Update snapshots to reflect changes in fix messages

This commit is contained in:
Zanie 2023-10-03 12:16:01 -05:00
parent 9949fa0daf
commit ee903bf168
209 changed files with 1591 additions and 1591 deletions

View File

@ -40,7 +40,7 @@ inline-quotes = "single"
-:1:5: B005 Using `.strip()` with multi-character strings is misleading
-:1:19: Q000 [*] Double quotes found but single quotes preferred
Found 3 errors.
[*] 2 potentially fixable with the --fix option.
[*] 2 fixable with the --fix option.
----- stderr -----
"###);
@ -75,7 +75,7 @@ inline-quotes = "single"
-:1:5: B005 Using `.strip()` with multi-character strings is misleading
-:1:19: Q000 [*] Double quotes found but single quotes preferred
Found 3 errors.
[*] 2 potentially fixable with the --fix option.
[*] 2 fixable with the --fix option.
----- stderr -----
"###);
@ -110,7 +110,7 @@ inline-quotes = "single"
-:1:5: B005 Using `.strip()` with multi-character strings is misleading
-:1:19: Q000 [*] Double quotes found but single quotes preferred
Found 3 errors.
[*] 2 potentially fixable with the --fix option.
[*] 2 fixable with the --fix option.
----- stderr -----
"###);
@ -149,7 +149,7 @@ inline-quotes = "single"
-:1:5: B005 Using `.strip()` with multi-character strings is misleading
-:1:19: Q000 [*] Double quotes found but single quotes preferred
Found 3 errors.
[*] 2 potentially fixable with the --fix option.
[*] 2 fixable with the --fix option.
----- stderr -----
"###);

View File

@ -3,14 +3,14 @@ source: crates/ruff_linter/src/message/grouped.rs
expression: content
---
fib.py:
1:8 F401 [*] `os` imported but unused
1:8 F401 [**] `os` imported but unused
|
1 | import os
| ^^ F401
|
= help: Remove unused import: `os`
6:5 F841 [*] Local variable `x` is assigned to but never used
6:5 F841 [**] Local variable `x` is assigned to but never used
|
4 | def fibonacci(n):
5 | """Compute the nth number in the Fibonacci sequence."""

View File

@ -2,14 +2,14 @@
source: crates/ruff_linter/src/message/text.rs
expression: content
---
fib.py:1:8: F401 [*] `os` imported but unused
fib.py:1:8: F401 [**] `os` imported but unused
|
1 | import os
| ^^ F401
|
= help: Remove unused import: `os`
fib.py:6:5: F841 [*] Local variable `x` is assigned to but never used
fib.py:6:5: F841 [**] Local variable `x` is assigned to but never used
|
4 | def fibonacci(n):
5 | """Compute the nth number in the Fibonacci sequence."""

View File

@ -242,7 +242,7 @@ annotation_presence.py:154:10: ANN401 Dynamically typed expressions (typing.Any)
| ^^^^^^^^^^^^^^^^^^^^^^^^ ANN401
|
annotation_presence.py:159:9: ANN204 [*] Missing return type annotation for special method `__init__`
annotation_presence.py:159:9: ANN204 [**] Missing return type annotation for special method `__init__`
|
157 | class Foo:
158 | @decorator()
@ -262,7 +262,7 @@ annotation_presence.py:159:9: ANN204 [*] Missing return type annotation for spec
161 161 |
162 162 |
annotation_presence.py:165:9: ANN204 [*] Missing return type annotation for special method `__init__`
annotation_presence.py:165:9: ANN204 [**] Missing return type annotation for special method `__init__`
|
163 | # Regression test for: https://github.com/astral-sh/ruff/issues/7711
164 | class Class:

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_annotations/mod.rs
---
mypy_init_return.py:5:9: ANN204 [*] Missing return type annotation for special method `__init__`
mypy_init_return.py:5:9: ANN204 [**] Missing return type annotation for special method `__init__`
|
3 | # Error
4 | class Foo:
@ -21,7 +21,7 @@ mypy_init_return.py:5:9: ANN204 [*] Missing return type annotation for special m
7 7 |
8 8 |
mypy_init_return.py:11:9: ANN204 [*] Missing return type annotation for special method `__init__`
mypy_init_return.py:11:9: ANN204 [**] Missing return type annotation for special method `__init__`
|
9 | # Error
10 | class Foo:
@ -49,7 +49,7 @@ mypy_init_return.py:40:5: ANN202 Missing return type annotation for private func
41 | ...
|
mypy_init_return.py:47:9: ANN204 [*] Missing return type annotation for special method `__init__`
mypy_init_return.py:47:9: ANN204 [**] Missing return type annotation for special method `__init__`
|
45 | # of a vararg falsely indicated that the function has a typed argument.
46 | class Foo:

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_annotations/mod.rs
---
simple_magic_methods.py:2:9: ANN204 [*] Missing return type annotation for special method `__str__`
simple_magic_methods.py:2:9: ANN204 [**] Missing return type annotation for special method `__str__`
|
1 | class Foo:
2 | def __str__(self):
@ -18,7 +18,7 @@ simple_magic_methods.py:2:9: ANN204 [*] Missing return type annotation for speci
4 4 |
5 5 | def __repr__(self):
simple_magic_methods.py:5:9: ANN204 [*] Missing return type annotation for special method `__repr__`
simple_magic_methods.py:5:9: ANN204 [**] Missing return type annotation for special method `__repr__`
|
3 | ...
4 |
@ -38,7 +38,7 @@ simple_magic_methods.py:5:9: ANN204 [*] Missing return type annotation for speci
7 7 |
8 8 | def __len__(self):
simple_magic_methods.py:8:9: ANN204 [*] Missing return type annotation for special method `__len__`
simple_magic_methods.py:8:9: ANN204 [**] Missing return type annotation for special method `__len__`
|
6 | ...
7 |
@ -58,7 +58,7 @@ simple_magic_methods.py:8:9: ANN204 [*] Missing return type annotation for speci
10 10 |
11 11 | def __length_hint__(self):
simple_magic_methods.py:11:9: ANN204 [*] Missing return type annotation for special method `__length_hint__`
simple_magic_methods.py:11:9: ANN204 [**] Missing return type annotation for special method `__length_hint__`
|
9 | ...
10 |
@ -78,7 +78,7 @@ simple_magic_methods.py:11:9: ANN204 [*] Missing return type annotation for spec
13 13 |
14 14 | def __init__(self):
simple_magic_methods.py:14:9: ANN204 [*] Missing return type annotation for special method `__init__`
simple_magic_methods.py:14:9: ANN204 [**] Missing return type annotation for special method `__init__`
|
12 | ...
13 |
@ -98,7 +98,7 @@ simple_magic_methods.py:14:9: ANN204 [*] Missing return type annotation for spec
16 16 |
17 17 | def __del__(self):
simple_magic_methods.py:17:9: ANN204 [*] Missing return type annotation for special method `__del__`
simple_magic_methods.py:17:9: ANN204 [**] Missing return type annotation for special method `__del__`
|
15 | ...
16 |
@ -118,7 +118,7 @@ simple_magic_methods.py:17:9: ANN204 [*] Missing return type annotation for spec
19 19 |
20 20 | def __bool__(self):
simple_magic_methods.py:20:9: ANN204 [*] Missing return type annotation for special method `__bool__`
simple_magic_methods.py:20:9: ANN204 [**] Missing return type annotation for special method `__bool__`
|
18 | ...
19 |
@ -138,7 +138,7 @@ simple_magic_methods.py:20:9: ANN204 [*] Missing return type annotation for spec
22 22 |
23 23 | def __bytes__(self):
simple_magic_methods.py:23:9: ANN204 [*] Missing return type annotation for special method `__bytes__`
simple_magic_methods.py:23:9: ANN204 [**] Missing return type annotation for special method `__bytes__`
|
21 | ...
22 |
@ -158,7 +158,7 @@ simple_magic_methods.py:23:9: ANN204 [*] Missing return type annotation for spec
25 25 |
26 26 | def __format__(self, format_spec):
simple_magic_methods.py:26:9: ANN204 [*] Missing return type annotation for special method `__format__`
simple_magic_methods.py:26:9: ANN204 [**] Missing return type annotation for special method `__format__`
|
24 | ...
25 |
@ -178,7 +178,7 @@ simple_magic_methods.py:26:9: ANN204 [*] Missing return type annotation for spec
28 28 |
29 29 | def __contains__(self, item):
simple_magic_methods.py:29:9: ANN204 [*] Missing return type annotation for special method `__contains__`
simple_magic_methods.py:29:9: ANN204 [**] Missing return type annotation for special method `__contains__`
|
27 | ...
28 |
@ -198,7 +198,7 @@ simple_magic_methods.py:29:9: ANN204 [*] Missing return type annotation for spec
31 31 |
32 32 | def __complex__(self):
simple_magic_methods.py:32:9: ANN204 [*] Missing return type annotation for special method `__complex__`
simple_magic_methods.py:32:9: ANN204 [**] Missing return type annotation for special method `__complex__`
|
30 | ...
31 |
@ -218,7 +218,7 @@ simple_magic_methods.py:32:9: ANN204 [*] Missing return type annotation for spec
34 34 |
35 35 | def __int__(self):
simple_magic_methods.py:35:9: ANN204 [*] Missing return type annotation for special method `__int__`
simple_magic_methods.py:35:9: ANN204 [**] Missing return type annotation for special method `__int__`
|
33 | ...
34 |
@ -238,7 +238,7 @@ simple_magic_methods.py:35:9: ANN204 [*] Missing return type annotation for spec
37 37 |
38 38 | def __float__(self):
simple_magic_methods.py:38:9: ANN204 [*] Missing return type annotation for special method `__float__`
simple_magic_methods.py:38:9: ANN204 [**] Missing return type annotation for special method `__float__`
|
36 | ...
37 |
@ -258,7 +258,7 @@ simple_magic_methods.py:38:9: ANN204 [*] Missing return type annotation for spec
40 40 |
41 41 | def __index__(self):
simple_magic_methods.py:41:9: ANN204 [*] Missing return type annotation for special method `__index__`
simple_magic_methods.py:41:9: ANN204 [**] Missing return type annotation for special method `__index__`
|
39 | ...
40 |

View File

