diff --git a/README.md b/README.md index e98124be85..4cac2b3a92 100644 --- a/README.md +++ b/README.md @@ -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 Rust as a first-party feature. -By default, Ruff enables Flake8's `F` rules, along with a subset of the `E` rules, omitting any -stylistic rules that overlap with the use of a formatter, like `ruff format` or -[Black](https://github.com/psf/black). +By default, Ruff enables Flake8's `F` rules, along with a subset of the `E` +rules, omitting any stylistic rules that overlap with the use of a formatter, +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 catches a wide variety of common errors (like unused imports) with zero configuration. diff --git a/crates/ruff_workspace/src/options.rs b/crates/ruff_workspace/src/options.rs index 055291b53c..389e582e12 100644 --- a/crates/ruff_workspace/src/options.rs +++ b/crates/ruff_workspace/src/options.rs @@ -804,11 +804,12 @@ pub struct LintCommonOptions { /// specific prefixes. `ignore` takes precedence over `select` if the /// same prefix appears in both. #[option( - default = r#"["E4", "E7", "E9", "F"]"#, + default = r#"["E4", "E7", "E9", "F", "B012", "PYI057"]"#, value_type = "list[RuleSelector]", example = r#" - # On top of the defaults (`E4`, E7`, `E9`, and `F`), enable flake8-bugbear (`B`) and flake8-quotes (`Q`). - select = ["E4", "E7", "E9", "F", "B", "Q"] + # On top of the defaults (`E4`, E7`, `E9`, `F`, `B012`, and `PYI057`), + # enable flake8-bugbear (`B`) and flake8-quotes (`Q`). + select = ["E4", "E7", "E9", "F", "PYI057", "B", "Q"] "# )] pub select: Option>, diff --git a/docs/configuration.md b/docs/configuration.md index 8d3297fbca..e40013352e 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -51,10 +51,12 @@ If left unspecified, Ruff's default configuration is equivalent to: target-version = "py39" [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 # McCabe complexity (`C901`) by default. - select = ["E4", "E7", "E9", "F"] + select = ["E4", "E7", "E9", "F", "PYI057", "B012"] ignore = [] # Allow fix for all enabled rules (when `--fix`) is provided.