crates/ruff_linter/resources/mdtest/configuration/rule-selector-precedence.md
Categories (e.g. correctness, suspicious), linter groups (e.g. RUF, UP), linter prefixes
(e.g. RUF1), and rules (e.g. F401, unused-import) can be combined in the same configuration.
In general, more specific selectors take precedence over broader selectors. Although all categories
aren't strictly "broader" than all linter groups, the general trend still applies. When selectors
have the same specificity, ignore takes precedence over select. In short, the current precedence
relationship is:
ALL < category < linter group < linter prefix < rule
Select all F (unused-import) and restriction (assert) rules.
[lint]
preview = true
select = ["F", "restriction"]
import os # error: [unused-import]
assert True # error: [assert]
ALLunused-import (F401) is a suspicious rule:
[lint]
preview = true
select = ["suspicious"]
ignore = ["ALL"]
import os # error: [unused-import]
[lint]
preview = true
select = ["F"]
ignore = ["suspicious"]
import os # error: [unused-import]
[lint]
preview = true
select = ["suspicious"]
ignore = ["F"]
import os
[lint]
preview = true
select = ["F4"]
ignore = ["suspicious"]
import os # error: [unused-import]
[lint]
preview = true
select = ["F401"]
ignore = ["suspicious"]
import os # error: [unused-import]
[lint]
preview = true
select = ["unused-import"]
ignore = ["suspicious"]
import os # error: [unused-import]