@ -11,7 +11,7 @@ B007.py:6:5: B007 Loop control variable `i` not used within loop body
|
= help: Rename unused `i` to `_i`
B007.py:18:13: B007 [*] Loop control variable `k` not used within loop body
B007.py:18:13: B007 [**] Loop control variable `k` not used within loop body
|
16 | for i in range(10):
17 | for j in range(10):
@ -39,7 +39,7 @@ B007.py:30:5: B007 Loop control variable `i` not used within loop body
|
= help: Rename unused `i` to `_i`
B007.py:30:13: B007 [*] Loop control variable `k` not used within loop body
B007.py:30:13: B007 [**] Loop control variable `k` not used within loop body
|
30 | for i, (j, (k, l)) in strange_generator(): # i, k not used
| ^ B007
@ -99,7 +99,7 @@ B007.py:46:10: B007 Loop control variable `bar` may not be used within loop body
|
= help: Rename unused `bar` to `_bar`
B007.py:52:14: B007 [*] Loop control variable `bar` not used within loop body
B007.py:52:14: B007 [**] Loop control variable `bar` not used within loop body
|
50 | def f():
51 | # Fixable.
@ -131,7 +131,7 @@ B007.py:59:14: B007 Loop control variable `bar` not used within loop body
|
= help: Rename unused `bar` to `_bar`
B007.py:68:14: B007 [*] Loop control variable `bar` not used within loop body
B007.py:68:14: B007 [**] Loop control variable `bar` not used within loop body
|
66 | def f():
67 | # Fixable.

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs
---
B009_B010.py:19:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
B009_B010.py:19:1: B009 [**] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
|
18 | # Invalid usage
19 | getattr(foo, "bar")
@ -21,7 +21,7 @@ B009_B010.py:19:1: B009 [*] Do not call `getattr` with a constant attribute valu
21 21 | getattr(foo, "__123abc__")
22 22 | getattr(foo, "abc123")
B009_B010.py:20:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
B009_B010.py:20:1: B009 [**] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
|
18 | # Invalid usage
19 | getattr(foo, "bar")
@ -42,7 +42,7 @@ B009_B010.py:20:1: B009 [*] Do not call `getattr` with a constant attribute valu
22 22 | getattr(foo, "abc123")
23 23 | getattr(foo, r"abc123")
B009_B010.py:21:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
B009_B010.py:21:1: B009 [**] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
|
19 | getattr(foo, "bar")
20 | getattr(foo, "_123abc")
@ -63,7 +63,7 @@ B009_B010.py:21:1: B009 [*] Do not call `getattr` with a constant attribute valu
23 23 | getattr(foo, r"abc123")
24 24 | _ = lambda x: getattr(x, "bar")
B009_B010.py:22:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
B009_B010.py:22:1: B009 [**] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
|
20 | getattr(foo, "_123abc")
21 | getattr(foo, "__123abc__")
@ -84,7 +84,7 @@ B009_B010.py:22:1: B009 [*] Do not call `getattr` with a constant attribute valu
24 24 | _ = lambda x: getattr(x, "bar")
25 25 | if getattr(x, "bar"):
B009_B010.py:23:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
B009_B010.py:23:1: B009 [**] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
|
21 | getattr(foo, "__123abc__")
22 | getattr(foo, "abc123")
@ -105,7 +105,7 @@ B009_B010.py:23:1: B009 [*] Do not call `getattr` with a constant attribute valu
25 25 | if getattr(x, "bar"):
26 26 | pass
B009_B010.py:24:15: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
B009_B010.py:24:15: B009 [**] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
|
22 | getattr(foo, "abc123")
23 | getattr(foo, r"abc123")
@ -126,7 +126,7 @@ B009_B010.py:24:15: B009 [*] Do not call `getattr` with a constant attribute val
26 26 | pass
27 27 | getattr(1, "real")
B009_B010.py:25:4: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
B009_B010.py:25:4: B009 [**] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
|
23 | getattr(foo, r"abc123")
24 | _ = lambda x: getattr(x, "bar")
@ -147,7 +147,7 @@ B009_B010.py:25:4: B009 [*] Do not call `getattr` with a constant attribute valu
27 27 | getattr(1, "real")
28 28 | getattr(1., "real")
B009_B010.py:27:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
B009_B010.py:27:1: B009 [**] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
|
25 | if getattr(x, "bar"):
26 | pass
@ -168,7 +168,7 @@ B009_B010.py:27:1: B009 [*] Do not call `getattr` with a constant attribute valu
29 29 | getattr(1.0, "real")
30 30 | getattr(1j, "real")
B009_B010.py:28:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
B009_B010.py:28:1: B009 [**] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
|
26 | pass
27 | getattr(1, "real")
@ -189,7 +189,7 @@ B009_B010.py:28:1: B009 [*] Do not call `getattr` with a constant attribute valu
30 30 | getattr(1j, "real")
31 31 | getattr(True, "real")
B009_B010.py:29:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
B009_B010.py:29:1: B009 [**] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
|
27 | getattr(1, "real")
28 | getattr(1., "real")
@ -210,7 +210,7 @@ B009_B010.py:29:1: B009 [*] Do not call `getattr` with a constant attribute valu
31 31 | getattr(True, "real")
32 32 | getattr(x := 1, "real")
B009_B010.py:30:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
B009_B010.py:30:1: B009 [**] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
|
28 | getattr(1., "real")
29 | getattr(1.0, "real")
@ -231,7 +231,7 @@ B009_B010.py:30:1: B009 [*] Do not call `getattr` with a constant attribute valu
32 32 | getattr(x := 1, "real")
33 33 | getattr(x + y, "real")
B009_B010.py:31:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
B009_B010.py:31:1: B009 [**] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
|
29 | getattr(1.0, "real")
30 | getattr(1j, "real")
@ -252,7 +252,7 @@ B009_B010.py:31:1: B009 [*] Do not call `getattr` with a constant attribute valu
33 33 | getattr(x + y, "real")
34 34 | getattr("foo"
B009_B010.py:32:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
B009_B010.py:32:1: B009 [**] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
|
30 | getattr(1j, "real")
31 | getattr(True, "real")
@ -273,7 +273,7 @@ B009_B010.py:32:1: B009 [*] Do not call `getattr` with a constant attribute valu
34 34 | getattr("foo"
35 35 | "bar", "real")
B009_B010.py:33:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
B009_B010.py:33:1: B009 [**] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
|
31 | getattr(True, "real")
32 | getattr(x := 1, "real")
@ -294,7 +294,7 @@ B009_B010.py:33:1: B009 [*] Do not call `getattr` with a constant attribute valu
35 35 | "bar", "real")
36 36 |
B009_B010.py:34:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
B009_B010.py:34:1: B009 [**] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
|
32 | getattr(x := 1, "real")
33 | getattr(x + y, "real")
@ -316,7 +316,7 @@ B009_B010.py:34:1: B009 [*] Do not call `getattr` with a constant attribute valu
37 37 |
38 38 | # Valid setattr usage
B009_B010.py:58:8: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
B009_B010.py:58:8: B009 [**] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
|
57 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1722458885
58 | assert getattr(func, '_rpc')is True
@ -336,7 +336,7 @@ B009_B010.py:58:8: B009 [*] Do not call `getattr` with a constant attribute valu
60 60 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1732387247
61 61 | getattr(*foo, "bar")
B009_B010.py:65:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
B009_B010.py:65:1: B009 [**] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
|
64 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1739800901
65 | / getattr(self.

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs
---
B009_B010.py:50:1: B010 [*] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access.
B009_B010.py:50:1: B010 [**] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access.
|
49 | # Invalid usage
50 | setattr(foo, "bar", None)
@ -21,7 +21,7 @@ B009_B010.py:50:1: B010 [*] Do not call `setattr` with a constant attribute valu
52 52 | setattr(foo, "__123abc__", None)
53 53 | setattr(foo, "abc123", None)
B009_B010.py:51:1: B010 [*] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access.
B009_B010.py:51:1: B010 [**] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access.
|
49 | # Invalid usage
50 | setattr(foo, "bar", None)
@ -42,7 +42,7 @@ B009_B010.py:51:1: B010 [*] Do not call `setattr` with a constant attribute valu
53 53 | setattr(foo, "abc123", None)
54 54 | setattr(foo, r"abc123", None)
B009_B010.py:52:1: B010 [*] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access.
B009_B010.py:52:1: B010 [**] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access.
|
50 | setattr(foo, "bar", None)
51 | setattr(foo, "_123abc", None)
@ -63,7 +63,7 @@ B009_B010.py:52:1: B010 [*] Do not call `setattr` with a constant attribute valu
54 54 | setattr(foo, r"abc123", None)
55 55 | setattr(foo.bar, r"baz", None)
B009_B010.py:53:1: B010 [*] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access.
B009_B010.py:53:1: B010 [**] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access.
|
51 | setattr(foo, "_123abc", None)
52 | setattr(foo, "__123abc__", None)
@ -84,7 +84,7 @@ B009_B010.py:53:1: B010 [*] Do not call `setattr` with a constant attribute valu
55 55 | setattr(foo.bar, r"baz", None)
56 56 |
B009_B010.py:54:1: B010 [*] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access.
B009_B010.py:54:1: B010 [**] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access.
|
52 | setattr(foo, "__123abc__", None)
53 | setattr(foo, "abc123", None)
@ -104,7 +104,7 @@ B009_B010.py:54:1: B010 [*] Do not call `setattr` with a constant attribute valu
56 56 |
57 57 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1722458885
B009_B010.py:55:1: B010 [*] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access.
B009_B010.py:55:1: B010 [**] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access.
|
53 | setattr(foo, "abc123", None)
54 | setattr(foo, r"abc123", None)

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs
---
B011.py:8:8: B011 [*] Do not `assert False` (`python -O` removes these calls), raise `AssertionError()`
B011.py:8:8: B011 [**] Do not `assert False` (`python -O` removes these calls), raise `AssertionError()`
|
7 | assert 1 != 2
8 | assert False
@ -20,7 +20,7 @@ B011.py:8:8: B011 [*] Do not `assert False` (`python -O` removes these calls), r
9 9 | assert 1 != 2, "message"
10 10 | assert False, "message"
B011.py:10:8: B011 [*] Do not `assert False` (`python -O` removes these calls), raise `AssertionError()`
B011.py:10:8: B011 [**] Do not `assert False` (`python -O` removes these calls), raise `AssertionError()`
|
8 | assert False
9 | assert 1 != 2, "message"

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs
---
C400.py:1:5: C400 [*] Unnecessary generator (rewrite as a `list` comprehension)
C400.py:1:5: C400 [**] Unnecessary generator (rewrite as a `list` comprehension)
|
1 | x = list(x for x in range(3))
| ^^^^^^^^^^^^^^^^^^^^^^^^^ C400
@ -17,7 +17,7 @@ C400.py:1:5: C400 [*] Unnecessary generator (rewrite as a `list` comprehension)
3 3 | x for x in range(3)
4 4 | )
C400.py:2:5: C400 [*] Unnecessary generator (rewrite as a `list` comprehension)
C400.py:2:5: C400 [**] Unnecessary generator (rewrite as a `list` comprehension)
|
1 | x = list(x for x in range(3))
2 | x = list(

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs
---
C401.py:1:5: C401 [*] Unnecessary generator (rewrite as a `set` comprehension)
C401.py:1:5: C401 [**] Unnecessary generator (rewrite as a `set` comprehension)
|
1 | x = set(x for x in range(3))
| ^^^^^^^^^^^^^^^^^^^^^^^^ C401
@ -17,7 +17,7 @@ C401.py:1:5: C401 [*] Unnecessary generator (rewrite as a `set` comprehension)
3 3 | y = f"{set(a if a < 6 else 0 for a in range(3))}"
4 4 | _ = "{}".format(set(a if a < 6 else 0 for a in range(3)))
C401.py:2:5: C401 [*] Unnecessary generator (rewrite as a `set` comprehension)
C401.py:2:5: C401 [**] Unnecessary generator (rewrite as a `set` comprehension)
|
1 | x = set(x for x in range(3))
2 | x = set(x for x in range(3))
@ -35,7 +35,7 @@ C401.py:2:5: C401 [*] Unnecessary generator (rewrite as a `set` comprehension)
4 4 | _ = "{}".format(set(a if a < 6 else 0 for a in range(3)))
5 5 | print(f"Hello {set(a for a in range(3))} World")
C401.py:3:8: C401 [*] Unnecessary generator (rewrite as a `set` comprehension)
C401.py:3:8: C401 [**] Unnecessary generator (rewrite as a `set` comprehension)
|
1 | x = set(x for x in range(3))
2 | x = set(x for x in range(3))
@ -55,7 +55,7 @@ C401.py:3:8: C401 [*] Unnecessary generator (rewrite as a `set` comprehension)
5 5 | print(f"Hello {set(a for a in range(3))} World")
6 6 |
C401.py:4:17: C401 [*] Unnecessary generator (rewrite as a `set` comprehension)
C401.py:4:17: C401 [**] Unnecessary generator (rewrite as a `set` comprehension)
|
2 | x = set(x for x in range(3))
3 | y = f"{set(a if a < 6 else 0 for a in range(3))}"
@ -75,7 +75,7 @@ C401.py:4:17: C401 [*] Unnecessary generator (rewrite as a `set` comprehension)
6 6 |
7 7 |
C401.py:5:16: C401 [*] Unnecessary generator (rewrite as a `set` comprehension)
C401.py:5:16: C401 [**] Unnecessary generator (rewrite as a `set` comprehension)
|
3 | y = f"{set(a if a < 6 else 0 for a in range(3))}"
4 | _ = "{}".format(set(a if a < 6 else 0 for a in range(3)))
@ -94,7 +94,7 @@ C401.py:5:16: C401 [*] Unnecessary generator (rewrite as a `set` comprehension)
7 7 |
8 8 | def f(x):
C401.py:12:16: C401 [*] Unnecessary generator (rewrite as a `set` comprehension)
C401.py:12:16: C401 [**] Unnecessary generator (rewrite as a `set` comprehension)
|
12 | print(f'Hello {set(a for a in "abc")} World')
| ^^^^^^^^^^^^^^^^^^^^^ C401
@ -113,7 +113,7 @@ C401.py:12:16: C401 [*] Unnecessary generator (rewrite as a `set` comprehension)
14 14 | print(f"Hello {set(f(a) for a in 'abc')} World")
15 15 | print(f"{set(a for a in 'abc') - set(a for a in 'ab')}")
C401.py:13:16: C401 [*] Unnecessary generator (rewrite as a `set` comprehension)
C401.py:13:16: C401 [**] Unnecessary generator (rewrite as a `set` comprehension)
|
12 | print(f'Hello {set(a for a in "abc")} World')
13 | print(f"Hello {set(a for a in 'abc')} World")
@ -133,7 +133,7 @@ C401.py:13:16: C401 [*] Unnecessary generator (rewrite as a `set` comprehension)
15 15 | print(f"{set(a for a in 'abc') - set(a for a in 'ab')}")
16 16 | print(f"{ set(a for a in 'abc') - set(a for a in 'ab') }")
C401.py:14:16: C401 [*] Unnecessary generator (rewrite as a `set` comprehension)
C401.py:14:16: C401 [**] Unnecessary generator (rewrite as a `set` comprehension)
|
12 | print(f'Hello {set(a for a in "abc")} World')
13 | print(f"Hello {set(a for a in 'abc')} World")
@ -154,7 +154,7 @@ C401.py:14:16: C401 [*] Unnecessary generator (rewrite as a `set` comprehension)
16 16 | print(f"{ set(a for a in 'abc') - set(a for a in 'ab') }")
17 17 |
C401.py:15:10: C401 [*] Unnecessary generator (rewrite as a `set` comprehension)
C401.py:15:10: C401 [**] Unnecessary generator (rewrite as a `set` comprehension)
|
13 | print(f"Hello {set(a for a in 'abc')} World")
14 | print(f"Hello {set(f(a) for a in 'abc')} World")
@ -174,7 +174,7 @@ C401.py:15:10: C401 [*] Unnecessary generator (rewrite as a `set` comprehension)
17 17 |
18 18 | # The fix generated for this diagnostic is incorrect, as we add additional space
C401.py:15:34: C401 [*] Unnecessary generator (rewrite as a `set` comprehension)
C401.py:15:34: C401 [**] Unnecessary generator (rewrite as a `set` comprehension)
|
13 | print(f"Hello {set(a for a in 'abc')} World")
14 | print(f"Hello {set(f(a) for a in 'abc')} World")
@ -194,7 +194,7 @@ C401.py:15:34: C401 [*] Unnecessary generator (rewrite as a `set` comprehension)
17 17 |
18 18 | # The fix generated for this diagnostic is incorrect, as we add additional space
C401.py:16:11: C401 [*] Unnecessary generator (rewrite as a `set` comprehension)
C401.py:16:11: C401 [**] Unnecessary generator (rewrite as a `set` comprehension)
|
14 | print(f"Hello {set(f(a) for a in 'abc')} World")
15 | print(f"{set(a for a in 'abc') - set(a for a in 'ab')}")
@ -215,7 +215,7 @@ C401.py:16:11: C401 [*] Unnecessary generator (rewrite as a `set` comprehension)
18 18 | # The fix generated for this diagnostic is incorrect, as we add additional space
19 19 | # around the set comprehension.
C401.py:16:35: C401 [*] Unnecessary generator (rewrite as a `set` comprehension)
C401.py:16:35: C401 [**] Unnecessary generator (rewrite as a `set` comprehension)
|
14 | print(f"Hello {set(f(a) for a in 'abc')} World")
15 | print(f"{set(a for a in 'abc') - set(a for a in 'ab')}")
@ -236,7 +236,7 @@ C401.py:16:35: C401 [*] Unnecessary generator (rewrite as a `set` comprehension)
18 18 | # The fix generated for this diagnostic is incorrect, as we add additional space
19 19 | # around the set comprehension.
C401.py:20:12: C401 [*] Unnecessary generator (rewrite as a `set` comprehension)
C401.py:20:12: C401 [**] Unnecessary generator (rewrite as a `set` comprehension)
|
18 | # The fix generated for this diagnostic is incorrect, as we add additional space
19 | # around the set comprehension.

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs
---
C402.py:1:1: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension)
C402.py:1:1: C402 [**] Unnecessary generator (rewrite as a `dict` comprehension)
|
1 | dict((x, x) for x in range(3))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C402
@ -17,7 +17,7 @@ C402.py:1:1: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension)
3 3 | (x, x) for x in range(3)
4 4 | )
C402.py:2:1: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension)
C402.py:2:1: C402 [**] Unnecessary generator (rewrite as a `dict` comprehension)
|
1 | dict((x, x) for x in range(3))
2 | / dict(
@ -41,7 +41,7 @@ C402.py:2:1: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension)
6 6 | y = f'{dict((x, x) for x in range(3))}'
7 7 | print(f'Hello {dict((x, x) for x in range(3))} World')
C402.py:6:8: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension)
C402.py:6:8: C402 [**] Unnecessary generator (rewrite as a `dict` comprehension)
|
4 | )
5 | dict(((x, x) for x in range(3)), z=3)
@ -62,7 +62,7 @@ C402.py:6:8: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension)
8 8 | print(f"Hello {dict((x, x) for x in 'abc')} World")
9 9 | print(f'Hello {dict((x, x) for x in "abc")} World')
C402.py:7:16: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension)
C402.py:7:16: C402 [**] Unnecessary generator (rewrite as a `dict` comprehension)
|
5 | dict(((x, x) for x in range(3)), z=3)
6 | y = f'{dict((x, x) for x in range(3))}'
@ -83,7 +83,7 @@ C402.py:7:16: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension)
9 9 | print(f'Hello {dict((x, x) for x in "abc")} World')
10 10 | print(f'Hello {dict((x,x) for x in "abc")} World')
C402.py:8:16: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension)
C402.py:8:16: C402 [**] Unnecessary generator (rewrite as a `dict` comprehension)
|
6 | y = f'{dict((x, x) for x in range(3))}'
7 | print(f'Hello {dict((x, x) for x in range(3))} World')
@ -104,7 +104,7 @@ C402.py:8:16: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension)
10 10 | print(f'Hello {dict((x,x) for x in "abc")} World')
11 11 |
C402.py:9:16: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension)
C402.py:9:16: C402 [**] Unnecessary generator (rewrite as a `dict` comprehension)
|
7 | print(f'Hello {dict((x, x) for x in range(3))} World')
8 | print(f"Hello {dict((x, x) for x in 'abc')} World")
@ -124,7 +124,7 @@ C402.py:9:16: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension)
11 11 |
12 12 | f'{dict((x, x) for x in range(3)) | dict((x, x) for x in range(3))}'
C402.py:10:16: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension)
C402.py:10:16: C402 [**] Unnecessary generator (rewrite as a `dict` comprehension)
|
8 | print(f"Hello {dict((x, x) for x in 'abc')} World")
9 | print(f'Hello {dict((x, x) for x in "abc")} World')
@ -145,7 +145,7 @@ C402.py:10:16: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension
12 12 | f'{dict((x, x) for x in range(3)) | dict((x, x) for x in range(3))}'
13 13 | f'{ dict((x, x) for x in range(3)) | dict((x, x) for x in range(3)) }'
C402.py:12:4: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension)
C402.py:12:4: C402 [**] Unnecessary generator (rewrite as a `dict` comprehension)
|
10 | print(f'Hello {dict((x,x) for x in "abc")} World')
11 |
@ -165,7 +165,7 @@ C402.py:12:4: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension)
14 14 |
15 15 | def f(x):
C402.py:12:37: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension)
C402.py:12:37: C402 [**] Unnecessary generator (rewrite as a `dict` comprehension)
|
10 | print(f'Hello {dict((x,x) for x in "abc")} World')
11 |
@ -185,7 +185,7 @@ C402.py:12:37: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension
14 14 |
15 15 | def f(x):
C402.py:13:5: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension)
C402.py:13:5: C402 [**] Unnecessary generator (rewrite as a `dict` comprehension)
|
12 | f'{dict((x, x) for x in range(3)) | dict((x, x) for x in range(3))}'
13 | f'{ dict((x, x) for x in range(3)) | dict((x, x) for x in range(3)) }'
@ -205,7 +205,7 @@ C402.py:13:5: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension)
15 15 | def f(x):
16 16 | return x
C402.py:13:38: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension)
C402.py:13:38: C402 [**] Unnecessary generator (rewrite as a `dict` comprehension)
|
12 | f'{dict((x, x) for x in range(3)) | dict((x, x) for x in range(3))}'
13 | f'{ dict((x, x) for x in range(3)) | dict((x, x) for x in range(3)) }'
@ -225,7 +225,7 @@ C402.py:13:38: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension
15 15 | def f(x):
16 16 | return x
C402.py:18:16: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension)
C402.py:18:16: C402 [**] Unnecessary generator (rewrite as a `dict` comprehension)
|
16 | return x
17 |
@ -246,7 +246,7 @@ C402.py:18:16: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension
20 20 | # Regression test for: https://github.com/astral-sh/ruff/issues/7086
21 21 | dict((k,v)for k,v in d.iteritems() if k in only_args)
C402.py:21:1: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension)
C402.py:21:1: C402 [**] Unnecessary generator (rewrite as a `dict` comprehension)
|
20 | # Regression test for: https://github.com/astral-sh/ruff/issues/7086
21 | dict((k,v)for k,v in d.iteritems() if k in only_args)

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs
---
C403.py:1:5: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` comprehension)
C403.py:1:5: C403 [**] Unnecessary `list` comprehension (rewrite as a `set` comprehension)
|
1 | s = set([x for x in range(3)])
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ C403
@ -17,7 +17,7 @@ C403.py:1:5: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` compr
3 3 | [x for x in range(3)]
4 4 | )
C403.py:2:5: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` comprehension)
C403.py:2:5: C403 [**] Unnecessary `list` comprehension (rewrite as a `set` comprehension)
|
1 | s = set([x for x in range(3)])
2 | s = set(
@ -42,7 +42,7 @@ C403.py:2:5: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` compr
6 6 | s = f"{set([x for x in 'ab'])}"
7 7 | s = f'{set([x for x in "ab"])}'
C403.py:6:8: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` comprehension)
C403.py:6:8: C403 [**] Unnecessary `list` comprehension (rewrite as a `set` comprehension)
|
4 | )
5 |
@ -62,7 +62,7 @@ C403.py:6:8: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` compr
8 8 |
9 9 | def f(x):
C403.py:7:8: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` comprehension)
C403.py:7:8: C403 [**] Unnecessary `list` comprehension (rewrite as a `set` comprehension)
|
6 | s = f"{set([x for x in 'ab'])}"
7 | s = f'{set([x for x in "ab"])}'
@ -82,7 +82,7 @@ C403.py:7:8: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` compr
9 9 | def f(x):
10 10 | return x
C403.py:12:8: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` comprehension)
C403.py:12:8: C403 [**] Unnecessary `list` comprehension (rewrite as a `set` comprehension)
|
10 | return x
11 |
@ -103,7 +103,7 @@ C403.py:12:8: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` comp
14 14 | s = f"{ set([x for x in 'ab']) | set([x for x in 'ab']) }"
15 15 | s = f"{set([x for x in 'ab']) | set([x for x in 'ab'])}"
C403.py:14:9: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` comprehension)
C403.py:14:9: C403 [**] Unnecessary `list` comprehension (rewrite as a `set` comprehension)
|
12 | s = f"{set([f(x) for x in 'ab'])}"
13 |
@ -121,7 +121,7 @@ C403.py:14:9: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` comp
14 |+s = f"{ {x for x in 'ab'} | set([x for x in 'ab']) }"
15 15 | s = f"{set([x for x in 'ab']) | set([x for x in 'ab'])}"
C403.py:14:34: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` comprehension)
C403.py:14:34: C403 [**] Unnecessary `list` comprehension (rewrite as a `set` comprehension)
|
12 | s = f"{set([f(x) for x in 'ab'])}"
13 |
@ -139,7 +139,7 @@ C403.py:14:34: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` com
14 |+s = f"{ set([x for x in 'ab']) | {x for x in 'ab'} }"
15 15 | s = f"{set([x for x in 'ab']) | set([x for x in 'ab'])}"
C403.py:15:8: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` comprehension)
C403.py:15:8: C403 [**] Unnecessary `list` comprehension (rewrite as a `set` comprehension)
|
14 | s = f"{ set([x for x in 'ab']) | set([x for x in 'ab']) }"
15 | s = f"{set([x for x in 'ab']) | set([x for x in 'ab'])}"
@ -154,7 +154,7 @@ C403.py:15:8: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` comp
15 |-s = f"{set([x for x in 'ab']) | set([x for x in 'ab'])}"
15 |+s = f"{ {x for x in 'ab'} | set([x for x in 'ab'])}"
C403.py:15:33: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` comprehension)
C403.py:15:33: C403 [**] Unnecessary `list` comprehension (rewrite as a `set` comprehension)
|
14 | s = f"{ set([x for x in 'ab']) | set([x for x in 'ab']) }"
15 | s = f"{set([x for x in 'ab']) | set([x for x in 'ab'])}"

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs
---
C404.py:1:1: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` comprehension)
C404.py:1:1: C404 [**] Unnecessary `list` comprehension (rewrite as a `dict` comprehension)
|
1 | dict([(i, i) for i in range(3)])
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C404
@ -16,7 +16,7 @@ C404.py:1:1: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` comp
3 3 |
4 4 | def f(x):
C404.py:7:4: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` comprehension)
C404.py:7:4: C404 [**] Unnecessary `list` comprehension (rewrite as a `dict` comprehension)
|
5 | return x
6 |
@ -37,7 +37,7 @@ C404.py:7:4: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` comp
9 9 | f"{dict([(s, s) for s in 'ab'])}"
10 10 | f"{dict([(s,f(s)) for s in 'ab'])}"
C404.py:8:4: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` comprehension)
C404.py:8:4: C404 [**] Unnecessary `list` comprehension (rewrite as a `dict` comprehension)
|
7 | f'{dict([(s,s) for s in "ab"])}'
8 | f"{dict([(s,s) for s in 'ab'])}"
@ -57,7 +57,7 @@ C404.py:8:4: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` comp
10 10 | f"{dict([(s,f(s)) for s in 'ab'])}"
11 11 |
C404.py:9:4: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` comprehension)
C404.py:9:4: C404 [**] Unnecessary `list` comprehension (rewrite as a `dict` comprehension)
|
7 | f'{dict([(s,s) for s in "ab"])}'
8 | f"{dict([(s,s) for s in 'ab'])}"
@ -77,7 +77,7 @@ C404.py:9:4: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` comp
11 11 |
12 12 | f'{dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"])}'
C404.py:10:4: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` comprehension)
C404.py:10:4: C404 [**] Unnecessary `list` comprehension (rewrite as a `dict` comprehension)
|
8 | f"{dict([(s,s) for s in 'ab'])}"
9 | f"{dict([(s, s) for s in 'ab'])}"
@ -98,7 +98,7 @@ C404.py:10:4: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` com
12 12 | f'{dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"])}'
13 13 | f'{ dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"]) }'
C404.py:12:4: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` comprehension)
C404.py:12:4: C404 [**] Unnecessary `list` comprehension (rewrite as a `dict` comprehension)
|
10 | f"{dict([(s,f(s)) for s in 'ab'])}"
11 |
@ -118,7 +118,7 @@ C404.py:12:4: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` com
14 14 |
15 15 | # Regression test for: https://github.com/astral-sh/ruff/issues/7087
C404.py:12:34: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` comprehension)
C404.py:12:34: C404 [**] Unnecessary `list` comprehension (rewrite as a `dict` comprehension)
|
10 | f"{dict([(s,f(s)) for s in 'ab'])}"
11 |
@ -138,7 +138,7 @@ C404.py:12:34: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` co
14 14 |
15 15 | # Regression test for: https://github.com/astral-sh/ruff/issues/7087
C404.py:13:5: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` comprehension)
C404.py:13:5: C404 [**] Unnecessary `list` comprehension (rewrite as a `dict` comprehension)
|
12 | f'{dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"])}'
13 | f'{ dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"]) }'
@ -158,7 +158,7 @@ C404.py:13:5: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` com
15 15 | # Regression test for: https://github.com/astral-sh/ruff/issues/7087
16 16 | saved.append(dict([(k, v)for k,v in list(unique_instance.__dict__.items()) if k in [f.name for f in unique_instance._meta.fields]]))
C404.py:13:35: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` comprehension)
C404.py:13:35: C404 [**] Unnecessary `list` comprehension (rewrite as a `dict` comprehension)
|
12 | f'{dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"])}'
13 | f'{ dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"]) }'
@ -178,7 +178,7 @@ C404.py:13:35: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` co
15 15 | # Regression test for: https://github.com/astral-sh/ruff/issues/7087
16 16 | saved.append(dict([(k, v)for k,v in list(unique_instance.__dict__.items()) if k in [f.name for f in unique_instance._meta.fields]]))
C404.py:16:14: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` comprehension)
C404.py:16:14: C404 [**] Unnecessary `list` comprehension (rewrite as a `dict` comprehension)
|
15 | # Regression test for: https://github.com/astral-sh/ruff/issues/7087
16 | saved.append(dict([(k, v)for k,v in list(unique_instance.__dict__.items()) if k in [f.name for f in unique_instance._meta.fields]]))

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs
---
C405.py:1:1: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal)
C405.py:1:1: C405 [**] Unnecessary `list` literal (rewrite as a `set` literal)
|
1 | set([1, 2])
| ^^^^^^^^^^^ C405
@ -17,7 +17,7 @@ C405.py:1:1: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal)
3 3 | set([])
4 4 | set(())
C405.py:2:1: C405 [*] Unnecessary `tuple` literal (rewrite as a `set` literal)
C405.py:2:1: C405 [**] Unnecessary `tuple` literal (rewrite as a `set` literal)
|
1 | set([1, 2])
2 | set((1, 2))
@ -35,7 +35,7 @@ C405.py:2:1: C405 [*] Unnecessary `tuple` literal (rewrite as a `set` literal)
4 4 | set(())
5 5 | set()
C405.py:3:1: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal)
C405.py:3:1: C405 [**] Unnecessary `list` literal (rewrite as a `set` literal)
|
1 | set([1, 2])
2 | set((1, 2))
@ -55,7 +55,7 @@ C405.py:3:1: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal)
5 5 | set()
6 6 | set((1,))
C405.py:4:1: C405 [*] Unnecessary `tuple` literal (rewrite as a `set` literal)
C405.py:4:1: C405 [**] Unnecessary `tuple` literal (rewrite as a `set` literal)
|
2 | set((1, 2))
3 | set([])
@ -77,7 +77,7 @@ C405.py:4:1: C405 [*] Unnecessary `tuple` literal (rewrite as a `set` literal)
7 7 | set((
8 8 | 1,
C405.py:6:1: C405 [*] Unnecessary `tuple` literal (rewrite as a `set` literal)
C405.py:6:1: C405 [**] Unnecessary `tuple` literal (rewrite as a `set` literal)
|
4 | set(())
5 | set()
@ -98,7 +98,7 @@ C405.py:6:1: C405 [*] Unnecessary `tuple` literal (rewrite as a `set` literal)
8 8 | 1,
9 9 | ))
C405.py:7:1: C405 [*] Unnecessary `tuple` literal (rewrite as a `set` literal)
C405.py:7:1: C405 [**] Unnecessary `tuple` literal (rewrite as a `set` literal)
|
5 | set()
6 | set((1,))
@ -124,7 +124,7 @@ C405.py:7:1: C405 [*] Unnecessary `tuple` literal (rewrite as a `set` literal)
11 11 | 1,
12 12 | ])
C405.py:10:1: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal)
C405.py:10:1: C405 [**] Unnecessary `list` literal (rewrite as a `set` literal)
|
8 | 1,
9 | ))
@ -150,7 +150,7 @@ C405.py:10:1: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal)
14 14 | (1,)
15 15 | )
C405.py:13:1: C405 [*] Unnecessary `tuple` literal (rewrite as a `set` literal)
C405.py:13:1: C405 [**] Unnecessary `tuple` literal (rewrite as a `set` literal)
|
11 | 1,
12 | ])
@ -175,7 +175,7 @@ C405.py:13:1: C405 [*] Unnecessary `tuple` literal (rewrite as a `set` literal)
17 15 | [1,]
18 16 | )
C405.py:16:1: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal)
C405.py:16:1: C405 [**] Unnecessary `list` literal (rewrite as a `set` literal)
|
14 | (1,)
15 | )
@ -200,7 +200,7 @@ C405.py:16:1: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal)
20 18 | f"{set(['a', 'b'])}"
21 19 | f'{set(["a", "b"])}'
C405.py:19:4: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal)
C405.py:19:4: C405 [**] Unnecessary `list` literal (rewrite as a `set` literal)
|
17 | [1,]
18 | )
@ -221,7 +221,7 @@ C405.py:19:4: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal)
21 21 | f'{set(["a", "b"])}'
22 22 |
C405.py:20:4: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal)
C405.py:20:4: C405 [**] Unnecessary `list` literal (rewrite as a `set` literal)
|
18 | )
19 | f"{set([1,2,3])}"
@ -241,7 +241,7 @@ C405.py:20:4: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal)
22 22 |
23 23 | f"{set(['a', 'b']) - set(['a'])}"
C405.py:21:4: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal)
C405.py:21:4: C405 [**] Unnecessary `list` literal (rewrite as a `set` literal)
|
19 | f"{set([1,2,3])}"
20 | f"{set(['a', 'b'])}"
@ -262,7 +262,7 @@ C405.py:21:4: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal)
23 23 | f"{set(['a', 'b']) - set(['a'])}"
24 24 | f"{ set(['a', 'b']) - set(['a']) }"
C405.py:23:4: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal)
C405.py:23:4: C405 [**] Unnecessary `list` literal (rewrite as a `set` literal)
|
21 | f'{set(["a", "b"])}'
22 |
@ -283,7 +283,7 @@ C405.py:23:4: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal)
25 25 | f"a {set(['a', 'b']) - set(['a'])} b"
26 26 | f"a { set(['a', 'b']) - set(['a']) } b"
C405.py:23:22: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal)
C405.py:23:22: C405 [**] Unnecessary `list` literal (rewrite as a `set` literal)
|
21 | f'{set(["a", "b"])}'
22 |
@ -304,7 +304,7 @@ C405.py:23:22: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal)
25 25 | f"a {set(['a', 'b']) - set(['a'])} b"
26 26 | f"a { set(['a', 'b']) - set(['a']) } b"
C405.py:24:5: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal)
C405.py:24:5: C405 [**] Unnecessary `list` literal (rewrite as a `set` literal)
|
23 | f"{set(['a', 'b']) - set(['a'])}"
24 | f"{ set(['a', 'b']) - set(['a']) }"
@ -323,7 +323,7 @@ C405.py:24:5: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal)
25 25 | f"a {set(['a', 'b']) - set(['a'])} b"
26 26 | f"a { set(['a', 'b']) - set(['a']) } b"
C405.py:24:23: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal)
C405.py:24:23: C405 [**] Unnecessary `list` literal (rewrite as a `set` literal)
|
23 | f"{set(['a', 'b']) - set(['a'])}"
24 | f"{ set(['a', 'b']) - set(['a']) }"
@ -342,7 +342,7 @@ C405.py:24:23: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal)
25 25 | f"a {set(['a', 'b']) - set(['a'])} b"
26 26 | f"a { set(['a', 'b']) - set(['a']) } b"
C405.py:25:6: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal)
C405.py:25:6: C405 [**] Unnecessary `list` literal (rewrite as a `set` literal)
|
23 | f"{set(['a', 'b']) - set(['a'])}"
24 | f"{ set(['a', 'b']) - set(['a']) }"
@ -360,7 +360,7 @@ C405.py:25:6: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal)
25 |+f"a { {'a', 'b'} - set(['a'])} b"
26 26 | f"a { set(['a', 'b']) - set(['a']) } b"
C405.py:25:24: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal)
C405.py:25:24: C405 [**] Unnecessary `list` literal (rewrite as a `set` literal)
|
23 | f"{set(['a', 'b']) - set(['a'])}"
24 | f"{ set(['a', 'b']) - set(['a']) }"
@ -378,7 +378,7 @@ C405.py:25:24: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal)
25 |+f"a {set(['a', 'b']) - {'a'} } b"
26 26 | f"a { set(['a', 'b']) - set(['a']) } b"
C405.py:26:7: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal)
C405.py:26:7: C405 [**] Unnecessary `list` literal (rewrite as a `set` literal)
|
24 | f"{ set(['a', 'b']) - set(['a']) }"
25 | f"a {set(['a', 'b']) - set(['a'])} b"
@ -394,7 +394,7 @@ C405.py:26:7: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal)
26 |-f"a { set(['a', 'b']) - set(['a']) } b"
26 |+f"a { {'a', 'b'} - set(['a']) } b"
C405.py:26:25: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal)
C405.py:26:25: C405 [**] Unnecessary `list` literal (rewrite as a `set` literal)
|
24 | f"{ set(['a', 'b']) - set(['a']) }"
25 | f"a {set(['a', 'b']) - set(['a'])} b"

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs
---
C406.py:1:6: C406 [*] Unnecessary `list` literal (rewrite as a `dict` literal)
C406.py:1:6: C406 [**] Unnecessary `list` literal (rewrite as a `dict` literal)
|
1 | d1 = dict([(1, 2)])
| ^^^^^^^^^^^^^^ C406
@ -17,7 +17,7 @@ C406.py:1:6: C406 [*] Unnecessary `list` literal (rewrite as a `dict` literal)
3 3 | d3 = dict([])
4 4 | d4 = dict(())
C406.py:2:6: C406 [*] Unnecessary `tuple` literal (rewrite as a `dict` literal)
C406.py:2:6: C406 [**] Unnecessary `tuple` literal (rewrite as a `dict` literal)
|
1 | d1 = dict([(1, 2)])
2 | d2 = dict(((1, 2),))
@ -35,7 +35,7 @@ C406.py:2:6: C406 [*] Unnecessary `tuple` literal (rewrite as a `dict` literal)
4 4 | d4 = dict(())
5 5 | d5 = dict()
C406.py:3:6: C406 [*] Unnecessary `list` literal (rewrite as a `dict` literal)
C406.py:3:6: C406 [**] Unnecessary `list` literal (rewrite as a `dict` literal)
|
1 | d1 = dict([(1, 2)])
2 | d2 = dict(((1, 2),))
@ -54,7 +54,7 @@ C406.py:3:6: C406 [*] Unnecessary `list` literal (rewrite as a `dict` literal)
4 4 | d4 = dict(())
5 5 | d5 = dict()
C406.py:4:6: C406 [*] Unnecessary `tuple` literal (rewrite as a `dict` literal)
C406.py:4:6: C406 [**] Unnecessary `tuple` literal (rewrite as a `dict` literal)
|
2 | d2 = dict(((1, 2),))
3 | d3 = dict([])

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs
---
C408.py:1:5: C408 [*] Unnecessary `tuple` call (rewrite as a literal)
C408.py:1:5: C408 [**] Unnecessary `tuple` call (rewrite as a literal)
|
1 | t = tuple()
| ^^^^^^^ C408
@ -17,7 +17,7 @@ C408.py:1:5: C408 [*] Unnecessary `tuple` call (rewrite as a literal)
3 3 | d1 = dict()
4 4 | d2 = dict(a=1)
C408.py:2:5: C408 [*] Unnecessary `list` call (rewrite as a literal)
C408.py:2:5: C408 [**] Unnecessary `list` call (rewrite as a literal)
|
1 | t = tuple()
2 | l = list()
@ -35,7 +35,7 @@ C408.py:2:5: C408 [*] Unnecessary `list` call (rewrite as a literal)
4 4 | d2 = dict(a=1)
5 5 | d3 = dict(**d2)
C408.py:3:6: C408 [*] Unnecessary `dict` call (rewrite as a literal)
C408.py:3:6: C408 [**] Unnecessary `dict` call (rewrite as a literal)
|
1 | t = tuple()
2 | l = list()
@ -55,7 +55,7 @@ C408.py:3:6: C408 [*] Unnecessary `dict` call (rewrite as a literal)
5 5 | d3 = dict(**d2)
6 6 |
C408.py:4:6: C408 [*] Unnecessary `dict` call (rewrite as a literal)
C408.py:4:6: C408 [**] Unnecessary `dict` call (rewrite as a literal)
|
2 | l = list()
3 | d1 = dict()
@ -75,7 +75,7 @@ C408.py:4:6: C408 [*] Unnecessary `dict` call (rewrite as a literal)
6 6 |
7 7 |
C408.py:14:4: C408 [*] Unnecessary `dict` call (rewrite as a literal)
C408.py:14:4: C408 [**] Unnecessary `dict` call (rewrite as a literal)
|
12 | a = list()
13 |
@ -96,7 +96,7 @@ C408.py:14:4: C408 [*] Unnecessary `dict` call (rewrite as a literal)
16 16 | f"{dict()}"
17 17 | f"a {dict()} b"
C408.py:15:4: C408 [*] Unnecessary `dict` call (rewrite as a literal)
C408.py:15:4: C408 [**] Unnecessary `dict` call (rewrite as a literal)
|
14 | f"{dict(x='y')}"
15 | f'{dict(x="y")}'
@ -116,7 +116,7 @@ C408.py:15:4: C408 [*] Unnecessary `dict` call (rewrite as a literal)
17 17 | f"a {dict()} b"
18 18 |
C408.py:16:4: C408 [*] Unnecessary `dict` call (rewrite as a literal)
C408.py:16:4: C408 [**] Unnecessary `dict` call (rewrite as a literal)
|
14 | f"{dict(x='y')}"
15 | f'{dict(x="y")}'
@ -136,7 +136,7 @@ C408.py:16:4: C408 [*] Unnecessary `dict` call (rewrite as a literal)
18 18 |
19 19 | f"{dict(x='y') | dict(y='z')}"
C408.py:17:6: C408 [*] Unnecessary `dict` call (rewrite as a literal)
C408.py:17:6: C408 [**] Unnecessary `dict` call (rewrite as a literal)
|
15 | f'{dict(x="y")}'
16 | f"{dict()}"
@ -157,7 +157,7 @@ C408.py:17:6: C408 [*] Unnecessary `dict` call (rewrite as a literal)
19 19 | f"{dict(x='y') | dict(y='z')}"
20 20 | f"{ dict(x='y') | dict(y='z') }"
C408.py:19:4: C408 [*] Unnecessary `dict` call (rewrite as a literal)
C408.py:19:4: C408 [**] Unnecessary `dict` call (rewrite as a literal)
|
17 | f"a {dict()} b"
18 |
@ -178,7 +178,7 @@ C408.py:19:4: C408 [*] Unnecessary `dict` call (rewrite as a literal)
21 21 | f"a {dict(x='y') | dict(y='z')} b"
22 22 | f"a { dict(x='y') | dict(y='z') } b"
C408.py:19:18: C408 [*] Unnecessary `dict` call (rewrite as a literal)
C408.py:19:18: C408 [**] Unnecessary `dict` call (rewrite as a literal)
|
17 | f"a {dict()} b"
18 |
@ -199,7 +199,7 @@ C408.py:19:18: C408 [*] Unnecessary `dict` call (rewrite as a literal)
21 21 | f"a {dict(x='y') | dict(y='z')} b"
22 22 | f"a { dict(x='y') | dict(y='z') } b"
C408.py:20:5: C408 [*] Unnecessary `dict` call (rewrite as a literal)
C408.py:20:5: C408 [**] Unnecessary `dict` call (rewrite as a literal)
|
19 | f"{dict(x='y') | dict(y='z')}"
20 | f"{ dict(x='y') | dict(y='z') }"
@ -218,7 +218,7 @@ C408.py:20:5: C408 [*] Unnecessary `dict` call (rewrite as a literal)
21 21 | f"a {dict(x='y') | dict(y='z')} b"
22 22 | f"a { dict(x='y') | dict(y='z') } b"
C408.py:20:19: C408 [*] Unnecessary `dict` call (rewrite as a literal)
C408.py:20:19: C408 [**] Unnecessary `dict` call (rewrite as a literal)
|
19 | f"{dict(x='y') | dict(y='z')}"
20 | f"{ dict(x='y') | dict(y='z') }"
@ -237,7 +237,7 @@ C408.py:20:19: C408 [*] Unnecessary `dict` call (rewrite as a literal)
21 21 | f"a {dict(x='y') | dict(y='z')} b"
22 22 | f"a { dict(x='y') | dict(y='z') } b"
C408.py:21:6: C408 [*] Unnecessary `dict` call (rewrite as a literal)
C408.py:21:6: C408 [**] Unnecessary `dict` call (rewrite as a literal)
|
19 | f"{dict(x='y') | dict(y='z')}"
20 | f"{ dict(x='y') | dict(y='z') }"
@ -255,7 +255,7 @@ C408.py:21:6: C408 [*] Unnecessary `dict` call (rewrite as a literal)
21 |+f"a { {'x': 'y'} | dict(y='z')} b"
22 22 | f"a { dict(x='y') | dict(y='z') } b"
C408.py:21:20: C408 [*] Unnecessary `dict` call (rewrite as a literal)
C408.py:21:20: C408 [**] Unnecessary `dict` call (rewrite as a literal)
|
19 | f"{dict(x='y') | dict(y='z')}"
20 | f"{ dict(x='y') | dict(y='z') }"
@ -273,7 +273,7 @@ C408.py:21:20: C408 [*] Unnecessary `dict` call (rewrite as a literal)
21 |+f"a {dict(x='y') | {'y': 'z'} } b"
22 22 | f"a { dict(x='y') | dict(y='z') } b"
C408.py:22:7: C408 [*] Unnecessary `dict` call (rewrite as a literal)
C408.py:22:7: C408 [**] Unnecessary `dict` call (rewrite as a literal)
|
20 | f"{ dict(x='y') | dict(y='z') }"
21 | f"a {dict(x='y') | dict(y='z')} b"
@ -289,7 +289,7 @@ C408.py:22:7: C408 [*] Unnecessary `dict` call (rewrite as a literal)
22 |-f"a { dict(x='y') | dict(y='z') } b"
22 |+f"a { {'x': 'y'} | dict(y='z') } b"
C408.py:22:21: C408 [*] Unnecessary `dict` call (rewrite as a literal)
C408.py:22:21: C408 [**] Unnecessary `dict` call (rewrite as a literal)
|
20 | f"{ dict(x='y') | dict(y='z') }"
21 | f"a {dict(x='y') | dict(y='z')} b"

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs
---
C408.py:1:5: C408 [*] Unnecessary `tuple` call (rewrite as a literal)
C408.py:1:5: C408 [**] Unnecessary `tuple` call (rewrite as a literal)
|
1 | t = tuple()
| ^^^^^^^ C408
@ -17,7 +17,7 @@ C408.py:1:5: C408 [*] Unnecessary `tuple` call (rewrite as a literal)
3 3 | d1 = dict()
4 4 | d2 = dict(a=1)
C408.py:2:5: C408 [*] Unnecessary `list` call (rewrite as a literal)
C408.py:2:5: C408 [**] Unnecessary `list` call (rewrite as a literal)
|
1 | t = tuple()
2 | l = list()
@ -35,7 +35,7 @@ C408.py:2:5: C408 [*] Unnecessary `list` call (rewrite as a literal)
4 4 | d2 = dict(a=1)
5 5 | d3 = dict(**d2)
C408.py:3:6: C408 [*] Unnecessary `dict` call (rewrite as a literal)
C408.py:3:6: C408 [**] Unnecessary `dict` call (rewrite as a literal)
|
1 | t = tuple()
2 | l = list()
@ -55,7 +55,7 @@ C408.py:3:6: C408 [*] Unnecessary `dict` call (rewrite as a literal)
5 5 | d3 = dict(**d2)
6 6 |
C408.py:16:4: C408 [*] Unnecessary `dict` call (rewrite as a literal)
C408.py:16:4: C408 [**] Unnecessary `dict` call (rewrite as a literal)
|
14 | f"{dict(x='y')}"
15 | f'{dict(x="y")}'
@ -75,7 +75,7 @@ C408.py:16:4: C408 [*] Unnecessary `dict` call (rewrite as a literal)
18 18 |
19 19 | f"{dict(x='y') | dict(y='z')}"
C408.py:17:6: C408 [*] Unnecessary `dict` call (rewrite as a literal)
C408.py:17:6: C408 [**] Unnecessary `dict` call (rewrite as a literal)
|
15 | f'{dict(x="y")}'
16 | f"{dict()}"

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs
---
C409.py:1:6: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite as a `tuple` literal)
C409.py:1:6: C409 [**] Unnecessary `list` literal passed to `tuple()` (rewrite as a `tuple` literal)
|
1 | t1 = tuple([])
| ^^^^^^^^^ C409
@ -17,7 +17,7 @@ C409.py:1:6: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite as
3 3 | t3 = tuple((1, 2))
4 4 | t4 = tuple([
C409.py:2:6: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite as a `tuple` literal)
C409.py:2:6: C409 [**] Unnecessary `list` literal passed to `tuple()` (rewrite as a `tuple` literal)
|
1 | t1 = tuple([])
2 | t2 = tuple([1, 2])
@ -35,7 +35,7 @@ C409.py:2:6: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite as
4 4 | t4 = tuple([
5 5 | 1,
C409.py:3:6: C409 [*] Unnecessary `tuple` literal passed to `tuple()` (remove the outer call to `tuple()`)
C409.py:3:6: C409 [**] Unnecessary `tuple` literal passed to `tuple()` (remove the outer call to `tuple()`)
|
1 | t1 = tuple([])
2 | t2 = tuple([1, 2])
@ -55,7 +55,7 @@ C409.py:3:6: C409 [*] Unnecessary `tuple` literal passed to `tuple()` (remove th
5 5 | 1,
6 6 | 2
C409.py:4:6: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite as a `tuple` literal)
C409.py:4:6: C409 [**] Unnecessary `list` literal passed to `tuple()` (rewrite as a `tuple` literal)
|
2 | t2 = tuple([1, 2])
3 | t3 = tuple((1, 2))
@ -84,7 +84,7 @@ C409.py:4:6: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite as
9 9 | (1, 2)
10 10 | )
C409.py:8:6: C409 [*] Unnecessary `tuple` literal passed to `tuple()` (remove the outer call to `tuple()`)
C409.py:8:6: C409 [**] Unnecessary `tuple` literal passed to `tuple()` (remove the outer call to `tuple()`)
|
6 | 2
7 | ])

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs
---
C410.py:1:6: C410 [*] Unnecessary `list` literal passed to `list()` (remove the outer call to `list()`)
C410.py:1:6: C410 [**] Unnecessary `list` literal passed to `list()` (remove the outer call to `list()`)
|
1 | l1 = list([1, 2])
| ^^^^^^^^^^^^ C410
@ -17,7 +17,7 @@ C410.py:1:6: C410 [*] Unnecessary `list` literal passed to `list()` (remove the
3 3 | l3 = list([])
4 4 | l4 = list(())
C410.py:2:6: C410 [*] Unnecessary `tuple` literal passed to `list()` (rewrite as a `list` literal)
C410.py:2:6: C410 [**] Unnecessary `tuple` literal passed to `list()` (rewrite as a `list` literal)
|
1 | l1 = list([1, 2])
2 | l2 = list((1, 2))
@ -34,7 +34,7 @@ C410.py:2:6: C410 [*] Unnecessary `tuple` literal passed to `list()` (rewrite as
3 3 | l3 = list([])
4 4 | l4 = list(())
C410.py:3:6: C410 [*] Unnecessary `list` literal passed to `list()` (remove the outer call to `list()`)
C410.py:3:6: C410 [**] Unnecessary `list` literal passed to `list()` (remove the outer call to `list()`)
|
1 | l1 = list([1, 2])
2 | l2 = list((1, 2))
@ -51,7 +51,7 @@ C410.py:3:6: C410 [*] Unnecessary `list` literal passed to `list()` (remove the
3 |+l3 = []
4 4 | l4 = list(())
C410.py:4:6: C410 [*] Unnecessary `tuple` literal passed to `list()` (rewrite as a `list` literal)
C410.py:4:6: C410 [**] Unnecessary `tuple` literal passed to `list()` (rewrite as a `list` literal)
|
2 | l2 = list((1, 2))
3 | l3 = list([])

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs
---
C411.py:2:1: C411 [*] Unnecessary `list` call (remove the outer call to `list()`)
C411.py:2:1: C411 [**] Unnecessary `list` call (remove the outer call to `list()`)
|
1 | x = [1, 2, 3]
2 | list([i for i in x])

View File

@ -21,7 +21,7 @@ C413.py:3:1: C413 [*] Unnecessary `list` call around `sorted()`
5 5 | reversed(sorted(x, key=lambda e: e))
6 6 | reversed(sorted(x, reverse=True))
C413.py:4:1: C413 [*] Unnecessary `reversed` call around `sorted()`
C413.py:4:1: C413 [**] Unnecessary `reversed` call around `sorted()`
|
2 | list(x)
3 | list(sorted(x))
@ -42,7 +42,7 @@ C413.py:4:1: C413 [*] Unnecessary `reversed` call around `sorted()`
6 6 | reversed(sorted(x, reverse=True))
7 7 | reversed(sorted(x, key=lambda e: e, reverse=True))
C413.py:5:1: C413 [*] Unnecessary `reversed` call around `sorted()`
C413.py:5:1: C413 [**] Unnecessary `reversed` call around `sorted()`
|
3 | list(sorted(x))
4 | reversed(sorted(x))
@ -63,7 +63,7 @@ C413.py:5:1: C413 [*] Unnecessary `reversed` call around `sorted()`
7 7 | reversed(sorted(x, key=lambda e: e, reverse=True))
8 8 | reversed(sorted(x, reverse=True, key=lambda e: e))
C413.py:6:1: C413 [*] Unnecessary `reversed` call around `sorted()`
C413.py:6:1: C413 [**] Unnecessary `reversed` call around `sorted()`
|
4 | reversed(sorted(x))
5 | reversed(sorted(x, key=lambda e: e))
@ -84,7 +84,7 @@ C413.py:6:1: C413 [*] Unnecessary `reversed` call around `sorted()`
8 8 | reversed(sorted(x, reverse=True, key=lambda e: e))
9 9 | reversed(sorted(x, reverse=False))
C413.py:7:1: C413 [*] Unnecessary `reversed` call around `sorted()`
C413.py:7:1: C413 [**] Unnecessary `reversed` call around `sorted()`
|
5 | reversed(sorted(x, key=lambda e: e))
6 | reversed(sorted(x, reverse=True))
@ -105,7 +105,7 @@ C413.py:7:1: C413 [*] Unnecessary `reversed` call around `sorted()`
9 9 | reversed(sorted(x, reverse=False))
10 10 | reversed(sorted(x, reverse=x))
C413.py:8:1: C413 [*] Unnecessary `reversed` call around `sorted()`
C413.py:8:1: C413 [**] Unnecessary `reversed` call around `sorted()`
|
6 | reversed(sorted(x, reverse=True))
7 | reversed(sorted(x, key=lambda e: e, reverse=True))
@ -126,7 +126,7 @@ C413.py:8:1: C413 [*] Unnecessary `reversed` call around `sorted()`
10 10 | reversed(sorted(x, reverse=x))
11 11 | reversed(sorted(x, reverse=not x))
C413.py:9:1: C413 [*] Unnecessary `reversed` call around `sorted()`
C413.py:9:1: C413 [**] Unnecessary `reversed` call around `sorted()`
|
7 | reversed(sorted(x, key=lambda e: e, reverse=True))
8 | reversed(sorted(x, reverse=True, key=lambda e: e))
@ -147,7 +147,7 @@ C413.py:9:1: C413 [*] Unnecessary `reversed` call around `sorted()`
11 11 | reversed(sorted(x, reverse=not x))
12 12 |
C413.py:10:1: C413 [*] Unnecessary `reversed` call around `sorted()`
C413.py:10:1: C413 [**] Unnecessary `reversed` call around `sorted()`
|
8 | reversed(sorted(x, reverse=True, key=lambda e: e))
9 | reversed(sorted(x, reverse=False))
@ -167,7 +167,7 @@ C413.py:10:1: C413 [*] Unnecessary `reversed` call around `sorted()`
12 12 |
13 13 | # Regression test for: https://github.com/astral-sh/ruff/issues/7289
C413.py:11:1: C413 [*] Unnecessary `reversed` call around `sorted()`
C413.py:11:1: C413 [**] Unnecessary `reversed` call around `sorted()`
|
9 | reversed(sorted(x, reverse=False))
10 | reversed(sorted(x, reverse=x))
@ -188,7 +188,7 @@ C413.py:11:1: C413 [*] Unnecessary `reversed` call around `sorted()`
13 13 | # Regression test for: https://github.com/astral-sh/ruff/issues/7289
14 14 | reversed(sorted(i for i in range(42)))
C413.py:14:1: C413 [*] Unnecessary `reversed` call around `sorted()`
C413.py:14:1: C413 [**] Unnecessary `reversed` call around `sorted()`
|
13 | # Regression test for: https://github.com/astral-sh/ruff/issues/7289
14 | reversed(sorted(i for i in range(42)))
@ -207,7 +207,7 @@ C413.py:14:1: C413 [*] Unnecessary `reversed` call around `sorted()`
16 16 |
17 17 |
C413.py:15:1: C413 [*] Unnecessary `reversed` call around `sorted()`
C413.py:15:1: C413 [**] Unnecessary `reversed` call around `sorted()`
|
13 | # Regression test for: https://github.com/astral-sh/ruff/issues/7289
14 | reversed(sorted(i for i in range(42)))

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs
---
C414.py:2:1: C414 [*] Unnecessary `list` call within `list()`
C414.py:2:1: C414 [**] Unnecessary `list` call within `list()`
|
1 | x = [1, 2, 3]
2 | list(list(x))
@ -19,7 +19,7 @@ C414.py:2:1: C414 [*] Unnecessary `list` call within `list()`
4 4 | tuple(list(x))
5 5 | tuple(tuple(x))
C414.py:3:1: C414 [*] Unnecessary `tuple` call within `list()`
C414.py:3:1: C414 [**] Unnecessary `tuple` call within `list()`
|
1 | x = [1, 2, 3]
2 | list(list(x))
@ -39,7 +39,7 @@ C414.py:3:1: C414 [*] Unnecessary `tuple` call within `list()`
5 5 | tuple(tuple(x))
6 6 | set(set(x))
C414.py:4:1: C414 [*] Unnecessary `list` call within `tuple()`
C414.py:4:1: C414 [**] Unnecessary `list` call within `tuple()`
|
2 | list(list(x))
3 | list(tuple(x))
@ -60,7 +60,7 @@ C414.py:4:1: C414 [*] Unnecessary `list` call within `tuple()`
6 6 | set(set(x))
7 7 | set(list(x))
C414.py:5:1: C414 [*] Unnecessary `tuple` call within `tuple()`
C414.py:5:1: C414 [**] Unnecessary `tuple` call within `tuple()`
|
3 | list(tuple(x))
4 | tuple(list(x))
@ -81,7 +81,7 @@ C414.py:5:1: C414 [*] Unnecessary `tuple` call within `tuple()`
7 7 | set(list(x))
8 8 | set(tuple(x))
C414.py:6:1: C414 [*] Unnecessary `set` call within `set()`
C414.py:6:1: C414 [**] Unnecessary `set` call within `set()`
|
4 | tuple(list(x))
5 | tuple(tuple(x))
@ -102,7 +102,7 @@ C414.py:6:1: C414 [*] Unnecessary `set` call within `set()`
8 8 | set(tuple(x))
9 9 | set(sorted(x))
C414.py:7:1: C414 [*] Unnecessary `list` call within `set()`
C414.py:7:1: C414 [**] Unnecessary `list` call within `set()`
|
5 | tuple(tuple(x))
6 | set(set(x))
@ -123,7 +123,7 @@ C414.py:7:1: C414 [*] Unnecessary `list` call within `set()`
9 9 | set(sorted(x))
10 10 | set(sorted(x, key=lambda y: y))
C414.py:8:1: C414 [*] Unnecessary `tuple` call within `set()`
C414.py:8:1: C414 [**] Unnecessary `tuple` call within `set()`
|
6 | set(set(x))
7 | set(list(x))
@ -144,7 +144,7 @@ C414.py:8:1: C414 [*] Unnecessary `tuple` call within `set()`
10 10 | set(sorted(x, key=lambda y: y))
11 11 | set(reversed(x))
C414.py:9:1: C414 [*] Unnecessary `sorted` call within `set()`
C414.py:9:1: C414 [**] Unnecessary `sorted` call within `set()`
|
7 | set(list(x))
8 | set(tuple(x))
@ -165,7 +165,7 @@ C414.py:9:1: C414 [*] Unnecessary `sorted` call within `set()`
11 11 | set(reversed(x))
12 12 | sorted(list(x))
C414.py:10:1: C414 [*] Unnecessary `sorted` call within `set()`
C414.py:10:1: C414 [**] Unnecessary `sorted` call within `set()`
|
8 | set(tuple(x))
9 | set(sorted(x))
@ -186,7 +186,7 @@ C414.py:10:1: C414 [*] Unnecessary `sorted` call within `set()`
12 12 | sorted(list(x))
13 13 | sorted(tuple(x))
C414.py:11:1: C414 [*] Unnecessary `reversed` call within `set()`
C414.py:11:1: C414 [**] Unnecessary `reversed` call within `set()`
|
9 | set(sorted(x))
10 | set(sorted(x, key=lambda y: y))
@ -207,7 +207,7 @@ C414.py:11:1: C414 [*] Unnecessary `reversed` call within `set()`
13 13 | sorted(tuple(x))
14 14 | sorted(sorted(x))
C414.py:12:1: C414 [*] Unnecessary `list` call within `sorted()`
C414.py:12:1: C414 [**] Unnecessary `list` call within `sorted()`
|
10 | set(sorted(x, key=lambda y: y))
11 | set(reversed(x))
@ -228,7 +228,7 @@ C414.py:12:1: C414 [*] Unnecessary `list` call within `sorted()`
14 14 | sorted(sorted(x))
15 15 | sorted(sorted(x, key=foo, reverse=False), reverse=False, key=foo)
C414.py:13:1: C414 [*] Unnecessary `tuple` call within `sorted()`
C414.py:13:1: C414 [**] Unnecessary `tuple` call within `sorted()`
|
11 | set(reversed(x))
12 | sorted(list(x))
@ -249,7 +249,7 @@ C414.py:13:1: C414 [*] Unnecessary `tuple` call within `sorted()`
15 15 | sorted(sorted(x, key=foo, reverse=False), reverse=False, key=foo)
16 16 | sorted(sorted(x, reverse=True), reverse=True)
C414.py:14:1: C414 [*] Unnecessary `sorted` call within `sorted()`
C414.py:14:1: C414 [**] Unnecessary `sorted` call within `sorted()`
|
12 | sorted(list(x))
13 | sorted(tuple(x))
@ -270,7 +270,7 @@ C414.py:14:1: C414 [*] Unnecessary `sorted` call within `sorted()`
16 16 | sorted(sorted(x, reverse=True), reverse=True)
17 17 | sorted(reversed(x))
C414.py:15:1: C414 [*] Unnecessary `sorted` call within `sorted()`
C414.py:15:1: C414 [**] Unnecessary `sorted` call within `sorted()`
|
13 | sorted(tuple(x))
14 | sorted(sorted(x))
@ -291,7 +291,7 @@ C414.py:15:1: C414 [*] Unnecessary `sorted` call within `sorted()`
17 17 | sorted(reversed(x))
18 18 | sorted(list(x), key=lambda y: y)
C414.py:16:1: C414 [*] Unnecessary `sorted` call within `sorted()`
C414.py:16:1: C414 [**] Unnecessary `sorted` call within `sorted()`
|
14 | sorted(sorted(x))
15 | sorted(sorted(x, key=foo, reverse=False), reverse=False, key=foo)
@ -312,7 +312,7 @@ C414.py:16:1: C414 [*] Unnecessary `sorted` call within `sorted()`
18 18 | sorted(list(x), key=lambda y: y)
19 19 | tuple(
C414.py:17:1: C414 [*] Unnecessary `reversed` call within `sorted()`
C414.py:17:1: C414 [**] Unnecessary `reversed` call within `sorted()`
|
15 | sorted(sorted(x, key=foo, reverse=False), reverse=False, key=foo)
16 | sorted(sorted(x, reverse=True), reverse=True)
@ -333,7 +333,7 @@ C414.py:17:1: C414 [*] Unnecessary `reversed` call within `sorted()`
19 19 | tuple(
20 20 | list(
C414.py:18:1: C414 [*] Unnecessary `list` call within `sorted()`
C414.py:18:1: C414 [**] Unnecessary `list` call within `sorted()`
|
16 | sorted(sorted(x, reverse=True), reverse=True)
17 | sorted(reversed(x))
@ -354,7 +354,7 @@ C414.py:18:1: C414 [*] Unnecessary `list` call within `sorted()`
20 20 | list(
21 21 | [x, 3, "hell"\
C414.py:19:1: C414 [*] Unnecessary `list` call within `tuple()`
C414.py:19:1: C414 [**] Unnecessary `list` call within `tuple()`
|
17 | sorted(reversed(x))
18 | sorted(list(x), key=lambda y: y)
@ -383,7 +383,7 @@ C414.py:19:1: C414 [*] Unnecessary `list` call within `tuple()`
25 23 | set(set())
26 24 | set(list())
C414.py:25:1: C414 [*] Unnecessary `set` call within `set()`
C414.py:25:1: C414 [**] Unnecessary `set` call within `set()`
|
23 | )
24 | )
@ -404,7 +404,7 @@ C414.py:25:1: C414 [*] Unnecessary `set` call within `set()`
27 27 | set(tuple())
28 28 | sorted(reversed())
C414.py:26:1: C414 [*] Unnecessary `list` call within `set()`
C414.py:26:1: C414 [**] Unnecessary `list` call within `set()`
|
24 | )
25 | set(set())
@ -425,7 +425,7 @@ C414.py:26:1: C414 [*] Unnecessary `list` call within `set()`
28 28 | sorted(reversed())
29 29 |
C414.py:27:1: C414 [*] Unnecessary `tuple` call within `set()`
C414.py:27:1: C414 [**] Unnecessary `tuple` call within `set()`
|
25 | set(set())
26 | set(list())
@ -445,7 +445,7 @@ C414.py:27:1: C414 [*] Unnecessary `tuple` call within `set()`
29 29 |
30 30 | # Nested sorts with differing keyword arguments. Not flagged.
C414.py:28:1: C414 [*] Unnecessary `reversed` call within `sorted()`
C414.py:28:1: C414 [**] Unnecessary `reversed` call within `sorted()`
|
26 | set(list())
27 | set(tuple())
@ -466,7 +466,7 @@ C414.py:28:1: C414 [*] Unnecessary `reversed` call within `sorted()`
30 30 | # Nested sorts with differing keyword arguments. Not flagged.
31 31 | sorted(sorted(x, key=lambda y: y))
C414.py:37:27: C414 [*] Unnecessary `list` call within `sorted()`
C414.py:37:27: C414 [**] Unnecessary `list` call within `sorted()`
|
36 | # Preserve trailing comments.
37 | xxxxxxxxxxx_xxxxx_xxxxx = sorted(
@ -492,7 +492,7 @@ C414.py:37:27: C414 [*] Unnecessary `list` call within `sorted()`
40 40 | # xx xxxx xxxxxxx xxxx xxx xxxxxxxx Nxxx
41 41 | key=lambda xxxxx: xxxxx or "",
C414.py:44:27: C414 [*] Unnecessary `list` call within `sorted()`
C414.py:44:27: C414 [**] Unnecessary `list` call within `sorted()`
|
42 | )
43 |

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs
---
C416.py:6:1: C416 [*] Unnecessary `list` comprehension (rewrite using `list()`)
C416.py:6:1: C416 [**] Unnecessary `list` comprehension (rewrite using `list()`)
|
4 | d = {"a": 1, "b": 2, "c": 3}
5 |
@ -22,7 +22,7 @@ C416.py:6:1: C416 [*] Unnecessary `list` comprehension (rewrite using `list()`)
8 8 | {k: v for k, v in y}
9 9 | {k: v for k, v in d.items()}
C416.py:7:1: C416 [*] Unnecessary `set` comprehension (rewrite using `set()`)
C416.py:7:1: C416 [**] Unnecessary `set` comprehension (rewrite using `set()`)
|
6 | [i for i in x]
7 | {i for i in x}
@ -42,7 +42,7 @@ C416.py:7:1: C416 [*] Unnecessary `set` comprehension (rewrite using `set()`)
9 9 | {k: v for k, v in d.items()}
10 10 | [(k, v) for k, v in d.items()]
C416.py:8:1: C416 [*] Unnecessary `dict` comprehension (rewrite using `dict()`)
C416.py:8:1: C416 [**] Unnecessary `dict` comprehension (rewrite using `dict()`)
|
6 | [i for i in x]
7 | {i for i in x}
@ -63,7 +63,7 @@ C416.py:8:1: C416 [*] Unnecessary `dict` comprehension (rewrite using `dict()`)
10 10 | [(k, v) for k, v in d.items()]
11 11 | {k: (a, b) for k, (a, b) in d.items()}
C416.py:9:1: C416 [*] Unnecessary `dict` comprehension (rewrite using `dict()`)
C416.py:9:1: C416 [**] Unnecessary `dict` comprehension (rewrite using `dict()`)
|
7 | {i for i in x}
8 | {k: v for k, v in y}
@ -84,7 +84,7 @@ C416.py:9:1: C416 [*] Unnecessary `dict` comprehension (rewrite using `dict()`)
11 11 | {k: (a, b) for k, (a, b) in d.items()}
12 12 |
C416.py:10:1: C416 [*] Unnecessary `list` comprehension (rewrite using `list()`)
C416.py:10:1: C416 [**] Unnecessary `list` comprehension (rewrite using `list()`)
|
8 | {k: v for k, v in y}
9 | {k: v for k, v in d.items()}
@ -104,7 +104,7 @@ C416.py:10:1: C416 [*] Unnecessary `list` comprehension (rewrite using `list()`)
12 12 |
13 13 | [i for i, in z]
C416.py:11:1: C416 [*] Unnecessary `dict` comprehension (rewrite using `dict()`)
C416.py:11:1: C416 [**] Unnecessary `dict` comprehension (rewrite using `dict()`)
|
9 | {k: v for k, v in d.items()}
10 | [(k, v) for k, v in d.items()]
@ -125,7 +125,7 @@ C416.py:11:1: C416 [*] Unnecessary `dict` comprehension (rewrite using `dict()`)
13 13 | [i for i, in z]
14 14 | [i for i, j in y]
C416.py:24:70: C416 [*] Unnecessary `list` comprehension (rewrite using `list()`)
C416.py:24:70: C416 [**] Unnecessary `list` comprehension (rewrite using `list()`)
|
23 | # Regression test for: https://github.com/astral-sh/ruff/issues/7196
24 | any(len(symbol_table.get_by_type(symbol_type)) > 0 for symbol_type in[t for t in SymbolType])

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs
---
C417.py:3:1: C417 [*] Unnecessary `map` usage (rewrite using a generator expression)
C417.py:3:1: C417 [**] Unnecessary `map` usage (rewrite using a generator expression)
|
1 | # Errors.
2 | nums = [1, 2, 3]
@ -21,7 +21,7 @@ C417.py:3:1: C417 [*] Unnecessary `map` usage (rewrite using a generator express
5 5 | list(map(lambda x: x * 2, nums))
6 6 | set(map(lambda x: x % 2 == 0, nums))
C417.py:4:1: C417 [*] Unnecessary `map` usage (rewrite using a generator expression)
C417.py:4:1: C417 [**] Unnecessary `map` usage (rewrite using a generator expression)
|
2 | nums = [1, 2, 3]
3 | map(lambda x: x + 1, nums)
@ -42,7 +42,7 @@ C417.py:4:1: C417 [*] Unnecessary `map` usage (rewrite using a generator express
6 6 | set(map(lambda x: x % 2 == 0, nums))
7 7 | dict(map(lambda v: (v, v**2), nums))
C417.py:5:1: C417 [*] Unnecessary `map` usage (rewrite using a `list` comprehension)
C417.py:5:1: C417 [**] Unnecessary `map` usage (rewrite using a `list` comprehension)
|
3 | map(lambda x: x + 1, nums)
4 | map(lambda x: str(x), nums)
@ -63,7 +63,7 @@ C417.py:5:1: C417 [*] Unnecessary `map` usage (rewrite using a `list` comprehens
7 7 | dict(map(lambda v: (v, v**2), nums))
8 8 | dict(map(lambda v: [v, v**2], nums))
C417.py:6:1: C417 [*] Unnecessary `map` usage (rewrite using a `set` comprehension)
C417.py:6:1: C417 [**] Unnecessary `map` usage (rewrite using a `set` comprehension)
|
4 | map(lambda x: str(x), nums)
5 | list(map(lambda x: x * 2, nums))
@ -84,7 +84,7 @@ C417.py:6:1: C417 [*] Unnecessary `map` usage (rewrite using a `set` comprehensi
8 8 | dict(map(lambda v: [v, v**2], nums))
9 9 | map(lambda: "const", nums)
C417.py:7:1: C417 [*] Unnecessary `map` usage (rewrite using a `dict` comprehension)
C417.py:7:1: C417 [**] Unnecessary `map` usage (rewrite using a `dict` comprehension)
|
5 | list(map(lambda x: x * 2, nums))
6 | set(map(lambda x: x % 2 == 0, nums))
@ -105,7 +105,7 @@ C417.py:7:1: C417 [*] Unnecessary `map` usage (rewrite using a `dict` comprehens
9 9 | map(lambda: "const", nums)
10 10 | map(lambda _: 3.0, nums)
C417.py:8:1: C417 [*] Unnecessary `map` usage (rewrite using a `dict` comprehension)
C417.py:8:1: C417 [**] Unnecessary `map` usage (rewrite using a `dict` comprehension)
|
6 | set(map(lambda x: x % 2 == 0, nums))
7 | dict(map(lambda v: (v, v**2), nums))
@ -126,7 +126,7 @@ C417.py:8:1: C417 [*] Unnecessary `map` usage (rewrite using a `dict` comprehens
10 10 | map(lambda _: 3.0, nums)
11 11 | _ = "".join(map(lambda x: x in nums and "1" or "0", range(123)))
C417.py:9:1: C417 [*] Unnecessary `map` usage (rewrite using a generator expression)
C417.py:9:1: C417 [**] Unnecessary `map` usage (rewrite using a generator expression)
|
7 | dict(map(lambda v: (v, v**2), nums))
8 | dict(map(lambda v: [v, v**2], nums))
@ -147,7 +147,7 @@ C417.py:9:1: C417 [*] Unnecessary `map` usage (rewrite using a generator express
11 11 | _ = "".join(map(lambda x: x in nums and "1" or "0", range(123)))
12 12 | all(map(lambda v: isinstance(v, dict), nums))
C417.py:10:1: C417 [*] Unnecessary `map` usage (rewrite using a generator expression)
C417.py:10:1: C417 [**] Unnecessary `map` usage (rewrite using a generator expression)
|
8 | dict(map(lambda v: [v, v**2], nums))
9 | map(lambda: "const", nums)
@ -168,7 +168,7 @@ C417.py:10:1: C417 [*] Unnecessary `map` usage (rewrite using a generator expres
12 12 | all(map(lambda v: isinstance(v, dict), nums))
13 13 | filter(func, map(lambda v: v, nums))
C417.py:11:13: C417 [*] Unnecessary `map` usage (rewrite using a generator expression)
C417.py:11:13: C417 [**] Unnecessary `map` usage (rewrite using a generator expression)
|
9 | map(lambda: "const", nums)
10 | map(lambda _: 3.0, nums)
@ -189,7 +189,7 @@ C417.py:11:13: C417 [*] Unnecessary `map` usage (rewrite using a generator expre
13 13 | filter(func, map(lambda v: v, nums))
14 14 | list(map(lambda x, y: x * y, nums))
C417.py:12:5: C417 [*] Unnecessary `map` usage (rewrite using a generator expression)
C417.py:12:5: C417 [**] Unnecessary `map` usage (rewrite using a generator expression)
|
10 | map(lambda _: 3.0, nums)
11 | _ = "".join(map(lambda x: x in nums and "1" or "0", range(123)))
@ -210,7 +210,7 @@ C417.py:12:5: C417 [*] Unnecessary `map` usage (rewrite using a generator expres
14 14 | list(map(lambda x, y: x * y, nums))
15 15 |
C417.py:13:14: C417 [*] Unnecessary `map` usage (rewrite using a generator expression)
C417.py:13:14: C417 [**] Unnecessary `map` usage (rewrite using a generator expression)
|
11 | _ = "".join(map(lambda x: x in nums and "1" or "0", range(123)))
12 | all(map(lambda v: isinstance(v, dict), nums))
@ -230,7 +230,7 @@ C417.py:13:14: C417 [*] Unnecessary `map` usage (rewrite using a generator expre
15 15 |
16 16 | # When inside f-string, then the fix should be surrounded by whitespace
C417.py:14:1: C417 [*] Unnecessary `map` usage (rewrite using a `list` comprehension)
C417.py:14:1: C417 [**] Unnecessary `map` usage (rewrite using a `list` comprehension)
|
12 | all(map(lambda v: isinstance(v, dict), nums))
13 | filter(func, map(lambda v: v, nums))
@ -251,7 +251,7 @@ C417.py:14:1: C417 [*] Unnecessary `map` usage (rewrite using a `list` comprehen
16 16 | # When inside f-string, then the fix should be surrounded by whitespace
17 17 | _ = f"{set(map(lambda x: x % 2 == 0, nums))}"
C417.py:17:8: C417 [*] Unnecessary `map` usage (rewrite using a `set` comprehension)
C417.py:17:8: C417 [**] Unnecessary `map` usage (rewrite using a `set` comprehension)
|
16 | # When inside f-string, then the fix should be surrounded by whitespace
17 | _ = f"{set(map(lambda x: x % 2 == 0, nums))}"
@ -270,7 +270,7 @@ C417.py:17:8: C417 [*] Unnecessary `map` usage (rewrite using a `set` comprehens
19 19 |
20 20 | # False negatives.
C417.py:18:8: C417 [*] Unnecessary `map` usage (rewrite using a `dict` comprehension)
C417.py:18:8: C417 [**] Unnecessary `map` usage (rewrite using a `dict` comprehension)
|
16 | # When inside f-string, then the fix should be surrounded by whitespace
17 | _ = f"{set(map(lambda x: x % 2 == 0, nums))}"
@ -291,7 +291,7 @@ C417.py:18:8: C417 [*] Unnecessary `map` usage (rewrite using a `dict` comprehen
20 20 | # False negatives.
21 21 | map(lambda x=2, y=1: x + y, nums, nums)
C417.py:36:1: C417 [*] Unnecessary `map` usage (rewrite using a generator expression)
C417.py:36:1: C417 [**] Unnecessary `map` usage (rewrite using a generator expression)
|
35 | # Error: the `x` is overridden by the inner lambda.
36 | map(lambda x: lambda x: x, range(4))
@ -311,7 +311,7 @@ C417.py:36:1: C417 [*] Unnecessary `map` usage (rewrite using a generator expres
38 38 | # Ok because of the default parameters, and variadic arguments.
39 39 | map(lambda x=1: x, nums)
C417.py:47:1: C417 [*] Unnecessary `map` usage (rewrite using a generator expression)
C417.py:47:1: C417 [**] Unnecessary `map` usage (rewrite using a generator expression)
|
46 | # Regression test for: https://github.com/astral-sh/ruff/issues/7121
47 | map(lambda x: x, y if y else z)
@ -330,7 +330,7 @@ C417.py:47:1: C417 [*] Unnecessary `map` usage (rewrite using a generator expres
48 48 | map(lambda x: x, (y if y else z))
49 49 | map(lambda x: x, (x, y, z))
C417.py:48:1: C417 [*] Unnecessary `map` usage (rewrite using a generator expression)
C417.py:48:1: C417 [**] Unnecessary `map` usage (rewrite using a generator expression)
|
46 | # Regression test for: https://github.com/astral-sh/ruff/issues/7121
47 | map(lambda x: x, y if y else z)
@ -348,7 +348,7 @@ C417.py:48:1: C417 [*] Unnecessary `map` usage (rewrite using a generator expres
48 |+(x for x in (y if y else z))
49 49 | map(lambda x: x, (x, y, z))
C417.py:49:1: C417 [*] Unnecessary `map` usage (rewrite using a generator expression)
C417.py:49:1: C417 [**] Unnecessary `map` usage (rewrite using a generator expression)
|
47 | map(lambda x: x, y if y else z)
48 | map(lambda x: x, (y if y else z))

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs
---
C418.py:1:1: C418 [*] Unnecessary `dict` literal passed to `dict()` (remove the outer call to `dict()`)
C418.py:1:1: C418 [**] Unnecessary `dict` literal passed to `dict()` (remove the outer call to `dict()`)
|
1 | dict({})
| ^^^^^^^^ C418
@ -17,7 +17,7 @@ C418.py:1:1: C418 [*] Unnecessary `dict` literal passed to `dict()` (remove the
3 3 | dict({'x': 1 for x in range(10)})
4 4 | dict(
C418.py:2:1: C418 [*] Unnecessary `dict` literal passed to `dict()` (remove the outer call to `dict()`)
C418.py:2:1: C418 [**] Unnecessary `dict` literal passed to `dict()` (remove the outer call to `dict()`)
|
1 | dict({})
2 | dict({'a': 1})
@ -35,7 +35,7 @@ C418.py:2:1: C418 [*] Unnecessary `dict` literal passed to `dict()` (remove the
4 4 | dict(
5 5 | {'x': 1 for x in range(10)}
C418.py:3:1: C418 [*] Unnecessary `dict` comprehension passed to `dict()` (remove the outer call to `dict()`)
C418.py:3:1: C418 [**] Unnecessary `dict` comprehension passed to `dict()` (remove the outer call to `dict()`)
|
1 | dict({})
2 | dict({'a': 1})
@ -55,7 +55,7 @@ C418.py:3:1: C418 [*] Unnecessary `dict` comprehension passed to `dict()` (remov
5 5 | {'x': 1 for x in range(10)}
6 6 | )
C418.py:4:1: C418 [*] Unnecessary `dict` comprehension passed to `dict()` (remove the outer call to `dict()`)
C418.py:4:1: C418 [**] Unnecessary `dict` comprehension passed to `dict()` (remove the outer call to `dict()`)
|
2 | dict({'a': 1})
3 | dict({'x': 1 for x in range(10)})

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs
---
C419.py:1:5: C419 [*] Unnecessary list comprehension.
C419.py:1:5: C419 [**] Unnecessary list comprehension.
|
1 | any([x.id for x in bar])
| ^^^^^^^^^^^^^^^^^^^ C419
@ -17,7 +17,7 @@ C419.py:1:5: C419 [*] Unnecessary list comprehension.
3 3 | any( # first comment
4 4 | [x.id for x in bar], # second comment
C419.py:2:5: C419 [*] Unnecessary list comprehension.
C419.py:2:5: C419 [**] Unnecessary list comprehension.
|
1 | any([x.id for x in bar])
2 | all([x.id for x in bar])
@ -35,7 +35,7 @@ C419.py:2:5: C419 [*] Unnecessary list comprehension.
4 4 | [x.id for x in bar], # second comment
5 5 | ) # third comment
C419.py:4:5: C419 [*] Unnecessary list comprehension.
C419.py:4:5: C419 [**] Unnecessary list comprehension.
|
2 | all([x.id for x in bar])
3 | any( # first comment
@ -56,7 +56,7 @@ C419.py:4:5: C419 [*] Unnecessary list comprehension.
6 6 | all( # first comment
7 7 | [x.id for x in bar], # second comment
C419.py:7:5: C419 [*] Unnecessary list comprehension.
C419.py:7:5: C419 [**] Unnecessary list comprehension.
|
5 | ) # third comment
6 | all( # first comment
@ -77,7 +77,7 @@ C419.py:7:5: C419 [*] Unnecessary list comprehension.
9 9 | any({x.id for x in bar})
10 10 |
C419.py:9:5: C419 [*] Unnecessary list comprehension.
C419.py:9:5: C419 [**] Unnecessary list comprehension.
|
7 | [x.id for x in bar], # second comment
8 | ) # third comment
@ -98,7 +98,7 @@ C419.py:9:5: C419 [*] Unnecessary list comprehension.
11 11 | # OK
12 12 | all(x.id for x in bar)
C419.py:24:5: C419 [*] Unnecessary list comprehension.
C419.py:24:5: C419 [**] Unnecessary list comprehension.
|
22 | # Special comment handling
23 | any(
@ -133,7 +133,7 @@ C419.py:24:5: C419 [*] Unnecessary list comprehension.
31 30 | )
32 31 |
C419.py:35:5: C419 [*] Unnecessary list comprehension.
C419.py:35:5: C419 [**] Unnecessary list comprehension.
|
33 | # Weird case where the function call, opening bracket, and comment are all
34 | # on the same line.

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_errmsg/mod.rs
---
EM.py:5:24: EM101 [*] Exception must not use a string literal, assign to variable first
EM.py:5:24: EM101 [**] Exception must not use a string literal, assign to variable first
|
4 | def f_a():
5 | raise RuntimeError("This is an example exception")
@ -20,7 +20,7 @@ EM.py:5:24: EM101 [*] Exception must not use a string literal, assign to variabl
7 8 |
8 9 | def f_a_short():
EM.py:18:24: EM102 [*] Exception must not use an f-string literal, assign to variable first
EM.py:18:24: EM102 [**] Exception must not use an f-string literal, assign to variable first
|
16 | def f_b():
17 | example = "example"
@ -40,7 +40,7 @@ EM.py:18:24: EM102 [*] Exception must not use an f-string literal, assign to var
20 21 |
21 22 | def f_c():
EM.py:22:24: EM103 [*] Exception must not use a `.format()` string directly, assign to variable first
EM.py:22:24: EM103 [**] Exception must not use a `.format()` string directly, assign to variable first
|
21 | def f_c():
22 | raise RuntimeError("This is an {example} exception".format(example="example"))
@ -68,7 +68,7 @@ EM.py:32:24: EM101 Exception must not use a string literal, assign to variable f
|
= help: Assign to variable; remove string literal
EM.py:39:24: EM101 [*] Exception must not use a string literal, assign to variable first
EM.py:39:24: EM101 [**] Exception must not use a string literal, assign to variable first
|
37 | msg = "hello"
38 |
@ -96,7 +96,7 @@ EM.py:46:28: EM101 Exception must not use a string literal, assign to variable f
|
= help: Assign to variable; remove string literal
EM.py:51:28: EM101 [*] Exception must not use a string literal, assign to variable first
EM.py:51:28: EM101 [**] Exception must not use a string literal, assign to variable first
|
49 | def f_fix_indentation_check(foo):
50 | if foo:
@ -118,7 +118,7 @@ EM.py:51:28: EM101 [*] Exception must not use a string literal, assign to variab
53 54 | if foo == "foo":
54 55 | raise RuntimeError(f"This is an exception: {foo}")
EM.py:54:32: EM102 [*] Exception must not use an f-string literal, assign to variable first
EM.py:54:32: EM102 [**] Exception must not use an f-string literal, assign to variable first
|
52 | else:
53 | if foo == "foo":
@ -139,7 +139,7 @@ EM.py:54:32: EM102 [*] Exception must not use an f-string literal, assign to var
56 57 |
57 58 |
EM.py:55:24: EM103 [*] Exception must not use a `.format()` string directly, assign to variable first
EM.py:55:24: EM103 [**] Exception must not use a `.format()` string directly, assign to variable first
|
53 | if foo == "foo":
54 | raise RuntimeError(f"This is an exception: {foo}")

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_errmsg/mod.rs
---
EM.py:5:24: EM101 [*] Exception must not use a string literal, assign to variable first
EM.py:5:24: EM101 [**] Exception must not use a string literal, assign to variable first
|
4 | def f_a():
5 | raise RuntimeError("This is an example exception")
@ -20,7 +20,7 @@ EM.py:5:24: EM101 [*] Exception must not use a string literal, assign to variabl
7 8 |
8 9 | def f_a_short():
EM.py:9:24: EM101 [*] Exception must not use a string literal, assign to variable first
EM.py:9:24: EM101 [**] Exception must not use a string literal, assign to variable first
|
8 | def f_a_short():
9 | raise RuntimeError("Error")
@ -39,7 +39,7 @@ EM.py:9:24: EM101 [*] Exception must not use a string literal, assign to variabl
11 12 |
12 13 | def f_a_empty():
EM.py:13:24: EM101 [*] Exception must not use a string literal, assign to variable first
EM.py:13:24: EM101 [**] Exception must not use a string literal, assign to variable first
|
12 | def f_a_empty():
13 | raise RuntimeError("")
@ -58,7 +58,7 @@ EM.py:13:24: EM101 [*] Exception must not use a string literal, assign to variab
15 16 |
16 17 | def f_b():
EM.py:18:24: EM102 [*] Exception must not use an f-string literal, assign to variable first
EM.py:18:24: EM102 [**] Exception must not use an f-string literal, assign to variable first
|
16 | def f_b():
17 | example = "example"
@ -78,7 +78,7 @@ EM.py:18:24: EM102 [*] Exception must not use an f-string literal, assign to var
20 21 |
21 22 | def f_c():
EM.py:22:24: EM103 [*] Exception must not use a `.format()` string directly, assign to variable first
EM.py:22:24: EM103 [**] Exception must not use a `.format()` string directly, assign to variable first
|
21 | def f_c():
22 | raise RuntimeError("This is an {example} exception".format(example="example"))
@ -106,7 +106,7 @@ EM.py:32:24: EM101 Exception must not use a string literal, assign to variable f
|
= help: Assign to variable; remove string literal
EM.py:39:24: EM101 [*] Exception must not use a string literal, assign to variable first
EM.py:39:24: EM101 [**] Exception must not use a string literal, assign to variable first
|
37 | msg = "hello"
38 |
@ -134,7 +134,7 @@ EM.py:46:28: EM101 Exception must not use a string literal, assign to variable f
|
= help: Assign to variable; remove string literal
EM.py:51:28: EM101 [*] Exception must not use a string literal, assign to variable first
EM.py:51:28: EM101 [**] Exception must not use a string literal, assign to variable first
|
49 | def f_fix_indentation_check(foo):
50 | if foo:
@ -156,7 +156,7 @@ EM.py:51:28: EM101 [*] Exception must not use a string literal, assign to variab
53 54 | if foo == "foo":
54 55 | raise RuntimeError(f"This is an exception: {foo}")
EM.py:54:32: EM102 [*] Exception must not use an f-string literal, assign to variable first
EM.py:54:32: EM102 [**] Exception must not use an f-string literal, assign to variable first
|
52 | else:
53 | if foo == "foo":
@ -177,7 +177,7 @@ EM.py:54:32: EM102 [*] Exception must not use an f-string literal, assign to var
56 57 |
57 58 |
EM.py:55:24: EM103 [*] Exception must not use a `.format()` string directly, assign to variable first
EM.py:55:24: EM103 [**] Exception must not use a `.format()` string directly, assign to variable first
|
53 | if foo == "foo":
54 | raise RuntimeError(f"This is an exception: {foo}")

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_import_conventions/mod.rs
---
defaults.py:6:12: ICN001 [*] `altair` should be imported as `alt`
defaults.py:6:12: ICN001 [**] `altair` should be imported as `alt`
|
5 | def unconventional():
6 | import altair
@ -32,7 +32,7 @@ defaults.py:7:12: ICN001 `matplotlib.pyplot` should be imported as `plt`
|
= help: Alias `matplotlib.pyplot` to `plt`
defaults.py:8:12: ICN001 [*] `numpy` should be imported as `np`
defaults.py:8:12: ICN001 [**] `numpy` should be imported as `np`
|
6 | import altair
7 | import matplotlib.pyplot
@ -53,7 +53,7 @@ defaults.py:8:12: ICN001 [*] `numpy` should be imported as `np`
10 10 | import seaborn
11 11 | import tkinter
defaults.py:9:12: ICN001 [*] `pandas` should be imported as `pd`
defaults.py:9:12: ICN001 [**] `pandas` should be imported as `pd`
|
7 | import matplotlib.pyplot
8 | import numpy
@ -74,7 +74,7 @@ defaults.py:9:12: ICN001 [*] `pandas` should be imported as `pd`
11 11 | import tkinter
12 12 | import networkx
defaults.py:10:12: ICN001 [*] `seaborn` should be imported as `sns`
defaults.py:10:12: ICN001 [**] `seaborn` should be imported as `sns`
|
8 | import numpy
9 | import pandas
@ -95,7 +95,7 @@ defaults.py:10:12: ICN001 [*] `seaborn` should be imported as `sns`
12 12 | import networkx
13 13 |
defaults.py:11:12: ICN001 [*] `tkinter` should be imported as `tk`
defaults.py:11:12: ICN001 [**] `tkinter` should be imported as `tk`
|
9 | import pandas
10 | import seaborn
@ -115,7 +115,7 @@ defaults.py:11:12: ICN001 [*] `tkinter` should be imported as `tk`
13 13 |
14 14 |
defaults.py:12:12: ICN001 [*] `networkx` should be imported as `nx`
defaults.py:12:12: ICN001 [**] `networkx` should be imported as `nx`
|
10 | import seaborn
11 | import tkinter
@ -134,7 +134,7 @@ defaults.py:12:12: ICN001 [*] `networkx` should be imported as `nx`
14 14 |
15 15 | def unconventional_aliases():
defaults.py:16:22: ICN001 [*] `altair` should be imported as `alt`
defaults.py:16:22: ICN001 [**] `altair` should be imported as `alt`
|
15 | def unconventional_aliases():
16 | import altair as altr
@ -154,7 +154,7 @@ defaults.py:16:22: ICN001 [*] `altair` should be imported as `alt`
18 18 | import numpy as nmp
19 19 | import pandas as pdas
defaults.py:17:33: ICN001 [*] `matplotlib.pyplot` should be imported as `plt`
defaults.py:17:33: ICN001 [**] `matplotlib.pyplot` should be imported as `plt`
|
15 | def unconventional_aliases():
16 | import altair as altr
@ -175,7 +175,7 @@ defaults.py:17:33: ICN001 [*] `matplotlib.pyplot` should be imported as `plt`
19 19 | import pandas as pdas
20 20 | import seaborn as sbrn
defaults.py:18:21: ICN001 [*] `numpy` should be imported as `np`
defaults.py:18:21: ICN001 [**] `numpy` should be imported as `np`
|
16 | import altair as altr
17 | import matplotlib.pyplot as plot
@ -196,7 +196,7 @@ defaults.py:18:21: ICN001 [*] `numpy` should be imported as `np`
20 20 | import seaborn as sbrn
21 21 | import tkinter as tkr
defaults.py:19:22: ICN001 [*] `pandas` should be imported as `pd`
defaults.py:19:22: ICN001 [**] `pandas` should be imported as `pd`
|
17 | import matplotlib.pyplot as plot
18 | import numpy as nmp
@ -217,7 +217,7 @@ defaults.py:19:22: ICN001 [*] `pandas` should be imported as `pd`
21 21 | import tkinter as tkr
22 22 | import networkx as nxy
defaults.py:20:23: ICN001 [*] `seaborn` should be imported as `sns`
defaults.py:20:23: ICN001 [**] `seaborn` should be imported as `sns`
|
18 | import numpy as nmp
19 | import pandas as pdas
@ -238,7 +238,7 @@ defaults.py:20:23: ICN001 [*] `seaborn` should be imported as `sns`
22 22 | import networkx as nxy
23 23 |
defaults.py:21:23: ICN001 [*] `tkinter` should be imported as `tk`
defaults.py:21:23: ICN001 [**] `tkinter` should be imported as `tk`
|
19 | import pandas as pdas
20 | import seaborn as sbrn
@ -258,7 +258,7 @@ defaults.py:21:23: ICN001 [*] `tkinter` should be imported as `tk`
23 23 |
24 24 | def conventional_aliases():
defaults.py:22:24: ICN001 [*] `networkx` should be imported as `nx`
defaults.py:22:24: ICN001 [**] `networkx` should be imported as `nx`
|
20 | import seaborn as sbrn
21 | import tkinter as tkr

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_import_conventions/mod.rs
---
tricky.py:7:16: ICN001 [*] `pandas` should be imported as `pd`
tricky.py:7:16: ICN001 [**] `pandas` should be imported as `pd`
|
5 | try:
6 | global pandas

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_logging/mod.rs
---
LOG001.py:3:1: LOG001 [*] Use `logging.getLogger()` to instantiate loggers
LOG001.py:3:1: LOG001 [**] Use `logging.getLogger()` to instantiate loggers
|
1 | import logging
2 |
@ -20,7 +20,7 @@ LOG001.py:3:1: LOG001 [*] Use `logging.getLogger()` to instantiate loggers
4 4 | logging.Logger()
5 5 | logging.getLogger(__name__)
LOG001.py:4:1: LOG001 [*] Use `logging.getLogger()` to instantiate loggers
LOG001.py:4:1: LOG001 [**] Use `logging.getLogger()` to instantiate loggers
|
3 | logging.Logger(__name__)
4 | logging.Logger()

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_logging/mod.rs
---
LOG002.py:11:11: LOG002 [*] Use `__name__` with `logging.getLogger()`
LOG002.py:11:11: LOG002 [**] Use `__name__` with `logging.getLogger()`
|
10 | # LOG002
11 | getLogger(__file__)
@ -20,7 +20,7 @@ LOG002.py:11:11: LOG002 [*] Use `__name__` with `logging.getLogger()`
13 13 |
14 14 | logging.getLogger(__cached__)
LOG002.py:12:24: LOG002 [*] Use `__name__` with `logging.getLogger()`
LOG002.py:12:24: LOG002 [**] Use `__name__` with `logging.getLogger()`
|
10 | # LOG002
11 | getLogger(__file__)
@ -41,7 +41,7 @@ LOG002.py:12:24: LOG002 [*] Use `__name__` with `logging.getLogger()`
14 14 | logging.getLogger(__cached__)
15 15 | getLogger(name=__cached__)
LOG002.py:14:19: LOG002 [*] Use `__name__` with `logging.getLogger()`
LOG002.py:14:19: LOG002 [**] Use `__name__` with `logging.getLogger()`
|
12 | logging.getLogger(name=__file__)
13 |
@ -61,7 +61,7 @@ LOG002.py:14:19: LOG002 [*] Use `__name__` with `logging.getLogger()`
16 16 |
17 17 |
LOG002.py:15:16: LOG002 [*] Use `__name__` with `logging.getLogger()`
LOG002.py:15:16: LOG002 [**] Use `__name__` with `logging.getLogger()`
|
14 | logging.getLogger(__cached__)
15 | getLogger(name=__cached__)

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_logging/mod.rs
---
LOG009.py:3:1: LOG009 [*] Use of undocumented `logging.WARN` constant
LOG009.py:3:1: LOG009 [**] Use of undocumented `logging.WARN` constant
|
1 | import logging
2 |
@ -20,7 +20,7 @@ LOG009.py:3:1: LOG009 [*] Use of undocumented `logging.WARN` constant
5 5 |
6 6 | from logging import WARN, WARNING
LOG009.py:8:1: LOG009 [*] Use of undocumented `logging.WARN` constant
LOG009.py:8:1: LOG009 [**] Use of undocumented `logging.WARN` constant
|
6 | from logging import WARN, WARNING
7 |

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_pie/mod.rs
---
PIE794.py:4:5: PIE794 [*] Class field `name` is defined multiple times
PIE794.py:4:5: PIE794 [**] Class field `name` is defined multiple times
|
2 | name = StringField()
3 | # ....
@ -21,7 +21,7 @@ PIE794.py:4:5: PIE794 [*] Class field `name` is defined multiple times
6 5 | def remove(self) -> None:
7 6 | ...
PIE794.py:13:5: PIE794 [*] Class field `name` is defined multiple times
PIE794.py:13:5: PIE794 [**] Class field `name` is defined multiple times
|
11 | name: str = StringField()
12 | # ....
@ -41,7 +41,7 @@ PIE794.py:13:5: PIE794 [*] Class field `name` is defined multiple times
15 14 | def foo(self) -> None:
16 15 | ...
PIE794.py:23:5: PIE794 [*] Class field `bar` is defined multiple times
PIE794.py:23:5: PIE794 [**] Class field `bar` is defined multiple times
|
21 | foo: bool = BooleanField()
22 | # ...
@ -59,7 +59,7 @@ PIE794.py:23:5: PIE794 [*] Class field `bar` is defined multiple times
25 24 |
26 25 | class User(BaseModel):
PIE794.py:40:5: PIE794 [*] Class field `bar` is defined multiple times
PIE794.py:40:5: PIE794 [**] Class field `bar` is defined multiple times
|
38 | foo: bool = BooleanField()
39 | # ...

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_pie/mod.rs
---
PIE810.py:2:1: PIE810 [*] Call `startswith` once with a `tuple`
PIE810.py:2:1: PIE810 [**] Call `startswith` once with a `tuple`
|
1 | # error
2 | obj.startswith("foo") or obj.startswith("bar")
@ -19,7 +19,7 @@ PIE810.py:2:1: PIE810 [*] Call `startswith` once with a `tuple`
4 4 | obj.endswith("foo") or obj.endswith("bar")
5 5 | # error
PIE810.py:4:1: PIE810 [*] Call `endswith` once with a `tuple`
PIE810.py:4:1: PIE810 [**] Call `endswith` once with a `tuple`
|
2 | obj.startswith("foo") or obj.startswith("bar")
3 | # error
@ -40,7 +40,7 @@ PIE810.py:4:1: PIE810 [*] Call `endswith` once with a `tuple`
6 6 | obj.startswith(foo) or obj.startswith(bar)
7 7 | # error
PIE810.py:6:1: PIE810 [*] Call `startswith` once with a `tuple`
PIE810.py:6:1: PIE810 [**] Call `startswith` once with a `tuple`
|
4 | obj.endswith("foo") or obj.endswith("bar")
5 | # error
@ -61,7 +61,7 @@ PIE810.py:6:1: PIE810 [*] Call `startswith` once with a `tuple`
8 8 | obj.startswith(foo) or obj.startswith("foo")
9 9 | # error
PIE810.py:8:1: PIE810 [*] Call `startswith` once with a `tuple`
PIE810.py:8:1: PIE810 [**] Call `startswith` once with a `tuple`
|
6 | obj.startswith(foo) or obj.startswith(bar)
7 | # error
@ -82,7 +82,7 @@ PIE810.py:8:1: PIE810 [*] Call `startswith` once with a `tuple`
10 10 | obj.endswith(foo) or obj.startswith(foo) or obj.startswith("foo")
11 11 |
PIE810.py:10:1: PIE810 [*] Call `startswith` once with a `tuple`
PIE810.py:10:1: PIE810 [**] Call `startswith` once with a `tuple`
|
8 | obj.startswith(foo) or obj.startswith("foo")
9 | # error

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs
---
PYI010.pyi:6:5: PYI010 [*] Function body must contain only `...`
PYI010.pyi:6:5: PYI010 [**] Function body must contain only `...`
|
5 | def buzz():
6 | print("buzz") # ERROR PYI010
@ -21,7 +21,7 @@ PYI010.pyi:6:5: PYI010 [*] Function body must contain only `...`
8 8 | def foo2():
9 9 | 123 # ERROR PYI010
PYI010.pyi:9:5: PYI010 [*] Function body must contain only `...`
PYI010.pyi:9:5: PYI010 [**] Function body must contain only `...`
|
8 | def foo2():
9 | 123 # ERROR PYI010
@ -41,7 +41,7 @@ PYI010.pyi:9:5: PYI010 [*] Function body must contain only `...`
11 11 | def bizz():
12 12 | x = 123 # ERROR PYI010
PYI010.pyi:12:5: PYI010 [*] Function body must contain only `...`
PYI010.pyi:12:5: PYI010 [**] Function body must contain only `...`
|
11 | def bizz():
12 | x = 123 # ERROR PYI010

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs
---
PYI011.pyi:10:14: PYI011 [*] Only simple default values allowed for typed arguments
PYI011.pyi:10:14: PYI011 [**] Only simple default values allowed for typed arguments
|
8 | def f12(
9 | x,
@ -22,7 +22,7 @@ PYI011.pyi:10:14: PYI011 [*] Only simple default values allowed for typed argume
12 12 | def f11(*, x: str = "x") -> None: ... # OK
13 13 | def f13(
PYI011.pyi:38:9: PYI011 [*] Only simple default values allowed for typed arguments
PYI011.pyi:38:9: PYI011 [**] Only simple default values allowed for typed arguments
|
36 | x: dict[
37 | int, int
@ -50,7 +50,7 @@ PYI011.pyi:38:9: PYI011 [*] Only simple default values allowed for typed argumen
43 40 | def f153(
44 41 | x: list[
PYI011.pyi:46:9: PYI011 [*] Only simple default values allowed for typed arguments
PYI011.pyi:46:9: PYI011 [**] Only simple default values allowed for typed arguments
|
44 | x: list[
45 | int
@ -96,7 +96,7 @@ PYI011.pyi:46:9: PYI011 [*] Only simple default values allowed for typed argumen
60 48 | def f154(
61 49 | x: tuple[
PYI011.pyi:63:9: PYI011 [*] Only simple default values allowed for typed arguments
PYI011.pyi:63:9: PYI011 [**] Only simple default values allowed for typed arguments
|
61 | x: tuple[
62 | str, tuple[str, ...]
@ -124,7 +124,7 @@ PYI011.pyi:63:9: PYI011 [*] Only simple default values allowed for typed argumen
68 65 | def f141(
69 66 | x: list[
PYI011.pyi:71:9: PYI011 [*] Only simple default values allowed for typed arguments
PYI011.pyi:71:9: PYI011 [**] Only simple default values allowed for typed arguments
|
69 | x: list[
70 | int
@ -150,7 +150,7 @@ PYI011.pyi:71:9: PYI011 [*] Only simple default values allowed for typed argumen
75 73 | def f142(
76 74 | x: list[
PYI011.pyi:78:9: PYI011 [*] Only simple default values allowed for typed arguments
PYI011.pyi:78:9: PYI011 [**] Only simple default values allowed for typed arguments
|
76 | x: list[
77 | int
@ -176,7 +176,7 @@ PYI011.pyi:78:9: PYI011 [*] Only simple default values allowed for typed argumen
82 80 | def f16(
83 81 | x: frozenset[
PYI011.pyi:85:9: PYI011 [*] Only simple default values allowed for typed arguments
PYI011.pyi:85:9: PYI011 [**] Only simple default values allowed for typed arguments
|
83 | x: frozenset[
84 | bytes
@ -202,7 +202,7 @@ PYI011.pyi:85:9: PYI011 [*] Only simple default values allowed for typed argumen
89 87 | def f17(
90 88 | x: str = "foo" # Error PYI011 Only simple default values allowed for typed arguments
PYI011.pyi:90:14: PYI011 [*] Only simple default values allowed for typed arguments
PYI011.pyi:90:14: PYI011 [**] Only simple default values allowed for typed arguments
|
88 | ) -> None: ...
89 | def f17(
@ -226,7 +226,7 @@ PYI011.pyi:90:14: PYI011 [*] Only simple default values allowed for typed argume
93 92 | def f18(
94 93 | x: str = b"foo" # Error PYI011 Only simple default values allowed for typed arguments
PYI011.pyi:94:14: PYI011 [*] Only simple default values allowed for typed arguments
PYI011.pyi:94:14: PYI011 [**] Only simple default values allowed for typed arguments
|
92 | ) -> None: ...
93 | def f18(
@ -250,7 +250,7 @@ PYI011.pyi:94:14: PYI011 [*] Only simple default values allowed for typed argume
97 96 | def f19(
98 97 | x: object = "foo" # Error PYI011 Only simple default values allowed for typed arguments
PYI011.pyi:98:17: PYI011 [*] Only simple default values allowed for typed arguments
PYI011.pyi:98:17: PYI011 [**] Only simple default values allowed for typed arguments
|
96 | ) -> None: ...
97 | def f19(
@ -274,7 +274,7 @@ PYI011.pyi:98:17: PYI011 [*] Only simple default values allowed for typed argume
101 100 | def f20(
102 101 | x: int = 5
PYI011.pyi:102:14: PYI011 [*] Only simple default values allowed for typed arguments
PYI011.pyi:102:14: PYI011 [**] Only simple default values allowed for typed arguments
|
100 | ) -> None: ...
101 | def f20(
@ -298,7 +298,7 @@ PYI011.pyi:102:14: PYI011 [*] Only simple default values allowed for typed argum
105 104 | def f21(
106 105 | x: complex = 3j
PYI011.pyi:106:18: PYI011 [*] Only simple default values allowed for typed arguments
PYI011.pyi:106:18: PYI011 [**] Only simple default values allowed for typed arguments
|
104 | ) -> None: ...
105 | def f21(
@ -322,7 +322,7 @@ PYI011.pyi:106:18: PYI011 [*] Only simple default values allowed for typed argum
109 108 | def f22(
110 109 | x: complex = -42.5j # Error PYI011 Only simple default values allowed for typed arguments
PYI011.pyi:110:18: PYI011 [*] Only simple default values allowed for typed arguments
PYI011.pyi:110:18: PYI011 [**] Only simple default values allowed for typed arguments
|
108 | ) -> None: ...
109 | def f22(
@ -346,7 +346,7 @@ PYI011.pyi:110:18: PYI011 [*] Only simple default values allowed for typed argum
113 112 | def f23(
114 113 | x: bool = True, # OK
PYI011.pyi:138:16: PYI011 [*] Only simple default values allowed for typed arguments
PYI011.pyi:138:16: PYI011 [**] Only simple default values allowed for typed arguments
|
136 | ) -> None: ...
137 | def f31(
@ -367,7 +367,7 @@ PYI011.pyi:138:16: PYI011 [*] Only simple default values allowed for typed argum
140 140 | def f32(
141 141 | x: float = np.inf, # Error PYI011 Only simple default values allowed for typed arguments
PYI011.pyi:141:16: PYI011 [*] Only simple default values allowed for typed arguments
PYI011.pyi:141:16: PYI011 [**] Only simple default values allowed for typed arguments
|
139 | ) -> None: ...
140 | def f32(
@ -388,7 +388,7 @@ PYI011.pyi:141:16: PYI011 [*] Only simple default values allowed for typed argum
143 143 | def f33(
144 144 | x: float = math.nan, # OK
PYI011.pyi:147:16: PYI011 [*] Only simple default values allowed for typed arguments
PYI011.pyi:147:16: PYI011 [**] Only simple default values allowed for typed arguments
|
145 | ) -> None: ...
146 | def f34(
@ -409,7 +409,7 @@ PYI011.pyi:147:16: PYI011 [*] Only simple default values allowed for typed argum
149 149 | def f35(
150 150 | x: complex = math.inf # Error PYI011 Only simple default values allowed for typed arguments
PYI011.pyi:150:18: PYI011 [*] Only simple default values allowed for typed arguments
PYI011.pyi:150:18: PYI011 [**] Only simple default values allowed for typed arguments
|
148 | ) -> None: ...
149 | def f35(
@ -433,7 +433,7 @@ PYI011.pyi:150:18: PYI011 [*] Only simple default values allowed for typed argum
153 152 | def f36(
154 153 | *,
PYI011.pyi:159:14: PYI011 [*] Only simple default values allowed for typed arguments
PYI011.pyi:159:14: PYI011 [**] Only simple default values allowed for typed arguments
|
157 | def f37(
158 | *,

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs
---
PYI014.pyi:3:7: PYI014 [*] Only simple default values allowed for arguments
PYI014.pyi:3:7: PYI014 [**] Only simple default values allowed for arguments
|
1 | def f12(
2 | x,
@ -21,7 +21,7 @@ PYI014.pyi:3:7: PYI014 [*] Only simple default values allowed for arguments
5 5 | def f11(*, x="x") -> None: ... # OK
6 6 | def f13(
PYI014.pyi:29:7: PYI014 [*] Only simple default values allowed for arguments
PYI014.pyi:29:7: PYI014 [**] Only simple default values allowed for arguments
|
27 | def f151(x={1: 2}) -> None: ...
28 | def f152(
@ -49,7 +49,7 @@ PYI014.pyi:29:7: PYI014 [*] Only simple default values allowed for arguments
34 31 | def f153(
35 32 | x=[ # Error PYI014
PYI014.pyi:35:7: PYI014 [*] Only simple default values allowed for arguments
PYI014.pyi:35:7: PYI014 [**] Only simple default values allowed for arguments
|
33 | ) -> None: ...
34 | def f153(
@ -95,7 +95,7 @@ PYI014.pyi:35:7: PYI014 [*] Only simple default values allowed for arguments
49 37 | def f154(
50 38 | x=( # Error PYI014
PYI014.pyi:50:7: PYI014 [*] Only simple default values allowed for arguments
PYI014.pyi:50:7: PYI014 [**] Only simple default values allowed for arguments
|
48 | ) -> None: ...
49 | def f154(
@ -123,7 +123,7 @@ PYI014.pyi:50:7: PYI014 [*] Only simple default values allowed for arguments
55 52 | def f141(
56 53 | x=[*range(10)], # Error PYI014
PYI014.pyi:56:7: PYI014 [*] Only simple default values allowed for arguments
PYI014.pyi:56:7: PYI014 [**] Only simple default values allowed for arguments
|
54 | ) -> None: ...
55 | def f141(
@ -144,7 +144,7 @@ PYI014.pyi:56:7: PYI014 [*] Only simple default values allowed for arguments
58 58 | def f142(
59 59 | x=list(range(10)), # Error PYI014
PYI014.pyi:59:7: PYI014 [*] Only simple default values allowed for arguments
PYI014.pyi:59:7: PYI014 [**] Only simple default values allowed for arguments
|
57 | ) -> None: ...
58 | def f142(
@ -165,7 +165,7 @@ PYI014.pyi:59:7: PYI014 [*] Only simple default values allowed for arguments
61 61 | def f16(x=frozenset({b"foo", b"bar", b"baz"})) -> None: ... # Error PYI014
62 62 | def f17(
PYI014.pyi:61:11: PYI014 [*] Only simple default values allowed for arguments
PYI014.pyi:61:11: PYI014 [**] Only simple default values allowed for arguments
|
59 | x=list(range(10)), # Error PYI014
60 | ) -> None: ...
@ -186,7 +186,7 @@ PYI014.pyi:61:11: PYI014 [*] Only simple default values allowed for arguments
63 63 | x="foo" + "bar", # Error PYI014
64 64 | ) -> None: ...
PYI014.pyi:63:7: PYI014 [*] Only simple default values allowed for arguments
PYI014.pyi:63:7: PYI014 [**] Only simple default values allowed for arguments
|
61 | def f16(x=frozenset({b"foo", b"bar", b"baz"})) -> None: ... # Error PYI014
62 | def f17(
@ -207,7 +207,7 @@ PYI014.pyi:63:7: PYI014 [*] Only simple default values allowed for arguments
65 65 | def f18(
66 66 | x=b"foo" + b"bar", # Error PYI014
PYI014.pyi:66:7: PYI014 [*] Only simple default values allowed for arguments
PYI014.pyi:66:7: PYI014 [**] Only simple default values allowed for arguments
|
64 | ) -> None: ...
65 | def f18(
@ -228,7 +228,7 @@ PYI014.pyi:66:7: PYI014 [*] Only simple default values allowed for arguments
68 68 | def f19(
69 69 | x="foo" + 4, # Error PYI014
PYI014.pyi:69:7: PYI014 [*] Only simple default values allowed for arguments
PYI014.pyi:69:7: PYI014 [**] Only simple default values allowed for arguments
|
67 | ) -> None: ...
68 | def f19(
@ -249,7 +249,7 @@ PYI014.pyi:69:7: PYI014 [*] Only simple default values allowed for arguments
71 71 | def f20(
72 72 | x=5 + 5, # Error PYI014
PYI014.pyi:72:7: PYI014 [*] Only simple default values allowed for arguments
PYI014.pyi:72:7: PYI014 [**] Only simple default values allowed for arguments
|
70 | ) -> None: ...
71 | def f20(
@ -270,7 +270,7 @@ PYI014.pyi:72:7: PYI014 [*] Only simple default values allowed for arguments
74 74 | def f21(
75 75 | x=3j - 3j, # Error PYI014
PYI014.pyi:75:7: PYI014 [*] Only simple default values allowed for arguments
PYI014.pyi:75:7: PYI014 [**] Only simple default values allowed for arguments
|
73 | ) -> None: ...
74 | def f21(
@ -291,7 +291,7 @@ PYI014.pyi:75:7: PYI014 [*] Only simple default values allowed for arguments
77 77 | def f22(
78 78 | x=-42.5j + 4.3j, # Error PYI014
PYI014.pyi:78:7: PYI014 [*] Only simple default values allowed for arguments
PYI014.pyi:78:7: PYI014 [**] Only simple default values allowed for arguments
|
76 | ) -> None: ...
77 | def f22(

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs
---
PYI015.pyi:44:23: PYI015 [*] Only simple default values allowed for assignments
PYI015.pyi:44:23: PYI015 [**] Only simple default values allowed for assignments
|
43 | # We *should* emit Y015 for more complex default values
44 | field221: list[int] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] # Y015 Only simple default values are allowed for assignments
@ -21,7 +21,7 @@ PYI015.pyi:44:23: PYI015 [*] Only simple default values allowed for assignments
46 46 | field224: list[int] = list(range(10)) # Y015 Only simple default values are allowed for assignments
47 47 | field225: list[object] = [{}, 1, 2] # Y015 Only simple default values are allowed for assignments
PYI015.pyi:45:23: PYI015 [*] Only simple default values allowed for assignments
PYI015.pyi:45:23: PYI015 [**] Only simple default values allowed for assignments
|
43 | # We *should* emit Y015 for more complex default values
44 | field221: list[int] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] # Y015 Only simple default values are allowed for assignments
@ -42,7 +42,7 @@ PYI015.pyi:45:23: PYI015 [*] Only simple default values allowed for assignments
47 47 | field225: list[object] = [{}, 1, 2] # Y015 Only simple default values are allowed for assignments
48 48 | field226: tuple[str | tuple[str, ...], ...] = ("foo", ("foo", "bar")) # Y015 Only simple default values are allowed for assignments
PYI015.pyi:46:23: PYI015 [*] Only simple default values allowed for assignments
PYI015.pyi:46:23: PYI015 [**] Only simple default values allowed for assignments
|
44 | field221: list[int] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] # Y015 Only simple default values are allowed for assignments
45 | field223: list[int] = [*range(10)] # Y015 Only simple default values are allowed for assignments
@ -63,7 +63,7 @@ PYI015.pyi:46:23: PYI015 [*] Only simple default values allowed for assignments
48 48 | field226: tuple[str | tuple[str, ...], ...] = ("foo", ("foo", "bar")) # Y015 Only simple default values are allowed for assignments
49 49 | field227: dict[str, object] = {"foo": {"foo": "bar"}} # Y015 Only simple default values are allowed for assignments
PYI015.pyi:47:26: PYI015 [*] Only simple default values allowed for assignments
PYI015.pyi:47:26: PYI015 [**] Only simple default values allowed for assignments
|
45 | field223: list[int] = [*range(10)] # Y015 Only simple default values are allowed for assignments
46 | field224: list[int] = list(range(10)) # Y015 Only simple default values are allowed for assignments
@ -84,7 +84,7 @@ PYI015.pyi:47:26: PYI015 [*] Only simple default values allowed for assignments
49 49 | field227: dict[str, object] = {"foo": {"foo": "bar"}} # Y015 Only simple default values are allowed for assignments
50 50 | field228: dict[str, list[object]] = {"foo": []} # Y015 Only simple default values are allowed for assignments
PYI015.pyi:48:47: PYI015 [*] Only simple default values allowed for assignments
PYI015.pyi:48:47: PYI015 [**] Only simple default values allowed for assignments
|
46 | field224: list[int] = list(range(10)) # Y015 Only simple default values are allowed for assignments
47 | field225: list[object] = [{}, 1, 2] # Y015 Only simple default values are allowed for assignments
@ -105,7 +105,7 @@ PYI015.pyi:48:47: PYI015 [*] Only simple default values allowed for assignments
50 50 | field228: dict[str, list[object]] = {"foo": []} # Y015 Only simple default values are allowed for assignments
51 51 | # When parsed, this case results in `None` being placed in the `.keys` list for the `ast.Dict` node
PYI015.pyi:49:31: PYI015 [*] Only simple default values allowed for assignments
PYI015.pyi:49:31: PYI015 [**] Only simple default values allowed for assignments
|
47 | field225: list[object] = [{}, 1, 2] # Y015 Only simple default values are allowed for assignments
48 | field226: tuple[str | tuple[str, ...], ...] = ("foo", ("foo", "bar")) # Y015 Only simple default values are allowed for assignments
@ -126,7 +126,7 @@ PYI015.pyi:49:31: PYI015 [*] Only simple default values allowed for assignments
51 51 | # When parsed, this case results in `None` being placed in the `.keys` list for the `ast.Dict` node
52 52 | field229: dict[int, int] = {1: 2, **{3: 4}} # Y015 Only simple default values are allowed for assignments
PYI015.pyi:50:37: PYI015 [*] Only simple default values allowed for assignments
PYI015.pyi:50:37: PYI015 [**] Only simple default values allowed for assignments
|
48 | field226: tuple[str | tuple[str, ...], ...] = ("foo", ("foo", "bar")) # Y015 Only simple default values are allowed for assignments
49 | field227: dict[str, object] = {"foo": {"foo": "bar"}} # Y015 Only simple default values are allowed for assignments
@ -147,7 +147,7 @@ PYI015.pyi:50:37: PYI015 [*] Only simple default values allowed for assignments
52 52 | field229: dict[int, int] = {1: 2, **{3: 4}} # Y015 Only simple default values are allowed for assignments
53 53 | field23 = "foo" + "bar" # Y015 Only simple default values are allowed for assignments
PYI015.pyi:52:28: PYI015 [*] Only simple default values allowed for assignments
PYI015.pyi:52:28: PYI015 [**] Only simple default values allowed for assignments
|
50 | field228: dict[str, list[object]] = {"foo": []} # Y015 Only simple default values are allowed for assignments
51 | # When parsed, this case results in `None` being placed in the `.keys` list for the `ast.Dict` node
@ -168,7 +168,7 @@ PYI015.pyi:52:28: PYI015 [*] Only simple default values allowed for assignments
54 54 | field24 = b"foo" + b"bar" # Y015 Only simple default values are allowed for assignments
55 55 | field25 = 5 * 5 # Y015 Only simple default values are allowed for assignments
PYI015.pyi:53:11: PYI015 [*] Only simple default values allowed for assignments
PYI015.pyi:53:11: PYI015 [**] Only simple default values allowed for assignments
|
51 | # When parsed, this case results in `None` being placed in the `.keys` list for the `ast.Dict` node
52 | field229: dict[int, int] = {1: 2, **{3: 4}} # Y015 Only simple default values are allowed for assignments
@ -189,7 +189,7 @@ PYI015.pyi:53:11: PYI015 [*] Only simple default values allowed for assignments
55 55 | field25 = 5 * 5 # Y015 Only simple default values are allowed for assignments
56 56 |
PYI015.pyi:54:11: PYI015 [*] Only simple default values allowed for assignments
PYI015.pyi:54:11: PYI015 [**] Only simple default values allowed for assignments
|
52 | field229: dict[int, int] = {1: 2, **{3: 4}} # Y015 Only simple default values are allowed for assignments
53 | field23 = "foo" + "bar" # Y015 Only simple default values are allowed for assignments
@ -209,7 +209,7 @@ PYI015.pyi:54:11: PYI015 [*] Only simple default values allowed for assignments
56 56 |
57 57 | # We shouldn't emit Y015 within functions
PYI015.pyi:55:11: PYI015 [*] Only simple default values allowed for assignments
PYI015.pyi:55:11: PYI015 [**] Only simple default values allowed for assignments
|
53 | field23 = "foo" + "bar" # Y015 Only simple default values are allowed for assignments
54 | field24 = b"foo" + b"bar" # Y015 Only simple default values are allowed for assignments

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs
---
PYI025.py:10:33: PYI025 [*] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin
PYI025.py:10:33: PYI025 [**] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin
|
9 | def f():
10 | from collections.abc import Set # PYI025
@ -19,7 +19,7 @@ PYI025.py:10:33: PYI025 [*] Use `from collections.abc import Set as AbstractSet`
12 12 |
13 13 | def f():
PYI025.py:14:51: PYI025 [*] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin
PYI025.py:14:51: PYI025 [**] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin
|
13 | def f():
14 | from collections.abc import Container, Sized, Set, ValuesView # PYI025

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs
---
PYI025.pyi:8:33: PYI025 [*] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin
PYI025.pyi:8:33: PYI025 [**] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin
|
7 | def f():
8 | from collections.abc import Set # PYI025
@ -21,7 +21,7 @@ PYI025.pyi:8:33: PYI025 [*] Use `from collections.abc import Set as AbstractSet`
10 10 | def f():
11 11 | from collections.abc import Container, Sized, Set, ValuesView # PYI025
PYI025.pyi:11:51: PYI025 [*] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin
PYI025.pyi:11:51: PYI025 [**] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin
|
10 | def f():
11 | from collections.abc import Container, Sized, Set, ValuesView # PYI025
@ -41,7 +41,7 @@ PYI025.pyi:11:51: PYI025 [*] Use `from collections.abc import Set as AbstractSet
13 13 | def f():
14 14 | """Test: local symbol renaming."""
PYI025.pyi:16:37: PYI025 [*] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin
PYI025.pyi:16:37: PYI025 [**] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin
|
14 | """Test: local symbol renaming."""
15 | if True:
@ -76,7 +76,7 @@ PYI025.pyi:16:37: PYI025 [*] Use `from collections.abc import Set as AbstractSet
29 29 | def Set():
30 30 | pass
PYI025.pyi:33:29: PYI025 [*] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin
PYI025.pyi:33:29: PYI025 [**] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin
|
31 | print(Set)
32 |
@ -119,7 +119,7 @@ PYI025.pyi:33:29: PYI025 [*] Use `from collections.abc import Set as AbstractSet
42 42 | def f():
43 43 | """Test: nonlocal symbol renaming."""
PYI025.pyi:44:33: PYI025 [*] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin
PYI025.pyi:44:33: PYI025 [**] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin
|
42 | def f():
43 | """Test: nonlocal symbol renaming."""

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs
---
PYI026.pyi:3:1: PYI026 [*] Use `typing.TypeAlias` for type alias, e.g., `NewAny: TypeAlias = Any`
PYI026.pyi:3:1: PYI026 [**] Use `typing.TypeAlias` for type alias, e.g., `NewAny: TypeAlias = Any`
|
1 | from typing import Literal, Any
2 |
@ -22,7 +22,7 @@ PYI026.pyi:3:1: PYI026 [*] Use `typing.TypeAlias` for type alias, e.g., `NewAny:
5 5 | Foo = Literal["foo"]
6 6 | IntOrStr = int | str
PYI026.pyi:4:1: PYI026 [*] Use `typing.TypeAlias` for type alias, e.g., `OptionalStr: TypeAlias = typing.Optional[str]`
PYI026.pyi:4:1: PYI026 [**] Use `typing.TypeAlias` for type alias, e.g., `OptionalStr: TypeAlias = typing.Optional[str]`
|
3 | NewAny = Any
4 | OptionalStr = typing.Optional[str]
@ -43,7 +43,7 @@ PYI026.pyi:4:1: PYI026 [*] Use `typing.TypeAlias` for type alias, e.g., `Optiona
6 6 | IntOrStr = int | str
7 7 | AliasNone = None
PYI026.pyi:5:1: PYI026 [*] Use `typing.TypeAlias` for type alias, e.g., `Foo: TypeAlias = Literal["foo"]`
PYI026.pyi:5:1: PYI026 [**] Use `typing.TypeAlias` for type alias, e.g., `Foo: TypeAlias = Literal["foo"]`
|
3 | NewAny = Any
4 | OptionalStr = typing.Optional[str]
@ -66,7 +66,7 @@ PYI026.pyi:5:1: PYI026 [*] Use `typing.TypeAlias` for type alias, e.g., `Foo: Ty
7 7 | AliasNone = None
8 8 |
PYI026.pyi:6:1: PYI026 [*] Use `typing.TypeAlias` for type alias, e.g., `IntOrStr: TypeAlias = int | str`
PYI026.pyi:6:1: PYI026 [**] Use `typing.TypeAlias` for type alias, e.g., `IntOrStr: TypeAlias = int | str`
|
4 | OptionalStr = typing.Optional[str]
5 | Foo = Literal["foo"]
@ -89,7 +89,7 @@ PYI026.pyi:6:1: PYI026 [*] Use `typing.TypeAlias` for type alias, e.g., `IntOrSt
8 8 |
9 9 | NewAny: typing.TypeAlias = Any
PYI026.pyi:7:1: PYI026 [*] Use `typing.TypeAlias` for type alias, e.g., `AliasNone: TypeAlias = None`
PYI026.pyi:7:1: PYI026 [**] Use `typing.TypeAlias` for type alias, e.g., `AliasNone: TypeAlias = None`
|
5 | Foo = Literal["foo"]
6 | IntOrStr = int | str

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs
---
PYI053.pyi:3:14: PYI053 [*] String and bytes literals longer than 50 characters are not permitted
PYI053.pyi:3:14: PYI053 [**] String and bytes literals longer than 50 characters are not permitted
|
1 | def f1(x: str = "50 character stringggggggggggggggggggggggggggggggg") -> None: ... # OK
2 | def f2(
@ -21,7 +21,7 @@ PYI053.pyi:3:14: PYI053 [*] String and bytes literals longer than 50 characters
5 5 | def f3(
6 6 | x: str = "50 character stringgggggggggggggggggggggggggggggg\U0001f600", # OK
PYI053.pyi:9:14: PYI053 [*] String and bytes literals longer than 50 characters are not permitted
PYI053.pyi:9:14: PYI053 [**] String and bytes literals longer than 50 characters are not permitted
|
7 | ) -> None: ...
8 | def f4(
@ -42,7 +42,7 @@ PYI053.pyi:9:14: PYI053 [*] String and bytes literals longer than 50 characters
11 11 | def f5(
12 12 | x: bytes = b"50 character byte stringgggggggggggggggggggggggggg", # OK
PYI053.pyi:21:16: PYI053 [*] String and bytes literals longer than 50 characters are not permitted
PYI053.pyi:21:16: PYI053 [**] String and bytes literals longer than 50 characters are not permitted
|
19 | ) -> None: ...
20 | def f8(
@ -62,7 +62,7 @@ PYI053.pyi:21:16: PYI053 [*] String and bytes literals longer than 50 characters
23 23 |
24 24 | foo: str = "50 character stringggggggggggggggggggggggggggggggg" # OK
PYI053.pyi:26:12: PYI053 [*] String and bytes literals longer than 50 characters are not permitted
PYI053.pyi:26:12: PYI053 [**] String and bytes literals longer than 50 characters are not permitted
|
24 | foo: str = "50 character stringggggggggggggggggggggggggggggggg" # OK
25 |
@ -83,7 +83,7 @@ PYI053.pyi:26:12: PYI053 [*] String and bytes literals longer than 50 characters
28 28 | baz: bytes = b"50 character byte stringgggggggggggggggggggggggggg" # OK
29 29 |
PYI053.pyi:30:14: PYI053 [*] String and bytes literals longer than 50 characters are not permitted
PYI053.pyi:30:14: PYI053 [**] String and bytes literals longer than 50 characters are not permitted
|
28 | baz: bytes = b"50 character byte stringgggggggggggggggggggggggggg" # OK
29 |

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs
---
PYI054.pyi:2:16: PYI054 [*] Numeric literals with a string representation longer than ten characters are not permitted
PYI054.pyi:2:16: PYI054 [**] Numeric literals with a string representation longer than ten characters are not permitted
|
1 | field01: int = 0xFFFFFFFF
2 | field02: int = 0xFFFFFFFFF # Error: PYI054
@ -19,7 +19,7 @@ PYI054.pyi:2:16: PYI054 [*] Numeric literals with a string representation longer
4 4 | field04: int = -0xFFFFFFFFF # Error: PYI054
5 5 |
PYI054.pyi:4:17: PYI054 [*] Numeric literals with a string representation longer than ten characters are not permitted
PYI054.pyi:4:17: PYI054 [**] Numeric literals with a string representation longer than ten characters are not permitted
|
2 | field02: int = 0xFFFFFFFFF # Error: PYI054
3 | field03: int = -0xFFFFFFFF
@ -40,7 +40,7 @@ PYI054.pyi:4:17: PYI054 [*] Numeric literals with a string representation longer
6 6 | field05: int = 1234567890
7 7 | field06: int = 12_456_890
PYI054.pyi:8:16: PYI054 [*] Numeric literals with a string representation longer than ten characters are not permitted
PYI054.pyi:8:16: PYI054 [**] Numeric literals with a string representation longer than ten characters are not permitted
|
6 | field05: int = 1234567890
7 | field06: int = 12_456_890
@ -61,7 +61,7 @@ PYI054.pyi:8:16: PYI054 [*] Numeric literals with a string representation longer
10 10 | field09: int = -234_567_890 # Error: PYI054
11 11 |
PYI054.pyi:10:17: PYI054 [*] Numeric literals with a string representation longer than ten characters are not permitted
PYI054.pyi:10:17: PYI054 [**] Numeric literals with a string representation longer than ten characters are not permitted
|
8 | field07: int = 12345678901 # Error: PYI054
9 | field08: int = -1234567801
@ -82,7 +82,7 @@ PYI054.pyi:10:17: PYI054 [*] Numeric literals with a string representation longe
12 12 | field10: float = 123.456789
13 13 | field11: float = 123.4567890 # Error: PYI054
PYI054.pyi:13:18: PYI054 [*] Numeric literals with a string representation longer than ten characters are not permitted
PYI054.pyi:13:18: PYI054 [**] Numeric literals with a string representation longer than ten characters are not permitted
|
12 | field10: float = 123.456789
13 | field11: float = 123.4567890 # Error: PYI054
@ -102,7 +102,7 @@ PYI054.pyi:13:18: PYI054 [*] Numeric literals with a string representation longe
15 15 | field13: float = -123.567_890 # Error: PYI054
16 16 |
PYI054.pyi:15:19: PYI054 [*] Numeric literals with a string representation longer than ten characters are not permitted
PYI054.pyi:15:19: PYI054 [**] Numeric literals with a string representation longer than ten characters are not permitted
|
13 | field11: float = 123.4567890 # Error: PYI054
14 | field12: float = -123.456789
@ -123,7 +123,7 @@ PYI054.pyi:15:19: PYI054 [*] Numeric literals with a string representation longe
17 17 | field14: complex = 1e1234567j
18 18 | field15: complex = 1e12345678j # Error: PYI054
PYI054.pyi:18:20: PYI054 [*] Numeric literals with a string representation longer than ten characters are not permitted
PYI054.pyi:18:20: PYI054 [**] Numeric literals with a string representation longer than ten characters are not permitted
|
17 | field14: complex = 1e1234567j
18 | field15: complex = 1e12345678j # Error: PYI054
@ -142,7 +142,7 @@ PYI054.pyi:18:20: PYI054 [*] Numeric literals with a string representation longe
19 19 | field16: complex = -1e1234567j
20 20 | field17: complex = 1e123456789j # Error: PYI054
PYI054.pyi:20:20: PYI054 [*] Numeric literals with a string representation longer than ten characters are not permitted
PYI054.pyi:20:20: PYI054 [**] Numeric literals with a string representation longer than ten characters are not permitted
|
18 | field15: complex = 1e12345678j # Error: PYI054
19 | field16: complex = -1e1234567j

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs
---
PYI026.pyi:3:1: PYI026 [*] Use `typing_extensions.TypeAlias` for type alias, e.g., `NewAny: TypeAlias = Any`
PYI026.pyi:3:1: PYI026 [**] Use `typing_extensions.TypeAlias` for type alias, e.g., `NewAny: TypeAlias = Any`
|
1 | from typing import Literal, Any
2 |
@ -22,7 +22,7 @@ PYI026.pyi:3:1: PYI026 [*] Use `typing_extensions.TypeAlias` for type alias, e.g
5 6 | Foo = Literal["foo"]
6 7 | IntOrStr = int | str
PYI026.pyi:4:1: PYI026 [*] Use `typing_extensions.TypeAlias` for type alias, e.g., `OptionalStr: TypeAlias = typing.Optional[str]`
PYI026.pyi:4:1: PYI026 [**] Use `typing_extensions.TypeAlias` for type alias, e.g., `OptionalStr: TypeAlias = typing.Optional[str]`
|
3 | NewAny = Any
4 | OptionalStr = typing.Optional[str]
@ -43,7 +43,7 @@ PYI026.pyi:4:1: PYI026 [*] Use `typing_extensions.TypeAlias` for type alias, e.g
6 7 | IntOrStr = int | str
7 8 | AliasNone = None
PYI026.pyi:5:1: PYI026 [*] Use `typing_extensions.TypeAlias` for type alias, e.g., `Foo: TypeAlias = Literal["foo"]`
PYI026.pyi:5:1: PYI026 [**] Use `typing_extensions.TypeAlias` for type alias, e.g., `Foo: TypeAlias = Literal["foo"]`
|
3 | NewAny = Any
4 | OptionalStr = typing.Optional[str]
@ -66,7 +66,7 @@ PYI026.pyi:5:1: PYI026 [*] Use `typing_extensions.TypeAlias` for type alias, e.g
7 8 | AliasNone = None
8 9 |
PYI026.pyi:6:1: PYI026 [*] Use `typing_extensions.TypeAlias` for type alias, e.g., `IntOrStr: TypeAlias = int | str`
PYI026.pyi:6:1: PYI026 [**] Use `typing_extensions.TypeAlias` for type alias, e.g., `IntOrStr: TypeAlias = int | str`
|
4 | OptionalStr = typing.Optional[str]
5 | Foo = Literal["foo"]
@ -89,7 +89,7 @@ PYI026.pyi:6:1: PYI026 [*] Use `typing_extensions.TypeAlias` for type alias, e.g
8 9 |
9 10 | NewAny: typing.TypeAlias = Any
PYI026.pyi:7:1: PYI026 [*] Use `typing_extensions.TypeAlias` for type alias, e.g., `AliasNone: TypeAlias = None`
PYI026.pyi:7:1: PYI026 [**] Use `typing_extensions.TypeAlias` for type alias, e.g., `AliasNone: TypeAlias = None`
|
5 | Foo = Literal["foo"]
6 | IntOrStr = int | str

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs
---
PT003.py:14:17: PT003 [*] `scope='function'` is implied in `@pytest.fixture()`
PT003.py:14:17: PT003 [**] `scope='function'` is implied in `@pytest.fixture()`
|
14 | @pytest.fixture(scope="function")
| ^^^^^^^^^^^^^^^^ PT003
@ -20,7 +20,7 @@ PT003.py:14:17: PT003 [*] `scope='function'` is implied in `@pytest.fixture()`
16 16 | ...
17 17 |
PT003.py:19:17: PT003 [*] `scope='function'` is implied in `@pytest.fixture()`
PT003.py:19:17: PT003 [**] `scope='function'` is implied in `@pytest.fixture()`
|
19 | @pytest.fixture(scope="function", name="my_fixture")
| ^^^^^^^^^^^^^^^^ PT003
@ -39,7 +39,7 @@ PT003.py:19:17: PT003 [*] `scope='function'` is implied in `@pytest.fixture()`
21 21 | ...
22 22 |
PT003.py:24:36: PT003 [*] `scope='function'` is implied in `@pytest.fixture()`
PT003.py:24:36: PT003 [**] `scope='function'` is implied in `@pytest.fixture()`
|
24 | @pytest.fixture(name="my_fixture", scope="function")
| ^^^^^^^^^^^^^^^^ PT003
@ -58,7 +58,7 @@ PT003.py:24:36: PT003 [*] `scope='function'` is implied in `@pytest.fixture()`
26 26 | ...
27 27 |
PT003.py:29:36: PT003 [*] `scope='function'` is implied in `@pytest.fixture()`
PT003.py:29:36: PT003 [**] `scope='function'` is implied in `@pytest.fixture()`
|
29 | @pytest.fixture(name="my_fixture", scope="function", **kwargs)
| ^^^^^^^^^^^^^^^^ PT003
@ -77,7 +77,7 @@ PT003.py:29:36: PT003 [*] `scope='function'` is implied in `@pytest.fixture()`
31 31 | ...
32 32 |
PT003.py:37:31: PT003 [*] `scope='function'` is implied in `@pytest.fixture()`
PT003.py:37:31: PT003 [**] `scope='function'` is implied in `@pytest.fixture()`
|
35 | # tests the general case as we use a helper function that should
36 | # work for all cases.
@ -98,7 +98,7 @@ PT003.py:37:31: PT003 [*] `scope='function'` is implied in `@pytest.fixture()`
39 39 | ...
40 40 |
PT003.py:43:5: PT003 [*] `scope='function'` is implied in `@pytest.fixture()`
PT003.py:43:5: PT003 [**] `scope='function'` is implied in `@pytest.fixture()`
|
42 | @pytest.fixture(
43 | scope="function",
@ -117,7 +117,7 @@ PT003.py:43:5: PT003 [*] `scope='function'` is implied in `@pytest.fixture()`
45 44 | )
46 45 | def error_multiple_args():
PT003.py:52:5: PT003 [*] `scope='function'` is implied in `@pytest.fixture()`
PT003.py:52:5: PT003 [**] `scope='function'` is implied in `@pytest.fixture()`
|
50 | @pytest.fixture(
51 | name="my_fixture",
@ -137,7 +137,7 @@ PT003.py:52:5: PT003 [*] `scope='function'` is implied in `@pytest.fixture()`
54 53 | def error_multiple_args():
55 54 | ...
PT003.py:66:5: PT003 [*] `scope='function'` is implied in `@pytest.fixture()`
PT003.py:66:5: PT003 [**] `scope='function'` is implied in `@pytest.fixture()`
|
64 | # another comment ,)
65 |

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs
---
PT006.py:24:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expected `csv`
PT006.py:24:26: PT006 [**] Wrong name(s) type in `@pytest.mark.parametrize`, expected `csv`
|
24 | @pytest.mark.parametrize(("param1", "param2"), [(1, 2), (3, 4)])
| ^^^^^^^^^^^^^^^^^^^^ PT006
@ -39,7 +39,7 @@ PT006.py:29:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expe
31 31 | ...
32 32 |
PT006.py:34:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expected `csv`
PT006.py:34:26: PT006 [**] Wrong name(s) type in `@pytest.mark.parametrize`, expected `csv`
|
34 | @pytest.mark.parametrize(["param1", "param2"], [(1, 2), (3, 4)])
| ^^^^^^^^^^^^^^^^^^^^ PT006

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs
---
PT006.py:9:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expected `tuple`
PT006.py:9:26: PT006 [**] Wrong name(s) type in `@pytest.mark.parametrize`, expected `tuple`
|
9 | @pytest.mark.parametrize("param1,param2", [(1, 2), (3, 4)])
| ^^^^^^^^^^^^^^^ PT006
@ -20,7 +20,7 @@ PT006.py:9:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expec
11 11 | ...
12 12 |
PT006.py:14:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expected `tuple`
PT006.py:14:26: PT006 [**] Wrong name(s) type in `@pytest.mark.parametrize`, expected `tuple`
|
14 | @pytest.mark.parametrize(" param1, , param2 , ", [(1, 2), (3, 4)])
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PT006
@ -39,7 +39,7 @@ PT006.py:14:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expe
16 16 | ...
17 17 |
PT006.py:19:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expected `tuple`
PT006.py:19:26: PT006 [**] Wrong name(s) type in `@pytest.mark.parametrize`, expected `tuple`
|
19 | @pytest.mark.parametrize("param1,param2", [(1, 2), (3, 4)])
| ^^^^^^^^^^^^^^^ PT006
@ -77,7 +77,7 @@ PT006.py:29:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expe
31 31 | ...
32 32 |
PT006.py:34:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expected `tuple`
PT006.py:34:26: PT006 [**] Wrong name(s) type in `@pytest.mark.parametrize`, expected `tuple`
|
34 | @pytest.mark.parametrize(["param1", "param2"], [(1, 2), (3, 4)])
| ^^^^^^^^^^^^^^^^^^^^ PT006
@ -115,7 +115,7 @@ PT006.py:39:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expe
41 41 | ...
42 42 |
PT006.py:44:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expected `tuple`
PT006.py:44:26: PT006 [**] Wrong name(s) type in `@pytest.mark.parametrize`, expected `tuple`
|
44 | @pytest.mark.parametrize([some_expr, another_expr], [1, 2, 3])
| ^^^^^^^^^^^^^^^^^^^^^^^^^ PT006
@ -134,7 +134,7 @@ PT006.py:44:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expe
46 46 | ...
47 47 |
PT006.py:49:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expected `tuple`
PT006.py:49:26: PT006 [**] Wrong name(s) type in `@pytest.mark.parametrize`, expected `tuple`
|
49 | @pytest.mark.parametrize([some_expr, "param2"], [1, 2, 3])
| ^^^^^^^^^^^^^^^^^^^^^ PT006
@ -153,7 +153,7 @@ PT006.py:49:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expe
51 51 | ...
52 52 |
PT006.py:54:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expected `tuple`
PT006.py:54:26: PT006 [**] Wrong name(s) type in `@pytest.mark.parametrize`, expected `tuple`
|
54 | @pytest.mark.parametrize(("param1, " "param2, " "param3"), [(1, 2, 3), (4, 5, 6)])
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PT006
@ -172,7 +172,7 @@ PT006.py:54:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expe
56 56 | ...
57 57 |
PT006.py:59:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expected `tuple`
PT006.py:59:26: PT006 [**] Wrong name(s) type in `@pytest.mark.parametrize`, expected `tuple`
|
59 | @pytest.mark.parametrize("param1, " "param2, " "param3", [(1, 2, 3), (4, 5, 6)])
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PT006
@ -191,7 +191,7 @@ PT006.py:59:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expe
61 61 | ...
62 62 |
PT006.py:64:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expected `tuple`
PT006.py:64:26: PT006 [**] Wrong name(s) type in `@pytest.mark.parametrize`, expected `tuple`
|
64 | @pytest.mark.parametrize((("param1, " "param2, " "param3")), [(1, 2, 3), (4, 5, 6)])
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PT006
@ -210,7 +210,7 @@ PT006.py:64:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expe
66 66 | ...
67 67 |
PT006.py:69:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expected `tuple`
PT006.py:69:26: PT006 [**] Wrong name(s) type in `@pytest.mark.parametrize`, expected `tuple`
|
69 | @pytest.mark.parametrize(("param1,param2"), [(1, 2), (3, 4)])
| ^^^^^^^^^^^^^^^^^ PT006

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs
---
PT006.py:9:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expected `list`
PT006.py:9:26: PT006 [**] Wrong name(s) type in `@pytest.mark.parametrize`, expected `list`
|
9 | @pytest.mark.parametrize("param1,param2", [(1, 2), (3, 4)])
| ^^^^^^^^^^^^^^^ PT006
@ -20,7 +20,7 @@ PT006.py:9:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expec
11 11 | ...
12 12 |
PT006.py:14:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expected `list`
PT006.py:14:26: PT006 [**] Wrong name(s) type in `@pytest.mark.parametrize`, expected `list`
|
14 | @pytest.mark.parametrize(" param1, , param2 , ", [(1, 2), (3, 4)])
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PT006
@ -39,7 +39,7 @@ PT006.py:14:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expe
16 16 | ...
17 17 |
PT006.py:19:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expected `list`
PT006.py:19:26: PT006 [**] Wrong name(s) type in `@pytest.mark.parametrize`, expected `list`
|
19 | @pytest.mark.parametrize("param1,param2", [(1, 2), (3, 4)])
| ^^^^^^^^^^^^^^^ PT006
@ -58,7 +58,7 @@ PT006.py:19:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expe
21 21 | ...
22 22 |
PT006.py:24:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expected `list`
PT006.py:24:26: PT006 [**] Wrong name(s) type in `@pytest.mark.parametrize`, expected `list`
|
24 | @pytest.mark.parametrize(("param1", "param2"), [(1, 2), (3, 4)])
| ^^^^^^^^^^^^^^^^^^^^ PT006
@ -115,7 +115,7 @@ PT006.py:39:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expe
41 41 | ...
42 42 |
PT006.py:54:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expected `list`
PT006.py:54:26: PT006 [**] Wrong name(s) type in `@pytest.mark.parametrize`, expected `list`
|
54 | @pytest.mark.parametrize(("param1, " "param2, " "param3"), [(1, 2, 3), (4, 5, 6)])
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PT006
@ -134,7 +134,7 @@ PT006.py:54:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expe
56 56 | ...
57 57 |
PT006.py:59:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expected `list`
PT006.py:59:26: PT006 [**] Wrong name(s) type in `@pytest.mark.parametrize`, expected `list`
|
59 | @pytest.mark.parametrize("param1, " "param2, " "param3", [(1, 2, 3), (4, 5, 6)])
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PT006
@ -153,7 +153,7 @@ PT006.py:59:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expe
61 61 | ...
62 62 |
PT006.py:64:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expected `list`
PT006.py:64:26: PT006 [**] Wrong name(s) type in `@pytest.mark.parametrize`, expected `list`
|
64 | @pytest.mark.parametrize((("param1, " "param2, " "param3")), [(1, 2, 3), (4, 5, 6)])
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PT006
@ -172,7 +172,7 @@ PT006.py:64:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expe
66 66 | ...
67 67 |
PT006.py:69:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expected `list`
PT006.py:69:26: PT006 [**] Wrong name(s) type in `@pytest.mark.parametrize`, expected `list`
|
69 | @pytest.mark.parametrize(("param1,param2"), [(1, 2), (3, 4)])
| ^^^^^^^^^^^^^^^^^ PT006

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs
---
PT009.py:11:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertTrue`
PT009.py:11:9: PT009 [**] Use a regular `assert` instead of unittest-style `assertTrue`
|
9 | expr = 1
10 | msg = "Must be True"
@ -22,7 +22,7 @@ PT009.py:11:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser
13 13 | self.assertTrue(expr, msg) # Error
14 14 | self.assertTrue(expr=expr, msg=msg) # Error
PT009.py:12:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertTrue`
PT009.py:12:9: PT009 [**] Use a regular `assert` instead of unittest-style `assertTrue`
|
10 | msg = "Must be True"
11 | self.assertTrue(expr) # Error
@ -43,7 +43,7 @@ PT009.py:12:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser
14 14 | self.assertTrue(expr=expr, msg=msg) # Error
15 15 | self.assertTrue(msg=msg, expr=expr) # Error
PT009.py:13:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertTrue`
PT009.py:13:9: PT009 [**] Use a regular `assert` instead of unittest-style `assertTrue`
|
11 | self.assertTrue(expr) # Error
12 | self.assertTrue(expr=expr) # Error
@ -64,7 +64,7 @@ PT009.py:13:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser
15 15 | self.assertTrue(msg=msg, expr=expr) # Error
16 16 | self.assertTrue(*(expr, msg)) # Error, unfixable
PT009.py:14:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertTrue`
PT009.py:14:9: PT009 [**] Use a regular `assert` instead of unittest-style `assertTrue`
|
12 | self.assertTrue(expr=expr) # Error
13 | self.assertTrue(expr, msg) # Error
@ -85,7 +85,7 @@ PT009.py:14:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser
16 16 | self.assertTrue(*(expr, msg)) # Error, unfixable
17 17 | self.assertTrue(**{"expr": expr, "msg": msg}) # Error, unfixable
PT009.py:15:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertTrue`
PT009.py:15:9: PT009 [**] Use a regular `assert` instead of unittest-style `assertTrue`
|
13 | self.assertTrue(expr, msg) # Error
14 | self.assertTrue(expr=expr, msg=msg) # Error
@ -183,7 +183,7 @@ PT009.py:25:16: PT009 Use a regular `assert` instead of unittest-style `assertEq
|
= help: Replace `assertEqual(...)` with `assert ...`
PT009.py:28:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertFalse`
PT009.py:28:9: PT009 [**] Use a regular `assert` instead of unittest-style `assertFalse`
|
27 | def test_assert_false(self):
28 | self.assertFalse(True) # Error
@ -203,7 +203,7 @@ PT009.py:28:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser
30 30 | def test_assert_equal(self):
31 31 | self.assertEqual(1, 2) # Error
PT009.py:31:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertEqual`
PT009.py:31:9: PT009 [**] Use a regular `assert` instead of unittest-style `assertEqual`
|
30 | def test_assert_equal(self):
31 | self.assertEqual(1, 2) # Error
@ -223,7 +223,7 @@ PT009.py:31:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser
33 33 | def test_assert_not_equal(self):
34 34 | self.assertNotEqual(1, 1) # Error
PT009.py:34:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertNotEqual`
PT009.py:34:9: PT009 [**] Use a regular `assert` instead of unittest-style `assertNotEqual`
|
33 | def test_assert_not_equal(self):
34 | self.assertNotEqual(1, 1) # Error
@ -243,7 +243,7 @@ PT009.py:34:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser
36 36 | def test_assert_greater(self):
37 37 | self.assertGreater(1, 2) # Error
PT009.py:37:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertGreater`
PT009.py:37:9: PT009 [**] Use a regular `assert` instead of unittest-style `assertGreater`
|
36 | def test_assert_greater(self):
37 | self.assertGreater(1, 2) # Error
@ -263,7 +263,7 @@ PT009.py:37:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser
39 39 | def test_assert_greater_equal(self):
40 40 | self.assertGreaterEqual(1, 2) # Error
PT009.py:40:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertGreaterEqual`
PT009.py:40:9: PT009 [**] Use a regular `assert` instead of unittest-style `assertGreaterEqual`
|
39 | def test_assert_greater_equal(self):
40 | self.assertGreaterEqual(1, 2) # Error
@ -283,7 +283,7 @@ PT009.py:40:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser
42 42 | def test_assert_less(self):
43 43 | self.assertLess(2, 1) # Error
PT009.py:43:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertLess`
PT009.py:43:9: PT009 [**] Use a regular `assert` instead of unittest-style `assertLess`
|
42 | def test_assert_less(self):
43 | self.assertLess(2, 1) # Error
@ -303,7 +303,7 @@ PT009.py:43:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser
45 45 | def test_assert_less_equal(self):
46 46 | self.assertLessEqual(1, 2) # Error
PT009.py:46:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertLessEqual`
PT009.py:46:9: PT009 [**] Use a regular `assert` instead of unittest-style `assertLessEqual`
|
45 | def test_assert_less_equal(self):
46 | self.assertLessEqual(1, 2) # Error
@ -323,7 +323,7 @@ PT009.py:46:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser
48 48 | def test_assert_in(self):
49 49 | self.assertIn(1, [2, 3]) # Error
PT009.py:49:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertIn`
PT009.py:49:9: PT009 [**] Use a regular `assert` instead of unittest-style `assertIn`
|
48 | def test_assert_in(self):
49 | self.assertIn(1, [2, 3]) # Error
@ -343,7 +343,7 @@ PT009.py:49:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser
51 51 | def test_assert_not_in(self):
52 52 | self.assertNotIn(2, [2, 3]) # Error
PT009.py:52:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertNotIn`
PT009.py:52:9: PT009 [**] Use a regular `assert` instead of unittest-style `assertNotIn`
|
51 | def test_assert_not_in(self):
52 | self.assertNotIn(2, [2, 3]) # Error
@ -363,7 +363,7 @@ PT009.py:52:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser
54 54 | def test_assert_is_none(self):
55 55 | self.assertIsNone(0) # Error
PT009.py:55:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertIsNone`
PT009.py:55:9: PT009 [**] Use a regular `assert` instead of unittest-style `assertIsNone`
|
54 | def test_assert_is_none(self):
55 | self.assertIsNone(0) # Error
@ -383,7 +383,7 @@ PT009.py:55:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser
57 57 | def test_assert_is_not_none(self):
58 58 | self.assertIsNotNone(0) # Error
PT009.py:58:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertIsNotNone`
PT009.py:58:9: PT009 [**] Use a regular `assert` instead of unittest-style `assertIsNotNone`
|
57 | def test_assert_is_not_none(self):
58 | self.assertIsNotNone(0) # Error
@ -403,7 +403,7 @@ PT009.py:58:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser
60 60 | def test_assert_is(self):
61 61 | self.assertIs([], []) # Error
PT009.py:61:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertIs`
PT009.py:61:9: PT009 [**] Use a regular `assert` instead of unittest-style `assertIs`
|
60 | def test_assert_is(self):
61 | self.assertIs([], []) # Error
@ -423,7 +423,7 @@ PT009.py:61:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser
63 63 | def test_assert_is_not(self):
64 64 | self.assertIsNot(1, 1) # Error
PT009.py:64:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertIsNot`
PT009.py:64:9: PT009 [**] Use a regular `assert` instead of unittest-style `assertIsNot`
|
63 | def test_assert_is_not(self):
64 | self.assertIsNot(1, 1) # Error
@ -443,7 +443,7 @@ PT009.py:64:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser
66 66 | def test_assert_is_instance(self):
67 67 | self.assertIsInstance(1, str) # Error
PT009.py:67:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertIsInstance`
PT009.py:67:9: PT009 [**] Use a regular `assert` instead of unittest-style `assertIsInstance`
|
66 | def test_assert_is_instance(self):
67 | self.assertIsInstance(1, str) # Error
@ -463,7 +463,7 @@ PT009.py:67:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser
69 69 | def test_assert_is_not_instance(self):
70 70 | self.assertNotIsInstance(1, int) # Error
PT009.py:70:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertNotIsInstance`
PT009.py:70:9: PT009 [**] Use a regular `assert` instead of unittest-style `assertNotIsInstance`
|
69 | def test_assert_is_not_instance(self):
70 | self.assertNotIsInstance(1, int) # Error
@ -483,7 +483,7 @@ PT009.py:70:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser
72 72 | def test_assert_regex(self):
73 73 | self.assertRegex("abc", r"def") # Error
PT009.py:73:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertRegex`
PT009.py:73:9: PT009 [**] Use a regular `assert` instead of unittest-style `assertRegex`
|
72 | def test_assert_regex(self):
73 | self.assertRegex("abc", r"def") # Error
@ -503,7 +503,7 @@ PT009.py:73:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser
75 75 | def test_assert_not_regex(self):
76 76 | self.assertNotRegex("abc", r"abc") # Error
PT009.py:76:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertNotRegex`
PT009.py:76:9: PT009 [**] Use a regular `assert` instead of unittest-style `assertNotRegex`
|
75 | def test_assert_not_regex(self):
76 | self.assertNotRegex("abc", r"abc") # Error
@ -523,7 +523,7 @@ PT009.py:76:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser
78 78 | def test_assert_regexp_matches(self):
79 79 | self.assertRegexpMatches("abc", r"def") # Error
PT009.py:79:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertRegexpMatches`
PT009.py:79:9: PT009 [**] Use a regular `assert` instead of unittest-style `assertRegexpMatches`
|
78 | def test_assert_regexp_matches(self):
79 | self.assertRegexpMatches("abc", r"def") # Error
@ -543,7 +543,7 @@ PT009.py:79:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser
81 81 | def test_assert_not_regexp_matches(self):
82 82 | self.assertNotRegex("abc", r"abc") # Error
PT009.py:82:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertNotRegex`
PT009.py:82:9: PT009 [**] Use a regular `assert` instead of unittest-style `assertNotRegex`
|
81 | def test_assert_not_regexp_matches(self):
82 | self.assertNotRegex("abc", r"abc") # Error
@ -563,7 +563,7 @@ PT009.py:82:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser
84 84 | def test_fail_if(self):
85 85 | self.failIf("abc") # Error
PT009.py:85:9: PT009 [*] Use a regular `assert` instead of unittest-style `failIf`
PT009.py:85:9: PT009 [**] Use a regular `assert` instead of unittest-style `failIf`
|
84 | def test_fail_if(self):
85 | self.failIf("abc") # Error
@ -583,7 +583,7 @@ PT009.py:85:9: PT009 [*] Use a regular `assert` instead of unittest-style `failI
87 87 | def test_fail_unless(self):
88 88 | self.failUnless("abc") # Error
PT009.py:88:9: PT009 [*] Use a regular `assert` instead of unittest-style `failUnless`
PT009.py:88:9: PT009 [**] Use a regular `assert` instead of unittest-style `failUnless`
|
87 | def test_fail_unless(self):
88 | self.failUnless("abc") # Error
@ -603,7 +603,7 @@ PT009.py:88:9: PT009 [*] Use a regular `assert` instead of unittest-style `failU
90 90 | def test_fail_unless_equal(self):
91 91 | self.failUnlessEqual(1, 2) # Error
PT009.py:91:9: PT009 [*] Use a regular `assert` instead of unittest-style `failUnlessEqual`
PT009.py:91:9: PT009 [**] Use a regular `assert` instead of unittest-style `failUnlessEqual`
|
90 | def test_fail_unless_equal(self):
91 | self.failUnlessEqual(1, 2) # Error
@ -623,7 +623,7 @@ PT009.py:91:9: PT009 [*] Use a regular `assert` instead of unittest-style `failU
93 93 | def test_fail_if_equal(self):
94 94 | self.failIfEqual(1, 2) # Error
PT009.py:94:9: PT009 [*] Use a regular `assert` instead of unittest-style `failIfEqual`
PT009.py:94:9: PT009 [**] Use a regular `assert` instead of unittest-style `failIfEqual`
|
93 | def test_fail_if_equal(self):
94 | self.failIfEqual(1, 2) # Error
@ -641,7 +641,7 @@ PT009.py:94:9: PT009 [*] Use a regular `assert` instead of unittest-style `failI
96 96 |
97 97 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1722459517
PT009.py:98:2: PT009 [*] Use a regular `assert` instead of unittest-style `assertTrue`
PT009.py:98:2: PT009 [**] Use a regular `assert` instead of unittest-style `assertTrue`
|
97 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1722459517
98 | (self.assertTrue(

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs
---
PT014.py:4:35: PT014 [*] Duplicate of test case at index 0 in `@pytest_mark.parametrize`
PT014.py:4:35: PT014 [**] Duplicate of test case at index 0 in `@pytest_mark.parametrize`
|
4 | @pytest.mark.parametrize("x", [1, 1, 2])
| ^ PT014
@ -20,7 +20,7 @@ PT014.py:4:35: PT014 [*] Duplicate of test case at index 0 in `@pytest_mark.para
6 6 | ...
7 7 |
PT014.py:14:35: PT014 [*] Duplicate of test case at index 0 in `@pytest_mark.parametrize`
PT014.py:14:35: PT014 [**] Duplicate of test case at index 0 in `@pytest_mark.parametrize`
|
14 | @pytest.mark.parametrize("x", [a, a, b, b, b, c])
| ^ PT014
@ -39,7 +39,7 @@ PT014.py:14:35: PT014 [*] Duplicate of test case at index 0 in `@pytest_mark.par
16 16 | ...
17 17 |
PT014.py:14:41: PT014 [*] Duplicate of test case at index 2 in `@pytest_mark.parametrize`
PT014.py:14:41: PT014 [**] Duplicate of test case at index 2 in `@pytest_mark.parametrize`
|
14 | @pytest.mark.parametrize("x", [a, a, b, b, b, c])
| ^ PT014
@ -58,7 +58,7 @@ PT014.py:14:41: PT014 [*] Duplicate of test case at index 2 in `@pytest_mark.par
16 16 | ...
17 17 |
PT014.py:14:44: PT014 [*] Duplicate of test case at index 2 in `@pytest_mark.parametrize`
PT014.py:14:44: PT014 [**] Duplicate of test case at index 2 in `@pytest_mark.parametrize`
|
14 | @pytest.mark.parametrize("x", [a, a, b, b, b, c])
| ^ PT014
@ -88,7 +88,7 @@ PT014.py:24:9: PT014 Duplicate of test case at index 0 in `@pytest_mark.parametr
|
= help: Remove duplicate test case
PT014.py:32:39: PT014 [*] Duplicate of test case at index 0 in `@pytest_mark.parametrize`
PT014.py:32:39: PT014 [**] Duplicate of test case at index 0 in `@pytest_mark.parametrize`
|
32 | @pytest.mark.parametrize("x", [a, b, (a), c, ((a))])
| ^ PT014
@ -107,7 +107,7 @@ PT014.py:32:39: PT014 [*] Duplicate of test case at index 0 in `@pytest_mark.par
34 34 | ...
35 35 |
PT014.py:32:48: PT014 [*] Duplicate of test case at index 0 in `@pytest_mark.parametrize`
PT014.py:32:48: PT014 [**] Duplicate of test case at index 0 in `@pytest_mark.parametrize`
|
32 | @pytest.mark.parametrize("x", [a, b, (a), c, ((a))])
| ^ PT014
@ -126,7 +126,7 @@ PT014.py:32:48: PT014 [*] Duplicate of test case at index 0 in `@pytest_mark.par
34 34 | ...
35 35 |
PT014.py:42:10: PT014 [*] Duplicate of test case at index 0 in `@pytest_mark.parametrize`
PT014.py:42:10: PT014 [**] Duplicate of test case at index 0 in `@pytest_mark.parametrize`
|
40 | a,
41 | b,
@ -146,7 +146,7 @@ PT014.py:42:10: PT014 [*] Duplicate of test case at index 0 in `@pytest_mark.par
44 43 | ((a)),
45 44 | ],
PT014.py:44:11: PT014 [*] Duplicate of test case at index 0 in `@pytest_mark.parametrize`
PT014.py:44:11: PT014 [**] Duplicate of test case at index 0 in `@pytest_mark.parametrize`
|
42 | (a),
43 | c,

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs
---
PT018.py:14:5: PT018 [*] Assertion should be broken down into multiple parts
PT018.py:14:5: PT018 [**] Assertion should be broken down into multiple parts
|
13 | def test_error():
14 | assert something and something_else
@ -22,7 +22,7 @@ PT018.py:14:5: PT018 [*] Assertion should be broken down into multiple parts
16 17 | assert something and not something_else
17 18 | assert something and (something_else or something_third)
PT018.py:15:5: PT018 [*] Assertion should be broken down into multiple parts
PT018.py:15:5: PT018 [**] Assertion should be broken down into multiple parts
|
13 | def test_error():
14 | assert something and something_else
@ -44,7 +44,7 @@ PT018.py:15:5: PT018 [*] Assertion should be broken down into multiple parts
17 18 | assert something and (something_else or something_third)
18 19 | assert not something and something_else
PT018.py:16:5: PT018 [*] Assertion should be broken down into multiple parts
PT018.py:16:5: PT018 [**] Assertion should be broken down into multiple parts
|
14 | assert something and something_else
15 | assert something and something_else and something_third
@ -66,7 +66,7 @@ PT018.py:16:5: PT018 [*] Assertion should be broken down into multiple parts
18 19 | assert not something and something_else
19 20 | assert not (something or something_else)
PT018.py:17:5: PT018 [*] Assertion should be broken down into multiple parts
PT018.py:17:5: PT018 [**] Assertion should be broken down into multiple parts
|
15 | assert something and something_else and something_third
16 | assert something and not something_else
@ -88,7 +88,7 @@ PT018.py:17:5: PT018 [*] Assertion should be broken down into multiple parts
19 20 | assert not (something or something_else)
20 21 | assert not (something or something_else or something_third)
PT018.py:18:5: PT018 [*] Assertion should be broken down into multiple parts
PT018.py:18:5: PT018 [**] Assertion should be broken down into multiple parts
|
16 | assert something and not something_else
17 | assert something and (something_else or something_third)
@ -110,7 +110,7 @@ PT018.py:18:5: PT018 [*] Assertion should be broken down into multiple parts
20 21 | assert not (something or something_else or something_third)
21 22 | assert something and something_else == """error
PT018.py:19:5: PT018 [*] Assertion should be broken down into multiple parts
PT018.py:19:5: PT018 [**] Assertion should be broken down into multiple parts
|
17 | assert something and (something_else or something_third)
18 | assert not something and something_else
@ -132,7 +132,7 @@ PT018.py:19:5: PT018 [*] Assertion should be broken down into multiple parts
21 22 | assert something and something_else == """error
22 23 | message
PT018.py:20:5: PT018 [*] Assertion should be broken down into multiple parts
PT018.py:20:5: PT018 [**] Assertion should be broken down into multiple parts
|
18 | assert not something and something_else
19 | assert not (something or something_else)
@ -154,7 +154,7 @@ PT018.py:20:5: PT018 [*] Assertion should be broken down into multiple parts
22 23 | message
23 24 | """
PT018.py:21:5: PT018 [*] Assertion should be broken down into multiple parts
PT018.py:21:5: PT018 [**] Assertion should be broken down into multiple parts
|
19 | assert not (something or something_else)
20 | assert not (something or something_else or something_third)
@ -179,7 +179,7 @@ PT018.py:21:5: PT018 [*] Assertion should be broken down into multiple parts
23 24 | """
24 25 | assert (
PT018.py:24:5: PT018 [*] Assertion should be broken down into multiple parts
PT018.py:24:5: PT018 [**] Assertion should be broken down into multiple parts
|
22 | message
23 | """
@ -210,7 +210,7 @@ PT018.py:24:5: PT018 [*] Assertion should be broken down into multiple parts
28 28 | message
29 29 | """
PT018.py:33:5: PT018 [*] Assertion should be broken down into multiple parts
PT018.py:33:5: PT018 [**] Assertion should be broken down into multiple parts
|
32 | # recursive case
33 | assert not (a or not (b or c))
@ -230,7 +230,7 @@ PT018.py:33:5: PT018 [*] Assertion should be broken down into multiple parts
35 36 |
36 37 | # detected, but no fix for messages
PT018.py:34:5: PT018 [*] Assertion should be broken down into multiple parts
PT018.py:34:5: PT018 [**] Assertion should be broken down into multiple parts
|
32 | # recursive case
33 | assert not (a or not (b or c))
@ -282,7 +282,7 @@ PT018.py:40:5: PT018 Assertion should be broken down into multiple parts
|
= help: Break down assertion into multiple parts
PT018.py:44:1: PT018 [*] Assertion should be broken down into multiple parts
PT018.py:44:1: PT018 [**] Assertion should be broken down into multiple parts
|
43 | assert something # OK
44 | assert something and something_else # Error
@ -302,7 +302,7 @@ PT018.py:44:1: PT018 [*] Assertion should be broken down into multiple parts
46 47 |
47 48 |
PT018.py:45:1: PT018 [*] Assertion should be broken down into multiple parts
PT018.py:45:1: PT018 [**] Assertion should be broken down into multiple parts
|
43 | assert something # OK
44 | assert something and something_else # Error
@ -351,7 +351,7 @@ PT018.py:54:9: PT018 Assertion should be broken down into multiple parts
|
= help: Break down assertion into multiple parts
PT018.py:59:5: PT018 [*] Assertion should be broken down into multiple parts
PT018.py:59:5: PT018 [**] Assertion should be broken down into multiple parts
|
57 | # Regression test for: https://github.com/astral-sh/ruff/issues/7143
58 | def test_parenthesized_not():
@ -380,7 +380,7 @@ PT018.py:59:5: PT018 [*] Assertion should be broken down into multiple parts
65 67 | assert (not (
66 68 | self.find_graph_output(node.output[0])
PT018.py:65:5: PT018 [*] Assertion should be broken down into multiple parts
PT018.py:65:5: PT018 [**] Assertion should be broken down into multiple parts
|
63 | )
64 |

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs
---
PT026.py:19:1: PT026 [*] Useless `pytest.mark.usefixtures` without parameters
PT026.py:19:1: PT026 [**] Useless `pytest.mark.usefixtures` without parameters
|
19 | @pytest.mark.usefixtures()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ PT026
@ -20,7 +20,7 @@ PT026.py:19:1: PT026 [*] Useless `pytest.mark.usefixtures` without parameters
21 21 | pass
22 22 |
PT026.py:24:1: PT026 [*] Useless `pytest.mark.usefixtures` without parameters
PT026.py:24:1: PT026 [**] Useless `pytest.mark.usefixtures` without parameters
|
24 | @pytest.mark.usefixtures
| ^^^^^^^^^^^^^^^^^^^^^^^^ PT026

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs
---
PT027_0.py:6:14: PT027 [*] Use `pytest.raises` instead of unittest-style `assertRaises`
PT027_0.py:6:14: PT027 [**] Use `pytest.raises` instead of unittest-style `assertRaises`
|
4 | class Test(unittest.TestCase):
5 | def test_errors(self):
@ -25,7 +25,7 @@ PT027_0.py:6:14: PT027 [*] Use `pytest.raises` instead of unittest-style `assert
8 9 | with self.assertRaises(expected_exception=ValueError):
9 10 | raise ValueError
PT027_0.py:8:14: PT027 [*] Use `pytest.raises` instead of unittest-style `assertRaises`
PT027_0.py:8:14: PT027 [**] Use `pytest.raises` instead of unittest-style `assertRaises`
|
6 | with self.assertRaises(ValueError):
7 | raise ValueError
@ -50,7 +50,7 @@ PT027_0.py:8:14: PT027 [*] Use `pytest.raises` instead of unittest-style `assert
10 11 |
11 12 | with self.failUnlessRaises(ValueError):
PT027_0.py:11:14: PT027 [*] Use `pytest.raises` instead of unittest-style `failUnlessRaises`
PT027_0.py:11:14: PT027 [**] Use `pytest.raises` instead of unittest-style `failUnlessRaises`
|
9 | raise ValueError
10 |
@ -76,7 +76,7 @@ PT027_0.py:11:14: PT027 [*] Use `pytest.raises` instead of unittest-style `failU
13 14 |
14 15 | with self.assertRaisesRegex(ValueError, "test"):
PT027_0.py:14:14: PT027 [*] Use `pytest.raises` instead of unittest-style `assertRaisesRegex`
PT027_0.py:14:14: PT027 [**] Use `pytest.raises` instead of unittest-style `assertRaisesRegex`
|
12 | raise ValueError
13 |
@ -102,7 +102,7 @@ PT027_0.py:14:14: PT027 [*] Use `pytest.raises` instead of unittest-style `asser
16 17 |
17 18 | with self.assertRaisesRegex(ValueError, expected_regex="test"):
PT027_0.py:17:14: PT027 [*] Use `pytest.raises` instead of unittest-style `assertRaisesRegex`
PT027_0.py:17:14: PT027 [**] Use `pytest.raises` instead of unittest-style `assertRaisesRegex`
|
15 | raise ValueError("test")
16 |
@ -128,7 +128,7 @@ PT027_0.py:17:14: PT027 [*] Use `pytest.raises` instead of unittest-style `asser
19 20 |
20 21 | with self.assertRaisesRegex(
PT027_0.py:20:14: PT027 [*] Use `pytest.raises` instead of unittest-style `assertRaisesRegex`
PT027_0.py:20:14: PT027 [**] Use `pytest.raises` instead of unittest-style `assertRaisesRegex`
|
18 | raise ValueError("test")
19 |
@ -157,7 +157,7 @@ PT027_0.py:20:14: PT027 [*] Use `pytest.raises` instead of unittest-style `asser
24 23 |
25 24 | with self.assertRaisesRegex(
PT027_0.py:25:14: PT027 [*] Use `pytest.raises` instead of unittest-style `assertRaisesRegex`
PT027_0.py:25:14: PT027 [**] Use `pytest.raises` instead of unittest-style `assertRaisesRegex`
|
23 | raise ValueError("test")
24 |
@ -186,7 +186,7 @@ PT027_0.py:25:14: PT027 [*] Use `pytest.raises` instead of unittest-style `asser
29 28 |
30 29 | with self.assertRaisesRegexp(ValueError, "test"):
PT027_0.py:30:14: PT027 [*] Use `pytest.raises` instead of unittest-style `assertRaisesRegexp`
PT027_0.py:30:14: PT027 [**] Use `pytest.raises` instead of unittest-style `assertRaisesRegexp`
|
28 | raise ValueError("test")
29 |

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs
---
PT027_1.py:11:14: PT027 [*] Use `pytest.raises` instead of unittest-style `assertRaises`
PT027_1.py:11:14: PT027 [**] Use `pytest.raises` instead of unittest-style `assertRaises`
|
10 | def test_errors(self):
11 | with self.assertRaises(ValueError):

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_return/mod.rs
---
RET503.py:20:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value
RET503.py:20:5: RET503 [**] Missing explicit `return` at the end of function able to return non-`None` value
|
18 | # if/elif/else
19 | def x(y):
@ -22,7 +22,7 @@ RET503.py:20:5: RET503 [*] Missing explicit `return` at the end of function able
23 24 |
24 25 |
RET503.py:27:9: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value
RET503.py:27:9: RET503 [**] Missing explicit `return` at the end of function able to return non-`None` value
|
25 | def x(y):
26 | if not y:
@ -42,7 +42,7 @@ RET503.py:27:9: RET503 [*] Missing explicit `return` at the end of function able
29 30 | return 2
30 31 |
RET503.py:36:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value
RET503.py:36:5: RET503 [**] Missing explicit `return` at the end of function able to return non-`None` value
|
34 | return 1
35 |
@ -60,7 +60,7 @@ RET503.py:36:5: RET503 [*] Missing explicit `return` at the end of function able
38 39 |
39 40 | # for
RET503.py:41:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value
RET503.py:41:5: RET503 [**] Missing explicit `return` at the end of function able to return non-`None` value
|
39 | # for
40 | def x(y):
@ -82,7 +82,7 @@ RET503.py:41:5: RET503 [*] Missing explicit `return` at the end of function able
45 46 |
46 47 |
RET503.py:52:9: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value
RET503.py:52:9: RET503 [**] Missing explicit `return` at the end of function able to return non-`None` value
|
50 | return i
51 | else:
@ -100,7 +100,7 @@ RET503.py:52:9: RET503 [*] Missing explicit `return` at the end of function able
54 55 |
55 56 | # A nonexistent function
RET503.py:59:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value
RET503.py:59:5: RET503 [**] Missing explicit `return` at the end of function able to return non-`None` value
|
57 | if x > 0:
58 | return False
@ -118,7 +118,7 @@ RET503.py:59:5: RET503 [*] Missing explicit `return` at the end of function able
61 62 |
62 63 | # A function that does return the control
RET503.py:66:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value
RET503.py:66:5: RET503 [**] Missing explicit `return` at the end of function able to return non-`None` value
|
64 | if x > 0:
65 | return False
@ -136,7 +136,7 @@ RET503.py:66:5: RET503 [*] Missing explicit `return` at the end of function able
68 69 |
69 70 | ###
RET503.py:82:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value
RET503.py:82:5: RET503 [**] Missing explicit `return` at the end of function able to return non-`None` value
|
80 | # last line in while loop
81 | def x(y):
@ -158,7 +158,7 @@ RET503.py:82:5: RET503 [*] Missing explicit `return` at the end of function able
87 88 |
88 89 | # exclude empty functions
RET503.py:113:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value
RET503.py:113:5: RET503 [**] Missing explicit `return` at the end of function able to return non-`None` value
|
111 | # return value within loop
112 | def bar1(x, y, z):
@ -180,7 +180,7 @@ RET503.py:113:5: RET503 [*] Missing explicit `return` at the end of function abl
118 119 |
119 120 | def bar3(x, y, z):
RET503.py:120:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value
RET503.py:120:5: RET503 [**] Missing explicit `return` at the end of function able to return non-`None` value
|
119 | def bar3(x, y, z):
120 | for i in x:
@ -204,7 +204,7 @@ RET503.py:120:5: RET503 [*] Missing explicit `return` at the end of function abl
128 129 |
129 130 | def bar1(x, y, z):
RET503.py:130:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value
RET503.py:130:5: RET503 [**] Missing explicit `return` at the end of function able to return non-`None` value
|
129 | def bar1(x, y, z):
130 | for i in x:
@ -225,7 +225,7 @@ RET503.py:130:5: RET503 [*] Missing explicit `return` at the end of function abl
135 136 |
136 137 | def bar3(x, y, z):
RET503.py:137:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value
RET503.py:137:5: RET503 [**] Missing explicit `return` at the end of function able to return non-`None` value
|
136 | def bar3(x, y, z):
137 | for i in x:
@ -249,7 +249,7 @@ RET503.py:137:5: RET503 [*] Missing explicit `return` at the end of function abl
145 146 |
146 147 | def prompts(self, foo):
RET503.py:274:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value
RET503.py:274:5: RET503 [**] Missing explicit `return` at the end of function able to return non-`None` value
|
272 | return False
273 |
@ -269,7 +269,7 @@ RET503.py:274:5: RET503 [*] Missing explicit `return` at the end of function abl
277 278 |
278 279 | def while_true():
RET503.py:291:13: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value
RET503.py:291:13: RET503 [**] Missing explicit `return` at the end of function able to return non-`None` value
|
289 | return 1
290 | case 1:
@ -287,7 +287,7 @@ RET503.py:291:13: RET503 [*] Missing explicit `return` at the end of function ab
293 294 |
294 295 | def foo(baz: str) -> str:
RET503.py:300:9: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value
RET503.py:300:9: RET503 [**] Missing explicit `return` at the end of function able to return non-`None` value
|
298 | def end_of_statement():
299 | def example():
@ -307,7 +307,7 @@ RET503.py:300:9: RET503 [*] Missing explicit `return` at the end of function abl
303 304 |
304 305 | def example():
RET503.py:305:9: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value
RET503.py:305:9: RET503 [**] Missing explicit `return` at the end of function able to return non-`None` value
|
304 | def example():
305 | if True:
@ -326,7 +326,7 @@ RET503.py:305:9: RET503 [*] Missing explicit `return` at the end of function abl
308 309 |
309 310 | def example():
RET503.py:310:9: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value
RET503.py:310:9: RET503 [**] Missing explicit `return` at the end of function able to return non-`None` value
|
309 | def example():
310 | if True:
@ -345,7 +345,7 @@ RET503.py:310:9: RET503 [*] Missing explicit `return` at the end of function abl
313 314 |
314 315 | def example():
RET503.py:315:9: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value
RET503.py:315:9: RET503 [**] Missing explicit `return` at the end of function able to return non-`None` value
|
314 | def example():
315 | if True:
@ -364,7 +364,7 @@ RET503.py:315:9: RET503 [*] Missing explicit `return` at the end of function abl
318 319 |
319 320 | def example():
RET503.py:320:9: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value
RET503.py:320:9: RET503 [**] Missing explicit `return` at the end of function able to return non-`None` value
|
319 | def example():
320 | if True:
@ -384,7 +384,7 @@ RET503.py:320:9: RET503 [*] Missing explicit `return` at the end of function abl
324 325 |
325 326 | def end_of_file():
RET503.py:328:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value
RET503.py:328:5: RET503 [**] Missing explicit `return` at the end of function able to return non-`None` value
|
326 | if False:
327 | return 1

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_return/mod.rs
---
RET504.py:6:12: RET504 [*] Unnecessary assignment to `a` before `return` statement
RET504.py:6:12: RET504 [**] Unnecessary assignment to `a` before `return` statement
|
4 | def x():
5 | a = 1
@ -21,7 +21,7 @@ RET504.py:6:12: RET504 [*] Unnecessary assignment to `a` before `return` stateme
8 7 |
9 8 | # Can be refactored false positives
RET504.py:23:12: RET504 [*] Unnecessary assignment to `formatted` before `return` statement
RET504.py:23:12: RET504 [**] Unnecessary assignment to `formatted` before `return` statement
|
21 | # clean up after any blank components
22 | formatted = formatted.replace("()", "").replace(" ", " ").strip()
@ -41,7 +41,7 @@ RET504.py:23:12: RET504 [*] Unnecessary assignment to `formatted` before `return
25 24 |
26 25 | # https://github.com/afonasev/flake8-return/issues/47#issue-641117366
RET504.py:246:12: RET504 [*] Unnecessary assignment to `queryset` before `return` statement
RET504.py:246:12: RET504 [**] Unnecessary assignment to `queryset` before `return` statement
|
244 | queryset = Model.filter(a=1)
245 | queryset = queryset.filter(c=3)
@ -61,7 +61,7 @@ RET504.py:246:12: RET504 [*] Unnecessary assignment to `queryset` before `return
248 247 |
249 248 | def get_queryset():
RET504.py:251:12: RET504 [*] Unnecessary assignment to `queryset` before `return` statement
RET504.py:251:12: RET504 [**] Unnecessary assignment to `queryset` before `return` statement
|
249 | def get_queryset():
250 | queryset = Model.filter(a=1)
@ -81,7 +81,7 @@ RET504.py:251:12: RET504 [*] Unnecessary assignment to `queryset` before `return
253 252 |
254 253 | # Function arguments
RET504.py:269:12: RET504 [*] Unnecessary assignment to `val` before `return` statement
RET504.py:269:12: RET504 [**] Unnecessary assignment to `val` before `return` statement
|
267 | return val
268 | val = 1
@ -101,7 +101,7 @@ RET504.py:269:12: RET504 [*] Unnecessary assignment to `val` before `return` sta
271 270 |
272 271 | def str_to_bool(val):
RET504.py:321:12: RET504 [*] Unnecessary assignment to `x` before `return` statement
RET504.py:321:12: RET504 [**] Unnecessary assignment to `x` before `return` statement
|
319 | with open("foo.txt", "r") as f:
320 | x = f.read()
@ -121,7 +121,7 @@ RET504.py:321:12: RET504 [*] Unnecessary assignment to `x` before `return` state
323 322 |
324 323 | def foo():
RET504.py:342:12: RET504 [*] Unnecessary assignment to `b` before `return` statement
RET504.py:342:12: RET504 [**] Unnecessary assignment to `b` before `return` statement
|
340 | a = 1
341 | b=a
@ -141,7 +141,7 @@ RET504.py:342:12: RET504 [*] Unnecessary assignment to `b` before `return` state
344 343 |
345 344 | def foo():
RET504.py:348:12: RET504 [*] Unnecessary assignment to `b` before `return` statement
RET504.py:348:12: RET504 [**] Unnecessary assignment to `b` before `return` statement
|
346 | a = 1
347 | b =a
@ -161,7 +161,7 @@ RET504.py:348:12: RET504 [*] Unnecessary assignment to `b` before `return` state
350 349 |
351 350 | def foo():
RET504.py:354:12: RET504 [*] Unnecessary assignment to `b` before `return` statement
RET504.py:354:12: RET504 [**] Unnecessary assignment to `b` before `return` statement
|
352 | a = 1
353 | b= a
@ -181,7 +181,7 @@ RET504.py:354:12: RET504 [*] Unnecessary assignment to `b` before `return` state
356 355 |
357 356 | def foo():
RET504.py:359:12: RET504 [*] Unnecessary assignment to `a` before `return` statement
RET504.py:359:12: RET504 [**] Unnecessary assignment to `a` before `return` statement
|
357 | def foo():
358 | a = 1 # Comment
@ -201,7 +201,7 @@ RET504.py:359:12: RET504 [*] Unnecessary assignment to `a` before `return` state
361 360 |
362 361 | # Regression test for: https://github.com/astral-sh/ruff/issues/7098
RET504.py:365:12: RET504 [*] Unnecessary assignment to `D` before `return` statement
RET504.py:365:12: RET504 [**] Unnecessary assignment to `D` before `return` statement
|
363 | def mavko_debari(P_kbar):
364 | D=0.4853881 + 3.6006116*P - 0.0117368*(P-1.3822)**2

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs
---
SIM101.py:1:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a single call
SIM101.py:1:4: SIM101 [**] Multiple `isinstance` calls for `a`, merge into a single call
|
1 | if isinstance(a, int) or isinstance(a, float): # SIM101
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SIM101
@ -16,7 +16,7 @@ SIM101.py:1:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a sing
3 3 |
4 4 | if isinstance(a, (int, float)) or isinstance(a, bool): # SIM101
SIM101.py:4:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a single call
SIM101.py:4:4: SIM101 [**] Multiple `isinstance` calls for `a`, merge into a single call
|
2 | pass
3 |
@ -36,7 +36,7 @@ SIM101.py:4:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a sing
6 6 |
7 7 | if isinstance(a, int) or isinstance(a, float) or isinstance(b, bool): # SIM101
SIM101.py:7:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a single call
SIM101.py:7:4: SIM101 [**] Multiple `isinstance` calls for `a`, merge into a single call
|
5 | pass
6 |
@ -56,7 +56,7 @@ SIM101.py:7:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a sing
9 9 |
10 10 | if isinstance(b, bool) or isinstance(a, int) or isinstance(a, float): # SIM101
SIM101.py:10:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a single call
SIM101.py:10:4: SIM101 [**] Multiple `isinstance` calls for `a`, merge into a single call
|
8 | pass
9 |
@ -76,7 +76,7 @@ SIM101.py:10:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a sin
12 12 |
13 13 | if isinstance(a, int) or isinstance(b, bool) or isinstance(a, float): # SIM101
SIM101.py:13:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a single call
SIM101.py:13:4: SIM101 [**] Multiple `isinstance` calls for `a`, merge into a single call
|
11 | pass
12 |
@ -96,7 +96,7 @@ SIM101.py:13:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a sin
15 15 |
16 16 | if (isinstance(a, int) or isinstance(a, float)) and isinstance(b, bool): # SIM101
SIM101.py:16:5: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a single call
SIM101.py:16:5: SIM101 [**] Multiple `isinstance` calls for `a`, merge into a single call
|
14 | pass
15 |
@ -116,7 +116,7 @@ SIM101.py:16:5: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a sin
18 18 |
19 19 | if isinstance(a.b, int) or isinstance(a.b, float): # SIM101
SIM101.py:19:4: SIM101 [*] Multiple `isinstance` calls for expression, merge into a single call
SIM101.py:19:4: SIM101 [**] Multiple `isinstance` calls for expression, merge into a single call
|
17 | pass
18 |

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs
---
SIM102.py:2:1: SIM102 [*] Use a single `if` statement instead of nested `if` statements
SIM102.py:2:1: SIM102 [**] Use a single `if` statement instead of nested `if` statements
|
1 | # SIM102
2 | / if a:
@ -22,7 +22,7 @@ SIM102.py:2:1: SIM102 [*] Use a single `if` statement instead of nested `if` sta
6 5 | # SIM102
7 6 | if a:
SIM102.py:7:1: SIM102 [*] Use a single `if` statement instead of nested `if` statements
SIM102.py:7:1: SIM102 [**] Use a single `if` statement instead of nested `if` statements
|
6 | # SIM102
7 | / if a:
@ -48,7 +48,7 @@ SIM102.py:7:1: SIM102 [*] Use a single `if` statement instead of nested `if` sta
12 11 | # SIM102
13 12 | if a:
SIM102.py:8:5: SIM102 [*] Use a single `if` statement instead of nested `if` statements
SIM102.py:8:5: SIM102 [**] Use a single `if` statement instead of nested `if` statements
|
6 | # SIM102
7 | if a:
@ -73,7 +73,7 @@ SIM102.py:8:5: SIM102 [*] Use a single `if` statement instead of nested `if` sta
12 11 | # SIM102
13 12 | if a:
SIM102.py:15:1: SIM102 [*] Use a single `if` statement instead of nested `if` statements
SIM102.py:15:1: SIM102 [**] Use a single `if` statement instead of nested `if` statements
|
13 | if a:
14 | pass
@ -108,7 +108,7 @@ SIM102.py:20:1: SIM102 Use a single `if` statement instead of nested `if` statem
|
= help: Combine `if` statements using `and`
SIM102.py:26:1: SIM102 [*] Use a single `if` statement instead of nested `if` statements
SIM102.py:26:1: SIM102 [**] Use a single `if` statement instead of nested `if` statements
|
25 | # SIM102
26 | / if a:
@ -134,7 +134,7 @@ SIM102.py:26:1: SIM102 [*] Use a single `if` statement instead of nested `if` st
31 30 | # OK
32 31 | if a:
SIM102.py:51:5: SIM102 [*] Use a single `if` statement instead of nested `if` statements
SIM102.py:51:5: SIM102 [**] Use a single `if` statement instead of nested `if` statements
|
49 | while x > 0:
50 | # SIM102
@ -172,7 +172,7 @@ SIM102.py:51:5: SIM102 [*] Use a single `if` statement instead of nested `if` st
64 63 |
65 64 |
SIM102.py:67:1: SIM102 [*] Use a single `if` statement instead of nested `if` statements
SIM102.py:67:1: SIM102 [**] Use a single `if` statement instead of nested `if` statements
|
66 | # SIM102
67 | / if x > 0:
@ -208,7 +208,7 @@ SIM102.py:67:1: SIM102 [*] Use a single `if` statement instead of nested `if` st
80 79 |
81 80 | while x > 0:
SIM102.py:83:5: SIM102 [*] Use a single `if` statement instead of nested `if` statements
SIM102.py:83:5: SIM102 [**] Use a single `if` statement instead of nested `if` statements
|
81 | while x > 0:
82 | # SIM102
@ -239,7 +239,7 @@ SIM102.py:83:5: SIM102 [*] Use a single `if` statement instead of nested `if` st
89 88 | # SIM102 (auto-fixable)
90 89 | if node.module012345678:
SIM102.py:90:1: SIM102 [*] Use a single `if` statement instead of nested `if` statements
SIM102.py:90:1: SIM102 [**] Use a single `if` statement instead of nested `if` statements
|
89 | # SIM102 (auto-fixable)
90 | / if node.module012345678:
@ -280,7 +280,7 @@ SIM102.py:97:1: SIM102 Use a single `if` statement instead of nested `if` statem
|
= help: Combine `if` statements using `and`
SIM102.py:106:5: SIM102 [*] Use a single `if` statement instead of nested `if` statements
SIM102.py:106:5: SIM102 [**] Use a single `if` statement instead of nested `if` statements
|
104 | # Regression test for https://github.com/apache/airflow/blob/145b16caaa43f0c42bffd97344df916c602cddde/airflow/configuration.py#L1161
105 | if a:
@ -306,7 +306,7 @@ SIM102.py:106:5: SIM102 [*] Use a single `if` statement instead of nested `if` s
110 109 | print("elif")
111 110 |
SIM102.py:132:5: SIM102 [*] Use a single `if` statement instead of nested `if` statements
SIM102.py:132:5: SIM102 [**] Use a single `if` statement instead of nested `if` statements
|
130 | if a:
131 | # SIM 102
@ -332,7 +332,7 @@ SIM102.py:132:5: SIM102 [*] Use a single `if` statement instead of nested `if` s
136 135 | print("bar")
137 136 |
SIM102.py:165:5: SIM102 [*] Use a single `if` statement instead of nested `if` statements
SIM102.py:165:5: SIM102 [**] Use a single `if` statement instead of nested `if` statements
|
163 | if a:
164 | pass

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs
---
SIM103.py:3:5: SIM103 [*] Return the condition `a` directly
SIM103.py:3:5: SIM103 [**] Return the condition `a` directly
|
1 | def f():
2 | # SIM103
@ -26,7 +26,7 @@ SIM103.py:3:5: SIM103 [*] Return the condition `a` directly
8 5 |
9 6 | def f():
SIM103.py:11:5: SIM103 [*] Return the condition `a == b` directly
SIM103.py:11:5: SIM103 [**] Return the condition `a == b` directly
|
9 | def f():
10 | # SIM103
@ -52,7 +52,7 @@ SIM103.py:11:5: SIM103 [*] Return the condition `a == b` directly
16 13 |
17 14 | def f():
SIM103.py:21:5: SIM103 [*] Return the condition `b` directly
SIM103.py:21:5: SIM103 [**] Return the condition `b` directly
|
19 | if a:
20 | return 1
@ -78,7 +78,7 @@ SIM103.py:21:5: SIM103 [*] Return the condition `b` directly
26 23 |
27 24 | def f():
SIM103.py:32:9: SIM103 [*] Return the condition `b` directly
SIM103.py:32:9: SIM103 [**] Return the condition `b` directly
|
30 | return 1
31 | else:

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs
---
SIM105_0.py:6:1: SIM105 [*] Use `contextlib.suppress(ValueError)` instead of `try`-`except`-`pass`
SIM105_0.py:6:1: SIM105 [**] Use `contextlib.suppress(ValueError)` instead of `try`-`except`-`pass`
|
5 | # SIM105
6 | / try:
@ -28,7 +28,7 @@ SIM105_0.py:6:1: SIM105 [*] Use `contextlib.suppress(ValueError)` instead of `tr
11 10 |
12 11 | # SIM105
SIM105_0.py:13:1: SIM105 [*] Use `contextlib.suppress(ValueError, OSError)` instead of `try`-`except`-`pass`
SIM105_0.py:13:1: SIM105 [**] Use `contextlib.suppress(ValueError, OSError)` instead of `try`-`except`-`pass`
|
12 | # SIM105
13 | / try:
@ -59,7 +59,7 @@ SIM105_0.py:13:1: SIM105 [*] Use `contextlib.suppress(ValueError, OSError)` inst
18 17 | # SIM105
19 18 | try:
SIM105_0.py:19:1: SIM105 [*] Use `contextlib.suppress(ValueError, OSError)` instead of `try`-`except`-`pass`
SIM105_0.py:19:1: SIM105 [**] Use `contextlib.suppress(ValueError, OSError)` instead of `try`-`except`-`pass`
|
18 | # SIM105
19 | / try:
@ -90,7 +90,7 @@ SIM105_0.py:19:1: SIM105 [*] Use `contextlib.suppress(ValueError, OSError)` inst
24 23 | # SIM105
25 24 | try:
SIM105_0.py:25:1: SIM105 [*] Use `contextlib.suppress(Exception)` instead of `try`-`except`-`pass`
SIM105_0.py:25:1: SIM105 [**] Use `contextlib.suppress(Exception)` instead of `try`-`except`-`pass`
|
24 | # SIM105
25 | / try:
@ -121,7 +121,7 @@ SIM105_0.py:25:1: SIM105 [*] Use `contextlib.suppress(Exception)` instead of `tr
30 29 | # SIM105
31 30 | try:
SIM105_0.py:31:1: SIM105 [*] Use `contextlib.suppress(a.Error, b.Error)` instead of `try`-`except`-`pass`
SIM105_0.py:31:1: SIM105 [**] Use `contextlib.suppress(a.Error, b.Error)` instead of `try`-`except`-`pass`
|
30 | # SIM105
31 | / try:
@ -152,7 +152,7 @@ SIM105_0.py:31:1: SIM105 [*] Use `contextlib.suppress(a.Error, b.Error)` instead
36 35 | # OK
37 36 | try:
SIM105_0.py:85:5: SIM105 [*] Use `contextlib.suppress(ValueError)` instead of `try`-`except`-`pass`
SIM105_0.py:85:5: SIM105 [**] Use `contextlib.suppress(ValueError)` instead of `try`-`except`-`pass`
|
83 | def with_ellipsis():
84 | # OK
@ -197,7 +197,7 @@ SIM105_0.py:100:5: SIM105 Use `contextlib.suppress(ValueError, OSError)` instead
|
= help: Replace with `contextlib.suppress(ValueError, OSError)`
SIM105_0.py:117:5: SIM105 [*] Use `contextlib.suppress(OSError)` instead of `try`-`except`-`pass`
SIM105_0.py:117:5: SIM105 [**] Use `contextlib.suppress(OSError)` instead of `try`-`except`-`pass`
|
115 | # Regression test for: https://github.com/astral-sh/ruff/issues/7123
116 | def write_models(directory, Models):
@ -230,7 +230,7 @@ SIM105_0.py:117:5: SIM105 [*] Use `contextlib.suppress(OSError)` instead of `try
122 121 | try: os.makedirs(model_dir);
123 122 | except OSError:
SIM105_0.py:122:5: SIM105 [*] Use `contextlib.suppress(OSError)` instead of `try`-`except`-`pass`
SIM105_0.py:122:5: SIM105 [**] Use `contextlib.suppress(OSError)` instead of `try`-`except`-`pass`
|
120 | pass;
121 |
@ -261,7 +261,7 @@ SIM105_0.py:122:5: SIM105 [*] Use `contextlib.suppress(OSError)` instead of `try
126 125 | try: os.makedirs(model_dir);
127 126 | except OSError:
SIM105_0.py:126:5: SIM105 [*] Use `contextlib.suppress(OSError)` instead of `try`-`except`-`pass`
SIM105_0.py:126:5: SIM105 [**] Use `contextlib.suppress(OSError)` instead of `try`-`except`-`pass`
|
124 | pass;
125 |

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs
---
SIM105_1.py:5:1: SIM105 [*] Use `contextlib.suppress(ValueError)` instead of `try`-`except`-`pass`
SIM105_1.py:5:1: SIM105 [**] Use `contextlib.suppress(ValueError)` instead of `try`-`except`-`pass`
|
4 | # SIM105
5 | / try:

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs
---
SIM105_2.py:10:1: SIM105 [*] Use `contextlib.suppress(ValueError)` instead of `try`-`except`-`pass`
SIM105_2.py:10:1: SIM105 [**] Use `contextlib.suppress(ValueError)` instead of `try`-`except`-`pass`
|
9 | # SIM105
10 | / try:

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs
---
SIM105_4.py:2:1: SIM105 [*] Use `contextlib.suppress(ImportError)` instead of `try`-`except`-`pass`
SIM105_4.py:2:1: SIM105 [**] Use `contextlib.suppress(ImportError)` instead of `try`-`except`-`pass`
|
1 | #!/usr/bin/env python
2 | / try:

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs
---
SIM108.py:2:1: SIM108 [*] Use ternary operator `b = c if a else d` instead of `if`-`else`-block
SIM108.py:2:1: SIM108 [**] Use ternary operator `b = c if a else d` instead of `if`-`else`-block
|
1 | # SIM108
2 | / if a:
@ -25,7 +25,7 @@ SIM108.py:2:1: SIM108 [*] Use ternary operator `b = c if a else d` instead of `i
7 4 | # OK
8 5 | b = c if a else d
SIM108.py:30:5: SIM108 [*] Use ternary operator `b = 1 if a else 2` instead of `if`-`else`-block
SIM108.py:30:5: SIM108 [**] Use ternary operator `b = 1 if a else 2` instead of `if`-`else`-block
|
28 | pass
29 | else:
@ -64,7 +64,7 @@ SIM108.py:58:1: SIM108 Use ternary operator `abc = x if x > 0 else -x` instead o
|
= help: Replace `if`-`else`-block with `abc = x if x > 0 else -x`
SIM108.py:82:1: SIM108 [*] Use ternary operator `b = "cccccccccccccccccccccccccccccccccß" if a else "ddddddddddddddddddddddddddddddddd💣"` instead of `if`-`else`-block
SIM108.py:82:1: SIM108 [**] Use ternary operator `b = "cccccccccccccccccccccccccccccccccß" if a else "ddddddddddddddddddddddddddddddddd💣"` instead of `if`-`else`-block
|
81 | # SIM108
82 | / if a:

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs
---
SIM109.py:2:4: SIM109 [*] Use `a in (b, c)` instead of multiple equality comparisons
SIM109.py:2:4: SIM109 [**] Use `a in (b, c)` instead of multiple equality comparisons
|
1 | # SIM109
2 | if a == b or a == c:
@ -18,7 +18,7 @@ SIM109.py:2:4: SIM109 [*] Use `a in (b, c)` instead of multiple equality compari
4 4 |
5 5 | # SIM109
SIM109.py:6:5: SIM109 [*] Use `a in (b, c)` instead of multiple equality comparisons
SIM109.py:6:5: SIM109 [**] Use `a in (b, c)` instead of multiple equality comparisons
|
5 | # SIM109
6 | if (a == b or a == c) and None:
@ -37,7 +37,7 @@ SIM109.py:6:5: SIM109 [*] Use `a in (b, c)` instead of multiple equality compari
8 8 |
9 9 | # SIM109
SIM109.py:10:4: SIM109 [*] Use `a in (b, c)` instead of multiple equality comparisons
SIM109.py:10:4: SIM109 [**] Use `a in (b, c)` instead of multiple equality comparisons
|
9 | # SIM109
10 | if a == b or a == c or None:
@ -56,7 +56,7 @@ SIM109.py:10:4: SIM109 [*] Use `a in (b, c)` instead of multiple equality compar
12 12 |
13 13 | # SIM109
SIM109.py:14:4: SIM109 [*] Use `a in (b, c)` instead of multiple equality comparisons
SIM109.py:14:4: SIM109 [**] Use `a in (b, c)` instead of multiple equality comparisons
|
13 | # SIM109
14 | if a == b or None or a == c:

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs
---
SIM110.py:3:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead of `for` loop
SIM110.py:3:5: SIM110 [**] Use `return any(check(x) for x in iterable)` instead of `for` loop
|
1 | def f():
2 | # SIM110
@ -26,7 +26,7 @@ SIM110.py:3:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead o
8 5 |
9 6 | def f():
SIM110.py:25:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` instead of `for` loop
SIM110.py:25:5: SIM110 [**] Use `return all(not check(x) for x in iterable)` instead of `for` loop
|
23 | def f():
24 | # SIM111
@ -52,7 +52,7 @@ SIM110.py:25:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` inst
30 27 |
31 28 | def f():
SIM110.py:33:5: SIM110 [*] Use `return all(x.is_empty() for x in iterable)` instead of `for` loop
SIM110.py:33:5: SIM110 [**] Use `return all(x.is_empty() for x in iterable)` instead of `for` loop
|
31 | def f():
32 | # SIM111
@ -78,7 +78,7 @@ SIM110.py:33:5: SIM110 [*] Use `return all(x.is_empty() for x in iterable)` inst
38 35 |
39 36 | def f():
SIM110.py:55:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead of `for` loop
SIM110.py:55:5: SIM110 [**] Use `return any(check(x) for x in iterable)` instead of `for` loop
|
53 | def f():
54 | # SIM110
@ -106,7 +106,7 @@ SIM110.py:55:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead
61 57 |
62 58 | def f():
SIM110.py:64:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` instead of `for` loop
SIM110.py:64:5: SIM110 [**] Use `return all(not check(x) for x in iterable)` instead of `for` loop
|
62 | def f():
63 | # SIM111
@ -134,7 +134,7 @@ SIM110.py:64:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` inst
70 66 |
71 67 | def f():
SIM110.py:73:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead of `for` loop
SIM110.py:73:5: SIM110 [**] Use `return any(check(x) for x in iterable)` instead of `for` loop
|
71 | def f():
72 | # SIM110
@ -163,7 +163,7 @@ SIM110.py:73:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead
79 75 |
80 76 |
SIM110.py:83:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` instead of `for` loop
SIM110.py:83:5: SIM110 [**] Use `return all(not check(x) for x in iterable)` instead of `for` loop
|
81 | def f():
82 | # SIM111
@ -218,7 +218,7 @@ SIM110.py:134:5: SIM110 Use `return all(not check(x) for x in iterable)` instead
|
= help: Replace with `return all(not check(x) for x in iterable)`
SIM110.py:144:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead of `for` loop
SIM110.py:144:5: SIM110 [**] Use `return any(check(x) for x in iterable)` instead of `for` loop
|
143 | # SIM110
144 | for x in iterable:
@ -243,7 +243,7 @@ SIM110.py:144:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead
149 146 |
150 147 | def f():
SIM110.py:154:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` instead of `for` loop
SIM110.py:154:5: SIM110 [**] Use `return all(not check(x) for x in iterable)` instead of `for` loop
|
153 | # SIM111
154 | for x in iterable:
@ -268,7 +268,7 @@ SIM110.py:154:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` ins
159 156 |
160 157 | def f():
SIM110.py:162:5: SIM110 [*] Use `return any(x.isdigit() for x in "012ß9💣29012ß9💣29012ß9💣29012ß9💣29012ß9💣2")` instead of `for` loop
SIM110.py:162:5: SIM110 [**] Use `return any(x.isdigit() for x in "012ß9💣29012ß9💣29012ß9💣29012ß9💣29012ß9💣2")` instead of `for` loop
|
160 | def f():
161 | # SIM110
@ -294,7 +294,7 @@ SIM110.py:162:5: SIM110 [*] Use `return any(x.isdigit() for x in "012ß9💣2
167 164 |
168 165 | def f():
SIM110.py:184:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead of `for` loop
SIM110.py:184:5: SIM110 [**] Use `return any(check(x) for x in iterable)` instead of `for` loop
|
182 | async def f():
183 | # SIM110

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs
---
SIM111.py:3:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead of `for` loop
SIM111.py:3:5: SIM110 [**] Use `return any(check(x) for x in iterable)` instead of `for` loop
|
1 | def f():
2 | # SIM110
@ -26,7 +26,7 @@ SIM111.py:3:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead o
8 5 |
9 6 | def f():
SIM111.py:25:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` instead of `for` loop
SIM111.py:25:5: SIM110 [**] Use `return all(not check(x) for x in iterable)` instead of `for` loop
|
23 | def f():
24 | # SIM111
@ -52,7 +52,7 @@ SIM111.py:25:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` inst
30 27 |
31 28 | def f():
SIM111.py:33:5: SIM110 [*] Use `return all(x.is_empty() for x in iterable)` instead of `for` loop
SIM111.py:33:5: SIM110 [**] Use `return all(x.is_empty() for x in iterable)` instead of `for` loop
|
31 | def f():
32 | # SIM111
@ -78,7 +78,7 @@ SIM111.py:33:5: SIM110 [*] Use `return all(x.is_empty() for x in iterable)` inst
38 35 |
39 36 | def f():
SIM111.py:55:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead of `for` loop
SIM111.py:55:5: SIM110 [**] Use `return any(check(x) for x in iterable)` instead of `for` loop
|
53 | def f():
54 | # SIM110
@ -106,7 +106,7 @@ SIM111.py:55:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead
61 57 |
62 58 | def f():
SIM111.py:64:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` instead of `for` loop
SIM111.py:64:5: SIM110 [**] Use `return all(not check(x) for x in iterable)` instead of `for` loop
|
62 | def f():
63 | # SIM111
@ -134,7 +134,7 @@ SIM111.py:64:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` inst
70 66 |
71 67 | def f():
SIM111.py:73:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead of `for` loop
SIM111.py:73:5: SIM110 [**] Use `return any(check(x) for x in iterable)` instead of `for` loop
|
71 | def f():
72 | # SIM110
@ -163,7 +163,7 @@ SIM111.py:73:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead
79 75 |
80 76 |
SIM111.py:83:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` instead of `for` loop
SIM111.py:83:5: SIM110 [**] Use `return all(not check(x) for x in iterable)` instead of `for` loop
|
81 | def f():
82 | # SIM111
@ -218,7 +218,7 @@ SIM111.py:134:5: SIM110 Use `return all(not check(x) for x in iterable)` instead
|
= help: Replace with `return all(not check(x) for x in iterable)`
SIM111.py:144:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead of `for` loop
SIM111.py:144:5: SIM110 [**] Use `return any(check(x) for x in iterable)` instead of `for` loop
|
143 | # SIM110
144 | for x in iterable:
@ -243,7 +243,7 @@ SIM111.py:144:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead
149 146 |
150 147 | def f():
SIM111.py:154:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` instead of `for` loop
SIM111.py:154:5: SIM110 [**] Use `return all(not check(x) for x in iterable)` instead of `for` loop
|
153 | # SIM111
154 | for x in iterable:
@ -268,7 +268,7 @@ SIM111.py:154:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` ins
159 156 |
160 157 | def f():
SIM111.py:162:5: SIM110 [*] Use `return all(x in y for x in iterable)` instead of `for` loop
SIM111.py:162:5: SIM110 [**] Use `return all(x in y for x in iterable)` instead of `for` loop
|
160 | def f():
161 | # SIM111
@ -294,7 +294,7 @@ SIM111.py:162:5: SIM110 [*] Use `return all(x in y for x in iterable)` instead o
167 164 |
168 165 | def f():
SIM111.py:170:5: SIM110 [*] Use `return all(x <= y for x in iterable)` instead of `for` loop
SIM111.py:170:5: SIM110 [**] Use `return all(x <= y for x in iterable)` instead of `for` loop
|
168 | def f():
169 | # SIM111
@ -320,7 +320,7 @@ SIM111.py:170:5: SIM110 [*] Use `return all(x <= y for x in iterable)` instead o
175 172 |
176 173 | def f():
SIM111.py:178:5: SIM110 [*] Use `return all(not x.isdigit() for x in "012ß9💣29012ß9💣29012ß9💣29012ß9💣29012ß9")` instead of `for` loop
SIM111.py:178:5: SIM110 [**] Use `return all(not x.isdigit() for x in "012ß9💣29012ß9💣29012ß9💣29012ß9💣29012ß9")` instead of `for` loop
|
176 | def f():
177 | # SIM111

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs
---
SIM112.py:4:12: SIM112 [*] Use capitalized environment variable `FOO` instead of `foo`
SIM112.py:4:12: SIM112 [**] Use capitalized environment variable `FOO` instead of `foo`
|
3 | # Bad
4 | os.environ['foo']
@ -65,7 +65,7 @@ SIM112.py:12:22: SIM112 Use capitalized environment variable `FOO` instead of `f
|
= help: Replace `foo` with `FOO`
SIM112.py:14:18: SIM112 [*] Use capitalized environment variable `FOO` instead of `foo`
SIM112.py:14:18: SIM112 [**] Use capitalized environment variable `FOO` instead of `foo`
|
12 | env = os.environ.get('foo')
13 |
@ -96,7 +96,7 @@ SIM112.py:16:26: SIM112 Use capitalized environment variable `FOO` instead of `f
|
= help: Replace `foo` with `FOO`
SIM112.py:19:22: SIM112 [*] Use capitalized environment variable `FOO` instead of `foo`
SIM112.py:19:22: SIM112 [**] Use capitalized environment variable `FOO` instead of `foo`
|
17 | pass
18 |

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs
---
SIM117.py:2:1: SIM117 [*] Use a single `with` statement with multiple contexts instead of nested `with` statements
SIM117.py:2:1: SIM117 [**] Use a single `with` statement with multiple contexts instead of nested `with` statements
|
1 | # SIM117
2 | / with A() as a:
@ -22,7 +22,7 @@ SIM117.py:2:1: SIM117 [*] Use a single `with` statement with multiple contexts i
6 5 | # SIM117
7 6 | with A():
SIM117.py:7:1: SIM117 [*] Use a single `with` statement with multiple contexts instead of nested `with` statements
SIM117.py:7:1: SIM117 [**] Use a single `with` statement with multiple contexts instead of nested `with` statements
|
6 | # SIM117
7 | / with A():
@ -59,7 +59,7 @@ SIM117.py:13:1: SIM117 Use a single `with` statement with multiple contexts inst
|
= help: Combine `with` statements
SIM117.py:19:1: SIM117 [*] Use a single `with` statement with multiple contexts instead of nested `with` statements
SIM117.py:19:1: SIM117 [**] Use a single `with` statement with multiple contexts instead of nested `with` statements
|
18 | # SIM117
19 | / with A() as a:
@ -85,7 +85,7 @@ SIM117.py:19:1: SIM117 [*] Use a single `with` statement with multiple contexts
24 23 | # OK
25 24 | with A() as a:
SIM117.py:47:1: SIM117 [*] Use a single `with` statement with multiple contexts instead of nested `with` statements
SIM117.py:47:1: SIM117 [**] Use a single `with` statement with multiple contexts instead of nested `with` statements
|
46 | # SIM117
47 | / async with A() as a:
@ -108,7 +108,7 @@ SIM117.py:47:1: SIM117 [*] Use a single `with` statement with multiple contexts
51 50 | while True:
52 51 | # SIM117
SIM117.py:53:5: SIM117 [*] Use a single `with` statement with multiple contexts instead of nested `with` statements
SIM117.py:53:5: SIM117 [**] Use a single `with` statement with multiple contexts instead of nested `with` statements
|
51 | while True:
52 | # SIM117
@ -146,7 +146,7 @@ SIM117.py:53:5: SIM117 [*] Use a single `with` statement with multiple contexts
66 65 |
67 66 | # SIM117
SIM117.py:68:1: SIM117 [*] Use a single `with` statement with multiple contexts instead of nested `with` statements
SIM117.py:68:1: SIM117 [**] Use a single `with` statement with multiple contexts instead of nested `with` statements
|
67 | # SIM117
68 | / with (
@ -173,7 +173,7 @@ SIM117.py:68:1: SIM117 [*] Use a single `with` statement with multiple contexts
75 74 | # SIM117
76 75 | with A() as a:
SIM117.py:76:1: SIM117 [*] Use a single `with` statement with multiple contexts instead of nested `with` statements
SIM117.py:76:1: SIM117 [**] Use a single `with` statement with multiple contexts instead of nested `with` statements
|
75 | # SIM117
76 | / with A() as a:
@ -205,7 +205,7 @@ SIM117.py:76:1: SIM117 [*] Use a single `with` statement with multiple contexts
83 82 | # SIM117
84 83 | with (
SIM117.py:84:1: SIM117 [*] Use a single `with` statement with multiple contexts instead of nested `with` statements
SIM117.py:84:1: SIM117 [**] Use a single `with` statement with multiple contexts instead of nested `with` statements
|
83 | # SIM117
84 | / with (
@ -239,7 +239,7 @@ SIM117.py:84:1: SIM117 [*] Use a single `with` statement with multiple contexts
94 91 | # SIM117 (auto-fixable)
95 92 | with A("01ß9💣28901ß9💣28901ß9💣289") as a:
SIM117.py:95:1: SIM117 [*] Use a single `with` statement with multiple contexts instead of nested `with` statements
SIM117.py:95:1: SIM117 [**] Use a single `with` statement with multiple contexts instead of nested `with` statements
|
94 | # SIM117 (auto-fixable)
95 | / with A("01ß9💣28901ß9💣28901ß9💣289") as a:
@ -284,7 +284,7 @@ SIM117.py:106:5: SIM117 Use a single `with` statement with multiple contexts ins
|
= help: Combine `with` statements
SIM117.py:126:1: SIM117 [*] Use a single `with` statement with multiple contexts instead of nested `with` statements
SIM117.py:126:1: SIM117 [**] Use a single `with` statement with multiple contexts instead of nested `with` statements
|
125 | # SIM117
126 | / with A() as a:

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs
---
SIM118.py:1:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()`
SIM118.py:1:1: SIM118 [**] Use `key in dict` instead of `key in dict.keys()`
|
1 | key in obj.keys() # SIM118
| ^^^^^^^^^^^^^^^^^ SIM118
@ -17,7 +17,7 @@ SIM118.py:1:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()`
3 3 | key not in obj.keys() # SIM118
4 4 |
SIM118.py:3:1: SIM118 [*] Use `key not in dict` instead of `key not in dict.keys()`
SIM118.py:3:1: SIM118 [**] Use `key not in dict` instead of `key not in dict.keys()`
|
1 | key in obj.keys() # SIM118
2 |
@ -37,7 +37,7 @@ SIM118.py:3:1: SIM118 [*] Use `key not in dict` instead of `key not in dict.keys
5 5 | foo["bar"] in obj.keys() # SIM118
6 6 |
SIM118.py:5:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()`
SIM118.py:5:1: SIM118 [**] Use `key in dict` instead of `key in dict.keys()`
|
3 | key not in obj.keys() # SIM118
4 |
@ -58,7 +58,7 @@ SIM118.py:5:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()`
7 7 | foo["bar"] not in obj.keys() # SIM118
8 8 |
SIM118.py:7:1: SIM118 [*] Use `key not in dict` instead of `key not in dict.keys()`
SIM118.py:7:1: SIM118 [**] Use `key not in dict` instead of `key not in dict.keys()`
|
5 | foo["bar"] in obj.keys() # SIM118
6 |
@ -79,7 +79,7 @@ SIM118.py:7:1: SIM118 [*] Use `key not in dict` instead of `key not in dict.keys
9 9 | foo['bar'] in obj.keys() # SIM118
10 10 |
SIM118.py:9:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()`
SIM118.py:9:1: SIM118 [**] Use `key in dict` instead of `key in dict.keys()`
|
7 | foo["bar"] not in obj.keys() # SIM118
8 |
@ -100,7 +100,7 @@ SIM118.py:9:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()`
11 11 | foo['bar'] not in obj.keys() # SIM118
12 12 |
SIM118.py:11:1: SIM118 [*] Use `key not in dict` instead of `key not in dict.keys()`
SIM118.py:11:1: SIM118 [**] Use `key not in dict` instead of `key not in dict.keys()`
|
9 | foo['bar'] in obj.keys() # SIM118
10 |
@ -121,7 +121,7 @@ SIM118.py:11:1: SIM118 [*] Use `key not in dict` instead of `key not in dict.key
13 13 | foo() in obj.keys() # SIM118
14 14 |
SIM118.py:13:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()`
SIM118.py:13:1: SIM118 [**] Use `key in dict` instead of `key in dict.keys()`
|
11 | foo['bar'] not in obj.keys() # SIM118
12 |
@ -142,7 +142,7 @@ SIM118.py:13:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()`
15 15 | foo() not in obj.keys() # SIM118
16 16 |
SIM118.py:15:1: SIM118 [*] Use `key not in dict` instead of `key not in dict.keys()`
SIM118.py:15:1: SIM118 [**] Use `key not in dict` instead of `key not in dict.keys()`
|
13 | foo() in obj.keys() # SIM118
14 |
@ -163,7 +163,7 @@ SIM118.py:15:1: SIM118 [*] Use `key not in dict` instead of `key not in dict.key
17 17 | for key in obj.keys(): # SIM118
18 18 | pass
SIM118.py:17:5: SIM118 [*] Use `key in dict` instead of `key in dict.keys()`
SIM118.py:17:5: SIM118 [**] Use `key in dict` instead of `key in dict.keys()`
|
15 | foo() not in obj.keys() # SIM118
16 |
@ -183,7 +183,7 @@ SIM118.py:17:5: SIM118 [*] Use `key in dict` instead of `key in dict.keys()`
19 19 |
20 20 | for key in list(obj.keys()):
SIM118.py:24:8: SIM118 [*] Use `key in dict` instead of `key in dict.keys()`
SIM118.py:24:8: SIM118 [**] Use `key in dict` instead of `key in dict.keys()`
|
22 | del obj[key]
23 |
@ -204,7 +204,7 @@ SIM118.py:24:8: SIM118 [*] Use `key in dict` instead of `key in dict.keys()`
26 26 | {k for k in obj.keys()} # SIM118
27 27 |
SIM118.py:26:8: SIM118 [*] Use `key in dict` instead of `key in dict.keys()`
SIM118.py:26:8: SIM118 [**] Use `key in dict` instead of `key in dict.keys()`
|
24 | [k for k in obj.keys()] # SIM118
25 |
@ -225,7 +225,7 @@ SIM118.py:26:8: SIM118 [*] Use `key in dict` instead of `key in dict.keys()`
28 28 | {k: k for k in obj.keys()} # SIM118
29 29 |
SIM118.py:28:11: SIM118 [*] Use `key in dict` instead of `key in dict.keys()`
SIM118.py:28:11: SIM118 [**] Use `key in dict` instead of `key in dict.keys()`
|
26 | {k for k in obj.keys()} # SIM118
27 |
@ -246,7 +246,7 @@ SIM118.py:28:11: SIM118 [*] Use `key in dict` instead of `key in dict.keys()`
30 30 | (k for k in obj.keys()) # SIM118
31 31 |
SIM118.py:30:8: SIM118 [*] Use `key in dict` instead of `key in dict.keys()`
SIM118.py:30:8: SIM118 [**] Use `key in dict` instead of `key in dict.keys()`
|
28 | {k: k for k in obj.keys()} # SIM118
29 |
@ -267,7 +267,7 @@ SIM118.py:30:8: SIM118 [*] Use `key in dict` instead of `key in dict.keys()`
32 32 | key in (obj or {}).keys() # SIM118
33 33 |
SIM118.py:32:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()`
SIM118.py:32:1: SIM118 [**] Use `key in dict` instead of `key in dict.keys()`
|
30 | (k for k in obj.keys()) # SIM118
31 |
@ -288,7 +288,7 @@ SIM118.py:32:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()`
34 34 | (key) in (obj or {}).keys() # SIM118
35 35 |
SIM118.py:34:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()`
SIM118.py:34:1: SIM118 [**] Use `key in dict` instead of `key in dict.keys()`
|
32 | key in (obj or {}).keys() # SIM118
33 |
@ -309,7 +309,7 @@ SIM118.py:34:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()`
36 36 | from typing import KeysView
37 37 |
SIM118.py:48:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()`
SIM118.py:48:1: SIM118 [**] Use `key in dict` instead of `key in dict.keys()`
|
47 | # Regression test for: https://github.com/astral-sh/ruff/issues/7124
48 | key in obj.keys()and foo
@ -329,7 +329,7 @@ SIM118.py:48:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()`
50 50 | key in (obj.keys())and foo
51 51 |
SIM118.py:49:2: SIM118 [*] Use `key in dict` instead of `key in dict.keys()`
SIM118.py:49:2: SIM118 [**] Use `key in dict` instead of `key in dict.keys()`
|
47 | # Regression test for: https://github.com/astral-sh/ruff/issues/7124
48 | key in obj.keys()and foo
@ -349,7 +349,7 @@ SIM118.py:49:2: SIM118 [*] Use `key in dict` instead of `key in dict.keys()`
51 51 |
52 52 | # Regression test for: https://github.com/astral-sh/ruff/issues/7200
SIM118.py:50:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()`
SIM118.py:50:1: SIM118 [**] Use `key in dict` instead of `key in dict.keys()`
|
48 | key in obj.keys()and foo
49 | (key in obj.keys())and foo
@ -370,7 +370,7 @@ SIM118.py:50:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()`
52 52 | # Regression test for: https://github.com/astral-sh/ruff/issues/7200
53 53 | for key in (
SIM118.py:53:5: SIM118 [*] Use `key in dict` instead of `key in dict.keys()`
SIM118.py:53:5: SIM118 [**] Use `key in dict` instead of `key in dict.keys()`
|
52 | # Regression test for: https://github.com/astral-sh/ruff/issues/7200
53 | for key in (

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs
---
SIM202.py:2:4: SIM202 [*] Use `a == b` instead of `not a != b`
SIM202.py:2:4: SIM202 [**] Use `a == b` instead of `not a != b`
|
1 | # SIM202
2 | if not a != b:
@ -18,7 +18,7 @@ SIM202.py:2:4: SIM202 [*] Use `a == b` instead of `not a != b`
4 4 |
5 5 | # SIM202
SIM202.py:6:4: SIM202 [*] Use `a == b + c` instead of `not a != b + c`
SIM202.py:6:4: SIM202 [**] Use `a == b + c` instead of `not a != b + c`
|
5 | # SIM202
6 | if not a != (b + c):
@ -37,7 +37,7 @@ SIM202.py:6:4: SIM202 [*] Use `a == b + c` instead of `not a != b + c`
8 8 |
9 9 | # SIM202
SIM202.py:10:4: SIM202 [*] Use `a + b == c` instead of `not a + b != c`
SIM202.py:10:4: SIM202 [**] Use `a + b == c` instead of `not a + b != c`
|
9 | # SIM202
10 | if not (a + b) != c:

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs
---
SIM208.py:1:4: SIM208 [*] Use `a` instead of `not (not a)`
SIM208.py:1:4: SIM208 [**] Use `a` instead of `not (not a)`
|
1 | if not (not a): # SIM208
| ^^^^^^^^^^^ SIM208
@ -16,7 +16,7 @@ SIM208.py:1:4: SIM208 [*] Use `a` instead of `not (not a)`
3 3 |
4 4 | if not (not (a == b)): # SIM208
SIM208.py:4:4: SIM208 [*] Use `a == b` instead of `not (not a == b)`
SIM208.py:4:4: SIM208 [**] Use `a == b` instead of `not (not a == b)`
|
2 | pass
3 |
@ -36,7 +36,7 @@ SIM208.py:4:4: SIM208 [*] Use `a == b` instead of `not (not a == b)`
6 6 |
7 7 | if not a: # OK
SIM208.py:16:5: SIM208 [*] Use `b` instead of `not (not b)`
SIM208.py:16:5: SIM208 [**] Use `b` instead of `not (not b)`
|
14 | pass
15 |
@ -57,7 +57,7 @@ SIM208.py:16:5: SIM208 [*] Use `b` instead of `not (not b)`
18 18 | f(not not a) # SIM208
19 19 |
SIM208.py:18:3: SIM208 [*] Use `a` instead of `not (not a)`
SIM208.py:18:3: SIM208 [**] Use `a` instead of `not (not a)`
|
16 | a = not not b # SIM208
17 |
@ -78,7 +78,7 @@ SIM208.py:18:3: SIM208 [*] Use `a` instead of `not (not a)`
20 20 | if 1 + (not (not a)): # SIM208
21 21 | pass
SIM208.py:20:9: SIM208 [*] Use `a` instead of `not (not a)`
SIM208.py:20:9: SIM208 [**] Use `a` instead of `not (not a)`
|
18 | f(not not a) # SIM208
19 |

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs
---
SIM210.py:1:5: SIM210 [*] Use `bool(...)` instead of `True if ... else False`
SIM210.py:1:5: SIM210 [**] Use `bool(...)` instead of `True if ... else False`
|
1 | a = True if b else False # SIM210
| ^^^^^^^^^^^^^^^^^^^^ SIM210
@ -17,7 +17,7 @@ SIM210.py:1:5: SIM210 [*] Use `bool(...)` instead of `True if ... else False`
3 3 | a = True if b != c else False # SIM210
4 4 |
SIM210.py:3:5: SIM210 [*] Remove unnecessary `True if ... else False`
SIM210.py:3:5: SIM210 [**] Remove unnecessary `True if ... else False`
|
1 | a = True if b else False # SIM210
2 |
@ -37,7 +37,7 @@ SIM210.py:3:5: SIM210 [*] Remove unnecessary `True if ... else False`
5 5 | a = True if b + c else False # SIM210
6 6 |
SIM210.py:5:5: SIM210 [*] Use `bool(...)` instead of `True if ... else False`
SIM210.py:5:5: SIM210 [**] Use `bool(...)` instead of `True if ... else False`
|
3 | a = True if b != c else False # SIM210
4 |
@ -67,7 +67,7 @@ SIM210.py:15:9: SIM210 Use `bool(...)` instead of `True if ... else False`
|
= help: Replace with `bool(...)
SIM210.py:19:11: SIM210 [*] Remove unnecessary `True if ... else False`
SIM210.py:19:11: SIM210 [**] Remove unnecessary `True if ... else False`
|
18 | # Regression test for: https://github.com/astral-sh/ruff/issues/7076
19 | samesld = True if (psl.privatesuffix(urlparse(response.url).netloc) ==

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs
---
SIM211.py:1:5: SIM211 [*] Use `not ...` instead of `False if ... else True`
SIM211.py:1:5: SIM211 [**] Use `not ...` instead of `False if ... else True`
|
1 | a = False if b else True # SIM211
| ^^^^^^^^^^^^^^^^^^^^ SIM211
@ -17,7 +17,7 @@ SIM211.py:1:5: SIM211 [*] Use `not ...` instead of `False if ... else True`
3 3 | a = False if b != c else True # SIM211
4 4 |
SIM211.py:3:5: SIM211 [*] Use `not ...` instead of `False if ... else True`
SIM211.py:3:5: SIM211 [**] Use `not ...` instead of `False if ... else True`
|
1 | a = False if b else True # SIM211
2 |
@ -37,7 +37,7 @@ SIM211.py:3:5: SIM211 [*] Use `not ...` instead of `False if ... else True`
5 5 | a = False if b + c else True # SIM211
6 6 |
SIM211.py:5:5: SIM211 [*] Use `not ...` instead of `False if ... else True`
SIM211.py:5:5: SIM211 [**] Use `not ...` instead of `False if ... else True`
|
3 | a = False if b != c else True # SIM211
4 |

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs
---
SIM212.py:1:5: SIM212 [*] Use `a if a else b` instead of `b if not a else a`
SIM212.py:1:5: SIM212 [**] Use `a if a else b` instead of `b if not a else a`
|
1 | c = b if not a else a # SIM212
| ^^^^^^^^^^^^^^^^^ SIM212
@ -17,7 +17,7 @@ SIM212.py:1:5: SIM212 [*] Use `a if a else b` instead of `b if not a else a`
3 3 | c = b + c if not a else a # SIM212
4 4 |
SIM212.py:3:5: SIM212 [*] Use `a if a else b + c` instead of `b + c if not a else a`
SIM212.py:3:5: SIM212 [**] Use `a if a else b + c` instead of `b + c if not a else a`
|
1 | c = b if not a else a # SIM212
2 |

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs
---
SIM220.py:1:4: SIM220 [*] Use `False` instead of `a and not a`
SIM220.py:1:4: SIM220 [**] Use `False` instead of `a and not a`
|
1 | if a and not a:
| ^^^^^^^^^^^ SIM220
@ -16,7 +16,7 @@ SIM220.py:1:4: SIM220 [*] Use `False` instead of `a and not a`
3 3 |
4 4 | if (a and not a) and b:
SIM220.py:4:5: SIM220 [*] Use `False` instead of `a and not a`
SIM220.py:4:5: SIM220 [**] Use `False` instead of `a and not a`
|
2 | pass
3 |
@ -36,7 +36,7 @@ SIM220.py:4:5: SIM220 [*] Use `False` instead of `a and not a`
6 6 |
7 7 | if (a and not a) or b:
SIM220.py:7:5: SIM220 [*] Use `False` instead of `a and not a`
SIM220.py:7:5: SIM220 [**] Use `False` instead of `a and not a`
|
5 | pass
6 |

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs
---
SIM221.py:1:4: SIM221 [*] Use `True` instead of `a or not a`
SIM221.py:1:4: SIM221 [**] Use `True` instead of `a or not a`
|
1 | if a or not a:
| ^^^^^^^^^^ SIM221
@ -16,7 +16,7 @@ SIM221.py:1:4: SIM221 [*] Use `True` instead of `a or not a`
3 3 |
4 4 | if (a or not a) or b:
SIM221.py:4:5: SIM221 [*] Use `True` instead of `a or not a`
SIM221.py:4:5: SIM221 [**] Use `True` instead of `a or not a`
|
2 | pass
3 |
@ -36,7 +36,7 @@ SIM221.py:4:5: SIM221 [*] Use `True` instead of `a or not a`
6 6 |
7 7 | if (a or not a) and b:
SIM221.py:7:5: SIM221 [*] Use `True` instead of `a or not a`
SIM221.py:7:5: SIM221 [**] Use `True` instead of `a or not a`
|
5 | pass
6 |

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs
---
SIM222.py:1:4: SIM222 [*] Use `True` instead of `... or True`
SIM222.py:1:4: SIM222 [**] Use `True` instead of `... or True`
|
1 | if a or True: # SIM222
| ^^^^^^^^^ SIM222
@ -16,7 +16,7 @@ SIM222.py:1:4: SIM222 [*] Use `True` instead of `... or True`
3 3 |
4 4 | if (a or b) or True: # SIM222
SIM222.py:4:4: SIM222 [*] Use `True` instead of `... or True`
SIM222.py:4:4: SIM222 [**] Use `True` instead of `... or True`
|
2 | pass
3 |
@ -36,7 +36,7 @@ SIM222.py:4:4: SIM222 [*] Use `True` instead of `... or True`
6 6 |
7 7 | if a or (b or True): # SIM222
SIM222.py:7:10: SIM222 [*] Use `True` instead of `... or True`
SIM222.py:7:10: SIM222 [**] Use `True` instead of `... or True`
|
5 | pass
6 |
@ -56,7 +56,7 @@ SIM222.py:7:10: SIM222 [*] Use `True` instead of `... or True`
9 9 |
10 10 | if a and True: # OK
SIM222.py:24:16: SIM222 [*] Use `True` instead of `True or ...`
SIM222.py:24:16: SIM222 [**] Use `True` instead of `True or ...`
|
22 | pass
23 |
@ -76,7 +76,7 @@ SIM222.py:24:16: SIM222 [*] Use `True` instead of `True or ...`
26 26 |
27 27 | if True or f() or a or g() or b: # SIM222
SIM222.py:27:4: SIM222 [*] Use `True` instead of `True or ...`
SIM222.py:27:4: SIM222 [**] Use `True` instead of `True or ...`
|
25 | pass
26 |
@ -96,7 +96,7 @@ SIM222.py:27:4: SIM222 [*] Use `True` instead of `True or ...`
29 29 |
30 30 | if a or True or f() or b or g(): # SIM222
SIM222.py:30:4: SIM222 [*] Use `True` instead of `... or True or ...`
SIM222.py:30:4: SIM222 [**] Use `True` instead of `... or True or ...`
|
28 | pass
29 |
@ -116,7 +116,7 @@ SIM222.py:30:4: SIM222 [*] Use `True` instead of `... or True or ...`
32 32 |
33 33 |
SIM222.py:47:6: SIM222 [*] Use `True` instead of `... or True`
SIM222.py:47:6: SIM222 [**] Use `True` instead of `... or True`
|
47 | a or "" or True # SIM222
| ^^^^^^^^^^ SIM222
@ -135,7 +135,7 @@ SIM222.py:47:6: SIM222 [*] Use `True` instead of `... or True`
49 49 | a or "foo" or True or "bar" # SIM222
50 50 |
SIM222.py:49:6: SIM222 [*] Use `"foo"` instead of `"foo" or ...`
SIM222.py:49:6: SIM222 [**] Use `"foo"` instead of `"foo" or ...`
|
47 | a or "" or True # SIM222
48 |
@ -156,7 +156,7 @@ SIM222.py:49:6: SIM222 [*] Use `"foo"` instead of `"foo" or ...`
51 51 | a or 0 or True # SIM222
52 52 |
SIM222.py:51:6: SIM222 [*] Use `True` instead of `... or True`
SIM222.py:51:6: SIM222 [**] Use `True` instead of `... or True`
|
49 | a or "foo" or True or "bar" # SIM222
50 |
@ -177,7 +177,7 @@ SIM222.py:51:6: SIM222 [*] Use `True` instead of `... or True`
53 53 | a or 1 or True or 2 # SIM222
54 54 |
SIM222.py:53:6: SIM222 [*] Use `1` instead of `1 or ...`
SIM222.py:53:6: SIM222 [**] Use `1` instead of `1 or ...`
|
51 | a or 0 or True # SIM222
52 |
@ -198,7 +198,7 @@ SIM222.py:53:6: SIM222 [*] Use `1` instead of `1 or ...`
55 55 | a or 0.0 or True # SIM222
56 56 |
SIM222.py:55:6: SIM222 [*] Use `True` instead of `... or True`
SIM222.py:55:6: SIM222 [**] Use `True` instead of `... or True`
|
53 | a or 1 or True or 2 # SIM222
54 |
@ -219,7 +219,7 @@ SIM222.py:55:6: SIM222 [*] Use `True` instead of `... or True`
57 57 | a or 0.1 or True or 0.2 # SIM222
58 58 |
SIM222.py:57:6: SIM222 [*] Use `0.1` instead of `0.1 or ...`
SIM222.py:57:6: SIM222 [**] Use `0.1` instead of `0.1 or ...`
|
55 | a or 0.0 or True # SIM222
56 |
@ -240,7 +240,7 @@ SIM222.py:57:6: SIM222 [*] Use `0.1` instead of `0.1 or ...`
59 59 | a or [] or True # SIM222
60 60 |
SIM222.py:59:6: SIM222 [*] Use `True` instead of `... or True`
SIM222.py:59:6: SIM222 [**] Use `True` instead of `... or True`
|
57 | a or 0.1 or True or 0.2 # SIM222
58 |
@ -261,7 +261,7 @@ SIM222.py:59:6: SIM222 [*] Use `True` instead of `... or True`
61 61 | a or list([]) or True # SIM222
62 62 |
SIM222.py:61:6: SIM222 [*] Use `True` instead of `... or True`
SIM222.py:61:6: SIM222 [**] Use `True` instead of `... or True`
|
59 | a or [] or True # SIM222
60 |
@ -282,7 +282,7 @@ SIM222.py:61:6: SIM222 [*] Use `True` instead of `... or True`
63 63 | a or [1] or True or [2] # SIM222
64 64 |
SIM222.py:63:6: SIM222 [*] Use `[1]` instead of `[1] or ...`
SIM222.py:63:6: SIM222 [**] Use `[1]` instead of `[1] or ...`
|
61 | a or list([]) or True # SIM222
62 |
@ -303,7 +303,7 @@ SIM222.py:63:6: SIM222 [*] Use `[1]` instead of `[1] or ...`
65 65 | a or list([1]) or True or list([2]) # SIM222
66 66 |
SIM222.py:65:6: SIM222 [*] Use `list([1])` instead of `list([1]) or ...`
SIM222.py:65:6: SIM222 [**] Use `list([1])` instead of `list([1]) or ...`
|
63 | a or [1] or True or [2] # SIM222
64 |
@ -324,7 +324,7 @@ SIM222.py:65:6: SIM222 [*] Use `list([1])` instead of `list([1]) or ...`
67 67 | a or {} or True # SIM222
68 68 |
SIM222.py:67:6: SIM222 [*] Use `True` instead of `... or True`
SIM222.py:67:6: SIM222 [**] Use `True` instead of `... or True`
|
65 | a or list([1]) or True or list([2]) # SIM222
66 |
@ -345,7 +345,7 @@ SIM222.py:67:6: SIM222 [*] Use `True` instead of `... or True`
69 69 | a or dict() or True # SIM222
70 70 |
SIM222.py:69:6: SIM222 [*] Use `True` instead of `... or True`
SIM222.py:69:6: SIM222 [**] Use `True` instead of `... or True`
|
67 | a or {} or True # SIM222
68 |
@ -366,7 +366,7 @@ SIM222.py:69:6: SIM222 [*] Use `True` instead of `... or True`
71 71 | a or {1: 1} or True or {2: 2} # SIM222
72 72 |
SIM222.py:71:6: SIM222 [*] Use `{1: 1}` instead of `{1: 1} or ...`
SIM222.py:71:6: SIM222 [**] Use `{1: 1}` instead of `{1: 1} or ...`
|
69 | a or dict() or True # SIM222
70 |
@ -387,7 +387,7 @@ SIM222.py:71:6: SIM222 [*] Use `{1: 1}` instead of `{1: 1} or ...`
73 73 | a or dict({1: 1}) or True or dict({2: 2}) # SIM222
74 74 |
SIM222.py:73:6: SIM222 [*] Use `dict({1: 1})` instead of `dict({1: 1}) or ...`
SIM222.py:73:6: SIM222 [**] Use `dict({1: 1})` instead of `dict({1: 1}) or ...`
|
71 | a or {1: 1} or True or {2: 2} # SIM222
72 |
@ -408,7 +408,7 @@ SIM222.py:73:6: SIM222 [*] Use `dict({1: 1})` instead of `dict({1: 1}) or ...`
75 75 | a or set() or True # SIM222
76 76 |
SIM222.py:75:6: SIM222 [*] Use `True` instead of `... or True`
SIM222.py:75:6: SIM222 [**] Use `True` instead of `... or True`
|
73 | a or dict({1: 1}) or True or dict({2: 2}) # SIM222
74 |
@ -429,7 +429,7 @@ SIM222.py:75:6: SIM222 [*] Use `True` instead of `... or True`
77 77 | a or set(set()) or True # SIM222
78 78 |
SIM222.py:77:6: SIM222 [*] Use `True` instead of `... or True`
SIM222.py:77:6: SIM222 [**] Use `True` instead of `... or True`
|
75 | a or set() or True # SIM222
76 |
@ -450,7 +450,7 @@ SIM222.py:77:6: SIM222 [*] Use `True` instead of `... or True`
79 79 | a or {1} or True or {2} # SIM222
80 80 |
SIM222.py:79:6: SIM222 [*] Use `{1}` instead of `{1} or ...`
SIM222.py:79:6: SIM222 [**] Use `{1}` instead of `{1} or ...`
|
77 | a or set(set()) or True # SIM222
78 |
@ -471,7 +471,7 @@ SIM222.py:79:6: SIM222 [*] Use `{1}` instead of `{1} or ...`
81 81 | a or set({1}) or True or set({2}) # SIM222
82 82 |
SIM222.py:81:6: SIM222 [*] Use `set({1})` instead of `set({1}) or ...`
SIM222.py:81:6: SIM222 [**] Use `set({1})` instead of `set({1}) or ...`
|
79 | a or {1} or True or {2} # SIM222
80 |
@ -492,7 +492,7 @@ SIM222.py:81:6: SIM222 [*] Use `set({1})` instead of `set({1}) or ...`
83 83 | a or () or True # SIM222
84 84 |
SIM222.py:83:6: SIM222 [*] Use `True` instead of `... or True`
SIM222.py:83:6: SIM222 [**] Use `True` instead of `... or True`
|
81 | a or set({1}) or True or set({2}) # SIM222
82 |
@ -513,7 +513,7 @@ SIM222.py:83:6: SIM222 [*] Use `True` instead of `... or True`
85 85 | a or tuple(()) or True # SIM222
86 86 |
SIM222.py:85:6: SIM222 [*] Use `True` instead of `... or True`
SIM222.py:85:6: SIM222 [**] Use `True` instead of `... or True`
|
83 | a or () or True # SIM222
84 |
@ -534,7 +534,7 @@ SIM222.py:85:6: SIM222 [*] Use `True` instead of `... or True`
87 87 | a or (1,) or True or (2,) # SIM222
88 88 |
SIM222.py:87:6: SIM222 [*] Use `(1,)` instead of `(1,) or ...`
SIM222.py:87:6: SIM222 [**] Use `(1,)` instead of `(1,) or ...`
|
85 | a or tuple(()) or True # SIM222
86 |
@ -555,7 +555,7 @@ SIM222.py:87:6: SIM222 [*] Use `(1,)` instead of `(1,) or ...`
89 89 | a or tuple((1,)) or True or tuple((2,)) # SIM222
90 90 |
SIM222.py:89:6: SIM222 [*] Use `tuple((1,))` instead of `tuple((1,)) or ...`
SIM222.py:89:6: SIM222 [**] Use `tuple((1,))` instead of `tuple((1,)) or ...`
|
87 | a or (1,) or True or (2,) # SIM222
88 |
@ -576,7 +576,7 @@ SIM222.py:89:6: SIM222 [*] Use `tuple((1,))` instead of `tuple((1,)) or ...`
91 91 | a or frozenset() or True # SIM222
92 92 |
SIM222.py:91:6: SIM222 [*] Use `True` instead of `... or True`
SIM222.py:91:6: SIM222 [**] Use `True` instead of `... or True`
|
89 | a or tuple((1,)) or True or tuple((2,)) # SIM222
90 |
@ -597,7 +597,7 @@ SIM222.py:91:6: SIM222 [*] Use `True` instead of `... or True`
93 93 | a or frozenset(frozenset()) or True # SIM222
94 94 |
SIM222.py:93:6: SIM222 [*] Use `True` instead of `... or True`
SIM222.py:93:6: SIM222 [**] Use `True` instead of `... or True`
|
91 | a or frozenset() or True # SIM222
92 |
@ -618,7 +618,7 @@ SIM222.py:93:6: SIM222 [*] Use `True` instead of `... or True`
95 95 | a or frozenset({1}) or True or frozenset({2}) # SIM222
96 96 |
SIM222.py:95:6: SIM222 [*] Use `frozenset({1})` instead of `frozenset({1}) or ...`
SIM222.py:95:6: SIM222 [**] Use `frozenset({1})` instead of `frozenset({1}) or ...`
|
93 | a or frozenset(frozenset()) or True # SIM222
94 |
@ -639,7 +639,7 @@ SIM222.py:95:6: SIM222 [*] Use `frozenset({1})` instead of `frozenset({1}) or ..
97 97 | a or frozenset(frozenset({1})) or True or frozenset(frozenset({2})) # SIM222
98 98 |
SIM222.py:97:6: SIM222 [*] Use `frozenset(frozenset({1}))` instead of `frozenset(frozenset({1})) or ...`
SIM222.py:97:6: SIM222 [**] Use `frozenset(frozenset({1}))` instead of `frozenset(frozenset({1})) or ...`
|
95 | a or frozenset({1}) or True or frozenset({2}) # SIM222
96 |
@ -658,7 +658,7 @@ SIM222.py:97:6: SIM222 [*] Use `frozenset(frozenset({1}))` instead of `frozenset
99 99 |
100 100 | # Inside test `a` is simplified.
SIM222.py:102:6: SIM222 [*] Use `True` instead of `... or True or ...`
SIM222.py:102:6: SIM222 [**] Use `True` instead of `... or True or ...`
|
100 | # Inside test `a` is simplified.
101 |
@ -679,7 +679,7 @@ SIM222.py:102:6: SIM222 [*] Use `True` instead of `... or True or ...`
104 104 | assert a or [1] or True or [2] # SIM222
105 105 |
SIM222.py:104:8: SIM222 [*] Use `True` instead of `... or True or ...`
SIM222.py:104:8: SIM222 [**] Use `True` instead of `... or True or ...`
|
102 | bool(a or [1] or True or [2]) # SIM222
103 |
@ -700,7 +700,7 @@ SIM222.py:104:8: SIM222 [*] Use `True` instead of `... or True or ...`
106 106 | if (a or [1] or True or [2]) and (a or [1] or True or [2]): # SIM222
107 107 | pass
SIM222.py:106:5: SIM222 [*] Use `True` instead of `... or True or ...`
SIM222.py:106:5: SIM222 [**] Use `True` instead of `... or True or ...`
|
104 | assert a or [1] or True or [2] # SIM222
105 |
@ -720,7 +720,7 @@ SIM222.py:106:5: SIM222 [*] Use `True` instead of `... or True or ...`
108 108 |
109 109 | 0 if a or [1] or True or [2] else 1 # SIM222
SIM222.py:106:35: SIM222 [*] Use `True` instead of `... or True or ...`
SIM222.py:106:35: SIM222 [**] Use `True` instead of `... or True or ...`
|
104 | assert a or [1] or True or [2] # SIM222
105 |
@ -740,7 +740,7 @@ SIM222.py:106:35: SIM222 [*] Use `True` instead of `... or True or ...`
108 108 |
109 109 | 0 if a or [1] or True or [2] else 1 # SIM222
SIM222.py:109:6: SIM222 [*] Use `True` instead of `... or True or ...`
SIM222.py:109:6: SIM222 [**] Use `True` instead of `... or True or ...`
|
107 | pass
108 |
@ -761,7 +761,7 @@ SIM222.py:109:6: SIM222 [*] Use `True` instead of `... or True or ...`
111 111 | while a or [1] or True or [2]: # SIM222
112 112 | pass
SIM222.py:111:7: SIM222 [*] Use `True` instead of `... or True or ...`
SIM222.py:111:7: SIM222 [**] Use `True` instead of `... or True or ...`
|
109 | 0 if a or [1] or True or [2] else 1 # SIM222
110 |
@ -781,7 +781,7 @@ SIM222.py:111:7: SIM222 [*] Use `True` instead of `... or True or ...`
113 113 |
114 114 | [
SIM222.py:118:8: SIM222 [*] Use `True` instead of `... or True or ...`
SIM222.py:118:8: SIM222 [**] Use `True` instead of `... or True or ...`
|
116 | for a in range(10)
117 | for b in range(10)
@ -802,7 +802,7 @@ SIM222.py:118:8: SIM222 [*] Use `True` instead of `... or True or ...`
120 120 | ]
121 121 |
SIM222.py:119:8: SIM222 [*] Use `True` instead of `... or True or ...`
SIM222.py:119:8: SIM222 [**] Use `True` instead of `... or True or ...`
|
117 | for b in range(10)
118 | if a or [1] or True or [2] # SIM222
@ -822,7 +822,7 @@ SIM222.py:119:8: SIM222 [*] Use `True` instead of `... or True or ...`
121 121 |
122 122 | {
SIM222.py:126:8: SIM222 [*] Use `True` instead of `... or True or ...`
SIM222.py:126:8: SIM222 [**] Use `True` instead of `... or True or ...`
|
124 | for a in range(10)
125 | for b in range(10)
@ -843,7 +843,7 @@ SIM222.py:126:8: SIM222 [*] Use `True` instead of `... or True or ...`
128 128 | }
129 129 |
SIM222.py:127:8: SIM222 [*] Use `True` instead of `... or True or ...`
SIM222.py:127:8: SIM222 [**] Use `True` instead of `... or True or ...`
|
125 | for b in range(10)
126 | if a or [1] or True or [2] # SIM222
@ -863,7 +863,7 @@ SIM222.py:127:8: SIM222 [*] Use `True` instead of `... or True or ...`
129 129 |
130 130 | {
SIM222.py:134:8: SIM222 [*] Use `True` instead of `... or True or ...`
SIM222.py:134:8: SIM222 [**] Use `True` instead of `... or True or ...`
|
132 | for a in range(10)
133 | for b in range(10)
@ -884,7 +884,7 @@ SIM222.py:134:8: SIM222 [*] Use `True` instead of `... or True or ...`
136 136 | }
137 137 |
SIM222.py:135:8: SIM222 [*] Use `True` instead of `... or True or ...`
SIM222.py:135:8: SIM222 [**] Use `True` instead of `... or True or ...`
|
133 | for b in range(10)
134 | if a or [1] or True or [2] # SIM222
@ -904,7 +904,7 @@ SIM222.py:135:8: SIM222 [*] Use `True` instead of `... or True or ...`
137 137 |
138 138 | (
SIM222.py:142:8: SIM222 [*] Use `True` instead of `... or True or ...`
SIM222.py:142:8: SIM222 [**] Use `True` instead of `... or True or ...`
|
140 | for a in range(10)
141 | for b in range(10)
@ -925,7 +925,7 @@ SIM222.py:142:8: SIM222 [*] Use `True` instead of `... or True or ...`
144 144 | )
145 145 |
SIM222.py:143:8: SIM222 [*] Use `True` instead of `... or True or ...`
SIM222.py:143:8: SIM222 [**] Use `True` instead of `... or True or ...`
|
141 | for b in range(10)
142 | if a or [1] or True or [2] # SIM222
@ -945,7 +945,7 @@ SIM222.py:143:8: SIM222 [*] Use `True` instead of `... or True or ...`
145 145 |
146 146 | # Outside test `a` is not simplified.
SIM222.py:148:6: SIM222 [*] Use `[1]` instead of `[1] or ...`
SIM222.py:148:6: SIM222 [**] Use `[1]` instead of `[1] or ...`
|
146 | # Outside test `a` is not simplified.
147 |
@ -966,7 +966,7 @@ SIM222.py:148:6: SIM222 [*] Use `[1]` instead of `[1] or ...`
150 150 | if (a or [1] or True or [2]) == (a or [1]): # SIM222
151 151 | pass
SIM222.py:150:10: SIM222 [*] Use `[1]` instead of `[1] or ...`
SIM222.py:150:10: SIM222 [**] Use `[1]` instead of `[1] or ...`
|
148 | a or [1] or True or [2] # SIM222
149 |
@ -986,7 +986,7 @@ SIM222.py:150:10: SIM222 [*] Use `[1]` instead of `[1] or ...`
152 152 |
153 153 | if f(a or [1] or True or [2]): # SIM222
SIM222.py:153:11: SIM222 [*] Use `[1]` instead of `[1] or ...`
SIM222.py:153:11: SIM222 [**] Use `[1]` instead of `[1] or ...`
|
151 | pass
152 |
@ -1006,7 +1006,7 @@ SIM222.py:153:11: SIM222 [*] Use `[1]` instead of `[1] or ...`
155 155 |
156 156 | # Regression test for: https://github.com/astral-sh/ruff/issues/7099
SIM222.py:157:30: SIM222 [*] Use `(int, int, int)` instead of `(int, int, int) or ...`
SIM222.py:157:30: SIM222 [**] Use `(int, int, int)` instead of `(int, int, int) or ...`
|
156 | # Regression test for: https://github.com/astral-sh/ruff/issues/7099
157 | def secondToTime(s0: int) -> (int, int, int) or str:
@ -1025,7 +1025,7 @@ SIM222.py:157:30: SIM222 [*] Use `(int, int, int)` instead of `(int, int, int) o
159 159 |
160 160 |
SIM222.py:161:31: SIM222 [*] Use `(int, int, int)` instead of `(int, int, int) or ...`
SIM222.py:161:31: SIM222 [**] Use `(int, int, int)` instead of `(int, int, int) or ...`
|
161 | def secondToTime(s0: int) -> ((int, int, int) or str):
| ^^^^^^^^^^^^^^^^^^^^^^ SIM222

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs
---
SIM223.py:1:4: SIM223 [*] Use `False` instead of `... and False`
SIM223.py:1:4: SIM223 [**] Use `False` instead of `... and False`
|
1 | if a and False: # SIM223
| ^^^^^^^^^^^ SIM223
@ -16,7 +16,7 @@ SIM223.py:1:4: SIM223 [*] Use `False` instead of `... and False`
3 3 |
4 4 | if (a or b) and False: # SIM223
SIM223.py:4:4: SIM223 [*] Use `False` instead of `... and False`
SIM223.py:4:4: SIM223 [**] Use `False` instead of `... and False`
|
2 | pass
3 |
@ -36,7 +36,7 @@ SIM223.py:4:4: SIM223 [*] Use `False` instead of `... and False`
6 6 |
7 7 | if a or (b and False): # SIM223
SIM223.py:7:10: SIM223 [*] Use `False` instead of `... and False`
SIM223.py:7:10: SIM223 [**] Use `False` instead of `... and False`
|
5 | pass
6 |
@ -56,7 +56,7 @@ SIM223.py:7:10: SIM223 [*] Use `False` instead of `... and False`
9 9 |
10 10 | if a or False:
SIM223.py:19:18: SIM223 [*] Use `False` instead of `False and ...`
SIM223.py:19:18: SIM223 [**] Use `False` instead of `False and ...`
|
17 | pass
18 |
@ -76,7 +76,7 @@ SIM223.py:19:18: SIM223 [*] Use `False` instead of `False and ...`
21 21 |
22 22 | if False and f() and a and g() and b: # SIM223
SIM223.py:22:4: SIM223 [*] Use `False` instead of `False and ...`
SIM223.py:22:4: SIM223 [**] Use `False` instead of `False and ...`
|
20 | pass
21 |
@ -96,7 +96,7 @@ SIM223.py:22:4: SIM223 [*] Use `False` instead of `False and ...`
24 24 |
25 25 | if a and False and f() and b and g(): # SIM223
SIM223.py:25:4: SIM223 [*] Use `False` instead of `... and False and ...`
SIM223.py:25:4: SIM223 [**] Use `False` instead of `... and False and ...`
|
23 | pass
24 |
@ -116,7 +116,7 @@ SIM223.py:25:4: SIM223 [*] Use `False` instead of `... and False and ...`
27 27 |
28 28 |
SIM223.py:42:7: SIM223 [*] Use `""` instead of `"" and ...`
SIM223.py:42:7: SIM223 [**] Use `""` instead of `"" and ...`
|
42 | a and "" and False # SIM223
| ^^^^^^^^^^^^ SIM223
@ -135,7 +135,7 @@ SIM223.py:42:7: SIM223 [*] Use `""` instead of `"" and ...`
44 44 | a and "foo" and False and "bar" # SIM223
45 45 |
SIM223.py:44:7: SIM223 [*] Use `False` instead of `... and False and ...`
SIM223.py:44:7: SIM223 [**] Use `False` instead of `... and False and ...`
|
42 | a and "" and False # SIM223
43 |
@ -156,7 +156,7 @@ SIM223.py:44:7: SIM223 [*] Use `False` instead of `... and False and ...`
46 46 | a and 0 and False # SIM223
47 47 |
SIM223.py:46:7: SIM223 [*] Use `0` instead of `0 and ...`
SIM223.py:46:7: SIM223 [**] Use `0` instead of `0 and ...`
|
44 | a and "foo" and False and "bar" # SIM223
45 |
@ -177,7 +177,7 @@ SIM223.py:46:7: SIM223 [*] Use `0` instead of `0 and ...`
48 48 | a and 1 and False and 2 # SIM223
49 49 |
SIM223.py:48:7: SIM223 [*] Use `False` instead of `... and False and ...`
SIM223.py:48:7: SIM223 [**] Use `False` instead of `... and False and ...`
|
46 | a and 0 and False # SIM223
47 |
@ -198,7 +198,7 @@ SIM223.py:48:7: SIM223 [*] Use `False` instead of `... and False and ...`
50 50 | a and 0.0 and False # SIM223
51 51 |
SIM223.py:50:7: SIM223 [*] Use `0.0` instead of `0.0 and ...`
SIM223.py:50:7: SIM223 [**] Use `0.0` instead of `0.0 and ...`
|
48 | a and 1 and False and 2 # SIM223
49 |
@ -219,7 +219,7 @@ SIM223.py:50:7: SIM223 [*] Use `0.0` instead of `0.0 and ...`
52 52 | a and 0.1 and False and 0.2 # SIM223
53 53 |
SIM223.py:52:7: SIM223 [*] Use `False` instead of `... and False and ...`
SIM223.py:52:7: SIM223 [**] Use `False` instead of `... and False and ...`
|
50 | a and 0.0 and False # SIM223
51 |
@ -240,7 +240,7 @@ SIM223.py:52:7: SIM223 [*] Use `False` instead of `... and False and ...`
54 54 | a and [] and False # SIM223
55 55 |
SIM223.py:54:7: SIM223 [*] Use `[]` instead of `[] and ...`
SIM223.py:54:7: SIM223 [**] Use `[]` instead of `[] and ...`
|
52 | a and 0.1 and False and 0.2 # SIM223
53 |
@ -261,7 +261,7 @@ SIM223.py:54:7: SIM223 [*] Use `[]` instead of `[] and ...`
56 56 | a and list([]) and False # SIM223
57 57 |
SIM223.py:56:7: SIM223 [*] Use `list([])` instead of `list([]) and ...`
SIM223.py:56:7: SIM223 [**] Use `list([])` instead of `list([]) and ...`
|
54 | a and [] and False # SIM223
55 |
@ -282,7 +282,7 @@ SIM223.py:56:7: SIM223 [*] Use `list([])` instead of `list([]) and ...`
58 58 | a and [1] and False and [2] # SIM223
59 59 |
SIM223.py:58:7: SIM223 [*] Use `False` instead of `... and False and ...`
SIM223.py:58:7: SIM223 [**] Use `False` instead of `... and False and ...`
|
56 | a and list([]) and False # SIM223
57 |
@ -303,7 +303,7 @@ SIM223.py:58:7: SIM223 [*] Use `False` instead of `... and False and ...`
60 60 | a and list([1]) and False and list([2]) # SIM223
61 61 |
SIM223.py:60:7: SIM223 [*] Use `False` instead of `... and False and ...`
SIM223.py:60:7: SIM223 [**] Use `False` instead of `... and False and ...`
|
58 | a and [1] and False and [2] # SIM223
59 |
@ -324,7 +324,7 @@ SIM223.py:60:7: SIM223 [*] Use `False` instead of `... and False and ...`
62 62 | a and {} and False # SIM223
63 63 |
SIM223.py:62:7: SIM223 [*] Use `{}` instead of `{} and ...`
SIM223.py:62:7: SIM223 [**] Use `{}` instead of `{} and ...`
|
60 | a and list([1]) and False and list([2]) # SIM223
61 |
@ -345,7 +345,7 @@ SIM223.py:62:7: SIM223 [*] Use `{}` instead of `{} and ...`
64 64 | a and dict() and False # SIM223
65 65 |
SIM223.py:64:7: SIM223 [*] Use `dict()` instead of `dict() and ...`
SIM223.py:64:7: SIM223 [**] Use `dict()` instead of `dict() and ...`
|
62 | a and {} and False # SIM223
63 |
@ -366,7 +366,7 @@ SIM223.py:64:7: SIM223 [*] Use `dict()` instead of `dict() and ...`
66 66 | a and {1: 1} and False and {2: 2} # SIM223
67 67 |
SIM223.py:66:7: SIM223 [*] Use `False` instead of `... and False and ...`
SIM223.py:66:7: SIM223 [**] Use `False` instead of `... and False and ...`
|
64 | a and dict() and False # SIM223
65 |
@ -387,7 +387,7 @@ SIM223.py:66:7: SIM223 [*] Use `False` instead of `... and False and ...`
68 68 | a and dict({1: 1}) and False and dict({2: 2}) # SIM223
69 69 |
SIM223.py:68:7: SIM223 [*] Use `False` instead of `... and False and ...`
SIM223.py:68:7: SIM223 [**] Use `False` instead of `... and False and ...`
|
66 | a and {1: 1} and False and {2: 2} # SIM223
67 |
@ -408,7 +408,7 @@ SIM223.py:68:7: SIM223 [*] Use `False` instead of `... and False and ...`
70 70 | a and set() and False # SIM223
71 71 |
SIM223.py:70:7: SIM223 [*] Use `set()` instead of `set() and ...`
SIM223.py:70:7: SIM223 [**] Use `set()` instead of `set() and ...`
|
68 | a and dict({1: 1}) and False and dict({2: 2}) # SIM223
69 |
@ -429,7 +429,7 @@ SIM223.py:70:7: SIM223 [*] Use `set()` instead of `set() and ...`
72 72 | a and set(set()) and False # SIM223
73 73 |
SIM223.py:72:7: SIM223 [*] Use `set(set())` instead of `set(set()) and ...`
SIM223.py:72:7: SIM223 [**] Use `set(set())` instead of `set(set()) and ...`
|
70 | a and set() and False # SIM223
71 |
@ -450,7 +450,7 @@ SIM223.py:72:7: SIM223 [*] Use `set(set())` instead of `set(set()) and ...`
74 74 | a and {1} and False and {2} # SIM223
75 75 |
SIM223.py:74:7: SIM223 [*] Use `False` instead of `... and False and ...`
SIM223.py:74:7: SIM223 [**] Use `False` instead of `... and False and ...`
|
72 | a and set(set()) and False # SIM223
73 |
@ -471,7 +471,7 @@ SIM223.py:74:7: SIM223 [*] Use `False` instead of `... and False and ...`
76 76 | a and set({1}) and False and set({2}) # SIM223
77 77 |
SIM223.py:76:7: SIM223 [*] Use `False` instead of `... and False and ...`
SIM223.py:76:7: SIM223 [**] Use `False` instead of `... and False and ...`
|
74 | a and {1} and False and {2} # SIM223
75 |
@ -492,7 +492,7 @@ SIM223.py:76:7: SIM223 [*] Use `False` instead of `... and False and ...`
78 78 | a and () and False # SIM222
79 79 |
SIM223.py:78:7: SIM223 [*] Use `()` instead of `() and ...`
SIM223.py:78:7: SIM223 [**] Use `()` instead of `() and ...`
|
76 | a and set({1}) and False and set({2}) # SIM223
77 |
@ -513,7 +513,7 @@ SIM223.py:78:7: SIM223 [*] Use `()` instead of `() and ...`
80 80 | a and tuple(()) and False # SIM222
81 81 |
SIM223.py:80:7: SIM223 [*] Use `tuple(())` instead of `tuple(()) and ...`
SIM223.py:80:7: SIM223 [**] Use `tuple(())` instead of `tuple(()) and ...`
|
78 | a and () and False # SIM222
79 |
@ -534,7 +534,7 @@ SIM223.py:80:7: SIM223 [*] Use `tuple(())` instead of `tuple(()) and ...`
82 82 | a and (1,) and False and (2,) # SIM222
83 83 |
SIM223.py:82:7: SIM223 [*] Use `False` instead of `... and False and ...`
SIM223.py:82:7: SIM223 [**] Use `False` instead of `... and False and ...`
|
80 | a and tuple(()) and False # SIM222
81 |
@ -555,7 +555,7 @@ SIM223.py:82:7: SIM223 [*] Use `False` instead of `... and False and ...`
84 84 | a and tuple((1,)) and False and tuple((2,)) # SIM222
85 85 |
SIM223.py:84:7: SIM223 [*] Use `False` instead of `... and False and ...`
SIM223.py:84:7: SIM223 [**] Use `False` instead of `... and False and ...`
|
82 | a and (1,) and False and (2,) # SIM222
83 |
@ -576,7 +576,7 @@ SIM223.py:84:7: SIM223 [*] Use `False` instead of `... and False and ...`
86 86 | a and frozenset() and False # SIM222
87 87 |
SIM223.py:86:7: SIM223 [*] Use `frozenset()` instead of `frozenset() and ...`
SIM223.py:86:7: SIM223 [**] Use `frozenset()` instead of `frozenset() and ...`
|
84 | a and tuple((1,)) and False and tuple((2,)) # SIM222
85 |
@ -597,7 +597,7 @@ SIM223.py:86:7: SIM223 [*] Use `frozenset()` instead of `frozenset() and ...`
88 88 | a and frozenset(frozenset()) and False # SIM222
89 89 |
SIM223.py:88:7: SIM223 [*] Use `frozenset(frozenset())` instead of `frozenset(frozenset()) and ...`
SIM223.py:88:7: SIM223 [**] Use `frozenset(frozenset())` instead of `frozenset(frozenset()) and ...`
|
86 | a and frozenset() and False # SIM222
87 |
@ -618,7 +618,7 @@ SIM223.py:88:7: SIM223 [*] Use `frozenset(frozenset())` instead of `frozenset(fr
90 90 | a and frozenset({1}) and False and frozenset({2}) # SIM222
91 91 |
SIM223.py:90:7: SIM223 [*] Use `False` instead of `... and False and ...`
SIM223.py:90:7: SIM223 [**] Use `False` instead of `... and False and ...`
|
88 | a and frozenset(frozenset()) and False # SIM222
89 |
@ -639,7 +639,7 @@ SIM223.py:90:7: SIM223 [*] Use `False` instead of `... and False and ...`
92 92 | a and frozenset(frozenset({1})) and False and frozenset(frozenset({2})) # SIM222
93 93 |
SIM223.py:92:7: SIM223 [*] Use `False` instead of `... and False and ...`
SIM223.py:92:7: SIM223 [**] Use `False` instead of `... and False and ...`
|
90 | a and frozenset({1}) and False and frozenset({2}) # SIM222
91 |
@ -658,7 +658,7 @@ SIM223.py:92:7: SIM223 [*] Use `False` instead of `... and False and ...`
94 94 |
95 95 | # Inside test `a` is simplified.
SIM223.py:97:6: SIM223 [*] Use `False` instead of `... and False and ...`
SIM223.py:97:6: SIM223 [**] Use `False` instead of `... and False and ...`
|
95 | # Inside test `a` is simplified.
96 |
@ -679,7 +679,7 @@ SIM223.py:97:6: SIM223 [*] Use `False` instead of `... and False and ...`
99 99 | assert a and [] and False and [] # SIM223
100 100 |
SIM223.py:99:8: SIM223 [*] Use `False` instead of `... and False and ...`
SIM223.py:99:8: SIM223 [**] Use `False` instead of `... and False and ...`
|
97 | bool(a and [] and False and []) # SIM223
98 |
@ -700,7 +700,7 @@ SIM223.py:99:8: SIM223 [*] Use `False` instead of `... and False and ...`
101 101 | if (a and [] and False and []) or (a and [] and False and []): # SIM223
102 102 | pass
SIM223.py:101:5: SIM223 [*] Use `False` instead of `... and False and ...`
SIM223.py:101:5: SIM223 [**] Use `False` instead of `... and False and ...`
|
99 | assert a and [] and False and [] # SIM223
100 |
@ -720,7 +720,7 @@ SIM223.py:101:5: SIM223 [*] Use `False` instead of `... and False and ...`
103 103 |
104 104 | 0 if a and [] and False and [] else 1 # SIM222
SIM223.py:101:36: SIM223 [*] Use `False` instead of `... and False and ...`
SIM223.py:101:36: SIM223 [**] Use `False` instead of `... and False and ...`
|
99 | assert a and [] and False and [] # SIM223
100 |
@ -740,7 +740,7 @@ SIM223.py:101:36: SIM223 [*] Use `False` instead of `... and False and ...`
103 103 |
104 104 | 0 if a and [] and False and [] else 1 # SIM222
SIM223.py:104:6: SIM223 [*] Use `False` instead of `... and False and ...`
SIM223.py:104:6: SIM223 [**] Use `False` instead of `... and False and ...`
|
102 | pass
103 |
@ -761,7 +761,7 @@ SIM223.py:104:6: SIM223 [*] Use `False` instead of `... and False and ...`
106 106 | while a and [] and False and []: # SIM223
107 107 | pass
SIM223.py:106:7: SIM223 [*] Use `False` instead of `... and False and ...`
SIM223.py:106:7: SIM223 [**] Use `False` instead of `... and False and ...`
|
104 | 0 if a and [] and False and [] else 1 # SIM222
105 |
@ -781,7 +781,7 @@ SIM223.py:106:7: SIM223 [*] Use `False` instead of `... and False and ...`
108 108 |
109 109 | [
SIM223.py:113:8: SIM223 [*] Use `False` instead of `... and False and ...`
SIM223.py:113:8: SIM223 [**] Use `False` instead of `... and False and ...`
|
111 | for a in range(10)
112 | for b in range(10)
@ -802,7 +802,7 @@ SIM223.py:113:8: SIM223 [*] Use `False` instead of `... and False and ...`
115 115 | ]
116 116 |
SIM223.py:114:8: SIM223 [*] Use `False` instead of `... and False and ...`
SIM223.py:114:8: SIM223 [**] Use `False` instead of `... and False and ...`
|
112 | for b in range(10)
113 | if a and [] and False and [] # SIM223
@ -822,7 +822,7 @@ SIM223.py:114:8: SIM223 [*] Use `False` instead of `... and False and ...`
116 116 |
117 117 | {
SIM223.py:121:8: SIM223 [*] Use `False` instead of `... and False and ...`
SIM223.py:121:8: SIM223 [**] Use `False` instead of `... and False and ...`
|
119 | for a in range(10)
120 | for b in range(10)
@ -843,7 +843,7 @@ SIM223.py:121:8: SIM223 [*] Use `False` instead of `... and False and ...`
123 123 | }
124 124 |
SIM223.py:122:8: SIM223 [*] Use `False` instead of `... and False and ...`
SIM223.py:122:8: SIM223 [**] Use `False` instead of `... and False and ...`
|
120 | for b in range(10)
121 | if a and [] and False and [] # SIM223
@ -863,7 +863,7 @@ SIM223.py:122:8: SIM223 [*] Use `False` instead of `... and False and ...`
124 124 |
125 125 | {
SIM223.py:129:8: SIM223 [*] Use `False` instead of `... and False and ...`
SIM223.py:129:8: SIM223 [**] Use `False` instead of `... and False and ...`
|
127 | for a in range(10)
128 | for b in range(10)
@ -884,7 +884,7 @@ SIM223.py:129:8: SIM223 [*] Use `False` instead of `... and False and ...`
131 131 | }
132 132 |
SIM223.py:130:8: SIM223 [*] Use `False` instead of `... and False and ...`
SIM223.py:130:8: SIM223 [**] Use `False` instead of `... and False and ...`
|
128 | for b in range(10)
129 | if a and [] and False and [] # SIM223
@ -904,7 +904,7 @@ SIM223.py:130:8: SIM223 [*] Use `False` instead of `... and False and ...`
132 132 |
133 133 | (
SIM223.py:137:8: SIM223 [*] Use `False` instead of `... and False and ...`
SIM223.py:137:8: SIM223 [**] Use `False` instead of `... and False and ...`
|
135 | for a in range(10)
136 | for b in range(10)
@ -925,7 +925,7 @@ SIM223.py:137:8: SIM223 [*] Use `False` instead of `... and False and ...`
139 139 | )
140 140 |
SIM223.py:138:8: SIM223 [*] Use `False` instead of `... and False and ...`
SIM223.py:138:8: SIM223 [**] Use `False` instead of `... and False and ...`
|
136 | for b in range(10)
137 | if a and [] and False and [] # SIM223
@ -945,7 +945,7 @@ SIM223.py:138:8: SIM223 [*] Use `False` instead of `... and False and ...`
140 140 |
141 141 | # Outside test `a` is not simplified.
SIM223.py:143:7: SIM223 [*] Use `[]` instead of `[] and ...`
SIM223.py:143:7: SIM223 [**] Use `[]` instead of `[] and ...`
|
141 | # Outside test `a` is not simplified.
142 |
@ -966,7 +966,7 @@ SIM223.py:143:7: SIM223 [*] Use `[]` instead of `[] and ...`
145 145 | if (a and [] and False and []) == (a and []): # SIM223
146 146 | pass
SIM223.py:145:11: SIM223 [*] Use `[]` instead of `[] and ...`
SIM223.py:145:11: SIM223 [**] Use `[]` instead of `[] and ...`
|
143 | a and [] and False and [] # SIM223
144 |
@ -986,7 +986,7 @@ SIM223.py:145:11: SIM223 [*] Use `[]` instead of `[] and ...`
147 147 |
148 148 | if f(a and [] and False and []): # SIM223
SIM223.py:148:12: SIM223 [*] Use `[]` instead of `[] and ...`
SIM223.py:148:12: SIM223 [**] Use `[]` instead of `[] and ...`
|
146 | pass
147 |

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs
---
SIM401.py:6:1: SIM401 [*] Use `var = a_dict.get(key, "default1")` instead of an `if` block
SIM401.py:6:1: SIM401 [**] Use `var = a_dict.get(key, "default1")` instead of an `if` block
|
5 | # SIM401 (pattern-1)
6 | / if key in a_dict:
@ -27,7 +27,7 @@ SIM401.py:6:1: SIM401 [*] Use `var = a_dict.get(key, "default1")` instead of an
11 8 | # SIM401 (pattern-2)
12 9 | if key not in a_dict:
SIM401.py:12:1: SIM401 [*] Use `var = a_dict.get(key, "default2")` instead of an `if` block
SIM401.py:12:1: SIM401 [**] Use `var = a_dict.get(key, "default2")` instead of an `if` block
|
11 | # SIM401 (pattern-2)
12 | / if key not in a_dict:
@ -53,7 +53,7 @@ SIM401.py:12:1: SIM401 [*] Use `var = a_dict.get(key, "default2")` instead of an
17 14 | # OK (default contains effect)
18 15 | if key in a_dict:
SIM401.py:24:1: SIM401 [*] Use `var = a_dict.get(keys[idx], "default")` instead of an `if` block
SIM401.py:24:1: SIM401 [**] Use `var = a_dict.get(keys[idx], "default")` instead of an `if` block
|
23 | # SIM401 (complex expression in key)
24 | / if keys[idx] in a_dict:
@ -79,7 +79,7 @@ SIM401.py:24:1: SIM401 [*] Use `var = a_dict.get(keys[idx], "default")` instead
29 26 | # SIM401 (complex expression in dict)
30 27 | if key in dicts[idx]:
SIM401.py:30:1: SIM401 [*] Use `var = dicts[idx].get(key, "default")` instead of an `if` block
SIM401.py:30:1: SIM401 [**] Use `var = dicts[idx].get(key, "default")` instead of an `if` block
|
29 | # SIM401 (complex expression in dict)
30 | / if key in dicts[idx]:
@ -105,7 +105,7 @@ SIM401.py:30:1: SIM401 [*] Use `var = dicts[idx].get(key, "default")` instead of
35 32 | # SIM401 (complex expression in var)
36 33 | if key in a_dict:
SIM401.py:36:1: SIM401 [*] Use `vars[idx] = a_dict.get(key, "defaultß9💣26789ß9💣26789ß9💣26789ß9💣26789ß9💣26789")` instead of an `if` block
SIM401.py:36:1: SIM401 [**] Use `vars[idx] = a_dict.get(key, "defaultß9💣26789ß9💣26789ß9💣26789ß9💣26789ß9💣26789")` instead of an `if` block
|
35 | # SIM401 (complex expression in var)
36 | / if key in a_dict:
@ -131,7 +131,7 @@ SIM401.py:36:1: SIM401 [*] Use `vars[idx] = a_dict.get(key, "defaultß9💣26
41 38 | # SIM401
42 39 | if foo():
SIM401.py:45:5: SIM401 [*] Use `vars[idx] = a_dict.get(key, "default")` instead of an `if` block
SIM401.py:45:5: SIM401 [**] Use `vars[idx] = a_dict.get(key, "default")` instead of an `if` block
|
43 | pass
44 | else:

View File

@ -12,7 +12,7 @@ application.py:5:1: TID252 Relative imports from parent modules are banned
|
= help: Replace relative imports from parent modules with absolute imports
application.py:6:1: TID252 [*] Relative imports from parent modules are banned
application.py:6:1: TID252 [**] Relative imports from parent modules are banned
|
5 | from ....import unknown
6 | from ..protocol import commands, definitions, responses
@ -32,7 +32,7 @@ application.py:6:1: TID252 [*] Relative imports from parent modules are banned
8 8 | from .. import server
9 9 | from . import logger, models
application.py:6:1: TID252 [*] Relative imports from parent modules are banned
application.py:6:1: TID252 [**] Relative imports from parent modules are banned
|
5 | from ....import unknown
6 | from ..protocol import commands, definitions, responses
@ -52,7 +52,7 @@ application.py:6:1: TID252 [*] Relative imports from parent modules are banned
8 8 | from .. import server
9 9 | from . import logger, models
application.py:6:1: TID252 [*] Relative imports from parent modules are banned
application.py:6:1: TID252 [**] Relative imports from parent modules are banned
|
5 | from ....import unknown
6 | from ..protocol import commands, definitions, responses
@ -72,7 +72,7 @@ application.py:6:1: TID252 [*] Relative imports from parent modules are banned
8 8 | from .. import server
9 9 | from . import logger, models
application.py:7:1: TID252 [*] Relative imports from parent modules are banned
application.py:7:1: TID252 [**] Relative imports from parent modules are banned
|
5 | from ....import unknown
6 | from ..protocol import commands, definitions, responses
@ -93,7 +93,7 @@ application.py:7:1: TID252 [*] Relative imports from parent modules are banned
9 9 | from . import logger, models
10 10 | from ..protocol.UpperCaseModule import some_function
application.py:8:1: TID252 [*] Relative imports from parent modules are banned
application.py:8:1: TID252 [**] Relative imports from parent modules are banned
|
6 | from ..protocol import commands, definitions, responses
7 | from ..server import example
@ -113,7 +113,7 @@ application.py:8:1: TID252 [*] Relative imports from parent modules are banned
9 9 | from . import logger, models
10 10 | from ..protocol.UpperCaseModule import some_function
application.py:10:1: TID252 [*] Relative imports from parent modules are banned
application.py:10:1: TID252 [**] Relative imports from parent modules are banned
|
8 | from .. import server
9 | from . import logger, models

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs
---
exempt_modules.py:14:12: TCH002 [*] Move third-party import `flask` into a type-checking block
exempt_modules.py:14:12: TCH002 [**] Move third-party import `flask` into a type-checking block
|
13 | def f():
14 | import flask

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs
---
<filename>:5:5: TCH002 [*] Move third-party import `pandas.DataFrame` into a type-checking block
<filename>:5:5: TCH002 [**] Move third-party import `pandas.DataFrame` into a type-checking block
|
4 | from pandas import (
5 | DataFrame, # DataFrame

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs
---
<filename>:7:5: TCH002 [*] Move third-party import `pandas.DataFrame` into a type-checking block
<filename>:7:5: TCH002 [**] Move third-party import `pandas.DataFrame` into a type-checking block
|
6 | from pandas import (
7 | DataFrame, # DataFrame

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs
---
<filename>:7:5: TCH002 [*] Move third-party import `pandas.DataFrame` into a type-checking block
<filename>:7:5: TCH002 [**] Move third-party import `pandas.DataFrame` into a type-checking block
|
6 | from pandas import (
7 | DataFrame, # DataFrame
@ -29,7 +29,7 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs
11 13 | def f(x: DataFrame, y: Series):
12 14 | pass
<filename>:8:5: TCH002 [*] Move third-party import `pandas.Series` into a type-checking block
<filename>:8:5: TCH002 [**] Move third-party import `pandas.Series` into a type-checking block
|
6 | from pandas import (
7 | DataFrame, # DataFrame

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs
---
<filename>:6:8: TCH003 [*] Move standard library import `os` into a type-checking block
<filename>:6:8: TCH003 [**] Move standard library import `os` into a type-checking block
|
4 | from typing import TYPE_CHECKING
5 |
@ -25,7 +25,7 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs
8 11 | def f(x: os, y: pandas):
9 12 | pass
<filename>:6:12: TCH002 [*] Move third-party import `pandas` into a type-checking block
<filename>:6:12: TCH002 [**] Move third-party import `pandas` into a type-checking block
|
4 | from typing import TYPE_CHECKING
5 |

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs
---
<filename>:6:8: TCH003 [*] Move standard library import `os` into a type-checking block
<filename>:6:8: TCH003 [**] Move standard library import `os` into a type-checking block
|
4 | from typing import TYPE_CHECKING
5 |
@ -24,7 +24,7 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs
8 10 | def f(x: os, y: sys):
9 11 | pass
<filename>:6:12: TCH003 [*] Move standard library import `sys` into a type-checking block
<filename>:6:12: TCH003 [**] Move standard library import `sys` into a type-checking block
|
4 | from typing import TYPE_CHECKING
5 |

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs
---
<filename>:4:18: TCH002 [*] Move third-party import `pandas` into a type-checking block
<filename>:4:18: TCH002 [**] Move third-party import `pandas` into a type-checking block
|
2 | from __future__ import annotations
3 |

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs
---
TCH004_1.py:4:26: TCH004 [*] Move import `datetime.datetime` out of type-checking block. Import is used for more than type hinting.
TCH004_1.py:4:26: TCH004 [**] Move import `datetime.datetime` out of type-checking block. Import is used for more than type hinting.
|
3 | if TYPE_CHECKING:
4 | from datetime import datetime

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs
---
TCH004_11.py:4:24: TCH004 [*] Move import `typing.List` out of type-checking block. Import is used for more than type hinting.
TCH004_11.py:4:24: TCH004 [**] Move import `typing.List` out of type-checking block. Import is used for more than type hinting.
|
3 | if TYPE_CHECKING:
4 | from typing import List

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs
---
TCH004_12.py:6:33: TCH004 [*] Move import `collections.abc.Callable` out of type-checking block. Import is used for more than type hinting.
TCH004_12.py:6:33: TCH004 [**] Move import `collections.abc.Callable` out of type-checking block. Import is used for more than type hinting.
|
5 | if TYPE_CHECKING:
6 | from collections.abc import Callable

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs
---
TCH004_2.py:4:26: TCH004 [*] Move import `datetime.date` out of type-checking block. Import is used for more than type hinting.
TCH004_2.py:4:26: TCH004 [**] Move import `datetime.date` out of type-checking block. Import is used for more than type hinting.
|
3 | if TYPE_CHECKING:
4 | from datetime import date

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs
---
TCH004_4.py:4:24: TCH004 [*] Move import `typing.Any` out of type-checking block. Import is used for more than type hinting.
TCH004_4.py:4:24: TCH004 [**] Move import `typing.Any` out of type-checking block. Import is used for more than type hinting.
|
3 | if TYPE_CHECKING:
4 | from typing import Any

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs
---
TCH004_5.py:4:24: TCH004 [*] Move import `typing.List` out of type-checking block. Import is used for more than type hinting.
TCH004_5.py:4:24: TCH004 [**] Move import `typing.List` out of type-checking block. Import is used for more than type hinting.
|
3 | if TYPE_CHECKING:
4 | from typing import List, Sequence, Set
@ -20,7 +20,7 @@ TCH004_5.py:4:24: TCH004 [*] Move import `typing.List` out of type-checking bloc
6 7 |
7 8 | def example(a: List[int], /, b: Sequence[int], *, c: Set[int]):
TCH004_5.py:4:30: TCH004 [*] Move import `typing.Sequence` out of type-checking block. Import is used for more than type hinting.
TCH004_5.py:4:30: TCH004 [**] Move import `typing.Sequence` out of type-checking block. Import is used for more than type hinting.
|
3 | if TYPE_CHECKING:
4 | from typing import List, Sequence, Set
@ -39,7 +39,7 @@ TCH004_5.py:4:30: TCH004 [*] Move import `typing.Sequence` out of type-checking
6 7 |
7 8 | def example(a: List[int], /, b: Sequence[int], *, c: Set[int]):
TCH004_5.py:4:40: TCH004 [*] Move import `typing.Set` out of type-checking block. Import is used for more than type hinting.
TCH004_5.py:4:40: TCH004 [**] Move import `typing.Set` out of type-checking block. Import is used for more than type hinting.
|
3 | if TYPE_CHECKING:
4 | from typing import List, Sequence, Set

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs
---
TCH004_9.py:4:24: TCH004 [*] Move import `typing.Tuple` out of type-checking block. Import is used for more than type hinting.
TCH004_9.py:4:24: TCH004 [**] Move import `typing.Tuple` out of type-checking block. Import is used for more than type hinting.
|
3 | if TYPE_CHECKING:
4 | from typing import Tuple, List, Dict
@ -22,7 +22,7 @@ TCH004_9.py:4:24: TCH004 [*] Move import `typing.Tuple` out of type-checking blo
6 7 | x: Tuple
7 8 |
TCH004_9.py:4:31: TCH004 [*] Move import `typing.List` out of type-checking block. Import is used for more than type hinting.
TCH004_9.py:4:31: TCH004 [**] Move import `typing.List` out of type-checking block. Import is used for more than type hinting.
|
3 | if TYPE_CHECKING:
4 | from typing import Tuple, List, Dict

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs
---
runtime_evaluated_base_classes_1.py:10:12: TCH004 [*] Move import `datetime` out of type-checking block. Import is used for more than type hinting.
runtime_evaluated_base_classes_1.py:10:12: TCH004 [**] Move import `datetime` out of type-checking block. Import is used for more than type hinting.
|
9 | if TYPE_CHECKING:
10 | import datetime # TCH004
@ -22,7 +22,7 @@ runtime_evaluated_base_classes_1.py:10:12: TCH004 [*] Move import `datetime` out
12 12 |
13 13 | import pandas # TCH004
runtime_evaluated_base_classes_1.py:11:23: TCH004 [*] Move import `array.array` out of type-checking block. Import is used for more than type hinting.
runtime_evaluated_base_classes_1.py:11:23: TCH004 [**] Move import `array.array` out of type-checking block. Import is used for more than type hinting.
|
9 | if TYPE_CHECKING:
10 | import datetime # TCH004
@ -46,7 +46,7 @@ runtime_evaluated_base_classes_1.py:11:23: TCH004 [*] Move import `array.array`
13 13 | import pandas # TCH004
14 14 | import pyproj
runtime_evaluated_base_classes_1.py:13:12: TCH004 [*] Move import `pandas` out of type-checking block. Import is used for more than type hinting.
runtime_evaluated_base_classes_1.py:13:12: TCH004 [**] Move import `pandas` out of type-checking block. Import is used for more than type hinting.
|
11 | from array import array # TCH004
12 |

View File

@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs
---
runtime_evaluated_decorators_1.py:12:12: TCH004 [*] Move import `datetime` out of type-checking block. Import is used for more than type hinting.
runtime_evaluated_decorators_1.py:12:12: TCH004 [**] Move import `datetime` out of type-checking block. Import is used for more than type hinting.
|
11 | if TYPE_CHECKING:
12 | import datetime # TCH004
@ -22,7 +22,7 @@ runtime_evaluated_decorators_1.py:12:12: TCH004 [*] Move import `datetime` out o
14 14 |
15 15 | import pandas # TCH004
runtime_evaluated_decorators_1.py:13:23: TCH004 [*] Move import `array.array` out of type-checking block. Import is used for more than type hinting.
runtime_evaluated_decorators_1.py:13:23: TCH004 [**] Move import `array.array` out of type-checking block. Import is used for more than type hinting.
|
11 | if TYPE_CHECKING:
12 | import datetime # TCH004
@ -46,7 +46,7 @@ runtime_evaluated_decorators_1.py:13:23: TCH004 [*] Move import `array.array` ou
15 15 | import pandas # TCH004
16 16 | import pyproj
runtime_evaluated_decorators_1.py:15:12: TCH004 [*] Move import `pandas` out of type-checking block. Import is used for more than type hinting.
runtime_evaluated_decorators_1.py:15:12: TCH004 [**] Move import `pandas` out of type-checking block. Import is used for more than type hinting.
|
13 | from array import array # TCH004
14 |

Some files were not shown because too many files have changed in this diff Show More