mirror of https://github.com/astral-sh/ruff
36 KiB
36 KiB
Changelog 0.9.x
0.9.0
Check out the blog post for a migration guide and overview of the changes!
Breaking changes
Ruff now formats your code according to the 2025 style guide. As a result, your code might now get formatted differently. See the formatter section for a detailed list of changes.
This release doesn’t remove or remap any existing stable rules.
Stabilization
The following rules have been stabilized and are no longer in preview:
stdlib-module-shadowing(A005). This rule has also been renamed: previously, it was calledbuiltin-module-shadowing.builtin-lambda-argument-shadowing(A006)slice-to-remove-prefix-or-suffix(FURB188)boolean-chained-comparison(PLR1716)decimal-from-float-literal(RUF032)post-init-default(RUF033)useless-if-else(RUF034)
The following behaviors have been stabilized:
pytest-parametrize-names-wrong-type(PT006): Detectpytest.parametrizecalls outside decorators and calls with keyword arguments.module-import-not-at-top-of-file(E402): Ignorepytest.importorskipcalls between import statements.mutable-dataclass-default(RUF008) andfunction-call-in-dataclass-default-argument(RUF009): Add support forattrs.bad-version-info-comparison(PYI006): Extend the rule to check non-stub files.
The following fixes or improvements to fixes have been stabilized:
redundant-numeric-union(PYI041)duplicate-union-members(PYI016)
Formatter
This release introduces the new 2025 stable style (#13371), stabilizing the following changes:
- Format expressions in f-string elements (#7594)
- Alternate quotes for strings inside f-strings (#13860)
- Preserve the casing of hex codes in f-string debug expressions (#14766)
- Choose the quote style for each string literal in an implicitly concatenated f-string rather than for the entire string (#13539)
- Automatically join an implicitly concatenated string into a single string literal if it fits on a single line (#9457)
- Remove the
ISC001incompatibility warning (#15123) - Prefer parenthesizing the
assertmessage over breaking the assertion expression (#9457) - Automatically parenthesize over-long
ifguards inmatchcaseclauses (#13513) - More consistent formatting for
matchcasepatterns (#6933) - Avoid unnecessary parentheses around return type annotations (#13381)
- Keep the opening parentheses on the same line as the
ifkeyword for comprehensions where the condition has a leading comment (#12282) - More consistent formatting for
withstatements with a single context manager for Python 3.8 or older (#10276) - Correctly calculate the line-width for code blocks in docstrings when using
max-doc-code-line-length = "dynamic"(#13523)
Preview features
-
`flake8-bugbear` -
`flake8-type-checking` -
`pylint` -
`pyupgrade` -
`ruff` -
`ruff`
Rule changes
-
`flake8-builtins` -
`flake8-return`
Server
- Improve the observability by removing the need for the "trace" value to turn on or off logging. The server logging is solely controlled using the
logLevelserver setting which defaults toinfo. This addresses the issue where users were notified about an error and told to consult the log, but it didn’t contain any messages. (#15232) - Ignore diagnostics from other sources for code action requests (#15373)
CLI
- Improve the error message for
--config key=valuewhen thekeyis for a table and it’s a simplevalue
Bug fixes
-
`eradicate` -
`flake8-django` -
`pycodestyle` -
`pydocstyle` -
`pyflakes` -
`refurb` -
`ruff` -
`ruff`
0.9.1
Preview features
-
`pycodestyle` -
`ruff`
Rule changes
-
`flake8-bugbear`
Formatter
- Preserve trailing end-of line comments for the last string literal in implicitly concatenated strings (#15378)
Server
- Fix a bug where the server and client notebooks were out of sync after reordering cells (#15398)
Bug fixes
-
`flake8-pie` -
`pyupgrade`
0.9.2
Preview features
-
`airflow` -
`airflow` -
`fastapi` -
`flake8-pytest-style` -
`flake8-pytest-style` -
`flake8-type-checking`
Rule changes
-
`flake8-todos` -
`pyflakes`
Formatter
- Fix curly bracket spacing around f-string expressions containing curly braces (#15471)
- Fix joining of f-strings with different quotes when using quote style
Preserve(#15524)
Server
- Avoid indexing the same workspace multiple times (#15495)
- Display context for
ruff.configurationerrors (#15452)
Configuration
- Remove
flattento improve deserialization error messages (#15414)
Bug fixes
- Parse triple-quoted string annotations as if parenthesized (#15387)
-
`fastapi` -
`flake8-bandit` -
`flake8-pathlib` -
`ruff`
0.9.3
Preview features
-
`airflow` -
`airflow` -
`flake8-bandit` -
`flake8-pytest-style` -
`flake8-simplify` -
`pyflakes` -
`pylint` -
`pylint` -
`pyupgrade` -
`refurb` -
`ruff` -
`ruff`
Rule changes
-
`flake8-bugbear` -
`flake8-comprehensions` -
`flake8-pytest-style` -
`flake8-simplify` -
`flake8-type-checking` -
`isort` -
`pydoclint` -
`pyflakes` -
`pyflakes` -
`pyflakes` -
`pylint` -
`ruff`
Formatter
- Fix bracket spacing for single-element tuples in f-string expressions (#15537)
- Fix unstable f-string formatting for expressions containing a trailing comma (#15545)
Performance
- Avoid quadratic membership check in import fixes (#15576)
Server
- Allow
unsafe-fixessettings for code actions (#15666)
Bug fixes
-
`flake8-bandit` -
`flake8-import-conventions` -
`flake8-simplify` -
`pyflakes` -
`pyupgrade` -
`ruff` - Preserve raw string prefix and escapes in all codegen fixes (#15694)
Documentation
- Generate documentation redirects for lowercase rule codes (#15564)
TRY300: Add some extra notes on not catching exceptions you didn't expect (#15036)
0.9.4
Preview features
-
`airflow` -
`airflow` -
`flake8-bandit` -
`pylint` -
`refurb` -
`ruff` -
`ruff` -
`ruff` -
`ruff`
Rule changes
- Preserve quote style in generated code (#15726, #15778, #15794)
-
`flake8-bugbear` -
`pylint` -
`pyupgrade`
CLI
- Fix formatter warning message for
flake8-quotesoption (#15788) - Implement tab autocomplete for
ruff config(#15603)
Bug fixes
-
`flake8-comprehensions` -
`flake8-comprehensions` -
`pyupgrade`
Documentation
- Add missing config docstrings (#15803)
- Add references to
trio.run_processandanyio.run_process(#15761) - Use
uv init --libin tutorial (#15718)
0.9.5
Preview features
- Recognize all symbols named
TYPE_CHECKINGforin_type_checking_block(#15719) -
`flake8-comprehensions` -
`flake8-logging` -
`flake8-pyi` -
`flake8-pyi` -
`flake8-pyi` -
`flake8-pyi` -
`pylint` -
`pyupgrade` -
`pyupgrade` -
`refurb` -
`refurb` -
`ruff` -
`airflow` -
`flake8-pyi` -
`flake8-pyi`
Rule changes
- Preserve triple quotes and prefixes for strings (#15818)
-
`flake8-comprehensions` -
`flake8-pyi` -
`pep8-naming` -
`pyupgrade` -
`ruff` -
`pycodestyle`
Configuration
- Config error only when
flake8-import-conventionsalias conflicts withisort.required-importsbound name (#15918) - Workaround Even Better TOML crash related to
allOf(#15992)
Bug fixes
-
`flake8-comprehensions` -
`flake8-comprehensions` -
`flake8-pyi` -
`pep8-naming` -
`pyflakes` -
`pylint` -
`refurb` -
`refurb`
Documentation
- Add deprecation warning for
ruff-lsprelated settings (#15850) - Docs (
linter.md): clarify that Python files are always searched for in subdirectories (#15882) - Fix a typo in
non_pep695_generic_class.rs(#15946) - Improve Docs: Pylint subcategories' codes (#15909)
- Remove non-existing
lint.extendIgnoreeditor setting (#15844) - Update black deviations (#15928)
- Mention
UP049inUP046andUP047, addSee alsosection toUP040(#15956) - Add instance variable examples to
RUF012(#15982) - Explain precedence for
ignoreandselectconfig (#15883)
0.9.6
Preview features
-
`airflow` -
`flake8-builtins` -
`flake8-pyi` -
`pylint` -
`ruff` -
`ruff`
Rule changes
-
`flake8-annotations` -
`flake8-builtins` -
`flake8-comprehensions` -
`flake8-pie` -
`flake8-simplify` -
`pylint` -
`pyupgrade` -
`pyupgrade` -
`pyupgrade` -
`pyupgrade` -
`ruff`
Server
- Root exclusions in the server to project root (#16043)
Bug fixes
-
`flake8-datetime` -
`flake8-type-checking`
Documentation
0.9.7
Preview features
- Consider
__new__methods as special function type for enforcing class method or static method rules (#13305) -
`airflow` -
`refurb` -
`ruff` -
`ruff` -
`refurb`
Rule changes
-
`flake8-debugger` -
`pycodestyle`
Formatter
- Fix unstable formatting of trailing end-of-line comments of parenthesized attribute values (#16187)
Server
- Fix handling of requests received after shutdown message (#16262)
- Ignore
source.organizeImports.ruffandsource.fixAll.ruffcode actions for a notebook cell (#16154) - Include document specific debug info for
ruff.printDebugInformation(#16215) - Update server to return the debug info as string with
ruff.printDebugInformation(#16214)
CLI
- Warn on invalid
noqaeven when there are no diagnostics (#16178) - Better error messages while loading configuration
extends (#15658)
Bug fixes
-
`flake8-comprehensions` -
`flake8-pyi` -
`pydocstyle` -
`pylint` -
`pylint` -
`pyupgrade` -
`pyupgrade` -
`pyupgrade` -
`refurb` -
`ruff`
Documentation
0.9.8
Preview features
- Start detecting version-related syntax errors in the parser (#16090)
Rule changes
-
`pylint` -
`pylint` -
`ruff`
Server
- Avoid indexing the project if
configurationPreferenceiseditorOnly(#16381) - Avoid unnecessary info at non-trace server log level (#16389)
- Expand
ruff.configurationto allow inline config (#16296) - Notify users for invalid client settings (#16361)
Configuration
- Add
per-file-target-versionoption (#16257)
Bug fixes
-
`refurb` -
`flake8-self` -
`pylint` -
`flake8-pyi`
Documentation
- Fix example for
S611(#16316) - Normalize inconsistent markdown headings in docstrings (#16364)
- Document MSRV policy (#16384)
0.9.9
Preview features
- Fix caching of unsupported-syntax errors (#16425)
Bug fixes
- Only show unsupported-syntax errors in editors when preview mode is enabled (#16429)
0.9.10
Preview features
-
`ruff` -
`syntax-errors` -
`syntax-errors` -
`syntax-errors` -
`syntax-errors` -
`syntax-errors` -
`syntax-errors` -
`syntax-errors` -
`syntax-errors` -
`syntax-errors`
Bug fixes
- Escape template filenames in glob patterns in configuration (#16407)
-
`flake8-simplify` - Formatter: Fix syntax error location in notebooks (#16499)
-
`pyupgrade` -
`flake8-builtins` -
`pylint`
CLI
- Move rule code from
descriptiontocheck_namein GitLab output serializer (#16437)
Documentation
-
`pydocstyle`