test: update formatting of multi-line annotations

It's hard to grok the change from the snapshot diffs alone, so here's
one example. Before:

    PYI021.pyi:15:5: PYI021 [*] Docstrings should not be included in stubs
       |
    14 |   class Baz:
    15 |       """Multiline docstring
       |  _____^
    16 | |
    17 | |     Lorem ipsum dolor sit amet
    18 | |     """
       | |_______^ PYI021
    19 |
    20 |       def __init__(self) -> None: ...
       |
       = help: Remove docstring

And now after:

    PYI021.pyi:15:5: PYI021 [*] Docstrings should not be included in stubs
       |
    14 |   class Baz:
    15 | /     """Multiline docstring
    16 | |
    17 | |     Lorem ipsum dolor sit amet
    18 | |     """
       | |_______^ PYI021
    19 |
    20 |       def __init__(self) -> None: ...
       |
       = help: Remove docstring

I personally think both of these are fine. If we felt strongly, I could
investigate reverting to the old style, but the new style seems okay to
me.

In other words, these updates I believe are just cosmetic and not a bug
fix.
This commit is contained in:
Andrew Gallant 2025-01-07 13:48:33 -05:00 committed by Andrew Gallant
parent 3fa4479c85
commit f29f58105b
110 changed files with 1305 additions and 1825 deletions

View File

@ -1,12 +1,10 @@
---
source: crates/ruff_linter/src/rules/flake8_async/mod.rs
snapshot_kind: text
---
ASYNC100.py:8:5: ASYNC100 A `with trio.fail_after(...):` context does not contain any `await` statements. This makes it pointless, as the timeout can only be triggered by a checkpoint.
|
7 | async def func():
8 | with trio.fail_after():
| _____^
8 | / with trio.fail_after():
9 | | ...
| |___________^ ASYNC100
|
@ -14,8 +12,7 @@ ASYNC100.py:8:5: ASYNC100 A `with trio.fail_after(...):` context does not contai
ASYNC100.py:18:5: ASYNC100 A `with trio.move_on_after(...):` context does not contain any `await` statements. This makes it pointless, as the timeout can only be triggered by a checkpoint.
|
17 | async def func():
18 | with trio.move_on_after():
| _____^
18 | / with trio.move_on_after():
19 | | ...
| |___________^ ASYNC100
|
@ -23,8 +20,7 @@ ASYNC100.py:18:5: ASYNC100 A `with trio.move_on_after(...):` context does not co
ASYNC100.py:45:5: ASYNC100 A `with anyio.move_on_after(...):` context does not contain any `await` statements. This makes it pointless, as the timeout can only be triggered by a checkpoint.
|
44 | async def func():
45 | with anyio.move_on_after(delay=0.2):
| _____^
45 | / with anyio.move_on_after(delay=0.2):
46 | | ...
| |___________^ ASYNC100
|
@ -32,8 +28,7 @@ ASYNC100.py:45:5: ASYNC100 A `with anyio.move_on_after(...):` context does not c
ASYNC100.py:50:5: ASYNC100 A `with anyio.fail_after(...):` context does not contain any `await` statements. This makes it pointless, as the timeout can only be triggered by a checkpoint.
|
49 | async def func():
50 | with anyio.fail_after():
| _____^
50 | / with anyio.fail_after():
51 | | ...
| |___________^ ASYNC100
|
@ -41,8 +36,7 @@ ASYNC100.py:50:5: ASYNC100 A `with anyio.fail_after(...):` context does not cont
ASYNC100.py:55:5: ASYNC100 A `with anyio.CancelScope(...):` context does not contain any `await` statements. This makes it pointless, as the timeout can only be triggered by a checkpoint.
|
54 | async def func():
55 | with anyio.CancelScope():
| _____^
55 | / with anyio.CancelScope():
56 | | ...
| |___________^ ASYNC100
|
@ -50,8 +44,7 @@ ASYNC100.py:55:5: ASYNC100 A `with anyio.CancelScope(...):` context does not con
ASYNC100.py:60:5: ASYNC100 A `with anyio.CancelScope(...):` context does not contain any `await` statements. This makes it pointless, as the timeout can only be triggered by a checkpoint.
|
59 | async def func():
60 | with anyio.CancelScope(), nullcontext():
| _____^
60 | / with anyio.CancelScope(), nullcontext():
61 | | ...
| |___________^ ASYNC100
|
@ -59,8 +52,7 @@ ASYNC100.py:60:5: ASYNC100 A `with anyio.CancelScope(...):` context does not con
ASYNC100.py:65:5: ASYNC100 A `with anyio.CancelScope(...):` context does not contain any `await` statements. This makes it pointless, as the timeout can only be triggered by a checkpoint.
|
64 | async def func():
65 | with nullcontext(), anyio.CancelScope():
| _____^
65 | / with nullcontext(), anyio.CancelScope():
66 | | ...
| |___________^ ASYNC100
|
@ -68,8 +60,7 @@ ASYNC100.py:65:5: ASYNC100 A `with anyio.CancelScope(...):` context does not con
ASYNC100.py:70:5: ASYNC100 A `with asyncio.timeout(...):` context does not contain any `await` statements. This makes it pointless, as the timeout can only be triggered by a checkpoint.
|
69 | async def func():
70 | async with asyncio.timeout(delay=0.2):
| _____^
70 | / async with asyncio.timeout(delay=0.2):
71 | | ...
| |___________^ ASYNC100
|
@ -77,8 +68,7 @@ ASYNC100.py:70:5: ASYNC100 A `with asyncio.timeout(...):` context does not conta
ASYNC100.py:75:5: ASYNC100 A `with asyncio.timeout_at(...):` context does not contain any `await` statements. This makes it pointless, as the timeout can only be triggered by a checkpoint.
|
74 | async def func():
75 | async with asyncio.timeout_at(when=0.2):
| _____^
75 | / async with asyncio.timeout_at(when=0.2):
76 | | ...
| |___________^ ASYNC100
|
@ -86,8 +76,7 @@ ASYNC100.py:75:5: ASYNC100 A `with asyncio.timeout_at(...):` context does not co
ASYNC100.py:85:5: ASYNC100 A `with asyncio.timeout(...):` context does not contain any `await` statements. This makes it pointless, as the timeout can only be triggered by a checkpoint.
|
84 | async def func():
85 | async with asyncio.timeout(delay=0.2), asyncio.TaskGroup(), asyncio.timeout(delay=0.2):
| _____^
85 | / async with asyncio.timeout(delay=0.2), asyncio.TaskGroup(), asyncio.timeout(delay=0.2):
86 | | ...
| |___________^ ASYNC100
|
@ -95,8 +84,7 @@ ASYNC100.py:85:5: ASYNC100 A `with asyncio.timeout(...):` context does not conta
ASYNC100.py:95:5: ASYNC100 A `with asyncio.timeout(...):` context does not contain any `await` statements. This makes it pointless, as the timeout can only be triggered by a checkpoint.
|
94 | async def func():
95 | async with asyncio.timeout(delay=0.2), asyncio.timeout(delay=0.2):
| _____^
95 | / async with asyncio.timeout(delay=0.2), asyncio.timeout(delay=0.2):
96 | | ...
| |___________^ ASYNC100
|

View File

@ -1,12 +1,10 @@
---
source: crates/ruff_linter/src/rules/flake8_async/mod.rs
snapshot_kind: text
---
ASYNC110.py:7:5: ASYNC110 Use `trio.Event` instead of awaiting `trio.sleep` in a `while` loop
|
6 | async def func():
7 | while True:
| _____^
7 | / while True:
8 | | await trio.sleep(10)
| |____________________________^ ASYNC110
|
@ -14,8 +12,7 @@ ASYNC110.py:7:5: ASYNC110 Use `trio.Event` instead of awaiting `trio.sleep` in a
ASYNC110.py:12:5: ASYNC110 Use `trio.Event` instead of awaiting `trio.sleep` in a `while` loop
|
11 | async def func():
12 | while True:
| _____^
12 | / while True:
13 | | await trio.sleep_until(10)
| |__________________________________^ ASYNC110
|
@ -23,8 +20,7 @@ ASYNC110.py:12:5: ASYNC110 Use `trio.Event` instead of awaiting `trio.sleep` in
ASYNC110.py:22:5: ASYNC110 Use `asyncio.Event` instead of awaiting `asyncio.sleep` in a `while` loop
|
21 | async def func():
22 | while True:
| _____^
22 | / while True:
23 | | await anyio.sleep(10)
| |_____________________________^ ASYNC110
|
@ -32,8 +28,7 @@ ASYNC110.py:22:5: ASYNC110 Use `asyncio.Event` instead of awaiting `asyncio.slee
ASYNC110.py:27:5: ASYNC110 Use `asyncio.Event` instead of awaiting `asyncio.sleep` in a `while` loop
|
26 | async def func():
27 | while True:
| _____^
27 | / while True:
28 | | await anyio.sleep_until(10)
| |___________________________________^ ASYNC110
|
@ -41,8 +36,7 @@ ASYNC110.py:27:5: ASYNC110 Use `asyncio.Event` instead of awaiting `asyncio.slee
ASYNC110.py:37:5: ASYNC110 Use `anyio.Event` instead of awaiting `anyio.sleep` in a `while` loop
|
36 | async def func():
37 | while True:
| _____^
37 | / while True:
38 | | await asyncio.sleep(10)
| |_______________________________^ ASYNC110
|

View File

