Skip to content

chore(lint): clear ruff SIM/UP backlog (#469 cluster) — closes #491/#492/#493/#496/#497/#503 - #2920

Merged
squid-protocol merged 1 commit into
mainfrom
chore/ruff-sim-up-cleanup
Sep 9, 2026
Merged

squid-protocol merged 1 commit into
mainfrom
chore/ruff-sim-up-cleanup

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

What

Clears the auto-fixable ruff lint backlog tracked by the #469 baseline-cleanup epic, bundled into one PR because the fixes share tests/ruff_audit_baseline.json (regenerated once here) and several source files overlap. Lint run with ruff==0.16.0 to match CI.

Rule Issue Change
SIM118 #496 Drop redundant .keys() in membership / iteration
UP045 #503 Optional[X] → X | None (+ remove now-unused Optional import)
SIM102 #491 #492 #493 Combine nested ifs with and
SIM108 #497 if/else assignment → ternary

How

  • 16 sites fixed via ruff check --select SIM102,SIM108,SIM118,UP045 --fix --unsafe-fixes. These rules are unsafe-classified in 0.16.0, so every hunk was reviewed by hand for behavioral equivalence and comment preservation (short-circuit semantics unchanged; no dropped comments).
  • 4 further sites combined by hand (ruff offered no fix): aperture.py, llm_recorder.py, language_lens.py, binary_anomaly_detector.py.
  • 3 sites kept nested with # noqa: <rule> — rationale because merging would drop an explanatory inline comment or duplicate an existing condition: signal_processor.py (SIM108, 80%-reduction comment), full_api_network_map.py (SIM102, suffix-match comment), language_lens.py (SIM102, redundant SAFE_WRAPPERS guard).
  • ruff_audit_baseline.json regenerated: 70 → 47 keys.

Verification

  • python tests/ruff_audit.py --ci → no new findings beyond the 47-key baseline, ruff format --check clean.
  • Full pytest suite: 8667 passed; the only failures are pre-existing security_auditor tests that need xgboost (absent from the local venv, unrelated to this change).
  • Baseline diff reviewed: removed keys are exactly the 23 resolved SIM/UP findings; remaining changes are benign line-shifts of out-of-scope findings.

Closes #491, closes #492, closes #493, closes #496, closes #497, closes #503

🤖 Generated with Claude Code

https://claude.ai/code/session_01QBL6TAMVXRUY7iQyy9Ysvi

…ter)

Resolves the auto-fixable ruff findings tracked by the #469 baseline-cleanup
epic, combined into one PR because they share tests/ruff_audit_baseline.json
(regenerated once here) and several source files overlap.

- SIM118 (#496): drop redundant .keys() in membership / iteration
- UP045 (#503): Optional[X] -> X | None; drop the now-unused Optional import
- SIM102/SIM108 (#491, #492, #493, #497): combine nested ifs / use ternaries.
  16 sites via `ruff --fix --unsafe-fixes` (every hunk reviewed for behavior
  and comment preservation); 4 further sites combined by hand; 3 sites kept
  nested with `# noqa` + rationale because merging would drop an explanatory
  inline comment or duplicate an existing condition.

Lint pinned to ruff==0.16.0 to match CI. tests/ruff_audit_baseline.json
regenerated 70 -> 47 keys; `python tests/ruff_audit.py --ci` passes (no new
findings, format clean).

Closes #491
Closes #492
Closes #493
Closes #496
Closes #497
Closes #503

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01QBL6TAMVXRUY7iQyy9Ysvi
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

@squid-protocol
squid-protocol merged commit f042a79 into main Sep 9, 2026
30 checks passed
@squid-protocol
squid-protocol deleted the chore/ruff-sim-up-cleanup branch September 9, 2026 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant