ci(#89): replace flake8 with ruff across CI, pre-commit, and dependencies#91
Merged
ci(#89): replace flake8 with ruff across CI, pre-commit, and dependencies#91
Conversation
- Add [tool.ruff.lint] config block to parser-core with full E/W/F/B/C901/G/PLC/PLR/T201/BLE001/UP/RUF ruleset - Add [tool.ruff.lint.per-file-ignores] for __init__.py and tests in parser-core - Add [tool.ruff.lint] config block to parser-free with T201 per-file-ignores for app.py and PLC0415 for tests - Bump ruff version constraint from >=0.0.265 to >=0.8.0,<1.0.0 - Remove flake8>=6.0.0,<8.0.0 from parser-core dev dependencies - G004 added to ignore list in both configs (214 violations deferred) - F401 per-file-ignores from .flake8 migrated to ruff config
- Run ruff --fix resolving 229 auto-fixable violations (UP037 quoted annotations, UP006 old typing generics, UP045 Optional[X]->X|None, UP035 deprecated typing imports, UP015 redundant open modes, UP024 IOError->OSError, PLR5501 collapsible else-if, RUF021 chained ops, RUF100 stale noqa directives, F401/F841 in src files) - Run ruff --unsafe-fixes --select RUF022 to sort __all__ in 3 files - Run black and isort to restore consistent formatting - Delete .flake8 (F401 per-file-ignores already migrated to ruff config)
…oqa; create G004 issue #90 - init.py: replace 22 print() calls with _echo() helper using sys.stdout.write() - expense_analysis.py: narrow 3 bare except→(ValueError,TypeError); noqa BLE001 line 126 with justification - 24 files: per-site # noqa: PLC0415 for lazy/circular-dep imports - 20+ defs: per-site # noqa for C901/PLR0912/PLR0915/PLR0913 complexity - 11 class attrs: # noqa: RUF012 for mutable defaults - pyproject.toml: expanded per-file-ignores for tests; added E402 for shim - Created GitHub issue #90 for deferred G004 violations (214 sites) - ruff check exits 0 for all src+tests
… flake8 - Updated ruff repo URL from charliermarsh to astral-sh/ruff-pre-commit - Bumped rev from v0.0.265 to v0.8.0 - Changed hook id from ruff to ruff-check (current canonical id) - Removed flake8 hook block entirely - Updated comment to reflect ruff as primary linter
- Updated ci.yml header comments: flake8 -> ruff in lint-core and lint-free - Replaced Flake8 step with Ruff in lint-core job (ruff reads config from pyproject.toml) - Replaced Flake8 step with Ruff in lint-free job - Updated lint-free install step: pip install black isort ruff (was flake8) - Replaced flake8>=6.0.0 with ruff>=0.8.0,<1.0.0 in requirements/dev.txt - Removed .flake8 config file (fully superseded by [tool.ruff.lint] in pyproject.toml)
Auto-fix in Plan 01 removed noqa: F401 re-exports needed for test patching: - processor.py: restore parse_totals_columns and to_float (re-exported from utils/config) - app.py: restore get_columns_config (re-exported from column_config) All 1420 parser-core and 88 parser-free tests now pass.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request
Summary
Migrates linting from
flake8toruff(closes #89).ruff checkreplacesflake8in all CI jobs and pre-commit hooks. All 390 violations resolved — 229 auto-fixed, remainder fixed manually or suppressed with documented per-site# noqa. G004 (214 logging f-string violations) deferred to issue #90.Changes
packages/parser-core/pyproject.toml: add[tool.ruff]+[tool.ruff.lint]config (E, W, F, B, C901, G, PLC, PLR, T201, BLE001, UP, RUF); bump ruff to>=0.8.0,<1.0.0; remove flake8 dev dep; migrate.flake8per-file-ignorespackages/parser-free/pyproject.toml: matching ruff config with T201 exemption forapp.py.flake8: deleted — config fully migrated to pyproject.tomlcommands/init.py: replace 22print()calls with_echo()helper usingsys.stdout.write()(T201)services/expense_analysis.py: narrow 3 bareexcept Exceptionto(ValueError, TypeError); 1 service-boundary# noqa: BLE001with documented justification# noqa: PLC0415for lazy/circular-dep imports# noqafor C901/PLR complexity violations.pre-commit-config.yaml:charliermarsh/ruff-pre-commit v0.0.265->astral-sh/ruff-pre-commit v0.8.0; hook idruff->ruff-check; flake8 hook removed.github/workflows/ci.yml:flake8->ruff check src testsin both lint-core and lint-free jobs; install step updatedrequirements/dev.txt:flake8>=6.0.0,<8.0.0->ruff>=0.8.0,<1.0.0processor.py,app.py,pdf_table_extractor.py: restore backward-compat# noqa: F401re-exports removed by auto-fixType
Testing
ruff checkexits 0 across all src+testsmake docker-integrationpassed locallyChecklist
Downstream impact
bankstatements_core(exported class, function, or exception)Notes
selectlist (not added toignore) -- adding toignorewhen not selected triggers RUF100