Repository navigation
ci(crate-gate): enforce RUST-018 workspace lint inheritance - #1931
Merged
Merged
Conversation
`[workspace.lints.clippy]` already pins `cognitive_complexity` and `too_many_lines` at `warn`, and all 21 workspace members declare `[lints] workspace = true` (#1639, RUST-018). Nothing asserted either fact: a member that dropped that one line would silently opt out of both ratchets while the report still showed zero debt, and downgrading the workspace level to `allow` removed the ratchet with no diff to review beyond one word. Extend the existing monocrate batch gate (`ci/check_workspace_crates.py`, run by `crate-gate.yml`) with `lint_inheritance_errors()`: - `[workspace.lints.clippy]` must still declare both ratchet lints and must not set either to `allow`/`off` (stricter levels are accepted); - every `[workspace] members` manifest must inherit, accepting both cargo spellings (`[lints] workspace = true` and `lints.workspace = true`); - comments are blanked quote-aware, so a commented-out `workspace = true` or a trailing `# pinned` comment cannot fake a pass. Tests live in the module the registry already maps to this gate (`ci/test_crate_guard_parity.py`), so no registry change is needed.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
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.
Why
#1639 (RUST-018) is done in content but unguarded in policy:
Cargo.tomlpins[workspace.lints.clippy]cognitive_complexity = "warn"andtoo_many_lines = "warn";[workspace] membersdeclare[lints] workspace = true(verified: 20crates/*+bench/fastled-examples).Nothing in CI asserted either fact. Two silent failures were reachable:
[lints] workspace = true— that crate stops being checked by both ratchets, and the debt report still reads zero;"allow"— one word removes the ratchet from every crate.What changed
ci/check_workspace_crates.py(the monocrate batch gate already run bycrate-gate.yml) gainslint_inheritance_errors():[workspace.lints.clippy]must still declare both ratchet lints atwarnor stricter (allow/offfails, naming the lint and pointing at#[expect(..., reason = ...)]as the sanctioned suppression);[lints] workspace = trueand dottedlints.workspace = true);# [lints]/# workspace = truecannot fake a pass, while a trailing# RUST-018comment on a real line is tolerated.--jsonnow carrieslint_inheritance. Tests go intoci/test_crate_guard_parity.py, the moduleci/gate_script_tests.tomlalready maps to this gate — no registry or workflow change (the gate is already invoked, so no new untested gate,MAX_UNTESTEDstays 0).Evidence (real runs, this branch)
RED proven both directions against the real tree (then reverted):
[lints]\nworkspace = truefromcrates/fbuild-serial/Cargo.toml→::error::Workspace member 'crates/fbuild-serial' does not inherit the workspace lints…, RC=1;cognitive_complexity = "allow"in the root manifest →::error::… sets cognitive_complexity = "allow", which switches the RUST-018 ratchet off…, RC=1.Mutation proof on the tests:
inherits_workspace_lints -> return Truefails 3 tests;elif level in ESCAPING_LEVELS -> elif Falsefails exactly the downgrade test.Scope
Part of #1639 (the RUST-018 inheritance/ratchet half). Python-side PY-004 (ruff C901/RUF100 over every tracked file) is already implemented and guarded by
ci/check_python_complexity.py+ its test; no change needed here. No new crate, no new workflow, no threshold raised. Unmerged by design — Zach merges.