Support baselines, i.e., ignore existing errors for incremental adoption
Author: edgarrmondragonCreated Dec 8, 2022Updated Sep 15, 2026
Labelscoresuppression
Baselines would allow developers to introduce Ruff to their codebase incrementally by ignoring existing errors and address them as they reappear when making changes to the code.
Supported by some tools in the flake8 ecosystem:
- Bandit: https://bandit.readthedocs.io/en/latest/start.html#baseline
- Flakeheaven: https://wemake-python-styleguide.readthedocs.io/en/latest/pages/usage/integrations/flakeheaven.html#legacy-first-1
A very basic proposal for this in ruff:
In the CLI
ruff . --exit-zero --format baseline > .ruff_baseline
ruff . --baseline .ruff_baseline # doesn't report any errors
In pyproject.toml
[tool.ruff]
baseline = ".ruff_baseline"
Source: astral-sh/ruff