update the documentation to reflect the new defaults

This commit is contained in:
Brent Westbrook 2025-10-02 09:08:47 -04:00
parent 3a779a237e
commit 2230ab07d0
3 changed files with 15 additions and 8 deletions

View File

@ -311,9 +311,13 @@ for more on the linting and formatting commands, respectively.
isort, pyupgrade, and others. Regardless of the rule's origin, Ruff re-implements every rule in isort, pyupgrade, and others. Regardless of the rule's origin, Ruff re-implements every rule in
Rust as a first-party feature. Rust as a first-party feature.
By default, Ruff enables Flake8's `F` rules, along with a subset of the `E` rules, omitting any By default, Ruff enables Flake8's `F` rules, along with a subset of the `E`
stylistic rules that overlap with the use of a formatter, like `ruff format` or rules, omitting any stylistic rules that overlap with the use of a formatter,
[Black](https://github.com/psf/black). like `ruff format` or [Black](https://github.com/psf/black). Ruff also enables
[`B012`](https://docs.astral.sh/ruff/rules/jump-statement-in-finally/), which
corresponds to a `SyntaxWarning`, and
[`PYI057`](https://docs.astral.sh/ruff/rules/byte-string-usage/), which flags
usage of some long-deprecated APIs in the standard library.
If you're just getting started with Ruff, **the default rule set is a great place to start**: it If you're just getting started with Ruff, **the default rule set is a great place to start**: it
catches a wide variety of common errors (like unused imports) with zero configuration. catches a wide variety of common errors (like unused imports) with zero configuration.

View File

@ -804,11 +804,12 @@ pub struct LintCommonOptions {
/// specific prefixes. `ignore` takes precedence over `select` if the /// specific prefixes. `ignore` takes precedence over `select` if the
/// same prefix appears in both. /// same prefix appears in both.
#[option( #[option(
default = r#"["E4", "E7", "E9", "F"]"#, default = r#"["E4", "E7", "E9", "F", "B012", "PYI057"]"#,
value_type = "list[RuleSelector]", value_type = "list[RuleSelector]",
example = r#" example = r#"
# On top of the defaults (`E4`, E7`, `E9`, and `F`), enable flake8-bugbear (`B`) and flake8-quotes (`Q`). # On top of the defaults (`E4`, E7`, `E9`, `F`, `B012`, and `PYI057`),
select = ["E4", "E7", "E9", "F", "B", "Q"] # enable flake8-bugbear (`B`) and flake8-quotes (`Q`).
select = ["E4", "E7", "E9", "F", "PYI057", "B", "Q"]
"# "#
)] )]
pub select: Option<Vec<RuleSelector>>, pub select: Option<Vec<RuleSelector>>,

View File

@ -51,10 +51,12 @@ If left unspecified, Ruff's default configuration is equivalent to:
target-version = "py39" target-version = "py39"
[tool.ruff.lint] [tool.ruff.lint]
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default. # Enable Pyflakes (`F`), a subset of the pycodestyle (`E`) codes,
# and a couple of other codes corresponding to CPython deprecations
# and syntax warnings by default.
# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or # Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or
# McCabe complexity (`C901`) by default. # McCabe complexity (`C901`) by default.
select = ["E4", "E7", "E9", "F"] select = ["E4", "E7", "E9", "F", "PYI057", "B012"]
ignore = [] ignore = []
# Allow fix for all enabled rules (when `--fix`) is provided. # Allow fix for all enabled rules (when `--fix`) is provided.