40 KiB
Changelog 0.12.x
0.12.0
Check out the blog post for a migration guide and overview of the changes!
Breaking changes
-
Detection of more syntax errors
Ruff now detects version-related syntax errors, such as the use of the
matchstatement on Python versions before 3.10, and syntax errors emitted by CPython's compiler, such as irrefutablematchpatterns before the finalcasearm. -
New default Python version handling for syntax errors
Ruff will default to the latest supported Python version (3.13) when checking for the version-related syntax errors mentioned above to prevent false positives in projects without a Python version configured. The default in all other cases, like applying lint rules, is unchanged and remains at the minimum supported Python version (3.9).
-
Updated f-string formatting
Ruff now formats multi-line f-strings with format specifiers to avoid adding a line break after the format specifier. This addresses a change to the Python grammar in version 3.13.4 that made such a line break a syntax error.
-
rust-toolchain.tomlis no longer included in source distributionsThe
rust-toolchain.tomlis used to specify a higher Rust version than Ruff's minimum supported Rust version (MSRV) for development and building release artifacts. However, when present in source distributions, it would also cause downstream package maintainers to pull in the same Rust toolchain, even if their available toolchain was MSRV-compatible.
Removed Rules
The following rules have been removed:
suspicious-xmle-tree-usage(S320)
Deprecated Rules
The following rules have been deprecated:
Stabilization
The following rules have been stabilized and are no longer in preview:
for-loop-writes(FURB122)check-and-remove-from-set(FURB132)verbose-decimal-constructor(FURB157)fromisoformat-replace-z(FURB162)int-on-sliced-str(FURB166)exc-info-outside-except-handler(LOG014)import-outside-top-level(PLC0415)unnecessary-dict-index-lookup(PLR1733)nan-comparison(PLW0177)eq-without-hash(PLW1641)pytest-parameter-with-default-argument(PT028)pytest-warns-too-broad(PT030)pytest-warns-with-multiple-statements(PT031)invalid-formatter-suppression-comment(RUF028)dataclass-enum(RUF049)class-with-mixed-type-vars(RUF053)unnecessary-round(RUF057)starmap-zip(RUF058)non-pep604-annotation-optional(UP045)non-pep695-generic-class(UP046)non-pep695-generic-function(UP047)private-type-parameter(UP049)
The following behaviors have been stabilized:
collection-literal-concatenation(RUF005) now recognizes slices, in addition to list literals and variables.- The fix for
readlines-in-for(FURB129) is now marked as always safe. if-else-block-instead-of-if-exp(SIM108) will now further simplify expressions to useorinstead of anifexpression, where possible.unused-noqa(RUF100) now checks for file-levelnoqacomments as well as inline comments.subprocess-without-shell-equals-true(S603) now accepts literal strings, as well as lists and tuples of literal strings, as trusted input.boolean-type-hint-positional-argument(FBT001) now applies to types that includebool, likebool | intortyping.Optional[bool], in addition to plainboolannotations.non-pep604-annotation-union(UP007) has now been split into two rules.UP007now applies only totyping.Union, whilenon-pep604-annotation-optional(UP045) checks for use oftyping.Optional.UP045has also been stabilized in this release, but you may need to update existinginclude,ignore, ornoqasettings to accommodate this change.
Preview features
-
`ruff` - [syntax-errors] Raise unsupported syntax error for template strings prior to Python 3.14 (#18664)
Bug fixes
- Add syntax error when conversion flag does not immediately follow exclamation mark (#18706)
- Add trailing space around
readlines(#18542) - Fix
\rand\r\nhandling in t- and f-string debug texts (#18673) - Hug closing
}when f-string expression has a format specifier (#18704) -
`flake8-pyi` -
`flake8-return` -
`pep8-naming` -
`pycodestyle` -
`pyupgrade` -
`refurb` -
`ruff` -
`ruff` -
`ruff` -
`ruff` -
`pylint`
Rule changes
- Fix false positive on mutations in
returnstatements (B909) (#18408) - Treat
ty:comments as pragma comments (#18532) -
`flake8-pyi` -
`pyupgrade` -
`pyupgrade` -
`refurb`
Server
- Support cancellation requests (#18627)
Documentation
- Drop confusing second
*from glob pattern example forper-file-target-version(#18709) - Update Neovim configuration examples (#18491)
-
`pylint` -
`refurb`
0.12.1
Preview features
-
`flake8-errmsg` -
`flake8-use-pathlib` -
`pygrep-hooks` -
`pylint` -
`ruff` - [formatter] Fix missing blank lines before decorated classes in
.pyifiles (#18888)
Bug fixes
- Avoid generating diagnostics with per-file ignores (#18801)
- Handle parenthesized arguments in
remove_argument(#18805) -
`flake8-logging` -
`flake8-pytest-style` -
`flake8-pytest-style` -
`flake8-pytest-style` -
`flake8-raise` -
`flake8-simplify` -
`flake8-simplify` -
`flake8-simplify` -
`flake8-pyi` -
`perflint` -
`perflint` -
`pylint` -
`pylint` -
`pylint` -
`pylint` -
`refurb` -
`refurb` -
`refurb` -
`ruff` - Fix casing of
analyze.directionvariant names (#18892)
Rule changes
- Fix f-string interpolation escaping in generated fixes (#18882)
-
`flake8-return` -
`flake8-async` -
`flake8-async` -
`flake8-bugbear` -
`flake8-comprehension` -
`flake8-comprehensions` -
`flake8-future-annotations` -
`pyflakes` -
`pylint` -
`pylint` -
`pylint` -
`pyupgrade` -
`ruff` -
`ruff` -
`ruff`
Server
- Consider virtual path for various server actions (#18910)
Documentation
- Add fix safety sections (#18940,#18841,#18802,#18837,#18800,#18415,#18853,#18842)
- Use updated pre-commit id (#18718)
-
`perflint` -
`pyupgrade` -
`flake8-pie` -
`flake8-pyi` -
`flake8-pie` -
`pycodestyle`
Other changes
- Disallow newlines in format specifiers of single quoted f- or t-strings (#18708)
-
`flake8-logging` -
`pyupgrade`
0.12.2
Preview features
-
`flake8-pyi` -
`pyupgrade`
Bug fixes
-
`flake8-comprehensions` -
`perflint` -
`pydocstyle` -
`pylint` -
`refurb` -
`ruff` -
`ruff`
Rule changes
-
`flake8-executable` -
`pandas` -
`pyupgrade`
Documentation
- Document link between
import-outside-top-level (PLC0415)andlint.flake8-tidy-imports.banned-module-level-imports(#18733) - Fix description of the
format.skip-magic-trailing-commaexample (#19095) -
`airflow` -
`airflow` -
`flake8-annotations` -
`flake8-async` -
`flake8-async` -
`flake8-async` -
`flake8-async` -
`flake8-async` -
`flake8-async` -
`flake8-bandit` -
`flake8-bandit` -
`flake8-bugbear` -
`flake8-bugbear` -
`flake8-datetimez` -
`flake8-datetimez` -
`flake8-pyi` -
`flake8-pyi` -
`flake8-pyi` -
`flake8-pyi` -
`flake8-pyi` -
`flake8-pytest-style` -
`flake8-pytest-style` -
`flake8-quotes` -
`flake8-simplify` -
`flake8-simplify` -
`flake8-simplify` -
`pyflakes` -
`pylint`
0.12.3
Preview features
-
`flake8-bugbear` -
`flake8-use-pathlib` -
`flake8-use-pathlib`
Bug fixes
-
`flake8-return` - Treat form feed as valid whitespace before a line continuation (#19220)
-
`flake8-type-checking` -
`pyupgrade`
Documentation
-
`flake8-pyi` -
`flake8-simplify` -
`flake8-type-checking` -
`flake8-use-pathlib` -
`pycodestyle` -
`pycodestyle` -
`pydoclint` -
`pylint`, `pyupgrade` -
`pylint` -
`flake8-bandit`
0.12.4
Preview features
-
`flake8-type-checking`, `pyupgrade`, `ruff` -
`flake8-use-pathlib` -
`pylint`
Bug fixes
-
`flake8-bugbear` -
`flake8-use-pathlib` -
`flake8-django` -
`isort` -
`isort` -
`pydoclint` -
`refurb`
Rule changes
-
`flake8-use-pathlib` -
`pep8_naming` -
`pycodestyle` -
`pylint` -
`ruff`
Documentation
-
`flake8-type-checking` - Make more documentation examples error out-of-the-box (#19288,#19272,#19291,#19296,#19292,#19295,#19297,#19309)
0.12.5
Preview features
-
`flake8-use-pathlib` -
`ruff`
Bug fixes
- Fix
unreachablepanic in parser (#19183) -
`flake8-pyi` -
`perflint` -
`pylint`
Rule changes
-
`pep8-naming`
0.12.6
Preview features
-
`flake8-commas` -
`pylint` -
`ruff`
Bug fixes
- Support
.pyifiles in ruff analyze graph (#19611) -
`flake8-pyi` -
`perflint` -
`pyupgrade` -
`refurb` -
`refurb` -
`ruff`
Rule changes
-
`flake8-blind-except`
Performance
- Add support for specifying minimum dots in detected string imports (#19538)
0.12.7
This is a follow-up release to 0.12.6. Because of an issue in the package metadata, 0.12.6 failed to publish fully to PyPI and has been yanked. Similarly, there is no GitHub release or Git tag for 0.12.6. The contents of the 0.12.7 release are identical to 0.12.6, except for the updated metadata.
0.12.8
Preview features
-
`flake8-use-pathlib`
Bug fixes
-
`flake8-blind-except` -
`flake8-errmsg` -
`flake8-simplify` -
`flake8-import-conventions` -
`isort` -
`pylint` -
`pyupgrade` -
`ruff`
Rule changes
-
`eradicate`
Documentation
- Replace "associative" with "commutative" in docs for
RUF036(#19706) - Fix copy and line separator colors in dark mode (#19630)
- Fix link to
typingdocumentation (#19648) -
`refurb`
Other changes
- Include column numbers in GitLab output format (#19708)
- Always expand tabs to four spaces in diagnostics (#19618)
- Update pre-commit's
ruffid (#19654)
0.12.9
Preview features
-
`airflow` -
`ruff`
Bug fixes
-
`flake8-blind-except` -
`flake8-comprehensions` -
`flake8-simplify`
Rule changes
-
`pylint`
Documentation
- Fix
lint.future-annotationslink (#19876)
Other changes
-
Build
riscv64binaries for release (#19819) -
Add rule code to error description in GitLab output (#19896)
-
Improve rendering of the
fulloutput format (#19415)Below is an example diff for
F401:-unused.py:8:19: F401 [*] `pathlib` imported but unused +F401 [*] `pathlib` imported but unused + --> unused.py:8:19 | 7 | # Unused, _not_ marked as required (due to the alias). 8 | import pathlib as non_alias - | ^^^^^^^^^ F401 + | ^^^^^^^^^ 9 | 10 | # Unused, marked as required. | - = help: Remove unused import: `pathlib` +help: Remove unused import: `pathlib`For now, the primary difference is the movement of the filename, line number, and column information to a second line in the header. This new representation will allow us to make further additions to Ruff's diagnostics, such as adding sub-diagnostics and multiple annotations to the same snippet.
0.12.10
Preview features
-
`flake8-simplify` -
`flake8-use-pathlib`
Bug fixes
-
`isort` -
`pyupgrade` -
`pyupgrade`
Rule changes
-
`pycodestyle` -
`pyflakes`
Documentation
- Fix description of global config file discovery strategy (#19188)
- Update outdated links to https://typing.python.org/en/latest/source/stubs.html (#19992)
-
`flake8-annotations`
0.12.11
Preview features
-
`airflow` -
`airflow` -
`flake8-async` -
`flake8-logging-format` -
`flake8-use-pathlib` -
`flake8-use-pathlib`
Bug fixes
-
`pyflakes`, `pylint` -
`pyflakes` -
`ruff` -
`ruff`
Rule changes
-
`ruff`
Documentation
- Fix incorrect
D413links in docstrings convention FAQ (#20089) -
`flake8-use-pathlib`
0.12.12
Preview features
- Show fixes by default (#19919)
-
`airflow` -
`airflow` -
`airflow` -
`flake8-async` -
`flake8-use-pathlib` -
`pylint` -
`ruff`
Bug fixes
- Less confidently mark f-strings as empty when inferring truthiness (#20152)
-
`fastapi` -
`flake8-comprehensions` -
`perflint`
Rule changes
-
`pycodestyle`