Commit 2584aff
Ignore deprecated rules unless selected by exact code (#20167)
<!--
Thank you for contributing to Ruff/ty! To help us out with reviewing,
please consider the following:
- Does this pull request include a summary of the change? (See below.)
- Does this pull request include a descriptive title? (Please prefix
with `[ty]` for ty pull
requests.)
- Does this pull request include references to any relevant issues?
-->
## Summary
Closes #18349
After this change:
- All deprecated rules are deselected by default
- They are only selected if the user specifically selects them by code,
e.g. `--select UP038`
- Thus, `--select ALL --select UP --select UP0` won't select the
deprecated rule UP038
- Documented the change in version policy. From now on, deprecating a
rule should increase the minor version
## Test Plan
Integration tests in "integration_tests.rs"
Also tested with a temporary test package:
```
~> ../../ruff/target/debug/ruff.exe check --select UP038
warning: Rule `UP038` is deprecated and will be removed in a future release.
warning: Detected debug build without --no-cache.
UP038 Use `X | Y` in `isinstance` call instead of `(X, Y)`
--> main.py:2:11
|
1 | def main():
2 | print(isinstance(25, (str, int)))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: Convert to `X | Y`
Found 1 error.
No fixes available (1 hidden fix can be enabled with the `--unsafe-fixes` option).
~> ../../ruff/target/debug/ruff.exe check --select UP03
warning: Detected debug build without --no-cache.
All checks passed!
~> ../../ruff/target/debug/ruff.exe check --select UP0
warning: Detected debug build without --no-cache.
All checks passed!
~> ../../ruff/target/debug/ruff.exe check --select UP
warning: Detected debug build without --no-cache.
All checks passed!
~> ../../ruff/target/debug/ruff.exe check --select ALL
# warnings and errors, but because of other errors, UP038 was deselected
```1 parent a6a5881 commit 2584aff
File tree
3 files changed
+9
-20
lines changed- crates
- ruff_linter/src
- ruff/tests
- docs
3 files changed
+9
-20
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1489 | 1489 | | |
1490 | 1490 | | |
1491 | 1491 | | |
| 1492 | + | |
| 1493 | + | |
1492 | 1494 | | |
1493 | 1495 | | |
1494 | 1496 | | |
| |||
1516 | 1518 | | |
1517 | 1519 | | |
1518 | 1520 | | |
1519 | | - | |
1520 | | - | |
| 1521 | + | |
| 1522 | + | |
1521 | 1523 | | |
1522 | | - | |
1523 | | - | |
1524 | | - | |
1525 | | - | |
1526 | | - | |
1527 | | - | |
1528 | | - | |
| 1524 | + | |
1529 | 1525 | | |
1530 | 1526 | | |
1531 | 1527 | | |
| |||
2155 | 2151 | | |
2156 | 2152 | | |
2157 | 2153 | | |
2158 | | - | |
2159 | | - | |
2160 | | - | |
2161 | | - | |
2162 | | - | |
2163 | | - | |
2164 | 2154 | | |
2165 | 2155 | | |
2166 | 2156 | | |
2167 | | - | |
| 2157 | + | |
2168 | 2158 | | |
2169 | 2159 | | |
2170 | 2160 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
214 | 214 | | |
215 | 215 | | |
216 | 216 | | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | | - | |
| 217 | + | |
| 218 | + | |
221 | 219 | | |
222 | 220 | | |
223 | 221 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| |||
0 commit comments