chore(lint): enable ruff B007 (unused loop control variable) - #4818
Open
chalfontchubby wants to merge 2 commits into
Open
chore(lint): enable ruff B007 (unused loop control variable)#4818chalfontchubby wants to merge 2 commits into
chalfontchubby wants to merge 2 commits into
Conversation
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.
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.
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 outerminute = 0of the same name. Renaming the loop's own binding to_minuteexposed the outer assignment as its own genuinely dead store (only ever referenced from a commented-out debug line) - removed it.plan.py:5194'sslot_startinplan_iboost_smart()is unused because the loop body reads the outer loop'sminuteinstead of the inner loop's ownslot_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_starthere 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