Compare commits

...

2 Commits

Author SHA1 Message Date
Micha Reiser
c923ffe389 Update more snapshots 2024-08-23 11:43:37 +02:00
Micha Reiser
aa7393344d Upgrade annotation snippet 2024-08-23 11:28:59 +02:00
1654 changed files with 34556 additions and 25935 deletions

19
Cargo.lock generated
View File

@@ -71,12 +71,12 @@ checksum = "c7021ce4924a3f25f802b2cccd1af585e39ea1a363a1aa2e72afe54b67a3a7a7"
[[package]]
name = "annotate-snippets"
version = "0.9.2"
version = "0.11.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ccaf7e9dfbb6ab22c82e473cd1a8a7bd313c19a5b7e40970f3d89ef5a5c9e81e"
checksum = "24e35ed54e5ea7997c14ed4c70ba043478db1112e98263b3b035907aa197d991"
dependencies = [
"anstyle",
"unicode-width",
"yansi-term",
]
[[package]]
@@ -2284,7 +2284,7 @@ name = "ruff_linter"
version = "0.6.2"
dependencies = [
"aho-corasick",
"annotate-snippets 0.9.2",
"annotate-snippets 0.11.4",
"anyhow",
"bitflags 2.6.0",
"chrono",
@@ -2470,7 +2470,7 @@ dependencies = [
name = "ruff_python_parser"
version = "0.0.0"
dependencies = [
"annotate-snippets 0.9.2",
"annotate-snippets 0.11.4",
"anyhow",
"bitflags 2.6.0",
"bstr",
@@ -3905,15 +3905,6 @@ version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec"
[[package]]
name = "yansi-term"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fe5c30ade05e61656247b2e334a031dfd0cc466fadef865bdcdea8d537951bf1"
dependencies = [
"winapi",
]
[[package]]
name = "zerocopy"
version = "0.7.32"

View File

@@ -40,7 +40,7 @@ red_knot_server = { path = "crates/red_knot_server" }
red_knot_workspace = { path = "crates/red_knot_workspace" }
aho-corasick = { version = "1.1.3" }
annotate-snippets = { version = "0.9.2", features = ["color"] }
annotate-snippets = { version = "0.11.4" }
anyhow = { version = "1.0.80" }
argfile = { version = "0.2.0" }
bincode = { version = "1.3.3" }

View File

@@ -1,7 +1,8 @@
---
source: crates/ruff/src/commands/check.rs
---
/home/ferris/project/code.py:1:1: E902 Permission denied (os error 13)
/home/ferris/project/notebook.ipynb:1:1: E902 Permission denied (os error 13)
/home/ferris/project/pyproject.toml:1:1: E902 Permission denied (os error 13)
error[E902]: /home/ferris/project/code.py:1:1: Permission denied (os error 13)
error[E902]: /home/ferris/project/notebook.ipynb:1:1: Permission denied (os error 13)
error[E902]: /home/ferris/project/pyproject.toml:1:1: Permission denied (os error 13)

View File

@@ -45,9 +45,12 @@ inline-quotes = "single"
success: false
exit_code: 1
----- stdout -----
test.py:1:5: Q000 [*] Double quotes found but single quotes preferred
test.py:1:5: B005 Using `.strip()` with multi-character strings is misleading
test.py:1:19: Q000 [*] Double quotes found but single quotes preferred
error[Q000]: test.py:1:5: [*] Double quotes found but single quotes preferred
error[B005]: test.py:1:5: Using `.strip()` with multi-character strings is misleading
error[Q000]: test.py:1:19: [*] Double quotes found but single quotes preferred
Found 3 errors.
[*] 2 fixable with the `--fix` option.
@@ -88,9 +91,12 @@ inline-quotes = "single"
success: false
exit_code: 1
----- stdout -----
-:1:5: Q000 [*] Double quotes found but single quotes preferred
-:1:5: B005 Using `.strip()` with multi-character strings is misleading
-:1:19: Q000 [*] Double quotes found but single quotes preferred
error[Q000]: -:1:5: [*] Double quotes found but single quotes preferred
error[B005]: -:1:5: Using `.strip()` with multi-character strings is misleading
error[Q000]: -:1:19: [*] Double quotes found but single quotes preferred
Found 3 errors.
[*] 2 fixable with the `--fix` option.
@@ -128,9 +134,12 @@ inline-quotes = "single"
success: false
exit_code: 1
----- stdout -----
-:1:5: Q000 [*] Double quotes found but single quotes preferred
-:1:5: B005 Using `.strip()` with multi-character strings is misleading
-:1:19: Q000 [*] Double quotes found but single quotes preferred
error[Q000]: -:1:5: [*] Double quotes found but single quotes preferred
error[B005]: -:1:5: Using `.strip()` with multi-character strings is misleading
error[Q000]: -:1:19: [*] Double quotes found but single quotes preferred
Found 3 errors.
[*] 2 fixable with the `--fix` option.
@@ -174,9 +183,12 @@ inline-quotes = "single"
success: false
exit_code: 1
----- stdout -----
-:1:5: Q000 [*] Double quotes found but single quotes preferred
-:1:5: B005 Using `.strip()` with multi-character strings is misleading
-:1:19: Q000 [*] Double quotes found but single quotes preferred
error[Q000]: -:1:5: [*] Double quotes found but single quotes preferred
error[B005]: -:1:5: Using `.strip()` with multi-character strings is misleading
error[Q000]: -:1:19: [*] Double quotes found but single quotes preferred
Found 3 errors.
[*] 2 fixable with the `--fix` option.
@@ -255,9 +267,12 @@ OTHER = "OTHER"
success: false
exit_code: 1
----- stdout -----
main.py:4:16: Q000 [*] Double quotes found but single quotes preferred
main.py:5:12: Q000 [*] Double quotes found but single quotes preferred
test.py:3:15: Q000 [*] Double quotes found but single quotes preferred
error[Q000]: main.py:4:16: [*] Double quotes found but single quotes preferred
error[Q000]: main.py:5:12: [*] Double quotes found but single quotes preferred
error[Q000]: test.py:3:15: [*] Double quotes found but single quotes preferred
Found 3 errors.
[*] 3 fixable with the `--fix` option.
@@ -305,8 +320,10 @@ if __name__ == "__main__":
success: false
exit_code: 1
----- stdout -----
generated.py:4:16: Q000 [*] Double quotes found but single quotes preferred
generated.py:5:12: Q000 [*] Double quotes found but single quotes preferred
error[Q000]: generated.py:4:16: [*] Double quotes found but single quotes preferred
error[Q000]: generated.py:5:12: [*] Double quotes found but single quotes preferred
Found 2 errors.
[*] 2 fixable with the `--fix` option.
@@ -352,7 +369,8 @@ _ = "---------------------------------------------------------------------------
success: false
exit_code: 1
----- stdout -----
test.py:5:91: E501 Line too long (109 > 100)
error[E501]: test.py:5:91: Line too long (109 > 100)
Found 1 error.
----- stderr -----
@@ -400,7 +418,8 @@ if __name__ == "__main__":
success: false
exit_code: 1
----- stdout -----
generated.py:2:8: F401 [*] `os` imported but unused
error[F401]: generated.py:2:8: [*] `os` imported but unused
Found 1 error.
[*] 1 fixable with the `--fix` option.
@@ -448,7 +467,8 @@ if __name__ == "__main__":
success: false
exit_code: 1
----- stdout -----
generated.py:2:8: F401 [*] `os` imported but unused
error[F401]: generated.py:2:8: [*] `os` imported but unused
Found 1 error.
[*] 1 fixable with the `--fix` option.
@@ -684,8 +704,10 @@ x = "longer_than_90_charactersssssssssssssssssssssssssssssssssssssssssssssssssss
success: false
exit_code: 1
----- stdout -----
-:2:1: I001 [*] Import block is un-sorted or un-formatted
-:15:91: E501 Line too long (97 > 90)
error[I001]: -:2:1: [*] Import block is un-sorted or un-formatted
error[E501]: -:15:91: Line too long (97 > 90)
Found 2 errors.
[*] 1 fixable with the `--fix` option.
@@ -809,7 +831,8 @@ select=["E501"]
success: false
exit_code: 1
----- stdout -----
-:1:91: E501 Line too long (97 > 90)
error[E501]: -:1:91: Line too long (97 > 90)
Found 1 error.
----- stderr -----
@@ -851,7 +874,8 @@ fn deprecated_config_option_overridden_via_cli() {
success: false
exit_code: 1
----- stdout -----
-:1:7: N801 Class name `lowercase` should use CapWords convention
error[N801]: -:1:7: Class name `lowercase` should use CapWords convention
Found 1 error.
----- stderr -----
@@ -925,7 +949,8 @@ include = ["*.ipy"]
success: false
exit_code: 1
----- stdout -----
main.ipy:cell 1:1:8: F401 [*] `os` imported but unused
error[F401]: main.ipy:cell 1:1:8: [*] `os` imported but unused
Found 1 error.
[*] 1 fixable with the `--fix` option.
@@ -963,7 +988,8 @@ import os
success: false
exit_code: 1
----- stdout -----
-:3:8: F401 [*] `os` imported but unused
error[F401]: -:3:8: [*] `os` imported but unused
Found 1 error.
[*] 1 fixable with the `--fix` option.
@@ -1041,7 +1067,8 @@ import os
success: false
exit_code: 1
----- stdout -----
-:2:8: F401 [*] `os` imported but unused
error[F401]: -:2:8: [*] `os` imported but unused
Found 1 error.
[*] 1 fixable with the `--fix` option.
@@ -1118,7 +1145,8 @@ import os
success: false
exit_code: 1
----- stdout -----
-:2:8: F401 [*] `os` imported but unused
error[F401]: -:2:8: [*] `os` imported but unused
Found 1 error.
[*] 1 fixable with the `--fix` option.
@@ -1159,7 +1187,8 @@ def func():
success: false
exit_code: 1
----- stdout -----
-:2:8: F401 [*] `os` imported but unused
error[F401]: -:2:8: [*] `os` imported but unused
Found 1 error.
[*] 1 fixable with the `--fix` option.
@@ -1197,7 +1226,8 @@ fn negated_per_file_ignores() -> Result<()> {
success: false
exit_code: 1
----- stdout -----
selected.py:1:1: RUF901 [*] Hey this is a stable test rule with a safe fix.
error[RUF901]: selected.py:1:1: [*] Hey this is a stable test rule with a safe fix.
Found 1 error.
[*] 1 fixable with the `--fix` option.
@@ -1239,7 +1269,8 @@ fn negated_per_file_ignores_absolute() -> Result<()> {
success: false
exit_code: 1
----- stdout -----
src/selected.py:1:1: RUF901 [*] Hey this is a stable test rule with a safe fix.
error[RUF901]: src/selected.py:1:1: [*] Hey this is a stable test rule with a safe fix.
Found 1 error.
[*] 1 fixable with the `--fix` option.

View File

@@ -29,7 +29,7 @@ ruff_source_file = { workspace = true, features = ["serde"] }
ruff_text_size = { workspace = true }
aho-corasick = { workspace = true }
annotate-snippets = { workspace = true, features = ["color"] }
annotate-snippets = { workspace = true }
anyhow = { workspace = true }
bitflags = { workspace = true }
chrono = { workspace = true }

View File

@@ -9,7 +9,7 @@ use ruff_source_file::OneIndexed;
use crate::fs::relativize_path;
use crate::message::diff::calculate_print_width;
use crate::message::text::{MessageCodeFrame, RuleCodeAndBody};
use crate::message::text::RuleCodeAndBody;
use crate::message::{
group_messages_by_filename, Emitter, EmitterContext, Message, MessageWithLocation,
};
@@ -154,16 +154,16 @@ impl Display for DisplayGroupedMessage<'_> {
)?;
if self.show_source {
use std::fmt::Write;
let mut padded = PadAdapter::new(f);
writeln!(
padded,
"{}",
MessageCodeFrame {
message,
notebook_index: self.notebook_index
}
)?;
// use std::fmt::Write;
// let mut padded = PadAdapter::new(f);
// writeln!(
// padded,
// "{}",
// MessageCodeFrame {
// message,
// notebook_index: self.notebook_index
// }
// )?;
}
Ok(())

View File

@@ -112,10 +112,7 @@ impl Message {
.map_or(TextSize::new(0), TextLen::text_len);
Message::SyntaxError(SyntaxErrorMessage {
message: format!(
"SyntaxError: {}",
DisplayParseErrorType::new(&parse_error.error)
),
message: DisplayParseErrorType::new(&parse_error.error).to_string(),
range: TextRange::at(parse_error.location.start(), len),
file,
})

View File

@@ -2,5 +2,5 @@
source: crates/ruff_linter/src/message/azure.rs
expression: content
---
##vso[task.logissue type=error;sourcepath=syntax_errors.py;linenumber=1;columnnumber=15;]SyntaxError: Expected one or more symbol names after import
##vso[task.logissue type=error;sourcepath=syntax_errors.py;linenumber=3;columnnumber=12;]SyntaxError: Expected ')', found newline
##vso[task.logissue type=error;sourcepath=syntax_errors.py;linenumber=1;columnnumber=15;]Expected one or more symbol names after import
##vso[task.logissue type=error;sourcepath=syntax_errors.py;linenumber=3;columnnumber=12;]Expected ')', found newline

View File

@@ -2,5 +2,5 @@
source: crates/ruff_linter/src/message/github.rs
expression: content
---
::error title=Ruff,file=syntax_errors.py,line=1,col=15,endLine=2,endColumn=1::syntax_errors.py:1:15: SyntaxError: Expected one or more symbol names after import
::error title=Ruff,file=syntax_errors.py,line=3,col=12,endLine=4,endColumn=1::syntax_errors.py:3:12: SyntaxError: Expected ')', found newline
::error title=Ruff,file=syntax_errors.py,line=1,col=15,endLine=2,endColumn=1::syntax_errors.py:1:15: Expected one or more symbol names after import
::error title=Ruff,file=syntax_errors.py,line=3,col=12,endLine=4,endColumn=1::syntax_errors.py:3:12: Expected ')', found newline

View File

@@ -4,7 +4,7 @@ expression: redact_fingerprint(&content)
---
[
{
"description": "SyntaxError: Expected one or more symbol names after import",
"description": "Expected one or more symbol names after import",
"fingerprint": "<redacted>",
"location": {
"lines": {
@@ -16,7 +16,7 @@ expression: redact_fingerprint(&content)
"severity": "major"
},
{
"description": "SyntaxError: Expected ')', found newline",
"description": "Expected ')', found newline",
"fingerprint": "<redacted>",
"location": {
"lines": {

View File

@@ -3,10 +3,8 @@ source: crates/ruff_linter/src/message/grouped.rs
expression: content
---
fib.py:
1:8 F401 `os` imported but unused
6:5 F841 Local variable `x` is assigned to but never used
1:8 `os` imported but unused
6:5 Local variable `x` is assigned to but never used
undef.py:
1:4 F821 Undefined name `a`
1:4 Undefined name `a`

View File

@@ -3,29 +3,7 @@ source: crates/ruff_linter/src/message/grouped.rs
expression: content
---
fib.py:
1:8 F401 `os` imported but unused
|
1 | import os
| ^^ F401
|
= help: Remove unused import: `os`
6:5 F841 Local variable `x` is assigned to but never used
|
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`
1:8 `os` imported but unused
6:5 Local variable `x` is assigned to but never used
undef.py:
1:4 F821 Undefined name `a`
|
1 | if a == 1: pass
| ^ F821
|
1:4 Undefined name `a`

View File

@@ -3,29 +3,7 @@ source: crates/ruff_linter/src/message/grouped.rs
expression: content
---
fib.py:
1:8 F401 [*] `os` imported but unused
|
1 | import os
| ^^ F401
|
= help: Remove unused import: `os`
6:5 F841 [*] Local variable `x` is assigned to but never used
|
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`
1:8 [*] `os` imported but unused
6:5 [*] Local variable `x` is assigned to but never used
undef.py:
1:4 F821 Undefined name `a`
|
1 | if a == 1: pass
| ^ F821
|
1:4 Undefined name `a`

View File

@@ -3,29 +3,7 @@ source: crates/ruff_linter/src/message/grouped.rs
expression: content
---
fib.py:
1:8 F401 `os` imported but unused
|
1 | import os
| ^^ F401
|
= help: Remove unused import: `os`
6:5 F841 Local variable `x` is assigned to but never used
|
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`
1:8 `os` imported but unused
6:5 Local variable `x` is assigned to but never used
undef.py:
1:4 F821 Undefined name `a`
|
1 | if a == 1: pass
| ^ F821
|
1:4 Undefined name `a`

View File

@@ -3,5 +3,5 @@ source: crates/ruff_linter/src/message/grouped.rs
expression: content
---
syntax_errors.py:
1:15 SyntaxError: Expected one or more symbol names after import
3:12 SyntaxError: Expected ')', found newline
1:15 Expected one or more symbol names after import
3:12 Expected ')', found newline

View File

@@ -16,7 +16,7 @@ expression: content
"column": 15,
"row": 1
},
"message": "SyntaxError: Expected one or more symbol names after import",
"message": "Expected one or more symbol names after import",
"noqa_row": null,
"url": null
},
@@ -33,7 +33,7 @@ expression: content
"column": 12,
"row": 3
},
"message": "SyntaxError: Expected ')', found newline",
"message": "Expected ')', found newline",
"noqa_row": null,
"url": null
}

View File

@@ -2,5 +2,5 @@
source: crates/ruff_linter/src/message/json_lines.rs
expression: content
---
{"cell":null,"code":null,"end_location":{"column":1,"row":2},"filename":"syntax_errors.py","fix":null,"location":{"column":15,"row":1},"message":"SyntaxError: Expected one or more symbol names after import","noqa_row":null,"url":null}
{"cell":null,"code":null,"end_location":{"column":1,"row":4},"filename":"syntax_errors.py","fix":null,"location":{"column":12,"row":3},"message":"SyntaxError: Expected ')', found newline","noqa_row":null,"url":null}
{"cell":null,"code":null,"end_location":{"column":1,"row":2},"filename":"syntax_errors.py","fix":null,"location":{"column":15,"row":1},"message":"Expected one or more symbol names after import","noqa_row":null,"url":null}
{"cell":null,"code":null,"end_location":{"column":1,"row":4},"filename":"syntax_errors.py","fix":null,"location":{"column":12,"row":3},"message":"Expected ')', found newline","noqa_row":null,"url":null}

View File

@@ -6,10 +6,10 @@ expression: content
<testsuites name="ruff" tests="2" failures="2" errors="0">
<testsuite name="syntax_errors.py" tests="2" disabled="0" errors="0" failures="2" package="org.ruff">
<testcase name="org.ruff" classname="syntax_errors" line="1" column="15">
<failure message="SyntaxError: Expected one or more symbol names after import">line 1, col 15, SyntaxError: Expected one or more symbol names after import</failure>
<failure message="Expected one or more symbol names after import">line 1, col 15, Expected one or more symbol names after import</failure>
</testcase>
<testcase name="org.ruff" classname="syntax_errors" line="3" column="12">
<failure message="SyntaxError: Expected &apos;)&apos;, found newline">line 3, col 12, SyntaxError: Expected &apos;)&apos;, found newline</failure>
<failure message="Expected &apos;)&apos;, found newline">line 3, col 12, Expected &apos;)&apos;, found newline</failure>
</testcase>
</testsuite>
</testsuites>

View File

@@ -2,5 +2,5 @@
source: crates/ruff_linter/src/message/pylint.rs
expression: content
---
syntax_errors.py:1: SyntaxError: Expected one or more symbol names after import
syntax_errors.py:3: SyntaxError: Expected ')', found newline
syntax_errors.py:1: Expected one or more symbol names after import
syntax_errors.py:3: Expected ')', found newline

View File

@@ -22,7 +22,7 @@ expression: content
}
}
},
"message": "SyntaxError: Expected one or more symbol names after import"
"message": "Expected one or more symbol names after import"
},
{
"code": {
@@ -42,7 +42,7 @@ expression: content
}
}
},
"message": "SyntaxError: Expected ')', found newline"
"message": "Expected ')', found newline"
}
],
"severity": "warning",

View File

@@ -2,28 +2,30 @@
source: crates/ruff_linter/src/message/text.rs
expression: content
---
fib.py:1:8: F401 `os` imported but unused
error[F401]: 1:8: `os` imported but unused
--> fib.py:1:8
|
1 | import os
| ^^ F401
| ^^
|
= help: Remove unused import: `os`
error[F841]: 6:5: Local variable `x` is assigned to but never used
fib.py:6:5: F841 Local variable `x` is assigned to but never used
--> fib.py:6:5
|
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`
error[F821]: 1:4: Undefined name `a`
undef.py:1:4: F821 Undefined name `a`
--> undef.py:1:4
|
1 | if a == 1: pass
| ^ F821
| ^
|

View File

@@ -2,28 +2,30 @@
source: crates/ruff_linter/src/message/text.rs
expression: content
---
fib.py:1:8: F401 `os` imported but unused
error[F401]: 1:8: `os` imported but unused
--> fib.py:1:8
|
1 | import os
| ^^ F401
| ^^
|
= help: Remove unused import: `os`
error[F841]: 6:5: Local variable `x` is assigned to but never used
fib.py:6:5: F841 Local variable `x` is assigned to but never used
--> fib.py:6:5
|
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`
error[F821]: 1:4: Undefined name `a`
undef.py:1:4: F821 Undefined name `a`
--> undef.py:1:4
|
1 | if a == 1: pass
| ^ F821
| ^
|

View File

@@ -2,28 +2,30 @@
source: crates/ruff_linter/src/message/text.rs
expression: content
---
fib.py:1:8: F401 [*] `os` imported but unused
error[F401]: 1:8: [*] `os` imported but unused
--> fib.py:1:8
|
1 | import os
| ^^ F401
| ^^
|
= help: Remove unused import: `os`
error[F841]: 6:5: [*] Local variable `x` is assigned to but never used
fib.py:6:5: F841 [*] Local variable `x` is assigned to but never used
--> fib.py:6:5
|
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`
error[F821]: 1:4: Undefined name `a`
undef.py:1:4: F821 Undefined name `a`
--> undef.py:1:4
|
1 | if a == 1: pass
| ^ F821
| ^
|

View File

@@ -2,31 +2,33 @@
source: crates/ruff_linter/src/message/text.rs
expression: content
---
notebook.ipynb:cell 1:2:8: F401 [*] `os` imported but unused
error[F401]: cell 1:2:8: [*] `os` imported but unused
--> notebook.ipynb:2:8
|
1 | # cell 1
2 | import os
| ^^ F401
| ^^
|
= help: Remove unused import: `os`
error[F401]: cell 2:2:8: [*] `math` imported but unused
notebook.ipynb:cell 2:2:8: F401 [*] `math` imported but unused
--> notebook.ipynb:2:8
|
1 | # cell 2
2 | import math
| ^^^^ F401
| ^^^^
3 |
4 | print('hello world')
|
= help: Remove unused import: `math`
error[F841]: cell 3:4:5: [*] Local variable `x` is assigned to but never used
notebook.ipynb:cell 3:4:5: F841 [*] Local variable `x` is assigned to but never used
--> notebook.ipynb:4:5
|
2 | def foo():
3 | print()
4 | x = 1
| ^ F841
| ^
|
= help: Remove assignment to unused variable `x`

View File

@@ -2,7 +2,9 @@
source: crates/ruff_linter/src/message/text.rs
expression: content
---
syntax_errors.py:1:15: SyntaxError: Expected one or more symbol names after import
error[syntax-error]: 1:15: Expected one or more symbol names after import
--> syntax_errors.py:1:15
|
1 | from os import
| ^
@@ -10,8 +12,9 @@ syntax_errors.py:1:15: SyntaxError: Expected one or more symbol names after impo
3 | if call(foo
4 | def bar():
|
error[syntax-error]: 3:12: Expected ')', found newline
syntax_errors.py:3:12: SyntaxError: Expected ')', found newline
--> syntax_errors.py:3:12
|
1 | from os import
2 |

View File

@@ -1,12 +1,11 @@
use std::borrow::Cow;
use std::fmt::Write as _;
use std::fmt::{Display, Formatter};
use std::io::Write;
use annotate_snippets::display_list::{DisplayList, FormatOptions};
use annotate_snippets::snippet::{Annotation, AnnotationType, Slice, Snippet, SourceAnnotation};
use annotate_snippets::{Level, Renderer, Snippet};
use bitflags::bitflags;
use colored::Colorize;
use ruff_notebook::NotebookIndex;
use ruff_source_file::{OneIndexed, SourceLocation};
use ruff_text_size::{Ranged, TextRange, TextSize};
@@ -71,20 +70,16 @@ impl Emitter for TextEmitter {
context: &EmitterContext,
) -> anyhow::Result<()> {
for message in messages {
write!(
writer,
"{path}{sep}",
path = relativize_path(message.filename()).bold(),
sep = ":".cyan(),
)?;
let mut title = String::new();
let start_location = message.compute_start_location();
let notebook_index = context.notebook_index(message.filename());
// Check if we're working on a jupyter notebook and translate positions with cell accordingly
// TODO: Only append location to title if there are no snippets
let diagnostic_location = if let Some(notebook_index) = notebook_index {
write!(
writer,
title,
"cell {cell}{sep}",
cell = notebook_index
.cell(start_location.row)
@@ -103,7 +98,7 @@ impl Emitter for TextEmitter {
};
writeln!(
writer,
title,
"{row}{sep}{col}{sep} {code_and_body}",
row = diagnostic_location.row,
col = diagnostic_location.column,
@@ -115,19 +110,39 @@ impl Emitter for TextEmitter {
}
)?;
if self.flags.intersects(EmitterFlags::SHOW_SOURCE) {
// The `0..0` range is used to highlight file-level diagnostics.
if message.range() != TextRange::default() {
writeln!(
writer,
"{}",
MessageCodeFrame {
message,
notebook_index
}
)?;
let code = message
.rule()
.map(|rule| rule.noqa_code().to_string())
.unwrap_or_else(|| "syntax-error".to_string());
let mut snippet_message = Level::Error.title(&title).id(&code);
// The `0..0` range is used to highlight file-level diagnostics.
let (code_frame, advise) = if self.flags.intersects(EmitterFlags::SHOW_SOURCE)
&& message.range() != TextRange::default()
{
(
Some(CodeFrameSnippet::new(message, notebook_index)),
create_suggestion_footer(&message),
)
} else {
(None, None)
};
snippet_message = snippet_message
.snippets(code_frame.as_ref().map(|snippet| snippet.as_snippet()))
.footers(advise);
let renderer = if cfg!(not(test)) {
if colored::control::SHOULD_COLORIZE.should_colorize() {
Renderer::styled()
} else {
Renderer::plain()
}
}
} else {
Renderer::plain()
};
writeln!(writer, "{}", renderer.render(snippet_message))?;
if self.flags.intersects(EmitterFlags::SHOW_FIX_DIFF) {
if let Some(diff) = Diff::from_message(message) {
@@ -152,9 +167,6 @@ impl Display for RuleCodeAndBody<'_> {
if let Some(fix) = self.message.fix() {
// Do not display an indicator for unapplicable fixes
if fix.applies(self.unsafe_fixes.required_applicability()) {
if let Some(rule) = self.message.rule() {
write!(f, "{} ", rule.noqa_code().to_string().red().bold())?;
}
return write!(
f,
"{fix}{body}",
@@ -165,45 +177,26 @@ impl Display for RuleCodeAndBody<'_> {
}
};
if let Some(rule) = self.message.rule() {
write!(
f,
"{code} {body}",
code = rule.noqa_code().to_string().red().bold(),
body = self.message.body(),
)
} else {
f.write_str(self.message.body())
}
f.write_str(self.message.body())
}
}
pub(super) struct MessageCodeFrame<'a> {
pub(crate) message: &'a Message,
pub(crate) notebook_index: Option<&'a NotebookIndex>,
struct CodeFrameSnippet<'a> {
pub(crate) source: SourceCode<'a>,
file_name: String,
line_start: OneIndexed,
}
impl Display for MessageCodeFrame<'_> {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
let suggestion = self.message.suggestion();
let footer = if suggestion.is_some() {
vec![Annotation {
id: None,
label: suggestion,
annotation_type: AnnotationType::Help,
}]
} else {
Vec::new()
};
impl<'a> CodeFrameSnippet<'a> {
fn new(message: &'a Message, notebook_index: Option<&NotebookIndex>) -> Self {
let source_code = message.source_file().to_source_code();
let source_code = self.message.source_file().to_source_code();
let content_start_index = source_code.line_index(self.message.start());
let content_start_index = source_code.line_index(message.start());
let mut start_index = content_start_index.saturating_sub(2);
// If we're working with a Jupyter Notebook, skip the lines which are
// outside of the cell containing the diagnostic.
if let Some(index) = self.notebook_index {
if let Some(index) = notebook_index {
let content_start_cell = index.cell(content_start_index).unwrap_or(OneIndexed::MIN);
while start_index < content_start_index {
if index.cell(start_index).unwrap_or(OneIndexed::MIN) == content_start_cell {
@@ -221,14 +214,14 @@ impl Display for MessageCodeFrame<'_> {
start_index = start_index.saturating_add(1);
}
let content_end_index = source_code.line_index(self.message.end());
let content_end_index = source_code.line_index(message.end());
let mut end_index = content_end_index
.saturating_add(2)
.min(OneIndexed::from_zero_indexed(source_code.line_count()));
// If we're working with a Jupyter Notebook, skip the lines which are
// outside of the cell containing the diagnostic.
if let Some(index) = self.notebook_index {
if let Some(index) = notebook_index {
let content_end_cell = index.cell(content_end_index).unwrap_or(OneIndexed::MIN);
while end_index > content_end_index {
if index.cell(end_index).unwrap_or(OneIndexed::MIN) == content_end_cell {
@@ -252,60 +245,48 @@ impl Display for MessageCodeFrame<'_> {
let source = replace_whitespace(
source_code.slice(TextRange::new(start_offset, end_offset)),
self.message.range() - start_offset,
message.range() - start_offset,
);
let source_text = source.text.show_nonprinting();
// TODO: Is it safe to keep the same annotation range after
// TODO handle show nonpritning
// showing nonprinting/replacing whitespace?
// let source = SourceCode {
// text: source.text.show_nonprinting(),
// annotation_range: source.annotation_range,
// };
let start_char = source.text[TextRange::up_to(source.annotation_range.start())]
.chars()
.count();
let char_length = source.text[source.annotation_range].chars().count();
let label = self
.message
.rule()
.map_or_else(String::new, |rule| rule.noqa_code().to_string());
let snippet = Snippet {
title: None,
slices: vec![Slice {
source: &source_text,
line_start: self.notebook_index.map_or_else(
|| start_index.get(),
|notebook_index| {
notebook_index
.cell_row(start_index)
.unwrap_or(OneIndexed::MIN)
.get()
},
),
annotations: vec![SourceAnnotation {
label: &label,
annotation_type: AnnotationType::Error,
range: (start_char, start_char + char_length),
}],
// The origin (file name, line number, and column number) is already encoded
// in the `label`.
origin: None,
fold: false,
}],
footer,
opt: FormatOptions {
#[cfg(test)]
color: false,
#[cfg(not(test))]
color: colored::control::SHOULD_COLORIZE.should_colorize(),
..FormatOptions::default()
let line_start = notebook_index.map_or_else(
|| start_index,
|notebook_index| {
notebook_index
.cell_row(start_index)
.unwrap_or(OneIndexed::MIN)
},
};
);
writeln!(f, "{message}", message = DisplayList::from(snippet))
Self {
line_start,
source,
file_name: relativize_path(message.filename()),
}
}
pub(super) fn as_snippet(&self) -> Snippet {
Snippet::source(&self.source.text)
.origin(&self.file_name)
.line_start(self.line_start.get())
.annotation(Level::Error.span(self.source.annotation_range.into()))
}
}
fn replace_whitespace(source: &str, annotation_range: TextRange) -> SourceCode {
fn create_suggestion_footer(message: &Message) -> Option<annotate_snippets::Message> {
let suggestion = message.suggestion()?;
Some(Level::Help.title(suggestion))
}
fn replace_whitespace<'a>(source: &str, annotation_range: TextRange) -> SourceCode {
let mut result = String::new();
let mut last_end = 0;
let mut range = annotation_range;

View File

@@ -1,22 +1,23 @@
---
source: crates/ruff_linter/src/rules/airflow/mod.rs
---
AIR001.py:11:1: AIR001 Task variable name should match the `task_id`: "my_task"
error[AIR001]: 11:1: Task variable name should match the `task_id`: "my_task"
--> AIR001.py:10:1
|
9 | my_task_2 = PythonOperator(callable=my_callable, task_id="my_task_2")
10 |
11 | incorrect_name = PythonOperator(task_id="my_task")
| ^^^^^^^^^^^^^^ AIR001
| ^^^^^^^^^^^^^^
12 | incorrect_name_2 = PythonOperator(callable=my_callable, task_id="my_task_2")
|
error[AIR001]: 12:1: Task variable name should match the `task_id`: "my_task_2"
AIR001.py:12:1: AIR001 Task variable name should match the `task_id`: "my_task_2"
--> AIR001.py:11:51
|
11 | incorrect_name = PythonOperator(task_id="my_task")
12 | incorrect_name_2 = PythonOperator(callable=my_callable, task_id="my_task_2")
| ^^^^^^^^^^^^^^^^ AIR001
| ^^^^^^^^^^^^^^^^
13 |
14 | from my_module import MyClass
|

View File

@@ -1,31 +1,33 @@
---
source: crates/ruff_linter/src/rules/eradicate/mod.rs
---
ERA001.py:1:1: ERA001 Found commented-out code
error[ERA001]: 1:1: Found commented-out code
--> ERA001.py:1:1
|
1 | #import os
| ^^^^^^^^^^ ERA001
| ^^^^^^^^^^
2 | # from foo import junk
3 | #a = 3
|
= help: Remove commented-out code
Display-only fix
1 |-#import os
2 1 | # from foo import junk
3 2 | #a = 3
4 3 | a = 4
ERA001.py:2:1: ERA001 Found commented-out code
error[ERA001]: 2:1: Found commented-out code
--> ERA001.py:1:11
|
1 | #import os
2 | # from foo import junk
| ^^^^^^^^^^^^^^^^^^^^^^ ERA001
| ^^^^^^^^^^^^^^^^^^^^^^
3 | #a = 3
4 | a = 4
|
= help: Remove commented-out code
Display-only fix
1 1 | #import os
2 |-# from foo import junk
@@ -33,17 +35,18 @@ ERA001.py:2:1: ERA001 Found commented-out code
4 3 | a = 4
5 4 | #foo(1, 2, 3)
ERA001.py:3:1: ERA001 Found commented-out code
error[ERA001]: 3:1: Found commented-out code
--> ERA001.py:2:23
|
1 | #import os
2 | # from foo import junk
3 | #a = 3
| ^^^^^^ ERA001
| ^^^^^^
4 | a = 4
5 | #foo(1, 2, 3)
|
= help: Remove commented-out code
Display-only fix
1 1 | #import os
2 2 | # from foo import junk
@@ -52,17 +55,18 @@ ERA001.py:3:1: ERA001 Found commented-out code
5 4 | #foo(1, 2, 3)
6 5 |
ERA001.py:5:1: ERA001 Found commented-out code
error[ERA001]: 5:1: Found commented-out code
--> ERA001.py:4:6
|
3 | #a = 3
4 | a = 4
5 | #foo(1, 2, 3)
| ^^^^^^^^^^^^^ ERA001
| ^^^^^^^^^^^^^
6 |
7 | def foo(x, y, z):
|
= help: Remove commented-out code
Display-only fix
2 2 | # from foo import junk
3 3 | #a = 3
@@ -72,16 +76,17 @@ ERA001.py:5:1: ERA001 Found commented-out code
7 6 | def foo(x, y, z):
8 7 | content = 1 # print('hello')
ERA001.py:13:5: ERA001 Found commented-out code
error[ERA001]: 13:5: Found commented-out code
--> ERA001.py:13:5
|
11 | # This is a real comment.
12 | # # This is a (nested) comment.
13 | #return True
| ^^^^^^^^^^^^ ERA001
| ^^^^^^^^^^^^
14 | return False
|
= help: Remove commented-out code
Display-only fix
10 10 |
11 11 | # This is a real comment.
@@ -91,15 +96,16 @@ ERA001.py:13:5: ERA001 Found commented-out code
15 14 |
16 15 | #import os # noqa: ERA001
ERA001.py:21:5: ERA001 Found commented-out code
error[ERA001]: 21:5: Found commented-out code
--> ERA001.py:21:5
|
19 | class A():
20 | pass
21 | # b = c
| ^^^^^^^ ERA001
| ^^^^^^^
|
= help: Remove commented-out code
Display-only fix
18 18 |
19 19 | class A():
@@ -109,17 +115,18 @@ ERA001.py:21:5: ERA001 Found commented-out code
23 22 |
24 23 | dictionary = {
ERA001.py:26:5: ERA001 Found commented-out code
error[ERA001]: 26:5: Found commented-out code
--> ERA001.py:26:5
|
24 | dictionary = {
25 | # "key1": 123, # noqa: ERA001
26 | # "key2": 456,
| ^^^^^^^^^^^^^^ ERA001
| ^^^^^^^^^^^^^^
27 | # "key3": 789, # test
28 | }
|
= help: Remove commented-out code
Display-only fix
23 23 |
24 24 | dictionary = {
@@ -129,16 +136,17 @@ ERA001.py:26:5: ERA001 Found commented-out code
28 27 | }
29 28 |
ERA001.py:27:5: ERA001 Found commented-out code
error[ERA001]: 27:5: Found commented-out code
--> ERA001.py:27:5
|
25 | # "key1": 123, # noqa: ERA001
26 | # "key2": 456,
27 | # "key3": 789, # test
| ^^^^^^^^^^^^^^^^^^^^^^ ERA001
| ^^^^^^^^^^^^^^^^^^^^^^
28 | }
|
= help: Remove commented-out code
Display-only fix
24 24 | dictionary = {
25 25 | # "key1": 123, # noqa: ERA001
@@ -148,17 +156,18 @@ ERA001.py:27:5: ERA001 Found commented-out code
29 28 |
30 29 | #import os # noqa
ERA001.py:32:1: ERA001 Found commented-out code
error[ERA001]: 32:1: Found commented-out code
--> ERA001.py:31:1
|
30 | #import os # noqa
31 |
32 | # case 1:
| ^^^^^^^^^ ERA001
| ^^^^^^^^^
33 | # try:
34 | # try: # with comment
|
= help: Remove commented-out code
Display-only fix
29 29 |
30 30 | #import os # noqa
@@ -168,16 +177,17 @@ ERA001.py:32:1: ERA001 Found commented-out code
34 33 | # try: # with comment
35 34 | # try: print()
ERA001.py:33:1: ERA001 Found commented-out code
error[ERA001]: 33:1: Found commented-out code
--> ERA001.py:32:10
|
32 | # case 1:
33 | # try:
| ^^^^^^ ERA001
| ^^^^^^
34 | # try: # with comment
35 | # try: print()
|
= help: Remove commented-out code
Display-only fix
30 30 | #import os # noqa
31 31 |
@@ -187,17 +197,18 @@ ERA001.py:33:1: ERA001 Found commented-out code
35 34 | # try: print()
36 35 | # except:
ERA001.py:34:1: ERA001 Found commented-out code
error[ERA001]: 34:1: Found commented-out code
--> ERA001.py:33:7
|
32 | # case 1:
33 | # try:
34 | # try: # with comment
| ^^^^^^^^^^^^^^^^^^^^^^ ERA001
| ^^^^^^^^^^^^^^^^^^^^^^
35 | # try: print()
36 | # except:
|
= help: Remove commented-out code
Display-only fix
31 31 |
32 32 | # case 1:
@@ -207,17 +218,18 @@ ERA001.py:34:1: ERA001 Found commented-out code
36 35 | # except:
37 36 | # except Foo:
ERA001.py:35:1: ERA001 Found commented-out code
error[ERA001]: 35:1: Found commented-out code
--> ERA001.py:34:23
|
33 | # try:
34 | # try: # with comment
35 | # try: print()
| ^^^^^^^^^^^^^^ ERA001
| ^^^^^^^^^^^^^^
36 | # except:
37 | # except Foo:
|
= help: Remove commented-out code
Display-only fix
32 32 | # case 1:
33 33 | # try:
@@ -227,17 +239,18 @@ ERA001.py:35:1: ERA001 Found commented-out code
37 36 | # except Foo:
38 37 | # except Exception as e: print(e)
ERA001.py:36:1: ERA001 Found commented-out code
error[ERA001]: 36:1: Found commented-out code
--> ERA001.py:35:15
|
34 | # try: # with comment
35 | # try: print()
36 | # except:
| ^^^^^^^^^ ERA001
| ^^^^^^^^^
37 | # except Foo:
38 | # except Exception as e: print(e)
|
= help: Remove commented-out code
Display-only fix
33 33 | # try:
34 34 | # try: # with comment
@@ -247,16 +260,17 @@ ERA001.py:36:1: ERA001 Found commented-out code
38 37 | # except Exception as e: print(e)
39 38 |
ERA001.py:37:1: ERA001 Found commented-out code
error[ERA001]: 37:1: Found commented-out code
--> ERA001.py:36:10
|
35 | # try: print()
36 | # except:
37 | # except Foo:
| ^^^^^^^^^^^^^ ERA001
| ^^^^^^^^^^^^^
38 | # except Exception as e: print(e)
|
= help: Remove commented-out code
Display-only fix
34 34 | # try: # with comment
35 35 | # try: print()
@@ -266,15 +280,16 @@ ERA001.py:37:1: ERA001 Found commented-out code
39 38 |
40 39 |
ERA001.py:38:1: ERA001 Found commented-out code
error[ERA001]: 38:1: Found commented-out code
--> ERA001.py:37:14
|
36 | # except:
37 | # except Foo:
38 | # except Exception as e: print(e)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ERA001
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: Remove commented-out code
Display-only fix
35 35 | # try: print()
36 36 | # except:
@@ -284,16 +299,17 @@ ERA001.py:38:1: ERA001 Found commented-out code
40 39 |
41 40 | # Script tag without an opening tag (Error)
ERA001.py:44:1: ERA001 Found commented-out code
error[ERA001]: 44:1: Found commented-out code
--> ERA001.py:43:29
|
43 | # requires-python = ">=3.11"
44 | # dependencies = [
| ^^^^^^^^^^^^^^^^^^ ERA001
| ^^^^^^^^^^^^^^^^^^
45 | # "requests<3",
46 | # "rich",
|
= help: Remove commented-out code
Display-only fix
41 41 | # Script tag without an opening tag (Error)
42 42 |
@@ -303,16 +319,17 @@ ERA001.py:44:1: ERA001 Found commented-out code
46 45 | # "rich",
47 46 | # ]
ERA001.py:47:1: ERA001 Found commented-out code
error[ERA001]: 47:1: Found commented-out code
--> ERA001.py:46:12
|
45 | # "requests<3",
46 | # "rich",
47 | # ]
| ^^^ ERA001
| ^^^
48 | # ///
|
= help: Remove commented-out code
Display-only fix
44 44 | # dependencies = [
45 45 | # "requests<3",

View File

@@ -1,17 +1,18 @@
---
source: crates/ruff_linter/src/rules/fastapi/mod.rs
---
FAST002.py:24:5: FAST002 [*] FastAPI dependency without `Annotated`
error[FAST002]: 24:5: [*] FastAPI dependency without `Annotated`
--> FAST002.py:24:5
|
22 | @app.get("/items/")
23 | def get_items(
24 | current_user: User = Depends(get_current_user),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FAST002
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
25 | some_security_param: str = Security(get_oauth2_user),
26 | ):
|
= help: Replace with `Annotated`
Unsafe fix
12 12 | Security,
13 13 | )
@@ -30,17 +31,18 @@ FAST002.py:24:5: FAST002 [*] FastAPI dependency without `Annotated`
26 27 | ):
27 28 | pass
FAST002.py:25:5: FAST002 [*] FastAPI dependency without `Annotated`
error[FAST002]: 25:5: [*] FastAPI dependency without `Annotated`
--> FAST002.py:25:5
|
23 | def get_items(
24 | current_user: User = Depends(get_current_user),
25 | some_security_param: str = Security(get_oauth2_user),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FAST002
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
26 | ):
27 | pass
|
= help: Replace with `Annotated`
Unsafe fix
12 12 | Security,
13 13 | )
@@ -59,17 +61,18 @@ FAST002.py:25:5: FAST002 [*] FastAPI dependency without `Annotated`
27 28 | pass
28 29 |
FAST002.py:32:5: FAST002 [*] FastAPI dependency without `Annotated`
error[FAST002]: 32:5: [*] FastAPI dependency without `Annotated`
--> FAST002.py:32:5
|
30 | @app.post("/stuff/")
31 | def do_stuff(
32 | some_query_param: str | None = Query(default=None),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FAST002
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
33 | some_path_param: str = Path(),
34 | some_body_param: str = Body("foo"),
|
= help: Replace with `Annotated`
Unsafe fix
12 12 | Security,
13 13 | )
@@ -88,17 +91,18 @@ FAST002.py:32:5: FAST002 [*] FastAPI dependency without `Annotated`
34 35 | some_body_param: str = Body("foo"),
35 36 | some_cookie_param: str = Cookie(),
FAST002.py:33:5: FAST002 [*] FastAPI dependency without `Annotated`
error[FAST002]: 33:5: [*] FastAPI dependency without `Annotated`
--> FAST002.py:33:5
|
31 | def do_stuff(
32 | some_query_param: str | None = Query(default=None),
33 | some_path_param: str = Path(),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FAST002
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
34 | some_body_param: str = Body("foo"),
35 | some_cookie_param: str = Cookie(),
|
= help: Replace with `Annotated`
Unsafe fix
12 12 | Security,
13 13 | )
@@ -117,17 +121,18 @@ FAST002.py:33:5: FAST002 [*] FastAPI dependency without `Annotated`
35 36 | some_cookie_param: str = Cookie(),
36 37 | some_header_param: int = Header(default=5),
FAST002.py:34:5: FAST002 [*] FastAPI dependency without `Annotated`
error[FAST002]: 34:5: [*] FastAPI dependency without `Annotated`
--> FAST002.py:34:5
|
32 | some_query_param: str | None = Query(default=None),
33 | some_path_param: str = Path(),
34 | some_body_param: str = Body("foo"),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FAST002
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
35 | some_cookie_param: str = Cookie(),
36 | some_header_param: int = Header(default=5),
|
= help: Replace with `Annotated`
Unsafe fix
12 12 | Security,
13 13 | )
@@ -146,17 +151,18 @@ FAST002.py:34:5: FAST002 [*] FastAPI dependency without `Annotated`
36 37 | some_header_param: int = Header(default=5),
37 38 | some_file_param: UploadFile = File(),
FAST002.py:35:5: FAST002 [*] FastAPI dependency without `Annotated`
error[FAST002]: 35:5: [*] FastAPI dependency without `Annotated`
--> FAST002.py:35:5
|
33 | some_path_param: str = Path(),
34 | some_body_param: str = Body("foo"),
35 | some_cookie_param: str = Cookie(),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FAST002
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
36 | some_header_param: int = Header(default=5),
37 | some_file_param: UploadFile = File(),
|
= help: Replace with `Annotated`
Unsafe fix
12 12 | Security,
13 13 | )
@@ -175,17 +181,18 @@ FAST002.py:35:5: FAST002 [*] FastAPI dependency without `Annotated`
37 38 | some_file_param: UploadFile = File(),
38 39 | some_form_param: str = Form(),
FAST002.py:36:5: FAST002 [*] FastAPI dependency without `Annotated`
error[FAST002]: 36:5: [*] FastAPI dependency without `Annotated`
--> FAST002.py:36:5
|
34 | some_body_param: str = Body("foo"),
35 | some_cookie_param: str = Cookie(),
36 | some_header_param: int = Header(default=5),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FAST002
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
37 | some_file_param: UploadFile = File(),
38 | some_form_param: str = Form(),
|
= help: Replace with `Annotated`
Unsafe fix
12 12 | Security,
13 13 | )
@@ -204,17 +211,18 @@ FAST002.py:36:5: FAST002 [*] FastAPI dependency without `Annotated`
38 39 | some_form_param: str = Form(),
39 40 | ):
FAST002.py:37:5: FAST002 [*] FastAPI dependency without `Annotated`
error[FAST002]: 37:5: [*] FastAPI dependency without `Annotated`
--> FAST002.py:37:5
|
35 | some_cookie_param: str = Cookie(),
36 | some_header_param: int = Header(default=5),
37 | some_file_param: UploadFile = File(),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FAST002
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
38 | some_form_param: str = Form(),
39 | ):
|
= help: Replace with `Annotated`
Unsafe fix
12 12 | Security,
13 13 | )
@@ -233,17 +241,18 @@ FAST002.py:37:5: FAST002 [*] FastAPI dependency without `Annotated`
39 40 | ):
40 41 | # do stuff
FAST002.py:38:5: FAST002 [*] FastAPI dependency without `Annotated`
error[FAST002]: 38:5: [*] FastAPI dependency without `Annotated`
--> FAST002.py:38:5
|
36 | some_header_param: int = Header(default=5),
37 | some_file_param: UploadFile = File(),
38 | some_form_param: str = Form(),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FAST002
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
39 | ):
40 | # do stuff
|
= help: Replace with `Annotated`
Unsafe fix
12 12 | Security,
13 13 | )

View File

@@ -1,15 +1,16 @@
---
source: crates/ruff_linter/src/rules/fastapi/mod.rs
---
FAST001.py:17:22: FAST001 [*] FastAPI route with redundant `response_model` argument
error[FAST001]: 17:22: [*] FastAPI route with redundant `response_model` argument
--> FAST001.py:17:22
|
17 | @app.post("/items/", response_model=Item)
| ^^^^^^^^^^^^^^^^^^^ FAST001
| ^^^^^^^^^^^^^^^^^^^
18 | async def create_item(item: Item) -> Item:
19 | return item
|
= help: Remove argument
Unsafe fix
14 14 | # Errors
15 15 |
@@ -20,15 +21,16 @@ FAST001.py:17:22: FAST001 [*] FastAPI route with redundant `response_model` argu
19 19 | return item
20 20 |
FAST001.py:22:22: FAST001 [*] FastAPI route with redundant `response_model` argument
error[FAST001]: 22:22: [*] FastAPI route with redundant `response_model` argument
--> FAST001.py:22:22
|
22 | @app.post("/items/", response_model=list[Item])
| ^^^^^^^^^^^^^^^^^^^^^^^^^ FAST001
| ^^^^^^^^^^^^^^^^^^^^^^^^^
23 | async def create_item(item: Item) -> list[Item]:
24 | return item
|
= help: Remove argument
Unsafe fix
19 19 | return item
20 20 |
@@ -39,15 +41,16 @@ FAST001.py:22:22: FAST001 [*] FastAPI route with redundant `response_model` argu
24 24 | return item
25 25 |
FAST001.py:27:22: FAST001 [*] FastAPI route with redundant `response_model` argument
error[FAST001]: 27:22: [*] FastAPI route with redundant `response_model` argument
--> FAST001.py:27:22
|
27 | @app.post("/items/", response_model=List[Item])
| ^^^^^^^^^^^^^^^^^^^^^^^^^ FAST001
| ^^^^^^^^^^^^^^^^^^^^^^^^^
28 | async def create_item(item: Item) -> List[Item]:
29 | return item
|
= help: Remove argument
Unsafe fix
24 24 | return item
25 25 |
@@ -58,15 +61,16 @@ FAST001.py:27:22: FAST001 [*] FastAPI route with redundant `response_model` argu
29 29 | return item
30 30 |
FAST001.py:32:22: FAST001 [*] FastAPI route with redundant `response_model` argument
error[FAST001]: 32:22: [*] FastAPI route with redundant `response_model` argument
--> FAST001.py:32:22
|
32 | @app.post("/items/", response_model=Dict[str, Item])
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FAST001
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
33 | async def create_item(item: Item) -> Dict[str, Item]:
34 | return item
|
= help: Remove argument
Unsafe fix
29 29 | return item
30 30 |
@@ -77,15 +81,16 @@ FAST001.py:32:22: FAST001 [*] FastAPI route with redundant `response_model` argu
34 34 | return item
35 35 |
FAST001.py:37:22: FAST001 [*] FastAPI route with redundant `response_model` argument
error[FAST001]: 37:22: [*] FastAPI route with redundant `response_model` argument
--> FAST001.py:37:22
|
37 | @app.post("/items/", response_model=str)
| ^^^^^^^^^^^^^^^^^^ FAST001
| ^^^^^^^^^^^^^^^^^^
38 | async def create_item(item: Item) -> str:
39 | return item
|
= help: Remove argument
Unsafe fix
34 34 | return item
35 35 |
@@ -96,15 +101,16 @@ FAST001.py:37:22: FAST001 [*] FastAPI route with redundant `response_model` argu
39 39 | return item
40 40 |
FAST001.py:42:21: FAST001 [*] FastAPI route with redundant `response_model` argument
error[FAST001]: 42:21: [*] FastAPI route with redundant `response_model` argument
--> FAST001.py:42:21
|
42 | @app.get("/items/", response_model=Item)
| ^^^^^^^^^^^^^^^^^^^ FAST001
| ^^^^^^^^^^^^^^^^^^^
43 | async def create_item(item: Item) -> Item:
44 | return item
|
= help: Remove argument
Unsafe fix
39 39 | return item
40 40 |
@@ -115,15 +121,16 @@ FAST001.py:42:21: FAST001 [*] FastAPI route with redundant `response_model` argu
44 44 | return item
45 45 |
FAST001.py:47:21: FAST001 [*] FastAPI route with redundant `response_model` argument
error[FAST001]: 47:21: [*] FastAPI route with redundant `response_model` argument
--> FAST001.py:47:21
|
47 | @app.get("/items/", response_model=Item)
| ^^^^^^^^^^^^^^^^^^^ FAST001
| ^^^^^^^^^^^^^^^^^^^
48 | @app.post("/items/", response_model=Item)
49 | async def create_item(item: Item) -> Item:
|
= help: Remove argument
Unsafe fix
44 44 | return item
45 45 |
@@ -134,16 +141,17 @@ FAST001.py:47:21: FAST001 [*] FastAPI route with redundant `response_model` argu
49 49 | async def create_item(item: Item) -> Item:
50 50 | return item
FAST001.py:48:22: FAST001 [*] FastAPI route with redundant `response_model` argument
error[FAST001]: 48:22: [*] FastAPI route with redundant `response_model` argument
--> FAST001.py:48:22
|
47 | @app.get("/items/", response_model=Item)
48 | @app.post("/items/", response_model=Item)
| ^^^^^^^^^^^^^^^^^^^ FAST001
| ^^^^^^^^^^^^^^^^^^^
49 | async def create_item(item: Item) -> Item:
50 | return item
|
= help: Remove argument
Unsafe fix
45 45 |
46 46 |
@@ -154,15 +162,16 @@ FAST001.py:48:22: FAST001 [*] FastAPI route with redundant `response_model` argu
50 50 | return item
51 51 |
FAST001.py:53:24: FAST001 [*] FastAPI route with redundant `response_model` argument
error[FAST001]: 53:24: [*] FastAPI route with redundant `response_model` argument
--> FAST001.py:53:24
|
53 | @router.get("/items/", response_model=Item)
| ^^^^^^^^^^^^^^^^^^^ FAST001
| ^^^^^^^^^^^^^^^^^^^
54 | async def create_item(item: Item) -> Item:
55 | return item
|
= help: Remove argument
Unsafe fix
50 50 | return item
51 51 |

View File

@@ -1,16 +1,17 @@
---
source: crates/ruff_linter/src/rules/fastapi/mod.rs
---
FAST003.py:7:19: FAST003 [*] Parameter `thing_id` appears in route path, but not in `read_thing` signature
error[FAST003]: 7:19: [*] Parameter `thing_id` appears in route path, but not in `read_thing` signature
--> FAST003.py:7:19
|
6 | # Errors
7 | @app.get("/things/{thing_id}")
| ^^^^^^^^^^ FAST003
| ^^^^^^^^^^
8 | async def read_thing(query: str):
9 | return {"query": query}
|
= help: Add `thing_id` to function signature
Unsafe fix
5 5 |
6 6 | # Errors
@@ -21,15 +22,16 @@ FAST003.py:7:19: FAST003 [*] Parameter `thing_id` appears in route path, but not
10 10 |
11 11 |
FAST003.py:12:23: FAST003 [*] Parameter `isbn` appears in route path, but not in `read_thing` signature
error[FAST003]: 12:23: [*] Parameter `isbn` appears in route path, but not in `read_thing` signature
--> FAST003.py:12:23
|
12 | @app.get("/books/isbn-{isbn}")
| ^^^^^^ FAST003
| ^^^^^^
13 | async def read_thing():
14 | ...
|
= help: Add `isbn` to function signature
Unsafe fix
10 10 |
11 11 |
@@ -40,15 +42,16 @@ FAST003.py:12:23: FAST003 [*] Parameter `isbn` appears in route path, but not in
15 15 |
16 16 |
FAST003.py:17:19: FAST003 [*] Parameter `thing_id` appears in route path, but not in `read_thing` signature
error[FAST003]: 17:19: [*] Parameter `thing_id` appears in route path, but not in `read_thing` signature
--> FAST003.py:17:19
|
17 | @app.get("/things/{thing_id:path}")
| ^^^^^^^^^^^^^^^ FAST003
| ^^^^^^^^^^^^^^^
18 | async def read_thing(query: str):
19 | return {"query": query}
|
= help: Add `thing_id` to function signature
Unsafe fix
15 15 |
16 16 |
@@ -59,15 +62,16 @@ FAST003.py:17:19: FAST003 [*] Parameter `thing_id` appears in route path, but no
20 20 |
21 21 |
FAST003.py:22:19: FAST003 [*] Parameter `thing_id` appears in route path, but not in `read_thing` signature
error[FAST003]: 22:19: [*] Parameter `thing_id` appears in route path, but not in `read_thing` signature
--> FAST003.py:22:19
|
22 | @app.get("/things/{thing_id : path}")
| ^^^^^^^^^^^^^^^^^ FAST003
| ^^^^^^^^^^^^^^^^^
23 | async def read_thing(query: str):
24 | return {"query": query}
|
= help: Add `thing_id` to function signature
Unsafe fix
20 20 |
21 21 |
@@ -78,15 +82,16 @@ FAST003.py:22:19: FAST003 [*] Parameter `thing_id` appears in route path, but no
25 25 |
26 26 |
FAST003.py:27:27: FAST003 [*] Parameter `title` appears in route path, but not in `read_thing` signature
error[FAST003]: 27:27: [*] Parameter `title` appears in route path, but not in `read_thing` signature
--> FAST003.py:27:27
|
27 | @app.get("/books/{author}/{title}")
| ^^^^^^^ FAST003
| ^^^^^^^
28 | async def read_thing(author: str):
29 | return {"author": author}
|
= help: Add `title` to function signature
Unsafe fix
25 25 |
26 26 |
@@ -97,15 +102,16 @@ FAST003.py:27:27: FAST003 [*] Parameter `title` appears in route path, but not i
30 30 |
31 31 |
FAST003.py:32:18: FAST003 [*] Parameter `author_name` appears in route path, but not in `read_thing` signature
error[FAST003]: 32:18: [*] Parameter `author_name` appears in route path, but not in `read_thing` signature
--> FAST003.py:32:18
|
32 | @app.get("/books/{author_name}/{title}")
| ^^^^^^^^^^^^^ FAST003
| ^^^^^^^^^^^^^
33 | async def read_thing():
34 | ...
|
= help: Add `author_name` to function signature
Unsafe fix
30 30 |
31 31 |
@@ -116,15 +122,16 @@ FAST003.py:32:18: FAST003 [*] Parameter `author_name` appears in route path, but
35 35 |
36 36 |
FAST003.py:32:32: FAST003 [*] Parameter `title` appears in route path, but not in `read_thing` signature
error[FAST003]: 32:32: [*] Parameter `title` appears in route path, but not in `read_thing` signature
--> FAST003.py:32:32
|
32 | @app.get("/books/{author_name}/{title}")
| ^^^^^^^ FAST003
| ^^^^^^^
33 | async def read_thing():
34 | ...
|
= help: Add `title` to function signature
Unsafe fix
30 30 |
31 31 |
@@ -135,31 +142,34 @@ FAST003.py:32:32: FAST003 [*] Parameter `title` appears in route path, but not i
35 35 |
36 36 |
FAST003.py:37:18: FAST003 Parameter `author` appears in route path, but only as a positional-only argument in `read_thing` signature
error[FAST003]: 37:18: Parameter `author` appears in route path, but only as a positional-only argument in `read_thing` signature
--> FAST003.py:37:18
|
37 | @app.get("/books/{author}/{title}")
| ^^^^^^^^ FAST003
| ^^^^^^^^
38 | async def read_thing(author: str, title: str, /):
39 | return {"author": author, "title": title}
|
error[FAST003]: 37:27: Parameter `title` appears in route path, but only as a positional-only argument in `read_thing` signature
FAST003.py:37:27: FAST003 Parameter `title` appears in route path, but only as a positional-only argument in `read_thing` signature
--> FAST003.py:37:27
|
37 | @app.get("/books/{author}/{title}")
| ^^^^^^^ FAST003
| ^^^^^^^
38 | async def read_thing(author: str, title: str, /):
39 | return {"author": author, "title": title}
|
error[FAST003]: 42:27: [*] Parameter `title` appears in route path, but not in `read_thing` signature
FAST003.py:42:27: FAST003 [*] Parameter `title` appears in route path, but not in `read_thing` signature
--> FAST003.py:42:27
|
42 | @app.get("/books/{author}/{title}/{page}")
| ^^^^^^^ FAST003
| ^^^^^^^
43 | async def read_thing(
44 | author: str,
|
= help: Add `title` to function signature
Unsafe fix
42 42 | @app.get("/books/{author}/{title}/{page}")
43 43 | async def read_thing(
@@ -170,15 +180,16 @@ FAST003.py:42:27: FAST003 [*] Parameter `title` appears in route path, but not i
47 47 |
48 48 |
FAST003.py:42:35: FAST003 [*] Parameter `page` appears in route path, but not in `read_thing` signature
error[FAST003]: 42:35: [*] Parameter `page` appears in route path, but not in `read_thing` signature
--> FAST003.py:42:35
|
42 | @app.get("/books/{author}/{title}/{page}")
| ^^^^^^ FAST003
| ^^^^^^
43 | async def read_thing(
44 | author: str,
|
= help: Add `page` to function signature
Unsafe fix
42 42 | @app.get("/books/{author}/{title}/{page}")
43 43 | async def read_thing(
@@ -189,15 +200,16 @@ FAST003.py:42:35: FAST003 [*] Parameter `page` appears in route path, but not in
47 47 |
48 48 |
FAST003.py:49:18: FAST003 [*] Parameter `author` appears in route path, but not in `read_thing` signature
error[FAST003]: 49:18: [*] Parameter `author` appears in route path, but not in `read_thing` signature
--> FAST003.py:49:18
|
49 | @app.get("/books/{author}/{title}")
| ^^^^^^^^ FAST003
| ^^^^^^^^
50 | async def read_thing():
51 | ...
|
= help: Add `author` to function signature
Unsafe fix
47 47 |
48 48 |
@@ -208,15 +220,16 @@ FAST003.py:49:18: FAST003 [*] Parameter `author` appears in route path, but not
52 52 |
53 53 |
FAST003.py:49:27: FAST003 [*] Parameter `title` appears in route path, but not in `read_thing` signature
error[FAST003]: 49:27: [*] Parameter `title` appears in route path, but not in `read_thing` signature
--> FAST003.py:49:27
|
49 | @app.get("/books/{author}/{title}")
| ^^^^^^^ FAST003
| ^^^^^^^
50 | async def read_thing():
51 | ...
|
= help: Add `title` to function signature
Unsafe fix
47 47 |
48 48 |
@@ -227,15 +240,16 @@ FAST003.py:49:27: FAST003 [*] Parameter `title` appears in route path, but not i
52 52 |
53 53 |
FAST003.py:54:27: FAST003 [*] Parameter `title` appears in route path, but not in `read_thing` signature
error[FAST003]: 54:27: [*] Parameter `title` appears in route path, but not in `read_thing` signature
--> FAST003.py:54:27
|
54 | @app.get("/books/{author}/{title}")
| ^^^^^^^ FAST003
| ^^^^^^^
55 | async def read_thing(*, author: str):
56 | ...
|
= help: Add `title` to function signature
Unsafe fix
52 52 |
53 53 |
@@ -246,15 +260,16 @@ FAST003.py:54:27: FAST003 [*] Parameter `title` appears in route path, but not i
57 57 |
58 58 |
FAST003.py:59:27: FAST003 [*] Parameter `title` appears in route path, but not in `read_thing` signature
error[FAST003]: 59:27: [*] Parameter `title` appears in route path, but not in `read_thing` signature
--> FAST003.py:59:27
|
59 | @app.get("/books/{author}/{title}")
| ^^^^^^^ FAST003
| ^^^^^^^
60 | async def read_thing(hello, /, *, author: str):
61 | ...
|
= help: Add `title` to function signature
Unsafe fix
57 57 |
58 58 |
@@ -265,15 +280,16 @@ FAST003.py:59:27: FAST003 [*] Parameter `title` appears in route path, but not i
62 62 |
63 63 |
FAST003.py:64:19: FAST003 [*] Parameter `thing_id` appears in route path, but not in `read_thing` signature
error[FAST003]: 64:19: [*] Parameter `thing_id` appears in route path, but not in `read_thing` signature
--> FAST003.py:64:19
|
64 | @app.get("/things/{thing_id}")
| ^^^^^^^^^^ FAST003
| ^^^^^^^^^^
65 | async def read_thing(
66 | query: str,
|
= help: Add `thing_id` to function signature
Unsafe fix
63 63 |
64 64 | @app.get("/things/{thing_id}")
@@ -284,15 +300,16 @@ FAST003.py:64:19: FAST003 [*] Parameter `thing_id` appears in route path, but no
68 68 | return {"query": query}
69 69 |
FAST003.py:71:19: FAST003 [*] Parameter `thing_id` appears in route path, but not in `read_thing` signature
error[FAST003]: 71:19: [*] Parameter `thing_id` appears in route path, but not in `read_thing` signature
--> FAST003.py:71:19
|
71 | @app.get("/things/{thing_id}")
| ^^^^^^^^^^ FAST003
| ^^^^^^^^^^
72 | async def read_thing(
73 | query: str = "default",
|
= help: Add `thing_id` to function signature
Unsafe fix
70 70 |
71 71 | @app.get("/things/{thing_id}")
@@ -303,15 +320,16 @@ FAST003.py:71:19: FAST003 [*] Parameter `thing_id` appears in route path, but no
75 75 | return {"query": query}
76 76 |
FAST003.py:78:19: FAST003 [*] Parameter `thing_id` appears in route path, but not in `read_thing` signature
error[FAST003]: 78:19: [*] Parameter `thing_id` appears in route path, but not in `read_thing` signature
--> FAST003.py:78:19
|
78 | @app.get("/things/{thing_id}")
| ^^^^^^^^^^ FAST003
| ^^^^^^^^^^
79 | async def read_thing(
80 | *, query: str = "default",
|
= help: Add `thing_id` to function signature
Unsafe fix
77 77 |
78 78 | @app.get("/things/{thing_id}")

View File

@@ -1,32 +1,34 @@
---
source: crates/ruff_linter/src/rules/flake8_2020/mod.rs
---
YTT101.py:6:7: YTT101 `sys.version[:3]` referenced (python3.10), use `sys.version_info`
error[YTT101]: 6:7: `sys.version[:3]` referenced (python3.10), use `sys.version_info`
--> YTT101.py:6:7
|
4 | print(sys.version)
5 |
6 | print(sys.version[:3])
| ^^^^^^^^^^^ YTT101
| ^^^^^^^^^^^
7 | print(version[:3])
8 | print(v[:3])
|
error[YTT101]: 7:7: `sys.version[:3]` referenced (python3.10), use `sys.version_info`
YTT101.py:7:7: YTT101 `sys.version[:3]` referenced (python3.10), use `sys.version_info`
--> YTT101.py:7:7
|
6 | print(sys.version[:3])
7 | print(version[:3])
| ^^^^^^^ YTT101
| ^^^^^^^
8 | print(v[:3])
|
error[YTT101]: 8:7: `sys.version[:3]` referenced (python3.10), use `sys.version_info`
YTT101.py:8:7: YTT101 `sys.version[:3]` referenced (python3.10), use `sys.version_info`
--> YTT101.py:8:7
|
6 | print(sys.version[:3])
7 | print(version[:3])
8 | print(v[:3])
| ^ YTT101
| ^
9 |
10 | # the tool is timid and only flags certain numeric slices
|

View File

@@ -1,20 +1,21 @@
---
source: crates/ruff_linter/src/rules/flake8_2020/mod.rs
---
YTT102.py:4:12: YTT102 `sys.version[2]` referenced (python3.10), use `sys.version_info`
error[YTT102]: 4:12: `sys.version[2]` referenced (python3.10), use `sys.version_info`
--> YTT102.py:4:12
|
2 | from sys import version
3 |
4 | py_minor = sys.version[2]
| ^^^^^^^^^^^ YTT102
| ^^^^^^^^^^^
5 | py_minor = version[2]
|
error[YTT102]: 5:12: `sys.version[2]` referenced (python3.10), use `sys.version_info`
YTT102.py:5:12: YTT102 `sys.version[2]` referenced (python3.10), use `sys.version_info`
--> YTT102.py:5:12
|
4 | py_minor = sys.version[2]
5 | py_minor = version[2]
| ^^^^^^^ YTT102
| ^^^^^^^
|

View File

@@ -1,50 +1,54 @@
---
source: crates/ruff_linter/src/rules/flake8_2020/mod.rs
---
YTT103.py:4:1: YTT103 `sys.version` compared to string (python3.10), use `sys.version_info`
error[YTT103]: 4:1: `sys.version` compared to string (python3.10), use `sys.version_info`
--> YTT103.py:3:1
|
2 | from sys import version
3 |
4 | version < "3.5"
| ^^^^^^^ YTT103
| ^^^^^^^
5 | sys.version < "3.5"
6 | sys.version <= "3.5"
|
error[YTT103]: 5:1: `sys.version` compared to string (python3.10), use `sys.version_info`
YTT103.py:5:1: YTT103 `sys.version` compared to string (python3.10), use `sys.version_info`
--> YTT103.py:4:16
|
4 | version < "3.5"
5 | sys.version < "3.5"
| ^^^^^^^^^^^ YTT103
| ^^^^^^^^^^^
6 | sys.version <= "3.5"
7 | sys.version > "3.5"
|
error[YTT103]: 6:1: `sys.version` compared to string (python3.10), use `sys.version_info`
YTT103.py:6:1: YTT103 `sys.version` compared to string (python3.10), use `sys.version_info`
--> YTT103.py:5:20
|
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"
|
error[YTT103]: 7:1: `sys.version` compared to string (python3.10), use `sys.version_info`
YTT103.py:7:1: YTT103 `sys.version` compared to string (python3.10), use `sys.version_info`
--> YTT103.py:6:21
|
5 | sys.version < "3.5"
6 | sys.version <= "3.5"
7 | sys.version > "3.5"
| ^^^^^^^^^^^ YTT103
| ^^^^^^^^^^^
8 | sys.version >= "3.5"
|
error[YTT103]: 8:1: `sys.version` compared to string (python3.10), use `sys.version_info`
YTT103.py:8:1: YTT103 `sys.version` compared to string (python3.10), use `sys.version_info`
--> YTT103.py:7:20
|
6 | sys.version <= "3.5"
7 | sys.version > "3.5"
8 | sys.version >= "3.5"
| ^^^^^^^^^^^ YTT103
| ^^^^^^^^^^^
|

View File

@@ -1,40 +1,43 @@
---
source: crates/ruff_linter/src/rules/flake8_2020/mod.rs
---
YTT201.py:7:7: YTT201 `sys.version_info[0] == 3` referenced (python4), use `>=`
error[YTT201]: 7:7: `sys.version_info[0] == 3` referenced (python4), use `>=`
--> YTT201.py:7:7
|
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
|
error[YTT201]: 8:7: `sys.version_info[0] == 3` referenced (python4), use `>=`
YTT201.py:8:7: YTT201 `sys.version_info[0] == 3` referenced (python4), use `>=`
--> YTT201.py:8:7
|
7 | PY3 = sys.version_info[0] == 3
8 | PY3 = version_info[0] == 3
| ^^^^^^^^^^^^^^^ YTT201
| ^^^^^^^^^^^^^^^
9 | PY2 = sys.version_info[0] != 3
10 | PY2 = version_info[0] != 3
|
error[YTT201]: 9:7: `sys.version_info[0] == 3` referenced (python4), use `>=`
YTT201.py:9:7: YTT201 `sys.version_info[0] == 3` referenced (python4), use `>=`
--> YTT201.py:9:7
|
7 | PY3 = sys.version_info[0] == 3
8 | PY3 = version_info[0] == 3
9 | PY2 = sys.version_info[0] != 3
| ^^^^^^^^^^^^^^^^^^^ YTT201
| ^^^^^^^^^^^^^^^^^^^
10 | PY2 = version_info[0] != 3
|
error[YTT201]: 10:7: `sys.version_info[0] == 3` referenced (python4), use `>=`
YTT201.py:10:7: YTT201 `sys.version_info[0] == 3` referenced (python4), use `>=`
--> YTT201.py:10:7
|
8 | PY3 = version_info[0] == 3
9 | PY2 = sys.version_info[0] != 3
10 | PY2 = version_info[0] != 3
| ^^^^^^^^^^^^^^^ YTT201
| ^^^^^^^^^^^^^^^
|

View File

@@ -1,23 +1,24 @@
---
source: crates/ruff_linter/src/rules/flake8_2020/mod.rs
---
YTT202.py:4:4: YTT202 `six.PY3` referenced (python4), use `not six.PY2`
error[YTT202]: 4:4: `six.PY3` referenced (python4), use `not six.PY2`
--> YTT202.py:4:4
|
2 | from six import PY3
3 |
4 | if six.PY3:
| ^^^^^^^ YTT202
| ^^^^^^^
5 | print("3")
6 | if PY3:
|
error[YTT202]: 6:4: `six.PY3` referenced (python4), use `not six.PY2`
YTT202.py:6:4: YTT202 `six.PY3` referenced (python4), use `not six.PY2`
--> YTT202.py:6:4
|
4 | if six.PY3:
5 | print("3")
6 | if PY3:
| ^^^ YTT202
| ^^^
7 | print("3")
|

View File

@@ -1,20 +1,21 @@
---
source: crates/ruff_linter/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
error[YTT203]: 4:1: `sys.version_info[1]` compared to integer (python4), compare `sys.version_info` to tuple
--> YTT203.py:3:1
|
2 | from sys import version_info
3 |
4 | sys.version_info[1] >= 5
| ^^^^^^^^^^^^^^^^^^^ YTT203
| ^^^^^^^^^^^^^^^^^^^
5 | version_info[1] < 6
|
error[YTT203]: 5:1: `sys.version_info[1]` compared to integer (python4), compare `sys.version_info` to tuple
YTT203.py:5:1: YTT203 `sys.version_info[1]` compared to integer (python4), compare `sys.version_info` to tuple
--> YTT203.py:4:25
|
4 | sys.version_info[1] >= 5
5 | version_info[1] < 6
| ^^^^^^^^^^^^^^^ YTT203
| ^^^^^^^^^^^^^^^
|

View File

@@ -1,20 +1,21 @@
---
source: crates/ruff_linter/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
error[YTT204]: 4:1: `sys.version_info.minor` compared to integer (python4), compare `sys.version_info` to tuple
--> YTT204.py:3:1
|
2 | from sys import version_info
3 |
4 | sys.version_info.minor <= 7
| ^^^^^^^^^^^^^^^^^^^^^^ YTT204
| ^^^^^^^^^^^^^^^^^^^^^^
5 | version_info.minor > 8
|
error[YTT204]: 5:1: `sys.version_info.minor` compared to integer (python4), compare `sys.version_info` to tuple
YTT204.py:5:1: YTT204 `sys.version_info.minor` compared to integer (python4), compare `sys.version_info` to tuple
--> YTT204.py:4:28
|
4 | sys.version_info.minor <= 7
5 | version_info.minor > 8
| ^^^^^^^^^^^^^^^^^^ YTT204
| ^^^^^^^^^^^^^^^^^^
|

View File

@@ -1,20 +1,21 @@
---
source: crates/ruff_linter/src/rules/flake8_2020/mod.rs
---
YTT301.py:4:12: YTT301 `sys.version[0]` referenced (python10), use `sys.version_info`
error[YTT301]: 4:12: `sys.version[0]` referenced (python10), use `sys.version_info`
--> YTT301.py:4:12
|
2 | from sys import version
3 |
4 | py_major = sys.version[0]
| ^^^^^^^^^^^ YTT301
| ^^^^^^^^^^^
5 | py_major = version[0]
|
error[YTT301]: 5:12: `sys.version[0]` referenced (python10), use `sys.version_info`
YTT301.py:5:12: YTT301 `sys.version[0]` referenced (python10), use `sys.version_info`
--> YTT301.py:5:12
|
4 | py_major = sys.version[0]
5 | py_major = version[0]
| ^^^^^^^ YTT301
| ^^^^^^^
|

View File

@@ -1,50 +1,54 @@
---
source: crates/ruff_linter/src/rules/flake8_2020/mod.rs
---
YTT302.py:4:1: YTT302 `sys.version` compared to string (python10), use `sys.version_info`
error[YTT302]: 4:1: `sys.version` compared to string (python10), use `sys.version_info`
--> YTT302.py:3:1
|
2 | from sys import version
3 |
4 | version < "3"
| ^^^^^^^ YTT302
| ^^^^^^^
5 | sys.version < "3"
6 | sys.version <= "3"
|
error[YTT302]: 5:1: `sys.version` compared to string (python10), use `sys.version_info`
YTT302.py:5:1: YTT302 `sys.version` compared to string (python10), use `sys.version_info`
--> YTT302.py:4:14
|
4 | version < "3"
5 | sys.version < "3"
| ^^^^^^^^^^^ YTT302
| ^^^^^^^^^^^
6 | sys.version <= "3"
7 | sys.version > "3"
|
error[YTT302]: 6:1: `sys.version` compared to string (python10), use `sys.version_info`
YTT302.py:6:1: YTT302 `sys.version` compared to string (python10), use `sys.version_info`
--> YTT302.py:5:18
|
4 | version < "3"
5 | sys.version < "3"
6 | sys.version <= "3"
| ^^^^^^^^^^^ YTT302
| ^^^^^^^^^^^
7 | sys.version > "3"
8 | sys.version >= "3"
|
error[YTT302]: 7:1: `sys.version` compared to string (python10), use `sys.version_info`
YTT302.py:7:1: YTT302 `sys.version` compared to string (python10), use `sys.version_info`
--> YTT302.py:6:19
|
5 | sys.version < "3"
6 | sys.version <= "3"
7 | sys.version > "3"
| ^^^^^^^^^^^ YTT302
| ^^^^^^^^^^^
8 | sys.version >= "3"
|
error[YTT302]: 8:1: `sys.version` compared to string (python10), use `sys.version_info`
YTT302.py:8:1: YTT302 `sys.version` compared to string (python10), use `sys.version_info`
--> YTT302.py:7:18
|
6 | sys.version <= "3"
7 | sys.version > "3"
8 | sys.version >= "3"
| ^^^^^^^^^^^ YTT302
| ^^^^^^^^^^^
|

View File

@@ -1,20 +1,21 @@
---
source: crates/ruff_linter/src/rules/flake8_2020/mod.rs
---
YTT303.py:4:7: YTT303 `sys.version[:1]` referenced (python10), use `sys.version_info`
error[YTT303]: 4:7: `sys.version[:1]` referenced (python10), use `sys.version_info`
--> YTT303.py:4:7
|
2 | from sys import version
3 |
4 | print(sys.version[:1])
| ^^^^^^^^^^^ YTT303
| ^^^^^^^^^^^
5 | print(version[:1])
|
error[YTT303]: 5:7: `sys.version[:1]` referenced (python10), use `sys.version_info`
YTT303.py:5:7: YTT303 `sys.version[:1]` referenced (python10), use `sys.version_info`
--> YTT303.py:5:7
|
4 | print(sys.version[:1])
5 | print(version[:1])
| ^^^^^^^ YTT303
| ^^^^^^^
|

View File

@@ -1,13 +1,13 @@
---
source: crates/ruff_linter/src/rules/flake8_annotations/mod.rs
---
allow_overload.py:29:9: ANN201 Missing return type annotation for public function `bar`
error[ANN201]: 29:9: Missing return type annotation for public function `bar`
--> allow_overload.py:29:9
|
28 | class X:
29 | def bar(i):
| ^^^ ANN201
| ^^^
30 | return i
|
= help: Add return type annotation

View File

@@ -1,36 +1,39 @@
---
source: crates/ruff_linter/src/rules/flake8_annotations/mod.rs
---
allow_star_arg_any.py:10:12: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `a`
error[ANN401]: 10:12: Dynamically typed expressions (typing.Any) are disallowed in `a`
--> allow_star_arg_any.py:10:12
|
9 | # ANN401
10 | def foo(a: Any, *args: str, **kwargs: str) -> int:
| ^^^ ANN401
| ^^^
11 | pass
|
error[ANN401]: 15:47: Dynamically typed expressions (typing.Any) are disallowed in `foo`
allow_star_arg_any.py:15:47: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `foo`
--> allow_star_arg_any.py:15:47
|
14 | # ANN401
15 | def foo(a: int, *args: str, **kwargs: str) -> Any:
| ^^^ ANN401
| ^^^
16 | pass
|
error[ANN401]: 40:29: Dynamically typed expressions (typing.Any) are disallowed in `a`
allow_star_arg_any.py:40:29: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `a`
--> allow_star_arg_any.py:40:29
|
39 | # ANN401
40 | def foo_method(self, a: Any, *params: str, **options: str) -> int:
| ^^^ ANN401
| ^^^
41 | pass
|
error[ANN401]: 44:67: Dynamically typed expressions (typing.Any) are disallowed in `foo_method`
allow_star_arg_any.py:44:67: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `foo_method`
--> allow_star_arg_any.py:44:67
|
43 | # ANN401
44 | def foo_method(self, a: int, *params: str, **options: str) -> Any:
| ^^^ ANN401
| ^^^
45 | pass
|

View File

@@ -1,14 +1,15 @@
---
source: crates/ruff_linter/src/rules/flake8_annotations/mod.rs
---
auto_return_type.py:1:5: ANN201 [*] Missing return type annotation for public function `func`
error[ANN201]: 1:5: [*] Missing return type annotation for public function `func`
--> auto_return_type.py:1:5
|
1 | def func():
| ^^^^ ANN201
| ^^^^
2 | return 1
|
= help: Add return type annotation: `int`
Unsafe fix
1 |-def func():
1 |+def func() -> int:
@@ -16,14 +17,15 @@ auto_return_type.py:1:5: ANN201 [*] Missing return type annotation for public fu
3 3 |
4 4 |
auto_return_type.py:5:5: ANN201 [*] Missing return type annotation for public function `func`
error[ANN201]: 5:5: [*] Missing return type annotation for public function `func`
--> auto_return_type.py:5:5
|
5 | def func():
| ^^^^ ANN201
| ^^^^
6 | return 1.5
|
= help: Add return type annotation: `float`
Unsafe fix
2 2 | return 1
3 3 |
@@ -34,15 +36,16 @@ auto_return_type.py:5:5: ANN201 [*] Missing return type annotation for public fu
7 7 |
8 8 |
auto_return_type.py:9:5: ANN201 [*] Missing return type annotation for public function `func`
error[ANN201]: 9:5: [*] Missing return type annotation for public function `func`
--> auto_return_type.py:9:5
|
9 | def func(x: int):
| ^^^^ ANN201
| ^^^^
10 | if x > 0:
11 | return 1
|
= help: Add return type annotation: `float`
Unsafe fix
6 6 | return 1.5
7 7 |
@@ -53,14 +56,15 @@ auto_return_type.py:9:5: ANN201 [*] Missing return type annotation for public fu
11 11 | return 1
12 12 | else:
auto_return_type.py:16:5: ANN201 [*] Missing return type annotation for public function `func`
error[ANN201]: 16:5: [*] Missing return type annotation for public function `func`
--> auto_return_type.py:16:5
|
16 | def func():
| ^^^^ ANN201
| ^^^^
17 | return True
|
= help: Add return type annotation: `bool`
Unsafe fix
13 13 | return 1.5
14 14 |
@@ -71,15 +75,16 @@ auto_return_type.py:16:5: ANN201 [*] Missing return type annotation for public f
18 18 |
19 19 |
auto_return_type.py:20:5: ANN201 [*] Missing return type annotation for public function `func`
error[ANN201]: 20:5: [*] Missing return type annotation for public function `func`
--> auto_return_type.py:20:5
|
20 | def func(x: int):
| ^^^^ ANN201
| ^^^^
21 | if x > 0:
22 | return None
|
= help: Add return type annotation: `None`
Unsafe fix
17 17 | return True
18 18 |
@@ -90,14 +95,15 @@ auto_return_type.py:20:5: ANN201 [*] Missing return type annotation for public f
22 22 | return None
23 23 | else:
auto_return_type.py:27:5: ANN201 [*] Missing return type annotation for public function `func`
error[ANN201]: 27:5: [*] Missing return type annotation for public function `func`
--> auto_return_type.py:27:5
|
27 | def func(x: int):
| ^^^^ ANN201
| ^^^^
28 | return 1 or 2.5 if x > 0 else 1.5 or "str"
|
= help: Add return type annotation: `str | float`
Unsafe fix
24 24 | return
25 25 |
@@ -108,14 +114,15 @@ auto_return_type.py:27:5: ANN201 [*] Missing return type annotation for public f
29 29 |
30 30 |
auto_return_type.py:31:5: ANN201 [*] Missing return type annotation for public function `func`
error[ANN201]: 31:5: [*] Missing return type annotation for public function `func`
--> auto_return_type.py:31:5
|
31 | def func(x: int):
| ^^^^ ANN201
| ^^^^
32 | return 1 + 2.5 if x > 0 else 1.5 or "str"
|
= help: Add return type annotation: `str | float`
Unsafe fix
28 28 | return 1 or 2.5 if x > 0 else 1.5 or "str"
29 29 |
@@ -126,32 +133,35 @@ auto_return_type.py:31:5: ANN201 [*] Missing return type annotation for public f
33 33 |
34 34 |
auto_return_type.py:35:5: ANN201 Missing return type annotation for public function `func`
error[ANN201]: 35:5: Missing return type annotation for public function `func`
--> auto_return_type.py:35:5
|
35 | def func(x: int):
| ^^^^ ANN201
| ^^^^
36 | if not x:
37 | return None
|
= help: Add return type annotation
error[ANN201]: 41:5: Missing return type annotation for public function `func`
auto_return_type.py:41:5: ANN201 Missing return type annotation for public function `func`
--> auto_return_type.py:41:5
|
41 | def func(x: int):
| ^^^^ ANN201
| ^^^^
42 | return {"foo": 1}
|
= help: Add return type annotation
error[ANN201]: 45:5: [*] Missing return type annotation for public function `func`
auto_return_type.py:45:5: ANN201 [*] Missing return type annotation for public function `func`
--> auto_return_type.py:45:5
|
45 | def func(x: int):
| ^^^^ ANN201
| ^^^^
46 | if not x:
47 | return 1
|
= help: Add return type annotation: `int`
Unsafe fix
42 42 | return {"foo": 1}
43 43 |
@@ -162,15 +172,16 @@ auto_return_type.py:45:5: ANN201 [*] Missing return type annotation for public f
47 47 | return 1
48 48 | else:
auto_return_type.py:52:5: ANN201 [*] Missing return type annotation for public function `func`
error[ANN201]: 52:5: [*] Missing return type annotation for public function `func`
--> auto_return_type.py:52:5
|
52 | def func(x: int):
| ^^^^ ANN201
| ^^^^
53 | if not x:
54 | return 1
|
= help: Add return type annotation: `int | None`
Unsafe fix
49 49 | return True
50 50 |
@@ -181,15 +192,16 @@ auto_return_type.py:52:5: ANN201 [*] Missing return type annotation for public f
54 54 | return 1
55 55 | else:
auto_return_type.py:59:5: ANN201 [*] Missing return type annotation for public function `func`
error[ANN201]: 59:5: [*] Missing return type annotation for public function `func`
--> auto_return_type.py:59:5
|
59 | def func(x: int):
| ^^^^ ANN201
| ^^^^
60 | if not x:
61 | return 1
|
= help: Add return type annotation: `str | int | None`
Unsafe fix
56 56 | return None
57 57 |
@@ -200,15 +212,16 @@ auto_return_type.py:59:5: ANN201 [*] Missing return type annotation for public f
61 61 | return 1
62 62 | elif x > 5:
auto_return_type.py:68:5: ANN201 [*] Missing return type annotation for public function `func`
error[ANN201]: 68:5: [*] Missing return type annotation for public function `func`
--> auto_return_type.py:68:5
|
68 | def func(x: int):
| ^^^^ ANN201
| ^^^^
69 | if x:
70 | return 1
|
= help: Add return type annotation: `int | None`
Unsafe fix
65 65 | return None
66 66 |
@@ -219,14 +232,15 @@ auto_return_type.py:68:5: ANN201 [*] Missing return type annotation for public f
70 70 | return 1
71 71 |
auto_return_type.py:73:5: ANN201 [*] Missing return type annotation for public function `func`
error[ANN201]: 73:5: [*] Missing return type annotation for public function `func`
--> auto_return_type.py:73:5
|
73 | def func():
| ^^^^ ANN201
| ^^^^
74 | x = 1
|
= help: Add return type annotation: `None`
Unsafe fix
70 70 | return 1
71 71 |
@@ -237,15 +251,16 @@ auto_return_type.py:73:5: ANN201 [*] Missing return type annotation for public f
75 75 |
76 76 |
auto_return_type.py:77:5: ANN201 [*] Missing return type annotation for public function `func`
error[ANN201]: 77:5: [*] Missing return type annotation for public function `func`
--> auto_return_type.py:77:5
|
77 | def func(x: int):
| ^^^^ ANN201
| ^^^^
78 | if x > 0:
79 | return 1
|
= help: Add return type annotation: `int | None`
Unsafe fix
74 74 | x = 1
75 75 |
@@ -256,15 +271,16 @@ auto_return_type.py:77:5: ANN201 [*] Missing return type annotation for public f
79 79 | return 1
80 80 |
auto_return_type.py:82:5: ANN201 [*] Missing return type annotation for public function `func`
error[ANN201]: 82:5: [*] Missing return type annotation for public function `func`
--> auto_return_type.py:82:5
|
82 | def func(x: int):
| ^^^^ ANN201
| ^^^^
83 | match x:
84 | case [1, 2, 3]:
|
= help: Add return type annotation: `str | int | None`
Unsafe fix
79 79 | return 1
80 80 |
@@ -275,15 +291,16 @@ auto_return_type.py:82:5: ANN201 [*] Missing return type annotation for public f
84 84 | case [1, 2, 3]:
85 85 | return 1
auto_return_type.py:90:5: ANN201 [*] Missing return type annotation for public function `func`
error[ANN201]: 90:5: [*] Missing return type annotation for public function `func`
--> auto_return_type.py:90:5
|
90 | def func(x: int):
| ^^^^ ANN201
| ^^^^
91 | for i in range(5):
92 | if i > 0:
|
= help: Add return type annotation: `int | None`
Unsafe fix
87 87 | return "foo"
88 88 |
@@ -294,15 +311,16 @@ auto_return_type.py:90:5: ANN201 [*] Missing return type annotation for public f
92 92 | if i > 0:
93 93 | return 1
auto_return_type.py:96:5: ANN201 [*] Missing return type annotation for public function `func`
error[ANN201]: 96:5: [*] Missing return type annotation for public function `func`
--> auto_return_type.py:96:5
|
96 | def func(x: int):
| ^^^^ ANN201
| ^^^^
97 | for i in range(5):
98 | if i > 0:
|
= help: Add return type annotation: `int`
Unsafe fix
93 93 | return 1
94 94 |
@@ -313,15 +331,16 @@ auto_return_type.py:96:5: ANN201 [*] Missing return type annotation for public f
98 98 | if i > 0:
99 99 | return 1
auto_return_type.py:104:5: ANN201 [*] Missing return type annotation for public function `func`
error[ANN201]: 104:5: [*] Missing return type annotation for public function `func`
--> auto_return_type.py:104:5
|
104 | def func(x: int):
| ^^^^ ANN201
| ^^^^
105 | for i in range(5):
106 | if i > 0:
|
= help: Add return type annotation: `int | None`
Unsafe fix
101 101 | return 4
102 102 |
@@ -332,15 +351,16 @@ auto_return_type.py:104:5: ANN201 [*] Missing return type annotation for public
106 106 | if i > 0:
107 107 | break
auto_return_type.py:112:5: ANN201 [*] Missing return type annotation for public function `func`
error[ANN201]: 112:5: [*] Missing return type annotation for public function `func`
--> auto_return_type.py:112:5
|
112 | def func(x: int):
| ^^^^ ANN201
| ^^^^
113 | try:
114 | pass
|
= help: Add return type annotation: `int | None`
Unsafe fix
109 109 | return 4
110 110 |
@@ -351,15 +371,16 @@ auto_return_type.py:112:5: ANN201 [*] Missing return type annotation for public
114 114 | pass
115 115 | except:
auto_return_type.py:119:5: ANN201 [*] Missing return type annotation for public function `func`
error[ANN201]: 119:5: [*] Missing return type annotation for public function `func`
--> auto_return_type.py:119:5
|
119 | def func(x: int):
| ^^^^ ANN201
| ^^^^
120 | try:
121 | pass
|
= help: Add return type annotation: `int`
Unsafe fix
116 116 | return 1
117 117 |
@@ -370,15 +391,16 @@ auto_return_type.py:119:5: ANN201 [*] Missing return type annotation for public
121 121 | pass
122 122 | except:
auto_return_type.py:128:5: ANN201 [*] Missing return type annotation for public function `func`
error[ANN201]: 128:5: [*] Missing return type annotation for public function `func`
--> auto_return_type.py:128:5
|
128 | def func(x: int):
| ^^^^ ANN201
| ^^^^
129 | try:
130 | pass
|
= help: Add return type annotation: `int`
Unsafe fix
125 125 | return 2
126 126 |
@@ -389,15 +411,16 @@ auto_return_type.py:128:5: ANN201 [*] Missing return type annotation for public
130 130 | pass
131 131 | except:
auto_return_type.py:137:5: ANN201 [*] Missing return type annotation for public function `func`
error[ANN201]: 137:5: [*] Missing return type annotation for public function `func`
--> auto_return_type.py:137:5
|
137 | def func(x: int):
| ^^^^ ANN201
| ^^^^
138 | try:
139 | return 1
|
= help: Add return type annotation: `int | None`
Unsafe fix
134 134 | return 2
135 135 |
@@ -408,15 +431,16 @@ auto_return_type.py:137:5: ANN201 [*] Missing return type annotation for public
139 139 | return 1
140 140 | except:
auto_return_type.py:146:5: ANN201 [*] Missing return type annotation for public function `func`
error[ANN201]: 146:5: [*] Missing return type annotation for public function `func`
--> auto_return_type.py:146:5
|
146 | def func(x: int):
| ^^^^ ANN201
| ^^^^
147 | while x > 0:
148 | break
|
= help: Add return type annotation: `int | None`
Unsafe fix
143 143 | pass
144 144 |
@@ -427,64 +451,70 @@ auto_return_type.py:146:5: ANN201 [*] Missing return type annotation for public
148 148 | break
149 149 | return 1
auto_return_type.py:158:9: ANN201 Missing return type annotation for public function `method`
error[ANN201]: 158:9: Missing return type annotation for public function `method`
--> auto_return_type.py:158:9
|
156 | class Foo(abc.ABC):
157 | @abstractmethod
158 | def method(self):
| ^^^^^^ ANN201
| ^^^^^^
159 | pass
|
= help: Add return type annotation
error[ANN201]: 162:9: Missing return type annotation for public function `method`
auto_return_type.py:162:9: ANN201 Missing return type annotation for public function `method`
--> auto_return_type.py:162:9
|
161 | @abc.abstractmethod
162 | def method(self):
| ^^^^^^ ANN201
| ^^^^^^
163 | """Docstring."""
|
= help: Add return type annotation
error[ANN201]: 166:9: Missing return type annotation for public function `method`
auto_return_type.py:166:9: ANN201 Missing return type annotation for public function `method`
--> auto_return_type.py:166:9
|
165 | @abc.abstractmethod
166 | def method(self):
| ^^^^^^ ANN201
| ^^^^^^
167 | ...
|
= help: Add return type annotation
error[ANN205]: 171:9: Missing return type annotation for staticmethod `method`
auto_return_type.py:171:9: ANN205 Missing return type annotation for staticmethod `method`
--> auto_return_type.py:171:9
|
169 | @staticmethod
170 | @abstractmethod
171 | def method():
| ^^^^^^ ANN205
| ^^^^^^
172 | pass
|
= help: Add return type annotation
error[ANN206]: 176:9: Missing return type annotation for classmethod `method`
auto_return_type.py:176:9: ANN206 Missing return type annotation for classmethod `method`
--> auto_return_type.py:176:9
|
174 | @classmethod
175 | @abstractmethod
176 | def method(cls):
| ^^^^^^ ANN206
| ^^^^^^
177 | pass
|
= help: Add return type annotation
error[ANN201]: 180:9: [*] Missing return type annotation for public function `method`
auto_return_type.py:180:9: ANN201 [*] Missing return type annotation for public function `method`
--> auto_return_type.py:180:9
|
179 | @abstractmethod
180 | def method(self):
| ^^^^^^ ANN201
| ^^^^^^
181 | if self.x > 0:
182 | return 1
|
= help: Add return type annotation: `float`
Unsafe fix
177 177 | pass
178 178 |
@@ -495,15 +525,16 @@ auto_return_type.py:180:9: ANN201 [*] Missing return type annotation for public
182 182 | return 1
183 183 | else:
auto_return_type.py:187:5: ANN201 [*] Missing return type annotation for public function `func`
error[ANN201]: 187:5: [*] Missing return type annotation for public function `func`
--> auto_return_type.py:187:5
|
187 | def func(x: int):
| ^^^^ ANN201
| ^^^^
188 | try:
189 | pass
|
= help: Add return type annotation: `int | None`
Unsafe fix
184 184 | return 1.5
185 185 |
@@ -514,15 +545,16 @@ auto_return_type.py:187:5: ANN201 [*] Missing return type annotation for public
189 189 | pass
190 190 | except:
auto_return_type.py:194:5: ANN201 [*] Missing return type annotation for public function `func`
error[ANN201]: 194:5: [*] Missing return type annotation for public function `func`
--> auto_return_type.py:194:5
|
194 | def func(x: int):
| ^^^^ ANN201
| ^^^^
195 | try:
196 | pass
|
= help: Add return type annotation: `int`
Unsafe fix
191 191 | return 2
192 192 |
@@ -533,15 +565,16 @@ auto_return_type.py:194:5: ANN201 [*] Missing return type annotation for public
196 196 | pass
197 197 | except:
auto_return_type.py:203:5: ANN201 [*] Missing return type annotation for public function `func`
error[ANN201]: 203:5: [*] Missing return type annotation for public function `func`
--> auto_return_type.py:203:5
|
203 | def func(x: int):
| ^^^^ ANN201
| ^^^^
204 | if not x:
205 | raise ValueError
|
= help: Add return type annotation: `Never`
Unsafe fix
151 151 |
152 152 | import abc
@@ -560,15 +593,16 @@ auto_return_type.py:203:5: ANN201 [*] Missing return type annotation for public
205 206 | raise ValueError
206 207 | else:
auto_return_type.py:210:5: ANN201 [*] Missing return type annotation for public function `func`
error[ANN201]: 210:5: [*] Missing return type annotation for public function `func`
--> auto_return_type.py:210:5
|
210 | def func(x: int):
| ^^^^ ANN201
| ^^^^
211 | if not x:
212 | raise ValueError
|
= help: Add return type annotation: `int`
Unsafe fix
207 207 | raise TypeError
208 208 |
@@ -579,15 +613,16 @@ auto_return_type.py:210:5: ANN201 [*] Missing return type annotation for public
212 212 | raise ValueError
213 213 | else:
auto_return_type.py:234:5: ANN201 [*] Missing return type annotation for public function `func`
error[ANN201]: 234:5: [*] Missing return type annotation for public function `func`
--> auto_return_type.py:234:5
|
234 | def func(x: int):
| ^^^^ ANN201
| ^^^^
235 | if not x:
236 | return 1
|
= help: Add return type annotation: `int`
Unsafe fix
231 231 | return i
232 232 |
@@ -598,15 +633,16 @@ auto_return_type.py:234:5: ANN201 [*] Missing return type annotation for public
236 236 | return 1
237 237 | raise ValueError
auto_return_type.py:240:5: ANN201 [*] Missing return type annotation for public function `func`
error[ANN201]: 240:5: [*] Missing return type annotation for public function `func`
--> auto_return_type.py:240:5
|
240 | def func(x: int):
| ^^^^ ANN201
| ^^^^
241 | if not x:
242 | return 1
|
= help: Add return type annotation: `int`
Unsafe fix
237 237 | raise ValueError
238 238 |
@@ -617,15 +653,16 @@ auto_return_type.py:240:5: ANN201 [*] Missing return type annotation for public
242 242 | return 1
243 243 | else:
auto_return_type.py:248:5: ANN201 [*] Missing return type annotation for public function `func`
error[ANN201]: 248:5: [*] Missing return type annotation for public function `func`
--> auto_return_type.py:248:5
|
248 | def func():
| ^^^^ ANN201
| ^^^^
249 | try:
250 | raise ValueError
|
= help: Add return type annotation: `int | None`
Unsafe fix
245 245 | raise ValueError
246 246 |
@@ -636,15 +673,16 @@ auto_return_type.py:248:5: ANN201 [*] Missing return type annotation for public
250 250 | raise ValueError
251 251 | except:
auto_return_type.py:255:5: ANN201 [*] Missing return type annotation for public function `func`
error[ANN201]: 255:5: [*] Missing return type annotation for public function `func`
--> auto_return_type.py:255:5
|
255 | def func():
| ^^^^ ANN201
| ^^^^
256 | try:
257 | return 1
|
= help: Add return type annotation: `int | None`
Unsafe fix
252 252 | return 2
253 253 |
@@ -655,15 +693,16 @@ auto_return_type.py:255:5: ANN201 [*] Missing return type annotation for public
257 257 | return 1
258 258 | except:
auto_return_type.py:262:5: ANN201 [*] Missing return type annotation for public function `func`
error[ANN201]: 262:5: [*] Missing return type annotation for public function `func`
--> auto_return_type.py:262:5
|
262 | def func(x: int):
| ^^^^ ANN201
| ^^^^
263 | for _ in range(3):
264 | if x > 0:
|
= help: Add return type annotation: `int`
Unsafe fix
259 259 | pass
260 260 |
@@ -674,15 +713,16 @@ auto_return_type.py:262:5: ANN201 [*] Missing return type annotation for public
264 264 | if x > 0:
265 265 | return 1
auto_return_type.py:269:5: ANN201 [*] Missing return type annotation for public function `func`
error[ANN201]: 269:5: [*] Missing return type annotation for public function `func`
--> auto_return_type.py:269:5
|
269 | def func(x: int):
| ^^^^ ANN201
| ^^^^
270 | if x > 5:
271 | raise ValueError
|
= help: Add return type annotation: `None`
Unsafe fix
266 266 | raise ValueError
267 267 |
@@ -693,15 +733,16 @@ auto_return_type.py:269:5: ANN201 [*] Missing return type annotation for public
271 271 | raise ValueError
272 272 | else:
auto_return_type.py:276:5: ANN201 [*] Missing return type annotation for public function `func`
error[ANN201]: 276:5: [*] Missing return type annotation for public function `func`
--> auto_return_type.py:276:5
|
276 | def func(x: int):
| ^^^^ ANN201
| ^^^^
277 | if x > 5:
278 | raise ValueError
|
= help: Add return type annotation: `None`
Unsafe fix
273 273 | pass
274 274 |
@@ -712,15 +753,16 @@ auto_return_type.py:276:5: ANN201 [*] Missing return type annotation for public
278 278 | raise ValueError
279 279 | elif x > 10:
auto_return_type.py:283:5: ANN201 [*] Missing return type annotation for public function `func`
error[ANN201]: 283:5: [*] Missing return type annotation for public function `func`
--> auto_return_type.py:283:5
|
283 | def func(x: int):
| ^^^^ ANN201
| ^^^^
284 | if x > 5:
285 | raise ValueError
|
= help: Add return type annotation: `int | None`
Unsafe fix
280 280 | pass
281 281 |
@@ -731,15 +773,16 @@ auto_return_type.py:283:5: ANN201 [*] Missing return type annotation for public
285 285 | raise ValueError
286 286 | elif x > 10:
auto_return_type.py:290:5: ANN201 [*] Missing return type annotation for public function `func`
error[ANN201]: 290:5: [*] Missing return type annotation for public function `func`
--> auto_return_type.py:290:5
|
290 | def func():
| ^^^^ ANN201
| ^^^^
291 | try:
292 | return 5
|
= help: Add return type annotation: `int`
Unsafe fix
287 287 | return 5
288 288 |
@@ -750,15 +793,16 @@ auto_return_type.py:290:5: ANN201 [*] Missing return type annotation for public
292 292 | return 5
293 293 | except:
auto_return_type.py:299:5: ANN201 [*] Missing return type annotation for public function `func`
error[ANN201]: 299:5: [*] Missing return type annotation for public function `func`
--> auto_return_type.py:299:5
|
299 | def func(x: int):
| ^^^^ ANN201
| ^^^^
300 | match x:
301 | case [1, 2, 3]:
|
= help: Add return type annotation: `str | int`
Unsafe fix
296 296 | raise ValueError
297 297 |
@@ -768,5 +812,3 @@ auto_return_type.py:299:5: ANN201 [*] Missing return type annotation for public
300 300 | match x:
301 301 | case [1, 2, 3]:
302 302 | return 1

View File

@@ -1,14 +1,15 @@
---
source: crates/ruff_linter/src/rules/flake8_annotations/mod.rs
---
auto_return_type.py:1:5: ANN201 [*] Missing return type annotation for public function `func`
error[ANN201]: 1:5: [*] Missing return type annotation for public function `func`
--> auto_return_type.py:1:5
|
1 | def func():
| ^^^^ ANN201
| ^^^^
2 | return 1
|
= help: Add return type annotation: `int`
Unsafe fix
1 |-def func():
1 |+def func() -> int:
@@ -16,14 +17,15 @@ auto_return_type.py:1:5: ANN201 [*] Missing return type annotation for public fu
3 3 |
4 4 |
auto_return_type.py:5:5: ANN201 [*] Missing return type annotation for public function `func`
error[ANN201]: 5:5: [*] Missing return type annotation for public function `func`
--> auto_return_type.py:5:5
|
5 | def func():
| ^^^^ ANN201
| ^^^^
6 | return 1.5
|
= help: Add return type annotation: `float`
Unsafe fix
2 2 | return 1
3 3 |
@@ -34,15 +36,16 @@ auto_return_type.py:5:5: ANN201 [*] Missing return type annotation for public fu
7 7 |
8 8 |
auto_return_type.py:9:5: ANN201 [*] Missing return type annotation for public function `func`
error[ANN201]: 9:5: [*] Missing return type annotation for public function `func`
--> auto_return_type.py:9:5
|
9 | def func(x: int):
| ^^^^ ANN201
| ^^^^
10 | if x > 0:
11 | return 1
|
= help: Add return type annotation: `float`
Unsafe fix
6 6 | return 1.5
7 7 |
@@ -53,14 +56,15 @@ auto_return_type.py:9:5: ANN201 [*] Missing return type annotation for public fu
11 11 | return 1
12 12 | else:
auto_return_type.py:16:5: ANN201 [*] Missing return type annotation for public function `func`
error[ANN201]: 16:5: [*] Missing return type annotation for public function `func`
--> auto_return_type.py:16:5
|
16 | def func():
| ^^^^ ANN201
| ^^^^
17 | return True
|
= help: Add return type annotation: `bool`
Unsafe fix
13 13 | return 1.5
14 14 |
@@ -71,15 +75,16 @@ auto_return_type.py:16:5: ANN201 [*] Missing return type annotation for public f
18 18 |
19 19 |
auto_return_type.py:20:5: ANN201 [*] Missing return type annotation for public function `func`
error[ANN201]: 20:5: [*] Missing return type annotation for public function `func`
--> auto_return_type.py:20:5
|
20 | def func(x: int):
| ^^^^ ANN201
| ^^^^
21 | if x > 0:
22 | return None
|
= help: Add return type annotation: `None`
Unsafe fix
17 17 | return True
18 18 |
@@ -90,14 +95,15 @@ auto_return_type.py:20:5: ANN201 [*] Missing return type annotation for public f
22 22 | return None
23 23 | else:
auto_return_type.py:27:5: ANN201 [*] Missing return type annotation for public function `func`
error[ANN201]: 27:5: [*] Missing return type annotation for public function `func`
--> auto_return_type.py:27:5
|
27 | def func(x: int):
| ^^^^ ANN201
| ^^^^
28 | return 1 or 2.5 if x > 0 else 1.5 or "str"
|
= help: Add return type annotation: `Union[str | float]`
Unsafe fix
1 |+from typing import Union
1 2 | def func():
@@ -113,14 +119,15 @@ auto_return_type.py:27:5: ANN201 [*] Missing return type annotation for public f
29 30 |
30 31 |
auto_return_type.py:31:5: ANN201 [*] Missing return type annotation for public function `func`
error[ANN201]: 31:5: [*] Missing return type annotation for public function `func`
--> auto_return_type.py:31:5
|
31 | def func(x: int):
| ^^^^ ANN201
| ^^^^
32 | return 1 + 2.5 if x > 0 else 1.5 or "str"
|
= help: Add return type annotation: `Union[str | float]`
Unsafe fix
1 |+from typing import Union
1 2 | def func():
@@ -136,32 +143,35 @@ auto_return_type.py:31:5: ANN201 [*] Missing return type annotation for public f
33 34 |
34 35 |
auto_return_type.py:35:5: ANN201 Missing return type annotation for public function `func`
error[ANN201]: 35:5: Missing return type annotation for public function `func`
--> auto_return_type.py:35:5
|
35 | def func(x: int):
| ^^^^ ANN201
| ^^^^
36 | if not x:
37 | return None
|
= help: Add return type annotation
error[ANN201]: 41:5: Missing return type annotation for public function `func`
auto_return_type.py:41:5: ANN201 Missing return type annotation for public function `func`
--> auto_return_type.py:41:5
|
41 | def func(x: int):
| ^^^^ ANN201
| ^^^^
42 | return {"foo": 1}
|
= help: Add return type annotation
error[ANN201]: 45:5: [*] Missing return type annotation for public function `func`
auto_return_type.py:45:5: ANN201 [*] Missing return type annotation for public function `func`
--> auto_return_type.py:45:5
|
45 | def func(x: int):
| ^^^^ ANN201
| ^^^^
46 | if not x:
47 | return 1
|
= help: Add return type annotation: `int`
Unsafe fix
42 42 | return {"foo": 1}
43 43 |
@@ -172,15 +182,16 @@ auto_return_type.py:45:5: ANN201 [*] Missing return type annotation for public f
47 47 | return 1
48 48 | else:
auto_return_type.py:52:5: ANN201 [*] Missing return type annotation for public function `func`
error[ANN201]: 52:5: [*] Missing return type annotation for public function `func`
--> auto_return_type.py:52:5
|
52 | def func(x: int):
| ^^^^ ANN201
| ^^^^
53 | if not x:
54 | return 1
|
= help: Add return type annotation: `Optional[int]`
Unsafe fix
1 |+from typing import Optional
1 2 | def func():
@@ -196,15 +207,16 @@ auto_return_type.py:52:5: ANN201 [*] Missing return type annotation for public f
54 55 | return 1
55 56 | else:
auto_return_type.py:59:5: ANN201 [*] Missing return type annotation for public function `func`
error[ANN201]: 59:5: [*] Missing return type annotation for public function `func`
--> auto_return_type.py:59:5
|
59 | def func(x: int):
| ^^^^ ANN201
| ^^^^
60 | if not x:
61 | return 1
|
= help: Add return type annotation: `Union[str | int | None]`
Unsafe fix
1 |+from typing import Union
1 2 | def func():
@@ -220,15 +232,16 @@ auto_return_type.py:59:5: ANN201 [*] Missing return type annotation for public f
61 62 | return 1
62 63 | elif x > 5:
auto_return_type.py:68:5: ANN201 [*] Missing return type annotation for public function `func`
error[ANN201]: 68:5: [*] Missing return type annotation for public function `func`
--> auto_return_type.py:68:5
|
68 | def func(x: int):
| ^^^^ ANN201
| ^^^^
69 | if x:
70 | return 1
|
= help: Add return type annotation: `Optional[int]`
Unsafe fix
1 |+from typing import Optional
1 2 | def func():
@@ -244,14 +257,15 @@ auto_return_type.py:68:5: ANN201 [*] Missing return type annotation for public f
70 71 | return 1
71 72 |
auto_return_type.py:73:5: ANN201 [*] Missing return type annotation for public function `func`
error[ANN201]: 73:5: [*] Missing return type annotation for public function `func`
--> auto_return_type.py:73:5
|
73 | def func():
| ^^^^ ANN201
| ^^^^
74 | x = 1
|
= help: Add return type annotation: `None`
Unsafe fix
70 70 | return 1
71 71 |
@@ -262,15 +276,16 @@ auto_return_type.py:73:5: ANN201 [*] Missing return type annotation for public f
75 75 |
76 76 |
auto_return_type.py:77:5: ANN201 [*] Missing return type annotation for public function `func`
error[ANN201]: 77:5: [*] Missing return type annotation for public function `func`
--> auto_return_type.py:77:5
|
77 | def func(x: int):
| ^^^^ ANN201
| ^^^^
78 | if x > 0:
79 | return 1
|
= help: Add return type annotation: `Optional[int]`
Unsafe fix
1 |+from typing import Optional
1 2 | def func():
@@ -286,15 +301,16 @@ auto_return_type.py:77:5: ANN201 [*] Missing return type annotation for public f
79 80 | return 1
80 81 |
auto_return_type.py:82:5: ANN201 [*] Missing return type annotation for public function `func`
error[ANN201]: 82:5: [*] Missing return type annotation for public function `func`
--> auto_return_type.py:82:5
|
82 | def func(x: int):
| ^^^^ ANN201
| ^^^^
83 | match x:
84 | case [1, 2, 3]:
|
= help: Add return type annotation: `Union[str | int | None]`
Unsafe fix
1 |+from typing import Union
1 2 | def func():
@@ -310,15 +326,16 @@ auto_return_type.py:82:5: ANN201 [*] Missing return type annotation for public f
84 85 | case [1, 2, 3]:
85 86 | return 1
auto_return_type.py:90:5: ANN201 [*] Missing return type annotation for public function `func`
error[ANN201]: 90:5: [*] Missing return type annotation for public function `func`
--> auto_return_type.py:90:5
|
90 | def func(x: int):
| ^^^^ ANN201
| ^^^^
91 | for i in range(5):
92 | if i > 0:
|
= help: Add return type annotation: `Optional[int]`
Unsafe fix
1 |+from typing import Optional
1 2 | def func():
@@ -334,15 +351,16 @@ auto_return_type.py:90:5: ANN201 [*] Missing return type annotation for public f
92 93 | if i > 0:
93 94 | return 1
auto_return_type.py:96:5: ANN201 [*] Missing return type annotation for public function `func`
error[ANN201]: 96:5: [*] Missing return type annotation for public function `func`
--> auto_return_type.py:96:5
|
96 | def func(x: int):
| ^^^^ ANN201
| ^^^^
97 | for i in range(5):
98 | if i > 0:
|
= help: Add return type annotation: `int`
Unsafe fix
93 93 | return 1
94 94 |
@@ -353,15 +371,16 @@ auto_return_type.py:96:5: ANN201 [*] Missing return type annotation for public f
98 98 | if i > 0:
99 99 | return 1
auto_return_type.py:104:5: ANN201 [*] Missing return type annotation for public function `func`
error[ANN201]: 104:5: [*] Missing return type annotation for public function `func`
--> auto_return_type.py:104:5
|
104 | def func(x: int):
| ^^^^ ANN201
| ^^^^
105 | for i in range(5):
106 | if i > 0:
|
= help: Add return type annotation: `Optional[int]`
Unsafe fix
1 |+from typing import Optional
1 2 | def func():
@@ -377,15 +396,16 @@ auto_return_type.py:104:5: ANN201 [*] Missing return type annotation for public
106 107 | if i > 0:
107 108 | break
auto_return_type.py:112:5: ANN201 [*] Missing return type annotation for public function `func`
error[ANN201]: 112:5: [*] Missing return type annotation for public function `func`
--> auto_return_type.py:112:5
|
112 | def func(x: int):
| ^^^^ ANN201
| ^^^^
113 | try:
114 | pass
|
= help: Add return type annotation: `Optional[int]`
Unsafe fix
1 |+from typing import Optional
1 2 | def func():
@@ -401,15 +421,16 @@ auto_return_type.py:112:5: ANN201 [*] Missing return type annotation for public
114 115 | pass
115 116 | except:
auto_return_type.py:119:5: ANN201 [*] Missing return type annotation for public function `func`
error[ANN201]: 119:5: [*] Missing return type annotation for public function `func`
--> auto_return_type.py:119:5
|
119 | def func(x: int):
| ^^^^ ANN201
| ^^^^
120 | try:
121 | pass
|
= help: Add return type annotation: `int`
Unsafe fix
116 116 | return 1
117 117 |
@@ -420,15 +441,16 @@ auto_return_type.py:119:5: ANN201 [*] Missing return type annotation for public
121 121 | pass
122 122 | except:
auto_return_type.py:128:5: ANN201 [*] Missing return type annotation for public function `func`
error[ANN201]: 128:5: [*] Missing return type annotation for public function `func`
--> auto_return_type.py:128:5
|
128 | def func(x: int):
| ^^^^ ANN201
| ^^^^
129 | try:
130 | pass
|
= help: Add return type annotation: `int`
Unsafe fix
125 125 | return 2
126 126 |
@@ -439,15 +461,16 @@ auto_return_type.py:128:5: ANN201 [*] Missing return type annotation for public
130 130 | pass
131 131 | except:
auto_return_type.py:137:5: ANN201 [*] Missing return type annotation for public function `func`
error[ANN201]: 137:5: [*] Missing return type annotation for public function `func`
--> auto_return_type.py:137:5
|
137 | def func(x: int):
| ^^^^ ANN201
| ^^^^
138 | try:
139 | return 1
|
= help: Add return type annotation: `Optional[int]`
Unsafe fix
1 |+from typing import Optional
1 2 | def func():
@@ -463,15 +486,16 @@ auto_return_type.py:137:5: ANN201 [*] Missing return type annotation for public
139 140 | return 1
140 141 | except:
auto_return_type.py:146:5: ANN201 [*] Missing return type annotation for public function `func`
error[ANN201]: 146:5: [*] Missing return type annotation for public function `func`
--> auto_return_type.py:146:5
|
146 | def func(x: int):
| ^^^^ ANN201
| ^^^^
147 | while x > 0:
148 | break
|
= help: Add return type annotation: `Optional[int]`
Unsafe fix
1 |+from typing import Optional
1 2 | def func():
@@ -487,64 +511,70 @@ auto_return_type.py:146:5: ANN201 [*] Missing return type annotation for public
148 149 | break
149 150 | return 1
auto_return_type.py:158:9: ANN201 Missing return type annotation for public function `method`
error[ANN201]: 158:9: Missing return type annotation for public function `method`
--> auto_return_type.py:158:9
|
156 | class Foo(abc.ABC):
157 | @abstractmethod
158 | def method(self):
| ^^^^^^ ANN201
| ^^^^^^
159 | pass
|
= help: Add return type annotation
error[ANN201]: 162:9: Missing return type annotation for public function `method`
auto_return_type.py:162:9: ANN201 Missing return type annotation for public function `method`
--> auto_return_type.py:162:9
|
161 | @abc.abstractmethod
162 | def method(self):
| ^^^^^^ ANN201
| ^^^^^^
163 | """Docstring."""
|
= help: Add return type annotation
error[ANN201]: 166:9: Missing return type annotation for public function `method`
auto_return_type.py:166:9: ANN201 Missing return type annotation for public function `method`
--> auto_return_type.py:166:9
|
165 | @abc.abstractmethod
166 | def method(self):
| ^^^^^^ ANN201
| ^^^^^^
167 | ...
|
= help: Add return type annotation
error[ANN205]: 171:9: Missing return type annotation for staticmethod `method`
auto_return_type.py:171:9: ANN205 Missing return type annotation for staticmethod `method`
--> auto_return_type.py:171:9
|
169 | @staticmethod
170 | @abstractmethod
171 | def method():
| ^^^^^^ ANN205
| ^^^^^^
172 | pass
|
= help: Add return type annotation
error[ANN206]: 176:9: Missing return type annotation for classmethod `method`
auto_return_type.py:176:9: ANN206 Missing return type annotation for classmethod `method`
--> auto_return_type.py:176:9
|
174 | @classmethod
175 | @abstractmethod
176 | def method(cls):
| ^^^^^^ ANN206
| ^^^^^^
177 | pass
|
= help: Add return type annotation
error[ANN201]: 180:9: [*] Missing return type annotation for public function `method`
auto_return_type.py:180:9: ANN201 [*] Missing return type annotation for public function `method`
--> auto_return_type.py:180:9
|
179 | @abstractmethod
180 | def method(self):
| ^^^^^^ ANN201
| ^^^^^^
181 | if self.x > 0:
182 | return 1
|
= help: Add return type annotation: `float`
Unsafe fix
177 177 | pass
178 178 |
@@ -555,15 +585,16 @@ auto_return_type.py:180:9: ANN201 [*] Missing return type annotation for public
182 182 | return 1
183 183 | else:
auto_return_type.py:187:5: ANN201 [*] Missing return type annotation for public function `func`
error[ANN201]: 187:5: [*] Missing return type annotation for public function `func`
--> auto_return_type.py:187:5
|
187 | def func(x: int):
| ^^^^ ANN201
| ^^^^
188 | try:
189 | pass
|
= help: Add return type annotation: `Optional[int]`
Unsafe fix
151 151 |
152 152 | import abc
@@ -582,15 +613,16 @@ auto_return_type.py:187:5: ANN201 [*] Missing return type annotation for public
189 190 | pass
190 191 | except:
auto_return_type.py:194:5: ANN201 [*] Missing return type annotation for public function `func`
error[ANN201]: 194:5: [*] Missing return type annotation for public function `func`
--> auto_return_type.py:194:5
|
194 | def func(x: int):
| ^^^^ ANN201
| ^^^^
195 | try:
196 | pass
|
= help: Add return type annotation: `int`
Unsafe fix
191 191 | return 2
192 192 |
@@ -601,15 +633,16 @@ auto_return_type.py:194:5: ANN201 [*] Missing return type annotation for public
196 196 | pass
197 197 | except:
auto_return_type.py:203:5: ANN201 [*] Missing return type annotation for public function `func`
error[ANN201]: 203:5: [*] Missing return type annotation for public function `func`
--> auto_return_type.py:203:5
|
203 | def func(x: int):
| ^^^^ ANN201
| ^^^^
204 | if not x:
205 | raise ValueError
|
= help: Add return type annotation: `NoReturn`
Unsafe fix
151 151 |
152 152 | import abc
@@ -628,15 +661,16 @@ auto_return_type.py:203:5: ANN201 [*] Missing return type annotation for public
205 206 | raise ValueError
206 207 | else:
auto_return_type.py:210:5: ANN201 [*] Missing return type annotation for public function `func`
error[ANN201]: 210:5: [*] Missing return type annotation for public function `func`
--> auto_return_type.py:210:5
|
210 | def func(x: int):
| ^^^^ ANN201
| ^^^^
211 | if not x:
212 | raise ValueError
|
= help: Add return type annotation: `int`
Unsafe fix
207 207 | raise TypeError
208 208 |
@@ -647,15 +681,16 @@ auto_return_type.py:210:5: ANN201 [*] Missing return type annotation for public
212 212 | raise ValueError
213 213 | else:
auto_return_type.py:234:5: ANN201 [*] Missing return type annotation for public function `func`
error[ANN201]: 234:5: [*] Missing return type annotation for public function `func`
--> auto_return_type.py:234:5
|
234 | def func(x: int):
| ^^^^ ANN201
| ^^^^
235 | if not x:
236 | return 1
|
= help: Add return type annotation: `int`
Unsafe fix
231 231 | return i
232 232 |
@@ -666,15 +701,16 @@ auto_return_type.py:234:5: ANN201 [*] Missing return type annotation for public
236 236 | return 1
237 237 | raise ValueError
auto_return_type.py:240:5: ANN201 [*] Missing return type annotation for public function `func`
error[ANN201]: 240:5: [*] Missing return type annotation for public function `func`
--> auto_return_type.py:240:5
|
240 | def func(x: int):
| ^^^^ ANN201
| ^^^^
241 | if not x:
242 | return 1
|
= help: Add return type annotation: `int`
Unsafe fix
237 237 | raise ValueError
238 238 |
@@ -685,15 +721,16 @@ auto_return_type.py:240:5: ANN201 [*] Missing return type annotation for public
242 242 | return 1
243 243 | else:
auto_return_type.py:248:5: ANN201 [*] Missing return type annotation for public function `func`
error[ANN201]: 248:5: [*] Missing return type annotation for public function `func`
--> auto_return_type.py:248:5
|
248 | def func():
| ^^^^ ANN201
| ^^^^
249 | try:
250 | raise ValueError
|
= help: Add return type annotation: `Optional[int]`
Unsafe fix
214 214 | return 1
215 215 |
@@ -713,15 +750,16 @@ auto_return_type.py:248:5: ANN201 [*] Missing return type annotation for public
250 250 | raise ValueError
251 251 | except:
auto_return_type.py:255:5: ANN201 [*] Missing return type annotation for public function `func`
error[ANN201]: 255:5: [*] Missing return type annotation for public function `func`
--> auto_return_type.py:255:5
|
255 | def func():
| ^^^^ ANN201
| ^^^^
256 | try:
257 | return 1
|
= help: Add return type annotation: `Optional[int]`
Unsafe fix
214 214 | return 1
215 215 |
@@ -741,15 +779,16 @@ auto_return_type.py:255:5: ANN201 [*] Missing return type annotation for public
257 257 | return 1
258 258 | except:
auto_return_type.py:262:5: ANN201 [*] Missing return type annotation for public function `func`
error[ANN201]: 262:5: [*] Missing return type annotation for public function `func`
--> auto_return_type.py:262:5
|
262 | def func(x: int):
| ^^^^ ANN201
| ^^^^
263 | for _ in range(3):
264 | if x > 0:
|
= help: Add return type annotation: `int`
Unsafe fix
259 259 | pass
260 260 |
@@ -760,15 +799,16 @@ auto_return_type.py:262:5: ANN201 [*] Missing return type annotation for public
264 264 | if x > 0:
265 265 | return 1
auto_return_type.py:269:5: ANN201 [*] Missing return type annotation for public function `func`
error[ANN201]: 269:5: [*] Missing return type annotation for public function `func`
--> auto_return_type.py:269:5
|
269 | def func(x: int):
| ^^^^ ANN201
| ^^^^
270 | if x > 5:
271 | raise ValueError
|
= help: Add return type annotation: `None`
Unsafe fix
266 266 | raise ValueError
267 267 |
@@ -779,15 +819,16 @@ auto_return_type.py:269:5: ANN201 [*] Missing return type annotation for public
271 271 | raise ValueError
272 272 | else:
auto_return_type.py:276:5: ANN201 [*] Missing return type annotation for public function `func`
error[ANN201]: 276:5: [*] Missing return type annotation for public function `func`
--> auto_return_type.py:276:5
|
276 | def func(x: int):
| ^^^^ ANN201
| ^^^^
277 | if x > 5:
278 | raise ValueError
|
= help: Add return type annotation: `None`
Unsafe fix
273 273 | pass
274 274 |
@@ -798,15 +839,16 @@ auto_return_type.py:276:5: ANN201 [*] Missing return type annotation for public
278 278 | raise ValueError
279 279 | elif x > 10:
auto_return_type.py:283:5: ANN201 [*] Missing return type annotation for public function `func`
error[ANN201]: 283:5: [*] Missing return type annotation for public function `func`
--> auto_return_type.py:283:5
|
283 | def func(x: int):
| ^^^^ ANN201
| ^^^^
284 | if x > 5:
285 | raise ValueError
|
= help: Add return type annotation: `Optional[int]`
Unsafe fix
214 214 | return 1
215 215 |
@@ -826,15 +868,16 @@ auto_return_type.py:283:5: ANN201 [*] Missing return type annotation for public
285 285 | raise ValueError
286 286 | elif x > 10:
auto_return_type.py:290:5: ANN201 [*] Missing return type annotation for public function `func`
error[ANN201]: 290:5: [*] Missing return type annotation for public function `func`
--> auto_return_type.py:290:5
|
290 | def func():
| ^^^^ ANN201
| ^^^^
291 | try:
292 | return 5
|
= help: Add return type annotation: `int`
Unsafe fix
287 287 | return 5
288 288 |
@@ -845,15 +888,16 @@ auto_return_type.py:290:5: ANN201 [*] Missing return type annotation for public
292 292 | return 5
293 293 | except:
auto_return_type.py:299:5: ANN201 [*] Missing return type annotation for public function `func`
error[ANN201]: 299:5: [*] Missing return type annotation for public function `func`
--> auto_return_type.py:299:5
|
299 | def func(x: int):
| ^^^^ ANN201
| ^^^^
300 | match x:
301 | case [1, 2, 3]:
|
= help: Add return type annotation: `Union[str | int]`
Unsafe fix
214 214 | return 1
215 215 |
@@ -872,5 +916,3 @@ auto_return_type.py:299:5: ANN201 [*] Missing return type annotation for public
300 300 | match x:
301 301 | case [1, 2, 3]:
302 302 | return 1

View File

@@ -1,15 +1,16 @@
---
source: crates/ruff_linter/src/rules/flake8_annotations/mod.rs
---
annotation_presence.py:5:5: ANN201 [*] Missing return type annotation for public function `foo`
error[ANN201]: 5:5: [*] Missing return type annotation for public function `foo`
--> annotation_presence.py:5:5
|
4 | # Error
5 | def foo(a, b):
| ^^^ ANN201
| ^^^
6 | pass
|
= help: Add return type annotation: `None`
Unsafe fix
2 2 | from typing_extensions import override
3 3 |
@@ -20,31 +21,34 @@ annotation_presence.py:5:5: ANN201 [*] Missing return type annotation for public
7 7 |
8 8 |
annotation_presence.py:5:9: ANN001 Missing type annotation for function argument `a`
error[ANN001]: 5:9: Missing type annotation for function argument `a`
--> annotation_presence.py:5:9
|
4 | # Error
5 | def foo(a, b):
| ^ ANN001
| ^
6 | pass
|
error[ANN001]: 5:12: Missing type annotation for function argument `b`
annotation_presence.py:5:12: ANN001 Missing type annotation for function argument `b`
--> annotation_presence.py:5:12
|
4 | # Error
5 | def foo(a, b):
| ^ ANN001
| ^
6 | pass
|
error[ANN201]: 10:5: [*] Missing return type annotation for public function `foo`
annotation_presence.py:10:5: ANN201 [*] Missing return type annotation for public function `foo`
--> annotation_presence.py:10:5
|
9 | # Error
10 | def foo(a: int, b):
| ^^^ ANN201
| ^^^
11 | pass
|
= help: Add return type annotation: `None`
Unsafe fix
7 7 |
8 8 |
@@ -55,31 +59,34 @@ annotation_presence.py:10:5: ANN201 [*] Missing return type annotation for publi
12 12 |
13 13 |
annotation_presence.py:10:17: ANN001 Missing type annotation for function argument `b`
error[ANN001]: 10:17: Missing type annotation for function argument `b`
--> annotation_presence.py:10:17
|
9 | # Error
10 | def foo(a: int, b):
| ^ ANN001
| ^
11 | pass
|
error[ANN001]: 15:17: Missing type annotation for function argument `b`
annotation_presence.py:15:17: ANN001 Missing type annotation for function argument `b`
--> annotation_presence.py:15:17
|
14 | # Error
15 | def foo(a: int, b) -> int:
| ^ ANN001
| ^
16 | pass
|
error[ANN201]: 20:5: [*] Missing return type annotation for public function `foo`
annotation_presence.py:20:5: ANN201 [*] Missing return type annotation for public function `foo`
--> annotation_presence.py:20:5
|
19 | # Error
20 | def foo(a: int, b: int):
| ^^^ ANN201
| ^^^
21 | pass
|
= help: Add return type annotation: `None`
Unsafe fix
17 17 |
18 18 |
@@ -90,15 +97,16 @@ annotation_presence.py:20:5: ANN201 [*] Missing return type annotation for publi
22 22 |
23 23 |
annotation_presence.py:25:5: ANN201 [*] Missing return type annotation for public function `foo`
error[ANN201]: 25:5: [*] Missing return type annotation for public function `foo`
--> annotation_presence.py:25:5
|
24 | # Error
25 | def foo():
| ^^^ ANN201
| ^^^
26 | pass
|
= help: Add return type annotation: `None`
Unsafe fix
22 22 |
23 23 |
@@ -109,193 +117,215 @@ annotation_presence.py:25:5: ANN201 [*] Missing return type annotation for publi
27 27 |
28 28 |
annotation_presence.py:45:12: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `a`
error[ANN401]: 45:12: Dynamically typed expressions (typing.Any) are disallowed in `a`
--> annotation_presence.py:45:12
|
44 | # ANN401
45 | def foo(a: Any, *args: str, **kwargs: str) -> int:
| ^^^ ANN401
| ^^^
46 | pass
|
error[ANN401]: 50:47: Dynamically typed expressions (typing.Any) are disallowed in `foo`
annotation_presence.py:50:47: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `foo`
--> annotation_presence.py:50:47
|
49 | # ANN401
50 | def foo(a: int, *args: str, **kwargs: str) -> Any:
| ^^^ ANN401
| ^^^
51 | pass
|
error[ANN401]: 55:24: Dynamically typed expressions (typing.Any) are disallowed in `*args`
annotation_presence.py:55:24: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `*args`
--> annotation_presence.py:55:24
|
54 | # ANN401
55 | def foo(a: int, *args: Any, **kwargs: Any) -> int:
| ^^^ ANN401
| ^^^
56 | pass
|
error[ANN401]: 55:39: Dynamically typed expressions (typing.Any) are disallowed in `**kwargs`
annotation_presence.py:55:39: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `**kwargs`
--> annotation_presence.py:55:39
|
54 | # ANN401
55 | def foo(a: int, *args: Any, **kwargs: Any) -> int:
| ^^^ ANN401
| ^^^
56 | pass
|
error[ANN401]: 60:24: Dynamically typed expressions (typing.Any) are disallowed in `*args`
annotation_presence.py:60:24: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `*args`
--> annotation_presence.py:60:24
|
59 | # ANN401
60 | def foo(a: int, *args: Any, **kwargs: str) -> int:
| ^^^ ANN401
| ^^^
61 | pass
|
error[ANN401]: 65:39: Dynamically typed expressions (typing.Any) are disallowed in `**kwargs`
annotation_presence.py:65:39: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `**kwargs`
--> annotation_presence.py:65:39
|
64 | # ANN401
65 | def foo(a: int, *args: str, **kwargs: Any) -> int:
| ^^^ ANN401
| ^^^
66 | pass
|
error[ANN101]: 75:13: Missing type annotation for `self` in method
annotation_presence.py:75:13: ANN101 Missing type annotation for `self` in method
--> annotation_presence.py:75:13
|
74 | # ANN101
75 | def foo(self, a: int, b: int) -> int:
| ^^^^ ANN101
| ^^^^
76 | pass
|
error[ANN401]: 79:29: Dynamically typed expressions (typing.Any) are disallowed in `a`
annotation_presence.py:79:29: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `a`
--> annotation_presence.py:79:29
|
78 | # ANN401
79 | def foo(self: "Foo", a: Any, *params: str, **options: str) -> int:
| ^^^ ANN401
| ^^^
80 | pass
|
error[ANN401]: 83:67: Dynamically typed expressions (typing.Any) are disallowed in `foo`
annotation_presence.py:83:67: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `foo`
--> annotation_presence.py:83:67
|
82 | # ANN401
83 | def foo(self: "Foo", a: int, *params: str, **options: str) -> Any:
| ^^^ ANN401
| ^^^
84 | pass
|
error[ANN401]: 87:43: Dynamically typed expressions (typing.Any) are disallowed in `*params`
annotation_presence.py:87:43: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `*params`
--> annotation_presence.py:87:43
|
86 | # ANN401
87 | def foo(self: "Foo", a: int, *params: Any, **options: Any) -> int:
| ^^^ ANN401
| ^^^
88 | pass
|
error[ANN401]: 87:59: Dynamically typed expressions (typing.Any) are disallowed in `**options`
annotation_presence.py:87:59: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `**options`
--> annotation_presence.py:87:59
|
86 | # ANN401
87 | def foo(self: "Foo", a: int, *params: Any, **options: Any) -> int:
| ^^^ ANN401
| ^^^
88 | pass
|
error[ANN401]: 91:43: Dynamically typed expressions (typing.Any) are disallowed in `*params`
annotation_presence.py:91:43: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `*params`
--> annotation_presence.py:91:43
|
90 | # ANN401
91 | def foo(self: "Foo", a: int, *params: Any, **options: str) -> int:
| ^^^ ANN401
| ^^^
92 | pass
|
error[ANN401]: 95:59: Dynamically typed expressions (typing.Any) are disallowed in `**options`
annotation_presence.py:95:59: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `**options`
--> annotation_presence.py:95:59
|
94 | # ANN401
95 | def foo(self: "Foo", a: int, *params: str, **options: Any) -> int:
| ^^^ ANN401
| ^^^
96 | pass
|
error[ANN102]: 130:13: Missing type annotation for `cls` in classmethod
annotation_presence.py:130:13: ANN102 Missing type annotation for `cls` in classmethod
--> annotation_presence.py:130:13
|
128 | # ANN102
129 | @classmethod
130 | def foo(cls, a: int, b: int) -> int:
| ^^^ ANN102
| ^^^
131 | pass
|
error[ANN101]: 134:13: Missing type annotation for `self` in method
annotation_presence.py:134:13: ANN101 Missing type annotation for `self` in method
--> annotation_presence.py:134:13
|
133 | # ANN101
134 | def foo(self, /, a: int, b: int) -> int:
| ^^^^ ANN101
| ^^^^
135 | pass
|
error[ANN401]: 149:10: Dynamically typed expressions (typing.Any) are disallowed in `a`
annotation_presence.py:149:10: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `a`
--> annotation_presence.py:149:10
|
148 | # ANN401
149 | def f(a: Any | int) -> None: ...
| ^^^^^^^^^ ANN401
| ^^^^^^^^^
150 | def f(a: int | Any) -> None: ...
151 | def f(a: Union[str, bytes, Any]) -> None: ...
|
error[ANN401]: 150:10: Dynamically typed expressions (typing.Any) are disallowed in `a`
annotation_presence.py:150:10: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `a`
--> annotation_presence.py:150:10
|
148 | # ANN401
149 | def f(a: Any | int) -> None: ...
150 | def f(a: int | Any) -> None: ...
| ^^^^^^^^^ ANN401
| ^^^^^^^^^
151 | def f(a: Union[str, bytes, Any]) -> None: ...
152 | def f(a: Optional[Any]) -> None: ...
|
error[ANN401]: 151:10: Dynamically typed expressions (typing.Any) are disallowed in `a`
annotation_presence.py:151:10: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `a`
--> annotation_presence.py:151:10
|
149 | def f(a: Any | int) -> None: ...
150 | def f(a: int | Any) -> None: ...
151 | def f(a: Union[str, bytes, Any]) -> None: ...
| ^^^^^^^^^^^^^^^^^^^^^^ ANN401
| ^^^^^^^^^^^^^^^^^^^^^^
152 | def f(a: Optional[Any]) -> None: ...
153 | def f(a: Annotated[Any, ...]) -> None: ...
|
error[ANN401]: 152:10: Dynamically typed expressions (typing.Any) are disallowed in `a`
annotation_presence.py:152:10: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `a`
--> annotation_presence.py:152:10
|
150 | def f(a: int | Any) -> None: ...
151 | def f(a: Union[str, bytes, Any]) -> None: ...
152 | def f(a: Optional[Any]) -> None: ...
| ^^^^^^^^^^^^^ ANN401
| ^^^^^^^^^^^^^
153 | def f(a: Annotated[Any, ...]) -> None: ...
154 | def f(a: "Union[str, bytes, Any]") -> None: ...
|
error[ANN401]: 153:10: Dynamically typed expressions (typing.Any) are disallowed in `a`
annotation_presence.py:153:10: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `a`
--> annotation_presence.py:153:10
|
151 | def f(a: Union[str, bytes, Any]) -> None: ...
152 | def f(a: Optional[Any]) -> None: ...
153 | def f(a: Annotated[Any, ...]) -> None: ...
| ^^^^^^^^^^^^^^^^^^^ ANN401
| ^^^^^^^^^^^^^^^^^^^
154 | def f(a: "Union[str, bytes, Any]") -> None: ...
|
error[ANN401]: 154:10: Dynamically typed expressions (typing.Any) are disallowed in `a`
annotation_presence.py:154:10: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `a`
--> annotation_presence.py:154:10
|
152 | def f(a: Optional[Any]) -> None: ...
153 | def f(a: Annotated[Any, ...]) -> None: ...
154 | def f(a: "Union[str, bytes, Any]") -> None: ...
| ^^^^^^^^^^^^^^^^^^^^^^^^ ANN401
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
error[ANN204]: 159:9: [*] Missing return type annotation for special method `__init__`
annotation_presence.py:159:9: ANN204 [*] Missing return type annotation for special method `__init__`
--> annotation_presence.py:159:9
|
157 | class Foo:
158 | @decorator()
159 | def __init__(self: "Foo", foo: int):
| ^^^^^^^^ ANN204
| ^^^^^^^^
160 | ...
|
= help: Add return type annotation: `None`
Unsafe fix
156 156 |
157 157 | class Foo:
@@ -306,16 +336,17 @@ annotation_presence.py:159:9: ANN204 [*] Missing return type annotation for spec
161 161 |
162 162 |
annotation_presence.py:165:9: ANN204 [*] Missing return type annotation for special method `__init__`
error[ANN204]: 165:9: [*] Missing return type annotation for special method `__init__`
--> annotation_presence.py:165:9
|
163 | # Regression test for: https://github.com/astral-sh/ruff/issues/7711
164 | class Class:
165 | def __init__(self):
| ^^^^^^^^ ANN204
| ^^^^^^^^
166 | print(f"{self.attr=}")
|
= help: Add return type annotation: `None`
Unsafe fix
162 162 |
163 163 | # Regression test for: https://github.com/astral-sh/ruff/issues/7711
@@ -324,13 +355,13 @@ annotation_presence.py:165:9: ANN204 [*] Missing return type annotation for spec
165 |+ def __init__(self) -> None:
166 166 | print(f"{self.attr=}")
annotation_presence.py:165:18: ANN101 Missing type annotation for `self` in method
error[ANN101]: 165:18: Missing type annotation for `self` in method
--> annotation_presence.py:165:18
|
163 | # Regression test for: https://github.com/astral-sh/ruff/issues/7711
164 | class Class:
165 | def __init__(self):
| ^^^^ ANN101
| ^^^^
166 | print(f"{self.attr=}")
|

View File

@@ -1,14 +1,15 @@
---
source: crates/ruff_linter/src/rules/flake8_annotations/mod.rs
---
ignore_fully_untyped.py:24:5: ANN201 [*] Missing return type annotation for public function `error_partially_typed_1`
error[ANN201]: 24:5: [*] Missing return type annotation for public function `error_partially_typed_1`
--> ignore_fully_untyped.py:24:5
|
24 | def error_partially_typed_1(a: int, b):
| ^^^^^^^^^^^^^^^^^^^^^^^ ANN201
| ^^^^^^^^^^^^^^^^^^^^^^^
25 | pass
|
= help: Add return type annotation: `None`
Unsafe fix
21 21 | pass
22 22 |
@@ -19,28 +20,31 @@ ignore_fully_untyped.py:24:5: ANN201 [*] Missing return type annotation for publ
26 26 |
27 27 |
ignore_fully_untyped.py:24:37: ANN001 Missing type annotation for function argument `b`
error[ANN001]: 24:37: Missing type annotation for function argument `b`
--> ignore_fully_untyped.py:24:37
|
24 | def error_partially_typed_1(a: int, b):
| ^ ANN001
| ^
25 | pass
|
error[ANN001]: 28:37: Missing type annotation for function argument `b`
ignore_fully_untyped.py:28:37: ANN001 Missing type annotation for function argument `b`
--> ignore_fully_untyped.py:28:37
|
28 | def error_partially_typed_2(a: int, b) -> int:
| ^ ANN001
| ^
29 | pass
|
error[ANN201]: 32:5: [*] Missing return type annotation for public function `error_partially_typed_3`
ignore_fully_untyped.py:32:5: ANN201 [*] Missing return type annotation for public function `error_partially_typed_3`
--> ignore_fully_untyped.py:32:5
|
32 | def error_partially_typed_3(a: int, b: int):
| ^^^^^^^^^^^^^^^^^^^^^^^ ANN201
| ^^^^^^^^^^^^^^^^^^^^^^^
33 | pass
|
= help: Add return type annotation: `None`
Unsafe fix
29 29 | pass
30 30 |
@@ -51,16 +55,17 @@ ignore_fully_untyped.py:32:5: ANN201 [*] Missing return type annotation for publ
34 34 |
35 35 |
ignore_fully_untyped.py:43:9: ANN201 [*] Missing return type annotation for public function `error_typed_self`
error[ANN201]: 43:9: [*] Missing return type annotation for public function `error_typed_self`
--> ignore_fully_untyped.py:43:9
|
41 | pass
42 |
43 | def error_typed_self(self: X):
| ^^^^^^^^^^^^^^^^ ANN201
| ^^^^^^^^^^^^^^^^
44 | pass
|
= help: Add return type annotation: `None`
Unsafe fix
40 40 | def ok_untyped_method(self):
41 41 | pass
@@ -68,5 +73,3 @@ ignore_fully_untyped.py:43:9: ANN201 [*] Missing return type annotation for publ
43 |- def error_typed_self(self: X):
43 |+ def error_typed_self(self: X) -> None:
44 44 | pass

View File

@@ -1,16 +1,17 @@
---
source: crates/ruff_linter/src/rules/flake8_annotations/mod.rs
---
mypy_init_return.py:5:9: ANN204 [*] Missing return type annotation for special method `__init__`
error[ANN204]: 5:9: [*] Missing return type annotation for special method `__init__`
--> mypy_init_return.py:5:9
|
3 | # Error
4 | class Foo:
5 | def __init__(self):
| ^^^^^^^^ ANN204
| ^^^^^^^^
6 | ...
|
= help: Add return type annotation: `None`
Unsafe fix
2 2 |
3 3 | # Error
@@ -21,16 +22,17 @@ mypy_init_return.py:5:9: ANN204 [*] Missing return type annotation for special m
7 7 |
8 8 |
mypy_init_return.py:11:9: ANN204 [*] Missing return type annotation for special method `__init__`
error[ANN204]: 11:9: [*] Missing return type annotation for special method `__init__`
--> mypy_init_return.py:11:9
|
9 | # Error
10 | class Foo:
11 | def __init__(self, foo):
| ^^^^^^^^ ANN204
| ^^^^^^^^
12 | ...
|
= help: Add return type annotation: `None`
Unsafe fix
8 8 |
9 9 | # Error
@@ -41,15 +43,16 @@ mypy_init_return.py:11:9: ANN204 [*] Missing return type annotation for special
13 13 |
14 14 |
mypy_init_return.py:40:5: ANN202 [*] Missing return type annotation for private function `__init__`
error[ANN202]: 40:5: [*] Missing return type annotation for private function `__init__`
--> mypy_init_return.py:40:5
|
39 | # Error
40 | def __init__(self, foo: int):
| ^^^^^^^^ ANN202
| ^^^^^^^^
41 | ...
|
= help: Add return type annotation: `None`
Unsafe fix
37 37 |
38 38 |
@@ -60,16 +63,17 @@ mypy_init_return.py:40:5: ANN202 [*] Missing return type annotation for private
42 42 |
43 43 |
mypy_init_return.py:47:9: ANN204 [*] Missing return type annotation for special method `__init__`
error[ANN204]: 47:9: [*] Missing return type annotation for special method `__init__`
--> mypy_init_return.py:47:9
|
45 | # of a vararg falsely indicated that the function has a typed argument.
46 | class Foo:
47 | def __init__(self, *arg):
| ^^^^^^^^ ANN204
| ^^^^^^^^
48 | ...
|
= help: Add return type annotation: `None`
Unsafe fix
44 44 | # Error used to be ok for a moment since the mere presence
45 45 | # of a vararg falsely indicated that the function has a typed argument.
@@ -77,5 +81,3 @@ mypy_init_return.py:47:9: ANN204 [*] Missing return type annotation for special
47 |- def __init__(self, *arg):
47 |+ def __init__(self, *arg) -> None:
48 48 | ...

View File

@@ -1,15 +1,16 @@
---
source: crates/ruff_linter/src/rules/flake8_annotations/mod.rs
---
simple_magic_methods.py:2:9: ANN204 [*] Missing return type annotation for special method `__str__`
error[ANN204]: 2:9: [*] Missing return type annotation for special method `__str__`
--> simple_magic_methods.py:2:9
|
1 | class Foo:
2 | def __str__(self):
| ^^^^^^^ ANN204
| ^^^^^^^
3 | ...
|
= help: Add return type annotation: `str`
Unsafe fix
1 1 | class Foo:
2 |- def __str__(self):
@@ -18,16 +19,17 @@ simple_magic_methods.py:2:9: ANN204 [*] Missing return type annotation for speci
4 4 |
5 5 | def __repr__(self):
simple_magic_methods.py:5:9: ANN204 [*] Missing return type annotation for special method `__repr__`
error[ANN204]: 5:9: [*] Missing return type annotation for special method `__repr__`
--> simple_magic_methods.py:5:9
|
3 | ...
4 |
5 | def __repr__(self):
| ^^^^^^^^ ANN204
| ^^^^^^^^
6 | ...
|
= help: Add return type annotation: `str`
Unsafe fix
2 2 | def __str__(self):
3 3 | ...
@@ -38,16 +40,17 @@ simple_magic_methods.py:5:9: ANN204 [*] Missing return type annotation for speci
7 7 |
8 8 | def __len__(self):
simple_magic_methods.py:8:9: ANN204 [*] Missing return type annotation for special method `__len__`
error[ANN204]: 8:9: [*] Missing return type annotation for special method `__len__`
--> simple_magic_methods.py:8:9
|
6 | ...
7 |
8 | def __len__(self):
| ^^^^^^^ ANN204
| ^^^^^^^
9 | ...
|
= help: Add return type annotation: `int`
Unsafe fix
5 5 | def __repr__(self):
6 6 | ...
@@ -58,16 +61,17 @@ simple_magic_methods.py:8:9: ANN204 [*] Missing return type annotation for speci
10 10 |
11 11 | def __length_hint__(self):
simple_magic_methods.py:11:9: ANN204 [*] Missing return type annotation for special method `__length_hint__`
error[ANN204]: 11:9: [*] Missing return type annotation for special method `__length_hint__`
--> simple_magic_methods.py:11:9
|
9 | ...
10 |
11 | def __length_hint__(self):
| ^^^^^^^^^^^^^^^ ANN204
| ^^^^^^^^^^^^^^^
12 | ...
|
= help: Add return type annotation: `int`
Unsafe fix
8 8 | def __len__(self):
9 9 | ...
@@ -78,16 +82,17 @@ simple_magic_methods.py:11:9: ANN204 [*] Missing return type annotation for spec
13 13 |
14 14 | def __init__(self):
simple_magic_methods.py:14:9: ANN204 [*] Missing return type annotation for special method `__init__`
error[ANN204]: 14:9: [*] Missing return type annotation for special method `__init__`
--> simple_magic_methods.py:14:9
|
12 | ...
13 |
14 | def __init__(self):
| ^^^^^^^^ ANN204
| ^^^^^^^^
15 | ...
|
= help: Add return type annotation: `None`
Unsafe fix
11 11 | def __length_hint__(self):
12 12 | ...
@@ -98,16 +103,17 @@ simple_magic_methods.py:14:9: ANN204 [*] Missing return type annotation for spec
16 16 |
17 17 | def __del__(self):
simple_magic_methods.py:17:9: ANN204 [*] Missing return type annotation for special method `__del__`
error[ANN204]: 17:9: [*] Missing return type annotation for special method `__del__`
--> simple_magic_methods.py:17:9
|
15 | ...
16 |
17 | def __del__(self):
| ^^^^^^^ ANN204
| ^^^^^^^
18 | ...
|
= help: Add return type annotation: `None`
Unsafe fix
14 14 | def __init__(self):
15 15 | ...
@@ -118,16 +124,17 @@ simple_magic_methods.py:17:9: ANN204 [*] Missing return type annotation for spec
19 19 |
20 20 | def __bool__(self):
simple_magic_methods.py:20:9: ANN204 [*] Missing return type annotation for special method `__bool__`
error[ANN204]: 20:9: [*] Missing return type annotation for special method `__bool__`
--> simple_magic_methods.py:20:9
|
18 | ...
19 |
20 | def __bool__(self):
| ^^^^^^^^ ANN204
| ^^^^^^^^
21 | ...
|
= help: Add return type annotation: `bool`
Unsafe fix
17 17 | def __del__(self):
18 18 | ...
@@ -138,16 +145,17 @@ simple_magic_methods.py:20:9: ANN204 [*] Missing return type annotation for spec
22 22 |
23 23 | def __bytes__(self):
simple_magic_methods.py:23:9: ANN204 [*] Missing return type annotation for special method `__bytes__`
error[ANN204]: 23:9: [*] Missing return type annotation for special method `__bytes__`
--> simple_magic_methods.py:23:9
|
21 | ...
22 |
23 | def __bytes__(self):
| ^^^^^^^^^ ANN204
| ^^^^^^^^^
24 | ...
|
= help: Add return type annotation: `bytes`
Unsafe fix
20 20 | def __bool__(self):
21 21 | ...
@@ -158,16 +166,17 @@ simple_magic_methods.py:23:9: ANN204 [*] Missing return type annotation for spec
25 25 |
26 26 | def __format__(self, format_spec):
simple_magic_methods.py:26:9: ANN204 [*] Missing return type annotation for special method `__format__`
error[ANN204]: 26:9: [*] Missing return type annotation for special method `__format__`
--> simple_magic_methods.py:26:9
|
24 | ...
25 |
26 | def __format__(self, format_spec):
| ^^^^^^^^^^ ANN204
| ^^^^^^^^^^
27 | ...
|
= help: Add return type annotation: `str`
Unsafe fix
23 23 | def __bytes__(self):
24 24 | ...
@@ -178,16 +187,17 @@ simple_magic_methods.py:26:9: ANN204 [*] Missing return type annotation for spec
28 28 |
29 29 | def __contains__(self, item):
simple_magic_methods.py:29:9: ANN204 [*] Missing return type annotation for special method `__contains__`
error[ANN204]: 29:9: [*] Missing return type annotation for special method `__contains__`
--> simple_magic_methods.py:29:9
|
27 | ...
28 |
29 | def __contains__(self, item):
| ^^^^^^^^^^^^ ANN204
| ^^^^^^^^^^^^
30 | ...
|
= help: Add return type annotation: `bool`
Unsafe fix
26 26 | def __format__(self, format_spec):
27 27 | ...
@@ -198,16 +208,17 @@ simple_magic_methods.py:29:9: ANN204 [*] Missing return type annotation for spec
31 31 |
32 32 | def __complex__(self):
simple_magic_methods.py:32:9: ANN204 [*] Missing return type annotation for special method `__complex__`
error[ANN204]: 32:9: [*] Missing return type annotation for special method `__complex__`
--> simple_magic_methods.py:32:9
|
30 | ...
31 |
32 | def __complex__(self):
| ^^^^^^^^^^^ ANN204
| ^^^^^^^^^^^
33 | ...
|
= help: Add return type annotation: `complex`
Unsafe fix
29 29 | def __contains__(self, item):
30 30 | ...
@@ -218,16 +229,17 @@ simple_magic_methods.py:32:9: ANN204 [*] Missing return type annotation for spec
34 34 |
35 35 | def __int__(self):
simple_magic_methods.py:35:9: ANN204 [*] Missing return type annotation for special method `__int__`
error[ANN204]: 35:9: [*] Missing return type annotation for special method `__int__`
--> simple_magic_methods.py:35:9
|
33 | ...
34 |
35 | def __int__(self):
| ^^^^^^^ ANN204
| ^^^^^^^
36 | ...
|
= help: Add return type annotation: `int`
Unsafe fix
32 32 | def __complex__(self):
33 33 | ...
@@ -238,16 +250,17 @@ simple_magic_methods.py:35:9: ANN204 [*] Missing return type annotation for spec
37 37 |
38 38 | def __float__(self):
simple_magic_methods.py:38:9: ANN204 [*] Missing return type annotation for special method `__float__`
error[ANN204]: 38:9: [*] Missing return type annotation for special method `__float__`
--> simple_magic_methods.py:38:9
|
36 | ...
37 |
38 | def __float__(self):
| ^^^^^^^^^ ANN204
| ^^^^^^^^^
39 | ...
|
= help: Add return type annotation: `float`
Unsafe fix
35 35 | def __int__(self):
36 36 | ...
@@ -258,16 +271,17 @@ simple_magic_methods.py:38:9: ANN204 [*] Missing return type annotation for spec
40 40 |
41 41 | def __index__(self):
simple_magic_methods.py:41:9: ANN204 [*] Missing return type annotation for special method `__index__`
error[ANN204]: 41:9: [*] Missing return type annotation for special method `__index__`
--> simple_magic_methods.py:41:9
|
39 | ...
40 |
41 | def __index__(self):
| ^^^^^^^^^ ANN204
| ^^^^^^^^^
42 | ...
|
= help: Add return type annotation: `int`
Unsafe fix
38 38 | def __float__(self):
39 39 | ...
@@ -275,5 +289,3 @@ simple_magic_methods.py:41:9: ANN204 [*] Missing return type annotation for spec
41 |- def __index__(self):
41 |+ def __index__(self) -> int:
42 42 | ...

View File

@@ -1,15 +1,16 @@
---
source: crates/ruff_linter/src/rules/flake8_annotations/mod.rs
---
suppress_none_returning.py:45:5: ANN201 [*] Missing return type annotation for public function `foo`
error[ANN201]: 45:5: [*] Missing return type annotation for public function `foo`
--> suppress_none_returning.py:45:5
|
44 | # Error
45 | def foo():
| ^^^ ANN201
| ^^^
46 | return True
|
= help: Add return type annotation: `bool`
Unsafe fix
42 42 |
43 43 |
@@ -20,16 +21,17 @@ suppress_none_returning.py:45:5: ANN201 [*] Missing return type annotation for p
47 47 |
48 48 |
suppress_none_returning.py:50:5: ANN201 [*] Missing return type annotation for public function `foo`
error[ANN201]: 50:5: [*] Missing return type annotation for public function `foo`
--> suppress_none_returning.py:50:5
|
49 | # Error
50 | def foo():
| ^^^ ANN201
| ^^^
51 | a = 2 + 2
52 | if a == 4:
|
= help: Add return type annotation: `bool | None`
Unsafe fix
47 47 |
48 48 |
@@ -40,12 +42,12 @@ suppress_none_returning.py:50:5: ANN201 [*] Missing return type annotation for p
52 52 | if a == 4:
53 53 | return True
suppress_none_returning.py:59:9: ANN001 Missing type annotation for function argument `a`
error[ANN001]: 59:9: Missing type annotation for function argument `a`
--> suppress_none_returning.py:59:9
|
58 | # Error (on the argument, but not the return type)
59 | def foo(a):
| ^ ANN001
| ^
60 | a = 2 + 2
|

View File

@@ -1,101 +1,113 @@
---
source: crates/ruff_linter/src/rules/flake8_async/mod.rs
---
ASYNC100.py:8:5: ASYNC100 A `with trio.fail_after(...):` context does not contain any `await` statements. This makes it pointless, as the timeout can only be triggered by a checkpoint.
error[ASYNC100]: 8:5: A `with trio.fail_after(...):` context does not contain any `await` statements. This makes it pointless, as the timeout can only be triggered by a checkpoint.
--> ASYNC100.py:8:5
|
7 | async def func():
8 | with trio.fail_after():
| _____^
9 | | ...
| |___________^ ASYNC100
| |___________^
|
error[ASYNC100]: 18:5: A `with trio.move_on_after(...):` context does not contain any `await` statements. This makes it pointless, as the timeout can only be triggered by a checkpoint.
ASYNC100.py:18:5: ASYNC100 A `with trio.move_on_after(...):` context does not contain any `await` statements. This makes it pointless, as the timeout can only be triggered by a checkpoint.
--> ASYNC100.py:18:5
|
17 | async def func():
18 | with trio.move_on_after():
| _____^
19 | | ...
| |___________^ ASYNC100
| |___________^
|
error[ASYNC100]: 40:5: A `with anyio.move_on_after(...):` context does not contain any `await` statements. This makes it pointless, as the timeout can only be triggered by a checkpoint.
ASYNC100.py:40:5: ASYNC100 A `with anyio.move_on_after(...):` context does not contain any `await` statements. This makes it pointless, as the timeout can only be triggered by a checkpoint.
--> ASYNC100.py:40:5
|
39 | async def func():
40 | with anyio.move_on_after(delay=0.2):
| _____^
41 | | ...
| |___________^ ASYNC100
| |___________^
|
error[ASYNC100]: 45:5: A `with anyio.fail_after(...):` context does not contain any `await` statements. This makes it pointless, as the timeout can only be triggered by a checkpoint.
ASYNC100.py:45:5: ASYNC100 A `with anyio.fail_after(...):` context does not contain any `await` statements. This makes it pointless, as the timeout can only be triggered by a checkpoint.
--> ASYNC100.py:45:5
|
44 | async def func():
45 | with anyio.fail_after():
| _____^
46 | | ...
| |___________^ ASYNC100
| |___________^
|
error[ASYNC100]: 50:5: A `with anyio.CancelScope(...):` context does not contain any `await` statements. This makes it pointless, as the timeout can only be triggered by a checkpoint.
ASYNC100.py:50:5: ASYNC100 A `with anyio.CancelScope(...):` context does not contain any `await` statements. This makes it pointless, as the timeout can only be triggered by a checkpoint.
--> ASYNC100.py:50:5
|
49 | async def func():
50 | with anyio.CancelScope():
| _____^
51 | | ...
| |___________^ ASYNC100
| |___________^
|
error[ASYNC100]: 55:5: A `with anyio.CancelScope(...):` context does not contain any `await` statements. This makes it pointless, as the timeout can only be triggered by a checkpoint.
ASYNC100.py:55:5: ASYNC100 A `with anyio.CancelScope(...):` context does not contain any `await` statements. This makes it pointless, as the timeout can only be triggered by a checkpoint.
--> ASYNC100.py:55:5
|
54 | async def func():
55 | with anyio.CancelScope(), nullcontext():
| _____^
56 | | ...
| |___________^ ASYNC100
| |___________^
|
error[ASYNC100]: 60:5: A `with anyio.CancelScope(...):` context does not contain any `await` statements. This makes it pointless, as the timeout can only be triggered by a checkpoint.
ASYNC100.py:60:5: ASYNC100 A `with anyio.CancelScope(...):` context does not contain any `await` statements. This makes it pointless, as the timeout can only be triggered by a checkpoint.
--> ASYNC100.py:60:5
|
59 | async def func():
60 | with nullcontext(), anyio.CancelScope():
| _____^
61 | | ...
| |___________^ ASYNC100
| |___________^
|
error[ASYNC100]: 65:5: A `with asyncio.timeout(...):` context does not contain any `await` statements. This makes it pointless, as the timeout can only be triggered by a checkpoint.
ASYNC100.py:65:5: ASYNC100 A `with asyncio.timeout(...):` context does not contain any `await` statements. This makes it pointless, as the timeout can only be triggered by a checkpoint.
--> ASYNC100.py:65:5
|
64 | async def func():
65 | async with asyncio.timeout(delay=0.2):
| _____^
66 | | ...
| |___________^ ASYNC100
| |___________^
|
error[ASYNC100]: 70:5: A `with asyncio.timeout_at(...):` context does not contain any `await` statements. This makes it pointless, as the timeout can only be triggered by a checkpoint.
ASYNC100.py:70:5: ASYNC100 A `with asyncio.timeout_at(...):` context does not contain any `await` statements. This makes it pointless, as the timeout can only be triggered by a checkpoint.
--> ASYNC100.py:70:5
|
69 | async def func():
70 | async with asyncio.timeout_at(when=0.2):
| _____^
71 | | ...
| |___________^ ASYNC100
| |___________^
|
error[ASYNC100]: 80:5: A `with asyncio.timeout(...):` context does not contain any `await` statements. This makes it pointless, as the timeout can only be triggered by a checkpoint.
ASYNC100.py:80:5: ASYNC100 A `with asyncio.timeout(...):` context does not contain any `await` statements. This makes it pointless, as the timeout can only be triggered by a checkpoint.
--> ASYNC100.py:80:5
|
79 | async def func():
80 | async with asyncio.timeout(delay=0.2), asyncio.TaskGroup(), asyncio.timeout(delay=0.2):
| _____^
81 | | ...
| |___________^ ASYNC100
| |___________^
|
error[ASYNC100]: 90:5: A `with asyncio.timeout(...):` context does not contain any `await` statements. This makes it pointless, as the timeout can only be triggered by a checkpoint.
ASYNC100.py:90:5: ASYNC100 A `with asyncio.timeout(...):` context does not contain any `await` statements. This makes it pointless, as the timeout can only be triggered by a checkpoint.
--> ASYNC100.py:90:5
|
89 | async def func():
90 | async with asyncio.timeout(delay=0.2), asyncio.timeout(delay=0.2):
| _____^
91 | | ...
| |___________^ ASYNC100
| |___________^
|

View File

@@ -1,16 +1,17 @@
---
source: crates/ruff_linter/src/rules/flake8_async/mod.rs
---
ASYNC105.py:30:5: ASYNC105 [*] Call to `trio.aclose_forcefully` is not immediately awaited
error[ASYNC105]: 30:5: [*] Call to `trio.aclose_forcefully` is not immediately awaited
--> ASYNC105.py:30:5
|
29 | # ASYNC105
30 | trio.aclose_forcefully(foo)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ASYNC105
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
31 | trio.open_file(foo)
32 | trio.open_ssl_over_tcp_listeners(foo, foo)
|
= help: Add `await`
Unsafe fix
27 27 | await trio.lowlevel.wait_writable(foo)
28 28 |
@@ -21,17 +22,18 @@ ASYNC105.py:30:5: ASYNC105 [*] Call to `trio.aclose_forcefully` is not immediate
32 32 | trio.open_ssl_over_tcp_listeners(foo, foo)
33 33 | trio.open_ssl_over_tcp_stream(foo, foo)
ASYNC105.py:31:5: ASYNC105 [*] Call to `trio.open_file` is not immediately awaited
error[ASYNC105]: 31:5: [*] Call to `trio.open_file` is not immediately awaited
--> ASYNC105.py:31:5
|
29 | # ASYNC105
30 | trio.aclose_forcefully(foo)
31 | trio.open_file(foo)
| ^^^^^^^^^^^^^^^^^^^ ASYNC105
| ^^^^^^^^^^^^^^^^^^^
32 | trio.open_ssl_over_tcp_listeners(foo, foo)
33 | trio.open_ssl_over_tcp_stream(foo, foo)
|
= help: Add `await`
Unsafe fix
28 28 |
29 29 | # ASYNC105
@@ -42,17 +44,18 @@ ASYNC105.py:31:5: ASYNC105 [*] Call to `trio.open_file` is not immediately await
33 33 | trio.open_ssl_over_tcp_stream(foo, foo)
34 34 | trio.open_tcp_listeners(foo)
ASYNC105.py:32:5: ASYNC105 [*] Call to `trio.open_ssl_over_tcp_listeners` is not immediately awaited
error[ASYNC105]: 32:5: [*] Call to `trio.open_ssl_over_tcp_listeners` is not immediately awaited
--> ASYNC105.py:32:5
|
30 | trio.aclose_forcefully(foo)
31 | trio.open_file(foo)
32 | trio.open_ssl_over_tcp_listeners(foo, foo)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ASYNC105
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
33 | trio.open_ssl_over_tcp_stream(foo, foo)
34 | trio.open_tcp_listeners(foo)
|
= help: Add `await`
Unsafe fix
29 29 | # ASYNC105
30 30 | trio.aclose_forcefully(foo)
@@ -63,17 +66,18 @@ ASYNC105.py:32:5: ASYNC105 [*] Call to `trio.open_ssl_over_tcp_listeners` is not
34 34 | trio.open_tcp_listeners(foo)
35 35 | trio.open_tcp_stream(foo, foo)
ASYNC105.py:33:5: ASYNC105 [*] Call to `trio.open_ssl_over_tcp_stream` is not immediately awaited
error[ASYNC105]: 33:5: [*] Call to `trio.open_ssl_over_tcp_stream` is not immediately awaited
--> ASYNC105.py:33:5
|
31 | trio.open_file(foo)
32 | trio.open_ssl_over_tcp_listeners(foo, foo)
33 | trio.open_ssl_over_tcp_stream(foo, foo)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ASYNC105
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
34 | trio.open_tcp_listeners(foo)
35 | trio.open_tcp_stream(foo, foo)
|
= help: Add `await`
Unsafe fix
30 30 | trio.aclose_forcefully(foo)
31 31 | trio.open_file(foo)
@@ -84,17 +88,18 @@ ASYNC105.py:33:5: ASYNC105 [*] Call to `trio.open_ssl_over_tcp_stream` is not im
35 35 | trio.open_tcp_stream(foo, foo)
36 36 | trio.open_unix_socket(foo)
ASYNC105.py:34:5: ASYNC105 [*] Call to `trio.open_tcp_listeners` is not immediately awaited
error[ASYNC105]: 34:5: [*] Call to `trio.open_tcp_listeners` is not immediately awaited
--> ASYNC105.py:34:5
|
32 | trio.open_ssl_over_tcp_listeners(foo, foo)
33 | trio.open_ssl_over_tcp_stream(foo, foo)
34 | trio.open_tcp_listeners(foo)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ASYNC105
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
35 | trio.open_tcp_stream(foo, foo)
36 | trio.open_unix_socket(foo)
|
= help: Add `await`
Unsafe fix
31 31 | trio.open_file(foo)
32 32 | trio.open_ssl_over_tcp_listeners(foo, foo)
@@ -105,17 +110,18 @@ ASYNC105.py:34:5: ASYNC105 [*] Call to `trio.open_tcp_listeners` is not immediat
36 36 | trio.open_unix_socket(foo)
37 37 | trio.run_process(foo)
ASYNC105.py:35:5: ASYNC105 [*] Call to `trio.open_tcp_stream` is not immediately awaited
error[ASYNC105]: 35:5: [*] Call to `trio.open_tcp_stream` is not immediately awaited
--> ASYNC105.py:35:5
|
33 | trio.open_ssl_over_tcp_stream(foo, foo)
34 | trio.open_tcp_listeners(foo)
35 | trio.open_tcp_stream(foo, foo)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ASYNC105
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
36 | trio.open_unix_socket(foo)
37 | trio.run_process(foo)
|
= help: Add `await`
Unsafe fix
32 32 | trio.open_ssl_over_tcp_listeners(foo, foo)
33 33 | trio.open_ssl_over_tcp_stream(foo, foo)
@@ -126,17 +132,18 @@ ASYNC105.py:35:5: ASYNC105 [*] Call to `trio.open_tcp_stream` is not immediately
37 37 | trio.run_process(foo)
38 38 | trio.serve_listeners(foo, foo)
ASYNC105.py:36:5: ASYNC105 [*] Call to `trio.open_unix_socket` is not immediately awaited
error[ASYNC105]: 36:5: [*] Call to `trio.open_unix_socket` is not immediately awaited
--> ASYNC105.py:36:5
|
34 | trio.open_tcp_listeners(foo)
35 | trio.open_tcp_stream(foo, foo)
36 | trio.open_unix_socket(foo)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ ASYNC105
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
37 | trio.run_process(foo)
38 | trio.serve_listeners(foo, foo)
|
= help: Add `await`
Unsafe fix
33 33 | trio.open_ssl_over_tcp_stream(foo, foo)
34 34 | trio.open_tcp_listeners(foo)
@@ -147,17 +154,18 @@ ASYNC105.py:36:5: ASYNC105 [*] Call to `trio.open_unix_socket` is not immediatel
38 38 | trio.serve_listeners(foo, foo)
39 39 | trio.serve_ssl_over_tcp(foo, foo, foo)
ASYNC105.py:37:5: ASYNC105 [*] Call to `trio.run_process` is not immediately awaited
error[ASYNC105]: 37:5: [*] Call to `trio.run_process` is not immediately awaited
--> ASYNC105.py:37:5
|
35 | trio.open_tcp_stream(foo, foo)
36 | trio.open_unix_socket(foo)
37 | trio.run_process(foo)
| ^^^^^^^^^^^^^^^^^^^^^ ASYNC105
| ^^^^^^^^^^^^^^^^^^^^^
38 | trio.serve_listeners(foo, foo)
39 | trio.serve_ssl_over_tcp(foo, foo, foo)
|
= help: Add `await`
Unsafe fix
34 34 | trio.open_tcp_listeners(foo)
35 35 | trio.open_tcp_stream(foo, foo)
@@ -168,17 +176,18 @@ ASYNC105.py:37:5: ASYNC105 [*] Call to `trio.run_process` is not immediately awa
39 39 | trio.serve_ssl_over_tcp(foo, foo, foo)
40 40 | trio.serve_tcp(foo, foo)
ASYNC105.py:38:5: ASYNC105 [*] Call to `trio.serve_listeners` is not immediately awaited
error[ASYNC105]: 38:5: [*] Call to `trio.serve_listeners` is not immediately awaited
--> ASYNC105.py:38:5
|
36 | trio.open_unix_socket(foo)
37 | trio.run_process(foo)
38 | trio.serve_listeners(foo, foo)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ASYNC105
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
39 | trio.serve_ssl_over_tcp(foo, foo, foo)
40 | trio.serve_tcp(foo, foo)
|
= help: Add `await`
Unsafe fix
35 35 | trio.open_tcp_stream(foo, foo)
36 36 | trio.open_unix_socket(foo)
@@ -189,17 +198,18 @@ ASYNC105.py:38:5: ASYNC105 [*] Call to `trio.serve_listeners` is not immediately
40 40 | trio.serve_tcp(foo, foo)
41 41 | trio.sleep(foo)
ASYNC105.py:39:5: ASYNC105 [*] Call to `trio.serve_ssl_over_tcp` is not immediately awaited
error[ASYNC105]: 39:5: [*] Call to `trio.serve_ssl_over_tcp` is not immediately awaited
--> ASYNC105.py:39:5
|
37 | trio.run_process(foo)
38 | trio.serve_listeners(foo, foo)
39 | trio.serve_ssl_over_tcp(foo, foo, foo)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ASYNC105
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
40 | trio.serve_tcp(foo, foo)
41 | trio.sleep(foo)
|
= help: Add `await`
Unsafe fix
36 36 | trio.open_unix_socket(foo)
37 37 | trio.run_process(foo)
@@ -210,17 +220,18 @@ ASYNC105.py:39:5: ASYNC105 [*] Call to `trio.serve_ssl_over_tcp` is not immediat
41 41 | trio.sleep(foo)
42 42 | trio.sleep_forever()
ASYNC105.py:40:5: ASYNC105 [*] Call to `trio.serve_tcp` is not immediately awaited
error[ASYNC105]: 40:5: [*] Call to `trio.serve_tcp` is not immediately awaited
--> ASYNC105.py:40:5
|
38 | trio.serve_listeners(foo, foo)
39 | trio.serve_ssl_over_tcp(foo, foo, foo)
40 | trio.serve_tcp(foo, foo)
| ^^^^^^^^^^^^^^^^^^^^^^^^ ASYNC105
| ^^^^^^^^^^^^^^^^^^^^^^^^
41 | trio.sleep(foo)
42 | trio.sleep_forever()
|
= help: Add `await`
Unsafe fix
37 37 | trio.run_process(foo)
38 38 | trio.serve_listeners(foo, foo)
@@ -231,17 +242,18 @@ ASYNC105.py:40:5: ASYNC105 [*] Call to `trio.serve_tcp` is not immediately await
42 42 | trio.sleep_forever()
43 43 | trio.sleep_until(foo)
ASYNC105.py:41:5: ASYNC105 [*] Call to `trio.sleep` is not immediately awaited
error[ASYNC105]: 41:5: [*] Call to `trio.sleep` is not immediately awaited
--> ASYNC105.py:41:5
|
39 | trio.serve_ssl_over_tcp(foo, foo, foo)
40 | trio.serve_tcp(foo, foo)
41 | trio.sleep(foo)
| ^^^^^^^^^^^^^^^ ASYNC105
| ^^^^^^^^^^^^^^^
42 | trio.sleep_forever()
43 | trio.sleep_until(foo)
|
= help: Add `await`
Unsafe fix
38 38 | trio.serve_listeners(foo, foo)
39 39 | trio.serve_ssl_over_tcp(foo, foo, foo)
@@ -252,17 +264,18 @@ ASYNC105.py:41:5: ASYNC105 [*] Call to `trio.sleep` is not immediately awaited
43 43 | trio.sleep_until(foo)
44 44 | trio.lowlevel.cancel_shielded_checkpoint()
ASYNC105.py:42:5: ASYNC105 [*] Call to `trio.sleep_forever` is not immediately awaited
error[ASYNC105]: 42:5: [*] Call to `trio.sleep_forever` is not immediately awaited
--> ASYNC105.py:42:5
|
40 | trio.serve_tcp(foo, foo)
41 | trio.sleep(foo)
42 | trio.sleep_forever()
| ^^^^^^^^^^^^^^^^^^^^ ASYNC105
| ^^^^^^^^^^^^^^^^^^^^
43 | trio.sleep_until(foo)
44 | trio.lowlevel.cancel_shielded_checkpoint()
|
= help: Add `await`
Unsafe fix
39 39 | trio.serve_ssl_over_tcp(foo, foo, foo)
40 40 | trio.serve_tcp(foo, foo)
@@ -273,17 +286,18 @@ ASYNC105.py:42:5: ASYNC105 [*] Call to `trio.sleep_forever` is not immediately a
44 44 | trio.lowlevel.cancel_shielded_checkpoint()
45 45 | trio.lowlevel.checkpoint()
ASYNC105.py:44:5: ASYNC105 [*] Call to `trio.lowlevel.cancel_shielded_checkpoint` is not immediately awaited
error[ASYNC105]: 44:5: [*] Call to `trio.lowlevel.cancel_shielded_checkpoint` is not immediately awaited
--> ASYNC105.py:44:5
|
42 | trio.sleep_forever()
43 | trio.sleep_until(foo)
44 | trio.lowlevel.cancel_shielded_checkpoint()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ASYNC105
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
45 | trio.lowlevel.checkpoint()
46 | trio.lowlevel.checkpoint_if_cancelled()
|
= help: Add `await`
Unsafe fix
41 41 | trio.sleep(foo)
42 42 | trio.sleep_forever()
@@ -294,17 +308,18 @@ ASYNC105.py:44:5: ASYNC105 [*] Call to `trio.lowlevel.cancel_shielded_checkpoint
46 46 | trio.lowlevel.checkpoint_if_cancelled()
47 47 | trio.lowlevel.open_process()
ASYNC105.py:45:5: ASYNC105 [*] Call to `trio.lowlevel.checkpoint` is not immediately awaited
error[ASYNC105]: 45:5: [*] Call to `trio.lowlevel.checkpoint` is not immediately awaited
--> ASYNC105.py:45:5
|
43 | trio.sleep_until(foo)
44 | trio.lowlevel.cancel_shielded_checkpoint()
45 | trio.lowlevel.checkpoint()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ ASYNC105
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
46 | trio.lowlevel.checkpoint_if_cancelled()
47 | trio.lowlevel.open_process()
|
= help: Add `await`
Unsafe fix
42 42 | trio.sleep_forever()
43 43 | trio.sleep_until(foo)
@@ -315,17 +330,18 @@ ASYNC105.py:45:5: ASYNC105 [*] Call to `trio.lowlevel.checkpoint` is not immedia
47 47 | trio.lowlevel.open_process()
48 48 | trio.lowlevel.permanently_detach_coroutine_object(foo)
ASYNC105.py:46:5: ASYNC105 [*] Call to `trio.lowlevel.checkpoint_if_cancelled` is not immediately awaited
error[ASYNC105]: 46:5: [*] Call to `trio.lowlevel.checkpoint_if_cancelled` is not immediately awaited
--> ASYNC105.py:46:5
|
44 | trio.lowlevel.cancel_shielded_checkpoint()
45 | trio.lowlevel.checkpoint()
46 | trio.lowlevel.checkpoint_if_cancelled()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ASYNC105
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
47 | trio.lowlevel.open_process()
48 | trio.lowlevel.permanently_detach_coroutine_object(foo)
|
= help: Add `await`
Unsafe fix
43 43 | trio.sleep_until(foo)
44 44 | trio.lowlevel.cancel_shielded_checkpoint()
@@ -336,17 +352,18 @@ ASYNC105.py:46:5: ASYNC105 [*] Call to `trio.lowlevel.checkpoint_if_cancelled` i
48 48 | trio.lowlevel.permanently_detach_coroutine_object(foo)
49 49 | trio.lowlevel.reattach_detached_coroutine_object(foo, foo)
ASYNC105.py:47:5: ASYNC105 [*] Call to `trio.lowlevel.open_process` is not immediately awaited
error[ASYNC105]: 47:5: [*] Call to `trio.lowlevel.open_process` is not immediately awaited
--> ASYNC105.py:47:5
|
45 | trio.lowlevel.checkpoint()
46 | trio.lowlevel.checkpoint_if_cancelled()
47 | trio.lowlevel.open_process()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ASYNC105
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
48 | trio.lowlevel.permanently_detach_coroutine_object(foo)
49 | trio.lowlevel.reattach_detached_coroutine_object(foo, foo)
|
= help: Add `await`
Unsafe fix
44 44 | trio.lowlevel.cancel_shielded_checkpoint()
45 45 | trio.lowlevel.checkpoint()
@@ -357,17 +374,18 @@ ASYNC105.py:47:5: ASYNC105 [*] Call to `trio.lowlevel.open_process` is not immed
49 49 | trio.lowlevel.reattach_detached_coroutine_object(foo, foo)
50 50 | trio.lowlevel.temporarily_detach_coroutine_object(foo)
ASYNC105.py:48:5: ASYNC105 [*] Call to `trio.lowlevel.permanently_detach_coroutine_object` is not immediately awaited
error[ASYNC105]: 48:5: [*] Call to `trio.lowlevel.permanently_detach_coroutine_object` is not immediately awaited
--> ASYNC105.py:48:5
|
46 | trio.lowlevel.checkpoint_if_cancelled()
47 | trio.lowlevel.open_process()
48 | trio.lowlevel.permanently_detach_coroutine_object(foo)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ASYNC105
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
49 | trio.lowlevel.reattach_detached_coroutine_object(foo, foo)
50 | trio.lowlevel.temporarily_detach_coroutine_object(foo)
|
= help: Add `await`
Unsafe fix
45 45 | trio.lowlevel.checkpoint()
46 46 | trio.lowlevel.checkpoint_if_cancelled()
@@ -378,17 +396,18 @@ ASYNC105.py:48:5: ASYNC105 [*] Call to `trio.lowlevel.permanently_detach_corouti
50 50 | trio.lowlevel.temporarily_detach_coroutine_object(foo)
51 51 | trio.lowlevel.wait_readable(foo)
ASYNC105.py:49:5: ASYNC105 [*] Call to `trio.lowlevel.reattach_detached_coroutine_object` is not immediately awaited
error[ASYNC105]: 49:5: [*] Call to `trio.lowlevel.reattach_detached_coroutine_object` is not immediately awaited
--> ASYNC105.py:49:5
|
47 | trio.lowlevel.open_process()
48 | trio.lowlevel.permanently_detach_coroutine_object(foo)
49 | trio.lowlevel.reattach_detached_coroutine_object(foo, foo)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ASYNC105
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
50 | trio.lowlevel.temporarily_detach_coroutine_object(foo)
51 | trio.lowlevel.wait_readable(foo)
|
= help: Add `await`
Unsafe fix
46 46 | trio.lowlevel.checkpoint_if_cancelled()
47 47 | trio.lowlevel.open_process()
@@ -399,17 +418,18 @@ ASYNC105.py:49:5: ASYNC105 [*] Call to `trio.lowlevel.reattach_detached_coroutin
51 51 | trio.lowlevel.wait_readable(foo)
52 52 | trio.lowlevel.wait_task_rescheduled(foo)
ASYNC105.py:50:5: ASYNC105 [*] Call to `trio.lowlevel.temporarily_detach_coroutine_object` is not immediately awaited
error[ASYNC105]: 50:5: [*] Call to `trio.lowlevel.temporarily_detach_coroutine_object` is not immediately awaited
--> ASYNC105.py:50:5
|
48 | trio.lowlevel.permanently_detach_coroutine_object(foo)
49 | trio.lowlevel.reattach_detached_coroutine_object(foo, foo)
50 | trio.lowlevel.temporarily_detach_coroutine_object(foo)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ASYNC105
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
51 | trio.lowlevel.wait_readable(foo)
52 | trio.lowlevel.wait_task_rescheduled(foo)
|
= help: Add `await`
Unsafe fix
47 47 | trio.lowlevel.open_process()
48 48 | trio.lowlevel.permanently_detach_coroutine_object(foo)
@@ -420,17 +440,18 @@ ASYNC105.py:50:5: ASYNC105 [*] Call to `trio.lowlevel.temporarily_detach_corouti
52 52 | trio.lowlevel.wait_task_rescheduled(foo)
53 53 | trio.lowlevel.wait_writable(foo)
ASYNC105.py:51:5: ASYNC105 [*] Call to `trio.lowlevel.wait_readable` is not immediately awaited
error[ASYNC105]: 51:5: [*] Call to `trio.lowlevel.wait_readable` is not immediately awaited
--> ASYNC105.py:51:5
|
49 | trio.lowlevel.reattach_detached_coroutine_object(foo, foo)
50 | trio.lowlevel.temporarily_detach_coroutine_object(foo)
51 | trio.lowlevel.wait_readable(foo)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ASYNC105
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
52 | trio.lowlevel.wait_task_rescheduled(foo)
53 | trio.lowlevel.wait_writable(foo)
|
= help: Add `await`
Unsafe fix
48 48 | trio.lowlevel.permanently_detach_coroutine_object(foo)
49 49 | trio.lowlevel.reattach_detached_coroutine_object(foo, foo)
@@ -441,16 +462,17 @@ ASYNC105.py:51:5: ASYNC105 [*] Call to `trio.lowlevel.wait_readable` is not imme
53 53 | trio.lowlevel.wait_writable(foo)
54 54 |
ASYNC105.py:52:5: ASYNC105 [*] Call to `trio.lowlevel.wait_task_rescheduled` is not immediately awaited
error[ASYNC105]: 52:5: [*] Call to `trio.lowlevel.wait_task_rescheduled` is not immediately awaited
--> ASYNC105.py:52:5
|
50 | trio.lowlevel.temporarily_detach_coroutine_object(foo)
51 | trio.lowlevel.wait_readable(foo)
52 | trio.lowlevel.wait_task_rescheduled(foo)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ASYNC105
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
53 | trio.lowlevel.wait_writable(foo)
|
= help: Add `await`
Unsafe fix
49 49 | trio.lowlevel.reattach_detached_coroutine_object(foo, foo)
50 50 | trio.lowlevel.temporarily_detach_coroutine_object(foo)
@@ -461,17 +483,18 @@ ASYNC105.py:52:5: ASYNC105 [*] Call to `trio.lowlevel.wait_task_rescheduled` is
54 54 |
55 55 | async with await trio.open_file(foo): # Ok
ASYNC105.py:53:5: ASYNC105 [*] Call to `trio.lowlevel.wait_writable` is not immediately awaited
error[ASYNC105]: 53:5: [*] Call to `trio.lowlevel.wait_writable` is not immediately awaited
--> ASYNC105.py:53:5
|
51 | trio.lowlevel.wait_readable(foo)
52 | trio.lowlevel.wait_task_rescheduled(foo)
53 | trio.lowlevel.wait_writable(foo)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ASYNC105
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
54 |
55 | async with await trio.open_file(foo): # Ok
|
= help: Add `await`
Unsafe fix
50 50 | trio.lowlevel.temporarily_detach_coroutine_object(foo)
51 51 | trio.lowlevel.wait_readable(foo)
@@ -482,16 +505,17 @@ ASYNC105.py:53:5: ASYNC105 [*] Call to `trio.lowlevel.wait_writable` is not imme
55 55 | async with await trio.open_file(foo): # Ok
56 56 | pass
ASYNC105.py:58:16: ASYNC105 [*] Call to `trio.open_file` is not immediately awaited
error[ASYNC105]: 58:16: [*] Call to `trio.open_file` is not immediately awaited
--> ASYNC105.py:58:16
|
56 | pass
57 |
58 | async with trio.open_file(foo): # ASYNC105
| ^^^^^^^^^^^^^^^^^^^ ASYNC105
| ^^^^^^^^^^^^^^^^^^^
59 | pass
|
= help: Add `await`
Unsafe fix
55 55 | async with await trio.open_file(foo): # Ok
56 56 | pass
@@ -502,11 +526,13 @@ ASYNC105.py:58:16: ASYNC105 [*] Call to `trio.open_file` is not immediately awai
60 60 |
61 61 |
ASYNC105.py:64:5: ASYNC105 Call to `trio.open_file` is not immediately awaited
error[ASYNC105]: 64:5: Call to `trio.open_file` is not immediately awaited
--> ASYNC105.py:64:5
|
62 | def func() -> None:
63 | # ASYNC105 (without fix)
64 | trio.open_file(foo)
| ^^^^^^^^^^^^^^^^^^^ ASYNC105
| ^^^^^^^^^^^^^^^^^^^
|
= help: Add `await`

View File

@@ -1,18 +1,21 @@
---
source: crates/ruff_linter/src/rules/flake8_async/mod.rs
---
ASYNC109_0.py:8:16: ASYNC109 Async function definition with a `timeout` parameter
error[ASYNC109]: 8:16: Async function definition with a `timeout` parameter
--> ASYNC109_0.py:8:16
|
8 | async def func(timeout):
| ^^^^^^^ ASYNC109
| ^^^^^^^
9 | ...
|
= help: Use `trio.fail_after` instead
error[ASYNC109]: 12:16: Async function definition with a `timeout` parameter
ASYNC109_0.py:12:16: ASYNC109 Async function definition with a `timeout` parameter
--> ASYNC109_0.py:12:16
|
12 | async def func(timeout=10):
| ^^^^^^^^^^ ASYNC109
| ^^^^^^^^^^
13 | ...
|
= help: Use `trio.fail_after` instead

View File

@@ -1,18 +1,21 @@
---
source: crates/ruff_linter/src/rules/flake8_async/mod.rs
---
ASYNC109_1.py:5:16: ASYNC109 Async function definition with a `timeout` parameter
error[ASYNC109]: 5:16: Async function definition with a `timeout` parameter
--> ASYNC109_1.py:5:16
|
5 | async def func(timeout):
| ^^^^^^^ ASYNC109
| ^^^^^^^
6 | ...
|
= help: Use `asyncio.timeout` instead
error[ASYNC109]: 9:16: Async function definition with a `timeout` parameter
ASYNC109_1.py:9:16: ASYNC109 Async function definition with a `timeout` parameter
--> ASYNC109_1.py:9:16
|
9 | async def func(timeout=10):
| ^^^^^^^^^^ ASYNC109
| ^^^^^^^^^^
10 | ...
|
= help: Use `asyncio.timeout` instead

View File

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

View File

@@ -1,17 +1,18 @@
---
source: crates/ruff_linter/src/rules/flake8_async/mod.rs
---
ASYNC115.py:5:11: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio.sleep(0)`
error[ASYNC115]: 5:11: [*] Use `trio.lowlevel.checkpoint()` instead of `trio.sleep(0)`
--> ASYNC115.py:5:11
|
3 | from trio import sleep
4 |
5 | await trio.sleep(0) # ASYNC115
| ^^^^^^^^^^^^^ ASYNC115
| ^^^^^^^^^^^^^
6 | await trio.sleep(1) # OK
7 | await trio.sleep(0, 1) # OK
|
= help: Replace with `trio.lowlevel.checkpoint()`
Safe fix
2 2 | import trio
3 3 | from trio import sleep
@@ -22,17 +23,18 @@ ASYNC115.py:5:11: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio
7 7 | await trio.sleep(0, 1) # OK
8 8 | await trio.sleep(...) # OK
ASYNC115.py:11:5: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio.sleep(0)`
error[ASYNC115]: 11:5: [*] Use `trio.lowlevel.checkpoint()` instead of `trio.sleep(0)`
--> ASYNC115.py:11:5
|
9 | await trio.sleep() # OK
10 |
11 | trio.sleep(0) # ASYNC115
| ^^^^^^^^^^^^^ ASYNC115
| ^^^^^^^^^^^^^
12 | foo = 0
13 | trio.sleep(foo) # OK
|
= help: Replace with `trio.lowlevel.checkpoint()`
Safe fix
8 8 | await trio.sleep(...) # OK
9 9 | await trio.sleep() # OK
@@ -43,17 +45,18 @@ ASYNC115.py:11:5: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio
13 13 | trio.sleep(foo) # OK
14 14 | trio.sleep(1) # OK
ASYNC115.py:17:5: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio.sleep(0)`
error[ASYNC115]: 17:5: [*] Use `trio.lowlevel.checkpoint()` instead of `trio.sleep(0)`
--> ASYNC115.py:17:5
|
15 | time.sleep(0) # OK
16 |
17 | sleep(0) # ASYNC115
| ^^^^^^^^ ASYNC115
| ^^^^^^^^
18 |
19 | bar = "bar"
|
= help: Replace with `trio.lowlevel.checkpoint()`
Safe fix
14 14 | trio.sleep(1) # OK
15 15 | time.sleep(0) # OK
@@ -64,15 +67,16 @@ ASYNC115.py:17:5: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio
19 19 | bar = "bar"
20 20 | trio.sleep(bar)
ASYNC115.py:48:14: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio.sleep(0)`
error[ASYNC115]: 48:14: [*] Use `trio.lowlevel.checkpoint()` instead of `trio.sleep(0)`
--> ASYNC115.py:48:14
|
46 | import trio
47 |
48 | trio.run(trio.sleep(0)) # ASYNC115
| ^^^^^^^^^^^^^ ASYNC115
| ^^^^^^^^^^^^^
|
= help: Replace with `trio.lowlevel.checkpoint()`
Safe fix
45 45 | def func():
46 46 | import trio
@@ -83,14 +87,15 @@ ASYNC115.py:48:14: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `tri
50 50 |
51 51 | from trio import Event, sleep
ASYNC115.py:55:5: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio.sleep(0)`
error[ASYNC115]: 55:5: [*] Use `trio.lowlevel.checkpoint()` instead of `trio.sleep(0)`
--> ASYNC115.py:55:5
|
54 | def func():
55 | sleep(0) # ASYNC115
| ^^^^^^^^ ASYNC115
| ^^^^^^^^
|
= help: Replace with `trio.lowlevel.checkpoint()`
Safe fix
48 48 | trio.run(trio.sleep(0)) # ASYNC115
49 49 |
@@ -106,14 +111,15 @@ ASYNC115.py:55:5: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio
57 57 |
58 58 | async def func():
ASYNC115.py:59:11: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio.sleep(0)`
error[ASYNC115]: 59:11: [*] Use `trio.lowlevel.checkpoint()` instead of `trio.sleep(0)`
--> ASYNC115.py:59:11
|
58 | async def func():
59 | await sleep(seconds=0) # ASYNC115
| ^^^^^^^^^^^^^^^^ ASYNC115
| ^^^^^^^^^^^^^^^^
|
= help: Replace with `trio.lowlevel.checkpoint()`
Safe fix
48 48 | trio.run(trio.sleep(0)) # ASYNC115
49 49 |
@@ -133,17 +139,18 @@ ASYNC115.py:59:11: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `tri
61 61 |
62 62 | def func():
ASYNC115.py:85:11: ASYNC115 [*] Use `asyncio.lowlevel.checkpoint()` instead of `asyncio.sleep(0)`
error[ASYNC115]: 85:11: [*] Use `asyncio.lowlevel.checkpoint()` instead of `asyncio.sleep(0)`
--> ASYNC115.py:85:11
|
83 | from anyio import sleep
84 |
85 | await anyio.sleep(0) # ASYNC115
| ^^^^^^^^^^^^^^ ASYNC115
| ^^^^^^^^^^^^^^
86 | await anyio.sleep(1) # OK
87 | await anyio.sleep(0, 1) # OK
|
= help: Replace with `asyncio.lowlevel.checkpoint()`
Safe fix
49 49 |
50 50 |
@@ -162,17 +169,18 @@ ASYNC115.py:85:11: ASYNC115 [*] Use `asyncio.lowlevel.checkpoint()` instead of `
87 88 | await anyio.sleep(0, 1) # OK
88 89 | await anyio.sleep(...) # OK
ASYNC115.py:91:5: ASYNC115 [*] Use `asyncio.lowlevel.checkpoint()` instead of `asyncio.sleep(0)`
error[ASYNC115]: 91:5: [*] Use `asyncio.lowlevel.checkpoint()` instead of `asyncio.sleep(0)`
--> ASYNC115.py:91:5
|
89 | await anyio.sleep() # OK
90 |
91 | anyio.sleep(0) # ASYNC115
| ^^^^^^^^^^^^^^ ASYNC115
| ^^^^^^^^^^^^^^
92 | foo = 0
93 | anyio.sleep(foo) # OK
|
= help: Replace with `asyncio.lowlevel.checkpoint()`
Safe fix
49 49 |
50 50 |
@@ -191,17 +199,18 @@ ASYNC115.py:91:5: ASYNC115 [*] Use `asyncio.lowlevel.checkpoint()` instead of `a
93 94 | anyio.sleep(foo) # OK
94 95 | anyio.sleep(1) # OK
ASYNC115.py:97:5: ASYNC115 [*] Use `asyncio.lowlevel.checkpoint()` instead of `asyncio.sleep(0)`
error[ASYNC115]: 97:5: [*] Use `asyncio.lowlevel.checkpoint()` instead of `asyncio.sleep(0)`
--> ASYNC115.py:97:5
|
95 | time.sleep(0) # OK
96 |
97 | sleep(0) # ASYNC115
| ^^^^^^^^ ASYNC115
| ^^^^^^^^
98 |
99 | bar = "bar"
|
= help: Replace with `asyncio.lowlevel.checkpoint()`
Safe fix
49 49 |
50 50 |
@@ -220,15 +229,16 @@ ASYNC115.py:97:5: ASYNC115 [*] Use `asyncio.lowlevel.checkpoint()` instead of `a
99 100 | bar = "bar"
100 101 | anyio.sleep(bar)
ASYNC115.py:128:15: ASYNC115 [*] Use `asyncio.lowlevel.checkpoint()` instead of `asyncio.sleep(0)`
error[ASYNC115]: 128:15: [*] Use `asyncio.lowlevel.checkpoint()` instead of `asyncio.sleep(0)`
--> ASYNC115.py:128:15
|
126 | import anyio
127 |
128 | anyio.run(anyio.sleep(0)) # ASYNC115
| ^^^^^^^^^^^^^^ ASYNC115
| ^^^^^^^^^^^^^^
|
= help: Replace with `asyncio.lowlevel.checkpoint()`
Safe fix
49 49 |
50 50 |

View File

@@ -1,16 +1,17 @@
---
source: crates/ruff_linter/src/rules/flake8_async/mod.rs
---
ASYNC116.py:11:11: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep_forever()`
error[ASYNC116]: 11:11: [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep_forever()`
--> ASYNC116.py:11:11
|
10 | # These examples are probably not meant to ever wake up:
11 | await trio.sleep(100000) # error: 116, "async"
| ^^^^^^^^^^^^^^^^^^ ASYNC116
| ^^^^^^^^^^^^^^^^^^
12 |
13 | # 'inf literal' overflow trick
|
= help: Replace with `trio.sleep_forever()`
Unsafe fix
8 8 | import trio
9 9 |
@@ -21,16 +22,17 @@ ASYNC116.py:11:11: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usu
13 13 | # 'inf literal' overflow trick
14 14 | await trio.sleep(1e999) # error: 116, "async"
ASYNC116.py:14:11: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep_forever()`
error[ASYNC116]: 14:11: [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep_forever()`
--> ASYNC116.py:14:11
|
13 | # 'inf literal' overflow trick
14 | await trio.sleep(1e999) # error: 116, "async"
| ^^^^^^^^^^^^^^^^^ ASYNC116
| ^^^^^^^^^^^^^^^^^
15 |
16 | await trio.sleep(86399)
|
= help: Replace with `trio.sleep_forever()`
Unsafe fix
11 11 | await trio.sleep(100000) # error: 116, "async"
12 12 |
@@ -41,16 +43,17 @@ ASYNC116.py:14:11: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usu
16 16 | await trio.sleep(86399)
17 17 | await trio.sleep(86400)
ASYNC116.py:18:11: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep_forever()`
error[ASYNC116]: 18:11: [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep_forever()`
--> ASYNC116.py:18:11
|
16 | await trio.sleep(86399)
17 | await trio.sleep(86400)
18 | await trio.sleep(86400.01) # error: 116, "async"
| ^^^^^^^^^^^^^^^^^^^^ ASYNC116
| ^^^^^^^^^^^^^^^^^^^^
19 | await trio.sleep(86401) # error: 116, "async"
|
= help: Replace with `trio.sleep_forever()`
Unsafe fix
15 15 |
16 16 | await trio.sleep(86399)
@@ -61,17 +64,18 @@ ASYNC116.py:18:11: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usu
20 20 |
21 21 | await trio.sleep(-1) # will raise a runtime error
ASYNC116.py:19:11: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep_forever()`
error[ASYNC116]: 19:11: [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep_forever()`
--> ASYNC116.py:19:11
|
17 | await trio.sleep(86400)
18 | await trio.sleep(86400.01) # error: 116, "async"
19 | await trio.sleep(86401) # error: 116, "async"
| ^^^^^^^^^^^^^^^^^ ASYNC116
| ^^^^^^^^^^^^^^^^^
20 |
21 | await trio.sleep(-1) # will raise a runtime error
|
= help: Replace with `trio.sleep_forever()`
Unsafe fix
16 16 | await trio.sleep(86399)
17 17 | await trio.sleep(86400)
@@ -82,16 +86,17 @@ ASYNC116.py:19:11: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usu
21 21 | await trio.sleep(-1) # will raise a runtime error
22 22 | await trio.sleep(0) # handled by different check
ASYNC116.py:48:5: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep_forever()`
error[ASYNC116]: 48:5: [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep_forever()`
--> ASYNC116.py:48:5
|
47 | # does not require the call to be awaited, nor in an async fun
48 | trio.sleep(86401) # error: 116, "async"
| ^^^^^^^^^^^^^^^^^ ASYNC116
| ^^^^^^^^^^^^^^^^^
49 | # also checks that we don't break visit_Call
50 | trio.run(trio.sleep(86401)) # error: 116, "async"
|
= help: Replace with `trio.sleep_forever()`
Unsafe fix
45 45 | import trio
46 46 |
@@ -102,15 +107,16 @@ ASYNC116.py:48:5: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usua
50 50 | trio.run(trio.sleep(86401)) # error: 116, "async"
51 51 |
ASYNC116.py:50:14: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep_forever()`
error[ASYNC116]: 50:14: [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep_forever()`
--> ASYNC116.py:50:14
|
48 | trio.sleep(86401) # error: 116, "async"
49 | # also checks that we don't break visit_Call
50 | trio.run(trio.sleep(86401)) # error: 116, "async"
| ^^^^^^^^^^^^^^^^^ ASYNC116
| ^^^^^^^^^^^^^^^^^
|
= help: Replace with `trio.sleep_forever()`
Unsafe fix
47 47 | # does not require the call to be awaited, nor in an async fun
48 48 | trio.sleep(86401) # error: 116, "async"
@@ -121,14 +127,15 @@ ASYNC116.py:50:14: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usu
52 52 |
53 53 | async def import_from_trio():
ASYNC116.py:57:11: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep_forever()`
error[ASYNC116]: 57:11: [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep_forever()`
--> ASYNC116.py:57:11
|
56 | # catch from import
57 | await sleep(86401) # error: 116, "async"
| ^^^^^^^^^^^^ ASYNC116
| ^^^^^^^^^^^^
|
= help: Replace with `trio.sleep_forever()`
Unsafe fix
2 2 | # ASYNCIO_NO_ERROR - no asyncio.sleep_forever, so check intentionally doesn't trigger.
3 3 | import math
@@ -147,16 +154,17 @@ ASYNC116.py:57:11: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usu
59 60 |
60 61 | async def import_anyio():
ASYNC116.py:64:11: ASYNC116 [*] `asyncio.sleep()` with >24 hour interval should usually be `asyncio.sleep_forever()`
error[ASYNC116]: 64:11: [*] `asyncio.sleep()` with >24 hour interval should usually be `asyncio.sleep_forever()`
--> ASYNC116.py:64:11
|
63 | # These examples are probably not meant to ever wake up:
64 | await anyio.sleep(100000) # error: 116, "async"
| ^^^^^^^^^^^^^^^^^^^ ASYNC116
| ^^^^^^^^^^^^^^^^^^^
65 |
66 | # 'inf literal' overflow trick
|
= help: Replace with `asyncio.sleep_forever()`
Unsafe fix
2 2 | # ASYNCIO_NO_ERROR - no asyncio.sleep_forever, so check intentionally doesn't trigger.
3 3 | import math
@@ -175,16 +183,17 @@ ASYNC116.py:64:11: ASYNC116 [*] `asyncio.sleep()` with >24 hour interval should
66 67 | # 'inf literal' overflow trick
67 68 | await anyio.sleep(1e999) # error: 116, "async"
ASYNC116.py:67:11: ASYNC116 [*] `asyncio.sleep()` with >24 hour interval should usually be `asyncio.sleep_forever()`
error[ASYNC116]: 67:11: [*] `asyncio.sleep()` with >24 hour interval should usually be `asyncio.sleep_forever()`
--> ASYNC116.py:67:11
|
66 | # 'inf literal' overflow trick
67 | await anyio.sleep(1e999) # error: 116, "async"
| ^^^^^^^^^^^^^^^^^^ ASYNC116
| ^^^^^^^^^^^^^^^^^^
68 |
69 | await anyio.sleep(86399)
|
= help: Replace with `asyncio.sleep_forever()`
Unsafe fix
2 2 | # ASYNCIO_NO_ERROR - no asyncio.sleep_forever, so check intentionally doesn't trigger.
3 3 | import math
@@ -203,16 +212,17 @@ ASYNC116.py:67:11: ASYNC116 [*] `asyncio.sleep()` with >24 hour interval should
69 70 | await anyio.sleep(86399)
70 71 | await anyio.sleep(86400)
ASYNC116.py:71:11: ASYNC116 [*] `asyncio.sleep()` with >24 hour interval should usually be `asyncio.sleep_forever()`
error[ASYNC116]: 71:11: [*] `asyncio.sleep()` with >24 hour interval should usually be `asyncio.sleep_forever()`
--> ASYNC116.py:71:11
|
69 | await anyio.sleep(86399)
70 | await anyio.sleep(86400)
71 | await anyio.sleep(86400.01) # error: 116, "async"
| ^^^^^^^^^^^^^^^^^^^^^ ASYNC116
| ^^^^^^^^^^^^^^^^^^^^^
72 | await anyio.sleep(86401) # error: 116, "async"
|
= help: Replace with `asyncio.sleep_forever()`
Unsafe fix
2 2 | # ASYNCIO_NO_ERROR - no asyncio.sleep_forever, so check intentionally doesn't trigger.
3 3 | import math
@@ -231,17 +241,18 @@ ASYNC116.py:71:11: ASYNC116 [*] `asyncio.sleep()` with >24 hour interval should
73 74 |
74 75 | await anyio.sleep(-1) # will raise a runtime error
ASYNC116.py:72:11: ASYNC116 [*] `asyncio.sleep()` with >24 hour interval should usually be `asyncio.sleep_forever()`
error[ASYNC116]: 72:11: [*] `asyncio.sleep()` with >24 hour interval should usually be `asyncio.sleep_forever()`
--> ASYNC116.py:72:11
|
70 | await anyio.sleep(86400)
71 | await anyio.sleep(86400.01) # error: 116, "async"
72 | await anyio.sleep(86401) # error: 116, "async"
| ^^^^^^^^^^^^^^^^^^ ASYNC116
| ^^^^^^^^^^^^^^^^^^
73 |
74 | await anyio.sleep(-1) # will raise a runtime error
|
= help: Replace with `asyncio.sleep_forever()`
Unsafe fix
2 2 | # ASYNCIO_NO_ERROR - no asyncio.sleep_forever, so check intentionally doesn't trigger.
3 3 | import math
@@ -260,16 +271,17 @@ ASYNC116.py:72:11: ASYNC116 [*] `asyncio.sleep()` with >24 hour interval should
74 75 | await anyio.sleep(-1) # will raise a runtime error
75 76 | await anyio.sleep(0) # handled by different check
ASYNC116.py:101:5: ASYNC116 [*] `asyncio.sleep()` with >24 hour interval should usually be `asyncio.sleep_forever()`
error[ASYNC116]: 101:5: [*] `asyncio.sleep()` with >24 hour interval should usually be `asyncio.sleep_forever()`
--> ASYNC116.py:101:5
|
100 | # does not require the call to be awaited, nor in an async fun
101 | anyio.sleep(86401) # error: 116, "async"
| ^^^^^^^^^^^^^^^^^^ ASYNC116
| ^^^^^^^^^^^^^^^^^^
102 | # also checks that we don't break visit_Call
103 | anyio.run(anyio.sleep(86401)) # error: 116, "async"
|
= help: Replace with `asyncio.sleep_forever()`
Unsafe fix
2 2 | # ASYNCIO_NO_ERROR - no asyncio.sleep_forever, so check intentionally doesn't trigger.
3 3 | import math
@@ -288,15 +300,16 @@ ASYNC116.py:101:5: ASYNC116 [*] `asyncio.sleep()` with >24 hour interval should
103 104 | anyio.run(anyio.sleep(86401)) # error: 116, "async"
104 105 |
ASYNC116.py:103:15: ASYNC116 [*] `asyncio.sleep()` with >24 hour interval should usually be `asyncio.sleep_forever()`
error[ASYNC116]: 103:15: [*] `asyncio.sleep()` with >24 hour interval should usually be `asyncio.sleep_forever()`
--> ASYNC116.py:103:15
|
101 | anyio.sleep(86401) # error: 116, "async"
102 | # also checks that we don't break visit_Call
103 | anyio.run(anyio.sleep(86401)) # error: 116, "async"
| ^^^^^^^^^^^^^^^^^^ ASYNC116
| ^^^^^^^^^^^^^^^^^^
|
= help: Replace with `asyncio.sleep_forever()`
Unsafe fix
2 2 | # ASYNCIO_NO_ERROR - no asyncio.sleep_forever, so check intentionally doesn't trigger.
3 3 | import math
@@ -315,14 +328,15 @@ ASYNC116.py:103:15: ASYNC116 [*] `asyncio.sleep()` with >24 hour interval should
105 106 |
106 107 | async def import_from_anyio():
ASYNC116.py:110:11: ASYNC116 [*] `asyncio.sleep()` with >24 hour interval should usually be `asyncio.sleep_forever()`
error[ASYNC116]: 110:11: [*] `asyncio.sleep()` with >24 hour interval should usually be `asyncio.sleep_forever()`
--> ASYNC116.py:110:11
|
109 | # catch from import
110 | await sleep(86401) # error: 116, "async"
| ^^^^^^^^^^^^ ASYNC116
| ^^^^^^^^^^^^
|
= help: Replace with `asyncio.sleep_forever()`
Unsafe fix
2 2 | # ASYNCIO_NO_ERROR - no asyncio.sleep_forever, so check intentionally doesn't trigger.
3 3 | import math

View File

@@ -1,229 +1,255 @@
---
source: crates/ruff_linter/src/rules/flake8_async/mod.rs
---
ASYNC210.py:8:5: ASYNC210 Async functions should not call blocking HTTP methods
error[ASYNC210]: 8:5: Async functions should not call blocking HTTP methods
--> ASYNC210.py:8:5
|
7 | async def foo():
8 | urllib.request.urlopen("http://example.com/foo/bar").read() # ASYNC210
| ^^^^^^^^^^^^^^^^^^^^^^ ASYNC210
| ^^^^^^^^^^^^^^^^^^^^^^
|
error[ASYNC210]: 12:5: Async functions should not call blocking HTTP methods
ASYNC210.py:12:5: ASYNC210 Async functions should not call blocking HTTP methods
--> ASYNC210.py:12:5
|
11 | async def foo():
12 | requests.get() # ASYNC210
| ^^^^^^^^^^^^ ASYNC210
| ^^^^^^^^^^^^
|
error[ASYNC210]: 16:5: Async functions should not call blocking HTTP methods
ASYNC210.py:16:5: ASYNC210 Async functions should not call blocking HTTP methods
--> ASYNC210.py:16:5
|
15 | async def foo():
16 | httpx.get() # ASYNC210
| ^^^^^^^^^ ASYNC210
| ^^^^^^^^^
|
error[ASYNC210]: 20:5: Async functions should not call blocking HTTP methods
ASYNC210.py:20:5: ASYNC210 Async functions should not call blocking HTTP methods
--> ASYNC210.py:20:5
|
19 | async def foo():
20 | requests.post() # ASYNC210
| ^^^^^^^^^^^^^ ASYNC210
| ^^^^^^^^^^^^^
|
error[ASYNC210]: 24:5: Async functions should not call blocking HTTP methods
ASYNC210.py:24:5: ASYNC210 Async functions should not call blocking HTTP methods
--> ASYNC210.py:24:5
|
23 | async def foo():
24 | httpx.post() # ASYNC210
| ^^^^^^^^^^ ASYNC210
| ^^^^^^^^^^
|
error[ASYNC210]: 28:5: Async functions should not call blocking HTTP methods
ASYNC210.py:28:5: ASYNC210 Async functions should not call blocking HTTP methods
--> ASYNC210.py:28:5
|
27 | async def foo():
28 | requests.get() # ASYNC210
| ^^^^^^^^^^^^ ASYNC210
| ^^^^^^^^^^^^
29 | requests.get(...) # ASYNC210
30 | requests.get # Ok
|
error[ASYNC210]: 29:5: Async functions should not call blocking HTTP methods
ASYNC210.py:29:5: ASYNC210 Async functions should not call blocking HTTP methods
--> ASYNC210.py:29:5
|
27 | async def foo():
28 | requests.get() # ASYNC210
29 | requests.get(...) # ASYNC210
| ^^^^^^^^^^^^ ASYNC210
| ^^^^^^^^^^^^
30 | requests.get # Ok
31 | print(requests.get()) # ASYNC210
|
error[ASYNC210]: 31:11: Async functions should not call blocking HTTP methods
ASYNC210.py:31:11: ASYNC210 Async functions should not call blocking HTTP methods
--> ASYNC210.py:31:11
|
29 | requests.get(...) # ASYNC210
30 | requests.get # Ok
31 | print(requests.get()) # ASYNC210
| ^^^^^^^^^^^^ ASYNC210
| ^^^^^^^^^^^^
32 | print(requests.get(requests.get())) # ASYNC210
|
error[ASYNC210]: 32:11: Async functions should not call blocking HTTP methods
ASYNC210.py:32:11: ASYNC210 Async functions should not call blocking HTTP methods
--> ASYNC210.py:32:11
|
30 | requests.get # Ok
31 | print(requests.get()) # ASYNC210
32 | print(requests.get(requests.get())) # ASYNC210
| ^^^^^^^^^^^^ ASYNC210
| ^^^^^^^^^^^^
33 |
34 | requests.options() # ASYNC210
|
error[ASYNC210]: 32:24: Async functions should not call blocking HTTP methods
ASYNC210.py:32:24: ASYNC210 Async functions should not call blocking HTTP methods
--> ASYNC210.py:32:24
|
30 | requests.get # Ok
31 | print(requests.get()) # ASYNC210
32 | print(requests.get(requests.get())) # ASYNC210
| ^^^^^^^^^^^^ ASYNC210
| ^^^^^^^^^^^^
33 |
34 | requests.options() # ASYNC210
|
error[ASYNC210]: 34:5: Async functions should not call blocking HTTP methods
ASYNC210.py:34:5: ASYNC210 Async functions should not call blocking HTTP methods
--> ASYNC210.py:34:5
|
32 | print(requests.get(requests.get())) # ASYNC210
33 |
34 | requests.options() # ASYNC210
| ^^^^^^^^^^^^^^^^ ASYNC210
| ^^^^^^^^^^^^^^^^
35 | requests.head() # ASYNC210
36 | requests.post() # ASYNC210
|
error[ASYNC210]: 35:5: Async functions should not call blocking HTTP methods
ASYNC210.py:35:5: ASYNC210 Async functions should not call blocking HTTP methods
--> ASYNC210.py:35:5
|
34 | requests.options() # ASYNC210
35 | requests.head() # ASYNC210
| ^^^^^^^^^^^^^ ASYNC210
| ^^^^^^^^^^^^^
36 | requests.post() # ASYNC210
37 | requests.put() # ASYNC210
|
error[ASYNC210]: 36:5: Async functions should not call blocking HTTP methods
ASYNC210.py:36:5: ASYNC210 Async functions should not call blocking HTTP methods
--> ASYNC210.py:36:5
|
34 | requests.options() # ASYNC210
35 | requests.head() # ASYNC210
36 | requests.post() # ASYNC210
| ^^^^^^^^^^^^^ ASYNC210
| ^^^^^^^^^^^^^
37 | requests.put() # ASYNC210
38 | requests.patch() # ASYNC210
|
error[ASYNC210]: 37:5: Async functions should not call blocking HTTP methods
ASYNC210.py:37:5: ASYNC210 Async functions should not call blocking HTTP methods
--> ASYNC210.py:37:5
|
35 | requests.head() # ASYNC210
36 | requests.post() # ASYNC210
37 | requests.put() # ASYNC210
| ^^^^^^^^^^^^ ASYNC210
| ^^^^^^^^^^^^
38 | requests.patch() # ASYNC210
39 | requests.delete() # ASYNC210
|
error[ASYNC210]: 38:5: Async functions should not call blocking HTTP methods
ASYNC210.py:38:5: ASYNC210 Async functions should not call blocking HTTP methods
--> ASYNC210.py:38:5
|
36 | requests.post() # ASYNC210
37 | requests.put() # ASYNC210
38 | requests.patch() # ASYNC210
| ^^^^^^^^^^^^^^ ASYNC210
| ^^^^^^^^^^^^^^
39 | requests.delete() # ASYNC210
40 | requests.foo()
|
error[ASYNC210]: 39:5: Async functions should not call blocking HTTP methods
ASYNC210.py:39:5: ASYNC210 Async functions should not call blocking HTTP methods
--> ASYNC210.py:39:5
|
37 | requests.put() # ASYNC210
38 | requests.patch() # ASYNC210
39 | requests.delete() # ASYNC210
| ^^^^^^^^^^^^^^^ ASYNC210
| ^^^^^^^^^^^^^^^
40 | requests.foo()
|
error[ASYNC210]: 42:5: Async functions should not call blocking HTTP methods
ASYNC210.py:42:5: ASYNC210 Async functions should not call blocking HTTP methods
--> ASYNC210.py:42:5
|
40 | requests.foo()
41 |
42 | httpx.options("") # ASYNC210
| ^^^^^^^^^^^^^ ASYNC210
| ^^^^^^^^^^^^^
43 | httpx.head("") # ASYNC210
44 | httpx.post("") # ASYNC210
|
error[ASYNC210]: 43:5: Async functions should not call blocking HTTP methods
ASYNC210.py:43:5: ASYNC210 Async functions should not call blocking HTTP methods
--> ASYNC210.py:43:5
|
42 | httpx.options("") # ASYNC210
43 | httpx.head("") # ASYNC210
| ^^^^^^^^^^ ASYNC210
| ^^^^^^^^^^
44 | httpx.post("") # ASYNC210
45 | httpx.put("") # ASYNC210
|
error[ASYNC210]: 44:5: Async functions should not call blocking HTTP methods
ASYNC210.py:44:5: ASYNC210 Async functions should not call blocking HTTP methods
--> ASYNC210.py:44:5
|
42 | httpx.options("") # ASYNC210
43 | httpx.head("") # ASYNC210
44 | httpx.post("") # ASYNC210
| ^^^^^^^^^^ ASYNC210
| ^^^^^^^^^^
45 | httpx.put("") # ASYNC210
46 | httpx.patch("") # ASYNC210
|
error[ASYNC210]: 45:5: Async functions should not call blocking HTTP methods
ASYNC210.py:45:5: ASYNC210 Async functions should not call blocking HTTP methods
--> ASYNC210.py:45:5
|
43 | httpx.head("") # ASYNC210
44 | httpx.post("") # ASYNC210
45 | httpx.put("") # ASYNC210
| ^^^^^^^^^ ASYNC210
| ^^^^^^^^^
46 | httpx.patch("") # ASYNC210
47 | httpx.delete("") # ASYNC210
|
error[ASYNC210]: 46:5: Async functions should not call blocking HTTP methods
ASYNC210.py:46:5: ASYNC210 Async functions should not call blocking HTTP methods
--> ASYNC210.py:46:5
|
44 | httpx.post("") # ASYNC210
45 | httpx.put("") # ASYNC210
46 | httpx.patch("") # ASYNC210
| ^^^^^^^^^^^ ASYNC210
| ^^^^^^^^^^^
47 | httpx.delete("") # ASYNC210
48 | httpx.foo() # Ok
|
error[ASYNC210]: 47:5: Async functions should not call blocking HTTP methods
ASYNC210.py:47:5: ASYNC210 Async functions should not call blocking HTTP methods
--> ASYNC210.py:47:5
|
45 | httpx.put("") # ASYNC210
46 | httpx.patch("") # ASYNC210
47 | httpx.delete("") # ASYNC210
| ^^^^^^^^^^^^ ASYNC210
| ^^^^^^^^^^^^
48 | httpx.foo() # Ok
|
error[ASYNC210]: 50:5: Async functions should not call blocking HTTP methods
ASYNC210.py:50:5: ASYNC210 Async functions should not call blocking HTTP methods
--> ASYNC210.py:50:5
|
48 | httpx.foo() # Ok
49 |
50 | urllib3.request() # ASYNC210
| ^^^^^^^^^^^^^^^ ASYNC210
| ^^^^^^^^^^^^^^^
51 | urllib3.request(...) # ASYNC210
|
error[ASYNC210]: 51:5: Async functions should not call blocking HTTP methods
ASYNC210.py:51:5: ASYNC210 Async functions should not call blocking HTTP methods
--> ASYNC210.py:51:5
|
50 | urllib3.request() # ASYNC210
51 | urllib3.request(...) # ASYNC210
| ^^^^^^^^^^^^^^^ ASYNC210
| ^^^^^^^^^^^^^^^
52 |
53 | urllib.request.urlopen("") # ASYNC210
|
error[ASYNC210]: 53:5: Async functions should not call blocking HTTP methods
ASYNC210.py:53:5: ASYNC210 Async functions should not call blocking HTTP methods
--> ASYNC210.py:53:5
|
51 | urllib3.request(...) # ASYNC210
52 |
53 | urllib.request.urlopen("") # ASYNC210
| ^^^^^^^^^^^^^^^^^^^^^^ ASYNC210
| ^^^^^^^^^^^^^^^^^^^^^^
54 |
55 | r = {}
|

View File

@@ -1,77 +1,86 @@
---
source: crates/ruff_linter/src/rules/flake8_async/mod.rs
---
ASYNC22x.py:31:5: ASYNC220 Async functions should not create subprocesses with blocking methods
error[ASYNC220]: 31:5: Async functions should not create subprocesses with blocking methods
--> ASYNC22x.py:31:5
|
29 | subprocess.getoutput() # ASYNC221
30 | )
31 | subprocess.Popen() # ASYNC220
| ^^^^^^^^^^^^^^^^ ASYNC220
| ^^^^^^^^^^^^^^^^
32 | os.system() # ASYNC221
|
error[ASYNC220]: 73:5: Async functions should not create subprocesses with blocking methods
ASYNC22x.py:73:5: ASYNC220 Async functions should not create subprocesses with blocking methods
--> ASYNC22x.py:73:5
|
72 | # if mode is given, and is not os.P_WAIT: ASYNC220
73 | os.spawnl(os.P_NOWAIT) # ASYNC220
| ^^^^^^^^^ ASYNC220
| ^^^^^^^^^
74 | os.spawnl(P_NOWAIT) # ASYNC220
75 | os.spawnl(mode=os.P_NOWAIT) # ASYNC220
|
error[ASYNC220]: 74:5: Async functions should not create subprocesses with blocking methods
ASYNC22x.py:74:5: ASYNC220 Async functions should not create subprocesses with blocking methods
--> ASYNC22x.py:74:5
|
72 | # if mode is given, and is not os.P_WAIT: ASYNC220
73 | os.spawnl(os.P_NOWAIT) # ASYNC220
74 | os.spawnl(P_NOWAIT) # ASYNC220
| ^^^^^^^^^ ASYNC220
| ^^^^^^^^^
75 | os.spawnl(mode=os.P_NOWAIT) # ASYNC220
76 | os.spawnl(mode=P_NOWAIT) # ASYNC220
|
error[ASYNC220]: 75:5: Async functions should not create subprocesses with blocking methods
ASYNC22x.py:75:5: ASYNC220 Async functions should not create subprocesses with blocking methods
--> ASYNC22x.py:75:5
|
73 | os.spawnl(os.P_NOWAIT) # ASYNC220
74 | os.spawnl(P_NOWAIT) # ASYNC220
75 | os.spawnl(mode=os.P_NOWAIT) # ASYNC220
| ^^^^^^^^^ ASYNC220
| ^^^^^^^^^
76 | os.spawnl(mode=P_NOWAIT) # ASYNC220
|
error[ASYNC220]: 76:5: Async functions should not create subprocesses with blocking methods
ASYNC22x.py:76:5: ASYNC220 Async functions should not create subprocesses with blocking methods
--> ASYNC22x.py:76:5
|
74 | os.spawnl(P_NOWAIT) # ASYNC220
75 | os.spawnl(mode=os.P_NOWAIT) # ASYNC220
76 | os.spawnl(mode=P_NOWAIT) # ASYNC220
| ^^^^^^^^^ ASYNC220
| ^^^^^^^^^
77 |
78 | P_WAIT = os.P_WAIT
|
error[ASYNC220]: 86:5: Async functions should not create subprocesses with blocking methods
ASYNC22x.py:86:5: ASYNC220 Async functions should not create subprocesses with blocking methods
--> ASYNC22x.py:86:5
|
85 | # other weird cases: ASYNC220
86 | os.spawnl(0) # ASYNC220
| ^^^^^^^^^ ASYNC220
| ^^^^^^^^^
87 | os.spawnl(1) # ASYNC220
88 | os.spawnl(foo()) # ASYNC220
|
error[ASYNC220]: 87:5: Async functions should not create subprocesses with blocking methods
ASYNC22x.py:87:5: ASYNC220 Async functions should not create subprocesses with blocking methods
--> ASYNC22x.py:87:5
|
85 | # other weird cases: ASYNC220
86 | os.spawnl(0) # ASYNC220
87 | os.spawnl(1) # ASYNC220
| ^^^^^^^^^ ASYNC220
| ^^^^^^^^^
88 | os.spawnl(foo()) # ASYNC220
|
error[ASYNC220]: 88:5: Async functions should not create subprocesses with blocking methods
ASYNC22x.py:88:5: ASYNC220 Async functions should not create subprocesses with blocking methods
--> ASYNC22x.py:88:5
|
86 | os.spawnl(0) # ASYNC220
87 | os.spawnl(1) # ASYNC220
88 | os.spawnl(foo()) # ASYNC220
| ^^^^^^^^^ ASYNC220
| ^^^^^^^^^
89 |
90 | # ASYNC222
|

View File

@@ -1,226 +1,251 @@
---
source: crates/ruff_linter/src/rules/flake8_async/mod.rs
---
ASYNC22x.py:8:5: ASYNC221 Async functions should not run processes with blocking methods
error[ASYNC221]: 8:5: Async functions should not run processes with blocking methods
--> ASYNC22x.py:8:5
|
7 | async def func():
8 | subprocess.run("foo") # ASYNC221
| ^^^^^^^^^^^^^^ ASYNC221
| ^^^^^^^^^^^^^^
|
error[ASYNC221]: 12:5: Async functions should not run processes with blocking methods
ASYNC22x.py:12:5: ASYNC221 Async functions should not run processes with blocking methods
--> ASYNC22x.py:12:5
|
11 | async def func():
12 | subprocess.call("foo") # ASYNC221
| ^^^^^^^^^^^^^^^ ASYNC221
| ^^^^^^^^^^^^^^^
|
error[ASYNC221]: 29:9: Async functions should not run processes with blocking methods
ASYNC22x.py:29:9: ASYNC221 Async functions should not run processes with blocking methods
--> ASYNC22x.py:29:9
|
27 | async def foo():
28 | await async_fun(
29 | subprocess.getoutput() # ASYNC221
| ^^^^^^^^^^^^^^^^^^^^ ASYNC221
| ^^^^^^^^^^^^^^^^^^^^
30 | )
31 | subprocess.Popen() # ASYNC220
|
error[ASYNC221]: 32:5: Async functions should not run processes with blocking methods
ASYNC22x.py:32:5: ASYNC221 Async functions should not run processes with blocking methods
--> ASYNC22x.py:32:5
|
30 | )
31 | subprocess.Popen() # ASYNC220
32 | os.system() # ASYNC221
| ^^^^^^^^^ ASYNC221
| ^^^^^^^^^
33 |
34 | system()
|
error[ASYNC221]: 38:5: Async functions should not run processes with blocking methods
ASYNC22x.py:38:5: ASYNC221 Async functions should not run processes with blocking methods
--> ASYNC22x.py:38:5
|
36 | os.anything()
37 |
38 | subprocess.run() # ASYNC221
| ^^^^^^^^^^^^^^ ASYNC221
| ^^^^^^^^^^^^^^
39 | subprocess.call() # ASYNC221
40 | subprocess.check_call() # ASYNC221
|
error[ASYNC221]: 39:5: Async functions should not run processes with blocking methods
ASYNC22x.py:39:5: ASYNC221 Async functions should not run processes with blocking methods
--> ASYNC22x.py:39:5
|
38 | subprocess.run() # ASYNC221
39 | subprocess.call() # ASYNC221
| ^^^^^^^^^^^^^^^ ASYNC221
| ^^^^^^^^^^^^^^^
40 | subprocess.check_call() # ASYNC221
41 | subprocess.check_output() # ASYNC221
|
error[ASYNC221]: 40:5: Async functions should not run processes with blocking methods
ASYNC22x.py:40:5: ASYNC221 Async functions should not run processes with blocking methods
--> ASYNC22x.py:40:5
|
38 | subprocess.run() # ASYNC221
39 | subprocess.call() # ASYNC221
40 | subprocess.check_call() # ASYNC221
| ^^^^^^^^^^^^^^^^^^^^^ ASYNC221
| ^^^^^^^^^^^^^^^^^^^^^
41 | subprocess.check_output() # ASYNC221
42 | subprocess.getoutput() # ASYNC221
|
error[ASYNC221]: 41:5: Async functions should not run processes with blocking methods
ASYNC22x.py:41:5: ASYNC221 Async functions should not run processes with blocking methods
--> ASYNC22x.py:41:5
|
39 | subprocess.call() # ASYNC221
40 | subprocess.check_call() # ASYNC221
41 | subprocess.check_output() # ASYNC221
| ^^^^^^^^^^^^^^^^^^^^^^^ ASYNC221
| ^^^^^^^^^^^^^^^^^^^^^^^
42 | subprocess.getoutput() # ASYNC221
43 | subprocess.getstatusoutput() # ASYNC221
|
error[ASYNC221]: 42:5: Async functions should not run processes with blocking methods
ASYNC22x.py:42:5: ASYNC221 Async functions should not run processes with blocking methods
--> ASYNC22x.py:42:5
|
40 | subprocess.check_call() # ASYNC221
41 | subprocess.check_output() # ASYNC221
42 | subprocess.getoutput() # ASYNC221
| ^^^^^^^^^^^^^^^^^^^^ ASYNC221
| ^^^^^^^^^^^^^^^^^^^^
43 | subprocess.getstatusoutput() # ASYNC221
|
error[ASYNC221]: 43:5: Async functions should not run processes with blocking methods
ASYNC22x.py:43:5: ASYNC221 Async functions should not run processes with blocking methods
--> ASYNC22x.py:43:5
|
41 | subprocess.check_output() # ASYNC221
42 | subprocess.getoutput() # ASYNC221
43 | subprocess.getstatusoutput() # ASYNC221
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ ASYNC221
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
44 |
45 | await async_fun(
|
error[ASYNC221]: 46:9: Async functions should not run processes with blocking methods
ASYNC22x.py:46:9: ASYNC221 Async functions should not run processes with blocking methods
--> ASYNC22x.py:46:9
|
45 | await async_fun(
46 | subprocess.getoutput() # ASYNC221
| ^^^^^^^^^^^^^^^^^^^^ ASYNC221
| ^^^^^^^^^^^^^^^^^^^^
47 | )
|
error[ASYNC221]: 54:5: Async functions should not run processes with blocking methods
ASYNC22x.py:54:5: ASYNC221 Async functions should not run processes with blocking methods
--> ASYNC22x.py:54:5
|
52 | subprocess()
53 |
54 | os.posix_spawn() # ASYNC221
| ^^^^^^^^^^^^^^ ASYNC221
| ^^^^^^^^^^^^^^
55 | os.posix_spawnp() # ASYNC221
|
error[ASYNC221]: 55:5: Async functions should not run processes with blocking methods
ASYNC22x.py:55:5: ASYNC221 Async functions should not run processes with blocking methods
--> ASYNC22x.py:55:5
|
54 | os.posix_spawn() # ASYNC221
55 | os.posix_spawnp() # ASYNC221
| ^^^^^^^^^^^^^^^ ASYNC221
| ^^^^^^^^^^^^^^^
56 |
57 | os.spawn()
|
error[ASYNC221]: 61:5: Async functions should not run processes with blocking methods
ASYNC22x.py:61:5: ASYNC221 Async functions should not run processes with blocking methods
--> ASYNC22x.py:61:5
|
59 | os.spawnllll()
60 |
61 | os.spawnl() # ASYNC221
| ^^^^^^^^^ ASYNC221
| ^^^^^^^^^
62 | os.spawnle() # ASYNC221
63 | os.spawnlp() # ASYNC221
|
error[ASYNC221]: 62:5: Async functions should not run processes with blocking methods
ASYNC22x.py:62:5: ASYNC221 Async functions should not run processes with blocking methods
--> ASYNC22x.py:62:5
|
61 | os.spawnl() # ASYNC221
62 | os.spawnle() # ASYNC221
| ^^^^^^^^^^ ASYNC221
| ^^^^^^^^^^
63 | os.spawnlp() # ASYNC221
64 | os.spawnlpe() # ASYNC221
|
error[ASYNC221]: 63:5: Async functions should not run processes with blocking methods
ASYNC22x.py:63:5: ASYNC221 Async functions should not run processes with blocking methods
--> ASYNC22x.py:63:5
|
61 | os.spawnl() # ASYNC221
62 | os.spawnle() # ASYNC221
63 | os.spawnlp() # ASYNC221
| ^^^^^^^^^^ ASYNC221
| ^^^^^^^^^^
64 | os.spawnlpe() # ASYNC221
65 | os.spawnv() # ASYNC221
|
error[ASYNC221]: 64:5: Async functions should not run processes with blocking methods
ASYNC22x.py:64:5: ASYNC221 Async functions should not run processes with blocking methods
--> ASYNC22x.py:64:5
|
62 | os.spawnle() # ASYNC221
63 | os.spawnlp() # ASYNC221
64 | os.spawnlpe() # ASYNC221
| ^^^^^^^^^^^ ASYNC221
| ^^^^^^^^^^^
65 | os.spawnv() # ASYNC221
66 | os.spawnve() # ASYNC221
|
error[ASYNC221]: 65:5: Async functions should not run processes with blocking methods
ASYNC22x.py:65:5: ASYNC221 Async functions should not run processes with blocking methods
--> ASYNC22x.py:65:5
|
63 | os.spawnlp() # ASYNC221
64 | os.spawnlpe() # ASYNC221
65 | os.spawnv() # ASYNC221
| ^^^^^^^^^ ASYNC221
| ^^^^^^^^^
66 | os.spawnve() # ASYNC221
67 | os.spawnvp() # ASYNC221
|
error[ASYNC221]: 66:5: Async functions should not run processes with blocking methods
ASYNC22x.py:66:5: ASYNC221 Async functions should not run processes with blocking methods
--> ASYNC22x.py:66:5
|
64 | os.spawnlpe() # ASYNC221
65 | os.spawnv() # ASYNC221
66 | os.spawnve() # ASYNC221
| ^^^^^^^^^^ ASYNC221
| ^^^^^^^^^^
67 | os.spawnvp() # ASYNC221
68 | os.spawnvpe() # ASYNC221
|
error[ASYNC221]: 67:5: Async functions should not run processes with blocking methods
ASYNC22x.py:67:5: ASYNC221 Async functions should not run processes with blocking methods
--> ASYNC22x.py:67:5
|
65 | os.spawnv() # ASYNC221
66 | os.spawnve() # ASYNC221
67 | os.spawnvp() # ASYNC221
| ^^^^^^^^^^ ASYNC221
| ^^^^^^^^^^
68 | os.spawnvpe() # ASYNC221
|
error[ASYNC221]: 68:5: Async functions should not run processes with blocking methods
ASYNC22x.py:68:5: ASYNC221 Async functions should not run processes with blocking methods
--> ASYNC22x.py:68:5
|
66 | os.spawnve() # ASYNC221
67 | os.spawnvp() # ASYNC221
68 | os.spawnvpe() # ASYNC221
| ^^^^^^^^^^^ ASYNC221
| ^^^^^^^^^^^
69 |
70 | P_NOWAIT = os.P_NOWAIT
|
error[ASYNC221]: 81:5: Async functions should not run processes with blocking methods
ASYNC22x.py:81:5: ASYNC221 Async functions should not run processes with blocking methods
--> ASYNC22x.py:81:5
|
80 | # if it is P_WAIT, ASYNC221
81 | os.spawnl(P_WAIT) # ASYNC221
| ^^^^^^^^^ ASYNC221
| ^^^^^^^^^
82 | os.spawnl(mode=os.P_WAIT) # ASYNC221
83 | os.spawnl(mode=P_WAIT) # ASYNC221
|
error[ASYNC221]: 82:5: Async functions should not run processes with blocking methods
ASYNC22x.py:82:5: ASYNC221 Async functions should not run processes with blocking methods
--> ASYNC22x.py:82:5
|
80 | # if it is P_WAIT, ASYNC221
81 | os.spawnl(P_WAIT) # ASYNC221
82 | os.spawnl(mode=os.P_WAIT) # ASYNC221
| ^^^^^^^^^ ASYNC221
| ^^^^^^^^^
83 | os.spawnl(mode=P_WAIT) # ASYNC221
|
error[ASYNC221]: 83:5: Async functions should not run processes with blocking methods
ASYNC22x.py:83:5: ASYNC221 Async functions should not run processes with blocking methods
--> ASYNC22x.py:83:5
|
81 | os.spawnl(P_WAIT) # ASYNC221
82 | os.spawnl(mode=os.P_WAIT) # ASYNC221
83 | os.spawnl(mode=P_WAIT) # ASYNC221
| ^^^^^^^^^ ASYNC221
| ^^^^^^^^^
84 |
85 | # other weird cases: ASYNC220
|

View File

@@ -1,64 +1,72 @@
---
source: crates/ruff_linter/src/rules/flake8_async/mod.rs
---
ASYNC22x.py:20:5: ASYNC222 Async functions should not wait on processes with blocking methods
error[ASYNC222]: 20:5: Async functions should not wait on processes with blocking methods
--> ASYNC22x.py:20:5
|
19 | async def func():
20 | os.wait4(10) # ASYNC222
| ^^^^^^^^ ASYNC222
| ^^^^^^^^
|
error[ASYNC222]: 24:5: Async functions should not wait on processes with blocking methods
ASYNC22x.py:24:5: ASYNC222 Async functions should not wait on processes with blocking methods
--> ASYNC22x.py:24:5
|
23 | async def func():
24 | os.wait(12) # ASYNC222
| ^^^^^^^ ASYNC222
| ^^^^^^^
|
error[ASYNC222]: 91:5: Async functions should not wait on processes with blocking methods
ASYNC22x.py:91:5: ASYNC222 Async functions should not wait on processes with blocking methods
--> ASYNC22x.py:91:5
|
90 | # ASYNC222
91 | os.wait() # ASYNC222
| ^^^^^^^ ASYNC222
| ^^^^^^^
92 | os.wait3() # ASYNC222
93 | os.wait4() # ASYNC222
|
error[ASYNC222]: 92:5: Async functions should not wait on processes with blocking methods
ASYNC22x.py:92:5: ASYNC222 Async functions should not wait on processes with blocking methods
--> ASYNC22x.py:92:5
|
90 | # ASYNC222
91 | os.wait() # ASYNC222
92 | os.wait3() # ASYNC222
| ^^^^^^^^ ASYNC222
| ^^^^^^^^
93 | os.wait4() # ASYNC222
94 | os.waitid() # ASYNC222
|
error[ASYNC222]: 93:5: Async functions should not wait on processes with blocking methods
ASYNC22x.py:93:5: ASYNC222 Async functions should not wait on processes with blocking methods
--> ASYNC22x.py:93:5
|
91 | os.wait() # ASYNC222
92 | os.wait3() # ASYNC222
93 | os.wait4() # ASYNC222
| ^^^^^^^^ ASYNC222
| ^^^^^^^^
94 | os.waitid() # ASYNC222
95 | os.waitpid() # ASYNC222
|
error[ASYNC222]: 94:5: Async functions should not wait on processes with blocking methods
ASYNC22x.py:94:5: ASYNC222 Async functions should not wait on processes with blocking methods
--> ASYNC22x.py:94:5
|
92 | os.wait3() # ASYNC222
93 | os.wait4() # ASYNC222
94 | os.waitid() # ASYNC222
| ^^^^^^^^^ ASYNC222
| ^^^^^^^^^
95 | os.waitpid() # ASYNC222
|
error[ASYNC222]: 95:5: Async functions should not wait on processes with blocking methods
ASYNC22x.py:95:5: ASYNC222 Async functions should not wait on processes with blocking methods
--> ASYNC22x.py:95:5
|
93 | os.wait4() # ASYNC222
94 | os.waitid() # ASYNC222
95 | os.waitpid() # ASYNC222
| ^^^^^^^^^^ ASYNC222
| ^^^^^^^^^^
96 |
97 | os.waitpi()
|

View File

@@ -1,101 +1,114 @@
---
source: crates/ruff_linter/src/rules/flake8_async/mod.rs
---
ASYNC230.py:6:5: ASYNC230 Async functions should not open files with blocking methods like `open`
|
5 | async def foo():
6 | open("") # ASYNC230
| ^^^^ ASYNC230
7 | io.open_code("") # ASYNC230
|
error[ASYNC230]: 6:5: Async functions should not open files with blocking methods like `open`
ASYNC230.py:7:5: ASYNC230 Async functions should not open files with blocking methods like `open`
--> ASYNC230.py:6:5
|
5 | async def foo():
6 | open("") # ASYNC230
| ^^^^
7 | io.open_code("") # ASYNC230
|
error[ASYNC230]: 7:5: Async functions should not open files with blocking methods like `open`
--> ASYNC230.py:7:5
|
5 | async def foo():
6 | open("") # ASYNC230
7 | io.open_code("") # ASYNC230
| ^^^^^^^^^^^^ ASYNC230
| ^^^^^^^^^^^^
8 |
9 | with open(""): # ASYNC230
|
error[ASYNC230]: 9:10: Async functions should not open files with blocking methods like `open`
ASYNC230.py:9:10: ASYNC230 Async functions should not open files with blocking methods like `open`
--> ASYNC230.py:9:10
|
7 | io.open_code("") # ASYNC230
8 |
9 | with open(""): # ASYNC230
| ^^^^ ASYNC230
| ^^^^
10 | ...
|
error[ASYNC230]: 12:10: Async functions should not open files with blocking methods like `open`
ASYNC230.py:12:10: ASYNC230 Async functions should not open files with blocking methods like `open`
--> ASYNC230.py:12:10
|
10 | ...
11 |
12 | with open("") as f: # ASYNC230
| ^^^^ ASYNC230
| ^^^^
13 | ...
|
error[ASYNC230]: 15:17: Async functions should not open files with blocking methods like `open`
ASYNC230.py:15:17: ASYNC230 Async functions should not open files with blocking methods like `open`
--> ASYNC230.py:15:17
|
13 | ...
14 |
15 | with foo(), open(""): # ASYNC230
| ^^^^ ASYNC230
| ^^^^
16 | ...
|
error[ASYNC230]: 18:16: Async functions should not open files with blocking methods like `open`
ASYNC230.py:18:16: ASYNC230 Async functions should not open files with blocking methods like `open`
--> ASYNC230.py:18:16
|
16 | ...
17 |
18 | async with open(""): # ASYNC230
| ^^^^ ASYNC230
| ^^^^
19 | ...
|
error[ASYNC230]: 29:5: Async functions should not open files with blocking methods like `open`
ASYNC230.py:29:5: ASYNC230 Async functions should not open files with blocking methods like `open`
--> ASYNC230.py:29:5
|
28 | async def func():
29 | open("foo") # ASYNC230
| ^^^^ ASYNC230
| ^^^^
|
error[ASYNC230]: 36:5: Async functions should not open files with blocking methods like `open`
ASYNC230.py:36:5: ASYNC230 Async functions should not open files with blocking methods like `open`
--> ASYNC230.py:36:5
|
35 | async def func():
36 | Path("foo").open() # ASYNC230
| ^^^^^^^^^^^^^^^^ ASYNC230
| ^^^^^^^^^^^^^^^^
|
error[ASYNC230]: 41:5: Async functions should not open files with blocking methods like `open`
ASYNC230.py:41:5: ASYNC230 Async functions should not open files with blocking methods like `open`
--> ASYNC230.py:41:5
|
39 | async def func():
40 | p = Path("foo")
41 | p.open() # ASYNC230
| ^^^^^^ ASYNC230
| ^^^^^^
|
error[ASYNC230]: 45:10: Async functions should not open files with blocking methods like `open`
ASYNC230.py:45:10: ASYNC230 Async functions should not open files with blocking methods like `open`
--> ASYNC230.py:45:10
|
44 | async def func():
45 | with Path("foo").open() as f: # ASYNC230
| ^^^^^^^^^^^^^^^^ ASYNC230
| ^^^^^^^^^^^^^^^^
46 | pass
|
error[ASYNC230]: 53:9: Async functions should not open files with blocking methods like `open`
ASYNC230.py:53:9: ASYNC230 Async functions should not open files with blocking methods like `open`
--> ASYNC230.py:53:9
|
52 | async def bar():
53 | p.open() # ASYNC230
| ^^^^^^ ASYNC230
| ^^^^^^
|
error[ASYNC230]: 59:5: Async functions should not open files with blocking methods like `open`
ASYNC230.py:59:5: ASYNC230 Async functions should not open files with blocking methods like `open`
--> ASYNC230.py:59:5
|
57 | (p1, p2) = (Path("foo"), Path("bar"))
58 |
59 | p1.open() # ASYNC230
| ^^^^^^^ ASYNC230
| ^^^^^^^
|

View File

@@ -1,9 +1,11 @@
---
source: crates/ruff_linter/src/rules/flake8_async/mod.rs
---
ASYNC251.py:6:5: ASYNC251 Async functions should not call `time.sleep`
error[ASYNC251]: 6:5: Async functions should not call `time.sleep`
--> ASYNC251.py:6:5
|
5 | async def func():
6 | time.sleep(1) # ASYNC251
| ^^^^^^^^^^ ASYNC251
| ^^^^^^^^^^
|

View File

@@ -1,27 +1,29 @@
---
source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs
---
S101.py:1:1: S101 Use of `assert` detected
error[S101]: 1:1: Use of `assert` detected
--> S101.py:1:1
|
1 | assert True # S101
| ^^^^^^ S101
| ^^^^^^
|
error[S101]: 6:5: Use of `assert` detected
S101.py:6:5: S101 Use of `assert` detected
--> S101.py:6:5
|
4 | def fn():
5 | x = 1
6 | assert x == 1 # S101
| ^^^^^^ S101
| ^^^^^^
7 | assert x == 2 # S101
|
error[S101]: 7:5: Use of `assert` detected
S101.py:7:5: S101 Use of `assert` detected
--> S101.py:7:5
|
5 | x = 1
6 | assert x == 1 # S101
7 | assert x == 2 # S101
| ^^^^^^ S101
| ^^^^^^
|

View File

@@ -1,22 +1,23 @@
---
source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs
---
S102.py:3:5: S102 Use of `exec` detected
error[S102]: 3:5: Use of `exec` detected
--> S102.py:3:5
|
1 | def fn():
2 | # Error
3 | exec('x = 2')
| ^^^^ S102
| ^^^^
4 |
5 | exec('y = 3')
|
error[S102]: 5:1: Use of `exec` detected
S102.py:5:1: S102 Use of `exec` detected
--> S102.py:4:1
|
3 | exec('x = 2')
4 |
5 | exec('y = 3')
| ^^^^ S102
| ^^^^
|

View File

@@ -1,140 +1,153 @@
---
source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs
---
S103.py:6:25: S103 `os.chmod` setting a permissive mask `0o227` on file or directory
error[S103]: 6:25: `os.chmod` setting a permissive mask `0o227` on file or directory
--> S103.py:6:25
|
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
|
error[S103]: 7:25: `os.chmod` setting a permissive mask `0o7` on file or directory
S103.py:7:25: S103 `os.chmod` setting a permissive mask `0o7` on file or directory
--> S103.py:7:25
|
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
|
error[S103]: 9:25: `os.chmod` setting a permissive mask `0o777` on file or directory
S103.py:9:25: S103 `os.chmod` setting a permissive mask `0o777` on file or directory
--> S103.py:9:25
|
7 | os.chmod("/etc/passwd", 0o7) # Error
8 | os.chmod("/etc/passwd", 0o664) # OK
9 | os.chmod("/etc/passwd", 0o777) # Error
| ^^^^^ S103
| ^^^^^
10 | os.chmod("/etc/passwd", 0o770) # Error
11 | os.chmod("/etc/passwd", 0o776) # Error
|
error[S103]: 10:25: `os.chmod` setting a permissive mask `0o770` on file or directory
S103.py:10:25: S103 `os.chmod` setting a permissive mask `0o770` on file or directory
--> S103.py:10:25
|
8 | os.chmod("/etc/passwd", 0o664) # OK
9 | os.chmod("/etc/passwd", 0o777) # Error
10 | os.chmod("/etc/passwd", 0o770) # Error
| ^^^^^ S103
| ^^^^^
11 | os.chmod("/etc/passwd", 0o776) # Error
12 | os.chmod("/etc/passwd", 0o760) # OK
|
error[S103]: 11:25: `os.chmod` setting a permissive mask `0o776` on file or directory
S103.py:11:25: S103 `os.chmod` setting a permissive mask `0o776` on file or directory
--> S103.py:11:25
|
9 | os.chmod("/etc/passwd", 0o777) # Error
10 | os.chmod("/etc/passwd", 0o770) # Error
11 | os.chmod("/etc/passwd", 0o776) # Error
| ^^^^^ S103
| ^^^^^
12 | os.chmod("/etc/passwd", 0o760) # OK
13 | os.chmod("~/.bashrc", 511) # Error
|
error[S103]: 13:23: `os.chmod` setting a permissive mask `0o777` on file or directory
S103.py:13:23: S103 `os.chmod` setting a permissive mask `0o777` on file or directory
--> S103.py:13:23
|
11 | os.chmod("/etc/passwd", 0o776) # Error
12 | os.chmod("/etc/passwd", 0o760) # OK
13 | os.chmod("~/.bashrc", 511) # Error
| ^^^ S103
| ^^^
14 | os.chmod("/etc/hosts", 0o777) # Error
15 | os.chmod("/tmp/oh_hai", 0x1FF) # Error
|
error[S103]: 14:24: `os.chmod` setting a permissive mask `0o777` on file or directory
S103.py:14:24: S103 `os.chmod` setting a permissive mask `0o777` on file or directory
--> S103.py:14:24
|
12 | os.chmod("/etc/passwd", 0o760) # OK
13 | os.chmod("~/.bashrc", 511) # Error
14 | os.chmod("/etc/hosts", 0o777) # Error
| ^^^^^ S103
| ^^^^^
15 | os.chmod("/tmp/oh_hai", 0x1FF) # Error
16 | os.chmod("/etc/passwd", stat.S_IRWXU) # OK
|
error[S103]: 15:25: `os.chmod` setting a permissive mask `0o777` on file or directory
S103.py:15:25: S103 `os.chmod` setting a permissive mask `0o777` on file or directory
--> S103.py:15:25
|
13 | os.chmod("~/.bashrc", 511) # Error
14 | os.chmod("/etc/hosts", 0o777) # Error
15 | os.chmod("/tmp/oh_hai", 0x1FF) # Error
| ^^^^^ S103
| ^^^^^
16 | os.chmod("/etc/passwd", stat.S_IRWXU) # OK
17 | os.chmod(keyfile, 0o777) # Error
|
error[S103]: 17:19: `os.chmod` setting a permissive mask `0o777` on file or directory
S103.py:17:19: S103 `os.chmod` setting a permissive mask `0o777` on file or directory
--> S103.py:17:19
|
15 | os.chmod("/tmp/oh_hai", 0x1FF) # Error
16 | os.chmod("/etc/passwd", stat.S_IRWXU) # OK
17 | os.chmod(keyfile, 0o777) # Error
| ^^^^^ S103
| ^^^^^
18 | os.chmod(keyfile, 0o7 | 0o70 | 0o700) # Error
19 | os.chmod(keyfile, stat.S_IRWXO | stat.S_IRWXG | stat.S_IRWXU) # Error
|
error[S103]: 18:19: `os.chmod` setting a permissive mask `0o777` on file or directory
S103.py:18:19: S103 `os.chmod` setting a permissive mask `0o777` on file or directory
--> S103.py:18:19
|
16 | os.chmod("/etc/passwd", stat.S_IRWXU) # OK
17 | os.chmod(keyfile, 0o777) # Error
18 | os.chmod(keyfile, 0o7 | 0o70 | 0o700) # Error
| ^^^^^^^^^^^^^^^^^^ S103
| ^^^^^^^^^^^^^^^^^^
19 | os.chmod(keyfile, stat.S_IRWXO | stat.S_IRWXG | stat.S_IRWXU) # Error
20 | os.chmod("~/hidden_exec", stat.S_IXGRP) # Error
|
error[S103]: 19:19: `os.chmod` setting a permissive mask `0o777` on file or directory
S103.py:19:19: S103 `os.chmod` setting a permissive mask `0o777` on file or directory
--> S103.py:19:19
|
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
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
20 | os.chmod("~/hidden_exec", stat.S_IXGRP) # Error
21 | os.chmod("~/hidden_exec", stat.S_IXOTH) # OK
|
error[S103]: 20:27: `os.chmod` setting a permissive mask `0o10` on file or directory
S103.py:20:27: S103 `os.chmod` setting a permissive mask `0o10` on file or directory
--> S103.py:20:27
|
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
| ^^^^^^^^^^^^
21 | os.chmod("~/hidden_exec", stat.S_IXOTH) # OK
22 | os.chmod("/etc/passwd", stat.S_IWOTH) # Error
|
error[S103]: 22:25: `os.chmod` setting a permissive mask `0o2` on file or directory
S103.py:22:25: S103 `os.chmod` setting a permissive mask `0o2` on file or directory
--> S103.py:22:25
|
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
| ^^^^^^^^^^^^
23 | os.chmod("/etc/passwd", 0o100000000) # Error
|
error[S103]: 23:25: `os.chmod` setting an invalid mask on file or directory
S103.py:23:25: S103 `os.chmod` setting an invalid mask on file or directory
--> S103.py:23:25
|
21 | os.chmod("~/hidden_exec", stat.S_IXOTH) # OK
22 | os.chmod("/etc/passwd", stat.S_IWOTH) # Error
23 | os.chmod("/etc/passwd", 0o100000000) # Error
| ^^^^^^^^^^^ S103
| ^^^^^^^^^^^
|

View File

@@ -1,64 +1,73 @@
---
source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs
---
S104.py:9:1: S104 Possible binding to all interfaces
error[S104]: 9:1: Possible binding to all interfaces
--> S104.py:8:8
|
8 | # Error
9 | "0.0.0.0"
| ^^^^^^^^^ S104
| ^^^^^^^^^
10 | '0.0.0.0'
11 | f"0.0.0.0"
|
error[S104]: 10:1: Possible binding to all interfaces
S104.py:10:1: S104 Possible binding to all interfaces
--> S104.py:9:10
|
8 | # Error
9 | "0.0.0.0"
10 | '0.0.0.0'
| ^^^^^^^^^ S104
| ^^^^^^^^^
11 | f"0.0.0.0"
|
error[S104]: 11:3: Possible binding to all interfaces
S104.py:11:3: S104 Possible binding to all interfaces
--> S104.py:11:3
|
9 | "0.0.0.0"
10 | '0.0.0.0'
11 | f"0.0.0.0"
| ^^^^^^^ S104
| ^^^^^^^
|
error[S104]: 15:6: Possible binding to all interfaces
S104.py:15:6: S104 Possible binding to all interfaces
--> S104.py:15:6
|
14 | # Error
15 | func("0.0.0.0")
| ^^^^^^^^^ S104
| ^^^^^^^^^
|
error[S104]: 19:9: Possible binding to all interfaces
S104.py:19:9: S104 Possible binding to all interfaces
--> S104.py:19:9
|
18 | def my_func():
19 | x = "0.0.0.0"
| ^^^^^^^^^ S104
| ^^^^^^^^^
20 | print(x)
|
error[S104]: 24:1: Possible binding to all interfaces
S104.py:24:1: S104 Possible binding to all interfaces
--> S104.py:23:32
|
23 | # Implicit string concatenation
24 | "0.0.0.0" f"0.0.0.0{expr}0.0.0.0"
| ^^^^^^^^^ S104
| ^^^^^^^^^
|
error[S104]: 24:13: Possible binding to all interfaces
S104.py:24:13: S104 Possible binding to all interfaces
--> S104.py:24:13
|
23 | # Implicit string concatenation
24 | "0.0.0.0" f"0.0.0.0{expr}0.0.0.0"
| ^^^^^^^ S104
| ^^^^^^^
|
error[S104]: 24:26: Possible binding to all interfaces
S104.py:24:26: S104 Possible binding to all interfaces
--> S104.py:24:26
|
23 | # Implicit string concatenation
24 | "0.0.0.0" f"0.0.0.0{expr}0.0.0.0"
| ^^^^^^^ S104
| ^^^^^^^
|

View File

@@ -1,377 +1,415 @@
---
source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs
---
S105.py:13:12: S105 Possible hardcoded password assigned to: "password"
error[S105]: 13:12: Possible hardcoded password assigned to: "password"
--> S105.py:13:12
|
12 | # Errors
13 | password = "s3cr3t"
| ^^^^^^^^ S105
| ^^^^^^^^
14 | _pass = "s3cr3t"
15 | passwd = "s3cr3t"
|
error[S105]: 14:9: Possible hardcoded password assigned to: "_pass"
S105.py:14:9: S105 Possible hardcoded password assigned to: "_pass"
--> S105.py:14:9
|
12 | # Errors
13 | password = "s3cr3t"
14 | _pass = "s3cr3t"
| ^^^^^^^^ S105
| ^^^^^^^^
15 | passwd = "s3cr3t"
16 | pwd = "s3cr3t"
|
error[S105]: 15:10: Possible hardcoded password assigned to: "passwd"
S105.py:15:10: S105 Possible hardcoded password assigned to: "passwd"
--> S105.py:15:10
|
13 | password = "s3cr3t"
14 | _pass = "s3cr3t"
15 | passwd = "s3cr3t"
| ^^^^^^^^ S105
| ^^^^^^^^
16 | pwd = "s3cr3t"
17 | secret = "s3cr3t"
|
error[S105]: 16:7: Possible hardcoded password assigned to: "pwd"
S105.py:16:7: S105 Possible hardcoded password assigned to: "pwd"
--> S105.py:16:7
|
14 | _pass = "s3cr3t"
15 | passwd = "s3cr3t"
16 | pwd = "s3cr3t"
| ^^^^^^^^ S105
| ^^^^^^^^
17 | secret = "s3cr3t"
18 | token = "s3cr3t"
|
error[S105]: 17:10: Possible hardcoded password assigned to: "secret"
S105.py:17:10: S105 Possible hardcoded password assigned to: "secret"
--> S105.py:17:10
|
15 | passwd = "s3cr3t"
16 | pwd = "s3cr3t"
17 | secret = "s3cr3t"
| ^^^^^^^^ S105
| ^^^^^^^^
18 | token = "s3cr3t"
19 | secrete = "s3cr3t"
|
error[S105]: 18:9: Possible hardcoded password assigned to: "token"
S105.py:18:9: S105 Possible hardcoded password assigned to: "token"
--> S105.py:18:9
|
16 | pwd = "s3cr3t"
17 | secret = "s3cr3t"
18 | token = "s3cr3t"
| ^^^^^^^^ S105
| ^^^^^^^^
19 | secrete = "s3cr3t"
20 | safe = password = "s3cr3t"
|
error[S105]: 19:11: Possible hardcoded password assigned to: "secrete"
S105.py:19:11: S105 Possible hardcoded password assigned to: "secrete"
--> S105.py:19:11
|
17 | secret = "s3cr3t"
18 | token = "s3cr3t"
19 | secrete = "s3cr3t"
| ^^^^^^^^ S105
| ^^^^^^^^
20 | safe = password = "s3cr3t"
21 | password = safe = "s3cr3t"
|
error[S105]: 20:19: Possible hardcoded password assigned to: "password"
S105.py:20:19: S105 Possible hardcoded password assigned to: "password"
--> S105.py:20:19
|
18 | token = "s3cr3t"
19 | secrete = "s3cr3t"
20 | safe = password = "s3cr3t"
| ^^^^^^^^ S105
| ^^^^^^^^
21 | password = safe = "s3cr3t"
22 | PASSWORD = "s3cr3t"
|
error[S105]: 21:19: Possible hardcoded password assigned to: "password"
S105.py:21:19: S105 Possible hardcoded password assigned to: "password"
--> S105.py:21:19
|
19 | secrete = "s3cr3t"
20 | safe = password = "s3cr3t"
21 | password = safe = "s3cr3t"
| ^^^^^^^^ S105
| ^^^^^^^^
22 | PASSWORD = "s3cr3t"
23 | PassWord = "s3cr3t"
|
error[S105]: 22:12: Possible hardcoded password assigned to: "PASSWORD"
S105.py:22:12: S105 Possible hardcoded password assigned to: "PASSWORD"
--> S105.py:22:12
|
20 | safe = password = "s3cr3t"
21 | password = safe = "s3cr3t"
22 | PASSWORD = "s3cr3t"
| ^^^^^^^^ S105
| ^^^^^^^^
23 | PassWord = "s3cr3t"
|
error[S105]: 23:12: Possible hardcoded password assigned to: "PassWord"
S105.py:23:12: S105 Possible hardcoded password assigned to: "PassWord"
--> S105.py:23:12
|
21 | password = safe = "s3cr3t"
22 | PASSWORD = "s3cr3t"
23 | PassWord = "s3cr3t"
| ^^^^^^^^ S105
| ^^^^^^^^
24 |
25 | d["password"] = "s3cr3t"
|
error[S105]: 25:17: Possible hardcoded password assigned to: "password"
S105.py:25:17: S105 Possible hardcoded password assigned to: "password"
--> S105.py:25:17
|
23 | PassWord = "s3cr3t"
24 |
25 | d["password"] = "s3cr3t"
| ^^^^^^^^ S105
| ^^^^^^^^
26 | d["pass"] = "s3cr3t"
27 | d["passwd"] = "s3cr3t"
|
error[S105]: 26:13: Possible hardcoded password assigned to: "pass"
S105.py:26:13: S105 Possible hardcoded password assigned to: "pass"
--> S105.py:26:13
|
25 | d["password"] = "s3cr3t"
26 | d["pass"] = "s3cr3t"
| ^^^^^^^^ S105
| ^^^^^^^^
27 | d["passwd"] = "s3cr3t"
28 | d["pwd"] = "s3cr3t"
|
error[S105]: 27:15: Possible hardcoded password assigned to: "passwd"
S105.py:27:15: S105 Possible hardcoded password assigned to: "passwd"
--> S105.py:27:15
|
25 | d["password"] = "s3cr3t"
26 | d["pass"] = "s3cr3t"
27 | d["passwd"] = "s3cr3t"
| ^^^^^^^^ S105
| ^^^^^^^^
28 | d["pwd"] = "s3cr3t"
29 | d["secret"] = "s3cr3t"
|
error[S105]: 28:12: Possible hardcoded password assigned to: "pwd"
S105.py:28:12: S105 Possible hardcoded password assigned to: "pwd"
--> S105.py:28:12
|
26 | d["pass"] = "s3cr3t"
27 | d["passwd"] = "s3cr3t"
28 | d["pwd"] = "s3cr3t"
| ^^^^^^^^ S105
| ^^^^^^^^
29 | d["secret"] = "s3cr3t"
30 | d["token"] = "s3cr3t"
|
error[S105]: 29:15: Possible hardcoded password assigned to: "secret"
S105.py:29:15: S105 Possible hardcoded password assigned to: "secret"
--> S105.py:29:15
|
27 | d["passwd"] = "s3cr3t"
28 | d["pwd"] = "s3cr3t"
29 | d["secret"] = "s3cr3t"
| ^^^^^^^^ S105
| ^^^^^^^^
30 | d["token"] = "s3cr3t"
31 | d["secrete"] = "s3cr3t"
|
error[S105]: 30:14: Possible hardcoded password assigned to: "token"
S105.py:30:14: S105 Possible hardcoded password assigned to: "token"
--> S105.py:30:14
|
28 | d["pwd"] = "s3cr3t"
29 | d["secret"] = "s3cr3t"
30 | d["token"] = "s3cr3t"
| ^^^^^^^^ S105
| ^^^^^^^^
31 | d["secrete"] = "s3cr3t"
32 | safe = d["password"] = "s3cr3t"
|
error[S105]: 31:16: Possible hardcoded password assigned to: "secrete"
S105.py:31:16: S105 Possible hardcoded password assigned to: "secrete"
--> S105.py:31:16
|
29 | d["secret"] = "s3cr3t"
30 | d["token"] = "s3cr3t"
31 | d["secrete"] = "s3cr3t"
| ^^^^^^^^ S105
| ^^^^^^^^
32 | safe = d["password"] = "s3cr3t"
33 | d["password"] = safe = "s3cr3t"
|
error[S105]: 32:24: Possible hardcoded password assigned to: "password"
S105.py:32:24: S105 Possible hardcoded password assigned to: "password"
--> S105.py:32:24
|
30 | d["token"] = "s3cr3t"
31 | d["secrete"] = "s3cr3t"
32 | safe = d["password"] = "s3cr3t"
| ^^^^^^^^ S105
| ^^^^^^^^
33 | d["password"] = safe = "s3cr3t"
|
error[S105]: 33:24: Possible hardcoded password assigned to: "password"
S105.py:33:24: S105 Possible hardcoded password assigned to: "password"
--> S105.py:33:24
|
31 | d["secrete"] = "s3cr3t"
32 | safe = d["password"] = "s3cr3t"
33 | d["password"] = safe = "s3cr3t"
| ^^^^^^^^ S105
| ^^^^^^^^
|
error[S105]: 37:16: Possible hardcoded password assigned to: "password"
S105.py:37:16: S105 Possible hardcoded password assigned to: "password"
--> S105.py:37:16
|
36 | class MyClass:
37 | password = "s3cr3t"
| ^^^^^^^^ S105
| ^^^^^^^^
38 | safe = password
|
error[S105]: 41:20: Possible hardcoded password assigned to: "password"
S105.py:41:20: S105 Possible hardcoded password assigned to: "password"
--> S105.py:41:20
|
41 | MyClass.password = "s3cr3t"
| ^^^^^^^^ S105
| ^^^^^^^^
42 | MyClass._pass = "s3cr3t"
43 | MyClass.passwd = "s3cr3t"
|
error[S105]: 42:17: Possible hardcoded password assigned to: "_pass"
S105.py:42:17: S105 Possible hardcoded password assigned to: "_pass"
--> S105.py:42:17
|
41 | MyClass.password = "s3cr3t"
42 | MyClass._pass = "s3cr3t"
| ^^^^^^^^ S105
| ^^^^^^^^
43 | MyClass.passwd = "s3cr3t"
44 | MyClass.pwd = "s3cr3t"
|
error[S105]: 43:18: Possible hardcoded password assigned to: "passwd"
S105.py:43:18: S105 Possible hardcoded password assigned to: "passwd"
--> S105.py:43:18
|
41 | MyClass.password = "s3cr3t"
42 | MyClass._pass = "s3cr3t"
43 | MyClass.passwd = "s3cr3t"
| ^^^^^^^^ S105
| ^^^^^^^^
44 | MyClass.pwd = "s3cr3t"
45 | MyClass.secret = "s3cr3t"
|
error[S105]: 44:15: Possible hardcoded password assigned to: "pwd"
S105.py:44:15: S105 Possible hardcoded password assigned to: "pwd"
--> S105.py:44:15
|
42 | MyClass._pass = "s3cr3t"
43 | MyClass.passwd = "s3cr3t"
44 | MyClass.pwd = "s3cr3t"
| ^^^^^^^^ S105
| ^^^^^^^^
45 | MyClass.secret = "s3cr3t"
46 | MyClass.token = "s3cr3t"
|
error[S105]: 45:18: Possible hardcoded password assigned to: "secret"
S105.py:45:18: S105 Possible hardcoded password assigned to: "secret"
--> S105.py:45:18
|
43 | MyClass.passwd = "s3cr3t"
44 | MyClass.pwd = "s3cr3t"
45 | MyClass.secret = "s3cr3t"
| ^^^^^^^^ S105
| ^^^^^^^^
46 | MyClass.token = "s3cr3t"
47 | MyClass.secrete = "s3cr3t"
|
error[S105]: 46:17: Possible hardcoded password assigned to: "token"
S105.py:46:17: S105 Possible hardcoded password assigned to: "token"
--> S105.py:46:17
|
44 | MyClass.pwd = "s3cr3t"
45 | MyClass.secret = "s3cr3t"
46 | MyClass.token = "s3cr3t"
| ^^^^^^^^ S105
| ^^^^^^^^
47 | MyClass.secrete = "s3cr3t"
|
error[S105]: 47:19: Possible hardcoded password assigned to: "secrete"
S105.py:47:19: S105 Possible hardcoded password assigned to: "secrete"
--> S105.py:47:19
|
45 | MyClass.secret = "s3cr3t"
46 | MyClass.token = "s3cr3t"
47 | MyClass.secrete = "s3cr3t"
| ^^^^^^^^ S105
| ^^^^^^^^
48 |
49 | password == "s3cr3t"
|
error[S105]: 49:13: Possible hardcoded password assigned to: "password"
S105.py:49:13: S105 Possible hardcoded password assigned to: "password"
--> S105.py:49:13
|
47 | MyClass.secrete = "s3cr3t"
48 |
49 | password == "s3cr3t"
| ^^^^^^^^ S105
| ^^^^^^^^
50 | _pass == "s3cr3t"
51 | passwd == "s3cr3t"
|
error[S105]: 50:10: Possible hardcoded password assigned to: "_pass"
S105.py:50:10: S105 Possible hardcoded password assigned to: "_pass"
--> S105.py:50:10
|
49 | password == "s3cr3t"
50 | _pass == "s3cr3t"
| ^^^^^^^^ S105
| ^^^^^^^^
51 | passwd == "s3cr3t"
52 | pwd == "s3cr3t"
|
error[S105]: 51:11: Possible hardcoded password assigned to: "passwd"
S105.py:51:11: S105 Possible hardcoded password assigned to: "passwd"
--> S105.py:51:11
|
49 | password == "s3cr3t"
50 | _pass == "s3cr3t"
51 | passwd == "s3cr3t"
| ^^^^^^^^ S105
| ^^^^^^^^
52 | pwd == "s3cr3t"
53 | secret == "s3cr3t"
|
error[S105]: 52:8: Possible hardcoded password assigned to: "pwd"
S105.py:52:8: S105 Possible hardcoded password assigned to: "pwd"
--> S105.py:52:8
|
50 | _pass == "s3cr3t"
51 | passwd == "s3cr3t"
52 | pwd == "s3cr3t"
| ^^^^^^^^ S105
| ^^^^^^^^
53 | secret == "s3cr3t"
54 | token == "s3cr3t"
|
error[S105]: 53:11: Possible hardcoded password assigned to: "secret"
S105.py:53:11: S105 Possible hardcoded password assigned to: "secret"
--> S105.py:53:11
|
51 | passwd == "s3cr3t"
52 | pwd == "s3cr3t"
53 | secret == "s3cr3t"
| ^^^^^^^^ S105
| ^^^^^^^^
54 | token == "s3cr3t"
55 | secrete == "s3cr3t"
|
error[S105]: 54:10: Possible hardcoded password assigned to: "token"
S105.py:54:10: S105 Possible hardcoded password assigned to: "token"
--> S105.py:54:10
|
52 | pwd == "s3cr3t"
53 | secret == "s3cr3t"
54 | token == "s3cr3t"
| ^^^^^^^^ S105
| ^^^^^^^^
55 | secrete == "s3cr3t"
56 | password == safe == "s3cr3t"
|
error[S105]: 55:12: Possible hardcoded password assigned to: "secrete"
S105.py:55:12: S105 Possible hardcoded password assigned to: "secrete"
--> S105.py:55:12
|
53 | secret == "s3cr3t"
54 | token == "s3cr3t"
55 | secrete == "s3cr3t"
| ^^^^^^^^ S105
| ^^^^^^^^
56 | password == safe == "s3cr3t"
|
error[S105]: 56:21: Possible hardcoded password assigned to: "password"
S105.py:56:21: S105 Possible hardcoded password assigned to: "password"
--> S105.py:56:21
|
54 | token == "s3cr3t"
55 | secrete == "s3cr3t"
56 | password == safe == "s3cr3t"
| ^^^^^^^^ S105
| ^^^^^^^^
57 |
58 | if token == "1\n2":
|
error[S105]: 58:13: Possible hardcoded password assigned to: "token"
S105.py:58:13: S105 Possible hardcoded password assigned to: "token"
--> S105.py:58:13
|
56 | password == safe == "s3cr3t"
57 |
58 | if token == "1\n2":
| ^^^^^^ S105
| ^^^^^^
59 | pass
|
error[S105]: 61:13: Possible hardcoded password assigned to: "token"
S105.py:61:13: S105 Possible hardcoded password assigned to: "token"
--> S105.py:61:13
|
59 | pass
60 |
61 | if token == "3\t4":
| ^^^^^^ S105
| ^^^^^^
62 | pass
|
error[S105]: 64:13: Possible hardcoded password assigned to: "token"
S105.py:64:13: S105 Possible hardcoded password assigned to: "token"
--> S105.py:64:13
|
62 | pass
63 |
64 | if token == "5\r6":
| ^^^^^^ S105
| ^^^^^^
65 | pass
|

View File

@@ -1,11 +1,11 @@
---
source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs
---
S106.py:14:9: S106 Possible hardcoded password assigned to argument: "password"
error[S106]: 14:9: Possible hardcoded password assigned to argument: "password"
--> S106.py:14:9
|
13 | # Error
14 | func(1, password="s3cr3t")
| ^^^^^^^^^^^^^^^^^ S106
| ^^^^^^^^^^^^^^^^^
|

View File

@@ -1,39 +1,43 @@
---
source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs
---
S107.py:5:29: S107 Possible hardcoded password assigned to function default: "password"
error[S107]: 5:29: Possible hardcoded password assigned to function default: "password"
--> S107.py:5:29
|
5 | def default(first, password="default"):
| ^^^^^^^^^ S107
| ^^^^^^^^^
6 | pass
|
error[S107]: 13:45: Possible hardcoded password assigned to function default: "password"
S107.py:13:45: S107 Possible hardcoded password assigned to function default: "password"
--> S107.py:13:45
|
13 | def default_posonly(first, /, pos, password="posonly"):
| ^^^^^^^^^ S107
| ^^^^^^^^^
14 | pass
|
error[S107]: 21:39: Possible hardcoded password assigned to function default: "password"
S107.py:21:39: S107 Possible hardcoded password assigned to function default: "password"
--> S107.py:21:39
|
21 | def default_kwonly(first, *, password="kwonly"):
| ^^^^^^^^ S107
| ^^^^^^^^
22 | pass
|
error[S107]: 29:39: Possible hardcoded password assigned to function default: "secret"
S107.py:29:39: S107 Possible hardcoded password assigned to function default: "secret"
--> S107.py:29:39
|
29 | def default_all(first, /, pos, secret="posonly", *, password="kwonly"):
| ^^^^^^^^^ S107
| ^^^^^^^^^
30 | pass
|
error[S107]: 29:62: Possible hardcoded password assigned to function default: "password"
S107.py:29:62: S107 Possible hardcoded password assigned to function default: "password"
--> S107.py:29:62
|
29 | def default_all(first, /, pos, secret="posonly", *, password="kwonly"):
| ^^^^^^^^ S107
| ^^^^^^^^
30 | pass
|

View File

@@ -1,64 +1,72 @@
---
source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs
---
S108.py:5:11: S108 Probable insecure usage of temporary file or directory: "/tmp/abc"
error[S108]: 5:11: Probable insecure usage of temporary file or directory: "/tmp/abc"
--> S108.py:5:11
|
3 | f.write("def")
4 |
5 | with open("/tmp/abc", "w") as f:
| ^^^^^^^^^^ S108
| ^^^^^^^^^^
6 | f.write("def")
|
error[S108]: 8:13: Probable insecure usage of temporary file or directory: "/tmp/abc"
S108.py:8:13: S108 Probable insecure usage of temporary file or directory: "/tmp/abc"
--> S108.py:8:13
|
6 | f.write("def")
7 |
8 | with open(f"/tmp/abc", "w") as f:
| ^^^^^^^^ S108
| ^^^^^^^^
9 | f.write("def")
|
error[S108]: 11:11: Probable insecure usage of temporary file or directory: "/var/tmp/123"
S108.py:11:11: S108 Probable insecure usage of temporary file or directory: "/var/tmp/123"
--> S108.py:11:11
|
9 | f.write("def")
10 |
11 | with open("/var/tmp/123", "w") as f:
| ^^^^^^^^^^^^^^ S108
| ^^^^^^^^^^^^^^
12 | f.write("def")
|
error[S108]: 14:11: Probable insecure usage of temporary file or directory: "/dev/shm/unit/test"
S108.py:14:11: S108 Probable insecure usage of temporary file or directory: "/dev/shm/unit/test"
--> S108.py:14:11
|
12 | f.write("def")
13 |
14 | with open("/dev/shm/unit/test", "w") as f:
| ^^^^^^^^^^^^^^^^^^^^ S108
| ^^^^^^^^^^^^^^^^^^^^
15 | f.write("def")
|
error[S108]: 22:11: Probable insecure usage of temporary file or directory: "/tmp/abc"
S108.py:22:11: S108 Probable insecure usage of temporary file or directory: "/tmp/abc"
--> S108.py:22:11
|
21 | # Implicit string concatenation
22 | with open("/tmp/" "abc", "w") as f:
| ^^^^^^^^^^^^^ S108
| ^^^^^^^^^^^^^
23 | f.write("def")
|
error[S108]: 25:11: Probable insecure usage of temporary file or directory: "/tmp/abc"
S108.py:25:11: S108 Probable insecure usage of temporary file or directory: "/tmp/abc"
--> S108.py:25:11
|
23 | f.write("def")
24 |
25 | with open("/tmp/abc" f"/tmp/abc", "w") as f:
| ^^^^^^^^^^ S108
| ^^^^^^^^^^
26 | f.write("def")
|
error[S108]: 25:24: Probable insecure usage of temporary file or directory: "/tmp/abc"
S108.py:25:24: S108 Probable insecure usage of temporary file or directory: "/tmp/abc"
--> S108.py:25:24
|
23 | f.write("def")
24 |
25 | with open("/tmp/abc" f"/tmp/abc", "w") as f:
| ^^^^^^^^ S108
| ^^^^^^^^
26 | f.write("def")
|

View File

@@ -1,72 +1,81 @@
---
source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs
---
S108.py:5:11: S108 Probable insecure usage of temporary file or directory: "/tmp/abc"
error[S108]: 5:11: Probable insecure usage of temporary file or directory: "/tmp/abc"
--> S108.py:5:11
|
3 | f.write("def")
4 |
5 | with open("/tmp/abc", "w") as f:
| ^^^^^^^^^^ S108
| ^^^^^^^^^^
6 | f.write("def")
|
error[S108]: 8:13: Probable insecure usage of temporary file or directory: "/tmp/abc"
S108.py:8:13: S108 Probable insecure usage of temporary file or directory: "/tmp/abc"
--> S108.py:8:13
|
6 | f.write("def")
7 |
8 | with open(f"/tmp/abc", "w") as f:
| ^^^^^^^^ S108
| ^^^^^^^^
9 | f.write("def")
|
error[S108]: 11:11: Probable insecure usage of temporary file or directory: "/var/tmp/123"
S108.py:11:11: S108 Probable insecure usage of temporary file or directory: "/var/tmp/123"
--> S108.py:11:11
|
9 | f.write("def")
10 |
11 | with open("/var/tmp/123", "w") as f:
| ^^^^^^^^^^^^^^ S108
| ^^^^^^^^^^^^^^
12 | f.write("def")
|
error[S108]: 14:11: Probable insecure usage of temporary file or directory: "/dev/shm/unit/test"
S108.py:14:11: S108 Probable insecure usage of temporary file or directory: "/dev/shm/unit/test"
--> S108.py:14:11
|
12 | f.write("def")
13 |
14 | with open("/dev/shm/unit/test", "w") as f:
| ^^^^^^^^^^^^^^^^^^^^ S108
| ^^^^^^^^^^^^^^^^^^^^
15 | f.write("def")
|
error[S108]: 18:11: Probable insecure usage of temporary file or directory: "/foo/bar"
S108.py:18:11: S108 Probable insecure usage of temporary file or directory: "/foo/bar"
--> S108.py:18:11
|
17 | # not ok by config
18 | with open("/foo/bar", "w") as f:
| ^^^^^^^^^^ S108
| ^^^^^^^^^^
19 | f.write("def")
|
error[S108]: 22:11: Probable insecure usage of temporary file or directory: "/tmp/abc"
S108.py:22:11: S108 Probable insecure usage of temporary file or directory: "/tmp/abc"
--> S108.py:22:11
|
21 | # Implicit string concatenation
22 | with open("/tmp/" "abc", "w") as f:
| ^^^^^^^^^^^^^ S108
| ^^^^^^^^^^^^^
23 | f.write("def")
|
error[S108]: 25:11: Probable insecure usage of temporary file or directory: "/tmp/abc"
S108.py:25:11: S108 Probable insecure usage of temporary file or directory: "/tmp/abc"
--> S108.py:25:11
|
23 | f.write("def")
24 |
25 | with open("/tmp/abc" f"/tmp/abc", "w") as f:
| ^^^^^^^^^^ S108
| ^^^^^^^^^^
26 | f.write("def")
|
error[S108]: 25:24: Probable insecure usage of temporary file or directory: "/tmp/abc"
S108.py:25:24: S108 Probable insecure usage of temporary file or directory: "/tmp/abc"
--> S108.py:25:24
|
23 | f.write("def")
24 |
25 | with open("/tmp/abc" f"/tmp/abc", "w") as f:
| ^^^^^^^^ S108
| ^^^^^^^^
26 | f.write("def")
|

View File

@@ -1,26 +1,27 @@
---
source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs
---
S110.py:3:1: S110 `try`-`except`-`pass` detected, consider logging the exception
error[S110]: 3:1: `try`-`except`-`pass` detected, consider logging the exception
--> S110.py:2:9
|
1 | try:
2 | pass
3 | / except Exception:
4 | | pass
| |________^ S110
| |________^
5 |
6 | try:
|
error[S110]: 8:1: `try`-`except`-`pass` detected, consider logging the exception
S110.py:8:1: S110 `try`-`except`-`pass` detected, consider logging the exception
--> S110.py:7:9
|
6 | try:
7 | pass
8 | / except:
9 | | pass
| |________^ S110
| |________^
10 |
11 | try:
|

View File

@@ -1,35 +1,37 @@
---
source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs
---
S110.py:3:1: S110 `try`-`except`-`pass` detected, consider logging the exception
error[S110]: 3:1: `try`-`except`-`pass` detected, consider logging the exception
--> S110.py:2:9
|
1 | try:
2 | pass
3 | / except Exception:
4 | | pass
| |________^ S110
| |________^
5 |
6 | try:
|
error[S110]: 8:1: `try`-`except`-`pass` detected, consider logging the exception
S110.py:8:1: S110 `try`-`except`-`pass` detected, consider logging the exception
--> S110.py:7:9
|
6 | try:
7 | pass
8 | / except:
9 | | pass
| |________^ S110
| |________^
10 |
11 | try:
|
error[S110]: 13:1: `try`-`except`-`pass` detected, consider logging the exception
S110.py:13:1: S110 `try`-`except`-`pass` detected, consider logging the exception
--> S110.py:12:9
|
11 | try:
12 | pass
13 | / except ValueError:
14 | | pass
| |________^ S110
| |________^
|

View File

@@ -1,48 +1,51 @@
---
source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs
---
S112.py:3:1: S112 `try`-`except`-`continue` detected, consider logging the exception
error[S112]: 3:1: `try`-`except`-`continue` detected, consider logging the exception
--> S112.py:2:9
|
1 | try:
2 | pass
3 | / except Exception:
4 | | continue
| |____________^ S112
| |____________^
5 |
6 | try:
|
error[S112]: 8:1: `try`-`except`-`continue` detected, consider logging the exception
S112.py:8:1: S112 `try`-`except`-`continue` detected, consider logging the exception
--> S112.py:7:9
|
6 | try:
7 | pass
8 | / except:
9 | | continue
| |____________^ S112
| |____________^
10 |
11 | try:
|
error[S112]: 13:1: `try`-`except`-`continue` detected, consider logging the exception
S112.py:13:1: S112 `try`-`except`-`continue` detected, consider logging the exception
--> S112.py:12:9
|
11 | try:
12 | pass
13 | / except (Exception,):
14 | | continue
| |____________^ S112
| |____________^
15 |
16 | try:
|
error[S112]: 18:1: `try`-`except`-`continue` detected, consider logging the exception
S112.py:18:1: S112 `try`-`except`-`continue` detected, consider logging the exception
--> S112.py:17:9
|
16 | try:
17 | pass
18 | / except (Exception, ValueError):
19 | | continue
| |____________^ S112
| |____________^
20 |
21 | try:
|

View File

@@ -1,238 +1,262 @@
---
source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs
assertion_line: 81
---
S113.py:46:1: S113 Probable use of `requests` call without timeout
error[S113]: 46:1: Probable use of `requests` call without timeout
--> S113.py:45:9
|
45 | # Errors
46 | requests.get('https://gmail.com')
| ^^^^^^^^^^^^ S113
| ^^^^^^^^^^^^
47 | requests.get('https://gmail.com', timeout=None)
48 | requests.post('https://gmail.com')
|
error[S113]: 47:35: Probable use of `requests` call with timeout set to `None`
S113.py:47:35: S113 Probable use of `requests` call with timeout set to `None`
--> S113.py:47:35
|
45 | # Errors
46 | requests.get('https://gmail.com')
47 | requests.get('https://gmail.com', timeout=None)
| ^^^^^^^^^^^^ S113
| ^^^^^^^^^^^^
48 | requests.post('https://gmail.com')
49 | requests.post('https://gmail.com', timeout=None)
|
error[S113]: 48:1: Probable use of `requests` call without timeout
S113.py:48:1: S113 Probable use of `requests` call without timeout
--> S113.py:47:48
|
46 | requests.get('https://gmail.com')
47 | requests.get('https://gmail.com', timeout=None)
48 | requests.post('https://gmail.com')
| ^^^^^^^^^^^^^ S113
| ^^^^^^^^^^^^^
49 | requests.post('https://gmail.com', timeout=None)
50 | requests.put('https://gmail.com')
|
error[S113]: 49:36: Probable use of `requests` call with timeout set to `None`
S113.py:49:36: S113 Probable use of `requests` call with timeout set to `None`
--> S113.py:49:36
|
47 | requests.get('https://gmail.com', timeout=None)
48 | requests.post('https://gmail.com')
49 | requests.post('https://gmail.com', timeout=None)
| ^^^^^^^^^^^^ S113
| ^^^^^^^^^^^^
50 | requests.put('https://gmail.com')
51 | requests.put('https://gmail.com', timeout=None)
|
error[S113]: 50:1: Probable use of `requests` call without timeout
S113.py:50:1: S113 Probable use of `requests` call without timeout
--> S113.py:49:49
|
48 | requests.post('https://gmail.com')
49 | requests.post('https://gmail.com', timeout=None)
50 | requests.put('https://gmail.com')
| ^^^^^^^^^^^^ S113
| ^^^^^^^^^^^^
51 | requests.put('https://gmail.com', timeout=None)
52 | requests.delete('https://gmail.com')
|
error[S113]: 51:35: Probable use of `requests` call with timeout set to `None`
S113.py:51:35: S113 Probable use of `requests` call with timeout set to `None`
--> S113.py:51:35
|
49 | requests.post('https://gmail.com', timeout=None)
50 | requests.put('https://gmail.com')
51 | requests.put('https://gmail.com', timeout=None)
| ^^^^^^^^^^^^ S113
| ^^^^^^^^^^^^
52 | requests.delete('https://gmail.com')
53 | requests.delete('https://gmail.com', timeout=None)
|
error[S113]: 52:1: Probable use of `requests` call without timeout
S113.py:52:1: S113 Probable use of `requests` call without timeout
--> S113.py:51:48
|
50 | requests.put('https://gmail.com')
51 | requests.put('https://gmail.com', timeout=None)
52 | requests.delete('https://gmail.com')
| ^^^^^^^^^^^^^^^ S113
| ^^^^^^^^^^^^^^^
53 | requests.delete('https://gmail.com', timeout=None)
54 | requests.patch('https://gmail.com')
|
error[S113]: 53:38: Probable use of `requests` call with timeout set to `None`
S113.py:53:38: S113 Probable use of `requests` call with timeout set to `None`
--> S113.py:53:38
|
51 | requests.put('https://gmail.com', timeout=None)
52 | requests.delete('https://gmail.com')
53 | requests.delete('https://gmail.com', timeout=None)
| ^^^^^^^^^^^^ S113
| ^^^^^^^^^^^^
54 | requests.patch('https://gmail.com')
55 | requests.patch('https://gmail.com', timeout=None)
|
error[S113]: 54:1: Probable use of `requests` call without timeout
S113.py:54:1: S113 Probable use of `requests` call without timeout
--> S113.py:53:51
|
52 | requests.delete('https://gmail.com')
53 | requests.delete('https://gmail.com', timeout=None)
54 | requests.patch('https://gmail.com')
| ^^^^^^^^^^^^^^ S113
| ^^^^^^^^^^^^^^
55 | requests.patch('https://gmail.com', timeout=None)
56 | requests.options('https://gmail.com')
|
error[S113]: 55:37: Probable use of `requests` call with timeout set to `None`
S113.py:55:37: S113 Probable use of `requests` call with timeout set to `None`
--> S113.py:55:37
|
53 | requests.delete('https://gmail.com', timeout=None)
54 | requests.patch('https://gmail.com')
55 | requests.patch('https://gmail.com', timeout=None)
| ^^^^^^^^^^^^ S113
| ^^^^^^^^^^^^
56 | requests.options('https://gmail.com')
57 | requests.options('https://gmail.com', timeout=None)
|
error[S113]: 56:1: Probable use of `requests` call without timeout
S113.py:56:1: S113 Probable use of `requests` call without timeout
--> S113.py:55:50
|
54 | requests.patch('https://gmail.com')
55 | requests.patch('https://gmail.com', timeout=None)
56 | requests.options('https://gmail.com')
| ^^^^^^^^^^^^^^^^ S113
| ^^^^^^^^^^^^^^^^
57 | requests.options('https://gmail.com', timeout=None)
58 | requests.head('https://gmail.com')
|
error[S113]: 57:39: Probable use of `requests` call with timeout set to `None`
S113.py:57:39: S113 Probable use of `requests` call with timeout set to `None`
--> S113.py:57:39
|
55 | requests.patch('https://gmail.com', timeout=None)
56 | requests.options('https://gmail.com')
57 | requests.options('https://gmail.com', timeout=None)
| ^^^^^^^^^^^^ S113
| ^^^^^^^^^^^^
58 | requests.head('https://gmail.com')
59 | requests.head('https://gmail.com', timeout=None)
|
error[S113]: 58:1: Probable use of `requests` call without timeout
S113.py:58:1: S113 Probable use of `requests` call without timeout
--> S113.py:57:52
|
56 | requests.options('https://gmail.com')
57 | requests.options('https://gmail.com', timeout=None)
58 | requests.head('https://gmail.com')
| ^^^^^^^^^^^^^ S113
| ^^^^^^^^^^^^^
59 | requests.head('https://gmail.com', timeout=None)
|
error[S113]: 59:36: Probable use of `requests` call with timeout set to `None`
S113.py:59:36: S113 Probable use of `requests` call with timeout set to `None`
--> S113.py:59:36
|
57 | requests.options('https://gmail.com', timeout=None)
58 | requests.head('https://gmail.com')
59 | requests.head('https://gmail.com', timeout=None)
| ^^^^^^^^^^^^ S113
| ^^^^^^^^^^^^
60 |
61 | httpx.get('https://gmail.com', timeout=None)
|
error[S113]: 61:32: Probable use of `httpx` call with timeout set to `None`
S113.py:61:32: S113 Probable use of `httpx` call with timeout set to `None`
--> S113.py:61:32
|
59 | requests.head('https://gmail.com', timeout=None)
60 |
61 | httpx.get('https://gmail.com', timeout=None)
| ^^^^^^^^^^^^ S113
| ^^^^^^^^^^^^
62 | httpx.post('https://gmail.com', timeout=None)
63 | httpx.put('https://gmail.com', timeout=None)
|
error[S113]: 62:33: Probable use of `httpx` call with timeout set to `None`
S113.py:62:33: S113 Probable use of `httpx` call with timeout set to `None`
--> S113.py:62:33
|
61 | httpx.get('https://gmail.com', timeout=None)
62 | httpx.post('https://gmail.com', timeout=None)
| ^^^^^^^^^^^^ S113
| ^^^^^^^^^^^^
63 | httpx.put('https://gmail.com', timeout=None)
64 | httpx.delete('https://gmail.com', timeout=None)
|
error[S113]: 63:32: Probable use of `httpx` call with timeout set to `None`
S113.py:63:32: S113 Probable use of `httpx` call with timeout set to `None`
--> S113.py:63:32
|
61 | httpx.get('https://gmail.com', timeout=None)
62 | httpx.post('https://gmail.com', timeout=None)
63 | httpx.put('https://gmail.com', timeout=None)
| ^^^^^^^^^^^^ S113
| ^^^^^^^^^^^^
64 | httpx.delete('https://gmail.com', timeout=None)
65 | httpx.patch('https://gmail.com', timeout=None)
|
error[S113]: 64:35: Probable use of `httpx` call with timeout set to `None`
S113.py:64:35: S113 Probable use of `httpx` call with timeout set to `None`
--> S113.py:64:35
|
62 | httpx.post('https://gmail.com', timeout=None)
63 | httpx.put('https://gmail.com', timeout=None)
64 | httpx.delete('https://gmail.com', timeout=None)
| ^^^^^^^^^^^^ S113
| ^^^^^^^^^^^^
65 | httpx.patch('https://gmail.com', timeout=None)
66 | httpx.options('https://gmail.com', timeout=None)
|
error[S113]: 65:34: Probable use of `httpx` call with timeout set to `None`
S113.py:65:34: S113 Probable use of `httpx` call with timeout set to `None`
--> S113.py:65:34
|
63 | httpx.put('https://gmail.com', timeout=None)
64 | httpx.delete('https://gmail.com', timeout=None)
65 | httpx.patch('https://gmail.com', timeout=None)
| ^^^^^^^^^^^^ S113
| ^^^^^^^^^^^^
66 | httpx.options('https://gmail.com', timeout=None)
67 | httpx.head('https://gmail.com', timeout=None)
|
error[S113]: 66:36: Probable use of `httpx` call with timeout set to `None`
S113.py:66:36: S113 Probable use of `httpx` call with timeout set to `None`
--> S113.py:66:36
|
64 | httpx.delete('https://gmail.com', timeout=None)
65 | httpx.patch('https://gmail.com', timeout=None)
66 | httpx.options('https://gmail.com', timeout=None)
| ^^^^^^^^^^^^ S113
| ^^^^^^^^^^^^
67 | httpx.head('https://gmail.com', timeout=None)
68 | httpx.Client(timeout=None)
|
error[S113]: 67:33: Probable use of `httpx` call with timeout set to `None`
S113.py:67:33: S113 Probable use of `httpx` call with timeout set to `None`
--> S113.py:67:33
|
65 | httpx.patch('https://gmail.com', timeout=None)
66 | httpx.options('https://gmail.com', timeout=None)
67 | httpx.head('https://gmail.com', timeout=None)
| ^^^^^^^^^^^^ S113
| ^^^^^^^^^^^^
68 | httpx.Client(timeout=None)
69 | httpx.AsyncClient(timeout=None)
|
error[S113]: 68:14: Probable use of `httpx` call with timeout set to `None`
S113.py:68:14: S113 Probable use of `httpx` call with timeout set to `None`
--> S113.py:68:14
|
66 | httpx.options('https://gmail.com', timeout=None)
67 | httpx.head('https://gmail.com', timeout=None)
68 | httpx.Client(timeout=None)
| ^^^^^^^^^^^^ S113
| ^^^^^^^^^^^^
69 | httpx.AsyncClient(timeout=None)
|
error[S113]: 69:19: Probable use of `httpx` call with timeout set to `None`
S113.py:69:19: S113 Probable use of `httpx` call with timeout set to `None`
--> S113.py:69:19
|
67 | httpx.head('https://gmail.com', timeout=None)
68 | httpx.Client(timeout=None)
69 | httpx.AsyncClient(timeout=None)
| ^^^^^^^^^^^^ S113
| ^^^^^^^^^^^^
70 |
71 | with httpx.Client(timeout=None) as client:
|
error[S113]: 71:19: Probable use of `httpx` call with timeout set to `None`
S113.py:71:19: S113 Probable use of `httpx` call with timeout set to `None`
--> S113.py:71:19
|
69 | httpx.AsyncClient(timeout=None)
70 |
71 | with httpx.Client(timeout=None) as client:
| ^^^^^^^^^^^^ S113
| ^^^^^^^^^^^^
72 | client.get('https://gmail.com')
|

View File

@@ -1,13 +1,13 @@
---
source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs
---
S201.py:10:9: S201 Use of `debug=True` in Flask app detected
error[S201]: 10:9: Use of `debug=True` in Flask app detected
--> S201.py:10:9
|
9 | # OK
10 | app.run(debug=True)
| ^^^^^^^^^^ S201
| ^^^^^^^^^^
11 |
12 | # Errors
|

View File

@@ -1,49 +1,53 @@
---
source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs
---
S202.py:8:5: S202 Uses of `tarfile.extractall()`
error[S202]: 8:5: Uses of `tarfile.extractall()`
--> S202.py:8:5
|
6 | def unsafe_archive_handler(filename):
7 | tar = tarfile.open(filename)
8 | tar.extractall(path=tempfile.mkdtemp())
| ^^^^^^^^^^^^^^ S202
| ^^^^^^^^^^^^^^
9 | tar.close()
|
error[S202]: 14:5: Uses of `tarfile.extractall()`
S202.py:14:5: S202 Uses of `tarfile.extractall()`
--> S202.py:14:5
|
12 | def managed_members_archive_handler(filename):
13 | tar = tarfile.open(filename)
14 | tar.extractall(path=tempfile.mkdtemp(), members=members_filter(tar))
| ^^^^^^^^^^^^^^ S202
| ^^^^^^^^^^^^^^
15 | tar.close()
|
error[S202]: 20:5: Uses of `tarfile.extractall()`
S202.py:20:5: S202 Uses of `tarfile.extractall()`
--> S202.py:20:5
|
18 | def list_members_archive_handler(filename):
19 | tar = tarfile.open(filename)
20 | tar.extractall(path=tempfile.mkdtemp(), members=[])
| ^^^^^^^^^^^^^^ S202
| ^^^^^^^^^^^^^^
21 | tar.close()
|
error[S202]: 26:5: Uses of `tarfile.extractall()`
S202.py:26:5: S202 Uses of `tarfile.extractall()`
--> S202.py:26:5
|
24 | def provided_members_archive_handler(filename):
25 | tar = tarfile.open(filename)
26 | tarfile.extractall(path=tempfile.mkdtemp(), members=tar)
| ^^^^^^^^^^^^^^^^^^ S202
| ^^^^^^^^^^^^^^^^^^
27 | tar.close()
|
error[S202]: 38:5: Uses of `tarfile.extractall()`
S202.py:38:5: S202 Uses of `tarfile.extractall()`
--> S202.py:38:5
|
36 | def filter_fully_trusted(filename):
37 | tar = tarfile.open(filename)
38 | tarfile.extractall(path=tempfile.mkdtemp(), filter="fully_trusted")
| ^^^^^^^^^^^^^^^^^^ S202
| ^^^^^^^^^^^^^^^^^^
39 | tar.close()
|

View File

@@ -1,12 +1,12 @@
---
source: crates/ruff_linter/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
error[S301]: 3:1: `pickle` and modules that wrap it can be unsafe when used to deserialize untrusted data, possible security issue
--> S301.py:2:1
|
1 | import pickle
2 |
3 | pickle.loads()
| ^^^^^^^^^^^^^^ S301
| ^^^^^^^^^^^^^^
|

View File

@@ -1,20 +1,21 @@
---
source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs
---
S307.py:3:7: S307 Use of possibly insecure function; consider using `ast.literal_eval`
error[S307]: 3:7: Use of possibly insecure function; consider using `ast.literal_eval`
--> S307.py:3:7
|
1 | import os
2 |
3 | print(eval("1+1")) # S307
| ^^^^^^^^^^^ S307
| ^^^^^^^^^^^
4 | print(eval("os.getcwd()")) # S307
|
error[S307]: 4:7: Use of possibly insecure function; consider using `ast.literal_eval`
S307.py:4:7: S307 Use of possibly insecure function; consider using `ast.literal_eval`
--> S307.py:4:7
|
3 | print(eval("1+1")) # S307
4 | print(eval("os.getcwd()")) # S307
| ^^^^^^^^^^^^^^^^^^^ S307
| ^^^^^^^^^^^^^^^^^^^
|

View File

@@ -1,34 +1,37 @@
---
source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs
---
S308.py:5:12: S308 Use of `mark_safe` may expose cross-site scripting vulnerabilities
error[S308]: 5:12: Use of `mark_safe` may expose cross-site scripting vulnerabilities
--> S308.py:5:12
|
4 | def some_func():
5 | return mark_safe('<script>alert("evil!")</script>')
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S308
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
error[S308]: 8:1: Use of `mark_safe` may expose cross-site scripting vulnerabilities
S308.py:8:1: S308 Use of `mark_safe` may expose cross-site scripting vulnerabilities
--> S308.py:8:1
|
8 | @mark_safe
| ^^^^^^^^^^ S308
| ^^^^^^^^^^
9 | def some_func():
10 | return '<script>alert("evil!")</script>'
|
error[S308]: 17:12: Use of `mark_safe` may expose cross-site scripting vulnerabilities
S308.py:17:12: S308 Use of `mark_safe` may expose cross-site scripting vulnerabilities
--> S308.py:17:12
|
16 | def some_func():
17 | return mark_safe('<script>alert("evil!")</script>')
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S308
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
error[S308]: 20:1: Use of `mark_safe` may expose cross-site scripting vulnerabilities
S308.py:20:1: S308 Use of `mark_safe` may expose cross-site scripting vulnerabilities
--> S308.py:20:1
|
20 | @mark_safe
| ^^^^^^^^^^ S308
| ^^^^^^^^^^
21 | def some_func():
22 | return '<script>alert("evil!")</script>'
|

View File

@@ -1,232 +1,257 @@
---
source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs
---
S310.py:6:1: S310 Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected.
error[S310]: 6:1: Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected.
--> S310.py:5:62
|
4 | urllib.request.urlopen(url=f'http://www.google.com')
5 | urllib.request.urlopen(url='http://' + 'www' + '.google.com')
6 | urllib.request.urlopen(url='http://www.google.com', **kwargs)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S310
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
7 | urllib.request.urlopen(url=f'http://www.google.com', **kwargs)
8 | urllib.request.urlopen('http://www.google.com')
|
error[S310]: 7:1: Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected.
S310.py:7:1: S310 Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected.
--> S310.py:6:62
|
5 | urllib.request.urlopen(url='http://' + 'www' + '.google.com')
6 | urllib.request.urlopen(url='http://www.google.com', **kwargs)
7 | urllib.request.urlopen(url=f'http://www.google.com', **kwargs)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S310
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
8 | urllib.request.urlopen('http://www.google.com')
9 | urllib.request.urlopen(f'http://www.google.com')
|
error[S310]: 10:1: Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected.
S310.py:10:1: S310 Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected.
--> S310.py:9:49
|
8 | urllib.request.urlopen('http://www.google.com')
9 | urllib.request.urlopen(f'http://www.google.com')
10 | urllib.request.urlopen('file:///foo/bar/baz')
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S310
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
11 | urllib.request.urlopen(url)
|
error[S310]: 11:1: Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected.
S310.py:11:1: S310 Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected.
--> S310.py:10:46
|
9 | urllib.request.urlopen(f'http://www.google.com')
10 | urllib.request.urlopen('file:///foo/bar/baz')
11 | urllib.request.urlopen(url)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ S310
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
12 |
13 | urllib.request.Request(url='http://www.google.com')
|
error[S310]: 16:1: Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected.
S310.py:16:1: S310 Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected.
--> S310.py:15:62
|
14 | urllib.request.Request(url=f'http://www.google.com')
15 | urllib.request.Request(url='http://' + 'www' + '.google.com')
16 | urllib.request.Request(url='http://www.google.com', **kwargs)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S310
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
17 | urllib.request.Request(url=f'http://www.google.com', **kwargs)
18 | urllib.request.Request('http://www.google.com')
|
error[S310]: 17:1: Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected.
S310.py:17:1: S310 Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected.
--> S310.py:16:62
|
15 | urllib.request.Request(url='http://' + 'www' + '.google.com')
16 | urllib.request.Request(url='http://www.google.com', **kwargs)
17 | urllib.request.Request(url=f'http://www.google.com', **kwargs)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S310
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
18 | urllib.request.Request('http://www.google.com')
19 | urllib.request.Request(f'http://www.google.com')
|
error[S310]: 20:1: Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected.
S310.py:20:1: S310 Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected.
--> S310.py:19:49
|
18 | urllib.request.Request('http://www.google.com')
19 | urllib.request.Request(f'http://www.google.com')
20 | urllib.request.Request('file:///foo/bar/baz')
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S310
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
21 | urllib.request.Request(url)
|
error[S310]: 21:1: Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected.
S310.py:21:1: S310 Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected.
--> S310.py:20:46
|
19 | urllib.request.Request(f'http://www.google.com')
20 | urllib.request.Request('file:///foo/bar/baz')
21 | urllib.request.Request(url)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ S310
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
22 |
23 | urllib.request.URLopener().open(fullurl='http://www.google.com')
|
error[S310]: 23:1: Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected.
S310.py:23:1: S310 Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected.
--> S310.py:22:1
|
21 | urllib.request.Request(url)
22 |
23 | urllib.request.URLopener().open(fullurl='http://www.google.com')
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ S310
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
24 | urllib.request.URLopener().open(fullurl=f'http://www.google.com')
25 | urllib.request.URLopener().open(fullurl='http://' + 'www' + '.google.com')
|
error[S310]: 24:1: Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected.
S310.py:24:1: S310 Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected.
--> S310.py:23:65
|
23 | urllib.request.URLopener().open(fullurl='http://www.google.com')
24 | urllib.request.URLopener().open(fullurl=f'http://www.google.com')
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ S310
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
25 | urllib.request.URLopener().open(fullurl='http://' + 'www' + '.google.com')
26 | urllib.request.URLopener().open(fullurl='http://www.google.com', **kwargs)
|
error[S310]: 25:1: Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected.
S310.py:25:1: S310 Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected.
--> S310.py:24:66
|
23 | urllib.request.URLopener().open(fullurl='http://www.google.com')
24 | urllib.request.URLopener().open(fullurl=f'http://www.google.com')
25 | urllib.request.URLopener().open(fullurl='http://' + 'www' + '.google.com')
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ S310
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
26 | urllib.request.URLopener().open(fullurl='http://www.google.com', **kwargs)
27 | urllib.request.URLopener().open(fullurl=f'http://www.google.com', **kwargs)
|
error[S310]: 26:1: Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected.
S310.py:26:1: S310 Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected.
--> S310.py:25:75
|
24 | urllib.request.URLopener().open(fullurl=f'http://www.google.com')
25 | urllib.request.URLopener().open(fullurl='http://' + 'www' + '.google.com')
26 | urllib.request.URLopener().open(fullurl='http://www.google.com', **kwargs)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ S310
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
27 | urllib.request.URLopener().open(fullurl=f'http://www.google.com', **kwargs)
28 | urllib.request.URLopener().open('http://www.google.com')
|
error[S310]: 27:1: Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected.
S310.py:27:1: S310 Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected.
--> S310.py:26:75
|
25 | urllib.request.URLopener().open(fullurl='http://' + 'www' + '.google.com')
26 | urllib.request.URLopener().open(fullurl='http://www.google.com', **kwargs)
27 | urllib.request.URLopener().open(fullurl=f'http://www.google.com', **kwargs)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ S310
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
28 | urllib.request.URLopener().open('http://www.google.com')
29 | urllib.request.URLopener().open(f'http://www.google.com')
|
error[S310]: 28:1: Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected.
S310.py:28:1: S310 Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected.
--> S310.py:27:76
|
26 | urllib.request.URLopener().open(fullurl='http://www.google.com', **kwargs)
27 | urllib.request.URLopener().open(fullurl=f'http://www.google.com', **kwargs)
28 | urllib.request.URLopener().open('http://www.google.com')
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ S310
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
29 | urllib.request.URLopener().open(f'http://www.google.com')
30 | urllib.request.URLopener().open('http://' + 'www' + '.google.com')
|
error[S310]: 29:1: Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected.
S310.py:29:1: S310 Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected.
--> S310.py:28:57
|
27 | urllib.request.URLopener().open(fullurl=f'http://www.google.com', **kwargs)
28 | urllib.request.URLopener().open('http://www.google.com')
29 | urllib.request.URLopener().open(f'http://www.google.com')
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ S310
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
30 | urllib.request.URLopener().open('http://' + 'www' + '.google.com')
31 | urllib.request.URLopener().open('file:///foo/bar/baz')
|
error[S310]: 30:1: Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected.
S310.py:30:1: S310 Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected.
--> S310.py:29:58
|
28 | urllib.request.URLopener().open('http://www.google.com')
29 | urllib.request.URLopener().open(f'http://www.google.com')
30 | urllib.request.URLopener().open('http://' + 'www' + '.google.com')
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ S310
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
31 | urllib.request.URLopener().open('file:///foo/bar/baz')
32 | urllib.request.URLopener().open(url)
|
error[S310]: 31:1: Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected.
S310.py:31:1: S310 Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected.
--> S310.py:30:67
|
29 | urllib.request.URLopener().open(f'http://www.google.com')
30 | urllib.request.URLopener().open('http://' + 'www' + '.google.com')
31 | urllib.request.URLopener().open('file:///foo/bar/baz')
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ S310
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
32 | urllib.request.URLopener().open(url)
|
error[S310]: 32:1: Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected.
S310.py:32:1: S310 Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected.
--> S310.py:31:55
|
30 | urllib.request.URLopener().open('http://' + 'www' + '.google.com')
31 | urllib.request.URLopener().open('file:///foo/bar/baz')
32 | urllib.request.URLopener().open(url)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ S310
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
33 |
34 | urllib.request.urlopen(url=urllib.request.Request('http://www.google.com'))
|
error[S310]: 37:1: Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected.
S310.py:37:1: S310 Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected.
--> S310.py:36:86
|
35 | urllib.request.urlopen(url=urllib.request.Request(f'http://www.google.com'))
36 | urllib.request.urlopen(url=urllib.request.Request('http://' + 'www' + '.google.com'))
37 | urllib.request.urlopen(url=urllib.request.Request('http://www.google.com'), **kwargs)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S310
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
38 | urllib.request.urlopen(url=urllib.request.Request(f'http://www.google.com'), **kwargs)
39 | urllib.request.urlopen(urllib.request.Request('http://www.google.com'))
|
error[S310]: 38:1: Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected.
S310.py:38:1: S310 Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected.
--> S310.py:37:86
|
36 | urllib.request.urlopen(url=urllib.request.Request('http://' + 'www' + '.google.com'))
37 | urllib.request.urlopen(url=urllib.request.Request('http://www.google.com'), **kwargs)
38 | urllib.request.urlopen(url=urllib.request.Request(f'http://www.google.com'), **kwargs)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S310
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
39 | urllib.request.urlopen(urllib.request.Request('http://www.google.com'))
40 | urllib.request.urlopen(urllib.request.Request(f'http://www.google.com'))
|
error[S310]: 41:1: Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected.
S310.py:41:1: S310 Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected.
--> S310.py:40:73
|
39 | urllib.request.urlopen(urllib.request.Request('http://www.google.com'))
40 | urllib.request.urlopen(urllib.request.Request(f'http://www.google.com'))
41 | urllib.request.urlopen(urllib.request.Request('file:///foo/bar/baz'))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S310
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
42 | urllib.request.urlopen(urllib.request.Request(url))
|
error[S310]: 41:24: Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected.
S310.py:41:24: S310 Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected.
--> S310.py:41:24
|
39 | urllib.request.urlopen(urllib.request.Request('http://www.google.com'))
40 | urllib.request.urlopen(urllib.request.Request(f'http://www.google.com'))
41 | urllib.request.urlopen(urllib.request.Request('file:///foo/bar/baz'))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S310
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
42 | urllib.request.urlopen(urllib.request.Request(url))
|
error[S310]: 42:1: Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected.
S310.py:42:1: S310 Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected.
--> S310.py:41:70
|
40 | urllib.request.urlopen(urllib.request.Request(f'http://www.google.com'))
41 | urllib.request.urlopen(urllib.request.Request('file:///foo/bar/baz'))
42 | urllib.request.urlopen(urllib.request.Request(url))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S310
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
error[S310]: 42:24: Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected.
S310.py:42:24: S310 Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected.
--> S310.py:42:24
|
40 | urllib.request.urlopen(urllib.request.Request(f'http://www.google.com'))
41 | urllib.request.urlopen(urllib.request.Request('file:///foo/bar/baz'))
42 | urllib.request.urlopen(urllib.request.Request(url))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ S310
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|

View File

@@ -1,90 +1,100 @@
---
source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs
---
S311.py:10:1: S311 Standard pseudo-random generators are not suitable for cryptographic purposes
error[S311]: 10:1: Standard pseudo-random generators are not suitable for cryptographic purposes
--> S311.py:9:9
|
9 | # Errors
10 | random.Random()
| ^^^^^^^^^^^^^^^ S311
| ^^^^^^^^^^^^^^^
11 | random.random()
12 | random.randrange()
|
error[S311]: 11:1: Standard pseudo-random generators are not suitable for cryptographic purposes
S311.py:11:1: S311 Standard pseudo-random generators are not suitable for cryptographic purposes
--> S311.py:10:16
|
9 | # Errors
10 | random.Random()
11 | random.random()
| ^^^^^^^^^^^^^^^ S311
| ^^^^^^^^^^^^^^^
12 | random.randrange()
13 | random.randint()
|
error[S311]: 12:1: Standard pseudo-random generators are not suitable for cryptographic purposes
S311.py:12:1: S311 Standard pseudo-random generators are not suitable for cryptographic purposes
--> S311.py:11:16
|
10 | random.Random()
11 | random.random()
12 | random.randrange()
| ^^^^^^^^^^^^^^^^^^ S311
| ^^^^^^^^^^^^^^^^^^
13 | random.randint()
14 | random.choice()
|
error[S311]: 13:1: Standard pseudo-random generators are not suitable for cryptographic purposes
S311.py:13:1: S311 Standard pseudo-random generators are not suitable for cryptographic purposes
--> S311.py:12:19
|
11 | random.random()
12 | random.randrange()
13 | random.randint()
| ^^^^^^^^^^^^^^^^ S311
| ^^^^^^^^^^^^^^^^
14 | random.choice()
15 | random.choices()
|
error[S311]: 14:1: Standard pseudo-random generators are not suitable for cryptographic purposes
S311.py:14:1: S311 Standard pseudo-random generators are not suitable for cryptographic purposes
--> S311.py:13:17
|
12 | random.randrange()
13 | random.randint()
14 | random.choice()
| ^^^^^^^^^^^^^^^ S311
| ^^^^^^^^^^^^^^^
15 | random.choices()
16 | random.uniform()
|
error[S311]: 15:1: Standard pseudo-random generators are not suitable for cryptographic purposes
S311.py:15:1: S311 Standard pseudo-random generators are not suitable for cryptographic purposes
--> S311.py:14:16
|
13 | random.randint()
14 | random.choice()
15 | random.choices()
| ^^^^^^^^^^^^^^^^ S311
| ^^^^^^^^^^^^^^^^
16 | random.uniform()
17 | random.triangular()
|
error[S311]: 16:1: Standard pseudo-random generators are not suitable for cryptographic purposes
S311.py:16:1: S311 Standard pseudo-random generators are not suitable for cryptographic purposes
--> S311.py:15:17
|
14 | random.choice()
15 | random.choices()
16 | random.uniform()
| ^^^^^^^^^^^^^^^^ S311
| ^^^^^^^^^^^^^^^^
17 | random.triangular()
18 | random.randbytes()
|
error[S311]: 17:1: Standard pseudo-random generators are not suitable for cryptographic purposes
S311.py:17:1: S311 Standard pseudo-random generators are not suitable for cryptographic purposes
--> S311.py:16:17
|
15 | random.choices()
16 | random.uniform()
17 | random.triangular()
| ^^^^^^^^^^^^^^^^^^^ S311
| ^^^^^^^^^^^^^^^^^^^
18 | random.randbytes()
|
error[S311]: 18:1: Standard pseudo-random generators are not suitable for cryptographic purposes
S311.py:18:1: S311 Standard pseudo-random generators are not suitable for cryptographic purposes
--> S311.py:17:20
|
16 | random.uniform()
17 | random.triangular()
18 | random.randbytes()
| ^^^^^^^^^^^^^^^^^^ S311
| ^^^^^^^^^^^^^^^^^^
19 |
20 | # Unrelated
|

View File

@@ -1,12 +1,12 @@
---
source: crates/ruff_linter/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.
error[S312]: 3:1: Telnet-related functions are being called. Telnet is considered insecure. Use SSH or some other encrypted protocol.
--> S312.py:2:1
|
1 | from telnetlib import Telnet
2 |
3 | Telnet("localhost", 23)
| ^^^^^^^^^^^^^^^^^^^^^^^ S312
| ^^^^^^^^^^^^^^^^^^^^^^^
|

View File

@@ -1,197 +1,218 @@
---
source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs
---
S324.py:7:13: S324 Probable use of insecure hash functions in `hashlib`: `md5`
error[S324]: 7:13: Probable use of insecure hash functions in `hashlib`: `md5`
--> S324.py:7:13
|
6 | # Errors
7 | hashlib.new('md5')
| ^^^^^ S324
| ^^^^^
8 | hashlib.new('md4', b'test')
9 | hashlib.new(name='md5', data=b'test')
|
error[S324]: 8:13: Probable use of insecure hash functions in `hashlib`: `md4`
S324.py:8:13: S324 Probable use of insecure hash functions in `hashlib`: `md4`
--> S324.py:8:13
|
6 | # Errors
7 | hashlib.new('md5')
8 | hashlib.new('md4', b'test')
| ^^^^^ S324
| ^^^^^
9 | hashlib.new(name='md5', data=b'test')
10 | hashlib.new('MD4', data=b'test')
|
error[S324]: 9:18: Probable use of insecure hash functions in `hashlib`: `md5`
S324.py:9:18: S324 Probable use of insecure hash functions in `hashlib`: `md5`
--> S324.py:9:18
|
7 | hashlib.new('md5')
8 | hashlib.new('md4', b'test')
9 | hashlib.new(name='md5', data=b'test')
| ^^^^^ S324
| ^^^^^
10 | hashlib.new('MD4', data=b'test')
11 | hashlib.new('sha1')
|
error[S324]: 10:13: Probable use of insecure hash functions in `hashlib`: `MD4`
S324.py:10:13: S324 Probable use of insecure hash functions in `hashlib`: `MD4`
--> S324.py:10:13
|
8 | hashlib.new('md4', b'test')
9 | hashlib.new(name='md5', data=b'test')
10 | hashlib.new('MD4', data=b'test')
| ^^^^^ S324
| ^^^^^
11 | hashlib.new('sha1')
12 | hashlib.new('sha1', data=b'test')
|
error[S324]: 11:13: Probable use of insecure hash functions in `hashlib`: `sha1`
S324.py:11:13: S324 Probable use of insecure hash functions in `hashlib`: `sha1`
--> S324.py:11:13
|
9 | hashlib.new(name='md5', data=b'test')
10 | hashlib.new('MD4', data=b'test')
11 | hashlib.new('sha1')
| ^^^^^^ S324
| ^^^^^^
12 | hashlib.new('sha1', data=b'test')
13 | hashlib.new('sha', data=b'test')
|
error[S324]: 12:13: Probable use of insecure hash functions in `hashlib`: `sha1`
S324.py:12:13: S324 Probable use of insecure hash functions in `hashlib`: `sha1`
--> S324.py:12:13
|
10 | hashlib.new('MD4', data=b'test')
11 | hashlib.new('sha1')
12 | hashlib.new('sha1', data=b'test')
| ^^^^^^ S324
| ^^^^^^
13 | hashlib.new('sha', data=b'test')
14 | hashlib.new(name='SHA', data=b'test')
|
error[S324]: 13:13: Probable use of insecure hash functions in `hashlib`: `sha`
S324.py:13:13: S324 Probable use of insecure hash functions in `hashlib`: `sha`
--> S324.py:13:13
|
11 | hashlib.new('sha1')
12 | hashlib.new('sha1', data=b'test')
13 | hashlib.new('sha', data=b'test')
| ^^^^^ S324
| ^^^^^
14 | hashlib.new(name='SHA', data=b'test')
15 | hashlib.sha(data=b'test')
|
error[S324]: 14:18: Probable use of insecure hash functions in `hashlib`: `SHA`
S324.py:14:18: S324 Probable use of insecure hash functions in `hashlib`: `SHA`
--> S324.py:14:18
|
12 | hashlib.new('sha1', data=b'test')
13 | hashlib.new('sha', data=b'test')
14 | hashlib.new(name='SHA', data=b'test')
| ^^^^^ S324
| ^^^^^
15 | hashlib.sha(data=b'test')
16 | hashlib.md5()
|
error[S324]: 15:1: Probable use of insecure hash functions in `hashlib`: `sha`
S324.py:15:1: S324 Probable use of insecure hash functions in `hashlib`: `sha`
--> S324.py:14:38
|
13 | hashlib.new('sha', data=b'test')
14 | hashlib.new(name='SHA', data=b'test')
15 | hashlib.sha(data=b'test')
| ^^^^^^^^^^^ S324
| ^^^^^^^^^^^
16 | hashlib.md5()
17 | hashlib_new('sha1')
|
error[S324]: 16:1: Probable use of insecure hash functions in `hashlib`: `md5`
S324.py:16:1: S324 Probable use of insecure hash functions in `hashlib`: `md5`
--> S324.py:15:26
|
14 | hashlib.new(name='SHA', data=b'test')
15 | hashlib.sha(data=b'test')
16 | hashlib.md5()
| ^^^^^^^^^^^ S324
| ^^^^^^^^^^^
17 | hashlib_new('sha1')
18 | hashlib_sha1('sha1')
|
error[S324]: 17:13: Probable use of insecure hash functions in `hashlib`: `sha1`
S324.py:17:13: S324 Probable use of insecure hash functions in `hashlib`: `sha1`
--> S324.py:17:13
|
15 | hashlib.sha(data=b'test')
16 | hashlib.md5()
17 | hashlib_new('sha1')
| ^^^^^^ S324
| ^^^^^^
18 | hashlib_sha1('sha1')
19 | # usedforsecurity arg only available in Python 3.9+
|
error[S324]: 18:1: Probable use of insecure hash functions in `hashlib`: `sha1`
S324.py:18:1: S324 Probable use of insecure hash functions in `hashlib`: `sha1`
--> S324.py:17:20
|
16 | hashlib.md5()
17 | hashlib_new('sha1')
18 | hashlib_sha1('sha1')
| ^^^^^^^^^^^^ S324
| ^^^^^^^^^^^^
19 | # usedforsecurity arg only available in Python 3.9+
20 | hashlib.new('sha1', usedforsecurity=True)
|
error[S324]: 20:13: Probable use of insecure hash functions in `hashlib`: `sha1`
S324.py:20:13: S324 Probable use of insecure hash functions in `hashlib`: `sha1`
--> S324.py:20:13
|
18 | hashlib_sha1('sha1')
19 | # usedforsecurity arg only available in Python 3.9+
20 | hashlib.new('sha1', usedforsecurity=True)
| ^^^^^^ S324
| ^^^^^^
21 |
22 | crypt.crypt("test", salt=crypt.METHOD_CRYPT)
|
error[S324]: 22:26: Probable use of insecure hash functions in `crypt`: `crypt.METHOD_CRYPT`
S324.py:22:26: S324 Probable use of insecure hash functions in `crypt`: `crypt.METHOD_CRYPT`
--> S324.py:22:26
|
20 | hashlib.new('sha1', usedforsecurity=True)
21 |
22 | crypt.crypt("test", salt=crypt.METHOD_CRYPT)
| ^^^^^^^^^^^^^^^^^^ S324
| ^^^^^^^^^^^^^^^^^^
23 | crypt.crypt("test", salt=crypt.METHOD_MD5)
24 | crypt.crypt("test", salt=crypt.METHOD_BLOWFISH)
|
error[S324]: 23:26: Probable use of insecure hash functions in `crypt`: `crypt.METHOD_MD5`
S324.py:23:26: S324 Probable use of insecure hash functions in `crypt`: `crypt.METHOD_MD5`
--> S324.py:23:26
|
22 | crypt.crypt("test", salt=crypt.METHOD_CRYPT)
23 | crypt.crypt("test", salt=crypt.METHOD_MD5)
| ^^^^^^^^^^^^^^^^ S324
| ^^^^^^^^^^^^^^^^
24 | crypt.crypt("test", salt=crypt.METHOD_BLOWFISH)
25 | crypt.crypt("test", crypt.METHOD_BLOWFISH)
|
error[S324]: 24:26: Probable use of insecure hash functions in `crypt`: `crypt.METHOD_BLOWFISH`
S324.py:24:26: S324 Probable use of insecure hash functions in `crypt`: `crypt.METHOD_BLOWFISH`
--> S324.py:24:26
|
22 | crypt.crypt("test", salt=crypt.METHOD_CRYPT)
23 | crypt.crypt("test", salt=crypt.METHOD_MD5)
24 | crypt.crypt("test", salt=crypt.METHOD_BLOWFISH)
| ^^^^^^^^^^^^^^^^^^^^^ S324
| ^^^^^^^^^^^^^^^^^^^^^
25 | crypt.crypt("test", crypt.METHOD_BLOWFISH)
|
error[S324]: 25:21: Probable use of insecure hash functions in `crypt`: `crypt.METHOD_BLOWFISH`
S324.py:25:21: S324 Probable use of insecure hash functions in `crypt`: `crypt.METHOD_BLOWFISH`
--> S324.py:25:21
|
23 | crypt.crypt("test", salt=crypt.METHOD_MD5)
24 | crypt.crypt("test", salt=crypt.METHOD_BLOWFISH)
25 | crypt.crypt("test", crypt.METHOD_BLOWFISH)
| ^^^^^^^^^^^^^^^^^^^^^ S324
| ^^^^^^^^^^^^^^^^^^^^^
26 |
27 | crypt.mksalt(crypt.METHOD_CRYPT)
|
error[S324]: 27:14: Probable use of insecure hash functions in `crypt`: `crypt.METHOD_CRYPT`
S324.py:27:14: S324 Probable use of insecure hash functions in `crypt`: `crypt.METHOD_CRYPT`
--> S324.py:27:14
|
25 | crypt.crypt("test", crypt.METHOD_BLOWFISH)
26 |
27 | crypt.mksalt(crypt.METHOD_CRYPT)
| ^^^^^^^^^^^^^^^^^^ S324
| ^^^^^^^^^^^^^^^^^^
28 | crypt.mksalt(crypt.METHOD_MD5)
29 | crypt.mksalt(crypt.METHOD_BLOWFISH)
|
error[S324]: 28:14: Probable use of insecure hash functions in `crypt`: `crypt.METHOD_MD5`
S324.py:28:14: S324 Probable use of insecure hash functions in `crypt`: `crypt.METHOD_MD5`
--> S324.py:28:14
|
27 | crypt.mksalt(crypt.METHOD_CRYPT)
28 | crypt.mksalt(crypt.METHOD_MD5)
| ^^^^^^^^^^^^^^^^ S324
| ^^^^^^^^^^^^^^^^
29 | crypt.mksalt(crypt.METHOD_BLOWFISH)
|
error[S324]: 29:14: Probable use of insecure hash functions in `crypt`: `crypt.METHOD_BLOWFISH`
S324.py:29:14: S324 Probable use of insecure hash functions in `crypt`: `crypt.METHOD_BLOWFISH`
--> S324.py:29:14
|
27 | crypt.mksalt(crypt.METHOD_CRYPT)
28 | crypt.mksalt(crypt.METHOD_MD5)
29 | crypt.mksalt(crypt.METHOD_BLOWFISH)
| ^^^^^^^^^^^^^^^^^^^^^ S324
| ^^^^^^^^^^^^^^^^^^^^^
30 |
31 | # OK
|

View File

@@ -1,18 +1,19 @@
---
source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs
---
S401.py:1:8: S401 `telnetlib` and related modules are considered insecure. Use SSH or another encrypted protocol.
error[S401]: 1:8: `telnetlib` and related modules are considered insecure. Use SSH or another encrypted protocol.
--> S401.py:1:8
|
1 | import telnetlib # S401
| ^^^^^^^^^ S401
| ^^^^^^^^^
2 | from telnetlib import Telnet # S401
|
error[S401]: 2:6: `telnetlib` and related modules are considered insecure. Use SSH or another encrypted protocol.
S401.py:2:6: S401 `telnetlib` and related modules are considered insecure. Use SSH or another encrypted protocol.
--> S401.py:2:6
|
1 | import telnetlib # S401
2 | from telnetlib import Telnet # S401
| ^^^^^^^^^ S401
| ^^^^^^^^^
|

View File

@@ -1,18 +1,19 @@
---
source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs
---
S402.py:1:8: S402 `ftplib` and related modules are considered insecure. Use SSH, SFTP, SCP, or another encrypted protocol.
error[S402]: 1:8: `ftplib` and related modules are considered insecure. Use SSH, SFTP, SCP, or another encrypted protocol.
--> S402.py:1:8
|
1 | import ftplib # S402
| ^^^^^^ S402
| ^^^^^^
2 | from ftplib import FTP # S402
|
error[S402]: 2:6: `ftplib` and related modules are considered insecure. Use SSH, SFTP, SCP, or another encrypted protocol.
S402.py:2:6: S402 `ftplib` and related modules are considered insecure. Use SSH, SFTP, SCP, or another encrypted protocol.
--> S402.py:2:6
|
1 | import ftplib # S402
2 | from ftplib import FTP # S402
| ^^^^^^ S402
| ^^^^^^
|

View File

@@ -1,78 +1,85 @@
---
source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs
---
S403.py:1:8: S403 `pickle`, `cPickle`, `dill`, and `shelve` modules are possibly insecure
error[S403]: 1:8: `pickle`, `cPickle`, `dill`, and `shelve` modules are possibly insecure
--> S403.py:1:8
|
1 | import dill # S403
| ^^^^ S403
| ^^^^
2 | from dill import objects # S403
3 | import shelve
|
error[S403]: 2:6: `pickle`, `cPickle`, `dill`, and `shelve` modules are possibly insecure
S403.py:2:6: S403 `pickle`, `cPickle`, `dill`, and `shelve` modules are possibly insecure
--> S403.py:2:6
|
1 | import dill # S403
2 | from dill import objects # S403
| ^^^^ S403
| ^^^^
3 | import shelve
4 | from shelve import open
|
error[S403]: 3:8: `pickle`, `cPickle`, `dill`, and `shelve` modules are possibly insecure
S403.py:3:8: S403 `pickle`, `cPickle`, `dill`, and `shelve` modules are possibly insecure
--> S403.py:3:8
|
1 | import dill # S403
2 | from dill import objects # S403
3 | import shelve
| ^^^^^^ S403
| ^^^^^^
4 | from shelve import open
5 | import cPickle
|
error[S403]: 4:6: `pickle`, `cPickle`, `dill`, and `shelve` modules are possibly insecure
S403.py:4:6: S403 `pickle`, `cPickle`, `dill`, and `shelve` modules are possibly insecure
--> S403.py:4:6
|
2 | from dill import objects # S403
3 | import shelve
4 | from shelve import open
| ^^^^^^ S403
| ^^^^^^
5 | import cPickle
6 | from cPickle import load
|
error[S403]: 5:8: `pickle`, `cPickle`, `dill`, and `shelve` modules are possibly insecure
S403.py:5:8: S403 `pickle`, `cPickle`, `dill`, and `shelve` modules are possibly insecure
--> S403.py:5:8
|
3 | import shelve
4 | from shelve import open
5 | import cPickle
| ^^^^^^^ S403
| ^^^^^^^
6 | from cPickle import load
7 | import pickle
|
error[S403]: 6:6: `pickle`, `cPickle`, `dill`, and `shelve` modules are possibly insecure
S403.py:6:6: S403 `pickle`, `cPickle`, `dill`, and `shelve` modules are possibly insecure
--> S403.py:6:6
|
4 | from shelve import open
5 | import cPickle
6 | from cPickle import load
| ^^^^^^^ S403
| ^^^^^^^
7 | import pickle
8 | from pickle import load
|
error[S403]: 7:8: `pickle`, `cPickle`, `dill`, and `shelve` modules are possibly insecure
S403.py:7:8: S403 `pickle`, `cPickle`, `dill`, and `shelve` modules are possibly insecure
--> S403.py:7:8
|
5 | import cPickle
6 | from cPickle import load
7 | import pickle
| ^^^^^^ S403
| ^^^^^^
8 | from pickle import load
|
error[S403]: 8:6: `pickle`, `cPickle`, `dill`, and `shelve` modules are possibly insecure
S403.py:8:6: S403 `pickle`, `cPickle`, `dill`, and `shelve` modules are possibly insecure
--> S403.py:8:6
|
6 | from cPickle import load
7 | import pickle
8 | from pickle import load
| ^^^^^^ S403
| ^^^^^^
|

View File

@@ -1,28 +1,30 @@
---
source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs
---
S404.py:1:8: S404 `subprocess` module is possibly insecure
error[S404]: 1:8: `subprocess` module is possibly insecure
--> S404.py:1:8
|
1 | import subprocess # S404
| ^^^^^^^^^^ S404
| ^^^^^^^^^^
2 | from subprocess import Popen # S404
3 | from subprocess import Popen as pop # S404
|
error[S404]: 2:6: `subprocess` module is possibly insecure
S404.py:2:6: S404 `subprocess` module is possibly insecure
--> S404.py:2:6
|
1 | import subprocess # S404
2 | from subprocess import Popen # S404
| ^^^^^^^^^^ S404
| ^^^^^^^^^^
3 | from subprocess import Popen as pop # S404
|
error[S404]: 3:6: `subprocess` module is possibly insecure
S404.py:3:6: S404 `subprocess` module is possibly insecure
--> S404.py:3:6
|
1 | import subprocess # S404
2 | from subprocess import Popen # S404
3 | from subprocess import Popen as pop # S404
| ^^^^^^^^^^ S404
| ^^^^^^^^^^
|

View File

@@ -1,38 +1,41 @@
---
source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs
---
S405.py:1:8: S405 `xml.etree` methods are vulnerable to XML attacks
error[S405]: 1:8: `xml.etree` methods are vulnerable to XML attacks
--> S405.py:1:8
|
1 | import xml.etree.cElementTree # S405
| ^^^^^^^^^^^^^^^^^^^^^^ S405
| ^^^^^^^^^^^^^^^^^^^^^^
2 | from xml.etree import cElementTree # S405
3 | import xml.etree.ElementTree # S405
|
error[S405]: 2:6: `xml.etree` methods are vulnerable to XML attacks
S405.py:2:6: S405 `xml.etree` methods are vulnerable to XML attacks
--> S405.py:2:6
|
1 | import xml.etree.cElementTree # S405
2 | from xml.etree import cElementTree # S405
| ^^^^^^^^^ S405
| ^^^^^^^^^
3 | import xml.etree.ElementTree # S405
4 | from xml.etree import ElementTree # S405
|
error[S405]: 3:8: `xml.etree` methods are vulnerable to XML attacks
S405.py:3:8: S405 `xml.etree` methods are vulnerable to XML attacks
--> S405.py:3:8
|
1 | import xml.etree.cElementTree # S405
2 | from xml.etree import cElementTree # S405
3 | import xml.etree.ElementTree # S405
| ^^^^^^^^^^^^^^^^^^^^^ S405
| ^^^^^^^^^^^^^^^^^^^^^
4 | from xml.etree import ElementTree # S405
|
error[S405]: 4:6: `xml.etree` methods are vulnerable to XML attacks
S405.py:4:6: S405 `xml.etree` methods are vulnerable to XML attacks
--> S405.py:4:6
|
2 | from xml.etree import cElementTree # S405
3 | import xml.etree.ElementTree # S405
4 | from xml.etree import ElementTree # S405
| ^^^^^^^^^ S405
| ^^^^^^^^^
|

View File

@@ -1,28 +1,30 @@
---
source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs
---
S406.py:1:6: S406 `xml.sax` methods are vulnerable to XML attacks
error[S406]: 1:6: `xml.sax` methods are vulnerable to XML attacks
--> S406.py:1:6
|
1 | from xml import sax # S406
| ^^^ S406
| ^^^
2 | import xml.sax as xmls # S406
3 | import xml.sax # S406
|
error[S406]: 2:8: `xml.sax` methods are vulnerable to XML attacks
S406.py:2:8: S406 `xml.sax` methods are vulnerable to XML attacks
--> S406.py:2:8
|
1 | from xml import sax # S406
2 | import xml.sax as xmls # S406
| ^^^^^^^^^^^^^^^ S406
| ^^^^^^^^^^^^^^^
3 | import xml.sax # S406
|
error[S406]: 3:8: `xml.sax` methods are vulnerable to XML attacks
S406.py:3:8: S406 `xml.sax` methods are vulnerable to XML attacks
--> S406.py:3:8
|
1 | from xml import sax # S406
2 | import xml.sax as xmls # S406
3 | import xml.sax # S406
| ^^^^^^^ S406
| ^^^^^^^
|

View File

@@ -1,18 +1,19 @@
---
source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs
---
S407.py:1:6: S407 `xml.dom.expatbuilder` is vulnerable to XML attacks
error[S407]: 1:6: `xml.dom.expatbuilder` is vulnerable to XML attacks
--> S407.py:1:6
|
1 | from xml.dom import expatbuilder # S407
| ^^^^^^^ S407
| ^^^^^^^
2 | import xml.dom.expatbuilder # S407
|
error[S407]: 2:8: `xml.dom.expatbuilder` is vulnerable to XML attacks
S407.py:2:8: S407 `xml.dom.expatbuilder` is vulnerable to XML attacks
--> S407.py:2:8
|
1 | from xml.dom import expatbuilder # S407
2 | import xml.dom.expatbuilder # S407
| ^^^^^^^^^^^^^^^^^^^^ S407
| ^^^^^^^^^^^^^^^^^^^^
|

View File

@@ -1,18 +1,19 @@
---
source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs
---
S408.py:1:6: S408 `xml.dom.minidom` is vulnerable to XML attacks
error[S408]: 1:6: `xml.dom.minidom` is vulnerable to XML attacks
--> S408.py:1:6
|
1 | from xml.dom.minidom import parseString # S408
| ^^^^^^^^^^^^^^^ S408
| ^^^^^^^^^^^^^^^
2 | import xml.dom.minidom # S408
|
error[S408]: 2:8: `xml.dom.minidom` is vulnerable to XML attacks
S408.py:2:8: S408 `xml.dom.minidom` is vulnerable to XML attacks
--> S408.py:2:8
|
1 | from xml.dom.minidom import parseString # S408
2 | import xml.dom.minidom # S408
| ^^^^^^^^^^^^^^^ S408
| ^^^^^^^^^^^^^^^
|

View File

@@ -1,18 +1,19 @@
---
source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs
---
S409.py:1:6: S409 `xml.dom.pulldom` is vulnerable to XML attacks
error[S409]: 1:6: `xml.dom.pulldom` is vulnerable to XML attacks
--> S409.py:1:6
|
1 | from xml.dom.pulldom import parseString # S409
| ^^^^^^^^^^^^^^^ S409
| ^^^^^^^^^^^^^^^
2 | import xml.dom.pulldom # S409
|
error[S409]: 2:8: `xml.dom.pulldom` is vulnerable to XML attacks
S409.py:2:8: S409 `xml.dom.pulldom` is vulnerable to XML attacks
--> S409.py:2:8
|
1 | from xml.dom.pulldom import parseString # S409
2 | import xml.dom.pulldom # S409
| ^^^^^^^^^^^^^^^ S409
| ^^^^^^^^^^^^^^^
|

View File

@@ -1,18 +1,19 @@
---
source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs
---
S410.py:1:8: S410 `lxml` is vulnerable to XML attacks
error[S410]: 1:8: `lxml` is vulnerable to XML attacks
--> S410.py:1:8
|
1 | import lxml # S410
| ^^^^ S410
| ^^^^
2 | from lxml import etree # S410
|
error[S410]: 2:6: `lxml` is vulnerable to XML attacks
S410.py:2:6: S410 `lxml` is vulnerable to XML attacks
--> S410.py:2:6
|
1 | import lxml # S410
2 | from lxml import etree # S410
| ^^^^ S410
| ^^^^
|

View File

@@ -1,18 +1,19 @@
---
source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs
---
S411.py:1:8: S411 XMLRPC is vulnerable to remote XML attacks
error[S411]: 1:8: XMLRPC is vulnerable to remote XML attacks
--> S411.py:1:8
|
1 | import xmlrpc # S411
| ^^^^^^ S411
| ^^^^^^
2 | from xmlrpc import server # S411
|
error[S411]: 2:6: XMLRPC is vulnerable to remote XML attacks
S411.py:2:6: S411 XMLRPC is vulnerable to remote XML attacks
--> S411.py:2:6
|
1 | import xmlrpc # S411
2 | from xmlrpc import server # S411
| ^^^^^^ S411
| ^^^^^^
|

View File

@@ -1,10 +1,10 @@
---
source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs
---
S412.py:1:6: S412 `httpoxy` is a set of vulnerabilities that affect application code running inCGI, or CGI-like environments. The use of CGI for web applications should be avoided
error[S412]: 1:6: `httpoxy` is a set of vulnerabilities that affect application code running inCGI, or CGI-like environments. The use of CGI for web applications should be avoided
--> S412.py:1:6
|
1 | from twisted.web.twcgi import CGIScript # S412
| ^^^^^^^^^^^^^^^^^ S412
| ^^^^^^^^^^^^^^^^^
|

View File

@@ -1,38 +1,41 @@
---
source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs
---
S413.py:1:8: S413 `pycrypto` library is known to have publicly disclosed buffer overflow vulnerability
error[S413]: 1:8: `pycrypto` library is known to have publicly disclosed buffer overflow vulnerability
--> S413.py:1:8
|
1 | import Crypto.Hash # S413
| ^^^^^^^^^^^ S413
| ^^^^^^^^^^^
2 | from Crypto.Hash import MD2 # S413
3 | import Crypto.PublicKey # S413
|
error[S413]: 2:6: `pycrypto` library is known to have publicly disclosed buffer overflow vulnerability
S413.py:2:6: S413 `pycrypto` library is known to have publicly disclosed buffer overflow vulnerability
--> S413.py:2:6
|
1 | import Crypto.Hash # S413
2 | from Crypto.Hash import MD2 # S413
| ^^^^^^^^^^^ S413
| ^^^^^^^^^^^
3 | import Crypto.PublicKey # S413
4 | from Crypto.PublicKey import RSA # S413
|
error[S413]: 3:8: `pycrypto` library is known to have publicly disclosed buffer overflow vulnerability
S413.py:3:8: S413 `pycrypto` library is known to have publicly disclosed buffer overflow vulnerability
--> S413.py:3:8
|
1 | import Crypto.Hash # S413
2 | from Crypto.Hash import MD2 # S413
3 | import Crypto.PublicKey # S413
| ^^^^^^^^^^^^^^^^ S413
| ^^^^^^^^^^^^^^^^
4 | from Crypto.PublicKey import RSA # S413
|
error[S413]: 4:6: `pycrypto` library is known to have publicly disclosed buffer overflow vulnerability
S413.py:4:6: S413 `pycrypto` library is known to have publicly disclosed buffer overflow vulnerability
--> S413.py:4:6
|
2 | from Crypto.Hash import MD2 # S413
3 | import Crypto.PublicKey # S413
4 | from Crypto.PublicKey import RSA # S413
| ^^^^^^^^^^^^^^^^ S413
| ^^^^^^^^^^^^^^^^
|

View File

@@ -1,18 +1,19 @@
---
source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs
---
S415.py:1:8: S415 An IPMI-related module is being imported. Prefer an encrypted protocol over IPMI.
error[S415]: 1:8: An IPMI-related module is being imported. Prefer an encrypted protocol over IPMI.
--> S415.py:1:8
|
1 | import pyghmi # S415
| ^^^^^^ S415
| ^^^^^^
2 | from pyghmi import foo # S415
|
error[S415]: 2:6: An IPMI-related module is being imported. Prefer an encrypted protocol over IPMI.
S415.py:2:6: S415 An IPMI-related module is being imported. Prefer an encrypted protocol over IPMI.
--> S415.py:2:6
|
1 | import pyghmi # S415
2 | from pyghmi import foo # S415
| ^^^^^^ S415
| ^^^^^^
|

View File

@@ -1,180 +1,197 @@
---
source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs
---
S501.py:5:47: S501 Probable use of `requests` call with `verify=False` disabling SSL certificate checks
error[S501]: 5:47: Probable use of `requests` call with `verify=False` disabling SSL certificate checks
--> S501.py:5:47
|
4 | requests.get('https://gmail.com', timeout=30, verify=True)
5 | requests.get('https://gmail.com', timeout=30, verify=False)
| ^^^^^^^^^^^^ S501
| ^^^^^^^^^^^^
6 | requests.post('https://gmail.com', timeout=30, verify=True)
7 | requests.post('https://gmail.com', timeout=30, verify=False)
|
error[S501]: 7:48: Probable use of `requests` call with `verify=False` disabling SSL certificate checks
S501.py:7:48: S501 Probable use of `requests` call with `verify=False` disabling SSL certificate checks
--> S501.py:7:48
|
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)
|
error[S501]: 9:47: Probable use of `requests` call with `verify=False` disabling SSL certificate checks
S501.py:9:47: S501 Probable use of `requests` call with `verify=False` disabling SSL certificate checks
--> S501.py:9:47
|
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
| ^^^^^^^^^^^^
10 | requests.delete('https://gmail.com', timeout=30, verify=True)
11 | requests.delete('https://gmail.com', timeout=30, verify=False)
|
error[S501]: 11:50: Probable use of `requests` call with `verify=False` disabling SSL certificate checks
S501.py:11:50: S501 Probable use of `requests` call with `verify=False` disabling SSL certificate checks
--> S501.py:11:50
|
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
| ^^^^^^^^^^^^
12 | requests.patch('https://gmail.com', timeout=30, verify=True)
13 | requests.patch('https://gmail.com', timeout=30, verify=False)
|
error[S501]: 13:49: Probable use of `requests` call with `verify=False` disabling SSL certificate checks
S501.py:13:49: S501 Probable use of `requests` call with `verify=False` disabling SSL certificate checks
--> S501.py:13:49
|
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
| ^^^^^^^^^^^^
14 | requests.options('https://gmail.com', timeout=30, verify=True)
15 | requests.options('https://gmail.com', timeout=30, verify=False)
|
error[S501]: 15:51: Probable use of `requests` call with `verify=False` disabling SSL certificate checks
S501.py:15:51: S501 Probable use of `requests` call with `verify=False` disabling SSL certificate checks
--> S501.py:15:51
|
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
| ^^^^^^^^^^^^
16 | requests.head('https://gmail.com', timeout=30, verify=True)
17 | requests.head('https://gmail.com', timeout=30, verify=False)
|
error[S501]: 17:48: Probable use of `requests` call with `verify=False` disabling SSL certificate checks
S501.py:17:48: S501 Probable use of `requests` call with `verify=False` disabling SSL certificate checks
--> S501.py:17:48
|
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
| ^^^^^^^^^^^^
18 |
19 | httpx.request('GET', 'https://gmail.com', verify=True)
|
error[S501]: 20:43: Probable use of `httpx` call with `verify=False` disabling SSL certificate checks
S501.py:20:43: S501 Probable use of `httpx` call with `verify=False` disabling SSL certificate checks
--> S501.py:20:43
|
19 | httpx.request('GET', 'https://gmail.com', verify=True)
20 | httpx.request('GET', 'https://gmail.com', verify=False)
| ^^^^^^^^^^^^ S501
| ^^^^^^^^^^^^
21 | httpx.get('https://gmail.com', verify=True)
22 | httpx.get('https://gmail.com', verify=False)
|
error[S501]: 22:32: Probable use of `httpx` call with `verify=False` disabling SSL certificate checks
S501.py:22:32: S501 Probable use of `httpx` call with `verify=False` disabling SSL certificate checks
--> S501.py:22:32
|
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
| ^^^^^^^^^^^^
23 | httpx.options('https://gmail.com', verify=True)
24 | httpx.options('https://gmail.com', verify=False)
|
error[S501]: 24:36: Probable use of `httpx` call with `verify=False` disabling SSL certificate checks
S501.py:24:36: S501 Probable use of `httpx` call with `verify=False` disabling SSL certificate checks
--> S501.py:24:36
|
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
| ^^^^^^^^^^^^
25 | httpx.head('https://gmail.com', verify=True)
26 | httpx.head('https://gmail.com', verify=False)
|
error[S501]: 26:33: Probable use of `httpx` call with `verify=False` disabling SSL certificate checks
S501.py:26:33: S501 Probable use of `httpx` call with `verify=False` disabling SSL certificate checks
--> S501.py:26:33
|
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
| ^^^^^^^^^^^^
27 | httpx.post('https://gmail.com', verify=True)
28 | httpx.post('https://gmail.com', verify=False)
|
error[S501]: 28:33: Probable use of `httpx` call with `verify=False` disabling SSL certificate checks
S501.py:28:33: S501 Probable use of `httpx` call with `verify=False` disabling SSL certificate checks
--> S501.py:28:33
|
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
| ^^^^^^^^^^^^
29 | httpx.put('https://gmail.com', verify=True)
30 | httpx.put('https://gmail.com', verify=False)
|
error[S501]: 30:32: Probable use of `httpx` call with `verify=False` disabling SSL certificate checks
S501.py:30:32: S501 Probable use of `httpx` call with `verify=False` disabling SSL certificate checks
--> S501.py:30:32
|
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
| ^^^^^^^^^^^^
31 | httpx.patch('https://gmail.com', verify=True)
32 | httpx.patch('https://gmail.com', verify=False)
|
error[S501]: 32:34: Probable use of `httpx` call with `verify=False` disabling SSL certificate checks
S501.py:32:34: S501 Probable use of `httpx` call with `verify=False` disabling SSL certificate checks
--> S501.py:32:34
|
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
| ^^^^^^^^^^^^
33 | httpx.delete('https://gmail.com', verify=True)
34 | httpx.delete('https://gmail.com', verify=False)
|
error[S501]: 34:35: Probable use of `httpx` call with `verify=False` disabling SSL certificate checks
S501.py:34:35: S501 Probable use of `httpx` call with `verify=False` disabling SSL certificate checks
--> S501.py:34:35
|
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
| ^^^^^^^^^^^^
35 | httpx.stream('https://gmail.com', verify=True)
36 | httpx.stream('https://gmail.com', verify=False)
|
error[S501]: 36:35: Probable use of `httpx` call with `verify=False` disabling SSL certificate checks
S501.py:36:35: S501 Probable use of `httpx` call with `verify=False` disabling SSL certificate checks
--> S501.py:36:35
|
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
| ^^^^^^^^^^^^
37 | httpx.Client()
38 | httpx.Client(verify=False)
|
error[S501]: 38:14: Probable use of `httpx` call with `verify=False` disabling SSL certificate checks
S501.py:38:14: S501 Probable use of `httpx` call with `verify=False` disabling SSL certificate checks
--> S501.py:38:14
|
36 | httpx.stream('https://gmail.com', verify=False)
37 | httpx.Client()
38 | httpx.Client(verify=False)
| ^^^^^^^^^^^^ S501
| ^^^^^^^^^^^^
39 | httpx.AsyncClient()
40 | httpx.AsyncClient(verify=False)
|
error[S501]: 40:19: Probable use of `httpx` call with `verify=False` disabling SSL certificate checks
S501.py:40:19: S501 Probable use of `httpx` call with `verify=False` disabling SSL certificate checks
--> S501.py:40:19
|
38 | httpx.Client(verify=False)
39 | httpx.AsyncClient()
40 | httpx.AsyncClient(verify=False)
| ^^^^^^^^^^^^ S501
| ^^^^^^^^^^^^
|

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