mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-04 02:38:25 +00:00
Fix line numbers in source frames (#4984)
This commit is contained in:
parent
111e1f93ca
commit
901bcb6f21
729 changed files with 19850 additions and 19851 deletions
|
@ -11,15 +11,15 @@ fib.py:
|
|||
= help: Remove unused import: `os`
|
||||
|
||||
6:5 F841 [*] Local variable `x` is assigned to but never used
|
||||
|
|
||||
6 | def fibonacci(n):
|
||||
7 | """Compute the nth number in the Fibonacci sequence."""
|
||||
8 | x = 1
|
||||
| ^ F841
|
||||
9 | if n == 0:
|
||||
10 | return 0
|
||||
|
|
||||
= help: Remove assignment to unused variable `x`
|
||||
|
|
||||
4 | def fibonacci(n):
|
||||
5 | """Compute the nth number in the Fibonacci sequence."""
|
||||
6 | x = 1
|
||||
| ^ F841
|
||||
7 | if n == 0:
|
||||
8 | return 0
|
||||
|
|
||||
= help: Remove assignment to unused variable `x`
|
||||
|
||||
undef.py:
|
||||
1:4 F821 Undefined name `a`
|
||||
|
|
|
@ -11,15 +11,15 @@ fib.py:
|
|||
= help: Remove unused import: `os`
|
||||
|
||||
6:5 F841 Local variable `x` is assigned to but never used
|
||||
|
|
||||
6 | def fibonacci(n):
|
||||
7 | """Compute the nth number in the Fibonacci sequence."""
|
||||
8 | x = 1
|
||||
| ^ F841
|
||||
9 | if n == 0:
|
||||
10 | return 0
|
||||
|
|
||||
= help: Remove assignment to unused variable `x`
|
||||
|
|
||||
4 | def fibonacci(n):
|
||||
5 | """Compute the nth number in the Fibonacci sequence."""
|
||||
6 | x = 1
|
||||
| ^ F841
|
||||
7 | if n == 0:
|
||||
8 | return 0
|
||||
|
|
||||
= help: Remove assignment to unused variable `x`
|
||||
|
||||
undef.py:
|
||||
1:4 F821 Undefined name `a`
|
||||
|
|
|
@ -10,15 +10,15 @@ fib.py:1:8: F401 `os` imported but unused
|
|||
= help: Remove unused import: `os`
|
||||
|
||||
fib.py:6:5: F841 Local variable `x` is assigned to but never used
|
||||
|
|
||||
6 | def fibonacci(n):
|
||||
7 | """Compute the nth number in the Fibonacci sequence."""
|
||||
8 | x = 1
|
||||
| ^ F841
|
||||
9 | if n == 0:
|
||||
10 | return 0
|
||||
|
|
||||
= help: Remove assignment to unused variable `x`
|
||||
|
|
||||
4 | def fibonacci(n):
|
||||
5 | """Compute the nth number in the Fibonacci sequence."""
|
||||
6 | x = 1
|
||||
| ^ F841
|
||||
7 | if n == 0:
|
||||
8 | return 0
|
||||
|
|
||||
= help: Remove assignment to unused variable `x`
|
||||
|
||||
undef.py:1:4: F821 Undefined name `a`
|
||||
|
|
||||
|
|
|
@ -10,15 +10,15 @@ fib.py:1:8: F401 [*] `os` imported but unused
|
|||
= help: Remove unused import: `os`
|
||||
|
||||
fib.py:6:5: F841 [*] Local variable `x` is assigned to but never used
|
||||
|
|
||||
6 | def fibonacci(n):
|
||||
7 | """Compute the nth number in the Fibonacci sequence."""
|
||||
8 | x = 1
|
||||
| ^ F841
|
||||
9 | if n == 0:
|
||||
10 | return 0
|
||||
|
|
||||
= help: Remove assignment to unused variable `x`
|
||||
|
|
||||
4 | def fibonacci(n):
|
||||
5 | """Compute the nth number in the Fibonacci sequence."""
|
||||
6 | x = 1
|
||||
| ^ F841
|
||||
7 | if n == 0:
|
||||
8 | return 0
|
||||
|
|
||||
= help: Remove assignment to unused variable `x`
|
||||
|
||||
undef.py:1:4: F821 Undefined name `a`
|
||||
|
|
||||
|
|
|
@ -215,7 +215,7 @@ impl Display for MessageCodeFrame<'_> {
|
|||
title: None,
|
||||
slices: vec![Slice {
|
||||
source: &source.text,
|
||||
line_start: content_start_index.get(),
|
||||
line_start: start_index.get(),
|
||||
annotations: vec![SourceAnnotation {
|
||||
label: &label,
|
||||
annotation_type: AnnotationType::Error,
|
||||
|
|
|
@ -3,20 +3,20 @@ source: crates/ruff/src/rules/airflow/mod.rs
|
|||
---
|
||||
AIR001.py:11:1: AIR001 Task variable name should match the `task_id`: "my_task"
|
||||
|
|
||||
11 | my_task_2 = PythonOperator(callable=my_callable, task_id="my_task_2")
|
||||
12 |
|
||||
13 | incorrect_name = PythonOperator(task_id="my_task")
|
||||
9 | my_task_2 = PythonOperator(callable=my_callable, task_id="my_task_2")
|
||||
10 |
|
||||
11 | incorrect_name = PythonOperator(task_id="my_task")
|
||||
| ^^^^^^^^^^^^^^ AIR001
|
||||
14 | incorrect_name_2 = PythonOperator(callable=my_callable, task_id="my_task_2")
|
||||
12 | incorrect_name_2 = PythonOperator(callable=my_callable, task_id="my_task_2")
|
||||
|
|
||||
|
||||
AIR001.py:12:1: AIR001 Task variable name should match the `task_id`: "my_task_2"
|
||||
|
|
||||
12 | incorrect_name = PythonOperator(task_id="my_task")
|
||||
13 | incorrect_name_2 = PythonOperator(callable=my_callable, task_id="my_task_2")
|
||||
11 | incorrect_name = PythonOperator(task_id="my_task")
|
||||
12 | incorrect_name_2 = PythonOperator(callable=my_callable, task_id="my_task_2")
|
||||
| ^^^^^^^^^^^^^^^^ AIR001
|
||||
14 |
|
||||
15 | from my_module import MyClass
|
||||
13 |
|
||||
14 | from my_module import MyClass
|
||||
|
|
||||
|
||||
|
||||
|
|
|
@ -18,11 +18,11 @@ ERA001.py:1:1: ERA001 [*] Found commented-out code
|
|||
|
||||
ERA001.py:2:1: ERA001 [*] Found commented-out code
|
||||
|
|
||||
2 | #import os
|
||||
3 | # from foo import junk
|
||||
1 | #import os
|
||||
2 | # from foo import junk
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ ERA001
|
||||
4 | #a = 3
|
||||
5 | a = 4
|
||||
3 | #a = 3
|
||||
4 | a = 4
|
||||
|
|
||||
= help: Remove commented-out code
|
||||
|
||||
|
@ -35,12 +35,12 @@ ERA001.py:2:1: ERA001 [*] Found commented-out code
|
|||
|
||||
ERA001.py:3:1: ERA001 [*] Found commented-out code
|
||||
|
|
||||
3 | #import os
|
||||
4 | # from foo import junk
|
||||
5 | #a = 3
|
||||
1 | #import os
|
||||
2 | # from foo import junk
|
||||
3 | #a = 3
|
||||
| ^^^^^^ ERA001
|
||||
6 | a = 4
|
||||
7 | #foo(1, 2, 3)
|
||||
4 | a = 4
|
||||
5 | #foo(1, 2, 3)
|
||||
|
|
||||
= help: Remove commented-out code
|
||||
|
||||
|
@ -54,12 +54,12 @@ ERA001.py:3:1: ERA001 [*] Found commented-out code
|
|||
|
||||
ERA001.py:5:1: ERA001 [*] Found commented-out code
|
||||
|
|
||||
5 | #a = 3
|
||||
6 | a = 4
|
||||
7 | #foo(1, 2, 3)
|
||||
3 | #a = 3
|
||||
4 | a = 4
|
||||
5 | #foo(1, 2, 3)
|
||||
| ^^^^^^^^^^^^^ ERA001
|
||||
8 |
|
||||
9 | def foo(x, y, z):
|
||||
6 |
|
||||
7 | def foo(x, y, z):
|
||||
|
|
||||
= help: Remove commented-out code
|
||||
|
||||
|
@ -74,11 +74,11 @@ ERA001.py:5:1: ERA001 [*] Found commented-out code
|
|||
|
||||
ERA001.py:13:5: ERA001 [*] Found commented-out code
|
||||
|
|
||||
13 | # This is a real comment.
|
||||
14 | # # This is a (nested) comment.
|
||||
15 | #return True
|
||||
11 | # This is a real comment.
|
||||
12 | # # This is a (nested) comment.
|
||||
13 | #return True
|
||||
| ^^^^^^^^^^^^ ERA001
|
||||
16 | return False
|
||||
14 | return False
|
||||
|
|
||||
= help: Remove commented-out code
|
||||
|
||||
|
@ -93,9 +93,9 @@ ERA001.py:13:5: ERA001 [*] Found commented-out code
|
|||
|
||||
ERA001.py:21:5: ERA001 [*] Found commented-out code
|
||||
|
|
||||
21 | class A():
|
||||
22 | pass
|
||||
23 | # b = c
|
||||
19 | class A():
|
||||
20 | pass
|
||||
21 | # b = c
|
||||
| ^^^^^^^ ERA001
|
||||
|
|
||||
= help: Remove commented-out code
|
||||
|
|
|
@ -2,31 +2,31 @@
|
|||
source: crates/ruff/src/rules/flake8_2020/mod.rs
|
||||
---
|
||||
YTT101.py:6:7: YTT101 `sys.version[:3]` referenced (python3.10), use `sys.version_info`
|
||||
|
|
||||
6 | print(sys.version)
|
||||
7 |
|
||||
8 | print(sys.version[:3])
|
||||
| ^^^^^^^^^^^ YTT101
|
||||
9 | print(version[:3])
|
||||
10 | print(v[:3])
|
||||
|
|
||||
|
|
||||
4 | print(sys.version)
|
||||
5 |
|
||||
6 | print(sys.version[:3])
|
||||
| ^^^^^^^^^^^ YTT101
|
||||
7 | print(version[:3])
|
||||
8 | print(v[:3])
|
||||
|
|
||||
|
||||
YTT101.py:7:7: YTT101 `sys.version[:3]` referenced (python3.10), use `sys.version_info`
|
||||
|
|
||||
7 | print(sys.version[:3])
|
||||
8 | print(version[:3])
|
||||
6 | print(sys.version[:3])
|
||||
7 | print(version[:3])
|
||||
| ^^^^^^^ YTT101
|
||||
9 | print(v[:3])
|
||||
8 | print(v[:3])
|
||||
|
|
||||
|
||||
YTT101.py:8:7: YTT101 `sys.version[:3]` referenced (python3.10), use `sys.version_info`
|
||||
|
|
||||
8 | print(sys.version[:3])
|
||||
9 | print(version[:3])
|
||||
10 | print(v[:3])
|
||||
6 | print(sys.version[:3])
|
||||
7 | print(version[:3])
|
||||
8 | print(v[:3])
|
||||
| ^ YTT101
|
||||
11 |
|
||||
12 | # the tool is timid and only flags certain numeric slices
|
||||
9 |
|
||||
10 | # the tool is timid and only flags certain numeric slices
|
||||
|
|
||||
|
||||
|
||||
|
|
|
@ -3,17 +3,17 @@ source: crates/ruff/src/rules/flake8_2020/mod.rs
|
|||
---
|
||||
YTT102.py:4:12: YTT102 `sys.version[2]` referenced (python3.10), use `sys.version_info`
|
||||
|
|
||||
4 | from sys import version
|
||||
5 |
|
||||
6 | py_minor = sys.version[2]
|
||||
2 | from sys import version
|
||||
3 |
|
||||
4 | py_minor = sys.version[2]
|
||||
| ^^^^^^^^^^^ YTT102
|
||||
7 | py_minor = version[2]
|
||||
5 | py_minor = version[2]
|
||||
|
|
||||
|
||||
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]
|
||||
4 | py_minor = sys.version[2]
|
||||
5 | py_minor = version[2]
|
||||
| ^^^^^^^ YTT102
|
||||
|
|
||||
|
||||
|
|
|
@ -3,48 +3,48 @@ source: crates/ruff/src/rules/flake8_2020/mod.rs
|
|||
---
|
||||
YTT103.py:4:1: YTT103 `sys.version` compared to string (python3.10), use `sys.version_info`
|
||||
|
|
||||
4 | from sys import version
|
||||
5 |
|
||||
6 | version < "3.5"
|
||||
2 | from sys import version
|
||||
3 |
|
||||
4 | version < "3.5"
|
||||
| ^^^^^^^ YTT103
|
||||
7 | sys.version < "3.5"
|
||||
8 | sys.version <= "3.5"
|
||||
5 | sys.version < "3.5"
|
||||
6 | sys.version <= "3.5"
|
||||
|
|
||||
|
||||
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"
|
||||
4 | version < "3.5"
|
||||
5 | sys.version < "3.5"
|
||||
| ^^^^^^^^^^^ YTT103
|
||||
7 | sys.version <= "3.5"
|
||||
8 | sys.version > "3.5"
|
||||
6 | sys.version <= "3.5"
|
||||
7 | sys.version > "3.5"
|
||||
|
|
||||
|
||||
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"
|
||||
8 | sys.version <= "3.5"
|
||||
| ^^^^^^^^^^^ YTT103
|
||||
9 | sys.version > "3.5"
|
||||
10 | sys.version >= "3.5"
|
||||
|
|
||||
|
|
||||
4 | version < "3.5"
|
||||
5 | sys.version < "3.5"
|
||||
6 | sys.version <= "3.5"
|
||||
| ^^^^^^^^^^^ YTT103
|
||||
7 | sys.version > "3.5"
|
||||
8 | sys.version >= "3.5"
|
||||
|
|
||||
|
||||
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"
|
||||
9 | sys.version > "3.5"
|
||||
| ^^^^^^^^^^^ YTT103
|
||||
10 | sys.version >= "3.5"
|
||||
|
|
||||
|
|
||||
5 | sys.version < "3.5"
|
||||
6 | sys.version <= "3.5"
|
||||
7 | sys.version > "3.5"
|
||||
| ^^^^^^^^^^^ YTT103
|
||||
8 | sys.version >= "3.5"
|
||||
|
|
||||
|
||||
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"
|
||||
10 | sys.version >= "3.5"
|
||||
| ^^^^^^^^^^^ YTT103
|
||||
|
|
||||
|
|
||||
6 | sys.version <= "3.5"
|
||||
7 | sys.version > "3.5"
|
||||
8 | sys.version >= "3.5"
|
||||
| ^^^^^^^^^^^ YTT103
|
||||
|
|
||||
|
||||
|
||||
|
|
|
@ -2,38 +2,38 @@
|
|||
source: crates/ruff/src/rules/flake8_2020/mod.rs
|
||||
---
|
||||
YTT201.py:7:7: YTT201 `sys.version_info[0] == 3` referenced (python4), use `>=`
|
||||
|
|
||||
7 | PY3 = sys.version_info[0] >= 3
|
||||
8 |
|
||||
9 | PY3 = sys.version_info[0] == 3
|
||||
| ^^^^^^^^^^^^^^^^^^^ YTT201
|
||||
10 | PY3 = version_info[0] == 3
|
||||
11 | PY2 = sys.version_info[0] != 3
|
||||
|
|
||||
|
|
||||
5 | PY3 = sys.version_info[0] >= 3
|
||||
6 |
|
||||
7 | PY3 = sys.version_info[0] == 3
|
||||
| ^^^^^^^^^^^^^^^^^^^ YTT201
|
||||
8 | PY3 = version_info[0] == 3
|
||||
9 | PY2 = sys.version_info[0] != 3
|
||||
|
|
||||
|
||||
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
|
||||
7 | PY3 = sys.version_info[0] == 3
|
||||
8 | PY3 = version_info[0] == 3
|
||||
| ^^^^^^^^^^^^^^^ YTT201
|
||||
10 | PY2 = sys.version_info[0] != 3
|
||||
11 | PY2 = version_info[0] != 3
|
||||
9 | PY2 = sys.version_info[0] != 3
|
||||
10 | PY2 = version_info[0] != 3
|
||||
|
|
||||
|
||||
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
|
||||
11 | PY2 = sys.version_info[0] != 3
|
||||
7 | PY3 = sys.version_info[0] == 3
|
||||
8 | PY3 = version_info[0] == 3
|
||||
9 | PY2 = sys.version_info[0] != 3
|
||||
| ^^^^^^^^^^^^^^^^^^^ YTT201
|
||||
12 | PY2 = version_info[0] != 3
|
||||
10 | PY2 = version_info[0] != 3
|
||||
|
|
||||
|
||||
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
|
||||
12 | PY2 = version_info[0] != 3
|
||||
8 | PY3 = version_info[0] == 3
|
||||
9 | PY2 = sys.version_info[0] != 3
|
||||
10 | PY2 = version_info[0] != 3
|
||||
| ^^^^^^^^^^^^^^^ YTT201
|
||||
|
|
||||
|
||||
|
|
|
@ -3,21 +3,21 @@ source: crates/ruff/src/rules/flake8_2020/mod.rs
|
|||
---
|
||||
YTT202.py:4:4: YTT202 `six.PY3` referenced (python4), use `not six.PY2`
|
||||
|
|
||||
4 | from six import PY3
|
||||
5 |
|
||||
6 | if six.PY3:
|
||||
2 | from six import PY3
|
||||
3 |
|
||||
4 | if six.PY3:
|
||||
| ^^^^^^^ YTT202
|
||||
7 | print("3")
|
||||
8 | if PY3:
|
||||
5 | print("3")
|
||||
6 | if PY3:
|
||||
|
|
||||
|
||||
YTT202.py:6:4: YTT202 `six.PY3` referenced (python4), use `not six.PY2`
|
||||
|
|
||||
6 | if six.PY3:
|
||||
7 | print("3")
|
||||
8 | if PY3:
|
||||
4 | if six.PY3:
|
||||
5 | print("3")
|
||||
6 | if PY3:
|
||||
| ^^^ YTT202
|
||||
9 | print("3")
|
||||
7 | print("3")
|
||||
|
|
||||
|
||||
|
||||
|
|
|
@ -3,17 +3,17 @@ source: crates/ruff/src/rules/flake8_2020/mod.rs
|
|||
---
|
||||
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 |
|
||||
6 | sys.version_info[1] >= 5
|
||||
2 | from sys import version_info
|
||||
3 |
|
||||
4 | sys.version_info[1] >= 5
|
||||
| ^^^^^^^^^^^^^^^^^^^ YTT203
|
||||
7 | version_info[1] < 6
|
||||
5 | version_info[1] < 6
|
||||
|
|
||||
|
||||
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
|
||||
4 | sys.version_info[1] >= 5
|
||||
5 | version_info[1] < 6
|
||||
| ^^^^^^^^^^^^^^^ YTT203
|
||||
|
|
||||
|
||||
|
|
|
@ -3,17 +3,17 @@ source: crates/ruff/src/rules/flake8_2020/mod.rs
|
|||
---
|
||||
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 |
|
||||
6 | sys.version_info.minor <= 7
|
||||
2 | from sys import version_info
|
||||
3 |
|
||||
4 | sys.version_info.minor <= 7
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ YTT204
|
||||
7 | version_info.minor > 8
|
||||
5 | version_info.minor > 8
|
||||
|
|
||||
|
||||
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
|
||||
4 | sys.version_info.minor <= 7
|
||||
5 | version_info.minor > 8
|
||||
| ^^^^^^^^^^^^^^^^^^ YTT204
|
||||
|
|
||||
|
||||
|
|
|
@ -3,17 +3,17 @@ source: crates/ruff/src/rules/flake8_2020/mod.rs
|
|||
---
|
||||
YTT301.py:4:12: YTT301 `sys.version[0]` referenced (python10), use `sys.version_info`
|
||||
|
|
||||
4 | from sys import version
|
||||
5 |
|
||||
6 | py_major = sys.version[0]
|
||||
2 | from sys import version
|
||||
3 |
|
||||
4 | py_major = sys.version[0]
|
||||
| ^^^^^^^^^^^ YTT301
|
||||
7 | py_major = version[0]
|
||||
5 | py_major = version[0]
|
||||
|
|
||||
|
||||
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]
|
||||
4 | py_major = sys.version[0]
|
||||
5 | py_major = version[0]
|
||||
| ^^^^^^^ YTT301
|
||||
|
|
||||
|
||||
|
|
|
@ -3,48 +3,48 @@ source: crates/ruff/src/rules/flake8_2020/mod.rs
|
|||
---
|
||||
YTT302.py:4:1: YTT302 `sys.version` compared to string (python10), use `sys.version_info`
|
||||
|
|
||||
4 | from sys import version
|
||||
5 |
|
||||
6 | version < "3"
|
||||
2 | from sys import version
|
||||
3 |
|
||||
4 | version < "3"
|
||||
| ^^^^^^^ YTT302
|
||||
7 | sys.version < "3"
|
||||
8 | sys.version <= "3"
|
||||
5 | sys.version < "3"
|
||||
6 | sys.version <= "3"
|
||||
|
|
||||
|
||||
YTT302.py:5:1: YTT302 `sys.version` compared to string (python10), use `sys.version_info`
|
||||
|
|
||||
5 | version < "3"
|
||||
6 | sys.version < "3"
|
||||
4 | version < "3"
|
||||
5 | sys.version < "3"
|
||||
| ^^^^^^^^^^^ YTT302
|
||||
7 | sys.version <= "3"
|
||||
8 | sys.version > "3"
|
||||
6 | sys.version <= "3"
|
||||
7 | sys.version > "3"
|
||||
|
|
||||
|
||||
YTT302.py:6:1: YTT302 `sys.version` compared to string (python10), use `sys.version_info`
|
||||
|
|
||||
6 | version < "3"
|
||||
7 | sys.version < "3"
|
||||
8 | sys.version <= "3"
|
||||
| ^^^^^^^^^^^ YTT302
|
||||
9 | sys.version > "3"
|
||||
10 | sys.version >= "3"
|
||||
|
|
||||
|
|
||||
4 | version < "3"
|
||||
5 | sys.version < "3"
|
||||
6 | sys.version <= "3"
|
||||
| ^^^^^^^^^^^ YTT302
|
||||
7 | sys.version > "3"
|
||||
8 | sys.version >= "3"
|
||||
|
|
||||
|
||||
YTT302.py:7:1: YTT302 `sys.version` compared to string (python10), use `sys.version_info`
|
||||
|
|
||||
7 | sys.version < "3"
|
||||
8 | sys.version <= "3"
|
||||
9 | sys.version > "3"
|
||||
| ^^^^^^^^^^^ YTT302
|
||||
10 | sys.version >= "3"
|
||||
|
|
||||
|
|
||||
5 | sys.version < "3"
|
||||
6 | sys.version <= "3"
|
||||
7 | sys.version > "3"
|
||||
| ^^^^^^^^^^^ YTT302
|
||||
8 | sys.version >= "3"
|
||||
|
|
||||
|
||||
YTT302.py:8:1: YTT302 `sys.version` compared to string (python10), use `sys.version_info`
|
||||
|
|
||||
8 | sys.version <= "3"
|
||||
9 | sys.version > "3"
|
||||
10 | sys.version >= "3"
|
||||
| ^^^^^^^^^^^ YTT302
|
||||
|
|
||||
|
|
||||
6 | sys.version <= "3"
|
||||
7 | sys.version > "3"
|
||||
8 | sys.version >= "3"
|
||||
| ^^^^^^^^^^^ YTT302
|
||||
|
|
||||
|
||||
|
||||
|
|
|
@ -3,17 +3,17 @@ source: crates/ruff/src/rules/flake8_2020/mod.rs
|
|||
---
|
||||
YTT303.py:4:7: YTT303 `sys.version[:1]` referenced (python10), use `sys.version_info`
|
||||
|
|
||||
4 | from sys import version
|
||||
5 |
|
||||
6 | print(sys.version[:1])
|
||||
2 | from sys import version
|
||||
3 |
|
||||
4 | print(sys.version[:1])
|
||||
| ^^^^^^^^^^^ YTT303
|
||||
7 | print(version[:1])
|
||||
5 | print(version[:1])
|
||||
|
|
||||
|
||||
YTT303.py:5:7: YTT303 `sys.version[:1]` referenced (python10), use `sys.version_info`
|
||||
|
|
||||
5 | print(sys.version[:1])
|
||||
6 | print(version[:1])
|
||||
4 | print(sys.version[:1])
|
||||
5 | print(version[:1])
|
||||
| ^^^^^^^ YTT303
|
||||
|
|
||||
|
||||
|
|
|
@ -3,10 +3,10 @@ source: crates/ruff/src/rules/flake8_annotations/mod.rs
|
|||
---
|
||||
allow_overload.py:29:9: ANN201 Missing return type annotation for public function `bar`
|
||||
|
|
||||
29 | class X:
|
||||
30 | def bar(i):
|
||||
28 | class X:
|
||||
29 | def bar(i):
|
||||
| ^^^ ANN201
|
||||
31 | return i
|
||||
30 | return i
|
||||
|
|
||||
|
||||
|
||||
|
|
|
@ -3,34 +3,34 @@ source: crates/ruff/src/rules/flake8_annotations/mod.rs
|
|||
---
|
||||
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 | # ANN401
|
||||
10 | def foo(a: Any, *args: str, **kwargs: str) -> int:
|
||||
| ^^^ ANN401
|
||||
12 | pass
|
||||
11 | pass
|
||||
|
|
||||
|
||||
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:
|
||||
14 | # ANN401
|
||||
15 | def foo(a: int, *args: str, **kwargs: str) -> Any:
|
||||
| ^^^ ANN401
|
||||
17 | pass
|
||||
16 | pass
|
||||
|
|
||||
|
||||
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:
|
||||
39 | # ANN401
|
||||
40 | def foo_method(self, a: Any, *params: str, **options: str) -> int:
|
||||
| ^^^ ANN401
|
||||
42 | pass
|
||||
41 | pass
|
||||
|
|
||||
|
||||
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:
|
||||
43 | # ANN401
|
||||
44 | def foo_method(self, a: int, *params: str, **options: str) -> Any:
|
||||
| ^^^ ANN401
|
||||
46 | pass
|
||||
45 | pass
|
||||
|
|
||||
|
||||
|
||||
|
|
|
@ -3,187 +3,187 @@ source: crates/ruff/src/rules/flake8_annotations/mod.rs
|
|||
---
|
||||
annotation_presence.py:5:5: ANN201 Missing return type annotation for public function `foo`
|
||||
|
|
||||
5 | # Error
|
||||
6 | def foo(a, b):
|
||||
4 | # Error
|
||||
5 | def foo(a, b):
|
||||
| ^^^ ANN201
|
||||
7 | pass
|
||||
6 | pass
|
||||
|
|
||||
|
||||
annotation_presence.py:5:9: ANN001 Missing type annotation for function argument `a`
|
||||
|
|
||||
5 | # Error
|
||||
6 | def foo(a, b):
|
||||
4 | # Error
|
||||
5 | def foo(a, b):
|
||||
| ^ ANN001
|
||||
7 | pass
|
||||
6 | pass
|
||||
|
|
||||
|
||||
annotation_presence.py:5:12: ANN001 Missing type annotation for function argument `b`
|
||||
|
|
||||
5 | # Error
|
||||
6 | def foo(a, b):
|
||||
4 | # Error
|
||||
5 | def foo(a, b):
|
||||
| ^ ANN001
|
||||
7 | pass
|
||||
6 | pass
|
||||
|
|
||||
|
||||
annotation_presence.py:10:5: ANN201 Missing return type annotation for public function `foo`
|
||||
|
|
||||
10 | # Error
|
||||
11 | def foo(a: int, b):
|
||||
9 | # Error
|
||||
10 | def foo(a: int, b):
|
||||
| ^^^ ANN201
|
||||
12 | pass
|
||||
11 | pass
|
||||
|
|
||||
|
||||
annotation_presence.py:10:17: ANN001 Missing type annotation for function argument `b`
|
||||
|
|
||||
10 | # Error
|
||||
11 | def foo(a: int, b):
|
||||
9 | # Error
|
||||
10 | def foo(a: int, b):
|
||||
| ^ ANN001
|
||||
12 | pass
|
||||
11 | pass
|
||||
|
|
||||
|
||||
annotation_presence.py:15:17: ANN001 Missing type annotation for function argument `b`
|
||||
|
|
||||
15 | # Error
|
||||
16 | def foo(a: int, b) -> int:
|
||||
14 | # Error
|
||||
15 | def foo(a: int, b) -> int:
|
||||
| ^ ANN001
|
||||
17 | pass
|
||||
16 | pass
|
||||
|
|
||||
|
||||
annotation_presence.py:20:5: ANN201 Missing return type annotation for public function `foo`
|
||||
|
|
||||
20 | # Error
|
||||
21 | def foo(a: int, b: int):
|
||||
19 | # Error
|
||||
20 | def foo(a: int, b: int):
|
||||
| ^^^ ANN201
|
||||
22 | pass
|
||||
21 | pass
|
||||
|
|
||||
|
||||
annotation_presence.py:25:5: ANN201 Missing return type annotation for public function `foo`
|
||||
|
|
||||
25 | # Error
|
||||
26 | def foo():
|
||||
24 | # Error
|
||||
25 | def foo():
|
||||
| ^^^ ANN201
|
||||
27 | pass
|
||||
26 | pass
|
||||
|
|
||||
|
||||
annotation_presence.py:45:12: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `a`
|
||||
|
|
||||
45 | # ANN401
|
||||
46 | def foo(a: Any, *args: str, **kwargs: str) -> int:
|
||||
44 | # ANN401
|
||||
45 | def foo(a: Any, *args: str, **kwargs: str) -> int:
|
||||
| ^^^ ANN401
|
||||
47 | pass
|
||||
46 | pass
|
||||
|
|
||||
|
||||
annotation_presence.py:50:47: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `foo`
|
||||
|
|
||||
50 | # ANN401
|
||||
51 | def foo(a: int, *args: str, **kwargs: str) -> Any:
|
||||
49 | # ANN401
|
||||
50 | def foo(a: int, *args: str, **kwargs: str) -> Any:
|
||||
| ^^^ ANN401
|
||||
52 | pass
|
||||
51 | pass
|
||||
|
|
||||
|
||||
annotation_presence.py:55:24: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `*args`
|
||||
|
|
||||
55 | # ANN401
|
||||
56 | def foo(a: int, *args: Any, **kwargs: Any) -> int:
|
||||
54 | # ANN401
|
||||
55 | def foo(a: int, *args: Any, **kwargs: Any) -> int:
|
||||
| ^^^ ANN401
|
||||
57 | pass
|
||||
56 | pass
|
||||
|
|
||||
|
||||
annotation_presence.py:55:39: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `**kwargs`
|
||||
|
|
||||
55 | # ANN401
|
||||
56 | def foo(a: int, *args: Any, **kwargs: Any) -> int:
|
||||
54 | # ANN401
|
||||
55 | def foo(a: int, *args: Any, **kwargs: Any) -> int:
|
||||
| ^^^ ANN401
|
||||
57 | pass
|
||||
56 | pass
|
||||
|
|
||||
|
||||
annotation_presence.py:60:24: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `*args`
|
||||
|
|
||||
60 | # ANN401
|
||||
61 | def foo(a: int, *args: Any, **kwargs: str) -> int:
|
||||
59 | # ANN401
|
||||
60 | def foo(a: int, *args: Any, **kwargs: str) -> int:
|
||||
| ^^^ ANN401
|
||||
62 | pass
|
||||
61 | pass
|
||||
|
|
||||
|
||||
annotation_presence.py:65:39: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `**kwargs`
|
||||
|
|
||||
65 | # ANN401
|
||||
66 | def foo(a: int, *args: str, **kwargs: Any) -> int:
|
||||
64 | # ANN401
|
||||
65 | def foo(a: int, *args: str, **kwargs: Any) -> int:
|
||||
| ^^^ ANN401
|
||||
67 | pass
|
||||
66 | pass
|
||||
|
|
||||
|
||||
annotation_presence.py:75:13: ANN101 Missing type annotation for `self` in method
|
||||
|
|
||||
75 | # ANN101
|
||||
76 | def foo(self, a: int, b: int) -> int:
|
||||
74 | # ANN101
|
||||
75 | def foo(self, a: int, b: int) -> int:
|
||||
| ^^^^ ANN101
|
||||
77 | pass
|
||||
76 | pass
|
||||
|
|
||||
|
||||
annotation_presence.py:79:29: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `a`
|
||||
|
|
||||
79 | # ANN401
|
||||
80 | def foo(self: "Foo", a: Any, *params: str, **options: str) -> int:
|
||||
78 | # ANN401
|
||||
79 | def foo(self: "Foo", a: Any, *params: str, **options: str) -> int:
|
||||
| ^^^ ANN401
|
||||
81 | pass
|
||||
80 | pass
|
||||
|
|
||||
|
||||
annotation_presence.py:83:67: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `foo`
|
||||
|
|
||||
83 | # ANN401
|
||||
84 | def foo(self: "Foo", a: int, *params: str, **options: str) -> Any:
|
||||
82 | # ANN401
|
||||
83 | def foo(self: "Foo", a: int, *params: str, **options: str) -> Any:
|
||||
| ^^^ ANN401
|
||||
85 | pass
|
||||
84 | pass
|
||||
|
|
||||
|
||||
annotation_presence.py:87:43: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `*params`
|
||||
|
|
||||
87 | # ANN401
|
||||
88 | def foo(self: "Foo", a: int, *params: Any, **options: Any) -> int:
|
||||
86 | # ANN401
|
||||
87 | def foo(self: "Foo", a: int, *params: Any, **options: Any) -> int:
|
||||
| ^^^ ANN401
|
||||
89 | pass
|
||||
88 | pass
|
||||
|
|
||||
|
||||
annotation_presence.py:87:59: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `**options`
|
||||
|
|
||||
87 | # ANN401
|
||||
88 | def foo(self: "Foo", a: int, *params: Any, **options: Any) -> int:
|
||||
86 | # ANN401
|
||||
87 | def foo(self: "Foo", a: int, *params: Any, **options: Any) -> int:
|
||||
| ^^^ ANN401
|
||||
89 | pass
|
||||
88 | pass
|
||||
|
|
||||
|
||||
annotation_presence.py:91:43: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `*params`
|
||||
|
|
||||
91 | # ANN401
|
||||
92 | def foo(self: "Foo", a: int, *params: Any, **options: str) -> int:
|
||||
90 | # ANN401
|
||||
91 | def foo(self: "Foo", a: int, *params: Any, **options: str) -> int:
|
||||
| ^^^ ANN401
|
||||
93 | pass
|
||||
92 | pass
|
||||
|
|
||||
|
||||
annotation_presence.py:95:59: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `**options`
|
||||
|
|
||||
95 | # ANN401
|
||||
96 | def foo(self: "Foo", a: int, *params: str, **options: Any) -> int:
|
||||
94 | # ANN401
|
||||
95 | def foo(self: "Foo", a: int, *params: str, **options: Any) -> int:
|
||||
| ^^^ ANN401
|
||||
97 | pass
|
||||
96 | pass
|
||||
|
|
||||
|
||||
annotation_presence.py:130:13: ANN102 Missing type annotation for `cls` in classmethod
|
||||
|
|
||||
130 | # ANN102
|
||||
131 | @classmethod
|
||||
132 | def foo(cls, a: int, b: int) -> int:
|
||||
128 | # ANN102
|
||||
129 | @classmethod
|
||||
130 | def foo(cls, a: int, b: int) -> int:
|
||||
| ^^^ ANN102
|
||||
133 | pass
|
||||
131 | pass
|
||||
|
|
||||
|
||||
annotation_presence.py:134:13: ANN101 Missing type annotation for `self` in method
|
||||
|
|
||||
134 | # ANN101
|
||||
135 | def foo(self, /, a: int, b: int) -> int:
|
||||
133 | # ANN101
|
||||
134 | def foo(self, /, a: int, b: int) -> int:
|
||||
| ^^^^ ANN101
|
||||
136 | pass
|
||||
135 | pass
|
||||
|
|
||||
|
||||
|
||||
|
|
|
@ -31,11 +31,11 @@ ignore_fully_untyped.py:32:5: ANN201 Missing return type annotation for public f
|
|||
|
||||
ignore_fully_untyped.py:43:9: ANN201 Missing return type annotation for public function `error_typed_self`
|
||||
|
|
||||
43 | pass
|
||||
44 |
|
||||
45 | def error_typed_self(self: X):
|
||||
41 | pass
|
||||
42 |
|
||||
43 | def error_typed_self(self: X):
|
||||
| ^^^^^^^^^^^^^^^^ ANN201
|
||||
46 | pass
|
||||
44 | pass
|
||||
|
|
||||
|
||||
|
||||
|
|
|
@ -3,11 +3,11 @@ source: crates/ruff/src/rules/flake8_annotations/mod.rs
|
|||
---
|
||||
mypy_init_return.py:5:9: ANN204 [*] Missing return type annotation for special method `__init__`
|
||||
|
|
||||
5 | # Error
|
||||
6 | class Foo:
|
||||
7 | def __init__(self):
|
||||
3 | # Error
|
||||
4 | class Foo:
|
||||
5 | def __init__(self):
|
||||
| ^^^^^^^^ ANN204
|
||||
8 | ...
|
||||
6 | ...
|
||||
|
|
||||
= help: Add `None` return type
|
||||
|
||||
|
@ -23,11 +23,11 @@ mypy_init_return.py:5:9: ANN204 [*] Missing return type annotation for special m
|
|||
|
||||
mypy_init_return.py:11:9: ANN204 [*] Missing return type annotation for special method `__init__`
|
||||
|
|
||||
11 | # Error
|
||||
12 | class Foo:
|
||||
13 | def __init__(self, foo):
|
||||
9 | # Error
|
||||
10 | class Foo:
|
||||
11 | def __init__(self, foo):
|
||||
| ^^^^^^^^ ANN204
|
||||
14 | ...
|
||||
12 | ...
|
||||
|
|
||||
= help: Add `None` return type
|
||||
|
||||
|
@ -43,19 +43,19 @@ mypy_init_return.py:11:9: ANN204 [*] Missing return type annotation for special
|
|||
|
||||
mypy_init_return.py:40:5: ANN202 Missing return type annotation for private function `__init__`
|
||||
|
|
||||
40 | # Error
|
||||
41 | def __init__(self, foo: int):
|
||||
39 | # Error
|
||||
40 | def __init__(self, foo: int):
|
||||
| ^^^^^^^^ ANN202
|
||||
42 | ...
|
||||
41 | ...
|
||||
|
|
||||
|
||||
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:
|
||||
49 | def __init__(self, *arg):
|
||||
45 | # of a vararg falsely indicated that the function has a typed argument.
|
||||
46 | class Foo:
|
||||
47 | def __init__(self, *arg):
|
||||
| ^^^^^^^^ ANN204
|
||||
50 | ...
|
||||
48 | ...
|
||||
|
|
||||
= help: Add `None` return type
|
||||
|
||||
|
|
|
@ -3,10 +3,10 @@ source: crates/ruff/src/rules/flake8_annotations/mod.rs
|
|||
---
|
||||
simple_magic_methods.py:2:9: ANN204 [*] Missing return type annotation for special method `__str__`
|
||||
|
|
||||
2 | class Foo:
|
||||
3 | def __str__(self):
|
||||
1 | class Foo:
|
||||
2 | def __str__(self):
|
||||
| ^^^^^^^ ANN204
|
||||
4 | ...
|
||||
3 | ...
|
||||
|
|
||||
= help: Add `None` return type
|
||||
|
||||
|
@ -20,11 +20,11 @@ simple_magic_methods.py:2:9: ANN204 [*] Missing return type annotation for speci
|
|||
|
||||
simple_magic_methods.py:5:9: ANN204 [*] Missing return type annotation for special method `__repr__`
|
||||
|
|
||||
5 | ...
|
||||
6 |
|
||||
7 | def __repr__(self):
|
||||
3 | ...
|
||||
4 |
|
||||
5 | def __repr__(self):
|
||||
| ^^^^^^^^ ANN204
|
||||
8 | ...
|
||||
6 | ...
|
||||
|
|
||||
= help: Add `None` return type
|
||||
|
||||
|
@ -39,14 +39,14 @@ simple_magic_methods.py:5:9: ANN204 [*] Missing return type annotation for speci
|
|||
8 8 | def __len__(self):
|
||||
|
||||
simple_magic_methods.py:8:9: ANN204 [*] Missing return type annotation for special method `__len__`
|
||||
|
|
||||
8 | ...
|
||||
9 |
|
||||
10 | def __len__(self):
|
||||
| ^^^^^^^ ANN204
|
||||
11 | ...
|
||||
|
|
||||
= help: Add `None` return type
|
||||
|
|
||||
6 | ...
|
||||
7 |
|
||||
8 | def __len__(self):
|
||||
| ^^^^^^^ ANN204
|
||||
9 | ...
|
||||
|
|
||||
= help: Add `None` return type
|
||||
|
||||
ℹ Suggested fix
|
||||
5 5 | def __repr__(self):
|
||||
|
@ -60,11 +60,11 @@ simple_magic_methods.py:8:9: ANN204 [*] Missing return type annotation for speci
|
|||
|
||||
simple_magic_methods.py:11:9: ANN204 [*] Missing return type annotation for special method `__length_hint__`
|
||||
|
|
||||
11 | ...
|
||||
12 |
|
||||
13 | def __length_hint__(self):
|
||||
9 | ...
|
||||
10 |
|
||||
11 | def __length_hint__(self):
|
||||
| ^^^^^^^^^^^^^^^ ANN204
|
||||
14 | ...
|
||||
12 | ...
|
||||
|
|
||||
= help: Add `None` return type
|
||||
|
||||
|
@ -80,11 +80,11 @@ simple_magic_methods.py:11:9: ANN204 [*] Missing return type annotation for spec
|
|||
|
||||
simple_magic_methods.py:14:9: ANN204 [*] Missing return type annotation for special method `__init__`
|
||||
|
|
||||
14 | ...
|
||||
15 |
|
||||
16 | def __init__(self):
|
||||
12 | ...
|
||||
13 |
|
||||
14 | def __init__(self):
|
||||
| ^^^^^^^^ ANN204
|
||||
17 | ...
|
||||
15 | ...
|
||||
|
|
||||
= help: Add `None` return type
|
||||
|
||||
|
@ -100,11 +100,11 @@ simple_magic_methods.py:14:9: ANN204 [*] Missing return type annotation for spec
|
|||
|
||||
simple_magic_methods.py:17:9: ANN204 [*] Missing return type annotation for special method `__del__`
|
||||
|
|
||||
17 | ...
|
||||
18 |
|
||||
19 | def __del__(self):
|
||||
15 | ...
|
||||
16 |
|
||||
17 | def __del__(self):
|
||||
| ^^^^^^^ ANN204
|
||||
20 | ...
|
||||
18 | ...
|
||||
|
|
||||
= help: Add `None` return type
|
||||
|
||||
|
@ -120,11 +120,11 @@ simple_magic_methods.py:17:9: ANN204 [*] Missing return type annotation for spec
|
|||
|
||||
simple_magic_methods.py:20:9: ANN204 [*] Missing return type annotation for special method `__bool__`
|
||||
|
|
||||
20 | ...
|
||||
21 |
|
||||
22 | def __bool__(self):
|
||||
18 | ...
|
||||
19 |
|
||||
20 | def __bool__(self):
|
||||
| ^^^^^^^^ ANN204
|
||||
23 | ...
|
||||
21 | ...
|
||||
|
|
||||
= help: Add `None` return type
|
||||
|
||||
|
@ -140,11 +140,11 @@ simple_magic_methods.py:20:9: ANN204 [*] Missing return type annotation for spec
|
|||
|
||||
simple_magic_methods.py:23:9: ANN204 [*] Missing return type annotation for special method `__bytes__`
|
||||
|
|
||||
23 | ...
|
||||
24 |
|
||||
25 | def __bytes__(self):
|
||||
21 | ...
|
||||
22 |
|
||||
23 | def __bytes__(self):
|
||||
| ^^^^^^^^^ ANN204
|
||||
26 | ...
|
||||
24 | ...
|
||||
|
|
||||
= help: Add `None` return type
|
||||
|
||||
|
@ -160,11 +160,11 @@ simple_magic_methods.py:23:9: ANN204 [*] Missing return type annotation for spec
|
|||
|
||||
simple_magic_methods.py:26:9: ANN204 [*] Missing return type annotation for special method `__format__`
|
||||
|
|
||||
26 | ...
|
||||
27 |
|
||||
28 | def __format__(self, format_spec):
|
||||
24 | ...
|
||||
25 |
|
||||
26 | def __format__(self, format_spec):
|
||||
| ^^^^^^^^^^ ANN204
|
||||
29 | ...
|
||||
27 | ...
|
||||
|
|
||||
= help: Add `None` return type
|
||||
|
||||
|
@ -180,11 +180,11 @@ simple_magic_methods.py:26:9: ANN204 [*] Missing return type annotation for spec
|
|||
|
||||
simple_magic_methods.py:29:9: ANN204 [*] Missing return type annotation for special method `__contains__`
|
||||
|
|
||||
29 | ...
|
||||
30 |
|
||||
31 | def __contains__(self, item):
|
||||
27 | ...
|
||||
28 |
|
||||
29 | def __contains__(self, item):
|
||||
| ^^^^^^^^^^^^ ANN204
|
||||
32 | ...
|
||||
30 | ...
|
||||
|
|
||||
= help: Add `None` return type
|
||||
|
||||
|
@ -200,11 +200,11 @@ simple_magic_methods.py:29:9: ANN204 [*] Missing return type annotation for spec
|
|||
|
||||
simple_magic_methods.py:32:9: ANN204 [*] Missing return type annotation for special method `__complex__`
|
||||
|
|
||||
32 | ...
|
||||
33 |
|
||||
34 | def __complex__(self):
|
||||
30 | ...
|
||||
31 |
|
||||
32 | def __complex__(self):
|
||||
| ^^^^^^^^^^^ ANN204
|
||||
35 | ...
|
||||
33 | ...
|
||||
|
|
||||
= help: Add `None` return type
|
||||
|
||||
|
@ -220,11 +220,11 @@ simple_magic_methods.py:32:9: ANN204 [*] Missing return type annotation for spec
|
|||
|
||||
simple_magic_methods.py:35:9: ANN204 [*] Missing return type annotation for special method `__int__`
|
||||
|
|
||||
35 | ...
|
||||
36 |
|
||||
37 | def __int__(self):
|
||||
33 | ...
|
||||
34 |
|
||||
35 | def __int__(self):
|
||||
| ^^^^^^^ ANN204
|
||||
38 | ...
|
||||
36 | ...
|
||||
|
|
||||
= help: Add `None` return type
|
||||
|
||||
|
@ -240,11 +240,11 @@ simple_magic_methods.py:35:9: ANN204 [*] Missing return type annotation for spec
|
|||
|
||||
simple_magic_methods.py:38:9: ANN204 [*] Missing return type annotation for special method `__float__`
|
||||
|
|
||||
38 | ...
|
||||
39 |
|
||||
40 | def __float__(self):
|
||||
36 | ...
|
||||
37 |
|
||||
38 | def __float__(self):
|
||||
| ^^^^^^^^^ ANN204
|
||||
41 | ...
|
||||
39 | ...
|
||||
|
|
||||
= help: Add `None` return type
|
||||
|
||||
|
@ -260,11 +260,11 @@ simple_magic_methods.py:38:9: ANN204 [*] Missing return type annotation for spec
|
|||
|
||||
simple_magic_methods.py:41:9: ANN204 [*] Missing return type annotation for special method `__index__`
|
||||
|
|
||||
41 | ...
|
||||
42 |
|
||||
43 | def __index__(self):
|
||||
39 | ...
|
||||
40 |
|
||||
41 | def __index__(self):
|
||||
| ^^^^^^^^^ ANN204
|
||||
44 | ...
|
||||
42 | ...
|
||||
|
|
||||
= help: Add `None` return type
|
||||
|
||||
|
|
|
@ -3,27 +3,27 @@ source: crates/ruff/src/rules/flake8_annotations/mod.rs
|
|||
---
|
||||
suppress_none_returning.py:45:5: ANN201 Missing return type annotation for public function `foo`
|
||||
|
|
||||
45 | # Error
|
||||
46 | def foo():
|
||||
44 | # Error
|
||||
45 | def foo():
|
||||
| ^^^ ANN201
|
||||
47 | return True
|
||||
46 | return True
|
||||
|
|
||||
|
||||
suppress_none_returning.py:50:5: ANN201 Missing return type annotation for public function `foo`
|
||||
|
|
||||
50 | # Error
|
||||
51 | def foo():
|
||||
49 | # Error
|
||||
50 | def foo():
|
||||
| ^^^ ANN201
|
||||
52 | a = 2 + 2
|
||||
53 | if a == 4:
|
||||
51 | a = 2 + 2
|
||||
52 | if a == 4:
|
||||
|
|
||||
|
||||
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):
|
||||
58 | # Error (on the argument, but not the return type)
|
||||
59 | def foo(a):
|
||||
| ^ ANN001
|
||||
61 | a = 2 + 2
|
||||
60 | a = 2 + 2
|
||||
|
|
||||
|
||||
|
||||
|
|
|
@ -3,36 +3,36 @@ source: crates/ruff/src/rules/flake8_async/mod.rs
|
|||
---
|
||||
ASYNC100.py:7:5: ASYNC100 Async functions should not call blocking HTTP methods
|
||||
|
|
||||
7 | async def foo():
|
||||
8 | urllib.request.urlopen("http://example.com/foo/bar").read()
|
||||
6 | async def foo():
|
||||
7 | urllib.request.urlopen("http://example.com/foo/bar").read()
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ ASYNC100
|
||||
|
|
||||
|
||||
ASYNC100.py:11:5: ASYNC100 Async functions should not call blocking HTTP methods
|
||||
|
|
||||
11 | async def foo():
|
||||
12 | requests.get()
|
||||
10 | async def foo():
|
||||
11 | requests.get()
|
||||
| ^^^^^^^^^^^^ ASYNC100
|
||||
|
|
||||
|
||||
ASYNC100.py:15:5: ASYNC100 Async functions should not call blocking HTTP methods
|
||||
|
|
||||
15 | async def foo():
|
||||
16 | httpx.get()
|
||||
14 | async def foo():
|
||||
15 | httpx.get()
|
||||
| ^^^^^^^^^ ASYNC100
|
||||
|
|
||||
|
||||
ASYNC100.py:19:5: ASYNC100 Async functions should not call blocking HTTP methods
|
||||
|
|
||||
19 | async def foo():
|
||||
20 | requests.post()
|
||||
18 | async def foo():
|
||||
19 | requests.post()
|
||||
| ^^^^^^^^^^^^^ ASYNC100
|
||||
|
|
||||
|
||||
ASYNC100.py:23:5: ASYNC100 Async functions should not call blocking HTTP methods
|
||||
|
|
||||
23 | async def foo():
|
||||
24 | httpx.post()
|
||||
22 | async def foo():
|
||||
23 | httpx.post()
|
||||
| ^^^^^^^^^^ ASYNC100
|
||||
|
|
||||
|
||||
|
|
|
@ -3,43 +3,43 @@ source: crates/ruff/src/rules/flake8_async/mod.rs
|
|||
---
|
||||
ASYNC101.py:7:5: ASYNC101 Async functions should not call `open`, `time.sleep`, or `subprocess` methods
|
||||
|
|
||||
7 | async def foo():
|
||||
8 | open("foo")
|
||||
6 | async def foo():
|
||||
7 | open("foo")
|
||||
| ^^^^ ASYNC101
|
||||
|
|
||||
|
||||
ASYNC101.py:11:5: ASYNC101 Async functions should not call `open`, `time.sleep`, or `subprocess` methods
|
||||
|
|
||||
11 | async def foo():
|
||||
12 | time.sleep(1)
|
||||
10 | async def foo():
|
||||
11 | time.sleep(1)
|
||||
| ^^^^^^^^^^ ASYNC101
|
||||
|
|
||||
|
||||
ASYNC101.py:15:5: ASYNC101 Async functions should not call `open`, `time.sleep`, or `subprocess` methods
|
||||
|
|
||||
15 | async def foo():
|
||||
16 | subprocess.run("foo")
|
||||
14 | async def foo():
|
||||
15 | subprocess.run("foo")
|
||||
| ^^^^^^^^^^^^^^ ASYNC101
|
||||
|
|
||||
|
||||
ASYNC101.py:19:5: ASYNC101 Async functions should not call `open`, `time.sleep`, or `subprocess` methods
|
||||
|
|
||||
19 | async def foo():
|
||||
20 | subprocess.call("foo")
|
||||
18 | async def foo():
|
||||
19 | subprocess.call("foo")
|
||||
| ^^^^^^^^^^^^^^^ ASYNC101
|
||||
|
|
||||
|
||||
ASYNC101.py:27:5: ASYNC101 Async functions should not call `open`, `time.sleep`, or `subprocess` methods
|
||||
|
|
||||
27 | async def foo():
|
||||
28 | os.wait4(10)
|
||||
26 | async def foo():
|
||||
27 | os.wait4(10)
|
||||
| ^^^^^^^^ ASYNC101
|
||||
|
|
||||
|
||||
ASYNC101.py:31:5: ASYNC101 Async functions should not call `open`, `time.sleep`, or `subprocess` methods
|
||||
|
|
||||
31 | async def foo():
|
||||
32 | os.wait(12)
|
||||
30 | async def foo():
|
||||
31 | os.wait(12)
|
||||
| ^^^^^^^ ASYNC101
|
||||
|
|
||||
|
||||
|
|
|
@ -3,16 +3,16 @@ source: crates/ruff/src/rules/flake8_async/mod.rs
|
|||
---
|
||||
ASYNC102.py:5:5: ASYNC102 Async functions should not call synchronous `os` methods
|
||||
|
|
||||
5 | async def foo():
|
||||
6 | os.popen()
|
||||
4 | async def foo():
|
||||
5 | os.popen()
|
||||
| ^^^^^^^^ ASYNC102
|
||||
|
|
||||
|
||||
ASYNC102.py:9:5: ASYNC102 Async functions should not call synchronous `os` methods
|
||||
|
|
||||
9 | async def foo():
|
||||
10 | os.spawnl()
|
||||
| ^^^^^^^^^ ASYNC102
|
||||
|
|
||||
|
|
||||
8 | async def foo():
|
||||
9 | os.spawnl()
|
||||
| ^^^^^^^^^ ASYNC102
|
||||
|
|
||||
|
||||
|
||||
|
|
|
@ -9,18 +9,18 @@ S101.py:1:1: S101 Use of `assert` detected
|
|||
|
||||
S101.py:6:5: S101 Use of `assert` detected
|
||||
|
|
||||
6 | def fn():
|
||||
7 | x = 1
|
||||
8 | assert x == 1 # S101
|
||||
4 | def fn():
|
||||
5 | x = 1
|
||||
6 | assert x == 1 # S101
|
||||
| ^^^^^^ S101
|
||||
9 | assert x == 2 # S101
|
||||
7 | assert x == 2 # S101
|
||||
|
|
||||
|
||||
S101.py:7:5: S101 Use of `assert` detected
|
||||
|
|
||||
7 | x = 1
|
||||
8 | assert x == 1 # S101
|
||||
9 | assert x == 2 # S101
|
||||
5 | x = 1
|
||||
6 | assert x == 1 # S101
|
||||
7 | assert x == 2 # S101
|
||||
| ^^^^^^ S101
|
||||
|
|
||||
|
||||
|
|
|
@ -3,19 +3,19 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
|
|||
---
|
||||
S102.py:3:5: S102 Use of `exec` detected
|
||||
|
|
||||
3 | def fn():
|
||||
4 | # Error
|
||||
5 | exec('x = 2')
|
||||
1 | def fn():
|
||||
2 | # Error
|
||||
3 | exec('x = 2')
|
||||
| ^^^^^^^^^^^^^ S102
|
||||
6 |
|
||||
7 | exec('y = 3')
|
||||
4 |
|
||||
5 | exec('y = 3')
|
||||
|
|
||||
|
||||
S102.py:5:1: S102 Use of `exec` detected
|
||||
|
|
||||
5 | exec('x = 2')
|
||||
6 |
|
||||
7 | exec('y = 3')
|
||||
3 | exec('x = 2')
|
||||
4 |
|
||||
5 | exec('y = 3')
|
||||
| ^^^^^^^^^^^^^ S102
|
||||
|
|
||||
|
||||
|
|
|
@ -2,129 +2,129 @@
|
|||
source: crates/ruff/src/rules/flake8_bandit/mod.rs
|
||||
---
|
||||
S103.py:6:25: S103 `os.chmod` setting a permissive mask `0o227` on file or directory
|
||||
|
|
||||
6 | keyfile = "foo"
|
||||
7 |
|
||||
8 | os.chmod("/etc/passwd", 0o227) # Error
|
||||
| ^^^^^ S103
|
||||
9 | os.chmod("/etc/passwd", 0o7) # Error
|
||||
10 | os.chmod("/etc/passwd", 0o664) # OK
|
||||
|
|
||||
|
|
||||
4 | keyfile = "foo"
|
||||
5 |
|
||||
6 | os.chmod("/etc/passwd", 0o227) # Error
|
||||
| ^^^^^ S103
|
||||
7 | os.chmod("/etc/passwd", 0o7) # Error
|
||||
8 | os.chmod("/etc/passwd", 0o664) # OK
|
||||
|
|
||||
|
||||
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
|
||||
| ^^^ S103
|
||||
9 | os.chmod("/etc/passwd", 0o664) # OK
|
||||
10 | os.chmod("/etc/passwd", 0o777) # Error
|
||||
|
|
||||
|
|
||||
6 | os.chmod("/etc/passwd", 0o227) # Error
|
||||
7 | os.chmod("/etc/passwd", 0o7) # Error
|
||||
| ^^^ S103
|
||||
8 | os.chmod("/etc/passwd", 0o664) # OK
|
||||
9 | os.chmod("/etc/passwd", 0o777) # Error
|
||||
|
|
||||
|
||||
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
|
||||
11 | os.chmod("/etc/passwd", 0o777) # Error
|
||||
7 | os.chmod("/etc/passwd", 0o7) # Error
|
||||
8 | os.chmod("/etc/passwd", 0o664) # OK
|
||||
9 | os.chmod("/etc/passwd", 0o777) # Error
|
||||
| ^^^^^ S103
|
||||
12 | os.chmod("/etc/passwd", 0o770) # Error
|
||||
13 | os.chmod("/etc/passwd", 0o776) # Error
|
||||
10 | os.chmod("/etc/passwd", 0o770) # Error
|
||||
11 | os.chmod("/etc/passwd", 0o776) # Error
|
||||
|
|
||||
|
||||
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
|
||||
12 | os.chmod("/etc/passwd", 0o770) # Error
|
||||
8 | os.chmod("/etc/passwd", 0o664) # OK
|
||||
9 | os.chmod("/etc/passwd", 0o777) # Error
|
||||
10 | os.chmod("/etc/passwd", 0o770) # Error
|
||||
| ^^^^^ S103
|
||||
13 | os.chmod("/etc/passwd", 0o776) # Error
|
||||
14 | os.chmod("/etc/passwd", 0o760) # OK
|
||||
11 | os.chmod("/etc/passwd", 0o776) # Error
|
||||
12 | os.chmod("/etc/passwd", 0o760) # OK
|
||||
|
|
||||
|
||||
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
|
||||
13 | os.chmod("/etc/passwd", 0o776) # Error
|
||||
9 | os.chmod("/etc/passwd", 0o777) # Error
|
||||
10 | os.chmod("/etc/passwd", 0o770) # Error
|
||||
11 | os.chmod("/etc/passwd", 0o776) # Error
|
||||
| ^^^^^ S103
|
||||
14 | os.chmod("/etc/passwd", 0o760) # OK
|
||||
15 | os.chmod("~/.bashrc", 511) # Error
|
||||
12 | os.chmod("/etc/passwd", 0o760) # OK
|
||||
13 | os.chmod("~/.bashrc", 511) # Error
|
||||
|
|
||||
|
||||
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
|
||||
15 | os.chmod("~/.bashrc", 511) # Error
|
||||
11 | os.chmod("/etc/passwd", 0o776) # Error
|
||||
12 | os.chmod("/etc/passwd", 0o760) # OK
|
||||
13 | os.chmod("~/.bashrc", 511) # Error
|
||||
| ^^^ S103
|
||||
16 | os.chmod("/etc/hosts", 0o777) # Error
|
||||
17 | os.chmod("/tmp/oh_hai", 0x1FF) # Error
|
||||
14 | os.chmod("/etc/hosts", 0o777) # Error
|
||||
15 | os.chmod("/tmp/oh_hai", 0x1FF) # Error
|
||||
|
|
||||
|
||||
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
|
||||
16 | os.chmod("/etc/hosts", 0o777) # Error
|
||||
12 | os.chmod("/etc/passwd", 0o760) # OK
|
||||
13 | os.chmod("~/.bashrc", 511) # Error
|
||||
14 | os.chmod("/etc/hosts", 0o777) # Error
|
||||
| ^^^^^ S103
|
||||
17 | os.chmod("/tmp/oh_hai", 0x1FF) # Error
|
||||
18 | os.chmod("/etc/passwd", stat.S_IRWXU) # OK
|
||||
15 | os.chmod("/tmp/oh_hai", 0x1FF) # Error
|
||||
16 | os.chmod("/etc/passwd", stat.S_IRWXU) # OK
|
||||
|
|
||||
|
||||
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
|
||||
17 | os.chmod("/tmp/oh_hai", 0x1FF) # Error
|
||||
13 | os.chmod("~/.bashrc", 511) # Error
|
||||
14 | os.chmod("/etc/hosts", 0o777) # Error
|
||||
15 | os.chmod("/tmp/oh_hai", 0x1FF) # Error
|
||||
| ^^^^^ S103
|
||||
18 | os.chmod("/etc/passwd", stat.S_IRWXU) # OK
|
||||
19 | os.chmod(keyfile, 0o777) # Error
|
||||
16 | os.chmod("/etc/passwd", stat.S_IRWXU) # OK
|
||||
17 | os.chmod(keyfile, 0o777) # Error
|
||||
|
|
||||
|
||||
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
|
||||
19 | os.chmod(keyfile, 0o777) # Error
|
||||
15 | os.chmod("/tmp/oh_hai", 0x1FF) # Error
|
||||
16 | os.chmod("/etc/passwd", stat.S_IRWXU) # OK
|
||||
17 | os.chmod(keyfile, 0o777) # Error
|
||||
| ^^^^^ S103
|
||||
20 | os.chmod(keyfile, 0o7 | 0o70 | 0o700) # Error
|
||||
21 | os.chmod(keyfile, stat.S_IRWXO | stat.S_IRWXG | stat.S_IRWXU) # Error
|
||||
18 | os.chmod(keyfile, 0o7 | 0o70 | 0o700) # Error
|
||||
19 | os.chmod(keyfile, stat.S_IRWXO | stat.S_IRWXG | stat.S_IRWXU) # Error
|
||||
|
|
||||
|
||||
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
|
||||
20 | os.chmod(keyfile, 0o7 | 0o70 | 0o700) # Error
|
||||
16 | os.chmod("/etc/passwd", stat.S_IRWXU) # OK
|
||||
17 | os.chmod(keyfile, 0o777) # Error
|
||||
18 | os.chmod(keyfile, 0o7 | 0o70 | 0o700) # Error
|
||||
| ^^^^^^^^^^^^^^^^^^ S103
|
||||
21 | os.chmod(keyfile, stat.S_IRWXO | stat.S_IRWXG | stat.S_IRWXU) # Error
|
||||
22 | os.chmod("~/hidden_exec", stat.S_IXGRP) # Error
|
||||
19 | os.chmod(keyfile, stat.S_IRWXO | stat.S_IRWXG | stat.S_IRWXU) # Error
|
||||
20 | os.chmod("~/hidden_exec", stat.S_IXGRP) # Error
|
||||
|
|
||||
|
||||
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
|
||||
21 | os.chmod(keyfile, stat.S_IRWXO | stat.S_IRWXG | stat.S_IRWXU) # Error
|
||||
17 | os.chmod(keyfile, 0o777) # Error
|
||||
18 | os.chmod(keyfile, 0o7 | 0o70 | 0o700) # Error
|
||||
19 | os.chmod(keyfile, stat.S_IRWXO | stat.S_IRWXG | stat.S_IRWXU) # Error
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S103
|
||||
22 | os.chmod("~/hidden_exec", stat.S_IXGRP) # Error
|
||||
23 | os.chmod("~/hidden_exec", stat.S_IXOTH) # OK
|
||||
20 | os.chmod("~/hidden_exec", stat.S_IXGRP) # Error
|
||||
21 | os.chmod("~/hidden_exec", stat.S_IXOTH) # OK
|
||||
|
|
||||
|
||||
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
|
||||
22 | os.chmod("~/hidden_exec", stat.S_IXGRP) # Error
|
||||
18 | os.chmod(keyfile, 0o7 | 0o70 | 0o700) # Error
|
||||
19 | os.chmod(keyfile, stat.S_IRWXO | stat.S_IRWXG | stat.S_IRWXU) # Error
|
||||
20 | os.chmod("~/hidden_exec", stat.S_IXGRP) # Error
|
||||
| ^^^^^^^^^^^^ S103
|
||||
23 | os.chmod("~/hidden_exec", stat.S_IXOTH) # OK
|
||||
24 | os.chmod("/etc/passwd", stat.S_IWOTH) # Error
|
||||
21 | os.chmod("~/hidden_exec", stat.S_IXOTH) # OK
|
||||
22 | os.chmod("/etc/passwd", stat.S_IWOTH) # Error
|
||||
|
|
||||
|
||||
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
|
||||
24 | os.chmod("/etc/passwd", stat.S_IWOTH) # Error
|
||||
20 | os.chmod("~/hidden_exec", stat.S_IXGRP) # Error
|
||||
21 | os.chmod("~/hidden_exec", stat.S_IXOTH) # OK
|
||||
22 | os.chmod("/etc/passwd", stat.S_IWOTH) # Error
|
||||
| ^^^^^^^^^^^^ S103
|
||||
|
|
||||
|
||||
|
|
|
@ -3,33 +3,33 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
|
|||
---
|
||||
S104.py:9:1: S104 Possible binding to all interfaces
|
||||
|
|
||||
9 | # Error
|
||||
10 | "0.0.0.0"
|
||||
8 | # Error
|
||||
9 | "0.0.0.0"
|
||||
| ^^^^^^^^^ S104
|
||||
11 | '0.0.0.0'
|
||||
10 | '0.0.0.0'
|
||||
|
|
||||
|
||||
S104.py:10:1: S104 Possible binding to all interfaces
|
||||
|
|
||||
10 | # Error
|
||||
11 | "0.0.0.0"
|
||||
12 | '0.0.0.0'
|
||||
8 | # Error
|
||||
9 | "0.0.0.0"
|
||||
10 | '0.0.0.0'
|
||||
| ^^^^^^^^^ S104
|
||||
|
|
||||
|
||||
S104.py:14:6: S104 Possible binding to all interfaces
|
||||
|
|
||||
14 | # Error
|
||||
15 | func("0.0.0.0")
|
||||
13 | # Error
|
||||
14 | func("0.0.0.0")
|
||||
| ^^^^^^^^^ S104
|
||||
|
|
||||
|
||||
S104.py:18:9: S104 Possible binding to all interfaces
|
||||
|
|
||||
18 | def my_func():
|
||||
19 | x = "0.0.0.0"
|
||||
17 | def my_func():
|
||||
18 | x = "0.0.0.0"
|
||||
| ^^^^^^^^^ S104
|
||||
20 | print(x)
|
||||
19 | print(x)
|
||||
|
|
||||
|
||||
|
||||
|
|
|
@ -3,204 +3,204 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
|
|||
---
|
||||
S105.py:13:12: S105 Possible hardcoded password assigned to: "password"
|
||||
|
|
||||
13 | # Errors
|
||||
14 | password = "s3cr3t"
|
||||
12 | # Errors
|
||||
13 | password = "s3cr3t"
|
||||
| ^^^^^^^^ S105
|
||||
15 | _pass = "s3cr3t"
|
||||
16 | passwd = "s3cr3t"
|
||||
14 | _pass = "s3cr3t"
|
||||
15 | passwd = "s3cr3t"
|
||||
|
|
||||
|
||||
S105.py:14:9: S105 Possible hardcoded password assigned to: "_pass"
|
||||
|
|
||||
14 | # Errors
|
||||
15 | password = "s3cr3t"
|
||||
16 | _pass = "s3cr3t"
|
||||
12 | # Errors
|
||||
13 | password = "s3cr3t"
|
||||
14 | _pass = "s3cr3t"
|
||||
| ^^^^^^^^ S105
|
||||
17 | passwd = "s3cr3t"
|
||||
18 | pwd = "s3cr3t"
|
||||
15 | passwd = "s3cr3t"
|
||||
16 | pwd = "s3cr3t"
|
||||
|
|
||||
|
||||
S105.py:15:10: S105 Possible hardcoded password assigned to: "passwd"
|
||||
|
|
||||
15 | password = "s3cr3t"
|
||||
16 | _pass = "s3cr3t"
|
||||
17 | passwd = "s3cr3t"
|
||||
13 | password = "s3cr3t"
|
||||
14 | _pass = "s3cr3t"
|
||||
15 | passwd = "s3cr3t"
|
||||
| ^^^^^^^^ S105
|
||||
18 | pwd = "s3cr3t"
|
||||
19 | secret = "s3cr3t"
|
||||
16 | pwd = "s3cr3t"
|
||||
17 | secret = "s3cr3t"
|
||||
|
|
||||
|
||||
S105.py:16:7: S105 Possible hardcoded password assigned to: "pwd"
|
||||
|
|
||||
16 | _pass = "s3cr3t"
|
||||
17 | passwd = "s3cr3t"
|
||||
18 | pwd = "s3cr3t"
|
||||
14 | _pass = "s3cr3t"
|
||||
15 | passwd = "s3cr3t"
|
||||
16 | pwd = "s3cr3t"
|
||||
| ^^^^^^^^ S105
|
||||
19 | secret = "s3cr3t"
|
||||
20 | token = "s3cr3t"
|
||||
17 | secret = "s3cr3t"
|
||||
18 | token = "s3cr3t"
|
||||
|
|
||||
|
||||
S105.py:17:10: S105 Possible hardcoded password assigned to: "secret"
|
||||
|
|
||||
17 | passwd = "s3cr3t"
|
||||
18 | pwd = "s3cr3t"
|
||||
19 | secret = "s3cr3t"
|
||||
15 | passwd = "s3cr3t"
|
||||
16 | pwd = "s3cr3t"
|
||||
17 | secret = "s3cr3t"
|
||||
| ^^^^^^^^ S105
|
||||
20 | token = "s3cr3t"
|
||||
21 | secrete = "s3cr3t"
|
||||
18 | token = "s3cr3t"
|
||||
19 | secrete = "s3cr3t"
|
||||
|
|
||||
|
||||
S105.py:18:9: S105 Possible hardcoded password assigned to: "token"
|
||||
|
|
||||
18 | pwd = "s3cr3t"
|
||||
19 | secret = "s3cr3t"
|
||||
20 | token = "s3cr3t"
|
||||
16 | pwd = "s3cr3t"
|
||||
17 | secret = "s3cr3t"
|
||||
18 | token = "s3cr3t"
|
||||
| ^^^^^^^^ S105
|
||||
21 | secrete = "s3cr3t"
|
||||
22 | safe = password = "s3cr3t"
|
||||
19 | secrete = "s3cr3t"
|
||||
20 | safe = password = "s3cr3t"
|
||||
|
|
||||
|
||||
S105.py:19:11: S105 Possible hardcoded password assigned to: "secrete"
|
||||
|
|
||||
19 | secret = "s3cr3t"
|
||||
20 | token = "s3cr3t"
|
||||
21 | secrete = "s3cr3t"
|
||||
17 | secret = "s3cr3t"
|
||||
18 | token = "s3cr3t"
|
||||
19 | secrete = "s3cr3t"
|
||||
| ^^^^^^^^ S105
|
||||
22 | safe = password = "s3cr3t"
|
||||
23 | password = safe = "s3cr3t"
|
||||
20 | safe = password = "s3cr3t"
|
||||
21 | password = safe = "s3cr3t"
|
||||
|
|
||||
|
||||
S105.py:20:19: S105 Possible hardcoded password assigned to: "password"
|
||||
|
|
||||
20 | token = "s3cr3t"
|
||||
21 | secrete = "s3cr3t"
|
||||
22 | safe = password = "s3cr3t"
|
||||
18 | token = "s3cr3t"
|
||||
19 | secrete = "s3cr3t"
|
||||
20 | safe = password = "s3cr3t"
|
||||
| ^^^^^^^^ S105
|
||||
23 | password = safe = "s3cr3t"
|
||||
24 | PASSWORD = "s3cr3t"
|
||||
21 | password = safe = "s3cr3t"
|
||||
22 | PASSWORD = "s3cr3t"
|
||||
|
|
||||
|
||||
S105.py:21:19: S105 Possible hardcoded password assigned to: "password"
|
||||
|
|
||||
21 | secrete = "s3cr3t"
|
||||
22 | safe = password = "s3cr3t"
|
||||
23 | password = safe = "s3cr3t"
|
||||
19 | secrete = "s3cr3t"
|
||||
20 | safe = password = "s3cr3t"
|
||||
21 | password = safe = "s3cr3t"
|
||||
| ^^^^^^^^ S105
|
||||
24 | PASSWORD = "s3cr3t"
|
||||
25 | PassWord = "s3cr3t"
|
||||
22 | PASSWORD = "s3cr3t"
|
||||
23 | PassWord = "s3cr3t"
|
||||
|
|
||||
|
||||
S105.py:22:12: S105 Possible hardcoded password assigned to: "PASSWORD"
|
||||
|
|
||||
22 | safe = password = "s3cr3t"
|
||||
23 | password = safe = "s3cr3t"
|
||||
24 | PASSWORD = "s3cr3t"
|
||||
20 | safe = password = "s3cr3t"
|
||||
21 | password = safe = "s3cr3t"
|
||||
22 | PASSWORD = "s3cr3t"
|
||||
| ^^^^^^^^ S105
|
||||
25 | PassWord = "s3cr3t"
|
||||
23 | PassWord = "s3cr3t"
|
||||
|
|
||||
|
||||
S105.py:23:12: S105 Possible hardcoded password assigned to: "PassWord"
|
||||
|
|
||||
23 | password = safe = "s3cr3t"
|
||||
24 | PASSWORD = "s3cr3t"
|
||||
25 | PassWord = "s3cr3t"
|
||||
21 | password = safe = "s3cr3t"
|
||||
22 | PASSWORD = "s3cr3t"
|
||||
23 | PassWord = "s3cr3t"
|
||||
| ^^^^^^^^ S105
|
||||
26 |
|
||||
27 | d["password"] = "s3cr3t"
|
||||
24 |
|
||||
25 | d["password"] = "s3cr3t"
|
||||
|
|
||||
|
||||
S105.py:25:17: S105 Possible hardcoded password assigned to: "password"
|
||||
|
|
||||
25 | PassWord = "s3cr3t"
|
||||
26 |
|
||||
27 | d["password"] = "s3cr3t"
|
||||
23 | PassWord = "s3cr3t"
|
||||
24 |
|
||||
25 | d["password"] = "s3cr3t"
|
||||
| ^^^^^^^^ S105
|
||||
28 | d["pass"] = "s3cr3t"
|
||||
29 | d["passwd"] = "s3cr3t"
|
||||
26 | d["pass"] = "s3cr3t"
|
||||
27 | d["passwd"] = "s3cr3t"
|
||||
|
|
||||
|
||||
S105.py:26:13: S105 Possible hardcoded password assigned to: "pass"
|
||||
|
|
||||
26 | d["password"] = "s3cr3t"
|
||||
27 | d["pass"] = "s3cr3t"
|
||||
25 | d["password"] = "s3cr3t"
|
||||
26 | d["pass"] = "s3cr3t"
|
||||
| ^^^^^^^^ S105
|
||||
28 | d["passwd"] = "s3cr3t"
|
||||
29 | d["pwd"] = "s3cr3t"
|
||||
27 | d["passwd"] = "s3cr3t"
|
||||
28 | d["pwd"] = "s3cr3t"
|
||||
|
|
||||
|
||||
S105.py:27:15: S105 Possible hardcoded password assigned to: "passwd"
|
||||
|
|
||||
27 | d["password"] = "s3cr3t"
|
||||
28 | d["pass"] = "s3cr3t"
|
||||
29 | d["passwd"] = "s3cr3t"
|
||||
25 | d["password"] = "s3cr3t"
|
||||
26 | d["pass"] = "s3cr3t"
|
||||
27 | d["passwd"] = "s3cr3t"
|
||||
| ^^^^^^^^ S105
|
||||
30 | d["pwd"] = "s3cr3t"
|
||||
31 | d["secret"] = "s3cr3t"
|
||||
28 | d["pwd"] = "s3cr3t"
|
||||
29 | d["secret"] = "s3cr3t"
|
||||
|
|
||||
|
||||
S105.py:28:12: S105 Possible hardcoded password assigned to: "pwd"
|
||||
|
|
||||
28 | d["pass"] = "s3cr3t"
|
||||
29 | d["passwd"] = "s3cr3t"
|
||||
30 | d["pwd"] = "s3cr3t"
|
||||
26 | d["pass"] = "s3cr3t"
|
||||
27 | d["passwd"] = "s3cr3t"
|
||||
28 | d["pwd"] = "s3cr3t"
|
||||
| ^^^^^^^^ S105
|
||||
31 | d["secret"] = "s3cr3t"
|
||||
32 | d["token"] = "s3cr3t"
|
||||
29 | d["secret"] = "s3cr3t"
|
||||
30 | d["token"] = "s3cr3t"
|
||||
|
|
||||
|
||||
S105.py:29:15: S105 Possible hardcoded password assigned to: "secret"
|
||||
|
|
||||
29 | d["passwd"] = "s3cr3t"
|
||||
30 | d["pwd"] = "s3cr3t"
|
||||
31 | d["secret"] = "s3cr3t"
|
||||
27 | d["passwd"] = "s3cr3t"
|
||||
28 | d["pwd"] = "s3cr3t"
|
||||
29 | d["secret"] = "s3cr3t"
|
||||
| ^^^^^^^^ S105
|
||||
32 | d["token"] = "s3cr3t"
|
||||
33 | d["secrete"] = "s3cr3t"
|
||||
30 | d["token"] = "s3cr3t"
|
||||
31 | d["secrete"] = "s3cr3t"
|
||||
|
|
||||
|
||||
S105.py:30:14: S105 Possible hardcoded password assigned to: "token"
|
||||
|
|
||||
30 | d["pwd"] = "s3cr3t"
|
||||
31 | d["secret"] = "s3cr3t"
|
||||
32 | d["token"] = "s3cr3t"
|
||||
28 | d["pwd"] = "s3cr3t"
|
||||
29 | d["secret"] = "s3cr3t"
|
||||
30 | d["token"] = "s3cr3t"
|
||||
| ^^^^^^^^ S105
|
||||
33 | d["secrete"] = "s3cr3t"
|
||||
34 | safe = d["password"] = "s3cr3t"
|
||||
31 | d["secrete"] = "s3cr3t"
|
||||
32 | safe = d["password"] = "s3cr3t"
|
||||
|
|
||||
|
||||
S105.py:31:16: S105 Possible hardcoded password assigned to: "secrete"
|
||||
|
|
||||
31 | d["secret"] = "s3cr3t"
|
||||
32 | d["token"] = "s3cr3t"
|
||||
33 | d["secrete"] = "s3cr3t"
|
||||
29 | d["secret"] = "s3cr3t"
|
||||
30 | d["token"] = "s3cr3t"
|
||||
31 | d["secrete"] = "s3cr3t"
|
||||
| ^^^^^^^^ S105
|
||||
34 | safe = d["password"] = "s3cr3t"
|
||||
35 | d["password"] = safe = "s3cr3t"
|
||||
32 | safe = d["password"] = "s3cr3t"
|
||||
33 | d["password"] = safe = "s3cr3t"
|
||||
|
|
||||
|
||||
S105.py:32:24: S105 Possible hardcoded password assigned to: "password"
|
||||
|
|
||||
32 | d["token"] = "s3cr3t"
|
||||
33 | d["secrete"] = "s3cr3t"
|
||||
34 | safe = d["password"] = "s3cr3t"
|
||||
30 | d["token"] = "s3cr3t"
|
||||
31 | d["secrete"] = "s3cr3t"
|
||||
32 | safe = d["password"] = "s3cr3t"
|
||||
| ^^^^^^^^ S105
|
||||
35 | d["password"] = safe = "s3cr3t"
|
||||
33 | d["password"] = safe = "s3cr3t"
|
||||
|
|
||||
|
||||
S105.py:33:24: S105 Possible hardcoded password assigned to: "password"
|
||||
|
|
||||
33 | d["secrete"] = "s3cr3t"
|
||||
34 | safe = d["password"] = "s3cr3t"
|
||||
35 | d["password"] = safe = "s3cr3t"
|
||||
31 | d["secrete"] = "s3cr3t"
|
||||
32 | safe = d["password"] = "s3cr3t"
|
||||
33 | d["password"] = safe = "s3cr3t"
|
||||
| ^^^^^^^^ S105
|
||||
|
|
||||
|
||||
S105.py:37:16: S105 Possible hardcoded password assigned to: "password"
|
||||
|
|
||||
37 | class MyClass:
|
||||
38 | password = "s3cr3t"
|
||||
36 | class MyClass:
|
||||
37 | password = "s3cr3t"
|
||||
| ^^^^^^^^ S105
|
||||
39 | safe = password
|
||||
38 | safe = password
|
||||
|
|
||||
|
||||
S105.py:41:20: S105 Possible hardcoded password assigned to: "password"
|
||||
|
@ -213,165 +213,165 @@ S105.py:41:20: S105 Possible hardcoded password assigned to: "password"
|
|||
|
||||
S105.py:42:17: S105 Possible hardcoded password assigned to: "_pass"
|
||||
|
|
||||
42 | MyClass.password = "s3cr3t"
|
||||
43 | MyClass._pass = "s3cr3t"
|
||||
41 | MyClass.password = "s3cr3t"
|
||||
42 | MyClass._pass = "s3cr3t"
|
||||
| ^^^^^^^^ S105
|
||||
44 | MyClass.passwd = "s3cr3t"
|
||||
45 | MyClass.pwd = "s3cr3t"
|
||||
43 | MyClass.passwd = "s3cr3t"
|
||||
44 | MyClass.pwd = "s3cr3t"
|
||||
|
|
||||
|
||||
S105.py:43:18: S105 Possible hardcoded password assigned to: "passwd"
|
||||
|
|
||||
43 | MyClass.password = "s3cr3t"
|
||||
44 | MyClass._pass = "s3cr3t"
|
||||
45 | MyClass.passwd = "s3cr3t"
|
||||
41 | MyClass.password = "s3cr3t"
|
||||
42 | MyClass._pass = "s3cr3t"
|
||||
43 | MyClass.passwd = "s3cr3t"
|
||||
| ^^^^^^^^ S105
|
||||
46 | MyClass.pwd = "s3cr3t"
|
||||
47 | MyClass.secret = "s3cr3t"
|
||||
44 | MyClass.pwd = "s3cr3t"
|
||||
45 | MyClass.secret = "s3cr3t"
|
||||
|
|
||||
|
||||
S105.py:44:15: S105 Possible hardcoded password assigned to: "pwd"
|
||||
|
|
||||
44 | MyClass._pass = "s3cr3t"
|
||||
45 | MyClass.passwd = "s3cr3t"
|
||||
46 | MyClass.pwd = "s3cr3t"
|
||||
42 | MyClass._pass = "s3cr3t"
|
||||
43 | MyClass.passwd = "s3cr3t"
|
||||
44 | MyClass.pwd = "s3cr3t"
|
||||
| ^^^^^^^^ S105
|
||||
47 | MyClass.secret = "s3cr3t"
|
||||
48 | MyClass.token = "s3cr3t"
|
||||
45 | MyClass.secret = "s3cr3t"
|
||||
46 | MyClass.token = "s3cr3t"
|
||||
|
|
||||
|
||||
S105.py:45:18: S105 Possible hardcoded password assigned to: "secret"
|
||||
|
|
||||
45 | MyClass.passwd = "s3cr3t"
|
||||
46 | MyClass.pwd = "s3cr3t"
|
||||
47 | MyClass.secret = "s3cr3t"
|
||||
43 | MyClass.passwd = "s3cr3t"
|
||||
44 | MyClass.pwd = "s3cr3t"
|
||||
45 | MyClass.secret = "s3cr3t"
|
||||
| ^^^^^^^^ S105
|
||||
48 | MyClass.token = "s3cr3t"
|
||||
49 | MyClass.secrete = "s3cr3t"
|
||||
46 | MyClass.token = "s3cr3t"
|
||||
47 | MyClass.secrete = "s3cr3t"
|
||||
|
|
||||
|
||||
S105.py:46:17: S105 Possible hardcoded password assigned to: "token"
|
||||
|
|
||||
46 | MyClass.pwd = "s3cr3t"
|
||||
47 | MyClass.secret = "s3cr3t"
|
||||
48 | MyClass.token = "s3cr3t"
|
||||
44 | MyClass.pwd = "s3cr3t"
|
||||
45 | MyClass.secret = "s3cr3t"
|
||||
46 | MyClass.token = "s3cr3t"
|
||||
| ^^^^^^^^ S105
|
||||
49 | MyClass.secrete = "s3cr3t"
|
||||
47 | MyClass.secrete = "s3cr3t"
|
||||
|
|
||||
|
||||
S105.py:47:19: S105 Possible hardcoded password assigned to: "secrete"
|
||||
|
|
||||
47 | MyClass.secret = "s3cr3t"
|
||||
48 | MyClass.token = "s3cr3t"
|
||||
49 | MyClass.secrete = "s3cr3t"
|
||||
45 | MyClass.secret = "s3cr3t"
|
||||
46 | MyClass.token = "s3cr3t"
|
||||
47 | MyClass.secrete = "s3cr3t"
|
||||
| ^^^^^^^^ S105
|
||||
50 |
|
||||
51 | password == "s3cr3t"
|
||||
48 |
|
||||
49 | password == "s3cr3t"
|
||||
|
|
||||
|
||||
S105.py:49:13: S105 Possible hardcoded password assigned to: "password"
|
||||
|
|
||||
49 | MyClass.secrete = "s3cr3t"
|
||||
50 |
|
||||
51 | password == "s3cr3t"
|
||||
47 | MyClass.secrete = "s3cr3t"
|
||||
48 |
|
||||
49 | password == "s3cr3t"
|
||||
| ^^^^^^^^ S105
|
||||
52 | _pass == "s3cr3t"
|
||||
53 | passwd == "s3cr3t"
|
||||
50 | _pass == "s3cr3t"
|
||||
51 | passwd == "s3cr3t"
|
||||
|
|
||||
|
||||
S105.py:50:10: S105 Possible hardcoded password assigned to: "_pass"
|
||||
|
|
||||
50 | password == "s3cr3t"
|
||||
51 | _pass == "s3cr3t"
|
||||
49 | password == "s3cr3t"
|
||||
50 | _pass == "s3cr3t"
|
||||
| ^^^^^^^^ S105
|
||||
52 | passwd == "s3cr3t"
|
||||
53 | pwd == "s3cr3t"
|
||||
51 | passwd == "s3cr3t"
|
||||
52 | pwd == "s3cr3t"
|
||||
|
|
||||
|
||||
S105.py:51:11: S105 Possible hardcoded password assigned to: "passwd"
|
||||
|
|
||||
51 | password == "s3cr3t"
|
||||
52 | _pass == "s3cr3t"
|
||||
53 | passwd == "s3cr3t"
|
||||
49 | password == "s3cr3t"
|
||||
50 | _pass == "s3cr3t"
|
||||
51 | passwd == "s3cr3t"
|
||||
| ^^^^^^^^ S105
|
||||
54 | pwd == "s3cr3t"
|
||||
55 | secret == "s3cr3t"
|
||||
52 | pwd == "s3cr3t"
|
||||
53 | secret == "s3cr3t"
|
||||
|
|
||||
|
||||
S105.py:52:8: S105 Possible hardcoded password assigned to: "pwd"
|
||||
|
|
||||
52 | _pass == "s3cr3t"
|
||||
53 | passwd == "s3cr3t"
|
||||
54 | pwd == "s3cr3t"
|
||||
50 | _pass == "s3cr3t"
|
||||
51 | passwd == "s3cr3t"
|
||||
52 | pwd == "s3cr3t"
|
||||
| ^^^^^^^^ S105
|
||||
55 | secret == "s3cr3t"
|
||||
56 | token == "s3cr3t"
|
||||
53 | secret == "s3cr3t"
|
||||
54 | token == "s3cr3t"
|
||||
|
|
||||
|
||||
S105.py:53:11: S105 Possible hardcoded password assigned to: "secret"
|
||||
|
|
||||
53 | passwd == "s3cr3t"
|
||||
54 | pwd == "s3cr3t"
|
||||
55 | secret == "s3cr3t"
|
||||
51 | passwd == "s3cr3t"
|
||||
52 | pwd == "s3cr3t"
|
||||
53 | secret == "s3cr3t"
|
||||
| ^^^^^^^^ S105
|
||||
56 | token == "s3cr3t"
|
||||
57 | secrete == "s3cr3t"
|
||||
54 | token == "s3cr3t"
|
||||
55 | secrete == "s3cr3t"
|
||||
|
|
||||
|
||||
S105.py:54:10: S105 Possible hardcoded password assigned to: "token"
|
||||
|
|
||||
54 | pwd == "s3cr3t"
|
||||
55 | secret == "s3cr3t"
|
||||
56 | token == "s3cr3t"
|
||||
52 | pwd == "s3cr3t"
|
||||
53 | secret == "s3cr3t"
|
||||
54 | token == "s3cr3t"
|
||||
| ^^^^^^^^ S105
|
||||
57 | secrete == "s3cr3t"
|
||||
58 | password == safe == "s3cr3t"
|
||||
55 | secrete == "s3cr3t"
|
||||
56 | password == safe == "s3cr3t"
|
||||
|
|
||||
|
||||
S105.py:55:12: S105 Possible hardcoded password assigned to: "secrete"
|
||||
|
|
||||
55 | secret == "s3cr3t"
|
||||
56 | token == "s3cr3t"
|
||||
57 | secrete == "s3cr3t"
|
||||
53 | secret == "s3cr3t"
|
||||
54 | token == "s3cr3t"
|
||||
55 | secrete == "s3cr3t"
|
||||
| ^^^^^^^^ S105
|
||||
58 | password == safe == "s3cr3t"
|
||||
56 | password == safe == "s3cr3t"
|
||||
|
|
||||
|
||||
S105.py:56:21: S105 Possible hardcoded password assigned to: "password"
|
||||
|
|
||||
56 | token == "s3cr3t"
|
||||
57 | secrete == "s3cr3t"
|
||||
58 | password == safe == "s3cr3t"
|
||||
54 | token == "s3cr3t"
|
||||
55 | secrete == "s3cr3t"
|
||||
56 | password == safe == "s3cr3t"
|
||||
| ^^^^^^^^ S105
|
||||
59 |
|
||||
60 | if token == "1\n2":
|
||||
57 |
|
||||
58 | if token == "1\n2":
|
||||
|
|
||||
|
||||
S105.py:58:13: S105 Possible hardcoded password assigned to: "token"
|
||||
|
|
||||
58 | password == safe == "s3cr3t"
|
||||
59 |
|
||||
60 | if token == "1\n2":
|
||||
56 | password == safe == "s3cr3t"
|
||||
57 |
|
||||
58 | if token == "1\n2":
|
||||
| ^^^^^^ S105
|
||||
61 | pass
|
||||
59 | pass
|
||||
|
|
||||
|
||||
S105.py:61:13: S105 Possible hardcoded password assigned to: "token"
|
||||
|
|
||||
61 | pass
|
||||
62 |
|
||||
63 | if token == "3\t4":
|
||||
59 | pass
|
||||
60 |
|
||||
61 | if token == "3\t4":
|
||||
| ^^^^^^ S105
|
||||
64 | pass
|
||||
62 | pass
|
||||
|
|
||||
|
||||
S105.py:64:13: S105 Possible hardcoded password assigned to: "token"
|
||||
|
|
||||
64 | pass
|
||||
65 |
|
||||
66 | if token == "5\r6":
|
||||
62 | pass
|
||||
63 |
|
||||
64 | if token == "5\r6":
|
||||
| ^^^^^^ S105
|
||||
67 | pass
|
||||
65 | pass
|
||||
|
|
||||
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
|
|||
---
|
||||
S106.py:14:9: S106 Possible hardcoded password assigned to argument: "password"
|
||||
|
|
||||
14 | # Error
|
||||
15 | func(1, password="s3cr3t")
|
||||
13 | # Error
|
||||
14 | func(1, password="s3cr3t")
|
||||
| ^^^^^^^^^^^^^^^^^ S106
|
||||
|
|
||||
|
||||
|
|
|
@ -3,29 +3,29 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
|
|||
---
|
||||
S108.py:5:11: S108 Probable insecure usage of temporary file or directory: "/tmp/abc"
|
||||
|
|
||||
5 | f.write("def")
|
||||
6 |
|
||||
7 | with open("/tmp/abc", "w") as f:
|
||||
3 | f.write("def")
|
||||
4 |
|
||||
5 | with open("/tmp/abc", "w") as f:
|
||||
| ^^^^^^^^^^ S108
|
||||
8 | f.write("def")
|
||||
6 | f.write("def")
|
||||
|
|
||||
|
||||
S108.py:8:11: S108 Probable insecure usage of temporary file or directory: "/var/tmp/123"
|
||||
|
|
||||
8 | f.write("def")
|
||||
9 |
|
||||
10 | with open("/var/tmp/123", "w") as f:
|
||||
| ^^^^^^^^^^^^^^ S108
|
||||
11 | f.write("def")
|
||||
|
|
||||
|
|
||||
6 | f.write("def")
|
||||
7 |
|
||||
8 | with open("/var/tmp/123", "w") as f:
|
||||
| ^^^^^^^^^^^^^^ S108
|
||||
9 | f.write("def")
|
||||
|
|
||||
|
||||
S108.py:11:11: S108 Probable insecure usage of temporary file or directory: "/dev/shm/unit/test"
|
||||
|
|
||||
11 | f.write("def")
|
||||
12 |
|
||||
13 | with open("/dev/shm/unit/test", "w") as f:
|
||||
9 | f.write("def")
|
||||
10 |
|
||||
11 | with open("/dev/shm/unit/test", "w") as f:
|
||||
| ^^^^^^^^^^^^^^^^^^^^ S108
|
||||
14 | f.write("def")
|
||||
12 | f.write("def")
|
||||
|
|
||||
|
||||
|
||||
|
|
|
@ -3,37 +3,37 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
|
|||
---
|
||||
S108.py:5:11: S108 Probable insecure usage of temporary file or directory: "/tmp/abc"
|
||||
|
|
||||
5 | f.write("def")
|
||||
6 |
|
||||
7 | with open("/tmp/abc", "w") as f:
|
||||
3 | f.write("def")
|
||||
4 |
|
||||
5 | with open("/tmp/abc", "w") as f:
|
||||
| ^^^^^^^^^^ S108
|
||||
8 | f.write("def")
|
||||
6 | f.write("def")
|
||||
|
|
||||
|
||||
S108.py:8:11: S108 Probable insecure usage of temporary file or directory: "/var/tmp/123"
|
||||
|
|
||||
8 | f.write("def")
|
||||
9 |
|
||||
10 | with open("/var/tmp/123", "w") as f:
|
||||
| ^^^^^^^^^^^^^^ S108
|
||||
11 | f.write("def")
|
||||
|
|
||||
|
|
||||
6 | f.write("def")
|
||||
7 |
|
||||
8 | with open("/var/tmp/123", "w") as f:
|
||||
| ^^^^^^^^^^^^^^ S108
|
||||
9 | f.write("def")
|
||||
|
|
||||
|
||||
S108.py:11:11: S108 Probable insecure usage of temporary file or directory: "/dev/shm/unit/test"
|
||||
|
|
||||
11 | f.write("def")
|
||||
12 |
|
||||
13 | with open("/dev/shm/unit/test", "w") as f:
|
||||
9 | f.write("def")
|
||||
10 |
|
||||
11 | with open("/dev/shm/unit/test", "w") as f:
|
||||
| ^^^^^^^^^^^^^^^^^^^^ S108
|
||||
14 | f.write("def")
|
||||
12 | f.write("def")
|
||||
|
|
||||
|
||||
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:
|
||||
14 | # not ok by config
|
||||
15 | with open("/foo/bar", "w") as f:
|
||||
| ^^^^^^^^^^ S108
|
||||
17 | f.write("def")
|
||||
16 | f.write("def")
|
||||
|
|
||||
|
||||
|
||||
|
|
|
@ -3,24 +3,24 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
|
|||
---
|
||||
S110.py:3:1: S110 `try`-`except`-`pass` detected, consider logging the exception
|
||||
|
|
||||
3 | try:
|
||||
4 | pass
|
||||
5 | / except Exception:
|
||||
6 | | pass
|
||||
1 | try:
|
||||
2 | pass
|
||||
3 | / except Exception:
|
||||
4 | | pass
|
||||
| |________^ S110
|
||||
7 |
|
||||
8 | try:
|
||||
5 |
|
||||
6 | try:
|
||||
|
|
||||
|
||||
S110.py:8:1: S110 `try`-`except`-`pass` detected, consider logging the exception
|
||||
|
|
||||
8 | try:
|
||||
9 | pass
|
||||
10 | / except:
|
||||
11 | | pass
|
||||
6 | try:
|
||||
7 | pass
|
||||
8 | / except:
|
||||
9 | | pass
|
||||
| |________^ S110
|
||||
12 |
|
||||
13 | try:
|
||||
10 |
|
||||
11 | try:
|
||||
|
|
||||
|
||||
|
||||
|
|
|
@ -3,32 +3,32 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
|
|||
---
|
||||
S110.py:3:1: S110 `try`-`except`-`pass` detected, consider logging the exception
|
||||
|
|
||||
3 | try:
|
||||
4 | pass
|
||||
5 | / except Exception:
|
||||
6 | | pass
|
||||
1 | try:
|
||||
2 | pass
|
||||
3 | / except Exception:
|
||||
4 | | pass
|
||||
| |________^ S110
|
||||
7 |
|
||||
8 | try:
|
||||
5 |
|
||||
6 | try:
|
||||
|
|
||||
|
||||
S110.py:8:1: S110 `try`-`except`-`pass` detected, consider logging the exception
|
||||
|
|
||||
8 | try:
|
||||
9 | pass
|
||||
10 | / except:
|
||||
11 | | pass
|
||||
6 | try:
|
||||
7 | pass
|
||||
8 | / except:
|
||||
9 | | pass
|
||||
| |________^ S110
|
||||
12 |
|
||||
13 | try:
|
||||
10 |
|
||||
11 | try:
|
||||
|
|
||||
|
||||
S110.py:13:1: S110 `try`-`except`-`pass` detected, consider logging the exception
|
||||
|
|
||||
13 | try:
|
||||
14 | pass
|
||||
15 | / except ValueError:
|
||||
16 | | pass
|
||||
11 | try:
|
||||
12 | pass
|
||||
13 | / except ValueError:
|
||||
14 | | pass
|
||||
| |________^ S110
|
||||
|
|
||||
|
||||
|
|
|
@ -3,46 +3,46 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
|
|||
---
|
||||
S112.py:3:1: S112 `try`-`except`-`continue` detected, consider logging the exception
|
||||
|
|
||||
3 | try:
|
||||
4 | pass
|
||||
5 | / except Exception:
|
||||
6 | | continue
|
||||
1 | try:
|
||||
2 | pass
|
||||
3 | / except Exception:
|
||||
4 | | continue
|
||||
| |____________^ S112
|
||||
7 |
|
||||
8 | try:
|
||||
5 |
|
||||
6 | try:
|
||||
|
|
||||
|
||||
S112.py:8:1: S112 `try`-`except`-`continue` detected, consider logging the exception
|
||||
|
|
||||
8 | try:
|
||||
9 | pass
|
||||
10 | / except:
|
||||
11 | | continue
|
||||
6 | try:
|
||||
7 | pass
|
||||
8 | / except:
|
||||
9 | | continue
|
||||
| |____________^ S112
|
||||
12 |
|
||||
13 | try:
|
||||
10 |
|
||||
11 | try:
|
||||
|
|
||||
|
||||
S112.py:13:1: S112 `try`-`except`-`continue` detected, consider logging the exception
|
||||
|
|
||||
13 | try:
|
||||
14 | pass
|
||||
15 | / except (Exception,):
|
||||
16 | | continue
|
||||
11 | try:
|
||||
12 | pass
|
||||
13 | / except (Exception,):
|
||||
14 | | continue
|
||||
| |____________^ S112
|
||||
17 |
|
||||
18 | try:
|
||||
15 |
|
||||
16 | try:
|
||||
|
|
||||
|
||||
S112.py:18:1: S112 `try`-`except`-`continue` detected, consider logging the exception
|
||||
|
|
||||
18 | try:
|
||||
19 | pass
|
||||
20 | / except (Exception, ValueError):
|
||||
21 | | continue
|
||||
16 | try:
|
||||
17 | pass
|
||||
18 | / except (Exception, ValueError):
|
||||
19 | | continue
|
||||
| |____________^ S112
|
||||
22 |
|
||||
23 | try:
|
||||
20 |
|
||||
21 | try:
|
||||
|
|
||||
|
||||
|
||||
|
|
|
@ -3,140 +3,140 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
|
|||
---
|
||||
S113.py:3:1: S113 Probable use of requests call without timeout
|
||||
|
|
||||
3 | import requests
|
||||
4 |
|
||||
5 | requests.get('https://gmail.com')
|
||||
1 | import requests
|
||||
2 |
|
||||
3 | requests.get('https://gmail.com')
|
||||
| ^^^^^^^^^^^^ S113
|
||||
6 | requests.get('https://gmail.com', timeout=None)
|
||||
7 | requests.get('https://gmail.com', timeout=5)
|
||||
4 | requests.get('https://gmail.com', timeout=None)
|
||||
5 | requests.get('https://gmail.com', timeout=5)
|
||||
|
|
||||
|
||||
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)
|
||||
3 | requests.get('https://gmail.com')
|
||||
4 | requests.get('https://gmail.com', timeout=None)
|
||||
| ^^^^ S113
|
||||
6 | requests.get('https://gmail.com', timeout=5)
|
||||
7 | requests.post('https://gmail.com')
|
||||
5 | requests.get('https://gmail.com', timeout=5)
|
||||
6 | requests.post('https://gmail.com')
|
||||
|
|
||||
|
||||
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)
|
||||
8 | requests.post('https://gmail.com')
|
||||
| ^^^^^^^^^^^^^ S113
|
||||
9 | requests.post('https://gmail.com', timeout=None)
|
||||
10 | requests.post('https://gmail.com', timeout=5)
|
||||
|
|
||||
|
|
||||
4 | requests.get('https://gmail.com', timeout=None)
|
||||
5 | requests.get('https://gmail.com', timeout=5)
|
||||
6 | requests.post('https://gmail.com')
|
||||
| ^^^^^^^^^^^^^ S113
|
||||
7 | requests.post('https://gmail.com', timeout=None)
|
||||
8 | requests.post('https://gmail.com', timeout=5)
|
||||
|
|
||||
|
||||
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')
|
||||
9 | requests.post('https://gmail.com', timeout=None)
|
||||
| ^^^^ S113
|
||||
10 | requests.post('https://gmail.com', timeout=5)
|
||||
11 | requests.put('https://gmail.com')
|
||||
|
|
||||
|
|
||||
5 | requests.get('https://gmail.com', timeout=5)
|
||||
6 | requests.post('https://gmail.com')
|
||||
7 | requests.post('https://gmail.com', timeout=None)
|
||||
| ^^^^ S113
|
||||
8 | requests.post('https://gmail.com', timeout=5)
|
||||
9 | requests.put('https://gmail.com')
|
||||
|
|
||||
|
||||
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)
|
||||
11 | requests.put('https://gmail.com')
|
||||
7 | requests.post('https://gmail.com', timeout=None)
|
||||
8 | requests.post('https://gmail.com', timeout=5)
|
||||
9 | requests.put('https://gmail.com')
|
||||
| ^^^^^^^^^^^^ S113
|
||||
12 | requests.put('https://gmail.com', timeout=None)
|
||||
13 | requests.put('https://gmail.com', timeout=5)
|
||||
10 | requests.put('https://gmail.com', timeout=None)
|
||||
11 | requests.put('https://gmail.com', timeout=5)
|
||||
|
|
||||
|
||||
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')
|
||||
12 | requests.put('https://gmail.com', timeout=None)
|
||||
8 | requests.post('https://gmail.com', timeout=5)
|
||||
9 | requests.put('https://gmail.com')
|
||||
10 | requests.put('https://gmail.com', timeout=None)
|
||||
| ^^^^ S113
|
||||
13 | requests.put('https://gmail.com', timeout=5)
|
||||
14 | requests.delete('https://gmail.com')
|
||||
11 | requests.put('https://gmail.com', timeout=5)
|
||||
12 | requests.delete('https://gmail.com')
|
||||
|
|
||||
|
||||
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)
|
||||
14 | requests.delete('https://gmail.com')
|
||||
10 | requests.put('https://gmail.com', timeout=None)
|
||||
11 | requests.put('https://gmail.com', timeout=5)
|
||||
12 | requests.delete('https://gmail.com')
|
||||
| ^^^^^^^^^^^^^^^ S113
|
||||
15 | requests.delete('https://gmail.com', timeout=None)
|
||||
16 | requests.delete('https://gmail.com', timeout=5)
|
||||
13 | requests.delete('https://gmail.com', timeout=None)
|
||||
14 | requests.delete('https://gmail.com', timeout=5)
|
||||
|
|
||||
|
||||
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')
|
||||
15 | requests.delete('https://gmail.com', timeout=None)
|
||||
11 | requests.put('https://gmail.com', timeout=5)
|
||||
12 | requests.delete('https://gmail.com')
|
||||
13 | requests.delete('https://gmail.com', timeout=None)
|
||||
| ^^^^ S113
|
||||
16 | requests.delete('https://gmail.com', timeout=5)
|
||||
17 | requests.patch('https://gmail.com')
|
||||
14 | requests.delete('https://gmail.com', timeout=5)
|
||||
15 | requests.patch('https://gmail.com')
|
||||
|
|
||||
|
||||
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)
|
||||
17 | requests.patch('https://gmail.com')
|
||||
13 | requests.delete('https://gmail.com', timeout=None)
|
||||
14 | requests.delete('https://gmail.com', timeout=5)
|
||||
15 | requests.patch('https://gmail.com')
|
||||
| ^^^^^^^^^^^^^^ S113
|
||||
18 | requests.patch('https://gmail.com', timeout=None)
|
||||
19 | requests.patch('https://gmail.com', timeout=5)
|
||||
16 | requests.patch('https://gmail.com', timeout=None)
|
||||
17 | requests.patch('https://gmail.com', timeout=5)
|
||||
|
|
||||
|
||||
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')
|
||||
18 | requests.patch('https://gmail.com', timeout=None)
|
||||
14 | requests.delete('https://gmail.com', timeout=5)
|
||||
15 | requests.patch('https://gmail.com')
|
||||
16 | requests.patch('https://gmail.com', timeout=None)
|
||||
| ^^^^ S113
|
||||
19 | requests.patch('https://gmail.com', timeout=5)
|
||||
20 | requests.options('https://gmail.com')
|
||||
17 | requests.patch('https://gmail.com', timeout=5)
|
||||
18 | requests.options('https://gmail.com')
|
||||
|
|
||||
|
||||
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)
|
||||
20 | requests.options('https://gmail.com')
|
||||
16 | requests.patch('https://gmail.com', timeout=None)
|
||||
17 | requests.patch('https://gmail.com', timeout=5)
|
||||
18 | requests.options('https://gmail.com')
|
||||
| ^^^^^^^^^^^^^^^^ S113
|
||||
21 | requests.options('https://gmail.com', timeout=None)
|
||||
22 | requests.options('https://gmail.com', timeout=5)
|
||||
19 | requests.options('https://gmail.com', timeout=None)
|
||||
20 | requests.options('https://gmail.com', timeout=5)
|
||||
|
|
||||
|
||||
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')
|
||||
21 | requests.options('https://gmail.com', timeout=None)
|
||||
17 | requests.patch('https://gmail.com', timeout=5)
|
||||
18 | requests.options('https://gmail.com')
|
||||
19 | requests.options('https://gmail.com', timeout=None)
|
||||
| ^^^^ S113
|
||||
22 | requests.options('https://gmail.com', timeout=5)
|
||||
23 | requests.head('https://gmail.com')
|
||||
20 | requests.options('https://gmail.com', timeout=5)
|
||||
21 | requests.head('https://gmail.com')
|
||||
|
|
||||
|
||||
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)
|
||||
23 | requests.head('https://gmail.com')
|
||||
19 | requests.options('https://gmail.com', timeout=None)
|
||||
20 | requests.options('https://gmail.com', timeout=5)
|
||||
21 | requests.head('https://gmail.com')
|
||||
| ^^^^^^^^^^^^^ S113
|
||||
24 | requests.head('https://gmail.com', timeout=None)
|
||||
25 | requests.head('https://gmail.com', timeout=5)
|
||||
22 | requests.head('https://gmail.com', timeout=None)
|
||||
23 | requests.head('https://gmail.com', timeout=5)
|
||||
|
|
||||
|
||||
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')
|
||||
24 | requests.head('https://gmail.com', timeout=None)
|
||||
20 | requests.options('https://gmail.com', timeout=5)
|
||||
21 | requests.head('https://gmail.com')
|
||||
22 | requests.head('https://gmail.com', timeout=None)
|
||||
| ^^^^ S113
|
||||
25 | requests.head('https://gmail.com', timeout=5)
|
||||
23 | requests.head('https://gmail.com', timeout=5)
|
||||
|
|
||||
|
||||
|
||||
|
|
|
@ -3,9 +3,9 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
|
|||
---
|
||||
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 |
|
||||
5 | pickle.loads()
|
||||
1 | import pickle
|
||||
2 |
|
||||
3 | pickle.loads()
|
||||
| ^^^^^^^^^^^^^^ S301
|
||||
|
|
||||
|
||||
|
|
|
@ -3,9 +3,9 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
|
|||
---
|
||||
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 |
|
||||
5 | Telnet("localhost", 23)
|
||||
1 | from telnetlib import Telnet
|
||||
2 |
|
||||
3 | Telnet("localhost", 23)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ S312
|
||||
|
|
||||
|
||||
|
|
|
@ -2,132 +2,132 @@
|
|||
source: crates/ruff/src/rules/flake8_bandit/mod.rs
|
||||
---
|
||||
S324.py:7:13: S324 Probable use of insecure hash functions in `hashlib`: `md5`
|
||||
|
|
||||
7 | # Invalid
|
||||
8 |
|
||||
9 | hashlib.new('md5')
|
||||
| ^^^^^ S324
|
||||
10 |
|
||||
11 | hashlib.new('md4', b'test')
|
||||
|
|
||||
|
|
||||
5 | # Invalid
|
||||
6 |
|
||||
7 | hashlib.new('md5')
|
||||
| ^^^^^ S324
|
||||
8 |
|
||||
9 | hashlib.new('md4', b'test')
|
||||
|
|
||||
|
||||
S324.py:9:13: S324 Probable use of insecure hash functions in `hashlib`: `md4`
|
||||
|
|
||||
9 | hashlib.new('md5')
|
||||
10 |
|
||||
11 | hashlib.new('md4', b'test')
|
||||
7 | hashlib.new('md5')
|
||||
8 |
|
||||
9 | hashlib.new('md4', b'test')
|
||||
| ^^^^^ S324
|
||||
12 |
|
||||
13 | hashlib.new(name='md5', data=b'test')
|
||||
10 |
|
||||
11 | hashlib.new(name='md5', data=b'test')
|
||||
|
|
||||
|
||||
S324.py:11:18: S324 Probable use of insecure hash functions in `hashlib`: `md5`
|
||||
|
|
||||
11 | hashlib.new('md4', b'test')
|
||||
12 |
|
||||
13 | hashlib.new(name='md5', data=b'test')
|
||||
9 | hashlib.new('md4', b'test')
|
||||
10 |
|
||||
11 | hashlib.new(name='md5', data=b'test')
|
||||
| ^^^^^ S324
|
||||
14 |
|
||||
15 | hashlib.new('MD4', data=b'test')
|
||||
12 |
|
||||
13 | hashlib.new('MD4', data=b'test')
|
||||
|
|
||||
|
||||
S324.py:13:13: S324 Probable use of insecure hash functions in `hashlib`: `MD4`
|
||||
|
|
||||
13 | hashlib.new(name='md5', data=b'test')
|
||||
14 |
|
||||
15 | hashlib.new('MD4', data=b'test')
|
||||
11 | hashlib.new(name='md5', data=b'test')
|
||||
12 |
|
||||
13 | hashlib.new('MD4', data=b'test')
|
||||
| ^^^^^ S324
|
||||
16 |
|
||||
17 | hashlib.new('sha1')
|
||||
14 |
|
||||
15 | hashlib.new('sha1')
|
||||
|
|
||||
|
||||
S324.py:15:13: S324 Probable use of insecure hash functions in `hashlib`: `sha1`
|
||||
|
|
||||
15 | hashlib.new('MD4', data=b'test')
|
||||
16 |
|
||||
17 | hashlib.new('sha1')
|
||||
13 | hashlib.new('MD4', data=b'test')
|
||||
14 |
|
||||
15 | hashlib.new('sha1')
|
||||
| ^^^^^^ S324
|
||||
18 |
|
||||
19 | hashlib.new('sha1', data=b'test')
|
||||
16 |
|
||||
17 | hashlib.new('sha1', data=b'test')
|
||||
|
|
||||
|
||||
S324.py:17:13: S324 Probable use of insecure hash functions in `hashlib`: `sha1`
|
||||
|
|
||||
17 | hashlib.new('sha1')
|
||||
18 |
|
||||
19 | hashlib.new('sha1', data=b'test')
|
||||
15 | hashlib.new('sha1')
|
||||
16 |
|
||||
17 | hashlib.new('sha1', data=b'test')
|
||||
| ^^^^^^ S324
|
||||
20 |
|
||||
21 | hashlib.new('sha', data=b'test')
|
||||
18 |
|
||||
19 | hashlib.new('sha', data=b'test')
|
||||
|
|
||||
|
||||
S324.py:19:13: S324 Probable use of insecure hash functions in `hashlib`: `sha`
|
||||
|
|
||||
19 | hashlib.new('sha1', data=b'test')
|
||||
20 |
|
||||
21 | hashlib.new('sha', data=b'test')
|
||||
17 | hashlib.new('sha1', data=b'test')
|
||||
18 |
|
||||
19 | hashlib.new('sha', data=b'test')
|
||||
| ^^^^^ S324
|
||||
22 |
|
||||
23 | hashlib.new(name='SHA', data=b'test')
|
||||
20 |
|
||||
21 | hashlib.new(name='SHA', data=b'test')
|
||||
|
|
||||
|
||||
S324.py:21:18: S324 Probable use of insecure hash functions in `hashlib`: `SHA`
|
||||
|
|
||||
21 | hashlib.new('sha', data=b'test')
|
||||
22 |
|
||||
23 | hashlib.new(name='SHA', data=b'test')
|
||||
19 | hashlib.new('sha', data=b'test')
|
||||
20 |
|
||||
21 | hashlib.new(name='SHA', data=b'test')
|
||||
| ^^^^^ S324
|
||||
24 |
|
||||
25 | hashlib.sha(data=b'test')
|
||||
22 |
|
||||
23 | hashlib.sha(data=b'test')
|
||||
|
|
||||
|
||||
S324.py:23:1: S324 Probable use of insecure hash functions in `hashlib`: `sha`
|
||||
|
|
||||
23 | hashlib.new(name='SHA', data=b'test')
|
||||
24 |
|
||||
25 | hashlib.sha(data=b'test')
|
||||
21 | hashlib.new(name='SHA', data=b'test')
|
||||
22 |
|
||||
23 | hashlib.sha(data=b'test')
|
||||
| ^^^^^^^^^^^ S324
|
||||
26 |
|
||||
27 | hashlib.md5()
|
||||
24 |
|
||||
25 | hashlib.md5()
|
||||
|
|
||||
|
||||
S324.py:25:1: S324 Probable use of insecure hash functions in `hashlib`: `md5`
|
||||
|
|
||||
25 | hashlib.sha(data=b'test')
|
||||
26 |
|
||||
27 | hashlib.md5()
|
||||
23 | hashlib.sha(data=b'test')
|
||||
24 |
|
||||
25 | hashlib.md5()
|
||||
| ^^^^^^^^^^^ S324
|
||||
28 |
|
||||
29 | hashlib_new('sha1')
|
||||
26 |
|
||||
27 | hashlib_new('sha1')
|
||||
|
|
||||
|
||||
S324.py:27:13: S324 Probable use of insecure hash functions in `hashlib`: `sha1`
|
||||
|
|
||||
27 | hashlib.md5()
|
||||
28 |
|
||||
29 | hashlib_new('sha1')
|
||||
25 | hashlib.md5()
|
||||
26 |
|
||||
27 | hashlib_new('sha1')
|
||||
| ^^^^^^ S324
|
||||
30 |
|
||||
31 | hashlib_sha1('sha1')
|
||||
28 |
|
||||
29 | hashlib_sha1('sha1')
|
||||
|
|
||||
|
||||
S324.py:29:1: S324 Probable use of insecure hash functions in `hashlib`: `sha1`
|
||||
|
|
||||
29 | hashlib_new('sha1')
|
||||
30 |
|
||||
31 | hashlib_sha1('sha1')
|
||||
27 | hashlib_new('sha1')
|
||||
28 |
|
||||
29 | hashlib_sha1('sha1')
|
||||
| ^^^^^^^^^^^^ S324
|
||||
32 |
|
||||
33 | # usedforsecurity arg only available in Python 3.9+
|
||||
30 |
|
||||
31 | # usedforsecurity arg only available in Python 3.9+
|
||||
|
|
||||
|
||||
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)
|
||||
31 | # usedforsecurity arg only available in Python 3.9+
|
||||
32 | hashlib.new('sha1', usedforsecurity=True)
|
||||
| ^^^^^^ S324
|
||||
34 |
|
||||
35 | # Valid
|
||||
33 |
|
||||
34 | # Valid
|
||||
|
|
||||
|
||||
|
||||
|
|
|
@ -3,177 +3,177 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
|
|||
---
|
||||
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)
|
||||
4 | requests.get('https://gmail.com', timeout=30, verify=True)
|
||||
5 | requests.get('https://gmail.com', timeout=30, verify=False)
|
||||
| ^^^^^ S501
|
||||
7 | requests.post('https://gmail.com', timeout=30, verify=True)
|
||||
8 | requests.post('https://gmail.com', timeout=30, verify=False)
|
||||
6 | requests.post('https://gmail.com', timeout=30, verify=True)
|
||||
7 | requests.post('https://gmail.com', timeout=30, verify=False)
|
||||
|
|
||||
|
||||
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)
|
||||
9 | requests.post('https://gmail.com', timeout=30, verify=False)
|
||||
| ^^^^^ S501
|
||||
10 | requests.put('https://gmail.com', timeout=30, verify=True)
|
||||
11 | requests.put('https://gmail.com', timeout=30, verify=False)
|
||||
|
|
||||
|
|
||||
5 | requests.get('https://gmail.com', timeout=30, verify=False)
|
||||
6 | requests.post('https://gmail.com', timeout=30, verify=True)
|
||||
7 | requests.post('https://gmail.com', timeout=30, verify=False)
|
||||
| ^^^^^ S501
|
||||
8 | requests.put('https://gmail.com', timeout=30, verify=True)
|
||||
9 | requests.put('https://gmail.com', timeout=30, verify=False)
|
||||
|
|
||||
|
||||
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)
|
||||
11 | requests.put('https://gmail.com', timeout=30, verify=False)
|
||||
7 | requests.post('https://gmail.com', timeout=30, verify=False)
|
||||
8 | requests.put('https://gmail.com', timeout=30, verify=True)
|
||||
9 | requests.put('https://gmail.com', timeout=30, verify=False)
|
||||
| ^^^^^ S501
|
||||
12 | requests.delete('https://gmail.com', timeout=30, verify=True)
|
||||
13 | requests.delete('https://gmail.com', timeout=30, verify=False)
|
||||
10 | requests.delete('https://gmail.com', timeout=30, verify=True)
|
||||
11 | requests.delete('https://gmail.com', timeout=30, verify=False)
|
||||
|
|
||||
|
||||
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)
|
||||
13 | requests.delete('https://gmail.com', timeout=30, verify=False)
|
||||
9 | requests.put('https://gmail.com', timeout=30, verify=False)
|
||||
10 | requests.delete('https://gmail.com', timeout=30, verify=True)
|
||||
11 | requests.delete('https://gmail.com', timeout=30, verify=False)
|
||||
| ^^^^^ S501
|
||||
14 | requests.patch('https://gmail.com', timeout=30, verify=True)
|
||||
15 | requests.patch('https://gmail.com', timeout=30, verify=False)
|
||||
12 | requests.patch('https://gmail.com', timeout=30, verify=True)
|
||||
13 | requests.patch('https://gmail.com', timeout=30, verify=False)
|
||||
|
|
||||
|
||||
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)
|
||||
15 | requests.patch('https://gmail.com', timeout=30, verify=False)
|
||||
11 | requests.delete('https://gmail.com', timeout=30, verify=False)
|
||||
12 | requests.patch('https://gmail.com', timeout=30, verify=True)
|
||||
13 | requests.patch('https://gmail.com', timeout=30, verify=False)
|
||||
| ^^^^^ S501
|
||||
16 | requests.options('https://gmail.com', timeout=30, verify=True)
|
||||
17 | requests.options('https://gmail.com', timeout=30, verify=False)
|
||||
14 | requests.options('https://gmail.com', timeout=30, verify=True)
|
||||
15 | requests.options('https://gmail.com', timeout=30, verify=False)
|
||||
|
|
||||
|
||||
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)
|
||||
17 | requests.options('https://gmail.com', timeout=30, verify=False)
|
||||
13 | requests.patch('https://gmail.com', timeout=30, verify=False)
|
||||
14 | requests.options('https://gmail.com', timeout=30, verify=True)
|
||||
15 | requests.options('https://gmail.com', timeout=30, verify=False)
|
||||
| ^^^^^ S501
|
||||
18 | requests.head('https://gmail.com', timeout=30, verify=True)
|
||||
19 | requests.head('https://gmail.com', timeout=30, verify=False)
|
||||
16 | requests.head('https://gmail.com', timeout=30, verify=True)
|
||||
17 | requests.head('https://gmail.com', timeout=30, verify=False)
|
||||
|
|
||||
|
||||
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)
|
||||
19 | requests.head('https://gmail.com', timeout=30, verify=False)
|
||||
15 | requests.options('https://gmail.com', timeout=30, verify=False)
|
||||
16 | requests.head('https://gmail.com', timeout=30, verify=True)
|
||||
17 | requests.head('https://gmail.com', timeout=30, verify=False)
|
||||
| ^^^^^ S501
|
||||
20 |
|
||||
21 | httpx.request('GET', 'https://gmail.com', verify=True)
|
||||
18 |
|
||||
19 | httpx.request('GET', 'https://gmail.com', verify=True)
|
||||
|
|
||||
|
||||
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)
|
||||
19 | httpx.request('GET', 'https://gmail.com', verify=True)
|
||||
20 | httpx.request('GET', 'https://gmail.com', verify=False)
|
||||
| ^^^^^ S501
|
||||
22 | httpx.get('https://gmail.com', verify=True)
|
||||
23 | httpx.get('https://gmail.com', verify=False)
|
||||
21 | httpx.get('https://gmail.com', verify=True)
|
||||
22 | httpx.get('https://gmail.com', verify=False)
|
||||
|
|
||||
|
||||
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)
|
||||
24 | httpx.get('https://gmail.com', verify=False)
|
||||
20 | httpx.request('GET', 'https://gmail.com', verify=False)
|
||||
21 | httpx.get('https://gmail.com', verify=True)
|
||||
22 | httpx.get('https://gmail.com', verify=False)
|
||||
| ^^^^^ S501
|
||||
25 | httpx.options('https://gmail.com', verify=True)
|
||||
26 | httpx.options('https://gmail.com', verify=False)
|
||||
23 | httpx.options('https://gmail.com', verify=True)
|
||||
24 | httpx.options('https://gmail.com', verify=False)
|
||||
|
|
||||
|
||||
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)
|
||||
26 | httpx.options('https://gmail.com', verify=False)
|
||||
22 | httpx.get('https://gmail.com', verify=False)
|
||||
23 | httpx.options('https://gmail.com', verify=True)
|
||||
24 | httpx.options('https://gmail.com', verify=False)
|
||||
| ^^^^^ S501
|
||||
27 | httpx.head('https://gmail.com', verify=True)
|
||||
28 | httpx.head('https://gmail.com', verify=False)
|
||||
25 | httpx.head('https://gmail.com', verify=True)
|
||||
26 | httpx.head('https://gmail.com', verify=False)
|
||||
|
|
||||
|
||||
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)
|
||||
28 | httpx.head('https://gmail.com', verify=False)
|
||||
24 | httpx.options('https://gmail.com', verify=False)
|
||||
25 | httpx.head('https://gmail.com', verify=True)
|
||||
26 | httpx.head('https://gmail.com', verify=False)
|
||||
| ^^^^^ S501
|
||||
29 | httpx.post('https://gmail.com', verify=True)
|
||||
30 | httpx.post('https://gmail.com', verify=False)
|
||||
27 | httpx.post('https://gmail.com', verify=True)
|
||||
28 | httpx.post('https://gmail.com', verify=False)
|
||||
|
|
||||
|
||||
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)
|
||||
30 | httpx.post('https://gmail.com', verify=False)
|
||||
26 | httpx.head('https://gmail.com', verify=False)
|
||||
27 | httpx.post('https://gmail.com', verify=True)
|
||||
28 | httpx.post('https://gmail.com', verify=False)
|
||||
| ^^^^^ S501
|
||||
31 | httpx.put('https://gmail.com', verify=True)
|
||||
32 | httpx.put('https://gmail.com', verify=False)
|
||||
29 | httpx.put('https://gmail.com', verify=True)
|
||||
30 | httpx.put('https://gmail.com', verify=False)
|
||||
|
|
||||
|
||||
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)
|
||||
32 | httpx.put('https://gmail.com', verify=False)
|
||||
28 | httpx.post('https://gmail.com', verify=False)
|
||||
29 | httpx.put('https://gmail.com', verify=True)
|
||||
30 | httpx.put('https://gmail.com', verify=False)
|
||||
| ^^^^^ S501
|
||||
33 | httpx.patch('https://gmail.com', verify=True)
|
||||
34 | httpx.patch('https://gmail.com', verify=False)
|
||||
31 | httpx.patch('https://gmail.com', verify=True)
|
||||
32 | httpx.patch('https://gmail.com', verify=False)
|
||||
|
|
||||
|
||||
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)
|
||||
34 | httpx.patch('https://gmail.com', verify=False)
|
||||
30 | httpx.put('https://gmail.com', verify=False)
|
||||
31 | httpx.patch('https://gmail.com', verify=True)
|
||||
32 | httpx.patch('https://gmail.com', verify=False)
|
||||
| ^^^^^ S501
|
||||
35 | httpx.delete('https://gmail.com', verify=True)
|
||||
36 | httpx.delete('https://gmail.com', verify=False)
|
||||
33 | httpx.delete('https://gmail.com', verify=True)
|
||||
34 | httpx.delete('https://gmail.com', verify=False)
|
||||
|
|
||||
|
||||
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)
|
||||
36 | httpx.delete('https://gmail.com', verify=False)
|
||||
32 | httpx.patch('https://gmail.com', verify=False)
|
||||
33 | httpx.delete('https://gmail.com', verify=True)
|
||||
34 | httpx.delete('https://gmail.com', verify=False)
|
||||
| ^^^^^ S501
|
||||
37 | httpx.stream('https://gmail.com', verify=True)
|
||||
38 | httpx.stream('https://gmail.com', verify=False)
|
||||
35 | httpx.stream('https://gmail.com', verify=True)
|
||||
36 | httpx.stream('https://gmail.com', verify=False)
|
||||
|
|
||||
|
||||
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)
|
||||
38 | httpx.stream('https://gmail.com', verify=False)
|
||||
34 | httpx.delete('https://gmail.com', verify=False)
|
||||
35 | httpx.stream('https://gmail.com', verify=True)
|
||||
36 | httpx.stream('https://gmail.com', verify=False)
|
||||
| ^^^^^ S501
|
||||
39 | httpx.Client()
|
||||
40 | httpx.Client(verify=False)
|
||||
37 | httpx.Client()
|
||||
38 | httpx.Client(verify=False)
|
||||
|
|
||||
|
||||
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()
|
||||
40 | httpx.Client(verify=False)
|
||||
36 | httpx.stream('https://gmail.com', verify=False)
|
||||
37 | httpx.Client()
|
||||
38 | httpx.Client(verify=False)
|
||||
| ^^^^^ S501
|
||||
41 | httpx.AsyncClient()
|
||||
42 | httpx.AsyncClient(verify=False)
|
||||
39 | httpx.AsyncClient()
|
||||
40 | httpx.AsyncClient(verify=False)
|
||||
|
|
||||
|
||||
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()
|
||||
42 | httpx.AsyncClient(verify=False)
|
||||
38 | httpx.Client(verify=False)
|
||||
39 | httpx.AsyncClient()
|
||||
40 | httpx.AsyncClient(verify=False)
|
||||
| ^^^^^ S501
|
||||
|
|
||||
|
||||
|
|
|
@ -3,12 +3,12 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
|
|||
---
|
||||
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})
|
||||
12 | y = yaml.load(ystr)
|
||||
8 | def test_yaml_load():
|
||||
9 | ystr = yaml.dump({"a": 1, "b": 2, "c": 3})
|
||||
10 | y = yaml.load(ystr)
|
||||
| ^^^^^^^^^ S506
|
||||
13 | yaml.dump(y)
|
||||
14 | try:
|
||||
11 | yaml.dump(y)
|
||||
12 | try:
|
||||
|
|
||||
|
||||
S506.py:24:24: S506 Probable use of unsafe loader `Loader` with `yaml.load`. Allows instantiation of arbitrary objects. Consider `yaml.safe_load`.
|
||||
|
|
|
@ -3,20 +3,20 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
|
|||
---
|
||||
S508.py:3:33: S508 The use of SNMPv1 and SNMPv2 is insecure. Use SNMPv3 if able.
|
||||
|
|
||||
3 | from pysnmp.hlapi import CommunityData
|
||||
4 |
|
||||
5 | CommunityData("public", mpModel=0) # S508
|
||||
1 | from pysnmp.hlapi import CommunityData
|
||||
2 |
|
||||
3 | CommunityData("public", mpModel=0) # S508
|
||||
| ^ S508
|
||||
6 | CommunityData("public", mpModel=1) # S508
|
||||
4 | CommunityData("public", mpModel=1) # S508
|
||||
|
|
||||
|
||||
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
|
||||
3 | CommunityData("public", mpModel=0) # S508
|
||||
4 | CommunityData("public", mpModel=1) # S508
|
||||
| ^ S508
|
||||
6 |
|
||||
7 | CommunityData("public", mpModel=2) # OK
|
||||
5 |
|
||||
6 | CommunityData("public", mpModel=2) # OK
|
||||
|
|
||||
|
||||
|
||||
|
|
|
@ -10,11 +10,11 @@ S509.py:4:12: S509 You should not use SNMPv3 without encryption. `noAuthNoPriv`
|
|||
|
||||
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
|
||||
4 | insecure = UsmUserData("securityName") # S509
|
||||
5 | auth_no_priv = UsmUserData("securityName", "authName") # S509
|
||||
| ^^^^^^^^^^^ S509
|
||||
7 |
|
||||
8 | less_insecure = UsmUserData("securityName", "authName", "privName") # OK
|
||||
6 |
|
||||
7 | less_insecure = UsmUserData("securityName", "authName", "privName") # OK
|
||||
|
|
||||
|
||||
|
||||
|
|
|
@ -3,9 +3,9 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
|
|||
---
|
||||
S601.py:3:1: S601 Possible shell injection via Paramiko call; check inputs are properly sanitized
|
||||
|
|
||||
3 | import paramiko
|
||||
4 |
|
||||
5 | paramiko.exec_command('something; really; unsafe')
|
||||
1 | import paramiko
|
||||
2 |
|
||||
3 | paramiko.exec_command('something; really; unsafe')
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ S601
|
||||
|
|
||||
|
||||
|
|
|
@ -3,114 +3,114 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
|
|||
---
|
||||
S602.py:4:15: S602 `subprocess` call with `shell=True` seems safe, but may be changed in the future; consider rewriting without `shell`
|
||||
|
|
||||
4 | # Check different Popen wrappers are checked.
|
||||
5 | Popen("true", shell=True)
|
||||
3 | # Check different Popen wrappers are checked.
|
||||
4 | Popen("true", shell=True)
|
||||
| ^^^^^^^^^^ S602
|
||||
6 | call("true", shell=True)
|
||||
7 | check_call("true", shell=True)
|
||||
5 | call("true", shell=True)
|
||||
6 | check_call("true", shell=True)
|
||||
|
|
||||
|
||||
S602.py:5:14: S602 `subprocess` call with `shell=True` seems safe, but may be changed in the future; consider rewriting without `shell`
|
||||
|
|
||||
5 | # Check different Popen wrappers are checked.
|
||||
6 | Popen("true", shell=True)
|
||||
7 | call("true", shell=True)
|
||||
3 | # Check different Popen wrappers are checked.
|
||||
4 | Popen("true", shell=True)
|
||||
5 | call("true", shell=True)
|
||||
| ^^^^^^^^^^ S602
|
||||
8 | check_call("true", shell=True)
|
||||
9 | check_output("true", shell=True)
|
||||
6 | check_call("true", shell=True)
|
||||
7 | check_output("true", shell=True)
|
||||
|
|
||||
|
||||
S602.py:6:20: S602 `subprocess` call with `shell=True` seems safe, but may be changed in the future; consider rewriting without `shell`
|
||||
|
|
||||
6 | Popen("true", shell=True)
|
||||
7 | call("true", shell=True)
|
||||
8 | check_call("true", shell=True)
|
||||
| ^^^^^^^^^^ S602
|
||||
9 | check_output("true", shell=True)
|
||||
10 | run("true", shell=True)
|
||||
|
|
||||
|
|
||||
4 | Popen("true", shell=True)
|
||||
5 | call("true", shell=True)
|
||||
6 | check_call("true", shell=True)
|
||||
| ^^^^^^^^^^ S602
|
||||
7 | check_output("true", shell=True)
|
||||
8 | run("true", shell=True)
|
||||
|
|
||||
|
||||
S602.py:7:22: S602 `subprocess` call with `shell=True` seems safe, but may be changed in the future; consider rewriting without `shell`
|
||||
|
|
||||
7 | call("true", shell=True)
|
||||
8 | check_call("true", shell=True)
|
||||
9 | check_output("true", shell=True)
|
||||
| ^^^^^^^^^^ S602
|
||||
10 | run("true", shell=True)
|
||||
|
|
||||
|
|
||||
5 | call("true", shell=True)
|
||||
6 | check_call("true", shell=True)
|
||||
7 | check_output("true", shell=True)
|
||||
| ^^^^^^^^^^ S602
|
||||
8 | run("true", shell=True)
|
||||
|
|
||||
|
||||
S602.py:8:13: S602 `subprocess` call with `shell=True` seems safe, but may be changed in the future; consider rewriting without `shell`
|
||||
|
|
||||
8 | check_call("true", shell=True)
|
||||
9 | check_output("true", shell=True)
|
||||
10 | run("true", shell=True)
|
||||
6 | check_call("true", shell=True)
|
||||
7 | check_output("true", shell=True)
|
||||
8 | run("true", shell=True)
|
||||
| ^^^^^^^^^^ S602
|
||||
11 |
|
||||
12 | # Check values that truthy values are treated as true.
|
||||
9 |
|
||||
10 | # Check values that truthy values are treated as true.
|
||||
|
|
||||
|
||||
S602.py:11:15: S602 `subprocess` call with `shell=True` seems safe, but may be changed in the future; consider rewriting without `shell`
|
||||
|
|
||||
11 | # Check values that truthy values are treated as true.
|
||||
12 | Popen("true", shell=1)
|
||||
10 | # Check values that truthy values are treated as true.
|
||||
11 | Popen("true", shell=1)
|
||||
| ^^^^^^^ S602
|
||||
13 | Popen("true", shell=[1])
|
||||
14 | Popen("true", shell={1: 1})
|
||||
12 | Popen("true", shell=[1])
|
||||
13 | Popen("true", shell={1: 1})
|
||||
|
|
||||
|
||||
S602.py:12:15: S602 `subprocess` call with `shell=True` seems safe, but may be changed in the future; consider rewriting without `shell`
|
||||
|
|
||||
12 | # Check values that truthy values are treated as true.
|
||||
13 | Popen("true", shell=1)
|
||||
14 | Popen("true", shell=[1])
|
||||
10 | # Check values that truthy values are treated as true.
|
||||
11 | Popen("true", shell=1)
|
||||
12 | Popen("true", shell=[1])
|
||||
| ^^^^^^^^^ S602
|
||||
15 | Popen("true", shell={1: 1})
|
||||
16 | Popen("true", shell=(1,))
|
||||
13 | Popen("true", shell={1: 1})
|
||||
14 | Popen("true", shell=(1,))
|
||||
|
|
||||
|
||||
S602.py:13:15: S602 `subprocess` call with `shell=True` seems safe, but may be changed in the future; consider rewriting without `shell`
|
||||
|
|
||||
13 | Popen("true", shell=1)
|
||||
14 | Popen("true", shell=[1])
|
||||
15 | Popen("true", shell={1: 1})
|
||||
11 | Popen("true", shell=1)
|
||||
12 | Popen("true", shell=[1])
|
||||
13 | Popen("true", shell={1: 1})
|
||||
| ^^^^^^^^^^^^ S602
|
||||
16 | Popen("true", shell=(1,))
|
||||
14 | Popen("true", shell=(1,))
|
||||
|
|
||||
|
||||
S602.py:14:15: S602 `subprocess` call with `shell=True` seems safe, but may be changed in the future; consider rewriting without `shell`
|
||||
|
|
||||
14 | Popen("true", shell=[1])
|
||||
15 | Popen("true", shell={1: 1})
|
||||
16 | Popen("true", shell=(1,))
|
||||
12 | Popen("true", shell=[1])
|
||||
13 | Popen("true", shell={1: 1})
|
||||
14 | Popen("true", shell=(1,))
|
||||
| ^^^^^^^^^^ S602
|
||||
17 |
|
||||
18 | # Check command argument looks unsafe.
|
||||
15 |
|
||||
16 | # Check command argument looks unsafe.
|
||||
|
|
||||
|
||||
S602.py:18:19: S602 `subprocess` call with `shell=True` identified, security issue
|
||||
|
|
||||
18 | # Check command argument looks unsafe.
|
||||
19 | var_string = "true"
|
||||
20 | Popen(var_string, shell=True)
|
||||
16 | # Check command argument looks unsafe.
|
||||
17 | var_string = "true"
|
||||
18 | Popen(var_string, shell=True)
|
||||
| ^^^^^^^^^^ S602
|
||||
21 | Popen([var_string], shell=True)
|
||||
22 | Popen([var_string, ""], shell=True)
|
||||
19 | Popen([var_string], shell=True)
|
||||
20 | Popen([var_string, ""], shell=True)
|
||||
|
|
||||
|
||||
S602.py:19:21: S602 `subprocess` call with `shell=True` identified, security issue
|
||||
|
|
||||
19 | var_string = "true"
|
||||
20 | Popen(var_string, shell=True)
|
||||
21 | Popen([var_string], shell=True)
|
||||
17 | var_string = "true"
|
||||
18 | Popen(var_string, shell=True)
|
||||
19 | Popen([var_string], shell=True)
|
||||
| ^^^^^^^^^^ S602
|
||||
22 | Popen([var_string, ""], shell=True)
|
||||
20 | Popen([var_string, ""], shell=True)
|
||||
|
|
||||
|
||||
S602.py:20:25: S602 `subprocess` call with `shell=True` identified, security issue
|
||||
|
|
||||
20 | Popen(var_string, shell=True)
|
||||
21 | Popen([var_string], shell=True)
|
||||
22 | Popen([var_string, ""], shell=True)
|
||||
18 | Popen(var_string, shell=True)
|
||||
19 | Popen([var_string], shell=True)
|
||||
20 | Popen([var_string, ""], shell=True)
|
||||
| ^^^^^^^^^^ S602
|
||||
|
|
||||
|
||||
|
|
|
@ -3,103 +3,103 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
|
|||
---
|
||||
S603.py:4:15: S603 `subprocess` call: check for execution of untrusted input
|
||||
|
|
||||
4 | # Different Popen wrappers are checked.
|
||||
5 | Popen("true", shell=False)
|
||||
3 | # Different Popen wrappers are checked.
|
||||
4 | Popen("true", shell=False)
|
||||
| ^^^^^^^^^^^ S603
|
||||
6 | call("true", shell=False)
|
||||
7 | check_call("true", shell=False)
|
||||
5 | call("true", shell=False)
|
||||
6 | check_call("true", shell=False)
|
||||
|
|
||||
|
||||
S603.py:5:14: S603 `subprocess` call: check for execution of untrusted input
|
||||
|
|
||||
5 | # Different Popen wrappers are checked.
|
||||
6 | Popen("true", shell=False)
|
||||
7 | call("true", shell=False)
|
||||
3 | # Different Popen wrappers are checked.
|
||||
4 | Popen("true", shell=False)
|
||||
5 | call("true", shell=False)
|
||||
| ^^^^^^^^^^^ S603
|
||||
8 | check_call("true", shell=False)
|
||||
9 | check_output("true", shell=False)
|
||||
6 | check_call("true", shell=False)
|
||||
7 | check_output("true", shell=False)
|
||||
|
|
||||
|
||||
S603.py:6:20: S603 `subprocess` call: check for execution of untrusted input
|
||||
|
|
||||
6 | Popen("true", shell=False)
|
||||
7 | call("true", shell=False)
|
||||
8 | check_call("true", shell=False)
|
||||
| ^^^^^^^^^^^ S603
|
||||
9 | check_output("true", shell=False)
|
||||
10 | run("true", shell=False)
|
||||
|
|
||||
|
|
||||
4 | Popen("true", shell=False)
|
||||
5 | call("true", shell=False)
|
||||
6 | check_call("true", shell=False)
|
||||
| ^^^^^^^^^^^ S603
|
||||
7 | check_output("true", shell=False)
|
||||
8 | run("true", shell=False)
|
||||
|
|
||||
|
||||
S603.py:7:22: S603 `subprocess` call: check for execution of untrusted input
|
||||
|
|
||||
7 | call("true", shell=False)
|
||||
8 | check_call("true", shell=False)
|
||||
9 | check_output("true", shell=False)
|
||||
| ^^^^^^^^^^^ S603
|
||||
10 | run("true", shell=False)
|
||||
|
|
||||
|
|
||||
5 | call("true", shell=False)
|
||||
6 | check_call("true", shell=False)
|
||||
7 | check_output("true", shell=False)
|
||||
| ^^^^^^^^^^^ S603
|
||||
8 | run("true", shell=False)
|
||||
|
|
||||
|
||||
S603.py:8:13: S603 `subprocess` call: check for execution of untrusted input
|
||||
|
|
||||
8 | check_call("true", shell=False)
|
||||
9 | check_output("true", shell=False)
|
||||
10 | run("true", shell=False)
|
||||
6 | check_call("true", shell=False)
|
||||
7 | check_output("true", shell=False)
|
||||
8 | run("true", shell=False)
|
||||
| ^^^^^^^^^^^ S603
|
||||
11 |
|
||||
12 | # Values that falsey values are treated as false.
|
||||
9 |
|
||||
10 | # Values that falsey values are treated as false.
|
||||
|
|
||||
|
||||
S603.py:11:15: S603 `subprocess` call: check for execution of untrusted input
|
||||
|
|
||||
11 | # Values that falsey values are treated as false.
|
||||
12 | Popen("true", shell=0)
|
||||
10 | # Values that falsey values are treated as false.
|
||||
11 | Popen("true", shell=0)
|
||||
| ^^^^^^^ S603
|
||||
13 | Popen("true", shell=[])
|
||||
14 | Popen("true", shell={})
|
||||
12 | Popen("true", shell=[])
|
||||
13 | Popen("true", shell={})
|
||||
|
|
||||
|
||||
S603.py:12:15: S603 `subprocess` call: check for execution of untrusted input
|
||||
|
|
||||
12 | # Values that falsey values are treated as false.
|
||||
13 | Popen("true", shell=0)
|
||||
14 | Popen("true", shell=[])
|
||||
10 | # Values that falsey values are treated as false.
|
||||
11 | Popen("true", shell=0)
|
||||
12 | Popen("true", shell=[])
|
||||
| ^^^^^^^^ S603
|
||||
15 | Popen("true", shell={})
|
||||
16 | Popen("true", shell=None)
|
||||
13 | Popen("true", shell={})
|
||||
14 | Popen("true", shell=None)
|
||||
|
|
||||
|
||||
S603.py:13:15: S603 `subprocess` call: check for execution of untrusted input
|
||||
|
|
||||
13 | Popen("true", shell=0)
|
||||
14 | Popen("true", shell=[])
|
||||
15 | Popen("true", shell={})
|
||||
11 | Popen("true", shell=0)
|
||||
12 | Popen("true", shell=[])
|
||||
13 | Popen("true", shell={})
|
||||
| ^^^^^^^^ S603
|
||||
16 | Popen("true", shell=None)
|
||||
14 | Popen("true", shell=None)
|
||||
|
|
||||
|
||||
S603.py:14:15: S603 `subprocess` call: check for execution of untrusted input
|
||||
|
|
||||
14 | Popen("true", shell=[])
|
||||
15 | Popen("true", shell={})
|
||||
16 | Popen("true", shell=None)
|
||||
12 | Popen("true", shell=[])
|
||||
13 | Popen("true", shell={})
|
||||
14 | Popen("true", shell=None)
|
||||
| ^^^^^^^^^^ S603
|
||||
17 |
|
||||
18 | # Unknown values are treated as falsey.
|
||||
15 |
|
||||
16 | # Unknown values are treated as falsey.
|
||||
|
|
||||
|
||||
S603.py:17:15: S603 `subprocess` call: check for execution of untrusted input
|
||||
|
|
||||
17 | # Unknown values are treated as falsey.
|
||||
18 | Popen("true", shell=True if True else False)
|
||||
16 | # Unknown values are treated as falsey.
|
||||
17 | Popen("true", shell=True if True else False)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S603
|
||||
19 |
|
||||
20 | # No value is also caught.
|
||||
18 |
|
||||
19 | # No value is also caught.
|
||||
|
|
||||
|
||||
S603.py:20:7: S603 `subprocess` call: check for execution of untrusted input
|
||||
|
|
||||
20 | # No value is also caught.
|
||||
21 | Popen("true")
|
||||
19 | # No value is also caught.
|
||||
20 | Popen("true")
|
||||
| ^^^^^^ S603
|
||||
|
|
||||
|
||||
|
|
|
@ -2,145 +2,145 @@
|
|||
source: crates/ruff/src/rules/flake8_bandit/mod.rs
|
||||
---
|
||||
S605.py:7:11: S605 Starting a process with a shell: seems safe, but may be changed in the future; consider rewriting without `shell`
|
||||
|
|
||||
7 | # Check all shell functions.
|
||||
8 | os.system("true")
|
||||
| ^^^^^^ S605
|
||||
9 | os.popen("true")
|
||||
10 | os.popen2("true")
|
||||
|
|
||||
|
|
||||
6 | # Check all shell functions.
|
||||
7 | os.system("true")
|
||||
| ^^^^^^ S605
|
||||
8 | os.popen("true")
|
||||
9 | os.popen2("true")
|
||||
|
|
||||
|
||||
S605.py:8:10: S605 Starting a process with a shell: seems safe, but may be changed in the future; consider rewriting without `shell`
|
||||
|
|
||||
8 | # Check all shell functions.
|
||||
9 | os.system("true")
|
||||
10 | os.popen("true")
|
||||
6 | # Check all shell functions.
|
||||
7 | os.system("true")
|
||||
8 | os.popen("true")
|
||||
| ^^^^^^ S605
|
||||
11 | os.popen2("true")
|
||||
12 | os.popen3("true")
|
||||
9 | os.popen2("true")
|
||||
10 | os.popen3("true")
|
||||
|
|
||||
|
||||
S605.py:9:11: S605 Starting a process with a shell: seems safe, but may be changed in the future; consider rewriting without `shell`
|
||||
|
|
||||
9 | os.system("true")
|
||||
10 | os.popen("true")
|
||||
11 | os.popen2("true")
|
||||
7 | os.system("true")
|
||||
8 | os.popen("true")
|
||||
9 | os.popen2("true")
|
||||
| ^^^^^^ S605
|
||||
12 | os.popen3("true")
|
||||
13 | os.popen4("true")
|
||||
10 | os.popen3("true")
|
||||
11 | os.popen4("true")
|
||||
|
|
||||
|
||||
S605.py:10:11: S605 Starting a process with a shell: seems safe, but may be changed in the future; consider rewriting without `shell`
|
||||
|
|
||||
10 | os.popen("true")
|
||||
11 | os.popen2("true")
|
||||
12 | os.popen3("true")
|
||||
8 | os.popen("true")
|
||||
9 | os.popen2("true")
|
||||
10 | os.popen3("true")
|
||||
| ^^^^^^ S605
|
||||
13 | os.popen4("true")
|
||||
14 | popen2.popen2("true")
|
||||
11 | os.popen4("true")
|
||||
12 | popen2.popen2("true")
|
||||
|
|
||||
|
||||
S605.py:11:11: S605 Starting a process with a shell: seems safe, but may be changed in the future; consider rewriting without `shell`
|
||||
|
|
||||
11 | os.popen2("true")
|
||||
12 | os.popen3("true")
|
||||
13 | os.popen4("true")
|
||||
9 | os.popen2("true")
|
||||
10 | os.popen3("true")
|
||||
11 | os.popen4("true")
|
||||
| ^^^^^^ S605
|
||||
14 | popen2.popen2("true")
|
||||
15 | popen2.popen3("true")
|
||||
12 | popen2.popen2("true")
|
||||
13 | popen2.popen3("true")
|
||||
|
|
||||
|
||||
S605.py:12:15: S605 Starting a process with a shell: seems safe, but may be changed in the future; consider rewriting without `shell`
|
||||
|
|
||||
12 | os.popen3("true")
|
||||
13 | os.popen4("true")
|
||||
14 | popen2.popen2("true")
|
||||
10 | os.popen3("true")
|
||||
11 | os.popen4("true")
|
||||
12 | popen2.popen2("true")
|
||||
| ^^^^^^ S605
|
||||
15 | popen2.popen3("true")
|
||||
16 | popen2.popen4("true")
|
||||
13 | popen2.popen3("true")
|
||||
14 | popen2.popen4("true")
|
||||
|
|
||||
|
||||
S605.py:13:15: S605 Starting a process with a shell: seems safe, but may be changed in the future; consider rewriting without `shell`
|
||||
|
|
||||
13 | os.popen4("true")
|
||||
14 | popen2.popen2("true")
|
||||
15 | popen2.popen3("true")
|
||||
11 | os.popen4("true")
|
||||
12 | popen2.popen2("true")
|
||||
13 | popen2.popen3("true")
|
||||
| ^^^^^^ S605
|
||||
16 | popen2.popen4("true")
|
||||
17 | popen2.Popen3("true")
|
||||
14 | popen2.popen4("true")
|
||||
15 | popen2.Popen3("true")
|
||||
|
|
||||
|
||||
S605.py:14:15: S605 Starting a process with a shell: seems safe, but may be changed in the future; consider rewriting without `shell`
|
||||
|
|
||||
14 | popen2.popen2("true")
|
||||
15 | popen2.popen3("true")
|
||||
16 | popen2.popen4("true")
|
||||
12 | popen2.popen2("true")
|
||||
13 | popen2.popen3("true")
|
||||
14 | popen2.popen4("true")
|
||||
| ^^^^^^ S605
|
||||
17 | popen2.Popen3("true")
|
||||
18 | popen2.Popen4("true")
|
||||
15 | popen2.Popen3("true")
|
||||
16 | popen2.Popen4("true")
|
||||
|
|
||||
|
||||
S605.py:15:15: S605 Starting a process with a shell: seems safe, but may be changed in the future; consider rewriting without `shell`
|
||||
|
|
||||
15 | popen2.popen3("true")
|
||||
16 | popen2.popen4("true")
|
||||
17 | popen2.Popen3("true")
|
||||
13 | popen2.popen3("true")
|
||||
14 | popen2.popen4("true")
|
||||
15 | popen2.Popen3("true")
|
||||
| ^^^^^^ S605
|
||||
18 | popen2.Popen4("true")
|
||||
19 | commands.getoutput("true")
|
||||
16 | popen2.Popen4("true")
|
||||
17 | commands.getoutput("true")
|
||||
|
|
||||
|
||||
S605.py:16:15: S605 Starting a process with a shell: seems safe, but may be changed in the future; consider rewriting without `shell`
|
||||
|
|
||||
16 | popen2.popen4("true")
|
||||
17 | popen2.Popen3("true")
|
||||
18 | popen2.Popen4("true")
|
||||
14 | popen2.popen4("true")
|
||||
15 | popen2.Popen3("true")
|
||||
16 | popen2.Popen4("true")
|
||||
| ^^^^^^ S605
|
||||
19 | commands.getoutput("true")
|
||||
20 | commands.getstatusoutput("true")
|
||||
17 | commands.getoutput("true")
|
||||
18 | commands.getstatusoutput("true")
|
||||
|
|
||||
|
||||
S605.py:17:20: S605 Starting a process with a shell: seems safe, but may be changed in the future; consider rewriting without `shell`
|
||||
|
|
||||
17 | popen2.Popen3("true")
|
||||
18 | popen2.Popen4("true")
|
||||
19 | commands.getoutput("true")
|
||||
15 | popen2.Popen3("true")
|
||||
16 | popen2.Popen4("true")
|
||||
17 | commands.getoutput("true")
|
||||
| ^^^^^^ S605
|
||||
20 | commands.getstatusoutput("true")
|
||||
18 | commands.getstatusoutput("true")
|
||||
|
|
||||
|
||||
S605.py:18:26: S605 Starting a process with a shell: seems safe, but may be changed in the future; consider rewriting without `shell`
|
||||
|
|
||||
18 | popen2.Popen4("true")
|
||||
19 | commands.getoutput("true")
|
||||
20 | commands.getstatusoutput("true")
|
||||
16 | popen2.Popen4("true")
|
||||
17 | commands.getoutput("true")
|
||||
18 | commands.getstatusoutput("true")
|
||||
| ^^^^^^ S605
|
||||
|
|
||||
|
||||
S605.py:23:11: S605 Starting a process with a shell, possible injection detected
|
||||
|
|
||||
23 | # Check command argument looks unsafe.
|
||||
24 | var_string = "true"
|
||||
25 | os.system(var_string)
|
||||
21 | # Check command argument looks unsafe.
|
||||
22 | var_string = "true"
|
||||
23 | os.system(var_string)
|
||||
| ^^^^^^^^^^ S605
|
||||
26 | os.system([var_string])
|
||||
27 | os.system([var_string, ""])
|
||||
24 | os.system([var_string])
|
||||
25 | os.system([var_string, ""])
|
||||
|
|
||||
|
||||
S605.py:24:11: S605 Starting a process with a shell, possible injection detected
|
||||
|
|
||||
24 | var_string = "true"
|
||||
25 | os.system(var_string)
|
||||
26 | os.system([var_string])
|
||||
22 | var_string = "true"
|
||||
23 | os.system(var_string)
|
||||
24 | os.system([var_string])
|
||||
| ^^^^^^^^^^^^ S605
|
||||
27 | os.system([var_string, ""])
|
||||
25 | os.system([var_string, ""])
|
||||
|
|
||||
|
||||
S605.py:25:11: S605 Starting a process with a shell, possible injection detected
|
||||
|
|
||||
25 | os.system(var_string)
|
||||
26 | os.system([var_string])
|
||||
27 | os.system([var_string, ""])
|
||||
23 | os.system(var_string)
|
||||
24 | os.system([var_string])
|
||||
25 | os.system([var_string, ""])
|
||||
| ^^^^^^^^^^^^^^^^ S605
|
||||
|
|
||||
|
||||
|
|
|
@ -3,167 +3,167 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
|
|||
---
|
||||
S606.py:4:1: S606 Starting a process without a shell
|
||||
|
|
||||
4 | # Check all shell functions.
|
||||
5 | os.execl("true")
|
||||
3 | # Check all shell functions.
|
||||
4 | os.execl("true")
|
||||
| ^^^^^^^^ S606
|
||||
6 | os.execle("true")
|
||||
7 | os.execlp("true")
|
||||
5 | os.execle("true")
|
||||
6 | os.execlp("true")
|
||||
|
|
||||
|
||||
S606.py:5:1: S606 Starting a process without a shell
|
||||
|
|
||||
5 | # Check all shell functions.
|
||||
6 | os.execl("true")
|
||||
7 | os.execle("true")
|
||||
3 | # Check all shell functions.
|
||||
4 | os.execl("true")
|
||||
5 | os.execle("true")
|
||||
| ^^^^^^^^^ S606
|
||||
8 | os.execlp("true")
|
||||
9 | os.execlpe("true")
|
||||
6 | os.execlp("true")
|
||||
7 | os.execlpe("true")
|
||||
|
|
||||
|
||||
S606.py:6:1: S606 Starting a process without a shell
|
||||
|
|
||||
6 | os.execl("true")
|
||||
7 | os.execle("true")
|
||||
8 | os.execlp("true")
|
||||
| ^^^^^^^^^ S606
|
||||
9 | os.execlpe("true")
|
||||
10 | os.execv("true")
|
||||
|
|
||||
|
|
||||
4 | os.execl("true")
|
||||
5 | os.execle("true")
|
||||
6 | os.execlp("true")
|
||||
| ^^^^^^^^^ S606
|
||||
7 | os.execlpe("true")
|
||||
8 | os.execv("true")
|
||||
|
|
||||
|
||||
S606.py:7:1: S606 Starting a process without a shell
|
||||
|
|
||||
7 | os.execle("true")
|
||||
8 | os.execlp("true")
|
||||
9 | os.execlpe("true")
|
||||
| ^^^^^^^^^^ S606
|
||||
10 | os.execv("true")
|
||||
11 | os.execve("true")
|
||||
|
|
||||
|
|
||||
5 | os.execle("true")
|
||||
6 | os.execlp("true")
|
||||
7 | os.execlpe("true")
|
||||
| ^^^^^^^^^^ S606
|
||||
8 | os.execv("true")
|
||||
9 | os.execve("true")
|
||||
|
|
||||
|
||||
S606.py:8:1: S606 Starting a process without a shell
|
||||
|
|
||||
8 | os.execlp("true")
|
||||
9 | os.execlpe("true")
|
||||
10 | os.execv("true")
|
||||
6 | os.execlp("true")
|
||||
7 | os.execlpe("true")
|
||||
8 | os.execv("true")
|
||||
| ^^^^^^^^ S606
|
||||
11 | os.execve("true")
|
||||
12 | os.execvp("true")
|
||||
9 | os.execve("true")
|
||||
10 | os.execvp("true")
|
||||
|
|
||||
|
||||
S606.py:9:1: S606 Starting a process without a shell
|
||||
|
|
||||
9 | os.execlpe("true")
|
||||
10 | os.execv("true")
|
||||
11 | os.execve("true")
|
||||
7 | os.execlpe("true")
|
||||
8 | os.execv("true")
|
||||
9 | os.execve("true")
|
||||
| ^^^^^^^^^ S606
|
||||
12 | os.execvp("true")
|
||||
13 | os.execvpe("true")
|
||||
10 | os.execvp("true")
|
||||
11 | os.execvpe("true")
|
||||
|
|
||||
|
||||
S606.py:10:1: S606 Starting a process without a shell
|
||||
|
|
||||
10 | os.execv("true")
|
||||
11 | os.execve("true")
|
||||
12 | os.execvp("true")
|
||||
8 | os.execv("true")
|
||||
9 | os.execve("true")
|
||||
10 | os.execvp("true")
|
||||
| ^^^^^^^^^ S606
|
||||
13 | os.execvpe("true")
|
||||
14 | os.spawnl("true")
|
||||
11 | os.execvpe("true")
|
||||
12 | os.spawnl("true")
|
||||
|
|
||||
|
||||
S606.py:11:1: S606 Starting a process without a shell
|
||||
|
|
||||
11 | os.execve("true")
|
||||
12 | os.execvp("true")
|
||||
13 | os.execvpe("true")
|
||||
9 | os.execve("true")
|
||||
10 | os.execvp("true")
|
||||
11 | os.execvpe("true")
|
||||
| ^^^^^^^^^^ S606
|
||||
14 | os.spawnl("true")
|
||||
15 | os.spawnle("true")
|
||||
12 | os.spawnl("true")
|
||||
13 | os.spawnle("true")
|
||||
|
|
||||
|
||||
S606.py:12:1: S606 Starting a process without a shell
|
||||
|
|
||||
12 | os.execvp("true")
|
||||
13 | os.execvpe("true")
|
||||
14 | os.spawnl("true")
|
||||
10 | os.execvp("true")
|
||||
11 | os.execvpe("true")
|
||||
12 | os.spawnl("true")
|
||||
| ^^^^^^^^^ S606
|
||||
15 | os.spawnle("true")
|
||||
16 | os.spawnlp("true")
|
||||
13 | os.spawnle("true")
|
||||
14 | os.spawnlp("true")
|
||||
|
|
||||
|
||||
S606.py:13:1: S606 Starting a process without a shell
|
||||
|
|
||||
13 | os.execvpe("true")
|
||||
14 | os.spawnl("true")
|
||||
15 | os.spawnle("true")
|
||||
11 | os.execvpe("true")
|
||||
12 | os.spawnl("true")
|
||||
13 | os.spawnle("true")
|
||||
| ^^^^^^^^^^ S606
|
||||
16 | os.spawnlp("true")
|
||||
17 | os.spawnlpe("true")
|
||||
14 | os.spawnlp("true")
|
||||
15 | os.spawnlpe("true")
|
||||
|
|
||||
|
||||
S606.py:14:1: S606 Starting a process without a shell
|
||||
|
|
||||
14 | os.spawnl("true")
|
||||
15 | os.spawnle("true")
|
||||
16 | os.spawnlp("true")
|
||||
12 | os.spawnl("true")
|
||||
13 | os.spawnle("true")
|
||||
14 | os.spawnlp("true")
|
||||
| ^^^^^^^^^^ S606
|
||||
17 | os.spawnlpe("true")
|
||||
18 | os.spawnv("true")
|
||||
15 | os.spawnlpe("true")
|
||||
16 | os.spawnv("true")
|
||||
|
|
||||
|
||||
S606.py:15:1: S606 Starting a process without a shell
|
||||
|
|
||||
15 | os.spawnle("true")
|
||||
16 | os.spawnlp("true")
|
||||
17 | os.spawnlpe("true")
|
||||
13 | os.spawnle("true")
|
||||
14 | os.spawnlp("true")
|
||||
15 | os.spawnlpe("true")
|
||||
| ^^^^^^^^^^^ S606
|
||||
18 | os.spawnv("true")
|
||||
19 | os.spawnve("true")
|
||||
16 | os.spawnv("true")
|
||||
17 | os.spawnve("true")
|
||||
|
|
||||
|
||||
S606.py:16:1: S606 Starting a process without a shell
|
||||
|
|
||||
16 | os.spawnlp("true")
|
||||
17 | os.spawnlpe("true")
|
||||
18 | os.spawnv("true")
|
||||
14 | os.spawnlp("true")
|
||||
15 | os.spawnlpe("true")
|
||||
16 | os.spawnv("true")
|
||||
| ^^^^^^^^^ S606
|
||||
19 | os.spawnve("true")
|
||||
20 | os.spawnvp("true")
|
||||
17 | os.spawnve("true")
|
||||
18 | os.spawnvp("true")
|
||||
|
|
||||
|
||||
S606.py:17:1: S606 Starting a process without a shell
|
||||
|
|
||||
17 | os.spawnlpe("true")
|
||||
18 | os.spawnv("true")
|
||||
19 | os.spawnve("true")
|
||||
15 | os.spawnlpe("true")
|
||||
16 | os.spawnv("true")
|
||||
17 | os.spawnve("true")
|
||||
| ^^^^^^^^^^ S606
|
||||
20 | os.spawnvp("true")
|
||||
21 | os.spawnvpe("true")
|
||||
18 | os.spawnvp("true")
|
||||
19 | os.spawnvpe("true")
|
||||
|
|
||||
|
||||
S606.py:18:1: S606 Starting a process without a shell
|
||||
|
|
||||
18 | os.spawnv("true")
|
||||
19 | os.spawnve("true")
|
||||
20 | os.spawnvp("true")
|
||||
16 | os.spawnv("true")
|
||||
17 | os.spawnve("true")
|
||||
18 | os.spawnvp("true")
|
||||
| ^^^^^^^^^^ S606
|
||||
21 | os.spawnvpe("true")
|
||||
22 | os.startfile("true")
|
||||
19 | os.spawnvpe("true")
|
||||
20 | os.startfile("true")
|
||||
|
|
||||
|
||||
S606.py:19:1: S606 Starting a process without a shell
|
||||
|
|
||||
19 | os.spawnve("true")
|
||||
20 | os.spawnvp("true")
|
||||
21 | os.spawnvpe("true")
|
||||
17 | os.spawnve("true")
|
||||
18 | os.spawnvp("true")
|
||||
19 | os.spawnvpe("true")
|
||||
| ^^^^^^^^^^^ S606
|
||||
22 | os.startfile("true")
|
||||
20 | os.startfile("true")
|
||||
|
|
||||
|
||||
S606.py:20:1: S606 Starting a process without a shell
|
||||
|
|
||||
20 | os.spawnvp("true")
|
||||
21 | os.spawnvpe("true")
|
||||
22 | os.startfile("true")
|
||||
18 | os.spawnvp("true")
|
||||
19 | os.spawnvpe("true")
|
||||
20 | os.startfile("true")
|
||||
| ^^^^^^^^^^^^ S606
|
||||
|
|
||||
|
||||
|
|
|
@ -3,221 +3,221 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
|
|||
---
|
||||
S607.py:9:11: S607 Starting a process with a partial executable path
|
||||
|
|
||||
9 | subprocess.check_output("true")
|
||||
10 | subprocess.run("true")
|
||||
11 | os.system("true")
|
||||
7 | subprocess.check_output("true")
|
||||
8 | subprocess.run("true")
|
||||
9 | os.system("true")
|
||||
| ^^^^^^ S607
|
||||
12 | os.popen("true")
|
||||
13 | os.popen2("true")
|
||||
10 | os.popen("true")
|
||||
11 | os.popen2("true")
|
||||
|
|
||||
|
||||
S607.py:10:10: S607 Starting a process with a partial executable path
|
||||
|
|
||||
10 | subprocess.run("true")
|
||||
11 | os.system("true")
|
||||
12 | os.popen("true")
|
||||
8 | subprocess.run("true")
|
||||
9 | os.system("true")
|
||||
10 | os.popen("true")
|
||||
| ^^^^^^ S607
|
||||
13 | os.popen2("true")
|
||||
14 | os.popen3("true")
|
||||
11 | os.popen2("true")
|
||||
12 | os.popen3("true")
|
||||
|
|
||||
|
||||
S607.py:11:11: S607 Starting a process with a partial executable path
|
||||
|
|
||||
11 | os.system("true")
|
||||
12 | os.popen("true")
|
||||
13 | os.popen2("true")
|
||||
9 | os.system("true")
|
||||
10 | os.popen("true")
|
||||
11 | os.popen2("true")
|
||||
| ^^^^^^ S607
|
||||
14 | os.popen3("true")
|
||||
15 | os.popen4("true")
|
||||
12 | os.popen3("true")
|
||||
13 | os.popen4("true")
|
||||
|
|
||||
|
||||
S607.py:12:11: S607 Starting a process with a partial executable path
|
||||
|
|
||||
12 | os.popen("true")
|
||||
13 | os.popen2("true")
|
||||
14 | os.popen3("true")
|
||||
10 | os.popen("true")
|
||||
11 | os.popen2("true")
|
||||
12 | os.popen3("true")
|
||||
| ^^^^^^ S607
|
||||
15 | os.popen4("true")
|
||||
16 | popen2.popen2("true")
|
||||
13 | os.popen4("true")
|
||||
14 | popen2.popen2("true")
|
||||
|
|
||||
|
||||
S607.py:13:11: S607 Starting a process with a partial executable path
|
||||
|
|
||||
13 | os.popen2("true")
|
||||
14 | os.popen3("true")
|
||||
15 | os.popen4("true")
|
||||
11 | os.popen2("true")
|
||||
12 | os.popen3("true")
|
||||
13 | os.popen4("true")
|
||||
| ^^^^^^ S607
|
||||
16 | popen2.popen2("true")
|
||||
17 | popen2.popen3("true")
|
||||
14 | popen2.popen2("true")
|
||||
15 | popen2.popen3("true")
|
||||
|
|
||||
|
||||
S607.py:21:10: S607 Starting a process with a partial executable path
|
||||
|
|
||||
21 | commands.getoutput("true")
|
||||
22 | commands.getstatusoutput("true")
|
||||
23 | os.execl("true")
|
||||
19 | commands.getoutput("true")
|
||||
20 | commands.getstatusoutput("true")
|
||||
21 | os.execl("true")
|
||||
| ^^^^^^ S607
|
||||
24 | os.execle("true")
|
||||
25 | os.execlp("true")
|
||||
22 | os.execle("true")
|
||||
23 | os.execlp("true")
|
||||
|
|
||||
|
||||
S607.py:22:11: S607 Starting a process with a partial executable path
|
||||
|
|
||||
22 | commands.getstatusoutput("true")
|
||||
23 | os.execl("true")
|
||||
24 | os.execle("true")
|
||||
20 | commands.getstatusoutput("true")
|
||||
21 | os.execl("true")
|
||||
22 | os.execle("true")
|
||||
| ^^^^^^ S607
|
||||
25 | os.execlp("true")
|
||||
26 | os.execlpe("true")
|
||||
23 | os.execlp("true")
|
||||
24 | os.execlpe("true")
|
||||
|
|
||||
|
||||
S607.py:23:11: S607 Starting a process with a partial executable path
|
||||
|
|
||||
23 | os.execl("true")
|
||||
24 | os.execle("true")
|
||||
25 | os.execlp("true")
|
||||
21 | os.execl("true")
|
||||
22 | os.execle("true")
|
||||
23 | os.execlp("true")
|
||||
| ^^^^^^ S607
|
||||
26 | os.execlpe("true")
|
||||
27 | os.execv("true")
|
||||
24 | os.execlpe("true")
|
||||
25 | os.execv("true")
|
||||
|
|
||||
|
||||
S607.py:24:12: S607 Starting a process with a partial executable path
|
||||
|
|
||||
24 | os.execle("true")
|
||||
25 | os.execlp("true")
|
||||
26 | os.execlpe("true")
|
||||
22 | os.execle("true")
|
||||
23 | os.execlp("true")
|
||||
24 | os.execlpe("true")
|
||||
| ^^^^^^ S607
|
||||
27 | os.execv("true")
|
||||
28 | os.execve("true")
|
||||
25 | os.execv("true")
|
||||
26 | os.execve("true")
|
||||
|
|
||||
|
||||
S607.py:25:10: S607 Starting a process with a partial executable path
|
||||
|
|
||||
25 | os.execlp("true")
|
||||
26 | os.execlpe("true")
|
||||
27 | os.execv("true")
|
||||
23 | os.execlp("true")
|
||||
24 | os.execlpe("true")
|
||||
25 | os.execv("true")
|
||||
| ^^^^^^ S607
|
||||
28 | os.execve("true")
|
||||
29 | os.execvp("true")
|
||||
26 | os.execve("true")
|
||||
27 | os.execvp("true")
|
||||
|
|
||||
|
||||
S607.py:26:11: S607 Starting a process with a partial executable path
|
||||
|
|
||||
26 | os.execlpe("true")
|
||||
27 | os.execv("true")
|
||||
28 | os.execve("true")
|
||||
24 | os.execlpe("true")
|
||||
25 | os.execv("true")
|
||||
26 | os.execve("true")
|
||||
| ^^^^^^ S607
|
||||
29 | os.execvp("true")
|
||||
30 | os.execvpe("true")
|
||||
27 | os.execvp("true")
|
||||
28 | os.execvpe("true")
|
||||
|
|
||||
|
||||
S607.py:27:11: S607 Starting a process with a partial executable path
|
||||
|
|
||||
27 | os.execv("true")
|
||||
28 | os.execve("true")
|
||||
29 | os.execvp("true")
|
||||
25 | os.execv("true")
|
||||
26 | os.execve("true")
|
||||
27 | os.execvp("true")
|
||||
| ^^^^^^ S607
|
||||
30 | os.execvpe("true")
|
||||
31 | os.spawnl("true")
|
||||
28 | os.execvpe("true")
|
||||
29 | os.spawnl("true")
|
||||
|
|
||||
|
||||
S607.py:28:12: S607 Starting a process with a partial executable path
|
||||
|
|
||||
28 | os.execve("true")
|
||||
29 | os.execvp("true")
|
||||
30 | os.execvpe("true")
|
||||
26 | os.execve("true")
|
||||
27 | os.execvp("true")
|
||||
28 | os.execvpe("true")
|
||||
| ^^^^^^ S607
|
||||
31 | os.spawnl("true")
|
||||
32 | os.spawnle("true")
|
||||
29 | os.spawnl("true")
|
||||
30 | os.spawnle("true")
|
||||
|
|
||||
|
||||
S607.py:29:11: S607 Starting a process with a partial executable path
|
||||
|
|
||||
29 | os.execvp("true")
|
||||
30 | os.execvpe("true")
|
||||
31 | os.spawnl("true")
|
||||
27 | os.execvp("true")
|
||||
28 | os.execvpe("true")
|
||||
29 | os.spawnl("true")
|
||||
| ^^^^^^ S607
|
||||
32 | os.spawnle("true")
|
||||
33 | os.spawnlp("true")
|
||||
30 | os.spawnle("true")
|
||||
31 | os.spawnlp("true")
|
||||
|
|
||||
|
||||
S607.py:30:12: S607 Starting a process with a partial executable path
|
||||
|
|
||||
30 | os.execvpe("true")
|
||||
31 | os.spawnl("true")
|
||||
32 | os.spawnle("true")
|
||||
28 | os.execvpe("true")
|
||||
29 | os.spawnl("true")
|
||||
30 | os.spawnle("true")
|
||||
| ^^^^^^ S607
|
||||
33 | os.spawnlp("true")
|
||||
34 | os.spawnlpe("true")
|
||||
31 | os.spawnlp("true")
|
||||
32 | os.spawnlpe("true")
|
||||
|
|
||||
|
||||
S607.py:31:12: S607 Starting a process with a partial executable path
|
||||
|
|
||||
31 | os.spawnl("true")
|
||||
32 | os.spawnle("true")
|
||||
33 | os.spawnlp("true")
|
||||
29 | os.spawnl("true")
|
||||
30 | os.spawnle("true")
|
||||
31 | os.spawnlp("true")
|
||||
| ^^^^^^ S607
|
||||
34 | os.spawnlpe("true")
|
||||
35 | os.spawnv("true")
|
||||
32 | os.spawnlpe("true")
|
||||
33 | os.spawnv("true")
|
||||
|
|
||||
|
||||
S607.py:32:13: S607 Starting a process with a partial executable path
|
||||
|
|
||||
32 | os.spawnle("true")
|
||||
33 | os.spawnlp("true")
|
||||
34 | os.spawnlpe("true")
|
||||
30 | os.spawnle("true")
|
||||
31 | os.spawnlp("true")
|
||||
32 | os.spawnlpe("true")
|
||||
| ^^^^^^ S607
|
||||
35 | os.spawnv("true")
|
||||
36 | os.spawnve("true")
|
||||
33 | os.spawnv("true")
|
||||
34 | os.spawnve("true")
|
||||
|
|
||||
|
||||
S607.py:33:11: S607 Starting a process with a partial executable path
|
||||
|
|
||||
33 | os.spawnlp("true")
|
||||
34 | os.spawnlpe("true")
|
||||
35 | os.spawnv("true")
|
||||
31 | os.spawnlp("true")
|
||||
32 | os.spawnlpe("true")
|
||||
33 | os.spawnv("true")
|
||||
| ^^^^^^ S607
|
||||
36 | os.spawnve("true")
|
||||
37 | os.spawnvp("true")
|
||||
34 | os.spawnve("true")
|
||||
35 | os.spawnvp("true")
|
||||
|
|
||||
|
||||
S607.py:34:12: S607 Starting a process with a partial executable path
|
||||
|
|
||||
34 | os.spawnlpe("true")
|
||||
35 | os.spawnv("true")
|
||||
36 | os.spawnve("true")
|
||||
32 | os.spawnlpe("true")
|
||||
33 | os.spawnv("true")
|
||||
34 | os.spawnve("true")
|
||||
| ^^^^^^ S607
|
||||
37 | os.spawnvp("true")
|
||||
38 | os.spawnvpe("true")
|
||||
35 | os.spawnvp("true")
|
||||
36 | os.spawnvpe("true")
|
||||
|
|
||||
|
||||
S607.py:35:12: S607 Starting a process with a partial executable path
|
||||
|
|
||||
35 | os.spawnv("true")
|
||||
36 | os.spawnve("true")
|
||||
37 | os.spawnvp("true")
|
||||
33 | os.spawnv("true")
|
||||
34 | os.spawnve("true")
|
||||
35 | os.spawnvp("true")
|
||||
| ^^^^^^ S607
|
||||
38 | os.spawnvpe("true")
|
||||
39 | os.startfile("true")
|
||||
36 | os.spawnvpe("true")
|
||||
37 | os.startfile("true")
|
||||
|
|
||||
|
||||
S607.py:36:13: S607 Starting a process with a partial executable path
|
||||
|
|
||||
36 | os.spawnve("true")
|
||||
37 | os.spawnvp("true")
|
||||
38 | os.spawnvpe("true")
|
||||
34 | os.spawnve("true")
|
||||
35 | os.spawnvp("true")
|
||||
36 | os.spawnvpe("true")
|
||||
| ^^^^^^ S607
|
||||
39 | os.startfile("true")
|
||||
37 | os.startfile("true")
|
||||
|
|
||||
|
||||
S607.py:37:14: S607 Starting a process with a partial executable path
|
||||
|
|
||||
37 | os.spawnvp("true")
|
||||
38 | os.spawnvpe("true")
|
||||
39 | os.startfile("true")
|
||||
35 | os.spawnvp("true")
|
||||
36 | os.spawnvpe("true")
|
||||
37 | os.startfile("true")
|
||||
| ^^^^^^ S607
|
||||
40 |
|
||||
41 | # Check it does not fail for full paths.
|
||||
38 |
|
||||
39 | # Check it does not fail for full paths.
|
||||
|
|
||||
|
||||
|
||||
|
|
|
@ -3,480 +3,480 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
|
|||
---
|
||||
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
|
||||
1 | # single-line failures
|
||||
2 | query1 = "SELECT %s FROM table" % (var,) # bad
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
4 | query2 = "SELECT var FROM " + table
|
||||
5 | query3 = "SELECT " + val + " FROM " + table
|
||||
3 | query2 = "SELECT var FROM " + table
|
||||
4 | query3 = "SELECT " + val + " FROM " + table
|
||||
|
|
||||
|
||||
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
|
||||
5 | query2 = "SELECT var FROM " + table
|
||||
1 | # single-line failures
|
||||
2 | query1 = "SELECT %s FROM table" % (var,) # bad
|
||||
3 | query2 = "SELECT var FROM " + table
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
6 | query3 = "SELECT " + val + " FROM " + table
|
||||
7 | query4 = "SELECT {} FROM table;".format(var)
|
||||
4 | query3 = "SELECT " + val + " FROM " + table
|
||||
5 | query4 = "SELECT {} FROM table;".format(var)
|
||||
|
|
||||
|
||||
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
|
||||
6 | query3 = "SELECT " + val + " FROM " + table
|
||||
2 | query1 = "SELECT %s FROM table" % (var,) # bad
|
||||
3 | query2 = "SELECT var FROM " + table
|
||||
4 | query3 = "SELECT " + val + " FROM " + table
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
7 | query4 = "SELECT {} FROM table;".format(var)
|
||||
8 | query5 = f"SELECT * FROM table WHERE var = {var}"
|
||||
5 | query4 = "SELECT {} FROM table;".format(var)
|
||||
6 | query5 = f"SELECT * FROM table WHERE var = {var}"
|
||||
|
|
||||
|
||||
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
|
||||
7 | query4 = "SELECT {} FROM table;".format(var)
|
||||
3 | query2 = "SELECT var FROM " + table
|
||||
4 | query3 = "SELECT " + val + " FROM " + table
|
||||
5 | query4 = "SELECT {} FROM table;".format(var)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
8 | query5 = f"SELECT * FROM table WHERE var = {var}"
|
||||
6 | query5 = f"SELECT * FROM table WHERE var = {var}"
|
||||
|
|
||||
|
||||
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)
|
||||
8 | query5 = f"SELECT * FROM table WHERE var = {var}"
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
9 |
|
||||
10 | query6 = "DELETE FROM table WHERE var = %s" % (var,)
|
||||
|
|
||||
|
|
||||
4 | query3 = "SELECT " + val + " FROM " + table
|
||||
5 | query4 = "SELECT {} FROM table;".format(var)
|
||||
6 | query5 = f"SELECT * FROM table WHERE var = {var}"
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
7 |
|
||||
8 | query6 = "DELETE FROM table WHERE var = %s" % (var,)
|
||||
|
|
||||
|
||||
S608.py:8:10: S608 Possible SQL injection vector through string-based query construction
|
||||
|
|
||||
8 | query5 = f"SELECT * FROM table WHERE var = {var}"
|
||||
9 |
|
||||
10 | query6 = "DELETE FROM table WHERE var = %s" % (var,)
|
||||
6 | query5 = f"SELECT * FROM table WHERE var = {var}"
|
||||
7 |
|
||||
8 | query6 = "DELETE FROM table WHERE var = %s" % (var,)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
11 | query7 = "DELETE FROM table WHERE VAR = " + var
|
||||
12 | query8 = "DELETE FROM " + table + "WHERE var = " + var
|
||||
9 | query7 = "DELETE FROM table WHERE VAR = " + var
|
||||
10 | query8 = "DELETE FROM " + table + "WHERE var = " + var
|
||||
|
|
||||
|
||||
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
|
||||
8 | query6 = "DELETE FROM table WHERE var = %s" % (var,)
|
||||
9 | query7 = "DELETE FROM table WHERE VAR = " + var
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
11 | query8 = "DELETE FROM " + table + "WHERE var = " + var
|
||||
12 | query9 = "DELETE FROM table WHERE var = {}".format(var)
|
||||
10 | query8 = "DELETE FROM " + table + "WHERE var = " + var
|
||||
11 | query9 = "DELETE FROM table WHERE var = {}".format(var)
|
||||
|
|
||||
|
||||
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
|
||||
12 | query8 = "DELETE FROM " + table + "WHERE var = " + var
|
||||
8 | query6 = "DELETE FROM table WHERE var = %s" % (var,)
|
||||
9 | query7 = "DELETE FROM table WHERE VAR = " + var
|
||||
10 | query8 = "DELETE FROM " + table + "WHERE var = " + var
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
13 | query9 = "DELETE FROM table WHERE var = {}".format(var)
|
||||
14 | query10 = f"DELETE FROM table WHERE var = {var}"
|
||||
11 | query9 = "DELETE FROM table WHERE var = {}".format(var)
|
||||
12 | query10 = f"DELETE FROM table WHERE var = {var}"
|
||||
|
|
||||
|
||||
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
|
||||
13 | query9 = "DELETE FROM table WHERE var = {}".format(var)
|
||||
9 | query7 = "DELETE FROM table WHERE VAR = " + var
|
||||
10 | query8 = "DELETE FROM " + table + "WHERE var = " + var
|
||||
11 | query9 = "DELETE FROM table WHERE var = {}".format(var)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
14 | query10 = f"DELETE FROM table WHERE var = {var}"
|
||||
12 | query10 = f"DELETE FROM table WHERE var = {var}"
|
||||
|
|
||||
|
||||
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)
|
||||
14 | query10 = f"DELETE FROM table WHERE var = {var}"
|
||||
10 | query8 = "DELETE FROM " + table + "WHERE var = " + var
|
||||
11 | query9 = "DELETE FROM table WHERE var = {}".format(var)
|
||||
12 | query10 = f"DELETE FROM table WHERE var = {var}"
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
15 |
|
||||
16 | query11 = "INSERT INTO table VALUES (%s)" % (var,)
|
||||
13 |
|
||||
14 | query11 = "INSERT INTO table VALUES (%s)" % (var,)
|
||||
|
|
||||
|
||||
S608.py:14:11: S608 Possible SQL injection vector through string-based query construction
|
||||
|
|
||||
14 | query10 = f"DELETE FROM table WHERE var = {var}"
|
||||
15 |
|
||||
16 | query11 = "INSERT INTO table VALUES (%s)" % (var,)
|
||||
12 | query10 = f"DELETE FROM table WHERE var = {var}"
|
||||
13 |
|
||||
14 | query11 = "INSERT INTO table VALUES (%s)" % (var,)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
17 | query12 = "INSERT INTO TABLE VALUES (" + var + ")"
|
||||
18 | query13 = "INSERT INTO {} VALUES ({})".format(table, var)
|
||||
15 | query12 = "INSERT INTO TABLE VALUES (" + var + ")"
|
||||
16 | query13 = "INSERT INTO {} VALUES ({})".format(table, var)
|
||||
|
|
||||
|
||||
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 + ")"
|
||||
14 | query11 = "INSERT INTO table VALUES (%s)" % (var,)
|
||||
15 | query12 = "INSERT INTO TABLE VALUES (" + var + ")"
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
17 | query13 = "INSERT INTO {} VALUES ({})".format(table, var)
|
||||
18 | query14 = f"INSERT INTO {table} VALUES var = {var}"
|
||||
16 | query13 = "INSERT INTO {} VALUES ({})".format(table, var)
|
||||
17 | query14 = f"INSERT INTO {table} VALUES var = {var}"
|
||||
|
|
||||
|
||||
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 + ")"
|
||||
18 | query13 = "INSERT INTO {} VALUES ({})".format(table, var)
|
||||
14 | query11 = "INSERT INTO table VALUES (%s)" % (var,)
|
||||
15 | query12 = "INSERT INTO TABLE VALUES (" + var + ")"
|
||||
16 | query13 = "INSERT INTO {} VALUES ({})".format(table, var)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
19 | query14 = f"INSERT INTO {table} VALUES var = {var}"
|
||||
17 | query14 = f"INSERT INTO {table} VALUES var = {var}"
|
||||
|
|
||||
|
||||
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)
|
||||
19 | query14 = f"INSERT INTO {table} VALUES var = {var}"
|
||||
15 | query12 = "INSERT INTO TABLE VALUES (" + var + ")"
|
||||
16 | query13 = "INSERT INTO {} VALUES ({})".format(table, var)
|
||||
17 | query14 = f"INSERT INTO {table} VALUES var = {var}"
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
20 |
|
||||
21 | query15 = "UPDATE %s SET var = %s" % (table, var)
|
||||
18 |
|
||||
19 | query15 = "UPDATE %s SET var = %s" % (table, var)
|
||||
|
|
||||
|
||||
S608.py:19:11: S608 Possible SQL injection vector through string-based query construction
|
||||
|
|
||||
19 | query14 = f"INSERT INTO {table} VALUES var = {var}"
|
||||
20 |
|
||||
21 | query15 = "UPDATE %s SET var = %s" % (table, var)
|
||||
17 | query14 = f"INSERT INTO {table} VALUES var = {var}"
|
||||
18 |
|
||||
19 | query15 = "UPDATE %s SET var = %s" % (table, var)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
22 | query16 = "UPDATE " + table + " SET var = " + var
|
||||
23 | query17 = "UPDATE {} SET var = {}".format(table, var)
|
||||
20 | query16 = "UPDATE " + table + " SET var = " + var
|
||||
21 | query17 = "UPDATE {} SET var = {}".format(table, var)
|
||||
|
|
||||
|
||||
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
|
||||
19 | query15 = "UPDATE %s SET var = %s" % (table, var)
|
||||
20 | query16 = "UPDATE " + table + " SET var = " + var
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
22 | query17 = "UPDATE {} SET var = {}".format(table, var)
|
||||
23 | query18 = f"UPDATE {table} SET var = {var}"
|
||||
21 | query17 = "UPDATE {} SET var = {}".format(table, var)
|
||||
22 | query18 = f"UPDATE {table} SET var = {var}"
|
||||
|
|
||||
|
||||
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
|
||||
23 | query17 = "UPDATE {} SET var = {}".format(table, var)
|
||||
19 | query15 = "UPDATE %s SET var = %s" % (table, var)
|
||||
20 | query16 = "UPDATE " + table + " SET var = " + var
|
||||
21 | query17 = "UPDATE {} SET var = {}".format(table, var)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
24 | query18 = f"UPDATE {table} SET var = {var}"
|
||||
22 | query18 = f"UPDATE {table} SET var = {var}"
|
||||
|
|
||||
|
||||
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)
|
||||
24 | query18 = f"UPDATE {table} SET var = {var}"
|
||||
20 | query16 = "UPDATE " + table + " SET var = " + var
|
||||
21 | query17 = "UPDATE {} SET var = {}".format(table, var)
|
||||
22 | query18 = f"UPDATE {table} SET var = {var}"
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
25 |
|
||||
26 | query19 = "select %s from table" % (var,)
|
||||
23 |
|
||||
24 | query19 = "select %s from table" % (var,)
|
||||
|
|
||||
|
||||
S608.py:24:11: S608 Possible SQL injection vector through string-based query construction
|
||||
|
|
||||
24 | query18 = f"UPDATE {table} SET var = {var}"
|
||||
25 |
|
||||
26 | query19 = "select %s from table" % (var,)
|
||||
22 | query18 = f"UPDATE {table} SET var = {var}"
|
||||
23 |
|
||||
24 | query19 = "select %s from table" % (var,)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
27 | query20 = "select var from " + table
|
||||
28 | query21 = "select " + val + " from " + table
|
||||
25 | query20 = "select var from " + table
|
||||
26 | query21 = "select " + val + " from " + table
|
||||
|
|
||||
|
||||
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
|
||||
24 | query19 = "select %s from table" % (var,)
|
||||
25 | query20 = "select var from " + table
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
27 | query21 = "select " + val + " from " + table
|
||||
28 | query22 = "select {} from table;".format(var)
|
||||
26 | query21 = "select " + val + " from " + table
|
||||
27 | query22 = "select {} from table;".format(var)
|
||||
|
|
||||
|
||||
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
|
||||
28 | query21 = "select " + val + " from " + table
|
||||
24 | query19 = "select %s from table" % (var,)
|
||||
25 | query20 = "select var from " + table
|
||||
26 | query21 = "select " + val + " from " + table
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
29 | query22 = "select {} from table;".format(var)
|
||||
30 | query23 = f"select * from table where var = {var}"
|
||||
27 | query22 = "select {} from table;".format(var)
|
||||
28 | query23 = f"select * from table where var = {var}"
|
||||
|
|
||||
|
||||
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
|
||||
29 | query22 = "select {} from table;".format(var)
|
||||
25 | query20 = "select var from " + table
|
||||
26 | query21 = "select " + val + " from " + table
|
||||
27 | query22 = "select {} from table;".format(var)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
30 | query23 = f"select * from table where var = {var}"
|
||||
28 | query23 = f"select * from table where var = {var}"
|
||||
|
|
||||
|
||||
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)
|
||||
30 | query23 = f"select * from table where var = {var}"
|
||||
26 | query21 = "select " + val + " from " + table
|
||||
27 | query22 = "select {} from table;".format(var)
|
||||
28 | query23 = f"select * from table where var = {var}"
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
31 |
|
||||
32 | query24 = "delete from table where var = %s" % (var,)
|
||||
29 |
|
||||
30 | query24 = "delete from table where var = %s" % (var,)
|
||||
|
|
||||
|
||||
S608.py:30:11: S608 Possible SQL injection vector through string-based query construction
|
||||
|
|
||||
30 | query23 = f"select * from table where var = {var}"
|
||||
31 |
|
||||
32 | query24 = "delete from table where var = %s" % (var,)
|
||||
28 | query23 = f"select * from table where var = {var}"
|
||||
29 |
|
||||
30 | query24 = "delete from table where var = %s" % (var,)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
33 | query25 = "delete from table where var = " + var
|
||||
34 | query26 = "delete from " + table + "where var = " + var
|
||||
31 | query25 = "delete from table where var = " + var
|
||||
32 | query26 = "delete from " + table + "where var = " + var
|
||||
|
|
||||
|
||||
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
|
||||
30 | query24 = "delete from table where var = %s" % (var,)
|
||||
31 | query25 = "delete from table where var = " + var
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
33 | query26 = "delete from " + table + "where var = " + var
|
||||
34 | query27 = "delete from table where var = {}".format(var)
|
||||
32 | query26 = "delete from " + table + "where var = " + var
|
||||
33 | query27 = "delete from table where var = {}".format(var)
|
||||
|
|
||||
|
||||
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
|
||||
34 | query26 = "delete from " + table + "where var = " + var
|
||||
30 | query24 = "delete from table where var = %s" % (var,)
|
||||
31 | query25 = "delete from table where var = " + var
|
||||
32 | query26 = "delete from " + table + "where var = " + var
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
35 | query27 = "delete from table where var = {}".format(var)
|
||||
36 | query28 = f"delete from table where var = {var}"
|
||||
33 | query27 = "delete from table where var = {}".format(var)
|
||||
34 | query28 = f"delete from table where var = {var}"
|
||||
|
|
||||
|
||||
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
|
||||
35 | query27 = "delete from table where var = {}".format(var)
|
||||
31 | query25 = "delete from table where var = " + var
|
||||
32 | query26 = "delete from " + table + "where var = " + var
|
||||
33 | query27 = "delete from table where var = {}".format(var)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
36 | query28 = f"delete from table where var = {var}"
|
||||
34 | query28 = f"delete from table where var = {var}"
|
||||
|
|
||||
|
||||
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)
|
||||
36 | query28 = f"delete from table where var = {var}"
|
||||
32 | query26 = "delete from " + table + "where var = " + var
|
||||
33 | query27 = "delete from table where var = {}".format(var)
|
||||
34 | query28 = f"delete from table where var = {var}"
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
37 |
|
||||
38 | query29 = "insert into table values (%s)" % (var,)
|
||||
35 |
|
||||
36 | query29 = "insert into table values (%s)" % (var,)
|
||||
|
|
||||
|
||||
S608.py:36:11: S608 Possible SQL injection vector through string-based query construction
|
||||
|
|
||||
36 | query28 = f"delete from table where var = {var}"
|
||||
37 |
|
||||
38 | query29 = "insert into table values (%s)" % (var,)
|
||||
34 | query28 = f"delete from table where var = {var}"
|
||||
35 |
|
||||
36 | query29 = "insert into table values (%s)" % (var,)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
39 | query30 = "insert into table values (" + var + ")"
|
||||
40 | query31 = "insert into {} values ({})".format(table, var)
|
||||
37 | query30 = "insert into table values (" + var + ")"
|
||||
38 | query31 = "insert into {} values ({})".format(table, var)
|
||||
|
|
||||
|
||||
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 + ")"
|
||||
36 | query29 = "insert into table values (%s)" % (var,)
|
||||
37 | query30 = "insert into table values (" + var + ")"
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
39 | query31 = "insert into {} values ({})".format(table, var)
|
||||
40 | query32 = f"insert into {table} values var = {var}"
|
||||
38 | query31 = "insert into {} values ({})".format(table, var)
|
||||
39 | query32 = f"insert into {table} values var = {var}"
|
||||
|
|
||||
|
||||
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 + ")"
|
||||
40 | query31 = "insert into {} values ({})".format(table, var)
|
||||
36 | query29 = "insert into table values (%s)" % (var,)
|
||||
37 | query30 = "insert into table values (" + var + ")"
|
||||
38 | query31 = "insert into {} values ({})".format(table, var)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
41 | query32 = f"insert into {table} values var = {var}"
|
||||
39 | query32 = f"insert into {table} values var = {var}"
|
||||
|
|
||||
|
||||
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)
|
||||
41 | query32 = f"insert into {table} values var = {var}"
|
||||
37 | query30 = "insert into table values (" + var + ")"
|
||||
38 | query31 = "insert into {} values ({})".format(table, var)
|
||||
39 | query32 = f"insert into {table} values var = {var}"
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
42 |
|
||||
43 | query33 = "update %s set var = %s" % (table, var)
|
||||
40 |
|
||||
41 | query33 = "update %s set var = %s" % (table, var)
|
||||
|
|
||||
|
||||
S608.py:41:11: S608 Possible SQL injection vector through string-based query construction
|
||||
|
|
||||
41 | query32 = f"insert into {table} values var = {var}"
|
||||
42 |
|
||||
43 | query33 = "update %s set var = %s" % (table, var)
|
||||
39 | query32 = f"insert into {table} values var = {var}"
|
||||
40 |
|
||||
41 | query33 = "update %s set var = %s" % (table, var)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
44 | query34 = "update " + table + " set var = " + var
|
||||
45 | query35 = "update {} set var = {}".format(table, var)
|
||||
42 | query34 = "update " + table + " set var = " + var
|
||||
43 | query35 = "update {} set var = {}".format(table, var)
|
||||
|
|
||||
|
||||
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
|
||||
41 | query33 = "update %s set var = %s" % (table, var)
|
||||
42 | query34 = "update " + table + " set var = " + var
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
44 | query35 = "update {} set var = {}".format(table, var)
|
||||
45 | query36 = f"update {table} set var = {var}"
|
||||
43 | query35 = "update {} set var = {}".format(table, var)
|
||||
44 | query36 = f"update {table} set var = {var}"
|
||||
|
|
||||
|
||||
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
|
||||
45 | query35 = "update {} set var = {}".format(table, var)
|
||||
41 | query33 = "update %s set var = %s" % (table, var)
|
||||
42 | query34 = "update " + table + " set var = " + var
|
||||
43 | query35 = "update {} set var = {}".format(table, var)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
46 | query36 = f"update {table} set var = {var}"
|
||||
44 | query36 = f"update {table} set var = {var}"
|
||||
|
|
||||
|
||||
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)
|
||||
46 | query36 = f"update {table} set var = {var}"
|
||||
42 | query34 = "update " + table + " set var = " + var
|
||||
43 | query35 = "update {} set var = {}".format(table, var)
|
||||
44 | query36 = f"update {table} set var = {var}"
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
47 |
|
||||
48 | # multi-line failures
|
||||
45 |
|
||||
46 | # multi-line failures
|
||||
|
|
||||
|
||||
S608.py:48:12: S608 Possible SQL injection vector through string-based query construction
|
||||
|
|
||||
48 | # multi-line failures
|
||||
49 | def query37():
|
||||
50 | return """
|
||||
46 | # multi-line failures
|
||||
47 | def query37():
|
||||
48 | return """
|
||||
| ____________^
|
||||
51 | | SELECT *
|
||||
52 | | FROM table
|
||||
53 | | WHERE var = %s
|
||||
54 | | """ % var
|
||||
49 | | SELECT *
|
||||
50 | | FROM table
|
||||
51 | | WHERE var = %s
|
||||
52 | | """ % var
|
||||
| |_____________^ S608
|
||||
55 |
|
||||
56 | def query38():
|
||||
53 |
|
||||
54 | def query38():
|
||||
|
|
||||
|
||||
S608.py:55:12: S608 Possible SQL injection vector through string-based query construction
|
||||
|
|
||||
55 | def query38():
|
||||
56 | return """
|
||||
54 | def query38():
|
||||
55 | return """
|
||||
| ____________^
|
||||
57 | | SELECT *
|
||||
58 | | FROM TABLE
|
||||
59 | | WHERE var =
|
||||
60 | | """ + var
|
||||
56 | | SELECT *
|
||||
57 | | FROM TABLE
|
||||
58 | | WHERE var =
|
||||
59 | | """ + var
|
||||
| |_____________^ S608
|
||||
61 |
|
||||
62 | def query39():
|
||||
60 |
|
||||
61 | def query39():
|
||||
|
|
||||
|
||||
S608.py:62:12: S608 Possible SQL injection vector through string-based query construction
|
||||
|
|
||||
62 | def query39():
|
||||
63 | return """
|
||||
61 | def query39():
|
||||
62 | return """
|
||||
| ____________^
|
||||
64 | | SELECT *
|
||||
65 | | FROM table
|
||||
66 | | WHERE var = {}
|
||||
67 | | """.format(var)
|
||||
63 | | SELECT *
|
||||
64 | | FROM table
|
||||
65 | | WHERE var = {}
|
||||
66 | | """.format(var)
|
||||
| |___________________^ S608
|
||||
68 |
|
||||
69 | def query40():
|
||||
67 |
|
||||
68 | def query40():
|
||||
|
|
||||
|
||||
S608.py:69:12: S608 Possible SQL injection vector through string-based query construction
|
||||
|
|
||||
69 | def query40():
|
||||
70 | return f"""
|
||||
68 | def query40():
|
||||
69 | return f"""
|
||||
| ____________^
|
||||
71 | | SELECT *
|
||||
72 | | FROM table
|
||||
73 | | WHERE var = {var}
|
||||
74 | | """
|
||||
70 | | SELECT *
|
||||
71 | | FROM table
|
||||
72 | | WHERE var = {var}
|
||||
73 | | """
|
||||
| |_______^ S608
|
||||
75 |
|
||||
76 | def query41():
|
||||
74 |
|
||||
75 | def query41():
|
||||
|
|
||||
|
||||
S608.py:77:9: S608 Possible SQL injection vector through string-based query construction
|
||||
|
|
||||
77 | def query41():
|
||||
78 | return (
|
||||
79 | "SELECT * "
|
||||
75 | def query41():
|
||||
76 | return (
|
||||
77 | "SELECT * "
|
||||
| _________^
|
||||
80 | | "FROM table "
|
||||
81 | | f"WHERE var = {var}"
|
||||
78 | | "FROM table "
|
||||
79 | | f"WHERE var = {var}"
|
||||
| |____________________________^ S608
|
||||
82 | )
|
||||
80 | )
|
||||
|
|
||||
|
||||
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)
|
||||
82 | # # cursor-wrapped failures
|
||||
83 | query42 = cursor.execute("SELECT * FROM table WHERE var = %s" % var)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
85 | query43 = cursor.execute(f"SELECT * FROM table WHERE var = {var}")
|
||||
86 | query44 = cursor.execute("SELECT * FROM table WHERE var = {}".format(var))
|
||||
84 | query43 = cursor.execute(f"SELECT * FROM table WHERE var = {var}")
|
||||
85 | query44 = cursor.execute("SELECT * FROM table WHERE var = {}".format(var))
|
||||
|
|
||||
|
||||
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)
|
||||
86 | query43 = cursor.execute(f"SELECT * FROM table WHERE var = {var}")
|
||||
82 | # # cursor-wrapped failures
|
||||
83 | query42 = cursor.execute("SELECT * FROM table WHERE var = %s" % var)
|
||||
84 | query43 = cursor.execute(f"SELECT * FROM table WHERE var = {var}")
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
87 | query44 = cursor.execute("SELECT * FROM table WHERE var = {}".format(var))
|
||||
88 | query45 = cursor.executemany("SELECT * FROM table WHERE var = %s" % var, [])
|
||||
85 | query44 = cursor.execute("SELECT * FROM table WHERE var = {}".format(var))
|
||||
86 | query45 = cursor.executemany("SELECT * FROM table WHERE var = %s" % var, [])
|
||||
|
|
||||
|
||||
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}")
|
||||
87 | query44 = cursor.execute("SELECT * FROM table WHERE var = {}".format(var))
|
||||
83 | query42 = cursor.execute("SELECT * FROM table WHERE var = %s" % var)
|
||||
84 | query43 = cursor.execute(f"SELECT * FROM table WHERE var = {var}")
|
||||
85 | query44 = cursor.execute("SELECT * FROM table WHERE var = {}".format(var))
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
88 | query45 = cursor.executemany("SELECT * FROM table WHERE var = %s" % var, [])
|
||||
86 | query45 = cursor.executemany("SELECT * FROM table WHERE var = %s" % var, [])
|
||||
|
|
||||
|
||||
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))
|
||||
88 | query45 = cursor.executemany("SELECT * FROM table WHERE var = %s" % var, [])
|
||||
84 | query43 = cursor.execute(f"SELECT * FROM table WHERE var = {var}")
|
||||
85 | query44 = cursor.execute("SELECT * FROM table WHERE var = {}".format(var))
|
||||
86 | query45 = cursor.executemany("SELECT * FROM table WHERE var = %s" % var, [])
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
89 |
|
||||
90 | # # pass
|
||||
87 |
|
||||
88 | # # pass
|
||||
|
|
||||
|
||||
S608.py:98:9: S608 Possible SQL injection vector through string-based query construction
|
||||
|
|
||||
98 | # # INSERT without INTO (e.g. MySQL and derivatives)
|
||||
99 | query = "INSERT table VALUES (%s)" % (var,)
|
||||
97 | # # INSERT without INTO (e.g. MySQL and derivatives)
|
||||
98 | query = "INSERT table VALUES (%s)" % (var,)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
100 |
|
||||
101 | # # REPLACE (e.g. MySQL and derivatives, SQLite)
|
||||
99 |
|
||||
100 | # # REPLACE (e.g. MySQL and derivatives, SQLite)
|
||||
|
|
||||
|
||||
S608.py:101:9: S608 Possible SQL injection vector through string-based query construction
|
||||
|
|
||||
101 | # # REPLACE (e.g. MySQL and derivatives, SQLite)
|
||||
102 | query = "REPLACE INTO table VALUES (%s)" % (var,)
|
||||
100 | # # REPLACE (e.g. MySQL and derivatives, SQLite)
|
||||
101 | query = "REPLACE INTO table VALUES (%s)" % (var,)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
103 | query = "REPLACE table VALUES (%s)" % (var,)
|
||||
102 | query = "REPLACE table VALUES (%s)" % (var,)
|
||||
|
|
||||
|
||||
S608.py:102:9: S608 Possible SQL injection vector through string-based query construction
|
||||
|
|
||||
102 | # # REPLACE (e.g. MySQL and derivatives, SQLite)
|
||||
103 | query = "REPLACE INTO table VALUES (%s)" % (var,)
|
||||
104 | query = "REPLACE table VALUES (%s)" % (var,)
|
||||
100 | # # REPLACE (e.g. MySQL and derivatives, SQLite)
|
||||
101 | query = "REPLACE INTO table VALUES (%s)" % (var,)
|
||||
102 | query = "REPLACE table VALUES (%s)" % (var,)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
105 |
|
||||
106 | query = "Deselect something that is not SQL even though it has a ' from ' somewhere in %s." % "there"
|
||||
103 |
|
||||
104 | query = "Deselect something that is not SQL even though it has a ' from ' somewhere in %s." % "there"
|
||||
|
|
||||
|
||||
|
||||
|
|
|
@ -3,39 +3,39 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
|
|||
---
|
||||
S609.py:4:1: S609 Possible wildcard injection in call due to `*` usage
|
||||
|
|
||||
4 | import subprocess
|
||||
5 |
|
||||
6 | os.popen("chmod +w foo*")
|
||||
2 | import subprocess
|
||||
3 |
|
||||
4 | os.popen("chmod +w foo*")
|
||||
| ^^^^^^^^ S609
|
||||
7 | subprocess.Popen("/bin/chown root: *", shell=True)
|
||||
8 | subprocess.Popen(["/usr/local/bin/rsync", "*", "some_where:"], shell=True)
|
||||
5 | subprocess.Popen("/bin/chown root: *", shell=True)
|
||||
6 | subprocess.Popen(["/usr/local/bin/rsync", "*", "some_where:"], shell=True)
|
||||
|
|
||||
|
||||
S609.py:5:1: S609 Possible wildcard injection in call due to `*` usage
|
||||
|
|
||||
5 | os.popen("chmod +w foo*")
|
||||
6 | subprocess.Popen("/bin/chown root: *", shell=True)
|
||||
4 | os.popen("chmod +w foo*")
|
||||
5 | subprocess.Popen("/bin/chown root: *", shell=True)
|
||||
| ^^^^^^^^^^^^^^^^ S609
|
||||
7 | subprocess.Popen(["/usr/local/bin/rsync", "*", "some_where:"], shell=True)
|
||||
8 | subprocess.Popen("/usr/local/bin/rsync * no_injection_here:")
|
||||
6 | subprocess.Popen(["/usr/local/bin/rsync", "*", "some_where:"], shell=True)
|
||||
7 | subprocess.Popen("/usr/local/bin/rsync * no_injection_here:")
|
||||
|
|
||||
|
||||
S609.py:6:1: S609 Possible wildcard injection in call due to `*` usage
|
||||
|
|
||||
6 | os.popen("chmod +w foo*")
|
||||
7 | subprocess.Popen("/bin/chown root: *", shell=True)
|
||||
8 | subprocess.Popen(["/usr/local/bin/rsync", "*", "some_where:"], shell=True)
|
||||
| ^^^^^^^^^^^^^^^^ S609
|
||||
9 | subprocess.Popen("/usr/local/bin/rsync * no_injection_here:")
|
||||
10 | os.system("tar cf foo.tar bar/*")
|
||||
|
|
||||
|
|
||||
4 | os.popen("chmod +w foo*")
|
||||
5 | subprocess.Popen("/bin/chown root: *", shell=True)
|
||||
6 | subprocess.Popen(["/usr/local/bin/rsync", "*", "some_where:"], shell=True)
|
||||
| ^^^^^^^^^^^^^^^^ S609
|
||||
7 | subprocess.Popen("/usr/local/bin/rsync * no_injection_here:")
|
||||
8 | os.system("tar cf foo.tar bar/*")
|
||||
|
|
||||
|
||||
S609.py:8:1: S609 Possible wildcard injection in call due to `*` usage
|
||||
|
|
||||
8 | subprocess.Popen(["/usr/local/bin/rsync", "*", "some_where:"], shell=True)
|
||||
9 | subprocess.Popen("/usr/local/bin/rsync * no_injection_here:")
|
||||
10 | os.system("tar cf foo.tar bar/*")
|
||||
| ^^^^^^^^^ S609
|
||||
|
|
||||
|
|
||||
6 | subprocess.Popen(["/usr/local/bin/rsync", "*", "some_where:"], shell=True)
|
||||
7 | subprocess.Popen("/usr/local/bin/rsync * no_injection_here:")
|
||||
8 | os.system("tar cf foo.tar bar/*")
|
||||
| ^^^^^^^^^ S609
|
||||
|
|
||||
|
||||
|
||||
|
|
|
@ -3,12 +3,12 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
|
|||
---
|
||||
S612.py:3:5: S612 Use of insecure `logging.config.listen` detected
|
||||
|
|
||||
3 | import logging.config
|
||||
4 |
|
||||
5 | t = logging.config.listen(9999)
|
||||
1 | import logging.config
|
||||
2 |
|
||||
3 | t = logging.config.listen(9999)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ S612
|
||||
6 |
|
||||
7 | def verify_func():
|
||||
4 |
|
||||
5 | def verify_func():
|
||||
|
|
||||
|
||||
|
||||
|
|
|
@ -3,48 +3,48 @@ source: crates/ruff/src/rules/flake8_bandit/mod.rs
|
|||
---
|
||||
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 | Environment(loader=templateLoader, load=templateLoader, autoescape=something) # S701
|
||||
7 | templateEnv = jinja2.Environment(autoescape=True,
|
||||
8 | loader=templateLoader )
|
||||
9 | Environment(loader=templateLoader, load=templateLoader, autoescape=something) # S701
|
||||
| ^^^^^^^^^ S701
|
||||
12 | templateEnv = jinja2.Environment(autoescape=False, loader=templateLoader ) # S701
|
||||
13 | Environment(loader=templateLoader,
|
||||
10 | templateEnv = jinja2.Environment(autoescape=False, loader=templateLoader ) # S701
|
||||
11 | Environment(loader=templateLoader,
|
||||
|
|
||||
|
||||
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
|
||||
12 | templateEnv = jinja2.Environment(autoescape=False, loader=templateLoader ) # S701
|
||||
8 | loader=templateLoader )
|
||||
9 | Environment(loader=templateLoader, load=templateLoader, autoescape=something) # S701
|
||||
10 | templateEnv = jinja2.Environment(autoescape=False, loader=templateLoader ) # S701
|
||||
| ^^^^^ S701
|
||||
13 | Environment(loader=templateLoader,
|
||||
14 | load=templateLoader,
|
||||
11 | Environment(loader=templateLoader,
|
||||
12 | load=templateLoader,
|
||||
|
|
||||
|
||||
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,
|
||||
15 | autoescape=False) # S701
|
||||
11 | Environment(loader=templateLoader,
|
||||
12 | load=templateLoader,
|
||||
13 | autoescape=False) # S701
|
||||
| ^^^^^ S701
|
||||
16 |
|
||||
17 | Environment(loader=templateLoader, # S701
|
||||
14 |
|
||||
15 | Environment(loader=templateLoader, # S701
|
||||
|
|
||||
|
||||
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 |
|
||||
17 | Environment(loader=templateLoader, # S701
|
||||
13 | autoescape=False) # S701
|
||||
14 |
|
||||
15 | Environment(loader=templateLoader, # S701
|
||||
| ^^^^^^^^^^^ S701
|
||||
18 | load=templateLoader)
|
||||
16 | load=templateLoader)
|
||||
|
|
||||
|
||||
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'
|
||||
31 | Environment(loader=templateLoader, autoescape=fake_func()) # S701
|
||||
27 | def fake_func():
|
||||
28 | return 'foobar'
|
||||
29 | Environment(loader=templateLoader, autoescape=fake_func()) # S701
|
||||
| ^^^^^^^^^^^ S701
|
||||
|
|
||||
|
||||
|
|
|
@ -3,95 +3,95 @@ source: crates/ruff/src/rules/flake8_blind_except/mod.rs
|
|||
---
|
||||
BLE.py:25:8: BLE001 Do not catch blind exception: `BaseException`
|
||||
|
|
||||
25 | except Exception as e:
|
||||
26 | raise e
|
||||
27 | except BaseException:
|
||||
23 | except Exception as e:
|
||||
24 | raise e
|
||||
25 | except BaseException:
|
||||
| ^^^^^^^^^^^^^ BLE001
|
||||
28 | pass
|
||||
26 | pass
|
||||
|
|
||||
|
||||
BLE.py:31:8: BLE001 Do not catch blind exception: `Exception`
|
||||
|
|
||||
31 | try:
|
||||
32 | pass
|
||||
33 | except Exception:
|
||||
29 | try:
|
||||
30 | pass
|
||||
31 | except Exception:
|
||||
| ^^^^^^^^^ BLE001
|
||||
34 | pass
|
||||
35 | finally:
|
||||
32 | pass
|
||||
33 | finally:
|
||||
|
|
||||
|
||||
BLE.py:42:8: BLE001 Do not catch blind exception: `Exception`
|
||||
|
|
||||
42 | try:
|
||||
43 | pass
|
||||
44 | except Exception as e:
|
||||
40 | try:
|
||||
41 | pass
|
||||
42 | except Exception as e:
|
||||
| ^^^^^^^^^ BLE001
|
||||
45 | try:
|
||||
46 | raise e
|
||||
43 | try:
|
||||
44 | raise e
|
||||
|
|
||||
|
||||
BLE.py:45:12: BLE001 Do not catch blind exception: `BaseException`
|
||||
|
|
||||
45 | try:
|
||||
46 | raise e
|
||||
47 | except BaseException:
|
||||
43 | try:
|
||||
44 | raise e
|
||||
45 | except BaseException:
|
||||
| ^^^^^^^^^^^^^ BLE001
|
||||
48 | pass
|
||||
46 | pass
|
||||
|
|
||||
|
||||
BLE.py:54:8: BLE001 Do not catch blind exception: `Exception`
|
||||
|
|
||||
54 | except BaseException as e:
|
||||
55 | raise e
|
||||
56 | except Exception:
|
||||
52 | except BaseException as e:
|
||||
53 | raise e
|
||||
54 | except Exception:
|
||||
| ^^^^^^^^^ BLE001
|
||||
57 | pass
|
||||
55 | pass
|
||||
|
|
||||
|
||||
BLE.py:60:8: BLE001 Do not catch blind exception: `Exception`
|
||||
|
|
||||
60 | try:
|
||||
61 | pass
|
||||
62 | except Exception as e:
|
||||
58 | try:
|
||||
59 | pass
|
||||
60 | except Exception as e:
|
||||
| ^^^^^^^^^ BLE001
|
||||
63 | raise bad
|
||||
64 | except BaseException:
|
||||
61 | raise bad
|
||||
62 | except BaseException:
|
||||
|
|
||||
|
||||
BLE.py:62:8: BLE001 Do not catch blind exception: `BaseException`
|
||||
|
|
||||
62 | except Exception as e:
|
||||
63 | raise bad
|
||||
64 | except BaseException:
|
||||
60 | except Exception as e:
|
||||
61 | raise bad
|
||||
62 | except BaseException:
|
||||
| ^^^^^^^^^^^^^ BLE001
|
||||
65 | pass
|
||||
63 | pass
|
||||
|
|
||||
|
||||
BLE.py:69:8: BLE001 Do not catch blind exception: `Exception`
|
||||
|
|
||||
69 | try:
|
||||
70 | pass
|
||||
71 | except Exception:
|
||||
67 | try:
|
||||
68 | pass
|
||||
69 | except Exception:
|
||||
| ^^^^^^^^^ BLE001
|
||||
72 | logging.error("...")
|
||||
70 | logging.error("...")
|
||||
|
|
||||
|
||||
BLE.py:75:8: BLE001 Do not catch blind exception: `Exception`
|
||||
|
|
||||
75 | try:
|
||||
76 | pass
|
||||
77 | except Exception:
|
||||
73 | try:
|
||||
74 | pass
|
||||
75 | except Exception:
|
||||
| ^^^^^^^^^ BLE001
|
||||
78 | logging.error("...", exc_info=False)
|
||||
76 | logging.error("...", exc_info=False)
|
||||
|
|
||||
|
||||
BLE.py:81:8: BLE001 Do not catch blind exception: `Exception`
|
||||
|
|
||||
81 | try:
|
||||
82 | pass
|
||||
83 | except Exception:
|
||||
79 | try:
|
||||
80 | pass
|
||||
81 | except Exception:
|
||||
| ^^^^^^^^^ BLE001
|
||||
84 | logging.error("...", exc_info=None)
|
||||
82 | logging.error("...", exc_info=None)
|
||||
|
|
||||
|
||||
|
||||
|
|
|
@ -3,90 +3,90 @@ source: crates/ruff/src/rules/flake8_boolean_trap/mod.rs
|
|||
---
|
||||
FBT.py:4:5: FBT001 Boolean positional arg in function definition
|
||||
|
|
||||
4 | posonly_nohint,
|
||||
5 | posonly_nonboolhint: int,
|
||||
6 | posonly_boolhint: bool,
|
||||
2 | posonly_nohint,
|
||||
3 | posonly_nonboolhint: int,
|
||||
4 | posonly_boolhint: bool,
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ FBT001
|
||||
7 | posonly_boolstrhint: "bool",
|
||||
8 | /,
|
||||
5 | posonly_boolstrhint: "bool",
|
||||
6 | /,
|
||||
|
|
||||
|
||||
FBT.py:5:5: FBT001 Boolean positional arg in function definition
|
||||
|
|
||||
5 | posonly_nonboolhint: int,
|
||||
6 | posonly_boolhint: bool,
|
||||
7 | posonly_boolstrhint: "bool",
|
||||
3 | posonly_nonboolhint: int,
|
||||
4 | posonly_boolhint: bool,
|
||||
5 | posonly_boolstrhint: "bool",
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ FBT001
|
||||
8 | /,
|
||||
9 | offset,
|
||||
6 | /,
|
||||
7 | offset,
|
||||
|
|
||||
|
||||
FBT.py:10:5: FBT001 Boolean positional arg in function definition
|
||||
|
|
||||
10 | posorkw_nonvalued_nohint,
|
||||
11 | posorkw_nonvalued_nonboolhint: int,
|
||||
12 | posorkw_nonvalued_boolhint: bool,
|
||||
8 | posorkw_nonvalued_nohint,
|
||||
9 | posorkw_nonvalued_nonboolhint: int,
|
||||
10 | posorkw_nonvalued_boolhint: bool,
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FBT001
|
||||
13 | posorkw_nonvalued_boolstrhint: "bool",
|
||||
14 | posorkw_boolvalued_nohint=True,
|
||||
11 | posorkw_nonvalued_boolstrhint: "bool",
|
||||
12 | posorkw_boolvalued_nohint=True,
|
||||
|
|
||||
|
||||
FBT.py:11:5: FBT001 Boolean positional arg in function definition
|
||||
|
|
||||
11 | posorkw_nonvalued_nonboolhint: int,
|
||||
12 | posorkw_nonvalued_boolhint: bool,
|
||||
13 | posorkw_nonvalued_boolstrhint: "bool",
|
||||
9 | posorkw_nonvalued_nonboolhint: int,
|
||||
10 | posorkw_nonvalued_boolhint: bool,
|
||||
11 | posorkw_nonvalued_boolstrhint: "bool",
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FBT001
|
||||
14 | posorkw_boolvalued_nohint=True,
|
||||
15 | posorkw_boolvalued_nonboolhint: int = True,
|
||||
12 | posorkw_boolvalued_nohint=True,
|
||||
13 | posorkw_boolvalued_nonboolhint: int = True,
|
||||
|
|
||||
|
||||
FBT.py:14:5: FBT001 Boolean positional arg in function definition
|
||||
|
|
||||
14 | posorkw_boolvalued_nohint=True,
|
||||
15 | posorkw_boolvalued_nonboolhint: int = True,
|
||||
16 | posorkw_boolvalued_boolhint: bool = True,
|
||||
12 | posorkw_boolvalued_nohint=True,
|
||||
13 | posorkw_boolvalued_nonboolhint: int = True,
|
||||
14 | posorkw_boolvalued_boolhint: bool = True,
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FBT001
|
||||
17 | posorkw_boolvalued_boolstrhint: "bool" = True,
|
||||
18 | posorkw_nonboolvalued_nohint=1,
|
||||
15 | posorkw_boolvalued_boolstrhint: "bool" = True,
|
||||
16 | posorkw_nonboolvalued_nohint=1,
|
||||
|
|
||||
|
||||
FBT.py:15:5: FBT001 Boolean positional arg in function definition
|
||||
|
|
||||
15 | posorkw_boolvalued_nonboolhint: int = True,
|
||||
16 | posorkw_boolvalued_boolhint: bool = True,
|
||||
17 | posorkw_boolvalued_boolstrhint: "bool" = True,
|
||||
13 | posorkw_boolvalued_nonboolhint: int = True,
|
||||
14 | posorkw_boolvalued_boolhint: bool = True,
|
||||
15 | posorkw_boolvalued_boolstrhint: "bool" = True,
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FBT001
|
||||
18 | posorkw_nonboolvalued_nohint=1,
|
||||
19 | posorkw_nonboolvalued_nonboolhint: int = 2,
|
||||
16 | posorkw_nonboolvalued_nohint=1,
|
||||
17 | posorkw_nonboolvalued_nonboolhint: int = 2,
|
||||
|
|
||||
|
||||
FBT.py:18:5: FBT001 Boolean positional arg in function definition
|
||||
|
|
||||
18 | posorkw_nonboolvalued_nohint=1,
|
||||
19 | posorkw_nonboolvalued_nonboolhint: int = 2,
|
||||
20 | posorkw_nonboolvalued_boolhint: bool = 3,
|
||||
16 | posorkw_nonboolvalued_nohint=1,
|
||||
17 | posorkw_nonboolvalued_nonboolhint: int = 2,
|
||||
18 | posorkw_nonboolvalued_boolhint: bool = 3,
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FBT001
|
||||
21 | posorkw_nonboolvalued_boolstrhint: "bool" = 4,
|
||||
22 | *,
|
||||
19 | posorkw_nonboolvalued_boolstrhint: "bool" = 4,
|
||||
20 | *,
|
||||
|
|
||||
|
||||
FBT.py:19:5: FBT001 Boolean positional arg in function definition
|
||||
|
|
||||
19 | posorkw_nonboolvalued_nonboolhint: int = 2,
|
||||
20 | posorkw_nonboolvalued_boolhint: bool = 3,
|
||||
21 | posorkw_nonboolvalued_boolstrhint: "bool" = 4,
|
||||
17 | posorkw_nonboolvalued_nonboolhint: int = 2,
|
||||
18 | posorkw_nonboolvalued_boolhint: bool = 3,
|
||||
19 | posorkw_nonboolvalued_boolstrhint: "bool" = 4,
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FBT001
|
||||
22 | *,
|
||||
23 | kwonly_nonvalued_nohint,
|
||||
20 | *,
|
||||
21 | kwonly_nonvalued_nohint,
|
||||
|
|
||||
|
||||
FBT.py:85:19: FBT001 Boolean positional arg in function definition
|
||||
|
|
||||
85 | # FBT001: Boolean positional arg in function definition
|
||||
86 | def foo(self, value: bool) -> None:
|
||||
84 | # FBT001: Boolean positional arg in function definition
|
||||
85 | def foo(self, value: bool) -> None:
|
||||
| ^^^^^^^^^^^ FBT001
|
||||
87 | pass
|
||||
86 | pass
|
||||
|
|
||||
|
||||
|
||||
|
|
|
@ -3,42 +3,42 @@ source: crates/ruff/src/rules/flake8_boolean_trap/mod.rs
|
|||
---
|
||||
FBT.py:12:31: FBT002 Boolean default value in function definition
|
||||
|
|
||||
12 | posorkw_nonvalued_boolhint: bool,
|
||||
13 | posorkw_nonvalued_boolstrhint: "bool",
|
||||
14 | posorkw_boolvalued_nohint=True,
|
||||
10 | posorkw_nonvalued_boolhint: bool,
|
||||
11 | posorkw_nonvalued_boolstrhint: "bool",
|
||||
12 | posorkw_boolvalued_nohint=True,
|
||||
| ^^^^ FBT002
|
||||
15 | posorkw_boolvalued_nonboolhint: int = True,
|
||||
16 | posorkw_boolvalued_boolhint: bool = True,
|
||||
13 | posorkw_boolvalued_nonboolhint: int = True,
|
||||
14 | posorkw_boolvalued_boolhint: bool = True,
|
||||
|
|
||||
|
||||
FBT.py:13:43: FBT002 Boolean default value in function definition
|
||||
|
|
||||
13 | posorkw_nonvalued_boolstrhint: "bool",
|
||||
14 | posorkw_boolvalued_nohint=True,
|
||||
15 | posorkw_boolvalued_nonboolhint: int = True,
|
||||
11 | posorkw_nonvalued_boolstrhint: "bool",
|
||||
12 | posorkw_boolvalued_nohint=True,
|
||||
13 | posorkw_boolvalued_nonboolhint: int = True,
|
||||
| ^^^^ FBT002
|
||||
16 | posorkw_boolvalued_boolhint: bool = True,
|
||||
17 | posorkw_boolvalued_boolstrhint: "bool" = True,
|
||||
14 | posorkw_boolvalued_boolhint: bool = True,
|
||||
15 | posorkw_boolvalued_boolstrhint: "bool" = True,
|
||||
|
|
||||
|
||||
FBT.py:14:41: FBT002 Boolean default value in function definition
|
||||
|
|
||||
14 | posorkw_boolvalued_nohint=True,
|
||||
15 | posorkw_boolvalued_nonboolhint: int = True,
|
||||
16 | posorkw_boolvalued_boolhint: bool = True,
|
||||
12 | posorkw_boolvalued_nohint=True,
|
||||
13 | posorkw_boolvalued_nonboolhint: int = True,
|
||||
14 | posorkw_boolvalued_boolhint: bool = True,
|
||||
| ^^^^ FBT002
|
||||
17 | posorkw_boolvalued_boolstrhint: "bool" = True,
|
||||
18 | posorkw_nonboolvalued_nohint=1,
|
||||
15 | posorkw_boolvalued_boolstrhint: "bool" = True,
|
||||
16 | posorkw_nonboolvalued_nohint=1,
|
||||
|
|
||||
|
||||
FBT.py:15:46: FBT002 Boolean default value in function definition
|
||||
|
|
||||
15 | posorkw_boolvalued_nonboolhint: int = True,
|
||||
16 | posorkw_boolvalued_boolhint: bool = True,
|
||||
17 | posorkw_boolvalued_boolstrhint: "bool" = True,
|
||||
13 | posorkw_boolvalued_nonboolhint: int = True,
|
||||
14 | posorkw_boolvalued_boolhint: bool = True,
|
||||
15 | posorkw_boolvalued_boolstrhint: "bool" = True,
|
||||
| ^^^^ FBT002
|
||||
18 | posorkw_nonboolvalued_nohint=1,
|
||||
19 | posorkw_nonboolvalued_nonboolhint: int = 2,
|
||||
16 | posorkw_nonboolvalued_nohint=1,
|
||||
17 | posorkw_nonboolvalued_nonboolhint: int = 2,
|
||||
|
|
||||
|
||||
|
||||
|
|
|
@ -10,29 +10,29 @@ FBT.py:42: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)
|
||||
59 | {}.deploy(True, False)
|
||||
55 | {}.pop(True, False)
|
||||
56 | dict.fromkeys(("world",), True)
|
||||
57 | {}.deploy(True, False)
|
||||
| ^^^^ FBT003
|
||||
60 | getattr(someobj, attrname, False)
|
||||
61 | mylist.index(True)
|
||||
58 | getattr(someobj, attrname, False)
|
||||
59 | mylist.index(True)
|
||||
|
|
||||
|
||||
FBT.py:57:17: FBT003 Boolean positional value in function call
|
||||
|
|
||||
57 | {}.pop(True, False)
|
||||
58 | dict.fromkeys(("world",), True)
|
||||
59 | {}.deploy(True, False)
|
||||
55 | {}.pop(True, False)
|
||||
56 | dict.fromkeys(("world",), True)
|
||||
57 | {}.deploy(True, False)
|
||||
| ^^^^^ FBT003
|
||||
60 | getattr(someobj, attrname, False)
|
||||
61 | mylist.index(True)
|
||||
58 | getattr(someobj, attrname, False)
|
||||
59 | mylist.index(True)
|
||||
|
|
||||
|
||||
FBT.py:69:38: FBT003 Boolean positional value in function call
|
||||
|
|
||||
69 | os.set_blocking(0, False)
|
||||
70 | g_action.set_enabled(True)
|
||||
71 | settings.set_enable_developer_extras(True)
|
||||
67 | os.set_blocking(0, False)
|
||||
68 | g_action.set_enabled(True)
|
||||
69 | settings.set_enable_developer_extras(True)
|
||||
| ^^^^ FBT003
|
||||
|
|
||||
|
||||
|
|
|
@ -3,16 +3,16 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
|
|||
---
|
||||
B002.py:15:9: B002 Python does not support the unary prefix increment
|
||||
|
|
||||
15 | def this_is_buggy(n):
|
||||
16 | x = ++n
|
||||
14 | def this_is_buggy(n):
|
||||
15 | x = ++n
|
||||
| ^^^ B002
|
||||
17 | return x
|
||||
16 | return x
|
||||
|
|
||||
|
||||
B002.py:20:12: B002 Python does not support the unary prefix increment
|
||||
|
|
||||
20 | def this_is_buggy_too(n):
|
||||
21 | return ++n
|
||||
19 | def this_is_buggy_too(n):
|
||||
20 | return ++n
|
||||
| ^^^ B002
|
||||
|
|
||||
|
||||
|
|
|
@ -3,11 +3,11 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
|
|||
---
|
||||
B003.py:9:1: B003 Assigning to `os.environ` doesn't clear the environment
|
||||
|
|
||||
9 | from os import environ
|
||||
10 |
|
||||
11 | os.environ = {}
|
||||
7 | from os import environ
|
||||
8 |
|
||||
9 | os.environ = {}
|
||||
| ^^^^^^^^^^ B003
|
||||
12 | environ = {} # that's fine, assigning a new meaning to the module-level name
|
||||
10 | environ = {} # that's fine, assigning a new meaning to the module-level name
|
||||
|
|
||||
|
||||
|
||||
|
|
|
@ -3,21 +3,21 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
|
|||
---
|
||||
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()
|
||||
5 | if hasattr(o, "__call__"):
|
||||
1 | def this_is_a_bug():
|
||||
2 | o = object()
|
||||
3 | if hasattr(o, "__call__"):
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ B004
|
||||
6 | print("Ooh, callable! Or is it?")
|
||||
7 | if getattr(o, "__call__", False):
|
||||
4 | print("Ooh, callable! Or is it?")
|
||||
5 | if getattr(o, "__call__", False):
|
||||
|
|
||||
|
||||
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?")
|
||||
7 | if getattr(o, "__call__", False):
|
||||
3 | if hasattr(o, "__call__"):
|
||||
4 | print("Ooh, callable! Or is it?")
|
||||
5 | if getattr(o, "__call__", False):
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ B004
|
||||
8 | print("Ooh, callable! Or is it?")
|
||||
6 | print("Ooh, callable! Or is it?")
|
||||
|
|
||||
|
||||
|
||||
|
|
|
@ -3,82 +3,82 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
|
|||
---
|
||||
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
|
||||
6 | s.strip(".facebook.com") # warning
|
||||
2 | s.strip(s) # no warning
|
||||
3 | s.strip("we") # no warning
|
||||
4 | s.strip(".facebook.com") # warning
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ B005
|
||||
7 | s.strip("e") # no warning
|
||||
8 | s.strip("\n\t ") # no warning
|
||||
5 | s.strip("e") # no warning
|
||||
6 | s.strip("\n\t ") # no warning
|
||||
|
|
||||
|
||||
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
|
||||
9 | s.strip(r"\n\t ") # warning
|
||||
| ^^^^^^^^^^^^^^^^^ B005
|
||||
10 | s.lstrip(s) # no warning
|
||||
11 | s.lstrip("we") # no warning
|
||||
|
|
||||
|
|
||||
5 | s.strip("e") # no warning
|
||||
6 | s.strip("\n\t ") # no warning
|
||||
7 | s.strip(r"\n\t ") # warning
|
||||
| ^^^^^^^^^^^^^^^^^ B005
|
||||
8 | s.lstrip(s) # no warning
|
||||
9 | s.lstrip("we") # no warning
|
||||
|
|
||||
|
||||
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
|
||||
12 | s.lstrip(".facebook.com") # warning
|
||||
8 | s.lstrip(s) # no warning
|
||||
9 | s.lstrip("we") # no warning
|
||||
10 | s.lstrip(".facebook.com") # warning
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ B005
|
||||
13 | s.lstrip("e") # no warning
|
||||
14 | s.lstrip("\n\t ") # no warning
|
||||
11 | s.lstrip("e") # no warning
|
||||
12 | s.lstrip("\n\t ") # no warning
|
||||
|
|
||||
|
||||
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
|
||||
15 | s.lstrip(r"\n\t ") # warning
|
||||
11 | s.lstrip("e") # no warning
|
||||
12 | s.lstrip("\n\t ") # no warning
|
||||
13 | s.lstrip(r"\n\t ") # warning
|
||||
| ^^^^^^^^^^^^^^^^^^ B005
|
||||
16 | s.rstrip(s) # no warning
|
||||
17 | s.rstrip("we") # warning
|
||||
14 | s.rstrip(s) # no warning
|
||||
15 | s.rstrip("we") # warning
|
||||
|
|
||||
|
||||
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
|
||||
18 | s.rstrip(".facebook.com") # warning
|
||||
14 | s.rstrip(s) # no warning
|
||||
15 | s.rstrip("we") # warning
|
||||
16 | s.rstrip(".facebook.com") # warning
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ B005
|
||||
19 | s.rstrip("e") # no warning
|
||||
20 | s.rstrip("\n\t ") # no warning
|
||||
17 | s.rstrip("e") # no warning
|
||||
18 | s.rstrip("\n\t ") # no warning
|
||||
|
|
||||
|
||||
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
|
||||
21 | s.rstrip(r"\n\t ") # warning
|
||||
17 | s.rstrip("e") # no warning
|
||||
18 | s.rstrip("\n\t ") # no warning
|
||||
19 | s.rstrip(r"\n\t ") # warning
|
||||
| ^^^^^^^^^^^^^^^^^^ B005
|
||||
22 | s.strip("a") # no warning
|
||||
23 | s.strip("あ") # no warning
|
||||
20 | s.strip("a") # no warning
|
||||
21 | s.strip("あ") # no warning
|
||||
|
|
||||
|
||||
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
|
||||
24 | s.strip("ああ") # warning
|
||||
20 | s.strip("a") # no warning
|
||||
21 | s.strip("あ") # no warning
|
||||
22 | s.strip("ああ") # warning
|
||||
| ^^^^^^^^^^^^^^^ B005
|
||||
25 | s.strip("\ufeff") # no warning
|
||||
26 | s.strip("\u0074\u0065\u0073\u0074") # warning
|
||||
23 | s.strip("\ufeff") # no warning
|
||||
24 | s.strip("\u0074\u0065\u0073\u0074") # warning
|
||||
|
|
||||
|
||||
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
|
||||
26 | s.strip("\u0074\u0065\u0073\u0074") # warning
|
||||
22 | s.strip("ああ") # warning
|
||||
23 | s.strip("\ufeff") # no warning
|
||||
24 | s.strip("\u0074\u0065\u0073\u0074") # warning
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ B005
|
||||
27 |
|
||||
28 | from somewhere import other_type, strip
|
||||
25 |
|
||||
26 | from somewhere import other_type, strip
|
||||
|
|
||||
|
||||
|
||||
|
|
|
@ -45,10 +45,10 @@ B006_B008.py:83:26: B006 Do not use mutable data structures for argument default
|
|||
|
||||
B006_B008.py:88:46: B006 Do not use mutable data structures for argument defaults
|
||||
|
|
||||
88 | # N.B. we're also flagging the function call in the comprehension
|
||||
89 | def list_comprehension_also_not_okay(default=[i**2 for i in range(3)]):
|
||||
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)]):
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ B006
|
||||
90 | pass
|
||||
89 | pass
|
||||
|
|
||||
|
||||
B006_B008.py:92:46: B006 Do not use mutable data structures for argument defaults
|
||||
|
@ -74,40 +74,40 @@ B006_B008.py:100:33: B006 Do not use mutable data structures for argument defaul
|
|||
|
||||
B006_B008.py:218:20: B006 Do not use mutable data structures for argument defaults
|
||||
|
|
||||
218 | # B006 and B008
|
||||
219 | # We should handle arbitrary nesting of these B008.
|
||||
220 | def nested_combo(a=[float(3), dt.datetime.now()]):
|
||||
216 | # B006 and B008
|
||||
217 | # We should handle arbitrary nesting of these B008.
|
||||
218 | def nested_combo(a=[float(3), dt.datetime.now()]):
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ B006
|
||||
221 | pass
|
||||
219 | pass
|
||||
|
|
||||
|
||||
B006_B008.py:251:27: B006 Do not use mutable data structures for argument defaults
|
||||
|
|
||||
251 | def mutable_annotations(
|
||||
252 | a: list[int] | None = [],
|
||||
250 | def mutable_annotations(
|
||||
251 | a: list[int] | None = [],
|
||||
| ^^ B006
|
||||
253 | b: Optional[Dict[int, int]] = {},
|
||||
254 | c: Annotated[Union[Set[str], abc.Sized], "annotation"] = set(),
|
||||
252 | b: Optional[Dict[int, int]] = {},
|
||||
253 | c: Annotated[Union[Set[str], abc.Sized], "annotation"] = set(),
|
||||
|
|
||||
|
||||
B006_B008.py:252:35: B006 Do not use mutable data structures for argument defaults
|
||||
|
|
||||
252 | def mutable_annotations(
|
||||
253 | a: list[int] | None = [],
|
||||
254 | b: Optional[Dict[int, int]] = {},
|
||||
250 | def mutable_annotations(
|
||||
251 | a: list[int] | None = [],
|
||||
252 | b: Optional[Dict[int, int]] = {},
|
||||
| ^^ B006
|
||||
255 | c: Annotated[Union[Set[str], abc.Sized], "annotation"] = set(),
|
||||
256 | ):
|
||||
253 | c: Annotated[Union[Set[str], abc.Sized], "annotation"] = set(),
|
||||
254 | ):
|
||||
|
|
||||
|
||||
B006_B008.py:253:62: B006 Do not use mutable data structures for argument defaults
|
||||
|
|
||||
253 | a: list[int] | None = [],
|
||||
254 | b: Optional[Dict[int, int]] = {},
|
||||
255 | c: Annotated[Union[Set[str], abc.Sized], "annotation"] = set(),
|
||||
251 | a: list[int] | None = [],
|
||||
252 | b: Optional[Dict[int, int]] = {},
|
||||
253 | c: Annotated[Union[Set[str], abc.Sized], "annotation"] = set(),
|
||||
| ^^^^^ B006
|
||||
256 | ):
|
||||
257 | pass
|
||||
254 | ):
|
||||
255 | pass
|
||||
|
|
||||
|
||||
|
||||
|
|
|
@ -3,21 +3,21 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
|
|||
---
|
||||
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 |
|
||||
8 | for i in range(10): # name not used within the loop; B007
|
||||
4 | print(i) # name no longer defined on Python 3; no warning yet
|
||||
5 |
|
||||
6 | for i in range(10): # name not used within the loop; B007
|
||||
| ^ B007
|
||||
9 | print(10)
|
||||
7 | print(10)
|
||||
|
|
||||
= help: Rename unused `i` to `_i`
|
||||
|
||||
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):
|
||||
20 | for k in range(10): # k not used, i and j used transitively
|
||||
16 | for i in range(10):
|
||||
17 | for j in range(10):
|
||||
18 | for k in range(10): # k not used, i and j used transitively
|
||||
| ^ B007
|
||||
21 | print(i + j)
|
||||
19 | print(i + j)
|
||||
|
|
||||
= help: Rename unused `k` to `_k`
|
||||
|
||||
|
@ -59,54 +59,54 @@ B007.py:30:13: B007 [*] Loop control variable `k` not 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)]:
|
||||
33 | FMT = "{foo} {bar}"
|
||||
34 | for foo, bar in [(1, 2)]:
|
||||
| ^^^ B007
|
||||
36 | if foo:
|
||||
37 | print(FMT.format(**locals()))
|
||||
35 | if foo:
|
||||
36 | print(FMT.format(**locals()))
|
||||
|
|
||||
= help: Rename unused `bar` to `_bar`
|
||||
|
||||
B007.py:38:10: B007 Loop control variable `bar` may not be used within loop body
|
||||
|
|
||||
38 | print(FMT.format(**locals()))
|
||||
39 |
|
||||
40 | for foo, bar in [(1, 2)]:
|
||||
36 | print(FMT.format(**locals()))
|
||||
37 |
|
||||
38 | for foo, bar in [(1, 2)]:
|
||||
| ^^^ B007
|
||||
41 | if foo:
|
||||
42 | print(FMT.format(**globals()))
|
||||
39 | if foo:
|
||||
40 | print(FMT.format(**globals()))
|
||||
|
|
||||
= help: Rename unused `bar` to `_bar`
|
||||
|
||||
B007.py:42:10: B007 Loop control variable `bar` may not be used within loop body
|
||||
|
|
||||
42 | print(FMT.format(**globals()))
|
||||
43 |
|
||||
44 | for foo, bar in [(1, 2)]:
|
||||
40 | print(FMT.format(**globals()))
|
||||
41 |
|
||||
42 | for foo, bar in [(1, 2)]:
|
||||
| ^^^ B007
|
||||
45 | if foo:
|
||||
46 | print(FMT.format(**vars()))
|
||||
43 | if foo:
|
||||
44 | print(FMT.format(**vars()))
|
||||
|
|
||||
= help: Rename unused `bar` to `_bar`
|
||||
|
||||
B007.py:46:10: B007 Loop control variable `bar` may not be used within loop body
|
||||
|
|
||||
46 | print(FMT.format(**vars()))
|
||||
47 |
|
||||
48 | for foo, bar in [(1, 2)]:
|
||||
44 | print(FMT.format(**vars()))
|
||||
45 |
|
||||
46 | for foo, bar in [(1, 2)]:
|
||||
| ^^^ B007
|
||||
49 | print(FMT.format(foo=foo, bar=eval("bar")))
|
||||
47 | print(FMT.format(foo=foo, bar=eval("bar")))
|
||||
|
|
||||
= help: Rename unused `bar` to `_bar`
|
||||
|
||||
B007.py:52:14: B007 [*] Loop control variable `bar` not used within loop body
|
||||
|
|
||||
52 | def f():
|
||||
53 | # Fixable.
|
||||
54 | for foo, bar, baz in (["1", "2", "3"],):
|
||||
50 | def f():
|
||||
51 | # Fixable.
|
||||
52 | for foo, bar, baz in (["1", "2", "3"],):
|
||||
| ^^^ B007
|
||||
55 | if foo or baz:
|
||||
56 | break
|
||||
53 | if foo or baz:
|
||||
54 | break
|
||||
|
|
||||
= help: Rename unused `bar` to `_bar`
|
||||
|
||||
|
@ -122,23 +122,23 @@ B007.py:52: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.
|
||||
61 | for foo, bar, baz in (["1", "2", "3"],):
|
||||
57 | def f():
|
||||
58 | # Unfixable due to usage of `bar` outside of loop.
|
||||
59 | for foo, bar, baz in (["1", "2", "3"],):
|
||||
| ^^^ B007
|
||||
62 | if foo or baz:
|
||||
63 | break
|
||||
60 | if foo or baz:
|
||||
61 | break
|
||||
|
|
||||
= help: Rename unused `bar` to `_bar`
|
||||
|
||||
B007.py:68:14: B007 [*] Loop control variable `bar` not used within loop body
|
||||
|
|
||||
68 | def f():
|
||||
69 | # Fixable.
|
||||
70 | for foo, bar, baz in (["1", "2", "3"],):
|
||||
66 | def f():
|
||||
67 | # Fixable.
|
||||
68 | for foo, bar, baz in (["1", "2", "3"],):
|
||||
| ^^^ B007
|
||||
71 | if foo or baz:
|
||||
72 | break
|
||||
69 | if foo or baz:
|
||||
70 | break
|
||||
|
|
||||
= help: Rename unused `bar` to `_bar`
|
||||
|
||||
|
@ -154,33 +154,33 @@ B007.py:68: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 | # Unfixable.
|
||||
79 | for foo, bar, baz in (["1", "2", "3"],):
|
||||
75 | def f():
|
||||
76 | # Unfixable.
|
||||
77 | for foo, bar, baz in (["1", "2", "3"],):
|
||||
| ^^^ B007
|
||||
80 | if foo or baz:
|
||||
81 | break
|
||||
78 | if foo or baz:
|
||||
79 | break
|
||||
|
|
||||
= help: Rename unused `bar` to `_bar`
|
||||
|
||||
B007.py:88:14: B007 Loop control variable `bar` not used within loop body
|
||||
|
|
||||
88 | def f():
|
||||
89 | # Unfixable (false negative) due to usage of `bar` outside of loop.
|
||||
90 | for foo, bar, baz in (["1", "2", "3"],):
|
||||
86 | def f():
|
||||
87 | # Unfixable (false negative) due to usage of `bar` outside of loop.
|
||||
88 | for foo, bar, baz in (["1", "2", "3"],):
|
||||
| ^^^ B007
|
||||
91 | if foo or baz:
|
||||
92 | break
|
||||
89 | if foo or baz:
|
||||
90 | break
|
||||
|
|
||||
= help: Rename unused `bar` to `_bar`
|
||||
|
||||
B007.py:98:5: B007 Loop control variable `line_` not used within loop body
|
||||
|
|
||||
98 | # Unfixable due to trailing underscore (`_line_` wouldn't be considered an ignorable
|
||||
99 | # variable name).
|
||||
100 | for line_ in range(self.header_lines):
|
||||
| ^^^^^ B007
|
||||
101 | fp.readline()
|
||||
|
|
||||
|
|
||||
96 | # Unfixable due to trailing underscore (`_line_` wouldn't be considered an ignorable
|
||||
97 | # variable name).
|
||||
98 | for line_ in range(self.header_lines):
|
||||
| ^^^^^ B007
|
||||
99 | fp.readline()
|
||||
|
|
||||
|
||||
|
||||
|
|
|
@ -3,10 +3,10 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
|
|||
---
|
||||
B006_B008.py:88:61: B008 Do not perform function call `range` in argument defaults
|
||||
|
|
||||
88 | # N.B. we're also flagging the function call in the comprehension
|
||||
89 | def list_comprehension_also_not_okay(default=[i**2 for i in range(3)]):
|
||||
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)]):
|
||||
| ^^^^^^^^ B008
|
||||
90 | pass
|
||||
89 | pass
|
||||
|
|
||||
|
||||
B006_B008.py:92:64: B008 Do not perform function call `range` in argument defaults
|
||||
|
@ -25,11 +25,11 @@ B006_B008.py:96:60: B008 Do not perform function call `range` in argument defaul
|
|||
|
||||
B006_B008.py:112:39: B008 Do not perform function call `time.time` in argument defaults
|
||||
|
|
||||
112 | # B008
|
||||
113 | # Flag function calls as default args (including if they are part of a sub-expression)
|
||||
114 | def in_fact_all_calls_are_wrong(value=time.time()):
|
||||
110 | # B008
|
||||
111 | # Flag function calls as default args (including if they are part of a sub-expression)
|
||||
112 | def in_fact_all_calls_are_wrong(value=time.time()):
|
||||
| ^^^^^^^^^^^ B008
|
||||
115 | ...
|
||||
113 | ...
|
||||
|
|
||||
|
||||
B006_B008.py:116:12: B008 Do not perform function call `dt.datetime.now` in argument defaults
|
||||
|
@ -48,36 +48,36 @@ B006_B008.py:120:30: B008 Do not perform function call in argument defaults
|
|||
|
||||
B006_B008.py:218:31: B008 Do not perform function call `dt.datetime.now` in argument defaults
|
||||
|
|
||||
218 | # B006 and B008
|
||||
219 | # We should handle arbitrary nesting of these B008.
|
||||
220 | def nested_combo(a=[float(3), dt.datetime.now()]):
|
||||
216 | # B006 and B008
|
||||
217 | # We should handle arbitrary nesting of these B008.
|
||||
218 | def nested_combo(a=[float(3), dt.datetime.now()]):
|
||||
| ^^^^^^^^^^^^^^^^^ B008
|
||||
221 | pass
|
||||
219 | pass
|
||||
|
|
||||
|
||||
B006_B008.py:224:22: B008 Do not perform function call `map` in argument defaults
|
||||
|
|
||||
224 | # Don't flag nested B006 since we can't guarantee that
|
||||
225 | # it isn't made mutable by the outer operation.
|
||||
226 | def no_nested_b006(a=map(lambda s: s.upper(), ["a", "b", "c"])):
|
||||
222 | # Don't flag nested B006 since we can't guarantee that
|
||||
223 | # it isn't made mutable by the outer operation.
|
||||
224 | def no_nested_b006(a=map(lambda s: s.upper(), ["a", "b", "c"])):
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ B008
|
||||
227 | pass
|
||||
225 | pass
|
||||
|
|
||||
|
||||
B006_B008.py:229:19: B008 Do not perform function call `random.randint` in argument defaults
|
||||
|
|
||||
229 | # B008-ception.
|
||||
230 | def nested_b008(a=random.randint(0, dt.datetime.now().year)):
|
||||
228 | # B008-ception.
|
||||
229 | def nested_b008(a=random.randint(0, dt.datetime.now().year)):
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ B008
|
||||
231 | pass
|
||||
230 | pass
|
||||
|
|
||||
|
||||
B006_B008.py:229:37: B008 Do not perform function call `dt.datetime.now` in argument defaults
|
||||
|
|
||||
229 | # B008-ception.
|
||||
230 | def nested_b008(a=random.randint(0, dt.datetime.now().year)):
|
||||
228 | # B008-ception.
|
||||
229 | def nested_b008(a=random.randint(0, dt.datetime.now().year)):
|
||||
| ^^^^^^^^^^^^^^^^^ B008
|
||||
231 | pass
|
||||
230 | pass
|
||||
|
|
||||
|
||||
|
||||
|
|
|
@ -3,11 +3,11 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
|
|||
---
|
||||
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")
|
||||
18 | # Invalid usage
|
||||
19 | getattr(foo, "bar")
|
||||
| ^^^^^^^^^^^^^^^^^^^ B009
|
||||
21 | getattr(foo, "_123abc")
|
||||
22 | getattr(foo, "__123abc__")
|
||||
20 | getattr(foo, "_123abc")
|
||||
21 | getattr(foo, "__123abc__")
|
||||
|
|
||||
= help: Replace `getattr` with attribute access
|
||||
|
||||
|
@ -23,12 +23,12 @@ B009_B010.py:19:1: B009 [*] Do not call `getattr` with a constant attribute valu
|
|||
|
||||
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")
|
||||
22 | getattr(foo, "_123abc")
|
||||
18 | # Invalid usage
|
||||
19 | getattr(foo, "bar")
|
||||
20 | getattr(foo, "_123abc")
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ B009
|
||||
23 | getattr(foo, "__123abc__")
|
||||
24 | getattr(foo, "abc123")
|
||||
21 | getattr(foo, "__123abc__")
|
||||
22 | getattr(foo, "abc123")
|
||||
|
|
||||
= help: Replace `getattr` with attribute access
|
||||
|
||||
|
@ -44,12 +44,12 @@ B009_B010.py:20:1: B009 [*] Do not call `getattr` with a constant attribute valu
|
|||
|
||||
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")
|
||||
23 | getattr(foo, "__123abc__")
|
||||
19 | getattr(foo, "bar")
|
||||
20 | getattr(foo, "_123abc")
|
||||
21 | getattr(foo, "__123abc__")
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ B009
|
||||
24 | getattr(foo, "abc123")
|
||||
25 | getattr(foo, r"abc123")
|
||||
22 | getattr(foo, "abc123")
|
||||
23 | getattr(foo, r"abc123")
|
||||
|
|
||||
= help: Replace `getattr` with attribute access
|
||||
|
||||
|
@ -65,12 +65,12 @@ B009_B010.py:21:1: B009 [*] Do not call `getattr` with a constant attribute valu
|
|||
|
||||
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__")
|
||||
24 | getattr(foo, "abc123")
|
||||
20 | getattr(foo, "_123abc")
|
||||
21 | getattr(foo, "__123abc__")
|
||||
22 | getattr(foo, "abc123")
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ B009
|
||||
25 | getattr(foo, r"abc123")
|
||||
26 | _ = lambda x: getattr(x, "bar")
|
||||
23 | getattr(foo, r"abc123")
|
||||
24 | _ = lambda x: getattr(x, "bar")
|
||||
|
|
||||
= help: Replace `getattr` with attribute access
|
||||
|
||||
|
@ -86,12 +86,12 @@ B009_B010.py:22:1: B009 [*] Do not call `getattr` with a constant attribute valu
|
|||
|
||||
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")
|
||||
25 | getattr(foo, r"abc123")
|
||||
21 | getattr(foo, "__123abc__")
|
||||
22 | getattr(foo, "abc123")
|
||||
23 | getattr(foo, r"abc123")
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ B009
|
||||
26 | _ = lambda x: getattr(x, "bar")
|
||||
27 | if getattr(x, "bar"):
|
||||
24 | _ = lambda x: getattr(x, "bar")
|
||||
25 | if getattr(x, "bar"):
|
||||
|
|
||||
= help: Replace `getattr` with attribute access
|
||||
|
||||
|
@ -107,12 +107,12 @@ B009_B010.py:23:1: B009 [*] Do not call `getattr` with a constant attribute valu
|
|||
|
||||
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")
|
||||
26 | _ = lambda x: getattr(x, "bar")
|
||||
22 | getattr(foo, "abc123")
|
||||
23 | getattr(foo, r"abc123")
|
||||
24 | _ = lambda x: getattr(x, "bar")
|
||||
| ^^^^^^^^^^^^^^^^^ B009
|
||||
27 | if getattr(x, "bar"):
|
||||
28 | pass
|
||||
25 | if getattr(x, "bar"):
|
||||
26 | pass
|
||||
|
|
||||
= help: Replace `getattr` with attribute access
|
||||
|
||||
|
@ -128,11 +128,11 @@ B009_B010.py:24:15: B009 [*] Do not call `getattr` with a constant attribute val
|
|||
|
||||
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")
|
||||
27 | if getattr(x, "bar"):
|
||||
23 | getattr(foo, r"abc123")
|
||||
24 | _ = lambda x: getattr(x, "bar")
|
||||
25 | if getattr(x, "bar"):
|
||||
| ^^^^^^^^^^^^^^^^^ B009
|
||||
28 | pass
|
||||
26 | pass
|
||||
|
|
||||
= help: Replace `getattr` with attribute access
|
||||
|
||||
|
|
|
@ -3,11 +3,11 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
|
|||
---
|
||||
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)
|
||||
39 | # Invalid usage
|
||||
40 | setattr(foo, "bar", None)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ B010
|
||||
42 | setattr(foo, "_123abc", None)
|
||||
43 | setattr(foo, "__123abc__", None)
|
||||
41 | setattr(foo, "_123abc", None)
|
||||
42 | setattr(foo, "__123abc__", None)
|
||||
|
|
||||
= help: Replace `setattr` with assignment
|
||||
|
||||
|
@ -23,12 +23,12 @@ B009_B010.py:40:1: B010 [*] Do not call `setattr` with a constant attribute valu
|
|||
|
||||
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)
|
||||
43 | setattr(foo, "_123abc", None)
|
||||
39 | # Invalid usage
|
||||
40 | setattr(foo, "bar", None)
|
||||
41 | setattr(foo, "_123abc", None)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ B010
|
||||
44 | setattr(foo, "__123abc__", None)
|
||||
45 | setattr(foo, "abc123", None)
|
||||
42 | setattr(foo, "__123abc__", None)
|
||||
43 | setattr(foo, "abc123", None)
|
||||
|
|
||||
= help: Replace `setattr` with assignment
|
||||
|
||||
|
@ -44,12 +44,12 @@ B009_B010.py:41:1: B010 [*] Do not call `setattr` with a constant attribute valu
|
|||
|
||||
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)
|
||||
44 | setattr(foo, "__123abc__", None)
|
||||
40 | setattr(foo, "bar", None)
|
||||
41 | setattr(foo, "_123abc", None)
|
||||
42 | setattr(foo, "__123abc__", None)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ B010
|
||||
45 | setattr(foo, "abc123", None)
|
||||
46 | setattr(foo, r"abc123", None)
|
||||
43 | setattr(foo, "abc123", None)
|
||||
44 | setattr(foo, r"abc123", None)
|
||||
|
|
||||
= help: Replace `setattr` with assignment
|
||||
|
||||
|
@ -65,12 +65,12 @@ B009_B010.py:42:1: B010 [*] Do not call `setattr` with a constant attribute valu
|
|||
|
||||
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)
|
||||
45 | setattr(foo, "abc123", None)
|
||||
41 | setattr(foo, "_123abc", None)
|
||||
42 | setattr(foo, "__123abc__", None)
|
||||
43 | setattr(foo, "abc123", None)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ B010
|
||||
46 | setattr(foo, r"abc123", None)
|
||||
47 | setattr(foo.bar, r"baz", None)
|
||||
44 | setattr(foo, r"abc123", None)
|
||||
45 | setattr(foo.bar, r"baz", None)
|
||||
|
|
||||
= help: Replace `setattr` with assignment
|
||||
|
||||
|
@ -85,11 +85,11 @@ B009_B010.py:43:1: B010 [*] Do not call `setattr` with a constant attribute valu
|
|||
|
||||
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)
|
||||
46 | setattr(foo, r"abc123", None)
|
||||
42 | setattr(foo, "__123abc__", None)
|
||||
43 | setattr(foo, "abc123", None)
|
||||
44 | setattr(foo, r"abc123", None)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ B010
|
||||
47 | setattr(foo.bar, r"baz", None)
|
||||
45 | setattr(foo.bar, r"baz", None)
|
||||
|
|
||||
= help: Replace `setattr` with assignment
|
||||
|
||||
|
@ -103,9 +103,9 @@ B009_B010.py:44:1: B010 [*] Do not call `setattr` with a constant attribute valu
|
|||
|
||||
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)
|
||||
47 | setattr(foo.bar, r"baz", None)
|
||||
43 | setattr(foo, "abc123", None)
|
||||
44 | setattr(foo, r"abc123", None)
|
||||
45 | setattr(foo.bar, r"baz", None)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ B010
|
||||
|
|
||||
= help: Replace `setattr` with assignment
|
||||
|
|
|
@ -3,11 +3,11 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
|
|||
---
|
||||
B011.py:8:8: B011 [*] Do not `assert False` (`python -O` removes these calls), raise `AssertionError()`
|
||||
|
|
||||
8 | assert 1 != 2
|
||||
9 | assert False
|
||||
7 | assert 1 != 2
|
||||
8 | assert False
|
||||
| ^^^^^ B011
|
||||
10 | assert 1 != 2, "message"
|
||||
11 | assert False, "message"
|
||||
9 | assert 1 != 2, "message"
|
||||
10 | assert False, "message"
|
||||
|
|
||||
= help: Replace `assert False`
|
||||
|
||||
|
@ -22,9 +22,9 @@ B011.py:8:8: B011 [*] Do not `assert False` (`python -O` removes these calls), r
|
|||
|
||||
B011.py:10:8: B011 [*] Do not `assert False` (`python -O` removes these calls), raise `AssertionError()`
|
||||
|
|
||||
10 | assert False
|
||||
11 | assert 1 != 2, "message"
|
||||
12 | assert False, "message"
|
||||
8 | assert False
|
||||
9 | assert 1 != 2, "message"
|
||||
10 | assert False, "message"
|
||||
| ^^^^^ B011
|
||||
|
|
||||
= help: Replace `assert False`
|
||||
|
|
|
@ -3,101 +3,101 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
|
|||
---
|
||||
B012.py:5:9: B012 `return` inside `finally` blocks cause exceptions to be silenced
|
||||
|
|
||||
5 | pass
|
||||
6 | finally:
|
||||
7 | return # warning
|
||||
3 | pass
|
||||
4 | finally:
|
||||
5 | return # warning
|
||||
| ^^^^^^ B012
|
||||
|
|
||||
|
||||
B012.py:13:13: B012 `return` inside `finally` blocks cause exceptions to be silenced
|
||||
|
|
||||
13 | finally:
|
||||
14 | if 1 + 0 == 2 - 1:
|
||||
15 | return # warning
|
||||
11 | finally:
|
||||
12 | if 1 + 0 == 2 - 1:
|
||||
13 | return # warning
|
||||
| ^^^^^^ B012
|
||||
|
|
||||
|
||||
B012.py:21:13: B012 `return` inside `finally` blocks cause exceptions to be silenced
|
||||
|
|
||||
21 | finally:
|
||||
22 | try:
|
||||
23 | return # warning
|
||||
19 | finally:
|
||||
20 | try:
|
||||
21 | return # warning
|
||||
| ^^^^^^ B012
|
||||
24 | except Exception:
|
||||
25 | pass
|
||||
22 | except Exception:
|
||||
23 | pass
|
||||
|
|
||||
|
||||
B012.py:31:13: B012 `return` inside `finally` blocks cause exceptions to be silenced
|
||||
|
|
||||
31 | pass
|
||||
32 | finally:
|
||||
33 | return # warning
|
||||
29 | pass
|
||||
30 | finally:
|
||||
31 | return # warning
|
||||
| ^^^^^^ B012
|
||||
34 | finally:
|
||||
35 | pass
|
||||
32 | finally:
|
||||
33 | pass
|
||||
|
|
||||
|
||||
B012.py:44:21: B012 `return` inside `finally` blocks cause exceptions to be silenced
|
||||
|
|
||||
44 | pass
|
||||
45 | finally:
|
||||
46 | return # warning
|
||||
42 | pass
|
||||
43 | finally:
|
||||
44 | return # warning
|
||||
| ^^^^^^ B012
|
||||
47 |
|
||||
48 | finally:
|
||||
45 |
|
||||
46 | finally:
|
||||
|
|
||||
|
||||
B012.py:66:13: B012 `break` inside `finally` blocks cause exceptions to be silenced
|
||||
|
|
||||
66 | pass
|
||||
67 | finally:
|
||||
68 | break # warning
|
||||
64 | pass
|
||||
65 | finally:
|
||||
66 | break # warning
|
||||
| ^^^^^ B012
|
||||
69 |
|
||||
70 | def j():
|
||||
67 |
|
||||
68 | def j():
|
||||
|
|
||||
|
||||
B012.py:78:13: B012 `continue` inside `finally` blocks cause exceptions to be silenced
|
||||
|
|
||||
78 | pass
|
||||
79 | finally:
|
||||
80 | continue # warning
|
||||
76 | pass
|
||||
77 | finally:
|
||||
78 | continue # warning
|
||||
| ^^^^^^^^ B012
|
||||
81 |
|
||||
82 | def j():
|
||||
79 |
|
||||
80 | def j():
|
||||
|
|
||||
|
||||
B012.py:94:13: B012 `return` inside `finally` blocks cause exceptions to be silenced
|
||||
|
|
||||
94 | continue # no warning
|
||||
95 | while True:
|
||||
96 | return # warning
|
||||
92 | continue # no warning
|
||||
93 | while True:
|
||||
94 | return # warning
|
||||
| ^^^^^^ B012
|
||||
|
|
||||
|
||||
B012.py:101:9: B012 `continue` inside `finally` blocks cause exceptions to be silenced
|
||||
|
|
||||
101 | pass
|
||||
102 | finally:
|
||||
103 | continue # warning
|
||||
99 | pass
|
||||
100 | finally:
|
||||
101 | continue # warning
|
||||
| ^^^^^^^^ B012
|
||||
104 |
|
||||
105 | while True:
|
||||
102 |
|
||||
103 | while True:
|
||||
|
|
||||
|
||||
B012.py:107:9: B012 `break` inside `finally` blocks cause exceptions to be silenced
|
||||
|
|
||||
107 | pass
|
||||
108 | finally:
|
||||
109 | break # warning
|
||||
105 | pass
|
||||
106 | finally:
|
||||
107 | break # warning
|
||||
| ^^^^^ B012
|
||||
|
|
||||
|
||||
B012.py:118:17: B012 `break` inside `finally` blocks cause exceptions to be silenced
|
||||
|
|
||||
118 | y = 0
|
||||
119 | case 0, *x:
|
||||
120 | break # warning
|
||||
116 | y = 0
|
||||
117 | case 0, *x:
|
||||
118 | break # warning
|
||||
| ^^^^^ B012
|
||||
|
|
||||
|
||||
|
|
|
@ -1,15 +1,14 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/flake8_bugbear/mod.rs
|
||||
assertion_line: 57
|
||||
---
|
||||
B013.py:3:8: B013 [*] A length-one tuple literal is redundant. Write `except ValueError` instead of `except (ValueError,)`.
|
||||
|
|
||||
3 | try:
|
||||
4 | pass
|
||||
5 | except (ValueError,):
|
||||
1 | try:
|
||||
2 | pass
|
||||
3 | except (ValueError,):
|
||||
| ^^^^^^^^^^^^^ B013
|
||||
6 | pass
|
||||
7 | except AttributeError:
|
||||
4 | pass
|
||||
5 | except AttributeError:
|
||||
|
|
||||
= help: Replace with `except ValueError`
|
||||
|
||||
|
|
|
@ -3,12 +3,12 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
|
|||
---
|
||||
B014.py:17:8: B014 [*] Exception handler with duplicate exception: `OSError`
|
||||
|
|
||||
17 | try:
|
||||
18 | pass
|
||||
19 | except (OSError, OSError) as err:
|
||||
15 | try:
|
||||
16 | pass
|
||||
17 | except (OSError, OSError) as err:
|
||||
| ^^^^^^^^^^^^^^^^^^ B014
|
||||
20 | # Duplicate exception types are useless
|
||||
21 | pass
|
||||
18 | # Duplicate exception types are useless
|
||||
19 | pass
|
||||
|
|
||||
= help: De-duplicate exceptions
|
||||
|
||||
|
@ -24,12 +24,12 @@ B014.py:17:8: B014 [*] Exception handler with duplicate exception: `OSError`
|
|||
|
||||
B014.py:28:8: B014 [*] Exception handler with duplicate exception: `MyError`
|
||||
|
|
||||
28 | try:
|
||||
29 | pass
|
||||
30 | except (MyError, MyError):
|
||||
26 | try:
|
||||
27 | pass
|
||||
28 | except (MyError, MyError):
|
||||
| ^^^^^^^^^^^^^^^^^^ B014
|
||||
31 | # Detect duplicate non-builtin errors
|
||||
32 | pass
|
||||
29 | # Detect duplicate non-builtin errors
|
||||
30 | pass
|
||||
|
|
||||
= help: De-duplicate exceptions
|
||||
|
||||
|
@ -45,12 +45,12 @@ B014.py:28:8: B014 [*] Exception handler with duplicate exception: `MyError`
|
|||
|
||||
B014.py:49:8: B014 [*] Exception handler with duplicate exception: `re.error`
|
||||
|
|
||||
49 | try:
|
||||
50 | pass
|
||||
51 | except (re.error, re.error):
|
||||
47 | try:
|
||||
48 | pass
|
||||
49 | except (re.error, re.error):
|
||||
| ^^^^^^^^^^^^^^^^^^^^ B014
|
||||
52 | # Duplicate exception types as attributes
|
||||
53 | pass
|
||||
50 | # Duplicate exception types as attributes
|
||||
51 | pass
|
||||
|
|
||||
= help: De-duplicate exceptions
|
||||
|
||||
|
|
|
@ -3,34 +3,34 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
|
|||
---
|
||||
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 |
|
||||
5 | 1 == 1
|
||||
1 | assert 1 == 1
|
||||
2 |
|
||||
3 | 1 == 1
|
||||
| ^^^^^^ B015
|
||||
6 |
|
||||
7 | assert 1 in (1, 2)
|
||||
4 |
|
||||
5 | assert 1 in (1, 2)
|
||||
|
|
||||
|
||||
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 |
|
||||
9 | 1 in (1, 2)
|
||||
5 | assert 1 in (1, 2)
|
||||
6 |
|
||||
7 | 1 in (1, 2)
|
||||
| ^^^^^^^^^^^ B015
|
||||
|
|
||||
|
||||
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 |
|
||||
19 | 1 in (1, 2)
|
||||
15 | assert 1 in (1, 2)
|
||||
16 |
|
||||
17 | 1 in (1, 2)
|
||||
| ^^^^^^^^^^^ B015
|
||||
|
|
||||
|
||||
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
|
||||
23 | class TestClass:
|
||||
24 | 1 == 1
|
||||
| ^^^^^^ B015
|
||||
|
|
||||
|
||||
|
|
|
@ -2,32 +2,32 @@
|
|||
source: crates/ruff/src/rules/flake8_bugbear/mod.rs
|
||||
---
|
||||
B016.py:6:7: B016 Cannot raise a literal. Did you intend to return it or raise an Exception?
|
||||
|
|
||||
6 | """
|
||||
7 |
|
||||
8 | raise False
|
||||
| ^^^^^ B016
|
||||
9 | raise 1
|
||||
10 | raise "string"
|
||||
|
|
||||
|
|
||||
4 | """
|
||||
5 |
|
||||
6 | raise False
|
||||
| ^^^^^ B016
|
||||
7 | raise 1
|
||||
8 | raise "string"
|
||||
|
|
||||
|
||||
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
|
||||
| ^ B016
|
||||
9 | raise "string"
|
||||
10 | raise Exception(False)
|
||||
|
|
||||
|
|
||||
6 | raise False
|
||||
7 | raise 1
|
||||
| ^ B016
|
||||
8 | raise "string"
|
||||
9 | raise Exception(False)
|
||||
|
|
||||
|
||||
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
|
||||
10 | raise "string"
|
||||
6 | raise False
|
||||
7 | raise 1
|
||||
8 | raise "string"
|
||||
| ^^^^^^^^ B016
|
||||
11 | raise Exception(False)
|
||||
12 | raise Exception(1)
|
||||
9 | raise Exception(False)
|
||||
10 | raise Exception(1)
|
||||
|
|
||||
|
||||
|
||||
|
|
|
@ -3,25 +3,25 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
|
|||
---
|
||||
B017.py:23:9: B017 `assertRaises(Exception)` should be considered evil
|
||||
|
|
||||
23 | class Foobar(unittest.TestCase):
|
||||
24 | def evil_raises(self) -> None:
|
||||
25 | with self.assertRaises(Exception):
|
||||
21 | class Foobar(unittest.TestCase):
|
||||
22 | def evil_raises(self) -> None:
|
||||
23 | with self.assertRaises(Exception):
|
||||
| _________^
|
||||
26 | | raise Exception("Evil I say!")
|
||||
24 | | raise Exception("Evil I say!")
|
||||
| |__________________________________________^ B017
|
||||
27 |
|
||||
28 | def context_manager_raises(self) -> None:
|
||||
25 |
|
||||
26 | def context_manager_raises(self) -> None:
|
||||
|
|
||||
|
||||
B017.py:41:5: B017 `pytest.raises(Exception)` should be considered evil
|
||||
|
|
||||
41 | def test_pytest_raises():
|
||||
42 | with pytest.raises(Exception):
|
||||
40 | def test_pytest_raises():
|
||||
41 | with pytest.raises(Exception):
|
||||
| _____^
|
||||
43 | | raise ValueError("Hello")
|
||||
42 | | raise ValueError("Hello")
|
||||
| |_________________________________^ B017
|
||||
44 |
|
||||
45 | with pytest.raises(Exception, "hello"):
|
||||
43 |
|
||||
44 | with pytest.raises(Exception, "hello"):
|
||||
|
|
||||
|
||||
|
||||
|
|
|
@ -3,255 +3,255 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
|
|||
---
|
||||
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)
|
||||
13 | 1j # Number (complex)
|
||||
9 | "str" # Str (no raise)
|
||||
10 | f"{int}" # JoinedStr (no raise)
|
||||
11 | 1j # Number (complex)
|
||||
| ^^ B018
|
||||
14 | 1 # Number (int)
|
||||
15 | 1.0 # Number (float)
|
||||
12 | 1 # Number (int)
|
||||
13 | 1.0 # Number (float)
|
||||
|
|
||||
|
||||
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)
|
||||
14 | 1 # Number (int)
|
||||
10 | f"{int}" # JoinedStr (no raise)
|
||||
11 | 1j # Number (complex)
|
||||
12 | 1 # Number (int)
|
||||
| ^ B018
|
||||
15 | 1.0 # Number (float)
|
||||
16 | b"foo" # Binary
|
||||
13 | 1.0 # Number (float)
|
||||
14 | b"foo" # Binary
|
||||
|
|
||||
|
||||
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)
|
||||
15 | 1.0 # Number (float)
|
||||
11 | 1j # Number (complex)
|
||||
12 | 1 # Number (int)
|
||||
13 | 1.0 # Number (float)
|
||||
| ^^^ B018
|
||||
16 | b"foo" # Binary
|
||||
17 | True # NameConstant (True)
|
||||
14 | b"foo" # Binary
|
||||
15 | True # NameConstant (True)
|
||||
|
|
||||
|
||||
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)
|
||||
16 | b"foo" # Binary
|
||||
12 | 1 # Number (int)
|
||||
13 | 1.0 # Number (float)
|
||||
14 | b"foo" # Binary
|
||||
| ^^^^^^ B018
|
||||
17 | True # NameConstant (True)
|
||||
18 | False # NameConstant (False)
|
||||
15 | True # NameConstant (True)
|
||||
16 | False # NameConstant (False)
|
||||
|
|
||||
|
||||
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
|
||||
17 | True # NameConstant (True)
|
||||
13 | 1.0 # Number (float)
|
||||
14 | b"foo" # Binary
|
||||
15 | True # NameConstant (True)
|
||||
| ^^^^ B018
|
||||
18 | False # NameConstant (False)
|
||||
19 | None # NameConstant (None)
|
||||
16 | False # NameConstant (False)
|
||||
17 | None # NameConstant (None)
|
||||
|
|
||||
|
||||
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)
|
||||
18 | False # NameConstant (False)
|
||||
14 | b"foo" # Binary
|
||||
15 | True # NameConstant (True)
|
||||
16 | False # NameConstant (False)
|
||||
| ^^^^^ B018
|
||||
19 | None # NameConstant (None)
|
||||
20 | [1, 2] # list
|
||||
17 | None # NameConstant (None)
|
||||
18 | [1, 2] # list
|
||||
|
|
||||
|
||||
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)
|
||||
19 | None # NameConstant (None)
|
||||
15 | True # NameConstant (True)
|
||||
16 | False # NameConstant (False)
|
||||
17 | None # NameConstant (None)
|
||||
| ^^^^ B018
|
||||
20 | [1, 2] # list
|
||||
21 | {1, 2} # set
|
||||
18 | [1, 2] # list
|
||||
19 | {1, 2} # set
|
||||
|
|
||||
|
||||
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)
|
||||
20 | [1, 2] # list
|
||||
16 | False # NameConstant (False)
|
||||
17 | None # NameConstant (None)
|
||||
18 | [1, 2] # list
|
||||
| ^^^^^^ B018
|
||||
21 | {1, 2} # set
|
||||
22 | {"foo": "bar"} # dict
|
||||
19 | {1, 2} # set
|
||||
20 | {"foo": "bar"} # dict
|
||||
|
|
||||
|
||||
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
|
||||
21 | {1, 2} # set
|
||||
17 | None # NameConstant (None)
|
||||
18 | [1, 2] # list
|
||||
19 | {1, 2} # set
|
||||
| ^^^^^^ B018
|
||||
22 | {"foo": "bar"} # dict
|
||||
20 | {"foo": "bar"} # dict
|
||||
|
|
||||
|
||||
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
|
||||
22 | {"foo": "bar"} # dict
|
||||
18 | [1, 2] # list
|
||||
19 | {1, 2} # set
|
||||
20 | {"foo": "bar"} # dict
|
||||
| ^^^^^^^^^^^^^^ B018
|
||||
|
|
||||
|
||||
B018.py:24:5: B018 Found useless expression. Either assign it to a variable or remove it.
|
||||
|
|
||||
24 | class Foo3:
|
||||
25 | 123
|
||||
23 | class Foo3:
|
||||
24 | 123
|
||||
| ^^^ B018
|
||||
26 | a = 2
|
||||
27 | "str"
|
||||
25 | a = 2
|
||||
26 | "str"
|
||||
|
|
||||
|
||||
B018.py:27:5: B018 Found useless expression. Either assign it to a variable or remove it.
|
||||
|
|
||||
27 | a = 2
|
||||
28 | "str"
|
||||
29 | 1
|
||||
25 | a = 2
|
||||
26 | "str"
|
||||
27 | 1
|
||||
| ^ B018
|
||||
|
|
||||
|
||||
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)
|
||||
41 | 1j # Number (complex)
|
||||
37 | "str" # Str (no raise)
|
||||
38 | f"{int}" # JoinedStr (no raise)
|
||||
39 | 1j # Number (complex)
|
||||
| ^^ B018
|
||||
42 | 1 # Number (int)
|
||||
43 | 1.0 # Number (float)
|
||||
40 | 1 # Number (int)
|
||||
41 | 1.0 # Number (float)
|
||||
|
|
||||
|
||||
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)
|
||||
42 | 1 # Number (int)
|
||||
38 | f"{int}" # JoinedStr (no raise)
|
||||
39 | 1j # Number (complex)
|
||||
40 | 1 # Number (int)
|
||||
| ^ B018
|
||||
43 | 1.0 # Number (float)
|
||||
44 | b"foo" # Binary
|
||||
41 | 1.0 # Number (float)
|
||||
42 | b"foo" # Binary
|
||||
|
|
||||
|
||||
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)
|
||||
43 | 1.0 # Number (float)
|
||||
39 | 1j # Number (complex)
|
||||
40 | 1 # Number (int)
|
||||
41 | 1.0 # Number (float)
|
||||
| ^^^ B018
|
||||
44 | b"foo" # Binary
|
||||
45 | True # NameConstant (True)
|
||||
42 | b"foo" # Binary
|
||||
43 | True # NameConstant (True)
|
||||
|
|
||||
|
||||
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)
|
||||
44 | b"foo" # Binary
|
||||
40 | 1 # Number (int)
|
||||
41 | 1.0 # Number (float)
|
||||
42 | b"foo" # Binary
|
||||
| ^^^^^^ B018
|
||||
45 | True # NameConstant (True)
|
||||
46 | False # NameConstant (False)
|
||||
43 | True # NameConstant (True)
|
||||
44 | False # NameConstant (False)
|
||||
|
|
||||
|
||||
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
|
||||
45 | True # NameConstant (True)
|
||||
41 | 1.0 # Number (float)
|
||||
42 | b"foo" # Binary
|
||||
43 | True # NameConstant (True)
|
||||
| ^^^^ B018
|
||||
46 | False # NameConstant (False)
|
||||
47 | None # NameConstant (None)
|
||||
44 | False # NameConstant (False)
|
||||
45 | None # NameConstant (None)
|
||||
|
|
||||
|
||||
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)
|
||||
46 | False # NameConstant (False)
|
||||
42 | b"foo" # Binary
|
||||
43 | True # NameConstant (True)
|
||||
44 | False # NameConstant (False)
|
||||
| ^^^^^ B018
|
||||
47 | None # NameConstant (None)
|
||||
48 | [1, 2] # list
|
||||
45 | None # NameConstant (None)
|
||||
46 | [1, 2] # list
|
||||
|
|
||||
|
||||
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)
|
||||
47 | None # NameConstant (None)
|
||||
43 | True # NameConstant (True)
|
||||
44 | False # NameConstant (False)
|
||||
45 | None # NameConstant (None)
|
||||
| ^^^^ B018
|
||||
48 | [1, 2] # list
|
||||
49 | {1, 2} # set
|
||||
46 | [1, 2] # list
|
||||
47 | {1, 2} # set
|
||||
|
|
||||
|
||||
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)
|
||||
48 | [1, 2] # list
|
||||
44 | False # NameConstant (False)
|
||||
45 | None # NameConstant (None)
|
||||
46 | [1, 2] # list
|
||||
| ^^^^^^ B018
|
||||
49 | {1, 2} # set
|
||||
50 | {"foo": "bar"} # dict
|
||||
47 | {1, 2} # set
|
||||
48 | {"foo": "bar"} # dict
|
||||
|
|
||||
|
||||
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
|
||||
49 | {1, 2} # set
|
||||
45 | None # NameConstant (None)
|
||||
46 | [1, 2] # list
|
||||
47 | {1, 2} # set
|
||||
| ^^^^^^ B018
|
||||
50 | {"foo": "bar"} # dict
|
||||
48 | {"foo": "bar"} # dict
|
||||
|
|
||||
|
||||
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
|
||||
50 | {"foo": "bar"} # dict
|
||||
46 | [1, 2] # list
|
||||
47 | {1, 2} # set
|
||||
48 | {"foo": "bar"} # dict
|
||||
| ^^^^^^^^^^^^^^ B018
|
||||
|
|
||||
|
||||
B018.py:52:5: B018 Found useless expression. Either assign it to a variable or remove it.
|
||||
|
|
||||
52 | def foo3():
|
||||
53 | 123
|
||||
51 | def foo3():
|
||||
52 | 123
|
||||
| ^^^ B018
|
||||
54 | a = 2
|
||||
55 | "str"
|
||||
53 | a = 2
|
||||
54 | "str"
|
||||
|
|
||||
|
||||
B018.py:55:5: B018 Found useless expression. Either assign it to a variable or remove it.
|
||||
|
|
||||
55 | a = 2
|
||||
56 | "str"
|
||||
57 | 3
|
||||
53 | a = 2
|
||||
54 | "str"
|
||||
55 | 3
|
||||
| ^ B018
|
||||
|
|
||||
|
||||
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)
|
||||
62 | def foo5():
|
||||
63 | foo.bar # Attribute (raise)
|
||||
| ^^^^^^^ B018
|
||||
65 | object().__class__ # Attribute (raise)
|
||||
66 | "foo" + "bar" # BinOp (raise)
|
||||
64 | object().__class__ # Attribute (raise)
|
||||
65 | "foo" + "bar" # BinOp (raise)
|
||||
|
|
||||
|
||||
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)
|
||||
66 | object().__class__ # Attribute (raise)
|
||||
62 | def foo5():
|
||||
63 | foo.bar # Attribute (raise)
|
||||
64 | object().__class__ # Attribute (raise)
|
||||
| ^^^^^^^^^^^^^^^^^^ B018
|
||||
67 | "foo" + "bar" # BinOp (raise)
|
||||
65 | "foo" + "bar" # BinOp (raise)
|
||||
|
|
||||
|
||||
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)
|
||||
67 | "foo" + "bar" # BinOp (raise)
|
||||
63 | foo.bar # Attribute (raise)
|
||||
64 | object().__class__ # Attribute (raise)
|
||||
65 | "foo" + "bar" # BinOp (raise)
|
||||
| ^^^^^^^^^^^^^ B018
|
||||
|
|
||||
|
||||
|
|
|
@ -3,81 +3,81 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
|
|||
---
|
||||
B019.py:78:5: 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
|
||||
77 | # Remaining methods should emit B019
|
||||
78 | @functools.cache
|
||||
| ^^^^^^^^^^^^^^^^ B019
|
||||
80 | def cached_instance_method(self, y):
|
||||
81 | ...
|
||||
79 | def cached_instance_method(self, y):
|
||||
80 | ...
|
||||
|
|
||||
|
||||
B019.py:82:5: B019 Use of `functools.lru_cache` or `functools.cache` on methods can lead to memory leaks
|
||||
|
|
||||
82 | ...
|
||||
83 |
|
||||
84 | @cache
|
||||
80 | ...
|
||||
81 |
|
||||
82 | @cache
|
||||
| ^^^^^^ B019
|
||||
85 | def another_cached_instance_method(self, y):
|
||||
86 | ...
|
||||
83 | def another_cached_instance_method(self, y):
|
||||
84 | ...
|
||||
|
|
||||
|
||||
B019.py:86:5: B019 Use of `functools.lru_cache` or `functools.cache` on methods can lead to memory leaks
|
||||
|
|
||||
86 | ...
|
||||
87 |
|
||||
88 | @functools.cache()
|
||||
84 | ...
|
||||
85 |
|
||||
86 | @functools.cache()
|
||||
| ^^^^^^^^^^^^^^^^^^ B019
|
||||
89 | def called_cached_instance_method(self, y):
|
||||
90 | ...
|
||||
87 | def called_cached_instance_method(self, y):
|
||||
88 | ...
|
||||
|
|
||||
|
||||
B019.py:90:5: B019 Use of `functools.lru_cache` or `functools.cache` on methods can lead to memory leaks
|
||||
|
|
||||
90 | ...
|
||||
91 |
|
||||
92 | @cache()
|
||||
88 | ...
|
||||
89 |
|
||||
90 | @cache()
|
||||
| ^^^^^^^^ B019
|
||||
93 | def another_called_cached_instance_method(self, y):
|
||||
94 | ...
|
||||
91 | def another_called_cached_instance_method(self, y):
|
||||
92 | ...
|
||||
|
|
||||
|
||||
B019.py:94:5: B019 Use of `functools.lru_cache` or `functools.cache` on methods can lead to memory leaks
|
||||
|
|
||||
94 | ...
|
||||
95 |
|
||||
96 | @functools.lru_cache
|
||||
92 | ...
|
||||
93 |
|
||||
94 | @functools.lru_cache
|
||||
| ^^^^^^^^^^^^^^^^^^^^ B019
|
||||
97 | def lru_cached_instance_method(self, y):
|
||||
98 | ...
|
||||
95 | def lru_cached_instance_method(self, y):
|
||||
96 | ...
|
||||
|
|
||||
|
||||
B019.py:98:5: B019 Use of `functools.lru_cache` or `functools.cache` on methods can lead to memory leaks
|
||||
|
|
||||
98 | ...
|
||||
99 |
|
||||
100 | @lru_cache
|
||||
96 | ...
|
||||
97 |
|
||||
98 | @lru_cache
|
||||
| ^^^^^^^^^^ B019
|
||||
101 | def another_lru_cached_instance_method(self, y):
|
||||
102 | ...
|
||||
99 | def another_lru_cached_instance_method(self, y):
|
||||
100 | ...
|
||||
|
|
||||
|
||||
B019.py:102:5: B019 Use of `functools.lru_cache` or `functools.cache` on methods can lead to memory leaks
|
||||
|
|
||||
102 | ...
|
||||
103 |
|
||||
104 | @functools.lru_cache()
|
||||
100 | ...
|
||||
101 |
|
||||
102 | @functools.lru_cache()
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ B019
|
||||
105 | def called_lru_cached_instance_method(self, y):
|
||||
106 | ...
|
||||
103 | def called_lru_cached_instance_method(self, y):
|
||||
104 | ...
|
||||
|
|
||||
|
||||
B019.py:106:5: B019 Use of `functools.lru_cache` or `functools.cache` on methods can lead to memory leaks
|
||||
|
|
||||
106 | ...
|
||||
107 |
|
||||
108 | @lru_cache()
|
||||
104 | ...
|
||||
105 |
|
||||
106 | @lru_cache()
|
||||
| ^^^^^^^^^^^^ B019
|
||||
109 | def another_called_lru_cached_instance_method(self, y):
|
||||
110 | ...
|
||||
107 | def another_called_lru_cached_instance_method(self, y):
|
||||
108 | ...
|
||||
|
|
||||
|
||||
|
||||
|
|
|
@ -2,29 +2,29 @@
|
|||
source: crates/ruff/src/rules/flake8_bugbear/mod.rs
|
||||
---
|
||||
B020.py:8:5: B020 Loop control variable `items` overrides iterable it iterates
|
||||
|
|
||||
8 | items = [1, 2, 3]
|
||||
9 |
|
||||
10 | for items in items:
|
||||
| ^^^^^ B020
|
||||
11 | print(items)
|
||||
|
|
||||
|
|
||||
6 | items = [1, 2, 3]
|
||||
7 |
|
||||
8 | for items in items:
|
||||
| ^^^^^ B020
|
||||
9 | print(items)
|
||||
|
|
||||
|
||||
B020.py:21:10: B020 Loop control variable `values` overrides iterable it iterates
|
||||
|
|
||||
21 | print(f"{key}, {value}")
|
||||
22 |
|
||||
23 | for key, values in values.items():
|
||||
19 | print(f"{key}, {value}")
|
||||
20 |
|
||||
21 | for key, values in values.items():
|
||||
| ^^^^^^ B020
|
||||
24 | print(f"{key}, {values}")
|
||||
22 | print(f"{key}, {values}")
|
||||
|
|
||||
|
||||
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]:
|
||||
35 | # However we still call out reassigning the iterable in the comprehension.
|
||||
36 | for vars in [i for i in vars]:
|
||||
| ^^^^ B020
|
||||
38 | print(vars)
|
||||
37 | print(vars)
|
||||
|
|
||||
|
||||
|
||||
|
|
|
@ -14,67 +14,67 @@ B021.py:1:1: B021 f-string used as docstring. Python will interpret this as a jo
|
|||
|
||||
B021.py:14:5: B021 f-string used as docstring. Python will interpret this as a joined string, rather than a docstring.
|
||||
|
|
||||
14 | def foo2():
|
||||
15 | f"""hello {VARIABLE}!"""
|
||||
13 | def foo2():
|
||||
14 | f"""hello {VARIABLE}!"""
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ B021
|
||||
|
|
||||
|
||||
B021.py:22:5: B021 f-string used as docstring. Python will interpret this as a joined string, rather than a docstring.
|
||||
|
|
||||
22 | class bar2:
|
||||
23 | f"""hello {VARIABLE}!"""
|
||||
21 | class bar2:
|
||||
22 | f"""hello {VARIABLE}!"""
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ B021
|
||||
|
|
||||
|
||||
B021.py:30:5: B021 f-string used as docstring. Python will interpret this as a joined string, rather than a docstring.
|
||||
|
|
||||
30 | def foo2():
|
||||
31 | f"""hello {VARIABLE}!"""
|
||||
29 | def foo2():
|
||||
30 | f"""hello {VARIABLE}!"""
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ B021
|
||||
|
|
||||
|
||||
B021.py:38:5: B021 f-string used as docstring. Python will interpret this as a joined string, rather than a docstring.
|
||||
|
|
||||
38 | class bar2:
|
||||
39 | f"""hello {VARIABLE}!"""
|
||||
37 | class bar2:
|
||||
38 | f"""hello {VARIABLE}!"""
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ B021
|
||||
|
|
||||
|
||||
B021.py:46:5: B021 f-string used as docstring. Python will interpret this as a joined string, rather than a docstring.
|
||||
|
|
||||
46 | def foo2():
|
||||
47 | f"hello {VARIABLE}!"
|
||||
45 | def foo2():
|
||||
46 | f"hello {VARIABLE}!"
|
||||
| ^^^^^^^^^^^^^^^^^^^^ B021
|
||||
|
|
||||
|
||||
B021.py:54:5: B021 f-string used as docstring. Python will interpret this as a joined string, rather than a docstring.
|
||||
|
|
||||
54 | class bar2:
|
||||
55 | f"hello {VARIABLE}!"
|
||||
53 | class bar2:
|
||||
54 | f"hello {VARIABLE}!"
|
||||
| ^^^^^^^^^^^^^^^^^^^^ B021
|
||||
|
|
||||
|
||||
B021.py:62:5: B021 f-string used as docstring. Python will interpret this as a joined string, rather than a docstring.
|
||||
|
|
||||
62 | def foo2():
|
||||
63 | f"hello {VARIABLE}!"
|
||||
61 | def foo2():
|
||||
62 | f"hello {VARIABLE}!"
|
||||
| ^^^^^^^^^^^^^^^^^^^^ B021
|
||||
|
|
||||
|
||||
B021.py:70:5: B021 f-string used as docstring. Python will interpret this as a joined string, rather than a docstring.
|
||||
|
|
||||
70 | class bar2:
|
||||
71 | f"hello {VARIABLE}!"
|
||||
69 | class bar2:
|
||||
70 | f"hello {VARIABLE}!"
|
||||
| ^^^^^^^^^^^^^^^^^^^^ B021
|
||||
|
|
||||
|
||||
B021.py:74:5: B021 f-string used as docstring. Python will interpret this as a joined string, rather than a docstring.
|
||||
|
|
||||
74 | def baz():
|
||||
75 | f"""I'm probably a docstring: {VARIABLE}!"""
|
||||
73 | def baz():
|
||||
74 | f"""I'm probably a docstring: {VARIABLE}!"""
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ B021
|
||||
76 | print(f"""I'm a normal string""")
|
||||
77 | f"""Don't detect me!"""
|
||||
75 | print(f"""I'm a normal string""")
|
||||
76 | f"""Don't detect me!"""
|
||||
|
|
||||
|
||||
|
||||
|
|
|
@ -3,20 +3,20 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
|
|||
---
|
||||
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 |
|
||||
11 | with contextlib.suppress():
|
||||
7 | from contextlib import suppress
|
||||
8 |
|
||||
9 | with contextlib.suppress():
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ B022
|
||||
12 | raise ValueError
|
||||
10 | raise ValueError
|
||||
|
|
||||
|
||||
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 |
|
||||
14 | with suppress():
|
||||
10 | raise ValueError
|
||||
11 |
|
||||
12 | with suppress():
|
||||
| ^^^^^^^^^^ B022
|
||||
15 | raise ValueError
|
||||
13 | raise ValueError
|
||||
|
|
||||
|
||||
|
||||
|
|
|
@ -3,221 +3,221 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
|
|||
---
|
||||
B023.py:12:30: B023 Function definition does not bind loop variable `x`
|
||||
|
|
||||
12 | y = x + 1
|
||||
13 | # Subject to late-binding problems
|
||||
14 | functions.append(lambda: x)
|
||||
10 | y = x + 1
|
||||
11 | # Subject to late-binding problems
|
||||
12 | functions.append(lambda: x)
|
||||
| ^ B023
|
||||
15 | functions.append(lambda: y) # not just the loop var
|
||||
13 | functions.append(lambda: y) # not just the loop var
|
||||
|
|
||||
|
||||
B023.py:13:30: B023 Function definition does not bind loop variable `y`
|
||||
|
|
||||
13 | # Subject to late-binding problems
|
||||
14 | functions.append(lambda: x)
|
||||
15 | functions.append(lambda: y) # not just the loop var
|
||||
11 | # Subject to late-binding problems
|
||||
12 | functions.append(lambda: x)
|
||||
13 | functions.append(lambda: y) # not just the loop var
|
||||
| ^ B023
|
||||
16 |
|
||||
17 | def f_bad_1():
|
||||
14 |
|
||||
15 | def f_bad_1():
|
||||
|
|
||||
|
||||
B023.py:16:16: B023 Function definition does not bind loop variable `x`
|
||||
|
|
||||
16 | def f_bad_1():
|
||||
17 | return x
|
||||
15 | def f_bad_1():
|
||||
16 | return x
|
||||
| ^ B023
|
||||
18 |
|
||||
19 | # Actually OK
|
||||
17 |
|
||||
18 | # Actually OK
|
||||
|
|
||||
|
||||
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
|
||||
27 | def check_inside_functions_too():
|
||||
28 | ls = [lambda: x for x in range(2)] # error
|
||||
| ^ B023
|
||||
30 | st = {lambda: x for x in range(2)} # error
|
||||
31 | gn = (lambda: x for x in range(2)) # error
|
||||
29 | st = {lambda: x for x in range(2)} # error
|
||||
30 | gn = (lambda: x for x in range(2)) # error
|
||||
|
|
||||
|
||||
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
|
||||
31 | st = {lambda: x for x in range(2)} # error
|
||||
27 | def check_inside_functions_too():
|
||||
28 | ls = [lambda: x for x in range(2)] # error
|
||||
29 | st = {lambda: x for x in range(2)} # error
|
||||
| ^ B023
|
||||
32 | gn = (lambda: x for x in range(2)) # error
|
||||
33 | dt = {x: lambda: x for x in range(2)} # error
|
||||
30 | gn = (lambda: x for x in range(2)) # error
|
||||
31 | dt = {x: lambda: x for x in range(2)} # error
|
||||
|
|
||||
|
||||
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
|
||||
32 | gn = (lambda: x for x in range(2)) # error
|
||||
28 | ls = [lambda: x for x in range(2)] # error
|
||||
29 | st = {lambda: x for x in range(2)} # error
|
||||
30 | gn = (lambda: x for x in range(2)) # error
|
||||
| ^ B023
|
||||
33 | dt = {x: lambda: x for x in range(2)} # error
|
||||
31 | dt = {x: lambda: x for x in range(2)} # error
|
||||
|
|
||||
|
||||
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
|
||||
33 | dt = {x: lambda: x for x in range(2)} # error
|
||||
29 | st = {lambda: x for x in range(2)} # error
|
||||
30 | gn = (lambda: x for x in range(2)) # error
|
||||
31 | dt = {x: lambda: x for x in range(2)} # error
|
||||
| ^ B023
|
||||
|
|
||||
|
||||
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():
|
||||
42 | functions.append(lambda: x) # error
|
||||
38 | async def container_for_problems():
|
||||
39 | async for x in pointless_async_iterable():
|
||||
40 | functions.append(lambda: x) # error
|
||||
| ^ B023
|
||||
43 |
|
||||
44 | [lambda: x async for x in pointless_async_iterable()] # error
|
||||
41 |
|
||||
42 | [lambda: x async for x in pointless_async_iterable()] # error
|
||||
|
|
||||
|
||||
B023.py:42:14: B023 Function definition does not bind loop variable `x`
|
||||
|
|
||||
42 | functions.append(lambda: x) # error
|
||||
43 |
|
||||
44 | [lambda: x async for x in pointless_async_iterable()] # error
|
||||
40 | functions.append(lambda: x) # error
|
||||
41 |
|
||||
42 | [lambda: x async for x in pointless_async_iterable()] # error
|
||||
| ^ B023
|
||||
|
|
||||
|
||||
B023.py:50:30: B023 Function definition does not bind loop variable `a`
|
||||
|
|
||||
50 | a = a_ = a - 1
|
||||
51 | b += 1
|
||||
52 | functions.append(lambda: a) # error
|
||||
48 | a = a_ = a - 1
|
||||
49 | b += 1
|
||||
50 | functions.append(lambda: a) # error
|
||||
| ^ B023
|
||||
53 | functions.append(lambda: a_) # error
|
||||
54 | functions.append(lambda: b) # error
|
||||
51 | functions.append(lambda: a_) # error
|
||||
52 | functions.append(lambda: b) # error
|
||||
|
|
||||
|
||||
B023.py:51:30: B023 Function definition does not bind loop variable `a_`
|
||||
|
|
||||
51 | b += 1
|
||||
52 | functions.append(lambda: a) # error
|
||||
53 | functions.append(lambda: a_) # error
|
||||
49 | b += 1
|
||||
50 | functions.append(lambda: a) # error
|
||||
51 | functions.append(lambda: a_) # error
|
||||
| ^^ B023
|
||||
54 | functions.append(lambda: b) # error
|
||||
55 | functions.append(lambda: c) # error, but not a name error due to late binding
|
||||
52 | functions.append(lambda: b) # error
|
||||
53 | functions.append(lambda: c) # error, but not a name error due to late binding
|
||||
|
|
||||
|
||||
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
|
||||
54 | functions.append(lambda: b) # error
|
||||
50 | functions.append(lambda: a) # error
|
||||
51 | functions.append(lambda: a_) # error
|
||||
52 | functions.append(lambda: b) # error
|
||||
| ^ B023
|
||||
55 | functions.append(lambda: c) # error, but not a name error due to late binding
|
||||
56 | c: bool = a > 3
|
||||
53 | functions.append(lambda: c) # error, but not a name error due to late binding
|
||||
54 | c: bool = a > 3
|
||||
|
|
||||
|
||||
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
|
||||
55 | functions.append(lambda: c) # error, but not a name error due to late binding
|
||||
51 | functions.append(lambda: a_) # error
|
||||
52 | functions.append(lambda: b) # error
|
||||
53 | functions.append(lambda: c) # error, but not a name error due to late binding
|
||||
| ^ B023
|
||||
56 | c: bool = a > 3
|
||||
57 | if not c:
|
||||
54 | c: bool = a > 3
|
||||
55 | if not c:
|
||||
|
|
||||
|
||||
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):
|
||||
63 | lambda: j * k # error
|
||||
59 | for j in range(2):
|
||||
60 | for k in range(3):
|
||||
61 | lambda: j * k # error
|
||||
| ^ B023
|
||||
|
|
||||
|
||||
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):
|
||||
63 | lambda: j * k # error
|
||||
59 | for j in range(2):
|
||||
60 | for k in range(3):
|
||||
61 | lambda: j * k # error
|
||||
| ^ B023
|
||||
|
|
||||
|
||||
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
|
||||
70 | [l for k in range(2)] # error for l, not for k
|
||||
66 | def f():
|
||||
67 | j = None # OK because it's an assignment
|
||||
68 | [l for k in range(2)] # error for l, not for k
|
||||
| ^ B023
|
||||
71 |
|
||||
72 | assert a and functions
|
||||
69 |
|
||||
70 | assert a and functions
|
||||
|
|
||||
|
||||
B023.py:82:16: B023 Function definition does not bind loop variable `i`
|
||||
|
|
||||
82 | for i in range(3):
|
||||
83 | lambda: f"{i}"
|
||||
81 | for i in range(3):
|
||||
82 | lambda: f"{i}"
|
||||
| ^ B023
|
||||
|
|
||||
|
||||
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:
|
||||
119 | min([None, lambda: x], key=repr)
|
||||
115 | for x in range(2):
|
||||
116 | # It's not a complete get-out-of-linting-free construct - these should fail:
|
||||
117 | min([None, lambda: x], key=repr)
|
||||
| ^ B023
|
||||
120 | sorted([None, lambda: x], key=repr)
|
||||
121 | any(filter(bool, [None, lambda: x]))
|
||||
118 | sorted([None, lambda: x], key=repr)
|
||||
119 | any(filter(bool, [None, lambda: 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)
|
||||
120 | sorted([None, lambda: x], key=repr)
|
||||
116 | # It's not a complete get-out-of-linting-free construct - these should fail:
|
||||
117 | min([None, lambda: x], key=repr)
|
||||
118 | sorted([None, lambda: x], key=repr)
|
||||
| ^ B023
|
||||
121 | any(filter(bool, [None, lambda: x]))
|
||||
122 | list(filter(bool, [None, lambda: x]))
|
||||
119 | any(filter(bool, [None, lambda: x]))
|
||||
120 | list(filter(bool, [None, lambda: 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)
|
||||
121 | any(filter(bool, [None, lambda: x]))
|
||||
117 | min([None, lambda: x], key=repr)
|
||||
118 | sorted([None, lambda: x], key=repr)
|
||||
119 | any(filter(bool, [None, lambda: x]))
|
||||
| ^ B023
|
||||
122 | list(filter(bool, [None, lambda: x]))
|
||||
123 | all(reduce(bool, [None, lambda: x]))
|
||||
120 | list(filter(bool, [None, lambda: x]))
|
||||
121 | all(reduce(bool, [None, lambda: 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]))
|
||||
122 | list(filter(bool, [None, lambda: x]))
|
||||
118 | sorted([None, lambda: x], key=repr)
|
||||
119 | any(filter(bool, [None, lambda: x]))
|
||||
120 | list(filter(bool, [None, lambda: x]))
|
||||
| ^ B023
|
||||
123 | all(reduce(bool, [None, lambda: x]))
|
||||
121 | all(reduce(bool, [None, lambda: 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]))
|
||||
123 | all(reduce(bool, [None, lambda: x]))
|
||||
119 | any(filter(bool, [None, lambda: x]))
|
||||
120 | list(filter(bool, [None, lambda: x]))
|
||||
121 | all(reduce(bool, [None, lambda: x]))
|
||||
| ^ B023
|
||||
124 |
|
||||
125 | # But all these should be OK:
|
||||
122 |
|
||||
123 | # But all these should be OK:
|
||||
|
|
||||
|
||||
B023.py:171:29: B023 Function definition does not bind loop variable `name`
|
||||
|
|
||||
171 | if foo(name):
|
||||
172 | return [lambda: name] # known false alarm
|
||||
170 | if foo(name):
|
||||
171 | return [lambda: name] # known false alarm
|
||||
| ^^^^ B023
|
||||
173 |
|
||||
174 | if False:
|
||||
172 |
|
||||
173 | if False:
|
||||
|
|
||||
|
||||
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
|
||||
173 | if False:
|
||||
174 | return [lambda: i for i in range(3)] # error
|
||||
| ^ B023
|
||||
|
|
||||
|
||||
|
|
|
@ -43,10 +43,10 @@ B024.py:92:7: B024 `notabc_Base_1` is an abstract base class, but it has no abst
|
|||
|
||||
B024.py:141:7: 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
|
||||
140 | # this doesn't actually declare a class variable, it's just an expression
|
||||
141 | class abc_set_class_variable_4(ABC): # error
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ B024
|
||||
143 | foo
|
||||
142 | foo
|
||||
|
|
||||
|
||||
|
||||
|
|
|
@ -3,39 +3,39 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
|
|||
---
|
||||
B025.py:19:8: B025 try-except block with duplicate exception `ValueError`
|
||||
|
|
||||
17 | except ValueError:
|
||||
18 | a = 2
|
||||
19 | except ValueError:
|
||||
20 | a = 2
|
||||
21 | except ValueError:
|
||||
| ^^^^^^^^^^ B025
|
||||
22 | a = 2
|
||||
20 | a = 2
|
||||
|
|
||||
|
||||
B025.py:28:8: B025 try-except block with duplicate exception `pickle.PickleError`
|
||||
|
|
||||
28 | except ValueError:
|
||||
29 | a = 2
|
||||
30 | except pickle.PickleError:
|
||||
26 | except ValueError:
|
||||
27 | a = 2
|
||||
28 | except pickle.PickleError:
|
||||
| ^^^^^^^^^^^^^^^^^^ B025
|
||||
31 | a = 2
|
||||
29 | a = 2
|
||||
|
|
||||
|
||||
B025.py:35:8: B025 try-except block with duplicate exception `ValueError`
|
||||
|
|
||||
35 | except (ValueError, TypeError):
|
||||
36 | a = 2
|
||||
37 | except ValueError:
|
||||
33 | except (ValueError, TypeError):
|
||||
34 | a = 2
|
||||
35 | except ValueError:
|
||||
| ^^^^^^^^^^ B025
|
||||
38 | a = 2
|
||||
39 | except (OSError, TypeError):
|
||||
36 | a = 2
|
||||
37 | except (OSError, TypeError):
|
||||
|
|
||||
|
||||
B025.py:37:18: B025 try-except block with duplicate exception `TypeError`
|
||||
|
|
||||
37 | except ValueError:
|
||||
38 | a = 2
|
||||
39 | except (OSError, TypeError):
|
||||
35 | except ValueError:
|
||||
36 | a = 2
|
||||
37 | except (OSError, TypeError):
|
||||
| ^^^^^^^^^ B025
|
||||
40 | a = 2
|
||||
38 | a = 2
|
||||
|
|
||||
|
||||
|
||||
|
|
|
@ -3,67 +3,67 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
|
|||
---
|
||||
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")
|
||||
18 | foo(bam="bam", *["bar", "baz"])
|
||||
14 | foo("bar", baz="baz", bam="bam")
|
||||
15 | foo(bar="bar", baz="baz", bam="bam")
|
||||
16 | foo(bam="bam", *["bar", "baz"])
|
||||
| ^^^^^^^^^^^^^^^ B026
|
||||
19 | foo(bam="bam", *bar_baz)
|
||||
20 | foo(baz="baz", bam="bam", *["bar"])
|
||||
17 | foo(bam="bam", *bar_baz)
|
||||
18 | foo(baz="baz", bam="bam", *["bar"])
|
||||
|
|
||||
|
||||
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"])
|
||||
19 | foo(bam="bam", *bar_baz)
|
||||
15 | foo(bar="bar", baz="baz", bam="bam")
|
||||
16 | foo(bam="bam", *["bar", "baz"])
|
||||
17 | foo(bam="bam", *bar_baz)
|
||||
| ^^^^^^^^ B026
|
||||
20 | foo(baz="baz", bam="bam", *["bar"])
|
||||
21 | foo(bar="bar", baz="baz", bam="bam", *[])
|
||||
18 | foo(baz="baz", bam="bam", *["bar"])
|
||||
19 | foo(bar="bar", baz="baz", bam="bam", *[])
|
||||
|
|
||||
|
||||
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)
|
||||
20 | foo(baz="baz", bam="bam", *["bar"])
|
||||
16 | foo(bam="bam", *["bar", "baz"])
|
||||
17 | foo(bam="bam", *bar_baz)
|
||||
18 | foo(baz="baz", bam="bam", *["bar"])
|
||||
| ^^^^^^^^ B026
|
||||
21 | foo(bar="bar", baz="baz", bam="bam", *[])
|
||||
22 | foo(bam="bam", *["bar"], *["baz"])
|
||||
19 | foo(bar="bar", baz="baz", bam="bam", *[])
|
||||
20 | foo(bam="bam", *["bar"], *["baz"])
|
||||
|
|
||||
|
||||
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"])
|
||||
21 | foo(bar="bar", baz="baz", bam="bam", *[])
|
||||
17 | foo(bam="bam", *bar_baz)
|
||||
18 | foo(baz="baz", bam="bam", *["bar"])
|
||||
19 | foo(bar="bar", baz="baz", bam="bam", *[])
|
||||
| ^^^ B026
|
||||
22 | foo(bam="bam", *["bar"], *["baz"])
|
||||
23 | foo(*["bar"], bam="bam", *["baz"])
|
||||
20 | foo(bam="bam", *["bar"], *["baz"])
|
||||
21 | foo(*["bar"], bam="bam", *["baz"])
|
||||
|
|
||||
|
||||
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", *[])
|
||||
22 | foo(bam="bam", *["bar"], *["baz"])
|
||||
18 | foo(baz="baz", bam="bam", *["bar"])
|
||||
19 | foo(bar="bar", baz="baz", bam="bam", *[])
|
||||
20 | foo(bam="bam", *["bar"], *["baz"])
|
||||
| ^^^^^^^^ B026
|
||||
23 | foo(*["bar"], bam="bam", *["baz"])
|
||||
21 | foo(*["bar"], bam="bam", *["baz"])
|
||||
|
|
||||
|
||||
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", *[])
|
||||
22 | foo(bam="bam", *["bar"], *["baz"])
|
||||
18 | foo(baz="baz", bam="bam", *["bar"])
|
||||
19 | foo(bar="bar", baz="baz", bam="bam", *[])
|
||||
20 | foo(bam="bam", *["bar"], *["baz"])
|
||||
| ^^^^^^^^ B026
|
||||
23 | foo(*["bar"], bam="bam", *["baz"])
|
||||
21 | foo(*["bar"], bam="bam", *["baz"])
|
||||
|
|
||||
|
||||
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"])
|
||||
23 | foo(*["bar"], bam="bam", *["baz"])
|
||||
19 | foo(bar="bar", baz="baz", bam="bam", *[])
|
||||
20 | foo(bam="bam", *["bar"], *["baz"])
|
||||
21 | foo(*["bar"], bam="bam", *["baz"])
|
||||
| ^^^^^^^^ B026
|
||||
|
|
||||
|
||||
|
|
|
@ -3,54 +3,54 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
|
|||
---
|
||||
B027.py:18:5: B027 `AbstractClass.empty_1` is an empty method in an abstract base class, but has no abstract decorator
|
||||
|
|
||||
18 | class AbstractClass(ABC):
|
||||
19 | def empty_1(self): # error
|
||||
17 | class AbstractClass(ABC):
|
||||
18 | def empty_1(self): # error
|
||||
| _____^
|
||||
20 | | ...
|
||||
19 | | ...
|
||||
| |___________^ B027
|
||||
21 |
|
||||
22 | def empty_2(self): # error
|
||||
20 |
|
||||
21 | def empty_2(self): # error
|
||||
|
|
||||
|
||||
B027.py:21:5: B027 `AbstractClass.empty_2` is an empty method in an abstract base class, but has no abstract decorator
|
||||
|
|
||||
21 | ...
|
||||
22 |
|
||||
23 | def empty_2(self): # error
|
||||
19 | ...
|
||||
20 |
|
||||
21 | def empty_2(self): # error
|
||||
| _____^
|
||||
24 | | pass
|
||||
22 | | pass
|
||||
| |____________^ B027
|
||||
25 |
|
||||
26 | def empty_3(self): # error
|
||||
23 |
|
||||
24 | def empty_3(self): # error
|
||||
|
|
||||
|
||||
B027.py:24:5: B027 `AbstractClass.empty_3` is an empty method in an abstract base class, but has no abstract decorator
|
||||
|
|
||||
24 | pass
|
||||
25 |
|
||||
26 | def empty_3(self): # error
|
||||
22 | pass
|
||||
23 |
|
||||
24 | def empty_3(self): # error
|
||||
| _____^
|
||||
27 | | """docstring"""
|
||||
28 | | ...
|
||||
25 | | """docstring"""
|
||||
26 | | ...
|
||||
| |___________^ B027
|
||||
29 |
|
||||
30 | def empty_4(self): # error
|
||||
27 |
|
||||
28 | def empty_4(self): # error
|
||||
|
|
||||
|
||||
B027.py:28:5: B027 `AbstractClass.empty_4` is an empty method in an abstract base class, but has no abstract decorator
|
||||
|
|
||||
28 | ...
|
||||
29 |
|
||||
30 | def empty_4(self): # error
|
||||
26 | ...
|
||||
27 |
|
||||
28 | def empty_4(self): # error
|
||||
| _____^
|
||||
31 | | """multiple ellipsis/pass"""
|
||||
29 | | """multiple ellipsis/pass"""
|
||||
30 | | ...
|
||||
31 | | pass
|
||||
32 | | ...
|
||||
33 | | pass
|
||||
34 | | ...
|
||||
35 | | pass
|
||||
| |____________^ B027
|
||||
36 |
|
||||
37 | @notabstract
|
||||
34 |
|
||||
35 | @notabstract
|
||||
|
|
||||
|
||||
|
||||
|
|
|
@ -3,21 +3,21 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
|
|||
---
|
||||
B028.py:8:1: B028 No explicit `stacklevel` keyword argument found
|
||||
|
|
||||
8 | """
|
||||
9 |
|
||||
10 | warnings.warn(DeprecationWarning("test"))
|
||||
6 | """
|
||||
7 |
|
||||
8 | warnings.warn(DeprecationWarning("test"))
|
||||
| ^^^^^^^^^^^^^ B028
|
||||
11 | warnings.warn(DeprecationWarning("test"), source=None)
|
||||
12 | warnings.warn(DeprecationWarning("test"), source=None, stacklevel=2)
|
||||
9 | warnings.warn(DeprecationWarning("test"), source=None)
|
||||
10 | warnings.warn(DeprecationWarning("test"), source=None, stacklevel=2)
|
||||
|
|
||||
|
||||
B028.py:9:1: B028 No explicit `stacklevel` keyword argument found
|
||||
|
|
||||
9 | warnings.warn(DeprecationWarning("test"))
|
||||
10 | warnings.warn(DeprecationWarning("test"), source=None)
|
||||
8 | warnings.warn(DeprecationWarning("test"))
|
||||
9 | warnings.warn(DeprecationWarning("test"), source=None)
|
||||
| ^^^^^^^^^^^^^ B028
|
||||
11 | warnings.warn(DeprecationWarning("test"), source=None, stacklevel=2)
|
||||
12 | warnings.warn(DeprecationWarning("test"), stacklevel=1)
|
||||
10 | warnings.warn(DeprecationWarning("test"), source=None, stacklevel=2)
|
||||
11 | warnings.warn(DeprecationWarning("test"), stacklevel=1)
|
||||
|
|
||||
|
||||
|
||||
|
|
|
@ -3,21 +3,21 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
|
|||
---
|
||||
B029.py:8:1: B029 Using `except ():` with an empty tuple does not catch anything; add exceptions to handle
|
||||
|
|
||||
8 | try:
|
||||
9 | pass
|
||||
10 | / except ():
|
||||
11 | | pass
|
||||
6 | try:
|
||||
7 | pass
|
||||
8 | / except ():
|
||||
9 | | pass
|
||||
| |________^ B029
|
||||
12 |
|
||||
13 | try:
|
||||
10 |
|
||||
11 | try:
|
||||
|
|
||||
|
||||
B029.py:13:1: B029 Using `except ():` with an empty tuple does not catch anything; add exceptions to handle
|
||||
|
|
||||
13 | try:
|
||||
14 | pass
|
||||
15 | / except () as e:
|
||||
16 | | pass
|
||||
11 | try:
|
||||
12 | pass
|
||||
13 | / except () as e:
|
||||
14 | | pass
|
||||
| |________^ B029
|
||||
|
|
||||
|
||||
|
|
|
@ -3,47 +3,47 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
|
|||
---
|
||||
B030.py:12:8: B030 `except` handlers should only be exception classes or tuples of exception classes
|
||||
|
|
||||
12 | try:
|
||||
13 | pass
|
||||
14 | except 1: # error
|
||||
10 | try:
|
||||
11 | pass
|
||||
12 | except 1: # error
|
||||
| ^ B030
|
||||
15 | pass
|
||||
13 | pass
|
||||
|
|
||||
|
||||
B030.py:17:9: B030 `except` handlers should only be exception classes or tuples of exception classes
|
||||
|
|
||||
17 | try:
|
||||
18 | pass
|
||||
19 | except (1, ValueError): # error
|
||||
15 | try:
|
||||
16 | pass
|
||||
17 | except (1, ValueError): # error
|
||||
| ^ B030
|
||||
20 | pass
|
||||
18 | pass
|
||||
|
|
||||
|
||||
B030.py:22:21: B030 `except` handlers should only be exception classes or tuples of exception classes
|
||||
|
|
||||
22 | try:
|
||||
23 | pass
|
||||
24 | except (ValueError, (RuntimeError, (KeyError, TypeError))): # error
|
||||
20 | try:
|
||||
21 | pass
|
||||
22 | except (ValueError, (RuntimeError, (KeyError, TypeError))): # error
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ B030
|
||||
25 | pass
|
||||
23 | pass
|
||||
|
|
||||
|
||||
B030.py:27:37: B030 `except` handlers should only be exception classes or tuples of exception classes
|
||||
|
|
||||
27 | try:
|
||||
28 | pass
|
||||
29 | except (ValueError, *(RuntimeError, (KeyError, TypeError))): # error
|
||||
25 | try:
|
||||
26 | pass
|
||||
27 | except (ValueError, *(RuntimeError, (KeyError, TypeError))): # error
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ B030
|
||||
30 | pass
|
||||
28 | pass
|
||||
|
|
||||
|
||||
B030.py:33:29: B030 `except` handlers should only be exception classes or tuples of exception classes
|
||||
|
|
||||
33 | try:
|
||||
34 | pass
|
||||
35 | except (*a, *(RuntimeError, (KeyError, TypeError))): # error
|
||||
31 | try:
|
||||
32 | pass
|
||||
33 | except (*a, *(RuntimeError, (KeyError, TypeError))): # error
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ B030
|
||||
36 | pass
|
||||
34 | pass
|
||||
|
|
||||
|
||||
|
||||
|
|
|
@ -3,196 +3,196 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
|
|||
---
|
||||
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()
|
||||
29 | collect_shop_items(shopper, section_items) # B031
|
||||
25 | for shopper in shoppers:
|
||||
26 | shopper = shopper.title()
|
||||
27 | collect_shop_items(shopper, section_items) # B031
|
||||
| ^^^^^^^^^^^^^ B031
|
||||
30 | # We're outside the nested loop and used the group again.
|
||||
31 | collect_shop_items(shopper, section_items) # B031
|
||||
28 | # We're outside the nested loop and used the group again.
|
||||
29 | collect_shop_items(shopper, section_items) # B031
|
||||
|
|
||||
|
||||
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.
|
||||
31 | collect_shop_items(shopper, section_items) # B031
|
||||
27 | collect_shop_items(shopper, section_items) # B031
|
||||
28 | # We're outside the nested loop and used the group again.
|
||||
29 | collect_shop_items(shopper, section_items) # B031
|
||||
| ^^^^^^^^^^^^^ B031
|
||||
32 |
|
||||
33 | for _section, section_items in groupby(items, key=lambda p: p[1]):
|
||||
30 |
|
||||
31 | for _section, section_items in groupby(items, key=lambda p: p[1]):
|
||||
|
|
||||
|
||||
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)
|
||||
35 | collect_shop_items("Joe", section_items) # B031
|
||||
31 | for _section, section_items in groupby(items, key=lambda p: p[1]):
|
||||
32 | collect_shop_items("Jane", section_items)
|
||||
33 | collect_shop_items("Joe", section_items) # B031
|
||||
| ^^^^^^^^^^^^^ B031
|
||||
|
|
||||
|
||||
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:
|
||||
42 | collect_shop_items(shopper, section_items) # B031
|
||||
38 | countdown = 3
|
||||
39 | while countdown > 0:
|
||||
40 | collect_shop_items(shopper, section_items) # B031
|
||||
| ^^^^^^^^^^^^^ B031
|
||||
43 | countdown -= 1
|
||||
41 | countdown -= 1
|
||||
|
|
||||
|
||||
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 | collection.append([list(section_items) for _ in range(3)]) # B031
|
||||
44 | collection = []
|
||||
45 | for _section, section_items in groupby(items, key=lambda p: p[1]):
|
||||
46 | collection.append([list(section_items) for _ in range(3)]) # B031
|
||||
| ^^^^^^^^^^^^^ B031
|
||||
49 |
|
||||
50 | unique_items = set()
|
||||
47 |
|
||||
48 | unique_items = set()
|
||||
|
|
||||
|
||||
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
|
||||
55 | # But it should be detected when used again
|
||||
56 | for item in section_items: # B031
|
||||
| ^^^^^^^^^^^^^ B031
|
||||
58 | another_set.add(item)
|
||||
57 | another_set.add(item)
|
||||
|
|
||||
|
||||
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:
|
||||
81 | collect_shop_items(shopper, section_items) # B031
|
||||
77 | for _section, section_items in itertools.groupby(items, key=lambda p: p[1]):
|
||||
78 | for shopper in shoppers:
|
||||
79 | collect_shop_items(shopper, section_items) # B031
|
||||
| ^^^^^^^^^^^^^ B031
|
||||
82 |
|
||||
83 | for _section, section_items in itertools.groupby(items, key=lambda p: p[1]):
|
||||
80 |
|
||||
81 | for _section, section_items in itertools.groupby(items, key=lambda p: p[1]):
|
||||
|
|
||||
|
||||
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
|
||||
81 | for _section, section_items in itertools.groupby(items, key=lambda p: p[1]):
|
||||
82 | _ = [collect_shop_items(shopper, section_items) for shopper in shoppers] # B031
|
||||
| ^^^^^^^^^^^^^ B031
|
||||
84 |
|
||||
85 | for _section, section_items in itertools.groupby(items, key=lambda p: p[1]):
|
||||
83 |
|
||||
84 | for _section, section_items in itertools.groupby(items, key=lambda p: p[1]):
|
||||
|
|
||||
|
||||
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.
|
||||
96 | _ = [(item1, item2) for item1 in section_items for item2 in section_items] # B031
|
||||
92 | for _section, section_items in itertools.groupby(items, key=lambda p: p[1]):
|
||||
93 | # The iterator is being used for the second time.
|
||||
94 | _ = [(item1, item2) for item1 in section_items for item2 in section_items] # B031
|
||||
| ^^^^^^^^^^^^^ B031
|
||||
97 |
|
||||
98 | for _section, section_items in itertools.groupby(items, key=lambda p: p[1]):
|
||||
95 |
|
||||
96 | for _section, section_items in itertools.groupby(items, key=lambda p: p[1]):
|
||||
|
|
||||
|
||||
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)
|
||||
103 | collect_shop_items(shopper, section_items) # B031
|
||||
99 | else:
|
||||
100 | collect_shop_items(shopper, section_items)
|
||||
101 | collect_shop_items(shopper, section_items) # B031
|
||||
| ^^^^^^^^^^^^^ B031
|
||||
104 |
|
||||
105 | for _section, section_items in itertools.groupby(items, key=lambda p: p[1]):
|
||||
102 |
|
||||
103 | for _section, section_items in itertools.groupby(items, key=lambda p: p[1]):
|
||||
|
|
||||
|
||||
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":
|
||||
110 | collect_shop_items(shopper, section_items) # B031
|
||||
106 | collect_shop_items(shopper, section_items)
|
||||
107 | if _section == "greens":
|
||||
108 | collect_shop_items(shopper, section_items) # B031
|
||||
| ^^^^^^^^^^^^^ B031
|
||||
111 | elif _section == "frozen items":
|
||||
112 | collect_shop_items(shopper, section_items) # B031
|
||||
109 | elif _section == "frozen items":
|
||||
110 | collect_shop_items(shopper, section_items) # B031
|
||||
|
|
||||
|
||||
B031.py:110: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) # B031
|
||||
109 | elif _section == "frozen items":
|
||||
110 | collect_shop_items(shopper, section_items) # B031
|
||||
111 | elif _section == "frozen items":
|
||||
112 | collect_shop_items(shopper, section_items) # B031
|
||||
| ^^^^^^^^^^^^^ B031
|
||||
113 | else:
|
||||
114 | collect_shop_items(shopper, section_items) # B031
|
||||
111 | else:
|
||||
112 | collect_shop_items(shopper, section_items) # B031
|
||||
|
|
||||
|
||||
B031.py:112: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 | else:
|
||||
112 | collect_shop_items(shopper, section_items) # B031
|
||||
113 | else:
|
||||
114 | collect_shop_items(shopper, section_items) # B031
|
||||
| ^^^^^^^^^^^^^ B031
|
||||
115 | collect_shop_items(shopper, section_items) # B031
|
||||
116 | elif _section == "frozen items":
|
||||
113 | collect_shop_items(shopper, section_items) # B031
|
||||
114 | elif _section == "frozen items":
|
||||
|
|
||||
|
||||
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
|
||||
115 | collect_shop_items(shopper, section_items) # B031
|
||||
111 | else:
|
||||
112 | collect_shop_items(shopper, section_items) # B031
|
||||
113 | collect_shop_items(shopper, section_items) # B031
|
||||
| ^^^^^^^^^^^^^ B031
|
||||
116 | elif _section == "frozen items":
|
||||
117 | # Mix `match` and `if` statements
|
||||
114 | elif _section == "frozen items":
|
||||
115 | # Mix `match` and `if` statements
|
||||
|
|
||||
|
||||
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":
|
||||
122 | collect_shop_items(shopper, section_items) # B031
|
||||
118 | collect_shop_items(shopper, section_items)
|
||||
119 | if _section == "fourth":
|
||||
120 | collect_shop_items(shopper, section_items) # B031
|
||||
| ^^^^^^^^^^^^^ B031
|
||||
123 | case _:
|
||||
124 | collect_shop_items(shopper, section_items)
|
||||
121 | case _:
|
||||
122 | collect_shop_items(shopper, section_items)
|
||||
|
|
||||
|
||||
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
|
||||
128 | collect_shop_items(shopper, section_items) # B031
|
||||
124 | collect_shop_items(shopper, section_items)
|
||||
125 | # Now, it should detect
|
||||
126 | collect_shop_items(shopper, section_items) # B031
|
||||
| ^^^^^^^^^^^^^ B031
|
||||
129 |
|
||||
130 | for _section, section_items in itertools.groupby(items, key=lambda p: p[1]):
|
||||
127 |
|
||||
128 | for _section, section_items in itertools.groupby(items, key=lambda p: p[1]):
|
||||
|
|
||||
|
||||
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":
|
||||
137 | collect_shop_items(shopper, section_items) # B031
|
||||
133 | match shopper:
|
||||
134 | case "Jane":
|
||||
135 | collect_shop_items(shopper, section_items) # B031
|
||||
| ^^^^^^^^^^^^^ B031
|
||||
138 | case _:
|
||||
139 | collect_shop_items(shopper, section_items) # B031
|
||||
136 | case _:
|
||||
137 | collect_shop_items(shopper, section_items) # B031
|
||||
|
|
||||
|
||||
B031.py:137:49: B031 Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage
|
||||
|
|
||||
135 | collect_shop_items(shopper, section_items) # B031
|
||||
136 | case _:
|
||||
137 | collect_shop_items(shopper, section_items) # B031
|
||||
138 | case _:
|
||||
139 | collect_shop_items(shopper, section_items) # B031
|
||||
| ^^^^^^^^^^^^^ B031
|
||||
140 | case "frozen items":
|
||||
141 | collect_shop_items(shopper, section_items)
|
||||
138 | case "frozen items":
|
||||
139 | collect_shop_items(shopper, section_items)
|
||||
|
|
||||
|
||||
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)
|
||||
142 | collect_shop_items(shopper, section_items) # B031
|
||||
138 | case "frozen items":
|
||||
139 | collect_shop_items(shopper, section_items)
|
||||
140 | collect_shop_items(shopper, section_items) # B031
|
||||
| ^^^^^^^^^^^^^ B031
|
||||
143 | case _:
|
||||
144 | collect_shop_items(shopper, section_items)
|
||||
141 | case _:
|
||||
142 | collect_shop_items(shopper, section_items)
|
||||
|
|
||||
|
||||
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
|
||||
146 | collect_shop_items(shopper, section_items) # B031
|
||||
142 | collect_shop_items(shopper, section_items)
|
||||
143 | # Now, it should detect
|
||||
144 | collect_shop_items(shopper, section_items) # B031
|
||||
| ^^^^^^^^^^^^^ B031
|
||||
147 |
|
||||
148 | for group in groupby(items, key=lambda p: p[1]):
|
||||
145 |
|
||||
146 | for group in groupby(items, key=lambda p: p[1]):
|
||||
|
|
||||
|
||||
|
||||
|
|
|
@ -3,76 +3,76 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
|
|||
---
|
||||
B032.py:9:1: B032 Possible unintentional type annotation (using `:`). Did you mean to assign (using `=`)?
|
||||
|
|
||||
9 | dct = {"a": 1}
|
||||
10 |
|
||||
11 | dct["b"]: 2
|
||||
7 | dct = {"a": 1}
|
||||
8 |
|
||||
9 | dct["b"]: 2
|
||||
| ^^^^^^^^^^^ B032
|
||||
12 | dct.b: 2
|
||||
10 | dct.b: 2
|
||||
|
|
||||
|
||||
B032.py:10:1: B032 Possible unintentional type annotation (using `:`). Did you mean to assign (using `=`)?
|
||||
|
|
||||
10 | dct["b"]: 2
|
||||
11 | dct.b: 2
|
||||
9 | dct["b"]: 2
|
||||
10 | dct.b: 2
|
||||
| ^^^^^^^^ B032
|
||||
12 |
|
||||
13 | dct["b"]: "test"
|
||||
11 |
|
||||
12 | dct["b"]: "test"
|
||||
|
|
||||
|
||||
B032.py:12:1: B032 Possible unintentional type annotation (using `:`). Did you mean to assign (using `=`)?
|
||||
|
|
||||
12 | dct.b: 2
|
||||
13 |
|
||||
14 | dct["b"]: "test"
|
||||
10 | dct.b: 2
|
||||
11 |
|
||||
12 | dct["b"]: "test"
|
||||
| ^^^^^^^^^^^^^^^^ B032
|
||||
15 | dct.b: "test"
|
||||
13 | dct.b: "test"
|
||||
|
|
||||
|
||||
B032.py:13:1: B032 Possible unintentional type annotation (using `:`). Did you mean to assign (using `=`)?
|
||||
|
|
||||
13 | dct["b"]: "test"
|
||||
14 | dct.b: "test"
|
||||
12 | dct["b"]: "test"
|
||||
13 | dct.b: "test"
|
||||
| ^^^^^^^^^^^^^ B032
|
||||
15 |
|
||||
16 | test = "test"
|
||||
14 |
|
||||
15 | test = "test"
|
||||
|
|
||||
|
||||
B032.py:16:1: B032 Possible unintentional type annotation (using `:`). Did you mean to assign (using `=`)?
|
||||
|
|
||||
16 | test = "test"
|
||||
17 | dct["b"]: test
|
||||
15 | test = "test"
|
||||
16 | dct["b"]: test
|
||||
| ^^^^^^^^^^^^^^ B032
|
||||
18 | dct["b"]: test.lower()
|
||||
19 | dct.b: test
|
||||
17 | dct["b"]: test.lower()
|
||||
18 | dct.b: test
|
||||
|
|
||||
|
||||
B032.py:17:1: B032 Possible unintentional type annotation (using `:`). Did you mean to assign (using `=`)?
|
||||
|
|
||||
17 | test = "test"
|
||||
18 | dct["b"]: test
|
||||
19 | dct["b"]: test.lower()
|
||||
15 | test = "test"
|
||||
16 | dct["b"]: test
|
||||
17 | dct["b"]: test.lower()
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ B032
|
||||
20 | dct.b: test
|
||||
21 | dct.b: test.lower()
|
||||
18 | dct.b: test
|
||||
19 | dct.b: test.lower()
|
||||
|
|
||||
|
||||
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()
|
||||
20 | dct.b: test
|
||||
16 | dct["b"]: test
|
||||
17 | dct["b"]: test.lower()
|
||||
18 | dct.b: test
|
||||
| ^^^^^^^^^^^ B032
|
||||
21 | dct.b: test.lower()
|
||||
19 | dct.b: test.lower()
|
||||
|
|
||||
|
||||
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
|
||||
21 | dct.b: test.lower()
|
||||
17 | dct["b"]: test.lower()
|
||||
18 | dct.b: test
|
||||
19 | dct.b: test.lower()
|
||||
| ^^^^^^^^^^^^^^^^^^^ B032
|
||||
22 |
|
||||
23 | # Do not flag below
|
||||
20 |
|
||||
21 | # Do not flag below
|
||||
|
|
||||
|
||||
|
||||
|
|
|
@ -3,21 +3,21 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
|
|||
---
|
||||
B033.py:4:35: B033 Sets should not contain duplicate item `"value1"`
|
||||
|
|
||||
4 | # Errors.
|
||||
5 | ###
|
||||
6 | incorrect_set = {"value1", 23, 5, "value1"}
|
||||
2 | # Errors.
|
||||
3 | ###
|
||||
4 | incorrect_set = {"value1", 23, 5, "value1"}
|
||||
| ^^^^^^^^ B033
|
||||
7 | incorrect_set = {1, 1}
|
||||
5 | incorrect_set = {1, 1}
|
||||
|
|
||||
|
||||
B033.py:5:21: B033 Sets should not contain duplicate item `1`
|
||||
|
|
||||
5 | ###
|
||||
6 | incorrect_set = {"value1", 23, 5, "value1"}
|
||||
7 | incorrect_set = {1, 1}
|
||||
3 | ###
|
||||
4 | incorrect_set = {"value1", 23, 5, "value1"}
|
||||
5 | incorrect_set = {1, 1}
|
||||
| ^ B033
|
||||
8 |
|
||||
9 | ###
|
||||
6 |
|
||||
7 | ###
|
||||
|
|
||||
|
||||
|
||||
|
|
|
@ -3,57 +3,57 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
|
|||
---
|
||||
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":
|
||||
12 | raise TypeError
|
||||
8 | except ValueError:
|
||||
9 | if "abc":
|
||||
10 | raise TypeError
|
||||
| ^^^^^^^^^^^^^^^ B904
|
||||
13 | raise UserWarning
|
||||
14 | except AssertionError:
|
||||
11 | raise UserWarning
|
||||
12 | except AssertionError:
|
||||
|
|
||||
|
||||
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
|
||||
13 | raise UserWarning
|
||||
9 | if "abc":
|
||||
10 | raise TypeError
|
||||
11 | raise UserWarning
|
||||
| ^^^^^^^^^^^^^^^^^ B904
|
||||
14 | except AssertionError:
|
||||
15 | raise # Bare `raise` should not be an error
|
||||
12 | except AssertionError:
|
||||
13 | raise # Bare `raise` should not be an error
|
||||
|
|
||||
|
||||
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
|
||||
18 | raise Exception("No cause here...")
|
||||
14 | except Exception as err:
|
||||
15 | assert err
|
||||
16 | raise Exception("No cause here...")
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ B904
|
||||
19 | except BaseException as base_err:
|
||||
20 | # Might use this instead of bare raise with the `.with_traceback()` method
|
||||
17 | except BaseException as base_err:
|
||||
18 | # Might use this instead of bare raise with the `.with_traceback()` method
|
||||
|
|
||||
|
||||
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 ...:
|
||||
64 | raise RuntimeError("boom!")
|
||||
60 | except Exception as e:
|
||||
61 | if ...:
|
||||
62 | raise RuntimeError("boom!")
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ B904
|
||||
65 | else:
|
||||
66 | raise RuntimeError("bang!")
|
||||
63 | else:
|
||||
64 | raise RuntimeError("bang!")
|
||||
|
|
||||
|
||||
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:
|
||||
66 | raise RuntimeError("bang!")
|
||||
62 | raise RuntimeError("boom!")
|
||||
63 | else:
|
||||
64 | raise RuntimeError("bang!")
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ B904
|
||||
|
|
||||
|
||||
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:
|
||||
74 | raise RuntimeError("boom!")
|
||||
70 | match 0:
|
||||
71 | case 0:
|
||||
72 | raise RuntimeError("boom!")
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ B904
|
||||
|
|
||||
|
||||
|
|
|
@ -3,85 +3,85 @@ source: crates/ruff/src/rules/flake8_bugbear/mod.rs
|
|||
---
|
||||
B905.py:4:1: B905 `zip()` without an explicit `strict=` parameter
|
||||
|
|
||||
4 | # Errors
|
||||
5 | zip()
|
||||
3 | # Errors
|
||||
4 | zip()
|
||||
| ^^^^^ B905
|
||||
6 | zip(range(3))
|
||||
7 | zip("a", "b")
|
||||
5 | zip(range(3))
|
||||
6 | zip("a", "b")
|
||||
|
|
||||
|
||||
B905.py:5:1: B905 `zip()` without an explicit `strict=` parameter
|
||||
|
|
||||
5 | # Errors
|
||||
6 | zip()
|
||||
7 | zip(range(3))
|
||||
3 | # Errors
|
||||
4 | zip()
|
||||
5 | zip(range(3))
|
||||
| ^^^^^^^^^^^^^ B905
|
||||
8 | zip("a", "b")
|
||||
9 | zip("a", "b", *zip("c"))
|
||||
6 | zip("a", "b")
|
||||
7 | zip("a", "b", *zip("c"))
|
||||
|
|
||||
|
||||
B905.py:6:1: B905 `zip()` without an explicit `strict=` parameter
|
||||
|
|
||||
6 | zip()
|
||||
7 | zip(range(3))
|
||||
8 | zip("a", "b")
|
||||
| ^^^^^^^^^^^^^ B905
|
||||
9 | zip("a", "b", *zip("c"))
|
||||
10 | zip(zip("a"), strict=False)
|
||||
|
|
||||
|
|
||||
4 | zip()
|
||||
5 | zip(range(3))
|
||||
6 | zip("a", "b")
|
||||
| ^^^^^^^^^^^^^ B905
|
||||
7 | zip("a", "b", *zip("c"))
|
||||
8 | zip(zip("a"), strict=False)
|
||||
|
|
||||
|
||||
B905.py:7:1: B905 `zip()` without an explicit `strict=` parameter
|
||||
|
|
||||
7 | zip(range(3))
|
||||
8 | zip("a", "b")
|
||||
9 | zip("a", "b", *zip("c"))
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ B905
|
||||
10 | zip(zip("a"), strict=False)
|
||||
11 | zip(zip("a", strict=True))
|
||||
|
|
||||
|
|
||||
5 | zip(range(3))
|
||||
6 | zip("a", "b")
|
||||
7 | zip("a", "b", *zip("c"))
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ B905
|
||||
8 | zip(zip("a"), strict=False)
|
||||
9 | zip(zip("a", strict=True))
|
||||
|
|
||||
|
||||
B905.py:7:16: B905 `zip()` without an explicit `strict=` parameter
|
||||
|
|
||||
7 | zip(range(3))
|
||||
8 | zip("a", "b")
|
||||
9 | zip("a", "b", *zip("c"))
|
||||
| ^^^^^^^^ B905
|
||||
10 | zip(zip("a"), strict=False)
|
||||
11 | zip(zip("a", strict=True))
|
||||
|
|
||||
|
|
||||
5 | zip(range(3))
|
||||
6 | zip("a", "b")
|
||||
7 | zip("a", "b", *zip("c"))
|
||||
| ^^^^^^^^ B905
|
||||
8 | zip(zip("a"), strict=False)
|
||||
9 | zip(zip("a", strict=True))
|
||||
|
|
||||
|
||||
B905.py:8:5: B905 `zip()` without an explicit `strict=` parameter
|
||||
|
|
||||
8 | zip("a", "b")
|
||||
9 | zip("a", "b", *zip("c"))
|
||||
10 | zip(zip("a"), strict=False)
|
||||
| ^^^^^^^^ B905
|
||||
11 | zip(zip("a", strict=True))
|
||||
|
|
||||
|
|
||||
6 | zip("a", "b")
|
||||
7 | zip("a", "b", *zip("c"))
|
||||
8 | zip(zip("a"), strict=False)
|
||||
| ^^^^^^^^ B905
|
||||
9 | zip(zip("a", strict=True))
|
||||
|
|
||||
|
||||
B905.py:9:1: B905 `zip()` without an explicit `strict=` parameter
|
||||
|
|
||||
9 | zip("a", "b", *zip("c"))
|
||||
10 | zip(zip("a"), strict=False)
|
||||
11 | zip(zip("a", strict=True))
|
||||
7 | zip("a", "b", *zip("c"))
|
||||
8 | zip(zip("a"), strict=False)
|
||||
9 | zip(zip("a", strict=True))
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ B905
|
||||
12 |
|
||||
13 | # OK
|
||||
10 |
|
||||
11 | # OK
|
||||
|
|
||||
|
||||
B905.py:24:1: B905 `zip()` without an explicit `strict=` parameter
|
||||
|
|
||||
24 | # Errors (limited iterators).
|
||||
25 | zip([1, 2, 3], repeat(1, 1))
|
||||
23 | # Errors (limited iterators).
|
||||
24 | zip([1, 2, 3], repeat(1, 1))
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ B905
|
||||
26 | zip([1, 2, 3], repeat(1, times=4))
|
||||
25 | zip([1, 2, 3], repeat(1, times=4))
|
||||
|
|
||||
|
||||
B905.py:25:1: B905 `zip()` without an explicit `strict=` parameter
|
||||
|
|
||||
25 | # Errors (limited iterators).
|
||||
26 | zip([1, 2, 3], repeat(1, 1))
|
||||
27 | zip([1, 2, 3], repeat(1, times=4))
|
||||
23 | # Errors (limited iterators).
|
||||
24 | zip([1, 2, 3], repeat(1, 1))
|
||||
25 | zip([1, 2, 3], repeat(1, times=4))
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ B905
|
||||
|
|
||||
|
||||
|
|
|
@ -11,178 +11,178 @@ A001.py:1:1: A001 Variable `sum` 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
|
||||
1 | import some as sum
|
||||
2 | from some import other as int
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ A001
|
||||
4 | from directory import new as dir
|
||||
3 | from directory import new as dir
|
||||
|
|
||||
|
||||
A001.py:3:1: A001 Variable `dir` is shadowing a Python builtin
|
||||
|
|
||||
3 | import some as sum
|
||||
4 | from some import other as int
|
||||
5 | from directory import new as dir
|
||||
1 | import some as sum
|
||||
2 | from some import other as int
|
||||
3 | from directory import new as dir
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ A001
|
||||
6 |
|
||||
7 | print = 1
|
||||
4 |
|
||||
5 | print = 1
|
||||
|
|
||||
|
||||
A001.py:5:1: A001 Variable `print` is shadowing a Python builtin
|
||||
|
|
||||
5 | from directory import new as dir
|
||||
6 |
|
||||
7 | print = 1
|
||||
3 | from directory import new as dir
|
||||
4 |
|
||||
5 | print = 1
|
||||
| ^^^^^ A001
|
||||
8 | copyright: 'annotation' = 2
|
||||
9 | (complex := 3)
|
||||
6 | copyright: 'annotation' = 2
|
||||
7 | (complex := 3)
|
||||
|
|
||||
|
||||
A001.py:6:1: A001 Variable `copyright` is shadowing a Python builtin
|
||||
|
|
||||
6 | print = 1
|
||||
7 | copyright: 'annotation' = 2
|
||||
5 | print = 1
|
||||
6 | copyright: 'annotation' = 2
|
||||
| ^^^^^^^^^ A001
|
||||
8 | (complex := 3)
|
||||
9 | float = object = 4
|
||||
7 | (complex := 3)
|
||||
8 | float = object = 4
|
||||
|
|
||||
|
||||
A001.py:7:2: A001 Variable `complex` is shadowing a Python builtin
|
||||
|
|
||||
7 | print = 1
|
||||
8 | copyright: 'annotation' = 2
|
||||
9 | (complex := 3)
|
||||
| ^^^^^^^ A001
|
||||
10 | float = object = 4
|
||||
11 | min, max = 5, 6
|
||||
|
|
||||
|
|
||||
5 | print = 1
|
||||
6 | copyright: 'annotation' = 2
|
||||
7 | (complex := 3)
|
||||
| ^^^^^^^ A001
|
||||
8 | float = object = 4
|
||||
9 | min, max = 5, 6
|
||||
|
|
||||
|
||||
A001.py:8:1: A001 Variable `float` is shadowing a Python builtin
|
||||
|
|
||||
8 | copyright: 'annotation' = 2
|
||||
9 | (complex := 3)
|
||||
10 | float = object = 4
|
||||
| ^^^^^ A001
|
||||
11 | min, max = 5, 6
|
||||
|
|
||||
|
|
||||
6 | copyright: 'annotation' = 2
|
||||
7 | (complex := 3)
|
||||
8 | float = object = 4
|
||||
| ^^^^^ A001
|
||||
9 | min, max = 5, 6
|
||||
|
|
||||
|
||||
A001.py:8:9: A001 Variable `object` is shadowing a Python builtin
|
||||
|
|
||||
8 | copyright: 'annotation' = 2
|
||||
9 | (complex := 3)
|
||||
10 | float = object = 4
|
||||
| ^^^^^^ A001
|
||||
11 | min, max = 5, 6
|
||||
|
|
||||
|
|
||||
6 | copyright: 'annotation' = 2
|
||||
7 | (complex := 3)
|
||||
8 | float = object = 4
|
||||
| ^^^^^^ A001
|
||||
9 | min, max = 5, 6
|
||||
|
|
||||
|
||||
A001.py:9:1: A001 Variable `min` is shadowing a Python builtin
|
||||
|
|
||||
9 | (complex := 3)
|
||||
10 | float = object = 4
|
||||
11 | min, max = 5, 6
|
||||
7 | (complex := 3)
|
||||
8 | float = object = 4
|
||||
9 | min, max = 5, 6
|
||||
| ^^^ A001
|
||||
12 |
|
||||
13 | id = 4
|
||||
10 |
|
||||
11 | id = 4
|
||||
|
|
||||
|
||||
A001.py:9:6: A001 Variable `max` is shadowing a Python builtin
|
||||
|
|
||||
9 | (complex := 3)
|
||||
10 | float = object = 4
|
||||
11 | min, max = 5, 6
|
||||
7 | (complex := 3)
|
||||
8 | float = object = 4
|
||||
9 | min, max = 5, 6
|
||||
| ^^^ A001
|
||||
12 |
|
||||
13 | id = 4
|
||||
10 |
|
||||
11 | id = 4
|
||||
|
|
||||
|
||||
A001.py:11:1: A001 Variable `id` is shadowing a Python builtin
|
||||
|
|
||||
11 | min, max = 5, 6
|
||||
12 |
|
||||
13 | id = 4
|
||||
9 | min, max = 5, 6
|
||||
10 |
|
||||
11 | id = 4
|
||||
| ^^ A001
|
||||
14 |
|
||||
15 | def bytes():
|
||||
12 |
|
||||
13 | def bytes():
|
||||
|
|
||||
|
||||
A001.py:13:5: A001 Variable `bytes` is shadowing a Python builtin
|
||||
|
|
||||
13 | id = 4
|
||||
14 |
|
||||
15 | def bytes():
|
||||
11 | id = 4
|
||||
12 |
|
||||
13 | def bytes():
|
||||
| ^^^^^ A001
|
||||
16 | pass
|
||||
14 | pass
|
||||
|
|
||||
|
||||
A001.py:16:7: A001 Variable `slice` is shadowing a Python builtin
|
||||
|
|
||||
16 | pass
|
||||
17 |
|
||||
18 | class slice:
|
||||
14 | pass
|
||||
15 |
|
||||
16 | class slice:
|
||||
| ^^^^^ A001
|
||||
19 | pass
|
||||
17 | pass
|
||||
|
|
||||
|
||||
A001.py:21:1: A001 Variable `ValueError` is shadowing a Python builtin
|
||||
|
|
||||
21 | try:
|
||||
22 | ...
|
||||
23 | / except ImportError as ValueError:
|
||||
24 | | ...
|
||||
19 | try:
|
||||
20 | ...
|
||||
21 | / except ImportError as ValueError:
|
||||
22 | | ...
|
||||
| |_______^ A001
|
||||
25 |
|
||||
26 | for memoryview, *bytearray in []:
|
||||
23 |
|
||||
24 | for memoryview, *bytearray in []:
|
||||
|
|
||||
|
||||
A001.py:24:5: A001 Variable `memoryview` is shadowing a Python builtin
|
||||
|
|
||||
24 | ...
|
||||
25 |
|
||||
26 | for memoryview, *bytearray in []:
|
||||
22 | ...
|
||||
23 |
|
||||
24 | for memoryview, *bytearray in []:
|
||||
| ^^^^^^^^^^ A001
|
||||
27 | pass
|
||||
25 | pass
|
||||
|
|
||||
|
||||
A001.py:24:18: A001 Variable `bytearray` is shadowing a Python builtin
|
||||
|
|
||||
24 | ...
|
||||
25 |
|
||||
26 | for memoryview, *bytearray in []:
|
||||
22 | ...
|
||||
23 |
|
||||
24 | for memoryview, *bytearray in []:
|
||||
| ^^^^^^^^^ A001
|
||||
27 | pass
|
||||
25 | pass
|
||||
|
|
||||
|
||||
A001.py:27:22: A001 Variable `str` is shadowing a Python builtin
|
||||
|
|
||||
27 | pass
|
||||
28 |
|
||||
29 | with open('file') as str, open('file2') as (all, any):
|
||||
25 | pass
|
||||
26 |
|
||||
27 | with open('file') as str, open('file2') as (all, any):
|
||||
| ^^^ A001
|
||||
30 | pass
|
||||
28 | pass
|
||||
|
|
||||
|
||||
A001.py:27:45: A001 Variable `all` is shadowing a Python builtin
|
||||
|
|
||||
27 | pass
|
||||
28 |
|
||||
29 | with open('file') as str, open('file2') as (all, any):
|
||||
25 | pass
|
||||
26 |
|
||||
27 | with open('file') as str, open('file2') as (all, any):
|
||||
| ^^^ A001
|
||||
30 | pass
|
||||
28 | pass
|
||||
|
|
||||
|
||||
A001.py:27:50: A001 Variable `any` is shadowing a Python builtin
|
||||
|
|
||||
27 | pass
|
||||
28 |
|
||||
29 | with open('file') as str, open('file2') as (all, any):
|
||||
25 | pass
|
||||
26 |
|
||||
27 | with open('file') as str, open('file2') as (all, any):
|
||||
| ^^^ A001
|
||||
30 | pass
|
||||
28 | pass
|
||||
|
|
||||
|
||||
A001.py:30:8: A001 Variable `sum` is shadowing a Python builtin
|
||||
|
|
||||
30 | pass
|
||||
31 |
|
||||
32 | [0 for sum in ()]
|
||||
28 | pass
|
||||
29 |
|
||||
30 | [0 for sum in ()]
|
||||
| ^^^ A001
|
||||
|
|
||||
|
||||
|
|
|
@ -11,158 +11,158 @@ A001.py:1:1: A001 Variable `sum` 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
|
||||
1 | import some as sum
|
||||
2 | from some import other as int
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ A001
|
||||
4 | from directory import new as dir
|
||||
3 | from directory import new as dir
|
||||
|
|
||||
|
||||
A001.py:5:1: A001 Variable `print` is shadowing a Python builtin
|
||||
|
|
||||
5 | from directory import new as dir
|
||||
6 |
|
||||
7 | print = 1
|
||||
3 | from directory import new as dir
|
||||
4 |
|
||||
5 | print = 1
|
||||
| ^^^^^ A001
|
||||
8 | copyright: 'annotation' = 2
|
||||
9 | (complex := 3)
|
||||
6 | copyright: 'annotation' = 2
|
||||
7 | (complex := 3)
|
||||
|
|
||||
|
||||
A001.py:6:1: A001 Variable `copyright` is shadowing a Python builtin
|
||||
|
|
||||
6 | print = 1
|
||||
7 | copyright: 'annotation' = 2
|
||||
5 | print = 1
|
||||
6 | copyright: 'annotation' = 2
|
||||
| ^^^^^^^^^ A001
|
||||
8 | (complex := 3)
|
||||
9 | float = object = 4
|
||||
7 | (complex := 3)
|
||||
8 | float = object = 4
|
||||
|
|
||||
|
||||
A001.py:7:2: A001 Variable `complex` is shadowing a Python builtin
|
||||
|
|
||||
7 | print = 1
|
||||
8 | copyright: 'annotation' = 2
|
||||
9 | (complex := 3)
|
||||
| ^^^^^^^ A001
|
||||
10 | float = object = 4
|
||||
11 | min, max = 5, 6
|
||||
|
|
||||
|
|
||||
5 | print = 1
|
||||
6 | copyright: 'annotation' = 2
|
||||
7 | (complex := 3)
|
||||
| ^^^^^^^ A001
|
||||
8 | float = object = 4
|
||||
9 | min, max = 5, 6
|
||||
|
|
||||
|
||||
A001.py:8:1: A001 Variable `float` is shadowing a Python builtin
|
||||
|
|
||||
8 | copyright: 'annotation' = 2
|
||||
9 | (complex := 3)
|
||||
10 | float = object = 4
|
||||
| ^^^^^ A001
|
||||
11 | min, max = 5, 6
|
||||
|
|
||||
|
|
||||
6 | copyright: 'annotation' = 2
|
||||
7 | (complex := 3)
|
||||
8 | float = object = 4
|
||||
| ^^^^^ A001
|
||||
9 | min, max = 5, 6
|
||||
|
|
||||
|
||||
A001.py:8:9: A001 Variable `object` is shadowing a Python builtin
|
||||
|
|
||||
8 | copyright: 'annotation' = 2
|
||||
9 | (complex := 3)
|
||||
10 | float = object = 4
|
||||
| ^^^^^^ A001
|
||||
11 | min, max = 5, 6
|
||||
|
|
||||
|
|
||||
6 | copyright: 'annotation' = 2
|
||||
7 | (complex := 3)
|
||||
8 | float = object = 4
|
||||
| ^^^^^^ A001
|
||||
9 | min, max = 5, 6
|
||||
|
|
||||
|
||||
A001.py:9:1: A001 Variable `min` is shadowing a Python builtin
|
||||
|
|
||||
9 | (complex := 3)
|
||||
10 | float = object = 4
|
||||
11 | min, max = 5, 6
|
||||
7 | (complex := 3)
|
||||
8 | float = object = 4
|
||||
9 | min, max = 5, 6
|
||||
| ^^^ A001
|
||||
12 |
|
||||
13 | id = 4
|
||||
10 |
|
||||
11 | id = 4
|
||||
|
|
||||
|
||||
A001.py:9:6: A001 Variable `max` is shadowing a Python builtin
|
||||
|
|
||||
9 | (complex := 3)
|
||||
10 | float = object = 4
|
||||
11 | min, max = 5, 6
|
||||
7 | (complex := 3)
|
||||
8 | float = object = 4
|
||||
9 | min, max = 5, 6
|
||||
| ^^^ A001
|
||||
12 |
|
||||
13 | id = 4
|
||||
10 |
|
||||
11 | id = 4
|
||||
|
|
||||
|
||||
A001.py:13:5: A001 Variable `bytes` is shadowing a Python builtin
|
||||
|
|
||||
13 | id = 4
|
||||
14 |
|
||||
15 | def bytes():
|
||||
11 | id = 4
|
||||
12 |
|
||||
13 | def bytes():
|
||||
| ^^^^^ A001
|
||||
16 | pass
|
||||
14 | pass
|
||||
|
|
||||
|
||||
A001.py:16:7: A001 Variable `slice` is shadowing a Python builtin
|
||||
|
|
||||
16 | pass
|
||||
17 |
|
||||
18 | class slice:
|
||||
14 | pass
|
||||
15 |
|
||||
16 | class slice:
|
||||
| ^^^^^ A001
|
||||
19 | pass
|
||||
17 | pass
|
||||
|
|
||||
|
||||
A001.py:21:1: A001 Variable `ValueError` is shadowing a Python builtin
|
||||
|
|
||||
21 | try:
|
||||
22 | ...
|
||||
23 | / except ImportError as ValueError:
|
||||
24 | | ...
|
||||
19 | try:
|
||||
20 | ...
|
||||
21 | / except ImportError as ValueError:
|
||||
22 | | ...
|
||||
| |_______^ A001
|
||||
25 |
|
||||
26 | for memoryview, *bytearray in []:
|
||||
23 |
|
||||
24 | for memoryview, *bytearray in []:
|
||||
|
|
||||
|
||||
A001.py:24:5: A001 Variable `memoryview` is shadowing a Python builtin
|
||||
|
|
||||
24 | ...
|
||||
25 |
|
||||
26 | for memoryview, *bytearray in []:
|
||||
22 | ...
|
||||
23 |
|
||||
24 | for memoryview, *bytearray in []:
|
||||
| ^^^^^^^^^^ A001
|
||||
27 | pass
|
||||
25 | pass
|
||||
|
|
||||
|
||||
A001.py:24:18: A001 Variable `bytearray` is shadowing a Python builtin
|
||||
|
|
||||
24 | ...
|
||||
25 |
|
||||
26 | for memoryview, *bytearray in []:
|
||||
22 | ...
|
||||
23 |
|
||||
24 | for memoryview, *bytearray in []:
|
||||
| ^^^^^^^^^ A001
|
||||
27 | pass
|
||||
25 | pass
|
||||
|
|
||||
|
||||
A001.py:27:22: A001 Variable `str` is shadowing a Python builtin
|
||||
|
|
||||
27 | pass
|
||||
28 |
|
||||
29 | with open('file') as str, open('file2') as (all, any):
|
||||
25 | pass
|
||||
26 |
|
||||
27 | with open('file') as str, open('file2') as (all, any):
|
||||
| ^^^ A001
|
||||
30 | pass
|
||||
28 | pass
|
||||
|
|
||||
|
||||
A001.py:27:45: A001 Variable `all` is shadowing a Python builtin
|
||||
|
|
||||
27 | pass
|
||||
28 |
|
||||
29 | with open('file') as str, open('file2') as (all, any):
|
||||
25 | pass
|
||||
26 |
|
||||
27 | with open('file') as str, open('file2') as (all, any):
|
||||
| ^^^ A001
|
||||
30 | pass
|
||||
28 | pass
|
||||
|
|
||||
|
||||
A001.py:27:50: A001 Variable `any` is shadowing a Python builtin
|
||||
|
|
||||
27 | pass
|
||||
28 |
|
||||
29 | with open('file') as str, open('file2') as (all, any):
|
||||
25 | pass
|
||||
26 |
|
||||
27 | with open('file') as str, open('file2') as (all, any):
|
||||
| ^^^ A001
|
||||
30 | pass
|
||||
28 | pass
|
||||
|
|
||||
|
||||
A001.py:30:8: A001 Variable `sum` is shadowing a Python builtin
|
||||
|
|
||||
30 | pass
|
||||
31 |
|
||||
32 | [0 for sum in ()]
|
||||
28 | pass
|
||||
29 |
|
||||
30 | [0 for sum in ()]
|
||||
| ^^^ A001
|
||||
|
|
||||
|
||||
|
|
|
@ -44,28 +44,28 @@ A002.py:5:17: A002 Argument `bytes` is shadowing a Python builtin
|
|||
|
|
||||
|
||||
A002.py:8:17: A002 Argument `id` is shadowing a Python builtin
|
||||
|
|
||||
8 | pass
|
||||
9 |
|
||||
10 | async def func3(id, dir):
|
||||
| ^^ A002
|
||||
11 | pass
|
||||
|
|
||||
|
|
||||
6 | pass
|
||||
7 |
|
||||
8 | async def func3(id, dir):
|
||||
| ^^ A002
|
||||
9 | pass
|
||||
|
|
||||
|
||||
A002.py:8:21: A002 Argument `dir` is shadowing a Python builtin
|
||||
|
|
||||
8 | pass
|
||||
9 |
|
||||
10 | async def func3(id, dir):
|
||||
| ^^^ A002
|
||||
11 | pass
|
||||
|
|
||||
|
|
||||
6 | pass
|
||||
7 |
|
||||
8 | async def func3(id, dir):
|
||||
| ^^^ A002
|
||||
9 | pass
|
||||
|
|
||||
|
||||
A002.py:11:16: A002 Argument `float` is shadowing a Python builtin
|
||||
|
|
||||
11 | pass
|
||||
12 |
|
||||
13 | map([], lambda float: ...)
|
||||
9 | pass
|
||||
10 |
|
||||
11 | map([], lambda float: ...)
|
||||
| ^^^^^ A002
|
||||
|
|
||||
|
||||
|
|
|
@ -45,9 +45,9 @@ A002.py:5:17: A002 Argument `bytes` is shadowing a Python builtin
|
|||
|
||||
A002.py:11:16: A002 Argument `float` is shadowing a Python builtin
|
||||
|
|
||||
11 | pass
|
||||
12 |
|
||||
13 | map([], lambda float: ...)
|
||||
9 | pass
|
||||
10 |
|
||||
11 | map([], lambda float: ...)
|
||||
| ^^^^^ A002
|
||||
|
|
||||
|
||||
|
|
|
@ -3,39 +3,39 @@ source: crates/ruff/src/rules/flake8_builtins/mod.rs
|
|||
---
|
||||
A003.py:2:5: A003 Class attribute `ImportError` is shadowing a Python builtin
|
||||
|
|
||||
2 | class MyClass:
|
||||
3 | ImportError = 4
|
||||
1 | class MyClass:
|
||||
2 | ImportError = 4
|
||||
| ^^^^^^^^^^^ A003
|
||||
4 | id = 5
|
||||
5 | dir = "/"
|
||||
3 | id = 5
|
||||
4 | dir = "/"
|
||||
|
|
||||
|
||||
A003.py:3:5: A003 Class attribute `id` is shadowing a Python builtin
|
||||
|
|
||||
3 | class MyClass:
|
||||
4 | ImportError = 4
|
||||
5 | id = 5
|
||||
1 | class MyClass:
|
||||
2 | ImportError = 4
|
||||
3 | id = 5
|
||||
| ^^ A003
|
||||
6 | dir = "/"
|
||||
4 | dir = "/"
|
||||
|
|
||||
|
||||
A003.py:4:5: A003 Class attribute `dir` is shadowing a Python builtin
|
||||
|
|
||||
4 | ImportError = 4
|
||||
5 | id = 5
|
||||
6 | dir = "/"
|
||||
2 | ImportError = 4
|
||||
3 | id = 5
|
||||
4 | dir = "/"
|
||||
| ^^^ A003
|
||||
7 |
|
||||
8 | def __init__(self):
|
||||
5 |
|
||||
6 | def __init__(self):
|
||||
|
|
||||
|
||||
A003.py:11:9: A003 Class attribute `str` is shadowing a Python builtin
|
||||
|
|
||||
11 | self.dir = "."
|
||||
12 |
|
||||
13 | def str(self):
|
||||
9 | self.dir = "."
|
||||
10 |
|
||||
11 | def str(self):
|
||||
| ^^^ A003
|
||||
14 | pass
|
||||
12 | pass
|
||||
|
|
||||
|
||||
|
||||
|
|
|
@ -3,20 +3,20 @@ source: crates/ruff/src/rules/flake8_builtins/mod.rs
|
|||
---
|
||||
A003.py:2:5: A003 Class attribute `ImportError` is shadowing a Python builtin
|
||||
|
|
||||
2 | class MyClass:
|
||||
3 | ImportError = 4
|
||||
1 | class MyClass:
|
||||
2 | ImportError = 4
|
||||
| ^^^^^^^^^^^ A003
|
||||
4 | id = 5
|
||||
5 | dir = "/"
|
||||
3 | id = 5
|
||||
4 | dir = "/"
|
||||
|
|
||||
|
||||
A003.py:11:9: A003 Class attribute `str` is shadowing a Python builtin
|
||||
|
|
||||
11 | self.dir = "."
|
||||
12 |
|
||||
13 | def str(self):
|
||||
9 | self.dir = "."
|
||||
10 |
|
||||
11 | def str(self):
|
||||
| ^^^ A003
|
||||
14 | pass
|
||||
12 | pass
|
||||
|
|
||||
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue