Tweak E712 docs by tjkuson · Pull Request #8613 · astral-sh/ruff (original) (raw)

@@ -1,15 +1,15 @@

---

source: crates/ruff_linter/src/rules/pycodestyle/mod.rs

---

E712.py:2:11: E712 [*] Comparison to `True` should be `cond is True` or `if cond:`

E712.py:2:11: E712 [*] Avoid equality comparisons to `True`; use `if cond:` for truth checks

|

1 | #: E712

2 | if res == True:

| ^^^^ E712

3 | pass

4 | #: E712

|

= help: Replace with `cond is True`

= help: Replace with `cond`

ℹ Unsafe fix

1 1 | #: E712

Expand All

@@ -19,7 +19,7 @@ E712.py:2:11: E712 [*] Comparison to `True` should be `cond is True` or `if cond

4 4 | #: E712

5 5 | if res != False:

E712.py:5:11: E712 [*] Comparison to `False` should be `cond is not False` or `if cond:`

E712.py:5:11: E712 [*] Avoid inequality comparisons to `False`; use `if cond:` for truth checks

|

3 | pass

4 | #: E712

Expand All

@@ -28,7 +28,7 @@ E712.py:5:11: E712 [*] Comparison to `False` should be `cond is not False` or `i

6 | pass

7 | #: E712

|

= help: Replace with `cond is not False`

= help: Replace with `cond`

ℹ Unsafe fix

2 2 | if res == True:

Expand All

@@ -40,7 +40,7 @@ E712.py:5:11: E712 [*] Comparison to `False` should be `cond is not False` or `i

7 7 | #: E712

8 8 | if True != res:

E712.py:8:4: E712 [*] Comparison to `True` should be `cond is not True` or `if not cond:`

E712.py:8:4: E712 [*] Avoid inequality comparisons to `True`; use `if not cond:` for false checks

|

6 | pass

7 | #: E712

Expand All

@@ -49,7 +49,7 @@ E712.py:8:4: E712 [*] Comparison to `True` should be `cond is not True` or `if n

9 | pass

10 | #: E712

|

= help: Replace with `cond is not True`

= help: Replace with `not cond`

ℹ Unsafe fix

5 5 | if res != False:

Expand All

@@ -61,7 +61,7 @@ E712.py:8:4: E712 [*] Comparison to `True` should be `cond is not True` or `if n

10 10 | #: E712

11 11 | if False == res:

E712.py:11:4: E712 [*] Comparison to `False` should be `cond is False` or `if not cond:`

E712.py:11:4: E712 [*] Avoid equality comparisons to `False`; use `if not cond:` for false checks

|

9 | pass

10 | #: E712

Expand All

@@ -70,7 +70,7 @@ E712.py:11:4: E712 [*] Comparison to `False` should be `cond is False` or `if no

12 | pass

13 | #: E712

|

= help: Replace with `cond is False`

= help: Replace with `not cond`

ℹ Unsafe fix

8 8 | if True != res:

Expand All

@@ -82,7 +82,7 @@ E712.py:11:4: E712 [*] Comparison to `False` should be `cond is False` or `if no

13 13 | #: E712

14 14 | if res[1] == True:

E712.py:14:14: E712 [*] Comparison to `True` should be `cond is True` or `if cond:`

E712.py:14:14: E712 [*] Avoid equality comparisons to `True`; use `if cond:` for truth checks

|

12 | pass

13 | #: E712

Expand All

@@ -91,7 +91,7 @@ E712.py:14:14: E712 [*] Comparison to `True` should be `cond is True` or `if con

15 | pass

16 | #: E712

|

= help: Replace with `cond is True`

= help: Replace with `cond`

ℹ Unsafe fix

11 11 | if False == res:

Expand All

@@ -103,7 +103,7 @@ E712.py:14:14: E712 [*] Comparison to `True` should be `cond is True` or `if con

16 16 | #: E712

17 17 | if res[1] != False:

E712.py:17:14: E712 [*] Comparison to `False` should be `cond is not False` or `if cond:`

E712.py:17:14: E712 [*] Avoid inequality comparisons to `False`; use `if cond:` for truth checks

|

15 | pass

16 | #: E712

Expand All

@@ -112,7 +112,7 @@ E712.py:17:14: E712 [*] Comparison to `False` should be `cond is not False` or `

18 | pass

19 | #: E712

|

= help: Replace with `cond is not False`

= help: Replace with `cond`

ℹ Unsafe fix

14 14 | if res[1] == True:

Expand All

@@ -124,7 +124,7 @@ E712.py:17:14: E712 [*] Comparison to `False` should be `cond is not False` or `

19 19 | #: E712

20 20 | var = 1 if cond == True else -1 if cond == False else cond

E712.py:20:20: E712 [*] Comparison to `True` should be `cond is True` or `if cond:`

E712.py:20:20: E712 [*] Avoid equality comparisons to `True`; use `if cond:` for truth checks

|

18 | pass

19 | #: E712

Expand All

@@ -133,7 +133,7 @@ E712.py:20:20: E712 [*] Comparison to `True` should be `cond is True` or `if con

21 | #: E712

22 | if (True) == TrueElement or x == TrueElement:

|

= help: Replace with `cond is True`

= help: Replace with `cond`

ℹ Unsafe fix

17 17 | if res[1] != False:

Expand All

@@ -145,7 +145,7 @@ E712.py:20:20: E712 [*] Comparison to `True` should be `cond is True` or `if con

22 22 | if (True) == TrueElement or x == TrueElement:

23 23 | pass

E712.py:20:44: E712 [*] Comparison to `False` should be `cond is False` or `if not cond:`

E712.py:20:44: E712 [*] Avoid equality comparisons to `False`; use `if not cond:` for false checks

|

18 | pass

19 | #: E712

Expand All

@@ -154,7 +154,7 @@ E712.py:20:44: E712 [*] Comparison to `False` should be `cond is False` or `if n

21 | #: E712

22 | if (True) == TrueElement or x == TrueElement:

|

= help: Replace with `cond is False`

= help: Replace with `not cond`

ℹ Unsafe fix

17 17 | if res[1] != False:

Expand All

@@ -166,15 +166,15 @@ E712.py:20:44: E712 [*] Comparison to `False` should be `cond is False` or `if n

22 22 | if (True) == TrueElement or x == TrueElement:

23 23 | pass

E712.py:22:5: E712 [*] Comparison to `True` should be `cond is True` or `if cond:`

E712.py:22:5: E712 [*] Avoid equality comparisons to `True`; use `if cond:` for truth checks

|

20 | var = 1 if cond == True else -1 if cond == False else cond

21 | #: E712

22 | if (True) == TrueElement or x == TrueElement:

| ^^^^ E712

23 | pass

|

= help: Replace with `cond is True`

= help: Replace with `cond`

ℹ Unsafe fix

19 19 | #: E712

Expand All

@@ -186,15 +186,15 @@ E712.py:22:5: E712 [*] Comparison to `True` should be `cond is True` or `if cond

24 24 |

25 25 | if res == True != False:

E712.py:25:11: E712 [*] Comparison to `True` should be `cond is True` or `if cond:`

E712.py:25:11: E712 [*] Avoid equality comparisons to `True`; use `if cond:` for truth checks

|

23 | pass

24 |

25 | if res == True != False:

| ^^^^ E712

26 | pass

|

= help: Replace with `cond is True`

= help: Replace with `cond`

ℹ Unsafe fix

22 22 | if (True) == TrueElement or x == TrueElement:

Expand All

@@ -206,15 +206,15 @@ E712.py:25:11: E712 [*] Comparison to `True` should be `cond is True` or `if con

27 27 |

28 28 | if(True) == TrueElement or x == TrueElement:

E712.py:25:19: E712 [*] Comparison to `False` should be `cond is not False` or `if cond:`

E712.py:25:19: E712 [*] Avoid inequality comparisons to `False`; use `if cond:` for truth checks

|

23 | pass

24 |

25 | if res == True != False:

| ^^^^^ E712

26 | pass

|

= help: Replace with `cond is not False`

= help: Replace with `cond`

ℹ Unsafe fix

22 22 | if (True) == TrueElement or x == TrueElement:

Expand All

@@ -226,15 +226,15 @@ E712.py:25:19: E712 [*] Comparison to `False` should be `cond is not False` or `

27 27 |

28 28 | if(True) == TrueElement or x == TrueElement:

E712.py:28:4: E712 [*] Comparison to `True` should be `cond is True` or `if cond:`

E712.py:28:4: E712 [*] Avoid equality comparisons to `True`; use `if cond:` for truth checks

|

26 | pass

27 |

28 | if(True) == TrueElement or x == TrueElement:

| ^^^^ E712

29 | pass

|

= help: Replace with `cond is True`

= help: Replace with `cond`

ℹ Unsafe fix

25 25 | if res == True != False:

Expand All

@@ -246,15 +246,15 @@ E712.py:28:4: E712 [*] Comparison to `True` should be `cond is True` or `if cond

30 30 |

31 31 | if (yield i) == True:

E712.py:31:17: E712 [*] Comparison to `True` should be `cond is True` or `if cond:`

E712.py:31:17: E712 [*] Avoid equality comparisons to `True`; use `if cond:` for truth checks

|

29 | pass

30 |

31 | if (yield i) == True:

| ^^^^ E712

32 | print("even")

|

= help: Replace with `cond is True`

= help: Replace with `cond`

ℹ Unsafe fix

28 28 | if(True) == TrueElement or x == TrueElement:

Expand Down