test: update formatting of multi-line annotations

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

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

And now after:

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

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

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

View File

@ -1,12 +1,10 @@
--- ---
source: crates/ruff_linter/src/rules/flake8_async/mod.rs 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. 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(): 7 | async def func():
8 | with trio.fail_after(): 8 | / with trio.fail_after():
| _____^
9 | | ... 9 | | ...
| |___________^ ASYNC100 | |___________^ 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. 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(): 17 | async def func():
18 | with trio.move_on_after(): 18 | / with trio.move_on_after():
| _____^
19 | | ... 19 | | ...
| |___________^ ASYNC100 | |___________^ 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. 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(): 44 | async def func():
45 | with anyio.move_on_after(delay=0.2): 45 | / with anyio.move_on_after(delay=0.2):
| _____^
46 | | ... 46 | | ...
| |___________^ ASYNC100 | |___________^ 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. 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(): 49 | async def func():
50 | with anyio.fail_after(): 50 | / with anyio.fail_after():
| _____^
51 | | ... 51 | | ...
| |___________^ ASYNC100 | |___________^ 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. 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(): 54 | async def func():
55 | with anyio.CancelScope(): 55 | / with anyio.CancelScope():
| _____^
56 | | ... 56 | | ...
| |___________^ ASYNC100 | |___________^ 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. 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(): 59 | async def func():
60 | with anyio.CancelScope(), nullcontext(): 60 | / with anyio.CancelScope(), nullcontext():
| _____^
61 | | ... 61 | | ...
| |___________^ ASYNC100 | |___________^ 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. 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(): 64 | async def func():
65 | with nullcontext(), anyio.CancelScope(): 65 | / with nullcontext(), anyio.CancelScope():
| _____^
66 | | ... 66 | | ...
| |___________^ ASYNC100 | |___________^ 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. 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(): 69 | async def func():
70 | async with asyncio.timeout(delay=0.2): 70 | / async with asyncio.timeout(delay=0.2):
| _____^
71 | | ... 71 | | ...
| |___________^ ASYNC100 | |___________^ 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. 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(): 74 | async def func():
75 | async with asyncio.timeout_at(when=0.2): 75 | / async with asyncio.timeout_at(when=0.2):
| _____^
76 | | ... 76 | | ...
| |___________^ ASYNC100 | |___________^ 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. 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(): 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 | | ... 86 | | ...
| |___________^ ASYNC100 | |___________^ 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. 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(): 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 | | ... 96 | | ...
| |___________^ ASYNC100 | |___________^ ASYNC100
| |

View File

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

View File

@ -1,6 +1,5 @@
--- ---
source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs 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 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(): 75 | def query41():
76 | return ( 76 | return (
77 | "SELECT * " 77 | / "SELECT * "
| _________^
78 | | "FROM table " 78 | | "FROM table "
79 | | f"WHERE var = {var}" 79 | | f"WHERE var = {var}"
| |____________________________^ S608 | |____________________________^ S608

View File

@ -1,12 +1,10 @@
--- ---
source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs 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 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): 17 | class AbstractClass(ABC):
18 | def empty_1(self): # error 18 | / def empty_1(self): # error
| _____^
19 | | ... 19 | | ...
| |___________^ B027 | |___________^ B027
20 | 20 |
@ -17,8 +15,7 @@ B027.py:21:5: B027 `AbstractClass.empty_2` is an empty method in an abstract bas
| |
19 | ... 19 | ...
20 | 20 |
21 | def empty_2(self): # error 21 | / def empty_2(self): # error
| _____^
22 | | pass 22 | | pass
| |____________^ B027 | |____________^ B027
23 | 23 |
@ -29,8 +26,7 @@ B027.py:24:5: B027 `AbstractClass.empty_3` is an empty method in an abstract bas
| |
22 | pass 22 | pass
23 | 23 |
24 | def empty_3(self): # error 24 | / def empty_3(self): # error
| _____^
25 | | """docstring""" 25 | | """docstring"""
26 | | ... 26 | | ...
| |___________^ B027 | |___________^ B027
@ -42,8 +38,7 @@ B027.py:28:5: B027 `AbstractClass.empty_4` is an empty method in an abstract bas
| |
26 | ... 26 | ...
27 | 27 |
28 | def empty_4(self): # error 28 | / def empty_4(self): # error
| _____^
29 | | """multiple ellipsis/pass""" 29 | | """multiple ellipsis/pass"""
30 | | ... 30 | | ...
31 | | pass 31 | | pass

View File

@ -1,6 +1,5 @@
--- ---
source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs
snapshot_kind: text
--- ---
C419.py:1:5: C419 [*] Unnecessary list comprehension C419.py:1:5: C419 [*] Unnecessary list comprehension
| |
@ -103,8 +102,7 @@ C419.py:28:5: C419 [*] Unnecessary list comprehension
| |
26 | # Special comment handling 26 | # Special comment handling
27 | any( 27 | any(
28 | [ # lbracket comment 28 | / [ # lbracket comment
| _____^
29 | | # second line comment 29 | | # second line comment
30 | | i.bit_count() 30 | | i.bit_count()
31 | | # random middle comment 31 | | # random middle comment

View File

@ -1,6 +1,5 @@
--- ---
source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs
snapshot_kind: text
--- ---
C419_1.py:1:5: C419 [*] Unnecessary list comprehension 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 12 | # Multi-line
13 | sum( 13 | sum(
14 | [ 14 | / [
| _____^
15 | | delta 15 | | delta
16 | | for delta in timedelta_list 16 | | for delta in timedelta_list
17 | | if delta 17 | | if delta

View File

@ -1,6 +1,5 @@
--- ---
source: crates/ruff_linter/src/rules/flake8_django/mod.rs 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 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 54 | pass
55 | 55 |
56 | def __str__(self): 56 | / def __str__(self):
| _____^
57 | | return "foobar" 57 | | return "foobar"
| |_______________________^ DJ012 | |_______________________^ DJ012
| |
@ -32,8 +30,7 @@ DJ012.py:69:5: DJ012 Order of model's inner classes, methods, and fields does no
| |
67 | pass 67 | pass
68 | 68 |
69 | def save(self): 69 | / def save(self):
| _____^
70 | | pass 70 | | pass
| |____________^ DJ012 | |____________^ DJ012
| |

View File

@ -1,6 +1,5 @@
--- ---
source: crates/ruff_linter/src/rules/flake8_errmsg/mod.rs 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 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(): 74 | def f_multi_line_string2():
75 | raise RuntimeError( 75 | raise RuntimeError(
76 | "This is an {example} exception".format( 76 | / "This is an {example} exception".format(
| _________^
77 | | example="example" 77 | | example="example"
78 | | ) 78 | | )
| |_________^ EM103 | |_________^ 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(): 82 | def f_multi_line_string2():
83 | raise RuntimeError( 83 | raise RuntimeError(
84 | ( 84 | / (
| _________^
85 | | "This is an " 85 | | "This is an "
86 | | "{example} exception" 86 | | "{example} exception"
87 | | ).format( 87 | | ).format(

View File

@ -1,6 +1,5 @@
--- ---
source: crates/ruff_linter/src/rules/flake8_errmsg/mod.rs 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 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(): 67 | def f_multi_line_string():
68 | raise RuntimeError( 68 | raise RuntimeError(
69 | "first" 69 | / "first"
| _________^
70 | | "second" 70 | | "second"
| |________________^ EM101 | |________________^ EM101
71 | ) 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(): 74 | def f_multi_line_string2():
75 | raise RuntimeError( 75 | raise RuntimeError(
76 | "This is an {example} exception".format( 76 | / "This is an {example} exception".format(
| _________^
77 | | example="example" 77 | | example="example"
78 | | ) 78 | | )
| |_________^ EM103 | |_________^ 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(): 82 | def f_multi_line_string2():
83 | raise RuntimeError( 83 | raise RuntimeError(
84 | ( 84 | / (
| _________^
85 | | "This is an " 85 | | "This is an "
86 | | "{example} exception" 86 | | "{example} exception"
87 | | ).format( 87 | | ).format(

View File

@ -1,12 +1,10 @@
--- ---
source: crates/ruff_linter/src/rules/flake8_implicit_str_concat/mod.rs 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 ISC.py:9:3: ISC003 Explicitly concatenated string should be implicitly concatenated
| |
8 | _ = ( 8 | _ = (
9 | "abc" + 9 | / "abc" +
| ___^
10 | | "def" 10 | | "def"
| |_______^ ISC003 | |_______^ ISC003
11 | ) 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 ISC.py:14:3: ISC003 Explicitly concatenated string should be implicitly concatenated
| |
13 | _ = ( 13 | _ = (
14 | f"abc" + 14 | / f"abc" +
| ___^
15 | | "def" 15 | | "def"
| |_______^ ISC003 | |_______^ ISC003
16 | ) 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 ISC.py:19:3: ISC003 Explicitly concatenated string should be implicitly concatenated
| |
18 | _ = ( 18 | _ = (
19 | b"abc" + 19 | / b"abc" +
| ___^
20 | | b"def" 20 | | b"def"
| |________^ ISC003 | |________^ ISC003
21 | ) 21 | )

View File

@ -1,6 +1,5 @@
--- ---
source: crates/ruff_linter/src/rules/flake8_implicit_str_concat/mod.rs 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 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 ISC.py:24:3: ISC002 Implicitly concatenated string literals over multiple lines
| |
23 | _ = ( 23 | _ = (
24 | "abc" 24 | / "abc"
| ___^
25 | | "def" 25 | | "def"
| |_______^ ISC002 | |_______^ ISC002
26 | ) 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 ISC.py:29:3: ISC002 Implicitly concatenated string literals over multiple lines
| |
28 | _ = ( 28 | _ = (
29 | f"abc" 29 | / f"abc"
| ___^
30 | | "def" 30 | | "def"
| |_______^ ISC002 | |_______^ ISC002
31 | ) 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 ISC.py:34:3: ISC002 Implicitly concatenated string literals over multiple lines
| |
33 | _ = ( 33 | _ = (
34 | b"abc" 34 | / b"abc"
| ___^
35 | | b"def" 35 | | b"def"
| |________^ ISC002 | |________^ ISC002
36 | ) 36 | )
@ -48,8 +44,7 @@ ISC.py:67:5: ISC002 Implicitly concatenated string literals over multiple lines
| |
65 | _ = f"""abc {"def" "ghi"} jkl""" 65 | _ = f"""abc {"def" "ghi"} jkl"""
66 | _ = f"""abc { 66 | _ = f"""abc {
67 | "def" 67 | / "def"
| _____^
68 | | "ghi" 68 | | "ghi"
| |_________^ ISC002 | |_________^ ISC002
69 | } jkl""" 69 | } jkl"""

View File

@ -155,8 +155,7 @@ PIE800.py:30:9: PIE800 [*] Unnecessary spread `**`
| |
28 | "data": [], 28 | "data": [],
29 | **( # Comment 29 | **( # Comment
30 | { # Comment 30 | / { # Comment
| _________^
31 | | "count": 1 if include_count else {}}), 31 | | "count": 1 if include_count else {}}),
| |________________________________________________^ PIE800 | |________________________________________________^ PIE800
32 | } 32 | }
@ -181,8 +180,7 @@ PIE800.py:37:9: PIE800 [*] Unnecessary spread `**`
| |
35 | "data": [], 35 | "data": [],
36 | **( 36 | **(
37 | { 37 | / {
| _________^
38 | | "count": (a := 1),}), 38 | | "count": (a := 1),}),
| |_______________________________^ PIE800 | |_______________________________^ PIE800
39 | } 39 | }
@ -207,8 +205,7 @@ PIE800.py:44:9: PIE800 [*] Unnecessary spread `**`
| |
42 | "data": [], 42 | "data": [],
43 | **( 43 | **(
44 | { 44 | / {
| _________^
45 | | "count": (a := 1) 45 | | "count": (a := 1)
46 | | } 46 | | }
| |_____________^ PIE800 | |_____________^ PIE800
@ -238,8 +235,7 @@ PIE800.py:54:9: PIE800 [*] Unnecessary spread `**`
| |
52 | "data": [], 52 | "data": [],
53 | **( 53 | **(
54 | { 54 | / {
| _________^
55 | | "count": (a := 1), # Comment 55 | | "count": (a := 1), # Comment
56 | | } # Comment 56 | | } # Comment
| |_____________^ PIE800 | |_____________^ PIE800

View File

@ -386,8 +386,7 @@ PYI016.py:57:5: PYI016 [*] Duplicate union member `set[int]`
| |
55 | int # foo 55 | int # foo
56 | ], 56 | ],
57 | set[ 57 | / set[
| _____^
58 | | int # bar 58 | | int # bar
59 | | ], 59 | | ],
| |_____^ PYI016 | |_____^ PYI016

View File

@ -387,8 +387,7 @@ PYI016.pyi:57:5: PYI016 [*] Duplicate union member `set[int]`
| |
55 | int # foo 55 | int # foo
56 | ], 56 | ],
57 | set[ 57 | / set[
| _____^
58 | | int # bar 58 | | int # bar
59 | | ], 59 | | ],
| |_____^ PYI016 | |_____^ PYI016

View File

@ -1,6 +1,5 @@
--- ---
source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs 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 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 PYI021.pyi:15:5: PYI021 [*] Docstrings should not be included in stubs
| |
14 | class Baz: 14 | class Baz:
15 | """Multiline docstring 15 | / """Multiline docstring
| _____^
16 | | 16 | |
17 | | Lorem ipsum dolor sit amet 17 | | Lorem ipsum dolor sit amet
18 | | """ 18 | | """

View File

@ -193,8 +193,7 @@ PYI041.py:67:9: PYI041 [*] Use `complex` instead of `int | float | complex`
| |
65 | def f10( 65 | def f10(
66 | arg: ( 66 | arg: (
67 | int | # comment 67 | / int | # comment
| _________^
68 | | float | # another 68 | | float | # another
69 | | complex 69 | | complex
| |_______________^ PYI041 | |_______________^ PYI041

View File

@ -117,8 +117,7 @@ PYI041.pyi:43:9: PYI041 [*] Use `complex` instead of `int | float | complex`
| |
41 | def f6( 41 | def f6(
42 | arg: ( 42 | arg: (
43 | int | # comment 43 | / int | # comment
| _________^
44 | | float | # another 44 | | float | # another
45 | | complex 45 | | complex
| |_______________^ PYI041 | |_______________^ PYI041

View File

@ -1,6 +1,5 @@
--- ---
source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs 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()` 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 ,) 64 | # another comment ,)
65 | 65 |
66 | scope=\ 66 | / scope=\
| _____^
67 | | "function" # some comment ), 67 | | "function" # some comment ),
| |__________________^ PT003 | |__________________^ PT003
68 | , 68 | ,

View File

@ -1,6 +1,5 @@
--- ---
source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs 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 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 101 | # Unsafe fix
102 | @pytest.mark.parametrize( 102 | @pytest.mark.parametrize(
103 | ( 103 | / (
| _____^
104 | | # comment 104 | | # comment
105 | | "param", 105 | | "param",
106 | | ), 106 | | ),

View File

@ -1,6 +1,5 @@
--- ---
source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs 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` 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 101 | # Unsafe fix
102 | @pytest.mark.parametrize( 102 | @pytest.mark.parametrize(
103 | ( 103 | / (
| _____^
104 | | # comment 104 | | # comment
105 | | "param", 105 | | "param",
106 | | ), 106 | | ),

View File

@ -1,6 +1,5 @@
--- ---
source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs 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` 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 101 | # Unsafe fix
102 | @pytest.mark.parametrize( 102 | @pytest.mark.parametrize(
103 | ( 103 | / (
| _____^
104 | | # comment 104 | | # comment
105 | | "param", 105 | | "param",
106 | | ), 106 | | ),

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,5 @@
--- ---
source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs 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 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) 19 | assert not (something or something_else)
20 | assert not (something or something_else or something_third) 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 22 | | message
23 | | """ 23 | | """
| |_______^ PT018 | |_______^ PT018
@ -184,8 +182,7 @@ PT018.py:24:5: PT018 [*] Assertion should be broken down into multiple parts
| |
22 | message 22 | message
23 | """ 23 | """
24 | assert ( 24 | / assert (
| _____^
25 | | something 25 | | something
26 | | and something_else 26 | | and something_else
27 | | == """error 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 57 | # Regression test for: https://github.com/astral-sh/ruff/issues/7143
58 | def test_parenthesized_not(): 58 | def test_parenthesized_not():
59 | assert not ( 59 | / assert not (
| _____^
60 | | self.find_graph_output(node.output[0]) 60 | | self.find_graph_output(node.output[0])
61 | | or self.find_graph_input(node.input[0]) 61 | | or self.find_graph_input(node.input[0])
62 | | or self.find_graph_output(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 | ) 63 | )
64 | 64 |
65 | assert (not ( 65 | / assert (not (
| _____^
66 | | self.find_graph_output(node.output[0]) 66 | | self.find_graph_output(node.output[0])
67 | | or self.find_graph_input(node.input[0]) 67 | | or self.find_graph_input(node.input[0])
68 | | or self.find_graph_output(node.input[0]) 68 | | or self.find_graph_output(node.input[0])

View File

@ -1,6 +1,5 @@
--- ---
source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs 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` 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` PT027_0.py:44:13: PT027 Use `pytest.raises` instead of unittest-style `assertRaises`
| |
43 | with ( 43 | with (
44 | self 44 | / self
| _____________^
45 | | # comment 45 | | # comment
46 | | .assertRaises(ValueError) 46 | | .assertRaises(ValueError)
| |_________________________^ PT027 | |_________________________^ PT027

View File

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

View File

@ -1,6 +1,5 @@
--- ---
source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs 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 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 | """ 14 | """
15 | 15 |
16 | """ 16 | / """
| _____^
17 | | this is not a docstring 17 | | this is not a docstring
18 | | """ 18 | | """
| |_______^ Q001 | |_______^ Q001
@ -83,8 +81,7 @@ docstring_doubles.py:30:9: Q001 [*] Double quote multiline found but single quot
| |
28 | some_expression = 'hello world' 28 | some_expression = 'hello world'
29 | 29 |
30 | """ 30 | / """
| _________^
31 | | this is not a docstring 31 | | this is not a docstring
32 | | """ 32 | | """
| |___________^ Q001 | |___________^ 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 docstring_doubles.py:35:13: Q001 [*] Double quote multiline found but single quotes preferred
| |
34 | if l: 34 | if l:
35 | """ 35 | / """
| _____________^
36 | | Looks like a docstring, but in reality it isn't - only modules, classes and functions 36 | | Looks like a docstring, but in reality it isn't - only modules, classes and functions
37 | | """ 37 | | """
| |_______________^ Q001 | |_______________^ Q001

View File

@ -1,6 +1,5 @@
--- ---
source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs 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 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 12 | class params \t not a docstring
13 | ''')): 13 | ''')):
14 | ''' 14 | / '''
| _____^
15 | | Single quotes multiline class docstring 15 | | Single quotes multiline class docstring
16 | | ''' 16 | | '''
| |_______^ Q002 | |_______^ Q002
@ -54,8 +52,7 @@ docstring_singles.py:26:9: Q002 [*] Single quote docstring found but double quot
| |
24 | definitely not a docstring''', 24 | definitely not a docstring''',
25 | val=l[Cls():3]): 25 | val=l[Cls():3]):
26 | ''' 26 | / '''
| _________^
27 | | Single quotes multiline function docstring 27 | | Single quotes multiline function docstring
28 | | ''' 28 | | '''
| |___________^ Q002 | |___________^ Q002

View File

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

View File

@ -1,6 +1,5 @@
--- ---
source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs 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 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 docstring_doubles.py:12:5: Q002 [*] Double quote docstring found but single quotes preferred
| |
11 | class Cls: 11 | class Cls:
12 | """ 12 | / """
| _____^
13 | | Double quotes multiline class docstring 13 | | Double quotes multiline class docstring
14 | | """ 14 | | """
| |_______^ Q002 | |_______^ Q002
@ -53,8 +51,7 @@ docstring_doubles.py:24:9: Q002 [*] Double quote docstring found but single quot
| |
22 | definitely not a docstring""", 22 | definitely not a docstring""",
23 | val=l[Cls():3]): 23 | val=l[Cls():3]):
24 | """ 24 | / """
| _________^
25 | | Double quotes multiline function docstring 25 | | Double quotes multiline function docstring
26 | | """ 26 | | """
| |___________^ Q002 | |___________^ Q002

View File

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

View File

@ -1,6 +1,5 @@
--- ---
source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs 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 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 | ''' 16 | '''
17 | 17 |
18 | ''' 18 | / '''
| _____^
19 | | this is not a docstring 19 | | this is not a docstring
20 | | ''' 20 | | '''
| |_______^ Q001 | |_______^ Q001
@ -110,8 +108,7 @@ docstring_singles.py:32:9: Q001 [*] Single quote multiline found but double quot
| |
30 | some_expression = 'hello world' 30 | some_expression = 'hello world'
31 | 31 |
32 | ''' 32 | / '''
| _________^
33 | | this is not a docstring 33 | | this is not a docstring
34 | | ''' 34 | | '''
| |___________^ Q001 | |___________^ 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 docstring_singles.py:37:13: Q001 [*] Single quote multiline found but double quotes preferred
| |
36 | if l: 36 | if l:
37 | ''' 37 | / '''
| _____________^
38 | | Looks like a docstring, but in reality it isn't - only modules, classes and functions 38 | | Looks like a docstring, but in reality it isn't - only modules, classes and functions
39 | | ''' 39 | | '''
| |_______________^ Q001 | |_______________^ Q001

View File

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

View File

@ -1,6 +1,5 @@
--- ---
source: crates/ruff_linter/src/rules/flake8_return/mod.rs 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 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 RET503.py:300:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value
| |
299 | def end_of_statement(): 299 | def end_of_statement():
300 | def example(): 300 | / def example():
| _____^
301 | | if True: 301 | | if True:
302 | | return "" 302 | | return ""
| |_____________________^ RET503 | |_____________________^ 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 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: 306 | | if True:
307 | | return "" 307 | | return ""
| |_____________________^ RET503 | |_____________________^ 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 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: 311 | | if True:
312 | | return "" # type: ignore 312 | | return "" # type: ignore
| |_____________________^ RET503 | |_____________________^ 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 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: 316 | | if True:
317 | | return "" ; 317 | | return "" ;
| |_____________________^ RET503 | |_____________________^ 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 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: 321 | | if True:
322 | | return "" \ 322 | | return "" \
| |_____________________^ RET503 | |_____________________^ RET503

View File

@ -1,6 +1,5 @@
--- ---
source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs 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 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 6 | # SIM102
7 | if a: 7 | if a:
8 | if b: 8 | / if b:
| _____^
9 | | if c: 9 | | if c:
| |_____________^ SIM102 | |_____________^ SIM102
10 | d 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: 49 | while x > 0:
50 | # SIM102 50 | # SIM102
51 | if y > 0: 51 | / if y > 0:
| _____^
52 | | if z > 0: 52 | | if z > 0:
| |_________________^ SIM102 | |_________________^ SIM102
53 | """this 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: 81 | while x > 0:
82 | # SIM102 82 | # SIM102
83 | if node.module: 83 | / if node.module:
| _____^
84 | | if node.module == "multiprocessing" or node.module.startswith( 84 | | if node.module == "multiprocessing" or node.module.startswith(
85 | | "multiprocessing." 85 | | "multiprocessing."
86 | | ): 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 104 | # Regression test for https://github.com/apache/airflow/blob/145b16caaa43f0c42bffd97344df916c602cddde/airflow/configuration.py#L1161
105 | if a: 105 | if a:
106 | if b: 106 | / if b:
| _____^
107 | | if c: 107 | | if c:
| |_____________^ SIM102 | |_____________^ SIM102
108 | print("if") 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: 130 | if a:
131 | # SIM 102 131 | # SIM 102
132 | if b: 132 | / if b:
| _____^
133 | | if c: 133 | | if c:
| |_____________^ SIM102 | |_____________^ SIM102
134 | print("foo") 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: 163 | if a:
164 | pass 164 | pass
165 | elif b: 165 | / elif b:
| _____^
166 | | if c: 166 | | if c:
| |_____________^ SIM102 | |_____________^ SIM102
167 | d 167 | d

View File

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

View File

@ -1,6 +1,5 @@
--- ---
source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs 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` 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(): 83 | def with_ellipsis():
84 | # OK 84 | # OK
85 | try: 85 | / try:
| _____^
86 | | foo() 86 | | foo()
87 | | except ValueError: 87 | | except ValueError:
88 | | ... 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` SIM105_0.py:100:5: SIM105 Use `contextlib.suppress(ValueError, OSError)` instead of `try`-`except`-`pass`
| |
99 | def with_comment(): 99 | def with_comment():
100 | try: 100 | / try:
| _____^
101 | | foo() 101 | | foo()
102 | | except (ValueError, OSError): 102 | | except (ValueError, OSError):
103 | | pass # Trailing comment. 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 115 | # Regression test for: https://github.com/astral-sh/ruff/issues/7123
116 | def write_models(directory, Models): 116 | def write_models(directory, Models):
117 | try: 117 | / try:
| _____^
118 | | os.makedirs(model_dir); 118 | | os.makedirs(model_dir);
119 | | except OSError: 119 | | except OSError:
120 | | pass; 120 | | pass;
@ -235,8 +231,7 @@ SIM105_0.py:122:5: SIM105 [*] Use `contextlib.suppress(OSError)` instead of `try
| |
120 | pass; 120 | pass;
121 | 121 |
122 | try: os.makedirs(model_dir); 122 | / try: os.makedirs(model_dir);
| _____^
123 | | except OSError: 123 | | except OSError:
124 | | pass; 124 | | pass;
| |____________^ SIM105 | |____________^ SIM105
@ -266,8 +261,7 @@ SIM105_0.py:126:5: SIM105 [*] Use `contextlib.suppress(OSError)` instead of `try
| |
124 | pass; 124 | pass;
125 | 125 |
126 | try: os.makedirs(model_dir); 126 | / try: os.makedirs(model_dir);
| _____^
127 | | except OSError: 127 | | except OSError:
128 | | pass; \ 128 | | pass; \
| |____________^ SIM105 | |____________^ SIM105

View File

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

View File

@ -1,6 +1,5 @@
--- ---
source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs 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 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 28 | pass
29 | else: 29 | else:
30 | if a: 30 | / if a:
| _____^
31 | | b = 1 31 | | b = 1
32 | | else: 32 | | else:
33 | | b = 2 33 | | b = 2

View File

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

View File

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

View File

@ -1,6 +1,5 @@
--- ---
source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs 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 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 SIM114.py:29:5: SIM114 [*] Combine `if` branches using logical `or` operator
| |
28 | if x == 1: 28 | if x == 1:
29 | if True: 29 | / if True:
| _____^
30 | | for _ in range(20): 30 | | for _ in range(20):
31 | | print("hello") 31 | | print("hello")
32 | | elif False: 32 | | elif False:
@ -186,8 +184,7 @@ SIM114.py:36:5: SIM114 [*] Combine `if` branches using logical `or` operator
| |
34 | print("hello") 34 | print("hello")
35 | elif x == 2: 35 | elif x == 2:
36 | if True: 36 | / if True:
| _____^
37 | | for _ in range(20): 37 | | for _ in range(20):
38 | | print("hello") 38 | | print("hello")
39 | | elif False: 39 | | elif False:
@ -333,8 +330,7 @@ SIM114.py:118:5: SIM114 [*] Combine `if` branches using logical `or` operator
| |
116 | a = True 116 | a = True
117 | b = False 117 | b = False
118 | if a > b: # end-of-line 118 | / if a > b: # end-of-line
| _____^
119 | | return 3 119 | | return 3
120 | | elif a == b: 120 | | elif a == b:
121 | | return 3 121 | | return 3
@ -360,8 +356,7 @@ SIM114.py:122:5: SIM114 [*] Combine `if` branches using logical `or` operator
| |
120 | elif a == b: 120 | elif a == b:
121 | return 3 121 | return 3
122 | elif a < b: # end-of-line 122 | / elif a < b: # end-of-line
| _____^
123 | | return 4 123 | | return 4
124 | | elif b is None: 124 | | elif b is None:
125 | | return 4 125 | | return 4
@ -385,8 +380,7 @@ SIM114.py:132:5: SIM114 [*] Combine `if` branches using logical `or` operator
| |
130 | a = True 130 | a = True
131 | b = False 131 | b = False
132 | if a > b: # end-of-line 132 | / if a > b: # end-of-line
| _____^
133 | | return 3 133 | | return 3
134 | | elif a := 1: 134 | | elif a := 1:
135 | | return 3 135 | | return 3

View File

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

View File

@ -1,6 +1,5 @@
--- ---
source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs 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 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 43 | pass
44 | else: 44 | else:
45 | if key in a_dict: 45 | / if key in a_dict:
| _____^
46 | | vars[idx] = a_dict[key] 46 | | vars[idx] = a_dict[key]
47 | | else: 47 | | else:
48 | | vars[idx] = "default" 48 | | vars[idx] = "default"

View File

@ -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()` TC006.py:59:9: TC006 [*] Add quotes to type expression in `typing.cast()`
| |
58 | 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, 60 | | | None,
| |______________^ TC006 | |______________^ TC006
61 | 3.0 61 | 3.0

View File

@ -1,6 +1,5 @@
--- ---
source: crates/ruff_linter/src/rules/flake8_use_pathlib/mod.rs 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` 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` PTH201.py:26:5: PTH201 [*] Do not pass the current directory explicitly to `Path`
| |
25 | Path( 25 | Path(
26 | '' # Comment in the middle of implicitly concatenated string 26 | / '' # Comment in the middle of implicitly concatenated string
| _____^
27 | | ".", 27 | | ".",
| |_______^ PTH201 | |_______^ PTH201
28 | ) 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` PTH201.py:48:5: PTH201 [*] Do not pass the current directory explicitly to `Path`
| |
47 | ( Path( 47 | ( Path(
48 | '' # Comment in the middle of implicitly concatenated string 48 | / '' # Comment in the middle of implicitly concatenated string
| _____^
49 | | ".", 49 | | ".",
| |_______^ PTH201 | |_______^ PTH201
50 | ) )/ (("parenthesized path call") 50 | ) )/ (("parenthesized path call")

View File

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

View File

@ -1,6 +1,5 @@
--- ---
source: crates/ruff_linter/src/rules/isort/mod.rs 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 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 trailing_suffix.py:5:5: I001 Import block is un-sorted or un-formatted
| |
4 | if True: 4 | if True:
5 | import sys 5 | / import sys
| _____^
6 | | import os; x = 1 6 | | import os; x = 1
| |_____________^ I001 | |_____________^ I001
| |

View File

@ -1,13 +1,11 @@
--- ---
source: crates/ruff_linter/src/rules/perflint/mod.rs 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 PERF203.py:5:5: PERF203 `try`-`except` within a loop incurs performance overhead
| |
3 | try: 3 | try:
4 | print(f"{i}") 4 | print(f"{i}")
5 | except: 5 | / except:
| _____^
6 | | print("error") 6 | | print("error")
| |______________________^ PERF203 | |______________________^ PERF203
7 | 7 |

View File

@ -151,8 +151,7 @@ PERF401.py:210:13: PERF401 Use a list comprehension to create a transformed list
| |
208 | ): # Comment 3 208 | ): # Comment 3
209 | if i % 2: # Comment 4 209 | if i % 2: # Comment 4
210 | result.append( 210 | / result.append(
| _____________^
211 | | ( 211 | | (
212 | | i + 1, 212 | | i + 1,
213 | | # Comment 5 213 | | # Comment 5

View File

@ -355,8 +355,7 @@ PERF401.py:210:13: PERF401 [*] Use a list comprehension to create a transformed
| |
208 | ): # Comment 3 208 | ): # Comment 3
209 | if i % 2: # Comment 4 209 | if i % 2: # Comment 4
210 | result.append( 210 | / result.append(
| _____________^
211 | | ( 211 | | (
212 | | i + 1, 212 | | i + 1,
213 | | # Comment 5 213 | | # Comment 5

View File

@ -1,6 +1,5 @@
--- ---
source: crates/ruff_linter/src/rules/pycodestyle/mod.rs 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` 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 145 | # E731
146 | 146 |
147 | f = lambda: ( 147 | / f = lambda: (
| _____^
148 | | i := 1, 148 | | i := 1,
149 | | ) 149 | | )
| |_____^ E731 | |_____^ E731

View File

@ -1,13 +1,11 @@
--- ---
source: crates/ruff_linter/src/rules/pydoclint/mod.rs 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` DOC502_google.py:7:5: DOC502 Raised exception is not explicitly raised: `FasterThanLightError`
| |
5 | # DOC502 5 | # DOC502
6 | def calculate_speed(distance: float, time: float) -> float: 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 | | 8 | |
9 | | Args: 9 | | Args:
10 | | distance: Distance traveled. 10 | | distance: Distance traveled.
@ -28,8 +26,7 @@ DOC502_google.py:24:5: DOC502 Raised exceptions are not explicitly raised: `Fast
| |
22 | # DOC502 22 | # DOC502
23 | def calculate_speed(distance: float, time: float) -> float: 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 | | 25 | |
26 | | Args: 26 | | Args:
27 | | distance: Distance traveled. 27 | | distance: Distance traveled.
@ -51,8 +48,7 @@ DOC502_google.py:42:5: DOC502 Raised exception is not explicitly raised: `Divisi
| |
40 | # DOC502 40 | # DOC502
41 | def calculate_speed(distance: float, time: float) -> float: 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 | | 43 | |
44 | | Args: 44 | | Args:
45 | | distance: Distance traveled. 45 | | distance: Distance traveled.

View File

@ -1,13 +1,11 @@
--- ---
source: crates/ruff_linter/src/rules/pydoclint/mod.rs 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` DOC502_numpy.py:7:5: DOC502 Raised exception is not explicitly raised: `FasterThanLightError`
| |
5 | # DOC502 5 | # DOC502
6 | def calculate_speed(distance: float, time: float) -> float: 6 | def calculate_speed(distance: float, time: float) -> float:
7 | """ 7 | / """
| _____^
8 | | Calculate speed as distance divided by time. 8 | | Calculate speed as distance divided by time.
9 | | 9 | |
10 | | Parameters 10 | | Parameters
@ -36,8 +34,7 @@ DOC502_numpy.py:32:5: DOC502 Raised exceptions are not explicitly raised: `Faste
| |
30 | # DOC502 30 | # DOC502
31 | def calculate_speed(distance: float, time: float) -> float: 31 | def calculate_speed(distance: float, time: float) -> float:
32 | """ 32 | / """
| _____^
33 | | Calculate speed as distance divided by time. 33 | | Calculate speed as distance divided by time.
34 | | 34 | |
35 | | Parameters 35 | | Parameters
@ -68,8 +65,7 @@ DOC502_numpy.py:59:5: DOC502 Raised exception is not explicitly raised: `Divisio
| |
57 | # DOC502 57 | # DOC502
58 | def calculate_speed(distance: float, time: float) -> float: 58 | def calculate_speed(distance: float, time: float) -> float:
59 | """ 59 | / """
| _____^
60 | | Calculate speed as distance divided by time. 60 | | Calculate speed as distance divided by time.
61 | | 61 | |
62 | | Parameters 62 | | Parameters

View File

@ -1,13 +1,11 @@
--- ---
source: crates/ruff_linter/src/rules/pydoclint/mod.rs 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 DOC202_google.py:14:5: DOC202 Docstring should not have a returns section because the function doesn't return anything
| |
12 | # DOC202 12 | # DOC202
13 | def foo(num: int) -> str: 13 | def foo(num: int) -> str:
14 | """ 14 | / """
| _____^
15 | | Do something 15 | | Do something
16 | | 16 | |
17 | | Args: 17 | | Args:
@ -25,8 +23,7 @@ DOC202_google.py:30:9: DOC202 Docstring should not have a returns section becaus
| |
28 | # DOC202 28 | # DOC202
29 | def foo(self) -> str: 29 | def foo(self) -> str:
30 | """ 30 | / """
| _________^
31 | | Do something 31 | | Do something
32 | | 32 | |
33 | | Args: 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 78 | # DOC202 -- never explicitly returns anything, just short-circuits
79 | def foo(s: str, condition: bool): 79 | def foo(s: str, condition: bool):
80 | """Fooey things. 80 | / """Fooey things.
| _____^
81 | | 81 | |
82 | | Returns: 82 | | Returns:
83 | | None 83 | | None

View File

@ -1,13 +1,11 @@
--- ---
source: crates/ruff_linter/src/rules/pydoclint/mod.rs 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 DOC202_numpy.py:16:5: DOC202 Docstring should not have a returns section because the function doesn't return anything
| |
14 | # DOC202 14 | # DOC202
15 | def foo(num: int) -> str: 15 | def foo(num: int) -> str:
16 | """ 16 | / """
| _____^
17 | | Do something 17 | | Do something
18 | | 18 | |
19 | | Parameters 19 | | Parameters
@ -29,8 +27,7 @@ DOC202_numpy.py:36:9: DOC202 Docstring should not have a returns section because
| |
34 | # DOC202 34 | # DOC202
35 | def foo(self) -> str: 35 | def foo(self) -> str:
36 | """ 36 | / """
| _________^
37 | | Do something 37 | | Do something
38 | | 38 | |
39 | | Parameters 39 | | Parameters

View File

@ -1,13 +1,11 @@
--- ---
source: crates/ruff_linter/src/rules/pydoclint/mod.rs 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 DOC403_google.py:14:5: DOC403 Docstring has a "Yields" section but the function doesn't yield anything
| |
12 | # DOC403 12 | # DOC403
13 | def foo(num: int) -> str: 13 | def foo(num: int) -> str:
14 | """ 14 | / """
| _____^
15 | | Do something 15 | | Do something
16 | | 16 | |
17 | | Args: 17 | | Args:
@ -25,8 +23,7 @@ DOC403_google.py:30:9: DOC403 Docstring has a "Yields" section but the function
| |
28 | # DOC403 28 | # DOC403
29 | def foo(self) -> str: 29 | def foo(self) -> str:
30 | """ 30 | / """
| _________^
31 | | Do something 31 | | Do something
32 | | 32 | |
33 | | Args: 33 | | Args:

View File

@ -1,13 +1,11 @@
--- ---
source: crates/ruff_linter/src/rules/pydoclint/mod.rs 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 DOC403_numpy.py:16:5: DOC403 Docstring has a "Yields" section but the function doesn't yield anything
| |
14 | # DOC403 14 | # DOC403
15 | def foo(num: int) -> str: 15 | def foo(num: int) -> str:
16 | """ 16 | / """
| _____^
17 | | Do something 17 | | Do something
18 | | 18 | |
19 | | Parameters 19 | | Parameters
@ -29,8 +27,7 @@ DOC403_numpy.py:36:9: DOC403 Docstring has a "Yields" section but the function d
| |
34 | # DOC403 34 | # DOC403
35 | def foo(self) -> str: 35 | def foo(self) -> str:
36 | """ 36 | / """
| _________^
37 | | Do something 37 | | Do something
38 | | 38 | |
39 | | Parameters 39 | | Parameters

View File

@ -1,13 +1,11 @@
--- ---
source: crates/ruff_linter/src/rules/pydoclint/mod.rs source: crates/ruff_linter/src/rules/pydoclint/mod.rs
snapshot_kind: text
--- ---
DOC501_google.py:34:5: DOC501 Raised exception `FasterThanLightError` missing from docstring DOC501_google.py:34:5: DOC501 Raised exception `FasterThanLightError` missing from docstring
| |
32 | # DOC501 32 | # DOC501
33 | def calculate_speed(distance: float, time: float) -> float: 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 | | 35 | |
36 | | Args: 36 | | Args:
37 | | distance: Distance traveled. 37 | | distance: Distance traveled.
@ -26,8 +24,7 @@ DOC501_google.py:51:5: DOC501 Raised exception `ValueError` missing from docstri
| |
49 | # DOC501 49 | # DOC501
50 | def calculate_speed(distance: float, time: float) -> float: 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 | | 52 | |
53 | | Args: 53 | | Args:
54 | | distance: Distance traveled. 54 | | distance: Distance traveled.
@ -46,8 +43,7 @@ DOC501_google.py:51:5: DOC501 Raised exception `FasterThanLightError` missing fr
| |
49 | # DOC501 49 | # DOC501
50 | def calculate_speed(distance: float, time: float) -> float: 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 | | 52 | |
53 | | Args: 53 | | Args:
54 | | distance: Distance traveled. 54 | | distance: Distance traveled.
@ -66,8 +62,7 @@ DOC501_google.py:106:5: DOC501 Raised exception `AnotherError` missing from docs
| |
104 | # DOC501 104 | # DOC501
105 | def calculate_speed(distance: float, time: float) -> float: 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 | | 107 | |
108 | | Args: 108 | | Args:
109 | | distance: Distance traveled. 109 | | distance: Distance traveled.
@ -85,8 +80,7 @@ DOC501_google.py:120:5: DOC501 Raised exception `AnotherError` missing from docs
| |
118 | # DOC501 118 | # DOC501
119 | def calculate_speed(distance: float, time: float) -> float: 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 | | 121 | |
122 | | Args: 122 | | Args:
123 | | distance: Distance traveled. 123 | | distance: Distance traveled.
@ -104,8 +98,7 @@ DOC501_google.py:134:5: DOC501 Raised exception `SomeError` missing from docstri
| |
132 | # DOC501 132 | # DOC501
133 | def foo(bar: int): 133 | def foo(bar: int):
134 | """Foo. 134 | / """Foo.
| _____^
135 | | 135 | |
136 | | Args: 136 | | Args:
137 | | bar: Bar. 137 | | bar: Bar.
@ -119,8 +112,7 @@ DOC501_google.py:197:5: DOC501 Raised exception `ZeroDivisionError` missing from
| |
195 | # DOC501 195 | # DOC501
196 | def calculate_speed(distance: float, time: float) -> float: 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 | | 198 | |
199 | | Args: 199 | | Args:
200 | | distance: Distance traveled. 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 DOC501_google.py:238:5: DOC501 Raised exception `TypeError` missing from docstring
| |
237 | def foo(): 237 | def foo():
238 | """Foo. 238 | / """Foo.
| _____^
239 | | 239 | |
240 | | Returns: 240 | | Returns:
241 | | 42: int. 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 DOC501_google.py:238:5: DOC501 Raised exception `ValueError` missing from docstring
| |
237 | def foo(): 237 | def foo():
238 | """Foo. 238 | / """Foo.
| _____^
239 | | 239 | |
240 | | Returns: 240 | | Returns:
241 | | 42: int. 241 | | 42: int.

View File

@ -1,13 +1,11 @@
--- ---
source: crates/ruff_linter/src/rules/pydoclint/mod.rs source: crates/ruff_linter/src/rules/pydoclint/mod.rs
snapshot_kind: text
--- ---
DOC501_numpy.py:35:5: DOC501 Raised exception `FasterThanLightError` missing from docstring DOC501_numpy.py:35:5: DOC501 Raised exception `FasterThanLightError` missing from docstring
| |
33 | # DOC501 33 | # DOC501
34 | def calculate_speed(distance: float, time: float) -> float: 34 | def calculate_speed(distance: float, time: float) -> float:
35 | """ 35 | / """
| _____^
36 | | Calculate speed as distance divided by time. 36 | | Calculate speed as distance divided by time.
37 | | 37 | |
38 | | Parameters 38 | | Parameters
@ -32,8 +30,7 @@ DOC501_numpy.py:58:5: DOC501 Raised exception `ValueError` missing from docstrin
| |
56 | # DOC501 56 | # DOC501
57 | def calculate_speed(distance: float, time: float) -> float: 57 | def calculate_speed(distance: float, time: float) -> float:
58 | """ 58 | / """
| _____^
59 | | Calculate speed as distance divided by time. 59 | | Calculate speed as distance divided by time.
60 | | 60 | |
61 | | Parameters 61 | | Parameters
@ -58,8 +55,7 @@ DOC501_numpy.py:58:5: DOC501 Raised exception `FasterThanLightError` missing fro
| |
56 | # DOC501 56 | # DOC501
57 | def calculate_speed(distance: float, time: float) -> float: 57 | def calculate_speed(distance: float, time: float) -> float:
58 | """ 58 | / """
| _____^
59 | | Calculate speed as distance divided by time. 59 | | Calculate speed as distance divided by time.
60 | | 60 | |
61 | | Parameters 61 | | Parameters
@ -84,8 +80,7 @@ DOC501_numpy.py:83:5: DOC501 Raised exception `TypeError` missing from docstring
| |
81 | # DOC501 81 | # DOC501
82 | def calculate_speed(distance: float, time: float) -> float: 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 | | 84 | |
85 | | ACalculate speed as distance divided by time. 85 | | ACalculate speed as distance divided by time.
86 | | 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 DOC501_numpy.py:139:5: DOC501 Raised exception `TypeError` missing from docstring
| |
138 | def foo(): 138 | def foo():
139 | """Foo. 139 | / """Foo.
| _____^
140 | | 140 | |
141 | | Returns 141 | | Returns
142 | | ------- 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 DOC501_numpy.py:139:5: DOC501 Raised exception `ValueError` missing from docstring
| |
138 | def foo(): 138 | def foo():
139 | """Foo. 139 | / """Foo.
| _____^
140 | | 140 | |
141 | | Returns 141 | | Returns
142 | | ------- 142 | | -------

View File

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

View File

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

View File

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

View File

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

View File

@ -1,13 +1,11 @@
--- ---
source: crates/ruff_linter/src/rules/pydocstyle/mod.rs 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 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') 127 | @expect('D212: Multi-line docstring summary should start at the first line')
128 | def asdlkfasd(): 128 | def asdlkfasd():
129 | """ 129 | / """
| _____^
130 | | Wrong. 130 | | Wrong.
131 | | """ 131 | | """
| |_______^ D200 | |_______^ 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') 595 | @expect('D212: Multi-line docstring summary should start at the first line')
596 | def one_liner(): 596 | def one_liner():
597 | """ 597 | / """
| _____^
598 | | 598 | |
599 | | Wrong.""" 599 | | Wrong."""
| |_____________^ D200 | |_____________^ 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') 604 | @expect('D212: Multi-line docstring summary should start at the first line')
605 | def one_liner(): 605 | def one_liner():
606 | r"""Wrong. 606 | / r"""Wrong.
| _____^
607 | | 607 | |
608 | | """ 608 | | """
| |_______^ D200 | |_______^ 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') 613 | @expect('D212: Multi-line docstring summary should start at the first line')
614 | def one_liner(): 614 | def one_liner():
615 | """Wrong." 615 | / """Wrong."
| _____^
616 | | 616 | |
617 | | """ 617 | | """
| |_______^ D200 | |_______^ 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') 622 | @expect('D212: Multi-line docstring summary should start at the first line')
623 | def one_liner(): 623 | def one_liner():
624 | """ 624 | / """
| _____^
625 | | 625 | |
626 | | "Wrong.""" 626 | | "Wrong."""
| |______________^ D200 | |______________^ 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 D.py:645:5: D200 One-line docstring should fit on one line
| |
644 | def single_line_docstring_with_an_escaped_backslash(): 644 | def single_line_docstring_with_an_escaped_backslash():
645 | "\ 645 | / "\
| _____^
646 | | " 646 | | "
| |_____^ D200 | |_____^ D200
647 | 647 |

View File

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

View File

@ -1,6 +1,5 @@
--- ---
source: crates/ruff_linter/src/rules/pydocstyle/mod.rs 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) 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(): 544 | def multiline_leading_space():
545 | 545 |
546 | """Leading space. 546 | / """Leading space.
| _____^
547 | | 547 | |
548 | | More content. 548 | | More content.
549 | | """ 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(): 566 | def multiline_trailing_and_leading_space():
567 | 567 |
568 | """Trailing and leading space. 568 | / """Trailing and leading space.
| _____^
569 | | 569 | |
570 | | More content. 570 | | More content.
571 | | """ 571 | | """

View File

@ -1,6 +1,5 @@
--- ---
source: crates/ruff_linter/src/rules/pydocstyle/mod.rs 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) 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') 553 | @expect('D213: Multi-line docstring summary should start at the second line')
554 | def multiline_trailing_space(): 554 | def multiline_trailing_space():
555 | """Leading space. 555 | / """Leading space.
| _____^
556 | | 556 | |
557 | | More content. 557 | | More content.
558 | | """ 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(): 566 | def multiline_trailing_and_leading_space():
567 | 567 |
568 | """Trailing and leading space. 568 | / """Trailing and leading space.
| _____^
569 | | 569 | |
570 | | More content. 570 | | More content.
571 | | """ 571 | | """

View File

@ -1,6 +1,5 @@
--- ---
source: crates/ruff_linter/src/rules/pydocstyle/mod.rs source: crates/ruff_linter/src/rules/pydocstyle/mod.rs
snapshot_kind: text
--- ---
D.py:161:5: D203 [*] 1 blank line required before class docstring 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. 524 | # parameters as functions for Google / Numpy conventions.
525 | class Blah: # noqa: D203,D213 525 | class Blah: # noqa: D203,D213
526 | """A Blah. 526 | / """A Blah.
| _____^
527 | | 527 | |
528 | | Parameters 528 | | Parameters
529 | | ---------- 529 | | ----------

View File

@ -1,13 +1,11 @@
--- ---
source: crates/ruff_linter/src/rules/pydocstyle/mod.rs 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 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') 198 | @expect('D213: Multi-line docstring summary should start at the second line')
199 | def multi_line_zero_separating_blanks(): 199 | def multi_line_zero_separating_blanks():
200 | """Summary. 200 | / """Summary.
| _____^
201 | | Description. 201 | | Description.
202 | | 202 | |
203 | | """ 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') 208 | @expect('D213: Multi-line docstring summary should start at the second line')
209 | def multi_line_two_separating_blanks(): 209 | def multi_line_two_separating_blanks():
210 | """Summary. 210 | / """Summary.
| _____^
211 | | 211 | |
212 | | 212 | |
213 | | Description. 213 | | Description.

View File

@ -1,13 +1,11 @@
--- ---
source: crates/ruff_linter/src/rules/pydocstyle/mod.rs 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 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') 279 | @expect('D213: Multi-line docstring summary should start at the second line')
280 | def asdfljdf24(): 280 | def asdfljdf24():
281 | """Summary. 281 | / """Summary.
| _____^
282 | | 282 | |
283 | | Description.""" 283 | | Description."""
| |___________________^ D209 | |___________________^ 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') 586 | @expect('D213: Multi-line docstring summary should start at the second line')
587 | def asdfljdjgf24(): 587 | def asdfljdjgf24():
588 | """Summary. 588 | / """Summary.
| _____^
589 | | 589 | |
590 | | Description. """ 590 | | Description. """
| |_____________________^ D209 | |_____________________^ D209

View File

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

View File

@ -1,13 +1,11 @@
--- ---
source: crates/ruff_linter/src/rules/pydocstyle/mod.rs 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 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') 127 | @expect('D212: Multi-line docstring summary should start at the first line')
128 | def asdlkfasd(): 128 | def asdlkfasd():
129 | """ 129 | / """
| _____^
130 | | Wrong. 130 | | Wrong.
131 | | """ 131 | | """
| |_______^ D212 | |_______^ 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') 595 | @expect('D212: Multi-line docstring summary should start at the first line')
596 | def one_liner(): 596 | def one_liner():
597 | """ 597 | / """
| _____^
598 | | 598 | |
599 | | Wrong.""" 599 | | Wrong."""
| |_____________^ D212 | |_____________^ 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') 622 | @expect('D212: Multi-line docstring summary should start at the first line')
623 | def one_liner(): 623 | def one_liner():
624 | """ 624 | / """
| _____^
625 | | 625 | |
626 | | "Wrong.""" 626 | | "Wrong."""
| |______________^ D212 | |______________^ D212

View File

@ -1,13 +1,11 @@
--- ---
source: crates/ruff_linter/src/rules/pydocstyle/mod.rs 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 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') 198 | @expect('D213: Multi-line docstring summary should start at the second line')
199 | def multi_line_zero_separating_blanks(): 199 | def multi_line_zero_separating_blanks():
200 | """Summary. 200 | / """Summary.
| _____^
201 | | Description. 201 | | Description.
202 | | 202 | |
203 | | """ 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') 208 | @expect('D213: Multi-line docstring summary should start at the second line')
209 | def multi_line_two_separating_blanks(): 209 | def multi_line_two_separating_blanks():
210 | """Summary. 210 | / """Summary.
| _____^
211 | | 211 | |
212 | | 212 | |
213 | | Description. 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') 218 | @expect('D213: Multi-line docstring summary should start at the second line')
219 | def multi_line_one_separating_blanks(): 219 | def multi_line_one_separating_blanks():
220 | """Summary. 220 | / """Summary.
| _____^
221 | | 221 | |
222 | | Description. 222 | | Description.
223 | | 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') 228 | @expect('D213: Multi-line docstring summary should start at the second line')
229 | def asdfsdf(): 229 | def asdfsdf():
230 | """Summary. 230 | / """Summary.
| _____^
231 | | 231 | |
232 | | Description. 232 | | Description.
233 | | 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') 238 | @expect('D213: Multi-line docstring summary should start at the second line')
239 | def asdsdfsdffsdf(): 239 | def asdsdfsdffsdf():
240 | """Summary. 240 | / """Summary.
| _____^
241 | | 241 | |
242 | | Description. 242 | | Description.
243 | | 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') 248 | @expect('D213: Multi-line docstring summary should start at the second line')
249 | def asdfsdsdf24(): 249 | def asdfsdsdf24():
250 | """Summary. 250 | / """Summary.
| _____^
251 | | 251 | |
252 | | Description. 252 | | Description.
253 | | 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') 258 | @expect('D213: Multi-line docstring summary should start at the second line')
259 | def asdfsdsdfsdf24(): 259 | def asdfsdsdfsdf24():
260 | """Summary. 260 | / """Summary.
| _____^
261 | | 261 | |
262 | | Description. 262 | | Description.
263 | | 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') 268 | @expect('D213: Multi-line docstring summary should start at the second line')
269 | def asdfsdfsdsdsdfsdf24(): 269 | def asdfsdfsdsdsdfsdf24():
270 | """Summary. 270 | / """Summary.
| _____^
271 | | 271 | |
272 | | Description. 272 | | Description.
273 | | 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') 279 | @expect('D213: Multi-line docstring summary should start at the second line')
280 | def asdfljdf24(): 280 | def asdfljdf24():
281 | """Summary. 281 | / """Summary.
| _____^
282 | | 282 | |
283 | | Description.""" 283 | | Description."""
| |___________________^ D213 | |___________________^ 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') 297 | @expect('D213: Multi-line docstring summary should start at the second line')
298 | def multiline(): 298 | def multiline():
299 | """ Whitespace at the beginning. 299 | / """ Whitespace at the beginning.
| _____^
300 | | 300 | |
301 | | This is the end. 301 | | This is the end.
302 | | """ 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') 341 | @expect('D213: Multi-line docstring summary should start at the second line')
342 | def exceptions_of_D301(): 342 | def exceptions_of_D301():
343 | """Exclude some backslashes from D301. 343 | / """Exclude some backslashes from D301.
| _____^
344 | | 344 | |
345 | | In particular, line continuations \ 345 | | In particular, line continuations \
346 | | and unicode literals \u0394 and \N{GREEK CAPITAL LETTER DELTA}. 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') 381 | @expect('D213: Multi-line docstring summary should start at the second line')
382 | def new_209(): 382 | def new_209():
383 | """First line. 383 | / """First line.
| _____^
384 | | 384 | |
385 | | More lines. 385 | | More lines.
386 | | """ 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') 390 | @expect('D213: Multi-line docstring summary should start at the second line')
391 | def old_209(): 391 | def old_209():
392 | """One liner. 392 | / """One liner.
| _____^
393 | | 393 | |
394 | | Multi-line comments. OK to have extra blank line 394 | | Multi-line comments. OK to have extra blank line
395 | | 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') 448 | @expect('D213: Multi-line docstring summary should start at the second line')
449 | def a_following_valid_function(x=None): 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 | | 451 | |
452 | | The assertion was caused in the next function, so this one is necessary. 452 | | The assertion was caused in the next function, so this one is necessary.
453 | | 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. 524 | # parameters as functions for Google / Numpy conventions.
525 | class Blah: # noqa: D203,D213 525 | class Blah: # noqa: D203,D213
526 | """A Blah. 526 | / """A Blah.
| _____^
527 | | 527 | |
528 | | Parameters 528 | | Parameters
529 | | ---------- 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(): 544 | def multiline_leading_space():
545 | 545 |
546 | """Leading space. 546 | / """Leading space.
| _____^
547 | | 547 | |
548 | | More content. 548 | | More content.
549 | | """ 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') 553 | @expect('D213: Multi-line docstring summary should start at the second line')
554 | def multiline_trailing_space(): 554 | def multiline_trailing_space():
555 | """Leading space. 555 | / """Leading space.
| _____^
556 | | 556 | |
557 | | More content. 557 | | More content.
558 | | """ 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(): 566 | def multiline_trailing_and_leading_space():
567 | 567 |
568 | """Trailing and leading space. 568 | / """Trailing and leading space.
| _____^
569 | | 569 | |
570 | | More content. 570 | | More content.
571 | | """ 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') 586 | @expect('D213: Multi-line docstring summary should start at the second line')
587 | def asdfljdjgf24(): 587 | def asdfljdjgf24():
588 | """Summary. 588 | / """Summary.
| _____^
589 | | 589 | |
590 | | Description. """ 590 | | Description. """
| |_____________________^ D213 | |_____________________^ 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') 604 | @expect('D212: Multi-line docstring summary should start at the first line')
605 | def one_liner(): 605 | def one_liner():
606 | r"""Wrong. 606 | / r"""Wrong.
| _____^
607 | | 607 | |
608 | | """ 608 | | """
| |_______^ D213 | |_______^ 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') 613 | @expect('D212: Multi-line docstring summary should start at the first line')
614 | def one_liner(): 614 | def one_liner():
615 | """Wrong." 615 | / """Wrong."
| _____^
616 | | 616 | |
617 | | """ 617 | | """
| |_______^ D213 | |_______^ 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 D.py:671:5: D213 [*] Multi-line docstring summary should start at the second line
| |
670 | def retain_extra_whitespace(): 670 | def retain_extra_whitespace():
671 | """Summary. 671 | / """Summary.
| _____^
672 | | 672 | |
673 | | This is overindented 673 | | This is overindented
674 | | And so is this, but it we should preserve the extra space on this line relative 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 D.py:680:5: D213 [*] Multi-line docstring summary should start at the second line
| |
679 | def retain_extra_whitespace_multiple(): 679 | def retain_extra_whitespace_multiple():
680 | """Summary. 680 | / """Summary.
| _____^
681 | | 681 | |
682 | | This is overindented 682 | | This is overindented
683 | | And so is this, but it we should preserve the extra space on this line relative 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 D.py:693:5: D213 [*] Multi-line docstring summary should start at the second line
| |
692 | def retain_extra_whitespace_deeper(): 692 | def retain_extra_whitespace_deeper():
693 | """Summary. 693 | / """Summary.
| _____^
694 | | 694 | |
695 | | This is overindented 695 | | This is overindented
696 | | And so is this, but it we should preserve the extra space on this line relative 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 D.py:702:5: D213 [*] Multi-line docstring summary should start at the second line
| |
701 | def retain_extra_whitespace_followed_by_same_offset(): 701 | def retain_extra_whitespace_followed_by_same_offset():
702 | """Summary. 702 | / """Summary.
| _____^
703 | | 703 | |
704 | | This is overindented 704 | | This is overindented
705 | | And so is this, but it we should preserve the extra space on this line relative 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 D.py:712:5: D213 [*] Multi-line docstring summary should start at the second line
| |
711 | def retain_extra_whitespace_not_overindented(): 711 | def retain_extra_whitespace_not_overindented():
712 | """Summary. 712 | / """Summary.
| _____^
713 | | 713 | |
714 | | This is not overindented 714 | | This is not overindented
715 | | This is overindented, but since one line is not overindented this should not raise 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 D.py:721:5: D213 [*] Multi-line docstring summary should start at the second line
| |
720 | def inconsistent_indent_byte_size(): 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 | | 722 | |
723 | |     Returns: 723 | |     Returns:
724 | | """ 724 | | """

View File

@ -1,6 +1,5 @@
--- ---
source: crates/ruff_linter/src/rules/pydocstyle/mod.rs source: crates/ruff_linter/src/rules/pydocstyle/mod.rs
snapshot_kind: text
--- ---
D.py:307:5: D300 [*] Use triple double quotes `"""` 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 `"""` D.py:645:5: D300 [*] Use triple double quotes `"""`
| |
644 | def single_line_docstring_with_an_escaped_backslash(): 644 | def single_line_docstring_with_an_escaped_backslash():
645 | "\ 645 | / "\
| _____^
646 | | " 646 | | "
| |_____^ D300 | |_____^ D300
647 | 647 |
@ -182,8 +180,7 @@ D.py:658:5: D300 [*] Use triple double quotes `"""`
D.py:664:5: D300 [*] Use triple double quotes `"""` D.py:664:5: D300 [*] Use triple double quotes `"""`
| |
663 | def newline_after_closing_quote(self): 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" 665 | | but continuations shouldn't be considered multi-line"
| |_________________________________________________________^ D300 | |_________________________________________________________^ D300
| |

View File

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

View File

@ -1,6 +1,5 @@
--- ---
source: crates/ruff_linter/src/rules/pydocstyle/mod.rs source: crates/ruff_linter/src/rules/pydocstyle/mod.rs
snapshot_kind: text
--- ---
D.py:355:5: D400 [*] First line should end with a period 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') 613 | @expect('D212: Multi-line docstring summary should start at the first line')
614 | def one_liner(): 614 | def one_liner():
615 | """Wrong." 615 | / """Wrong."
| _____^
616 | | 616 | |
617 | | """ 617 | | """
| |_______^ D400 | |_______^ 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 D.py:664:5: D400 [*] First line should end with a period
| |
663 | def newline_after_closing_quote(self): 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" 665 | | but continuations shouldn't be considered multi-line"
| |_________________________________________________________^ D400 | |_________________________________________________________^ D400
| |

View File

@ -1,6 +1,5 @@
--- ---
source: crates/ruff_linter/src/rules/pydocstyle/mod.rs source: crates/ruff_linter/src/rules/pydocstyle/mod.rs
snapshot_kind: text
--- ---
D400.py:2:5: D400 [*] First line should end with a period 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 D400.py:12:5: D400 [*] First line should end with a period
| |
11 | def f(): 11 | def f():
12 | """ 12 | / """
| _____^
13 | | Here's a line without a period, 13 | | Here's a line without a period,
14 | | but here's the next line 14 | | but here's the next line
15 | | """ 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 D400.py:25:5: D400 [*] First line should end with a period
| |
24 | def f(): 24 | def f():
25 | """ 25 | / """
| _____^
26 | | Here's a line without a period, 26 | | Here's a line without a period,
27 | | but here's the next line""" 27 | | but here's the next line"""
| |_______________________________^ D400 | |_______________________________^ 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 D400.py:32:5: D400 [*] First line should end with a period
| |
31 | def f(): 31 | def f():
32 | """ 32 | / """
| _____^
33 | | Here's a line without a period, 33 | | Here's a line without a period,
34 | | but here's the next line with trailing space """ 34 | | but here's the next line with trailing space """
| |____________________________________________________^ D400 | |____________________________________________________^ 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 D400.py:49:5: D400 [*] First line should end with a period
| |
48 | def f(): 48 | def f():
49 | r""" 49 | / r"""
| _____^
50 | | Here's a line without a period, 50 | | Here's a line without a period,
51 | | but here's the next line 51 | | but here's the next line
52 | | """ 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 D400.py:62:5: D400 [*] First line should end with a period
| |
61 | def f(): 61 | def f():
62 | r""" 62 | / r"""
| _____^
63 | | Here's a line without a period, 63 | | Here's a line without a period,
64 | | but here's the next line""" 64 | | but here's the next line"""
| |_______________________________^ D400 | |_______________________________^ 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 D400.py:69:5: D400 [*] First line should end with a period
| |
68 | def f(): 68 | def f():
69 | r""" 69 | / r"""
| _____^
70 | | Here's a line without a period, 70 | | Here's a line without a period,
71 | | but here's the next line with trailing space """ 71 | | but here's the next line with trailing space """
| |____________________________________________________^ D400 | |____________________________________________________^ 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 D400.py:97:5: D400 [*] First line should end with a period
| |
96 | def f(): 96 | def f():
97 | """ 97 | / """
| _____^
98 | | My example 98 | | My example
99 | | ========== 99 | | ==========
100 | | 100 | |

View File

@ -1,6 +1,5 @@
--- ---
source: crates/ruff_linter/src/rules/pydocstyle/mod.rs 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." 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." D401.py:18:5: D401 First line of docstring should be in imperative mood: "Constructor for a boa."
| |
17 | def bad_sdgfsdg23245777(): 17 | def bad_sdgfsdg23245777():
18 | """ 18 | / """
| _____^
19 | | 19 | |
20 | | Constructor for a boa. 20 | | Constructor for a boa.
21 | | 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" D401.py:35:5: D401 First line of docstring should be in imperative mood: "Writes a logical line that"
| |
34 | def multi_line(): 34 | def multi_line():
35 | """Writes a logical line that 35 | / """Writes a logical line that
| _____^
36 | | extends to two physical lines. 36 | | extends to two physical lines.
37 | | """ 37 | | """
| |_______^ D401 | |_______^ D401

View File

@ -1,6 +1,5 @@
--- ---
source: crates/ruff_linter/src/rules/pydocstyle/mod.rs 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` 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` D403.py:36:5: D403 [*] First word of the docstring should be capitalized: `here` -> `Here`
| |
35 | def first_word_lots_of_whitespace(): 35 | def first_word_lots_of_whitespace():
36 | """ 36 | / """
| _____^
37 | | 37 | |
38 | | 38 | |
39 | | 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` D403.py:46:5: D403 [*] First word of the docstring should be capitalized: `singleword` -> `Singleword`
| |
45 | def single_word_newline(): 45 | def single_word_newline():
46 | """singleword 46 | / """singleword
| _____^
47 | | 47 | |
48 | | """ 48 | | """
| |_______^ D403 | |_______^ 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` D403.py:51:5: D403 [*] First word of the docstring should be capitalized: `singleword` -> `Singleword`
| |
50 | def single_word_dot_newline(): 50 | def single_word_dot_newline():
51 | """singleword. 51 | / """singleword.
| _____^
52 | | 52 | |
53 | | """ 53 | | """
| |_______^ D403 | |_______^ 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` D403.py:56:5: D403 [*] First word of the docstring should be capitalized: `singleword` -> `Singleword`
| |
55 | def single_word_second_line(): 55 | def single_word_second_line():
56 | """ 56 | / """
| _____^
57 | | singleword 57 | | singleword
58 | | """ 58 | | """
| |_______^ D403 | |_______^ 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` D403.py:61:5: D403 [*] First word of the docstring should be capitalized: `singleword` -> `Singleword`
| |
60 | def single_word_dot_second_line(): 60 | def single_word_dot_second_line():
61 | """ 61 | / """
| _____^
62 | | singleword. 62 | | singleword.
63 | | """ 63 | | """
| |_______^ D403 | |_______^ 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` D403.py:66:5: D403 [*] First word of the docstring should be capitalized: `singleword` -> `Singleword`
| |
65 | def single_word_then_more_text(): 65 | def single_word_then_more_text():
66 | """singleword 66 | / """singleword
| _____^
67 | | 67 | |
68 | | This is more text. 68 | | This is more text.
69 | | """ 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` D403.py:72:5: D403 [*] First word of the docstring should be capitalized: `singleword` -> `Singleword`
| |
71 | def single_word_dot_then_more_text(): 71 | def single_word_dot_then_more_text():
72 | """singleword. 72 | / """singleword.
| _____^
73 | | 73 | |
74 | | This is more text. 74 | | This is more text.
75 | | """ 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` D403.py:78:5: D403 [*] First word of the docstring should be capitalized: `singleword` -> `Singleword`
| |
77 | def single_word_second_line_then_more_text(): 77 | def single_word_second_line_then_more_text():
78 | """ 78 | / """
| _____^
79 | | singleword 79 | | singleword
80 | | 80 | |
81 | | This is more text. 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` 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(): 84 | def single_word_dot_second_line_then_more_text():
85 | """ 85 | / """
| _____^
86 | | singleword. 86 | | singleword.
87 | | 87 | |
88 | | This is more text. 88 | | This is more text.

View File

@ -1,6 +1,5 @@
--- ---
source: crates/ruff_linter/src/rules/pydocstyle/mod.rs 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 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') 613 | @expect('D212: Multi-line docstring summary should start at the first line')
614 | def one_liner(): 614 | def one_liner():
615 | """Wrong." 615 | / """Wrong."
| _____^
616 | | 616 | |
617 | | """ 617 | | """
| |_______^ D415 | |_______^ 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 D.py:664:5: D415 [*] First line should end with a period, question mark, or exclamation point
| |
663 | def newline_after_closing_quote(self): 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" 665 | | but continuations shouldn't be considered multi-line"
| |_________________________________________________________^ D415 | |_________________________________________________________^ D415
| |

View File

@ -1,12 +1,10 @@
--- ---
source: crates/ruff_linter/src/rules/pydocstyle/mod.rs 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 D209_D400.py:2:5: D209 [*] Multi-line docstring closing quotes should be on a separate line
| |
1 | def lorem(): 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""" 3 | | sed do eiusmod tempor incididunt ut labore et dolore magna aliqua"""
| |________________________________________________________________________^ D209 | |________________________________________________________________________^ 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 D209_D400.py:2:5: D400 [*] First line should end with a period
| |
1 | def lorem(): 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""" 3 | | sed do eiusmod tempor incididunt ut labore et dolore magna aliqua"""
| |________________________________________________________________________^ D400 | |________________________________________________________________________^ D400
| |

View File

@ -1,6 +1,5 @@
--- ---
source: crates/ruff_linter/src/rules/pylint/mod.rs 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 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 await_outside_async.py:38:5: PLE1142 `await` should be used within an async function
| |
37 | def async_for_loop(): 37 | def async_for_loop():
38 | async for x in foo(): 38 | / async for x in foo():
| _____^
39 | | pass 39 | | pass
| |____________^ PLE1142 | |____________^ 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 await_outside_async.py:43:5: PLE1142 `await` should be used within an async function
| |
42 | def async_with(): 42 | def async_with():
43 | async with foo(): 43 | / async with foo():
| _____^
44 | | pass 44 | | pass
| |____________^ PLE1142 | |____________^ PLE1142
| |

View File

@ -1,6 +1,5 @@
--- ---
source: crates/ruff_linter/src/rules/pylint/mod.rs 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 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 28 | # PLE1310
29 | "Hello World".strip( 29 | "Hello World".strip(
30 | """ 30 | / """
| _____^
31 | | there are a lot of characters to strip 31 | | there are a lot of characters to strip
32 | | """ 32 | | """
| |___^ PLE1310 | |___^ PLE1310
@ -111,8 +109,7 @@ bad_str_strip_call.py:42:5: PLE1310 String `strip` call contains duplicate chara
| |
40 | # PLE1310 40 | # PLE1310
41 | "Hello World".strip( 41 | "Hello World".strip(
42 | "can we get a long " 42 | / "can we get a long "
| _____^
43 | | "string of characters to strip " 43 | | "string of characters to strip "
44 | | "please?" 44 | | "please?"
| |_____________^ PLE1310 | |_____________^ PLE1310
@ -123,8 +120,7 @@ bad_str_strip_call.py:49:5: PLE1310 String `strip` call contains duplicate chara
| |
47 | # PLE1310 47 | # PLE1310
48 | "Hello World".strip( 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" 50 | | "string \t of characters to strip"
51 | | "please?" 51 | | "please?"
| |_____________^ PLE1310 | |_____________^ PLE1310

View File

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

View File

@ -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 boolean_chained_comparison.py:141:5: PLR1716 [*] Contains chained boolean comparison that can be simplified
| |
140 | ( 140 | (
141 | a 141 | / a
| _____^
142 | | <b 142 | | <b
143 | | # hmmm... 143 | | # hmmm...
144 | | <c 144 | | <c

View File

@ -1,6 +1,5 @@
--- ---
source: crates/ruff_linter/src/rules/pylint/mod.rs 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)` 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)` if_stmt_min_max.py:143:9: PLR1730 [*] Replace `if` statement with `self._min = min(value, self._min)`
| |
142 | def foo(self, value) -> None: 142 | def foo(self, value) -> None:
143 | if value < self._min: 143 | / if value < self._min:
| _________^
144 | | self._min = value 144 | | self._min = value
| |_____________________________^ PLR1730 | |_____________________________^ PLR1730
145 | if value > self._max: 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: 143 | if value < self._min:
144 | self._min = value 144 | self._min = value
145 | if value > self._max: 145 | / if value > self._max:
| _________^
146 | | self._max = value 146 | | self._max = value
| |_____________________________^ PLR1730 | |_____________________________^ PLR1730
147 | 147 |
@ -352,8 +349,7 @@ if_stmt_min_max.py:148:9: PLR1730 [*] Replace `if` statement with `self._min = m
| |
146 | self._max = value 146 | self._max = value
147 | 147 |
148 | if self._min < value: 148 | / if self._min < value:
| _________^
149 | | self._min = value 149 | | self._min = value
| |_____________________________^ PLR1730 | |_____________________________^ PLR1730
150 | if self._max > value: 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: 148 | if self._min < value:
149 | self._min = value 149 | self._min = value
150 | if self._max > value: 150 | / if self._max > value:
| _________^
151 | | self._max = value 151 | | self._max = value
| |_____________________________^ PLR1730 | |_____________________________^ PLR1730
152 | 152 |
@ -400,8 +395,7 @@ if_stmt_min_max.py:153:9: PLR1730 [*] Replace `if` statement with `self._min = m
| |
151 | self._max = value 151 | self._max = value
152 | 152 |
153 | if value <= self._min: 153 | / if value <= self._min:
| _________^
154 | | self._min = value 154 | | self._min = value
| |_____________________________^ PLR1730 | |_____________________________^ PLR1730
155 | if value >= self._max: 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: 153 | if value <= self._min:
154 | self._min = value 154 | self._min = value
155 | if value >= self._max: 155 | / if value >= self._max:
| _________^
156 | | self._max = value 156 | | self._max = value
| |_____________________________^ PLR1730 | |_____________________________^ PLR1730
157 | 157 |
@ -448,8 +441,7 @@ if_stmt_min_max.py:158:9: PLR1730 [*] Replace `if` statement with `self._min = m
| |
156 | self._max = value 156 | self._max = value
157 | 157 |
158 | if self._min <= value: 158 | / if self._min <= value:
| _________^
159 | | self._min = value 159 | | self._min = value
| |_____________________________^ PLR1730 | |_____________________________^ PLR1730
160 | if self._max >= value: 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: 158 | if self._min <= value:
159 | self._min = value 159 | self._min = value
160 | if self._max >= value: 160 | / if self._max >= value:
| _________^
161 | | self._max = value 161 | | self._max = value
| |_____________________________^ PLR1730 | |_____________________________^ PLR1730
| |

View File

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

View File

@ -44,8 +44,7 @@ unreachable.py:21:9: PLW0101 Unreachable code in `if_elif_always_false`
| |
19 | def if_elif_always_false(): 19 | def if_elif_always_false():
20 | if False: 20 | if False:
21 | return "unreachable" 21 | / return "unreachable"
| _________^
22 | | elif False: 22 | | elif False:
23 | | return "also unreachable" 23 | | return "also unreachable"
| |_________________________________^ PLW0101 | |_________________________________^ PLW0101
@ -185,8 +184,7 @@ unreachable.py:122:9: PLW0101 Unreachable code in `while_true_else_return`
| |
120 | return "reachable" 120 | return "reachable"
121 | else: 121 | else:
122 | return "unreachable" 122 | / return "unreachable"
| _________^
123 | | return "also unreachable" 123 | | return "also unreachable"
| |_____________________________^ PLW0101 | |_____________________________^ PLW0101
124 | 124 |
@ -245,8 +243,7 @@ unreachable.py:248:5: PLW0101 Unreachable code in `after_return`
| |
246 | def after_return(): 246 | def after_return():
247 | return "reachable" 247 | return "reachable"
248 | print("unreachable") 248 | / print("unreachable")
| _____^
249 | | print("unreachable") 249 | | print("unreachable")
250 | | print("unreachable") 250 | | print("unreachable")
251 | | 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] 255 | def check_if_url_exists(url: str) -> bool: # type: ignore[return]
256 | return True # uncomment to check URLs 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: 258 | | if response.status_code == 200:
259 | | return True 259 | | return True
260 | | if response.status_code == 404: 260 | | if response.status_code == 404:

View File

@ -1,6 +1,5 @@
--- ---
source: crates/ruff_linter/src/rules/pyupgrade/mod.rs source: crates/ruff_linter/src/rules/pyupgrade/mod.rs
snapshot_kind: text
--- ---
UP012.py:2:1: UP012 [*] Unnecessary call to `encode` as UTF-8 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 | ) 14 | )
15 | ( 15 | (
16 | "Lorem " 16 | / "Lorem "
| _____^
17 | | "Ipsum".encode() 17 | | "Ipsum".encode()
| |____________________^ UP012 | |____________________^ UP012
18 | ) 18 | )
@ -187,8 +185,7 @@ UP012.py:20:5: UP012 [*] Unnecessary call to `encode` as UTF-8
| |
18 | ) 18 | )
19 | ( 19 | (
20 | "Lorem " # Comment 20 | / "Lorem " # Comment
| _____^
21 | | "Ipsum".encode() # Comment 21 | | "Ipsum".encode() # Comment
| |____________________^ UP012 | |____________________^ UP012
22 | ) 22 | )

View File

@ -1,6 +1,5 @@
--- ---
source: crates/ruff_linter/src/rules/pyupgrade/mod.rs source: crates/ruff_linter/src/rules/pyupgrade/mod.rs
snapshot_kind: text
--- ---
UP026.py:3:12: UP026 [*] `mock` is deprecated, use `unittest.mock` 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: 56 | if True:
57 | if False: 57 | if False:
58 | from mock import ( 58 | / from mock import (
| _________^
59 | | mock, 59 | | mock,
60 | | a, 60 | | a,
61 | | b, 61 | | b,

View File

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

View File

@ -1,6 +1,5 @@
--- ---
source: crates/ruff_linter/src/rules/pyupgrade/mod.rs 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 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 UP030_0.py:25:5: UP030 [*] Use implicit references for positional format fields
| |
24 | print( 24 | print(
25 | 'foo{0}' 25 | / 'foo{0}'
| _____^
26 | | 'bar{1}'.format(1, 2) 26 | | 'bar{1}'.format(1, 2)
| |_________________________^ UP030 | |_________________________^ UP030
27 | ) 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 UP030_0.py:30:5: UP030 [*] Use implicit references for positional format fields
| |
29 | print( 29 | print(
30 | 'foo{0}' # ohai\n" 30 | / 'foo{0}' # ohai\n"
| _____^
31 | | 'bar{1}'.format(1, 2) 31 | | 'bar{1}'.format(1, 2)
| |_________________________^ UP030 | |_________________________^ UP030
32 | ) 32 | )

View File

@ -1,6 +1,5 @@
--- ---
source: crates/ruff_linter/src/rules/pyupgrade/mod.rs 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 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 UP032_0.py:94:5: UP032 [*] Use f-string instead of `format` call
| |
93 | ( 93 | (
94 | ( 94 | / (
| _____^
95 | | # comment 95 | | # comment
96 | | "{a}" 96 | | "{a}"
97 | | # comment 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 UP032_0.py:220:5: UP032 [*] Use f-string instead of `format` call
| |
219 | raise ValueError( 219 | raise ValueError(
220 | "Conflicting configuration dicts: {!r} {!r}" 220 | / "Conflicting configuration dicts: {!r} {!r}"
| _____^
221 | | "".format(new_dict, d) 221 | | "".format(new_dict, d)
| |__________________________^ UP032 | |__________________________^ UP032
222 | ) 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 UP032_0.py:225:5: UP032 [*] Use f-string instead of `format` call
| |
224 | raise ValueError( 224 | raise ValueError(
225 | "Conflicting configuration dicts: {!r} {!r}" 225 | / "Conflicting configuration dicts: {!r} {!r}"
| _____^
226 | | "".format(new_dict, d) 226 | | "".format(new_dict, d)
| |__________________________^ UP032 | |__________________________^ UP032
227 | 227 |

View File

@ -1,6 +1,5 @@
--- ---
source: crates/ruff_linter/src/rules/pyupgrade/mod.rs source: crates/ruff_linter/src/rules/pyupgrade/mod.rs
snapshot_kind: text
--- ---
UP035.py:2:1: UP035 [*] Import from `collections.abc` instead: `Mapping` 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` UP035.py:37:5: UP035 [*] Import from `collections.abc` instead: `Mapping`, `Callable`
| |
36 | if True: 36 | if True:
37 | from collections import ( 37 | / from collections import (
| _____^
38 | | Mapping, 38 | | Mapping,
39 | | Callable, 39 | | Callable,
40 | | Bad, 40 | | Bad,

View File

@ -1,6 +1,5 @@
--- ---
source: crates/ruff_linter/src/rules/refurb/mod.rs source: crates/ruff_linter/src/rules/refurb/mod.rs
snapshot_kind: text
--- ---
FURB110.py:1:5: FURB110 [*] Replace ternary `if` expression with `or` operator 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 21 | # FURB110
22 | z = ( 22 | z = (
23 | x if ( 23 | / x if (
| _____^
24 | | # Test for x. 24 | | # Test for x.
25 | | x 25 | | x
26 | | ) else ( 26 | | ) else (
@ -154,8 +152,7 @@ FURB110.py:34:5: FURB110 [*] Replace ternary `if` expression with `or` operator
| |
32 | # FURB110 32 | # FURB110
33 | z = ( 33 | z = (
34 | x if 34 | / x if
| _____^
35 | | # If true, use x. 35 | | # If true, use x.
36 | | x 36 | | x
37 | | # Otherwise, use y. 37 | | # Otherwise, use y.
@ -185,8 +182,7 @@ FURB110.py:44:5: FURB110 [*] Replace ternary `if` expression with `or` operator
| |
42 | # FURB110 42 | # FURB110
43 | z = ( 43 | z = (
44 | x 44 | / x
| _____^
45 | | if x 45 | | if x
46 | | else y 46 | | else y
47 | | if y > 0 47 | | if y > 0

View File

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

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