lint snapshots: Use filename only to avoid platform specific separators (#3930)

This commit is contained in:
Micha Reiser 2023-04-11 11:40:51 +02:00 committed by GitHub
parent e8aebee3f6
commit 61200d2171
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
728 changed files with 3832 additions and 3832 deletions

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/eradicate/mod.rs
---
./resources/test/fixtures/eradicate/ERA001.py:1:1: ERA001 [*] Found commented-out code
ERA001.py:1:1: ERA001 [*] Found commented-out code
|
1 | #import os
| ^^^^^^^^^^ ERA001
@ -16,7 +16,7 @@ source: crates/ruff/src/rules/eradicate/mod.rs
3 2 | #a = 3
4 3 | a = 4
./resources/test/fixtures/eradicate/ERA001.py:2:1: ERA001 [*] Found commented-out code
ERA001.py:2:1: ERA001 [*] Found commented-out code
|
2 | #import os
3 | # from foo import junk
@ -33,7 +33,7 @@ source: crates/ruff/src/rules/eradicate/mod.rs
4 3 | a = 4
5 4 | #foo(1, 2, 3)
./resources/test/fixtures/eradicate/ERA001.py:3:1: ERA001 [*] Found commented-out code
ERA001.py:3:1: ERA001 [*] Found commented-out code
|
3 | #import os
4 | # from foo import junk
@ -52,7 +52,7 @@ source: crates/ruff/src/rules/eradicate/mod.rs
5 4 | #foo(1, 2, 3)
6 5 |
./resources/test/fixtures/eradicate/ERA001.py:5:1: ERA001 [*] Found commented-out code
ERA001.py:5:1: ERA001 [*] Found commented-out code
|
5 | #a = 3
6 | a = 4
@ -72,7 +72,7 @@ source: crates/ruff/src/rules/eradicate/mod.rs
7 6 | def foo(x, y, z):
8 7 | content = 1 # print('hello')
./resources/test/fixtures/eradicate/ERA001.py:12:5: ERA001 [*] Found commented-out code
ERA001.py:12:5: ERA001 [*] Found commented-out code
|
12 | # This is a real comment.
13 | #return True

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_2020/mod.rs
---
./resources/test/fixtures/flake8_2020/YTT101.py:6:7: YTT101 `sys.version[:3]` referenced (python3.10), use `sys.version_info`
YTT101.py:6:7: YTT101 `sys.version[:3]` referenced (python3.10), use `sys.version_info`
|
6 | print(sys.version)
7 |
@ -11,7 +11,7 @@ source: crates/ruff/src/rules/flake8_2020/mod.rs
10 | print(v[:3])
|
./resources/test/fixtures/flake8_2020/YTT101.py:7:7: YTT101 `sys.version[:3]` referenced (python3.10), use `sys.version_info`
YTT101.py:7:7: YTT101 `sys.version[:3]` referenced (python3.10), use `sys.version_info`
|
7 | print(sys.version[:3])
8 | print(version[:3])
@ -19,7 +19,7 @@ source: crates/ruff/src/rules/flake8_2020/mod.rs
9 | print(v[:3])
|
./resources/test/fixtures/flake8_2020/YTT101.py:8:7: YTT101 `sys.version[:3]` referenced (python3.10), use `sys.version_info`
YTT101.py:8:7: YTT101 `sys.version[:3]` referenced (python3.10), use `sys.version_info`
|
8 | print(sys.version[:3])
9 | print(version[:3])

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_2020/mod.rs
---
./resources/test/fixtures/flake8_2020/YTT102.py:4:12: YTT102 `sys.version[2]` referenced (python3.10), use `sys.version_info`
YTT102.py:4:12: YTT102 `sys.version[2]` referenced (python3.10), use `sys.version_info`
|
4 | from sys import version
5 |
@ -10,7 +10,7 @@ source: crates/ruff/src/rules/flake8_2020/mod.rs
7 | py_minor = version[2]
|
./resources/test/fixtures/flake8_2020/YTT102.py:5:12: YTT102 `sys.version[2]` referenced (python3.10), use `sys.version_info`
YTT102.py:5:12: YTT102 `sys.version[2]` referenced (python3.10), use `sys.version_info`
|
5 | py_minor = sys.version[2]
6 | py_minor = version[2]

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_2020/mod.rs
---
./resources/test/fixtures/flake8_2020/YTT103.py:4:1: YTT103 `sys.version` compared to string (python3.10), use `sys.version_info`
YTT103.py:4:1: YTT103 `sys.version` compared to string (python3.10), use `sys.version_info`
|
4 | from sys import version
5 |
@ -11,7 +11,7 @@ source: crates/ruff/src/rules/flake8_2020/mod.rs
8 | sys.version <= "3.5"
|
./resources/test/fixtures/flake8_2020/YTT103.py:5:1: YTT103 `sys.version` compared to string (python3.10), use `sys.version_info`
YTT103.py:5:1: YTT103 `sys.version` compared to string (python3.10), use `sys.version_info`
|
5 | version < "3.5"
6 | sys.version < "3.5"
@ -20,7 +20,7 @@ source: crates/ruff/src/rules/flake8_2020/mod.rs
8 | sys.version > "3.5"
|
./resources/test/fixtures/flake8_2020/YTT103.py:6:1: YTT103 `sys.version` compared to string (python3.10), use `sys.version_info`
YTT103.py:6:1: YTT103 `sys.version` compared to string (python3.10), use `sys.version_info`
|
6 | version < "3.5"
7 | sys.version < "3.5"
@ -30,7 +30,7 @@ source: crates/ruff/src/rules/flake8_2020/mod.rs
10 | sys.version >= "3.5"
|
./resources/test/fixtures/flake8_2020/YTT103.py:7:1: YTT103 `sys.version` compared to string (python3.10), use `sys.version_info`
YTT103.py:7:1: YTT103 `sys.version` compared to string (python3.10), use `sys.version_info`
|
7 | sys.version < "3.5"
8 | sys.version <= "3.5"
@ -39,7 +39,7 @@ source: crates/ruff/src/rules/flake8_2020/mod.rs
10 | sys.version >= "3.5"
|
./resources/test/fixtures/flake8_2020/YTT103.py:8:1: YTT103 `sys.version` compared to string (python3.10), use `sys.version_info`
YTT103.py:8:1: YTT103 `sys.version` compared to string (python3.10), use `sys.version_info`
|
8 | sys.version <= "3.5"
9 | sys.version > "3.5"

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_2020/mod.rs
---
./resources/test/fixtures/flake8_2020/YTT201.py:7:7: YTT201 `sys.version_info[0] == 3` referenced (python4), use `>=`
YTT201.py:7:7: YTT201 `sys.version_info[0] == 3` referenced (python4), use `>=`
|
7 | PY3 = sys.version_info[0] >= 3
8 |
@ -11,7 +11,7 @@ source: crates/ruff/src/rules/flake8_2020/mod.rs
11 | PY2 = sys.version_info[0] != 3
|
./resources/test/fixtures/flake8_2020/YTT201.py:8:7: YTT201 `sys.version_info[0] == 3` referenced (python4), use `>=`
YTT201.py:8:7: YTT201 `sys.version_info[0] == 3` referenced (python4), use `>=`
|
8 | PY3 = sys.version_info[0] == 3
9 | PY3 = version_info[0] == 3
@ -20,7 +20,7 @@ source: crates/ruff/src/rules/flake8_2020/mod.rs
11 | PY2 = version_info[0] != 3
|
./resources/test/fixtures/flake8_2020/YTT201.py:9:7: YTT201 `sys.version_info[0] == 3` referenced (python4), use `>=`
YTT201.py:9:7: YTT201 `sys.version_info[0] == 3` referenced (python4), use `>=`
|
9 | PY3 = sys.version_info[0] == 3
10 | PY3 = version_info[0] == 3
@ -29,7 +29,7 @@ source: crates/ruff/src/rules/flake8_2020/mod.rs
12 | PY2 = version_info[0] != 3
|
./resources/test/fixtures/flake8_2020/YTT201.py:10:7: YTT201 `sys.version_info[0] == 3` referenced (python4), use `>=`
YTT201.py:10:7: YTT201 `sys.version_info[0] == 3` referenced (python4), use `>=`
|
10 | PY3 = version_info[0] == 3
11 | PY2 = sys.version_info[0] != 3

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_2020/mod.rs
---
./resources/test/fixtures/flake8_2020/YTT202.py:4:4: YTT202 `six.PY3` referenced (python4), use `not six.PY2`
YTT202.py:4:4: YTT202 `six.PY3` referenced (python4), use `not six.PY2`
|
4 | from six import PY3
5 |
@ -11,7 +11,7 @@ source: crates/ruff/src/rules/flake8_2020/mod.rs
8 | if PY3:
|
./resources/test/fixtures/flake8_2020/YTT202.py:6:4: YTT202 `six.PY3` referenced (python4), use `not six.PY2`
YTT202.py:6:4: YTT202 `six.PY3` referenced (python4), use `not six.PY2`
|
6 | if six.PY3:
7 | print("3")

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_2020/mod.rs
---
./resources/test/fixtures/flake8_2020/YTT203.py:4:1: YTT203 `sys.version_info[1]` compared to integer (python4), compare `sys.version_info` to tuple
YTT203.py:4:1: YTT203 `sys.version_info[1]` compared to integer (python4), compare `sys.version_info` to tuple
|
4 | from sys import version_info
5 |
@ -10,7 +10,7 @@ source: crates/ruff/src/rules/flake8_2020/mod.rs
7 | version_info[1] < 6
|
./resources/test/fixtures/flake8_2020/YTT203.py:5:1: YTT203 `sys.version_info[1]` compared to integer (python4), compare `sys.version_info` to tuple
YTT203.py:5:1: YTT203 `sys.version_info[1]` compared to integer (python4), compare `sys.version_info` to tuple
|
5 | sys.version_info[1] >= 5
6 | version_info[1] < 6

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_2020/mod.rs
---
./resources/test/fixtures/flake8_2020/YTT204.py:4:1: YTT204 `sys.version_info.minor` compared to integer (python4), compare `sys.version_info` to tuple
YTT204.py:4:1: YTT204 `sys.version_info.minor` compared to integer (python4), compare `sys.version_info` to tuple
|
4 | from sys import version_info
5 |
@ -10,7 +10,7 @@ source: crates/ruff/src/rules/flake8_2020/mod.rs
7 | version_info.minor > 8
|
./resources/test/fixtures/flake8_2020/YTT204.py:5:1: YTT204 `sys.version_info.minor` compared to integer (python4), compare `sys.version_info` to tuple
YTT204.py:5:1: YTT204 `sys.version_info.minor` compared to integer (python4), compare `sys.version_info` to tuple
|
5 | sys.version_info.minor <= 7
6 | version_info.minor > 8

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_2020/mod.rs
---
./resources/test/fixtures/flake8_2020/YTT301.py:4:12: YTT301 `sys.version[0]` referenced (python10), use `sys.version_info`
YTT301.py:4:12: YTT301 `sys.version[0]` referenced (python10), use `sys.version_info`
|
4 | from sys import version
5 |
@ -10,7 +10,7 @@ source: crates/ruff/src/rules/flake8_2020/mod.rs
7 | py_major = version[0]
|
./resources/test/fixtures/flake8_2020/YTT301.py:5:12: YTT301 `sys.version[0]` referenced (python10), use `sys.version_info`
YTT301.py:5:12: YTT301 `sys.version[0]` referenced (python10), use `sys.version_info`
|
5 | py_major = sys.version[0]
6 | py_major = version[0]

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_2020/mod.rs
---
./resources/test/fixtures/flake8_2020/YTT302.py:4:1: YTT302 `sys.version` compared to string (python10), use `sys.version_info`
YTT302.py:4:1: YTT302 `sys.version` compared to string (python10), use `sys.version_info`
|
4 | from sys import version
5 |
@ -11,7 +11,7 @@ source: crates/ruff/src/rules/flake8_2020/mod.rs
8 | sys.version <= "3"
|
./resources/test/fixtures/flake8_2020/YTT302.py:5:1: YTT302 `sys.version` compared to string (python10), use `sys.version_info`
YTT302.py:5:1: YTT302 `sys.version` compared to string (python10), use `sys.version_info`
|
5 | version < "3"
6 | sys.version < "3"
@ -20,7 +20,7 @@ source: crates/ruff/src/rules/flake8_2020/mod.rs
8 | sys.version > "3"
|
./resources/test/fixtures/flake8_2020/YTT302.py:6:1: YTT302 `sys.version` compared to string (python10), use `sys.version_info`
YTT302.py:6:1: YTT302 `sys.version` compared to string (python10), use `sys.version_info`
|
6 | version < "3"
7 | sys.version < "3"
@ -30,7 +30,7 @@ source: crates/ruff/src/rules/flake8_2020/mod.rs
10 | sys.version >= "3"
|
./resources/test/fixtures/flake8_2020/YTT302.py:7:1: YTT302 `sys.version` compared to string (python10), use `sys.version_info`
YTT302.py:7:1: YTT302 `sys.version` compared to string (python10), use `sys.version_info`
|
7 | sys.version < "3"
8 | sys.version <= "3"
@ -39,7 +39,7 @@ source: crates/ruff/src/rules/flake8_2020/mod.rs
10 | sys.version >= "3"
|
./resources/test/fixtures/flake8_2020/YTT302.py:8:1: YTT302 `sys.version` compared to string (python10), use `sys.version_info`
YTT302.py:8:1: YTT302 `sys.version` compared to string (python10), use `sys.version_info`
|
8 | sys.version <= "3"
9 | sys.version > "3"

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_2020/mod.rs
---
./resources/test/fixtures/flake8_2020/YTT303.py:4:7: YTT303 `sys.version[:1]` referenced (python10), use `sys.version_info`
YTT303.py:4:7: YTT303 `sys.version[:1]` referenced (python10), use `sys.version_info`
|
4 | from sys import version
5 |
@ -10,7 +10,7 @@ source: crates/ruff/src/rules/flake8_2020/mod.rs
7 | print(version[:1])
|
./resources/test/fixtures/flake8_2020/YTT303.py:5:7: YTT303 `sys.version[:1]` referenced (python10), use `sys.version_info`
YTT303.py:5:7: YTT303 `sys.version[:1]` referenced (python10), use `sys.version_info`
|
5 | print(sys.version[:1])
6 | print(version[:1])

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_annotations/mod.rs
---
./resources/test/fixtures/flake8_annotations/allow_overload.py:29:9: ANN201 Missing return type annotation for public function `bar`
allow_overload.py:29:9: ANN201 Missing return type annotation for public function `bar`
|
29 | class X:
30 | def bar(i):

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_annotations/mod.rs
---
./resources/test/fixtures/flake8_annotations/allow_star_arg_any.py:10:12: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `a`
allow_star_arg_any.py:10:12: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `a`
|
10 | # ANN401
11 | def foo(a: Any, *args: str, **kwargs: str) -> int:
@ -9,7 +9,7 @@ source: crates/ruff/src/rules/flake8_annotations/mod.rs
12 | pass
|
./resources/test/fixtures/flake8_annotations/allow_star_arg_any.py:15:47: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `foo`
allow_star_arg_any.py:15:47: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `foo`
|
15 | # ANN401
16 | def foo(a: int, *args: str, **kwargs: str) -> Any:
@ -17,7 +17,7 @@ source: crates/ruff/src/rules/flake8_annotations/mod.rs
17 | pass
|
./resources/test/fixtures/flake8_annotations/allow_star_arg_any.py:40:29: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `a`
allow_star_arg_any.py:40:29: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `a`
|
40 | # ANN401
41 | def foo_method(self, a: Any, *params: str, **options: str) -> int:
@ -25,7 +25,7 @@ source: crates/ruff/src/rules/flake8_annotations/mod.rs
42 | pass
|
./resources/test/fixtures/flake8_annotations/allow_star_arg_any.py:44:67: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `foo_method`
allow_star_arg_any.py:44:67: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `foo_method`
|
44 | # ANN401
45 | def foo_method(self, a: int, *params: str, **options: str) -> Any:

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_annotations/mod.rs
---
./resources/test/fixtures/flake8_annotations/annotation_presence.py:4:5: ANN201 Missing return type annotation for public function `foo`
annotation_presence.py:4:5: ANN201 Missing return type annotation for public function `foo`
|
4 | # Error
5 | def foo(a, b):
@ -9,7 +9,7 @@ source: crates/ruff/src/rules/flake8_annotations/mod.rs
6 | pass
|
./resources/test/fixtures/flake8_annotations/annotation_presence.py:4:9: ANN001 Missing type annotation for function argument `a`
annotation_presence.py:4:9: ANN001 Missing type annotation for function argument `a`
|
4 | # Error
5 | def foo(a, b):
@ -17,7 +17,7 @@ source: crates/ruff/src/rules/flake8_annotations/mod.rs
6 | pass
|
./resources/test/fixtures/flake8_annotations/annotation_presence.py:4:12: ANN001 Missing type annotation for function argument `b`
annotation_presence.py:4:12: ANN001 Missing type annotation for function argument `b`
|
4 | # Error
5 | def foo(a, b):
@ -25,7 +25,7 @@ source: crates/ruff/src/rules/flake8_annotations/mod.rs
6 | pass
|
./resources/test/fixtures/flake8_annotations/annotation_presence.py:9:5: ANN201 Missing return type annotation for public function `foo`
annotation_presence.py:9:5: ANN201 Missing return type annotation for public function `foo`
|
9 | # Error
10 | def foo(a: int, b):
@ -33,7 +33,7 @@ source: crates/ruff/src/rules/flake8_annotations/mod.rs
11 | pass
|
./resources/test/fixtures/flake8_annotations/annotation_presence.py:9:17: ANN001 Missing type annotation for function argument `b`
annotation_presence.py:9:17: ANN001 Missing type annotation for function argument `b`
|
9 | # Error
10 | def foo(a: int, b):
@ -41,7 +41,7 @@ source: crates/ruff/src/rules/flake8_annotations/mod.rs
11 | pass
|
./resources/test/fixtures/flake8_annotations/annotation_presence.py:14:17: ANN001 Missing type annotation for function argument `b`
annotation_presence.py:14:17: ANN001 Missing type annotation for function argument `b`
|
14 | # Error
15 | def foo(a: int, b) -> int:
@ -49,7 +49,7 @@ source: crates/ruff/src/rules/flake8_annotations/mod.rs
16 | pass
|
./resources/test/fixtures/flake8_annotations/annotation_presence.py:19:5: ANN201 Missing return type annotation for public function `foo`
annotation_presence.py:19:5: ANN201 Missing return type annotation for public function `foo`
|
19 | # Error
20 | def foo(a: int, b: int):
@ -57,7 +57,7 @@ source: crates/ruff/src/rules/flake8_annotations/mod.rs
21 | pass
|
./resources/test/fixtures/flake8_annotations/annotation_presence.py:24:5: ANN201 Missing return type annotation for public function `foo`
annotation_presence.py:24:5: ANN201 Missing return type annotation for public function `foo`
|
24 | # Error
25 | def foo():
@ -65,7 +65,7 @@ source: crates/ruff/src/rules/flake8_annotations/mod.rs
26 | pass
|
./resources/test/fixtures/flake8_annotations/annotation_presence.py:44:12: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `a`
annotation_presence.py:44:12: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `a`
|
44 | # ANN401
45 | def foo(a: Any, *args: str, **kwargs: str) -> int:
@ -73,7 +73,7 @@ source: crates/ruff/src/rules/flake8_annotations/mod.rs
46 | pass
|
./resources/test/fixtures/flake8_annotations/annotation_presence.py:49:47: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `foo`
annotation_presence.py:49:47: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `foo`
|
49 | # ANN401
50 | def foo(a: int, *args: str, **kwargs: str) -> Any:
@ -81,7 +81,7 @@ source: crates/ruff/src/rules/flake8_annotations/mod.rs
51 | pass
|
./resources/test/fixtures/flake8_annotations/annotation_presence.py:54:24: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `*args`
annotation_presence.py:54:24: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `*args`
|
54 | # ANN401
55 | def foo(a: int, *args: Any, **kwargs: Any) -> int:
@ -89,7 +89,7 @@ source: crates/ruff/src/rules/flake8_annotations/mod.rs
56 | pass
|
./resources/test/fixtures/flake8_annotations/annotation_presence.py:54:39: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `**kwargs`
annotation_presence.py:54:39: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `**kwargs`
|
54 | # ANN401
55 | def foo(a: int, *args: Any, **kwargs: Any) -> int:
@ -97,7 +97,7 @@ source: crates/ruff/src/rules/flake8_annotations/mod.rs
56 | pass
|
./resources/test/fixtures/flake8_annotations/annotation_presence.py:59:24: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `*args`
annotation_presence.py:59:24: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `*args`
|
59 | # ANN401
60 | def foo(a: int, *args: Any, **kwargs: str) -> int:
@ -105,7 +105,7 @@ source: crates/ruff/src/rules/flake8_annotations/mod.rs
61 | pass
|
./resources/test/fixtures/flake8_annotations/annotation_presence.py:64:39: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `**kwargs`
annotation_presence.py:64:39: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `**kwargs`
|
64 | # ANN401
65 | def foo(a: int, *args: str, **kwargs: Any) -> int:
@ -113,7 +113,7 @@ source: crates/ruff/src/rules/flake8_annotations/mod.rs
66 | pass
|
./resources/test/fixtures/flake8_annotations/annotation_presence.py:74:13: ANN101 Missing type annotation for `self` in method
annotation_presence.py:74:13: ANN101 Missing type annotation for `self` in method
|
74 | # ANN101
75 | def foo(self, a: int, b: int) -> int:
@ -121,7 +121,7 @@ source: crates/ruff/src/rules/flake8_annotations/mod.rs
76 | pass
|
./resources/test/fixtures/flake8_annotations/annotation_presence.py:78:29: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `a`
annotation_presence.py:78:29: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `a`
|
78 | # ANN401
79 | def foo(self: "Foo", a: Any, *params: str, **options: str) -> int:
@ -129,7 +129,7 @@ source: crates/ruff/src/rules/flake8_annotations/mod.rs
80 | pass
|
./resources/test/fixtures/flake8_annotations/annotation_presence.py:82:67: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `foo`
annotation_presence.py:82:67: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `foo`
|
82 | # ANN401
83 | def foo(self: "Foo", a: int, *params: str, **options: str) -> Any:
@ -137,7 +137,7 @@ source: crates/ruff/src/rules/flake8_annotations/mod.rs
84 | pass
|
./resources/test/fixtures/flake8_annotations/annotation_presence.py:86:43: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `*params`
annotation_presence.py:86:43: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `*params`
|
86 | # ANN401
87 | def foo(self: "Foo", a: int, *params: Any, **options: Any) -> int:
@ -145,7 +145,7 @@ source: crates/ruff/src/rules/flake8_annotations/mod.rs
88 | pass
|
./resources/test/fixtures/flake8_annotations/annotation_presence.py:86:59: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `**options`
annotation_presence.py:86:59: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `**options`
|
86 | # ANN401
87 | def foo(self: "Foo", a: int, *params: Any, **options: Any) -> int:
@ -153,7 +153,7 @@ source: crates/ruff/src/rules/flake8_annotations/mod.rs
88 | pass
|
./resources/test/fixtures/flake8_annotations/annotation_presence.py:90:43: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `*params`
annotation_presence.py:90:43: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `*params`
|
90 | # ANN401
91 | def foo(self: "Foo", a: int, *params: Any, **options: str) -> int:
@ -161,7 +161,7 @@ source: crates/ruff/src/rules/flake8_annotations/mod.rs
92 | pass
|
./resources/test/fixtures/flake8_annotations/annotation_presence.py:94:59: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `**options`
annotation_presence.py:94:59: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `**options`
|
94 | # ANN401
95 | def foo(self: "Foo", a: int, *params: str, **options: Any) -> int:
@ -169,7 +169,7 @@ source: crates/ruff/src/rules/flake8_annotations/mod.rs
96 | pass
|
./resources/test/fixtures/flake8_annotations/annotation_presence.py:104:13: ANN102 Missing type annotation for `cls` in classmethod
annotation_presence.py:104:13: ANN102 Missing type annotation for `cls` in classmethod
|
104 | # ANN102
105 | @classmethod
@ -178,7 +178,7 @@ source: crates/ruff/src/rules/flake8_annotations/mod.rs
107 | pass
|
./resources/test/fixtures/flake8_annotations/annotation_presence.py:108:13: ANN101 Missing type annotation for `self` in method
annotation_presence.py:108:13: ANN101 Missing type annotation for `self` in method
|
108 | # ANN101
109 | def foo(self, /, a: int, b: int) -> int:

View file

@ -1,35 +1,35 @@
---
source: crates/ruff/src/rules/flake8_annotations/mod.rs
---
./resources/test/fixtures/flake8_annotations/ignore_fully_untyped.py:24:5: ANN201 Missing return type annotation for public function `error_partially_typed_1`
ignore_fully_untyped.py:24:5: ANN201 Missing return type annotation for public function `error_partially_typed_1`
|
24 | def error_partially_typed_1(a: int, b):
| ^^^^^^^^^^^^^^^^^^^^^^^ ANN201
25 | pass
|
./resources/test/fixtures/flake8_annotations/ignore_fully_untyped.py:24:37: ANN001 Missing type annotation for function argument `b`
ignore_fully_untyped.py:24:37: ANN001 Missing type annotation for function argument `b`
|
24 | def error_partially_typed_1(a: int, b):
| ^ ANN001
25 | pass
|
./resources/test/fixtures/flake8_annotations/ignore_fully_untyped.py:28:37: ANN001 Missing type annotation for function argument `b`
ignore_fully_untyped.py:28:37: ANN001 Missing type annotation for function argument `b`
|
28 | def error_partially_typed_2(a: int, b) -> int:
| ^ ANN001
29 | pass
|
./resources/test/fixtures/flake8_annotations/ignore_fully_untyped.py:32:5: ANN201 Missing return type annotation for public function `error_partially_typed_3`
ignore_fully_untyped.py:32:5: ANN201 Missing return type annotation for public function `error_partially_typed_3`
|
32 | def error_partially_typed_3(a: int, b: int):
| ^^^^^^^^^^^^^^^^^^^^^^^ ANN201
33 | pass
|
./resources/test/fixtures/flake8_annotations/ignore_fully_untyped.py:43:9: ANN201 Missing return type annotation for public function `error_typed_self`
ignore_fully_untyped.py:43:9: ANN201 Missing return type annotation for public function `error_typed_self`
|
43 | pass
44 |

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_annotations/mod.rs
---
./resources/test/fixtures/flake8_annotations/mypy_init_return.py:5:9: ANN204 [*] Missing return type annotation for special method `__init__`
mypy_init_return.py:5:9: ANN204 [*] Missing return type annotation for special method `__init__`
|
5 | # Error
6 | class Foo:
@ -21,7 +21,7 @@ source: crates/ruff/src/rules/flake8_annotations/mod.rs
7 7 |
8 8 |
./resources/test/fixtures/flake8_annotations/mypy_init_return.py:11:9: ANN204 [*] Missing return type annotation for special method `__init__`
mypy_init_return.py:11:9: ANN204 [*] Missing return type annotation for special method `__init__`
|
11 | # Error
12 | class Foo:
@ -41,7 +41,7 @@ source: crates/ruff/src/rules/flake8_annotations/mod.rs
13 13 |
14 14 |
./resources/test/fixtures/flake8_annotations/mypy_init_return.py:40:5: ANN202 Missing return type annotation for private function `__init__`
mypy_init_return.py:40:5: ANN202 Missing return type annotation for private function `__init__`
|
40 | # Error
41 | def __init__(self, foo: int):
@ -49,7 +49,7 @@ source: crates/ruff/src/rules/flake8_annotations/mod.rs
42 | ...
|
./resources/test/fixtures/flake8_annotations/mypy_init_return.py:47:9: ANN204 [*] Missing return type annotation for special method `__init__`
mypy_init_return.py:47:9: ANN204 [*] Missing return type annotation for special method `__init__`
|
47 | # of a vararg falsely indicated that the function has a typed argument.
48 | class Foo:

View file

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

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_annotations/mod.rs
---
./resources/test/fixtures/flake8_annotations/suppress_none_returning.py:45:5: ANN201 Missing return type annotation for public function `foo`
suppress_none_returning.py:45:5: ANN201 Missing return type annotation for public function `foo`
|
45 | # Error
46 | def foo():
@ -9,7 +9,7 @@ source: crates/ruff/src/rules/flake8_annotations/mod.rs
47 | return True
|
./resources/test/fixtures/flake8_annotations/suppress_none_returning.py:50:5: ANN201 Missing return type annotation for public function `foo`
suppress_none_returning.py:50:5: ANN201 Missing return type annotation for public function `foo`
|
50 | # Error
51 | def foo():
@ -18,7 +18,7 @@ source: crates/ruff/src/rules/flake8_annotations/mod.rs
53 | if a == 4:
|
./resources/test/fixtures/flake8_annotations/suppress_none_returning.py:59:9: ANN001 Missing type annotation for function argument `a`
suppress_none_returning.py:59:9: ANN001 Missing type annotation for function argument `a`
|
59 | # Error (on the argument, but not the return type)
60 | def foo(a):

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_bandit/mod.rs
---
./resources/test/fixtures/flake8_bandit/S101.py:2:1: S101 Use of `assert` detected
S101.py:2:1: S101 Use of `assert` detected
|
2 | # Error
3 | assert True
@ -10,7 +10,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
5 | def fn():
|
./resources/test/fixtures/flake8_bandit/S101.py:8:5: S101 Use of `assert` detected
S101.py:8:5: S101 Use of `assert` detected
|
8 | # Error
9 | assert x == 1
@ -19,7 +19,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
11 | # Error
|
./resources/test/fixtures/flake8_bandit/S101.py:11:5: S101 Use of `assert` detected
S101.py:11:5: S101 Use of `assert` detected
|
11 | # Error
12 | assert x == 2

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_bandit/mod.rs
---
./resources/test/fixtures/flake8_bandit/S102.py:3:5: S102 Use of `exec` detected
S102.py:3:5: S102 Use of `exec` detected
|
3 | def fn():
4 | # Error
@ -11,7 +11,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
7 | exec('y = 3')
|
./resources/test/fixtures/flake8_bandit/S102.py:5:1: S102 Use of `exec` detected
S102.py:5:1: S102 Use of `exec` detected
|
5 | exec('x = 2')
6 |

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_bandit/mod.rs
---
./resources/test/fixtures/flake8_bandit/S103.py:6:25: S103 `os.chmod` setting a permissive mask `0o227` on file or directory
S103.py:6:25: S103 `os.chmod` setting a permissive mask `0o227` on file or directory
|
6 | keyfile = "foo"
7 |
@ -11,7 +11,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
10 | os.chmod("/etc/passwd", 0o664) # OK
|
./resources/test/fixtures/flake8_bandit/S103.py:7:25: S103 `os.chmod` setting a permissive mask `0o7` on file or directory
S103.py:7:25: S103 `os.chmod` setting a permissive mask `0o7` on file or directory
|
7 | os.chmod("/etc/passwd", 0o227) # Error
8 | os.chmod("/etc/passwd", 0o7) # Error
@ -20,7 +20,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
10 | os.chmod("/etc/passwd", 0o777) # Error
|
./resources/test/fixtures/flake8_bandit/S103.py:9:25: S103 `os.chmod` setting a permissive mask `0o777` on file or directory
S103.py:9:25: S103 `os.chmod` setting a permissive mask `0o777` on file or directory
|
9 | os.chmod("/etc/passwd", 0o7) # Error
10 | os.chmod("/etc/passwd", 0o664) # OK
@ -30,7 +30,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
13 | os.chmod("/etc/passwd", 0o776) # Error
|
./resources/test/fixtures/flake8_bandit/S103.py:10:25: S103 `os.chmod` setting a permissive mask `0o770` on file or directory
S103.py:10:25: S103 `os.chmod` setting a permissive mask `0o770` on file or directory
|
10 | os.chmod("/etc/passwd", 0o664) # OK
11 | os.chmod("/etc/passwd", 0o777) # Error
@ -40,7 +40,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
14 | os.chmod("/etc/passwd", 0o760) # OK
|
./resources/test/fixtures/flake8_bandit/S103.py:11:25: S103 `os.chmod` setting a permissive mask `0o776` on file or directory
S103.py:11:25: S103 `os.chmod` setting a permissive mask `0o776` on file or directory
|
11 | os.chmod("/etc/passwd", 0o777) # Error
12 | os.chmod("/etc/passwd", 0o770) # Error
@ -50,7 +50,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
15 | os.chmod("~/.bashrc", 511) # Error
|
./resources/test/fixtures/flake8_bandit/S103.py:13:23: S103 `os.chmod` setting a permissive mask `0o777` on file or directory
S103.py:13:23: S103 `os.chmod` setting a permissive mask `0o777` on file or directory
|
13 | os.chmod("/etc/passwd", 0o776) # Error
14 | os.chmod("/etc/passwd", 0o760) # OK
@ -60,7 +60,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
17 | os.chmod("/tmp/oh_hai", 0x1FF) # Error
|
./resources/test/fixtures/flake8_bandit/S103.py:14:24: S103 `os.chmod` setting a permissive mask `0o777` on file or directory
S103.py:14:24: S103 `os.chmod` setting a permissive mask `0o777` on file or directory
|
14 | os.chmod("/etc/passwd", 0o760) # OK
15 | os.chmod("~/.bashrc", 511) # Error
@ -70,7 +70,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
18 | os.chmod("/etc/passwd", stat.S_IRWXU) # OK
|
./resources/test/fixtures/flake8_bandit/S103.py:15:25: S103 `os.chmod` setting a permissive mask `0o777` on file or directory
S103.py:15:25: S103 `os.chmod` setting a permissive mask `0o777` on file or directory
|
15 | os.chmod("~/.bashrc", 511) # Error
16 | os.chmod("/etc/hosts", 0o777) # Error
@ -80,7 +80,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
19 | os.chmod(keyfile, 0o777) # Error
|
./resources/test/fixtures/flake8_bandit/S103.py:17:19: S103 `os.chmod` setting a permissive mask `0o777` on file or directory
S103.py:17:19: S103 `os.chmod` setting a permissive mask `0o777` on file or directory
|
17 | os.chmod("/tmp/oh_hai", 0x1FF) # Error
18 | os.chmod("/etc/passwd", stat.S_IRWXU) # OK
@ -90,7 +90,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
21 | os.chmod(keyfile, stat.S_IRWXO | stat.S_IRWXG | stat.S_IRWXU) # Error
|
./resources/test/fixtures/flake8_bandit/S103.py:18:19: S103 `os.chmod` setting a permissive mask `0o777` on file or directory
S103.py:18:19: S103 `os.chmod` setting a permissive mask `0o777` on file or directory
|
18 | os.chmod("/etc/passwd", stat.S_IRWXU) # OK
19 | os.chmod(keyfile, 0o777) # Error
@ -100,7 +100,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
22 | os.chmod("~/hidden_exec", stat.S_IXGRP) # Error
|
./resources/test/fixtures/flake8_bandit/S103.py:19:19: S103 `os.chmod` setting a permissive mask `0o777` on file or directory
S103.py:19:19: S103 `os.chmod` setting a permissive mask `0o777` on file or directory
|
19 | os.chmod(keyfile, 0o777) # Error
20 | os.chmod(keyfile, 0o7 | 0o70 | 0o700) # Error
@ -110,7 +110,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
23 | os.chmod("~/hidden_exec", stat.S_IXOTH) # OK
|
./resources/test/fixtures/flake8_bandit/S103.py:20:27: S103 `os.chmod` setting a permissive mask `0o10` on file or directory
S103.py:20:27: S103 `os.chmod` setting a permissive mask `0o10` on file or directory
|
20 | os.chmod(keyfile, 0o7 | 0o70 | 0o700) # Error
21 | os.chmod(keyfile, stat.S_IRWXO | stat.S_IRWXG | stat.S_IRWXU) # Error
@ -120,7 +120,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
24 | os.chmod("/etc/passwd", stat.S_IWOTH) # Error
|
./resources/test/fixtures/flake8_bandit/S103.py:22:25: S103 `os.chmod` setting a permissive mask `0o2` on file or directory
S103.py:22:25: S103 `os.chmod` setting a permissive mask `0o2` on file or directory
|
22 | os.chmod("~/hidden_exec", stat.S_IXGRP) # Error
23 | os.chmod("~/hidden_exec", stat.S_IXOTH) # OK

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_bandit/mod.rs
---
./resources/test/fixtures/flake8_bandit/S104.py:9:1: S104 Possible binding to all interfaces
S104.py:9:1: S104 Possible binding to all interfaces
|
9 | # Error
10 | "0.0.0.0"
@ -9,7 +9,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
11 | '0.0.0.0'
|
./resources/test/fixtures/flake8_bandit/S104.py:10:1: S104 Possible binding to all interfaces
S104.py:10:1: S104 Possible binding to all interfaces
|
10 | # Error
11 | "0.0.0.0"
@ -17,14 +17,14 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
| ^^^^^^^^^ S104
|
./resources/test/fixtures/flake8_bandit/S104.py:14:6: S104 Possible binding to all interfaces
S104.py:14:6: S104 Possible binding to all interfaces
|
14 | # Error
15 | func("0.0.0.0")
| ^^^^^^^^^ S104
|
./resources/test/fixtures/flake8_bandit/S104.py:18:9: S104 Possible binding to all interfaces
S104.py:18:9: S104 Possible binding to all interfaces
|
18 | def my_func():
19 | x = "0.0.0.0"

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_bandit/mod.rs
---
./resources/test/fixtures/flake8_bandit/S105.py:13:12: S105 Possible hardcoded password: "s3cr3t"
S105.py:13:12: S105 Possible hardcoded password: "s3cr3t"
|
13 | # Errors
14 | password = "s3cr3t"
@ -10,7 +10,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
16 | passwd = "s3cr3t"
|
./resources/test/fixtures/flake8_bandit/S105.py:14:9: S105 Possible hardcoded password: "s3cr3t"
S105.py:14:9: S105 Possible hardcoded password: "s3cr3t"
|
14 | # Errors
15 | password = "s3cr3t"
@ -20,7 +20,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
18 | pwd = "s3cr3t"
|
./resources/test/fixtures/flake8_bandit/S105.py:15:10: S105 Possible hardcoded password: "s3cr3t"
S105.py:15:10: S105 Possible hardcoded password: "s3cr3t"
|
15 | password = "s3cr3t"
16 | _pass = "s3cr3t"
@ -30,7 +30,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
19 | secret = "s3cr3t"
|
./resources/test/fixtures/flake8_bandit/S105.py:16:7: S105 Possible hardcoded password: "s3cr3t"
S105.py:16:7: S105 Possible hardcoded password: "s3cr3t"
|
16 | _pass = "s3cr3t"
17 | passwd = "s3cr3t"
@ -40,7 +40,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
20 | token = "s3cr3t"
|
./resources/test/fixtures/flake8_bandit/S105.py:17:10: S105 Possible hardcoded password: "s3cr3t"
S105.py:17:10: S105 Possible hardcoded password: "s3cr3t"
|
17 | passwd = "s3cr3t"
18 | pwd = "s3cr3t"
@ -50,7 +50,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
21 | secrete = "s3cr3t"
|
./resources/test/fixtures/flake8_bandit/S105.py:18:9: S105 Possible hardcoded password: "s3cr3t"
S105.py:18:9: S105 Possible hardcoded password: "s3cr3t"
|
18 | pwd = "s3cr3t"
19 | secret = "s3cr3t"
@ -60,7 +60,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
22 | safe = password = "s3cr3t"
|
./resources/test/fixtures/flake8_bandit/S105.py:19:11: S105 Possible hardcoded password: "s3cr3t"
S105.py:19:11: S105 Possible hardcoded password: "s3cr3t"
|
19 | secret = "s3cr3t"
20 | token = "s3cr3t"
@ -70,7 +70,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
23 | password = safe = "s3cr3t"
|
./resources/test/fixtures/flake8_bandit/S105.py:20:19: S105 Possible hardcoded password: "s3cr3t"
S105.py:20:19: S105 Possible hardcoded password: "s3cr3t"
|
20 | token = "s3cr3t"
21 | secrete = "s3cr3t"
@ -80,7 +80,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
24 | PASSWORD = "s3cr3t"
|
./resources/test/fixtures/flake8_bandit/S105.py:21:19: S105 Possible hardcoded password: "s3cr3t"
S105.py:21:19: S105 Possible hardcoded password: "s3cr3t"
|
21 | secrete = "s3cr3t"
22 | safe = password = "s3cr3t"
@ -90,7 +90,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
25 | PassWord = "s3cr3t"
|
./resources/test/fixtures/flake8_bandit/S105.py:22:12: S105 Possible hardcoded password: "s3cr3t"
S105.py:22:12: S105 Possible hardcoded password: "s3cr3t"
|
22 | safe = password = "s3cr3t"
23 | password = safe = "s3cr3t"
@ -99,7 +99,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
25 | PassWord = "s3cr3t"
|
./resources/test/fixtures/flake8_bandit/S105.py:23:12: S105 Possible hardcoded password: "s3cr3t"
S105.py:23:12: S105 Possible hardcoded password: "s3cr3t"
|
23 | password = safe = "s3cr3t"
24 | PASSWORD = "s3cr3t"
@ -109,7 +109,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
27 | d["password"] = "s3cr3t"
|
./resources/test/fixtures/flake8_bandit/S105.py:25:17: S105 Possible hardcoded password: "s3cr3t"
S105.py:25:17: S105 Possible hardcoded password: "s3cr3t"
|
25 | PassWord = "s3cr3t"
26 |
@ -119,7 +119,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
29 | d["passwd"] = "s3cr3t"
|
./resources/test/fixtures/flake8_bandit/S105.py:26:13: S105 Possible hardcoded password: "s3cr3t"
S105.py:26:13: S105 Possible hardcoded password: "s3cr3t"
|
26 | d["password"] = "s3cr3t"
27 | d["pass"] = "s3cr3t"
@ -128,7 +128,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
29 | d["pwd"] = "s3cr3t"
|
./resources/test/fixtures/flake8_bandit/S105.py:27:15: S105 Possible hardcoded password: "s3cr3t"
S105.py:27:15: S105 Possible hardcoded password: "s3cr3t"
|
27 | d["password"] = "s3cr3t"
28 | d["pass"] = "s3cr3t"
@ -138,7 +138,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
31 | d["secret"] = "s3cr3t"
|
./resources/test/fixtures/flake8_bandit/S105.py:28:12: S105 Possible hardcoded password: "s3cr3t"
S105.py:28:12: S105 Possible hardcoded password: "s3cr3t"
|
28 | d["pass"] = "s3cr3t"
29 | d["passwd"] = "s3cr3t"
@ -148,7 +148,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
32 | d["token"] = "s3cr3t"
|
./resources/test/fixtures/flake8_bandit/S105.py:29:15: S105 Possible hardcoded password: "s3cr3t"
S105.py:29:15: S105 Possible hardcoded password: "s3cr3t"
|
29 | d["passwd"] = "s3cr3t"
30 | d["pwd"] = "s3cr3t"
@ -158,7 +158,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
33 | d["secrete"] = "s3cr3t"
|
./resources/test/fixtures/flake8_bandit/S105.py:30:14: S105 Possible hardcoded password: "s3cr3t"
S105.py:30:14: S105 Possible hardcoded password: "s3cr3t"
|
30 | d["pwd"] = "s3cr3t"
31 | d["secret"] = "s3cr3t"
@ -168,7 +168,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
34 | safe = d["password"] = "s3cr3t"
|
./resources/test/fixtures/flake8_bandit/S105.py:31:16: S105 Possible hardcoded password: "s3cr3t"
S105.py:31:16: S105 Possible hardcoded password: "s3cr3t"
|
31 | d["secret"] = "s3cr3t"
32 | d["token"] = "s3cr3t"
@ -178,7 +178,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
35 | d["password"] = safe = "s3cr3t"
|
./resources/test/fixtures/flake8_bandit/S105.py:32:24: S105 Possible hardcoded password: "s3cr3t"
S105.py:32:24: S105 Possible hardcoded password: "s3cr3t"
|
32 | d["token"] = "s3cr3t"
33 | d["secrete"] = "s3cr3t"
@ -187,7 +187,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
35 | d["password"] = safe = "s3cr3t"
|
./resources/test/fixtures/flake8_bandit/S105.py:33:24: S105 Possible hardcoded password: "s3cr3t"
S105.py:33:24: S105 Possible hardcoded password: "s3cr3t"
|
33 | d["secrete"] = "s3cr3t"
34 | safe = d["password"] = "s3cr3t"
@ -195,7 +195,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
| ^^^^^^^^ S105
|
./resources/test/fixtures/flake8_bandit/S105.py:37:16: S105 Possible hardcoded password: "s3cr3t"
S105.py:37:16: S105 Possible hardcoded password: "s3cr3t"
|
37 | class MyClass:
38 | password = "s3cr3t"
@ -203,7 +203,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
39 | safe = password
|
./resources/test/fixtures/flake8_bandit/S105.py:41:20: S105 Possible hardcoded password: "s3cr3t"
S105.py:41:20: S105 Possible hardcoded password: "s3cr3t"
|
41 | MyClass.password = "s3cr3t"
| ^^^^^^^^ S105
@ -211,7 +211,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
43 | MyClass.passwd = "s3cr3t"
|
./resources/test/fixtures/flake8_bandit/S105.py:42:17: S105 Possible hardcoded password: "s3cr3t"
S105.py:42:17: S105 Possible hardcoded password: "s3cr3t"
|
42 | MyClass.password = "s3cr3t"
43 | MyClass._pass = "s3cr3t"
@ -220,7 +220,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
45 | MyClass.pwd = "s3cr3t"
|
./resources/test/fixtures/flake8_bandit/S105.py:43:18: S105 Possible hardcoded password: "s3cr3t"
S105.py:43:18: S105 Possible hardcoded password: "s3cr3t"
|
43 | MyClass.password = "s3cr3t"
44 | MyClass._pass = "s3cr3t"
@ -230,7 +230,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
47 | MyClass.secret = "s3cr3t"
|
./resources/test/fixtures/flake8_bandit/S105.py:44:15: S105 Possible hardcoded password: "s3cr3t"
S105.py:44:15: S105 Possible hardcoded password: "s3cr3t"
|
44 | MyClass._pass = "s3cr3t"
45 | MyClass.passwd = "s3cr3t"
@ -240,7 +240,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
48 | MyClass.token = "s3cr3t"
|
./resources/test/fixtures/flake8_bandit/S105.py:45:18: S105 Possible hardcoded password: "s3cr3t"
S105.py:45:18: S105 Possible hardcoded password: "s3cr3t"
|
45 | MyClass.passwd = "s3cr3t"
46 | MyClass.pwd = "s3cr3t"
@ -250,7 +250,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
49 | MyClass.secrete = "s3cr3t"
|
./resources/test/fixtures/flake8_bandit/S105.py:46:17: S105 Possible hardcoded password: "s3cr3t"
S105.py:46:17: S105 Possible hardcoded password: "s3cr3t"
|
46 | MyClass.pwd = "s3cr3t"
47 | MyClass.secret = "s3cr3t"
@ -259,7 +259,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
49 | MyClass.secrete = "s3cr3t"
|
./resources/test/fixtures/flake8_bandit/S105.py:47:19: S105 Possible hardcoded password: "s3cr3t"
S105.py:47:19: S105 Possible hardcoded password: "s3cr3t"
|
47 | MyClass.secret = "s3cr3t"
48 | MyClass.token = "s3cr3t"
@ -269,7 +269,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
51 | password == "s3cr3t"
|
./resources/test/fixtures/flake8_bandit/S105.py:49:13: S105 Possible hardcoded password: "s3cr3t"
S105.py:49:13: S105 Possible hardcoded password: "s3cr3t"
|
49 | MyClass.secrete = "s3cr3t"
50 |
@ -279,7 +279,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
53 | passwd == "s3cr3t"
|
./resources/test/fixtures/flake8_bandit/S105.py:50:10: S105 Possible hardcoded password: "s3cr3t"
S105.py:50:10: S105 Possible hardcoded password: "s3cr3t"
|
50 | password == "s3cr3t"
51 | _pass == "s3cr3t"
@ -288,7 +288,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
53 | pwd == "s3cr3t"
|
./resources/test/fixtures/flake8_bandit/S105.py:51:11: S105 Possible hardcoded password: "s3cr3t"
S105.py:51:11: S105 Possible hardcoded password: "s3cr3t"
|
51 | password == "s3cr3t"
52 | _pass == "s3cr3t"
@ -298,7 +298,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
55 | secret == "s3cr3t"
|
./resources/test/fixtures/flake8_bandit/S105.py:52:8: S105 Possible hardcoded password: "s3cr3t"
S105.py:52:8: S105 Possible hardcoded password: "s3cr3t"
|
52 | _pass == "s3cr3t"
53 | passwd == "s3cr3t"
@ -308,7 +308,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
56 | token == "s3cr3t"
|
./resources/test/fixtures/flake8_bandit/S105.py:53:11: S105 Possible hardcoded password: "s3cr3t"
S105.py:53:11: S105 Possible hardcoded password: "s3cr3t"
|
53 | passwd == "s3cr3t"
54 | pwd == "s3cr3t"
@ -318,7 +318,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
57 | secrete == "s3cr3t"
|
./resources/test/fixtures/flake8_bandit/S105.py:54:10: S105 Possible hardcoded password: "s3cr3t"
S105.py:54:10: S105 Possible hardcoded password: "s3cr3t"
|
54 | pwd == "s3cr3t"
55 | secret == "s3cr3t"
@ -328,7 +328,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
58 | password == safe == "s3cr3t"
|
./resources/test/fixtures/flake8_bandit/S105.py:55:12: S105 Possible hardcoded password: "s3cr3t"
S105.py:55:12: S105 Possible hardcoded password: "s3cr3t"
|
55 | secret == "s3cr3t"
56 | token == "s3cr3t"
@ -337,7 +337,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
58 | password == safe == "s3cr3t"
|
./resources/test/fixtures/flake8_bandit/S105.py:56:21: S105 Possible hardcoded password: "s3cr3t"
S105.py:56:21: S105 Possible hardcoded password: "s3cr3t"
|
56 | token == "s3cr3t"
57 | secrete == "s3cr3t"
@ -347,7 +347,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
60 | if token == "1\n2":
|
./resources/test/fixtures/flake8_bandit/S105.py:58:13: S105 Possible hardcoded password: "1\n2"
S105.py:58:13: S105 Possible hardcoded password: "1\n2"
|
58 | password == safe == "s3cr3t"
59 |
@ -356,7 +356,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
61 | pass
|
./resources/test/fixtures/flake8_bandit/S105.py:61:13: S105 Possible hardcoded password: "3\t4"
S105.py:61:13: S105 Possible hardcoded password: "3\t4"
|
61 | pass
62 |
@ -365,7 +365,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
64 | pass
|
./resources/test/fixtures/flake8_bandit/S105.py:64:13: S105 Possible hardcoded password: "5\r6"
S105.py:64:13: S105 Possible hardcoded password: "5\r6"
|
64 | pass
65 |

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_bandit/mod.rs
---
./resources/test/fixtures/flake8_bandit/S106.py:14:9: S106 Possible hardcoded password: "s3cr3t"
S106.py:14:9: S106 Possible hardcoded password: "s3cr3t"
|
14 | # Error
15 | func(1, password="s3cr3t")

View file

@ -1,35 +1,35 @@
---
source: crates/ruff/src/rules/flake8_bandit/mod.rs
---
./resources/test/fixtures/flake8_bandit/S107.py:5:29: S107 Possible hardcoded password: "default"
S107.py:5:29: S107 Possible hardcoded password: "default"
|
5 | def default(first, password="default"):
| ^^^^^^^^^ S107
6 | pass
|
./resources/test/fixtures/flake8_bandit/S107.py:13:45: S107 Possible hardcoded password: "posonly"
S107.py:13:45: S107 Possible hardcoded password: "posonly"
|
13 | def default_posonly(first, /, pos, password="posonly"):
| ^^^^^^^^^ S107
14 | pass
|
./resources/test/fixtures/flake8_bandit/S107.py:21:39: S107 Possible hardcoded password: "kwonly"
S107.py:21:39: S107 Possible hardcoded password: "kwonly"
|
21 | def default_kwonly(first, *, password="kwonly"):
| ^^^^^^^^ S107
22 | pass
|
./resources/test/fixtures/flake8_bandit/S107.py:29:39: S107 Possible hardcoded password: "posonly"
S107.py:29:39: S107 Possible hardcoded password: "posonly"
|
29 | def default_all(first, /, pos, secret="posonly", *, password="kwonly"):
| ^^^^^^^^^ S107
30 | pass
|
./resources/test/fixtures/flake8_bandit/S107.py:29:62: S107 Possible hardcoded password: "kwonly"
S107.py:29:62: S107 Possible hardcoded password: "kwonly"
|
29 | def default_all(first, /, pos, secret="posonly", *, password="kwonly"):
| ^^^^^^^^ S107

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_bandit/mod.rs
---
./resources/test/fixtures/flake8_bandit/S108.py:5:11: S108 Probable insecure usage of temporary file or directory: "/tmp/abc"
S108.py:5:11: S108 Probable insecure usage of temporary file or directory: "/tmp/abc"
|
5 | f.write("def")
6 |
@ -10,7 +10,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
8 | f.write("def")
|
./resources/test/fixtures/flake8_bandit/S108.py:8:11: S108 Probable insecure usage of temporary file or directory: "/var/tmp/123"
S108.py:8:11: S108 Probable insecure usage of temporary file or directory: "/var/tmp/123"
|
8 | f.write("def")
9 |
@ -19,7 +19,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
11 | f.write("def")
|
./resources/test/fixtures/flake8_bandit/S108.py:11:11: S108 Probable insecure usage of temporary file or directory: "/dev/shm/unit/test"
S108.py:11:11: S108 Probable insecure usage of temporary file or directory: "/dev/shm/unit/test"
|
11 | f.write("def")
12 |

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_bandit/mod.rs
---
./resources/test/fixtures/flake8_bandit/S108.py:5:11: S108 Probable insecure usage of temporary file or directory: "/tmp/abc"
S108.py:5:11: S108 Probable insecure usage of temporary file or directory: "/tmp/abc"
|
5 | f.write("def")
6 |
@ -10,7 +10,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
8 | f.write("def")
|
./resources/test/fixtures/flake8_bandit/S108.py:8:11: S108 Probable insecure usage of temporary file or directory: "/var/tmp/123"
S108.py:8:11: S108 Probable insecure usage of temporary file or directory: "/var/tmp/123"
|
8 | f.write("def")
9 |
@ -19,7 +19,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
11 | f.write("def")
|
./resources/test/fixtures/flake8_bandit/S108.py:11:11: S108 Probable insecure usage of temporary file or directory: "/dev/shm/unit/test"
S108.py:11:11: S108 Probable insecure usage of temporary file or directory: "/dev/shm/unit/test"
|
11 | f.write("def")
12 |
@ -28,7 +28,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
14 | f.write("def")
|
./resources/test/fixtures/flake8_bandit/S108.py:15:11: S108 Probable insecure usage of temporary file or directory: "/foo/bar"
S108.py:15:11: S108 Probable insecure usage of temporary file or directory: "/foo/bar"
|
15 | # not ok by config
16 | with open("/foo/bar", "w") as f:

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_bandit/mod.rs
---
./resources/test/fixtures/flake8_bandit/S110.py:3:1: S110 `try`-`except`-`pass` detected, consider logging the exception
S110.py:3:1: S110 `try`-`except`-`pass` detected, consider logging the exception
|
3 | try:
4 | pass
@ -12,7 +12,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
8 | try:
|
./resources/test/fixtures/flake8_bandit/S110.py:8:1: S110 `try`-`except`-`pass` detected, consider logging the exception
S110.py:8:1: S110 `try`-`except`-`pass` detected, consider logging the exception
|
8 | try:
9 | pass

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_bandit/mod.rs
---
./resources/test/fixtures/flake8_bandit/S110.py:3:1: S110 `try`-`except`-`pass` detected, consider logging the exception
S110.py:3:1: S110 `try`-`except`-`pass` detected, consider logging the exception
|
3 | try:
4 | pass
@ -12,7 +12,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
8 | try:
|
./resources/test/fixtures/flake8_bandit/S110.py:8:1: S110 `try`-`except`-`pass` detected, consider logging the exception
S110.py:8:1: S110 `try`-`except`-`pass` detected, consider logging the exception
|
8 | try:
9 | pass
@ -23,7 +23,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
13 | try:
|
./resources/test/fixtures/flake8_bandit/S110.py:13:1: S110 `try`-`except`-`pass` detected, consider logging the exception
S110.py:13:1: S110 `try`-`except`-`pass` detected, consider logging the exception
|
13 | try:
14 | pass

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_bandit/mod.rs
---
./resources/test/fixtures/flake8_bandit/S112.py:3:1: S112 `try`-`except`-`continue` detected, consider logging the exception
S112.py:3:1: S112 `try`-`except`-`continue` detected, consider logging the exception
|
3 | try:
4 | pass
@ -12,7 +12,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
8 | try:
|
./resources/test/fixtures/flake8_bandit/S112.py:8:1: S112 `try`-`except`-`continue` detected, consider logging the exception
S112.py:8:1: S112 `try`-`except`-`continue` detected, consider logging the exception
|
8 | try:
9 | pass
@ -23,7 +23,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
13 | try:
|
./resources/test/fixtures/flake8_bandit/S112.py:13:1: S112 `try`-`except`-`continue` detected, consider logging the exception
S112.py:13:1: S112 `try`-`except`-`continue` detected, consider logging the exception
|
13 | try:
14 | pass
@ -34,7 +34,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
18 | try:
|
./resources/test/fixtures/flake8_bandit/S112.py:18:1: S112 `try`-`except`-`continue` detected, consider logging the exception
S112.py:18:1: S112 `try`-`except`-`continue` detected, consider logging the exception
|
18 | try:
19 | pass

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_bandit/mod.rs
---
./resources/test/fixtures/flake8_bandit/S113.py:3:1: S113 Probable use of requests call without timeout
S113.py:3:1: S113 Probable use of requests call without timeout
|
3 | import requests
4 |
@ -11,7 +11,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
7 | requests.get('https://gmail.com', timeout=5)
|
./resources/test/fixtures/flake8_bandit/S113.py:4:43: S113 Probable use of requests call with timeout set to `None`
S113.py:4:43: S113 Probable use of requests call with timeout set to `None`
|
4 | requests.get('https://gmail.com')
5 | requests.get('https://gmail.com', timeout=None)
@ -20,7 +20,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
7 | requests.post('https://gmail.com')
|
./resources/test/fixtures/flake8_bandit/S113.py:6:1: S113 Probable use of requests call without timeout
S113.py:6:1: S113 Probable use of requests call without timeout
|
6 | requests.get('https://gmail.com', timeout=None)
7 | requests.get('https://gmail.com', timeout=5)
@ -30,7 +30,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
10 | requests.post('https://gmail.com', timeout=5)
|
./resources/test/fixtures/flake8_bandit/S113.py:7:44: S113 Probable use of requests call with timeout set to `None`
S113.py:7:44: S113 Probable use of requests call with timeout set to `None`
|
7 | requests.get('https://gmail.com', timeout=5)
8 | requests.post('https://gmail.com')
@ -40,7 +40,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
11 | requests.put('https://gmail.com')
|
./resources/test/fixtures/flake8_bandit/S113.py:9:1: S113 Probable use of requests call without timeout
S113.py:9:1: S113 Probable use of requests call without timeout
|
9 | requests.post('https://gmail.com', timeout=None)
10 | requests.post('https://gmail.com', timeout=5)
@ -50,7 +50,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
13 | requests.put('https://gmail.com', timeout=5)
|
./resources/test/fixtures/flake8_bandit/S113.py:10:43: S113 Probable use of requests call with timeout set to `None`
S113.py:10:43: S113 Probable use of requests call with timeout set to `None`
|
10 | requests.post('https://gmail.com', timeout=5)
11 | requests.put('https://gmail.com')
@ -60,7 +60,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
14 | requests.delete('https://gmail.com')
|
./resources/test/fixtures/flake8_bandit/S113.py:12:1: S113 Probable use of requests call without timeout
S113.py:12:1: S113 Probable use of requests call without timeout
|
12 | requests.put('https://gmail.com', timeout=None)
13 | requests.put('https://gmail.com', timeout=5)
@ -70,7 +70,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
16 | requests.delete('https://gmail.com', timeout=5)
|
./resources/test/fixtures/flake8_bandit/S113.py:13:46: S113 Probable use of requests call with timeout set to `None`
S113.py:13:46: S113 Probable use of requests call with timeout set to `None`
|
13 | requests.put('https://gmail.com', timeout=5)
14 | requests.delete('https://gmail.com')
@ -80,7 +80,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
17 | requests.patch('https://gmail.com')
|
./resources/test/fixtures/flake8_bandit/S113.py:15:1: S113 Probable use of requests call without timeout
S113.py:15:1: S113 Probable use of requests call without timeout
|
15 | requests.delete('https://gmail.com', timeout=None)
16 | requests.delete('https://gmail.com', timeout=5)
@ -90,7 +90,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
19 | requests.patch('https://gmail.com', timeout=5)
|
./resources/test/fixtures/flake8_bandit/S113.py:16:45: S113 Probable use of requests call with timeout set to `None`
S113.py:16:45: S113 Probable use of requests call with timeout set to `None`
|
16 | requests.delete('https://gmail.com', timeout=5)
17 | requests.patch('https://gmail.com')
@ -100,7 +100,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
20 | requests.options('https://gmail.com')
|
./resources/test/fixtures/flake8_bandit/S113.py:18:1: S113 Probable use of requests call without timeout
S113.py:18:1: S113 Probable use of requests call without timeout
|
18 | requests.patch('https://gmail.com', timeout=None)
19 | requests.patch('https://gmail.com', timeout=5)
@ -110,7 +110,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
22 | requests.options('https://gmail.com', timeout=5)
|
./resources/test/fixtures/flake8_bandit/S113.py:19:47: S113 Probable use of requests call with timeout set to `None`
S113.py:19:47: S113 Probable use of requests call with timeout set to `None`
|
19 | requests.patch('https://gmail.com', timeout=5)
20 | requests.options('https://gmail.com')
@ -120,7 +120,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
23 | requests.head('https://gmail.com')
|
./resources/test/fixtures/flake8_bandit/S113.py:21:1: S113 Probable use of requests call without timeout
S113.py:21:1: S113 Probable use of requests call without timeout
|
21 | requests.options('https://gmail.com', timeout=None)
22 | requests.options('https://gmail.com', timeout=5)
@ -130,7 +130,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
25 | requests.head('https://gmail.com', timeout=5)
|
./resources/test/fixtures/flake8_bandit/S113.py:22:44: S113 Probable use of requests call with timeout set to `None`
S113.py:22:44: S113 Probable use of requests call with timeout set to `None`
|
22 | requests.options('https://gmail.com', timeout=5)
23 | requests.head('https://gmail.com')

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_bandit/mod.rs
---
./resources/test/fixtures/flake8_bandit/S301.py:3:1: S301 `pickle` and modules that wrap it can be unsafe when used to deserialize untrusted data, possible security issue
S301.py:3:1: S301 `pickle` and modules that wrap it can be unsafe when used to deserialize untrusted data, possible security issue
|
3 | import pickle
4 |

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_bandit/mod.rs
---
./resources/test/fixtures/flake8_bandit/S312.py:3:1: S312 Telnet-related functions are being called. Telnet is considered insecure. Use SSH or some other encrypted protocol.
S312.py:3:1: S312 Telnet-related functions are being called. Telnet is considered insecure. Use SSH or some other encrypted protocol.
|
3 | from telnetlib import Telnet
4 |

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_bandit/mod.rs
---
./resources/test/fixtures/flake8_bandit/S324.py:7:13: S324 Probable use of insecure hash functions in `hashlib`: `md5`
S324.py:7:13: S324 Probable use of insecure hash functions in `hashlib`: `md5`
|
7 | # Invalid
8 |
@ -11,7 +11,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
11 | hashlib.new('md4', b'test')
|
./resources/test/fixtures/flake8_bandit/S324.py:9:13: S324 Probable use of insecure hash functions in `hashlib`: `md4`
S324.py:9:13: S324 Probable use of insecure hash functions in `hashlib`: `md4`
|
9 | hashlib.new('md5')
10 |
@ -21,7 +21,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
13 | hashlib.new(name='md5', data=b'test')
|
./resources/test/fixtures/flake8_bandit/S324.py:11:18: S324 Probable use of insecure hash functions in `hashlib`: `md5`
S324.py:11:18: S324 Probable use of insecure hash functions in `hashlib`: `md5`
|
11 | hashlib.new('md4', b'test')
12 |
@ -31,7 +31,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
15 | hashlib.new('MD4', data=b'test')
|
./resources/test/fixtures/flake8_bandit/S324.py:13:13: S324 Probable use of insecure hash functions in `hashlib`: `MD4`
S324.py:13:13: S324 Probable use of insecure hash functions in `hashlib`: `MD4`
|
13 | hashlib.new(name='md5', data=b'test')
14 |
@ -41,7 +41,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
17 | hashlib.new('sha1')
|
./resources/test/fixtures/flake8_bandit/S324.py:15:13: S324 Probable use of insecure hash functions in `hashlib`: `sha1`
S324.py:15:13: S324 Probable use of insecure hash functions in `hashlib`: `sha1`
|
15 | hashlib.new('MD4', data=b'test')
16 |
@ -51,7 +51,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
19 | hashlib.new('sha1', data=b'test')
|
./resources/test/fixtures/flake8_bandit/S324.py:17:13: S324 Probable use of insecure hash functions in `hashlib`: `sha1`
S324.py:17:13: S324 Probable use of insecure hash functions in `hashlib`: `sha1`
|
17 | hashlib.new('sha1')
18 |
@ -61,7 +61,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
21 | hashlib.new('sha', data=b'test')
|
./resources/test/fixtures/flake8_bandit/S324.py:19:13: S324 Probable use of insecure hash functions in `hashlib`: `sha`
S324.py:19:13: S324 Probable use of insecure hash functions in `hashlib`: `sha`
|
19 | hashlib.new('sha1', data=b'test')
20 |
@ -71,7 +71,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
23 | hashlib.new(name='SHA', data=b'test')
|
./resources/test/fixtures/flake8_bandit/S324.py:21:18: S324 Probable use of insecure hash functions in `hashlib`: `SHA`
S324.py:21:18: S324 Probable use of insecure hash functions in `hashlib`: `SHA`
|
21 | hashlib.new('sha', data=b'test')
22 |
@ -81,7 +81,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
25 | hashlib.sha(data=b'test')
|
./resources/test/fixtures/flake8_bandit/S324.py:23:1: S324 Probable use of insecure hash functions in `hashlib`: `sha`
S324.py:23:1: S324 Probable use of insecure hash functions in `hashlib`: `sha`
|
23 | hashlib.new(name='SHA', data=b'test')
24 |
@ -91,7 +91,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
27 | hashlib.md5()
|
./resources/test/fixtures/flake8_bandit/S324.py:25:1: S324 Probable use of insecure hash functions in `hashlib`: `md5`
S324.py:25:1: S324 Probable use of insecure hash functions in `hashlib`: `md5`
|
25 | hashlib.sha(data=b'test')
26 |
@ -101,7 +101,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
29 | hashlib_new('sha1')
|
./resources/test/fixtures/flake8_bandit/S324.py:27:13: S324 Probable use of insecure hash functions in `hashlib`: `sha1`
S324.py:27:13: S324 Probable use of insecure hash functions in `hashlib`: `sha1`
|
27 | hashlib.md5()
28 |
@ -111,7 +111,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
31 | hashlib_sha1('sha1')
|
./resources/test/fixtures/flake8_bandit/S324.py:29:1: S324 Probable use of insecure hash functions in `hashlib`: `sha1`
S324.py:29:1: S324 Probable use of insecure hash functions in `hashlib`: `sha1`
|
29 | hashlib_new('sha1')
30 |
@ -121,7 +121,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
33 | # usedforsecurity arg only available in Python 3.9+
|
./resources/test/fixtures/flake8_bandit/S324.py:32:13: S324 Probable use of insecure hash functions in `hashlib`: `sha1`
S324.py:32:13: S324 Probable use of insecure hash functions in `hashlib`: `sha1`
|
32 | # usedforsecurity arg only available in Python 3.9+
33 | hashlib.new('sha1', usedforsecurity=True)

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_bandit/mod.rs
---
./resources/test/fixtures/flake8_bandit/S501.py:5:54: S501 Probable use of `requests` call with `verify=False` disabling SSL certificate checks
S501.py:5:54: S501 Probable use of `requests` call with `verify=False` disabling SSL certificate checks
|
5 | requests.get('https://gmail.com', timeout=30, verify=True)
6 | requests.get('https://gmail.com', timeout=30, verify=False)
@ -10,7 +10,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
8 | requests.post('https://gmail.com', timeout=30, verify=False)
|
./resources/test/fixtures/flake8_bandit/S501.py:7:55: S501 Probable use of `requests` call with `verify=False` disabling SSL certificate checks
S501.py:7:55: S501 Probable use of `requests` call with `verify=False` disabling SSL certificate checks
|
7 | requests.get('https://gmail.com', timeout=30, verify=False)
8 | requests.post('https://gmail.com', timeout=30, verify=True)
@ -20,7 +20,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
11 | requests.put('https://gmail.com', timeout=30, verify=False)
|
./resources/test/fixtures/flake8_bandit/S501.py:9:54: S501 Probable use of `requests` call with `verify=False` disabling SSL certificate checks
S501.py:9:54: S501 Probable use of `requests` call with `verify=False` disabling SSL certificate checks
|
9 | requests.post('https://gmail.com', timeout=30, verify=False)
10 | requests.put('https://gmail.com', timeout=30, verify=True)
@ -30,7 +30,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
13 | requests.delete('https://gmail.com', timeout=30, verify=False)
|
./resources/test/fixtures/flake8_bandit/S501.py:11:57: S501 Probable use of `requests` call with `verify=False` disabling SSL certificate checks
S501.py:11:57: S501 Probable use of `requests` call with `verify=False` disabling SSL certificate checks
|
11 | requests.put('https://gmail.com', timeout=30, verify=False)
12 | requests.delete('https://gmail.com', timeout=30, verify=True)
@ -40,7 +40,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
15 | requests.patch('https://gmail.com', timeout=30, verify=False)
|
./resources/test/fixtures/flake8_bandit/S501.py:13:56: S501 Probable use of `requests` call with `verify=False` disabling SSL certificate checks
S501.py:13:56: S501 Probable use of `requests` call with `verify=False` disabling SSL certificate checks
|
13 | requests.delete('https://gmail.com', timeout=30, verify=False)
14 | requests.patch('https://gmail.com', timeout=30, verify=True)
@ -50,7 +50,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
17 | requests.options('https://gmail.com', timeout=30, verify=False)
|
./resources/test/fixtures/flake8_bandit/S501.py:15:58: S501 Probable use of `requests` call with `verify=False` disabling SSL certificate checks
S501.py:15:58: S501 Probable use of `requests` call with `verify=False` disabling SSL certificate checks
|
15 | requests.patch('https://gmail.com', timeout=30, verify=False)
16 | requests.options('https://gmail.com', timeout=30, verify=True)
@ -60,7 +60,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
19 | requests.head('https://gmail.com', timeout=30, verify=False)
|
./resources/test/fixtures/flake8_bandit/S501.py:17:55: S501 Probable use of `requests` call with `verify=False` disabling SSL certificate checks
S501.py:17:55: S501 Probable use of `requests` call with `verify=False` disabling SSL certificate checks
|
17 | requests.options('https://gmail.com', timeout=30, verify=False)
18 | requests.head('https://gmail.com', timeout=30, verify=True)
@ -70,7 +70,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
21 | httpx.request('GET', 'https://gmail.com', verify=True)
|
./resources/test/fixtures/flake8_bandit/S501.py:20:50: S501 Probable use of `httpx` call with `verify=False` disabling SSL certificate checks
S501.py:20:50: S501 Probable use of `httpx` call with `verify=False` disabling SSL certificate checks
|
20 | httpx.request('GET', 'https://gmail.com', verify=True)
21 | httpx.request('GET', 'https://gmail.com', verify=False)
@ -79,7 +79,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
23 | httpx.get('https://gmail.com', verify=False)
|
./resources/test/fixtures/flake8_bandit/S501.py:22:39: S501 Probable use of `httpx` call with `verify=False` disabling SSL certificate checks
S501.py:22:39: S501 Probable use of `httpx` call with `verify=False` disabling SSL certificate checks
|
22 | httpx.request('GET', 'https://gmail.com', verify=False)
23 | httpx.get('https://gmail.com', verify=True)
@ -89,7 +89,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
26 | httpx.options('https://gmail.com', verify=False)
|
./resources/test/fixtures/flake8_bandit/S501.py:24:43: S501 Probable use of `httpx` call with `verify=False` disabling SSL certificate checks
S501.py:24:43: S501 Probable use of `httpx` call with `verify=False` disabling SSL certificate checks
|
24 | httpx.get('https://gmail.com', verify=False)
25 | httpx.options('https://gmail.com', verify=True)
@ -99,7 +99,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
28 | httpx.head('https://gmail.com', verify=False)
|
./resources/test/fixtures/flake8_bandit/S501.py:26:40: S501 Probable use of `httpx` call with `verify=False` disabling SSL certificate checks
S501.py:26:40: S501 Probable use of `httpx` call with `verify=False` disabling SSL certificate checks
|
26 | httpx.options('https://gmail.com', verify=False)
27 | httpx.head('https://gmail.com', verify=True)
@ -109,7 +109,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
30 | httpx.post('https://gmail.com', verify=False)
|
./resources/test/fixtures/flake8_bandit/S501.py:28:40: S501 Probable use of `httpx` call with `verify=False` disabling SSL certificate checks
S501.py:28:40: S501 Probable use of `httpx` call with `verify=False` disabling SSL certificate checks
|
28 | httpx.head('https://gmail.com', verify=False)
29 | httpx.post('https://gmail.com', verify=True)
@ -119,7 +119,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
32 | httpx.put('https://gmail.com', verify=False)
|
./resources/test/fixtures/flake8_bandit/S501.py:30:39: S501 Probable use of `httpx` call with `verify=False` disabling SSL certificate checks
S501.py:30:39: S501 Probable use of `httpx` call with `verify=False` disabling SSL certificate checks
|
30 | httpx.post('https://gmail.com', verify=False)
31 | httpx.put('https://gmail.com', verify=True)
@ -129,7 +129,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
34 | httpx.patch('https://gmail.com', verify=False)
|
./resources/test/fixtures/flake8_bandit/S501.py:32:41: S501 Probable use of `httpx` call with `verify=False` disabling SSL certificate checks
S501.py:32:41: S501 Probable use of `httpx` call with `verify=False` disabling SSL certificate checks
|
32 | httpx.put('https://gmail.com', verify=False)
33 | httpx.patch('https://gmail.com', verify=True)
@ -139,7 +139,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
36 | httpx.delete('https://gmail.com', verify=False)
|
./resources/test/fixtures/flake8_bandit/S501.py:34:42: S501 Probable use of `httpx` call with `verify=False` disabling SSL certificate checks
S501.py:34:42: S501 Probable use of `httpx` call with `verify=False` disabling SSL certificate checks
|
34 | httpx.patch('https://gmail.com', verify=False)
35 | httpx.delete('https://gmail.com', verify=True)
@ -149,7 +149,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
38 | httpx.stream('https://gmail.com', verify=False)
|
./resources/test/fixtures/flake8_bandit/S501.py:36:42: S501 Probable use of `httpx` call with `verify=False` disabling SSL certificate checks
S501.py:36:42: S501 Probable use of `httpx` call with `verify=False` disabling SSL certificate checks
|
36 | httpx.delete('https://gmail.com', verify=False)
37 | httpx.stream('https://gmail.com', verify=True)
@ -159,7 +159,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
40 | httpx.Client(verify=False)
|
./resources/test/fixtures/flake8_bandit/S501.py:38:21: S501 Probable use of `httpx` call with `verify=False` disabling SSL certificate checks
S501.py:38:21: S501 Probable use of `httpx` call with `verify=False` disabling SSL certificate checks
|
38 | httpx.stream('https://gmail.com', verify=False)
39 | httpx.Client()
@ -169,7 +169,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
42 | httpx.AsyncClient(verify=False)
|
./resources/test/fixtures/flake8_bandit/S501.py:40:26: S501 Probable use of `httpx` call with `verify=False` disabling SSL certificate checks
S501.py:40:26: S501 Probable use of `httpx` call with `verify=False` disabling SSL certificate checks
|
40 | httpx.Client(verify=False)
41 | httpx.AsyncClient()

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_bandit/mod.rs
---
./resources/test/fixtures/flake8_bandit/S506.py:10:9: S506 Probable use of unsafe `yaml.load`. Allows instantiation of arbitrary objects. Consider `yaml.safe_load`.
S506.py:10:9: S506 Probable use of unsafe `yaml.load`. Allows instantiation of arbitrary objects. Consider `yaml.safe_load`.
|
10 | def test_yaml_load():
11 | ystr = yaml.dump({"a": 1, "b": 2, "c": 3})
@ -11,7 +11,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
14 | try:
|
./resources/test/fixtures/flake8_bandit/S506.py:24:24: S506 Probable use of unsafe loader `Loader` with `yaml.load`. Allows instantiation of arbitrary objects. Consider `yaml.safe_load`.
S506.py:24:24: S506 Probable use of unsafe loader `Loader` with `yaml.load`. Allows instantiation of arbitrary objects. Consider `yaml.safe_load`.
|
24 | yaml.load("{}", Loader=yaml.Loader)
| ^^^^^^^^^^^ S506

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_bandit/mod.rs
---
./resources/test/fixtures/flake8_bandit/S508.py:3:33: S508 The use of SNMPv1 and SNMPv2 is insecure. Use SNMPv3 if able.
S508.py:3:33: S508 The use of SNMPv1 and SNMPv2 is insecure. Use SNMPv3 if able.
|
3 | from pysnmp.hlapi import CommunityData
4 |
@ -10,7 +10,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
6 | CommunityData("public", mpModel=1) # S508
|
./resources/test/fixtures/flake8_bandit/S508.py:4:33: S508 The use of SNMPv1 and SNMPv2 is insecure. Use SNMPv3 if able.
S508.py:4:33: S508 The use of SNMPv1 and SNMPv2 is insecure. Use SNMPv3 if able.
|
4 | CommunityData("public", mpModel=0) # S508
5 | CommunityData("public", mpModel=1) # S508

View file

@ -1,14 +1,14 @@
---
source: crates/ruff/src/rules/flake8_bandit/mod.rs
---
./resources/test/fixtures/flake8_bandit/S509.py:4:12: S509 You should not use SNMPv3 without encryption. `noAuthNoPriv` & `authNoPriv` is insecure.
S509.py:4:12: S509 You should not use SNMPv3 without encryption. `noAuthNoPriv` & `authNoPriv` is insecure.
|
4 | insecure = UsmUserData("securityName") # S509
| ^^^^^^^^^^^ S509
5 | auth_no_priv = UsmUserData("securityName", "authName") # S509
|
./resources/test/fixtures/flake8_bandit/S509.py:5:16: S509 You should not use SNMPv3 without encryption. `noAuthNoPriv` & `authNoPriv` is insecure.
S509.py:5:16: S509 You should not use SNMPv3 without encryption. `noAuthNoPriv` & `authNoPriv` is insecure.
|
5 | insecure = UsmUserData("securityName") # S509
6 | auth_no_priv = UsmUserData("securityName", "authName") # S509

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_bandit/mod.rs
---
./resources/test/fixtures/flake8_bandit/S608.py:2:10: S608 Possible SQL injection vector through string-based query construction
S608.py:2:10: S608 Possible SQL injection vector through string-based query construction
|
2 | # single-line failures
3 | query1 = "SELECT %s FROM table" % (var,) # bad
@ -10,7 +10,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
5 | query3 = "SELECT " + val + " FROM " + table
|
./resources/test/fixtures/flake8_bandit/S608.py:3:10: S608 Possible SQL injection vector through string-based query construction
S608.py:3:10: S608 Possible SQL injection vector through string-based query construction
|
3 | # single-line failures
4 | query1 = "SELECT %s FROM table" % (var,) # bad
@ -20,7 +20,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
7 | query4 = "SELECT {} FROM table;".format(var)
|
./resources/test/fixtures/flake8_bandit/S608.py:4:10: S608 Possible SQL injection vector through string-based query construction
S608.py:4:10: S608 Possible SQL injection vector through string-based query construction
|
4 | query1 = "SELECT %s FROM table" % (var,) # bad
5 | query2 = "SELECT var FROM " + table
@ -30,7 +30,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
8 | query5 = f"SELECT * FROM table WHERE var = {var}"
|
./resources/test/fixtures/flake8_bandit/S608.py:5:10: S608 Possible SQL injection vector through string-based query construction
S608.py:5:10: S608 Possible SQL injection vector through string-based query construction
|
5 | query2 = "SELECT var FROM " + table
6 | query3 = "SELECT " + val + " FROM " + table
@ -39,7 +39,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
8 | query5 = f"SELECT * FROM table WHERE var = {var}"
|
./resources/test/fixtures/flake8_bandit/S608.py:6:10: S608 Possible SQL injection vector through string-based query construction
S608.py:6:10: S608 Possible SQL injection vector through string-based query construction
|
6 | query3 = "SELECT " + val + " FROM " + table
7 | query4 = "SELECT {} FROM table;".format(var)
@ -49,7 +49,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
10 | query6 = "DELETE FROM table WHERE var = %s" % (var,)
|
./resources/test/fixtures/flake8_bandit/S608.py:8:10: S608 Possible SQL injection vector through string-based query construction
S608.py:8:10: S608 Possible SQL injection vector through string-based query construction
|
8 | query5 = f"SELECT * FROM table WHERE var = {var}"
9 |
@ -59,7 +59,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
12 | query8 = "DELETE FROM " + table + "WHERE var = " + var
|
./resources/test/fixtures/flake8_bandit/S608.py:9:10: S608 Possible SQL injection vector through string-based query construction
S608.py:9:10: S608 Possible SQL injection vector through string-based query construction
|
9 | query6 = "DELETE FROM table WHERE var = %s" % (var,)
10 | query7 = "DELETE FROM table WHERE VAR = " + var
@ -68,7 +68,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
12 | query9 = "DELETE FROM table WHERE var = {}".format(var)
|
./resources/test/fixtures/flake8_bandit/S608.py:10:10: S608 Possible SQL injection vector through string-based query construction
S608.py:10:10: S608 Possible SQL injection vector through string-based query construction
|
10 | query6 = "DELETE FROM table WHERE var = %s" % (var,)
11 | query7 = "DELETE FROM table WHERE VAR = " + var
@ -78,7 +78,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
14 | query10 = f"DELETE FROM table WHERE var = {var}"
|
./resources/test/fixtures/flake8_bandit/S608.py:11:10: S608 Possible SQL injection vector through string-based query construction
S608.py:11:10: S608 Possible SQL injection vector through string-based query construction
|
11 | query7 = "DELETE FROM table WHERE VAR = " + var
12 | query8 = "DELETE FROM " + table + "WHERE var = " + var
@ -87,7 +87,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
14 | query10 = f"DELETE FROM table WHERE var = {var}"
|
./resources/test/fixtures/flake8_bandit/S608.py:12:11: S608 Possible SQL injection vector through string-based query construction
S608.py:12:11: S608 Possible SQL injection vector through string-based query construction
|
12 | query8 = "DELETE FROM " + table + "WHERE var = " + var
13 | query9 = "DELETE FROM table WHERE var = {}".format(var)
@ -97,7 +97,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
16 | query11 = "INSERT INTO table VALUES (%s)" % (var,)
|
./resources/test/fixtures/flake8_bandit/S608.py:14:11: S608 Possible SQL injection vector through string-based query construction
S608.py:14:11: S608 Possible SQL injection vector through string-based query construction
|
14 | query10 = f"DELETE FROM table WHERE var = {var}"
15 |
@ -107,7 +107,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
18 | query13 = "INSERT INTO {} VALUES ({})".format(table, var)
|
./resources/test/fixtures/flake8_bandit/S608.py:15:11: S608 Possible SQL injection vector through string-based query construction
S608.py:15:11: S608 Possible SQL injection vector through string-based query construction
|
15 | query11 = "INSERT INTO table VALUES (%s)" % (var,)
16 | query12 = "INSERT INTO TABLE VALUES (" + var + ")"
@ -116,7 +116,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
18 | query14 = f"INSERT INTO {table} VALUES var = {var}"
|
./resources/test/fixtures/flake8_bandit/S608.py:16:11: S608 Possible SQL injection vector through string-based query construction
S608.py:16:11: S608 Possible SQL injection vector through string-based query construction
|
16 | query11 = "INSERT INTO table VALUES (%s)" % (var,)
17 | query12 = "INSERT INTO TABLE VALUES (" + var + ")"
@ -125,7 +125,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
19 | query14 = f"INSERT INTO {table} VALUES var = {var}"
|
./resources/test/fixtures/flake8_bandit/S608.py:17:11: S608 Possible SQL injection vector through string-based query construction
S608.py:17:11: S608 Possible SQL injection vector through string-based query construction
|
17 | query12 = "INSERT INTO TABLE VALUES (" + var + ")"
18 | query13 = "INSERT INTO {} VALUES ({})".format(table, var)
@ -135,7 +135,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
21 | query15 = "UPDATE %s SET var = %s" % (table, var)
|
./resources/test/fixtures/flake8_bandit/S608.py:19:11: S608 Possible SQL injection vector through string-based query construction
S608.py:19:11: S608 Possible SQL injection vector through string-based query construction
|
19 | query14 = f"INSERT INTO {table} VALUES var = {var}"
20 |
@ -145,7 +145,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
23 | query17 = "UPDATE {} SET var = {}".format(table, var)
|
./resources/test/fixtures/flake8_bandit/S608.py:20:11: S608 Possible SQL injection vector through string-based query construction
S608.py:20:11: S608 Possible SQL injection vector through string-based query construction
|
20 | query15 = "UPDATE %s SET var = %s" % (table, var)
21 | query16 = "UPDATE " + table + " SET var = " + var
@ -154,7 +154,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
23 | query18 = f"UPDATE {table} SET var = {var}"
|
./resources/test/fixtures/flake8_bandit/S608.py:21:11: S608 Possible SQL injection vector through string-based query construction
S608.py:21:11: S608 Possible SQL injection vector through string-based query construction
|
21 | query15 = "UPDATE %s SET var = %s" % (table, var)
22 | query16 = "UPDATE " + table + " SET var = " + var
@ -163,7 +163,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
24 | query18 = f"UPDATE {table} SET var = {var}"
|
./resources/test/fixtures/flake8_bandit/S608.py:22:11: S608 Possible SQL injection vector through string-based query construction
S608.py:22:11: S608 Possible SQL injection vector through string-based query construction
|
22 | query16 = "UPDATE " + table + " SET var = " + var
23 | query17 = "UPDATE {} SET var = {}".format(table, var)
@ -173,7 +173,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
26 | query19 = "select %s from table" % (var,)
|
./resources/test/fixtures/flake8_bandit/S608.py:24:11: S608 Possible SQL injection vector through string-based query construction
S608.py:24:11: S608 Possible SQL injection vector through string-based query construction
|
24 | query18 = f"UPDATE {table} SET var = {var}"
25 |
@ -183,7 +183,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
28 | query21 = "select " + val + " from " + table
|
./resources/test/fixtures/flake8_bandit/S608.py:25:11: S608 Possible SQL injection vector through string-based query construction
S608.py:25:11: S608 Possible SQL injection vector through string-based query construction
|
25 | query19 = "select %s from table" % (var,)
26 | query20 = "select var from " + table
@ -192,7 +192,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
28 | query22 = "select {} from table;".format(var)
|
./resources/test/fixtures/flake8_bandit/S608.py:26:11: S608 Possible SQL injection vector through string-based query construction
S608.py:26:11: S608 Possible SQL injection vector through string-based query construction
|
26 | query19 = "select %s from table" % (var,)
27 | query20 = "select var from " + table
@ -202,7 +202,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
30 | query23 = f"select * from table where var = {var}"
|
./resources/test/fixtures/flake8_bandit/S608.py:27:11: S608 Possible SQL injection vector through string-based query construction
S608.py:27:11: S608 Possible SQL injection vector through string-based query construction
|
27 | query20 = "select var from " + table
28 | query21 = "select " + val + " from " + table
@ -211,7 +211,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
30 | query23 = f"select * from table where var = {var}"
|
./resources/test/fixtures/flake8_bandit/S608.py:28:11: S608 Possible SQL injection vector through string-based query construction
S608.py:28:11: S608 Possible SQL injection vector through string-based query construction
|
28 | query21 = "select " + val + " from " + table
29 | query22 = "select {} from table;".format(var)
@ -221,7 +221,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
32 | query24 = "delete from table where var = %s" % (var,)
|
./resources/test/fixtures/flake8_bandit/S608.py:30:11: S608 Possible SQL injection vector through string-based query construction
S608.py:30:11: S608 Possible SQL injection vector through string-based query construction
|
30 | query23 = f"select * from table where var = {var}"
31 |
@ -231,7 +231,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
34 | query26 = "delete from " + table + "where var = " + var
|
./resources/test/fixtures/flake8_bandit/S608.py:31:11: S608 Possible SQL injection vector through string-based query construction
S608.py:31:11: S608 Possible SQL injection vector through string-based query construction
|
31 | query24 = "delete from table where var = %s" % (var,)
32 | query25 = "delete from table where var = " + var
@ -240,7 +240,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
34 | query27 = "delete from table where var = {}".format(var)
|
./resources/test/fixtures/flake8_bandit/S608.py:32:11: S608 Possible SQL injection vector through string-based query construction
S608.py:32:11: S608 Possible SQL injection vector through string-based query construction
|
32 | query24 = "delete from table where var = %s" % (var,)
33 | query25 = "delete from table where var = " + var
@ -250,7 +250,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
36 | query28 = f"delete from table where var = {var}"
|
./resources/test/fixtures/flake8_bandit/S608.py:33:11: S608 Possible SQL injection vector through string-based query construction
S608.py:33:11: S608 Possible SQL injection vector through string-based query construction
|
33 | query25 = "delete from table where var = " + var
34 | query26 = "delete from " + table + "where var = " + var
@ -259,7 +259,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
36 | query28 = f"delete from table where var = {var}"
|
./resources/test/fixtures/flake8_bandit/S608.py:34:11: S608 Possible SQL injection vector through string-based query construction
S608.py:34:11: S608 Possible SQL injection vector through string-based query construction
|
34 | query26 = "delete from " + table + "where var = " + var
35 | query27 = "delete from table where var = {}".format(var)
@ -269,7 +269,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
38 | query29 = "insert into table values (%s)" % (var,)
|
./resources/test/fixtures/flake8_bandit/S608.py:36:11: S608 Possible SQL injection vector through string-based query construction
S608.py:36:11: S608 Possible SQL injection vector through string-based query construction
|
36 | query28 = f"delete from table where var = {var}"
37 |
@ -279,7 +279,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
40 | query31 = "insert into {} values ({})".format(table, var)
|
./resources/test/fixtures/flake8_bandit/S608.py:37:11: S608 Possible SQL injection vector through string-based query construction
S608.py:37:11: S608 Possible SQL injection vector through string-based query construction
|
37 | query29 = "insert into table values (%s)" % (var,)
38 | query30 = "insert into table values (" + var + ")"
@ -288,7 +288,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
40 | query32 = f"insert into {table} values var = {var}"
|
./resources/test/fixtures/flake8_bandit/S608.py:38:11: S608 Possible SQL injection vector through string-based query construction
S608.py:38:11: S608 Possible SQL injection vector through string-based query construction
|
38 | query29 = "insert into table values (%s)" % (var,)
39 | query30 = "insert into table values (" + var + ")"
@ -297,7 +297,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
41 | query32 = f"insert into {table} values var = {var}"
|
./resources/test/fixtures/flake8_bandit/S608.py:39:11: S608 Possible SQL injection vector through string-based query construction
S608.py:39:11: S608 Possible SQL injection vector through string-based query construction
|
39 | query30 = "insert into table values (" + var + ")"
40 | query31 = "insert into {} values ({})".format(table, var)
@ -307,7 +307,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
43 | query33 = "update %s set var = %s" % (table, var)
|
./resources/test/fixtures/flake8_bandit/S608.py:41:11: S608 Possible SQL injection vector through string-based query construction
S608.py:41:11: S608 Possible SQL injection vector through string-based query construction
|
41 | query32 = f"insert into {table} values var = {var}"
42 |
@ -317,7 +317,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
45 | query35 = "update {} set var = {}".format(table, var)
|
./resources/test/fixtures/flake8_bandit/S608.py:42:11: S608 Possible SQL injection vector through string-based query construction
S608.py:42:11: S608 Possible SQL injection vector through string-based query construction
|
42 | query33 = "update %s set var = %s" % (table, var)
43 | query34 = "update " + table + " set var = " + var
@ -326,7 +326,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
45 | query36 = f"update {table} set var = {var}"
|
./resources/test/fixtures/flake8_bandit/S608.py:43:11: S608 Possible SQL injection vector through string-based query construction
S608.py:43:11: S608 Possible SQL injection vector through string-based query construction
|
43 | query33 = "update %s set var = %s" % (table, var)
44 | query34 = "update " + table + " set var = " + var
@ -335,7 +335,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
46 | query36 = f"update {table} set var = {var}"
|
./resources/test/fixtures/flake8_bandit/S608.py:44:11: S608 Possible SQL injection vector through string-based query construction
S608.py:44:11: S608 Possible SQL injection vector through string-based query construction
|
44 | query34 = "update " + table + " set var = " + var
45 | query35 = "update {} set var = {}".format(table, var)
@ -345,7 +345,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
48 | # multi-line failures
|
./resources/test/fixtures/flake8_bandit/S608.py:48:12: S608 Possible SQL injection vector through string-based query construction
S608.py:48:12: S608 Possible SQL injection vector through string-based query construction
|
48 | # multi-line failures
49 | def query37():
@ -360,7 +360,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
56 | def query38():
|
./resources/test/fixtures/flake8_bandit/S608.py:55:12: S608 Possible SQL injection vector through string-based query construction
S608.py:55:12: S608 Possible SQL injection vector through string-based query construction
|
55 | def query38():
56 | return """
@ -374,7 +374,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
62 | def query39():
|
./resources/test/fixtures/flake8_bandit/S608.py:62:12: S608 Possible SQL injection vector through string-based query construction
S608.py:62:12: S608 Possible SQL injection vector through string-based query construction
|
62 | def query39():
63 | return """
@ -388,7 +388,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
69 | def query40():
|
./resources/test/fixtures/flake8_bandit/S608.py:69:12: S608 Possible SQL injection vector through string-based query construction
S608.py:69:12: S608 Possible SQL injection vector through string-based query construction
|
69 | def query40():
70 | return f"""
@ -402,7 +402,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
76 | def query41():
|
./resources/test/fixtures/flake8_bandit/S608.py:77:9: S608 Possible SQL injection vector through string-based query construction
S608.py:77:9: S608 Possible SQL injection vector through string-based query construction
|
77 | def query41():
78 | return (
@ -414,7 +414,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
82 | )
|
./resources/test/fixtures/flake8_bandit/S608.py:83:26: S608 Possible SQL injection vector through string-based query construction
S608.py:83:26: S608 Possible SQL injection vector through string-based query construction
|
83 | # # cursor-wrapped failures
84 | query42 = cursor.execute("SELECT * FROM table WHERE var = %s" % var)
@ -423,7 +423,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
86 | query44 = cursor.execute("SELECT * FROM table WHERE var = {}".format(var))
|
./resources/test/fixtures/flake8_bandit/S608.py:84:26: S608 Possible SQL injection vector through string-based query construction
S608.py:84:26: S608 Possible SQL injection vector through string-based query construction
|
84 | # # cursor-wrapped failures
85 | query42 = cursor.execute("SELECT * FROM table WHERE var = %s" % var)
@ -433,7 +433,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
88 | query45 = cursor.executemany("SELECT * FROM table WHERE var = %s" % var, [])
|
./resources/test/fixtures/flake8_bandit/S608.py:85:26: S608 Possible SQL injection vector through string-based query construction
S608.py:85:26: S608 Possible SQL injection vector through string-based query construction
|
85 | query42 = cursor.execute("SELECT * FROM table WHERE var = %s" % var)
86 | query43 = cursor.execute(f"SELECT * FROM table WHERE var = {var}")
@ -442,7 +442,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
88 | query45 = cursor.executemany("SELECT * FROM table WHERE var = %s" % var, [])
|
./resources/test/fixtures/flake8_bandit/S608.py:86:30: S608 Possible SQL injection vector through string-based query construction
S608.py:86:30: S608 Possible SQL injection vector through string-based query construction
|
86 | query43 = cursor.execute(f"SELECT * FROM table WHERE var = {var}")
87 | query44 = cursor.execute("SELECT * FROM table WHERE var = {}".format(var))

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_bandit/mod.rs
---
./resources/test/fixtures/flake8_bandit/S612.py:3:5: S612 Use of insecure `logging.config.listen` detected
S612.py:3:5: S612 Use of insecure `logging.config.listen` detected
|
3 | import logging.config
4 |

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_bandit/mod.rs
---
./resources/test/fixtures/flake8_bandit/S701.py:9:68: S701 Using jinja2 templates with `autoescape=False` is dangerous and can lead to XSS. Ensure `autoescape=True` or use the `select_autoescape` function.
S701.py:9:68: S701 Using jinja2 templates with `autoescape=False` is dangerous and can lead to XSS. Ensure `autoescape=True` or use the `select_autoescape` function.
|
9 | templateEnv = jinja2.Environment(autoescape=True,
10 | loader=templateLoader )
@ -11,7 +11,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
13 | Environment(loader=templateLoader,
|
./resources/test/fixtures/flake8_bandit/S701.py:10:45: S701 Using jinja2 templates with `autoescape=False` is dangerous and can lead to XSS. Ensure `autoescape=True` or use the `select_autoescape` function.
S701.py:10:45: S701 Using jinja2 templates with `autoescape=False` is dangerous and can lead to XSS. Ensure `autoescape=True` or use the `select_autoescape` function.
|
10 | loader=templateLoader )
11 | Environment(loader=templateLoader, load=templateLoader, autoescape=something) # S701
@ -21,7 +21,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
14 | load=templateLoader,
|
./resources/test/fixtures/flake8_bandit/S701.py:13:24: S701 Using jinja2 templates with `autoescape=False` is dangerous and can lead to XSS. Ensure `autoescape=True` or use the `select_autoescape` function.
S701.py:13:24: S701 Using jinja2 templates with `autoescape=False` is dangerous and can lead to XSS. Ensure `autoescape=True` or use the `select_autoescape` function.
|
13 | Environment(loader=templateLoader,
14 | load=templateLoader,
@ -31,7 +31,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
17 | Environment(loader=templateLoader, # S701
|
./resources/test/fixtures/flake8_bandit/S701.py:15:1: S701 By default, jinja2 sets `autoescape` to `False`. Consider using `autoescape=True` or the `select_autoescape` function to mitigate XSS vulnerabilities.
S701.py:15:1: S701 By default, jinja2 sets `autoescape` to `False`. Consider using `autoescape=True` or the `select_autoescape` function to mitigate XSS vulnerabilities.
|
15 | autoescape=False) # S701
16 |
@ -40,7 +40,7 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
18 | load=templateLoader)
|
./resources/test/fixtures/flake8_bandit/S701.py:29:47: S701 Using jinja2 templates with `autoescape=False` is dangerous and can lead to XSS. Ensure `autoescape=True` or use the `select_autoescape` function.
S701.py:29:47: S701 Using jinja2 templates with `autoescape=False` is dangerous and can lead to XSS. Ensure `autoescape=True` or use the `select_autoescape` function.
|
29 | def fake_func():
30 | return 'foobar'

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_blind_except/mod.rs
---
./resources/test/fixtures/flake8_blind_except/BLE.py:25:8: BLE001 Do not catch blind exception: `BaseException`
BLE.py:25:8: BLE001 Do not catch blind exception: `BaseException`
|
25 | except Exception as e:
26 | raise e
@ -10,7 +10,7 @@ source: crates/ruff/src/rules/flake8_blind_except/mod.rs
28 | pass
|
./resources/test/fixtures/flake8_blind_except/BLE.py:31:8: BLE001 Do not catch blind exception: `Exception`
BLE.py:31:8: BLE001 Do not catch blind exception: `Exception`
|
31 | try:
32 | pass
@ -20,7 +20,7 @@ source: crates/ruff/src/rules/flake8_blind_except/mod.rs
35 | finally:
|
./resources/test/fixtures/flake8_blind_except/BLE.py:42:8: BLE001 Do not catch blind exception: `Exception`
BLE.py:42:8: BLE001 Do not catch blind exception: `Exception`
|
42 | try:
43 | pass
@ -30,7 +30,7 @@ source: crates/ruff/src/rules/flake8_blind_except/mod.rs
46 | raise e
|
./resources/test/fixtures/flake8_blind_except/BLE.py:45:12: BLE001 Do not catch blind exception: `BaseException`
BLE.py:45:12: BLE001 Do not catch blind exception: `BaseException`
|
45 | try:
46 | raise e
@ -39,7 +39,7 @@ source: crates/ruff/src/rules/flake8_blind_except/mod.rs
48 | pass
|
./resources/test/fixtures/flake8_blind_except/BLE.py:54:8: BLE001 Do not catch blind exception: `Exception`
BLE.py:54:8: BLE001 Do not catch blind exception: `Exception`
|
54 | except BaseException as e:
55 | raise e
@ -48,7 +48,7 @@ source: crates/ruff/src/rules/flake8_blind_except/mod.rs
57 | pass
|
./resources/test/fixtures/flake8_blind_except/BLE.py:60:8: BLE001 Do not catch blind exception: `Exception`
BLE.py:60:8: BLE001 Do not catch blind exception: `Exception`
|
60 | try:
61 | pass
@ -58,7 +58,7 @@ source: crates/ruff/src/rules/flake8_blind_except/mod.rs
64 | except BaseException:
|
./resources/test/fixtures/flake8_blind_except/BLE.py:62:8: BLE001 Do not catch blind exception: `BaseException`
BLE.py:62:8: BLE001 Do not catch blind exception: `BaseException`
|
62 | except Exception as e:
63 | raise bad
@ -67,7 +67,7 @@ source: crates/ruff/src/rules/flake8_blind_except/mod.rs
65 | pass
|
./resources/test/fixtures/flake8_blind_except/BLE.py:69:8: BLE001 Do not catch blind exception: `Exception`
BLE.py:69:8: BLE001 Do not catch blind exception: `Exception`
|
69 | try:
70 | pass
@ -76,7 +76,7 @@ source: crates/ruff/src/rules/flake8_blind_except/mod.rs
72 | logging.error("...")
|
./resources/test/fixtures/flake8_blind_except/BLE.py:75:8: BLE001 Do not catch blind exception: `Exception`
BLE.py:75:8: BLE001 Do not catch blind exception: `Exception`
|
75 | try:
76 | pass
@ -85,7 +85,7 @@ source: crates/ruff/src/rules/flake8_blind_except/mod.rs
78 | logging.error("...", exc_info=False)
|
./resources/test/fixtures/flake8_blind_except/BLE.py:81:8: BLE001 Do not catch blind exception: `Exception`
BLE.py:81:8: BLE001 Do not catch blind exception: `Exception`
|
81 | try:
82 | pass

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_boolean_trap/mod.rs
---
./resources/test/fixtures/flake8_boolean_trap/FBT.py:4:5: FBT001 Boolean positional arg in function definition
FBT.py:4:5: FBT001 Boolean positional arg in function definition
|
4 | posonly_nohint,
5 | posonly_nonboolhint: int,
@ -11,7 +11,7 @@ source: crates/ruff/src/rules/flake8_boolean_trap/mod.rs
8 | /,
|
./resources/test/fixtures/flake8_boolean_trap/FBT.py:5:5: FBT001 Boolean positional arg in function definition
FBT.py:5:5: FBT001 Boolean positional arg in function definition
|
5 | posonly_nonboolhint: int,
6 | posonly_boolhint: bool,
@ -21,7 +21,7 @@ source: crates/ruff/src/rules/flake8_boolean_trap/mod.rs
9 | offset,
|
./resources/test/fixtures/flake8_boolean_trap/FBT.py:10:5: FBT001 Boolean positional arg in function definition
FBT.py:10:5: FBT001 Boolean positional arg in function definition
|
10 | posorkw_nonvalued_nohint,
11 | posorkw_nonvalued_nonboolhint: int,
@ -31,7 +31,7 @@ source: crates/ruff/src/rules/flake8_boolean_trap/mod.rs
14 | posorkw_boolvalued_nohint=True,
|
./resources/test/fixtures/flake8_boolean_trap/FBT.py:11:5: FBT001 Boolean positional arg in function definition
FBT.py:11:5: FBT001 Boolean positional arg in function definition
|
11 | posorkw_nonvalued_nonboolhint: int,
12 | posorkw_nonvalued_boolhint: bool,
@ -41,7 +41,7 @@ source: crates/ruff/src/rules/flake8_boolean_trap/mod.rs
15 | posorkw_boolvalued_nonboolhint: int = True,
|
./resources/test/fixtures/flake8_boolean_trap/FBT.py:14:5: FBT001 Boolean positional arg in function definition
FBT.py:14:5: FBT001 Boolean positional arg in function definition
|
14 | posorkw_boolvalued_nohint=True,
15 | posorkw_boolvalued_nonboolhint: int = True,
@ -51,7 +51,7 @@ source: crates/ruff/src/rules/flake8_boolean_trap/mod.rs
18 | posorkw_nonboolvalued_nohint=1,
|
./resources/test/fixtures/flake8_boolean_trap/FBT.py:15:5: FBT001 Boolean positional arg in function definition
FBT.py:15:5: FBT001 Boolean positional arg in function definition
|
15 | posorkw_boolvalued_nonboolhint: int = True,
16 | posorkw_boolvalued_boolhint: bool = True,
@ -61,7 +61,7 @@ source: crates/ruff/src/rules/flake8_boolean_trap/mod.rs
19 | posorkw_nonboolvalued_nonboolhint: int = 2,
|
./resources/test/fixtures/flake8_boolean_trap/FBT.py:18:5: FBT001 Boolean positional arg in function definition
FBT.py:18:5: FBT001 Boolean positional arg in function definition
|
18 | posorkw_nonboolvalued_nohint=1,
19 | posorkw_nonboolvalued_nonboolhint: int = 2,
@ -71,7 +71,7 @@ source: crates/ruff/src/rules/flake8_boolean_trap/mod.rs
22 | *,
|
./resources/test/fixtures/flake8_boolean_trap/FBT.py:19:5: FBT001 Boolean positional arg in function definition
FBT.py:19:5: FBT001 Boolean positional arg in function definition
|
19 | posorkw_nonboolvalued_nonboolhint: int = 2,
20 | posorkw_nonboolvalued_boolhint: bool = 3,
@ -81,7 +81,7 @@ source: crates/ruff/src/rules/flake8_boolean_trap/mod.rs
23 | kwonly_nonvalued_nohint,
|
./resources/test/fixtures/flake8_boolean_trap/FBT.py:81:19: FBT001 Boolean positional arg in function definition
FBT.py:81:19: FBT001 Boolean positional arg in function definition
|
81 | # FBT001: Boolean positional arg in function definition
82 | def foo(self, value: bool) -> None:

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_boolean_trap/mod.rs
---
./resources/test/fixtures/flake8_boolean_trap/FBT.py:12:31: FBT002 Boolean default value in function definition
FBT.py:12:31: FBT002 Boolean default value in function definition
|
12 | posorkw_nonvalued_boolhint: bool,
13 | posorkw_nonvalued_boolstrhint: "bool",
@ -11,7 +11,7 @@ source: crates/ruff/src/rules/flake8_boolean_trap/mod.rs
16 | posorkw_boolvalued_boolhint: bool = True,
|
./resources/test/fixtures/flake8_boolean_trap/FBT.py:13:43: FBT002 Boolean default value in function definition
FBT.py:13:43: FBT002 Boolean default value in function definition
|
13 | posorkw_nonvalued_boolstrhint: "bool",
14 | posorkw_boolvalued_nohint=True,
@ -21,7 +21,7 @@ source: crates/ruff/src/rules/flake8_boolean_trap/mod.rs
17 | posorkw_boolvalued_boolstrhint: "bool" = True,
|
./resources/test/fixtures/flake8_boolean_trap/FBT.py:14:41: FBT002 Boolean default value in function definition
FBT.py:14:41: FBT002 Boolean default value in function definition
|
14 | posorkw_boolvalued_nohint=True,
15 | posorkw_boolvalued_nonboolhint: int = True,
@ -31,7 +31,7 @@ source: crates/ruff/src/rules/flake8_boolean_trap/mod.rs
18 | posorkw_nonboolvalued_nohint=1,
|
./resources/test/fixtures/flake8_boolean_trap/FBT.py:15:46: FBT002 Boolean default value in function definition
FBT.py:15:46: FBT002 Boolean default value in function definition
|
15 | posorkw_boolvalued_nonboolhint: int = True,
16 | posorkw_boolvalued_boolhint: bool = True,

View file

@ -1,14 +1,14 @@
---
source: crates/ruff/src/rules/flake8_boolean_trap/mod.rs
---
./resources/test/fixtures/flake8_boolean_trap/FBT.py:42:11: FBT003 Boolean positional value in function call
FBT.py:42:11: FBT003 Boolean positional value in function call
|
42 | used("a", True)
| ^^^^ FBT003
43 | used(do=True)
|
./resources/test/fixtures/flake8_boolean_trap/FBT.py:57:11: FBT003 Boolean positional value in function call
FBT.py:57:11: FBT003 Boolean positional value in function call
|
57 | {}.pop(True, False)
58 | dict.fromkeys(("world",), True)
@ -18,7 +18,7 @@ source: crates/ruff/src/rules/flake8_boolean_trap/mod.rs
61 | mylist.index(True)
|
./resources/test/fixtures/flake8_boolean_trap/FBT.py:57:17: FBT003 Boolean positional value in function call
FBT.py:57:17: FBT003 Boolean positional value in function call
|
57 | {}.pop(True, False)
58 | dict.fromkeys(("world",), True)

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_bugbear/mod.rs
---
./resources/test/fixtures/flake8_bugbear/B002.py:15:9: B002 Python does not support the unary prefix increment
B002.py:15:9: B002 Python does not support the unary prefix increment
|
15 | def this_is_buggy(n):
16 | x = ++n
@ -9,7 +9,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
17 | return x
|
./resources/test/fixtures/flake8_bugbear/B002.py:20:12: B002 Python does not support the unary prefix increment
B002.py:20:12: B002 Python does not support the unary prefix increment
|
20 | def this_is_buggy_too(n):
21 | return ++n

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_bugbear/mod.rs
---
./resources/test/fixtures/flake8_bugbear/B003.py:9:1: B003 Assigning to `os.environ` doesn't clear the environment
B003.py:9:1: B003 Assigning to `os.environ` doesn't clear the environment
|
9 | from os import environ
10 |

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_bugbear/mod.rs
---
./resources/test/fixtures/flake8_bugbear/B004.py:3:8: B004 Using `hasattr(x, '__call__')` to test if x is callable is unreliable. Use `callable(x)` for consistent results.
B004.py:3:8: B004 Using `hasattr(x, '__call__')` to test if x is callable is unreliable. Use `callable(x)` for consistent results.
|
3 | def this_is_a_bug():
4 | o = object()
@ -11,7 +11,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
7 | if getattr(o, "__call__", False):
|
./resources/test/fixtures/flake8_bugbear/B004.py:5:8: B004 Using `hasattr(x, '__call__')` to test if x is callable is unreliable. Use `callable(x)` for consistent results.
B004.py:5:8: B004 Using `hasattr(x, '__call__')` to test if x is callable is unreliable. Use `callable(x)` for consistent results.
|
5 | if hasattr(o, "__call__"):
6 | print("Ooh, callable! Or is it?")

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_bugbear/mod.rs
---
./resources/test/fixtures/flake8_bugbear/B005.py:4:1: B005 Using `.strip()` with multi-character strings is misleading the reader
B005.py:4:1: B005 Using `.strip()` with multi-character strings is misleading the reader
|
4 | s.strip(s) # no warning
5 | s.strip("we") # no warning
@ -11,7 +11,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
8 | s.strip("\n\t ") # no warning
|
./resources/test/fixtures/flake8_bugbear/B005.py:7:1: B005 Using `.strip()` with multi-character strings is misleading the reader
B005.py:7:1: B005 Using `.strip()` with multi-character strings is misleading the reader
|
7 | s.strip("e") # no warning
8 | s.strip("\n\t ") # no warning
@ -21,7 +21,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
11 | s.lstrip("we") # no warning
|
./resources/test/fixtures/flake8_bugbear/B005.py:10:1: B005 Using `.strip()` with multi-character strings is misleading the reader
B005.py:10:1: B005 Using `.strip()` with multi-character strings is misleading the reader
|
10 | s.lstrip(s) # no warning
11 | s.lstrip("we") # no warning
@ -31,7 +31,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
14 | s.lstrip("\n\t ") # no warning
|
./resources/test/fixtures/flake8_bugbear/B005.py:13:1: B005 Using `.strip()` with multi-character strings is misleading the reader
B005.py:13:1: B005 Using `.strip()` with multi-character strings is misleading the reader
|
13 | s.lstrip("e") # no warning
14 | s.lstrip("\n\t ") # no warning
@ -41,7 +41,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
17 | s.rstrip("we") # warning
|
./resources/test/fixtures/flake8_bugbear/B005.py:16:1: B005 Using `.strip()` with multi-character strings is misleading the reader
B005.py:16:1: B005 Using `.strip()` with multi-character strings is misleading the reader
|
16 | s.rstrip(s) # no warning
17 | s.rstrip("we") # warning
@ -51,7 +51,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
20 | s.rstrip("\n\t ") # no warning
|
./resources/test/fixtures/flake8_bugbear/B005.py:19:1: B005 Using `.strip()` with multi-character strings is misleading the reader
B005.py:19:1: B005 Using `.strip()` with multi-character strings is misleading the reader
|
19 | s.rstrip("e") # no warning
20 | s.rstrip("\n\t ") # no warning
@ -61,7 +61,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
23 | s.strip("あ") # no warning
|
./resources/test/fixtures/flake8_bugbear/B005.py:22:1: B005 Using `.strip()` with multi-character strings is misleading the reader
B005.py:22:1: B005 Using `.strip()` with multi-character strings is misleading the reader
|
22 | s.strip("a") # no warning
23 | s.strip("あ") # no warning
@ -71,7 +71,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
26 | s.strip("\u0074\u0065\u0073\u0074") # warning
|
./resources/test/fixtures/flake8_bugbear/B005.py:24:1: B005 Using `.strip()` with multi-character strings is misleading the reader
B005.py:24:1: B005 Using `.strip()` with multi-character strings is misleading the reader
|
24 | s.strip("ああ") # warning
25 | s.strip("\ufeff") # no warning

View file

@ -1,49 +1,49 @@
---
source: crates/ruff/src/rules/flake8_bugbear/mod.rs
---
./resources/test/fixtures/flake8_bugbear/B006_B008.py:62:25: B006 Do not use mutable data structures for argument defaults
B006_B008.py:62:25: B006 Do not use mutable data structures for argument defaults
|
62 | def this_is_wrong(value=[1, 2, 3]):
| ^^^^^^^^^ B006
63 | ...
|
./resources/test/fixtures/flake8_bugbear/B006_B008.py:66:30: B006 Do not use mutable data structures for argument defaults
B006_B008.py:66:30: B006 Do not use mutable data structures for argument defaults
|
66 | def this_is_also_wrong(value={}):
| ^^ B006
67 | ...
|
./resources/test/fixtures/flake8_bugbear/B006_B008.py:70:20: B006 Do not use mutable data structures for argument defaults
B006_B008.py:70:20: B006 Do not use mutable data structures for argument defaults
|
70 | def and_this(value=set()):
| ^^^^^ B006
71 | ...
|
./resources/test/fixtures/flake8_bugbear/B006_B008.py:74:20: B006 Do not use mutable data structures for argument defaults
B006_B008.py:74:20: B006 Do not use mutable data structures for argument defaults
|
74 | def this_too(value=collections.OrderedDict()):
| ^^^^^^^^^^^^^^^^^^^^^^^^^ B006
75 | ...
|
./resources/test/fixtures/flake8_bugbear/B006_B008.py:78:32: B006 Do not use mutable data structures for argument defaults
B006_B008.py:78:32: B006 Do not use mutable data structures for argument defaults
|
78 | async def async_this_too(value=collections.defaultdict()):
| ^^^^^^^^^^^^^^^^^^^^^^^^^ B006
79 | ...
|
./resources/test/fixtures/flake8_bugbear/B006_B008.py:82:26: B006 Do not use mutable data structures for argument defaults
B006_B008.py:82:26: B006 Do not use mutable data structures for argument defaults
|
82 | def dont_forget_me(value=collections.deque()):
| ^^^^^^^^^^^^^^^^^^^ B006
83 | ...
|
./resources/test/fixtures/flake8_bugbear/B006_B008.py:87:46: B006 Do not use mutable data structures for argument defaults
B006_B008.py:87:46: B006 Do not use mutable data structures for argument defaults
|
87 | # N.B. we're also flagging the function call in the comprehension
88 | def list_comprehension_also_not_okay(default=[i**2 for i in range(3)]):
@ -51,28 +51,28 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
89 | pass
|
./resources/test/fixtures/flake8_bugbear/B006_B008.py:91:46: B006 Do not use mutable data structures for argument defaults
B006_B008.py:91:46: B006 Do not use mutable data structures for argument defaults
|
91 | def dict_comprehension_also_not_okay(default={i: i**2 for i in range(3)}):
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ B006
92 | pass
|
./resources/test/fixtures/flake8_bugbear/B006_B008.py:95:45: B006 Do not use mutable data structures for argument defaults
B006_B008.py:95:45: B006 Do not use mutable data structures for argument defaults
|
95 | def set_comprehension_also_not_okay(default={i**2 for i in range(3)}):
| ^^^^^^^^^^^^^^^^^^^^^^^^ B006
96 | pass
|
./resources/test/fixtures/flake8_bugbear/B006_B008.py:99:33: B006 Do not use mutable data structures for argument defaults
B006_B008.py:99:33: B006 Do not use mutable data structures for argument defaults
|
99 | def kwonlyargs_mutable(*, value=[]):
| ^^ B006
100 | ...
|
./resources/test/fixtures/flake8_bugbear/B006_B008.py:192:20: B006 Do not use mutable data structures for argument defaults
B006_B008.py:192:20: B006 Do not use mutable data structures for argument defaults
|
192 | # B006 and B008
193 | # We should handle arbitrary nesting of these B008.
@ -81,7 +81,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
195 | pass
|
./resources/test/fixtures/flake8_bugbear/B006_B008.py:225:27: B006 Do not use mutable data structures for argument defaults
B006_B008.py:225:27: B006 Do not use mutable data structures for argument defaults
|
225 | def mutable_annotations(
226 | a: list[int] | None = [],
@ -90,7 +90,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
228 | c: Annotated[Union[Set[str], abc.Sized], "annotation"] = set(),
|
./resources/test/fixtures/flake8_bugbear/B006_B008.py:226:35: B006 Do not use mutable data structures for argument defaults
B006_B008.py:226:35: B006 Do not use mutable data structures for argument defaults
|
226 | def mutable_annotations(
227 | a: list[int] | None = [],
@ -100,7 +100,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
230 | ):
|
./resources/test/fixtures/flake8_bugbear/B006_B008.py:227:62: B006 Do not use mutable data structures for argument defaults
B006_B008.py:227:62: B006 Do not use mutable data structures for argument defaults
|
227 | a: list[int] | None = [],
228 | b: Optional[Dict[int, int]] = {},

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_bugbear/mod.rs
---
./resources/test/fixtures/flake8_bugbear/B007.py:6:5: B007 [*] Loop control variable `i` not used within loop body
B007.py:6:5: B007 [*] Loop control variable `i` not used within loop body
|
6 | print(i) # name no longer defined on Python 3; no warning yet
7 |
@ -11,7 +11,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
|
= help: Rename unused `i` to `_i`
./resources/test/fixtures/flake8_bugbear/B007.py:18:13: B007 [*] Loop control variable `k` not used within loop body
B007.py:18:13: B007 [*] Loop control variable `k` not used within loop body
|
18 | for i in range(10):
19 | for j in range(10):
@ -31,7 +31,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
20 20 |
21 21 |
./resources/test/fixtures/flake8_bugbear/B007.py:30:5: B007 [*] Loop control variable `i` not used within loop body
B007.py:30:5: B007 [*] Loop control variable `i` not used within loop body
|
30 | for i, (j, (k, l)) in strange_generator(): # i, k not used
| ^ B007
@ -39,7 +39,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
|
= help: Rename unused `i` to `_i`
./resources/test/fixtures/flake8_bugbear/B007.py:30:13: B007 [*] Loop control variable `k` not used within loop body
B007.py:30:13: B007 [*] Loop control variable `k` not used within loop body
|
30 | for i, (j, (k, l)) in strange_generator(): # i, k not used
| ^ B007
@ -57,7 +57,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
32 32 |
33 33 | FMT = "{foo} {bar}"
./resources/test/fixtures/flake8_bugbear/B007.py:34:10: B007 Loop control variable `bar` may not be used within loop body
B007.py:34:10: B007 Loop control variable `bar` may not be used within loop body
|
34 | FMT = "{foo} {bar}"
35 | for foo, bar in [(1, 2)]:
@ -66,7 +66,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
37 | print(FMT.format(**locals()))
|
./resources/test/fixtures/flake8_bugbear/B007.py:38:10: B007 Loop control variable `bar` may not be used within loop body
B007.py:38:10: B007 Loop control variable `bar` may not be used within loop body
|
38 | print(FMT.format(**locals()))
39 |
@ -76,7 +76,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
42 | print(FMT.format(**globals()))
|
./resources/test/fixtures/flake8_bugbear/B007.py:42:10: B007 Loop control variable `bar` may not be used within loop body
B007.py:42:10: B007 Loop control variable `bar` may not be used within loop body
|
42 | print(FMT.format(**globals()))
43 |
@ -86,7 +86,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
46 | print(FMT.format(**vars()))
|
./resources/test/fixtures/flake8_bugbear/B007.py:46:10: B007 Loop control variable `bar` may not be used within loop body
B007.py:46:10: B007 Loop control variable `bar` may not be used within loop body
|
46 | print(FMT.format(**vars()))
47 |
@ -95,7 +95,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
49 | print(FMT.format(foo=foo, bar=eval("bar")))
|
./resources/test/fixtures/flake8_bugbear/B007.py:52:14: B007 [*] Loop control variable `bar` not used within loop body
B007.py:52:14: B007 [*] Loop control variable `bar` not used within loop body
|
52 | def f():
53 | # Fixable.
@ -116,7 +116,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
54 54 | break
55 55 |
./resources/test/fixtures/flake8_bugbear/B007.py:59:14: B007 [*] Loop control variable `bar` not used within loop body
B007.py:59:14: B007 [*] Loop control variable `bar` not used within loop body
|
59 | def f():
60 | # Unfixable due to usage of `bar` outside of loop.
@ -127,7 +127,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
|
= help: Rename unused `bar` to `_bar`
./resources/test/fixtures/flake8_bugbear/B007.py:68:14: B007 [*] Loop control variable `bar` not used within loop body
B007.py:68:14: B007 [*] Loop control variable `bar` not used within loop body
|
68 | def f():
69 | # Fixable.
@ -148,7 +148,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
70 70 | break
71 71 |
./resources/test/fixtures/flake8_bugbear/B007.py:77:14: B007 [*] Loop control variable `bar` not used within loop body
B007.py:77:14: B007 [*] Loop control variable `bar` not used within loop body
|
77 | def f():
78 | # Fixable.
@ -169,7 +169,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
79 79 | break
80 80 |
./resources/test/fixtures/flake8_bugbear/B007.py:87:5: B007 Loop control variable `line_` not used within loop body
B007.py:87:5: B007 Loop control variable `line_` not used within loop body
|
87 | # Unfixable due to trailing underscore (`_line_` wouldn't be considered an ignorable
88 | # variable name).

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_bugbear/mod.rs
---
./resources/test/fixtures/flake8_bugbear/B006_B008.py:87:61: B008 Do not perform function call `range` in argument defaults
B006_B008.py:87:61: B008 Do not perform function call `range` in argument defaults
|
87 | # N.B. we're also flagging the function call in the comprehension
88 | def list_comprehension_also_not_okay(default=[i**2 for i in range(3)]):
@ -9,21 +9,21 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
89 | pass
|
./resources/test/fixtures/flake8_bugbear/B006_B008.py:91:64: B008 Do not perform function call `range` in argument defaults
B006_B008.py:91:64: B008 Do not perform function call `range` in argument defaults
|
91 | def dict_comprehension_also_not_okay(default={i: i**2 for i in range(3)}):
| ^^^^^^^^ B008
92 | pass
|
./resources/test/fixtures/flake8_bugbear/B006_B008.py:95:60: B008 Do not perform function call `range` in argument defaults
B006_B008.py:95:60: B008 Do not perform function call `range` in argument defaults
|
95 | def set_comprehension_also_not_okay(default={i**2 for i in range(3)}):
| ^^^^^^^^ B008
96 | pass
|
./resources/test/fixtures/flake8_bugbear/B006_B008.py:111:39: B008 Do not perform function call `time.time` in argument defaults
B006_B008.py:111:39: B008 Do not perform function call `time.time` in argument defaults
|
111 | # B008
112 | # Flag function calls as default args (including if they are part of a sub-expression)
@ -32,28 +32,28 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
114 | ...
|
./resources/test/fixtures/flake8_bugbear/B006_B008.py:115:12: B008 Do not perform function call `dt.datetime.now` in argument defaults
B006_B008.py:115:12: B008 Do not perform function call `dt.datetime.now` in argument defaults
|
115 | def f(when=dt.datetime.now() + dt.timedelta(days=7)):
| ^^^^^^^^^^^^^^^^^ B008
116 | pass
|
./resources/test/fixtures/flake8_bugbear/B006_B008.py:119:30: B008 Do not perform function call in argument defaults
B006_B008.py:119:30: B008 Do not perform function call in argument defaults
|
119 | def can_even_catch_lambdas(a=(lambda x: x)()):
| ^^^^^^^^^^^^^^^ B008
120 | ...
|
./resources/test/fixtures/flake8_bugbear/B006_B008.py:157:34: B008 Do not perform function call `float` in argument defaults
B006_B008.py:157:34: B008 Do not perform function call `float` in argument defaults
|
157 | def float_infinity_literal(value=float("1e999")):
| ^^^^^^^^^^^^^^ B008
158 | pass
|
./resources/test/fixtures/flake8_bugbear/B006_B008.py:162:30: B008 Do not perform function call `float` in argument defaults
B006_B008.py:162:30: B008 Do not perform function call `float` in argument defaults
|
162 | # But don't allow standard floats
163 | def float_int_is_wrong(value=float(3)):
@ -61,14 +61,14 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
164 | pass
|
./resources/test/fixtures/flake8_bugbear/B006_B008.py:166:45: B008 Do not perform function call `float` in argument defaults
B006_B008.py:166:45: B008 Do not perform function call `float` in argument defaults
|
166 | def float_str_not_inf_or_nan_is_wrong(value=float("3.14")):
| ^^^^^^^^^^^^^ B008
167 | pass
|
./resources/test/fixtures/flake8_bugbear/B006_B008.py:192:21: B008 Do not perform function call `float` in argument defaults
B006_B008.py:192:21: B008 Do not perform function call `float` in argument defaults
|
192 | # B006 and B008
193 | # We should handle arbitrary nesting of these B008.
@ -77,7 +77,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
195 | pass
|
./resources/test/fixtures/flake8_bugbear/B006_B008.py:192:31: B008 Do not perform function call `dt.datetime.now` in argument defaults
B006_B008.py:192:31: B008 Do not perform function call `dt.datetime.now` in argument defaults
|
192 | # B006 and B008
193 | # We should handle arbitrary nesting of these B008.
@ -86,7 +86,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
195 | pass
|
./resources/test/fixtures/flake8_bugbear/B006_B008.py:198:22: B008 Do not perform function call `map` in argument defaults
B006_B008.py:198:22: B008 Do not perform function call `map` in argument defaults
|
198 | # Don't flag nested B006 since we can't guarantee that
199 | # it isn't made mutable by the outer operation.
@ -95,7 +95,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
201 | pass
|
./resources/test/fixtures/flake8_bugbear/B006_B008.py:203:19: B008 Do not perform function call `random.randint` in argument defaults
B006_B008.py:203:19: B008 Do not perform function call `random.randint` in argument defaults
|
203 | # B008-ception.
204 | def nested_b008(a=random.randint(0, dt.datetime.now().year)):
@ -103,7 +103,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
205 | pass
|
./resources/test/fixtures/flake8_bugbear/B006_B008.py:203:37: B008 Do not perform function call `dt.datetime.now` in argument defaults
B006_B008.py:203:37: B008 Do not perform function call `dt.datetime.now` in argument defaults
|
203 | # B008-ception.
204 | def nested_b008(a=random.randint(0, dt.datetime.now().year)):

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_bugbear/mod.rs
---
./resources/test/fixtures/flake8_bugbear/B009_B010.py:19:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
B009_B010.py:19:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
|
19 | # Invalid usage
20 | getattr(foo, "bar")
@ -21,7 +21,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
21 21 | getattr(foo, "__123abc__")
22 22 | getattr(foo, "abc123")
./resources/test/fixtures/flake8_bugbear/B009_B010.py:20:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
B009_B010.py:20:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
|
20 | # Invalid usage
21 | getattr(foo, "bar")
@ -42,7 +42,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
22 22 | getattr(foo, "abc123")
23 23 | getattr(foo, r"abc123")
./resources/test/fixtures/flake8_bugbear/B009_B010.py:21:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
B009_B010.py:21:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
|
21 | getattr(foo, "bar")
22 | getattr(foo, "_123abc")
@ -63,7 +63,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
23 23 | getattr(foo, r"abc123")
24 24 | _ = lambda x: getattr(x, "bar")
./resources/test/fixtures/flake8_bugbear/B009_B010.py:22:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
B009_B010.py:22:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
|
22 | getattr(foo, "_123abc")
23 | getattr(foo, "__123abc__")
@ -84,7 +84,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
24 24 | _ = lambda x: getattr(x, "bar")
25 25 | if getattr(x, "bar"):
./resources/test/fixtures/flake8_bugbear/B009_B010.py:23:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
B009_B010.py:23:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
|
23 | getattr(foo, "__123abc__")
24 | getattr(foo, "abc123")
@ -105,7 +105,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
25 25 | if getattr(x, "bar"):
26 26 | pass
./resources/test/fixtures/flake8_bugbear/B009_B010.py:24:15: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
B009_B010.py:24:15: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
|
24 | getattr(foo, "abc123")
25 | getattr(foo, r"abc123")
@ -126,7 +126,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
26 26 | pass
27 27 |
./resources/test/fixtures/flake8_bugbear/B009_B010.py:25:4: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
B009_B010.py:25:4: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
|
25 | getattr(foo, r"abc123")
26 | _ = lambda x: getattr(x, "bar")

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_bugbear/mod.rs
---
./resources/test/fixtures/flake8_bugbear/B009_B010.py:40:1: B010 [*] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access.
B009_B010.py:40:1: B010 [*] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access.
|
40 | # Invalid usage
41 | setattr(foo, "bar", None)
@ -21,7 +21,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
42 42 | setattr(foo, "__123abc__", None)
43 43 | setattr(foo, "abc123", None)
./resources/test/fixtures/flake8_bugbear/B009_B010.py:41:1: B010 [*] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access.
B009_B010.py:41:1: B010 [*] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access.
|
41 | # Invalid usage
42 | setattr(foo, "bar", None)
@ -42,7 +42,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
43 43 | setattr(foo, "abc123", None)
44 44 | setattr(foo, r"abc123", None)
./resources/test/fixtures/flake8_bugbear/B009_B010.py:42:1: B010 [*] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access.
B009_B010.py:42:1: B010 [*] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access.
|
42 | setattr(foo, "bar", None)
43 | setattr(foo, "_123abc", None)
@ -63,7 +63,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
44 44 | setattr(foo, r"abc123", None)
45 45 | setattr(foo.bar, r"baz", None)
./resources/test/fixtures/flake8_bugbear/B009_B010.py:43:1: B010 [*] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access.
B009_B010.py:43:1: B010 [*] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access.
|
43 | setattr(foo, "_123abc", None)
44 | setattr(foo, "__123abc__", None)
@ -83,7 +83,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
44 44 | setattr(foo, r"abc123", None)
45 45 | setattr(foo.bar, r"baz", None)
./resources/test/fixtures/flake8_bugbear/B009_B010.py:44:1: B010 [*] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access.
B009_B010.py:44:1: B010 [*] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access.
|
44 | setattr(foo, "__123abc__", None)
45 | setattr(foo, "abc123", None)
@ -101,7 +101,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
44 |+foo.abc123 = None
45 45 | setattr(foo.bar, r"baz", None)
./resources/test/fixtures/flake8_bugbear/B009_B010.py:45:1: B010 [*] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access.
B009_B010.py:45:1: B010 [*] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access.
|
45 | setattr(foo, "abc123", None)
46 | setattr(foo, r"abc123", None)

View file

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

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_bugbear/mod.rs
---
./resources/test/fixtures/flake8_bugbear/B012.py:5:9: B012 `return` inside `finally` blocks cause exceptions to be silenced
B012.py:5:9: B012 `return` inside `finally` blocks cause exceptions to be silenced
|
5 | pass
6 | finally:
@ -9,7 +9,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
| ^^^^^^ B012
|
./resources/test/fixtures/flake8_bugbear/B012.py:13:13: B012 `return` inside `finally` blocks cause exceptions to be silenced
B012.py:13:13: B012 `return` inside `finally` blocks cause exceptions to be silenced
|
13 | finally:
14 | if 1 + 0 == 2 - 1:
@ -17,7 +17,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
| ^^^^^^ B012
|
./resources/test/fixtures/flake8_bugbear/B012.py:21:13: B012 `return` inside `finally` blocks cause exceptions to be silenced
B012.py:21:13: B012 `return` inside `finally` blocks cause exceptions to be silenced
|
21 | finally:
22 | try:
@ -27,7 +27,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
25 | pass
|
./resources/test/fixtures/flake8_bugbear/B012.py:31:13: B012 `return` inside `finally` blocks cause exceptions to be silenced
B012.py:31:13: B012 `return` inside `finally` blocks cause exceptions to be silenced
|
31 | pass
32 | finally:
@ -37,7 +37,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
35 | pass
|
./resources/test/fixtures/flake8_bugbear/B012.py:44:21: B012 `return` inside `finally` blocks cause exceptions to be silenced
B012.py:44:21: B012 `return` inside `finally` blocks cause exceptions to be silenced
|
44 | pass
45 | finally:
@ -47,7 +47,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
48 | finally:
|
./resources/test/fixtures/flake8_bugbear/B012.py:66:13: B012 `break` inside `finally` blocks cause exceptions to be silenced
B012.py:66:13: B012 `break` inside `finally` blocks cause exceptions to be silenced
|
66 | pass
67 | finally:
@ -57,7 +57,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
70 | def j():
|
./resources/test/fixtures/flake8_bugbear/B012.py:78:13: B012 `continue` inside `finally` blocks cause exceptions to be silenced
B012.py:78:13: B012 `continue` inside `finally` blocks cause exceptions to be silenced
|
78 | pass
79 | finally:
@ -67,7 +67,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
82 | def j():
|
./resources/test/fixtures/flake8_bugbear/B012.py:94:13: B012 `return` inside `finally` blocks cause exceptions to be silenced
B012.py:94:13: B012 `return` inside `finally` blocks cause exceptions to be silenced
|
94 | continue # no warning
95 | while True:
@ -75,7 +75,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
| ^^^^^^ B012
|
./resources/test/fixtures/flake8_bugbear/B012.py:101:9: B012 `continue` inside `finally` blocks cause exceptions to be silenced
B012.py:101:9: B012 `continue` inside `finally` blocks cause exceptions to be silenced
|
101 | pass
102 | finally:
@ -85,7 +85,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
105 | while True:
|
./resources/test/fixtures/flake8_bugbear/B012.py:107:9: B012 `break` inside `finally` blocks cause exceptions to be silenced
B012.py:107:9: B012 `break` inside `finally` blocks cause exceptions to be silenced
|
107 | pass
108 | finally:
@ -93,7 +93,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
| ^^^^^ B012
|
./resources/test/fixtures/flake8_bugbear/B012.py:118:17: B012 `break` inside `finally` blocks cause exceptions to be silenced
B012.py:118:17: B012 `break` inside `finally` blocks cause exceptions to be silenced
|
118 | y = 0
119 | case 0, *x:

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_bugbear/mod.rs
---
./resources/test/fixtures/flake8_bugbear/B013.py:3:8: B013 [*] A length-one tuple literal is redundant. Write `except ValueError` instead of `except (ValueError,)`.
B013.py:3:8: B013 [*] A length-one tuple literal is redundant. Write `except ValueError` instead of `except (ValueError,)`.
|
3 | try:
4 | pass

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_bugbear/mod.rs
---
./resources/test/fixtures/flake8_bugbear/B014.py:17:8: B014 [*] Exception handler with duplicate exception: `OSError`
B014.py:17:8: B014 [*] Exception handler with duplicate exception: `OSError`
|
17 | try:
18 | pass
@ -22,7 +22,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
19 19 | pass
20 20 |
./resources/test/fixtures/flake8_bugbear/B014.py:28:8: B014 [*] Exception handler with duplicate exception: `MyError`
B014.py:28:8: B014 [*] Exception handler with duplicate exception: `MyError`
|
28 | try:
29 | pass
@ -43,7 +43,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
30 30 | pass
31 31 |
./resources/test/fixtures/flake8_bugbear/B014.py:49:8: B014 [*] Exception handler with duplicate exception: `re.error`
B014.py:49:8: B014 [*] Exception handler with duplicate exception: `re.error`
|
49 | try:
50 | pass

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_bugbear/mod.rs
---
./resources/test/fixtures/flake8_bugbear/B015.py:3:1: B015 Pointless comparison. This comparison does nothing but waste CPU instructions. Either prepend `assert` or remove it.
B015.py:3:1: B015 Pointless comparison. This comparison does nothing but waste CPU instructions. Either prepend `assert` or remove it.
|
3 | assert 1 == 1
4 |
@ -11,7 +11,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
7 | assert 1 in (1, 2)
|
./resources/test/fixtures/flake8_bugbear/B015.py:7:1: B015 Pointless comparison. This comparison does nothing but waste CPU instructions. Either prepend `assert` or remove it.
B015.py:7:1: B015 Pointless comparison. This comparison does nothing but waste CPU instructions. Either prepend `assert` or remove it.
|
7 | assert 1 in (1, 2)
8 |
@ -19,7 +19,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
| ^^^^^^^^^^^ B015
|
./resources/test/fixtures/flake8_bugbear/B015.py:17:5: B015 Pointless comparison. This comparison does nothing but waste CPU instructions. Either prepend `assert` or remove it.
B015.py:17:5: B015 Pointless comparison. This comparison does nothing but waste CPU instructions. Either prepend `assert` or remove it.
|
17 | assert 1 in (1, 2)
18 |
@ -27,7 +27,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
| ^^^^^^^^^^^ B015
|
./resources/test/fixtures/flake8_bugbear/B015.py:24:5: B015 Pointless comparison. This comparison does nothing but waste CPU instructions. Either prepend `assert` or remove it.
B015.py:24:5: B015 Pointless comparison. This comparison does nothing but waste CPU instructions. Either prepend `assert` or remove it.
|
24 | class TestClass:
25 | 1 == 1

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_bugbear/mod.rs
---
./resources/test/fixtures/flake8_bugbear/B016.py:6:7: B016 Cannot raise a literal. Did you intend to return it or raise an Exception?
B016.py:6:7: B016 Cannot raise a literal. Did you intend to return it or raise an Exception?
|
6 | """
7 |
@ -11,7 +11,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
10 | raise "string"
|
./resources/test/fixtures/flake8_bugbear/B016.py:7:7: B016 Cannot raise a literal. Did you intend to return it or raise an Exception?
B016.py:7:7: B016 Cannot raise a literal. Did you intend to return it or raise an Exception?
|
7 | raise False
8 | raise 1
@ -20,7 +20,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
10 | raise Exception(False)
|
./resources/test/fixtures/flake8_bugbear/B016.py:8:7: B016 Cannot raise a literal. Did you intend to return it or raise an Exception?
B016.py:8:7: B016 Cannot raise a literal. Did you intend to return it or raise an Exception?
|
8 | raise False
9 | raise 1

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_bugbear/mod.rs
---
./resources/test/fixtures/flake8_bugbear/B017.py:22:9: B017 `assertRaises(Exception)` should be considered evil
B017.py:22:9: B017 `assertRaises(Exception)` should be considered evil
|
22 | class Foobar(unittest.TestCase):
23 | def evil_raises(self) -> None:

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_bugbear/mod.rs
---
./resources/test/fixtures/flake8_bugbear/B018.py:11:5: B018 Found useless expression. Either assign it to a variable or remove it.
B018.py:11:5: B018 Found useless expression. Either assign it to a variable or remove it.
|
11 | "str" # Str (no raise)
12 | f"{int}" # JoinedStr (no raise)
@ -11,7 +11,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
15 | 1.0 # Number (float)
|
./resources/test/fixtures/flake8_bugbear/B018.py:12:5: B018 Found useless expression. Either assign it to a variable or remove it.
B018.py:12:5: B018 Found useless expression. Either assign it to a variable or remove it.
|
12 | f"{int}" # JoinedStr (no raise)
13 | 1j # Number (complex)
@ -21,7 +21,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
16 | b"foo" # Binary
|
./resources/test/fixtures/flake8_bugbear/B018.py:13:5: B018 Found useless expression. Either assign it to a variable or remove it.
B018.py:13:5: B018 Found useless expression. Either assign it to a variable or remove it.
|
13 | 1j # Number (complex)
14 | 1 # Number (int)
@ -31,7 +31,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
17 | True # NameConstant (True)
|
./resources/test/fixtures/flake8_bugbear/B018.py:14:5: B018 Found useless expression. Either assign it to a variable or remove it.
B018.py:14:5: B018 Found useless expression. Either assign it to a variable or remove it.
|
14 | 1 # Number (int)
15 | 1.0 # Number (float)
@ -41,7 +41,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
18 | False # NameConstant (False)
|
./resources/test/fixtures/flake8_bugbear/B018.py:15:5: B018 Found useless expression. Either assign it to a variable or remove it.
B018.py:15:5: B018 Found useless expression. Either assign it to a variable or remove it.
|
15 | 1.0 # Number (float)
16 | b"foo" # Binary
@ -51,7 +51,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
19 | None # NameConstant (None)
|
./resources/test/fixtures/flake8_bugbear/B018.py:16:5: B018 Found useless expression. Either assign it to a variable or remove it.
B018.py:16:5: B018 Found useless expression. Either assign it to a variable or remove it.
|
16 | b"foo" # Binary
17 | True # NameConstant (True)
@ -61,7 +61,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
20 | [1, 2] # list
|
./resources/test/fixtures/flake8_bugbear/B018.py:17:5: B018 Found useless expression. Either assign it to a variable or remove it.
B018.py:17:5: B018 Found useless expression. Either assign it to a variable or remove it.
|
17 | True # NameConstant (True)
18 | False # NameConstant (False)
@ -71,7 +71,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
21 | {1, 2} # set
|
./resources/test/fixtures/flake8_bugbear/B018.py:18:5: B018 Found useless expression. Either assign it to a variable or remove it.
B018.py:18:5: B018 Found useless expression. Either assign it to a variable or remove it.
|
18 | False # NameConstant (False)
19 | None # NameConstant (None)
@ -81,7 +81,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
22 | {"foo": "bar"} # dict
|
./resources/test/fixtures/flake8_bugbear/B018.py:19:5: B018 Found useless expression. Either assign it to a variable or remove it.
B018.py:19:5: B018 Found useless expression. Either assign it to a variable or remove it.
|
19 | None # NameConstant (None)
20 | [1, 2] # list
@ -90,7 +90,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
22 | {"foo": "bar"} # dict
|
./resources/test/fixtures/flake8_bugbear/B018.py:20:5: B018 Found useless expression. Either assign it to a variable or remove it.
B018.py:20:5: B018 Found useless expression. Either assign it to a variable or remove it.
|
20 | [1, 2] # list
21 | {1, 2} # set
@ -98,7 +98,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
| ^^^^^^^^^^^^^^ B018
|
./resources/test/fixtures/flake8_bugbear/B018.py:24:5: B018 Found useless expression. Either assign it to a variable or remove it.
B018.py:24:5: B018 Found useless expression. Either assign it to a variable or remove it.
|
24 | class Foo3:
25 | 123
@ -107,7 +107,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
27 | "str"
|
./resources/test/fixtures/flake8_bugbear/B018.py:27:5: B018 Found useless expression. Either assign it to a variable or remove it.
B018.py:27:5: B018 Found useless expression. Either assign it to a variable or remove it.
|
27 | a = 2
28 | "str"
@ -115,7 +115,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
| ^ B018
|
./resources/test/fixtures/flake8_bugbear/B018.py:39:5: B018 Found useless expression. Either assign it to a variable or remove it.
B018.py:39:5: B018 Found useless expression. Either assign it to a variable or remove it.
|
39 | "str" # Str (no raise)
40 | f"{int}" # JoinedStr (no raise)
@ -125,7 +125,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
43 | 1.0 # Number (float)
|
./resources/test/fixtures/flake8_bugbear/B018.py:40:5: B018 Found useless expression. Either assign it to a variable or remove it.
B018.py:40:5: B018 Found useless expression. Either assign it to a variable or remove it.
|
40 | f"{int}" # JoinedStr (no raise)
41 | 1j # Number (complex)
@ -135,7 +135,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
44 | b"foo" # Binary
|
./resources/test/fixtures/flake8_bugbear/B018.py:41:5: B018 Found useless expression. Either assign it to a variable or remove it.
B018.py:41:5: B018 Found useless expression. Either assign it to a variable or remove it.
|
41 | 1j # Number (complex)
42 | 1 # Number (int)
@ -145,7 +145,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
45 | True # NameConstant (True)
|
./resources/test/fixtures/flake8_bugbear/B018.py:42:5: B018 Found useless expression. Either assign it to a variable or remove it.
B018.py:42:5: B018 Found useless expression. Either assign it to a variable or remove it.
|
42 | 1 # Number (int)
43 | 1.0 # Number (float)
@ -155,7 +155,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
46 | False # NameConstant (False)
|
./resources/test/fixtures/flake8_bugbear/B018.py:43:5: B018 Found useless expression. Either assign it to a variable or remove it.
B018.py:43:5: B018 Found useless expression. Either assign it to a variable or remove it.
|
43 | 1.0 # Number (float)
44 | b"foo" # Binary
@ -165,7 +165,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
47 | None # NameConstant (None)
|
./resources/test/fixtures/flake8_bugbear/B018.py:44:5: B018 Found useless expression. Either assign it to a variable or remove it.
B018.py:44:5: B018 Found useless expression. Either assign it to a variable or remove it.
|
44 | b"foo" # Binary
45 | True # NameConstant (True)
@ -175,7 +175,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
48 | [1, 2] # list
|
./resources/test/fixtures/flake8_bugbear/B018.py:45:5: B018 Found useless expression. Either assign it to a variable or remove it.
B018.py:45:5: B018 Found useless expression. Either assign it to a variable or remove it.
|
45 | True # NameConstant (True)
46 | False # NameConstant (False)
@ -185,7 +185,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
49 | {1, 2} # set
|
./resources/test/fixtures/flake8_bugbear/B018.py:46:5: B018 Found useless expression. Either assign it to a variable or remove it.
B018.py:46:5: B018 Found useless expression. Either assign it to a variable or remove it.
|
46 | False # NameConstant (False)
47 | None # NameConstant (None)
@ -195,7 +195,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
50 | {"foo": "bar"} # dict
|
./resources/test/fixtures/flake8_bugbear/B018.py:47:5: B018 Found useless expression. Either assign it to a variable or remove it.
B018.py:47:5: B018 Found useless expression. Either assign it to a variable or remove it.
|
47 | None # NameConstant (None)
48 | [1, 2] # list
@ -204,7 +204,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
50 | {"foo": "bar"} # dict
|
./resources/test/fixtures/flake8_bugbear/B018.py:48:5: B018 Found useless expression. Either assign it to a variable or remove it.
B018.py:48:5: B018 Found useless expression. Either assign it to a variable or remove it.
|
48 | [1, 2] # list
49 | {1, 2} # set
@ -212,7 +212,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
| ^^^^^^^^^^^^^^ B018
|
./resources/test/fixtures/flake8_bugbear/B018.py:52:5: B018 Found useless expression. Either assign it to a variable or remove it.
B018.py:52:5: B018 Found useless expression. Either assign it to a variable or remove it.
|
52 | def foo3():
53 | 123
@ -221,7 +221,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
55 | "str"
|
./resources/test/fixtures/flake8_bugbear/B018.py:55:5: B018 Found useless expression. Either assign it to a variable or remove it.
B018.py:55:5: B018 Found useless expression. Either assign it to a variable or remove it.
|
55 | a = 2
56 | "str"
@ -229,7 +229,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
| ^ B018
|
./resources/test/fixtures/flake8_bugbear/B018.py:63:5: B018 Found useless expression. Either assign it to a variable or remove it.
B018.py:63:5: B018 Found useless expression. Either assign it to a variable or remove it.
|
63 | def foo5():
64 | foo.bar # Attribute (raise)
@ -238,7 +238,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
66 | "foo" + "bar" # BinOp (raise)
|
./resources/test/fixtures/flake8_bugbear/B018.py:64:5: B018 Found useless attribute access. Either assign it to a variable or remove it.
B018.py:64:5: B018 Found useless attribute access. Either assign it to a variable or remove it.
|
64 | def foo5():
65 | foo.bar # Attribute (raise)
@ -247,7 +247,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
67 | "foo" + "bar" # BinOp (raise)
|
./resources/test/fixtures/flake8_bugbear/B018.py:65:5: B018 Found useless expression. Either assign it to a variable or remove it.
B018.py:65:5: B018 Found useless expression. Either assign it to a variable or remove it.
|
65 | foo.bar # Attribute (raise)
66 | object().__class__ # Attribute (raise)

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_bugbear/mod.rs
---
./resources/test/fixtures/flake8_bugbear/B019.py:78:6: B019 Use of `functools.lru_cache` or `functools.cache` on methods can lead to memory leaks
B019.py:78:6: B019 Use of `functools.lru_cache` or `functools.cache` on methods can lead to memory leaks
|
78 | # Remaining methods should emit B019
79 | @functools.cache
@ -10,7 +10,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
81 | ...
|
./resources/test/fixtures/flake8_bugbear/B019.py:82:6: B019 Use of `functools.lru_cache` or `functools.cache` on methods can lead to memory leaks
B019.py:82:6: B019 Use of `functools.lru_cache` or `functools.cache` on methods can lead to memory leaks
|
82 | ...
83 |
@ -20,7 +20,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
86 | ...
|
./resources/test/fixtures/flake8_bugbear/B019.py:86:6: B019 Use of `functools.lru_cache` or `functools.cache` on methods can lead to memory leaks
B019.py:86:6: B019 Use of `functools.lru_cache` or `functools.cache` on methods can lead to memory leaks
|
86 | ...
87 |
@ -30,7 +30,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
90 | ...
|
./resources/test/fixtures/flake8_bugbear/B019.py:90:6: B019 Use of `functools.lru_cache` or `functools.cache` on methods can lead to memory leaks
B019.py:90:6: B019 Use of `functools.lru_cache` or `functools.cache` on methods can lead to memory leaks
|
90 | ...
91 |
@ -40,7 +40,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
94 | ...
|
./resources/test/fixtures/flake8_bugbear/B019.py:94:6: B019 Use of `functools.lru_cache` or `functools.cache` on methods can lead to memory leaks
B019.py:94:6: B019 Use of `functools.lru_cache` or `functools.cache` on methods can lead to memory leaks
|
94 | ...
95 |
@ -50,7 +50,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
98 | ...
|
./resources/test/fixtures/flake8_bugbear/B019.py:98:6: B019 Use of `functools.lru_cache` or `functools.cache` on methods can lead to memory leaks
B019.py:98:6: B019 Use of `functools.lru_cache` or `functools.cache` on methods can lead to memory leaks
|
98 | ...
99 |
@ -60,7 +60,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
102 | ...
|
./resources/test/fixtures/flake8_bugbear/B019.py:102:6: B019 Use of `functools.lru_cache` or `functools.cache` on methods can lead to memory leaks
B019.py:102:6: B019 Use of `functools.lru_cache` or `functools.cache` on methods can lead to memory leaks
|
102 | ...
103 |
@ -70,7 +70,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
106 | ...
|
./resources/test/fixtures/flake8_bugbear/B019.py:106:6: B019 Use of `functools.lru_cache` or `functools.cache` on methods can lead to memory leaks
B019.py:106:6: B019 Use of `functools.lru_cache` or `functools.cache` on methods can lead to memory leaks
|
106 | ...
107 |

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_bugbear/mod.rs
---
./resources/test/fixtures/flake8_bugbear/B020.py:8:5: B020 Loop control variable `items` overrides iterable it iterates
B020.py:8:5: B020 Loop control variable `items` overrides iterable it iterates
|
8 | items = [1, 2, 3]
9 |
@ -10,7 +10,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
11 | print(items)
|
./resources/test/fixtures/flake8_bugbear/B020.py:21:10: B020 Loop control variable `values` overrides iterable it iterates
B020.py:21:10: B020 Loop control variable `values` overrides iterable it iterates
|
21 | print(f"{key}, {value}")
22 |
@ -19,7 +19,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
24 | print(f"{key}, {values}")
|
./resources/test/fixtures/flake8_bugbear/B020.py:36:5: B020 Loop control variable `vars` overrides iterable it iterates
B020.py:36:5: B020 Loop control variable `vars` overrides iterable it iterates
|
36 | # However we still call out reassigning the iterable in the comprehension.
37 | for vars in [i for i in vars]:

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_bugbear/mod.rs
---
./resources/test/fixtures/flake8_bugbear/B021.py:1:1: B021 f-string used as docstring. This will be interpreted by python as a joined string rather than a docstring.
B021.py:1:1: B021 f-string used as docstring. This will be interpreted by python as a joined string rather than a docstring.
|
1 | / f"""
2 | | Should emit:
@ -12,63 +12,63 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
6 | VARIABLE = "world"
|
./resources/test/fixtures/flake8_bugbear/B021.py:14:5: B021 f-string used as docstring. This will be interpreted by python as a joined string rather than a docstring.
B021.py:14:5: B021 f-string used as docstring. This will be interpreted by python as a joined string rather than a docstring.
|
14 | def foo2():
15 | f"""hello {VARIABLE}!"""
| ^^^^^^^^^^^^^^^^^^^^^^^^ B021
|
./resources/test/fixtures/flake8_bugbear/B021.py:22:5: B021 f-string used as docstring. This will be interpreted by python as a joined string rather than a docstring.
B021.py:22:5: B021 f-string used as docstring. This will be interpreted by python as a joined string rather than a docstring.
|
22 | class bar2:
23 | f"""hello {VARIABLE}!"""
| ^^^^^^^^^^^^^^^^^^^^^^^^ B021
|
./resources/test/fixtures/flake8_bugbear/B021.py:30:5: B021 f-string used as docstring. This will be interpreted by python as a joined string rather than a docstring.
B021.py:30:5: B021 f-string used as docstring. This will be interpreted by python as a joined string rather than a docstring.
|
30 | def foo2():
31 | f"""hello {VARIABLE}!"""
| ^^^^^^^^^^^^^^^^^^^^^^^^ B021
|
./resources/test/fixtures/flake8_bugbear/B021.py:38:5: B021 f-string used as docstring. This will be interpreted by python as a joined string rather than a docstring.
B021.py:38:5: B021 f-string used as docstring. This will be interpreted by python as a joined string rather than a docstring.
|
38 | class bar2:
39 | f"""hello {VARIABLE}!"""
| ^^^^^^^^^^^^^^^^^^^^^^^^ B021
|
./resources/test/fixtures/flake8_bugbear/B021.py:46:5: B021 f-string used as docstring. This will be interpreted by python as a joined string rather than a docstring.
B021.py:46:5: B021 f-string used as docstring. This will be interpreted by python as a joined string rather than a docstring.
|
46 | def foo2():
47 | f"hello {VARIABLE}!"
| ^^^^^^^^^^^^^^^^^^^^ B021
|
./resources/test/fixtures/flake8_bugbear/B021.py:54:5: B021 f-string used as docstring. This will be interpreted by python as a joined string rather than a docstring.
B021.py:54:5: B021 f-string used as docstring. This will be interpreted by python as a joined string rather than a docstring.
|
54 | class bar2:
55 | f"hello {VARIABLE}!"
| ^^^^^^^^^^^^^^^^^^^^ B021
|
./resources/test/fixtures/flake8_bugbear/B021.py:62:5: B021 f-string used as docstring. This will be interpreted by python as a joined string rather than a docstring.
B021.py:62:5: B021 f-string used as docstring. This will be interpreted by python as a joined string rather than a docstring.
|
62 | def foo2():
63 | f"hello {VARIABLE}!"
| ^^^^^^^^^^^^^^^^^^^^ B021
|
./resources/test/fixtures/flake8_bugbear/B021.py:70:5: B021 f-string used as docstring. This will be interpreted by python as a joined string rather than a docstring.
B021.py:70:5: B021 f-string used as docstring. This will be interpreted by python as a joined string rather than a docstring.
|
70 | class bar2:
71 | f"hello {VARIABLE}!"
| ^^^^^^^^^^^^^^^^^^^^ B021
|
./resources/test/fixtures/flake8_bugbear/B021.py:74:5: B021 f-string used as docstring. This will be interpreted by python as a joined string rather than a docstring.
B021.py:74:5: B021 f-string used as docstring. This will be interpreted by python as a joined string rather than a docstring.
|
74 | def baz():
75 | f"""I'm probably a docstring: {VARIABLE}!"""

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_bugbear/mod.rs
---
./resources/test/fixtures/flake8_bugbear/B022.py:9:6: B022 No arguments passed to `contextlib.suppress`. No exceptions will be suppressed and therefore this context manager is redundant
B022.py:9:6: B022 No arguments passed to `contextlib.suppress`. No exceptions will be suppressed and therefore this context manager is redundant
|
9 | from contextlib import suppress
10 |
@ -10,7 +10,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
12 | raise ValueError
|
./resources/test/fixtures/flake8_bugbear/B022.py:12:6: B022 No arguments passed to `contextlib.suppress`. No exceptions will be suppressed and therefore this context manager is redundant
B022.py:12:6: B022 No arguments passed to `contextlib.suppress`. No exceptions will be suppressed and therefore this context manager is redundant
|
12 | raise ValueError
13 |

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_bugbear/mod.rs
---
./resources/test/fixtures/flake8_bugbear/B023.py:12:30: B023 Function definition does not bind loop variable `x`
B023.py:12:30: B023 Function definition does not bind loop variable `x`
|
12 | y = x + 1
13 | # Subject to late-binding problems
@ -10,7 +10,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
15 | functions.append(lambda: y) # not just the loop var
|
./resources/test/fixtures/flake8_bugbear/B023.py:13:30: B023 Function definition does not bind loop variable `y`
B023.py:13:30: B023 Function definition does not bind loop variable `y`
|
13 | # Subject to late-binding problems
14 | functions.append(lambda: x)
@ -20,7 +20,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
17 | def f_bad_1():
|
./resources/test/fixtures/flake8_bugbear/B023.py:16:16: B023 Function definition does not bind loop variable `x`
B023.py:16:16: B023 Function definition does not bind loop variable `x`
|
16 | def f_bad_1():
17 | return x
@ -29,7 +29,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
19 | # Actually OK
|
./resources/test/fixtures/flake8_bugbear/B023.py:28:19: B023 Function definition does not bind loop variable `x`
B023.py:28:19: B023 Function definition does not bind loop variable `x`
|
28 | def check_inside_functions_too():
29 | ls = [lambda: x for x in range(2)] # error
@ -38,7 +38,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
31 | gn = (lambda: x for x in range(2)) # error
|
./resources/test/fixtures/flake8_bugbear/B023.py:29:19: B023 Function definition does not bind loop variable `x`
B023.py:29:19: B023 Function definition does not bind loop variable `x`
|
29 | def check_inside_functions_too():
30 | ls = [lambda: x for x in range(2)] # error
@ -48,7 +48,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
33 | dt = {x: lambda: x for x in range(2)} # error
|
./resources/test/fixtures/flake8_bugbear/B023.py:30:19: B023 Function definition does not bind loop variable `x`
B023.py:30:19: B023 Function definition does not bind loop variable `x`
|
30 | ls = [lambda: x for x in range(2)] # error
31 | st = {lambda: x for x in range(2)} # error
@ -57,7 +57,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
33 | dt = {x: lambda: x for x in range(2)} # error
|
./resources/test/fixtures/flake8_bugbear/B023.py:31:22: B023 Function definition does not bind loop variable `x`
B023.py:31:22: B023 Function definition does not bind loop variable `x`
|
31 | st = {lambda: x for x in range(2)} # error
32 | gn = (lambda: x for x in range(2)) # error
@ -65,7 +65,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
| ^ B023
|
./resources/test/fixtures/flake8_bugbear/B023.py:40:34: B023 Function definition does not bind loop variable `x`
B023.py:40:34: B023 Function definition does not bind loop variable `x`
|
40 | async def container_for_problems():
41 | async for x in pointless_async_iterable():
@ -75,7 +75,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
44 | [lambda: x async for x in pointless_async_iterable()] # error
|
./resources/test/fixtures/flake8_bugbear/B023.py:42:14: B023 Function definition does not bind loop variable `x`
B023.py:42:14: B023 Function definition does not bind loop variable `x`
|
42 | functions.append(lambda: x) # error
43 |
@ -83,7 +83,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
| ^ B023
|
./resources/test/fixtures/flake8_bugbear/B023.py:50:30: B023 Function definition does not bind loop variable `a`
B023.py:50:30: B023 Function definition does not bind loop variable `a`
|
50 | a = a_ = a - 1
51 | b += 1
@ -93,7 +93,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
54 | functions.append(lambda: b) # error
|
./resources/test/fixtures/flake8_bugbear/B023.py:51:30: B023 Function definition does not bind loop variable `a_`
B023.py:51:30: B023 Function definition does not bind loop variable `a_`
|
51 | b += 1
52 | functions.append(lambda: a) # error
@ -103,7 +103,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
55 | functions.append(lambda: c) # error, but not a name error due to late binding
|
./resources/test/fixtures/flake8_bugbear/B023.py:52:30: B023 Function definition does not bind loop variable `b`
B023.py:52:30: B023 Function definition does not bind loop variable `b`
|
52 | functions.append(lambda: a) # error
53 | functions.append(lambda: a_) # error
@ -113,7 +113,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
56 | c: bool = a > 3
|
./resources/test/fixtures/flake8_bugbear/B023.py:53:30: B023 Function definition does not bind loop variable `c`
B023.py:53:30: B023 Function definition does not bind loop variable `c`
|
53 | functions.append(lambda: a_) # error
54 | functions.append(lambda: b) # error
@ -123,7 +123,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
57 | if not c:
|
./resources/test/fixtures/flake8_bugbear/B023.py:61:17: B023 Function definition does not bind loop variable `j`
B023.py:61:17: B023 Function definition does not bind loop variable `j`
|
61 | for j in range(2):
62 | for k in range(3):
@ -131,7 +131,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
| ^ B023
|
./resources/test/fixtures/flake8_bugbear/B023.py:61:21: B023 Function definition does not bind loop variable `k`
B023.py:61:21: B023 Function definition does not bind loop variable `k`
|
61 | for j in range(2):
62 | for k in range(3):
@ -139,7 +139,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
| ^ B023
|
./resources/test/fixtures/flake8_bugbear/B023.py:68:10: B023 Function definition does not bind loop variable `l`
B023.py:68:10: B023 Function definition does not bind loop variable `l`
|
68 | def f():
69 | j = None # OK because it's an assignment
@ -149,14 +149,14 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
72 | assert a and functions
|
./resources/test/fixtures/flake8_bugbear/B023.py:82:16: B023 Function definition does not bind loop variable `i`
B023.py:82:16: B023 Function definition does not bind loop variable `i`
|
82 | for i in range(3):
83 | lambda: f"{i}"
| ^ B023
|
./resources/test/fixtures/flake8_bugbear/B023.py:117:24: B023 Function definition does not bind loop variable `x`
B023.py:117:24: B023 Function definition does not bind loop variable `x`
|
117 | for x in range(2):
118 | # It's not a complete get-out-of-linting-free construct - these should fail:
@ -166,7 +166,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
121 | any(filter(bool, [None, lambda: x]))
|
./resources/test/fixtures/flake8_bugbear/B023.py:118:27: B023 Function definition does not bind loop variable `x`
B023.py:118:27: B023 Function definition does not bind loop variable `x`
|
118 | # It's not a complete get-out-of-linting-free construct - these should fail:
119 | min([None, lambda: x], key=repr)
@ -176,7 +176,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
122 | list(filter(bool, [None, lambda: x]))
|
./resources/test/fixtures/flake8_bugbear/B023.py:119:37: B023 Function definition does not bind loop variable `x`
B023.py:119:37: B023 Function definition does not bind loop variable `x`
|
119 | min([None, lambda: x], key=repr)
120 | sorted([None, lambda: x], key=repr)
@ -186,7 +186,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
123 | all(reduce(bool, [None, lambda: x]))
|
./resources/test/fixtures/flake8_bugbear/B023.py:120:38: B023 Function definition does not bind loop variable `x`
B023.py:120:38: B023 Function definition does not bind loop variable `x`
|
120 | sorted([None, lambda: x], key=repr)
121 | any(filter(bool, [None, lambda: x]))
@ -195,7 +195,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
123 | all(reduce(bool, [None, lambda: x]))
|
./resources/test/fixtures/flake8_bugbear/B023.py:121:37: B023 Function definition does not bind loop variable `x`
B023.py:121:37: B023 Function definition does not bind loop variable `x`
|
121 | any(filter(bool, [None, lambda: x]))
122 | list(filter(bool, [None, lambda: x]))
@ -205,7 +205,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
125 | # But all these should be OK:
|
./resources/test/fixtures/flake8_bugbear/B023.py:171:29: B023 Function definition does not bind loop variable `name`
B023.py:171:29: B023 Function definition does not bind loop variable `name`
|
171 | if foo(name):
172 | return [lambda: name] # known false alarm
@ -214,7 +214,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
174 | if False:
|
./resources/test/fixtures/flake8_bugbear/B023.py:174:29: B023 Function definition does not bind loop variable `i`
B023.py:174:29: B023 Function definition does not bind loop variable `i`
|
174 | if False:
175 | return [lambda: i for i in range(3)] # error

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_bugbear/mod.rs
---
./resources/test/fixtures/flake8_bugbear/B024.py:18:1: B024 `Base_1` is an abstract base class, but it has no abstract methods
B024.py:18:1: B024 `Base_1` is an abstract base class, but it has no abstract methods
|
18 | / class Base_1(ABC): # error
19 | | def method(self):
@ -9,7 +9,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
| |_____________^ B024
|
./resources/test/fixtures/flake8_bugbear/B024.py:71:1: B024 `MetaBase_1` is an abstract base class, but it has no abstract methods
B024.py:71:1: B024 `MetaBase_1` is an abstract base class, but it has no abstract methods
|
71 | / class MetaBase_1(metaclass=ABCMeta): # error
72 | | def method(self):
@ -17,7 +17,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
| |_____________^ B024
|
./resources/test/fixtures/flake8_bugbear/B024.py:82:1: B024 `abc_Base_1` is an abstract base class, but it has no abstract methods
B024.py:82:1: B024 `abc_Base_1` is an abstract base class, but it has no abstract methods
|
82 | / class abc_Base_1(abc.ABC): # error
83 | | def method(self):
@ -25,7 +25,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
| |_____________^ B024
|
./resources/test/fixtures/flake8_bugbear/B024.py:87:1: B024 `abc_Base_2` is an abstract base class, but it has no abstract methods
B024.py:87:1: B024 `abc_Base_2` is an abstract base class, but it has no abstract methods
|
87 | / class abc_Base_2(metaclass=abc.ABCMeta): # error
88 | | def method(self):
@ -33,7 +33,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
| |_____________^ B024
|
./resources/test/fixtures/flake8_bugbear/B024.py:92:1: B024 `notabc_Base_1` is an abstract base class, but it has no abstract methods
B024.py:92:1: B024 `notabc_Base_1` is an abstract base class, but it has no abstract methods
|
92 | / class notabc_Base_1(notabc.ABC): # error
93 | | def method(self):
@ -41,7 +41,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
| |_____________^ B024
|
./resources/test/fixtures/flake8_bugbear/B024.py:141:1: B024 `abc_set_class_variable_4` is an abstract base class, but it has no abstract methods
B024.py:141:1: B024 `abc_set_class_variable_4` is an abstract base class, but it has no abstract methods
|
141 | # this doesn't actually declare a class variable, it's just an expression
142 | / class abc_set_class_variable_4(ABC): # error

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_bugbear/mod.rs
---
./resources/test/fixtures/flake8_bugbear/B025.py:19:8: B025 try-except block with duplicate exception `ValueError`
B025.py:19:8: B025 try-except block with duplicate exception `ValueError`
|
19 | except ValueError:
20 | a = 2
@ -10,7 +10,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
22 | a = 2
|
./resources/test/fixtures/flake8_bugbear/B025.py:28:8: B025 try-except block with duplicate exception `pickle.PickleError`
B025.py:28:8: B025 try-except block with duplicate exception `pickle.PickleError`
|
28 | except ValueError:
29 | a = 2
@ -19,7 +19,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
31 | a = 2
|
./resources/test/fixtures/flake8_bugbear/B025.py:35:8: B025 try-except block with duplicate exception `ValueError`
B025.py:35:8: B025 try-except block with duplicate exception `ValueError`
|
35 | except (ValueError, TypeError):
36 | a = 2
@ -29,7 +29,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
39 | except (OSError, TypeError):
|
./resources/test/fixtures/flake8_bugbear/B025.py:37:18: B025 try-except block with duplicate exception `TypeError`
B025.py:37:18: B025 try-except block with duplicate exception `TypeError`
|
37 | except ValueError:
38 | a = 2

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_bugbear/mod.rs
---
./resources/test/fixtures/flake8_bugbear/B026.py:16:16: B026 Star-arg unpacking after a keyword argument is strongly discouraged
B026.py:16:16: B026 Star-arg unpacking after a keyword argument is strongly discouraged
|
16 | foo("bar", baz="baz", bam="bam")
17 | foo(bar="bar", baz="baz", bam="bam")
@ -11,7 +11,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
20 | foo(baz="baz", bam="bam", *["bar"])
|
./resources/test/fixtures/flake8_bugbear/B026.py:17:16: B026 Star-arg unpacking after a keyword argument is strongly discouraged
B026.py:17:16: B026 Star-arg unpacking after a keyword argument is strongly discouraged
|
17 | foo(bar="bar", baz="baz", bam="bam")
18 | foo(bam="bam", *["bar", "baz"])
@ -21,7 +21,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
21 | foo(bar="bar", baz="baz", bam="bam", *[])
|
./resources/test/fixtures/flake8_bugbear/B026.py:18:27: B026 Star-arg unpacking after a keyword argument is strongly discouraged
B026.py:18:27: B026 Star-arg unpacking after a keyword argument is strongly discouraged
|
18 | foo(bam="bam", *["bar", "baz"])
19 | foo(bam="bam", *bar_baz)
@ -31,7 +31,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
22 | foo(bam="bam", *["bar"], *["baz"])
|
./resources/test/fixtures/flake8_bugbear/B026.py:19:38: B026 Star-arg unpacking after a keyword argument is strongly discouraged
B026.py:19:38: B026 Star-arg unpacking after a keyword argument is strongly discouraged
|
19 | foo(bam="bam", *bar_baz)
20 | foo(baz="baz", bam="bam", *["bar"])
@ -41,7 +41,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
23 | foo(*["bar"], bam="bam", *["baz"])
|
./resources/test/fixtures/flake8_bugbear/B026.py:20:16: B026 Star-arg unpacking after a keyword argument is strongly discouraged
B026.py:20:16: B026 Star-arg unpacking after a keyword argument is strongly discouraged
|
20 | foo(baz="baz", bam="bam", *["bar"])
21 | foo(bar="bar", baz="baz", bam="bam", *[])
@ -50,7 +50,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
23 | foo(*["bar"], bam="bam", *["baz"])
|
./resources/test/fixtures/flake8_bugbear/B026.py:20:26: B026 Star-arg unpacking after a keyword argument is strongly discouraged
B026.py:20:26: B026 Star-arg unpacking after a keyword argument is strongly discouraged
|
20 | foo(baz="baz", bam="bam", *["bar"])
21 | foo(bar="bar", baz="baz", bam="bam", *[])
@ -59,7 +59,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
23 | foo(*["bar"], bam="bam", *["baz"])
|
./resources/test/fixtures/flake8_bugbear/B026.py:21:26: B026 Star-arg unpacking after a keyword argument is strongly discouraged
B026.py:21:26: B026 Star-arg unpacking after a keyword argument is strongly discouraged
|
21 | foo(bar="bar", baz="baz", bam="bam", *[])
22 | foo(bam="bam", *["bar"], *["baz"])

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_bugbear/mod.rs
---
./resources/test/fixtures/flake8_bugbear/B027.py:13:5: B027 `AbstractClass.empty_1` is an empty method in an abstract base class, but has no abstract decorator
B027.py:13:5: B027 `AbstractClass.empty_1` is an empty method in an abstract base class, but has no abstract decorator
|
13 | class AbstractClass(ABC):
14 | def empty_1(self): # error
@ -12,7 +12,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
17 | def empty_2(self): # error
|
./resources/test/fixtures/flake8_bugbear/B027.py:16:5: B027 `AbstractClass.empty_2` is an empty method in an abstract base class, but has no abstract decorator
B027.py:16:5: B027 `AbstractClass.empty_2` is an empty method in an abstract base class, but has no abstract decorator
|
16 | ...
17 |
@ -24,7 +24,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
21 | def empty_3(self): # error
|
./resources/test/fixtures/flake8_bugbear/B027.py:19:5: B027 `AbstractClass.empty_3` is an empty method in an abstract base class, but has no abstract decorator
B027.py:19:5: B027 `AbstractClass.empty_3` is an empty method in an abstract base class, but has no abstract decorator
|
19 | pass
20 |
@ -37,7 +37,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
25 | def empty_4(self): # error
|
./resources/test/fixtures/flake8_bugbear/B027.py:23:5: B027 `AbstractClass.empty_4` is an empty method in an abstract base class, but has no abstract decorator
B027.py:23:5: B027 `AbstractClass.empty_4` is an empty method in an abstract base class, but has no abstract decorator
|
23 | ...
24 |

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_bugbear/mod.rs
---
./resources/test/fixtures/flake8_bugbear/B028.py:8:1: B028 No explicit `stacklevel` keyword argument found
B028.py:8:1: B028 No explicit `stacklevel` keyword argument found
|
8 | """
9 |
@ -11,7 +11,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
12 | warnings.warn(DeprecationWarning("test"), source=None, stacklevel=2)
|
./resources/test/fixtures/flake8_bugbear/B028.py:9:1: B028 No explicit `stacklevel` keyword argument found
B028.py:9:1: B028 No explicit `stacklevel` keyword argument found
|
9 | warnings.warn(DeprecationWarning("test"))
10 | warnings.warn(DeprecationWarning("test"), source=None)

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_bugbear/mod.rs
---
./resources/test/fixtures/flake8_bugbear/B029.py:8:1: B029 Using `except ():` with an empty tuple does not catch anything; add exceptions to handle
B029.py:8:1: B029 Using `except ():` with an empty tuple does not catch anything; add exceptions to handle
|
8 | try:
9 | pass
@ -12,7 +12,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
13 | try:
|
./resources/test/fixtures/flake8_bugbear/B029.py:13:1: B029 Using `except ():` with an empty tuple does not catch anything; add exceptions to handle
B029.py:13:1: B029 Using `except ():` with an empty tuple does not catch anything; add exceptions to handle
|
13 | try:
14 | pass

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_bugbear/mod.rs
---
./resources/test/fixtures/flake8_bugbear/B030.py:12:8: B030 `except` handlers should only be exception classes or tuples of exception classes
B030.py:12:8: B030 `except` handlers should only be exception classes or tuples of exception classes
|
12 | try:
13 | pass
@ -10,7 +10,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
15 | pass
|
./resources/test/fixtures/flake8_bugbear/B030.py:17:9: B030 `except` handlers should only be exception classes or tuples of exception classes
B030.py:17:9: B030 `except` handlers should only be exception classes or tuples of exception classes
|
17 | try:
18 | pass
@ -19,7 +19,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
20 | pass
|
./resources/test/fixtures/flake8_bugbear/B030.py:22:21: B030 `except` handlers should only be exception classes or tuples of exception classes
B030.py:22:21: B030 `except` handlers should only be exception classes or tuples of exception classes
|
22 | try:
23 | pass
@ -28,7 +28,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
25 | pass
|
./resources/test/fixtures/flake8_bugbear/B030.py:27:37: B030 `except` handlers should only be exception classes or tuples of exception classes
B030.py:27:37: B030 `except` handlers should only be exception classes or tuples of exception classes
|
27 | try:
28 | pass
@ -37,7 +37,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
30 | pass
|
./resources/test/fixtures/flake8_bugbear/B030.py:33:29: B030 `except` handlers should only be exception classes or tuples of exception classes
B030.py:33:29: B030 `except` handlers should only be exception classes or tuples of exception classes
|
33 | try:
34 | pass

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_bugbear/mod.rs
---
./resources/test/fixtures/flake8_bugbear/B031.py:27:37: B031 Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage
B031.py:27:37: B031 Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage
|
27 | for shopper in shoppers:
28 | shopper = shopper.title()
@ -11,7 +11,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
31 | collect_shop_items(shopper, section_items) # B031
|
./resources/test/fixtures/flake8_bugbear/B031.py:29:33: B031 Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage
B031.py:29:33: B031 Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage
|
29 | collect_shop_items(shopper, section_items) # B031
30 | # We're outside the nested loop and used the group again.
@ -21,7 +21,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
33 | for _section, section_items in groupby(items, key=lambda p: p[1]):
|
./resources/test/fixtures/flake8_bugbear/B031.py:33:31: B031 Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage
B031.py:33:31: B031 Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage
|
33 | for _section, section_items in groupby(items, key=lambda p: p[1]):
34 | collect_shop_items("Jane", section_items)
@ -29,7 +29,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
| ^^^^^^^^^^^^^ B031
|
./resources/test/fixtures/flake8_bugbear/B031.py:40:37: B031 Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage
B031.py:40:37: B031 Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage
|
40 | countdown = 3
41 | while countdown > 0:
@ -38,7 +38,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
43 | countdown -= 1
|
./resources/test/fixtures/flake8_bugbear/B031.py:46:29: B031 Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage
B031.py:46:29: B031 Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage
|
46 | collection = []
47 | for _section, section_items in groupby(items, key=lambda p: p[1]):
@ -48,7 +48,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
50 | unique_items = set()
|
./resources/test/fixtures/flake8_bugbear/B031.py:56:17: B031 Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage
B031.py:56:17: B031 Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage
|
56 | # But it should be detected when used again
57 | for item in section_items: # B031
@ -56,7 +56,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
58 | another_set.add(item)
|
./resources/test/fixtures/flake8_bugbear/B031.py:79:37: B031 Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage
B031.py:79:37: B031 Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage
|
79 | for _section, section_items in itertools.groupby(items, key=lambda p: p[1]):
80 | for shopper in shoppers:
@ -66,7 +66,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
83 | for _section, section_items in itertools.groupby(items, key=lambda p: p[1]):
|
./resources/test/fixtures/flake8_bugbear/B031.py:82:38: B031 Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage
B031.py:82:38: B031 Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage
|
82 | for _section, section_items in itertools.groupby(items, key=lambda p: p[1]):
83 | _ = [collect_shop_items(shopper, section_items) for shopper in shoppers] # B031
@ -75,7 +75,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
85 | for _section, section_items in itertools.groupby(items, key=lambda p: p[1]):
|
./resources/test/fixtures/flake8_bugbear/B031.py:94:65: B031 Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage
B031.py:94:65: B031 Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage
|
94 | for _section, section_items in itertools.groupby(items, key=lambda p: p[1]):
95 | # The iterator is being used for the second time.
@ -85,7 +85,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
98 | for _section, section_items in itertools.groupby(items, key=lambda p: p[1]):
|
./resources/test/fixtures/flake8_bugbear/B031.py:101:37: B031 Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage
B031.py:101:37: B031 Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage
|
101 | else:
102 | collect_shop_items(shopper, section_items)
@ -95,7 +95,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
105 | for _section, section_items in itertools.groupby(items, key=lambda p: p[1]):
|
./resources/test/fixtures/flake8_bugbear/B031.py:108:41: B031 Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage
B031.py:108:41: B031 Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage
|
108 | collect_shop_items(shopper, section_items)
109 | if _section == "greens":
@ -105,7 +105,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
112 | collect_shop_items(shopper, section_items) # B031
|
./resources/test/fixtures/flake8_bugbear/B031.py:110:41: B031 Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage
B031.py:110:41: B031 Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage
|
110 | collect_shop_items(shopper, section_items) # B031
111 | elif _section == "frozen items":
@ -115,7 +115,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
114 | collect_shop_items(shopper, section_items) # B031
|
./resources/test/fixtures/flake8_bugbear/B031.py:112:41: B031 Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage
B031.py:112:41: B031 Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage
|
112 | collect_shop_items(shopper, section_items) # B031
113 | else:
@ -125,7 +125,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
116 | elif _section == "frozen items":
|
./resources/test/fixtures/flake8_bugbear/B031.py:113:37: B031 Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage
B031.py:113:37: B031 Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage
|
113 | else:
114 | collect_shop_items(shopper, section_items) # B031
@ -135,7 +135,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
117 | # Mix `match` and `if` statements
|
./resources/test/fixtures/flake8_bugbear/B031.py:120:49: B031 Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage
B031.py:120:49: B031 Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage
|
120 | collect_shop_items(shopper, section_items)
121 | if _section == "fourth":
@ -145,7 +145,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
124 | collect_shop_items(shopper, section_items)
|
./resources/test/fixtures/flake8_bugbear/B031.py:126:33: B031 Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage
B031.py:126:33: B031 Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage
|
126 | collect_shop_items(shopper, section_items)
127 | # Now, it should detect
@ -155,7 +155,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
130 | for _section, section_items in itertools.groupby(items, key=lambda p: p[1]):
|
./resources/test/fixtures/flake8_bugbear/B031.py:135:49: B031 Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage
B031.py:135:49: B031 Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage
|
135 | match shopper:
136 | case "Jane":
@ -165,7 +165,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
139 | collect_shop_items(shopper, section_items) # B031
|
./resources/test/fixtures/flake8_bugbear/B031.py:137:49: B031 Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage
B031.py:137:49: B031 Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage
|
137 | collect_shop_items(shopper, section_items) # B031
138 | case _:
@ -175,7 +175,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
141 | collect_shop_items(shopper, section_items)
|
./resources/test/fixtures/flake8_bugbear/B031.py:140:41: B031 Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage
B031.py:140:41: B031 Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage
|
140 | case "frozen items":
141 | collect_shop_items(shopper, section_items)
@ -185,7 +185,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
144 | collect_shop_items(shopper, section_items)
|
./resources/test/fixtures/flake8_bugbear/B031.py:144:33: B031 Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage
B031.py:144:33: B031 Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage
|
144 | collect_shop_items(shopper, section_items)
145 | # Now, it should detect

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_bugbear/mod.rs
---
./resources/test/fixtures/flake8_bugbear/B032.py:9:1: B032 Possible unintentional type annotation (using `:`). Did you mean to assign (using `=`)?
B032.py:9:1: B032 Possible unintentional type annotation (using `:`). Did you mean to assign (using `=`)?
|
9 | dct = {"a": 1}
10 |
@ -10,7 +10,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
12 | dct.b: 2
|
./resources/test/fixtures/flake8_bugbear/B032.py:10:1: B032 Possible unintentional type annotation (using `:`). Did you mean to assign (using `=`)?
B032.py:10:1: B032 Possible unintentional type annotation (using `:`). Did you mean to assign (using `=`)?
|
10 | dct["b"]: 2
11 | dct.b: 2
@ -19,7 +19,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
13 | dct["b"]: "test"
|
./resources/test/fixtures/flake8_bugbear/B032.py:12:1: B032 Possible unintentional type annotation (using `:`). Did you mean to assign (using `=`)?
B032.py:12:1: B032 Possible unintentional type annotation (using `:`). Did you mean to assign (using `=`)?
|
12 | dct.b: 2
13 |
@ -28,7 +28,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
15 | dct.b: "test"
|
./resources/test/fixtures/flake8_bugbear/B032.py:13:1: B032 Possible unintentional type annotation (using `:`). Did you mean to assign (using `=`)?
B032.py:13:1: B032 Possible unintentional type annotation (using `:`). Did you mean to assign (using `=`)?
|
13 | dct["b"]: "test"
14 | dct.b: "test"
@ -37,7 +37,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
16 | test = "test"
|
./resources/test/fixtures/flake8_bugbear/B032.py:16:1: B032 Possible unintentional type annotation (using `:`). Did you mean to assign (using `=`)?
B032.py:16:1: B032 Possible unintentional type annotation (using `:`). Did you mean to assign (using `=`)?
|
16 | test = "test"
17 | dct["b"]: test
@ -46,7 +46,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
19 | dct.b: test
|
./resources/test/fixtures/flake8_bugbear/B032.py:17:1: B032 Possible unintentional type annotation (using `:`). Did you mean to assign (using `=`)?
B032.py:17:1: B032 Possible unintentional type annotation (using `:`). Did you mean to assign (using `=`)?
|
17 | test = "test"
18 | dct["b"]: test
@ -56,7 +56,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
21 | dct.b: test.lower()
|
./resources/test/fixtures/flake8_bugbear/B032.py:18:1: B032 Possible unintentional type annotation (using `:`). Did you mean to assign (using `=`)?
B032.py:18:1: B032 Possible unintentional type annotation (using `:`). Did you mean to assign (using `=`)?
|
18 | dct["b"]: test
19 | dct["b"]: test.lower()
@ -65,7 +65,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
21 | dct.b: test.lower()
|
./resources/test/fixtures/flake8_bugbear/B032.py:19:1: B032 Possible unintentional type annotation (using `:`). Did you mean to assign (using `=`)?
B032.py:19:1: B032 Possible unintentional type annotation (using `:`). Did you mean to assign (using `=`)?
|
19 | dct["b"]: test.lower()
20 | dct.b: test

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_bugbear/mod.rs
---
./resources/test/fixtures/flake8_bugbear/B904.py:10:9: B904 Within an `except` clause, raise exceptions with `raise ... from err` or `raise ... from None` to distinguish them from errors in exception handling
B904.py:10:9: B904 Within an `except` clause, raise exceptions with `raise ... from err` or `raise ... from None` to distinguish them from errors in exception handling
|
10 | except ValueError:
11 | if "abc":
@ -11,7 +11,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
14 | except AssertionError:
|
./resources/test/fixtures/flake8_bugbear/B904.py:11:5: B904 Within an `except` clause, raise exceptions with `raise ... from err` or `raise ... from None` to distinguish them from errors in exception handling
B904.py:11:5: B904 Within an `except` clause, raise exceptions with `raise ... from err` or `raise ... from None` to distinguish them from errors in exception handling
|
11 | if "abc":
12 | raise TypeError
@ -21,7 +21,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
15 | raise # Bare `raise` should not be an error
|
./resources/test/fixtures/flake8_bugbear/B904.py:16:5: B904 Within an `except` clause, raise exceptions with `raise ... from err` or `raise ... from None` to distinguish them from errors in exception handling
B904.py:16:5: B904 Within an `except` clause, raise exceptions with `raise ... from err` or `raise ... from None` to distinguish them from errors in exception handling
|
16 | except Exception as err:
17 | assert err
@ -31,7 +31,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
20 | # Might use this instead of bare raise with the `.with_traceback()` method
|
./resources/test/fixtures/flake8_bugbear/B904.py:62:9: B904 Within an `except` clause, raise exceptions with `raise ... from err` or `raise ... from None` to distinguish them from errors in exception handling
B904.py:62:9: B904 Within an `except` clause, raise exceptions with `raise ... from err` or `raise ... from None` to distinguish them from errors in exception handling
|
62 | except Exception as e:
63 | if ...:
@ -41,7 +41,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
66 | raise RuntimeError("bang!")
|
./resources/test/fixtures/flake8_bugbear/B904.py:64:9: B904 Within an `except` clause, raise exceptions with `raise ... from err` or `raise ... from None` to distinguish them from errors in exception handling
B904.py:64:9: B904 Within an `except` clause, raise exceptions with `raise ... from err` or `raise ... from None` to distinguish them from errors in exception handling
|
64 | raise RuntimeError("boom!")
65 | else:
@ -49,7 +49,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ B904
|
./resources/test/fixtures/flake8_bugbear/B904.py:72:13: B904 Within an `except` clause, raise exceptions with `raise ... from err` or `raise ... from None` to distinguish them from errors in exception handling
B904.py:72:13: B904 Within an `except` clause, raise exceptions with `raise ... from err` or `raise ... from None` to distinguish them from errors in exception handling
|
72 | match 0:
73 | case 0:

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_bugbear/mod.rs
---
./resources/test/fixtures/flake8_bugbear/B905.py:1:1: B905 `zip()` without an explicit `strict=` parameter
B905.py:1:1: B905 `zip()` without an explicit `strict=` parameter
|
1 | zip()
| ^^^^^ B905
@ -9,7 +9,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
3 | zip("a", "b")
|
./resources/test/fixtures/flake8_bugbear/B905.py:2:1: B905 `zip()` without an explicit `strict=` parameter
B905.py:2:1: B905 `zip()` without an explicit `strict=` parameter
|
2 | zip()
3 | zip(range(3))
@ -18,7 +18,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
5 | zip("a", "b", *zip("c"))
|
./resources/test/fixtures/flake8_bugbear/B905.py:3:1: B905 `zip()` without an explicit `strict=` parameter
B905.py:3:1: B905 `zip()` without an explicit `strict=` parameter
|
3 | zip()
4 | zip(range(3))
@ -28,7 +28,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
7 | zip(zip("a"), strict=False)
|
./resources/test/fixtures/flake8_bugbear/B905.py:4:1: B905 `zip()` without an explicit `strict=` parameter
B905.py:4:1: B905 `zip()` without an explicit `strict=` parameter
|
4 | zip(range(3))
5 | zip("a", "b")
@ -38,7 +38,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
8 | zip(zip("a", strict=True))
|
./resources/test/fixtures/flake8_bugbear/B905.py:4:16: B905 `zip()` without an explicit `strict=` parameter
B905.py:4:16: B905 `zip()` without an explicit `strict=` parameter
|
4 | zip(range(3))
5 | zip("a", "b")
@ -48,7 +48,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
8 | zip(zip("a", strict=True))
|
./resources/test/fixtures/flake8_bugbear/B905.py:5:5: B905 `zip()` without an explicit `strict=` parameter
B905.py:5:5: B905 `zip()` without an explicit `strict=` parameter
|
5 | zip("a", "b")
6 | zip("a", "b", *zip("c"))
@ -57,7 +57,7 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
8 | zip(zip("a", strict=True))
|
./resources/test/fixtures/flake8_bugbear/B905.py:6:1: B905 `zip()` without an explicit `strict=` parameter
B905.py:6:1: B905 `zip()` without an explicit `strict=` parameter
|
6 | zip("a", "b", *zip("c"))
7 | zip(zip("a"), strict=False)

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_bugbear/mod.rs
---
./resources/test/fixtures/flake8_bugbear/B008_extended.py:19:51: B008 Do not perform function call `Depends` in argument defaults
B008_extended.py:19:51: B008 Do not perform function call `Depends` in argument defaults
|
19 | def error_due_to_missing_import(data: List[str] = Depends(None)):
| ^^^^^^^^^^^^^ B008

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_builtins/mod.rs
---
./resources/test/fixtures/flake8_builtins/A001.py:1:1: A001 Variable `sum` is shadowing a python builtin
A001.py:1:1: A001 Variable `sum` is shadowing a python builtin
|
1 | import some as sum
| ^^^^^^^^^^^^^^^^^^ A001
@ -9,7 +9,7 @@ source: crates/ruff/src/rules/flake8_builtins/mod.rs
3 | from directory import new as dir
|
./resources/test/fixtures/flake8_builtins/A001.py:2:1: A001 Variable `int` is shadowing a python builtin
A001.py:2:1: A001 Variable `int` is shadowing a python builtin
|
2 | import some as sum
3 | from some import other as int
@ -17,7 +17,7 @@ source: crates/ruff/src/rules/flake8_builtins/mod.rs
4 | from directory import new as dir
|
./resources/test/fixtures/flake8_builtins/A001.py:3:1: A001 Variable `dir` is shadowing a python builtin
A001.py:3:1: A001 Variable `dir` is shadowing a python builtin
|
3 | import some as sum
4 | from some import other as int
@ -27,7 +27,7 @@ source: crates/ruff/src/rules/flake8_builtins/mod.rs
7 | print = 1
|
./resources/test/fixtures/flake8_builtins/A001.py:5:1: A001 Variable `print` is shadowing a python builtin
A001.py:5:1: A001 Variable `print` is shadowing a python builtin
|
5 | from directory import new as dir
6 |
@ -37,7 +37,7 @@ source: crates/ruff/src/rules/flake8_builtins/mod.rs
9 | (complex := 3)
|
./resources/test/fixtures/flake8_builtins/A001.py:6:1: A001 Variable `copyright` is shadowing a python builtin
A001.py:6:1: A001 Variable `copyright` is shadowing a python builtin
|
6 | print = 1
7 | copyright: 'annotation' = 2
@ -46,7 +46,7 @@ source: crates/ruff/src/rules/flake8_builtins/mod.rs
9 | float = object = 4
|
./resources/test/fixtures/flake8_builtins/A001.py:7:2: A001 Variable `complex` is shadowing a python builtin
A001.py:7:2: A001 Variable `complex` is shadowing a python builtin
|
7 | print = 1
8 | copyright: 'annotation' = 2
@ -56,7 +56,7 @@ source: crates/ruff/src/rules/flake8_builtins/mod.rs
11 | min, max = 5, 6
|
./resources/test/fixtures/flake8_builtins/A001.py:8:1: A001 Variable `float` is shadowing a python builtin
A001.py:8:1: A001 Variable `float` is shadowing a python builtin
|
8 | copyright: 'annotation' = 2
9 | (complex := 3)
@ -65,7 +65,7 @@ source: crates/ruff/src/rules/flake8_builtins/mod.rs
11 | min, max = 5, 6
|
./resources/test/fixtures/flake8_builtins/A001.py:8:9: A001 Variable `object` is shadowing a python builtin
A001.py:8:9: A001 Variable `object` is shadowing a python builtin
|
8 | copyright: 'annotation' = 2
9 | (complex := 3)
@ -74,7 +74,7 @@ source: crates/ruff/src/rules/flake8_builtins/mod.rs
11 | min, max = 5, 6
|
./resources/test/fixtures/flake8_builtins/A001.py:9:1: A001 Variable `min` is shadowing a python builtin
A001.py:9:1: A001 Variable `min` is shadowing a python builtin
|
9 | (complex := 3)
10 | float = object = 4
@ -84,7 +84,7 @@ source: crates/ruff/src/rules/flake8_builtins/mod.rs
13 | id = 4
|
./resources/test/fixtures/flake8_builtins/A001.py:9:6: A001 Variable `max` is shadowing a python builtin
A001.py:9:6: A001 Variable `max` is shadowing a python builtin
|
9 | (complex := 3)
10 | float = object = 4
@ -94,7 +94,7 @@ source: crates/ruff/src/rules/flake8_builtins/mod.rs
13 | id = 4
|
./resources/test/fixtures/flake8_builtins/A001.py:11:1: A001 Variable `id` is shadowing a python builtin
A001.py:11:1: A001 Variable `id` is shadowing a python builtin
|
11 | min, max = 5, 6
12 |
@ -104,7 +104,7 @@ source: crates/ruff/src/rules/flake8_builtins/mod.rs
15 | def bytes():
|
./resources/test/fixtures/flake8_builtins/A001.py:13:1: A001 Variable `bytes` is shadowing a python builtin
A001.py:13:1: A001 Variable `bytes` is shadowing a python builtin
|
13 | id = 4
14 |
@ -115,7 +115,7 @@ source: crates/ruff/src/rules/flake8_builtins/mod.rs
18 | class slice:
|
./resources/test/fixtures/flake8_builtins/A001.py:16:1: A001 Variable `slice` is shadowing a python builtin
A001.py:16:1: A001 Variable `slice` is shadowing a python builtin
|
16 | pass
17 |
@ -126,7 +126,7 @@ source: crates/ruff/src/rules/flake8_builtins/mod.rs
21 | try:
|
./resources/test/fixtures/flake8_builtins/A001.py:21:1: A001 Variable `ValueError` is shadowing a python builtin
A001.py:21:1: A001 Variable `ValueError` is shadowing a python builtin
|
21 | try:
22 | ...
@ -137,7 +137,7 @@ source: crates/ruff/src/rules/flake8_builtins/mod.rs
26 | for memoryview, *bytearray in []:
|
./resources/test/fixtures/flake8_builtins/A001.py:24:5: A001 Variable `memoryview` is shadowing a python builtin
A001.py:24:5: A001 Variable `memoryview` is shadowing a python builtin
|
24 | ...
25 |
@ -146,7 +146,7 @@ source: crates/ruff/src/rules/flake8_builtins/mod.rs
27 | pass
|
./resources/test/fixtures/flake8_builtins/A001.py:24:18: A001 Variable `bytearray` is shadowing a python builtin
A001.py:24:18: A001 Variable `bytearray` is shadowing a python builtin
|
24 | ...
25 |
@ -155,7 +155,7 @@ source: crates/ruff/src/rules/flake8_builtins/mod.rs
27 | pass
|
./resources/test/fixtures/flake8_builtins/A001.py:27:22: A001 Variable `str` is shadowing a python builtin
A001.py:27:22: A001 Variable `str` is shadowing a python builtin
|
27 | pass
28 |
@ -164,7 +164,7 @@ source: crates/ruff/src/rules/flake8_builtins/mod.rs
30 | pass
|
./resources/test/fixtures/flake8_builtins/A001.py:27:45: A001 Variable `all` is shadowing a python builtin
A001.py:27:45: A001 Variable `all` is shadowing a python builtin
|
27 | pass
28 |
@ -173,7 +173,7 @@ source: crates/ruff/src/rules/flake8_builtins/mod.rs
30 | pass
|
./resources/test/fixtures/flake8_builtins/A001.py:27:50: A001 Variable `any` is shadowing a python builtin
A001.py:27:50: A001 Variable `any` is shadowing a python builtin
|
27 | pass
28 |
@ -182,7 +182,7 @@ source: crates/ruff/src/rules/flake8_builtins/mod.rs
30 | pass
|
./resources/test/fixtures/flake8_builtins/A001.py:30:8: A001 Variable `sum` is shadowing a python builtin
A001.py:30:8: A001 Variable `sum` is shadowing a python builtin
|
30 | pass
31 |

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_builtins/mod.rs
---
./resources/test/fixtures/flake8_builtins/A001.py:1:1: A001 Variable `sum` is shadowing a python builtin
A001.py:1:1: A001 Variable `sum` is shadowing a python builtin
|
1 | import some as sum
| ^^^^^^^^^^^^^^^^^^ A001
@ -9,7 +9,7 @@ source: crates/ruff/src/rules/flake8_builtins/mod.rs
3 | from directory import new as dir
|
./resources/test/fixtures/flake8_builtins/A001.py:2:1: A001 Variable `int` is shadowing a python builtin
A001.py:2:1: A001 Variable `int` is shadowing a python builtin
|
2 | import some as sum
3 | from some import other as int
@ -17,7 +17,7 @@ source: crates/ruff/src/rules/flake8_builtins/mod.rs
4 | from directory import new as dir
|
./resources/test/fixtures/flake8_builtins/A001.py:5:1: A001 Variable `print` is shadowing a python builtin
A001.py:5:1: A001 Variable `print` is shadowing a python builtin
|
5 | from directory import new as dir
6 |
@ -27,7 +27,7 @@ source: crates/ruff/src/rules/flake8_builtins/mod.rs
9 | (complex := 3)
|
./resources/test/fixtures/flake8_builtins/A001.py:6:1: A001 Variable `copyright` is shadowing a python builtin
A001.py:6:1: A001 Variable `copyright` is shadowing a python builtin
|
6 | print = 1
7 | copyright: 'annotation' = 2
@ -36,7 +36,7 @@ source: crates/ruff/src/rules/flake8_builtins/mod.rs
9 | float = object = 4
|
./resources/test/fixtures/flake8_builtins/A001.py:7:2: A001 Variable `complex` is shadowing a python builtin
A001.py:7:2: A001 Variable `complex` is shadowing a python builtin
|
7 | print = 1
8 | copyright: 'annotation' = 2
@ -46,7 +46,7 @@ source: crates/ruff/src/rules/flake8_builtins/mod.rs
11 | min, max = 5, 6
|
./resources/test/fixtures/flake8_builtins/A001.py:8:1: A001 Variable `float` is shadowing a python builtin
A001.py:8:1: A001 Variable `float` is shadowing a python builtin
|
8 | copyright: 'annotation' = 2
9 | (complex := 3)
@ -55,7 +55,7 @@ source: crates/ruff/src/rules/flake8_builtins/mod.rs
11 | min, max = 5, 6
|
./resources/test/fixtures/flake8_builtins/A001.py:8:9: A001 Variable `object` is shadowing a python builtin
A001.py:8:9: A001 Variable `object` is shadowing a python builtin
|
8 | copyright: 'annotation' = 2
9 | (complex := 3)
@ -64,7 +64,7 @@ source: crates/ruff/src/rules/flake8_builtins/mod.rs
11 | min, max = 5, 6
|
./resources/test/fixtures/flake8_builtins/A001.py:9:1: A001 Variable `min` is shadowing a python builtin
A001.py:9:1: A001 Variable `min` is shadowing a python builtin
|
9 | (complex := 3)
10 | float = object = 4
@ -74,7 +74,7 @@ source: crates/ruff/src/rules/flake8_builtins/mod.rs
13 | id = 4
|
./resources/test/fixtures/flake8_builtins/A001.py:9:6: A001 Variable `max` is shadowing a python builtin
A001.py:9:6: A001 Variable `max` is shadowing a python builtin
|
9 | (complex := 3)
10 | float = object = 4
@ -84,7 +84,7 @@ source: crates/ruff/src/rules/flake8_builtins/mod.rs
13 | id = 4
|
./resources/test/fixtures/flake8_builtins/A001.py:13:1: A001 Variable `bytes` is shadowing a python builtin
A001.py:13:1: A001 Variable `bytes` is shadowing a python builtin
|
13 | id = 4
14 |
@ -95,7 +95,7 @@ source: crates/ruff/src/rules/flake8_builtins/mod.rs
18 | class slice:
|
./resources/test/fixtures/flake8_builtins/A001.py:16:1: A001 Variable `slice` is shadowing a python builtin
A001.py:16:1: A001 Variable `slice` is shadowing a python builtin
|
16 | pass
17 |
@ -106,7 +106,7 @@ source: crates/ruff/src/rules/flake8_builtins/mod.rs
21 | try:
|
./resources/test/fixtures/flake8_builtins/A001.py:21:1: A001 Variable `ValueError` is shadowing a python builtin
A001.py:21:1: A001 Variable `ValueError` is shadowing a python builtin
|
21 | try:
22 | ...
@ -117,7 +117,7 @@ source: crates/ruff/src/rules/flake8_builtins/mod.rs
26 | for memoryview, *bytearray in []:
|
./resources/test/fixtures/flake8_builtins/A001.py:24:5: A001 Variable `memoryview` is shadowing a python builtin
A001.py:24:5: A001 Variable `memoryview` is shadowing a python builtin
|
24 | ...
25 |
@ -126,7 +126,7 @@ source: crates/ruff/src/rules/flake8_builtins/mod.rs
27 | pass
|
./resources/test/fixtures/flake8_builtins/A001.py:24:18: A001 Variable `bytearray` is shadowing a python builtin
A001.py:24:18: A001 Variable `bytearray` is shadowing a python builtin
|
24 | ...
25 |
@ -135,7 +135,7 @@ source: crates/ruff/src/rules/flake8_builtins/mod.rs
27 | pass
|
./resources/test/fixtures/flake8_builtins/A001.py:27:22: A001 Variable `str` is shadowing a python builtin
A001.py:27:22: A001 Variable `str` is shadowing a python builtin
|
27 | pass
28 |
@ -144,7 +144,7 @@ source: crates/ruff/src/rules/flake8_builtins/mod.rs
30 | pass
|
./resources/test/fixtures/flake8_builtins/A001.py:27:45: A001 Variable `all` is shadowing a python builtin
A001.py:27:45: A001 Variable `all` is shadowing a python builtin
|
27 | pass
28 |
@ -153,7 +153,7 @@ source: crates/ruff/src/rules/flake8_builtins/mod.rs
30 | pass
|
./resources/test/fixtures/flake8_builtins/A001.py:27:50: A001 Variable `any` is shadowing a python builtin
A001.py:27:50: A001 Variable `any` is shadowing a python builtin
|
27 | pass
28 |
@ -162,7 +162,7 @@ source: crates/ruff/src/rules/flake8_builtins/mod.rs
30 | pass
|
./resources/test/fixtures/flake8_builtins/A001.py:30:8: A001 Variable `sum` is shadowing a python builtin
A001.py:30:8: A001 Variable `sum` is shadowing a python builtin
|
30 | pass
31 |

View file

@ -1,49 +1,49 @@
---
source: crates/ruff/src/rules/flake8_builtins/mod.rs
---
./resources/test/fixtures/flake8_builtins/A002.py:1:11: A002 Argument `str` is shadowing a python builtin
A002.py:1:11: A002 Argument `str` is shadowing a python builtin
|
1 | def func1(str, /, type, *complex, Exception, **getattr):
| ^^^ A002
2 | pass
|
./resources/test/fixtures/flake8_builtins/A002.py:1:19: A002 Argument `type` is shadowing a python builtin
A002.py:1:19: A002 Argument `type` is shadowing a python builtin
|
1 | def func1(str, /, type, *complex, Exception, **getattr):
| ^^^^ A002
2 | pass
|
./resources/test/fixtures/flake8_builtins/A002.py:1:26: A002 Argument `complex` is shadowing a python builtin
A002.py:1:26: A002 Argument `complex` is shadowing a python builtin
|
1 | def func1(str, /, type, *complex, Exception, **getattr):
| ^^^^^^^ A002
2 | pass
|
./resources/test/fixtures/flake8_builtins/A002.py:1:35: A002 Argument `Exception` is shadowing a python builtin
A002.py:1:35: A002 Argument `Exception` is shadowing a python builtin
|
1 | def func1(str, /, type, *complex, Exception, **getattr):
| ^^^^^^^^^ A002
2 | pass
|
./resources/test/fixtures/flake8_builtins/A002.py:1:48: A002 Argument `getattr` is shadowing a python builtin
A002.py:1:48: A002 Argument `getattr` is shadowing a python builtin
|
1 | def func1(str, /, type, *complex, Exception, **getattr):
| ^^^^^^^ A002
2 | pass
|
./resources/test/fixtures/flake8_builtins/A002.py:5:17: A002 Argument `bytes` is shadowing a python builtin
A002.py:5:17: A002 Argument `bytes` is shadowing a python builtin
|
5 | async def func2(bytes):
| ^^^^^ A002
6 | pass
|
./resources/test/fixtures/flake8_builtins/A002.py:8:17: A002 Argument `id` is shadowing a python builtin
A002.py:8:17: A002 Argument `id` is shadowing a python builtin
|
8 | pass
9 |
@ -52,7 +52,7 @@ source: crates/ruff/src/rules/flake8_builtins/mod.rs
11 | pass
|
./resources/test/fixtures/flake8_builtins/A002.py:8:21: A002 Argument `dir` is shadowing a python builtin
A002.py:8:21: A002 Argument `dir` is shadowing a python builtin
|
8 | pass
9 |
@ -61,7 +61,7 @@ source: crates/ruff/src/rules/flake8_builtins/mod.rs
11 | pass
|
./resources/test/fixtures/flake8_builtins/A002.py:11:16: A002 Argument `float` is shadowing a python builtin
A002.py:11:16: A002 Argument `float` is shadowing a python builtin
|
11 | pass
12 |

View file

@ -1,49 +1,49 @@
---
source: crates/ruff/src/rules/flake8_builtins/mod.rs
---
./resources/test/fixtures/flake8_builtins/A002.py:1:11: A002 Argument `str` is shadowing a python builtin
A002.py:1:11: A002 Argument `str` is shadowing a python builtin
|
1 | def func1(str, /, type, *complex, Exception, **getattr):
| ^^^ A002
2 | pass
|
./resources/test/fixtures/flake8_builtins/A002.py:1:19: A002 Argument `type` is shadowing a python builtin
A002.py:1:19: A002 Argument `type` is shadowing a python builtin
|
1 | def func1(str, /, type, *complex, Exception, **getattr):
| ^^^^ A002
2 | pass
|
./resources/test/fixtures/flake8_builtins/A002.py:1:26: A002 Argument `complex` is shadowing a python builtin
A002.py:1:26: A002 Argument `complex` is shadowing a python builtin
|
1 | def func1(str, /, type, *complex, Exception, **getattr):
| ^^^^^^^ A002
2 | pass
|
./resources/test/fixtures/flake8_builtins/A002.py:1:35: A002 Argument `Exception` is shadowing a python builtin
A002.py:1:35: A002 Argument `Exception` is shadowing a python builtin
|
1 | def func1(str, /, type, *complex, Exception, **getattr):
| ^^^^^^^^^ A002
2 | pass
|
./resources/test/fixtures/flake8_builtins/A002.py:1:48: A002 Argument `getattr` is shadowing a python builtin
A002.py:1:48: A002 Argument `getattr` is shadowing a python builtin
|
1 | def func1(str, /, type, *complex, Exception, **getattr):
| ^^^^^^^ A002
2 | pass
|
./resources/test/fixtures/flake8_builtins/A002.py:5:17: A002 Argument `bytes` is shadowing a python builtin
A002.py:5:17: A002 Argument `bytes` is shadowing a python builtin
|
5 | async def func2(bytes):
| ^^^^^ A002
6 | pass
|
./resources/test/fixtures/flake8_builtins/A002.py:11:16: A002 Argument `float` is shadowing a python builtin
A002.py:11:16: A002 Argument `float` is shadowing a python builtin
|
11 | pass
12 |

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_builtins/mod.rs
---
./resources/test/fixtures/flake8_builtins/A003.py:2:5: A003 Class attribute `ImportError` is shadowing a python builtin
A003.py:2:5: A003 Class attribute `ImportError` is shadowing a python builtin
|
2 | class MyClass:
3 | ImportError = 4
@ -10,7 +10,7 @@ source: crates/ruff/src/rules/flake8_builtins/mod.rs
5 | dir = "/"
|
./resources/test/fixtures/flake8_builtins/A003.py:3:5: A003 Class attribute `id` is shadowing a python builtin
A003.py:3:5: A003 Class attribute `id` is shadowing a python builtin
|
3 | class MyClass:
4 | ImportError = 4
@ -19,7 +19,7 @@ source: crates/ruff/src/rules/flake8_builtins/mod.rs
6 | dir = "/"
|
./resources/test/fixtures/flake8_builtins/A003.py:4:5: A003 Class attribute `dir` is shadowing a python builtin
A003.py:4:5: A003 Class attribute `dir` is shadowing a python builtin
|
4 | ImportError = 4
5 | id = 5
@ -29,7 +29,7 @@ source: crates/ruff/src/rules/flake8_builtins/mod.rs
8 | def __init__(self):
|
./resources/test/fixtures/flake8_builtins/A003.py:11:5: A003 Class attribute `str` is shadowing a python builtin
A003.py:11:5: A003 Class attribute `str` is shadowing a python builtin
|
11 | self.dir = "."
12 |

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_builtins/mod.rs
---
./resources/test/fixtures/flake8_builtins/A003.py:2:5: A003 Class attribute `ImportError` is shadowing a python builtin
A003.py:2:5: A003 Class attribute `ImportError` is shadowing a python builtin
|
2 | class MyClass:
3 | ImportError = 4
@ -10,7 +10,7 @@ source: crates/ruff/src/rules/flake8_builtins/mod.rs
5 | dir = "/"
|
./resources/test/fixtures/flake8_builtins/A003.py:11:5: A003 Class attribute `str` is shadowing a python builtin
A003.py:11:5: A003 Class attribute `str` is shadowing a python builtin
|
11 | self.dir = "."
12 |

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_commas/mod.rs
---
./resources/test/fixtures/flake8_commas/COM81.py:4:18: COM812 [*] Trailing comma missing
COM81.py:4:18: COM812 [*] Trailing comma missing
|
4 | bad_function_call(
5 | param1='test',
@ -22,7 +22,7 @@ source: crates/ruff/src/rules/flake8_commas/mod.rs
6 6 | # ==> bad_list.py <==
7 7 | bad_list = [
./resources/test/fixtures/flake8_commas/COM81.py:10:6: COM812 [*] Trailing comma missing
COM81.py:10:6: COM812 [*] Trailing comma missing
|
10 | 1,
11 | 2,
@ -42,7 +42,7 @@ source: crates/ruff/src/rules/flake8_commas/mod.rs
12 12 |
13 13 | bad_list_with_comment = [
./resources/test/fixtures/flake8_commas/COM81.py:16:6: COM812 [*] Trailing comma missing
COM81.py:16:6: COM812 [*] Trailing comma missing
|
16 | 1,
17 | 2,
@ -63,7 +63,7 @@ source: crates/ruff/src/rules/flake8_commas/mod.rs
18 18 | ]
19 19 |
./resources/test/fixtures/flake8_commas/COM81.py:23:6: COM812 [*] Trailing comma missing
COM81.py:23:6: COM812 [*] Trailing comma missing
|
23 | 1,
24 | 2,
@ -82,7 +82,7 @@ source: crates/ruff/src/rules/flake8_commas/mod.rs
25 25 |
26 26 |
./resources/test/fixtures/flake8_commas/COM81.py:36:8: COM818 Trailing comma on bare tuple prohibited
COM81.py:36:8: COM818 Trailing comma on bare tuple prohibited
|
36 | foo = (1,)
37 |
@ -92,7 +92,7 @@ source: crates/ruff/src/rules/flake8_commas/mod.rs
40 | bar = 1; foo = bar,
|
./resources/test/fixtures/flake8_commas/COM81.py:38:19: COM818 Trailing comma on bare tuple prohibited
COM81.py:38:19: COM818 Trailing comma on bare tuple prohibited
|
38 | foo = 1,
39 |
@ -102,7 +102,7 @@ source: crates/ruff/src/rules/flake8_commas/mod.rs
42 | foo = (
|
./resources/test/fixtures/flake8_commas/COM81.py:45:8: COM818 Trailing comma on bare tuple prohibited
COM81.py:45:8: COM818 Trailing comma on bare tuple prohibited
|
45 | )
46 |
@ -112,7 +112,7 @@ source: crates/ruff/src/rules/flake8_commas/mod.rs
49 | class A(object):
|
./resources/test/fixtures/flake8_commas/COM81.py:49:10: COM818 Trailing comma on bare tuple prohibited
COM81.py:49:10: COM818 Trailing comma on bare tuple prohibited
|
49 | class A(object):
50 | foo = 3
@ -121,7 +121,7 @@ source: crates/ruff/src/rules/flake8_commas/mod.rs
52 | foo_bar = 2
|
./resources/test/fixtures/flake8_commas/COM81.py:56:32: COM818 Trailing comma on bare tuple prohibited
COM81.py:56:32: COM818 Trailing comma on bare tuple prohibited
|
56 | from foo import bar, baz
57 |
@ -131,7 +131,7 @@ source: crates/ruff/src/rules/flake8_commas/mod.rs
60 | group_by = ('foobar' * 3),
|
./resources/test/fixtures/flake8_commas/COM81.py:58:26: COM818 Trailing comma on bare tuple prohibited
COM81.py:58:26: COM818 Trailing comma on bare tuple prohibited
|
58 | group_by = function_call('arg'),
59 |
@ -141,7 +141,7 @@ source: crates/ruff/src/rules/flake8_commas/mod.rs
62 | def foo():
|
./resources/test/fixtures/flake8_commas/COM81.py:61:17: COM818 Trailing comma on bare tuple prohibited
COM81.py:61:17: COM818 Trailing comma on bare tuple prohibited
|
61 | def foo():
62 | return False,
@ -150,7 +150,7 @@ source: crates/ruff/src/rules/flake8_commas/mod.rs
64 | # ==> callable_before_parenth_form.py <==
|
./resources/test/fixtures/flake8_commas/COM81.py:70:8: COM812 [*] Trailing comma missing
COM81.py:70:8: COM812 [*] Trailing comma missing
|
70 | {'foo': foo}['foo'](
71 | bar
@ -169,7 +169,7 @@ source: crates/ruff/src/rules/flake8_commas/mod.rs
72 72 |
73 73 | {'foo': foo}['foo'](
./resources/test/fixtures/flake8_commas/COM81.py:78:8: COM812 [*] Trailing comma missing
COM81.py:78:8: COM812 [*] Trailing comma missing
|
78 | (foo)(
79 | bar
@ -188,7 +188,7 @@ source: crates/ruff/src/rules/flake8_commas/mod.rs
80 80 |
81 81 | (foo)[0](
./resources/test/fixtures/flake8_commas/COM81.py:86:8: COM812 [*] Trailing comma missing
COM81.py:86:8: COM812 [*] Trailing comma missing
|
86 | [foo][0](
87 | bar
@ -207,7 +207,7 @@ source: crates/ruff/src/rules/flake8_commas/mod.rs
88 88 |
89 89 | [foo][0](
./resources/test/fixtures/flake8_commas/COM81.py:152:6: COM812 [*] Trailing comma missing
COM81.py:152:6: COM812 [*] Trailing comma missing
|
152 | # ==> keyword_before_parenth_form/base_bad.py <==
153 | from x import (
@ -227,7 +227,7 @@ source: crates/ruff/src/rules/flake8_commas/mod.rs
154 154 |
155 155 | assert(
./resources/test/fixtures/flake8_commas/COM81.py:158:11: COM812 [*] Trailing comma missing
COM81.py:158:11: COM812 [*] Trailing comma missing
|
158 | SyntaxWarning,
159 | ThrownHere,
@ -247,7 +247,7 @@ source: crates/ruff/src/rules/flake8_commas/mod.rs
160 160 |
161 161 | # async await is fine outside an async def
./resources/test/fixtures/flake8_commas/COM81.py:293:15: COM812 [*] Trailing comma missing
COM81.py:293:15: COM812 [*] Trailing comma missing
|
293 | # ==> multiline_bad_dict.py <==
294 | multiline_bad_dict = {
@ -268,7 +268,7 @@ source: crates/ruff/src/rules/flake8_commas/mod.rs
295 295 | # ==> multiline_bad_function_def.py <==
296 296 | def func_good(
./resources/test/fixtures/flake8_commas/COM81.py:304:14: COM812 [*] Trailing comma missing
COM81.py:304:14: COM812 [*] Trailing comma missing
|
304 | def func_bad(
305 | a = 3,
@ -289,7 +289,7 @@ source: crates/ruff/src/rules/flake8_commas/mod.rs
306 306 | pass
307 307 |
./resources/test/fixtures/flake8_commas/COM81.py:310:14: COM812 [*] Trailing comma missing
COM81.py:310:14: COM812 [*] Trailing comma missing
|
310 | # ==> multiline_bad_function_one_param.py <==
311 | def func(
@ -310,7 +310,7 @@ source: crates/ruff/src/rules/flake8_commas/mod.rs
312 312 | pass
313 313 |
./resources/test/fixtures/flake8_commas/COM81.py:316:10: COM812 [*] Trailing comma missing
COM81.py:316:10: COM812 [*] Trailing comma missing
|
316 | func(
317 | a = 3
@ -329,7 +329,7 @@ source: crates/ruff/src/rules/flake8_commas/mod.rs
318 318 |
319 319 | # ==> multiline_bad_or_dict.py <==
./resources/test/fixtures/flake8_commas/COM81.py:322:15: COM812 [*] Trailing comma missing
COM81.py:322:15: COM812 [*] Trailing comma missing
|
322 | multiline_bad_or_dict = {
323 | "good": True or False,
@ -349,7 +349,7 @@ source: crates/ruff/src/rules/flake8_commas/mod.rs
324 324 |
325 325 | # ==> multiline_good_dict.py <==
./resources/test/fixtures/flake8_commas/COM81.py:368:15: COM812 [*] Trailing comma missing
COM81.py:368:15: COM812 [*] Trailing comma missing
|
368 | multiline_index_access[
369 | "probably fine",
@ -369,7 +369,7 @@ source: crates/ruff/src/rules/flake8_commas/mod.rs
370 370 |
371 371 | multiline_index_access[
./resources/test/fixtures/flake8_commas/COM81.py:375:15: COM812 [*] Trailing comma missing
COM81.py:375:15: COM812 [*] Trailing comma missing
|
375 | "fine",
376 | :
@ -389,7 +389,7 @@ source: crates/ruff/src/rules/flake8_commas/mod.rs
377 377 |
378 378 | # ==> multiline_string.py <==
./resources/test/fixtures/flake8_commas/COM81.py:404:15: COM812 [*] Trailing comma missing
COM81.py:404:15: COM812 [*] Trailing comma missing
|
404 | "fine"
405 | :
@ -409,7 +409,7 @@ source: crates/ruff/src/rules/flake8_commas/mod.rs
406 406 |
407 407 | multiline_index_access[
./resources/test/fixtures/flake8_commas/COM81.py:432:15: COM812 [*] Trailing comma missing
COM81.py:432:15: COM812 [*] Trailing comma missing
|
432 | :
433 | "fine",
@ -429,7 +429,7 @@ source: crates/ruff/src/rules/flake8_commas/mod.rs
434 434 |
435 435 | multiline_index_access[
./resources/test/fixtures/flake8_commas/COM81.py:485:21: COM819 [*] Trailing comma prohibited
COM81.py:485:21: COM819 [*] Trailing comma prohibited
|
485 | # ==> prohibited.py <==
486 | foo = ['a', 'b', 'c',]
@ -449,7 +449,7 @@ source: crates/ruff/src/rules/flake8_commas/mod.rs
487 487 | bar = { a: b,}
488 488 |
./resources/test/fixtures/flake8_commas/COM81.py:487:13: COM819 [*] Trailing comma prohibited
COM81.py:487:13: COM819 [*] Trailing comma prohibited
|
487 | foo = ['a', 'b', 'c',]
488 |
@ -470,7 +470,7 @@ source: crates/ruff/src/rules/flake8_commas/mod.rs
489 489 | def bah(ham, spam,):
490 490 | pass
./resources/test/fixtures/flake8_commas/COM81.py:489:18: COM819 [*] Trailing comma prohibited
COM81.py:489:18: COM819 [*] Trailing comma prohibited
|
489 | bar = { a: b,}
490 |
@ -490,7 +490,7 @@ source: crates/ruff/src/rules/flake8_commas/mod.rs
491 491 |
492 492 | (0,)
./resources/test/fixtures/flake8_commas/COM81.py:494:6: COM819 [*] Trailing comma prohibited
COM81.py:494:6: COM819 [*] Trailing comma prohibited
|
494 | (0,)
495 |
@ -511,7 +511,7 @@ source: crates/ruff/src/rules/flake8_commas/mod.rs
496 496 | foo = ['a', 'b', 'c', ]
497 497 |
./resources/test/fixtures/flake8_commas/COM81.py:496:21: COM819 [*] Trailing comma prohibited
COM81.py:496:21: COM819 [*] Trailing comma prohibited
|
496 | (0, 1,)
497 |
@ -532,7 +532,7 @@ source: crates/ruff/src/rules/flake8_commas/mod.rs
498 498 | bar = { a: b, }
499 499 |
./resources/test/fixtures/flake8_commas/COM81.py:498:13: COM819 [*] Trailing comma prohibited
COM81.py:498:13: COM819 [*] Trailing comma prohibited
|
498 | foo = ['a', 'b', 'c', ]
499 |
@ -553,7 +553,7 @@ source: crates/ruff/src/rules/flake8_commas/mod.rs
500 500 | def bah(ham, spam, ):
501 501 | pass
./resources/test/fixtures/flake8_commas/COM81.py:500:18: COM819 [*] Trailing comma prohibited
COM81.py:500:18: COM819 [*] Trailing comma prohibited
|
500 | bar = { a: b, }
501 |
@ -573,7 +573,7 @@ source: crates/ruff/src/rules/flake8_commas/mod.rs
502 502 |
503 503 | (0, )
./resources/test/fixtures/flake8_commas/COM81.py:505:6: COM819 [*] Trailing comma prohibited
COM81.py:505:6: COM819 [*] Trailing comma prohibited
|
505 | (0, )
506 |
@ -594,7 +594,7 @@ source: crates/ruff/src/rules/flake8_commas/mod.rs
507 507 | image[:, :, 0]
508 508 |
./resources/test/fixtures/flake8_commas/COM81.py:511:10: COM819 [*] Trailing comma prohibited
COM81.py:511:10: COM819 [*] Trailing comma prohibited
|
511 | image[:,]
512 |
@ -615,7 +615,7 @@ source: crates/ruff/src/rules/flake8_commas/mod.rs
513 513 | lambda x, :
514 514 |
./resources/test/fixtures/flake8_commas/COM81.py:513:9: COM819 [*] Trailing comma prohibited
COM81.py:513:9: COM819 [*] Trailing comma prohibited
|
513 | image[:,:,]
514 |
@ -636,7 +636,7 @@ source: crates/ruff/src/rules/flake8_commas/mod.rs
515 515 | # ==> unpack.py <==
516 516 | def function(
./resources/test/fixtures/flake8_commas/COM81.py:519:13: COM812 [*] Trailing comma missing
COM81.py:519:13: COM812 [*] Trailing comma missing
|
519 | foo,
520 | bar,
@ -657,7 +657,7 @@ source: crates/ruff/src/rules/flake8_commas/mod.rs
521 521 | pass
522 522 |
./resources/test/fixtures/flake8_commas/COM81.py:526:10: COM812 [*] Trailing comma missing
COM81.py:526:10: COM812 [*] Trailing comma missing
|
526 | foo,
527 | bar,
@ -678,7 +678,7 @@ source: crates/ruff/src/rules/flake8_commas/mod.rs
528 528 | pass
529 529 |
./resources/test/fixtures/flake8_commas/COM81.py:534:16: COM812 [*] Trailing comma missing
COM81.py:534:16: COM812 [*] Trailing comma missing
|
534 | bar,
535 | *args,
@ -699,7 +699,7 @@ source: crates/ruff/src/rules/flake8_commas/mod.rs
536 536 | pass
537 537 |
./resources/test/fixtures/flake8_commas/COM81.py:541:13: COM812 [*] Trailing comma missing
COM81.py:541:13: COM812 [*] Trailing comma missing
|
541 | foo,
542 | bar,
@ -719,7 +719,7 @@ source: crates/ruff/src/rules/flake8_commas/mod.rs
543 543 |
544 544 | result = function(
./resources/test/fixtures/flake8_commas/COM81.py:547:24: COM812 [*] Trailing comma missing
COM81.py:547:24: COM812 [*] Trailing comma missing
|
547 | foo,
548 | bar,
@ -739,7 +739,7 @@ source: crates/ruff/src/rules/flake8_commas/mod.rs
549 549 |
550 550 | def foo(
./resources/test/fixtures/flake8_commas/COM81.py:554:15: COM812 [*] Trailing comma missing
COM81.py:554:15: COM812 [*] Trailing comma missing
|
554 | spam,
555 | *args,
@ -760,7 +760,7 @@ source: crates/ruff/src/rules/flake8_commas/mod.rs
556 556 | pass
557 557 |
./resources/test/fixtures/flake8_commas/COM81.py:561:13: COM812 [*] Trailing comma missing
COM81.py:561:13: COM812 [*] Trailing comma missing
|
561 | foo(
562 | **kwargs
@ -779,7 +779,7 @@ source: crates/ruff/src/rules/flake8_commas/mod.rs
563 563 |
564 564 | {
./resources/test/fixtures/flake8_commas/COM81.py:565:13: COM812 [*] Trailing comma missing
COM81.py:565:13: COM812 [*] Trailing comma missing
|
565 | {
566 | **kwargs
@ -798,7 +798,7 @@ source: crates/ruff/src/rules/flake8_commas/mod.rs
567 567 |
568 568 | (
./resources/test/fixtures/flake8_commas/COM81.py:573:10: COM812 [*] Trailing comma missing
COM81.py:573:10: COM812 [*] Trailing comma missing
|
573 | {
574 | *args
@ -817,7 +817,7 @@ source: crates/ruff/src/rules/flake8_commas/mod.rs
575 575 |
576 576 | [
./resources/test/fixtures/flake8_commas/COM81.py:577:10: COM812 [*] Trailing comma missing
COM81.py:577:10: COM812 [*] Trailing comma missing
|
577 | [
578 | *args
@ -836,7 +836,7 @@ source: crates/ruff/src/rules/flake8_commas/mod.rs
579 579 |
580 580 | def foo(
./resources/test/fixtures/flake8_commas/COM81.py:583:10: COM812 [*] Trailing comma missing
COM81.py:583:10: COM812 [*] Trailing comma missing
|
583 | ham,
584 | spam,
@ -857,7 +857,7 @@ source: crates/ruff/src/rules/flake8_commas/mod.rs
585 585 | pass
586 586 |
./resources/test/fixtures/flake8_commas/COM81.py:590:13: COM812 [*] Trailing comma missing
COM81.py:590:13: COM812 [*] Trailing comma missing
|
590 | ham,
591 | spam,
@ -878,7 +878,7 @@ source: crates/ruff/src/rules/flake8_commas/mod.rs
592 592 | pass
593 593 |
./resources/test/fixtures/flake8_commas/COM81.py:598:15: COM812 [*] Trailing comma missing
COM81.py:598:15: COM812 [*] Trailing comma missing
|
598 | spam,
599 | *args,
@ -899,7 +899,7 @@ source: crates/ruff/src/rules/flake8_commas/mod.rs
600 600 | pass
601 601 |
./resources/test/fixtures/flake8_commas/COM81.py:627:20: COM812 [*] Trailing comma missing
COM81.py:627:20: COM812 [*] Trailing comma missing
|
627 | foo,
628 | bar,
@ -919,7 +919,7 @@ source: crates/ruff/src/rules/flake8_commas/mod.rs
629 629 |
630 630 | # Make sure the COM812 and UP034 rules don't autofix simultaneously and cause a syntax error.
./resources/test/fixtures/flake8_commas/COM81.py:632:42: COM812 [*] Trailing comma missing
COM81.py:632:42: COM812 [*] Trailing comma missing
|
632 | # Make sure the COM812 and UP034 rules don't autofix simultaneously and cause a syntax error.
633 | the_first_one = next(

View file

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

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_comprehensions/mod.rs
---
./resources/test/fixtures/flake8_comprehensions/C401.py:1:5: C401 [*] Unnecessary generator (rewrite as a `set` comprehension)
C401.py:1:5: C401 [*] Unnecessary generator (rewrite as a `set` comprehension)
|
1 | x = set(x for x in range(3))
| ^^^^^^^^^^^^^^^^^^^^^^^^ C401
@ -17,7 +17,7 @@ source: crates/ruff/src/rules/flake8_comprehensions/mod.rs
3 3 | x for x in range(3)
4 4 | )
./resources/test/fixtures/flake8_comprehensions/C401.py:2:5: C401 [*] Unnecessary generator (rewrite as a `set` comprehension)
C401.py:2:5: C401 [*] Unnecessary generator (rewrite as a `set` comprehension)
|
2 | x = set(x for x in range(3))
3 | x = set(
@ -41,7 +41,7 @@ source: crates/ruff/src/rules/flake8_comprehensions/mod.rs
6 6 | _ = '{}'.format(set(a if a < 6 else 0 for a in range(3)))
7 7 | print(f'Hello {set(a for a in range(3))} World')
./resources/test/fixtures/flake8_comprehensions/C401.py:5:8: C401 [*] Unnecessary generator (rewrite as a `set` comprehension)
C401.py:5:8: C401 [*] Unnecessary generator (rewrite as a `set` comprehension)
|
5 | x for x in range(3)
6 | )
@ -62,7 +62,7 @@ source: crates/ruff/src/rules/flake8_comprehensions/mod.rs
7 7 | print(f'Hello {set(a for a in range(3))} World')
8 8 |
./resources/test/fixtures/flake8_comprehensions/C401.py:6:17: C401 [*] Unnecessary generator (rewrite as a `set` comprehension)
C401.py:6:17: C401 [*] Unnecessary generator (rewrite as a `set` comprehension)
|
6 | )
7 | y = f'{set(a if a < 6 else 0 for a in range(3))}'
@ -82,7 +82,7 @@ source: crates/ruff/src/rules/flake8_comprehensions/mod.rs
8 8 |
9 9 | def set(*args, **kwargs):
./resources/test/fixtures/flake8_comprehensions/C401.py:7:16: C401 [*] Unnecessary generator (rewrite as a `set` comprehension)
C401.py:7:16: C401 [*] Unnecessary generator (rewrite as a `set` comprehension)
|
7 | y = f'{set(a if a < 6 else 0 for a in range(3))}'
8 | _ = '{}'.format(set(a if a < 6 else 0 for a in range(3)))

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_comprehensions/mod.rs
---
./resources/test/fixtures/flake8_comprehensions/C402.py:1:1: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension)
C402.py:1:1: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension)
|
1 | dict((x, x) for x in range(3))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C402
@ -17,7 +17,7 @@ source: crates/ruff/src/rules/flake8_comprehensions/mod.rs
3 3 | (x, x) for x in range(3)
4 4 | )
./resources/test/fixtures/flake8_comprehensions/C402.py:2:1: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension)
C402.py:2:1: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension)
|
2 | dict((x, x) for x in range(3))
3 | / dict(
@ -41,7 +41,7 @@ source: crates/ruff/src/rules/flake8_comprehensions/mod.rs
6 6 | y = f'{dict((x, x) for x in range(3))}'
7 7 | print(f'Hello {dict((x, x) for x in range(3))} World')
./resources/test/fixtures/flake8_comprehensions/C402.py:6:8: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension)
C402.py:6:8: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension)
|
6 | )
7 | dict(((x, x) for x in range(3)), z=3)
@ -59,7 +59,7 @@ source: crates/ruff/src/rules/flake8_comprehensions/mod.rs
6 |+y = f'{ {x: x for x in range(3)} }'
7 7 | print(f'Hello {dict((x, x) for x in range(3))} World')
./resources/test/fixtures/flake8_comprehensions/C402.py:7:16: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension)
C402.py:7:16: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension)
|
7 | dict(((x, x) for x in range(3)), z=3)
8 | y = f'{dict((x, x) for x in range(3))}'

View file

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

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_comprehensions/mod.rs
---
./resources/test/fixtures/flake8_comprehensions/C404.py:1:1: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` comprehension)
C404.py:1:1: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` comprehension)
|
1 | dict([(i, i) for i in range(3)])
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C404

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_comprehensions/mod.rs
---
./resources/test/fixtures/flake8_comprehensions/C405.py:1:1: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal)
C405.py:1:1: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal)
|
1 | set([1, 2])
| ^^^^^^^^^^^ C405
@ -17,7 +17,7 @@ source: crates/ruff/src/rules/flake8_comprehensions/mod.rs
3 3 | set([])
4 4 | set(())
./resources/test/fixtures/flake8_comprehensions/C405.py:2:1: C405 [*] Unnecessary `tuple` literal (rewrite as a `set` literal)
C405.py:2:1: C405 [*] Unnecessary `tuple` literal (rewrite as a `set` literal)
|
2 | set([1, 2])
3 | set((1, 2))
@ -35,7 +35,7 @@ source: crates/ruff/src/rules/flake8_comprehensions/mod.rs
4 4 | set(())
5 5 | set()
./resources/test/fixtures/flake8_comprehensions/C405.py:3:1: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal)
C405.py:3:1: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal)
|
3 | set([1, 2])
4 | set((1, 2))
@ -55,7 +55,7 @@ source: crates/ruff/src/rules/flake8_comprehensions/mod.rs
5 5 | set()
6 6 | set((1,))
./resources/test/fixtures/flake8_comprehensions/C405.py:4:1: C405 [*] Unnecessary `tuple` literal (rewrite as a `set` literal)
C405.py:4:1: C405 [*] Unnecessary `tuple` literal (rewrite as a `set` literal)
|
4 | set((1, 2))
5 | set([])
@ -77,7 +77,7 @@ source: crates/ruff/src/rules/flake8_comprehensions/mod.rs
7 7 | set((
8 8 | 1,
./resources/test/fixtures/flake8_comprehensions/C405.py:6:1: C405 [*] Unnecessary `tuple` literal (rewrite as a `set` literal)
C405.py:6:1: C405 [*] Unnecessary `tuple` literal (rewrite as a `set` literal)
|
6 | set(())
7 | set()
@ -98,7 +98,7 @@ source: crates/ruff/src/rules/flake8_comprehensions/mod.rs
8 8 | 1,
9 9 | ))
./resources/test/fixtures/flake8_comprehensions/C405.py:7:1: C405 [*] Unnecessary `tuple` literal (rewrite as a `set` literal)
C405.py:7:1: C405 [*] Unnecessary `tuple` literal (rewrite as a `set` literal)
|
7 | set()
8 | set((1,))
@ -124,7 +124,7 @@ source: crates/ruff/src/rules/flake8_comprehensions/mod.rs
11 11 | 1,
12 12 | ])
./resources/test/fixtures/flake8_comprehensions/C405.py:10:1: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal)
C405.py:10:1: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal)
|
10 | 1,
11 | ))
@ -150,7 +150,7 @@ source: crates/ruff/src/rules/flake8_comprehensions/mod.rs
14 14 | (1,)
15 15 | )
./resources/test/fixtures/flake8_comprehensions/C405.py:13:1: C405 [*] Unnecessary `tuple` literal (rewrite as a `set` literal)
C405.py:13:1: C405 [*] Unnecessary `tuple` literal (rewrite as a `set` literal)
|
13 | 1,
14 | ])
@ -175,7 +175,7 @@ source: crates/ruff/src/rules/flake8_comprehensions/mod.rs
17 15 | [1,]
18 16 | )
./resources/test/fixtures/flake8_comprehensions/C405.py:16:1: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal)
C405.py:16:1: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal)
|
16 | (1,)
17 | )

View file

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

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_comprehensions/mod.rs
---
./resources/test/fixtures/flake8_comprehensions/C408.py:1:5: C408 [*] Unnecessary `tuple` call (rewrite as a literal)
C408.py:1:5: C408 [*] Unnecessary `tuple` call (rewrite as a literal)
|
1 | t = tuple()
| ^^^^^^^ C408
@ -17,7 +17,7 @@ source: crates/ruff/src/rules/flake8_comprehensions/mod.rs
3 3 | d1 = dict()
4 4 | d2 = dict(a=1)
./resources/test/fixtures/flake8_comprehensions/C408.py:2:5: C408 [*] Unnecessary `list` call (rewrite as a literal)
C408.py:2:5: C408 [*] Unnecessary `list` call (rewrite as a literal)
|
2 | t = tuple()
3 | l = list()
@ -35,7 +35,7 @@ source: crates/ruff/src/rules/flake8_comprehensions/mod.rs
4 4 | d2 = dict(a=1)
5 5 | d3 = dict(**d2)
./resources/test/fixtures/flake8_comprehensions/C408.py:3:6: C408 [*] Unnecessary `dict` call (rewrite as a literal)
C408.py:3:6: C408 [*] Unnecessary `dict` call (rewrite as a literal)
|
3 | t = tuple()
4 | l = list()
@ -55,7 +55,7 @@ source: crates/ruff/src/rules/flake8_comprehensions/mod.rs
5 5 | d3 = dict(**d2)
6 6 |
./resources/test/fixtures/flake8_comprehensions/C408.py:4:6: C408 [*] Unnecessary `dict` call (rewrite as a literal)
C408.py:4:6: C408 [*] Unnecessary `dict` call (rewrite as a literal)
|
4 | l = list()
5 | d1 = dict()

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_comprehensions/mod.rs
---
./resources/test/fixtures/flake8_comprehensions/C408.py:1:5: C408 [*] Unnecessary `tuple` call (rewrite as a literal)
C408.py:1:5: C408 [*] Unnecessary `tuple` call (rewrite as a literal)
|
1 | t = tuple()
| ^^^^^^^ C408
@ -17,7 +17,7 @@ source: crates/ruff/src/rules/flake8_comprehensions/mod.rs
3 3 | d1 = dict()
4 4 | d2 = dict(a=1)
./resources/test/fixtures/flake8_comprehensions/C408.py:2:5: C408 [*] Unnecessary `list` call (rewrite as a literal)
C408.py:2:5: C408 [*] Unnecessary `list` call (rewrite as a literal)
|
2 | t = tuple()
3 | l = list()
@ -35,7 +35,7 @@ source: crates/ruff/src/rules/flake8_comprehensions/mod.rs
4 4 | d2 = dict(a=1)
5 5 | d3 = dict(**d2)
./resources/test/fixtures/flake8_comprehensions/C408.py:3:6: C408 [*] Unnecessary `dict` call (rewrite as a literal)
C408.py:3:6: C408 [*] Unnecessary `dict` call (rewrite as a literal)
|
3 | t = tuple()
4 | l = list()

View file

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

View file

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

View file

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

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_comprehensions/mod.rs
---
./resources/test/fixtures/flake8_comprehensions/C413.py:3:1: C413 [*] Unnecessary `list` call around `sorted()`
C413.py:3:1: C413 [*] Unnecessary `list` call around `sorted()`
|
3 | x = [2, 3, 1]
4 | list(x)
@ -21,7 +21,7 @@ source: crates/ruff/src/rules/flake8_comprehensions/mod.rs
5 5 | reversed(sorted(x, key=lambda e: e))
6 6 | reversed(sorted(x, reverse=True))
./resources/test/fixtures/flake8_comprehensions/C413.py:4:1: C413 [*] Unnecessary `reversed` call around `sorted()`
C413.py:4:1: C413 [*] Unnecessary `reversed` call around `sorted()`
|
4 | list(x)
5 | list(sorted(x))
@ -42,7 +42,7 @@ source: crates/ruff/src/rules/flake8_comprehensions/mod.rs
6 6 | reversed(sorted(x, reverse=True))
7 7 | reversed(sorted(x, key=lambda e: e, reverse=True))
./resources/test/fixtures/flake8_comprehensions/C413.py:5:1: C413 [*] Unnecessary `reversed` call around `sorted()`
C413.py:5:1: C413 [*] Unnecessary `reversed` call around `sorted()`
|
5 | list(sorted(x))
6 | reversed(sorted(x))
@ -63,7 +63,7 @@ source: crates/ruff/src/rules/flake8_comprehensions/mod.rs
7 7 | reversed(sorted(x, key=lambda e: e, reverse=True))
8 8 | reversed(sorted(x, reverse=True, key=lambda e: e))
./resources/test/fixtures/flake8_comprehensions/C413.py:6:1: C413 [*] Unnecessary `reversed` call around `sorted()`
C413.py:6:1: C413 [*] Unnecessary `reversed` call around `sorted()`
|
6 | reversed(sorted(x))
7 | reversed(sorted(x, key=lambda e: e))
@ -84,7 +84,7 @@ source: crates/ruff/src/rules/flake8_comprehensions/mod.rs
8 8 | reversed(sorted(x, reverse=True, key=lambda e: e))
9 9 | reversed(sorted(x, reverse=False))
./resources/test/fixtures/flake8_comprehensions/C413.py:7:1: C413 [*] Unnecessary `reversed` call around `sorted()`
C413.py:7:1: C413 [*] Unnecessary `reversed` call around `sorted()`
|
7 | reversed(sorted(x, key=lambda e: e))
8 | reversed(sorted(x, reverse=True))
@ -105,7 +105,7 @@ source: crates/ruff/src/rules/flake8_comprehensions/mod.rs
9 9 | reversed(sorted(x, reverse=False))
10 10 |
./resources/test/fixtures/flake8_comprehensions/C413.py:8:1: C413 [*] Unnecessary `reversed` call around `sorted()`
C413.py:8:1: C413 [*] Unnecessary `reversed` call around `sorted()`
|
8 | reversed(sorted(x, reverse=True))
9 | reversed(sorted(x, key=lambda e: e, reverse=True))
@ -125,7 +125,7 @@ source: crates/ruff/src/rules/flake8_comprehensions/mod.rs
10 10 |
11 11 | def reversed(*args, **kwargs):
./resources/test/fixtures/flake8_comprehensions/C413.py:9:1: C413 [*] Unnecessary `reversed` call around `sorted()`
C413.py:9:1: C413 [*] Unnecessary `reversed` call around `sorted()`
|
9 | reversed(sorted(x, key=lambda e: e, reverse=True))
10 | reversed(sorted(x, reverse=True, key=lambda e: e))

View file

@ -1,7 +1,7 @@
---
source: crates/ruff/src/rules/flake8_comprehensions/mod.rs
---
./resources/test/fixtures/flake8_comprehensions/C414.py:2:1: C414 [*] Unnecessary `list` call within `list()`
C414.py:2:1: C414 [*] Unnecessary `list` call within `list()`
|
2 | x = [1, 2, 3]
3 | list(list(x))
@ -19,7 +19,7 @@ source: crates/ruff/src/rules/flake8_comprehensions/mod.rs
4 4 | tuple(list(x))
5 5 | tuple(tuple(x))
./resources/test/fixtures/flake8_comprehensions/C414.py:3:1: C414 [*] Unnecessary `tuple` call within `list()`
C414.py:3:1: C414 [*] Unnecessary `tuple` call within `list()`
|
3 | x = [1, 2, 3]
4 | list(list(x))
@ -39,7 +39,7 @@ source: crates/ruff/src/rules/flake8_comprehensions/mod.rs
5 5 | tuple(tuple(x))
6 6 | set(set(x))
./resources/test/fixtures/flake8_comprehensions/C414.py:4:1: C414 [*] Unnecessary `list` call within `tuple()`
C414.py:4:1: C414 [*] Unnecessary `list` call within `tuple()`
|
4 | list(list(x))
5 | list(tuple(x))
@ -60,7 +60,7 @@ source: crates/ruff/src/rules/flake8_comprehensions/mod.rs
6 6 | set(set(x))
7 7 | set(list(x))
./resources/test/fixtures/flake8_comprehensions/C414.py:5:1: C414 [*] Unnecessary `tuple` call within `tuple()`
C414.py:5:1: C414 [*] Unnecessary `tuple` call within `tuple()`
|
5 | list(tuple(x))
6 | tuple(list(x))
@ -81,7 +81,7 @@ source: crates/ruff/src/rules/flake8_comprehensions/mod.rs
7 7 | set(list(x))
8 8 | set(tuple(x))
./resources/test/fixtures/flake8_comprehensions/C414.py:6:1: C414 [*] Unnecessary `set` call within `set()`
C414.py:6:1: C414 [*] Unnecessary `set` call within `set()`
|
6 | tuple(list(x))
7 | tuple(tuple(x))
@ -102,7 +102,7 @@ source: crates/ruff/src/rules/flake8_comprehensions/mod.rs
8 8 | set(tuple(x))
9 9 | set(sorted(x))
./resources/test/fixtures/flake8_comprehensions/C414.py:7:1: C414 [*] Unnecessary `list` call within `set()`
C414.py:7:1: C414 [*] Unnecessary `list` call within `set()`
|
7 | tuple(tuple(x))
8 | set(set(x))
@ -123,7 +123,7 @@ source: crates/ruff/src/rules/flake8_comprehensions/mod.rs
9 9 | set(sorted(x))
10 10 | set(sorted(x, key=lambda y: y))
./resources/test/fixtures/flake8_comprehensions/C414.py:8:1: C414 [*] Unnecessary `tuple` call within `set()`
C414.py:8:1: C414 [*] Unnecessary `tuple` call within `set()`
|
8 | set(set(x))
9 | set(list(x))
@ -144,7 +144,7 @@ source: crates/ruff/src/rules/flake8_comprehensions/mod.rs
10 10 | set(sorted(x, key=lambda y: y))
11 11 | set(reversed(x))
./resources/test/fixtures/flake8_comprehensions/C414.py:9:1: C414 [*] Unnecessary `sorted` call within `set()`
C414.py:9:1: C414 [*] Unnecessary `sorted` call within `set()`
|
9 | set(list(x))
10 | set(tuple(x))
@ -165,7 +165,7 @@ source: crates/ruff/src/rules/flake8_comprehensions/mod.rs
11 11 | set(reversed(x))
12 12 | sorted(list(x))
./resources/test/fixtures/flake8_comprehensions/C414.py:10:1: C414 [*] Unnecessary `sorted` call within `set()`
C414.py:10:1: C414 [*] Unnecessary `sorted` call within `set()`
|
10 | set(tuple(x))
11 | set(sorted(x))
@ -186,7 +186,7 @@ source: crates/ruff/src/rules/flake8_comprehensions/mod.rs
12 12 | sorted(list(x))
13 13 | sorted(tuple(x))
./resources/test/fixtures/flake8_comprehensions/C414.py:11:1: C414 [*] Unnecessary `reversed` call within `set()`
C414.py:11:1: C414 [*] Unnecessary `reversed` call within `set()`
|
11 | set(sorted(x))
12 | set(sorted(x, key=lambda y: y))
@ -207,7 +207,7 @@ source: crates/ruff/src/rules/flake8_comprehensions/mod.rs
13 13 | sorted(tuple(x))
14 14 | sorted(sorted(x))
./resources/test/fixtures/flake8_comprehensions/C414.py:12:1: C414 [*] Unnecessary `list` call within `sorted()`
C414.py:12:1: C414 [*] Unnecessary `list` call within `sorted()`
|
12 | set(sorted(x, key=lambda y: y))
13 | set(reversed(x))
@ -228,7 +228,7 @@ source: crates/ruff/src/rules/flake8_comprehensions/mod.rs
14 14 | sorted(sorted(x))
15 15 | sorted(sorted(x, key=lambda y: y))
./resources/test/fixtures/flake8_comprehensions/C414.py:13:1: C414 [*] Unnecessary `tuple` call within `sorted()`
C414.py:13:1: C414 [*] Unnecessary `tuple` call within `sorted()`
|
13 | set(reversed(x))
14 | sorted(list(x))
@ -249,7 +249,7 @@ source: crates/ruff/src/rules/flake8_comprehensions/mod.rs
15 15 | sorted(sorted(x, key=lambda y: y))
16 16 | sorted(reversed(x))
./resources/test/fixtures/flake8_comprehensions/C414.py:14:1: C414 [*] Unnecessary `sorted` call within `sorted()`
C414.py:14:1: C414 [*] Unnecessary `sorted` call within `sorted()`
|
14 | sorted(list(x))
15 | sorted(tuple(x))
@ -270,7 +270,7 @@ source: crates/ruff/src/rules/flake8_comprehensions/mod.rs
16 16 | sorted(reversed(x))
17 17 | sorted(list(x), key=lambda y: y)
./resources/test/fixtures/flake8_comprehensions/C414.py:15:1: C414 [*] Unnecessary `sorted` call within `sorted()`
C414.py:15:1: C414 [*] Unnecessary `sorted` call within `sorted()`
|
15 | sorted(tuple(x))
16 | sorted(sorted(x))
@ -291,7 +291,7 @@ source: crates/ruff/src/rules/flake8_comprehensions/mod.rs
17 17 | sorted(list(x), key=lambda y: y)
18 18 | tuple(
./resources/test/fixtures/flake8_comprehensions/C414.py:16:1: C414 [*] Unnecessary `reversed` call within `sorted()`
C414.py:16:1: C414 [*] Unnecessary `reversed` call within `sorted()`
|
16 | sorted(sorted(x))
17 | sorted(sorted(x, key=lambda y: y))
@ -312,7 +312,7 @@ source: crates/ruff/src/rules/flake8_comprehensions/mod.rs
18 18 | tuple(
19 19 | list(
./resources/test/fixtures/flake8_comprehensions/C414.py:17:1: C414 [*] Unnecessary `list` call within `sorted()`
C414.py:17:1: C414 [*] Unnecessary `list` call within `sorted()`
|
17 | sorted(sorted(x, key=lambda y: y))
18 | sorted(reversed(x))
@ -333,7 +333,7 @@ source: crates/ruff/src/rules/flake8_comprehensions/mod.rs
19 19 | list(
20 20 | [x, 3, "hell"\
./resources/test/fixtures/flake8_comprehensions/C414.py:18:1: C414 [*] Unnecessary `list` call within `tuple()`
C414.py:18:1: C414 [*] Unnecessary `list` call within `tuple()`
|
18 | sorted(reversed(x))
19 | sorted(list(x), key=lambda y: y)

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