ruff extend-select: Add Rules to the Set
extend-select adds rule codes to whatever is already selected, unlike select which replaces the selection.
select sets the active rules; extend-select grows them. Knowing the difference avoids accidentally turning off everything else when you only meant to add one family.
What it does
extend-select, under [tool.ruff.lint], adds the listed rule codes to the existing selection rather than overriding it. The command-line equivalent is --extend-select. Use it to layer extra families (B, UP, SIM) onto a base set without restating the base.
Common usage
[tool.ruff.lint]
select = ["E", "F"]
extend-select = ["I", "B", "UP"]Keys
| Item | What it does |
|---|---|
| [tool.ruff.lint] select | Replaces the selection |
| [tool.ruff.lint] extend-select | Adds to the selection |
| --select | Command-line override of selection |
| --extend-select | Command-line addition to selection |
| extend-ignore | Add to the ignore list similarly |
In CI
Use select for the deliberate base set and extend-select for additions, so a teammate adding --select on the command line does not silently disable your extend-select families. Keep both in config for reproducibility.
Common errors in CI
Using select where you meant extend-select wipes out previously selected families, so rules you relied on stop firing and CI passes code it used to fail. Adding a new family via extend-select can fail a previously green build because more rules now apply. A typo in a code yields "Unknown rule selector" and exit 2.