From beea8cdfec826802a7d9ecada3b38156eb693e77 Mon Sep 17 00:00:00 2001 From: Amethyst Reese Date: Tue, 7 Oct 2025 11:05:47 -0700 Subject: [PATCH] Bump 0.14.0 (#20751) --- BREAKING_CHANGES.md | 16 ++ CHANGELOG.md | 276 +++--------------------------- Cargo.lock | 6 +- README.md | 6 +- changelogs/0.13.x.md | 263 ++++++++++++++++++++++++++++ crates/ruff/Cargo.toml | 2 +- crates/ruff_linter/Cargo.toml | 2 +- crates/ruff_wasm/Cargo.toml | 2 +- docs/integrations.md | 8 +- docs/tutorial.md | 2 +- pyproject.toml | 2 +- scripts/benchmarks/pyproject.toml | 2 +- 12 files changed, 323 insertions(+), 264 deletions(-) create mode 100644 changelogs/0.13.x.md diff --git a/BREAKING_CHANGES.md b/BREAKING_CHANGES.md index 9dd46c6ba9..491eb59cca 100644 --- a/BREAKING_CHANGES.md +++ b/BREAKING_CHANGES.md @@ -1,5 +1,21 @@ # Breaking Changes +## 0.14.0 + +- **Default to Python 3.10** + + Ruff now defaults to Python 3.10 instead of 3.9 if no explicit Python + version is configured using [`ruff.target-version`](https://docs.astral.sh/ruff/settings/#target-version) + or [`project.requires-python`](https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#python-requires) + ([#20725](https://github.com/astral-sh/ruff/pull/20725)) + +- **Default to Python 3.14 for syntax errors** + + Ruff will default to the _latest_ supported Python version (3.14) when + checking for syntax errors without a Python version configured. The default + in all other cases, like applying lint rules, remains at the minimum + supported Python version (3.10). + ## 0.13.0 - **Several rules can now add `from __future__ import annotations` automatically** diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d8029e4e3..96954d38c5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,266 +1,46 @@ # Changelog -## 0.13.3 +## 0.14.0 -Released on 2025-10-02. - -### Preview features - -- Display diffs for `ruff format --check` and add support for different output formats ([#20443](https://github.com/astral-sh/ruff/pull/20443)) -- \[`pyflakes`\] Handle some common submodule import situations for `unused-import` (`F401`) ([#20200](https://github.com/astral-sh/ruff/pull/20200)) -- \[`ruff`\] Do not flag `%r` + `repr()` combinations (`RUF065`) ([#20600](https://github.com/astral-sh/ruff/pull/20600)) - -### Bug fixes - -- \[`cli`\] Add conflict between `--add-noqa` and `--diff` options ([#20642](https://github.com/astral-sh/ruff/pull/20642)) -- \[`pylint`\] Exempt required imports from `PLR0402` ([#20381](https://github.com/astral-sh/ruff/pull/20381)) -- \[`pylint`\] Fix missing `max-nested-blocks` in settings display ([#20574](https://github.com/astral-sh/ruff/pull/20574)) -- \[`pyupgrade`\] Prevent infinite loop with `I002` and `UP026` ([#20634](https://github.com/astral-sh/ruff/pull/20634)) - -### Rule changes - -- \[`flake8-simplify`\] Improve help message clarity (`SIM105`) ([#20548](https://github.com/astral-sh/ruff/pull/20548)) - -### Documentation - -- Add the *The Basics* title back to CONTRIBUTING.md ([#20624](https://github.com/astral-sh/ruff/pull/20624)) -- Fixed documentation for try_consider_else ([#20587](https://github.com/astral-sh/ruff/pull/20587)) -- \[`isort`\] Clarify dependency between `order-by-type` and `case-sensitive` settings ([#20559](https://github.com/astral-sh/ruff/pull/20559)) -- \[`pylint`\] Clarify fix safety to include left-hand hashability (`PLR6201`) ([#20518](https://github.com/astral-sh/ruff/pull/20518)) - -### Other changes - -- \[`playground`\] Fix quick fixes for empty ranges in playground ([#20599](https://github.com/astral-sh/ruff/pull/20599)) - -### Contributors - -- [@TaKO8Ki](https://github.com/TaKO8Ki) -- [@ntBre](https://github.com/ntBre) -- [@dylwil3](https://github.com/dylwil3) -- [@MichaReiser](https://github.com/MichaReiser) -- [@danparizher](https://github.com/danparizher) -- [@LilMonk](https://github.com/LilMonk) -- [@mgiovani](https://github.com/mgiovani) -- [@IDrokin117](https://github.com/IDrokin117) - -## 0.13.2 - -Released on 2025-09-25. - -### Preview features - -- \[`flake8-async`\] Implement `blocking-path-method` (`ASYNC240`) ([#20264](https://github.com/astral-sh/ruff/pull/20264)) -- \[`flake8-bugbear`\] Implement `map-without-explicit-strict` (`B912`) ([#20429](https://github.com/astral-sh/ruff/pull/20429)) -- \[`flake8-bultins`\] Detect class-scope builtin shadowing in decorators, default args, and attribute initializers (`A003`) ([#20178](https://github.com/astral-sh/ruff/pull/20178)) -- \[`ruff`\] Implement `logging-eager-conversion` (`RUF065`) ([#19942](https://github.com/astral-sh/ruff/pull/19942)) -- Include `.pyw` files by default when linting and formatting ([#20458](https://github.com/astral-sh/ruff/pull/20458)) - -### Bug fixes - -- Deduplicate input paths ([#20105](https://github.com/astral-sh/ruff/pull/20105)) -- \[`flake8-comprehensions`\] Preserve trailing commas for single-element lists (`C409`) ([#19571](https://github.com/astral-sh/ruff/pull/19571)) -- \[`flake8-pyi`\] Avoid syntax error from conflict with `PIE790` (`PYI021`) ([#20010](https://github.com/astral-sh/ruff/pull/20010)) -- \[`flake8-simplify`\] Correct fix for positive `maxsplit` without separator (`SIM905`) ([#20056](https://github.com/astral-sh/ruff/pull/20056)) -- \[`pyupgrade`\] Fix `UP008` not to apply when `__class__` is a local variable ([#20497](https://github.com/astral-sh/ruff/pull/20497)) -- \[`ruff`\] Fix `B004` to skip invalid `hasattr`/`getattr` calls ([#20486](https://github.com/astral-sh/ruff/pull/20486)) -- \[`ruff`\] Replace `-nan` with `nan` when using the value to construct a `Decimal` (`FURB164` ) ([#20391](https://github.com/astral-sh/ruff/pull/20391)) - -### Documentation - -- Add 'Finding ways to help' to CONTRIBUTING.md ([#20567](https://github.com/astral-sh/ruff/pull/20567)) -- Update import path to `ruff-wasm-web` ([#20539](https://github.com/astral-sh/ruff/pull/20539)) -- \[`flake8-bandit`\] Clarify the supported hashing functions (`S324`) ([#20534](https://github.com/astral-sh/ruff/pull/20534)) - -### Other changes - -- \[`playground`\] Allow hover quick fixes to appear for overlapping diagnostics ([#20527](https://github.com/astral-sh/ruff/pull/20527)) -- \[`playground`\] Fix non‑BMP code point handling in quick fixes and markers ([#20526](https://github.com/astral-sh/ruff/pull/20526)) - -### Contributors - -- [@BurntSushi](https://github.com/BurntSushi) -- [@mtshiba](https://github.com/mtshiba) -- [@second-ed](https://github.com/second-ed) -- [@danparizher](https://github.com/danparizher) -- [@ShikChen](https://github.com/ShikChen) -- [@PieterCK](https://github.com/PieterCK) -- [@GDYendell](https://github.com/GDYendell) -- [@RazerM](https://github.com/RazerM) -- [@TaKO8Ki](https://github.com/TaKO8Ki) -- [@amyreese](https://github.com/amyreese) -- [@ntbre](https://github.com/ntBre) -- [@MichaReiser](https://github.com/MichaReiser) - -## 0.13.1 - -Released on 2025-09-18. - -### Preview features - -- \[`flake8-simplify`\] Detect unnecessary `None` default for additional key expression types (`SIM910`) ([#20343](https://github.com/astral-sh/ruff/pull/20343)) -- \[`flake8-use-pathlib`\] Add fix for `PTH123` ([#20169](https://github.com/astral-sh/ruff/pull/20169)) -- \[`flake8-use-pathlib`\] Fix `PTH101`, `PTH104`, `PTH105`, `PTH121` fixes ([#20143](https://github.com/astral-sh/ruff/pull/20143)) -- \[`flake8-use-pathlib`\] Make `PTH111` fix unsafe because it can change behavior ([#20215](https://github.com/astral-sh/ruff/pull/20215)) -- \[`pycodestyle`\] Fix `E301` to only trigger for functions immediately within a class ([#19768](https://github.com/astral-sh/ruff/pull/19768)) -- \[`refurb`\] Mark `single-item-membership-test` fix as always unsafe (`FURB171`) ([#20279](https://github.com/astral-sh/ruff/pull/20279)) - -### Bug fixes - -- Handle t-strings for token-based rules and suppression comments ([#20357](https://github.com/astral-sh/ruff/pull/20357)) -- \[`flake8-bandit`\] Fix truthiness: dict-only `**` displays not truthy for `shell` (`S602`, `S604`, `S609`) ([#20177](https://github.com/astral-sh/ruff/pull/20177)) -- \[`flake8-simplify`\] Fix diagnostic to show correct method name for `str.rsplit` calls (`SIM905`) ([#20459](https://github.com/astral-sh/ruff/pull/20459)) -- \[`flynt`\] Use triple quotes for joined raw strings with newlines (`FLY002`) ([#20197](https://github.com/astral-sh/ruff/pull/20197)) -- \[`pyupgrade`\] Fix false positive when class name is shadowed by local variable (`UP008`) ([#20427](https://github.com/astral-sh/ruff/pull/20427)) -- \[`pyupgrade`\] Prevent infinite loop with `I002` and `UP026` ([#20327](https://github.com/astral-sh/ruff/pull/20327)) -- \[`ruff`\] Recognize t-strings, generators, and lambdas in `invalid-index-type` (`RUF016`) ([#20213](https://github.com/astral-sh/ruff/pull/20213)) - -### Rule changes - -- \[`RUF102`\] Respect rule redirects in invalid rule code detection ([#20245](https://github.com/astral-sh/ruff/pull/20245)) -- \[`flake8-bugbear`\] Mark the fix for `unreliable-callable-check` as always unsafe (`B004`) ([#20318](https://github.com/astral-sh/ruff/pull/20318)) -- \[`ruff`\] Allow dataclass attribute value instantiation from nested frozen dataclass (`RUF009`) ([#20352](https://github.com/astral-sh/ruff/pull/20352)) - -### CLI - -- Add fixes to `output-format=sarif` ([#20300](https://github.com/astral-sh/ruff/pull/20300)) -- Treat panics as fatal diagnostics, sort panics last ([#20258](https://github.com/astral-sh/ruff/pull/20258)) - -### Documentation - -- \[`ruff`\] Add `analyze.string-imports-min-dots` to settings ([#20375](https://github.com/astral-sh/ruff/pull/20375)) -- Update README.md with Albumentations new repository URL ([#20415](https://github.com/astral-sh/ruff/pull/20415)) - -### Other changes - -- Bump MSRV to Rust 1.88 ([#20470](https://github.com/astral-sh/ruff/pull/20470)) -- Enable inline noqa for multiline strings in playground ([#20442](https://github.com/astral-sh/ruff/pull/20442)) - -### Contributors - -- [@chirizxc](https://github.com/chirizxc) -- [@danparizher](https://github.com/danparizher) -- [@IDrokin117](https://github.com/IDrokin117) -- [@amyreese](https://github.com/amyreese) -- [@AlexWaygood](https://github.com/AlexWaygood) -- [@dylwil3](https://github.com/dylwil3) -- [@njhearp](https://github.com/njhearp) -- [@woodruffw](https://github.com/woodruffw) -- [@dcreager](https://github.com/dcreager) -- [@TaKO8Ki](https://github.com/TaKO8Ki) -- [@BurntSushi](https://github.com/BurntSushi) -- [@salahelfarissi](https://github.com/salahelfarissi) -- [@MichaReiser](https://github.com/MichaReiser) - -## 0.13.0 - -Check out the [blog post](https://astral.sh/blog/ruff-v0.13.0) for a migration -guide and overview of the changes! +Released on 2025-10-07. ### Breaking changes -- **Several rules can now add `from __future__ import annotations` automatically** - - `TC001`, `TC002`, `TC003`, `RUF013`, and `UP037` now add `from __future__ import annotations` as part of their fixes when the - `lint.future-annotations` setting is enabled. This allows the rules to move - more imports into `TYPE_CHECKING` blocks (`TC001`, `TC002`, and `TC003`), - use PEP 604 union syntax on Python versions before 3.10 (`RUF013`), and - unquote more annotations (`UP037`). - -- **Full module paths are now used to verify first-party modules** - - Ruff now checks that the full path to a module exists on disk before - categorizing it as a first-party import. This change makes first-party - import detection more accurate, helping to avoid false positives on local - directories with the same name as a third-party dependency, for example. See - the [FAQ - section](https://docs.astral.sh/ruff/faq/#how-does-ruff-determine-which-of-my-imports-are-first-party-third-party-etc) on import categorization for more details. - -- **Deprecated rules must now be selected by exact rule code** - - Ruff will no longer activate deprecated rules selected by their group name - or prefix. As noted below, the two remaining deprecated rules were also - removed in this release, so this won't affect any current rules, but it will - still affect any deprecations in the future. - -- **The deprecated macOS configuration directory fallback has been removed** - - Ruff will no longer look for a user-level configuration file at - `~/Library/Application Support/ruff/ruff.toml` on macOS. This feature was - deprecated in v0.5 in favor of using the [XDG - specification](https://specifications.freedesktop.org/basedir-spec/latest/) - (usually resolving to `~/.config/ruff/ruff.toml`), like on Linux. The - fallback and accompanying deprecation warning have now been removed. - -### Removed Rules - -The following rules have been removed: - -- [`pandas-df-variable-name`](https://docs.astral.sh/ruff/rules/pandas-df-variable-name) (`PD901`) -- [`non-pep604-isinstance`](https://docs.astral.sh/ruff/rules/non-pep604-isinstance) (`UP038`) - -### Stabilization - -The following rules have been stabilized and are no longer in preview: - -- [`airflow-dag-no-schedule-argument`](https://docs.astral.sh/ruff/rules/airflow-dag-no-schedule-argument) - (`AIR002`) -- [`airflow3-removal`](https://docs.astral.sh/ruff/rules/airflow3-removal) (`AIR301`) -- [`airflow3-moved-to-provider`](https://docs.astral.sh/ruff/rules/airflow3-moved-to-provider) - (`AIR302`) -- [`airflow3-suggested-update`](https://docs.astral.sh/ruff/rules/airflow3-suggested-update) - (`AIR311`) -- [`airflow3-suggested-to-move-to-provider`](https://docs.astral.sh/ruff/rules/airflow3-suggested-to-move-to-provider) - (`AIR312`) -- [`long-sleep-not-forever`](https://docs.astral.sh/ruff/rules/long-sleep-not-forever) (`ASYNC116`) -- [`f-string-number-format`](https://docs.astral.sh/ruff/rules/f-string-number-format) (`FURB116`) -- [`os-symlink`](https://docs.astral.sh/ruff/rules/os-symlink) (`PTH211`) -- [`generic-not-last-base-class`](https://docs.astral.sh/ruff/rules/generic-not-last-base-class) - (`PYI059`) -- [`redundant-none-literal`](https://docs.astral.sh/ruff/rules/redundant-none-literal) (`PYI061`) -- [`pytest-raises-ambiguous-pattern`](https://docs.astral.sh/ruff/rules/pytest-raises-ambiguous-pattern) - (`RUF043`) -- [`unused-unpacked-variable`](https://docs.astral.sh/ruff/rules/unused-unpacked-variable) - (`RUF059`) -- [`useless-class-metaclass-type`](https://docs.astral.sh/ruff/rules/useless-class-metaclass-type) - (`UP050`) - -The following behaviors have been stabilized: - -- [`assert-raises-exception`](https://docs.astral.sh/ruff/rules/assert-raises-exception) (`B017`) - now checks for direct calls to `unittest.TestCase.assert_raises` and `pytest.raises` instead of - only the context manager forms. -- [`missing-trailing-comma`](https://docs.astral.sh/ruff/rules/missing-trailing-comma) (`COM812`) - and [`prohibited-trailing-comma`](https://docs.astral.sh/ruff/rules/prohibited-trailing-comma) - (`COM819`) now check for trailing commas in PEP 695 type parameter lists. -- [`raw-string-in-exception`](https://docs.astral.sh/ruff/rules/raw-string-in-exception) (`EM101`) - now also checks for byte strings in exception messages. -- [`invalid-mock-access`](https://docs.astral.sh/ruff/rules/invalid-mock-access) (`PGH005`) now - checks for `AsyncMock` methods like `not_awaited` in addition to the synchronous variants. -- [`useless-import-alias`](https://docs.astral.sh/ruff/rules/useless-import-alias) (`PLC0414`) no - longer applies to `__init__.py` files, where it conflicted with one of the suggested fixes for - [`unused-import`](https://docs.astral.sh/ruff/rules/unused-import) (`F401`). -- [`bidirectional-unicode`](https://docs.astral.sh/ruff/rules/bidirectional-unicode) (`PLE2502`) now - also checks for U+061C (Arabic Letter Mark). -- The fix for - [`multiple-with-statements`](https://docs.astral.sh/ruff/rules/multiple-with-statements) - (`SIM117`) is now marked as always safe. +- Update default and latest Python versions for 3.14 ([#20725](https://github.com/astral-sh/ruff/pull/20725)) ### Preview features -- \[`pyupgrade`\] Enable `UP043` in stub files ([#20027](https://github.com/astral-sh/ruff/pull/20027)) +- \[`flake8-bugbear`\] Include certain guaranteed-mutable expressions: tuples, generators, and assignment expressions (`B006`) ([#20024](https://github.com/astral-sh/ruff/pull/20024)) +- \[`refurb`\] Add fixes for `FURB101` and `FURB103` ([#20520](https://github.com/astral-sh/ruff/pull/20520)) +- \[`ruff`\] Extend `FA102` with listed PEP 585-compatible APIs ([#20659](https://github.com/astral-sh/ruff/pull/20659)) ### Bug fixes -- \[`pyupgrade`\] Apply `UP008` only when the `__class__` cell exists ([#19424](https://github.com/astral-sh/ruff/pull/19424)) -- \[`ruff`\] Fix empty f-string detection in `in-empty-collection` (`RUF060`) ([#20249](https://github.com/astral-sh/ruff/pull/20249)) - -### Server - -- Add support for using uv as an alternative formatter backend ([#19665](https://github.com/astral-sh/ruff/pull/19665)) +- \[`flake8-annotations`\] Fix return type annotations to handle shadowed builtin symbols (`ANN201`, `ANN202`, `ANN204`, `ANN205`, `ANN206`) ([#20612](https://github.com/astral-sh/ruff/pull/20612)) +- \[`flynt`\] Fix f-string quoting for mixed quote joiners (`FLY002`) ([#20662](https://github.com/astral-sh/ruff/pull/20662)) +- \[`isort`\] Fix inserting required imports before future imports (`I002`) ([#20676](https://github.com/astral-sh/ruff/pull/20676)) +- \[`ruff`\] Handle argfile expansion errors gracefully ([#20691](https://github.com/astral-sh/ruff/pull/20691)) +- \[`ruff`\] Skip `RUF051` if `else`/`elif` block is present ([#20705](https://github.com/astral-sh/ruff/pull/20705)) +- \[`ruff`\] Improve handling of intermixed comments inside from-imports ([#20561](https://github.com/astral-sh/ruff/pull/20561)) ### Documentation -- \[`pep8-naming`\] Fix formatting of `__all__` (`N816`) ([#20301](https://github.com/astral-sh/ruff/pull/20301)) +- \[`flake8-comprehensions`\] Clarify fix safety documentation (`C413`) ([#20640](https://github.com/astral-sh/ruff/pull/20640)) + +### Contributors + +- [@danparizher](https://github.com/danparizher) +- [@terror](https://github.com/terror) +- [@TaKO8Ki](https://github.com/TaKO8Ki) +- [@ntBre](https://github.com/ntBre) +- [@njhearp](https://github.com/njhearp) +- [@amyreese](https://github.com/amyreese) +- [@IDrokin117](https://github.com/IDrokin117) +- [@chirizxc](https://github.com/chirizxc) + +## 0.13.x + +See [changelogs/0.13.x](./changelogs/0.13.x.md) ## 0.12.x diff --git a/Cargo.lock b/Cargo.lock index 29debc0a8b..23823a5aa2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2738,7 +2738,7 @@ dependencies = [ [[package]] name = "ruff" -version = "0.13.3" +version = "0.14.0" dependencies = [ "anyhow", "argfile", @@ -2995,7 +2995,7 @@ dependencies = [ [[package]] name = "ruff_linter" -version = "0.13.3" +version = "0.14.0" dependencies = [ "aho-corasick", "anyhow", @@ -3349,7 +3349,7 @@ dependencies = [ [[package]] name = "ruff_wasm" -version = "0.13.3" +version = "0.14.0" dependencies = [ "console_error_panic_hook", "console_log", diff --git a/README.md b/README.md index 4d958091aa..bf5b1ce71a 100644 --- a/README.md +++ b/README.md @@ -148,8 +148,8 @@ curl -LsSf https://astral.sh/ruff/install.sh | sh powershell -c "irm https://astral.sh/ruff/install.ps1 | iex" # For a specific version. -curl -LsSf https://astral.sh/ruff/0.13.3/install.sh | sh -powershell -c "irm https://astral.sh/ruff/0.13.3/install.ps1 | iex" +curl -LsSf https://astral.sh/ruff/0.14.0/install.sh | sh +powershell -c "irm https://astral.sh/ruff/0.14.0/install.ps1 | iex" ``` You can also install Ruff via [Homebrew](https://formulae.brew.sh/formula/ruff), [Conda](https://anaconda.org/conda-forge/ruff), @@ -182,7 +182,7 @@ Ruff can also be used as a [pre-commit](https://pre-commit.com/) hook via [`ruff ```yaml - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: v0.13.3 + rev: v0.14.0 hooks: # Run the linter. - id: ruff-check diff --git a/changelogs/0.13.x.md b/changelogs/0.13.x.md new file mode 100644 index 0000000000..e242bc5478 --- /dev/null +++ b/changelogs/0.13.x.md @@ -0,0 +1,263 @@ +# Changelog 0.13.x + +## 0.13.0 + +Check out the [blog post](https://astral.sh/blog/ruff-v0.13.0) for a migration +guide and overview of the changes! + +### Breaking changes + +- **Several rules can now add `from __future__ import annotations` automatically** + + `TC001`, `TC002`, `TC003`, `RUF013`, and `UP037` now add `from __future__ import annotations` as part of their fixes when the + `lint.future-annotations` setting is enabled. This allows the rules to move + more imports into `TYPE_CHECKING` blocks (`TC001`, `TC002`, and `TC003`), + use PEP 604 union syntax on Python versions before 3.10 (`RUF013`), and + unquote more annotations (`UP037`). + +- **Full module paths are now used to verify first-party modules** + + Ruff now checks that the full path to a module exists on disk before + categorizing it as a first-party import. This change makes first-party + import detection more accurate, helping to avoid false positives on local + directories with the same name as a third-party dependency, for example. See + the [FAQ + section](https://docs.astral.sh/ruff/faq/#how-does-ruff-determine-which-of-my-imports-are-first-party-third-party-etc) on import categorization for more details. + +- **Deprecated rules must now be selected by exact rule code** + + Ruff will no longer activate deprecated rules selected by their group name + or prefix. As noted below, the two remaining deprecated rules were also + removed in this release, so this won't affect any current rules, but it will + still affect any deprecations in the future. + +- **The deprecated macOS configuration directory fallback has been removed** + + Ruff will no longer look for a user-level configuration file at + `~/Library/Application Support/ruff/ruff.toml` on macOS. This feature was + deprecated in v0.5 in favor of using the [XDG + specification](https://specifications.freedesktop.org/basedir-spec/latest/) + (usually resolving to `~/.config/ruff/ruff.toml`), like on Linux. The + fallback and accompanying deprecation warning have now been removed. + +### Removed Rules + +The following rules have been removed: + +- [`pandas-df-variable-name`](https://docs.astral.sh/ruff/rules/pandas-df-variable-name) (`PD901`) +- [`non-pep604-isinstance`](https://docs.astral.sh/ruff/rules/non-pep604-isinstance) (`UP038`) + +### Stabilization + +The following rules have been stabilized and are no longer in preview: + +- [`airflow-dag-no-schedule-argument`](https://docs.astral.sh/ruff/rules/airflow-dag-no-schedule-argument) + (`AIR002`) +- [`airflow3-removal`](https://docs.astral.sh/ruff/rules/airflow3-removal) (`AIR301`) +- [`airflow3-moved-to-provider`](https://docs.astral.sh/ruff/rules/airflow3-moved-to-provider) + (`AIR302`) +- [`airflow3-suggested-update`](https://docs.astral.sh/ruff/rules/airflow3-suggested-update) + (`AIR311`) +- [`airflow3-suggested-to-move-to-provider`](https://docs.astral.sh/ruff/rules/airflow3-suggested-to-move-to-provider) + (`AIR312`) +- [`long-sleep-not-forever`](https://docs.astral.sh/ruff/rules/long-sleep-not-forever) (`ASYNC116`) +- [`f-string-number-format`](https://docs.astral.sh/ruff/rules/f-string-number-format) (`FURB116`) +- [`os-symlink`](https://docs.astral.sh/ruff/rules/os-symlink) (`PTH211`) +- [`generic-not-last-base-class`](https://docs.astral.sh/ruff/rules/generic-not-last-base-class) + (`PYI059`) +- [`redundant-none-literal`](https://docs.astral.sh/ruff/rules/redundant-none-literal) (`PYI061`) +- [`pytest-raises-ambiguous-pattern`](https://docs.astral.sh/ruff/rules/pytest-raises-ambiguous-pattern) + (`RUF043`) +- [`unused-unpacked-variable`](https://docs.astral.sh/ruff/rules/unused-unpacked-variable) + (`RUF059`) +- [`useless-class-metaclass-type`](https://docs.astral.sh/ruff/rules/useless-class-metaclass-type) + (`UP050`) + +The following behaviors have been stabilized: + +- [`assert-raises-exception`](https://docs.astral.sh/ruff/rules/assert-raises-exception) (`B017`) + now checks for direct calls to `unittest.TestCase.assert_raises` and `pytest.raises` instead of + only the context manager forms. +- [`missing-trailing-comma`](https://docs.astral.sh/ruff/rules/missing-trailing-comma) (`COM812`) + and [`prohibited-trailing-comma`](https://docs.astral.sh/ruff/rules/prohibited-trailing-comma) + (`COM819`) now check for trailing commas in PEP 695 type parameter lists. +- [`raw-string-in-exception`](https://docs.astral.sh/ruff/rules/raw-string-in-exception) (`EM101`) + now also checks for byte strings in exception messages. +- [`invalid-mock-access`](https://docs.astral.sh/ruff/rules/invalid-mock-access) (`PGH005`) now + checks for `AsyncMock` methods like `not_awaited` in addition to the synchronous variants. +- [`useless-import-alias`](https://docs.astral.sh/ruff/rules/useless-import-alias) (`PLC0414`) no + longer applies to `__init__.py` files, where it conflicted with one of the suggested fixes for + [`unused-import`](https://docs.astral.sh/ruff/rules/unused-import) (`F401`). +- [`bidirectional-unicode`](https://docs.astral.sh/ruff/rules/bidirectional-unicode) (`PLE2502`) now + also checks for U+061C (Arabic Letter Mark). +- The fix for + [`multiple-with-statements`](https://docs.astral.sh/ruff/rules/multiple-with-statements) + (`SIM117`) is now marked as always safe. + +### Preview features + +- \[`pyupgrade`\] Enable `UP043` in stub files ([#20027](https://github.com/astral-sh/ruff/pull/20027)) + +### Bug fixes + +- \[`pyupgrade`\] Apply `UP008` only when the `__class__` cell exists ([#19424](https://github.com/astral-sh/ruff/pull/19424)) +- \[`ruff`\] Fix empty f-string detection in `in-empty-collection` (`RUF060`) ([#20249](https://github.com/astral-sh/ruff/pull/20249)) + +### Server + +- Add support for using uv as an alternative formatter backend ([#19665](https://github.com/astral-sh/ruff/pull/19665)) + +### Documentation + +- \[`pep8-naming`\] Fix formatting of `__all__` (`N816`) ([#20301](https://github.com/astral-sh/ruff/pull/20301)) + +## 0.13.1 + +Released on 2025-09-18. + +### Preview features + +- \[`flake8-simplify`\] Detect unnecessary `None` default for additional key expression types (`SIM910`) ([#20343](https://github.com/astral-sh/ruff/pull/20343)) +- \[`flake8-use-pathlib`\] Add fix for `PTH123` ([#20169](https://github.com/astral-sh/ruff/pull/20169)) +- \[`flake8-use-pathlib`\] Fix `PTH101`, `PTH104`, `PTH105`, `PTH121` fixes ([#20143](https://github.com/astral-sh/ruff/pull/20143)) +- \[`flake8-use-pathlib`\] Make `PTH111` fix unsafe because it can change behavior ([#20215](https://github.com/astral-sh/ruff/pull/20215)) +- \[`pycodestyle`\] Fix `E301` to only trigger for functions immediately within a class ([#19768](https://github.com/astral-sh/ruff/pull/19768)) +- \[`refurb`\] Mark `single-item-membership-test` fix as always unsafe (`FURB171`) ([#20279](https://github.com/astral-sh/ruff/pull/20279)) + +### Bug fixes + +- Handle t-strings for token-based rules and suppression comments ([#20357](https://github.com/astral-sh/ruff/pull/20357)) +- \[`flake8-bandit`\] Fix truthiness: dict-only `**` displays not truthy for `shell` (`S602`, `S604`, `S609`) ([#20177](https://github.com/astral-sh/ruff/pull/20177)) +- \[`flake8-simplify`\] Fix diagnostic to show correct method name for `str.rsplit` calls (`SIM905`) ([#20459](https://github.com/astral-sh/ruff/pull/20459)) +- \[`flynt`\] Use triple quotes for joined raw strings with newlines (`FLY002`) ([#20197](https://github.com/astral-sh/ruff/pull/20197)) +- \[`pyupgrade`\] Fix false positive when class name is shadowed by local variable (`UP008`) ([#20427](https://github.com/astral-sh/ruff/pull/20427)) +- \[`pyupgrade`\] Prevent infinite loop with `I002` and `UP026` ([#20327](https://github.com/astral-sh/ruff/pull/20327)) +- \[`ruff`\] Recognize t-strings, generators, and lambdas in `invalid-index-type` (`RUF016`) ([#20213](https://github.com/astral-sh/ruff/pull/20213)) + +### Rule changes + +- \[`RUF102`\] Respect rule redirects in invalid rule code detection ([#20245](https://github.com/astral-sh/ruff/pull/20245)) +- \[`flake8-bugbear`\] Mark the fix for `unreliable-callable-check` as always unsafe (`B004`) ([#20318](https://github.com/astral-sh/ruff/pull/20318)) +- \[`ruff`\] Allow dataclass attribute value instantiation from nested frozen dataclass (`RUF009`) ([#20352](https://github.com/astral-sh/ruff/pull/20352)) + +### CLI + +- Add fixes to `output-format=sarif` ([#20300](https://github.com/astral-sh/ruff/pull/20300)) +- Treat panics as fatal diagnostics, sort panics last ([#20258](https://github.com/astral-sh/ruff/pull/20258)) + +### Documentation + +- \[`ruff`\] Add `analyze.string-imports-min-dots` to settings ([#20375](https://github.com/astral-sh/ruff/pull/20375)) +- Update README.md with Albumentations new repository URL ([#20415](https://github.com/astral-sh/ruff/pull/20415)) + +### Other changes + +- Bump MSRV to Rust 1.88 ([#20470](https://github.com/astral-sh/ruff/pull/20470)) +- Enable inline noqa for multiline strings in playground ([#20442](https://github.com/astral-sh/ruff/pull/20442)) + +### Contributors + +- [@chirizxc](https://github.com/chirizxc) +- [@danparizher](https://github.com/danparizher) +- [@IDrokin117](https://github.com/IDrokin117) +- [@amyreese](https://github.com/amyreese) +- [@AlexWaygood](https://github.com/AlexWaygood) +- [@dylwil3](https://github.com/dylwil3) +- [@njhearp](https://github.com/njhearp) +- [@woodruffw](https://github.com/woodruffw) +- [@dcreager](https://github.com/dcreager) +- [@TaKO8Ki](https://github.com/TaKO8Ki) +- [@BurntSushi](https://github.com/BurntSushi) +- [@salahelfarissi](https://github.com/salahelfarissi) +- [@MichaReiser](https://github.com/MichaReiser) + +## 0.13.2 + +Released on 2025-09-25. + +### Preview features + +- \[`flake8-async`\] Implement `blocking-path-method` (`ASYNC240`) ([#20264](https://github.com/astral-sh/ruff/pull/20264)) +- \[`flake8-bugbear`\] Implement `map-without-explicit-strict` (`B912`) ([#20429](https://github.com/astral-sh/ruff/pull/20429)) +- \[`flake8-bultins`\] Detect class-scope builtin shadowing in decorators, default args, and attribute initializers (`A003`) ([#20178](https://github.com/astral-sh/ruff/pull/20178)) +- \[`ruff`\] Implement `logging-eager-conversion` (`RUF065`) ([#19942](https://github.com/astral-sh/ruff/pull/19942)) +- Include `.pyw` files by default when linting and formatting ([#20458](https://github.com/astral-sh/ruff/pull/20458)) + +### Bug fixes + +- Deduplicate input paths ([#20105](https://github.com/astral-sh/ruff/pull/20105)) +- \[`flake8-comprehensions`\] Preserve trailing commas for single-element lists (`C409`) ([#19571](https://github.com/astral-sh/ruff/pull/19571)) +- \[`flake8-pyi`\] Avoid syntax error from conflict with `PIE790` (`PYI021`) ([#20010](https://github.com/astral-sh/ruff/pull/20010)) +- \[`flake8-simplify`\] Correct fix for positive `maxsplit` without separator (`SIM905`) ([#20056](https://github.com/astral-sh/ruff/pull/20056)) +- \[`pyupgrade`\] Fix `UP008` not to apply when `__class__` is a local variable ([#20497](https://github.com/astral-sh/ruff/pull/20497)) +- \[`ruff`\] Fix `B004` to skip invalid `hasattr`/`getattr` calls ([#20486](https://github.com/astral-sh/ruff/pull/20486)) +- \[`ruff`\] Replace `-nan` with `nan` when using the value to construct a `Decimal` (`FURB164` ) ([#20391](https://github.com/astral-sh/ruff/pull/20391)) + +### Documentation + +- Add 'Finding ways to help' to CONTRIBUTING.md ([#20567](https://github.com/astral-sh/ruff/pull/20567)) +- Update import path to `ruff-wasm-web` ([#20539](https://github.com/astral-sh/ruff/pull/20539)) +- \[`flake8-bandit`\] Clarify the supported hashing functions (`S324`) ([#20534](https://github.com/astral-sh/ruff/pull/20534)) + +### Other changes + +- \[`playground`\] Allow hover quick fixes to appear for overlapping diagnostics ([#20527](https://github.com/astral-sh/ruff/pull/20527)) +- \[`playground`\] Fix non‑BMP code point handling in quick fixes and markers ([#20526](https://github.com/astral-sh/ruff/pull/20526)) + +### Contributors + +- [@BurntSushi](https://github.com/BurntSushi) +- [@mtshiba](https://github.com/mtshiba) +- [@second-ed](https://github.com/second-ed) +- [@danparizher](https://github.com/danparizher) +- [@ShikChen](https://github.com/ShikChen) +- [@PieterCK](https://github.com/PieterCK) +- [@GDYendell](https://github.com/GDYendell) +- [@RazerM](https://github.com/RazerM) +- [@TaKO8Ki](https://github.com/TaKO8Ki) +- [@amyreese](https://github.com/amyreese) +- [@ntbre](https://github.com/ntBre) +- [@MichaReiser](https://github.com/MichaReiser) + +## 0.13.3 + +Released on 2025-10-02. + +### Preview features + +- Display diffs for `ruff format --check` and add support for different output formats ([#20443](https://github.com/astral-sh/ruff/pull/20443)) +- \[`pyflakes`\] Handle some common submodule import situations for `unused-import` (`F401`) ([#20200](https://github.com/astral-sh/ruff/pull/20200)) +- \[`ruff`\] Do not flag `%r` + `repr()` combinations (`RUF065`) ([#20600](https://github.com/astral-sh/ruff/pull/20600)) + +### Bug fixes + +- \[`cli`\] Add conflict between `--add-noqa` and `--diff` options ([#20642](https://github.com/astral-sh/ruff/pull/20642)) +- \[`pylint`\] Exempt required imports from `PLR0402` ([#20381](https://github.com/astral-sh/ruff/pull/20381)) +- \[`pylint`\] Fix missing `max-nested-blocks` in settings display ([#20574](https://github.com/astral-sh/ruff/pull/20574)) +- \[`pyupgrade`\] Prevent infinite loop with `I002` and `UP026` ([#20634](https://github.com/astral-sh/ruff/pull/20634)) + +### Rule changes + +- \[`flake8-simplify`\] Improve help message clarity (`SIM105`) ([#20548](https://github.com/astral-sh/ruff/pull/20548)) + +### Documentation + +- Add the *The Basics* title back to CONTRIBUTING.md ([#20624](https://github.com/astral-sh/ruff/pull/20624)) +- Fixed documentation for try_consider_else ([#20587](https://github.com/astral-sh/ruff/pull/20587)) +- \[`isort`\] Clarify dependency between `order-by-type` and `case-sensitive` settings ([#20559](https://github.com/astral-sh/ruff/pull/20559)) +- \[`pylint`\] Clarify fix safety to include left-hand hashability (`PLR6201`) ([#20518](https://github.com/astral-sh/ruff/pull/20518)) + +### Other changes + +- \[`playground`\] Fix quick fixes for empty ranges in playground ([#20599](https://github.com/astral-sh/ruff/pull/20599)) + +### Contributors + +- [@TaKO8Ki](https://github.com/TaKO8Ki) +- [@ntBre](https://github.com/ntBre) +- [@dylwil3](https://github.com/dylwil3) +- [@MichaReiser](https://github.com/MichaReiser) +- [@danparizher](https://github.com/danparizher) +- [@LilMonk](https://github.com/LilMonk) +- [@mgiovani](https://github.com/mgiovani) +- [@IDrokin117](https://github.com/IDrokin117) diff --git a/crates/ruff/Cargo.toml b/crates/ruff/Cargo.toml index 8c5728477b..7bbce1f163 100644 --- a/crates/ruff/Cargo.toml +++ b/crates/ruff/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ruff" -version = "0.13.3" +version = "0.14.0" publish = true authors = { workspace = true } edition = { workspace = true } diff --git a/crates/ruff_linter/Cargo.toml b/crates/ruff_linter/Cargo.toml index 37b891b8b9..5deb8ffb3e 100644 --- a/crates/ruff_linter/Cargo.toml +++ b/crates/ruff_linter/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ruff_linter" -version = "0.13.3" +version = "0.14.0" publish = false authors = { workspace = true } edition = { workspace = true } diff --git a/crates/ruff_wasm/Cargo.toml b/crates/ruff_wasm/Cargo.toml index 41f76394d8..ad2ec2c3f5 100644 --- a/crates/ruff_wasm/Cargo.toml +++ b/crates/ruff_wasm/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ruff_wasm" -version = "0.13.3" +version = "0.14.0" publish = false authors = { workspace = true } edition = { workspace = true } diff --git a/docs/integrations.md b/docs/integrations.md index 470a7af673..1c561760e0 100644 --- a/docs/integrations.md +++ b/docs/integrations.md @@ -80,7 +80,7 @@ You can add the following configuration to `.gitlab-ci.yml` to run a `ruff forma stage: build interruptible: true image: - name: ghcr.io/astral-sh/ruff:0.13.3-alpine + name: ghcr.io/astral-sh/ruff:0.14.0-alpine before_script: - cd $CI_PROJECT_DIR - ruff --version @@ -106,7 +106,7 @@ Ruff can be used as a [pre-commit](https://pre-commit.com) hook via [`ruff-pre-c ```yaml - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: v0.13.3 + rev: v0.14.0 hooks: # Run the linter. - id: ruff-check @@ -119,7 +119,7 @@ To enable lint fixes, add the `--fix` argument to the lint hook: ```yaml - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: v0.13.3 + rev: v0.14.0 hooks: # Run the linter. - id: ruff-check @@ -133,7 +133,7 @@ To avoid running on Jupyter Notebooks, remove `jupyter` from the list of allowed ```yaml - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: v0.13.3 + rev: v0.14.0 hooks: # Run the linter. - id: ruff-check diff --git a/docs/tutorial.md b/docs/tutorial.md index c0ede285e6..7e8f712eb6 100644 --- a/docs/tutorial.md +++ b/docs/tutorial.md @@ -369,7 +369,7 @@ This tutorial has focused on Ruff's command-line interface, but Ruff can also be ```yaml - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: v0.13.3 + rev: v0.14.0 hooks: # Run the linter. - id: ruff diff --git a/pyproject.toml b/pyproject.toml index baf21144c4..87b8bf9ee0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "maturin" [project] name = "ruff" -version = "0.13.3" +version = "0.14.0" description = "An extremely fast Python linter and code formatter, written in Rust." authors = [{ name = "Astral Software Inc.", email = "hey@astral.sh" }] readme = "README.md" diff --git a/scripts/benchmarks/pyproject.toml b/scripts/benchmarks/pyproject.toml index 4ab274b53d..7c491bf099 100644 --- a/scripts/benchmarks/pyproject.toml +++ b/scripts/benchmarks/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "scripts" -version = "0.13.3" +version = "0.14.0" description = "" authors = ["Charles Marsh "]