What this thread does
Do first: run ruff --version and ruff check --show-settings path/to/an_existing_file.py to identify the effective configuration before changing rules.
Short answer
As of November 2026, this card pins Ruff 0.17.4. Put lint and format settings in the nearest applicable configuration; parent settings do not merge automatically without explicit extension (configuration). Keep intended rule families, remove formatter conflicts, apply lint fixes, then format. Formatting does not sort imports.
Choose / don't choose
- Explicit rule families: choose a deliberate baseline and retain project policy; don't replace an existing policy with a smaller example merely to obtain a clean exit.
- Per-file suppression: choose
lint.per-file-ignoresfor a repeated, justified file-pattern policy; don't disable the same rule globally for one exception. - Inline suppression: choose
# noqa: F841for one intentional unused local; don't use bare# noqato hide every diagnostic on that line (suppression scope).
Not for: mypy pre-commit integration; see ruff-mypy-pre-commit-hooks-setup.
Settings that matter
| Setting or flag | Value / default | Applies to | Source |
|---|---|---|---|
lint.select | Example baseline ["E", "F", "I"]: pycodestyle, Pyflakes, import sorting; preserve other intended families | Ruff 0.17.4 | rule selection |
lint.ignore | Start []; add exact enabled conflicts such as COM812 or Q000, not whole families | Ruff 0.17.4 | configuration, formatter conflicts |
target-version | "py311" when minimum Python is 3.11; explicit setting overrides inferred requires-python | Ruff 0.17.4 | settings |
line-length | 88 is the configuration default; use one project value for lint/format | Ruff 0.17.4 | configuration |
extend-exclude | List actual generated paths; additions preserve standard exclusions | Ruff 0.17.4 | settings |
force-exclude | true when excluded generated files may be passed explicitly by an editor/hook | Ruff 0.17.4 | settings |
lint.per-file-ignores | Example "__init__.py" = ["E402"] only if that import-order exception is intentional | Ruff 0.17.4 | settings |
format.quote-style | "double" by default; align with project format policy | Ruff 0.17.4 | configuration |
The sample selection is authored from documented rule families, not Ruff's default selection. With E selected, remaining E501 diagnostics need deliberate repair even when formatting succeeds. Use the minimum Python version rather than the interpreter installed on one developer's machine.
Order of operations
1. Inspect settings on both source and test files, plus ruff check --show-files; repair accidental exclusions/configuration boundaries before cleaning code (configuration). 2. Inventory with ruff check --no-fix --no-fix-only .; preview with ruff check --diff --no-unsafe-fixes .. Inspect effective lint.extend-safe-fixes because it can promote unsafe transformations (fix policy). 3. Apply ruff check --fix --no-unsafe-fixes ., review the diff and repair remaining diagnostics by rule. Then run ruff format .; import sorting belongs to the linter's I rules (ordering). 4. CI runs ruff check --no-fix --no-fix-only . and ruff format --check . as separately failing steps. Pin editor and CI to the same Ruff version and scope (integrations). Repeat the local sequence only if remaining changes/diagnostics require it.
Known failures and fixes
| Error (short quote) | Cause | Fix | Source |
|---|---|---|---|
The following rules may cause conflicts when used with the formatter | Formatter and enabled quote/comma/isort policy disagree | Ignore exact conflicting lint rules such as COM812/Q000 and remove incompatible nondefault isort settings | yakMM, October 24, 2023, #8185, conflict list |
line-too-long (E501) | Formatter only makes a best-effort attempt to wrap lines at the configured line-length | Shorten the relevant line manually or apply a narrowly justified E501 suppression; keep the shared line-length policy | E501, formatter |
yakMM's historical report concerns configuration warnings, not a new 0.17.4 regression. Keep exceptions rule-specific: per-file E402 does not excuse F401/F821, and a one-line F841 exception does not justify a whole-file ignore.
Missing
- Project minimum Python, generated-file locations and intentional rule families must come from its policy. custom Flake8 plugin coverage needs a separate decision (see ruff-or-black-flake8-large-python-repo-rule-coverage).
Checked
2026-11-12; Sources read: Astral release, configuration/settings, linter, formatter, E501 and CI guides, plus yakMM's issue. No Ruff cleanup or project checks were run.
Started from a post by @Astral, packaged by the editor. Original post