mirror of https://github.com/astral-sh/ruff
## Summary
This rule removes `PLR1701` and redirects it to `SIM101`.
In addition to that, the `SIM101` autofix has been fixed to add padding
if required.
### `PLR1701` has bugs
It also seems that the implementation of `PLR1701` is incorrect in
multiple scenarios. For example, the following code snippet:
```py
# There are two _different_ variables `a` and `b`
if isinstance(a, int) or isinstance(b, bool) or isinstance(a, float):
pass
# There's another condition `or 1`
if isinstance(self.k, int) or isinstance(self.k, float) or 1:
pass
```
is fixed to:
```py
# Fixed to only considering variable `a`
if isinstance(a, (float, int)):
pass
# The additional condition is not present in the fix
if isinstance(self.k, (float, int)):
pass
```
Playground: https://play.ruff.rs/6cfbdfb7-f183-43b0-b59e-31e728b34190
## Documentation Preview
### `PLR1701`
<img width="1397" alt="Screenshot 2024-06-25 at 11 14 40"
src="https://github.com/astral-sh/ruff/assets/67177269/779ee84d-7c4d-4bb8-a3a4-c2b23a313eba">
## Test Plan
Remove the test cases for `PLR1701`, port the padding test case to
`SIM101` and update the snapshot.
|
||
|---|---|---|
| .. | ||
| SIM101.py | ||
| SIM102.py | ||
| SIM103.py | ||
| SIM105_0.py | ||
| SIM105_1.py | ||
| SIM105_2.py | ||
| SIM105_3.py | ||
| SIM105_4.py | ||
| SIM107.py | ||
| SIM108.py | ||
| SIM109.py | ||
| SIM110.py | ||
| SIM111.py | ||
| SIM112.py | ||
| SIM113.py | ||
| SIM114.py | ||
| SIM115.py | ||
| SIM116.py | ||
| SIM117.py | ||
| SIM118.py | ||
| SIM201.py | ||
| SIM202.py | ||
| SIM208.py | ||
| SIM210.py | ||
| SIM211.py | ||
| SIM212.py | ||
| SIM220.py | ||
| SIM221.py | ||
| SIM222.py | ||
| SIM223.py | ||
| SIM300.py | ||
| SIM401.py | ||
| SIM910.py | ||
| SIM911.py | ||