Skip to content

chore: adopt ruff as the linter, replace flake8#1

Closed
shmulc8 wants to merge 1 commit into
feature/uv-migrationfrom
feature/ruff-linter
Closed

chore: adopt ruff as the linter, replace flake8#1
shmulc8 wants to merge 1 commit into
feature/uv-migrationfrom
feature/ruff-linter

Conversation

@shmulc8

@shmulc8 shmulc8 commented Jul 6, 2026

Copy link
Copy Markdown
Owner

Stacked on the uv migration (The-PR-Agent#2509). Base is feature/uv-migration so this diff shows only the ruff changes; retarget to upstream main once The-PR-Agent#2509 merges.

What

Consolidates linting on ruff and, crucially, makes it enforced — ruff was already configured in pyproject.toml but never run in CI.

  • Replace flake8 with ruff (pinned 0.15.20) in the dev group; enable the ruff pre-commit hook and drop the now-redundant isort hook (ruff sorts imports). The existing pre-commit.yml workflow now enforces linting on every PR.
  • Apply ruff's safe autofixes only: remove unused imports (F401), collapse f-strings without placeholders (F541), sort imports (I001) — 302 fixes across 72 files. Also removed a duplicate GiteaProvider import.
  • Defer pre-existing violations (E501, bare-except, bugbear rules, …) via an explicit lint.ignore list with a TODO to burn it down, so ruff runs green on adoption without a mass-churn reformat. F821 is scoped to pr_similar_issue.py (its optional deps are imported lazily).
  • Update AGENTS.md to run ruff check instead of flake8.

Deliberately NOT included

ruff format (repo-wide formatting) — that's a large diff best done as its own PR plus a .git-blame-ignore-revs entry.

Verification

  • ruff checkAll checks passed; ruff pre-commit hook passes.
  • PYTHONPATH=. uv run pytest tests/unittest1245 passed (autofixes broke nothing).

Follow-up debt (flagged, not fixed here)

  • F811 — two real redefinitions worth a look: a shadowed handle_github_webhooks in bitbucket_app.py:311 and a re-imported Request in azuredevops_server_webhook.py:18.
  • The lint.ignore list is the debt ledger — each entry is a rule to clean up and re-enable.

🤖 Generated with Claude Code

- Replace flake8 with ruff (pinned 0.15.20) in the dev group and enable the
  ruff pre-commit hook; drop the now-redundant isort hook (ruff sorts
  imports). The existing pre-commit CI workflow now actually enforces
  linting, which the configured-but-unused ruff never did.
- Apply ruff's safe autofixes: remove unused imports (F401), collapse
  f-strings without placeholders (F541), sort imports (I001) — 302 fixes
  across 72 files, tests still green.
- Defer pre-existing violations (E501, bare-except, bugbear rules, etc.)
  via an explicit ignore list with a TODO to burn it down, so ruff runs
  green on adoption without a mass-churn reformat. Scope F821 to the
  similar-issue tool's lazy optional imports.
- Update AGENTS.md to run `ruff check` instead of flake8.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ADg72cCmirPo9W3E74Htyk
@shmulc8 shmulc8 closed this Jul 6, 2026
@shmulc8 shmulc8 reopened this Jul 6, 2026
@shmulc8

shmulc8 commented Jul 6, 2026

Copy link
Copy Markdown
Owner Author

Superseded by The-PR-Agent#2511, opened natively in the upstream repo now that access is sorted.

@shmulc8 shmulc8 closed this Jul 6, 2026
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.

2 participants