Skip to content

chore(lint): enable ruff B007 (unused loop control variable) - #4818

Open
chalfontchubby wants to merge 2 commits into
mainfrom
chore/ruff-b007
Open

chore(lint): enable ruff B007 (unused loop control variable)#4818
chalfontchubby wants to merge 2 commits into
mainfrom
chore/ruff-b007

Conversation

@chalfontchubby

Copy link
Copy Markdown
Collaborator

Summary

Enables ruff's B007 (loop control variable not used within the loop body). 29 violations, mostly a mechanical rename to _name - the loop still iterates identically, only the binding name changes.

Two needed judgement rather than a blind rename:

  • utils.py:1478's loop variable shadowed an outer minute = 0 of the same name. Renaming the loop's own binding to _minute exposed the outer assignment as its own genuinely dead store (only ever referenced from a commented-out debug line) - removed it.
  • plan.py:5194's slot_start in plan_iboost_smart() is unused because the loop body reads the outer loop's minute instead of the inner loop's own slot_start - so the intended per-slot rate averaging is a silent no-op. That's a real behavioural bug, not a style issue, so it's out of scope for a lint-enablement PR: filed as iBoost smart planning doesn't actually average the rate across the min-length window #4817 with the fix described there. Renamed to _slot_start here only to satisfy the lint rule, without changing behaviour.

Test plan

  • ruff check --select=F401,E713,F811,E722,F821,F841,B007 - clean
  • ./run_all --quick - passes
  • ./run_pre_commit - clean

🤖 Generated with Claude Code

chalfontchubby and others added 2 commits August 28, 2026 20:44
29 violations, mostly a mechanical rename to _name (loop still iterates
the same way, only the binding name changes - zero behaviour change).

Two required judgement rather than a blind rename:

- utils.py:1478's loop variable shadowed an outer `minute = 0` of the same
  name. Renaming the loop's binding to `_minute` exposed the outer
  assignment as its own genuinely dead store (only referenced from a
  commented-out debug line) - removed it.
- plan.py:5194's `slot_start` in plan_iboost_smart() is unused because the
  loop body reads the outer loop's `minute` instead - filed as #4817, a
  real bug (the intended per-slot rate averaging is a no-op). Renamed to
  `_slot_start` here to satisfy the lint rule without changing behaviour;
  the actual fix belongs in its own PR.
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.

2 participants