mirror of https://github.com/astral-sh/ruff
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:
parent
3fa4479c85
commit
f29f58105b
|
|
@ -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
|
||||
|
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -1,12 +1,10 @@
|
|||
---
|
||||
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 |
|
||||
|
|
@ -17,8 +15,7 @@ B027.py:21:5: B027 `AbstractClass.empty_2` is an empty method in an abstract bas
|
|||
|
|
||||
19 | ...
|
||||
20 |
|
||||
21 | def empty_2(self): # error
|
||||
| _____^
|
||||
21 | / def empty_2(self): # error
|
||||
22 | | pass
|
||||
| |____________^ B027
|
||||
23 |
|
||||
|
|
@ -29,8 +26,7 @@ B027.py:24:5: B027 `AbstractClass.empty_3` is an empty method in an abstract bas
|
|||
|
|
||||
22 | pass
|
||||
23 |
|
||||
24 | def empty_3(self): # error
|
||||
| _____^
|
||||
24 | / def empty_3(self): # error
|
||||
25 | | """docstring"""
|
||||
26 | | ...
|
||||
| |___________^ B027
|
||||
|
|
@ -42,8 +38,7 @@ B027.py:28:5: B027 `AbstractClass.empty_4` is an empty method in an abstract bas
|
|||
|
|
||||
26 | ...
|
||||
27 |
|
||||
28 | def empty_4(self): # error
|
||||
| _____^
|
||||
28 | / def empty_4(self): # error
|
||||
29 | | """multiple ellipsis/pass"""
|
||||
30 | | ...
|
||||
31 | | pass
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
---
|
||||
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
|
||||
|
|
||||
|
|
@ -22,8 +21,7 @@ DJ012.py:56:5: DJ012 Order of model's inner classes, methods, and fields does no
|
|||
|
|
||||
54 | pass
|
||||
55 |
|
||||
56 | def __str__(self):
|
||||
| _____^
|
||||
56 | / def __str__(self):
|
||||
57 | | return "foobar"
|
||||
| |_______________________^ DJ012
|
||||
|
|
||||
|
|
@ -32,8 +30,7 @@ DJ012.py:69:5: DJ012 Order of model's inner classes, methods, and fields does no
|
|||
|
|
||||
67 | pass
|
||||
68 |
|
||||
69 | def save(self):
|
||||
| _____^
|
||||
69 | / def save(self):
|
||||
70 | | pass
|
||||
| |____________^ DJ012
|
||||
|
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
||||
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
||||
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -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 | )
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
---
|
||||
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
|
||||
|
|
||||
|
|
@ -17,8 +16,7 @@ ISC.py:5:5: ISC002 Implicitly concatenated string literals over multiple lines
|
|||
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"""
|
||||
|
|
|
|||
|
|
@ -155,8 +155,7 @@ PIE800.py:30:9: PIE800 [*] Unnecessary spread `**`
|
|||
|
|
||||
28 | "data": [],
|
||||
29 | **( # Comment
|
||||
30 | { # Comment
|
||||
| _________^
|
||||
30 | / { # Comment
|
||||
31 | | "count": 1 if include_count else {}}),
|
||||
| |________________________________________________^ PIE800
|
||||
32 | }
|
||||
|
|
@ -181,8 +180,7 @@ PIE800.py:37:9: PIE800 [*] Unnecessary spread `**`
|
|||
|
|
||||
35 | "data": [],
|
||||
36 | **(
|
||||
37 | {
|
||||
| _________^
|
||||
37 | / {
|
||||
38 | | "count": (a := 1),}),
|
||||
| |_______________________________^ PIE800
|
||||
39 | }
|
||||
|
|
@ -207,8 +205,7 @@ PIE800.py:44:9: PIE800 [*] Unnecessary spread `**`
|
|||
|
|
||||
42 | "data": [],
|
||||
43 | **(
|
||||
44 | {
|
||||
| _________^
|
||||
44 | / {
|
||||
45 | | "count": (a := 1)
|
||||
46 | | }
|
||||
| |_____________^ PIE800
|
||||
|
|
@ -238,8 +235,7 @@ PIE800.py:54:9: PIE800 [*] Unnecessary spread `**`
|
|||
|
|
||||
52 | "data": [],
|
||||
53 | **(
|
||||
54 | {
|
||||
| _________^
|
||||
54 | / {
|
||||
55 | | "count": (a := 1), # Comment
|
||||
56 | | } # Comment
|
||||
| |_____________^ PIE800
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
---
|
||||
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
|
||||
|
|
||||
|
|
@ -81,8 +80,7 @@ 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
|
||||
| _____^
|
||||
15 | / """Multiline docstring
|
||||
16 | |
|
||||
17 | | Lorem ipsum dolor sit amet
|
||||
18 | | """
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 | ,
|
||||
|
|
|
|||
|
|
@ -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 | | ),
|
||||
|
|
|
|||
|
|
@ -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 | | ),
|
||||
|
|
|
|||
|
|
@ -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 | | ),
|
||||
|
|
|
|||
|
|
@ -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 | | ),
|
||||
|
|
|
|||
|
|
@ -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 | | ),
|
||||
|
|
|
|||
|
|
@ -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 | | ],
|
||||
|
|
|
|||
|
|
@ -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 | | ],
|
||||
|
|
|
|||
|
|
@ -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,8 +13,7 @@ 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
|
||||
|
|
@ -28,8 +25,7 @@ PT012.py:52:5: PT012 `pytest.raises()` block should contain a single simple stat
|
|||
|
|
||||
50 | [].size
|
||||
51 |
|
||||
52 | with pytest.raises(AttributeError):
|
||||
| _____^
|
||||
52 | / with pytest.raises(AttributeError):
|
||||
53 | | for i in []:
|
||||
54 | | [].size
|
||||
| |___________________^ PT012
|
||||
|
|
@ -41,8 +37,7 @@ PT012.py:56:5: PT012 `pytest.raises()` block should contain a single simple stat
|
|||
|
|
||||
54 | [].size
|
||||
55 |
|
||||
56 | with pytest.raises(AttributeError):
|
||||
| _____^
|
||||
56 | / with pytest.raises(AttributeError):
|
||||
57 | | async for i in []:
|
||||
58 | | [].size
|
||||
| |___________________^ PT012
|
||||
|
|
@ -54,8 +49,7 @@ PT012.py:60:5: PT012 `pytest.raises()` block should contain a single simple stat
|
|||
|
|
||||
58 | [].size
|
||||
59 |
|
||||
60 | with pytest.raises(AttributeError):
|
||||
| _____^
|
||||
60 | / with pytest.raises(AttributeError):
|
||||
61 | | while True:
|
||||
62 | | [].size
|
||||
| |___________________^ PT012
|
||||
|
|
@ -67,8 +61,7 @@ PT012.py:64:5: PT012 `pytest.raises()` block should contain a single simple stat
|
|||
|
|
||||
62 | [].size
|
||||
63 |
|
||||
64 | with pytest.raises(AttributeError):
|
||||
| _____^
|
||||
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:
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -356,8 +353,7 @@ 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])
|
||||
|
|
@ -385,8 +381,7 @@ PT018.py:65:5: PT018 [*] Assertion should be broken down into multiple parts
|
|||
|
|
||||
63 | )
|
||||
64 |
|
||||
65 | assert (not (
|
||||
| _____^
|
||||
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])
|
||||
|
|
|
|||
|
|
@ -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`
|
||||
|
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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,8 +13,7 @@ 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
|
||||
|
|
@ -28,8 +25,7 @@ PT031.py:52:5: PT031 `pytest.warns()` block should contain a single simple state
|
|||
|
|
||||
50 | foo()
|
||||
51 |
|
||||
52 | with pytest.warns(UserWarning):
|
||||
| _____^
|
||||
52 | / with pytest.warns(UserWarning):
|
||||
53 | | for i in []:
|
||||
54 | | foo()
|
||||
| |_________________^ PT031
|
||||
|
|
@ -41,8 +37,7 @@ PT031.py:56:5: PT031 `pytest.warns()` block should contain a single simple state
|
|||
|
|
||||
54 | foo()
|
||||
55 |
|
||||
56 | with pytest.warns(UserWarning):
|
||||
| _____^
|
||||
56 | / with pytest.warns(UserWarning):
|
||||
57 | | async for i in []:
|
||||
58 | | foo()
|
||||
| |_________________^ PT031
|
||||
|
|
@ -54,8 +49,7 @@ PT031.py:60:5: PT031 `pytest.warns()` block should contain a single simple state
|
|||
|
|
||||
58 | foo()
|
||||
59 |
|
||||
60 | with pytest.warns(UserWarning):
|
||||
| _____^
|
||||
60 | / with pytest.warns(UserWarning):
|
||||
61 | | while True:
|
||||
62 | | foo()
|
||||
| |_________________^ PT031
|
||||
|
|
@ -67,8 +61,7 @@ PT031.py:64:5: PT031 `pytest.warns()` block should contain a single simple state
|
|||
|
|
||||
62 | foo()
|
||||
63 |
|
||||
64 | with pytest.warns(UserWarning):
|
||||
| _____^
|
||||
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:
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
---
|
||||
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
|
||||
|
|
||||
|
|
@ -32,8 +31,7 @@ docstring_doubles.py:16:5: Q001 [*] Double quote multiline found but single quot
|
|||
|
|
||||
14 | """
|
||||
15 |
|
||||
16 | """
|
||||
| _____^
|
||||
16 | / """
|
||||
17 | | this is not a docstring
|
||||
18 | | """
|
||||
| |_______^ Q001
|
||||
|
|
@ -83,8 +81,7 @@ docstring_doubles.py:30:9: Q001 [*] Double quote multiline found but single quot
|
|||
|
|
||||
28 | some_expression = 'hello world'
|
||||
29 |
|
||||
30 | """
|
||||
| _________^
|
||||
30 | / """
|
||||
31 | | this is not a docstring
|
||||
32 | | """
|
||||
| |___________^ Q001
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
||||
|
|
@ -27,8 +26,7 @@ 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
|
||||
|
|
@ -54,8 +52,7 @@ 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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
||||
|
|
@ -26,8 +25,7 @@ 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
|
||||
|
|
@ -53,8 +51,7 @@ 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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
---
|
||||
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
|
||||
|
|
||||
|
|
@ -59,8 +58,7 @@ docstring_singles.py:18:5: Q001 [*] Single quote multiline found but double quot
|
|||
|
|
||||
16 | '''
|
||||
17 |
|
||||
18 | '''
|
||||
| _____^
|
||||
18 | / '''
|
||||
19 | | this is not a docstring
|
||||
20 | | '''
|
||||
| |_______^ Q001
|
||||
|
|
@ -110,8 +108,7 @@ docstring_singles.py:32:9: Q001 [*] Single quote multiline found but double quot
|
|||
|
|
||||
30 | some_expression = 'hello world'
|
||||
31 |
|
||||
32 | '''
|
||||
| _________^
|
||||
32 | / '''
|
||||
33 | | this is not a docstring
|
||||
34 | | '''
|
||||
| |___________^ Q001
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
@ -254,8 +246,7 @@ RET503.py:275:5: RET503 [*] Missing explicit `return` at the end of function abl
|
|||
|
|
||||
273 | return False
|
||||
274 |
|
||||
275 | for value in values:
|
||||
| _____^
|
||||
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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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`
|
||||
|
|
||||
|
|
@ -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,8 +185,7 @@ 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.
|
||||
|
|
@ -202,8 +199,7 @@ 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;
|
||||
|
|
@ -235,8 +231,7 @@ SIM105_0.py:122:5: SIM105 [*] Use `contextlib.suppress(OSError)` instead of `try
|
|||
|
|
||||
120 | pass;
|
||||
121 |
|
||||
122 | try: os.makedirs(model_dir);
|
||||
| _____^
|
||||
122 | / try: os.makedirs(model_dir);
|
||||
123 | | except OSError:
|
||||
124 | | pass;
|
||||
| |____________^ SIM105
|
||||
|
|
@ -266,8 +261,7 @@ SIM105_0.py:126:5: SIM105 [*] Use `contextlib.suppress(OSError)` instead of `try
|
|||
|
|
||||
124 | pass;
|
||||
125 |
|
||||
126 | try: os.makedirs(model_dir);
|
||||
| _____^
|
||||
126 | / try: os.makedirs(model_dir);
|
||||
127 | | except OSError:
|
||||
128 | | pass; \
|
||||
| |____________^ SIM105
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
@ -197,8 +189,7 @@ SIM110.py:124:5: SIM110 Use `return any(check(x) for x in iterable)` instead of
|
|||
|
|
||||
122 | pass
|
||||
123 |
|
||||
124 | for x in iterable:
|
||||
| _____^
|
||||
124 | / for x in iterable:
|
||||
125 | | if check(x):
|
||||
126 | | return True
|
||||
127 | | return False
|
||||
|
|
@ -210,8 +201,7 @@ SIM110.py:134:5: SIM110 Use `return all(not check(x) for x in iterable)` instead
|
|||
|
|
||||
132 | pass
|
||||
133 |
|
||||
134 | for x in iterable:
|
||||
| _____^
|
||||
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💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ":
|
||||
| _____^
|
||||
162 | / for x in "012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ":
|
||||
163 | | if x.isdigit():
|
||||
164 | | return True
|
||||
165 | | return False
|
||||
|
|
@ -299,8 +286,7 @@ 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
|
||||
|
|
@ -327,8 +313,7 @@ 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
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
@ -197,8 +189,7 @@ SIM111.py:124:5: SIM110 Use `return any(check(x) for x in iterable)` instead of
|
|||
|
|
||||
122 | pass
|
||||
123 |
|
||||
124 | for x in iterable:
|
||||
| _____^
|
||||
124 | / for x in iterable:
|
||||
125 | | if check(x):
|
||||
126 | | return True
|
||||
127 | | return False
|
||||
|
|
@ -210,8 +201,7 @@ SIM111.py:134:5: SIM110 Use `return all(not check(x) for x in iterable)` instead
|
|||
|
|
||||
132 | pass
|
||||
133 |
|
||||
134 | for x in iterable:
|
||||
| _____^
|
||||
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💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9":
|
||||
| _____^
|
||||
178 | / for x in "012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9":
|
||||
179 | | if x.isdigit():
|
||||
180 | | return False
|
||||
181 | | return True
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
||||
|
|
@ -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,8 +184,7 @@ 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:
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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!")
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
||||
|
|
@ -136,8 +135,7 @@ 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"
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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`
|
||||
|
|
||||
|
|
@ -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")
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
---
|
||||
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
|
||||
|
|
||||
|
|
@ -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
|
||||
|
|
||||
|
|
|
|||
|
|
@ -1,13 +1,11 @@
|
|||
---
|
||||
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 |
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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`
|
||||
|
|
||||
|
|
@ -348,8 +347,7 @@ E731.py:147:5: E731 [*] Do not assign a `lambda` expression, use a `def`
|
|||
|
|
||||
145 | # E731
|
||||
146 |
|
||||
147 | f = lambda: (
|
||||
| _____^
|
||||
147 | / f = lambda: (
|
||||
148 | | i := 1,
|
||||
149 | | )
|
||||
| |_____^ E731
|
||||
|
|
|
|||
|
|
@ -1,13 +1,11 @@
|
|||
---
|
||||
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.
|
||||
| _____^
|
||||
7 | / """Calculate speed as distance divided by time.
|
||||
8 | |
|
||||
9 | | Args:
|
||||
10 | | distance: Distance traveled.
|
||||
|
|
@ -28,8 +26,7 @@ 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.
|
||||
| _____^
|
||||
24 | / """Calculate speed as distance divided by time.
|
||||
25 | |
|
||||
26 | | Args:
|
||||
27 | | distance: Distance traveled.
|
||||
|
|
@ -51,8 +48,7 @@ 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.
|
||||
| _____^
|
||||
42 | / """Calculate speed as distance divided by time.
|
||||
43 | |
|
||||
44 | | Args:
|
||||
45 | | distance: Distance traveled.
|
||||
|
|
|
|||
|
|
@ -1,13 +1,11 @@
|
|||
---
|
||||
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 | |
|
||||
10 | | Parameters
|
||||
|
|
@ -36,8 +34,7 @@ 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 | |
|
||||
35 | | Parameters
|
||||
|
|
@ -68,8 +65,7 @@ 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 | |
|
||||
62 | | Parameters
|
||||
|
|
|
|||
|
|
@ -1,13 +1,11 @@
|
|||
---
|
||||
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 | |
|
||||
17 | | Args:
|
||||
|
|
@ -25,8 +23,7 @@ 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 | |
|
||||
33 | | Args:
|
||||
|
|
@ -44,8 +41,7 @@ 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.
|
||||
| _____^
|
||||
80 | / """Fooey things.
|
||||
81 | |
|
||||
82 | | Returns:
|
||||
83 | | None
|
||||
|
|
|
|||
|
|
@ -1,13 +1,11 @@
|
|||
---
|
||||
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 | |
|
||||
19 | | Parameters
|
||||
|
|
@ -29,8 +27,7 @@ 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 | |
|
||||
39 | | Parameters
|
||||
|
|
|
|||
|
|
@ -1,13 +1,11 @@
|
|||
---
|
||||
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 | |
|
||||
17 | | Args:
|
||||
|
|
@ -25,8 +23,7 @@ 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 | |
|
||||
33 | | Args:
|
||||
|
|
|
|||
|
|
@ -1,13 +1,11 @@
|
|||
---
|
||||
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 | |
|
||||
19 | | Parameters
|
||||
|
|
@ -29,8 +27,7 @@ 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 | |
|
||||
39 | | Parameters
|
||||
|
|
|
|||
|
|
@ -1,13 +1,11 @@
|
|||
---
|
||||
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.
|
||||
| _____^
|
||||
34 | / """Calculate speed as distance divided by time.
|
||||
35 | |
|
||||
36 | | Args:
|
||||
37 | | distance: Distance traveled.
|
||||
|
|
@ -26,8 +24,7 @@ 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.
|
||||
| _____^
|
||||
51 | / """Calculate speed as distance divided by time.
|
||||
52 | |
|
||||
53 | | Args:
|
||||
54 | | distance: Distance traveled.
|
||||
|
|
@ -46,8 +43,7 @@ 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.
|
||||
| _____^
|
||||
51 | / """Calculate speed as distance divided by time.
|
||||
52 | |
|
||||
53 | | Args:
|
||||
54 | | distance: Distance traveled.
|
||||
|
|
@ -66,8 +62,7 @@ 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.
|
||||
| _____^
|
||||
106 | / """Calculate speed as distance divided by time.
|
||||
107 | |
|
||||
108 | | Args:
|
||||
109 | | distance: Distance traveled.
|
||||
|
|
@ -85,8 +80,7 @@ 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.
|
||||
| _____^
|
||||
120 | / """Calculate speed as distance divided by time.
|
||||
121 | |
|
||||
122 | | Args:
|
||||
123 | | distance: Distance traveled.
|
||||
|
|
@ -104,8 +98,7 @@ DOC501_google.py:134:5: DOC501 Raised exception `SomeError` missing from docstri
|
|||
|
|
||||
132 | # DOC501
|
||||
133 | def foo(bar: int):
|
||||
134 | """Foo.
|
||||
| _____^
|
||||
134 | / """Foo.
|
||||
135 | |
|
||||
136 | | Args:
|
||||
137 | | bar: Bar.
|
||||
|
|
@ -119,8 +112,7 @@ 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.
|
||||
| _____^
|
||||
197 | / """Calculate speed as distance divided by time.
|
||||
198 | |
|
||||
199 | | Args:
|
||||
200 | | distance: Distance traveled.
|
||||
|
|
@ -141,8 +133,7 @@ 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.
|
||||
| _____^
|
||||
238 | / """Foo.
|
||||
239 | |
|
||||
240 | | Returns:
|
||||
241 | | 42: int.
|
||||
|
|
@ -156,8 +147,7 @@ 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.
|
||||
| _____^
|
||||
238 | / """Foo.
|
||||
239 | |
|
||||
240 | | Returns:
|
||||
241 | | 42: int.
|
||||
|
|
|
|||
|
|
@ -1,13 +1,11 @@
|
|||
---
|
||||
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 | |
|
||||
38 | | Parameters
|
||||
|
|
@ -32,8 +30,7 @@ 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 | |
|
||||
61 | | Parameters
|
||||
|
|
@ -58,8 +55,7 @@ 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 | |
|
||||
61 | | Parameters
|
||||
|
|
@ -84,8 +80,7 @@ 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.
|
||||
| _____^
|
||||
83 | / """Calculate speed as distance divided by time.
|
||||
84 | |
|
||||
85 | | ACalculate speed as distance divided by time.
|
||||
86 | |
|
||||
|
|
@ -115,8 +110,7 @@ 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.
|
||||
| _____^
|
||||
139 | / """Foo.
|
||||
140 | |
|
||||
141 | | Returns
|
||||
142 | | -------
|
||||
|
|
@ -132,8 +126,7 @@ 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.
|
||||
| _____^
|
||||
139 | / """Foo.
|
||||
140 | |
|
||||
141 | | Returns
|
||||
142 | | -------
|
||||
|
|
|
|||
|
|
@ -1,13 +1,11 @@
|
|||
---
|
||||
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 | |
|
||||
6 | | Args:
|
||||
|
|
@ -22,8 +20,7 @@ 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 | |
|
||||
47 | | Args:
|
||||
|
|
@ -58,8 +55,7 @@ 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.
|
||||
| _____^
|
||||
178 | / """A very helpful docstring.
|
||||
179 | |
|
||||
180 | | Args:
|
||||
181 | | x (int): An integer.
|
||||
|
|
@ -74,8 +70,7 @@ 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.
|
||||
| _____^
|
||||
191 | / """A very helpful docstring.
|
||||
192 | |
|
||||
193 | | Args:
|
||||
194 | | x (int): An integer.
|
||||
|
|
@ -90,8 +85,7 @@ 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.
|
||||
| _____^
|
||||
204 | / """A very helpful docstring.
|
||||
205 | |
|
||||
206 | | Args:
|
||||
207 | | s (str): A string.
|
||||
|
|
|
|||
|
|
@ -1,13 +1,11 @@
|
|||
---
|
||||
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 | |
|
||||
6 | | Parameters
|
||||
|
|
@ -24,8 +22,7 @@ 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 | |
|
||||
57 | | Parameters
|
||||
|
|
@ -52,8 +49,7 @@ 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.
|
||||
| _____^
|
||||
152 | / """A very helpful docstring.
|
||||
153 | |
|
||||
154 | | Parameters
|
||||
155 | | ----------
|
||||
|
|
@ -70,8 +66,7 @@ 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.
|
||||
| _____^
|
||||
167 | / """A very helpful docstring.
|
||||
168 | |
|
||||
169 | | Parameters
|
||||
170 | | ----------
|
||||
|
|
@ -88,8 +83,7 @@ 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.
|
||||
| _____^
|
||||
182 | / """A very helpful docstring.
|
||||
183 | |
|
||||
184 | | Parameters
|
||||
185 | | ----------
|
||||
|
|
|
|||
|
|
@ -1,13 +1,11 @@
|
|||
---
|
||||
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 | |
|
||||
6 | | Args:
|
||||
|
|
@ -22,8 +20,7 @@ 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 | |
|
||||
47 | | Args:
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -1,13 +1,11 @@
|
|||
---
|
||||
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 | |
|
||||
6 | | Parameters
|
||||
|
|
@ -24,8 +22,7 @@ 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 | |
|
||||
57 | | Parameters
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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,8 +28,7 @@ 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 | """
|
||||
| _____^
|
||||
597 | / """
|
||||
598 | |
|
||||
599 | | Wrong."""
|
||||
| |_____________^ D200
|
||||
|
|
@ -54,8 +51,7 @@ 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.
|
||||
| _____^
|
||||
606 | / r"""Wrong.
|
||||
607 | |
|
||||
608 | | """
|
||||
| |_______^ D200
|
||||
|
|
@ -78,8 +74,7 @@ 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."
|
||||
| _____^
|
||||
615 | / """Wrong."
|
||||
616 | |
|
||||
617 | | """
|
||||
| |_______^ D200
|
||||
|
|
@ -90,8 +85,7 @@ 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 | """
|
||||
| _____^
|
||||
624 | / """
|
||||
625 | |
|
||||
626 | | "Wrong."""
|
||||
| |______________^ D200
|
||||
|
|
@ -101,8 +95,7 @@ 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 |
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
---
|
||||
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)
|
||||
|
|
||||
|
|
@ -44,8 +43,7 @@ D.py:546:5: D201 [*] No blank lines allowed before function docstring (found 1)
|
|||
|
|
||||
544 | def multiline_leading_space():
|
||||
545 |
|
||||
546 | """Leading space.
|
||||
| _____^
|
||||
546 | / """Leading space.
|
||||
547 | |
|
||||
548 | | More content.
|
||||
549 | | """
|
||||
|
|
@ -66,8 +64,7 @@ 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.
|
||||
| _____^
|
||||
568 | / """Trailing and leading space.
|
||||
569 | |
|
||||
570 | | More content.
|
||||
571 | | """
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
||||
|
|
@ -46,8 +45,7 @@ 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.
|
||||
| _____^
|
||||
555 | / """Leading space.
|
||||
556 | |
|
||||
557 | | More content.
|
||||
558 | | """
|
||||
|
|
@ -70,8 +68,7 @@ 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.
|
||||
| _____^
|
||||
568 | / """Trailing and leading space.
|
||||
569 | |
|
||||
570 | | More content.
|
||||
571 | | """
|
||||
|
|
|
|||
|
|
@ -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,8 +40,7 @@ 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.
|
||||
| _____^
|
||||
526 | / """A Blah.
|
||||
527 | |
|
||||
528 | | Parameters
|
||||
529 | | ----------
|
||||
|
|
|
|||
|
|
@ -1,13 +1,11 @@
|
|||
---
|
||||
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 | |
|
||||
203 | | """
|
||||
|
|
@ -19,8 +17,7 @@ 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.
|
||||
| _____^
|
||||
210 | / """Summary.
|
||||
211 | |
|
||||
212 | |
|
||||
213 | | Description.
|
||||
|
|
|
|||
|
|
@ -1,13 +1,11 @@
|
|||
---
|
||||
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.
|
||||
| _____^
|
||||
281 | / """Summary.
|
||||
282 | |
|
||||
283 | | Description."""
|
||||
| |___________________^ D209
|
||||
|
|
@ -29,8 +27,7 @@ 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.
|
||||
| _____^
|
||||
588 | / """Summary.
|
||||
589 | |
|
||||
590 | | Description. """
|
||||
| |_____________________^ D209
|
||||
|
|
|
|||
|
|
@ -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,8 +43,7 @@ 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.
|
||||
| _____^
|
||||
299 | / """ Whitespace at the beginning.
|
||||
300 | |
|
||||
301 | | This is the end.
|
||||
302 | | """
|
||||
|
|
|
|||
|
|
@ -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,8 +27,7 @@ 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 | """
|
||||
| _____^
|
||||
597 | / """
|
||||
598 | |
|
||||
599 | | Wrong."""
|
||||
| |_____________^ D212
|
||||
|
|
@ -53,8 +50,7 @@ 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 | """
|
||||
| _____^
|
||||
624 | / """
|
||||
625 | |
|
||||
626 | | "Wrong."""
|
||||
| |______________^ D212
|
||||
|
|
|
|||
|
|
@ -1,13 +1,11 @@
|
|||
---
|
||||
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 | |
|
||||
203 | | """
|
||||
|
|
@ -30,8 +28,7 @@ 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.
|
||||
| _____^
|
||||
210 | / """Summary.
|
||||
211 | |
|
||||
212 | |
|
||||
213 | | Description.
|
||||
|
|
@ -56,8 +53,7 @@ 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.
|
||||
| _____^
|
||||
220 | / """Summary.
|
||||
221 | |
|
||||
222 | | Description.
|
||||
223 | |
|
||||
|
|
@ -81,8 +77,7 @@ 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.
|
||||
| _____^
|
||||
230 | / """Summary.
|
||||
231 | |
|
||||
232 | | Description.
|
||||
233 | |
|
||||
|
|
@ -106,8 +101,7 @@ 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.
|
||||
| _____^
|
||||
240 | / """Summary.
|
||||
241 | |
|
||||
242 | | Description.
|
||||
243 | |
|
||||
|
|
@ -131,8 +125,7 @@ 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.
|
||||
| _____^
|
||||
250 | / """Summary.
|
||||
251 | |
|
||||
252 | | Description.
|
||||
253 | |
|
||||
|
|
@ -156,8 +149,7 @@ 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.
|
||||
| _____^
|
||||
260 | / """Summary.
|
||||
261 | |
|
||||
262 | | Description.
|
||||
263 | |
|
||||
|
|
@ -181,8 +173,7 @@ 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.
|
||||
| _____^
|
||||
270 | / """Summary.
|
||||
271 | |
|
||||
272 | | Description.
|
||||
273 | |
|
||||
|
|
@ -206,8 +197,7 @@ 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.
|
||||
| _____^
|
||||
281 | / """Summary.
|
||||
282 | |
|
||||
283 | | Description."""
|
||||
| |___________________^ D213
|
||||
|
|
@ -229,8 +219,7 @@ 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.
|
||||
| _____^
|
||||
299 | / """ Whitespace at the beginning.
|
||||
300 | |
|
||||
301 | | This is the end.
|
||||
302 | | """
|
||||
|
|
@ -253,8 +242,7 @@ 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.
|
||||
| _____^
|
||||
343 | / """Exclude some backslashes from D301.
|
||||
344 | |
|
||||
345 | | In particular, line continuations \
|
||||
346 | | and unicode literals \u0394 and \N{GREEK CAPITAL LETTER DELTA}.
|
||||
|
|
@ -279,8 +267,7 @@ 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.
|
||||
| _____^
|
||||
383 | / """First line.
|
||||
384 | |
|
||||
385 | | More lines.
|
||||
386 | | """
|
||||
|
|
@ -304,8 +291,7 @@ 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.
|
||||
| _____^
|
||||
392 | / """One liner.
|
||||
393 | |
|
||||
394 | | Multi-line comments. OK to have extra blank line
|
||||
395 | |
|
||||
|
|
@ -353,8 +339,7 @@ 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.
|
||||
| _____^
|
||||
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 | |
|
||||
|
|
@ -378,8 +363,7 @@ 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.
|
||||
| _____^
|
||||
526 | / """A Blah.
|
||||
527 | |
|
||||
528 | | Parameters
|
||||
529 | | ----------
|
||||
|
|
@ -407,8 +391,7 @@ D.py:546:5: D213 [*] Multi-line docstring summary should start at the second lin
|
|||
|
|
||||
544 | def multiline_leading_space():
|
||||
545 |
|
||||
546 | """Leading space.
|
||||
| _____^
|
||||
546 | / """Leading space.
|
||||
547 | |
|
||||
548 | | More content.
|
||||
549 | | """
|
||||
|
|
@ -431,8 +414,7 @@ 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.
|
||||
| _____^
|
||||
555 | / """Leading space.
|
||||
556 | |
|
||||
557 | | More content.
|
||||
558 | | """
|
||||
|
|
@ -457,8 +439,7 @@ D.py:568:5: D213 [*] Multi-line docstring summary should start at the second lin
|
|||
|
|
||||
566 | def multiline_trailing_and_leading_space():
|
||||
567 |
|
||||
568 | """Trailing and leading space.
|
||||
| _____^
|
||||
568 | / """Trailing and leading space.
|
||||
569 | |
|
||||
570 | | More content.
|
||||
571 | | """
|
||||
|
|
@ -483,8 +464,7 @@ 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.
|
||||
| _____^
|
||||
588 | / """Summary.
|
||||
589 | |
|
||||
590 | | Description. """
|
||||
| |_____________________^ D213
|
||||
|
|
@ -506,8 +486,7 @@ 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.
|
||||
| _____^
|
||||
606 | / r"""Wrong.
|
||||
607 | |
|
||||
608 | | """
|
||||
| |_______^ D213
|
||||
|
|
@ -529,8 +508,7 @@ 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."
|
||||
| _____^
|
||||
615 | / """Wrong."
|
||||
616 | |
|
||||
617 | | """
|
||||
| |_______^ D213
|
||||
|
|
@ -551,8 +529,7 @@ 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.
|
||||
| _____^
|
||||
671 | / """Summary.
|
||||
672 | |
|
||||
673 | | This is overindented
|
||||
674 | | And so is this, but it we should preserve the extra space on this line relative
|
||||
|
|
@ -576,8 +553,7 @@ 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.
|
||||
| _____^
|
||||
680 | / """Summary.
|
||||
681 | |
|
||||
682 | | This is overindented
|
||||
683 | | And so is this, but it we should preserve the extra space on this line relative
|
||||
|
|
@ -604,8 +580,7 @@ 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.
|
||||
| _____^
|
||||
693 | / """Summary.
|
||||
694 | |
|
||||
695 | | This is overindented
|
||||
696 | | And so is this, but it we should preserve the extra space on this line relative
|
||||
|
|
@ -632,8 +607,7 @@ 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.
|
||||
| _____^
|
||||
702 | / """Summary.
|
||||
703 | |
|
||||
704 | | This is overindented
|
||||
705 | | And so is this, but it we should preserve the extra space on this line relative
|
||||
|
|
@ -658,8 +632,7 @@ 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.
|
||||
| _____^
|
||||
712 | / """Summary.
|
||||
713 | |
|
||||
714 | | This is not overindented
|
||||
715 | | This is overindented, but since one line is not overindented this should not raise
|
||||
|
|
@ -683,8 +656,7 @@ 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).
|
||||
| _____^
|
||||
721 | / """There's a non-breaking space (2-bytes) after 3 spaces (https://github.com/astral-sh/ruff/issues/9080).
|
||||
722 | |
|
||||
723 | | Returns:
|
||||
724 | | """
|
||||
|
|
|
|||
|
|
@ -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,8 +99,7 @@ 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 |
|
||||
|
|
@ -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
|
||||
|
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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,8 +244,7 @@ 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."
|
||||
| _____^
|
||||
615 | / """Wrong."
|
||||
616 | |
|
||||
617 | | """
|
||||
| |_______^ 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
|
||||
|
|
||||
|
|
|
|||
|
|
@ -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,8 +244,7 @@ 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 | |
|
||||
|
|
|
|||
|
|
@ -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,8 +18,7 @@ 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 | """
|
||||
| _____^
|
||||
18 | / """
|
||||
19 | |
|
||||
20 | | Constructor for a boa.
|
||||
21 | |
|
||||
|
|
@ -49,8 +47,7 @@ D401.py:29:9: D401 First line of docstring should be in imperative mood: "Runs o
|
|||
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
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
---
|
||||
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`
|
||||
|
|
||||
|
|
@ -63,8 +62,7 @@ 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 | """
|
||||
| _____^
|
||||
36 | / """
|
||||
37 | |
|
||||
38 | |
|
||||
39 | |
|
||||
|
|
@ -91,8 +89,7 @@ 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
|
||||
| _____^
|
||||
46 | / """singleword
|
||||
47 | |
|
||||
48 | | """
|
||||
| |_______^ D403
|
||||
|
|
@ -114,8 +111,7 @@ 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.
|
||||
| _____^
|
||||
51 | / """singleword.
|
||||
52 | |
|
||||
53 | | """
|
||||
| |_______^ D403
|
||||
|
|
@ -137,8 +133,7 @@ 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
|
||||
|
|
@ -160,8 +155,7 @@ 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
|
||||
|
|
@ -183,8 +177,7 @@ 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
|
||||
| _____^
|
||||
66 | / """singleword
|
||||
67 | |
|
||||
68 | | This is more text.
|
||||
69 | | """
|
||||
|
|
@ -207,8 +200,7 @@ 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.
|
||||
| _____^
|
||||
72 | / """singleword.
|
||||
73 | |
|
||||
74 | | This is more text.
|
||||
75 | | """
|
||||
|
|
@ -231,8 +223,7 @@ 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 | |
|
||||
81 | | This is more text.
|
||||
|
|
@ -256,8 +247,7 @@ 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 | |
|
||||
88 | | This is more text.
|
||||
|
|
|
|||
|
|
@ -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,8 +236,7 @@ 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."
|
||||
| _____^
|
||||
615 | / """Wrong."
|
||||
616 | |
|
||||
617 | | """
|
||||
| |_______^ 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
|
||||
|
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
---
|
||||
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
|
||||
|
|
||||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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"]
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)`
|
||||
|
|
||||
|
|
@ -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,8 +326,7 @@ 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 |
|
||||
|
|
@ -352,8 +349,7 @@ if_stmt_min_max.py:148:9: PLR1730 [*] Replace `if` statement with `self._min = m
|
|||
|
|
||||
146 | self._max = value
|
||||
147 |
|
||||
148 | if self._min < value:
|
||||
| _________^
|
||||
148 | / if self._min < value:
|
||||
149 | | self._min = value
|
||||
| |_____________________________^ PLR1730
|
||||
150 | if self._max > value:
|
||||
|
|
@ -376,8 +372,7 @@ 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 |
|
||||
|
|
@ -400,8 +395,7 @@ if_stmt_min_max.py:153:9: PLR1730 [*] Replace `if` statement with `self._min = m
|
|||
|
|
||||
151 | self._max = value
|
||||
152 |
|
||||
153 | if value <= self._min:
|
||||
| _________^
|
||||
153 | / if value <= self._min:
|
||||
154 | | self._min = value
|
||||
| |_____________________________^ PLR1730
|
||||
155 | if value >= self._max:
|
||||
|
|
@ -424,8 +418,7 @@ 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 |
|
||||
|
|
@ -448,8 +441,7 @@ if_stmt_min_max.py:158:9: PLR1730 [*] Replace `if` statement with `self._min = m
|
|||
|
|
||||
156 | self._max = value
|
||||
157 |
|
||||
158 | if self._min <= value:
|
||||
| _________^
|
||||
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
|
||||
|
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -185,8 +184,7 @@ 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 |
|
||||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
||||
|
|
@ -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 | )
|
||||
|
|
|
|||
|
|
@ -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`
|
||||
|
|
||||
|
|
@ -320,8 +319,7 @@ 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,
|
||||
|
|
|
|||
|
|
@ -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,8 +175,7 @@ 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 |
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
---
|
||||
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
|
||||
|
|
||||
|
|
@ -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 | )
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
---
|
||||
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
|
||||
|
|
||||
|
|
@ -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
|
||||
|
|
@ -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,8 +1141,7 @@ 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 |
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/rules/pyupgrade/mod.rs
|
||||
snapshot_kind: text
|
||||
---
|
||||
UP035.py:2:1: UP035 [*] Import from `collections.abc` instead: `Mapping`
|
||||
|
|
||||
|
|
@ -285,8 +284,7 @@ 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,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/rules/refurb/mod.rs
|
||||
snapshot_kind: text
|
||||
---
|
||||
FURB110.py:1:5: FURB110 [*] Replace ternary `if` expression 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
|
||||
|
|
|
|||
|
|
@ -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
Loading…
Reference in New Issue