hermes - 💡(How to fix) Fix tracker: ruff complexity reduction (C, PLR) — PR-to-lint mapping

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Code Example

$ ruff check --select C,PLR --statistics
857  PLR2004  magic-value-comparison
807  C901     complex-structure
522  PLR0912  too-many-branches
398  PLR0915  too-many-statements
339  PLR1702  too-many-nested-blocks
320  PLR6301  no-self-use
314  PLR0911  too-many-return-statements
281  PLR0914  too-many-locals
223  PLR0913  too-many-arguments
140  PLR0917  too-many-positional-arguments
 25  PLR1714  repeated-equality-comparison
 20  PLR6104  non-augmented-assignment
  9  PLR0916  too-many-boolean-expressions
  7  PLR0904  too-many-public-methods
  1  PLR0124  comparison-with-itself
  1  PLR6201  literal-membership
─────────────────────────
4,264 total
RAW_BUFFERClick to expand / collapse

Phase 1 — Mechanical auto-fixes

PRCategoryWhatCountFilesStatus
#23926PLR5501, PLR1730, C420, PLR1704, C414if/else → early return, useless else, sorted(list()), shadow variable, redundant set literal4628✅ Merged
#23937PLR6201in (...)in {...} literal-membership608133✅ Merged
#23940C401, C416, C408, PLR1722Unnecessary comprehensions, list()/dict() vs literal, class Foo:class Foo2119✅ Merged

Total auto-fixed: 675 issues across 180 files.


Phase 2 — Structural refactoring (C901 complexity)

codex_responses_adapter.py (4 PRs, stacked)

PRFunctionComplexityStatus
#23951_chat_messages_to_responses_input45 → <10Open
#23952_preflight_codex_input_items51 → <10Open
#23954_preflight_codex_api_kwargs36 → 21Open
#23957_normalize_codex_response37 → 18Open

anthropic_adapter.py

PRFunctionComplexityStatus
#23968convert_messages_to_anthropic79 → 10Open

Total C901 eliminated: ~179 points (248 → ~69) across 5 functions.


Current state

$ ruff check --select C,PLR --statistics
857  PLR2004  magic-value-comparison
807  C901     complex-structure
522  PLR0912  too-many-branches
398  PLR0915  too-many-statements
339  PLR1702  too-many-nested-blocks
320  PLR6301  no-self-use
314  PLR0911  too-many-return-statements
281  PLR0914  too-many-locals
223  PLR0913  too-many-arguments
140  PLR0917  too-many-positional-arguments
 25  PLR1714  repeated-equality-comparison
 20  PLR6104  non-augmented-assignment
  9  PLR0916  too-many-boolean-expressions
  7  PLR0904  too-many-public-methods
  1  PLR0124  comparison-with-itself
  1  PLR6201  literal-membership
─────────────────────────
4,264 total

Remaining C901 elephants

ComplexityFunctionFile
408run_conversationrun_agent.py
262_run_agentgateway/run.py
168AIAgent.__init__run_agent.py
122_cmd_update_implhermes_cli/main.py
84run_syncgateway/run.py
72resolve_provider_clientagent/auxiliary_client.py
46start_gatewaygateway/run.py
39_handle_max_iterationsrun_agent.py
37_watch_update_progress + send_progress_messagesgateway/run.py
36_run_agent_via_proxygateway/run.py
35maincli.py
34_get_clarify_displaycli.py
31build_anthropic_kwargsanthropic_adapter.py

Pending auto-fix categories (low-hanging fruit)

CategoryCountRisk
PLR2004857High noise — only file individual issues for domain-significant magic numbers
PLR6301320Method → function extraction (no-self-use)
PLR1702339Nested block reduction (needs manual refactor, not auto-fix)

Strategy

  1. Continue structural refactoring — target the remaining C901 elephants above
  2. After structural series completes — evaluate PLR6301 (no-self-use) auto-fix batch
  3. PLR2004 — skip bulk; file individual issues only for domain-significant magic numbers

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING