Skip to content

Fix remaining 33 findings in #473 (ARG001/ARG002/RUF012/B007/RUF059/F841) - #480

Merged
squid-protocol merged 3 commits into
mainfrom
fix-473-ruff-arg-ruf012-b007-f841
Jul 25, 2026
Merged

squid-protocol merged 3 commits into
mainfrom
fix-473-ruff-arg-ruf012-b007-f841

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Summary

Closes out the remainder of #473 (S110's 22 findings were already fixed in #476). This covers the last 33 findings across ARG001, ARG002, RUF012, B007, RUF059, and F841.

Three of these turned out to be real bugs, not just lint noise -- each one is a parameter that a real caller passes a genuine value for, but the function silently ignores it, while an established sibling in the same file shows exactly what it should be doing instead. Confirmed the approach with the repo owner before wiring each one in:

  • signal_processor.py: _calc_concurrency/_calc_state_flux accepted the tier risk floor irc but never used it, unlike 4 sibling _calc_* methods that fold it into their density formula ((x + irc) / loc). Wired it in the same way.
  • language_lens.py: _tier_3_lexical_scan accepted claimed_lang but never used it, while its sibling gravity_lang gets an explicit raw_score *= 1.25 consensus boost right next to it. Gave claimed_lang the same boost.
  • cobol_jcl_forge.py: generate_zero_trust_jcl accepted corporate_header but never used it, while its sibling forge_schemas (called two lines earlier by the same caller) prepends it as a comment block. Mirrored that for JCL //* comment lines.

Everything else was one of:

  • Dead parameters removed outright (call sites and tests updated to match) -- detector.py's deep_scan/family, security_lens.py's policy/loc (with loc removed from every call site across galaxyscope.py, sbom_recorder.py, binary_anomaly_detector.py, vault_sentinel.py, and their tests), gpu_recorder.py's forensic_report/commit_hash/branch_name.
  • Genuine shared-interface params marked # noqa: ARG002 -- reason (matching this repo's existing noqa-with-rationale convention) -- sarif_recorder.py/sbom_recorder.py's generate_report() and language_lens.py's inspect(**kwargs), both part of a shared call shape dispatched from galaxyscope.py's Phase 12 recorder fan-out.
  • Mutable class-level constants annotated ClassVar (detector.py, security_auditor.py, analysis_lens.py).

tests/ruff_audit_baseline.json regenerated: 241 -> 152 findings (all remaining findings are pre-existing, out of #473's scope, tracked under #474/#475).

Closes #473

Test plan

  • ruff check --select ARG001,ARG002,RUF012,B007,RUF059,F841 gitgalaxy/ -- all clear
  • ruff format --check gitgalaxy/ -- all 79 files already formatted
  • python tests/ruff_audit.py --ci -- no new findings beyond the regenerated 152-finding baseline
  • Full test suite: pytest tests/ -- 866 passed, 1 pre-existing xfail

🤖 Generated with Claude Code

…841)

Closes the ARG/B007/RUF012/RUF059/F841 remainder of #473 (S110 was
already closed out in #476). Three findings turned out to be real bugs
where a parameter was accepted but never wired into an established
sibling formula, confirmed with the user before fixing:

- signal_processor.py: _calc_concurrency/_calc_state_flux ignored the
  tier risk floor `irc`, unlike 4 sibling _calc_* methods that fold it
  into their density formula. Wired it in identically.
- language_lens.py: _tier_3_lexical_scan ignored `claimed_lang` while
  its sibling `gravity_lang` gets a 1.25x consensus boost. Gave
  claimed_lang the same boost.
- cobol_jcl_forge.py: generate_zero_trust_jcl ignored `corporate_header`
  while its sibling forge_schemas (called two lines earlier by the same
  caller) prepends it as a comment block. Mirrored that for JCL output.

Everything else was dead parameters removed outright (call sites and
tests updated to match), genuine shared-interface params marked with
`# noqa: ARG002 -- reason` (matching the repo's existing noqa
convention), or mutable class-level constants annotated ClassVar.

Baseline regenerated: 241 -> 152 findings in ruff_audit_baseline.json.
Full test suite passes (866 passed, 1 pre-existing xfail).

Closes #473

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

squid-protocol and others added 2 commits July 25, 2026 19:47
… golden masters

CI's golden-crucible regression test caught a miscalibration in the irc
wiring from the previous commit: I mirrored _calc_cog_load's `irc/loc`
pattern, but concurrency/state_flux compute density on a pre-scaled
x100 percentage basis, so dividing irc by loc there blew up scores for
small files (e.g. one file jumped from 34.63% to 99.48%).

analysis_lens.py's tuning config already had an `irc_mult` key for both
categories (concurrency: 0.1, state_flux: 0.15), with threshold_base/
sigmoid_slope comments like "Lowered from 4.0" that only make sense if
irc_mult was meant to be consumed -- this was the actually-intended
formula, matching tech_debt's flat `irc * irc_weight` pattern rather
than cog_load's loc-divided one. Switched both to `density += irc *
tuning.get("irc_mult", ...)`, which produces the modest, proportional
deltas the tuning was calibrated for.

Verified locally against the language-crucible corpus in both
zero-dependency and full-precision mode (test_golden_crucible.py -m
golden_crucible), regenerated both golden masters, and reran the full
suite (866 passed, 1 pre-existing xfail).

Co-Authored-By: Claude Sonnet 5 <[email protected]>
The previous commit added two lines to signal_processor.py, shifting
an already-baselined PERF401 finding from line 2457 to 2459 -- the
known line-shift false-positive tests/ruff_audit.py's docstring
describes, not a new finding. No other findings changed.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@squid-protocol
squid-protocol merged commit c615c20 into main Jul 25, 2026
27 checks passed
@squid-protocol
squid-protocol deleted the fix-473-ruff-arg-ruf012-b007-f841 branch July 25, 2026 23:58
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.

[REFACTOR] Ruff: exception-handling and dead-code hygiene (S110, ARG, B007, RUF012/059, F841)

1 participant