Repository navigation
Description
Objective
Part of the ruff lint baseline cleanup (PERF203 -- try/except inside a loop body). Chunked out of the larger sub-issue this replaces, so it's a manageable, self-contained pickup.
Findings
gitgalaxy/cobol_to_java_controller.py:221(PERF203) --try-exceptwithin a loop incurs performance overheadgitgalaxy/cobol_to_java_controller.py:303(PERF203) --try-exceptwithin a loop incurs performance overheadgitgalaxy/metrics/chronometer.py:424(PERF203) --try-exceptwithin a loop incurs performance overheadgitgalaxy/metrics/statistical_auditor.py:312(PERF203) --try-exceptwithin a loop incurs performance overheadgitgalaxy/security/security_auditor.py:424(PERF203) --try-exceptwithin a loop incurs performance overheadgitgalaxy/tools/cobol_to_cobol/cobol_compiler_forge.py:207(PERF203) --try-exceptwithin a loop incurs performance overheadgitgalaxy/tools/network_auditing/full_api_network_map.py:333(PERF203) --try-exceptwithin a loop incurs performance overheadgitgalaxy/tools/network_auditing/full_api_network_map.py:351(PERF203) --try-exceptwithin a loop incurs performance overheadgitgalaxy/tools/supply_chain_security/binary_anomaly_detector.py:204(PERF203) --try-exceptwithin a loop incurs performance overheadgitgalaxy/tools/supply_chain_security/vault_sentinel.py:145(PERF203) --try-exceptwithin a loop incurs performance overheadgitgalaxy/tools/terabyte_log_scanning/terabyte_log_scanner.py:153(PERF203) --try-exceptwithin a loop incurs performance overhead
Approach
Moving the try outside the loop can change error-isolation semantics -- one bad iteration currently doesn't kill the rest of the batch in most of these call sites (per-file/per-item fault isolation is a deliberate pattern elsewhere in this codebase). Confirm each loop body's fault-isolation intent before restructuring; some of these may be correctly left as-is with a # noqa: PERF203 and a one-line comment explaining why, rather than mechanically hoisted.
Fix in a small PR, removing resolved entries from tests/ruff_audit_baseline.json (see tests/ruff_audit.py's module docstring for the regen command).
Parent: #469
Activity