|
| 1 | +# Changelog 0.13.x |
| 2 | + |
| 3 | +## 0.13.0 |
| 4 | + |
| 5 | +Check out the [blog post](https://astral.sh/blog/ruff-v0.13.0) for a migration |
| 6 | +guide and overview of the changes! |
| 7 | + |
| 8 | +### Breaking changes |
| 9 | + |
| 10 | +- **Several rules can now add `from __future__ import annotations` automatically** |
| 11 | + |
| 12 | + `TC001`, `TC002`, `TC003`, `RUF013`, and `UP037` now add `from __future__ import annotations` as part of their fixes when the |
| 13 | + `lint.future-annotations` setting is enabled. This allows the rules to move |
| 14 | + more imports into `TYPE_CHECKING` blocks (`TC001`, `TC002`, and `TC003`), |
| 15 | + use PEP 604 union syntax on Python versions before 3.10 (`RUF013`), and |
| 16 | + unquote more annotations (`UP037`). |
| 17 | + |
| 18 | +- **Full module paths are now used to verify first-party modules** |
| 19 | + |
| 20 | + Ruff now checks that the full path to a module exists on disk before |
| 21 | + categorizing it as a first-party import. This change makes first-party |
| 22 | + import detection more accurate, helping to avoid false positives on local |
| 23 | + directories with the same name as a third-party dependency, for example. See |
| 24 | + the [FAQ |
| 25 | + 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. |
| 26 | + |
| 27 | +- **Deprecated rules must now be selected by exact rule code** |
| 28 | + |
| 29 | + Ruff will no longer activate deprecated rules selected by their group name |
| 30 | + or prefix. As noted below, the two remaining deprecated rules were also |
| 31 | + removed in this release, so this won't affect any current rules, but it will |
| 32 | + still affect any deprecations in the future. |
| 33 | + |
| 34 | +- **The deprecated macOS configuration directory fallback has been removed** |
| 35 | + |
| 36 | + Ruff will no longer look for a user-level configuration file at |
| 37 | + `~/Library/Application Support/ruff/ruff.toml` on macOS. This feature was |
| 38 | + deprecated in v0.5 in favor of using the [XDG |
| 39 | + specification](https://specifications.freedesktop.org/basedir-spec/latest/) |
| 40 | + (usually resolving to `~/.config/ruff/ruff.toml`), like on Linux. The |
| 41 | + fallback and accompanying deprecation warning have now been removed. |
| 42 | + |
| 43 | +### Removed Rules |
| 44 | + |
| 45 | +The following rules have been removed: |
| 46 | + |
| 47 | +- [`pandas-df-variable-name`](https://docs.astral.sh/ruff/rules/pandas-df-variable-name) (`PD901`) |
| 48 | +- [`non-pep604-isinstance`](https://docs.astral.sh/ruff/rules/non-pep604-isinstance) (`UP038`) |
| 49 | + |
| 50 | +### Stabilization |
| 51 | + |
| 52 | +The following rules have been stabilized and are no longer in preview: |
| 53 | + |
| 54 | +- [`airflow-dag-no-schedule-argument`](https://docs.astral.sh/ruff/rules/airflow-dag-no-schedule-argument) |
| 55 | + (`AIR002`) |
| 56 | +- [`airflow3-removal`](https://docs.astral.sh/ruff/rules/airflow3-removal) (`AIR301`) |
| 57 | +- [`airflow3-moved-to-provider`](https://docs.astral.sh/ruff/rules/airflow3-moved-to-provider) |
| 58 | + (`AIR302`) |
| 59 | +- [`airflow3-suggested-update`](https://docs.astral.sh/ruff/rules/airflow3-suggested-update) |
| 60 | + (`AIR311`) |
| 61 | +- [`airflow3-suggested-to-move-to-provider`](https://docs.astral.sh/ruff/rules/airflow3-suggested-to-move-to-provider) |
| 62 | + (`AIR312`) |
| 63 | +- [`long-sleep-not-forever`](https://docs.astral.sh/ruff/rules/long-sleep-not-forever) (`ASYNC116`) |
| 64 | +- [`f-string-number-format`](https://docs.astral.sh/ruff/rules/f-string-number-format) (`FURB116`) |
| 65 | +- [`os-symlink`](https://docs.astral.sh/ruff/rules/os-symlink) (`PTH211`) |
| 66 | +- [`generic-not-last-base-class`](https://docs.astral.sh/ruff/rules/generic-not-last-base-class) |
| 67 | + (`PYI059`) |
| 68 | +- [`redundant-none-literal`](https://docs.astral.sh/ruff/rules/redundant-none-literal) (`PYI061`) |
| 69 | +- [`pytest-raises-ambiguous-pattern`](https://docs.astral.sh/ruff/rules/pytest-raises-ambiguous-pattern) |
| 70 | + (`RUF043`) |
| 71 | +- [`unused-unpacked-variable`](https://docs.astral.sh/ruff/rules/unused-unpacked-variable) |
| 72 | + (`RUF059`) |
| 73 | +- [`useless-class-metaclass-type`](https://docs.astral.sh/ruff/rules/useless-class-metaclass-type) |
| 74 | + (`UP050`) |
| 75 | + |
| 76 | +The following behaviors have been stabilized: |
| 77 | + |
| 78 | +- [`assert-raises-exception`](https://docs.astral.sh/ruff/rules/assert-raises-exception) (`B017`) |
| 79 | + now checks for direct calls to `unittest.TestCase.assert_raises` and `pytest.raises` instead of |
| 80 | + only the context manager forms. |
| 81 | +- [`missing-trailing-comma`](https://docs.astral.sh/ruff/rules/missing-trailing-comma) (`COM812`) |
| 82 | + and [`prohibited-trailing-comma`](https://docs.astral.sh/ruff/rules/prohibited-trailing-comma) |
| 83 | + (`COM819`) now check for trailing commas in PEP 695 type parameter lists. |
| 84 | +- [`raw-string-in-exception`](https://docs.astral.sh/ruff/rules/raw-string-in-exception) (`EM101`) |
| 85 | + now also checks for byte strings in exception messages. |
| 86 | +- [`invalid-mock-access`](https://docs.astral.sh/ruff/rules/invalid-mock-access) (`PGH005`) now |
| 87 | + checks for `AsyncMock` methods like `not_awaited` in addition to the synchronous variants. |
| 88 | +- [`useless-import-alias`](https://docs.astral.sh/ruff/rules/useless-import-alias) (`PLC0414`) no |
| 89 | + longer applies to `__init__.py` files, where it conflicted with one of the suggested fixes for |
| 90 | + [`unused-import`](https://docs.astral.sh/ruff/rules/unused-import) (`F401`). |
| 91 | +- [`bidirectional-unicode`](https://docs.astral.sh/ruff/rules/bidirectional-unicode) (`PLE2502`) now |
| 92 | + also checks for U+061C (Arabic Letter Mark). |
| 93 | +- The fix for |
| 94 | + [`multiple-with-statements`](https://docs.astral.sh/ruff/rules/multiple-with-statements) |
| 95 | + (`SIM117`) is now marked as always safe. |
| 96 | + |
| 97 | +### Preview features |
| 98 | + |
| 99 | +- \[`pyupgrade`\] Enable `UP043` in stub files ([#20027](https://github.com/astral-sh/ruff/pull/20027)) |
| 100 | + |
| 101 | +### Bug fixes |
| 102 | + |
| 103 | +- \[`pyupgrade`\] Apply `UP008` only when the `__class__` cell exists ([#19424](https://github.com/astral-sh/ruff/pull/19424)) |
| 104 | +- \[`ruff`\] Fix empty f-string detection in `in-empty-collection` (`RUF060`) ([#20249](https://github.com/astral-sh/ruff/pull/20249)) |
| 105 | + |
| 106 | +### Server |
| 107 | + |
| 108 | +- Add support for using uv as an alternative formatter backend ([#19665](https://github.com/astral-sh/ruff/pull/19665)) |
| 109 | + |
| 110 | +### Documentation |
| 111 | + |
| 112 | +- \[`pep8-naming`\] Fix formatting of `__all__` (`N816`) ([#20301](https://github.com/astral-sh/ruff/pull/20301)) |
| 113 | + |
| 114 | +## 0.13.1 |
| 115 | + |
| 116 | +Released on 2025-09-18. |
| 117 | + |
| 118 | +### Preview features |
| 119 | + |
| 120 | +- \[`flake8-simplify`\] Detect unnecessary `None` default for additional key expression types (`SIM910`) ([#20343](https://github.com/astral-sh/ruff/pull/20343)) |
| 121 | +- \[`flake8-use-pathlib`\] Add fix for `PTH123` ([#20169](https://github.com/astral-sh/ruff/pull/20169)) |
| 122 | +- \[`flake8-use-pathlib`\] Fix `PTH101`, `PTH104`, `PTH105`, `PTH121` fixes ([#20143](https://github.com/astral-sh/ruff/pull/20143)) |
| 123 | +- \[`flake8-use-pathlib`\] Make `PTH111` fix unsafe because it can change behavior ([#20215](https://github.com/astral-sh/ruff/pull/20215)) |
| 124 | +- \[`pycodestyle`\] Fix `E301` to only trigger for functions immediately within a class ([#19768](https://github.com/astral-sh/ruff/pull/19768)) |
| 125 | +- \[`refurb`\] Mark `single-item-membership-test` fix as always unsafe (`FURB171`) ([#20279](https://github.com/astral-sh/ruff/pull/20279)) |
| 126 | + |
| 127 | +### Bug fixes |
| 128 | + |
| 129 | +- Handle t-strings for token-based rules and suppression comments ([#20357](https://github.com/astral-sh/ruff/pull/20357)) |
| 130 | +- \[`flake8-bandit`\] Fix truthiness: dict-only `**` displays not truthy for `shell` (`S602`, `S604`, `S609`) ([#20177](https://github.com/astral-sh/ruff/pull/20177)) |
| 131 | +- \[`flake8-simplify`\] Fix diagnostic to show correct method name for `str.rsplit` calls (`SIM905`) ([#20459](https://github.com/astral-sh/ruff/pull/20459)) |
| 132 | +- \[`flynt`\] Use triple quotes for joined raw strings with newlines (`FLY002`) ([#20197](https://github.com/astral-sh/ruff/pull/20197)) |
| 133 | +- \[`pyupgrade`\] Fix false positive when class name is shadowed by local variable (`UP008`) ([#20427](https://github.com/astral-sh/ruff/pull/20427)) |
| 134 | +- \[`pyupgrade`\] Prevent infinite loop with `I002` and `UP026` ([#20327](https://github.com/astral-sh/ruff/pull/20327)) |
| 135 | +- \[`ruff`\] Recognize t-strings, generators, and lambdas in `invalid-index-type` (`RUF016`) ([#20213](https://github.com/astral-sh/ruff/pull/20213)) |
| 136 | + |
| 137 | +### Rule changes |
| 138 | + |
| 139 | +- \[`RUF102`\] Respect rule redirects in invalid rule code detection ([#20245](https://github.com/astral-sh/ruff/pull/20245)) |
| 140 | +- \[`flake8-bugbear`\] Mark the fix for `unreliable-callable-check` as always unsafe (`B004`) ([#20318](https://github.com/astral-sh/ruff/pull/20318)) |
| 141 | +- \[`ruff`\] Allow dataclass attribute value instantiation from nested frozen dataclass (`RUF009`) ([#20352](https://github.com/astral-sh/ruff/pull/20352)) |
| 142 | + |
| 143 | +### CLI |
| 144 | + |
| 145 | +- Add fixes to `output-format=sarif` ([#20300](https://github.com/astral-sh/ruff/pull/20300)) |
| 146 | +- Treat panics as fatal diagnostics, sort panics last ([#20258](https://github.com/astral-sh/ruff/pull/20258)) |
| 147 | + |
| 148 | +### Documentation |
| 149 | + |
| 150 | +- \[`ruff`\] Add `analyze.string-imports-min-dots` to settings ([#20375](https://github.com/astral-sh/ruff/pull/20375)) |
| 151 | +- Update README.md with Albumentations new repository URL ([#20415](https://github.com/astral-sh/ruff/pull/20415)) |
| 152 | + |
| 153 | +### Other changes |
| 154 | + |
| 155 | +- Bump MSRV to Rust 1.88 ([#20470](https://github.com/astral-sh/ruff/pull/20470)) |
| 156 | +- Enable inline noqa for multiline strings in playground ([#20442](https://github.com/astral-sh/ruff/pull/20442)) |
| 157 | + |
| 158 | +### Contributors |
| 159 | + |
| 160 | +- [@chirizxc](https://github.com/chirizxc) |
| 161 | +- [@danparizher](https://github.com/danparizher) |
| 162 | +- [@IDrokin117](https://github.com/IDrokin117) |
| 163 | +- [@amyreese](https://github.com/amyreese) |
| 164 | +- [@AlexWaygood](https://github.com/AlexWaygood) |
| 165 | +- [@dylwil3](https://github.com/dylwil3) |
| 166 | +- [@njhearp](https://github.com/njhearp) |
| 167 | +- [@woodruffw](https://github.com/woodruffw) |
| 168 | +- [@dcreager](https://github.com/dcreager) |
| 169 | +- [@TaKO8Ki](https://github.com/TaKO8Ki) |
| 170 | +- [@BurntSushi](https://github.com/BurntSushi) |
| 171 | +- [@salahelfarissi](https://github.com/salahelfarissi) |
| 172 | +- [@MichaReiser](https://github.com/MichaReiser) |
| 173 | + |
| 174 | +## 0.13.2 |
| 175 | + |
| 176 | +Released on 2025-09-25. |
| 177 | + |
| 178 | +### Preview features |
| 179 | + |
| 180 | +- \[`flake8-async`\] Implement `blocking-path-method` (`ASYNC240`) ([#20264](https://github.com/astral-sh/ruff/pull/20264)) |
| 181 | +- \[`flake8-bugbear`\] Implement `map-without-explicit-strict` (`B912`) ([#20429](https://github.com/astral-sh/ruff/pull/20429)) |
| 182 | +- \[`flake8-bultins`\] Detect class-scope builtin shadowing in decorators, default args, and attribute initializers (`A003`) ([#20178](https://github.com/astral-sh/ruff/pull/20178)) |
| 183 | +- \[`ruff`\] Implement `logging-eager-conversion` (`RUF065`) ([#19942](https://github.com/astral-sh/ruff/pull/19942)) |
| 184 | +- Include `.pyw` files by default when linting and formatting ([#20458](https://github.com/astral-sh/ruff/pull/20458)) |
| 185 | + |
| 186 | +### Bug fixes |
| 187 | + |
| 188 | +- Deduplicate input paths ([#20105](https://github.com/astral-sh/ruff/pull/20105)) |
| 189 | +- \[`flake8-comprehensions`\] Preserve trailing commas for single-element lists (`C409`) ([#19571](https://github.com/astral-sh/ruff/pull/19571)) |
| 190 | +- \[`flake8-pyi`\] Avoid syntax error from conflict with `PIE790` (`PYI021`) ([#20010](https://github.com/astral-sh/ruff/pull/20010)) |
| 191 | +- \[`flake8-simplify`\] Correct fix for positive `maxsplit` without separator (`SIM905`) ([#20056](https://github.com/astral-sh/ruff/pull/20056)) |
| 192 | +- \[`pyupgrade`\] Fix `UP008` not to apply when `__class__` is a local variable ([#20497](https://github.com/astral-sh/ruff/pull/20497)) |
| 193 | +- \[`ruff`\] Fix `B004` to skip invalid `hasattr`/`getattr` calls ([#20486](https://github.com/astral-sh/ruff/pull/20486)) |
| 194 | +- \[`ruff`\] Replace `-nan` with `nan` when using the value to construct a `Decimal` (`FURB164` ) ([#20391](https://github.com/astral-sh/ruff/pull/20391)) |
| 195 | + |
| 196 | +### Documentation |
| 197 | + |
| 198 | +- Add 'Finding ways to help' to CONTRIBUTING.md ([#20567](https://github.com/astral-sh/ruff/pull/20567)) |
| 199 | +- Update import path to `ruff-wasm-web` ([#20539](https://github.com/astral-sh/ruff/pull/20539)) |
| 200 | +- \[`flake8-bandit`\] Clarify the supported hashing functions (`S324`) ([#20534](https://github.com/astral-sh/ruff/pull/20534)) |
| 201 | + |
| 202 | +### Other changes |
| 203 | + |
| 204 | +- \[`playground`\] Allow hover quick fixes to appear for overlapping diagnostics ([#20527](https://github.com/astral-sh/ruff/pull/20527)) |
| 205 | +- \[`playground`\] Fix non‑BMP code point handling in quick fixes and markers ([#20526](https://github.com/astral-sh/ruff/pull/20526)) |
| 206 | + |
| 207 | +### Contributors |
| 208 | + |
| 209 | +- [@BurntSushi](https://github.com/BurntSushi) |
| 210 | +- [@mtshiba](https://github.com/mtshiba) |
| 211 | +- [@second-ed](https://github.com/second-ed) |
| 212 | +- [@danparizher](https://github.com/danparizher) |
| 213 | +- [@ShikChen](https://github.com/ShikChen) |
| 214 | +- [@PieterCK](https://github.com/PieterCK) |
| 215 | +- [@GDYendell](https://github.com/GDYendell) |
| 216 | +- [@RazerM](https://github.com/RazerM) |
| 217 | +- [@TaKO8Ki](https://github.com/TaKO8Ki) |
| 218 | +- [@amyreese](https://github.com/amyreese) |
| 219 | +- [@ntbre](https://github.com/ntBre) |
| 220 | +- [@MichaReiser](https://github.com/MichaReiser) |
| 221 | + |
| 222 | +## 0.13.3 |
| 223 | + |
| 224 | +Released on 2025-10-02. |
| 225 | + |
| 226 | +### Preview features |
| 227 | + |
| 228 | +- Display diffs for `ruff format --check` and add support for different output formats ([#20443](https://github.com/astral-sh/ruff/pull/20443)) |
| 229 | +- \[`pyflakes`\] Handle some common submodule import situations for `unused-import` (`F401`) ([#20200](https://github.com/astral-sh/ruff/pull/20200)) |
| 230 | +- \[`ruff`\] Do not flag `%r` + `repr()` combinations (`RUF065`) ([#20600](https://github.com/astral-sh/ruff/pull/20600)) |
| 231 | + |
| 232 | +### Bug fixes |
| 233 | + |
| 234 | +- \[`cli`\] Add conflict between `--add-noqa` and `--diff` options ([#20642](https://github.com/astral-sh/ruff/pull/20642)) |
| 235 | +- \[`pylint`\] Exempt required imports from `PLR0402` ([#20381](https://github.com/astral-sh/ruff/pull/20381)) |
| 236 | +- \[`pylint`\] Fix missing `max-nested-blocks` in settings display ([#20574](https://github.com/astral-sh/ruff/pull/20574)) |
| 237 | +- \[`pyupgrade`\] Prevent infinite loop with `I002` and `UP026` ([#20634](https://github.com/astral-sh/ruff/pull/20634)) |
| 238 | + |
| 239 | +### Rule changes |
| 240 | + |
| 241 | +- \[`flake8-simplify`\] Improve help message clarity (`SIM105`) ([#20548](https://github.com/astral-sh/ruff/pull/20548)) |
| 242 | + |
| 243 | +### Documentation |
| 244 | + |
| 245 | +- Add the *The Basics* title back to CONTRIBUTING.md ([#20624](https://github.com/astral-sh/ruff/pull/20624)) |
| 246 | +- Fixed documentation for try_consider_else ([#20587](https://github.com/astral-sh/ruff/pull/20587)) |
| 247 | +- \[`isort`\] Clarify dependency between `order-by-type` and `case-sensitive` settings ([#20559](https://github.com/astral-sh/ruff/pull/20559)) |
| 248 | +- \[`pylint`\] Clarify fix safety to include left-hand hashability (`PLR6201`) ([#20518](https://github.com/astral-sh/ruff/pull/20518)) |
| 249 | + |
| 250 | +### Other changes |
| 251 | + |
| 252 | +- \[`playground`\] Fix quick fixes for empty ranges in playground ([#20599](https://github.com/astral-sh/ruff/pull/20599)) |
| 253 | + |
| 254 | +### Contributors |
| 255 | + |
| 256 | +- [@TaKO8Ki](https://github.com/TaKO8Ki) |
| 257 | +- [@ntBre](https://github.com/ntBre) |
| 258 | +- [@dylwil3](https://github.com/dylwil3) |
| 259 | +- [@MichaReiser](https://github.com/MichaReiser) |
| 260 | +- [@danparizher](https://github.com/danparizher) |
| 261 | +- [@LilMonk](https://github.com/LilMonk) |
| 262 | +- [@mgiovani](https://github.com/mgiovani) |
| 263 | +- [@IDrokin117](https://github.com/IDrokin117) |
0 commit comments