Repository navigation
Description
Objective
Part of the ruff lint baseline cleanup (several 1-2 count rule families -- C401 (unnecessary generator where a builtin call would do), C403 (unnecessary list comprehension where a set/generator would do), C414 (redundant cast (e.g. list()/sorted() double-wrapping)), C416 (unnecessary comprehension that just rebuilds the same collection), C419 (unnecessary comprehension inside a call that takes an iterable directly), PERF102 (iterating .items() when only keys or only values are used), RUF005 (list concatenation via + instead of unpacking), RUF015 (allocating a full list just to grab the first element), SIM105 (try/except/pass that could be contextlib.suppress(...))). Chunked out of the larger sub-issue this replaces, so it's a manageable, self-contained pickup.
Findings
gitgalaxy/core/detector.py:2158(C403) -- Unnecessary list comprehension (rewrite as a set comprehension)gitgalaxy/core/guidestar_lens.py:139(C401) -- Unnecessary generator (rewrite as a set comprehension)gitgalaxy/core/network_risk_sensor.py:183(C419) -- Unnecessary list comprehensiongitgalaxy/metrics/signal_processor.py:498(RUF046) -- Value being cast tointis already an integergitgalaxy/metrics/signal_processor.py:549(C419) -- Unnecessary list comprehensiongitgalaxy/recorders/audit_recorder.py:290(C416) -- Unnecessary dict comprehension (rewrite usingdict())gitgalaxy/recorders/audit_recorder.py:307(C414) -- Unnecessarylist()call withinsorted()gitgalaxy/recorders/gpu_recorder.py:285(C414) -- Unnecessarylist()call withinsorted()gitgalaxy/recorders/record_keeper.py:700(RUF005) -- Consider iterable unpacking instead of concatenationgitgalaxy/recorders/record_keeper.py:771(RUF005) -- Consider iterable unpacking instead of concatenationgitgalaxy/security/security_auditor.py:359(RUF046) -- Value being cast tointis already an integergitgalaxy/standards/language_lens.py:132(SIM105) -- Usecontextlib.suppress(re.error)instead oftry-except-passgitgalaxy/standards/language_lens.py:760(PERF102) -- When using only the values of a dict use thevalues()methodgitgalaxy/standards/language_lens.py:897(PERF102) -- When using only the values of a dict use thevalues()methodgitgalaxy/tools/cobol_to_cobol/cobol_jcl_auditor.py:107(RUF015) -- Prefernext(iter(generated_metrics["exec_pgms"]))over single element slice
Approach
Each of these rules only has 1-2 occurrences, so they're bundled into one grab-bag rather than filed as individual one-line issues. Each finding is independent -- fix whichever you like, in any order.
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
squid-protocol commentedon Aug 9, 2026
FYI while doing a pass to check for staleness across the "good first issue" label: 2 of the 15 findings listed here have already been fixed incidentally (no longer flagged by
ruff check, no longer in the baseline) -- looks like a side effect of unrelated edits to these files, not a targeted fix:gitgalaxy/core/network_risk_sensor.py(was:183) C419gitgalaxy/metrics/signal_processor.py(was:549) C419The other 13 findings across the remaining files are still live and confirmed against a fresh
ruff check(pinned 0.16.0) + the current baseline. Whoever picks this up can drop those two from the findings list -- nothing else to do for them specifically, they just won't show up when you go looking.