chore(lint): widen ANN slack to 10% of baseline and drop PLR0913 from the strict gate - #31335
Conversation
…me ANN rules and PLR0913 Co-authored-by: Mateo Wang <mateo-berri@users.noreply.github.com>
|
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Co-authored-by: Mateo Wang <mateo-berri@users.noreply.github.com>
Greptile SummaryThis PR loosens the strict ruff gate's ANN-rule headroom to 10% of baseline, drops
Confidence Score: 5/5Safe to merge — changes are confined to lint infrastructure scripts, budget config, and their unit tests, with no production code affected. The change is a well-scoped lint-gate adjustment: widening headroom for annotation rules to unblock passthrough code, removing a broadly-tripping argument-count rule, and simultaneously strengthening the ratchet guard so the loosening is permanently visible. All three changes are explained, the new behavior is covered by 13 passing unit tests, and no production logic is touched. No files require special attention.
|
| Filename | Overview |
|---|---|
| ruff-strict-budget.json | Widens ANN rule slacks to 10% of baseline for high-volume rules (≥500 violations) and removes the PLR0913 entry entirely; baselines are unchanged. |
| ruff-strict.toml | Removes PLR0913 from the strict select list; all other rules are unchanged. |
| scripts/budget_ratchet_check.py | Hardens the non-gating ratchet guard to flag baseline increases even when slack is cut to keep the ceiling flat; adds _baselines() helper and _regression_detail() with dual-reason reporting. |
| tests/test_litellm/test_budget_ratchet_check.py | Adds two new tests for the baseline-increase detection; the previously-blessed "slack traded for baseline" case is correctly reclassified as a regression and moved to its own dedicated test. |
Reviews (2): Last reviewed commit: "fix(lint): ratchet-guard rising baseline..." | Re-trigger Greptile
…itellm_ann-plr0913-10pct-slack-4a6d Co-authored-by: Mateo Wang <mateo-berri@users.noreply.github.com>
…ask them Co-authored-by: Mateo Wang <mateo-berri@users.noreply.github.com>
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 2108850. Configure here.
92d0788
into
litellm_internal_staging
Relevant issues
Loosens the strict ruff gate so it stops blocking PRs that merely touch shared, dynamically-typed plumbing in passthrough/proxy code, and hardens the non-gating ratchet guard so the loosening is fully visible. Context is the GigaChat passthrough PR #25886, which was sitting 2 over both the ANN401 and PLR0913 caps even though the violations are inherent to httpx pass-through signatures and Python's generator protocol
Linear ticket
N/A
Type
🚄 Infrastructure
Changes
The strict ruff gate (
scripts/ruff_strict_gate.py) computes each rule's ceiling asbaseline + slackand is already grandfathered, so it only blames a change for net-new violations that push the whole-repo total past that ceiling. Three adjustments hereFirst, the slack for the high-volume ANN rules is bumped to 10% of baseline (rounded half up). "High-volume" is the set of ANN rules with a baseline at or above 500, which is also exactly the set that already carried slack of 20 or more; the smaller ANN rules (ANN002 at 64, ANN205 at 117, ANN206 at 120) are intentionally left untouched. Baselines are unchanged, so the ratchet still tightens normally via
make lint-budget-update; only the headroom growsSecond, PLR0913 (too-many-arguments) is removed from the strict gate entirely, both its budget entry and its slot in the
ruff-strict.tomlselect list. It is a broad rule that trips a large share of PRs, so the plan is to roll these rules out gradually rather than enforce everything at once. It can be re-added later once the codebase is in better shape. There are no existing# noqa: PLR0913suppressions, so removing it from select does not create any unused-noqa (RUF100) failuresThird, the non-gating ratchet guard (
scripts/budget_ratchet_check.py) is hardened. It already flagged a raised ceiling, a dropped rule, and a deleted budget file, but a baseline increase that was masked by an equal slack cut (ceiling held flat) slipped through; in fact the old tests explicitly blessed that case. Sincebaselineis itself meant to be a one-way downward ratchet (the docstring's own banned-API example is a baseline that should turn the check red), the guard now also fails when a rule's baseline rises on its own, and reports both reasons when a ceiling and a baseline rise together. Rule-removal and file-deletion detection are unchangedWorth noting for contributors: these violations can already be suppressed inline with
# noqa: <CODE> <reason>, which drops them out of the gate's count. ruff honors the suppression and does not flag it as an unused noqa, so a justified noqa is a valid escape hatch for the genuinely unavoidable cases (for example thesend/throwgenerator-protocolAnys). A bare# noqawithout codes or a reason is itself caught by the custom LIT003 check, so the reason is not optionalScreenshots / Proof of Fix
Strict gate passes on this branch:
Ratchet guard now catches a baseline bump that keeps the ceiling flat (unit tests, 13 passing):
The widened ANN401 cap clears the total that PR #25886 currently breaches (1938 < 2075), and PLR0913 is no longer gated at all. The
budget-ratchetjob is expected to be red on this PR by design (it is non-gating and exists precisely to make this loosening obvious in review)Slack Thread