lint/strict/python
ruff selects the baseline rule families
Implements lint/strict for python.
| Severity | warning |
| Tiers | 1, 2 |
| Stacks | python |
| Scope | each |
| Kind | expr |
| Source | library v0.3.1 |
| Selected by | fleetlint-recommended@v0.3.1 |
Requirement
The nearest ruff configuration ([tool.ruff.lint] in pyproject.toml, or ruff.toml) selects every family in params.required (pycodestyle, pyflakes, isort, bugbear, pyupgrade, simplify, blind-except, bandit, complexity, print) through select, extend-select or ALL, and does not ignore it.
Why
ruff’s default selection is a small subset; blind excepts, security findings and leftover prints are only reported when their families are selected.
Applies when
["", "../", "../../", "../../../"].exists(d, file(d + "ruff.toml") || file(d + ".ruff.toml")
|| (file(d + "pyproject.toml") && [toml(d + "pyproject.toml")].exists(p, p != null && has(p.tool) && has(p.tool.ruff))))Check
For each item in:
params.required[["", "../", "../../", "../../../"].map(d, [d + ".ruff.toml", d + "ruff.toml", d + "pyproject.toml"]).flatten()
.filter(f, file(f) && [toml(f)].exists(t, t != null && (!f.endsWith("pyproject.toml") || (has(t.tool) && has(t.tool.ruff)))))]
.exists(l, [l[0].endsWith("pyproject.toml") ? toml(l[0]).tool.ruff : toml(l[0])]
.exists(r, [has(r.lint) && r.lint != null ? r.lint : dyn({})].exists(lt,
(("select" in lt ? lt.select : ("select" in r ? r.select : ["E4", "E7", "E9", "F"]))
+ ("extend-select" in lt ? lt["extend-select"] : []) + ("extend-select" in r ? r["extend-select"] : []))
.exists(s, s == item || s == "ALL")
&& !(("ignore" in lt && item in lt.ignore) || ("ignore" in r && item in r.ignore)))))Parameters
required:[E F I B UP SIM BLE S C90 T20]
Fix
Add the missing families to select (or extend-select) under [tool.ruff.lint].
Agent instruction: Add each reported family to [tool.ruff.lint] select; ratchet the violations that appear with ruff check --add-noqa instead of fixing them in the same change.
fleetlint fix can apply this rule’s fix automatically (1 action(s)).
See: https://fleetlint.org/baseline/#static-analysis, https://fleetlint.org/stacks/#python
Generated by fleetlint docs from catalog v0.3.1.