mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-31 07:37:38 +00:00
Rename ruff
crate to ruff_linter
(#7529)
This commit is contained in:
parent
dcbd8eacd8
commit
5849a75223
4397 changed files with 93921 additions and 93915 deletions
|
@ -13,7 +13,7 @@ repository = { workspace = true }
|
|||
license = { workspace = true }
|
||||
|
||||
[dependencies]
|
||||
ruff = { path = "../ruff", default-features = false }
|
||||
ruff_linter = { path = "../ruff_linter", default-features = false }
|
||||
ruff_workspace = { path = "../ruff_workspace" }
|
||||
|
||||
anyhow = { workspace = true }
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//! Extract Black configuration settings from a pyproject.toml.
|
||||
|
||||
use ruff::line_width::LineLength;
|
||||
use ruff::settings::types::PythonVersion;
|
||||
use ruff_linter::line_width::LineLength;
|
||||
use ruff_linter::settings::types::PythonVersion;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Default)]
|
||||
|
|
|
@ -3,17 +3,17 @@ use std::str::FromStr;
|
|||
|
||||
use itertools::Itertools;
|
||||
|
||||
use ruff::line_width::LineLength;
|
||||
use ruff::registry::Linter;
|
||||
use ruff::rule_selector::RuleSelector;
|
||||
use ruff::rules::flake8_pytest_style::types::{
|
||||
use ruff_linter::line_width::LineLength;
|
||||
use ruff_linter::registry::Linter;
|
||||
use ruff_linter::rule_selector::RuleSelector;
|
||||
use ruff_linter::rules::flake8_pytest_style::types::{
|
||||
ParametrizeNameType, ParametrizeValuesRowType, ParametrizeValuesType,
|
||||
};
|
||||
use ruff::rules::flake8_quotes::settings::Quote;
|
||||
use ruff::rules::flake8_tidy_imports::settings::Strictness;
|
||||
use ruff::rules::pydocstyle::settings::Convention;
|
||||
use ruff::settings::types::PythonVersion;
|
||||
use ruff::warn_user;
|
||||
use ruff_linter::rules::flake8_quotes::settings::Quote;
|
||||
use ruff_linter::rules::flake8_tidy_imports::settings::Strictness;
|
||||
use ruff_linter::rules::pydocstyle::settings::Convention;
|
||||
use ruff_linter::settings::types::PythonVersion;
|
||||
use ruff_linter::warn_user;
|
||||
use ruff_workspace::options::{
|
||||
Flake8AnnotationsOptions, Flake8BugbearOptions, Flake8BuiltinsOptions, Flake8ErrMsgOptions,
|
||||
Flake8PytestStyleOptions, Flake8QuotesOptions, Flake8TidyImportsOptions, McCabeOptions,
|
||||
|
@ -458,12 +458,12 @@ mod tests {
|
|||
use pep440_rs::VersionSpecifiers;
|
||||
|
||||
use pretty_assertions::assert_eq;
|
||||
use ruff::line_width::LineLength;
|
||||
use ruff::registry::Linter;
|
||||
use ruff::rule_selector::RuleSelector;
|
||||
use ruff::rules::flake8_quotes;
|
||||
use ruff::rules::pydocstyle::settings::Convention;
|
||||
use ruff::settings::types::PythonVersion;
|
||||
use ruff_linter::line_width::LineLength;
|
||||
use ruff_linter::registry::Linter;
|
||||
use ruff_linter::rule_selector::RuleSelector;
|
||||
use ruff_linter::rules::flake8_quotes;
|
||||
use ruff_linter::rules::pydocstyle::settings::Convention;
|
||||
use ruff_linter::settings::types::PythonVersion;
|
||||
use ruff_workspace::options::{Flake8QuotesOptions, Options, PydocstyleOptions};
|
||||
use ruff_workspace::pyproject::Pyproject;
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ use crate::converter::convert;
|
|||
use crate::external_config::ExternalConfig;
|
||||
use crate::plugin::Plugin;
|
||||
use crate::pyproject::parse;
|
||||
use ruff::logging::{set_up_logging, LogLevel};
|
||||
use ruff_linter::logging::{set_up_logging, LogLevel};
|
||||
|
||||
#[derive(Parser)]
|
||||
#[command(
|
||||
|
|
|
@ -3,10 +3,11 @@ use std::str::FromStr;
|
|||
use anyhow::{bail, Result};
|
||||
use once_cell::sync::Lazy;
|
||||
use regex::Regex;
|
||||
use ruff::settings::types::PatternPrefixPair;
|
||||
use ruff::{warn_user, RuleSelector};
|
||||
use rustc_hash::FxHashMap;
|
||||
|
||||
use ruff_linter::settings::types::PatternPrefixPair;
|
||||
use ruff_linter::{warn_user, RuleSelector};
|
||||
|
||||
static COMMA_SEPARATED_LIST_RE: Lazy<Regex> = Lazy::new(|| Regex::new(r"[,\s]").unwrap());
|
||||
|
||||
/// Parse a comma-separated list of `RuleSelector` values (e.g.,
|
||||
|
@ -192,11 +193,11 @@ pub(crate) fn collect_per_file_ignores(
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use anyhow::Result;
|
||||
use ruff::RuleSelector;
|
||||
|
||||
use ruff::codes;
|
||||
use ruff::registry::Linter;
|
||||
use ruff::settings::types::PatternPrefixPair;
|
||||
use ruff_linter::codes;
|
||||
use ruff_linter::registry::Linter;
|
||||
use ruff_linter::settings::types::PatternPrefixPair;
|
||||
use ruff_linter::RuleSelector;
|
||||
|
||||
use super::{parse_files_to_codes_mapping, parse_prefix_codes, parse_strings};
|
||||
|
||||
|
|
|
@ -3,9 +3,9 @@ use std::fmt;
|
|||
use std::str::FromStr;
|
||||
|
||||
use anyhow::anyhow;
|
||||
use ruff::registry::Linter;
|
||||
use ruff::settings::types::PreviewMode;
|
||||
use ruff::RuleSelector;
|
||||
use ruff_linter::registry::Linter;
|
||||
use ruff_linter::settings::types::PreviewMode;
|
||||
use ruff_linter::RuleSelector;
|
||||
|
||||
#[derive(Copy, Clone, Ord, PartialOrd, Eq, PartialEq)]
|
||||
pub enum Plugin {
|
||||
|
|
|
@ -1,96 +0,0 @@
|
|||
# project
|
||||
|
||||
An example multi-package Python project used to test setting resolution and other complex
|
||||
behaviors.
|
||||
|
||||
## Expected behavior
|
||||
|
||||
Running from the repo root should pick up and enforce the appropriate settings for each package:
|
||||
|
||||
```console
|
||||
∴ cargo run -p ruff_cli -- check crates/ruff/resources/test/project/
|
||||
crates/ruff/resources/test/project/examples/.dotfiles/script.py:1:1: I001 [*] Import block is un-sorted or un-formatted
|
||||
crates/ruff/resources/test/project/examples/.dotfiles/script.py:1:8: F401 [*] `numpy` imported but unused
|
||||
crates/ruff/resources/test/project/examples/.dotfiles/script.py:2:17: F401 [*] `app.app_file` imported but unused
|
||||
crates/ruff/resources/test/project/examples/docs/docs/file.py:1:1: I001 [*] Import block is un-sorted or un-formatted
|
||||
crates/ruff/resources/test/project/examples/docs/docs/file.py:8:5: F841 [*] Local variable `x` is assigned to but never used
|
||||
crates/ruff/resources/test/project/project/file.py:1:8: F401 [*] `os` imported but unused
|
||||
crates/ruff/resources/test/project/project/import_file.py:1:1: I001 [*] Import block is un-sorted or un-formatted
|
||||
Found 7 errors.
|
||||
[*] 7 potentially fixable with the --fix option.
|
||||
```
|
||||
|
||||
Running from the project directory itself should exhibit the same behavior:
|
||||
|
||||
```console
|
||||
∴ (cd crates/ruff/resources/test/project/ && cargo run -p ruff_cli -- check .)
|
||||
examples/.dotfiles/script.py:1:1: I001 [*] Import block is un-sorted or un-formatted
|
||||
examples/.dotfiles/script.py:1:8: F401 [*] `numpy` imported but unused
|
||||
examples/.dotfiles/script.py:2:17: F401 [*] `app.app_file` imported but unused
|
||||
examples/docs/docs/file.py:1:1: I001 [*] Import block is un-sorted or un-formatted
|
||||
examples/docs/docs/file.py:8:5: F841 [*] Local variable `x` is assigned to but never used
|
||||
project/file.py:1:8: F401 [*] `os` imported but unused
|
||||
project/import_file.py:1:1: I001 [*] Import block is un-sorted or un-formatted
|
||||
Found 7 errors.
|
||||
[*] 7 potentially fixable with the --fix option.
|
||||
```
|
||||
|
||||
Running from the sub-package directory should exhibit the same behavior, but omit the top-level
|
||||
files:
|
||||
|
||||
```console
|
||||
∴ (cd crates/ruff/resources/test/project/examples/docs && cargo run -p ruff_cli -- check .)
|
||||
docs/file.py:1:1: I001 [*] Import block is un-sorted or un-formatted
|
||||
docs/file.py:8:5: F841 [*] Local variable `x` is assigned to but never used
|
||||
Found 2 errors.
|
||||
[*] 2 potentially fixable with the --fix option.
|
||||
```
|
||||
|
||||
`--config` should force Ruff to use the specified `pyproject.toml` for all files, and resolve
|
||||
file paths from the current working directory:
|
||||
|
||||
```console
|
||||
∴ (cargo run -p ruff_cli -- check --config=crates/ruff/resources/test/project/pyproject.toml crates/ruff/resources/test/project/)
|
||||
crates/ruff/resources/test/project/examples/.dotfiles/script.py:1:8: F401 [*] `numpy` imported but unused
|
||||
crates/ruff/resources/test/project/examples/.dotfiles/script.py:2:17: F401 [*] `app.app_file` imported but unused
|
||||
crates/ruff/resources/test/project/examples/docs/docs/concepts/file.py:1:8: F401 [*] `os` imported but unused
|
||||
crates/ruff/resources/test/project/examples/docs/docs/file.py:1:1: I001 [*] Import block is un-sorted or un-formatted
|
||||
crates/ruff/resources/test/project/examples/docs/docs/file.py:1:8: F401 [*] `os` imported but unused
|
||||
crates/ruff/resources/test/project/examples/docs/docs/file.py:3:8: F401 [*] `numpy` imported but unused
|
||||
crates/ruff/resources/test/project/examples/docs/docs/file.py:4:27: F401 [*] `docs.concepts.file` imported but unused
|
||||
crates/ruff/resources/test/project/examples/excluded/script.py:1:8: F401 [*] `os` imported but unused
|
||||
crates/ruff/resources/test/project/project/file.py:1:8: F401 [*] `os` imported but unused
|
||||
Found 9 errors.
|
||||
[*] 9 potentially fixable with the --fix option.
|
||||
```
|
||||
|
||||
Running from a parent directory should "ignore" the `exclude` (hence, `concepts/file.py` gets
|
||||
included in the output):
|
||||
|
||||
```console
|
||||
∴ (cd crates/ruff/resources/test/project/examples && cargo run -p ruff_cli -- check --config=docs/ruff.toml .)
|
||||
docs/docs/concepts/file.py:5:5: F841 [*] Local variable `x` is assigned to but never used
|
||||
docs/docs/file.py:1:1: I001 [*] Import block is un-sorted or un-formatted
|
||||
docs/docs/file.py:8:5: F841 [*] Local variable `x` is assigned to but never used
|
||||
excluded/script.py:5:5: F841 [*] Local variable `x` is assigned to but never used
|
||||
Found 4 errors.
|
||||
[*] 4 potentially fixable with the --fix option.
|
||||
```
|
||||
|
||||
Passing an excluded directory directly should report errors in the contained files:
|
||||
|
||||
```console
|
||||
∴ cargo run -p ruff_cli -- check crates/ruff/resources/test/project/examples/excluded/
|
||||
crates/ruff/resources/test/project/examples/excluded/script.py:1:8: F401 [*] `os` imported but unused
|
||||
Found 1 error.
|
||||
[*] 1 potentially fixable with the --fix option.
|
||||
```
|
||||
|
||||
Unless we `--force-exclude`:
|
||||
|
||||
```console
|
||||
∴ cargo run -p ruff_cli -- check crates/ruff/resources/test/project/examples/excluded/ --force-exclude
|
||||
warning: No Python files found under the given path(s)
|
||||
∴ cargo run -p ruff_cli -- check crates/ruff/resources/test/project/examples/excluded/script.py --force-exclude
|
||||
warning: No Python files found under the given path(s)
|
||||
```
|
|
@ -1,5 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/comments/shebang.rs
|
||||
expression: "ShebangDirective::try_extract(source)"
|
||||
---
|
||||
None
|
|
@ -1,5 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/comments/shebang.rs
|
||||
expression: "ShebangDirective::try_extract(source)"
|
||||
---
|
||||
None
|
|
@ -1,9 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/comments/shebang.rs
|
||||
expression: "ShebangDirective::try_extract(source)"
|
||||
---
|
||||
Some(
|
||||
ShebangDirective(
|
||||
"/usr/bin/env python",
|
||||
),
|
||||
)
|
|
@ -1,9 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/comments/shebang.rs
|
||||
expression: "ShebangDirective::try_extract(source)"
|
||||
---
|
||||
Some(
|
||||
ShebangDirective(
|
||||
"/usr/bin/env python # trailing comment",
|
||||
),
|
||||
)
|
|
@ -1,5 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/comments/shebang.rs
|
||||
expression: "ShebangDirective::try_extract(source)"
|
||||
---
|
||||
None
|
|
@ -1,8 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/message/azure.rs
|
||||
expression: content
|
||||
---
|
||||
##vso[task.logissue type=error;sourcepath=fib.py;linenumber=1;columnnumber=8;code=F401;]`os` imported but unused
|
||||
##vso[task.logissue type=error;sourcepath=fib.py;linenumber=6;columnnumber=5;code=F841;]Local variable `x` is assigned to but never used
|
||||
##vso[task.logissue type=error;sourcepath=undef.py;linenumber=1;columnnumber=4;code=F821;]Undefined name `a`
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/message/github.rs
|
||||
expression: content
|
||||
---
|
||||
::error title=Ruff (F401),file=fib.py,line=1,col=8,endLine=1,endColumn=10::fib.py:1:8: F401 `os` imported but unused
|
||||
::error title=Ruff (F841),file=fib.py,line=6,col=5,endLine=6,endColumn=6::fib.py:6:5: F841 Local variable `x` is assigned to but never used
|
||||
::error title=Ruff (F821),file=undef.py,line=1,col=4,endLine=1,endColumn=5::undef.py:1:4: F821 Undefined name `a`
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/message/gitlab.rs
|
||||
expression: redact_fingerprint(&content)
|
||||
---
|
||||
[
|
||||
{
|
||||
"description": "(F401) `os` imported but unused",
|
||||
"fingerprint": "<redacted>",
|
||||
"location": {
|
||||
"lines": {
|
||||
"begin": 1,
|
||||
"end": 1
|
||||
},
|
||||
"path": "fib.py"
|
||||
},
|
||||
"severity": "major"
|
||||
},
|
||||
{
|
||||
"description": "(F841) Local variable `x` is assigned to but never used",
|
||||
"fingerprint": "<redacted>",
|
||||
"location": {
|
||||
"lines": {
|
||||
"begin": 6,
|
||||
"end": 6
|
||||
},
|
||||
"path": "fib.py"
|
||||
},
|
||||
"severity": "major"
|
||||
},
|
||||
{
|
||||
"description": "(F821) Undefined name `a`",
|
||||
"fingerprint": "<redacted>",
|
||||
"location": {
|
||||
"lines": {
|
||||
"begin": 1,
|
||||
"end": 1
|
||||
},
|
||||
"path": "undef.py"
|
||||
},
|
||||
"severity": "major"
|
||||
}
|
||||
]
|
|
@ -1,12 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/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
|
||||
|
||||
undef.py:
|
||||
1:4 F821 Undefined name `a`
|
||||
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/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`
|
||||
|
||||
undef.py:
|
||||
1:4 F821 Undefined name `a`
|
||||
|
|
||||
1 | if a == 1: pass
|
||||
| ^ F821
|
||||
|
|
||||
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/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`
|
||||
|
||||
undef.py:
|
||||
1:4 F821 Undefined name `a`
|
||||
|
|
||||
1 | if a == 1: pass
|
||||
| ^ F821
|
||||
|
|
||||
|
||||
|
|
@ -1,86 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/message/json.rs
|
||||
expression: content
|
||||
---
|
||||
[
|
||||
{
|
||||
"code": "F401",
|
||||
"end_location": {
|
||||
"column": 10,
|
||||
"row": 1
|
||||
},
|
||||
"filename": "fib.py",
|
||||
"fix": {
|
||||
"applicability": "Suggested",
|
||||
"edits": [
|
||||
{
|
||||
"content": "",
|
||||
"end_location": {
|
||||
"column": 1,
|
||||
"row": 2
|
||||
},
|
||||
"location": {
|
||||
"column": 1,
|
||||
"row": 1
|
||||
}
|
||||
}
|
||||
],
|
||||
"message": "Remove unused import: `os`"
|
||||
},
|
||||
"location": {
|
||||
"column": 8,
|
||||
"row": 1
|
||||
},
|
||||
"message": "`os` imported but unused",
|
||||
"noqa_row": 1,
|
||||
"url": "https://docs.astral.sh/ruff/rules/unused-import"
|
||||
},
|
||||
{
|
||||
"code": "F841",
|
||||
"end_location": {
|
||||
"column": 6,
|
||||
"row": 6
|
||||
},
|
||||
"filename": "fib.py",
|
||||
"fix": {
|
||||
"applicability": "Suggested",
|
||||
"edits": [
|
||||
{
|
||||
"content": "",
|
||||
"end_location": {
|
||||
"column": 10,
|
||||
"row": 6
|
||||
},
|
||||
"location": {
|
||||
"column": 5,
|
||||
"row": 6
|
||||
}
|
||||
}
|
||||
],
|
||||
"message": "Remove assignment to unused variable `x`"
|
||||
},
|
||||
"location": {
|
||||
"column": 5,
|
||||
"row": 6
|
||||
},
|
||||
"message": "Local variable `x` is assigned to but never used",
|
||||
"noqa_row": 6,
|
||||
"url": "https://docs.astral.sh/ruff/rules/unused-variable"
|
||||
},
|
||||
{
|
||||
"code": "F821",
|
||||
"end_location": {
|
||||
"column": 5,
|
||||
"row": 1
|
||||
},
|
||||
"filename": "undef.py",
|
||||
"fix": null,
|
||||
"location": {
|
||||
"column": 4,
|
||||
"row": 1
|
||||
},
|
||||
"message": "Undefined name `a`",
|
||||
"noqa_row": 1,
|
||||
"url": "https://docs.astral.sh/ruff/rules/undefined-name"
|
||||
}
|
||||
]
|
|
@ -1,8 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/message/json_lines.rs
|
||||
expression: content
|
||||
---
|
||||
{"code":"F401","end_location":{"column":10,"row":1},"filename":"fib.py","fix":{"applicability":"Suggested","edits":[{"content":"","end_location":{"column":1,"row":2},"location":{"column":1,"row":1}}],"message":"Remove unused import: `os`"},"location":{"column":8,"row":1},"message":"`os` imported but unused","noqa_row":1,"url":"https://docs.astral.sh/ruff/rules/unused-import"}
|
||||
{"code":"F841","end_location":{"column":6,"row":6},"filename":"fib.py","fix":{"applicability":"Suggested","edits":[{"content":"","end_location":{"column":10,"row":6},"location":{"column":5,"row":6}}],"message":"Remove assignment to unused variable `x`"},"location":{"column":5,"row":6},"message":"Local variable `x` is assigned to but never used","noqa_row":6,"url":"https://docs.astral.sh/ruff/rules/unused-variable"}
|
||||
{"code":"F821","end_location":{"column":5,"row":1},"filename":"undef.py","fix":null,"location":{"column":4,"row":1},"message":"Undefined name `a`","noqa_row":1,"url":"https://docs.astral.sh/ruff/rules/undefined-name"}
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/message/junit.rs
|
||||
expression: content
|
||||
---
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<testsuites name="ruff" tests="3" failures="3" errors="0">
|
||||
<testsuite name="fib.py" tests="2" disabled="0" errors="0" failures="2" package="org.ruff">
|
||||
<testcase name="org.ruff.F401" classname="fib" line="1" column="8">
|
||||
<failure message="`os` imported but unused">line 1, col 8, `os` imported but unused</failure>
|
||||
</testcase>
|
||||
<testcase name="org.ruff.F841" classname="fib" line="6" column="5">
|
||||
<failure message="Local variable `x` is assigned to but never used">line 6, col 5, Local variable `x` is assigned to but never used</failure>
|
||||
</testcase>
|
||||
</testsuite>
|
||||
<testsuite name="undef.py" tests="1" disabled="0" errors="0" failures="1" package="org.ruff">
|
||||
<testcase name="org.ruff.F821" classname="undef" line="1" column="4">
|
||||
<failure message="Undefined name `a`">line 1, col 4, Undefined name `a`</failure>
|
||||
</testcase>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/message/pylint.rs
|
||||
expression: content
|
||||
---
|
||||
fib.py:1: [F401] `os` imported but unused
|
||||
fib.py:6: [F841] Local variable `x` is assigned to but never used
|
||||
undef.py:1: [F821] Undefined name `a`
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/message/text.rs
|
||||
expression: content
|
||||
---
|
||||
fib.py:1:8: F401 `os` imported but unused
|
||||
|
|
||||
1 | import os
|
||||
| ^^ F401
|
||||
|
|
||||
= help: Remove unused import: `os`
|
||||
|
||||
fib.py: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`
|
||||
|
||||
undef.py:1:4: F821 Undefined name `a`
|
||||
|
|
||||
1 | if a == 1: pass
|
||||
| ^ F821
|
||||
|
|
||||
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/message/text.rs
|
||||
expression: content
|
||||
---
|
||||
fib.py:1:8: F401 [*] `os` imported but unused
|
||||
|
|
||||
1 | import os
|
||||
| ^^ F401
|
||||
|
|
||||
= help: Remove unused import: `os`
|
||||
|
||||
fib.py: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`
|
||||
|
||||
undef.py:1:4: F821 Undefined name `a`
|
||||
|
|
||||
1 | if a == 1: pass
|
||||
| ^ F821
|
||||
|
|
||||
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/airflow/mod.rs
|
||||
---
|
||||
AIR001.py:11:1: AIR001 Task variable name should match the `task_id`: "my_task"
|
||||
|
|
||||
9 | my_task_2 = PythonOperator(callable=my_callable, task_id="my_task_2")
|
||||
10 |
|
||||
11 | incorrect_name = PythonOperator(task_id="my_task")
|
||||
| ^^^^^^^^^^^^^^ AIR001
|
||||
12 | incorrect_name_2 = PythonOperator(callable=my_callable, task_id="my_task_2")
|
||||
|
|
||||
|
||||
AIR001.py:12:1: AIR001 Task variable name should match the `task_id`: "my_task_2"
|
||||
|
|
||||
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
|
||||
|
|
||||
|
||||
|
|
@ -1,151 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/eradicate/mod.rs
|
||||
---
|
||||
ERA001.py:1:1: ERA001 [*] Found commented-out code
|
||||
|
|
||||
1 | #import os
|
||||
| ^^^^^^^^^^ ERA001
|
||||
2 | # from foo import junk
|
||||
3 | #a = 3
|
||||
|
|
||||
= help: Remove commented-out code
|
||||
|
||||
ℹ Possible 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
|
||||
|
|
||||
1 | #import os
|
||||
2 | # from foo import junk
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ ERA001
|
||||
3 | #a = 3
|
||||
4 | a = 4
|
||||
|
|
||||
= help: Remove commented-out code
|
||||
|
||||
ℹ Possible fix
|
||||
1 1 | #import os
|
||||
2 |-# from foo import junk
|
||||
3 2 | #a = 3
|
||||
4 3 | a = 4
|
||||
5 4 | #foo(1, 2, 3)
|
||||
|
||||
ERA001.py:3:1: ERA001 [*] Found commented-out code
|
||||
|
|
||||
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
|
||||
|
||||
ℹ Possible fix
|
||||
1 1 | #import os
|
||||
2 2 | # from foo import junk
|
||||
3 |-#a = 3
|
||||
4 3 | a = 4
|
||||
5 4 | #foo(1, 2, 3)
|
||||
6 5 |
|
||||
|
||||
ERA001.py:5:1: ERA001 [*] Found commented-out code
|
||||
|
|
||||
3 | #a = 3
|
||||
4 | a = 4
|
||||
5 | #foo(1, 2, 3)
|
||||
| ^^^^^^^^^^^^^ ERA001
|
||||
6 |
|
||||
7 | def foo(x, y, z):
|
||||
|
|
||||
= help: Remove commented-out code
|
||||
|
||||
ℹ Possible fix
|
||||
2 2 | # from foo import junk
|
||||
3 3 | #a = 3
|
||||
4 4 | a = 4
|
||||
5 |-#foo(1, 2, 3)
|
||||
6 5 |
|
||||
7 6 | def foo(x, y, z):
|
||||
8 7 | content = 1 # print('hello')
|
||||
|
||||
ERA001.py:13:5: ERA001 [*] Found commented-out code
|
||||
|
|
||||
11 | # This is a real comment.
|
||||
12 | # # This is a (nested) comment.
|
||||
13 | #return True
|
||||
| ^^^^^^^^^^^^ ERA001
|
||||
14 | return False
|
||||
|
|
||||
= help: Remove commented-out code
|
||||
|
||||
ℹ Possible fix
|
||||
10 10 |
|
||||
11 11 | # This is a real comment.
|
||||
12 12 | # # This is a (nested) comment.
|
||||
13 |- #return True
|
||||
14 13 | return False
|
||||
15 14 |
|
||||
16 15 | #import os # noqa: ERA001
|
||||
|
||||
ERA001.py:21:5: ERA001 [*] Found commented-out code
|
||||
|
|
||||
19 | class A():
|
||||
20 | pass
|
||||
21 | # b = c
|
||||
| ^^^^^^^ ERA001
|
||||
|
|
||||
= help: Remove commented-out code
|
||||
|
||||
ℹ Possible fix
|
||||
18 18 |
|
||||
19 19 | class A():
|
||||
20 20 | pass
|
||||
21 |- # b = c
|
||||
22 21 |
|
||||
23 22 |
|
||||
24 23 | dictionary = {
|
||||
|
||||
ERA001.py:26:5: ERA001 [*] Found commented-out code
|
||||
|
|
||||
24 | dictionary = {
|
||||
25 | # "key1": 123, # noqa: ERA001
|
||||
26 | # "key2": 456,
|
||||
| ^^^^^^^^^^^^^^ ERA001
|
||||
27 | # "key3": 789, # test
|
||||
28 | }
|
||||
|
|
||||
= help: Remove commented-out code
|
||||
|
||||
ℹ Possible fix
|
||||
23 23 |
|
||||
24 24 | dictionary = {
|
||||
25 25 | # "key1": 123, # noqa: ERA001
|
||||
26 |- # "key2": 456,
|
||||
27 26 | # "key3": 789, # test
|
||||
28 27 | }
|
||||
29 28 |
|
||||
|
||||
ERA001.py:27:5: ERA001 [*] Found commented-out code
|
||||
|
|
||||
25 | # "key1": 123, # noqa: ERA001
|
||||
26 | # "key2": 456,
|
||||
27 | # "key3": 789, # test
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ ERA001
|
||||
28 | }
|
||||
|
|
||||
= help: Remove commented-out code
|
||||
|
||||
ℹ Possible fix
|
||||
24 24 | dictionary = {
|
||||
25 25 | # "key1": 123, # noqa: ERA001
|
||||
26 26 | # "key2": 456,
|
||||
27 |- # "key3": 789, # test
|
||||
28 27 | }
|
||||
29 28 |
|
||||
30 29 | #import os # noqa
|
||||
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/flake8_2020/mod.rs
|
||||
---
|
||||
YTT101.py:6:7: YTT101 `sys.version[:3]` referenced (python3.10), use `sys.version_info`
|
||||
|
|
||||
4 | print(sys.version)
|
||||
5 |
|
||||
6 | print(sys.version[:3])
|
||||
| ^^^^^^^^^^^ YTT101
|
||||
7 | print(version[:3])
|
||||
8 | print(v[:3])
|
||||
|
|
||||
|
||||
YTT101.py:7:7: YTT101 `sys.version[:3]` referenced (python3.10), use `sys.version_info`
|
||||
|
|
||||
6 | print(sys.version[:3])
|
||||
7 | print(version[:3])
|
||||
| ^^^^^^^ YTT101
|
||||
8 | print(v[:3])
|
||||
|
|
||||
|
||||
YTT101.py:8:7: YTT101 `sys.version[:3]` referenced (python3.10), use `sys.version_info`
|
||||
|
|
||||
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
|
||||
|
|
||||
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/flake8_2020/mod.rs
|
||||
---
|
||||
YTT102.py:4:12: YTT102 `sys.version[2]` referenced (python3.10), use `sys.version_info`
|
||||
|
|
||||
2 | from sys import version
|
||||
3 |
|
||||
4 | py_minor = sys.version[2]
|
||||
| ^^^^^^^^^^^ YTT102
|
||||
5 | py_minor = version[2]
|
||||
|
|
||||
|
||||
YTT102.py:5:12: YTT102 `sys.version[2]` referenced (python3.10), use `sys.version_info`
|
||||
|
|
||||
4 | py_minor = sys.version[2]
|
||||
5 | py_minor = version[2]
|
||||
| ^^^^^^^ YTT102
|
||||
|
|
||||
|
||||
|
|
@ -1,50 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/flake8_2020/mod.rs
|
||||
---
|
||||
YTT103.py:4:1: YTT103 `sys.version` compared to string (python3.10), use `sys.version_info`
|
||||
|
|
||||
2 | from sys import version
|
||||
3 |
|
||||
4 | version < "3.5"
|
||||
| ^^^^^^^ YTT103
|
||||
5 | sys.version < "3.5"
|
||||
6 | sys.version <= "3.5"
|
||||
|
|
||||
|
||||
YTT103.py:5:1: YTT103 `sys.version` compared to string (python3.10), use `sys.version_info`
|
||||
|
|
||||
4 | version < "3.5"
|
||||
5 | sys.version < "3.5"
|
||||
| ^^^^^^^^^^^ YTT103
|
||||
6 | sys.version <= "3.5"
|
||||
7 | sys.version > "3.5"
|
||||
|
|
||||
|
||||
YTT103.py:6:1: YTT103 `sys.version` compared to string (python3.10), use `sys.version_info`
|
||||
|
|
||||
4 | version < "3.5"
|
||||
5 | sys.version < "3.5"
|
||||
6 | sys.version <= "3.5"
|
||||
| ^^^^^^^^^^^ YTT103
|
||||
7 | sys.version > "3.5"
|
||||
8 | sys.version >= "3.5"
|
||||
|
|
||||
|
||||
YTT103.py:7:1: YTT103 `sys.version` compared to string (python3.10), use `sys.version_info`
|
||||
|
|
||||
5 | sys.version < "3.5"
|
||||
6 | sys.version <= "3.5"
|
||||
7 | sys.version > "3.5"
|
||||
| ^^^^^^^^^^^ YTT103
|
||||
8 | sys.version >= "3.5"
|
||||
|
|
||||
|
||||
YTT103.py:8:1: YTT103 `sys.version` compared to string (python3.10), use `sys.version_info`
|
||||
|
|
||||
6 | sys.version <= "3.5"
|
||||
7 | sys.version > "3.5"
|
||||
8 | sys.version >= "3.5"
|
||||
| ^^^^^^^^^^^ YTT103
|
||||
|
|
||||
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/flake8_2020/mod.rs
|
||||
---
|
||||
YTT201.py:7:7: YTT201 `sys.version_info[0] == 3` referenced (python4), use `>=`
|
||||
|
|
||||
5 | PY3 = sys.version_info[0] >= 3
|
||||
6 |
|
||||
7 | PY3 = sys.version_info[0] == 3
|
||||
| ^^^^^^^^^^^^^^^^^^^ YTT201
|
||||
8 | PY3 = version_info[0] == 3
|
||||
9 | PY2 = sys.version_info[0] != 3
|
||||
|
|
||||
|
||||
YTT201.py:8:7: YTT201 `sys.version_info[0] == 3` referenced (python4), use `>=`
|
||||
|
|
||||
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
|
||||
|
|
||||
|
||||
YTT201.py:9:7: YTT201 `sys.version_info[0] == 3` referenced (python4), use `>=`
|
||||
|
|
||||
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
|
||||
|
|
||||
|
||||
YTT201.py:10:7: YTT201 `sys.version_info[0] == 3` referenced (python4), use `>=`
|
||||
|
|
||||
8 | PY3 = version_info[0] == 3
|
||||
9 | PY2 = sys.version_info[0] != 3
|
||||
10 | PY2 = version_info[0] != 3
|
||||
| ^^^^^^^^^^^^^^^ YTT201
|
||||
|
|
||||
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/flake8_2020/mod.rs
|
||||
---
|
||||
YTT202.py:4:4: YTT202 `six.PY3` referenced (python4), use `not six.PY2`
|
||||
|
|
||||
2 | from six import PY3
|
||||
3 |
|
||||
4 | if six.PY3:
|
||||
| ^^^^^^^ YTT202
|
||||
5 | print("3")
|
||||
6 | if PY3:
|
||||
|
|
||||
|
||||
YTT202.py:6:4: YTT202 `six.PY3` referenced (python4), use `not six.PY2`
|
||||
|
|
||||
4 | if six.PY3:
|
||||
5 | print("3")
|
||||
6 | if PY3:
|
||||
| ^^^ YTT202
|
||||
7 | print("3")
|
||||
|
|
||||
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/flake8_2020/mod.rs
|
||||
---
|
||||
YTT203.py:4:1: YTT203 `sys.version_info[1]` compared to integer (python4), compare `sys.version_info` to tuple
|
||||
|
|
||||
2 | from sys import version_info
|
||||
3 |
|
||||
4 | sys.version_info[1] >= 5
|
||||
| ^^^^^^^^^^^^^^^^^^^ YTT203
|
||||
5 | version_info[1] < 6
|
||||
|
|
||||
|
||||
YTT203.py:5:1: YTT203 `sys.version_info[1]` compared to integer (python4), compare `sys.version_info` to tuple
|
||||
|
|
||||
4 | sys.version_info[1] >= 5
|
||||
5 | version_info[1] < 6
|
||||
| ^^^^^^^^^^^^^^^ YTT203
|
||||
|
|
||||
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/flake8_2020/mod.rs
|
||||
---
|
||||
YTT204.py:4:1: YTT204 `sys.version_info.minor` compared to integer (python4), compare `sys.version_info` to tuple
|
||||
|
|
||||
2 | from sys import version_info
|
||||
3 |
|
||||
4 | sys.version_info.minor <= 7
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ YTT204
|
||||
5 | version_info.minor > 8
|
||||
|
|
||||
|
||||
YTT204.py:5:1: YTT204 `sys.version_info.minor` compared to integer (python4), compare `sys.version_info` to tuple
|
||||
|
|
||||
4 | sys.version_info.minor <= 7
|
||||
5 | version_info.minor > 8
|
||||
| ^^^^^^^^^^^^^^^^^^ YTT204
|
||||
|
|
||||
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/flake8_2020/mod.rs
|
||||
---
|
||||
YTT301.py:4:12: YTT301 `sys.version[0]` referenced (python10), use `sys.version_info`
|
||||
|
|
||||
2 | from sys import version
|
||||
3 |
|
||||
4 | py_major = sys.version[0]
|
||||
| ^^^^^^^^^^^ YTT301
|
||||
5 | py_major = version[0]
|
||||
|
|
||||
|
||||
YTT301.py:5:12: YTT301 `sys.version[0]` referenced (python10), use `sys.version_info`
|
||||
|
|
||||
4 | py_major = sys.version[0]
|
||||
5 | py_major = version[0]
|
||||
| ^^^^^^^ YTT301
|
||||
|
|
||||
|
||||
|
|
@ -1,50 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/flake8_2020/mod.rs
|
||||
---
|
||||
YTT302.py:4:1: YTT302 `sys.version` compared to string (python10), use `sys.version_info`
|
||||
|
|
||||
2 | from sys import version
|
||||
3 |
|
||||
4 | version < "3"
|
||||
| ^^^^^^^ YTT302
|
||||
5 | sys.version < "3"
|
||||
6 | sys.version <= "3"
|
||||
|
|
||||
|
||||
YTT302.py:5:1: YTT302 `sys.version` compared to string (python10), use `sys.version_info`
|
||||
|
|
||||
4 | version < "3"
|
||||
5 | sys.version < "3"
|
||||
| ^^^^^^^^^^^ YTT302
|
||||
6 | sys.version <= "3"
|
||||
7 | sys.version > "3"
|
||||
|
|
||||
|
||||
YTT302.py:6:1: YTT302 `sys.version` compared to string (python10), use `sys.version_info`
|
||||
|
|
||||
4 | version < "3"
|
||||
5 | sys.version < "3"
|
||||
6 | sys.version <= "3"
|
||||
| ^^^^^^^^^^^ YTT302
|
||||
7 | sys.version > "3"
|
||||
8 | sys.version >= "3"
|
||||
|
|
||||
|
||||
YTT302.py:7:1: YTT302 `sys.version` compared to string (python10), use `sys.version_info`
|
||||
|
|
||||
5 | sys.version < "3"
|
||||
6 | sys.version <= "3"
|
||||
7 | sys.version > "3"
|
||||
| ^^^^^^^^^^^ YTT302
|
||||
8 | sys.version >= "3"
|
||||
|
|
||||
|
||||
YTT302.py:8:1: YTT302 `sys.version` compared to string (python10), use `sys.version_info`
|
||||
|
|
||||
6 | sys.version <= "3"
|
||||
7 | sys.version > "3"
|
||||
8 | sys.version >= "3"
|
||||
| ^^^^^^^^^^^ YTT302
|
||||
|
|
||||
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/flake8_2020/mod.rs
|
||||
---
|
||||
YTT303.py:4:7: YTT303 `sys.version[:1]` referenced (python10), use `sys.version_info`
|
||||
|
|
||||
2 | from sys import version
|
||||
3 |
|
||||
4 | print(sys.version[:1])
|
||||
| ^^^^^^^^^^^ YTT303
|
||||
5 | print(version[:1])
|
||||
|
|
||||
|
||||
YTT303.py:5:7: YTT303 `sys.version[:1]` referenced (python10), use `sys.version_info`
|
||||
|
|
||||
4 | print(sys.version[:1])
|
||||
5 | print(version[:1])
|
||||
| ^^^^^^^ YTT303
|
||||
|
|
||||
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/flake8_annotations/mod.rs
|
||||
---
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/flake8_annotations/mod.rs
|
||||
---
|
||||
allow_overload.py:29:9: ANN201 Missing return type annotation for public function `bar`
|
||||
|
|
||||
28 | class X:
|
||||
29 | def bar(i):
|
||||
| ^^^ ANN201
|
||||
30 | return i
|
||||
|
|
||||
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/flake8_annotations/mod.rs
|
||||
---
|
||||
allow_star_arg_any.py:10:12: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `a`
|
||||
|
|
||||
9 | # ANN401
|
||||
10 | def foo(a: Any, *args: str, **kwargs: str) -> int:
|
||||
| ^^^ ANN401
|
||||
11 | pass
|
||||
|
|
||||
|
||||
allow_star_arg_any.py:15:47: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `foo`
|
||||
|
|
||||
14 | # ANN401
|
||||
15 | def foo(a: int, *args: str, **kwargs: str) -> Any:
|
||||
| ^^^ ANN401
|
||||
16 | pass
|
||||
|
|
||||
|
||||
allow_star_arg_any.py:40:29: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `a`
|
||||
|
|
||||
39 | # ANN401
|
||||
40 | def foo_method(self, a: Any, *params: str, **options: str) -> int:
|
||||
| ^^^ ANN401
|
||||
41 | pass
|
||||
|
|
||||
|
||||
allow_star_arg_any.py:44:67: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `foo_method`
|
||||
|
|
||||
43 | # ANN401
|
||||
44 | def foo_method(self, a: int, *params: str, **options: str) -> Any:
|
||||
| ^^^ ANN401
|
||||
45 | pass
|
||||
|
|
||||
|
||||
|
|
@ -1,263 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/flake8_annotations/mod.rs
|
||||
---
|
||||
annotation_presence.py:5:5: ANN201 Missing return type annotation for public function `foo`
|
||||
|
|
||||
4 | # Error
|
||||
5 | def foo(a, b):
|
||||
| ^^^ ANN201
|
||||
6 | pass
|
||||
|
|
||||
|
||||
annotation_presence.py:5:9: ANN001 Missing type annotation for function argument `a`
|
||||
|
|
||||
4 | # Error
|
||||
5 | def foo(a, b):
|
||||
| ^ ANN001
|
||||
6 | pass
|
||||
|
|
||||
|
||||
annotation_presence.py:5:12: ANN001 Missing type annotation for function argument `b`
|
||||
|
|
||||
4 | # Error
|
||||
5 | def foo(a, b):
|
||||
| ^ ANN001
|
||||
6 | pass
|
||||
|
|
||||
|
||||
annotation_presence.py:10:5: ANN201 Missing return type annotation for public function `foo`
|
||||
|
|
||||
9 | # Error
|
||||
10 | def foo(a: int, b):
|
||||
| ^^^ ANN201
|
||||
11 | pass
|
||||
|
|
||||
|
||||
annotation_presence.py:10:17: ANN001 Missing type annotation for function argument `b`
|
||||
|
|
||||
9 | # Error
|
||||
10 | def foo(a: int, b):
|
||||
| ^ ANN001
|
||||
11 | pass
|
||||
|
|
||||
|
||||
annotation_presence.py:15:17: ANN001 Missing type annotation for function argument `b`
|
||||
|
|
||||
14 | # Error
|
||||
15 | def foo(a: int, b) -> int:
|
||||
| ^ ANN001
|
||||
16 | pass
|
||||
|
|
||||
|
||||
annotation_presence.py:20:5: ANN201 Missing return type annotation for public function `foo`
|
||||
|
|
||||
19 | # Error
|
||||
20 | def foo(a: int, b: int):
|
||||
| ^^^ ANN201
|
||||
21 | pass
|
||||
|
|
||||
|
||||
annotation_presence.py:25:5: ANN201 Missing return type annotation for public function `foo`
|
||||
|
|
||||
24 | # Error
|
||||
25 | def foo():
|
||||
| ^^^ ANN201
|
||||
26 | pass
|
||||
|
|
||||
|
||||
annotation_presence.py:45:12: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `a`
|
||||
|
|
||||
44 | # ANN401
|
||||
45 | def foo(a: Any, *args: str, **kwargs: str) -> int:
|
||||
| ^^^ ANN401
|
||||
46 | pass
|
||||
|
|
||||
|
||||
annotation_presence.py:50:47: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `foo`
|
||||
|
|
||||
49 | # ANN401
|
||||
50 | def foo(a: int, *args: str, **kwargs: str) -> Any:
|
||||
| ^^^ ANN401
|
||||
51 | pass
|
||||
|
|
||||
|
||||
annotation_presence.py:55:24: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `*args`
|
||||
|
|
||||
54 | # ANN401
|
||||
55 | def foo(a: int, *args: Any, **kwargs: Any) -> int:
|
||||
| ^^^ ANN401
|
||||
56 | pass
|
||||
|
|
||||
|
||||
annotation_presence.py:55:39: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `**kwargs`
|
||||
|
|
||||
54 | # ANN401
|
||||
55 | def foo(a: int, *args: Any, **kwargs: Any) -> int:
|
||||
| ^^^ ANN401
|
||||
56 | pass
|
||||
|
|
||||
|
||||
annotation_presence.py:60:24: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `*args`
|
||||
|
|
||||
59 | # ANN401
|
||||
60 | def foo(a: int, *args: Any, **kwargs: str) -> int:
|
||||
| ^^^ ANN401
|
||||
61 | pass
|
||||
|
|
||||
|
||||
annotation_presence.py:65:39: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `**kwargs`
|
||||
|
|
||||
64 | # ANN401
|
||||
65 | def foo(a: int, *args: str, **kwargs: Any) -> int:
|
||||
| ^^^ ANN401
|
||||
66 | pass
|
||||
|
|
||||
|
||||
annotation_presence.py:75:13: ANN101 Missing type annotation for `self` in method
|
||||
|
|
||||
74 | # ANN101
|
||||
75 | def foo(self, a: int, b: int) -> int:
|
||||
| ^^^^ ANN101
|
||||
76 | pass
|
||||
|
|
||||
|
||||
annotation_presence.py:79:29: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `a`
|
||||
|
|
||||
78 | # ANN401
|
||||
79 | def foo(self: "Foo", a: Any, *params: str, **options: str) -> int:
|
||||
| ^^^ ANN401
|
||||
80 | pass
|
||||
|
|
||||
|
||||
annotation_presence.py:83:67: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `foo`
|
||||
|
|
||||
82 | # ANN401
|
||||
83 | def foo(self: "Foo", a: int, *params: str, **options: str) -> Any:
|
||||
| ^^^ ANN401
|
||||
84 | pass
|
||||
|
|
||||
|
||||
annotation_presence.py:87:43: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `*params`
|
||||
|
|
||||
86 | # ANN401
|
||||
87 | def foo(self: "Foo", a: int, *params: Any, **options: Any) -> int:
|
||||
| ^^^ ANN401
|
||||
88 | pass
|
||||
|
|
||||
|
||||
annotation_presence.py:87:59: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `**options`
|
||||
|
|
||||
86 | # ANN401
|
||||
87 | def foo(self: "Foo", a: int, *params: Any, **options: Any) -> int:
|
||||
| ^^^ ANN401
|
||||
88 | pass
|
||||
|
|
||||
|
||||
annotation_presence.py:91:43: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `*params`
|
||||
|
|
||||
90 | # ANN401
|
||||
91 | def foo(self: "Foo", a: int, *params: Any, **options: str) -> int:
|
||||
| ^^^ ANN401
|
||||
92 | pass
|
||||
|
|
||||
|
||||
annotation_presence.py:95:59: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `**options`
|
||||
|
|
||||
94 | # ANN401
|
||||
95 | def foo(self: "Foo", a: int, *params: str, **options: Any) -> int:
|
||||
| ^^^ ANN401
|
||||
96 | pass
|
||||
|
|
||||
|
||||
annotation_presence.py:130:13: ANN102 Missing type annotation for `cls` in classmethod
|
||||
|
|
||||
128 | # ANN102
|
||||
129 | @classmethod
|
||||
130 | def foo(cls, a: int, b: int) -> int:
|
||||
| ^^^ ANN102
|
||||
131 | pass
|
||||
|
|
||||
|
||||
annotation_presence.py:134:13: ANN101 Missing type annotation for `self` in method
|
||||
|
|
||||
133 | # ANN101
|
||||
134 | def foo(self, /, a: int, b: int) -> int:
|
||||
| ^^^^ ANN101
|
||||
135 | pass
|
||||
|
|
||||
|
||||
annotation_presence.py:149:10: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `a`
|
||||
|
|
||||
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: ...
|
||||
|
|
||||
|
||||
annotation_presence.py:150:10: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `a`
|
||||
|
|
||||
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: ...
|
||||
|
|
||||
|
||||
annotation_presence.py:151:10: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `a`
|
||||
|
|
||||
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: ...
|
||||
|
|
||||
|
||||
annotation_presence.py:152:10: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `a`
|
||||
|
|
||||
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: ...
|
||||
|
|
||||
|
||||
annotation_presence.py:153:10: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `a`
|
||||
|
|
||||
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: ...
|
||||
|
|
||||
|
||||
annotation_presence.py:154:10: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `a`
|
||||
|
|
||||
152 | def f(a: Optional[Any]) -> None: ...
|
||||
153 | def f(a: Annotated[Any, ...]) -> None: ...
|
||||
154 | def f(a: "Union[str, bytes, Any]") -> None: ...
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ ANN401
|
||||
|
|
||||
|
||||
annotation_presence.py:159:9: ANN204 [*] Missing return type annotation for special method `__init__`
|
||||
|
|
||||
157 | class Foo:
|
||||
158 | @decorator()
|
||||
159 | def __init__(self: "Foo", foo: int):
|
||||
| ^^^^^^^^ ANN204
|
||||
160 | ...
|
||||
|
|
||||
= help: Add `None` return type
|
||||
|
||||
ℹ Suggested fix
|
||||
156 156 |
|
||||
157 157 | class Foo:
|
||||
158 158 | @decorator()
|
||||
159 |- def __init__(self: "Foo", foo: int):
|
||||
159 |+ def __init__(self: "Foo", foo: int) -> None:
|
||||
160 160 | ...
|
||||
|
||||
|
|
@ -1,41 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/flake8_annotations/mod.rs
|
||||
---
|
||||
ignore_fully_untyped.py:24:5: ANN201 Missing return type annotation for public function `error_partially_typed_1`
|
||||
|
|
||||
24 | def error_partially_typed_1(a: int, b):
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ ANN201
|
||||
25 | pass
|
||||
|
|
||||
|
||||
ignore_fully_untyped.py:24:37: ANN001 Missing type annotation for function argument `b`
|
||||
|
|
||||
24 | def error_partially_typed_1(a: int, b):
|
||||
| ^ ANN001
|
||||
25 | pass
|
||||
|
|
||||
|
||||
ignore_fully_untyped.py:28:37: ANN001 Missing type annotation for function argument `b`
|
||||
|
|
||||
28 | def error_partially_typed_2(a: int, b) -> int:
|
||||
| ^ ANN001
|
||||
29 | pass
|
||||
|
|
||||
|
||||
ignore_fully_untyped.py:32:5: ANN201 Missing return type annotation for public function `error_partially_typed_3`
|
||||
|
|
||||
32 | def error_partially_typed_3(a: int, b: int):
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ ANN201
|
||||
33 | pass
|
||||
|
|
||||
|
||||
ignore_fully_untyped.py:43:9: ANN201 Missing return type annotation for public function `error_typed_self`
|
||||
|
|
||||
41 | pass
|
||||
42 |
|
||||
43 | def error_typed_self(self: X):
|
||||
| ^^^^^^^^^^^^^^^^ ANN201
|
||||
44 | pass
|
||||
|
|
||||
|
||||
|
|
@ -1,70 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/flake8_annotations/mod.rs
|
||||
---
|
||||
mypy_init_return.py:5:9: ANN204 [*] Missing return type annotation for special method `__init__`
|
||||
|
|
||||
3 | # Error
|
||||
4 | class Foo:
|
||||
5 | def __init__(self):
|
||||
| ^^^^^^^^ ANN204
|
||||
6 | ...
|
||||
|
|
||||
= help: Add `None` return type
|
||||
|
||||
ℹ Suggested fix
|
||||
2 2 |
|
||||
3 3 | # Error
|
||||
4 4 | class Foo:
|
||||
5 |- def __init__(self):
|
||||
5 |+ def __init__(self) -> None:
|
||||
6 6 | ...
|
||||
7 7 |
|
||||
8 8 |
|
||||
|
||||
mypy_init_return.py:11:9: ANN204 [*] Missing return type annotation for special method `__init__`
|
||||
|
|
||||
9 | # Error
|
||||
10 | class Foo:
|
||||
11 | def __init__(self, foo):
|
||||
| ^^^^^^^^ ANN204
|
||||
12 | ...
|
||||
|
|
||||
= help: Add `None` return type
|
||||
|
||||
ℹ Suggested fix
|
||||
8 8 |
|
||||
9 9 | # Error
|
||||
10 10 | class Foo:
|
||||
11 |- def __init__(self, foo):
|
||||
11 |+ def __init__(self, foo) -> None:
|
||||
12 12 | ...
|
||||
13 13 |
|
||||
14 14 |
|
||||
|
||||
mypy_init_return.py:40:5: ANN202 Missing return type annotation for private function `__init__`
|
||||
|
|
||||
39 | # Error
|
||||
40 | def __init__(self, foo: int):
|
||||
| ^^^^^^^^ ANN202
|
||||
41 | ...
|
||||
|
|
||||
|
||||
mypy_init_return.py:47:9: ANN204 [*] Missing return type annotation for special method `__init__`
|
||||
|
|
||||
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 `None` return type
|
||||
|
||||
ℹ Suggested 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.
|
||||
46 46 | class Foo:
|
||||
47 |- def __init__(self, *arg):
|
||||
47 |+ def __init__(self, *arg) -> None:
|
||||
48 48 | ...
|
||||
|
||||
|
|
@ -1,279 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/flake8_annotations/mod.rs
|
||||
---
|
||||
simple_magic_methods.py:2:9: ANN204 [*] Missing return type annotation for special method `__str__`
|
||||
|
|
||||
1 | class Foo:
|
||||
2 | def __str__(self):
|
||||
| ^^^^^^^ ANN204
|
||||
3 | ...
|
||||
|
|
||||
= help: Add `None` return type
|
||||
|
||||
ℹ Suggested fix
|
||||
1 1 | class Foo:
|
||||
2 |- def __str__(self):
|
||||
2 |+ def __str__(self) -> str:
|
||||
3 3 | ...
|
||||
4 4 |
|
||||
5 5 | def __repr__(self):
|
||||
|
||||
simple_magic_methods.py:5:9: ANN204 [*] Missing return type annotation for special method `__repr__`
|
||||
|
|
||||
3 | ...
|
||||
4 |
|
||||
5 | def __repr__(self):
|
||||
| ^^^^^^^^ ANN204
|
||||
6 | ...
|
||||
|
|
||||
= help: Add `None` return type
|
||||
|
||||
ℹ Suggested fix
|
||||
2 2 | def __str__(self):
|
||||
3 3 | ...
|
||||
4 4 |
|
||||
5 |- def __repr__(self):
|
||||
5 |+ def __repr__(self) -> str:
|
||||
6 6 | ...
|
||||
7 7 |
|
||||
8 8 | def __len__(self):
|
||||
|
||||
simple_magic_methods.py:8:9: ANN204 [*] Missing return type annotation for special method `__len__`
|
||||
|
|
||||
6 | ...
|
||||
7 |
|
||||
8 | def __len__(self):
|
||||
| ^^^^^^^ ANN204
|
||||
9 | ...
|
||||
|
|
||||
= help: Add `None` return type
|
||||
|
||||
ℹ Suggested fix
|
||||
5 5 | def __repr__(self):
|
||||
6 6 | ...
|
||||
7 7 |
|
||||
8 |- def __len__(self):
|
||||
8 |+ def __len__(self) -> int:
|
||||
9 9 | ...
|
||||
10 10 |
|
||||
11 11 | def __length_hint__(self):
|
||||
|
||||
simple_magic_methods.py:11:9: ANN204 [*] Missing return type annotation for special method `__length_hint__`
|
||||
|
|
||||
9 | ...
|
||||
10 |
|
||||
11 | def __length_hint__(self):
|
||||
| ^^^^^^^^^^^^^^^ ANN204
|
||||
12 | ...
|
||||
|
|
||||
= help: Add `None` return type
|
||||
|
||||
ℹ Suggested fix
|
||||
8 8 | def __len__(self):
|
||||
9 9 | ...
|
||||
10 10 |
|
||||
11 |- def __length_hint__(self):
|
||||
11 |+ def __length_hint__(self) -> int:
|
||||
12 12 | ...
|
||||
13 13 |
|
||||
14 14 | def __init__(self):
|
||||
|
||||
simple_magic_methods.py:14:9: ANN204 [*] Missing return type annotation for special method `__init__`
|
||||
|
|
||||
12 | ...
|
||||
13 |
|
||||
14 | def __init__(self):
|
||||
| ^^^^^^^^ ANN204
|
||||
15 | ...
|
||||
|
|
||||
= help: Add `None` return type
|
||||
|
||||
ℹ Suggested fix
|
||||
11 11 | def __length_hint__(self):
|
||||
12 12 | ...
|
||||
13 13 |
|
||||
14 |- def __init__(self):
|
||||
14 |+ def __init__(self) -> None:
|
||||
15 15 | ...
|
||||
16 16 |
|
||||
17 17 | def __del__(self):
|
||||
|
||||
simple_magic_methods.py:17:9: ANN204 [*] Missing return type annotation for special method `__del__`
|
||||
|
|
||||
15 | ...
|
||||
16 |
|
||||
17 | def __del__(self):
|
||||
| ^^^^^^^ ANN204
|
||||
18 | ...
|
||||
|
|
||||
= help: Add `None` return type
|
||||
|
||||
ℹ Suggested fix
|
||||
14 14 | def __init__(self):
|
||||
15 15 | ...
|
||||
16 16 |
|
||||
17 |- def __del__(self):
|
||||
17 |+ def __del__(self) -> None:
|
||||
18 18 | ...
|
||||
19 19 |
|
||||
20 20 | def __bool__(self):
|
||||
|
||||
simple_magic_methods.py:20:9: ANN204 [*] Missing return type annotation for special method `__bool__`
|
||||
|
|
||||
18 | ...
|
||||
19 |
|
||||
20 | def __bool__(self):
|
||||
| ^^^^^^^^ ANN204
|
||||
21 | ...
|
||||
|
|
||||
= help: Add `None` return type
|
||||
|
||||
ℹ Suggested fix
|
||||
17 17 | def __del__(self):
|
||||
18 18 | ...
|
||||
19 19 |
|
||||
20 |- def __bool__(self):
|
||||
20 |+ def __bool__(self) -> bool:
|
||||
21 21 | ...
|
||||
22 22 |
|
||||
23 23 | def __bytes__(self):
|
||||
|
||||
simple_magic_methods.py:23:9: ANN204 [*] Missing return type annotation for special method `__bytes__`
|
||||
|
|
||||
21 | ...
|
||||
22 |
|
||||
23 | def __bytes__(self):
|
||||
| ^^^^^^^^^ ANN204
|
||||
24 | ...
|
||||
|
|
||||
= help: Add `None` return type
|
||||
|
||||
ℹ Suggested fix
|
||||
20 20 | def __bool__(self):
|
||||
21 21 | ...
|
||||
22 22 |
|
||||
23 |- def __bytes__(self):
|
||||
23 |+ def __bytes__(self) -> bytes:
|
||||
24 24 | ...
|
||||
25 25 |
|
||||
26 26 | def __format__(self, format_spec):
|
||||
|
||||
simple_magic_methods.py:26:9: ANN204 [*] Missing return type annotation for special method `__format__`
|
||||
|
|
||||
24 | ...
|
||||
25 |
|
||||
26 | def __format__(self, format_spec):
|
||||
| ^^^^^^^^^^ ANN204
|
||||
27 | ...
|
||||
|
|
||||
= help: Add `None` return type
|
||||
|
||||
ℹ Suggested fix
|
||||
23 23 | def __bytes__(self):
|
||||
24 24 | ...
|
||||
25 25 |
|
||||
26 |- def __format__(self, format_spec):
|
||||
26 |+ def __format__(self, format_spec) -> str:
|
||||
27 27 | ...
|
||||
28 28 |
|
||||
29 29 | def __contains__(self, item):
|
||||
|
||||
simple_magic_methods.py:29:9: ANN204 [*] Missing return type annotation for special method `__contains__`
|
||||
|
|
||||
27 | ...
|
||||
28 |
|
||||
29 | def __contains__(self, item):
|
||||
| ^^^^^^^^^^^^ ANN204
|
||||
30 | ...
|
||||
|
|
||||
= help: Add `None` return type
|
||||
|
||||
ℹ Suggested fix
|
||||
26 26 | def __format__(self, format_spec):
|
||||
27 27 | ...
|
||||
28 28 |
|
||||
29 |- def __contains__(self, item):
|
||||
29 |+ def __contains__(self, item) -> bool:
|
||||
30 30 | ...
|
||||
31 31 |
|
||||
32 32 | def __complex__(self):
|
||||
|
||||
simple_magic_methods.py:32:9: ANN204 [*] Missing return type annotation for special method `__complex__`
|
||||
|
|
||||
30 | ...
|
||||
31 |
|
||||
32 | def __complex__(self):
|
||||
| ^^^^^^^^^^^ ANN204
|
||||
33 | ...
|
||||
|
|
||||
= help: Add `None` return type
|
||||
|
||||
ℹ Suggested fix
|
||||
29 29 | def __contains__(self, item):
|
||||
30 30 | ...
|
||||
31 31 |
|
||||
32 |- def __complex__(self):
|
||||
32 |+ def __complex__(self) -> complex:
|
||||
33 33 | ...
|
||||
34 34 |
|
||||
35 35 | def __int__(self):
|
||||
|
||||
simple_magic_methods.py:35:9: ANN204 [*] Missing return type annotation for special method `__int__`
|
||||
|
|
||||
33 | ...
|
||||
34 |
|
||||
35 | def __int__(self):
|
||||
| ^^^^^^^ ANN204
|
||||
36 | ...
|
||||
|
|
||||
= help: Add `None` return type
|
||||
|
||||
ℹ Suggested fix
|
||||
32 32 | def __complex__(self):
|
||||
33 33 | ...
|
||||
34 34 |
|
||||
35 |- def __int__(self):
|
||||
35 |+ def __int__(self) -> int:
|
||||
36 36 | ...
|
||||
37 37 |
|
||||
38 38 | def __float__(self):
|
||||
|
||||
simple_magic_methods.py:38:9: ANN204 [*] Missing return type annotation for special method `__float__`
|
||||
|
|
||||
36 | ...
|
||||
37 |
|
||||
38 | def __float__(self):
|
||||
| ^^^^^^^^^ ANN204
|
||||
39 | ...
|
||||
|
|
||||
= help: Add `None` return type
|
||||
|
||||
ℹ Suggested fix
|
||||
35 35 | def __int__(self):
|
||||
36 36 | ...
|
||||
37 37 |
|
||||
38 |- def __float__(self):
|
||||
38 |+ def __float__(self) -> float:
|
||||
39 39 | ...
|
||||
40 40 |
|
||||
41 41 | def __index__(self):
|
||||
|
||||
simple_magic_methods.py:41:9: ANN204 [*] Missing return type annotation for special method `__index__`
|
||||
|
|
||||
39 | ...
|
||||
40 |
|
||||
41 | def __index__(self):
|
||||
| ^^^^^^^^^ ANN204
|
||||
42 | ...
|
||||
|
|
||||
= help: Add `None` return type
|
||||
|
||||
ℹ Suggested fix
|
||||
38 38 | def __float__(self):
|
||||
39 39 | ...
|
||||
40 40 |
|
||||
41 |- def __index__(self):
|
||||
41 |+ def __index__(self) -> int:
|
||||
42 42 | ...
|
||||
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/flake8_annotations/mod.rs
|
||||
---
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/flake8_annotations/mod.rs
|
||||
---
|
||||
suppress_none_returning.py:45:5: ANN201 Missing return type annotation for public function `foo`
|
||||
|
|
||||
44 | # Error
|
||||
45 | def foo():
|
||||
| ^^^ ANN201
|
||||
46 | return True
|
||||
|
|
||||
|
||||
suppress_none_returning.py:50:5: ANN201 Missing return type annotation for public function `foo`
|
||||
|
|
||||
49 | # Error
|
||||
50 | def foo():
|
||||
| ^^^ ANN201
|
||||
51 | a = 2 + 2
|
||||
52 | if a == 4:
|
||||
|
|
||||
|
||||
suppress_none_returning.py:59:9: ANN001 Missing type annotation for function argument `a`
|
||||
|
|
||||
58 | # Error (on the argument, but not the return type)
|
||||
59 | def foo(a):
|
||||
| ^ ANN001
|
||||
60 | a = 2 + 2
|
||||
|
|
||||
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/flake8_async/mod.rs
|
||||
---
|
||||
ASYNC100.py:7:5: ASYNC100 Async functions should not call blocking HTTP methods
|
||||
|
|
||||
6 | async def foo():
|
||||
7 | urllib.request.urlopen("http://example.com/foo/bar").read()
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ ASYNC100
|
||||
|
|
||||
|
||||
ASYNC100.py:11:5: ASYNC100 Async functions should not call blocking HTTP methods
|
||||
|
|
||||
10 | async def foo():
|
||||
11 | requests.get()
|
||||
| ^^^^^^^^^^^^ ASYNC100
|
||||
|
|
||||
|
||||
ASYNC100.py:15:5: ASYNC100 Async functions should not call blocking HTTP methods
|
||||
|
|
||||
14 | async def foo():
|
||||
15 | httpx.get()
|
||||
| ^^^^^^^^^ ASYNC100
|
||||
|
|
||||
|
||||
ASYNC100.py:19:5: ASYNC100 Async functions should not call blocking HTTP methods
|
||||
|
|
||||
18 | async def foo():
|
||||
19 | requests.post()
|
||||
| ^^^^^^^^^^^^^ ASYNC100
|
||||
|
|
||||
|
||||
ASYNC100.py:23:5: ASYNC100 Async functions should not call blocking HTTP methods
|
||||
|
|
||||
22 | async def foo():
|
||||
23 | httpx.post()
|
||||
| ^^^^^^^^^^ ASYNC100
|
||||
|
|
||||
|
||||
|
|
@ -1,46 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/flake8_async/mod.rs
|
||||
---
|
||||
ASYNC101.py:7:5: ASYNC101 Async functions should not call `open`, `time.sleep`, or `subprocess` methods
|
||||
|
|
||||
6 | async def foo():
|
||||
7 | open("foo")
|
||||
| ^^^^ ASYNC101
|
||||
|
|
||||
|
||||
ASYNC101.py:11:5: ASYNC101 Async functions should not call `open`, `time.sleep`, or `subprocess` methods
|
||||
|
|
||||
10 | async def foo():
|
||||
11 | time.sleep(1)
|
||||
| ^^^^^^^^^^ ASYNC101
|
||||
|
|
||||
|
||||
ASYNC101.py:15:5: ASYNC101 Async functions should not call `open`, `time.sleep`, or `subprocess` methods
|
||||
|
|
||||
14 | async def foo():
|
||||
15 | subprocess.run("foo")
|
||||
| ^^^^^^^^^^^^^^ ASYNC101
|
||||
|
|
||||
|
||||
ASYNC101.py:19:5: ASYNC101 Async functions should not call `open`, `time.sleep`, or `subprocess` methods
|
||||
|
|
||||
18 | async def foo():
|
||||
19 | subprocess.call("foo")
|
||||
| ^^^^^^^^^^^^^^^ ASYNC101
|
||||
|
|
||||
|
||||
ASYNC101.py:27:5: ASYNC101 Async functions should not call `open`, `time.sleep`, or `subprocess` methods
|
||||
|
|
||||
26 | async def foo():
|
||||
27 | os.wait4(10)
|
||||
| ^^^^^^^^ ASYNC101
|
||||
|
|
||||
|
||||
ASYNC101.py:31:5: ASYNC101 Async functions should not call `open`, `time.sleep`, or `subprocess` methods
|
||||
|
|
||||
30 | async def foo():
|
||||
31 | os.wait(12)
|
||||
| ^^^^^^^ ASYNC101
|
||||
|
|
||||
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/flake8_async/mod.rs
|
||||
---
|
||||
ASYNC102.py:5:5: ASYNC102 Async functions should not call synchronous `os` methods
|
||||
|
|
||||
4 | async def foo():
|
||||
5 | os.popen()
|
||||
| ^^^^^^^^ ASYNC102
|
||||
|
|
||||
|
||||
ASYNC102.py:9:5: ASYNC102 Async functions should not call synchronous `os` methods
|
||||
|
|
||||
8 | async def foo():
|
||||
9 | os.spawnl()
|
||||
| ^^^^^^^^^ ASYNC102
|
||||
|
|
||||
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/flake8_bandit/mod.rs
|
||||
---
|
||||
S101.py:1:1: S101 Use of `assert` detected
|
||||
|
|
||||
1 | assert True # S101
|
||||
| ^^^^^^ S101
|
||||
|
|
||||
|
||||
S101.py:6:5: S101 Use of `assert` detected
|
||||
|
|
||||
4 | def fn():
|
||||
5 | x = 1
|
||||
6 | assert x == 1 # S101
|
||||
| ^^^^^^ S101
|
||||
7 | assert x == 2 # S101
|
||||
|
|
||||
|
||||
S101.py:7:5: S101 Use of `assert` detected
|
||||
|
|
||||
5 | x = 1
|
||||
6 | assert x == 1 # S101
|
||||
7 | assert x == 2 # S101
|
||||
| ^^^^^^ S101
|
||||
|
|
||||
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/flake8_bandit/mod.rs
|
||||
---
|
||||
S102.py:3:5: S102 Use of `exec` detected
|
||||
|
|
||||
1 | def fn():
|
||||
2 | # Error
|
||||
3 | exec('x = 2')
|
||||
| ^^^^ S102
|
||||
4 |
|
||||
5 | exec('y = 3')
|
||||
|
|
||||
|
||||
S102.py:5:1: S102 Use of `exec` detected
|
||||
|
|
||||
3 | exec('x = 2')
|
||||
4 |
|
||||
5 | exec('y = 3')
|
||||
| ^^^^ S102
|
||||
|
|
||||
|
||||
|
|
@ -1,131 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/flake8_bandit/mod.rs
|
||||
---
|
||||
S103.py:6:25: S103 `os.chmod` setting a permissive mask `0o227` on file or directory
|
||||
|
|
||||
4 | keyfile = "foo"
|
||||
5 |
|
||||
6 | os.chmod("/etc/passwd", 0o227) # Error
|
||||
| ^^^^^ S103
|
||||
7 | os.chmod("/etc/passwd", 0o7) # Error
|
||||
8 | os.chmod("/etc/passwd", 0o664) # OK
|
||||
|
|
||||
|
||||
S103.py:7:25: S103 `os.chmod` setting a permissive mask `0o7` on file or directory
|
||||
|
|
||||
6 | os.chmod("/etc/passwd", 0o227) # Error
|
||||
7 | os.chmod("/etc/passwd", 0o7) # Error
|
||||
| ^^^ S103
|
||||
8 | os.chmod("/etc/passwd", 0o664) # OK
|
||||
9 | os.chmod("/etc/passwd", 0o777) # Error
|
||||
|
|
||||
|
||||
S103.py:9:25: S103 `os.chmod` setting a permissive mask `0o777` on file or directory
|
||||
|
|
||||
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
|
||||
|
|
||||
|
||||
S103.py:10:25: S103 `os.chmod` setting a permissive mask `0o770` on file or directory
|
||||
|
|
||||
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
|
||||
|
|
||||
|
||||
S103.py:11:25: S103 `os.chmod` setting a permissive mask `0o776` on file or directory
|
||||
|
|
||||
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
|
||||
|
|
||||
|
||||
S103.py:13:23: S103 `os.chmod` setting a permissive mask `0o777` on file or directory
|
||||
|
|
||||
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
|
||||
|
|
||||
|
||||
S103.py:14:24: S103 `os.chmod` setting a permissive mask `0o777` on file or directory
|
||||
|
|
||||
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
|
||||
|
|
||||
|
||||
S103.py:15:25: S103 `os.chmod` setting a permissive mask `0o777` on file or directory
|
||||
|
|
||||
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
|
||||
|
|
||||
|
||||
S103.py:17:19: S103 `os.chmod` setting a permissive mask `0o777` on file or directory
|
||||
|
|
||||
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
|
||||
|
|
||||
|
||||
S103.py:18:19: S103 `os.chmod` setting a permissive mask `0o777` on file or directory
|
||||
|
|
||||
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
|
||||
|
|
||||
|
||||
S103.py:19:19: S103 `os.chmod` setting a permissive mask `0o777` on file or directory
|
||||
|
|
||||
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
|
||||
|
|
||||
|
||||
S103.py:20:27: S103 `os.chmod` setting a permissive mask `0o10` on file or directory
|
||||
|
|
||||
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
|
||||
|
|
||||
|
||||
S103.py:22:25: S103 `os.chmod` setting a permissive mask `0o2` on file or directory
|
||||
|
|
||||
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
|
||||
|
|
||||
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/flake8_bandit/mod.rs
|
||||
---
|
||||
S104.py:9:1: S104 Possible binding to all interfaces
|
||||
|
|
||||
8 | # Error
|
||||
9 | "0.0.0.0"
|
||||
| ^^^^^^^^^ S104
|
||||
10 | '0.0.0.0'
|
||||
|
|
||||
|
||||
S104.py:10:1: S104 Possible binding to all interfaces
|
||||
|
|
||||
8 | # Error
|
||||
9 | "0.0.0.0"
|
||||
10 | '0.0.0.0'
|
||||
| ^^^^^^^^^ S104
|
||||
|
|
||||
|
||||
S104.py:14:6: S104 Possible binding to all interfaces
|
||||
|
|
||||
13 | # Error
|
||||
14 | func("0.0.0.0")
|
||||
| ^^^^^^^^^ S104
|
||||
|
|
||||
|
||||
S104.py:18:9: S104 Possible binding to all interfaces
|
||||
|
|
||||
17 | def my_func():
|
||||
18 | x = "0.0.0.0"
|
||||
| ^^^^^^^^^ S104
|
||||
19 | print(x)
|
||||
|
|
||||
|
||||
|
|
@ -1,377 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/flake8_bandit/mod.rs
|
||||
---
|
||||
S105.py:13:12: S105 Possible hardcoded password assigned to: "password"
|
||||
|
|
||||
12 | # Errors
|
||||
13 | password = "s3cr3t"
|
||||
| ^^^^^^^^ S105
|
||||
14 | _pass = "s3cr3t"
|
||||
15 | passwd = "s3cr3t"
|
||||
|
|
||||
|
||||
S105.py:14:9: S105 Possible hardcoded password assigned to: "_pass"
|
||||
|
|
||||
12 | # Errors
|
||||
13 | password = "s3cr3t"
|
||||
14 | _pass = "s3cr3t"
|
||||
| ^^^^^^^^ S105
|
||||
15 | passwd = "s3cr3t"
|
||||
16 | pwd = "s3cr3t"
|
||||
|
|
||||
|
||||
S105.py:15:10: S105 Possible hardcoded password assigned to: "passwd"
|
||||
|
|
||||
13 | password = "s3cr3t"
|
||||
14 | _pass = "s3cr3t"
|
||||
15 | passwd = "s3cr3t"
|
||||
| ^^^^^^^^ S105
|
||||
16 | pwd = "s3cr3t"
|
||||
17 | secret = "s3cr3t"
|
||||
|
|
||||
|
||||
S105.py:16:7: S105 Possible hardcoded password assigned to: "pwd"
|
||||
|
|
||||
14 | _pass = "s3cr3t"
|
||||
15 | passwd = "s3cr3t"
|
||||
16 | pwd = "s3cr3t"
|
||||
| ^^^^^^^^ S105
|
||||
17 | secret = "s3cr3t"
|
||||
18 | token = "s3cr3t"
|
||||
|
|
||||
|
||||
S105.py:17:10: S105 Possible hardcoded password assigned to: "secret"
|
||||
|
|
||||
15 | passwd = "s3cr3t"
|
||||
16 | pwd = "s3cr3t"
|
||||
17 | secret = "s3cr3t"
|
||||
| ^^^^^^^^ S105
|
||||
18 | token = "s3cr3t"
|
||||
19 | secrete = "s3cr3t"
|
||||
|
|
||||
|
||||
S105.py:18:9: S105 Possible hardcoded password assigned to: "token"
|
||||
|
|
||||
16 | pwd = "s3cr3t"
|
||||
17 | secret = "s3cr3t"
|
||||
18 | token = "s3cr3t"
|
||||
| ^^^^^^^^ S105
|
||||
19 | secrete = "s3cr3t"
|
||||
20 | safe = password = "s3cr3t"
|
||||
|
|
||||
|
||||
S105.py:19:11: S105 Possible hardcoded password assigned to: "secrete"
|
||||
|
|
||||
17 | secret = "s3cr3t"
|
||||
18 | token = "s3cr3t"
|
||||
19 | secrete = "s3cr3t"
|
||||
| ^^^^^^^^ S105
|
||||
20 | safe = password = "s3cr3t"
|
||||
21 | password = safe = "s3cr3t"
|
||||
|
|
||||
|
||||
S105.py:20:19: S105 Possible hardcoded password assigned to: "password"
|
||||
|
|
||||
18 | token = "s3cr3t"
|
||||
19 | secrete = "s3cr3t"
|
||||
20 | safe = password = "s3cr3t"
|
||||
| ^^^^^^^^ S105
|
||||
21 | password = safe = "s3cr3t"
|
||||
22 | PASSWORD = "s3cr3t"
|
||||
|
|
||||
|
||||
S105.py:21:19: S105 Possible hardcoded password assigned to: "password"
|
||||
|
|
||||
19 | secrete = "s3cr3t"
|
||||
20 | safe = password = "s3cr3t"
|
||||
21 | password = safe = "s3cr3t"
|
||||
| ^^^^^^^^ S105
|
||||
22 | PASSWORD = "s3cr3t"
|
||||
23 | PassWord = "s3cr3t"
|
||||
|
|
||||
|
||||
S105.py:22:12: S105 Possible hardcoded password assigned to: "PASSWORD"
|
||||
|
|
||||
20 | safe = password = "s3cr3t"
|
||||
21 | password = safe = "s3cr3t"
|
||||
22 | PASSWORD = "s3cr3t"
|
||||
| ^^^^^^^^ S105
|
||||
23 | PassWord = "s3cr3t"
|
||||
|
|
||||
|
||||
S105.py:23:12: S105 Possible hardcoded password assigned to: "PassWord"
|
||||
|
|
||||
21 | password = safe = "s3cr3t"
|
||||
22 | PASSWORD = "s3cr3t"
|
||||
23 | PassWord = "s3cr3t"
|
||||
| ^^^^^^^^ S105
|
||||
24 |
|
||||
25 | d["password"] = "s3cr3t"
|
||||
|
|
||||
|
||||
S105.py:25:17: S105 Possible hardcoded password assigned to: "password"
|
||||
|
|
||||
23 | PassWord = "s3cr3t"
|
||||
24 |
|
||||
25 | d["password"] = "s3cr3t"
|
||||
| ^^^^^^^^ S105
|
||||
26 | d["pass"] = "s3cr3t"
|
||||
27 | d["passwd"] = "s3cr3t"
|
||||
|
|
||||
|
||||
S105.py:26:13: S105 Possible hardcoded password assigned to: "pass"
|
||||
|
|
||||
25 | d["password"] = "s3cr3t"
|
||||
26 | d["pass"] = "s3cr3t"
|
||||
| ^^^^^^^^ S105
|
||||
27 | d["passwd"] = "s3cr3t"
|
||||
28 | d["pwd"] = "s3cr3t"
|
||||
|
|
||||
|
||||
S105.py:27:15: S105 Possible hardcoded password assigned to: "passwd"
|
||||
|
|
||||
25 | d["password"] = "s3cr3t"
|
||||
26 | d["pass"] = "s3cr3t"
|
||||
27 | d["passwd"] = "s3cr3t"
|
||||
| ^^^^^^^^ S105
|
||||
28 | d["pwd"] = "s3cr3t"
|
||||
29 | d["secret"] = "s3cr3t"
|
||||
|
|
||||
|
||||
S105.py:28:12: S105 Possible hardcoded password assigned to: "pwd"
|
||||
|
|
||||
26 | d["pass"] = "s3cr3t"
|
||||
27 | d["passwd"] = "s3cr3t"
|
||||
28 | d["pwd"] = "s3cr3t"
|
||||
| ^^^^^^^^ S105
|
||||
29 | d["secret"] = "s3cr3t"
|
||||
30 | d["token"] = "s3cr3t"
|
||||
|
|
||||
|
||||
S105.py:29:15: S105 Possible hardcoded password assigned to: "secret"
|
||||
|
|
||||
27 | d["passwd"] = "s3cr3t"
|
||||
28 | d["pwd"] = "s3cr3t"
|
||||
29 | d["secret"] = "s3cr3t"
|
||||
| ^^^^^^^^ S105
|
||||
30 | d["token"] = "s3cr3t"
|
||||
31 | d["secrete"] = "s3cr3t"
|
||||
|
|
||||
|
||||
S105.py:30:14: S105 Possible hardcoded password assigned to: "token"
|
||||
|
|
||||
28 | d["pwd"] = "s3cr3t"
|
||||
29 | d["secret"] = "s3cr3t"
|
||||
30 | d["token"] = "s3cr3t"
|
||||
| ^^^^^^^^ S105
|
||||
31 | d["secrete"] = "s3cr3t"
|
||||
32 | safe = d["password"] = "s3cr3t"
|
||||
|
|
||||
|
||||
S105.py:31:16: S105 Possible hardcoded password assigned to: "secrete"
|
||||
|
|
||||
29 | d["secret"] = "s3cr3t"
|
||||
30 | d["token"] = "s3cr3t"
|
||||
31 | d["secrete"] = "s3cr3t"
|
||||
| ^^^^^^^^ S105
|
||||
32 | safe = d["password"] = "s3cr3t"
|
||||
33 | d["password"] = safe = "s3cr3t"
|
||||
|
|
||||
|
||||
S105.py:32:24: S105 Possible hardcoded password assigned to: "password"
|
||||
|
|
||||
30 | d["token"] = "s3cr3t"
|
||||
31 | d["secrete"] = "s3cr3t"
|
||||
32 | safe = d["password"] = "s3cr3t"
|
||||
| ^^^^^^^^ S105
|
||||
33 | d["password"] = safe = "s3cr3t"
|
||||
|
|
||||
|
||||
S105.py:33:24: S105 Possible hardcoded password assigned to: "password"
|
||||
|
|
||||
31 | d["secrete"] = "s3cr3t"
|
||||
32 | safe = d["password"] = "s3cr3t"
|
||||
33 | d["password"] = safe = "s3cr3t"
|
||||
| ^^^^^^^^ S105
|
||||
|
|
||||
|
||||
S105.py:37:16: S105 Possible hardcoded password assigned to: "password"
|
||||
|
|
||||
36 | class MyClass:
|
||||
37 | password = "s3cr3t"
|
||||
| ^^^^^^^^ S105
|
||||
38 | safe = password
|
||||
|
|
||||
|
||||
S105.py:41:20: S105 Possible hardcoded password assigned to: "password"
|
||||
|
|
||||
41 | MyClass.password = "s3cr3t"
|
||||
| ^^^^^^^^ S105
|
||||
42 | MyClass._pass = "s3cr3t"
|
||||
43 | MyClass.passwd = "s3cr3t"
|
||||
|
|
||||
|
||||
S105.py:42:17: S105 Possible hardcoded password assigned to: "_pass"
|
||||
|
|
||||
41 | MyClass.password = "s3cr3t"
|
||||
42 | MyClass._pass = "s3cr3t"
|
||||
| ^^^^^^^^ S105
|
||||
43 | MyClass.passwd = "s3cr3t"
|
||||
44 | MyClass.pwd = "s3cr3t"
|
||||
|
|
||||
|
||||
S105.py:43:18: S105 Possible hardcoded password assigned to: "passwd"
|
||||
|
|
||||
41 | MyClass.password = "s3cr3t"
|
||||
42 | MyClass._pass = "s3cr3t"
|
||||
43 | MyClass.passwd = "s3cr3t"
|
||||
| ^^^^^^^^ S105
|
||||
44 | MyClass.pwd = "s3cr3t"
|
||||
45 | MyClass.secret = "s3cr3t"
|
||||
|
|
||||
|
||||
S105.py:44:15: S105 Possible hardcoded password assigned to: "pwd"
|
||||
|
|
||||
42 | MyClass._pass = "s3cr3t"
|
||||
43 | MyClass.passwd = "s3cr3t"
|
||||
44 | MyClass.pwd = "s3cr3t"
|
||||
| ^^^^^^^^ S105
|
||||
45 | MyClass.secret = "s3cr3t"
|
||||
46 | MyClass.token = "s3cr3t"
|
||||
|
|
||||
|
||||
S105.py:45:18: S105 Possible hardcoded password assigned to: "secret"
|
||||
|
|
||||
43 | MyClass.passwd = "s3cr3t"
|
||||
44 | MyClass.pwd = "s3cr3t"
|
||||
45 | MyClass.secret = "s3cr3t"
|
||||
| ^^^^^^^^ S105
|
||||
46 | MyClass.token = "s3cr3t"
|
||||
47 | MyClass.secrete = "s3cr3t"
|
||||
|
|
||||
|
||||
S105.py:46:17: S105 Possible hardcoded password assigned to: "token"
|
||||
|
|
||||
44 | MyClass.pwd = "s3cr3t"
|
||||
45 | MyClass.secret = "s3cr3t"
|
||||
46 | MyClass.token = "s3cr3t"
|
||||
| ^^^^^^^^ S105
|
||||
47 | MyClass.secrete = "s3cr3t"
|
||||
|
|
||||
|
||||
S105.py:47:19: S105 Possible hardcoded password assigned to: "secrete"
|
||||
|
|
||||
45 | MyClass.secret = "s3cr3t"
|
||||
46 | MyClass.token = "s3cr3t"
|
||||
47 | MyClass.secrete = "s3cr3t"
|
||||
| ^^^^^^^^ S105
|
||||
48 |
|
||||
49 | password == "s3cr3t"
|
||||
|
|
||||
|
||||
S105.py:49:13: S105 Possible hardcoded password assigned to: "password"
|
||||
|
|
||||
47 | MyClass.secrete = "s3cr3t"
|
||||
48 |
|
||||
49 | password == "s3cr3t"
|
||||
| ^^^^^^^^ S105
|
||||
50 | _pass == "s3cr3t"
|
||||
51 | passwd == "s3cr3t"
|
||||
|
|
||||
|
||||
S105.py:50:10: S105 Possible hardcoded password assigned to: "_pass"
|
||||
|
|
||||
49 | password == "s3cr3t"
|
||||
50 | _pass == "s3cr3t"
|
||||
| ^^^^^^^^ S105
|
||||
51 | passwd == "s3cr3t"
|
||||
52 | pwd == "s3cr3t"
|
||||
|
|
||||
|
||||
S105.py:51:11: S105 Possible hardcoded password assigned to: "passwd"
|
||||
|
|
||||
49 | password == "s3cr3t"
|
||||
50 | _pass == "s3cr3t"
|
||||
51 | passwd == "s3cr3t"
|
||||
| ^^^^^^^^ S105
|
||||
52 | pwd == "s3cr3t"
|
||||
53 | secret == "s3cr3t"
|
||||
|
|
||||
|
||||
S105.py:52:8: S105 Possible hardcoded password assigned to: "pwd"
|
||||
|
|
||||
50 | _pass == "s3cr3t"
|
||||
51 | passwd == "s3cr3t"
|
||||
52 | pwd == "s3cr3t"
|
||||
| ^^^^^^^^ S105
|
||||
53 | secret == "s3cr3t"
|
||||
54 | token == "s3cr3t"
|
||||
|
|
||||
|
||||
S105.py:53:11: S105 Possible hardcoded password assigned to: "secret"
|
||||
|
|
||||
51 | passwd == "s3cr3t"
|
||||
52 | pwd == "s3cr3t"
|
||||
53 | secret == "s3cr3t"
|
||||
| ^^^^^^^^ S105
|
||||
54 | token == "s3cr3t"
|
||||
55 | secrete == "s3cr3t"
|
||||
|
|
||||
|
||||
S105.py:54:10: S105 Possible hardcoded password assigned to: "token"
|
||||
|
|
||||
52 | pwd == "s3cr3t"
|
||||
53 | secret == "s3cr3t"
|
||||
54 | token == "s3cr3t"
|
||||
| ^^^^^^^^ S105
|
||||
55 | secrete == "s3cr3t"
|
||||
56 | password == safe == "s3cr3t"
|
||||
|
|
||||
|
||||
S105.py:55:12: S105 Possible hardcoded password assigned to: "secrete"
|
||||
|
|
||||
53 | secret == "s3cr3t"
|
||||
54 | token == "s3cr3t"
|
||||
55 | secrete == "s3cr3t"
|
||||
| ^^^^^^^^ S105
|
||||
56 | password == safe == "s3cr3t"
|
||||
|
|
||||
|
||||
S105.py:56:21: S105 Possible hardcoded password assigned to: "password"
|
||||
|
|
||||
54 | token == "s3cr3t"
|
||||
55 | secrete == "s3cr3t"
|
||||
56 | password == safe == "s3cr3t"
|
||||
| ^^^^^^^^ S105
|
||||
57 |
|
||||
58 | if token == "1\n2":
|
||||
|
|
||||
|
||||
S105.py:58:13: S105 Possible hardcoded password assigned to: "token"
|
||||
|
|
||||
56 | password == safe == "s3cr3t"
|
||||
57 |
|
||||
58 | if token == "1\n2":
|
||||
| ^^^^^^ S105
|
||||
59 | pass
|
||||
|
|
||||
|
||||
S105.py:61:13: S105 Possible hardcoded password assigned to: "token"
|
||||
|
|
||||
59 | pass
|
||||
60 |
|
||||
61 | if token == "3\t4":
|
||||
| ^^^^^^ S105
|
||||
62 | pass
|
||||
|
|
||||
|
||||
S105.py:64:13: S105 Possible hardcoded password assigned to: "token"
|
||||
|
|
||||
62 | pass
|
||||
63 |
|
||||
64 | if token == "5\r6":
|
||||
| ^^^^^^ S105
|
||||
65 | pass
|
||||
|
|
||||
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/flake8_bandit/mod.rs
|
||||
---
|
||||
S106.py:14:9: S106 Possible hardcoded password assigned to argument: "password"
|
||||
|
|
||||
13 | # Error
|
||||
14 | func(1, password="s3cr3t")
|
||||
| ^^^^^^^^^^^^^^^^^ S106
|
||||
|
|
||||
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/flake8_bandit/mod.rs
|
||||
---
|
||||
S107.py:5:29: S107 Possible hardcoded password assigned to function default: "password"
|
||||
|
|
||||
5 | def default(first, password="default"):
|
||||
| ^^^^^^^^^ S107
|
||||
6 | pass
|
||||
|
|
||||
|
||||
S107.py:13:45: S107 Possible hardcoded password assigned to function default: "password"
|
||||
|
|
||||
13 | def default_posonly(first, /, pos, password="posonly"):
|
||||
| ^^^^^^^^^ S107
|
||||
14 | pass
|
||||
|
|
||||
|
||||
S107.py:21:39: S107 Possible hardcoded password assigned to function default: "password"
|
||||
|
|
||||
21 | def default_kwonly(first, *, password="kwonly"):
|
||||
| ^^^^^^^^ S107
|
||||
22 | pass
|
||||
|
|
||||
|
||||
S107.py:29:39: S107 Possible hardcoded password assigned to function default: "secret"
|
||||
|
|
||||
29 | def default_all(first, /, pos, secret="posonly", *, password="kwonly"):
|
||||
| ^^^^^^^^^ S107
|
||||
30 | pass
|
||||
|
|
||||
|
||||
S107.py:29:62: S107 Possible hardcoded password assigned to function default: "password"
|
||||
|
|
||||
29 | def default_all(first, /, pos, secret="posonly", *, password="kwonly"):
|
||||
| ^^^^^^^^ S107
|
||||
30 | pass
|
||||
|
|
||||
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/flake8_bandit/mod.rs
|
||||
---
|
||||
S108.py:5:11: S108 Probable insecure usage of temporary file or directory: "/tmp/abc"
|
||||
|
|
||||
3 | f.write("def")
|
||||
4 |
|
||||
5 | with open("/tmp/abc", "w") as f:
|
||||
| ^^^^^^^^^^ S108
|
||||
6 | f.write("def")
|
||||
|
|
||||
|
||||
S108.py:8:11: S108 Probable insecure usage of temporary file or directory: "/var/tmp/123"
|
||||
|
|
||||
6 | f.write("def")
|
||||
7 |
|
||||
8 | with open("/var/tmp/123", "w") as f:
|
||||
| ^^^^^^^^^^^^^^ S108
|
||||
9 | f.write("def")
|
||||
|
|
||||
|
||||
S108.py:11:11: S108 Probable insecure usage of temporary file or directory: "/dev/shm/unit/test"
|
||||
|
|
||||
9 | f.write("def")
|
||||
10 |
|
||||
11 | with open("/dev/shm/unit/test", "w") as f:
|
||||
| ^^^^^^^^^^^^^^^^^^^^ S108
|
||||
12 | f.write("def")
|
||||
|
|
||||
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/flake8_bandit/mod.rs
|
||||
---
|
||||
S108.py:5:11: S108 Probable insecure usage of temporary file or directory: "/tmp/abc"
|
||||
|
|
||||
3 | f.write("def")
|
||||
4 |
|
||||
5 | with open("/tmp/abc", "w") as f:
|
||||
| ^^^^^^^^^^ S108
|
||||
6 | f.write("def")
|
||||
|
|
||||
|
||||
S108.py:8:11: S108 Probable insecure usage of temporary file or directory: "/var/tmp/123"
|
||||
|
|
||||
6 | f.write("def")
|
||||
7 |
|
||||
8 | with open("/var/tmp/123", "w") as f:
|
||||
| ^^^^^^^^^^^^^^ S108
|
||||
9 | f.write("def")
|
||||
|
|
||||
|
||||
S108.py:11:11: S108 Probable insecure usage of temporary file or directory: "/dev/shm/unit/test"
|
||||
|
|
||||
9 | f.write("def")
|
||||
10 |
|
||||
11 | with open("/dev/shm/unit/test", "w") as f:
|
||||
| ^^^^^^^^^^^^^^^^^^^^ S108
|
||||
12 | f.write("def")
|
||||
|
|
||||
|
||||
S108.py:15:11: S108 Probable insecure usage of temporary file or directory: "/foo/bar"
|
||||
|
|
||||
14 | # not ok by config
|
||||
15 | with open("/foo/bar", "w") as f:
|
||||
| ^^^^^^^^^^ S108
|
||||
16 | f.write("def")
|
||||
|
|
||||
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/flake8_bandit/mod.rs
|
||||
---
|
||||
S110.py:3:1: S110 `try`-`except`-`pass` detected, consider logging the exception
|
||||
|
|
||||
1 | try:
|
||||
2 | pass
|
||||
3 | / except Exception:
|
||||
4 | | pass
|
||||
| |________^ S110
|
||||
5 |
|
||||
6 | try:
|
||||
|
|
||||
|
||||
S110.py:8:1: S110 `try`-`except`-`pass` detected, consider logging the exception
|
||||
|
|
||||
6 | try:
|
||||
7 | pass
|
||||
8 | / except:
|
||||
9 | | pass
|
||||
| |________^ S110
|
||||
10 |
|
||||
11 | try:
|
||||
|
|
||||
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/flake8_bandit/mod.rs
|
||||
---
|
||||
S110.py:3:1: S110 `try`-`except`-`pass` detected, consider logging the exception
|
||||
|
|
||||
1 | try:
|
||||
2 | pass
|
||||
3 | / except Exception:
|
||||
4 | | pass
|
||||
| |________^ S110
|
||||
5 |
|
||||
6 | try:
|
||||
|
|
||||
|
||||
S110.py:8:1: S110 `try`-`except`-`pass` detected, consider logging the exception
|
||||
|
|
||||
6 | try:
|
||||
7 | pass
|
||||
8 | / except:
|
||||
9 | | pass
|
||||
| |________^ S110
|
||||
10 |
|
||||
11 | try:
|
||||
|
|
||||
|
||||
S110.py:13:1: S110 `try`-`except`-`pass` detected, consider logging the exception
|
||||
|
|
||||
11 | try:
|
||||
12 | pass
|
||||
13 | / except ValueError:
|
||||
14 | | pass
|
||||
| |________^ S110
|
||||
|
|
||||
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/flake8_bandit/mod.rs
|
||||
---
|
||||
S112.py:3:1: S112 `try`-`except`-`continue` detected, consider logging the exception
|
||||
|
|
||||
1 | try:
|
||||
2 | pass
|
||||
3 | / except Exception:
|
||||
4 | | continue
|
||||
| |____________^ S112
|
||||
5 |
|
||||
6 | try:
|
||||
|
|
||||
|
||||
S112.py:8:1: S112 `try`-`except`-`continue` detected, consider logging the exception
|
||||
|
|
||||
6 | try:
|
||||
7 | pass
|
||||
8 | / except:
|
||||
9 | | continue
|
||||
| |____________^ S112
|
||||
10 |
|
||||
11 | try:
|
||||
|
|
||||
|
||||
S112.py:13:1: S112 `try`-`except`-`continue` detected, consider logging the exception
|
||||
|
|
||||
11 | try:
|
||||
12 | pass
|
||||
13 | / except (Exception,):
|
||||
14 | | continue
|
||||
| |____________^ S112
|
||||
15 |
|
||||
16 | try:
|
||||
|
|
||||
|
||||
S112.py:18:1: S112 `try`-`except`-`continue` detected, consider logging the exception
|
||||
|
|
||||
16 | try:
|
||||
17 | pass
|
||||
18 | / except (Exception, ValueError):
|
||||
19 | | continue
|
||||
| |____________^ S112
|
||||
20 |
|
||||
21 | try:
|
||||
|
|
||||
|
||||
|
|
@ -1,142 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/flake8_bandit/mod.rs
|
||||
---
|
||||
S113.py:3:1: S113 Probable use of requests call without timeout
|
||||
|
|
||||
1 | import requests
|
||||
2 |
|
||||
3 | requests.get('https://gmail.com')
|
||||
| ^^^^^^^^^^^^ S113
|
||||
4 | requests.get('https://gmail.com', timeout=None)
|
||||
5 | requests.get('https://gmail.com', timeout=5)
|
||||
|
|
||||
|
||||
S113.py:4:35: S113 Probable use of requests call with timeout set to `None`
|
||||
|
|
||||
3 | requests.get('https://gmail.com')
|
||||
4 | requests.get('https://gmail.com', timeout=None)
|
||||
| ^^^^^^^^^^^^ S113
|
||||
5 | requests.get('https://gmail.com', timeout=5)
|
||||
6 | requests.post('https://gmail.com')
|
||||
|
|
||||
|
||||
S113.py:6:1: S113 Probable use of requests call without timeout
|
||||
|
|
||||
4 | requests.get('https://gmail.com', timeout=None)
|
||||
5 | requests.get('https://gmail.com', timeout=5)
|
||||
6 | requests.post('https://gmail.com')
|
||||
| ^^^^^^^^^^^^^ S113
|
||||
7 | requests.post('https://gmail.com', timeout=None)
|
||||
8 | requests.post('https://gmail.com', timeout=5)
|
||||
|
|
||||
|
||||
S113.py:7:36: S113 Probable use of requests call with timeout set to `None`
|
||||
|
|
||||
5 | requests.get('https://gmail.com', timeout=5)
|
||||
6 | requests.post('https://gmail.com')
|
||||
7 | requests.post('https://gmail.com', timeout=None)
|
||||
| ^^^^^^^^^^^^ S113
|
||||
8 | requests.post('https://gmail.com', timeout=5)
|
||||
9 | requests.put('https://gmail.com')
|
||||
|
|
||||
|
||||
S113.py:9:1: S113 Probable use of requests call without timeout
|
||||
|
|
||||
7 | requests.post('https://gmail.com', timeout=None)
|
||||
8 | requests.post('https://gmail.com', timeout=5)
|
||||
9 | requests.put('https://gmail.com')
|
||||
| ^^^^^^^^^^^^ S113
|
||||
10 | requests.put('https://gmail.com', timeout=None)
|
||||
11 | requests.put('https://gmail.com', timeout=5)
|
||||
|
|
||||
|
||||
S113.py:10:35: S113 Probable use of requests call with timeout set to `None`
|
||||
|
|
||||
8 | requests.post('https://gmail.com', timeout=5)
|
||||
9 | requests.put('https://gmail.com')
|
||||
10 | requests.put('https://gmail.com', timeout=None)
|
||||
| ^^^^^^^^^^^^ S113
|
||||
11 | requests.put('https://gmail.com', timeout=5)
|
||||
12 | requests.delete('https://gmail.com')
|
||||
|
|
||||
|
||||
S113.py:12:1: S113 Probable use of requests call without timeout
|
||||
|
|
||||
10 | requests.put('https://gmail.com', timeout=None)
|
||||
11 | requests.put('https://gmail.com', timeout=5)
|
||||
12 | requests.delete('https://gmail.com')
|
||||
| ^^^^^^^^^^^^^^^ S113
|
||||
13 | requests.delete('https://gmail.com', timeout=None)
|
||||
14 | requests.delete('https://gmail.com', timeout=5)
|
||||
|
|
||||
|
||||
S113.py:13:38: S113 Probable use of requests call with timeout set to `None`
|
||||
|
|
||||
11 | requests.put('https://gmail.com', timeout=5)
|
||||
12 | requests.delete('https://gmail.com')
|
||||
13 | requests.delete('https://gmail.com', timeout=None)
|
||||
| ^^^^^^^^^^^^ S113
|
||||
14 | requests.delete('https://gmail.com', timeout=5)
|
||||
15 | requests.patch('https://gmail.com')
|
||||
|
|
||||
|
||||
S113.py:15:1: S113 Probable use of requests call without timeout
|
||||
|
|
||||
13 | requests.delete('https://gmail.com', timeout=None)
|
||||
14 | requests.delete('https://gmail.com', timeout=5)
|
||||
15 | requests.patch('https://gmail.com')
|
||||
| ^^^^^^^^^^^^^^ S113
|
||||
16 | requests.patch('https://gmail.com', timeout=None)
|
||||
17 | requests.patch('https://gmail.com', timeout=5)
|
||||
|
|
||||
|
||||
S113.py:16:37: S113 Probable use of requests call with timeout set to `None`
|
||||
|
|
||||
14 | requests.delete('https://gmail.com', timeout=5)
|
||||
15 | requests.patch('https://gmail.com')
|
||||
16 | requests.patch('https://gmail.com', timeout=None)
|
||||
| ^^^^^^^^^^^^ S113
|
||||
17 | requests.patch('https://gmail.com', timeout=5)
|
||||
18 | requests.options('https://gmail.com')
|
||||
|
|
||||
|
||||
S113.py:18:1: S113 Probable use of requests call without timeout
|
||||
|
|
||||
16 | requests.patch('https://gmail.com', timeout=None)
|
||||
17 | requests.patch('https://gmail.com', timeout=5)
|
||||
18 | requests.options('https://gmail.com')
|
||||
| ^^^^^^^^^^^^^^^^ S113
|
||||
19 | requests.options('https://gmail.com', timeout=None)
|
||||
20 | requests.options('https://gmail.com', timeout=5)
|
||||
|
|
||||
|
||||
S113.py:19:39: S113 Probable use of requests call with timeout set to `None`
|
||||
|
|
||||
17 | requests.patch('https://gmail.com', timeout=5)
|
||||
18 | requests.options('https://gmail.com')
|
||||
19 | requests.options('https://gmail.com', timeout=None)
|
||||
| ^^^^^^^^^^^^ S113
|
||||
20 | requests.options('https://gmail.com', timeout=5)
|
||||
21 | requests.head('https://gmail.com')
|
||||
|
|
||||
|
||||
S113.py:21:1: S113 Probable use of requests call without timeout
|
||||
|
|
||||
19 | requests.options('https://gmail.com', timeout=None)
|
||||
20 | requests.options('https://gmail.com', timeout=5)
|
||||
21 | requests.head('https://gmail.com')
|
||||
| ^^^^^^^^^^^^^ S113
|
||||
22 | requests.head('https://gmail.com', timeout=None)
|
||||
23 | requests.head('https://gmail.com', timeout=5)
|
||||
|
|
||||
|
||||
S113.py:22:36: S113 Probable use of requests call with timeout set to `None`
|
||||
|
|
||||
20 | requests.options('https://gmail.com', timeout=5)
|
||||
21 | requests.head('https://gmail.com')
|
||||
22 | requests.head('https://gmail.com', timeout=None)
|
||||
| ^^^^^^^^^^^^ S113
|
||||
23 | requests.head('https://gmail.com', timeout=5)
|
||||
|
|
||||
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/flake8_bandit/mod.rs
|
||||
---
|
||||
S201.py:10:9: S201 Use of `debug=True` in Flask app detected
|
||||
|
|
||||
9 | # OK
|
||||
10 | app.run(debug=True)
|
||||
| ^^^^^^^^^^ S201
|
||||
11 |
|
||||
12 | # Errors
|
||||
|
|
||||
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/flake8_bandit/mod.rs
|
||||
---
|
||||
S301.py:3:1: S301 `pickle` and modules that wrap it can be unsafe when used to deserialize untrusted data, possible security issue
|
||||
|
|
||||
1 | import pickle
|
||||
2 |
|
||||
3 | pickle.loads()
|
||||
| ^^^^^^^^^^^^^^ S301
|
||||
|
|
||||
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/flake8_bandit/mod.rs
|
||||
---
|
||||
S307.py:3:7: S307 Use of possibly insecure function; consider using `ast.literal_eval`
|
||||
|
|
||||
1 | import os
|
||||
2 |
|
||||
3 | print(eval("1+1")) # S307
|
||||
| ^^^^^^^^^^^ S307
|
||||
4 | print(eval("os.getcwd()")) # S307
|
||||
|
|
||||
|
||||
S307.py:4:7: S307 Use of possibly insecure function; consider using `ast.literal_eval`
|
||||
|
|
||||
3 | print(eval("1+1")) # S307
|
||||
4 | print(eval("os.getcwd()")) # S307
|
||||
| ^^^^^^^^^^^^^^^^^^^ S307
|
||||
|
|
||||
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/flake8_bandit/mod.rs
|
||||
---
|
||||
S312.py:3:1: S312 Telnet-related functions are being called. Telnet is considered insecure. Use SSH or some other encrypted protocol.
|
||||
|
|
||||
1 | from telnetlib import Telnet
|
||||
2 |
|
||||
3 | Telnet("localhost", 23)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ S312
|
||||
|
|
||||
|
||||
|
|
@ -1,133 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/flake8_bandit/mod.rs
|
||||
---
|
||||
S324.py:7:13: S324 Probable use of insecure hash functions in `hashlib`: `md5`
|
||||
|
|
||||
5 | # Invalid
|
||||
6 |
|
||||
7 | hashlib.new('md5')
|
||||
| ^^^^^ S324
|
||||
8 |
|
||||
9 | hashlib.new('md4', b'test')
|
||||
|
|
||||
|
||||
S324.py:9:13: S324 Probable use of insecure hash functions in `hashlib`: `md4`
|
||||
|
|
||||
7 | hashlib.new('md5')
|
||||
8 |
|
||||
9 | hashlib.new('md4', b'test')
|
||||
| ^^^^^ S324
|
||||
10 |
|
||||
11 | hashlib.new(name='md5', data=b'test')
|
||||
|
|
||||
|
||||
S324.py:11:18: S324 Probable use of insecure hash functions in `hashlib`: `md5`
|
||||
|
|
||||
9 | hashlib.new('md4', b'test')
|
||||
10 |
|
||||
11 | hashlib.new(name='md5', data=b'test')
|
||||
| ^^^^^ S324
|
||||
12 |
|
||||
13 | hashlib.new('MD4', data=b'test')
|
||||
|
|
||||
|
||||
S324.py:13:13: S324 Probable use of insecure hash functions in `hashlib`: `MD4`
|
||||
|
|
||||
11 | hashlib.new(name='md5', data=b'test')
|
||||
12 |
|
||||
13 | hashlib.new('MD4', data=b'test')
|
||||
| ^^^^^ S324
|
||||
14 |
|
||||
15 | hashlib.new('sha1')
|
||||
|
|
||||
|
||||
S324.py:15:13: S324 Probable use of insecure hash functions in `hashlib`: `sha1`
|
||||
|
|
||||
13 | hashlib.new('MD4', data=b'test')
|
||||
14 |
|
||||
15 | hashlib.new('sha1')
|
||||
| ^^^^^^ S324
|
||||
16 |
|
||||
17 | hashlib.new('sha1', data=b'test')
|
||||
|
|
||||
|
||||
S324.py:17:13: S324 Probable use of insecure hash functions in `hashlib`: `sha1`
|
||||
|
|
||||
15 | hashlib.new('sha1')
|
||||
16 |
|
||||
17 | hashlib.new('sha1', data=b'test')
|
||||
| ^^^^^^ S324
|
||||
18 |
|
||||
19 | hashlib.new('sha', data=b'test')
|
||||
|
|
||||
|
||||
S324.py:19:13: S324 Probable use of insecure hash functions in `hashlib`: `sha`
|
||||
|
|
||||
17 | hashlib.new('sha1', data=b'test')
|
||||
18 |
|
||||
19 | hashlib.new('sha', data=b'test')
|
||||
| ^^^^^ S324
|
||||
20 |
|
||||
21 | hashlib.new(name='SHA', data=b'test')
|
||||
|
|
||||
|
||||
S324.py:21:18: S324 Probable use of insecure hash functions in `hashlib`: `SHA`
|
||||
|
|
||||
19 | hashlib.new('sha', data=b'test')
|
||||
20 |
|
||||
21 | hashlib.new(name='SHA', data=b'test')
|
||||
| ^^^^^ S324
|
||||
22 |
|
||||
23 | hashlib.sha(data=b'test')
|
||||
|
|
||||
|
||||
S324.py:23:1: S324 Probable use of insecure hash functions in `hashlib`: `sha`
|
||||
|
|
||||
21 | hashlib.new(name='SHA', data=b'test')
|
||||
22 |
|
||||
23 | hashlib.sha(data=b'test')
|
||||
| ^^^^^^^^^^^ S324
|
||||
24 |
|
||||
25 | hashlib.md5()
|
||||
|
|
||||
|
||||
S324.py:25:1: S324 Probable use of insecure hash functions in `hashlib`: `md5`
|
||||
|
|
||||
23 | hashlib.sha(data=b'test')
|
||||
24 |
|
||||
25 | hashlib.md5()
|
||||
| ^^^^^^^^^^^ S324
|
||||
26 |
|
||||
27 | hashlib_new('sha1')
|
||||
|
|
||||
|
||||
S324.py:27:13: S324 Probable use of insecure hash functions in `hashlib`: `sha1`
|
||||
|
|
||||
25 | hashlib.md5()
|
||||
26 |
|
||||
27 | hashlib_new('sha1')
|
||||
| ^^^^^^ S324
|
||||
28 |
|
||||
29 | hashlib_sha1('sha1')
|
||||
|
|
||||
|
||||
S324.py:29:1: S324 Probable use of insecure hash functions in `hashlib`: `sha1`
|
||||
|
|
||||
27 | hashlib_new('sha1')
|
||||
28 |
|
||||
29 | hashlib_sha1('sha1')
|
||||
| ^^^^^^^^^^^^ S324
|
||||
30 |
|
||||
31 | # usedforsecurity arg only available in Python 3.9+
|
||||
|
|
||||
|
||||
S324.py:32:13: S324 Probable use of insecure hash functions in `hashlib`: `sha1`
|
||||
|
|
||||
31 | # usedforsecurity arg only available in Python 3.9+
|
||||
32 | hashlib.new('sha1', usedforsecurity=True)
|
||||
| ^^^^^^ S324
|
||||
33 |
|
||||
34 | # Valid
|
||||
|
|
||||
|
||||
|
|
@ -1,180 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/flake8_bandit/mod.rs
|
||||
---
|
||||
S501.py:5:47: S501 Probable use of `requests` call with `verify=False` disabling SSL certificate checks
|
||||
|
|
||||
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)
|
||||
|
|
||||
|
||||
S501.py:7:48: S501 Probable use of `requests` call with `verify=False` disabling SSL certificate checks
|
||||
|
|
||||
5 | requests.get('https://gmail.com', timeout=30, verify=False)
|
||||
6 | requests.post('https://gmail.com', timeout=30, verify=True)
|
||||
7 | requests.post('https://gmail.com', timeout=30, verify=False)
|
||||
| ^^^^^^^^^^^^ S501
|
||||
8 | requests.put('https://gmail.com', timeout=30, verify=True)
|
||||
9 | requests.put('https://gmail.com', timeout=30, verify=False)
|
||||
|
|
||||
|
||||
S501.py:9:47: S501 Probable use of `requests` call with `verify=False` disabling SSL certificate checks
|
||||
|
|
||||
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)
|
||||
|
|
||||
|
||||
S501.py:11:50: S501 Probable use of `requests` call with `verify=False` disabling SSL certificate checks
|
||||
|
|
||||
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)
|
||||
|
|
||||
|
||||
S501.py:13:49: S501 Probable use of `requests` call with `verify=False` disabling SSL certificate checks
|
||||
|
|
||||
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)
|
||||
|
|
||||
|
||||
S501.py:15:51: S501 Probable use of `requests` call with `verify=False` disabling SSL certificate checks
|
||||
|
|
||||
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)
|
||||
|
|
||||
|
||||
S501.py:17:48: S501 Probable use of `requests` call with `verify=False` disabling SSL certificate checks
|
||||
|
|
||||
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)
|
||||
|
|
||||
|
||||
S501.py:20:43: S501 Probable use of `httpx` call with `verify=False` disabling SSL certificate checks
|
||||
|
|
||||
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)
|
||||
|
|
||||
|
||||
S501.py:22:32: S501 Probable use of `httpx` call with `verify=False` disabling SSL certificate checks
|
||||
|
|
||||
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)
|
||||
|
|
||||
|
||||
S501.py:24:36: S501 Probable use of `httpx` call with `verify=False` disabling SSL certificate checks
|
||||
|
|
||||
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)
|
||||
|
|
||||
|
||||
S501.py:26:33: S501 Probable use of `httpx` call with `verify=False` disabling SSL certificate checks
|
||||
|
|
||||
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)
|
||||
|
|
||||
|
||||
S501.py:28:33: S501 Probable use of `httpx` call with `verify=False` disabling SSL certificate checks
|
||||
|
|
||||
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)
|
||||
|
|
||||
|
||||
S501.py:30:32: S501 Probable use of `httpx` call with `verify=False` disabling SSL certificate checks
|
||||
|
|
||||
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)
|
||||
|
|
||||
|
||||
S501.py:32:34: S501 Probable use of `httpx` call with `verify=False` disabling SSL certificate checks
|
||||
|
|
||||
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)
|
||||
|
|
||||
|
||||
S501.py:34:35: S501 Probable use of `httpx` call with `verify=False` disabling SSL certificate checks
|
||||
|
|
||||
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)
|
||||
|
|
||||
|
||||
S501.py:36:35: S501 Probable use of `httpx` call with `verify=False` disabling SSL certificate checks
|
||||
|
|
||||
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)
|
||||
|
|
||||
|
||||
S501.py:38:14: S501 Probable use of `httpx` call with `verify=False` disabling SSL certificate checks
|
||||
|
|
||||
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)
|
||||
|
|
||||
|
||||
S501.py:40:19: S501 Probable use of `httpx` call with `verify=False` disabling SSL certificate checks
|
||||
|
|
||||
38 | httpx.Client(verify=False)
|
||||
39 | httpx.AsyncClient()
|
||||
40 | httpx.AsyncClient(verify=False)
|
||||
| ^^^^^^^^^^^^ S501
|
||||
|
|
||||
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/flake8_bandit/mod.rs
|
||||
---
|
||||
S506.py:10:9: S506 Probable use of unsafe `yaml.load`. Allows instantiation of arbitrary objects. Consider `yaml.safe_load`.
|
||||
|
|
||||
8 | def test_yaml_load():
|
||||
9 | ystr = yaml.dump({"a": 1, "b": 2, "c": 3})
|
||||
10 | y = yaml.load(ystr)
|
||||
| ^^^^^^^^^ S506
|
||||
11 | yaml.dump(y)
|
||||
12 | try:
|
||||
|
|
||||
|
||||
S506.py:24:24: S506 Probable use of unsafe loader `Loader` with `yaml.load`. Allows instantiation of arbitrary objects. Consider `yaml.safe_load`.
|
||||
|
|
||||
24 | yaml.load("{}", Loader=yaml.Loader)
|
||||
| ^^^^^^^^^^^ S506
|
||||
25 |
|
||||
26 | # no issue should be found
|
||||
|
|
||||
|
||||
|
|
@ -1,62 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/flake8_bandit/mod.rs
|
||||
---
|
||||
S507.py:13:40: S507 Paramiko call with policy set to automatically trust the unknown host key
|
||||
|
|
||||
12 | # Errors
|
||||
13 | ssh_client.set_missing_host_key_policy(client.AutoAddPolicy)
|
||||
| ^^^^^^^^^^^^^^^^^^^^ S507
|
||||
14 | ssh_client.set_missing_host_key_policy(client.WarningPolicy)
|
||||
15 | ssh_client.set_missing_host_key_policy(AutoAddPolicy)
|
||||
|
|
||||
|
||||
S507.py:14:40: S507 Paramiko call with policy set to automatically trust the unknown host key
|
||||
|
|
||||
12 | # Errors
|
||||
13 | ssh_client.set_missing_host_key_policy(client.AutoAddPolicy)
|
||||
14 | ssh_client.set_missing_host_key_policy(client.WarningPolicy)
|
||||
| ^^^^^^^^^^^^^^^^^^^^ S507
|
||||
15 | ssh_client.set_missing_host_key_policy(AutoAddPolicy)
|
||||
16 | ssh_client.set_missing_host_key_policy(policy=client.AutoAddPolicy)
|
||||
|
|
||||
|
||||
S507.py:15:40: S507 Paramiko call with policy set to automatically trust the unknown host key
|
||||
|
|
||||
13 | ssh_client.set_missing_host_key_policy(client.AutoAddPolicy)
|
||||
14 | ssh_client.set_missing_host_key_policy(client.WarningPolicy)
|
||||
15 | ssh_client.set_missing_host_key_policy(AutoAddPolicy)
|
||||
| ^^^^^^^^^^^^^ S507
|
||||
16 | ssh_client.set_missing_host_key_policy(policy=client.AutoAddPolicy)
|
||||
17 | ssh_client.set_missing_host_key_policy(policy=client.WarningPolicy)
|
||||
|
|
||||
|
||||
S507.py:16:47: S507 Paramiko call with policy set to automatically trust the unknown host key
|
||||
|
|
||||
14 | ssh_client.set_missing_host_key_policy(client.WarningPolicy)
|
||||
15 | ssh_client.set_missing_host_key_policy(AutoAddPolicy)
|
||||
16 | ssh_client.set_missing_host_key_policy(policy=client.AutoAddPolicy)
|
||||
| ^^^^^^^^^^^^^^^^^^^^ S507
|
||||
17 | ssh_client.set_missing_host_key_policy(policy=client.WarningPolicy)
|
||||
18 | ssh_client.set_missing_host_key_policy(policy=WarningPolicy)
|
||||
|
|
||||
|
||||
S507.py:17:47: S507 Paramiko call with policy set to automatically trust the unknown host key
|
||||
|
|
||||
15 | ssh_client.set_missing_host_key_policy(AutoAddPolicy)
|
||||
16 | ssh_client.set_missing_host_key_policy(policy=client.AutoAddPolicy)
|
||||
17 | ssh_client.set_missing_host_key_policy(policy=client.WarningPolicy)
|
||||
| ^^^^^^^^^^^^^^^^^^^^ S507
|
||||
18 | ssh_client.set_missing_host_key_policy(policy=WarningPolicy)
|
||||
|
|
||||
|
||||
S507.py:18:47: S507 Paramiko call with policy set to automatically trust the unknown host key
|
||||
|
|
||||
16 | ssh_client.set_missing_host_key_policy(policy=client.AutoAddPolicy)
|
||||
17 | ssh_client.set_missing_host_key_policy(policy=client.WarningPolicy)
|
||||
18 | ssh_client.set_missing_host_key_policy(policy=WarningPolicy)
|
||||
| ^^^^^^^^^^^^^ S507
|
||||
19 |
|
||||
20 | # Unrelated
|
||||
|
|
||||
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/flake8_bandit/mod.rs
|
||||
---
|
||||
S508.py:3:25: S508 The use of SNMPv1 and SNMPv2 is insecure. Use SNMPv3 if able.
|
||||
|
|
||||
1 | from pysnmp.hlapi import CommunityData
|
||||
2 |
|
||||
3 | CommunityData("public", mpModel=0) # S508
|
||||
| ^^^^^^^^^ S508
|
||||
4 | CommunityData("public", mpModel=1) # S508
|
||||
|
|
||||
|
||||
S508.py:4:25: S508 The use of SNMPv1 and SNMPv2 is insecure. Use SNMPv3 if able.
|
||||
|
|
||||
3 | CommunityData("public", mpModel=0) # S508
|
||||
4 | CommunityData("public", mpModel=1) # S508
|
||||
| ^^^^^^^^^ S508
|
||||
5 |
|
||||
6 | CommunityData("public", mpModel=2) # OK
|
||||
|
|
||||
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/flake8_bandit/mod.rs
|
||||
---
|
||||
S509.py:4:12: S509 You should not use SNMPv3 without encryption. `noAuthNoPriv` & `authNoPriv` is insecure.
|
||||
|
|
||||
4 | insecure = UsmUserData("securityName") # S509
|
||||
| ^^^^^^^^^^^ S509
|
||||
5 | auth_no_priv = UsmUserData("securityName", "authName") # S509
|
||||
|
|
||||
|
||||
S509.py:5:16: S509 You should not use SNMPv3 without encryption. `noAuthNoPriv` & `authNoPriv` is insecure.
|
||||
|
|
||||
4 | insecure = UsmUserData("securityName") # S509
|
||||
5 | auth_no_priv = UsmUserData("securityName", "authName") # S509
|
||||
| ^^^^^^^^^^^ S509
|
||||
6 |
|
||||
7 | less_insecure = UsmUserData("securityName", "authName", "privName") # OK
|
||||
|
|
||||
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/flake8_bandit/mod.rs
|
||||
---
|
||||
S601.py:3:1: S601 Possible shell injection via Paramiko call; check inputs are properly sanitized
|
||||
|
|
||||
1 | import paramiko
|
||||
2 |
|
||||
3 | paramiko.exec_command('something; really; unsafe')
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ S601
|
||||
|
|
||||
|
||||
|
|
@ -1,117 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/flake8_bandit/mod.rs
|
||||
---
|
||||
S602.py:4:15: S602 `subprocess` call with `shell=True` seems safe, but may be changed in the future; consider rewriting without `shell`
|
||||
|
|
||||
3 | # Check different Popen wrappers are checked.
|
||||
4 | Popen("true", shell=True)
|
||||
| ^^^^^^^^^^ S602
|
||||
5 | call("true", shell=True)
|
||||
6 | check_call("true", shell=True)
|
||||
|
|
||||
|
||||
S602.py:5:14: S602 `subprocess` call with `shell=True` seems safe, but may be changed in the future; consider rewriting without `shell`
|
||||
|
|
||||
3 | # Check different Popen wrappers are checked.
|
||||
4 | Popen("true", shell=True)
|
||||
5 | call("true", shell=True)
|
||||
| ^^^^^^^^^^ S602
|
||||
6 | check_call("true", shell=True)
|
||||
7 | check_output("true", shell=True)
|
||||
|
|
||||
|
||||
S602.py:6:20: S602 `subprocess` call with `shell=True` seems safe, but may be changed in the future; consider rewriting without `shell`
|
||||
|
|
||||
4 | Popen("true", shell=True)
|
||||
5 | call("true", shell=True)
|
||||
6 | check_call("true", shell=True)
|
||||
| ^^^^^^^^^^ S602
|
||||
7 | check_output("true", shell=True)
|
||||
8 | run("true", shell=True)
|
||||
|
|
||||
|
||||
S602.py:7:22: S602 `subprocess` call with `shell=True` seems safe, but may be changed in the future; consider rewriting without `shell`
|
||||
|
|
||||
5 | call("true", shell=True)
|
||||
6 | check_call("true", shell=True)
|
||||
7 | check_output("true", shell=True)
|
||||
| ^^^^^^^^^^ S602
|
||||
8 | run("true", shell=True)
|
||||
|
|
||||
|
||||
S602.py:8:13: S602 `subprocess` call with `shell=True` seems safe, but may be changed in the future; consider rewriting without `shell`
|
||||
|
|
||||
6 | check_call("true", shell=True)
|
||||
7 | check_output("true", shell=True)
|
||||
8 | run("true", shell=True)
|
||||
| ^^^^^^^^^^ S602
|
||||
9 |
|
||||
10 | # Check values that truthy values are treated as true.
|
||||
|
|
||||
|
||||
S602.py:11:15: S602 `subprocess` call with `shell=True` seems safe, but may be changed in the future; consider rewriting without `shell`
|
||||
|
|
||||
10 | # Check values that truthy values are treated as true.
|
||||
11 | Popen("true", shell=1)
|
||||
| ^^^^^^^ S602
|
||||
12 | Popen("true", shell=[1])
|
||||
13 | Popen("true", shell={1: 1})
|
||||
|
|
||||
|
||||
S602.py:12:15: S602 `subprocess` call with `shell=True` seems safe, but may be changed in the future; consider rewriting without `shell`
|
||||
|
|
||||
10 | # Check values that truthy values are treated as true.
|
||||
11 | Popen("true", shell=1)
|
||||
12 | Popen("true", shell=[1])
|
||||
| ^^^^^^^^^ S602
|
||||
13 | Popen("true", shell={1: 1})
|
||||
14 | Popen("true", shell=(1,))
|
||||
|
|
||||
|
||||
S602.py:13:15: S602 `subprocess` call with `shell=True` seems safe, but may be changed in the future; consider rewriting without `shell`
|
||||
|
|
||||
11 | Popen("true", shell=1)
|
||||
12 | Popen("true", shell=[1])
|
||||
13 | Popen("true", shell={1: 1})
|
||||
| ^^^^^^^^^^^^ S602
|
||||
14 | Popen("true", shell=(1,))
|
||||
|
|
||||
|
||||
S602.py:14:15: S602 `subprocess` call with `shell=True` seems safe, but may be changed in the future; consider rewriting without `shell`
|
||||
|
|
||||
12 | Popen("true", shell=[1])
|
||||
13 | Popen("true", shell={1: 1})
|
||||
14 | Popen("true", shell=(1,))
|
||||
| ^^^^^^^^^^ S602
|
||||
15 |
|
||||
16 | # Check command argument looks unsafe.
|
||||
|
|
||||
|
||||
S602.py:18:19: S602 `subprocess` call with `shell=True` identified, security issue
|
||||
|
|
||||
16 | # Check command argument looks unsafe.
|
||||
17 | var_string = "true"
|
||||
18 | Popen(var_string, shell=True)
|
||||
| ^^^^^^^^^^ S602
|
||||
19 | Popen([var_string], shell=True)
|
||||
20 | Popen([var_string, ""], shell=True)
|
||||
|
|
||||
|
||||
S602.py:19:21: S602 `subprocess` call with `shell=True` identified, security issue
|
||||
|
|
||||
17 | var_string = "true"
|
||||
18 | Popen(var_string, shell=True)
|
||||
19 | Popen([var_string], shell=True)
|
||||
| ^^^^^^^^^^ S602
|
||||
20 | Popen([var_string, ""], shell=True)
|
||||
|
|
||||
|
||||
S602.py:20:25: S602 `subprocess` call with `shell=True` identified, security issue
|
||||
|
|
||||
18 | Popen(var_string, shell=True)
|
||||
19 | Popen([var_string], shell=True)
|
||||
20 | Popen([var_string, ""], shell=True)
|
||||
| ^^^^^^^^^^ S602
|
||||
|
|
||||
|
||||
|
|
@ -1,106 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/flake8_bandit/mod.rs
|
||||
---
|
||||
S603.py:4:15: S603 `subprocess` call: check for execution of untrusted input
|
||||
|
|
||||
3 | # Different Popen wrappers are checked.
|
||||
4 | Popen("true", shell=False)
|
||||
| ^^^^^^^^^^^ S603
|
||||
5 | call("true", shell=False)
|
||||
6 | check_call("true", shell=False)
|
||||
|
|
||||
|
||||
S603.py:5:14: S603 `subprocess` call: check for execution of untrusted input
|
||||
|
|
||||
3 | # Different Popen wrappers are checked.
|
||||
4 | Popen("true", shell=False)
|
||||
5 | call("true", shell=False)
|
||||
| ^^^^^^^^^^^ S603
|
||||
6 | check_call("true", shell=False)
|
||||
7 | check_output("true", shell=False)
|
||||
|
|
||||
|
||||
S603.py:6:20: S603 `subprocess` call: check for execution of untrusted input
|
||||
|
|
||||
4 | Popen("true", shell=False)
|
||||
5 | call("true", shell=False)
|
||||
6 | check_call("true", shell=False)
|
||||
| ^^^^^^^^^^^ S603
|
||||
7 | check_output("true", shell=False)
|
||||
8 | run("true", shell=False)
|
||||
|
|
||||
|
||||
S603.py:7:22: S603 `subprocess` call: check for execution of untrusted input
|
||||
|
|
||||
5 | call("true", shell=False)
|
||||
6 | check_call("true", shell=False)
|
||||
7 | check_output("true", shell=False)
|
||||
| ^^^^^^^^^^^ S603
|
||||
8 | run("true", shell=False)
|
||||
|
|
||||
|
||||
S603.py:8:13: S603 `subprocess` call: check for execution of untrusted input
|
||||
|
|
||||
6 | check_call("true", shell=False)
|
||||
7 | check_output("true", shell=False)
|
||||
8 | run("true", shell=False)
|
||||
| ^^^^^^^^^^^ S603
|
||||
9 |
|
||||
10 | # Values that falsey values are treated as false.
|
||||
|
|
||||
|
||||
S603.py:11:15: S603 `subprocess` call: check for execution of untrusted input
|
||||
|
|
||||
10 | # Values that falsey values are treated as false.
|
||||
11 | Popen("true", shell=0)
|
||||
| ^^^^^^^ S603
|
||||
12 | Popen("true", shell=[])
|
||||
13 | Popen("true", shell={})
|
||||
|
|
||||
|
||||
S603.py:12:15: S603 `subprocess` call: check for execution of untrusted input
|
||||
|
|
||||
10 | # Values that falsey values are treated as false.
|
||||
11 | Popen("true", shell=0)
|
||||
12 | Popen("true", shell=[])
|
||||
| ^^^^^^^^ S603
|
||||
13 | Popen("true", shell={})
|
||||
14 | Popen("true", shell=None)
|
||||
|
|
||||
|
||||
S603.py:13:15: S603 `subprocess` call: check for execution of untrusted input
|
||||
|
|
||||
11 | Popen("true", shell=0)
|
||||
12 | Popen("true", shell=[])
|
||||
13 | Popen("true", shell={})
|
||||
| ^^^^^^^^ S603
|
||||
14 | Popen("true", shell=None)
|
||||
|
|
||||
|
||||
S603.py:14:15: S603 `subprocess` call: check for execution of untrusted input
|
||||
|
|
||||
12 | Popen("true", shell=[])
|
||||
13 | Popen("true", shell={})
|
||||
14 | Popen("true", shell=None)
|
||||
| ^^^^^^^^^^ S603
|
||||
15 |
|
||||
16 | # Unknown values are treated as falsey.
|
||||
|
|
||||
|
||||
S603.py:17:15: S603 `subprocess` call: check for execution of untrusted input
|
||||
|
|
||||
16 | # Unknown values are treated as falsey.
|
||||
17 | Popen("true", shell=True if True else False)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S603
|
||||
18 |
|
||||
19 | # No value is also caught.
|
||||
|
|
||||
|
||||
S603.py:20:7: S603 `subprocess` call: check for execution of untrusted input
|
||||
|
|
||||
19 | # No value is also caught.
|
||||
20 | Popen("true")
|
||||
| ^^^^^^ S603
|
||||
|
|
||||
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/flake8_bandit/mod.rs
|
||||
---
|
||||
S604.py:5:5: S604 Function call with `shell=True` parameter identified, security issue
|
||||
|
|
||||
5 | foo(shell=True)
|
||||
| ^^^^^^^^^^ S604
|
||||
|
|
||||
|
||||
|
|
@ -1,147 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/flake8_bandit/mod.rs
|
||||
---
|
||||
S605.py:7:11: S605 Starting a process with a shell: seems safe, but may be changed in the future; consider rewriting without `shell`
|
||||
|
|
||||
6 | # Check all shell functions.
|
||||
7 | os.system("true")
|
||||
| ^^^^^^ S605
|
||||
8 | os.popen("true")
|
||||
9 | os.popen2("true")
|
||||
|
|
||||
|
||||
S605.py:8:10: S605 Starting a process with a shell: seems safe, but may be changed in the future; consider rewriting without `shell`
|
||||
|
|
||||
6 | # Check all shell functions.
|
||||
7 | os.system("true")
|
||||
8 | os.popen("true")
|
||||
| ^^^^^^ S605
|
||||
9 | os.popen2("true")
|
||||
10 | os.popen3("true")
|
||||
|
|
||||
|
||||
S605.py:9:11: S605 Starting a process with a shell: seems safe, but may be changed in the future; consider rewriting without `shell`
|
||||
|
|
||||
7 | os.system("true")
|
||||
8 | os.popen("true")
|
||||
9 | os.popen2("true")
|
||||
| ^^^^^^ S605
|
||||
10 | os.popen3("true")
|
||||
11 | os.popen4("true")
|
||||
|
|
||||
|
||||
S605.py:10:11: S605 Starting a process with a shell: seems safe, but may be changed in the future; consider rewriting without `shell`
|
||||
|
|
||||
8 | os.popen("true")
|
||||
9 | os.popen2("true")
|
||||
10 | os.popen3("true")
|
||||
| ^^^^^^ S605
|
||||
11 | os.popen4("true")
|
||||
12 | popen2.popen2("true")
|
||||
|
|
||||
|
||||
S605.py:11:11: S605 Starting a process with a shell: seems safe, but may be changed in the future; consider rewriting without `shell`
|
||||
|
|
||||
9 | os.popen2("true")
|
||||
10 | os.popen3("true")
|
||||
11 | os.popen4("true")
|
||||
| ^^^^^^ S605
|
||||
12 | popen2.popen2("true")
|
||||
13 | popen2.popen3("true")
|
||||
|
|
||||
|
||||
S605.py:12:15: S605 Starting a process with a shell: seems safe, but may be changed in the future; consider rewriting without `shell`
|
||||
|
|
||||
10 | os.popen3("true")
|
||||
11 | os.popen4("true")
|
||||
12 | popen2.popen2("true")
|
||||
| ^^^^^^ S605
|
||||
13 | popen2.popen3("true")
|
||||
14 | popen2.popen4("true")
|
||||
|
|
||||
|
||||
S605.py:13:15: S605 Starting a process with a shell: seems safe, but may be changed in the future; consider rewriting without `shell`
|
||||
|
|
||||
11 | os.popen4("true")
|
||||
12 | popen2.popen2("true")
|
||||
13 | popen2.popen3("true")
|
||||
| ^^^^^^ S605
|
||||
14 | popen2.popen4("true")
|
||||
15 | popen2.Popen3("true")
|
||||
|
|
||||
|
||||
S605.py:14:15: S605 Starting a process with a shell: seems safe, but may be changed in the future; consider rewriting without `shell`
|
||||
|
|
||||
12 | popen2.popen2("true")
|
||||
13 | popen2.popen3("true")
|
||||
14 | popen2.popen4("true")
|
||||
| ^^^^^^ S605
|
||||
15 | popen2.Popen3("true")
|
||||
16 | popen2.Popen4("true")
|
||||
|
|
||||
|
||||
S605.py:15:15: S605 Starting a process with a shell: seems safe, but may be changed in the future; consider rewriting without `shell`
|
||||
|
|
||||
13 | popen2.popen3("true")
|
||||
14 | popen2.popen4("true")
|
||||
15 | popen2.Popen3("true")
|
||||
| ^^^^^^ S605
|
||||
16 | popen2.Popen4("true")
|
||||
17 | commands.getoutput("true")
|
||||
|
|
||||
|
||||
S605.py:16:15: S605 Starting a process with a shell: seems safe, but may be changed in the future; consider rewriting without `shell`
|
||||
|
|
||||
14 | popen2.popen4("true")
|
||||
15 | popen2.Popen3("true")
|
||||
16 | popen2.Popen4("true")
|
||||
| ^^^^^^ S605
|
||||
17 | commands.getoutput("true")
|
||||
18 | commands.getstatusoutput("true")
|
||||
|
|
||||
|
||||
S605.py:17:20: S605 Starting a process with a shell: seems safe, but may be changed in the future; consider rewriting without `shell`
|
||||
|
|
||||
15 | popen2.Popen3("true")
|
||||
16 | popen2.Popen4("true")
|
||||
17 | commands.getoutput("true")
|
||||
| ^^^^^^ S605
|
||||
18 | commands.getstatusoutput("true")
|
||||
|
|
||||
|
||||
S605.py:18:26: S605 Starting a process with a shell: seems safe, but may be changed in the future; consider rewriting without `shell`
|
||||
|
|
||||
16 | popen2.Popen4("true")
|
||||
17 | commands.getoutput("true")
|
||||
18 | commands.getstatusoutput("true")
|
||||
| ^^^^^^ S605
|
||||
|
|
||||
|
||||
S605.py:23:11: S605 Starting a process with a shell, possible injection detected
|
||||
|
|
||||
21 | # Check command argument looks unsafe.
|
||||
22 | var_string = "true"
|
||||
23 | os.system(var_string)
|
||||
| ^^^^^^^^^^ S605
|
||||
24 | os.system([var_string])
|
||||
25 | os.system([var_string, ""])
|
||||
|
|
||||
|
||||
S605.py:24:11: S605 Starting a process with a shell, possible injection detected
|
||||
|
|
||||
22 | var_string = "true"
|
||||
23 | os.system(var_string)
|
||||
24 | os.system([var_string])
|
||||
| ^^^^^^^^^^^^ S605
|
||||
25 | os.system([var_string, ""])
|
||||
|
|
||||
|
||||
S605.py:25:11: S605 Starting a process with a shell, possible injection detected
|
||||
|
|
||||
23 | os.system(var_string)
|
||||
24 | os.system([var_string])
|
||||
25 | os.system([var_string, ""])
|
||||
| ^^^^^^^^^^^^^^^^ S605
|
||||
|
|
||||
|
||||
|
|
@ -1,170 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/flake8_bandit/mod.rs
|
||||
---
|
||||
S606.py:4:1: S606 Starting a process without a shell
|
||||
|
|
||||
3 | # Check all shell functions.
|
||||
4 | os.execl("true")
|
||||
| ^^^^^^^^ S606
|
||||
5 | os.execle("true")
|
||||
6 | os.execlp("true")
|
||||
|
|
||||
|
||||
S606.py:5:1: S606 Starting a process without a shell
|
||||
|
|
||||
3 | # Check all shell functions.
|
||||
4 | os.execl("true")
|
||||
5 | os.execle("true")
|
||||
| ^^^^^^^^^ S606
|
||||
6 | os.execlp("true")
|
||||
7 | os.execlpe("true")
|
||||
|
|
||||
|
||||
S606.py:6:1: S606 Starting a process without a shell
|
||||
|
|
||||
4 | os.execl("true")
|
||||
5 | os.execle("true")
|
||||
6 | os.execlp("true")
|
||||
| ^^^^^^^^^ S606
|
||||
7 | os.execlpe("true")
|
||||
8 | os.execv("true")
|
||||
|
|
||||
|
||||
S606.py:7:1: S606 Starting a process without a shell
|
||||
|
|
||||
5 | os.execle("true")
|
||||
6 | os.execlp("true")
|
||||
7 | os.execlpe("true")
|
||||
| ^^^^^^^^^^ S606
|
||||
8 | os.execv("true")
|
||||
9 | os.execve("true")
|
||||
|
|
||||
|
||||
S606.py:8:1: S606 Starting a process without a shell
|
||||
|
|
||||
6 | os.execlp("true")
|
||||
7 | os.execlpe("true")
|
||||
8 | os.execv("true")
|
||||
| ^^^^^^^^ S606
|
||||
9 | os.execve("true")
|
||||
10 | os.execvp("true")
|
||||
|
|
||||
|
||||
S606.py:9:1: S606 Starting a process without a shell
|
||||
|
|
||||
7 | os.execlpe("true")
|
||||
8 | os.execv("true")
|
||||
9 | os.execve("true")
|
||||
| ^^^^^^^^^ S606
|
||||
10 | os.execvp("true")
|
||||
11 | os.execvpe("true")
|
||||
|
|
||||
|
||||
S606.py:10:1: S606 Starting a process without a shell
|
||||
|
|
||||
8 | os.execv("true")
|
||||
9 | os.execve("true")
|
||||
10 | os.execvp("true")
|
||||
| ^^^^^^^^^ S606
|
||||
11 | os.execvpe("true")
|
||||
12 | os.spawnl("true")
|
||||
|
|
||||
|
||||
S606.py:11:1: S606 Starting a process without a shell
|
||||
|
|
||||
9 | os.execve("true")
|
||||
10 | os.execvp("true")
|
||||
11 | os.execvpe("true")
|
||||
| ^^^^^^^^^^ S606
|
||||
12 | os.spawnl("true")
|
||||
13 | os.spawnle("true")
|
||||
|
|
||||
|
||||
S606.py:12:1: S606 Starting a process without a shell
|
||||
|
|
||||
10 | os.execvp("true")
|
||||
11 | os.execvpe("true")
|
||||
12 | os.spawnl("true")
|
||||
| ^^^^^^^^^ S606
|
||||
13 | os.spawnle("true")
|
||||
14 | os.spawnlp("true")
|
||||
|
|
||||
|
||||
S606.py:13:1: S606 Starting a process without a shell
|
||||
|
|
||||
11 | os.execvpe("true")
|
||||
12 | os.spawnl("true")
|
||||
13 | os.spawnle("true")
|
||||
| ^^^^^^^^^^ S606
|
||||
14 | os.spawnlp("true")
|
||||
15 | os.spawnlpe("true")
|
||||
|
|
||||
|
||||
S606.py:14:1: S606 Starting a process without a shell
|
||||
|
|
||||
12 | os.spawnl("true")
|
||||
13 | os.spawnle("true")
|
||||
14 | os.spawnlp("true")
|
||||
| ^^^^^^^^^^ S606
|
||||
15 | os.spawnlpe("true")
|
||||
16 | os.spawnv("true")
|
||||
|
|
||||
|
||||
S606.py:15:1: S606 Starting a process without a shell
|
||||
|
|
||||
13 | os.spawnle("true")
|
||||
14 | os.spawnlp("true")
|
||||
15 | os.spawnlpe("true")
|
||||
| ^^^^^^^^^^^ S606
|
||||
16 | os.spawnv("true")
|
||||
17 | os.spawnve("true")
|
||||
|
|
||||
|
||||
S606.py:16:1: S606 Starting a process without a shell
|
||||
|
|
||||
14 | os.spawnlp("true")
|
||||
15 | os.spawnlpe("true")
|
||||
16 | os.spawnv("true")
|
||||
| ^^^^^^^^^ S606
|
||||
17 | os.spawnve("true")
|
||||
18 | os.spawnvp("true")
|
||||
|
|
||||
|
||||
S606.py:17:1: S606 Starting a process without a shell
|
||||
|
|
||||
15 | os.spawnlpe("true")
|
||||
16 | os.spawnv("true")
|
||||
17 | os.spawnve("true")
|
||||
| ^^^^^^^^^^ S606
|
||||
18 | os.spawnvp("true")
|
||||
19 | os.spawnvpe("true")
|
||||
|
|
||||
|
||||
S606.py:18:1: S606 Starting a process without a shell
|
||||
|
|
||||
16 | os.spawnv("true")
|
||||
17 | os.spawnve("true")
|
||||
18 | os.spawnvp("true")
|
||||
| ^^^^^^^^^^ S606
|
||||
19 | os.spawnvpe("true")
|
||||
20 | os.startfile("true")
|
||||
|
|
||||
|
||||
S606.py:19:1: S606 Starting a process without a shell
|
||||
|
|
||||
17 | os.spawnve("true")
|
||||
18 | os.spawnvp("true")
|
||||
19 | os.spawnvpe("true")
|
||||
| ^^^^^^^^^^^ S606
|
||||
20 | os.startfile("true")
|
||||
|
|
||||
|
||||
S606.py:20:1: S606 Starting a process without a shell
|
||||
|
|
||||
18 | os.spawnvp("true")
|
||||
19 | os.spawnvpe("true")
|
||||
20 | os.startfile("true")
|
||||
| ^^^^^^^^^^^^ S606
|
||||
|
|
||||
|
||||
|
|
@ -1,223 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/flake8_bandit/mod.rs
|
||||
---
|
||||
S607.py:9:11: S607 Starting a process with a partial executable path
|
||||
|
|
||||
7 | subprocess.check_output("true")
|
||||
8 | subprocess.run("true")
|
||||
9 | os.system("true")
|
||||
| ^^^^^^ S607
|
||||
10 | os.popen("true")
|
||||
11 | os.popen2("true")
|
||||
|
|
||||
|
||||
S607.py:10:10: S607 Starting a process with a partial executable path
|
||||
|
|
||||
8 | subprocess.run("true")
|
||||
9 | os.system("true")
|
||||
10 | os.popen("true")
|
||||
| ^^^^^^ S607
|
||||
11 | os.popen2("true")
|
||||
12 | os.popen3("true")
|
||||
|
|
||||
|
||||
S607.py:11:11: S607 Starting a process with a partial executable path
|
||||
|
|
||||
9 | os.system("true")
|
||||
10 | os.popen("true")
|
||||
11 | os.popen2("true")
|
||||
| ^^^^^^ S607
|
||||
12 | os.popen3("true")
|
||||
13 | os.popen4("true")
|
||||
|
|
||||
|
||||
S607.py:12:11: S607 Starting a process with a partial executable path
|
||||
|
|
||||
10 | os.popen("true")
|
||||
11 | os.popen2("true")
|
||||
12 | os.popen3("true")
|
||||
| ^^^^^^ S607
|
||||
13 | os.popen4("true")
|
||||
14 | popen2.popen2("true")
|
||||
|
|
||||
|
||||
S607.py:13:11: S607 Starting a process with a partial executable path
|
||||
|
|
||||
11 | os.popen2("true")
|
||||
12 | os.popen3("true")
|
||||
13 | os.popen4("true")
|
||||
| ^^^^^^ S607
|
||||
14 | popen2.popen2("true")
|
||||
15 | popen2.popen3("true")
|
||||
|
|
||||
|
||||
S607.py:21:10: S607 Starting a process with a partial executable path
|
||||
|
|
||||
19 | commands.getoutput("true")
|
||||
20 | commands.getstatusoutput("true")
|
||||
21 | os.execl("true")
|
||||
| ^^^^^^ S607
|
||||
22 | os.execle("true")
|
||||
23 | os.execlp("true")
|
||||
|
|
||||
|
||||
S607.py:22:11: S607 Starting a process with a partial executable path
|
||||
|
|
||||
20 | commands.getstatusoutput("true")
|
||||
21 | os.execl("true")
|
||||
22 | os.execle("true")
|
||||
| ^^^^^^ S607
|
||||
23 | os.execlp("true")
|
||||
24 | os.execlpe("true")
|
||||
|
|
||||
|
||||
S607.py:23:11: S607 Starting a process with a partial executable path
|
||||
|
|
||||
21 | os.execl("true")
|
||||
22 | os.execle("true")
|
||||
23 | os.execlp("true")
|
||||
| ^^^^^^ S607
|
||||
24 | os.execlpe("true")
|
||||
25 | os.execv("true")
|
||||
|
|
||||
|
||||
S607.py:24:12: S607 Starting a process with a partial executable path
|
||||
|
|
||||
22 | os.execle("true")
|
||||
23 | os.execlp("true")
|
||||
24 | os.execlpe("true")
|
||||
| ^^^^^^ S607
|
||||
25 | os.execv("true")
|
||||
26 | os.execve("true")
|
||||
|
|
||||
|
||||
S607.py:25:10: S607 Starting a process with a partial executable path
|
||||
|
|
||||
23 | os.execlp("true")
|
||||
24 | os.execlpe("true")
|
||||
25 | os.execv("true")
|
||||
| ^^^^^^ S607
|
||||
26 | os.execve("true")
|
||||
27 | os.execvp("true")
|
||||
|
|
||||
|
||||
S607.py:26:11: S607 Starting a process with a partial executable path
|
||||
|
|
||||
24 | os.execlpe("true")
|
||||
25 | os.execv("true")
|
||||
26 | os.execve("true")
|
||||
| ^^^^^^ S607
|
||||
27 | os.execvp("true")
|
||||
28 | os.execvpe("true")
|
||||
|
|
||||
|
||||
S607.py:27:11: S607 Starting a process with a partial executable path
|
||||
|
|
||||
25 | os.execv("true")
|
||||
26 | os.execve("true")
|
||||
27 | os.execvp("true")
|
||||
| ^^^^^^ S607
|
||||
28 | os.execvpe("true")
|
||||
29 | os.spawnl("true")
|
||||
|
|
||||
|
||||
S607.py:28:12: S607 Starting a process with a partial executable path
|
||||
|
|
||||
26 | os.execve("true")
|
||||
27 | os.execvp("true")
|
||||
28 | os.execvpe("true")
|
||||
| ^^^^^^ S607
|
||||
29 | os.spawnl("true")
|
||||
30 | os.spawnle("true")
|
||||
|
|
||||
|
||||
S607.py:29:11: S607 Starting a process with a partial executable path
|
||||
|
|
||||
27 | os.execvp("true")
|
||||
28 | os.execvpe("true")
|
||||
29 | os.spawnl("true")
|
||||
| ^^^^^^ S607
|
||||
30 | os.spawnle("true")
|
||||
31 | os.spawnlp("true")
|
||||
|
|
||||
|
||||
S607.py:30:12: S607 Starting a process with a partial executable path
|
||||
|
|
||||
28 | os.execvpe("true")
|
||||
29 | os.spawnl("true")
|
||||
30 | os.spawnle("true")
|
||||
| ^^^^^^ S607
|
||||
31 | os.spawnlp("true")
|
||||
32 | os.spawnlpe("true")
|
||||
|
|
||||
|
||||
S607.py:31:12: S607 Starting a process with a partial executable path
|
||||
|
|
||||
29 | os.spawnl("true")
|
||||
30 | os.spawnle("true")
|
||||
31 | os.spawnlp("true")
|
||||
| ^^^^^^ S607
|
||||
32 | os.spawnlpe("true")
|
||||
33 | os.spawnv("true")
|
||||
|
|
||||
|
||||
S607.py:32:13: S607 Starting a process with a partial executable path
|
||||
|
|
||||
30 | os.spawnle("true")
|
||||
31 | os.spawnlp("true")
|
||||
32 | os.spawnlpe("true")
|
||||
| ^^^^^^ S607
|
||||
33 | os.spawnv("true")
|
||||
34 | os.spawnve("true")
|
||||
|
|
||||
|
||||
S607.py:33:11: S607 Starting a process with a partial executable path
|
||||
|
|
||||
31 | os.spawnlp("true")
|
||||
32 | os.spawnlpe("true")
|
||||
33 | os.spawnv("true")
|
||||
| ^^^^^^ S607
|
||||
34 | os.spawnve("true")
|
||||
35 | os.spawnvp("true")
|
||||
|
|
||||
|
||||
S607.py:34:12: S607 Starting a process with a partial executable path
|
||||
|
|
||||
32 | os.spawnlpe("true")
|
||||
33 | os.spawnv("true")
|
||||
34 | os.spawnve("true")
|
||||
| ^^^^^^ S607
|
||||
35 | os.spawnvp("true")
|
||||
36 | os.spawnvpe("true")
|
||||
|
|
||||
|
||||
S607.py:35:12: S607 Starting a process with a partial executable path
|
||||
|
|
||||
33 | os.spawnv("true")
|
||||
34 | os.spawnve("true")
|
||||
35 | os.spawnvp("true")
|
||||
| ^^^^^^ S607
|
||||
36 | os.spawnvpe("true")
|
||||
37 | os.startfile("true")
|
||||
|
|
||||
|
||||
S607.py:36:13: S607 Starting a process with a partial executable path
|
||||
|
|
||||
34 | os.spawnve("true")
|
||||
35 | os.spawnvp("true")
|
||||
36 | os.spawnvpe("true")
|
||||
| ^^^^^^ S607
|
||||
37 | os.startfile("true")
|
||||
|
|
||||
|
||||
S607.py:37:14: S607 Starting a process with a partial executable path
|
||||
|
|
||||
35 | os.spawnvp("true")
|
||||
36 | os.spawnvpe("true")
|
||||
37 | os.startfile("true")
|
||||
| ^^^^^^ S607
|
||||
38 |
|
||||
39 | # Check it does not fail for full paths.
|
||||
|
|
||||
|
||||
|
|
@ -1,482 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/flake8_bandit/mod.rs
|
||||
---
|
||||
S608.py:2:10: S608 Possible SQL injection vector through string-based query construction
|
||||
|
|
||||
1 | # single-line failures
|
||||
2 | query1 = "SELECT %s FROM table" % (var,) # bad
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
3 | query2 = "SELECT var FROM " + table
|
||||
4 | query3 = "SELECT " + val + " FROM " + table
|
||||
|
|
||||
|
||||
S608.py:3:10: S608 Possible SQL injection vector through string-based query construction
|
||||
|
|
||||
1 | # single-line failures
|
||||
2 | query1 = "SELECT %s FROM table" % (var,) # bad
|
||||
3 | query2 = "SELECT var FROM " + table
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
4 | query3 = "SELECT " + val + " FROM " + table
|
||||
5 | query4 = "SELECT {} FROM table;".format(var)
|
||||
|
|
||||
|
||||
S608.py:4:10: S608 Possible SQL injection vector through string-based query construction
|
||||
|
|
||||
2 | query1 = "SELECT %s FROM table" % (var,) # bad
|
||||
3 | query2 = "SELECT var FROM " + table
|
||||
4 | query3 = "SELECT " + val + " FROM " + table
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
5 | query4 = "SELECT {} FROM table;".format(var)
|
||||
6 | query5 = f"SELECT * FROM table WHERE var = {var}"
|
||||
|
|
||||
|
||||
S608.py:5:10: S608 Possible SQL injection vector through string-based query construction
|
||||
|
|
||||
3 | query2 = "SELECT var FROM " + table
|
||||
4 | query3 = "SELECT " + val + " FROM " + table
|
||||
5 | query4 = "SELECT {} FROM table;".format(var)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
6 | query5 = f"SELECT * FROM table WHERE var = {var}"
|
||||
|
|
||||
|
||||
S608.py:6:10: S608 Possible SQL injection vector through string-based query construction
|
||||
|
|
||||
4 | query3 = "SELECT " + val + " FROM " + table
|
||||
5 | query4 = "SELECT {} FROM table;".format(var)
|
||||
6 | query5 = f"SELECT * FROM table WHERE var = {var}"
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
7 |
|
||||
8 | query6 = "DELETE FROM table WHERE var = %s" % (var,)
|
||||
|
|
||||
|
||||
S608.py:8:10: S608 Possible SQL injection vector through string-based query construction
|
||||
|
|
||||
6 | query5 = f"SELECT * FROM table WHERE var = {var}"
|
||||
7 |
|
||||
8 | query6 = "DELETE FROM table WHERE var = %s" % (var,)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
9 | query7 = "DELETE FROM table WHERE VAR = " + var
|
||||
10 | query8 = "DELETE FROM " + table + "WHERE var = " + var
|
||||
|
|
||||
|
||||
S608.py:9:10: S608 Possible SQL injection vector through string-based query construction
|
||||
|
|
||||
8 | query6 = "DELETE FROM table WHERE var = %s" % (var,)
|
||||
9 | query7 = "DELETE FROM table WHERE VAR = " + var
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
10 | query8 = "DELETE FROM " + table + "WHERE var = " + var
|
||||
11 | query9 = "DELETE FROM table WHERE var = {}".format(var)
|
||||
|
|
||||
|
||||
S608.py:10:10: S608 Possible SQL injection vector through string-based query construction
|
||||
|
|
||||
8 | query6 = "DELETE FROM table WHERE var = %s" % (var,)
|
||||
9 | query7 = "DELETE FROM table WHERE VAR = " + var
|
||||
10 | query8 = "DELETE FROM " + table + "WHERE var = " + var
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
11 | query9 = "DELETE FROM table WHERE var = {}".format(var)
|
||||
12 | query10 = f"DELETE FROM table WHERE var = {var}"
|
||||
|
|
||||
|
||||
S608.py:11:10: S608 Possible SQL injection vector through string-based query construction
|
||||
|
|
||||
9 | query7 = "DELETE FROM table WHERE VAR = " + var
|
||||
10 | query8 = "DELETE FROM " + table + "WHERE var = " + var
|
||||
11 | query9 = "DELETE FROM table WHERE var = {}".format(var)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
12 | query10 = f"DELETE FROM table WHERE var = {var}"
|
||||
|
|
||||
|
||||
S608.py:12:11: S608 Possible SQL injection vector through string-based query construction
|
||||
|
|
||||
10 | query8 = "DELETE FROM " + table + "WHERE var = " + var
|
||||
11 | query9 = "DELETE FROM table WHERE var = {}".format(var)
|
||||
12 | query10 = f"DELETE FROM table WHERE var = {var}"
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
13 |
|
||||
14 | query11 = "INSERT INTO table VALUES (%s)" % (var,)
|
||||
|
|
||||
|
||||
S608.py:14:11: S608 Possible SQL injection vector through string-based query construction
|
||||
|
|
||||
12 | query10 = f"DELETE FROM table WHERE var = {var}"
|
||||
13 |
|
||||
14 | query11 = "INSERT INTO table VALUES (%s)" % (var,)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
15 | query12 = "INSERT INTO TABLE VALUES (" + var + ")"
|
||||
16 | query13 = "INSERT INTO {} VALUES ({})".format(table, var)
|
||||
|
|
||||
|
||||
S608.py:15:11: S608 Possible SQL injection vector through string-based query construction
|
||||
|
|
||||
14 | query11 = "INSERT INTO table VALUES (%s)" % (var,)
|
||||
15 | query12 = "INSERT INTO TABLE VALUES (" + var + ")"
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
16 | query13 = "INSERT INTO {} VALUES ({})".format(table, var)
|
||||
17 | query14 = f"INSERT INTO {table} VALUES var = {var}"
|
||||
|
|
||||
|
||||
S608.py:16:11: S608 Possible SQL injection vector through string-based query construction
|
||||
|
|
||||
14 | query11 = "INSERT INTO table VALUES (%s)" % (var,)
|
||||
15 | query12 = "INSERT INTO TABLE VALUES (" + var + ")"
|
||||
16 | query13 = "INSERT INTO {} VALUES ({})".format(table, var)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
17 | query14 = f"INSERT INTO {table} VALUES var = {var}"
|
||||
|
|
||||
|
||||
S608.py:17:11: S608 Possible SQL injection vector through string-based query construction
|
||||
|
|
||||
15 | query12 = "INSERT INTO TABLE VALUES (" + var + ")"
|
||||
16 | query13 = "INSERT INTO {} VALUES ({})".format(table, var)
|
||||
17 | query14 = f"INSERT INTO {table} VALUES var = {var}"
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
18 |
|
||||
19 | query15 = "UPDATE %s SET var = %s" % (table, var)
|
||||
|
|
||||
|
||||
S608.py:19:11: S608 Possible SQL injection vector through string-based query construction
|
||||
|
|
||||
17 | query14 = f"INSERT INTO {table} VALUES var = {var}"
|
||||
18 |
|
||||
19 | query15 = "UPDATE %s SET var = %s" % (table, var)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
20 | query16 = "UPDATE " + table + " SET var = " + var
|
||||
21 | query17 = "UPDATE {} SET var = {}".format(table, var)
|
||||
|
|
||||
|
||||
S608.py:20:11: S608 Possible SQL injection vector through string-based query construction
|
||||
|
|
||||
19 | query15 = "UPDATE %s SET var = %s" % (table, var)
|
||||
20 | query16 = "UPDATE " + table + " SET var = " + var
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
21 | query17 = "UPDATE {} SET var = {}".format(table, var)
|
||||
22 | query18 = f"UPDATE {table} SET var = {var}"
|
||||
|
|
||||
|
||||
S608.py:21:11: S608 Possible SQL injection vector through string-based query construction
|
||||
|
|
||||
19 | query15 = "UPDATE %s SET var = %s" % (table, var)
|
||||
20 | query16 = "UPDATE " + table + " SET var = " + var
|
||||
21 | query17 = "UPDATE {} SET var = {}".format(table, var)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
22 | query18 = f"UPDATE {table} SET var = {var}"
|
||||
|
|
||||
|
||||
S608.py:22:11: S608 Possible SQL injection vector through string-based query construction
|
||||
|
|
||||
20 | query16 = "UPDATE " + table + " SET var = " + var
|
||||
21 | query17 = "UPDATE {} SET var = {}".format(table, var)
|
||||
22 | query18 = f"UPDATE {table} SET var = {var}"
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
23 |
|
||||
24 | query19 = "select %s from table" % (var,)
|
||||
|
|
||||
|
||||
S608.py:24:11: S608 Possible SQL injection vector through string-based query construction
|
||||
|
|
||||
22 | query18 = f"UPDATE {table} SET var = {var}"
|
||||
23 |
|
||||
24 | query19 = "select %s from table" % (var,)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
25 | query20 = "select var from " + table
|
||||
26 | query21 = "select " + val + " from " + table
|
||||
|
|
||||
|
||||
S608.py:25:11: S608 Possible SQL injection vector through string-based query construction
|
||||
|
|
||||
24 | query19 = "select %s from table" % (var,)
|
||||
25 | query20 = "select var from " + table
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
26 | query21 = "select " + val + " from " + table
|
||||
27 | query22 = "select {} from table;".format(var)
|
||||
|
|
||||
|
||||
S608.py:26:11: S608 Possible SQL injection vector through string-based query construction
|
||||
|
|
||||
24 | query19 = "select %s from table" % (var,)
|
||||
25 | query20 = "select var from " + table
|
||||
26 | query21 = "select " + val + " from " + table
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
27 | query22 = "select {} from table;".format(var)
|
||||
28 | query23 = f"select * from table where var = {var}"
|
||||
|
|
||||
|
||||
S608.py:27:11: S608 Possible SQL injection vector through string-based query construction
|
||||
|
|
||||
25 | query20 = "select var from " + table
|
||||
26 | query21 = "select " + val + " from " + table
|
||||
27 | query22 = "select {} from table;".format(var)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
28 | query23 = f"select * from table where var = {var}"
|
||||
|
|
||||
|
||||
S608.py:28:11: S608 Possible SQL injection vector through string-based query construction
|
||||
|
|
||||
26 | query21 = "select " + val + " from " + table
|
||||
27 | query22 = "select {} from table;".format(var)
|
||||
28 | query23 = f"select * from table where var = {var}"
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
29 |
|
||||
30 | query24 = "delete from table where var = %s" % (var,)
|
||||
|
|
||||
|
||||
S608.py:30:11: S608 Possible SQL injection vector through string-based query construction
|
||||
|
|
||||
28 | query23 = f"select * from table where var = {var}"
|
||||
29 |
|
||||
30 | query24 = "delete from table where var = %s" % (var,)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
31 | query25 = "delete from table where var = " + var
|
||||
32 | query26 = "delete from " + table + "where var = " + var
|
||||
|
|
||||
|
||||
S608.py:31:11: S608 Possible SQL injection vector through string-based query construction
|
||||
|
|
||||
30 | query24 = "delete from table where var = %s" % (var,)
|
||||
31 | query25 = "delete from table where var = " + var
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
32 | query26 = "delete from " + table + "where var = " + var
|
||||
33 | query27 = "delete from table where var = {}".format(var)
|
||||
|
|
||||
|
||||
S608.py:32:11: S608 Possible SQL injection vector through string-based query construction
|
||||
|
|
||||
30 | query24 = "delete from table where var = %s" % (var,)
|
||||
31 | query25 = "delete from table where var = " + var
|
||||
32 | query26 = "delete from " + table + "where var = " + var
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
33 | query27 = "delete from table where var = {}".format(var)
|
||||
34 | query28 = f"delete from table where var = {var}"
|
||||
|
|
||||
|
||||
S608.py:33:11: S608 Possible SQL injection vector through string-based query construction
|
||||
|
|
||||
31 | query25 = "delete from table where var = " + var
|
||||
32 | query26 = "delete from " + table + "where var = " + var
|
||||
33 | query27 = "delete from table where var = {}".format(var)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
34 | query28 = f"delete from table where var = {var}"
|
||||
|
|
||||
|
||||
S608.py:34:11: S608 Possible SQL injection vector through string-based query construction
|
||||
|
|
||||
32 | query26 = "delete from " + table + "where var = " + var
|
||||
33 | query27 = "delete from table where var = {}".format(var)
|
||||
34 | query28 = f"delete from table where var = {var}"
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
35 |
|
||||
36 | query29 = "insert into table values (%s)" % (var,)
|
||||
|
|
||||
|
||||
S608.py:36:11: S608 Possible SQL injection vector through string-based query construction
|
||||
|
|
||||
34 | query28 = f"delete from table where var = {var}"
|
||||
35 |
|
||||
36 | query29 = "insert into table values (%s)" % (var,)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
37 | query30 = "insert into table values (" + var + ")"
|
||||
38 | query31 = "insert into {} values ({})".format(table, var)
|
||||
|
|
||||
|
||||
S608.py:37:11: S608 Possible SQL injection vector through string-based query construction
|
||||
|
|
||||
36 | query29 = "insert into table values (%s)" % (var,)
|
||||
37 | query30 = "insert into table values (" + var + ")"
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
38 | query31 = "insert into {} values ({})".format(table, var)
|
||||
39 | query32 = f"insert into {table} values var = {var}"
|
||||
|
|
||||
|
||||
S608.py:38:11: S608 Possible SQL injection vector through string-based query construction
|
||||
|
|
||||
36 | query29 = "insert into table values (%s)" % (var,)
|
||||
37 | query30 = "insert into table values (" + var + ")"
|
||||
38 | query31 = "insert into {} values ({})".format(table, var)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
39 | query32 = f"insert into {table} values var = {var}"
|
||||
|
|
||||
|
||||
S608.py:39:11: S608 Possible SQL injection vector through string-based query construction
|
||||
|
|
||||
37 | query30 = "insert into table values (" + var + ")"
|
||||
38 | query31 = "insert into {} values ({})".format(table, var)
|
||||
39 | query32 = f"insert into {table} values var = {var}"
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
40 |
|
||||
41 | query33 = "update %s set var = %s" % (table, var)
|
||||
|
|
||||
|
||||
S608.py:41:11: S608 Possible SQL injection vector through string-based query construction
|
||||
|
|
||||
39 | query32 = f"insert into {table} values var = {var}"
|
||||
40 |
|
||||
41 | query33 = "update %s set var = %s" % (table, var)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
42 | query34 = "update " + table + " set var = " + var
|
||||
43 | query35 = "update {} set var = {}".format(table, var)
|
||||
|
|
||||
|
||||
S608.py:42:11: S608 Possible SQL injection vector through string-based query construction
|
||||
|
|
||||
41 | query33 = "update %s set var = %s" % (table, var)
|
||||
42 | query34 = "update " + table + " set var = " + var
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
43 | query35 = "update {} set var = {}".format(table, var)
|
||||
44 | query36 = f"update {table} set var = {var}"
|
||||
|
|
||||
|
||||
S608.py:43:11: S608 Possible SQL injection vector through string-based query construction
|
||||
|
|
||||
41 | query33 = "update %s set var = %s" % (table, var)
|
||||
42 | query34 = "update " + table + " set var = " + var
|
||||
43 | query35 = "update {} set var = {}".format(table, var)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
44 | query36 = f"update {table} set var = {var}"
|
||||
|
|
||||
|
||||
S608.py:44:11: S608 Possible SQL injection vector through string-based query construction
|
||||
|
|
||||
42 | query34 = "update " + table + " set var = " + var
|
||||
43 | query35 = "update {} set var = {}".format(table, var)
|
||||
44 | query36 = f"update {table} set var = {var}"
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
45 |
|
||||
46 | # multi-line failures
|
||||
|
|
||||
|
||||
S608.py:48:12: S608 Possible SQL injection vector through string-based query construction
|
||||
|
|
||||
46 | # multi-line failures
|
||||
47 | def query37():
|
||||
48 | return """
|
||||
| ____________^
|
||||
49 | | SELECT *
|
||||
50 | | FROM table
|
||||
51 | | WHERE var = %s
|
||||
52 | | """ % var
|
||||
| |_____________^ S608
|
||||
53 |
|
||||
54 | def query38():
|
||||
|
|
||||
|
||||
S608.py:55:12: S608 Possible SQL injection vector through string-based query construction
|
||||
|
|
||||
54 | def query38():
|
||||
55 | return """
|
||||
| ____________^
|
||||
56 | | SELECT *
|
||||
57 | | FROM TABLE
|
||||
58 | | WHERE var =
|
||||
59 | | """ + var
|
||||
| |_____________^ S608
|
||||
60 |
|
||||
61 | def query39():
|
||||
|
|
||||
|
||||
S608.py:62:12: S608 Possible SQL injection vector through string-based query construction
|
||||
|
|
||||
61 | def query39():
|
||||
62 | return """
|
||||
| ____________^
|
||||
63 | | SELECT *
|
||||
64 | | FROM table
|
||||
65 | | WHERE var = {}
|
||||
66 | | """.format(var)
|
||||
| |___________________^ S608
|
||||
67 |
|
||||
68 | def query40():
|
||||
|
|
||||
|
||||
S608.py:69:12: S608 Possible SQL injection vector through string-based query construction
|
||||
|
|
||||
68 | def query40():
|
||||
69 | return f"""
|
||||
| ____________^
|
||||
70 | | SELECT *
|
||||
71 | | FROM table
|
||||
72 | | WHERE var = {var}
|
||||
73 | | """
|
||||
| |_______^ S608
|
||||
74 |
|
||||
75 | def query41():
|
||||
|
|
||||
|
||||
S608.py:77:9: S608 Possible SQL injection vector through string-based query construction
|
||||
|
|
||||
75 | def query41():
|
||||
76 | return (
|
||||
77 | "SELECT * "
|
||||
| _________^
|
||||
78 | | "FROM table "
|
||||
79 | | f"WHERE var = {var}"
|
||||
| |____________________________^ S608
|
||||
80 | )
|
||||
|
|
||||
|
||||
S608.py:83:26: S608 Possible SQL injection vector through string-based query construction
|
||||
|
|
||||
82 | # # cursor-wrapped failures
|
||||
83 | query42 = cursor.execute("SELECT * FROM table WHERE var = %s" % var)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
84 | query43 = cursor.execute(f"SELECT * FROM table WHERE var = {var}")
|
||||
85 | query44 = cursor.execute("SELECT * FROM table WHERE var = {}".format(var))
|
||||
|
|
||||
|
||||
S608.py:84:26: S608 Possible SQL injection vector through string-based query construction
|
||||
|
|
||||
82 | # # cursor-wrapped failures
|
||||
83 | query42 = cursor.execute("SELECT * FROM table WHERE var = %s" % var)
|
||||
84 | query43 = cursor.execute(f"SELECT * FROM table WHERE var = {var}")
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
85 | query44 = cursor.execute("SELECT * FROM table WHERE var = {}".format(var))
|
||||
86 | query45 = cursor.executemany("SELECT * FROM table WHERE var = %s" % var, [])
|
||||
|
|
||||
|
||||
S608.py:85:26: S608 Possible SQL injection vector through string-based query construction
|
||||
|
|
||||
83 | query42 = cursor.execute("SELECT * FROM table WHERE var = %s" % var)
|
||||
84 | query43 = cursor.execute(f"SELECT * FROM table WHERE var = {var}")
|
||||
85 | query44 = cursor.execute("SELECT * FROM table WHERE var = {}".format(var))
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
86 | query45 = cursor.executemany("SELECT * FROM table WHERE var = %s" % var, [])
|
||||
|
|
||||
|
||||
S608.py:86:30: S608 Possible SQL injection vector through string-based query construction
|
||||
|
|
||||
84 | query43 = cursor.execute(f"SELECT * FROM table WHERE var = {var}")
|
||||
85 | query44 = cursor.execute("SELECT * FROM table WHERE var = {}".format(var))
|
||||
86 | query45 = cursor.executemany("SELECT * FROM table WHERE var = %s" % var, [])
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
87 |
|
||||
88 | # # pass
|
||||
|
|
||||
|
||||
S608.py:98:9: S608 Possible SQL injection vector through string-based query construction
|
||||
|
|
||||
97 | # # INSERT without INTO (e.g. MySQL and derivatives)
|
||||
98 | query = "INSERT table VALUES (%s)" % (var,)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
99 |
|
||||
100 | # # REPLACE (e.g. MySQL and derivatives, SQLite)
|
||||
|
|
||||
|
||||
S608.py:101:9: S608 Possible SQL injection vector through string-based query construction
|
||||
|
|
||||
100 | # # REPLACE (e.g. MySQL and derivatives, SQLite)
|
||||
101 | query = "REPLACE INTO table VALUES (%s)" % (var,)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
102 | query = "REPLACE table VALUES (%s)" % (var,)
|
||||
|
|
||||
|
||||
S608.py:102:9: S608 Possible SQL injection vector through string-based query construction
|
||||
|
|
||||
100 | # # REPLACE (e.g. MySQL and derivatives, SQLite)
|
||||
101 | query = "REPLACE INTO table VALUES (%s)" % (var,)
|
||||
102 | query = "REPLACE table VALUES (%s)" % (var,)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
|
||||
103 |
|
||||
104 | query = "Deselect something that is not SQL even though it has a ' from ' somewhere in %s." % "there"
|
||||
|
|
||||
|
||||
|
|
@ -1,41 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/flake8_bandit/mod.rs
|
||||
---
|
||||
S609.py:4:1: S609 Possible wildcard injection in call due to `*` usage
|
||||
|
|
||||
2 | import subprocess
|
||||
3 |
|
||||
4 | os.popen("chmod +w foo*")
|
||||
| ^^^^^^^^ S609
|
||||
5 | subprocess.Popen("/bin/chown root: *", shell=True)
|
||||
6 | subprocess.Popen(["/usr/local/bin/rsync", "*", "some_where:"], shell=True)
|
||||
|
|
||||
|
||||
S609.py:5:1: S609 Possible wildcard injection in call due to `*` usage
|
||||
|
|
||||
4 | os.popen("chmod +w foo*")
|
||||
5 | subprocess.Popen("/bin/chown root: *", shell=True)
|
||||
| ^^^^^^^^^^^^^^^^ S609
|
||||
6 | subprocess.Popen(["/usr/local/bin/rsync", "*", "some_where:"], shell=True)
|
||||
7 | subprocess.Popen("/usr/local/bin/rsync * no_injection_here:")
|
||||
|
|
||||
|
||||
S609.py:6:1: S609 Possible wildcard injection in call due to `*` usage
|
||||
|
|
||||
4 | os.popen("chmod +w foo*")
|
||||
5 | subprocess.Popen("/bin/chown root: *", shell=True)
|
||||
6 | subprocess.Popen(["/usr/local/bin/rsync", "*", "some_where:"], shell=True)
|
||||
| ^^^^^^^^^^^^^^^^ S609
|
||||
7 | subprocess.Popen("/usr/local/bin/rsync * no_injection_here:")
|
||||
8 | os.system("tar cf foo.tar bar/*")
|
||||
|
|
||||
|
||||
S609.py:8:1: S609 Possible wildcard injection in call due to `*` usage
|
||||
|
|
||||
6 | subprocess.Popen(["/usr/local/bin/rsync", "*", "some_where:"], shell=True)
|
||||
7 | subprocess.Popen("/usr/local/bin/rsync * no_injection_here:")
|
||||
8 | os.system("tar cf foo.tar bar/*")
|
||||
| ^^^^^^^^^ S609
|
||||
|
|
||||
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/flake8_bandit/mod.rs
|
||||
---
|
||||
S612.py:3:5: S612 Use of insecure `logging.config.listen` detected
|
||||
|
|
||||
1 | import logging.config
|
||||
2 |
|
||||
3 | t = logging.config.listen(9999)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ S612
|
||||
4 |
|
||||
5 | def verify_func():
|
||||
|
|
||||
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/flake8_bandit/mod.rs
|
||||
---
|
||||
S701.py:9:57: S701 Using jinja2 templates with `autoescape=False` is dangerous and can lead to XSS. Ensure `autoescape=True` or use the `select_autoescape` function.
|
||||
|
|
||||
7 | templateEnv = jinja2.Environment(autoescape=True,
|
||||
8 | loader=templateLoader )
|
||||
9 | Environment(loader=templateLoader, load=templateLoader, autoescape=something) # S701
|
||||
| ^^^^^^^^^^^^^^^^^^^^ S701
|
||||
10 | templateEnv = jinja2.Environment(autoescape=False, loader=templateLoader ) # S701
|
||||
11 | Environment(loader=templateLoader,
|
||||
|
|
||||
|
||||
S701.py:10:34: S701 Using jinja2 templates with `autoescape=False` is dangerous and can lead to XSS. Ensure `autoescape=True` or use the `select_autoescape` function.
|
||||
|
|
||||
8 | loader=templateLoader )
|
||||
9 | Environment(loader=templateLoader, load=templateLoader, autoescape=something) # S701
|
||||
10 | templateEnv = jinja2.Environment(autoescape=False, loader=templateLoader ) # S701
|
||||
| ^^^^^^^^^^^^^^^^ S701
|
||||
11 | Environment(loader=templateLoader,
|
||||
12 | load=templateLoader,
|
||||
|
|
||||
|
||||
S701.py:13:13: S701 Using jinja2 templates with `autoescape=False` is dangerous and can lead to XSS. Ensure `autoescape=True` or use the `select_autoescape` function.
|
||||
|
|
||||
11 | Environment(loader=templateLoader,
|
||||
12 | load=templateLoader,
|
||||
13 | autoescape=False) # S701
|
||||
| ^^^^^^^^^^^^^^^^ S701
|
||||
14 |
|
||||
15 | Environment(loader=templateLoader, # S701
|
||||
|
|
||||
|
||||
S701.py:15:1: S701 By default, jinja2 sets `autoescape` to `False`. Consider using `autoescape=True` or the `select_autoescape` function to mitigate XSS vulnerabilities.
|
||||
|
|
||||
13 | autoescape=False) # S701
|
||||
14 |
|
||||
15 | Environment(loader=templateLoader, # S701
|
||||
| ^^^^^^^^^^^ S701
|
||||
16 | load=templateLoader)
|
||||
|
|
||||
|
||||
S701.py:29:36: S701 Using jinja2 templates with `autoescape=False` is dangerous and can lead to XSS. Ensure `autoescape=True` or use the `select_autoescape` function.
|
||||
|
|
||||
27 | def fake_func():
|
||||
28 | return 'foobar'
|
||||
29 | Environment(loader=templateLoader, autoescape=fake_func()) # S701
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ S701
|
||||
|
|
||||
|
||||
|
|
@ -1,97 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/flake8_blind_except/mod.rs
|
||||
---
|
||||
BLE.py:25:8: BLE001 Do not catch blind exception: `BaseException`
|
||||
|
|
||||
23 | except Exception as e:
|
||||
24 | raise e
|
||||
25 | except BaseException:
|
||||
| ^^^^^^^^^^^^^ BLE001
|
||||
26 | pass
|
||||
|
|
||||
|
||||
BLE.py:31:8: BLE001 Do not catch blind exception: `Exception`
|
||||
|
|
||||
29 | try:
|
||||
30 | pass
|
||||
31 | except Exception:
|
||||
| ^^^^^^^^^ BLE001
|
||||
32 | pass
|
||||
33 | finally:
|
||||
|
|
||||
|
||||
BLE.py:42:8: BLE001 Do not catch blind exception: `Exception`
|
||||
|
|
||||
40 | try:
|
||||
41 | pass
|
||||
42 | except Exception as e:
|
||||
| ^^^^^^^^^ BLE001
|
||||
43 | try:
|
||||
44 | raise e
|
||||
|
|
||||
|
||||
BLE.py:45:12: BLE001 Do not catch blind exception: `BaseException`
|
||||
|
|
||||
43 | try:
|
||||
44 | raise e
|
||||
45 | except BaseException:
|
||||
| ^^^^^^^^^^^^^ BLE001
|
||||
46 | pass
|
||||
|
|
||||
|
||||
BLE.py:54:8: BLE001 Do not catch blind exception: `Exception`
|
||||
|
|
||||
52 | except BaseException as e:
|
||||
53 | raise e
|
||||
54 | except Exception:
|
||||
| ^^^^^^^^^ BLE001
|
||||
55 | pass
|
||||
|
|
||||
|
||||
BLE.py:60:8: BLE001 Do not catch blind exception: `Exception`
|
||||
|
|
||||
58 | try:
|
||||
59 | pass
|
||||
60 | except Exception as e:
|
||||
| ^^^^^^^^^ BLE001
|
||||
61 | raise bad
|
||||
62 | except BaseException:
|
||||
|
|
||||
|
||||
BLE.py:62:8: BLE001 Do not catch blind exception: `BaseException`
|
||||
|
|
||||
60 | except Exception as e:
|
||||
61 | raise bad
|
||||
62 | except BaseException:
|
||||
| ^^^^^^^^^^^^^ BLE001
|
||||
63 | pass
|
||||
|
|
||||
|
||||
BLE.py:69:8: BLE001 Do not catch blind exception: `Exception`
|
||||
|
|
||||
67 | try:
|
||||
68 | pass
|
||||
69 | except Exception:
|
||||
| ^^^^^^^^^ BLE001
|
||||
70 | logging.error("...")
|
||||
|
|
||||
|
||||
BLE.py:75:8: BLE001 Do not catch blind exception: `Exception`
|
||||
|
|
||||
73 | try:
|
||||
74 | pass
|
||||
75 | except Exception:
|
||||
| ^^^^^^^^^ BLE001
|
||||
76 | logging.error("...", exc_info=False)
|
||||
|
|
||||
|
||||
BLE.py:81:8: BLE001 Do not catch blind exception: `Exception`
|
||||
|
|
||||
79 | try:
|
||||
80 | pass
|
||||
81 | except Exception:
|
||||
| ^^^^^^^^^ BLE001
|
||||
82 | logging.error("...", exc_info=None)
|
||||
|
|
||||
|
||||
|
|
@ -1,92 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/flake8_boolean_trap/mod.rs
|
||||
---
|
||||
FBT.py:4:5: FBT001 Boolean-typed positional argument in function definition
|
||||
|
|
||||
2 | posonly_nohint,
|
||||
3 | posonly_nonboolhint: int,
|
||||
4 | posonly_boolhint: bool,
|
||||
| ^^^^^^^^^^^^^^^^ FBT001
|
||||
5 | posonly_boolstrhint: "bool",
|
||||
6 | /,
|
||||
|
|
||||
|
||||
FBT.py:5:5: FBT001 Boolean-typed positional argument in function definition
|
||||
|
|
||||
3 | posonly_nonboolhint: int,
|
||||
4 | posonly_boolhint: bool,
|
||||
5 | posonly_boolstrhint: "bool",
|
||||
| ^^^^^^^^^^^^^^^^^^^ FBT001
|
||||
6 | /,
|
||||
7 | offset,
|
||||
|
|
||||
|
||||
FBT.py:10:5: FBT001 Boolean-typed positional argument in function definition
|
||||
|
|
||||
8 | posorkw_nonvalued_nohint,
|
||||
9 | posorkw_nonvalued_nonboolhint: int,
|
||||
10 | posorkw_nonvalued_boolhint: bool,
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ FBT001
|
||||
11 | posorkw_nonvalued_boolstrhint: "bool",
|
||||
12 | posorkw_boolvalued_nohint=True,
|
||||
|
|
||||
|
||||
FBT.py:11:5: FBT001 Boolean-typed positional argument in function definition
|
||||
|
|
||||
9 | posorkw_nonvalued_nonboolhint: int,
|
||||
10 | posorkw_nonvalued_boolhint: bool,
|
||||
11 | posorkw_nonvalued_boolstrhint: "bool",
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FBT001
|
||||
12 | posorkw_boolvalued_nohint=True,
|
||||
13 | posorkw_boolvalued_nonboolhint: int = True,
|
||||
|
|
||||
|
||||
FBT.py:14:5: FBT001 Boolean-typed positional argument in function definition
|
||||
|
|
||||
12 | posorkw_boolvalued_nohint=True,
|
||||
13 | posorkw_boolvalued_nonboolhint: int = True,
|
||||
14 | posorkw_boolvalued_boolhint: bool = True,
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ FBT001
|
||||
15 | posorkw_boolvalued_boolstrhint: "bool" = True,
|
||||
16 | posorkw_nonboolvalued_nohint=1,
|
||||
|
|
||||
|
||||
FBT.py:15:5: FBT001 Boolean-typed positional argument in function definition
|
||||
|
|
||||
13 | posorkw_boolvalued_nonboolhint: int = True,
|
||||
14 | posorkw_boolvalued_boolhint: bool = True,
|
||||
15 | posorkw_boolvalued_boolstrhint: "bool" = True,
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FBT001
|
||||
16 | posorkw_nonboolvalued_nohint=1,
|
||||
17 | posorkw_nonboolvalued_nonboolhint: int = 2,
|
||||
|
|
||||
|
||||
FBT.py:18:5: FBT001 Boolean-typed positional argument in function definition
|
||||
|
|
||||
16 | posorkw_nonboolvalued_nohint=1,
|
||||
17 | posorkw_nonboolvalued_nonboolhint: int = 2,
|
||||
18 | posorkw_nonboolvalued_boolhint: bool = 3,
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FBT001
|
||||
19 | posorkw_nonboolvalued_boolstrhint: "bool" = 4,
|
||||
20 | *,
|
||||
|
|
||||
|
||||
FBT.py:19:5: FBT001 Boolean-typed positional argument in function definition
|
||||
|
|
||||
17 | posorkw_nonboolvalued_nonboolhint: int = 2,
|
||||
18 | posorkw_nonboolvalued_boolhint: bool = 3,
|
||||
19 | posorkw_nonboolvalued_boolstrhint: "bool" = 4,
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FBT001
|
||||
20 | *,
|
||||
21 | kwonly_nonvalued_nohint,
|
||||
|
|
||||
|
||||
FBT.py:87:19: FBT001 Boolean-typed positional argument in function definition
|
||||
|
|
||||
86 | # FBT001: Boolean positional arg in function definition
|
||||
87 | def foo(self, value: bool) -> None:
|
||||
| ^^^^^ FBT001
|
||||
88 | pass
|
||||
|
|
||||
|
||||
|
|
@ -1,44 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/flake8_boolean_trap/mod.rs
|
||||
---
|
||||
FBT.py:12:5: FBT002 Boolean default positional argument in function definition
|
||||
|
|
||||
10 | posorkw_nonvalued_boolhint: bool,
|
||||
11 | posorkw_nonvalued_boolstrhint: "bool",
|
||||
12 | posorkw_boolvalued_nohint=True,
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ FBT002
|
||||
13 | posorkw_boolvalued_nonboolhint: int = True,
|
||||
14 | posorkw_boolvalued_boolhint: bool = True,
|
||||
|
|
||||
|
||||
FBT.py:13:5: FBT002 Boolean default positional argument in function definition
|
||||
|
|
||||
11 | posorkw_nonvalued_boolstrhint: "bool",
|
||||
12 | posorkw_boolvalued_nohint=True,
|
||||
13 | posorkw_boolvalued_nonboolhint: int = True,
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FBT002
|
||||
14 | posorkw_boolvalued_boolhint: bool = True,
|
||||
15 | posorkw_boolvalued_boolstrhint: "bool" = True,
|
||||
|
|
||||
|
||||
FBT.py:14:5: FBT002 Boolean default positional argument in function definition
|
||||
|
|
||||
12 | posorkw_boolvalued_nohint=True,
|
||||
13 | posorkw_boolvalued_nonboolhint: int = True,
|
||||
14 | posorkw_boolvalued_boolhint: bool = True,
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ FBT002
|
||||
15 | posorkw_boolvalued_boolstrhint: "bool" = True,
|
||||
16 | posorkw_nonboolvalued_nohint=1,
|
||||
|
|
||||
|
||||
FBT.py:15:5: FBT002 Boolean default positional argument in function definition
|
||||
|
|
||||
13 | posorkw_boolvalued_nonboolhint: int = True,
|
||||
14 | posorkw_boolvalued_boolhint: bool = True,
|
||||
15 | posorkw_boolvalued_boolstrhint: "bool" = True,
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FBT002
|
||||
16 | posorkw_nonboolvalued_nohint=1,
|
||||
17 | posorkw_nonboolvalued_nonboolhint: int = 2,
|
||||
|
|
||||
|
||||
|
|
@ -1,41 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/flake8_boolean_trap/mod.rs
|
||||
---
|
||||
FBT.py:42:11: FBT003 Boolean positional value in function call
|
||||
|
|
||||
42 | used("a", True)
|
||||
| ^^^^ FBT003
|
||||
43 | used(do=True)
|
||||
|
|
||||
|
||||
FBT.py:57:11: FBT003 Boolean positional value in function call
|
||||
|
|
||||
55 | {}.pop(True, False)
|
||||
56 | dict.fromkeys(("world",), True)
|
||||
57 | {}.deploy(True, False)
|
||||
| ^^^^ FBT003
|
||||
58 | getattr(someobj, attrname, False)
|
||||
59 | mylist.index(True)
|
||||
|
|
||||
|
||||
FBT.py:57:17: FBT003 Boolean positional value in function call
|
||||
|
|
||||
55 | {}.pop(True, False)
|
||||
56 | dict.fromkeys(("world",), True)
|
||||
57 | {}.deploy(True, False)
|
||||
| ^^^^^ FBT003
|
||||
58 | getattr(someobj, attrname, False)
|
||||
59 | mylist.index(True)
|
||||
|
|
||||
|
||||
FBT.py:69:38: FBT003 Boolean positional value in function call
|
||||
|
|
||||
67 | os.set_blocking(0, False)
|
||||
68 | g_action.set_enabled(True)
|
||||
69 | settings.set_enable_developer_extras(True)
|
||||
| ^^^^ FBT003
|
||||
70 | foo.is_(True)
|
||||
71 | bar.is_not(False)
|
||||
|
|
||||
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/flake8_bugbear/mod.rs
|
||||
---
|
||||
B002.py:18:9: B002 Python does not support the unary prefix increment operator (`++`)
|
||||
|
|
||||
17 | def this_is_buggy(n):
|
||||
18 | x = ++n
|
||||
| ^^^ B002
|
||||
19 | y = --n
|
||||
20 | return x, y
|
||||
|
|
||||
|
||||
B002.py:19:9: B002 Python does not support the unary prefix decrement operator (`--`)
|
||||
|
|
||||
17 | def this_is_buggy(n):
|
||||
18 | x = ++n
|
||||
19 | y = --n
|
||||
| ^^^ B002
|
||||
20 | return x, y
|
||||
|
|
||||
|
||||
B002.py:24:12: B002 Python does not support the unary prefix increment operator (`++`)
|
||||
|
|
||||
23 | def this_is_buggy_too(n):
|
||||
24 | return ++n, --n
|
||||
| ^^^ B002
|
||||
|
|
||||
|
||||
B002.py:24:17: B002 Python does not support the unary prefix decrement operator (`--`)
|
||||
|
|
||||
23 | def this_is_buggy_too(n):
|
||||
24 | return ++n, --n
|
||||
| ^^^ B002
|
||||
|
|
||||
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/flake8_bugbear/mod.rs
|
||||
---
|
||||
B003.py:9:1: B003 Assigning to `os.environ` doesn't clear the environment
|
||||
|
|
||||
7 | from os import environ
|
||||
8 |
|
||||
9 | os.environ = {}
|
||||
| ^^^^^^^^^^ B003
|
||||
10 | environ = {} # that's fine, assigning a new meaning to the module-level name
|
||||
|
|
||||
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/flake8_bugbear/mod.rs
|
||||
---
|
||||
B004.py:3:8: B004 [*] Using `hasattr(x, "__call__")` to test if x is callable is unreliable. Use `callable(x)` for consistent results.
|
||||
|
|
||||
1 | def this_is_a_bug():
|
||||
2 | o = object()
|
||||
3 | if hasattr(o, "__call__"):
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ B004
|
||||
4 | print("Ooh, callable! Or is it?")
|
||||
5 | if getattr(o, "__call__", False):
|
||||
|
|
||||
= help: Replace with `callable()`
|
||||
|
||||
ℹ Fix
|
||||
1 1 | def this_is_a_bug():
|
||||
2 2 | o = object()
|
||||
3 |- if hasattr(o, "__call__"):
|
||||
3 |+ if callable(o):
|
||||
4 4 | print("Ooh, callable! Or is it?")
|
||||
5 5 | if getattr(o, "__call__", False):
|
||||
6 6 | print("Ooh, callable! Or is it?")
|
||||
|
||||
B004.py:5:8: B004 Using `hasattr(x, "__call__")` to test if x is callable is unreliable. Use `callable(x)` for consistent results.
|
||||
|
|
||||
3 | if hasattr(o, "__call__"):
|
||||
4 | print("Ooh, callable! Or is it?")
|
||||
5 | if getattr(o, "__call__", False):
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ B004
|
||||
6 | print("Ooh, callable! Or is it?")
|
||||
|
|
||||
= help: Replace with `callable()`
|
||||
|
||||
|
|
@ -1,84 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/flake8_bugbear/mod.rs
|
||||
---
|
||||
B005.py:4:1: B005 Using `.strip()` with multi-character strings is misleading the reader
|
||||
|
|
||||
2 | s.strip(s) # no warning
|
||||
3 | s.strip("we") # no warning
|
||||
4 | s.strip(".facebook.com") # warning
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ B005
|
||||
5 | s.strip("e") # no warning
|
||||
6 | s.strip("\n\t ") # no warning
|
||||
|
|
||||
|
||||
B005.py:7:1: B005 Using `.strip()` with multi-character strings is misleading the reader
|
||||
|
|
||||
5 | s.strip("e") # no warning
|
||||
6 | s.strip("\n\t ") # no warning
|
||||
7 | s.strip(r"\n\t ") # warning
|
||||
| ^^^^^^^^^^^^^^^^^ B005
|
||||
8 | s.lstrip(s) # no warning
|
||||
9 | s.lstrip("we") # no warning
|
||||
|
|
||||
|
||||
B005.py:10:1: B005 Using `.strip()` with multi-character strings is misleading the reader
|
||||
|
|
||||
8 | s.lstrip(s) # no warning
|
||||
9 | s.lstrip("we") # no warning
|
||||
10 | s.lstrip(".facebook.com") # warning
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ B005
|
||||
11 | s.lstrip("e") # no warning
|
||||
12 | s.lstrip("\n\t ") # no warning
|
||||
|
|
||||
|
||||
B005.py:13:1: B005 Using `.strip()` with multi-character strings is misleading the reader
|
||||
|
|
||||
11 | s.lstrip("e") # no warning
|
||||
12 | s.lstrip("\n\t ") # no warning
|
||||
13 | s.lstrip(r"\n\t ") # warning
|
||||
| ^^^^^^^^^^^^^^^^^^ B005
|
||||
14 | s.rstrip(s) # no warning
|
||||
15 | s.rstrip("we") # warning
|
||||
|
|
||||
|
||||
B005.py:16:1: B005 Using `.strip()` with multi-character strings is misleading the reader
|
||||
|
|
||||
14 | s.rstrip(s) # no warning
|
||||
15 | s.rstrip("we") # warning
|
||||
16 | s.rstrip(".facebook.com") # warning
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ B005
|
||||
17 | s.rstrip("e") # no warning
|
||||
18 | s.rstrip("\n\t ") # no warning
|
||||
|
|
||||
|
||||
B005.py:19:1: B005 Using `.strip()` with multi-character strings is misleading the reader
|
||||
|
|
||||
17 | s.rstrip("e") # no warning
|
||||
18 | s.rstrip("\n\t ") # no warning
|
||||
19 | s.rstrip(r"\n\t ") # warning
|
||||
| ^^^^^^^^^^^^^^^^^^ B005
|
||||
20 | s.strip("a") # no warning
|
||||
21 | s.strip("あ") # no warning
|
||||
|
|
||||
|
||||
B005.py:22:1: B005 Using `.strip()` with multi-character strings is misleading the reader
|
||||
|
|
||||
20 | s.strip("a") # no warning
|
||||
21 | s.strip("あ") # no warning
|
||||
22 | s.strip("ああ") # warning
|
||||
| ^^^^^^^^^^^^^^^ B005
|
||||
23 | s.strip("\ufeff") # no warning
|
||||
24 | s.strip("\u0074\u0065\u0073\u0074") # warning
|
||||
|
|
||||
|
||||
B005.py:24:1: B005 Using `.strip()` with multi-character strings is misleading the reader
|
||||
|
|
||||
22 | s.strip("ああ") # warning
|
||||
23 | s.strip("\ufeff") # no warning
|
||||
24 | s.strip("\u0074\u0065\u0073\u0074") # warning
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ B005
|
||||
25 |
|
||||
26 | from somewhere import other_type, strip
|
||||
|
|
||||
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/flake8_bugbear/mod.rs
|
||||
---
|
||||
B006_1.py:3:22: B006 [*] Do not use mutable data structures for argument defaults
|
||||
|
|
||||
1 | # Docstring followed by a newline
|
||||
2 |
|
||||
3 | def foobar(foor, bar={}):
|
||||
| ^^ B006
|
||||
4 | """
|
||||
5 | """
|
||||
|
|
||||
= help: Replace with `None`; initialize within function
|
||||
|
||||
ℹ Possible fix
|
||||
1 1 | # Docstring followed by a newline
|
||||
2 2 |
|
||||
3 |-def foobar(foor, bar={}):
|
||||
3 |+def foobar(foor, bar=None):
|
||||
4 4 | """
|
||||
5 5 | """
|
||||
6 |+
|
||||
7 |+ if bar is None:
|
||||
8 |+ bar = {}
|
||||
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/flake8_bugbear/mod.rs
|
||||
---
|
||||
B006_2.py:4:22: B006 [*] Do not use mutable data structures for argument defaults
|
||||
|
|
||||
2 | # Regression test for https://github.com/astral-sh/ruff/issues/7155
|
||||
3 |
|
||||
4 | def foobar(foor, bar={}):
|
||||
| ^^ B006
|
||||
5 | """
|
||||
6 | """
|
||||
|
|
||||
= help: Replace with `None`; initialize within function
|
||||
|
||||
ℹ Possible fix
|
||||
1 1 | # Docstring followed by whitespace with no newline
|
||||
2 2 | # Regression test for https://github.com/astral-sh/ruff/issues/7155
|
||||
3 3 |
|
||||
4 |-def foobar(foor, bar={}):
|
||||
4 |+def foobar(foor, bar=None):
|
||||
5 5 | """
|
||||
6 |- """
|
||||
6 |+ """
|
||||
7 |+ if bar is None:
|
||||
8 |+ bar = {}
|
||||
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/flake8_bugbear/mod.rs
|
||||
---
|
||||
B006_3.py:4:22: B006 [*] Do not use mutable data structures for argument defaults
|
||||
|
|
||||
4 | def foobar(foor, bar={}):
|
||||
| ^^ B006
|
||||
5 | """
|
||||
6 | """
|
||||
|
|
||||
= help: Replace with `None`; initialize within function
|
||||
|
||||
ℹ Possible fix
|
||||
1 1 | # Docstring with no newline
|
||||
2 2 |
|
||||
3 3 |
|
||||
4 |-def foobar(foor, bar={}):
|
||||
4 |+def foobar(foor, bar=None):
|
||||
5 |+ """
|
||||
5 6 | """
|
||||
6 |- """
|
||||
7 |+ if bar is None:
|
||||
8 |+ bar = {}
|
||||
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/flake8_bugbear/mod.rs
|
||||
---
|
||||
B006_4.py:7:26: B006 [*] Do not use mutable data structures for argument defaults
|
||||
|
|
||||
6 | class FormFeedIndent:
|
||||
7 | def __init__(self, a=[]):
|
||||
| ^^ B006
|
||||
8 | print(a)
|
||||
|
|
||||
= help: Replace with `None`; initialize within function
|
||||
|
||||
ℹ Possible fix
|
||||
4 4 |
|
||||
5 5 |
|
||||
6 6 | class FormFeedIndent:
|
||||
7 |- def __init__(self, a=[]):
|
||||
7 |+ def __init__(self, a=None):
|
||||
8 |+ if a is None:
|
||||
9 |+ a = []
|
||||
8 10 | print(a)
|
||||
9 11 |
|
||||
|
||||
|
|
@ -1,498 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/flake8_bugbear/mod.rs
|
||||
---
|
||||
B006_B008.py:63:25: B006 [*] Do not use mutable data structures for argument defaults
|
||||
|
|
||||
63 | def this_is_wrong(value=[1, 2, 3]):
|
||||
| ^^^^^^^^^ B006
|
||||
64 | ...
|
||||
|
|
||||
= help: Replace with `None`; initialize within function
|
||||
|
||||
ℹ Possible fix
|
||||
60 60 | # Flag mutable literals/comprehensions
|
||||
61 61 |
|
||||
62 62 |
|
||||
63 |-def this_is_wrong(value=[1, 2, 3]):
|
||||
63 |+def this_is_wrong(value=None):
|
||||
64 |+ if value is None:
|
||||
65 |+ value = [1, 2, 3]
|
||||
64 66 | ...
|
||||
65 67 |
|
||||
66 68 |
|
||||
|
||||
B006_B008.py:67:30: B006 [*] Do not use mutable data structures for argument defaults
|
||||
|
|
||||
67 | def this_is_also_wrong(value={}):
|
||||
| ^^ B006
|
||||
68 | ...
|
||||
|
|
||||
= help: Replace with `None`; initialize within function
|
||||
|
||||
ℹ Possible fix
|
||||
64 64 | ...
|
||||
65 65 |
|
||||
66 66 |
|
||||
67 |-def this_is_also_wrong(value={}):
|
||||
67 |+def this_is_also_wrong(value=None):
|
||||
68 |+ if value is None:
|
||||
69 |+ value = {}
|
||||
68 70 | ...
|
||||
69 71 |
|
||||
70 72 |
|
||||
|
||||
B006_B008.py:73:52: B006 [*] Do not use mutable data structures for argument defaults
|
||||
|
|
||||
71 | class Foo:
|
||||
72 | @staticmethod
|
||||
73 | def this_is_also_wrong_and_more_indented(value={}):
|
||||
| ^^ B006
|
||||
74 | pass
|
||||
|
|
||||
= help: Replace with `None`; initialize within function
|
||||
|
||||
ℹ Possible fix
|
||||
70 70 |
|
||||
71 71 | class Foo:
|
||||
72 72 | @staticmethod
|
||||
73 |- def this_is_also_wrong_and_more_indented(value={}):
|
||||
73 |+ def this_is_also_wrong_and_more_indented(value=None):
|
||||
74 |+ if value is None:
|
||||
75 |+ value = {}
|
||||
74 76 | pass
|
||||
75 77 |
|
||||
76 78 |
|
||||
|
||||
B006_B008.py:77:31: B006 [*] Do not use mutable data structures for argument defaults
|
||||
|
|
||||
77 | def multiline_arg_wrong(value={
|
||||
| _______________________________^
|
||||
78 | |
|
||||
79 | | }):
|
||||
| |_^ B006
|
||||
80 | ...
|
||||
|
|
||||
= help: Replace with `None`; initialize within function
|
||||
|
||||
ℹ Possible fix
|
||||
74 74 | pass
|
||||
75 75 |
|
||||
76 76 |
|
||||
77 |-def multiline_arg_wrong(value={
|
||||
78 |-
|
||||
79 |-}):
|
||||
77 |+def multiline_arg_wrong(value=None):
|
||||
78 |+ if value is None:
|
||||
79 |+ value = {}
|
||||
80 80 | ...
|
||||
81 81 |
|
||||
82 82 | def single_line_func_wrong(value = {}): ...
|
||||
|
||||
B006_B008.py:82:36: B006 Do not use mutable data structures for argument defaults
|
||||
|
|
||||
80 | ...
|
||||
81 |
|
||||
82 | def single_line_func_wrong(value = {}): ...
|
||||
| ^^ B006
|
||||
|
|
||||
= help: Replace with `None`; initialize within function
|
||||
|
||||
B006_B008.py:85:20: B006 [*] Do not use mutable data structures for argument defaults
|
||||
|
|
||||
85 | def and_this(value=set()):
|
||||
| ^^^^^ B006
|
||||
86 | ...
|
||||
|
|
||||
= help: Replace with `None`; initialize within function
|
||||
|
||||
ℹ Possible fix
|
||||
82 82 | def single_line_func_wrong(value = {}): ...
|
||||
83 83 |
|
||||
84 84 |
|
||||
85 |-def and_this(value=set()):
|
||||
85 |+def and_this(value=None):
|
||||
86 |+ if value is None:
|
||||
87 |+ value = set()
|
||||
86 88 | ...
|
||||
87 89 |
|
||||
88 90 |
|
||||
|
||||
B006_B008.py:89:20: B006 [*] Do not use mutable data structures for argument defaults
|
||||
|
|
||||
89 | def this_too(value=collections.OrderedDict()):
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ B006
|
||||
90 | ...
|
||||
|
|
||||
= help: Replace with `None`; initialize within function
|
||||
|
||||
ℹ Possible fix
|
||||
86 86 | ...
|
||||
87 87 |
|
||||
88 88 |
|
||||
89 |-def this_too(value=collections.OrderedDict()):
|
||||
89 |+def this_too(value=None):
|
||||
90 |+ if value is None:
|
||||
91 |+ value = collections.OrderedDict()
|
||||
90 92 | ...
|
||||
91 93 |
|
||||
92 94 |
|
||||
|
||||
B006_B008.py:93:32: B006 [*] Do not use mutable data structures for argument defaults
|
||||
|
|
||||
93 | async def async_this_too(value=collections.defaultdict()):
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ B006
|
||||
94 | ...
|
||||
|
|
||||
= help: Replace with `None`; initialize within function
|
||||
|
||||
ℹ Possible fix
|
||||
90 90 | ...
|
||||
91 91 |
|
||||
92 92 |
|
||||
93 |-async def async_this_too(value=collections.defaultdict()):
|
||||
93 |+async def async_this_too(value=None):
|
||||
94 |+ if value is None:
|
||||
95 |+ value = collections.defaultdict()
|
||||
94 96 | ...
|
||||
95 97 |
|
||||
96 98 |
|
||||
|
||||
B006_B008.py:97:26: B006 [*] Do not use mutable data structures for argument defaults
|
||||
|
|
||||
97 | def dont_forget_me(value=collections.deque()):
|
||||
| ^^^^^^^^^^^^^^^^^^^ B006
|
||||
98 | ...
|
||||
|
|
||||
= help: Replace with `None`; initialize within function
|
||||
|
||||
ℹ Possible fix
|
||||
94 94 | ...
|
||||
95 95 |
|
||||
96 96 |
|
||||
97 |-def dont_forget_me(value=collections.deque()):
|
||||
97 |+def dont_forget_me(value=None):
|
||||
98 |+ if value is None:
|
||||
99 |+ value = collections.deque()
|
||||
98 100 | ...
|
||||
99 101 |
|
||||
100 102 |
|
||||
|
||||
B006_B008.py:102:46: B006 [*] Do not use mutable data structures for argument defaults
|
||||
|
|
||||
101 | # N.B. we're also flagging the function call in the comprehension
|
||||
102 | def list_comprehension_also_not_okay(default=[i**2 for i in range(3)]):
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ B006
|
||||
103 | pass
|
||||
|
|
||||
= help: Replace with `None`; initialize within function
|
||||
|
||||
ℹ Possible fix
|
||||
99 99 |
|
||||
100 100 |
|
||||
101 101 | # N.B. we're also flagging the function call in the comprehension
|
||||
102 |-def list_comprehension_also_not_okay(default=[i**2 for i in range(3)]):
|
||||
102 |+def list_comprehension_also_not_okay(default=None):
|
||||
103 |+ if default is None:
|
||||
104 |+ default = [i ** 2 for i in range(3)]
|
||||
103 105 | pass
|
||||
104 106 |
|
||||
105 107 |
|
||||
|
||||
B006_B008.py:106:46: B006 [*] Do not use mutable data structures for argument defaults
|
||||
|
|
||||
106 | def dict_comprehension_also_not_okay(default={i: i**2 for i in range(3)}):
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ B006
|
||||
107 | pass
|
||||
|
|
||||
= help: Replace with `None`; initialize within function
|
||||
|
||||
ℹ Possible fix
|
||||
103 103 | pass
|
||||
104 104 |
|
||||
105 105 |
|
||||
106 |-def dict_comprehension_also_not_okay(default={i: i**2 for i in range(3)}):
|
||||
106 |+def dict_comprehension_also_not_okay(default=None):
|
||||
107 |+ if default is None:
|
||||
108 |+ default = {i: i ** 2 for i in range(3)}
|
||||
107 109 | pass
|
||||
108 110 |
|
||||
109 111 |
|
||||
|
||||
B006_B008.py:110:45: B006 [*] Do not use mutable data structures for argument defaults
|
||||
|
|
||||
110 | def set_comprehension_also_not_okay(default={i**2 for i in range(3)}):
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ B006
|
||||
111 | pass
|
||||
|
|
||||
= help: Replace with `None`; initialize within function
|
||||
|
||||
ℹ Possible fix
|
||||
107 107 | pass
|
||||
108 108 |
|
||||
109 109 |
|
||||
110 |-def set_comprehension_also_not_okay(default={i**2 for i in range(3)}):
|
||||
110 |+def set_comprehension_also_not_okay(default=None):
|
||||
111 |+ if default is None:
|
||||
112 |+ default = {i ** 2 for i in range(3)}
|
||||
111 113 | pass
|
||||
112 114 |
|
||||
113 115 |
|
||||
|
||||
B006_B008.py:114:33: B006 [*] Do not use mutable data structures for argument defaults
|
||||
|
|
||||
114 | def kwonlyargs_mutable(*, value=[]):
|
||||
| ^^ B006
|
||||
115 | ...
|
||||
|
|
||||
= help: Replace with `None`; initialize within function
|
||||
|
||||
ℹ Possible fix
|
||||
111 111 | pass
|
||||
112 112 |
|
||||
113 113 |
|
||||
114 |-def kwonlyargs_mutable(*, value=[]):
|
||||
114 |+def kwonlyargs_mutable(*, value=None):
|
||||
115 |+ if value is None:
|
||||
116 |+ value = []
|
||||
115 117 | ...
|
||||
116 118 |
|
||||
117 119 |
|
||||
|
||||
B006_B008.py:239:20: B006 [*] Do not use mutable data structures for argument defaults
|
||||
|
|
||||
237 | # B006 and B008
|
||||
238 | # We should handle arbitrary nesting of these B008.
|
||||
239 | def nested_combo(a=[float(3), dt.datetime.now()]):
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ B006
|
||||
240 | pass
|
||||
|
|
||||
= help: Replace with `None`; initialize within function
|
||||
|
||||
ℹ Possible fix
|
||||
236 236 |
|
||||
237 237 | # B006 and B008
|
||||
238 238 | # We should handle arbitrary nesting of these B008.
|
||||
239 |-def nested_combo(a=[float(3), dt.datetime.now()]):
|
||||
239 |+def nested_combo(a=None):
|
||||
240 |+ if a is None:
|
||||
241 |+ a = [float(3), dt.datetime.now()]
|
||||
240 242 | pass
|
||||
241 243 |
|
||||
242 244 |
|
||||
|
||||
B006_B008.py:276:27: B006 [*] Do not use mutable data structures for argument defaults
|
||||
|
|
||||
275 | def mutable_annotations(
|
||||
276 | a: list[int] | None = [],
|
||||
| ^^ B006
|
||||
277 | b: Optional[Dict[int, int]] = {},
|
||||
278 | c: Annotated[Union[Set[str], abc.Sized], "annotation"] = set(),
|
||||
|
|
||||
= help: Replace with `None`; initialize within function
|
||||
|
||||
ℹ Possible fix
|
||||
273 273 |
|
||||
274 274 |
|
||||
275 275 | def mutable_annotations(
|
||||
276 |- a: list[int] | None = [],
|
||||
276 |+ a: list[int] | None = None,
|
||||
277 277 | b: Optional[Dict[int, int]] = {},
|
||||
278 278 | c: Annotated[Union[Set[str], abc.Sized], "annotation"] = set(),
|
||||
279 279 | d: typing_extensions.Annotated[Union[Set[str], abc.Sized], "annotation"] = set(),
|
||||
280 280 | ):
|
||||
281 |+ if a is None:
|
||||
282 |+ a = []
|
||||
281 283 | pass
|
||||
282 284 |
|
||||
283 285 |
|
||||
|
||||
B006_B008.py:277:35: B006 [*] Do not use mutable data structures for argument defaults
|
||||
|
|
||||
275 | def mutable_annotations(
|
||||
276 | a: list[int] | None = [],
|
||||
277 | b: Optional[Dict[int, int]] = {},
|
||||
| ^^ B006
|
||||
278 | c: Annotated[Union[Set[str], abc.Sized], "annotation"] = set(),
|
||||
279 | d: typing_extensions.Annotated[Union[Set[str], abc.Sized], "annotation"] = set(),
|
||||
|
|
||||
= help: Replace with `None`; initialize within function
|
||||
|
||||
ℹ Possible fix
|
||||
274 274 |
|
||||
275 275 | def mutable_annotations(
|
||||
276 276 | a: list[int] | None = [],
|
||||
277 |- b: Optional[Dict[int, int]] = {},
|
||||
277 |+ b: Optional[Dict[int, int]] = None,
|
||||
278 278 | c: Annotated[Union[Set[str], abc.Sized], "annotation"] = set(),
|
||||
279 279 | d: typing_extensions.Annotated[Union[Set[str], abc.Sized], "annotation"] = set(),
|
||||
280 280 | ):
|
||||
281 |+ if b is None:
|
||||
282 |+ b = {}
|
||||
281 283 | pass
|
||||
282 284 |
|
||||
283 285 |
|
||||
|
||||
B006_B008.py:278:62: B006 [*] Do not use mutable data structures for argument defaults
|
||||
|
|
||||
276 | a: list[int] | None = [],
|
||||
277 | b: Optional[Dict[int, int]] = {},
|
||||
278 | c: Annotated[Union[Set[str], abc.Sized], "annotation"] = set(),
|
||||
| ^^^^^ B006
|
||||
279 | d: typing_extensions.Annotated[Union[Set[str], abc.Sized], "annotation"] = set(),
|
||||
280 | ):
|
||||
|
|
||||
= help: Replace with `None`; initialize within function
|
||||
|
||||
ℹ Possible fix
|
||||
275 275 | def mutable_annotations(
|
||||
276 276 | a: list[int] | None = [],
|
||||
277 277 | b: Optional[Dict[int, int]] = {},
|
||||
278 |- c: Annotated[Union[Set[str], abc.Sized], "annotation"] = set(),
|
||||
278 |+ c: Annotated[Union[Set[str], abc.Sized], "annotation"] = None,
|
||||
279 279 | d: typing_extensions.Annotated[Union[Set[str], abc.Sized], "annotation"] = set(),
|
||||
280 280 | ):
|
||||
281 |+ if c is None:
|
||||
282 |+ c = set()
|
||||
281 283 | pass
|
||||
282 284 |
|
||||
283 285 |
|
||||
|
||||
B006_B008.py:279:80: B006 [*] Do not use mutable data structures for argument defaults
|
||||
|
|
||||
277 | b: Optional[Dict[int, int]] = {},
|
||||
278 | c: Annotated[Union[Set[str], abc.Sized], "annotation"] = set(),
|
||||
279 | d: typing_extensions.Annotated[Union[Set[str], abc.Sized], "annotation"] = set(),
|
||||
| ^^^^^ B006
|
||||
280 | ):
|
||||
281 | pass
|
||||
|
|
||||
= help: Replace with `None`; initialize within function
|
||||
|
||||
ℹ Possible fix
|
||||
276 276 | a: list[int] | None = [],
|
||||
277 277 | b: Optional[Dict[int, int]] = {},
|
||||
278 278 | c: Annotated[Union[Set[str], abc.Sized], "annotation"] = set(),
|
||||
279 |- d: typing_extensions.Annotated[Union[Set[str], abc.Sized], "annotation"] = set(),
|
||||
279 |+ d: typing_extensions.Annotated[Union[Set[str], abc.Sized], "annotation"] = None,
|
||||
280 280 | ):
|
||||
281 |+ if d is None:
|
||||
282 |+ d = set()
|
||||
281 283 | pass
|
||||
282 284 |
|
||||
283 285 |
|
||||
|
||||
B006_B008.py:284:52: B006 [*] Do not use mutable data structures for argument defaults
|
||||
|
|
||||
284 | def single_line_func_wrong(value: dict[str, str] = {}):
|
||||
| ^^ B006
|
||||
285 | """Docstring"""
|
||||
|
|
||||
= help: Replace with `None`; initialize within function
|
||||
|
||||
ℹ Possible fix
|
||||
281 281 | pass
|
||||
282 282 |
|
||||
283 283 |
|
||||
284 |-def single_line_func_wrong(value: dict[str, str] = {}):
|
||||
284 |+def single_line_func_wrong(value: dict[str, str] = None):
|
||||
285 285 | """Docstring"""
|
||||
286 |+ if value is None:
|
||||
287 |+ value = {}
|
||||
286 288 |
|
||||
287 289 |
|
||||
288 290 | def single_line_func_wrong(value: dict[str, str] = {}):
|
||||
|
||||
B006_B008.py:288:52: B006 [*] Do not use mutable data structures for argument defaults
|
||||
|
|
||||
288 | def single_line_func_wrong(value: dict[str, str] = {}):
|
||||
| ^^ B006
|
||||
289 | """Docstring"""
|
||||
290 | ...
|
||||
|
|
||||
= help: Replace with `None`; initialize within function
|
||||
|
||||
ℹ Possible fix
|
||||
285 285 | """Docstring"""
|
||||
286 286 |
|
||||
287 287 |
|
||||
288 |-def single_line_func_wrong(value: dict[str, str] = {}):
|
||||
288 |+def single_line_func_wrong(value: dict[str, str] = None):
|
||||
289 289 | """Docstring"""
|
||||
290 |+ if value is None:
|
||||
291 |+ value = {}
|
||||
290 292 | ...
|
||||
291 293 |
|
||||
292 294 |
|
||||
|
||||
B006_B008.py:293:52: B006 Do not use mutable data structures for argument defaults
|
||||
|
|
||||
293 | def single_line_func_wrong(value: dict[str, str] = {}):
|
||||
| ^^ B006
|
||||
294 | """Docstring"""; ...
|
||||
|
|
||||
= help: Replace with `None`; initialize within function
|
||||
|
||||
B006_B008.py:297:52: B006 Do not use mutable data structures for argument defaults
|
||||
|
|
||||
297 | def single_line_func_wrong(value: dict[str, str] = {}):
|
||||
| ^^ B006
|
||||
298 | """Docstring"""; \
|
||||
299 | ...
|
||||
|
|
||||
= help: Replace with `None`; initialize within function
|
||||
|
||||
B006_B008.py:302:52: B006 [*] Do not use mutable data structures for argument defaults
|
||||
|
|
||||
302 | def single_line_func_wrong(value: dict[str, str] = {
|
||||
| ____________________________________________________^
|
||||
303 | | # This is a comment
|
||||
304 | | }):
|
||||
| |_^ B006
|
||||
305 | """Docstring"""
|
||||
|
|
||||
= help: Replace with `None`; initialize within function
|
||||
|
||||
ℹ Possible fix
|
||||
299 299 | ...
|
||||
300 300 |
|
||||
301 301 |
|
||||
302 |-def single_line_func_wrong(value: dict[str, str] = {
|
||||
303 |- # This is a comment
|
||||
304 |-}):
|
||||
302 |+def single_line_func_wrong(value: dict[str, str] = None):
|
||||
305 303 | """Docstring"""
|
||||
304 |+ if value is None:
|
||||
305 |+ value = {}
|
||||
306 306 |
|
||||
307 307 |
|
||||
308 308 | def single_line_func_wrong(value: dict[str, str] = {}) \
|
||||
|
||||
B006_B008.py:308:52: B006 Do not use mutable data structures for argument defaults
|
||||
|
|
||||
308 | def single_line_func_wrong(value: dict[str, str] = {}) \
|
||||
| ^^ B006
|
||||
309 | : \
|
||||
310 | """Docstring"""
|
||||
|
|
||||
= help: Replace with `None`; initialize within function
|
||||
|
||||
B006_B008.py:313:52: B006 [*] Do not use mutable data structures for argument defaults
|
||||
|
|
||||
313 | def single_line_func_wrong(value: dict[str, str] = {}):
|
||||
| ^^ B006
|
||||
314 | """Docstring without newline"""
|
||||
|
|
||||
= help: Replace with `None`; initialize within function
|
||||
|
||||
ℹ Possible fix
|
||||
310 310 | """Docstring"""
|
||||
311 311 |
|
||||
312 312 |
|
||||
313 |-def single_line_func_wrong(value: dict[str, str] = {}):
|
||||
314 |- """Docstring without newline"""
|
||||
313 |+def single_line_func_wrong(value: dict[str, str] = None):
|
||||
314 |+ """Docstring without newline"""
|
||||
315 |+ if value is None:
|
||||
316 |+ value = {}
|
||||
|
||||
|
|
@ -1,186 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/flake8_bugbear/mod.rs
|
||||
---
|
||||
B007.py:6:5: B007 Loop control variable `i` not used within loop body
|
||||
|
|
||||
4 | print(i) # name no longer defined on Python 3; no warning yet
|
||||
5 |
|
||||
6 | for i in range(10): # name not used within the loop; B007
|
||||
| ^ B007
|
||||
7 | print(10)
|
||||
|
|
||||
= help: Rename unused `i` to `_i`
|
||||
|
||||
B007.py:18:13: B007 [*] Loop control variable `k` not used within loop body
|
||||
|
|
||||
16 | for i in range(10):
|
||||
17 | for j in range(10):
|
||||
18 | for k in range(10): # k not used, i and j used transitively
|
||||
| ^ B007
|
||||
19 | print(i + j)
|
||||
|
|
||||
= help: Rename unused `k` to `_k`
|
||||
|
||||
ℹ Suggested fix
|
||||
15 15 |
|
||||
16 16 | for i in range(10):
|
||||
17 17 | for j in range(10):
|
||||
18 |- for k in range(10): # k not used, i and j used transitively
|
||||
18 |+ for _k in range(10): # k not used, i and j used transitively
|
||||
19 19 | print(i + j)
|
||||
20 20 |
|
||||
21 21 |
|
||||
|
||||
B007.py:30:5: B007 Loop control variable `i` not used within loop body
|
||||
|
|
||||
30 | for i, (j, (k, l)) in strange_generator(): # i, k not used
|
||||
| ^ B007
|
||||
31 | print(j, l)
|
||||
|
|
||||
= help: Rename unused `i` to `_i`
|
||||
|
||||
B007.py:30:13: B007 [*] Loop control variable `k` not used within loop body
|
||||
|
|
||||
30 | for i, (j, (k, l)) in strange_generator(): # i, k not used
|
||||
| ^ B007
|
||||
31 | print(j, l)
|
||||
|
|
||||
= help: Rename unused `k` to `_k`
|
||||
|
||||
ℹ Suggested fix
|
||||
27 27 | yield i, (j, (k, l))
|
||||
28 28 |
|
||||
29 29 |
|
||||
30 |-for i, (j, (k, l)) in strange_generator(): # i, k not used
|
||||
30 |+for i, (j, (_k, l)) in strange_generator(): # i, k not used
|
||||
31 31 | print(j, l)
|
||||
32 32 |
|
||||
33 33 | FMT = "{foo} {bar}"
|
||||
|
||||
B007.py:34:10: B007 Loop control variable `bar` may not be used within loop body
|
||||
|
|
||||
33 | FMT = "{foo} {bar}"
|
||||
34 | for foo, bar in [(1, 2)]:
|
||||
| ^^^ B007
|
||||
35 | if foo:
|
||||
36 | print(FMT.format(**locals()))
|
||||
|
|
||||
= help: Rename unused `bar` to `_bar`
|
||||
|
||||
B007.py:38:10: B007 Loop control variable `bar` may not be used within loop body
|
||||
|
|
||||
36 | print(FMT.format(**locals()))
|
||||
37 |
|
||||
38 | for foo, bar in [(1, 2)]:
|
||||
| ^^^ B007
|
||||
39 | if foo:
|
||||
40 | print(FMT.format(**globals()))
|
||||
|
|
||||
= help: Rename unused `bar` to `_bar`
|
||||
|
||||
B007.py:42:10: B007 Loop control variable `bar` may not be used within loop body
|
||||
|
|
||||
40 | print(FMT.format(**globals()))
|
||||
41 |
|
||||
42 | for foo, bar in [(1, 2)]:
|
||||
| ^^^ B007
|
||||
43 | if foo:
|
||||
44 | print(FMT.format(**vars()))
|
||||
|
|
||||
= help: Rename unused `bar` to `_bar`
|
||||
|
||||
B007.py:46:10: B007 Loop control variable `bar` may not be used within loop body
|
||||
|
|
||||
44 | print(FMT.format(**vars()))
|
||||
45 |
|
||||
46 | for foo, bar in [(1, 2)]:
|
||||
| ^^^ B007
|
||||
47 | print(FMT.format(foo=foo, bar=eval("bar")))
|
||||
|
|
||||
= help: Rename unused `bar` to `_bar`
|
||||
|
||||
B007.py:52:14: B007 [*] Loop control variable `bar` not used within loop body
|
||||
|
|
||||
50 | def f():
|
||||
51 | # Fixable.
|
||||
52 | for foo, bar, baz in (["1", "2", "3"],):
|
||||
| ^^^ B007
|
||||
53 | if foo or baz:
|
||||
54 | break
|
||||
|
|
||||
= help: Rename unused `bar` to `_bar`
|
||||
|
||||
ℹ Suggested fix
|
||||
49 49 |
|
||||
50 50 | def f():
|
||||
51 51 | # Fixable.
|
||||
52 |- for foo, bar, baz in (["1", "2", "3"],):
|
||||
52 |+ for foo, _bar, baz in (["1", "2", "3"],):
|
||||
53 53 | if foo or baz:
|
||||
54 54 | break
|
||||
55 55 |
|
||||
|
||||
B007.py:59:14: B007 Loop control variable `bar` not used within loop body
|
||||
|
|
||||
57 | def f():
|
||||
58 | # Unfixable due to usage of `bar` outside of loop.
|
||||
59 | for foo, bar, baz in (["1", "2", "3"],):
|
||||
| ^^^ B007
|
||||
60 | if foo or baz:
|
||||
61 | break
|
||||
|
|
||||
= help: Rename unused `bar` to `_bar`
|
||||
|
||||
B007.py:68:14: B007 [*] Loop control variable `bar` not used within loop body
|
||||
|
|
||||
66 | def f():
|
||||
67 | # Fixable.
|
||||
68 | for foo, bar, baz in (["1", "2", "3"],):
|
||||
| ^^^ B007
|
||||
69 | if foo or baz:
|
||||
70 | break
|
||||
|
|
||||
= help: Rename unused `bar` to `_bar`
|
||||
|
||||
ℹ Suggested fix
|
||||
65 65 |
|
||||
66 66 | def f():
|
||||
67 67 | # Fixable.
|
||||
68 |- for foo, bar, baz in (["1", "2", "3"],):
|
||||
68 |+ for foo, _bar, baz in (["1", "2", "3"],):
|
||||
69 69 | if foo or baz:
|
||||
70 70 | break
|
||||
71 71 |
|
||||
|
||||
B007.py:77:14: B007 Loop control variable `bar` not used within loop body
|
||||
|
|
||||
75 | def f():
|
||||
76 | # Unfixable.
|
||||
77 | for foo, bar, baz in (["1", "2", "3"],):
|
||||
| ^^^ B007
|
||||
78 | if foo or baz:
|
||||
79 | break
|
||||
|
|
||||
= help: Rename unused `bar` to `_bar`
|
||||
|
||||
B007.py:88:14: B007 Loop control variable `bar` not used within loop body
|
||||
|
|
||||
86 | def f():
|
||||
87 | # Unfixable (false negative) due to usage of `bar` outside of loop.
|
||||
88 | for foo, bar, baz in (["1", "2", "3"],):
|
||||
| ^^^ B007
|
||||
89 | if foo or baz:
|
||||
90 | break
|
||||
|
|
||||
= help: Rename unused `bar` to `_bar`
|
||||
|
||||
B007.py:98:5: B007 Loop control variable `line_` not used within loop body
|
||||
|
|
||||
96 | # Unfixable due to trailing underscore (`_line_` wouldn't be considered an ignorable
|
||||
97 | # variable name).
|
||||
98 | for line_ in range(self.header_lines):
|
||||
| ^^^^^ B007
|
||||
99 | fp.readline()
|
||||
|
|
||||
|
||||
|
|
@ -1,83 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/flake8_bugbear/mod.rs
|
||||
---
|
||||
B006_B008.py:102:61: B008 Do not perform function call `range` in argument defaults
|
||||
|
|
||||
101 | # N.B. we're also flagging the function call in the comprehension
|
||||
102 | def list_comprehension_also_not_okay(default=[i**2 for i in range(3)]):
|
||||
| ^^^^^^^^ B008
|
||||
103 | pass
|
||||
|
|
||||
|
||||
B006_B008.py:106:64: B008 Do not perform function call `range` in argument defaults
|
||||
|
|
||||
106 | def dict_comprehension_also_not_okay(default={i: i**2 for i in range(3)}):
|
||||
| ^^^^^^^^ B008
|
||||
107 | pass
|
||||
|
|
||||
|
||||
B006_B008.py:110:60: B008 Do not perform function call `range` in argument defaults
|
||||
|
|
||||
110 | def set_comprehension_also_not_okay(default={i**2 for i in range(3)}):
|
||||
| ^^^^^^^^ B008
|
||||
111 | pass
|
||||
|
|
||||
|
||||
B006_B008.py:126:39: B008 Do not perform function call `time.time` in argument defaults
|
||||
|
|
||||
124 | # B008
|
||||
125 | # Flag function calls as default args (including if they are part of a sub-expression)
|
||||
126 | def in_fact_all_calls_are_wrong(value=time.time()):
|
||||
| ^^^^^^^^^^^ B008
|
||||
127 | ...
|
||||
|
|
||||
|
||||
B006_B008.py:130:12: B008 Do not perform function call `dt.datetime.now` in argument defaults
|
||||
|
|
||||
130 | def f(when=dt.datetime.now() + dt.timedelta(days=7)):
|
||||
| ^^^^^^^^^^^^^^^^^ B008
|
||||
131 | pass
|
||||
|
|
||||
|
||||
B006_B008.py:134:30: B008 Do not perform function call in argument defaults
|
||||
|
|
||||
134 | def can_even_catch_lambdas(a=(lambda x: x)()):
|
||||
| ^^^^^^^^^^^^^^^ B008
|
||||
135 | ...
|
||||
|
|
||||
|
||||
B006_B008.py:239:31: B008 Do not perform function call `dt.datetime.now` in argument defaults
|
||||
|
|
||||
237 | # B006 and B008
|
||||
238 | # We should handle arbitrary nesting of these B008.
|
||||
239 | def nested_combo(a=[float(3), dt.datetime.now()]):
|
||||
| ^^^^^^^^^^^^^^^^^ B008
|
||||
240 | pass
|
||||
|
|
||||
|
||||
B006_B008.py:245:22: B008 Do not perform function call `map` in argument defaults
|
||||
|
|
||||
243 | # Don't flag nested B006 since we can't guarantee that
|
||||
244 | # it isn't made mutable by the outer operation.
|
||||
245 | def no_nested_b006(a=map(lambda s: s.upper(), ["a", "b", "c"])):
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ B008
|
||||
246 | pass
|
||||
|
|
||||
|
||||
B006_B008.py:250:19: B008 Do not perform function call `random.randint` in argument defaults
|
||||
|
|
||||
249 | # B008-ception.
|
||||
250 | def nested_b008(a=random.randint(0, dt.datetime.now().year)):
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ B008
|
||||
251 | pass
|
||||
|
|
||||
|
||||
B006_B008.py:250:37: B008 Do not perform function call `dt.datetime.now` in argument defaults
|
||||
|
|
||||
249 | # B008-ception.
|
||||
250 | def nested_b008(a=random.randint(0, dt.datetime.now().year)):
|
||||
| ^^^^^^^^^^^^^^^^^ B008
|
||||
251 | pass
|
||||
|
|
||||
|
||||
|
|
@ -1,334 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/flake8_bugbear/mod.rs
|
||||
---
|
||||
B009_B010.py:19:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
|
||||
|
|
||||
18 | # Invalid usage
|
||||
19 | getattr(foo, "bar")
|
||||
| ^^^^^^^^^^^^^^^^^^^ B009
|
||||
20 | getattr(foo, "_123abc")
|
||||
21 | getattr(foo, "__123abc__")
|
||||
|
|
||||
= help: Replace `getattr` with attribute access
|
||||
|
||||
ℹ Suggested fix
|
||||
16 16 | getattr(foo, "__123abc")
|
||||
17 17 |
|
||||
18 18 | # Invalid usage
|
||||
19 |-getattr(foo, "bar")
|
||||
19 |+foo.bar
|
||||
20 20 | getattr(foo, "_123abc")
|
||||
21 21 | getattr(foo, "__123abc__")
|
||||
22 22 | getattr(foo, "abc123")
|
||||
|
||||
B009_B010.py:20:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
|
||||
|
|
||||
18 | # Invalid usage
|
||||
19 | getattr(foo, "bar")
|
||||
20 | getattr(foo, "_123abc")
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ B009
|
||||
21 | getattr(foo, "__123abc__")
|
||||
22 | getattr(foo, "abc123")
|
||||
|
|
||||
= help: Replace `getattr` with attribute access
|
||||
|
||||
ℹ Suggested fix
|
||||
17 17 |
|
||||
18 18 | # Invalid usage
|
||||
19 19 | getattr(foo, "bar")
|
||||
20 |-getattr(foo, "_123abc")
|
||||
20 |+foo._123abc
|
||||
21 21 | getattr(foo, "__123abc__")
|
||||
22 22 | getattr(foo, "abc123")
|
||||
23 23 | getattr(foo, r"abc123")
|
||||
|
||||
B009_B010.py:21:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
|
||||
|
|
||||
19 | getattr(foo, "bar")
|
||||
20 | getattr(foo, "_123abc")
|
||||
21 | getattr(foo, "__123abc__")
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ B009
|
||||
22 | getattr(foo, "abc123")
|
||||
23 | getattr(foo, r"abc123")
|
||||
|
|
||||
= help: Replace `getattr` with attribute access
|
||||
|
||||
ℹ Suggested fix
|
||||
18 18 | # Invalid usage
|
||||
19 19 | getattr(foo, "bar")
|
||||
20 20 | getattr(foo, "_123abc")
|
||||
21 |-getattr(foo, "__123abc__")
|
||||
21 |+foo.__123abc__
|
||||
22 22 | getattr(foo, "abc123")
|
||||
23 23 | getattr(foo, r"abc123")
|
||||
24 24 | _ = lambda x: getattr(x, "bar")
|
||||
|
||||
B009_B010.py:22:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
|
||||
|
|
||||
20 | getattr(foo, "_123abc")
|
||||
21 | getattr(foo, "__123abc__")
|
||||
22 | getattr(foo, "abc123")
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ B009
|
||||
23 | getattr(foo, r"abc123")
|
||||
24 | _ = lambda x: getattr(x, "bar")
|
||||
|
|
||||
= help: Replace `getattr` with attribute access
|
||||
|
||||
ℹ Suggested fix
|
||||
19 19 | getattr(foo, "bar")
|
||||
20 20 | getattr(foo, "_123abc")
|
||||
21 21 | getattr(foo, "__123abc__")
|
||||
22 |-getattr(foo, "abc123")
|
||||
22 |+foo.abc123
|
||||
23 23 | getattr(foo, r"abc123")
|
||||
24 24 | _ = lambda x: getattr(x, "bar")
|
||||
25 25 | if getattr(x, "bar"):
|
||||
|
||||
B009_B010.py:23:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
|
||||
|
|
||||
21 | getattr(foo, "__123abc__")
|
||||
22 | getattr(foo, "abc123")
|
||||
23 | getattr(foo, r"abc123")
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ B009
|
||||
24 | _ = lambda x: getattr(x, "bar")
|
||||
25 | if getattr(x, "bar"):
|
||||
|
|
||||
= help: Replace `getattr` with attribute access
|
||||
|
||||
ℹ Suggested fix
|
||||
20 20 | getattr(foo, "_123abc")
|
||||
21 21 | getattr(foo, "__123abc__")
|
||||
22 22 | getattr(foo, "abc123")
|
||||
23 |-getattr(foo, r"abc123")
|
||||
23 |+foo.abc123
|
||||
24 24 | _ = lambda x: getattr(x, "bar")
|
||||
25 25 | if getattr(x, "bar"):
|
||||
26 26 | pass
|
||||
|
||||
B009_B010.py:24:15: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
|
||||
|
|
||||
22 | getattr(foo, "abc123")
|
||||
23 | getattr(foo, r"abc123")
|
||||
24 | _ = lambda x: getattr(x, "bar")
|
||||
| ^^^^^^^^^^^^^^^^^ B009
|
||||
25 | if getattr(x, "bar"):
|
||||
26 | pass
|
||||
|
|
||||
= help: Replace `getattr` with attribute access
|
||||
|
||||
ℹ Suggested fix
|
||||
21 21 | getattr(foo, "__123abc__")
|
||||
22 22 | getattr(foo, "abc123")
|
||||
23 23 | getattr(foo, r"abc123")
|
||||
24 |-_ = lambda x: getattr(x, "bar")
|
||||
24 |+_ = lambda x: x.bar
|
||||
25 25 | if getattr(x, "bar"):
|
||||
26 26 | pass
|
||||
27 27 | getattr(1, "real")
|
||||
|
||||
B009_B010.py:25:4: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
|
||||
|
|
||||
23 | getattr(foo, r"abc123")
|
||||
24 | _ = lambda x: getattr(x, "bar")
|
||||
25 | if getattr(x, "bar"):
|
||||
| ^^^^^^^^^^^^^^^^^ B009
|
||||
26 | pass
|
||||
27 | getattr(1, "real")
|
||||
|
|
||||
= help: Replace `getattr` with attribute access
|
||||
|
||||
ℹ Suggested fix
|
||||
22 22 | getattr(foo, "abc123")
|
||||
23 23 | getattr(foo, r"abc123")
|
||||
24 24 | _ = lambda x: getattr(x, "bar")
|
||||
25 |-if getattr(x, "bar"):
|
||||
25 |+if x.bar:
|
||||
26 26 | pass
|
||||
27 27 | getattr(1, "real")
|
||||
28 28 | getattr(1., "real")
|
||||
|
||||
B009_B010.py:27:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
|
||||
|
|
||||
25 | if getattr(x, "bar"):
|
||||
26 | pass
|
||||
27 | getattr(1, "real")
|
||||
| ^^^^^^^^^^^^^^^^^^ B009
|
||||
28 | getattr(1., "real")
|
||||
29 | getattr(1.0, "real")
|
||||
|
|
||||
= help: Replace `getattr` with attribute access
|
||||
|
||||
ℹ Suggested fix
|
||||
24 24 | _ = lambda x: getattr(x, "bar")
|
||||
25 25 | if getattr(x, "bar"):
|
||||
26 26 | pass
|
||||
27 |-getattr(1, "real")
|
||||
27 |+(1).real
|
||||
28 28 | getattr(1., "real")
|
||||
29 29 | getattr(1.0, "real")
|
||||
30 30 | getattr(1j, "real")
|
||||
|
||||
B009_B010.py:28:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
|
||||
|
|
||||
26 | pass
|
||||
27 | getattr(1, "real")
|
||||
28 | getattr(1., "real")
|
||||
| ^^^^^^^^^^^^^^^^^^^ B009
|
||||
29 | getattr(1.0, "real")
|
||||
30 | getattr(1j, "real")
|
||||
|
|
||||
= help: Replace `getattr` with attribute access
|
||||
|
||||
ℹ Suggested fix
|
||||
25 25 | if getattr(x, "bar"):
|
||||
26 26 | pass
|
||||
27 27 | getattr(1, "real")
|
||||
28 |-getattr(1., "real")
|
||||
28 |+(1.).real
|
||||
29 29 | getattr(1.0, "real")
|
||||
30 30 | getattr(1j, "real")
|
||||
31 31 | getattr(True, "real")
|
||||
|
||||
B009_B010.py:29:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
|
||||
|
|
||||
27 | getattr(1, "real")
|
||||
28 | getattr(1., "real")
|
||||
29 | getattr(1.0, "real")
|
||||
| ^^^^^^^^^^^^^^^^^^^^ B009
|
||||
30 | getattr(1j, "real")
|
||||
31 | getattr(True, "real")
|
||||
|
|
||||
= help: Replace `getattr` with attribute access
|
||||
|
||||
ℹ Suggested fix
|
||||
26 26 | pass
|
||||
27 27 | getattr(1, "real")
|
||||
28 28 | getattr(1., "real")
|
||||
29 |-getattr(1.0, "real")
|
||||
29 |+(1.0).real
|
||||
30 30 | getattr(1j, "real")
|
||||
31 31 | getattr(True, "real")
|
||||
32 32 | getattr(x := 1, "real")
|
||||
|
||||
B009_B010.py:30:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
|
||||
|
|
||||
28 | getattr(1., "real")
|
||||
29 | getattr(1.0, "real")
|
||||
30 | getattr(1j, "real")
|
||||
| ^^^^^^^^^^^^^^^^^^^ B009
|
||||
31 | getattr(True, "real")
|
||||
32 | getattr(x := 1, "real")
|
||||
|
|
||||
= help: Replace `getattr` with attribute access
|
||||
|
||||
ℹ Suggested fix
|
||||
27 27 | getattr(1, "real")
|
||||
28 28 | getattr(1., "real")
|
||||
29 29 | getattr(1.0, "real")
|
||||
30 |-getattr(1j, "real")
|
||||
30 |+(1j).real
|
||||
31 31 | getattr(True, "real")
|
||||
32 32 | getattr(x := 1, "real")
|
||||
33 33 | getattr(x + y, "real")
|
||||
|
||||
B009_B010.py:31:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
|
||||
|
|
||||
29 | getattr(1.0, "real")
|
||||
30 | getattr(1j, "real")
|
||||
31 | getattr(True, "real")
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ B009
|
||||
32 | getattr(x := 1, "real")
|
||||
33 | getattr(x + y, "real")
|
||||
|
|
||||
= help: Replace `getattr` with attribute access
|
||||
|
||||
ℹ Suggested fix
|
||||
28 28 | getattr(1., "real")
|
||||
29 29 | getattr(1.0, "real")
|
||||
30 30 | getattr(1j, "real")
|
||||
31 |-getattr(True, "real")
|
||||
31 |+(True).real
|
||||
32 32 | getattr(x := 1, "real")
|
||||
33 33 | getattr(x + y, "real")
|
||||
34 34 | getattr("foo"
|
||||
|
||||
B009_B010.py:32:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
|
||||
|
|
||||
30 | getattr(1j, "real")
|
||||
31 | getattr(True, "real")
|
||||
32 | getattr(x := 1, "real")
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ B009
|
||||
33 | getattr(x + y, "real")
|
||||
34 | getattr("foo"
|
||||
|
|
||||
= help: Replace `getattr` with attribute access
|
||||
|
||||
ℹ Suggested fix
|
||||
29 29 | getattr(1.0, "real")
|
||||
30 30 | getattr(1j, "real")
|
||||
31 31 | getattr(True, "real")
|
||||
32 |-getattr(x := 1, "real")
|
||||
32 |+(x := 1).real
|
||||
33 33 | getattr(x + y, "real")
|
||||
34 34 | getattr("foo"
|
||||
35 35 | "bar", "real")
|
||||
|
||||
B009_B010.py:33:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
|
||||
|
|
||||
31 | getattr(True, "real")
|
||||
32 | getattr(x := 1, "real")
|
||||
33 | getattr(x + y, "real")
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ B009
|
||||
34 | getattr("foo"
|
||||
35 | "bar", "real")
|
||||
|
|
||||
= help: Replace `getattr` with attribute access
|
||||
|
||||
ℹ Suggested fix
|
||||
30 30 | getattr(1j, "real")
|
||||
31 31 | getattr(True, "real")
|
||||
32 32 | getattr(x := 1, "real")
|
||||
33 |-getattr(x + y, "real")
|
||||
33 |+(x + y).real
|
||||
34 34 | getattr("foo"
|
||||
35 35 | "bar", "real")
|
||||
36 36 |
|
||||
|
||||
B009_B010.py:34:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
|
||||
|
|
||||
32 | getattr(x := 1, "real")
|
||||
33 | getattr(x + y, "real")
|
||||
34 | / getattr("foo"
|
||||
35 | | "bar", "real")
|
||||
| |______________________^ B009
|
||||
|
|
||||
= help: Replace `getattr` with attribute access
|
||||
|
||||
ℹ Suggested fix
|
||||
31 31 | getattr(True, "real")
|
||||
32 32 | getattr(x := 1, "real")
|
||||
33 33 | getattr(x + y, "real")
|
||||
34 |-getattr("foo"
|
||||
35 |- "bar", "real")
|
||||
34 |+("foo"
|
||||
35 |+ "bar").real
|
||||
36 36 |
|
||||
37 37 |
|
||||
38 38 | # Valid setattr usage
|
||||
|
||||
B009_B010.py:58:8: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
|
||||
|
|
||||
57 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1722458885
|
||||
58 | assert getattr(func, '_rpc')is True
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ B009
|
||||
|
|
||||
= help: Replace `getattr` with attribute access
|
||||
|
||||
ℹ Suggested fix
|
||||
55 55 | setattr(foo.bar, r"baz", None)
|
||||
56 56 |
|
||||
57 57 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1722458885
|
||||
58 |-assert getattr(func, '_rpc')is True
|
||||
58 |+assert func._rpc is True
|
||||
|
||||
|
|
@ -1,128 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/flake8_bugbear/mod.rs
|
||||
---
|
||||
B009_B010.py:50:1: B010 [*] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access.
|
||||
|
|
||||
49 | # Invalid usage
|
||||
50 | setattr(foo, "bar", None)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ B010
|
||||
51 | setattr(foo, "_123abc", None)
|
||||
52 | setattr(foo, "__123abc__", None)
|
||||
|
|
||||
= help: Replace `setattr` with assignment
|
||||
|
||||
ℹ Suggested fix
|
||||
47 47 | pass
|
||||
48 48 |
|
||||
49 49 | # Invalid usage
|
||||
50 |-setattr(foo, "bar", None)
|
||||
50 |+foo.bar = None
|
||||
51 51 | setattr(foo, "_123abc", None)
|
||||
52 52 | setattr(foo, "__123abc__", None)
|
||||
53 53 | setattr(foo, "abc123", None)
|
||||
|
||||
B009_B010.py:51:1: B010 [*] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access.
|
||||
|
|
||||
49 | # Invalid usage
|
||||
50 | setattr(foo, "bar", None)
|
||||
51 | setattr(foo, "_123abc", None)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ B010
|
||||
52 | setattr(foo, "__123abc__", None)
|
||||
53 | setattr(foo, "abc123", None)
|
||||
|
|
||||
= help: Replace `setattr` with assignment
|
||||
|
||||
ℹ Suggested fix
|
||||
48 48 |
|
||||
49 49 | # Invalid usage
|
||||
50 50 | setattr(foo, "bar", None)
|
||||
51 |-setattr(foo, "_123abc", None)
|
||||
51 |+foo._123abc = None
|
||||
52 52 | setattr(foo, "__123abc__", None)
|
||||
53 53 | setattr(foo, "abc123", None)
|
||||
54 54 | setattr(foo, r"abc123", None)
|
||||
|
||||
B009_B010.py:52:1: B010 [*] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access.
|
||||
|
|
||||
50 | setattr(foo, "bar", None)
|
||||
51 | setattr(foo, "_123abc", None)
|
||||
52 | setattr(foo, "__123abc__", None)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ B010
|
||||
53 | setattr(foo, "abc123", None)
|
||||
54 | setattr(foo, r"abc123", None)
|
||||
|
|
||||
= help: Replace `setattr` with assignment
|
||||
|
||||
ℹ Suggested fix
|
||||
49 49 | # Invalid usage
|
||||
50 50 | setattr(foo, "bar", None)
|
||||
51 51 | setattr(foo, "_123abc", None)
|
||||
52 |-setattr(foo, "__123abc__", None)
|
||||
52 |+foo.__123abc__ = None
|
||||
53 53 | setattr(foo, "abc123", None)
|
||||
54 54 | setattr(foo, r"abc123", None)
|
||||
55 55 | setattr(foo.bar, r"baz", None)
|
||||
|
||||
B009_B010.py:53:1: B010 [*] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access.
|
||||
|
|
||||
51 | setattr(foo, "_123abc", None)
|
||||
52 | setattr(foo, "__123abc__", None)
|
||||
53 | setattr(foo, "abc123", None)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ B010
|
||||
54 | setattr(foo, r"abc123", None)
|
||||
55 | setattr(foo.bar, r"baz", None)
|
||||
|
|
||||
= help: Replace `setattr` with assignment
|
||||
|
||||
ℹ Suggested fix
|
||||
50 50 | setattr(foo, "bar", None)
|
||||
51 51 | setattr(foo, "_123abc", None)
|
||||
52 52 | setattr(foo, "__123abc__", None)
|
||||
53 |-setattr(foo, "abc123", None)
|
||||
53 |+foo.abc123 = None
|
||||
54 54 | setattr(foo, r"abc123", None)
|
||||
55 55 | setattr(foo.bar, r"baz", None)
|
||||
56 56 |
|
||||
|
||||
B009_B010.py:54:1: B010 [*] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access.
|
||||
|
|
||||
52 | setattr(foo, "__123abc__", None)
|
||||
53 | setattr(foo, "abc123", None)
|
||||
54 | setattr(foo, r"abc123", None)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ B010
|
||||
55 | setattr(foo.bar, r"baz", None)
|
||||
|
|
||||
= help: Replace `setattr` with assignment
|
||||
|
||||
ℹ Suggested fix
|
||||
51 51 | setattr(foo, "_123abc", None)
|
||||
52 52 | setattr(foo, "__123abc__", None)
|
||||
53 53 | setattr(foo, "abc123", None)
|
||||
54 |-setattr(foo, r"abc123", None)
|
||||
54 |+foo.abc123 = None
|
||||
55 55 | setattr(foo.bar, r"baz", None)
|
||||
56 56 |
|
||||
57 57 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1722458885
|
||||
|
||||
B009_B010.py:55:1: B010 [*] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access.
|
||||
|
|
||||
53 | setattr(foo, "abc123", None)
|
||||
54 | setattr(foo, r"abc123", None)
|
||||
55 | setattr(foo.bar, r"baz", None)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ B010
|
||||
56 |
|
||||
57 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1722458885
|
||||
|
|
||||
= help: Replace `setattr` with assignment
|
||||
|
||||
ℹ Suggested fix
|
||||
52 52 | setattr(foo, "__123abc__", None)
|
||||
53 53 | setattr(foo, "abc123", None)
|
||||
54 54 | setattr(foo, r"abc123", None)
|
||||
55 |-setattr(foo.bar, r"baz", None)
|
||||
55 |+foo.bar.baz = None
|
||||
56 56 |
|
||||
57 57 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1722458885
|
||||
58 58 | assert getattr(func, '_rpc')is True
|
||||
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/flake8_bugbear/mod.rs
|
||||
---
|
||||
B011.py:8:8: B011 [*] Do not `assert False` (`python -O` removes these calls), raise `AssertionError()`
|
||||
|
|
||||
7 | assert 1 != 2
|
||||
8 | assert False
|
||||
| ^^^^^ B011
|
||||
9 | assert 1 != 2, "message"
|
||||
10 | assert False, "message"
|
||||
|
|
||||
= help: Replace `assert False`
|
||||
|
||||
ℹ Suggested fix
|
||||
5 5 | """
|
||||
6 6 |
|
||||
7 7 | assert 1 != 2
|
||||
8 |-assert False
|
||||
8 |+raise AssertionError()
|
||||
9 9 | assert 1 != 2, "message"
|
||||
10 10 | assert False, "message"
|
||||
|
||||
B011.py:10:8: B011 [*] Do not `assert False` (`python -O` removes these calls), raise `AssertionError()`
|
||||
|
|
||||
8 | assert False
|
||||
9 | assert 1 != 2, "message"
|
||||
10 | assert False, "message"
|
||||
| ^^^^^ B011
|
||||
|
|
||||
= help: Replace `assert False`
|
||||
|
||||
ℹ Suggested fix
|
||||
7 7 | assert 1 != 2
|
||||
8 8 | assert False
|
||||
9 9 | assert 1 != 2, "message"
|
||||
10 |-assert False, "message"
|
||||
10 |+raise AssertionError("message")
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue