mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-03 18:28:24 +00:00
test: update snapshots with trimmed lines
This updates snapshots where long lines now get trimmed with `annotate-snippets`. And an ellipsis is inserted to indicate trimming. This is a little hokey to test since in tests we don't do any styling. And I believe this just uses the default "max term width" for rendering. But in real life, it seems like a big improvement to have long lines trimmed if they would otherwise wrap in the terminal. So this seems like an improvement to me. There are some other fixes here that overlap with previous categories.
This commit is contained in:
parent
84ba4ecaf5
commit
670fcecd1b
15 changed files with 343 additions and 359 deletions
|
@ -1,11 +1,10 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs
|
||||
snapshot_kind: text
|
||||
---
|
||||
PYI003.pyi:4:4: PYI003 Unrecognized `sys.version_info` check
|
||||
|
|
||||
3 | if sys.version_info[0] == 2: ...
|
||||
4 | if sys.version_info[0] == True: ... # Y003 Unrecognized sys.version_info check # E712 comparison to True should be 'if cond is True:' or 'if cond:'
|
||||
4 | if sys.version_info[0] == True: ... # Y003 Unrecognized sys.version_info check # E712 comparison to True should be 'if cond is True:'…
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI003
|
||||
5 | if sys.version_info[0.0] == 2: ... # Y003 Unrecognized sys.version_info check
|
||||
6 | if sys.version_info[False] == 2: ... # Y003 Unrecognized sys.version_info check
|
||||
|
@ -14,7 +13,7 @@ PYI003.pyi:4:4: PYI003 Unrecognized `sys.version_info` check
|
|||
PYI003.pyi:5:4: PYI003 Unrecognized `sys.version_info` check
|
||||
|
|
||||
3 | if sys.version_info[0] == 2: ...
|
||||
4 | if sys.version_info[0] == True: ... # Y003 Unrecognized sys.version_info check # E712 comparison to True should be 'if cond is True:' or 'if cond:'
|
||||
4 | if sys.version_info[0] == True: ... # Y003 Unrecognized sys.version_info check # E712 comparison to True should be 'if cond is True:'…
|
||||
5 | if sys.version_info[0.0] == 2: ... # Y003 Unrecognized sys.version_info check
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI003
|
||||
6 | if sys.version_info[False] == 2: ... # Y003 Unrecognized sys.version_info check
|
||||
|
@ -23,7 +22,7 @@ PYI003.pyi:5:4: PYI003 Unrecognized `sys.version_info` check
|
|||
|
||||
PYI003.pyi:6:4: PYI003 Unrecognized `sys.version_info` check
|
||||
|
|
||||
4 | if sys.version_info[0] == True: ... # Y003 Unrecognized sys.version_info check # E712 comparison to True should be 'if cond is True:' or 'if cond:'
|
||||
4 | if sys.version_info[0] == True: ... # Y003 Unrecognized sys.version_info check # E712 comparison to True should be 'if cond is True:'…
|
||||
5 | if sys.version_info[0.0] == 2: ... # Y003 Unrecognized sys.version_info check
|
||||
6 | if sys.version_info[False] == 2: ... # Y003 Unrecognized sys.version_info check
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI003
|
||||
|
|
|
@ -1,44 +1,43 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs
|
||||
snapshot_kind: text
|
||||
---
|
||||
PYI033.pyi:6:22: PYI033 Don't use type comments in stub file
|
||||
|
|
||||
4 | from typing import TypeAlias
|
||||
5 |
|
||||
6 | A: TypeAlias = None # type: int # Y033 Do not use type comments in stubs (e.g. use "x: int" instead of "x = ... # type: int")
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI033
|
||||
7 | B: TypeAlias = None # type: str # And here's an extra comment about why it's that type # Y033 Do not use type comments in stubs (e.g. use "x: int" instead of "x = ... # type: int")
|
||||
8 | C: TypeAlias = None #type: int # Y033 Do not use type comments in stubs (e.g. use "x: int" instead of "x = ... # type: int")
|
||||
4 | … import TypeAlias
|
||||
5 | …
|
||||
6 | …s = None # type: int # Y033 Do not use type comments in stubs (e.g. use "x: int" instead of "x = ... # type: int")
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI033
|
||||
7 | …s = None # type: str # And here's an extra comment about why it's that type # Y033 Do not use type comments in stubs (e.g. use "x: …
|
||||
8 | …s = None #type: int # Y033 Do not use type comments in stubs (e.g. use "x: int" instead of "x = ... # type: int")
|
||||
|
|
||||
|
||||
PYI033.pyi:7:22: PYI033 Don't use type comments in stub file
|
||||
|
|
||||
6 | A: TypeAlias = None # type: int # Y033 Do not use type comments in stubs (e.g. use "x: int" instead of "x = ... # type: int")
|
||||
7 | B: TypeAlias = None # type: str # And here's an extra comment about why it's that type # Y033 Do not use type comments in stubs (e.g. use "x: int" instead of "x = ... # type: int")
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI033
|
||||
8 | C: TypeAlias = None #type: int # Y033 Do not use type comments in stubs (e.g. use "x: int" instead of "x = ... # type: int")
|
||||
9 | D: TypeAlias = None # type: int # Y033 Do not use type comments in stubs (e.g. use "x: int" instead of "x = ... # type: int")
|
||||
6 | …one # type: int # Y033 Do not use type comments in stubs (e.g. use "x: int" instead of "x = ... # type: int")
|
||||
7 | …one # type: str # And here's an extra comment about why it's that type # Y033 Do not use type comments in stubs (e.g. use "x: int" instead of "x = ... # type: int")
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI033
|
||||
8 | …one #type: int # Y033 Do not use type comments in stubs (e.g. use "x: int" instead of "x = ... # type: int")
|
||||
9 | …one # type: int # Y033 Do not use type comments in stubs (e.g. use "x: int" instead of "x = ... # type: int")
|
||||
|
|
||||
|
||||
PYI033.pyi:8:22: PYI033 Don't use type comments in stub file
|
||||
|
|
||||
6 | A: TypeAlias = None # type: int # Y033 Do not use type comments in stubs (e.g. use "x: int" instead of "x = ... # type: int")
|
||||
7 | B: TypeAlias = None # type: str # And here's an extra comment about why it's that type # Y033 Do not use type comments in stubs (e.g. use "x: int" instead of "x = ... # type: int")
|
||||
8 | C: TypeAlias = None #type: int # Y033 Do not use type comments in stubs (e.g. use "x: int" instead of "x = ... # type: int")
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI033
|
||||
9 | D: TypeAlias = None # type: int # Y033 Do not use type comments in stubs (e.g. use "x: int" instead of "x = ... # type: int")
|
||||
10 | E: TypeAlias = None# type: int # Y033 Do not use type comments in stubs (e.g. use "x: int" instead of "x = ... # type: int")
|
||||
6 | …s = None # type: int # Y033 Do not use type comments in stubs (e.g. use "x: int" instead of "x = ... # type: int")
|
||||
7 | …s = None # type: str # And here's an extra comment about why it's that type # Y033 Do not use type comments in stubs (e.g. use "x:…
|
||||
8 | …s = None #type: int # Y033 Do not use type comments in stubs (e.g. use "x: int" instead of "x = ... # type: int")
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI033
|
||||
9 | …s = None # type: int # Y033 Do not use type comments in stubs (e.g. use "x: int" instead of "x = ... # type: int")
|
||||
10 | …s = None# type: int # Y033 Do not use type comments in stubs (e.g. use "x: int" instead of "x = ... # type: int")
|
||||
|
|
||||
|
||||
PYI033.pyi:9:22: PYI033 Don't use type comments in stub file
|
||||
|
|
||||
7 | B: TypeAlias = None # type: str # And here's an extra comment about why it's that type # Y033 Do not use type comments in stubs (e.g. use "x: int" instead of "x = ... # type: int")
|
||||
8 | C: TypeAlias = None #type: int # Y033 Do not use type comments in stubs (e.g. use "x: int" instead of "x = ... # type: int")
|
||||
9 | D: TypeAlias = None # type: int # Y033 Do not use type comments in stubs (e.g. use "x: int" instead of "x = ... # type: int")
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI033
|
||||
10 | E: TypeAlias = None# type: int # Y033 Do not use type comments in stubs (e.g. use "x: int" instead of "x = ... # type: int")
|
||||
11 | F: TypeAlias = None#type:int # Y033 Do not use type comments in stubs (e.g. use "x: int" instead of "x = ... # type: int")
|
||||
7 | … None # type: str # And here's an extra comment about why it's that type # Y033 Do not use type comments in stubs (e.g. use "x: in…
|
||||
8 | … None #type: int # Y033 Do not use type comments in stubs (e.g. use "x: int" instead of "x = ... # type: int")
|
||||
9 | … None # type: int # Y033 Do not use type comments in stubs (e.g. use "x: int" instead of "x = ... # type: int")
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI033
|
||||
10 | … None# type: int # Y033 Do not use type comments in stubs (e.g. use "x: int" instead of "x = ... # type: int")
|
||||
11 | … None#type:int # Y033 Do not use type comments in stubs (e.g. use "x: int" instead of "x = ... # type: int")
|
||||
|
|
||||
|
||||
PYI033.pyi:10:20: PYI033 Don't use type comments in stub file
|
||||
|
@ -56,35 +55,35 @@ PYI033.pyi:11:20: PYI033 Don't use type comments in stub file
|
|||
10 | E: TypeAlias = None# type: int # Y033 Do not use type comments in stubs (e.g. use "x: int" instead of "x = ... # type: int")
|
||||
11 | F: TypeAlias = None#type:int # Y033 Do not use type comments in stubs (e.g. use "x: int" instead of "x = ... # type: int")
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI033
|
||||
12 |
|
||||
12 |
|
||||
13 | def func(
|
||||
|
|
||||
|
||||
PYI033.pyi:14:12: PYI033 Don't use type comments in stub file
|
||||
|
|
||||
13 | def func(
|
||||
14 | arg1, # type: dict[str, int] # Y033 Do not use type comments in stubs (e.g. use "x: int" instead of "x = ... # type: int")
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI033
|
||||
15 | arg2 # type: Sequence[bytes] # And here's some more info about this arg # Y033 Do not use type comments in stubs (e.g. use "x: int" instead of "x = ... # type: int")
|
||||
16 | ): ...
|
||||
13 | …func(
|
||||
14 | …arg1, # type: dict[str, int] # Y033 Do not use type comments in stubs (e.g. use "x: int" instead of "x = ... # type: int")
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI033
|
||||
15 | …arg2 # type: Sequence[bytes] # And here's some more info about this arg # Y033 Do not use type comments in stubs (e.g. use "x: int…
|
||||
16 | …..
|
||||
|
|
||||
|
||||
PYI033.pyi:15:11: PYI033 Don't use type comments in stub file
|
||||
|
|
||||
13 | def func(
|
||||
14 | arg1, # type: dict[str, int] # Y033 Do not use type comments in stubs (e.g. use "x: int" instead of "x = ... # type: int")
|
||||
15 | arg2 # type: Sequence[bytes] # And here's some more info about this arg # Y033 Do not use type comments in stubs (e.g. use "x: int" instead of "x = ... # type: int")
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI033
|
||||
16 | ): ...
|
||||
13 | …unc(
|
||||
14 | …rg1, # type: dict[str, int] # Y033 Do not use type comments in stubs (e.g. use "x: int" instead of "x = ... # type: int")
|
||||
15 | …rg2 # type: Sequence[bytes] # And here's some more info about this arg # Y033 Do not use type comments in stubs (e.g. use "x: int" instead of "x = ... # type: int")
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI033
|
||||
16 | ….
|
||||
|
|
||||
|
||||
PYI033.pyi:19:29: PYI033 Don't use type comments in stub file
|
||||
|
|
||||
18 | class Foo:
|
||||
19 | Attr: TypeAlias = None # type: set[str] # Y033 Do not use type comments in stubs (e.g. use "x: int" instead of "x = ... # type: int")
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI033
|
||||
20 |
|
||||
21 | G: TypeAlias = None # type: ignore
|
||||
18 | …
|
||||
19 | … None # type: set[str] # Y033 Do not use type comments in stubs (e.g. use "x: int" instead of "x = ... # type: int")
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI033
|
||||
20 | …
|
||||
21 | …# type: ignore
|
||||
|
|
||||
|
||||
PYI033.pyi:29:22: PYI033 Don't use type comments in stub file
|
||||
|
@ -92,7 +91,7 @@ PYI033.pyi:29:22: PYI033 Don't use type comments in stub file
|
|||
28 | # Whole line commented out # type: int
|
||||
29 | M: TypeAlias = None # type: can't parse me!
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ PYI033
|
||||
30 |
|
||||
30 |
|
||||
31 | class Bar:
|
||||
|
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ PYI034.py:21:9: PYI034 [*] `__new__` methods in classes like `Bad` usually retur
|
|||
20 | ): # Y040 Do not inherit from "object" explicitly, as it is redundant in Python 3
|
||||
21 | def __new__(cls, *args: Any, **kwargs: Any) -> Bad:
|
||||
| ^^^^^^^ PYI034
|
||||
22 | ... # Y034 "__new__" methods usually return "self" at runtime. Consider using "typing_extensions.Self" in "Bad.__new__", e.g. "def __new__(cls, *args: Any, **kwargs: Any) -> Self: ..."
|
||||
22 | ... # Y034 "__new__" methods usually return "self" at runtime. Consider using "typing_extensions.Self" in "Bad.__new__", e.g.…
|
||||
|
|
||||
= help: Use `Self` as return type
|
||||
|
||||
|
@ -24,10 +24,10 @@ PYI034.py:21:9: PYI034 [*] `__new__` methods in classes like `Bad` usually retur
|
|||
PYI034.py:36:9: PYI034 [*] `__enter__` methods in classes like `Bad` usually return `self` at runtime
|
||||
|
|
||||
34 | ... # Y032 Prefer "object" to "Any" for the second parameter in "__ne__" methods
|
||||
35 |
|
||||
35 |
|
||||
36 | def __enter__(self) -> Bad:
|
||||
| ^^^^^^^^^ PYI034
|
||||
37 | ... # Y034 "__enter__" methods in classes like "Bad" usually return "self" at runtime. Consider using "typing_extensions.Self" in "Bad.__enter__", e.g. "def __enter__(self) -> Self: ..."
|
||||
37 | ... # Y034 "__enter__" methods in classes like "Bad" usually return "self" at runtime. Consider using "typing_extensions.Self…
|
||||
|
|
||||
= help: Use `Self` as return type
|
||||
|
||||
|
@ -43,11 +43,11 @@ PYI034.py:36:9: PYI034 [*] `__enter__` methods in classes like `Bad` usually ret
|
|||
|
||||
PYI034.py:39:15: PYI034 [*] `__aenter__` methods in classes like `Bad` usually return `self` at runtime
|
||||
|
|
||||
37 | ... # Y034 "__enter__" methods in classes like "Bad" usually return "self" at runtime. Consider using "typing_extensions.Self" in "Bad.__enter__", e.g. "def __enter__(self) -> Self: ..."
|
||||
38 |
|
||||
37 | ... # Y034 "__enter__" methods in classes like "Bad" usually return "self" at runtime. Consider using "typing_extensions.Self…
|
||||
38 |
|
||||
39 | async def __aenter__(self) -> Bad:
|
||||
| ^^^^^^^^^^ PYI034
|
||||
40 | ... # Y034 "__aenter__" methods in classes like "Bad" usually return "self" at runtime. Consider using "typing_extensions.Self" in "Bad.__aenter__", e.g. "async def __aenter__(self) -> Self: ..."
|
||||
40 | ... # Y034 "__aenter__" methods in classes like "Bad" usually return "self" at runtime. Consider using "typing_extensions.Sel…
|
||||
|
|
||||
= help: Use `Self` as return type
|
||||
|
||||
|
@ -63,11 +63,11 @@ PYI034.py:39:15: PYI034 [*] `__aenter__` methods in classes like `Bad` usually r
|
|||
|
||||
PYI034.py:42:9: PYI034 [*] `__iadd__` methods in classes like `Bad` usually return `self` at runtime
|
||||
|
|
||||
40 | ... # Y034 "__aenter__" methods in classes like "Bad" usually return "self" at runtime. Consider using "typing_extensions.Self" in "Bad.__aenter__", e.g. "async def __aenter__(self) -> Self: ..."
|
||||
41 |
|
||||
40 | ... # Y034 "__aenter__" methods in classes like "Bad" usually return "self" at runtime. Consider using "typing_extensions.Sel…
|
||||
41 |
|
||||
42 | def __iadd__(self, other: Bad) -> Bad:
|
||||
| ^^^^^^^^ PYI034
|
||||
43 | ... # Y034 "__iadd__" methods in classes like "Bad" usually return "self" at runtime. Consider using "typing_extensions.Self" in "Bad.__iadd__", e.g. "def __iadd__(self, other: Bad) -> Self: ..."
|
||||
43 | ... # Y034 "__iadd__" methods in classes like "Bad" usually return "self" at runtime. Consider using "typing_extensions.Self"…
|
||||
|
|
||||
= help: Use `Self` as return type
|
||||
|
||||
|
@ -86,7 +86,7 @@ PYI034.py:165:9: PYI034 [*] `__iter__` methods in classes like `BadIterator1` us
|
|||
164 | class BadIterator1(Iterator[int]):
|
||||
165 | def __iter__(self) -> Iterator[int]:
|
||||
| ^^^^^^^^ PYI034
|
||||
166 | ... # Y034 "__iter__" methods in classes like "BadIterator1" usually return "self" at runtime. Consider using "typing_extensions.Self" in "BadIterator1.__iter__", e.g. "def __iter__(self) -> Self: ..."
|
||||
166 | ... # Y034 "__iter__" methods in classes like "BadIterator1" usually return "self" at runtime. Consider using "typing_extens…
|
||||
|
|
||||
= help: Use `Self` as return type
|
||||
|
||||
|
@ -106,7 +106,7 @@ PYI034.py:172:9: PYI034 [*] `__iter__` methods in classes like `BadIterator2` us
|
|||
171 | ): # Y022 Use "collections.abc.Iterator[T]" instead of "typing.Iterator[T]" (PEP 585 syntax)
|
||||
172 | def __iter__(self) -> Iterator[int]:
|
||||
| ^^^^^^^^ PYI034
|
||||
173 | ... # Y034 "__iter__" methods in classes like "BadIterator2" usually return "self" at runtime. Consider using "typing_extensions.Self" in "BadIterator2.__iter__", e.g. "def __iter__(self) -> Self: ..."
|
||||
173 | ... # Y034 "__iter__" methods in classes like "BadIterator2" usually return "self" at runtime. Consider using "typing_extens…
|
||||
|
|
||||
= help: Use `Self` as return type
|
||||
|
||||
|
@ -126,7 +126,7 @@ PYI034.py:179:9: PYI034 [*] `__iter__` methods in classes like `BadIterator3` us
|
|||
178 | ): # Y022 Use "collections.abc.Iterator[T]" instead of "typing.Iterator[T]" (PEP 585 syntax)
|
||||
179 | def __iter__(self) -> collections.abc.Iterator[int]:
|
||||
| ^^^^^^^^ PYI034
|
||||
180 | ... # Y034 "__iter__" methods in classes like "BadIterator3" usually return "self" at runtime. Consider using "typing_extensions.Self" in "BadIterator3.__iter__", e.g. "def __iter__(self) -> Self: ..."
|
||||
180 | ... # Y034 "__iter__" methods in classes like "BadIterator3" usually return "self" at runtime. Consider using "typing_extens…
|
||||
|
|
||||
= help: Use `Self` as return type
|
||||
|
||||
|
@ -146,7 +146,7 @@ PYI034.py:185:9: PYI034 [*] `__iter__` methods in classes like `BadIterator4` us
|
|||
184 | # Note: *Iterable*, not *Iterator*, returned!
|
||||
185 | def __iter__(self) -> Iterable[int]:
|
||||
| ^^^^^^^^ PYI034
|
||||
186 | ... # Y034 "__iter__" methods in classes like "BadIterator4" usually return "self" at runtime. Consider using "typing_extensions.Self" in "BadIterator4.__iter__", e.g. "def __iter__(self) -> Self: ..."
|
||||
186 | ... # Y034 "__iter__" methods in classes like "BadIterator4" usually return "self" at runtime. Consider using "typing_extens…
|
||||
|
|
||||
= help: Use `Self` as return type
|
||||
|
||||
|
@ -165,7 +165,7 @@ PYI034.py:195:9: PYI034 [*] `__aiter__` methods in classes like `BadAsyncIterato
|
|||
194 | class BadAsyncIterator(collections.abc.AsyncIterator[str]):
|
||||
195 | def __aiter__(self) -> typing.AsyncIterator[str]:
|
||||
| ^^^^^^^^^ PYI034
|
||||
196 | ... # Y034 "__aiter__" methods in classes like "BadAsyncIterator" usually return "self" at runtime. Consider using "typing_extensions.Self" in "BadAsyncIterator.__aiter__", e.g. "def __aiter__(self) -> Self: ..." # Y022 Use "collections.abc.AsyncIterator[T]" instead of "typing.AsyncIterator[T]" (PEP 585 syntax)
|
||||
196 | ... # Y034 "__aiter__" methods in classes like "BadAsyncIterator" usually return "self" at runtime. Consider using "typing_e…
|
||||
|
|
||||
= help: Use `Self` as return type
|
||||
|
||||
|
@ -242,7 +242,7 @@ PYI034.py:328:9: PYI034 [*] `__enter__` methods in classes like `NonGeneric1` us
|
|||
327 | def __new__(cls: type[NonGeneric1], *args, **kwargs) -> NonGeneric1: ...
|
||||
328 | def __enter__(self: NonGeneric1) -> NonGeneric1: ...
|
||||
| ^^^^^^^^^ PYI034
|
||||
329 |
|
||||
329 |
|
||||
330 | class NonGeneric2(tuple):
|
||||
|
|
||||
= help: Use `Self` as return type
|
||||
|
@ -262,7 +262,7 @@ PYI034.py:331:9: PYI034 [*] `__new__` methods in classes like `NonGeneric2` usua
|
|||
330 | class NonGeneric2(tuple):
|
||||
331 | def __new__(cls: Type[NonGeneric2]) -> NonGeneric2: ...
|
||||
| ^^^^^^^ PYI034
|
||||
332 |
|
||||
332 |
|
||||
333 | class Generic1[T](list):
|
||||
|
|
||||
= help: Use `Self` as return type
|
||||
|
@ -340,7 +340,7 @@ PYI034.py:346:9: PYI034 `__enter__` methods in classes like `Generic2` usually r
|
|||
345 | def __new__(cls: type[Generic2]) -> Generic2: ...
|
||||
346 | def __enter__(self: Generic2) -> Generic2: ...
|
||||
| ^^^^^^^^^ PYI034
|
||||
347 |
|
||||
347 |
|
||||
348 | class Generic3(tuple[*Ts]):
|
||||
|
|
||||
= help: Use `Self` as return type
|
||||
|
@ -380,7 +380,7 @@ PYI034.py:350:9: PYI034 `__enter__` methods in classes like `Generic3` usually r
|
|||
349 | def __new__(cls: type[Generic3]) -> Generic3: ...
|
||||
350 | def __enter__(self: Generic3) -> Generic3: ...
|
||||
| ^^^^^^^^^ PYI034
|
||||
351 |
|
||||
351 |
|
||||
352 | class Generic4(collections.abc.Callable[P, ...]):
|
||||
|
|
||||
= help: Use `Self` as return type
|
||||
|
@ -420,7 +420,7 @@ PYI034.py:354:9: PYI034 `__enter__` methods in classes like `Generic4` usually r
|
|||
353 | def __new__(cls: type[Generic4]) -> Generic4: ...
|
||||
354 | def __enter__(self: Generic4) -> Generic4: ...
|
||||
| ^^^^^^^^^ PYI034
|
||||
355 |
|
||||
355 |
|
||||
356 | from some_module import PotentialTypeVar
|
||||
|
|
||||
= help: Use `Self` as return type
|
||||
|
|
|
@ -8,7 +8,7 @@ PYI034.pyi:20:9: PYI034 [*] `__new__` methods in classes like `Bad` usually retu
|
|||
20 | def __new__(
|
||||
| ^^^^^^^ PYI034
|
||||
21 | cls, *args: Any, **kwargs: Any
|
||||
22 | ) -> Bad: ... # Y034 "__new__" methods usually return "self" at runtime. Consider using "typing_extensions.Self" in "Bad.__new__", e.g. "def __new__(cls, *args: Any, **kwargs: Any) -> Self: ..."
|
||||
22 | ) -> Bad: ... # Y034 "__new__" methods usually return "self" at runtime. Consider using "typing_extensions.Self" in "Bad.__new__"…
|
||||
|
|
||||
= help: Use `Self` as return type
|
||||
|
||||
|
@ -29,7 +29,7 @@ PYI034.pyi:35:9: PYI034 [*] `__enter__` methods in classes like `Bad` usually re
|
|||
35 | def __enter__(
|
||||
| ^^^^^^^^^ PYI034
|
||||
36 | self,
|
||||
37 | ) -> Bad: ... # Y034 "__enter__" methods in classes like "Bad" usually return "self" at runtime. Consider using "typing_extensions.Self" in "Bad.__enter__", e.g. "def __enter__(self) -> Self: ..."
|
||||
37 | ) -> Bad: ... # Y034 "__enter__" methods in classes like "Bad" usually return "self" at runtime. Consider using "typing_extension…
|
||||
|
|
||||
= help: Use `Self` as return type
|
||||
|
||||
|
@ -46,11 +46,11 @@ PYI034.pyi:35:9: PYI034 [*] `__enter__` methods in classes like `Bad` usually re
|
|||
PYI034.pyi:38:15: PYI034 [*] `__aenter__` methods in classes like `Bad` usually return `self` at runtime
|
||||
|
|
||||
36 | self,
|
||||
37 | ) -> Bad: ... # Y034 "__enter__" methods in classes like "Bad" usually return "self" at runtime. Consider using "typing_extensions.Self" in "Bad.__enter__", e.g. "def __enter__(self) -> Self: ..."
|
||||
37 | ) -> Bad: ... # Y034 "__enter__" methods in classes like "Bad" usually return "self" at runtime. Consider using "typing_extension…
|
||||
38 | async def __aenter__(
|
||||
| ^^^^^^^^^^ PYI034
|
||||
39 | self,
|
||||
40 | ) -> Bad: ... # Y034 "__aenter__" methods in classes like "Bad" usually return "self" at runtime. Consider using "typing_extensions.Self" in "Bad.__aenter__", e.g. "async def __aenter__(self) -> Self: ..."
|
||||
40 | ) -> Bad: ... # Y034 "__aenter__" methods in classes like "Bad" usually return "self" at runtime. Consider using "typing_extensio…
|
||||
|
|
||||
= help: Use `Self` as return type
|
||||
|
||||
|
@ -67,11 +67,11 @@ PYI034.pyi:38:15: PYI034 [*] `__aenter__` methods in classes like `Bad` usually
|
|||
PYI034.pyi:41:9: PYI034 [*] `__iadd__` methods in classes like `Bad` usually return `self` at runtime
|
||||
|
|
||||
39 | self,
|
||||
40 | ) -> Bad: ... # Y034 "__aenter__" methods in classes like "Bad" usually return "self" at runtime. Consider using "typing_extensions.Self" in "Bad.__aenter__", e.g. "async def __aenter__(self) -> Self: ..."
|
||||
40 | ) -> Bad: ... # Y034 "__aenter__" methods in classes like "Bad" usually return "self" at runtime. Consider using "typing_extensio…
|
||||
41 | def __iadd__(
|
||||
| ^^^^^^^^ PYI034
|
||||
42 | self, other: Bad
|
||||
43 | ) -> Bad: ... # Y034 "__iadd__" methods in classes like "Bad" usually return "self" at runtime. Consider using "typing_extensions.Self" in "Bad.__iadd__", e.g. "def __iadd__(self, other: Bad) -> Self: ..."
|
||||
43 | ) -> Bad: ... # Y034 "__iadd__" methods in classes like "Bad" usually return "self" at runtime. Consider using "typing_extensions…
|
||||
|
|
||||
= help: Use `Self` as return type
|
||||
|
||||
|
@ -223,7 +223,7 @@ PYI034.pyi:222:9: PYI034 [*] `__enter__` methods in classes like `NonGeneric1` u
|
|||
221 | def __new__(cls: type[NonGeneric1], *args, **kwargs) -> NonGeneric1: ...
|
||||
222 | def __enter__(self: NonGeneric1) -> NonGeneric1: ...
|
||||
| ^^^^^^^^^ PYI034
|
||||
223 |
|
||||
223 |
|
||||
224 | class NonGeneric2(tuple):
|
||||
|
|
||||
= help: Use `Self` as return type
|
||||
|
@ -243,7 +243,7 @@ PYI034.pyi:225:9: PYI034 [*] `__new__` methods in classes like `NonGeneric2` usu
|
|||
224 | class NonGeneric2(tuple):
|
||||
225 | def __new__(cls: Type[NonGeneric2]) -> NonGeneric2: ...
|
||||
| ^^^^^^^ PYI034
|
||||
226 |
|
||||
226 |
|
||||
227 | class Generic1[T](list):
|
||||
|
|
||||
= help: Use `Self` as return type
|
||||
|
@ -321,7 +321,7 @@ PYI034.pyi:240:9: PYI034 `__enter__` methods in classes like `Generic2` usually
|
|||
239 | def __new__(cls: type[Generic2]) -> Generic2: ...
|
||||
240 | def __enter__(self: Generic2) -> Generic2: ...
|
||||
| ^^^^^^^^^ PYI034
|
||||
241 |
|
||||
241 |
|
||||
242 | class Generic3(tuple[*Ts]):
|
||||
|
|
||||
= help: Use `Self` as return type
|
||||
|
@ -361,7 +361,7 @@ PYI034.pyi:244:9: PYI034 `__enter__` methods in classes like `Generic3` usually
|
|||
243 | def __new__(cls: type[Generic3]) -> Generic3: ...
|
||||
244 | def __enter__(self: Generic3) -> Generic3: ...
|
||||
| ^^^^^^^^^ PYI034
|
||||
245 |
|
||||
245 |
|
||||
246 | class Generic4(collections.abc.Callable[P, ...]):
|
||||
|
|
||||
= help: Use `Self` as return type
|
||||
|
@ -401,7 +401,7 @@ PYI034.pyi:248:9: PYI034 `__enter__` methods in classes like `Generic4` usually
|
|||
247 | def __new__(cls: type[Generic4]) -> Generic4: ...
|
||||
248 | def __enter__(self: Generic4) -> Generic4: ...
|
||||
| ^^^^^^^^^ PYI034
|
||||
249 |
|
||||
249 |
|
||||
250 | from some_module import PotentialTypeVar
|
||||
|
|
||||
= help: Use `Self` as return type
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs
|
||||
snapshot_kind: text
|
||||
---
|
||||
PYI036.py:54:31: PYI036 [*] Star-args in `__exit__` should be annotated with `object`
|
||||
|
|
||||
|
@ -27,7 +26,7 @@ PYI036.py:55:24: PYI036 If there are no star-args, `__aexit__` should have at le
|
|||
54 | def __exit__(self, *args: Any) -> None: ... # PYI036: Bad star-args annotation
|
||||
55 | async def __aexit__(self) -> None: ... # PYI036: Missing args
|
||||
| ^^^^^^ PYI036
|
||||
56 |
|
||||
56 |
|
||||
57 | class BadTwo:
|
||||
|
|
||||
|
||||
|
@ -45,54 +44,54 @@ PYI036.py:59:48: PYI036 All keyword-only arguments in `__aexit__` must have a de
|
|||
58 | def __exit__(self, typ, exc, tb, weird_extra_arg) -> None: ... # PYI036: Extra arg must have default
|
||||
59 | async def __aexit__(self, typ, exc, tb, *, weird_extra_arg) -> None: ...# PYI036: Extra arg must have default
|
||||
| ^^^^^^^^^^^^^^^ PYI036
|
||||
60 |
|
||||
60 |
|
||||
61 | class BadThree:
|
||||
|
|
||||
|
||||
PYI036.py:62:29: PYI036 The first argument in `__exit__` should be annotated with `object` or `type[BaseException] | None`
|
||||
|
|
||||
61 | class BadThree:
|
||||
62 | def __exit__(self, typ: type[BaseException], exc: BaseException | None, tb: TracebackType | None) -> None: ... # PYI036: First arg has bad annotation
|
||||
62 | def __exit__(self, typ: type[BaseException], exc: BaseException | None, tb: TracebackType | None) -> None: ... # PYI036: First arg…
|
||||
| ^^^^^^^^^^^^^^^^^^^ PYI036
|
||||
63 | async def __aexit__(self, __typ: type[BaseException] | None, __exc: BaseException, __tb: TracebackType) -> bool | None: ... # PYI036: Second arg has bad annotation
|
||||
63 | async def __aexit__(self, __typ: type[BaseException] | None, __exc: BaseException, __tb: TracebackType) -> bool | None: ... # PYI0…
|
||||
|
|
||||
|
||||
PYI036.py:63:73: PYI036 The second argument in `__aexit__` should be annotated with `object` or `BaseException | None`
|
||||
|
|
||||
61 | class BadThree:
|
||||
62 | def __exit__(self, typ: type[BaseException], exc: BaseException | None, tb: TracebackType | None) -> None: ... # PYI036: First arg has bad annotation
|
||||
63 | async def __aexit__(self, __typ: type[BaseException] | None, __exc: BaseException, __tb: TracebackType) -> bool | None: ... # PYI036: Second arg has bad annotation
|
||||
62 | def __exit__(self, typ: type[BaseException], exc: BaseException | None, tb: TracebackType | None) -> None: ... # PYI036: First arg…
|
||||
63 | async def __aexit__(self, __typ: type[BaseException] | None, __exc: BaseException, __tb: TracebackType) -> bool | None: ... # PYI0…
|
||||
| ^^^^^^^^^^^^^ PYI036
|
||||
64 |
|
||||
64 |
|
||||
65 | class BadFour:
|
||||
|
|
||||
|
||||
PYI036.py:63:94: PYI036 The third argument in `__aexit__` should be annotated with `object` or `types.TracebackType | None`
|
||||
|
|
||||
61 | class BadThree:
|
||||
62 | def __exit__(self, typ: type[BaseException], exc: BaseException | None, tb: TracebackType | None) -> None: ... # PYI036: First arg has bad annotation
|
||||
63 | async def __aexit__(self, __typ: type[BaseException] | None, __exc: BaseException, __tb: TracebackType) -> bool | None: ... # PYI036: Second arg has bad annotation
|
||||
62 | def __exit__(self, typ: type[BaseException], exc: BaseException | None, tb: TracebackType | None) -> None: ... # PYI036: First arg…
|
||||
63 | async def __aexit__(self, __typ: type[BaseException] | None, __exc: BaseException, __tb: TracebackType) -> bool | None: ... # PYI0…
|
||||
| ^^^^^^^^^^^^^ PYI036
|
||||
64 |
|
||||
64 |
|
||||
65 | class BadFour:
|
||||
|
|
||||
|
||||
PYI036.py:66:111: PYI036 The third argument in `__exit__` should be annotated with `object` or `types.TracebackType | None`
|
||||
|
|
||||
65 | class BadFour:
|
||||
66 | def __exit__(self, typ: typing.Optional[type[BaseException]], exc: typing.Union[BaseException, None], tb: TracebackType) -> None: ... # PYI036: Third arg has bad annotation
|
||||
| ^^^^^^^^^^^^^ PYI036
|
||||
67 | async def __aexit__(self, __typ: type[BaseException] | None, __exc: BaseException | None, __tb: typing.Union[TracebackType, None, int]) -> bool | None: ... # PYI036: Third arg has bad annotation
|
||||
65 | …
|
||||
66 | …xception]], exc: typing.Union[BaseException, None], tb: TracebackType) -> None: ... # PYI036: Third arg has bad annotation
|
||||
| ^^^^^^^^^^^^^ PYI036
|
||||
67 | …n] | None, __exc: BaseException | None, __tb: typing.Union[TracebackType, None, int]) -> bool | None: ... # PYI036: Third arg has bad…
|
||||
|
|
||||
|
||||
PYI036.py:67:101: PYI036 The third argument in `__aexit__` should be annotated with `object` or `types.TracebackType | None`
|
||||
|
|
||||
65 | class BadFour:
|
||||
66 | def __exit__(self, typ: typing.Optional[type[BaseException]], exc: typing.Union[BaseException, None], tb: TracebackType) -> None: ... # PYI036: Third arg has bad annotation
|
||||
67 | async def __aexit__(self, __typ: type[BaseException] | None, __exc: BaseException | None, __tb: typing.Union[TracebackType, None, int]) -> bool | None: ... # PYI036: Third arg has bad annotation
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI036
|
||||
68 |
|
||||
69 | class BadFive:
|
||||
65 | …
|
||||
66 | …eption]], exc: typing.Union[BaseException, None], tb: TracebackType) -> None: ... # PYI036: Third arg has bad annotation
|
||||
67 | … | None, __exc: BaseException | None, __tb: typing.Union[TracebackType, None, int]) -> bool | None: ... # PYI036: Third arg has bad a…
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI036
|
||||
68 | …
|
||||
69 | …
|
||||
|
|
||||
|
||||
PYI036.py:70:29: PYI036 The first argument in `__exit__` should be annotated with `object` or `type[BaseException] | None`
|
||||
|
@ -100,7 +99,7 @@ PYI036.py:70:29: PYI036 The first argument in `__exit__` should be annotated wit
|
|||
69 | class BadFive:
|
||||
70 | def __exit__(self, typ: BaseException | None, *args: list[str]) -> bool: ... # PYI036: Bad star-args annotation
|
||||
| ^^^^^^^^^^^^^^^^^^^^ PYI036
|
||||
71 | async def __aexit__(self, /, typ: type[BaseException] | None, *args: Any) -> Awaitable[None]: ... # PYI036: Bad star-args annotation
|
||||
71 | async def __aexit__(self, /, typ: type[BaseException] | None, *args: Any) -> Awaitable[None]: ... # PYI036: Bad star-args annotati…
|
||||
|
|
||||
|
||||
PYI036.py:70:58: PYI036 [*] Star-args in `__exit__` should be annotated with `object`
|
||||
|
@ -108,7 +107,7 @@ PYI036.py:70:58: PYI036 [*] Star-args in `__exit__` should be annotated with `ob
|
|||
69 | class BadFive:
|
||||
70 | def __exit__(self, typ: BaseException | None, *args: list[str]) -> bool: ... # PYI036: Bad star-args annotation
|
||||
| ^^^^^^^^^ PYI036
|
||||
71 | async def __aexit__(self, /, typ: type[BaseException] | None, *args: Any) -> Awaitable[None]: ... # PYI036: Bad star-args annotation
|
||||
71 | async def __aexit__(self, /, typ: type[BaseException] | None, *args: Any) -> Awaitable[None]: ... # PYI036: Bad star-args annotati…
|
||||
|
|
||||
= help: Annotate star-args with `object`
|
||||
|
||||
|
@ -126,9 +125,9 @@ PYI036.py:71:74: PYI036 [*] Star-args in `__aexit__` should be annotated with `o
|
|||
|
|
||||
69 | class BadFive:
|
||||
70 | def __exit__(self, typ: BaseException | None, *args: list[str]) -> bool: ... # PYI036: Bad star-args annotation
|
||||
71 | async def __aexit__(self, /, typ: type[BaseException] | None, *args: Any) -> Awaitable[None]: ... # PYI036: Bad star-args annotation
|
||||
71 | async def __aexit__(self, /, typ: type[BaseException] | None, *args: Any) -> Awaitable[None]: ... # PYI036: Bad star-args annotati…
|
||||
| ^^^ PYI036
|
||||
72 |
|
||||
72 |
|
||||
73 | class BadSix:
|
||||
|
|
||||
= help: Annotate star-args with `object`
|
||||
|
@ -157,7 +156,7 @@ PYI036.py:75:48: PYI036 All keyword-only arguments in `__aexit__` must have a de
|
|||
74 | def __exit__(self, typ, exc, tb, weird_extra_arg, extra_arg2 = None) -> None: ... # PYI036: Extra arg must have default
|
||||
75 | async def __aexit__(self, typ, exc, tb, *, weird_extra_arg) -> None: ... # PYI036: kwargs must have default
|
||||
| ^^^^^^^^^^^^^^^ PYI036
|
||||
76 |
|
||||
76 |
|
||||
77 | class AllPositionalOnlyArgs:
|
||||
|
|
||||
|
||||
|
@ -175,7 +174,7 @@ PYI036.py:83:95: PYI036 The third argument in `__aexit__` should be annotated wi
|
|||
82 | def __exit__(self, typ: type[Exception] | None, exc: BaseException | None, tb: TracebackType | None, /) -> None: ...
|
||||
83 | async def __aexit__(self, typ: type[BaseException] | None, exc: BaseException | None, tb: TracebackType, /) -> None: ...
|
||||
| ^^^^^^^^^^^^^ PYI036
|
||||
84 |
|
||||
84 |
|
||||
85 | # Definitions not in a class scope can do whatever, we don't care
|
||||
|
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs
|
||||
snapshot_kind: text
|
||||
---
|
||||
PYI036.pyi:54:31: PYI036 [*] Star-args in `__exit__` should be annotated with `object`
|
||||
|
|
||||
|
@ -27,7 +26,7 @@ PYI036.pyi:55:24: PYI036 If there are no star-args, `__aexit__` should have at l
|
|||
54 | def __exit__(self, *args: Any) -> None: ... # PYI036: Bad star-args annotation
|
||||
55 | async def __aexit__(self) -> None: ... # PYI036: Missing args
|
||||
| ^^^^^^ PYI036
|
||||
56 |
|
||||
56 |
|
||||
57 | class BadTwo:
|
||||
|
|
||||
|
||||
|
@ -45,7 +44,7 @@ PYI036.pyi:59:48: PYI036 All keyword-only arguments in `__aexit__` must have a d
|
|||
58 | def __exit__(self, typ, exc, tb, weird_extra_arg) -> None: ... # PYI036: Extra arg must have default
|
||||
59 | async def __aexit__(self, typ, exc, tb, *, weird_extra_arg1, weird_extra_arg2) -> None: ...# PYI036: kwargs must have default
|
||||
| ^^^^^^^^^^^^^^^^ PYI036
|
||||
60 |
|
||||
60 |
|
||||
61 | class BadThree:
|
||||
|
|
||||
|
||||
|
@ -55,54 +54,54 @@ PYI036.pyi:59:66: PYI036 All keyword-only arguments in `__aexit__` must have a d
|
|||
58 | def __exit__(self, typ, exc, tb, weird_extra_arg) -> None: ... # PYI036: Extra arg must have default
|
||||
59 | async def __aexit__(self, typ, exc, tb, *, weird_extra_arg1, weird_extra_arg2) -> None: ...# PYI036: kwargs must have default
|
||||
| ^^^^^^^^^^^^^^^^ PYI036
|
||||
60 |
|
||||
60 |
|
||||
61 | class BadThree:
|
||||
|
|
||||
|
||||
PYI036.pyi:62:29: PYI036 The first argument in `__exit__` should be annotated with `object` or `type[BaseException] | None`
|
||||
|
|
||||
61 | class BadThree:
|
||||
62 | def __exit__(self, typ: type[BaseException], exc: BaseException | None, tb: TracebackType | None) -> None: ... # PYI036: First arg has bad annotation
|
||||
62 | def __exit__(self, typ: type[BaseException], exc: BaseException | None, tb: TracebackType | None) -> None: ... # PYI036: First arg…
|
||||
| ^^^^^^^^^^^^^^^^^^^ PYI036
|
||||
63 | async def __aexit__(self, __typ: type[BaseException] | None, __exc: BaseException, __tb: TracebackType) -> bool | None: ... # PYI036: Second arg has bad annotation
|
||||
63 | async def __aexit__(self, __typ: type[BaseException] | None, __exc: BaseException, __tb: TracebackType) -> bool | None: ... # PYI0…
|
||||
|
|
||||
|
||||
PYI036.pyi:63:73: PYI036 The second argument in `__aexit__` should be annotated with `object` or `BaseException | None`
|
||||
|
|
||||
61 | class BadThree:
|
||||
62 | def __exit__(self, typ: type[BaseException], exc: BaseException | None, tb: TracebackType | None) -> None: ... # PYI036: First arg has bad annotation
|
||||
63 | async def __aexit__(self, __typ: type[BaseException] | None, __exc: BaseException, __tb: TracebackType) -> bool | None: ... # PYI036: Second arg has bad annotation
|
||||
62 | def __exit__(self, typ: type[BaseException], exc: BaseException | None, tb: TracebackType | None) -> None: ... # PYI036: First arg…
|
||||
63 | async def __aexit__(self, __typ: type[BaseException] | None, __exc: BaseException, __tb: TracebackType) -> bool | None: ... # PYI0…
|
||||
| ^^^^^^^^^^^^^ PYI036
|
||||
64 |
|
||||
64 |
|
||||
65 | class BadFour:
|
||||
|
|
||||
|
||||
PYI036.pyi:63:94: PYI036 The third argument in `__aexit__` should be annotated with `object` or `types.TracebackType | None`
|
||||
|
|
||||
61 | class BadThree:
|
||||
62 | def __exit__(self, typ: type[BaseException], exc: BaseException | None, tb: TracebackType | None) -> None: ... # PYI036: First arg has bad annotation
|
||||
63 | async def __aexit__(self, __typ: type[BaseException] | None, __exc: BaseException, __tb: TracebackType) -> bool | None: ... # PYI036: Second arg has bad annotation
|
||||
62 | def __exit__(self, typ: type[BaseException], exc: BaseException | None, tb: TracebackType | None) -> None: ... # PYI036: First arg…
|
||||
63 | async def __aexit__(self, __typ: type[BaseException] | None, __exc: BaseException, __tb: TracebackType) -> bool | None: ... # PYI0…
|
||||
| ^^^^^^^^^^^^^ PYI036
|
||||
64 |
|
||||
64 |
|
||||
65 | class BadFour:
|
||||
|
|
||||
|
||||
PYI036.pyi:66:111: PYI036 The third argument in `__exit__` should be annotated with `object` or `types.TracebackType | None`
|
||||
|
|
||||
65 | class BadFour:
|
||||
66 | def __exit__(self, typ: typing.Optional[type[BaseException]], exc: typing.Union[BaseException, None], tb: TracebackType) -> None: ... # PYI036: Third arg has bad annotation
|
||||
| ^^^^^^^^^^^^^ PYI036
|
||||
67 | async def __aexit__(self, __typ: type[BaseException] | None, __exc: BaseException | None, __tb: typing.Union[TracebackType, None, int]) -> bool | None: ... # PYI036: Third arg has bad annotation
|
||||
65 | …
|
||||
66 | …xception]], exc: typing.Union[BaseException, None], tb: TracebackType) -> None: ... # PYI036: Third arg has bad annotation
|
||||
| ^^^^^^^^^^^^^ PYI036
|
||||
67 | …n] | None, __exc: BaseException | None, __tb: typing.Union[TracebackType, None, int]) -> bool | None: ... # PYI036: Third arg has bad…
|
||||
|
|
||||
|
||||
PYI036.pyi:67:101: PYI036 The third argument in `__aexit__` should be annotated with `object` or `types.TracebackType | None`
|
||||
|
|
||||
65 | class BadFour:
|
||||
66 | def __exit__(self, typ: typing.Optional[type[BaseException]], exc: typing.Union[BaseException, None], tb: TracebackType) -> None: ... # PYI036: Third arg has bad annotation
|
||||
67 | async def __aexit__(self, __typ: type[BaseException] | None, __exc: BaseException | None, __tb: typing.Union[TracebackType, None, int]) -> bool | None: ... # PYI036: Third arg has bad annotation
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI036
|
||||
68 |
|
||||
69 | class BadFive:
|
||||
65 | …
|
||||
66 | …eption]], exc: typing.Union[BaseException, None], tb: TracebackType) -> None: ... # PYI036: Third arg has bad annotation
|
||||
67 | … | None, __exc: BaseException | None, __tb: typing.Union[TracebackType, None, int]) -> bool | None: ... # PYI036: Third arg has bad a…
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI036
|
||||
68 | …
|
||||
69 | …
|
||||
|
|
||||
|
||||
PYI036.pyi:70:29: PYI036 The first argument in `__exit__` should be annotated with `object` or `type[BaseException] | None`
|
||||
|
@ -110,7 +109,7 @@ PYI036.pyi:70:29: PYI036 The first argument in `__exit__` should be annotated wi
|
|||
69 | class BadFive:
|
||||
70 | def __exit__(self, typ: BaseException | None, *args: list[str]) -> bool: ... # PYI036: Bad star-args annotation
|
||||
| ^^^^^^^^^^^^^^^^^^^^ PYI036
|
||||
71 | async def __aexit__(self, /, typ: type[BaseException] | None, *args: Any) -> Awaitable[None]: ... # PYI036: Bad star-args annotation
|
||||
71 | async def __aexit__(self, /, typ: type[BaseException] | None, *args: Any) -> Awaitable[None]: ... # PYI036: Bad star-args annotati…
|
||||
|
|
||||
|
||||
PYI036.pyi:70:58: PYI036 [*] Star-args in `__exit__` should be annotated with `object`
|
||||
|
@ -118,7 +117,7 @@ PYI036.pyi:70:58: PYI036 [*] Star-args in `__exit__` should be annotated with `o
|
|||
69 | class BadFive:
|
||||
70 | def __exit__(self, typ: BaseException | None, *args: list[str]) -> bool: ... # PYI036: Bad star-args annotation
|
||||
| ^^^^^^^^^ PYI036
|
||||
71 | async def __aexit__(self, /, typ: type[BaseException] | None, *args: Any) -> Awaitable[None]: ... # PYI036: Bad star-args annotation
|
||||
71 | async def __aexit__(self, /, typ: type[BaseException] | None, *args: Any) -> Awaitable[None]: ... # PYI036: Bad star-args annotati…
|
||||
|
|
||||
= help: Annotate star-args with `object`
|
||||
|
||||
|
@ -136,9 +135,9 @@ PYI036.pyi:71:74: PYI036 [*] Star-args in `__aexit__` should be annotated with `
|
|||
|
|
||||
69 | class BadFive:
|
||||
70 | def __exit__(self, typ: BaseException | None, *args: list[str]) -> bool: ... # PYI036: Bad star-args annotation
|
||||
71 | async def __aexit__(self, /, typ: type[BaseException] | None, *args: Any) -> Awaitable[None]: ... # PYI036: Bad star-args annotation
|
||||
71 | async def __aexit__(self, /, typ: type[BaseException] | None, *args: Any) -> Awaitable[None]: ... # PYI036: Bad star-args annotati…
|
||||
| ^^^ PYI036
|
||||
72 |
|
||||
72 |
|
||||
73 | class BadSix:
|
||||
|
|
||||
= help: Annotate star-args with `object`
|
||||
|
@ -183,7 +182,7 @@ PYI036.pyi:90:95: PYI036 The third argument in `__aexit__` should be annotated w
|
|||
89 | def __exit__(self, typ: type[Exception] | None, exc: BaseException | None, tb: TracebackType | None, /) -> None: ...
|
||||
90 | async def __aexit__(self, typ: type[BaseException] | None, exc: BaseException | None, tb: TracebackType, /) -> None: ...
|
||||
| ^^^^^^^^^^^^^ PYI036
|
||||
91 |
|
||||
91 |
|
||||
92 | # Definitions not in a class scope can do whatever, we don't care
|
||||
|
|
||||
|
||||
|
@ -193,7 +192,7 @@ PYI036.pyi:159:17: PYI036 Annotations for a three-argument `__exit__` overload (
|
|||
158 | @overload
|
||||
159 | def __exit__(self, exc_typ: Exception, exc: Exception, tb: TracebackType) -> None: ... # PYI036
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI036
|
||||
160 |
|
||||
160 |
|
||||
161 | class UnacceptableOverload2:
|
||||
|
|
||||
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs
|
||||
snapshot_kind: text
|
||||
---
|
||||
PYI052.pyi:14:10: PYI052 Need type annotation for `field5`
|
||||
|
|
||||
12 | field43: int = -0xFFFFFFFF
|
||||
13 | field44: int = -1234567890
|
||||
14 | field5 = 0 # type: int # Y033 Do not use type comments in stubs (e.g. use "x: int" instead of "x = ... # type: int") # Y052 Need type annotation for "field5"
|
||||
14 | field5 = 0 # type: int # Y033 Do not use type comments in stubs (e.g. use "x: int" instead of "x = ... # type: int") # Y052 Need ty…
|
||||
| ^ PYI052
|
||||
15 | field6 = 0 # Y052 Need type annotation for "field6"
|
||||
16 | field7 = b"" # Y052 Need type annotation for "field7"
|
||||
|
@ -15,7 +14,7 @@ PYI052.pyi:14:10: PYI052 Need type annotation for `field5`
|
|||
PYI052.pyi:15:10: PYI052 Need type annotation for `field6`
|
||||
|
|
||||
13 | field44: int = -1234567890
|
||||
14 | field5 = 0 # type: int # Y033 Do not use type comments in stubs (e.g. use "x: int" instead of "x = ... # type: int") # Y052 Need type annotation for "field5"
|
||||
14 | field5 = 0 # type: int # Y033 Do not use type comments in stubs (e.g. use "x: int" instead of "x = ... # type: int") # Y052 Need ty…
|
||||
15 | field6 = 0 # Y052 Need type annotation for "field6"
|
||||
| ^ PYI052
|
||||
16 | field7 = b"" # Y052 Need type annotation for "field7"
|
||||
|
@ -24,7 +23,7 @@ PYI052.pyi:15:10: PYI052 Need type annotation for `field6`
|
|||
|
||||
PYI052.pyi:16:10: PYI052 Need type annotation for `field7`
|
||||
|
|
||||
14 | field5 = 0 # type: int # Y033 Do not use type comments in stubs (e.g. use "x: int" instead of "x = ... # type: int") # Y052 Need type annotation for "field5"
|
||||
14 | field5 = 0 # type: int # Y033 Do not use type comments in stubs (e.g. use "x: int" instead of "x = ... # type: int") # Y052 Need ty…
|
||||
15 | field6 = 0 # Y052 Need type annotation for "field6"
|
||||
16 | field7 = b"" # Y052 Need type annotation for "field7"
|
||||
| ^^^ PYI052
|
||||
|
|
|
@ -5,8 +5,8 @@ snapshot_kind: text
|
|||
PYI066.pyi:3:4: PYI066 Put branches for newer Python versions first when branching on `sys.version_info` comparisons
|
||||
|
|
||||
1 | import sys
|
||||
2 |
|
||||
3 | if sys.version_info < (3, 10): # Y066 When using if/else with sys.version_info, put the code for new Python versions first, e.g. "if sys.version_info >= (3, 10)"
|
||||
2 |
|
||||
3 | if sys.version_info < (3, 10): # Y066 When using if/else with sys.version_info, put the code for new Python versions first, e.g. "if s…
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI066
|
||||
4 | def foo(x): ...
|
||||
5 | else:
|
||||
|
@ -15,28 +15,28 @@ PYI066.pyi:3:4: PYI066 Put branches for newer Python versions first when branchi
|
|||
PYI066.pyi:8:4: PYI066 Put branches for newer Python versions first when branching on `sys.version_info` comparisons
|
||||
|
|
||||
6 | def foo(x, *, bar=True): ...
|
||||
7 |
|
||||
8 | if sys.version_info < (3, 8): # Y066 When using if/else with sys.version_info, put the code for new Python versions first, e.g. "if sys.version_info >= (3, 8)"
|
||||
7 |
|
||||
8 | if sys.version_info < (3, 8): # Y066 When using if/else with sys.version_info, put the code for new Python versions first, e.g. "if s…
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ PYI066
|
||||
9 | def bar(x): ...
|
||||
10 | elif sys.version_info < (3, 9): # Y066 When using if/else with sys.version_info, put the code for new Python versions first, e.g. "if sys.version_info >= (3, 9)"
|
||||
10 | elif sys.version_info < (3, 9): # Y066 When using if/else with sys.version_info, put the code for new Python versions first, e.g. "if…
|
||||
|
|
||||
|
||||
PYI066.pyi:10:6: PYI066 Put branches for newer Python versions first when branching on `sys.version_info` comparisons
|
||||
|
|
||||
8 | if sys.version_info < (3, 8): # Y066 When using if/else with sys.version_info, put the code for new Python versions first, e.g. "if sys.version_info >= (3, 8)"
|
||||
8 | if sys.version_info < (3, 8): # Y066 When using if/else with sys.version_info, put the code for new Python versions first, e.g. "if s…
|
||||
9 | def bar(x): ...
|
||||
10 | elif sys.version_info < (3, 9): # Y066 When using if/else with sys.version_info, put the code for new Python versions first, e.g. "if sys.version_info >= (3, 9)"
|
||||
10 | elif sys.version_info < (3, 9): # Y066 When using if/else with sys.version_info, put the code for new Python versions first, e.g. "if…
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ PYI066
|
||||
11 | def bar(x, *, bar=True): ...
|
||||
12 | elif sys.version_info < (3, 11): # Y066 When using if/else with sys.version_info, put the code for new Python versions first, e.g. "if sys.version_info >= (3, 10)"
|
||||
12 | elif sys.version_info < (3, 11): # Y066 When using if/else with sys.version_info, put the code for new Python versions first, e.g. "i…
|
||||
|
|
||||
|
||||
PYI066.pyi:12:6: PYI066 Put branches for newer Python versions first when branching on `sys.version_info` comparisons
|
||||
|
|
||||
10 | elif sys.version_info < (3, 9): # Y066 When using if/else with sys.version_info, put the code for new Python versions first, e.g. "if sys.version_info >= (3, 9)"
|
||||
10 | elif sys.version_info < (3, 9): # Y066 When using if/else with sys.version_info, put the code for new Python versions first, e.g. "if…
|
||||
11 | def bar(x, *, bar=True): ...
|
||||
12 | elif sys.version_info < (3, 11): # Y066 When using if/else with sys.version_info, put the code for new Python versions first, e.g. "if sys.version_info >= (3, 10)"
|
||||
12 | elif sys.version_info < (3, 11): # Y066 When using if/else with sys.version_info, put the code for new Python versions first, e.g. "i…
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI066
|
||||
13 | def bar(x, *, bar=True, baz=False): ...
|
||||
14 | else:
|
||||
|
@ -46,7 +46,7 @@ PYI066.pyi:20:6: PYI066 Put branches for newer Python versions first when branch
|
|||
|
|
||||
18 | if sys.version_info >= (3, 5):
|
||||
19 | ...
|
||||
20 | elif sys.version_info < (3, 9): # Y066 When using if/else with sys.version_info, put the code for new Python versions first, e.g. "if sys.version_info >= (3, 10)"
|
||||
20 | elif sys.version_info < (3, 9): # Y066 When using if/else with sys.version_info, put the code for new Python versions first, e.g. "if…
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ PYI066
|
||||
21 | ...
|
||||
22 | else:
|
||||
|
|
|
@ -4,10 +4,10 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs
|
|||
quote3.py:4:44: TC002 [*] Move third-party import `django.contrib.auth.models.AbstractBaseUser` into a type-checking block
|
||||
|
|
||||
2 | from typing import Literal, Union
|
||||
3 |
|
||||
3 |
|
||||
4 | from django.contrib.auth.models import AbstractBaseUser
|
||||
| ^^^^^^^^^^^^^^^^ TC002
|
||||
5 |
|
||||
5 |
|
||||
6 | def test_union_literal_mixed_quotes(user: AbstractBaseUser[Union[Literal['active', "inactive"], str]]):
|
||||
|
|
||||
= help: Move into type-checking block
|
||||
|
@ -31,10 +31,10 @@ quote3.py:4:44: TC002 [*] Move third-party import `django.contrib.auth.models.Ab
|
|||
quote3.py:13:44: TC002 [*] Move third-party import `django.contrib.auth.models.AbstractBaseUser` into a type-checking block
|
||||
|
|
||||
11 | from typing import Callable, Literal
|
||||
12 |
|
||||
12 |
|
||||
13 | from django.contrib.auth.models import AbstractBaseUser
|
||||
| ^^^^^^^^^^^^^^^^ TC002
|
||||
14 |
|
||||
14 |
|
||||
15 | def test_callable_literal_mixed_quotes(callable_fn: AbstractBaseUser[Callable[["int", Literal['admin', "user"]], 'bool']]):
|
||||
|
|
||||
= help: Move into type-checking block
|
||||
|
@ -62,11 +62,11 @@ quote3.py:13:44: TC002 [*] Move third-party import `django.contrib.auth.models.A
|
|||
quote3.py:22:44: TC002 [*] Move third-party import `django.contrib.auth.models.AbstractBaseUser` into a type-checking block
|
||||
|
|
||||
20 | from typing import Annotated, Callable, Literal
|
||||
21 |
|
||||
21 |
|
||||
22 | from django.contrib.auth.models import AbstractBaseUser
|
||||
| ^^^^^^^^^^^^^^^^ TC002
|
||||
23 |
|
||||
24 | def test_callable_annotated_literal(callable_fn: AbstractBaseUser[Callable[[int, Annotated[str, Literal['active', "inactive"]]], bool]]):
|
||||
23 |
|
||||
24 | def test_callable_annotated_literal(callable_fn: AbstractBaseUser[Callable[[int, Annotated[str, Literal['active', "inactive"]]], b…
|
||||
|
|
||||
= help: Move into type-checking block
|
||||
|
||||
|
@ -93,10 +93,10 @@ quote3.py:22:44: TC002 [*] Move third-party import `django.contrib.auth.models.A
|
|||
quote3.py:31:37: TC002 [*] Move third-party import `django.contrib.auth.models` into a type-checking block
|
||||
|
|
||||
29 | from typing import literal
|
||||
30 |
|
||||
30 |
|
||||
31 | from django.contrib.auth import models
|
||||
| ^^^^^^ TC002
|
||||
32 |
|
||||
32 |
|
||||
33 | def test_attribute(arg: models.AbstractBaseUser["int"]):
|
||||
|
|
||||
= help: Move into type-checking block
|
||||
|
@ -124,10 +124,10 @@ quote3.py:31:37: TC002 [*] Move third-party import `django.contrib.auth.models`
|
|||
quote3.py:40:37: TC002 [*] Move third-party import `django.contrib.auth.models` into a type-checking block
|
||||
|
|
||||
38 | from typing import Literal
|
||||
39 |
|
||||
39 |
|
||||
40 | from django.contrib.auth import models
|
||||
| ^^^^^^ TC002
|
||||
41 |
|
||||
41 |
|
||||
42 | def test_attribute_typing_literal(arg: models.AbstractBaseUser[Literal["admin"]]):
|
||||
|
|
||||
= help: Move into type-checking block
|
||||
|
@ -158,7 +158,7 @@ quote3.py:59:29: TC002 [*] Move third-party import `third_party.Type` into a typ
|
|||
58 | from typing import Literal
|
||||
59 | from third_party import Type
|
||||
| ^^^^ TC002
|
||||
60 |
|
||||
60 |
|
||||
61 | def test_string_contains_opposite_quote(self, type1: Type[Literal["'"]], type2: Type[Literal["\'"]]):
|
||||
|
|
||||
= help: Move into type-checking block
|
||||
|
@ -189,7 +189,7 @@ quote3.py:67:29: TC002 [*] Move third-party import `third_party.Type` into a typ
|
|||
66 | from typing import Literal
|
||||
67 | from third_party import Type
|
||||
| ^^^^ TC002
|
||||
68 |
|
||||
68 |
|
||||
69 | def test_quote_contains_backslash(self, type1: Type[Literal["\n"]], type2: Type[Literal["\""]]):
|
||||
|
|
||||
= help: Move into type-checking block
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/rules/pycodestyle/mod.rs
|
||||
snapshot_kind: text
|
||||
---
|
||||
E23.py:2:7: E231 [*] Missing whitespace after ','
|
||||
|
|
||||
|
@ -107,7 +106,7 @@ E23.py:33:6: E231 [*] Missing whitespace after ','
|
|||
32 | # E231
|
||||
33 | f"{(a,b)}"
|
||||
| ^ E231
|
||||
34 |
|
||||
34 |
|
||||
35 | # Okay because it's hard to differentiate between the usages of a colon in a f-string
|
||||
|
|
||||
= help: Add missing whitespace
|
||||
|
@ -127,7 +126,7 @@ E23.py:47:37: E231 [*] Missing whitespace after ':'
|
|||
46 | #: E231
|
||||
47 | {len(f's3://{self.s3_bucket_name}/'):1}
|
||||
| ^ E231
|
||||
48 |
|
||||
48 |
|
||||
49 | #: Okay
|
||||
|
|
||||
= help: Add missing whitespace
|
||||
|
@ -604,7 +603,7 @@ E23.py:112:6: E231 [*] Missing whitespace after ':'
|
|||
E23.py:116:18: E231 [*] Missing whitespace after ':'
|
||||
|
|
||||
114 | pass
|
||||
115 |
|
||||
115 |
|
||||
116 | class PEP696Bad[A:object="foo"[::-1], B:object =[[["foo", "bar"]]], C:object= bytes]:
|
||||
| ^ E231
|
||||
117 | def pep_696_bad_method[A:object="foo"[::-1], B:object =[[["foo", "bar"]]], C:object= bytes](
|
||||
|
@ -625,7 +624,7 @@ E23.py:116:18: E231 [*] Missing whitespace after ':'
|
|||
E23.py:116:40: E231 [*] Missing whitespace after ':'
|
||||
|
|
||||
114 | pass
|
||||
115 |
|
||||
115 |
|
||||
116 | class PEP696Bad[A:object="foo"[::-1], B:object =[[["foo", "bar"]]], C:object= bytes]:
|
||||
| ^ E231
|
||||
117 | def pep_696_bad_method[A:object="foo"[::-1], B:object =[[["foo", "bar"]]], C:object= bytes](
|
||||
|
@ -646,7 +645,7 @@ E23.py:116:40: E231 [*] Missing whitespace after ':'
|
|||
E23.py:116:70: E231 [*] Missing whitespace after ':'
|
||||
|
|
||||
114 | pass
|
||||
115 |
|
||||
115 |
|
||||
116 | class PEP696Bad[A:object="foo"[::-1], B:object =[[["foo", "bar"]]], C:object= bytes]:
|
||||
| ^ E231
|
||||
117 | def pep_696_bad_method[A:object="foo"[::-1], B:object =[[["foo", "bar"]]], C:object= bytes](
|
||||
|
@ -790,10 +789,10 @@ E23.py:121:10: E231 [*] Missing whitespace after ':'
|
|||
E23.py:125:32: E231 [*] Missing whitespace after ':'
|
||||
|
|
||||
123 | pass
|
||||
124 |
|
||||
124 |
|
||||
125 | class PEP696BadWithEmptyBases[A:object="foo"[::-1], B:object =[[["foo", "bar"]]], C:object= bytes]():
|
||||
| ^ E231
|
||||
126 | class IndentedPEP696BadWithNonEmptyBases[A:object="foo"[::-1], B:object =[[["foo", "bar"]]], C:object= bytes](object, something_dynamic[x::-1]):
|
||||
126 | class IndentedPEP696BadWithNonEmptyBases[A:object="foo"[::-1], B:object =[[["foo", "bar"]]], C:object= bytes](object, something_d…
|
||||
127 | pass
|
||||
|
|
||||
= help: Add missing whitespace
|
||||
|
@ -811,10 +810,10 @@ E23.py:125:32: E231 [*] Missing whitespace after ':'
|
|||
E23.py:125:54: E231 [*] Missing whitespace after ':'
|
||||
|
|
||||
123 | pass
|
||||
124 |
|
||||
124 |
|
||||
125 | class PEP696BadWithEmptyBases[A:object="foo"[::-1], B:object =[[["foo", "bar"]]], C:object= bytes]():
|
||||
| ^ E231
|
||||
126 | class IndentedPEP696BadWithNonEmptyBases[A:object="foo"[::-1], B:object =[[["foo", "bar"]]], C:object= bytes](object, something_dynamic[x::-1]):
|
||||
126 | class IndentedPEP696BadWithNonEmptyBases[A:object="foo"[::-1], B:object =[[["foo", "bar"]]], C:object= bytes](object, something_d…
|
||||
127 | pass
|
||||
|
|
||||
= help: Add missing whitespace
|
||||
|
@ -832,10 +831,10 @@ E23.py:125:54: E231 [*] Missing whitespace after ':'
|
|||
E23.py:125:84: E231 [*] Missing whitespace after ':'
|
||||
|
|
||||
123 | pass
|
||||
124 |
|
||||
124 |
|
||||
125 | class PEP696BadWithEmptyBases[A:object="foo"[::-1], B:object =[[["foo", "bar"]]], C:object= bytes]():
|
||||
| ^ E231
|
||||
126 | class IndentedPEP696BadWithNonEmptyBases[A:object="foo"[::-1], B:object =[[["foo", "bar"]]], C:object= bytes](object, something_dynamic[x::-1]):
|
||||
126 | class IndentedPEP696BadWithNonEmptyBases[A:object="foo"[::-1], B:object =[[["foo", "bar"]]], C:object= bytes](object, something_d…
|
||||
127 | pass
|
||||
|
|
||||
= help: Add missing whitespace
|
||||
|
@ -853,7 +852,7 @@ E23.py:125:84: E231 [*] Missing whitespace after ':'
|
|||
E23.py:126:47: E231 [*] Missing whitespace after ':'
|
||||
|
|
||||
125 | class PEP696BadWithEmptyBases[A:object="foo"[::-1], B:object =[[["foo", "bar"]]], C:object= bytes]():
|
||||
126 | class IndentedPEP696BadWithNonEmptyBases[A:object="foo"[::-1], B:object =[[["foo", "bar"]]], C:object= bytes](object, something_dynamic[x::-1]):
|
||||
126 | class IndentedPEP696BadWithNonEmptyBases[A:object="foo"[::-1], B:object =[[["foo", "bar"]]], C:object= bytes](object, something_d…
|
||||
| ^ E231
|
||||
127 | pass
|
||||
|
|
||||
|
@ -872,7 +871,7 @@ E23.py:126:47: E231 [*] Missing whitespace after ':'
|
|||
E23.py:126:69: E231 [*] Missing whitespace after ':'
|
||||
|
|
||||
125 | class PEP696BadWithEmptyBases[A:object="foo"[::-1], B:object =[[["foo", "bar"]]], C:object= bytes]():
|
||||
126 | class IndentedPEP696BadWithNonEmptyBases[A:object="foo"[::-1], B:object =[[["foo", "bar"]]], C:object= bytes](object, something_dynamic[x::-1]):
|
||||
126 | class IndentedPEP696BadWithNonEmptyBases[A:object="foo"[::-1], B:object =[[["foo", "bar"]]], C:object= bytes](object, something_d…
|
||||
| ^ E231
|
||||
127 | pass
|
||||
|
|
||||
|
@ -891,7 +890,7 @@ E23.py:126:69: E231 [*] Missing whitespace after ':'
|
|||
E23.py:126:99: E231 [*] Missing whitespace after ':'
|
||||
|
|
||||
125 | class PEP696BadWithEmptyBases[A:object="foo"[::-1], B:object =[[["foo", "bar"]]], C:object= bytes]():
|
||||
126 | class IndentedPEP696BadWithNonEmptyBases[A:object="foo"[::-1], B:object =[[["foo", "bar"]]], C:object= bytes](object, something_dynamic[x::-1]):
|
||||
126 | class IndentedPEP696BadWithNonEmptyBases[A:object="foo"[::-1], B:object =[[["foo", "bar"]]], C:object= bytes](object, something_d…
|
||||
| ^ E231
|
||||
127 | pass
|
||||
|
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/rules/pycodestyle/mod.rs
|
||||
snapshot_kind: text
|
||||
---
|
||||
E501.py:5:89: E501 Line too long (123 > 88)
|
||||
|
|
||||
3 | https://github.com/PyCQA/pycodestyle/pull/258/files#diff-841c622497a8033d10152bfdfb15b20b92437ecdea21a260944ea86b77b51533
|
||||
4 |
|
||||
4 |
|
||||
5 | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ E501
|
||||
6 | """
|
||||
|
@ -50,9 +49,9 @@ E501.py:43:89: E501 Line too long (105 > 88)
|
|||
|
||||
E501.py:83:89: E501 Line too long (147 > 88)
|
||||
|
|
||||
81 | class Bar:
|
||||
82 | """
|
||||
83 | This is a long sentence that ends with a shortened URL and, therefore, could easily be broken across multiple lines ([source](https://ruff.rs))
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ E501
|
||||
84 | """
|
||||
81 | …
|
||||
82 | …
|
||||
83 | … URL and, therefore, could easily be broken across multiple lines ([source](https://ruff.rs))
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ E501
|
||||
84 | …
|
||||
|
|
||||
|
|
|
@ -1,77 +1,76 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/rules/pycodestyle/mod.rs
|
||||
snapshot_kind: text
|
||||
---
|
||||
E501_1.py:1:89: E501 Line too long (149 > 88)
|
||||
|
|
||||
1 | # TODO: comments starting with one of the configured task-tags sometimes are longer than line-length so that you can easily find them with `git grep`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ E501
|
||||
2 | # TODO(charlie): comments starting with one of the configured task-tags sometimes are longer than line-length so that you can easily find them with `git grep`
|
||||
3 | # TODO comments starting with one of the configured task-tags sometimes are longer than line-length so that you can easily find them with `git grep`
|
||||
1 | …ask-tags sometimes are longer than line-length so that you can easily find them with `git grep`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ E501
|
||||
2 | …figured task-tags sometimes are longer than line-length so that you can easily find them with `git grep`
|
||||
3 | …sk-tags sometimes are longer than line-length so that you can easily find them with `git grep`
|
||||
|
|
||||
|
||||
E501_1.py:2:89: E501 Line too long (158 > 88)
|
||||
|
|
||||
1 | # TODO: comments starting with one of the configured task-tags sometimes are longer than line-length so that you can easily find them with `git grep`
|
||||
2 | # TODO(charlie): comments starting with one of the configured task-tags sometimes are longer than line-length so that you can easily find them with `git grep`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ E501
|
||||
3 | # TODO comments starting with one of the configured task-tags sometimes are longer than line-length so that you can easily find them with `git grep`
|
||||
4 | # TODO comments starting with one of the configured task-tags sometimes are longer than line-length so that you can easily find them with `git grep`
|
||||
1 | …ags sometimes are longer than line-length so that you can easily find them with `git grep`
|
||||
2 | …ed task-tags sometimes are longer than line-length so that you can easily find them with `git grep`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ E501
|
||||
3 | …gs sometimes are longer than line-length so that you can easily find them with `git grep`
|
||||
4 | …task-tags sometimes are longer than line-length so that you can easily find them with `git grep`
|
||||
|
|
||||
|
||||
E501_1.py:3:89: E501 Line too long (148 > 88)
|
||||
|
|
||||
1 | # TODO: comments starting with one of the configured task-tags sometimes are longer than line-length so that you can easily find them with `git grep`
|
||||
2 | # TODO(charlie): comments starting with one of the configured task-tags sometimes are longer than line-length so that you can easily find them with `git grep`
|
||||
3 | # TODO comments starting with one of the configured task-tags sometimes are longer than line-length so that you can easily find them with `git grep`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ E501
|
||||
4 | # TODO comments starting with one of the configured task-tags sometimes are longer than line-length so that you can easily find them with `git grep`
|
||||
5 | # FIXME: comments starting with one of the configured task-tags sometimes are longer than line-length so that you can easily find them with `git grep`
|
||||
1 | …ask-tags sometimes are longer than line-length so that you can easily find them with `git grep`
|
||||
2 | …figured task-tags sometimes are longer than line-length so that you can easily find them with `git grep`
|
||||
3 | …sk-tags sometimes are longer than line-length so that you can easily find them with `git grep`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ E501
|
||||
4 | …ured task-tags sometimes are longer than line-length so that you can easily find them with `git grep`
|
||||
5 | …task-tags sometimes are longer than line-length so that you can easily find them with `git grep`
|
||||
|
|
||||
|
||||
E501_1.py:4:89: E501 Line too long (155 > 88)
|
||||
|
|
||||
2 | # TODO(charlie): comments starting with one of the configured task-tags sometimes are longer than line-length so that you can easily find them with `git grep`
|
||||
3 | # TODO comments starting with one of the configured task-tags sometimes are longer than line-length so that you can easily find them with `git grep`
|
||||
4 | # TODO comments starting with one of the configured task-tags sometimes are longer than line-length so that you can easily find them with `git grep`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ E501
|
||||
5 | # FIXME: comments starting with one of the configured task-tags sometimes are longer than line-length so that you can easily find them with `git grep`
|
||||
6 | # FIXME comments starting with one of the configured task-tags sometimes are longer than line-length so that you can easily find them with `git grep`
|
||||
2 | …ured task-tags sometimes are longer than line-length so that you can easily find them with `git grep`
|
||||
3 | …tags sometimes are longer than line-length so that you can easily find them with `git grep`
|
||||
4 | …d task-tags sometimes are longer than line-length so that you can easily find them with `git grep`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ E501
|
||||
5 | …k-tags sometimes are longer than line-length so that you can easily find them with `git grep`
|
||||
6 | …-tags sometimes are longer than line-length so that you can easily find them with `git grep`
|
||||
|
|
||||
|
||||
E501_1.py:5:89: E501 Line too long (150 > 88)
|
||||
|
|
||||
3 | # TODO comments starting with one of the configured task-tags sometimes are longer than line-length so that you can easily find them with `git grep`
|
||||
4 | # TODO comments starting with one of the configured task-tags sometimes are longer than line-length so that you can easily find them with `git grep`
|
||||
5 | # FIXME: comments starting with one of the configured task-tags sometimes are longer than line-length so that you can easily find them with `git grep`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ E501
|
||||
6 | # FIXME comments starting with one of the configured task-tags sometimes are longer than line-length so that you can easily find them with `git grep`
|
||||
7 | # FIXME comments starting with one of the configured task-tags sometimes are longer than line-length so that you can easily find them with `git grep`
|
||||
3 | …k-tags sometimes are longer than line-length so that you can easily find them with `git grep`
|
||||
4 | …red task-tags sometimes are longer than line-length so that you can easily find them with `git grep`
|
||||
5 | …ask-tags sometimes are longer than line-length so that you can easily find them with `git grep`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ E501
|
||||
6 | …sk-tags sometimes are longer than line-length so that you can easily find them with `git grep`
|
||||
7 | …ured task-tags sometimes are longer than line-length so that you can easily find them with `git grep`
|
||||
|
|
||||
|
||||
E501_1.py:6:89: E501 Line too long (149 > 88)
|
||||
|
|
||||
4 | # TODO comments starting with one of the configured task-tags sometimes are longer than line-length so that you can easily find them with `git grep`
|
||||
5 | # FIXME: comments starting with one of the configured task-tags sometimes are longer than line-length so that you can easily find them with `git grep`
|
||||
6 | # FIXME comments starting with one of the configured task-tags sometimes are longer than line-length so that you can easily find them with `git grep`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ E501
|
||||
7 | # FIXME comments starting with one of the configured task-tags sometimes are longer than line-length so that you can easily find them with `git grep`
|
||||
8 | # FIXME(charlie): comments starting with one of the configured task-tags sometimes are longer than line-length so that you can easily find them with `git grep`
|
||||
4 | …ured task-tags sometimes are longer than line-length so that you can easily find them with `git grep`
|
||||
5 | …task-tags sometimes are longer than line-length so that you can easily find them with `git grep`
|
||||
6 | …ask-tags sometimes are longer than line-length so that you can easily find them with `git grep`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ E501
|
||||
7 | …gured task-tags sometimes are longer than line-length so that you can easily find them with `git grep`
|
||||
8 | …nfigured task-tags sometimes are longer than line-length so that you can easily find them with `git grep`
|
||||
|
|
||||
|
||||
E501_1.py:7:89: E501 Line too long (156 > 88)
|
||||
|
|
||||
5 | # FIXME: comments starting with one of the configured task-tags sometimes are longer than line-length so that you can easily find them with `git grep`
|
||||
6 | # FIXME comments starting with one of the configured task-tags sometimes are longer than line-length so that you can easily find them with `git grep`
|
||||
7 | # FIXME comments starting with one of the configured task-tags sometimes are longer than line-length so that you can easily find them with `git grep`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ E501
|
||||
8 | # FIXME(charlie): comments starting with one of the configured task-tags sometimes are longer than line-length so that you can easily find them with `git grep`
|
||||
5 | …-tags sometimes are longer than line-length so that you can easily find them with `git grep`
|
||||
6 | …tags sometimes are longer than line-length so that you can easily find them with `git grep`
|
||||
7 | …d task-tags sometimes are longer than line-length so that you can easily find them with `git grep`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ E501
|
||||
8 | …ured task-tags sometimes are longer than line-length so that you can easily find them with `git grep`
|
||||
|
|
||||
|
||||
E501_1.py:8:89: E501 Line too long (159 > 88)
|
||||
|
|
||||
6 | # FIXME comments starting with one of the configured task-tags sometimes are longer than line-length so that you can easily find them with `git grep`
|
||||
7 | # FIXME comments starting with one of the configured task-tags sometimes are longer than line-length so that you can easily find them with `git grep`
|
||||
8 | # FIXME(charlie): comments starting with one of the configured task-tags sometimes are longer than line-length so that you can easily find them with `git grep`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ E501
|
||||
6 | …ags sometimes are longer than line-length so that you can easily find them with `git grep`
|
||||
7 | … task-tags sometimes are longer than line-length so that you can easily find them with `git grep`
|
||||
8 | …red task-tags sometimes are longer than line-length so that you can easily find them with `git grep`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ E501
|
||||
|
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/rules/pyflakes/mod.rs
|
||||
snapshot_kind: text
|
||||
---
|
||||
F821_17.py:16:12: F821 Undefined name `DoesNotExist`
|
||||
|
|
||||
14 | # Types used in aliased assignment must exist
|
||||
15 |
|
||||
15 |
|
||||
16 | type Foo = DoesNotExist # F821: Undefined name `DoesNotExist`
|
||||
| ^^^^^^^^^^^^ F821
|
||||
17 | type Foo = list[DoesNotExist] # F821: Undefined name `DoesNotExist`
|
||||
|
@ -16,7 +15,7 @@ F821_17.py:17:17: F821 Undefined name `DoesNotExist`
|
|||
16 | type Foo = DoesNotExist # F821: Undefined name `DoesNotExist`
|
||||
17 | type Foo = list[DoesNotExist] # F821: Undefined name `DoesNotExist`
|
||||
| ^^^^^^^^^^^^ F821
|
||||
18 |
|
||||
18 |
|
||||
19 | # Type parameters do not escape alias scopes
|
||||
|
|
||||
|
||||
|
@ -25,17 +24,17 @@ F821_17.py:22:1: F821 Undefined name `T`
|
|||
21 | type Foo[T] = T
|
||||
22 | T # F821: Undefined name `T` - not accessible afterward alias scope
|
||||
| ^ F821
|
||||
23 |
|
||||
23 |
|
||||
24 | # Type parameters in functions
|
||||
|
|
||||
|
||||
F821_17.py:39:17: F821 Undefined name `T`
|
||||
|
|
||||
37 | from some_library import some_decorator
|
||||
38 |
|
||||
38 |
|
||||
39 | @some_decorator(T) # F821: Undefined name `T` - not accessible in decorators
|
||||
| ^ F821
|
||||
40 |
|
||||
40 |
|
||||
41 | def foo[T](t: T) -> None: ...
|
||||
|
|
||||
|
||||
|
@ -51,7 +50,7 @@ F821_17.py:64:17: F821 Undefined name `T`
|
|||
63 | from some_library import some_decorator
|
||||
64 | @some_decorator(T) # F821: Undefined name `T` - not accessible in decorators
|
||||
| ^ F821
|
||||
65 |
|
||||
65 |
|
||||
66 | class Foo[T](list[T]): ...
|
||||
|
|
||||
|
||||
|
@ -60,14 +59,14 @@ F821_17.py:67:1: F821 Undefined name `T`
|
|||
66 | class Foo[T](list[T]): ...
|
||||
67 | T # F821: Undefined name `T` - not accessible after class scope
|
||||
| ^ F821
|
||||
68 |
|
||||
68 |
|
||||
69 | # Types specified in bounds should exist
|
||||
|
|
||||
|
||||
F821_17.py:71:13: F821 Undefined name `DoesNotExist`
|
||||
|
|
||||
69 | # Types specified in bounds should exist
|
||||
70 |
|
||||
70 |
|
||||
71 | type Foo[T: DoesNotExist] = T # F821: Undefined name `DoesNotExist`
|
||||
| ^^^^^^^^^^^^ F821
|
||||
72 | def foo[T: DoesNotExist](t: T) -> T: return t # F821: Undefined name `DoesNotExist`
|
||||
|
@ -88,14 +87,14 @@ F821_17.py:73:14: F821 Undefined name `DoesNotExist`
|
|||
72 | def foo[T: DoesNotExist](t: T) -> T: return t # F821: Undefined name `DoesNotExist`
|
||||
73 | class Foo[T: DoesNotExist](list[T]): ... # F821: Undefined name `DoesNotExist`
|
||||
| ^^^^^^^^^^^^ F821
|
||||
74 |
|
||||
74 |
|
||||
75 | type Foo[T: (DoesNotExist1, DoesNotExist2)] = T # F821: Undefined name `DoesNotExist1`, Undefined name `DoesNotExist2`
|
||||
|
|
||||
|
||||
F821_17.py:75:14: F821 Undefined name `DoesNotExist1`
|
||||
|
|
||||
73 | class Foo[T: DoesNotExist](list[T]): ... # F821: Undefined name `DoesNotExist`
|
||||
74 |
|
||||
74 |
|
||||
75 | type Foo[T: (DoesNotExist1, DoesNotExist2)] = T # F821: Undefined name `DoesNotExist1`, Undefined name `DoesNotExist2`
|
||||
| ^^^^^^^^^^^^^ F821
|
||||
76 | def foo[T: (DoesNotExist1, DoesNotExist2)](t: T) -> T: return t # F821: Undefined name `DoesNotExist1`, Undefined name `DoesNotExist2`
|
||||
|
@ -105,7 +104,7 @@ F821_17.py:75:14: F821 Undefined name `DoesNotExist1`
|
|||
F821_17.py:75:29: F821 Undefined name `DoesNotExist2`
|
||||
|
|
||||
73 | class Foo[T: DoesNotExist](list[T]): ... # F821: Undefined name `DoesNotExist`
|
||||
74 |
|
||||
74 |
|
||||
75 | type Foo[T: (DoesNotExist1, DoesNotExist2)] = T # F821: Undefined name `DoesNotExist1`, Undefined name `DoesNotExist2`
|
||||
| ^^^^^^^^^^^^^ F821
|
||||
76 | def foo[T: (DoesNotExist1, DoesNotExist2)](t: T) -> T: return t # F821: Undefined name `DoesNotExist1`, Undefined name `DoesNotExist2`
|
||||
|
@ -134,7 +133,7 @@ F821_17.py:77:15: F821 Undefined name `DoesNotExist1`
|
|||
76 | def foo[T: (DoesNotExist1, DoesNotExist2)](t: T) -> T: return t # F821: Undefined name `DoesNotExist1`, Undefined name `DoesNotExist2`
|
||||
77 | class Foo[T: (DoesNotExist1, DoesNotExist2)](list[T]): ... # F821: Undefined name `DoesNotExist1`, Undefined name `DoesNotExist2`
|
||||
| ^^^^^^^^^^^^^ F821
|
||||
78 |
|
||||
78 |
|
||||
79 | # Same in defaults
|
||||
|
|
||||
|
||||
|
@ -144,14 +143,14 @@ F821_17.py:77:30: F821 Undefined name `DoesNotExist2`
|
|||
76 | def foo[T: (DoesNotExist1, DoesNotExist2)](t: T) -> T: return t # F821: Undefined name `DoesNotExist1`, Undefined name `DoesNotExist2`
|
||||
77 | class Foo[T: (DoesNotExist1, DoesNotExist2)](list[T]): ... # F821: Undefined name `DoesNotExist1`, Undefined name `DoesNotExist2`
|
||||
| ^^^^^^^^^^^^^ F821
|
||||
78 |
|
||||
78 |
|
||||
79 | # Same in defaults
|
||||
|
|
||||
|
||||
F821_17.py:81:14: F821 Undefined name `DoesNotExist`
|
||||
|
|
||||
79 | # Same in defaults
|
||||
80 |
|
||||
80 |
|
||||
81 | type Foo[T = DoesNotExist] = T # F821: Undefined name `DoesNotExist`
|
||||
| ^^^^^^^^^^^^ F821
|
||||
82 | def foo[T = DoesNotExist](t: T) -> T: return t # F821: Undefined name `DoesNotExist`
|
||||
|
@ -172,34 +171,34 @@ F821_17.py:83:15: F821 Undefined name `DoesNotExist`
|
|||
82 | def foo[T = DoesNotExist](t: T) -> T: return t # F821: Undefined name `DoesNotExist`
|
||||
83 | class Foo[T = DoesNotExist](list[T]): ... # F821: Undefined name `DoesNotExist`
|
||||
| ^^^^^^^^^^^^ F821
|
||||
84 |
|
||||
84 |
|
||||
85 | type Foo[T = (DoesNotExist1, DoesNotExist2)] = T # F821: Undefined name `DoesNotExist1`, Undefined name `DoesNotExist2`
|
||||
|
|
||||
|
||||
F821_17.py:85:15: F821 Undefined name `DoesNotExist1`
|
||||
|
|
||||
83 | class Foo[T = DoesNotExist](list[T]): ... # F821: Undefined name `DoesNotExist`
|
||||
84 |
|
||||
84 |
|
||||
85 | type Foo[T = (DoesNotExist1, DoesNotExist2)] = T # F821: Undefined name `DoesNotExist1`, Undefined name `DoesNotExist2`
|
||||
| ^^^^^^^^^^^^^ F821
|
||||
86 | def foo[T = (DoesNotExist1, DoesNotExist2)](t: T) -> T: return t # F821: Undefined name `DoesNotExist1`, Undefined name `DoesNotExist2`
|
||||
86 | def foo[T = (DoesNotExist1, DoesNotExist2)](t: T) -> T: return t # F821: Undefined name `DoesNotExist1`, Undefined name `DoesNotExist…
|
||||
87 | class Foo[T = (DoesNotExist1, DoesNotExist2)](list[T]): ... # F821: Undefined name `DoesNotExist1`, Undefined name `DoesNotExist2`
|
||||
|
|
||||
|
||||
F821_17.py:85:30: F821 Undefined name `DoesNotExist2`
|
||||
|
|
||||
83 | class Foo[T = DoesNotExist](list[T]): ... # F821: Undefined name `DoesNotExist`
|
||||
84 |
|
||||
84 |
|
||||
85 | type Foo[T = (DoesNotExist1, DoesNotExist2)] = T # F821: Undefined name `DoesNotExist1`, Undefined name `DoesNotExist2`
|
||||
| ^^^^^^^^^^^^^ F821
|
||||
86 | def foo[T = (DoesNotExist1, DoesNotExist2)](t: T) -> T: return t # F821: Undefined name `DoesNotExist1`, Undefined name `DoesNotExist2`
|
||||
86 | def foo[T = (DoesNotExist1, DoesNotExist2)](t: T) -> T: return t # F821: Undefined name `DoesNotExist1`, Undefined name `DoesNotExist…
|
||||
87 | class Foo[T = (DoesNotExist1, DoesNotExist2)](list[T]): ... # F821: Undefined name `DoesNotExist1`, Undefined name `DoesNotExist2`
|
||||
|
|
||||
|
||||
F821_17.py:86:14: F821 Undefined name `DoesNotExist1`
|
||||
|
|
||||
85 | type Foo[T = (DoesNotExist1, DoesNotExist2)] = T # F821: Undefined name `DoesNotExist1`, Undefined name `DoesNotExist2`
|
||||
86 | def foo[T = (DoesNotExist1, DoesNotExist2)](t: T) -> T: return t # F821: Undefined name `DoesNotExist1`, Undefined name `DoesNotExist2`
|
||||
86 | def foo[T = (DoesNotExist1, DoesNotExist2)](t: T) -> T: return t # F821: Undefined name `DoesNotExist1`, Undefined name `DoesNotExist…
|
||||
| ^^^^^^^^^^^^^ F821
|
||||
87 | class Foo[T = (DoesNotExist1, DoesNotExist2)](list[T]): ... # F821: Undefined name `DoesNotExist1`, Undefined name `DoesNotExist2`
|
||||
|
|
||||
|
@ -207,7 +206,7 @@ F821_17.py:86:14: F821 Undefined name `DoesNotExist1`
|
|||
F821_17.py:86:29: F821 Undefined name `DoesNotExist2`
|
||||
|
|
||||
85 | type Foo[T = (DoesNotExist1, DoesNotExist2)] = T # F821: Undefined name `DoesNotExist1`, Undefined name `DoesNotExist2`
|
||||
86 | def foo[T = (DoesNotExist1, DoesNotExist2)](t: T) -> T: return t # F821: Undefined name `DoesNotExist1`, Undefined name `DoesNotExist2`
|
||||
86 | def foo[T = (DoesNotExist1, DoesNotExist2)](t: T) -> T: return t # F821: Undefined name `DoesNotExist1`, Undefined name `DoesNotExist…
|
||||
| ^^^^^^^^^^^^^ F821
|
||||
87 | class Foo[T = (DoesNotExist1, DoesNotExist2)](list[T]): ... # F821: Undefined name `DoesNotExist1`, Undefined name `DoesNotExist2`
|
||||
|
|
||||
|
@ -215,27 +214,27 @@ F821_17.py:86:29: F821 Undefined name `DoesNotExist2`
|
|||
F821_17.py:87:16: F821 Undefined name `DoesNotExist1`
|
||||
|
|
||||
85 | type Foo[T = (DoesNotExist1, DoesNotExist2)] = T # F821: Undefined name `DoesNotExist1`, Undefined name `DoesNotExist2`
|
||||
86 | def foo[T = (DoesNotExist1, DoesNotExist2)](t: T) -> T: return t # F821: Undefined name `DoesNotExist1`, Undefined name `DoesNotExist2`
|
||||
86 | def foo[T = (DoesNotExist1, DoesNotExist2)](t: T) -> T: return t # F821: Undefined name `DoesNotExist1`, Undefined name `DoesNotExist…
|
||||
87 | class Foo[T = (DoesNotExist1, DoesNotExist2)](list[T]): ... # F821: Undefined name `DoesNotExist1`, Undefined name `DoesNotExist2`
|
||||
| ^^^^^^^^^^^^^ F821
|
||||
88 |
|
||||
88 |
|
||||
89 | # Type parameters in nested classes
|
||||
|
|
||||
|
||||
F821_17.py:87:31: F821 Undefined name `DoesNotExist2`
|
||||
|
|
||||
85 | type Foo[T = (DoesNotExist1, DoesNotExist2)] = T # F821: Undefined name `DoesNotExist1`, Undefined name `DoesNotExist2`
|
||||
86 | def foo[T = (DoesNotExist1, DoesNotExist2)](t: T) -> T: return t # F821: Undefined name `DoesNotExist1`, Undefined name `DoesNotExist2`
|
||||
86 | def foo[T = (DoesNotExist1, DoesNotExist2)](t: T) -> T: return t # F821: Undefined name `DoesNotExist1`, Undefined name `DoesNotExist…
|
||||
87 | class Foo[T = (DoesNotExist1, DoesNotExist2)](list[T]): ... # F821: Undefined name `DoesNotExist1`, Undefined name `DoesNotExist2`
|
||||
| ^^^^^^^^^^^^^ F821
|
||||
88 |
|
||||
88 |
|
||||
89 | # Type parameters in nested classes
|
||||
|
|
||||
|
||||
F821_17.py:102:52: F821 Undefined name `t`
|
||||
|
|
||||
100 | return x
|
||||
101 |
|
||||
101 |
|
||||
102 | def cannot_access_parent_variable(self, x: t) -> t: # F821: Undefined name `T`
|
||||
| ^ F821
|
||||
103 | t # F821: Undefined name `t`
|
||||
|
@ -245,7 +244,7 @@ F821_17.py:102:52: F821 Undefined name `t`
|
|||
F821_17.py:102:58: F821 Undefined name `t`
|
||||
|
|
||||
100 | return x
|
||||
101 |
|
||||
101 |
|
||||
102 | def cannot_access_parent_variable(self, x: t) -> t: # F821: Undefined name `T`
|
||||
| ^ F821
|
||||
103 | t # F821: Undefined name `t`
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/rules/pylint/mod.rs
|
||||
snapshot_kind: text
|
||||
---
|
||||
too_many_boolean_expressions.py:11:6: PLR0916 Too many Boolean expressions (6 > 5)
|
||||
|
|
||||
|
@ -169,7 +168,7 @@ too_many_boolean_expressions.py:43:6: PLR0916 Too many Boolean expressions (22 >
|
|||
43 | elif (a and b) and c and d and e and f and g and h and i and j and k and l and m and n and o and p and q and r and s and t and u and v:
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PLR0916
|
||||
44 | ...
|
||||
45 | elif (a and b) and c and d and e and f and g and h and i and j and k and l and m and n and o and p and q and r and s and t and u and v and w:
|
||||
45 | elif (a and b) and c and d and e and f and g and h and i and j and k and l and m and n and o and p and q and r and s and t and u and v and …
|
||||
|
|
||||
|
||||
too_many_boolean_expressions.py:45:6: PLR0916 Too many Boolean expressions (23 > 5)
|
||||
|
@ -179,7 +178,7 @@ too_many_boolean_expressions.py:45:6: PLR0916 Too many Boolean expressions (23 >
|
|||
45 | elif (a and b) and c and d and e and f and g and h and i and j and k and l and m and n and o and p and q and r and s and t and u and v and w:
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PLR0916
|
||||
46 | ...
|
||||
47 | elif (a and b) and c and d and e and f and g and h and i and j and k and l and m and n and o and p and q and r and s and t and u and v and w and x:
|
||||
47 | elif (a and b) and c and d and e and f and g and h and i and j and k and l and m and n and o and p and q and r and s and t and u and v and w and …
|
||||
|
|
||||
|
||||
too_many_boolean_expressions.py:47:6: PLR0916 Too many Boolean expressions (24 > 5)
|
||||
|
@ -189,7 +188,7 @@ too_many_boolean_expressions.py:47:6: PLR0916 Too many Boolean expressions (24 >
|
|||
47 | elif (a and b) and c and d and e and f and g and h and i and j and k and l and m and n and o and p and q and r and s and t and u and v and w and x:
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PLR0916
|
||||
48 | ...
|
||||
49 | elif (a and b) and c and d and e and f and g and h and i and j and k and l and m and n and o and p and q and r and s and t and u and v and w and x and y:
|
||||
49 | elif (a and b) and c and d and e and f and g and h and i and j and k and l and m and n and o and p and q and r and s and t and u and v and w and x and …
|
||||
|
|
||||
|
||||
too_many_boolean_expressions.py:49:6: PLR0916 Too many Boolean expressions (25 > 5)
|
||||
|
@ -199,7 +198,7 @@ too_many_boolean_expressions.py:49:6: PLR0916 Too many Boolean expressions (25 >
|
|||
49 | elif (a and b) and c and d and e and f and g and h and i and j and k and l and m and n and o and p and q and r and s and t and u and v and w and x and y:
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PLR0916
|
||||
50 | ...
|
||||
51 | elif (a and b) and c and d and e and f and g and h and i and j and k and l and m and n and o and p and q and r and s and t and u and v and w and x and y and z:
|
||||
51 | elif (a and b) and c and d and e and f and g and h and i and j and k and l and m and n and o and p and q and r and s and t and u and v and w and x and y and …
|
||||
|
|
||||
|
||||
too_many_boolean_expressions.py:51:6: PLR0916 Too many Boolean expressions (26 > 5)
|
||||
|
|
|
@ -6,7 +6,7 @@ UP031_0.py:4:7: UP031 [*] Use format specifiers instead of percent format
|
|||
3 | # UP031
|
||||
4 | print('%s %s' % (a, b))
|
||||
| ^^^^^^^^^^^^^^^^ UP031
|
||||
5 |
|
||||
5 |
|
||||
6 | print('%s%s' % (a, b))
|
||||
|
|
||||
= help: Replace with format specifiers
|
||||
|
@ -24,10 +24,10 @@ UP031_0.py:4:7: UP031 [*] Use format specifiers instead of percent format
|
|||
UP031_0.py:6:7: UP031 [*] Use format specifiers instead of percent format
|
||||
|
|
||||
4 | print('%s %s' % (a, b))
|
||||
5 |
|
||||
5 |
|
||||
6 | print('%s%s' % (a, b))
|
||||
| ^^^^^^^^^^^^^^^ UP031
|
||||
7 |
|
||||
7 |
|
||||
8 | print("trivial" % ())
|
||||
|
|
||||
= help: Replace with format specifiers
|
||||
|
@ -45,10 +45,10 @@ UP031_0.py:6:7: UP031 [*] Use format specifiers instead of percent format
|
|||
UP031_0.py:8:7: UP031 [*] Use format specifiers instead of percent format
|
||||
|
|
||||
6 | print('%s%s' % (a, b))
|
||||
7 |
|
||||
7 |
|
||||
8 | print("trivial" % ())
|
||||
| ^^^^^^^^^^^^^^ UP031
|
||||
9 |
|
||||
9 |
|
||||
10 | print("%s" % ("simple",))
|
||||
|
|
||||
= help: Replace with format specifiers
|
||||
|
@ -66,10 +66,10 @@ UP031_0.py:8:7: UP031 [*] Use format specifiers instead of percent format
|
|||
UP031_0.py:10:7: UP031 [*] Use format specifiers instead of percent format
|
||||
|
|
||||
8 | print("trivial" % ())
|
||||
9 |
|
||||
9 |
|
||||
10 | print("%s" % ("simple",))
|
||||
| ^^^^^^^^^^^^^^^^^^ UP031
|
||||
11 |
|
||||
11 |
|
||||
12 | print("%s" % ("%s" % ("nested",),))
|
||||
|
|
||||
= help: Replace with format specifiers
|
||||
|
@ -87,10 +87,10 @@ UP031_0.py:10:7: UP031 [*] Use format specifiers instead of percent format
|
|||
UP031_0.py:12:7: UP031 [*] Use format specifiers instead of percent format
|
||||
|
|
||||
10 | print("%s" % ("simple",))
|
||||
11 |
|
||||
11 |
|
||||
12 | print("%s" % ("%s" % ("nested",),))
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP031
|
||||
13 |
|
||||
13 |
|
||||
14 | print("%s%% percent" % (15,))
|
||||
|
|
||||
= help: Replace with format specifiers
|
||||
|
@ -108,10 +108,10 @@ UP031_0.py:12:7: UP031 [*] Use format specifiers instead of percent format
|
|||
UP031_0.py:12:15: UP031 [*] Use format specifiers instead of percent format
|
||||
|
|
||||
10 | print("%s" % ("simple",))
|
||||
11 |
|
||||
11 |
|
||||
12 | print("%s" % ("%s" % ("nested",),))
|
||||
| ^^^^^^^^^^^^^^^^^^ UP031
|
||||
13 |
|
||||
13 |
|
||||
14 | print("%s%% percent" % (15,))
|
||||
|
|
||||
= help: Replace with format specifiers
|
||||
|
@ -129,10 +129,10 @@ UP031_0.py:12:15: UP031 [*] Use format specifiers instead of percent format
|
|||
UP031_0.py:14:7: UP031 [*] Use format specifiers instead of percent format
|
||||
|
|
||||
12 | print("%s" % ("%s" % ("nested",),))
|
||||
13 |
|
||||
13 |
|
||||
14 | print("%s%% percent" % (15,))
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ UP031
|
||||
15 |
|
||||
15 |
|
||||
16 | print("%f" % (15,))
|
||||
|
|
||||
= help: Replace with format specifiers
|
||||
|
@ -150,10 +150,10 @@ UP031_0.py:14:7: UP031 [*] Use format specifiers instead of percent format
|
|||
UP031_0.py:16:7: UP031 [*] Use format specifiers instead of percent format
|
||||
|
|
||||
14 | print("%s%% percent" % (15,))
|
||||
15 |
|
||||
15 |
|
||||
16 | print("%f" % (15,))
|
||||
| ^^^^^^^^^^^^ UP031
|
||||
17 |
|
||||
17 |
|
||||
18 | print("%.f" % (15,))
|
||||
|
|
||||
= help: Replace with format specifiers
|
||||
|
@ -171,10 +171,10 @@ UP031_0.py:16:7: UP031 [*] Use format specifiers instead of percent format
|
|||
UP031_0.py:18:7: UP031 [*] Use format specifiers instead of percent format
|
||||
|
|
||||
16 | print("%f" % (15,))
|
||||
17 |
|
||||
17 |
|
||||
18 | print("%.f" % (15,))
|
||||
| ^^^^^^^^^^^^^ UP031
|
||||
19 |
|
||||
19 |
|
||||
20 | print("%.3f" % (15,))
|
||||
|
|
||||
= help: Replace with format specifiers
|
||||
|
@ -192,10 +192,10 @@ UP031_0.py:18:7: UP031 [*] Use format specifiers instead of percent format
|
|||
UP031_0.py:20:7: UP031 [*] Use format specifiers instead of percent format
|
||||
|
|
||||
18 | print("%.f" % (15,))
|
||||
19 |
|
||||
19 |
|
||||
20 | print("%.3f" % (15,))
|
||||
| ^^^^^^^^^^^^^^ UP031
|
||||
21 |
|
||||
21 |
|
||||
22 | print("%3f" % (15,))
|
||||
|
|
||||
= help: Replace with format specifiers
|
||||
|
@ -213,10 +213,10 @@ UP031_0.py:20:7: UP031 [*] Use format specifiers instead of percent format
|
|||
UP031_0.py:22:7: UP031 [*] Use format specifiers instead of percent format
|
||||
|
|
||||
20 | print("%.3f" % (15,))
|
||||
21 |
|
||||
21 |
|
||||
22 | print("%3f" % (15,))
|
||||
| ^^^^^^^^^^^^^ UP031
|
||||
23 |
|
||||
23 |
|
||||
24 | print("%-5f" % (5,))
|
||||
|
|
||||
= help: Replace with format specifiers
|
||||
|
@ -234,10 +234,10 @@ UP031_0.py:22:7: UP031 [*] Use format specifiers instead of percent format
|
|||
UP031_0.py:24:7: UP031 [*] Use format specifiers instead of percent format
|
||||
|
|
||||
22 | print("%3f" % (15,))
|
||||
23 |
|
||||
23 |
|
||||
24 | print("%-5f" % (5,))
|
||||
| ^^^^^^^^^^^^^ UP031
|
||||
25 |
|
||||
25 |
|
||||
26 | print("%9f" % (5,))
|
||||
|
|
||||
= help: Replace with format specifiers
|
||||
|
@ -255,10 +255,10 @@ UP031_0.py:24:7: UP031 [*] Use format specifiers instead of percent format
|
|||
UP031_0.py:26:7: UP031 [*] Use format specifiers instead of percent format
|
||||
|
|
||||
24 | print("%-5f" % (5,))
|
||||
25 |
|
||||
25 |
|
||||
26 | print("%9f" % (5,))
|
||||
| ^^^^^^^^^^^^ UP031
|
||||
27 |
|
||||
27 |
|
||||
28 | print("%#o" % (123,))
|
||||
|
|
||||
= help: Replace with format specifiers
|
||||
|
@ -276,10 +276,10 @@ UP031_0.py:26:7: UP031 [*] Use format specifiers instead of percent format
|
|||
UP031_0.py:28:7: UP031 [*] Use format specifiers instead of percent format
|
||||
|
|
||||
26 | print("%9f" % (5,))
|
||||
27 |
|
||||
27 |
|
||||
28 | print("%#o" % (123,))
|
||||
| ^^^^^^^^^^^^^^ UP031
|
||||
29 |
|
||||
29 |
|
||||
30 | print("brace {} %s" % (1,))
|
||||
|
|
||||
= help: Replace with format specifiers
|
||||
|
@ -297,10 +297,10 @@ UP031_0.py:28:7: UP031 [*] Use format specifiers instead of percent format
|
|||
UP031_0.py:30:7: UP031 [*] Use format specifiers instead of percent format
|
||||
|
|
||||
28 | print("%#o" % (123,))
|
||||
29 |
|
||||
29 |
|
||||
30 | print("brace {} %s" % (1,))
|
||||
| ^^^^^^^^^^^^^^^^^^^^ UP031
|
||||
31 |
|
||||
31 |
|
||||
32 | print((
|
||||
|
|
||||
= help: Replace with format specifiers
|
||||
|
@ -318,8 +318,7 @@ UP031_0.py:30:7: UP031 [*] Use format specifiers instead of percent format
|
|||
UP031_0.py:33:5: UP031 [*] Use format specifiers instead of percent format
|
||||
|
|
||||
32 | print((
|
||||
33 | "foo %s "
|
||||
| _____^
|
||||
33 | / "foo %s "
|
||||
34 | | "bar %s" % (x, y)
|
||||
| |_____________________^ UP031
|
||||
35 | ))
|
||||
|
@ -341,8 +340,7 @@ UP031_0.py:33:5: UP031 [*] Use format specifiers instead of percent format
|
|||
UP031_0.py:38:3: UP031 [*] Use format specifiers instead of percent format
|
||||
|
|
||||
37 | print(
|
||||
38 | "%s" % (
|
||||
| ___^
|
||||
38 | / "%s" % (
|
||||
39 | | "trailing comma",
|
||||
40 | | )
|
||||
| |_________^ UP031
|
||||
|
@ -363,10 +361,10 @@ UP031_0.py:38:3: UP031 [*] Use format specifiers instead of percent format
|
|||
UP031_0.py:43:7: UP031 [*] Use format specifiers instead of percent format
|
||||
|
|
||||
41 | )
|
||||
42 |
|
||||
42 |
|
||||
43 | print("foo %s " % (x,))
|
||||
| ^^^^^^^^^^^^^^^^ UP031
|
||||
44 |
|
||||
44 |
|
||||
45 | print("%(k)s" % {"k": "v"})
|
||||
|
|
||||
= help: Replace with format specifiers
|
||||
|
@ -384,10 +382,10 @@ UP031_0.py:43:7: UP031 [*] Use format specifiers instead of percent format
|
|||
UP031_0.py:45:7: UP031 [*] Use format specifiers instead of percent format
|
||||
|
|
||||
43 | print("foo %s " % (x,))
|
||||
44 |
|
||||
44 |
|
||||
45 | print("%(k)s" % {"k": "v"})
|
||||
| ^^^^^^^^^^^^^^^^^^^^ UP031
|
||||
46 |
|
||||
46 |
|
||||
47 | print("%(k)s" % {
|
||||
|
|
||||
= help: Replace with format specifiers
|
||||
|
@ -405,14 +403,14 @@ UP031_0.py:45:7: UP031 [*] Use format specifiers instead of percent format
|
|||
UP031_0.py:47:7: UP031 [*] Use format specifiers instead of percent format
|
||||
|
|
||||
45 | print("%(k)s" % {"k": "v"})
|
||||
46 |
|
||||
46 |
|
||||
47 | print("%(k)s" % {
|
||||
| _______^
|
||||
48 | | "k": "v",
|
||||
49 | | "i": "j"
|
||||
50 | | })
|
||||
| |_^ UP031
|
||||
51 |
|
||||
51 |
|
||||
52 | print("%(to_list)s" % {"to_list": []})
|
||||
|
|
||||
= help: Replace with format specifiers
|
||||
|
@ -436,10 +434,10 @@ UP031_0.py:47:7: UP031 [*] Use format specifiers instead of percent format
|
|||
UP031_0.py:52:7: UP031 [*] Use format specifiers instead of percent format
|
||||
|
|
||||
50 | })
|
||||
51 |
|
||||
51 |
|
||||
52 | print("%(to_list)s" % {"to_list": []})
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP031
|
||||
53 |
|
||||
53 |
|
||||
54 | print("%(k)s" % {"k": "v", "i": 1, "j": []})
|
||||
|
|
||||
= help: Replace with format specifiers
|
||||
|
@ -457,10 +455,10 @@ UP031_0.py:52:7: UP031 [*] Use format specifiers instead of percent format
|
|||
UP031_0.py:54:7: UP031 [*] Use format specifiers instead of percent format
|
||||
|
|
||||
52 | print("%(to_list)s" % {"to_list": []})
|
||||
53 |
|
||||
53 |
|
||||
54 | print("%(k)s" % {"k": "v", "i": 1, "j": []})
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP031
|
||||
55 |
|
||||
55 |
|
||||
56 | print("%(ab)s" % {"a" "b": 1})
|
||||
|
|
||||
= help: Replace with format specifiers
|
||||
|
@ -478,10 +476,10 @@ UP031_0.py:54:7: UP031 [*] Use format specifiers instead of percent format
|
|||
UP031_0.py:56:7: UP031 [*] Use format specifiers instead of percent format
|
||||
|
|
||||
54 | print("%(k)s" % {"k": "v", "i": 1, "j": []})
|
||||
55 |
|
||||
55 |
|
||||
56 | print("%(ab)s" % {"a" "b": 1})
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ UP031
|
||||
57 |
|
||||
57 |
|
||||
58 | print("%(a)s" % {"a" : 1})
|
||||
|
|
||||
= help: Replace with format specifiers
|
||||
|
@ -499,7 +497,7 @@ UP031_0.py:56:7: UP031 [*] Use format specifiers instead of percent format
|
|||
UP031_0.py:58:7: UP031 [*] Use format specifiers instead of percent format
|
||||
|
|
||||
56 | print("%(ab)s" % {"a" "b": 1})
|
||||
57 |
|
||||
57 |
|
||||
58 | print("%(a)s" % {"a" : 1})
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ UP031
|
||||
|
|
||||
|
@ -518,8 +516,7 @@ UP031_0.py:58:7: UP031 [*] Use format specifiers instead of percent format
|
|||
UP031_0.py:62:5: UP031 [*] Use format specifiers instead of percent format
|
||||
|
|
||||
61 | print(
|
||||
62 | "foo %(foo)s "
|
||||
| _____^
|
||||
62 | / "foo %(foo)s "
|
||||
63 | | "bar %(bar)s" % {"foo": x, "bar": y}
|
||||
| |________________________________________^ UP031
|
||||
64 | )
|
||||
|
@ -542,8 +539,7 @@ UP031_0.py:68:5: UP031 [*] Use format specifiers instead of percent format
|
|||
|
|
||||
66 | bar = {"bar": y}
|
||||
67 | print(
|
||||
68 | "foo %(foo)s "
|
||||
| _____^
|
||||
68 | / "foo %(foo)s "
|
||||
69 | | "bar %(bar)s" % {"foo": x, **bar}
|
||||
| |_____________________________________^ UP031
|
||||
70 | )
|
||||
|
@ -565,10 +561,10 @@ UP031_0.py:68:5: UP031 [*] Use format specifiers instead of percent format
|
|||
UP031_0.py:72:7: UP031 [*] Use format specifiers instead of percent format
|
||||
|
|
||||
70 | )
|
||||
71 |
|
||||
71 |
|
||||
72 | print("%s \N{snowman}" % (a,))
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ UP031
|
||||
73 |
|
||||
73 |
|
||||
74 | print("%(foo)s \N{snowman}" % {"foo": 1})
|
||||
|
|
||||
= help: Replace with format specifiers
|
||||
|
@ -586,10 +582,10 @@ UP031_0.py:72:7: UP031 [*] Use format specifiers instead of percent format
|
|||
UP031_0.py:74:7: UP031 [*] Use format specifiers instead of percent format
|
||||
|
|
||||
72 | print("%s \N{snowman}" % (a,))
|
||||
73 |
|
||||
73 |
|
||||
74 | print("%(foo)s \N{snowman}" % {"foo": 1})
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP031
|
||||
75 |
|
||||
75 |
|
||||
76 | print(("foo %s " "bar %s") % (x, y))
|
||||
|
|
||||
= help: Replace with format specifiers
|
||||
|
@ -607,10 +603,10 @@ UP031_0.py:74:7: UP031 [*] Use format specifiers instead of percent format
|
|||
UP031_0.py:76:7: UP031 [*] Use format specifiers instead of percent format
|
||||
|
|
||||
74 | print("%(foo)s \N{snowman}" % {"foo": 1})
|
||||
75 |
|
||||
75 |
|
||||
76 | print(("foo %s " "bar %s") % (x, y))
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP031
|
||||
77 |
|
||||
77 |
|
||||
78 | # Single-value expressions
|
||||
|
|
||||
= help: Replace with format specifiers
|
||||
|
@ -776,7 +772,7 @@ UP031_0.py:86:7: UP031 [*] Use format specifiers instead of percent format
|
|||
85 | print('Hello %(arg)s' % bar.baz)
|
||||
86 | print('Hello %(arg)s' % bar['bop'])
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP031
|
||||
87 |
|
||||
87 |
|
||||
88 | # Hanging modulos
|
||||
|
|
||||
= help: Replace with format specifiers
|
||||
|
@ -799,7 +795,7 @@ UP031_0.py:89:1: UP031 [*] Use format specifiers instead of percent format
|
|||
91 | | "bar %s"
|
||||
92 | | ) % (x, y)
|
||||
| |__________^ UP031
|
||||
93 |
|
||||
93 |
|
||||
94 | (
|
||||
|
|
||||
= help: Replace with format specifiers
|
||||
|
@ -821,13 +817,13 @@ UP031_0.py:89:1: UP031 [*] Use format specifiers instead of percent format
|
|||
UP031_0.py:94:1: UP031 [*] Use format specifiers instead of percent format
|
||||
|
|
||||
92 | ) % (x, y)
|
||||
93 |
|
||||
93 |
|
||||
94 | / (
|
||||
95 | | "foo %(foo)s "
|
||||
96 | | "bar %(bar)s"
|
||||
97 | | ) % {"foo": x, "bar": y}
|
||||
| |________________________^ UP031
|
||||
98 |
|
||||
98 |
|
||||
99 | (
|
||||
|
|
||||
= help: Replace with format specifiers
|
||||
|
@ -849,8 +845,7 @@ UP031_0.py:94:1: UP031 [*] Use format specifiers instead of percent format
|
|||
UP031_0.py:100:5: UP031 [*] Use format specifiers instead of percent format
|
||||
|
|
||||
99 | (
|
||||
100 | """foo %s"""
|
||||
| _____^
|
||||
100 | / """foo %s"""
|
||||
101 | | % (x,)
|
||||
| |__________^ UP031
|
||||
102 | )
|
||||
|
@ -871,8 +866,7 @@ UP031_0.py:100:5: UP031 [*] Use format specifiers instead of percent format
|
|||
UP031_0.py:105:5: UP031 [*] Use format specifiers instead of percent format
|
||||
|
|
||||
104 | (
|
||||
105 | """
|
||||
| _____^
|
||||
105 | / """
|
||||
106 | | foo %s
|
||||
107 | | """
|
||||
108 | | % (x,)
|
||||
|
@ -897,7 +891,7 @@ UP031_0.py:105:5: UP031 [*] Use format specifiers instead of percent format
|
|||
UP031_0.py:111:1: UP031 [*] Use format specifiers instead of percent format
|
||||
|
|
||||
109 | )
|
||||
110 |
|
||||
110 |
|
||||
111 | / "%s" % (
|
||||
112 | | x, # comment
|
||||
113 | | )
|
||||
|
@ -919,12 +913,12 @@ UP031_0.py:116:8: UP031 [*] Use format specifiers instead of percent format
|
|||
|
|
||||
116 | path = "%s-%s-%s.pem" % (
|
||||
| ________^
|
||||
117 | | safe_domain_name(cn), # common name, which should be filename safe because it is IDNA-encoded, but in case of a malformed cert make sure it's ok to use as a filename
|
||||
117 | | safe_domain_name(cn), # common name, which should be filename safe because it is IDNA-encoded, but in case of a malformed cert ma…
|
||||
118 | | cert.not_valid_after.date().isoformat().replace("-", ""), # expiration date
|
||||
119 | | hexlify(cert.fingerprint(hashes.SHA256())).decode("ascii")[0:8], # fingerprint prefix
|
||||
120 | | )
|
||||
| |_^ UP031
|
||||
121 |
|
||||
121 |
|
||||
122 | # UP031 (no longer false negatives; now offer potentially unsafe fixes)
|
||||
|
|
||||
= help: Replace with format specifiers
|
||||
|
@ -944,7 +938,7 @@ UP031_0.py:123:1: UP031 [*] Use format specifiers instead of percent format
|
|||
122 | # UP031 (no longer false negatives; now offer potentially unsafe fixes)
|
||||
123 | 'Hello %s' % bar
|
||||
| ^^^^^^^^^^^^^^^^ UP031
|
||||
124 |
|
||||
124 |
|
||||
125 | 'Hello %s' % bar.baz
|
||||
|
|
||||
= help: Replace with format specifiers
|
||||
|
@ -962,10 +956,10 @@ UP031_0.py:123:1: UP031 [*] Use format specifiers instead of percent format
|
|||
UP031_0.py:125:1: UP031 [*] Use format specifiers instead of percent format
|
||||
|
|
||||
123 | 'Hello %s' % bar
|
||||
124 |
|
||||
124 |
|
||||
125 | 'Hello %s' % bar.baz
|
||||
| ^^^^^^^^^^^^^^^^^^^^ UP031
|
||||
126 |
|
||||
126 |
|
||||
127 | 'Hello %s' % bar['bop']
|
||||
|
|
||||
= help: Replace with format specifiers
|
||||
|
@ -983,10 +977,10 @@ UP031_0.py:125:1: UP031 [*] Use format specifiers instead of percent format
|
|||
UP031_0.py:127:1: UP031 [*] Use format specifiers instead of percent format
|
||||
|
|
||||
125 | 'Hello %s' % bar.baz
|
||||
126 |
|
||||
126 |
|
||||
127 | 'Hello %s' % bar['bop']
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ UP031
|
||||
128 |
|
||||
128 |
|
||||
129 | # Not a valid type annotation but this test shouldn't result in a panic.
|
||||
|
|
||||
= help: Replace with format specifiers
|
||||
|
@ -1007,7 +1001,7 @@ UP031_0.py:131:5: UP031 [*] Use format specifiers instead of percent format
|
|||
130 | # Refer: https://github.com/astral-sh/ruff/issues/11736
|
||||
131 | x: "'%s + %s' % (1, 2)"
|
||||
| ^^^^^^^^^^^^^^^^^^ UP031
|
||||
132 |
|
||||
132 |
|
||||
133 | # See: https://github.com/astral-sh/ruff/issues/12421
|
||||
|
|
||||
= help: Replace with format specifiers
|
||||
|
@ -1110,7 +1104,7 @@ UP031_0.py:138:7: UP031 [*] Use format specifiers instead of percent format
|
|||
137 | print("%.00002X" % 1)
|
||||
138 | print("%.20X" % 1)
|
||||
| ^^^^^^^^^^^ UP031
|
||||
139 |
|
||||
139 |
|
||||
140 | print("%2X" % 1)
|
||||
|
|
||||
= help: Replace with format specifiers
|
||||
|
@ -1128,7 +1122,7 @@ UP031_0.py:138:7: UP031 [*] Use format specifiers instead of percent format
|
|||
UP031_0.py:140:7: UP031 [*] Use format specifiers instead of percent format
|
||||
|
|
||||
138 | print("%.20X" % 1)
|
||||
139 |
|
||||
139 |
|
||||
140 | print("%2X" % 1)
|
||||
| ^^^^^^^^^ UP031
|
||||
141 | print("%02X" % 1)
|
||||
|
@ -1150,7 +1144,7 @@ UP031_0.py:141:7: UP031 [*] Use format specifiers instead of percent format
|
|||
140 | print("%2X" % 1)
|
||||
141 | print("%02X" % 1)
|
||||
| ^^^^^^^^^^ UP031
|
||||
142 |
|
||||
142 |
|
||||
143 | # UP031 (no longer false negatives, but offer no fix because of more complex syntax)
|
||||
|
|
||||
= help: Replace with format specifiers
|
||||
|
@ -1168,10 +1162,10 @@ UP031_0.py:141:7: UP031 [*] Use format specifiers instead of percent format
|
|||
UP031_0.py:145:1: UP031 Use format specifiers instead of percent format
|
||||
|
|
||||
143 | # UP031 (no longer false negatives, but offer no fix because of more complex syntax)
|
||||
144 |
|
||||
144 |
|
||||
145 | "%d.%d" % (a, b)
|
||||
| ^^^^^^^ UP031
|
||||
146 |
|
||||
146 |
|
||||
147 | "%*s" % (5, "hi")
|
||||
|
|
||||
= help: Replace with format specifiers
|
||||
|
@ -1179,10 +1173,10 @@ UP031_0.py:145:1: UP031 Use format specifiers instead of percent format
|
|||
UP031_0.py:147:1: UP031 Use format specifiers instead of percent format
|
||||
|
|
||||
145 | "%d.%d" % (a, b)
|
||||
146 |
|
||||
146 |
|
||||
147 | "%*s" % (5, "hi")
|
||||
| ^^^^^ UP031
|
||||
148 |
|
||||
148 |
|
||||
149 | "%d" % (flt,)
|
||||
|
|
||||
= help: Replace with format specifiers
|
||||
|
@ -1190,10 +1184,10 @@ UP031_0.py:147:1: UP031 Use format specifiers instead of percent format
|
|||
UP031_0.py:149:1: UP031 Use format specifiers instead of percent format
|
||||
|
|
||||
147 | "%*s" % (5, "hi")
|
||||
148 |
|
||||
148 |
|
||||
149 | "%d" % (flt,)
|
||||
| ^^^^ UP031
|
||||
150 |
|
||||
150 |
|
||||
151 | "%c" % (some_string,)
|
||||
|
|
||||
= help: Replace with format specifiers
|
||||
|
@ -1201,10 +1195,10 @@ UP031_0.py:149:1: UP031 Use format specifiers instead of percent format
|
|||
UP031_0.py:151:1: UP031 Use format specifiers instead of percent format
|
||||
|
|
||||
149 | "%d" % (flt,)
|
||||
150 |
|
||||
150 |
|
||||
151 | "%c" % (some_string,)
|
||||
| ^^^^ UP031
|
||||
152 |
|
||||
152 |
|
||||
153 | "%.2r" % (1.25)
|
||||
|
|
||||
= help: Replace with format specifiers
|
||||
|
@ -1212,10 +1206,10 @@ UP031_0.py:151:1: UP031 Use format specifiers instead of percent format
|
|||
UP031_0.py:153:1: UP031 Use format specifiers instead of percent format
|
||||
|
|
||||
151 | "%c" % (some_string,)
|
||||
152 |
|
||||
152 |
|
||||
153 | "%.2r" % (1.25)
|
||||
| ^^^^^^ UP031
|
||||
154 |
|
||||
154 |
|
||||
155 | "%.*s" % (5, "hi")
|
||||
|
|
||||
= help: Replace with format specifiers
|
||||
|
@ -1223,10 +1217,10 @@ UP031_0.py:153:1: UP031 Use format specifiers instead of percent format
|
|||
UP031_0.py:155:1: UP031 Use format specifiers instead of percent format
|
||||
|
|
||||
153 | "%.2r" % (1.25)
|
||||
154 |
|
||||
154 |
|
||||
155 | "%.*s" % (5, "hi")
|
||||
| ^^^^^^ UP031
|
||||
156 |
|
||||
156 |
|
||||
157 | "%i" % (flt,)
|
||||
|
|
||||
= help: Replace with format specifiers
|
||||
|
@ -1234,10 +1228,10 @@ UP031_0.py:155:1: UP031 Use format specifiers instead of percent format
|
|||
UP031_0.py:157:1: UP031 Use format specifiers instead of percent format
|
||||
|
|
||||
155 | "%.*s" % (5, "hi")
|
||||
156 |
|
||||
156 |
|
||||
157 | "%i" % (flt,)
|
||||
| ^^^^ UP031
|
||||
158 |
|
||||
158 |
|
||||
159 | "%()s" % {"": "empty"}
|
||||
|
|
||||
= help: Replace with format specifiers
|
||||
|
@ -1245,10 +1239,10 @@ UP031_0.py:157:1: UP031 Use format specifiers instead of percent format
|
|||
UP031_0.py:159:1: UP031 Use format specifiers instead of percent format
|
||||
|
|
||||
157 | "%i" % (flt,)
|
||||
158 |
|
||||
158 |
|
||||
159 | "%()s" % {"": "empty"}
|
||||
| ^^^^^^ UP031
|
||||
160 |
|
||||
160 |
|
||||
161 | "%s" % {"k": "v"}
|
||||
|
|
||||
= help: Replace with format specifiers
|
||||
|
@ -1256,10 +1250,10 @@ UP031_0.py:159:1: UP031 Use format specifiers instead of percent format
|
|||
UP031_0.py:161:1: UP031 Use format specifiers instead of percent format
|
||||
|
|
||||
159 | "%()s" % {"": "empty"}
|
||||
160 |
|
||||
160 |
|
||||
161 | "%s" % {"k": "v"}
|
||||
| ^^^^ UP031
|
||||
162 |
|
||||
162 |
|
||||
163 | "%()s" % {"": "bar"}
|
||||
|
|
||||
= help: Replace with format specifiers
|
||||
|
@ -1267,10 +1261,10 @@ UP031_0.py:161:1: UP031 Use format specifiers instead of percent format
|
|||
UP031_0.py:163:1: UP031 Use format specifiers instead of percent format
|
||||
|
|
||||
161 | "%s" % {"k": "v"}
|
||||
162 |
|
||||
162 |
|
||||
163 | "%()s" % {"": "bar"}
|
||||
| ^^^^^^ UP031
|
||||
164 |
|
||||
164 |
|
||||
165 | "%(1)s" % {"1": "bar"}
|
||||
|
|
||||
= help: Replace with format specifiers
|
||||
|
@ -1278,10 +1272,10 @@ UP031_0.py:163:1: UP031 Use format specifiers instead of percent format
|
|||
UP031_0.py:165:1: UP031 Use format specifiers instead of percent format
|
||||
|
|
||||
163 | "%()s" % {"": "bar"}
|
||||
164 |
|
||||
164 |
|
||||
165 | "%(1)s" % {"1": "bar"}
|
||||
| ^^^^^^^ UP031
|
||||
166 |
|
||||
166 |
|
||||
167 | "%(a)s" % {"a": 1, "a": 2}
|
||||
|
|
||||
= help: Replace with format specifiers
|
||||
|
@ -1289,10 +1283,10 @@ UP031_0.py:165:1: UP031 Use format specifiers instead of percent format
|
|||
UP031_0.py:167:1: UP031 Use format specifiers instead of percent format
|
||||
|
|
||||
165 | "%(1)s" % {"1": "bar"}
|
||||
166 |
|
||||
166 |
|
||||
167 | "%(a)s" % {"a": 1, "a": 2}
|
||||
| ^^^^^^^ UP031
|
||||
168 |
|
||||
168 |
|
||||
169 | "%(1)s" % {1: 2, "1": 2}
|
||||
|
|
||||
= help: Replace with format specifiers
|
||||
|
@ -1300,10 +1294,10 @@ UP031_0.py:167:1: UP031 Use format specifiers instead of percent format
|
|||
UP031_0.py:169:1: UP031 Use format specifiers instead of percent format
|
||||
|
|
||||
167 | "%(a)s" % {"a": 1, "a": 2}
|
||||
168 |
|
||||
168 |
|
||||
169 | "%(1)s" % {1: 2, "1": 2}
|
||||
| ^^^^^^^ UP031
|
||||
170 |
|
||||
170 |
|
||||
171 | "%(and)s" % {"and": 2}
|
||||
|
|
||||
= help: Replace with format specifiers
|
||||
|
@ -1311,7 +1305,7 @@ UP031_0.py:169:1: UP031 Use format specifiers instead of percent format
|
|||
UP031_0.py:171:1: UP031 Use format specifiers instead of percent format
|
||||
|
|
||||
169 | "%(1)s" % {1: 2, "1": 2}
|
||||
170 |
|
||||
170 |
|
||||
171 | "%(and)s" % {"and": 2}
|
||||
| ^^^^^^^^^ UP031
|
||||
|
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue