Remove flake8 and replace with ruff#1686
Conversation
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 Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (6)
WalkthroughThis 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. ChangesFlake8 to Ruff Linting Migration
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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 checkandruff format --check, and adjustsaioesphomeapi/__init__.pyRuff 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.
| ruff check aioesphomeapi tests | ||
| ruff format --check aioesphomeapi tests | ||
| isort aioesphomeapi tests |
| - run: ruff format --check aioesphomeapi tests | ||
| name: Check ruff formatting | ||
| if: ${{ matrix.python-version == '3.14' && matrix.extension == 'skip_cython' && matrix.os == 'ubuntu-latest' }} |
Summary
Remove flake8 from the linter stack — ruff already covers every check flake8 was doing here (E/F/W codes via
select = ["E", "F", ...]inpyproject.toml) and CI was running both back-to-back.Closes #1685
Changes
flake8==7.3.0fromrequirements/test.txt.[flake8]section insetup.cfg(kept[bdist_wheel]).Lint with flake8step in.github/workflows/ci.ymland the correspondingflake8.jsonproblem-matcher registration..github/workflows/matchers/flake8.json.flake8 aioesphomeapiinscript/lintforruff check+ruff format --check.# flake8: noqaand per-line# noqa: F401inaioesphomeapi/__init__.pywith a single# ruff: noqa: F401, F403header (covers thefrom .model import *re-export).ruff --fixre-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