Skip to content

Commit 8358ad8

Browse files
MichaReiserAlexWaygoodDaverball
authored
Ruff 0.8 release (#14486)
Co-authored-by: Alex Waygood <[email protected]> Co-authored-by: David Salvisberg <[email protected]>
1 parent 2b8b1ef commit 8358ad8

File tree

10 files changed

+139
-15
lines changed

10 files changed

+139
-15
lines changed

BREAKING_CHANGES.md

+25
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,30 @@
11
# Breaking Changes
22

3+
## 0.8.0
4+
5+
- **Default to Python 3.9**
6+
7+
Ruff now defaults to Python 3.9 instead of 3.8 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) ([#13896](https://github.com/astral-sh/ruff/pull/13896))
8+
9+
- **Changed location of `pydoclint` diagnostics**
10+
11+
[`pydoclint`](https://docs.astral.sh/ruff/rules/#pydoclint-doc) diagnostics now point to the first-line of the problematic docstring. Previously, this was not the case.
12+
13+
If you've opted into these preview rules but have them suppressed using
14+
[`noqa`](https://docs.astral.sh/ruff/linter/#error-suppression) comments in
15+
some places, this change may mean that you need to move the `noqa` suppression
16+
comments. Most users should be unaffected by this change.
17+
18+
- **Use XDG (i.e. `~/.local/bin`) instead of the Cargo home directory in the standalone installer**
19+
20+
Previously, Ruff's installer used `$CARGO_HOME` or `~/.cargo/bin` for its target install directory. Now, Ruff will be installed into `$XDG_BIN_HOME`, `$XDG_DATA_HOME/../bin`, or `~/.local/bin` (in that order).
21+
22+
This change is only relevant to users of the standalone Ruff installer (using the shell or PowerShell script). If you installed Ruff using uv or pip, you should be unaffected.
23+
24+
- **Changes to the line width calculation**
25+
26+
Ruff now uses a new version of the [unicode-width](https://github.com/unicode-rs/unicode-width) Rust crate to calculate the line width. In very rare cases, this may lead to lines containing Unicode characters being reformatted, or being considered too long when they were not before ([`E501`](https://docs.astral.sh/ruff/rules/line-too-long/)).
27+
328
## 0.7.0
429

530
- The pytest rules `PT001` and `PT023` now default to omitting the decorator parentheses when there are no arguments

CHANGELOG.md

+99
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,104 @@
11
# Changelog
22

3+
## 0.8.0
4+
5+
Check out the [blog post](https://astral.sh/blog/ruff-v0.8.0) for a migration guide and overview of the changes!
6+
7+
### Breaking changes
8+
9+
See also, the "Remapped rules" section which may result in disabled rules.
10+
11+
- **Default to Python 3.9**
12+
13+
Ruff now defaults to Python 3.9 instead of 3.8 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) ([#13896](https://github.com/astral-sh/ruff/pull/13896))
14+
15+
- **Changed location of `pydoclint` diagnostics**
16+
17+
[`pydoclint`](https://docs.astral.sh/ruff/rules/#pydoclint-doc) diagnostics now point to the first-line of the problematic docstring. Previously, this was not the case.
18+
19+
If you've opted into these preview rules but have them suppressed using
20+
[`noqa`](https://docs.astral.sh/ruff/linter/#error-suppression) comments in
21+
some places, this change may mean that you need to move the `noqa` suppression
22+
comments. Most users should be unaffected by this change.
23+
24+
- **Use XDG (i.e. `~/.local/bin`) instead of the Cargo home directory in the standalone installer**
25+
26+
Previously, Ruff's installer used `$CARGO_HOME` or `~/.cargo/bin` for its target install directory. Now, Ruff will be installed into `$XDG_BIN_HOME`, `$XDG_DATA_HOME/../bin`, or `~/.local/bin` (in that order).
27+
28+
This change is only relevant to users of the standalone Ruff installer (using the shell or PowerShell script). If you installed Ruff using uv or pip, you should be unaffected.
29+
30+
- **Changes to the line width calculation**
31+
32+
Ruff now uses a new version of the [unicode-width](https://github.com/unicode-rs/unicode-width) Rust crate to calculate the line width. In very rare cases, this may lead to lines containing Unicode characters being reformatted, or being considered too long when they were not before ([`E501`](https://docs.astral.sh/ruff/rules/line-too-long/)).
33+
34+
### Removed Rules
35+
36+
The following deprecated rules have been removed:
37+
38+
- [`missing-type-self`](https://docs.astral.sh/ruff/rules/missing-type-self/) (`ANN101`)
39+
- [`missing-type-cls`](https://docs.astral.sh/ruff/rules/missing-type-cls/) (`ANN102`)
40+
- [`syntax-error`](https://docs.astral.sh/ruff/rules/syntax-error/) (`E999`)
41+
- [`pytest-missing-fixture-name-underscore`](https://docs.astral.sh/ruff/rules/pytest-missing-fixture-name-underscore/) (`PT004`)
42+
- [`pytest-incorrect-fixture-name-underscore`](https://docs.astral.sh/ruff/rules/pytest-incorrect-fixture-name-underscore/) (`PT005`)
43+
- [`unpacked-list-comprehension`](https://docs.astral.sh/ruff/rules/unpacked-list-comprehension/) (`UP027`)
44+
45+
### Remapped rules
46+
47+
The following rules have been remapped to new rule codes:
48+
49+
- [`flake8-type-checking`](https://docs.astral.sh/ruff/rules/#flake8-type-checking-tc): `TCH` to `TC`
50+
51+
### Stabilization
52+
53+
The following rules have been stabilized and are no longer in preview:
54+
55+
- [`builtin-import-shadowing`](https://docs.astral.sh/ruff/rules/builtin-import-shadowing/) (`A004`)
56+
- [`mutable-contextvar-default`](https://docs.astral.sh/ruff/rules/mutable-contextvar-default/) (`B039`)
57+
- [`fast-api-redundant-response-model`](https://docs.astral.sh/ruff/rules/fast-api-redundant-response-model/) (`FAST001`)
58+
- [`fast-api-non-annotated-dependency`](https://docs.astral.sh/ruff/rules/fast-api-non-annotated-dependency/) (`FAST002`)
59+
- [`dict-index-missing-items`](https://docs.astral.sh/ruff/rules/dict-index-missing-items/) (`PLC0206`)
60+
- [`pep484-style-positional-only-argument`](https://docs.astral.sh/ruff/rules/pep484-style-positional-only-argument/) (`PYI063`)
61+
- [`redundant-final-literal`](https://docs.astral.sh/ruff/rules/redundant-final-literal/) (`PYI064`)
62+
- [`bad-version-info-order`](https://docs.astral.sh/ruff/rules/bad-version-info-order/) (`PYI066`)
63+
- [`parenthesize-chained-operators`](https://docs.astral.sh/ruff/rules/parenthesize-chained-operators/) (`RUF021`)
64+
- [`unsorted-dunder-all`](https://docs.astral.sh/ruff/rules/unsorted-dunder-all/) (`RUF022`)
65+
- [`unsorted-dunder-slots`](https://docs.astral.sh/ruff/rules/unsorted-dunder-slots/) (`RUF023`)
66+
- [`assert-with-print-message`](https://docs.astral.sh/ruff/rules/assert-with-print-message/) (`RUF030`)
67+
- [`unnecessary-default-type-args`](https://docs.astral.sh/ruff/rules/unnecessary-default-type-args/) (`UP043`)
68+
69+
The following behaviors have been stabilized:
70+
71+
- [`ambiguous-variable-name`](https://docs.astral.sh/ruff/rules/ambiguous-variable-name/) (`E741`): Violations in stub files are now ignored. Stub authors typically don't control variable names.
72+
- [`printf-string-formatting`](https://docs.astral.sh/ruff/rules/printf-string-formatting/) (`UP031`): Report all `printf`-like usages even if no autofix is available
73+
74+
The following fixes have been stabilized:
75+
76+
- [`zip-instead-of-pairwise`](https://docs.astral.sh/ruff/rules/zip-instead-of-pairwise/) (`RUF007`)
77+
78+
### Preview features
79+
80+
- \[`flake8-datetimez`\] Exempt `min.time()` and `max.time()` (`DTZ901`) ([#14394](https://github.com/astral-sh/ruff/pull/14394))
81+
- \[`flake8-pie`\] Mark fix as unsafe if the following statement is a string literal (`PIE790`) ([#14393](https://github.com/astral-sh/ruff/pull/14393))
82+
- \[`flake8-pyi`\] New rule `redundant-none-literal` (`PYI061`) ([#14316](https://github.com/astral-sh/ruff/pull/14316))
83+
- \[`flake8-pyi`\] Add autofix for `redundant-numeric-union` (`PYI041`) ([#14273](https://github.com/astral-sh/ruff/pull/14273))
84+
- \[`ruff`\] New rule `map-int-version-parsing` (`RUF048`) ([#14373](https://github.com/astral-sh/ruff/pull/14373))
85+
- \[`ruff`\] New rule `redundant-bool-literal` (`RUF038`) ([#14319](https://github.com/astral-sh/ruff/pull/14319))
86+
- \[`ruff`\] New rule `unraw-re-pattern` (`RUF039`) ([#14446](https://github.com/astral-sh/ruff/pull/14446))
87+
- \[`pycodestyle`\] Exempt `pytest.importorskip()` calls (`E402`) ([#14474](https://github.com/astral-sh/ruff/pull/14474))
88+
- \[`pylint`\] Autofix suggests using sets when possible (`PLR1714`) ([#14372](https://github.com/astral-sh/ruff/pull/14372))
89+
90+
### Rule changes
91+
92+
- [`invalid-pyproject-toml`](https://docs.astral.sh/ruff/rules/invalid-pyproject-toml/) (`RUF200`): Updated to reflect the provisionally accepted [PEP 639](https://peps.python.org/pep-0639/).
93+
- \[`flake8-pyi`\] Avoid panic in unfixable case (`PYI041`) ([#14402](https://github.com/astral-sh/ruff/pull/14402))
94+
- \[`flake8-type-checking`\] Correctly handle quotes in subscript expression when generating an autofix ([#14371](https://github.com/astral-sh/ruff/pull/14371))
95+
- \[`pylint`\] Suggest correct autofix for `__contains__` (`PLC2801`) ([#14424](https://github.com/astral-sh/ruff/pull/14424))
96+
97+
### Configuration
98+
99+
- Ruff now emits a warning instead of an error when a configuration [`ignore`](https://docs.astral.sh/ruff/settings/#lint_ignore)s a rule that has been removed ([#14435](https://github.com/astral-sh/ruff/pull/14435))
100+
- Ruff now validates that `lint.flake8-import-conventions.aliases` only uses valid module names and aliases ([#14477](https://github.com/astral-sh/ruff/pull/14477))
101+
3102
## 0.7.4
4103

5104
### Preview features

Cargo.lock

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,8 @@ curl -LsSf https://astral.sh/ruff/install.sh | sh
136136
powershell -c "irm https://astral.sh/ruff/install.ps1 | iex"
137137

138138
# For a specific version.
139-
curl -LsSf https://astral.sh/ruff/0.7.4/install.sh | sh
140-
powershell -c "irm https://astral.sh/ruff/0.7.4/install.ps1 | iex"
139+
curl -LsSf https://astral.sh/ruff/0.8.0/install.sh | sh
140+
powershell -c "irm https://astral.sh/ruff/0.8.0/install.ps1 | iex"
141141
```
142142

143143
You can also install Ruff via [Homebrew](https://formulae.brew.sh/formula/ruff), [Conda](https://anaconda.org/conda-forge/ruff),
@@ -170,7 +170,7 @@ Ruff can also be used as a [pre-commit](https://pre-commit.com/) hook via [`ruff
170170
```yaml
171171
- repo: https://github.com/astral-sh/ruff-pre-commit
172172
# Ruff version.
173-
rev: v0.7.4
173+
rev: v0.8.0
174174
hooks:
175175
# Run the linter.
176176
- id: ruff

crates/ruff/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "ruff"
3-
version = "0.7.4"
3+
version = "0.8.0"
44
publish = true
55
authors = { workspace = true }
66
edition = { workspace = true }

crates/ruff_linter/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "ruff_linter"
3-
version = "0.7.4"
3+
version = "0.8.0"
44
publish = false
55
authors = { workspace = true }
66
edition = { workspace = true }

crates/ruff_wasm/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "ruff_wasm"
3-
version = "0.7.4"
3+
version = "0.8.0"
44
publish = false
55
authors = { workspace = true }
66
edition = { workspace = true }

docs/integrations.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ You can add the following configuration to `.gitlab-ci.yml` to run a `ruff forma
8080
stage: build
8181
interruptible: true
8282
image:
83-
name: ghcr.io/astral-sh/ruff:0.7.4-alpine
83+
name: ghcr.io/astral-sh/ruff:0.8.0-alpine
8484
before_script:
8585
- cd $CI_PROJECT_DIR
8686
- ruff --version
@@ -106,7 +106,7 @@ Ruff can be used as a [pre-commit](https://pre-commit.com) hook via [`ruff-pre-c
106106
```yaml
107107
- repo: https://github.com/astral-sh/ruff-pre-commit
108108
# Ruff version.
109-
rev: v0.7.4
109+
rev: v0.8.0
110110
hooks:
111111
# Run the linter.
112112
- id: ruff
@@ -119,7 +119,7 @@ To enable lint fixes, add the `--fix` argument to the lint hook:
119119
```yaml
120120
- repo: https://github.com/astral-sh/ruff-pre-commit
121121
# Ruff version.
122-
rev: v0.7.4
122+
rev: v0.8.0
123123
hooks:
124124
# Run the linter.
125125
- id: ruff
@@ -133,7 +133,7 @@ To run the hooks over Jupyter Notebooks too, add `jupyter` to the list of allowe
133133
```yaml
134134
- repo: https://github.com/astral-sh/ruff-pre-commit
135135
# Ruff version.
136-
rev: v0.7.4
136+
rev: v0.8.0
137137
hooks:
138138
# Run the linter.
139139
- id: ruff

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "maturin"
44

55
[project]
66
name = "ruff"
7-
version = "0.7.4"
7+
version = "0.8.0"
88
description = "An extremely fast Python linter and code formatter, written in Rust."
99
authors = [{ name = "Astral Software Inc.", email = "[email protected]" }]
1010
readme = "README.md"

scripts/benchmarks/pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "scripts"
3-
version = "0.7.4"
3+
version = "0.8.0"
44
description = ""
55
authors = ["Charles Marsh <[email protected]>"]
66

0 commit comments

Comments
 (0)