Skip to content

Remove flake8 and replace with ruff#1686

Merged
bdraco merged 1 commit into
esphome:mainfrom
bluetoothbot:koan/implement-1685
May 20, 2026
Merged

Remove flake8 and replace with ruff#1686
bdraco merged 1 commit into
esphome:mainfrom
bluetoothbot:koan/implement-1685

Conversation

@bluetoothbot
Copy link
Copy Markdown
Contributor

@bluetoothbot bluetoothbot commented May 20, 2026

Summary

Remove flake8 from the linter stack — ruff already covers every check flake8 was doing here (E/F/W codes via select = ["E", "F", ...] in pyproject.toml) and CI was running both back-to-back.

Closes #1685

Changes

  • Drop flake8==7.3.0 from requirements/test.txt.
  • Delete the [flake8] section in setup.cfg (kept [bdist_wheel]).
  • Remove the Lint with flake8 step in .github/workflows/ci.yml and the corresponding flake8.json problem-matcher registration.
  • Delete .github/workflows/matchers/flake8.json.
  • Swap flake8 aioesphomeapi in script/lint for ruff check + ruff format --check.
  • Replace the file-level # flake8: noqa and per-line # noqa: F401 in aioesphomeapi/__init__.py with a single # ruff: noqa: F401, F403 header (covers the from .model import * re-export). ruff --fix re-sorted the alphabetised import list as a side effect.

Test plan

  • ruff check aioesphomeapi tests — clean.
  • ruff format --check aioesphomeapi tests — 55 files already formatted.
  • pytest tests/ — 1075 passed, 2 skipped.

Generated by Kōan /implement


Quality Report

Changes: 6 files changed, 8 insertions(+), 58 deletions(-)

Code scan: clean

Tests: failed (FAILED)

Branch hygiene: clean

Generated by Kōan post-mission quality pipeline

Drop flake8 (==7.3.0) from requirements/test.txt, delete the
[flake8] section in setup.cfg, remove the CI lint step and its
problem matcher, and swap the legacy script/lint flake8 call for
ruff check + format. The flake8-style file-level/line-level noqa
markers in aioesphomeapi/__init__.py become a single
`# ruff: noqa: F401, F403` header; ruff --fix re-sorts the
re-export list as a side effect.

Closes esphome#1685
@codecov
Copy link
Copy Markdown

codecov Bot commented May 20, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (40ef803) to head (4b550c3).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #1686   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           25        25           
  Lines         4152      4152           
=========================================
  Hits          4152      4152           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented May 20, 2026

Merging this PR will not alter performance

✅ 40 untouched benchmarks


Comparing bluetoothbot:koan/implement-1685 (4b550c3) with main (40ef803)

Open in CodSpeed

@bdraco bdraco marked this pull request as ready for review May 20, 2026 12:03
Copilot AI review requested due to automatic review settings May 20, 2026 12:03
@bdraco bdraco merged commit dc32bd4 into esphome:main May 20, 2026
16 checks passed
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 20, 2026

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: bdd05ea8-b3db-4029-96f0-825411283296

📥 Commits

Reviewing files that changed from the base of the PR and between 40ef803 and 4b550c3.

📒 Files selected for processing (6)
  • .github/workflows/ci.yml
  • .github/workflows/matchers/flake8.json
  • aioesphomeapi/__init__.py
  • requirements/test.txt
  • script/lint
  • setup.cfg

Walkthrough

This PR removes flake8 as the linting tool and replaces it with ruff throughout the repository. Configuration files (setup.cfg, CI workflows, test dependencies) are updated; the lint script is switched to use ruff check and format; and code pragmas are updated from flake8 to ruff with explicit rule codes.

Changes

Flake8 to Ruff Linting Migration

Layer / File(s) Summary
Configuration and dependency cleanup
setup.cfg, .github/workflows/ci.yml, requirements/test.txt
Flake8 configuration block removed from setup.cfg; CI problem-matcher registration updated to include only pylint, mypy, and pytest; flake8 dependency removed from test requirements.
Lint script tooling replacement
script/lint
Flake8 invocation replaced with ruff check and ruff format --check for both aioesphomeapi and tests directories.
Module pragma and import reordering
aioesphomeapi/__init__.py
Module-level linting pragma updated from flake8: noqa to ruff: noqa with explicit rule codes (F401, F403); exception/error symbols from .core and .log_parser are reordered while preserving exported names.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes flake8 from the repository’s linting toolchain and relies on Ruff (plus existing tooling) for CI and local lint workflows, reducing duplicated lint runs.

Changes:

  • Removes the flake8 configuration and dependency (setup.cfg, requirements/test.txt).
  • Updates CI to stop registering/running flake8 and deletes the flake8 problem matcher (.github/workflows/ci.yml, matcher JSON).
  • Updates local lint script to use ruff check and ruff format --check, and adjusts aioesphomeapi/__init__.py Ruff ignore directives.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
setup.cfg Removes [flake8] configuration, retaining wheel settings.
script/lint Replaces flake8 invocation with ruff check and ruff format --check.
requirements/test.txt Drops flake8 from test/lint dependencies.
aioesphomeapi/init.py Replaces flake8 no-qa directives with Ruff equivalents and reorders imports.
.github/workflows/matchers/flake8.json Deletes the flake8 problem matcher file.
.github/workflows/ci.yml Removes flake8 matcher registration and the flake8 lint step.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread script/lint
Comment on lines +8 to 10
ruff check aioesphomeapi tests
ruff format --check aioesphomeapi tests
isort aioesphomeapi tests
Comment thread .github/workflows/ci.yml
Comment on lines 83 to 85
- run: ruff format --check aioesphomeapi tests
name: Check ruff formatting
if: ${{ matrix.python-version == '3.14' && matrix.extension == 'skip_cython' && matrix.os == 'ubuntu-latest' }}
@bluetoothbot bluetoothbot deleted the koan/implement-1685 branch May 20, 2026 12:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove flake8 from this repo and replace it with ruff

3 participants