Skip to content

Lint: align advisory flake8 with black (99), clear the E501/F84x backlog — closes #318 - #319

Merged
chigwell merged 2 commits into
chigwell:mainfrom
axisrow:lint/align-flake8-black
Oct 16, 2026
Merged

chigwell merged 2 commits into
chigwell:mainfrom
axisrow:lint/align-flake8-black

Conversation

@axisrow

@axisrow axisrow commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

Closes #318.

What this does

1. Aligns the advisory flake8 pass with the project's own black config (line-length 99).

The advisory run used --max-line-length=88 while black --check . (blocking) enforces 99 — so every black-formatted line of length 89–99 was a permanent finding. Advisory findings on main: 1,184. After alignment alone: 195.

Config is now codified in a checked-in .flake8 (flake8 does not read pyproject.toml, so the [tool.flake8] section there was dead — and had it been read, it would have ignored E501 entirely):

  • max-line-length = 99 (matches [tool.black])
  • extend-ignore = E203, W503 — black-style conflicts
  • extend-ignore = F401, F403, F405 — the deliberate star-import re-export pattern (main.py/runner.py re-export runtime/tools; every tool module resolves names through it) — hundreds of hits, zero signal
  • per-file-ignores: telegram_mcp/runtime.py: E402 — imports there follow env/lock setup on purpose

The advisory CI step now just runs flake8 . --count --exit-zero --statistics and reads .flake8.

2. Clears the remaining non-complexity backlog (94 E501, 11 F841, 6 F811, 6 F541):

  • long docstrings/comments and over-long string literals wrapped — string content unchanged (implicit concatenation)
  • dead local bindings removed (result = await ... where the result was never read)
  • shadowed duplicate test definitions in tests/test_runner.py removed (the newer duplicate of each shadowed test is the one that actually ran — the dead earlier definitions are deleted)
  • f-prefix dropped from f-strings without placeholders

Result

before after
advisory findings (flake8 ., exit-zero) 1,184 56
of which complexity (C901) ~60 56
blocking black --check . ✅ ✅
blocking flake8 --select=E9,F63,F7,F82 ✅ ✅
pytest ✅ ✅ 1221 passed

The 56 remaining C901 hotspots are left visible on purpose — they are a refactoring backlog (worst: message_to_dict at 45, validate_id at 29), not something to churn in a lint PR. From here the advisory count is small enough to keep honestly near zero.

Verification

flake8 . --count --exit-zero --statistics   # 56, all C901
black --check .                             # clean
pytest -q                                   # 1221 passed

🤖 Generated with Claude Code

axisrow and others added 2 commits October 17, 2026 03:04
The advisory flake8 pass used --max-line-length=88 while the project's
black enforces 99, so every black-formatted line of length 89-99 was a
permanent finding: 1,184 advisory findings on main, none actionable.

- add .flake8 (line-length 99, E203/W503 black-compat, F401/F403/F405
  for the star-import re-export pattern, E402 per-file for runtime.py)
- drop the inert [tool.flake8] section from pyproject.toml (flake8 does
  not read pyproject.toml; if it did, that section ignored E501 itself)
- advisory CI run now reads .flake8 instead of repeating CLI flags

Co-Authored-By: Claude Code <[email protected]>
Fixes every non-complexity finding the advisory run reported at
line-length 99 (94 E501, 11 F841, 6 F811, 6 F541):

- wrap long docstrings/comments and over-long string literals
  (string content unchanged, implicit concatenation only)
- drop dead local bindings and shadowed duplicate test definitions
  (test_runner.py kept the newer duplicate of each shadowed test)
- drop f-prefixes from f-strings without placeholders

The remaining 56 C901 complexity hotspots are left visible on purpose:
they are a refactoring backlog, not a formatting fix.

Co-Authored-By: Claude Code <[email protected]>
@chigwell
chigwell merged commit e0f4f9c into chigwell:main Oct 16, 2026
4 checks passed
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.

Lint: advisory flake8 pass reports 1,184 findings on main; aligning it with black's line-length=99 would cut it to 139

2 participants