@ -1,6 +1,5 @@
---
source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs
snapshot_kind: text
---
S608.py:2:10: S608 Possible SQL injection vector through string-based query construction
|
@ -46,14 +45,14 @@ S608.py:6:10: S608 Possible SQL injection vector through string-based query cons
5 | query4 = "SELECT {} FROM table;".format(var)
6 | query5 = f"SELECT * FROM table WHERE var = {var}"
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
7 |
7 |
8 | query6 = "DELETE FROM table WHERE var = %s" % (var,)
|
S608.py:8:10: S608 Possible SQL injection vector through string-based query construction
|
6 | query5 = f"SELECT * FROM table WHERE var = {var}"
7 |
7 |
8 | query6 = "DELETE FROM table WHERE var = %s" % (var,)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
9 | query7 = "DELETE FROM table WHERE VAR = " + var
@ -94,14 +93,14 @@ S608.py:12:11: S608 Possible SQL injection vector through string-based query con
11 | query9 = "DELETE FROM table WHERE var = {}".format(var)
12 | query10 = f"DELETE FROM table WHERE var = {var}"
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
13 |
13 |
14 | query11 = "INSERT INTO table VALUES (%s)" % (var,)
|
S608.py:14:11: S608 Possible SQL injection vector through string-based query construction
|
12 | query10 = f"DELETE FROM table WHERE var = {var}"
13 |
13 |
14 | query11 = "INSERT INTO table VALUES (%s)" % (var,)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
15 | query12 = "INSERT INTO TABLE VALUES (" + var + ")"
@ -132,14 +131,14 @@ S608.py:17:11: S608 Possible SQL injection vector through string-based query con
16 | query13 = "INSERT INTO {} VALUES ({})".format(table, var)
17 | query14 = f"INSERT INTO {table} VALUES var = {var}"
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
18 |
18 |
19 | query15 = "UPDATE %s SET var = %s" % (table, var)
|
S608.py:19:11: S608 Possible SQL injection vector through string-based query construction
|
17 | query14 = f"INSERT INTO {table} VALUES var = {var}"
18 |
18 |
19 | query15 = "UPDATE %s SET var = %s" % (table, var)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
20 | query16 = "UPDATE " + table + " SET var = " + var
@ -170,14 +169,14 @@ S608.py:22:11: S608 Possible SQL injection vector through string-based query con
21 | query17 = "UPDATE {} SET var = {}".format(table, var)
22 | query18 = f"UPDATE {table} SET var = {var}"
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
23 |
23 |
24 | query19 = "select %s from table" % (var,)
|
S608.py:24:11: S608 Possible SQL injection vector through string-based query construction
|
22 | query18 = f"UPDATE {table} SET var = {var}"
23 |
23 |
24 | query19 = "select %s from table" % (var,)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
25 | query20 = "select var from " + table
@ -218,14 +217,14 @@ S608.py:28:11: S608 Possible SQL injection vector through string-based query con
27 | query22 = "select {} from table;".format(var)
28 | query23 = f"select * from table where var = {var}"
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
29 |
29 |
30 | query24 = "delete from table where var = %s" % (var,)
|
S608.py:30:11: S608 Possible SQL injection vector through string-based query construction
|
28 | query23 = f"select * from table where var = {var}"
29 |
29 |
30 | query24 = "delete from table where var = %s" % (var,)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
31 | query25 = "delete from table where var = " + var
@ -266,14 +265,14 @@ S608.py:34:11: S608 Possible SQL injection vector through string-based query con
33 | query27 = "delete from table where var = {}".format(var)
34 | query28 = f"delete from table where var = {var}"
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
35 |
35 |
36 | query29 = "insert into table values (%s)" % (var,)
|
S608.py:36:11: S608 Possible SQL injection vector through string-based query construction
|
34 | query28 = f"delete from table where var = {var}"
35 |
35 |
36 | query29 = "insert into table values (%s)" % (var,)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
37 | query30 = "insert into table values (" + var + ")"
@ -304,14 +303,14 @@ S608.py:39:11: S608 Possible SQL injection vector through string-based query con
38 | query31 = "insert into {} values ({})".format(table, var)
39 | query32 = f"insert into {table} values var = {var}"
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
40 |
40 |
41 | query33 = "update %s set var = %s" % (table, var)
|
S608.py:41:11: S608 Possible SQL injection vector through string-based query construction
|
39 | query32 = f"insert into {table} values var = {var}"
40 |
40 |
41 | query33 = "update %s set var = %s" % (table, var)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
42 | query34 = "update " + table + " set var = " + var
@ -342,7 +341,7 @@ S608.py:44:11: S608 Possible SQL injection vector through string-based query con
43 | query35 = "update {} set var = {}".format(table, var)
44 | query36 = f"update {table} set var = {var}"
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
45 |
45 |
46 | # multi-line failures
|
@ -357,7 +356,7 @@ S608.py:48:12: S608 Possible SQL injection vector through string-based query con
51 | | WHERE var = %s
52 | | """ % var
| |_____________^ S608
53 |
53 |
54 | def query38():
|
@ -371,7 +370,7 @@ S608.py:55:12: S608 Possible SQL injection vector through string-based query con
58 | | WHERE var =
59 | | """ + var
| |_____________^ S608
60 |
60 |
61 | def query39():
|
@ -385,7 +384,7 @@ S608.py:62:12: S608 Possible SQL injection vector through string-based query con
65 | | WHERE var = {}
66 | | """.format(var)
| |___________________^ S608
67 |
67 |
68 | def query40():
|
@ -399,7 +398,7 @@ S608.py:69:12: S608 Possible SQL injection vector through string-based query con
72 | | WHERE var = {var}
73 | | """
| |_______^ S608
74 |
74 |
75 | def query41():
|
@ -407,8 +406,7 @@ S608.py:77:9: S608 Possible SQL injection vector through string-based query cons
|
75 | def query41():
76 | return (
77 | "SELECT * "
| _________^
77 | / "SELECT * "
78 | | "FROM table "
79 | | f"WHERE var = {var}"
| |____________________________^ S608
@ -449,7 +447,7 @@ S608.py:86:30: S608 Possible SQL injection vector through string-based query con
85 | query44 = cursor.execute("SELECT * FROM table WHERE var = {}".format(var))
86 | query45 = cursor.executemany("SELECT * FROM table WHERE var = %s" % var, [])
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
87 |
87 |
88 | # # pass
|
@ -458,7 +456,7 @@ S608.py:98:11: S608 Possible SQL injection vector through string-based query con
97 | # # INSERT without INTO (e.g. MySQL and derivatives)
98 | query46 = "INSERT table VALUES (%s)" % (var,)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
99 |
99 |
100 | # # REPLACE (e.g. MySQL and derivatives, SQLite)
|
@ -476,7 +474,7 @@ S608.py:102:11: S608 Possible SQL injection vector through string-based query co
101 | query47 = "REPLACE INTO table VALUES (%s)" % (var,)
102 | query48 = "REPLACE table VALUES (%s)" % (var,)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
103 |
103 |
104 | query49 = "Deselect something that is not SQL even though it has a ' from ' somewhere in %s." % "there"
|
@ -494,7 +492,7 @@ S608.py:112:1: S608 Possible SQL injection vector through string-based query con
111 | "SELECT * FROM " + ("table1" if x > 0 else "table2") # query50
112 | "SELECT * FROM " + ("table1" if x > 0 else ["table2"]) # query51
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
113 |
113 |
114 | # test cases from #12044
|
@ -507,7 +505,7 @@ S608.py:117:12: S608 Possible SQL injection vector through string-based query co
119 | | FROM bar
120 | | """
| |_______^ S608
121 |
121 |
122 | def query53():
|
@ -521,7 +519,7 @@ S608.py:123:12: S608 Possible SQL injection vector through string-based query co
126 | | FROM bar
127 | | """
| |_______^ S608
128 |
128 |
129 | def query54():
|
@ -535,46 +533,46 @@ S608.py:130:12: S608 Possible SQL injection vector through string-based query co
133 | | bar
134 | | """
| |_______^ S608
135 |
135 |
136 | query55 = f"""SELECT * FROM
|
S608.py:136:11: S608 Possible SQL injection vector through string-based query construction
|
134 | """
135 |
135 |
136 | query55 = f"""SELECT * FROM
| ___________^
137 | | {var}.table
138 | | """
| |___^ S608
139 |
139 |
140 | query56 = f"""SELECT *
|
S608.py:140:11: S608 Possible SQL injection vector through string-based query construction
|
138 | """
139 |
139 |
140 | query56 = f"""SELECT *
| ___________^
141 | | FROM {var}.table
142 | | """
| |___^ S608
143 |
143 |
144 | query57 = f"""
|
S608.py:144:11: S608 Possible SQL injection vector through string-based query construction
|
142 | """
143 |
143 |
144 | query57 = f"""
| ___________^
145 | | SELECT *
146 | | FROM {var}.table
147 | | """
| |___^ S608
148 |
148 |
149 | query57 = f"""
|

View File

@ -1,55 +1,50 @@
---
source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs
snapshot_kind: text
---
B027.py:18:5: B027 `AbstractClass.empty_1` is an empty method in an abstract base class, but has no abstract decorator
|
17 | class AbstractClass(ABC):
18 | def empty_1(self): # error
| _____^
18 | / def empty_1(self): # error
19 | | ...
| |___________^ B027
20 |
20 |
21 | def empty_2(self): # error
|
B027.py:21:5: B027 `AbstractClass.empty_2` is an empty method in an abstract base class, but has no abstract decorator
|
19 | ...
20 |
21 | def empty_2(self): # error
| _____^
20 |
21 | / def empty_2(self): # error
22 | | pass
| |____________^ B027
23 |
23 |
24 | def empty_3(self): # error
|
B027.py:24:5: B027 `AbstractClass.empty_3` is an empty method in an abstract base class, but has no abstract decorator
|
22 | pass
23 |
24 | def empty_3(self): # error
| _____^
23 |
24 | / def empty_3(self): # error
25 | | """docstring"""
26 | | ...
| |___________^ B027
27 |
27 |
28 | def empty_4(self): # error
|
B027.py:28:5: B027 `AbstractClass.empty_4` is an empty method in an abstract base class, but has no abstract decorator
|
26 | ...
27 |
28 | def empty_4(self): # error
| _____^
27 |
28 | / def empty_4(self): # error
29 | | """multiple ellipsis/pass"""
30 | | ...
31 | | pass
32 | | ...
33 | | pass
| |____________^ B027
34 |
34 |
35 | @notabstract
|

View File

@ -1,6 +1,5 @@
---
source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs
snapshot_kind: text
---
C419.py:1:5: C419 [*] Unnecessary list comprehension
|
@ -84,7 +83,7 @@ C419.py:9:5: C419 [*] Unnecessary set comprehension
8 | ) # third comment
9 | any({x.id for x in bar})
| ^^^^^^^^^^^^^^^^^^^ C419
10 |
10 |
11 | # OK
|
= help: Remove unnecessary comprehension
@ -103,8 +102,7 @@ C419.py:28:5: C419 [*] Unnecessary list comprehension
|
26 | # Special comment handling
27 | any(
28 | [ # lbracket comment
| _____^
28 | / [ # lbracket comment
29 | | # second line comment
30 | | i.bit_count()
31 | | # random middle comment
@ -189,7 +187,7 @@ C419.py:50:5: C419 [*] Unnecessary set comprehension
49 | any({x.id for x in bar})
50 | all({x.id for x in bar})
| ^^^^^^^^^^^^^^^^^^^ C419
51 |
51 |
52 | # should be linted in preview...
|
= help: Remove unnecessary comprehension

View File

@ -1,6 +1,5 @@
---
source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs
snapshot_kind: text
---
C419_1.py:1:5: C419 [*] Unnecessary list comprehension
|
@ -61,7 +60,7 @@ C419_1.py:4:5: C419 [*] Unnecessary list comprehension
3 | max([x.val for x in bar])
4 | sum([x.val for x in bar], 0)
| ^^^^^^^^^^^^^^^^^^^^ C419
5 |
5 |
6 | # OK
|
= help: Remove unnecessary comprehension
@ -80,8 +79,7 @@ C419_1.py:14:5: C419 [*] Unnecessary list comprehension
|
12 | # Multi-line
13 | sum(
14 | [
| _____^
14 | / [
15 | | delta
16 | | for delta in timedelta_list
17 | | if delta

View File

@ -1,11 +1,10 @@
---
source: crates/ruff_linter/src/rules/flake8_django/mod.rs
snapshot_kind: text
---
DJ012.py:28:5: DJ012 Order of model's inner classes, methods, and fields does not follow the Django Style Guide: field declaration should come before `Meta` class
|
26 | return "foobar"
27 |
27 |
28 | first_name = models.CharField(max_length=32)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ DJ012
|
@ -13,7 +12,7 @@ DJ012.py:28:5: DJ012 Order of model's inner classes, methods, and fields does no
DJ012.py:43:5: DJ012 Order of model's inner classes, methods, and fields does not follow the Django Style Guide: field declaration should come before manager declaration
|
41 | return "foobar"
42 |
42 |
43 | first_name = models.CharField(max_length=32)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ DJ012
|
@ -21,9 +20,8 @@ DJ012.py:43:5: DJ012 Order of model's inner classes, methods, and fields does no
DJ012.py:56:5: DJ012 Order of model's inner classes, methods, and fields does not follow the Django Style Guide: Magic method should come before custom method
|
54 | pass
55 |
56 | def __str__(self):
| _____^
55 |
56 | / def __str__(self):
57 | | return "foobar"
| |_______________________^ DJ012
|
@ -31,9 +29,8 @@ DJ012.py:56:5: DJ012 Order of model's inner classes, methods, and fields does no
DJ012.py:69:5: DJ012 Order of model's inner classes, methods, and fields does not follow the Django Style Guide: `save` method should come before `get_absolute_url` method
|
67 | pass
68 |
69 | def save(self):
| _____^
68 |
69 | / def save(self):
70 | | pass
| |____________^ DJ012
|
@ -41,7 +38,7 @@ DJ012.py:69:5: DJ012 Order of model's inner classes, methods, and fields does no
DJ012.py:123:5: DJ012 Order of model's inner classes, methods, and fields does not follow the Django Style Guide: field declaration should come before `Meta` class
|
121 | verbose_name = "test"
122 |
122 |
123 | first_name = models.CharField(max_length=32)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ DJ012
124 | last_name = models.CharField(max_length=32)
@ -50,7 +47,7 @@ DJ012.py:123:5: DJ012 Order of model's inner classes, methods, and fields does n
DJ012.py:129:5: DJ012 Order of model's inner classes, methods, and fields does not follow the Django Style Guide: field declaration should come before `Meta` class
|
127 | pass
128 |
128 |
129 | middle_name = models.CharField(max_length=32)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ DJ012
|
@ -58,7 +55,7 @@ DJ012.py:129:5: DJ012 Order of model's inner classes, methods, and fields does n
DJ012.py:146:5: DJ012 Order of model's inner classes, methods, and fields does not follow the Django Style Guide: field declaration should come before `Meta` class
|
144 | return "foobar"
145 |
145 |
146 | first_name = models.CharField(max_length=32)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ DJ012
|

View File

@ -1,6 +1,5 @@
---
source: crates/ruff_linter/src/rules/flake8_errmsg/mod.rs
snapshot_kind: text
---
EM.py:5:24: EM101 [*] Exception must not use a string literal, assign to variable first
|
@ -83,7 +82,7 @@ EM.py:32:24: EM101 [*] Exception must not use a string literal, assign to variab
EM.py:39:24: EM101 [*] Exception must not use a string literal, assign to variable first
|
37 | msg = "hello"
38 |
38 |
39 | raise RuntimeError("This is an example exception")
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ EM101
|
@ -223,8 +222,7 @@ EM.py:76:9: EM103 [*] Exception must not use a `.format()` string directly, assi
|
74 | def f_multi_line_string2():
75 | raise RuntimeError(
76 | "This is an {example} exception".format(
| _________^
76 | / "This is an {example} exception".format(
77 | | example="example"
78 | | )
| |_________^ EM103
@ -253,8 +251,7 @@ EM.py:84:9: EM103 [*] Exception must not use a `.format()` string directly, assi
|
82 | def f_multi_line_string2():
83 | raise RuntimeError(
84 | (
| _________^
84 | / (
85 | | "This is an "
86 | | "{example} exception"
87 | | ).format(

View File

@ -1,6 +1,5 @@
---
source: crates/ruff_linter/src/rules/flake8_errmsg/mod.rs
snapshot_kind: text
---
EM.py:5:24: EM101 [*] Exception must not use a string literal, assign to variable first
|
@ -121,7 +120,7 @@ EM.py:32:24: EM101 [*] Exception must not use a string literal, assign to variab
EM.py:39:24: EM101 [*] Exception must not use a string literal, assign to variable first
|
37 | msg = "hello"
38 |
38 |
39 | raise RuntimeError("This is an example exception")
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ EM101
|
@ -261,8 +260,7 @@ EM.py:69:9: EM101 [*] Exception must not use a string literal, assign to variabl
|
67 | def f_multi_line_string():
68 | raise RuntimeError(
69 | "first"
| _________^
69 | / "first"
70 | | "second"
| |________________^ EM101
71 | )
@ -289,8 +287,7 @@ EM.py:76:9: EM103 [*] Exception must not use a `.format()` string directly, assi
|
74 | def f_multi_line_string2():
75 | raise RuntimeError(
76 | "This is an {example} exception".format(
| _________^
76 | / "This is an {example} exception".format(
77 | | example="example"
78 | | )
| |_________^ EM103
@ -319,8 +316,7 @@ EM.py:84:9: EM103 [*] Exception must not use a `.format()` string directly, assi
|
82 | def f_multi_line_string2():
83 | raise RuntimeError(
84 | (
| _________^
84 | / (
85 | | "This is an "
86 | | "{example} exception"
87 | | ).format(

View File

@ -1,12 +1,10 @@
---
source: crates/ruff_linter/src/rules/flake8_implicit_str_concat/mod.rs
snapshot_kind: text
---
ISC.py:9:3: ISC003 Explicitly concatenated string should be implicitly concatenated
|
8 | _ = (
9 | "abc" +
| ___^
9 | / "abc" +
10 | | "def"
| |_______^ ISC003
11 | )
@ -15,8 +13,7 @@ ISC.py:9:3: ISC003 Explicitly concatenated string should be implicitly concatena
ISC.py:14:3: ISC003 Explicitly concatenated string should be implicitly concatenated
|
13 | _ = (
14 | f"abc" +
| ___^
14 | / f"abc" +
15 | | "def"
| |_______^ ISC003
16 | )
@ -25,8 +22,7 @@ ISC.py:14:3: ISC003 Explicitly concatenated string should be implicitly concaten
ISC.py:19:3: ISC003 Explicitly concatenated string should be implicitly concatenated
|
18 | _ = (
19 | b"abc" +
| ___^
19 | / b"abc" +
20 | | b"def"
| |________^ ISC003
21 | )
@ -51,6 +47,6 @@ ISC.py:80:10: ISC003 Explicitly concatenated string should be implicitly concate
| __________^
81 | | + f"second"} d"
| |_______________^ ISC003
82 |
82 |
83 | # See https://github.com/astral-sh/ruff/issues/12936
|

View File

@ -1,24 +1,22 @@
---
source: crates/ruff_linter/src/rules/flake8_implicit_str_concat/mod.rs
snapshot_kind: text
---
ISC.py:5:5: ISC002 Implicitly concatenated string literals over multiple lines
|
3 | _ = "abc" + "def"
4 |
4 |
5 | _ = "abc" \
| _____^
6 | | "def"
| |_________^ ISC002
7 |
7 |
8 | _ = (
|
ISC.py:24:3: ISC002 Implicitly concatenated string literals over multiple lines
|
23 | _ = (
24 | "abc"
| ___^
24 | / "abc"
25 | | "def"
| |_______^ ISC002
26 | )
@ -27,8 +25,7 @@ ISC.py:24:3: ISC002 Implicitly concatenated string literals over multiple lines
ISC.py:29:3: ISC002 Implicitly concatenated string literals over multiple lines
|
28 | _ = (
29 | f"abc"
| ___^
29 | / f"abc"
30 | | "def"
| |_______^ ISC002
31 | )
@ -37,8 +34,7 @@ ISC.py:29:3: ISC002 Implicitly concatenated string literals over multiple lines
ISC.py:34:3: ISC002 Implicitly concatenated string literals over multiple lines
|
33 | _ = (
34 | b"abc"
| ___^
34 | / b"abc"
35 | | b"def"
| |________^ ISC002
36 | )
@ -48,8 +44,7 @@ ISC.py:67:5: ISC002 Implicitly concatenated string literals over multiple lines
|
65 | _ = f"""abc {"def" "ghi"} jkl"""
66 | _ = f"""abc {
67 | "def"
| _____^
67 | / "def"
68 | | "ghi"
| |_________^ ISC002
69 | } jkl"""
@ -63,6 +58,6 @@ ISC.py:74:10: ISC002 Implicitly concatenated string literals over multiple lines
| __________^
75 | | f"def"} g"
| |__________^ ISC002
76 |
76 |
77 | # Explicitly concatenated nested f-strings
|

View File

@ -13,9 +13,9 @@ PIE800.py:1:14: PIE800 [*] Unnecessary spread `**`
Safe fix
1 |-{"foo": 1, **{"bar": 1}} # PIE800
1 |+{"foo": 1, "bar": 1} # PIE800
2 2 |
2 2 |
3 3 | {**{"bar": 10}, "a": "b"} # PIE800
4 4 |
4 4 |
PIE800.py:3:4: PIE800 [*] Unnecessary spread `**`
|
@ -30,12 +30,12 @@ PIE800.py:3:4: PIE800 [*] Unnecessary spread `**`
Safe fix
1 1 | {"foo": 1, **{"bar": 1}} # PIE800
2 2 |
2 2 |
3 |-{**{"bar": 10}, "a": "b"} # PIE800
3 |+{"bar": 10, "a": "b"} # PIE800
4 4 |
4 4 |
5 5 | foo({**foo, **{"bar": True}}) # PIE800
6 6 |
6 6 |
PIE800.py:5:15: PIE800 [*] Unnecessary spread `**`
|
@ -49,14 +49,14 @@ PIE800.py:5:15: PIE800 [*] Unnecessary spread `**`
= help: Remove unnecessary dict
Safe fix
2 2 |
2 2 |
3 3 | {**{"bar": 10}, "a": "b"} # PIE800
4 4 |
4 4 |
5 |-foo({**foo, **{"bar": True}}) # PIE800
5 |+foo({**foo, "bar": True}) # PIE800
6 6 |
6 6 |
7 7 | {**foo, **{"bar": 10}} # PIE800
8 8 |
8 8 |
PIE800.py:7:11: PIE800 [*] Unnecessary spread `**`
|
@ -70,12 +70,12 @@ PIE800.py:7:11: PIE800 [*] Unnecessary spread `**`
= help: Remove unnecessary dict
Safe fix
4 4 |
4 4 |
5 5 | foo({**foo, **{"bar": True}}) # PIE800
6 6 |
6 6 |
7 |-{**foo, **{"bar": 10}} # PIE800
7 |+{**foo, "bar": 10} # PIE800
8 8 |
8 8 |
9 9 | { # PIE800
10 10 | "a": "b",
@ -99,7 +99,7 @@ PIE800.py:12:7: PIE800 [*] Unnecessary spread `**`
10 10 | "a": "b",
11 11 | # Preserve
12 |- **{
12 |+
12 |+
13 13 | # all
14 |- "bar": 10, # the
14 |+ "bar": 10 # the
@ -107,7 +107,7 @@ PIE800.py:12:7: PIE800 [*] Unnecessary spread `**`
16 |- },
16 |+ ,
17 17 | }
18 18 |
18 18 |
19 19 | {**foo, **buzz, **{bar: 10}} # PIE800
PIE800.py:19:19: PIE800 [*] Unnecessary spread `**`
@ -124,10 +124,10 @@ PIE800.py:19:19: PIE800 [*] Unnecessary spread `**`
Safe fix
16 16 | },
17 17 | }
18 18 |
18 18 |
19 |-{**foo, **buzz, **{bar: 10}} # PIE800
19 |+{**foo, **buzz, bar: 10} # PIE800
20 20 |
20 20 |
21 21 | # https://github.com/astral-sh/ruff/issues/15366
22 22 | {
@ -148,15 +148,14 @@ PIE800.py:24:8: PIE800 [*] Unnecessary spread `**`
24 |- **({"count": 1 if include_count else {}}),
24 |+ "count": 1 if include_count else {},
25 25 | }
26 26 |
26 26 |
27 27 | {
PIE800.py:30:9: PIE800 [*] Unnecessary spread `**`
|
28 | "data": [],
29 | **( # Comment
30 | { # Comment
| _________^
30 | / { # Comment
31 | | "count": 1 if include_count else {}}),
| |________________________________________________^ PIE800
32 | }
@ -164,7 +163,7 @@ PIE800.py:30:9: PIE800 [*] Unnecessary spread `**`
= help: Remove unnecessary dict
Safe fix
26 26 |
26 26 |
27 27 | {
28 28 | "data": [],
29 |- **( # Comment
@ -174,15 +173,14 @@ PIE800.py:30:9: PIE800 [*] Unnecessary spread `**`
30 |+ # Comment
31 |+ "count": 1 if include_count else {},
32 32 | }
33 33 |
33 33 |
34 34 | {
PIE800.py:37:9: PIE800 [*] Unnecessary spread `**`
|
35 | "data": [],
36 | **(
37 | {
| _________^
37 | / {
38 | | "count": (a := 1),}),
| |_______________________________^ PIE800
39 | }
@ -190,25 +188,24 @@ PIE800.py:37:9: PIE800 [*] Unnecessary spread `**`
= help: Remove unnecessary dict
Safe fix
33 33 |
33 33 |
34 34 | {
35 35 | "data": [],
36 |- **(
37 |- {
38 |- "count": (a := 1),}),
36 |+
37 |+
36 |+
37 |+
38 |+ "count": (a := 1),
39 39 | }
40 40 |
40 40 |
41 41 | {
PIE800.py:44:9: PIE800 [*] Unnecessary spread `**`
|
42 | "data": [],
43 | **(
44 | {
| _________^
44 | / {
45 | | "count": (a := 1)
46 | | }
| |_____________^ PIE800
@ -218,28 +215,27 @@ PIE800.py:44:9: PIE800 [*] Unnecessary spread `**`
= help: Remove unnecessary dict
Safe fix
40 40 |
40 40 |
41 41 | {
42 42 | "data": [],
43 |- **(
44 |- {
43 |+
44 |+
43 |+
44 |+
45 45 | "count": (a := 1)
46 |- }
47 |- )
46 |+
47 |+
46 |+
47 |+
48 48 | ,
49 49 | }
50 50 |
50 50 |
PIE800.py:54:9: PIE800 [*] Unnecessary spread `**`
|
52 | "data": [],
53 | **(
54 | {
| _________^
54 | / {
55 | | "count": (a := 1), # Comment
56 | | } # Comment
| |_____________^ PIE800
@ -249,7 +245,7 @@ PIE800.py:54:9: PIE800 [*] Unnecessary spread `**`
= help: Remove unnecessary dict
Safe fix
50 50 |
50 50 |
51 51 | {
52 52 | "data": [],
53 |- **(
@ -257,14 +253,14 @@ PIE800.py:54:9: PIE800 [*] Unnecessary spread `**`
55 |- "count": (a := 1), # Comment
56 |- } # Comment
57 |- ) # Comment
53 |+
54 |+
53 |+
54 |+
55 |+ "count": (a := 1) # Comment
56 |+ # Comment
57 |+ # Comment
58 58 | ,
59 59 | }
60 60 |
60 60 |
PIE800.py:65:1: PIE800 [*] Unnecessary spread `**`
|
@ -280,7 +276,7 @@ PIE800.py:65:1: PIE800 [*] Unnecessary spread `**`
= help: Remove unnecessary dict
Safe fix
60 60 |
60 60 |
61 61 | ({
62 62 | "data": [],
63 |- **( # Comment
@ -295,7 +291,7 @@ PIE800.py:65:1: PIE800 [*] Unnecessary spread `**`
65 |+ # Comment
66 |+ "count": (a := 1) # Comment
67 |+ # Comment
68 |+
68 |+
69 |+ # Comment
70 70 | ,
71 71 | })

View File

@ -6,7 +6,7 @@ PYI016.py:7:15: PYI016 [*] Duplicate union member `str`
6 | # Should emit for duplicate field types.
7 | field2: str | str # PYI016: Duplicate union member `str`
| ^^^ PYI016
8 |
8 |
9 | # Should emit for union types in arguments.
|
= help: Remove duplicate union member `str`
@ -126,7 +126,7 @@ PYI016.py:21:28: PYI016 [*] Duplicate union member `int`
20 | field5: str | int | str # PYI016: Duplicate union member `str`
21 | field6: int | bool | str | int # PYI016: Duplicate union member `int`
| ^^^ PYI016
22 |
22 |
23 | # Shouldn't emit for non-type unions.
|
= help: Remove duplicate union member `int`
@ -146,7 +146,7 @@ PYI016.py:27:22: PYI016 [*] Duplicate union member `int`
26 | # Should emit for strangely-bracketed unions.
27 | field8: int | (str | int) # PYI016: Duplicate union member `int`
| ^^^ PYI016
28 |
28 |
29 | # Should handle user brackets when fixing.
|
= help: Remove duplicate union member `int`
@ -186,7 +186,7 @@ PYI016.py:31:24: PYI016 [*] Duplicate union member `str`
30 | field9: int | (int | str) # PYI016: Duplicate union member `int`
31 | field10: (str | int) | str # PYI016: Duplicate union member `str`
| ^^^ PYI016
32 |
32 |
33 | # Should emit for nested unions.
|
= help: Remove duplicate union member `str`
@ -206,7 +206,7 @@ PYI016.py:34:21: PYI016 [*] Duplicate union member `int`
33 | # Should emit for nested unions.
34 | field11: dict[int | int, str]
| ^^^ PYI016
35 |
35 |
36 | # Should emit for unions with more than two cases
|
= help: Remove duplicate union member `int`
@ -265,7 +265,7 @@ PYI016.py:38:16: PYI016 [*] Duplicate union member `int`
37 | field12: int | int | int # Error
38 | field13: int | int | int | int # Error
| ^^^ PYI016
39 |
39 |
40 | # Should emit for unions with more than two cases, even if not directly adjacent
|
= help: Remove duplicate union member `int`
@ -286,7 +286,7 @@ PYI016.py:38:22: PYI016 [*] Duplicate union member `int`
37 | field12: int | int | int # Error
38 | field13: int | int | int | int # Error
| ^^^ PYI016
39 |
39 |
40 | # Should emit for unions with more than two cases, even if not directly adjacent
|
= help: Remove duplicate union member `int`
@ -307,7 +307,7 @@ PYI016.py:38:28: PYI016 [*] Duplicate union member `int`
37 | field12: int | int | int # Error
38 | field13: int | int | int | int # Error
| ^^^ PYI016
39 |
39 |
40 | # Should emit for unions with more than two cases, even if not directly adjacent
|
= help: Remove duplicate union member `int`
@ -327,7 +327,7 @@ PYI016.py:41:16: PYI016 [*] Duplicate union member `int`
40 | # Should emit for unions with more than two cases, even if not directly adjacent
41 | field14: int | int | str | int # Error
| ^^^ PYI016
42 |
42 |
43 | # Should emit for duplicate literal types; also covered by PYI030
|
= help: Remove duplicate union member `int`
@ -347,7 +347,7 @@ PYI016.py:41:28: PYI016 [*] Duplicate union member `int`
40 | # Should emit for unions with more than two cases, even if not directly adjacent
41 | field14: int | int | str | int # Error
| ^^^ PYI016
42 |
42 |
43 | # Should emit for duplicate literal types; also covered by PYI030
|
= help: Remove duplicate union member `int`
@ -367,7 +367,7 @@ PYI016.py:44:30: PYI016 [*] Duplicate union member `typing.Literal[1]`
43 | # Should emit for duplicate literal types; also covered by PYI030
44 | field15: typing.Literal[1] | typing.Literal[1] # Error
| ^^^^^^^^^^^^^^^^^ PYI016
45 |
45 |
46 | # Shouldn't emit if in new parent type
|
= help: Remove duplicate union member `typing.Literal[1]`
@ -386,8 +386,7 @@ PYI016.py:57:5: PYI016 [*] Duplicate union member `set[int]`
|
55 | int # foo
56 | ],
57 | set[
| _____^
57 | / set[
58 | | int # bar
59 | | ],
| |_____^ PYI016
@ -417,7 +416,7 @@ PYI016.py:63:28: PYI016 [*] Duplicate union member `int`
62 | # Should emit in cases with `typing.Union` instead of `|`
63 | field19: typing.Union[int, int] # Error
| ^^^ PYI016
64 |
64 |
65 | # Should emit in cases with nested `typing.Union`
|
= help: Remove duplicate union member `int`
@ -437,7 +436,7 @@ PYI016.py:66:41: PYI016 [*] Duplicate union member `int`
65 | # Should emit in cases with nested `typing.Union`
66 | field20: typing.Union[int, typing.Union[int, str]] # Error
| ^^^ PYI016
67 |
67 |
68 | # Should emit in cases with mixed `typing.Union` and `|`
|
= help: Remove duplicate union member `int`
@ -457,7 +456,7 @@ PYI016.py:69:28: PYI016 [*] Duplicate union member `int`
68 | # Should emit in cases with mixed `typing.Union` and `|`
69 | field21: typing.Union[int, int | str] # Error
| ^^^ PYI016
70 |
70 |
71 | # Should emit only once in cases with multiple nested `typing.Union`
|
= help: Remove duplicate union member `int`
@ -477,7 +476,7 @@ PYI016.py:72:41: PYI016 [*] Duplicate union member `int`
71 | # Should emit only once in cases with multiple nested `typing.Union`
72 | field22: typing.Union[int, typing.Union[int, typing.Union[int, int]]] # Error
| ^^^ PYI016
73 |
73 |
74 | # Should emit in cases with newlines
|
= help: Remove duplicate union member `int`
@ -497,7 +496,7 @@ PYI016.py:72:59: PYI016 [*] Duplicate union member `int`
71 | # Should emit only once in cases with multiple nested `typing.Union`
72 | field22: typing.Union[int, typing.Union[int, typing.Union[int, int]]] # Error
| ^^^ PYI016
73 |
73 |
74 | # Should emit in cases with newlines
|
= help: Remove duplicate union member `int`
@ -517,7 +516,7 @@ PYI016.py:72:64: PYI016 [*] Duplicate union member `int`
71 | # Should emit only once in cases with multiple nested `typing.Union`
72 | field22: typing.Union[int, typing.Union[int, typing.Union[int, int]]] # Error
| ^^^ PYI016
73 |
73 |
74 | # Should emit in cases with newlines
|
= help: Remove duplicate union member `int`
@ -538,7 +537,7 @@ PYI016.py:76:12: PYI016 [*] Duplicate union member `set[int]`
75 | field23: set[ # foo
76 | int] | set[int]
| ^^^^^^^^ PYI016
77 |
77 |
78 | # Should emit twice (once for each `int` in the nested union, both of which are
|
= help: Remove duplicate union member `set[int]`
@ -560,7 +559,7 @@ PYI016.py:81:41: PYI016 [*] Duplicate union member `int`
80 | # we incorrectly re-checked the nested union).
81 | field24: typing.Union[int, typing.Union[int, int]] # PYI016: Duplicate union member `int`
| ^^^ PYI016
82 |
82 |
83 | # Should emit twice (once for each `int` in the nested union, both of which are
|
= help: Remove duplicate union member `int`
@ -581,7 +580,7 @@ PYI016.py:81:46: PYI016 [*] Duplicate union member `int`
80 | # we incorrectly re-checked the nested union).
81 | field24: typing.Union[int, typing.Union[int, int]] # PYI016: Duplicate union member `int`
| ^^^ PYI016
82 |
82 |
83 | # Should emit twice (once for each `int` in the nested union, both of which are
|
= help: Remove duplicate union member `int`
@ -602,7 +601,7 @@ PYI016.py:86:28: PYI016 [*] Duplicate union member `int`
85 | # we incorrectly re-checked the nested union).
86 | field25: typing.Union[int, int | int] # PYI016: Duplicate union member `int`
| ^^^ PYI016
87 |
87 |
88 | # Should emit in cases with nested `typing.Union`
|
= help: Remove duplicate union member `int`
@ -623,7 +622,7 @@ PYI016.py:86:34: PYI016 [*] Duplicate union member `int`
85 | # we incorrectly re-checked the nested union).
86 | field25: typing.Union[int, int | int] # PYI016: Duplicate union member `int`
| ^^^ PYI016
87 |
87 |
88 | # Should emit in cases with nested `typing.Union`
|
= help: Remove duplicate union member `int`
@ -643,7 +642,7 @@ PYI016.py:89:41: PYI016 [*] Duplicate union member `int`
88 | # Should emit in cases with nested `typing.Union`
89 | field26: typing.Union[typing.Union[int, int]] # PYI016: Duplicate union member `int`
| ^^^ PYI016
90 |
90 |
91 | # Should emit in cases with nested `typing.Union`
|
= help: Remove duplicate union member `int`
@ -663,7 +662,7 @@ PYI016.py:92:54: PYI016 [*] Duplicate union member `int`
91 | # Should emit in cases with nested `typing.Union`
92 | field27: typing.Union[typing.Union[typing.Union[int, int]]] # PYI016: Duplicate union member `int`
| ^^^ PYI016
93 |
93 |
94 | # Should emit in cases with mixed `typing.Union` and `|`
|
= help: Remove duplicate union member `int`
@ -683,7 +682,7 @@ PYI016.py:95:29: PYI016 [*] Duplicate union member `int`
94 | # Should emit in cases with mixed `typing.Union` and `|`
95 | field28: typing.Union[int | int] # Error
| ^^^ PYI016
96 |
96 |
97 | # Should emit twice in cases with multiple nested `typing.Union`
|
= help: Remove duplicate union member `int`
@ -703,7 +702,7 @@ PYI016.py:98:54: PYI016 [*] Duplicate union member `int`
97 | # Should emit twice in cases with multiple nested `typing.Union`
98 | field29: typing.Union[int, typing.Union[typing.Union[int, int]]] # Error
| ^^^ PYI016
99 |
99 |
100 | # Should emit once in cases with multiple nested `typing.Union`
|
= help: Remove duplicate union member `int`
@ -723,7 +722,7 @@ PYI016.py:98:59: PYI016 [*] Duplicate union member `int`
97 | # Should emit twice in cases with multiple nested `typing.Union`
98 | field29: typing.Union[int, typing.Union[typing.Union[int, int]]] # Error
| ^^^ PYI016
99 |
99 |
100 | # Should emit once in cases with multiple nested `typing.Union`
|
= help: Remove duplicate union member `int`
@ -743,7 +742,7 @@ PYI016.py:101:54: PYI016 [*] Duplicate union member `int`
100 | # Should emit once in cases with multiple nested `typing.Union`
101 | field30: typing.Union[int, typing.Union[typing.Union[int, str]]] # Error
| ^^^ PYI016
102 |
102 |
103 | # Should emit once, and fix to `typing.Union[float, int]`
|
= help: Remove duplicate union member `int`
@ -763,7 +762,7 @@ PYI016.py:104:49: PYI016 [*] Duplicate union member `int`
103 | # Should emit once, and fix to `typing.Union[float, int]`
104 | field31: typing.Union[float, typing.Union[int | int]] # Error
| ^^^ PYI016
105 |
105 |
106 | # Should emit once, and fix to `typing.Union[float, int]`
|
= help: Remove duplicate union member `int`
@ -783,7 +782,7 @@ PYI016.py:107:49: PYI016 [*] Duplicate union member `int`
106 | # Should emit once, and fix to `typing.Union[float, int]`
107 | field32: typing.Union[float, typing.Union[int | int | int]] # Error
| ^^^ PYI016
108 |
108 |
109 | # Test case for mixed union type fix
|
= help: Remove duplicate union member `int`
@ -803,7 +802,7 @@ PYI016.py:107:55: PYI016 [*] Duplicate union member `int`
106 | # Should emit once, and fix to `typing.Union[float, int]`
107 | field32: typing.Union[float, typing.Union[int | int | int]] # Error
| ^^^ PYI016
108 |
108 |
109 | # Test case for mixed union type fix
|
= help: Remove duplicate union member `int`
@ -823,7 +822,7 @@ PYI016.py:110:42: PYI016 [*] Duplicate union member `int`
109 | # Test case for mixed union type fix
110 | field33: typing.Union[typing.Union[int | int] | typing.Union[int | int]] # Error
| ^^^ PYI016
111 |
111 |
112 | # Test case for mixed union type
|
= help: Remove duplicate union member `int`
@ -843,7 +842,7 @@ PYI016.py:110:62: PYI016 [*] Duplicate union member `int`
109 | # Test case for mixed union type fix
110 | field33: typing.Union[typing.Union[int | int] | typing.Union[int | int]] # Error
| ^^^ PYI016
111 |
111 |
112 | # Test case for mixed union type
|
= help: Remove duplicate union member `int`
@ -863,7 +862,7 @@ PYI016.py:110:68: PYI016 [*] Duplicate union member `int`
109 | # Test case for mixed union type fix
110 | field33: typing.Union[typing.Union[int | int] | typing.Union[int | int]] # Error
| ^^^ PYI016
111 |
111 |
112 | # Test case for mixed union type
|
= help: Remove duplicate union member `int`

View File

@ -7,7 +7,7 @@ PYI016.pyi:7:15: PYI016 [*] Duplicate union member `str`
6 | # Should emit for duplicate field types.
7 | field2: str | str # PYI016: Duplicate union member `str`
| ^^^ PYI016
8 |
8 |
9 | # Should emit for union types in arguments.
|
= help: Remove duplicate union member `str`
@ -127,7 +127,7 @@ PYI016.pyi:21:28: PYI016 [*] Duplicate union member `int`
20 | field5: str | int | str # PYI016: Duplicate union member `str`
21 | field6: int | bool | str | int # PYI016: Duplicate union member `int`
| ^^^ PYI016
22 |
22 |
23 | # Shouldn't emit for non-type unions.
|
= help: Remove duplicate union member `int`
@ -147,7 +147,7 @@ PYI016.pyi:27:22: PYI016 [*] Duplicate union member `int`
26 | # Should emit for strangely-bracketed unions.
27 | field8: int | (str | int) # PYI016: Duplicate union member `int`
| ^^^ PYI016
28 |
28 |
29 | # Should handle user brackets when fixing.
|
= help: Remove duplicate union member `int`
@ -187,7 +187,7 @@ PYI016.pyi:31:24: PYI016 [*] Duplicate union member `str`
30 | field9: int | (int | str) # PYI016: Duplicate union member `int`
31 | field10: (str | int) | str # PYI016: Duplicate union member `str`
| ^^^ PYI016
32 |
32 |
33 | # Should emit for nested unions.
|
= help: Remove duplicate union member `str`
@ -207,7 +207,7 @@ PYI016.pyi:34:21: PYI016 [*] Duplicate union member `int`
33 | # Should emit for nested unions.
34 | field11: dict[int | int, str]
| ^^^ PYI016
35 |
35 |
36 | # Should emit for unions with more than two cases
|
= help: Remove duplicate union member `int`
@ -266,7 +266,7 @@ PYI016.pyi:38:16: PYI016 [*] Duplicate union member `int`
37 | field12: int | int | int # Error
38 | field13: int | int | int | int # Error
| ^^^ PYI016
39 |
39 |
40 | # Should emit for unions with more than two cases, even if not directly adjacent
|
= help: Remove duplicate union member `int`
@ -287,7 +287,7 @@ PYI016.pyi:38:22: PYI016 [*] Duplicate union member `int`
37 | field12: int | int | int # Error
38 | field13: int | int | int | int # Error
| ^^^ PYI016
39 |
39 |
40 | # Should emit for unions with more than two cases, even if not directly adjacent
|
= help: Remove duplicate union member `int`
@ -308,7 +308,7 @@ PYI016.pyi:38:28: PYI016 [*] Duplicate union member `int`
37 | field12: int | int | int # Error
38 | field13: int | int | int | int # Error
| ^^^ PYI016
39 |
39 |
40 | # Should emit for unions with more than two cases, even if not directly adjacent
|
= help: Remove duplicate union member `int`
@ -328,7 +328,7 @@ PYI016.pyi:41:16: PYI016 [*] Duplicate union member `int`
40 | # Should emit for unions with more than two cases, even if not directly adjacent
41 | field14: int | int | str | int # Error
| ^^^ PYI016
42 |
42 |
43 | # Should emit for duplicate literal types; also covered by PYI030
|
= help: Remove duplicate union member `int`
@ -348,7 +348,7 @@ PYI016.pyi:41:28: PYI016 [*] Duplicate union member `int`
40 | # Should emit for unions with more than two cases, even if not directly adjacent
41 | field14: int | int | str | int # Error
| ^^^ PYI016
42 |
42 |
43 | # Should emit for duplicate literal types; also covered by PYI030
|
= help: Remove duplicate union member `int`
@ -368,7 +368,7 @@ PYI016.pyi:44:30: PYI016 [*] Duplicate union member `typing.Literal[1]`
43 | # Should emit for duplicate literal types; also covered by PYI030
44 | field15: typing.Literal[1] | typing.Literal[1] # Error
| ^^^^^^^^^^^^^^^^^ PYI016
45 |
45 |
46 | # Shouldn't emit if in new parent type
|
= help: Remove duplicate union member `typing.Literal[1]`
@ -387,8 +387,7 @@ PYI016.pyi:57:5: PYI016 [*] Duplicate union member `set[int]`
|
55 | int # foo
56 | ],
57 | set[
| _____^
57 | / set[
58 | | int # bar
59 | | ],
| |_____^ PYI016
@ -418,7 +417,7 @@ PYI016.pyi:63:28: PYI016 [*] Duplicate union member `int`
62 | # Should emit in cases with `typing.Union` instead of `|`
63 | field19: typing.Union[int, int] # Error
| ^^^ PYI016
64 |
64 |
65 | # Should emit in cases with nested `typing.Union`
|
= help: Remove duplicate union member `int`
@ -438,7 +437,7 @@ PYI016.pyi:66:41: PYI016 [*] Duplicate union member `int`
65 | # Should emit in cases with nested `typing.Union`
66 | field20: typing.Union[int, typing.Union[int, str]] # Error
| ^^^ PYI016
67 |
67 |
68 | # Should emit in cases with mixed `typing.Union` and `|`
|
= help: Remove duplicate union member `int`
@ -458,7 +457,7 @@ PYI016.pyi:69:28: PYI016 [*] Duplicate union member `int`
68 | # Should emit in cases with mixed `typing.Union` and `|`
69 | field21: typing.Union[int, int | str] # Error
| ^^^ PYI016
70 |
70 |
71 | # Should emit only once in cases with multiple nested `typing.Union`
|
= help: Remove duplicate union member `int`
@ -478,7 +477,7 @@ PYI016.pyi:72:41: PYI016 [*] Duplicate union member `int`
71 | # Should emit only once in cases with multiple nested `typing.Union`
72 | field22: typing.Union[int, typing.Union[int, typing.Union[int, int]]] # Error
| ^^^ PYI016
73 |
73 |
74 | # Should emit in cases with newlines
|
= help: Remove duplicate union member `int`
@ -498,7 +497,7 @@ PYI016.pyi:72:59: PYI016 [*] Duplicate union member `int`
71 | # Should emit only once in cases with multiple nested `typing.Union`
72 | field22: typing.Union[int, typing.Union[int, typing.Union[int, int]]] # Error
| ^^^ PYI016
73 |
73 |
74 | # Should emit in cases with newlines
|
= help: Remove duplicate union member `int`
@ -518,7 +517,7 @@ PYI016.pyi:72:64: PYI016 [*] Duplicate union member `int`
71 | # Should emit only once in cases with multiple nested `typing.Union`
72 | field22: typing.Union[int, typing.Union[int, typing.Union[int, int]]] # Error
| ^^^ PYI016
73 |
73 |
74 | # Should emit in cases with newlines
|
= help: Remove duplicate union member `int`
@ -539,7 +538,7 @@ PYI016.pyi:76:12: PYI016 [*] Duplicate union member `set[int]`
75 | field23: set[ # foo
76 | int] | set[int]
| ^^^^^^^^ PYI016
77 |
77 |
78 | # Should emit twice (once for each `int` in the nested union, both of which are
|
= help: Remove duplicate union member `set[int]`
@ -561,7 +560,7 @@ PYI016.pyi:81:41: PYI016 [*] Duplicate union member `int`
80 | # we incorrectly re-checked the nested union).
81 | field24: typing.Union[int, typing.Union[int, int]] # PYI016: Duplicate union member `int`
| ^^^ PYI016
82 |
82 |
83 | # Should emit twice (once for each `int` in the nested union, both of which are
|
= help: Remove duplicate union member `int`
@ -582,7 +581,7 @@ PYI016.pyi:81:46: PYI016 [*] Duplicate union member `int`
80 | # we incorrectly re-checked the nested union).
81 | field24: typing.Union[int, typing.Union[int, int]] # PYI016: Duplicate union member `int`
| ^^^ PYI016
82 |
82 |
83 | # Should emit twice (once for each `int` in the nested union, both of which are
|
= help: Remove duplicate union member `int`
@ -603,7 +602,7 @@ PYI016.pyi:86:28: PYI016 [*] Duplicate union member `int`
85 | # we incorrectly re-checked the nested union).
86 | field25: typing.Union[int, int | int] # PYI016: Duplicate union member `int`
| ^^^ PYI016
87 |
87 |
88 | # Should emit in cases with nested `typing.Union`
|
= help: Remove duplicate union member `int`
@ -624,7 +623,7 @@ PYI016.pyi:86:34: PYI016 [*] Duplicate union member `int`
85 | # we incorrectly re-checked the nested union).
86 | field25: typing.Union[int, int | int] # PYI016: Duplicate union member `int`
| ^^^ PYI016
87 |
87 |
88 | # Should emit in cases with nested `typing.Union`
|
= help: Remove duplicate union member `int`
@ -644,7 +643,7 @@ PYI016.pyi:89:41: PYI016 [*] Duplicate union member `int`
88 | # Should emit in cases with nested `typing.Union`
89 | field26: typing.Union[typing.Union[int, int]] # PYI016: Duplicate union member `int`
| ^^^ PYI016
90 |
90 |
91 | # Should emit in cases with nested `typing.Union`
|
= help: Remove duplicate union member `int`
@ -664,7 +663,7 @@ PYI016.pyi:92:54: PYI016 [*] Duplicate union member `int`
91 | # Should emit in cases with nested `typing.Union`
92 | field27: typing.Union[typing.Union[typing.Union[int, int]]] # PYI016: Duplicate union member `int`
| ^^^ PYI016
93 |
93 |
94 | # Should emit in cases with mixed `typing.Union` and `|`
|
= help: Remove duplicate union member `int`
@ -684,7 +683,7 @@ PYI016.pyi:95:29: PYI016 [*] Duplicate union member `int`
94 | # Should emit in cases with mixed `typing.Union` and `|`
95 | field28: typing.Union[int | int] # Error
| ^^^ PYI016
96 |
96 |
97 | # Should emit twice in cases with multiple nested `typing.Union`
|
= help: Remove duplicate union member `int`
@ -704,7 +703,7 @@ PYI016.pyi:98:54: PYI016 [*] Duplicate union member `int`
97 | # Should emit twice in cases with multiple nested `typing.Union`
98 | field29: typing.Union[int, typing.Union[typing.Union[int, int]]] # Error
| ^^^ PYI016
99 |
99 |
100 | # Should emit once in cases with multiple nested `typing.Union`
|
= help: Remove duplicate union member `int`
@ -724,7 +723,7 @@ PYI016.pyi:98:59: PYI016 [*] Duplicate union member `int`
97 | # Should emit twice in cases with multiple nested `typing.Union`
98 | field29: typing.Union[int, typing.Union[typing.Union[int, int]]] # Error
| ^^^ PYI016
99 |
99 |
100 | # Should emit once in cases with multiple nested `typing.Union`
|
= help: Remove duplicate union member `int`
@ -744,7 +743,7 @@ PYI016.pyi:101:54: PYI016 [*] Duplicate union member `int`
100 | # Should emit once in cases with multiple nested `typing.Union`
101 | field30: typing.Union[int, typing.Union[typing.Union[int, str]]] # Error
| ^^^ PYI016
102 |
102 |
103 | # Should emit once, and fix to `typing.Union[float, int]`
|
= help: Remove duplicate union member `int`
@ -764,7 +763,7 @@ PYI016.pyi:104:49: PYI016 [*] Duplicate union member `int`
103 | # Should emit once, and fix to `typing.Union[float, int]`
104 | field31: typing.Union[float, typing.Union[int | int]] # Error
| ^^^ PYI016
105 |
105 |
106 | # Should emit once, and fix to `typing.Union[float, int]`
|
= help: Remove duplicate union member `int`
@ -784,7 +783,7 @@ PYI016.pyi:107:49: PYI016 [*] Duplicate union member `int`
106 | # Should emit once, and fix to `typing.Union[float, int]`
107 | field32: typing.Union[float, typing.Union[int | int | int]] # Error
| ^^^ PYI016
108 |
108 |
109 | # Test case for mixed union type fix
|
= help: Remove duplicate union member `int`
@ -804,7 +803,7 @@ PYI016.pyi:107:55: PYI016 [*] Duplicate union member `int`
106 | # Should emit once, and fix to `typing.Union[float, int]`
107 | field32: typing.Union[float, typing.Union[int | int | int]] # Error
| ^^^ PYI016
108 |
108 |
109 | # Test case for mixed union type fix
|
= help: Remove duplicate union member `int`
@ -824,7 +823,7 @@ PYI016.pyi:110:42: PYI016 [*] Duplicate union member `int`
109 | # Test case for mixed union type fix
110 | field33: typing.Union[typing.Union[int | int] | typing.Union[int | int]] # Error
| ^^^ PYI016
111 |
111 |
112 | # Test case for mixed union type
|
= help: Remove duplicate union member `int`
@ -844,7 +843,7 @@ PYI016.pyi:110:62: PYI016 [*] Duplicate union member `int`
109 | # Test case for mixed union type fix
110 | field33: typing.Union[typing.Union[int | int] | typing.Union[int | int]] # Error
| ^^^ PYI016
111 |
111 |
112 | # Test case for mixed union type
|
= help: Remove duplicate union member `int`
@ -864,7 +863,7 @@ PYI016.pyi:110:68: PYI016 [*] Duplicate union member `int`
109 | # Test case for mixed union type fix
110 | field33: typing.Union[typing.Union[int | int] | typing.Union[int | int]] # Error
| ^^^ PYI016
111 |
111 |
112 | # Test case for mixed union type
|
= help: Remove duplicate union member `int`

View File

@ -1,12 +1,11 @@
---
source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs
snapshot_kind: text
---
PYI021.pyi:1:1: PYI021 [*] Docstrings should not be included in stubs
|
1 | """foo""" # ERROR PYI021
| ^^^^^^^^^ PYI021
2 |
2 |
3 | def foo():
|
= help: Remove docstring
@ -23,7 +22,7 @@ PYI021.pyi:4:5: PYI021 [*] Docstrings should not be included in stubs
3 | def foo():
4 | """foo""" # ERROR PYI021
| ^^^^^^^^^ PYI021
5 |
5 |
6 | class Bar:
|
= help: Remove docstring
@ -43,7 +42,7 @@ PYI021.pyi:7:5: PYI021 [*] Docstrings should not be included in stubs
6 | class Bar:
7 | """bar""" # ERROR PYI021
| ^^^^^^^^^ PYI021
8 |
8 |
9 | class Qux:
|
= help: Remove docstring
@ -63,7 +62,7 @@ PYI021.pyi:10:5: PYI021 [*] Docstrings should not be included in stubs
9 | class Qux:
10 | """qux""" # ERROR PYI021
| ^^^^^^^^^ PYI021
11 |
11 |
12 | def __init__(self) -> None: ...
|
= help: Remove docstring
@ -81,13 +80,12 @@ PYI021.pyi:10:5: PYI021 [*] Docstrings should not be included in stubs
PYI021.pyi:15:5: PYI021 [*] Docstrings should not be included in stubs
|
14 | class Baz:
15 | """Multiline docstring
| _____^
16 | |
15 | / """Multiline docstring
16 | |
17 | | Lorem ipsum dolor sit amet
18 | | """
| |_______^ PYI021
19 |
19 |
20 | def __init__(self) -> None: ...
|
= help: Remove docstring

View File

@ -193,8 +193,7 @@ PYI041.py:67:9: PYI041 [*] Use `complex` instead of `int | float | complex`
|
65 | def f10(
66 | arg: (
67 | int | # comment
| _________^
67 | / int | # comment
68 | | float | # another
69 | | complex
| |_______________^ PYI041
@ -216,7 +215,7 @@ PYI041.py:67:9: PYI041 [*] Use `complex` instead of `int | float | complex`
PYI041.py:79:24: PYI041 [*] Use `complex` instead of `int | float | complex`
|
77 | ...
78 |
78 |
79 | def bad(self, arg: int | float | complex) -> None:
| ^^^^^^^^^^^^^^^^^^^^^ PYI041
80 | ...
@ -236,7 +235,7 @@ PYI041.py:79:24: PYI041 [*] Use `complex` instead of `int | float | complex`
PYI041.py:82:25: PYI041 [*] Use `complex` instead of `int | float | complex`
|
80 | ...
81 |
81 |
82 | def bad2(self, arg: int | Union[float, complex]) -> None:
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI041
83 | ...
@ -256,7 +255,7 @@ PYI041.py:82:25: PYI041 [*] Use `complex` instead of `int | float | complex`
PYI041.py:85:25: PYI041 [*] Use `complex` instead of `int | float | complex`
|
83 | ...
84 |
84 |
85 | def bad3(self, arg: Union[Union[float, complex], int]) -> None:
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI041
86 | ...
@ -276,7 +275,7 @@ PYI041.py:85:25: PYI041 [*] Use `complex` instead of `int | float | complex`
PYI041.py:88:25: PYI041 [*] Use `complex` instead of `int | float | complex`
|
86 | ...
87 |
87 |
88 | def bad4(self, arg: Union[float | complex, int]) -> None:
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI041
89 | ...
@ -296,7 +295,7 @@ PYI041.py:88:25: PYI041 [*] Use `complex` instead of `int | float | complex`
PYI041.py:91:25: PYI041 [*] Use `complex` instead of `int | float | complex`
|
89 | ...
90 |
90 |
91 | def bad5(self, arg: int | (float | complex)) -> None:
| ^^^^^^^^^^^^^^^^^^^^^^^ PYI041
92 | ...

View File

@ -74,7 +74,7 @@ PYI041.pyi:33:24: PYI041 [*] Use `float` instead of `int | float`
|
33 | async def f4(**kwargs: int | int | float) -> None: ... # PYI041
| ^^^^^^^^^^^^^^^^^ PYI041
34 |
34 |
35 | def f5(
|
= help: Remove redundant type
@ -117,8 +117,7 @@ PYI041.pyi:43:9: PYI041 [*] Use `complex` instead of `int | float | complex`
|
41 | def f6(
42 | arg: (
43 | int | # comment
| _________^
43 | / int | # comment
44 | | float | # another
45 | | complex
| |_______________^ PYI041
@ -140,7 +139,7 @@ PYI041.pyi:43:9: PYI041 [*] Use `complex` instead of `int | float | complex`
PYI041.pyi:49:26: PYI041 [*] Use `float` instead of `int | float`
|
47 | ) -> None: ... # PYI041
48 |
48 |
49 | def f5(arg1: int, *args: Union[int, int, float]) -> None: ... # PYI041
| ^^^^^^^^^^^^^^^^^^^^^^ PYI041
|
@ -210,10 +209,10 @@ PYI041.pyi:58:26: PYI041 [*] Use `float` instead of `int | float`
PYI041.pyi:64:24: PYI041 [*] Use `complex` instead of `int | float | complex`
|
62 | def good(self, arg: int) -> None: ...
63 |
63 |
64 | def bad(self, arg: int | float | complex) -> None: ... # PYI041
| ^^^^^^^^^^^^^^^^^^^^^ PYI041
65 |
65 |
66 | def bad2(self, arg: int | Union[float, complex]) -> None: ... # PYI041
|
= help: Remove redundant type
@ -231,10 +230,10 @@ PYI041.pyi:64:24: PYI041 [*] Use `complex` instead of `int | float | complex`
PYI041.pyi:66:25: PYI041 [*] Use `complex` instead of `int | float | complex`
|
64 | def bad(self, arg: int | float | complex) -> None: ... # PYI041
65 |
65 |
66 | def bad2(self, arg: int | Union[float, complex]) -> None: ... # PYI041
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI041
67 |
67 |
68 | def bad3(self, arg: Union[Union[float, complex], int]) -> None: ... # PYI041
|
= help: Remove redundant type
@ -252,10 +251,10 @@ PYI041.pyi:66:25: PYI041 [*] Use `complex` instead of `int | float | complex`
PYI041.pyi:68:25: PYI041 [*] Use `complex` instead of `int | float | complex`
|
66 | def bad2(self, arg: int | Union[float, complex]) -> None: ... # PYI041
67 |
67 |
68 | def bad3(self, arg: Union[Union[float, complex], int]) -> None: ... # PYI041
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI041
69 |
69 |
70 | def bad4(self, arg: Union[float | complex, int]) -> None: ... # PYI041
|
= help: Remove redundant type
@ -273,10 +272,10 @@ PYI041.pyi:68:25: PYI041 [*] Use `complex` instead of `int | float | complex`
PYI041.pyi:70:25: PYI041 [*] Use `complex` instead of `int | float | complex`
|
68 | def bad3(self, arg: Union[Union[float, complex], int]) -> None: ... # PYI041
69 |
69 |
70 | def bad4(self, arg: Union[float | complex, int]) -> None: ... # PYI041
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI041
71 |
71 |
72 | def bad5(self, arg: int | (float | complex)) -> None: ... # PYI041
|
= help: Remove redundant type
@ -293,7 +292,7 @@ PYI041.pyi:70:25: PYI041 [*] Use `complex` instead of `int | float | complex`
PYI041.pyi:72:25: PYI041 [*] Use `complex` instead of `int | float | complex`
|
70 | def bad4(self, arg: Union[float | complex, int]) -> None: ... # PYI041
71 |
71 |
72 | def bad5(self, arg: int | (float | complex)) -> None: ... # PYI041
| ^^^^^^^^^^^^^^^^^^^^^^^ PYI041
|

View File

@ -1,6 +1,5 @@
---
source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs
snapshot_kind: text
---
PT003.py:14:17: PT003 [*] `scope='function'` is implied in `@pytest.fixture()`
|
@ -142,8 +141,7 @@ PT003.py:66:5: PT003 [*] `scope='function'` is implied in `@pytest.fixture()`
|
64 | # another comment ,)
65 |
66 | scope=\
| _____^
66 | / scope=\
67 | | "function" # some comment ),
| |__________________^ PT003
68 | ,

View File

@ -1,6 +1,5 @@
---
source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs
snapshot_kind: text
---
PT006.py:24:26: PT006 [*] Wrong type passed to first argument of `pytest.mark.parametrize`; expected a string of comma-separated values
|
@ -157,8 +156,7 @@ PT006.py:103:5: PT006 [*] Wrong type passed to first argument of `pytest.mark.pa
|
101 | # Unsafe fix
102 | @pytest.mark.parametrize(
103 | (
| _____^
103 | / (
104 | | # comment
105 | | "param",
106 | | ),

View File

@ -1,6 +1,5 @@
---
source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs
snapshot_kind: text
---
PT006.py:9:26: PT006 [*] Wrong type passed to first argument of `pytest.mark.parametrize`; expected `tuple`
|
@ -329,8 +328,7 @@ PT006.py:103:5: PT006 [*] Wrong type passed to first argument of `pytest.mark.pa
|
101 | # Unsafe fix
102 | @pytest.mark.parametrize(
103 | (
| _____^
103 | / (
104 | | # comment
105 | | "param",
106 | | ),

View File

@ -1,6 +1,5 @@
---
source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs
snapshot_kind: text
---
PT006.py:9:26: PT006 [*] Wrong type passed to first argument of `pytest.mark.parametrize`; expected `list`
|
@ -291,8 +290,7 @@ PT006.py:103:5: PT006 [*] Wrong type passed to first argument of `pytest.mark.pa
|
101 | # Unsafe fix
102 | @pytest.mark.parametrize(
103 | (
| _____^
103 | / (
104 | | # comment
105 | | "param",
106 | | ),

View File

@ -1,6 +1,5 @@
---
source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs
snapshot_kind: text
---
PT007.py:4:35: PT007 [*] Wrong values type in `pytest.mark.parametrize` expected `list` of `list`
|
@ -25,8 +24,7 @@ PT007.py:11:5: PT007 [*] Wrong values type in `pytest.mark.parametrize` expected
|
9 | @pytest.mark.parametrize(
10 | ("param1", "param2"),
11 | (
| _____^
11 | / (
12 | | (1, 2),
13 | | (3, 4),
14 | | ),
@ -96,8 +94,7 @@ PT007.py:22:5: PT007 [*] Wrong values type in `pytest.mark.parametrize` expected
|
20 | @pytest.mark.parametrize(
21 | ("param1", "param2"),
22 | (
| _____^
22 | / (
23 | | [1, 2],
24 | | [3, 4],
25 | | ),

View File

@ -1,6 +1,5 @@
---
source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs
snapshot_kind: text
---
PT007.py:4:35: PT007 [*] Wrong values type in `pytest.mark.parametrize` expected `list` of `tuple`
|
@ -25,8 +24,7 @@ PT007.py:11:5: PT007 [*] Wrong values type in `pytest.mark.parametrize` expected
|
9 | @pytest.mark.parametrize(
10 | ("param1", "param2"),
11 | (
| _____^
11 | / (
12 | | (1, 2),
13 | | (3, 4),
14 | | ),
@ -54,8 +52,7 @@ PT007.py:22:5: PT007 [*] Wrong values type in `pytest.mark.parametrize` expected
|
20 | @pytest.mark.parametrize(
21 | ("param1", "param2"),
22 | (
| _____^
22 | / (
23 | | [1, 2],
24 | | [3, 4],
25 | | ),

View File

@ -1,6 +1,5 @@
---
source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs
snapshot_kind: text
---
PT007.py:12:9: PT007 [*] Wrong values type in `pytest.mark.parametrize` expected `tuple` of `list`
|
@ -67,8 +66,7 @@ PT007.py:38:5: PT007 [*] Wrong values type in `pytest.mark.parametrize` expected
|
36 | @pytest.mark.parametrize(
37 | ("param1", "param2"),
38 | [
| _____^
38 | / [
39 | | (1, 2),
40 | | (3, 4),
41 | | ],
@ -138,8 +136,7 @@ PT007.py:49:5: PT007 [*] Wrong values type in `pytest.mark.parametrize` expected
|
47 | @pytest.mark.parametrize(
48 | ("param1", "param2"),
49 | [
| _____^
49 | / [
50 | | [1, 2],
51 | | [3, 4],
52 | | ],
@ -167,8 +164,7 @@ PT007.py:60:5: PT007 [*] Wrong values type in `pytest.mark.parametrize` expected
|
58 | @pytest.mark.parametrize(
59 | "param1,param2",
60 | [
| _____^
60 | / [
61 | | [1, 2],
62 | | [3, 4],
63 | | ],
@ -196,8 +192,7 @@ PT007.py:71:5: PT007 [*] Wrong values type in `pytest.mark.parametrize` expected
|
69 | @pytest.mark.parametrize(
70 | "param",
71 | [
| _____^
71 | / [
72 | | [1, 2],
73 | | [3, 4],
74 | | ],

View File

@ -1,6 +1,5 @@
---
source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs
snapshot_kind: text
---
PT007.py:23:9: PT007 [*] Wrong values type in `pytest.mark.parametrize` expected `tuple` of `tuple`
|
@ -67,8 +66,7 @@ PT007.py:38:5: PT007 [*] Wrong values type in `pytest.mark.parametrize` expected
|
36 | @pytest.mark.parametrize(
37 | ("param1", "param2"),
38 | [
| _____^
38 | / [
39 | | (1, 2),
40 | | (3, 4),
41 | | ],
@ -96,8 +94,7 @@ PT007.py:49:5: PT007 [*] Wrong values type in `pytest.mark.parametrize` expected
|
47 | @pytest.mark.parametrize(
48 | ("param1", "param2"),
49 | [
| _____^
49 | / [
50 | | [1, 2],
51 | | [3, 4],
52 | | ],
@ -167,8 +164,7 @@ PT007.py:60:5: PT007 [*] Wrong values type in `pytest.mark.parametrize` expected
|
58 | @pytest.mark.parametrize(
59 | "param1,param2",
60 | [
| _____^
60 | / [
61 | | [1, 2],
62 | | [3, 4],
63 | | ],
@ -238,8 +234,7 @@ PT007.py:71:5: PT007 [*] Wrong values type in `pytest.mark.parametrize` expected
|
69 | @pytest.mark.parametrize(
70 | "param",
71 | [
| _____^
71 | / [
72 | | [1, 2],
73 | | [3, 4],
74 | | ],

View File

@ -1,12 +1,10 @@
---
source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs
snapshot_kind: text
---
PT012.py:42:5: PT012 `pytest.raises()` block should contain a single simple statement
|
41 | def test_error_multiple_statements():
42 | with pytest.raises(AttributeError):
| _____^
42 | / with pytest.raises(AttributeError):
43 | | len([])
44 | | [].size
| |_______________^ PT012
@ -15,60 +13,55 @@ PT012.py:42:5: PT012 `pytest.raises()` block should contain a single simple stat
PT012.py:48:5: PT012 `pytest.raises()` block should contain a single simple statement
|
47 | async def test_error_complex_statement():
48 | with pytest.raises(AttributeError):
| _____^
48 | / with pytest.raises(AttributeError):
49 | | if True:
50 | | [].size
| |___________________^ PT012
51 |
51 |
52 | with pytest.raises(AttributeError):
|
PT012.py:52:5: PT012 `pytest.raises()` block should contain a single simple statement
|
50 | [].size
51 |
52 | with pytest.raises(AttributeError):
| _____^
51 |
52 | / with pytest.raises(AttributeError):
53 | | for i in []:
54 | | [].size
| |___________________^ PT012
55 |
55 |
56 | with pytest.raises(AttributeError):
|
PT012.py:56:5: PT012 `pytest.raises()` block should contain a single simple statement
|
54 | [].size
55 |
56 | with pytest.raises(AttributeError):
| _____^
55 |
56 | / with pytest.raises(AttributeError):
57 | | async for i in []:
58 | | [].size
| |___________________^ PT012
59 |
59 |
60 | with pytest.raises(AttributeError):
|
PT012.py:60:5: PT012 `pytest.raises()` block should contain a single simple statement
|
58 | [].size
59 |
60 | with pytest.raises(AttributeError):
| _____^
59 |
60 | / with pytest.raises(AttributeError):
61 | | while True:
62 | | [].size
| |___________________^ PT012
63 |
63 |
64 | with pytest.raises(AttributeError):
|
PT012.py:64:5: PT012 `pytest.raises()` block should contain a single simple statement
|
62 | [].size
63 |
64 | with pytest.raises(AttributeError):
| _____^
63 |
64 | / with pytest.raises(AttributeError):
65 | | async with context_manager_under_test():
66 | | if True:
67 | | raise Exception
@ -78,8 +71,7 @@ PT012.py:64:5: PT012 `pytest.raises()` block should contain a single simple stat
PT012.py:71:5: PT012 `pytest.raises()` block should contain a single simple statement
|
70 | def test_error_try():
71 | with pytest.raises(AttributeError):
| _____^
71 | / with pytest.raises(AttributeError):
72 | | try:
73 | | [].size
74 | | except:

View File

@ -1,6 +1,5 @@
---
source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs
snapshot_kind: text
---
PT018.py:14:5: PT018 [*] Assertion should be broken down into multiple parts
|
@ -159,8 +158,7 @@ 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)
21 | assert something and something_else == """error
| _____^
21 | / assert something and something_else == """error
22 | | message
23 | | """
| |_______^ PT018
@ -184,8 +182,7 @@ PT018.py:24:5: PT018 [*] Assertion should be broken down into multiple parts
|
22 | message
23 | """
24 | assert (
| _____^
24 | / assert (
25 | | something
26 | | and something_else
27 | | == """error
@ -193,7 +190,7 @@ PT018.py:24:5: PT018 [*] Assertion should be broken down into multiple parts
29 | | """
30 | | )
| |_____^ PT018
31 |
31 |
32 | # recursive case
|
= help: Break down assertion into multiple parts
@ -237,7 +234,7 @@ PT018.py:34:5: PT018 [*] Assertion should be broken down into multiple parts
33 | assert not (a or not (b or c))
34 | assert not (a or not (b and c))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PT018
35 |
35 |
36 | # detected, but no fix for messages
|
= help: Break down assertion into multiple parts
@ -328,7 +325,7 @@ PT018.py:49:5: PT018 Assertion should be broken down into multiple parts
48 | def test_multiline():
49 | assert something and something_else; x = 1
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PT018
50 |
50 |
51 | x = 1; assert something and something_else
|
= help: Break down assertion into multiple parts
@ -336,10 +333,10 @@ PT018.py:49:5: PT018 Assertion should be broken down into multiple parts
PT018.py:51:12: PT018 Assertion should be broken down into multiple parts
|
49 | assert something and something_else; x = 1
50 |
50 |
51 | x = 1; assert something and something_else
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PT018
52 |
52 |
53 | x = 1; \
|
= help: Break down assertion into multiple parts
@ -356,14 +353,13 @@ 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():
59 | assert not (
| _____^
59 | / assert not (
60 | | self.find_graph_output(node.output[0])
61 | | or self.find_graph_input(node.input[0])
62 | | or self.find_graph_output(node.input[0])
63 | | )
| |_____^ PT018
64 |
64 |
65 | assert (not (
|
= help: Break down assertion into multiple parts
@ -384,15 +380,14 @@ PT018.py:59: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 |
65 | assert (not (
| _____^
64 |
65 | / assert (not (
66 | | self.find_graph_output(node.output[0])
67 | | or self.find_graph_input(node.input[0])
68 | | or self.find_graph_output(node.input[0])
69 | | ))
| |______^ PT018
70 |
70 |
71 | assert (not self.find_graph_output(node.output[0]) or
|
= help: Break down assertion into multiple parts

View File

@ -1,6 +1,5 @@
---
source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs
snapshot_kind: text
---
PT027_0.py:6:14: PT027 [*] Use `pytest.raises` instead of unittest-style `assertRaises`
|
@ -54,7 +53,7 @@ PT027_0.py:8:14: PT027 [*] Use `pytest.raises` instead of unittest-style `assert
PT027_0.py:11:14: PT027 [*] Use `pytest.raises` instead of unittest-style `failUnlessRaises`
|
9 | raise ValueError
10 |
10 |
11 | with self.failUnlessRaises(ValueError):
| ^^^^^^^^^^^^^^^^^^^^^ PT027
12 | raise ValueError
@ -80,7 +79,7 @@ PT027_0.py:11:14: PT027 [*] Use `pytest.raises` instead of unittest-style `failU
PT027_0.py:14:14: PT027 [*] Use `pytest.raises` instead of unittest-style `assertRaisesRegex`
|
12 | raise ValueError
13 |
13 |
14 | with self.assertRaisesRegex(ValueError, "test"):
| ^^^^^^^^^^^^^^^^^^^^^^ PT027
15 | raise ValueError("test")
@ -106,7 +105,7 @@ PT027_0.py:14:14: PT027 [*] Use `pytest.raises` instead of unittest-style `asser
PT027_0.py:17:14: PT027 [*] Use `pytest.raises` instead of unittest-style `assertRaisesRegex`
|
15 | raise ValueError("test")
16 |
16 |
17 | with self.assertRaisesRegex(ValueError, expected_regex="test"):
| ^^^^^^^^^^^^^^^^^^^^^^ PT027
18 | raise ValueError("test")
@ -132,7 +131,7 @@ PT027_0.py:17:14: PT027 [*] Use `pytest.raises` instead of unittest-style `asser
PT027_0.py:20:14: PT027 [*] Use `pytest.raises` instead of unittest-style `assertRaisesRegex`
|
18 | raise ValueError("test")
19 |
19 |
20 | with self.assertRaisesRegex(
| ^^^^^^^^^^^^^^^^^^^^^^ PT027
21 | expected_exception=ValueError, expected_regex="test"
@ -161,7 +160,7 @@ PT027_0.py:20:14: PT027 [*] Use `pytest.raises` instead of unittest-style `asser
PT027_0.py:25:14: PT027 [*] Use `pytest.raises` instead of unittest-style `assertRaisesRegex`
|
23 | raise ValueError("test")
24 |
24 |
25 | with self.assertRaisesRegex(
| ^^^^^^^^^^^^^^^^^^^^^^ PT027
26 | expected_regex="test", expected_exception=ValueError
@ -190,7 +189,7 @@ PT027_0.py:25:14: PT027 [*] Use `pytest.raises` instead of unittest-style `asser
PT027_0.py:30:14: PT027 [*] Use `pytest.raises` instead of unittest-style `assertRaisesRegexp`
|
28 | raise ValueError("test")
29 |
29 |
30 | with self.assertRaisesRegexp(ValueError, "test"):
| ^^^^^^^^^^^^^^^^^^^^^^^ PT027
31 | raise ValueError("test")
@ -225,7 +224,7 @@ PT027_0.py:34:14: PT027 Use `pytest.raises` instead of unittest-style `assertRai
PT027_0.py:37:14: PT027 Use `pytest.raises` instead of unittest-style `assertRaises`
|
35 | raise ValueError
36 |
36 |
37 | with self.assertRaises(
| ^^^^^^^^^^^^^^^^^ PT027
38 | # comment
@ -236,8 +235,7 @@ PT027_0.py:37:14: PT027 Use `pytest.raises` instead of unittest-style `assertRai
PT027_0.py:44:13: PT027 Use `pytest.raises` instead of unittest-style `assertRaises`
|
43 | with (
44 | self
| _____________^
44 | / self
45 | | # comment
46 | | .assertRaises(ValueError)
| |_________________________^ PT027

View File

@ -1,12 +1,10 @@
---
source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs
snapshot_kind: text
---
PT031.py:42:5: PT031 `pytest.warns()` block should contain a single simple statement
|
41 | def test_error_multiple_statements():
42 | with pytest.warns(UserWarning):
| _____^
42 | / with pytest.warns(UserWarning):
43 | | foo()
44 | | bar()
| |_____________^ PT031
@ -15,60 +13,55 @@ PT031.py:42:5: PT031 `pytest.warns()` block should contain a single simple state
PT031.py:48:5: PT031 `pytest.warns()` block should contain a single simple statement
|
47 | async def test_error_complex_statement():
48 | with pytest.warns(UserWarning):
| _____^
48 | / with pytest.warns(UserWarning):
49 | | if True:
50 | | foo()
| |_________________^ PT031
51 |
51 |
52 | with pytest.warns(UserWarning):
|
PT031.py:52:5: PT031 `pytest.warns()` block should contain a single simple statement
|
50 | foo()
51 |
52 | with pytest.warns(UserWarning):
| _____^
51 |
52 | / with pytest.warns(UserWarning):
53 | | for i in []:
54 | | foo()
| |_________________^ PT031
55 |
55 |
56 | with pytest.warns(UserWarning):
|
PT031.py:56:5: PT031 `pytest.warns()` block should contain a single simple statement
|
54 | foo()
55 |
56 | with pytest.warns(UserWarning):
| _____^
55 |
56 | / with pytest.warns(UserWarning):
57 | | async for i in []:
58 | | foo()
| |_________________^ PT031
59 |
59 |
60 | with pytest.warns(UserWarning):
|
PT031.py:60:5: PT031 `pytest.warns()` block should contain a single simple statement
|
58 | foo()
59 |
60 | with pytest.warns(UserWarning):
| _____^
59 |
60 | / with pytest.warns(UserWarning):
61 | | while True:
62 | | foo()
| |_________________^ PT031
63 |
63 |
64 | with pytest.warns(UserWarning):
|
PT031.py:64:5: PT031 `pytest.warns()` block should contain a single simple statement
|
62 | foo()
63 |
64 | with pytest.warns(UserWarning):
| _____^
63 |
64 | / with pytest.warns(UserWarning):
65 | | async with context_manager_under_test():
66 | | if True:
67 | | foo()
@ -78,8 +71,7 @@ PT031.py:64:5: PT031 `pytest.warns()` block should contain a single simple state
PT031.py:71:5: PT031 `pytest.warns()` block should contain a single simple statement
|
70 | def test_error_try():
71 | with pytest.warns(UserWarning):
| _____^
71 | / with pytest.warns(UserWarning):
72 | | try:
73 | | foo()
74 | | except:

View File

@ -1,16 +1,15 @@
---
source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs
snapshot_kind: text
---
docstring_doubles.py:5:1: Q001 [*] Double quote multiline found but single quotes preferred
|
3 | """
4 |
4 |
5 | / """
6 | | this is not a docstring
7 | | """
| |___^ Q001
8 |
8 |
9 | l = []
|
= help: Replace double multiline quotes with single quotes
@ -31,13 +30,12 @@ docstring_doubles.py:5:1: Q001 [*] Double quote multiline found but single quote
docstring_doubles.py:16:5: Q001 [*] Double quote multiline found but single quotes preferred
|
14 | """
15 |
16 | """
| _____^
15 |
16 | / """
17 | | this is not a docstring
18 | | """
| |_______^ Q001
19 |
19 |
20 | # The colon in the list indexing below is an edge case for the docstring scanner
|
= help: Replace double multiline quotes with single quotes
@ -82,13 +80,12 @@ docstring_doubles.py:21:21: Q001 [*] Double quote multiline found but single quo
docstring_doubles.py:30:9: Q001 [*] Double quote multiline found but single quotes preferred
|
28 | some_expression = 'hello world'
29 |
30 | """
| _________^
29 |
30 | / """
31 | | this is not a docstring
32 | | """
| |___________^ Q001
33 |
33 |
34 | if l:
|
= help: Replace double multiline quotes with single quotes
@ -109,8 +106,7 @@ docstring_doubles.py:30:9: Q001 [*] Double quote multiline found but single quot
docstring_doubles.py:35:13: Q001 [*] Double quote multiline found but single quotes preferred
|
34 | if l:
35 | """
| _____________^
35 | / """
36 | | Looks like a docstring, but in reality it isn't - only modules, classes and functions
37 | | """
| |_______________^ Q001

View File

@ -1,6 +1,5 @@
---
source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs
snapshot_kind: text
---
docstring_singles.py:1:1: Q002 [*] Single quote docstring found but double quotes preferred
|
@ -8,7 +7,7 @@ docstring_singles.py:1:1: Q002 [*] Single quote docstring found but double quote
2 | | Single quotes multiline module docstring
3 | | '''
| |___^ Q002
4 |
4 |
5 | '''
|
= help: Replace single quotes docstring with double quotes
@ -27,12 +26,11 @@ docstring_singles.py:14:5: Q002 [*] Single quote docstring found but double quot
|
12 | class params \t not a docstring
13 | ''')):
14 | '''
| _____^
14 | / '''
15 | | Single quotes multiline class docstring
16 | | '''
| |_______^ Q002
17 |
17 |
18 | '''
|
= help: Replace single quotes docstring with double quotes
@ -54,12 +52,11 @@ docstring_singles.py:26:9: Q002 [*] Single quote docstring found but double quot
|
24 | definitely not a docstring''',
25 | val=l[Cls():3]):
26 | '''
| _________^
26 | / '''
27 | | Single quotes multiline function docstring
28 | | '''
| |___________^ Q002
29 |
29 |
30 | some_expression = 'hello world'
|
= help: Replace single quotes docstring with double quotes

View File

@ -1,6 +1,5 @@
---
source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs
snapshot_kind: text
---
docstring_singles_function.py:2:5: Q002 [*] Single quote docstring found but double quotes preferred
|
@ -23,8 +22,7 @@ docstring_singles_function.py:2:5: Q002 [*] Single quote docstring found but dou
docstring_singles_function.py:8:5: Q002 [*] Single quote docstring found but double quotes preferred
|
7 | def foo2():
8 | '''
| _____^
8 | / '''
9 | | function without params, multiline docstring
10 | | '''
| |_______^ Q002

View File

@ -1,6 +1,5 @@
---
source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs
snapshot_kind: text
---
docstring_doubles.py:1:1: Q002 [*] Double quote docstring found but single quotes preferred
|
@ -8,7 +7,7 @@ docstring_doubles.py:1:1: Q002 [*] Double quote docstring found but single quote
2 | | Double quotes multiline module docstring
3 | | """
| |___^ Q002
4 |
4 |
5 | """
|
= help: Replace double quotes docstring with single quotes
@ -26,12 +25,11 @@ docstring_doubles.py:1:1: Q002 [*] Double quote docstring found but single quote
docstring_doubles.py:12:5: Q002 [*] Double quote docstring found but single quotes preferred
|
11 | class Cls:
12 | """
| _____^
12 | / """
13 | | Double quotes multiline class docstring
14 | | """
| |_______^ Q002
15 |
15 |
16 | """
|
= help: Replace double quotes docstring with single quotes
@ -53,12 +51,11 @@ docstring_doubles.py:24:9: Q002 [*] Double quote docstring found but single quot
|
22 | definitely not a docstring""",
23 | val=l[Cls():3]):
24 | """
| _________^
24 | / """
25 | | Double quotes multiline function docstring
26 | | """
| |___________^ Q002
27 |
27 |
28 | some_expression = 'hello world'
|
= help: Replace double quotes docstring with single quotes

View File

@ -1,6 +1,5 @@
---
source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs
snapshot_kind: text
---
docstring_doubles_function.py:2:5: Q002 [*] Double quote docstring found but single quotes preferred
|
@ -23,8 +22,7 @@ docstring_doubles_function.py:2:5: Q002 [*] Double quote docstring found but sin
docstring_doubles_function.py:8:5: Q002 [*] Double quote docstring found but single quotes preferred
|
7 | def foo2():
8 | """
| _____^
8 | / """
9 | | function without params, multiline docstring
10 | | """
| |_______^ Q002

View File

@ -1,16 +1,15 @@
---
source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs
snapshot_kind: text
---
docstring_singles.py:5:1: Q001 [*] Single quote multiline found but double quotes preferred
|
3 | '''
4 |
4 |
5 | / '''
6 | | this is not a docstring
7 | | '''
| |___^ Q001
8 |
8 |
9 | l = []
|
= help: Replace single multiline quotes with double quotes
@ -31,7 +30,7 @@ docstring_singles.py:5:1: Q001 [*] Single quote multiline found but double quote
docstring_singles.py:11:21: Q001 [*] Single quote multiline found but double quotes preferred
|
9 | l = []
10 |
10 |
11 | class Cls(MakeKlass('''
| _____________________^
12 | | class params \t not a docstring
@ -58,13 +57,12 @@ docstring_singles.py:11:21: Q001 [*] Single quote multiline found but double quo
docstring_singles.py:18:5: Q001 [*] Single quote multiline found but double quotes preferred
|
16 | '''
17 |
18 | '''
| _____^
17 |
18 | / '''
19 | | this is not a docstring
20 | | '''
| |_______^ Q001
21 |
21 |
22 | # The colon in the list indexing below is an edge case for the docstring scanner
|
= help: Replace single multiline quotes with double quotes
@ -109,13 +107,12 @@ docstring_singles.py:23:21: Q001 [*] Single quote multiline found but double quo
docstring_singles.py:32:9: Q001 [*] Single quote multiline found but double quotes preferred
|
30 | some_expression = 'hello world'
31 |
32 | '''
| _________^
31 |
32 | / '''
33 | | this is not a docstring
34 | | '''
| |___________^ Q001
35 |
35 |
36 | if l:
|
= help: Replace single multiline quotes with double quotes
@ -136,8 +133,7 @@ docstring_singles.py:32:9: Q001 [*] Single quote multiline found but double quot
docstring_singles.py:37:13: Q001 [*] Single quote multiline found but double quotes preferred
|
36 | if l:
37 | '''
| _____________^
37 | / '''
38 | | Looks like a docstring, but in reality it isn't - only modules, classes and functions
39 | | '''
| |_______________^ Q001

View File

@ -1,13 +1,11 @@
---
source: crates/ruff_linter/src/rules/flake8_return/mod.rs
snapshot_kind: text
---
RET503.py:21:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value
|
19 | # if/elif/else
20 | def x(y):
21 | if not y:
| _____^
21 | / if not y:
22 | | return 1
| |________________^ RET503
23 | # error
@ -46,7 +44,7 @@ RET503.py:28:9: RET503 [*] Missing explicit `return` at the end of function able
RET503.py:37:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value
|
35 | return 1
36 |
36 |
37 | print() # error
| ^^^^^^^ RET503
|
@ -65,8 +63,7 @@ RET503.py:42:5: RET503 [*] Missing explicit `return` at the end of function able
|
40 | # for
41 | def x(y):
42 | for i in range(10):
| _____^
42 | / for i in range(10):
43 | | if i > 10:
44 | | return i
| |____________________^ RET503
@ -141,8 +138,7 @@ RET503.py:83:5: RET503 [*] Missing explicit `return` at the end of function able
|
81 | # last line in while loop
82 | def x(y):
83 | while i > 0:
| _____^
83 | / while i > 0:
84 | | if y > 0:
85 | | return 1
86 | | y += 1
@ -163,8 +159,7 @@ RET503.py:114:5: RET503 [*] Missing explicit `return` at the end of function abl
|
112 | # return value within loop
113 | def bar1(x, y, z):
114 | for i in x:
| _____^
114 | / for i in x:
115 | | if i > y:
116 | | break
117 | | return z
@ -184,8 +179,7 @@ RET503.py:114:5: RET503 [*] Missing explicit `return` at the end of function abl
RET503.py:121:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value
|
120 | def bar3(x, y, z):
121 | for i in x:
| _____^
121 | / for i in x:
122 | | if i > y:
123 | | if z:
124 | | break
@ -208,8 +202,7 @@ RET503.py:121:5: RET503 [*] Missing explicit `return` at the end of function abl
RET503.py:131:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value
|
130 | def bar1(x, y, z):
131 | for i in x:
| _____^
131 | / for i in x:
132 | | if i < y:
133 | | continue
134 | | return z
@ -229,8 +222,7 @@ RET503.py:131:5: RET503 [*] Missing explicit `return` at the end of function abl
RET503.py:138:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value
|
137 | def bar3(x, y, z):
138 | for i in x:
| _____^
138 | / for i in x:
139 | | if i < y:
140 | | if z:
141 | | continue
@ -253,9 +245,8 @@ RET503.py:138:5: RET503 [*] Missing explicit `return` at the end of function abl
RET503.py:275:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value
|
273 | return False
274 |
275 | for value in values:
| _____^
274 |
275 | / for value in values:
276 | | print(value)
| |____________________^ RET503
|
@ -292,8 +283,7 @@ RET503.py:301:9: RET503 [*] Missing explicit `return` at the end of function abl
|
299 | def end_of_statement():
300 | def example():
301 | if True:
| _________^
301 | / if True:
302 | | return ""
| |_____________________^ RET503
|
@ -311,8 +301,7 @@ RET503.py:301:9: RET503 [*] Missing explicit `return` at the end of function abl
RET503.py:306:9: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value
|
305 | def example():
306 | if True:
| _________^
306 | / if True:
307 | | return ""
| |_____________________^ RET503
|
@ -330,8 +319,7 @@ RET503.py:306:9: RET503 [*] Missing explicit `return` at the end of function abl
RET503.py:311:9: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value
|
310 | def example():
311 | if True:
| _________^
311 | / if True:
312 | | return "" # type: ignore
| |_____________________^ RET503
|
@ -349,8 +337,7 @@ RET503.py:311:9: RET503 [*] Missing explicit `return` at the end of function abl
RET503.py:316:9: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value
|
315 | def example():
316 | if True:
| _________^
316 | / if True:
317 | | return "" ;
| |_____________________^ RET503
|
@ -368,8 +355,7 @@ RET503.py:316:9: RET503 [*] Missing explicit `return` at the end of function abl
RET503.py:321:9: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value
|
320 | def example():
321 | if True:
| _________^
321 | / if True:
322 | | return "" \
| |_____________________^ RET503
323 | ; # type: ignore

View File

@ -1,6 +1,5 @@
---
source: crates/ruff_linter/src/rules/flake8_return/mod.rs
snapshot_kind: text
---
RET503.py:20:1: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value
|
@ -47,7 +46,7 @@ RET503.py:33:1: RET503 [*] Missing explicit `return` at the end of function able
33 | / def x(y):
34 | | if not y:
35 | | return 1
36 | |
36 | |
37 | | print() # error
| |___________^ RET503
|
@ -257,7 +256,7 @@ RET503.py:271:1: RET503 [*] Missing explicit `return` at the end of function abl
271 | / def nested(values):
272 | | if not values:
273 | | return False
274 | |
274 | |
275 | | for value in values:
276 | | print(value)
| |____________________^ RET503
@ -298,8 +297,7 @@ RET503.py:287:1: RET503 [*] Missing explicit `return` at the end of function abl
RET503.py:300:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value
|
299 | def end_of_statement():
300 | def example():
| _____^
300 | / def example():
301 | | if True:
302 | | return ""
| |_____________________^ RET503
@ -317,8 +315,7 @@ RET503.py:300:5: RET503 [*] Missing explicit `return` at the end of function abl
RET503.py:305:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value
|
305 | def example():
| _____^
305 | / def example():
306 | | if True:
307 | | return ""
| |_____________________^ RET503
@ -336,8 +333,7 @@ RET503.py:305:5: RET503 [*] Missing explicit `return` at the end of function abl
RET503.py:310:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value
|
310 | def example():
| _____^
310 | / def example():
311 | | if True:
312 | | return "" # type: ignore
| |_____________________^ RET503
@ -355,8 +351,7 @@ RET503.py:310:5: RET503 [*] Missing explicit `return` at the end of function abl
RET503.py:315:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value
|
315 | def example():
| _____^
315 | / def example():
316 | | if True:
317 | | return "" ;
| |_____________________^ RET503
@ -374,8 +369,7 @@ RET503.py:315:5: RET503 [*] Missing explicit `return` at the end of function abl
RET503.py:320:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value
|
320 | def example():
| _____^
320 | / def example():
321 | | if True:
322 | | return "" \
| |_____________________^ RET503

View File

@ -1,6 +1,5 @@
---
source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs
snapshot_kind: text
---
SIM102.py:2:1: SIM102 [*] Use a single `if` statement instead of nested `if` statements
|
@ -53,8 +52,7 @@ SIM102.py:8:5: SIM102 [*] Use a single `if` statement instead of nested `if` sta
|
6 | # SIM102
7 | if a:
8 | if b:
| _____^
8 | / if b:
9 | | if c:
| |_____________^ SIM102
10 | d
@ -139,8 +137,7 @@ SIM102.py:51:5: SIM102 [*] Use a single `if` statement instead of nested `if` st
|
49 | while x > 0:
50 | # SIM102
51 | if y > 0:
| _____^
51 | / if y > 0:
52 | | if z > 0:
| |_________________^ SIM102
53 | """this
@ -213,8 +210,7 @@ SIM102.py:83:5: SIM102 [*] Use a single `if` statement instead of nested `if` st
|
81 | while x > 0:
82 | # SIM102
83 | if node.module:
| _____^
83 | / if node.module:
84 | | if node.module == "multiprocessing" or node.module.startswith(
85 | | "multiprocessing."
86 | | ):
@ -285,8 +281,7 @@ SIM102.py:106:5: SIM102 [*] Use a single `if` statement instead of nested `if` s
|
104 | # Regression test for https://github.com/apache/airflow/blob/145b16caaa43f0c42bffd97344df916c602cddde/airflow/configuration.py#L1161
105 | if a:
106 | if b:
| _____^
106 | / if b:
107 | | if c:
| |_____________^ SIM102
108 | print("if")
@ -311,8 +306,7 @@ SIM102.py:132:5: SIM102 [*] Use a single `if` statement instead of nested `if` s
|
130 | if a:
131 | # SIM 102
132 | if b:
| _____^
132 | / if b:
133 | | if c:
| |_____________^ SIM102
134 | print("foo")
@ -337,8 +331,7 @@ SIM102.py:165:5: SIM102 [*] Use a single `if` statement instead of nested `if` s
|
163 | if a:
164 | pass
165 | elif b:
| _____^
165 | / elif b:
166 | | if c:
| |_____________^ SIM102
167 | d

View File

@ -1,13 +1,11 @@
---
source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs
snapshot_kind: text
---
SIM103.py:3:5: SIM103 [*] Return the condition `bool(a)` directly
|
1 | def f():
2 | # SIM103
3 | if a:
| _____^
3 | / if a:
4 | | return True
5 | | else:
6 | | return False
@ -31,8 +29,7 @@ SIM103.py:11:5: SIM103 [*] Return the condition `a == b` directly
|
9 | def f():
10 | # SIM103
11 | if a == b:
| _____^
11 | / if a == b:
12 | | return True
13 | | else:
14 | | return False
@ -57,8 +54,7 @@ SIM103.py:21:5: SIM103 [*] Return the condition `bool(b)` directly
|
19 | if a:
20 | return 1
21 | elif b:
| _____^
21 | / elif b:
22 | | return True
23 | | else:
24 | | return False
@ -83,8 +79,7 @@ SIM103.py:32:9: SIM103 [*] Return the condition `bool(b)` directly
|
30 | return 1
31 | else:
32 | if b:
| _________^
32 | / if b:
33 | | return True
34 | | else:
35 | | return False
@ -109,8 +104,7 @@ SIM103.py:57:5: SIM103 [*] Return the condition `not a` directly
|
55 | def f():
56 | # SIM103
57 | if a:
| _____^
57 | / if a:
58 | | return False
59 | | else:
60 | | return True
@ -135,8 +129,7 @@ SIM103.py:83:5: SIM103 Return the condition directly
|
81 | def bool():
82 | return False
83 | if a:
| _____^
83 | / if a:
84 | | return True
85 | | else:
86 | | return False
@ -148,8 +141,7 @@ SIM103.py:91:5: SIM103 [*] Return the condition `not (keys is not None and notic
|
89 | def f():
90 | # SIM103
91 | if keys is not None and notice.key not in keys:
| _____^
91 | / if keys is not None and notice.key not in keys:
92 | | return False
93 | | else:
94 | | return True
@ -174,8 +166,7 @@ SIM103.py:104:5: SIM103 [*] Return the condition `bool(a)` directly
|
102 | def f():
103 | # SIM103
104 | if a:
| _____^
104 | / if a:
105 | | return True
106 | | return False
| |________________^ SIM103
@ -198,8 +189,7 @@ SIM103.py:111:5: SIM103 [*] Return the condition `not a` directly
|
109 | def f():
110 | # SIM103
111 | if a:
| _____^
111 | / if a:
112 | | return False
113 | | return True
| |_______________^ SIM103
@ -221,8 +211,7 @@ SIM103.py:111:5: SIM103 [*] Return the condition `not a` directly
SIM103.py:117:5: SIM103 [*] Return the condition `10 < a` directly
|
116 | def f():
117 | if not 10 < a:
| _____^
117 | / if not 10 < a:
118 | | return False
119 | | return True
| |_______________^ SIM103
@ -244,8 +233,7 @@ SIM103.py:117:5: SIM103 [*] Return the condition `10 < a` directly
SIM103.py:123:5: SIM103 [*] Return the condition `not 10 < a` directly
|
122 | def f():
123 | if 10 < a:
| _____^
123 | / if 10 < a:
124 | | return False
125 | | return True
| |_______________^ SIM103

View File

@ -1,6 +1,5 @@
---
source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs
snapshot_kind: text
---
SIM105_0.py:6:1: SIM105 [*] Use `contextlib.suppress(ValueError)` instead of `try`-`except`-`pass`
|
@ -37,7 +36,7 @@ SIM105_0.py:13:1: SIM105 [*] Use `contextlib.suppress(ValueError, OSError)` inst
15 | | except (ValueError, OSError):
16 | | pass
| |________^ SIM105
17 |
17 |
18 | # SIM105
|
= help: Replace with `contextlib.suppress(ValueError, OSError)`
@ -68,7 +67,7 @@ SIM105_0.py:19:1: SIM105 [*] Use `contextlib.suppress(ValueError, OSError)` inst
21 | | except (ValueError, OSError) as e:
22 | | pass
| |________^ SIM105
23 |
23 |
24 | # SIM105
|
= help: Replace with `contextlib.suppress(ValueError, OSError)`
@ -99,7 +98,7 @@ SIM105_0.py:25:1: SIM105 [*] Use `contextlib.suppress(Exception)` instead of `tr
27 | | except:
28 | | pass
| |________^ SIM105
29 |
29 |
30 | # SIM105
|
= help: Replace with `contextlib.suppress(Exception)`
@ -130,7 +129,7 @@ SIM105_0.py:31:1: SIM105 [*] Use `contextlib.suppress(a.Error, b.Error)` instead
33 | | except (a.Error, b.Error):
34 | | pass
| |________^ SIM105
35 |
35 |
36 | # OK
|
= help: Replace with `contextlib.suppress(a.Error, b.Error)`
@ -157,8 +156,7 @@ SIM105_0.py:85:5: SIM105 [*] Use `contextlib.suppress(ValueError)` instead of `t
|
83 | def with_ellipsis():
84 | # OK
85 | try:
| _____^
85 | / try:
86 | | foo()
87 | | except ValueError:
88 | | ...
@ -187,13 +185,12 @@ SIM105_0.py:85:5: SIM105 [*] Use `contextlib.suppress(ValueError)` instead of `t
SIM105_0.py:100:5: SIM105 Use `contextlib.suppress(ValueError, OSError)` instead of `try`-`except`-`pass`
|
99 | def with_comment():
100 | try:
| _____^
100 | / try:
101 | | foo()
102 | | except (ValueError, OSError):
103 | | pass # Trailing comment.
| |____________^ SIM105
104 |
104 |
105 | try:
|
= help: Replace with `contextlib.suppress(ValueError, OSError)`
@ -202,13 +199,12 @@ SIM105_0.py:117:5: SIM105 [*] Use `contextlib.suppress(OSError)` instead of `try
|
115 | # Regression test for: https://github.com/astral-sh/ruff/issues/7123
116 | def write_models(directory, Models):
117 | try:
| _____^
117 | / try:
118 | | os.makedirs(model_dir);
119 | | except OSError:
120 | | pass;
| |____________^ SIM105
121 |
121 |
122 | try: os.makedirs(model_dir);
|
= help: Replace with `contextlib.suppress(OSError)`
@ -234,13 +230,12 @@ SIM105_0.py:117:5: SIM105 [*] Use `contextlib.suppress(OSError)` instead of `try
SIM105_0.py:122:5: SIM105 [*] Use `contextlib.suppress(OSError)` instead of `try`-`except`-`pass`
|
120 | pass;
121 |
122 | try: os.makedirs(model_dir);
| _____^
121 |
122 | / try: os.makedirs(model_dir);
123 | | except OSError:
124 | | pass;
| |____________^ SIM105
125 |
125 |
126 | try: os.makedirs(model_dir);
|
= help: Replace with `contextlib.suppress(OSError)`
@ -265,9 +260,8 @@ SIM105_0.py:122:5: SIM105 [*] Use `contextlib.suppress(OSError)` instead of `try
SIM105_0.py:126:5: SIM105 [*] Use `contextlib.suppress(OSError)` instead of `try`-`except`-`pass`
|
124 | pass;
125 |
126 | try: os.makedirs(model_dir);
| _____^
125 |
126 | / try: os.makedirs(model_dir);
127 | | except OSError:
128 | | pass; \
| |____________^ SIM105

View File

@ -1,13 +1,11 @@
---
source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs
snapshot_kind: text
---
SIM105_3.py:10:5: SIM105 Use `contextlib.suppress(ValueError)` instead of `try`-`except`-`pass`
|
8 | def bar():
9 | # SIM105
10 | try:
| _____^
10 | / try:
11 | | foo()
12 | | except ValueError:
13 | | pass

View File

@ -1,6 +1,5 @@
---
source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs
snapshot_kind: text
---
SIM108.py:2:1: SIM108 [*] Use ternary operator `b = c if a else d` instead of `if`-`else`-block
|
@ -10,7 +9,7 @@ SIM108.py:2:1: SIM108 [*] Use ternary operator `b = c if a else d` instead of `i
4 | | else:
5 | | b = d
| |_________^ SIM108
6 |
6 |
7 | # OK
|
= help: Replace `if`-`else`-block with `b = c if a else d`
@ -30,8 +29,7 @@ SIM108.py:30:5: SIM108 [*] Use ternary operator `b = 1 if a else 2` instead of `
|
28 | pass
29 | else:
30 | if a:
| _____^
30 | / if a:
31 | | b = 1
32 | | else:
33 | | b = 2
@ -129,7 +127,7 @@ SIM108.py:141:1: SIM108 [*] Use ternary operator `z = cond if cond else other_co
143 | | else:
144 | | z = other_cond
| |__________________^ SIM108
145 |
145 |
146 | # SIM108 - should suggest
|
= help: Replace `if`-`else`-block with `z = cond if cond else other_cond`
@ -156,7 +154,7 @@ SIM108.py:148:1: SIM108 [*] Use ternary operator `z = cond if not cond else othe
150 | | else:
151 | | z = other_cond
| |__________________^ SIM108
152 |
152 |
153 | # SIM108 - should suggest
|
= help: Replace `if`-`else`-block with `z = cond if not cond else other_cond`
@ -183,7 +181,7 @@ SIM108.py:155:1: SIM108 [*] Use ternary operator `z = not cond if cond else othe
157 | | else:
158 | | z = other_cond
| |__________________^ SIM108
159 |
159 |
160 | # SIM108 does not suggest
|
= help: Replace `if`-`else`-block with `z = not cond if cond else other_cond`
@ -210,7 +208,7 @@ SIM108.py:167:1: SIM108 [*] Use ternary operator `z = 1 if True else other` inst
169 | | else:
170 | | z = other
| |_____________^ SIM108
171 |
171 |
172 | if False:
|
= help: Replace `if`-`else`-block with `z = 1 if True else other`
@ -231,13 +229,13 @@ SIM108.py:167:1: SIM108 [*] Use ternary operator `z = 1 if True else other` inst
SIM108.py:177:1: SIM108 [*] Use ternary operator `z = True if 1 else other` instead of `if`-`else`-block
|
175 | z = other
176 |
176 |
177 | / if 1:
178 | | z = True
179 | | else:
180 | | z = other
| |_____________^ SIM108
181 |
181 |
182 | # SIM108 does not suggest a binary option in this
|
= help: Replace `if`-`else`-block with `z = True if 1 else other`
@ -264,7 +262,7 @@ SIM108.py:185:1: SIM108 [*] Use ternary operator `z = foo() if foo() else other`
187 | | else:
188 | | z = other
| |_____________^ SIM108
189 |
189 |
190 | # SIM108 does not suggest a binary option in this
|
= help: Replace `if`-`else`-block with `z = foo() if foo() else other`

View File

@ -1,13 +1,11 @@
---
source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs
snapshot_kind: text
---
SIM110.py:3:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead of `for` loop
|
1 | def f():
2 | # SIM110
3 | for x in iterable:
| _____^
3 | / for x in iterable:
4 | | if check(x):
5 | | return True
6 | | return False
@ -31,8 +29,7 @@ SIM110.py:25:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` inst
|
23 | def f():
24 | # SIM111
25 | for x in iterable:
| _____^
25 | / for x in iterable:
26 | | if check(x):
27 | | return False
28 | | return True
@ -57,8 +54,7 @@ SIM110.py:33:5: SIM110 [*] Use `return all(x.is_empty() for x in iterable)` inst
|
31 | def f():
32 | # SIM111
33 | for x in iterable:
| _____^
33 | / for x in iterable:
34 | | if not x.is_empty():
35 | | return False
36 | | return True
@ -83,8 +79,7 @@ SIM110.py:55:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead
|
53 | def f():
54 | # SIM110
55 | for x in iterable:
| _____^
55 | / for x in iterable:
56 | | if check(x):
57 | | return True
58 | | else:
@ -111,8 +106,7 @@ SIM110.py:64:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` inst
|
62 | def f():
63 | # SIM111
64 | for x in iterable:
| _____^
64 | / for x in iterable:
65 | | if check(x):
66 | | return False
67 | | else:
@ -139,8 +133,7 @@ SIM110.py:73:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead
|
71 | def f():
72 | # SIM110
73 | for x in iterable:
| _____^
73 | / for x in iterable:
74 | | if check(x):
75 | | return True
76 | | else:
@ -168,8 +161,7 @@ SIM110.py:83:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` inst
|
81 | def f():
82 | # SIM111
83 | for x in iterable:
| _____^
83 | / for x in iterable:
84 | | if check(x):
85 | | return False
86 | | else:
@ -196,9 +188,8 @@ SIM110.py:83:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` inst
SIM110.py:124:5: SIM110 Use `return any(check(x) for x in iterable)` instead of `for` loop
|
122 | pass
123 |
124 | for x in iterable:
| _____^
123 |
124 | / for x in iterable:
125 | | if check(x):
126 | | return True
127 | | return False
@ -209,9 +200,8 @@ SIM110.py:124:5: SIM110 Use `return any(check(x) for x in iterable)` instead of
SIM110.py:134:5: SIM110 Use `return all(not check(x) for x in iterable)` instead of `for` loop
|
132 | pass
133 |
134 | for x in iterable:
| _____^
133 |
134 | / for x in iterable:
135 | | if check(x):
136 | | return False
137 | | return True
@ -222,8 +212,7 @@ SIM110.py:134:5: SIM110 Use `return all(not check(x) for x in iterable)` instead
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:
| _____^
144 | / for x in iterable:
145 | | if check(x):
146 | | return True
147 | | return False
@ -247,8 +236,7 @@ SIM110.py:144:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead
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:
| _____^
154 | / for x in iterable:
155 | | if check(x):
156 | | return False
157 | | return True
@ -273,8 +261,7 @@ SIM110.py:162:5: SIM110 [*] Use `return any(x.isdigit() for x in "012ß9💣2
|
160 | def f():
161 | # SIM110
162 | for x in "012ß9💣29012ß9💣29012ß9💣29012ß9💣29012ß9💣2":
| _____^
162 | / for x in "012ß9💣29012ß9💣29012ß9💣29012ß9💣29012ß9💣2":
163 | | if x.isdigit():
164 | | return True
165 | | return False
@ -299,13 +286,12 @@ SIM110.py:184:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead
|
182 | async def f():
183 | # SIM110
184 | for x in iterable:
| _____^
184 | / for x in iterable:
185 | | if check(x):
186 | | return True
187 | | return False
| |________________^ SIM110
188 |
188 |
189 | async def f():
|
= help: Replace with `return any(check(x) for x in iterable)`
@ -327,13 +313,12 @@ SIM110.py:191:5: SIM110 [*] Use `return any(check(x) for x in await iterable)` i
|
189 | async def f():
190 | # SIM110
191 | for x in await iterable:
| _____^
191 | / for x in await iterable:
192 | | if check(x):
193 | | return True
194 | | return False
| |________________^ SIM110
195 |
195 |
196 | def f():
|
= help: Replace with `return any(check(x) for x in await iterable)`

View File

@ -1,13 +1,11 @@
---
source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs
snapshot_kind: text
---
SIM111.py:3:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead of `for` loop
|
1 | def f():
2 | # SIM110
3 | for x in iterable:
| _____^
3 | / for x in iterable:
4 | | if check(x):
5 | | return True
6 | | return False
@ -31,8 +29,7 @@ SIM111.py:25:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` inst
|
23 | def f():
24 | # SIM111
25 | for x in iterable:
| _____^
25 | / for x in iterable:
26 | | if check(x):
27 | | return False
28 | | return True
@ -57,8 +54,7 @@ SIM111.py:33:5: SIM110 [*] Use `return all(x.is_empty() for x in iterable)` inst
|
31 | def f():
32 | # SIM111
33 | for x in iterable:
| _____^
33 | / for x in iterable:
34 | | if not x.is_empty():
35 | | return False
36 | | return True
@ -83,8 +79,7 @@ SIM111.py:55:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead
|
53 | def f():
54 | # SIM110
55 | for x in iterable:
| _____^
55 | / for x in iterable:
56 | | if check(x):
57 | | return True
58 | | else:
@ -111,8 +106,7 @@ SIM111.py:64:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` inst
|
62 | def f():
63 | # SIM111
64 | for x in iterable:
| _____^
64 | / for x in iterable:
65 | | if check(x):
66 | | return False
67 | | else:
@ -139,8 +133,7 @@ SIM111.py:73:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead
|
71 | def f():
72 | # SIM110
73 | for x in iterable:
| _____^
73 | / for x in iterable:
74 | | if check(x):
75 | | return True
76 | | else:
@ -168,8 +161,7 @@ SIM111.py:83:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` inst
|
81 | def f():
82 | # SIM111
83 | for x in iterable:
| _____^
83 | / for x in iterable:
84 | | if check(x):
85 | | return False
86 | | else:
@ -196,9 +188,8 @@ SIM111.py:83:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` inst
SIM111.py:124:5: SIM110 Use `return any(check(x) for x in iterable)` instead of `for` loop
|
122 | pass
123 |
124 | for x in iterable:
| _____^
123 |
124 | / for x in iterable:
125 | | if check(x):
126 | | return True
127 | | return False
@ -209,9 +200,8 @@ SIM111.py:124:5: SIM110 Use `return any(check(x) for x in iterable)` instead of
SIM111.py:134:5: SIM110 Use `return all(not check(x) for x in iterable)` instead of `for` loop
|
132 | pass
133 |
134 | for x in iterable:
| _____^
133 |
134 | / for x in iterable:
135 | | if check(x):
136 | | return False
137 | | return True
@ -222,8 +212,7 @@ SIM111.py:134:5: SIM110 Use `return all(not check(x) for x in iterable)` instead
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:
| _____^
144 | / for x in iterable:
145 | | if check(x):
146 | | return True
147 | | return False
@ -247,8 +236,7 @@ SIM111.py:144:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead
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:
| _____^
154 | / for x in iterable:
155 | | if check(x):
156 | | return False
157 | | return True
@ -273,8 +261,7 @@ SIM111.py:162:5: SIM110 [*] Use `return all(x in y for x in iterable)` instead o
|
160 | def f():
161 | # SIM111
162 | for x in iterable:
| _____^
162 | / for x in iterable:
163 | | if x not in y:
164 | | return False
165 | | return True
@ -299,8 +286,7 @@ SIM111.py:170:5: SIM110 [*] Use `return all(x <= y for x in iterable)` instead o
|
168 | def f():
169 | # SIM111
170 | for x in iterable:
| _____^
170 | / for x in iterable:
171 | | if x > y:
172 | | return False
173 | | return True
@ -325,8 +311,7 @@ SIM111.py:178:5: SIM110 [*] Use `return all(not x.isdigit() for x in "012ß9💣
|
176 | def f():
177 | # SIM111
178 | for x in "012ß9💣29012ß9💣29012ß9💣29012ß9💣29012ß9":
| _____^
178 | / for x in "012ß9💣29012ß9💣29012ß9💣29012ß9💣29012ß9":
179 | | if x.isdigit():
180 | | return False
181 | | return True

View File

@ -1,6 +1,5 @@
---
source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs
snapshot_kind: text
---
SIM114.py:2:1: SIM114 [*] Combine `if` branches using logical `or` operator
|
@ -10,7 +9,7 @@ SIM114.py:2:1: SIM114 [*] Combine `if` branches using logical `or` operator
4 | | elif c:
5 | | b
| |_____^ SIM114
6 |
6 |
7 | if a: # we preserve comments, too!
|
= help: Combine `if` branches
@ -28,13 +27,13 @@ SIM114.py:2:1: SIM114 [*] Combine `if` branches using logical `or` operator
SIM114.py:7:1: SIM114 [*] Combine `if` branches using logical `or` operator
|
5 | b
6 |
6 |
7 | / if a: # we preserve comments, too!
8 | | b
9 | | elif c: # but not on the second branch
10 | | b
| |_____^ SIM114
11 |
11 |
12 | if x == 1:
|
= help: Combine `if` branches
@ -54,7 +53,7 @@ SIM114.py:7:1: SIM114 [*] Combine `if` branches using logical `or` operator
SIM114.py:12:1: SIM114 [*] Combine `if` branches using logical `or` operator
|
10 | b
11 |
11 |
12 | / if x == 1:
13 | | for _ in range(20):
14 | | print("hello")
@ -62,7 +61,7 @@ SIM114.py:12:1: SIM114 [*] Combine `if` branches using logical `or` operator
16 | | for _ in range(20):
17 | | print("hello")
| |______________________^ SIM114
18 |
18 |
19 | if x == 1:
|
= help: Combine `if` branches
@ -83,7 +82,7 @@ SIM114.py:12:1: SIM114 [*] Combine `if` branches using logical `or` operator
SIM114.py:19:1: SIM114 [*] Combine `if` branches using logical `or` operator
|
17 | print("hello")
18 |
18 |
19 | / if x == 1:
20 | | if True:
21 | | for _ in range(20):
@ -93,7 +92,7 @@ SIM114.py:19:1: SIM114 [*] Combine `if` branches using logical `or` operator
25 | | for _ in range(20):
26 | | print("hello")
| |__________________________^ SIM114
27 |
27 |
28 | if x == 1:
|
= help: Combine `if` branches
@ -115,7 +114,7 @@ SIM114.py:19:1: SIM114 [*] Combine `if` branches using logical `or` operator
SIM114.py:28:1: SIM114 [*] Combine `if` branches using logical `or` operator
|
26 | print("hello")
27 |
27 |
28 | / if x == 1:
29 | | if True:
30 | | for _ in range(20):
@ -131,7 +130,7 @@ SIM114.py:28:1: SIM114 [*] Combine `if` branches using logical `or` operator
40 | | for _ in range(20):
41 | | print("hello")
| |__________________________^ SIM114
42 |
42 |
43 | if (
|
= help: Combine `if` branches
@ -156,8 +155,7 @@ SIM114.py:28:1: SIM114 [*] Combine `if` branches using logical `or` operator
SIM114.py:29:5: SIM114 [*] Combine `if` branches using logical `or` operator
|
28 | if x == 1:
29 | if True:
| _____^
29 | / if True:
30 | | for _ in range(20):
31 | | print("hello")
32 | | elif False:
@ -186,15 +184,14 @@ SIM114.py:36:5: SIM114 [*] Combine `if` branches using logical `or` operator
|
34 | print("hello")
35 | elif x == 2:
36 | if True:
| _____^
36 | / if True:
37 | | for _ in range(20):
38 | | print("hello")
39 | | elif False:
40 | | for _ in range(20):
41 | | print("hello")
| |__________________________^ SIM114
42 |
42 |
43 | if (
|
= help: Combine `if` branches
@ -215,7 +212,7 @@ SIM114.py:36:5: SIM114 [*] Combine `if` branches using logical `or` operator
SIM114.py:43:1: SIM114 [*] Combine `if` branches using logical `or` operator
|
41 | print("hello")
42 |
42 |
43 | / if (
44 | | x == 1
45 | | and y == 2
@ -236,7 +233,7 @@ SIM114.py:43:1: SIM114 [*] Combine `if` branches using logical `or` operator
60 | | elif 1 == 2:
61 | | pass
| |________^ SIM114
62 |
62 |
63 | if result.eofs == "O":
|
= help: Combine `if` branches
@ -333,8 +330,7 @@ SIM114.py:118:5: SIM114 [*] Combine `if` branches using logical `or` operator
|
116 | a = True
117 | b = False
118 | if a > b: # end-of-line
| _____^
118 | / if a > b: # end-of-line
119 | | return 3
120 | | elif a == b:
121 | | return 3
@ -360,8 +356,7 @@ SIM114.py:122:5: SIM114 [*] Combine `if` branches using logical `or` operator
|
120 | elif a == b:
121 | return 3
122 | elif a < b: # end-of-line
| _____^
122 | / elif a < b: # end-of-line
123 | | return 4
124 | | elif b is None:
125 | | return 4
@ -385,8 +380,7 @@ SIM114.py:132:5: SIM114 [*] Combine `if` branches using logical `or` operator
|
130 | a = True
131 | b = False
132 | if a > b: # end-of-line
| _____^
132 | / if a > b: # end-of-line
133 | | return 3
134 | | elif a := 1:
135 | | return 3

View File

@ -1,6 +1,5 @@
---
source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs
snapshot_kind: text
---
SIM117.py:2:1: SIM117 [*] Use a single `with` statement with multiple contexts instead of nested `with` statements
|
@ -113,8 +112,7 @@ SIM117.py:53:5: SIM117 [*] Use a single `with` statement with multiple contexts
|
51 | while True:
52 | # SIM117
53 | with A() as a:
| _____^
53 | / with A() as a:
54 | | with B() as b:
| |______________________^ SIM117
55 | """this
@ -277,8 +275,7 @@ SIM117.py:106:5: SIM117 Use a single `with` statement with multiple contexts ins
|
104 | # From issue #3025.
105 | async def main():
106 | async with A() as a: # SIM117.
| _____^
106 | / async with A() as a: # SIM117.
107 | | async with B() as b:
| |____________________________^ SIM117
108 | print("async-inside!")

View File

@ -1,6 +1,5 @@
---
source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs
snapshot_kind: text
---
SIM401.py:6:1: SIM401 [*] Use `var = a_dict.get(key, "default1")` instead of an `if` block
|
@ -10,7 +9,7 @@ SIM401.py:6:1: SIM401 [*] Use `var = a_dict.get(key, "default1")` instead of an
8 | | else:
9 | | var = "default1"
| |____________________^ SIM401
10 |
10 |
11 | # SIM401 (pattern-2)
|
= help: Replace with `var = a_dict.get(key, "default1")`
@ -36,7 +35,7 @@ SIM401.py:12:1: SIM401 [*] Use `var = a_dict.get(key, "default2")` instead of an
14 | | else:
15 | | var = a_dict[key]
| |_____________________^ SIM401
16 |
16 |
17 | # OK (default contains effect)
|
= help: Replace with `var = a_dict.get(key, "default2")`
@ -62,7 +61,7 @@ SIM401.py:24:1: SIM401 [*] Use `var = a_dict.get(keys[idx], "default")` instead
26 | | else:
27 | | var = "default"
| |___________________^ SIM401
28 |
28 |
29 | # SIM401 (complex expression in dict)
|
= help: Replace with `var = a_dict.get(keys[idx], "default")`
@ -88,7 +87,7 @@ SIM401.py:30:1: SIM401 [*] Use `var = dicts[idx].get(key, "default")` instead of
32 | | else:
33 | | var = "default"
| |___________________^ SIM401
34 |
34 |
35 | # SIM401 (complex expression in var)
|
= help: Replace with `var = dicts[idx].get(key, "default")`
@ -114,7 +113,7 @@ SIM401.py:36:1: SIM401 [*] Use `vars[idx] = a_dict.get(key, "defaultß9💣26
38 | | else:
39 | | vars[idx] = "defaultß9💣26789ß9💣26789ß9💣26789ß9💣26789ß9💣26789"
| |___________________________________________________________________________^ SIM401
40 |
40 |
41 | # SIM401
|
= help: Replace with `vars[idx] = a_dict.get(key, "defaultß9💣26789ß9💣26789ß9💣26789ß9💣26789ß9💣26789")`
@ -136,13 +135,12 @@ SIM401.py:45:5: SIM401 [*] Use `vars[idx] = a_dict.get(key, "default")` instead
|
43 | pass
44 | else:
45 | if key in a_dict:
| _____^
45 | / if key in a_dict:
46 | | vars[idx] = a_dict[key]
47 | | else:
48 | | vars[idx] = "default"
| |_____________________________^ SIM401
49 |
49 |
50 | ###
|
= help: Replace with `vars[idx] = a_dict.get(key, "default")`
@ -165,7 +163,7 @@ SIM401.py:123:7: SIM401 [*] Use `a_dict.get(key, "default3")` instead of an `if`
122 | # SIM401
123 | var = a_dict[key] if key in a_dict else "default3"
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SIM401
124 |
124 |
125 | # SIM401
|
= help: Replace with `a_dict.get(key, "default3")`
@ -185,7 +183,7 @@ SIM401.py:126:7: SIM401 [*] Use `a_dict.get(key, "default-1")` instead of an `if
125 | # SIM401
126 | var = "default-1" if key not in a_dict else a_dict[key]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SIM401
127 |
127 |
128 | # OK (default contains effect)
|
= help: Replace with `a_dict.get(key, "default-1")`

View File

@ -4,7 +4,7 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs
TC006.py:4:10: TC006 [*] Add quotes to type expression in `typing.cast()`
|
2 | from typing import cast
3 |
3 |
4 | cast(int, 3.0) # TC006
| ^^^ TC006
|
@ -23,7 +23,7 @@ TC006.py:4:10: TC006 [*] Add quotes to type expression in `typing.cast()`
TC006.py:10:10: TC006 [*] Add quotes to type expression in `typing.cast()`
|
8 | from typing import cast
9 |
9 |
10 | cast(list[tuple[bool | float | int | str]], 3.0) # TC006
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TC006
|
@ -42,7 +42,7 @@ TC006.py:10:10: TC006 [*] Add quotes to type expression in `typing.cast()`
TC006.py:16:10: TC006 [*] Add quotes to type expression in `typing.cast()`
|
14 | from typing import Union, cast
15 |
15 |
16 | cast(list[tuple[Union[bool, float, int, str]]], 3.0) # TC006
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TC006
|
@ -61,7 +61,7 @@ TC006.py:16:10: TC006 [*] Add quotes to type expression in `typing.cast()`
TC006.py:40:14: TC006 [*] Add quotes to type expression in `typing.cast()`
|
38 | from typing import cast as typecast
39 |
39 |
40 | typecast(int, 3.0) # TC006
| ^^^ TC006
|
@ -80,7 +80,7 @@ TC006.py:40:14: TC006 [*] Add quotes to type expression in `typing.cast()`
TC006.py:46:17: TC006 [*] Add quotes to type expression in `typing.cast()`
|
44 | import typing
45 |
45 |
46 | typing.cast(int, 3.0) # TC006
| ^^^ TC006
|
@ -99,7 +99,7 @@ TC006.py:46:17: TC006 [*] Add quotes to type expression in `typing.cast()`
TC006.py:52:12: TC006 [*] Add quotes to type expression in `typing.cast()`
|
50 | import typing as t
51 |
51 |
52 | t.cast(t.Literal["3.0", '3'], 3.0) # TC006
| ^^^^^^^^^^^^^^^^^^^^^ TC006
|
@ -118,8 +118,7 @@ TC006.py:52:12: TC006 [*] Add quotes to type expression in `typing.cast()`
TC006.py:59:9: TC006 [*] Add quotes to type expression in `typing.cast()`
|
58 | cast(
59 | int # TC006 (unsafe, because it will get rid of this comment)
| _________^
59 | / int # TC006 (unsafe, because it will get rid of this comment)
60 | | | None,
| |______________^ TC006
61 | 3.0
@ -160,7 +159,7 @@ TC006.py:68:17: TC006 [*] Add quotes to type expression in `typing.cast()`
TC006.py:75:10: TC006 [*] Add quotes to type expression in `typing.cast()`
|
73 | from typing import cast, Literal
74 |
74 |
75 | cast(Literal["A"], 'A')
| ^^^^^^^^^^^^ TC006
|
@ -179,7 +178,7 @@ TC006.py:75:10: TC006 [*] Add quotes to type expression in `typing.cast()`
TC006.py:82:10: TC006 [*] Add quotes to type expression in `typing.cast()`
|
80 | from typing import cast, Annotated, Literal
81 |
81 |
82 | cast(list[Annotated["list['Literal[\"A\"]']", "Foo"]], ['A'])
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TC006
|

View File

@ -1,6 +1,5 @@
---
source: crates/ruff_linter/src/rules/flake8_use_pathlib/mod.rs
snapshot_kind: text
---
PTH201.py:6:10: PTH201 [*] Do not pass the current directory explicitly to `Path`
|
@ -69,7 +68,7 @@ PTH201.py:9:10: PTH201 [*] Do not pass the current directory explicitly to `Path
8 | _ = PurePath(".")
9 | _ = Path("")
| ^^ PTH201
10 |
10 |
11 | Path('', )
|
= help: Remove the current directory argument
@ -87,10 +86,10 @@ PTH201.py:9:10: PTH201 [*] Do not pass the current directory explicitly to `Path
PTH201.py:11:6: PTH201 [*] Do not pass the current directory explicitly to `Path`
|
9 | _ = Path("")
10 |
10 |
11 | Path('', )
| ^^ PTH201
12 |
12 |
13 | Path(
|
= help: Remove the current directory argument
@ -171,8 +170,7 @@ PTH201.py:22:5: PTH201 [*] Do not pass the current directory explicitly to `Path
PTH201.py:26:5: PTH201 [*] Do not pass the current directory explicitly to `Path`
|
25 | Path(
26 | '' # Comment in the middle of implicitly concatenated string
| _____^
26 | / '' # Comment in the middle of implicitly concatenated string
27 | | ".",
| |_______^ PTH201
28 | )
@ -281,8 +279,7 @@ PTH201.py:44:5: PTH201 [*] Do not pass the current directory explicitly to `Path
PTH201.py:48:5: PTH201 [*] Do not pass the current directory explicitly to `Path`
|
47 | ( Path(
48 | '' # Comment in the middle of implicitly concatenated string
| _____^
48 | / '' # Comment in the middle of implicitly concatenated string
49 | | ".",
| |_______^ PTH201
50 | ) )/ (("parenthesized path call")

View File

@ -1,12 +1,11 @@
---
source: crates/ruff_linter/src/rules/isort/mod.rs
snapshot_kind: text
---
bom_unsorted.py:1:1: I001 [*] Import block is un-sorted or un-formatted
|
1 | import foo
| _^
1 | / import foo
2 | | import bar
| |___________^ I001
|
= help: Organize imports

View File

@ -1,13 +1,12 @@
---
source: crates/ruff_linter/src/rules/isort/mod.rs
snapshot_kind: text
---
trailing_suffix.py:1:1: I001 Import block is un-sorted or un-formatted
|
1 | / import sys
2 | | import os; x = 1
| |_________^ I001
3 |
3 |
4 | if True:
|
= help: Organize imports
@ -15,8 +14,7 @@ trailing_suffix.py:1:1: I001 Import block is un-sorted or un-formatted
trailing_suffix.py:5:5: I001 Import block is un-sorted or un-formatted
|
4 | if True:
5 | import sys
| _____^
5 | / import sys
6 | | import os; x = 1
| |_____________^ I001
|

View File

@ -1,15 +1,13 @@
---
source: crates/ruff_linter/src/rules/perflint/mod.rs
snapshot_kind: text
---
PERF203.py:5:5: PERF203 `try`-`except` within a loop incurs performance overhead
|
3 | try:
4 | print(f"{i}")
5 | except:
| _____^
5 | / except:
6 | | print("error")
| |______________________^ PERF203
7 |
7 |
8 | # OK
|

View File

@ -151,8 +151,7 @@ PERF401.py:210:13: PERF401 Use a list comprehension to create a transformed list
|
208 | ): # Comment 3
209 | if i % 2: # Comment 4
210 | result.append(
| _____________^
210 | / result.append(
211 | | (
212 | | i + 1,
213 | | # Comment 5
@ -188,7 +187,7 @@ PERF401.py:239:9: PERF401 Use a list comprehension to create a transformed list
238 | for a in values:
239 | result.append(a + 1) # PERF401
| ^^^^^^^^^^^^^^^^^^^^ PERF401
240 |
240 |
241 | def f():
|
= help: Replace for loop with list comprehension

View File

@ -355,8 +355,7 @@ PERF401.py:210:13: PERF401 [*] Use a list comprehension to create a transformed
|
208 | ): # Comment 3
209 | if i % 2: # Comment 4
210 | result.append(
| _____________^
210 | / result.append(
211 | | (
212 | | i + 1,
213 | | # Comment 5
@ -447,7 +446,7 @@ PERF401.py:239:9: PERF401 [*] Use a list comprehension to create a transformed l
238 | for a in values:
239 | result.append(a + 1) # PERF401
| ^^^^^^^^^^^^^^^^^^^^ PERF401
240 |
240 |
241 | def f():
|
= help: Replace for loop with list comprehension

View File

@ -1,6 +1,5 @@
---
source: crates/ruff_linter/src/rules/pycodestyle/mod.rs
snapshot_kind: text
---
E731.py:3:5: E731 [*] Do not assign a `lambda` expression, use a `def`
|
@ -187,7 +186,7 @@ E731.py:86:5: E731 [*] Do not assign a `lambda` expression, use a `def`
E731.py:94:5: E731 [*] Do not assign a `lambda` expression, use a `def`
|
92 | from typing import Callable
93 |
93 |
94 | f: Callable[[], None] = lambda: None
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ E731
|
@ -207,7 +206,7 @@ E731.py:94:5: E731 [*] Do not assign a `lambda` expression, use a `def`
E731.py:102:5: E731 [*] Do not assign a `lambda` expression, use a `def`
|
100 | from typing import Callable
101 |
101 |
102 | f: Callable[..., None] = lambda a, b: None
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ E731
|
@ -227,7 +226,7 @@ E731.py:102:5: E731 [*] Do not assign a `lambda` expression, use a `def`
E731.py:110:5: E731 [*] Do not assign a `lambda` expression, use a `def`
|
108 | from typing import Callable
109 |
109 |
110 | f: Callable[[int], int] = lambda x: 2 * x
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ E731
|
@ -247,7 +246,7 @@ E731.py:110:5: E731 [*] Do not assign a `lambda` expression, use a `def`
E731.py:119:5: E731 [*] Do not assign a `lambda` expression, use a `def`
|
117 | from collections.abc import Callable
118 |
118 |
119 | f: Callable[[str, int], str] = lambda a, b: a * b
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ E731
|
@ -267,7 +266,7 @@ E731.py:119:5: E731 [*] Do not assign a `lambda` expression, use a `def`
E731.py:127:5: E731 [*] Do not assign a `lambda` expression, use a `def`
|
125 | from collections.abc import Callable
126 |
126 |
127 | f: Callable[[str, int], tuple[str, int]] = lambda a, b: (a, b)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ E731
|
@ -287,7 +286,7 @@ E731.py:127:5: E731 [*] Do not assign a `lambda` expression, use a `def`
E731.py:135:5: E731 [*] Do not assign a `lambda` expression, use a `def`
|
133 | from collections.abc import Callable
134 |
134 |
135 | f: Callable[[str, int, list[str]], list[str]] = lambda a, b, /, c: [*c, a * b]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ E731
|
@ -347,9 +346,8 @@ E731.py:140:5: E731 Do not assign a `lambda` expression, use a `def`
E731.py:147:5: E731 [*] Do not assign a `lambda` expression, use a `def`
|
145 | # E731
146 |
147 | f = lambda: (
| _____^
146 |
147 | / f = lambda: (
148 | | i := 1,
149 | | )
| |_____^ E731
@ -380,7 +378,7 @@ E731.py:163:1: E731 [*] Do not assign a `lambda` expression, use a `def`
165 | | b
166 | | """
| |___^ E731
167 |
167 |
168 | # * https://github.com/astral-sh/ruff/issues/10277
|
= help: Rewrite `x` as a `def`
@ -401,7 +399,7 @@ E731.py:169:1: E731 [*] Do not assign a `lambda` expression, use a `def`
168 | # * https://github.com/astral-sh/ruff/issues/10277
169 | at_least_one_million = lambda _: _ >= 1_000_000
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ E731
170 |
170 |
171 | x = lambda: (
|
= help: Rewrite `at_least_one_million` as a `def`
@ -420,13 +418,13 @@ E731.py:169:1: E731 [*] Do not assign a `lambda` expression, use a `def`
E731.py:171:1: E731 [*] Do not assign a `lambda` expression, use a `def`
|
169 | at_least_one_million = lambda _: _ >= 1_000_000
170 |
170 |
171 | / x = lambda: (
172 | | # comment
173 | | 5 + 10
174 | | )
| |_^ E731
175 |
175 |
176 | x = lambda: (
|
= help: Rewrite `x` as a `def`
@ -445,7 +443,7 @@ E731.py:171:1: E731 [*] Do not assign a `lambda` expression, use a `def`
E731.py:176:1: E731 [*] Do not assign a `lambda` expression, use a `def`
|
174 | )
175 |
175 |
176 | / x = lambda: (
177 | | # comment
178 | | y := 10

View File

@ -1,21 +1,19 @@
---
source: crates/ruff_linter/src/rules/pydoclint/mod.rs
snapshot_kind: text
---
DOC502_google.py:7:5: DOC502 Raised exception is not explicitly raised: `FasterThanLightError`
|
5 | # DOC502
6 | def calculate_speed(distance: float, time: float) -> float:
7 | """Calculate speed as distance divided by time.
| _____^
8 | |
7 | / """Calculate speed as distance divided by time.
8 | |
9 | | Args:
10 | | distance: Distance traveled.
11 | | time: Time spent traveling.
12 | |
12 | |
13 | | Returns:
14 | | Speed as distance divided by time.
15 | |
15 | |
16 | | Raises:
17 | | FasterThanLightError: If speed is greater than the speed of light.
18 | | """
@ -28,16 +26,15 @@ DOC502_google.py:24:5: DOC502 Raised exceptions are not explicitly raised: `Fast
|
22 | # DOC502
23 | def calculate_speed(distance: float, time: float) -> float:
24 | """Calculate speed as distance divided by time.
| _____^
25 | |
24 | / """Calculate speed as distance divided by time.
25 | |
26 | | Args:
27 | | distance: Distance traveled.
28 | | time: Time spent traveling.
29 | |
29 | |
30 | | Returns:
31 | | Speed as distance divided by time.
32 | |
32 | |
33 | | Raises:
34 | | FasterThanLightError: If speed is greater than the speed of light.
35 | | DivisionByZero: Divide by zero.
@ -51,16 +48,15 @@ DOC502_google.py:42:5: DOC502 Raised exception is not explicitly raised: `Divisi
|
40 | # DOC502
41 | def calculate_speed(distance: float, time: float) -> float:
42 | """Calculate speed as distance divided by time.
| _____^
43 | |
42 | / """Calculate speed as distance divided by time.
43 | |
44 | | Args:
45 | | distance: Distance traveled.
46 | | time: Time spent traveling.
47 | |
47 | |
48 | | Returns:
49 | | Speed as distance divided by time.
50 | |
50 | |
51 | | Raises:
52 | | FasterThanLightError: If speed is greater than the speed of light.
53 | | DivisionByZero: Divide by zero.

View File

@ -1,27 +1,25 @@
---
source: crates/ruff_linter/src/rules/pydoclint/mod.rs
snapshot_kind: text
---
DOC502_numpy.py:7:5: DOC502 Raised exception is not explicitly raised: `FasterThanLightError`
|
5 | # DOC502
6 | def calculate_speed(distance: float, time: float) -> float:
7 | """
| _____^
7 | / """
8 | | Calculate speed as distance divided by time.
9 | |
9 | |
10 | | Parameters
11 | | ----------
12 | | distance : float
13 | | Distance traveled.
14 | | time : float
15 | | Time spent traveling.
16 | |
16 | |
17 | | Returns
18 | | -------
19 | | float
20 | | Speed as distance divided by time.
21 | |
21 | |
22 | | Raises
23 | | ------
24 | | FasterThanLightError
@ -36,22 +34,21 @@ DOC502_numpy.py:32:5: DOC502 Raised exceptions are not explicitly raised: `Faste
|
30 | # DOC502
31 | def calculate_speed(distance: float, time: float) -> float:
32 | """
| _____^
32 | / """
33 | | Calculate speed as distance divided by time.
34 | |
34 | |
35 | | Parameters
36 | | ----------
37 | | distance : float
38 | | Distance traveled.
39 | | time : float
40 | | Time spent traveling.
41 | |
41 | |
42 | | Returns
43 | | -------
44 | | float
45 | | Speed as distance divided by time.
46 | |
46 | |
47 | | Raises
48 | | ------
49 | | FasterThanLightError
@ -68,22 +65,21 @@ DOC502_numpy.py:59:5: DOC502 Raised exception is not explicitly raised: `Divisio
|
57 | # DOC502
58 | def calculate_speed(distance: float, time: float) -> float:
59 | """
| _____^
59 | / """
60 | | Calculate speed as distance divided by time.
61 | |
61 | |
62 | | Parameters
63 | | ----------
64 | | distance : float
65 | | Distance traveled.
66 | | time : float
67 | | Time spent traveling.
68 | |
68 | |
69 | | Returns
70 | | -------
71 | | float
72 | | Speed as distance divided by time.
73 | |
73 | |
74 | | Raises
75 | | ------
76 | | FasterThanLightError

View File

@ -1,18 +1,16 @@
---
source: crates/ruff_linter/src/rules/pydoclint/mod.rs
snapshot_kind: text
---
DOC202_google.py:14:5: DOC202 Docstring should not have a returns section because the function doesn't return anything
|
12 | # DOC202
13 | def foo(num: int) -> str:
14 | """
| _____^
14 | / """
15 | | Do something
16 | |
16 | |
17 | | Args:
18 | | num (int): A number
19 | |
19 | |
20 | | Returns:
21 | | str: A string
22 | | """
@ -25,13 +23,12 @@ DOC202_google.py:30:9: DOC202 Docstring should not have a returns section becaus
|
28 | # DOC202
29 | def foo(self) -> str:
30 | """
| _________^
30 | / """
31 | | Do something
32 | |
32 | |
33 | | Args:
34 | | num (int): A number
35 | |
35 | |
36 | | Returns:
37 | | str: A string
38 | | """
@ -44,9 +41,8 @@ DOC202_google.py:80:5: DOC202 Docstring should not have a returns section becaus
|
78 | # DOC202 -- never explicitly returns anything, just short-circuits
79 | def foo(s: str, condition: bool):
80 | """Fooey things.
| _____^
81 | |
80 | / """Fooey things.
81 | |
82 | | Returns:
83 | | None
84 | | """

View File

@ -1,20 +1,18 @@
---
source: crates/ruff_linter/src/rules/pydoclint/mod.rs
snapshot_kind: text
---
DOC202_numpy.py:16:5: DOC202 Docstring should not have a returns section because the function doesn't return anything
|
14 | # DOC202
15 | def foo(num: int) -> str:
16 | """
| _____^
16 | / """
17 | | Do something
18 | |
18 | |
19 | | Parameters
20 | | ----------
21 | | num : int
22 | | A number
23 | |
23 | |
24 | | Returns
25 | | -------
26 | | str
@ -29,15 +27,14 @@ DOC202_numpy.py:36:9: DOC202 Docstring should not have a returns section because
|
34 | # DOC202
35 | def foo(self) -> str:
36 | """
| _________^
36 | / """
37 | | Do something
38 | |
38 | |
39 | | Parameters
40 | | ----------
41 | | num : int
42 | | A number
43 | |
43 | |
44 | | Returns
45 | | -------
46 | | str

View File

@ -1,18 +1,16 @@
---
source: crates/ruff_linter/src/rules/pydoclint/mod.rs
snapshot_kind: text
---
DOC403_google.py:14:5: DOC403 Docstring has a "Yields" section but the function doesn't yield anything
|
12 | # DOC403
13 | def foo(num: int) -> str:
14 | """
| _____^
14 | / """
15 | | Do something
16 | |
16 | |
17 | | Args:
18 | | num (int): A number
19 | |
19 | |
20 | | Yields:
21 | | str: A string
22 | | """
@ -25,13 +23,12 @@ DOC403_google.py:30:9: DOC403 Docstring has a "Yields" section but the function
|
28 | # DOC403
29 | def foo(self) -> str:
30 | """
| _________^
30 | / """
31 | | Do something
32 | |
32 | |
33 | | Args:
34 | | num (int): A number
35 | |
35 | |
36 | | Yields:
37 | | str: A string
38 | | """

View File

@ -1,20 +1,18 @@
---
source: crates/ruff_linter/src/rules/pydoclint/mod.rs
snapshot_kind: text
---
DOC403_numpy.py:16:5: DOC403 Docstring has a "Yields" section but the function doesn't yield anything
|
14 | # DOC403
15 | def foo(num: int) -> str:
16 | """
| _____^
16 | / """
17 | | Do something
18 | |
18 | |
19 | | Parameters
20 | | ----------
21 | | num : int
22 | | A number
23 | |
23 | |
24 | | Yields
25 | | -------
26 | | str
@ -29,15 +27,14 @@ DOC403_numpy.py:36:9: DOC403 Docstring has a "Yields" section but the function d
|
34 | # DOC403
35 | def foo(self) -> str:
36 | """
| _________^
36 | / """
37 | | Do something
38 | |
38 | |
39 | | Parameters
40 | | ----------
41 | | num : int
42 | | A number
43 | |
43 | |
44 | | Yields
45 | | -------
46 | | str

View File

@ -1,18 +1,16 @@
---
source: crates/ruff_linter/src/rules/pydoclint/mod.rs
snapshot_kind: text
---
DOC501_google.py:34:5: DOC501 Raised exception `FasterThanLightError` missing from docstring
|
32 | # DOC501
33 | def calculate_speed(distance: float, time: float) -> float:
34 | """Calculate speed as distance divided by time.
| _____^
35 | |
34 | / """Calculate speed as distance divided by time.
35 | |
36 | | Args:
37 | | distance: Distance traveled.
38 | | time: Time spent traveling.
39 | |
39 | |
40 | | Returns:
41 | | Speed as distance divided by time.
42 | | """
@ -26,13 +24,12 @@ DOC501_google.py:51:5: DOC501 Raised exception `ValueError` missing from docstri
|
49 | # DOC501
50 | def calculate_speed(distance: float, time: float) -> float:
51 | """Calculate speed as distance divided by time.
| _____^
52 | |
51 | / """Calculate speed as distance divided by time.
52 | |
53 | | Args:
54 | | distance: Distance traveled.
55 | | time: Time spent traveling.
56 | |
56 | |
57 | | Returns:
58 | | Speed as distance divided by time.
59 | | """
@ -46,13 +43,12 @@ DOC501_google.py:51:5: DOC501 Raised exception `FasterThanLightError` missing fr
|
49 | # DOC501
50 | def calculate_speed(distance: float, time: float) -> float:
51 | """Calculate speed as distance divided by time.
| _____^
52 | |
51 | / """Calculate speed as distance divided by time.
52 | |
53 | | Args:
54 | | distance: Distance traveled.
55 | | time: Time spent traveling.
56 | |
56 | |
57 | | Returns:
58 | | Speed as distance divided by time.
59 | | """
@ -66,13 +62,12 @@ DOC501_google.py:106:5: DOC501 Raised exception `AnotherError` missing from docs
|
104 | # DOC501
105 | def calculate_speed(distance: float, time: float) -> float:
106 | """Calculate speed as distance divided by time.
| _____^
107 | |
106 | / """Calculate speed as distance divided by time.
107 | |
108 | | Args:
109 | | distance: Distance traveled.
110 | | time: Time spent traveling.
111 | |
111 | |
112 | | Returns:
113 | | Speed as distance divided by time.
114 | | """
@ -85,13 +80,12 @@ DOC501_google.py:120:5: DOC501 Raised exception `AnotherError` missing from docs
|
118 | # DOC501
119 | def calculate_speed(distance: float, time: float) -> float:
120 | """Calculate speed as distance divided by time.
| _____^
121 | |
120 | / """Calculate speed as distance divided by time.
121 | |
122 | | Args:
123 | | distance: Distance traveled.
124 | | time: Time spent traveling.
125 | |
125 | |
126 | | Returns:
127 | | Speed as distance divided by time.
128 | | """
@ -104,9 +98,8 @@ DOC501_google.py:134:5: DOC501 Raised exception `SomeError` missing from docstri
|
132 | # DOC501
133 | def foo(bar: int):
134 | """Foo.
| _____^
135 | |
134 | / """Foo.
135 | |
136 | | Args:
137 | | bar: Bar.
138 | | """
@ -119,16 +112,15 @@ DOC501_google.py:197:5: DOC501 Raised exception `ZeroDivisionError` missing from
|
195 | # DOC501
196 | def calculate_speed(distance: float, time: float) -> float:
197 | """Calculate speed as distance divided by time.
| _____^
198 | |
197 | / """Calculate speed as distance divided by time.
198 | |
199 | | Args:
200 | | distance: Distance traveled.
201 | | time: Time spent traveling.
202 | |
202 | |
203 | | Returns:
204 | | Speed as distance divided by time.
205 | |
205 | |
206 | | Raises:
207 | | TypeError: if you didn't pass a number for both parameters
208 | | """
@ -141,9 +133,8 @@ DOC501_google.py:197:5: DOC501 Raised exception `ZeroDivisionError` missing from
DOC501_google.py:238:5: DOC501 Raised exception `TypeError` missing from docstring
|
237 | def foo():
238 | """Foo.
| _____^
239 | |
238 | / """Foo.
239 | |
240 | | Returns:
241 | | 42: int.
242 | | """
@ -156,9 +147,8 @@ DOC501_google.py:238:5: DOC501 Raised exception `TypeError` missing from docstri
DOC501_google.py:238:5: DOC501 Raised exception `ValueError` missing from docstring
|
237 | def foo():
238 | """Foo.
| _____^
239 | |
238 | / """Foo.
239 | |
240 | | Returns:
241 | | 42: int.
242 | | """

View File

@ -1,22 +1,20 @@
---
source: crates/ruff_linter/src/rules/pydoclint/mod.rs
snapshot_kind: text
---
DOC501_numpy.py:35:5: DOC501 Raised exception `FasterThanLightError` missing from docstring
|
33 | # DOC501
34 | def calculate_speed(distance: float, time: float) -> float:
35 | """
| _____^
35 | / """
36 | | Calculate speed as distance divided by time.
37 | |
37 | |
38 | | Parameters
39 | | ----------
40 | | distance : float
41 | | Distance traveled.
42 | | time : float
43 | | Time spent traveling.
44 | |
44 | |
45 | | Returns
46 | | -------
47 | | float
@ -32,17 +30,16 @@ DOC501_numpy.py:58:5: DOC501 Raised exception `ValueError` missing from docstrin
|
56 | # DOC501
57 | def calculate_speed(distance: float, time: float) -> float:
58 | """
| _____^
58 | / """
59 | | Calculate speed as distance divided by time.
60 | |
60 | |
61 | | Parameters
62 | | ----------
63 | | distance : float
64 | | Distance traveled.
65 | | time : float
66 | | Time spent traveling.
67 | |
67 | |
68 | | Returns
69 | | -------
70 | | float
@ -58,17 +55,16 @@ DOC501_numpy.py:58:5: DOC501 Raised exception `FasterThanLightError` missing fro
|
56 | # DOC501
57 | def calculate_speed(distance: float, time: float) -> float:
58 | """
| _____^
58 | / """
59 | | Calculate speed as distance divided by time.
60 | |
60 | |
61 | | Parameters
62 | | ----------
63 | | distance : float
64 | | Distance traveled.
65 | | time : float
66 | | Time spent traveling.
67 | |
67 | |
68 | | Returns
69 | | -------
70 | | float
@ -84,23 +80,22 @@ DOC501_numpy.py:83:5: DOC501 Raised exception `TypeError` missing from docstring
|
81 | # DOC501
82 | def calculate_speed(distance: float, time: float) -> float:
83 | """Calculate speed as distance divided by time.
| _____^
84 | |
83 | / """Calculate speed as distance divided by time.
84 | |
85 | | ACalculate speed as distance divided by time.
86 | |
86 | |
87 | | Parameters
88 | | ----------
89 | | distance : float
90 | | Distance traveled.
91 | | time : float
92 | | Time spent traveling.
93 | |
93 | |
94 | | Returns
95 | | -------
96 | | float
97 | | Speed as distance divided by time.
98 | |
98 | |
99 | | Raises
100 | | ------
101 | | ZeroDivisionError
@ -115,9 +110,8 @@ DOC501_numpy.py:83:5: DOC501 Raised exception `TypeError` missing from docstring
DOC501_numpy.py:139:5: DOC501 Raised exception `TypeError` missing from docstring
|
138 | def foo():
139 | """Foo.
| _____^
140 | |
139 | / """Foo.
140 | |
141 | | Returns
142 | | -------
143 | | int
@ -132,9 +126,8 @@ DOC501_numpy.py:139:5: DOC501 Raised exception `TypeError` missing from docstrin
DOC501_numpy.py:139:5: DOC501 Raised exception `ValueError` missing from docstring
|
138 | def foo():
139 | """Foo.
| _____^
140 | |
139 | / """Foo.
140 | |
141 | | Returns
142 | | -------
143 | | int

View File

@ -1,15 +1,13 @@
---
source: crates/ruff_linter/src/rules/pydoclint/mod.rs
snapshot_kind: text
---
DOC201_google.py:3:5: DOC201 `return` is not documented in docstring
|
1 | # DOC201
2 | def foo(num: int) -> str:
3 | """
| _____^
3 | / """
4 | | Do something
5 | |
5 | |
6 | | Args:
7 | | num (int): A number
8 | | """
@ -22,10 +20,9 @@ DOC201_google.py:44:9: DOC201 `return` is not documented in docstring
|
42 | # DOC201
43 | def bar(self) -> str:
44 | """
| _________^
44 | / """
45 | | Do something
46 | |
46 | |
47 | | Args:
48 | | num (int): A number
49 | | """
@ -58,9 +55,8 @@ DOC201_google.py:178:5: DOC201 `return` is not documented in docstring
|
176 | # DOC201 - non-early return explicit None
177 | def foo(x: int) -> int | None:
178 | """A very helpful docstring.
| _____^
179 | |
178 | / """A very helpful docstring.
179 | |
180 | | Args:
181 | | x (int): An integer.
182 | | """
@ -74,9 +70,8 @@ DOC201_google.py:191:5: DOC201 `return` is not documented in docstring
|
189 | # DOC201 - non-early return explicit None w/o useful type annotations
190 | def foo(x):
191 | """A very helpful docstring.
| _____^
192 | |
191 | / """A very helpful docstring.
192 | |
193 | | Args:
194 | | x (int): An integer.
195 | | """
@ -90,9 +85,8 @@ DOC201_google.py:204:5: DOC201 `return` is not documented in docstring
|
202 | # DOC201 - only returns None, but return annotation is not None
203 | def foo(s: str) -> str | None:
204 | """A very helpful docstring.
| _____^
205 | |
204 | / """A very helpful docstring.
205 | |
206 | | Args:
207 | | s (str): A string.
208 | | """

View File

@ -1,15 +1,13 @@
---
source: crates/ruff_linter/src/rules/pydoclint/mod.rs
snapshot_kind: text
---
DOC201_numpy.py:3:5: DOC201 `return` is not documented in docstring
|
1 | # DOC201
2 | def foo(num: int) -> str:
3 | """
| _____^
3 | / """
4 | | Do something
5 | |
5 | |
6 | | Parameters
7 | | ----------
8 | | num : int
@ -24,10 +22,9 @@ DOC201_numpy.py:54:9: DOC201 `return` is not documented in docstring
|
52 | # DOC201
53 | def bar(self) -> str:
54 | """
| _________^
54 | / """
55 | | Do something
56 | |
56 | |
57 | | Parameters
58 | | ----------
59 | | num : int
@ -52,9 +49,8 @@ DOC201_numpy.py:152:5: DOC201 `return` is not documented in docstring
|
150 | # DOC201 - non-early return explicit None
151 | def foo(x: int) -> int | None:
152 | """A very helpful docstring.
| _____^
153 | |
152 | / """A very helpful docstring.
153 | |
154 | | Parameters
155 | | ----------
156 | | x : int
@ -70,9 +66,8 @@ DOC201_numpy.py:167:5: DOC201 `return` is not documented in docstring
|
165 | # DOC201 - non-early return explicit None w/o useful type annotations
166 | def foo(x):
167 | """A very helpful docstring.
| _____^
168 | |
167 | / """A very helpful docstring.
168 | |
169 | | Parameters
170 | | ----------
171 | | x : int
@ -88,9 +83,8 @@ DOC201_numpy.py:182:5: DOC201 `return` is not documented in docstring
|
180 | # DOC201 - only returns None, but return annotation is not None
181 | def foo(s: str) -> str | None:
182 | """A very helpful docstring.
| _____^
183 | |
182 | / """A very helpful docstring.
183 | |
184 | | Parameters
185 | | ----------
186 | | x : str

View File

@ -1,15 +1,13 @@
---
source: crates/ruff_linter/src/rules/pydoclint/mod.rs
snapshot_kind: text
---
DOC402_google.py:3:5: DOC402 `yield` is not documented in docstring
|
1 | # DOC402
2 | def foo(num: int) -> str:
3 | """
| _____^
3 | / """
4 | | Do something
5 | |
5 | |
6 | | Args:
7 | | num (int): A number
8 | | """
@ -22,10 +20,9 @@ DOC402_google.py:44:9: DOC402 `yield` is not documented in docstring
|
42 | # DOC402
43 | def bar(self) -> str:
44 | """
| _________^
44 | / """
45 | | Do something
46 | |
46 | |
47 | | Args:
48 | | num (int): A number
49 | | """
@ -58,8 +55,7 @@ DOC402_google.py:97:5: DOC402 `yield` is not documented in docstring
|
95 | # DOC402
96 | def foo() -> collections.abc.Generator[int | None, None, None]:
97 | """
| _____^
97 | / """
98 | | Do something
99 | | """
| |_______^ DOC402
@ -71,8 +67,7 @@ DOC402_google.py:105:5: DOC402 `yield` is not documented in docstring
|
103 | # DOC402
104 | def bar() -> collections.abc.Iterator[int | None]:
105 | """
| _____^
105 | / """
106 | | Do something
107 | | """
| |_______^ DOC402

View File

@ -1,15 +1,13 @@
---
source: crates/ruff_linter/src/rules/pydoclint/mod.rs
snapshot_kind: text
---
DOC402_numpy.py:3:5: DOC402 `yield` is not documented in docstring
|
1 | # DOC402
2 | def foo(num: int) -> str:
3 | """
| _____^
3 | / """
4 | | Do something
5 | |
5 | |
6 | | Parameters
7 | | ----------
8 | | num : int
@ -24,10 +22,9 @@ DOC402_numpy.py:54:9: DOC402 `yield` is not documented in docstring
|
52 | # DOC402
53 | def bar(self) -> str:
54 | """
| _________^
54 | / """
55 | | Do something
56 | |
56 | |
57 | | Parameters
58 | | ----------
59 | | num : int
@ -42,8 +39,7 @@ DOC402_numpy.py:86:5: DOC402 `yield` is not documented in docstring
|
84 | # DOC402
85 | def foo() -> typing.Generator[int | None, None, None]:
86 | """
| _____^
86 | / """
87 | | Do something
88 | | """
| |_______^ DOC402
@ -56,8 +52,7 @@ DOC402_numpy.py:95:5: DOC402 `yield` is not documented in docstring
|
93 | # DOC402
94 | def foo() -> typing.Generator[int, None, None]:
95 | """
| _____^
95 | / """
96 | | Do something
97 | | """
| |_______^ DOC402
@ -69,8 +64,7 @@ DOC402_numpy.py:119:5: DOC402 `yield` is not documented in docstring
|
117 | # DOC402
118 | def foo():
119 | """
| _____^
119 | / """
120 | | Do something
121 | | """
| |_______^ DOC402
@ -83,8 +77,7 @@ DOC402_numpy.py:128:5: DOC402 `yield` is not documented in docstring
|
126 | # DOC402
127 | def foo():
128 | """
| _____^
128 | / """
129 | | Do something
130 | | """
| |_______^ DOC402
@ -97,8 +90,7 @@ DOC402_numpy.py:137:5: DOC402 `yield` is not documented in docstring
|
135 | # DOC402
136 | def bar() -> typing.Iterator[int | None]:
137 | """
| _____^
137 | / """
138 | | Do something
139 | | """
| |_______^ DOC402

View File

@ -1,13 +1,11 @@
---
source: crates/ruff_linter/src/rules/pydocstyle/mod.rs
snapshot_kind: text
---
D.py:129:5: D200 [*] One-line docstring should fit on one line
|
127 | @expect('D212: Multi-line docstring summary should start at the first line')
128 | def asdlkfasd():
129 | """
| _____^
129 | / """
130 | | Wrong.
131 | | """
| |_______^ D200
@ -30,9 +28,8 @@ D.py:597:5: D200 [*] One-line docstring should fit on one line
|
595 | @expect('D212: Multi-line docstring summary should start at the first line')
596 | def one_liner():
597 | """
| _____^
598 | |
597 | / """
598 | |
599 | | Wrong."""
| |_____________^ D200
|
@ -54,9 +51,8 @@ D.py:606:5: D200 [*] One-line docstring should fit on one line
|
604 | @expect('D212: Multi-line docstring summary should start at the first line')
605 | def one_liner():
606 | r"""Wrong.
| _____^
607 | |
606 | / r"""Wrong.
607 | |
608 | | """
| |_______^ D200
|
@ -78,9 +74,8 @@ D.py:615:5: D200 One-line docstring should fit on one line
|
613 | @expect('D212: Multi-line docstring summary should start at the first line')
614 | def one_liner():
615 | """Wrong."
| _____^
616 | |
615 | / """Wrong."
616 | |
617 | | """
| |_______^ D200
|
@ -90,9 +85,8 @@ D.py:624:5: D200 One-line docstring should fit on one line
|
622 | @expect('D212: Multi-line docstring summary should start at the first line')
623 | def one_liner():
624 | """
| _____^
625 | |
624 | / """
625 | |
626 | | "Wrong."""
| |______________^ D200
|
@ -101,11 +95,10 @@ D.py:624:5: D200 One-line docstring should fit on one line
D.py:645:5: D200 One-line docstring should fit on one line
|
644 | def single_line_docstring_with_an_escaped_backslash():
645 | "\
| _____^
645 | / "\
646 | | "
| |_____^ D200
647 |
647 |
648 | class StatementOnSameLineAsDocstring:
|
= help: Reformat to one line

View File

@ -1,12 +1,10 @@
---
source: crates/ruff_linter/src/rules/pydocstyle/mod.rs
snapshot_kind: text
---
D200.py:2:5: D200 One-line docstring should fit on one line
|
1 | def func():
2 | """\
| _____^
2 | / """\
3 | | """
| |_______^ D200
|
@ -15,8 +13,7 @@ D200.py:2:5: D200 One-line docstring should fit on one line
D200.py:7:5: D200 [*] One-line docstring should fit on one line
|
6 | def func():
7 | """\\
| _____^
7 | / """\\
8 | | """
| |_______^ D200
|
@ -36,8 +33,7 @@ D200.py:7:5: D200 [*] One-line docstring should fit on one line
D200.py:12:5: D200 One-line docstring should fit on one line
|
11 | def func():
12 | """\ \
| _____^
12 | / """\ \
13 | | """
| |_______^ D200
|

View File

@ -1,11 +1,10 @@
---
source: crates/ruff_linter/src/rules/pydocstyle/mod.rs
snapshot_kind: text
---
D.py:137:5: D201 [*] No blank lines allowed before function docstring (found 1)
|
135 | def leading_space():
136 |
136 |
137 | """Leading space."""
| ^^^^^^^^^^^^^^^^^^^^ D201
|
@ -23,10 +22,10 @@ D.py:137:5: D201 [*] No blank lines allowed before function docstring (found 1)
D.py:151:5: D201 [*] No blank lines allowed before function docstring (found 1)
|
149 | def trailing_and_leading_space():
150 |
150 |
151 | """Trailing and leading space."""
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ D201
152 |
152 |
153 | pass
|
= help: Remove blank line(s) before function docstring
@ -43,10 +42,9 @@ D.py:151:5: D201 [*] No blank lines allowed before function docstring (found 1)
D.py:546:5: D201 [*] No blank lines allowed before function docstring (found 1)
|
544 | def multiline_leading_space():
545 |
546 | """Leading space.
| _____^
547 | |
545 |
546 | / """Leading space.
547 | |
548 | | More content.
549 | | """
| |_______^ D201
@ -65,14 +63,13 @@ D.py:546:5: D201 [*] No blank lines allowed before function docstring (found 1)
D.py:568:5: D201 [*] No blank lines allowed before function docstring (found 1)
|
566 | def multiline_trailing_and_leading_space():
567 |
568 | """Trailing and leading space.
| _____^
569 | |
567 |
568 | / """Trailing and leading space.
569 | |
570 | | More content.
571 | | """
| |_______^ D201
572 |
572 |
573 | pass
|
= help: Remove blank line(s) before function docstring

View File

@ -1,6 +1,5 @@
---
source: crates/ruff_linter/src/rules/pydocstyle/mod.rs
snapshot_kind: text
---
D.py:142:5: D202 [*] No blank lines allowed after function docstring (found 1)
|
@ -8,7 +7,7 @@ D.py:142:5: D202 [*] No blank lines allowed after function docstring (found 1)
141 | def trailing_space():
142 | """Leading space."""
| ^^^^^^^^^^^^^^^^^^^^ D202
143 |
143 |
144 | pass
|
= help: Remove blank line(s) after function docstring
@ -25,10 +24,10 @@ D.py:142:5: D202 [*] No blank lines allowed after function docstring (found 1)
D.py:151:5: D202 [*] No blank lines allowed after function docstring (found 1)
|
149 | def trailing_and_leading_space():
150 |
150 |
151 | """Trailing and leading space."""
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ D202
152 |
152 |
153 | pass
|
= help: Remove blank line(s) after function docstring
@ -46,13 +45,12 @@ D.py:555:5: D202 [*] No blank lines allowed after function docstring (found 1)
|
553 | @expect('D213: Multi-line docstring summary should start at the second line')
554 | def multiline_trailing_space():
555 | """Leading space.
| _____^
556 | |
555 | / """Leading space.
556 | |
557 | | More content.
558 | | """
| |_______^ D202
559 |
559 |
560 | pass
|
= help: Remove blank line(s) after function docstring
@ -69,14 +67,13 @@ D.py:555:5: D202 [*] No blank lines allowed after function docstring (found 1)
D.py:568:5: D202 [*] No blank lines allowed after function docstring (found 1)
|
566 | def multiline_trailing_and_leading_space():
567 |
568 | """Trailing and leading space.
| _____^
569 | |
567 |
568 | / """Trailing and leading space.
569 | |
570 | | More content.
571 | | """
| |_______^ D202
572 |
572 |
573 | pass
|
= help: Remove blank line(s) after function docstring

View File

@ -1,6 +1,5 @@
---
source: crates/ruff_linter/src/rules/pydocstyle/mod.rs
snapshot_kind: text
---
D.py:161:5: D203 [*] 1 blank line required before class docstring
|
@ -41,16 +40,15 @@ D.py:526:5: D203 [*] 1 blank line required before class docstring
|
524 | # parameters as functions for Google / Numpy conventions.
525 | class Blah: # noqa: D203,D213
526 | """A Blah.
| _____^
527 | |
526 | / """A Blah.
527 | |
528 | | Parameters
529 | | ----------
530 | | x : int
531 | |
531 | |
532 | | """
| |_______^ D203
533 |
533 |
534 | def __init__(self, x):
|
= help: Insert 1 blank line before class docstring

View File

@ -1,15 +1,13 @@
---
source: crates/ruff_linter/src/rules/pydocstyle/mod.rs
snapshot_kind: text
---
D.py:200:5: D205 1 blank line required between summary line and description
|
198 | @expect('D213: Multi-line docstring summary should start at the second line')
199 | def multi_line_zero_separating_blanks():
200 | """Summary.
| _____^
200 | / """Summary.
201 | | Description.
202 | |
202 | |
203 | | """
| |_______^ D205
|
@ -19,12 +17,11 @@ D.py:210:5: D205 [*] 1 blank line required between summary line and description
|
208 | @expect('D213: Multi-line docstring summary should start at the second line')
209 | def multi_line_two_separating_blanks():
210 | """Summary.
| _____^
211 | |
212 | |
210 | / """Summary.
211 | |
212 | |
213 | | Description.
214 | |
214 | |
215 | | """
| |_______^ D205
|

View File

@ -1,14 +1,12 @@
---
source: crates/ruff_linter/src/rules/pydocstyle/mod.rs
snapshot_kind: text
---
D.py:281:5: D209 [*] Multi-line docstring closing quotes should be on a separate line
|
279 | @expect('D213: Multi-line docstring summary should start at the second line')
280 | def asdfljdf24():
281 | """Summary.
| _____^
282 | |
281 | / """Summary.
282 | |
283 | | Description."""
| |___________________^ D209
|
@ -29,9 +27,8 @@ D.py:588:5: D209 [*] Multi-line docstring closing quotes should be on a separate
|
586 | @expect('D213: Multi-line docstring summary should start at the second line')
587 | def asdfljdjgf24():
588 | """Summary.
| _____^
589 | |
588 | / """Summary.
589 | |
590 | | Description. """
| |_____________________^ D209
|

View File

@ -1,6 +1,5 @@
---
source: crates/ruff_linter/src/rules/pydocstyle/mod.rs
snapshot_kind: text
---
D.py:288:5: D210 [*] No whitespaces allowed surrounding docstring text
|
@ -44,9 +43,8 @@ D.py:299:5: D210 [*] No whitespaces allowed surrounding docstring text
|
297 | @expect('D213: Multi-line docstring summary should start at the second line')
298 | def multiline():
299 | """ Whitespace at the beginning.
| _____^
300 | |
299 | / """ Whitespace at the beginning.
300 | |
301 | | This is the end.
302 | | """
| |_______^ D210

View File

@ -1,13 +1,11 @@
---
source: crates/ruff_linter/src/rules/pydocstyle/mod.rs
snapshot_kind: text
---
D.py:129:5: D212 [*] Multi-line docstring summary should start at the first line
|
127 | @expect('D212: Multi-line docstring summary should start at the first line')
128 | def asdlkfasd():
129 | """
| _____^
129 | / """
130 | | Wrong.
131 | | """
| |_______^ D212
@ -29,9 +27,8 @@ D.py:597:5: D212 [*] Multi-line docstring summary should start at the first line
|
595 | @expect('D212: Multi-line docstring summary should start at the first line')
596 | def one_liner():
597 | """
| _____^
598 | |
597 | / """
598 | |
599 | | Wrong."""
| |_____________^ D212
|
@ -53,9 +50,8 @@ D.py:624:5: D212 [*] Multi-line docstring summary should start at the first line
|
622 | @expect('D212: Multi-line docstring summary should start at the first line')
623 | def one_liner():
624 | """
| _____^
625 | |
624 | / """
625 | |
626 | | "Wrong."""
| |______________^ D212
|

View File

@ -1,15 +1,13 @@
---
source: crates/ruff_linter/src/rules/pydocstyle/mod.rs
snapshot_kind: text
---
D.py:200:5: D213 [*] Multi-line docstring summary should start at the second line
|
198 | @expect('D213: Multi-line docstring summary should start at the second line')
199 | def multi_line_zero_separating_blanks():
200 | """Summary.
| _____^
200 | / """Summary.
201 | | Description.
202 | |
202 | |
203 | | """
| |_______^ D213
|
@ -30,12 +28,11 @@ D.py:210:5: D213 [*] Multi-line docstring summary should start at the second lin
|
208 | @expect('D213: Multi-line docstring summary should start at the second line')
209 | def multi_line_two_separating_blanks():
210 | """Summary.
| _____^
211 | |
212 | |
210 | / """Summary.
211 | |
212 | |
213 | | Description.
214 | |
214 | |
215 | | """
| |_______^ D213
|
@ -56,11 +53,10 @@ D.py:220:5: D213 [*] Multi-line docstring summary should start at the second lin
|
218 | @expect('D213: Multi-line docstring summary should start at the second line')
219 | def multi_line_one_separating_blanks():
220 | """Summary.
| _____^
221 | |
220 | / """Summary.
221 | |
222 | | Description.
223 | |
223 | |
224 | | """
| |_______^ D213
|
@ -81,11 +77,10 @@ D.py:230:5: D213 [*] Multi-line docstring summary should start at the second lin
|
228 | @expect('D213: Multi-line docstring summary should start at the second line')
229 | def asdfsdf():
230 | """Summary.
| _____^
231 | |
230 | / """Summary.
231 | |
232 | | Description.
233 | |
233 | |
234 | | """
| |_______^ D213
|
@ -106,11 +101,10 @@ D.py:240:5: D213 [*] Multi-line docstring summary should start at the second lin
|
238 | @expect('D213: Multi-line docstring summary should start at the second line')
239 | def asdsdfsdffsdf():
240 | """Summary.
| _____^
241 | |
240 | / """Summary.
241 | |
242 | | Description.
243 | |
243 | |
244 | | """
| |___^ D213
|
@ -131,11 +125,10 @@ D.py:250:5: D213 [*] Multi-line docstring summary should start at the second lin
|
248 | @expect('D213: Multi-line docstring summary should start at the second line')
249 | def asdfsdsdf24():
250 | """Summary.
| _____^
251 | |
250 | / """Summary.
251 | |
252 | | Description.
253 | |
253 | |
254 | | """
| |_______^ D213
|
@ -156,11 +149,10 @@ D.py:260:5: D213 [*] Multi-line docstring summary should start at the second lin
|
258 | @expect('D213: Multi-line docstring summary should start at the second line')
259 | def asdfsdsdfsdf24():
260 | """Summary.
| _____^
261 | |
260 | / """Summary.
261 | |
262 | | Description.
263 | |
263 | |
264 | | """
| |___________^ D213
|
@ -181,11 +173,10 @@ D.py:270:5: D213 [*] Multi-line docstring summary should start at the second lin
|
268 | @expect('D213: Multi-line docstring summary should start at the second line')
269 | def asdfsdfsdsdsdfsdf24():
270 | """Summary.
| _____^
271 | |
270 | / """Summary.
271 | |
272 | | Description.
273 | |
273 | |
274 | | """
| |_______^ D213
|
@ -206,9 +197,8 @@ D.py:281:5: D213 [*] Multi-line docstring summary should start at the second lin
|
279 | @expect('D213: Multi-line docstring summary should start at the second line')
280 | def asdfljdf24():
281 | """Summary.
| _____^
282 | |
281 | / """Summary.
282 | |
283 | | Description."""
| |___________________^ D213
|
@ -229,9 +219,8 @@ D.py:299:5: D213 [*] Multi-line docstring summary should start at the second lin
|
297 | @expect('D213: Multi-line docstring summary should start at the second line')
298 | def multiline():
299 | """ Whitespace at the beginning.
| _____^
300 | |
299 | / """ Whitespace at the beginning.
300 | |
301 | | This is the end.
302 | | """
| |_______^ D213
@ -253,9 +242,8 @@ D.py:343:5: D213 [*] Multi-line docstring summary should start at the second lin
|
341 | @expect('D213: Multi-line docstring summary should start at the second line')
342 | def exceptions_of_D301():
343 | """Exclude some backslashes from D301.
| _____^
344 | |
343 | / """Exclude some backslashes from D301.
344 | |
345 | | In particular, line continuations \
346 | | and unicode literals \u0394 and \N{GREEK CAPITAL LETTER DELTA}.
347 | | They are considered to be intentionally unescaped.
@ -279,9 +267,8 @@ D.py:383:5: D213 [*] Multi-line docstring summary should start at the second lin
|
381 | @expect('D213: Multi-line docstring summary should start at the second line')
382 | def new_209():
383 | """First line.
| _____^
384 | |
383 | / """First line.
384 | |
385 | | More lines.
386 | | """
| |_______^ D213
@ -304,11 +291,10 @@ D.py:392:5: D213 [*] Multi-line docstring summary should start at the second lin
|
390 | @expect('D213: Multi-line docstring summary should start at the second line')
391 | def old_209():
392 | """One liner.
| _____^
393 | |
392 | / """One liner.
393 | |
394 | | Multi-line comments. OK to have extra blank line
395 | |
395 | |
396 | | """
| |_______^ D213
|
@ -331,7 +317,7 @@ D.py:438:37: D213 [*] Multi-line docstring summary should start at the second li
437 | @expect('D213: Multi-line docstring summary should start at the second line')
438 | def docstring_start_in_same_line(): """First Line.
| _____________________________________^
439 | |
439 | |
440 | | Second Line
441 | | """
| |_______^ D213
@ -353,11 +339,10 @@ D.py:450:5: D213 [*] Multi-line docstring summary should start at the second lin
|
448 | @expect('D213: Multi-line docstring summary should start at the second line')
449 | def a_following_valid_function(x=None):
450 | """Check for a bug where the previous function caused an assertion.
| _____^
451 | |
450 | / """Check for a bug where the previous function caused an assertion.
451 | |
452 | | The assertion was caused in the next function, so this one is necessary.
453 | |
453 | |
454 | | """
| |_______^ D213
|
@ -378,16 +363,15 @@ D.py:526:5: D213 [*] Multi-line docstring summary should start at the second lin
|
524 | # parameters as functions for Google / Numpy conventions.
525 | class Blah: # noqa: D203,D213
526 | """A Blah.
| _____^
527 | |
526 | / """A Blah.
527 | |
528 | | Parameters
529 | | ----------
530 | | x : int
531 | |
531 | |
532 | | """
| |_______^ D213
533 |
533 |
534 | def __init__(self, x):
|
= help: Insert line break and indentation after opening quotes
@ -406,10 +390,9 @@ D.py:526:5: D213 [*] Multi-line docstring summary should start at the second lin
D.py:546:5: D213 [*] Multi-line docstring summary should start at the second line
|
544 | def multiline_leading_space():
545 |
546 | """Leading space.
| _____^
547 | |
545 |
546 | / """Leading space.
547 | |
548 | | More content.
549 | | """
| |_______^ D213
@ -431,13 +414,12 @@ D.py:555:5: D213 [*] Multi-line docstring summary should start at the second lin
|
553 | @expect('D213: Multi-line docstring summary should start at the second line')
554 | def multiline_trailing_space():
555 | """Leading space.
| _____^
556 | |
555 | / """Leading space.
556 | |
557 | | More content.
558 | | """
| |_______^ D213
559 |
559 |
560 | pass
|
= help: Insert line break and indentation after opening quotes
@ -456,14 +438,13 @@ D.py:555:5: D213 [*] Multi-line docstring summary should start at the second lin
D.py:568:5: D213 [*] Multi-line docstring summary should start at the second line
|
566 | def multiline_trailing_and_leading_space():
567 |
568 | """Trailing and leading space.
| _____^
569 | |
567 |
568 | / """Trailing and leading space.
569 | |
570 | | More content.
571 | | """
| |_______^ D213
572 |
572 |
573 | pass
|
= help: Insert line break and indentation after opening quotes
@ -483,9 +464,8 @@ D.py:588:5: D213 [*] Multi-line docstring summary should start at the second lin
|
586 | @expect('D213: Multi-line docstring summary should start at the second line')
587 | def asdfljdjgf24():
588 | """Summary.
| _____^
589 | |
588 | / """Summary.
589 | |
590 | | Description. """
| |_____________________^ D213
|
@ -506,9 +486,8 @@ D.py:606:5: D213 [*] Multi-line docstring summary should start at the second lin
|
604 | @expect('D212: Multi-line docstring summary should start at the first line')
605 | def one_liner():
606 | r"""Wrong.
| _____^
607 | |
606 | / r"""Wrong.
607 | |
608 | | """
| |_______^ D213
|
@ -529,9 +508,8 @@ D.py:615:5: D213 [*] Multi-line docstring summary should start at the second lin
|
613 | @expect('D212: Multi-line docstring summary should start at the first line')
614 | def one_liner():
615 | """Wrong."
| _____^
616 | |
615 | / """Wrong."
616 | |
617 | | """
| |_______^ D213
|
@ -551,9 +529,8 @@ D.py:615:5: D213 [*] Multi-line docstring summary should start at the second lin
D.py:671:5: D213 [*] Multi-line docstring summary should start at the second line
|
670 | def retain_extra_whitespace():
671 | """Summary.
| _____^
672 | |
671 | / """Summary.
672 | |
673 | | This is overindented
674 | | And so is this, but it we should preserve the extra space on this line relative
675 | | to the one before
@ -576,9 +553,8 @@ D.py:671:5: D213 [*] Multi-line docstring summary should start at the second lin
D.py:680:5: D213 [*] Multi-line docstring summary should start at the second line
|
679 | def retain_extra_whitespace_multiple():
680 | """Summary.
| _____^
681 | |
680 | / """Summary.
681 | |
682 | | This is overindented
683 | | And so is this, but it we should preserve the extra space on this line relative
684 | | to the one before
@ -604,16 +580,15 @@ D.py:680:5: D213 [*] Multi-line docstring summary should start at the second lin
D.py:693:5: D213 [*] Multi-line docstring summary should start at the second line
|
692 | def retain_extra_whitespace_deeper():
693 | """Summary.
| _____^
694 | |
693 | / """Summary.
694 | |
695 | | This is overindented
696 | | And so is this, but it we should preserve the extra space on this line relative
697 | | to the one before
698 | | And the relative indent here should be preserved too
699 | | """
| |_______^ D213
700 |
700 |
701 | def retain_extra_whitespace_followed_by_same_offset():
|
= help: Insert line break and indentation after opening quotes
@ -632,9 +607,8 @@ D.py:693:5: D213 [*] Multi-line docstring summary should start at the second lin
D.py:702:5: D213 [*] Multi-line docstring summary should start at the second line
|
701 | def retain_extra_whitespace_followed_by_same_offset():
702 | """Summary.
| _____^
703 | |
702 | / """Summary.
703 | |
704 | | This is overindented
705 | | And so is this, but it we should preserve the extra space on this line relative
706 | | This is overindented
@ -658,9 +632,8 @@ D.py:702:5: D213 [*] Multi-line docstring summary should start at the second lin
D.py:712:5: D213 [*] Multi-line docstring summary should start at the second line
|
711 | def retain_extra_whitespace_not_overindented():
712 | """Summary.
| _____^
713 | |
712 | / """Summary.
713 | |
714 | | This is not overindented
715 | | This is overindented, but since one line is not overindented this should not raise
716 | | And so is this, but it we should preserve the extra space on this line relative
@ -683,9 +656,8 @@ D.py:712:5: D213 [*] Multi-line docstring summary should start at the second lin
D.py:721:5: D213 [*] Multi-line docstring summary should start at the second line
|
720 | def inconsistent_indent_byte_size():
721 | """There's a non-breaking space (2-bytes) after 3 spaces (https://github.com/astral-sh/ruff/issues/9080).
| _____^
722 | |
721 | / """There's a non-breaking space (2-bytes) after 3 spaces (https://github.com/astral-sh/ruff/issues/9080).
722 | |
723 | |     Returns:
724 | | """
| |_______^ D213

View File

@ -1,6 +1,5 @@
---
source: crates/ruff_linter/src/rules/pydocstyle/mod.rs
snapshot_kind: text
---
D.py:307:5: D300 [*] Use triple double quotes `"""`
|
@ -100,11 +99,10 @@ D.py:328:5: D300 [*] Use triple double quotes `"""`
D.py:645:5: D300 [*] Use triple double quotes `"""`
|
644 | def single_line_docstring_with_an_escaped_backslash():
645 | "\
| _____^
645 | / "\
646 | | "
| |_____^ D300
647 |
647 |
648 | class StatementOnSameLineAsDocstring:
|
= help: Convert to triple double quotes
@ -182,8 +180,7 @@ D.py:658:5: D300 [*] Use triple double quotes `"""`
D.py:664:5: D300 [*] Use triple double quotes `"""`
|
663 | def newline_after_closing_quote(self):
664 | "We enforce a newline after the closing quote for a multi-line docstring \
| _____^
664 | / "We enforce a newline after the closing quote for a multi-line docstring \
665 | | but continuations shouldn't be considered multi-line"
| |_________________________________________________________^ D300
|

View File

@ -1,6 +1,5 @@
---
source: crates/ruff_linter/src/rules/pydocstyle/mod.rs
snapshot_kind: text
---
D301.py:2:5: D301 [*] Use `r"""` if any backslashes in a docstring
|
@ -29,8 +28,7 @@ D301.py:37:5: D301 Use `r"""` if any backslashes in a docstring
D301.py:93:5: D301 [*] Use `r"""` if any backslashes in a docstring
|
92 | def should_add_raw_for_single_double_quote_escape():
93 | """
| _____^
93 | / """
94 | | This is single quote escape \".
95 | | """
| |_______^ D301
@ -50,8 +48,7 @@ D301.py:93:5: D301 [*] Use `r"""` if any backslashes in a docstring
D301.py:99:5: D301 [*] Use `r"""` if any backslashes in a docstring
|
98 | def should_add_raw_for_single_single_quote_escape():
99 | '''
| _____^
99 | / '''
100 | | This is single quote escape \'.
101 | | '''
| |_______^ D301

View File

@ -1,6 +1,5 @@
---
source: crates/ruff_linter/src/rules/pydocstyle/mod.rs
snapshot_kind: text
---
D.py:355:5: D400 [*] First line should end with a period
|
@ -245,9 +244,8 @@ D.py:615:5: D400 [*] First line should end with a period
|
613 | @expect('D212: Multi-line docstring summary should start at the first line')
614 | def one_liner():
615 | """Wrong."
| _____^
616 | |
615 | / """Wrong."
616 | |
617 | | """
| |_______^ D400
|
@ -267,7 +265,7 @@ D.py:639:17: D400 [*] First line should end with a period
|
639 | class SameLine: """This is a docstring on the same line"""
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ D400
640 |
640 |
641 | def same_line(): """This is a docstring on the same line"""
|
= help: Add period
@ -285,7 +283,7 @@ D.py:639:17: D400 [*] First line should end with a period
D.py:641:18: D400 [*] First line should end with a period
|
639 | class SameLine: """This is a docstring on the same line"""
640 |
640 |
641 | def same_line(): """This is a docstring on the same line"""
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ D400
|
@ -304,8 +302,7 @@ D.py:641:18: D400 [*] First line should end with a period
D.py:664:5: D400 [*] First line should end with a period
|
663 | def newline_after_closing_quote(self):
664 | "We enforce a newline after the closing quote for a multi-line docstring \
| _____^
664 | / "We enforce a newline after the closing quote for a multi-line docstring \
665 | | but continuations shouldn't be considered multi-line"
| |_________________________________________________________^ D400
|

View File

@ -1,6 +1,5 @@
---
source: crates/ruff_linter/src/rules/pydocstyle/mod.rs
snapshot_kind: text
---
D400.py:2:5: D400 [*] First line should end with a period
|
@ -41,8 +40,7 @@ D400.py:7:5: D400 [*] First line should end with a period
D400.py:12:5: D400 [*] First line should end with a period
|
11 | def f():
12 | """
| _____^
12 | / """
13 | | Here's a line without a period,
14 | | but here's the next line
15 | | """
@ -83,8 +81,7 @@ D400.py:20:5: D400 [*] First line should end with a period
D400.py:25:5: D400 [*] First line should end with a period
|
24 | def f():
25 | """
| _____^
25 | / """
26 | | Here's a line without a period,
27 | | but here's the next line"""
| |_______________________________^ D400
@ -105,8 +102,7 @@ D400.py:25:5: D400 [*] First line should end with a period
D400.py:32:5: D400 [*] First line should end with a period
|
31 | def f():
32 | """
| _____^
32 | / """
33 | | Here's a line without a period,
34 | | but here's the next line with trailing space """
| |____________________________________________________^ D400
@ -165,8 +161,7 @@ D400.py:44:5: D400 [*] First line should end with a period
D400.py:49:5: D400 [*] First line should end with a period
|
48 | def f():
49 | r"""
| _____^
49 | / r"""
50 | | Here's a line without a period,
51 | | but here's the next line
52 | | """
@ -207,8 +202,7 @@ D400.py:57:5: D400 [*] First line should end with a period
D400.py:62:5: D400 [*] First line should end with a period
|
61 | def f():
62 | r"""
| _____^
62 | / r"""
63 | | Here's a line without a period,
64 | | but here's the next line"""
| |_______________________________^ D400
@ -229,8 +223,7 @@ D400.py:62:5: D400 [*] First line should end with a period
D400.py:69:5: D400 [*] First line should end with a period
|
68 | def f():
69 | r"""
| _____^
69 | / r"""
70 | | Here's a line without a period,
71 | | but here's the next line with trailing space """
| |____________________________________________________^ D400
@ -251,11 +244,10 @@ D400.py:69:5: D400 [*] First line should end with a period
D400.py:97:5: D400 [*] First line should end with a period
|
96 | def f():
97 | """
| _____^
97 | / """
98 | | My example
99 | | ==========
100 | |
100 | |
101 | | My example explanation
102 | | """
| |_______^ D400

View File

@ -1,6 +1,5 @@
---
source: crates/ruff_linter/src/rules/pydocstyle/mod.rs
snapshot_kind: text
---
D401.py:10:5: D401 First line of docstring should be in imperative mood: "Returns foo."
|
@ -19,11 +18,10 @@ D401.py:14:5: D401 First line of docstring should be in imperative mood: "Constr
D401.py:18:5: D401 First line of docstring should be in imperative mood: "Constructor for a boa."
|
17 | def bad_sdgfsdg23245777():
18 | """
| _____^
19 | |
18 | / """
19 | |
20 | | Constructor for a boa.
21 | |
21 | |
22 | | """
| |_______^ D401
|
@ -33,7 +31,7 @@ D401.py:26:5: D401 First line of docstring should be in imperative mood: "Runs s
25 | def bad_run_something():
26 | """Runs something"""
| ^^^^^^^^^^^^^^^^^^^^ D401
27 |
27 |
28 | def bad_nested():
|
@ -42,15 +40,14 @@ D401.py:29:9: D401 First line of docstring should be in imperative mood: "Runs o
28 | def bad_nested():
29 | """Runs other things, nested"""
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ D401
30 |
30 |
31 | bad_nested()
|
D401.py:35:5: D401 First line of docstring should be in imperative mood: "Writes a logical line that"
|
34 | def multi_line():
35 | """Writes a logical line that
| _____^
35 | / """Writes a logical line that
36 | | extends to two physical lines.
37 | | """
| |_______^ D401
@ -61,6 +58,6 @@ D401.py:74:9: D401 First line of docstring should be in imperative mood: "This m
73 | def bad_method(self):
74 | """This method docstring should be written in imperative mood."""
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ D401
75 |
75 |
76 | @property
|

View File

@ -1,13 +1,12 @@
---
source: crates/ruff_linter/src/rules/pydocstyle/mod.rs
snapshot_kind: text
---
D403.py:2:5: D403 [*] First word of the docstring should be capitalized: `this` -> `This`
|
1 | def bad_function():
2 | """this docstring is not capitalized"""
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ D403
3 |
3 |
4 | def good_function():
|
= help: Capitalize `this` to `This`
@ -25,7 +24,7 @@ D403.py:30:5: D403 [*] First word of the docstring should be capitalized: `singl
29 | def single_word():
30 | """singleword."""
| ^^^^^^^^^^^^^^^^^ D403
31 |
31 |
32 | def single_word_no_dot():
|
= help: Capitalize `singleword` to `Singleword`
@ -45,7 +44,7 @@ D403.py:33:5: D403 [*] First word of the docstring should be capitalized: `singl
32 | def single_word_no_dot():
33 | """singleword"""
| ^^^^^^^^^^^^^^^^ D403
34 |
34 |
35 | def first_word_lots_of_whitespace():
|
= help: Capitalize `singleword` to `Singleword`
@ -63,17 +62,16 @@ D403.py:33:5: D403 [*] First word of the docstring should be capitalized: `singl
D403.py:36:5: D403 [*] First word of the docstring should be capitalized: `here` -> `Here`
|
35 | def first_word_lots_of_whitespace():
36 | """
| _____^
37 | |
38 | |
39 | |
36 | / """
37 | |
38 | |
39 | |
40 | | here is the start of my docstring!
41 | |
41 | |
42 | | What do you think?
43 | | """
| |_______^ D403
44 |
44 |
45 | def single_word_newline():
|
= help: Capitalize `here` to `Here`
@ -91,12 +89,11 @@ D403.py:36:5: D403 [*] First word of the docstring should be capitalized: `here`
D403.py:46:5: D403 [*] First word of the docstring should be capitalized: `singleword` -> `Singleword`
|
45 | def single_word_newline():
46 | """singleword
| _____^
47 | |
46 | / """singleword
47 | |
48 | | """
| |_______^ D403
49 |
49 |
50 | def single_word_dot_newline():
|
= help: Capitalize `singleword` to `Singleword`
@ -114,12 +111,11 @@ D403.py:46:5: D403 [*] First word of the docstring should be capitalized: `singl
D403.py:51:5: D403 [*] First word of the docstring should be capitalized: `singleword` -> `Singleword`
|
50 | def single_word_dot_newline():
51 | """singleword.
| _____^
52 | |
51 | / """singleword.
52 | |
53 | | """
| |_______^ D403
54 |
54 |
55 | def single_word_second_line():
|
= help: Capitalize `singleword` to `Singleword`
@ -137,12 +133,11 @@ D403.py:51:5: D403 [*] First word of the docstring should be capitalized: `singl
D403.py:56:5: D403 [*] First word of the docstring should be capitalized: `singleword` -> `Singleword`
|
55 | def single_word_second_line():
56 | """
| _____^
56 | / """
57 | | singleword
58 | | """
| |_______^ D403
59 |
59 |
60 | def single_word_dot_second_line():
|
= help: Capitalize `singleword` to `Singleword`
@ -160,12 +155,11 @@ D403.py:56:5: D403 [*] First word of the docstring should be capitalized: `singl
D403.py:61:5: D403 [*] First word of the docstring should be capitalized: `singleword` -> `Singleword`
|
60 | def single_word_dot_second_line():
61 | """
| _____^
61 | / """
62 | | singleword.
63 | | """
| |_______^ D403
64 |
64 |
65 | def single_word_then_more_text():
|
= help: Capitalize `singleword` to `Singleword`
@ -183,13 +177,12 @@ D403.py:61:5: D403 [*] First word of the docstring should be capitalized: `singl
D403.py:66:5: D403 [*] First word of the docstring should be capitalized: `singleword` -> `Singleword`
|
65 | def single_word_then_more_text():
66 | """singleword
| _____^
67 | |
66 | / """singleword
67 | |
68 | | This is more text.
69 | | """
| |_______^ D403
70 |
70 |
71 | def single_word_dot_then_more_text():
|
= help: Capitalize `singleword` to `Singleword`
@ -207,13 +200,12 @@ D403.py:66:5: D403 [*] First word of the docstring should be capitalized: `singl
D403.py:72:5: D403 [*] First word of the docstring should be capitalized: `singleword` -> `Singleword`
|
71 | def single_word_dot_then_more_text():
72 | """singleword.
| _____^
73 | |
72 | / """singleword.
73 | |
74 | | This is more text.
75 | | """
| |_______^ D403
76 |
76 |
77 | def single_word_second_line_then_more_text():
|
= help: Capitalize `singleword` to `Singleword`
@ -231,14 +223,13 @@ D403.py:72:5: D403 [*] First word of the docstring should be capitalized: `singl
D403.py:78:5: D403 [*] First word of the docstring should be capitalized: `singleword` -> `Singleword`
|
77 | def single_word_second_line_then_more_text():
78 | """
| _____^
78 | / """
79 | | singleword
80 | |
80 | |
81 | | This is more text.
82 | | """
| |_______^ D403
83 |
83 |
84 | def single_word_dot_second_line_then_more_text():
|
= help: Capitalize `singleword` to `Singleword`
@ -256,10 +247,9 @@ D403.py:78:5: D403 [*] First word of the docstring should be capitalized: `singl
D403.py:85:5: D403 [*] First word of the docstring should be capitalized: `singleword` -> `Singleword`
|
84 | def single_word_dot_second_line_then_more_text():
85 | """
| _____^
85 | / """
86 | | singleword.
87 | |
87 | |
88 | | This is more text.
89 | | """
| |_______^ D403

View File

@ -1,6 +1,5 @@
---
source: crates/ruff_linter/src/rules/pydocstyle/mod.rs
snapshot_kind: text
---
D.py:355:5: D415 [*] First line should end with a period, question mark, or exclamation point
|
@ -237,9 +236,8 @@ D.py:615:5: D415 [*] First line should end with a period, question mark, or excl
|
613 | @expect('D212: Multi-line docstring summary should start at the first line')
614 | def one_liner():
615 | """Wrong."
| _____^
616 | |
615 | / """Wrong."
616 | |
617 | | """
| |_______^ D415
|
@ -259,7 +257,7 @@ D.py:639:17: D415 [*] First line should end with a period, question mark, or exc
|
639 | class SameLine: """This is a docstring on the same line"""
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ D415
640 |
640 |
641 | def same_line(): """This is a docstring on the same line"""
|
= help: Add closing punctuation
@ -277,7 +275,7 @@ D.py:639:17: D415 [*] First line should end with a period, question mark, or exc
D.py:641:18: D415 [*] First line should end with a period, question mark, or exclamation point
|
639 | class SameLine: """This is a docstring on the same line"""
640 |
640 |
641 | def same_line(): """This is a docstring on the same line"""
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ D415
|
@ -296,8 +294,7 @@ D.py:641:18: D415 [*] First line should end with a period, question mark, or exc
D.py:664:5: D415 [*] First line should end with a period, question mark, or exclamation point
|
663 | def newline_after_closing_quote(self):
664 | "We enforce a newline after the closing quote for a multi-line docstring \
| _____^
664 | / "We enforce a newline after the closing quote for a multi-line docstring \
665 | | but continuations shouldn't be considered multi-line"
| |_________________________________________________________^ D415
|

View File

@ -1,12 +1,10 @@
---
source: crates/ruff_linter/src/rules/pydocstyle/mod.rs
snapshot_kind: text
---
D209_D400.py:2:5: D209 [*] Multi-line docstring closing quotes should be on a separate line
|
1 | def lorem():
2 | """lorem ipsum dolor sit amet consectetur adipiscing elit
| _____^
2 | / """lorem ipsum dolor sit amet consectetur adipiscing elit
3 | | sed do eiusmod tempor incididunt ut labore et dolore magna aliqua"""
| |________________________________________________________________________^ D209
|
@ -22,8 +20,7 @@ D209_D400.py:2:5: D209 [*] Multi-line docstring closing quotes should be on a se
D209_D400.py:2:5: D400 [*] First line should end with a period
|
1 | def lorem():
2 | """lorem ipsum dolor sit amet consectetur adipiscing elit
| _____^
2 | / """lorem ipsum dolor sit amet consectetur adipiscing elit
3 | | sed do eiusmod tempor incididunt ut labore et dolore magna aliqua"""
| |________________________________________________________________________^ D400
|

View File

@ -1,6 +1,5 @@
---
source: crates/ruff_linter/src/rules/pylint/mod.rs
snapshot_kind: text
---
await_outside_async.py:15:11: PLE1142 `await` should be used within an async function
|
@ -20,8 +19,7 @@ await_outside_async.py:29:9: PLE1142 `await` should be used within an async func
await_outside_async.py:38:5: PLE1142 `await` should be used within an async function
|
37 | def async_for_loop():
38 | async for x in foo():
| _____^
38 | / async for x in foo():
39 | | pass
| |____________^ PLE1142
|
@ -29,8 +27,7 @@ await_outside_async.py:38:5: PLE1142 `await` should be used within an async func
await_outside_async.py:43:5: PLE1142 `await` should be used within an async function
|
42 | def async_with():
43 | async with foo():
| _____^
43 | / async with foo():
44 | | pass
| |____________^ PLE1142
|

View File

@ -1,13 +1,12 @@
---
source: crates/ruff_linter/src/rules/pylint/mod.rs
snapshot_kind: text
---
bad_str_strip_call.py:2:21: PLE1310 String `strip` call contains duplicate characters
|
1 | # PLE1310
2 | "Hello World".strip("Hello")
| ^^^^^^^ PLE1310
3 |
3 |
4 | # PLE1310
|
@ -16,7 +15,7 @@ bad_str_strip_call.py:5:21: PLE1310 String `strip` call contains duplicate chara
4 | # PLE1310
5 | "Hello World".strip("Hello")
| ^^^^^^^ PLE1310
6 |
6 |
7 | # PLE1310
|
@ -25,7 +24,7 @@ bad_str_strip_call.py:8:21: PLE1310 String `strip` call contains duplicate chara
7 | # PLE1310
8 | "Hello World".strip(u"Hello")
| ^^^^^^^^ PLE1310
9 |
9 |
10 | # PLE1310
|
@ -34,7 +33,7 @@ bad_str_strip_call.py:11:21: PLE1310 String `strip` call contains duplicate char
10 | # PLE1310
11 | "Hello World".strip(r"Hello")
| ^^^^^^^^ PLE1310
12 |
12 |
13 | # PLE1310
|
@ -43,7 +42,7 @@ bad_str_strip_call.py:14:21: PLE1310 String `strip` call contains duplicate char
13 | # PLE1310
14 | "Hello World".strip("Hello\t")
| ^^^^^^^^^ PLE1310
15 |
15 |
16 | # PLE1310
|
@ -52,7 +51,7 @@ bad_str_strip_call.py:17:21: PLE1310 String `strip` call contains duplicate char
16 | # PLE1310
17 | "Hello World".strip(r"Hello\t")
| ^^^^^^^^^^ PLE1310
18 |
18 |
19 | # PLE1310
|
@ -61,7 +60,7 @@ bad_str_strip_call.py:20:21: PLE1310 String `strip` call contains duplicate char
19 | # PLE1310
20 | "Hello World".strip("Hello\\")
| ^^^^^^^^^ PLE1310
21 |
21 |
22 | # PLE1310
|
@ -70,7 +69,7 @@ bad_str_strip_call.py:23:21: PLE1310 String `strip` call contains duplicate char
22 | # PLE1310
23 | "Hello World".strip(r"Hello\\")
| ^^^^^^^^^^ PLE1310
24 |
24 |
25 | # PLE1310
|
@ -79,7 +78,7 @@ bad_str_strip_call.py:26:21: PLE1310 String `strip` call contains duplicate char
25 | # PLE1310
26 | "Hello World".strip("🤣🤣🤣🤣🙃👀😀")
| ^^^^^^^^^^^^^^^^ PLE1310
27 |
27 |
28 | # PLE1310
|
@ -87,8 +86,7 @@ bad_str_strip_call.py:30:5: PLE1310 String `strip` call contains duplicate chara
|
28 | # PLE1310
29 | "Hello World".strip(
30 | """
| _____^
30 | / """
31 | | there are a lot of characters to strip
32 | | """
| |___^ PLE1310
@ -103,7 +101,7 @@ bad_str_strip_call.py:36:21: PLE1310 String `strip` call contains duplicate char
37 | | "string of characters to strip " \
38 | | "please?")
| |_____________________________^ PLE1310
39 |
39 |
40 | # PLE1310
|
@ -111,8 +109,7 @@ bad_str_strip_call.py:42:5: PLE1310 String `strip` call contains duplicate chara
|
40 | # PLE1310
41 | "Hello World".strip(
42 | "can we get a long "
| _____^
42 | / "can we get a long "
43 | | "string of characters to strip "
44 | | "please?"
| |_____________^ PLE1310
@ -123,8 +120,7 @@ bad_str_strip_call.py:49:5: PLE1310 String `strip` call contains duplicate chara
|
47 | # PLE1310
48 | "Hello World".strip(
49 | "can \t we get a long"
| _____^
49 | / "can \t we get a long"
50 | | "string \t of characters to strip"
51 | | "please?"
| |_____________^ PLE1310
@ -136,7 +132,7 @@ bad_str_strip_call.py:61:11: PLE1310 String `strip` call contains duplicate char
60 | # PLE1310
61 | u''.strip('http://')
| ^^^^^^^^^ PLE1310
62 |
62 |
63 | # PLE1310
|
@ -145,7 +141,7 @@ bad_str_strip_call.py:64:12: PLE1310 String `lstrip` call contains duplicate cha
63 | # PLE1310
64 | u''.lstrip('http://')
| ^^^^^^^^^ PLE1310
65 |
65 |
66 | # PLE1310
|
@ -154,6 +150,6 @@ bad_str_strip_call.py:67:12: PLE1310 String `rstrip` call contains duplicate cha
66 | # PLE1310
67 | b''.rstrip('http://')
| ^^^^^^^^^ PLE1310
68 |
68 |
69 | # OK
|

View File

@ -1,12 +1,10 @@
---
source: crates/ruff_linter/src/rules/pylint/mod.rs
snapshot_kind: text
---
too_many_nested_blocks.py:2:5: PLR1702 Too many nested blocks (6 > 5)
|
1 | def correct_fruits(fruits) -> bool:
2 | if len(fruits) > 1: # PLR1702
| _____^
2 | / if len(fruits) > 1: # PLR1702
3 | | if "apple" in fruits:
4 | | if "orange" in fruits:
5 | | count = fruits["orange"]

View File

@ -349,7 +349,7 @@ boolean_chained_comparison.py:127:4: PLR1716 [*] Contains chained boolean compar
126 | (a < b) and (b < c)
127 | (((a < b))) and (b < c)
| ^^^^^^^^^^^^^^^^^^^ PLR1716
128 |
128 |
129 | (a<b) and b<c and ((c<d))
|
= help: Use a single compare expression
@ -367,10 +367,10 @@ boolean_chained_comparison.py:127:4: PLR1716 [*] Contains chained boolean compar
boolean_chained_comparison.py:129:2: PLR1716 [*] Contains chained boolean comparison that can be simplified
|
127 | (((a < b))) and (b < c)
128 |
128 |
129 | (a<b) and b<c and ((c<d))
| ^^^^^^^^^^^^ PLR1716
130 |
130 |
131 | # should error and fix
|
= help: Use a single compare expression
@ -388,10 +388,10 @@ boolean_chained_comparison.py:129:2: PLR1716 [*] Contains chained boolean compar
boolean_chained_comparison.py:129:11: PLR1716 [*] Contains chained boolean comparison that can be simplified
|
127 | (((a < b))) and (b < c)
128 |
128 |
129 | (a<b) and b<c and ((c<d))
| ^^^^^^^^^^^^^ PLR1716
130 |
130 |
131 | # should error and fix
|
= help: Use a single compare expression
@ -411,7 +411,7 @@ boolean_chained_comparison.py:132:1: PLR1716 [*] Contains chained boolean compar
131 | # should error and fix
132 | a<b<c and c<d
| ^^^^^^^^^^^^^ PLR1716
133 |
133 |
134 | # more involved examples (all should error and fix)
|
= help: Use a single compare expression
@ -434,7 +434,7 @@ boolean_chained_comparison.py:135:1: PLR1716 [*] Contains chained boolean compar
137 | | # more comments
138 | | ) and b < c
| |___________^ PLR1716
139 |
139 |
140 | (
|
= help: Use a single compare expression
@ -452,8 +452,7 @@ boolean_chained_comparison.py:135:1: PLR1716 [*] Contains chained boolean compar
boolean_chained_comparison.py:141:5: PLR1716 [*] Contains chained boolean comparison that can be simplified
|
140 | (
141 | a
| _____^
141 | / a
142 | | <b
143 | | # hmmm...
144 | | <c
@ -481,7 +480,7 @@ boolean_chained_comparison.py:141:5: PLR1716 [*] Contains chained boolean compar
boolean_chained_comparison.py:148:1: PLR1716 [*] Contains chained boolean comparison that can be simplified
|
146 | )
147 |
147 |
148 | a < (b) and (((b)) < c)
| ^^^^^^^^^^^^^^^^^^^^^^ PLR1716
|

View File

@ -1,6 +1,5 @@
---
source: crates/ruff_linter/src/rules/pylint/mod.rs
snapshot_kind: text
---
if_stmt_min_max.py:8:1: PLR1730 [*] Replace `if` statement with `value = max(value, 10)`
|
@ -8,7 +7,7 @@ if_stmt_min_max.py:8:1: PLR1730 [*] Replace `if` statement with `value = max(val
8 | / if value < 10: # [max-instead-of-if]
9 | | value = 10
| |______________^ PLR1730
10 |
10 |
11 | if value <= 10: # [max-instead-of-if]
|
= help: Replace with `value = max(value, 10)`
@ -27,11 +26,11 @@ if_stmt_min_max.py:8:1: PLR1730 [*] Replace `if` statement with `value = max(val
if_stmt_min_max.py:11:1: PLR1730 [*] Replace `if` statement with `value = max(10, value)`
|
9 | value = 10
10 |
10 |
11 | / if value <= 10: # [max-instead-of-if]
12 | | value = 10
| |______________^ PLR1730
13 |
13 |
14 | if value < value2: # [max-instead-of-if]
|
= help: Replace with `value = max(10, value)`
@ -50,11 +49,11 @@ if_stmt_min_max.py:11:1: PLR1730 [*] Replace `if` statement with `value = max(10
if_stmt_min_max.py:14:1: PLR1730 [*] Replace `if` statement with `value = max(value, value2)`
|
12 | value = 10
13 |
13 |
14 | / if value < value2: # [max-instead-of-if]
15 | | value = value2
| |__________________^ PLR1730
16 |
16 |
17 | if value > 10: # [min-instead-of-if]
|
= help: Replace with `value = max(value, value2)`
@ -73,11 +72,11 @@ if_stmt_min_max.py:14:1: PLR1730 [*] Replace `if` statement with `value = max(va
if_stmt_min_max.py:17:1: PLR1730 [*] Replace `if` statement with `value = min(value, 10)`
|
15 | value = value2
16 |
16 |
17 | / if value > 10: # [min-instead-of-if]
18 | | value = 10
| |______________^ PLR1730
19 |
19 |
20 | if value >= 10: # [min-instead-of-if]
|
= help: Replace with `value = min(value, 10)`
@ -96,11 +95,11 @@ if_stmt_min_max.py:17:1: PLR1730 [*] Replace `if` statement with `value = min(va
if_stmt_min_max.py:20:1: PLR1730 [*] Replace `if` statement with `value = min(10, value)`
|
18 | value = 10
19 |
19 |
20 | / if value >= 10: # [min-instead-of-if]
21 | | value = 10
| |______________^ PLR1730
22 |
22 |
23 | if value > value2: # [min-instead-of-if]
|
= help: Replace with `value = min(10, value)`
@ -119,7 +118,7 @@ if_stmt_min_max.py:20:1: PLR1730 [*] Replace `if` statement with `value = min(10
if_stmt_min_max.py:23:1: PLR1730 [*] Replace `if` statement with `value = min(value, value2)`
|
21 | value = 10
22 |
22 |
23 | / if value > value2: # [min-instead-of-if]
24 | | value = value2
| |__________________^ PLR1730
@ -143,7 +142,7 @@ if_stmt_min_max.py:33:1: PLR1730 [*] Replace `if` statement with `A1.value = max
33 | / if A1.value < 10: # [max-instead-of-if]
34 | | A1.value = 10
| |_________________^ PLR1730
35 |
35 |
36 | if A1.value > 10: # [min-instead-of-if]
|
= help: Replace with `A1.value = max(A1.value, 10)`
@ -162,7 +161,7 @@ if_stmt_min_max.py:33:1: PLR1730 [*] Replace `if` statement with `A1.value = max
if_stmt_min_max.py:36:1: PLR1730 [*] Replace `if` statement with `A1.value = min(A1.value, 10)`
|
34 | A1.value = 10
35 |
35 |
36 | / if A1.value > 10: # [min-instead-of-if]
37 | | A1.value = 10
| |_________________^ PLR1730
@ -183,11 +182,11 @@ if_stmt_min_max.py:36:1: PLR1730 [*] Replace `if` statement with `A1.value = min
if_stmt_min_max.py:60:1: PLR1730 [*] Replace `if` statement with `A2 = max(A2, A1)`
|
58 | A2 = AA(3)
59 |
59 |
60 | / if A2 < A1: # [max-instead-of-if]
61 | | A2 = A1
| |___________^ PLR1730
62 |
62 |
63 | if A2 <= A1: # [max-instead-of-if]
|
= help: Replace with `A2 = max(A2, A1)`
@ -206,11 +205,11 @@ if_stmt_min_max.py:60:1: PLR1730 [*] Replace `if` statement with `A2 = max(A2, A
if_stmt_min_max.py:63:1: PLR1730 [*] Replace `if` statement with `A2 = max(A1, A2)`
|
61 | A2 = A1
62 |
62 |
63 | / if A2 <= A1: # [max-instead-of-if]
64 | | A2 = A1
| |___________^ PLR1730
65 |
65 |
66 | if A2 > A1: # [min-instead-of-if]
|
= help: Replace with `A2 = max(A1, A2)`
@ -229,11 +228,11 @@ if_stmt_min_max.py:63:1: PLR1730 [*] Replace `if` statement with `A2 = max(A1, A
if_stmt_min_max.py:66:1: PLR1730 [*] Replace `if` statement with `A2 = min(A2, A1)`
|
64 | A2 = A1
65 |
65 |
66 | / if A2 > A1: # [min-instead-of-if]
67 | | A2 = A1
| |___________^ PLR1730
68 |
68 |
69 | if A2 >= A1: # [min-instead-of-if]
|
= help: Replace with `A2 = min(A2, A1)`
@ -252,11 +251,11 @@ if_stmt_min_max.py:66:1: PLR1730 [*] Replace `if` statement with `A2 = min(A2, A
if_stmt_min_max.py:69:1: PLR1730 [*] Replace `if` statement with `A2 = min(A1, A2)`
|
67 | A2 = A1
68 |
68 |
69 | / if A2 >= A1: # [min-instead-of-if]
70 | | A2 = A1
| |___________^ PLR1730
71 |
71 |
72 | # Negative
|
= help: Replace with `A2 = min(A1, A2)`
@ -281,7 +280,7 @@ if_stmt_min_max.py:132:1: PLR1730 [*] Replace `if` statement with `min` call
135 | | attr
136 | | ) = 3
| |_________^ PLR1730
137 |
137 |
138 | class Foo:
|
= help: Replace with `min` call
@ -304,8 +303,7 @@ if_stmt_min_max.py:132:1: PLR1730 [*] Replace `if` statement with `min` call
if_stmt_min_max.py:143:9: PLR1730 [*] Replace `if` statement with `self._min = min(value, self._min)`
|
142 | def foo(self, value) -> None:
143 | if value < self._min:
| _________^
143 | / if value < self._min:
144 | | self._min = value
| |_____________________________^ PLR1730
145 | if value > self._max:
@ -328,11 +326,10 @@ if_stmt_min_max.py:145:9: PLR1730 [*] Replace `if` statement with `self._max = m
|
143 | if value < self._min:
144 | self._min = value
145 | if value > self._max:
| _________^
145 | / if value > self._max:
146 | | self._max = value
| |_____________________________^ PLR1730
147 |
147 |
148 | if self._min < value:
|
= help: Replace with `self._max = max(value, self._max)`
@ -351,9 +348,8 @@ if_stmt_min_max.py:145:9: PLR1730 [*] Replace `if` statement with `self._max = m
if_stmt_min_max.py:148:9: PLR1730 [*] Replace `if` statement with `self._min = max(self._min, value)`
|
146 | self._max = value
147 |
148 | if self._min < value:
| _________^
147 |
148 | / if self._min < value:
149 | | self._min = value
| |_____________________________^ PLR1730
150 | if self._max > value:
@ -376,11 +372,10 @@ if_stmt_min_max.py:150:9: PLR1730 [*] Replace `if` statement with `self._max = m
|
148 | if self._min < value:
149 | self._min = value
150 | if self._max > value:
| _________^
150 | / if self._max > value:
151 | | self._max = value
| |_____________________________^ PLR1730
152 |
152 |
153 | if value <= self._min:
|
= help: Replace with `self._max = min(self._max, value)`
@ -399,9 +394,8 @@ if_stmt_min_max.py:150:9: PLR1730 [*] Replace `if` statement with `self._max = m
if_stmt_min_max.py:153:9: PLR1730 [*] Replace `if` statement with `self._min = min(self._min, value)`
|
151 | self._max = value
152 |
153 | if value <= self._min:
| _________^
152 |
153 | / if value <= self._min:
154 | | self._min = value
| |_____________________________^ PLR1730
155 | if value >= self._max:
@ -424,11 +418,10 @@ if_stmt_min_max.py:155:9: PLR1730 [*] Replace `if` statement with `self._max = m
|
153 | if value <= self._min:
154 | self._min = value
155 | if value >= self._max:
| _________^
155 | / if value >= self._max:
156 | | self._max = value
| |_____________________________^ PLR1730
157 |
157 |
158 | if self._min <= value:
|
= help: Replace with `self._max = max(self._max, value)`
@ -447,9 +440,8 @@ if_stmt_min_max.py:155:9: PLR1730 [*] Replace `if` statement with `self._max = m
if_stmt_min_max.py:158:9: PLR1730 [*] Replace `if` statement with `self._min = max(value, self._min)`
|
156 | self._max = value
157 |
158 | if self._min <= value:
| _________^
157 |
158 | / if self._min <= value:
159 | | self._min = value
| |_____________________________^ PLR1730
160 | if self._max >= value:
@ -471,8 +463,7 @@ if_stmt_min_max.py:160:9: PLR1730 [*] Replace `if` statement with `self._max = m
|
158 | if self._min <= value:
159 | self._min = value
160 | if self._max >= value:
| _________^
160 | / if self._max >= value:
161 | | self._max = value
| |_____________________________^ PLR1730
|

View File

@ -1,13 +1,11 @@
---
source: crates/ruff_linter/src/rules/pylint/mod.rs
snapshot_kind: text
---
collapsible_else_if.py:37:5: PLR5501 [*] Use `elif` instead of `else` then `if`, to reduce indentation
|
35 | if 1:
36 | pass
37 | else:
| _____^
37 | / else:
38 | | if 2:
| |________^ PLR5501
39 | pass
@ -31,8 +29,7 @@ collapsible_else_if.py:45:5: PLR5501 [*] Use `elif` instead of `else` then `if`,
|
43 | if 1:
44 | pass
45 | else:
| _____^
45 | / else:
46 | | if 2:
| |________^ PLR5501
47 | pass
@ -60,8 +57,7 @@ collapsible_else_if.py:55:5: PLR5501 [*] Use `elif` instead of `else` then `if`,
|
53 | if 1:
54 | pass
55 | else:
| _____^
55 | / else:
56 | | # inner comment
57 | | if 2:
| |________^ PLR5501
@ -92,8 +88,7 @@ collapsible_else_if.py:69:5: PLR5501 [*] Use `elif` instead of `else` then `if`,
|
67 | elif True:
68 | print(2)
69 | else:
| _____^
69 | / else:
70 | | if True:
| |________^ PLR5501
71 | print(3)
@ -121,8 +116,7 @@ collapsible_else_if.py:79:5: PLR5501 [*] Use `elif` instead of `else` then `if`,
|
77 | if 1:
78 | pass
79 | else:
| _____^
79 | / else:
80 | | if 2: pass
| |________^ PLR5501
81 | else: pass
@ -146,8 +140,7 @@ collapsible_else_if.py:87:5: PLR5501 [*] Use `elif` instead of `else` then `if`,
|
85 | if 1:
86 | pass
87 | else:
| _____^
87 | / else:
88 | | if 2: pass
| |________^ PLR5501
89 | else:
@ -173,8 +166,7 @@ collapsible_else_if.py:96:5: PLR5501 [*] Use `elif` instead of `else` then `if`,
|
94 | if 1:
95 | pass
96 | else:
| _____^
96 | / else:
97 | | if 2:
| |________^ PLR5501
98 | pass
@ -201,8 +193,7 @@ collapsible_else_if.py:105:5: PLR5501 [*] Use `elif` instead of `else` then `if`
|
103 | if 1:
104 | pass
105 | else:
| _____^
105 | / else:
106 | | # inner comment which happens
107 | | # to be longer than one line
108 | | if 2:
@ -236,8 +227,7 @@ collapsible_else_if.py:117:5: PLR5501 [*] Use `elif` instead of `else` then `if`
|
115 | if 1:
116 | pass
117 | else:
| _____^
117 | / else:
118 | | # inner comment which happens to be overly indented
119 | | if 2:
| |________^ PLR5501
@ -268,8 +258,7 @@ collapsible_else_if.py:128:5: PLR5501 [*] Use `elif` instead of `else` then `if`
|
126 | if 1:
127 | pass
128 | else:
| _____^
128 | / else:
129 | | # inner comment which happens to be under indented
130 | | if 2:
| |________^ PLR5501
@ -300,8 +289,7 @@ collapsible_else_if.py:139:5: PLR5501 [*] Use `elif` instead of `else` then `if`
|
137 | if 1:
138 | pass
139 | else:
| _____^
139 | / else:
140 | | # inner comment which has mixed
141 | | # indentation levels
142 | | # which is pretty weird

View File

@ -7,7 +7,7 @@ unreachable.py:3:5: PLW0101 Unreachable code in `after_return`
2 | return "reachable"
3 | return "unreachable"
| ^^^^^^^^^^^^^^^^^^^^ PLW0101
4 |
4 |
5 | async def also_works_on_async_functions():
|
@ -17,7 +17,7 @@ unreachable.py:7:5: PLW0101 Unreachable code in `also_works_on_async_functions`
6 | return "reachable"
7 | return "unreachable"
| ^^^^^^^^^^^^^^^^^^^^ PLW0101
8 |
8 |
9 | def if_always_true():
|
@ -27,7 +27,7 @@ unreachable.py:12:5: PLW0101 Unreachable code in `if_always_true`
11 | return "reachable"
12 | return "unreachable"
| ^^^^^^^^^^^^^^^^^^^^ PLW0101
13 |
13 |
14 | def if_always_false():
|
@ -44,8 +44,7 @@ unreachable.py:21:9: PLW0101 Unreachable code in `if_elif_always_false`
|
19 | def if_elif_always_false():
20 | if False:
21 | return "unreachable"
| _________^
21 | / return "unreachable"
22 | | elif False:
23 | | return "also unreachable"
| |_________________________________^ PLW0101
@ -68,7 +67,7 @@ unreachable.py:31:5: PLW0101 Unreachable code in `if_elif_always_true`
30 | return "reachable"
31 | return "also unreachable"
| ^^^^^^^^^^^^^^^^^^^^^^^^^ PLW0101
32 |
32 |
33 | def ends_with_if():
|
@ -88,7 +87,7 @@ unreachable.py:42:5: PLW0101 Unreachable code in `infinite_loop`
41 | continue
42 | return "unreachable"
| ^^^^^^^^^^^^^^^^^^^^ PLW0101
43 |
43 |
44 | ''' TODO: we could determine these, but we don't yet.
|
@ -98,7 +97,7 @@ unreachable.py:75:5: PLW0101 Unreachable code in `match_wildcard`
74 | return "reachable"
75 | return "unreachable"
| ^^^^^^^^^^^^^^^^^^^^ PLW0101
76 |
76 |
77 | def match_case_and_wildcard(status):
|
@ -108,7 +107,7 @@ unreachable.py:83:5: PLW0101 Unreachable code in `match_case_and_wildcard`
82 | return "reachable"
83 | return "unreachable"
| ^^^^^^^^^^^^^^^^^^^^ PLW0101
84 |
84 |
85 | def raise_exception():
|
@ -118,7 +117,7 @@ unreachable.py:87:5: PLW0101 Unreachable code in `raise_exception`
86 | raise Exception
87 | return "unreachable"
| ^^^^^^^^^^^^^^^^^^^^ PLW0101
88 |
88 |
89 | def while_false():
|
@ -157,7 +156,7 @@ unreachable.py:105:5: PLW0101 Unreachable code in `while_false_else_return`
104 | return "reachable"
105 | return "also unreachable"
| ^^^^^^^^^^^^^^^^^^^^^^^^^ PLW0101
106 |
106 |
107 | def while_true():
|
@ -167,7 +166,7 @@ unreachable.py:110:5: PLW0101 Unreachable code in `while_true`
109 | return "reachable"
110 | return "unreachable"
| ^^^^^^^^^^^^^^^^^^^^ PLW0101
111 |
111 |
112 | def while_true_else():
|
@ -177,7 +176,7 @@ unreachable.py:116:9: PLW0101 Unreachable code in `while_true_else`
115 | else:
116 | return "unreachable"
| ^^^^^^^^^^^^^^^^^^^^ PLW0101
117 |
117 |
118 | def while_true_else_return():
|
@ -185,11 +184,10 @@ unreachable.py:122:9: PLW0101 Unreachable code in `while_true_else_return`
|
120 | return "reachable"
121 | else:
122 | return "unreachable"
| _________^
122 | / return "unreachable"
123 | | return "also unreachable"
| |_____________________________^ PLW0101
124 |
124 |
125 | def while_false_var_i():
|
@ -208,7 +206,7 @@ unreachable.py:135:5: PLW0101 Unreachable code in `while_true_var_i`
134 | i += 1
135 | return i
| ^^^^^^^^ PLW0101
136 |
136 |
137 | def while_infinite():
|
@ -218,7 +216,7 @@ unreachable.py:140:5: PLW0101 Unreachable code in `while_infinite`
139 | pass
140 | return "unreachable"
| ^^^^^^^^^^^^^^^^^^^^ PLW0101
141 |
141 |
142 | def while_if_true():
|
@ -228,7 +226,7 @@ unreachable.py:146:5: PLW0101 Unreachable code in `while_if_true`
145 | return "reachable"
146 | return "unreachable"
| ^^^^^^^^^^^^^^^^^^^^ PLW0101
147 |
147 |
148 | def while_break():
|
@ -245,8 +243,7 @@ unreachable.py:248:5: PLW0101 Unreachable code in `after_return`
|
246 | def after_return():
247 | return "reachable"
248 | print("unreachable")
| _____^
248 | / print("unreachable")
249 | | print("unreachable")
250 | | print("unreachable")
251 | | print("unreachable")
@ -258,8 +255,7 @@ unreachable.py:257:5: PLW0101 Unreachable code in `check_if_url_exists`
|
255 | def check_if_url_exists(url: str) -> bool: # type: ignore[return]
256 | return True # uncomment to check URLs
257 | response = requests.head(url, allow_redirects=True)
| _____^
257 | / response = requests.head(url, allow_redirects=True)
258 | | if response.status_code == 200:
259 | | return True
260 | | if response.status_code == 404:

View File

@ -1,6 +1,5 @@
---
source: crates/ruff_linter/src/rules/pyupgrade/mod.rs
snapshot_kind: text
---
UP012.py:2:1: UP012 [*] Unnecessary call to `encode` as UTF-8
|
@ -130,7 +129,7 @@ UP012.py:8:1: UP012 [*] Unnecessary call to `encode` as UTF-8
7 | "foo".encode(encoding="utf-8") # b"foo"
8 | / """
9 | | Lorem
10 | |
10 | |
11 | | Ipsum
12 | | """.encode(
13 | | "utf-8"
@ -162,8 +161,7 @@ UP012.py:16:5: UP012 [*] Unnecessary call to `encode` as UTF-8
|
14 | )
15 | (
16 | "Lorem "
| _____^
16 | / "Lorem "
17 | | "Ipsum".encode()
| |____________________^ UP012
18 | )
@ -187,8 +185,7 @@ UP012.py:20:5: UP012 [*] Unnecessary call to `encode` as UTF-8
|
18 | )
19 | (
20 | "Lorem " # Comment
| _____^
20 | / "Lorem " # Comment
21 | | "Ipsum".encode() # Comment
| |____________________^ UP012
22 | )
@ -256,7 +253,7 @@ UP012.py:36:1: UP012 [*] Unnecessary UTF-8 `encoding` argument to `encode`
37 | | "utf-8",
38 | | )
| |_^ UP012
39 |
39 |
40 | # `encode` with custom args and kwargs should not be processed.
|
= help: Remove unnecessary `encoding` argument
@ -299,7 +296,7 @@ UP012.py:55:1: UP012 [*] Unnecessary UTF-8 `encoding` argument to `encode`
54 | "unicode text©".encode()
55 | "unicode text©".encode(encoding="UTF8") # "unicode text©".encode()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP012
56 |
56 |
57 | r"foo\o".encode("utf-8") # br"foo\o"
|
= help: Remove unnecessary `encoding` argument
@ -317,7 +314,7 @@ UP012.py:55:1: UP012 [*] Unnecessary UTF-8 `encoding` argument to `encode`
UP012.py:57:1: UP012 [*] Unnecessary call to `encode` as UTF-8
|
55 | "unicode text©".encode(encoding="UTF8") # "unicode text©".encode()
56 |
56 |
57 | r"foo\o".encode("utf-8") # br"foo\o"
| ^^^^^^^^^^^^^^^^^^^^^^^^ UP012
58 | u"foo".encode("utf-8") # b"foo"
@ -402,7 +399,7 @@ UP012.py:61:7: UP012 [*] Unnecessary call to `encode` as UTF-8
60 | U"foo".encode("utf-8") # b"foo"
61 | print("foo".encode()) # print(b"foo")
| ^^^^^^^^^^^^^^ UP012
62 |
62 |
63 | # `encode` on parenthesized strings.
|
= help: Rewrite as bytes literal
@ -425,7 +422,7 @@ UP012.py:64:1: UP012 [*] Unnecessary call to `encode` as UTF-8
66 | | "def"
67 | | ).encode()
| |__________^ UP012
68 |
68 |
69 | ((
|
= help: Rewrite as bytes literal
@ -447,13 +444,13 @@ UP012.py:64:1: UP012 [*] Unnecessary call to `encode` as UTF-8
UP012.py:69:1: UP012 [*] Unnecessary call to `encode` as UTF-8
|
67 | ).encode()
68 |
68 |
69 | / ((
70 | | "abc"
71 | | "def"
72 | | )).encode()
| |___________^ UP012
73 |
73 |
74 | (f"foo{bar}").encode("utf-8")
|
= help: Rewrite as bytes literal
@ -475,7 +472,7 @@ UP012.py:69:1: UP012 [*] Unnecessary call to `encode` as UTF-8
UP012.py:74:1: UP012 [*] Unnecessary UTF-8 `encoding` argument to `encode`
|
72 | )).encode()
73 |
73 |
74 | (f"foo{bar}").encode("utf-8")
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP012
75 | (f"foo{bar}").encode(encoding="utf-8")
@ -558,7 +555,7 @@ UP012.py:82:17: UP012 [*] Unnecessary call to `encode` as UTF-8
81 | def _match_ignore(line):
82 | input=stdin and'\n'.encode()or None
| ^^^^^^^^^^^^^ UP012
83 |
83 |
84 | # Not a valid type annotation but this test shouldn't result in a panic.
|
= help: Rewrite as bytes literal

View File

@ -1,6 +1,5 @@
---
source: crates/ruff_linter/src/rules/pyupgrade/mod.rs
snapshot_kind: text
---
UP026.py:3:12: UP026 [*] `mock` is deprecated, use `unittest.mock`
|
@ -8,7 +7,7 @@ UP026.py:3:12: UP026 [*] `mock` is deprecated, use `unittest.mock`
2 | if True:
3 | import mock
| ^^^^ UP026
4 |
4 |
5 | # Error (`from unittest import mock`)
|
= help: Import from `unittest.mock` instead
@ -28,7 +27,7 @@ UP026.py:7:12: UP026 [*] `mock` is deprecated, use `unittest.mock`
6 | if True:
7 | import mock, sys
| ^^^^ UP026
8 |
8 |
9 | # Error (`from unittest.mock import *`)
|
= help: Import from `unittest.mock` instead
@ -50,7 +49,7 @@ UP026.py:11:5: UP026 [*] `mock` is deprecated, use `unittest.mock`
10 | if True:
11 | from mock import *
| ^^^^^^^^^^^^^^^^^^ UP026
12 |
12 |
13 | # Error (`from unittest import mock`)
|
= help: Import from `unittest.mock` instead
@ -70,7 +69,7 @@ UP026.py:14:8: UP026 [*] `mock` is deprecated, use `unittest.mock`
13 | # Error (`from unittest import mock`)
14 | import mock.mock
| ^^^^^^^^^ UP026
15 |
15 |
16 | # Error (`from unittest import mock`)
|
= help: Import from `unittest.mock` instead
@ -90,7 +89,7 @@ UP026.py:17:20: UP026 [*] `mock` is deprecated, use `unittest.mock`
16 | # Error (`from unittest import mock`)
17 | import contextlib, mock, sys
| ^^^^ UP026
18 |
18 |
19 | # Error (`from unittest import mock`)
|
= help: Import from `unittest.mock` instead
@ -131,7 +130,7 @@ UP026.py:24:1: UP026 [*] `mock` is deprecated, use `unittest.mock`
23 | # Error (`from unittest import mock`)
24 | from mock import mock
| ^^^^^^^^^^^^^^^^^^^^^ UP026
25 |
25 |
26 | # Error (keep trailing comma)
|
= help: Import from `unittest.mock` instead
@ -188,7 +187,7 @@ UP026.py:33:1: UP026 [*] `mock` is deprecated, use `unittest.mock`
37 | | mock,
38 | | )
| |_^ UP026
39 |
39 |
40 | # Error (avoid trailing comma)
|
= help: Import from `unittest.mock` instead
@ -300,7 +299,7 @@ UP026.py:54:1: UP026 [*] `mock` is deprecated, use `unittest.mock`
53 | from mock import mock, a, b, c
54 | from mock import a, b, c, mock
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP026
55 |
55 |
56 | if True:
|
= help: Import from `unittest.mock` instead
@ -320,15 +319,14 @@ UP026.py:58:9: UP026 [*] `mock` is deprecated, use `unittest.mock`
|
56 | if True:
57 | if False:
58 | from mock import (
| _________^
58 | / from mock import (
59 | | mock,
60 | | a,
61 | | b,
62 | | c
63 | | )
| |_________^ UP026
64 |
64 |
65 | # OK
|
= help: Import from `unittest.mock` instead
@ -354,7 +352,7 @@ UP026.py:69:8: UP026 [*] `mock` is deprecated, use `unittest.mock`
68 | # Error (`from unittest import mock`)
69 | import mock, mock
| ^^^^ UP026
70 |
70 |
71 | # Error (`from unittest import mock as foo`)
|
= help: Import from `unittest.mock` instead
@ -375,7 +373,7 @@ UP026.py:69:14: UP026 [*] `mock` is deprecated, use `unittest.mock`
68 | # Error (`from unittest import mock`)
69 | import mock, mock
| ^^^^ UP026
70 |
70 |
71 | # Error (`from unittest import mock as foo`)
|
= help: Import from `unittest.mock` instead
@ -396,7 +394,7 @@ UP026.py:72:8: UP026 [*] `mock` is deprecated, use `unittest.mock`
71 | # Error (`from unittest import mock as foo`)
72 | import mock as foo
| ^^^^^^^^^^^ UP026
73 |
73 |
74 | # Error (`from unittest import mock as foo`)
|
= help: Import from `unittest.mock` instead
@ -416,7 +414,7 @@ UP026.py:75:1: UP026 [*] `mock` is deprecated, use `unittest.mock`
74 | # Error (`from unittest import mock as foo`)
75 | from mock import mock as foo
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP026
76 |
76 |
77 | if True:
|
= help: Import from `unittest.mock` instead
@ -437,7 +435,7 @@ UP026.py:79:12: UP026 [*] `mock` is deprecated, use `unittest.mock`
78 | # This should yield multiple, aliased imports.
79 | import mock as foo, mock as bar, mock
| ^^^^^^^^^^^ UP026
80 |
80 |
81 | # This should yield multiple, aliased imports, and preserve `os`.
|
= help: Import from `unittest.mock` instead
@ -460,7 +458,7 @@ UP026.py:79:25: UP026 [*] `mock` is deprecated, use `unittest.mock`
78 | # This should yield multiple, aliased imports.
79 | import mock as foo, mock as bar, mock
| ^^^^^^^^^^^ UP026
80 |
80 |
81 | # This should yield multiple, aliased imports, and preserve `os`.
|
= help: Import from `unittest.mock` instead
@ -483,7 +481,7 @@ UP026.py:79:38: UP026 [*] `mock` is deprecated, use `unittest.mock`
78 | # This should yield multiple, aliased imports.
79 | import mock as foo, mock as bar, mock
| ^^^^ UP026
80 |
80 |
81 | # This should yield multiple, aliased imports, and preserve `os`.
|
= help: Import from `unittest.mock` instead
@ -505,7 +503,7 @@ UP026.py:82:12: UP026 [*] `mock` is deprecated, use `unittest.mock`
81 | # This should yield multiple, aliased imports, and preserve `os`.
82 | import mock as foo, mock as bar, mock, os
| ^^^^^^^^^^^ UP026
83 |
83 |
84 | if True:
|
= help: Import from `unittest.mock` instead
@ -528,7 +526,7 @@ UP026.py:82:25: UP026 [*] `mock` is deprecated, use `unittest.mock`
81 | # This should yield multiple, aliased imports, and preserve `os`.
82 | import mock as foo, mock as bar, mock, os
| ^^^^^^^^^^^ UP026
83 |
83 |
84 | if True:
|
= help: Import from `unittest.mock` instead
@ -551,7 +549,7 @@ UP026.py:82:38: UP026 [*] `mock` is deprecated, use `unittest.mock`
81 | # This should yield multiple, aliased imports, and preserve `os`.
82 | import mock as foo, mock as bar, mock, os
| ^^^^ UP026
83 |
83 |
84 | if True:
|
= help: Import from `unittest.mock` instead

View File

@ -1,12 +1,10 @@
---
source: crates/ruff_linter/src/rules/pyupgrade/mod.rs
snapshot_kind: text
---
UP028_0.py:2:5: UP028 [*] Replace `yield` over `for` loop with `yield from`
|
1 | def f():
2 | for x in y:
| _____^
2 | / for x in y:
3 | | yield x
| |_______________^ UP028
|
@ -24,8 +22,7 @@ UP028_0.py:2:5: UP028 [*] Replace `yield` over `for` loop with `yield from`
UP028_0.py:7:5: UP028 [*] Replace `yield` over `for` loop with `yield from`
|
6 | def g():
7 | for x, y in z:
| _____^
7 | / for x, y in z:
8 | | yield (x, y)
| |____________________^ UP028
|
@ -45,8 +42,7 @@ UP028_0.py:7:5: UP028 [*] Replace `yield` over `for` loop with `yield from`
UP028_0.py:12:5: UP028 [*] Replace `yield` over `for` loop with `yield from`
|
11 | def h():
12 | for x in [1, 2, 3]:
| _____^
12 | / for x in [1, 2, 3]:
13 | | yield x
| |_______________^ UP028
|
@ -66,8 +62,7 @@ UP028_0.py:12:5: UP028 [*] Replace `yield` over `for` loop with `yield from`
UP028_0.py:17:5: UP028 [*] Replace `yield` over `for` loop with `yield from`
|
16 | def i():
17 | for x in {x for x in y}:
| _____^
17 | / for x in {x for x in y}:
18 | | yield x
| |_______________^ UP028
|
@ -87,8 +82,7 @@ UP028_0.py:17:5: UP028 [*] Replace `yield` over `for` loop with `yield from`
UP028_0.py:22:5: UP028 [*] Replace `yield` over `for` loop with `yield from`
|
21 | def j():
22 | for x in (1, 2, 3):
| _____^
22 | / for x in (1, 2, 3):
23 | | yield x
| |_______________^ UP028
|
@ -108,8 +102,7 @@ UP028_0.py:22:5: UP028 [*] Replace `yield` over `for` loop with `yield from`
UP028_0.py:27:5: UP028 [*] Replace `yield` over `for` loop with `yield from`
|
26 | def k():
27 | for x, y in {3: "x", 6: "y"}:
| _____^
27 | / for x, y in {3: "x", 6: "y"}:
28 | | yield x, y
| |__________________^ UP028
|
@ -130,8 +123,7 @@ UP028_0.py:33:5: UP028 [*] Replace `yield` over `for` loop with `yield from`
|
31 | def f(): # Comment one\n'
32 | # Comment two\n'
33 | for x, y in { # Comment three\n'
| _____^
33 | / for x, y in { # Comment three\n'
34 | | 3: "x", # Comment four\n'
35 | | # Comment five\n'
36 | | 6: "y", # Comment six\n'
@ -163,8 +155,7 @@ UP028_0.py:33:5: UP028 [*] Replace `yield` over `for` loop with `yield from`
UP028_0.py:44:5: UP028 [*] Replace `yield` over `for` loop with `yield from`
|
43 | def f():
44 | for x, y in [{3: (3, [44, "long ss"]), 6: "y"}]:
| _____^
44 | / for x, y in [{3: (3, [44, "long ss"]), 6: "y"}]:
45 | | yield x, y
| |__________________^ UP028
|
@ -184,11 +175,10 @@ UP028_0.py:44:5: UP028 [*] Replace `yield` over `for` loop with `yield from`
UP028_0.py:49:5: UP028 [*] Replace `yield` over `for` loop with `yield from`
|
48 | def f():
49 | for x, y in z():
| _____^
49 | / for x, y in z():
50 | | yield x, y
| |__________________^ UP028
51 |
51 |
52 | def f():
|
= help: Replace with `yield from`
@ -208,8 +198,7 @@ UP028_0.py:55:9: UP028 [*] Replace `yield` over `for` loop with `yield from`
|
53 | def func():
54 | # This comment is preserved\n'
55 | for x, y in z(): # Comment one\n'
| _________^
55 | / for x, y in z(): # Comment one\n'
56 | | # Comment two\n'
57 | | yield x, y # Comment three\n'
| |______________________^ UP028
@ -234,8 +223,7 @@ UP028_0.py:67:5: UP028 [*] Replace `yield` over `for` loop with `yield from`
|
65 | for x in y:
66 | yield x
67 | for z in x:
| _____^
67 | / for z in x:
68 | | yield z
| |_______________^ UP028
|
@ -255,8 +243,7 @@ UP028_0.py:67:5: UP028 [*] Replace `yield` over `for` loop with `yield from`
UP028_0.py:72:5: UP028 [*] Replace `yield` over `for` loop with `yield from`
|
71 | def f():
72 | for x, y in z():
| _____^
72 | / for x, y in z():
73 | | yield x, y
| |__________________^ UP028
74 | x = 1
@ -278,8 +265,7 @@ UP028_0.py:79:5: UP028 [*] Replace `yield` over `for` loop with `yield from`
|
77 | # Regression test for: https://github.com/astral-sh/ruff/issues/7103
78 | def _serve_method(fn):
79 | for h in (
| _____^
79 | / for h in (
80 | | TaggedText.from_file(args.input)
81 | | .markup(highlight=args.region)
82 | | ):
@ -307,8 +293,7 @@ UP028_0.py:97:5: UP028 [*] Replace `yield` over `for` loop with `yield from`
|
95 | # UP028: The exception binding is not a reference to the loop variable
96 | def f():
97 | for x in (1, 2, 3):
| _____^
97 | / for x in (1, 2, 3):
98 | | yield x
| |_______________^ UP028
99 | # Shadowing with an `except`
@ -331,8 +316,7 @@ UP028_0.py:108:5: UP028 [*] Replace `yield` over `for` loop with `yield from`
|
106 | # UP028: The context binding is not a reference to the loop variable
107 | def f():
108 | for x in (1, 2, 3):
| _____^
108 | / for x in (1, 2, 3):
109 | | yield x
| |_______________^ UP028
110 | # Shadowing with `with`
@ -355,8 +339,7 @@ UP028_0.py:118:5: UP028 [*] Replace `yield` over `for` loop with `yield from`
|
116 | # UP028: The type annotation binding is not a reference to the loop variable
117 | def f():
118 | for x in (1, 2, 3):
| _____^
118 | / for x in (1, 2, 3):
119 | | yield x
| |_______________^ UP028
120 | # Shadowing with a type annotation
@ -379,8 +362,7 @@ UP028_0.py:134:5: UP028 [*] Replace `yield` over `for` loop with `yield from`
|
132 | # UP028: The exception bindings are not a reference to the loop variable
133 | def f():
134 | for x in (1, 2, 3):
| _____^
134 | / for x in (1, 2, 3):
135 | | yield x
| |_______________^ UP028
136 | # Shadowing with multiple `except` blocks

View File

@ -1,14 +1,13 @@
---
source: crates/ruff_linter/src/rules/pyupgrade/mod.rs
snapshot_kind: text
---
UP030_0.py:3:1: UP030 [*] Use implicit references for positional format fields
|
1 | # Invalid calls; errors expected.
2 |
2 |
3 | "{0}" "{1}" "{2}".format(1, 2, 3)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP030
4 |
4 |
5 | "a {3} complicated {1} string with {0} {2}".format(
|
= help: Remove explicit positional indices
@ -25,12 +24,12 @@ UP030_0.py:3:1: UP030 [*] Use implicit references for positional format fields
UP030_0.py:5:1: UP030 [*] Use implicit references for positional format fields
|
3 | "{0}" "{1}" "{2}".format(1, 2, 3)
4 |
4 |
5 | / "a {3} complicated {1} string with {0} {2}".format(
6 | | "first", "second", "third", "fourth"
7 | | )
| |_^ UP030
8 |
8 |
9 | '{0}'.format(1)
|
= help: Remove explicit positional indices
@ -50,10 +49,10 @@ UP030_0.py:5:1: UP030 [*] Use implicit references for positional format fields
UP030_0.py:9:1: UP030 [*] Use implicit references for positional format fields
|
7 | )
8 |
8 |
9 | '{0}'.format(1)
| ^^^^^^^^^^^^^^^ UP030
10 |
10 |
11 | '{0:x}'.format(30)
|
= help: Remove explicit positional indices
@ -71,10 +70,10 @@ UP030_0.py:9:1: UP030 [*] Use implicit references for positional format fields
UP030_0.py:11:1: UP030 [*] Use implicit references for positional format fields
|
9 | '{0}'.format(1)
10 |
10 |
11 | '{0:x}'.format(30)
| ^^^^^^^^^^^^^^^^^^ UP030
12 |
12 |
13 | x = '{0}'.format(1)
|
= help: Remove explicit positional indices
@ -92,10 +91,10 @@ UP030_0.py:11:1: UP030 [*] Use implicit references for positional format fields
UP030_0.py:13:5: UP030 [*] Use implicit references for positional format fields
|
11 | '{0:x}'.format(30)
12 |
12 |
13 | x = '{0}'.format(1)
| ^^^^^^^^^^^^^^^ UP030
14 |
14 |
15 | '''{0}\n{1}\n'''.format(1, 2)
|
= help: Remove explicit positional indices
@ -113,10 +112,10 @@ UP030_0.py:13:5: UP030 [*] Use implicit references for positional format fields
UP030_0.py:15:1: UP030 [*] Use implicit references for positional format fields
|
13 | x = '{0}'.format(1)
14 |
14 |
15 | '''{0}\n{1}\n'''.format(1, 2)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP030
16 |
16 |
17 | x = "foo {0}" \
|
= help: Remove explicit positional indices
@ -134,12 +133,12 @@ UP030_0.py:15:1: UP030 [*] Use implicit references for positional format fields
UP030_0.py:17:5: UP030 [*] Use implicit references for positional format fields
|
15 | '''{0}\n{1}\n'''.format(1, 2)
16 |
16 |
17 | x = "foo {0}" \
| _____^
18 | | "bar {1}".format(1, 2)
| |__________________________^ UP030
19 |
19 |
20 | ("{0}").format(1)
|
= help: Remove explicit positional indices
@ -159,10 +158,10 @@ UP030_0.py:17:5: UP030 [*] Use implicit references for positional format fields
UP030_0.py:20:1: UP030 [*] Use implicit references for positional format fields
|
18 | "bar {1}".format(1, 2)
19 |
19 |
20 | ("{0}").format(1)
| ^^^^^^^^^^^^^^^^^ UP030
21 |
21 |
22 | "\N{snowman} {0}".format(1)
|
= help: Remove explicit positional indices
@ -180,10 +179,10 @@ UP030_0.py:20:1: UP030 [*] Use implicit references for positional format fields
UP030_0.py:22:1: UP030 [*] Use implicit references for positional format fields
|
20 | ("{0}").format(1)
21 |
21 |
22 | "\N{snowman} {0}".format(1)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP030
23 |
23 |
24 | print(
|
= help: Remove explicit positional indices
@ -201,8 +200,7 @@ UP030_0.py:22:1: UP030 [*] Use implicit references for positional format fields
UP030_0.py:25:5: UP030 [*] Use implicit references for positional format fields
|
24 | print(
25 | 'foo{0}'
| _____^
25 | / 'foo{0}'
26 | | 'bar{1}'.format(1, 2)
| |_________________________^ UP030
27 | )
@ -224,8 +222,7 @@ UP030_0.py:25:5: UP030 [*] Use implicit references for positional format fields
UP030_0.py:30:5: UP030 [*] Use implicit references for positional format fields
|
29 | print(
30 | 'foo{0}' # ohai\n"
| _____^
30 | / 'foo{0}' # ohai\n"
31 | | 'bar{1}'.format(1, 2)
| |_________________________^ UP030
32 | )
@ -247,10 +244,10 @@ UP030_0.py:30:5: UP030 [*] Use implicit references for positional format fields
UP030_0.py:34:1: UP030 Use implicit references for positional format fields
|
32 | )
33 |
33 |
34 | '{' '0}'.format(1)
| ^^^^^^^^^^^^^^^^^^ UP030
35 |
35 |
36 | args = list(range(10))
|
= help: Remove explicit positional indices
@ -258,10 +255,10 @@ UP030_0.py:34:1: UP030 Use implicit references for positional format fields
UP030_0.py:39:1: UP030 [*] Use implicit references for positional format fields
|
37 | kwargs = {x: x for x in range(10)}
38 |
38 |
39 | "{0}".format(*args)
| ^^^^^^^^^^^^^^^^^^^ UP030
40 |
40 |
41 | "{0}".format(**kwargs)
|
= help: Remove explicit positional indices
@ -279,10 +276,10 @@ UP030_0.py:39:1: UP030 [*] Use implicit references for positional format fields
UP030_0.py:41:1: UP030 [*] Use implicit references for positional format fields
|
39 | "{0}".format(*args)
40 |
40 |
41 | "{0}".format(**kwargs)
| ^^^^^^^^^^^^^^^^^^^^^^ UP030
42 |
42 |
43 | "{0}_{1}".format(*args)
|
= help: Remove explicit positional indices
@ -300,10 +297,10 @@ UP030_0.py:41:1: UP030 [*] Use implicit references for positional format fields
UP030_0.py:43:1: UP030 [*] Use implicit references for positional format fields
|
41 | "{0}".format(**kwargs)
42 |
42 |
43 | "{0}_{1}".format(*args)
| ^^^^^^^^^^^^^^^^^^^^^^^ UP030
44 |
44 |
45 | "{0}_{1}".format(1, *args)
|
= help: Remove explicit positional indices
@ -321,10 +318,10 @@ UP030_0.py:43:1: UP030 [*] Use implicit references for positional format fields
UP030_0.py:45:1: UP030 [*] Use implicit references for positional format fields
|
43 | "{0}_{1}".format(*args)
44 |
44 |
45 | "{0}_{1}".format(1, *args)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ UP030
46 |
46 |
47 | "{0}_{1}".format(1, 2, *args)
|
= help: Remove explicit positional indices
@ -342,10 +339,10 @@ UP030_0.py:45:1: UP030 [*] Use implicit references for positional format fields
UP030_0.py:47:1: UP030 [*] Use implicit references for positional format fields
|
45 | "{0}_{1}".format(1, *args)
46 |
46 |
47 | "{0}_{1}".format(1, 2, *args)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP030
48 |
48 |
49 | "{0}_{1}".format(*args, 1, 2)
|
= help: Remove explicit positional indices
@ -363,10 +360,10 @@ UP030_0.py:47:1: UP030 [*] Use implicit references for positional format fields
UP030_0.py:49:1: UP030 [*] Use implicit references for positional format fields
|
47 | "{0}_{1}".format(1, 2, *args)
48 |
48 |
49 | "{0}_{1}".format(*args, 1, 2)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP030
50 |
50 |
51 | "{0}_{1}_{2}".format(1, **kwargs)
|
= help: Remove explicit positional indices
@ -384,10 +381,10 @@ UP030_0.py:49:1: UP030 [*] Use implicit references for positional format fields
UP030_0.py:51:1: UP030 [*] Use implicit references for positional format fields
|
49 | "{0}_{1}".format(*args, 1, 2)
50 |
50 |
51 | "{0}_{1}_{2}".format(1, **kwargs)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP030
52 |
52 |
53 | "{0}_{1}_{2}".format(1, 2, **kwargs)
|
= help: Remove explicit positional indices
@ -405,10 +402,10 @@ UP030_0.py:51:1: UP030 [*] Use implicit references for positional format fields
UP030_0.py:53:1: UP030 [*] Use implicit references for positional format fields
|
51 | "{0}_{1}_{2}".format(1, **kwargs)
52 |
52 |
53 | "{0}_{1}_{2}".format(1, 2, **kwargs)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP030
54 |
54 |
55 | "{0}_{1}_{2}".format(1, 2, 3, **kwargs)
|
= help: Remove explicit positional indices
@ -426,10 +423,10 @@ UP030_0.py:53:1: UP030 [*] Use implicit references for positional format fields
UP030_0.py:55:1: UP030 [*] Use implicit references for positional format fields
|
53 | "{0}_{1}_{2}".format(1, 2, **kwargs)
54 |
54 |
55 | "{0}_{1}_{2}".format(1, 2, 3, **kwargs)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP030
56 |
56 |
57 | "{0}_{1}_{2}".format(1, 2, 3, *args, **kwargs)
|
= help: Remove explicit positional indices
@ -447,10 +444,10 @@ UP030_0.py:55:1: UP030 [*] Use implicit references for positional format fields
UP030_0.py:57:1: UP030 [*] Use implicit references for positional format fields
|
55 | "{0}_{1}_{2}".format(1, 2, 3, **kwargs)
56 |
56 |
57 | "{0}_{1}_{2}".format(1, 2, 3, *args, **kwargs)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP030
58 |
58 |
59 | "{1}_{0}".format(1, 2, *args)
|
= help: Remove explicit positional indices
@ -468,10 +465,10 @@ UP030_0.py:57:1: UP030 [*] Use implicit references for positional format fields
UP030_0.py:59:1: UP030 [*] Use implicit references for positional format fields
|
57 | "{0}_{1}_{2}".format(1, 2, 3, *args, **kwargs)
58 |
58 |
59 | "{1}_{0}".format(1, 2, *args)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP030
60 |
60 |
61 | "{1}_{0}".format(1, 2)
|
= help: Remove explicit positional indices
@ -488,7 +485,7 @@ UP030_0.py:59:1: UP030 [*] Use implicit references for positional format fields
UP030_0.py:61:1: UP030 [*] Use implicit references for positional format fields
|
59 | "{1}_{0}".format(1, 2, *args)
60 |
60 |
61 | "{1}_{0}".format(1, 2)
| ^^^^^^^^^^^^^^^^^^^^^^ UP030
|

View File

@ -1,14 +1,13 @@
---
source: crates/ruff_linter/src/rules/pyupgrade/mod.rs
snapshot_kind: text
---
UP032_0.py:5:1: UP032 [*] Use f-string instead of `format` call
|
3 | ###
4 |
4 |
5 | "{} {}".format(a, b)
| ^^^^^^^^^^^^^^^^^^^^ UP032
6 |
6 |
7 | "{1} {0}".format(a, b)
|
= help: Convert to f-string
@ -26,10 +25,10 @@ UP032_0.py:5:1: UP032 [*] Use f-string instead of `format` call
UP032_0.py:7:1: UP032 [*] Use f-string instead of `format` call
|
5 | "{} {}".format(a, b)
6 |
6 |
7 | "{1} {0}".format(a, b)
| ^^^^^^^^^^^^^^^^^^^^^^ UP032
8 |
8 |
9 | "{0} {1} {0}".format(a, b)
|
= help: Convert to f-string
@ -47,10 +46,10 @@ UP032_0.py:7:1: UP032 [*] Use f-string instead of `format` call
UP032_0.py:9:1: UP032 [*] Use f-string instead of `format` call
|
7 | "{1} {0}".format(a, b)
8 |
8 |
9 | "{0} {1} {0}".format(a, b)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ UP032
10 |
10 |
11 | "{x.y}".format(x=z)
|
= help: Convert to f-string
@ -68,10 +67,10 @@ UP032_0.py:9:1: UP032 [*] Use f-string instead of `format` call
UP032_0.py:11:1: UP032 [*] Use f-string instead of `format` call
|
9 | "{0} {1} {0}".format(a, b)
10 |
10 |
11 | "{x.y}".format(x=z)
| ^^^^^^^^^^^^^^^^^^^ UP032
12 |
12 |
13 | "{x} {y} {x}".format(x=a, y=b)
|
= help: Convert to f-string
@ -89,10 +88,10 @@ UP032_0.py:11:1: UP032 [*] Use f-string instead of `format` call
UP032_0.py:13:1: UP032 [*] Use f-string instead of `format` call
|
11 | "{x.y}".format(x=z)
12 |
12 |
13 | "{x} {y} {x}".format(x=a, y=b)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP032
14 |
14 |
15 | "{.x} {.y}".format(a, b)
|
= help: Convert to f-string
@ -110,10 +109,10 @@ UP032_0.py:13:1: UP032 [*] Use f-string instead of `format` call
UP032_0.py:15:1: UP032 [*] Use f-string instead of `format` call
|
13 | "{x} {y} {x}".format(x=a, y=b)
14 |
14 |
15 | "{.x} {.y}".format(a, b)
| ^^^^^^^^^^^^^^^^^^^^^^^^ UP032
16 |
16 |
17 | "{} {}".format(a.b, c.d)
|
= help: Convert to f-string
@ -131,10 +130,10 @@ UP032_0.py:15:1: UP032 [*] Use f-string instead of `format` call
UP032_0.py:17:1: UP032 [*] Use f-string instead of `format` call
|
15 | "{.x} {.y}".format(a, b)
16 |
16 |
17 | "{} {}".format(a.b, c.d)
| ^^^^^^^^^^^^^^^^^^^^^^^^ UP032
18 |
18 |
19 | "{}".format(a())
|
= help: Convert to f-string
@ -152,10 +151,10 @@ UP032_0.py:17:1: UP032 [*] Use f-string instead of `format` call
UP032_0.py:19:1: UP032 [*] Use f-string instead of `format` call
|
17 | "{} {}".format(a.b, c.d)
18 |
18 |
19 | "{}".format(a())
| ^^^^^^^^^^^^^^^^ UP032
20 |
20 |
21 | "{}".format(a.b())
|
= help: Convert to f-string
@ -173,10 +172,10 @@ UP032_0.py:19:1: UP032 [*] Use f-string instead of `format` call
UP032_0.py:21:1: UP032 [*] Use f-string instead of `format` call
|
19 | "{}".format(a())
20 |
20 |
21 | "{}".format(a.b())
| ^^^^^^^^^^^^^^^^^^ UP032
22 |
22 |
23 | "{}".format(a.b().c())
|
= help: Convert to f-string
@ -194,10 +193,10 @@ UP032_0.py:21:1: UP032 [*] Use f-string instead of `format` call
UP032_0.py:23:1: UP032 [*] Use f-string instead of `format` call
|
21 | "{}".format(a.b())
22 |
22 |
23 | "{}".format(a.b().c())
| ^^^^^^^^^^^^^^^^^^^^^^ UP032
24 |
24 |
25 | "hello {}!".format(name)
|
= help: Convert to f-string
@ -215,10 +214,10 @@ UP032_0.py:23:1: UP032 [*] Use f-string instead of `format` call
UP032_0.py:25:1: UP032 [*] Use f-string instead of `format` call
|
23 | "{}".format(a.b().c())
24 |
24 |
25 | "hello {}!".format(name)
| ^^^^^^^^^^^^^^^^^^^^^^^^ UP032
26 |
26 |
27 | "{}{b}{}".format(a, c, b=b)
|
= help: Convert to f-string
@ -236,10 +235,10 @@ UP032_0.py:25:1: UP032 [*] Use f-string instead of `format` call
UP032_0.py:27:1: UP032 [*] Use f-string instead of `format` call
|
25 | "hello {}!".format(name)
26 |
26 |
27 | "{}{b}{}".format(a, c, b=b)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP032
28 |
28 |
29 | "{}".format(0x0)
|
= help: Convert to f-string
@ -257,10 +256,10 @@ UP032_0.py:27:1: UP032 [*] Use f-string instead of `format` call
UP032_0.py:29:1: UP032 [*] Use f-string instead of `format` call
|
27 | "{}{b}{}".format(a, c, b=b)
28 |
28 |
29 | "{}".format(0x0)
| ^^^^^^^^^^^^^^^^ UP032
30 |
30 |
31 | "{} {}".format(a, b)
|
= help: Convert to f-string
@ -278,10 +277,10 @@ UP032_0.py:29:1: UP032 [*] Use f-string instead of `format` call
UP032_0.py:31:1: UP032 [*] Use f-string instead of `format` call
|
29 | "{}".format(0x0)
30 |
30 |
31 | "{} {}".format(a, b)
| ^^^^^^^^^^^^^^^^^^^^ UP032
32 |
32 |
33 | """{} {}""".format(a, b)
|
= help: Convert to f-string
@ -299,10 +298,10 @@ UP032_0.py:31:1: UP032 [*] Use f-string instead of `format` call
UP032_0.py:33:1: UP032 [*] Use f-string instead of `format` call
|
31 | "{} {}".format(a, b)
32 |
32 |
33 | """{} {}""".format(a, b)
| ^^^^^^^^^^^^^^^^^^^^^^^^ UP032
34 |
34 |
35 | "foo{}".format(1)
|
= help: Convert to f-string
@ -320,10 +319,10 @@ UP032_0.py:33:1: UP032 [*] Use f-string instead of `format` call
UP032_0.py:35:1: UP032 [*] Use f-string instead of `format` call
|
33 | """{} {}""".format(a, b)
34 |
34 |
35 | "foo{}".format(1)
| ^^^^^^^^^^^^^^^^^ UP032
36 |
36 |
37 | r"foo{}".format(1)
|
= help: Convert to f-string
@ -341,10 +340,10 @@ UP032_0.py:35:1: UP032 [*] Use f-string instead of `format` call
UP032_0.py:37:1: UP032 [*] Use f-string instead of `format` call
|
35 | "foo{}".format(1)
36 |
36 |
37 | r"foo{}".format(1)
| ^^^^^^^^^^^^^^^^^^ UP032
38 |
38 |
39 | x = "{a}".format(a=1)
|
= help: Convert to f-string
@ -362,10 +361,10 @@ UP032_0.py:37:1: UP032 [*] Use f-string instead of `format` call
UP032_0.py:39:5: UP032 [*] Use f-string instead of `format` call
|
37 | r"foo{}".format(1)
38 |
38 |
39 | x = "{a}".format(a=1)
| ^^^^^^^^^^^^^^^^^ UP032
40 |
40 |
41 | print("foo {} ".format(x))
|
= help: Convert to f-string
@ -383,10 +382,10 @@ UP032_0.py:39:5: UP032 [*] Use f-string instead of `format` call
UP032_0.py:41:7: UP032 [*] Use f-string instead of `format` call
|
39 | x = "{a}".format(a=1)
40 |
40 |
41 | print("foo {} ".format(x))
| ^^^^^^^^^^^^^^^^^^^ UP032
42 |
42 |
43 | "{a[b]}".format(a=a)
|
= help: Convert to f-string
@ -404,10 +403,10 @@ UP032_0.py:41:7: UP032 [*] Use f-string instead of `format` call
UP032_0.py:43:1: UP032 [*] Use f-string instead of `format` call
|
41 | print("foo {} ".format(x))
42 |
42 |
43 | "{a[b]}".format(a=a)
| ^^^^^^^^^^^^^^^^^^^^ UP032
44 |
44 |
45 | "{a.a[b]}".format(a=a)
|
= help: Convert to f-string
@ -425,10 +424,10 @@ UP032_0.py:43:1: UP032 [*] Use f-string instead of `format` call
UP032_0.py:45:1: UP032 [*] Use f-string instead of `format` call
|
43 | "{a[b]}".format(a=a)
44 |
44 |
45 | "{a.a[b]}".format(a=a)
| ^^^^^^^^^^^^^^^^^^^^^^ UP032
46 |
46 |
47 | "{}{{}}{}".format(escaped, y)
|
= help: Convert to f-string
@ -446,10 +445,10 @@ UP032_0.py:45:1: UP032 [*] Use f-string instead of `format` call
UP032_0.py:47:1: UP032 [*] Use f-string instead of `format` call
|
45 | "{a.a[b]}".format(a=a)
46 |
46 |
47 | "{}{{}}{}".format(escaped, y)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP032
48 |
48 |
49 | "{}".format(a)
|
= help: Convert to f-string
@ -467,10 +466,10 @@ UP032_0.py:47:1: UP032 [*] Use f-string instead of `format` call
UP032_0.py:49:1: UP032 [*] Use f-string instead of `format` call
|
47 | "{}{{}}{}".format(escaped, y)
48 |
48 |
49 | "{}".format(a)
| ^^^^^^^^^^^^^^ UP032
50 |
50 |
51 | '({}={{0!e}})'.format(a)
|
= help: Convert to f-string
@ -488,10 +487,10 @@ UP032_0.py:49:1: UP032 [*] Use f-string instead of `format` call
UP032_0.py:51:1: UP032 [*] Use f-string instead of `format` call
|
49 | "{}".format(a)
50 |
50 |
51 | '({}={{0!e}})'.format(a)
| ^^^^^^^^^^^^^^^^^^^^^^^^ UP032
52 |
52 |
53 | "{[b]}".format(a)
|
= help: Convert to f-string
@ -509,10 +508,10 @@ UP032_0.py:51:1: UP032 [*] Use f-string instead of `format` call
UP032_0.py:53:1: UP032 [*] Use f-string instead of `format` call
|
51 | '({}={{0!e}})'.format(a)
52 |
52 |
53 | "{[b]}".format(a)
| ^^^^^^^^^^^^^^^^^ UP032
54 |
54 |
55 | '{[b]}'.format(a)
|
= help: Convert to f-string
@ -530,10 +529,10 @@ UP032_0.py:53:1: UP032 [*] Use f-string instead of `format` call
UP032_0.py:55:1: UP032 [*] Use f-string instead of `format` call
|
53 | "{[b]}".format(a)
54 |
54 |
55 | '{[b]}'.format(a)
| ^^^^^^^^^^^^^^^^^ UP032
56 |
56 |
57 | """{[b]}""".format(a)
|
= help: Convert to f-string
@ -551,10 +550,10 @@ UP032_0.py:55:1: UP032 [*] Use f-string instead of `format` call
UP032_0.py:57:1: UP032 [*] Use f-string instead of `format` call
|
55 | '{[b]}'.format(a)
56 |
56 |
57 | """{[b]}""".format(a)
| ^^^^^^^^^^^^^^^^^^^^^ UP032
58 |
58 |
59 | '''{[b]}'''.format(a)
|
= help: Convert to f-string
@ -572,10 +571,10 @@ UP032_0.py:57:1: UP032 [*] Use f-string instead of `format` call
UP032_0.py:59:1: UP032 [*] Use f-string instead of `format` call
|
57 | """{[b]}""".format(a)
58 |
58 |
59 | '''{[b]}'''.format(a)
| ^^^^^^^^^^^^^^^^^^^^^ UP032
60 |
60 |
61 | "{}".format(
|
= help: Convert to f-string
@ -593,12 +592,12 @@ UP032_0.py:59:1: UP032 [*] Use f-string instead of `format` call
UP032_0.py:61:1: UP032 [*] Use f-string instead of `format` call
|
59 | '''{[b]}'''.format(a)
60 |
60 |
61 | / "{}".format(
62 | | 1
63 | | )
| |_^ UP032
64 |
64 |
65 | "123456789 {}".format(
|
= help: Convert to f-string
@ -618,12 +617,12 @@ UP032_0.py:61:1: UP032 [*] Use f-string instead of `format` call
UP032_0.py:65:1: UP032 [*] Use f-string instead of `format` call
|
63 | )
64 |
64 |
65 | / "123456789 {}".format(
66 | | 1111111111111111111111111111111111111111111111111111111111111111111111111,
67 | | )
| |_^ UP032
68 |
68 |
69 | """
|
= help: Convert to f-string
@ -643,12 +642,12 @@ UP032_0.py:65:1: UP032 [*] Use f-string instead of `format` call
UP032_0.py:69:1: UP032 [*] Use f-string instead of `format` call
|
67 | )
68 |
68 |
69 | / """
70 | | {}
71 | | """.format(1)
| |_____________^ UP032
72 |
72 |
73 | aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = """
|
= help: Convert to f-string
@ -669,7 +668,7 @@ UP032_0.py:69:1: UP032 [*] Use f-string instead of `format` call
UP032_0.py:73:85: UP032 [*] Use f-string instead of `format` call
|
71 | """.format(1)
72 |
72 |
73 | aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = """
| _____________________________________________________________________________________^
74 | | {}
@ -677,7 +676,7 @@ UP032_0.py:73:85: UP032 [*] Use f-string instead of `format` call
76 | | 111111
77 | | )
| |_^ UP032
78 |
78 |
79 | "{a}" "{b}".format(a=1, b=1)
|
= help: Convert to f-string
@ -701,10 +700,10 @@ UP032_0.py:73:85: UP032 [*] Use f-string instead of `format` call
UP032_0.py:79:1: UP032 [*] Use f-string instead of `format` call
|
77 | )
78 |
78 |
79 | "{a}" "{b}".format(a=1, b=1)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP032
80 |
80 |
81 | (
|
= help: Convert to f-string
@ -722,13 +721,13 @@ UP032_0.py:79:1: UP032 [*] Use f-string instead of `format` call
UP032_0.py:81:1: UP032 [*] Use f-string instead of `format` call
|
79 | "{a}" "{b}".format(a=1, b=1)
80 |
80 |
81 | / (
82 | | "{a}"
83 | | "{b}"
84 | | ).format(a=1, b=1)
| |__________________^ UP032
85 |
85 |
86 | (
|
= help: Convert to f-string
@ -750,7 +749,7 @@ UP032_0.py:81:1: UP032 [*] Use f-string instead of `format` call
UP032_0.py:86:1: UP032 [*] Use f-string instead of `format` call
|
84 | ).format(a=1, b=1)
85 |
85 |
86 | / (
87 | | "{a}"
88 | | ""
@ -758,7 +757,7 @@ UP032_0.py:86:1: UP032 [*] Use f-string instead of `format` call
90 | | ""
91 | | ).format(a=1, b=1)
| |__________________^ UP032
92 |
92 |
93 | (
|
= help: Convert to f-string
@ -782,8 +781,7 @@ UP032_0.py:86:1: UP032 [*] Use f-string instead of `format` call
UP032_0.py:94:5: UP032 [*] Use f-string instead of `format` call
|
93 | (
94 | (
| _____^
94 | / (
95 | | # comment
96 | | "{a}"
97 | | # comment
@ -816,7 +814,7 @@ UP032_0.py:94:5: UP032 [*] Use f-string instead of `format` call
UP032_0.py:104:1: UP032 [*] Use f-string instead of `format` call
|
102 | )
103 |
103 |
104 | / (
105 | | "{a}"
106 | | "b"
@ -931,7 +929,7 @@ UP032_0.py:129:1: UP032 [*] Use f-string instead of `format` call
|
129 | "{}".format(1 * 2)
| ^^^^^^^^^^^^^^^^^^ UP032
130 |
130 |
131 | ###
|
= help: Convert to f-string
@ -949,12 +947,12 @@ UP032_0.py:129:1: UP032 [*] Use f-string instead of `format` call
UP032_0.py:160:1: UP032 [*] Use f-string instead of `format` call
|
158 | r'"\N{snowman} {}".format(a)'
159 |
159 |
160 | / "123456789 {}".format(
161 | | 11111111111111111111111111111111111111111111111111111111111111111111111111,
162 | | )
| |_^ UP032
163 |
163 |
164 | """
|
= help: Convert to f-string
@ -974,7 +972,7 @@ UP032_0.py:160:1: UP032 [*] Use f-string instead of `format` call
UP032_0.py:164:1: UP032 [*] Use f-string instead of `format` call
|
162 | )
163 |
163 |
164 | / """
165 | | {}
166 | | {}
@ -985,7 +983,7 @@ UP032_0.py:164:1: UP032 [*] Use f-string instead of `format` call
171 | | 111111111111111111111111111111111111111111111111111111111111111111111111111111111111111,
172 | | )
| |_^ UP032
173 |
173 |
174 | aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = """{}
|
= help: Convert to f-string
@ -1014,14 +1012,14 @@ UP032_0.py:164:1: UP032 [*] Use f-string instead of `format` call
UP032_0.py:174:84: UP032 [*] Use f-string instead of `format` call
|
172 | )
173 |
173 |
174 | aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = """{}
| ____________________________________________________________________________________^
175 | | """.format(
176 | | 111111
177 | | )
| |_^ UP032
178 |
178 |
179 | "{}".format(
|
= help: Convert to f-string
@ -1043,7 +1041,7 @@ UP032_0.py:174:84: UP032 [*] Use f-string instead of `format` call
UP032_0.py:202:1: UP032 Use f-string instead of `format` call
|
200 | "{}".format(**c)
201 |
201 |
202 | / "{}".format(
203 | | 1 # comment
204 | | )
@ -1057,7 +1055,7 @@ UP032_0.py:209:1: UP032 [*] Use f-string instead of `format` call
208 | # existing line length, so it's fine.
209 | "<Customer: {}, {}, {}, {}, {}>".format(self.internal_ids, self.external_ids, self.properties, self.tags, self.others)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP032
210 |
210 |
211 | # When fixing, trim the trailing empty string.
|
= help: Convert to f-string
@ -1079,7 +1077,7 @@ UP032_0.py:212:18: UP032 [*] Use f-string instead of `format` call
| __________________^
213 | | "".format(new_dict, d))
| |_______________________________________^ UP032
214 |
214 |
215 | # When fixing, trim the trailing empty string.
|
= help: Convert to f-string
@ -1102,7 +1100,7 @@ UP032_0.py:216:18: UP032 [*] Use f-string instead of `format` call
| __________________^
217 | | .format(new_dict, d))
| |_____________________________________^ UP032
218 |
218 |
219 | raise ValueError(
|
= help: Convert to f-string
@ -1122,8 +1120,7 @@ UP032_0.py:216:18: UP032 [*] Use f-string instead of `format` call
UP032_0.py:220:5: UP032 [*] Use f-string instead of `format` call
|
219 | raise ValueError(
220 | "Conflicting configuration dicts: {!r} {!r}"
| _____^
220 | / "Conflicting configuration dicts: {!r} {!r}"
221 | | "".format(new_dict, d)
| |__________________________^ UP032
222 | )
@ -1144,11 +1141,10 @@ UP032_0.py:220:5: UP032 [*] Use f-string instead of `format` call
UP032_0.py:225:5: UP032 [*] Use f-string instead of `format` call
|
224 | raise ValueError(
225 | "Conflicting configuration dicts: {!r} {!r}"
| _____^
225 | / "Conflicting configuration dicts: {!r} {!r}"
226 | | "".format(new_dict, d)
| |__________________________^ UP032
227 |
227 |
228 | )
|
= help: Convert to f-string
@ -1172,7 +1168,7 @@ UP032_0.py:231:1: UP032 [*] Use f-string instead of `format` call
233 | | "{{}}"
234 | | ).format(a)
| |___________^ UP032
235 |
235 |
236 | ("{}" "{{}}").format(a)
|
= help: Convert to f-string
@ -1193,7 +1189,7 @@ UP032_0.py:231:1: UP032 [*] Use f-string instead of `format` call
UP032_0.py:236:1: UP032 [*] Use f-string instead of `format` call
|
234 | ).format(a)
235 |
235 |
236 | ("{}" "{{}}").format(a)
| ^^^^^^^^^^^^^^^^^^^^^^^ UP032
|
@ -1217,7 +1213,7 @@ UP032_0.py:240:1: UP032 [*] Use f-string instead of `format` call
242 | | "{{{}}}"
243 | | ).format(a, b)
| |______________^ UP032
244 |
244 |
245 | ("{}" "{{{}}}").format(a, b)
|
= help: Convert to f-string
@ -1239,10 +1235,10 @@ UP032_0.py:240:1: UP032 [*] Use f-string instead of `format` call
UP032_0.py:245:1: UP032 [*] Use f-string instead of `format` call
|
243 | ).format(a, b)
244 |
244 |
245 | ("{}" "{{{}}}").format(a, b)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP032
246 |
246 |
247 | # The dictionary should be parenthesized.
|
= help: Convert to f-string
@ -1262,7 +1258,7 @@ UP032_0.py:248:1: UP032 [*] Use f-string instead of `format` call
247 | # The dictionary should be parenthesized.
248 | "{}".format({0: 1}[0])
| ^^^^^^^^^^^^^^^^^^^^^^ UP032
249 |
249 |
250 | # The dictionary should be parenthesized.
|
= help: Convert to f-string
@ -1282,7 +1278,7 @@ UP032_0.py:251:1: UP032 [*] Use f-string instead of `format` call
250 | # The dictionary should be parenthesized.
251 | "{}".format({0: 1}.bar)
| ^^^^^^^^^^^^^^^^^^^^^^^ UP032
252 |
252 |
253 | # The dictionary should be parenthesized.
|
= help: Convert to f-string
@ -1302,7 +1298,7 @@ UP032_0.py:254:1: UP032 [*] Use f-string instead of `format` call
253 | # The dictionary should be parenthesized.
254 | "{}".format({0: 1}())
| ^^^^^^^^^^^^^^^^^^^^^ UP032
255 |
255 |
256 | # The string shouldn't be converted, since it would require repeating the function call.
|
= help: Convert to f-string
@ -1322,7 +1318,7 @@ UP032_0.py:261:1: UP032 [*] Use f-string instead of `format` call
260 | # The string _should_ be converted, since the function call is repeated in the arguments.
261 | "{0} {1}".format(foo(), foo())
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP032
262 |
262 |
263 | # The call should be removed, but the string itself should remain.
|
= help: Convert to f-string
@ -1342,7 +1338,7 @@ UP032_0.py:264:1: UP032 [*] Use f-string instead of `format` call
263 | # The call should be removed, but the string itself should remain.
264 | ''.format(self.project)
| ^^^^^^^^^^^^^^^^^^^^^^^ UP032
265 |
265 |
266 | # The call should be removed, but the string itself should remain.
|
= help: Convert to f-string
@ -1362,7 +1358,7 @@ UP032_0.py:267:1: UP032 [*] Use f-string instead of `format` call
266 | # The call should be removed, but the string itself should remain.
267 | "".format(self.project)
| ^^^^^^^^^^^^^^^^^^^^^^^ UP032
268 |
268 |
269 | # Not a valid type annotation but this test shouldn't result in a panic.
|
= help: Convert to f-string

View File

@ -1,13 +1,12 @@
---
source: crates/ruff_linter/src/rules/pyupgrade/mod.rs
snapshot_kind: text
---
UP035.py:2:1: UP035 [*] Import from `collections.abc` instead: `Mapping`
|
1 | # UP035
2 | from collections import Mapping
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035
3 |
3 |
4 | from collections import Mapping as MAP
|
= help: Import from `collections.abc`
@ -23,10 +22,10 @@ UP035.py:2:1: UP035 [*] Import from `collections.abc` instead: `Mapping`
UP035.py:4:1: UP035 [*] Import from `collections.abc` instead: `Mapping`
|
2 | from collections import Mapping
3 |
3 |
4 | from collections import Mapping as MAP
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035
5 |
5 |
6 | from collections import Mapping, Sequence
|
= help: Import from `collections.abc`
@ -44,10 +43,10 @@ UP035.py:4:1: UP035 [*] Import from `collections.abc` instead: `Mapping`
UP035.py:6:1: UP035 [*] Import from `collections.abc` instead: `Mapping`, `Sequence`
|
4 | from collections import Mapping as MAP
5 |
5 |
6 | from collections import Mapping, Sequence
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035
7 |
7 |
8 | from collections import Counter, Mapping
|
= help: Import from `collections.abc`
@ -65,10 +64,10 @@ UP035.py:6:1: UP035 [*] Import from `collections.abc` instead: `Mapping`, `Seque
UP035.py:8:1: UP035 [*] Import from `collections.abc` instead: `Mapping`
|
6 | from collections import Mapping, Sequence
7 |
7 |
8 | from collections import Counter, Mapping
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035
9 |
9 |
10 | from collections import (Counter, Mapping)
|
= help: Import from `collections.abc`
@ -87,10 +86,10 @@ UP035.py:8:1: UP035 [*] Import from `collections.abc` instead: `Mapping`
UP035.py:10:1: UP035 [*] Import from `collections.abc` instead: `Mapping`
|
8 | from collections import Counter, Mapping
9 |
9 |
10 | from collections import (Counter, Mapping)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035
11 |
11 |
12 | from collections import (Counter,
|
= help: Import from `collections.abc`
@ -109,11 +108,11 @@ UP035.py:10:1: UP035 [*] Import from `collections.abc` instead: `Mapping`
UP035.py:12:1: UP035 [*] Import from `collections.abc` instead: `Mapping`
|
10 | from collections import (Counter, Mapping)
11 |
11 |
12 | / from collections import (Counter,
13 | | Mapping)
| |_________________________________^ UP035
14 |
14 |
15 | from collections import Counter, \
|
= help: Import from `collections.abc`
@ -133,11 +132,11 @@ UP035.py:12:1: UP035 [*] Import from `collections.abc` instead: `Mapping`
UP035.py:15:1: UP035 [*] Import from `collections.abc` instead: `Mapping`
|
13 | Mapping)
14 |
14 |
15 | / from collections import Counter, \
16 | | Mapping
| |________________________________^ UP035
17 |
17 |
18 | from collections import Counter, Mapping, Sequence
|
= help: Import from `collections.abc`
@ -157,10 +156,10 @@ UP035.py:15:1: UP035 [*] Import from `collections.abc` instead: `Mapping`
UP035.py:18:1: UP035 [*] Import from `collections.abc` instead: `Mapping`, `Sequence`
|
16 | Mapping
17 |
17 |
18 | from collections import Counter, Mapping, Sequence
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035
19 |
19 |
20 | from collections import Mapping as mapping, Counter
|
= help: Import from `collections.abc`
@ -179,10 +178,10 @@ UP035.py:18:1: UP035 [*] Import from `collections.abc` instead: `Mapping`, `Sequ
UP035.py:20:1: UP035 [*] Import from `collections.abc` instead: `Mapping`
|
18 | from collections import Counter, Mapping, Sequence
19 |
19 |
20 | from collections import Mapping as mapping, Counter
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035
21 |
21 |
22 | if True:
|
= help: Import from `collections.abc`
@ -203,7 +202,7 @@ UP035.py:23:5: UP035 [*] Import from `collections.abc` instead: `Mapping`
22 | if True:
23 | from collections import Mapping, Counter
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035
24 |
24 |
25 | if True:
|
= help: Import from `collections.abc`
@ -225,7 +224,7 @@ UP035.py:28:5: UP035 [*] Import from `collections.abc` instead: `Mapping`
27 | pass
28 | from collections import Mapping, Counter
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035
29 |
29 |
30 | if True: from collections import Mapping
|
= help: Import from `collections.abc`
@ -244,10 +243,10 @@ UP035.py:28:5: UP035 [*] Import from `collections.abc` instead: `Mapping`
UP035.py:30:10: UP035 [*] Import from `collections.abc` instead: `Mapping`
|
28 | from collections import Mapping, Counter
29 |
29 |
30 | if True: from collections import Mapping
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035
31 |
31 |
32 | import os
|
= help: Import from `collections.abc`
@ -285,15 +284,14 @@ UP035.py:33:1: UP035 [*] Import from `collections.abc` instead: `Mapping`
UP035.py:37:5: UP035 [*] Import from `collections.abc` instead: `Mapping`, `Callable`
|
36 | if True:
37 | from collections import (
| _____^
37 | / from collections import (
38 | | Mapping,
39 | | Callable,
40 | | Bad,
41 | | Good,
42 | | )
| |_____^ UP035
43 |
43 |
44 | from typing import Callable, Match, Pattern, List, OrderedDict, AbstractSet, ContextManager
|
= help: Import from `collections.abc`
@ -315,10 +313,10 @@ UP035.py:37:5: UP035 [*] Import from `collections.abc` instead: `Mapping`, `Call
UP035.py:44:1: UP035 [*] Import from `collections.abc` instead: `Callable`
|
42 | )
43 |
43 |
44 | from typing import Callable, Match, Pattern, List, OrderedDict, AbstractSet, ContextManager
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035
45 |
45 |
46 | if True: from collections import (
|
= help: Import from `collections.abc`
@ -337,10 +335,10 @@ UP035.py:44:1: UP035 [*] Import from `collections.abc` instead: `Callable`
UP035.py:44:1: UP035 [*] Import from `collections` instead: `OrderedDict`
|
42 | )
43 |
43 |
44 | from typing import Callable, Match, Pattern, List, OrderedDict, AbstractSet, ContextManager
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035
45 |
45 |
46 | if True: from collections import (
|
= help: Import from `collections`
@ -359,10 +357,10 @@ UP035.py:44:1: UP035 [*] Import from `collections` instead: `OrderedDict`
UP035.py:44:1: UP035 [*] Import from `re` instead: `Match`, `Pattern`
|
42 | )
43 |
43 |
44 | from typing import Callable, Match, Pattern, List, OrderedDict, AbstractSet, ContextManager
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035
45 |
45 |
46 | if True: from collections import (
|
= help: Import from `re`
@ -381,42 +379,42 @@ UP035.py:44:1: UP035 [*] Import from `re` instead: `Match`, `Pattern`
UP035.py:44:1: UP035 `typing.List` is deprecated, use `list` instead
|
42 | )
43 |
43 |
44 | from typing import Callable, Match, Pattern, List, OrderedDict, AbstractSet, ContextManager
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035
45 |
45 |
46 | if True: from collections import (
|
UP035.py:44:1: UP035 `typing.AbstractSet` is deprecated, use `collections.abc.Set` instead
|
42 | )
43 |
43 |
44 | from typing import Callable, Match, Pattern, List, OrderedDict, AbstractSet, ContextManager
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035
45 |
45 |
46 | if True: from collections import (
|
UP035.py:44:1: UP035 `typing.ContextManager` is deprecated, use `contextlib.AbstractContextManager` instead
|
42 | )
43 |
43 |
44 | from typing import Callable, Match, Pattern, List, OrderedDict, AbstractSet, ContextManager
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035
45 |
45 |
46 | if True: from collections import (
|
UP035.py:46:10: UP035 Import from `collections.abc` instead: `Mapping`
|
44 | from typing import Callable, Match, Pattern, List, OrderedDict, AbstractSet, ContextManager
45 |
45 |
46 | if True: from collections import (
| __________^
47 | | Mapping, Counter)
| |_____________________^ UP035
48 |
48 |
49 | # Bad imports from PYI027 that are now handled by PYI022 (UP035)
|
= help: Import from `collections.abc`
@ -1001,7 +999,7 @@ UP035.py:84:1: UP035 [*] Import from `typing` instead: `SupportsIndex`
83 | # UP035 on py312+ only
84 | from typing_extensions import SupportsIndex
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035
85 |
85 |
86 | # UP035 on py312+ only
|
= help: Import from `typing`
@ -1021,7 +1019,7 @@ UP035.py:87:1: UP035 [*] Import from `typing` instead: `NamedTuple`
86 | # UP035 on py312+ only
87 | from typing_extensions import NamedTuple
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035
88 |
88 |
89 | # UP035 on py312+ only: `typing_extensions` supports `frozen_default` (backported from 3.12).
|
= help: Import from `typing`
@ -1041,7 +1039,7 @@ UP035.py:90:1: UP035 [*] Import from `typing` instead: `dataclass_transform`
89 | # UP035 on py312+ only: `typing_extensions` supports `frozen_default` (backported from 3.12).
90 | from typing_extensions import dataclass_transform
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035
91 |
91 |
92 | # UP035
|
= help: Import from `typing`
@ -1061,7 +1059,7 @@ UP035.py:93:1: UP035 [*] Import from `enum` instead: `StrEnum`
92 | # UP035
93 | from backports.strenum import StrEnum
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035
94 |
94 |
95 | # UP035
|
= help: Import from `enum`
@ -1081,7 +1079,7 @@ UP035.py:96:1: UP035 [*] Import from `typing` instead: `override`
95 | # UP035
96 | from typing_extensions import override
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035
97 |
97 |
98 | # UP035
|
= help: Import from `typing`
@ -1101,7 +1099,7 @@ UP035.py:99:1: UP035 [*] Import from `collections.abc` instead: `Buffer`
98 | # UP035
99 | from typing_extensions import Buffer
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035
100 |
100 |
101 | # UP035
|
= help: Import from `collections.abc`
@ -1121,7 +1119,7 @@ UP035.py:102:1: UP035 [*] Import from `types` instead: `get_original_bases`
101 | # UP035
102 | from typing_extensions import get_original_bases
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035
103 |
103 |
104 | # UP035 on py313+ only
|
= help: Import from `types`
@ -1141,7 +1139,7 @@ UP035.py:105:1: UP035 [*] Import from `typing` instead: `TypeVar`
104 | # UP035 on py313+ only
105 | from typing_extensions import TypeVar
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035
106 |
106 |
107 | # UP035 on py313+ only
|
= help: Import from `typing`
@ -1161,7 +1159,7 @@ UP035.py:108:1: UP035 [*] Import from `types` instead: `CapsuleType`
107 | # UP035 on py313+ only
108 | from typing_extensions import CapsuleType
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035
109 |
109 |
110 | # UP035 on py313+ only
|
= help: Import from `types`

View File

@ -1,12 +1,11 @@
---
source: crates/ruff_linter/src/rules/refurb/mod.rs
snapshot_kind: text
---
FURB110.py:1:5: FURB110 [*] Replace ternary `if` expression with `or` operator
|
1 | z = x if x else y # FURB110
| ^^^^^^^^^^^^^ FURB110
2 |
2 |
3 | z = x \
|
= help: Replace with `or` operator
@ -21,12 +20,12 @@ FURB110.py:1:5: FURB110 [*] Replace ternary `if` expression with `or` operator
FURB110.py:3:5: FURB110 [*] Replace ternary `if` expression with `or` operator
|
1 | z = x if x else y # FURB110
2 |
2 |
3 | z = x \
| _____^
4 | | if x else y # FURB110
| |_______________^ FURB110
5 |
5 |
6 | z = x if x \
|
= help: Replace with `or` operator
@ -44,13 +43,13 @@ FURB110.py:3:5: FURB110 [*] Replace ternary `if` expression with `or` operator
FURB110.py:6:5: FURB110 [*] Replace ternary `if` expression with `or` operator
|
4 | if x else y # FURB110
5 |
5 |
6 | z = x if x \
| _____^
7 | | else \
8 | | y # FURB110
| |_________^ FURB110
9 |
9 |
10 | z = x() if x() else y() # FURB110
|
= help: Replace with `or` operator
@ -70,10 +69,10 @@ FURB110.py:6:5: FURB110 [*] Replace ternary `if` expression with `or` operator
FURB110.py:10:5: FURB110 [*] Replace ternary `if` expression with `or` operator
|
8 | y # FURB110
9 |
9 |
10 | z = x() if x() else y() # FURB110
| ^^^^^^^^^^^^^^^^^^^ FURB110
11 |
11 |
12 | # FURB110
|
= help: Replace with `or` operator
@ -100,7 +99,7 @@ FURB110.py:13:5: FURB110 [*] Replace ternary `if` expression with `or` operator
18 | | y
19 | | )
| |_^ FURB110
20 |
20 |
21 | # FURB110
|
= help: Replace with `or` operator
@ -123,8 +122,7 @@ FURB110.py:23:5: FURB110 [*] Replace ternary `if` expression with `or` operator
|
21 | # FURB110
22 | z = (
23 | x if (
| _____^
23 | / x if (
24 | | # Test for x.
25 | | x
26 | | ) else (
@ -154,8 +152,7 @@ FURB110.py:34:5: FURB110 [*] Replace ternary `if` expression with `or` operator
|
32 | # FURB110
33 | z = (
34 | x if
| _____^
34 | / x if
35 | | # If true, use x.
36 | | x
37 | | # Otherwise, use y.
@ -185,8 +182,7 @@ FURB110.py:44:5: FURB110 [*] Replace ternary `if` expression with `or` operator
|
42 | # FURB110
43 | z = (
44 | x
| _____^
44 | / x
45 | | if x
46 | | else y
47 | | if y > 0

View File

@ -1,6 +1,5 @@
---
source: crates/ruff_linter/src/rules/refurb/mod.rs
snapshot_kind: text
---
FURB113.py:23:1: FURB113 [*] Use `nums.extend((1, 2))` instead of repeatedly calling `nums.append()`
|
@ -156,8 +155,7 @@ FURB113.py:69:5: FURB113 [*] Use `nums.extend((1, 2))` instead of repeatedly cal
|
67 | if True:
68 | # FURB113
69 | nums.append(1)
| _____^
69 | / nums.append(1)
70 | | nums.append(2)
| |__________________^ FURB113
|
@ -178,8 +176,7 @@ FURB113.py:75:5: FURB113 [*] Use `nums.extend((1, 2))` instead of repeatedly cal
|
73 | if True:
74 | # FURB113
75 | nums.append(1)
| _____^
75 | / nums.append(1)
76 | | nums.append(2)
| |__________________^ FURB113
77 | pass
@ -201,8 +198,7 @@ FURB113.py:82:5: FURB113 Use `nums.extend((1, 2, 3))` instead of repeatedly call
|
80 | if True:
81 | # FURB113
82 | nums.append(1)
| _____^
82 | / nums.append(1)
83 | | nums2.append(1)
84 | | nums.append(2)
85 | | nums.append(3)
@ -214,8 +210,7 @@ FURB113.py:90:5: FURB113 [*] Use `x.extend((1, 2))` instead of repeatedly callin
|
88 | def yes_one(x: list[int]):
89 | # FURB113
90 | x.append(1)
| _____^
90 | / x.append(1)
91 | | x.append(2)
| |_______________^ FURB113
|
@ -236,8 +231,7 @@ FURB113.py:96:5: FURB113 [*] Use `x.extend((1, 2))` instead of repeatedly callin
|
94 | def yes_two(x: List[int]):
95 | # FURB113
96 | x.append(1)
| _____^
96 | / x.append(1)
97 | | x.append(2)
| |_______________^ FURB113
|
@ -258,8 +252,7 @@ FURB113.py:102:5: FURB113 [*] Use `x.extend((1, 2))` instead of repeatedly calli
|
100 | def yes_three(*, x: list[int]):
101 | # FURB113
102 | x.append(1)
| _____^
102 | / x.append(1)
103 | | x.append(2)
| |_______________^ FURB113
|
@ -280,8 +273,7 @@ FURB113.py:108:5: FURB113 [*] Use `x.extend((1, 2))` instead of repeatedly calli
|
106 | def yes_four(x: list[int], /):
107 | # FURB113
108 | x.append(1)
| _____^
108 | / x.append(1)
109 | | x.append(2)
| |_______________^ FURB113
|
@ -302,8 +294,7 @@ FURB113.py:114:5: FURB113 Use `x.extend((1, 2, 3))` instead of repeatedly callin
|
112 | def yes_five(x: list[int], y: list[int]):
113 | # FURB113
114 | x.append(1)
| _____^
114 | / x.append(1)
115 | | x.append(2)
116 | | y.append(1)
117 | | x.append(3)
@ -315,8 +306,7 @@ FURB113.py:122:5: FURB113 [*] Use `x.extend((1, 2))` instead of repeatedly calli
|
120 | def yes_six(x: list):
121 | # FURB113
122 | x.append(1)
| _____^
122 | / x.append(1)
123 | | x.append(2)
| |_______________^ FURB113
|
@ -337,8 +327,7 @@ FURB113.py:128:5: FURB113 Use `nums.extend((1, 2, 3))` instead of repeatedly cal
|
126 | if True:
127 | # FURB113
128 | nums.append(1)
| _____^
128 | / nums.append(1)
129 | | # comment
130 | | nums.append(2)
131 | | # comment

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