Repository navigation
chore(perf): clear ruff PERF401 & PERF203 backlog — closes #490, #495 - #2921
Merged
Merged
Conversation
Resolves the PERF401 (#490) and PERF203 (#495) findings tracked by the #469 lint-baseline epic. Analysis was done with per-site review (a fan-out of higher-effort agents over the actual code), because neither rule is a blind mechanical fix. - PERF401 (#490): 6 manual `for`+`append` -> comprehension/`.extend()` rewrites. All are pure mappings with no side effects/filtering/try, so the rewrites are behavior-preserving. ruff offers no autofix for these, so each was written and reviewed by hand. - PERF203 (#495): 11 `try/except`-in-loop sites. 10 are INTENTIONAL per-iteration fault isolation (skip a bad file/artifact, continue the batch); hoisting the try would turn one bad item into a whole-batch abort. The 11th (terabyte_log_scanner.py) exits the process in its `except`, so the loop-level try cost is moot. All 11 are kept and documented with `# noqa: PERF203 -- <why>` rather than mechanically "fixed". Lint pinned to ruff==0.16.0. tests/ruff_audit_baseline.json regenerated 70 -> 53; `python tests/ruff_audit.py --ci` passes (no new findings, format clean). Closes #490 Closes #495 Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01QBL6TAMVXRUY7iQyy9Ysvi
# Conflicts: # tests/ruff_audit_baseline.json
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Clears the PERF401 (#490) and PERF203 (#495) ruff findings from the #469 lint-baseline epic. Neither rule is a blind mechanical fix, so each site was reviewed against the actual code (via a fan-out of higher-effort review agents).
PERF401 (#490) — 6 sites, rewritten by hand
ruff offers no autofix for these. All are pure
for+appendmappings (no side effects / filtering / try), sofor→comprehension/.extend()is behavior-preserving:cobol_refractor_controller.py,recorders/audit_recorder.py,recorders/sbom_recorder.py,standards/language_lens.py,tools/cobol_to_cobol/cobol_jcl_forge.py,tools/cobol_to_java/cobol_to_java_agent_forge.py.PERF203 (#495) — 11 sites, documented not "fixed"
The naive fix (hoist
tryout of the loop) would destroy fault isolation — turning "skip one bad file, continue the batch" into "abort the whole batch on the first error". Per-site review found:# noqa: PERF203 -- <why>explaining the isolation.terabyte_log_scanner.py)sys.exit()s in itsexcept, so the loop-leveltrycost is moot → kept + noqa.Verification
python tests/ruff_audit.py --ci→ no new findings beyond the regenerated 53-key baseline (was 70);ruff format --checkclean. Pinned ruff==0.16.0.security_auditortest needingxgboost(absent from the local venv, unrelated — that file only gained a comment here).Closes #490, closes #495
🤖 Generated with Claude Code
https://claude.ai/code/session_01QBL6TAMVXRUY7iQyy9Ysvi