diff --git a/crates/ruff_linter/src/message/mod.rs b/crates/ruff_linter/src/message/mod.rs index 4c6068f376..0c61e220f1 100644 --- a/crates/ruff_linter/src/message/mod.rs +++ b/crates/ruff_linter/src/message/mod.rs @@ -112,10 +112,7 @@ impl Message { .map_or(TextSize::new(0), TextLen::text_len); Message::SyntaxError(SyntaxErrorMessage { - message: format!( - "SyntaxError: {}", - DisplayParseErrorType::new(&parse_error.error) - ), + message: DisplayParseErrorType::new(&parse_error.error).to_string(), range: TextRange::at(parse_error.location.start(), len), file, }) diff --git a/crates/ruff_linter/src/message/snapshots/ruff_linter__message__azure__tests__syntax_errors.snap b/crates/ruff_linter/src/message/snapshots/ruff_linter__message__azure__tests__syntax_errors.snap index 8c57205239..dbb15a7875 100644 --- a/crates/ruff_linter/src/message/snapshots/ruff_linter__message__azure__tests__syntax_errors.snap +++ b/crates/ruff_linter/src/message/snapshots/ruff_linter__message__azure__tests__syntax_errors.snap @@ -2,5 +2,5 @@ source: crates/ruff_linter/src/message/azure.rs expression: content --- -##vso[task.logissue type=error;sourcepath=syntax_errors.py;linenumber=1;columnnumber=15;]SyntaxError: Expected one or more symbol names after import -##vso[task.logissue type=error;sourcepath=syntax_errors.py;linenumber=3;columnnumber=12;]SyntaxError: Expected ')', found newline +##vso[task.logissue type=error;sourcepath=syntax_errors.py;linenumber=1;columnnumber=15;]Expected one or more symbol names after import +##vso[task.logissue type=error;sourcepath=syntax_errors.py;linenumber=3;columnnumber=12;]Expected ')', found newline diff --git a/crates/ruff_linter/src/message/snapshots/ruff_linter__message__github__tests__syntax_errors.snap b/crates/ruff_linter/src/message/snapshots/ruff_linter__message__github__tests__syntax_errors.snap index e7444371c6..43268b48d5 100644 --- a/crates/ruff_linter/src/message/snapshots/ruff_linter__message__github__tests__syntax_errors.snap +++ b/crates/ruff_linter/src/message/snapshots/ruff_linter__message__github__tests__syntax_errors.snap @@ -2,5 +2,5 @@ source: crates/ruff_linter/src/message/github.rs expression: content --- -::error title=Ruff,file=syntax_errors.py,line=1,col=15,endLine=2,endColumn=1::syntax_errors.py:1:15: SyntaxError: Expected one or more symbol names after import -::error title=Ruff,file=syntax_errors.py,line=3,col=12,endLine=4,endColumn=1::syntax_errors.py:3:12: SyntaxError: Expected ')', found newline +::error title=Ruff,file=syntax_errors.py,line=1,col=15,endLine=2,endColumn=1::syntax_errors.py:1:15: Expected one or more symbol names after import +::error title=Ruff,file=syntax_errors.py,line=3,col=12,endLine=4,endColumn=1::syntax_errors.py:3:12: Expected ')', found newline diff --git a/crates/ruff_linter/src/message/snapshots/ruff_linter__message__gitlab__tests__syntax_errors.snap b/crates/ruff_linter/src/message/snapshots/ruff_linter__message__gitlab__tests__syntax_errors.snap index 27c3c4a3ac..c732421deb 100644 --- a/crates/ruff_linter/src/message/snapshots/ruff_linter__message__gitlab__tests__syntax_errors.snap +++ b/crates/ruff_linter/src/message/snapshots/ruff_linter__message__gitlab__tests__syntax_errors.snap @@ -4,7 +4,7 @@ expression: redact_fingerprint(&content) --- [ { - "description": "SyntaxError: Expected one or more symbol names after import", + "description": "Expected one or more symbol names after import", "fingerprint": "", "location": { "lines": { @@ -16,7 +16,7 @@ expression: redact_fingerprint(&content) "severity": "major" }, { - "description": "SyntaxError: Expected ')', found newline", + "description": "Expected ')', found newline", "fingerprint": "", "location": { "lines": { diff --git a/crates/ruff_linter/src/message/snapshots/ruff_linter__message__grouped__tests__syntax_errors.snap b/crates/ruff_linter/src/message/snapshots/ruff_linter__message__grouped__tests__syntax_errors.snap index 17e7e59a3e..64f97bd0d1 100644 --- a/crates/ruff_linter/src/message/snapshots/ruff_linter__message__grouped__tests__syntax_errors.snap +++ b/crates/ruff_linter/src/message/snapshots/ruff_linter__message__grouped__tests__syntax_errors.snap @@ -3,5 +3,5 @@ source: crates/ruff_linter/src/message/grouped.rs expression: content --- syntax_errors.py: - 1:15 SyntaxError: Expected one or more symbol names after import - 3:12 SyntaxError: Expected ')', found newline + 1:15 Expected one or more symbol names after import + 3:12 Expected ')', found newline diff --git a/crates/ruff_linter/src/message/snapshots/ruff_linter__message__json__tests__syntax_errors.snap b/crates/ruff_linter/src/message/snapshots/ruff_linter__message__json__tests__syntax_errors.snap index 1a7fa5b1e4..2a0a9af896 100644 --- a/crates/ruff_linter/src/message/snapshots/ruff_linter__message__json__tests__syntax_errors.snap +++ b/crates/ruff_linter/src/message/snapshots/ruff_linter__message__json__tests__syntax_errors.snap @@ -16,7 +16,7 @@ expression: content "column": 15, "row": 1 }, - "message": "SyntaxError: Expected one or more symbol names after import", + "message": "Expected one or more symbol names after import", "noqa_row": null, "url": null }, @@ -33,7 +33,7 @@ expression: content "column": 12, "row": 3 }, - "message": "SyntaxError: Expected ')', found newline", + "message": "Expected ')', found newline", "noqa_row": null, "url": null } diff --git a/crates/ruff_linter/src/message/snapshots/ruff_linter__message__json_lines__tests__syntax_errors.snap b/crates/ruff_linter/src/message/snapshots/ruff_linter__message__json_lines__tests__syntax_errors.snap index 326913dcdf..bd128b39e8 100644 --- a/crates/ruff_linter/src/message/snapshots/ruff_linter__message__json_lines__tests__syntax_errors.snap +++ b/crates/ruff_linter/src/message/snapshots/ruff_linter__message__json_lines__tests__syntax_errors.snap @@ -2,5 +2,5 @@ source: crates/ruff_linter/src/message/json_lines.rs expression: content --- -{"cell":null,"code":null,"end_location":{"column":1,"row":2},"filename":"syntax_errors.py","fix":null,"location":{"column":15,"row":1},"message":"SyntaxError: Expected one or more symbol names after import","noqa_row":null,"url":null} -{"cell":null,"code":null,"end_location":{"column":1,"row":4},"filename":"syntax_errors.py","fix":null,"location":{"column":12,"row":3},"message":"SyntaxError: Expected ')', found newline","noqa_row":null,"url":null} +{"cell":null,"code":null,"end_location":{"column":1,"row":2},"filename":"syntax_errors.py","fix":null,"location":{"column":15,"row":1},"message":"Expected one or more symbol names after import","noqa_row":null,"url":null} +{"cell":null,"code":null,"end_location":{"column":1,"row":4},"filename":"syntax_errors.py","fix":null,"location":{"column":12,"row":3},"message":"Expected ')', found newline","noqa_row":null,"url":null} diff --git a/crates/ruff_linter/src/message/snapshots/ruff_linter__message__junit__tests__syntax_errors.snap b/crates/ruff_linter/src/message/snapshots/ruff_linter__message__junit__tests__syntax_errors.snap index c8015a9d5e..8af5e2adfc 100644 --- a/crates/ruff_linter/src/message/snapshots/ruff_linter__message__junit__tests__syntax_errors.snap +++ b/crates/ruff_linter/src/message/snapshots/ruff_linter__message__junit__tests__syntax_errors.snap @@ -6,10 +6,10 @@ expression: content - line 1, col 15, SyntaxError: Expected one or more symbol names after import + line 1, col 15, Expected one or more symbol names after import - line 3, col 12, SyntaxError: Expected ')', found newline + line 3, col 12, Expected ')', found newline diff --git a/crates/ruff_linter/src/message/snapshots/ruff_linter__message__pylint__tests__syntax_errors.snap b/crates/ruff_linter/src/message/snapshots/ruff_linter__message__pylint__tests__syntax_errors.snap index bc6b33b48e..ee554f07a4 100644 --- a/crates/ruff_linter/src/message/snapshots/ruff_linter__message__pylint__tests__syntax_errors.snap +++ b/crates/ruff_linter/src/message/snapshots/ruff_linter__message__pylint__tests__syntax_errors.snap @@ -2,5 +2,5 @@ source: crates/ruff_linter/src/message/pylint.rs expression: content --- -syntax_errors.py:1: SyntaxError: Expected one or more symbol names after import -syntax_errors.py:3: SyntaxError: Expected ')', found newline +syntax_errors.py:1: Expected one or more symbol names after import +syntax_errors.py:3: Expected ')', found newline diff --git a/crates/ruff_linter/src/message/snapshots/ruff_linter__message__rdjson__tests__syntax_errors.snap b/crates/ruff_linter/src/message/snapshots/ruff_linter__message__rdjson__tests__syntax_errors.snap index c73c784b19..a919c47d66 100644 --- a/crates/ruff_linter/src/message/snapshots/ruff_linter__message__rdjson__tests__syntax_errors.snap +++ b/crates/ruff_linter/src/message/snapshots/ruff_linter__message__rdjson__tests__syntax_errors.snap @@ -22,7 +22,7 @@ expression: content } } }, - "message": "SyntaxError: Expected one or more symbol names after import" + "message": "Expected one or more symbol names after import" }, { "code": { @@ -42,7 +42,7 @@ expression: content } } }, - "message": "SyntaxError: Expected ')', found newline" + "message": "Expected ')', found newline" } ], "severity": "warning", diff --git a/crates/ruff_linter/src/message/snapshots/ruff_linter__message__text__tests__default.snap b/crates/ruff_linter/src/message/snapshots/ruff_linter__message__text__tests__default.snap index cb8ecd0b41..fc7fb00bcf 100644 --- a/crates/ruff_linter/src/message/snapshots/ruff_linter__message__text__tests__default.snap +++ b/crates/ruff_linter/src/message/snapshots/ruff_linter__message__text__tests__default.snap @@ -2,15 +2,17 @@ source: crates/ruff_linter/src/message/text.rs expression: content --- -error[F401]: fib.py:1:8: `os` imported but unused +error[F401]: 1:8: `os` imported but unused + --> fib.py:1:8 | 1 | import os | ^^ | = help: Remove unused import: `os` -error[F841]: fib.py:6:5: Local variable `x` is assigned to but never used +error[F841]: 6:5: Local variable `x` is assigned to but never used + --> fib.py:6:5 | 4 | def fibonacci(n): 5 | """Compute the nth number in the Fibonacci sequence.""" @@ -20,8 +22,9 @@ error[F841]: fib.py:6:5: Local variable `x` is assigned to but never used 8 | return 0 | = help: Remove assignment to unused variable `x` -error[F821]: undef.py:1:4: Undefined name `a` +error[F821]: 1:4: Undefined name `a` + --> undef.py:1:4 | 1 | if a == 1: pass | ^ diff --git a/crates/ruff_linter/src/message/snapshots/ruff_linter__message__text__tests__fix_status.snap b/crates/ruff_linter/src/message/snapshots/ruff_linter__message__text__tests__fix_status.snap index cb8ecd0b41..fc7fb00bcf 100644 --- a/crates/ruff_linter/src/message/snapshots/ruff_linter__message__text__tests__fix_status.snap +++ b/crates/ruff_linter/src/message/snapshots/ruff_linter__message__text__tests__fix_status.snap @@ -2,15 +2,17 @@ source: crates/ruff_linter/src/message/text.rs expression: content --- -error[F401]: fib.py:1:8: `os` imported but unused +error[F401]: 1:8: `os` imported but unused + --> fib.py:1:8 | 1 | import os | ^^ | = help: Remove unused import: `os` -error[F841]: fib.py:6:5: Local variable `x` is assigned to but never used +error[F841]: 6:5: Local variable `x` is assigned to but never used + --> fib.py:6:5 | 4 | def fibonacci(n): 5 | """Compute the nth number in the Fibonacci sequence.""" @@ -20,8 +22,9 @@ error[F841]: fib.py:6:5: Local variable `x` is assigned to but never used 8 | return 0 | = help: Remove assignment to unused variable `x` -error[F821]: undef.py:1:4: Undefined name `a` +error[F821]: 1:4: Undefined name `a` + --> undef.py:1:4 | 1 | if a == 1: pass | ^ diff --git a/crates/ruff_linter/src/message/snapshots/ruff_linter__message__text__tests__fix_status_unsafe.snap b/crates/ruff_linter/src/message/snapshots/ruff_linter__message__text__tests__fix_status_unsafe.snap index 652e7243e7..7e0befed7f 100644 --- a/crates/ruff_linter/src/message/snapshots/ruff_linter__message__text__tests__fix_status_unsafe.snap +++ b/crates/ruff_linter/src/message/snapshots/ruff_linter__message__text__tests__fix_status_unsafe.snap @@ -2,15 +2,17 @@ source: crates/ruff_linter/src/message/text.rs expression: content --- -error[F401]: fib.py:1:8: [*] `os` imported but unused +error[F401]: 1:8: [*] `os` imported but unused + --> fib.py:1:8 | 1 | import os | ^^ | = help: Remove unused import: `os` -error[F841]: fib.py:6:5: [*] Local variable `x` is assigned to but never used +error[F841]: 6:5: [*] Local variable `x` is assigned to but never used + --> fib.py:6:5 | 4 | def fibonacci(n): 5 | """Compute the nth number in the Fibonacci sequence.""" @@ -20,8 +22,9 @@ error[F841]: fib.py:6:5: [*] Local variable `x` is assigned to but never used 8 | return 0 | = help: Remove assignment to unused variable `x` -error[F821]: undef.py:1:4: Undefined name `a` +error[F821]: 1:4: Undefined name `a` + --> undef.py:1:4 | 1 | if a == 1: pass | ^ diff --git a/crates/ruff_linter/src/message/snapshots/ruff_linter__message__text__tests__notebook_output.snap b/crates/ruff_linter/src/message/snapshots/ruff_linter__message__text__tests__notebook_output.snap index 3f3bcf3652..33f254c2cb 100644 --- a/crates/ruff_linter/src/message/snapshots/ruff_linter__message__text__tests__notebook_output.snap +++ b/crates/ruff_linter/src/message/snapshots/ruff_linter__message__text__tests__notebook_output.snap @@ -2,16 +2,18 @@ source: crates/ruff_linter/src/message/text.rs expression: content --- -error[F401]: notebook.ipynb:cell 1:2:8: [*] `os` imported but unused +error[F401]: cell 1:2:8: [*] `os` imported but unused + --> notebook.ipynb:2:8 | 1 | # cell 1 2 | import os | ^^ | = help: Remove unused import: `os` -error[F401]: notebook.ipynb:cell 2:2:8: [*] `math` imported but unused +error[F401]: cell 2:2:8: [*] `math` imported but unused + --> notebook.ipynb:2:8 | 1 | # cell 2 2 | import math @@ -20,8 +22,9 @@ error[F401]: notebook.ipynb:cell 2:2:8: [*] `math` imported but unused 4 | print('hello world') | = help: Remove unused import: `math` -error[F841]: notebook.ipynb:cell 3:4:5: [*] Local variable `x` is assigned to but never used +error[F841]: cell 3:4:5: [*] Local variable `x` is assigned to but never used + --> notebook.ipynb:4:5 | 2 | def foo(): 3 | print() diff --git a/crates/ruff_linter/src/message/snapshots/ruff_linter__message__text__tests__syntax_errors.snap b/crates/ruff_linter/src/message/snapshots/ruff_linter__message__text__tests__syntax_errors.snap index 618774276b..aaab1dd913 100644 --- a/crates/ruff_linter/src/message/snapshots/ruff_linter__message__text__tests__syntax_errors.snap +++ b/crates/ruff_linter/src/message/snapshots/ruff_linter__message__text__tests__syntax_errors.snap @@ -2,7 +2,9 @@ source: crates/ruff_linter/src/message/text.rs expression: content --- -syntax_errors.py:1:15: SyntaxError: Expected one or more symbol names after import +error[syntax-error]: 1:15: Expected one or more symbol names after import + + --> syntax_errors.py:1:15 | 1 | from os import | ^ @@ -10,8 +12,9 @@ syntax_errors.py:1:15: SyntaxError: Expected one or more symbol names after impo 3 | if call(foo 4 | def bar(): | +error[syntax-error]: 3:12: Expected ')', found newline -syntax_errors.py:3:12: SyntaxError: Expected ')', found newline + --> syntax_errors.py:3:12 | 1 | from os import 2 | diff --git a/crates/ruff_linter/src/message/text.rs b/crates/ruff_linter/src/message/text.rs index ea6a612114..918a91d933 100644 --- a/crates/ruff_linter/src/message/text.rs +++ b/crates/ruff_linter/src/message/text.rs @@ -71,17 +71,12 @@ impl Emitter for TextEmitter { ) -> anyhow::Result<()> { for message in messages { let mut title = String::new(); - write!( - title, - "{path}{sep}", - path = relativize_path(message.filename()).bold(), - sep = ":".cyan(), - )?; let start_location = message.compute_start_location(); let notebook_index = context.notebook_index(message.filename()); // Check if we're working on a jupyter notebook and translate positions with cell accordingly + // TODO: Only append location to title if there are no snippets let diagnostic_location = if let Some(notebook_index) = notebook_index { write!( title, @@ -118,7 +113,7 @@ impl Emitter for TextEmitter { let code = message .rule() .map(|rule| rule.noqa_code().to_string()) - .unwrap_or_default(); + .unwrap_or_else(|| "syntax-error".to_string()); let mut snippet_message = Level::Error.title(&title).id(&code); // The `0..0` range is used to highlight file-level diagnostics. @@ -172,9 +167,6 @@ impl Display for RuleCodeAndBody<'_> { if let Some(fix) = self.message.fix() { // Do not display an indicator for unapplicable fixes if fix.applies(self.unsafe_fixes.required_applicability()) { - if let Some(rule) = self.message.rule() { - write!(f, "{} ", rule.noqa_code().to_string().red().bold())?; - } return write!( f, "{fix}{body}", @@ -185,21 +177,13 @@ impl Display for RuleCodeAndBody<'_> { } }; - if let Some(rule) = self.message.rule() { - write!( - f, - "{code} {body}", - code = rule.noqa_code().to_string().red().bold(), - body = self.message.body(), - ) - } else { - f.write_str(self.message.body()) - } + f.write_str(self.message.body()) } } struct CodeFrameSnippet<'a> { pub(crate) source: SourceCode<'a>, + file_name: String, line_start: OneIndexed, } @@ -281,11 +265,16 @@ impl<'a> CodeFrameSnippet<'a> { }, ); - Self { line_start, source } + Self { + line_start, + source, + file_name: relativize_path(message.filename()), + } } pub(super) fn as_snippet(&self) -> Snippet { Snippet::source(&self.source.text) + .origin(&self.file_name) .line_start(self.line_start.get()) .annotation(Level::Error.span(self.source.annotation_range.into())) } diff --git a/crates/ruff_linter/src/rules/airflow/snapshots/ruff_linter__rules__airflow__tests__AIR001_AIR001.py.snap b/crates/ruff_linter/src/rules/airflow/snapshots/ruff_linter__rules__airflow__tests__AIR001_AIR001.py.snap index 88c6e651cc..24ffe5b10c 100644 --- a/crates/ruff_linter/src/rules/airflow/snapshots/ruff_linter__rules__airflow__tests__AIR001_AIR001.py.snap +++ b/crates/ruff_linter/src/rules/airflow/snapshots/ruff_linter__rules__airflow__tests__AIR001_AIR001.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/airflow/mod.rs --- -error[AIR001]: AIR001.py:11:1: Task variable name should match the `task_id`: "my_task" +error[AIR001]: 11:1: Task variable name should match the `task_id`: "my_task" + --> AIR001.py:10:1 | 9 | my_task_2 = PythonOperator(callable=my_callable, task_id="my_task_2") 10 | @@ -10,8 +11,9 @@ error[AIR001]: AIR001.py:11:1: Task variable name should match the `task_id`: "m | ^^^^^^^^^^^^^^ 12 | incorrect_name_2 = PythonOperator(callable=my_callable, task_id="my_task_2") | -error[AIR001]: AIR001.py:12:1: Task variable name should match the `task_id`: "my_task_2" +error[AIR001]: 12:1: Task variable name should match the `task_id`: "my_task_2" + --> AIR001.py:11:51 | 11 | incorrect_name = PythonOperator(task_id="my_task") 12 | incorrect_name_2 = PythonOperator(callable=my_callable, task_id="my_task_2") diff --git a/crates/ruff_linter/src/rules/eradicate/snapshots/ruff_linter__rules__eradicate__tests__ERA001_ERA001.py.snap b/crates/ruff_linter/src/rules/eradicate/snapshots/ruff_linter__rules__eradicate__tests__ERA001_ERA001.py.snap index ad99846a15..d3f64d48fe 100644 --- a/crates/ruff_linter/src/rules/eradicate/snapshots/ruff_linter__rules__eradicate__tests__ERA001_ERA001.py.snap +++ b/crates/ruff_linter/src/rules/eradicate/snapshots/ruff_linter__rules__eradicate__tests__ERA001_ERA001.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/eradicate/mod.rs --- -error[ERA001]: ERA001.py:1:1: Found commented-out code +error[ERA001]: 1:1: Found commented-out code + --> ERA001.py:1:1 | 1 | #import os | ^^^^^^^^^^ @@ -16,8 +17,9 @@ error[ERA001]: ERA001.py:1:1: Found commented-out code 3 2 | #a = 3 4 3 | a = 4 -error[ERA001]: ERA001.py:2:1: Found commented-out code +error[ERA001]: 2:1: Found commented-out code + --> ERA001.py:1:11 | 1 | #import os 2 | # from foo import junk @@ -33,8 +35,9 @@ error[ERA001]: ERA001.py:2:1: Found commented-out code 4 3 | a = 4 5 4 | #foo(1, 2, 3) -error[ERA001]: ERA001.py:3:1: Found commented-out code +error[ERA001]: 3:1: Found commented-out code + --> ERA001.py:2:23 | 1 | #import os 2 | # from foo import junk @@ -52,8 +55,9 @@ error[ERA001]: ERA001.py:3:1: Found commented-out code 5 4 | #foo(1, 2, 3) 6 5 | -error[ERA001]: ERA001.py:5:1: Found commented-out code +error[ERA001]: 5:1: Found commented-out code + --> ERA001.py:4:6 | 3 | #a = 3 4 | a = 4 @@ -72,8 +76,9 @@ error[ERA001]: ERA001.py:5:1: Found commented-out code 7 6 | def foo(x, y, z): 8 7 | content = 1 # print('hello') -error[ERA001]: ERA001.py:13:5: Found commented-out code +error[ERA001]: 13:5: Found commented-out code + --> ERA001.py:13:5 | 11 | # This is a real comment. 12 | # # This is a (nested) comment. @@ -91,8 +96,9 @@ error[ERA001]: ERA001.py:13:5: Found commented-out code 15 14 | 16 15 | #import os # noqa: ERA001 -error[ERA001]: ERA001.py:21:5: Found commented-out code +error[ERA001]: 21:5: Found commented-out code + --> ERA001.py:21:5 | 19 | class A(): 20 | pass @@ -109,8 +115,9 @@ error[ERA001]: ERA001.py:21:5: Found commented-out code 23 22 | 24 23 | dictionary = { -error[ERA001]: ERA001.py:26:5: Found commented-out code +error[ERA001]: 26:5: Found commented-out code + --> ERA001.py:26:5 | 24 | dictionary = { 25 | # "key1": 123, # noqa: ERA001 @@ -129,8 +136,9 @@ error[ERA001]: ERA001.py:26:5: Found commented-out code 28 27 | } 29 28 | -error[ERA001]: ERA001.py:27:5: Found commented-out code +error[ERA001]: 27:5: Found commented-out code + --> ERA001.py:27:5 | 25 | # "key1": 123, # noqa: ERA001 26 | # "key2": 456, @@ -148,8 +156,9 @@ error[ERA001]: ERA001.py:27:5: Found commented-out code 29 28 | 30 29 | #import os # noqa -error[ERA001]: ERA001.py:32:1: Found commented-out code +error[ERA001]: 32:1: Found commented-out code + --> ERA001.py:31:1 | 30 | #import os # noqa 31 | @@ -168,8 +177,9 @@ error[ERA001]: ERA001.py:32:1: Found commented-out code 34 33 | # try: # with comment 35 34 | # try: print() -error[ERA001]: ERA001.py:33:1: Found commented-out code +error[ERA001]: 33:1: Found commented-out code + --> ERA001.py:32:10 | 32 | # case 1: 33 | # try: @@ -187,8 +197,9 @@ error[ERA001]: ERA001.py:33:1: Found commented-out code 35 34 | # try: print() 36 35 | # except: -error[ERA001]: ERA001.py:34:1: Found commented-out code +error[ERA001]: 34:1: Found commented-out code + --> ERA001.py:33:7 | 32 | # case 1: 33 | # try: @@ -207,8 +218,9 @@ error[ERA001]: ERA001.py:34:1: Found commented-out code 36 35 | # except: 37 36 | # except Foo: -error[ERA001]: ERA001.py:35:1: Found commented-out code +error[ERA001]: 35:1: Found commented-out code + --> ERA001.py:34:23 | 33 | # try: 34 | # try: # with comment @@ -227,8 +239,9 @@ error[ERA001]: ERA001.py:35:1: Found commented-out code 37 36 | # except Foo: 38 37 | # except Exception as e: print(e) -error[ERA001]: ERA001.py:36:1: Found commented-out code +error[ERA001]: 36:1: Found commented-out code + --> ERA001.py:35:15 | 34 | # try: # with comment 35 | # try: print() @@ -247,8 +260,9 @@ error[ERA001]: ERA001.py:36:1: Found commented-out code 38 37 | # except Exception as e: print(e) 39 38 | -error[ERA001]: ERA001.py:37:1: Found commented-out code +error[ERA001]: 37:1: Found commented-out code + --> ERA001.py:36:10 | 35 | # try: print() 36 | # except: @@ -266,8 +280,9 @@ error[ERA001]: ERA001.py:37:1: Found commented-out code 39 38 | 40 39 | -error[ERA001]: ERA001.py:38:1: Found commented-out code +error[ERA001]: 38:1: Found commented-out code + --> ERA001.py:37:14 | 36 | # except: 37 | # except Foo: @@ -284,8 +299,9 @@ error[ERA001]: ERA001.py:38:1: Found commented-out code 40 39 | 41 40 | # Script tag without an opening tag (Error) -error[ERA001]: ERA001.py:44:1: Found commented-out code +error[ERA001]: 44:1: Found commented-out code + --> ERA001.py:43:29 | 43 | # requires-python = ">=3.11" 44 | # dependencies = [ @@ -303,8 +319,9 @@ error[ERA001]: ERA001.py:44:1: Found commented-out code 46 45 | # "rich", 47 46 | # ] -error[ERA001]: ERA001.py:47:1: Found commented-out code +error[ERA001]: 47:1: Found commented-out code + --> ERA001.py:46:12 | 45 | # "requests<3", 46 | # "rich", diff --git a/crates/ruff_linter/src/rules/fastapi/snapshots/ruff_linter__rules__fastapi__tests__fast-api-non-annotated-dependency_FAST002.py.snap b/crates/ruff_linter/src/rules/fastapi/snapshots/ruff_linter__rules__fastapi__tests__fast-api-non-annotated-dependency_FAST002.py.snap index 0651f5f700..12f9c2f202 100644 --- a/crates/ruff_linter/src/rules/fastapi/snapshots/ruff_linter__rules__fastapi__tests__fast-api-non-annotated-dependency_FAST002.py.snap +++ b/crates/ruff_linter/src/rules/fastapi/snapshots/ruff_linter__rules__fastapi__tests__fast-api-non-annotated-dependency_FAST002.py.snap @@ -1,17 +1,18 @@ --- source: crates/ruff_linter/src/rules/fastapi/mod.rs --- -FAST002.py:24:5: FAST002 [*] FastAPI dependency without `Annotated` +error[FAST002]: 24:5: [*] FastAPI dependency without `Annotated` + + --> FAST002.py:24:5 | 22 | @app.get("/items/") 23 | def get_items( 24 | current_user: User = Depends(get_current_user), - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FAST002 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 25 | some_security_param: str = Security(get_oauth2_user), 26 | ): | = help: Replace with `Annotated` - ℹ Unsafe fix 12 12 | Security, 13 13 | ) @@ -30,17 +31,18 @@ FAST002.py:24:5: FAST002 [*] FastAPI dependency without `Annotated` 26 27 | ): 27 28 | pass -FAST002.py:25:5: FAST002 [*] FastAPI dependency without `Annotated` +error[FAST002]: 25:5: [*] FastAPI dependency without `Annotated` + + --> FAST002.py:25:5 | 23 | def get_items( 24 | current_user: User = Depends(get_current_user), 25 | some_security_param: str = Security(get_oauth2_user), - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FAST002 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 26 | ): 27 | pass | = help: Replace with `Annotated` - ℹ Unsafe fix 12 12 | Security, 13 13 | ) @@ -59,17 +61,18 @@ FAST002.py:25:5: FAST002 [*] FastAPI dependency without `Annotated` 27 28 | pass 28 29 | -FAST002.py:32:5: FAST002 [*] FastAPI dependency without `Annotated` +error[FAST002]: 32:5: [*] FastAPI dependency without `Annotated` + + --> FAST002.py:32:5 | 30 | @app.post("/stuff/") 31 | def do_stuff( 32 | some_query_param: str | None = Query(default=None), - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FAST002 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 33 | some_path_param: str = Path(), 34 | some_body_param: str = Body("foo"), | = help: Replace with `Annotated` - ℹ Unsafe fix 12 12 | Security, 13 13 | ) @@ -88,17 +91,18 @@ FAST002.py:32:5: FAST002 [*] FastAPI dependency without `Annotated` 34 35 | some_body_param: str = Body("foo"), 35 36 | some_cookie_param: str = Cookie(), -FAST002.py:33:5: FAST002 [*] FastAPI dependency without `Annotated` +error[FAST002]: 33:5: [*] FastAPI dependency without `Annotated` + + --> FAST002.py:33:5 | 31 | def do_stuff( 32 | some_query_param: str | None = Query(default=None), 33 | some_path_param: str = Path(), - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FAST002 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 34 | some_body_param: str = Body("foo"), 35 | some_cookie_param: str = Cookie(), | = help: Replace with `Annotated` - ℹ Unsafe fix 12 12 | Security, 13 13 | ) @@ -117,17 +121,18 @@ FAST002.py:33:5: FAST002 [*] FastAPI dependency without `Annotated` 35 36 | some_cookie_param: str = Cookie(), 36 37 | some_header_param: int = Header(default=5), -FAST002.py:34:5: FAST002 [*] FastAPI dependency without `Annotated` +error[FAST002]: 34:5: [*] FastAPI dependency without `Annotated` + + --> FAST002.py:34:5 | 32 | some_query_param: str | None = Query(default=None), 33 | some_path_param: str = Path(), 34 | some_body_param: str = Body("foo"), - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FAST002 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 35 | some_cookie_param: str = Cookie(), 36 | some_header_param: int = Header(default=5), | = help: Replace with `Annotated` - ℹ Unsafe fix 12 12 | Security, 13 13 | ) @@ -146,17 +151,18 @@ FAST002.py:34:5: FAST002 [*] FastAPI dependency without `Annotated` 36 37 | some_header_param: int = Header(default=5), 37 38 | some_file_param: UploadFile = File(), -FAST002.py:35:5: FAST002 [*] FastAPI dependency without `Annotated` +error[FAST002]: 35:5: [*] FastAPI dependency without `Annotated` + + --> FAST002.py:35:5 | 33 | some_path_param: str = Path(), 34 | some_body_param: str = Body("foo"), 35 | some_cookie_param: str = Cookie(), - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FAST002 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 36 | some_header_param: int = Header(default=5), 37 | some_file_param: UploadFile = File(), | = help: Replace with `Annotated` - ℹ Unsafe fix 12 12 | Security, 13 13 | ) @@ -175,17 +181,18 @@ FAST002.py:35:5: FAST002 [*] FastAPI dependency without `Annotated` 37 38 | some_file_param: UploadFile = File(), 38 39 | some_form_param: str = Form(), -FAST002.py:36:5: FAST002 [*] FastAPI dependency without `Annotated` +error[FAST002]: 36:5: [*] FastAPI dependency without `Annotated` + + --> FAST002.py:36:5 | 34 | some_body_param: str = Body("foo"), 35 | some_cookie_param: str = Cookie(), 36 | some_header_param: int = Header(default=5), - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FAST002 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 37 | some_file_param: UploadFile = File(), 38 | some_form_param: str = Form(), | = help: Replace with `Annotated` - ℹ Unsafe fix 12 12 | Security, 13 13 | ) @@ -204,17 +211,18 @@ FAST002.py:36:5: FAST002 [*] FastAPI dependency without `Annotated` 38 39 | some_form_param: str = Form(), 39 40 | ): -FAST002.py:37:5: FAST002 [*] FastAPI dependency without `Annotated` +error[FAST002]: 37:5: [*] FastAPI dependency without `Annotated` + + --> FAST002.py:37:5 | 35 | some_cookie_param: str = Cookie(), 36 | some_header_param: int = Header(default=5), 37 | some_file_param: UploadFile = File(), - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FAST002 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 38 | some_form_param: str = Form(), 39 | ): | = help: Replace with `Annotated` - ℹ Unsafe fix 12 12 | Security, 13 13 | ) @@ -233,17 +241,18 @@ FAST002.py:37:5: FAST002 [*] FastAPI dependency without `Annotated` 39 40 | ): 40 41 | # do stuff -FAST002.py:38:5: FAST002 [*] FastAPI dependency without `Annotated` +error[FAST002]: 38:5: [*] FastAPI dependency without `Annotated` + + --> FAST002.py:38:5 | 36 | some_header_param: int = Header(default=5), 37 | some_file_param: UploadFile = File(), 38 | some_form_param: str = Form(), - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FAST002 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 39 | ): 40 | # do stuff | = help: Replace with `Annotated` - ℹ Unsafe fix 12 12 | Security, 13 13 | ) diff --git a/crates/ruff_linter/src/rules/fastapi/snapshots/ruff_linter__rules__fastapi__tests__fast-api-redundant-response-model_FAST001.py.snap b/crates/ruff_linter/src/rules/fastapi/snapshots/ruff_linter__rules__fastapi__tests__fast-api-redundant-response-model_FAST001.py.snap index 84b582e502..5e87b83f45 100644 --- a/crates/ruff_linter/src/rules/fastapi/snapshots/ruff_linter__rules__fastapi__tests__fast-api-redundant-response-model_FAST001.py.snap +++ b/crates/ruff_linter/src/rules/fastapi/snapshots/ruff_linter__rules__fastapi__tests__fast-api-redundant-response-model_FAST001.py.snap @@ -1,15 +1,16 @@ --- source: crates/ruff_linter/src/rules/fastapi/mod.rs --- -FAST001.py:17:22: FAST001 [*] FastAPI route with redundant `response_model` argument +error[FAST001]: 17:22: [*] FastAPI route with redundant `response_model` argument + + --> FAST001.py:17:22 | 17 | @app.post("/items/", response_model=Item) - | ^^^^^^^^^^^^^^^^^^^ FAST001 + | ^^^^^^^^^^^^^^^^^^^ 18 | async def create_item(item: Item) -> Item: 19 | return item | = help: Remove argument - ℹ Unsafe fix 14 14 | # Errors 15 15 | @@ -20,15 +21,16 @@ FAST001.py:17:22: FAST001 [*] FastAPI route with redundant `response_model` argu 19 19 | return item 20 20 | -FAST001.py:22:22: FAST001 [*] FastAPI route with redundant `response_model` argument +error[FAST001]: 22:22: [*] FastAPI route with redundant `response_model` argument + + --> FAST001.py:22:22 | 22 | @app.post("/items/", response_model=list[Item]) - | ^^^^^^^^^^^^^^^^^^^^^^^^^ FAST001 + | ^^^^^^^^^^^^^^^^^^^^^^^^^ 23 | async def create_item(item: Item) -> list[Item]: 24 | return item | = help: Remove argument - ℹ Unsafe fix 19 19 | return item 20 20 | @@ -39,15 +41,16 @@ FAST001.py:22:22: FAST001 [*] FastAPI route with redundant `response_model` argu 24 24 | return item 25 25 | -FAST001.py:27:22: FAST001 [*] FastAPI route with redundant `response_model` argument +error[FAST001]: 27:22: [*] FastAPI route with redundant `response_model` argument + + --> FAST001.py:27:22 | 27 | @app.post("/items/", response_model=List[Item]) - | ^^^^^^^^^^^^^^^^^^^^^^^^^ FAST001 + | ^^^^^^^^^^^^^^^^^^^^^^^^^ 28 | async def create_item(item: Item) -> List[Item]: 29 | return item | = help: Remove argument - ℹ Unsafe fix 24 24 | return item 25 25 | @@ -58,15 +61,16 @@ FAST001.py:27:22: FAST001 [*] FastAPI route with redundant `response_model` argu 29 29 | return item 30 30 | -FAST001.py:32:22: FAST001 [*] FastAPI route with redundant `response_model` argument +error[FAST001]: 32:22: [*] FastAPI route with redundant `response_model` argument + + --> FAST001.py:32:22 | 32 | @app.post("/items/", response_model=Dict[str, Item]) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FAST001 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 33 | async def create_item(item: Item) -> Dict[str, Item]: 34 | return item | = help: Remove argument - ℹ Unsafe fix 29 29 | return item 30 30 | @@ -77,15 +81,16 @@ FAST001.py:32:22: FAST001 [*] FastAPI route with redundant `response_model` argu 34 34 | return item 35 35 | -FAST001.py:37:22: FAST001 [*] FastAPI route with redundant `response_model` argument +error[FAST001]: 37:22: [*] FastAPI route with redundant `response_model` argument + + --> FAST001.py:37:22 | 37 | @app.post("/items/", response_model=str) - | ^^^^^^^^^^^^^^^^^^ FAST001 + | ^^^^^^^^^^^^^^^^^^ 38 | async def create_item(item: Item) -> str: 39 | return item | = help: Remove argument - ℹ Unsafe fix 34 34 | return item 35 35 | @@ -96,15 +101,16 @@ FAST001.py:37:22: FAST001 [*] FastAPI route with redundant `response_model` argu 39 39 | return item 40 40 | -FAST001.py:42:21: FAST001 [*] FastAPI route with redundant `response_model` argument +error[FAST001]: 42:21: [*] FastAPI route with redundant `response_model` argument + + --> FAST001.py:42:21 | 42 | @app.get("/items/", response_model=Item) - | ^^^^^^^^^^^^^^^^^^^ FAST001 + | ^^^^^^^^^^^^^^^^^^^ 43 | async def create_item(item: Item) -> Item: 44 | return item | = help: Remove argument - ℹ Unsafe fix 39 39 | return item 40 40 | @@ -115,15 +121,16 @@ FAST001.py:42:21: FAST001 [*] FastAPI route with redundant `response_model` argu 44 44 | return item 45 45 | -FAST001.py:47:21: FAST001 [*] FastAPI route with redundant `response_model` argument +error[FAST001]: 47:21: [*] FastAPI route with redundant `response_model` argument + + --> FAST001.py:47:21 | 47 | @app.get("/items/", response_model=Item) - | ^^^^^^^^^^^^^^^^^^^ FAST001 + | ^^^^^^^^^^^^^^^^^^^ 48 | @app.post("/items/", response_model=Item) 49 | async def create_item(item: Item) -> Item: | = help: Remove argument - ℹ Unsafe fix 44 44 | return item 45 45 | @@ -134,16 +141,17 @@ FAST001.py:47:21: FAST001 [*] FastAPI route with redundant `response_model` argu 49 49 | async def create_item(item: Item) -> Item: 50 50 | return item -FAST001.py:48:22: FAST001 [*] FastAPI route with redundant `response_model` argument +error[FAST001]: 48:22: [*] FastAPI route with redundant `response_model` argument + + --> FAST001.py:48:22 | 47 | @app.get("/items/", response_model=Item) 48 | @app.post("/items/", response_model=Item) - | ^^^^^^^^^^^^^^^^^^^ FAST001 + | ^^^^^^^^^^^^^^^^^^^ 49 | async def create_item(item: Item) -> Item: 50 | return item | = help: Remove argument - ℹ Unsafe fix 45 45 | 46 46 | @@ -154,15 +162,16 @@ FAST001.py:48:22: FAST001 [*] FastAPI route with redundant `response_model` argu 50 50 | return item 51 51 | -FAST001.py:53:24: FAST001 [*] FastAPI route with redundant `response_model` argument +error[FAST001]: 53:24: [*] FastAPI route with redundant `response_model` argument + + --> FAST001.py:53:24 | 53 | @router.get("/items/", response_model=Item) - | ^^^^^^^^^^^^^^^^^^^ FAST001 + | ^^^^^^^^^^^^^^^^^^^ 54 | async def create_item(item: Item) -> Item: 55 | return item | = help: Remove argument - ℹ Unsafe fix 50 50 | return item 51 51 | diff --git a/crates/ruff_linter/src/rules/fastapi/snapshots/ruff_linter__rules__fastapi__tests__fast-api-unused-path-parameter_FAST003.py.snap b/crates/ruff_linter/src/rules/fastapi/snapshots/ruff_linter__rules__fastapi__tests__fast-api-unused-path-parameter_FAST003.py.snap index 86da96e16d..ba6201a9a2 100644 --- a/crates/ruff_linter/src/rules/fastapi/snapshots/ruff_linter__rules__fastapi__tests__fast-api-unused-path-parameter_FAST003.py.snap +++ b/crates/ruff_linter/src/rules/fastapi/snapshots/ruff_linter__rules__fastapi__tests__fast-api-unused-path-parameter_FAST003.py.snap @@ -1,16 +1,17 @@ --- source: crates/ruff_linter/src/rules/fastapi/mod.rs --- -FAST003.py:7:19: FAST003 [*] Parameter `thing_id` appears in route path, but not in `read_thing` signature +error[FAST003]: 7:19: [*] Parameter `thing_id` appears in route path, but not in `read_thing` signature + + --> FAST003.py:7:19 | 6 | # Errors 7 | @app.get("/things/{thing_id}") - | ^^^^^^^^^^ FAST003 + | ^^^^^^^^^^ 8 | async def read_thing(query: str): 9 | return {"query": query} | = help: Add `thing_id` to function signature - ℹ Unsafe fix 5 5 | 6 6 | # Errors @@ -21,15 +22,16 @@ FAST003.py:7:19: FAST003 [*] Parameter `thing_id` appears in route path, but not 10 10 | 11 11 | -FAST003.py:12:23: FAST003 [*] Parameter `isbn` appears in route path, but not in `read_thing` signature +error[FAST003]: 12:23: [*] Parameter `isbn` appears in route path, but not in `read_thing` signature + + --> FAST003.py:12:23 | 12 | @app.get("/books/isbn-{isbn}") - | ^^^^^^ FAST003 + | ^^^^^^ 13 | async def read_thing(): 14 | ... | = help: Add `isbn` to function signature - ℹ Unsafe fix 10 10 | 11 11 | @@ -40,15 +42,16 @@ FAST003.py:12:23: FAST003 [*] Parameter `isbn` appears in route path, but not in 15 15 | 16 16 | -FAST003.py:17:19: FAST003 [*] Parameter `thing_id` appears in route path, but not in `read_thing` signature +error[FAST003]: 17:19: [*] Parameter `thing_id` appears in route path, but not in `read_thing` signature + + --> FAST003.py:17:19 | 17 | @app.get("/things/{thing_id:path}") - | ^^^^^^^^^^^^^^^ FAST003 + | ^^^^^^^^^^^^^^^ 18 | async def read_thing(query: str): 19 | return {"query": query} | = help: Add `thing_id` to function signature - ℹ Unsafe fix 15 15 | 16 16 | @@ -59,15 +62,16 @@ FAST003.py:17:19: FAST003 [*] Parameter `thing_id` appears in route path, but no 20 20 | 21 21 | -FAST003.py:22:19: FAST003 [*] Parameter `thing_id` appears in route path, but not in `read_thing` signature +error[FAST003]: 22:19: [*] Parameter `thing_id` appears in route path, but not in `read_thing` signature + + --> FAST003.py:22:19 | 22 | @app.get("/things/{thing_id : path}") - | ^^^^^^^^^^^^^^^^^ FAST003 + | ^^^^^^^^^^^^^^^^^ 23 | async def read_thing(query: str): 24 | return {"query": query} | = help: Add `thing_id` to function signature - ℹ Unsafe fix 20 20 | 21 21 | @@ -78,15 +82,16 @@ FAST003.py:22:19: FAST003 [*] Parameter `thing_id` appears in route path, but no 25 25 | 26 26 | -FAST003.py:27:27: FAST003 [*] Parameter `title` appears in route path, but not in `read_thing` signature +error[FAST003]: 27:27: [*] Parameter `title` appears in route path, but not in `read_thing` signature + + --> FAST003.py:27:27 | 27 | @app.get("/books/{author}/{title}") - | ^^^^^^^ FAST003 + | ^^^^^^^ 28 | async def read_thing(author: str): 29 | return {"author": author} | = help: Add `title` to function signature - ℹ Unsafe fix 25 25 | 26 26 | @@ -97,15 +102,16 @@ FAST003.py:27:27: FAST003 [*] Parameter `title` appears in route path, but not i 30 30 | 31 31 | -FAST003.py:32:18: FAST003 [*] Parameter `author_name` appears in route path, but not in `read_thing` signature +error[FAST003]: 32:18: [*] Parameter `author_name` appears in route path, but not in `read_thing` signature + + --> FAST003.py:32:18 | 32 | @app.get("/books/{author_name}/{title}") - | ^^^^^^^^^^^^^ FAST003 + | ^^^^^^^^^^^^^ 33 | async def read_thing(): 34 | ... | = help: Add `author_name` to function signature - ℹ Unsafe fix 30 30 | 31 31 | @@ -116,15 +122,16 @@ FAST003.py:32:18: FAST003 [*] Parameter `author_name` appears in route path, but 35 35 | 36 36 | -FAST003.py:32:32: FAST003 [*] Parameter `title` appears in route path, but not in `read_thing` signature +error[FAST003]: 32:32: [*] Parameter `title` appears in route path, but not in `read_thing` signature + + --> FAST003.py:32:32 | 32 | @app.get("/books/{author_name}/{title}") - | ^^^^^^^ FAST003 + | ^^^^^^^ 33 | async def read_thing(): 34 | ... | = help: Add `title` to function signature - ℹ Unsafe fix 30 30 | 31 31 | @@ -135,31 +142,34 @@ FAST003.py:32:32: FAST003 [*] Parameter `title` appears in route path, but not i 35 35 | 36 36 | -FAST003.py:37:18: FAST003 Parameter `author` appears in route path, but only as a positional-only argument in `read_thing` signature +error[FAST003]: 37:18: Parameter `author` appears in route path, but only as a positional-only argument in `read_thing` signature + + --> FAST003.py:37:18 | 37 | @app.get("/books/{author}/{title}") - | ^^^^^^^^ FAST003 + | ^^^^^^^^ 38 | async def read_thing(author: str, title: str, /): 39 | return {"author": author, "title": title} | +error[FAST003]: 37:27: Parameter `title` appears in route path, but only as a positional-only argument in `read_thing` signature -FAST003.py:37:27: FAST003 Parameter `title` appears in route path, but only as a positional-only argument in `read_thing` signature + --> FAST003.py:37:27 | 37 | @app.get("/books/{author}/{title}") - | ^^^^^^^ FAST003 + | ^^^^^^^ 38 | async def read_thing(author: str, title: str, /): 39 | return {"author": author, "title": title} | +error[FAST003]: 42:27: [*] Parameter `title` appears in route path, but not in `read_thing` signature -FAST003.py:42:27: FAST003 [*] Parameter `title` appears in route path, but not in `read_thing` signature + --> FAST003.py:42:27 | 42 | @app.get("/books/{author}/{title}/{page}") - | ^^^^^^^ FAST003 + | ^^^^^^^ 43 | async def read_thing( 44 | author: str, | = help: Add `title` to function signature - ℹ Unsafe fix 42 42 | @app.get("/books/{author}/{title}/{page}") 43 43 | async def read_thing( @@ -170,15 +180,16 @@ FAST003.py:42:27: FAST003 [*] Parameter `title` appears in route path, but not i 47 47 | 48 48 | -FAST003.py:42:35: FAST003 [*] Parameter `page` appears in route path, but not in `read_thing` signature +error[FAST003]: 42:35: [*] Parameter `page` appears in route path, but not in `read_thing` signature + + --> FAST003.py:42:35 | 42 | @app.get("/books/{author}/{title}/{page}") - | ^^^^^^ FAST003 + | ^^^^^^ 43 | async def read_thing( 44 | author: str, | = help: Add `page` to function signature - ℹ Unsafe fix 42 42 | @app.get("/books/{author}/{title}/{page}") 43 43 | async def read_thing( @@ -189,15 +200,16 @@ FAST003.py:42:35: FAST003 [*] Parameter `page` appears in route path, but not in 47 47 | 48 48 | -FAST003.py:49:18: FAST003 [*] Parameter `author` appears in route path, but not in `read_thing` signature +error[FAST003]: 49:18: [*] Parameter `author` appears in route path, but not in `read_thing` signature + + --> FAST003.py:49:18 | 49 | @app.get("/books/{author}/{title}") - | ^^^^^^^^ FAST003 + | ^^^^^^^^ 50 | async def read_thing(): 51 | ... | = help: Add `author` to function signature - ℹ Unsafe fix 47 47 | 48 48 | @@ -208,15 +220,16 @@ FAST003.py:49:18: FAST003 [*] Parameter `author` appears in route path, but not 52 52 | 53 53 | -FAST003.py:49:27: FAST003 [*] Parameter `title` appears in route path, but not in `read_thing` signature +error[FAST003]: 49:27: [*] Parameter `title` appears in route path, but not in `read_thing` signature + + --> FAST003.py:49:27 | 49 | @app.get("/books/{author}/{title}") - | ^^^^^^^ FAST003 + | ^^^^^^^ 50 | async def read_thing(): 51 | ... | = help: Add `title` to function signature - ℹ Unsafe fix 47 47 | 48 48 | @@ -227,15 +240,16 @@ FAST003.py:49:27: FAST003 [*] Parameter `title` appears in route path, but not i 52 52 | 53 53 | -FAST003.py:54:27: FAST003 [*] Parameter `title` appears in route path, but not in `read_thing` signature +error[FAST003]: 54:27: [*] Parameter `title` appears in route path, but not in `read_thing` signature + + --> FAST003.py:54:27 | 54 | @app.get("/books/{author}/{title}") - | ^^^^^^^ FAST003 + | ^^^^^^^ 55 | async def read_thing(*, author: str): 56 | ... | = help: Add `title` to function signature - ℹ Unsafe fix 52 52 | 53 53 | @@ -246,15 +260,16 @@ FAST003.py:54:27: FAST003 [*] Parameter `title` appears in route path, but not i 57 57 | 58 58 | -FAST003.py:59:27: FAST003 [*] Parameter `title` appears in route path, but not in `read_thing` signature +error[FAST003]: 59:27: [*] Parameter `title` appears in route path, but not in `read_thing` signature + + --> FAST003.py:59:27 | 59 | @app.get("/books/{author}/{title}") - | ^^^^^^^ FAST003 + | ^^^^^^^ 60 | async def read_thing(hello, /, *, author: str): 61 | ... | = help: Add `title` to function signature - ℹ Unsafe fix 57 57 | 58 58 | @@ -265,15 +280,16 @@ FAST003.py:59:27: FAST003 [*] Parameter `title` appears in route path, but not i 62 62 | 63 63 | -FAST003.py:64:19: FAST003 [*] Parameter `thing_id` appears in route path, but not in `read_thing` signature +error[FAST003]: 64:19: [*] Parameter `thing_id` appears in route path, but not in `read_thing` signature + + --> FAST003.py:64:19 | 64 | @app.get("/things/{thing_id}") - | ^^^^^^^^^^ FAST003 + | ^^^^^^^^^^ 65 | async def read_thing( 66 | query: str, | = help: Add `thing_id` to function signature - ℹ Unsafe fix 63 63 | 64 64 | @app.get("/things/{thing_id}") @@ -284,15 +300,16 @@ FAST003.py:64:19: FAST003 [*] Parameter `thing_id` appears in route path, but no 68 68 | return {"query": query} 69 69 | -FAST003.py:71:19: FAST003 [*] Parameter `thing_id` appears in route path, but not in `read_thing` signature +error[FAST003]: 71:19: [*] Parameter `thing_id` appears in route path, but not in `read_thing` signature + + --> FAST003.py:71:19 | 71 | @app.get("/things/{thing_id}") - | ^^^^^^^^^^ FAST003 + | ^^^^^^^^^^ 72 | async def read_thing( 73 | query: str = "default", | = help: Add `thing_id` to function signature - ℹ Unsafe fix 70 70 | 71 71 | @app.get("/things/{thing_id}") @@ -303,15 +320,16 @@ FAST003.py:71:19: FAST003 [*] Parameter `thing_id` appears in route path, but no 75 75 | return {"query": query} 76 76 | -FAST003.py:78:19: FAST003 [*] Parameter `thing_id` appears in route path, but not in `read_thing` signature +error[FAST003]: 78:19: [*] Parameter `thing_id` appears in route path, but not in `read_thing` signature + + --> FAST003.py:78:19 | 78 | @app.get("/things/{thing_id}") - | ^^^^^^^^^^ FAST003 + | ^^^^^^^^^^ 79 | async def read_thing( 80 | *, query: str = "default", | = help: Add `thing_id` to function signature - ℹ Unsafe fix 77 77 | 78 78 | @app.get("/things/{thing_id}") diff --git a/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT101_YTT101.py.snap b/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT101_YTT101.py.snap index 4ded3c41c5..1a652b8bdb 100644 --- a/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT101_YTT101.py.snap +++ b/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT101_YTT101.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_2020/mod.rs --- -error[YTT101]: YTT101.py:6:7: `sys.version[:3]` referenced (python3.10), use `sys.version_info` +error[YTT101]: 6:7: `sys.version[:3]` referenced (python3.10), use `sys.version_info` + --> YTT101.py:6:7 | 4 | print(sys.version) 5 | @@ -11,16 +12,18 @@ error[YTT101]: YTT101.py:6:7: `sys.version[:3]` referenced (python3.10), use `sy 7 | print(version[:3]) 8 | print(v[:3]) | -error[YTT101]: YTT101.py:7:7: `sys.version[:3]` referenced (python3.10), use `sys.version_info` +error[YTT101]: 7:7: `sys.version[:3]` referenced (python3.10), use `sys.version_info` + --> YTT101.py:7:7 | 6 | print(sys.version[:3]) 7 | print(version[:3]) | ^^^^^^^ 8 | print(v[:3]) | -error[YTT101]: YTT101.py:8:7: `sys.version[:3]` referenced (python3.10), use `sys.version_info` +error[YTT101]: 8:7: `sys.version[:3]` referenced (python3.10), use `sys.version_info` + --> YTT101.py:8:7 | 6 | print(sys.version[:3]) 7 | print(version[:3]) diff --git a/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT102_YTT102.py.snap b/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT102_YTT102.py.snap index f1274992a0..17fcc5cb09 100644 --- a/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT102_YTT102.py.snap +++ b/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT102_YTT102.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_2020/mod.rs --- -error[YTT102]: YTT102.py:4:12: `sys.version[2]` referenced (python3.10), use `sys.version_info` +error[YTT102]: 4:12: `sys.version[2]` referenced (python3.10), use `sys.version_info` + --> YTT102.py:4:12 | 2 | from sys import version 3 | @@ -10,8 +11,9 @@ error[YTT102]: YTT102.py:4:12: `sys.version[2]` referenced (python3.10), use `sy | ^^^^^^^^^^^ 5 | py_minor = version[2] | -error[YTT102]: YTT102.py:5:12: `sys.version[2]` referenced (python3.10), use `sys.version_info` +error[YTT102]: 5:12: `sys.version[2]` referenced (python3.10), use `sys.version_info` + --> YTT102.py:5:12 | 4 | py_minor = sys.version[2] 5 | py_minor = version[2] diff --git a/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT103_YTT103.py.snap b/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT103_YTT103.py.snap index 2f16bbc0c9..5c93cad042 100644 --- a/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT103_YTT103.py.snap +++ b/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT103_YTT103.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_2020/mod.rs --- -error[YTT103]: YTT103.py:4:1: `sys.version` compared to string (python3.10), use `sys.version_info` +error[YTT103]: 4:1: `sys.version` compared to string (python3.10), use `sys.version_info` + --> YTT103.py:3:1 | 2 | from sys import version 3 | @@ -11,8 +12,9 @@ error[YTT103]: YTT103.py:4:1: `sys.version` compared to string (python3.10), use 5 | sys.version < "3.5" 6 | sys.version <= "3.5" | -error[YTT103]: YTT103.py:5:1: `sys.version` compared to string (python3.10), use `sys.version_info` +error[YTT103]: 5:1: `sys.version` compared to string (python3.10), use `sys.version_info` + --> YTT103.py:4:16 | 4 | version < "3.5" 5 | sys.version < "3.5" @@ -20,8 +22,9 @@ error[YTT103]: YTT103.py:5:1: `sys.version` compared to string (python3.10), use 6 | sys.version <= "3.5" 7 | sys.version > "3.5" | -error[YTT103]: YTT103.py:6:1: `sys.version` compared to string (python3.10), use `sys.version_info` +error[YTT103]: 6:1: `sys.version` compared to string (python3.10), use `sys.version_info` + --> YTT103.py:5:20 | 4 | version < "3.5" 5 | sys.version < "3.5" @@ -30,8 +33,9 @@ error[YTT103]: YTT103.py:6:1: `sys.version` compared to string (python3.10), use 7 | sys.version > "3.5" 8 | sys.version >= "3.5" | -error[YTT103]: YTT103.py:7:1: `sys.version` compared to string (python3.10), use `sys.version_info` +error[YTT103]: 7:1: `sys.version` compared to string (python3.10), use `sys.version_info` + --> YTT103.py:6:21 | 5 | sys.version < "3.5" 6 | sys.version <= "3.5" @@ -39,8 +43,9 @@ error[YTT103]: YTT103.py:7:1: `sys.version` compared to string (python3.10), use | ^^^^^^^^^^^ 8 | sys.version >= "3.5" | -error[YTT103]: YTT103.py:8:1: `sys.version` compared to string (python3.10), use `sys.version_info` +error[YTT103]: 8:1: `sys.version` compared to string (python3.10), use `sys.version_info` + --> YTT103.py:7:20 | 6 | sys.version <= "3.5" 7 | sys.version > "3.5" diff --git a/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT201_YTT201.py.snap b/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT201_YTT201.py.snap index 09d79e9bcc..d6da96737b 100644 --- a/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT201_YTT201.py.snap +++ b/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT201_YTT201.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_2020/mod.rs --- -error[YTT201]: YTT201.py:7:7: `sys.version_info[0] == 3` referenced (python4), use `>=` +error[YTT201]: 7:7: `sys.version_info[0] == 3` referenced (python4), use `>=` + --> YTT201.py:7:7 | 5 | PY3 = sys.version_info[0] >= 3 6 | @@ -11,8 +12,9 @@ error[YTT201]: YTT201.py:7:7: `sys.version_info[0] == 3` referenced (python4), u 8 | PY3 = version_info[0] == 3 9 | PY2 = sys.version_info[0] != 3 | -error[YTT201]: YTT201.py:8:7: `sys.version_info[0] == 3` referenced (python4), use `>=` +error[YTT201]: 8:7: `sys.version_info[0] == 3` referenced (python4), use `>=` + --> YTT201.py:8:7 | 7 | PY3 = sys.version_info[0] == 3 8 | PY3 = version_info[0] == 3 @@ -20,8 +22,9 @@ error[YTT201]: YTT201.py:8:7: `sys.version_info[0] == 3` referenced (python4), u 9 | PY2 = sys.version_info[0] != 3 10 | PY2 = version_info[0] != 3 | -error[YTT201]: YTT201.py:9:7: `sys.version_info[0] == 3` referenced (python4), use `>=` +error[YTT201]: 9:7: `sys.version_info[0] == 3` referenced (python4), use `>=` + --> YTT201.py:9:7 | 7 | PY3 = sys.version_info[0] == 3 8 | PY3 = version_info[0] == 3 @@ -29,8 +32,9 @@ error[YTT201]: YTT201.py:9:7: `sys.version_info[0] == 3` referenced (python4), u | ^^^^^^^^^^^^^^^^^^^ 10 | PY2 = version_info[0] != 3 | -error[YTT201]: YTT201.py:10:7: `sys.version_info[0] == 3` referenced (python4), use `>=` +error[YTT201]: 10:7: `sys.version_info[0] == 3` referenced (python4), use `>=` + --> YTT201.py:10:7 | 8 | PY3 = version_info[0] == 3 9 | PY2 = sys.version_info[0] != 3 diff --git a/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT202_YTT202.py.snap b/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT202_YTT202.py.snap index 374a59adc7..bf4afa9a4b 100644 --- a/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT202_YTT202.py.snap +++ b/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT202_YTT202.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_2020/mod.rs --- -error[YTT202]: YTT202.py:4:4: `six.PY3` referenced (python4), use `not six.PY2` +error[YTT202]: 4:4: `six.PY3` referenced (python4), use `not six.PY2` + --> YTT202.py:4:4 | 2 | from six import PY3 3 | @@ -11,8 +12,9 @@ error[YTT202]: YTT202.py:4:4: `six.PY3` referenced (python4), use `not six.PY2` 5 | print("3") 6 | if PY3: | -error[YTT202]: YTT202.py:6:4: `six.PY3` referenced (python4), use `not six.PY2` +error[YTT202]: 6:4: `six.PY3` referenced (python4), use `not six.PY2` + --> YTT202.py:6:4 | 4 | if six.PY3: 5 | print("3") diff --git a/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT203_YTT203.py.snap b/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT203_YTT203.py.snap index 8419892d21..0ca3c2b0fc 100644 --- a/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT203_YTT203.py.snap +++ b/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT203_YTT203.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_2020/mod.rs --- -error[YTT203]: YTT203.py:4:1: `sys.version_info[1]` compared to integer (python4), compare `sys.version_info` to tuple +error[YTT203]: 4:1: `sys.version_info[1]` compared to integer (python4), compare `sys.version_info` to tuple + --> YTT203.py:3:1 | 2 | from sys import version_info 3 | @@ -10,8 +11,9 @@ error[YTT203]: YTT203.py:4:1: `sys.version_info[1]` compared to integer (python4 | ^^^^^^^^^^^^^^^^^^^ 5 | version_info[1] < 6 | -error[YTT203]: YTT203.py:5:1: `sys.version_info[1]` compared to integer (python4), compare `sys.version_info` to tuple +error[YTT203]: 5:1: `sys.version_info[1]` compared to integer (python4), compare `sys.version_info` to tuple + --> YTT203.py:4:25 | 4 | sys.version_info[1] >= 5 5 | version_info[1] < 6 diff --git a/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT204_YTT204.py.snap b/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT204_YTT204.py.snap index bda53cc0c8..f8ce1bc1ef 100644 --- a/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT204_YTT204.py.snap +++ b/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT204_YTT204.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_2020/mod.rs --- -error[YTT204]: YTT204.py:4:1: `sys.version_info.minor` compared to integer (python4), compare `sys.version_info` to tuple +error[YTT204]: 4:1: `sys.version_info.minor` compared to integer (python4), compare `sys.version_info` to tuple + --> YTT204.py:3:1 | 2 | from sys import version_info 3 | @@ -10,8 +11,9 @@ error[YTT204]: YTT204.py:4:1: `sys.version_info.minor` compared to integer (pyth | ^^^^^^^^^^^^^^^^^^^^^^ 5 | version_info.minor > 8 | -error[YTT204]: YTT204.py:5:1: `sys.version_info.minor` compared to integer (python4), compare `sys.version_info` to tuple +error[YTT204]: 5:1: `sys.version_info.minor` compared to integer (python4), compare `sys.version_info` to tuple + --> YTT204.py:4:28 | 4 | sys.version_info.minor <= 7 5 | version_info.minor > 8 diff --git a/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT301_YTT301.py.snap b/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT301_YTT301.py.snap index 9b08ee391b..cbdc469396 100644 --- a/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT301_YTT301.py.snap +++ b/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT301_YTT301.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_2020/mod.rs --- -error[YTT301]: YTT301.py:4:12: `sys.version[0]` referenced (python10), use `sys.version_info` +error[YTT301]: 4:12: `sys.version[0]` referenced (python10), use `sys.version_info` + --> YTT301.py:4:12 | 2 | from sys import version 3 | @@ -10,8 +11,9 @@ error[YTT301]: YTT301.py:4:12: `sys.version[0]` referenced (python10), use `sys. | ^^^^^^^^^^^ 5 | py_major = version[0] | -error[YTT301]: YTT301.py:5:12: `sys.version[0]` referenced (python10), use `sys.version_info` +error[YTT301]: 5:12: `sys.version[0]` referenced (python10), use `sys.version_info` + --> YTT301.py:5:12 | 4 | py_major = sys.version[0] 5 | py_major = version[0] diff --git a/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT302_YTT302.py.snap b/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT302_YTT302.py.snap index 1b2ac1e680..798e58c4b9 100644 --- a/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT302_YTT302.py.snap +++ b/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT302_YTT302.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_2020/mod.rs --- -error[YTT302]: YTT302.py:4:1: `sys.version` compared to string (python10), use `sys.version_info` +error[YTT302]: 4:1: `sys.version` compared to string (python10), use `sys.version_info` + --> YTT302.py:3:1 | 2 | from sys import version 3 | @@ -11,8 +12,9 @@ error[YTT302]: YTT302.py:4:1: `sys.version` compared to string (python10), use ` 5 | sys.version < "3" 6 | sys.version <= "3" | -error[YTT302]: YTT302.py:5:1: `sys.version` compared to string (python10), use `sys.version_info` +error[YTT302]: 5:1: `sys.version` compared to string (python10), use `sys.version_info` + --> YTT302.py:4:14 | 4 | version < "3" 5 | sys.version < "3" @@ -20,8 +22,9 @@ error[YTT302]: YTT302.py:5:1: `sys.version` compared to string (python10), use ` 6 | sys.version <= "3" 7 | sys.version > "3" | -error[YTT302]: YTT302.py:6:1: `sys.version` compared to string (python10), use `sys.version_info` +error[YTT302]: 6:1: `sys.version` compared to string (python10), use `sys.version_info` + --> YTT302.py:5:18 | 4 | version < "3" 5 | sys.version < "3" @@ -30,8 +33,9 @@ error[YTT302]: YTT302.py:6:1: `sys.version` compared to string (python10), use ` 7 | sys.version > "3" 8 | sys.version >= "3" | -error[YTT302]: YTT302.py:7:1: `sys.version` compared to string (python10), use `sys.version_info` +error[YTT302]: 7:1: `sys.version` compared to string (python10), use `sys.version_info` + --> YTT302.py:6:19 | 5 | sys.version < "3" 6 | sys.version <= "3" @@ -39,8 +43,9 @@ error[YTT302]: YTT302.py:7:1: `sys.version` compared to string (python10), use ` | ^^^^^^^^^^^ 8 | sys.version >= "3" | -error[YTT302]: YTT302.py:8:1: `sys.version` compared to string (python10), use `sys.version_info` +error[YTT302]: 8:1: `sys.version` compared to string (python10), use `sys.version_info` + --> YTT302.py:7:18 | 6 | sys.version <= "3" 7 | sys.version > "3" diff --git a/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT303_YTT303.py.snap b/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT303_YTT303.py.snap index b786d2941d..14fd3bf6c1 100644 --- a/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT303_YTT303.py.snap +++ b/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT303_YTT303.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_2020/mod.rs --- -error[YTT303]: YTT303.py:4:7: `sys.version[:1]` referenced (python10), use `sys.version_info` +error[YTT303]: 4:7: `sys.version[:1]` referenced (python10), use `sys.version_info` + --> YTT303.py:4:7 | 2 | from sys import version 3 | @@ -10,8 +11,9 @@ error[YTT303]: YTT303.py:4:7: `sys.version[:1]` referenced (python10), use `sys. | ^^^^^^^^^^^ 5 | print(version[:1]) | -error[YTT303]: YTT303.py:5:7: `sys.version[:1]` referenced (python10), use `sys.version_info` +error[YTT303]: 5:7: `sys.version[:1]` referenced (python10), use `sys.version_info` + --> YTT303.py:5:7 | 4 | print(sys.version[:1]) 5 | print(version[:1]) diff --git a/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__allow_overload.snap b/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__allow_overload.snap index 144867deb1..0460178567 100644 --- a/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__allow_overload.snap +++ b/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__allow_overload.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_annotations/mod.rs --- -error[ANN201]: allow_overload.py:29:9: Missing return type annotation for public function `bar` +error[ANN201]: 29:9: Missing return type annotation for public function `bar` + --> allow_overload.py:29:9 | 28 | class X: 29 | def bar(i): diff --git a/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__allow_star_arg_any.snap b/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__allow_star_arg_any.snap index 08b4cd9bb3..d135ac6504 100644 --- a/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__allow_star_arg_any.snap +++ b/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__allow_star_arg_any.snap @@ -1,32 +1,36 @@ --- source: crates/ruff_linter/src/rules/flake8_annotations/mod.rs --- -error[ANN401]: allow_star_arg_any.py:10:12: Dynamically typed expressions (typing.Any) are disallowed in `a` +error[ANN401]: 10:12: Dynamically typed expressions (typing.Any) are disallowed in `a` + --> allow_star_arg_any.py:10:12 | 9 | # ANN401 10 | def foo(a: Any, *args: str, **kwargs: str) -> int: | ^^^ 11 | pass | -error[ANN401]: allow_star_arg_any.py:15:47: Dynamically typed expressions (typing.Any) are disallowed in `foo` +error[ANN401]: 15:47: Dynamically typed expressions (typing.Any) are disallowed in `foo` + --> allow_star_arg_any.py:15:47 | 14 | # ANN401 15 | def foo(a: int, *args: str, **kwargs: str) -> Any: | ^^^ 16 | pass | -error[ANN401]: allow_star_arg_any.py:40:29: Dynamically typed expressions (typing.Any) are disallowed in `a` +error[ANN401]: 40:29: Dynamically typed expressions (typing.Any) are disallowed in `a` + --> allow_star_arg_any.py:40:29 | 39 | # ANN401 40 | def foo_method(self, a: Any, *params: str, **options: str) -> int: | ^^^ 41 | pass | -error[ANN401]: allow_star_arg_any.py:44:67: Dynamically typed expressions (typing.Any) are disallowed in `foo_method` +error[ANN401]: 44:67: Dynamically typed expressions (typing.Any) are disallowed in `foo_method` + --> allow_star_arg_any.py:44:67 | 43 | # ANN401 44 | def foo_method(self, a: int, *params: str, **options: str) -> Any: diff --git a/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__auto_return_type.snap b/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__auto_return_type.snap index d564eea39a..8618675592 100644 --- a/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__auto_return_type.snap +++ b/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__auto_return_type.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_annotations/mod.rs --- -error[ANN201]: auto_return_type.py:1:5: [*] Missing return type annotation for public function `func` +error[ANN201]: 1:5: [*] Missing return type annotation for public function `func` + --> auto_return_type.py:1:5 | 1 | def func(): | ^^^^ @@ -16,8 +17,9 @@ error[ANN201]: auto_return_type.py:1:5: [*] Missing return type annotation for p 3 3 | 4 4 | -error[ANN201]: auto_return_type.py:5:5: [*] Missing return type annotation for public function `func` +error[ANN201]: 5:5: [*] Missing return type annotation for public function `func` + --> auto_return_type.py:5:5 | 5 | def func(): | ^^^^ @@ -34,8 +36,9 @@ error[ANN201]: auto_return_type.py:5:5: [*] Missing return type annotation for p 7 7 | 8 8 | -error[ANN201]: auto_return_type.py:9:5: [*] Missing return type annotation for public function `func` +error[ANN201]: 9:5: [*] Missing return type annotation for public function `func` + --> auto_return_type.py:9:5 | 9 | def func(x: int): | ^^^^ @@ -53,8 +56,9 @@ error[ANN201]: auto_return_type.py:9:5: [*] Missing return type annotation for p 11 11 | return 1 12 12 | else: -error[ANN201]: auto_return_type.py:16:5: [*] Missing return type annotation for public function `func` +error[ANN201]: 16:5: [*] Missing return type annotation for public function `func` + --> auto_return_type.py:16:5 | 16 | def func(): | ^^^^ @@ -71,8 +75,9 @@ error[ANN201]: auto_return_type.py:16:5: [*] Missing return type annotation for 18 18 | 19 19 | -error[ANN201]: auto_return_type.py:20:5: [*] Missing return type annotation for public function `func` +error[ANN201]: 20:5: [*] Missing return type annotation for public function `func` + --> auto_return_type.py:20:5 | 20 | def func(x: int): | ^^^^ @@ -90,8 +95,9 @@ error[ANN201]: auto_return_type.py:20:5: [*] Missing return type annotation for 22 22 | return None 23 23 | else: -error[ANN201]: auto_return_type.py:27:5: [*] Missing return type annotation for public function `func` +error[ANN201]: 27:5: [*] Missing return type annotation for public function `func` + --> auto_return_type.py:27:5 | 27 | def func(x: int): | ^^^^ @@ -108,8 +114,9 @@ error[ANN201]: auto_return_type.py:27:5: [*] Missing return type annotation for 29 29 | 30 30 | -error[ANN201]: auto_return_type.py:31:5: [*] Missing return type annotation for public function `func` +error[ANN201]: 31:5: [*] Missing return type annotation for public function `func` + --> auto_return_type.py:31:5 | 31 | def func(x: int): | ^^^^ @@ -126,8 +133,9 @@ error[ANN201]: auto_return_type.py:31:5: [*] Missing return type annotation for 33 33 | 34 34 | -error[ANN201]: auto_return_type.py:35:5: Missing return type annotation for public function `func` +error[ANN201]: 35:5: Missing return type annotation for public function `func` + --> auto_return_type.py:35:5 | 35 | def func(x: int): | ^^^^ @@ -135,16 +143,18 @@ error[ANN201]: auto_return_type.py:35:5: Missing return type annotation for publ 37 | return None | = help: Add return type annotation -error[ANN201]: auto_return_type.py:41:5: Missing return type annotation for public function `func` +error[ANN201]: 41:5: Missing return type annotation for public function `func` + --> auto_return_type.py:41:5 | 41 | def func(x: int): | ^^^^ 42 | return {"foo": 1} | = help: Add return type annotation -error[ANN201]: auto_return_type.py:45:5: [*] Missing return type annotation for public function `func` +error[ANN201]: 45:5: [*] Missing return type annotation for public function `func` + --> auto_return_type.py:45:5 | 45 | def func(x: int): | ^^^^ @@ -162,8 +172,9 @@ error[ANN201]: auto_return_type.py:45:5: [*] Missing return type annotation for 47 47 | return 1 48 48 | else: -error[ANN201]: auto_return_type.py:52:5: [*] Missing return type annotation for public function `func` +error[ANN201]: 52:5: [*] Missing return type annotation for public function `func` + --> auto_return_type.py:52:5 | 52 | def func(x: int): | ^^^^ @@ -181,8 +192,9 @@ error[ANN201]: auto_return_type.py:52:5: [*] Missing return type annotation for 54 54 | return 1 55 55 | else: -error[ANN201]: auto_return_type.py:59:5: [*] Missing return type annotation for public function `func` +error[ANN201]: 59:5: [*] Missing return type annotation for public function `func` + --> auto_return_type.py:59:5 | 59 | def func(x: int): | ^^^^ @@ -200,8 +212,9 @@ error[ANN201]: auto_return_type.py:59:5: [*] Missing return type annotation for 61 61 | return 1 62 62 | elif x > 5: -error[ANN201]: auto_return_type.py:68:5: [*] Missing return type annotation for public function `func` +error[ANN201]: 68:5: [*] Missing return type annotation for public function `func` + --> auto_return_type.py:68:5 | 68 | def func(x: int): | ^^^^ @@ -219,8 +232,9 @@ error[ANN201]: auto_return_type.py:68:5: [*] Missing return type annotation for 70 70 | return 1 71 71 | -error[ANN201]: auto_return_type.py:73:5: [*] Missing return type annotation for public function `func` +error[ANN201]: 73:5: [*] Missing return type annotation for public function `func` + --> auto_return_type.py:73:5 | 73 | def func(): | ^^^^ @@ -237,8 +251,9 @@ error[ANN201]: auto_return_type.py:73:5: [*] Missing return type annotation for 75 75 | 76 76 | -error[ANN201]: auto_return_type.py:77:5: [*] Missing return type annotation for public function `func` +error[ANN201]: 77:5: [*] Missing return type annotation for public function `func` + --> auto_return_type.py:77:5 | 77 | def func(x: int): | ^^^^ @@ -256,8 +271,9 @@ error[ANN201]: auto_return_type.py:77:5: [*] Missing return type annotation for 79 79 | return 1 80 80 | -error[ANN201]: auto_return_type.py:82:5: [*] Missing return type annotation for public function `func` +error[ANN201]: 82:5: [*] Missing return type annotation for public function `func` + --> auto_return_type.py:82:5 | 82 | def func(x: int): | ^^^^ @@ -275,8 +291,9 @@ error[ANN201]: auto_return_type.py:82:5: [*] Missing return type annotation for 84 84 | case [1, 2, 3]: 85 85 | return 1 -error[ANN201]: auto_return_type.py:90:5: [*] Missing return type annotation for public function `func` +error[ANN201]: 90:5: [*] Missing return type annotation for public function `func` + --> auto_return_type.py:90:5 | 90 | def func(x: int): | ^^^^ @@ -294,8 +311,9 @@ error[ANN201]: auto_return_type.py:90:5: [*] Missing return type annotation for 92 92 | if i > 0: 93 93 | return 1 -error[ANN201]: auto_return_type.py:96:5: [*] Missing return type annotation for public function `func` +error[ANN201]: 96:5: [*] Missing return type annotation for public function `func` + --> auto_return_type.py:96:5 | 96 | def func(x: int): | ^^^^ @@ -313,8 +331,9 @@ error[ANN201]: auto_return_type.py:96:5: [*] Missing return type annotation for 98 98 | if i > 0: 99 99 | return 1 -error[ANN201]: auto_return_type.py:104:5: [*] Missing return type annotation for public function `func` +error[ANN201]: 104:5: [*] Missing return type annotation for public function `func` + --> auto_return_type.py:104:5 | 104 | def func(x: int): | ^^^^ @@ -332,8 +351,9 @@ error[ANN201]: auto_return_type.py:104:5: [*] Missing return type annotation for 106 106 | if i > 0: 107 107 | break -error[ANN201]: auto_return_type.py:112:5: [*] Missing return type annotation for public function `func` +error[ANN201]: 112:5: [*] Missing return type annotation for public function `func` + --> auto_return_type.py:112:5 | 112 | def func(x: int): | ^^^^ @@ -351,8 +371,9 @@ error[ANN201]: auto_return_type.py:112:5: [*] Missing return type annotation for 114 114 | pass 115 115 | except: -error[ANN201]: auto_return_type.py:119:5: [*] Missing return type annotation for public function `func` +error[ANN201]: 119:5: [*] Missing return type annotation for public function `func` + --> auto_return_type.py:119:5 | 119 | def func(x: int): | ^^^^ @@ -370,8 +391,9 @@ error[ANN201]: auto_return_type.py:119:5: [*] Missing return type annotation for 121 121 | pass 122 122 | except: -error[ANN201]: auto_return_type.py:128:5: [*] Missing return type annotation for public function `func` +error[ANN201]: 128:5: [*] Missing return type annotation for public function `func` + --> auto_return_type.py:128:5 | 128 | def func(x: int): | ^^^^ @@ -389,8 +411,9 @@ error[ANN201]: auto_return_type.py:128:5: [*] Missing return type annotation for 130 130 | pass 131 131 | except: -error[ANN201]: auto_return_type.py:137:5: [*] Missing return type annotation for public function `func` +error[ANN201]: 137:5: [*] Missing return type annotation for public function `func` + --> auto_return_type.py:137:5 | 137 | def func(x: int): | ^^^^ @@ -408,8 +431,9 @@ error[ANN201]: auto_return_type.py:137:5: [*] Missing return type annotation for 139 139 | return 1 140 140 | except: -error[ANN201]: auto_return_type.py:146:5: [*] Missing return type annotation for public function `func` +error[ANN201]: 146:5: [*] Missing return type annotation for public function `func` + --> auto_return_type.py:146:5 | 146 | def func(x: int): | ^^^^ @@ -427,8 +451,9 @@ error[ANN201]: auto_return_type.py:146:5: [*] Missing return type annotation for 148 148 | break 149 149 | return 1 -error[ANN201]: auto_return_type.py:158:9: Missing return type annotation for public function `method` +error[ANN201]: 158:9: Missing return type annotation for public function `method` + --> auto_return_type.py:158:9 | 156 | class Foo(abc.ABC): 157 | @abstractmethod @@ -437,8 +462,9 @@ error[ANN201]: auto_return_type.py:158:9: Missing return type annotation for pub 159 | pass | = help: Add return type annotation -error[ANN201]: auto_return_type.py:162:9: Missing return type annotation for public function `method` +error[ANN201]: 162:9: Missing return type annotation for public function `method` + --> auto_return_type.py:162:9 | 161 | @abc.abstractmethod 162 | def method(self): @@ -446,8 +472,9 @@ error[ANN201]: auto_return_type.py:162:9: Missing return type annotation for pub 163 | """Docstring.""" | = help: Add return type annotation -error[ANN201]: auto_return_type.py:166:9: Missing return type annotation for public function `method` +error[ANN201]: 166:9: Missing return type annotation for public function `method` + --> auto_return_type.py:166:9 | 165 | @abc.abstractmethod 166 | def method(self): @@ -455,8 +482,9 @@ error[ANN201]: auto_return_type.py:166:9: Missing return type annotation for pub 167 | ... | = help: Add return type annotation -error[ANN205]: auto_return_type.py:171:9: Missing return type annotation for staticmethod `method` +error[ANN205]: 171:9: Missing return type annotation for staticmethod `method` + --> auto_return_type.py:171:9 | 169 | @staticmethod 170 | @abstractmethod @@ -465,8 +493,9 @@ error[ANN205]: auto_return_type.py:171:9: Missing return type annotation for sta 172 | pass | = help: Add return type annotation -error[ANN206]: auto_return_type.py:176:9: Missing return type annotation for classmethod `method` +error[ANN206]: 176:9: Missing return type annotation for classmethod `method` + --> auto_return_type.py:176:9 | 174 | @classmethod 175 | @abstractmethod @@ -475,8 +504,9 @@ error[ANN206]: auto_return_type.py:176:9: Missing return type annotation for cla 177 | pass | = help: Add return type annotation -error[ANN201]: auto_return_type.py:180:9: [*] Missing return type annotation for public function `method` +error[ANN201]: 180:9: [*] Missing return type annotation for public function `method` + --> auto_return_type.py:180:9 | 179 | @abstractmethod 180 | def method(self): @@ -495,8 +525,9 @@ error[ANN201]: auto_return_type.py:180:9: [*] Missing return type annotation for 182 182 | return 1 183 183 | else: -error[ANN201]: auto_return_type.py:187:5: [*] Missing return type annotation for public function `func` +error[ANN201]: 187:5: [*] Missing return type annotation for public function `func` + --> auto_return_type.py:187:5 | 187 | def func(x: int): | ^^^^ @@ -514,8 +545,9 @@ error[ANN201]: auto_return_type.py:187:5: [*] Missing return type annotation for 189 189 | pass 190 190 | except: -error[ANN201]: auto_return_type.py:194:5: [*] Missing return type annotation for public function `func` +error[ANN201]: 194:5: [*] Missing return type annotation for public function `func` + --> auto_return_type.py:194:5 | 194 | def func(x: int): | ^^^^ @@ -533,8 +565,9 @@ error[ANN201]: auto_return_type.py:194:5: [*] Missing return type annotation for 196 196 | pass 197 197 | except: -error[ANN201]: auto_return_type.py:203:5: [*] Missing return type annotation for public function `func` +error[ANN201]: 203:5: [*] Missing return type annotation for public function `func` + --> auto_return_type.py:203:5 | 203 | def func(x: int): | ^^^^ @@ -560,8 +593,9 @@ error[ANN201]: auto_return_type.py:203:5: [*] Missing return type annotation for 205 206 | raise ValueError 206 207 | else: -error[ANN201]: auto_return_type.py:210:5: [*] Missing return type annotation for public function `func` +error[ANN201]: 210:5: [*] Missing return type annotation for public function `func` + --> auto_return_type.py:210:5 | 210 | def func(x: int): | ^^^^ @@ -579,8 +613,9 @@ error[ANN201]: auto_return_type.py:210:5: [*] Missing return type annotation for 212 212 | raise ValueError 213 213 | else: -error[ANN201]: auto_return_type.py:234:5: [*] Missing return type annotation for public function `func` +error[ANN201]: 234:5: [*] Missing return type annotation for public function `func` + --> auto_return_type.py:234:5 | 234 | def func(x: int): | ^^^^ @@ -598,8 +633,9 @@ error[ANN201]: auto_return_type.py:234:5: [*] Missing return type annotation for 236 236 | return 1 237 237 | raise ValueError -error[ANN201]: auto_return_type.py:240:5: [*] Missing return type annotation for public function `func` +error[ANN201]: 240:5: [*] Missing return type annotation for public function `func` + --> auto_return_type.py:240:5 | 240 | def func(x: int): | ^^^^ @@ -617,8 +653,9 @@ error[ANN201]: auto_return_type.py:240:5: [*] Missing return type annotation for 242 242 | return 1 243 243 | else: -error[ANN201]: auto_return_type.py:248:5: [*] Missing return type annotation for public function `func` +error[ANN201]: 248:5: [*] Missing return type annotation for public function `func` + --> auto_return_type.py:248:5 | 248 | def func(): | ^^^^ @@ -636,8 +673,9 @@ error[ANN201]: auto_return_type.py:248:5: [*] Missing return type annotation for 250 250 | raise ValueError 251 251 | except: -error[ANN201]: auto_return_type.py:255:5: [*] Missing return type annotation for public function `func` +error[ANN201]: 255:5: [*] Missing return type annotation for public function `func` + --> auto_return_type.py:255:5 | 255 | def func(): | ^^^^ @@ -655,8 +693,9 @@ error[ANN201]: auto_return_type.py:255:5: [*] Missing return type annotation for 257 257 | return 1 258 258 | except: -error[ANN201]: auto_return_type.py:262:5: [*] Missing return type annotation for public function `func` +error[ANN201]: 262:5: [*] Missing return type annotation for public function `func` + --> auto_return_type.py:262:5 | 262 | def func(x: int): | ^^^^ @@ -674,8 +713,9 @@ error[ANN201]: auto_return_type.py:262:5: [*] Missing return type annotation for 264 264 | if x > 0: 265 265 | return 1 -error[ANN201]: auto_return_type.py:269:5: [*] Missing return type annotation for public function `func` +error[ANN201]: 269:5: [*] Missing return type annotation for public function `func` + --> auto_return_type.py:269:5 | 269 | def func(x: int): | ^^^^ @@ -693,8 +733,9 @@ error[ANN201]: auto_return_type.py:269:5: [*] Missing return type annotation for 271 271 | raise ValueError 272 272 | else: -error[ANN201]: auto_return_type.py:276:5: [*] Missing return type annotation for public function `func` +error[ANN201]: 276:5: [*] Missing return type annotation for public function `func` + --> auto_return_type.py:276:5 | 276 | def func(x: int): | ^^^^ @@ -712,8 +753,9 @@ error[ANN201]: auto_return_type.py:276:5: [*] Missing return type annotation for 278 278 | raise ValueError 279 279 | elif x > 10: -error[ANN201]: auto_return_type.py:283:5: [*] Missing return type annotation for public function `func` +error[ANN201]: 283:5: [*] Missing return type annotation for public function `func` + --> auto_return_type.py:283:5 | 283 | def func(x: int): | ^^^^ @@ -731,8 +773,9 @@ error[ANN201]: auto_return_type.py:283:5: [*] Missing return type annotation for 285 285 | raise ValueError 286 286 | elif x > 10: -error[ANN201]: auto_return_type.py:290:5: [*] Missing return type annotation for public function `func` +error[ANN201]: 290:5: [*] Missing return type annotation for public function `func` + --> auto_return_type.py:290:5 | 290 | def func(): | ^^^^ @@ -750,8 +793,9 @@ error[ANN201]: auto_return_type.py:290:5: [*] Missing return type annotation for 292 292 | return 5 293 293 | except: -error[ANN201]: auto_return_type.py:299:5: [*] Missing return type annotation for public function `func` +error[ANN201]: 299:5: [*] Missing return type annotation for public function `func` + --> auto_return_type.py:299:5 | 299 | def func(x: int): | ^^^^ diff --git a/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__auto_return_type_py38.snap b/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__auto_return_type_py38.snap index af7f14ab7e..2a31044f41 100644 --- a/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__auto_return_type_py38.snap +++ b/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__auto_return_type_py38.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_annotations/mod.rs --- -error[ANN201]: auto_return_type.py:1:5: [*] Missing return type annotation for public function `func` +error[ANN201]: 1:5: [*] Missing return type annotation for public function `func` + --> auto_return_type.py:1:5 | 1 | def func(): | ^^^^ @@ -16,8 +17,9 @@ error[ANN201]: auto_return_type.py:1:5: [*] Missing return type annotation for p 3 3 | 4 4 | -error[ANN201]: auto_return_type.py:5:5: [*] Missing return type annotation for public function `func` +error[ANN201]: 5:5: [*] Missing return type annotation for public function `func` + --> auto_return_type.py:5:5 | 5 | def func(): | ^^^^ @@ -34,8 +36,9 @@ error[ANN201]: auto_return_type.py:5:5: [*] Missing return type annotation for p 7 7 | 8 8 | -error[ANN201]: auto_return_type.py:9:5: [*] Missing return type annotation for public function `func` +error[ANN201]: 9:5: [*] Missing return type annotation for public function `func` + --> auto_return_type.py:9:5 | 9 | def func(x: int): | ^^^^ @@ -53,8 +56,9 @@ error[ANN201]: auto_return_type.py:9:5: [*] Missing return type annotation for p 11 11 | return 1 12 12 | else: -error[ANN201]: auto_return_type.py:16:5: [*] Missing return type annotation for public function `func` +error[ANN201]: 16:5: [*] Missing return type annotation for public function `func` + --> auto_return_type.py:16:5 | 16 | def func(): | ^^^^ @@ -71,8 +75,9 @@ error[ANN201]: auto_return_type.py:16:5: [*] Missing return type annotation for 18 18 | 19 19 | -error[ANN201]: auto_return_type.py:20:5: [*] Missing return type annotation for public function `func` +error[ANN201]: 20:5: [*] Missing return type annotation for public function `func` + --> auto_return_type.py:20:5 | 20 | def func(x: int): | ^^^^ @@ -90,8 +95,9 @@ error[ANN201]: auto_return_type.py:20:5: [*] Missing return type annotation for 22 22 | return None 23 23 | else: -error[ANN201]: auto_return_type.py:27:5: [*] Missing return type annotation for public function `func` +error[ANN201]: 27:5: [*] Missing return type annotation for public function `func` + --> auto_return_type.py:27:5 | 27 | def func(x: int): | ^^^^ @@ -113,8 +119,9 @@ error[ANN201]: auto_return_type.py:27:5: [*] Missing return type annotation for 29 30 | 30 31 | -error[ANN201]: auto_return_type.py:31:5: [*] Missing return type annotation for public function `func` +error[ANN201]: 31:5: [*] Missing return type annotation for public function `func` + --> auto_return_type.py:31:5 | 31 | def func(x: int): | ^^^^ @@ -136,8 +143,9 @@ error[ANN201]: auto_return_type.py:31:5: [*] Missing return type annotation for 33 34 | 34 35 | -error[ANN201]: auto_return_type.py:35:5: Missing return type annotation for public function `func` +error[ANN201]: 35:5: Missing return type annotation for public function `func` + --> auto_return_type.py:35:5 | 35 | def func(x: int): | ^^^^ @@ -145,16 +153,18 @@ error[ANN201]: auto_return_type.py:35:5: Missing return type annotation for publ 37 | return None | = help: Add return type annotation -error[ANN201]: auto_return_type.py:41:5: Missing return type annotation for public function `func` +error[ANN201]: 41:5: Missing return type annotation for public function `func` + --> auto_return_type.py:41:5 | 41 | def func(x: int): | ^^^^ 42 | return {"foo": 1} | = help: Add return type annotation -error[ANN201]: auto_return_type.py:45:5: [*] Missing return type annotation for public function `func` +error[ANN201]: 45:5: [*] Missing return type annotation for public function `func` + --> auto_return_type.py:45:5 | 45 | def func(x: int): | ^^^^ @@ -172,8 +182,9 @@ error[ANN201]: auto_return_type.py:45:5: [*] Missing return type annotation for 47 47 | return 1 48 48 | else: -error[ANN201]: auto_return_type.py:52:5: [*] Missing return type annotation for public function `func` +error[ANN201]: 52:5: [*] Missing return type annotation for public function `func` + --> auto_return_type.py:52:5 | 52 | def func(x: int): | ^^^^ @@ -196,8 +207,9 @@ error[ANN201]: auto_return_type.py:52:5: [*] Missing return type annotation for 54 55 | return 1 55 56 | else: -error[ANN201]: auto_return_type.py:59:5: [*] Missing return type annotation for public function `func` +error[ANN201]: 59:5: [*] Missing return type annotation for public function `func` + --> auto_return_type.py:59:5 | 59 | def func(x: int): | ^^^^ @@ -220,8 +232,9 @@ error[ANN201]: auto_return_type.py:59:5: [*] Missing return type annotation for 61 62 | return 1 62 63 | elif x > 5: -error[ANN201]: auto_return_type.py:68:5: [*] Missing return type annotation for public function `func` +error[ANN201]: 68:5: [*] Missing return type annotation for public function `func` + --> auto_return_type.py:68:5 | 68 | def func(x: int): | ^^^^ @@ -244,8 +257,9 @@ error[ANN201]: auto_return_type.py:68:5: [*] Missing return type annotation for 70 71 | return 1 71 72 | -error[ANN201]: auto_return_type.py:73:5: [*] Missing return type annotation for public function `func` +error[ANN201]: 73:5: [*] Missing return type annotation for public function `func` + --> auto_return_type.py:73:5 | 73 | def func(): | ^^^^ @@ -262,8 +276,9 @@ error[ANN201]: auto_return_type.py:73:5: [*] Missing return type annotation for 75 75 | 76 76 | -error[ANN201]: auto_return_type.py:77:5: [*] Missing return type annotation for public function `func` +error[ANN201]: 77:5: [*] Missing return type annotation for public function `func` + --> auto_return_type.py:77:5 | 77 | def func(x: int): | ^^^^ @@ -286,8 +301,9 @@ error[ANN201]: auto_return_type.py:77:5: [*] Missing return type annotation for 79 80 | return 1 80 81 | -error[ANN201]: auto_return_type.py:82:5: [*] Missing return type annotation for public function `func` +error[ANN201]: 82:5: [*] Missing return type annotation for public function `func` + --> auto_return_type.py:82:5 | 82 | def func(x: int): | ^^^^ @@ -310,8 +326,9 @@ error[ANN201]: auto_return_type.py:82:5: [*] Missing return type annotation for 84 85 | case [1, 2, 3]: 85 86 | return 1 -error[ANN201]: auto_return_type.py:90:5: [*] Missing return type annotation for public function `func` +error[ANN201]: 90:5: [*] Missing return type annotation for public function `func` + --> auto_return_type.py:90:5 | 90 | def func(x: int): | ^^^^ @@ -334,8 +351,9 @@ error[ANN201]: auto_return_type.py:90:5: [*] Missing return type annotation for 92 93 | if i > 0: 93 94 | return 1 -error[ANN201]: auto_return_type.py:96:5: [*] Missing return type annotation for public function `func` +error[ANN201]: 96:5: [*] Missing return type annotation for public function `func` + --> auto_return_type.py:96:5 | 96 | def func(x: int): | ^^^^ @@ -353,8 +371,9 @@ error[ANN201]: auto_return_type.py:96:5: [*] Missing return type annotation for 98 98 | if i > 0: 99 99 | return 1 -error[ANN201]: auto_return_type.py:104:5: [*] Missing return type annotation for public function `func` +error[ANN201]: 104:5: [*] Missing return type annotation for public function `func` + --> auto_return_type.py:104:5 | 104 | def func(x: int): | ^^^^ @@ -377,8 +396,9 @@ error[ANN201]: auto_return_type.py:104:5: [*] Missing return type annotation for 106 107 | if i > 0: 107 108 | break -error[ANN201]: auto_return_type.py:112:5: [*] Missing return type annotation for public function `func` +error[ANN201]: 112:5: [*] Missing return type annotation for public function `func` + --> auto_return_type.py:112:5 | 112 | def func(x: int): | ^^^^ @@ -401,8 +421,9 @@ error[ANN201]: auto_return_type.py:112:5: [*] Missing return type annotation for 114 115 | pass 115 116 | except: -error[ANN201]: auto_return_type.py:119:5: [*] Missing return type annotation for public function `func` +error[ANN201]: 119:5: [*] Missing return type annotation for public function `func` + --> auto_return_type.py:119:5 | 119 | def func(x: int): | ^^^^ @@ -420,8 +441,9 @@ error[ANN201]: auto_return_type.py:119:5: [*] Missing return type annotation for 121 121 | pass 122 122 | except: -error[ANN201]: auto_return_type.py:128:5: [*] Missing return type annotation for public function `func` +error[ANN201]: 128:5: [*] Missing return type annotation for public function `func` + --> auto_return_type.py:128:5 | 128 | def func(x: int): | ^^^^ @@ -439,8 +461,9 @@ error[ANN201]: auto_return_type.py:128:5: [*] Missing return type annotation for 130 130 | pass 131 131 | except: -error[ANN201]: auto_return_type.py:137:5: [*] Missing return type annotation for public function `func` +error[ANN201]: 137:5: [*] Missing return type annotation for public function `func` + --> auto_return_type.py:137:5 | 137 | def func(x: int): | ^^^^ @@ -463,8 +486,9 @@ error[ANN201]: auto_return_type.py:137:5: [*] Missing return type annotation for 139 140 | return 1 140 141 | except: -error[ANN201]: auto_return_type.py:146:5: [*] Missing return type annotation for public function `func` +error[ANN201]: 146:5: [*] Missing return type annotation for public function `func` + --> auto_return_type.py:146:5 | 146 | def func(x: int): | ^^^^ @@ -487,8 +511,9 @@ error[ANN201]: auto_return_type.py:146:5: [*] Missing return type annotation for 148 149 | break 149 150 | return 1 -error[ANN201]: auto_return_type.py:158:9: Missing return type annotation for public function `method` +error[ANN201]: 158:9: Missing return type annotation for public function `method` + --> auto_return_type.py:158:9 | 156 | class Foo(abc.ABC): 157 | @abstractmethod @@ -497,8 +522,9 @@ error[ANN201]: auto_return_type.py:158:9: Missing return type annotation for pub 159 | pass | = help: Add return type annotation -error[ANN201]: auto_return_type.py:162:9: Missing return type annotation for public function `method` +error[ANN201]: 162:9: Missing return type annotation for public function `method` + --> auto_return_type.py:162:9 | 161 | @abc.abstractmethod 162 | def method(self): @@ -506,8 +532,9 @@ error[ANN201]: auto_return_type.py:162:9: Missing return type annotation for pub 163 | """Docstring.""" | = help: Add return type annotation -error[ANN201]: auto_return_type.py:166:9: Missing return type annotation for public function `method` +error[ANN201]: 166:9: Missing return type annotation for public function `method` + --> auto_return_type.py:166:9 | 165 | @abc.abstractmethod 166 | def method(self): @@ -515,8 +542,9 @@ error[ANN201]: auto_return_type.py:166:9: Missing return type annotation for pub 167 | ... | = help: Add return type annotation -error[ANN205]: auto_return_type.py:171:9: Missing return type annotation for staticmethod `method` +error[ANN205]: 171:9: Missing return type annotation for staticmethod `method` + --> auto_return_type.py:171:9 | 169 | @staticmethod 170 | @abstractmethod @@ -525,8 +553,9 @@ error[ANN205]: auto_return_type.py:171:9: Missing return type annotation for sta 172 | pass | = help: Add return type annotation -error[ANN206]: auto_return_type.py:176:9: Missing return type annotation for classmethod `method` +error[ANN206]: 176:9: Missing return type annotation for classmethod `method` + --> auto_return_type.py:176:9 | 174 | @classmethod 175 | @abstractmethod @@ -535,8 +564,9 @@ error[ANN206]: auto_return_type.py:176:9: Missing return type annotation for cla 177 | pass | = help: Add return type annotation -error[ANN201]: auto_return_type.py:180:9: [*] Missing return type annotation for public function `method` +error[ANN201]: 180:9: [*] Missing return type annotation for public function `method` + --> auto_return_type.py:180:9 | 179 | @abstractmethod 180 | def method(self): @@ -555,8 +585,9 @@ error[ANN201]: auto_return_type.py:180:9: [*] Missing return type annotation for 182 182 | return 1 183 183 | else: -error[ANN201]: auto_return_type.py:187:5: [*] Missing return type annotation for public function `func` +error[ANN201]: 187:5: [*] Missing return type annotation for public function `func` + --> auto_return_type.py:187:5 | 187 | def func(x: int): | ^^^^ @@ -582,8 +613,9 @@ error[ANN201]: auto_return_type.py:187:5: [*] Missing return type annotation for 189 190 | pass 190 191 | except: -error[ANN201]: auto_return_type.py:194:5: [*] Missing return type annotation for public function `func` +error[ANN201]: 194:5: [*] Missing return type annotation for public function `func` + --> auto_return_type.py:194:5 | 194 | def func(x: int): | ^^^^ @@ -601,8 +633,9 @@ error[ANN201]: auto_return_type.py:194:5: [*] Missing return type annotation for 196 196 | pass 197 197 | except: -error[ANN201]: auto_return_type.py:203:5: [*] Missing return type annotation for public function `func` +error[ANN201]: 203:5: [*] Missing return type annotation for public function `func` + --> auto_return_type.py:203:5 | 203 | def func(x: int): | ^^^^ @@ -628,8 +661,9 @@ error[ANN201]: auto_return_type.py:203:5: [*] Missing return type annotation for 205 206 | raise ValueError 206 207 | else: -error[ANN201]: auto_return_type.py:210:5: [*] Missing return type annotation for public function `func` +error[ANN201]: 210:5: [*] Missing return type annotation for public function `func` + --> auto_return_type.py:210:5 | 210 | def func(x: int): | ^^^^ @@ -647,8 +681,9 @@ error[ANN201]: auto_return_type.py:210:5: [*] Missing return type annotation for 212 212 | raise ValueError 213 213 | else: -error[ANN201]: auto_return_type.py:234:5: [*] Missing return type annotation for public function `func` +error[ANN201]: 234:5: [*] Missing return type annotation for public function `func` + --> auto_return_type.py:234:5 | 234 | def func(x: int): | ^^^^ @@ -666,8 +701,9 @@ error[ANN201]: auto_return_type.py:234:5: [*] Missing return type annotation for 236 236 | return 1 237 237 | raise ValueError -error[ANN201]: auto_return_type.py:240:5: [*] Missing return type annotation for public function `func` +error[ANN201]: 240:5: [*] Missing return type annotation for public function `func` + --> auto_return_type.py:240:5 | 240 | def func(x: int): | ^^^^ @@ -685,8 +721,9 @@ error[ANN201]: auto_return_type.py:240:5: [*] Missing return type annotation for 242 242 | return 1 243 243 | else: -error[ANN201]: auto_return_type.py:248:5: [*] Missing return type annotation for public function `func` +error[ANN201]: 248:5: [*] Missing return type annotation for public function `func` + --> auto_return_type.py:248:5 | 248 | def func(): | ^^^^ @@ -713,8 +750,9 @@ error[ANN201]: auto_return_type.py:248:5: [*] Missing return type annotation for 250 250 | raise ValueError 251 251 | except: -error[ANN201]: auto_return_type.py:255:5: [*] Missing return type annotation for public function `func` +error[ANN201]: 255:5: [*] Missing return type annotation for public function `func` + --> auto_return_type.py:255:5 | 255 | def func(): | ^^^^ @@ -741,8 +779,9 @@ error[ANN201]: auto_return_type.py:255:5: [*] Missing return type annotation for 257 257 | return 1 258 258 | except: -error[ANN201]: auto_return_type.py:262:5: [*] Missing return type annotation for public function `func` +error[ANN201]: 262:5: [*] Missing return type annotation for public function `func` + --> auto_return_type.py:262:5 | 262 | def func(x: int): | ^^^^ @@ -760,8 +799,9 @@ error[ANN201]: auto_return_type.py:262:5: [*] Missing return type annotation for 264 264 | if x > 0: 265 265 | return 1 -error[ANN201]: auto_return_type.py:269:5: [*] Missing return type annotation for public function `func` +error[ANN201]: 269:5: [*] Missing return type annotation for public function `func` + --> auto_return_type.py:269:5 | 269 | def func(x: int): | ^^^^ @@ -779,8 +819,9 @@ error[ANN201]: auto_return_type.py:269:5: [*] Missing return type annotation for 271 271 | raise ValueError 272 272 | else: -error[ANN201]: auto_return_type.py:276:5: [*] Missing return type annotation for public function `func` +error[ANN201]: 276:5: [*] Missing return type annotation for public function `func` + --> auto_return_type.py:276:5 | 276 | def func(x: int): | ^^^^ @@ -798,8 +839,9 @@ error[ANN201]: auto_return_type.py:276:5: [*] Missing return type annotation for 278 278 | raise ValueError 279 279 | elif x > 10: -error[ANN201]: auto_return_type.py:283:5: [*] Missing return type annotation for public function `func` +error[ANN201]: 283:5: [*] Missing return type annotation for public function `func` + --> auto_return_type.py:283:5 | 283 | def func(x: int): | ^^^^ @@ -826,8 +868,9 @@ error[ANN201]: auto_return_type.py:283:5: [*] Missing return type annotation for 285 285 | raise ValueError 286 286 | elif x > 10: -error[ANN201]: auto_return_type.py:290:5: [*] Missing return type annotation for public function `func` +error[ANN201]: 290:5: [*] Missing return type annotation for public function `func` + --> auto_return_type.py:290:5 | 290 | def func(): | ^^^^ @@ -845,8 +888,9 @@ error[ANN201]: auto_return_type.py:290:5: [*] Missing return type annotation for 292 292 | return 5 293 293 | except: -error[ANN201]: auto_return_type.py:299:5: [*] Missing return type annotation for public function `func` +error[ANN201]: 299:5: [*] Missing return type annotation for public function `func` + --> auto_return_type.py:299:5 | 299 | def func(x: int): | ^^^^ diff --git a/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__defaults.snap b/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__defaults.snap index 080995d584..87035f805b 100644 --- a/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__defaults.snap +++ b/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__defaults.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_annotations/mod.rs --- -error[ANN201]: annotation_presence.py:5:5: [*] Missing return type annotation for public function `foo` +error[ANN201]: 5:5: [*] Missing return type annotation for public function `foo` + --> annotation_presence.py:5:5 | 4 | # Error 5 | def foo(a, b): @@ -20,24 +21,27 @@ error[ANN201]: annotation_presence.py:5:5: [*] Missing return type annotation fo 7 7 | 8 8 | -error[ANN001]: annotation_presence.py:5:9: Missing type annotation for function argument `a` +error[ANN001]: 5:9: Missing type annotation for function argument `a` + --> annotation_presence.py:5:9 | 4 | # Error 5 | def foo(a, b): | ^ 6 | pass | -error[ANN001]: annotation_presence.py:5:12: Missing type annotation for function argument `b` +error[ANN001]: 5:12: Missing type annotation for function argument `b` + --> annotation_presence.py:5:12 | 4 | # Error 5 | def foo(a, b): | ^ 6 | pass | -error[ANN201]: annotation_presence.py:10:5: [*] Missing return type annotation for public function `foo` +error[ANN201]: 10:5: [*] Missing return type annotation for public function `foo` + --> annotation_presence.py:10:5 | 9 | # Error 10 | def foo(a: int, b): @@ -55,24 +59,27 @@ error[ANN201]: annotation_presence.py:10:5: [*] Missing return type annotation f 12 12 | 13 13 | -error[ANN001]: annotation_presence.py:10:17: Missing type annotation for function argument `b` +error[ANN001]: 10:17: Missing type annotation for function argument `b` + --> annotation_presence.py:10:17 | 9 | # Error 10 | def foo(a: int, b): | ^ 11 | pass | -error[ANN001]: annotation_presence.py:15:17: Missing type annotation for function argument `b` +error[ANN001]: 15:17: Missing type annotation for function argument `b` + --> annotation_presence.py:15:17 | 14 | # Error 15 | def foo(a: int, b) -> int: | ^ 16 | pass | -error[ANN201]: annotation_presence.py:20:5: [*] Missing return type annotation for public function `foo` +error[ANN201]: 20:5: [*] Missing return type annotation for public function `foo` + --> annotation_presence.py:20:5 | 19 | # Error 20 | def foo(a: int, b: int): @@ -90,8 +97,9 @@ error[ANN201]: annotation_presence.py:20:5: [*] Missing return type annotation f 22 22 | 23 23 | -error[ANN201]: annotation_presence.py:25:5: [*] Missing return type annotation for public function `foo` +error[ANN201]: 25:5: [*] Missing return type annotation for public function `foo` + --> annotation_presence.py:25:5 | 24 | # Error 25 | def foo(): @@ -109,112 +117,126 @@ error[ANN201]: annotation_presence.py:25:5: [*] Missing return type annotation f 27 27 | 28 28 | -error[ANN401]: annotation_presence.py:45:12: Dynamically typed expressions (typing.Any) are disallowed in `a` +error[ANN401]: 45:12: Dynamically typed expressions (typing.Any) are disallowed in `a` + --> annotation_presence.py:45:12 | 44 | # ANN401 45 | def foo(a: Any, *args: str, **kwargs: str) -> int: | ^^^ 46 | pass | -error[ANN401]: annotation_presence.py:50:47: Dynamically typed expressions (typing.Any) are disallowed in `foo` +error[ANN401]: 50:47: Dynamically typed expressions (typing.Any) are disallowed in `foo` + --> annotation_presence.py:50:47 | 49 | # ANN401 50 | def foo(a: int, *args: str, **kwargs: str) -> Any: | ^^^ 51 | pass | -error[ANN401]: annotation_presence.py:55:24: Dynamically typed expressions (typing.Any) are disallowed in `*args` +error[ANN401]: 55:24: Dynamically typed expressions (typing.Any) are disallowed in `*args` + --> annotation_presence.py:55:24 | 54 | # ANN401 55 | def foo(a: int, *args: Any, **kwargs: Any) -> int: | ^^^ 56 | pass | -error[ANN401]: annotation_presence.py:55:39: Dynamically typed expressions (typing.Any) are disallowed in `**kwargs` +error[ANN401]: 55:39: Dynamically typed expressions (typing.Any) are disallowed in `**kwargs` + --> annotation_presence.py:55:39 | 54 | # ANN401 55 | def foo(a: int, *args: Any, **kwargs: Any) -> int: | ^^^ 56 | pass | -error[ANN401]: annotation_presence.py:60:24: Dynamically typed expressions (typing.Any) are disallowed in `*args` +error[ANN401]: 60:24: Dynamically typed expressions (typing.Any) are disallowed in `*args` + --> annotation_presence.py:60:24 | 59 | # ANN401 60 | def foo(a: int, *args: Any, **kwargs: str) -> int: | ^^^ 61 | pass | -error[ANN401]: annotation_presence.py:65:39: Dynamically typed expressions (typing.Any) are disallowed in `**kwargs` +error[ANN401]: 65:39: Dynamically typed expressions (typing.Any) are disallowed in `**kwargs` + --> annotation_presence.py:65:39 | 64 | # ANN401 65 | def foo(a: int, *args: str, **kwargs: Any) -> int: | ^^^ 66 | pass | -error[ANN101]: annotation_presence.py:75:13: Missing type annotation for `self` in method +error[ANN101]: 75:13: Missing type annotation for `self` in method + --> annotation_presence.py:75:13 | 74 | # ANN101 75 | def foo(self, a: int, b: int) -> int: | ^^^^ 76 | pass | -error[ANN401]: annotation_presence.py:79:29: Dynamically typed expressions (typing.Any) are disallowed in `a` +error[ANN401]: 79:29: Dynamically typed expressions (typing.Any) are disallowed in `a` + --> annotation_presence.py:79:29 | 78 | # ANN401 79 | def foo(self: "Foo", a: Any, *params: str, **options: str) -> int: | ^^^ 80 | pass | -error[ANN401]: annotation_presence.py:83:67: Dynamically typed expressions (typing.Any) are disallowed in `foo` +error[ANN401]: 83:67: Dynamically typed expressions (typing.Any) are disallowed in `foo` + --> annotation_presence.py:83:67 | 82 | # ANN401 83 | def foo(self: "Foo", a: int, *params: str, **options: str) -> Any: | ^^^ 84 | pass | -error[ANN401]: annotation_presence.py:87:43: Dynamically typed expressions (typing.Any) are disallowed in `*params` +error[ANN401]: 87:43: Dynamically typed expressions (typing.Any) are disallowed in `*params` + --> annotation_presence.py:87:43 | 86 | # ANN401 87 | def foo(self: "Foo", a: int, *params: Any, **options: Any) -> int: | ^^^ 88 | pass | -error[ANN401]: annotation_presence.py:87:59: Dynamically typed expressions (typing.Any) are disallowed in `**options` +error[ANN401]: 87:59: Dynamically typed expressions (typing.Any) are disallowed in `**options` + --> annotation_presence.py:87:59 | 86 | # ANN401 87 | def foo(self: "Foo", a: int, *params: Any, **options: Any) -> int: | ^^^ 88 | pass | -error[ANN401]: annotation_presence.py:91:43: Dynamically typed expressions (typing.Any) are disallowed in `*params` +error[ANN401]: 91:43: Dynamically typed expressions (typing.Any) are disallowed in `*params` + --> annotation_presence.py:91:43 | 90 | # ANN401 91 | def foo(self: "Foo", a: int, *params: Any, **options: str) -> int: | ^^^ 92 | pass | -error[ANN401]: annotation_presence.py:95:59: Dynamically typed expressions (typing.Any) are disallowed in `**options` +error[ANN401]: 95:59: Dynamically typed expressions (typing.Any) are disallowed in `**options` + --> annotation_presence.py:95:59 | 94 | # ANN401 95 | def foo(self: "Foo", a: int, *params: str, **options: Any) -> int: | ^^^ 96 | pass | -error[ANN102]: annotation_presence.py:130:13: Missing type annotation for `cls` in classmethod +error[ANN102]: 130:13: Missing type annotation for `cls` in classmethod + --> annotation_presence.py:130:13 | 128 | # ANN102 129 | @classmethod @@ -222,16 +244,18 @@ error[ANN102]: annotation_presence.py:130:13: Missing type annotation for `cls` | ^^^ 131 | pass | -error[ANN101]: annotation_presence.py:134:13: Missing type annotation for `self` in method +error[ANN101]: 134:13: Missing type annotation for `self` in method + --> annotation_presence.py:134:13 | 133 | # ANN101 134 | def foo(self, /, a: int, b: int) -> int: | ^^^^ 135 | pass | -error[ANN401]: annotation_presence.py:149:10: Dynamically typed expressions (typing.Any) are disallowed in `a` +error[ANN401]: 149:10: Dynamically typed expressions (typing.Any) are disallowed in `a` + --> annotation_presence.py:149:10 | 148 | # ANN401 149 | def f(a: Any | int) -> None: ... @@ -239,8 +263,9 @@ error[ANN401]: annotation_presence.py:149:10: Dynamically typed expressions (typ 150 | def f(a: int | Any) -> None: ... 151 | def f(a: Union[str, bytes, Any]) -> None: ... | -error[ANN401]: annotation_presence.py:150:10: Dynamically typed expressions (typing.Any) are disallowed in `a` +error[ANN401]: 150:10: Dynamically typed expressions (typing.Any) are disallowed in `a` + --> annotation_presence.py:150:10 | 148 | # ANN401 149 | def f(a: Any | int) -> None: ... @@ -249,8 +274,9 @@ error[ANN401]: annotation_presence.py:150:10: Dynamically typed expressions (typ 151 | def f(a: Union[str, bytes, Any]) -> None: ... 152 | def f(a: Optional[Any]) -> None: ... | -error[ANN401]: annotation_presence.py:151:10: Dynamically typed expressions (typing.Any) are disallowed in `a` +error[ANN401]: 151:10: Dynamically typed expressions (typing.Any) are disallowed in `a` + --> annotation_presence.py:151:10 | 149 | def f(a: Any | int) -> None: ... 150 | def f(a: int | Any) -> None: ... @@ -259,8 +285,9 @@ error[ANN401]: annotation_presence.py:151:10: Dynamically typed expressions (typ 152 | def f(a: Optional[Any]) -> None: ... 153 | def f(a: Annotated[Any, ...]) -> None: ... | -error[ANN401]: annotation_presence.py:152:10: Dynamically typed expressions (typing.Any) are disallowed in `a` +error[ANN401]: 152:10: Dynamically typed expressions (typing.Any) are disallowed in `a` + --> annotation_presence.py:152:10 | 150 | def f(a: int | Any) -> None: ... 151 | def f(a: Union[str, bytes, Any]) -> None: ... @@ -269,8 +296,9 @@ error[ANN401]: annotation_presence.py:152:10: Dynamically typed expressions (typ 153 | def f(a: Annotated[Any, ...]) -> None: ... 154 | def f(a: "Union[str, bytes, Any]") -> None: ... | -error[ANN401]: annotation_presence.py:153:10: Dynamically typed expressions (typing.Any) are disallowed in `a` +error[ANN401]: 153:10: Dynamically typed expressions (typing.Any) are disallowed in `a` + --> annotation_presence.py:153:10 | 151 | def f(a: Union[str, bytes, Any]) -> None: ... 152 | def f(a: Optional[Any]) -> None: ... @@ -278,16 +306,18 @@ error[ANN401]: annotation_presence.py:153:10: Dynamically typed expressions (typ | ^^^^^^^^^^^^^^^^^^^ 154 | def f(a: "Union[str, bytes, Any]") -> None: ... | -error[ANN401]: annotation_presence.py:154:10: Dynamically typed expressions (typing.Any) are disallowed in `a` +error[ANN401]: 154:10: Dynamically typed expressions (typing.Any) are disallowed in `a` + --> annotation_presence.py:154:10 | 152 | def f(a: Optional[Any]) -> None: ... 153 | def f(a: Annotated[Any, ...]) -> None: ... 154 | def f(a: "Union[str, bytes, Any]") -> None: ... | ^^^^^^^^^^^^^^^^^^^^^^^^ | -error[ANN204]: annotation_presence.py:159:9: [*] Missing return type annotation for special method `__init__` +error[ANN204]: 159:9: [*] Missing return type annotation for special method `__init__` + --> annotation_presence.py:159:9 | 157 | class Foo: 158 | @decorator() @@ -306,8 +336,9 @@ error[ANN204]: annotation_presence.py:159:9: [*] Missing return type annotation 161 161 | 162 162 | -error[ANN204]: annotation_presence.py:165:9: [*] Missing return type annotation for special method `__init__` +error[ANN204]: 165:9: [*] Missing return type annotation for special method `__init__` + --> annotation_presence.py:165:9 | 163 | # Regression test for: https://github.com/astral-sh/ruff/issues/7711 164 | class Class: @@ -324,8 +355,9 @@ error[ANN204]: annotation_presence.py:165:9: [*] Missing return type annotation 165 |+ def __init__(self) -> None: 166 166 | print(f"{self.attr=}") -error[ANN101]: annotation_presence.py:165:18: Missing type annotation for `self` in method +error[ANN101]: 165:18: Missing type annotation for `self` in method + --> annotation_presence.py:165:18 | 163 | # Regression test for: https://github.com/astral-sh/ruff/issues/7711 164 | class Class: diff --git a/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__ignore_fully_untyped.snap b/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__ignore_fully_untyped.snap index cc00095750..7d55ffaca5 100644 --- a/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__ignore_fully_untyped.snap +++ b/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__ignore_fully_untyped.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_annotations/mod.rs --- -error[ANN201]: ignore_fully_untyped.py:24:5: [*] Missing return type annotation for public function `error_partially_typed_1` +error[ANN201]: 24:5: [*] Missing return type annotation for public function `error_partially_typed_1` + --> ignore_fully_untyped.py:24:5 | 24 | def error_partially_typed_1(a: int, b): | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -19,22 +20,25 @@ error[ANN201]: ignore_fully_untyped.py:24:5: [*] Missing return type annotation 26 26 | 27 27 | -error[ANN001]: ignore_fully_untyped.py:24:37: Missing type annotation for function argument `b` +error[ANN001]: 24:37: Missing type annotation for function argument `b` + --> ignore_fully_untyped.py:24:37 | 24 | def error_partially_typed_1(a: int, b): | ^ 25 | pass | -error[ANN001]: ignore_fully_untyped.py:28:37: Missing type annotation for function argument `b` +error[ANN001]: 28:37: Missing type annotation for function argument `b` + --> ignore_fully_untyped.py:28:37 | 28 | def error_partially_typed_2(a: int, b) -> int: | ^ 29 | pass | -error[ANN201]: ignore_fully_untyped.py:32:5: [*] Missing return type annotation for public function `error_partially_typed_3` +error[ANN201]: 32:5: [*] Missing return type annotation for public function `error_partially_typed_3` + --> ignore_fully_untyped.py:32:5 | 32 | def error_partially_typed_3(a: int, b: int): | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -51,8 +55,9 @@ error[ANN201]: ignore_fully_untyped.py:32:5: [*] Missing return type annotation 34 34 | 35 35 | -error[ANN201]: ignore_fully_untyped.py:43:9: [*] Missing return type annotation for public function `error_typed_self` +error[ANN201]: 43:9: [*] Missing return type annotation for public function `error_typed_self` + --> ignore_fully_untyped.py:43:9 | 41 | pass 42 | diff --git a/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__mypy_init_return.snap b/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__mypy_init_return.snap index 049a5f9e11..4b323bfabd 100644 --- a/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__mypy_init_return.snap +++ b/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__mypy_init_return.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_annotations/mod.rs --- -error[ANN204]: mypy_init_return.py:5:9: [*] Missing return type annotation for special method `__init__` +error[ANN204]: 5:9: [*] Missing return type annotation for special method `__init__` + --> mypy_init_return.py:5:9 | 3 | # Error 4 | class Foo: @@ -21,8 +22,9 @@ error[ANN204]: mypy_init_return.py:5:9: [*] Missing return type annotation for s 7 7 | 8 8 | -error[ANN204]: mypy_init_return.py:11:9: [*] Missing return type annotation for special method `__init__` +error[ANN204]: 11:9: [*] Missing return type annotation for special method `__init__` + --> mypy_init_return.py:11:9 | 9 | # Error 10 | class Foo: @@ -41,8 +43,9 @@ error[ANN204]: mypy_init_return.py:11:9: [*] Missing return type annotation for 13 13 | 14 14 | -error[ANN202]: mypy_init_return.py:40:5: [*] Missing return type annotation for private function `__init__` +error[ANN202]: 40:5: [*] Missing return type annotation for private function `__init__` + --> mypy_init_return.py:40:5 | 39 | # Error 40 | def __init__(self, foo: int): @@ -60,8 +63,9 @@ error[ANN202]: mypy_init_return.py:40:5: [*] Missing return type annotation for 42 42 | 43 43 | -error[ANN204]: mypy_init_return.py:47:9: [*] Missing return type annotation for special method `__init__` +error[ANN204]: 47:9: [*] Missing return type annotation for special method `__init__` + --> mypy_init_return.py:47:9 | 45 | # of a vararg falsely indicated that the function has a typed argument. 46 | class Foo: diff --git a/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__simple_magic_methods.snap b/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__simple_magic_methods.snap index 7677dfb7fa..e5ada5a2f6 100644 --- a/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__simple_magic_methods.snap +++ b/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__simple_magic_methods.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_annotations/mod.rs --- -error[ANN204]: simple_magic_methods.py:2:9: [*] Missing return type annotation for special method `__str__` +error[ANN204]: 2:9: [*] Missing return type annotation for special method `__str__` + --> simple_magic_methods.py:2:9 | 1 | class Foo: 2 | def __str__(self): @@ -18,8 +19,9 @@ error[ANN204]: simple_magic_methods.py:2:9: [*] Missing return type annotation f 4 4 | 5 5 | def __repr__(self): -error[ANN204]: simple_magic_methods.py:5:9: [*] Missing return type annotation for special method `__repr__` +error[ANN204]: 5:9: [*] Missing return type annotation for special method `__repr__` + --> simple_magic_methods.py:5:9 | 3 | ... 4 | @@ -38,8 +40,9 @@ error[ANN204]: simple_magic_methods.py:5:9: [*] Missing return type annotation f 7 7 | 8 8 | def __len__(self): -error[ANN204]: simple_magic_methods.py:8:9: [*] Missing return type annotation for special method `__len__` +error[ANN204]: 8:9: [*] Missing return type annotation for special method `__len__` + --> simple_magic_methods.py:8:9 | 6 | ... 7 | @@ -58,8 +61,9 @@ error[ANN204]: simple_magic_methods.py:8:9: [*] Missing return type annotation f 10 10 | 11 11 | def __length_hint__(self): -error[ANN204]: simple_magic_methods.py:11:9: [*] Missing return type annotation for special method `__length_hint__` +error[ANN204]: 11:9: [*] Missing return type annotation for special method `__length_hint__` + --> simple_magic_methods.py:11:9 | 9 | ... 10 | @@ -78,8 +82,9 @@ error[ANN204]: simple_magic_methods.py:11:9: [*] Missing return type annotation 13 13 | 14 14 | def __init__(self): -error[ANN204]: simple_magic_methods.py:14:9: [*] Missing return type annotation for special method `__init__` +error[ANN204]: 14:9: [*] Missing return type annotation for special method `__init__` + --> simple_magic_methods.py:14:9 | 12 | ... 13 | @@ -98,8 +103,9 @@ error[ANN204]: simple_magic_methods.py:14:9: [*] Missing return type annotation 16 16 | 17 17 | def __del__(self): -error[ANN204]: simple_magic_methods.py:17:9: [*] Missing return type annotation for special method `__del__` +error[ANN204]: 17:9: [*] Missing return type annotation for special method `__del__` + --> simple_magic_methods.py:17:9 | 15 | ... 16 | @@ -118,8 +124,9 @@ error[ANN204]: simple_magic_methods.py:17:9: [*] Missing return type annotation 19 19 | 20 20 | def __bool__(self): -error[ANN204]: simple_magic_methods.py:20:9: [*] Missing return type annotation for special method `__bool__` +error[ANN204]: 20:9: [*] Missing return type annotation for special method `__bool__` + --> simple_magic_methods.py:20:9 | 18 | ... 19 | @@ -138,8 +145,9 @@ error[ANN204]: simple_magic_methods.py:20:9: [*] Missing return type annotation 22 22 | 23 23 | def __bytes__(self): -error[ANN204]: simple_magic_methods.py:23:9: [*] Missing return type annotation for special method `__bytes__` +error[ANN204]: 23:9: [*] Missing return type annotation for special method `__bytes__` + --> simple_magic_methods.py:23:9 | 21 | ... 22 | @@ -158,8 +166,9 @@ error[ANN204]: simple_magic_methods.py:23:9: [*] Missing return type annotation 25 25 | 26 26 | def __format__(self, format_spec): -error[ANN204]: simple_magic_methods.py:26:9: [*] Missing return type annotation for special method `__format__` +error[ANN204]: 26:9: [*] Missing return type annotation for special method `__format__` + --> simple_magic_methods.py:26:9 | 24 | ... 25 | @@ -178,8 +187,9 @@ error[ANN204]: simple_magic_methods.py:26:9: [*] Missing return type annotation 28 28 | 29 29 | def __contains__(self, item): -error[ANN204]: simple_magic_methods.py:29:9: [*] Missing return type annotation for special method `__contains__` +error[ANN204]: 29:9: [*] Missing return type annotation for special method `__contains__` + --> simple_magic_methods.py:29:9 | 27 | ... 28 | @@ -198,8 +208,9 @@ error[ANN204]: simple_magic_methods.py:29:9: [*] Missing return type annotation 31 31 | 32 32 | def __complex__(self): -error[ANN204]: simple_magic_methods.py:32:9: [*] Missing return type annotation for special method `__complex__` +error[ANN204]: 32:9: [*] Missing return type annotation for special method `__complex__` + --> simple_magic_methods.py:32:9 | 30 | ... 31 | @@ -218,8 +229,9 @@ error[ANN204]: simple_magic_methods.py:32:9: [*] Missing return type annotation 34 34 | 35 35 | def __int__(self): -error[ANN204]: simple_magic_methods.py:35:9: [*] Missing return type annotation for special method `__int__` +error[ANN204]: 35:9: [*] Missing return type annotation for special method `__int__` + --> simple_magic_methods.py:35:9 | 33 | ... 34 | @@ -238,8 +250,9 @@ error[ANN204]: simple_magic_methods.py:35:9: [*] Missing return type annotation 37 37 | 38 38 | def __float__(self): -error[ANN204]: simple_magic_methods.py:38:9: [*] Missing return type annotation for special method `__float__` +error[ANN204]: 38:9: [*] Missing return type annotation for special method `__float__` + --> simple_magic_methods.py:38:9 | 36 | ... 37 | @@ -258,8 +271,9 @@ error[ANN204]: simple_magic_methods.py:38:9: [*] Missing return type annotation 40 40 | 41 41 | def __index__(self): -error[ANN204]: simple_magic_methods.py:41:9: [*] Missing return type annotation for special method `__index__` +error[ANN204]: 41:9: [*] Missing return type annotation for special method `__index__` + --> simple_magic_methods.py:41:9 | 39 | ... 40 | diff --git a/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__suppress_none_returning.snap b/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__suppress_none_returning.snap index 53c461dd9d..ca41773e34 100644 --- a/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__suppress_none_returning.snap +++ b/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__suppress_none_returning.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_annotations/mod.rs --- -error[ANN201]: suppress_none_returning.py:45:5: [*] Missing return type annotation for public function `foo` +error[ANN201]: 45:5: [*] Missing return type annotation for public function `foo` + --> suppress_none_returning.py:45:5 | 44 | # Error 45 | def foo(): @@ -20,8 +21,9 @@ error[ANN201]: suppress_none_returning.py:45:5: [*] Missing return type annotati 47 47 | 48 48 | -error[ANN201]: suppress_none_returning.py:50:5: [*] Missing return type annotation for public function `foo` +error[ANN201]: 50:5: [*] Missing return type annotation for public function `foo` + --> suppress_none_returning.py:50:5 | 49 | # Error 50 | def foo(): @@ -40,8 +42,9 @@ error[ANN201]: suppress_none_returning.py:50:5: [*] Missing return type annotati 52 52 | if a == 4: 53 53 | return True -error[ANN001]: suppress_none_returning.py:59:9: Missing type annotation for function argument `a` +error[ANN001]: 59:9: Missing type annotation for function argument `a` + --> suppress_none_returning.py:59:9 | 58 | # Error (on the argument, but not the return type) 59 | def foo(a): diff --git a/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC100_ASYNC100.py.snap b/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC100_ASYNC100.py.snap index 0eca205a5b..a1907a5189 100644 --- a/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC100_ASYNC100.py.snap +++ b/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC100_ASYNC100.py.snap @@ -1,101 +1,113 @@ --- source: crates/ruff_linter/src/rules/flake8_async/mod.rs --- -ASYNC100.py:8:5: ASYNC100 A `with trio.fail_after(...):` context does not contain any `await` statements. This makes it pointless, as the timeout can only be triggered by a checkpoint. +error[ASYNC100]: 8:5: A `with trio.fail_after(...):` context does not contain any `await` statements. This makes it pointless, as the timeout can only be triggered by a checkpoint. + + --> ASYNC100.py:8:5 | 7 | async def func(): 8 | with trio.fail_after(): | _____^ 9 | | ... - | |___________^ ASYNC100 + | |___________^ | +error[ASYNC100]: 18:5: A `with trio.move_on_after(...):` context does not contain any `await` statements. This makes it pointless, as the timeout can only be triggered by a checkpoint. -ASYNC100.py:18:5: ASYNC100 A `with trio.move_on_after(...):` context does not contain any `await` statements. This makes it pointless, as the timeout can only be triggered by a checkpoint. + --> ASYNC100.py:18:5 | 17 | async def func(): 18 | with trio.move_on_after(): | _____^ 19 | | ... - | |___________^ ASYNC100 + | |___________^ | +error[ASYNC100]: 40:5: A `with anyio.move_on_after(...):` context does not contain any `await` statements. This makes it pointless, as the timeout can only be triggered by a checkpoint. -ASYNC100.py:40:5: ASYNC100 A `with anyio.move_on_after(...):` context does not contain any `await` statements. This makes it pointless, as the timeout can only be triggered by a checkpoint. + --> ASYNC100.py:40:5 | 39 | async def func(): 40 | with anyio.move_on_after(delay=0.2): | _____^ 41 | | ... - | |___________^ ASYNC100 + | |___________^ | +error[ASYNC100]: 45:5: A `with anyio.fail_after(...):` context does not contain any `await` statements. This makes it pointless, as the timeout can only be triggered by a checkpoint. -ASYNC100.py:45:5: ASYNC100 A `with anyio.fail_after(...):` context does not contain any `await` statements. This makes it pointless, as the timeout can only be triggered by a checkpoint. + --> ASYNC100.py:45:5 | 44 | async def func(): 45 | with anyio.fail_after(): | _____^ 46 | | ... - | |___________^ ASYNC100 + | |___________^ | +error[ASYNC100]: 50:5: A `with anyio.CancelScope(...):` context does not contain any `await` statements. This makes it pointless, as the timeout can only be triggered by a checkpoint. -ASYNC100.py:50:5: ASYNC100 A `with anyio.CancelScope(...):` context does not contain any `await` statements. This makes it pointless, as the timeout can only be triggered by a checkpoint. + --> ASYNC100.py:50:5 | 49 | async def func(): 50 | with anyio.CancelScope(): | _____^ 51 | | ... - | |___________^ ASYNC100 + | |___________^ | +error[ASYNC100]: 55:5: A `with anyio.CancelScope(...):` context does not contain any `await` statements. This makes it pointless, as the timeout can only be triggered by a checkpoint. -ASYNC100.py:55:5: ASYNC100 A `with anyio.CancelScope(...):` context does not contain any `await` statements. This makes it pointless, as the timeout can only be triggered by a checkpoint. + --> ASYNC100.py:55:5 | 54 | async def func(): 55 | with anyio.CancelScope(), nullcontext(): | _____^ 56 | | ... - | |___________^ ASYNC100 + | |___________^ | +error[ASYNC100]: 60:5: A `with anyio.CancelScope(...):` context does not contain any `await` statements. This makes it pointless, as the timeout can only be triggered by a checkpoint. -ASYNC100.py:60:5: ASYNC100 A `with anyio.CancelScope(...):` context does not contain any `await` statements. This makes it pointless, as the timeout can only be triggered by a checkpoint. + --> ASYNC100.py:60:5 | 59 | async def func(): 60 | with nullcontext(), anyio.CancelScope(): | _____^ 61 | | ... - | |___________^ ASYNC100 + | |___________^ | +error[ASYNC100]: 65:5: A `with asyncio.timeout(...):` context does not contain any `await` statements. This makes it pointless, as the timeout can only be triggered by a checkpoint. -ASYNC100.py:65:5: ASYNC100 A `with asyncio.timeout(...):` context does not contain any `await` statements. This makes it pointless, as the timeout can only be triggered by a checkpoint. + --> ASYNC100.py:65:5 | 64 | async def func(): 65 | async with asyncio.timeout(delay=0.2): | _____^ 66 | | ... - | |___________^ ASYNC100 + | |___________^ | +error[ASYNC100]: 70:5: A `with asyncio.timeout_at(...):` context does not contain any `await` statements. This makes it pointless, as the timeout can only be triggered by a checkpoint. -ASYNC100.py:70:5: ASYNC100 A `with asyncio.timeout_at(...):` context does not contain any `await` statements. This makes it pointless, as the timeout can only be triggered by a checkpoint. + --> ASYNC100.py:70:5 | 69 | async def func(): 70 | async with asyncio.timeout_at(when=0.2): | _____^ 71 | | ... - | |___________^ ASYNC100 + | |___________^ | +error[ASYNC100]: 80:5: A `with asyncio.timeout(...):` context does not contain any `await` statements. This makes it pointless, as the timeout can only be triggered by a checkpoint. -ASYNC100.py:80:5: ASYNC100 A `with asyncio.timeout(...):` context does not contain any `await` statements. This makes it pointless, as the timeout can only be triggered by a checkpoint. + --> ASYNC100.py:80:5 | 79 | async def func(): 80 | async with asyncio.timeout(delay=0.2), asyncio.TaskGroup(), asyncio.timeout(delay=0.2): | _____^ 81 | | ... - | |___________^ ASYNC100 + | |___________^ | +error[ASYNC100]: 90:5: A `with asyncio.timeout(...):` context does not contain any `await` statements. This makes it pointless, as the timeout can only be triggered by a checkpoint. -ASYNC100.py:90:5: ASYNC100 A `with asyncio.timeout(...):` context does not contain any `await` statements. This makes it pointless, as the timeout can only be triggered by a checkpoint. + --> ASYNC100.py:90:5 | 89 | async def func(): 90 | async with asyncio.timeout(delay=0.2), asyncio.timeout(delay=0.2): | _____^ 91 | | ... - | |___________^ ASYNC100 + | |___________^ | diff --git a/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC105_ASYNC105.py.snap b/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC105_ASYNC105.py.snap index 1595cdc008..68fcc23644 100644 --- a/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC105_ASYNC105.py.snap +++ b/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC105_ASYNC105.py.snap @@ -1,16 +1,17 @@ --- source: crates/ruff_linter/src/rules/flake8_async/mod.rs --- -ASYNC105.py:30:5: ASYNC105 [*] Call to `trio.aclose_forcefully` is not immediately awaited +error[ASYNC105]: 30:5: [*] Call to `trio.aclose_forcefully` is not immediately awaited + + --> ASYNC105.py:30:5 | 29 | # ASYNC105 30 | trio.aclose_forcefully(foo) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ASYNC105 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ 31 | trio.open_file(foo) 32 | trio.open_ssl_over_tcp_listeners(foo, foo) | = help: Add `await` - ℹ Unsafe fix 27 27 | await trio.lowlevel.wait_writable(foo) 28 28 | @@ -21,17 +22,18 @@ ASYNC105.py:30:5: ASYNC105 [*] Call to `trio.aclose_forcefully` is not immediate 32 32 | trio.open_ssl_over_tcp_listeners(foo, foo) 33 33 | trio.open_ssl_over_tcp_stream(foo, foo) -ASYNC105.py:31:5: ASYNC105 [*] Call to `trio.open_file` is not immediately awaited +error[ASYNC105]: 31:5: [*] Call to `trio.open_file` is not immediately awaited + + --> ASYNC105.py:31:5 | 29 | # ASYNC105 30 | trio.aclose_forcefully(foo) 31 | trio.open_file(foo) - | ^^^^^^^^^^^^^^^^^^^ ASYNC105 + | ^^^^^^^^^^^^^^^^^^^ 32 | trio.open_ssl_over_tcp_listeners(foo, foo) 33 | trio.open_ssl_over_tcp_stream(foo, foo) | = help: Add `await` - ℹ Unsafe fix 28 28 | 29 29 | # ASYNC105 @@ -42,17 +44,18 @@ ASYNC105.py:31:5: ASYNC105 [*] Call to `trio.open_file` is not immediately await 33 33 | trio.open_ssl_over_tcp_stream(foo, foo) 34 34 | trio.open_tcp_listeners(foo) -ASYNC105.py:32:5: ASYNC105 [*] Call to `trio.open_ssl_over_tcp_listeners` is not immediately awaited +error[ASYNC105]: 32:5: [*] Call to `trio.open_ssl_over_tcp_listeners` is not immediately awaited + + --> ASYNC105.py:32:5 | 30 | trio.aclose_forcefully(foo) 31 | trio.open_file(foo) 32 | trio.open_ssl_over_tcp_listeners(foo, foo) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ASYNC105 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 33 | trio.open_ssl_over_tcp_stream(foo, foo) 34 | trio.open_tcp_listeners(foo) | = help: Add `await` - ℹ Unsafe fix 29 29 | # ASYNC105 30 30 | trio.aclose_forcefully(foo) @@ -63,17 +66,18 @@ ASYNC105.py:32:5: ASYNC105 [*] Call to `trio.open_ssl_over_tcp_listeners` is not 34 34 | trio.open_tcp_listeners(foo) 35 35 | trio.open_tcp_stream(foo, foo) -ASYNC105.py:33:5: ASYNC105 [*] Call to `trio.open_ssl_over_tcp_stream` is not immediately awaited +error[ASYNC105]: 33:5: [*] Call to `trio.open_ssl_over_tcp_stream` is not immediately awaited + + --> ASYNC105.py:33:5 | 31 | trio.open_file(foo) 32 | trio.open_ssl_over_tcp_listeners(foo, foo) 33 | trio.open_ssl_over_tcp_stream(foo, foo) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ASYNC105 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 34 | trio.open_tcp_listeners(foo) 35 | trio.open_tcp_stream(foo, foo) | = help: Add `await` - ℹ Unsafe fix 30 30 | trio.aclose_forcefully(foo) 31 31 | trio.open_file(foo) @@ -84,17 +88,18 @@ ASYNC105.py:33:5: ASYNC105 [*] Call to `trio.open_ssl_over_tcp_stream` is not im 35 35 | trio.open_tcp_stream(foo, foo) 36 36 | trio.open_unix_socket(foo) -ASYNC105.py:34:5: ASYNC105 [*] Call to `trio.open_tcp_listeners` is not immediately awaited +error[ASYNC105]: 34:5: [*] Call to `trio.open_tcp_listeners` is not immediately awaited + + --> ASYNC105.py:34:5 | 32 | trio.open_ssl_over_tcp_listeners(foo, foo) 33 | trio.open_ssl_over_tcp_stream(foo, foo) 34 | trio.open_tcp_listeners(foo) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ASYNC105 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 35 | trio.open_tcp_stream(foo, foo) 36 | trio.open_unix_socket(foo) | = help: Add `await` - ℹ Unsafe fix 31 31 | trio.open_file(foo) 32 32 | trio.open_ssl_over_tcp_listeners(foo, foo) @@ -105,17 +110,18 @@ ASYNC105.py:34:5: ASYNC105 [*] Call to `trio.open_tcp_listeners` is not immediat 36 36 | trio.open_unix_socket(foo) 37 37 | trio.run_process(foo) -ASYNC105.py:35:5: ASYNC105 [*] Call to `trio.open_tcp_stream` is not immediately awaited +error[ASYNC105]: 35:5: [*] Call to `trio.open_tcp_stream` is not immediately awaited + + --> ASYNC105.py:35:5 | 33 | trio.open_ssl_over_tcp_stream(foo, foo) 34 | trio.open_tcp_listeners(foo) 35 | trio.open_tcp_stream(foo, foo) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ASYNC105 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 36 | trio.open_unix_socket(foo) 37 | trio.run_process(foo) | = help: Add `await` - ℹ Unsafe fix 32 32 | trio.open_ssl_over_tcp_listeners(foo, foo) 33 33 | trio.open_ssl_over_tcp_stream(foo, foo) @@ -126,17 +132,18 @@ ASYNC105.py:35:5: ASYNC105 [*] Call to `trio.open_tcp_stream` is not immediately 37 37 | trio.run_process(foo) 38 38 | trio.serve_listeners(foo, foo) -ASYNC105.py:36:5: ASYNC105 [*] Call to `trio.open_unix_socket` is not immediately awaited +error[ASYNC105]: 36:5: [*] Call to `trio.open_unix_socket` is not immediately awaited + + --> ASYNC105.py:36:5 | 34 | trio.open_tcp_listeners(foo) 35 | trio.open_tcp_stream(foo, foo) 36 | trio.open_unix_socket(foo) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ ASYNC105 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ 37 | trio.run_process(foo) 38 | trio.serve_listeners(foo, foo) | = help: Add `await` - ℹ Unsafe fix 33 33 | trio.open_ssl_over_tcp_stream(foo, foo) 34 34 | trio.open_tcp_listeners(foo) @@ -147,17 +154,18 @@ ASYNC105.py:36:5: ASYNC105 [*] Call to `trio.open_unix_socket` is not immediatel 38 38 | trio.serve_listeners(foo, foo) 39 39 | trio.serve_ssl_over_tcp(foo, foo, foo) -ASYNC105.py:37:5: ASYNC105 [*] Call to `trio.run_process` is not immediately awaited +error[ASYNC105]: 37:5: [*] Call to `trio.run_process` is not immediately awaited + + --> ASYNC105.py:37:5 | 35 | trio.open_tcp_stream(foo, foo) 36 | trio.open_unix_socket(foo) 37 | trio.run_process(foo) - | ^^^^^^^^^^^^^^^^^^^^^ ASYNC105 + | ^^^^^^^^^^^^^^^^^^^^^ 38 | trio.serve_listeners(foo, foo) 39 | trio.serve_ssl_over_tcp(foo, foo, foo) | = help: Add `await` - ℹ Unsafe fix 34 34 | trio.open_tcp_listeners(foo) 35 35 | trio.open_tcp_stream(foo, foo) @@ -168,17 +176,18 @@ ASYNC105.py:37:5: ASYNC105 [*] Call to `trio.run_process` is not immediately awa 39 39 | trio.serve_ssl_over_tcp(foo, foo, foo) 40 40 | trio.serve_tcp(foo, foo) -ASYNC105.py:38:5: ASYNC105 [*] Call to `trio.serve_listeners` is not immediately awaited +error[ASYNC105]: 38:5: [*] Call to `trio.serve_listeners` is not immediately awaited + + --> ASYNC105.py:38:5 | 36 | trio.open_unix_socket(foo) 37 | trio.run_process(foo) 38 | trio.serve_listeners(foo, foo) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ASYNC105 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 39 | trio.serve_ssl_over_tcp(foo, foo, foo) 40 | trio.serve_tcp(foo, foo) | = help: Add `await` - ℹ Unsafe fix 35 35 | trio.open_tcp_stream(foo, foo) 36 36 | trio.open_unix_socket(foo) @@ -189,17 +198,18 @@ ASYNC105.py:38:5: ASYNC105 [*] Call to `trio.serve_listeners` is not immediately 40 40 | trio.serve_tcp(foo, foo) 41 41 | trio.sleep(foo) -ASYNC105.py:39:5: ASYNC105 [*] Call to `trio.serve_ssl_over_tcp` is not immediately awaited +error[ASYNC105]: 39:5: [*] Call to `trio.serve_ssl_over_tcp` is not immediately awaited + + --> ASYNC105.py:39:5 | 37 | trio.run_process(foo) 38 | trio.serve_listeners(foo, foo) 39 | trio.serve_ssl_over_tcp(foo, foo, foo) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ASYNC105 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 40 | trio.serve_tcp(foo, foo) 41 | trio.sleep(foo) | = help: Add `await` - ℹ Unsafe fix 36 36 | trio.open_unix_socket(foo) 37 37 | trio.run_process(foo) @@ -210,17 +220,18 @@ ASYNC105.py:39:5: ASYNC105 [*] Call to `trio.serve_ssl_over_tcp` is not immediat 41 41 | trio.sleep(foo) 42 42 | trio.sleep_forever() -ASYNC105.py:40:5: ASYNC105 [*] Call to `trio.serve_tcp` is not immediately awaited +error[ASYNC105]: 40:5: [*] Call to `trio.serve_tcp` is not immediately awaited + + --> ASYNC105.py:40:5 | 38 | trio.serve_listeners(foo, foo) 39 | trio.serve_ssl_over_tcp(foo, foo, foo) 40 | trio.serve_tcp(foo, foo) - | ^^^^^^^^^^^^^^^^^^^^^^^^ ASYNC105 + | ^^^^^^^^^^^^^^^^^^^^^^^^ 41 | trio.sleep(foo) 42 | trio.sleep_forever() | = help: Add `await` - ℹ Unsafe fix 37 37 | trio.run_process(foo) 38 38 | trio.serve_listeners(foo, foo) @@ -231,17 +242,18 @@ ASYNC105.py:40:5: ASYNC105 [*] Call to `trio.serve_tcp` is not immediately await 42 42 | trio.sleep_forever() 43 43 | trio.sleep_until(foo) -ASYNC105.py:41:5: ASYNC105 [*] Call to `trio.sleep` is not immediately awaited +error[ASYNC105]: 41:5: [*] Call to `trio.sleep` is not immediately awaited + + --> ASYNC105.py:41:5 | 39 | trio.serve_ssl_over_tcp(foo, foo, foo) 40 | trio.serve_tcp(foo, foo) 41 | trio.sleep(foo) - | ^^^^^^^^^^^^^^^ ASYNC105 + | ^^^^^^^^^^^^^^^ 42 | trio.sleep_forever() 43 | trio.sleep_until(foo) | = help: Add `await` - ℹ Unsafe fix 38 38 | trio.serve_listeners(foo, foo) 39 39 | trio.serve_ssl_over_tcp(foo, foo, foo) @@ -252,17 +264,18 @@ ASYNC105.py:41:5: ASYNC105 [*] Call to `trio.sleep` is not immediately awaited 43 43 | trio.sleep_until(foo) 44 44 | trio.lowlevel.cancel_shielded_checkpoint() -ASYNC105.py:42:5: ASYNC105 [*] Call to `trio.sleep_forever` is not immediately awaited +error[ASYNC105]: 42:5: [*] Call to `trio.sleep_forever` is not immediately awaited + + --> ASYNC105.py:42:5 | 40 | trio.serve_tcp(foo, foo) 41 | trio.sleep(foo) 42 | trio.sleep_forever() - | ^^^^^^^^^^^^^^^^^^^^ ASYNC105 + | ^^^^^^^^^^^^^^^^^^^^ 43 | trio.sleep_until(foo) 44 | trio.lowlevel.cancel_shielded_checkpoint() | = help: Add `await` - ℹ Unsafe fix 39 39 | trio.serve_ssl_over_tcp(foo, foo, foo) 40 40 | trio.serve_tcp(foo, foo) @@ -273,17 +286,18 @@ ASYNC105.py:42:5: ASYNC105 [*] Call to `trio.sleep_forever` is not immediately a 44 44 | trio.lowlevel.cancel_shielded_checkpoint() 45 45 | trio.lowlevel.checkpoint() -ASYNC105.py:44:5: ASYNC105 [*] Call to `trio.lowlevel.cancel_shielded_checkpoint` is not immediately awaited +error[ASYNC105]: 44:5: [*] Call to `trio.lowlevel.cancel_shielded_checkpoint` is not immediately awaited + + --> ASYNC105.py:44:5 | 42 | trio.sleep_forever() 43 | trio.sleep_until(foo) 44 | trio.lowlevel.cancel_shielded_checkpoint() - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ASYNC105 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 45 | trio.lowlevel.checkpoint() 46 | trio.lowlevel.checkpoint_if_cancelled() | = help: Add `await` - ℹ Unsafe fix 41 41 | trio.sleep(foo) 42 42 | trio.sleep_forever() @@ -294,17 +308,18 @@ ASYNC105.py:44:5: ASYNC105 [*] Call to `trio.lowlevel.cancel_shielded_checkpoint 46 46 | trio.lowlevel.checkpoint_if_cancelled() 47 47 | trio.lowlevel.open_process() -ASYNC105.py:45:5: ASYNC105 [*] Call to `trio.lowlevel.checkpoint` is not immediately awaited +error[ASYNC105]: 45:5: [*] Call to `trio.lowlevel.checkpoint` is not immediately awaited + + --> ASYNC105.py:45:5 | 43 | trio.sleep_until(foo) 44 | trio.lowlevel.cancel_shielded_checkpoint() 45 | trio.lowlevel.checkpoint() - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ ASYNC105 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ 46 | trio.lowlevel.checkpoint_if_cancelled() 47 | trio.lowlevel.open_process() | = help: Add `await` - ℹ Unsafe fix 42 42 | trio.sleep_forever() 43 43 | trio.sleep_until(foo) @@ -315,17 +330,18 @@ ASYNC105.py:45:5: ASYNC105 [*] Call to `trio.lowlevel.checkpoint` is not immedia 47 47 | trio.lowlevel.open_process() 48 48 | trio.lowlevel.permanently_detach_coroutine_object(foo) -ASYNC105.py:46:5: ASYNC105 [*] Call to `trio.lowlevel.checkpoint_if_cancelled` is not immediately awaited +error[ASYNC105]: 46:5: [*] Call to `trio.lowlevel.checkpoint_if_cancelled` is not immediately awaited + + --> ASYNC105.py:46:5 | 44 | trio.lowlevel.cancel_shielded_checkpoint() 45 | trio.lowlevel.checkpoint() 46 | trio.lowlevel.checkpoint_if_cancelled() - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ASYNC105 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 47 | trio.lowlevel.open_process() 48 | trio.lowlevel.permanently_detach_coroutine_object(foo) | = help: Add `await` - ℹ Unsafe fix 43 43 | trio.sleep_until(foo) 44 44 | trio.lowlevel.cancel_shielded_checkpoint() @@ -336,17 +352,18 @@ ASYNC105.py:46:5: ASYNC105 [*] Call to `trio.lowlevel.checkpoint_if_cancelled` i 48 48 | trio.lowlevel.permanently_detach_coroutine_object(foo) 49 49 | trio.lowlevel.reattach_detached_coroutine_object(foo, foo) -ASYNC105.py:47:5: ASYNC105 [*] Call to `trio.lowlevel.open_process` is not immediately awaited +error[ASYNC105]: 47:5: [*] Call to `trio.lowlevel.open_process` is not immediately awaited + + --> ASYNC105.py:47:5 | 45 | trio.lowlevel.checkpoint() 46 | trio.lowlevel.checkpoint_if_cancelled() 47 | trio.lowlevel.open_process() - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ASYNC105 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 48 | trio.lowlevel.permanently_detach_coroutine_object(foo) 49 | trio.lowlevel.reattach_detached_coroutine_object(foo, foo) | = help: Add `await` - ℹ Unsafe fix 44 44 | trio.lowlevel.cancel_shielded_checkpoint() 45 45 | trio.lowlevel.checkpoint() @@ -357,17 +374,18 @@ ASYNC105.py:47:5: ASYNC105 [*] Call to `trio.lowlevel.open_process` is not immed 49 49 | trio.lowlevel.reattach_detached_coroutine_object(foo, foo) 50 50 | trio.lowlevel.temporarily_detach_coroutine_object(foo) -ASYNC105.py:48:5: ASYNC105 [*] Call to `trio.lowlevel.permanently_detach_coroutine_object` is not immediately awaited +error[ASYNC105]: 48:5: [*] Call to `trio.lowlevel.permanently_detach_coroutine_object` is not immediately awaited + + --> ASYNC105.py:48:5 | 46 | trio.lowlevel.checkpoint_if_cancelled() 47 | trio.lowlevel.open_process() 48 | trio.lowlevel.permanently_detach_coroutine_object(foo) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ASYNC105 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 49 | trio.lowlevel.reattach_detached_coroutine_object(foo, foo) 50 | trio.lowlevel.temporarily_detach_coroutine_object(foo) | = help: Add `await` - ℹ Unsafe fix 45 45 | trio.lowlevel.checkpoint() 46 46 | trio.lowlevel.checkpoint_if_cancelled() @@ -378,17 +396,18 @@ ASYNC105.py:48:5: ASYNC105 [*] Call to `trio.lowlevel.permanently_detach_corouti 50 50 | trio.lowlevel.temporarily_detach_coroutine_object(foo) 51 51 | trio.lowlevel.wait_readable(foo) -ASYNC105.py:49:5: ASYNC105 [*] Call to `trio.lowlevel.reattach_detached_coroutine_object` is not immediately awaited +error[ASYNC105]: 49:5: [*] Call to `trio.lowlevel.reattach_detached_coroutine_object` is not immediately awaited + + --> ASYNC105.py:49:5 | 47 | trio.lowlevel.open_process() 48 | trio.lowlevel.permanently_detach_coroutine_object(foo) 49 | trio.lowlevel.reattach_detached_coroutine_object(foo, foo) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ASYNC105 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 50 | trio.lowlevel.temporarily_detach_coroutine_object(foo) 51 | trio.lowlevel.wait_readable(foo) | = help: Add `await` - ℹ Unsafe fix 46 46 | trio.lowlevel.checkpoint_if_cancelled() 47 47 | trio.lowlevel.open_process() @@ -399,17 +418,18 @@ ASYNC105.py:49:5: ASYNC105 [*] Call to `trio.lowlevel.reattach_detached_coroutin 51 51 | trio.lowlevel.wait_readable(foo) 52 52 | trio.lowlevel.wait_task_rescheduled(foo) -ASYNC105.py:50:5: ASYNC105 [*] Call to `trio.lowlevel.temporarily_detach_coroutine_object` is not immediately awaited +error[ASYNC105]: 50:5: [*] Call to `trio.lowlevel.temporarily_detach_coroutine_object` is not immediately awaited + + --> ASYNC105.py:50:5 | 48 | trio.lowlevel.permanently_detach_coroutine_object(foo) 49 | trio.lowlevel.reattach_detached_coroutine_object(foo, foo) 50 | trio.lowlevel.temporarily_detach_coroutine_object(foo) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ASYNC105 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 51 | trio.lowlevel.wait_readable(foo) 52 | trio.lowlevel.wait_task_rescheduled(foo) | = help: Add `await` - ℹ Unsafe fix 47 47 | trio.lowlevel.open_process() 48 48 | trio.lowlevel.permanently_detach_coroutine_object(foo) @@ -420,17 +440,18 @@ ASYNC105.py:50:5: ASYNC105 [*] Call to `trio.lowlevel.temporarily_detach_corouti 52 52 | trio.lowlevel.wait_task_rescheduled(foo) 53 53 | trio.lowlevel.wait_writable(foo) -ASYNC105.py:51:5: ASYNC105 [*] Call to `trio.lowlevel.wait_readable` is not immediately awaited +error[ASYNC105]: 51:5: [*] Call to `trio.lowlevel.wait_readable` is not immediately awaited + + --> ASYNC105.py:51:5 | 49 | trio.lowlevel.reattach_detached_coroutine_object(foo, foo) 50 | trio.lowlevel.temporarily_detach_coroutine_object(foo) 51 | trio.lowlevel.wait_readable(foo) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ASYNC105 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 52 | trio.lowlevel.wait_task_rescheduled(foo) 53 | trio.lowlevel.wait_writable(foo) | = help: Add `await` - ℹ Unsafe fix 48 48 | trio.lowlevel.permanently_detach_coroutine_object(foo) 49 49 | trio.lowlevel.reattach_detached_coroutine_object(foo, foo) @@ -441,16 +462,17 @@ ASYNC105.py:51:5: ASYNC105 [*] Call to `trio.lowlevel.wait_readable` is not imme 53 53 | trio.lowlevel.wait_writable(foo) 54 54 | -ASYNC105.py:52:5: ASYNC105 [*] Call to `trio.lowlevel.wait_task_rescheduled` is not immediately awaited +error[ASYNC105]: 52:5: [*] Call to `trio.lowlevel.wait_task_rescheduled` is not immediately awaited + + --> ASYNC105.py:52:5 | 50 | trio.lowlevel.temporarily_detach_coroutine_object(foo) 51 | trio.lowlevel.wait_readable(foo) 52 | trio.lowlevel.wait_task_rescheduled(foo) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ASYNC105 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 53 | trio.lowlevel.wait_writable(foo) | = help: Add `await` - ℹ Unsafe fix 49 49 | trio.lowlevel.reattach_detached_coroutine_object(foo, foo) 50 50 | trio.lowlevel.temporarily_detach_coroutine_object(foo) @@ -461,17 +483,18 @@ ASYNC105.py:52:5: ASYNC105 [*] Call to `trio.lowlevel.wait_task_rescheduled` is 54 54 | 55 55 | async with await trio.open_file(foo): # Ok -ASYNC105.py:53:5: ASYNC105 [*] Call to `trio.lowlevel.wait_writable` is not immediately awaited +error[ASYNC105]: 53:5: [*] Call to `trio.lowlevel.wait_writable` is not immediately awaited + + --> ASYNC105.py:53:5 | 51 | trio.lowlevel.wait_readable(foo) 52 | trio.lowlevel.wait_task_rescheduled(foo) 53 | trio.lowlevel.wait_writable(foo) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ASYNC105 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 54 | 55 | async with await trio.open_file(foo): # Ok | = help: Add `await` - ℹ Unsafe fix 50 50 | trio.lowlevel.temporarily_detach_coroutine_object(foo) 51 51 | trio.lowlevel.wait_readable(foo) @@ -482,16 +505,17 @@ ASYNC105.py:53:5: ASYNC105 [*] Call to `trio.lowlevel.wait_writable` is not imme 55 55 | async with await trio.open_file(foo): # Ok 56 56 | pass -ASYNC105.py:58:16: ASYNC105 [*] Call to `trio.open_file` is not immediately awaited +error[ASYNC105]: 58:16: [*] Call to `trio.open_file` is not immediately awaited + + --> ASYNC105.py:58:16 | 56 | pass 57 | 58 | async with trio.open_file(foo): # ASYNC105 - | ^^^^^^^^^^^^^^^^^^^ ASYNC105 + | ^^^^^^^^^^^^^^^^^^^ 59 | pass | = help: Add `await` - ℹ Unsafe fix 55 55 | async with await trio.open_file(foo): # Ok 56 56 | pass @@ -502,11 +526,13 @@ ASYNC105.py:58:16: ASYNC105 [*] Call to `trio.open_file` is not immediately awai 60 60 | 61 61 | -ASYNC105.py:64:5: ASYNC105 Call to `trio.open_file` is not immediately awaited +error[ASYNC105]: 64:5: Call to `trio.open_file` is not immediately awaited + + --> ASYNC105.py:64:5 | 62 | def func() -> None: 63 | # ASYNC105 (without fix) 64 | trio.open_file(foo) - | ^^^^^^^^^^^^^^^^^^^ ASYNC105 + | ^^^^^^^^^^^^^^^^^^^ | = help: Add `await` diff --git a/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC109_ASYNC109_0.py.snap b/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC109_ASYNC109_0.py.snap index 1a624f6dc4..7cff33f250 100644 --- a/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC109_ASYNC109_0.py.snap +++ b/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC109_ASYNC109_0.py.snap @@ -1,18 +1,21 @@ --- source: crates/ruff_linter/src/rules/flake8_async/mod.rs --- -ASYNC109_0.py:8:16: ASYNC109 Async function definition with a `timeout` parameter +error[ASYNC109]: 8:16: Async function definition with a `timeout` parameter + + --> ASYNC109_0.py:8:16 | 8 | async def func(timeout): - | ^^^^^^^ ASYNC109 + | ^^^^^^^ 9 | ... | = help: Use `trio.fail_after` instead +error[ASYNC109]: 12:16: Async function definition with a `timeout` parameter -ASYNC109_0.py:12:16: ASYNC109 Async function definition with a `timeout` parameter + --> ASYNC109_0.py:12:16 | 12 | async def func(timeout=10): - | ^^^^^^^^^^ ASYNC109 + | ^^^^^^^^^^ 13 | ... | = help: Use `trio.fail_after` instead diff --git a/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC109_ASYNC109_1.py.snap b/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC109_ASYNC109_1.py.snap index 5f24e49845..ef1db9638c 100644 --- a/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC109_ASYNC109_1.py.snap +++ b/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC109_ASYNC109_1.py.snap @@ -1,18 +1,21 @@ --- source: crates/ruff_linter/src/rules/flake8_async/mod.rs --- -ASYNC109_1.py:5:16: ASYNC109 Async function definition with a `timeout` parameter +error[ASYNC109]: 5:16: Async function definition with a `timeout` parameter + + --> ASYNC109_1.py:5:16 | 5 | async def func(timeout): - | ^^^^^^^ ASYNC109 + | ^^^^^^^ 6 | ... | = help: Use `asyncio.timeout` instead +error[ASYNC109]: 9:16: Async function definition with a `timeout` parameter -ASYNC109_1.py:9:16: ASYNC109 Async function definition with a `timeout` parameter + --> ASYNC109_1.py:9:16 | 9 | async def func(timeout=10): - | ^^^^^^^^^^ ASYNC109 + | ^^^^^^^^^^ 10 | ... | = help: Use `asyncio.timeout` instead diff --git a/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC110_ASYNC110.py.snap b/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC110_ASYNC110.py.snap index c878faddf0..c116ee77f1 100644 --- a/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC110_ASYNC110.py.snap +++ b/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC110_ASYNC110.py.snap @@ -1,47 +1,53 @@ --- source: crates/ruff_linter/src/rules/flake8_async/mod.rs --- -ASYNC110.py:7:5: ASYNC110 Use `trio.Event` instead of awaiting `trio.sleep` in a `while` loop +error[ASYNC110]: 7:5: Use `trio.Event` instead of awaiting `trio.sleep` in a `while` loop + + --> ASYNC110.py:7:5 | 6 | async def func(): 7 | while True: | _____^ 8 | | await trio.sleep(10) - | |____________________________^ ASYNC110 + | |____________________________^ | +error[ASYNC110]: 12:5: Use `trio.Event` instead of awaiting `trio.sleep` in a `while` loop -ASYNC110.py:12:5: ASYNC110 Use `trio.Event` instead of awaiting `trio.sleep` in a `while` loop + --> ASYNC110.py:12:5 | 11 | async def func(): 12 | while True: | _____^ 13 | | await trio.sleep_until(10) - | |__________________________________^ ASYNC110 + | |__________________________________^ | +error[ASYNC110]: 22:5: Use `asyncio.Event` instead of awaiting `asyncio.sleep` in a `while` loop -ASYNC110.py:22:5: ASYNC110 Use `asyncio.Event` instead of awaiting `asyncio.sleep` in a `while` loop + --> ASYNC110.py:22:5 | 21 | async def func(): 22 | while True: | _____^ 23 | | await anyio.sleep(10) - | |_____________________________^ ASYNC110 + | |_____________________________^ | +error[ASYNC110]: 27:5: Use `asyncio.Event` instead of awaiting `asyncio.sleep` in a `while` loop -ASYNC110.py:27:5: ASYNC110 Use `asyncio.Event` instead of awaiting `asyncio.sleep` in a `while` loop + --> ASYNC110.py:27:5 | 26 | async def func(): 27 | while True: | _____^ 28 | | await anyio.sleep_until(10) - | |___________________________________^ ASYNC110 + | |___________________________________^ | +error[ASYNC110]: 37:5: Use `anyio.Event` instead of awaiting `anyio.sleep` in a `while` loop -ASYNC110.py:37:5: ASYNC110 Use `anyio.Event` instead of awaiting `anyio.sleep` in a `while` loop + --> ASYNC110.py:37:5 | 36 | async def func(): 37 | while True: | _____^ 38 | | await asyncio.sleep(10) - | |_______________________________^ ASYNC110 + | |_______________________________^ | diff --git a/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC115_ASYNC115.py.snap b/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC115_ASYNC115.py.snap index 3e40da955d..f048bbe48f 100644 --- a/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC115_ASYNC115.py.snap +++ b/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC115_ASYNC115.py.snap @@ -1,17 +1,18 @@ --- source: crates/ruff_linter/src/rules/flake8_async/mod.rs --- -ASYNC115.py:5:11: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio.sleep(0)` +error[ASYNC115]: 5:11: [*] Use `trio.lowlevel.checkpoint()` instead of `trio.sleep(0)` + + --> ASYNC115.py:5:11 | 3 | from trio import sleep 4 | 5 | await trio.sleep(0) # ASYNC115 - | ^^^^^^^^^^^^^ ASYNC115 + | ^^^^^^^^^^^^^ 6 | await trio.sleep(1) # OK 7 | await trio.sleep(0, 1) # OK | = help: Replace with `trio.lowlevel.checkpoint()` - ℹ Safe fix 2 2 | import trio 3 3 | from trio import sleep @@ -22,17 +23,18 @@ ASYNC115.py:5:11: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio 7 7 | await trio.sleep(0, 1) # OK 8 8 | await trio.sleep(...) # OK -ASYNC115.py:11:5: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio.sleep(0)` +error[ASYNC115]: 11:5: [*] Use `trio.lowlevel.checkpoint()` instead of `trio.sleep(0)` + + --> ASYNC115.py:11:5 | 9 | await trio.sleep() # OK 10 | 11 | trio.sleep(0) # ASYNC115 - | ^^^^^^^^^^^^^ ASYNC115 + | ^^^^^^^^^^^^^ 12 | foo = 0 13 | trio.sleep(foo) # OK | = help: Replace with `trio.lowlevel.checkpoint()` - ℹ Safe fix 8 8 | await trio.sleep(...) # OK 9 9 | await trio.sleep() # OK @@ -43,17 +45,18 @@ ASYNC115.py:11:5: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio 13 13 | trio.sleep(foo) # OK 14 14 | trio.sleep(1) # OK -ASYNC115.py:17:5: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio.sleep(0)` +error[ASYNC115]: 17:5: [*] Use `trio.lowlevel.checkpoint()` instead of `trio.sleep(0)` + + --> ASYNC115.py:17:5 | 15 | time.sleep(0) # OK 16 | 17 | sleep(0) # ASYNC115 - | ^^^^^^^^ ASYNC115 + | ^^^^^^^^ 18 | 19 | bar = "bar" | = help: Replace with `trio.lowlevel.checkpoint()` - ℹ Safe fix 14 14 | trio.sleep(1) # OK 15 15 | time.sleep(0) # OK @@ -64,15 +67,16 @@ ASYNC115.py:17:5: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio 19 19 | bar = "bar" 20 20 | trio.sleep(bar) -ASYNC115.py:48:14: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio.sleep(0)` +error[ASYNC115]: 48:14: [*] Use `trio.lowlevel.checkpoint()` instead of `trio.sleep(0)` + + --> ASYNC115.py:48:14 | 46 | import trio 47 | 48 | trio.run(trio.sleep(0)) # ASYNC115 - | ^^^^^^^^^^^^^ ASYNC115 + | ^^^^^^^^^^^^^ | = help: Replace with `trio.lowlevel.checkpoint()` - ℹ Safe fix 45 45 | def func(): 46 46 | import trio @@ -83,14 +87,15 @@ ASYNC115.py:48:14: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `tri 50 50 | 51 51 | from trio import Event, sleep -ASYNC115.py:55:5: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio.sleep(0)` +error[ASYNC115]: 55:5: [*] Use `trio.lowlevel.checkpoint()` instead of `trio.sleep(0)` + + --> ASYNC115.py:55:5 | 54 | def func(): 55 | sleep(0) # ASYNC115 - | ^^^^^^^^ ASYNC115 + | ^^^^^^^^ | = help: Replace with `trio.lowlevel.checkpoint()` - ℹ Safe fix 48 48 | trio.run(trio.sleep(0)) # ASYNC115 49 49 | @@ -106,14 +111,15 @@ ASYNC115.py:55:5: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio 57 57 | 58 58 | async def func(): -ASYNC115.py:59:11: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio.sleep(0)` +error[ASYNC115]: 59:11: [*] Use `trio.lowlevel.checkpoint()` instead of `trio.sleep(0)` + + --> ASYNC115.py:59:11 | 58 | async def func(): 59 | await sleep(seconds=0) # ASYNC115 - | ^^^^^^^^^^^^^^^^ ASYNC115 + | ^^^^^^^^^^^^^^^^ | = help: Replace with `trio.lowlevel.checkpoint()` - ℹ Safe fix 48 48 | trio.run(trio.sleep(0)) # ASYNC115 49 49 | @@ -133,17 +139,18 @@ ASYNC115.py:59:11: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `tri 61 61 | 62 62 | def func(): -ASYNC115.py:85:11: ASYNC115 [*] Use `asyncio.lowlevel.checkpoint()` instead of `asyncio.sleep(0)` +error[ASYNC115]: 85:11: [*] Use `asyncio.lowlevel.checkpoint()` instead of `asyncio.sleep(0)` + + --> ASYNC115.py:85:11 | 83 | from anyio import sleep 84 | 85 | await anyio.sleep(0) # ASYNC115 - | ^^^^^^^^^^^^^^ ASYNC115 + | ^^^^^^^^^^^^^^ 86 | await anyio.sleep(1) # OK 87 | await anyio.sleep(0, 1) # OK | = help: Replace with `asyncio.lowlevel.checkpoint()` - ℹ Safe fix 49 49 | 50 50 | @@ -162,17 +169,18 @@ ASYNC115.py:85:11: ASYNC115 [*] Use `asyncio.lowlevel.checkpoint()` instead of ` 87 88 | await anyio.sleep(0, 1) # OK 88 89 | await anyio.sleep(...) # OK -ASYNC115.py:91:5: ASYNC115 [*] Use `asyncio.lowlevel.checkpoint()` instead of `asyncio.sleep(0)` +error[ASYNC115]: 91:5: [*] Use `asyncio.lowlevel.checkpoint()` instead of `asyncio.sleep(0)` + + --> ASYNC115.py:91:5 | 89 | await anyio.sleep() # OK 90 | 91 | anyio.sleep(0) # ASYNC115 - | ^^^^^^^^^^^^^^ ASYNC115 + | ^^^^^^^^^^^^^^ 92 | foo = 0 93 | anyio.sleep(foo) # OK | = help: Replace with `asyncio.lowlevel.checkpoint()` - ℹ Safe fix 49 49 | 50 50 | @@ -191,17 +199,18 @@ ASYNC115.py:91:5: ASYNC115 [*] Use `asyncio.lowlevel.checkpoint()` instead of `a 93 94 | anyio.sleep(foo) # OK 94 95 | anyio.sleep(1) # OK -ASYNC115.py:97:5: ASYNC115 [*] Use `asyncio.lowlevel.checkpoint()` instead of `asyncio.sleep(0)` +error[ASYNC115]: 97:5: [*] Use `asyncio.lowlevel.checkpoint()` instead of `asyncio.sleep(0)` + + --> ASYNC115.py:97:5 | 95 | time.sleep(0) # OK 96 | 97 | sleep(0) # ASYNC115 - | ^^^^^^^^ ASYNC115 + | ^^^^^^^^ 98 | 99 | bar = "bar" | = help: Replace with `asyncio.lowlevel.checkpoint()` - ℹ Safe fix 49 49 | 50 50 | @@ -220,15 +229,16 @@ ASYNC115.py:97:5: ASYNC115 [*] Use `asyncio.lowlevel.checkpoint()` instead of `a 99 100 | bar = "bar" 100 101 | anyio.sleep(bar) -ASYNC115.py:128:15: ASYNC115 [*] Use `asyncio.lowlevel.checkpoint()` instead of `asyncio.sleep(0)` +error[ASYNC115]: 128:15: [*] Use `asyncio.lowlevel.checkpoint()` instead of `asyncio.sleep(0)` + + --> ASYNC115.py:128:15 | 126 | import anyio 127 | 128 | anyio.run(anyio.sleep(0)) # ASYNC115 - | ^^^^^^^^^^^^^^ ASYNC115 + | ^^^^^^^^^^^^^^ | = help: Replace with `asyncio.lowlevel.checkpoint()` - ℹ Safe fix 49 49 | 50 50 | diff --git a/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC116_ASYNC116.py.snap b/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC116_ASYNC116.py.snap index 144033875d..cc093f8961 100644 --- a/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC116_ASYNC116.py.snap +++ b/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC116_ASYNC116.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_async/mod.rs --- -error[ASYNC116]: ASYNC116.py:11:11: [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep_forever()` +error[ASYNC116]: 11:11: [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep_forever()` + --> ASYNC116.py:11:11 | 10 | # These examples are probably not meant to ever wake up: 11 | await trio.sleep(100000) # error: 116, "async" @@ -21,8 +22,9 @@ error[ASYNC116]: ASYNC116.py:11:11: [*] `trio.sleep()` with >24 hour interval sh 13 13 | # 'inf literal' overflow trick 14 14 | await trio.sleep(1e999) # error: 116, "async" -error[ASYNC116]: ASYNC116.py:14:11: [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep_forever()` +error[ASYNC116]: 14:11: [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep_forever()` + --> ASYNC116.py:14:11 | 13 | # 'inf literal' overflow trick 14 | await trio.sleep(1e999) # error: 116, "async" @@ -41,8 +43,9 @@ error[ASYNC116]: ASYNC116.py:14:11: [*] `trio.sleep()` with >24 hour interval sh 16 16 | await trio.sleep(86399) 17 17 | await trio.sleep(86400) -error[ASYNC116]: ASYNC116.py:18:11: [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep_forever()` +error[ASYNC116]: 18:11: [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep_forever()` + --> ASYNC116.py:18:11 | 16 | await trio.sleep(86399) 17 | await trio.sleep(86400) @@ -61,8 +64,9 @@ error[ASYNC116]: ASYNC116.py:18:11: [*] `trio.sleep()` with >24 hour interval sh 20 20 | 21 21 | await trio.sleep(-1) # will raise a runtime error -error[ASYNC116]: ASYNC116.py:19:11: [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep_forever()` +error[ASYNC116]: 19:11: [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep_forever()` + --> ASYNC116.py:19:11 | 17 | await trio.sleep(86400) 18 | await trio.sleep(86400.01) # error: 116, "async" @@ -82,8 +86,9 @@ error[ASYNC116]: ASYNC116.py:19:11: [*] `trio.sleep()` with >24 hour interval sh 21 21 | await trio.sleep(-1) # will raise a runtime error 22 22 | await trio.sleep(0) # handled by different check -error[ASYNC116]: ASYNC116.py:48:5: [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep_forever()` +error[ASYNC116]: 48:5: [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep_forever()` + --> ASYNC116.py:48:5 | 47 | # does not require the call to be awaited, nor in an async fun 48 | trio.sleep(86401) # error: 116, "async" @@ -102,8 +107,9 @@ error[ASYNC116]: ASYNC116.py:48:5: [*] `trio.sleep()` with >24 hour interval sho 50 50 | trio.run(trio.sleep(86401)) # error: 116, "async" 51 51 | -error[ASYNC116]: ASYNC116.py:50:14: [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep_forever()` +error[ASYNC116]: 50:14: [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep_forever()` + --> ASYNC116.py:50:14 | 48 | trio.sleep(86401) # error: 116, "async" 49 | # also checks that we don't break visit_Call @@ -121,8 +127,9 @@ error[ASYNC116]: ASYNC116.py:50:14: [*] `trio.sleep()` with >24 hour interval sh 52 52 | 53 53 | async def import_from_trio(): -error[ASYNC116]: ASYNC116.py:57:11: [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep_forever()` +error[ASYNC116]: 57:11: [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep_forever()` + --> ASYNC116.py:57:11 | 56 | # catch from import 57 | await sleep(86401) # error: 116, "async" @@ -147,16 +154,17 @@ error[ASYNC116]: ASYNC116.py:57:11: [*] `trio.sleep()` with >24 hour interval sh 59 60 | 60 61 | async def import_anyio(): -ASYNC116.py:64:11: ASYNC116 [*] `asyncio.sleep()` with >24 hour interval should usually be `asyncio.sleep_forever()` +error[ASYNC116]: 64:11: [*] `asyncio.sleep()` with >24 hour interval should usually be `asyncio.sleep_forever()` + + --> ASYNC116.py:64:11 | 63 | # These examples are probably not meant to ever wake up: 64 | await anyio.sleep(100000) # error: 116, "async" - | ^^^^^^^^^^^^^^^^^^^ ASYNC116 + | ^^^^^^^^^^^^^^^^^^^ 65 | 66 | # 'inf literal' overflow trick | = help: Replace with `asyncio.sleep_forever()` - ℹ Unsafe fix 2 2 | # ASYNCIO_NO_ERROR - no asyncio.sleep_forever, so check intentionally doesn't trigger. 3 3 | import math @@ -175,16 +183,17 @@ ASYNC116.py:64:11: ASYNC116 [*] `asyncio.sleep()` with >24 hour interval should 66 67 | # 'inf literal' overflow trick 67 68 | await anyio.sleep(1e999) # error: 116, "async" -ASYNC116.py:67:11: ASYNC116 [*] `asyncio.sleep()` with >24 hour interval should usually be `asyncio.sleep_forever()` +error[ASYNC116]: 67:11: [*] `asyncio.sleep()` with >24 hour interval should usually be `asyncio.sleep_forever()` + + --> ASYNC116.py:67:11 | 66 | # 'inf literal' overflow trick 67 | await anyio.sleep(1e999) # error: 116, "async" - | ^^^^^^^^^^^^^^^^^^ ASYNC116 + | ^^^^^^^^^^^^^^^^^^ 68 | 69 | await anyio.sleep(86399) | = help: Replace with `asyncio.sleep_forever()` - ℹ Unsafe fix 2 2 | # ASYNCIO_NO_ERROR - no asyncio.sleep_forever, so check intentionally doesn't trigger. 3 3 | import math @@ -203,16 +212,17 @@ ASYNC116.py:67:11: ASYNC116 [*] `asyncio.sleep()` with >24 hour interval should 69 70 | await anyio.sleep(86399) 70 71 | await anyio.sleep(86400) -ASYNC116.py:71:11: ASYNC116 [*] `asyncio.sleep()` with >24 hour interval should usually be `asyncio.sleep_forever()` +error[ASYNC116]: 71:11: [*] `asyncio.sleep()` with >24 hour interval should usually be `asyncio.sleep_forever()` + + --> ASYNC116.py:71:11 | 69 | await anyio.sleep(86399) 70 | await anyio.sleep(86400) 71 | await anyio.sleep(86400.01) # error: 116, "async" - | ^^^^^^^^^^^^^^^^^^^^^ ASYNC116 + | ^^^^^^^^^^^^^^^^^^^^^ 72 | await anyio.sleep(86401) # error: 116, "async" | = help: Replace with `asyncio.sleep_forever()` - ℹ Unsafe fix 2 2 | # ASYNCIO_NO_ERROR - no asyncio.sleep_forever, so check intentionally doesn't trigger. 3 3 | import math @@ -231,17 +241,18 @@ ASYNC116.py:71:11: ASYNC116 [*] `asyncio.sleep()` with >24 hour interval should 73 74 | 74 75 | await anyio.sleep(-1) # will raise a runtime error -ASYNC116.py:72:11: ASYNC116 [*] `asyncio.sleep()` with >24 hour interval should usually be `asyncio.sleep_forever()` +error[ASYNC116]: 72:11: [*] `asyncio.sleep()` with >24 hour interval should usually be `asyncio.sleep_forever()` + + --> ASYNC116.py:72:11 | 70 | await anyio.sleep(86400) 71 | await anyio.sleep(86400.01) # error: 116, "async" 72 | await anyio.sleep(86401) # error: 116, "async" - | ^^^^^^^^^^^^^^^^^^ ASYNC116 + | ^^^^^^^^^^^^^^^^^^ 73 | 74 | await anyio.sleep(-1) # will raise a runtime error | = help: Replace with `asyncio.sleep_forever()` - ℹ Unsafe fix 2 2 | # ASYNCIO_NO_ERROR - no asyncio.sleep_forever, so check intentionally doesn't trigger. 3 3 | import math @@ -260,16 +271,17 @@ ASYNC116.py:72:11: ASYNC116 [*] `asyncio.sleep()` with >24 hour interval should 74 75 | await anyio.sleep(-1) # will raise a runtime error 75 76 | await anyio.sleep(0) # handled by different check -ASYNC116.py:101:5: ASYNC116 [*] `asyncio.sleep()` with >24 hour interval should usually be `asyncio.sleep_forever()` +error[ASYNC116]: 101:5: [*] `asyncio.sleep()` with >24 hour interval should usually be `asyncio.sleep_forever()` + + --> ASYNC116.py:101:5 | 100 | # does not require the call to be awaited, nor in an async fun 101 | anyio.sleep(86401) # error: 116, "async" - | ^^^^^^^^^^^^^^^^^^ ASYNC116 + | ^^^^^^^^^^^^^^^^^^ 102 | # also checks that we don't break visit_Call 103 | anyio.run(anyio.sleep(86401)) # error: 116, "async" | = help: Replace with `asyncio.sleep_forever()` - ℹ Unsafe fix 2 2 | # ASYNCIO_NO_ERROR - no asyncio.sleep_forever, so check intentionally doesn't trigger. 3 3 | import math @@ -288,15 +300,16 @@ ASYNC116.py:101:5: ASYNC116 [*] `asyncio.sleep()` with >24 hour interval should 103 104 | anyio.run(anyio.sleep(86401)) # error: 116, "async" 104 105 | -ASYNC116.py:103:15: ASYNC116 [*] `asyncio.sleep()` with >24 hour interval should usually be `asyncio.sleep_forever()` +error[ASYNC116]: 103:15: [*] `asyncio.sleep()` with >24 hour interval should usually be `asyncio.sleep_forever()` + + --> ASYNC116.py:103:15 | 101 | anyio.sleep(86401) # error: 116, "async" 102 | # also checks that we don't break visit_Call 103 | anyio.run(anyio.sleep(86401)) # error: 116, "async" - | ^^^^^^^^^^^^^^^^^^ ASYNC116 + | ^^^^^^^^^^^^^^^^^^ | = help: Replace with `asyncio.sleep_forever()` - ℹ Unsafe fix 2 2 | # ASYNCIO_NO_ERROR - no asyncio.sleep_forever, so check intentionally doesn't trigger. 3 3 | import math @@ -315,14 +328,15 @@ ASYNC116.py:103:15: ASYNC116 [*] `asyncio.sleep()` with >24 hour interval should 105 106 | 106 107 | async def import_from_anyio(): -ASYNC116.py:110:11: ASYNC116 [*] `asyncio.sleep()` with >24 hour interval should usually be `asyncio.sleep_forever()` +error[ASYNC116]: 110:11: [*] `asyncio.sleep()` with >24 hour interval should usually be `asyncio.sleep_forever()` + + --> ASYNC116.py:110:11 | 109 | # catch from import 110 | await sleep(86401) # error: 116, "async" - | ^^^^^^^^^^^^ ASYNC116 + | ^^^^^^^^^^^^ | = help: Replace with `asyncio.sleep_forever()` - ℹ Unsafe fix 2 2 | # ASYNCIO_NO_ERROR - no asyncio.sleep_forever, so check intentionally doesn't trigger. 3 3 | import math diff --git a/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC210_ASYNC210.py.snap b/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC210_ASYNC210.py.snap index 8ca70a9387..415bacad5a 100644 --- a/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC210_ASYNC210.py.snap +++ b/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC210_ASYNC210.py.snap @@ -1,229 +1,255 @@ --- source: crates/ruff_linter/src/rules/flake8_async/mod.rs --- -ASYNC210.py:8:5: ASYNC210 Async functions should not call blocking HTTP methods +error[ASYNC210]: 8:5: Async functions should not call blocking HTTP methods + + --> ASYNC210.py:8:5 | 7 | async def foo(): 8 | urllib.request.urlopen("http://example.com/foo/bar").read() # ASYNC210 - | ^^^^^^^^^^^^^^^^^^^^^^ ASYNC210 + | ^^^^^^^^^^^^^^^^^^^^^^ | +error[ASYNC210]: 12:5: Async functions should not call blocking HTTP methods -ASYNC210.py:12:5: ASYNC210 Async functions should not call blocking HTTP methods + --> ASYNC210.py:12:5 | 11 | async def foo(): 12 | requests.get() # ASYNC210 - | ^^^^^^^^^^^^ ASYNC210 + | ^^^^^^^^^^^^ | +error[ASYNC210]: 16:5: Async functions should not call blocking HTTP methods -ASYNC210.py:16:5: ASYNC210 Async functions should not call blocking HTTP methods + --> ASYNC210.py:16:5 | 15 | async def foo(): 16 | httpx.get() # ASYNC210 - | ^^^^^^^^^ ASYNC210 + | ^^^^^^^^^ | +error[ASYNC210]: 20:5: Async functions should not call blocking HTTP methods -ASYNC210.py:20:5: ASYNC210 Async functions should not call blocking HTTP methods + --> ASYNC210.py:20:5 | 19 | async def foo(): 20 | requests.post() # ASYNC210 - | ^^^^^^^^^^^^^ ASYNC210 + | ^^^^^^^^^^^^^ | +error[ASYNC210]: 24:5: Async functions should not call blocking HTTP methods -ASYNC210.py:24:5: ASYNC210 Async functions should not call blocking HTTP methods + --> ASYNC210.py:24:5 | 23 | async def foo(): 24 | httpx.post() # ASYNC210 - | ^^^^^^^^^^ ASYNC210 + | ^^^^^^^^^^ | +error[ASYNC210]: 28:5: Async functions should not call blocking HTTP methods -ASYNC210.py:28:5: ASYNC210 Async functions should not call blocking HTTP methods + --> ASYNC210.py:28:5 | 27 | async def foo(): 28 | requests.get() # ASYNC210 - | ^^^^^^^^^^^^ ASYNC210 + | ^^^^^^^^^^^^ 29 | requests.get(...) # ASYNC210 30 | requests.get # Ok | +error[ASYNC210]: 29:5: Async functions should not call blocking HTTP methods -ASYNC210.py:29:5: ASYNC210 Async functions should not call blocking HTTP methods + --> ASYNC210.py:29:5 | 27 | async def foo(): 28 | requests.get() # ASYNC210 29 | requests.get(...) # ASYNC210 - | ^^^^^^^^^^^^ ASYNC210 + | ^^^^^^^^^^^^ 30 | requests.get # Ok 31 | print(requests.get()) # ASYNC210 | +error[ASYNC210]: 31:11: Async functions should not call blocking HTTP methods -ASYNC210.py:31:11: ASYNC210 Async functions should not call blocking HTTP methods + --> ASYNC210.py:31:11 | 29 | requests.get(...) # ASYNC210 30 | requests.get # Ok 31 | print(requests.get()) # ASYNC210 - | ^^^^^^^^^^^^ ASYNC210 + | ^^^^^^^^^^^^ 32 | print(requests.get(requests.get())) # ASYNC210 | +error[ASYNC210]: 32:11: Async functions should not call blocking HTTP methods -ASYNC210.py:32:11: ASYNC210 Async functions should not call blocking HTTP methods + --> ASYNC210.py:32:11 | 30 | requests.get # Ok 31 | print(requests.get()) # ASYNC210 32 | print(requests.get(requests.get())) # ASYNC210 - | ^^^^^^^^^^^^ ASYNC210 + | ^^^^^^^^^^^^ 33 | 34 | requests.options() # ASYNC210 | +error[ASYNC210]: 32:24: Async functions should not call blocking HTTP methods -ASYNC210.py:32:24: ASYNC210 Async functions should not call blocking HTTP methods + --> ASYNC210.py:32:24 | 30 | requests.get # Ok 31 | print(requests.get()) # ASYNC210 32 | print(requests.get(requests.get())) # ASYNC210 - | ^^^^^^^^^^^^ ASYNC210 + | ^^^^^^^^^^^^ 33 | 34 | requests.options() # ASYNC210 | +error[ASYNC210]: 34:5: Async functions should not call blocking HTTP methods -ASYNC210.py:34:5: ASYNC210 Async functions should not call blocking HTTP methods + --> ASYNC210.py:34:5 | 32 | print(requests.get(requests.get())) # ASYNC210 33 | 34 | requests.options() # ASYNC210 - | ^^^^^^^^^^^^^^^^ ASYNC210 + | ^^^^^^^^^^^^^^^^ 35 | requests.head() # ASYNC210 36 | requests.post() # ASYNC210 | +error[ASYNC210]: 35:5: Async functions should not call blocking HTTP methods -ASYNC210.py:35:5: ASYNC210 Async functions should not call blocking HTTP methods + --> ASYNC210.py:35:5 | 34 | requests.options() # ASYNC210 35 | requests.head() # ASYNC210 - | ^^^^^^^^^^^^^ ASYNC210 + | ^^^^^^^^^^^^^ 36 | requests.post() # ASYNC210 37 | requests.put() # ASYNC210 | +error[ASYNC210]: 36:5: Async functions should not call blocking HTTP methods -ASYNC210.py:36:5: ASYNC210 Async functions should not call blocking HTTP methods + --> ASYNC210.py:36:5 | 34 | requests.options() # ASYNC210 35 | requests.head() # ASYNC210 36 | requests.post() # ASYNC210 - | ^^^^^^^^^^^^^ ASYNC210 + | ^^^^^^^^^^^^^ 37 | requests.put() # ASYNC210 38 | requests.patch() # ASYNC210 | +error[ASYNC210]: 37:5: Async functions should not call blocking HTTP methods -ASYNC210.py:37:5: ASYNC210 Async functions should not call blocking HTTP methods + --> ASYNC210.py:37:5 | 35 | requests.head() # ASYNC210 36 | requests.post() # ASYNC210 37 | requests.put() # ASYNC210 - | ^^^^^^^^^^^^ ASYNC210 + | ^^^^^^^^^^^^ 38 | requests.patch() # ASYNC210 39 | requests.delete() # ASYNC210 | +error[ASYNC210]: 38:5: Async functions should not call blocking HTTP methods -ASYNC210.py:38:5: ASYNC210 Async functions should not call blocking HTTP methods + --> ASYNC210.py:38:5 | 36 | requests.post() # ASYNC210 37 | requests.put() # ASYNC210 38 | requests.patch() # ASYNC210 - | ^^^^^^^^^^^^^^ ASYNC210 + | ^^^^^^^^^^^^^^ 39 | requests.delete() # ASYNC210 40 | requests.foo() | +error[ASYNC210]: 39:5: Async functions should not call blocking HTTP methods -ASYNC210.py:39:5: ASYNC210 Async functions should not call blocking HTTP methods + --> ASYNC210.py:39:5 | 37 | requests.put() # ASYNC210 38 | requests.patch() # ASYNC210 39 | requests.delete() # ASYNC210 - | ^^^^^^^^^^^^^^^ ASYNC210 + | ^^^^^^^^^^^^^^^ 40 | requests.foo() | +error[ASYNC210]: 42:5: Async functions should not call blocking HTTP methods -ASYNC210.py:42:5: ASYNC210 Async functions should not call blocking HTTP methods + --> ASYNC210.py:42:5 | 40 | requests.foo() 41 | 42 | httpx.options("") # ASYNC210 - | ^^^^^^^^^^^^^ ASYNC210 + | ^^^^^^^^^^^^^ 43 | httpx.head("") # ASYNC210 44 | httpx.post("") # ASYNC210 | +error[ASYNC210]: 43:5: Async functions should not call blocking HTTP methods -ASYNC210.py:43:5: ASYNC210 Async functions should not call blocking HTTP methods + --> ASYNC210.py:43:5 | 42 | httpx.options("") # ASYNC210 43 | httpx.head("") # ASYNC210 - | ^^^^^^^^^^ ASYNC210 + | ^^^^^^^^^^ 44 | httpx.post("") # ASYNC210 45 | httpx.put("") # ASYNC210 | +error[ASYNC210]: 44:5: Async functions should not call blocking HTTP methods -ASYNC210.py:44:5: ASYNC210 Async functions should not call blocking HTTP methods + --> ASYNC210.py:44:5 | 42 | httpx.options("") # ASYNC210 43 | httpx.head("") # ASYNC210 44 | httpx.post("") # ASYNC210 - | ^^^^^^^^^^ ASYNC210 + | ^^^^^^^^^^ 45 | httpx.put("") # ASYNC210 46 | httpx.patch("") # ASYNC210 | +error[ASYNC210]: 45:5: Async functions should not call blocking HTTP methods -ASYNC210.py:45:5: ASYNC210 Async functions should not call blocking HTTP methods + --> ASYNC210.py:45:5 | 43 | httpx.head("") # ASYNC210 44 | httpx.post("") # ASYNC210 45 | httpx.put("") # ASYNC210 - | ^^^^^^^^^ ASYNC210 + | ^^^^^^^^^ 46 | httpx.patch("") # ASYNC210 47 | httpx.delete("") # ASYNC210 | +error[ASYNC210]: 46:5: Async functions should not call blocking HTTP methods -ASYNC210.py:46:5: ASYNC210 Async functions should not call blocking HTTP methods + --> ASYNC210.py:46:5 | 44 | httpx.post("") # ASYNC210 45 | httpx.put("") # ASYNC210 46 | httpx.patch("") # ASYNC210 - | ^^^^^^^^^^^ ASYNC210 + | ^^^^^^^^^^^ 47 | httpx.delete("") # ASYNC210 48 | httpx.foo() # Ok | +error[ASYNC210]: 47:5: Async functions should not call blocking HTTP methods -ASYNC210.py:47:5: ASYNC210 Async functions should not call blocking HTTP methods + --> ASYNC210.py:47:5 | 45 | httpx.put("") # ASYNC210 46 | httpx.patch("") # ASYNC210 47 | httpx.delete("") # ASYNC210 - | ^^^^^^^^^^^^ ASYNC210 + | ^^^^^^^^^^^^ 48 | httpx.foo() # Ok | +error[ASYNC210]: 50:5: Async functions should not call blocking HTTP methods -ASYNC210.py:50:5: ASYNC210 Async functions should not call blocking HTTP methods + --> ASYNC210.py:50:5 | 48 | httpx.foo() # Ok 49 | 50 | urllib3.request() # ASYNC210 - | ^^^^^^^^^^^^^^^ ASYNC210 + | ^^^^^^^^^^^^^^^ 51 | urllib3.request(...) # ASYNC210 | +error[ASYNC210]: 51:5: Async functions should not call blocking HTTP methods -ASYNC210.py:51:5: ASYNC210 Async functions should not call blocking HTTP methods + --> ASYNC210.py:51:5 | 50 | urllib3.request() # ASYNC210 51 | urllib3.request(...) # ASYNC210 - | ^^^^^^^^^^^^^^^ ASYNC210 + | ^^^^^^^^^^^^^^^ 52 | 53 | urllib.request.urlopen("") # ASYNC210 | +error[ASYNC210]: 53:5: Async functions should not call blocking HTTP methods -ASYNC210.py:53:5: ASYNC210 Async functions should not call blocking HTTP methods + --> ASYNC210.py:53:5 | 51 | urllib3.request(...) # ASYNC210 52 | 53 | urllib.request.urlopen("") # ASYNC210 - | ^^^^^^^^^^^^^^^^^^^^^^ ASYNC210 + | ^^^^^^^^^^^^^^^^^^^^^^ 54 | 55 | r = {} | diff --git a/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC220_ASYNC22x.py.snap b/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC220_ASYNC22x.py.snap index e7db488fa6..33177a22e6 100644 --- a/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC220_ASYNC22x.py.snap +++ b/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC220_ASYNC22x.py.snap @@ -1,77 +1,86 @@ --- source: crates/ruff_linter/src/rules/flake8_async/mod.rs --- -ASYNC22x.py:31:5: ASYNC220 Async functions should not create subprocesses with blocking methods +error[ASYNC220]: 31:5: Async functions should not create subprocesses with blocking methods + + --> ASYNC22x.py:31:5 | 29 | subprocess.getoutput() # ASYNC221 30 | ) 31 | subprocess.Popen() # ASYNC220 - | ^^^^^^^^^^^^^^^^ ASYNC220 + | ^^^^^^^^^^^^^^^^ 32 | os.system() # ASYNC221 | +error[ASYNC220]: 73:5: Async functions should not create subprocesses with blocking methods -ASYNC22x.py:73:5: ASYNC220 Async functions should not create subprocesses with blocking methods + --> ASYNC22x.py:73:5 | 72 | # if mode is given, and is not os.P_WAIT: ASYNC220 73 | os.spawnl(os.P_NOWAIT) # ASYNC220 - | ^^^^^^^^^ ASYNC220 + | ^^^^^^^^^ 74 | os.spawnl(P_NOWAIT) # ASYNC220 75 | os.spawnl(mode=os.P_NOWAIT) # ASYNC220 | +error[ASYNC220]: 74:5: Async functions should not create subprocesses with blocking methods -ASYNC22x.py:74:5: ASYNC220 Async functions should not create subprocesses with blocking methods + --> ASYNC22x.py:74:5 | 72 | # if mode is given, and is not os.P_WAIT: ASYNC220 73 | os.spawnl(os.P_NOWAIT) # ASYNC220 74 | os.spawnl(P_NOWAIT) # ASYNC220 - | ^^^^^^^^^ ASYNC220 + | ^^^^^^^^^ 75 | os.spawnl(mode=os.P_NOWAIT) # ASYNC220 76 | os.spawnl(mode=P_NOWAIT) # ASYNC220 | +error[ASYNC220]: 75:5: Async functions should not create subprocesses with blocking methods -ASYNC22x.py:75:5: ASYNC220 Async functions should not create subprocesses with blocking methods + --> ASYNC22x.py:75:5 | 73 | os.spawnl(os.P_NOWAIT) # ASYNC220 74 | os.spawnl(P_NOWAIT) # ASYNC220 75 | os.spawnl(mode=os.P_NOWAIT) # ASYNC220 - | ^^^^^^^^^ ASYNC220 + | ^^^^^^^^^ 76 | os.spawnl(mode=P_NOWAIT) # ASYNC220 | +error[ASYNC220]: 76:5: Async functions should not create subprocesses with blocking methods -ASYNC22x.py:76:5: ASYNC220 Async functions should not create subprocesses with blocking methods + --> ASYNC22x.py:76:5 | 74 | os.spawnl(P_NOWAIT) # ASYNC220 75 | os.spawnl(mode=os.P_NOWAIT) # ASYNC220 76 | os.spawnl(mode=P_NOWAIT) # ASYNC220 - | ^^^^^^^^^ ASYNC220 + | ^^^^^^^^^ 77 | 78 | P_WAIT = os.P_WAIT | +error[ASYNC220]: 86:5: Async functions should not create subprocesses with blocking methods -ASYNC22x.py:86:5: ASYNC220 Async functions should not create subprocesses with blocking methods + --> ASYNC22x.py:86:5 | 85 | # other weird cases: ASYNC220 86 | os.spawnl(0) # ASYNC220 - | ^^^^^^^^^ ASYNC220 + | ^^^^^^^^^ 87 | os.spawnl(1) # ASYNC220 88 | os.spawnl(foo()) # ASYNC220 | +error[ASYNC220]: 87:5: Async functions should not create subprocesses with blocking methods -ASYNC22x.py:87:5: ASYNC220 Async functions should not create subprocesses with blocking methods + --> ASYNC22x.py:87:5 | 85 | # other weird cases: ASYNC220 86 | os.spawnl(0) # ASYNC220 87 | os.spawnl(1) # ASYNC220 - | ^^^^^^^^^ ASYNC220 + | ^^^^^^^^^ 88 | os.spawnl(foo()) # ASYNC220 | +error[ASYNC220]: 88:5: Async functions should not create subprocesses with blocking methods -ASYNC22x.py:88:5: ASYNC220 Async functions should not create subprocesses with blocking methods + --> ASYNC22x.py:88:5 | 86 | os.spawnl(0) # ASYNC220 87 | os.spawnl(1) # ASYNC220 88 | os.spawnl(foo()) # ASYNC220 - | ^^^^^^^^^ ASYNC220 + | ^^^^^^^^^ 89 | 90 | # ASYNC222 | diff --git a/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC221_ASYNC22x.py.snap b/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC221_ASYNC22x.py.snap index 59fa094dc3..29e9b34d3e 100644 --- a/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC221_ASYNC22x.py.snap +++ b/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC221_ASYNC22x.py.snap @@ -1,226 +1,251 @@ --- source: crates/ruff_linter/src/rules/flake8_async/mod.rs --- -ASYNC22x.py:8:5: ASYNC221 Async functions should not run processes with blocking methods +error[ASYNC221]: 8:5: Async functions should not run processes with blocking methods + + --> ASYNC22x.py:8:5 | 7 | async def func(): 8 | subprocess.run("foo") # ASYNC221 - | ^^^^^^^^^^^^^^ ASYNC221 + | ^^^^^^^^^^^^^^ | +error[ASYNC221]: 12:5: Async functions should not run processes with blocking methods -ASYNC22x.py:12:5: ASYNC221 Async functions should not run processes with blocking methods + --> ASYNC22x.py:12:5 | 11 | async def func(): 12 | subprocess.call("foo") # ASYNC221 - | ^^^^^^^^^^^^^^^ ASYNC221 + | ^^^^^^^^^^^^^^^ | +error[ASYNC221]: 29:9: Async functions should not run processes with blocking methods -ASYNC22x.py:29:9: ASYNC221 Async functions should not run processes with blocking methods + --> ASYNC22x.py:29:9 | 27 | async def foo(): 28 | await async_fun( 29 | subprocess.getoutput() # ASYNC221 - | ^^^^^^^^^^^^^^^^^^^^ ASYNC221 + | ^^^^^^^^^^^^^^^^^^^^ 30 | ) 31 | subprocess.Popen() # ASYNC220 | +error[ASYNC221]: 32:5: Async functions should not run processes with blocking methods -ASYNC22x.py:32:5: ASYNC221 Async functions should not run processes with blocking methods + --> ASYNC22x.py:32:5 | 30 | ) 31 | subprocess.Popen() # ASYNC220 32 | os.system() # ASYNC221 - | ^^^^^^^^^ ASYNC221 + | ^^^^^^^^^ 33 | 34 | system() | +error[ASYNC221]: 38:5: Async functions should not run processes with blocking methods -ASYNC22x.py:38:5: ASYNC221 Async functions should not run processes with blocking methods + --> ASYNC22x.py:38:5 | 36 | os.anything() 37 | 38 | subprocess.run() # ASYNC221 - | ^^^^^^^^^^^^^^ ASYNC221 + | ^^^^^^^^^^^^^^ 39 | subprocess.call() # ASYNC221 40 | subprocess.check_call() # ASYNC221 | +error[ASYNC221]: 39:5: Async functions should not run processes with blocking methods -ASYNC22x.py:39:5: ASYNC221 Async functions should not run processes with blocking methods + --> ASYNC22x.py:39:5 | 38 | subprocess.run() # ASYNC221 39 | subprocess.call() # ASYNC221 - | ^^^^^^^^^^^^^^^ ASYNC221 + | ^^^^^^^^^^^^^^^ 40 | subprocess.check_call() # ASYNC221 41 | subprocess.check_output() # ASYNC221 | +error[ASYNC221]: 40:5: Async functions should not run processes with blocking methods -ASYNC22x.py:40:5: ASYNC221 Async functions should not run processes with blocking methods + --> ASYNC22x.py:40:5 | 38 | subprocess.run() # ASYNC221 39 | subprocess.call() # ASYNC221 40 | subprocess.check_call() # ASYNC221 - | ^^^^^^^^^^^^^^^^^^^^^ ASYNC221 + | ^^^^^^^^^^^^^^^^^^^^^ 41 | subprocess.check_output() # ASYNC221 42 | subprocess.getoutput() # ASYNC221 | +error[ASYNC221]: 41:5: Async functions should not run processes with blocking methods -ASYNC22x.py:41:5: ASYNC221 Async functions should not run processes with blocking methods + --> ASYNC22x.py:41:5 | 39 | subprocess.call() # ASYNC221 40 | subprocess.check_call() # ASYNC221 41 | subprocess.check_output() # ASYNC221 - | ^^^^^^^^^^^^^^^^^^^^^^^ ASYNC221 + | ^^^^^^^^^^^^^^^^^^^^^^^ 42 | subprocess.getoutput() # ASYNC221 43 | subprocess.getstatusoutput() # ASYNC221 | +error[ASYNC221]: 42:5: Async functions should not run processes with blocking methods -ASYNC22x.py:42:5: ASYNC221 Async functions should not run processes with blocking methods + --> ASYNC22x.py:42:5 | 40 | subprocess.check_call() # ASYNC221 41 | subprocess.check_output() # ASYNC221 42 | subprocess.getoutput() # ASYNC221 - | ^^^^^^^^^^^^^^^^^^^^ ASYNC221 + | ^^^^^^^^^^^^^^^^^^^^ 43 | subprocess.getstatusoutput() # ASYNC221 | +error[ASYNC221]: 43:5: Async functions should not run processes with blocking methods -ASYNC22x.py:43:5: ASYNC221 Async functions should not run processes with blocking methods + --> ASYNC22x.py:43:5 | 41 | subprocess.check_output() # ASYNC221 42 | subprocess.getoutput() # ASYNC221 43 | subprocess.getstatusoutput() # ASYNC221 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ ASYNC221 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ 44 | 45 | await async_fun( | +error[ASYNC221]: 46:9: Async functions should not run processes with blocking methods -ASYNC22x.py:46:9: ASYNC221 Async functions should not run processes with blocking methods + --> ASYNC22x.py:46:9 | 45 | await async_fun( 46 | subprocess.getoutput() # ASYNC221 - | ^^^^^^^^^^^^^^^^^^^^ ASYNC221 + | ^^^^^^^^^^^^^^^^^^^^ 47 | ) | +error[ASYNC221]: 54:5: Async functions should not run processes with blocking methods -ASYNC22x.py:54:5: ASYNC221 Async functions should not run processes with blocking methods + --> ASYNC22x.py:54:5 | 52 | subprocess() 53 | 54 | os.posix_spawn() # ASYNC221 - | ^^^^^^^^^^^^^^ ASYNC221 + | ^^^^^^^^^^^^^^ 55 | os.posix_spawnp() # ASYNC221 | +error[ASYNC221]: 55:5: Async functions should not run processes with blocking methods -ASYNC22x.py:55:5: ASYNC221 Async functions should not run processes with blocking methods + --> ASYNC22x.py:55:5 | 54 | os.posix_spawn() # ASYNC221 55 | os.posix_spawnp() # ASYNC221 - | ^^^^^^^^^^^^^^^ ASYNC221 + | ^^^^^^^^^^^^^^^ 56 | 57 | os.spawn() | +error[ASYNC221]: 61:5: Async functions should not run processes with blocking methods -ASYNC22x.py:61:5: ASYNC221 Async functions should not run processes with blocking methods + --> ASYNC22x.py:61:5 | 59 | os.spawnllll() 60 | 61 | os.spawnl() # ASYNC221 - | ^^^^^^^^^ ASYNC221 + | ^^^^^^^^^ 62 | os.spawnle() # ASYNC221 63 | os.spawnlp() # ASYNC221 | +error[ASYNC221]: 62:5: Async functions should not run processes with blocking methods -ASYNC22x.py:62:5: ASYNC221 Async functions should not run processes with blocking methods + --> ASYNC22x.py:62:5 | 61 | os.spawnl() # ASYNC221 62 | os.spawnle() # ASYNC221 - | ^^^^^^^^^^ ASYNC221 + | ^^^^^^^^^^ 63 | os.spawnlp() # ASYNC221 64 | os.spawnlpe() # ASYNC221 | +error[ASYNC221]: 63:5: Async functions should not run processes with blocking methods -ASYNC22x.py:63:5: ASYNC221 Async functions should not run processes with blocking methods + --> ASYNC22x.py:63:5 | 61 | os.spawnl() # ASYNC221 62 | os.spawnle() # ASYNC221 63 | os.spawnlp() # ASYNC221 - | ^^^^^^^^^^ ASYNC221 + | ^^^^^^^^^^ 64 | os.spawnlpe() # ASYNC221 65 | os.spawnv() # ASYNC221 | +error[ASYNC221]: 64:5: Async functions should not run processes with blocking methods -ASYNC22x.py:64:5: ASYNC221 Async functions should not run processes with blocking methods + --> ASYNC22x.py:64:5 | 62 | os.spawnle() # ASYNC221 63 | os.spawnlp() # ASYNC221 64 | os.spawnlpe() # ASYNC221 - | ^^^^^^^^^^^ ASYNC221 + | ^^^^^^^^^^^ 65 | os.spawnv() # ASYNC221 66 | os.spawnve() # ASYNC221 | +error[ASYNC221]: 65:5: Async functions should not run processes with blocking methods -ASYNC22x.py:65:5: ASYNC221 Async functions should not run processes with blocking methods + --> ASYNC22x.py:65:5 | 63 | os.spawnlp() # ASYNC221 64 | os.spawnlpe() # ASYNC221 65 | os.spawnv() # ASYNC221 - | ^^^^^^^^^ ASYNC221 + | ^^^^^^^^^ 66 | os.spawnve() # ASYNC221 67 | os.spawnvp() # ASYNC221 | +error[ASYNC221]: 66:5: Async functions should not run processes with blocking methods -ASYNC22x.py:66:5: ASYNC221 Async functions should not run processes with blocking methods + --> ASYNC22x.py:66:5 | 64 | os.spawnlpe() # ASYNC221 65 | os.spawnv() # ASYNC221 66 | os.spawnve() # ASYNC221 - | ^^^^^^^^^^ ASYNC221 + | ^^^^^^^^^^ 67 | os.spawnvp() # ASYNC221 68 | os.spawnvpe() # ASYNC221 | +error[ASYNC221]: 67:5: Async functions should not run processes with blocking methods -ASYNC22x.py:67:5: ASYNC221 Async functions should not run processes with blocking methods + --> ASYNC22x.py:67:5 | 65 | os.spawnv() # ASYNC221 66 | os.spawnve() # ASYNC221 67 | os.spawnvp() # ASYNC221 - | ^^^^^^^^^^ ASYNC221 + | ^^^^^^^^^^ 68 | os.spawnvpe() # ASYNC221 | +error[ASYNC221]: 68:5: Async functions should not run processes with blocking methods -ASYNC22x.py:68:5: ASYNC221 Async functions should not run processes with blocking methods + --> ASYNC22x.py:68:5 | 66 | os.spawnve() # ASYNC221 67 | os.spawnvp() # ASYNC221 68 | os.spawnvpe() # ASYNC221 - | ^^^^^^^^^^^ ASYNC221 + | ^^^^^^^^^^^ 69 | 70 | P_NOWAIT = os.P_NOWAIT | +error[ASYNC221]: 81:5: Async functions should not run processes with blocking methods -ASYNC22x.py:81:5: ASYNC221 Async functions should not run processes with blocking methods + --> ASYNC22x.py:81:5 | 80 | # if it is P_WAIT, ASYNC221 81 | os.spawnl(P_WAIT) # ASYNC221 - | ^^^^^^^^^ ASYNC221 + | ^^^^^^^^^ 82 | os.spawnl(mode=os.P_WAIT) # ASYNC221 83 | os.spawnl(mode=P_WAIT) # ASYNC221 | +error[ASYNC221]: 82:5: Async functions should not run processes with blocking methods -ASYNC22x.py:82:5: ASYNC221 Async functions should not run processes with blocking methods + --> ASYNC22x.py:82:5 | 80 | # if it is P_WAIT, ASYNC221 81 | os.spawnl(P_WAIT) # ASYNC221 82 | os.spawnl(mode=os.P_WAIT) # ASYNC221 - | ^^^^^^^^^ ASYNC221 + | ^^^^^^^^^ 83 | os.spawnl(mode=P_WAIT) # ASYNC221 | +error[ASYNC221]: 83:5: Async functions should not run processes with blocking methods -ASYNC22x.py:83:5: ASYNC221 Async functions should not run processes with blocking methods + --> ASYNC22x.py:83:5 | 81 | os.spawnl(P_WAIT) # ASYNC221 82 | os.spawnl(mode=os.P_WAIT) # ASYNC221 83 | os.spawnl(mode=P_WAIT) # ASYNC221 - | ^^^^^^^^^ ASYNC221 + | ^^^^^^^^^ 84 | 85 | # other weird cases: ASYNC220 | diff --git a/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC222_ASYNC22x.py.snap b/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC222_ASYNC22x.py.snap index 0c9e675ffa..32c4055fc3 100644 --- a/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC222_ASYNC22x.py.snap +++ b/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC222_ASYNC22x.py.snap @@ -1,64 +1,72 @@ --- source: crates/ruff_linter/src/rules/flake8_async/mod.rs --- -ASYNC22x.py:20:5: ASYNC222 Async functions should not wait on processes with blocking methods +error[ASYNC222]: 20:5: Async functions should not wait on processes with blocking methods + + --> ASYNC22x.py:20:5 | 19 | async def func(): 20 | os.wait4(10) # ASYNC222 - | ^^^^^^^^ ASYNC222 + | ^^^^^^^^ | +error[ASYNC222]: 24:5: Async functions should not wait on processes with blocking methods -ASYNC22x.py:24:5: ASYNC222 Async functions should not wait on processes with blocking methods + --> ASYNC22x.py:24:5 | 23 | async def func(): 24 | os.wait(12) # ASYNC222 - | ^^^^^^^ ASYNC222 + | ^^^^^^^ | +error[ASYNC222]: 91:5: Async functions should not wait on processes with blocking methods -ASYNC22x.py:91:5: ASYNC222 Async functions should not wait on processes with blocking methods + --> ASYNC22x.py:91:5 | 90 | # ASYNC222 91 | os.wait() # ASYNC222 - | ^^^^^^^ ASYNC222 + | ^^^^^^^ 92 | os.wait3() # ASYNC222 93 | os.wait4() # ASYNC222 | +error[ASYNC222]: 92:5: Async functions should not wait on processes with blocking methods -ASYNC22x.py:92:5: ASYNC222 Async functions should not wait on processes with blocking methods + --> ASYNC22x.py:92:5 | 90 | # ASYNC222 91 | os.wait() # ASYNC222 92 | os.wait3() # ASYNC222 - | ^^^^^^^^ ASYNC222 + | ^^^^^^^^ 93 | os.wait4() # ASYNC222 94 | os.waitid() # ASYNC222 | +error[ASYNC222]: 93:5: Async functions should not wait on processes with blocking methods -ASYNC22x.py:93:5: ASYNC222 Async functions should not wait on processes with blocking methods + --> ASYNC22x.py:93:5 | 91 | os.wait() # ASYNC222 92 | os.wait3() # ASYNC222 93 | os.wait4() # ASYNC222 - | ^^^^^^^^ ASYNC222 + | ^^^^^^^^ 94 | os.waitid() # ASYNC222 95 | os.waitpid() # ASYNC222 | +error[ASYNC222]: 94:5: Async functions should not wait on processes with blocking methods -ASYNC22x.py:94:5: ASYNC222 Async functions should not wait on processes with blocking methods + --> ASYNC22x.py:94:5 | 92 | os.wait3() # ASYNC222 93 | os.wait4() # ASYNC222 94 | os.waitid() # ASYNC222 - | ^^^^^^^^^ ASYNC222 + | ^^^^^^^^^ 95 | os.waitpid() # ASYNC222 | +error[ASYNC222]: 95:5: Async functions should not wait on processes with blocking methods -ASYNC22x.py:95:5: ASYNC222 Async functions should not wait on processes with blocking methods + --> ASYNC22x.py:95:5 | 93 | os.wait4() # ASYNC222 94 | os.waitid() # ASYNC222 95 | os.waitpid() # ASYNC222 - | ^^^^^^^^^^ ASYNC222 + | ^^^^^^^^^^ 96 | 97 | os.waitpi() | diff --git a/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC230_ASYNC230.py.snap b/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC230_ASYNC230.py.snap index c0b5faf4c4..3ae50bf8a4 100644 --- a/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC230_ASYNC230.py.snap +++ b/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC230_ASYNC230.py.snap @@ -1,101 +1,114 @@ --- source: crates/ruff_linter/src/rules/flake8_async/mod.rs --- -ASYNC230.py:6:5: ASYNC230 Async functions should not open files with blocking methods like `open` - | -5 | async def foo(): -6 | open("") # ASYNC230 - | ^^^^ ASYNC230 -7 | io.open_code("") # ASYNC230 - | +error[ASYNC230]: 6:5: Async functions should not open files with blocking methods like `open` -ASYNC230.py:7:5: ASYNC230 Async functions should not open files with blocking methods like `open` + --> ASYNC230.py:6:5 + | +5 | async def foo(): +6 | open("") # ASYNC230 + | ^^^^ +7 | io.open_code("") # ASYNC230 + | +error[ASYNC230]: 7:5: Async functions should not open files with blocking methods like `open` + + --> ASYNC230.py:7:5 | 5 | async def foo(): 6 | open("") # ASYNC230 7 | io.open_code("") # ASYNC230 - | ^^^^^^^^^^^^ ASYNC230 + | ^^^^^^^^^^^^ 8 | 9 | with open(""): # ASYNC230 | +error[ASYNC230]: 9:10: Async functions should not open files with blocking methods like `open` -ASYNC230.py:9:10: ASYNC230 Async functions should not open files with blocking methods like `open` + --> ASYNC230.py:9:10 | 7 | io.open_code("") # ASYNC230 8 | 9 | with open(""): # ASYNC230 - | ^^^^ ASYNC230 + | ^^^^ 10 | ... | +error[ASYNC230]: 12:10: Async functions should not open files with blocking methods like `open` -ASYNC230.py:12:10: ASYNC230 Async functions should not open files with blocking methods like `open` + --> ASYNC230.py:12:10 | 10 | ... 11 | 12 | with open("") as f: # ASYNC230 - | ^^^^ ASYNC230 + | ^^^^ 13 | ... | +error[ASYNC230]: 15:17: Async functions should not open files with blocking methods like `open` -ASYNC230.py:15:17: ASYNC230 Async functions should not open files with blocking methods like `open` + --> ASYNC230.py:15:17 | 13 | ... 14 | 15 | with foo(), open(""): # ASYNC230 - | ^^^^ ASYNC230 + | ^^^^ 16 | ... | +error[ASYNC230]: 18:16: Async functions should not open files with blocking methods like `open` -ASYNC230.py:18:16: ASYNC230 Async functions should not open files with blocking methods like `open` + --> ASYNC230.py:18:16 | 16 | ... 17 | 18 | async with open(""): # ASYNC230 - | ^^^^ ASYNC230 + | ^^^^ 19 | ... | +error[ASYNC230]: 29:5: Async functions should not open files with blocking methods like `open` -ASYNC230.py:29:5: ASYNC230 Async functions should not open files with blocking methods like `open` + --> ASYNC230.py:29:5 | 28 | async def func(): 29 | open("foo") # ASYNC230 - | ^^^^ ASYNC230 + | ^^^^ | +error[ASYNC230]: 36:5: Async functions should not open files with blocking methods like `open` -ASYNC230.py:36:5: ASYNC230 Async functions should not open files with blocking methods like `open` + --> ASYNC230.py:36:5 | 35 | async def func(): 36 | Path("foo").open() # ASYNC230 - | ^^^^^^^^^^^^^^^^ ASYNC230 + | ^^^^^^^^^^^^^^^^ | +error[ASYNC230]: 41:5: Async functions should not open files with blocking methods like `open` -ASYNC230.py:41:5: ASYNC230 Async functions should not open files with blocking methods like `open` + --> ASYNC230.py:41:5 | 39 | async def func(): 40 | p = Path("foo") 41 | p.open() # ASYNC230 - | ^^^^^^ ASYNC230 + | ^^^^^^ | +error[ASYNC230]: 45:10: Async functions should not open files with blocking methods like `open` -ASYNC230.py:45:10: ASYNC230 Async functions should not open files with blocking methods like `open` + --> ASYNC230.py:45:10 | 44 | async def func(): 45 | with Path("foo").open() as f: # ASYNC230 - | ^^^^^^^^^^^^^^^^ ASYNC230 + | ^^^^^^^^^^^^^^^^ 46 | pass | +error[ASYNC230]: 53:9: Async functions should not open files with blocking methods like `open` -ASYNC230.py:53:9: ASYNC230 Async functions should not open files with blocking methods like `open` + --> ASYNC230.py:53:9 | 52 | async def bar(): 53 | p.open() # ASYNC230 - | ^^^^^^ ASYNC230 + | ^^^^^^ | +error[ASYNC230]: 59:5: Async functions should not open files with blocking methods like `open` -ASYNC230.py:59:5: ASYNC230 Async functions should not open files with blocking methods like `open` + --> ASYNC230.py:59:5 | 57 | (p1, p2) = (Path("foo"), Path("bar")) 58 | 59 | p1.open() # ASYNC230 - | ^^^^^^^ ASYNC230 + | ^^^^^^^ | diff --git a/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC251_ASYNC251.py.snap b/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC251_ASYNC251.py.snap index ffafdf9d99..e7b197545a 100644 --- a/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC251_ASYNC251.py.snap +++ b/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC251_ASYNC251.py.snap @@ -1,9 +1,11 @@ --- source: crates/ruff_linter/src/rules/flake8_async/mod.rs --- -ASYNC251.py:6:5: ASYNC251 Async functions should not call `time.sleep` +error[ASYNC251]: 6:5: Async functions should not call `time.sleep` + + --> ASYNC251.py:6:5 | 5 | async def func(): 6 | time.sleep(1) # ASYNC251 - | ^^^^^^^^^^ ASYNC251 + | ^^^^^^^^^^ | diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S101_S101.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S101_S101.py.snap index 54c0fd2d47..ef1c7be960 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S101_S101.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S101_S101.py.snap @@ -1,14 +1,16 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs --- -error[S101]: S101.py:1:1: Use of `assert` detected +error[S101]: 1:1: Use of `assert` detected + --> S101.py:1:1 | 1 | assert True # S101 | ^^^^^^ | -error[S101]: S101.py:6:5: Use of `assert` detected +error[S101]: 6:5: Use of `assert` detected + --> S101.py:6:5 | 4 | def fn(): 5 | x = 1 @@ -16,8 +18,9 @@ error[S101]: S101.py:6:5: Use of `assert` detected | ^^^^^^ 7 | assert x == 2 # S101 | -error[S101]: S101.py:7:5: Use of `assert` detected +error[S101]: 7:5: Use of `assert` detected + --> S101.py:7:5 | 5 | x = 1 6 | assert x == 1 # S101 diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S102_S102.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S102_S102.py.snap index 3807210b5b..e3171a6a31 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S102_S102.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S102_S102.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs --- -error[S102]: S102.py:3:5: Use of `exec` detected +error[S102]: 3:5: Use of `exec` detected + --> S102.py:3:5 | 1 | def fn(): 2 | # Error @@ -11,8 +12,9 @@ error[S102]: S102.py:3:5: Use of `exec` detected 4 | 5 | exec('y = 3') | -error[S102]: S102.py:5:1: Use of `exec` detected +error[S102]: 5:1: Use of `exec` detected + --> S102.py:4:1 | 3 | exec('x = 2') 4 | diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S103_S103.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S103_S103.py.snap index 88bce008c3..ad38f42db1 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S103_S103.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S103_S103.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs --- -error[S103]: S103.py:6:25: `os.chmod` setting a permissive mask `0o227` on file or directory +error[S103]: 6:25: `os.chmod` setting a permissive mask `0o227` on file or directory + --> S103.py:6:25 | 4 | keyfile = "foo" 5 | @@ -11,8 +12,9 @@ error[S103]: S103.py:6:25: `os.chmod` setting a permissive mask `0o227` on file 7 | os.chmod("/etc/passwd", 0o7) # Error 8 | os.chmod("/etc/passwd", 0o664) # OK | -error[S103]: S103.py:7:25: `os.chmod` setting a permissive mask `0o7` on file or directory +error[S103]: 7:25: `os.chmod` setting a permissive mask `0o7` on file or directory + --> S103.py:7:25 | 6 | os.chmod("/etc/passwd", 0o227) # Error 7 | os.chmod("/etc/passwd", 0o7) # Error @@ -20,8 +22,9 @@ error[S103]: S103.py:7:25: `os.chmod` setting a permissive mask `0o7` on file or 8 | os.chmod("/etc/passwd", 0o664) # OK 9 | os.chmod("/etc/passwd", 0o777) # Error | -error[S103]: S103.py:9:25: `os.chmod` setting a permissive mask `0o777` on file or directory +error[S103]: 9:25: `os.chmod` setting a permissive mask `0o777` on file or directory + --> S103.py:9:25 | 7 | os.chmod("/etc/passwd", 0o7) # Error 8 | os.chmod("/etc/passwd", 0o664) # OK @@ -30,8 +33,9 @@ error[S103]: S103.py:9:25: `os.chmod` setting a permissive mask `0o777` on file 10 | os.chmod("/etc/passwd", 0o770) # Error 11 | os.chmod("/etc/passwd", 0o776) # Error | -error[S103]: S103.py:10:25: `os.chmod` setting a permissive mask `0o770` on file or directory +error[S103]: 10:25: `os.chmod` setting a permissive mask `0o770` on file or directory + --> S103.py:10:25 | 8 | os.chmod("/etc/passwd", 0o664) # OK 9 | os.chmod("/etc/passwd", 0o777) # Error @@ -40,8 +44,9 @@ error[S103]: S103.py:10:25: `os.chmod` setting a permissive mask `0o770` on file 11 | os.chmod("/etc/passwd", 0o776) # Error 12 | os.chmod("/etc/passwd", 0o760) # OK | -error[S103]: S103.py:11:25: `os.chmod` setting a permissive mask `0o776` on file or directory +error[S103]: 11:25: `os.chmod` setting a permissive mask `0o776` on file or directory + --> S103.py:11:25 | 9 | os.chmod("/etc/passwd", 0o777) # Error 10 | os.chmod("/etc/passwd", 0o770) # Error @@ -50,8 +55,9 @@ error[S103]: S103.py:11:25: `os.chmod` setting a permissive mask `0o776` on file 12 | os.chmod("/etc/passwd", 0o760) # OK 13 | os.chmod("~/.bashrc", 511) # Error | -error[S103]: S103.py:13:23: `os.chmod` setting a permissive mask `0o777` on file or directory +error[S103]: 13:23: `os.chmod` setting a permissive mask `0o777` on file or directory + --> S103.py:13:23 | 11 | os.chmod("/etc/passwd", 0o776) # Error 12 | os.chmod("/etc/passwd", 0o760) # OK @@ -60,8 +66,9 @@ error[S103]: S103.py:13:23: `os.chmod` setting a permissive mask `0o777` on file 14 | os.chmod("/etc/hosts", 0o777) # Error 15 | os.chmod("/tmp/oh_hai", 0x1FF) # Error | -error[S103]: S103.py:14:24: `os.chmod` setting a permissive mask `0o777` on file or directory +error[S103]: 14:24: `os.chmod` setting a permissive mask `0o777` on file or directory + --> S103.py:14:24 | 12 | os.chmod("/etc/passwd", 0o760) # OK 13 | os.chmod("~/.bashrc", 511) # Error @@ -70,8 +77,9 @@ error[S103]: S103.py:14:24: `os.chmod` setting a permissive mask `0o777` on file 15 | os.chmod("/tmp/oh_hai", 0x1FF) # Error 16 | os.chmod("/etc/passwd", stat.S_IRWXU) # OK | -error[S103]: S103.py:15:25: `os.chmod` setting a permissive mask `0o777` on file or directory +error[S103]: 15:25: `os.chmod` setting a permissive mask `0o777` on file or directory + --> S103.py:15:25 | 13 | os.chmod("~/.bashrc", 511) # Error 14 | os.chmod("/etc/hosts", 0o777) # Error @@ -80,8 +88,9 @@ error[S103]: S103.py:15:25: `os.chmod` setting a permissive mask `0o777` on file 16 | os.chmod("/etc/passwd", stat.S_IRWXU) # OK 17 | os.chmod(keyfile, 0o777) # Error | -error[S103]: S103.py:17:19: `os.chmod` setting a permissive mask `0o777` on file or directory +error[S103]: 17:19: `os.chmod` setting a permissive mask `0o777` on file or directory + --> S103.py:17:19 | 15 | os.chmod("/tmp/oh_hai", 0x1FF) # Error 16 | os.chmod("/etc/passwd", stat.S_IRWXU) # OK @@ -90,8 +99,9 @@ error[S103]: S103.py:17:19: `os.chmod` setting a permissive mask `0o777` on file 18 | os.chmod(keyfile, 0o7 | 0o70 | 0o700) # Error 19 | os.chmod(keyfile, stat.S_IRWXO | stat.S_IRWXG | stat.S_IRWXU) # Error | -error[S103]: S103.py:18:19: `os.chmod` setting a permissive mask `0o777` on file or directory +error[S103]: 18:19: `os.chmod` setting a permissive mask `0o777` on file or directory + --> S103.py:18:19 | 16 | os.chmod("/etc/passwd", stat.S_IRWXU) # OK 17 | os.chmod(keyfile, 0o777) # Error @@ -100,8 +110,9 @@ error[S103]: S103.py:18:19: `os.chmod` setting a permissive mask `0o777` on file 19 | os.chmod(keyfile, stat.S_IRWXO | stat.S_IRWXG | stat.S_IRWXU) # Error 20 | os.chmod("~/hidden_exec", stat.S_IXGRP) # Error | -error[S103]: S103.py:19:19: `os.chmod` setting a permissive mask `0o777` on file or directory +error[S103]: 19:19: `os.chmod` setting a permissive mask `0o777` on file or directory + --> S103.py:19:19 | 17 | os.chmod(keyfile, 0o777) # Error 18 | os.chmod(keyfile, 0o7 | 0o70 | 0o700) # Error @@ -110,8 +121,9 @@ error[S103]: S103.py:19:19: `os.chmod` setting a permissive mask `0o777` on file 20 | os.chmod("~/hidden_exec", stat.S_IXGRP) # Error 21 | os.chmod("~/hidden_exec", stat.S_IXOTH) # OK | -error[S103]: S103.py:20:27: `os.chmod` setting a permissive mask `0o10` on file or directory +error[S103]: 20:27: `os.chmod` setting a permissive mask `0o10` on file or directory + --> S103.py:20:27 | 18 | os.chmod(keyfile, 0o7 | 0o70 | 0o700) # Error 19 | os.chmod(keyfile, stat.S_IRWXO | stat.S_IRWXG | stat.S_IRWXU) # Error @@ -120,8 +132,9 @@ error[S103]: S103.py:20:27: `os.chmod` setting a permissive mask `0o10` on file 21 | os.chmod("~/hidden_exec", stat.S_IXOTH) # OK 22 | os.chmod("/etc/passwd", stat.S_IWOTH) # Error | -error[S103]: S103.py:22:25: `os.chmod` setting a permissive mask `0o2` on file or directory +error[S103]: 22:25: `os.chmod` setting a permissive mask `0o2` on file or directory + --> S103.py:22:25 | 20 | os.chmod("~/hidden_exec", stat.S_IXGRP) # Error 21 | os.chmod("~/hidden_exec", stat.S_IXOTH) # OK @@ -129,8 +142,9 @@ error[S103]: S103.py:22:25: `os.chmod` setting a permissive mask `0o2` on file o | ^^^^^^^^^^^^ 23 | os.chmod("/etc/passwd", 0o100000000) # Error | -error[S103]: S103.py:23:25: `os.chmod` setting an invalid mask on file or directory +error[S103]: 23:25: `os.chmod` setting an invalid mask on file or directory + --> S103.py:23:25 | 21 | os.chmod("~/hidden_exec", stat.S_IXOTH) # OK 22 | os.chmod("/etc/passwd", stat.S_IWOTH) # Error diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S104_S104.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S104_S104.py.snap index 7c3a3b6272..fe01b8171a 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S104_S104.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S104_S104.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs --- -error[S104]: S104.py:9:1: Possible binding to all interfaces +error[S104]: 9:1: Possible binding to all interfaces + --> S104.py:8:8 | 8 | # Error 9 | "0.0.0.0" @@ -10,8 +11,9 @@ error[S104]: S104.py:9:1: Possible binding to all interfaces 10 | '0.0.0.0' 11 | f"0.0.0.0" | -error[S104]: S104.py:10:1: Possible binding to all interfaces +error[S104]: 10:1: Possible binding to all interfaces + --> S104.py:9:10 | 8 | # Error 9 | "0.0.0.0" @@ -19,45 +21,51 @@ error[S104]: S104.py:10:1: Possible binding to all interfaces | ^^^^^^^^^ 11 | f"0.0.0.0" | -error[S104]: S104.py:11:3: Possible binding to all interfaces +error[S104]: 11:3: Possible binding to all interfaces + --> S104.py:11:3 | 9 | "0.0.0.0" 10 | '0.0.0.0' 11 | f"0.0.0.0" | ^^^^^^^ | -error[S104]: S104.py:15:6: Possible binding to all interfaces +error[S104]: 15:6: Possible binding to all interfaces + --> S104.py:15:6 | 14 | # Error 15 | func("0.0.0.0") | ^^^^^^^^^ | -error[S104]: S104.py:19:9: Possible binding to all interfaces +error[S104]: 19:9: Possible binding to all interfaces + --> S104.py:19:9 | 18 | def my_func(): 19 | x = "0.0.0.0" | ^^^^^^^^^ 20 | print(x) | -error[S104]: S104.py:24:1: Possible binding to all interfaces +error[S104]: 24:1: Possible binding to all interfaces + --> S104.py:23:32 | 23 | # Implicit string concatenation 24 | "0.0.0.0" f"0.0.0.0{expr}0.0.0.0" | ^^^^^^^^^ | -error[S104]: S104.py:24:13: Possible binding to all interfaces +error[S104]: 24:13: Possible binding to all interfaces + --> S104.py:24:13 | 23 | # Implicit string concatenation 24 | "0.0.0.0" f"0.0.0.0{expr}0.0.0.0" | ^^^^^^^ | -error[S104]: S104.py:24:26: Possible binding to all interfaces +error[S104]: 24:26: Possible binding to all interfaces + --> S104.py:24:26 | 23 | # Implicit string concatenation 24 | "0.0.0.0" f"0.0.0.0{expr}0.0.0.0" diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S105_S105.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S105_S105.py.snap index 8b7a992821..84631aca16 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S105_S105.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S105_S105.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs --- -error[S105]: S105.py:13:12: Possible hardcoded password assigned to: "password" +error[S105]: 13:12: Possible hardcoded password assigned to: "password" + --> S105.py:13:12 | 12 | # Errors 13 | password = "s3cr3t" @@ -10,8 +11,9 @@ error[S105]: S105.py:13:12: Possible hardcoded password assigned to: "password" 14 | _pass = "s3cr3t" 15 | passwd = "s3cr3t" | -error[S105]: S105.py:14:9: Possible hardcoded password assigned to: "_pass" +error[S105]: 14:9: Possible hardcoded password assigned to: "_pass" + --> S105.py:14:9 | 12 | # Errors 13 | password = "s3cr3t" @@ -20,8 +22,9 @@ error[S105]: S105.py:14:9: Possible hardcoded password assigned to: "_pass" 15 | passwd = "s3cr3t" 16 | pwd = "s3cr3t" | -error[S105]: S105.py:15:10: Possible hardcoded password assigned to: "passwd" +error[S105]: 15:10: Possible hardcoded password assigned to: "passwd" + --> S105.py:15:10 | 13 | password = "s3cr3t" 14 | _pass = "s3cr3t" @@ -30,8 +33,9 @@ error[S105]: S105.py:15:10: Possible hardcoded password assigned to: "passwd" 16 | pwd = "s3cr3t" 17 | secret = "s3cr3t" | -error[S105]: S105.py:16:7: Possible hardcoded password assigned to: "pwd" +error[S105]: 16:7: Possible hardcoded password assigned to: "pwd" + --> S105.py:16:7 | 14 | _pass = "s3cr3t" 15 | passwd = "s3cr3t" @@ -40,8 +44,9 @@ error[S105]: S105.py:16:7: Possible hardcoded password assigned to: "pwd" 17 | secret = "s3cr3t" 18 | token = "s3cr3t" | -error[S105]: S105.py:17:10: Possible hardcoded password assigned to: "secret" +error[S105]: 17:10: Possible hardcoded password assigned to: "secret" + --> S105.py:17:10 | 15 | passwd = "s3cr3t" 16 | pwd = "s3cr3t" @@ -50,8 +55,9 @@ error[S105]: S105.py:17:10: Possible hardcoded password assigned to: "secret" 18 | token = "s3cr3t" 19 | secrete = "s3cr3t" | -error[S105]: S105.py:18:9: Possible hardcoded password assigned to: "token" +error[S105]: 18:9: Possible hardcoded password assigned to: "token" + --> S105.py:18:9 | 16 | pwd = "s3cr3t" 17 | secret = "s3cr3t" @@ -60,8 +66,9 @@ error[S105]: S105.py:18:9: Possible hardcoded password assigned to: "token" 19 | secrete = "s3cr3t" 20 | safe = password = "s3cr3t" | -error[S105]: S105.py:19:11: Possible hardcoded password assigned to: "secrete" +error[S105]: 19:11: Possible hardcoded password assigned to: "secrete" + --> S105.py:19:11 | 17 | secret = "s3cr3t" 18 | token = "s3cr3t" @@ -70,8 +77,9 @@ error[S105]: S105.py:19:11: Possible hardcoded password assigned to: "secrete" 20 | safe = password = "s3cr3t" 21 | password = safe = "s3cr3t" | -error[S105]: S105.py:20:19: Possible hardcoded password assigned to: "password" +error[S105]: 20:19: Possible hardcoded password assigned to: "password" + --> S105.py:20:19 | 18 | token = "s3cr3t" 19 | secrete = "s3cr3t" @@ -80,8 +88,9 @@ error[S105]: S105.py:20:19: Possible hardcoded password assigned to: "password" 21 | password = safe = "s3cr3t" 22 | PASSWORD = "s3cr3t" | -error[S105]: S105.py:21:19: Possible hardcoded password assigned to: "password" +error[S105]: 21:19: Possible hardcoded password assigned to: "password" + --> S105.py:21:19 | 19 | secrete = "s3cr3t" 20 | safe = password = "s3cr3t" @@ -90,8 +99,9 @@ error[S105]: S105.py:21:19: Possible hardcoded password assigned to: "password" 22 | PASSWORD = "s3cr3t" 23 | PassWord = "s3cr3t" | -error[S105]: S105.py:22:12: Possible hardcoded password assigned to: "PASSWORD" +error[S105]: 22:12: Possible hardcoded password assigned to: "PASSWORD" + --> S105.py:22:12 | 20 | safe = password = "s3cr3t" 21 | password = safe = "s3cr3t" @@ -99,8 +109,9 @@ error[S105]: S105.py:22:12: Possible hardcoded password assigned to: "PASSWORD" | ^^^^^^^^ 23 | PassWord = "s3cr3t" | -error[S105]: S105.py:23:12: Possible hardcoded password assigned to: "PassWord" +error[S105]: 23:12: Possible hardcoded password assigned to: "PassWord" + --> S105.py:23:12 | 21 | password = safe = "s3cr3t" 22 | PASSWORD = "s3cr3t" @@ -109,8 +120,9 @@ error[S105]: S105.py:23:12: Possible hardcoded password assigned to: "PassWord" 24 | 25 | d["password"] = "s3cr3t" | -error[S105]: S105.py:25:17: Possible hardcoded password assigned to: "password" +error[S105]: 25:17: Possible hardcoded password assigned to: "password" + --> S105.py:25:17 | 23 | PassWord = "s3cr3t" 24 | @@ -119,8 +131,9 @@ error[S105]: S105.py:25:17: Possible hardcoded password assigned to: "password" 26 | d["pass"] = "s3cr3t" 27 | d["passwd"] = "s3cr3t" | -error[S105]: S105.py:26:13: Possible hardcoded password assigned to: "pass" +error[S105]: 26:13: Possible hardcoded password assigned to: "pass" + --> S105.py:26:13 | 25 | d["password"] = "s3cr3t" 26 | d["pass"] = "s3cr3t" @@ -128,8 +141,9 @@ error[S105]: S105.py:26:13: Possible hardcoded password assigned to: "pass" 27 | d["passwd"] = "s3cr3t" 28 | d["pwd"] = "s3cr3t" | -error[S105]: S105.py:27:15: Possible hardcoded password assigned to: "passwd" +error[S105]: 27:15: Possible hardcoded password assigned to: "passwd" + --> S105.py:27:15 | 25 | d["password"] = "s3cr3t" 26 | d["pass"] = "s3cr3t" @@ -138,8 +152,9 @@ error[S105]: S105.py:27:15: Possible hardcoded password assigned to: "passwd" 28 | d["pwd"] = "s3cr3t" 29 | d["secret"] = "s3cr3t" | -error[S105]: S105.py:28:12: Possible hardcoded password assigned to: "pwd" +error[S105]: 28:12: Possible hardcoded password assigned to: "pwd" + --> S105.py:28:12 | 26 | d["pass"] = "s3cr3t" 27 | d["passwd"] = "s3cr3t" @@ -148,8 +163,9 @@ error[S105]: S105.py:28:12: Possible hardcoded password assigned to: "pwd" 29 | d["secret"] = "s3cr3t" 30 | d["token"] = "s3cr3t" | -error[S105]: S105.py:29:15: Possible hardcoded password assigned to: "secret" +error[S105]: 29:15: Possible hardcoded password assigned to: "secret" + --> S105.py:29:15 | 27 | d["passwd"] = "s3cr3t" 28 | d["pwd"] = "s3cr3t" @@ -158,8 +174,9 @@ error[S105]: S105.py:29:15: Possible hardcoded password assigned to: "secret" 30 | d["token"] = "s3cr3t" 31 | d["secrete"] = "s3cr3t" | -error[S105]: S105.py:30:14: Possible hardcoded password assigned to: "token" +error[S105]: 30:14: Possible hardcoded password assigned to: "token" + --> S105.py:30:14 | 28 | d["pwd"] = "s3cr3t" 29 | d["secret"] = "s3cr3t" @@ -168,8 +185,9 @@ error[S105]: S105.py:30:14: Possible hardcoded password assigned to: "token" 31 | d["secrete"] = "s3cr3t" 32 | safe = d["password"] = "s3cr3t" | -error[S105]: S105.py:31:16: Possible hardcoded password assigned to: "secrete" +error[S105]: 31:16: Possible hardcoded password assigned to: "secrete" + --> S105.py:31:16 | 29 | d["secret"] = "s3cr3t" 30 | d["token"] = "s3cr3t" @@ -178,8 +196,9 @@ error[S105]: S105.py:31:16: Possible hardcoded password assigned to: "secrete" 32 | safe = d["password"] = "s3cr3t" 33 | d["password"] = safe = "s3cr3t" | -error[S105]: S105.py:32:24: Possible hardcoded password assigned to: "password" +error[S105]: 32:24: Possible hardcoded password assigned to: "password" + --> S105.py:32:24 | 30 | d["token"] = "s3cr3t" 31 | d["secrete"] = "s3cr3t" @@ -187,32 +206,36 @@ error[S105]: S105.py:32:24: Possible hardcoded password assigned to: "password" | ^^^^^^^^ 33 | d["password"] = safe = "s3cr3t" | -error[S105]: S105.py:33:24: Possible hardcoded password assigned to: "password" +error[S105]: 33:24: Possible hardcoded password assigned to: "password" + --> S105.py:33:24 | 31 | d["secrete"] = "s3cr3t" 32 | safe = d["password"] = "s3cr3t" 33 | d["password"] = safe = "s3cr3t" | ^^^^^^^^ | -error[S105]: S105.py:37:16: Possible hardcoded password assigned to: "password" +error[S105]: 37:16: Possible hardcoded password assigned to: "password" + --> S105.py:37:16 | 36 | class MyClass: 37 | password = "s3cr3t" | ^^^^^^^^ 38 | safe = password | -error[S105]: S105.py:41:20: Possible hardcoded password assigned to: "password" +error[S105]: 41:20: Possible hardcoded password assigned to: "password" + --> S105.py:41:20 | 41 | MyClass.password = "s3cr3t" | ^^^^^^^^ 42 | MyClass._pass = "s3cr3t" 43 | MyClass.passwd = "s3cr3t" | -error[S105]: S105.py:42:17: Possible hardcoded password assigned to: "_pass" +error[S105]: 42:17: Possible hardcoded password assigned to: "_pass" + --> S105.py:42:17 | 41 | MyClass.password = "s3cr3t" 42 | MyClass._pass = "s3cr3t" @@ -220,8 +243,9 @@ error[S105]: S105.py:42:17: Possible hardcoded password assigned to: "_pass" 43 | MyClass.passwd = "s3cr3t" 44 | MyClass.pwd = "s3cr3t" | -error[S105]: S105.py:43:18: Possible hardcoded password assigned to: "passwd" +error[S105]: 43:18: Possible hardcoded password assigned to: "passwd" + --> S105.py:43:18 | 41 | MyClass.password = "s3cr3t" 42 | MyClass._pass = "s3cr3t" @@ -230,8 +254,9 @@ error[S105]: S105.py:43:18: Possible hardcoded password assigned to: "passwd" 44 | MyClass.pwd = "s3cr3t" 45 | MyClass.secret = "s3cr3t" | -error[S105]: S105.py:44:15: Possible hardcoded password assigned to: "pwd" +error[S105]: 44:15: Possible hardcoded password assigned to: "pwd" + --> S105.py:44:15 | 42 | MyClass._pass = "s3cr3t" 43 | MyClass.passwd = "s3cr3t" @@ -240,8 +265,9 @@ error[S105]: S105.py:44:15: Possible hardcoded password assigned to: "pwd" 45 | MyClass.secret = "s3cr3t" 46 | MyClass.token = "s3cr3t" | -error[S105]: S105.py:45:18: Possible hardcoded password assigned to: "secret" +error[S105]: 45:18: Possible hardcoded password assigned to: "secret" + --> S105.py:45:18 | 43 | MyClass.passwd = "s3cr3t" 44 | MyClass.pwd = "s3cr3t" @@ -250,8 +276,9 @@ error[S105]: S105.py:45:18: Possible hardcoded password assigned to: "secret" 46 | MyClass.token = "s3cr3t" 47 | MyClass.secrete = "s3cr3t" | -error[S105]: S105.py:46:17: Possible hardcoded password assigned to: "token" +error[S105]: 46:17: Possible hardcoded password assigned to: "token" + --> S105.py:46:17 | 44 | MyClass.pwd = "s3cr3t" 45 | MyClass.secret = "s3cr3t" @@ -259,8 +286,9 @@ error[S105]: S105.py:46:17: Possible hardcoded password assigned to: "token" | ^^^^^^^^ 47 | MyClass.secrete = "s3cr3t" | -error[S105]: S105.py:47:19: Possible hardcoded password assigned to: "secrete" +error[S105]: 47:19: Possible hardcoded password assigned to: "secrete" + --> S105.py:47:19 | 45 | MyClass.secret = "s3cr3t" 46 | MyClass.token = "s3cr3t" @@ -269,8 +297,9 @@ error[S105]: S105.py:47:19: Possible hardcoded password assigned to: "secrete" 48 | 49 | password == "s3cr3t" | -error[S105]: S105.py:49:13: Possible hardcoded password assigned to: "password" +error[S105]: 49:13: Possible hardcoded password assigned to: "password" + --> S105.py:49:13 | 47 | MyClass.secrete = "s3cr3t" 48 | @@ -279,8 +308,9 @@ error[S105]: S105.py:49:13: Possible hardcoded password assigned to: "password" 50 | _pass == "s3cr3t" 51 | passwd == "s3cr3t" | -error[S105]: S105.py:50:10: Possible hardcoded password assigned to: "_pass" +error[S105]: 50:10: Possible hardcoded password assigned to: "_pass" + --> S105.py:50:10 | 49 | password == "s3cr3t" 50 | _pass == "s3cr3t" @@ -288,8 +318,9 @@ error[S105]: S105.py:50:10: Possible hardcoded password assigned to: "_pass" 51 | passwd == "s3cr3t" 52 | pwd == "s3cr3t" | -error[S105]: S105.py:51:11: Possible hardcoded password assigned to: "passwd" +error[S105]: 51:11: Possible hardcoded password assigned to: "passwd" + --> S105.py:51:11 | 49 | password == "s3cr3t" 50 | _pass == "s3cr3t" @@ -298,8 +329,9 @@ error[S105]: S105.py:51:11: Possible hardcoded password assigned to: "passwd" 52 | pwd == "s3cr3t" 53 | secret == "s3cr3t" | -error[S105]: S105.py:52:8: Possible hardcoded password assigned to: "pwd" +error[S105]: 52:8: Possible hardcoded password assigned to: "pwd" + --> S105.py:52:8 | 50 | _pass == "s3cr3t" 51 | passwd == "s3cr3t" @@ -308,8 +340,9 @@ error[S105]: S105.py:52:8: Possible hardcoded password assigned to: "pwd" 53 | secret == "s3cr3t" 54 | token == "s3cr3t" | -error[S105]: S105.py:53:11: Possible hardcoded password assigned to: "secret" +error[S105]: 53:11: Possible hardcoded password assigned to: "secret" + --> S105.py:53:11 | 51 | passwd == "s3cr3t" 52 | pwd == "s3cr3t" @@ -318,8 +351,9 @@ error[S105]: S105.py:53:11: Possible hardcoded password assigned to: "secret" 54 | token == "s3cr3t" 55 | secrete == "s3cr3t" | -error[S105]: S105.py:54:10: Possible hardcoded password assigned to: "token" +error[S105]: 54:10: Possible hardcoded password assigned to: "token" + --> S105.py:54:10 | 52 | pwd == "s3cr3t" 53 | secret == "s3cr3t" @@ -328,8 +362,9 @@ error[S105]: S105.py:54:10: Possible hardcoded password assigned to: "token" 55 | secrete == "s3cr3t" 56 | password == safe == "s3cr3t" | -error[S105]: S105.py:55:12: Possible hardcoded password assigned to: "secrete" +error[S105]: 55:12: Possible hardcoded password assigned to: "secrete" + --> S105.py:55:12 | 53 | secret == "s3cr3t" 54 | token == "s3cr3t" @@ -337,8 +372,9 @@ error[S105]: S105.py:55:12: Possible hardcoded password assigned to: "secrete" | ^^^^^^^^ 56 | password == safe == "s3cr3t" | -error[S105]: S105.py:56:21: Possible hardcoded password assigned to: "password" +error[S105]: 56:21: Possible hardcoded password assigned to: "password" + --> S105.py:56:21 | 54 | token == "s3cr3t" 55 | secrete == "s3cr3t" @@ -347,8 +383,9 @@ error[S105]: S105.py:56:21: Possible hardcoded password assigned to: "password" 57 | 58 | if token == "1\n2": | -error[S105]: S105.py:58:13: Possible hardcoded password assigned to: "token" +error[S105]: 58:13: Possible hardcoded password assigned to: "token" + --> S105.py:58:13 | 56 | password == safe == "s3cr3t" 57 | @@ -356,8 +393,9 @@ error[S105]: S105.py:58:13: Possible hardcoded password assigned to: "token" | ^^^^^^ 59 | pass | -error[S105]: S105.py:61:13: Possible hardcoded password assigned to: "token" +error[S105]: 61:13: Possible hardcoded password assigned to: "token" + --> S105.py:61:13 | 59 | pass 60 | @@ -365,8 +403,9 @@ error[S105]: S105.py:61:13: Possible hardcoded password assigned to: "token" | ^^^^^^ 62 | pass | -error[S105]: S105.py:64:13: Possible hardcoded password assigned to: "token" +error[S105]: 64:13: Possible hardcoded password assigned to: "token" + --> S105.py:64:13 | 62 | pass 63 | diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S106_S106.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S106_S106.py.snap index 88d36b706b..e530487c5e 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S106_S106.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S106_S106.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs --- -error[S106]: S106.py:14:9: Possible hardcoded password assigned to argument: "password" +error[S106]: 14:9: Possible hardcoded password assigned to argument: "password" + --> S106.py:14:9 | 13 | # Error 14 | func(1, password="s3cr3t") diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S107_S107.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S107_S107.py.snap index 44166a10fc..461f04a7c7 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S107_S107.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S107_S107.py.snap @@ -1,36 +1,41 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs --- -error[S107]: S107.py:5:29: Possible hardcoded password assigned to function default: "password" +error[S107]: 5:29: Possible hardcoded password assigned to function default: "password" + --> S107.py:5:29 | 5 | def default(first, password="default"): | ^^^^^^^^^ 6 | pass | -error[S107]: S107.py:13:45: Possible hardcoded password assigned to function default: "password" +error[S107]: 13:45: Possible hardcoded password assigned to function default: "password" + --> S107.py:13:45 | 13 | def default_posonly(first, /, pos, password="posonly"): | ^^^^^^^^^ 14 | pass | -error[S107]: S107.py:21:39: Possible hardcoded password assigned to function default: "password" +error[S107]: 21:39: Possible hardcoded password assigned to function default: "password" + --> S107.py:21:39 | 21 | def default_kwonly(first, *, password="kwonly"): | ^^^^^^^^ 22 | pass | -error[S107]: S107.py:29:39: Possible hardcoded password assigned to function default: "secret" +error[S107]: 29:39: Possible hardcoded password assigned to function default: "secret" + --> S107.py:29:39 | 29 | def default_all(first, /, pos, secret="posonly", *, password="kwonly"): | ^^^^^^^^^ 30 | pass | -error[S107]: S107.py:29:62: Possible hardcoded password assigned to function default: "password" +error[S107]: 29:62: Possible hardcoded password assigned to function default: "password" + --> S107.py:29:62 | 29 | def default_all(first, /, pos, secret="posonly", *, password="kwonly"): | ^^^^^^^^ diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S108_S108.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S108_S108.py.snap index 83a9e3e04b..45e65881ed 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S108_S108.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S108_S108.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs --- -error[S108]: S108.py:5:11: Probable insecure usage of temporary file or directory: "/tmp/abc" +error[S108]: 5:11: Probable insecure usage of temporary file or directory: "/tmp/abc" + --> S108.py:5:11 | 3 | f.write("def") 4 | @@ -10,8 +11,9 @@ error[S108]: S108.py:5:11: Probable insecure usage of temporary file or director | ^^^^^^^^^^ 6 | f.write("def") | -error[S108]: S108.py:8:13: Probable insecure usage of temporary file or directory: "/tmp/abc" +error[S108]: 8:13: Probable insecure usage of temporary file or directory: "/tmp/abc" + --> S108.py:8:13 | 6 | f.write("def") 7 | @@ -19,8 +21,9 @@ error[S108]: S108.py:8:13: Probable insecure usage of temporary file or director | ^^^^^^^^ 9 | f.write("def") | -error[S108]: S108.py:11:11: Probable insecure usage of temporary file or directory: "/var/tmp/123" +error[S108]: 11:11: Probable insecure usage of temporary file or directory: "/var/tmp/123" + --> S108.py:11:11 | 9 | f.write("def") 10 | @@ -28,8 +31,9 @@ error[S108]: S108.py:11:11: Probable insecure usage of temporary file or directo | ^^^^^^^^^^^^^^ 12 | f.write("def") | -error[S108]: S108.py:14:11: Probable insecure usage of temporary file or directory: "/dev/shm/unit/test" +error[S108]: 14:11: Probable insecure usage of temporary file or directory: "/dev/shm/unit/test" + --> S108.py:14:11 | 12 | f.write("def") 13 | @@ -37,16 +41,18 @@ error[S108]: S108.py:14:11: Probable insecure usage of temporary file or directo | ^^^^^^^^^^^^^^^^^^^^ 15 | f.write("def") | -error[S108]: S108.py:22:11: Probable insecure usage of temporary file or directory: "/tmp/abc" +error[S108]: 22:11: Probable insecure usage of temporary file or directory: "/tmp/abc" + --> S108.py:22:11 | 21 | # Implicit string concatenation 22 | with open("/tmp/" "abc", "w") as f: | ^^^^^^^^^^^^^ 23 | f.write("def") | -error[S108]: S108.py:25:11: Probable insecure usage of temporary file or directory: "/tmp/abc" +error[S108]: 25:11: Probable insecure usage of temporary file or directory: "/tmp/abc" + --> S108.py:25:11 | 23 | f.write("def") 24 | @@ -54,8 +60,9 @@ error[S108]: S108.py:25:11: Probable insecure usage of temporary file or directo | ^^^^^^^^^^ 26 | f.write("def") | -error[S108]: S108.py:25:24: Probable insecure usage of temporary file or directory: "/tmp/abc" +error[S108]: 25:24: Probable insecure usage of temporary file or directory: "/tmp/abc" + --> S108.py:25:24 | 23 | f.write("def") 24 | diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S108_extend.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S108_extend.snap index 5cd076a0a0..470a760557 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S108_extend.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S108_extend.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs --- -error[S108]: S108.py:5:11: Probable insecure usage of temporary file or directory: "/tmp/abc" +error[S108]: 5:11: Probable insecure usage of temporary file or directory: "/tmp/abc" + --> S108.py:5:11 | 3 | f.write("def") 4 | @@ -10,8 +11,9 @@ error[S108]: S108.py:5:11: Probable insecure usage of temporary file or director | ^^^^^^^^^^ 6 | f.write("def") | -error[S108]: S108.py:8:13: Probable insecure usage of temporary file or directory: "/tmp/abc" +error[S108]: 8:13: Probable insecure usage of temporary file or directory: "/tmp/abc" + --> S108.py:8:13 | 6 | f.write("def") 7 | @@ -19,8 +21,9 @@ error[S108]: S108.py:8:13: Probable insecure usage of temporary file or director | ^^^^^^^^ 9 | f.write("def") | -error[S108]: S108.py:11:11: Probable insecure usage of temporary file or directory: "/var/tmp/123" +error[S108]: 11:11: Probable insecure usage of temporary file or directory: "/var/tmp/123" + --> S108.py:11:11 | 9 | f.write("def") 10 | @@ -28,8 +31,9 @@ error[S108]: S108.py:11:11: Probable insecure usage of temporary file or directo | ^^^^^^^^^^^^^^ 12 | f.write("def") | -error[S108]: S108.py:14:11: Probable insecure usage of temporary file or directory: "/dev/shm/unit/test" +error[S108]: 14:11: Probable insecure usage of temporary file or directory: "/dev/shm/unit/test" + --> S108.py:14:11 | 12 | f.write("def") 13 | @@ -37,24 +41,27 @@ error[S108]: S108.py:14:11: Probable insecure usage of temporary file or directo | ^^^^^^^^^^^^^^^^^^^^ 15 | f.write("def") | -error[S108]: S108.py:18:11: Probable insecure usage of temporary file or directory: "/foo/bar" +error[S108]: 18:11: Probable insecure usage of temporary file or directory: "/foo/bar" + --> S108.py:18:11 | 17 | # not ok by config 18 | with open("/foo/bar", "w") as f: | ^^^^^^^^^^ 19 | f.write("def") | -error[S108]: S108.py:22:11: Probable insecure usage of temporary file or directory: "/tmp/abc" +error[S108]: 22:11: Probable insecure usage of temporary file or directory: "/tmp/abc" + --> S108.py:22:11 | 21 | # Implicit string concatenation 22 | with open("/tmp/" "abc", "w") as f: | ^^^^^^^^^^^^^ 23 | f.write("def") | -error[S108]: S108.py:25:11: Probable insecure usage of temporary file or directory: "/tmp/abc" +error[S108]: 25:11: Probable insecure usage of temporary file or directory: "/tmp/abc" + --> S108.py:25:11 | 23 | f.write("def") 24 | @@ -62,8 +69,9 @@ error[S108]: S108.py:25:11: Probable insecure usage of temporary file or directo | ^^^^^^^^^^ 26 | f.write("def") | -error[S108]: S108.py:25:24: Probable insecure usage of temporary file or directory: "/tmp/abc" +error[S108]: 25:24: Probable insecure usage of temporary file or directory: "/tmp/abc" + --> S108.py:25:24 | 23 | f.write("def") 24 | diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S110_S110.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S110_S110.py.snap index f3b60cb7cf..37fd48b9b5 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S110_S110.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S110_S110.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs --- -error[S110]: S110.py:3:1: `try`-`except`-`pass` detected, consider logging the exception +error[S110]: 3:1: `try`-`except`-`pass` detected, consider logging the exception + --> S110.py:2:9 | 1 | try: 2 | pass @@ -12,8 +13,9 @@ error[S110]: S110.py:3:1: `try`-`except`-`pass` detected, consider logging the e 5 | 6 | try: | -error[S110]: S110.py:8:1: `try`-`except`-`pass` detected, consider logging the exception +error[S110]: 8:1: `try`-`except`-`pass` detected, consider logging the exception + --> S110.py:7:9 | 6 | try: 7 | pass diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S110_typed.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S110_typed.snap index a3166a06ae..f9fe8b9cdf 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S110_typed.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S110_typed.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs --- -error[S110]: S110.py:3:1: `try`-`except`-`pass` detected, consider logging the exception +error[S110]: 3:1: `try`-`except`-`pass` detected, consider logging the exception + --> S110.py:2:9 | 1 | try: 2 | pass @@ -12,8 +13,9 @@ error[S110]: S110.py:3:1: `try`-`except`-`pass` detected, consider logging the e 5 | 6 | try: | -error[S110]: S110.py:8:1: `try`-`except`-`pass` detected, consider logging the exception +error[S110]: 8:1: `try`-`except`-`pass` detected, consider logging the exception + --> S110.py:7:9 | 6 | try: 7 | pass @@ -23,8 +25,9 @@ error[S110]: S110.py:8:1: `try`-`except`-`pass` detected, consider logging the e 10 | 11 | try: | -error[S110]: S110.py:13:1: `try`-`except`-`pass` detected, consider logging the exception +error[S110]: 13:1: `try`-`except`-`pass` detected, consider logging the exception + --> S110.py:12:9 | 11 | try: 12 | pass diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S112_S112.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S112_S112.py.snap index 9de70527de..48eb0a8609 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S112_S112.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S112_S112.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs --- -error[S112]: S112.py:3:1: `try`-`except`-`continue` detected, consider logging the exception +error[S112]: 3:1: `try`-`except`-`continue` detected, consider logging the exception + --> S112.py:2:9 | 1 | try: 2 | pass @@ -12,8 +13,9 @@ error[S112]: S112.py:3:1: `try`-`except`-`continue` detected, consider logging t 5 | 6 | try: | -error[S112]: S112.py:8:1: `try`-`except`-`continue` detected, consider logging the exception +error[S112]: 8:1: `try`-`except`-`continue` detected, consider logging the exception + --> S112.py:7:9 | 6 | try: 7 | pass @@ -23,8 +25,9 @@ error[S112]: S112.py:8:1: `try`-`except`-`continue` detected, consider logging t 10 | 11 | try: | -error[S112]: S112.py:13:1: `try`-`except`-`continue` detected, consider logging the exception +error[S112]: 13:1: `try`-`except`-`continue` detected, consider logging the exception + --> S112.py:12:9 | 11 | try: 12 | pass @@ -34,8 +37,9 @@ error[S112]: S112.py:13:1: `try`-`except`-`continue` detected, consider logging 15 | 16 | try: | -error[S112]: S112.py:18:1: `try`-`except`-`continue` detected, consider logging the exception +error[S112]: 18:1: `try`-`except`-`continue` detected, consider logging the exception + --> S112.py:17:9 | 16 | try: 17 | pass diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S113_S113.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S113_S113.py.snap index 25eb309248..58dcb4cb03 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S113_S113.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S113_S113.py.snap @@ -1,238 +1,262 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs -assertion_line: 81 --- -S113.py:46:1: S113 Probable use of `requests` call without timeout +error[S113]: 46:1: Probable use of `requests` call without timeout + + --> S113.py:45:9 | 45 | # Errors 46 | requests.get('https://gmail.com') - | ^^^^^^^^^^^^ S113 + | ^^^^^^^^^^^^ 47 | requests.get('https://gmail.com', timeout=None) 48 | requests.post('https://gmail.com') | +error[S113]: 47:35: Probable use of `requests` call with timeout set to `None` -S113.py:47:35: S113 Probable use of `requests` call with timeout set to `None` + --> S113.py:47:35 | 45 | # Errors 46 | requests.get('https://gmail.com') 47 | requests.get('https://gmail.com', timeout=None) - | ^^^^^^^^^^^^ S113 + | ^^^^^^^^^^^^ 48 | requests.post('https://gmail.com') 49 | requests.post('https://gmail.com', timeout=None) | +error[S113]: 48:1: Probable use of `requests` call without timeout -S113.py:48:1: S113 Probable use of `requests` call without timeout + --> S113.py:47:48 | 46 | requests.get('https://gmail.com') 47 | requests.get('https://gmail.com', timeout=None) 48 | requests.post('https://gmail.com') - | ^^^^^^^^^^^^^ S113 + | ^^^^^^^^^^^^^ 49 | requests.post('https://gmail.com', timeout=None) 50 | requests.put('https://gmail.com') | +error[S113]: 49:36: Probable use of `requests` call with timeout set to `None` -S113.py:49:36: S113 Probable use of `requests` call with timeout set to `None` + --> S113.py:49:36 | 47 | requests.get('https://gmail.com', timeout=None) 48 | requests.post('https://gmail.com') 49 | requests.post('https://gmail.com', timeout=None) - | ^^^^^^^^^^^^ S113 + | ^^^^^^^^^^^^ 50 | requests.put('https://gmail.com') 51 | requests.put('https://gmail.com', timeout=None) | +error[S113]: 50:1: Probable use of `requests` call without timeout -S113.py:50:1: S113 Probable use of `requests` call without timeout + --> S113.py:49:49 | 48 | requests.post('https://gmail.com') 49 | requests.post('https://gmail.com', timeout=None) 50 | requests.put('https://gmail.com') - | ^^^^^^^^^^^^ S113 + | ^^^^^^^^^^^^ 51 | requests.put('https://gmail.com', timeout=None) 52 | requests.delete('https://gmail.com') | +error[S113]: 51:35: Probable use of `requests` call with timeout set to `None` -S113.py:51:35: S113 Probable use of `requests` call with timeout set to `None` + --> S113.py:51:35 | 49 | requests.post('https://gmail.com', timeout=None) 50 | requests.put('https://gmail.com') 51 | requests.put('https://gmail.com', timeout=None) - | ^^^^^^^^^^^^ S113 + | ^^^^^^^^^^^^ 52 | requests.delete('https://gmail.com') 53 | requests.delete('https://gmail.com', timeout=None) | +error[S113]: 52:1: Probable use of `requests` call without timeout -S113.py:52:1: S113 Probable use of `requests` call without timeout + --> S113.py:51:48 | 50 | requests.put('https://gmail.com') 51 | requests.put('https://gmail.com', timeout=None) 52 | requests.delete('https://gmail.com') - | ^^^^^^^^^^^^^^^ S113 + | ^^^^^^^^^^^^^^^ 53 | requests.delete('https://gmail.com', timeout=None) 54 | requests.patch('https://gmail.com') | +error[S113]: 53:38: Probable use of `requests` call with timeout set to `None` -S113.py:53:38: S113 Probable use of `requests` call with timeout set to `None` + --> S113.py:53:38 | 51 | requests.put('https://gmail.com', timeout=None) 52 | requests.delete('https://gmail.com') 53 | requests.delete('https://gmail.com', timeout=None) - | ^^^^^^^^^^^^ S113 + | ^^^^^^^^^^^^ 54 | requests.patch('https://gmail.com') 55 | requests.patch('https://gmail.com', timeout=None) | +error[S113]: 54:1: Probable use of `requests` call without timeout -S113.py:54:1: S113 Probable use of `requests` call without timeout + --> S113.py:53:51 | 52 | requests.delete('https://gmail.com') 53 | requests.delete('https://gmail.com', timeout=None) 54 | requests.patch('https://gmail.com') - | ^^^^^^^^^^^^^^ S113 + | ^^^^^^^^^^^^^^ 55 | requests.patch('https://gmail.com', timeout=None) 56 | requests.options('https://gmail.com') | +error[S113]: 55:37: Probable use of `requests` call with timeout set to `None` -S113.py:55:37: S113 Probable use of `requests` call with timeout set to `None` + --> S113.py:55:37 | 53 | requests.delete('https://gmail.com', timeout=None) 54 | requests.patch('https://gmail.com') 55 | requests.patch('https://gmail.com', timeout=None) - | ^^^^^^^^^^^^ S113 + | ^^^^^^^^^^^^ 56 | requests.options('https://gmail.com') 57 | requests.options('https://gmail.com', timeout=None) | +error[S113]: 56:1: Probable use of `requests` call without timeout -S113.py:56:1: S113 Probable use of `requests` call without timeout + --> S113.py:55:50 | 54 | requests.patch('https://gmail.com') 55 | requests.patch('https://gmail.com', timeout=None) 56 | requests.options('https://gmail.com') - | ^^^^^^^^^^^^^^^^ S113 + | ^^^^^^^^^^^^^^^^ 57 | requests.options('https://gmail.com', timeout=None) 58 | requests.head('https://gmail.com') | +error[S113]: 57:39: Probable use of `requests` call with timeout set to `None` -S113.py:57:39: S113 Probable use of `requests` call with timeout set to `None` + --> S113.py:57:39 | 55 | requests.patch('https://gmail.com', timeout=None) 56 | requests.options('https://gmail.com') 57 | requests.options('https://gmail.com', timeout=None) - | ^^^^^^^^^^^^ S113 + | ^^^^^^^^^^^^ 58 | requests.head('https://gmail.com') 59 | requests.head('https://gmail.com', timeout=None) | +error[S113]: 58:1: Probable use of `requests` call without timeout -S113.py:58:1: S113 Probable use of `requests` call without timeout + --> S113.py:57:52 | 56 | requests.options('https://gmail.com') 57 | requests.options('https://gmail.com', timeout=None) 58 | requests.head('https://gmail.com') - | ^^^^^^^^^^^^^ S113 + | ^^^^^^^^^^^^^ 59 | requests.head('https://gmail.com', timeout=None) | +error[S113]: 59:36: Probable use of `requests` call with timeout set to `None` -S113.py:59:36: S113 Probable use of `requests` call with timeout set to `None` + --> S113.py:59:36 | 57 | requests.options('https://gmail.com', timeout=None) 58 | requests.head('https://gmail.com') 59 | requests.head('https://gmail.com', timeout=None) - | ^^^^^^^^^^^^ S113 + | ^^^^^^^^^^^^ 60 | 61 | httpx.get('https://gmail.com', timeout=None) | +error[S113]: 61:32: Probable use of `httpx` call with timeout set to `None` -S113.py:61:32: S113 Probable use of `httpx` call with timeout set to `None` + --> S113.py:61:32 | 59 | requests.head('https://gmail.com', timeout=None) 60 | 61 | httpx.get('https://gmail.com', timeout=None) - | ^^^^^^^^^^^^ S113 + | ^^^^^^^^^^^^ 62 | httpx.post('https://gmail.com', timeout=None) 63 | httpx.put('https://gmail.com', timeout=None) | +error[S113]: 62:33: Probable use of `httpx` call with timeout set to `None` -S113.py:62:33: S113 Probable use of `httpx` call with timeout set to `None` + --> S113.py:62:33 | 61 | httpx.get('https://gmail.com', timeout=None) 62 | httpx.post('https://gmail.com', timeout=None) - | ^^^^^^^^^^^^ S113 + | ^^^^^^^^^^^^ 63 | httpx.put('https://gmail.com', timeout=None) 64 | httpx.delete('https://gmail.com', timeout=None) | +error[S113]: 63:32: Probable use of `httpx` call with timeout set to `None` -S113.py:63:32: S113 Probable use of `httpx` call with timeout set to `None` + --> S113.py:63:32 | 61 | httpx.get('https://gmail.com', timeout=None) 62 | httpx.post('https://gmail.com', timeout=None) 63 | httpx.put('https://gmail.com', timeout=None) - | ^^^^^^^^^^^^ S113 + | ^^^^^^^^^^^^ 64 | httpx.delete('https://gmail.com', timeout=None) 65 | httpx.patch('https://gmail.com', timeout=None) | +error[S113]: 64:35: Probable use of `httpx` call with timeout set to `None` -S113.py:64:35: S113 Probable use of `httpx` call with timeout set to `None` + --> S113.py:64:35 | 62 | httpx.post('https://gmail.com', timeout=None) 63 | httpx.put('https://gmail.com', timeout=None) 64 | httpx.delete('https://gmail.com', timeout=None) - | ^^^^^^^^^^^^ S113 + | ^^^^^^^^^^^^ 65 | httpx.patch('https://gmail.com', timeout=None) 66 | httpx.options('https://gmail.com', timeout=None) | +error[S113]: 65:34: Probable use of `httpx` call with timeout set to `None` -S113.py:65:34: S113 Probable use of `httpx` call with timeout set to `None` + --> S113.py:65:34 | 63 | httpx.put('https://gmail.com', timeout=None) 64 | httpx.delete('https://gmail.com', timeout=None) 65 | httpx.patch('https://gmail.com', timeout=None) - | ^^^^^^^^^^^^ S113 + | ^^^^^^^^^^^^ 66 | httpx.options('https://gmail.com', timeout=None) 67 | httpx.head('https://gmail.com', timeout=None) | +error[S113]: 66:36: Probable use of `httpx` call with timeout set to `None` -S113.py:66:36: S113 Probable use of `httpx` call with timeout set to `None` + --> S113.py:66:36 | 64 | httpx.delete('https://gmail.com', timeout=None) 65 | httpx.patch('https://gmail.com', timeout=None) 66 | httpx.options('https://gmail.com', timeout=None) - | ^^^^^^^^^^^^ S113 + | ^^^^^^^^^^^^ 67 | httpx.head('https://gmail.com', timeout=None) 68 | httpx.Client(timeout=None) | +error[S113]: 67:33: Probable use of `httpx` call with timeout set to `None` -S113.py:67:33: S113 Probable use of `httpx` call with timeout set to `None` + --> S113.py:67:33 | 65 | httpx.patch('https://gmail.com', timeout=None) 66 | httpx.options('https://gmail.com', timeout=None) 67 | httpx.head('https://gmail.com', timeout=None) - | ^^^^^^^^^^^^ S113 + | ^^^^^^^^^^^^ 68 | httpx.Client(timeout=None) 69 | httpx.AsyncClient(timeout=None) | +error[S113]: 68:14: Probable use of `httpx` call with timeout set to `None` -S113.py:68:14: S113 Probable use of `httpx` call with timeout set to `None` + --> S113.py:68:14 | 66 | httpx.options('https://gmail.com', timeout=None) 67 | httpx.head('https://gmail.com', timeout=None) 68 | httpx.Client(timeout=None) - | ^^^^^^^^^^^^ S113 + | ^^^^^^^^^^^^ 69 | httpx.AsyncClient(timeout=None) | +error[S113]: 69:19: Probable use of `httpx` call with timeout set to `None` -S113.py:69:19: S113 Probable use of `httpx` call with timeout set to `None` + --> S113.py:69:19 | 67 | httpx.head('https://gmail.com', timeout=None) 68 | httpx.Client(timeout=None) 69 | httpx.AsyncClient(timeout=None) - | ^^^^^^^^^^^^ S113 + | ^^^^^^^^^^^^ 70 | 71 | with httpx.Client(timeout=None) as client: | +error[S113]: 71:19: Probable use of `httpx` call with timeout set to `None` -S113.py:71:19: S113 Probable use of `httpx` call with timeout set to `None` + --> S113.py:71:19 | 69 | httpx.AsyncClient(timeout=None) 70 | 71 | with httpx.Client(timeout=None) as client: - | ^^^^^^^^^^^^ S113 + | ^^^^^^^^^^^^ 72 | client.get('https://gmail.com') | diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S201_S201.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S201_S201.py.snap index 3225dbad2d..1d27b66d10 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S201_S201.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S201_S201.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs --- -error[S201]: S201.py:10:9: Use of `debug=True` in Flask app detected +error[S201]: 10:9: Use of `debug=True` in Flask app detected + --> S201.py:10:9 | 9 | # OK 10 | app.run(debug=True) diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S202_S202.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S202_S202.py.snap index 0ac6556b0b..526b88edb6 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S202_S202.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S202_S202.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs --- -error[S202]: S202.py:8:5: Uses of `tarfile.extractall()` +error[S202]: 8:5: Uses of `tarfile.extractall()` + --> S202.py:8:5 | 6 | def unsafe_archive_handler(filename): 7 | tar = tarfile.open(filename) @@ -10,8 +11,9 @@ error[S202]: S202.py:8:5: Uses of `tarfile.extractall()` | ^^^^^^^^^^^^^^ 9 | tar.close() | -error[S202]: S202.py:14:5: Uses of `tarfile.extractall()` +error[S202]: 14:5: Uses of `tarfile.extractall()` + --> S202.py:14:5 | 12 | def managed_members_archive_handler(filename): 13 | tar = tarfile.open(filename) @@ -19,8 +21,9 @@ error[S202]: S202.py:14:5: Uses of `tarfile.extractall()` | ^^^^^^^^^^^^^^ 15 | tar.close() | -error[S202]: S202.py:20:5: Uses of `tarfile.extractall()` +error[S202]: 20:5: Uses of `tarfile.extractall()` + --> S202.py:20:5 | 18 | def list_members_archive_handler(filename): 19 | tar = tarfile.open(filename) @@ -28,8 +31,9 @@ error[S202]: S202.py:20:5: Uses of `tarfile.extractall()` | ^^^^^^^^^^^^^^ 21 | tar.close() | -error[S202]: S202.py:26:5: Uses of `tarfile.extractall()` +error[S202]: 26:5: Uses of `tarfile.extractall()` + --> S202.py:26:5 | 24 | def provided_members_archive_handler(filename): 25 | tar = tarfile.open(filename) @@ -37,8 +41,9 @@ error[S202]: S202.py:26:5: Uses of `tarfile.extractall()` | ^^^^^^^^^^^^^^^^^^ 27 | tar.close() | -error[S202]: S202.py:38:5: Uses of `tarfile.extractall()` +error[S202]: 38:5: Uses of `tarfile.extractall()` + --> S202.py:38:5 | 36 | def filter_fully_trusted(filename): 37 | tar = tarfile.open(filename) diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S301_S301.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S301_S301.py.snap index 49644851f3..cfc336ad18 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S301_S301.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S301_S301.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs --- -error[S301]: S301.py:3:1: `pickle` and modules that wrap it can be unsafe when used to deserialize untrusted data, possible security issue +error[S301]: 3:1: `pickle` and modules that wrap it can be unsafe when used to deserialize untrusted data, possible security issue + --> S301.py:2:1 | 1 | import pickle 2 | diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S307_S307.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S307_S307.py.snap index a2dc0938df..a11fd0a61b 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S307_S307.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S307_S307.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs --- -error[S307]: S307.py:3:7: Use of possibly insecure function; consider using `ast.literal_eval` +error[S307]: 3:7: Use of possibly insecure function; consider using `ast.literal_eval` + --> S307.py:3:7 | 1 | import os 2 | @@ -10,8 +11,9 @@ error[S307]: S307.py:3:7: Use of possibly insecure function; consider using `ast | ^^^^^^^^^^^ 4 | print(eval("os.getcwd()")) # S307 | -error[S307]: S307.py:4:7: Use of possibly insecure function; consider using `ast.literal_eval` +error[S307]: 4:7: Use of possibly insecure function; consider using `ast.literal_eval` + --> S307.py:4:7 | 3 | print(eval("1+1")) # S307 4 | print(eval("os.getcwd()")) # S307 diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S308_S308.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S308_S308.py.snap index 0a49fb4cfc..10749defe0 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S308_S308.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S308_S308.py.snap @@ -1,30 +1,34 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs --- -error[S308]: S308.py:5:12: Use of `mark_safe` may expose cross-site scripting vulnerabilities +error[S308]: 5:12: Use of `mark_safe` may expose cross-site scripting vulnerabilities + --> S308.py:5:12 | 4 | def some_func(): 5 | return mark_safe('') | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -error[S308]: S308.py:8:1: Use of `mark_safe` may expose cross-site scripting vulnerabilities +error[S308]: 8:1: Use of `mark_safe` may expose cross-site scripting vulnerabilities + --> S308.py:8:1 | 8 | @mark_safe | ^^^^^^^^^^ 9 | def some_func(): 10 | return '' | -error[S308]: S308.py:17:12: Use of `mark_safe` may expose cross-site scripting vulnerabilities +error[S308]: 17:12: Use of `mark_safe` may expose cross-site scripting vulnerabilities + --> S308.py:17:12 | 16 | def some_func(): 17 | return mark_safe('') | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -error[S308]: S308.py:20:1: Use of `mark_safe` may expose cross-site scripting vulnerabilities +error[S308]: 20:1: Use of `mark_safe` may expose cross-site scripting vulnerabilities + --> S308.py:20:1 | 20 | @mark_safe | ^^^^^^^^^^ diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S310_S310.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S310_S310.py.snap index 26612b698f..91ae1991f5 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S310_S310.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S310_S310.py.snap @@ -1,232 +1,257 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs --- -S310.py:6:1: S310 Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected. +error[S310]: 6:1: Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected. + + --> S310.py:5:62 | 4 | urllib.request.urlopen(url=f'http://www.google.com') 5 | urllib.request.urlopen(url='http://' + 'www' + '.google.com') 6 | urllib.request.urlopen(url='http://www.google.com', **kwargs) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S310 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 7 | urllib.request.urlopen(url=f'http://www.google.com', **kwargs) 8 | urllib.request.urlopen('http://www.google.com') | +error[S310]: 7:1: Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected. -S310.py:7:1: S310 Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected. + --> S310.py:6:62 | 5 | urllib.request.urlopen(url='http://' + 'www' + '.google.com') 6 | urllib.request.urlopen(url='http://www.google.com', **kwargs) 7 | urllib.request.urlopen(url=f'http://www.google.com', **kwargs) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S310 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 8 | urllib.request.urlopen('http://www.google.com') 9 | urllib.request.urlopen(f'http://www.google.com') | +error[S310]: 10:1: Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected. -S310.py:10:1: S310 Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected. + --> S310.py:9:49 | 8 | urllib.request.urlopen('http://www.google.com') 9 | urllib.request.urlopen(f'http://www.google.com') 10 | urllib.request.urlopen('file:///foo/bar/baz') - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S310 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 11 | urllib.request.urlopen(url) | +error[S310]: 11:1: Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected. -S310.py:11:1: S310 Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected. + --> S310.py:10:46 | 9 | urllib.request.urlopen(f'http://www.google.com') 10 | urllib.request.urlopen('file:///foo/bar/baz') 11 | urllib.request.urlopen(url) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ S310 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ 12 | 13 | urllib.request.Request(url='http://www.google.com') | +error[S310]: 16:1: Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected. -S310.py:16:1: S310 Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected. + --> S310.py:15:62 | 14 | urllib.request.Request(url=f'http://www.google.com') 15 | urllib.request.Request(url='http://' + 'www' + '.google.com') 16 | urllib.request.Request(url='http://www.google.com', **kwargs) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S310 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 17 | urllib.request.Request(url=f'http://www.google.com', **kwargs) 18 | urllib.request.Request('http://www.google.com') | +error[S310]: 17:1: Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected. -S310.py:17:1: S310 Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected. + --> S310.py:16:62 | 15 | urllib.request.Request(url='http://' + 'www' + '.google.com') 16 | urllib.request.Request(url='http://www.google.com', **kwargs) 17 | urllib.request.Request(url=f'http://www.google.com', **kwargs) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S310 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 18 | urllib.request.Request('http://www.google.com') 19 | urllib.request.Request(f'http://www.google.com') | +error[S310]: 20:1: Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected. -S310.py:20:1: S310 Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected. + --> S310.py:19:49 | 18 | urllib.request.Request('http://www.google.com') 19 | urllib.request.Request(f'http://www.google.com') 20 | urllib.request.Request('file:///foo/bar/baz') - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S310 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 21 | urllib.request.Request(url) | +error[S310]: 21:1: Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected. -S310.py:21:1: S310 Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected. + --> S310.py:20:46 | 19 | urllib.request.Request(f'http://www.google.com') 20 | urllib.request.Request('file:///foo/bar/baz') 21 | urllib.request.Request(url) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ S310 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ 22 | 23 | urllib.request.URLopener().open(fullurl='http://www.google.com') | +error[S310]: 23:1: Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected. -S310.py:23:1: S310 Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected. + --> S310.py:22:1 | 21 | urllib.request.Request(url) 22 | 23 | urllib.request.URLopener().open(fullurl='http://www.google.com') - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ S310 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ 24 | urllib.request.URLopener().open(fullurl=f'http://www.google.com') 25 | urllib.request.URLopener().open(fullurl='http://' + 'www' + '.google.com') | +error[S310]: 24:1: Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected. -S310.py:24:1: S310 Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected. + --> S310.py:23:65 | 23 | urllib.request.URLopener().open(fullurl='http://www.google.com') 24 | urllib.request.URLopener().open(fullurl=f'http://www.google.com') - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ S310 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ 25 | urllib.request.URLopener().open(fullurl='http://' + 'www' + '.google.com') 26 | urllib.request.URLopener().open(fullurl='http://www.google.com', **kwargs) | +error[S310]: 25:1: Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected. -S310.py:25:1: S310 Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected. + --> S310.py:24:66 | 23 | urllib.request.URLopener().open(fullurl='http://www.google.com') 24 | urllib.request.URLopener().open(fullurl=f'http://www.google.com') 25 | urllib.request.URLopener().open(fullurl='http://' + 'www' + '.google.com') - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ S310 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ 26 | urllib.request.URLopener().open(fullurl='http://www.google.com', **kwargs) 27 | urllib.request.URLopener().open(fullurl=f'http://www.google.com', **kwargs) | +error[S310]: 26:1: Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected. -S310.py:26:1: S310 Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected. + --> S310.py:25:75 | 24 | urllib.request.URLopener().open(fullurl=f'http://www.google.com') 25 | urllib.request.URLopener().open(fullurl='http://' + 'www' + '.google.com') 26 | urllib.request.URLopener().open(fullurl='http://www.google.com', **kwargs) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ S310 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ 27 | urllib.request.URLopener().open(fullurl=f'http://www.google.com', **kwargs) 28 | urllib.request.URLopener().open('http://www.google.com') | +error[S310]: 27:1: Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected. -S310.py:27:1: S310 Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected. + --> S310.py:26:75 | 25 | urllib.request.URLopener().open(fullurl='http://' + 'www' + '.google.com') 26 | urllib.request.URLopener().open(fullurl='http://www.google.com', **kwargs) 27 | urllib.request.URLopener().open(fullurl=f'http://www.google.com', **kwargs) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ S310 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ 28 | urllib.request.URLopener().open('http://www.google.com') 29 | urllib.request.URLopener().open(f'http://www.google.com') | +error[S310]: 28:1: Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected. -S310.py:28:1: S310 Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected. + --> S310.py:27:76 | 26 | urllib.request.URLopener().open(fullurl='http://www.google.com', **kwargs) 27 | urllib.request.URLopener().open(fullurl=f'http://www.google.com', **kwargs) 28 | urllib.request.URLopener().open('http://www.google.com') - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ S310 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ 29 | urllib.request.URLopener().open(f'http://www.google.com') 30 | urllib.request.URLopener().open('http://' + 'www' + '.google.com') | +error[S310]: 29:1: Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected. -S310.py:29:1: S310 Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected. + --> S310.py:28:57 | 27 | urllib.request.URLopener().open(fullurl=f'http://www.google.com', **kwargs) 28 | urllib.request.URLopener().open('http://www.google.com') 29 | urllib.request.URLopener().open(f'http://www.google.com') - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ S310 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ 30 | urllib.request.URLopener().open('http://' + 'www' + '.google.com') 31 | urllib.request.URLopener().open('file:///foo/bar/baz') | +error[S310]: 30:1: Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected. -S310.py:30:1: S310 Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected. + --> S310.py:29:58 | 28 | urllib.request.URLopener().open('http://www.google.com') 29 | urllib.request.URLopener().open(f'http://www.google.com') 30 | urllib.request.URLopener().open('http://' + 'www' + '.google.com') - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ S310 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ 31 | urllib.request.URLopener().open('file:///foo/bar/baz') 32 | urllib.request.URLopener().open(url) | +error[S310]: 31:1: Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected. -S310.py:31:1: S310 Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected. + --> S310.py:30:67 | 29 | urllib.request.URLopener().open(f'http://www.google.com') 30 | urllib.request.URLopener().open('http://' + 'www' + '.google.com') 31 | urllib.request.URLopener().open('file:///foo/bar/baz') - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ S310 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ 32 | urllib.request.URLopener().open(url) | +error[S310]: 32:1: Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected. -S310.py:32:1: S310 Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected. + --> S310.py:31:55 | 30 | urllib.request.URLopener().open('http://' + 'www' + '.google.com') 31 | urllib.request.URLopener().open('file:///foo/bar/baz') 32 | urllib.request.URLopener().open(url) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ S310 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ 33 | 34 | urllib.request.urlopen(url=urllib.request.Request('http://www.google.com')) | +error[S310]: 37:1: Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected. -S310.py:37:1: S310 Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected. + --> S310.py:36:86 | 35 | urllib.request.urlopen(url=urllib.request.Request(f'http://www.google.com')) 36 | urllib.request.urlopen(url=urllib.request.Request('http://' + 'www' + '.google.com')) 37 | urllib.request.urlopen(url=urllib.request.Request('http://www.google.com'), **kwargs) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S310 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 38 | urllib.request.urlopen(url=urllib.request.Request(f'http://www.google.com'), **kwargs) 39 | urllib.request.urlopen(urllib.request.Request('http://www.google.com')) | +error[S310]: 38:1: Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected. -S310.py:38:1: S310 Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected. + --> S310.py:37:86 | 36 | urllib.request.urlopen(url=urllib.request.Request('http://' + 'www' + '.google.com')) 37 | urllib.request.urlopen(url=urllib.request.Request('http://www.google.com'), **kwargs) 38 | urllib.request.urlopen(url=urllib.request.Request(f'http://www.google.com'), **kwargs) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S310 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 39 | urllib.request.urlopen(urllib.request.Request('http://www.google.com')) 40 | urllib.request.urlopen(urllib.request.Request(f'http://www.google.com')) | +error[S310]: 41:1: Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected. -S310.py:41:1: S310 Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected. + --> S310.py:40:73 | 39 | urllib.request.urlopen(urllib.request.Request('http://www.google.com')) 40 | urllib.request.urlopen(urllib.request.Request(f'http://www.google.com')) 41 | urllib.request.urlopen(urllib.request.Request('file:///foo/bar/baz')) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S310 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 42 | urllib.request.urlopen(urllib.request.Request(url)) | +error[S310]: 41:24: Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected. -S310.py:41:24: S310 Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected. + --> S310.py:41:24 | 39 | urllib.request.urlopen(urllib.request.Request('http://www.google.com')) 40 | urllib.request.urlopen(urllib.request.Request(f'http://www.google.com')) 41 | urllib.request.urlopen(urllib.request.Request('file:///foo/bar/baz')) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S310 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 42 | urllib.request.urlopen(urllib.request.Request(url)) | +error[S310]: 42:1: Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected. -S310.py:42:1: S310 Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected. + --> S310.py:41:70 | 40 | urllib.request.urlopen(urllib.request.Request(f'http://www.google.com')) 41 | urllib.request.urlopen(urllib.request.Request('file:///foo/bar/baz')) 42 | urllib.request.urlopen(urllib.request.Request(url)) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S310 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | +error[S310]: 42:24: Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected. -S310.py:42:24: S310 Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected. + --> S310.py:42:24 | 40 | urllib.request.urlopen(urllib.request.Request(f'http://www.google.com')) 41 | urllib.request.urlopen(urllib.request.Request('file:///foo/bar/baz')) 42 | urllib.request.urlopen(urllib.request.Request(url)) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ S310 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S311_S311.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S311_S311.py.snap index ab0ebec9dd..4ee1986352 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S311_S311.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S311_S311.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs --- -error[S311]: S311.py:10:1: Standard pseudo-random generators are not suitable for cryptographic purposes +error[S311]: 10:1: Standard pseudo-random generators are not suitable for cryptographic purposes + --> S311.py:9:9 | 9 | # Errors 10 | random.Random() @@ -10,8 +11,9 @@ error[S311]: S311.py:10:1: Standard pseudo-random generators are not suitable fo 11 | random.random() 12 | random.randrange() | -error[S311]: S311.py:11:1: Standard pseudo-random generators are not suitable for cryptographic purposes +error[S311]: 11:1: Standard pseudo-random generators are not suitable for cryptographic purposes + --> S311.py:10:16 | 9 | # Errors 10 | random.Random() @@ -20,8 +22,9 @@ error[S311]: S311.py:11:1: Standard pseudo-random generators are not suitable fo 12 | random.randrange() 13 | random.randint() | -error[S311]: S311.py:12:1: Standard pseudo-random generators are not suitable for cryptographic purposes +error[S311]: 12:1: Standard pseudo-random generators are not suitable for cryptographic purposes + --> S311.py:11:16 | 10 | random.Random() 11 | random.random() @@ -30,8 +33,9 @@ error[S311]: S311.py:12:1: Standard pseudo-random generators are not suitable fo 13 | random.randint() 14 | random.choice() | -error[S311]: S311.py:13:1: Standard pseudo-random generators are not suitable for cryptographic purposes +error[S311]: 13:1: Standard pseudo-random generators are not suitable for cryptographic purposes + --> S311.py:12:19 | 11 | random.random() 12 | random.randrange() @@ -40,8 +44,9 @@ error[S311]: S311.py:13:1: Standard pseudo-random generators are not suitable fo 14 | random.choice() 15 | random.choices() | -error[S311]: S311.py:14:1: Standard pseudo-random generators are not suitable for cryptographic purposes +error[S311]: 14:1: Standard pseudo-random generators are not suitable for cryptographic purposes + --> S311.py:13:17 | 12 | random.randrange() 13 | random.randint() @@ -50,8 +55,9 @@ error[S311]: S311.py:14:1: Standard pseudo-random generators are not suitable fo 15 | random.choices() 16 | random.uniform() | -error[S311]: S311.py:15:1: Standard pseudo-random generators are not suitable for cryptographic purposes +error[S311]: 15:1: Standard pseudo-random generators are not suitable for cryptographic purposes + --> S311.py:14:16 | 13 | random.randint() 14 | random.choice() @@ -60,8 +66,9 @@ error[S311]: S311.py:15:1: Standard pseudo-random generators are not suitable fo 16 | random.uniform() 17 | random.triangular() | -error[S311]: S311.py:16:1: Standard pseudo-random generators are not suitable for cryptographic purposes +error[S311]: 16:1: Standard pseudo-random generators are not suitable for cryptographic purposes + --> S311.py:15:17 | 14 | random.choice() 15 | random.choices() @@ -70,8 +77,9 @@ error[S311]: S311.py:16:1: Standard pseudo-random generators are not suitable fo 17 | random.triangular() 18 | random.randbytes() | -error[S311]: S311.py:17:1: Standard pseudo-random generators are not suitable for cryptographic purposes +error[S311]: 17:1: Standard pseudo-random generators are not suitable for cryptographic purposes + --> S311.py:16:17 | 15 | random.choices() 16 | random.uniform() @@ -79,8 +87,9 @@ error[S311]: S311.py:17:1: Standard pseudo-random generators are not suitable fo | ^^^^^^^^^^^^^^^^^^^ 18 | random.randbytes() | -error[S311]: S311.py:18:1: Standard pseudo-random generators are not suitable for cryptographic purposes +error[S311]: 18:1: Standard pseudo-random generators are not suitable for cryptographic purposes + --> S311.py:17:20 | 16 | random.uniform() 17 | random.triangular() diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S312_S312.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S312_S312.py.snap index 8feb5fea6d..b66b198b71 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S312_S312.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S312_S312.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs --- -error[S312]: S312.py:3:1: Telnet-related functions are being called. Telnet is considered insecure. Use SSH or some other encrypted protocol. +error[S312]: 3:1: Telnet-related functions are being called. Telnet is considered insecure. Use SSH or some other encrypted protocol. + --> S312.py:2:1 | 1 | from telnetlib import Telnet 2 | diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S324_S324.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S324_S324.py.snap index 8aa955fc16..137af7ae15 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S324_S324.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S324_S324.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs --- -error[S324]: S324.py:7:13: Probable use of insecure hash functions in `hashlib`: `md5` +error[S324]: 7:13: Probable use of insecure hash functions in `hashlib`: `md5` + --> S324.py:7:13 | 6 | # Errors 7 | hashlib.new('md5') @@ -10,8 +11,9 @@ error[S324]: S324.py:7:13: Probable use of insecure hash functions in `hashlib`: 8 | hashlib.new('md4', b'test') 9 | hashlib.new(name='md5', data=b'test') | -error[S324]: S324.py:8:13: Probable use of insecure hash functions in `hashlib`: `md4` +error[S324]: 8:13: Probable use of insecure hash functions in `hashlib`: `md4` + --> S324.py:8:13 | 6 | # Errors 7 | hashlib.new('md5') @@ -20,8 +22,9 @@ error[S324]: S324.py:8:13: Probable use of insecure hash functions in `hashlib`: 9 | hashlib.new(name='md5', data=b'test') 10 | hashlib.new('MD4', data=b'test') | -error[S324]: S324.py:9:18: Probable use of insecure hash functions in `hashlib`: `md5` +error[S324]: 9:18: Probable use of insecure hash functions in `hashlib`: `md5` + --> S324.py:9:18 | 7 | hashlib.new('md5') 8 | hashlib.new('md4', b'test') @@ -30,8 +33,9 @@ error[S324]: S324.py:9:18: Probable use of insecure hash functions in `hashlib`: 10 | hashlib.new('MD4', data=b'test') 11 | hashlib.new('sha1') | -error[S324]: S324.py:10:13: Probable use of insecure hash functions in `hashlib`: `MD4` +error[S324]: 10:13: Probable use of insecure hash functions in `hashlib`: `MD4` + --> S324.py:10:13 | 8 | hashlib.new('md4', b'test') 9 | hashlib.new(name='md5', data=b'test') @@ -40,8 +44,9 @@ error[S324]: S324.py:10:13: Probable use of insecure hash functions in `hashlib` 11 | hashlib.new('sha1') 12 | hashlib.new('sha1', data=b'test') | -error[S324]: S324.py:11:13: Probable use of insecure hash functions in `hashlib`: `sha1` +error[S324]: 11:13: Probable use of insecure hash functions in `hashlib`: `sha1` + --> S324.py:11:13 | 9 | hashlib.new(name='md5', data=b'test') 10 | hashlib.new('MD4', data=b'test') @@ -50,8 +55,9 @@ error[S324]: S324.py:11:13: Probable use of insecure hash functions in `hashlib` 12 | hashlib.new('sha1', data=b'test') 13 | hashlib.new('sha', data=b'test') | -error[S324]: S324.py:12:13: Probable use of insecure hash functions in `hashlib`: `sha1` +error[S324]: 12:13: Probable use of insecure hash functions in `hashlib`: `sha1` + --> S324.py:12:13 | 10 | hashlib.new('MD4', data=b'test') 11 | hashlib.new('sha1') @@ -60,8 +66,9 @@ error[S324]: S324.py:12:13: Probable use of insecure hash functions in `hashlib` 13 | hashlib.new('sha', data=b'test') 14 | hashlib.new(name='SHA', data=b'test') | -error[S324]: S324.py:13:13: Probable use of insecure hash functions in `hashlib`: `sha` +error[S324]: 13:13: Probable use of insecure hash functions in `hashlib`: `sha` + --> S324.py:13:13 | 11 | hashlib.new('sha1') 12 | hashlib.new('sha1', data=b'test') @@ -70,8 +77,9 @@ error[S324]: S324.py:13:13: Probable use of insecure hash functions in `hashlib` 14 | hashlib.new(name='SHA', data=b'test') 15 | hashlib.sha(data=b'test') | -error[S324]: S324.py:14:18: Probable use of insecure hash functions in `hashlib`: `SHA` +error[S324]: 14:18: Probable use of insecure hash functions in `hashlib`: `SHA` + --> S324.py:14:18 | 12 | hashlib.new('sha1', data=b'test') 13 | hashlib.new('sha', data=b'test') @@ -80,8 +88,9 @@ error[S324]: S324.py:14:18: Probable use of insecure hash functions in `hashlib` 15 | hashlib.sha(data=b'test') 16 | hashlib.md5() | -error[S324]: S324.py:15:1: Probable use of insecure hash functions in `hashlib`: `sha` +error[S324]: 15:1: Probable use of insecure hash functions in `hashlib`: `sha` + --> S324.py:14:38 | 13 | hashlib.new('sha', data=b'test') 14 | hashlib.new(name='SHA', data=b'test') @@ -90,8 +99,9 @@ error[S324]: S324.py:15:1: Probable use of insecure hash functions in `hashlib`: 16 | hashlib.md5() 17 | hashlib_new('sha1') | -error[S324]: S324.py:16:1: Probable use of insecure hash functions in `hashlib`: `md5` +error[S324]: 16:1: Probable use of insecure hash functions in `hashlib`: `md5` + --> S324.py:15:26 | 14 | hashlib.new(name='SHA', data=b'test') 15 | hashlib.sha(data=b'test') @@ -100,8 +110,9 @@ error[S324]: S324.py:16:1: Probable use of insecure hash functions in `hashlib`: 17 | hashlib_new('sha1') 18 | hashlib_sha1('sha1') | -error[S324]: S324.py:17:13: Probable use of insecure hash functions in `hashlib`: `sha1` +error[S324]: 17:13: Probable use of insecure hash functions in `hashlib`: `sha1` + --> S324.py:17:13 | 15 | hashlib.sha(data=b'test') 16 | hashlib.md5() @@ -110,8 +121,9 @@ error[S324]: S324.py:17:13: Probable use of insecure hash functions in `hashlib` 18 | hashlib_sha1('sha1') 19 | # usedforsecurity arg only available in Python 3.9+ | -error[S324]: S324.py:18:1: Probable use of insecure hash functions in `hashlib`: `sha1` +error[S324]: 18:1: Probable use of insecure hash functions in `hashlib`: `sha1` + --> S324.py:17:20 | 16 | hashlib.md5() 17 | hashlib_new('sha1') @@ -120,8 +132,9 @@ error[S324]: S324.py:18:1: Probable use of insecure hash functions in `hashlib`: 19 | # usedforsecurity arg only available in Python 3.9+ 20 | hashlib.new('sha1', usedforsecurity=True) | -error[S324]: S324.py:20:13: Probable use of insecure hash functions in `hashlib`: `sha1` +error[S324]: 20:13: Probable use of insecure hash functions in `hashlib`: `sha1` + --> S324.py:20:13 | 18 | hashlib_sha1('sha1') 19 | # usedforsecurity arg only available in Python 3.9+ @@ -130,8 +143,9 @@ error[S324]: S324.py:20:13: Probable use of insecure hash functions in `hashlib` 21 | 22 | crypt.crypt("test", salt=crypt.METHOD_CRYPT) | -error[S324]: S324.py:22:26: Probable use of insecure hash functions in `crypt`: `crypt.METHOD_CRYPT` +error[S324]: 22:26: Probable use of insecure hash functions in `crypt`: `crypt.METHOD_CRYPT` + --> S324.py:22:26 | 20 | hashlib.new('sha1', usedforsecurity=True) 21 | @@ -140,8 +154,9 @@ error[S324]: S324.py:22:26: Probable use of insecure hash functions in `crypt`: 23 | crypt.crypt("test", salt=crypt.METHOD_MD5) 24 | crypt.crypt("test", salt=crypt.METHOD_BLOWFISH) | -error[S324]: S324.py:23:26: Probable use of insecure hash functions in `crypt`: `crypt.METHOD_MD5` +error[S324]: 23:26: Probable use of insecure hash functions in `crypt`: `crypt.METHOD_MD5` + --> S324.py:23:26 | 22 | crypt.crypt("test", salt=crypt.METHOD_CRYPT) 23 | crypt.crypt("test", salt=crypt.METHOD_MD5) @@ -149,8 +164,9 @@ error[S324]: S324.py:23:26: Probable use of insecure hash functions in `crypt`: 24 | crypt.crypt("test", salt=crypt.METHOD_BLOWFISH) 25 | crypt.crypt("test", crypt.METHOD_BLOWFISH) | -error[S324]: S324.py:24:26: Probable use of insecure hash functions in `crypt`: `crypt.METHOD_BLOWFISH` +error[S324]: 24:26: Probable use of insecure hash functions in `crypt`: `crypt.METHOD_BLOWFISH` + --> S324.py:24:26 | 22 | crypt.crypt("test", salt=crypt.METHOD_CRYPT) 23 | crypt.crypt("test", salt=crypt.METHOD_MD5) @@ -158,8 +174,9 @@ error[S324]: S324.py:24:26: Probable use of insecure hash functions in `crypt`: | ^^^^^^^^^^^^^^^^^^^^^ 25 | crypt.crypt("test", crypt.METHOD_BLOWFISH) | -error[S324]: S324.py:25:21: Probable use of insecure hash functions in `crypt`: `crypt.METHOD_BLOWFISH` +error[S324]: 25:21: Probable use of insecure hash functions in `crypt`: `crypt.METHOD_BLOWFISH` + --> S324.py:25:21 | 23 | crypt.crypt("test", salt=crypt.METHOD_MD5) 24 | crypt.crypt("test", salt=crypt.METHOD_BLOWFISH) @@ -168,8 +185,9 @@ error[S324]: S324.py:25:21: Probable use of insecure hash functions in `crypt`: 26 | 27 | crypt.mksalt(crypt.METHOD_CRYPT) | -error[S324]: S324.py:27:14: Probable use of insecure hash functions in `crypt`: `crypt.METHOD_CRYPT` +error[S324]: 27:14: Probable use of insecure hash functions in `crypt`: `crypt.METHOD_CRYPT` + --> S324.py:27:14 | 25 | crypt.crypt("test", crypt.METHOD_BLOWFISH) 26 | @@ -178,16 +196,18 @@ error[S324]: S324.py:27:14: Probable use of insecure hash functions in `crypt`: 28 | crypt.mksalt(crypt.METHOD_MD5) 29 | crypt.mksalt(crypt.METHOD_BLOWFISH) | -error[S324]: S324.py:28:14: Probable use of insecure hash functions in `crypt`: `crypt.METHOD_MD5` +error[S324]: 28:14: Probable use of insecure hash functions in `crypt`: `crypt.METHOD_MD5` + --> S324.py:28:14 | 27 | crypt.mksalt(crypt.METHOD_CRYPT) 28 | crypt.mksalt(crypt.METHOD_MD5) | ^^^^^^^^^^^^^^^^ 29 | crypt.mksalt(crypt.METHOD_BLOWFISH) | -error[S324]: S324.py:29:14: Probable use of insecure hash functions in `crypt`: `crypt.METHOD_BLOWFISH` +error[S324]: 29:14: Probable use of insecure hash functions in `crypt`: `crypt.METHOD_BLOWFISH` + --> S324.py:29:14 | 27 | crypt.mksalt(crypt.METHOD_CRYPT) 28 | crypt.mksalt(crypt.METHOD_MD5) diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S401_S401.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S401_S401.py.snap index fd06689c92..253d38b375 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S401_S401.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S401_S401.py.snap @@ -1,15 +1,17 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs --- -error[S401]: S401.py:1:8: `telnetlib` and related modules are considered insecure. Use SSH or another encrypted protocol. +error[S401]: 1:8: `telnetlib` and related modules are considered insecure. Use SSH or another encrypted protocol. + --> S401.py:1:8 | 1 | import telnetlib # S401 | ^^^^^^^^^ 2 | from telnetlib import Telnet # S401 | -error[S401]: S401.py:2:6: `telnetlib` and related modules are considered insecure. Use SSH or another encrypted protocol. +error[S401]: 2:6: `telnetlib` and related modules are considered insecure. Use SSH or another encrypted protocol. + --> S401.py:2:6 | 1 | import telnetlib # S401 2 | from telnetlib import Telnet # S401 diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S402_S402.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S402_S402.py.snap index ba8adc0db6..49f42a411a 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S402_S402.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S402_S402.py.snap @@ -1,15 +1,17 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs --- -error[S402]: S402.py:1:8: `ftplib` and related modules are considered insecure. Use SSH, SFTP, SCP, or another encrypted protocol. +error[S402]: 1:8: `ftplib` and related modules are considered insecure. Use SSH, SFTP, SCP, or another encrypted protocol. + --> S402.py:1:8 | 1 | import ftplib # S402 | ^^^^^^ 2 | from ftplib import FTP # S402 | -error[S402]: S402.py:2:6: `ftplib` and related modules are considered insecure. Use SSH, SFTP, SCP, or another encrypted protocol. +error[S402]: 2:6: `ftplib` and related modules are considered insecure. Use SSH, SFTP, SCP, or another encrypted protocol. + --> S402.py:2:6 | 1 | import ftplib # S402 2 | from ftplib import FTP # S402 diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S403_S403.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S403_S403.py.snap index c900f82c2d..0c9aeffea0 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S403_S403.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S403_S403.py.snap @@ -1,16 +1,18 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs --- -error[S403]: S403.py:1:8: `pickle`, `cPickle`, `dill`, and `shelve` modules are possibly insecure +error[S403]: 1:8: `pickle`, `cPickle`, `dill`, and `shelve` modules are possibly insecure + --> S403.py:1:8 | 1 | import dill # S403 | ^^^^ 2 | from dill import objects # S403 3 | import shelve | -error[S403]: S403.py:2:6: `pickle`, `cPickle`, `dill`, and `shelve` modules are possibly insecure +error[S403]: 2:6: `pickle`, `cPickle`, `dill`, and `shelve` modules are possibly insecure + --> S403.py:2:6 | 1 | import dill # S403 2 | from dill import objects # S403 @@ -18,8 +20,9 @@ error[S403]: S403.py:2:6: `pickle`, `cPickle`, `dill`, and `shelve` modules are 3 | import shelve 4 | from shelve import open | -error[S403]: S403.py:3:8: `pickle`, `cPickle`, `dill`, and `shelve` modules are possibly insecure +error[S403]: 3:8: `pickle`, `cPickle`, `dill`, and `shelve` modules are possibly insecure + --> S403.py:3:8 | 1 | import dill # S403 2 | from dill import objects # S403 @@ -28,8 +31,9 @@ error[S403]: S403.py:3:8: `pickle`, `cPickle`, `dill`, and `shelve` modules are 4 | from shelve import open 5 | import cPickle | -error[S403]: S403.py:4:6: `pickle`, `cPickle`, `dill`, and `shelve` modules are possibly insecure +error[S403]: 4:6: `pickle`, `cPickle`, `dill`, and `shelve` modules are possibly insecure + --> S403.py:4:6 | 2 | from dill import objects # S403 3 | import shelve @@ -38,8 +42,9 @@ error[S403]: S403.py:4:6: `pickle`, `cPickle`, `dill`, and `shelve` modules are 5 | import cPickle 6 | from cPickle import load | -error[S403]: S403.py:5:8: `pickle`, `cPickle`, `dill`, and `shelve` modules are possibly insecure +error[S403]: 5:8: `pickle`, `cPickle`, `dill`, and `shelve` modules are possibly insecure + --> S403.py:5:8 | 3 | import shelve 4 | from shelve import open @@ -48,8 +53,9 @@ error[S403]: S403.py:5:8: `pickle`, `cPickle`, `dill`, and `shelve` modules are 6 | from cPickle import load 7 | import pickle | -error[S403]: S403.py:6:6: `pickle`, `cPickle`, `dill`, and `shelve` modules are possibly insecure +error[S403]: 6:6: `pickle`, `cPickle`, `dill`, and `shelve` modules are possibly insecure + --> S403.py:6:6 | 4 | from shelve import open 5 | import cPickle @@ -58,8 +64,9 @@ error[S403]: S403.py:6:6: `pickle`, `cPickle`, `dill`, and `shelve` modules are 7 | import pickle 8 | from pickle import load | -error[S403]: S403.py:7:8: `pickle`, `cPickle`, `dill`, and `shelve` modules are possibly insecure +error[S403]: 7:8: `pickle`, `cPickle`, `dill`, and `shelve` modules are possibly insecure + --> S403.py:7:8 | 5 | import cPickle 6 | from cPickle import load @@ -67,8 +74,9 @@ error[S403]: S403.py:7:8: `pickle`, `cPickle`, `dill`, and `shelve` modules are | ^^^^^^ 8 | from pickle import load | -error[S403]: S403.py:8:6: `pickle`, `cPickle`, `dill`, and `shelve` modules are possibly insecure +error[S403]: 8:6: `pickle`, `cPickle`, `dill`, and `shelve` modules are possibly insecure + --> S403.py:8:6 | 6 | from cPickle import load 7 | import pickle diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S404_S404.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S404_S404.py.snap index 94a546ed51..d9d02871fb 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S404_S404.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S404_S404.py.snap @@ -1,24 +1,27 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs --- -error[S404]: S404.py:1:8: `subprocess` module is possibly insecure +error[S404]: 1:8: `subprocess` module is possibly insecure + --> S404.py:1:8 | 1 | import subprocess # S404 | ^^^^^^^^^^ 2 | from subprocess import Popen # S404 3 | from subprocess import Popen as pop # S404 | -error[S404]: S404.py:2:6: `subprocess` module is possibly insecure +error[S404]: 2:6: `subprocess` module is possibly insecure + --> S404.py:2:6 | 1 | import subprocess # S404 2 | from subprocess import Popen # S404 | ^^^^^^^^^^ 3 | from subprocess import Popen as pop # S404 | -error[S404]: S404.py:3:6: `subprocess` module is possibly insecure +error[S404]: 3:6: `subprocess` module is possibly insecure + --> S404.py:3:6 | 1 | import subprocess # S404 2 | from subprocess import Popen # S404 diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S405_S405.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S405_S405.py.snap index 178ff8c8ca..bf4338e464 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S405_S405.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S405_S405.py.snap @@ -1,16 +1,18 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs --- -error[S405]: S405.py:1:8: `xml.etree` methods are vulnerable to XML attacks +error[S405]: 1:8: `xml.etree` methods are vulnerable to XML attacks + --> S405.py:1:8 | 1 | import xml.etree.cElementTree # S405 | ^^^^^^^^^^^^^^^^^^^^^^ 2 | from xml.etree import cElementTree # S405 3 | import xml.etree.ElementTree # S405 | -error[S405]: S405.py:2:6: `xml.etree` methods are vulnerable to XML attacks +error[S405]: 2:6: `xml.etree` methods are vulnerable to XML attacks + --> S405.py:2:6 | 1 | import xml.etree.cElementTree # S405 2 | from xml.etree import cElementTree # S405 @@ -18,8 +20,9 @@ error[S405]: S405.py:2:6: `xml.etree` methods are vulnerable to XML attacks 3 | import xml.etree.ElementTree # S405 4 | from xml.etree import ElementTree # S405 | -error[S405]: S405.py:3:8: `xml.etree` methods are vulnerable to XML attacks +error[S405]: 3:8: `xml.etree` methods are vulnerable to XML attacks + --> S405.py:3:8 | 1 | import xml.etree.cElementTree # S405 2 | from xml.etree import cElementTree # S405 @@ -27,8 +30,9 @@ error[S405]: S405.py:3:8: `xml.etree` methods are vulnerable to XML attacks | ^^^^^^^^^^^^^^^^^^^^^ 4 | from xml.etree import ElementTree # S405 | -error[S405]: S405.py:4:6: `xml.etree` methods are vulnerable to XML attacks +error[S405]: 4:6: `xml.etree` methods are vulnerable to XML attacks + --> S405.py:4:6 | 2 | from xml.etree import cElementTree # S405 3 | import xml.etree.ElementTree # S405 diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S406_S406.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S406_S406.py.snap index 388f770ed8..7533cd67f6 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S406_S406.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S406_S406.py.snap @@ -1,24 +1,27 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs --- -error[S406]: S406.py:1:6: `xml.sax` methods are vulnerable to XML attacks +error[S406]: 1:6: `xml.sax` methods are vulnerable to XML attacks + --> S406.py:1:6 | 1 | from xml import sax # S406 | ^^^ 2 | import xml.sax as xmls # S406 3 | import xml.sax # S406 | -error[S406]: S406.py:2:8: `xml.sax` methods are vulnerable to XML attacks +error[S406]: 2:8: `xml.sax` methods are vulnerable to XML attacks + --> S406.py:2:8 | 1 | from xml import sax # S406 2 | import xml.sax as xmls # S406 | ^^^^^^^^^^^^^^^ 3 | import xml.sax # S406 | -error[S406]: S406.py:3:8: `xml.sax` methods are vulnerable to XML attacks +error[S406]: 3:8: `xml.sax` methods are vulnerable to XML attacks + --> S406.py:3:8 | 1 | from xml import sax # S406 2 | import xml.sax as xmls # S406 diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S407_S407.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S407_S407.py.snap index 8300832e1a..753b79f501 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S407_S407.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S407_S407.py.snap @@ -1,15 +1,17 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs --- -error[S407]: S407.py:1:6: `xml.dom.expatbuilder` is vulnerable to XML attacks +error[S407]: 1:6: `xml.dom.expatbuilder` is vulnerable to XML attacks + --> S407.py:1:6 | 1 | from xml.dom import expatbuilder # S407 | ^^^^^^^ 2 | import xml.dom.expatbuilder # S407 | -error[S407]: S407.py:2:8: `xml.dom.expatbuilder` is vulnerable to XML attacks +error[S407]: 2:8: `xml.dom.expatbuilder` is vulnerable to XML attacks + --> S407.py:2:8 | 1 | from xml.dom import expatbuilder # S407 2 | import xml.dom.expatbuilder # S407 diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S408_S408.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S408_S408.py.snap index 473db65eec..eea0a2c836 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S408_S408.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S408_S408.py.snap @@ -1,15 +1,17 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs --- -error[S408]: S408.py:1:6: `xml.dom.minidom` is vulnerable to XML attacks +error[S408]: 1:6: `xml.dom.minidom` is vulnerable to XML attacks + --> S408.py:1:6 | 1 | from xml.dom.minidom import parseString # S408 | ^^^^^^^^^^^^^^^ 2 | import xml.dom.minidom # S408 | -error[S408]: S408.py:2:8: `xml.dom.minidom` is vulnerable to XML attacks +error[S408]: 2:8: `xml.dom.minidom` is vulnerable to XML attacks + --> S408.py:2:8 | 1 | from xml.dom.minidom import parseString # S408 2 | import xml.dom.minidom # S408 diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S409_S409.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S409_S409.py.snap index 81c192b3cc..25c2c755e3 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S409_S409.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S409_S409.py.snap @@ -1,15 +1,17 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs --- -error[S409]: S409.py:1:6: `xml.dom.pulldom` is vulnerable to XML attacks +error[S409]: 1:6: `xml.dom.pulldom` is vulnerable to XML attacks + --> S409.py:1:6 | 1 | from xml.dom.pulldom import parseString # S409 | ^^^^^^^^^^^^^^^ 2 | import xml.dom.pulldom # S409 | -error[S409]: S409.py:2:8: `xml.dom.pulldom` is vulnerable to XML attacks +error[S409]: 2:8: `xml.dom.pulldom` is vulnerable to XML attacks + --> S409.py:2:8 | 1 | from xml.dom.pulldom import parseString # S409 2 | import xml.dom.pulldom # S409 diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S410_S410.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S410_S410.py.snap index d01c5012f1..626da002f2 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S410_S410.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S410_S410.py.snap @@ -1,15 +1,17 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs --- -error[S410]: S410.py:1:8: `lxml` is vulnerable to XML attacks +error[S410]: 1:8: `lxml` is vulnerable to XML attacks + --> S410.py:1:8 | 1 | import lxml # S410 | ^^^^ 2 | from lxml import etree # S410 | -error[S410]: S410.py:2:6: `lxml` is vulnerable to XML attacks +error[S410]: 2:6: `lxml` is vulnerable to XML attacks + --> S410.py:2:6 | 1 | import lxml # S410 2 | from lxml import etree # S410 diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S411_S411.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S411_S411.py.snap index e7a6416e5f..1f5f17e790 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S411_S411.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S411_S411.py.snap @@ -1,15 +1,17 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs --- -error[S411]: S411.py:1:8: XMLRPC is vulnerable to remote XML attacks +error[S411]: 1:8: XMLRPC is vulnerable to remote XML attacks + --> S411.py:1:8 | 1 | import xmlrpc # S411 | ^^^^^^ 2 | from xmlrpc import server # S411 | -error[S411]: S411.py:2:6: XMLRPC is vulnerable to remote XML attacks +error[S411]: 2:6: XMLRPC is vulnerable to remote XML attacks + --> S411.py:2:6 | 1 | import xmlrpc # S411 2 | from xmlrpc import server # S411 diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S412_S412.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S412_S412.py.snap index d55e854a19..4932965b7c 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S412_S412.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S412_S412.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs --- -error[S412]: S412.py:1:6: `httpoxy` is a set of vulnerabilities that affect application code running inCGI, or CGI-like environments. The use of CGI for web applications should be avoided +error[S412]: 1:6: `httpoxy` is a set of vulnerabilities that affect application code running inCGI, or CGI-like environments. The use of CGI for web applications should be avoided + --> S412.py:1:6 | 1 | from twisted.web.twcgi import CGIScript # S412 | ^^^^^^^^^^^^^^^^^ diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S413_S413.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S413_S413.py.snap index 54be90b520..adbfb3d415 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S413_S413.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S413_S413.py.snap @@ -1,16 +1,18 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs --- -error[S413]: S413.py:1:8: `pycrypto` library is known to have publicly disclosed buffer overflow vulnerability +error[S413]: 1:8: `pycrypto` library is known to have publicly disclosed buffer overflow vulnerability + --> S413.py:1:8 | 1 | import Crypto.Hash # S413 | ^^^^^^^^^^^ 2 | from Crypto.Hash import MD2 # S413 3 | import Crypto.PublicKey # S413 | -error[S413]: S413.py:2:6: `pycrypto` library is known to have publicly disclosed buffer overflow vulnerability +error[S413]: 2:6: `pycrypto` library is known to have publicly disclosed buffer overflow vulnerability + --> S413.py:2:6 | 1 | import Crypto.Hash # S413 2 | from Crypto.Hash import MD2 # S413 @@ -18,8 +20,9 @@ error[S413]: S413.py:2:6: `pycrypto` library is known to have publicly disclosed 3 | import Crypto.PublicKey # S413 4 | from Crypto.PublicKey import RSA # S413 | -error[S413]: S413.py:3:8: `pycrypto` library is known to have publicly disclosed buffer overflow vulnerability +error[S413]: 3:8: `pycrypto` library is known to have publicly disclosed buffer overflow vulnerability + --> S413.py:3:8 | 1 | import Crypto.Hash # S413 2 | from Crypto.Hash import MD2 # S413 @@ -27,8 +30,9 @@ error[S413]: S413.py:3:8: `pycrypto` library is known to have publicly disclosed | ^^^^^^^^^^^^^^^^ 4 | from Crypto.PublicKey import RSA # S413 | -error[S413]: S413.py:4:6: `pycrypto` library is known to have publicly disclosed buffer overflow vulnerability +error[S413]: 4:6: `pycrypto` library is known to have publicly disclosed buffer overflow vulnerability + --> S413.py:4:6 | 2 | from Crypto.Hash import MD2 # S413 3 | import Crypto.PublicKey # S413 diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S415_S415.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S415_S415.py.snap index be7c3cc1a3..1f22545bd9 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S415_S415.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S415_S415.py.snap @@ -1,15 +1,17 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs --- -error[S415]: S415.py:1:8: An IPMI-related module is being imported. Prefer an encrypted protocol over IPMI. +error[S415]: 1:8: An IPMI-related module is being imported. Prefer an encrypted protocol over IPMI. + --> S415.py:1:8 | 1 | import pyghmi # S415 | ^^^^^^ 2 | from pyghmi import foo # S415 | -error[S415]: S415.py:2:6: An IPMI-related module is being imported. Prefer an encrypted protocol over IPMI. +error[S415]: 2:6: An IPMI-related module is being imported. Prefer an encrypted protocol over IPMI. + --> S415.py:2:6 | 1 | import pyghmi # S415 2 | from pyghmi import foo # S415 diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S501_S501.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S501_S501.py.snap index 8845006d2b..da8a76b4cf 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S501_S501.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S501_S501.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs --- -error[S501]: S501.py:5:47: Probable use of `requests` call with `verify=False` disabling SSL certificate checks +error[S501]: 5:47: Probable use of `requests` call with `verify=False` disabling SSL certificate checks + --> S501.py:5:47 | 4 | requests.get('https://gmail.com', timeout=30, verify=True) 5 | requests.get('https://gmail.com', timeout=30, verify=False) @@ -10,8 +11,9 @@ error[S501]: S501.py:5:47: Probable use of `requests` call with `verify=False` d 6 | requests.post('https://gmail.com', timeout=30, verify=True) 7 | requests.post('https://gmail.com', timeout=30, verify=False) | -error[S501]: S501.py:7:48: Probable use of `requests` call with `verify=False` disabling SSL certificate checks +error[S501]: 7:48: Probable use of `requests` call with `verify=False` disabling SSL certificate checks + --> S501.py:7:48 | 5 | requests.get('https://gmail.com', timeout=30, verify=False) 6 | requests.post('https://gmail.com', timeout=30, verify=True) @@ -20,8 +22,9 @@ error[S501]: S501.py:7:48: Probable use of `requests` call with `verify=False` d 8 | requests.put('https://gmail.com', timeout=30, verify=True) 9 | requests.put('https://gmail.com', timeout=30, verify=False) | -error[S501]: S501.py:9:47: Probable use of `requests` call with `verify=False` disabling SSL certificate checks +error[S501]: 9:47: Probable use of `requests` call with `verify=False` disabling SSL certificate checks + --> S501.py:9:47 | 7 | requests.post('https://gmail.com', timeout=30, verify=False) 8 | requests.put('https://gmail.com', timeout=30, verify=True) @@ -30,8 +33,9 @@ error[S501]: S501.py:9:47: Probable use of `requests` call with `verify=False` d 10 | requests.delete('https://gmail.com', timeout=30, verify=True) 11 | requests.delete('https://gmail.com', timeout=30, verify=False) | -error[S501]: S501.py:11:50: Probable use of `requests` call with `verify=False` disabling SSL certificate checks +error[S501]: 11:50: Probable use of `requests` call with `verify=False` disabling SSL certificate checks + --> S501.py:11:50 | 9 | requests.put('https://gmail.com', timeout=30, verify=False) 10 | requests.delete('https://gmail.com', timeout=30, verify=True) @@ -40,8 +44,9 @@ error[S501]: S501.py:11:50: Probable use of `requests` call with `verify=False` 12 | requests.patch('https://gmail.com', timeout=30, verify=True) 13 | requests.patch('https://gmail.com', timeout=30, verify=False) | -error[S501]: S501.py:13:49: Probable use of `requests` call with `verify=False` disabling SSL certificate checks +error[S501]: 13:49: Probable use of `requests` call with `verify=False` disabling SSL certificate checks + --> S501.py:13:49 | 11 | requests.delete('https://gmail.com', timeout=30, verify=False) 12 | requests.patch('https://gmail.com', timeout=30, verify=True) @@ -50,8 +55,9 @@ error[S501]: S501.py:13:49: Probable use of `requests` call with `verify=False` 14 | requests.options('https://gmail.com', timeout=30, verify=True) 15 | requests.options('https://gmail.com', timeout=30, verify=False) | -error[S501]: S501.py:15:51: Probable use of `requests` call with `verify=False` disabling SSL certificate checks +error[S501]: 15:51: Probable use of `requests` call with `verify=False` disabling SSL certificate checks + --> S501.py:15:51 | 13 | requests.patch('https://gmail.com', timeout=30, verify=False) 14 | requests.options('https://gmail.com', timeout=30, verify=True) @@ -60,8 +66,9 @@ error[S501]: S501.py:15:51: Probable use of `requests` call with `verify=False` 16 | requests.head('https://gmail.com', timeout=30, verify=True) 17 | requests.head('https://gmail.com', timeout=30, verify=False) | -error[S501]: S501.py:17:48: Probable use of `requests` call with `verify=False` disabling SSL certificate checks +error[S501]: 17:48: Probable use of `requests` call with `verify=False` disabling SSL certificate checks + --> S501.py:17:48 | 15 | requests.options('https://gmail.com', timeout=30, verify=False) 16 | requests.head('https://gmail.com', timeout=30, verify=True) @@ -70,8 +77,9 @@ error[S501]: S501.py:17:48: Probable use of `requests` call with `verify=False` 18 | 19 | httpx.request('GET', 'https://gmail.com', verify=True) | -error[S501]: S501.py:20:43: Probable use of `httpx` call with `verify=False` disabling SSL certificate checks +error[S501]: 20:43: Probable use of `httpx` call with `verify=False` disabling SSL certificate checks + --> S501.py:20:43 | 19 | httpx.request('GET', 'https://gmail.com', verify=True) 20 | httpx.request('GET', 'https://gmail.com', verify=False) @@ -79,8 +87,9 @@ error[S501]: S501.py:20:43: Probable use of `httpx` call with `verify=False` dis 21 | httpx.get('https://gmail.com', verify=True) 22 | httpx.get('https://gmail.com', verify=False) | -error[S501]: S501.py:22:32: Probable use of `httpx` call with `verify=False` disabling SSL certificate checks +error[S501]: 22:32: Probable use of `httpx` call with `verify=False` disabling SSL certificate checks + --> S501.py:22:32 | 20 | httpx.request('GET', 'https://gmail.com', verify=False) 21 | httpx.get('https://gmail.com', verify=True) @@ -89,8 +98,9 @@ error[S501]: S501.py:22:32: Probable use of `httpx` call with `verify=False` dis 23 | httpx.options('https://gmail.com', verify=True) 24 | httpx.options('https://gmail.com', verify=False) | -error[S501]: S501.py:24:36: Probable use of `httpx` call with `verify=False` disabling SSL certificate checks +error[S501]: 24:36: Probable use of `httpx` call with `verify=False` disabling SSL certificate checks + --> S501.py:24:36 | 22 | httpx.get('https://gmail.com', verify=False) 23 | httpx.options('https://gmail.com', verify=True) @@ -99,8 +109,9 @@ error[S501]: S501.py:24:36: Probable use of `httpx` call with `verify=False` dis 25 | httpx.head('https://gmail.com', verify=True) 26 | httpx.head('https://gmail.com', verify=False) | -error[S501]: S501.py:26:33: Probable use of `httpx` call with `verify=False` disabling SSL certificate checks +error[S501]: 26:33: Probable use of `httpx` call with `verify=False` disabling SSL certificate checks + --> S501.py:26:33 | 24 | httpx.options('https://gmail.com', verify=False) 25 | httpx.head('https://gmail.com', verify=True) @@ -109,8 +120,9 @@ error[S501]: S501.py:26:33: Probable use of `httpx` call with `verify=False` dis 27 | httpx.post('https://gmail.com', verify=True) 28 | httpx.post('https://gmail.com', verify=False) | -error[S501]: S501.py:28:33: Probable use of `httpx` call with `verify=False` disabling SSL certificate checks +error[S501]: 28:33: Probable use of `httpx` call with `verify=False` disabling SSL certificate checks + --> S501.py:28:33 | 26 | httpx.head('https://gmail.com', verify=False) 27 | httpx.post('https://gmail.com', verify=True) @@ -119,8 +131,9 @@ error[S501]: S501.py:28:33: Probable use of `httpx` call with `verify=False` dis 29 | httpx.put('https://gmail.com', verify=True) 30 | httpx.put('https://gmail.com', verify=False) | -error[S501]: S501.py:30:32: Probable use of `httpx` call with `verify=False` disabling SSL certificate checks +error[S501]: 30:32: Probable use of `httpx` call with `verify=False` disabling SSL certificate checks + --> S501.py:30:32 | 28 | httpx.post('https://gmail.com', verify=False) 29 | httpx.put('https://gmail.com', verify=True) @@ -129,8 +142,9 @@ error[S501]: S501.py:30:32: Probable use of `httpx` call with `verify=False` dis 31 | httpx.patch('https://gmail.com', verify=True) 32 | httpx.patch('https://gmail.com', verify=False) | -error[S501]: S501.py:32:34: Probable use of `httpx` call with `verify=False` disabling SSL certificate checks +error[S501]: 32:34: Probable use of `httpx` call with `verify=False` disabling SSL certificate checks + --> S501.py:32:34 | 30 | httpx.put('https://gmail.com', verify=False) 31 | httpx.patch('https://gmail.com', verify=True) @@ -139,8 +153,9 @@ error[S501]: S501.py:32:34: Probable use of `httpx` call with `verify=False` dis 33 | httpx.delete('https://gmail.com', verify=True) 34 | httpx.delete('https://gmail.com', verify=False) | -error[S501]: S501.py:34:35: Probable use of `httpx` call with `verify=False` disabling SSL certificate checks +error[S501]: 34:35: Probable use of `httpx` call with `verify=False` disabling SSL certificate checks + --> S501.py:34:35 | 32 | httpx.patch('https://gmail.com', verify=False) 33 | httpx.delete('https://gmail.com', verify=True) @@ -149,8 +164,9 @@ error[S501]: S501.py:34:35: Probable use of `httpx` call with `verify=False` dis 35 | httpx.stream('https://gmail.com', verify=True) 36 | httpx.stream('https://gmail.com', verify=False) | -error[S501]: S501.py:36:35: Probable use of `httpx` call with `verify=False` disabling SSL certificate checks +error[S501]: 36:35: Probable use of `httpx` call with `verify=False` disabling SSL certificate checks + --> S501.py:36:35 | 34 | httpx.delete('https://gmail.com', verify=False) 35 | httpx.stream('https://gmail.com', verify=True) @@ -159,8 +175,9 @@ error[S501]: S501.py:36:35: Probable use of `httpx` call with `verify=False` dis 37 | httpx.Client() 38 | httpx.Client(verify=False) | -error[S501]: S501.py:38:14: Probable use of `httpx` call with `verify=False` disabling SSL certificate checks +error[S501]: 38:14: Probable use of `httpx` call with `verify=False` disabling SSL certificate checks + --> S501.py:38:14 | 36 | httpx.stream('https://gmail.com', verify=False) 37 | httpx.Client() @@ -169,8 +186,9 @@ error[S501]: S501.py:38:14: Probable use of `httpx` call with `verify=False` dis 39 | httpx.AsyncClient() 40 | httpx.AsyncClient(verify=False) | -error[S501]: S501.py:40:19: Probable use of `httpx` call with `verify=False` disabling SSL certificate checks +error[S501]: 40:19: Probable use of `httpx` call with `verify=False` disabling SSL certificate checks + --> S501.py:40:19 | 38 | httpx.Client(verify=False) 39 | httpx.AsyncClient() diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S502_S502.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S502_S502.py.snap index 412499b43f..2c13fe9edd 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S502_S502.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S502_S502.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs --- -error[S502]: S502.py:6:13: Call made with insecure SSL protocol: `PROTOCOL_SSLv3` +error[S502]: 6:13: Call made with insecure SSL protocol: `PROTOCOL_SSLv3` + --> S502.py:6:13 | 4 | from OpenSSL.SSL import Context 5 | @@ -11,8 +12,9 @@ error[S502]: S502.py:6:13: Call made with insecure SSL protocol: `PROTOCOL_SSLv3 7 | ssl.wrap_socket(ssl_version=ssl.PROTOCOL_TLSv1) # S502 8 | ssl.wrap_socket(ssl_version=ssl.PROTOCOL_SSLv2) # S502 | -error[S502]: S502.py:7:17: Call made with insecure SSL protocol: `PROTOCOL_TLSv1` +error[S502]: 7:17: Call made with insecure SSL protocol: `PROTOCOL_TLSv1` + --> S502.py:7:17 | 6 | wrap_socket(ssl_version=ssl.PROTOCOL_SSLv3) # S502 7 | ssl.wrap_socket(ssl_version=ssl.PROTOCOL_TLSv1) # S502 @@ -20,8 +22,9 @@ error[S502]: S502.py:7:17: Call made with insecure SSL protocol: `PROTOCOL_TLSv1 8 | ssl.wrap_socket(ssl_version=ssl.PROTOCOL_SSLv2) # S502 9 | SSL.Context(method=SSL.SSLv2_METHOD) # S502 | -error[S502]: S502.py:8:17: Call made with insecure SSL protocol: `PROTOCOL_SSLv2` +error[S502]: 8:17: Call made with insecure SSL protocol: `PROTOCOL_SSLv2` + --> S502.py:8:17 | 6 | wrap_socket(ssl_version=ssl.PROTOCOL_SSLv3) # S502 7 | ssl.wrap_socket(ssl_version=ssl.PROTOCOL_TLSv1) # S502 @@ -30,8 +33,9 @@ error[S502]: S502.py:8:17: Call made with insecure SSL protocol: `PROTOCOL_SSLv2 9 | SSL.Context(method=SSL.SSLv2_METHOD) # S502 10 | SSL.Context(method=SSL.SSLv23_METHOD) # S502 | -error[S502]: S502.py:9:13: Call made with insecure SSL protocol: `SSLv2_METHOD` +error[S502]: 9:13: Call made with insecure SSL protocol: `SSLv2_METHOD` + --> S502.py:9:13 | 7 | ssl.wrap_socket(ssl_version=ssl.PROTOCOL_TLSv1) # S502 8 | ssl.wrap_socket(ssl_version=ssl.PROTOCOL_SSLv2) # S502 @@ -40,8 +44,9 @@ error[S502]: S502.py:9:13: Call made with insecure SSL protocol: `SSLv2_METHOD` 10 | SSL.Context(method=SSL.SSLv23_METHOD) # S502 11 | Context(method=SSL.SSLv3_METHOD) # S502 | -error[S502]: S502.py:10:13: Call made with insecure SSL protocol: `SSLv23_METHOD` +error[S502]: 10:13: Call made with insecure SSL protocol: `SSLv23_METHOD` + --> S502.py:10:13 | 8 | ssl.wrap_socket(ssl_version=ssl.PROTOCOL_SSLv2) # S502 9 | SSL.Context(method=SSL.SSLv2_METHOD) # S502 @@ -50,8 +55,9 @@ error[S502]: S502.py:10:13: Call made with insecure SSL protocol: `SSLv23_METHOD 11 | Context(method=SSL.SSLv3_METHOD) # S502 12 | Context(method=SSL.TLSv1_METHOD) # S502 | -error[S502]: S502.py:11:9: Call made with insecure SSL protocol: `SSLv3_METHOD` +error[S502]: 11:9: Call made with insecure SSL protocol: `SSLv3_METHOD` + --> S502.py:11:9 | 9 | SSL.Context(method=SSL.SSLv2_METHOD) # S502 10 | SSL.Context(method=SSL.SSLv23_METHOD) # S502 @@ -59,8 +65,9 @@ error[S502]: S502.py:11:9: Call made with insecure SSL protocol: `SSLv3_METHOD` | ^^^^^^^^^^^^^^^^^^^^^^^ 12 | Context(method=SSL.TLSv1_METHOD) # S502 | -error[S502]: S502.py:12:9: Call made with insecure SSL protocol: `TLSv1_METHOD` +error[S502]: 12:9: Call made with insecure SSL protocol: `TLSv1_METHOD` + --> S502.py:12:9 | 10 | SSL.Context(method=SSL.SSLv23_METHOD) # S502 11 | Context(method=SSL.SSLv3_METHOD) # S502 diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S503_S503.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S503_S503.py.snap index 3c3596cb0c..c957349ae4 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S503_S503.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S503_S503.py.snap @@ -1,29 +1,33 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs --- -error[S503]: S503.py:6:18: Argument default set to insecure SSL protocol: `PROTOCOL_SSLv2` +error[S503]: 6:18: Argument default set to insecure SSL protocol: `PROTOCOL_SSLv2` + --> S503.py:6:18 | 6 | def func(version=ssl.PROTOCOL_SSLv2): # S503 | ^^^^^^^^^^^^^^^^^^ 7 | pass | -error[S503]: S503.py:10:19: Argument default set to insecure SSL protocol: `SSLv2_METHOD` +error[S503]: 10:19: Argument default set to insecure SSL protocol: `SSLv2_METHOD` + --> S503.py:10:19 | 10 | def func(protocol=SSL.SSLv2_METHOD): # S503 | ^^^^^^^^^^^^^^^^ 11 | pass | -error[S503]: S503.py:14:18: Argument default set to insecure SSL protocol: `SSLv23_METHOD` +error[S503]: 14:18: Argument default set to insecure SSL protocol: `SSLv23_METHOD` + --> S503.py:14:18 | 14 | def func(version=SSL.SSLv23_METHOD): # S503 | ^^^^^^^^^^^^^^^^^ 15 | pass | -error[S503]: S503.py:18:19: Argument default set to insecure SSL protocol: `PROTOCOL_TLSv1` +error[S503]: 18:19: Argument default set to insecure SSL protocol: `PROTOCOL_TLSv1` + --> S503.py:18:19 | 18 | def func(protocol=PROTOCOL_TLSv1): # S503 | ^^^^^^^^^^^^^^ diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S504_S504.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S504_S504.py.snap index af9760b2c8..d511d872c0 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S504_S504.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S504_S504.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs --- -error[S504]: S504.py:4:1: `ssl.wrap_socket` called without an `ssl_version`` +error[S504]: 4:1: `ssl.wrap_socket` called without an `ssl_version`` + --> S504.py:3:1 | 2 | from ssl import wrap_socket 3 | @@ -11,8 +12,9 @@ error[S504]: S504.py:4:1: `ssl.wrap_socket` called without an `ssl_version`` 5 | wrap_socket() # S504 6 | ssl.wrap_socket(ssl_version=ssl.PROTOCOL_TLSv1_2) # OK | -error[S504]: S504.py:5:1: `ssl.wrap_socket` called without an `ssl_version`` +error[S504]: 5:1: `ssl.wrap_socket` called without an `ssl_version`` + --> S504.py:4:26 | 4 | ssl.wrap_socket() # S504 5 | wrap_socket() # S504 diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S505_S505.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S505_S505.py.snap index 3190c65ad2..0d7a2c95d2 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S505_S505.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S505_S505.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs --- -error[S505]: S505.py:29:35: DSA key sizes below 2048 bits are considered breakable +error[S505]: 29:35: DSA key sizes below 2048 bits are considered breakable + --> S505.py:29:35 | 28 | # Errors 29 | dsa.generate_private_key(key_size=2047, backend=backends.default_backend()) @@ -10,8 +11,9 @@ error[S505]: S505.py:29:35: DSA key sizes below 2048 bits are considered breakab 30 | ec.generate_private_key(curve=ec.SECT163R2, backend=backends.default_backend()) 31 | rsa.generate_private_key( | -error[S505]: S505.py:30:31: EC key sizes below 224 bits are considered breakable +error[S505]: 30:31: EC key sizes below 224 bits are considered breakable + --> S505.py:30:31 | 28 | # Errors 29 | dsa.generate_private_key(key_size=2047, backend=backends.default_backend()) @@ -20,8 +22,9 @@ error[S505]: S505.py:30:31: EC key sizes below 224 bits are considered breakable 31 | rsa.generate_private_key( 32 | public_exponent=65537, key_size=2047, backend=backends.default_backend() | -error[S505]: S505.py:32:37: RSA key sizes below 2048 bits are considered breakable +error[S505]: 32:37: RSA key sizes below 2048 bits are considered breakable + --> S505.py:32:37 | 30 | ec.generate_private_key(curve=ec.SECT163R2, backend=backends.default_backend()) 31 | rsa.generate_private_key( @@ -30,8 +33,9 @@ error[S505]: S505.py:32:37: RSA key sizes below 2048 bits are considered breakab 33 | ) 34 | pycrypto_dsa.generate(bits=2047) | -error[S505]: S505.py:34:28: DSA key sizes below 2048 bits are considered breakable +error[S505]: 34:28: DSA key sizes below 2048 bits are considered breakable + --> S505.py:34:28 | 32 | public_exponent=65537, key_size=2047, backend=backends.default_backend() 33 | ) @@ -40,8 +44,9 @@ error[S505]: S505.py:34:28: DSA key sizes below 2048 bits are considered breakab 35 | pycrypto_rsa.generate(bits=2047) 36 | pycryptodomex_dsa.generate(bits=2047) | -error[S505]: S505.py:35:28: DSA key sizes below 2048 bits are considered breakable +error[S505]: 35:28: DSA key sizes below 2048 bits are considered breakable + --> S505.py:35:28 | 33 | ) 34 | pycrypto_dsa.generate(bits=2047) @@ -50,8 +55,9 @@ error[S505]: S505.py:35:28: DSA key sizes below 2048 bits are considered breakab 36 | pycryptodomex_dsa.generate(bits=2047) 37 | pycryptodomex_rsa.generate(bits=2047) | -error[S505]: S505.py:36:33: DSA key sizes below 2048 bits are considered breakable +error[S505]: 36:33: DSA key sizes below 2048 bits are considered breakable + --> S505.py:36:33 | 34 | pycrypto_dsa.generate(bits=2047) 35 | pycrypto_rsa.generate(bits=2047) @@ -60,8 +66,9 @@ error[S505]: S505.py:36:33: DSA key sizes below 2048 bits are considered breakab 37 | pycryptodomex_rsa.generate(bits=2047) 38 | dsa.generate_private_key(2047, backends.default_backend()) | -error[S505]: S505.py:37:33: DSA key sizes below 2048 bits are considered breakable +error[S505]: 37:33: DSA key sizes below 2048 bits are considered breakable + --> S505.py:37:33 | 35 | pycrypto_rsa.generate(bits=2047) 36 | pycryptodomex_dsa.generate(bits=2047) @@ -70,8 +77,9 @@ error[S505]: S505.py:37:33: DSA key sizes below 2048 bits are considered breakab 38 | dsa.generate_private_key(2047, backends.default_backend()) 39 | ec.generate_private_key(ec.SECT163R2, backends.default_backend()) | -error[S505]: S505.py:38:26: DSA key sizes below 2048 bits are considered breakable +error[S505]: 38:26: DSA key sizes below 2048 bits are considered breakable + --> S505.py:38:26 | 36 | pycryptodomex_dsa.generate(bits=2047) 37 | pycryptodomex_rsa.generate(bits=2047) @@ -80,8 +88,9 @@ error[S505]: S505.py:38:26: DSA key sizes below 2048 bits are considered breakab 39 | ec.generate_private_key(ec.SECT163R2, backends.default_backend()) 40 | rsa.generate_private_key(3, 2047, backends.default_backend()) | -error[S505]: S505.py:39:25: EC key sizes below 224 bits are considered breakable +error[S505]: 39:25: EC key sizes below 224 bits are considered breakable + --> S505.py:39:25 | 37 | pycryptodomex_rsa.generate(bits=2047) 38 | dsa.generate_private_key(2047, backends.default_backend()) @@ -90,8 +99,9 @@ error[S505]: S505.py:39:25: EC key sizes below 224 bits are considered breakable 40 | rsa.generate_private_key(3, 2047, backends.default_backend()) 41 | pycrypto_dsa.generate(2047) | -error[S505]: S505.py:40:29: RSA key sizes below 2048 bits are considered breakable +error[S505]: 40:29: RSA key sizes below 2048 bits are considered breakable + --> S505.py:40:29 | 38 | dsa.generate_private_key(2047, backends.default_backend()) 39 | ec.generate_private_key(ec.SECT163R2, backends.default_backend()) @@ -100,8 +110,9 @@ error[S505]: S505.py:40:29: RSA key sizes below 2048 bits are considered breakab 41 | pycrypto_dsa.generate(2047) 42 | pycrypto_rsa.generate(2047) | -error[S505]: S505.py:41:23: DSA key sizes below 2048 bits are considered breakable +error[S505]: 41:23: DSA key sizes below 2048 bits are considered breakable + --> S505.py:41:23 | 39 | ec.generate_private_key(ec.SECT163R2, backends.default_backend()) 40 | rsa.generate_private_key(3, 2047, backends.default_backend()) @@ -110,8 +121,9 @@ error[S505]: S505.py:41:23: DSA key sizes below 2048 bits are considered breakab 42 | pycrypto_rsa.generate(2047) 43 | pycryptodomex_dsa.generate(2047) | -error[S505]: S505.py:42:23: DSA key sizes below 2048 bits are considered breakable +error[S505]: 42:23: DSA key sizes below 2048 bits are considered breakable + --> S505.py:42:23 | 40 | rsa.generate_private_key(3, 2047, backends.default_backend()) 41 | pycrypto_dsa.generate(2047) @@ -120,8 +132,9 @@ error[S505]: S505.py:42:23: DSA key sizes below 2048 bits are considered breakab 43 | pycryptodomex_dsa.generate(2047) 44 | pycryptodomex_rsa.generate(2047) | -error[S505]: S505.py:43:28: DSA key sizes below 2048 bits are considered breakable +error[S505]: 43:28: DSA key sizes below 2048 bits are considered breakable + --> S505.py:43:28 | 41 | pycrypto_dsa.generate(2047) 42 | pycrypto_rsa.generate(2047) @@ -129,8 +142,9 @@ error[S505]: S505.py:43:28: DSA key sizes below 2048 bits are considered breakab | ^^^^ 44 | pycryptodomex_rsa.generate(2047) | -error[S505]: S505.py:44:28: DSA key sizes below 2048 bits are considered breakable +error[S505]: 44:28: DSA key sizes below 2048 bits are considered breakable + --> S505.py:44:28 | 42 | pycrypto_rsa.generate(2047) 43 | pycryptodomex_dsa.generate(2047) diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S506_S506.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S506_S506.py.snap index 076dde1eb9..9fa9e4b716 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S506_S506.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S506_S506.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs --- -error[S506]: S506.py:10:9: Probable use of unsafe `yaml.load`. Allows instantiation of arbitrary objects. Consider `yaml.safe_load`. +error[S506]: 10:9: Probable use of unsafe `yaml.load`. Allows instantiation of arbitrary objects. Consider `yaml.safe_load`. + --> S506.py:10:9 | 8 | def test_yaml_load(): 9 | ystr = yaml.dump({"a": 1, "b": 2, "c": 3}) @@ -11,8 +12,9 @@ error[S506]: S506.py:10:9: Probable use of unsafe `yaml.load`. Allows instantiat 11 | yaml.dump(y) 12 | try: | -error[S506]: S506.py:24:24: Probable use of unsafe loader `Loader` with `yaml.load`. Allows instantiation of arbitrary objects. Consider `yaml.safe_load`. +error[S506]: 24:24: Probable use of unsafe loader `Loader` with `yaml.load`. Allows instantiation of arbitrary objects. Consider `yaml.safe_load`. + --> S506.py:24:24 | 24 | yaml.load("{}", Loader=yaml.Loader) | ^^^^^^^^^^^ diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S507_S507.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S507_S507.py.snap index a63a0f747d..21cec9c9dd 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S507_S507.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S507_S507.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs --- -error[S507]: S507.py:15:40: Paramiko call with policy set to automatically trust the unknown host key +error[S507]: 15:40: Paramiko call with policy set to automatically trust the unknown host key + --> S507.py:15:40 | 14 | # Errors 15 | ssh_client.set_missing_host_key_policy(client.AutoAddPolicy) @@ -10,8 +11,9 @@ error[S507]: S507.py:15:40: Paramiko call with policy set to automatically trust 16 | ssh_client.set_missing_host_key_policy(client.WarningPolicy) 17 | ssh_client.set_missing_host_key_policy(client.AutoAddPolicy()) | -error[S507]: S507.py:16:40: Paramiko call with policy set to automatically trust the unknown host key +error[S507]: 16:40: Paramiko call with policy set to automatically trust the unknown host key + --> S507.py:16:40 | 14 | # Errors 15 | ssh_client.set_missing_host_key_policy(client.AutoAddPolicy) @@ -20,8 +22,9 @@ error[S507]: S507.py:16:40: Paramiko call with policy set to automatically trust 17 | ssh_client.set_missing_host_key_policy(client.AutoAddPolicy()) 18 | ssh_client.set_missing_host_key_policy(AutoAddPolicy) | -error[S507]: S507.py:17:40: Paramiko call with policy set to automatically trust the unknown host key +error[S507]: 17:40: Paramiko call with policy set to automatically trust the unknown host key + --> S507.py:17:40 | 15 | ssh_client.set_missing_host_key_policy(client.AutoAddPolicy) 16 | ssh_client.set_missing_host_key_policy(client.WarningPolicy) @@ -30,8 +33,9 @@ error[S507]: S507.py:17:40: Paramiko call with policy set to automatically trust 18 | ssh_client.set_missing_host_key_policy(AutoAddPolicy) 19 | ssh_client.set_missing_host_key_policy(policy=client.AutoAddPolicy) | -error[S507]: S507.py:18:40: Paramiko call with policy set to automatically trust the unknown host key +error[S507]: 18:40: Paramiko call with policy set to automatically trust the unknown host key + --> S507.py:18:40 | 16 | ssh_client.set_missing_host_key_policy(client.WarningPolicy) 17 | ssh_client.set_missing_host_key_policy(client.AutoAddPolicy()) @@ -40,8 +44,9 @@ error[S507]: S507.py:18:40: Paramiko call with policy set to automatically trust 19 | ssh_client.set_missing_host_key_policy(policy=client.AutoAddPolicy) 20 | ssh_client.set_missing_host_key_policy(policy=client.WarningPolicy) | -error[S507]: S507.py:19:47: Paramiko call with policy set to automatically trust the unknown host key +error[S507]: 19:47: Paramiko call with policy set to automatically trust the unknown host key + --> S507.py:19:47 | 17 | ssh_client.set_missing_host_key_policy(client.AutoAddPolicy()) 18 | ssh_client.set_missing_host_key_policy(AutoAddPolicy) @@ -50,8 +55,9 @@ error[S507]: S507.py:19:47: Paramiko call with policy set to automatically trust 20 | ssh_client.set_missing_host_key_policy(policy=client.WarningPolicy) 21 | ssh_client.set_missing_host_key_policy(policy=WarningPolicy) | -error[S507]: S507.py:20:47: Paramiko call with policy set to automatically trust the unknown host key +error[S507]: 20:47: Paramiko call with policy set to automatically trust the unknown host key + --> S507.py:20:47 | 18 | ssh_client.set_missing_host_key_policy(AutoAddPolicy) 19 | ssh_client.set_missing_host_key_policy(policy=client.AutoAddPolicy) @@ -60,8 +66,9 @@ error[S507]: S507.py:20:47: Paramiko call with policy set to automatically trust 21 | ssh_client.set_missing_host_key_policy(policy=WarningPolicy) 22 | ssh_client_from_paramiko.set_missing_host_key_policy(paramiko.AutoAddPolicy) | -error[S507]: S507.py:21:47: Paramiko call with policy set to automatically trust the unknown host key +error[S507]: 21:47: Paramiko call with policy set to automatically trust the unknown host key + --> S507.py:21:47 | 19 | ssh_client.set_missing_host_key_policy(policy=client.AutoAddPolicy) 20 | ssh_client.set_missing_host_key_policy(policy=client.WarningPolicy) @@ -69,8 +76,9 @@ error[S507]: S507.py:21:47: Paramiko call with policy set to automatically trust | ^^^^^^^^^^^^^ 22 | ssh_client_from_paramiko.set_missing_host_key_policy(paramiko.AutoAddPolicy) | -error[S507]: S507.py:22:54: Paramiko call with policy set to automatically trust the unknown host key +error[S507]: 22:54: Paramiko call with policy set to automatically trust the unknown host key + --> S507.py:22:54 | 20 | ssh_client.set_missing_host_key_policy(policy=client.WarningPolicy) 21 | ssh_client.set_missing_host_key_policy(policy=WarningPolicy) diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S508_S508.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S508_S508.py.snap index 4f718e0374..1a2783b277 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S508_S508.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S508_S508.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs --- -error[S508]: S508.py:3:25: The use of SNMPv1 and SNMPv2 is insecure. Use SNMPv3 if able. +error[S508]: 3:25: The use of SNMPv1 and SNMPv2 is insecure. Use SNMPv3 if able. + --> S508.py:3:25 | 1 | from pysnmp.hlapi import CommunityData 2 | @@ -10,8 +11,9 @@ error[S508]: S508.py:3:25: The use of SNMPv1 and SNMPv2 is insecure. Use SNMPv3 | ^^^^^^^^^ 4 | CommunityData("public", mpModel=1) # S508 | -error[S508]: S508.py:4:25: The use of SNMPv1 and SNMPv2 is insecure. Use SNMPv3 if able. +error[S508]: 4:25: The use of SNMPv1 and SNMPv2 is insecure. Use SNMPv3 if able. + --> S508.py:4:25 | 3 | CommunityData("public", mpModel=0) # S508 4 | CommunityData("public", mpModel=1) # S508 diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S509_S509.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S509_S509.py.snap index 6826091e99..c0bf77e7fb 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S509_S509.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S509_S509.py.snap @@ -1,15 +1,17 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs --- -error[S509]: S509.py:4:12: You should not use SNMPv3 without encryption. `noAuthNoPriv` & `authNoPriv` is insecure. +error[S509]: 4:12: You should not use SNMPv3 without encryption. `noAuthNoPriv` & `authNoPriv` is insecure. + --> S509.py:4:12 | 4 | insecure = UsmUserData("securityName") # S509 | ^^^^^^^^^^^ 5 | auth_no_priv = UsmUserData("securityName", "authName") # S509 | -error[S509]: S509.py:5:16: You should not use SNMPv3 without encryption. `noAuthNoPriv` & `authNoPriv` is insecure. +error[S509]: 5:16: You should not use SNMPv3 without encryption. `noAuthNoPriv` & `authNoPriv` is insecure. + --> S509.py:5:16 | 4 | insecure = UsmUserData("securityName") # S509 5 | auth_no_priv = UsmUserData("securityName", "authName") # S509 diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S601_S601.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S601_S601.py.snap index f03adb7ff9..f6d03962c2 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S601_S601.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S601_S601.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs --- -error[S601]: S601.py:3:1: Possible shell injection via Paramiko call; check inputs are properly sanitized +error[S601]: 3:1: Possible shell injection via Paramiko call; check inputs are properly sanitized + --> S601.py:2:1 | 1 | import paramiko 2 | diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S602_S602.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S602_S602.py.snap index 6976a96c1d..0a82aaece7 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S602_S602.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S602_S602.py.snap @@ -1,115 +1,128 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs --- -S602.py:4:1: S602 `subprocess` call with `shell=True` seems safe, but may be changed in the future; consider rewriting without `shell` +error[S602]: 4:1: `subprocess` call with `shell=True` seems safe, but may be changed in the future; consider rewriting without `shell` + + --> S602.py:3:46 | 3 | # Check different Popen wrappers are checked. 4 | Popen("true", shell=True) - | ^^^^^ S602 + | ^^^^^ 5 | call("true", shell=True) 6 | check_call("true", shell=True) | +error[S602]: 5:1: `subprocess` call with `shell=True` seems safe, but may be changed in the future; consider rewriting without `shell` -S602.py:5:1: S602 `subprocess` call with `shell=True` seems safe, but may be changed in the future; consider rewriting without `shell` + --> S602.py:4:26 | 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) | +error[S602]: 6:1: `subprocess` call with `shell=True` seems safe, but may be changed in the future; consider rewriting without `shell` -S602.py:6:1: S602 `subprocess` call with `shell=True` seems safe, but may be changed in the future; consider rewriting without `shell` + --> S602.py:5:25 | 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) | +error[S602]: 7:1: `subprocess` call with `shell=True` seems safe, but may be changed in the future; consider rewriting without `shell` -S602.py:7:1: S602 `subprocess` call with `shell=True` seems safe, but may be changed in the future; consider rewriting without `shell` + --> S602.py:6:31 | 5 | call("true", shell=True) 6 | check_call("true", shell=True) 7 | check_output("true", shell=True) - | ^^^^^^^^^^^^ S602 + | ^^^^^^^^^^^^ 8 | run("true", shell=True) | +error[S602]: 8:1: `subprocess` call with `shell=True` seems safe, but may be changed in the future; consider rewriting without `shell` -S602.py:8:1: S602 `subprocess` call with `shell=True` seems safe, but may be changed in the future; consider rewriting without `shell` + --> S602.py:7:33 | 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. | +error[S602]: 11:1: `subprocess` call with truthy `shell` seems safe, but may be changed in the future; consider rewriting without `shell` -S602.py:11:1: S602 `subprocess` call with truthy `shell` seems safe, but may be changed in the future; consider rewriting without `shell` + --> S602.py:10:55 | 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}) | +error[S602]: 12:1: `subprocess` call with truthy `shell` seems safe, but may be changed in the future; consider rewriting without `shell` -S602.py:12:1: S602 `subprocess` call with truthy `shell` seems safe, but may be changed in the future; consider rewriting without `shell` + --> S602.py:11:23 | 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,)) | +error[S602]: 13:1: `subprocess` call with truthy `shell` seems safe, but may be changed in the future; consider rewriting without `shell` -S602.py:13:1: S602 `subprocess` call with truthy `shell` seems safe, but may be changed in the future; consider rewriting without `shell` + --> S602.py:12:25 | 11 | Popen("true", shell=1) 12 | Popen("true", shell=[1]) 13 | Popen("true", shell={1: 1}) - | ^^^^^ S602 + | ^^^^^ 14 | Popen("true", shell=(1,)) | +error[S602]: 14:1: `subprocess` call with truthy `shell` seems safe, but may be changed in the future; consider rewriting without `shell` -S602.py:14:1: S602 `subprocess` call with truthy `shell` seems safe, but may be changed in the future; consider rewriting without `shell` + --> S602.py:13:28 | 12 | Popen("true", shell=[1]) 13 | Popen("true", shell={1: 1}) 14 | Popen("true", shell=(1,)) - | ^^^^^ S602 + | ^^^^^ 15 | 16 | # Check command argument looks unsafe. | +error[S602]: 18:1: `subprocess` call with `shell=True` identified, security issue -S602.py:18:1: S602 `subprocess` call with `shell=True` identified, security issue + --> S602.py:17:20 | 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) | +error[S602]: 19:1: `subprocess` call with `shell=True` identified, security issue -S602.py:19:1: S602 `subprocess` call with `shell=True` identified, security issue + --> S602.py:18:30 | 17 | var_string = "true" 18 | Popen(var_string, shell=True) 19 | Popen([var_string], shell=True) - | ^^^^^ S602 + | ^^^^^ 20 | Popen([var_string, ""], shell=True) | +error[S602]: 20:1: `subprocess` call with `shell=True` identified, security issue -S602.py:20:1: S602 `subprocess` call with `shell=True` identified, security issue + --> S602.py:19:32 | 18 | Popen(var_string, shell=True) 19 | Popen([var_string], shell=True) 20 | Popen([var_string, ""], shell=True) - | ^^^^^ S602 + | ^^^^^ | diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S603_S603.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S603_S603.py.snap index 052f58dd6a..6405a39c3b 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S603_S603.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S603_S603.py.snap @@ -1,104 +1,116 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs --- -S603.py:4:1: S603 `subprocess` call: check for execution of untrusted input +error[S603]: 4:1: `subprocess` call: check for execution of untrusted input + + --> S603.py:3:40 | 3 | # Different Popen wrappers are checked. 4 | Popen("true", shell=False) - | ^^^^^ S603 + | ^^^^^ 5 | call("true", shell=False) 6 | check_call("true", shell=False) | +error[S603]: 5:1: `subprocess` call: check for execution of untrusted input -S603.py:5:1: S603 `subprocess` call: check for execution of untrusted input + --> S603.py:4:27 | 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) | +error[S603]: 6:1: `subprocess` call: check for execution of untrusted input -S603.py:6:1: S603 `subprocess` call: check for execution of untrusted input + --> S603.py:5:26 | 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) | +error[S603]: 7:1: `subprocess` call: check for execution of untrusted input -S603.py:7:1: S603 `subprocess` call: check for execution of untrusted input + --> S603.py:6:32 | 5 | call("true", shell=False) 6 | check_call("true", shell=False) 7 | check_output("true", shell=False) - | ^^^^^^^^^^^^ S603 + | ^^^^^^^^^^^^ 8 | run("true", shell=False) | +error[S603]: 8:1: `subprocess` call: check for execution of untrusted input -S603.py:8:1: S603 `subprocess` call: check for execution of untrusted input + --> S603.py:7:34 | 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. | +error[S603]: 11:1: `subprocess` call: check for execution of untrusted input -S603.py:11:1: S603 `subprocess` call: check for execution of untrusted input + --> S603.py:10:50 | 10 | # Values that falsey values are treated as false. 11 | Popen("true", shell=0) - | ^^^^^ S603 + | ^^^^^ 12 | Popen("true", shell=[]) 13 | Popen("true", shell={}) | +error[S603]: 12:1: `subprocess` call: check for execution of untrusted input -S603.py:12:1: S603 `subprocess` call: check for execution of untrusted input + --> S603.py:11:23 | 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) | +error[S603]: 13:1: `subprocess` call: check for execution of untrusted input -S603.py:13:1: S603 `subprocess` call: check for execution of untrusted input + --> S603.py:12:24 | 11 | Popen("true", shell=0) 12 | Popen("true", shell=[]) 13 | Popen("true", shell={}) - | ^^^^^ S603 + | ^^^^^ 14 | Popen("true", shell=None) | +error[S603]: 14:1: `subprocess` call: check for execution of untrusted input -S603.py:14:1: S603 `subprocess` call: check for execution of untrusted input + --> S603.py:13:24 | 12 | Popen("true", shell=[]) 13 | Popen("true", shell={}) 14 | Popen("true", shell=None) - | ^^^^^ S603 + | ^^^^^ 15 | 16 | # Unknown values are treated as falsey. | +error[S603]: 17:1: `subprocess` call: check for execution of untrusted input -S603.py:17:1: S603 `subprocess` call: check for execution of untrusted input + --> S603.py:16:40 | 16 | # Unknown values are treated as falsey. 17 | Popen("true", shell=True if True else False) - | ^^^^^ S603 + | ^^^^^ 18 | 19 | # No value is also caught. | +error[S603]: 20:1: `subprocess` call: check for execution of untrusted input -S603.py:20:1: S603 `subprocess` call: check for execution of untrusted input + --> S603.py:19:27 | 19 | # No value is also caught. 20 | Popen("true") - | ^^^^^ S603 + | ^^^^^ | diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S604_S604.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S604_S604.py.snap index 3b05258325..b4017b2fe8 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S604_S604.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S604_S604.py.snap @@ -1,8 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs --- -S604.py:5:1: S604 Function call with `shell=True` parameter identified, security issue +error[S604]: 5:1: Function call with `shell=True` parameter identified, security issue + + --> S604.py:5:1 | 5 | foo(shell=True) - | ^^^ S604 + | ^^^ | diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S605_S605.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S605_S605.py.snap index aca51dd266..42b4ac2fbd 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S605_S605.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S605_S605.py.snap @@ -1,165 +1,183 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs --- -S605.py:8:1: S605 Starting a process with a shell: seems safe, but may be changed in the future; consider rewriting without `shell` +error[S605]: 8:1: Starting a process with a shell: seems safe, but may be changed in the future; consider rewriting without `shell` + + --> S605.py:7:29 | 7 | # Check all shell functions. 8 | os.system("true") - | ^^^^^^^^^ S605 + | ^^^^^^^^^ 9 | os.popen("true") 10 | os.popen2("true") | +error[S605]: 9:1: Starting a process with a shell: seems safe, but may be changed in the future; consider rewriting without `shell` -S605.py:9:1: S605 Starting a process with a shell: seems safe, but may be changed in the future; consider rewriting without `shell` + --> S605.py:8:18 | 7 | # Check all shell functions. 8 | os.system("true") 9 | os.popen("true") - | ^^^^^^^^ S605 + | ^^^^^^^^ 10 | os.popen2("true") 11 | os.popen3("true") | +error[S605]: 10:1: Starting a process with a shell: seems safe, but may be changed in the future; consider rewriting without `shell` -S605.py:10:1: S605 Starting a process with a shell: seems safe, but may be changed in the future; consider rewriting without `shell` + --> S605.py:9:17 | 8 | os.system("true") 9 | os.popen("true") 10 | os.popen2("true") - | ^^^^^^^^^ S605 + | ^^^^^^^^^ 11 | os.popen3("true") 12 | os.popen4("true") | +error[S605]: 11:1: Starting a process with a shell: seems safe, but may be changed in the future; consider rewriting without `shell` -S605.py:11:1: S605 Starting a process with a shell: seems safe, but may be changed in the future; consider rewriting without `shell` + --> S605.py:10:18 | 9 | os.popen("true") 10 | os.popen2("true") 11 | os.popen3("true") - | ^^^^^^^^^ S605 + | ^^^^^^^^^ 12 | os.popen4("true") 13 | popen2.popen2("true") | +error[S605]: 12:1: Starting a process with a shell: seems safe, but may be changed in the future; consider rewriting without `shell` -S605.py:12:1: S605 Starting a process with a shell: seems safe, but may be changed in the future; consider rewriting without `shell` + --> S605.py:11:18 | 10 | os.popen2("true") 11 | os.popen3("true") 12 | os.popen4("true") - | ^^^^^^^^^ S605 + | ^^^^^^^^^ 13 | popen2.popen2("true") 14 | popen2.popen3("true") | +error[S605]: 13:1: Starting a process with a shell: seems safe, but may be changed in the future; consider rewriting without `shell` -S605.py:13:1: S605 Starting a process with a shell: seems safe, but may be changed in the future; consider rewriting without `shell` + --> S605.py:12:18 | 11 | os.popen3("true") 12 | os.popen4("true") 13 | popen2.popen2("true") - | ^^^^^^^^^^^^^ S605 + | ^^^^^^^^^^^^^ 14 | popen2.popen3("true") 15 | popen2.popen4("true") | +error[S605]: 14:1: Starting a process with a shell: seems safe, but may be changed in the future; consider rewriting without `shell` -S605.py:14:1: S605 Starting a process with a shell: seems safe, but may be changed in the future; consider rewriting without `shell` + --> S605.py:13:22 | 12 | os.popen4("true") 13 | popen2.popen2("true") 14 | popen2.popen3("true") - | ^^^^^^^^^^^^^ S605 + | ^^^^^^^^^^^^^ 15 | popen2.popen4("true") 16 | popen2.Popen3("true") | +error[S605]: 15:1: Starting a process with a shell: seems safe, but may be changed in the future; consider rewriting without `shell` -S605.py:15:1: S605 Starting a process with a shell: seems safe, but may be changed in the future; consider rewriting without `shell` + --> S605.py:14:22 | 13 | popen2.popen2("true") 14 | popen2.popen3("true") 15 | popen2.popen4("true") - | ^^^^^^^^^^^^^ S605 + | ^^^^^^^^^^^^^ 16 | popen2.Popen3("true") 17 | popen2.Popen4("true") | +error[S605]: 16:1: Starting a process with a shell: seems safe, but may be changed in the future; consider rewriting without `shell` -S605.py:16:1: S605 Starting a process with a shell: seems safe, but may be changed in the future; consider rewriting without `shell` + --> S605.py:15:22 | 14 | popen2.popen3("true") 15 | popen2.popen4("true") 16 | popen2.Popen3("true") - | ^^^^^^^^^^^^^ S605 + | ^^^^^^^^^^^^^ 17 | popen2.Popen4("true") 18 | commands.getoutput("true") | +error[S605]: 17:1: Starting a process with a shell: seems safe, but may be changed in the future; consider rewriting without `shell` -S605.py:17:1: S605 Starting a process with a shell: seems safe, but may be changed in the future; consider rewriting without `shell` + --> S605.py:16:22 | 15 | popen2.popen4("true") 16 | popen2.Popen3("true") 17 | popen2.Popen4("true") - | ^^^^^^^^^^^^^ S605 + | ^^^^^^^^^^^^^ 18 | commands.getoutput("true") 19 | commands.getstatusoutput("true") | +error[S605]: 18:1: Starting a process with a shell: seems safe, but may be changed in the future; consider rewriting without `shell` -S605.py:18:1: S605 Starting a process with a shell: seems safe, but may be changed in the future; consider rewriting without `shell` + --> S605.py:17:22 | 16 | popen2.Popen3("true") 17 | popen2.Popen4("true") 18 | commands.getoutput("true") - | ^^^^^^^^^^^^^^^^^^ S605 + | ^^^^^^^^^^^^^^^^^^ 19 | commands.getstatusoutput("true") 20 | subprocess.getoutput("true") | +error[S605]: 19:1: Starting a process with a shell: seems safe, but may be changed in the future; consider rewriting without `shell` -S605.py:19:1: S605 Starting a process with a shell: seems safe, but may be changed in the future; consider rewriting without `shell` + --> S605.py:18:27 | 17 | popen2.Popen4("true") 18 | commands.getoutput("true") 19 | commands.getstatusoutput("true") - | ^^^^^^^^^^^^^^^^^^^^^^^^ S605 + | ^^^^^^^^^^^^^^^^^^^^^^^^ 20 | subprocess.getoutput("true") 21 | subprocess.getstatusoutput("true") | +error[S605]: 20:1: Starting a process with a shell: seems safe, but may be changed in the future; consider rewriting without `shell` -S605.py:20:1: S605 Starting a process with a shell: seems safe, but may be changed in the future; consider rewriting without `shell` + --> S605.py:19:33 | 18 | commands.getoutput("true") 19 | commands.getstatusoutput("true") 20 | subprocess.getoutput("true") - | ^^^^^^^^^^^^^^^^^^^^ S605 + | ^^^^^^^^^^^^^^^^^^^^ 21 | subprocess.getstatusoutput("true") | +error[S605]: 21:1: Starting a process with a shell: seems safe, but may be changed in the future; consider rewriting without `shell` -S605.py:21:1: S605 Starting a process with a shell: seems safe, but may be changed in the future; consider rewriting without `shell` + --> S605.py:20:29 | 19 | commands.getstatusoutput("true") 20 | subprocess.getoutput("true") 21 | subprocess.getstatusoutput("true") - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ S605 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | +error[S605]: 26:1: Starting a process with a shell, possible injection detected -S605.py:26:1: S605 Starting a process with a shell, possible injection detected + --> S605.py:25:20 | 24 | # Check command argument looks unsafe. 25 | var_string = "true" 26 | os.system(var_string) - | ^^^^^^^^^ S605 + | ^^^^^^^^^ 27 | os.system([var_string]) 28 | os.system([var_string, ""]) | +error[S605]: 27:1: Starting a process with a shell, possible injection detected -S605.py:27:1: S605 Starting a process with a shell, possible injection detected + --> S605.py:26:22 | 25 | var_string = "true" 26 | os.system(var_string) 27 | os.system([var_string]) - | ^^^^^^^^^ S605 + | ^^^^^^^^^ 28 | os.system([var_string, ""]) | +error[S605]: 28:1: Starting a process with a shell, possible injection detected -S605.py:28:1: S605 Starting a process with a shell, possible injection detected + --> S605.py:27:24 | 26 | os.system(var_string) 27 | os.system([var_string]) 28 | os.system([var_string, ""]) - | ^^^^^^^^^ S605 + | ^^^^^^^^^ | diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S606_S606.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S606_S606.py.snap index 3c2877d547..b2fd6ad378 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S606_S606.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S606_S606.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs --- -error[S606]: S606.py:4:1: Starting a process without a shell +error[S606]: 4:1: Starting a process without a shell + --> S606.py:3:29 | 3 | # Check all shell functions. 4 | os.execl("true") @@ -10,8 +11,9 @@ error[S606]: S606.py:4:1: Starting a process without a shell 5 | os.execle("true") 6 | os.execlp("true") | -error[S606]: S606.py:5:1: Starting a process without a shell +error[S606]: 5:1: Starting a process without a shell + --> S606.py:4:17 | 3 | # Check all shell functions. 4 | os.execl("true") @@ -20,8 +22,9 @@ error[S606]: S606.py:5:1: Starting a process without a shell 6 | os.execlp("true") 7 | os.execlpe("true") | -error[S606]: S606.py:6:1: Starting a process without a shell +error[S606]: 6:1: Starting a process without a shell + --> S606.py:5:18 | 4 | os.execl("true") 5 | os.execle("true") @@ -30,8 +33,9 @@ error[S606]: S606.py:6:1: Starting a process without a shell 7 | os.execlpe("true") 8 | os.execv("true") | -error[S606]: S606.py:7:1: Starting a process without a shell +error[S606]: 7:1: Starting a process without a shell + --> S606.py:6:18 | 5 | os.execle("true") 6 | os.execlp("true") @@ -40,8 +44,9 @@ error[S606]: S606.py:7:1: Starting a process without a shell 8 | os.execv("true") 9 | os.execve("true") | -error[S606]: S606.py:8:1: Starting a process without a shell +error[S606]: 8:1: Starting a process without a shell + --> S606.py:7:19 | 6 | os.execlp("true") 7 | os.execlpe("true") @@ -50,8 +55,9 @@ error[S606]: S606.py:8:1: Starting a process without a shell 9 | os.execve("true") 10 | os.execvp("true") | -error[S606]: S606.py:9:1: Starting a process without a shell +error[S606]: 9:1: Starting a process without a shell + --> S606.py:8:17 | 7 | os.execlpe("true") 8 | os.execv("true") @@ -60,8 +66,9 @@ error[S606]: S606.py:9:1: Starting a process without a shell 10 | os.execvp("true") 11 | os.execvpe("true") | -error[S606]: S606.py:10:1: Starting a process without a shell +error[S606]: 10:1: Starting a process without a shell + --> S606.py:9:18 | 8 | os.execv("true") 9 | os.execve("true") @@ -70,8 +77,9 @@ error[S606]: S606.py:10:1: Starting a process without a shell 11 | os.execvpe("true") 12 | os.spawnl("true") | -error[S606]: S606.py:11:1: Starting a process without a shell +error[S606]: 11:1: Starting a process without a shell + --> S606.py:10:18 | 9 | os.execve("true") 10 | os.execvp("true") @@ -80,8 +88,9 @@ error[S606]: S606.py:11:1: Starting a process without a shell 12 | os.spawnl("true") 13 | os.spawnle("true") | -error[S606]: S606.py:12:1: Starting a process without a shell +error[S606]: 12:1: Starting a process without a shell + --> S606.py:11:19 | 10 | os.execvp("true") 11 | os.execvpe("true") @@ -90,8 +99,9 @@ error[S606]: S606.py:12:1: Starting a process without a shell 13 | os.spawnle("true") 14 | os.spawnlp("true") | -error[S606]: S606.py:13:1: Starting a process without a shell +error[S606]: 13:1: Starting a process without a shell + --> S606.py:12:18 | 11 | os.execvpe("true") 12 | os.spawnl("true") @@ -100,8 +110,9 @@ error[S606]: S606.py:13:1: Starting a process without a shell 14 | os.spawnlp("true") 15 | os.spawnlpe("true") | -error[S606]: S606.py:14:1: Starting a process without a shell +error[S606]: 14:1: Starting a process without a shell + --> S606.py:13:19 | 12 | os.spawnl("true") 13 | os.spawnle("true") @@ -110,8 +121,9 @@ error[S606]: S606.py:14:1: Starting a process without a shell 15 | os.spawnlpe("true") 16 | os.spawnv("true") | -error[S606]: S606.py:15:1: Starting a process without a shell +error[S606]: 15:1: Starting a process without a shell + --> S606.py:14:19 | 13 | os.spawnle("true") 14 | os.spawnlp("true") @@ -120,8 +132,9 @@ error[S606]: S606.py:15:1: Starting a process without a shell 16 | os.spawnv("true") 17 | os.spawnve("true") | -error[S606]: S606.py:16:1: Starting a process without a shell +error[S606]: 16:1: Starting a process without a shell + --> S606.py:15:20 | 14 | os.spawnlp("true") 15 | os.spawnlpe("true") @@ -130,8 +143,9 @@ error[S606]: S606.py:16:1: Starting a process without a shell 17 | os.spawnve("true") 18 | os.spawnvp("true") | -error[S606]: S606.py:17:1: Starting a process without a shell +error[S606]: 17:1: Starting a process without a shell + --> S606.py:16:18 | 15 | os.spawnlpe("true") 16 | os.spawnv("true") @@ -140,8 +154,9 @@ error[S606]: S606.py:17:1: Starting a process without a shell 18 | os.spawnvp("true") 19 | os.spawnvpe("true") | -error[S606]: S606.py:18:1: Starting a process without a shell +error[S606]: 18:1: Starting a process without a shell + --> S606.py:17:19 | 16 | os.spawnv("true") 17 | os.spawnve("true") @@ -150,8 +165,9 @@ error[S606]: S606.py:18:1: Starting a process without a shell 19 | os.spawnvpe("true") 20 | os.startfile("true") | -error[S606]: S606.py:19:1: Starting a process without a shell +error[S606]: 19:1: Starting a process without a shell + --> S606.py:18:19 | 17 | os.spawnve("true") 18 | os.spawnvp("true") @@ -159,8 +175,9 @@ error[S606]: S606.py:19:1: Starting a process without a shell | ^^^^^^^^^^^ 20 | os.startfile("true") | -error[S606]: S606.py:20:1: Starting a process without a shell +error[S606]: 20:1: Starting a process without a shell + --> S606.py:19:20 | 18 | os.spawnvp("true") 19 | os.spawnvpe("true") diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S607_S607.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S607_S607.py.snap index c8d5d73006..3cc0ecffdf 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S607_S607.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S607_S607.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs --- -error[S607]: S607.py:9:11: Starting a process with a partial executable path +error[S607]: 9:11: Starting a process with a partial executable path + --> S607.py:9:11 | 7 | subprocess.check_output("true") 8 | subprocess.run("true") @@ -11,8 +12,9 @@ error[S607]: S607.py:9:11: Starting a process with a partial executable path 10 | os.popen("true") 11 | os.popen2("true") | -error[S607]: S607.py:10:10: Starting a process with a partial executable path +error[S607]: 10:10: Starting a process with a partial executable path + --> S607.py:10:10 | 8 | subprocess.run("true") 9 | os.system("true") @@ -21,8 +23,9 @@ error[S607]: S607.py:10:10: Starting a process with a partial executable path 11 | os.popen2("true") 12 | os.popen3("true") | -error[S607]: S607.py:11:11: Starting a process with a partial executable path +error[S607]: 11:11: Starting a process with a partial executable path + --> S607.py:11:11 | 9 | os.system("true") 10 | os.popen("true") @@ -31,8 +34,9 @@ error[S607]: S607.py:11:11: Starting a process with a partial executable path 12 | os.popen3("true") 13 | os.popen4("true") | -error[S607]: S607.py:12:11: Starting a process with a partial executable path +error[S607]: 12:11: Starting a process with a partial executable path + --> S607.py:12:11 | 10 | os.popen("true") 11 | os.popen2("true") @@ -41,8 +45,9 @@ error[S607]: S607.py:12:11: Starting a process with a partial executable path 13 | os.popen4("true") 14 | popen2.popen2("true") | -error[S607]: S607.py:13:11: Starting a process with a partial executable path +error[S607]: 13:11: Starting a process with a partial executable path + --> S607.py:13:11 | 11 | os.popen2("true") 12 | os.popen3("true") @@ -51,8 +56,9 @@ error[S607]: S607.py:13:11: Starting a process with a partial executable path 14 | popen2.popen2("true") 15 | popen2.popen3("true") | -error[S607]: S607.py:21:10: Starting a process with a partial executable path +error[S607]: 21:10: Starting a process with a partial executable path + --> S607.py:21:10 | 19 | commands.getoutput("true") 20 | commands.getstatusoutput("true") @@ -61,8 +67,9 @@ error[S607]: S607.py:21:10: Starting a process with a partial executable path 22 | os.execle("true") 23 | os.execlp("true") | -error[S607]: S607.py:22:11: Starting a process with a partial executable path +error[S607]: 22:11: Starting a process with a partial executable path + --> S607.py:22:11 | 20 | commands.getstatusoutput("true") 21 | os.execl("true") @@ -71,8 +78,9 @@ error[S607]: S607.py:22:11: Starting a process with a partial executable path 23 | os.execlp("true") 24 | os.execlpe("true") | -error[S607]: S607.py:23:11: Starting a process with a partial executable path +error[S607]: 23:11: Starting a process with a partial executable path + --> S607.py:23:11 | 21 | os.execl("true") 22 | os.execle("true") @@ -81,8 +89,9 @@ error[S607]: S607.py:23:11: Starting a process with a partial executable path 24 | os.execlpe("true") 25 | os.execv("true") | -error[S607]: S607.py:24:12: Starting a process with a partial executable path +error[S607]: 24:12: Starting a process with a partial executable path + --> S607.py:24:12 | 22 | os.execle("true") 23 | os.execlp("true") @@ -91,8 +100,9 @@ error[S607]: S607.py:24:12: Starting a process with a partial executable path 25 | os.execv("true") 26 | os.execve("true") | -error[S607]: S607.py:25:10: Starting a process with a partial executable path +error[S607]: 25:10: Starting a process with a partial executable path + --> S607.py:25:10 | 23 | os.execlp("true") 24 | os.execlpe("true") @@ -101,8 +111,9 @@ error[S607]: S607.py:25:10: Starting a process with a partial executable path 26 | os.execve("true") 27 | os.execvp("true") | -error[S607]: S607.py:26:11: Starting a process with a partial executable path +error[S607]: 26:11: Starting a process with a partial executable path + --> S607.py:26:11 | 24 | os.execlpe("true") 25 | os.execv("true") @@ -111,8 +122,9 @@ error[S607]: S607.py:26:11: Starting a process with a partial executable path 27 | os.execvp("true") 28 | os.execvpe("true") | -error[S607]: S607.py:27:11: Starting a process with a partial executable path +error[S607]: 27:11: Starting a process with a partial executable path + --> S607.py:27:11 | 25 | os.execv("true") 26 | os.execve("true") @@ -121,8 +133,9 @@ error[S607]: S607.py:27:11: Starting a process with a partial executable path 28 | os.execvpe("true") 29 | os.spawnl("true") | -error[S607]: S607.py:28:12: Starting a process with a partial executable path +error[S607]: 28:12: Starting a process with a partial executable path + --> S607.py:28:12 | 26 | os.execve("true") 27 | os.execvp("true") @@ -131,8 +144,9 @@ error[S607]: S607.py:28:12: Starting a process with a partial executable path 29 | os.spawnl("true") 30 | os.spawnle("true") | -error[S607]: S607.py:29:11: Starting a process with a partial executable path +error[S607]: 29:11: Starting a process with a partial executable path + --> S607.py:29:11 | 27 | os.execvp("true") 28 | os.execvpe("true") @@ -141,8 +155,9 @@ error[S607]: S607.py:29:11: Starting a process with a partial executable path 30 | os.spawnle("true") 31 | os.spawnlp("true") | -error[S607]: S607.py:30:12: Starting a process with a partial executable path +error[S607]: 30:12: Starting a process with a partial executable path + --> S607.py:30:12 | 28 | os.execvpe("true") 29 | os.spawnl("true") @@ -151,8 +166,9 @@ error[S607]: S607.py:30:12: Starting a process with a partial executable path 31 | os.spawnlp("true") 32 | os.spawnlpe("true") | -error[S607]: S607.py:31:12: Starting a process with a partial executable path +error[S607]: 31:12: Starting a process with a partial executable path + --> S607.py:31:12 | 29 | os.spawnl("true") 30 | os.spawnle("true") @@ -161,8 +177,9 @@ error[S607]: S607.py:31:12: Starting a process with a partial executable path 32 | os.spawnlpe("true") 33 | os.spawnv("true") | -error[S607]: S607.py:32:13: Starting a process with a partial executable path +error[S607]: 32:13: Starting a process with a partial executable path + --> S607.py:32:13 | 30 | os.spawnle("true") 31 | os.spawnlp("true") @@ -171,8 +188,9 @@ error[S607]: S607.py:32:13: Starting a process with a partial executable path 33 | os.spawnv("true") 34 | os.spawnve("true") | -error[S607]: S607.py:33:11: Starting a process with a partial executable path +error[S607]: 33:11: Starting a process with a partial executable path + --> S607.py:33:11 | 31 | os.spawnlp("true") 32 | os.spawnlpe("true") @@ -181,8 +199,9 @@ error[S607]: S607.py:33:11: Starting a process with a partial executable path 34 | os.spawnve("true") 35 | os.spawnvp("true") | -error[S607]: S607.py:34:12: Starting a process with a partial executable path +error[S607]: 34:12: Starting a process with a partial executable path + --> S607.py:34:12 | 32 | os.spawnlpe("true") 33 | os.spawnv("true") @@ -191,8 +210,9 @@ error[S607]: S607.py:34:12: Starting a process with a partial executable path 35 | os.spawnvp("true") 36 | os.spawnvpe("true") | -error[S607]: S607.py:35:12: Starting a process with a partial executable path +error[S607]: 35:12: Starting a process with a partial executable path + --> S607.py:35:12 | 33 | os.spawnv("true") 34 | os.spawnve("true") @@ -201,8 +221,9 @@ error[S607]: S607.py:35:12: Starting a process with a partial executable path 36 | os.spawnvpe("true") 37 | os.startfile("true") | -error[S607]: S607.py:36:13: Starting a process with a partial executable path +error[S607]: 36:13: Starting a process with a partial executable path + --> S607.py:36:13 | 34 | os.spawnve("true") 35 | os.spawnvp("true") @@ -210,8 +231,9 @@ error[S607]: S607.py:36:13: Starting a process with a partial executable path | ^^^^^^ 37 | os.startfile("true") | -error[S607]: S607.py:37:14: Starting a process with a partial executable path +error[S607]: 37:14: Starting a process with a partial executable path + --> S607.py:37:14 | 35 | os.spawnvp("true") 36 | os.spawnvpe("true") diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S608_S608.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S608_S608.py.snap index 3228178f1d..ff047ecdca 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S608_S608.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S608_S608.py.snap @@ -1,351 +1,389 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs --- -S608.py:2:10: S608 Possible SQL injection vector through string-based query construction +error[S608]: 2:10: Possible SQL injection vector through string-based query construction + + --> S608.py:2:10 | 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 | +error[S608]: 3:10: Possible SQL injection vector through string-based query construction -S608.py:3:10: S608 Possible SQL injection vector through string-based query construction + --> S608.py:3:10 | 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) | +error[S608]: 4:10: Possible SQL injection vector through string-based query construction -S608.py:4:10: S608 Possible SQL injection vector through string-based query construction + --> S608.py:4:10 | 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}" | +error[S608]: 5:10: Possible SQL injection vector through string-based query construction -S608.py:5:10: S608 Possible SQL injection vector through string-based query construction + --> S608.py:5:10 | 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}" | +error[S608]: 6:10: Possible SQL injection vector through string-based query construction -S608.py:6:10: S608 Possible SQL injection vector through string-based query construction + --> S608.py:6:10 | 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,) | +error[S608]: 8:10: Possible SQL injection vector through string-based query construction -S608.py:8:10: S608 Possible SQL injection vector through string-based query construction + --> S608.py:8:10 | 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 | +error[S608]: 9:10: Possible SQL injection vector through string-based query construction -S608.py:9:10: S608 Possible SQL injection vector through string-based query construction + --> S608.py:9:10 | 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) | +error[S608]: 10:10: Possible SQL injection vector through string-based query construction -S608.py:10:10: S608 Possible SQL injection vector through string-based query construction + --> S608.py:10:10 | 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}" | +error[S608]: 11:10: Possible SQL injection vector through string-based query construction -S608.py:11:10: S608 Possible SQL injection vector through string-based query construction + --> S608.py:11:10 | 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}" | +error[S608]: 12:11: Possible SQL injection vector through string-based query construction -S608.py:12:11: S608 Possible SQL injection vector through string-based query construction + --> S608.py:12:11 | 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,) | +error[S608]: 14:11: Possible SQL injection vector through string-based query construction -S608.py:14:11: S608 Possible SQL injection vector through string-based query construction + --> S608.py:14:11 | 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) | +error[S608]: 15:11: Possible SQL injection vector through string-based query construction -S608.py:15:11: S608 Possible SQL injection vector through string-based query construction + --> S608.py:15:11 | 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}" | +error[S608]: 16:11: Possible SQL injection vector through string-based query construction -S608.py:16:11: S608 Possible SQL injection vector through string-based query construction + --> S608.py:16:11 | 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}" | +error[S608]: 17:11: Possible SQL injection vector through string-based query construction -S608.py:17:11: S608 Possible SQL injection vector through string-based query construction + --> S608.py:17:11 | 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) | +error[S608]: 19:11: Possible SQL injection vector through string-based query construction -S608.py:19:11: S608 Possible SQL injection vector through string-based query construction + --> S608.py:19:11 | 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) | +error[S608]: 20:11: Possible SQL injection vector through string-based query construction -S608.py:20:11: S608 Possible SQL injection vector through string-based query construction + --> S608.py:20:11 | 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}" | +error[S608]: 21:11: Possible SQL injection vector through string-based query construction -S608.py:21:11: S608 Possible SQL injection vector through string-based query construction + --> S608.py:21:11 | 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}" | +error[S608]: 22:11: Possible SQL injection vector through string-based query construction -S608.py:22:11: S608 Possible SQL injection vector through string-based query construction + --> S608.py:22:11 | 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,) | +error[S608]: 24:11: Possible SQL injection vector through string-based query construction -S608.py:24:11: S608 Possible SQL injection vector through string-based query construction + --> S608.py:24:11 | 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 | +error[S608]: 25:11: Possible SQL injection vector through string-based query construction -S608.py:25:11: S608 Possible SQL injection vector through string-based query construction + --> S608.py:25:11 | 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) | +error[S608]: 26:11: Possible SQL injection vector through string-based query construction -S608.py:26:11: S608 Possible SQL injection vector through string-based query construction + --> S608.py:26:11 | 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}" | +error[S608]: 27:11: Possible SQL injection vector through string-based query construction -S608.py:27:11: S608 Possible SQL injection vector through string-based query construction + --> S608.py:27:11 | 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}" | +error[S608]: 28:11: Possible SQL injection vector through string-based query construction -S608.py:28:11: S608 Possible SQL injection vector through string-based query construction + --> S608.py:28:11 | 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,) | +error[S608]: 30:11: Possible SQL injection vector through string-based query construction -S608.py:30:11: S608 Possible SQL injection vector through string-based query construction + --> S608.py:30:11 | 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 | +error[S608]: 31:11: Possible SQL injection vector through string-based query construction -S608.py:31:11: S608 Possible SQL injection vector through string-based query construction + --> S608.py:31:11 | 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) | +error[S608]: 32:11: Possible SQL injection vector through string-based query construction -S608.py:32:11: S608 Possible SQL injection vector through string-based query construction + --> S608.py:32:11 | 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}" | +error[S608]: 33:11: Possible SQL injection vector through string-based query construction -S608.py:33:11: S608 Possible SQL injection vector through string-based query construction + --> S608.py:33:11 | 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}" | +error[S608]: 34:11: Possible SQL injection vector through string-based query construction -S608.py:34:11: S608 Possible SQL injection vector through string-based query construction + --> S608.py:34:11 | 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,) | +error[S608]: 36:11: Possible SQL injection vector through string-based query construction -S608.py:36:11: S608 Possible SQL injection vector through string-based query construction + --> S608.py:36:11 | 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) | +error[S608]: 37:11: Possible SQL injection vector through string-based query construction -S608.py:37:11: S608 Possible SQL injection vector through string-based query construction + --> S608.py:37:11 | 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}" | +error[S608]: 38:11: Possible SQL injection vector through string-based query construction -S608.py:38:11: S608 Possible SQL injection vector through string-based query construction + --> S608.py:38:11 | 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}" | +error[S608]: 39:11: Possible SQL injection vector through string-based query construction -S608.py:39:11: S608 Possible SQL injection vector through string-based query construction + --> S608.py:39:11 | 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) | +error[S608]: 41:11: Possible SQL injection vector through string-based query construction -S608.py:41:11: S608 Possible SQL injection vector through string-based query construction + --> S608.py:41:11 | 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) | +error[S608]: 42:11: Possible SQL injection vector through string-based query construction -S608.py:42:11: S608 Possible SQL injection vector through string-based query construction + --> S608.py:42:11 | 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}" | +error[S608]: 43:11: Possible SQL injection vector through string-based query construction -S608.py:43:11: S608 Possible SQL injection vector through string-based query construction + --> S608.py:43:11 | 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}" | +error[S608]: 44:11: Possible SQL injection vector through string-based query construction -S608.py:44:11: S608 Possible SQL injection vector through string-based query construction + --> S608.py:44:11 | 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 | +error[S608]: 48:12: Possible SQL injection vector through string-based query construction -S608.py:48:12: S608 Possible SQL injection vector through string-based query construction + --> S608.py:48:12 | 46 | # multi-line failures 47 | def query37(): @@ -355,12 +393,13 @@ S608.py:48:12: S608 Possible SQL injection vector through string-based query con 50 | | FROM table 51 | | WHERE var = %s 52 | | """ % var - | |_____________^ S608 + | |_____________^ 53 | 54 | def query38(): | +error[S608]: 55:12: Possible SQL injection vector through string-based query construction -S608.py:55:12: S608 Possible SQL injection vector through string-based query construction + --> S608.py:55:12 | 54 | def query38(): 55 | return """ @@ -369,12 +408,13 @@ S608.py:55:12: S608 Possible SQL injection vector through string-based query con 57 | | FROM TABLE 58 | | WHERE var = 59 | | """ + var - | |_____________^ S608 + | |_____________^ 60 | 61 | def query39(): | +error[S608]: 62:12: Possible SQL injection vector through string-based query construction -S608.py:62:12: S608 Possible SQL injection vector through string-based query construction + --> S608.py:62:12 | 61 | def query39(): 62 | return """ @@ -383,12 +423,13 @@ S608.py:62:12: S608 Possible SQL injection vector through string-based query con 64 | | FROM table 65 | | WHERE var = {} 66 | | """.format(var) - | |___________________^ S608 + | |___________________^ 67 | 68 | def query40(): | +error[S608]: 69:12: Possible SQL injection vector through string-based query construction -S608.py:69:12: S608 Possible SQL injection vector through string-based query construction + --> S608.py:69:12 | 68 | def query40(): 69 | return f""" @@ -397,12 +438,13 @@ S608.py:69:12: S608 Possible SQL injection vector through string-based query con 71 | | FROM table 72 | | WHERE var = {var} 73 | | """ - | |_______^ S608 + | |_______^ 74 | 75 | def query41(): | +error[S608]: 77:9: Possible SQL injection vector through string-based query construction -S608.py:77:9: S608 Possible SQL injection vector through string-based query construction + --> S608.py:77:9 | 75 | def query41(): 76 | return ( @@ -410,87 +452,96 @@ S608.py:77:9: S608 Possible SQL injection vector through string-based query cons | _________^ 78 | | "FROM table " 79 | | f"WHERE var = {var}" - | |____________________________^ S608 + | |____________________________^ 80 | ) | +error[S608]: 83:26: Possible SQL injection vector through string-based query construction -S608.py:83:26: S608 Possible SQL injection vector through string-based query construction + --> S608.py:83:26 | 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)) | +error[S608]: 84:26: Possible SQL injection vector through string-based query construction -S608.py:84:26: S608 Possible SQL injection vector through string-based query construction + --> S608.py:84:26 | 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, []) | +error[S608]: 85:26: Possible SQL injection vector through string-based query construction -S608.py:85:26: S608 Possible SQL injection vector through string-based query construction + --> S608.py:85:26 | 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, []) | +error[S608]: 86:30: Possible SQL injection vector through string-based query construction -S608.py:86:30: S608 Possible SQL injection vector through string-based query construction + --> S608.py:86:30 | 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 | +error[S608]: 98:9: Possible SQL injection vector through string-based query construction -S608.py:98:9: S608 Possible SQL injection vector through string-based query construction + --> S608.py:98:9 | 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) | +error[S608]: 101:9: Possible SQL injection vector through string-based query construction -S608.py:101:9: S608 Possible SQL injection vector through string-based query construction + --> S608.py:101:9 | 100 | # # REPLACE (e.g. MySQL and derivatives, SQLite) 101 | query = "REPLACE INTO table VALUES (%s)" % (var,) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 102 | query = "REPLACE table VALUES (%s)" % (var,) | +error[S608]: 102:9: Possible SQL injection vector through string-based query construction -S608.py:102:9: S608 Possible SQL injection vector through string-based query construction + --> S608.py:102:9 | 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" | +error[S608]: 111:1: Possible SQL injection vector through string-based query construction -S608.py:111:1: S608 Possible SQL injection vector through string-based query construction + --> S608.py:110:11 | 110 | # # errors 111 | "SELECT * FROM " + ("table1" if x > 0 else "table2") - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 112 | "SELECT * FROM " + ("table1" if x > 0 else ["table2"]) | +error[S608]: 112:1: Possible SQL injection vector through string-based query construction -S608.py:112:1: S608 Possible SQL injection vector through string-based query construction + --> S608.py:111:53 | 110 | # # errors 111 | "SELECT * FROM " + ("table1" if x > 0 else "table2") 112 | "SELECT * FROM " + ("table1" if x > 0 else ["table2"]) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S609_S609.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S609_S609.py.snap index 0b98e44ce4..a495cc71c7 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S609_S609.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S609_S609.py.snap @@ -1,39 +1,44 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs --- -S609.py:4:10: S609 Possible wildcard injection in call due to `*` usage +error[S609]: 4:10: Possible wildcard injection in call due to `*` usage + + --> S609.py:4:10 | 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) | +error[S609]: 5:18: Possible wildcard injection in call due to `*` usage -S609.py:5:18: S609 Possible wildcard injection in call due to `*` usage + --> S609.py:5:18 | 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:") | +error[S609]: 6:18: Possible wildcard injection in call due to `*` usage -S609.py:6:18: S609 Possible wildcard injection in call due to `*` usage + --> S609.py:6:18 | 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/*") | +error[S609]: 8:11: Possible wildcard injection in call due to `*` usage -S609.py:8:11: S609 Possible wildcard injection in call due to `*` usage + --> S609.py:8:11 | 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 + | ^^^^^^^^^^^^^^^^^^^^^^ | diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S610_S610.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S610_S610.py.snap index 65e9f891a4..2651d60e32 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S610_S610.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S610_S610.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs --- -error[S610]: S610.py:4:44: Use of Django `extra` can lead to SQL injection vulnerabilities +error[S610]: 4:44: Use of Django `extra` can lead to SQL injection vulnerabilities + --> S610.py:4:44 | 3 | # Errors 4 | User.objects.filter(username='admin').extra(dict(could_be='insecure')) @@ -10,8 +11,9 @@ error[S610]: S610.py:4:44: Use of Django `extra` can lead to SQL injection vulne 5 | User.objects.filter(username='admin').extra(select=dict(could_be='insecure')) 6 | User.objects.filter(username='admin').extra(select={'test': '%secure' % 'nos'}) | -error[S610]: S610.py:5:44: Use of Django `extra` can lead to SQL injection vulnerabilities +error[S610]: 5:44: Use of Django `extra` can lead to SQL injection vulnerabilities + --> S610.py:5:44 | 3 | # Errors 4 | User.objects.filter(username='admin').extra(dict(could_be='insecure')) @@ -20,8 +22,9 @@ error[S610]: S610.py:5:44: Use of Django `extra` can lead to SQL injection vulne 6 | User.objects.filter(username='admin').extra(select={'test': '%secure' % 'nos'}) 7 | User.objects.filter(username='admin').extra(select={'test': '{}secure'.format('nos')}) | -error[S610]: S610.py:6:44: Use of Django `extra` can lead to SQL injection vulnerabilities +error[S610]: 6:44: Use of Django `extra` can lead to SQL injection vulnerabilities + --> S610.py:6:44 | 4 | User.objects.filter(username='admin').extra(dict(could_be='insecure')) 5 | User.objects.filter(username='admin').extra(select=dict(could_be='insecure')) @@ -30,8 +33,9 @@ error[S610]: S610.py:6:44: Use of Django `extra` can lead to SQL injection vulne 7 | User.objects.filter(username='admin').extra(select={'test': '{}secure'.format('nos')}) 8 | User.objects.filter(username='admin').extra(where=['%secure' % 'nos']) | -error[S610]: S610.py:7:44: Use of Django `extra` can lead to SQL injection vulnerabilities +error[S610]: 7:44: Use of Django `extra` can lead to SQL injection vulnerabilities + --> S610.py:7:44 | 5 | User.objects.filter(username='admin').extra(select=dict(could_be='insecure')) 6 | User.objects.filter(username='admin').extra(select={'test': '%secure' % 'nos'}) @@ -40,8 +44,9 @@ error[S610]: S610.py:7:44: Use of Django `extra` can lead to SQL injection vulne 8 | User.objects.filter(username='admin').extra(where=['%secure' % 'nos']) 9 | User.objects.filter(username='admin').extra(where=['{}secure'.format('no')]) | -error[S610]: S610.py:8:44: Use of Django `extra` can lead to SQL injection vulnerabilities +error[S610]: 8:44: Use of Django `extra` can lead to SQL injection vulnerabilities + --> S610.py:8:44 | 6 | User.objects.filter(username='admin').extra(select={'test': '%secure' % 'nos'}) 7 | User.objects.filter(username='admin').extra(select={'test': '{}secure'.format('nos')}) @@ -49,8 +54,9 @@ error[S610]: S610.py:8:44: Use of Django `extra` can lead to SQL injection vulne | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ 9 | User.objects.filter(username='admin').extra(where=['{}secure'.format('no')]) | -error[S610]: S610.py:9:44: Use of Django `extra` can lead to SQL injection vulnerabilities +error[S610]: 9:44: Use of Django `extra` can lead to SQL injection vulnerabilities + --> S610.py:9:44 | 7 | User.objects.filter(username='admin').extra(select={'test': '{}secure'.format('nos')}) 8 | User.objects.filter(username='admin').extra(where=['%secure' % 'nos']) @@ -59,8 +65,9 @@ error[S610]: S610.py:9:44: Use of Django `extra` can lead to SQL injection vulne 10 | 11 | query = '"username") AS "username", * FROM "auth_user" WHERE 1=1 OR "username"=? --' | -error[S610]: S610.py:12:44: Use of Django `extra` can lead to SQL injection vulnerabilities +error[S610]: 12:44: Use of Django `extra` can lead to SQL injection vulnerabilities + --> S610.py:12:44 | 11 | query = '"username") AS "username", * FROM "auth_user" WHERE 1=1 OR "username"=? --' 12 | User.objects.filter(username='admin').extra(select={'test': query}) @@ -68,8 +75,9 @@ error[S610]: S610.py:12:44: Use of Django `extra` can lead to SQL injection vuln 13 | 14 | where_var = ['1=1) OR 1=1 AND (1=1'] | -error[S610]: S610.py:15:44: Use of Django `extra` can lead to SQL injection vulnerabilities +error[S610]: 15:44: Use of Django `extra` can lead to SQL injection vulnerabilities + --> S610.py:15:44 | 14 | where_var = ['1=1) OR 1=1 AND (1=1'] 15 | User.objects.filter(username='admin').extra(where=where_var) @@ -77,8 +85,9 @@ error[S610]: S610.py:15:44: Use of Django `extra` can lead to SQL injection vuln 16 | 17 | where_str = '1=1) OR 1=1 AND (1=1' | -error[S610]: S610.py:18:44: Use of Django `extra` can lead to SQL injection vulnerabilities +error[S610]: 18:44: Use of Django `extra` can lead to SQL injection vulnerabilities + --> S610.py:18:44 | 17 | where_str = '1=1) OR 1=1 AND (1=1' 18 | User.objects.filter(username='admin').extra(where=[where_str]) @@ -86,8 +95,9 @@ error[S610]: S610.py:18:44: Use of Django `extra` can lead to SQL injection vuln 19 | 20 | tables_var = ['django_content_type" WHERE "auth_user"."username"="admin'] | -error[S610]: S610.py:21:25: Use of Django `extra` can lead to SQL injection vulnerabilities +error[S610]: 21:25: Use of Django `extra` can lead to SQL injection vulnerabilities + --> S610.py:21:25 | 20 | tables_var = ['django_content_type" WHERE "auth_user"."username"="admin'] 21 | User.objects.all().extra(tables=tables_var).distinct() @@ -95,8 +105,9 @@ error[S610]: S610.py:21:25: Use of Django `extra` can lead to SQL injection vuln 22 | 23 | tables_str = 'django_content_type" WHERE "auth_user"."username"="admin' | -error[S610]: S610.py:24:25: Use of Django `extra` can lead to SQL injection vulnerabilities +error[S610]: 24:25: Use of Django `extra` can lead to SQL injection vulnerabilities + --> S610.py:24:25 | 23 | tables_str = 'django_content_type" WHERE "auth_user"."username"="admin' 24 | User.objects.all().extra(tables=[tables_str]).distinct() diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S611_S611.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S611_S611.py.snap index 8b56467209..b7aaf140ab 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S611_S611.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S611_S611.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs --- -error[S611]: S611.py:5:27: Use of `RawSQL` can lead to SQL injection vulnerabilities +error[S611]: 5:27: Use of `RawSQL` can lead to SQL injection vulnerabilities + --> S611.py:5:27 | 4 | User.objects.annotate(val=RawSQL('secure', [])) 5 | User.objects.annotate(val=RawSQL('%secure' % 'nos', [])) @@ -10,8 +11,9 @@ error[S611]: S611.py:5:27: Use of `RawSQL` can lead to SQL injection vulnerabili 6 | User.objects.annotate(val=RawSQL('{}secure'.format('no'), [])) 7 | raw = '"username") AS "val" FROM "auth_user" WHERE "username"="admin" --' | -error[S611]: S611.py:6:27: Use of `RawSQL` can lead to SQL injection vulnerabilities +error[S611]: 6:27: Use of `RawSQL` can lead to SQL injection vulnerabilities + --> S611.py:6:27 | 4 | User.objects.annotate(val=RawSQL('secure', [])) 5 | User.objects.annotate(val=RawSQL('%secure' % 'nos', [])) @@ -20,8 +22,9 @@ error[S611]: S611.py:6:27: Use of `RawSQL` can lead to SQL injection vulnerabili 7 | raw = '"username") AS "val" FROM "auth_user" WHERE "username"="admin" --' 8 | User.objects.annotate(val=RawSQL(raw, [])) | -error[S611]: S611.py:8:27: Use of `RawSQL` can lead to SQL injection vulnerabilities +error[S611]: 8:27: Use of `RawSQL` can lead to SQL injection vulnerabilities + --> S611.py:8:27 | 6 | User.objects.annotate(val=RawSQL('{}secure'.format('no'), [])) 7 | raw = '"username") AS "val" FROM "auth_user" WHERE "username"="admin" --' @@ -30,8 +33,9 @@ error[S611]: S611.py:8:27: Use of `RawSQL` can lead to SQL injection vulnerabili 9 | raw = '"username") AS "val" FROM "auth_user"' \ 10 | ' WHERE "username"="admin" OR 1=%s --' | -error[S611]: S611.py:11:27: Use of `RawSQL` can lead to SQL injection vulnerabilities +error[S611]: 11:27: Use of `RawSQL` can lead to SQL injection vulnerabilities + --> S611.py:11:27 | 9 | raw = '"username") AS "val" FROM "auth_user"' \ 10 | ' WHERE "username"="admin" OR 1=%s --' @@ -40,8 +44,9 @@ error[S611]: S611.py:11:27: Use of `RawSQL` can lead to SQL injection vulnerabil 12 | User.objects.annotate(val=RawSQL(sql='{}secure'.format('no'), params=[])) 13 | User.objects.annotate(val=RawSQL(params=[], sql='{}secure'.format('no'))) | -error[S611]: S611.py:12:27: Use of `RawSQL` can lead to SQL injection vulnerabilities +error[S611]: 12:27: Use of `RawSQL` can lead to SQL injection vulnerabilities + --> S611.py:12:27 | 10 | ' WHERE "username"="admin" OR 1=%s --' 11 | User.objects.annotate(val=RawSQL(raw, [0])) @@ -49,8 +54,9 @@ error[S611]: S611.py:12:27: Use of `RawSQL` can lead to SQL injection vulnerabil | ^^^^^^ 13 | User.objects.annotate(val=RawSQL(params=[], sql='{}secure'.format('no'))) | -error[S611]: S611.py:13:27: Use of `RawSQL` can lead to SQL injection vulnerabilities +error[S611]: 13:27: Use of `RawSQL` can lead to SQL injection vulnerabilities + --> S611.py:13:27 | 11 | User.objects.annotate(val=RawSQL(raw, [0])) 12 | User.objects.annotate(val=RawSQL(sql='{}secure'.format('no'), params=[])) diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S612_S612.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S612_S612.py.snap index 94bde14b92..17dc373065 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S612_S612.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S612_S612.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs --- -error[S612]: S612.py:3:5: Use of insecure `logging.config.listen` detected +error[S612]: 3:5: Use of insecure `logging.config.listen` detected + --> S612.py:3:5 | 1 | import logging.config 2 | diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S701_S701.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S701_S701.py.snap index bf654c291c..7763fb336a 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S701_S701.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S701_S701.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs --- -error[S701]: S701.py:9:57: Using jinja2 templates with `autoescape=False` is dangerous and can lead to XSS. Ensure `autoescape=True` or use the `select_autoescape` function. +error[S701]: 9:57: Using jinja2 templates with `autoescape=False` is dangerous and can lead to XSS. Ensure `autoescape=True` or use the `select_autoescape` function. + --> S701.py:9:57 | 7 | templateEnv = jinja2.Environment(autoescape=True, 8 | loader=templateLoader ) @@ -11,8 +12,9 @@ error[S701]: S701.py:9:57: Using jinja2 templates with `autoescape=False` is dan 10 | templateEnv = jinja2.Environment(autoescape=False, loader=templateLoader ) # S701 11 | Environment(loader=templateLoader, | -error[S701]: S701.py:10:34: Using jinja2 templates with `autoescape=False` is dangerous and can lead to XSS. Ensure `autoescape=True` or use the `select_autoescape` function. +error[S701]: 10:34: Using jinja2 templates with `autoescape=False` is dangerous and can lead to XSS. Ensure `autoescape=True` or use the `select_autoescape` function. + --> S701.py:10:34 | 8 | loader=templateLoader ) 9 | Environment(loader=templateLoader, load=templateLoader, autoescape=something) # S701 @@ -21,8 +23,9 @@ error[S701]: S701.py:10:34: Using jinja2 templates with `autoescape=False` is da 11 | Environment(loader=templateLoader, 12 | load=templateLoader, | -error[S701]: S701.py:13:13: Using jinja2 templates with `autoescape=False` is dangerous and can lead to XSS. Ensure `autoescape=True` or use the `select_autoescape` function. +error[S701]: 13:13: Using jinja2 templates with `autoescape=False` is dangerous and can lead to XSS. Ensure `autoescape=True` or use the `select_autoescape` function. + --> S701.py:13:13 | 11 | Environment(loader=templateLoader, 12 | load=templateLoader, @@ -31,8 +34,9 @@ error[S701]: S701.py:13:13: Using jinja2 templates with `autoescape=False` is da 14 | 15 | Environment(loader=templateLoader, # S701 | -error[S701]: S701.py:15:1: By default, jinja2 sets `autoescape` to `False`. Consider using `autoescape=True` or the `select_autoescape` function to mitigate XSS vulnerabilities. +error[S701]: 15:1: By default, jinja2 sets `autoescape` to `False`. Consider using `autoescape=True` or the `select_autoescape` function to mitigate XSS vulnerabilities. + --> S701.py:14:1 | 13 | autoescape=False) # S701 14 | @@ -40,8 +44,9 @@ error[S701]: S701.py:15:1: By default, jinja2 sets `autoescape` to `False`. Cons | ^^^^^^^^^^^ 16 | load=templateLoader) | -error[S701]: S701.py:29:36: Using jinja2 templates with `autoescape=False` is dangerous and can lead to XSS. Ensure `autoescape=True` or use the `select_autoescape` function. +error[S701]: 29:36: Using jinja2 templates with `autoescape=False` is dangerous and can lead to XSS. Ensure `autoescape=True` or use the `select_autoescape` function. + --> S701.py:29:36 | 27 | def fake_func(): 28 | return 'foobar' diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S702_S702.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S702_S702.py.snap index 865ead8e79..f8d942a97f 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S702_S702.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S702_S702.py.snap @@ -1,16 +1,18 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs --- -error[S702]: S702.py:6:1: Mako templates allow HTML and JavaScript rendering by default and are inherently open to XSS attacks +error[S702]: 6:1: Mako templates allow HTML and JavaScript rendering by default and are inherently open to XSS attacks + --> S702.py:6:1 | 6 | Template("hello") | ^^^^^^^^ 7 | 8 | mako.template.Template("hern") | -error[S702]: S702.py:8:1: Mako templates allow HTML and JavaScript rendering by default and are inherently open to XSS attacks +error[S702]: 8:1: Mako templates allow HTML and JavaScript rendering by default and are inherently open to XSS attacks + --> S702.py:7:1 | 6 | Template("hello") 7 | @@ -18,8 +20,9 @@ error[S702]: S702.py:8:1: Mako templates allow HTML and JavaScript rendering by | ^^^^^^^^^^^^^^^^^^^^^^ 9 | template.Template("hern") | -error[S702]: S702.py:9:1: Mako templates allow HTML and JavaScript rendering by default and are inherently open to XSS attacks +error[S702]: 9:1: Mako templates allow HTML and JavaScript rendering by default and are inherently open to XSS attacks + --> S702.py:8:31 | 8 | mako.template.Template("hern") 9 | template.Template("hern") diff --git a/crates/ruff_linter/src/rules/flake8_blind_except/snapshots/ruff_linter__rules__flake8_blind_except__tests__BLE001_BLE.py.snap b/crates/ruff_linter/src/rules/flake8_blind_except/snapshots/ruff_linter__rules__flake8_blind_except__tests__BLE001_BLE.py.snap index ca1c85c3fd..529140b4f6 100644 --- a/crates/ruff_linter/src/rules/flake8_blind_except/snapshots/ruff_linter__rules__flake8_blind_except__tests__BLE001_BLE.py.snap +++ b/crates/ruff_linter/src/rules/flake8_blind_except/snapshots/ruff_linter__rules__flake8_blind_except__tests__BLE001_BLE.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_blind_except/mod.rs --- -error[BLE001]: BLE.py:25:8: Do not catch blind exception: `BaseException` +error[BLE001]: 25:8: Do not catch blind exception: `BaseException` + --> BLE.py:25:8 | 23 | except Exception as e: 24 | raise e @@ -10,8 +11,9 @@ error[BLE001]: BLE.py:25:8: Do not catch blind exception: `BaseException` | ^^^^^^^^^^^^^ 26 | pass | -error[BLE001]: BLE.py:31:8: Do not catch blind exception: `Exception` +error[BLE001]: 31:8: Do not catch blind exception: `Exception` + --> BLE.py:31:8 | 29 | try: 30 | pass @@ -20,8 +22,9 @@ error[BLE001]: BLE.py:31:8: Do not catch blind exception: `Exception` 32 | pass 33 | finally: | -error[BLE001]: BLE.py:42:8: Do not catch blind exception: `Exception` +error[BLE001]: 42:8: Do not catch blind exception: `Exception` + --> BLE.py:42:8 | 40 | try: 41 | pass @@ -30,8 +33,9 @@ error[BLE001]: BLE.py:42:8: Do not catch blind exception: `Exception` 43 | try: 44 | raise e | -error[BLE001]: BLE.py:45:12: Do not catch blind exception: `BaseException` +error[BLE001]: 45:12: Do not catch blind exception: `BaseException` + --> BLE.py:45:12 | 43 | try: 44 | raise e @@ -39,8 +43,9 @@ error[BLE001]: BLE.py:45:12: Do not catch blind exception: `BaseException` | ^^^^^^^^^^^^^ 46 | pass | -error[BLE001]: BLE.py:54:8: Do not catch blind exception: `Exception` +error[BLE001]: 54:8: Do not catch blind exception: `Exception` + --> BLE.py:54:8 | 52 | except BaseException as e: 53 | raise e @@ -48,8 +53,9 @@ error[BLE001]: BLE.py:54:8: Do not catch blind exception: `Exception` | ^^^^^^^^^ 55 | pass | -error[BLE001]: BLE.py:60:8: Do not catch blind exception: `Exception` +error[BLE001]: 60:8: Do not catch blind exception: `Exception` + --> BLE.py:60:8 | 58 | try: 59 | pass @@ -58,8 +64,9 @@ error[BLE001]: BLE.py:60:8: Do not catch blind exception: `Exception` 61 | raise bad 62 | except BaseException: | -error[BLE001]: BLE.py:62:8: Do not catch blind exception: `BaseException` +error[BLE001]: 62:8: Do not catch blind exception: `BaseException` + --> BLE.py:62:8 | 60 | except Exception as e: 61 | raise bad @@ -67,8 +74,9 @@ error[BLE001]: BLE.py:62:8: Do not catch blind exception: `BaseException` | ^^^^^^^^^^^^^ 63 | pass | -error[BLE001]: BLE.py:69:8: Do not catch blind exception: `Exception` +error[BLE001]: 69:8: Do not catch blind exception: `Exception` + --> BLE.py:69:8 | 67 | try: 68 | pass @@ -76,8 +84,9 @@ error[BLE001]: BLE.py:69:8: Do not catch blind exception: `Exception` | ^^^^^^^^^ 70 | logging.error("...") | -error[BLE001]: BLE.py:75:8: Do not catch blind exception: `Exception` +error[BLE001]: 75:8: Do not catch blind exception: `Exception` + --> BLE.py:75:8 | 73 | try: 74 | pass @@ -85,8 +94,9 @@ error[BLE001]: BLE.py:75:8: Do not catch blind exception: `Exception` | ^^^^^^^^^ 76 | logging.error("...", exc_info=False) | -error[BLE001]: BLE.py:81:8: Do not catch blind exception: `Exception` +error[BLE001]: 81:8: Do not catch blind exception: `Exception` + --> BLE.py:81:8 | 79 | try: 80 | pass @@ -94,8 +104,9 @@ error[BLE001]: BLE.py:81:8: Do not catch blind exception: `Exception` | ^^^^^^^^^ 82 | logging.error("...", exc_info=None) | -error[BLE001]: BLE.py:101:8: Do not catch blind exception: `Exception` +error[BLE001]: 101:8: Do not catch blind exception: `Exception` + --> BLE.py:101:8 | 99 | try: 100 | pass @@ -103,8 +114,9 @@ error[BLE001]: BLE.py:101:8: Do not catch blind exception: `Exception` | ^^^^^^^^^ 102 | error("...") | -error[BLE001]: BLE.py:107:8: Do not catch blind exception: `Exception` +error[BLE001]: 107:8: Do not catch blind exception: `Exception` + --> BLE.py:107:8 | 105 | try: 106 | pass @@ -112,8 +124,9 @@ error[BLE001]: BLE.py:107:8: Do not catch blind exception: `Exception` | ^^^^^^^^^ 108 | error("...", exc_info=False) | -error[BLE001]: BLE.py:113:8: Do not catch blind exception: `Exception` +error[BLE001]: 113:8: Do not catch blind exception: `Exception` + --> BLE.py:113:8 | 111 | try: 112 | pass diff --git a/crates/ruff_linter/src/rules/flake8_boolean_trap/snapshots/ruff_linter__rules__flake8_boolean_trap__tests__FBT001_FBT.py.snap b/crates/ruff_linter/src/rules/flake8_boolean_trap/snapshots/ruff_linter__rules__flake8_boolean_trap__tests__FBT001_FBT.py.snap index 88eb3904e2..9947887b46 100644 --- a/crates/ruff_linter/src/rules/flake8_boolean_trap/snapshots/ruff_linter__rules__flake8_boolean_trap__tests__FBT001_FBT.py.snap +++ b/crates/ruff_linter/src/rules/flake8_boolean_trap/snapshots/ruff_linter__rules__flake8_boolean_trap__tests__FBT001_FBT.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_boolean_trap/mod.rs --- -error[FBT001]: FBT.py:4:5: Boolean-typed positional argument in function definition +error[FBT001]: 4:5: Boolean-typed positional argument in function definition + --> FBT.py:4:5 | 2 | posonly_nohint, 3 | posonly_nonboolhint: int, @@ -11,8 +12,9 @@ error[FBT001]: FBT.py:4:5: Boolean-typed positional argument in function definit 5 | posonly_boolstrhint: "bool", 6 | /, | -error[FBT001]: FBT.py:5:5: Boolean-typed positional argument in function definition +error[FBT001]: 5:5: Boolean-typed positional argument in function definition + --> FBT.py:5:5 | 3 | posonly_nonboolhint: int, 4 | posonly_boolhint: bool, @@ -21,8 +23,9 @@ error[FBT001]: FBT.py:5:5: Boolean-typed positional argument in function definit 6 | /, 7 | offset, | -error[FBT001]: FBT.py:10:5: Boolean-typed positional argument in function definition +error[FBT001]: 10:5: Boolean-typed positional argument in function definition + --> FBT.py:10:5 | 8 | posorkw_nonvalued_nohint, 9 | posorkw_nonvalued_nonboolhint: int, @@ -31,8 +34,9 @@ error[FBT001]: FBT.py:10:5: Boolean-typed positional argument in function defini 11 | posorkw_nonvalued_boolstrhint: "bool", 12 | posorkw_boolvalued_nohint=True, | -error[FBT001]: FBT.py:11:5: Boolean-typed positional argument in function definition +error[FBT001]: 11:5: Boolean-typed positional argument in function definition + --> FBT.py:11:5 | 9 | posorkw_nonvalued_nonboolhint: int, 10 | posorkw_nonvalued_boolhint: bool, @@ -41,8 +45,9 @@ error[FBT001]: FBT.py:11:5: Boolean-typed positional argument in function defini 12 | posorkw_boolvalued_nohint=True, 13 | posorkw_boolvalued_nonboolhint: int = True, | -error[FBT001]: FBT.py:14:5: Boolean-typed positional argument in function definition +error[FBT001]: 14:5: Boolean-typed positional argument in function definition + --> FBT.py:14:5 | 12 | posorkw_boolvalued_nohint=True, 13 | posorkw_boolvalued_nonboolhint: int = True, @@ -51,8 +56,9 @@ error[FBT001]: FBT.py:14:5: Boolean-typed positional argument in function defini 15 | posorkw_boolvalued_boolstrhint: "bool" = True, 16 | posorkw_nonboolvalued_nohint=1, | -error[FBT001]: FBT.py:15:5: Boolean-typed positional argument in function definition +error[FBT001]: 15:5: Boolean-typed positional argument in function definition + --> FBT.py:15:5 | 13 | posorkw_boolvalued_nonboolhint: int = True, 14 | posorkw_boolvalued_boolhint: bool = True, @@ -61,8 +67,9 @@ error[FBT001]: FBT.py:15:5: Boolean-typed positional argument in function defini 16 | posorkw_nonboolvalued_nohint=1, 17 | posorkw_nonboolvalued_nonboolhint: int = 2, | -error[FBT001]: FBT.py:18:5: Boolean-typed positional argument in function definition +error[FBT001]: 18:5: Boolean-typed positional argument in function definition + --> FBT.py:18:5 | 16 | posorkw_nonboolvalued_nohint=1, 17 | posorkw_nonboolvalued_nonboolhint: int = 2, @@ -71,8 +78,9 @@ error[FBT001]: FBT.py:18:5: Boolean-typed positional argument in function defini 19 | posorkw_nonboolvalued_boolstrhint: "bool" = 4, 20 | *, | -error[FBT001]: FBT.py:19:5: Boolean-typed positional argument in function definition +error[FBT001]: 19:5: Boolean-typed positional argument in function definition + --> FBT.py:19:5 | 17 | posorkw_nonboolvalued_nonboolhint: int = 2, 18 | posorkw_nonboolvalued_boolhint: bool = 3, @@ -81,8 +89,9 @@ error[FBT001]: FBT.py:19:5: Boolean-typed positional argument in function defini 20 | *, 21 | kwonly_nonvalued_nohint, | -error[FBT001]: FBT.py:90:19: Boolean-typed positional argument in function definition +error[FBT001]: 90:19: Boolean-typed positional argument in function definition + --> FBT.py:90:19 | 89 | # FBT001: Boolean positional arg in function definition 90 | def foo(self, value: bool) -> None: diff --git a/crates/ruff_linter/src/rules/flake8_boolean_trap/snapshots/ruff_linter__rules__flake8_boolean_trap__tests__FBT002_FBT.py.snap b/crates/ruff_linter/src/rules/flake8_boolean_trap/snapshots/ruff_linter__rules__flake8_boolean_trap__tests__FBT002_FBT.py.snap index f47745b549..dd78eeb0bb 100644 --- a/crates/ruff_linter/src/rules/flake8_boolean_trap/snapshots/ruff_linter__rules__flake8_boolean_trap__tests__FBT002_FBT.py.snap +++ b/crates/ruff_linter/src/rules/flake8_boolean_trap/snapshots/ruff_linter__rules__flake8_boolean_trap__tests__FBT002_FBT.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_boolean_trap/mod.rs --- -error[FBT002]: FBT.py:12:5: Boolean default positional argument in function definition +error[FBT002]: 12:5: Boolean default positional argument in function definition + --> FBT.py:12:5 | 10 | posorkw_nonvalued_boolhint: bool, 11 | posorkw_nonvalued_boolstrhint: "bool", @@ -11,8 +12,9 @@ error[FBT002]: FBT.py:12:5: Boolean default positional argument in function defi 13 | posorkw_boolvalued_nonboolhint: int = True, 14 | posorkw_boolvalued_boolhint: bool = True, | -error[FBT002]: FBT.py:13:5: Boolean default positional argument in function definition +error[FBT002]: 13:5: Boolean default positional argument in function definition + --> FBT.py:13:5 | 11 | posorkw_nonvalued_boolstrhint: "bool", 12 | posorkw_boolvalued_nohint=True, @@ -21,8 +23,9 @@ error[FBT002]: FBT.py:13:5: Boolean default positional argument in function defi 14 | posorkw_boolvalued_boolhint: bool = True, 15 | posorkw_boolvalued_boolstrhint: "bool" = True, | -error[FBT002]: FBT.py:14:5: Boolean default positional argument in function definition +error[FBT002]: 14:5: Boolean default positional argument in function definition + --> FBT.py:14:5 | 12 | posorkw_boolvalued_nohint=True, 13 | posorkw_boolvalued_nonboolhint: int = True, @@ -31,8 +34,9 @@ error[FBT002]: FBT.py:14:5: Boolean default positional argument in function defi 15 | posorkw_boolvalued_boolstrhint: "bool" = True, 16 | posorkw_nonboolvalued_nohint=1, | -error[FBT002]: FBT.py:15:5: Boolean default positional argument in function definition +error[FBT002]: 15:5: Boolean default positional argument in function definition + --> FBT.py:15:5 | 13 | posorkw_boolvalued_nonboolhint: int = True, 14 | posorkw_boolvalued_boolhint: bool = True, diff --git a/crates/ruff_linter/src/rules/flake8_boolean_trap/snapshots/ruff_linter__rules__flake8_boolean_trap__tests__FBT003_FBT.py.snap b/crates/ruff_linter/src/rules/flake8_boolean_trap/snapshots/ruff_linter__rules__flake8_boolean_trap__tests__FBT003_FBT.py.snap index 32647b3cc1..03ec628022 100644 --- a/crates/ruff_linter/src/rules/flake8_boolean_trap/snapshots/ruff_linter__rules__flake8_boolean_trap__tests__FBT003_FBT.py.snap +++ b/crates/ruff_linter/src/rules/flake8_boolean_trap/snapshots/ruff_linter__rules__flake8_boolean_trap__tests__FBT003_FBT.py.snap @@ -1,15 +1,17 @@ --- source: crates/ruff_linter/src/rules/flake8_boolean_trap/mod.rs --- -error[FBT003]: FBT.py:41:11: Boolean positional value in function call +error[FBT003]: 41:11: Boolean positional value in function call + --> FBT.py:41:11 | 41 | used("a", True) | ^^^^ 42 | used(do=True) | -error[FBT003]: FBT.py:56:11: Boolean positional value in function call +error[FBT003]: 56:11: Boolean positional value in function call + --> FBT.py:56:11 | 54 | {}.pop(True, False) 55 | dict.fromkeys(("world",), True) @@ -18,8 +20,9 @@ error[FBT003]: FBT.py:56:11: Boolean positional value in function call 57 | getattr(someobj, attrname, False) 58 | mylist.index(True) | -error[FBT003]: FBT.py:56:17: Boolean positional value in function call +error[FBT003]: 56:17: Boolean positional value in function call + --> FBT.py:56:17 | 54 | {}.pop(True, False) 55 | dict.fromkeys(("world",), True) @@ -28,14 +31,16 @@ error[FBT003]: FBT.py:56:17: Boolean positional value in function call 57 | getattr(someobj, attrname, False) 58 | mylist.index(True) | -error[FBT003]: FBT.py:120:10: Boolean positional value in function call +error[FBT003]: 120:10: Boolean positional value in function call + --> FBT.py:120:10 | 120 | settings(True) | ^^^^ | -error[FBT003]: FBT.py:144:20: Boolean positional value in function call +error[FBT003]: 144:20: Boolean positional value in function call + --> FBT.py:144:20 | 142 | is_foo_or_bar=Case( 143 | When(Q(is_foo=True) | Q(is_bar=True)), @@ -44,8 +49,9 @@ error[FBT003]: FBT.py:144:20: Boolean positional value in function call 145 | ), 146 | default=Value(False), | -error[FBT003]: FBT.py:146:19: Boolean positional value in function call +error[FBT003]: 146:19: Boolean positional value in function call + --> FBT.py:146:19 | 144 | then=Value(True), 145 | ), @@ -53,8 +59,9 @@ error[FBT003]: FBT.py:146:19: Boolean positional value in function call | ^^^^^ 147 | ) | -error[FBT003]: FBT.py:156:23: Boolean positional value in function call +error[FBT003]: 156:23: Boolean positional value in function call + --> FBT.py:156:23 | 155 | class Settings(BaseSettings): 156 | foo: bool = Field(True, exclude=True) diff --git a/crates/ruff_linter/src/rules/flake8_boolean_trap/snapshots/ruff_linter__rules__flake8_boolean_trap__tests__extend_allowed_callable.snap b/crates/ruff_linter/src/rules/flake8_boolean_trap/snapshots/ruff_linter__rules__flake8_boolean_trap__tests__extend_allowed_callable.snap index 4a6d59c778..fa17747e1d 100644 --- a/crates/ruff_linter/src/rules/flake8_boolean_trap/snapshots/ruff_linter__rules__flake8_boolean_trap__tests__extend_allowed_callable.snap +++ b/crates/ruff_linter/src/rules/flake8_boolean_trap/snapshots/ruff_linter__rules__flake8_boolean_trap__tests__extend_allowed_callable.snap @@ -1,15 +1,17 @@ --- source: crates/ruff_linter/src/rules/flake8_boolean_trap/mod.rs --- -error[FBT003]: FBT.py:41:11: Boolean positional value in function call +error[FBT003]: 41:11: Boolean positional value in function call + --> FBT.py:41:11 | 41 | used("a", True) | ^^^^ 42 | used(do=True) | -error[FBT003]: FBT.py:56:11: Boolean positional value in function call +error[FBT003]: 56:11: Boolean positional value in function call + --> FBT.py:56:11 | 54 | {}.pop(True, False) 55 | dict.fromkeys(("world",), True) @@ -18,8 +20,9 @@ error[FBT003]: FBT.py:56:11: Boolean positional value in function call 57 | getattr(someobj, attrname, False) 58 | mylist.index(True) | -error[FBT003]: FBT.py:56:17: Boolean positional value in function call +error[FBT003]: 56:17: Boolean positional value in function call + --> FBT.py:56:17 | 54 | {}.pop(True, False) 55 | dict.fromkeys(("world",), True) @@ -28,8 +31,9 @@ error[FBT003]: FBT.py:56:17: Boolean positional value in function call 57 | getattr(someobj, attrname, False) 58 | mylist.index(True) | -error[FBT003]: FBT.py:120:10: Boolean positional value in function call +error[FBT003]: 120:10: Boolean positional value in function call + --> FBT.py:120:10 | 120 | settings(True) | ^^^^ diff --git a/crates/ruff_linter/src/rules/flake8_boolean_trap/snapshots/ruff_linter__rules__flake8_boolean_trap__tests__preview__FBT001_FBT.py.snap b/crates/ruff_linter/src/rules/flake8_boolean_trap/snapshots/ruff_linter__rules__flake8_boolean_trap__tests__preview__FBT001_FBT.py.snap index 03346c7acd..7504c64332 100644 --- a/crates/ruff_linter/src/rules/flake8_boolean_trap/snapshots/ruff_linter__rules__flake8_boolean_trap__tests__preview__FBT001_FBT.py.snap +++ b/crates/ruff_linter/src/rules/flake8_boolean_trap/snapshots/ruff_linter__rules__flake8_boolean_trap__tests__preview__FBT001_FBT.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_boolean_trap/mod.rs --- -error[FBT001]: FBT.py:4:5: Boolean-typed positional argument in function definition +error[FBT001]: 4:5: Boolean-typed positional argument in function definition + --> FBT.py:4:5 | 2 | posonly_nohint, 3 | posonly_nonboolhint: int, @@ -11,8 +12,9 @@ error[FBT001]: FBT.py:4:5: Boolean-typed positional argument in function definit 5 | posonly_boolstrhint: "bool", 6 | /, | -error[FBT001]: FBT.py:5:5: Boolean-typed positional argument in function definition +error[FBT001]: 5:5: Boolean-typed positional argument in function definition + --> FBT.py:5:5 | 3 | posonly_nonboolhint: int, 4 | posonly_boolhint: bool, @@ -21,8 +23,9 @@ error[FBT001]: FBT.py:5:5: Boolean-typed positional argument in function definit 6 | /, 7 | offset, | -error[FBT001]: FBT.py:10:5: Boolean-typed positional argument in function definition +error[FBT001]: 10:5: Boolean-typed positional argument in function definition + --> FBT.py:10:5 | 8 | posorkw_nonvalued_nohint, 9 | posorkw_nonvalued_nonboolhint: int, @@ -31,8 +34,9 @@ error[FBT001]: FBT.py:10:5: Boolean-typed positional argument in function defini 11 | posorkw_nonvalued_boolstrhint: "bool", 12 | posorkw_boolvalued_nohint=True, | -error[FBT001]: FBT.py:11:5: Boolean-typed positional argument in function definition +error[FBT001]: 11:5: Boolean-typed positional argument in function definition + --> FBT.py:11:5 | 9 | posorkw_nonvalued_nonboolhint: int, 10 | posorkw_nonvalued_boolhint: bool, @@ -41,8 +45,9 @@ error[FBT001]: FBT.py:11:5: Boolean-typed positional argument in function defini 12 | posorkw_boolvalued_nohint=True, 13 | posorkw_boolvalued_nonboolhint: int = True, | -error[FBT001]: FBT.py:14:5: Boolean-typed positional argument in function definition +error[FBT001]: 14:5: Boolean-typed positional argument in function definition + --> FBT.py:14:5 | 12 | posorkw_boolvalued_nohint=True, 13 | posorkw_boolvalued_nonboolhint: int = True, @@ -51,8 +56,9 @@ error[FBT001]: FBT.py:14:5: Boolean-typed positional argument in function defini 15 | posorkw_boolvalued_boolstrhint: "bool" = True, 16 | posorkw_nonboolvalued_nohint=1, | -error[FBT001]: FBT.py:15:5: Boolean-typed positional argument in function definition +error[FBT001]: 15:5: Boolean-typed positional argument in function definition + --> FBT.py:15:5 | 13 | posorkw_boolvalued_nonboolhint: int = True, 14 | posorkw_boolvalued_boolhint: bool = True, @@ -61,8 +67,9 @@ error[FBT001]: FBT.py:15:5: Boolean-typed positional argument in function defini 16 | posorkw_nonboolvalued_nohint=1, 17 | posorkw_nonboolvalued_nonboolhint: int = 2, | -error[FBT001]: FBT.py:18:5: Boolean-typed positional argument in function definition +error[FBT001]: 18:5: Boolean-typed positional argument in function definition + --> FBT.py:18:5 | 16 | posorkw_nonboolvalued_nohint=1, 17 | posorkw_nonboolvalued_nonboolhint: int = 2, @@ -71,8 +78,9 @@ error[FBT001]: FBT.py:18:5: Boolean-typed positional argument in function defini 19 | posorkw_nonboolvalued_boolstrhint: "bool" = 4, 20 | *, | -error[FBT001]: FBT.py:19:5: Boolean-typed positional argument in function definition +error[FBT001]: 19:5: Boolean-typed positional argument in function definition + --> FBT.py:19:5 | 17 | posorkw_nonboolvalued_nonboolhint: int = 2, 18 | posorkw_nonboolvalued_boolhint: bool = 3, @@ -81,23 +89,26 @@ error[FBT001]: FBT.py:19:5: Boolean-typed positional argument in function defini 20 | *, 21 | kwonly_nonvalued_nohint, | -error[FBT001]: FBT.py:90:19: Boolean-typed positional argument in function definition +error[FBT001]: 90:19: Boolean-typed positional argument in function definition + --> FBT.py:90:19 | 89 | # FBT001: Boolean positional arg in function definition 90 | def foo(self, value: bool) -> None: | ^^^^^ 91 | pass | -error[FBT001]: FBT.py:100:10: Boolean-typed positional argument in function definition +error[FBT001]: 100:10: Boolean-typed positional argument in function definition + --> FBT.py:100:10 | 100 | def func(x: Union[list, Optional[int | str | float | bool]]): | ^ 101 | pass | -error[FBT001]: FBT.py:104:10: Boolean-typed positional argument in function definition +error[FBT001]: 104:10: Boolean-typed positional argument in function definition + --> FBT.py:104:10 | 104 | def func(x: bool | str): | ^ diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B002_B002.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B002_B002.py.snap index 89158354db..55b41aa617 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B002_B002.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B002_B002.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs --- -error[B002]: B002.py:18:9: Python does not support the unary prefix increment operator (`++`) +error[B002]: 18:9: Python does not support the unary prefix increment operator (`++`) + --> B002.py:18:9 | 17 | def this_is_buggy(n): 18 | x = ++n @@ -10,8 +11,9 @@ error[B002]: B002.py:18:9: Python does not support the unary prefix increment op 19 | y = --n 20 | return x, y | -error[B002]: B002.py:19:9: Python does not support the unary prefix decrement operator (`--`) +error[B002]: 19:9: Python does not support the unary prefix decrement operator (`--`) + --> B002.py:19:9 | 17 | def this_is_buggy(n): 18 | x = ++n @@ -19,15 +21,17 @@ error[B002]: B002.py:19:9: Python does not support the unary prefix decrement op | ^^^ 20 | return x, y | -error[B002]: B002.py:24:12: Python does not support the unary prefix increment operator (`++`) +error[B002]: 24:12: Python does not support the unary prefix increment operator (`++`) + --> B002.py:24:12 | 23 | def this_is_buggy_too(n): 24 | return ++n, --n | ^^^ | -error[B002]: B002.py:24:17: Python does not support the unary prefix decrement operator (`--`) +error[B002]: 24:17: Python does not support the unary prefix decrement operator (`--`) + --> B002.py:24:17 | 23 | def this_is_buggy_too(n): 24 | return ++n, --n diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B003_B003.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B003_B003.py.snap index 316f491f77..a61db7c87e 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B003_B003.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B003_B003.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs --- -error[B003]: B003.py:9:1: Assigning to `os.environ` doesn't clear the environment +error[B003]: 9:1: Assigning to `os.environ` doesn't clear the environment + --> B003.py:8:1 | 7 | from os import environ 8 | diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B004_B004.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B004_B004.py.snap index 3fb5a91d5b..cd2f3a5ceb 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B004_B004.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B004_B004.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs --- -error[B004]: B004.py:3:8: [*] Using `hasattr(x, "__call__")` to test if x is callable is unreliable. Use `callable(x)` for consistent results. +error[B004]: 3:8: [*] Using `hasattr(x, "__call__")` to test if x is callable is unreliable. Use `callable(x)` for consistent results. + --> B004.py:3:8 | 1 | def this_is_a_bug(): 2 | o = object() @@ -21,8 +22,9 @@ error[B004]: B004.py:3:8: [*] Using `hasattr(x, "__call__")` to test if x is cal 5 5 | if getattr(o, "__call__", False): 6 6 | print("Ooh, callable! Or is it?") -error[B004]: B004.py:5:8: Using `hasattr(x, "__call__")` to test if x is callable is unreliable. Use `callable(x)` for consistent results. +error[B004]: 5:8: Using `hasattr(x, "__call__")` to test if x is callable is unreliable. Use `callable(x)` for consistent results. + --> B004.py:5:8 | 3 | if hasattr(o, "__call__"): 4 | print("Ooh, callable! Or is it?") @@ -31,8 +33,9 @@ error[B004]: B004.py:5:8: Using `hasattr(x, "__call__")` to test if x is callabl 6 | print("Ooh, callable! Or is it?") | = help: Replace with `callable()` -error[B004]: B004.py:12:8: [*] Using `hasattr(x, "__call__")` to test if x is callable is unreliable. Use `callable(x)` for consistent results. +error[B004]: 12:8: [*] Using `hasattr(x, "__call__")` to test if x is callable is unreliable. Use `callable(x)` for consistent results. + --> B004.py:12:8 | 10 | import builtins 11 | o = object() @@ -52,8 +55,9 @@ error[B004]: B004.py:12:8: [*] Using `hasattr(x, "__call__")` to test if x is ca 14 14 | if builtins.getattr(o, "__call__", False): 15 15 | print("B U G") -error[B004]: B004.py:14:8: Using `hasattr(x, "__call__")` to test if x is callable is unreliable. Use `callable(x)` for consistent results. +error[B004]: 14:8: Using `hasattr(x, "__call__")` to test if x is callable is unreliable. Use `callable(x)` for consistent results. + --> B004.py:14:8 | 12 | if builtins.hasattr(o, "__call__"): 13 | print("B U G") @@ -62,8 +66,9 @@ error[B004]: B004.py:14:8: Using `hasattr(x, "__call__")` to test if x is callab 15 | print("B U G") | = help: Replace with `callable()` -error[B004]: B004.py:24:8: [*] Using `hasattr(x, "__call__")` to test if x is callable is unreliable. Use `callable(x)` for consistent results. +error[B004]: 24:8: [*] Using `hasattr(x, "__call__")` to test if x is callable is unreliable. Use `callable(x)` for consistent results. + --> B004.py:24:8 | 22 | return True 23 | diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B005_B005.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B005_B005.py.snap index a9c5e3b34f..8994b0f077 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B005_B005.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B005_B005.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs --- -error[B005]: B005.py:4:1: Using `.strip()` with multi-character strings is misleading +error[B005]: 4:1: Using `.strip()` with multi-character strings is misleading + --> B005.py:3:28 | 2 | s.strip(s) # no warning 3 | s.strip("we") # no warning @@ -11,8 +12,9 @@ error[B005]: B005.py:4:1: Using `.strip()` with multi-character strings is misle 5 | s.strip("e") # no warning 6 | s.strip("\n\t ") # no warning | -error[B005]: B005.py:7:1: Using `.strip()` with multi-character strings is misleading +error[B005]: 7:1: Using `.strip()` with multi-character strings is misleading + --> B005.py:6:31 | 5 | s.strip("e") # no warning 6 | s.strip("\n\t ") # no warning @@ -21,8 +23,9 @@ error[B005]: B005.py:7:1: Using `.strip()` with multi-character strings is misle 8 | s.lstrip(s) # no warning 9 | s.lstrip("we") # no warning | -error[B005]: B005.py:10:1: Using `.strip()` with multi-character strings is misleading +error[B005]: 10:1: Using `.strip()` with multi-character strings is misleading + --> B005.py:9:29 | 8 | s.lstrip(s) # no warning 9 | s.lstrip("we") # no warning @@ -31,8 +34,9 @@ error[B005]: B005.py:10:1: Using `.strip()` with multi-character strings is misl 11 | s.lstrip("e") # no warning 12 | s.lstrip("\n\t ") # no warning | -error[B005]: B005.py:13:1: Using `.strip()` with multi-character strings is misleading +error[B005]: 13:1: Using `.strip()` with multi-character strings is misleading + --> B005.py:12:32 | 11 | s.lstrip("e") # no warning 12 | s.lstrip("\n\t ") # no warning @@ -41,8 +45,9 @@ error[B005]: B005.py:13:1: Using `.strip()` with multi-character strings is misl 14 | s.rstrip(s) # no warning 15 | s.rstrip("we") # warning | -error[B005]: B005.py:16:1: Using `.strip()` with multi-character strings is misleading +error[B005]: 16:1: Using `.strip()` with multi-character strings is misleading + --> B005.py:15:26 | 14 | s.rstrip(s) # no warning 15 | s.rstrip("we") # warning @@ -51,8 +56,9 @@ error[B005]: B005.py:16:1: Using `.strip()` with multi-character strings is misl 17 | s.rstrip("e") # no warning 18 | s.rstrip("\n\t ") # no warning | -error[B005]: B005.py:19:1: Using `.strip()` with multi-character strings is misleading +error[B005]: 19:1: Using `.strip()` with multi-character strings is misleading + --> B005.py:18:32 | 17 | s.rstrip("e") # no warning 18 | s.rstrip("\n\t ") # no warning @@ -61,8 +67,9 @@ error[B005]: B005.py:19:1: Using `.strip()` with multi-character strings is misl 20 | s.strip("a") # no warning 21 | s.strip("あ") # no warning | -error[B005]: B005.py:22:1: Using `.strip()` with multi-character strings is misleading +error[B005]: 22:1: Using `.strip()` with multi-character strings is misleading + --> B005.py:21:27 | 20 | s.strip("a") # no warning 21 | s.strip("あ") # no warning @@ -71,8 +78,9 @@ error[B005]: B005.py:22:1: Using `.strip()` with multi-character strings is misl 23 | s.strip("\ufeff") # no warning 24 | s.strip("\u0074\u0065\u0073\u0074") # warning | -error[B005]: B005.py:24:1: Using `.strip()` with multi-character strings is misleading +error[B005]: 24:1: Using `.strip()` with multi-character strings is misleading + --> B005.py:23:32 | 22 | s.strip("ああ") # warning 23 | s.strip("\ufeff") # no warning diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_1.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_1.py.snap index 5a552dda53..f8f1408cd2 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_1.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_1.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs --- -error[B006]: B006_1.py:3:22: [*] Do not use mutable data structures for argument defaults +error[B006]: 3:22: [*] Do not use mutable data structures for argument defaults + --> B006_1.py:3:22 | 1 | # Docstring followed by a newline 2 | diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_2.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_2.py.snap index a465f2b837..09505be659 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_2.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_2.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs --- -error[B006]: B006_2.py:4:22: [*] Do not use mutable data structures for argument defaults +error[B006]: 4:22: [*] Do not use mutable data structures for argument defaults + --> B006_2.py:4:22 | 2 | # Regression test for https://github.com/astral-sh/ruff/issues/7155 3 | diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_3.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_3.py.snap index 439dff7309..6534f09f97 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_3.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_3.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs --- -error[B006]: B006_3.py:4:22: [*] Do not use mutable data structures for argument defaults +error[B006]: 4:22: [*] Do not use mutable data structures for argument defaults + --> B006_3.py:4:22 | 4 | def foobar(foor, bar={}): | ^^ diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_4.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_4.py.snap index b6f7710756..c51edf7d97 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_4.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_4.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs --- -error[B006]: B006_4.py:7:26: [*] Do not use mutable data structures for argument defaults +error[B006]: 7:26: [*] Do not use mutable data structures for argument defaults + --> B006_4.py:7:26 | 6 | class FormFeedIndent: 7 | def __init__(self, a=[]): diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_5.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_5.py.snap index e1a70c92ed..7d11194321 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_5.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_5.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs --- -error[B006]: B006_5.py:5:49: [*] Do not use mutable data structures for argument defaults +error[B006]: 5:49: [*] Do not use mutable data structures for argument defaults + --> B006_5.py:5:49 | 5 | def import_module_wrong(value: dict[str, str] = {}): | ^^ @@ -22,8 +23,9 @@ error[B006]: B006_5.py:5:49: [*] Do not use mutable data structures for argument 8 10 | 9 11 | def import_module_with_values_wrong(value: dict[str, str] = {}): -error[B006]: B006_5.py:9:61: [*] Do not use mutable data structures for argument defaults +error[B006]: 9:61: [*] Do not use mutable data structures for argument defaults + --> B006_5.py:9:61 | 9 | def import_module_with_values_wrong(value: dict[str, str] = {}): | ^^ @@ -44,8 +46,9 @@ error[B006]: B006_5.py:9:61: [*] Do not use mutable data structures for argument 13 15 | 14 16 | -error[B006]: B006_5.py:15:50: [*] Do not use mutable data structures for argument defaults +error[B006]: 15:50: [*] Do not use mutable data structures for argument defaults + --> B006_5.py:15:50 | 15 | def import_modules_wrong(value: dict[str, str] = {}): | ^^ @@ -68,8 +71,9 @@ error[B006]: B006_5.py:15:50: [*] Do not use mutable data structures for argumen 20 22 | 21 23 | def from_import_module_wrong(value: dict[str, str] = {}): -error[B006]: B006_5.py:21:54: [*] Do not use mutable data structures for argument defaults +error[B006]: 21:54: [*] Do not use mutable data structures for argument defaults + --> B006_5.py:21:54 | 21 | def from_import_module_wrong(value: dict[str, str] = {}): | ^^ @@ -89,8 +93,9 @@ error[B006]: B006_5.py:21:54: [*] Do not use mutable data structures for argumen 24 26 | 25 27 | def from_imports_module_wrong(value: dict[str, str] = {}): -error[B006]: B006_5.py:25:55: [*] Do not use mutable data structures for argument defaults +error[B006]: 25:55: [*] Do not use mutable data structures for argument defaults + --> B006_5.py:25:55 | 25 | def from_imports_module_wrong(value: dict[str, str] = {}): | ^^ @@ -112,8 +117,9 @@ error[B006]: B006_5.py:25:55: [*] Do not use mutable data structures for argumen 29 31 | 30 32 | def import_and_from_imports_module_wrong(value: dict[str, str] = {}): -error[B006]: B006_5.py:30:66: [*] Do not use mutable data structures for argument defaults +error[B006]: 30:66: [*] Do not use mutable data structures for argument defaults + --> B006_5.py:30:66 | 30 | def import_and_from_imports_module_wrong(value: dict[str, str] = {}): | ^^ @@ -135,8 +141,9 @@ error[B006]: B006_5.py:30:66: [*] Do not use mutable data structures for argumen 34 36 | 35 37 | def import_docstring_module_wrong(value: dict[str, str] = {}): -error[B006]: B006_5.py:35:59: [*] Do not use mutable data structures for argument defaults +error[B006]: 35:59: [*] Do not use mutable data structures for argument defaults + --> B006_5.py:35:59 | 35 | def import_docstring_module_wrong(value: dict[str, str] = {}): | ^^ @@ -158,8 +165,9 @@ error[B006]: B006_5.py:35:59: [*] Do not use mutable data structures for argumen 39 41 | 40 42 | def import_module_wrong(value: dict[str, str] = {}): -error[B006]: B006_5.py:40:49: [*] Do not use mutable data structures for argument defaults +error[B006]: 40:49: [*] Do not use mutable data structures for argument defaults + --> B006_5.py:40:49 | 40 | def import_module_wrong(value: dict[str, str] = {}): | ^^ @@ -181,8 +189,9 @@ error[B006]: B006_5.py:40:49: [*] Do not use mutable data structures for argumen 44 46 | 45 47 | def import_module_wrong(value: dict[str, str] = {}): -error[B006]: B006_5.py:45:49: [*] Do not use mutable data structures for argument defaults +error[B006]: 45:49: [*] Do not use mutable data structures for argument defaults + --> B006_5.py:45:49 | 45 | def import_module_wrong(value: dict[str, str] = {}): | ^^ @@ -203,8 +212,9 @@ error[B006]: B006_5.py:45:49: [*] Do not use mutable data structures for argumen 48 50 | 49 51 | -error[B006]: B006_5.py:50:49: [*] Do not use mutable data structures for argument defaults +error[B006]: 50:49: [*] Do not use mutable data structures for argument defaults + --> B006_5.py:50:49 | 50 | def import_module_wrong(value: dict[str, str] = {}): | ^^ @@ -226,8 +236,9 @@ error[B006]: B006_5.py:50:49: [*] Do not use mutable data structures for argumen 54 56 | 55 57 | def import_module_wrong(value: dict[str, str] = {}): -error[B006]: B006_5.py:55:49: [*] Do not use mutable data structures for argument defaults +error[B006]: 55:49: [*] Do not use mutable data structures for argument defaults + --> B006_5.py:55:49 | 55 | def import_module_wrong(value: dict[str, str] = {}): | ^^ @@ -247,8 +258,9 @@ error[B006]: B006_5.py:55:49: [*] Do not use mutable data structures for argumen 58 60 | 59 61 | def import_module_wrong(value: dict[str, str] = {}): -error[B006]: B006_5.py:59:49: [*] Do not use mutable data structures for argument defaults +error[B006]: 59:49: [*] Do not use mutable data structures for argument defaults + --> B006_5.py:59:49 | 59 | def import_module_wrong(value: dict[str, str] = {}): | ^^ @@ -267,8 +279,9 @@ error[B006]: B006_5.py:59:49: [*] Do not use mutable data structures for argumen 61 63 | 62 64 | -error[B006]: B006_5.py:63:49: [*] Do not use mutable data structures for argument defaults +error[B006]: 63:49: [*] Do not use mutable data structures for argument defaults + --> B006_5.py:63:49 | 63 | def import_module_wrong(value: dict[str, str] = {}): | ^^ @@ -288,22 +301,25 @@ error[B006]: B006_5.py:63:49: [*] Do not use mutable data structures for argumen 66 68 | 67 69 | def import_module_wrong(value: dict[str, str] = {}): import os -error[B006]: B006_5.py:67:49: Do not use mutable data structures for argument defaults +error[B006]: 67:49: Do not use mutable data structures for argument defaults + --> B006_5.py:67:49 | 67 | def import_module_wrong(value: dict[str, str] = {}): import os | ^^ | = help: Replace with `None`; initialize within function -error[B006]: B006_5.py:70:49: Do not use mutable data structures for argument defaults +error[B006]: 70:49: Do not use mutable data structures for argument defaults + --> B006_5.py:70:49 | 70 | def import_module_wrong(value: dict[str, str] = {}): import os; import sys | ^^ | = help: Replace with `None`; initialize within function -error[B006]: B006_5.py:73:49: Do not use mutable data structures for argument defaults +error[B006]: 73:49: Do not use mutable data structures for argument defaults + --> B006_5.py:73:49 | 73 | def import_module_wrong(value: dict[str, str] = {}): \ | ^^ diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_6.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_6.py.snap index f291a1aac2..40c0cd6e85 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_6.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_6.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs --- -error[B006]: B006_6.py:4:22: [*] Do not use mutable data structures for argument defaults +error[B006]: 4:22: [*] Do not use mutable data structures for argument defaults + --> B006_6.py:4:22 | 2 | # Same as B006_2.py, but import instead of docstring 3 | diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_7.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_7.py.snap index 38fa1e0651..bf80946867 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_7.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_7.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs --- -error[B006]: B006_7.py:4:22: [*] Do not use mutable data structures for argument defaults +error[B006]: 4:22: [*] Do not use mutable data structures for argument defaults + --> B006_7.py:4:22 | 2 | # Same as B006_3.py, but import instead of docstring 3 | diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_8.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_8.py.snap index 6e85aa0649..38782599eb 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_8.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_8.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs --- -error[B006]: B006_8.py:1:19: [*] Do not use mutable data structures for argument defaults +error[B006]: 1:19: [*] Do not use mutable data structures for argument defaults + --> B006_8.py:1:19 | 1 | def foo(a: list = []): | ^^ @@ -16,8 +17,9 @@ error[B006]: B006_8.py:1:19: [*] Do not use mutable data structures for argument 3 3 | 4 4 | -error[B006]: B006_8.py:5:19: [*] Do not use mutable data structures for argument defaults +error[B006]: 5:19: [*] Do not use mutable data structures for argument defaults + --> B006_8.py:5:19 | 5 | def bar(a: dict = {}): | ^^ @@ -35,8 +37,9 @@ error[B006]: B006_8.py:5:19: [*] Do not use mutable data structures for argument 7 7 | raise NotImplementedError("and has some text in here") 8 8 | -error[B006]: B006_8.py:10:19: [*] Do not use mutable data structures for argument defaults +error[B006]: 10:19: [*] Do not use mutable data structures for argument defaults + --> B006_8.py:10:19 | 10 | def baz(a: list = []): | ^^ @@ -57,8 +60,9 @@ error[B006]: B006_8.py:10:19: [*] Do not use mutable data structures for argumen 13 15 | 14 16 | -error[B006]: B006_8.py:15:19: [*] Do not use mutable data structures for argument defaults +error[B006]: 15:19: [*] Do not use mutable data structures for argument defaults + --> B006_8.py:15:19 | 15 | def qux(a: list = []): | ^^ @@ -75,8 +79,9 @@ error[B006]: B006_8.py:15:19: [*] Do not use mutable data structures for argumen 17 17 | 18 18 | -error[B006]: B006_8.py:19:20: [*] Do not use mutable data structures for argument defaults +error[B006]: 19:20: [*] Do not use mutable data structures for argument defaults + --> B006_8.py:19:20 | 19 | def quux(a: list = []): | ^^ diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_B008.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_B008.py.snap index bd95b19842..a78436b59f 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_B008.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_B008.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs --- -error[B006]: B006_B008.py:63:25: [*] Do not use mutable data structures for argument defaults +error[B006]: 63:25: [*] Do not use mutable data structures for argument defaults + --> B006_B008.py:63:25 | 63 | def this_is_wrong(value=[1, 2, 3]): | ^^^^^^^^^ @@ -19,8 +20,9 @@ error[B006]: B006_B008.py:63:25: [*] Do not use mutable data structures for argu 65 65 | 66 66 | -error[B006]: B006_B008.py:67:30: [*] Do not use mutable data structures for argument defaults +error[B006]: 67:30: [*] Do not use mutable data structures for argument defaults + --> B006_B008.py:67:30 | 67 | def this_is_also_wrong(value={}): | ^^ @@ -37,8 +39,9 @@ error[B006]: B006_B008.py:67:30: [*] Do not use mutable data structures for argu 69 69 | 70 70 | -error[B006]: B006_B008.py:73:52: [*] Do not use mutable data structures for argument defaults +error[B006]: 73:52: [*] Do not use mutable data structures for argument defaults + --> B006_B008.py:73:52 | 71 | class Foo: 72 | @staticmethod @@ -57,8 +60,9 @@ error[B006]: B006_B008.py:73:52: [*] Do not use mutable data structures for argu 75 75 | 76 76 | -error[B006]: B006_B008.py:77:31: [*] Do not use mutable data structures for argument defaults +error[B006]: 77:31: [*] Do not use mutable data structures for argument defaults + --> B006_B008.py:77:31 | 77 | def multiline_arg_wrong(value={ | _______________________________^ @@ -80,8 +84,9 @@ error[B006]: B006_B008.py:77:31: [*] Do not use mutable data structures for argu 81 79 | 82 80 | def single_line_func_wrong(value = {}): ... -error[B006]: B006_B008.py:82:36: Do not use mutable data structures for argument defaults +error[B006]: 82:36: Do not use mutable data structures for argument defaults + --> B006_B008.py:82:36 | 80 | ... 81 | @@ -89,8 +94,9 @@ error[B006]: B006_B008.py:82:36: Do not use mutable data structures for argument | ^^ | = help: Replace with `None`; initialize within function -error[B006]: B006_B008.py:85:20: [*] Do not use mutable data structures for argument defaults +error[B006]: 85:20: [*] Do not use mutable data structures for argument defaults + --> B006_B008.py:85:20 | 85 | def and_this(value=set()): | ^^^^^ @@ -107,8 +113,9 @@ error[B006]: B006_B008.py:85:20: [*] Do not use mutable data structures for argu 87 87 | 88 88 | -error[B006]: B006_B008.py:89:20: [*] Do not use mutable data structures for argument defaults +error[B006]: 89:20: [*] Do not use mutable data structures for argument defaults + --> B006_B008.py:89:20 | 89 | def this_too(value=collections.OrderedDict()): | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -125,8 +132,9 @@ error[B006]: B006_B008.py:89:20: [*] Do not use mutable data structures for argu 91 91 | 92 92 | -error[B006]: B006_B008.py:93:32: [*] Do not use mutable data structures for argument defaults +error[B006]: 93:32: [*] Do not use mutable data structures for argument defaults + --> B006_B008.py:93:32 | 93 | async def async_this_too(value=collections.defaultdict()): | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -143,8 +151,9 @@ error[B006]: B006_B008.py:93:32: [*] Do not use mutable data structures for argu 95 95 | 96 96 | -error[B006]: B006_B008.py:97:26: [*] Do not use mutable data structures for argument defaults +error[B006]: 97:26: [*] Do not use mutable data structures for argument defaults + --> B006_B008.py:97:26 | 97 | def dont_forget_me(value=collections.deque()): | ^^^^^^^^^^^^^^^^^^^ @@ -161,8 +170,9 @@ error[B006]: B006_B008.py:97:26: [*] Do not use mutable data structures for argu 99 99 | 100 100 | -error[B006]: B006_B008.py:102:46: [*] Do not use mutable data structures for argument defaults +error[B006]: 102:46: [*] Do not use mutable data structures for argument defaults + --> B006_B008.py:102:46 | 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)]): @@ -180,8 +190,9 @@ error[B006]: B006_B008.py:102:46: [*] Do not use mutable data structures for arg 104 104 | 105 105 | -error[B006]: B006_B008.py:106:46: [*] Do not use mutable data structures for argument defaults +error[B006]: 106:46: [*] Do not use mutable data structures for argument defaults + --> B006_B008.py:106:46 | 106 | def dict_comprehension_also_not_okay(default={i: i**2 for i in range(3)}): | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -198,8 +209,9 @@ error[B006]: B006_B008.py:106:46: [*] Do not use mutable data structures for arg 108 108 | 109 109 | -error[B006]: B006_B008.py:110:45: [*] Do not use mutable data structures for argument defaults +error[B006]: 110:45: [*] Do not use mutable data structures for argument defaults + --> B006_B008.py:110:45 | 110 | def set_comprehension_also_not_okay(default={i**2 for i in range(3)}): | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -216,8 +228,9 @@ error[B006]: B006_B008.py:110:45: [*] Do not use mutable data structures for arg 112 112 | 113 113 | -error[B006]: B006_B008.py:114:33: [*] Do not use mutable data structures for argument defaults +error[B006]: 114:33: [*] Do not use mutable data structures for argument defaults + --> B006_B008.py:114:33 | 114 | def kwonlyargs_mutable(*, value=[]): | ^^ @@ -234,8 +247,9 @@ error[B006]: B006_B008.py:114:33: [*] Do not use mutable data structures for arg 116 116 | 117 117 | -error[B006]: B006_B008.py:239:20: [*] Do not use mutable data structures for argument defaults +error[B006]: 239:20: [*] Do not use mutable data structures for argument defaults + --> B006_B008.py:239:20 | 237 | # B006 and B008 238 | # We should handle arbitrary nesting of these B008. @@ -254,8 +268,9 @@ error[B006]: B006_B008.py:239:20: [*] Do not use mutable data structures for arg 241 241 | 242 242 | -error[B006]: B006_B008.py:276:27: [*] Do not use mutable data structures for argument defaults +error[B006]: 276:27: [*] Do not use mutable data structures for argument defaults + --> B006_B008.py:276:27 | 275 | def mutable_annotations( 276 | a: list[int] | None = [], @@ -274,8 +289,9 @@ error[B006]: B006_B008.py:276:27: [*] Do not use mutable data structures for arg 278 278 | c: Annotated[Union[Set[str], abc.Sized], "annotation"] = set(), 279 279 | d: typing_extensions.Annotated[Union[Set[str], abc.Sized], "annotation"] = set(), -error[B006]: B006_B008.py:277:35: [*] Do not use mutable data structures for argument defaults +error[B006]: 277:35: [*] Do not use mutable data structures for argument defaults + --> B006_B008.py:277:35 | 275 | def mutable_annotations( 276 | a: list[int] | None = [], @@ -295,8 +311,9 @@ error[B006]: B006_B008.py:277:35: [*] Do not use mutable data structures for arg 279 279 | d: typing_extensions.Annotated[Union[Set[str], abc.Sized], "annotation"] = set(), 280 280 | ): -error[B006]: B006_B008.py:278:62: [*] Do not use mutable data structures for argument defaults +error[B006]: 278:62: [*] Do not use mutable data structures for argument defaults + --> B006_B008.py:278:62 | 276 | a: list[int] | None = [], 277 | b: Optional[Dict[int, int]] = {}, @@ -316,8 +333,9 @@ error[B006]: B006_B008.py:278:62: [*] Do not use mutable data structures for arg 280 280 | ): 281 281 | pass -error[B006]: B006_B008.py:279:80: [*] Do not use mutable data structures for argument defaults +error[B006]: 279:80: [*] Do not use mutable data structures for argument defaults + --> B006_B008.py:279:80 | 277 | b: Optional[Dict[int, int]] = {}, 278 | c: Annotated[Union[Set[str], abc.Sized], "annotation"] = set(), @@ -337,8 +355,9 @@ error[B006]: B006_B008.py:279:80: [*] Do not use mutable data structures for arg 281 281 | pass 282 282 | -error[B006]: B006_B008.py:284:52: [*] Do not use mutable data structures for argument defaults +error[B006]: 284:52: [*] Do not use mutable data structures for argument defaults + --> B006_B008.py:284:52 | 284 | def single_line_func_wrong(value: dict[str, str] = {}): | ^^ @@ -355,8 +374,9 @@ error[B006]: B006_B008.py:284:52: [*] Do not use mutable data structures for arg 286 286 | 287 287 | -error[B006]: B006_B008.py:288:52: [*] Do not use mutable data structures for argument defaults +error[B006]: 288:52: [*] Do not use mutable data structures for argument defaults + --> B006_B008.py:288:52 | 288 | def single_line_func_wrong(value: dict[str, str] = {}): | ^^ @@ -374,8 +394,9 @@ error[B006]: B006_B008.py:288:52: [*] Do not use mutable data structures for arg 290 290 | ... 291 291 | -error[B006]: B006_B008.py:293:52: [*] Do not use mutable data structures for argument defaults +error[B006]: 293:52: [*] Do not use mutable data structures for argument defaults + --> B006_B008.py:293:52 | 293 | def single_line_func_wrong(value: dict[str, str] = {}): | ^^ @@ -392,8 +413,9 @@ error[B006]: B006_B008.py:293:52: [*] Do not use mutable data structures for arg 295 295 | 296 296 | -error[B006]: B006_B008.py:297:52: [*] Do not use mutable data structures for argument defaults +error[B006]: 297:52: [*] Do not use mutable data structures for argument defaults + --> B006_B008.py:297:52 | 297 | def single_line_func_wrong(value: dict[str, str] = {}): | ^^ @@ -411,8 +433,9 @@ error[B006]: B006_B008.py:297:52: [*] Do not use mutable data structures for arg 299 299 | ... 300 300 | -error[B006]: B006_B008.py:302:52: [*] Do not use mutable data structures for argument defaults +error[B006]: 302:52: [*] Do not use mutable data structures for argument defaults + --> B006_B008.py:302:52 | 302 | def single_line_func_wrong(value: dict[str, str] = { | ____________________________________________________^ @@ -434,8 +457,9 @@ error[B006]: B006_B008.py:302:52: [*] Do not use mutable data structures for arg 306 304 | 307 305 | -error[B006]: B006_B008.py:308:52: Do not use mutable data structures for argument defaults +error[B006]: 308:52: Do not use mutable data structures for argument defaults + --> B006_B008.py:308:52 | 308 | def single_line_func_wrong(value: dict[str, str] = {}) \ | ^^ @@ -443,8 +467,9 @@ error[B006]: B006_B008.py:308:52: Do not use mutable data structures for argumen 310 | """Docstring""" | = help: Replace with `None`; initialize within function -error[B006]: B006_B008.py:313:52: [*] Do not use mutable data structures for argument defaults +error[B006]: 313:52: [*] Do not use mutable data structures for argument defaults + --> B006_B008.py:313:52 | 313 | def single_line_func_wrong(value: dict[str, str] = {}): | ^^ diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B007_B007.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B007_B007.py.snap index 3dd064300a..ae459d0362 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B007_B007.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B007_B007.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs --- -error[B007]: B007.py:6:5: Loop control variable `i` not used within loop body +error[B007]: 6:5: Loop control variable `i` not used within loop body + --> B007.py:6:5 | 4 | print(i) # name no longer defined on Python 3; no warning yet 5 | @@ -11,8 +12,9 @@ error[B007]: B007.py:6:5: Loop control variable `i` not used within loop body 7 | print(10) | = help: Rename unused `i` to `_i` -error[B007]: B007.py:18:13: [*] Loop control variable `k` not used within loop body +error[B007]: 18:13: [*] Loop control variable `k` not used within loop body + --> B007.py:18:13 | 16 | for i in range(10): 17 | for j in range(10): @@ -31,16 +33,18 @@ error[B007]: B007.py:18:13: [*] Loop control variable `k` not used within loop b 20 20 | 21 21 | -error[B007]: B007.py:30:5: Loop control variable `i` not used within loop body +error[B007]: 30:5: Loop control variable `i` not used within loop body + --> B007.py:30:5 | 30 | for i, (j, (k, l)) in strange_generator(): # i, k not used | ^ 31 | print(j, l) | = help: Rename unused `i` to `_i` -error[B007]: B007.py:30:13: [*] Loop control variable `k` not used within loop body +error[B007]: 30:13: [*] Loop control variable `k` not used within loop body + --> B007.py:30:13 | 30 | for i, (j, (k, l)) in strange_generator(): # i, k not used | ^ @@ -57,8 +61,9 @@ error[B007]: B007.py:30:13: [*] Loop control variable `k` not used within loop b 32 32 | 33 33 | FMT = "{foo} {bar}" -error[B007]: B007.py:34:10: Loop control variable `bar` may not be used within loop body +error[B007]: 34:10: Loop control variable `bar` may not be used within loop body + --> B007.py:34:10 | 33 | FMT = "{foo} {bar}" 34 | for foo, bar in [(1, 2)]: @@ -67,8 +72,9 @@ error[B007]: B007.py:34:10: Loop control variable `bar` may not be used within l 36 | print(FMT.format(**locals())) | = help: Rename unused `bar` to `_bar` -error[B007]: B007.py:38:10: Loop control variable `bar` may not be used within loop body +error[B007]: 38:10: Loop control variable `bar` may not be used within loop body + --> B007.py:38:10 | 36 | print(FMT.format(**locals())) 37 | @@ -78,8 +84,9 @@ error[B007]: B007.py:38:10: Loop control variable `bar` may not be used within l 40 | print(FMT.format(**globals())) | = help: Rename unused `bar` to `_bar` -error[B007]: B007.py:42:10: Loop control variable `bar` may not be used within loop body +error[B007]: 42:10: Loop control variable `bar` may not be used within loop body + --> B007.py:42:10 | 40 | print(FMT.format(**globals())) 41 | @@ -89,8 +96,9 @@ error[B007]: B007.py:42:10: Loop control variable `bar` may not be used within l 44 | print(FMT.format(**vars())) | = help: Rename unused `bar` to `_bar` -error[B007]: B007.py:46:10: Loop control variable `bar` may not be used within loop body +error[B007]: 46:10: Loop control variable `bar` may not be used within loop body + --> B007.py:46:10 | 44 | print(FMT.format(**vars())) 45 | @@ -99,8 +107,9 @@ error[B007]: B007.py:46:10: Loop control variable `bar` may not be used within l 47 | print(FMT.format(foo=foo, bar=eval("bar"))) | = help: Rename unused `bar` to `_bar` -error[B007]: B007.py:52:14: [*] Loop control variable `bar` not used within loop body +error[B007]: 52:14: [*] Loop control variable `bar` not used within loop body + --> B007.py:52:14 | 50 | def f(): 51 | # Fixable. @@ -120,8 +129,9 @@ error[B007]: B007.py:52:14: [*] Loop control variable `bar` not used within loop 54 54 | break 55 55 | -error[B007]: B007.py:59:14: Loop control variable `bar` not used within loop body +error[B007]: 59:14: Loop control variable `bar` not used within loop body + --> B007.py:59:14 | 57 | def f(): 58 | # Unfixable due to usage of `bar` outside of loop. @@ -131,8 +141,9 @@ error[B007]: B007.py:59:14: Loop control variable `bar` not used within loop bod 61 | break | = help: Rename unused `bar` to `_bar` -error[B007]: B007.py:68:14: [*] Loop control variable `bar` not used within loop body +error[B007]: 68:14: [*] Loop control variable `bar` not used within loop body + --> B007.py:68:14 | 66 | def f(): 67 | # Fixable. @@ -152,8 +163,9 @@ error[B007]: B007.py:68:14: [*] Loop control variable `bar` not used within loop 70 70 | break 71 71 | -error[B007]: B007.py:77:14: Loop control variable `bar` not used within loop body +error[B007]: 77:14: Loop control variable `bar` not used within loop body + --> B007.py:77:14 | 75 | def f(): 76 | # Unfixable. @@ -163,8 +175,9 @@ error[B007]: B007.py:77:14: Loop control variable `bar` not used within loop bod 79 | break | = help: Rename unused `bar` to `_bar` -error[B007]: B007.py:88:14: Loop control variable `bar` not used within loop body +error[B007]: 88:14: Loop control variable `bar` not used within loop body + --> B007.py:88:14 | 86 | def f(): 87 | # Unfixable (false negative) due to usage of `bar` outside of loop. @@ -174,8 +187,9 @@ error[B007]: B007.py:88:14: Loop control variable `bar` not used within loop bod 90 | break | = help: Rename unused `bar` to `_bar` -error[B007]: B007.py:98:5: Loop control variable `line_` not used within loop body +error[B007]: 98:5: Loop control variable `line_` not used within loop body + --> B007.py:98:5 | 96 | # Unfixable due to trailing underscore (`_line_` wouldn't be considered an ignorable 97 | # variable name). diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B008_B006_B008.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B008_B006_B008.py.snap index 2952498cb0..163c08abd2 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B008_B006_B008.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B008_B006_B008.py.snap @@ -1,30 +1,34 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs --- -error[B008]: B006_B008.py:102:61: Do not perform function call `range` in argument defaults; instead, perform the call within the function, or read the default from a module-level singleton variable +error[B008]: 102:61: Do not perform function call `range` in argument defaults; instead, perform the call within the function, or read the default from a module-level singleton variable + --> B006_B008.py:102:61 | 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)]): | ^^^^^^^^ 103 | pass | -error[B008]: B006_B008.py:106:64: Do not perform function call `range` in argument defaults; instead, perform the call within the function, or read the default from a module-level singleton variable +error[B008]: 106:64: Do not perform function call `range` in argument defaults; instead, perform the call within the function, or read the default from a module-level singleton variable + --> B006_B008.py:106:64 | 106 | def dict_comprehension_also_not_okay(default={i: i**2 for i in range(3)}): | ^^^^^^^^ 107 | pass | -error[B008]: B006_B008.py:110:60: Do not perform function call `range` in argument defaults; instead, perform the call within the function, or read the default from a module-level singleton variable +error[B008]: 110:60: Do not perform function call `range` in argument defaults; instead, perform the call within the function, or read the default from a module-level singleton variable + --> B006_B008.py:110:60 | 110 | def set_comprehension_also_not_okay(default={i**2 for i in range(3)}): | ^^^^^^^^ 111 | pass | -error[B008]: B006_B008.py:126:39: Do not perform function call `time.time` in argument defaults; instead, perform the call within the function, or read the default from a module-level singleton variable +error[B008]: 126:39: Do not perform function call `time.time` in argument defaults; instead, perform the call within the function, or read the default from a module-level singleton variable + --> B006_B008.py:126:39 | 124 | # B008 125 | # Flag function calls as default args (including if they are part of a sub-expression) @@ -32,22 +36,25 @@ error[B008]: B006_B008.py:126:39: Do not perform function call `time.time` in ar | ^^^^^^^^^^^ 127 | ... | -error[B008]: B006_B008.py:130:12: Do not perform function call `dt.datetime.now` in argument defaults; instead, perform the call within the function, or read the default from a module-level singleton variable +error[B008]: 130:12: Do not perform function call `dt.datetime.now` in argument defaults; instead, perform the call within the function, or read the default from a module-level singleton variable + --> B006_B008.py:130:12 | 130 | def f(when=dt.datetime.now() + dt.timedelta(days=7)): | ^^^^^^^^^^^^^^^^^ 131 | pass | -error[B008]: B006_B008.py:134:30: Do not perform function call in argument defaults; instead, perform the call within the function, or read the default from a module-level singleton variable +error[B008]: 134:30: Do not perform function call in argument defaults; instead, perform the call within the function, or read the default from a module-level singleton variable + --> B006_B008.py:134:30 | 134 | def can_even_catch_lambdas(a=(lambda x: x)()): | ^^^^^^^^^^^^^^^ 135 | ... | -error[B008]: B006_B008.py:239:31: Do not perform function call `dt.datetime.now` in argument defaults; instead, perform the call within the function, or read the default from a module-level singleton variable +error[B008]: 239:31: Do not perform function call `dt.datetime.now` in argument defaults; instead, perform the call within the function, or read the default from a module-level singleton variable + --> B006_B008.py:239:31 | 237 | # B006 and B008 238 | # We should handle arbitrary nesting of these B008. @@ -55,8 +62,9 @@ error[B008]: B006_B008.py:239:31: Do not perform function call `dt.datetime.now` | ^^^^^^^^^^^^^^^^^ 240 | pass | -error[B008]: B006_B008.py:245:22: Do not perform function call `map` in argument defaults; instead, perform the call within the function, or read the default from a module-level singleton variable +error[B008]: 245:22: Do not perform function call `map` in argument defaults; instead, perform the call within the function, or read the default from a module-level singleton variable + --> B006_B008.py:245:22 | 243 | # Don't flag nested B006 since we can't guarantee that 244 | # it isn't made mutable by the outer operation. @@ -64,16 +72,18 @@ error[B008]: B006_B008.py:245:22: Do not perform function call `map` in argument | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 246 | pass | -error[B008]: B006_B008.py:250:19: Do not perform function call `random.randint` in argument defaults; instead, perform the call within the function, or read the default from a module-level singleton variable +error[B008]: 250:19: Do not perform function call `random.randint` in argument defaults; instead, perform the call within the function, or read the default from a module-level singleton variable + --> B006_B008.py:250:19 | 249 | # B008-ception. 250 | def nested_b008(a=random.randint(0, dt.datetime.now().year)): | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 251 | pass | -error[B008]: B006_B008.py:250:37: Do not perform function call `dt.datetime.now` in argument defaults; instead, perform the call within the function, or read the default from a module-level singleton variable +error[B008]: 250:37: Do not perform function call `dt.datetime.now` in argument defaults; instead, perform the call within the function, or read the default from a module-level singleton variable + --> B006_B008.py:250:37 | 249 | # B008-ception. 250 | def nested_b008(a=random.randint(0, dt.datetime.now().year)): diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B009_B009_B010.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B009_B009_B010.py.snap index 3d30d938ef..6e5d7c8331 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B009_B009_B010.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B009_B009_B010.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs --- -error[B009]: B009_B010.py:19:1: [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. +error[B009]: 19:1: [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. + --> B009_B010.py:18:16 | 18 | # Invalid usage 19 | getattr(foo, "bar") @@ -21,8 +22,9 @@ error[B009]: B009_B010.py:19:1: [*] Do not call `getattr` with a constant attrib 21 21 | getattr(foo, "__123abc__") 22 22 | getattr(foo, "abc123") -error[B009]: B009_B010.py:20:1: [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. +error[B009]: 20:1: [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. + --> B009_B010.py:19:20 | 18 | # Invalid usage 19 | getattr(foo, "bar") @@ -42,8 +44,9 @@ error[B009]: B009_B010.py:20:1: [*] Do not call `getattr` with a constant attrib 22 22 | getattr(foo, "abc123") 23 23 | getattr(foo, r"abc123") -error[B009]: B009_B010.py:21:1: [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. +error[B009]: 21:1: [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. + --> B009_B010.py:20:24 | 19 | getattr(foo, "bar") 20 | getattr(foo, "_123abc") @@ -63,8 +66,9 @@ error[B009]: B009_B010.py:21:1: [*] Do not call `getattr` with a constant attrib 23 23 | getattr(foo, r"abc123") 24 24 | _ = lambda x: getattr(x, "bar") -error[B009]: B009_B010.py:22:1: [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. +error[B009]: 22:1: [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. + --> B009_B010.py:21:27 | 20 | getattr(foo, "_123abc") 21 | getattr(foo, "__123abc__") @@ -84,8 +88,9 @@ error[B009]: B009_B010.py:22:1: [*] Do not call `getattr` with a constant attrib 24 24 | _ = lambda x: getattr(x, "bar") 25 25 | if getattr(x, "bar"): -error[B009]: B009_B010.py:23:1: [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. +error[B009]: 23:1: [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. + --> B009_B010.py:22:23 | 21 | getattr(foo, "__123abc__") 22 | getattr(foo, "abc123") @@ -105,8 +110,9 @@ error[B009]: B009_B010.py:23:1: [*] Do not call `getattr` with a constant attrib 25 25 | if getattr(x, "bar"): 26 26 | pass -error[B009]: B009_B010.py:24:15: [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. +error[B009]: 24:15: [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. + --> B009_B010.py:24:15 | 22 | getattr(foo, "abc123") 23 | getattr(foo, r"abc123") @@ -126,8 +132,9 @@ error[B009]: B009_B010.py:24:15: [*] Do not call `getattr` with a constant attri 26 26 | pass 27 27 | getattr(1, "real") -error[B009]: B009_B010.py:25:4: [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. +error[B009]: 25:4: [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. + --> B009_B010.py:25:4 | 23 | getattr(foo, r"abc123") 24 | _ = lambda x: getattr(x, "bar") @@ -147,8 +154,9 @@ error[B009]: B009_B010.py:25:4: [*] Do not call `getattr` with a constant attrib 27 27 | getattr(1, "real") 28 28 | getattr(1., "real") -error[B009]: B009_B010.py:27:1: [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. +error[B009]: 27:1: [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. + --> B009_B010.py:26:9 | 25 | if getattr(x, "bar"): 26 | pass @@ -168,8 +176,9 @@ error[B009]: B009_B010.py:27:1: [*] Do not call `getattr` with a constant attrib 29 29 | getattr(1.0, "real") 30 30 | getattr(1j, "real") -error[B009]: B009_B010.py:28:1: [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. +error[B009]: 28:1: [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. + --> B009_B010.py:27:19 | 26 | pass 27 | getattr(1, "real") @@ -189,8 +198,9 @@ error[B009]: B009_B010.py:28:1: [*] Do not call `getattr` with a constant attrib 30 30 | getattr(1j, "real") 31 31 | getattr(True, "real") -error[B009]: B009_B010.py:29:1: [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. +error[B009]: 29:1: [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. + --> B009_B010.py:28:20 | 27 | getattr(1, "real") 28 | getattr(1., "real") @@ -210,8 +220,9 @@ error[B009]: B009_B010.py:29:1: [*] Do not call `getattr` with a constant attrib 31 31 | getattr(True, "real") 32 32 | getattr(x := 1, "real") -error[B009]: B009_B010.py:30:1: [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. +error[B009]: 30:1: [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. + --> B009_B010.py:29:21 | 28 | getattr(1., "real") 29 | getattr(1.0, "real") @@ -231,8 +242,9 @@ error[B009]: B009_B010.py:30:1: [*] Do not call `getattr` with a constant attrib 32 32 | getattr(x := 1, "real") 33 33 | getattr(x + y, "real") -error[B009]: B009_B010.py:31:1: [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. +error[B009]: 31:1: [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. + --> B009_B010.py:30:20 | 29 | getattr(1.0, "real") 30 | getattr(1j, "real") @@ -252,8 +264,9 @@ error[B009]: B009_B010.py:31:1: [*] Do not call `getattr` with a constant attrib 33 33 | getattr(x + y, "real") 34 34 | getattr("foo" -error[B009]: B009_B010.py:32:1: [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. +error[B009]: 32:1: [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. + --> B009_B010.py:31:22 | 30 | getattr(1j, "real") 31 | getattr(True, "real") @@ -273,8 +286,9 @@ error[B009]: B009_B010.py:32:1: [*] Do not call `getattr` with a constant attrib 34 34 | getattr("foo" 35 35 | "bar", "real") -error[B009]: B009_B010.py:33:1: [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. +error[B009]: 33:1: [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. + --> B009_B010.py:32:24 | 31 | getattr(True, "real") 32 | getattr(x := 1, "real") @@ -294,8 +308,9 @@ error[B009]: B009_B010.py:33:1: [*] Do not call `getattr` with a constant attrib 35 35 | "bar", "real") 36 36 | -error[B009]: B009_B010.py:34:1: [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. +error[B009]: 34:1: [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. + --> B009_B010.py:33:23 | 32 | getattr(x := 1, "real") 33 | getattr(x + y, "real") @@ -316,8 +331,9 @@ error[B009]: B009_B010.py:34:1: [*] Do not call `getattr` with a constant attrib 37 37 | 38 38 | # Valid setattr usage -error[B009]: B009_B010.py:58:8: [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. +error[B009]: 58:8: [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. + --> B009_B010.py:58:8 | 57 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1722458885 58 | assert getattr(func, '_rpc')is True @@ -336,8 +352,9 @@ error[B009]: B009_B010.py:58:8: [*] Do not call `getattr` with a constant attrib 60 60 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1732387247 61 61 | getattr(*foo, "bar") -error[B009]: B009_B010.py:65:1: [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. +error[B009]: 65:1: [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. + --> B009_B010.py:64:93 | 64 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1739800901 65 | / getattr(self. @@ -359,8 +376,9 @@ error[B009]: B009_B010.py:65:1: [*] Do not call `getattr` with a constant attrib 68 68 | import builtins 69 69 | builtins.getattr(foo, "bar") -error[B009]: B009_B010.py:69:1: [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. +error[B009]: 69:1: [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. + --> B009_B010.py:68:16 | 68 | import builtins 69 | builtins.getattr(foo, "bar") diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B010_B009_B010.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B010_B009_B010.py.snap index 8cb399bcc2..23a481a393 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B010_B009_B010.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B010_B009_B010.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs --- -error[B010]: B009_B010.py:50:1: [*] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access. +error[B010]: 50:1: [*] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access. + --> B009_B010.py:49:16 | 49 | # Invalid usage 50 | setattr(foo, "bar", None) @@ -21,8 +22,9 @@ error[B010]: B009_B010.py:50:1: [*] Do not call `setattr` with a constant attrib 52 52 | setattr(foo, "__123abc__", None) 53 53 | setattr(foo, "abc123", None) -error[B010]: B009_B010.py:51:1: [*] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access. +error[B010]: 51:1: [*] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access. + --> B009_B010.py:50:26 | 49 | # Invalid usage 50 | setattr(foo, "bar", None) @@ -42,8 +44,9 @@ error[B010]: B009_B010.py:51:1: [*] Do not call `setattr` with a constant attrib 53 53 | setattr(foo, "abc123", None) 54 54 | setattr(foo, r"abc123", None) -error[B010]: B009_B010.py:52:1: [*] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access. +error[B010]: 52:1: [*] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access. + --> B009_B010.py:51:30 | 50 | setattr(foo, "bar", None) 51 | setattr(foo, "_123abc", None) @@ -63,8 +66,9 @@ error[B010]: B009_B010.py:52:1: [*] Do not call `setattr` with a constant attrib 54 54 | setattr(foo, r"abc123", None) 55 55 | setattr(foo.bar, r"baz", None) -error[B010]: B009_B010.py:53:1: [*] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access. +error[B010]: 53:1: [*] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access. + --> B009_B010.py:52:33 | 51 | setattr(foo, "_123abc", None) 52 | setattr(foo, "__123abc__", None) @@ -84,8 +88,9 @@ error[B010]: B009_B010.py:53:1: [*] Do not call `setattr` with a constant attrib 55 55 | setattr(foo.bar, r"baz", None) 56 56 | -error[B010]: B009_B010.py:54:1: [*] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access. +error[B010]: 54:1: [*] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access. + --> B009_B010.py:53:29 | 52 | setattr(foo, "__123abc__", None) 53 | setattr(foo, "abc123", None) @@ -104,8 +109,9 @@ error[B010]: B009_B010.py:54:1: [*] Do not call `setattr` with a constant attrib 56 56 | 57 57 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1722458885 -error[B010]: B009_B010.py:55:1: [*] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access. +error[B010]: 55:1: [*] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access. + --> B009_B010.py:54:30 | 53 | setattr(foo, "abc123", None) 54 | setattr(foo, r"abc123", None) diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B011_B011.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B011_B011.py.snap index 40a759f7e7..1b03ea2c61 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B011_B011.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B011_B011.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs --- -error[B011]: B011.py:8:8: [*] Do not `assert False` (`python -O` removes these calls), raise `AssertionError()` +error[B011]: 8:8: [*] Do not `assert False` (`python -O` removes these calls), raise `AssertionError()` + --> B011.py:8:8 | 7 | assert 1 != 2 8 | assert False @@ -20,8 +21,9 @@ error[B011]: B011.py:8:8: [*] Do not `assert False` (`python -O` removes these c 9 9 | assert 1 != 2, "message" 10 10 | assert False, "message" -error[B011]: B011.py:10:8: [*] Do not `assert False` (`python -O` removes these calls), raise `AssertionError()` +error[B011]: 10:8: [*] Do not `assert False` (`python -O` removes these calls), raise `AssertionError()` + --> B011.py:10:8 | 8 | assert False 9 | assert 1 != 2, "message" diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B012_B012.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B012_B012.py.snap index 82a601aa2d..50c001e4db 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B012_B012.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B012_B012.py.snap @@ -1,24 +1,27 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs --- -error[B012]: B012.py:5:9: `return` inside `finally` blocks cause exceptions to be silenced +error[B012]: 5:9: `return` inside `finally` blocks cause exceptions to be silenced + --> B012.py:5:9 | 3 | pass 4 | finally: 5 | return # warning | ^^^^^^ | -error[B012]: B012.py:13:13: `return` inside `finally` blocks cause exceptions to be silenced +error[B012]: 13:13: `return` inside `finally` blocks cause exceptions to be silenced + --> B012.py:13:13 | 11 | finally: 12 | if 1 + 0 == 2 - 1: 13 | return # warning | ^^^^^^ | -error[B012]: B012.py:21:13: `return` inside `finally` blocks cause exceptions to be silenced +error[B012]: 21:13: `return` inside `finally` blocks cause exceptions to be silenced + --> B012.py:21:13 | 19 | finally: 20 | try: @@ -27,8 +30,9 @@ error[B012]: B012.py:21:13: `return` inside `finally` blocks cause exceptions to 22 | except Exception: 23 | pass | -error[B012]: B012.py:31:13: `return` inside `finally` blocks cause exceptions to be silenced +error[B012]: 31:13: `return` inside `finally` blocks cause exceptions to be silenced + --> B012.py:31:13 | 29 | pass 30 | finally: @@ -37,8 +41,9 @@ error[B012]: B012.py:31:13: `return` inside `finally` blocks cause exceptions to 32 | finally: 33 | pass | -error[B012]: B012.py:44:21: `return` inside `finally` blocks cause exceptions to be silenced +error[B012]: 44:21: `return` inside `finally` blocks cause exceptions to be silenced + --> B012.py:44:21 | 42 | pass 43 | finally: @@ -47,8 +52,9 @@ error[B012]: B012.py:44:21: `return` inside `finally` blocks cause exceptions to 45 | 46 | finally: | -error[B012]: B012.py:66:13: `break` inside `finally` blocks cause exceptions to be silenced +error[B012]: 66:13: `break` inside `finally` blocks cause exceptions to be silenced + --> B012.py:66:13 | 64 | pass 65 | finally: @@ -57,8 +63,9 @@ error[B012]: B012.py:66:13: `break` inside `finally` blocks cause exceptions to 67 | 68 | def j(): | -error[B012]: B012.py:78:13: `continue` inside `finally` blocks cause exceptions to be silenced +error[B012]: 78:13: `continue` inside `finally` blocks cause exceptions to be silenced + --> B012.py:78:13 | 76 | pass 77 | finally: @@ -67,16 +74,18 @@ error[B012]: B012.py:78:13: `continue` inside `finally` blocks cause exceptions 79 | 80 | def j(): | -error[B012]: B012.py:94:13: `return` inside `finally` blocks cause exceptions to be silenced +error[B012]: 94:13: `return` inside `finally` blocks cause exceptions to be silenced + --> B012.py:94:13 | 92 | continue # no warning 93 | while True: 94 | return # warning | ^^^^^^ | -error[B012]: B012.py:101:9: `continue` inside `finally` blocks cause exceptions to be silenced +error[B012]: 101:9: `continue` inside `finally` blocks cause exceptions to be silenced + --> B012.py:101:9 | 99 | pass 100 | finally: @@ -85,16 +94,18 @@ error[B012]: B012.py:101:9: `continue` inside `finally` blocks cause exceptions 102 | 103 | while True: | -error[B012]: B012.py:107:9: `break` inside `finally` blocks cause exceptions to be silenced +error[B012]: 107:9: `break` inside `finally` blocks cause exceptions to be silenced + --> B012.py:107:9 | 105 | pass 106 | finally: 107 | break # warning | ^^^^^ | -error[B012]: B012.py:118:17: `break` inside `finally` blocks cause exceptions to be silenced +error[B012]: 118:17: `break` inside `finally` blocks cause exceptions to be silenced + --> B012.py:118:17 | 116 | y = 0 117 | case 0, *x: diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B013_B013.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B013_B013.py.snap index 658dfd3c7a..fd474a6f73 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B013_B013.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B013_B013.py.snap @@ -1,17 +1,18 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs --- -B013.py:5:8: B013 [*] A length-one tuple literal is redundant in exception handlers +error[B013]: 5:8: [*] A length-one tuple literal is redundant in exception handlers + + --> B013.py:5:8 | 3 | try: 4 | pass 5 | except (ValueError,): - | ^^^^^^^^^^^^^ B013 + | ^^^^^^^^^^^^^ 6 | pass 7 | except AttributeError: | = help: Replace with `except ValueError` - ℹ Safe fix 2 2 | 3 3 | try: @@ -22,16 +23,17 @@ B013.py:5:8: B013 [*] A length-one tuple literal is redundant in exception handl 7 7 | except AttributeError: 8 8 | pass -B013.py:13:7: B013 [*] A length-one tuple literal is redundant in exception handlers +error[B013]: 13:7: [*] A length-one tuple literal is redundant in exception handlers + + --> B013.py:13:7 | 11 | except (*retriable_exceptions,): 12 | pass 13 | except(ValueError,): - | ^^^^^^^^^^^^^ B013 + | ^^^^^^^^^^^^^ 14 | pass | = help: Replace with `except ValueError` - ℹ Safe fix 10 10 | pass 11 11 | except (*retriable_exceptions,): diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B014_B014.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B014_B014.py.snap index bda08ad845..642f3ac6ff 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B014_B014.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B014_B014.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs --- -error[B014]: B014.py:17:8: [*] Exception handler with duplicate exception: `OSError` +error[B014]: 17:8: [*] Exception handler with duplicate exception: `OSError` + --> B014.py:17:8 | 15 | try: 16 | pass @@ -22,8 +23,9 @@ error[B014]: B014.py:17:8: [*] Exception handler with duplicate exception: `OSEr 19 19 | pass 20 20 | -error[B014]: B014.py:28:8: [*] Exception handler with duplicate exception: `MyError` +error[B014]: 28:8: [*] Exception handler with duplicate exception: `MyError` + --> B014.py:28:8 | 26 | try: 27 | pass @@ -43,8 +45,9 @@ error[B014]: B014.py:28:8: [*] Exception handler with duplicate exception: `MyEr 30 30 | pass 31 31 | -error[B014]: B014.py:49:8: [*] Exception handler with duplicate exception: `re.error` +error[B014]: 49:8: [*] Exception handler with duplicate exception: `re.error` + --> B014.py:49:8 | 47 | try: 48 | pass @@ -64,8 +67,9 @@ error[B014]: B014.py:49:8: [*] Exception handler with duplicate exception: `re.e 51 51 | pass 52 52 | -error[B014]: B014.py:82:8: [*] Exception handler with duplicate exception: `ValueError` +error[B014]: 82:8: [*] Exception handler with duplicate exception: `ValueError` + --> B014.py:82:8 | 80 | try: 81 | pass @@ -84,8 +88,9 @@ error[B014]: B014.py:82:8: [*] Exception handler with duplicate exception: `Valu 84 84 | 85 85 | -error[B014]: B014.py:89:7: [*] Exception handler with duplicate exception: `re.error` +error[B014]: 89:7: [*] Exception handler with duplicate exception: `re.error` + --> B014.py:89:7 | 87 | try: 88 | pas diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B015_B015.ipynb.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B015_B015.ipynb.snap index 9df71f4188..dae815982f 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B015_B015.ipynb.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B015_B015.ipynb.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs --- -error[B015]: B015.ipynb:5:1: Pointless comparison. Did you mean to assign a value? Otherwise, prepend `assert` or remove it. +error[B015]: 5:1: Pointless comparison. Did you mean to assign a value? Otherwise, prepend `assert` or remove it. + --> B015.ipynb:4:32 | 3 | x == 1 4 | # Only skip the last expression @@ -11,8 +12,9 @@ error[B015]: B015.ipynb:5:1: Pointless comparison. Did you mean to assign a valu 6 | x == 1 7 | # Nested expressions isn't relevant | -error[B015]: B015.ipynb:9:5: Pointless comparison. Did you mean to assign a value? Otherwise, prepend `assert` or remove it. +error[B015]: 9:5: Pointless comparison. Did you mean to assign a value? Otherwise, prepend `assert` or remove it. + --> B015.ipynb:9:5 | 7 | # Nested expressions isn't relevant 8 | if True: @@ -21,8 +23,9 @@ error[B015]: B015.ipynb:9:5: Pointless comparison. Did you mean to assign a valu 10 | # Semicolons shouldn't affect the output 11 | x == 1; | -error[B015]: B015.ipynb:13:1: Pointless comparison. Did you mean to assign a value? Otherwise, prepend `assert` or remove it. +error[B015]: 13:1: Pointless comparison. Did you mean to assign a value? Otherwise, prepend `assert` or remove it. + --> B015.ipynb:12:39 | 11 | x == 1; 12 | # Semicolons with multiple expressions diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B015_B015.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B015_B015.py.snap index 73529071e6..4d3874efb7 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B015_B015.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B015_B015.py.snap @@ -1,44 +1,49 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs -assertion_line: 74 --- -B015.py:3:1: B015 Pointless comparison. Did you mean to assign a value? Otherwise, prepend `assert` or remove it. +error[B015]: 3:1: Pointless comparison. Did you mean to assign a value? Otherwise, prepend `assert` or remove it. + + --> B015.py:2:1 | 1 | assert 1 == 1 2 | 3 | 1 == 1 - | ^^^^^^ B015 + | ^^^^^^ 4 | 5 | assert 1 in (1, 2) | +error[B015]: 7:1: Pointless comparison. Did you mean to assign a value? Otherwise, prepend `assert` or remove it. -B015.py:7:1: B015 Pointless comparison. Did you mean to assign a value? Otherwise, prepend `assert` or remove it. + --> B015.py:6:1 | 5 | assert 1 in (1, 2) 6 | 7 | 1 in (1, 2) - | ^^^^^^^^^^^ B015 + | ^^^^^^^^^^^ | +error[B015]: 17:5: Pointless comparison at end of function scope. Did you mean to return the expression result? -B015.py:17:5: B015 Pointless comparison at end of function scope. Did you mean to return the expression result? + --> B015.py:17:5 | 15 | assert 1 in (1, 2) 16 | 17 | 1 in (1, 2) - | ^^^^^^^^^^^ B015 + | ^^^^^^^^^^^ | +error[B015]: 21:5: Pointless comparison. Did you mean to assign a value? Otherwise, prepend `assert` or remove it. -B015.py:21:5: B015 Pointless comparison. Did you mean to assign a value? Otherwise, prepend `assert` or remove it. + --> B015.py:21:5 | 20 | def test2(): 21 | 1 in (1, 2) - | ^^^^^^^^^^^ B015 + | ^^^^^^^^^^^ 22 | return | +error[B015]: 29:5: Pointless comparison. Did you mean to assign a value? Otherwise, prepend `assert` or remove it. -B015.py:29:5: B015 Pointless comparison. Did you mean to assign a value? Otherwise, prepend `assert` or remove it. + --> B015.py:29:5 | 28 | class TestClass: 29 | 1 == 1 - | ^^^^^^ B015 + | ^^^^^^ | diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B016_B016.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B016_B016.py.snap index 84956dff36..1942324615 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B016_B016.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B016_B016.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs --- -error[B016]: B016.py:6:7: Cannot raise a literal. Did you intend to return it or raise an Exception? +error[B016]: 6:7: Cannot raise a literal. Did you intend to return it or raise an Exception? + --> B016.py:6:7 | 4 | """ 5 | @@ -11,8 +12,9 @@ error[B016]: B016.py:6:7: Cannot raise a literal. Did you intend to return it or 7 | raise 1 8 | raise "string" | -error[B016]: B016.py:7:7: Cannot raise a literal. Did you intend to return it or raise an Exception? +error[B016]: 7:7: Cannot raise a literal. Did you intend to return it or raise an Exception? + --> B016.py:7:7 | 6 | raise False 7 | raise 1 @@ -20,8 +22,9 @@ error[B016]: B016.py:7:7: Cannot raise a literal. Did you intend to return it or 8 | raise "string" 9 | raise Exception(False) | -error[B016]: B016.py:8:7: Cannot raise a literal. Did you intend to return it or raise an Exception? +error[B016]: 8:7: Cannot raise a literal. Did you intend to return it or raise an Exception? + --> B016.py:8:7 | 6 | raise False 7 | raise 1 diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B017_B017.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B017_B017.py.snap index 49bae19ed3..6e7182b1a7 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B017_B017.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B017_B017.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs --- -error[B017]: B017.py:23:14: `assertRaises(Exception)` should be considered evil +error[B017]: 23:14: `assertRaises(Exception)` should be considered evil + --> B017.py:23:14 | 21 | class Foobar(unittest.TestCase): 22 | def evil_raises(self) -> None: @@ -10,24 +11,27 @@ error[B017]: B017.py:23:14: `assertRaises(Exception)` should be considered evil | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 24 | raise Exception("Evil I say!") | -error[B017]: B017.py:27:14: `assertRaises(BaseException)` should be considered evil +error[B017]: 27:14: `assertRaises(BaseException)` should be considered evil + --> B017.py:27:14 | 26 | def also_evil_raises(self) -> None: 27 | with self.assertRaises(BaseException): | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 28 | raise Exception("Evil I say!") | -error[B017]: B017.py:45:10: `pytest.raises(Exception)` should be considered evil +error[B017]: 45:10: `pytest.raises(Exception)` should be considered evil + --> B017.py:45:10 | 44 | def test_pytest_raises(): 45 | with pytest.raises(Exception): | ^^^^^^^^^^^^^^^^^^^^^^^^ 46 | raise ValueError("Hello") | -error[B017]: B017.py:48:10: `pytest.raises(Exception)` should be considered evil +error[B017]: 48:10: `pytest.raises(Exception)` should be considered evil + --> B017.py:48:10 | 46 | raise ValueError("Hello") 47 | diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B018_B018.ipynb.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B018_B018.ipynb.snap index 55bbbec398..96c0e446e5 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B018_B018.ipynb.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B018_B018.ipynb.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs --- -error[B018]: B018.ipynb:5:1: Found useless expression. Either assign it to a variable or remove it. +error[B018]: 5:1: Found useless expression. Either assign it to a variable or remove it. + --> B018.ipynb:4:32 | 3 | x 4 | # Only skip the last expression @@ -11,8 +12,9 @@ error[B018]: B018.ipynb:5:1: Found useless expression. Either assign it to a var 6 | x 7 | # Nested expressions isn't relevant | -error[B018]: B018.ipynb:9:5: Found useless expression. Either assign it to a variable or remove it. +error[B018]: 9:5: Found useless expression. Either assign it to a variable or remove it. + --> B018.ipynb:9:5 | 7 | # Nested expressions isn't relevant 8 | if True: @@ -21,8 +23,9 @@ error[B018]: B018.ipynb:9:5: Found useless expression. Either assign it to a var 10 | # Semicolons shouldn't affect the output 11 | x; | -error[B018]: B018.ipynb:13:1: Found useless expression. Either assign it to a variable or remove it. +error[B018]: 13:1: Found useless expression. Either assign it to a variable or remove it. + --> B018.ipynb:12:39 | 11 | x; 12 | # Semicolons with multiple expressions diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B018_B018.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B018_B018.py.snap index 0b0e91ba0e..244010ef26 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B018_B018.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B018_B018.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs --- -error[B018]: B018.py:11:5: Found useless expression. Either assign it to a variable or remove it. +error[B018]: 11:5: Found useless expression. Either assign it to a variable or remove it. + --> B018.py:11:5 | 9 | "str" # Str (no raise) 10 | f"{int}" # JoinedStr (no raise) @@ -11,8 +12,9 @@ error[B018]: B018.py:11:5: Found useless expression. Either assign it to a varia 12 | 1 # Number (int) 13 | 1.0 # Number (float) | -error[B018]: B018.py:12:5: Found useless expression. Either assign it to a variable or remove it. +error[B018]: 12:5: Found useless expression. Either assign it to a variable or remove it. + --> B018.py:12:5 | 10 | f"{int}" # JoinedStr (no raise) 11 | 1j # Number (complex) @@ -21,8 +23,9 @@ error[B018]: B018.py:12:5: Found useless expression. Either assign it to a varia 13 | 1.0 # Number (float) 14 | b"foo" # Binary | -error[B018]: B018.py:13:5: Found useless expression. Either assign it to a variable or remove it. +error[B018]: 13:5: Found useless expression. Either assign it to a variable or remove it. + --> B018.py:13:5 | 11 | 1j # Number (complex) 12 | 1 # Number (int) @@ -31,8 +34,9 @@ error[B018]: B018.py:13:5: Found useless expression. Either assign it to a varia 14 | b"foo" # Binary 15 | True # NameConstant (True) | -error[B018]: B018.py:14:5: Found useless expression. Either assign it to a variable or remove it. +error[B018]: 14:5: Found useless expression. Either assign it to a variable or remove it. + --> B018.py:14:5 | 12 | 1 # Number (int) 13 | 1.0 # Number (float) @@ -41,8 +45,9 @@ error[B018]: B018.py:14:5: Found useless expression. Either assign it to a varia 15 | True # NameConstant (True) 16 | False # NameConstant (False) | -error[B018]: B018.py:15:5: Found useless expression. Either assign it to a variable or remove it. +error[B018]: 15:5: Found useless expression. Either assign it to a variable or remove it. + --> B018.py:15:5 | 13 | 1.0 # Number (float) 14 | b"foo" # Binary @@ -51,8 +56,9 @@ error[B018]: B018.py:15:5: Found useless expression. Either assign it to a varia 16 | False # NameConstant (False) 17 | None # NameConstant (None) | -error[B018]: B018.py:16:5: Found useless expression. Either assign it to a variable or remove it. +error[B018]: 16:5: Found useless expression. Either assign it to a variable or remove it. + --> B018.py:16:5 | 14 | b"foo" # Binary 15 | True # NameConstant (True) @@ -61,8 +67,9 @@ error[B018]: B018.py:16:5: Found useless expression. Either assign it to a varia 17 | None # NameConstant (None) 18 | [1, 2] # list | -error[B018]: B018.py:17:5: Found useless expression. Either assign it to a variable or remove it. +error[B018]: 17:5: Found useless expression. Either assign it to a variable or remove it. + --> B018.py:17:5 | 15 | True # NameConstant (True) 16 | False # NameConstant (False) @@ -71,8 +78,9 @@ error[B018]: B018.py:17:5: Found useless expression. Either assign it to a varia 18 | [1, 2] # list 19 | {1, 2} # set | -error[B018]: B018.py:18:5: Found useless expression. Either assign it to a variable or remove it. +error[B018]: 18:5: Found useless expression. Either assign it to a variable or remove it. + --> B018.py:18:5 | 16 | False # NameConstant (False) 17 | None # NameConstant (None) @@ -81,8 +89,9 @@ error[B018]: B018.py:18:5: Found useless expression. Either assign it to a varia 19 | {1, 2} # set 20 | {"foo": "bar"} # dict | -error[B018]: B018.py:19:5: Found useless expression. Either assign it to a variable or remove it. +error[B018]: 19:5: Found useless expression. Either assign it to a variable or remove it. + --> B018.py:19:5 | 17 | None # NameConstant (None) 18 | [1, 2] # list @@ -90,16 +99,18 @@ error[B018]: B018.py:19:5: Found useless expression. Either assign it to a varia | ^^^^^^ 20 | {"foo": "bar"} # dict | -error[B018]: B018.py:20:5: Found useless expression. Either assign it to a variable or remove it. +error[B018]: 20:5: Found useless expression. Either assign it to a variable or remove it. + --> B018.py:20:5 | 18 | [1, 2] # list 19 | {1, 2} # set 20 | {"foo": "bar"} # dict | ^^^^^^^^^^^^^^ | -error[B018]: B018.py:24:5: Found useless expression. Either assign it to a variable or remove it. +error[B018]: 24:5: Found useless expression. Either assign it to a variable or remove it. + --> B018.py:24:5 | 23 | class Foo3: 24 | 123 @@ -107,16 +118,18 @@ error[B018]: B018.py:24:5: Found useless expression. Either assign it to a varia 25 | a = 2 26 | "str" | -error[B018]: B018.py:27:5: Found useless expression. Either assign it to a variable or remove it. +error[B018]: 27:5: Found useless expression. Either assign it to a variable or remove it. + --> B018.py:27:5 | 25 | a = 2 26 | "str" 27 | 1 | ^ | -error[B018]: B018.py:39:5: Found useless expression. Either assign it to a variable or remove it. +error[B018]: 39:5: Found useless expression. Either assign it to a variable or remove it. + --> B018.py:39:5 | 37 | "str" # Str (no raise) 38 | f"{int}" # JoinedStr (no raise) @@ -125,8 +138,9 @@ error[B018]: B018.py:39:5: Found useless expression. Either assign it to a varia 40 | 1 # Number (int) 41 | 1.0 # Number (float) | -error[B018]: B018.py:40:5: Found useless expression. Either assign it to a variable or remove it. +error[B018]: 40:5: Found useless expression. Either assign it to a variable or remove it. + --> B018.py:40:5 | 38 | f"{int}" # JoinedStr (no raise) 39 | 1j # Number (complex) @@ -135,8 +149,9 @@ error[B018]: B018.py:40:5: Found useless expression. Either assign it to a varia 41 | 1.0 # Number (float) 42 | b"foo" # Binary | -error[B018]: B018.py:41:5: Found useless expression. Either assign it to a variable or remove it. +error[B018]: 41:5: Found useless expression. Either assign it to a variable or remove it. + --> B018.py:41:5 | 39 | 1j # Number (complex) 40 | 1 # Number (int) @@ -145,8 +160,9 @@ error[B018]: B018.py:41:5: Found useless expression. Either assign it to a varia 42 | b"foo" # Binary 43 | True # NameConstant (True) | -error[B018]: B018.py:42:5: Found useless expression. Either assign it to a variable or remove it. +error[B018]: 42:5: Found useless expression. Either assign it to a variable or remove it. + --> B018.py:42:5 | 40 | 1 # Number (int) 41 | 1.0 # Number (float) @@ -155,8 +171,9 @@ error[B018]: B018.py:42:5: Found useless expression. Either assign it to a varia 43 | True # NameConstant (True) 44 | False # NameConstant (False) | -error[B018]: B018.py:43:5: Found useless expression. Either assign it to a variable or remove it. +error[B018]: 43:5: Found useless expression. Either assign it to a variable or remove it. + --> B018.py:43:5 | 41 | 1.0 # Number (float) 42 | b"foo" # Binary @@ -165,8 +182,9 @@ error[B018]: B018.py:43:5: Found useless expression. Either assign it to a varia 44 | False # NameConstant (False) 45 | None # NameConstant (None) | -error[B018]: B018.py:44:5: Found useless expression. Either assign it to a variable or remove it. +error[B018]: 44:5: Found useless expression. Either assign it to a variable or remove it. + --> B018.py:44:5 | 42 | b"foo" # Binary 43 | True # NameConstant (True) @@ -175,8 +193,9 @@ error[B018]: B018.py:44:5: Found useless expression. Either assign it to a varia 45 | None # NameConstant (None) 46 | [1, 2] # list | -error[B018]: B018.py:45:5: Found useless expression. Either assign it to a variable or remove it. +error[B018]: 45:5: Found useless expression. Either assign it to a variable or remove it. + --> B018.py:45:5 | 43 | True # NameConstant (True) 44 | False # NameConstant (False) @@ -185,8 +204,9 @@ error[B018]: B018.py:45:5: Found useless expression. Either assign it to a varia 46 | [1, 2] # list 47 | {1, 2} # set | -error[B018]: B018.py:46:5: Found useless expression. Either assign it to a variable or remove it. +error[B018]: 46:5: Found useless expression. Either assign it to a variable or remove it. + --> B018.py:46:5 | 44 | False # NameConstant (False) 45 | None # NameConstant (None) @@ -195,8 +215,9 @@ error[B018]: B018.py:46:5: Found useless expression. Either assign it to a varia 47 | {1, 2} # set 48 | {"foo": "bar"} # dict | -error[B018]: B018.py:47:5: Found useless expression. Either assign it to a variable or remove it. +error[B018]: 47:5: Found useless expression. Either assign it to a variable or remove it. + --> B018.py:47:5 | 45 | None # NameConstant (None) 46 | [1, 2] # list @@ -204,16 +225,18 @@ error[B018]: B018.py:47:5: Found useless expression. Either assign it to a varia | ^^^^^^ 48 | {"foo": "bar"} # dict | -error[B018]: B018.py:48:5: Found useless expression. Either assign it to a variable or remove it. +error[B018]: 48:5: Found useless expression. Either assign it to a variable or remove it. + --> B018.py:48:5 | 46 | [1, 2] # list 47 | {1, 2} # set 48 | {"foo": "bar"} # dict | ^^^^^^^^^^^^^^ | -error[B018]: B018.py:52:5: Found useless expression. Either assign it to a variable or remove it. +error[B018]: 52:5: Found useless expression. Either assign it to a variable or remove it. + --> B018.py:52:5 | 51 | def foo3(): 52 | 123 @@ -221,16 +244,18 @@ error[B018]: B018.py:52:5: Found useless expression. Either assign it to a varia 53 | a = 2 54 | "str" | -error[B018]: B018.py:55:5: Found useless expression. Either assign it to a variable or remove it. +error[B018]: 55:5: Found useless expression. Either assign it to a variable or remove it. + --> B018.py:55:5 | 53 | a = 2 54 | "str" 55 | 3 | ^ | -error[B018]: B018.py:63:5: Found useless expression. Either assign it to a variable or remove it. +error[B018]: 63:5: Found useless expression. Either assign it to a variable or remove it. + --> B018.py:63:5 | 62 | def foo5(): 63 | foo.bar # Attribute (raise) @@ -238,8 +263,9 @@ error[B018]: B018.py:63:5: Found useless expression. Either assign it to a varia 64 | object().__class__ # Attribute (raise) 65 | "foo" + "bar" # BinOp (raise) | -error[B018]: B018.py:64:5: Found useless attribute access. Either assign it to a variable or remove it. +error[B018]: 64:5: Found useless attribute access. Either assign it to a variable or remove it. + --> B018.py:64:5 | 62 | def foo5(): 63 | foo.bar # Attribute (raise) @@ -247,8 +273,9 @@ error[B018]: B018.py:64:5: Found useless attribute access. Either assign it to a | ^^^^^^^^^^^^^^^^^^ 65 | "foo" + "bar" # BinOp (raise) | -error[B018]: B018.py:65:5: Found useless expression. Either assign it to a variable or remove it. +error[B018]: 65:5: Found useless expression. Either assign it to a variable or remove it. + --> B018.py:65:5 | 63 | foo.bar # Attribute (raise) 64 | object().__class__ # Attribute (raise) diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B019_B019.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B019_B019.py.snap index 907178352a..25e5b81974 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B019_B019.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B019_B019.py.snap @@ -1,90 +1,100 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs --- -B019.py:78:5: B019 Use of `functools.lru_cache` or `functools.cache` on methods can lead to memory leaks +error[B019]: 78:5: Use of `functools.lru_cache` or `functools.cache` on methods can lead to memory leaks + + --> B019.py:78:5 | 77 | # Remaining methods should emit B019 78 | @functools.cache - | ^^^^^^^^^^^^^^^^ B019 + | ^^^^^^^^^^^^^^^^ 79 | def cached_instance_method(self, y): 80 | ... | +error[B019]: 82:5: Use of `functools.lru_cache` or `functools.cache` on methods can lead to memory leaks -B019.py:82:5: B019 Use of `functools.lru_cache` or `functools.cache` on methods can lead to memory leaks + --> B019.py:82:5 | 80 | ... 81 | 82 | @cache - | ^^^^^^ B019 + | ^^^^^^ 83 | def another_cached_instance_method(self, y): 84 | ... | +error[B019]: 86:5: Use of `functools.lru_cache` or `functools.cache` on methods can lead to memory leaks -B019.py:86:5: B019 Use of `functools.lru_cache` or `functools.cache` on methods can lead to memory leaks + --> B019.py:86:5 | 84 | ... 85 | 86 | @functools.cache() - | ^^^^^^^^^^^^^^^^^^ B019 + | ^^^^^^^^^^^^^^^^^^ 87 | def called_cached_instance_method(self, y): 88 | ... | +error[B019]: 90:5: Use of `functools.lru_cache` or `functools.cache` on methods can lead to memory leaks -B019.py:90:5: B019 Use of `functools.lru_cache` or `functools.cache` on methods can lead to memory leaks + --> B019.py:90:5 | 88 | ... 89 | 90 | @cache() - | ^^^^^^^^ B019 + | ^^^^^^^^ 91 | def another_called_cached_instance_method(self, y): 92 | ... | +error[B019]: 94:5: Use of `functools.lru_cache` or `functools.cache` on methods can lead to memory leaks -B019.py:94:5: B019 Use of `functools.lru_cache` or `functools.cache` on methods can lead to memory leaks + --> B019.py:94:5 | 92 | ... 93 | 94 | @functools.lru_cache - | ^^^^^^^^^^^^^^^^^^^^ B019 + | ^^^^^^^^^^^^^^^^^^^^ 95 | def lru_cached_instance_method(self, y): 96 | ... | +error[B019]: 98:5: Use of `functools.lru_cache` or `functools.cache` on methods can lead to memory leaks -B019.py:98:5: B019 Use of `functools.lru_cache` or `functools.cache` on methods can lead to memory leaks + --> B019.py:98:5 | 96 | ... 97 | 98 | @lru_cache - | ^^^^^^^^^^ B019 + | ^^^^^^^^^^ 99 | def another_lru_cached_instance_method(self, y): 100 | ... | +error[B019]: 102:5: Use of `functools.lru_cache` or `functools.cache` on methods can lead to memory leaks -B019.py:102:5: B019 Use of `functools.lru_cache` or `functools.cache` on methods can lead to memory leaks + --> B019.py:102:5 | 100 | ... 101 | 102 | @functools.lru_cache() - | ^^^^^^^^^^^^^^^^^^^^^^ B019 + | ^^^^^^^^^^^^^^^^^^^^^^ 103 | def called_lru_cached_instance_method(self, y): 104 | ... | +error[B019]: 106:5: Use of `functools.lru_cache` or `functools.cache` on methods can lead to memory leaks -B019.py:106:5: B019 Use of `functools.lru_cache` or `functools.cache` on methods can lead to memory leaks + --> B019.py:106:5 | 104 | ... 105 | 106 | @lru_cache() - | ^^^^^^^^^^^^ B019 + | ^^^^^^^^^^^^ 107 | def another_called_lru_cached_instance_method(self, y): 108 | ... | +error[B019]: 124:5: Use of `functools.lru_cache` or `functools.cache` on methods can lead to memory leaks -B019.py:124:5: B019 Use of `functools.lru_cache` or `functools.cache` on methods can lead to memory leaks + --> B019.py:124:5 | 123 | class Metaclass(type): 124 | @functools.lru_cache - | ^^^^^^^^^^^^^^^^^^^^ B019 + | ^^^^^^^^^^^^^^^^^^^^ 125 | def lru_cached_instance_method_on_metaclass(cls, x: int): 126 | ... | diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B020_B020.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B020_B020.py.snap index f678521b98..2540b2c7be 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B020_B020.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B020_B020.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs --- -error[B020]: B020.py:8:5: Loop control variable `items` overrides iterable it iterates +error[B020]: 8:5: Loop control variable `items` overrides iterable it iterates + --> B020.py:8:5 | 6 | items = [1, 2, 3] 7 | @@ -10,8 +11,9 @@ error[B020]: B020.py:8:5: Loop control variable `items` overrides iterable it it | ^^^^^ 9 | print(items) | -error[B020]: B020.py:21:10: Loop control variable `values` overrides iterable it iterates +error[B020]: 21:10: Loop control variable `values` overrides iterable it iterates + --> B020.py:21:10 | 19 | print(f"{key}, {value}") 20 | @@ -19,8 +21,9 @@ error[B020]: B020.py:21:10: Loop control variable `values` overrides iterable it | ^^^^^^ 22 | print(f"{key}, {values}") | -error[B020]: B020.py:36:5: Loop control variable `vars` overrides iterable it iterates +error[B020]: 36:5: Loop control variable `vars` overrides iterable it iterates + --> B020.py:36:5 | 35 | # However we still call out reassigning the iterable in the comprehension. 36 | for vars in [i for i in vars]: diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B021_B021.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B021_B021.py.snap index 16208de12c..4b0ca1e73b 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B021_B021.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B021_B021.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs --- -error[B021]: B021.py:1:1: f-string used as docstring. Python will interpret this as a joined string, rather than a docstring. +error[B021]: 1:1: f-string used as docstring. Python will interpret this as a joined string, rather than a docstring. + --> B021.py:1:1 | 1 | / f""" 2 | | Should emit: @@ -12,64 +13,73 @@ error[B021]: B021.py:1:1: f-string used as docstring. Python will interpret this 5 | 6 | VARIABLE = "world" | -error[B021]: B021.py:14:5: f-string used as docstring. Python will interpret this as a joined string, rather than a docstring. +error[B021]: 14:5: f-string used as docstring. Python will interpret this as a joined string, rather than a docstring. + --> B021.py:14:5 | 13 | def foo2(): 14 | f"""hello {VARIABLE}!""" | ^^^^^^^^^^^^^^^^^^^^^^^^ | -error[B021]: B021.py:22:5: f-string used as docstring. Python will interpret this as a joined string, rather than a docstring. +error[B021]: 22:5: f-string used as docstring. Python will interpret this as a joined string, rather than a docstring. + --> B021.py:22:5 | 21 | class bar2: 22 | f"""hello {VARIABLE}!""" | ^^^^^^^^^^^^^^^^^^^^^^^^ | -error[B021]: B021.py:30:5: f-string used as docstring. Python will interpret this as a joined string, rather than a docstring. +error[B021]: 30:5: f-string used as docstring. Python will interpret this as a joined string, rather than a docstring. + --> B021.py:30:5 | 29 | def foo2(): 30 | f"""hello {VARIABLE}!""" | ^^^^^^^^^^^^^^^^^^^^^^^^ | -error[B021]: B021.py:38:5: f-string used as docstring. Python will interpret this as a joined string, rather than a docstring. +error[B021]: 38:5: f-string used as docstring. Python will interpret this as a joined string, rather than a docstring. + --> B021.py:38:5 | 37 | class bar2: 38 | f"""hello {VARIABLE}!""" | ^^^^^^^^^^^^^^^^^^^^^^^^ | -error[B021]: B021.py:46:5: f-string used as docstring. Python will interpret this as a joined string, rather than a docstring. +error[B021]: 46:5: f-string used as docstring. Python will interpret this as a joined string, rather than a docstring. + --> B021.py:46:5 | 45 | def foo2(): 46 | f"hello {VARIABLE}!" | ^^^^^^^^^^^^^^^^^^^^ | -error[B021]: B021.py:54:5: f-string used as docstring. Python will interpret this as a joined string, rather than a docstring. +error[B021]: 54:5: f-string used as docstring. Python will interpret this as a joined string, rather than a docstring. + --> B021.py:54:5 | 53 | class bar2: 54 | f"hello {VARIABLE}!" | ^^^^^^^^^^^^^^^^^^^^ | -error[B021]: B021.py:62:5: f-string used as docstring. Python will interpret this as a joined string, rather than a docstring. +error[B021]: 62:5: f-string used as docstring. Python will interpret this as a joined string, rather than a docstring. + --> B021.py:62:5 | 61 | def foo2(): 62 | f"hello {VARIABLE}!" | ^^^^^^^^^^^^^^^^^^^^ | -error[B021]: B021.py:70:5: f-string used as docstring. Python will interpret this as a joined string, rather than a docstring. +error[B021]: 70:5: f-string used as docstring. Python will interpret this as a joined string, rather than a docstring. + --> B021.py:70:5 | 69 | class bar2: 70 | f"hello {VARIABLE}!" | ^^^^^^^^^^^^^^^^^^^^ | -error[B021]: B021.py:74:5: f-string used as docstring. Python will interpret this as a joined string, rather than a docstring. +error[B021]: 74:5: f-string used as docstring. Python will interpret this as a joined string, rather than a docstring. + --> B021.py:74:5 | 73 | def baz(): 74 | f"""I'm probably a docstring: {VARIABLE}!""" diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B022_B022.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B022_B022.py.snap index eb86e77bdf..c924ac991f 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B022_B022.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B022_B022.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs --- -error[B022]: B022.py:9:6: No arguments passed to `contextlib.suppress`. No exceptions will be suppressed and therefore this context manager is redundant +error[B022]: 9:6: No arguments passed to `contextlib.suppress`. No exceptions will be suppressed and therefore this context manager is redundant + --> B022.py:9:6 | 7 | from contextlib import suppress 8 | @@ -10,8 +11,9 @@ error[B022]: B022.py:9:6: No arguments passed to `contextlib.suppress`. No excep | ^^^^^^^^^^^^^^^^^^^^^ 10 | raise ValueError | -error[B022]: B022.py:12:6: No arguments passed to `contextlib.suppress`. No exceptions will be suppressed and therefore this context manager is redundant +error[B022]: 12:6: No arguments passed to `contextlib.suppress`. No exceptions will be suppressed and therefore this context manager is redundant + --> B022.py:12:6 | 10 | raise ValueError 11 | diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B023_B023.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B023_B023.py.snap index dc19839b18..a6a800fd92 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B023_B023.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B023_B023.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs --- -error[B023]: B023.py:12:30: Function definition does not bind loop variable `x` +error[B023]: 12:30: Function definition does not bind loop variable `x` + --> B023.py:12:30 | 10 | y = x + 1 11 | # Subject to late-binding problems @@ -10,8 +11,9 @@ error[B023]: B023.py:12:30: Function definition does not bind loop variable `x` | ^ 13 | functions.append(lambda: y) # not just the loop var | -error[B023]: B023.py:13:30: Function definition does not bind loop variable `y` +error[B023]: 13:30: Function definition does not bind loop variable `y` + --> B023.py:13:30 | 11 | # Subject to late-binding problems 12 | functions.append(lambda: x) @@ -20,8 +22,9 @@ error[B023]: B023.py:13:30: Function definition does not bind loop variable `y` 14 | 15 | def f_bad_1(): | -error[B023]: B023.py:16:16: Function definition does not bind loop variable `x` +error[B023]: 16:16: Function definition does not bind loop variable `x` + --> B023.py:16:16 | 15 | def f_bad_1(): 16 | return x @@ -29,8 +32,9 @@ error[B023]: B023.py:16:16: Function definition does not bind loop variable `x` 17 | 18 | # Actually OK | -error[B023]: B023.py:28:19: Function definition does not bind loop variable `x` +error[B023]: 28:19: Function definition does not bind loop variable `x` + --> B023.py:28:19 | 27 | def check_inside_functions_too(): 28 | ls = [lambda: x for x in range(2)] # error @@ -38,8 +42,9 @@ error[B023]: B023.py:28:19: Function definition does not bind loop variable `x` 29 | st = {lambda: x for x in range(2)} # error 30 | gn = (lambda: x for x in range(2)) # error | -error[B023]: B023.py:29:19: Function definition does not bind loop variable `x` +error[B023]: 29:19: Function definition does not bind loop variable `x` + --> B023.py:29:19 | 27 | def check_inside_functions_too(): 28 | ls = [lambda: x for x in range(2)] # error @@ -48,8 +53,9 @@ error[B023]: B023.py:29:19: Function definition does not bind loop variable `x` 30 | gn = (lambda: x for x in range(2)) # error 31 | dt = {x: lambda: x for x in range(2)} # error | -error[B023]: B023.py:30:19: Function definition does not bind loop variable `x` +error[B023]: 30:19: Function definition does not bind loop variable `x` + --> B023.py:30:19 | 28 | ls = [lambda: x for x in range(2)] # error 29 | st = {lambda: x for x in range(2)} # error @@ -57,16 +63,18 @@ error[B023]: B023.py:30:19: Function definition does not bind loop variable `x` | ^ 31 | dt = {x: lambda: x for x in range(2)} # error | -error[B023]: B023.py:31:22: Function definition does not bind loop variable `x` +error[B023]: 31:22: Function definition does not bind loop variable `x` + --> B023.py:31:22 | 29 | st = {lambda: x for x in range(2)} # error 30 | gn = (lambda: x for x in range(2)) # error 31 | dt = {x: lambda: x for x in range(2)} # error | ^ | -error[B023]: B023.py:40:34: Function definition does not bind loop variable `x` +error[B023]: 40:34: Function definition does not bind loop variable `x` + --> B023.py:40:34 | 38 | async def container_for_problems(): 39 | async for x in pointless_async_iterable(): @@ -75,16 +83,18 @@ error[B023]: B023.py:40:34: Function definition does not bind loop variable `x` 41 | 42 | [lambda: x async for x in pointless_async_iterable()] # error | -error[B023]: B023.py:42:14: Function definition does not bind loop variable `x` +error[B023]: 42:14: Function definition does not bind loop variable `x` + --> B023.py:42:14 | 40 | functions.append(lambda: x) # error 41 | 42 | [lambda: x async for x in pointless_async_iterable()] # error | ^ | -error[B023]: B023.py:50:30: Function definition does not bind loop variable `a` +error[B023]: 50:30: Function definition does not bind loop variable `a` + --> B023.py:50:30 | 48 | a = a_ = a - 1 49 | b += 1 @@ -93,8 +103,9 @@ error[B023]: B023.py:50:30: Function definition does not bind loop variable `a` 51 | functions.append(lambda: a_) # error 52 | functions.append(lambda: b) # error | -error[B023]: B023.py:51:30: Function definition does not bind loop variable `a_` +error[B023]: 51:30: Function definition does not bind loop variable `a_` + --> B023.py:51:30 | 49 | b += 1 50 | functions.append(lambda: a) # error @@ -103,8 +114,9 @@ error[B023]: B023.py:51:30: Function definition does not bind loop variable `a_` 52 | functions.append(lambda: b) # error 53 | functions.append(lambda: c) # error, but not a name error due to late binding | -error[B023]: B023.py:52:30: Function definition does not bind loop variable `b` +error[B023]: 52:30: Function definition does not bind loop variable `b` + --> B023.py:52:30 | 50 | functions.append(lambda: a) # error 51 | functions.append(lambda: a_) # error @@ -113,8 +125,9 @@ error[B023]: B023.py:52:30: Function definition does not bind loop variable `b` 53 | functions.append(lambda: c) # error, but not a name error due to late binding 54 | c: bool = a > 3 | -error[B023]: B023.py:53:30: Function definition does not bind loop variable `c` +error[B023]: 53:30: Function definition does not bind loop variable `c` + --> B023.py:53:30 | 51 | functions.append(lambda: a_) # error 52 | functions.append(lambda: b) # error @@ -123,24 +136,27 @@ error[B023]: B023.py:53:30: Function definition does not bind loop variable `c` 54 | c: bool = a > 3 55 | if not c: | -error[B023]: B023.py:61:17: Function definition does not bind loop variable `j` +error[B023]: 61:17: Function definition does not bind loop variable `j` + --> B023.py:61:17 | 59 | for j in range(2): 60 | for k in range(3): 61 | lambda: j * k # error | ^ | -error[B023]: B023.py:61:21: Function definition does not bind loop variable `k` +error[B023]: 61:21: Function definition does not bind loop variable `k` + --> B023.py:61:21 | 59 | for j in range(2): 60 | for k in range(3): 61 | lambda: j * k # error | ^ | -error[B023]: B023.py:68:10: Function definition does not bind loop variable `l` +error[B023]: 68:10: Function definition does not bind loop variable `l` + --> B023.py:68:10 | 66 | def f(): 67 | j = None # OK because it's an assignment @@ -149,15 +165,17 @@ error[B023]: B023.py:68:10: Function definition does not bind loop variable `l` 69 | 70 | assert a and functions | -error[B023]: B023.py:82:16: Function definition does not bind loop variable `i` +error[B023]: 82:16: Function definition does not bind loop variable `i` + --> B023.py:82:16 | 81 | for i in range(3): 82 | lambda: f"{i}" | ^ | -error[B023]: B023.py:117:24: Function definition does not bind loop variable `x` +error[B023]: 117:24: Function definition does not bind loop variable `x` + --> B023.py:117:24 | 115 | for x in range(2): 116 | # It's not a complete get-out-of-linting-free construct - these should fail: @@ -166,8 +184,9 @@ error[B023]: B023.py:117:24: Function definition does not bind loop variable `x` 118 | sorted([None, lambda: x], key=repr) 119 | any(filter(bool, [None, lambda: x])) | -error[B023]: B023.py:118:27: Function definition does not bind loop variable `x` +error[B023]: 118:27: Function definition does not bind loop variable `x` + --> B023.py:118:27 | 116 | # It's not a complete get-out-of-linting-free construct - these should fail: 117 | min([None, lambda: x], key=repr) @@ -176,8 +195,9 @@ error[B023]: B023.py:118:27: Function definition does not bind loop variable `x` 119 | any(filter(bool, [None, lambda: x])) 120 | list(filter(bool, [None, lambda: x])) | -error[B023]: B023.py:119:37: Function definition does not bind loop variable `x` +error[B023]: 119:37: Function definition does not bind loop variable `x` + --> B023.py:119:37 | 117 | min([None, lambda: x], key=repr) 118 | sorted([None, lambda: x], key=repr) @@ -186,8 +206,9 @@ error[B023]: B023.py:119:37: Function definition does not bind loop variable `x` 120 | list(filter(bool, [None, lambda: x])) 121 | all(reduce(bool, [None, lambda: x])) | -error[B023]: B023.py:120:38: Function definition does not bind loop variable `x` +error[B023]: 120:38: Function definition does not bind loop variable `x` + --> B023.py:120:38 | 118 | sorted([None, lambda: x], key=repr) 119 | any(filter(bool, [None, lambda: x])) @@ -195,8 +216,9 @@ error[B023]: B023.py:120:38: Function definition does not bind loop variable `x` | ^ 121 | all(reduce(bool, [None, lambda: x])) | -error[B023]: B023.py:121:37: Function definition does not bind loop variable `x` +error[B023]: 121:37: Function definition does not bind loop variable `x` + --> B023.py:121:37 | 119 | any(filter(bool, [None, lambda: x])) 120 | list(filter(bool, [None, lambda: x])) @@ -205,8 +227,9 @@ error[B023]: B023.py:121:37: Function definition does not bind loop variable `x` 122 | 123 | # But all these should be OK: | -error[B023]: B023.py:171:29: Function definition does not bind loop variable `name` +error[B023]: 171:29: Function definition does not bind loop variable `name` + --> B023.py:171:29 | 170 | if foo(name): 171 | return [lambda: name] # known false alarm @@ -214,8 +237,9 @@ error[B023]: B023.py:171:29: Function definition does not bind loop variable `na 172 | 173 | if False: | -error[B023]: B023.py:174:29: Function definition does not bind loop variable `i` +error[B023]: 174:29: Function definition does not bind loop variable `i` + --> B023.py:174:29 | 173 | if False: 174 | return [lambda: i for i in range(3)] # error diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B024_B024.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B024_B024.py.snap index 08367b4a1b..059d7311fb 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B024_B024.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B024_B024.py.snap @@ -1,62 +1,70 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs --- -error[B024]: B024.py:18:7: `Base_1` is an abstract base class, but it has no abstract methods +error[B024]: 18:7: `Base_1` is an abstract base class, but it has no abstract methods + --> B024.py:18:7 | 18 | class Base_1(ABC): # error | ^^^^^^ 19 | def method(self): 20 | foo() | -error[B024]: B024.py:71:7: `MetaBase_1` is an abstract base class, but it has no abstract methods +error[B024]: 71:7: `MetaBase_1` is an abstract base class, but it has no abstract methods + --> B024.py:71:7 | 71 | class MetaBase_1(metaclass=ABCMeta): # error | ^^^^^^^^^^ 72 | def method(self): 73 | foo() | -error[B024]: B024.py:82:7: `abc_Base_1` is an abstract base class, but it has no abstract methods +error[B024]: 82:7: `abc_Base_1` is an abstract base class, but it has no abstract methods + --> B024.py:82:7 | 82 | class abc_Base_1(abc.ABC): # error | ^^^^^^^^^^ 83 | def method(self): 84 | foo() | -error[B024]: B024.py:87:7: `abc_Base_2` is an abstract base class, but it has no abstract methods +error[B024]: 87:7: `abc_Base_2` is an abstract base class, but it has no abstract methods + --> B024.py:87:7 | 87 | class abc_Base_2(metaclass=abc.ABCMeta): # error | ^^^^^^^^^^ 88 | def method(self): 89 | foo() | -error[B024]: B024.py:92:7: `notabc_Base_1` is an abstract base class, but it has no abstract methods +error[B024]: 92:7: `notabc_Base_1` is an abstract base class, but it has no abstract methods + --> B024.py:92:7 | 92 | class notabc_Base_1(notabc.ABC): # error | ^^^^^^^^^^^^^ 93 | def method(self): 94 | foo() | -error[B024]: B024.py:132:7: `abc_set_class_variable_2` is an abstract base class, but it has no abstract methods +error[B024]: 132:7: `abc_set_class_variable_2` is an abstract base class, but it has no abstract methods + --> B024.py:132:7 | 132 | class abc_set_class_variable_2(ABC): # error (not an abstract attribute) | ^^^^^^^^^^^^^^^^^^^^^^^^ 133 | foo = 2 | -error[B024]: B024.py:136:7: `abc_set_class_variable_3` is an abstract base class, but it has no abstract methods +error[B024]: 136:7: `abc_set_class_variable_3` is an abstract base class, but it has no abstract methods + --> B024.py:136:7 | 136 | class abc_set_class_variable_3(ABC): # error (not an abstract attribute) | ^^^^^^^^^^^^^^^^^^^^^^^^ 137 | foo: int = 2 | -error[B024]: B024.py:141:7: `abc_set_class_variable_4` is an abstract base class, but it has no abstract methods +error[B024]: 141:7: `abc_set_class_variable_4` is an abstract base class, but it has no abstract methods + --> B024.py:141:7 | 140 | # this doesn't actually declare a class variable, it's just an expression 141 | class abc_set_class_variable_4(ABC): # error diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B025_B025.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B025_B025.py.snap index a1d53502cc..f37f148a09 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B025_B025.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B025_B025.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs --- -error[B025]: B025.py:19:8: try-except block with duplicate exception `ValueError` +error[B025]: 19:8: try-except block with duplicate exception `ValueError` + --> B025.py:19:8 | 17 | except ValueError: 18 | a = 2 @@ -10,8 +11,9 @@ error[B025]: B025.py:19:8: try-except block with duplicate exception `ValueError | ^^^^^^^^^^ 20 | a = 2 | -error[B025]: B025.py:28:8: try-except block with duplicate exception `pickle.PickleError` +error[B025]: 28:8: try-except block with duplicate exception `pickle.PickleError` + --> B025.py:28:8 | 26 | except ValueError: 27 | a = 2 @@ -19,8 +21,9 @@ error[B025]: B025.py:28:8: try-except block with duplicate exception `pickle.Pic | ^^^^^^^^^^^^^^^^^^ 29 | a = 2 | -error[B025]: B025.py:35:8: try-except block with duplicate exception `ValueError` +error[B025]: 35:8: try-except block with duplicate exception `ValueError` + --> B025.py:35:8 | 33 | except (ValueError, TypeError): 34 | a = 2 @@ -29,8 +32,9 @@ error[B025]: B025.py:35:8: try-except block with duplicate exception `ValueError 36 | a = 2 37 | except (OSError, TypeError): | -error[B025]: B025.py:37:18: try-except block with duplicate exception `TypeError` +error[B025]: 37:18: try-except block with duplicate exception `TypeError` + --> B025.py:37:18 | 35 | except ValueError: 36 | a = 2 diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B026_B026.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B026_B026.py.snap index 3e81268ebe..c0aa8df1f9 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B026_B026.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B026_B026.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs --- -error[B026]: B026.py:16:16: Star-arg unpacking after a keyword argument is strongly discouraged +error[B026]: 16:16: Star-arg unpacking after a keyword argument is strongly discouraged + --> B026.py:16:16 | 14 | foo("bar", baz="baz", bam="bam") 15 | foo(bar="bar", baz="baz", bam="bam") @@ -11,8 +12,9 @@ error[B026]: B026.py:16:16: Star-arg unpacking after a keyword argument is stron 17 | foo(bam="bam", *bar_baz) 18 | foo(baz="baz", bam="bam", *["bar"]) | -error[B026]: B026.py:17:16: Star-arg unpacking after a keyword argument is strongly discouraged +error[B026]: 17:16: Star-arg unpacking after a keyword argument is strongly discouraged + --> B026.py:17:16 | 15 | foo(bar="bar", baz="baz", bam="bam") 16 | foo(bam="bam", *["bar", "baz"]) @@ -21,8 +23,9 @@ error[B026]: B026.py:17:16: Star-arg unpacking after a keyword argument is stron 18 | foo(baz="baz", bam="bam", *["bar"]) 19 | foo(bar="bar", baz="baz", bam="bam", *[]) | -error[B026]: B026.py:18:27: Star-arg unpacking after a keyword argument is strongly discouraged +error[B026]: 18:27: Star-arg unpacking after a keyword argument is strongly discouraged + --> B026.py:18:27 | 16 | foo(bam="bam", *["bar", "baz"]) 17 | foo(bam="bam", *bar_baz) @@ -31,8 +34,9 @@ error[B026]: B026.py:18:27: Star-arg unpacking after a keyword argument is stron 19 | foo(bar="bar", baz="baz", bam="bam", *[]) 20 | foo(bam="bam", *["bar"], *["baz"]) | -error[B026]: B026.py:19:38: Star-arg unpacking after a keyword argument is strongly discouraged +error[B026]: 19:38: Star-arg unpacking after a keyword argument is strongly discouraged + --> B026.py:19:38 | 17 | foo(bam="bam", *bar_baz) 18 | foo(baz="baz", bam="bam", *["bar"]) @@ -41,8 +45,9 @@ error[B026]: B026.py:19:38: Star-arg unpacking after a keyword argument is stron 20 | foo(bam="bam", *["bar"], *["baz"]) 21 | foo(*["bar"], bam="bam", *["baz"]) | -error[B026]: B026.py:20:16: Star-arg unpacking after a keyword argument is strongly discouraged +error[B026]: 20:16: Star-arg unpacking after a keyword argument is strongly discouraged + --> B026.py:20:16 | 18 | foo(baz="baz", bam="bam", *["bar"]) 19 | foo(bar="bar", baz="baz", bam="bam", *[]) @@ -50,8 +55,9 @@ error[B026]: B026.py:20:16: Star-arg unpacking after a keyword argument is stron | ^^^^^^^^ 21 | foo(*["bar"], bam="bam", *["baz"]) | -error[B026]: B026.py:20:26: Star-arg unpacking after a keyword argument is strongly discouraged +error[B026]: 20:26: Star-arg unpacking after a keyword argument is strongly discouraged + --> B026.py:20:26 | 18 | foo(baz="baz", bam="bam", *["bar"]) 19 | foo(bar="bar", baz="baz", bam="bam", *[]) @@ -59,8 +65,9 @@ error[B026]: B026.py:20:26: Star-arg unpacking after a keyword argument is stron | ^^^^^^^^ 21 | foo(*["bar"], bam="bam", *["baz"]) | -error[B026]: B026.py:21:26: Star-arg unpacking after a keyword argument is strongly discouraged +error[B026]: 21:26: Star-arg unpacking after a keyword argument is strongly discouraged + --> B026.py:21:26 | 19 | foo(bar="bar", baz="baz", bam="bam", *[]) 20 | foo(bam="bam", *["bar"], *["baz"]) diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B027_B027.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B027_B027.py.snap index 60d6be842a..340ad50a69 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B027_B027.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B027_B027.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs --- -error[B027]: B027.py:18:5: `AbstractClass.empty_1` is an empty method in an abstract base class, but has no abstract decorator +error[B027]: 18:5: `AbstractClass.empty_1` is an empty method in an abstract base class, but has no abstract decorator + --> B027.py:18:5 | 17 | class AbstractClass(ABC): 18 | def empty_1(self): # error @@ -12,8 +13,9 @@ error[B027]: B027.py:18:5: `AbstractClass.empty_1` is an empty method in an abst 20 | 21 | def empty_2(self): # error | -error[B027]: B027.py:21:5: `AbstractClass.empty_2` is an empty method in an abstract base class, but has no abstract decorator +error[B027]: 21:5: `AbstractClass.empty_2` is an empty method in an abstract base class, but has no abstract decorator + --> B027.py:21:5 | 19 | ... 20 | @@ -24,8 +26,9 @@ error[B027]: B027.py:21:5: `AbstractClass.empty_2` is an empty method in an abst 23 | 24 | def empty_3(self): # error | -error[B027]: B027.py:24:5: `AbstractClass.empty_3` is an empty method in an abstract base class, but has no abstract decorator +error[B027]: 24:5: `AbstractClass.empty_3` is an empty method in an abstract base class, but has no abstract decorator + --> B027.py:24:5 | 22 | pass 23 | @@ -37,8 +40,9 @@ error[B027]: B027.py:24:5: `AbstractClass.empty_3` is an empty method in an abst 27 | 28 | def empty_4(self): # error | -error[B027]: B027.py:28:5: `AbstractClass.empty_4` is an empty method in an abstract base class, but has no abstract decorator +error[B027]: 28:5: `AbstractClass.empty_4` is an empty method in an abstract base class, but has no abstract decorator + --> B027.py:28:5 | 26 | ... 27 | diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B028_B028.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B028_B028.py.snap index 5d9dbc2214..a4b0c7e6d8 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B028_B028.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B028_B028.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs --- -error[B028]: B028.py:8:1: No explicit `stacklevel` keyword argument found +error[B028]: 8:1: No explicit `stacklevel` keyword argument found + --> B028.py:7:1 | 6 | """ 7 | @@ -11,8 +12,9 @@ error[B028]: B028.py:8:1: No explicit `stacklevel` keyword argument found 9 | warnings.warn(DeprecationWarning("test"), source=None) 10 | warnings.warn(DeprecationWarning("test"), source=None, stacklevel=2) | -error[B028]: B028.py:9:1: No explicit `stacklevel` keyword argument found +error[B028]: 9:1: No explicit `stacklevel` keyword argument found + --> B028.py:8:42 | 8 | warnings.warn(DeprecationWarning("test")) 9 | warnings.warn(DeprecationWarning("test"), source=None) diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B029_B029.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B029_B029.py.snap index 4257925dc3..a1b4e47255 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B029_B029.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B029_B029.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs --- -error[B029]: B029.py:8:1: Using `except ():` with an empty tuple does not catch anything; add exceptions to handle +error[B029]: 8:1: Using `except ():` with an empty tuple does not catch anything; add exceptions to handle + --> B029.py:7:9 | 6 | try: 7 | pass @@ -12,8 +13,9 @@ error[B029]: B029.py:8:1: Using `except ():` with an empty tuple does not catch 10 | 11 | try: | -error[B029]: B029.py:13:1: Using `except ():` with an empty tuple does not catch anything; add exceptions to handle +error[B029]: 13:1: Using `except ():` with an empty tuple does not catch anything; add exceptions to handle + --> B029.py:12:9 | 11 | try: 12 | pass diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B030_B030.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B030_B030.py.snap index 9064fd6fac..beb2811c7a 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B030_B030.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B030_B030.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs --- -error[B030]: B030.py:12:8: `except` handlers should only be exception classes or tuples of exception classes +error[B030]: 12:8: `except` handlers should only be exception classes or tuples of exception classes + --> B030.py:12:8 | 10 | try: 11 | pass @@ -10,8 +11,9 @@ error[B030]: B030.py:12:8: `except` handlers should only be exception classes or | ^ 13 | pass | -error[B030]: B030.py:17:9: `except` handlers should only be exception classes or tuples of exception classes +error[B030]: 17:9: `except` handlers should only be exception classes or tuples of exception classes + --> B030.py:17:9 | 15 | try: 16 | pass @@ -19,8 +21,9 @@ error[B030]: B030.py:17:9: `except` handlers should only be exception classes or | ^ 18 | pass | -error[B030]: B030.py:22:21: `except` handlers should only be exception classes or tuples of exception classes +error[B030]: 22:21: `except` handlers should only be exception classes or tuples of exception classes + --> B030.py:22:21 | 20 | try: 21 | pass @@ -28,8 +31,9 @@ error[B030]: B030.py:22:21: `except` handlers should only be exception classes o | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 23 | pass | -error[B030]: B030.py:27:37: `except` handlers should only be exception classes or tuples of exception classes +error[B030]: 27:37: `except` handlers should only be exception classes or tuples of exception classes + --> B030.py:27:37 | 25 | try: 26 | pass @@ -37,8 +41,9 @@ error[B030]: B030.py:27:37: `except` handlers should only be exception classes o | ^^^^^^^^^^^^^^^^^^^^^ 28 | pass | -error[B030]: B030.py:33:29: `except` handlers should only be exception classes or tuples of exception classes +error[B030]: 33:29: `except` handlers should only be exception classes or tuples of exception classes + --> B030.py:33:29 | 31 | try: 32 | pass @@ -46,8 +51,9 @@ error[B030]: B030.py:33:29: `except` handlers should only be exception classes o | ^^^^^^^^^^^^^^^^^^^^^ 34 | pass | -error[B030]: B030.py:39:28: `except` handlers should only be exception classes or tuples of exception classes +error[B030]: 39:28: `except` handlers should only be exception classes or tuples of exception classes + --> B030.py:39:28 | 37 | try: 38 | pass @@ -55,8 +61,9 @@ error[B030]: B030.py:39:28: `except` handlers should only be exception classes o | ^^^^^^^^^^^^^^^^^^^^^ 40 | pass | -error[B030]: B030.py:131:8: `except` handlers should only be exception classes or tuples of exception classes +error[B030]: 131:8: `except` handlers should only be exception classes or tuples of exception classes + --> B030.py:131:8 | 129 | try: 130 | pass diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B031_B031.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B031_B031.py.snap index e3cd98bab5..b2acdf0518 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B031_B031.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B031_B031.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs --- -error[B031]: B031.py:27:37: Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage +error[B031]: 27:37: Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage + --> B031.py:27:37 | 25 | for shopper in shoppers: 26 | shopper = shopper.title() @@ -11,8 +12,9 @@ error[B031]: B031.py:27:37: Using the generator returned from `itertools.groupby 28 | # We're outside the nested loop and used the group again. 29 | collect_shop_items(shopper, section_items) # B031 | -error[B031]: B031.py:29:33: Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage +error[B031]: 29:33: Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage + --> B031.py:29:33 | 27 | collect_shop_items(shopper, section_items) # B031 28 | # We're outside the nested loop and used the group again. @@ -21,16 +23,18 @@ error[B031]: B031.py:29:33: Using the generator returned from `itertools.groupby 30 | 31 | for _section, section_items in groupby(items, key=lambda p: p[1]): | -error[B031]: B031.py:33:31: Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage +error[B031]: 33:31: Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage + --> B031.py:33:31 | 31 | for _section, section_items in groupby(items, key=lambda p: p[1]): 32 | collect_shop_items("Jane", section_items) 33 | collect_shop_items("Joe", section_items) # B031 | ^^^^^^^^^^^^^ | -error[B031]: B031.py:40:37: Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage +error[B031]: 40:37: Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage + --> B031.py:40:37 | 38 | countdown = 3 39 | while countdown > 0: @@ -38,8 +42,9 @@ error[B031]: B031.py:40:37: Using the generator returned from `itertools.groupby | ^^^^^^^^^^^^^ 41 | countdown -= 1 | -error[B031]: B031.py:46:29: Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage +error[B031]: 46:29: Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage + --> B031.py:46:29 | 44 | collection = [] 45 | for _section, section_items in groupby(items, key=lambda p: p[1]): @@ -48,16 +53,18 @@ error[B031]: B031.py:46:29: Using the generator returned from `itertools.groupby 47 | 48 | unique_items = set() | -error[B031]: B031.py:56:17: Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage +error[B031]: 56:17: Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage + --> B031.py:56:17 | 55 | # But it should be detected when used again 56 | for item in section_items: # B031 | ^^^^^^^^^^^^^ 57 | another_set.add(item) | -error[B031]: B031.py:79:37: Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage +error[B031]: 79:37: Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage + --> B031.py:79:37 | 77 | for _section, section_items in itertools.groupby(items, key=lambda p: p[1]): 78 | for shopper in shoppers: @@ -66,8 +73,9 @@ error[B031]: B031.py:79:37: Using the generator returned from `itertools.groupby 80 | 81 | for _section, section_items in itertools.groupby(items, key=lambda p: p[1]): | -error[B031]: B031.py:82:38: Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage +error[B031]: 82:38: Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage + --> B031.py:82:38 | 81 | for _section, section_items in itertools.groupby(items, key=lambda p: p[1]): 82 | _ = [collect_shop_items(shopper, section_items) for shopper in shoppers] # B031 @@ -75,8 +83,9 @@ error[B031]: B031.py:82:38: Using the generator returned from `itertools.groupby 83 | 84 | for _section, section_items in itertools.groupby(items, key=lambda p: p[1]): | -error[B031]: B031.py:94:65: Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage +error[B031]: 94:65: Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage + --> B031.py:94:65 | 92 | for _section, section_items in itertools.groupby(items, key=lambda p: p[1]): 93 | # The iterator is being used for the second time. @@ -85,8 +94,9 @@ error[B031]: B031.py:94:65: Using the generator returned from `itertools.groupby 95 | 96 | for _section, section_items in itertools.groupby(items, key=lambda p: p[1]): | -error[B031]: B031.py:101:37: Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage +error[B031]: 101:37: Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage + --> B031.py:101:37 | 99 | else: 100 | collect_shop_items(shopper, section_items) @@ -95,8 +105,9 @@ error[B031]: B031.py:101:37: Using the generator returned from `itertools.groupb 102 | 103 | for _section, section_items in itertools.groupby(items, key=lambda p: p[1]): | -error[B031]: B031.py:108:41: Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage +error[B031]: 108:41: Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage + --> B031.py:108:41 | 106 | collect_shop_items(shopper, section_items) 107 | if _section == "greens": @@ -105,8 +116,9 @@ error[B031]: B031.py:108:41: Using the generator returned from `itertools.groupb 109 | elif _section == "frozen items": 110 | collect_shop_items(shopper, section_items) # B031 | -error[B031]: B031.py:110:41: Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage +error[B031]: 110:41: Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage + --> B031.py:110:41 | 108 | collect_shop_items(shopper, section_items) # B031 109 | elif _section == "frozen items": @@ -115,8 +127,9 @@ error[B031]: B031.py:110:41: Using the generator returned from `itertools.groupb 111 | else: 112 | collect_shop_items(shopper, section_items) # B031 | -error[B031]: B031.py:112:41: Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage +error[B031]: 112:41: Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage + --> B031.py:112:41 | 110 | collect_shop_items(shopper, section_items) # B031 111 | else: @@ -125,8 +138,9 @@ error[B031]: B031.py:112:41: Using the generator returned from `itertools.groupb 113 | collect_shop_items(shopper, section_items) # B031 114 | elif _section == "frozen items": | -error[B031]: B031.py:113:37: Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage +error[B031]: 113:37: Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage + --> B031.py:113:37 | 111 | else: 112 | collect_shop_items(shopper, section_items) # B031 @@ -135,8 +149,9 @@ error[B031]: B031.py:113:37: Using the generator returned from `itertools.groupb 114 | elif _section == "frozen items": 115 | # Mix `match` and `if` statements | -error[B031]: B031.py:120:49: Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage +error[B031]: 120:49: Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage + --> B031.py:120:49 | 118 | collect_shop_items(shopper, section_items) 119 | if _section == "fourth": @@ -145,8 +160,9 @@ error[B031]: B031.py:120:49: Using the generator returned from `itertools.groupb 121 | case _: 122 | collect_shop_items(shopper, section_items) | -error[B031]: B031.py:126:33: Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage +error[B031]: 126:33: Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage + --> B031.py:126:33 | 124 | collect_shop_items(shopper, section_items) 125 | # Now, it should detect @@ -155,8 +171,9 @@ error[B031]: B031.py:126:33: Using the generator returned from `itertools.groupb 127 | 128 | for _section, section_items in itertools.groupby(items, key=lambda p: p[1]): | -error[B031]: B031.py:135:49: Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage +error[B031]: 135:49: Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage + --> B031.py:135:49 | 133 | match shopper: 134 | case "Jane": @@ -165,8 +182,9 @@ error[B031]: B031.py:135:49: Using the generator returned from `itertools.groupb 136 | case _: 137 | collect_shop_items(shopper, section_items) # B031 | -error[B031]: B031.py:137:49: Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage +error[B031]: 137:49: Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage + --> B031.py:137:49 | 135 | collect_shop_items(shopper, section_items) # B031 136 | case _: @@ -175,8 +193,9 @@ error[B031]: B031.py:137:49: Using the generator returned from `itertools.groupb 138 | case "frozen items": 139 | collect_shop_items(shopper, section_items) | -error[B031]: B031.py:140:41: Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage +error[B031]: 140:41: Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage + --> B031.py:140:41 | 138 | case "frozen items": 139 | collect_shop_items(shopper, section_items) @@ -185,8 +204,9 @@ error[B031]: B031.py:140:41: Using the generator returned from `itertools.groupb 141 | case _: 142 | collect_shop_items(shopper, section_items) | -error[B031]: B031.py:144:33: Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage +error[B031]: 144:33: Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage + --> B031.py:144:33 | 142 | collect_shop_items(shopper, section_items) 143 | # Now, it should detect @@ -195,8 +215,9 @@ error[B031]: B031.py:144:33: Using the generator returned from `itertools.groupb 145 | 146 | for group in groupby(items, key=lambda p: p[1]): | -error[B031]: B031.py:200:37: Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage +error[B031]: 200:37: Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage + --> B031.py:200:37 | 198 | if _section == "greens": 199 | collect_shop_items(shopper, section_items) @@ -204,8 +225,9 @@ error[B031]: B031.py:200:37: Using the generator returned from `itertools.groupb | ^^^^^^^^^^^^^ 201 | return | -error[B031]: B031.py:210:37: Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage +error[B031]: 210:37: Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage + --> B031.py:210:37 | 208 | elif _section == "frozen items": 209 | collect_shop_items(shopper, section_items) @@ -214,8 +236,9 @@ error[B031]: B031.py:210:37: Using the generator returned from `itertools.groupb 211 | 212 | # Should trigger, since only one branch has a return statement. | -error[B031]: B031.py:219:33: Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage +error[B031]: 219:33: Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage + --> B031.py:219:33 | 217 | elif _section == "frozen items": 218 | collect_shop_items(shopper, section_items) diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B032_B032.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B032_B032.py.snap index 6f354a3654..950a6c5790 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B032_B032.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B032_B032.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs --- -error[B032]: B032.py:9:1: Possible unintentional type annotation (using `:`). Did you mean to assign (using `=`)? +error[B032]: 9:1: Possible unintentional type annotation (using `:`). Did you mean to assign (using `=`)? + --> B032.py:8:1 | 7 | dct = {"a": 1} 8 | @@ -10,8 +11,9 @@ error[B032]: B032.py:9:1: Possible unintentional type annotation (using `:`). Di | ^^^^^^^^^^^ 10 | dct.b: 2 | -error[B032]: B032.py:10:1: Possible unintentional type annotation (using `:`). Did you mean to assign (using `=`)? +error[B032]: 10:1: Possible unintentional type annotation (using `:`). Did you mean to assign (using `=`)? + --> B032.py:9:12 | 9 | dct["b"]: 2 10 | dct.b: 2 @@ -19,8 +21,9 @@ error[B032]: B032.py:10:1: Possible unintentional type annotation (using `:`). D 11 | 12 | dct["b"]: "test" | -error[B032]: B032.py:12:1: Possible unintentional type annotation (using `:`). Did you mean to assign (using `=`)? +error[B032]: 12:1: Possible unintentional type annotation (using `:`). Did you mean to assign (using `=`)? + --> B032.py:11:1 | 10 | dct.b: 2 11 | @@ -28,8 +31,9 @@ error[B032]: B032.py:12:1: Possible unintentional type annotation (using `:`). D | ^^^^^^^^^^^^^^^^ 13 | dct.b: "test" | -error[B032]: B032.py:13:1: Possible unintentional type annotation (using `:`). Did you mean to assign (using `=`)? +error[B032]: 13:1: Possible unintentional type annotation (using `:`). Did you mean to assign (using `=`)? + --> B032.py:12:17 | 12 | dct["b"]: "test" 13 | dct.b: "test" @@ -37,8 +41,9 @@ error[B032]: B032.py:13:1: Possible unintentional type annotation (using `:`). D 14 | 15 | test = "test" | -error[B032]: B032.py:16:1: Possible unintentional type annotation (using `:`). Did you mean to assign (using `=`)? +error[B032]: 16:1: Possible unintentional type annotation (using `:`). Did you mean to assign (using `=`)? + --> B032.py:15:14 | 15 | test = "test" 16 | dct["b"]: test @@ -46,8 +51,9 @@ error[B032]: B032.py:16:1: Possible unintentional type annotation (using `:`). D 17 | dct["b"]: test.lower() 18 | dct.b: test | -error[B032]: B032.py:17:1: Possible unintentional type annotation (using `:`). Did you mean to assign (using `=`)? +error[B032]: 17:1: Possible unintentional type annotation (using `:`). Did you mean to assign (using `=`)? + --> B032.py:16:15 | 15 | test = "test" 16 | dct["b"]: test @@ -56,8 +62,9 @@ error[B032]: B032.py:17:1: Possible unintentional type annotation (using `:`). D 18 | dct.b: test 19 | dct.b: test.lower() | -error[B032]: B032.py:18:1: Possible unintentional type annotation (using `:`). Did you mean to assign (using `=`)? +error[B032]: 18:1: Possible unintentional type annotation (using `:`). Did you mean to assign (using `=`)? + --> B032.py:17:23 | 16 | dct["b"]: test 17 | dct["b"]: test.lower() @@ -65,8 +72,9 @@ error[B032]: B032.py:18:1: Possible unintentional type annotation (using `:`). D | ^^^^^^^^^^^ 19 | dct.b: test.lower() | -error[B032]: B032.py:19:1: Possible unintentional type annotation (using `:`). Did you mean to assign (using `=`)? +error[B032]: 19:1: Possible unintentional type annotation (using `:`). Did you mean to assign (using `=`)? + --> B032.py:18:12 | 17 | dct["b"]: test.lower() 18 | dct.b: test diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B033_B033.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B033_B033.py.snap index 103e3cdc46..a24f5a3a47 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B033_B033.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B033_B033.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs --- -error[B033]: B033.py:4:35: [*] Sets should not contain duplicate item `"value1"` +error[B033]: 4:35: [*] Sets should not contain duplicate item `"value1"` + --> B033.py:4:35 | 2 | # Errors. 3 | ### @@ -22,8 +23,9 @@ error[B033]: B033.py:4:35: [*] Sets should not contain duplicate item `"value1"` 6 6 | incorrect_set_multiline = { 7 7 | "value1", -error[B033]: B033.py:5:21: [*] Sets should not contain duplicate item `1` +error[B033]: 5:21: [*] Sets should not contain duplicate item `1` + --> B033.py:5:21 | 3 | ### 4 | incorrect_set = {"value1", 23, 5, "value1"} @@ -43,8 +45,9 @@ error[B033]: B033.py:5:21: [*] Sets should not contain duplicate item `1` 7 7 | "value1", 8 8 | 23, -error[B033]: B033.py:10:5: [*] Sets should not contain duplicate item `"value1"` +error[B033]: 10:5: [*] Sets should not contain duplicate item `"value1"` + --> B033.py:10:5 | 8 | 23, 9 | 5, @@ -63,8 +66,9 @@ error[B033]: B033.py:10:5: [*] Sets should not contain duplicate item `"value1"` 12 11 | } 13 12 | incorrect_set = {1, 1} -error[B033]: B033.py:13:21: [*] Sets should not contain duplicate item `1` +error[B033]: 13:21: [*] Sets should not contain duplicate item `1` + --> B033.py:13:21 | 11 | # B033 12 | } @@ -84,8 +88,9 @@ error[B033]: B033.py:13:21: [*] Sets should not contain duplicate item `1` 15 15 | incorrect_set = {0, 1, 1,} 16 16 | incorrect_set = {0, 1, 1} -error[B033]: B033.py:14:21: [*] Sets should not contain duplicate item `1` +error[B033]: 14:21: [*] Sets should not contain duplicate item `1` + --> B033.py:14:21 | 12 | } 13 | incorrect_set = {1, 1} @@ -105,8 +110,9 @@ error[B033]: B033.py:14:21: [*] Sets should not contain duplicate item `1` 16 16 | incorrect_set = {0, 1, 1} 17 17 | incorrect_set = { -error[B033]: B033.py:15:24: [*] Sets should not contain duplicate item `1` +error[B033]: 15:24: [*] Sets should not contain duplicate item `1` + --> B033.py:15:24 | 13 | incorrect_set = {1, 1} 14 | incorrect_set = {1, 1,} @@ -126,8 +132,9 @@ error[B033]: B033.py:15:24: [*] Sets should not contain duplicate item `1` 17 17 | incorrect_set = { 18 18 | 0, -error[B033]: B033.py:16:24: [*] Sets should not contain duplicate item `1` +error[B033]: 16:24: [*] Sets should not contain duplicate item `1` + --> B033.py:16:24 | 14 | incorrect_set = {1, 1,} 15 | incorrect_set = {0, 1, 1,} @@ -147,8 +154,9 @@ error[B033]: B033.py:16:24: [*] Sets should not contain duplicate item `1` 18 18 | 0, 19 19 | 1, -error[B033]: B033.py:20:5: [*] Sets should not contain duplicate item `1` +error[B033]: 20:5: [*] Sets should not contain duplicate item `1` + --> B033.py:20:5 | 18 | 0, 19 | 1, diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B034_B034.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B034_B034.py.snap index e0eab36ed9..a5f4883ab2 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B034_B034.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B034_B034.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs --- -error[B034]: B034.py:5:1: `re.sub` should pass `count` and `flags` as keyword arguments to avoid confusion due to unintuitive argument positions +error[B034]: 5:1: `re.sub` should pass `count` and `flags` as keyword arguments to avoid confusion due to unintuitive argument positions + --> B034.py:4:7 | 4 | # B034 5 | re.sub("a", "b", "aaa", re.IGNORECASE) @@ -10,8 +11,9 @@ error[B034]: B034.py:5:1: `re.sub` should pass `count` and `flags` as keyword ar 6 | re.sub("a", "b", "aaa", 5) 7 | re.sub("a", "b", "aaa", 5, re.IGNORECASE) | -error[B034]: B034.py:6:1: `re.sub` should pass `count` and `flags` as keyword arguments to avoid confusion due to unintuitive argument positions +error[B034]: 6:1: `re.sub` should pass `count` and `flags` as keyword arguments to avoid confusion due to unintuitive argument positions + --> B034.py:5:39 | 4 | # B034 5 | re.sub("a", "b", "aaa", re.IGNORECASE) @@ -20,8 +22,9 @@ error[B034]: B034.py:6:1: `re.sub` should pass `count` and `flags` as keyword ar 7 | re.sub("a", "b", "aaa", 5, re.IGNORECASE) 8 | re.subn("a", "b", "aaa", re.IGNORECASE) | -error[B034]: B034.py:7:1: `re.sub` should pass `count` and `flags` as keyword arguments to avoid confusion due to unintuitive argument positions +error[B034]: 7:1: `re.sub` should pass `count` and `flags` as keyword arguments to avoid confusion due to unintuitive argument positions + --> B034.py:6:27 | 5 | re.sub("a", "b", "aaa", re.IGNORECASE) 6 | re.sub("a", "b", "aaa", 5) @@ -30,8 +33,9 @@ error[B034]: B034.py:7:1: `re.sub` should pass `count` and `flags` as keyword ar 8 | re.subn("a", "b", "aaa", re.IGNORECASE) 9 | re.subn("a", "b", "aaa", 5) | -error[B034]: B034.py:8:1: `re.subn` should pass `count` and `flags` as keyword arguments to avoid confusion due to unintuitive argument positions +error[B034]: 8:1: `re.subn` should pass `count` and `flags` as keyword arguments to avoid confusion due to unintuitive argument positions + --> B034.py:7:42 | 6 | re.sub("a", "b", "aaa", 5) 7 | re.sub("a", "b", "aaa", 5, re.IGNORECASE) @@ -40,8 +44,9 @@ error[B034]: B034.py:8:1: `re.subn` should pass `count` and `flags` as keyword a 9 | re.subn("a", "b", "aaa", 5) 10 | re.subn("a", "b", "aaa", 5, re.IGNORECASE) | -error[B034]: B034.py:9:1: `re.subn` should pass `count` and `flags` as keyword arguments to avoid confusion due to unintuitive argument positions +error[B034]: 9:1: `re.subn` should pass `count` and `flags` as keyword arguments to avoid confusion due to unintuitive argument positions + --> B034.py:8:40 | 7 | re.sub("a", "b", "aaa", 5, re.IGNORECASE) 8 | re.subn("a", "b", "aaa", re.IGNORECASE) @@ -50,8 +55,9 @@ error[B034]: B034.py:9:1: `re.subn` should pass `count` and `flags` as keyword a 10 | re.subn("a", "b", "aaa", 5, re.IGNORECASE) 11 | re.split(" ", "a a a a", re.I) | -error[B034]: B034.py:10:1: `re.subn` should pass `count` and `flags` as keyword arguments to avoid confusion due to unintuitive argument positions +error[B034]: 10:1: `re.subn` should pass `count` and `flags` as keyword arguments to avoid confusion due to unintuitive argument positions + --> B034.py:9:28 | 8 | re.subn("a", "b", "aaa", re.IGNORECASE) 9 | re.subn("a", "b", "aaa", 5) @@ -60,8 +66,9 @@ error[B034]: B034.py:10:1: `re.subn` should pass `count` and `flags` as keyword 11 | re.split(" ", "a a a a", re.I) 12 | re.split(" ", "a a a a", 2) | -error[B034]: B034.py:11:1: `re.split` should pass `maxsplit` and `flags` as keyword arguments to avoid confusion due to unintuitive argument positions +error[B034]: 11:1: `re.split` should pass `maxsplit` and `flags` as keyword arguments to avoid confusion due to unintuitive argument positions + --> B034.py:10:43 | 9 | re.subn("a", "b", "aaa", 5) 10 | re.subn("a", "b", "aaa", 5, re.IGNORECASE) @@ -70,8 +77,9 @@ error[B034]: B034.py:11:1: `re.split` should pass `maxsplit` and `flags` as keyw 12 | re.split(" ", "a a a a", 2) 13 | re.split(" ", "a a a a", 2, re.I) | -error[B034]: B034.py:12:1: `re.split` should pass `maxsplit` and `flags` as keyword arguments to avoid confusion due to unintuitive argument positions +error[B034]: 12:1: `re.split` should pass `maxsplit` and `flags` as keyword arguments to avoid confusion due to unintuitive argument positions + --> B034.py:11:31 | 10 | re.subn("a", "b", "aaa", 5, re.IGNORECASE) 11 | re.split(" ", "a a a a", re.I) @@ -80,8 +88,9 @@ error[B034]: B034.py:12:1: `re.split` should pass `maxsplit` and `flags` as keyw 13 | re.split(" ", "a a a a", 2, re.I) 14 | sub("a", "b", "aaa", re.IGNORECASE) | -error[B034]: B034.py:13:1: `re.split` should pass `maxsplit` and `flags` as keyword arguments to avoid confusion due to unintuitive argument positions +error[B034]: 13:1: `re.split` should pass `maxsplit` and `flags` as keyword arguments to avoid confusion due to unintuitive argument positions + --> B034.py:12:28 | 11 | re.split(" ", "a a a a", re.I) 12 | re.split(" ", "a a a a", 2) @@ -89,8 +98,9 @@ error[B034]: B034.py:13:1: `re.split` should pass `maxsplit` and `flags` as keyw | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 14 | sub("a", "b", "aaa", re.IGNORECASE) | -error[B034]: B034.py:14:1: `re.sub` should pass `count` and `flags` as keyword arguments to avoid confusion due to unintuitive argument positions +error[B034]: 14:1: `re.sub` should pass `count` and `flags` as keyword arguments to avoid confusion due to unintuitive argument positions + --> B034.py:13:34 | 12 | re.split(" ", "a a a a", 2) 13 | re.split(" ", "a a a a", 2, re.I) diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B035_B035.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B035_B035.py.snap index 02c251b982..7a8b33ba27 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B035_B035.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B035_B035.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs --- -error[B035]: B035.py:17:2: Dictionary comprehension uses static key: `"key"` +error[B035]: 17:2: Dictionary comprehension uses static key: `"key"` + --> B035.py:17:2 | 16 | # Errors 17 | {"key": value.upper() for value in data} @@ -10,8 +11,9 @@ error[B035]: B035.py:17:2: Dictionary comprehension uses static key: `"key"` 18 | {True: value.upper() for value in data} 19 | {0: value.upper() for value in data} | -error[B035]: B035.py:18:2: Dictionary comprehension uses static key: `True` +error[B035]: 18:2: Dictionary comprehension uses static key: `True` + --> B035.py:18:2 | 16 | # Errors 17 | {"key": value.upper() for value in data} @@ -20,8 +22,9 @@ error[B035]: B035.py:18:2: Dictionary comprehension uses static key: `True` 19 | {0: value.upper() for value in data} 20 | {(1, "a"): value.upper() for value in data} # Constant tuple | -error[B035]: B035.py:19:2: Dictionary comprehension uses static key: `0` +error[B035]: 19:2: Dictionary comprehension uses static key: `0` + --> B035.py:19:2 | 17 | {"key": value.upper() for value in data} 18 | {True: value.upper() for value in data} @@ -30,8 +33,9 @@ error[B035]: B035.py:19:2: Dictionary comprehension uses static key: `0` 20 | {(1, "a"): value.upper() for value in data} # Constant tuple 21 | {constant: value.upper() for value in data} | -error[B035]: B035.py:20:2: Dictionary comprehension uses static key: `(1, "a")` +error[B035]: 20:2: Dictionary comprehension uses static key: `(1, "a")` + --> B035.py:20:2 | 18 | {True: value.upper() for value in data} 19 | {0: value.upper() for value in data} @@ -40,8 +44,9 @@ error[B035]: B035.py:20:2: Dictionary comprehension uses static key: `(1, "a")` 21 | {constant: value.upper() for value in data} 22 | {constant + constant: value.upper() for value in data} | -error[B035]: B035.py:21:2: Dictionary comprehension uses static key: `constant` +error[B035]: 21:2: Dictionary comprehension uses static key: `constant` + --> B035.py:21:2 | 19 | {0: value.upper() for value in data} 20 | {(1, "a"): value.upper() for value in data} # Constant tuple @@ -50,8 +55,9 @@ error[B035]: B035.py:21:2: Dictionary comprehension uses static key: `constant` 22 | {constant + constant: value.upper() for value in data} 23 | {constant.attribute: value.upper() for value in data} | -error[B035]: B035.py:22:2: Dictionary comprehension uses static key: `constant + constant` +error[B035]: 22:2: Dictionary comprehension uses static key: `constant + constant` + --> B035.py:22:2 | 20 | {(1, "a"): value.upper() for value in data} # Constant tuple 21 | {constant: value.upper() for value in data} @@ -60,8 +66,9 @@ error[B035]: B035.py:22:2: Dictionary comprehension uses static key: `constant + 23 | {constant.attribute: value.upper() for value in data} 24 | {constant[0]: value.upper() for value in data} | -error[B035]: B035.py:23:2: Dictionary comprehension uses static key: `constant.attribute` +error[B035]: 23:2: Dictionary comprehension uses static key: `constant.attribute` + --> B035.py:23:2 | 21 | {constant: value.upper() for value in data} 22 | {constant + constant: value.upper() for value in data} @@ -70,8 +77,9 @@ error[B035]: B035.py:23:2: Dictionary comprehension uses static key: `constant.a 24 | {constant[0]: value.upper() for value in data} 25 | {tokens: token for token in tokens} | -error[B035]: B035.py:24:2: Dictionary comprehension uses static key: `constant[0]` +error[B035]: 24:2: Dictionary comprehension uses static key: `constant[0]` + --> B035.py:24:2 | 22 | {constant + constant: value.upper() for value in data} 23 | {constant.attribute: value.upper() for value in data} @@ -79,8 +87,9 @@ error[B035]: B035.py:24:2: Dictionary comprehension uses static key: `constant[0 | ^^^^^^^^^^^ 25 | {tokens: token for token in tokens} | -error[B035]: B035.py:25:2: Dictionary comprehension uses static key: `tokens` +error[B035]: 25:2: Dictionary comprehension uses static key: `tokens` + --> B035.py:25:2 | 23 | {constant.attribute: value.upper() for value in data} 24 | {constant[0]: value.upper() for value in data} diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B039_B039.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B039_B039.py.snap index e2bbb851aa..ff6bd4ad69 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B039_B039.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B039_B039.py.snap @@ -1,127 +1,140 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs --- -B039.py:19:26: B039 Do not use mutable data structures for `ContextVar` defaults +error[B039]: 19:26: Do not use mutable data structures for `ContextVar` defaults + + --> B039.py:19:26 | 18 | # Bad 19 | ContextVar("cv", default=[]) - | ^^ B039 + | ^^ 20 | ContextVar("cv", default={}) 21 | ContextVar("cv", default=list()) | = help: Replace with `None`; initialize with `.set()`` +error[B039]: 20:26: Do not use mutable data structures for `ContextVar` defaults -B039.py:20:26: B039 Do not use mutable data structures for `ContextVar` defaults + --> B039.py:20:26 | 18 | # Bad 19 | ContextVar("cv", default=[]) 20 | ContextVar("cv", default={}) - | ^^ B039 + | ^^ 21 | ContextVar("cv", default=list()) 22 | ContextVar("cv", default=set()) | = help: Replace with `None`; initialize with `.set()`` +error[B039]: 21:26: Do not use mutable data structures for `ContextVar` defaults -B039.py:21:26: B039 Do not use mutable data structures for `ContextVar` defaults + --> B039.py:21:26 | 19 | ContextVar("cv", default=[]) 20 | ContextVar("cv", default={}) 21 | ContextVar("cv", default=list()) - | ^^^^^^ B039 + | ^^^^^^ 22 | ContextVar("cv", default=set()) 23 | ContextVar("cv", default=dict()) | = help: Replace with `None`; initialize with `.set()`` +error[B039]: 22:26: Do not use mutable data structures for `ContextVar` defaults -B039.py:22:26: B039 Do not use mutable data structures for `ContextVar` defaults + --> B039.py:22:26 | 20 | ContextVar("cv", default={}) 21 | ContextVar("cv", default=list()) 22 | ContextVar("cv", default=set()) - | ^^^^^ B039 + | ^^^^^ 23 | ContextVar("cv", default=dict()) 24 | ContextVar("cv", default=[char for char in "foo"]) | = help: Replace with `None`; initialize with `.set()`` +error[B039]: 23:26: Do not use mutable data structures for `ContextVar` defaults -B039.py:23:26: B039 Do not use mutable data structures for `ContextVar` defaults + --> B039.py:23:26 | 21 | ContextVar("cv", default=list()) 22 | ContextVar("cv", default=set()) 23 | ContextVar("cv", default=dict()) - | ^^^^^^ B039 + | ^^^^^^ 24 | ContextVar("cv", default=[char for char in "foo"]) 25 | ContextVar("cv", default={char for char in "foo"}) | = help: Replace with `None`; initialize with `.set()`` +error[B039]: 24:26: Do not use mutable data structures for `ContextVar` defaults -B039.py:24:26: B039 Do not use mutable data structures for `ContextVar` defaults + --> B039.py:24:26 | 22 | ContextVar("cv", default=set()) 23 | ContextVar("cv", default=dict()) 24 | ContextVar("cv", default=[char for char in "foo"]) - | ^^^^^^^^^^^^^^^^^^^^^^^^ B039 + | ^^^^^^^^^^^^^^^^^^^^^^^^ 25 | ContextVar("cv", default={char for char in "foo"}) 26 | ContextVar("cv", default={char: idx for idx, char in enumerate("foo")}) | = help: Replace with `None`; initialize with `.set()`` +error[B039]: 25:26: Do not use mutable data structures for `ContextVar` defaults -B039.py:25:26: B039 Do not use mutable data structures for `ContextVar` defaults + --> B039.py:25:26 | 23 | ContextVar("cv", default=dict()) 24 | ContextVar("cv", default=[char for char in "foo"]) 25 | ContextVar("cv", default={char for char in "foo"}) - | ^^^^^^^^^^^^^^^^^^^^^^^^ B039 + | ^^^^^^^^^^^^^^^^^^^^^^^^ 26 | ContextVar("cv", default={char: idx for idx, char in enumerate("foo")}) 27 | ContextVar("cv", default=collections.deque()) | = help: Replace with `None`; initialize with `.set()`` +error[B039]: 26:26: Do not use mutable data structures for `ContextVar` defaults -B039.py:26:26: B039 Do not use mutable data structures for `ContextVar` defaults + --> B039.py:26:26 | 24 | ContextVar("cv", default=[char for char in "foo"]) 25 | ContextVar("cv", default={char for char in "foo"}) 26 | ContextVar("cv", default={char: idx for idx, char in enumerate("foo")}) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ B039 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 27 | ContextVar("cv", default=collections.deque()) | = help: Replace with `None`; initialize with `.set()`` +error[B039]: 27:26: Do not use mutable data structures for `ContextVar` defaults -B039.py:27:26: B039 Do not use mutable data structures for `ContextVar` defaults + --> B039.py:27:26 | 25 | ContextVar("cv", default={char for char in "foo"}) 26 | ContextVar("cv", default={char: idx for idx, char in enumerate("foo")}) 27 | ContextVar("cv", default=collections.deque()) - | ^^^^^^^^^^^^^^^^^^^ B039 + | ^^^^^^^^^^^^^^^^^^^ 28 | 29 | def bar() -> list[int]: | = help: Replace with `None`; initialize with `.set()`` +error[B039]: 32:26: Do not use mutable data structures for `ContextVar` defaults -B039.py:32:26: B039 Do not use mutable data structures for `ContextVar` defaults + --> B039.py:32:26 | 30 | return [1, 2, 3] 31 | 32 | ContextVar("cv", default=bar()) - | ^^^^^ B039 + | ^^^^^ 33 | ContextVar("cv", default=time.time()) | = help: Replace with `None`; initialize with `.set()`` +error[B039]: 33:26: Do not use mutable data structures for `ContextVar` defaults -B039.py:33:26: B039 Do not use mutable data structures for `ContextVar` defaults + --> B039.py:33:26 | 32 | ContextVar("cv", default=bar()) 33 | ContextVar("cv", default=time.time()) - | ^^^^^^^^^^^ B039 + | ^^^^^^^^^^^ 34 | 35 | def baz(): ... | = help: Replace with `None`; initialize with `.set()`` +error[B039]: 36:26: Do not use mutable data structures for `ContextVar` defaults -B039.py:36:26: B039 Do not use mutable data structures for `ContextVar` defaults + --> B039.py:36:26 | 35 | def baz(): ... 36 | ContextVar("cv", default=baz()) - | ^^^^^ B039 + | ^^^^^ | = help: Replace with `None`; initialize with `.set()`` diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B901_B901.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B901_B901.py.snap index b1e65fb3c0..4b70e5361c 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B901_B901.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B901_B901.py.snap @@ -1,21 +1,24 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs --- -B901.py:9:9: B901 Using `yield` and `return {value}` in a generator function can lead to confusing behavior +error[B901]: 9:9: Using `yield` and `return {value}` in a generator function can lead to confusing behavior + + --> B901.py:9:9 | 7 | def broken(): 8 | if True: 9 | return [1, 2, 3] - | ^^^^^^^^^^^^^^^^ B901 + | ^^^^^^^^^^^^^^^^ 10 | 11 | yield 3 | +error[B901]: 36:5: Using `yield` and `return {value}` in a generator function can lead to confusing behavior -B901.py:36:5: B901 Using `yield` and `return {value}` in a generator function can lead to confusing behavior + --> B901.py:36:5 | 35 | def broken2(): 36 | return [3, 2, 1] - | ^^^^^^^^^^^^^^^^ B901 + | ^^^^^^^^^^^^^^^^ 37 | 38 | yield from not_broken() | diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B904_B904.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B904_B904.py.snap index d0125ff89b..5b4b56afd4 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B904_B904.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B904_B904.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs --- -error[B904]: B904.py:10:9: Within an `except` clause, raise exceptions with `raise ... from err` or `raise ... from None` to distinguish them from errors in exception handling +error[B904]: 10:9: Within an `except` clause, raise exceptions with `raise ... from err` or `raise ... from None` to distinguish them from errors in exception handling + --> B904.py:10:9 | 8 | except ValueError: 9 | if "abc": @@ -11,8 +12,9 @@ error[B904]: B904.py:10:9: Within an `except` clause, raise exceptions with `rai 11 | raise UserWarning 12 | except AssertionError: | -error[B904]: B904.py:11:5: Within an `except` clause, raise exceptions with `raise ... from err` or `raise ... from None` to distinguish them from errors in exception handling +error[B904]: 11:5: Within an `except` clause, raise exceptions with `raise ... from err` or `raise ... from None` to distinguish them from errors in exception handling + --> B904.py:11:5 | 9 | if "abc": 10 | raise TypeError @@ -21,8 +23,9 @@ error[B904]: B904.py:11:5: Within an `except` clause, raise exceptions with `rai 12 | except AssertionError: 13 | raise # Bare `raise` should not be an error | -error[B904]: B904.py:16:5: Within an `except` clause, raise exceptions with `raise ... from err` or `raise ... from None` to distinguish them from errors in exception handling +error[B904]: 16:5: Within an `except` clause, raise exceptions with `raise ... from err` or `raise ... from None` to distinguish them from errors in exception handling + --> B904.py:16:5 | 14 | except Exception as err: 15 | assert err @@ -31,8 +34,9 @@ error[B904]: B904.py:16:5: Within an `except` clause, raise exceptions with `rai 17 | except BaseException as err: 18 | raise err | -error[B904]: B904.py:20:5: Within an `except` clause, raise exceptions with `raise ... from err` or `raise ... from None` to distinguish them from errors in exception handling +error[B904]: 20:5: Within an `except` clause, raise exceptions with `raise ... from err` or `raise ... from None` to distinguish them from errors in exception handling + --> B904.py:20:5 | 18 | raise err 19 | except BaseException as err: @@ -41,8 +45,9 @@ error[B904]: B904.py:20:5: Within an `except` clause, raise exceptions with `rai 21 | finally: 22 | raise Exception("Nothing to chain from, so no warning here") | -error[B904]: B904.py:63:9: Within an `except` clause, raise exceptions with `raise ... from err` or `raise ... from None` to distinguish them from errors in exception handling +error[B904]: 63:9: Within an `except` clause, raise exceptions with `raise ... from err` or `raise ... from None` to distinguish them from errors in exception handling + --> B904.py:63:9 | 61 | except Exception as e: 62 | if ...: @@ -51,16 +56,18 @@ error[B904]: B904.py:63:9: Within an `except` clause, raise exceptions with `rai 64 | else: 65 | raise RuntimeError("bang!") | -error[B904]: B904.py:65:9: Within an `except` clause, raise exceptions with `raise ... from err` or `raise ... from None` to distinguish them from errors in exception handling +error[B904]: 65:9: Within an `except` clause, raise exceptions with `raise ... from err` or `raise ... from None` to distinguish them from errors in exception handling + --> B904.py:65:9 | 63 | raise RuntimeError("boom!") 64 | else: 65 | raise RuntimeError("bang!") | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -error[B904]: B904.py:73:13: Within an `except` clause, raise exceptions with `raise ... from err` or `raise ... from None` to distinguish them from errors in exception handling +error[B904]: 73:13: Within an `except` clause, raise exceptions with `raise ... from err` or `raise ... from None` to distinguish them from errors in exception handling + --> B904.py:73:13 | 71 | match 0: 72 | case 0: diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B905.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B905.py.snap index 22661a11c4..732b0edfa6 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B905.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B905.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs --- -error[B905]: B905.py:4:1: [*] `zip()` without an explicit `strict=` parameter +error[B905]: 4:1: [*] `zip()` without an explicit `strict=` parameter + --> B905.py:3:9 | 3 | # Errors 4 | zip() @@ -21,8 +22,9 @@ error[B905]: B905.py:4:1: [*] `zip()` without an explicit `strict=` parameter 6 6 | zip("a", "b") 7 7 | zip("a", "b", *zip("c")) -error[B905]: B905.py:5:1: [*] `zip()` without an explicit `strict=` parameter +error[B905]: 5:1: [*] `zip()` without an explicit `strict=` parameter + --> B905.py:4:6 | 3 | # Errors 4 | zip() @@ -42,8 +44,9 @@ error[B905]: B905.py:5:1: [*] `zip()` without an explicit `strict=` parameter 7 7 | zip("a", "b", *zip("c")) 8 8 | zip(zip("a"), strict=False) -error[B905]: B905.py:6:1: [*] `zip()` without an explicit `strict=` parameter +error[B905]: 6:1: [*] `zip()` without an explicit `strict=` parameter + --> B905.py:5:14 | 4 | zip() 5 | zip(range(3)) @@ -63,8 +66,9 @@ error[B905]: B905.py:6:1: [*] `zip()` without an explicit `strict=` parameter 8 8 | zip(zip("a"), strict=False) 9 9 | zip(zip("a", strict=True)) -error[B905]: B905.py:7:1: [*] `zip()` without an explicit `strict=` parameter +error[B905]: 7:1: [*] `zip()` without an explicit `strict=` parameter + --> B905.py:6:14 | 5 | zip(range(3)) 6 | zip("a", "b") @@ -84,8 +88,9 @@ error[B905]: B905.py:7:1: [*] `zip()` without an explicit `strict=` parameter 9 9 | zip(zip("a", strict=True)) 10 10 | -error[B905]: B905.py:7:16: [*] `zip()` without an explicit `strict=` parameter +error[B905]: 7:16: [*] `zip()` without an explicit `strict=` parameter + --> B905.py:7:16 | 5 | zip(range(3)) 6 | zip("a", "b") @@ -105,8 +110,9 @@ error[B905]: B905.py:7:16: [*] `zip()` without an explicit `strict=` parameter 9 9 | zip(zip("a", strict=True)) 10 10 | -error[B905]: B905.py:8:5: [*] `zip()` without an explicit `strict=` parameter +error[B905]: 8:5: [*] `zip()` without an explicit `strict=` parameter + --> B905.py:8:5 | 6 | zip("a", "b") 7 | zip("a", "b", *zip("c")) @@ -125,8 +131,9 @@ error[B905]: B905.py:8:5: [*] `zip()` without an explicit `strict=` parameter 10 10 | 11 11 | # OK -error[B905]: B905.py:9:1: [*] `zip()` without an explicit `strict=` parameter +error[B905]: 9:1: [*] `zip()` without an explicit `strict=` parameter + --> B905.py:8:28 | 7 | zip("a", "b", *zip("c")) 8 | zip(zip("a"), strict=False) @@ -146,8 +153,9 @@ error[B905]: B905.py:9:1: [*] `zip()` without an explicit `strict=` parameter 11 11 | # OK 12 12 | zip(range(3), strict=True) -error[B905]: B905.py:24:1: [*] `zip()` without an explicit `strict=` parameter +error[B905]: 24:1: [*] `zip()` without an explicit `strict=` parameter + --> B905.py:23:30 | 23 | # Errors (limited iterators). 24 | zip([1, 2, 3], repeat(1, 1)) @@ -165,8 +173,9 @@ error[B905]: B905.py:24:1: [*] `zip()` without an explicit `strict=` parameter 26 26 | 27 27 | import builtins -error[B905]: B905.py:25:1: [*] `zip()` without an explicit `strict=` parameter +error[B905]: 25:1: [*] `zip()` without an explicit `strict=` parameter + --> B905.py:24:29 | 23 | # Errors (limited iterators). 24 | zip([1, 2, 3], repeat(1, 1)) @@ -186,8 +195,9 @@ error[B905]: B905.py:25:1: [*] `zip()` without an explicit `strict=` parameter 27 27 | import builtins 28 28 | # Still an error even though it uses the qualified name -error[B905]: B905.py:29:1: [*] `zip()` without an explicit `strict=` parameter +error[B905]: 29:1: [*] `zip()` without an explicit `strict=` parameter + --> B905.py:28:56 | 27 | import builtins 28 | # Still an error even though it uses the qualified name diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B909_B909.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B909_B909.py.snap index d6807bca2a..0ebcdf3ccf 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B909_B909.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B909_B909.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs --- -error[B909]: B909.py:12:5: Mutation to loop iterable `some_list` during iteration +error[B909]: 12:5: Mutation to loop iterable `some_list` during iteration + --> B909.py:12:5 | 10 | for elem in some_list: 11 | # errors @@ -11,8 +12,9 @@ error[B909]: B909.py:12:5: Mutation to loop iterable `some_list` during iteratio 13 | del some_list[2] 14 | some_list.append(elem) | -error[B909]: B909.py:13:5: Mutation to loop iterable `some_list` during iteration +error[B909]: 13:5: Mutation to loop iterable `some_list` during iteration + --> B909.py:13:5 | 11 | # errors 12 | some_list.remove(0) @@ -21,8 +23,9 @@ error[B909]: B909.py:13:5: Mutation to loop iterable `some_list` during iteratio 14 | some_list.append(elem) 15 | some_list.sort() | -error[B909]: B909.py:14:5: Mutation to loop iterable `some_list` during iteration +error[B909]: 14:5: Mutation to loop iterable `some_list` during iteration + --> B909.py:14:5 | 12 | some_list.remove(0) 13 | del some_list[2] @@ -31,8 +34,9 @@ error[B909]: B909.py:14:5: Mutation to loop iterable `some_list` during iteratio 15 | some_list.sort() 16 | some_list.reverse() | -error[B909]: B909.py:15:5: Mutation to loop iterable `some_list` during iteration +error[B909]: 15:5: Mutation to loop iterable `some_list` during iteration + --> B909.py:15:5 | 13 | del some_list[2] 14 | some_list.append(elem) @@ -41,8 +45,9 @@ error[B909]: B909.py:15:5: Mutation to loop iterable `some_list` during iteratio 16 | some_list.reverse() 17 | some_list.clear() | -error[B909]: B909.py:16:5: Mutation to loop iterable `some_list` during iteration +error[B909]: 16:5: Mutation to loop iterable `some_list` during iteration + --> B909.py:16:5 | 14 | some_list.append(elem) 15 | some_list.sort() @@ -51,8 +56,9 @@ error[B909]: B909.py:16:5: Mutation to loop iterable `some_list` during iteratio 17 | some_list.clear() 18 | some_list.extend([1, 2]) | -error[B909]: B909.py:17:5: Mutation to loop iterable `some_list` during iteration +error[B909]: 17:5: Mutation to loop iterable `some_list` during iteration + --> B909.py:17:5 | 15 | some_list.sort() 16 | some_list.reverse() @@ -61,8 +67,9 @@ error[B909]: B909.py:17:5: Mutation to loop iterable `some_list` during iteratio 18 | some_list.extend([1, 2]) 19 | some_list.insert(1, 1) | -error[B909]: B909.py:18:5: Mutation to loop iterable `some_list` during iteration +error[B909]: 18:5: Mutation to loop iterable `some_list` during iteration + --> B909.py:18:5 | 16 | some_list.reverse() 17 | some_list.clear() @@ -71,8 +78,9 @@ error[B909]: B909.py:18:5: Mutation to loop iterable `some_list` during iteratio 19 | some_list.insert(1, 1) 20 | some_list.pop(1) | -error[B909]: B909.py:19:5: Mutation to loop iterable `some_list` during iteration +error[B909]: 19:5: Mutation to loop iterable `some_list` during iteration + --> B909.py:19:5 | 17 | some_list.clear() 18 | some_list.extend([1, 2]) @@ -81,8 +89,9 @@ error[B909]: B909.py:19:5: Mutation to loop iterable `some_list` during iteratio 20 | some_list.pop(1) 21 | some_list.pop() | -error[B909]: B909.py:20:5: Mutation to loop iterable `some_list` during iteration +error[B909]: 20:5: Mutation to loop iterable `some_list` during iteration + --> B909.py:20:5 | 18 | some_list.extend([1, 2]) 19 | some_list.insert(1, 1) @@ -90,8 +99,9 @@ error[B909]: B909.py:20:5: Mutation to loop iterable `some_list` during iteratio | ^^^^^^^^^^^^^ 21 | some_list.pop() | -error[B909]: B909.py:21:5: Mutation to loop iterable `some_list` during iteration +error[B909]: 21:5: Mutation to loop iterable `some_list` during iteration + --> B909.py:21:5 | 19 | some_list.insert(1, 1) 20 | some_list.pop(1) @@ -100,8 +110,9 @@ error[B909]: B909.py:21:5: Mutation to loop iterable `some_list` during iteratio 22 | 23 | # conditional break should error | -error[B909]: B909.py:25:9: Mutation to loop iterable `some_list` during iteration +error[B909]: 25:9: Mutation to loop iterable `some_list` during iteration + --> B909.py:25:9 | 23 | # conditional break should error 24 | if elem == 2: @@ -110,8 +121,9 @@ error[B909]: B909.py:25:9: Mutation to loop iterable `some_list` during iteratio 26 | if elem == 3: 27 | break | -error[B909]: B909.py:47:5: Mutation to loop iterable `mydicts` during iteration +error[B909]: 47:5: Mutation to loop iterable `mydicts` during iteration + --> B909.py:47:5 | 45 | for elem in mydicts: 46 | # errors @@ -120,8 +132,9 @@ error[B909]: B909.py:47:5: Mutation to loop iterable `mydicts` during iteration 48 | mydicts.setdefault("foo", 1) 49 | mydicts.update({"foo": "bar"}) | -error[B909]: B909.py:48:5: Mutation to loop iterable `mydicts` during iteration +error[B909]: 48:5: Mutation to loop iterable `mydicts` during iteration + --> B909.py:48:5 | 46 | # errors 47 | mydicts.popitem() @@ -129,8 +142,9 @@ error[B909]: B909.py:48:5: Mutation to loop iterable `mydicts` during iteration | ^^^^^^^^^^^^^^^^^^ 49 | mydicts.update({"foo": "bar"}) | -error[B909]: B909.py:49:5: Mutation to loop iterable `mydicts` during iteration +error[B909]: 49:5: Mutation to loop iterable `mydicts` during iteration + --> B909.py:49:5 | 47 | mydicts.popitem() 48 | mydicts.setdefault("foo", 1) @@ -139,8 +153,9 @@ error[B909]: B909.py:49:5: Mutation to loop iterable `mydicts` during iteration 50 | 51 | # no errors | -error[B909]: B909.py:62:5: Mutation to loop iterable `myset` during iteration +error[B909]: 62:5: Mutation to loop iterable `myset` during iteration + --> B909.py:62:5 | 60 | for _ in myset: 61 | # errors @@ -149,8 +164,9 @@ error[B909]: B909.py:62:5: Mutation to loop iterable `myset` during iteration 63 | myset.intersection_update({4, 5}) 64 | myset.difference_update({4, 5}) | -error[B909]: B909.py:63:5: Mutation to loop iterable `myset` during iteration +error[B909]: 63:5: Mutation to loop iterable `myset` during iteration + --> B909.py:63:5 | 61 | # errors 62 | myset.update({4, 5}) @@ -159,8 +175,9 @@ error[B909]: B909.py:63:5: Mutation to loop iterable `myset` during iteration 64 | myset.difference_update({4, 5}) 65 | myset.symmetric_difference_update({4, 5}) | -error[B909]: B909.py:64:5: Mutation to loop iterable `myset` during iteration +error[B909]: 64:5: Mutation to loop iterable `myset` during iteration + --> B909.py:64:5 | 62 | myset.update({4, 5}) 63 | myset.intersection_update({4, 5}) @@ -169,8 +186,9 @@ error[B909]: B909.py:64:5: Mutation to loop iterable `myset` during iteration 65 | myset.symmetric_difference_update({4, 5}) 66 | myset.add(4) | -error[B909]: B909.py:65:5: Mutation to loop iterable `myset` during iteration +error[B909]: 65:5: Mutation to loop iterable `myset` during iteration + --> B909.py:65:5 | 63 | myset.intersection_update({4, 5}) 64 | myset.difference_update({4, 5}) @@ -179,8 +197,9 @@ error[B909]: B909.py:65:5: Mutation to loop iterable `myset` during iteration 66 | myset.add(4) 67 | myset.discard(3) | -error[B909]: B909.py:66:5: Mutation to loop iterable `myset` during iteration +error[B909]: 66:5: Mutation to loop iterable `myset` during iteration + --> B909.py:66:5 | 64 | myset.difference_update({4, 5}) 65 | myset.symmetric_difference_update({4, 5}) @@ -188,8 +207,9 @@ error[B909]: B909.py:66:5: Mutation to loop iterable `myset` during iteration | ^^^^^^^^^ 67 | myset.discard(3) | -error[B909]: B909.py:67:5: Mutation to loop iterable `myset` during iteration +error[B909]: 67:5: Mutation to loop iterable `myset` during iteration + --> B909.py:67:5 | 65 | myset.symmetric_difference_update({4, 5}) 66 | myset.add(4) @@ -198,8 +218,9 @@ error[B909]: B909.py:67:5: Mutation to loop iterable `myset` during iteration 68 | 69 | # no errors | -error[B909]: B909.py:84:5: Mutation to loop iterable `a.some_list` during iteration +error[B909]: 84:5: Mutation to loop iterable `a.some_list` during iteration + --> B909.py:84:5 | 82 | # ensure member accesses are handled as errors 83 | for elem in a.some_list: @@ -207,16 +228,18 @@ error[B909]: B909.py:84:5: Mutation to loop iterable `a.some_list` during iterat | ^^^^^^^^^^^^^^^^^^ 85 | del a.some_list[2] | -error[B909]: B909.py:85:5: Mutation to loop iterable `a.some_list` during iteration +error[B909]: 85:5: Mutation to loop iterable `a.some_list` during iteration + --> B909.py:85:5 | 83 | for elem in a.some_list: 84 | a.some_list.remove(0) 85 | del a.some_list[2] | ^^^^^^^^^^^^^^^^^^ | -error[B909]: B909.py:93:5: Mutation to loop iterable `foo` during iteration +error[B909]: 93:5: Mutation to loop iterable `foo` during iteration + --> B909.py:93:5 | 91 | bar = [4, 5, 6] 92 | for _ in foo: @@ -225,8 +248,9 @@ error[B909]: B909.py:93:5: Mutation to loop iterable `foo` during iteration 94 | foo += bar 95 | foo[1] = 9 | -error[B909]: B909.py:94:5: Mutation to loop iterable `foo` during iteration +error[B909]: 94:5: Mutation to loop iterable `foo` during iteration + --> B909.py:94:5 | 92 | for _ in foo: 93 | foo *= 2 @@ -235,8 +259,9 @@ error[B909]: B909.py:94:5: Mutation to loop iterable `foo` during iteration 95 | foo[1] = 9 96 | foo[1:2] = bar | -error[B909]: B909.py:95:5: Mutation to loop iterable `foo` during iteration +error[B909]: 95:5: Mutation to loop iterable `foo` during iteration + --> B909.py:95:5 | 93 | foo *= 2 94 | foo += bar @@ -245,8 +270,9 @@ error[B909]: B909.py:95:5: Mutation to loop iterable `foo` during iteration 96 | foo[1:2] = bar 97 | foo[1:2:3] = bar | -error[B909]: B909.py:96:5: Mutation to loop iterable `foo` during iteration +error[B909]: 96:5: Mutation to loop iterable `foo` during iteration + --> B909.py:96:5 | 94 | foo += bar 95 | foo[1] = 9 @@ -254,8 +280,9 @@ error[B909]: B909.py:96:5: Mutation to loop iterable `foo` during iteration | ^^^^^^^^^^^^^^ 97 | foo[1:2:3] = bar | -error[B909]: B909.py:97:5: Mutation to loop iterable `foo` during iteration +error[B909]: 97:5: Mutation to loop iterable `foo` during iteration + --> B909.py:97:5 | 95 | foo[1] = 9 96 | foo[1:2] = bar @@ -264,8 +291,9 @@ error[B909]: B909.py:97:5: Mutation to loop iterable `foo` during iteration 98 | 99 | foo = {1, 2, 3} | -error[B909]: B909.py:102:5: Mutation to loop iterable `foo` during iteration +error[B909]: 102:5: Mutation to loop iterable `foo` during iteration + --> B909.py:102:5 | 100 | bar = {4, 5, 6} 101 | for _ in foo: # should error @@ -274,8 +302,9 @@ error[B909]: B909.py:102:5: Mutation to loop iterable `foo` during iteration 103 | foo &= bar 104 | foo -= bar | -error[B909]: B909.py:103:5: Mutation to loop iterable `foo` during iteration +error[B909]: 103:5: Mutation to loop iterable `foo` during iteration + --> B909.py:103:5 | 101 | for _ in foo: # should error 102 | foo |= bar @@ -284,8 +313,9 @@ error[B909]: B909.py:103:5: Mutation to loop iterable `foo` during iteration 104 | foo -= bar 105 | foo ^= bar | -error[B909]: B909.py:104:5: Mutation to loop iterable `foo` during iteration +error[B909]: 104:5: Mutation to loop iterable `foo` during iteration + --> B909.py:104:5 | 102 | foo |= bar 103 | foo &= bar @@ -293,16 +323,18 @@ error[B909]: B909.py:104:5: Mutation to loop iterable `foo` during iteration | ^^^^^^^^^^ 105 | foo ^= bar | -error[B909]: B909.py:105:5: Mutation to loop iterable `foo` during iteration +error[B909]: 105:5: Mutation to loop iterable `foo` during iteration + --> B909.py:105:5 | 103 | foo &= bar 104 | foo -= bar 105 | foo ^= bar | ^^^^^^^^^^ | -error[B909]: B909.py:125:5: Mutation to loop iterable `foo` during iteration +error[B909]: 125:5: Mutation to loop iterable `foo` during iteration + --> B909.py:125:5 | 123 | # should error (?) 124 | for _ in foo: @@ -311,8 +343,9 @@ error[B909]: B909.py:125:5: Mutation to loop iterable `foo` during iteration 126 | if bar: 127 | bar.remove(1) | -error[B909]: B909.py:136:9: Mutation to loop iterable `foo` during iteration +error[B909]: 136:9: Mutation to loop iterable `foo` during iteration + --> B909.py:136:9 | 134 | pass 135 | else: @@ -321,8 +354,9 @@ error[B909]: B909.py:136:9: Mutation to loop iterable `foo` during iteration 137 | 138 | # should error | -error[B909]: B909.py:140:8: Mutation to loop iterable `some_list` during iteration +error[B909]: 140:8: Mutation to loop iterable `some_list` during iteration + --> B909.py:140:8 | 138 | # should error 139 | for elem in some_list: @@ -330,8 +364,9 @@ error[B909]: B909.py:140:8: Mutation to loop iterable `some_list` during iterati | ^^^^^^^^^^^^^ 141 | pass | -error[B909]: B909.py:150:8: Mutation to loop iterable `some_list` during iteration +error[B909]: 150:8: Mutation to loop iterable `some_list` during iteration + --> B909.py:150:8 | 148 | # should error 149 | for elem in some_list: @@ -340,42 +375,46 @@ error[B909]: B909.py:150:8: Mutation to loop iterable `some_list` during iterati 151 | pass 152 | else: | +error[B909]: 157:5: Mutation to loop iterable `some_list` during iteration -B909.py:157:5: B909 Mutation to loop iterable `some_list` during iteration + --> B909.py:157:5 | 155 | # should error 156 | for elem in some_list: 157 | del some_list[elem] - | ^^^^^^^^^^^^^^^^^^^ B909 + | ^^^^^^^^^^^^^^^^^^^ 158 | some_list.remove(elem) 159 | some_list.discard(elem) | +error[B909]: 158:5: Mutation to loop iterable `some_list` during iteration -B909.py:158:5: B909 Mutation to loop iterable `some_list` during iteration + --> B909.py:158:5 | 156 | for elem in some_list: 157 | del some_list[elem] 158 | some_list.remove(elem) - | ^^^^^^^^^^^^^^^^ B909 + | ^^^^^^^^^^^^^^^^ 159 | some_list.discard(elem) | +error[B909]: 159:5: Mutation to loop iterable `some_list` during iteration -B909.py:159:5: B909 Mutation to loop iterable `some_list` during iteration + --> B909.py:159:5 | 157 | del some_list[elem] 158 | some_list.remove(elem) 159 | some_list.discard(elem) - | ^^^^^^^^^^^^^^^^^ B909 + | ^^^^^^^^^^^^^^^^^ 160 | 161 | # should not error | +error[B909]: 167:5: Mutation to loop iterable `some_list` during iteration -B909.py:167:5: B909 Mutation to loop iterable `some_list` during iteration + --> B909.py:167:5 | 165 | # should error 166 | for i, elem in enumerate(some_list): 167 | some_list.pop(0) - | ^^^^^^^^^^^^^ B909 + | ^^^^^^^^^^^^^ 168 | 169 | # should not error (list) | diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__extend_immutable_calls_arg_annotation.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__extend_immutable_calls_arg_annotation.snap index 04acd26de3..106c73c87f 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__extend_immutable_calls_arg_annotation.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__extend_immutable_calls_arg_annotation.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs --- -error[B006]: B006_extended.py:17:55: [*] Do not use mutable data structures for argument defaults +error[B006]: 17:55: [*] Do not use mutable data structures for argument defaults + --> B006_extended.py:17:55 | 17 | def error_due_to_missing_import(foo: ImmutableTypeA = []): | ^^ diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__extend_immutable_calls_arg_default.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__extend_immutable_calls_arg_default.snap index ee2df58bf9..1395e2d98d 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__extend_immutable_calls_arg_default.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__extend_immutable_calls_arg_default.snap @@ -1,15 +1,17 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs --- -error[B008]: B008_extended.py:24:51: Do not perform function call `Depends` in argument defaults; instead, perform the call within the function, or read the default from a module-level singleton variable +error[B008]: 24:51: Do not perform function call `Depends` in argument defaults; instead, perform the call within the function, or read the default from a module-level singleton variable + --> B008_extended.py:24:51 | 24 | def error_due_to_missing_import(data: List[str] = Depends(None)): | ^^^^^^^^^^^^^ 25 | ... | -error[B008]: B008_extended.py:36:15: Do not perform function call `OtherClass` in argument defaults; instead, perform the call within the function, or read the default from a module-level singleton variable +error[B008]: 36:15: Do not perform function call `OtherClass` in argument defaults; instead, perform the call within the function, or read the default from a module-level singleton variable + --> B008_extended.py:36:15 | 36 | def error(obj=OtherClass()): | ^^^^^^^^^^^^ diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__extend_mutable_contextvar_default.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__extend_mutable_contextvar_default.snap index d03f11124f..393501f463 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__extend_mutable_contextvar_default.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__extend_mutable_contextvar_default.snap @@ -1,10 +1,12 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs --- -B039_extended.py:7:26: B039 Do not use mutable data structures for `ContextVar` defaults +error[B039]: 7:26: Do not use mutable data structures for `ContextVar` defaults + + --> B039_extended.py:7:26 | 6 | from something_else import Depends 7 | ContextVar("cv", default=Depends()) - | ^^^^^^^^^ B039 + | ^^^^^^^^^ | = help: Replace with `None`; initialize with `.set()`` diff --git a/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A001_A001.py.snap b/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A001_A001.py.snap index 489f88d885..52475a1c55 100644 --- a/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A001_A001.py.snap +++ b/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A001_A001.py.snap @@ -1,24 +1,27 @@ --- source: crates/ruff_linter/src/rules/flake8_builtins/mod.rs --- -error[A001]: A001.py:1:16: Variable `sum` is shadowing a Python builtin +error[A001]: 1:16: Variable `sum` is shadowing a Python builtin + --> A001.py:1:16 | 1 | import some as sum | ^^^ 2 | from some import other as int 3 | from directory import new as dir | -error[A001]: A001.py:2:27: Variable `int` is shadowing a Python builtin +error[A001]: 2:27: Variable `int` is shadowing a Python builtin + --> A001.py:2:27 | 1 | import some as sum 2 | from some import other as int | ^^^ 3 | from directory import new as dir | -error[A001]: A001.py:3:30: Variable `dir` is shadowing a Python builtin +error[A001]: 3:30: Variable `dir` is shadowing a Python builtin + --> A001.py:3:30 | 1 | import some as sum 2 | from some import other as int @@ -27,8 +30,9 @@ error[A001]: A001.py:3:30: Variable `dir` is shadowing a Python builtin 4 | 5 | print = 1 | -error[A001]: A001.py:5:1: Variable `print` is shadowing a Python builtin +error[A001]: 5:1: Variable `print` is shadowing a Python builtin + --> A001.py:4:1 | 3 | from directory import new as dir 4 | @@ -37,8 +41,9 @@ error[A001]: A001.py:5:1: Variable `print` is shadowing a Python builtin 6 | copyright: 'annotation' = 2 7 | (complex := 3) | -error[A001]: A001.py:6:1: Variable `copyright` is shadowing a Python builtin +error[A001]: 6:1: Variable `copyright` is shadowing a Python builtin + --> A001.py:5:10 | 5 | print = 1 6 | copyright: 'annotation' = 2 @@ -46,8 +51,9 @@ error[A001]: A001.py:6:1: Variable `copyright` is shadowing a Python builtin 7 | (complex := 3) 8 | float = object = 4 | -error[A001]: A001.py:7:2: Variable `complex` is shadowing a Python builtin +error[A001]: 7:2: Variable `complex` is shadowing a Python builtin + --> A001.py:7:2 | 5 | print = 1 6 | copyright: 'annotation' = 2 @@ -56,8 +62,9 @@ error[A001]: A001.py:7:2: Variable `complex` is shadowing a Python builtin 8 | float = object = 4 9 | min, max = 5, 6 | -error[A001]: A001.py:8:1: Variable `float` is shadowing a Python builtin +error[A001]: 8:1: Variable `float` is shadowing a Python builtin + --> A001.py:7:15 | 6 | copyright: 'annotation' = 2 7 | (complex := 3) @@ -65,8 +72,9 @@ error[A001]: A001.py:8:1: Variable `float` is shadowing a Python builtin | ^^^^^ 9 | min, max = 5, 6 | -error[A001]: A001.py:8:9: Variable `object` is shadowing a Python builtin +error[A001]: 8:9: Variable `object` is shadowing a Python builtin + --> A001.py:8:9 | 6 | copyright: 'annotation' = 2 7 | (complex := 3) @@ -74,8 +82,9 @@ error[A001]: A001.py:8:9: Variable `object` is shadowing a Python builtin | ^^^^^^ 9 | min, max = 5, 6 | -error[A001]: A001.py:9:1: Variable `min` is shadowing a Python builtin +error[A001]: 9:1: Variable `min` is shadowing a Python builtin + --> A001.py:8:19 | 7 | (complex := 3) 8 | float = object = 4 @@ -84,8 +93,9 @@ error[A001]: A001.py:9:1: Variable `min` is shadowing a Python builtin 10 | 11 | id = 4 | -error[A001]: A001.py:9:6: Variable `max` is shadowing a Python builtin +error[A001]: 9:6: Variable `max` is shadowing a Python builtin + --> A001.py:9:6 | 7 | (complex := 3) 8 | float = object = 4 @@ -94,8 +104,9 @@ error[A001]: A001.py:9:6: Variable `max` is shadowing a Python builtin 10 | 11 | id = 4 | -error[A001]: A001.py:11:1: Variable `id` is shadowing a Python builtin +error[A001]: 11:1: Variable `id` is shadowing a Python builtin + --> A001.py:10:1 | 9 | min, max = 5, 6 10 | @@ -104,8 +115,9 @@ error[A001]: A001.py:11:1: Variable `id` is shadowing a Python builtin 12 | 13 | def bytes(): | -error[A001]: A001.py:13:5: Variable `bytes` is shadowing a Python builtin +error[A001]: 13:5: Variable `bytes` is shadowing a Python builtin + --> A001.py:13:5 | 11 | id = 4 12 | @@ -113,8 +125,9 @@ error[A001]: A001.py:13:5: Variable `bytes` is shadowing a Python builtin | ^^^^^ 14 | pass | -error[A001]: A001.py:16:7: Variable `slice` is shadowing a Python builtin +error[A001]: 16:7: Variable `slice` is shadowing a Python builtin + --> A001.py:16:7 | 14 | pass 15 | @@ -122,8 +135,9 @@ error[A001]: A001.py:16:7: Variable `slice` is shadowing a Python builtin | ^^^^^ 17 | pass | -error[A001]: A001.py:21:23: Variable `ValueError` is shadowing a Python builtin +error[A001]: 21:23: Variable `ValueError` is shadowing a Python builtin + --> A001.py:21:23 | 19 | try: 20 | ... @@ -131,8 +145,9 @@ error[A001]: A001.py:21:23: Variable `ValueError` is shadowing a Python builtin | ^^^^^^^^^^ 22 | ... | -error[A001]: A001.py:24:5: Variable `memoryview` is shadowing a Python builtin +error[A001]: 24:5: Variable `memoryview` is shadowing a Python builtin + --> A001.py:24:5 | 22 | ... 23 | @@ -140,8 +155,9 @@ error[A001]: A001.py:24:5: Variable `memoryview` is shadowing a Python builtin | ^^^^^^^^^^ 25 | pass | -error[A001]: A001.py:24:18: Variable `bytearray` is shadowing a Python builtin +error[A001]: 24:18: Variable `bytearray` is shadowing a Python builtin + --> A001.py:24:18 | 22 | ... 23 | @@ -149,8 +165,9 @@ error[A001]: A001.py:24:18: Variable `bytearray` is shadowing a Python builtin | ^^^^^^^^^ 25 | pass | -error[A001]: A001.py:27:22: Variable `str` is shadowing a Python builtin +error[A001]: 27:22: Variable `str` is shadowing a Python builtin + --> A001.py:27:22 | 25 | pass 26 | @@ -158,8 +175,9 @@ error[A001]: A001.py:27:22: Variable `str` is shadowing a Python builtin | ^^^ 28 | pass | -error[A001]: A001.py:27:45: Variable `all` is shadowing a Python builtin +error[A001]: 27:45: Variable `all` is shadowing a Python builtin + --> A001.py:27:45 | 25 | pass 26 | @@ -167,8 +185,9 @@ error[A001]: A001.py:27:45: Variable `all` is shadowing a Python builtin | ^^^ 28 | pass | -error[A001]: A001.py:27:50: Variable `any` is shadowing a Python builtin +error[A001]: 27:50: Variable `any` is shadowing a Python builtin + --> A001.py:27:50 | 25 | pass 26 | @@ -176,8 +195,9 @@ error[A001]: A001.py:27:50: Variable `any` is shadowing a Python builtin | ^^^ 28 | pass | -error[A001]: A001.py:30:8: Variable `sum` is shadowing a Python builtin +error[A001]: 30:8: Variable `sum` is shadowing a Python builtin + --> A001.py:30:8 | 28 | pass 29 | diff --git a/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A001_A001.py_builtins_ignorelist.snap b/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A001_A001.py_builtins_ignorelist.snap index 5f13f6e896..67111f0b84 100644 --- a/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A001_A001.py_builtins_ignorelist.snap +++ b/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A001_A001.py_builtins_ignorelist.snap @@ -1,24 +1,27 @@ --- source: crates/ruff_linter/src/rules/flake8_builtins/mod.rs --- -error[A001]: A001.py:1:16: Variable `sum` is shadowing a Python builtin +error[A001]: 1:16: Variable `sum` is shadowing a Python builtin + --> A001.py:1:16 | 1 | import some as sum | ^^^ 2 | from some import other as int 3 | from directory import new as dir | -error[A001]: A001.py:2:27: Variable `int` is shadowing a Python builtin +error[A001]: 2:27: Variable `int` is shadowing a Python builtin + --> A001.py:2:27 | 1 | import some as sum 2 | from some import other as int | ^^^ 3 | from directory import new as dir | -error[A001]: A001.py:5:1: Variable `print` is shadowing a Python builtin +error[A001]: 5:1: Variable `print` is shadowing a Python builtin + --> A001.py:4:1 | 3 | from directory import new as dir 4 | @@ -27,8 +30,9 @@ error[A001]: A001.py:5:1: Variable `print` is shadowing a Python builtin 6 | copyright: 'annotation' = 2 7 | (complex := 3) | -error[A001]: A001.py:6:1: Variable `copyright` is shadowing a Python builtin +error[A001]: 6:1: Variable `copyright` is shadowing a Python builtin + --> A001.py:5:10 | 5 | print = 1 6 | copyright: 'annotation' = 2 @@ -36,8 +40,9 @@ error[A001]: A001.py:6:1: Variable `copyright` is shadowing a Python builtin 7 | (complex := 3) 8 | float = object = 4 | -error[A001]: A001.py:7:2: Variable `complex` is shadowing a Python builtin +error[A001]: 7:2: Variable `complex` is shadowing a Python builtin + --> A001.py:7:2 | 5 | print = 1 6 | copyright: 'annotation' = 2 @@ -46,8 +51,9 @@ error[A001]: A001.py:7:2: Variable `complex` is shadowing a Python builtin 8 | float = object = 4 9 | min, max = 5, 6 | -error[A001]: A001.py:8:1: Variable `float` is shadowing a Python builtin +error[A001]: 8:1: Variable `float` is shadowing a Python builtin + --> A001.py:7:15 | 6 | copyright: 'annotation' = 2 7 | (complex := 3) @@ -55,8 +61,9 @@ error[A001]: A001.py:8:1: Variable `float` is shadowing a Python builtin | ^^^^^ 9 | min, max = 5, 6 | -error[A001]: A001.py:8:9: Variable `object` is shadowing a Python builtin +error[A001]: 8:9: Variable `object` is shadowing a Python builtin + --> A001.py:8:9 | 6 | copyright: 'annotation' = 2 7 | (complex := 3) @@ -64,8 +71,9 @@ error[A001]: A001.py:8:9: Variable `object` is shadowing a Python builtin | ^^^^^^ 9 | min, max = 5, 6 | -error[A001]: A001.py:9:1: Variable `min` is shadowing a Python builtin +error[A001]: 9:1: Variable `min` is shadowing a Python builtin + --> A001.py:8:19 | 7 | (complex := 3) 8 | float = object = 4 @@ -74,8 +82,9 @@ error[A001]: A001.py:9:1: Variable `min` is shadowing a Python builtin 10 | 11 | id = 4 | -error[A001]: A001.py:9:6: Variable `max` is shadowing a Python builtin +error[A001]: 9:6: Variable `max` is shadowing a Python builtin + --> A001.py:9:6 | 7 | (complex := 3) 8 | float = object = 4 @@ -84,8 +93,9 @@ error[A001]: A001.py:9:6: Variable `max` is shadowing a Python builtin 10 | 11 | id = 4 | -error[A001]: A001.py:13:5: Variable `bytes` is shadowing a Python builtin +error[A001]: 13:5: Variable `bytes` is shadowing a Python builtin + --> A001.py:13:5 | 11 | id = 4 12 | @@ -93,8 +103,9 @@ error[A001]: A001.py:13:5: Variable `bytes` is shadowing a Python builtin | ^^^^^ 14 | pass | -error[A001]: A001.py:16:7: Variable `slice` is shadowing a Python builtin +error[A001]: 16:7: Variable `slice` is shadowing a Python builtin + --> A001.py:16:7 | 14 | pass 15 | @@ -102,8 +113,9 @@ error[A001]: A001.py:16:7: Variable `slice` is shadowing a Python builtin | ^^^^^ 17 | pass | -error[A001]: A001.py:21:23: Variable `ValueError` is shadowing a Python builtin +error[A001]: 21:23: Variable `ValueError` is shadowing a Python builtin + --> A001.py:21:23 | 19 | try: 20 | ... @@ -111,8 +123,9 @@ error[A001]: A001.py:21:23: Variable `ValueError` is shadowing a Python builtin | ^^^^^^^^^^ 22 | ... | -error[A001]: A001.py:24:5: Variable `memoryview` is shadowing a Python builtin +error[A001]: 24:5: Variable `memoryview` is shadowing a Python builtin + --> A001.py:24:5 | 22 | ... 23 | @@ -120,8 +133,9 @@ error[A001]: A001.py:24:5: Variable `memoryview` is shadowing a Python builtin | ^^^^^^^^^^ 25 | pass | -error[A001]: A001.py:24:18: Variable `bytearray` is shadowing a Python builtin +error[A001]: 24:18: Variable `bytearray` is shadowing a Python builtin + --> A001.py:24:18 | 22 | ... 23 | @@ -129,8 +143,9 @@ error[A001]: A001.py:24:18: Variable `bytearray` is shadowing a Python builtin | ^^^^^^^^^ 25 | pass | -error[A001]: A001.py:27:22: Variable `str` is shadowing a Python builtin +error[A001]: 27:22: Variable `str` is shadowing a Python builtin + --> A001.py:27:22 | 25 | pass 26 | @@ -138,8 +153,9 @@ error[A001]: A001.py:27:22: Variable `str` is shadowing a Python builtin | ^^^ 28 | pass | -error[A001]: A001.py:27:45: Variable `all` is shadowing a Python builtin +error[A001]: 27:45: Variable `all` is shadowing a Python builtin + --> A001.py:27:45 | 25 | pass 26 | @@ -147,8 +163,9 @@ error[A001]: A001.py:27:45: Variable `all` is shadowing a Python builtin | ^^^ 28 | pass | -error[A001]: A001.py:27:50: Variable `any` is shadowing a Python builtin +error[A001]: 27:50: Variable `any` is shadowing a Python builtin + --> A001.py:27:50 | 25 | pass 26 | @@ -156,8 +173,9 @@ error[A001]: A001.py:27:50: Variable `any` is shadowing a Python builtin | ^^^ 28 | pass | -error[A001]: A001.py:30:8: Variable `sum` is shadowing a Python builtin +error[A001]: 30:8: Variable `sum` is shadowing a Python builtin + --> A001.py:30:8 | 28 | pass 29 | diff --git a/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A002_A002.py.snap b/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A002_A002.py.snap index b00ca145fc..72fd11febc 100644 --- a/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A002_A002.py.snap +++ b/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A002_A002.py.snap @@ -1,66 +1,76 @@ --- source: crates/ruff_linter/src/rules/flake8_builtins/mod.rs --- -A002.py:1:11: A002 Argument `str` is shadowing a Python builtin +error[A002]: 1:11: Argument `str` is shadowing a Python builtin + + --> A002.py:1:11 | 1 | def func1(str, /, type, *complex, Exception, **getattr): - | ^^^ A002 + | ^^^ 2 | pass | +error[A002]: 1:19: Argument `type` is shadowing a Python builtin -A002.py:1:19: A002 Argument `type` is shadowing a Python builtin + --> A002.py:1:19 | 1 | def func1(str, /, type, *complex, Exception, **getattr): - | ^^^^ A002 + | ^^^^ 2 | pass | +error[A002]: 1:26: Argument `complex` is shadowing a Python builtin -A002.py:1:26: A002 Argument `complex` is shadowing a Python builtin + --> A002.py:1:26 | 1 | def func1(str, /, type, *complex, Exception, **getattr): - | ^^^^^^^ A002 + | ^^^^^^^ 2 | pass | +error[A002]: 1:35: Argument `Exception` is shadowing a Python builtin -A002.py:1:35: A002 Argument `Exception` is shadowing a Python builtin + --> A002.py:1:35 | 1 | def func1(str, /, type, *complex, Exception, **getattr): - | ^^^^^^^^^ A002 + | ^^^^^^^^^ 2 | pass | +error[A002]: 1:48: Argument `getattr` is shadowing a Python builtin -A002.py:1:48: A002 Argument `getattr` is shadowing a Python builtin + --> A002.py:1:48 | 1 | def func1(str, /, type, *complex, Exception, **getattr): - | ^^^^^^^ A002 + | ^^^^^^^ 2 | pass | +error[A002]: 5:17: Argument `bytes` is shadowing a Python builtin -A002.py:5:17: A002 Argument `bytes` is shadowing a Python builtin + --> A002.py:5:17 | 5 | async def func2(bytes): - | ^^^^^ A002 + | ^^^^^ 6 | pass | +error[A002]: 9:17: Argument `id` is shadowing a Python builtin -A002.py:9:17: A002 Argument `id` is shadowing a Python builtin + --> A002.py:9:17 | 9 | async def func3(id, dir): - | ^^ A002 + | ^^ 10 | pass | +error[A002]: 9:21: Argument `dir` is shadowing a Python builtin -A002.py:9:21: A002 Argument `dir` is shadowing a Python builtin + --> A002.py:9:21 | 9 | async def func3(id, dir): - | ^^^ A002 + | ^^^ 10 | pass | +error[A002]: 13:16: Argument `float` is shadowing a Python builtin -A002.py:13:16: A002 Argument `float` is shadowing a Python builtin + --> A002.py:13:16 | 13 | map([], lambda float: ...) - | ^^^^^ A002 + | ^^^^^ 14 | 15 | from typing import override, overload | diff --git a/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A002_A002.py_builtins_ignorelist.snap b/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A002_A002.py_builtins_ignorelist.snap index d562762596..ccd788616f 100644 --- a/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A002_A002.py_builtins_ignorelist.snap +++ b/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A002_A002.py_builtins_ignorelist.snap @@ -1,52 +1,60 @@ --- source: crates/ruff_linter/src/rules/flake8_builtins/mod.rs --- -A002.py:1:11: A002 Argument `str` is shadowing a Python builtin +error[A002]: 1:11: Argument `str` is shadowing a Python builtin + + --> A002.py:1:11 | 1 | def func1(str, /, type, *complex, Exception, **getattr): - | ^^^ A002 + | ^^^ 2 | pass | +error[A002]: 1:19: Argument `type` is shadowing a Python builtin -A002.py:1:19: A002 Argument `type` is shadowing a Python builtin + --> A002.py:1:19 | 1 | def func1(str, /, type, *complex, Exception, **getattr): - | ^^^^ A002 + | ^^^^ 2 | pass | +error[A002]: 1:26: Argument `complex` is shadowing a Python builtin -A002.py:1:26: A002 Argument `complex` is shadowing a Python builtin + --> A002.py:1:26 | 1 | def func1(str, /, type, *complex, Exception, **getattr): - | ^^^^^^^ A002 + | ^^^^^^^ 2 | pass | +error[A002]: 1:35: Argument `Exception` is shadowing a Python builtin -A002.py:1:35: A002 Argument `Exception` is shadowing a Python builtin + --> A002.py:1:35 | 1 | def func1(str, /, type, *complex, Exception, **getattr): - | ^^^^^^^^^ A002 + | ^^^^^^^^^ 2 | pass | +error[A002]: 1:48: Argument `getattr` is shadowing a Python builtin -A002.py:1:48: A002 Argument `getattr` is shadowing a Python builtin + --> A002.py:1:48 | 1 | def func1(str, /, type, *complex, Exception, **getattr): - | ^^^^^^^ A002 + | ^^^^^^^ 2 | pass | +error[A002]: 5:17: Argument `bytes` is shadowing a Python builtin -A002.py:5:17: A002 Argument `bytes` is shadowing a Python builtin + --> A002.py:5:17 | 5 | async def func2(bytes): - | ^^^^^ A002 + | ^^^^^ 6 | pass | +error[A002]: 13:16: Argument `float` is shadowing a Python builtin -A002.py:13:16: A002 Argument `float` is shadowing a Python builtin + --> A002.py:13:16 | 13 | map([], lambda float: ...) - | ^^^^^ A002 + | ^^^^^ 14 | 15 | from typing import override, overload | diff --git a/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A003_A003.py.snap b/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A003_A003.py.snap index e409831200..16b127383b 100644 --- a/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A003_A003.py.snap +++ b/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A003_A003.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_builtins/mod.rs --- -error[A003]: A003.py:17:31: Python builtin is shadowed by method `str` from line 14 +error[A003]: 17:31: Python builtin is shadowed by method `str` from line 14 + --> A003.py:17:31 | 15 | pass 16 | @@ -10,8 +11,9 @@ error[A003]: A003.py:17:31: Python builtin is shadowed by method `str` from line | ^^^ 18 | pass | -error[A003]: A003.py:20:34: Python builtin is shadowed by class attribute `id` from line 3 +error[A003]: 20:34: Python builtin is shadowed by class attribute `id` from line 3 + --> A003.py:20:34 | 18 | pass 19 | diff --git a/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A003_A003.py_builtins_ignorelist.snap b/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A003_A003.py_builtins_ignorelist.snap index d77f345b90..b3a85de88f 100644 --- a/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A003_A003.py_builtins_ignorelist.snap +++ b/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A003_A003.py_builtins_ignorelist.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_builtins/mod.rs --- -error[A003]: A003.py:17:31: Python builtin is shadowed by method `str` from line 14 +error[A003]: 17:31: Python builtin is shadowed by method `str` from line 14 + --> A003.py:17:31 | 15 | pass 16 | diff --git a/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A004_A004.py.snap b/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A004_A004.py.snap index a645772146..8292563da9 100644 --- a/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A004_A004.py.snap +++ b/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A004_A004.py.snap @@ -1,55 +1,62 @@ --- source: crates/ruff_linter/src/rules/flake8_builtins/mod.rs --- -A004.py:1:16: A004 Import `sum` is shadowing a Python builtin +error[A004]: 1:16: Import `sum` is shadowing a Python builtin + + --> A004.py:1:16 | 1 | import some as sum - | ^^^ A004 + | ^^^ 2 | import float 3 | from some import other as int | +error[A004]: 2:8: Import `float` is shadowing a Python builtin -A004.py:2:8: A004 Import `float` is shadowing a Python builtin + --> A004.py:2:8 | 1 | import some as sum 2 | import float - | ^^^^^ A004 + | ^^^^^ 3 | from some import other as int 4 | from some import input, exec | +error[A004]: 3:27: Import `int` is shadowing a Python builtin -A004.py:3:27: A004 Import `int` is shadowing a Python builtin + --> A004.py:3:27 | 1 | import some as sum 2 | import float 3 | from some import other as int - | ^^^ A004 + | ^^^ 4 | from some import input, exec 5 | from directory import new as dir | +error[A004]: 4:18: Import `input` is shadowing a Python builtin -A004.py:4:18: A004 Import `input` is shadowing a Python builtin + --> A004.py:4:18 | 2 | import float 3 | from some import other as int 4 | from some import input, exec - | ^^^^^ A004 + | ^^^^^ 5 | from directory import new as dir | +error[A004]: 4:25: Import `exec` is shadowing a Python builtin -A004.py:4:25: A004 Import `exec` is shadowing a Python builtin + --> A004.py:4:25 | 2 | import float 3 | from some import other as int 4 | from some import input, exec - | ^^^^ A004 + | ^^^^ 5 | from directory import new as dir | +error[A004]: 5:30: Import `dir` is shadowing a Python builtin -A004.py:5:30: A004 Import `dir` is shadowing a Python builtin + --> A004.py:5:30 | 3 | from some import other as int 4 | from some import input, exec 5 | from directory import new as dir - | ^^^ A004 + | ^^^ | diff --git a/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A004_A004.py_builtins_ignorelist.snap b/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A004_A004.py_builtins_ignorelist.snap index e9d130125b..667710e6f7 100644 --- a/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A004_A004.py_builtins_ignorelist.snap +++ b/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A004_A004.py_builtins_ignorelist.snap @@ -1,47 +1,53 @@ --- source: crates/ruff_linter/src/rules/flake8_builtins/mod.rs --- -A004.py:1:16: A004 Import `sum` is shadowing a Python builtin +error[A004]: 1:16: Import `sum` is shadowing a Python builtin + + --> A004.py:1:16 | 1 | import some as sum - | ^^^ A004 + | ^^^ 2 | import float 3 | from some import other as int | +error[A004]: 2:8: Import `float` is shadowing a Python builtin -A004.py:2:8: A004 Import `float` is shadowing a Python builtin + --> A004.py:2:8 | 1 | import some as sum 2 | import float - | ^^^^^ A004 + | ^^^^^ 3 | from some import other as int 4 | from some import input, exec | +error[A004]: 3:27: Import `int` is shadowing a Python builtin -A004.py:3:27: A004 Import `int` is shadowing a Python builtin + --> A004.py:3:27 | 1 | import some as sum 2 | import float 3 | from some import other as int - | ^^^ A004 + | ^^^ 4 | from some import input, exec 5 | from directory import new as dir | +error[A004]: 4:18: Import `input` is shadowing a Python builtin -A004.py:4:18: A004 Import `input` is shadowing a Python builtin + --> A004.py:4:18 | 2 | import float 3 | from some import other as int 4 | from some import input, exec - | ^^^^^ A004 + | ^^^^^ 5 | from directory import new as dir | +error[A004]: 4:25: Import `exec` is shadowing a Python builtin -A004.py:4:25: A004 Import `exec` is shadowing a Python builtin + --> A004.py:4:25 | 2 | import float 3 | from some import other as int 4 | from some import input, exec - | ^^^^ A004 + | ^^^^ 5 | from directory import new as dir | diff --git a/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A005_A005__modules__logging____init__.py.snap b/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A005_A005__modules__logging____init__.py.snap index 9f05f0aa76..c40fa382b2 100644 --- a/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A005_A005__modules__logging____init__.py.snap +++ b/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A005_A005__modules__logging____init__.py.snap @@ -1,4 +1,4 @@ --- source: crates/ruff_linter/src/rules/flake8_builtins/mod.rs --- -__init__.py:1:1: A005 Module `logging` is shadowing a Python builtin module +error[A005]: 1:1: Module `logging` is shadowing a Python builtin module diff --git a/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A005_A005__modules__package__bisect.py.snap b/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A005_A005__modules__package__bisect.py.snap index 3615ea4297..b5c278050a 100644 --- a/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A005_A005__modules__package__bisect.py.snap +++ b/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A005_A005__modules__package__bisect.py.snap @@ -1,4 +1,4 @@ --- source: crates/ruff_linter/src/rules/flake8_builtins/mod.rs --- -bisect.py:1:1: A005 Module `bisect` is shadowing a Python builtin module +error[A005]: 1:1: Module `bisect` is shadowing a Python builtin module diff --git a/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A005_A005__modules__package__bisect.py_builtins_allowed_modules.snap b/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A005_A005__modules__package__bisect.py_builtins_allowed_modules.snap index 3615ea4297..b5c278050a 100644 --- a/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A005_A005__modules__package__bisect.py_builtins_allowed_modules.snap +++ b/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A005_A005__modules__package__bisect.py_builtins_allowed_modules.snap @@ -1,4 +1,4 @@ --- source: crates/ruff_linter/src/rules/flake8_builtins/mod.rs --- -bisect.py:1:1: A005 Module `bisect` is shadowing a Python builtin module +error[A005]: 1:1: Module `bisect` is shadowing a Python builtin module diff --git a/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A005_A005__modules__package__xml.py.snap b/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A005_A005__modules__package__xml.py.snap index 3fade6e0a3..c54b30436d 100644 --- a/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A005_A005__modules__package__xml.py.snap +++ b/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A005_A005__modules__package__xml.py.snap @@ -1,4 +1,4 @@ --- source: crates/ruff_linter/src/rules/flake8_builtins/mod.rs --- -xml.py:1:1: A005 Module `xml` is shadowing a Python builtin module +error[A005]: 1:1: Module `xml` is shadowing a Python builtin module diff --git a/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A005_A005__modules__string____init__.py.snap b/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A005_A005__modules__string____init__.py.snap index 69dc571b6f..a63235f4c8 100644 --- a/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A005_A005__modules__string____init__.py.snap +++ b/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A005_A005__modules__string____init__.py.snap @@ -1,4 +1,4 @@ --- source: crates/ruff_linter/src/rules/flake8_builtins/mod.rs --- -__init__.py:1:1: A005 Module `string` is shadowing a Python builtin module +error[A005]: 1:1: Module `string` is shadowing a Python builtin module diff --git a/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A005_A005__modules__string____init__.py_builtins_allowed_modules.snap b/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A005_A005__modules__string____init__.py_builtins_allowed_modules.snap index 69dc571b6f..a63235f4c8 100644 --- a/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A005_A005__modules__string____init__.py_builtins_allowed_modules.snap +++ b/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A005_A005__modules__string____init__.py_builtins_allowed_modules.snap @@ -1,4 +1,4 @@ --- source: crates/ruff_linter/src/rules/flake8_builtins/mod.rs --- -__init__.py:1:1: A005 Module `string` is shadowing a Python builtin module +error[A005]: 1:1: Module `string` is shadowing a Python builtin module diff --git a/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A006_A006.py.snap b/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A006_A006.py.snap index 14544a4f3d..0d58417b31 100644 --- a/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A006_A006.py.snap +++ b/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A006_A006.py.snap @@ -1,64 +1,72 @@ --- source: crates/ruff_linter/src/rules/flake8_builtins/mod.rs --- -A006.py:1:8: A006 Lambda argument `print` is shadowing a Python builtin +error[A006]: 1:8: Lambda argument `print` is shadowing a Python builtin + + --> A006.py:1:8 | 1 | lambda print, copyright: print - | ^^^^^ A006 + | ^^^^^ 2 | lambda x, float, y: x + y 3 | lambda min, max: min | +error[A006]: 1:15: Lambda argument `copyright` is shadowing a Python builtin -A006.py:1:15: A006 Lambda argument `copyright` is shadowing a Python builtin + --> A006.py:1:15 | 1 | lambda print, copyright: print - | ^^^^^^^^^ A006 + | ^^^^^^^^^ 2 | lambda x, float, y: x + y 3 | lambda min, max: min | +error[A006]: 2:11: Lambda argument `float` is shadowing a Python builtin -A006.py:2:11: A006 Lambda argument `float` is shadowing a Python builtin + --> A006.py:2:11 | 1 | lambda print, copyright: print 2 | lambda x, float, y: x + y - | ^^^^^ A006 + | ^^^^^ 3 | lambda min, max: min 4 | lambda id: id | +error[A006]: 3:8: Lambda argument `min` is shadowing a Python builtin -A006.py:3:8: A006 Lambda argument `min` is shadowing a Python builtin + --> A006.py:3:8 | 1 | lambda print, copyright: print 2 | lambda x, float, y: x + y 3 | lambda min, max: min - | ^^^ A006 + | ^^^ 4 | lambda id: id 5 | lambda dir: dir | +error[A006]: 3:13: Lambda argument `max` is shadowing a Python builtin -A006.py:3:13: A006 Lambda argument `max` is shadowing a Python builtin + --> A006.py:3:13 | 1 | lambda print, copyright: print 2 | lambda x, float, y: x + y 3 | lambda min, max: min - | ^^^ A006 + | ^^^ 4 | lambda id: id 5 | lambda dir: dir | +error[A006]: 4:8: Lambda argument `id` is shadowing a Python builtin -A006.py:4:8: A006 Lambda argument `id` is shadowing a Python builtin + --> A006.py:4:8 | 2 | lambda x, float, y: x + y 3 | lambda min, max: min 4 | lambda id: id - | ^^ A006 + | ^^ 5 | lambda dir: dir | +error[A006]: 5:8: Lambda argument `dir` is shadowing a Python builtin -A006.py:5:8: A006 Lambda argument `dir` is shadowing a Python builtin + --> A006.py:5:8 | 3 | lambda min, max: min 4 | lambda id: id 5 | lambda dir: dir - | ^^^ A006 + | ^^^ | diff --git a/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A006_A006.py_builtins_ignorelist.snap b/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A006_A006.py_builtins_ignorelist.snap index 2ac1bb621e..3ccb6b0fa8 100644 --- a/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A006_A006.py_builtins_ignorelist.snap +++ b/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A006_A006.py_builtins_ignorelist.snap @@ -1,47 +1,53 @@ --- source: crates/ruff_linter/src/rules/flake8_builtins/mod.rs --- -A006.py:1:8: A006 Lambda argument `print` is shadowing a Python builtin +error[A006]: 1:8: Lambda argument `print` is shadowing a Python builtin + + --> A006.py:1:8 | 1 | lambda print, copyright: print - | ^^^^^ A006 + | ^^^^^ 2 | lambda x, float, y: x + y 3 | lambda min, max: min | +error[A006]: 1:15: Lambda argument `copyright` is shadowing a Python builtin -A006.py:1:15: A006 Lambda argument `copyright` is shadowing a Python builtin + --> A006.py:1:15 | 1 | lambda print, copyright: print - | ^^^^^^^^^ A006 + | ^^^^^^^^^ 2 | lambda x, float, y: x + y 3 | lambda min, max: min | +error[A006]: 2:11: Lambda argument `float` is shadowing a Python builtin -A006.py:2:11: A006 Lambda argument `float` is shadowing a Python builtin + --> A006.py:2:11 | 1 | lambda print, copyright: print 2 | lambda x, float, y: x + y - | ^^^^^ A006 + | ^^^^^ 3 | lambda min, max: min 4 | lambda id: id | +error[A006]: 3:8: Lambda argument `min` is shadowing a Python builtin -A006.py:3:8: A006 Lambda argument `min` is shadowing a Python builtin + --> A006.py:3:8 | 1 | lambda print, copyright: print 2 | lambda x, float, y: x + y 3 | lambda min, max: min - | ^^^ A006 + | ^^^ 4 | lambda id: id 5 | lambda dir: dir | +error[A006]: 3:13: Lambda argument `max` is shadowing a Python builtin -A006.py:3:13: A006 Lambda argument `max` is shadowing a Python builtin + --> A006.py:3:13 | 1 | lambda print, copyright: print 2 | lambda x, float, y: x + y 3 | lambda min, max: min - | ^^^ A006 + | ^^^ 4 | lambda id: id 5 | lambda dir: dir | diff --git a/crates/ruff_linter/src/rules/flake8_commas/snapshots/ruff_linter__rules__flake8_commas__tests__COM81.py.snap b/crates/ruff_linter/src/rules/flake8_commas/snapshots/ruff_linter__rules__flake8_commas__tests__COM81.py.snap index 1955cf08d0..373d276979 100644 --- a/crates/ruff_linter/src/rules/flake8_commas/snapshots/ruff_linter__rules__flake8_commas__tests__COM81.py.snap +++ b/crates/ruff_linter/src/rules/flake8_commas/snapshots/ruff_linter__rules__flake8_commas__tests__COM81.py.snap @@ -1,17 +1,18 @@ --- source: crates/ruff_linter/src/rules/flake8_commas/mod.rs --- -COM81.py:4:18: COM812 [*] Trailing comma missing +error[COM812]: 4:18: [*] Trailing comma missing + + --> COM81.py:4:18 | 2 | bad_function_call( 3 | param1='test', 4 | param2='test' - | COM812 + | ^ 5 | ) 6 | # ==> bad_list.py <== | = help: Add trailing comma - ℹ Safe fix 1 1 | # ==> bad_function_call.py <== 2 2 | bad_function_call( @@ -22,16 +23,17 @@ COM81.py:4:18: COM812 [*] Trailing comma missing 6 6 | # ==> bad_list.py <== 7 7 | bad_list = [ -COM81.py:10:6: COM812 [*] Trailing comma missing +error[COM812]: 10:6: [*] Trailing comma missing + + --> COM81.py:10:6 | 8 | 1, 9 | 2, 10 | 3 - | COM812 + | ^ 11 | ] | = help: Add trailing comma - ℹ Safe fix 7 7 | bad_list = [ 8 8 | 1, @@ -42,17 +44,18 @@ COM81.py:10:6: COM812 [*] Trailing comma missing 12 12 | 13 13 | bad_list_with_comment = [ -COM81.py:16:6: COM812 [*] Trailing comma missing +error[COM812]: 16:6: [*] Trailing comma missing + + --> COM81.py:16:6 | 14 | 1, 15 | 2, 16 | 3 - | COM812 + | ^ 17 | # still needs a comma! 18 | ] | = help: Add trailing comma - ℹ Safe fix 13 13 | bad_list_with_comment = [ 14 14 | 1, @@ -63,15 +66,16 @@ COM81.py:16:6: COM812 [*] Trailing comma missing 18 18 | ] 19 19 | -COM81.py:23:6: COM812 [*] Trailing comma missing +error[COM812]: 23:6: [*] Trailing comma missing + + --> COM81.py:23:6 | 21 | 1, 22 | 2, 23 | 3 - | COM812 + | ^ | = help: Add trailing comma - ℹ Safe fix 20 20 | bad_list_with_extra_empty = [ 21 21 | 1, @@ -82,83 +86,91 @@ COM81.py:23:6: COM812 [*] Trailing comma missing 25 25 | 26 26 | -COM81.py:36:8: COM818 Trailing comma on bare tuple prohibited +error[COM818]: 36:8: Trailing comma on bare tuple prohibited + + --> COM81.py:36:8 | 34 | foo = (1,) 35 | 36 | foo = 1, - | ^ COM818 + | ^ 37 | 38 | bar = 1; foo = bar, | +error[COM818]: 38:19: Trailing comma on bare tuple prohibited -COM81.py:38:19: COM818 Trailing comma on bare tuple prohibited + --> COM81.py:38:19 | 36 | foo = 1, 37 | 38 | bar = 1; foo = bar, - | ^ COM818 + | ^ 39 | 40 | foo = ( | +error[COM818]: 45:8: Trailing comma on bare tuple prohibited -COM81.py:45:8: COM818 Trailing comma on bare tuple prohibited + --> COM81.py:45:8 | 43 | ) 44 | 45 | foo = 3, - | ^ COM818 + | ^ 46 | 47 | class A(object): | +error[COM818]: 49:10: Trailing comma on bare tuple prohibited -COM81.py:49:10: COM818 Trailing comma on bare tuple prohibited + --> COM81.py:49:10 | 47 | class A(object): 48 | foo = 3 49 | bar = 10, - | ^ COM818 + | ^ 50 | foo_bar = 2 | +error[COM818]: 56:32: Trailing comma on bare tuple prohibited -COM81.py:56:32: COM818 Trailing comma on bare tuple prohibited + --> COM81.py:56:32 | 54 | from foo import bar, baz 55 | 56 | group_by = function_call('arg'), - | ^ COM818 + | ^ 57 | 58 | group_by = ('foobar' * 3), | +error[COM818]: 58:26: Trailing comma on bare tuple prohibited -COM81.py:58:26: COM818 Trailing comma on bare tuple prohibited + --> COM81.py:58:26 | 56 | group_by = function_call('arg'), 57 | 58 | group_by = ('foobar' * 3), - | ^ COM818 + | ^ 59 | 60 | def foo(): | +error[COM818]: 61:17: Trailing comma on bare tuple prohibited -COM81.py:61:17: COM818 Trailing comma on bare tuple prohibited + --> COM81.py:61:17 | 60 | def foo(): 61 | return False, - | ^ COM818 + | ^ 62 | 63 | # ==> callable_before_parenth_form.py <== | +error[COM812]: 70:8: [*] Trailing comma missing -COM81.py:70:8: COM812 [*] Trailing comma missing + --> COM81.py:70:8 | 69 | {'foo': foo}['foo']( 70 | bar - | COM812 + | ^ 71 | ) | = help: Add trailing comma - ℹ Safe fix 67 67 | pass 68 68 | @@ -169,15 +181,16 @@ COM81.py:70:8: COM812 [*] Trailing comma missing 72 72 | 73 73 | {'foo': foo}['foo']( -COM81.py:78:8: COM812 [*] Trailing comma missing +error[COM812]: 78:8: [*] Trailing comma missing + + --> COM81.py:78:8 | 77 | (foo)( 78 | bar - | COM812 + | ^ 79 | ) | = help: Add trailing comma - ℹ Safe fix 75 75 | ) 76 76 | @@ -188,15 +201,16 @@ COM81.py:78:8: COM812 [*] Trailing comma missing 80 80 | 81 81 | (foo)[0]( -COM81.py:86:8: COM812 [*] Trailing comma missing +error[COM812]: 86:8: [*] Trailing comma missing + + --> COM81.py:86:8 | 85 | [foo][0]( 86 | bar - | COM812 + | ^ 87 | ) | = help: Add trailing comma - ℹ Safe fix 83 83 | ) 84 84 | @@ -207,16 +221,17 @@ COM81.py:86:8: COM812 [*] Trailing comma missing 88 88 | 89 89 | [foo][0]( -COM81.py:152:6: COM812 [*] Trailing comma missing +error[COM812]: 152:6: [*] Trailing comma missing + + --> COM81.py:152:6 | 150 | # ==> keyword_before_parenth_form/base_bad.py <== 151 | from x import ( 152 | y - | COM812 + | ^ 153 | ) | = help: Add trailing comma - ℹ Safe fix 149 149 | 150 150 | # ==> keyword_before_parenth_form/base_bad.py <== @@ -227,16 +242,17 @@ COM81.py:152:6: COM812 [*] Trailing comma missing 154 154 | 155 155 | assert( -COM81.py:158:11: COM812 [*] Trailing comma missing +error[COM812]: 158:11: [*] Trailing comma missing + + --> COM81.py:158:11 | 156 | SyntaxWarning, 157 | ThrownHere, 158 | Anyway - | COM812 + | ^ 159 | ) | = help: Add trailing comma - ℹ Safe fix 155 155 | assert( 156 156 | SyntaxWarning, @@ -247,17 +263,18 @@ COM81.py:158:11: COM812 [*] Trailing comma missing 160 160 | 161 161 | # async await is fine outside an async def -COM81.py:293:15: COM812 [*] Trailing comma missing +error[COM812]: 293:15: [*] Trailing comma missing + + --> COM81.py:293:15 | 291 | # ==> multiline_bad_dict.py <== 292 | multiline_bad_dict = { 293 | "bad": 123 - | COM812 + | ^ 294 | } 295 | # ==> multiline_bad_function_def.py <== | = help: Add trailing comma - ℹ Safe fix 290 290 | 291 291 | # ==> multiline_bad_dict.py <== @@ -268,17 +285,18 @@ COM81.py:293:15: COM812 [*] Trailing comma missing 295 295 | # ==> multiline_bad_function_def.py <== 296 296 | def func_good( -COM81.py:304:14: COM812 [*] Trailing comma missing +error[COM812]: 304:14: [*] Trailing comma missing + + --> COM81.py:304:14 | 302 | def func_bad( 303 | a = 3, 304 | b = 2 - | COM812 + | ^ 305 | ): 306 | pass | = help: Add trailing comma - ℹ Safe fix 301 301 | 302 302 | def func_bad( @@ -289,17 +307,18 @@ COM81.py:304:14: COM812 [*] Trailing comma missing 306 306 | pass 307 307 | -COM81.py:310:14: COM812 [*] Trailing comma missing +error[COM812]: 310:14: [*] Trailing comma missing + + --> COM81.py:310:14 | 308 | # ==> multiline_bad_function_one_param.py <== 309 | def func( 310 | a = 3 - | COM812 + | ^ 311 | ): 312 | pass | = help: Add trailing comma - ℹ Safe fix 307 307 | 308 308 | # ==> multiline_bad_function_one_param.py <== @@ -310,15 +329,16 @@ COM81.py:310:14: COM812 [*] Trailing comma missing 312 312 | pass 313 313 | -COM81.py:316:10: COM812 [*] Trailing comma missing +error[COM812]: 316:10: [*] Trailing comma missing + + --> COM81.py:316:10 | 315 | func( 316 | a = 3 - | COM812 + | ^ 317 | ) | = help: Add trailing comma - ℹ Safe fix 313 313 | 314 314 | @@ -329,16 +349,17 @@ COM81.py:316:10: COM812 [*] Trailing comma missing 318 318 | 319 319 | # ==> multiline_bad_or_dict.py <== -COM81.py:322:15: COM812 [*] Trailing comma missing +error[COM812]: 322:15: [*] Trailing comma missing + + --> COM81.py:322:15 | 320 | multiline_bad_or_dict = { 321 | "good": True or False, 322 | "bad": 123 - | COM812 + | ^ 323 | } | = help: Add trailing comma - ℹ Safe fix 319 319 | # ==> multiline_bad_or_dict.py <== 320 320 | multiline_bad_or_dict = { @@ -349,16 +370,17 @@ COM81.py:322:15: COM812 [*] Trailing comma missing 324 324 | 325 325 | # ==> multiline_good_dict.py <== -COM81.py:368:15: COM812 [*] Trailing comma missing +error[COM812]: 368:15: [*] Trailing comma missing + + --> COM81.py:368:15 | 366 | multiline_index_access[ 367 | "probably fine", 368 | "not good" - | COM812 + | ^ 369 | ] | = help: Add trailing comma - ℹ Safe fix 365 365 | 366 366 | multiline_index_access[ @@ -369,16 +391,17 @@ COM81.py:368:15: COM812 [*] Trailing comma missing 370 370 | 371 371 | multiline_index_access[ -COM81.py:375:15: COM812 [*] Trailing comma missing +error[COM812]: 375:15: [*] Trailing comma missing + + --> COM81.py:375:15 | 373 | "fine", 374 | : 375 | "not good" - | COM812 + | ^ 376 | ] | = help: Add trailing comma - ℹ Safe fix 372 372 | "fine", 373 373 | "fine", @@ -389,16 +412,17 @@ COM81.py:375:15: COM812 [*] Trailing comma missing 377 377 | 378 378 | # ==> multiline_string.py <== -COM81.py:404:15: COM812 [*] Trailing comma missing +error[COM812]: 404:15: [*] Trailing comma missing + + --> COM81.py:404:15 | 402 | "fine" 403 | : 404 | "not fine" - | COM812 + | ^ 405 | ] | = help: Add trailing comma - ℹ Safe fix 401 401 | "fine", 402 402 | "fine" @@ -409,16 +433,17 @@ COM81.py:404:15: COM812 [*] Trailing comma missing 406 406 | 407 407 | multiline_index_access[ -COM81.py:432:15: COM812 [*] Trailing comma missing +error[COM812]: 432:15: [*] Trailing comma missing + + --> COM81.py:432:15 | 430 | : 431 | "fine", 432 | "not fine" - | COM812 + | ^ 433 | ] | = help: Add trailing comma - ℹ Safe fix 429 429 | "fine" 430 430 | : @@ -429,16 +454,17 @@ COM81.py:432:15: COM812 [*] Trailing comma missing 434 434 | 435 435 | multiline_index_access[ -COM81.py:485:21: COM819 [*] Trailing comma prohibited +error[COM819]: 485:21: [*] Trailing comma prohibited + + --> COM81.py:485:21 | 484 | # ==> prohibited.py <== 485 | foo = ['a', 'b', 'c',] - | ^ COM819 + | ^ 486 | 487 | bar = { a: b,} | = help: Remove trailing comma - ℹ Safe fix 482 482 | ) 483 483 | @@ -449,17 +475,18 @@ COM81.py:485:21: COM819 [*] Trailing comma prohibited 487 487 | bar = { a: b,} 488 488 | -COM81.py:487:13: COM819 [*] Trailing comma prohibited +error[COM819]: 487:13: [*] Trailing comma prohibited + + --> COM81.py:487:13 | 485 | foo = ['a', 'b', 'c',] 486 | 487 | bar = { a: b,} - | ^ COM819 + | ^ 488 | 489 | def bah(ham, spam,): | = help: Remove trailing comma - ℹ Safe fix 484 484 | # ==> prohibited.py <== 485 485 | foo = ['a', 'b', 'c',] @@ -470,16 +497,17 @@ COM81.py:487:13: COM819 [*] Trailing comma prohibited 489 489 | def bah(ham, spam,): 490 490 | pass -COM81.py:489:18: COM819 [*] Trailing comma prohibited +error[COM819]: 489:18: [*] Trailing comma prohibited + + --> COM81.py:489:18 | 487 | bar = { a: b,} 488 | 489 | def bah(ham, spam,): - | ^ COM819 + | ^ 490 | pass | = help: Remove trailing comma - ℹ Safe fix 486 486 | 487 487 | bar = { a: b,} @@ -490,17 +518,18 @@ COM81.py:489:18: COM819 [*] Trailing comma prohibited 491 491 | 492 492 | (0,) -COM81.py:494:6: COM819 [*] Trailing comma prohibited +error[COM819]: 494:6: [*] Trailing comma prohibited + + --> COM81.py:494:6 | 492 | (0,) 493 | 494 | (0, 1,) - | ^ COM819 + | ^ 495 | 496 | foo = ['a', 'b', 'c', ] | = help: Remove trailing comma - ℹ Safe fix 491 491 | 492 492 | (0,) @@ -511,17 +540,18 @@ COM81.py:494:6: COM819 [*] Trailing comma prohibited 496 496 | foo = ['a', 'b', 'c', ] 497 497 | -COM81.py:496:21: COM819 [*] Trailing comma prohibited +error[COM819]: 496:21: [*] Trailing comma prohibited + + --> COM81.py:496:21 | 494 | (0, 1,) 495 | 496 | foo = ['a', 'b', 'c', ] - | ^ COM819 + | ^ 497 | 498 | bar = { a: b, } | = help: Remove trailing comma - ℹ Safe fix 493 493 | 494 494 | (0, 1,) @@ -532,17 +562,18 @@ COM81.py:496:21: COM819 [*] Trailing comma prohibited 498 498 | bar = { a: b, } 499 499 | -COM81.py:498:13: COM819 [*] Trailing comma prohibited +error[COM819]: 498:13: [*] Trailing comma prohibited + + --> COM81.py:498:13 | 496 | foo = ['a', 'b', 'c', ] 497 | 498 | bar = { a: b, } - | ^ COM819 + | ^ 499 | 500 | def bah(ham, spam, ): | = help: Remove trailing comma - ℹ Safe fix 495 495 | 496 496 | foo = ['a', 'b', 'c', ] @@ -553,16 +584,17 @@ COM81.py:498:13: COM819 [*] Trailing comma prohibited 500 500 | def bah(ham, spam, ): 501 501 | pass -COM81.py:500:18: COM819 [*] Trailing comma prohibited +error[COM819]: 500:18: [*] Trailing comma prohibited + + --> COM81.py:500:18 | 498 | bar = { a: b, } 499 | 500 | def bah(ham, spam, ): - | ^ COM819 + | ^ 501 | pass | = help: Remove trailing comma - ℹ Safe fix 497 497 | 498 498 | bar = { a: b, } @@ -573,17 +605,18 @@ COM81.py:500:18: COM819 [*] Trailing comma prohibited 502 502 | 503 503 | (0, ) -COM81.py:505:6: COM819 [*] Trailing comma prohibited +error[COM819]: 505:6: [*] Trailing comma prohibited + + --> COM81.py:505:6 | 503 | (0, ) 504 | 505 | (0, 1, ) - | ^ COM819 + | ^ 506 | 507 | image[:, :, 0] | = help: Remove trailing comma - ℹ Safe fix 502 502 | 503 503 | (0, ) @@ -594,17 +627,18 @@ COM81.py:505:6: COM819 [*] Trailing comma prohibited 507 507 | image[:, :, 0] 508 508 | -COM81.py:511:10: COM819 [*] Trailing comma prohibited +error[COM819]: 511:10: [*] Trailing comma prohibited + + --> COM81.py:511:10 | 509 | image[:,] 510 | 511 | image[:,:,] - | ^ COM819 + | ^ 512 | 513 | lambda x, : x | = help: Remove trailing comma - ℹ Safe fix 508 508 | 509 509 | image[:,] @@ -615,17 +649,18 @@ COM81.py:511:10: COM819 [*] Trailing comma prohibited 513 513 | lambda x, : x 514 514 | -COM81.py:513:9: COM819 [*] Trailing comma prohibited +error[COM819]: 513:9: [*] Trailing comma prohibited + + --> COM81.py:513:9 | 511 | image[:,:,] 512 | 513 | lambda x, : x - | ^ COM819 + | ^ 514 | 515 | # ==> unpack.py <== | = help: Remove trailing comma - ℹ Safe fix 510 510 | 511 511 | image[:,:,] @@ -636,17 +671,18 @@ COM81.py:513:9: COM819 [*] Trailing comma prohibited 515 515 | # ==> unpack.py <== 516 516 | def function( -COM81.py:519:13: COM812 [*] Trailing comma missing +error[COM812]: 519:13: [*] Trailing comma missing + + --> COM81.py:519:13 | 517 | foo, 518 | bar, 519 | **kwargs - | COM812 + | ^ 520 | ): 521 | pass | = help: Add trailing comma - ℹ Safe fix 516 516 | def function( 517 517 | foo, @@ -657,17 +693,18 @@ COM81.py:519:13: COM812 [*] Trailing comma missing 521 521 | pass 522 522 | -COM81.py:526:10: COM812 [*] Trailing comma missing +error[COM812]: 526:10: [*] Trailing comma missing + + --> COM81.py:526:10 | 524 | foo, 525 | bar, 526 | *args - | COM812 + | ^ 527 | ): 528 | pass | = help: Add trailing comma - ℹ Safe fix 523 523 | def function( 524 524 | foo, @@ -678,17 +715,18 @@ COM81.py:526:10: COM812 [*] Trailing comma missing 528 528 | pass 529 529 | -COM81.py:534:16: COM812 [*] Trailing comma missing +error[COM812]: 534:16: [*] Trailing comma missing + + --> COM81.py:534:16 | 532 | bar, 533 | *args, 534 | extra_kwarg - | COM812 + | ^ 535 | ): 536 | pass | = help: Add trailing comma - ℹ Safe fix 531 531 | foo, 532 532 | bar, @@ -699,16 +737,17 @@ COM81.py:534:16: COM812 [*] Trailing comma missing 536 536 | pass 537 537 | -COM81.py:541:13: COM812 [*] Trailing comma missing +error[COM812]: 541:13: [*] Trailing comma missing + + --> COM81.py:541:13 | 539 | foo, 540 | bar, 541 | **kwargs - | COM812 + | ^ 542 | ) | = help: Add trailing comma - ℹ Safe fix 538 538 | result = function( 539 539 | foo, @@ -719,16 +758,17 @@ COM81.py:541:13: COM812 [*] Trailing comma missing 543 543 | 544 544 | result = function( -COM81.py:547:24: COM812 [*] Trailing comma missing +error[COM812]: 547:24: [*] Trailing comma missing + + --> COM81.py:547:24 | 545 | foo, 546 | bar, 547 | **not_called_kwargs - | COM812 + | ^ 548 | ) | = help: Add trailing comma - ℹ Safe fix 544 544 | result = function( 545 545 | foo, @@ -739,17 +779,18 @@ COM81.py:547:24: COM812 [*] Trailing comma missing 549 549 | 550 550 | def foo( -COM81.py:554:15: COM812 [*] Trailing comma missing +error[COM812]: 554:15: [*] Trailing comma missing + + --> COM81.py:554:15 | 552 | spam, 553 | *args, 554 | kwarg_only - | COM812 + | ^ 555 | ): 556 | pass | = help: Add trailing comma - ℹ Safe fix 551 551 | ham, 552 552 | spam, @@ -760,15 +801,16 @@ COM81.py:554:15: COM812 [*] Trailing comma missing 556 556 | pass 557 557 | -COM81.py:561:13: COM812 [*] Trailing comma missing +error[COM812]: 561:13: [*] Trailing comma missing + + --> COM81.py:561:13 | 560 | foo( 561 | **kwargs - | COM812 + | ^ 562 | ) | = help: Add trailing comma - ℹ Safe fix 558 558 | # In python 3.5 if it's not a function def, commas are mandatory. 559 559 | @@ -779,15 +821,16 @@ COM81.py:561:13: COM812 [*] Trailing comma missing 563 563 | 564 564 | { -COM81.py:565:13: COM812 [*] Trailing comma missing +error[COM812]: 565:13: [*] Trailing comma missing + + --> COM81.py:565:13 | 564 | { 565 | **kwargs - | COM812 + | ^ 566 | } | = help: Add trailing comma - ℹ Safe fix 562 562 | ) 563 563 | @@ -798,15 +841,16 @@ COM81.py:565:13: COM812 [*] Trailing comma missing 567 567 | 568 568 | { -COM81.py:569:10: COM812 [*] Trailing comma missing +error[COM812]: 569:10: [*] Trailing comma missing + + --> COM81.py:569:10 | 568 | { 569 | *args - | COM812 + | ^ 570 | } | = help: Add trailing comma - ℹ Safe fix 566 566 | } 567 567 | @@ -817,15 +861,16 @@ COM81.py:569:10: COM812 [*] Trailing comma missing 571 571 | 572 572 | [ -COM81.py:573:10: COM812 [*] Trailing comma missing +error[COM812]: 573:10: [*] Trailing comma missing + + --> COM81.py:573:10 | 572 | [ 573 | *args - | COM812 + | ^ 574 | ] | = help: Add trailing comma - ℹ Safe fix 570 570 | } 571 571 | @@ -836,17 +881,18 @@ COM81.py:573:10: COM812 [*] Trailing comma missing 575 575 | 576 576 | def foo( -COM81.py:579:10: COM812 [*] Trailing comma missing +error[COM812]: 579:10: [*] Trailing comma missing + + --> COM81.py:579:10 | 577 | ham, 578 | spam, 579 | *args - | COM812 + | ^ 580 | ): 581 | pass | = help: Add trailing comma - ℹ Safe fix 576 576 | def foo( 577 577 | ham, @@ -857,17 +903,18 @@ COM81.py:579:10: COM812 [*] Trailing comma missing 581 581 | pass 582 582 | -COM81.py:586:13: COM812 [*] Trailing comma missing +error[COM812]: 586:13: [*] Trailing comma missing + + --> COM81.py:586:13 | 584 | ham, 585 | spam, 586 | **kwargs - | COM812 + | ^ 587 | ): 588 | pass | = help: Add trailing comma - ℹ Safe fix 583 583 | def foo( 584 584 | ham, @@ -878,17 +925,18 @@ COM81.py:586:13: COM812 [*] Trailing comma missing 588 588 | pass 589 589 | -COM81.py:594:15: COM812 [*] Trailing comma missing +error[COM812]: 594:15: [*] Trailing comma missing + + --> COM81.py:594:15 | 592 | spam, 593 | *args, 594 | kwarg_only - | COM812 + | ^ 595 | ): 596 | pass | = help: Add trailing comma - ℹ Safe fix 591 591 | ham, 592 592 | spam, @@ -899,16 +947,17 @@ COM81.py:594:15: COM812 [*] Trailing comma missing 596 596 | pass 597 597 | -COM81.py:623:20: COM812 [*] Trailing comma missing +error[COM812]: 623:20: [*] Trailing comma missing + + --> COM81.py:623:20 | 621 | foo, 622 | bar, 623 | **{'ham': spam} - | COM812 + | ^ 624 | ) | = help: Add trailing comma - ℹ Safe fix 620 620 | result = function( 621 621 | foo, @@ -919,16 +968,17 @@ COM81.py:623:20: COM812 [*] Trailing comma missing 625 625 | 626 626 | # Make sure the COM812 and UP034 rules don't fix simultaneously and cause a syntax error. -COM81.py:628:42: COM812 [*] Trailing comma missing +error[COM812]: 628:42: [*] Trailing comma missing + + --> COM81.py:628:42 | 626 | # Make sure the COM812 and UP034 rules don't fix simultaneously and cause a syntax error. 627 | the_first_one = next( 628 | (i for i in range(10) if i // 2 == 0) # COM812 fix should include the final bracket - | COM812 + | ^ 629 | ) | = help: Add trailing comma - ℹ Safe fix 625 625 | 626 626 | # Make sure the COM812 and UP034 rules don't fix simultaneously and cause a syntax error. @@ -939,16 +989,17 @@ COM81.py:628:42: COM812 [*] Trailing comma missing 630 630 | 631 631 | foo = namedtuple( -COM81.py:640:46: COM819 [*] Trailing comma prohibited +error[COM819]: 640:46: [*] Trailing comma prohibited + + --> COM81.py:640:46 | 639 | # F-strings 640 | kwargs.pop("remove", f"this {trailing_comma}",) - | ^ COM819 + | ^ 641 | 642 | raise Exception( | = help: Remove trailing comma - ℹ Safe fix 637 637 | ) 638 638 | @@ -959,15 +1010,16 @@ COM81.py:640:46: COM819 [*] Trailing comma prohibited 642 642 | raise Exception( 643 643 | "first", extra=f"Add trailing comma here ->" -COM81.py:643:49: COM812 [*] Trailing comma missing +error[COM812]: 643:49: [*] Trailing comma missing + + --> COM81.py:643:49 | 642 | raise Exception( 643 | "first", extra=f"Add trailing comma here ->" - | COM812 + | ^ 644 | ) | = help: Add trailing comma - ℹ Safe fix 640 640 | kwargs.pop("remove", f"this {trailing_comma}",) 641 641 | diff --git a/crates/ruff_linter/src/rules/flake8_commas/snapshots/ruff_linter__rules__flake8_commas__tests__COM81_syntax_error.py.snap b/crates/ruff_linter/src/rules/flake8_commas/snapshots/ruff_linter__rules__flake8_commas__tests__COM81_syntax_error.py.snap index d604355cc6..3112216e08 100644 --- a/crates/ruff_linter/src/rules/flake8_commas/snapshots/ruff_linter__rules__flake8_commas__tests__COM81_syntax_error.py.snap +++ b/crates/ruff_linter/src/rules/flake8_commas/snapshots/ruff_linter__rules__flake8_commas__tests__COM81_syntax_error.py.snap @@ -1,7 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_commas/mod.rs --- -COM81_syntax_error.py:3:5: SyntaxError: Starred expression cannot be used here +error[syntax-error]: 3:5: Starred expression cannot be used here + + --> COM81_syntax_error.py:3:5 | 1 | # Check for `flake8-commas` violation for a file containing syntax errors. 2 | ( @@ -9,8 +11,9 @@ COM81_syntax_error.py:3:5: SyntaxError: Starred expression cannot be used here | ^ 4 | ) | +error[syntax-error]: 6:9: Type parameter list cannot be empty -COM81_syntax_error.py:6:9: SyntaxError: Type parameter list cannot be empty + --> COM81_syntax_error.py:6:9 | 4 | ) 5 | @@ -18,13 +21,14 @@ COM81_syntax_error.py:6:9: SyntaxError: Type parameter list cannot be empty | ^ 7 | pass | +error[COM819]: 6:38: Trailing comma prohibited -COM81_syntax_error.py:6:38: COM819 Trailing comma prohibited + --> COM81_syntax_error.py:6:38 | 4 | ) 5 | 6 | def foo[(param1='test', param2='test',): - | ^ COM819 + | ^ 7 | pass | = help: Remove trailing comma diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C400_C400.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C400_C400.py.snap index 42fe1d447c..19da37c8bd 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C400_C400.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C400_C400.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs --- -error[C400]: C400.py:2:13: [*] Unnecessary generator (rewrite as a `list` comprehension) +error[C400]: 2:13: [*] Unnecessary generator (rewrite as a `list` comprehension) + --> C400.py:2:13 | 1 | # Cannot combine with C416. Should use list comprehension here. 2 | even_nums = list(2 * x for x in range(3)) @@ -19,8 +20,9 @@ error[C400]: C400.py:2:13: [*] Unnecessary generator (rewrite as a `list` compre 4 4 | 2 * x + 1 for x in range(3) 5 5 | ) -error[C400]: C400.py:3:12: [*] Unnecessary generator (rewrite as a `list` comprehension) +error[C400]: 3:12: [*] Unnecessary generator (rewrite as a `list` comprehension) + --> C400.py:3:12 | 1 | # Cannot combine with C416. Should use list comprehension here. 2 | even_nums = list(2 * x for x in range(3)) @@ -43,8 +45,9 @@ error[C400]: C400.py:3:12: [*] Unnecessary generator (rewrite as a `list` compre 7 7 | 8 8 | # Short-circuit case, combine with C416 and should produce x = list(range(3)) -error[C400]: C400.py:9:5: [*] Unnecessary generator (rewrite using `list()`) +error[C400]: 9:5: [*] Unnecessary generator (rewrite using `list()`) + --> C400.py:9:5 | 8 | # Short-circuit case, combine with C416 and should produce x = list(range(3)) 9 | x = list(x for x in range(3)) @@ -63,8 +66,9 @@ error[C400]: C400.py:9:5: [*] Unnecessary generator (rewrite using `list()`) 11 11 | x for x in range(3) 12 12 | ) -error[C400]: C400.py:10:5: [*] Unnecessary generator (rewrite using `list()`) +error[C400]: 10:5: [*] Unnecessary generator (rewrite using `list()`) + --> C400.py:10:5 | 8 | # Short-circuit case, combine with C416 and should produce x = list(range(3)) 9 | x = list(x for x in range(3)) @@ -89,8 +93,9 @@ error[C400]: C400.py:10:5: [*] Unnecessary generator (rewrite using `list()`) 14 12 | # Strip parentheses from inner generators. 15 13 | list((2 * x for x in range(3))) -error[C400]: C400.py:15:1: [*] Unnecessary generator (rewrite as a `list` comprehension) +error[C400]: 15:1: [*] Unnecessary generator (rewrite as a `list` comprehension) + --> C400.py:14:43 | 14 | # Strip parentheses from inner generators. 15 | list((2 * x for x in range(3))) @@ -109,8 +114,9 @@ error[C400]: C400.py:15:1: [*] Unnecessary generator (rewrite as a `list` compre 17 17 | list((((2 * x for x in range(3))))) 18 18 | -error[C400]: C400.py:16:1: [*] Unnecessary generator (rewrite as a `list` comprehension) +error[C400]: 16:1: [*] Unnecessary generator (rewrite as a `list` comprehension) + --> C400.py:15:32 | 14 | # Strip parentheses from inner generators. 15 | list((2 * x for x in range(3))) @@ -129,8 +135,9 @@ error[C400]: C400.py:16:1: [*] Unnecessary generator (rewrite as a `list` compre 18 18 | 19 19 | # Not built-in list. -error[C400]: C400.py:17:1: [*] Unnecessary generator (rewrite as a `list` comprehension) +error[C400]: 17:1: [*] Unnecessary generator (rewrite as a `list` comprehension) + --> C400.py:16:34 | 15 | list((2 * x for x in range(3))) 16 | list(((2 * x for x in range(3)))) diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C401_C401.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C401_C401.py.snap index d9cbe805c7..14de827159 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C401_C401.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C401_C401.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs --- -error[C401]: C401.py:2:13: [*] Unnecessary generator (rewrite as a `set` comprehension) +error[C401]: 2:13: [*] Unnecessary generator (rewrite as a `set` comprehension) + --> C401.py:2:13 | 1 | # Cannot conbime with C416. Should use set comprehension here. 2 | even_nums = set(2 * x for x in range(3)) @@ -19,8 +20,9 @@ error[C401]: C401.py:2:13: [*] Unnecessary generator (rewrite as a `set` compreh 4 4 | 2 * x + 1 for x in range(3) 5 5 | ) -error[C401]: C401.py:3:12: [*] Unnecessary generator (rewrite as a `set` comprehension) +error[C401]: 3:12: [*] Unnecessary generator (rewrite as a `set` comprehension) + --> C401.py:3:12 | 1 | # Cannot conbime with C416. Should use set comprehension here. 2 | even_nums = set(2 * x for x in range(3)) @@ -44,8 +46,9 @@ error[C401]: C401.py:3:12: [*] Unnecessary generator (rewrite as a `set` compreh 7 7 | 8 8 | def f(x): -error[C401]: C401.py:6:17: [*] Unnecessary generator (rewrite as a `set` comprehension) +error[C401]: 6:17: [*] Unnecessary generator (rewrite as a `set` comprehension) + --> C401.py:6:17 | 4 | 2 * x + 1 for x in range(3) 5 | ) @@ -65,8 +68,9 @@ error[C401]: C401.py:6:17: [*] Unnecessary generator (rewrite as a `set` compreh 8 8 | def f(x): 9 9 | return x -error[C401]: C401.py:11:16: [*] Unnecessary generator (rewrite as a `set` comprehension) +error[C401]: 11:16: [*] Unnecessary generator (rewrite as a `set` comprehension) + --> C401.py:11:16 | 9 | return x 10 | @@ -85,8 +89,9 @@ error[C401]: C401.py:11:16: [*] Unnecessary generator (rewrite as a `set` compre 13 13 | 14 14 | -error[C401]: C401.py:12:17: [*] Unnecessary generator (rewrite as a `set` comprehension) +error[C401]: 12:17: [*] Unnecessary generator (rewrite as a `set` comprehension) + --> C401.py:12:17 | 11 | print(f"Hello {set(f(a) for a in 'abc')} World") 12 | print(f"Hello { set(f(a) for a in 'abc') } World") @@ -103,8 +108,9 @@ error[C401]: C401.py:12:17: [*] Unnecessary generator (rewrite as a `set` compre 14 14 | 15 15 | # Short-circuit case, combine with C416 and should produce x = set(range(3)) -error[C401]: C401.py:16:5: [*] Unnecessary generator (rewrite using `set()` +error[C401]: 16:5: [*] Unnecessary generator (rewrite using `set()` + --> C401.py:16:5 | 15 | # Short-circuit case, combine with C416 and should produce x = set(range(3)) 16 | x = set(x for x in range(3)) @@ -123,8 +129,9 @@ error[C401]: C401.py:16:5: [*] Unnecessary generator (rewrite using `set()` 18 18 | x for x in range(3) 19 19 | ) -error[C401]: C401.py:17:5: [*] Unnecessary generator (rewrite using `set()` +error[C401]: 17:5: [*] Unnecessary generator (rewrite using `set()` + --> C401.py:17:5 | 15 | # Short-circuit case, combine with C416 and should produce x = set(range(3)) 16 | x = set(x for x in range(3)) @@ -149,8 +156,9 @@ error[C401]: C401.py:17:5: [*] Unnecessary generator (rewrite using `set()` 21 19 | print(f"{set(a for a in 'abc') - set(a for a in 'ab')}") 22 20 | print(f"{ set(a for a in 'abc') - set(a for a in 'ab') }") -error[C401]: C401.py:20:16: [*] Unnecessary generator (rewrite using `set()` +error[C401]: 20:16: [*] Unnecessary generator (rewrite using `set()` + --> C401.py:20:16 | 18 | x for x in range(3) 19 | ) @@ -170,8 +178,9 @@ error[C401]: C401.py:20:16: [*] Unnecessary generator (rewrite using `set()` 22 22 | print(f"{ set(a for a in 'abc') - set(a for a in 'ab') }") 23 23 | -error[C401]: C401.py:21:10: [*] Unnecessary generator (rewrite using `set()` +error[C401]: 21:10: [*] Unnecessary generator (rewrite using `set()` + --> C401.py:21:10 | 19 | ) 20 | print(f"Hello {set(a for a in range(3))} World") @@ -190,8 +199,9 @@ error[C401]: C401.py:21:10: [*] Unnecessary generator (rewrite using `set()` 23 23 | 24 24 | -error[C401]: C401.py:21:34: [*] Unnecessary generator (rewrite using `set()` +error[C401]: 21:34: [*] Unnecessary generator (rewrite using `set()` + --> C401.py:21:34 | 19 | ) 20 | print(f"Hello {set(a for a in range(3))} World") @@ -210,8 +220,9 @@ error[C401]: C401.py:21:34: [*] Unnecessary generator (rewrite using `set()` 23 23 | 24 24 | -error[C401]: C401.py:22:11: [*] Unnecessary generator (rewrite using `set()` +error[C401]: 22:11: [*] Unnecessary generator (rewrite using `set()` + --> C401.py:22:11 | 20 | print(f"Hello {set(a for a in range(3))} World") 21 | print(f"{set(a for a in 'abc') - set(a for a in 'ab')}") @@ -229,8 +240,9 @@ error[C401]: C401.py:22:11: [*] Unnecessary generator (rewrite using `set()` 24 24 | 25 25 | # Not built-in set. -error[C401]: C401.py:22:35: [*] Unnecessary generator (rewrite using `set()` +error[C401]: 22:35: [*] Unnecessary generator (rewrite using `set()` + --> C401.py:22:35 | 20 | print(f"Hello {set(a for a in range(3))} World") 21 | print(f"{set(a for a in 'abc') - set(a for a in 'ab')}") diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C402_C402.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C402_C402.py.snap index 486ca6ab34..f47c628312 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C402_C402.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C402_C402.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs --- -error[C402]: C402.py:1:1: [*] Unnecessary generator (rewrite as a `dict` comprehension) +error[C402]: 1:1: [*] Unnecessary generator (rewrite as a `dict` comprehension) + --> C402.py:1:1 | 1 | dict((x, x) for x in range(3)) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -17,8 +18,9 @@ error[C402]: C402.py:1:1: [*] Unnecessary generator (rewrite as a `dict` compreh 3 3 | (x, x) for x in range(3) 4 4 | ) -error[C402]: C402.py:2:1: [*] Unnecessary generator (rewrite as a `dict` comprehension) +error[C402]: 2:1: [*] Unnecessary generator (rewrite as a `dict` comprehension) + --> C402.py:1:31 | 1 | dict((x, x) for x in range(3)) 2 | / dict( @@ -41,8 +43,9 @@ error[C402]: C402.py:2:1: [*] Unnecessary generator (rewrite as a `dict` compreh 6 6 | y = f'{dict((x, x) for x in range(3))}' 7 7 | print(f'Hello {dict((x, x) for x in range(3))} World') -error[C402]: C402.py:6:8: [*] Unnecessary generator (rewrite as a `dict` comprehension) +error[C402]: 6:8: [*] Unnecessary generator (rewrite as a `dict` comprehension) + --> C402.py:6:8 | 4 | ) 5 | dict(((x, x) for x in range(3)), z=3) @@ -62,8 +65,9 @@ error[C402]: C402.py:6:8: [*] Unnecessary generator (rewrite as a `dict` compreh 8 8 | print(f"Hello {dict((x, x) for x in 'abc')} World") 9 9 | print(f'Hello {dict((x, x) for x in "abc")} World') -error[C402]: C402.py:7:16: [*] Unnecessary generator (rewrite as a `dict` comprehension) +error[C402]: 7:16: [*] Unnecessary generator (rewrite as a `dict` comprehension) + --> C402.py:7:16 | 5 | dict(((x, x) for x in range(3)), z=3) 6 | y = f'{dict((x, x) for x in range(3))}' @@ -83,8 +87,9 @@ error[C402]: C402.py:7:16: [*] Unnecessary generator (rewrite as a `dict` compre 9 9 | print(f'Hello {dict((x, x) for x in "abc")} World') 10 10 | print(f'Hello {dict((x,x) for x in "abc")} World') -error[C402]: C402.py:8:16: [*] Unnecessary generator (rewrite as a `dict` comprehension) +error[C402]: 8:16: [*] Unnecessary generator (rewrite as a `dict` comprehension) + --> C402.py:8:16 | 6 | y = f'{dict((x, x) for x in range(3))}' 7 | print(f'Hello {dict((x, x) for x in range(3))} World') @@ -104,8 +109,9 @@ error[C402]: C402.py:8:16: [*] Unnecessary generator (rewrite as a `dict` compre 10 10 | print(f'Hello {dict((x,x) for x in "abc")} World') 11 11 | -error[C402]: C402.py:9:16: [*] Unnecessary generator (rewrite as a `dict` comprehension) +error[C402]: 9:16: [*] Unnecessary generator (rewrite as a `dict` comprehension) + --> C402.py:9:16 | 7 | print(f'Hello {dict((x, x) for x in range(3))} World') 8 | print(f"Hello {dict((x, x) for x in 'abc')} World") @@ -124,8 +130,9 @@ error[C402]: C402.py:9:16: [*] Unnecessary generator (rewrite as a `dict` compre 11 11 | 12 12 | f'{dict((x, x) for x in range(3)) | dict((x, x) for x in range(3))}' -error[C402]: C402.py:10:16: [*] Unnecessary generator (rewrite as a `dict` comprehension) +error[C402]: 10:16: [*] Unnecessary generator (rewrite as a `dict` comprehension) + --> C402.py:10:16 | 8 | print(f"Hello {dict((x, x) for x in 'abc')} World") 9 | print(f'Hello {dict((x, x) for x in "abc")} World') @@ -145,8 +152,9 @@ error[C402]: C402.py:10:16: [*] Unnecessary generator (rewrite as a `dict` compr 12 12 | f'{dict((x, x) for x in range(3)) | dict((x, x) for x in range(3))}' 13 13 | f'{ dict((x, x) for x in range(3)) | dict((x, x) for x in range(3)) }' -error[C402]: C402.py:12:4: [*] Unnecessary generator (rewrite as a `dict` comprehension) +error[C402]: 12:4: [*] Unnecessary generator (rewrite as a `dict` comprehension) + --> C402.py:12:4 | 10 | print(f'Hello {dict((x,x) for x in "abc")} World') 11 | @@ -165,8 +173,9 @@ error[C402]: C402.py:12:4: [*] Unnecessary generator (rewrite as a `dict` compre 14 14 | 15 15 | def f(x): -error[C402]: C402.py:12:37: [*] Unnecessary generator (rewrite as a `dict` comprehension) +error[C402]: 12:37: [*] Unnecessary generator (rewrite as a `dict` comprehension) + --> C402.py:12:37 | 10 | print(f'Hello {dict((x,x) for x in "abc")} World') 11 | @@ -185,8 +194,9 @@ error[C402]: C402.py:12:37: [*] Unnecessary generator (rewrite as a `dict` compr 14 14 | 15 15 | def f(x): -error[C402]: C402.py:13:5: [*] Unnecessary generator (rewrite as a `dict` comprehension) +error[C402]: 13:5: [*] Unnecessary generator (rewrite as a `dict` comprehension) + --> C402.py:13:5 | 12 | f'{dict((x, x) for x in range(3)) | dict((x, x) for x in range(3))}' 13 | f'{ dict((x, x) for x in range(3)) | dict((x, x) for x in range(3)) }' @@ -205,8 +215,9 @@ error[C402]: C402.py:13:5: [*] Unnecessary generator (rewrite as a `dict` compre 15 15 | def f(x): 16 16 | return x -error[C402]: C402.py:13:38: [*] Unnecessary generator (rewrite as a `dict` comprehension) +error[C402]: 13:38: [*] Unnecessary generator (rewrite as a `dict` comprehension) + --> C402.py:13:38 | 12 | f'{dict((x, x) for x in range(3)) | dict((x, x) for x in range(3))}' 13 | f'{ dict((x, x) for x in range(3)) | dict((x, x) for x in range(3)) }' @@ -225,8 +236,9 @@ error[C402]: C402.py:13:38: [*] Unnecessary generator (rewrite as a `dict` compr 15 15 | def f(x): 16 16 | return x -error[C402]: C402.py:18:16: [*] Unnecessary generator (rewrite as a `dict` comprehension) +error[C402]: 18:16: [*] Unnecessary generator (rewrite as a `dict` comprehension) + --> C402.py:18:16 | 16 | return x 17 | @@ -246,8 +258,9 @@ error[C402]: C402.py:18:16: [*] Unnecessary generator (rewrite as a `dict` compr 20 20 | # Regression test for: https://github.com/astral-sh/ruff/issues/7086 21 21 | dict((k,v)for k,v in d.iteritems() if k in only_args) -error[C402]: C402.py:21:1: [*] Unnecessary generator (rewrite as a `dict` comprehension) +error[C402]: 21:1: [*] Unnecessary generator (rewrite as a `dict` comprehension) + --> C402.py:20:69 | 20 | # Regression test for: https://github.com/astral-sh/ruff/issues/7086 21 | dict((k,v)for k,v in d.iteritems() if k in only_args) diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C403_C403.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C403_C403.py.snap index bc83c69202..eee3e6c742 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C403_C403.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C403_C403.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs --- -error[C403]: C403.py:1:5: [*] Unnecessary `list` comprehension (rewrite as a `set` comprehension) +error[C403]: 1:5: [*] Unnecessary `list` comprehension (rewrite as a `set` comprehension) + --> C403.py:1:5 | 1 | s = set([x for x in range(3)]) | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -17,8 +18,9 @@ error[C403]: C403.py:1:5: [*] Unnecessary `list` comprehension (rewrite as a `se 3 3 | [x for x in range(3)] 4 4 | ) -error[C403]: C403.py:2:5: [*] Unnecessary `list` comprehension (rewrite as a `set` comprehension) +error[C403]: 2:5: [*] Unnecessary `list` comprehension (rewrite as a `set` comprehension) + --> C403.py:2:5 | 1 | s = set([x for x in range(3)]) 2 | s = set( @@ -42,8 +44,9 @@ error[C403]: C403.py:2:5: [*] Unnecessary `list` comprehension (rewrite as a `se 6 6 | s = f"{set([x for x in 'ab'])}" 7 7 | s = f'{set([x for x in "ab"])}' -error[C403]: C403.py:6:8: [*] Unnecessary `list` comprehension (rewrite as a `set` comprehension) +error[C403]: 6:8: [*] Unnecessary `list` comprehension (rewrite as a `set` comprehension) + --> C403.py:6:8 | 4 | ) 5 | @@ -62,8 +65,9 @@ error[C403]: C403.py:6:8: [*] Unnecessary `list` comprehension (rewrite as a `se 8 8 | 9 9 | def f(x): -error[C403]: C403.py:7:8: [*] Unnecessary `list` comprehension (rewrite as a `set` comprehension) +error[C403]: 7:8: [*] Unnecessary `list` comprehension (rewrite as a `set` comprehension) + --> C403.py:7:8 | 6 | s = f"{set([x for x in 'ab'])}" 7 | s = f'{set([x for x in "ab"])}' @@ -82,8 +86,9 @@ error[C403]: C403.py:7:8: [*] Unnecessary `list` comprehension (rewrite as a `se 9 9 | def f(x): 10 10 | return x -error[C403]: C403.py:12:8: [*] Unnecessary `list` comprehension (rewrite as a `set` comprehension) +error[C403]: 12:8: [*] Unnecessary `list` comprehension (rewrite as a `set` comprehension) + --> C403.py:12:8 | 10 | return x 11 | @@ -103,8 +108,9 @@ error[C403]: C403.py:12:8: [*] Unnecessary `list` comprehension (rewrite as a `s 14 14 | s = f"{ set([x for x in 'ab']) | set([x for x in 'ab']) }" 15 15 | s = f"{set([x for x in 'ab']) | set([x for x in 'ab'])}" -error[C403]: C403.py:14:9: [*] Unnecessary `list` comprehension (rewrite as a `set` comprehension) +error[C403]: 14:9: [*] Unnecessary `list` comprehension (rewrite as a `set` comprehension) + --> C403.py:14:9 | 12 | s = f"{set([f(x) for x in 'ab'])}" 13 | @@ -123,8 +129,9 @@ error[C403]: C403.py:14:9: [*] Unnecessary `list` comprehension (rewrite as a `s 16 16 | 17 17 | s = set( # comment -error[C403]: C403.py:14:34: [*] Unnecessary `list` comprehension (rewrite as a `set` comprehension) +error[C403]: 14:34: [*] Unnecessary `list` comprehension (rewrite as a `set` comprehension) + --> C403.py:14:34 | 12 | s = f"{set([f(x) for x in 'ab'])}" 13 | @@ -143,8 +150,9 @@ error[C403]: C403.py:14:34: [*] Unnecessary `list` comprehension (rewrite as a ` 16 16 | 17 17 | s = set( # comment -error[C403]: C403.py:15:8: [*] Unnecessary `list` comprehension (rewrite as a `set` comprehension) +error[C403]: 15:8: [*] Unnecessary `list` comprehension (rewrite as a `set` comprehension) + --> C403.py:15:8 | 14 | s = f"{ set([x for x in 'ab']) | set([x for x in 'ab']) }" 15 | s = f"{set([x for x in 'ab']) | set([x for x in 'ab'])}" @@ -163,8 +171,9 @@ error[C403]: C403.py:15:8: [*] Unnecessary `list` comprehension (rewrite as a `s 17 17 | s = set( # comment 18 18 | [x for x in range(3)] -error[C403]: C403.py:15:33: [*] Unnecessary `list` comprehension (rewrite as a `set` comprehension) +error[C403]: 15:33: [*] Unnecessary `list` comprehension (rewrite as a `set` comprehension) + --> C403.py:15:33 | 14 | s = f"{ set([x for x in 'ab']) | set([x for x in 'ab']) }" 15 | s = f"{set([x for x in 'ab']) | set([x for x in 'ab'])}" @@ -183,8 +192,9 @@ error[C403]: C403.py:15:33: [*] Unnecessary `list` comprehension (rewrite as a ` 17 17 | s = set( # comment 18 18 | [x for x in range(3)] -error[C403]: C403.py:17:5: [*] Unnecessary `list` comprehension (rewrite as a `set` comprehension) +error[C403]: 17:5: [*] Unnecessary `list` comprehension (rewrite as a `set` comprehension) + --> C403.py:17:5 | 15 | s = f"{set([x for x in 'ab']) | set([x for x in 'ab'])}" 16 | @@ -211,8 +221,9 @@ error[C403]: C403.py:17:5: [*] Unnecessary `list` comprehension (rewrite as a `s 21 21 | s = set([ # comment 22 22 | x for x in range(3) -error[C403]: C403.py:21:5: [*] Unnecessary `list` comprehension (rewrite as a `set` comprehension) +error[C403]: 21:5: [*] Unnecessary `list` comprehension (rewrite as a `set` comprehension) + --> C403.py:21:5 | 19 | ) 20 | diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C404_C404.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C404_C404.py.snap index 2072d9569e..20a9f0534f 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C404_C404.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C404_C404.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs --- -error[C404]: C404.py:1:1: [*] Unnecessary `list` comprehension (rewrite as a `dict` comprehension) +error[C404]: 1:1: [*] Unnecessary `list` comprehension (rewrite as a `dict` comprehension) + --> C404.py:1:1 | 1 | dict([(i, i) for i in range(3)]) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -16,8 +17,9 @@ error[C404]: C404.py:1:1: [*] Unnecessary `list` comprehension (rewrite as a `di 3 3 | 4 4 | def f(x): -error[C404]: C404.py:7:4: [*] Unnecessary `list` comprehension (rewrite as a `dict` comprehension) +error[C404]: 7:4: [*] Unnecessary `list` comprehension (rewrite as a `dict` comprehension) + --> C404.py:7:4 | 5 | return x 6 | @@ -37,8 +39,9 @@ error[C404]: C404.py:7:4: [*] Unnecessary `list` comprehension (rewrite as a `di 9 9 | f"{dict([(s, s) for s in 'ab'])}" 10 10 | f"{dict([(s,f(s)) for s in 'ab'])}" -error[C404]: C404.py:8:4: [*] Unnecessary `list` comprehension (rewrite as a `dict` comprehension) +error[C404]: 8:4: [*] Unnecessary `list` comprehension (rewrite as a `dict` comprehension) + --> C404.py:8:4 | 7 | f'{dict([(s,s) for s in "ab"])}' 8 | f"{dict([(s,s) for s in 'ab'])}" @@ -57,8 +60,9 @@ error[C404]: C404.py:8:4: [*] Unnecessary `list` comprehension (rewrite as a `di 10 10 | f"{dict([(s,f(s)) for s in 'ab'])}" 11 11 | -error[C404]: C404.py:9:4: [*] Unnecessary `list` comprehension (rewrite as a `dict` comprehension) +error[C404]: 9:4: [*] Unnecessary `list` comprehension (rewrite as a `dict` comprehension) + --> C404.py:9:4 | 7 | f'{dict([(s,s) for s in "ab"])}' 8 | f"{dict([(s,s) for s in 'ab'])}" @@ -77,8 +81,9 @@ error[C404]: C404.py:9:4: [*] Unnecessary `list` comprehension (rewrite as a `di 11 11 | 12 12 | f'{dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"])}' -error[C404]: C404.py:10:4: [*] Unnecessary `list` comprehension (rewrite as a `dict` comprehension) +error[C404]: 10:4: [*] Unnecessary `list` comprehension (rewrite as a `dict` comprehension) + --> C404.py:10:4 | 8 | f"{dict([(s,s) for s in 'ab'])}" 9 | f"{dict([(s, s) for s in 'ab'])}" @@ -98,8 +103,9 @@ error[C404]: C404.py:10:4: [*] Unnecessary `list` comprehension (rewrite as a `d 12 12 | f'{dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"])}' 13 13 | f'{ dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"]) }' -error[C404]: C404.py:12:4: [*] Unnecessary `list` comprehension (rewrite as a `dict` comprehension) +error[C404]: 12:4: [*] Unnecessary `list` comprehension (rewrite as a `dict` comprehension) + --> C404.py:12:4 | 10 | f"{dict([(s,f(s)) for s in 'ab'])}" 11 | @@ -118,8 +124,9 @@ error[C404]: C404.py:12:4: [*] Unnecessary `list` comprehension (rewrite as a `d 14 14 | 15 15 | # Regression test for: https://github.com/astral-sh/ruff/issues/7087 -error[C404]: C404.py:12:34: [*] Unnecessary `list` comprehension (rewrite as a `dict` comprehension) +error[C404]: 12:34: [*] Unnecessary `list` comprehension (rewrite as a `dict` comprehension) + --> C404.py:12:34 | 10 | f"{dict([(s,f(s)) for s in 'ab'])}" 11 | @@ -138,8 +145,9 @@ error[C404]: C404.py:12:34: [*] Unnecessary `list` comprehension (rewrite as a ` 14 14 | 15 15 | # Regression test for: https://github.com/astral-sh/ruff/issues/7087 -error[C404]: C404.py:13:5: [*] Unnecessary `list` comprehension (rewrite as a `dict` comprehension) +error[C404]: 13:5: [*] Unnecessary `list` comprehension (rewrite as a `dict` comprehension) + --> C404.py:13:5 | 12 | f'{dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"])}' 13 | f'{ dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"]) }' @@ -158,8 +166,9 @@ error[C404]: C404.py:13:5: [*] Unnecessary `list` comprehension (rewrite as a `d 15 15 | # Regression test for: https://github.com/astral-sh/ruff/issues/7087 16 16 | saved.append(dict([(k, v)for k,v in list(unique_instance.__dict__.items()) if k in [f.name for f in unique_instance._meta.fields]])) -error[C404]: C404.py:13:35: [*] Unnecessary `list` comprehension (rewrite as a `dict` comprehension) +error[C404]: 13:35: [*] Unnecessary `list` comprehension (rewrite as a `dict` comprehension) + --> C404.py:13:35 | 12 | f'{dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"])}' 13 | f'{ dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"]) }' @@ -178,8 +187,9 @@ error[C404]: C404.py:13:35: [*] Unnecessary `list` comprehension (rewrite as a ` 15 15 | # Regression test for: https://github.com/astral-sh/ruff/issues/7087 16 16 | saved.append(dict([(k, v)for k,v in list(unique_instance.__dict__.items()) if k in [f.name for f in unique_instance._meta.fields]])) -error[C404]: C404.py:16:14: [*] Unnecessary `list` comprehension (rewrite as a `dict` comprehension) +error[C404]: 16:14: [*] Unnecessary `list` comprehension (rewrite as a `dict` comprehension) + --> C404.py:16:14 | 15 | # Regression test for: https://github.com/astral-sh/ruff/issues/7087 16 | saved.append(dict([(k, v)for k,v in list(unique_instance.__dict__.items()) if k in [f.name for f in unique_instance._meta.fields]])) diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C405_C405.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C405_C405.py.snap index 6425979581..04d1c78c6f 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C405_C405.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C405_C405.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs --- -error[C405]: C405.py:1:1: [*] Unnecessary `list` literal (rewrite as a `set` literal) +error[C405]: 1:1: [*] Unnecessary `list` literal (rewrite as a `set` literal) + --> C405.py:1:1 | 1 | set([1, 2]) | ^^^^^^^^^^^ @@ -17,8 +18,9 @@ error[C405]: C405.py:1:1: [*] Unnecessary `list` literal (rewrite as a `set` lit 3 3 | set([]) 4 4 | set(()) -error[C405]: C405.py:2:1: [*] Unnecessary `tuple` literal (rewrite as a `set` literal) +error[C405]: 2:1: [*] Unnecessary `tuple` literal (rewrite as a `set` literal) + --> C405.py:1:12 | 1 | set([1, 2]) 2 | set((1, 2)) @@ -35,8 +37,9 @@ error[C405]: C405.py:2:1: [*] Unnecessary `tuple` literal (rewrite as a `set` li 4 4 | set(()) 5 5 | set() -error[C405]: C405.py:3:1: [*] Unnecessary `list` literal (rewrite as a `set` literal) +error[C405]: 3:1: [*] Unnecessary `list` literal (rewrite as a `set` literal) + --> C405.py:2:12 | 1 | set([1, 2]) 2 | set((1, 2)) @@ -55,8 +58,9 @@ error[C405]: C405.py:3:1: [*] Unnecessary `list` literal (rewrite as a `set` lit 5 5 | set() 6 6 | set((1,)) -error[C405]: C405.py:4:1: [*] Unnecessary `tuple` literal (rewrite as a `set` literal) +error[C405]: 4:1: [*] Unnecessary `tuple` literal (rewrite as a `set` literal) + --> C405.py:3:8 | 2 | set((1, 2)) 3 | set([]) @@ -77,8 +81,9 @@ error[C405]: C405.py:4:1: [*] Unnecessary `tuple` literal (rewrite as a `set` li 7 7 | set(( 8 8 | 1, -error[C405]: C405.py:6:1: [*] Unnecessary `tuple` literal (rewrite as a `set` literal) +error[C405]: 6:1: [*] Unnecessary `tuple` literal (rewrite as a `set` literal) + --> C405.py:5:6 | 4 | set(()) 5 | set() @@ -98,8 +103,9 @@ error[C405]: C405.py:6:1: [*] Unnecessary `tuple` literal (rewrite as a `set` li 8 8 | 1, 9 9 | )) -error[C405]: C405.py:7:1: [*] Unnecessary `tuple` literal (rewrite as a `set` literal) +error[C405]: 7:1: [*] Unnecessary `tuple` literal (rewrite as a `set` literal) + --> C405.py:6:10 | 5 | set() 6 | set((1,)) @@ -124,8 +130,9 @@ error[C405]: C405.py:7:1: [*] Unnecessary `tuple` literal (rewrite as a `set` li 11 11 | 1, 12 12 | ]) -error[C405]: C405.py:10:1: [*] Unnecessary `list` literal (rewrite as a `set` literal) +error[C405]: 10:1: [*] Unnecessary `list` literal (rewrite as a `set` literal) + --> C405.py:9:3 | 8 | 1, 9 | )) @@ -150,8 +157,9 @@ error[C405]: C405.py:10:1: [*] Unnecessary `list` literal (rewrite as a `set` li 14 14 | (1,) 15 15 | ) -error[C405]: C405.py:13:1: [*] Unnecessary `tuple` literal (rewrite as a `set` literal) +error[C405]: 13:1: [*] Unnecessary `tuple` literal (rewrite as a `set` literal) + --> C405.py:12:3 | 11 | 1, 12 | ]) @@ -175,8 +183,9 @@ error[C405]: C405.py:13:1: [*] Unnecessary `tuple` literal (rewrite as a `set` l 17 15 | [1,] 18 16 | ) -error[C405]: C405.py:16:1: [*] Unnecessary `list` literal (rewrite as a `set` literal) +error[C405]: 16:1: [*] Unnecessary `list` literal (rewrite as a `set` literal) + --> C405.py:15:2 | 14 | (1,) 15 | ) @@ -200,8 +209,9 @@ error[C405]: C405.py:16:1: [*] Unnecessary `list` literal (rewrite as a `set` li 20 18 | f"{set(['a', 'b'])}" 21 19 | f'{set(["a", "b"])}' -error[C405]: C405.py:19:4: [*] Unnecessary `list` literal (rewrite as a `set` literal) +error[C405]: 19:4: [*] Unnecessary `list` literal (rewrite as a `set` literal) + --> C405.py:19:4 | 17 | [1,] 18 | ) @@ -221,8 +231,9 @@ error[C405]: C405.py:19:4: [*] Unnecessary `list` literal (rewrite as a `set` li 21 21 | f'{set(["a", "b"])}' 22 22 | -error[C405]: C405.py:20:4: [*] Unnecessary `list` literal (rewrite as a `set` literal) +error[C405]: 20:4: [*] Unnecessary `list` literal (rewrite as a `set` literal) + --> C405.py:20:4 | 18 | ) 19 | f"{set([1,2,3])}" @@ -241,8 +252,9 @@ error[C405]: C405.py:20:4: [*] Unnecessary `list` literal (rewrite as a `set` li 22 22 | 23 23 | f"{set(['a', 'b']) - set(['a'])}" -error[C405]: C405.py:21:4: [*] Unnecessary `list` literal (rewrite as a `set` literal) +error[C405]: 21:4: [*] Unnecessary `list` literal (rewrite as a `set` literal) + --> C405.py:21:4 | 19 | f"{set([1,2,3])}" 20 | f"{set(['a', 'b'])}" @@ -262,8 +274,9 @@ error[C405]: C405.py:21:4: [*] Unnecessary `list` literal (rewrite as a `set` li 23 23 | f"{set(['a', 'b']) - set(['a'])}" 24 24 | f"{ set(['a', 'b']) - set(['a']) }" -error[C405]: C405.py:23:4: [*] Unnecessary `list` literal (rewrite as a `set` literal) +error[C405]: 23:4: [*] Unnecessary `list` literal (rewrite as a `set` literal) + --> C405.py:23:4 | 21 | f'{set(["a", "b"])}' 22 | @@ -283,8 +296,9 @@ error[C405]: C405.py:23:4: [*] Unnecessary `list` literal (rewrite as a `set` li 25 25 | f"a {set(['a', 'b']) - set(['a'])} b" 26 26 | f"a { set(['a', 'b']) - set(['a']) } b" -error[C405]: C405.py:23:22: [*] Unnecessary `list` literal (rewrite as a `set` literal) +error[C405]: 23:22: [*] Unnecessary `list` literal (rewrite as a `set` literal) + --> C405.py:23:22 | 21 | f'{set(["a", "b"])}' 22 | @@ -304,8 +318,9 @@ error[C405]: C405.py:23:22: [*] Unnecessary `list` literal (rewrite as a `set` l 25 25 | f"a {set(['a', 'b']) - set(['a'])} b" 26 26 | f"a { set(['a', 'b']) - set(['a']) } b" -error[C405]: C405.py:24:5: [*] Unnecessary `list` literal (rewrite as a `set` literal) +error[C405]: 24:5: [*] Unnecessary `list` literal (rewrite as a `set` literal) + --> C405.py:24:5 | 23 | f"{set(['a', 'b']) - set(['a'])}" 24 | f"{ set(['a', 'b']) - set(['a']) }" @@ -323,8 +338,9 @@ error[C405]: C405.py:24:5: [*] Unnecessary `list` literal (rewrite as a `set` li 25 25 | f"a {set(['a', 'b']) - set(['a'])} b" 26 26 | f"a { set(['a', 'b']) - set(['a']) } b" -error[C405]: C405.py:24:23: [*] Unnecessary `list` literal (rewrite as a `set` literal) +error[C405]: 24:23: [*] Unnecessary `list` literal (rewrite as a `set` literal) + --> C405.py:24:23 | 23 | f"{set(['a', 'b']) - set(['a'])}" 24 | f"{ set(['a', 'b']) - set(['a']) }" @@ -342,8 +358,9 @@ error[C405]: C405.py:24:23: [*] Unnecessary `list` literal (rewrite as a `set` l 25 25 | f"a {set(['a', 'b']) - set(['a'])} b" 26 26 | f"a { set(['a', 'b']) - set(['a']) } b" -error[C405]: C405.py:25:6: [*] Unnecessary `list` literal (rewrite as a `set` literal) +error[C405]: 25:6: [*] Unnecessary `list` literal (rewrite as a `set` literal) + --> C405.py:25:6 | 23 | f"{set(['a', 'b']) - set(['a'])}" 24 | f"{ set(['a', 'b']) - set(['a']) }" @@ -360,8 +377,9 @@ error[C405]: C405.py:25:6: [*] Unnecessary `list` literal (rewrite as a `set` li 25 |+f"a { {'a', 'b'} - set(['a'])} b" 26 26 | f"a { set(['a', 'b']) - set(['a']) } b" -error[C405]: C405.py:25:24: [*] Unnecessary `list` literal (rewrite as a `set` literal) +error[C405]: 25:24: [*] Unnecessary `list` literal (rewrite as a `set` literal) + --> C405.py:25:24 | 23 | f"{set(['a', 'b']) - set(['a'])}" 24 | f"{ set(['a', 'b']) - set(['a']) }" @@ -378,8 +396,9 @@ error[C405]: C405.py:25:24: [*] Unnecessary `list` literal (rewrite as a `set` l 25 |+f"a {set(['a', 'b']) - {'a'} } b" 26 26 | f"a { set(['a', 'b']) - set(['a']) } b" -error[C405]: C405.py:26:7: [*] Unnecessary `list` literal (rewrite as a `set` literal) +error[C405]: 26:7: [*] Unnecessary `list` literal (rewrite as a `set` literal) + --> C405.py:26:7 | 24 | f"{ set(['a', 'b']) - set(['a']) }" 25 | f"a {set(['a', 'b']) - set(['a'])} b" @@ -394,8 +413,9 @@ error[C405]: C405.py:26:7: [*] Unnecessary `list` literal (rewrite as a `set` li 26 |-f"a { set(['a', 'b']) - set(['a']) } b" 26 |+f"a { {'a', 'b'} - set(['a']) } b" -error[C405]: C405.py:26:25: [*] Unnecessary `list` literal (rewrite as a `set` literal) +error[C405]: 26:25: [*] Unnecessary `list` literal (rewrite as a `set` literal) + --> C405.py:26:25 | 24 | f"{ set(['a', 'b']) - set(['a']) }" 25 | f"a {set(['a', 'b']) - set(['a'])} b" diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C406_C406.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C406_C406.py.snap index 1871b8831b..719e32b1d4 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C406_C406.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C406_C406.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs --- -error[C406]: C406.py:1:6: [*] Unnecessary `list` literal (rewrite as a `dict` literal) +error[C406]: 1:6: [*] Unnecessary `list` literal (rewrite as a `dict` literal) + --> C406.py:1:6 | 1 | d1 = dict([(1, 2)]) | ^^^^^^^^^^^^^^ @@ -17,8 +18,9 @@ error[C406]: C406.py:1:6: [*] Unnecessary `list` literal (rewrite as a `dict` li 3 3 | d3 = dict([]) 4 4 | d4 = dict(()) -error[C406]: C406.py:2:6: [*] Unnecessary `tuple` literal (rewrite as a `dict` literal) +error[C406]: 2:6: [*] Unnecessary `tuple` literal (rewrite as a `dict` literal) + --> C406.py:2:6 | 1 | d1 = dict([(1, 2)]) 2 | d2 = dict(((1, 2),)) @@ -35,8 +37,9 @@ error[C406]: C406.py:2:6: [*] Unnecessary `tuple` literal (rewrite as a `dict` l 4 4 | d4 = dict(()) 5 5 | d5 = dict() -error[C406]: C406.py:3:6: [*] Unnecessary `list` literal (rewrite as a `dict` literal) +error[C406]: 3:6: [*] Unnecessary `list` literal (rewrite as a `dict` literal) + --> C406.py:3:6 | 1 | d1 = dict([(1, 2)]) 2 | d2 = dict(((1, 2),)) @@ -54,8 +57,9 @@ error[C406]: C406.py:3:6: [*] Unnecessary `list` literal (rewrite as a `dict` li 4 4 | d4 = dict(()) 5 5 | d5 = dict() -error[C406]: C406.py:4:6: [*] Unnecessary `tuple` literal (rewrite as a `dict` literal) +error[C406]: 4:6: [*] Unnecessary `tuple` literal (rewrite as a `dict` literal) + --> C406.py:4:6 | 2 | d2 = dict(((1, 2),)) 3 | d3 = dict([]) diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C408_C408.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C408_C408.py.snap index 632cf414ca..ebff00a361 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C408_C408.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C408_C408.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs --- -error[C408]: C408.py:1:5: [*] Unnecessary `tuple` call (rewrite as a literal) +error[C408]: 1:5: [*] Unnecessary `tuple` call (rewrite as a literal) + --> C408.py:1:5 | 1 | t = tuple() | ^^^^^^^ @@ -17,8 +18,9 @@ error[C408]: C408.py:1:5: [*] Unnecessary `tuple` call (rewrite as a literal) 3 3 | d1 = dict() 4 4 | d2 = dict(a=1) -error[C408]: C408.py:2:5: [*] Unnecessary `list` call (rewrite as a literal) +error[C408]: 2:5: [*] Unnecessary `list` call (rewrite as a literal) + --> C408.py:2:5 | 1 | t = tuple() 2 | l = list() @@ -35,8 +37,9 @@ error[C408]: C408.py:2:5: [*] Unnecessary `list` call (rewrite as a literal) 4 4 | d2 = dict(a=1) 5 5 | d3 = dict(**d2) -error[C408]: C408.py:3:6: [*] Unnecessary `dict` call (rewrite as a literal) +error[C408]: 3:6: [*] Unnecessary `dict` call (rewrite as a literal) + --> C408.py:3:6 | 1 | t = tuple() 2 | l = list() @@ -55,8 +58,9 @@ error[C408]: C408.py:3:6: [*] Unnecessary `dict` call (rewrite as a literal) 5 5 | d3 = dict(**d2) 6 6 | -error[C408]: C408.py:4:6: [*] Unnecessary `dict` call (rewrite as a literal) +error[C408]: 4:6: [*] Unnecessary `dict` call (rewrite as a literal) + --> C408.py:4:6 | 2 | l = list() 3 | d1 = dict() @@ -75,8 +79,9 @@ error[C408]: C408.py:4:6: [*] Unnecessary `dict` call (rewrite as a literal) 6 6 | 7 7 | -error[C408]: C408.py:14:4: [*] Unnecessary `dict` call (rewrite as a literal) +error[C408]: 14:4: [*] Unnecessary `dict` call (rewrite as a literal) + --> C408.py:14:4 | 12 | a = list() 13 | @@ -96,8 +101,9 @@ error[C408]: C408.py:14:4: [*] Unnecessary `dict` call (rewrite as a literal) 16 16 | f"{dict()}" 17 17 | f"a {dict()} b" -error[C408]: C408.py:15:4: [*] Unnecessary `dict` call (rewrite as a literal) +error[C408]: 15:4: [*] Unnecessary `dict` call (rewrite as a literal) + --> C408.py:15:4 | 14 | f"{dict(x='y')}" 15 | f'{dict(x="y")}' @@ -116,8 +122,9 @@ error[C408]: C408.py:15:4: [*] Unnecessary `dict` call (rewrite as a literal) 17 17 | f"a {dict()} b" 18 18 | -error[C408]: C408.py:16:4: [*] Unnecessary `dict` call (rewrite as a literal) +error[C408]: 16:4: [*] Unnecessary `dict` call (rewrite as a literal) + --> C408.py:16:4 | 14 | f"{dict(x='y')}" 15 | f'{dict(x="y")}' @@ -136,8 +143,9 @@ error[C408]: C408.py:16:4: [*] Unnecessary `dict` call (rewrite as a literal) 18 18 | 19 19 | f"{dict(x='y') | dict(y='z')}" -error[C408]: C408.py:17:6: [*] Unnecessary `dict` call (rewrite as a literal) +error[C408]: 17:6: [*] Unnecessary `dict` call (rewrite as a literal) + --> C408.py:17:6 | 15 | f'{dict(x="y")}' 16 | f"{dict()}" @@ -157,8 +165,9 @@ error[C408]: C408.py:17:6: [*] Unnecessary `dict` call (rewrite as a literal) 19 19 | f"{dict(x='y') | dict(y='z')}" 20 20 | f"{ dict(x='y') | dict(y='z') }" -error[C408]: C408.py:19:4: [*] Unnecessary `dict` call (rewrite as a literal) +error[C408]: 19:4: [*] Unnecessary `dict` call (rewrite as a literal) + --> C408.py:19:4 | 17 | f"a {dict()} b" 18 | @@ -178,8 +187,9 @@ error[C408]: C408.py:19:4: [*] Unnecessary `dict` call (rewrite as a literal) 21 21 | f"a {dict(x='y') | dict(y='z')} b" 22 22 | f"a { dict(x='y') | dict(y='z') } b" -error[C408]: C408.py:19:18: [*] Unnecessary `dict` call (rewrite as a literal) +error[C408]: 19:18: [*] Unnecessary `dict` call (rewrite as a literal) + --> C408.py:19:18 | 17 | f"a {dict()} b" 18 | @@ -199,8 +209,9 @@ error[C408]: C408.py:19:18: [*] Unnecessary `dict` call (rewrite as a literal) 21 21 | f"a {dict(x='y') | dict(y='z')} b" 22 22 | f"a { dict(x='y') | dict(y='z') } b" -error[C408]: C408.py:20:5: [*] Unnecessary `dict` call (rewrite as a literal) +error[C408]: 20:5: [*] Unnecessary `dict` call (rewrite as a literal) + --> C408.py:20:5 | 19 | f"{dict(x='y') | dict(y='z')}" 20 | f"{ dict(x='y') | dict(y='z') }" @@ -219,8 +230,9 @@ error[C408]: C408.py:20:5: [*] Unnecessary `dict` call (rewrite as a literal) 22 22 | f"a { dict(x='y') | dict(y='z') } b" 23 23 | -error[C408]: C408.py:20:19: [*] Unnecessary `dict` call (rewrite as a literal) +error[C408]: 20:19: [*] Unnecessary `dict` call (rewrite as a literal) + --> C408.py:20:19 | 19 | f"{dict(x='y') | dict(y='z')}" 20 | f"{ dict(x='y') | dict(y='z') }" @@ -239,8 +251,9 @@ error[C408]: C408.py:20:19: [*] Unnecessary `dict` call (rewrite as a literal) 22 22 | f"a { dict(x='y') | dict(y='z') } b" 23 23 | -error[C408]: C408.py:21:6: [*] Unnecessary `dict` call (rewrite as a literal) +error[C408]: 21:6: [*] Unnecessary `dict` call (rewrite as a literal) + --> C408.py:21:6 | 19 | f"{dict(x='y') | dict(y='z')}" 20 | f"{ dict(x='y') | dict(y='z') }" @@ -259,8 +272,9 @@ error[C408]: C408.py:21:6: [*] Unnecessary `dict` call (rewrite as a literal) 23 23 | 24 24 | dict( -error[C408]: C408.py:21:20: [*] Unnecessary `dict` call (rewrite as a literal) +error[C408]: 21:20: [*] Unnecessary `dict` call (rewrite as a literal) + --> C408.py:21:20 | 19 | f"{dict(x='y') | dict(y='z')}" 20 | f"{ dict(x='y') | dict(y='z') }" @@ -279,8 +293,9 @@ error[C408]: C408.py:21:20: [*] Unnecessary `dict` call (rewrite as a literal) 23 23 | 24 24 | dict( -error[C408]: C408.py:22:7: [*] Unnecessary `dict` call (rewrite as a literal) +error[C408]: 22:7: [*] Unnecessary `dict` call (rewrite as a literal) + --> C408.py:22:7 | 20 | f"{ dict(x='y') | dict(y='z') }" 21 | f"a {dict(x='y') | dict(y='z')} b" @@ -300,8 +315,9 @@ error[C408]: C408.py:22:7: [*] Unnecessary `dict` call (rewrite as a literal) 24 24 | dict( 25 25 | # comment -error[C408]: C408.py:22:21: [*] Unnecessary `dict` call (rewrite as a literal) +error[C408]: 22:21: [*] Unnecessary `dict` call (rewrite as a literal) + --> C408.py:22:21 | 20 | f"{ dict(x='y') | dict(y='z') }" 21 | f"a {dict(x='y') | dict(y='z')} b" @@ -321,8 +337,9 @@ error[C408]: C408.py:22:21: [*] Unnecessary `dict` call (rewrite as a literal) 24 24 | dict( 25 25 | # comment -error[C408]: C408.py:24:1: [*] Unnecessary `dict` call (rewrite as a literal) +error[C408]: 24:1: [*] Unnecessary `dict` call (rewrite as a literal) + --> C408.py:23:1 | 22 | f"a { dict(x='y') | dict(y='z') } b" 23 | @@ -347,8 +364,9 @@ error[C408]: C408.py:24:1: [*] Unnecessary `dict` call (rewrite as a literal) 28 28 | tuple( # comment 29 29 | ) -error[C408]: C408.py:28:1: [*] Unnecessary `tuple` call (rewrite as a literal) +error[C408]: 28:1: [*] Unnecessary `tuple` call (rewrite as a literal) + --> C408.py:27:1 | 26 | ) 27 | diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C408_C408.py_allow_dict_calls_with_keyword_arguments.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C408_C408.py_allow_dict_calls_with_keyword_arguments.snap index bb8c4f230c..b79589d209 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C408_C408.py_allow_dict_calls_with_keyword_arguments.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C408_C408.py_allow_dict_calls_with_keyword_arguments.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs --- -error[C408]: C408.py:1:5: [*] Unnecessary `tuple` call (rewrite as a literal) +error[C408]: 1:5: [*] Unnecessary `tuple` call (rewrite as a literal) + --> C408.py:1:5 | 1 | t = tuple() | ^^^^^^^ @@ -17,8 +18,9 @@ error[C408]: C408.py:1:5: [*] Unnecessary `tuple` call (rewrite as a literal) 3 3 | d1 = dict() 4 4 | d2 = dict(a=1) -error[C408]: C408.py:2:5: [*] Unnecessary `list` call (rewrite as a literal) +error[C408]: 2:5: [*] Unnecessary `list` call (rewrite as a literal) + --> C408.py:2:5 | 1 | t = tuple() 2 | l = list() @@ -35,8 +37,9 @@ error[C408]: C408.py:2:5: [*] Unnecessary `list` call (rewrite as a literal) 4 4 | d2 = dict(a=1) 5 5 | d3 = dict(**d2) -error[C408]: C408.py:3:6: [*] Unnecessary `dict` call (rewrite as a literal) +error[C408]: 3:6: [*] Unnecessary `dict` call (rewrite as a literal) + --> C408.py:3:6 | 1 | t = tuple() 2 | l = list() @@ -55,8 +58,9 @@ error[C408]: C408.py:3:6: [*] Unnecessary `dict` call (rewrite as a literal) 5 5 | d3 = dict(**d2) 6 6 | -error[C408]: C408.py:16:4: [*] Unnecessary `dict` call (rewrite as a literal) +error[C408]: 16:4: [*] Unnecessary `dict` call (rewrite as a literal) + --> C408.py:16:4 | 14 | f"{dict(x='y')}" 15 | f'{dict(x="y")}' @@ -75,8 +79,9 @@ error[C408]: C408.py:16:4: [*] Unnecessary `dict` call (rewrite as a literal) 18 18 | 19 19 | f"{dict(x='y') | dict(y='z')}" -error[C408]: C408.py:17:6: [*] Unnecessary `dict` call (rewrite as a literal) +error[C408]: 17:6: [*] Unnecessary `dict` call (rewrite as a literal) + --> C408.py:17:6 | 15 | f'{dict(x="y")}' 16 | f"{dict()}" @@ -96,8 +101,9 @@ error[C408]: C408.py:17:6: [*] Unnecessary `dict` call (rewrite as a literal) 19 19 | f"{dict(x='y') | dict(y='z')}" 20 20 | f"{ dict(x='y') | dict(y='z') }" -error[C408]: C408.py:24:1: [*] Unnecessary `dict` call (rewrite as a literal) +error[C408]: 24:1: [*] Unnecessary `dict` call (rewrite as a literal) + --> C408.py:23:1 | 22 | f"a { dict(x='y') | dict(y='z') } b" 23 | @@ -122,8 +128,9 @@ error[C408]: C408.py:24:1: [*] Unnecessary `dict` call (rewrite as a literal) 28 28 | tuple( # comment 29 29 | ) -error[C408]: C408.py:28:1: [*] Unnecessary `tuple` call (rewrite as a literal) +error[C408]: 28:1: [*] Unnecessary `tuple` call (rewrite as a literal) + --> C408.py:27:1 | 26 | ) 27 | diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C409_C409.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C409_C409.py.snap index e2dbdb31f2..481c8c35b2 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C409_C409.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C409_C409.py.snap @@ -1,15 +1,16 @@ --- source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs --- -C409.py:1:6: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite as a `tuple` literal) +error[C409]: 1:6: [*] Unnecessary `list` literal passed to `tuple()` (rewrite as a `tuple` literal) + + --> C409.py:1:6 | 1 | t1 = tuple([]) - | ^^^^^^^^^ C409 + | ^^^^^^^^^ 2 | t2 = tuple([1, 2]) 3 | t3 = tuple((1, 2)) | = help: Rewrite as a `tuple` literal - ℹ Unsafe fix 1 |-t1 = tuple([]) 1 |+t1 = () @@ -17,16 +18,17 @@ C409.py:1:6: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite as 3 3 | t3 = tuple((1, 2)) 4 4 | t4 = tuple([ -C409.py:2:6: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite as a `tuple` literal) +error[C409]: 2:6: [*] Unnecessary `list` literal passed to `tuple()` (rewrite as a `tuple` literal) + + --> C409.py:2:6 | 1 | t1 = tuple([]) 2 | t2 = tuple([1, 2]) - | ^^^^^^^^^^^^^ C409 + | ^^^^^^^^^^^^^ 3 | t3 = tuple((1, 2)) 4 | t4 = tuple([ | = help: Rewrite as a `tuple` literal - ℹ Unsafe fix 1 1 | t1 = tuple([]) 2 |-t2 = tuple([1, 2]) @@ -35,17 +37,18 @@ C409.py:2:6: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite as 4 4 | t4 = tuple([ 5 5 | 1, -C409.py:3:6: C409 [*] Unnecessary `tuple` literal passed to `tuple()` (remove the outer call to `tuple()`) +error[C409]: 3:6: [*] Unnecessary `tuple` literal passed to `tuple()` (remove the outer call to `tuple()`) + + --> C409.py:3:6 | 1 | t1 = tuple([]) 2 | t2 = tuple([1, 2]) 3 | t3 = tuple((1, 2)) - | ^^^^^^^^^^^^^ C409 + | ^^^^^^^^^^^^^ 4 | t4 = tuple([ 5 | 1, | = help: Remove the outer call to `tuple()` - ℹ Unsafe fix 1 1 | t1 = tuple([]) 2 2 | t2 = tuple([1, 2]) @@ -55,7 +58,9 @@ C409.py:3:6: C409 [*] Unnecessary `tuple` literal passed to `tuple()` (remove th 5 5 | 1, 6 6 | 2 -C409.py:4:6: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite as a `tuple` literal) +error[C409]: 4:6: [*] Unnecessary `list` literal passed to `tuple()` (rewrite as a `tuple` literal) + + --> C409.py:4:6 | 2 | t2 = tuple([1, 2]) 3 | t3 = tuple((1, 2)) @@ -64,12 +69,11 @@ C409.py:4:6: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite as 5 | | 1, 6 | | 2 7 | | ]) - | |__^ C409 + | |__^ 8 | t5 = tuple( 9 | (1, 2) | = help: Rewrite as a `tuple` literal - ℹ Unsafe fix 1 1 | t1 = tuple([]) 2 2 | t2 = tuple([1, 2]) @@ -84,7 +88,9 @@ C409.py:4:6: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite as 9 9 | (1, 2) 10 10 | ) -C409.py:8:6: C409 [*] Unnecessary `tuple` literal passed to `tuple()` (remove the outer call to `tuple()`) +error[C409]: 8:6: [*] Unnecessary `tuple` literal passed to `tuple()` (remove the outer call to `tuple()`) + + --> C409.py:8:6 | 6 | 2 7 | ]) @@ -92,12 +98,11 @@ C409.py:8:6: C409 [*] Unnecessary `tuple` literal passed to `tuple()` (remove th | ______^ 9 | | (1, 2) 10 | | ) - | |_^ C409 + | |_^ 11 | 12 | tuple( # comment | = help: Remove the outer call to `tuple()` - ℹ Unsafe fix 5 5 | 1, 6 6 | 2 @@ -110,19 +115,20 @@ C409.py:8:6: C409 [*] Unnecessary `tuple` literal passed to `tuple()` (remove th 12 10 | tuple( # comment 13 11 | [1, 2] -C409.py:12:1: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite as a `tuple` literal) +error[C409]: 12:1: [*] Unnecessary `list` literal passed to `tuple()` (rewrite as a `tuple` literal) + + --> C409.py:11:1 | 10 | ) 11 | 12 | / tuple( # comment 13 | | [1, 2] 14 | | ) - | |_^ C409 + | |_^ 15 | 16 | tuple([ # comment | = help: Rewrite as a `tuple` literal - ℹ Unsafe fix 9 9 | (1, 2) 10 10 | ) @@ -135,19 +141,20 @@ C409.py:12:1: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite a 16 14 | tuple([ # comment 17 15 | 1, 2 -C409.py:16:1: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite as a `tuple` literal) +error[C409]: 16:1: [*] Unnecessary `list` literal passed to `tuple()` (rewrite as a `tuple` literal) + + --> C409.py:15:1 | 14 | ) 15 | 16 | / tuple([ # comment 17 | | 1, 2 18 | | ]) - | |__^ C409 + | |__^ 19 | 20 | tuple(( | = help: Rewrite as a `tuple` literal - ℹ Unsafe fix 13 13 | [1, 2] 14 14 | ) @@ -161,19 +168,20 @@ C409.py:16:1: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite a 20 20 | tuple(( 21 21 | 1, -C409.py:20:1: C409 [*] Unnecessary `tuple` literal passed to `tuple()` (remove the outer call to `tuple()`) +error[C409]: 20:1: [*] Unnecessary `tuple` literal passed to `tuple()` (remove the outer call to `tuple()`) + + --> C409.py:19:1 | 18 | ]) 19 | 20 | / tuple(( 21 | | 1, 22 | | )) - | |__^ C409 + | |__^ 23 | 24 | t6 = tuple([1]) | = help: Remove the outer call to `tuple()` - ℹ Unsafe fix 17 17 | 1, 2 18 18 | ]) @@ -187,17 +195,18 @@ C409.py:20:1: C409 [*] Unnecessary `tuple` literal passed to `tuple()` (remove t 24 24 | t6 = tuple([1]) 25 25 | t7 = tuple((1,)) -C409.py:24:6: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite as a `tuple` literal) +error[C409]: 24:6: [*] Unnecessary `list` literal passed to `tuple()` (rewrite as a `tuple` literal) + + --> C409.py:24:6 | 22 | )) 23 | 24 | t6 = tuple([1]) - | ^^^^^^^^^^ C409 + | ^^^^^^^^^^ 25 | t7 = tuple((1,)) 26 | t8 = tuple([1,]) | = help: Rewrite as a `tuple` literal - ℹ Unsafe fix 21 21 | 1, 22 22 | )) @@ -208,15 +217,16 @@ C409.py:24:6: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite a 26 26 | t8 = tuple([1,]) 27 27 | -C409.py:25:6: C409 [*] Unnecessary `tuple` literal passed to `tuple()` (remove the outer call to `tuple()`) +error[C409]: 25:6: [*] Unnecessary `tuple` literal passed to `tuple()` (remove the outer call to `tuple()`) + + --> C409.py:25:6 | 24 | t6 = tuple([1]) 25 | t7 = tuple((1,)) - | ^^^^^^^^^^^ C409 + | ^^^^^^^^^^^ 26 | t8 = tuple([1,]) | = help: Remove the outer call to `tuple()` - ℹ Unsafe fix 22 22 | )) 23 23 | @@ -227,17 +237,18 @@ C409.py:25:6: C409 [*] Unnecessary `tuple` literal passed to `tuple()` (remove t 27 27 | 28 28 | tuple([x for x in range(5)]) -C409.py:26:6: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite as a `tuple` literal) +error[C409]: 26:6: [*] Unnecessary `list` literal passed to `tuple()` (rewrite as a `tuple` literal) + + --> C409.py:26:6 | 24 | t6 = tuple([1]) 25 | t7 = tuple((1,)) 26 | t8 = tuple([1,]) - | ^^^^^^^^^^^ C409 + | ^^^^^^^^^^^ 27 | 28 | tuple([x for x in range(5)]) | = help: Rewrite as a `tuple` literal - ℹ Unsafe fix 23 23 | 24 24 | t6 = tuple([1]) diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C410_C410.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C410_C410.py.snap index e68a8c11d0..81d12d596f 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C410_C410.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C410_C410.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs --- -error[C410]: C410.py:1:6: [*] Unnecessary `list` literal passed to `list()` (remove the outer call to `list()`) +error[C410]: 1:6: [*] Unnecessary `list` literal passed to `list()` (remove the outer call to `list()`) + --> C410.py:1:6 | 1 | l1 = list([1, 2]) | ^^^^^^^^^^^^ @@ -17,8 +18,9 @@ error[C410]: C410.py:1:6: [*] Unnecessary `list` literal passed to `list()` (rem 3 3 | l3 = list([]) 4 4 | l4 = list(()) -error[C410]: C410.py:2:6: [*] Unnecessary `tuple` literal passed to `list()` (rewrite as a `list` literal) +error[C410]: 2:6: [*] Unnecessary `tuple` literal passed to `list()` (rewrite as a `list` literal) + --> C410.py:2:6 | 1 | l1 = list([1, 2]) 2 | l2 = list((1, 2)) @@ -35,8 +37,9 @@ error[C410]: C410.py:2:6: [*] Unnecessary `tuple` literal passed to `list()` (re 4 4 | l4 = list(()) 5 5 | -error[C410]: C410.py:3:6: [*] Unnecessary `list` literal passed to `list()` (remove the outer call to `list()`) +error[C410]: 3:6: [*] Unnecessary `list` literal passed to `list()` (remove the outer call to `list()`) + --> C410.py:3:6 | 1 | l1 = list([1, 2]) 2 | l2 = list((1, 2)) @@ -54,8 +57,9 @@ error[C410]: C410.py:3:6: [*] Unnecessary `list` literal passed to `list()` (rem 5 5 | 6 6 | -error[C410]: C410.py:4:6: [*] Unnecessary `tuple` literal passed to `list()` (rewrite as a `list` literal) +error[C410]: 4:6: [*] Unnecessary `tuple` literal passed to `list()` (rewrite as a `list` literal) + --> C410.py:4:6 | 2 | l2 = list((1, 2)) 3 | l3 = list([]) @@ -73,8 +77,9 @@ error[C410]: C410.py:4:6: [*] Unnecessary `tuple` literal passed to `list()` (re 6 6 | 7 7 | list( # comment -error[C410]: C410.py:7:1: [*] Unnecessary `list` literal passed to `list()` (remove the outer call to `list()`) +error[C410]: 7:1: [*] Unnecessary `list` literal passed to `list()` (remove the outer call to `list()`) + --> C410.py:7:1 | 7 | / list( # comment 8 | | [1, 2] @@ -96,8 +101,9 @@ error[C410]: C410.py:7:1: [*] Unnecessary `list` literal passed to `list()` (rem 11 9 | list([ # comment 12 10 | 1, 2 -error[C410]: C410.py:11:1: [*] Unnecessary `list` literal passed to `list()` (remove the outer call to `list()`) +error[C410]: 11:1: [*] Unnecessary `list` literal passed to `list()` (remove the outer call to `list()`) + --> C410.py:10:1 | 9 | ) 10 | diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C411_C411.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C411_C411.py.snap index ce93e62707..a50273ed1f 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C411_C411.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C411_C411.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs --- -error[C411]: C411.py:2:1: [*] Unnecessary `list` call (remove the outer call to `list()`) +error[C411]: 2:1: [*] Unnecessary `list` call (remove the outer call to `list()`) + --> C411.py:1:14 | 1 | x = [1, 2, 3] 2 | list([i for i in x]) diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C413_C413.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C413_C413.py.snap index 02e8f49892..3450fe1950 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C413_C413.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C413_C413.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs --- -error[C413]: C413.py:3:1: [*] Unnecessary `list` call around `sorted()` +error[C413]: 3:1: [*] Unnecessary `list` call around `sorted()` + --> C413.py:2:8 | 1 | x = [2, 3, 1] 2 | list(x) @@ -21,8 +22,9 @@ error[C413]: C413.py:3:1: [*] Unnecessary `list` call around `sorted()` 5 5 | reversed(sorted(x, key=lambda e: e)) 6 6 | reversed(sorted(x, reverse=True)) -error[C413]: C413.py:4:1: [*] Unnecessary `reversed` call around `sorted()` +error[C413]: 4:1: [*] Unnecessary `reversed` call around `sorted()` + --> C413.py:3:16 | 2 | list(x) 3 | list(sorted(x)) @@ -42,8 +44,9 @@ error[C413]: C413.py:4:1: [*] Unnecessary `reversed` call around `sorted()` 6 6 | reversed(sorted(x, reverse=True)) 7 7 | reversed(sorted(x, key=lambda e: e, reverse=True)) -error[C413]: C413.py:5:1: [*] Unnecessary `reversed` call around `sorted()` +error[C413]: 5:1: [*] Unnecessary `reversed` call around `sorted()` + --> C413.py:4:20 | 3 | list(sorted(x)) 4 | reversed(sorted(x)) @@ -63,8 +66,9 @@ error[C413]: C413.py:5:1: [*] Unnecessary `reversed` call around `sorted()` 7 7 | reversed(sorted(x, key=lambda e: e, reverse=True)) 8 8 | reversed(sorted(x, reverse=True, key=lambda e: e)) -error[C413]: C413.py:6:1: [*] Unnecessary `reversed` call around `sorted()` +error[C413]: 6:1: [*] Unnecessary `reversed` call around `sorted()` + --> C413.py:5:37 | 4 | reversed(sorted(x)) 5 | reversed(sorted(x, key=lambda e: e)) @@ -84,8 +88,9 @@ error[C413]: C413.py:6:1: [*] Unnecessary `reversed` call around `sorted()` 8 8 | reversed(sorted(x, reverse=True, key=lambda e: e)) 9 9 | reversed(sorted(x, reverse=False)) -error[C413]: C413.py:7:1: [*] Unnecessary `reversed` call around `sorted()` +error[C413]: 7:1: [*] Unnecessary `reversed` call around `sorted()` + --> C413.py:6:34 | 5 | reversed(sorted(x, key=lambda e: e)) 6 | reversed(sorted(x, reverse=True)) @@ -105,8 +110,9 @@ error[C413]: C413.py:7:1: [*] Unnecessary `reversed` call around `sorted()` 9 9 | reversed(sorted(x, reverse=False)) 10 10 | reversed(sorted(x, reverse=x)) -error[C413]: C413.py:8:1: [*] Unnecessary `reversed` call around `sorted()` +error[C413]: 8:1: [*] Unnecessary `reversed` call around `sorted()` + --> C413.py:7:51 | 6 | reversed(sorted(x, reverse=True)) 7 | reversed(sorted(x, key=lambda e: e, reverse=True)) @@ -126,8 +132,9 @@ error[C413]: C413.py:8:1: [*] Unnecessary `reversed` call around `sorted()` 10 10 | reversed(sorted(x, reverse=x)) 11 11 | reversed(sorted(x, reverse=not x)) -error[C413]: C413.py:9:1: [*] Unnecessary `reversed` call around `sorted()` +error[C413]: 9:1: [*] Unnecessary `reversed` call around `sorted()` + --> C413.py:8:51 | 7 | reversed(sorted(x, key=lambda e: e, reverse=True)) 8 | reversed(sorted(x, reverse=True, key=lambda e: e)) @@ -147,8 +154,9 @@ error[C413]: C413.py:9:1: [*] Unnecessary `reversed` call around `sorted()` 11 11 | reversed(sorted(x, reverse=not x)) 12 12 | -error[C413]: C413.py:10:1: [*] Unnecessary `reversed` call around `sorted()` +error[C413]: 10:1: [*] Unnecessary `reversed` call around `sorted()` + --> C413.py:9:35 | 8 | reversed(sorted(x, reverse=True, key=lambda e: e)) 9 | reversed(sorted(x, reverse=False)) @@ -167,8 +175,9 @@ error[C413]: C413.py:10:1: [*] Unnecessary `reversed` call around `sorted()` 12 12 | 13 13 | # Regression test for: https://github.com/astral-sh/ruff/issues/7289 -error[C413]: C413.py:11:1: [*] Unnecessary `reversed` call around `sorted()` +error[C413]: 11:1: [*] Unnecessary `reversed` call around `sorted()` + --> C413.py:10:31 | 9 | reversed(sorted(x, reverse=False)) 10 | reversed(sorted(x, reverse=x)) @@ -188,8 +197,9 @@ error[C413]: C413.py:11:1: [*] Unnecessary `reversed` call around `sorted()` 13 13 | # Regression test for: https://github.com/astral-sh/ruff/issues/7289 14 14 | reversed(sorted(i for i in range(42))) -error[C413]: C413.py:14:1: [*] Unnecessary `reversed` call around `sorted()` +error[C413]: 14:1: [*] Unnecessary `reversed` call around `sorted()` + --> C413.py:13:69 | 13 | # Regression test for: https://github.com/astral-sh/ruff/issues/7289 14 | reversed(sorted(i for i in range(42))) @@ -207,8 +217,9 @@ error[C413]: C413.py:14:1: [*] Unnecessary `reversed` call around `sorted()` 16 16 | 17 17 | # Regression test for: https://github.com/astral-sh/ruff/issues/10335 -error[C413]: C413.py:15:1: [*] Unnecessary `reversed` call around `sorted()` +error[C413]: 15:1: [*] Unnecessary `reversed` call around `sorted()` + --> C413.py:14:39 | 13 | # Regression test for: https://github.com/astral-sh/ruff/issues/7289 14 | reversed(sorted(i for i in range(42))) @@ -228,8 +239,9 @@ error[C413]: C413.py:15:1: [*] Unnecessary `reversed` call around `sorted()` 17 17 | # Regression test for: https://github.com/astral-sh/ruff/issues/10335 18 18 | reversed(sorted([1, 2, 3], reverse=False or True)) -error[C413]: C413.py:18:1: [*] Unnecessary `reversed` call around `sorted()` +error[C413]: 18:1: [*] Unnecessary `reversed` call around `sorted()` + --> C413.py:17:70 | 17 | # Regression test for: https://github.com/astral-sh/ruff/issues/10335 18 | reversed(sorted([1, 2, 3], reverse=False or True)) @@ -245,8 +257,9 @@ error[C413]: C413.py:18:1: [*] Unnecessary `reversed` call around `sorted()` 18 |+sorted([1, 2, 3], reverse=not (False or True)) 19 19 | reversed(sorted([1, 2, 3], reverse=(False or True))) -error[C413]: C413.py:19:1: [*] Unnecessary `reversed` call around `sorted()` +error[C413]: 19:1: [*] Unnecessary `reversed` call around `sorted()` + --> C413.py:18:51 | 17 | # Regression test for: https://github.com/astral-sh/ruff/issues/10335 18 | reversed(sorted([1, 2, 3], reverse=False or True)) diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C414_C414.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C414_C414.py.snap index 6a628094f8..f0e6235a31 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C414_C414.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C414_C414.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs --- -error[C414]: C414.py:2:1: [*] Unnecessary `list` call within `list()` +error[C414]: 2:1: [*] Unnecessary `list` call within `list()` + --> C414.py:1:14 | 1 | x = [1, 2, 3] 2 | list(list(x)) @@ -19,8 +20,9 @@ error[C414]: C414.py:2:1: [*] Unnecessary `list` call within `list()` 4 4 | tuple(list(x)) 5 5 | tuple(tuple(x)) -error[C414]: C414.py:3:1: [*] Unnecessary `tuple` call within `list()` +error[C414]: 3:1: [*] Unnecessary `tuple` call within `list()` + --> C414.py:2:14 | 1 | x = [1, 2, 3] 2 | list(list(x)) @@ -39,8 +41,9 @@ error[C414]: C414.py:3:1: [*] Unnecessary `tuple` call within `list()` 5 5 | tuple(tuple(x)) 6 6 | set(set(x)) -error[C414]: C414.py:4:1: [*] Unnecessary `list` call within `tuple()` +error[C414]: 4:1: [*] Unnecessary `list` call within `tuple()` + --> C414.py:3:15 | 2 | list(list(x)) 3 | list(tuple(x)) @@ -60,8 +63,9 @@ error[C414]: C414.py:4:1: [*] Unnecessary `list` call within `tuple()` 6 6 | set(set(x)) 7 7 | set(list(x)) -error[C414]: C414.py:5:1: [*] Unnecessary `tuple` call within `tuple()` +error[C414]: 5:1: [*] Unnecessary `tuple` call within `tuple()` + --> C414.py:4:15 | 3 | list(tuple(x)) 4 | tuple(list(x)) @@ -81,8 +85,9 @@ error[C414]: C414.py:5:1: [*] Unnecessary `tuple` call within `tuple()` 7 7 | set(list(x)) 8 8 | set(tuple(x)) -error[C414]: C414.py:6:1: [*] Unnecessary `set` call within `set()` +error[C414]: 6:1: [*] Unnecessary `set` call within `set()` + --> C414.py:5:16 | 4 | tuple(list(x)) 5 | tuple(tuple(x)) @@ -102,8 +107,9 @@ error[C414]: C414.py:6:1: [*] Unnecessary `set` call within `set()` 8 8 | set(tuple(x)) 9 9 | set(sorted(x)) -error[C414]: C414.py:7:1: [*] Unnecessary `list` call within `set()` +error[C414]: 7:1: [*] Unnecessary `list` call within `set()` + --> C414.py:6:12 | 5 | tuple(tuple(x)) 6 | set(set(x)) @@ -123,8 +129,9 @@ error[C414]: C414.py:7:1: [*] Unnecessary `list` call within `set()` 9 9 | set(sorted(x)) 10 10 | set(sorted(x, key=lambda y: y)) -error[C414]: C414.py:8:1: [*] Unnecessary `tuple` call within `set()` +error[C414]: 8:1: [*] Unnecessary `tuple` call within `set()` + --> C414.py:7:13 | 6 | set(set(x)) 7 | set(list(x)) @@ -144,8 +151,9 @@ error[C414]: C414.py:8:1: [*] Unnecessary `tuple` call within `set()` 10 10 | set(sorted(x, key=lambda y: y)) 11 11 | set(reversed(x)) -error[C414]: C414.py:9:1: [*] Unnecessary `sorted` call within `set()` +error[C414]: 9:1: [*] Unnecessary `sorted` call within `set()` + --> C414.py:8:14 | 7 | set(list(x)) 8 | set(tuple(x)) @@ -165,8 +173,9 @@ error[C414]: C414.py:9:1: [*] Unnecessary `sorted` call within `set()` 11 11 | set(reversed(x)) 12 12 | sorted(list(x)) -error[C414]: C414.py:10:1: [*] Unnecessary `sorted` call within `set()` +error[C414]: 10:1: [*] Unnecessary `sorted` call within `set()` + --> C414.py:9:15 | 8 | set(tuple(x)) 9 | set(sorted(x)) @@ -186,8 +195,9 @@ error[C414]: C414.py:10:1: [*] Unnecessary `sorted` call within `set()` 12 12 | sorted(list(x)) 13 13 | sorted(tuple(x)) -error[C414]: C414.py:11:1: [*] Unnecessary `reversed` call within `set()` +error[C414]: 11:1: [*] Unnecessary `reversed` call within `set()` + --> C414.py:10:32 | 9 | set(sorted(x)) 10 | set(sorted(x, key=lambda y: y)) @@ -207,8 +217,9 @@ error[C414]: C414.py:11:1: [*] Unnecessary `reversed` call within `set()` 13 13 | sorted(tuple(x)) 14 14 | sorted(sorted(x)) -error[C414]: C414.py:12:1: [*] Unnecessary `list` call within `sorted()` +error[C414]: 12:1: [*] Unnecessary `list` call within `sorted()` + --> C414.py:11:17 | 10 | set(sorted(x, key=lambda y: y)) 11 | set(reversed(x)) @@ -228,8 +239,9 @@ error[C414]: C414.py:12:1: [*] Unnecessary `list` call within `sorted()` 14 14 | sorted(sorted(x)) 15 15 | sorted(sorted(x, key=foo, reverse=False), reverse=False, key=foo) -error[C414]: C414.py:13:1: [*] Unnecessary `tuple` call within `sorted()` +error[C414]: 13:1: [*] Unnecessary `tuple` call within `sorted()` + --> C414.py:12:16 | 11 | set(reversed(x)) 12 | sorted(list(x)) @@ -249,8 +261,9 @@ error[C414]: C414.py:13:1: [*] Unnecessary `tuple` call within `sorted()` 15 15 | sorted(sorted(x, key=foo, reverse=False), reverse=False, key=foo) 16 16 | sorted(sorted(x, reverse=True), reverse=True) -error[C414]: C414.py:14:1: [*] Unnecessary `sorted` call within `sorted()` +error[C414]: 14:1: [*] Unnecessary `sorted` call within `sorted()` + --> C414.py:13:17 | 12 | sorted(list(x)) 13 | sorted(tuple(x)) @@ -270,8 +283,9 @@ error[C414]: C414.py:14:1: [*] Unnecessary `sorted` call within `sorted()` 16 16 | sorted(sorted(x, reverse=True), reverse=True) 17 17 | sorted(reversed(x)) -error[C414]: C414.py:15:1: [*] Unnecessary `sorted` call within `sorted()` +error[C414]: 15:1: [*] Unnecessary `sorted` call within `sorted()` + --> C414.py:14:18 | 13 | sorted(tuple(x)) 14 | sorted(sorted(x)) @@ -291,8 +305,9 @@ error[C414]: C414.py:15:1: [*] Unnecessary `sorted` call within `sorted()` 17 17 | sorted(reversed(x)) 18 18 | sorted(list(x), key=lambda y: y) -error[C414]: C414.py:16:1: [*] Unnecessary `sorted` call within `sorted()` +error[C414]: 16:1: [*] Unnecessary `sorted` call within `sorted()` + --> C414.py:15:66 | 14 | sorted(sorted(x)) 15 | sorted(sorted(x, key=foo, reverse=False), reverse=False, key=foo) @@ -312,8 +327,9 @@ error[C414]: C414.py:16:1: [*] Unnecessary `sorted` call within `sorted()` 18 18 | sorted(list(x), key=lambda y: y) 19 19 | tuple( -error[C414]: C414.py:17:1: [*] Unnecessary `reversed` call within `sorted()` +error[C414]: 17:1: [*] Unnecessary `reversed` call within `sorted()` + --> C414.py:16:46 | 15 | sorted(sorted(x, key=foo, reverse=False), reverse=False, key=foo) 16 | sorted(sorted(x, reverse=True), reverse=True) @@ -333,8 +349,9 @@ error[C414]: C414.py:17:1: [*] Unnecessary `reversed` call within `sorted()` 19 19 | tuple( 20 20 | list( -error[C414]: C414.py:18:1: [*] Unnecessary `list` call within `sorted()` +error[C414]: 18:1: [*] Unnecessary `list` call within `sorted()` + --> C414.py:17:20 | 16 | sorted(sorted(x, reverse=True), reverse=True) 17 | sorted(reversed(x)) @@ -354,8 +371,9 @@ error[C414]: C414.py:18:1: [*] Unnecessary `list` call within `sorted()` 20 20 | list( 21 21 | [x, 3, "hell"\ -error[C414]: C414.py:19:1: [*] Unnecessary `list` call within `tuple()` +error[C414]: 19:1: [*] Unnecessary `list` call within `tuple()` + --> C414.py:18:33 | 17 | sorted(reversed(x)) 18 | sorted(list(x), key=lambda y: y) @@ -383,8 +401,9 @@ error[C414]: C414.py:19:1: [*] Unnecessary `list` call within `tuple()` 25 23 | set(set()) 26 24 | set(list()) -error[C414]: C414.py:25:1: [*] Unnecessary `set` call within `set()` +error[C414]: 25:1: [*] Unnecessary `set` call within `set()` + --> C414.py:24:2 | 23 | ) 24 | ) @@ -404,8 +423,9 @@ error[C414]: C414.py:25:1: [*] Unnecessary `set` call within `set()` 27 27 | set(tuple()) 28 28 | sorted(reversed()) -error[C414]: C414.py:26:1: [*] Unnecessary `list` call within `set()` +error[C414]: 26:1: [*] Unnecessary `list` call within `set()` + --> C414.py:25:11 | 24 | ) 25 | set(set()) @@ -425,8 +445,9 @@ error[C414]: C414.py:26:1: [*] Unnecessary `list` call within `set()` 28 28 | sorted(reversed()) 29 29 | -error[C414]: C414.py:27:1: [*] Unnecessary `tuple` call within `set()` +error[C414]: 27:1: [*] Unnecessary `tuple` call within `set()` + --> C414.py:26:12 | 25 | set(set()) 26 | set(list()) @@ -445,8 +466,9 @@ error[C414]: C414.py:27:1: [*] Unnecessary `tuple` call within `set()` 29 29 | 30 30 | # Nested sorts with differing keyword arguments. Not flagged. -error[C414]: C414.py:28:1: [*] Unnecessary `reversed` call within `sorted()` +error[C414]: 28:1: [*] Unnecessary `reversed` call within `sorted()` + --> C414.py:27:13 | 26 | set(list()) 27 | set(tuple()) @@ -466,8 +488,9 @@ error[C414]: C414.py:28:1: [*] Unnecessary `reversed` call within `sorted()` 30 30 | # Nested sorts with differing keyword arguments. Not flagged. 31 31 | sorted(sorted(x, key=lambda y: y)) -error[C414]: C414.py:37:27: [*] Unnecessary `list` call within `sorted()` +error[C414]: 37:27: [*] Unnecessary `list` call within `sorted()` + --> C414.py:37:27 | 36 | # Preserve trailing comments. 37 | xxxxxxxxxxx_xxxxx_xxxxx = sorted( @@ -492,8 +515,9 @@ error[C414]: C414.py:37:27: [*] Unnecessary `list` call within `sorted()` 40 40 | # xx xxxx xxxxxxx xxxx xxx xxxxxxxx Nxxx 41 41 | key=lambda xxxxx: xxxxx or "", -error[C414]: C414.py:44:27: [*] Unnecessary `list` call within `sorted()` +error[C414]: 44:27: [*] Unnecessary `list` call within `sorted()` + --> C414.py:44:27 | 42 | ) 43 | diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C415_C415.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C415_C415.py.snap index 8f4d89c160..ba35056b42 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C415_C415.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C415_C415.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs --- -error[C415]: C415.py:2:5: Unnecessary subscript reversal of iterable within `set()` +error[C415]: 2:5: Unnecessary subscript reversal of iterable within `set()` + --> C415.py:2:5 | 1 | lst = [2, 1, 3] 2 | a = set(lst[::-1]) @@ -10,8 +11,9 @@ error[C415]: C415.py:2:5: Unnecessary subscript reversal of iterable within `set 3 | b = reversed(lst[::-1]) 4 | c = sorted(lst[::-1]) | -error[C415]: C415.py:3:5: Unnecessary subscript reversal of iterable within `reversed()` +error[C415]: 3:5: Unnecessary subscript reversal of iterable within `reversed()` + --> C415.py:3:5 | 1 | lst = [2, 1, 3] 2 | a = set(lst[::-1]) @@ -20,8 +22,9 @@ error[C415]: C415.py:3:5: Unnecessary subscript reversal of iterable within `rev 4 | c = sorted(lst[::-1]) 5 | d = sorted(lst[::-1], reverse=True) | -error[C415]: C415.py:4:5: Unnecessary subscript reversal of iterable within `sorted()` +error[C415]: 4:5: Unnecessary subscript reversal of iterable within `sorted()` + --> C415.py:4:5 | 2 | a = set(lst[::-1]) 3 | b = reversed(lst[::-1]) @@ -30,8 +33,9 @@ error[C415]: C415.py:4:5: Unnecessary subscript reversal of iterable within `sor 5 | d = sorted(lst[::-1], reverse=True) 6 | e = set(lst[2:-1]) | -error[C415]: C415.py:5:5: Unnecessary subscript reversal of iterable within `sorted()` +error[C415]: 5:5: Unnecessary subscript reversal of iterable within `sorted()` + --> C415.py:5:5 | 3 | b = reversed(lst[::-1]) 4 | c = sorted(lst[::-1]) diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C416_C416.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C416_C416.py.snap index f8c3adbf1a..27a0d1f04b 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C416_C416.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C416_C416.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs --- -error[C416]: C416.py:6:1: [*] Unnecessary `list` comprehension (rewrite using `list()`) +error[C416]: 6:1: [*] Unnecessary `list` comprehension (rewrite using `list()`) + --> C416.py:5:1 | 4 | d = {"a": 1, "b": 2, "c": 3} 5 | @@ -22,8 +23,9 @@ error[C416]: C416.py:6:1: [*] Unnecessary `list` comprehension (rewrite using `l 8 8 | {k: v for k, v in y} 9 9 | {k: v for k, v in d.items()} -error[C416]: C416.py:7:1: [*] Unnecessary `set` comprehension (rewrite using `set()`) +error[C416]: 7:1: [*] Unnecessary `set` comprehension (rewrite using `set()`) + --> C416.py:6:15 | 6 | [i for i in x] 7 | {i for i in x} @@ -42,8 +44,9 @@ error[C416]: C416.py:7:1: [*] Unnecessary `set` comprehension (rewrite using `se 9 9 | {k: v for k, v in d.items()} 10 10 | [(k, v) for k, v in d.items()] -error[C416]: C416.py:8:1: [*] Unnecessary `dict` comprehension (rewrite using `dict()`) +error[C416]: 8:1: [*] Unnecessary `dict` comprehension (rewrite using `dict()`) + --> C416.py:7:15 | 6 | [i for i in x] 7 | {i for i in x} @@ -63,8 +66,9 @@ error[C416]: C416.py:8:1: [*] Unnecessary `dict` comprehension (rewrite using `d 10 10 | [(k, v) for k, v in d.items()] 11 11 | {k: (a, b) for k, (a, b) in d.items()} -error[C416]: C416.py:9:1: [*] Unnecessary `dict` comprehension (rewrite using `dict()`) +error[C416]: 9:1: [*] Unnecessary `dict` comprehension (rewrite using `dict()`) + --> C416.py:8:21 | 7 | {i for i in x} 8 | {k: v for k, v in y} @@ -84,8 +88,9 @@ error[C416]: C416.py:9:1: [*] Unnecessary `dict` comprehension (rewrite using `d 11 11 | {k: (a, b) for k, (a, b) in d.items()} 12 12 | -error[C416]: C416.py:10:1: [*] Unnecessary `list` comprehension (rewrite using `list()`) +error[C416]: 10:1: [*] Unnecessary `list` comprehension (rewrite using `list()`) + --> C416.py:9:29 | 8 | {k: v for k, v in y} 9 | {k: v for k, v in d.items()} @@ -104,8 +109,9 @@ error[C416]: C416.py:10:1: [*] Unnecessary `list` comprehension (rewrite using ` 12 12 | 13 13 | [i for i, in z] -error[C416]: C416.py:11:1: [*] Unnecessary `dict` comprehension (rewrite using `dict()`) +error[C416]: 11:1: [*] Unnecessary `dict` comprehension (rewrite using `dict()`) + --> C416.py:10:31 | 9 | {k: v for k, v in d.items()} 10 | [(k, v) for k, v in d.items()] @@ -125,8 +131,9 @@ error[C416]: C416.py:11:1: [*] Unnecessary `dict` comprehension (rewrite using ` 13 13 | [i for i, in z] 14 14 | [i for i, j in y] -error[C416]: C416.py:24:70: [*] Unnecessary `list` comprehension (rewrite using `list()`) +error[C416]: 24:70: [*] Unnecessary `list` comprehension (rewrite using `list()`) + --> C416.py:24:70 | 23 | # Regression test for: https://github.com/astral-sh/ruff/issues/7196 24 | any(len(symbol_table.get_by_type(symbol_type)) > 0 for symbol_type in[t for t in SymbolType]) diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C417_C417.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C417_C417.py.snap index 12dfb7f1b7..675f34c167 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C417_C417.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C417_C417.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs --- -error[C417]: C417.py:3:1: [*] Unnecessary `map` usage (rewrite using a generator expression) +error[C417]: 3:1: [*] Unnecessary `map` usage (rewrite using a generator expression) + --> C417.py:2:17 | 1 | # Errors. 2 | nums = [1, 2, 3] @@ -21,8 +22,9 @@ error[C417]: C417.py:3:1: [*] Unnecessary `map` usage (rewrite using a generator 5 5 | list(map(lambda x: x * 2, nums)) 6 6 | set(map(lambda x: x % 2 == 0, nums)) -error[C417]: C417.py:4:1: [*] Unnecessary `map` usage (rewrite using a generator expression) +error[C417]: 4:1: [*] Unnecessary `map` usage (rewrite using a generator expression) + --> C417.py:3:27 | 2 | nums = [1, 2, 3] 3 | map(lambda x: x + 1, nums) @@ -42,8 +44,9 @@ error[C417]: C417.py:4:1: [*] Unnecessary `map` usage (rewrite using a generator 6 6 | set(map(lambda x: x % 2 == 0, nums)) 7 7 | dict(map(lambda v: (v, v**2), nums)) -error[C417]: C417.py:5:1: [*] Unnecessary `map` usage (rewrite using a `list` comprehension) +error[C417]: 5:1: [*] Unnecessary `map` usage (rewrite using a `list` comprehension) + --> C417.py:4:28 | 3 | map(lambda x: x + 1, nums) 4 | map(lambda x: str(x), nums) @@ -63,8 +66,9 @@ error[C417]: C417.py:5:1: [*] Unnecessary `map` usage (rewrite using a `list` co 7 7 | dict(map(lambda v: (v, v**2), nums)) 8 8 | dict(map(lambda v: [v, v**2], nums)) -error[C417]: C417.py:6:1: [*] Unnecessary `map` usage (rewrite using a `set` comprehension) +error[C417]: 6:1: [*] Unnecessary `map` usage (rewrite using a `set` comprehension) + --> C417.py:5:33 | 4 | map(lambda x: str(x), nums) 5 | list(map(lambda x: x * 2, nums)) @@ -84,8 +88,9 @@ error[C417]: C417.py:6:1: [*] Unnecessary `map` usage (rewrite using a `set` com 8 8 | dict(map(lambda v: [v, v**2], nums)) 9 9 | map(lambda: "const", nums) -error[C417]: C417.py:7:1: [*] Unnecessary `map` usage (rewrite using a `dict` comprehension) +error[C417]: 7:1: [*] Unnecessary `map` usage (rewrite using a `dict` comprehension) + --> C417.py:6:37 | 5 | list(map(lambda x: x * 2, nums)) 6 | set(map(lambda x: x % 2 == 0, nums)) @@ -105,8 +110,9 @@ error[C417]: C417.py:7:1: [*] Unnecessary `map` usage (rewrite using a `dict` co 9 9 | map(lambda: "const", nums) 10 10 | map(lambda _: 3.0, nums) -error[C417]: C417.py:8:1: [*] Unnecessary `map` usage (rewrite using a `dict` comprehension) +error[C417]: 8:1: [*] Unnecessary `map` usage (rewrite using a `dict` comprehension) + --> C417.py:7:37 | 6 | set(map(lambda x: x % 2 == 0, nums)) 7 | dict(map(lambda v: (v, v**2), nums)) @@ -126,8 +132,9 @@ error[C417]: C417.py:8:1: [*] Unnecessary `map` usage (rewrite using a `dict` co 10 10 | map(lambda _: 3.0, nums) 11 11 | _ = "".join(map(lambda x: x in nums and "1" or "0", range(123))) -error[C417]: C417.py:9:1: [*] Unnecessary `map` usage (rewrite using a generator expression) +error[C417]: 9:1: [*] Unnecessary `map` usage (rewrite using a generator expression) + --> C417.py:8:37 | 7 | dict(map(lambda v: (v, v**2), nums)) 8 | dict(map(lambda v: [v, v**2], nums)) @@ -147,8 +154,9 @@ error[C417]: C417.py:9:1: [*] Unnecessary `map` usage (rewrite using a generator 11 11 | _ = "".join(map(lambda x: x in nums and "1" or "0", range(123))) 12 12 | all(map(lambda v: isinstance(v, dict), nums)) -error[C417]: C417.py:10:1: [*] Unnecessary `map` usage (rewrite using a generator expression) +error[C417]: 10:1: [*] Unnecessary `map` usage (rewrite using a generator expression) + --> C417.py:9:27 | 8 | dict(map(lambda v: [v, v**2], nums)) 9 | map(lambda: "const", nums) @@ -168,8 +176,9 @@ error[C417]: C417.py:10:1: [*] Unnecessary `map` usage (rewrite using a generato 12 12 | all(map(lambda v: isinstance(v, dict), nums)) 13 13 | filter(func, map(lambda v: v, nums)) -error[C417]: C417.py:11:13: [*] Unnecessary `map` usage (rewrite using a generator expression) +error[C417]: 11:13: [*] Unnecessary `map` usage (rewrite using a generator expression) + --> C417.py:11:13 | 9 | map(lambda: "const", nums) 10 | map(lambda _: 3.0, nums) @@ -189,8 +198,9 @@ error[C417]: C417.py:11:13: [*] Unnecessary `map` usage (rewrite using a generat 13 13 | filter(func, map(lambda v: v, nums)) 14 14 | list(map(lambda x, y: x * y, nums)) -error[C417]: C417.py:12:5: [*] Unnecessary `map` usage (rewrite using a generator expression) +error[C417]: 12:5: [*] Unnecessary `map` usage (rewrite using a generator expression) + --> C417.py:12:5 | 10 | map(lambda _: 3.0, nums) 11 | _ = "".join(map(lambda x: x in nums and "1" or "0", range(123))) @@ -210,8 +220,9 @@ error[C417]: C417.py:12:5: [*] Unnecessary `map` usage (rewrite using a generato 14 14 | list(map(lambda x, y: x * y, nums)) 15 15 | -error[C417]: C417.py:13:14: [*] Unnecessary `map` usage (rewrite using a generator expression) +error[C417]: 13:14: [*] Unnecessary `map` usage (rewrite using a generator expression) + --> C417.py:13:14 | 11 | _ = "".join(map(lambda x: x in nums and "1" or "0", range(123))) 12 | all(map(lambda v: isinstance(v, dict), nums)) @@ -230,8 +241,9 @@ error[C417]: C417.py:13:14: [*] Unnecessary `map` usage (rewrite using a generat 15 15 | 16 16 | # When inside f-string, then the fix should be surrounded by whitespace -error[C417]: C417.py:14:1: [*] Unnecessary `map` usage (rewrite using a `list` comprehension) +error[C417]: 14:1: [*] Unnecessary `map` usage (rewrite using a `list` comprehension) + --> C417.py:13:37 | 12 | all(map(lambda v: isinstance(v, dict), nums)) 13 | filter(func, map(lambda v: v, nums)) @@ -251,8 +263,9 @@ error[C417]: C417.py:14:1: [*] Unnecessary `map` usage (rewrite using a `list` c 16 16 | # When inside f-string, then the fix should be surrounded by whitespace 17 17 | _ = f"{set(map(lambda x: x % 2 == 0, nums))}" -error[C417]: C417.py:17:8: [*] Unnecessary `map` usage (rewrite using a `set` comprehension) +error[C417]: 17:8: [*] Unnecessary `map` usage (rewrite using a `set` comprehension) + --> C417.py:17:8 | 16 | # When inside f-string, then the fix should be surrounded by whitespace 17 | _ = f"{set(map(lambda x: x % 2 == 0, nums))}" @@ -270,8 +283,9 @@ error[C417]: C417.py:17:8: [*] Unnecessary `map` usage (rewrite using a `set` co 19 19 | 20 20 | # False negatives. -error[C417]: C417.py:18:8: [*] Unnecessary `map` usage (rewrite using a `dict` comprehension) +error[C417]: 18:8: [*] Unnecessary `map` usage (rewrite using a `dict` comprehension) + --> C417.py:18:8 | 16 | # When inside f-string, then the fix should be surrounded by whitespace 17 | _ = f"{set(map(lambda x: x % 2 == 0, nums))}" @@ -291,8 +305,9 @@ error[C417]: C417.py:18:8: [*] Unnecessary `map` usage (rewrite using a `dict` c 20 20 | # False negatives. 21 21 | map(lambda x=2, y=1: x + y, nums, nums) -error[C417]: C417.py:36:1: [*] Unnecessary `map` usage (rewrite using a generator expression) +error[C417]: 36:1: [*] Unnecessary `map` usage (rewrite using a generator expression) + --> C417.py:35:52 | 35 | # Error: the `x` is overridden by the inner lambda. 36 | map(lambda x: lambda x: x, range(4)) @@ -311,8 +326,9 @@ error[C417]: C417.py:36:1: [*] Unnecessary `map` usage (rewrite using a generato 38 38 | # Ok because of the default parameters, and variadic arguments. 39 39 | map(lambda x=1: x, nums) -error[C417]: C417.py:47:1: [*] Unnecessary `map` usage (rewrite using a generator expression) +error[C417]: 47:1: [*] Unnecessary `map` usage (rewrite using a generator expression) + --> C417.py:46:69 | 46 | # Regression test for: https://github.com/astral-sh/ruff/issues/7121 47 | map(lambda x: x, y if y else z) @@ -330,8 +346,9 @@ error[C417]: C417.py:47:1: [*] Unnecessary `map` usage (rewrite using a generato 48 48 | map(lambda x: x, (y if y else z)) 49 49 | map(lambda x: x, (x, y, z)) -error[C417]: C417.py:48:1: [*] Unnecessary `map` usage (rewrite using a generator expression) +error[C417]: 48:1: [*] Unnecessary `map` usage (rewrite using a generator expression) + --> C417.py:47:32 | 46 | # Regression test for: https://github.com/astral-sh/ruff/issues/7121 47 | map(lambda x: x, y if y else z) @@ -348,8 +365,9 @@ error[C417]: C417.py:48:1: [*] Unnecessary `map` usage (rewrite using a generato 48 |+(x for x in (y if y else z)) 49 49 | map(lambda x: x, (x, y, z)) -error[C417]: C417.py:49:1: [*] Unnecessary `map` usage (rewrite using a generator expression) +error[C417]: 49:1: [*] Unnecessary `map` usage (rewrite using a generator expression) + --> C417.py:48:34 | 47 | map(lambda x: x, y if y else z) 48 | map(lambda x: x, (y if y else z)) diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C418_C418.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C418_C418.py.snap index 39c0786ab9..df19bac75c 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C418_C418.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C418_C418.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs --- -error[C418]: C418.py:1:1: [*] Unnecessary `dict` literal passed to `dict()` (remove the outer call to `dict()`) +error[C418]: 1:1: [*] Unnecessary `dict` literal passed to `dict()` (remove the outer call to `dict()`) + --> C418.py:1:1 | 1 | dict({}) | ^^^^^^^^ @@ -17,8 +18,9 @@ error[C418]: C418.py:1:1: [*] Unnecessary `dict` literal passed to `dict()` (rem 3 3 | dict({'x': 1 for x in range(10)}) 4 4 | dict( -error[C418]: C418.py:2:1: [*] Unnecessary `dict` literal passed to `dict()` (remove the outer call to `dict()`) +error[C418]: 2:1: [*] Unnecessary `dict` literal passed to `dict()` (remove the outer call to `dict()`) + --> C418.py:1:9 | 1 | dict({}) 2 | dict({'a': 1}) @@ -35,8 +37,9 @@ error[C418]: C418.py:2:1: [*] Unnecessary `dict` literal passed to `dict()` (rem 4 4 | dict( 5 5 | {'x': 1 for x in range(10)} -error[C418]: C418.py:3:1: [*] Unnecessary `dict` comprehension passed to `dict()` (remove the outer call to `dict()`) +error[C418]: 3:1: [*] Unnecessary `dict` comprehension passed to `dict()` (remove the outer call to `dict()`) + --> C418.py:2:15 | 1 | dict({}) 2 | dict({'a': 1}) @@ -55,8 +58,9 @@ error[C418]: C418.py:3:1: [*] Unnecessary `dict` comprehension passed to `dict() 5 5 | {'x': 1 for x in range(10)} 6 6 | ) -error[C418]: C418.py:4:1: [*] Unnecessary `dict` comprehension passed to `dict()` (remove the outer call to `dict()`) +error[C418]: 4:1: [*] Unnecessary `dict` comprehension passed to `dict()` (remove the outer call to `dict()`) + --> C418.py:3:34 | 2 | dict({'a': 1}) 3 | dict({'x': 1 for x in range(10)}) diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C419_C419.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C419_C419.py.snap index d1b04aebaa..79c743bba9 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C419_C419.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C419_C419.py.snap @@ -1,15 +1,16 @@ --- source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs --- -C419.py:1:5: C419 [*] Unnecessary list comprehension +error[C419]: 1:5: [*] Unnecessary list comprehension + + --> C419.py:1:5 | 1 | any([x.id for x in bar]) - | ^^^^^^^^^^^^^^^^^^^ C419 + | ^^^^^^^^^^^^^^^^^^^ 2 | all([x.id for x in bar]) 3 | any( # first comment | = help: Remove unnecessary comprehension - ℹ Unsafe fix 1 |-any([x.id for x in bar]) 1 |+any(x.id for x in bar) @@ -17,16 +18,17 @@ C419.py:1:5: C419 [*] Unnecessary list comprehension 3 3 | any( # first comment 4 4 | [x.id for x in bar], # second comment -C419.py:2:5: C419 [*] Unnecessary list comprehension +error[C419]: 2:5: [*] Unnecessary list comprehension + + --> C419.py:2:5 | 1 | any([x.id for x in bar]) 2 | all([x.id for x in bar]) - | ^^^^^^^^^^^^^^^^^^^ C419 + | ^^^^^^^^^^^^^^^^^^^ 3 | any( # first comment 4 | [x.id for x in bar], # second comment | = help: Remove unnecessary comprehension - ℹ Unsafe fix 1 1 | any([x.id for x in bar]) 2 |-all([x.id for x in bar]) @@ -35,17 +37,18 @@ C419.py:2:5: C419 [*] Unnecessary list comprehension 4 4 | [x.id for x in bar], # second comment 5 5 | ) # third comment -C419.py:4:5: C419 [*] Unnecessary list comprehension +error[C419]: 4:5: [*] Unnecessary list comprehension + + --> C419.py:4:5 | 2 | all([x.id for x in bar]) 3 | any( # first comment 4 | [x.id for x in bar], # second comment - | ^^^^^^^^^^^^^^^^^^^ C419 + | ^^^^^^^^^^^^^^^^^^^ 5 | ) # third comment 6 | all( # first comment | = help: Remove unnecessary comprehension - ℹ Unsafe fix 1 1 | any([x.id for x in bar]) 2 2 | all([x.id for x in bar]) @@ -56,17 +59,18 @@ C419.py:4:5: C419 [*] Unnecessary list comprehension 6 6 | all( # first comment 7 7 | [x.id for x in bar], # second comment -C419.py:7:5: C419 [*] Unnecessary list comprehension +error[C419]: 7:5: [*] Unnecessary list comprehension + + --> C419.py:7:5 | 5 | ) # third comment 6 | all( # first comment 7 | [x.id for x in bar], # second comment - | ^^^^^^^^^^^^^^^^^^^ C419 + | ^^^^^^^^^^^^^^^^^^^ 8 | ) # third comment 9 | any({x.id for x in bar}) | = help: Remove unnecessary comprehension - ℹ Unsafe fix 4 4 | [x.id for x in bar], # second comment 5 5 | ) # third comment @@ -77,17 +81,18 @@ C419.py:7:5: C419 [*] Unnecessary list comprehension 9 9 | any({x.id for x in bar}) 10 10 | -C419.py:9:5: C419 [*] Unnecessary set comprehension +error[C419]: 9:5: [*] Unnecessary set comprehension + + --> C419.py:9:5 | 7 | [x.id for x in bar], # second comment 8 | ) # third comment 9 | any({x.id for x in bar}) - | ^^^^^^^^^^^^^^^^^^^ C419 + | ^^^^^^^^^^^^^^^^^^^ 10 | 11 | # OK | = help: Remove unnecessary comprehension - ℹ Unsafe fix 6 6 | all( # first comment 7 7 | [x.id for x in bar], # second comment @@ -98,7 +103,9 @@ C419.py:9:5: C419 [*] Unnecessary set comprehension 11 11 | # OK 12 12 | all(x.id for x in bar) -C419.py:28:5: C419 [*] Unnecessary list comprehension +error[C419]: 28:5: [*] Unnecessary list comprehension + + --> C419.py:28:5 | 26 | # Special comment handling 27 | any( @@ -109,12 +116,11 @@ C419.py:28:5: C419 [*] Unnecessary list comprehension 31 | | # random middle comment 32 | | for i in range(5) # rbracket comment 33 | | ] # rpar comment - | |_____^ C419 + | |_____^ 34 | # trailing comment 35 | ) | = help: Remove unnecessary comprehension - ℹ Unsafe fix 25 25 | 26 26 | # Special comment handling @@ -133,7 +139,9 @@ C419.py:28:5: C419 [*] Unnecessary list comprehension 35 34 | ) 36 35 | -C419.py:39:5: C419 [*] Unnecessary list comprehension +error[C419]: 39:5: [*] Unnecessary list comprehension + + --> C419.py:39:5 | 37 | # Weird case where the function call, opening bracket, and comment are all 38 | # on the same line. @@ -142,11 +150,10 @@ C419.py:39:5: C419 [*] Unnecessary list comprehension 40 | | # second line comment 41 | | i.bit_count() for i in range(5) # rbracket comment 42 | | ] # rpar comment - | |_____^ C419 + | |_____^ 43 | ) | = help: Remove unnecessary comprehension - ℹ Unsafe fix 36 36 | 37 37 | # Weird case where the function call, opening bracket, and comment are all @@ -163,15 +170,16 @@ C419.py:39:5: C419 [*] Unnecessary list comprehension 44 44 | 45 45 | ## Set comprehensions should only be linted -C419.py:49:5: C419 [*] Unnecessary set comprehension +error[C419]: 49:5: [*] Unnecessary set comprehension + + --> C419.py:49:5 | 48 | # should be linted... 49 | any({x.id for x in bar}) - | ^^^^^^^^^^^^^^^^^^^ C419 + | ^^^^^^^^^^^^^^^^^^^ 50 | all({x.id for x in bar}) | = help: Remove unnecessary comprehension - ℹ Unsafe fix 46 46 | ## when function is invariant under duplication of inputs 47 47 | @@ -182,17 +190,18 @@ C419.py:49:5: C419 [*] Unnecessary set comprehension 51 51 | 52 52 | # should be linted in preview... -C419.py:50:5: C419 [*] Unnecessary set comprehension +error[C419]: 50:5: [*] Unnecessary set comprehension + + --> C419.py:50:5 | 48 | # should be linted... 49 | any({x.id for x in bar}) 50 | all({x.id for x in bar}) - | ^^^^^^^^^^^^^^^^^^^ C419 + | ^^^^^^^^^^^^^^^^^^^ 51 | 52 | # should be linted in preview... | = help: Remove unnecessary comprehension - ℹ Unsafe fix 47 47 | 48 48 | # should be linted... diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C420_C420.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C420_C420.py.snap index c1b1ee2942..29596afb8c 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C420_C420.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C420_C420.py.snap @@ -1,15 +1,16 @@ --- source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs --- -C420.py:6:5: C420 [*] Unnecessary dict comprehension for iterable; use `dict.fromkeys` instead +error[C420]: 6:5: [*] Unnecessary dict comprehension for iterable; use `dict.fromkeys` instead + + --> C420.py:6:5 | 4 | def func(): 5 | numbers = [1, 2, 3] 6 | {n: None for n in numbers} # RUF025 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ C420 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: Replace with `dict.fromkeys(iterable, value)`) - ℹ Safe fix 3 3 | 4 4 | def func(): @@ -20,15 +21,16 @@ C420.py:6:5: C420 [*] Unnecessary dict comprehension for iterable; use `dict.fro 8 8 | 9 9 | def func(): -C420.py:10:23: C420 [*] Unnecessary dict comprehension for iterable; use `dict.fromkeys` instead +error[C420]: 10:23: [*] Unnecessary dict comprehension for iterable; use `dict.fromkeys` instead + + --> C420.py:10:23 | 9 | def func(): 10 | for key, value in {n: 1 for n in [1, 2, 3]}.items(): # RUF025 - | ^^^^^^^^^^^^^^^^^^^^^^^^^ C420 + | ^^^^^^^^^^^^^^^^^^^^^^^^^ 11 | pass | = help: Replace with `dict.fromkeys(iterable)`) - ℹ Safe fix 7 7 | 8 8 | @@ -39,14 +41,15 @@ C420.py:10:23: C420 [*] Unnecessary dict comprehension for iterable; use `dict.f 12 12 | 13 13 | -C420.py:15:5: C420 [*] Unnecessary dict comprehension for iterable; use `dict.fromkeys` instead +error[C420]: 15:5: [*] Unnecessary dict comprehension for iterable; use `dict.fromkeys` instead + + --> C420.py:15:5 | 14 | def func(): 15 | {n: 1.1 for n in [1, 2, 3]} # RUF025 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ C420 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: Replace with `dict.fromkeys(iterable)`) - ℹ Safe fix 12 12 | 13 13 | @@ -57,15 +60,16 @@ C420.py:15:5: C420 [*] Unnecessary dict comprehension for iterable; use `dict.fr 17 17 | 18 18 | def func(): -C420.py:26:7: C420 [*] Unnecessary dict comprehension for iterable; use `dict.fromkeys` instead +error[C420]: 26:7: [*] Unnecessary dict comprehension for iterable; use `dict.fromkeys` instead + + --> C420.py:26:7 | 24 | return data 25 | 26 | f({c: "a" for c in "12345"}) # RUF025 - | ^^^^^^^^^^^^^^^^^^^^^^^^^ C420 + | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: Replace with `dict.fromkeys(iterable)`) - ℹ Safe fix 23 23 | def f(data): 24 24 | return data @@ -76,14 +80,15 @@ C420.py:26:7: C420 [*] Unnecessary dict comprehension for iterable; use `dict.fr 28 28 | 29 29 | def func(): -C420.py:30:5: C420 [*] Unnecessary dict comprehension for iterable; use `dict.fromkeys` instead +error[C420]: 30:5: [*] Unnecessary dict comprehension for iterable; use `dict.fromkeys` instead + + --> C420.py:30:5 | 29 | def func(): 30 | {n: True for n in [1, 2, 2]} # RUF025 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C420 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: Replace with `dict.fromkeys(iterable)`) - ℹ Safe fix 27 27 | 28 28 | @@ -94,14 +99,15 @@ C420.py:30:5: C420 [*] Unnecessary dict comprehension for iterable; use `dict.fr 32 32 | 33 33 | def func(): -C420.py:34:5: C420 [*] Unnecessary dict comprehension for iterable; use `dict.fromkeys` instead +error[C420]: 34:5: [*] Unnecessary dict comprehension for iterable; use `dict.fromkeys` instead + + --> C420.py:34:5 | 33 | def func(): 34 | {n: b"hello" for n in (1, 2, 2)} # RUF025 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C420 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: Replace with `dict.fromkeys(iterable)`) - ℹ Safe fix 31 31 | 32 32 | @@ -112,14 +118,15 @@ C420.py:34:5: C420 [*] Unnecessary dict comprehension for iterable; use `dict.fr 36 36 | 37 37 | def func(): -C420.py:38:5: C420 [*] Unnecessary dict comprehension for iterable; use `dict.fromkeys` instead +error[C420]: 38:5: [*] Unnecessary dict comprehension for iterable; use `dict.fromkeys` instead + + --> C420.py:38:5 | 37 | def func(): 38 | {n: ... for n in [1, 2, 3]} # RUF025 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ C420 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: Replace with `dict.fromkeys(iterable)`) - ℹ Safe fix 35 35 | 36 36 | @@ -130,14 +137,15 @@ C420.py:38:5: C420 [*] Unnecessary dict comprehension for iterable; use `dict.fr 40 40 | 41 41 | def func(): -C420.py:42:5: C420 [*] Unnecessary dict comprehension for iterable; use `dict.fromkeys` instead +error[C420]: 42:5: [*] Unnecessary dict comprehension for iterable; use `dict.fromkeys` instead + + --> C420.py:42:5 | 41 | def func(): 42 | {n: False for n in {1: "a", 2: "b"}} # RUF025 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C420 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: Replace with `dict.fromkeys(iterable)`) - ℹ Safe fix 39 39 | 40 40 | @@ -148,14 +156,15 @@ C420.py:42:5: C420 [*] Unnecessary dict comprehension for iterable; use `dict.fr 44 44 | 45 45 | def func(): -C420.py:46:5: C420 [*] Unnecessary dict comprehension for iterable; use `dict.fromkeys` instead +error[C420]: 46:5: [*] Unnecessary dict comprehension for iterable; use `dict.fromkeys` instead + + --> C420.py:46:5 | 45 | def func(): 46 | {(a, b): 1 for (a, b) in [(1, 2), (3, 4)]} # RUF025 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C420 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: Replace with `dict.fromkeys(iterable)`) - ℹ Safe fix 43 43 | 44 44 | @@ -166,14 +175,15 @@ C420.py:46:5: C420 [*] Unnecessary dict comprehension for iterable; use `dict.fr 48 48 | 49 49 | def func(): -C420.py:54:5: C420 [*] Unnecessary dict comprehension for iterable; use `dict.fromkeys` instead +error[C420]: 54:5: [*] Unnecessary dict comprehension for iterable; use `dict.fromkeys` instead + + --> C420.py:54:5 | 53 | a = f() 54 | {n: a for n in [1, 2, 3]} # RUF025 - | ^^^^^^^^^^^^^^^^^^^^^^^^^ C420 + | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: Replace with `dict.fromkeys(iterable)`) - ℹ Safe fix 51 51 | return 1 52 52 | @@ -184,15 +194,16 @@ C420.py:54:5: C420 [*] Unnecessary dict comprehension for iterable; use `dict.fr 56 56 | 57 57 | def func(): -C420.py:59:6: C420 [*] Unnecessary dict comprehension for iterable; use `dict.fromkeys` instead +error[C420]: 59:6: [*] Unnecessary dict comprehension for iterable; use `dict.fromkeys` instead + + --> C420.py:59:6 | 57 | def func(): 58 | values = ["a", "b", "c"] 59 | [{n: values for n in [1, 2, 3]}] # RUF025 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C420 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: Replace with `dict.fromkeys(iterable)`) - ℹ Safe fix 56 56 | 57 57 | def func(): diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__preview__C409_C409.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__preview__C409_C409.py.snap index 4d816904df..1d9f75b74d 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__preview__C409_C409.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__preview__C409_C409.py.snap @@ -1,15 +1,16 @@ --- source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs --- -C409.py:1:6: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite as a `tuple` literal) +error[C409]: 1:6: [*] Unnecessary `list` literal passed to `tuple()` (rewrite as a `tuple` literal) + + --> C409.py:1:6 | 1 | t1 = tuple([]) - | ^^^^^^^^^ C409 + | ^^^^^^^^^ 2 | t2 = tuple([1, 2]) 3 | t3 = tuple((1, 2)) | = help: Rewrite as a `tuple` literal - ℹ Unsafe fix 1 |-t1 = tuple([]) 1 |+t1 = () @@ -17,16 +18,17 @@ C409.py:1:6: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite as 3 3 | t3 = tuple((1, 2)) 4 4 | t4 = tuple([ -C409.py:2:6: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite as a `tuple` literal) +error[C409]: 2:6: [*] Unnecessary `list` literal passed to `tuple()` (rewrite as a `tuple` literal) + + --> C409.py:2:6 | 1 | t1 = tuple([]) 2 | t2 = tuple([1, 2]) - | ^^^^^^^^^^^^^ C409 + | ^^^^^^^^^^^^^ 3 | t3 = tuple((1, 2)) 4 | t4 = tuple([ | = help: Rewrite as a `tuple` literal - ℹ Unsafe fix 1 1 | t1 = tuple([]) 2 |-t2 = tuple([1, 2]) @@ -35,17 +37,18 @@ C409.py:2:6: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite as 4 4 | t4 = tuple([ 5 5 | 1, -C409.py:3:6: C409 [*] Unnecessary `tuple` literal passed to `tuple()` (remove the outer call to `tuple()`) +error[C409]: 3:6: [*] Unnecessary `tuple` literal passed to `tuple()` (remove the outer call to `tuple()`) + + --> C409.py:3:6 | 1 | t1 = tuple([]) 2 | t2 = tuple([1, 2]) 3 | t3 = tuple((1, 2)) - | ^^^^^^^^^^^^^ C409 + | ^^^^^^^^^^^^^ 4 | t4 = tuple([ 5 | 1, | = help: Remove the outer call to `tuple()` - ℹ Unsafe fix 1 1 | t1 = tuple([]) 2 2 | t2 = tuple([1, 2]) @@ -55,7 +58,9 @@ C409.py:3:6: C409 [*] Unnecessary `tuple` literal passed to `tuple()` (remove th 5 5 | 1, 6 6 | 2 -C409.py:4:6: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite as a `tuple` literal) +error[C409]: 4:6: [*] Unnecessary `list` literal passed to `tuple()` (rewrite as a `tuple` literal) + + --> C409.py:4:6 | 2 | t2 = tuple([1, 2]) 3 | t3 = tuple((1, 2)) @@ -64,12 +69,11 @@ C409.py:4:6: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite as 5 | | 1, 6 | | 2 7 | | ]) - | |__^ C409 + | |__^ 8 | t5 = tuple( 9 | (1, 2) | = help: Rewrite as a `tuple` literal - ℹ Unsafe fix 1 1 | t1 = tuple([]) 2 2 | t2 = tuple([1, 2]) @@ -84,7 +88,9 @@ C409.py:4:6: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite as 9 9 | (1, 2) 10 10 | ) -C409.py:8:6: C409 [*] Unnecessary `tuple` literal passed to `tuple()` (remove the outer call to `tuple()`) +error[C409]: 8:6: [*] Unnecessary `tuple` literal passed to `tuple()` (remove the outer call to `tuple()`) + + --> C409.py:8:6 | 6 | 2 7 | ]) @@ -92,12 +98,11 @@ C409.py:8:6: C409 [*] Unnecessary `tuple` literal passed to `tuple()` (remove th | ______^ 9 | | (1, 2) 10 | | ) - | |_^ C409 + | |_^ 11 | 12 | tuple( # comment | = help: Remove the outer call to `tuple()` - ℹ Unsafe fix 5 5 | 1, 6 6 | 2 @@ -110,19 +115,20 @@ C409.py:8:6: C409 [*] Unnecessary `tuple` literal passed to `tuple()` (remove th 12 10 | tuple( # comment 13 11 | [1, 2] -C409.py:12:1: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite as a `tuple` literal) +error[C409]: 12:1: [*] Unnecessary `list` literal passed to `tuple()` (rewrite as a `tuple` literal) + + --> C409.py:11:1 | 10 | ) 11 | 12 | / tuple( # comment 13 | | [1, 2] 14 | | ) - | |_^ C409 + | |_^ 15 | 16 | tuple([ # comment | = help: Rewrite as a `tuple` literal - ℹ Unsafe fix 9 9 | (1, 2) 10 10 | ) @@ -135,19 +141,20 @@ C409.py:12:1: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite a 16 14 | tuple([ # comment 17 15 | 1, 2 -C409.py:16:1: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite as a `tuple` literal) +error[C409]: 16:1: [*] Unnecessary `list` literal passed to `tuple()` (rewrite as a `tuple` literal) + + --> C409.py:15:1 | 14 | ) 15 | 16 | / tuple([ # comment 17 | | 1, 2 18 | | ]) - | |__^ C409 + | |__^ 19 | 20 | tuple(( | = help: Rewrite as a `tuple` literal - ℹ Unsafe fix 13 13 | [1, 2] 14 14 | ) @@ -161,19 +168,20 @@ C409.py:16:1: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite a 20 20 | tuple(( 21 21 | 1, -C409.py:20:1: C409 [*] Unnecessary `tuple` literal passed to `tuple()` (remove the outer call to `tuple()`) +error[C409]: 20:1: [*] Unnecessary `tuple` literal passed to `tuple()` (remove the outer call to `tuple()`) + + --> C409.py:19:1 | 18 | ]) 19 | 20 | / tuple(( 21 | | 1, 22 | | )) - | |__^ C409 + | |__^ 23 | 24 | t6 = tuple([1]) | = help: Remove the outer call to `tuple()` - ℹ Unsafe fix 17 17 | 1, 2 18 18 | ]) @@ -187,17 +195,18 @@ C409.py:20:1: C409 [*] Unnecessary `tuple` literal passed to `tuple()` (remove t 24 24 | t6 = tuple([1]) 25 25 | t7 = tuple((1,)) -C409.py:24:6: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite as a `tuple` literal) +error[C409]: 24:6: [*] Unnecessary `list` literal passed to `tuple()` (rewrite as a `tuple` literal) + + --> C409.py:24:6 | 22 | )) 23 | 24 | t6 = tuple([1]) - | ^^^^^^^^^^ C409 + | ^^^^^^^^^^ 25 | t7 = tuple((1,)) 26 | t8 = tuple([1,]) | = help: Rewrite as a `tuple` literal - ℹ Unsafe fix 21 21 | 1, 22 22 | )) @@ -208,15 +217,16 @@ C409.py:24:6: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite a 26 26 | t8 = tuple([1,]) 27 27 | -C409.py:25:6: C409 [*] Unnecessary `tuple` literal passed to `tuple()` (remove the outer call to `tuple()`) +error[C409]: 25:6: [*] Unnecessary `tuple` literal passed to `tuple()` (remove the outer call to `tuple()`) + + --> C409.py:25:6 | 24 | t6 = tuple([1]) 25 | t7 = tuple((1,)) - | ^^^^^^^^^^^ C409 + | ^^^^^^^^^^^ 26 | t8 = tuple([1,]) | = help: Remove the outer call to `tuple()` - ℹ Unsafe fix 22 22 | )) 23 23 | @@ -227,17 +237,18 @@ C409.py:25:6: C409 [*] Unnecessary `tuple` literal passed to `tuple()` (remove t 27 27 | 28 28 | tuple([x for x in range(5)]) -C409.py:26:6: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite as a `tuple` literal) +error[C409]: 26:6: [*] Unnecessary `list` literal passed to `tuple()` (rewrite as a `tuple` literal) + + --> C409.py:26:6 | 24 | t6 = tuple([1]) 25 | t7 = tuple((1,)) 26 | t8 = tuple([1,]) - | ^^^^^^^^^^^ C409 + | ^^^^^^^^^^^ 27 | 28 | tuple([x for x in range(5)]) | = help: Rewrite as a `tuple` literal - ℹ Unsafe fix 23 23 | 24 24 | t6 = tuple([1]) @@ -248,17 +259,18 @@ C409.py:26:6: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite a 28 28 | tuple([x for x in range(5)]) 29 29 | tuple({x for x in range(10)}) -C409.py:28:1: C409 [*] Unnecessary list comprehension passed to `tuple()` (rewrite as a generator) +error[C409]: 28:1: [*] Unnecessary list comprehension passed to `tuple()` (rewrite as a generator) + + --> C409.py:27:1 | 26 | t8 = tuple([1,]) 27 | 28 | tuple([x for x in range(5)]) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C409 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 29 | tuple({x for x in range(10)}) 30 | tuple(x for x in range(5)) | = help: Rewrite as a generator - ℹ Unsafe fix 25 25 | t7 = tuple((1,)) 26 26 | t8 = tuple([1,]) @@ -269,19 +281,20 @@ C409.py:28:1: C409 [*] Unnecessary list comprehension passed to `tuple()` (rewri 30 30 | tuple(x for x in range(5)) 31 31 | tuple([ -C409.py:31:1: C409 [*] Unnecessary list comprehension passed to `tuple()` (rewrite as a generator) +error[C409]: 31:1: [*] Unnecessary list comprehension passed to `tuple()` (rewrite as a generator) + + --> C409.py:30:27 | 29 | tuple({x for x in range(10)}) 30 | tuple(x for x in range(5)) 31 | / tuple([ 32 | | x for x in [1,2,3] 33 | | ]) - | |__^ C409 + | |__^ 34 | tuple( # comment 35 | [x for x in [1,2,3]] | = help: Rewrite as a generator - ℹ Unsafe fix 28 28 | tuple([x for x in range(5)]) 29 29 | tuple({x for x in range(10)}) @@ -294,19 +307,20 @@ C409.py:31:1: C409 [*] Unnecessary list comprehension passed to `tuple()` (rewri 35 33 | [x for x in [1,2,3]] 36 34 | ) -C409.py:34:1: C409 [*] Unnecessary list comprehension passed to `tuple()` (rewrite as a generator) +error[C409]: 34:1: [*] Unnecessary list comprehension passed to `tuple()` (rewrite as a generator) + + --> C409.py:33:3 | 32 | x for x in [1,2,3] 33 | ]) 34 | / tuple( # comment 35 | | [x for x in [1,2,3]] 36 | | ) - | |_^ C409 + | |_^ 37 | tuple([ # comment 38 | x for x in range(10) | = help: Rewrite as a generator - ℹ Unsafe fix 32 32 | x for x in [1,2,3] 33 33 | ]) @@ -317,19 +331,20 @@ C409.py:34:1: C409 [*] Unnecessary list comprehension passed to `tuple()` (rewri 37 37 | tuple([ # comment 38 38 | x for x in range(10) -C409.py:37:1: C409 [*] Unnecessary list comprehension passed to `tuple()` (rewrite as a generator) +error[C409]: 37:1: [*] Unnecessary list comprehension passed to `tuple()` (rewrite as a generator) + + --> C409.py:36:2 | 35 | [x for x in [1,2,3]] 36 | ) 37 | / tuple([ # comment 38 | | x for x in range(10) 39 | | ]) - | |__^ C409 + | |__^ 40 | tuple( 41 | { | = help: Rewrite as a generator - ℹ Unsafe fix 34 34 | tuple( # comment 35 35 | [x for x in [1,2,3]] diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__preview__C419_C419_1.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__preview__C419_C419_1.py.snap index 9bc26685fb..0197dc9609 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__preview__C419_C419_1.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__preview__C419_C419_1.py.snap @@ -1,15 +1,16 @@ --- source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs --- -C419_1.py:1:5: C419 [*] Unnecessary list comprehension +error[C419]: 1:5: [*] Unnecessary list comprehension + + --> C419_1.py:1:5 | 1 | sum([x.val for x in bar]) - | ^^^^^^^^^^^^^^^^^^^^ C419 + | ^^^^^^^^^^^^^^^^^^^^ 2 | min([x.val for x in bar]) 3 | max([x.val for x in bar]) | = help: Remove unnecessary comprehension - ℹ Unsafe fix 1 |-sum([x.val for x in bar]) 1 |+sum(x.val for x in bar) @@ -17,16 +18,17 @@ C419_1.py:1:5: C419 [*] Unnecessary list comprehension 3 3 | max([x.val for x in bar]) 4 4 | sum([x.val for x in bar], 0) -C419_1.py:2:5: C419 [*] Unnecessary list comprehension +error[C419]: 2:5: [*] Unnecessary list comprehension + + --> C419_1.py:2:5 | 1 | sum([x.val for x in bar]) 2 | min([x.val for x in bar]) - | ^^^^^^^^^^^^^^^^^^^^ C419 + | ^^^^^^^^^^^^^^^^^^^^ 3 | max([x.val for x in bar]) 4 | sum([x.val for x in bar], 0) | = help: Remove unnecessary comprehension - ℹ Unsafe fix 1 1 | sum([x.val for x in bar]) 2 |-min([x.val for x in bar]) @@ -35,16 +37,17 @@ C419_1.py:2:5: C419 [*] Unnecessary list comprehension 4 4 | sum([x.val for x in bar], 0) 5 5 | -C419_1.py:3:5: C419 [*] Unnecessary list comprehension +error[C419]: 3:5: [*] Unnecessary list comprehension + + --> C419_1.py:3:5 | 1 | sum([x.val for x in bar]) 2 | min([x.val for x in bar]) 3 | max([x.val for x in bar]) - | ^^^^^^^^^^^^^^^^^^^^ C419 + | ^^^^^^^^^^^^^^^^^^^^ 4 | sum([x.val for x in bar], 0) | = help: Remove unnecessary comprehension - ℹ Unsafe fix 1 1 | sum([x.val for x in bar]) 2 2 | min([x.val for x in bar]) @@ -54,17 +57,18 @@ C419_1.py:3:5: C419 [*] Unnecessary list comprehension 5 5 | 6 6 | # OK -C419_1.py:4:5: C419 [*] Unnecessary list comprehension +error[C419]: 4:5: [*] Unnecessary list comprehension + + --> C419_1.py:4:5 | 2 | min([x.val for x in bar]) 3 | max([x.val for x in bar]) 4 | sum([x.val for x in bar], 0) - | ^^^^^^^^^^^^^^^^^^^^ C419 + | ^^^^^^^^^^^^^^^^^^^^ 5 | 6 | # OK | = help: Remove unnecessary comprehension - ℹ Unsafe fix 1 1 | sum([x.val for x in bar]) 2 2 | min([x.val for x in bar]) @@ -75,7 +79,9 @@ C419_1.py:4:5: C419 [*] Unnecessary list comprehension 6 6 | # OK 7 7 | sum(x.val for x in bar) -C419_1.py:14:5: C419 [*] Unnecessary list comprehension +error[C419]: 14:5: [*] Unnecessary list comprehension + + --> C419_1.py:14:5 | 12 | # Multi-line 13 | sum( @@ -85,12 +91,11 @@ C419_1.py:14:5: C419 [*] Unnecessary list comprehension 16 | | for delta in timedelta_list 17 | | if delta 18 | | ], - | |_____^ C419 + | |_____^ 19 | dt.timedelta(), 20 | ) | = help: Remove unnecessary comprehension - ℹ Unsafe fix 11 11 | 12 12 | # Multi-line diff --git a/crates/ruff_linter/src/rules/flake8_copyright/snapshots/ruff_linter__rules__flake8_copyright__tests__char_boundary.snap b/crates/ruff_linter/src/rules/flake8_copyright/snapshots/ruff_linter__rules__flake8_copyright__tests__char_boundary.snap index 6bac4b05dc..f997c3a35c 100644 --- a/crates/ruff_linter/src/rules/flake8_copyright/snapshots/ruff_linter__rules__flake8_copyright__tests__char_boundary.snap +++ b/crates/ruff_linter/src/rules/flake8_copyright/snapshots/ruff_linter__rules__flake8_copyright__tests__char_boundary.snap @@ -1,4 +1,4 @@ --- source: crates/ruff_linter/src/rules/flake8_copyright/mod.rs --- -:1:1: CPY001 Missing copyright notice at top of file +error[CPY001]: 1:1: Missing copyright notice at top of file diff --git a/crates/ruff_linter/src/rules/flake8_copyright/snapshots/ruff_linter__rules__flake8_copyright__tests__invalid_author.snap b/crates/ruff_linter/src/rules/flake8_copyright/snapshots/ruff_linter__rules__flake8_copyright__tests__invalid_author.snap index 6bac4b05dc..f997c3a35c 100644 --- a/crates/ruff_linter/src/rules/flake8_copyright/snapshots/ruff_linter__rules__flake8_copyright__tests__invalid_author.snap +++ b/crates/ruff_linter/src/rules/flake8_copyright/snapshots/ruff_linter__rules__flake8_copyright__tests__invalid_author.snap @@ -1,4 +1,4 @@ --- source: crates/ruff_linter/src/rules/flake8_copyright/mod.rs --- -:1:1: CPY001 Missing copyright notice at top of file +error[CPY001]: 1:1: Missing copyright notice at top of file diff --git a/crates/ruff_linter/src/rules/flake8_copyright/snapshots/ruff_linter__rules__flake8_copyright__tests__late_notice.snap b/crates/ruff_linter/src/rules/flake8_copyright/snapshots/ruff_linter__rules__flake8_copyright__tests__late_notice.snap index 6bac4b05dc..f997c3a35c 100644 --- a/crates/ruff_linter/src/rules/flake8_copyright/snapshots/ruff_linter__rules__flake8_copyright__tests__late_notice.snap +++ b/crates/ruff_linter/src/rules/flake8_copyright/snapshots/ruff_linter__rules__flake8_copyright__tests__late_notice.snap @@ -1,4 +1,4 @@ --- source: crates/ruff_linter/src/rules/flake8_copyright/mod.rs --- -:1:1: CPY001 Missing copyright notice at top of file +error[CPY001]: 1:1: Missing copyright notice at top of file diff --git a/crates/ruff_linter/src/rules/flake8_copyright/snapshots/ruff_linter__rules__flake8_copyright__tests__valid_author_with_comma_invalid_no_space.snap b/crates/ruff_linter/src/rules/flake8_copyright/snapshots/ruff_linter__rules__flake8_copyright__tests__valid_author_with_comma_invalid_no_space.snap index 6bac4b05dc..f997c3a35c 100644 --- a/crates/ruff_linter/src/rules/flake8_copyright/snapshots/ruff_linter__rules__flake8_copyright__tests__valid_author_with_comma_invalid_no_space.snap +++ b/crates/ruff_linter/src/rules/flake8_copyright/snapshots/ruff_linter__rules__flake8_copyright__tests__valid_author_with_comma_invalid_no_space.snap @@ -1,4 +1,4 @@ --- source: crates/ruff_linter/src/rules/flake8_copyright/mod.rs --- -:1:1: CPY001 Missing copyright notice at top of file +error[CPY001]: 1:1: Missing copyright notice at top of file diff --git a/crates/ruff_linter/src/rules/flake8_copyright/snapshots/ruff_linter__rules__flake8_copyright__tests__valid_author_with_comma_invalid_spaces.snap b/crates/ruff_linter/src/rules/flake8_copyright/snapshots/ruff_linter__rules__flake8_copyright__tests__valid_author_with_comma_invalid_spaces.snap index 6bac4b05dc..f997c3a35c 100644 --- a/crates/ruff_linter/src/rules/flake8_copyright/snapshots/ruff_linter__rules__flake8_copyright__tests__valid_author_with_comma_invalid_spaces.snap +++ b/crates/ruff_linter/src/rules/flake8_copyright/snapshots/ruff_linter__rules__flake8_copyright__tests__valid_author_with_comma_invalid_spaces.snap @@ -1,4 +1,4 @@ --- source: crates/ruff_linter/src/rules/flake8_copyright/mod.rs --- -:1:1: CPY001 Missing copyright notice at top of file +error[CPY001]: 1:1: Missing copyright notice at top of file diff --git a/crates/ruff_linter/src/rules/flake8_copyright/snapshots/ruff_linter__rules__flake8_copyright__tests__valid_author_with_dash_invalid_space.snap b/crates/ruff_linter/src/rules/flake8_copyright/snapshots/ruff_linter__rules__flake8_copyright__tests__valid_author_with_dash_invalid_space.snap index 6bac4b05dc..f997c3a35c 100644 --- a/crates/ruff_linter/src/rules/flake8_copyright/snapshots/ruff_linter__rules__flake8_copyright__tests__valid_author_with_dash_invalid_space.snap +++ b/crates/ruff_linter/src/rules/flake8_copyright/snapshots/ruff_linter__rules__flake8_copyright__tests__valid_author_with_dash_invalid_space.snap @@ -1,4 +1,4 @@ --- source: crates/ruff_linter/src/rules/flake8_copyright/mod.rs --- -:1:1: CPY001 Missing copyright notice at top of file +error[CPY001]: 1:1: Missing copyright notice at top of file diff --git a/crates/ruff_linter/src/rules/flake8_copyright/snapshots/ruff_linter__rules__flake8_copyright__tests__valid_author_with_dash_invalid_spaces.snap b/crates/ruff_linter/src/rules/flake8_copyright/snapshots/ruff_linter__rules__flake8_copyright__tests__valid_author_with_dash_invalid_spaces.snap index 6bac4b05dc..f997c3a35c 100644 --- a/crates/ruff_linter/src/rules/flake8_copyright/snapshots/ruff_linter__rules__flake8_copyright__tests__valid_author_with_dash_invalid_spaces.snap +++ b/crates/ruff_linter/src/rules/flake8_copyright/snapshots/ruff_linter__rules__flake8_copyright__tests__valid_author_with_dash_invalid_spaces.snap @@ -1,4 +1,4 @@ --- source: crates/ruff_linter/src/rules/flake8_copyright/mod.rs --- -:1:1: CPY001 Missing copyright notice at top of file +error[CPY001]: 1:1: Missing copyright notice at top of file diff --git a/crates/ruff_linter/src/rules/flake8_datetimez/snapshots/ruff_linter__rules__flake8_datetimez__tests__DTZ001_DTZ001.py.snap b/crates/ruff_linter/src/rules/flake8_datetimez/snapshots/ruff_linter__rules__flake8_datetimez__tests__DTZ001_DTZ001.py.snap index dde715d3ab..e414b22799 100644 --- a/crates/ruff_linter/src/rules/flake8_datetimez/snapshots/ruff_linter__rules__flake8_datetimez__tests__DTZ001_DTZ001.py.snap +++ b/crates/ruff_linter/src/rules/flake8_datetimez/snapshots/ruff_linter__rules__flake8_datetimez__tests__DTZ001_DTZ001.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_datetimez/mod.rs --- -error[DTZ001]: DTZ001.py:4:1: `datetime.datetime()` called without a `tzinfo` argument +error[DTZ001]: 4:1: `datetime.datetime()` called without a `tzinfo` argument + --> DTZ001.py:3:10 | 3 | # no args 4 | datetime.datetime(2000, 1, 1, 0, 0, 0) @@ -11,8 +12,9 @@ error[DTZ001]: DTZ001.py:4:1: `datetime.datetime()` called without a `tzinfo` ar 6 | # none args | = help: Pass a `datetime.timezone` object to the `tzinfo` parameter -error[DTZ001]: DTZ001.py:7:1: `tzinfo=None` passed to `datetime.datetime()` +error[DTZ001]: 7:1: `tzinfo=None` passed to `datetime.datetime()` + --> DTZ001.py:6:12 | 6 | # none args 7 | datetime.datetime(2000, 1, 1, 0, 0, 0, 0, None) @@ -21,8 +23,9 @@ error[DTZ001]: DTZ001.py:7:1: `tzinfo=None` passed to `datetime.datetime()` 9 | # not none arg | = help: Pass a `datetime.timezone` object to the `tzinfo` parameter -error[DTZ001]: DTZ001.py:13:1: `datetime.datetime()` called without a `tzinfo` argument +error[DTZ001]: 13:1: `datetime.datetime()` called without a `tzinfo` argument + --> DTZ001.py:12:12 | 12 | # no kwargs 13 | datetime.datetime(2000, 1, 1, fold=1) @@ -31,8 +34,9 @@ error[DTZ001]: DTZ001.py:13:1: `datetime.datetime()` called without a `tzinfo` a 15 | # none kwargs | = help: Pass a `datetime.timezone` object to the `tzinfo` parameter -error[DTZ001]: DTZ001.py:16:1: `tzinfo=None` passed to `datetime.datetime()` +error[DTZ001]: 16:1: `tzinfo=None` passed to `datetime.datetime()` + --> DTZ001.py:15:14 | 15 | # none kwargs 16 | datetime.datetime(2000, 1, 1, tzinfo=None) @@ -41,8 +45,9 @@ error[DTZ001]: DTZ001.py:16:1: `tzinfo=None` passed to `datetime.datetime()` 18 | from datetime import datetime | = help: Pass a `datetime.timezone` object to the `tzinfo` parameter -error[DTZ001]: DTZ001.py:21:1: `datetime.datetime()` called without a `tzinfo` argument +error[DTZ001]: 21:1: `datetime.datetime()` called without a `tzinfo` argument + --> DTZ001.py:20:22 | 20 | # no args unqualified 21 | datetime(2000, 1, 1, 0, 0, 0) diff --git a/crates/ruff_linter/src/rules/flake8_datetimez/snapshots/ruff_linter__rules__flake8_datetimez__tests__DTZ002_DTZ002.py.snap b/crates/ruff_linter/src/rules/flake8_datetimez/snapshots/ruff_linter__rules__flake8_datetimez__tests__DTZ002_DTZ002.py.snap index 892662fcd7..01a2e96b99 100644 --- a/crates/ruff_linter/src/rules/flake8_datetimez/snapshots/ruff_linter__rules__flake8_datetimez__tests__DTZ002_DTZ002.py.snap +++ b/crates/ruff_linter/src/rules/flake8_datetimez/snapshots/ruff_linter__rules__flake8_datetimez__tests__DTZ002_DTZ002.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_datetimez/mod.rs --- -error[DTZ002]: DTZ002.py:4:1: `datetime.datetime.today()` used +error[DTZ002]: 4:1: `datetime.datetime.today()` used + --> DTZ002.py:3:12 | 3 | # qualified 4 | datetime.datetime.today() @@ -11,8 +12,9 @@ error[DTZ002]: DTZ002.py:4:1: `datetime.datetime.today()` used 6 | from datetime import datetime | = help: Use `datetime.datetime.now(tz=...)` instead -error[DTZ002]: DTZ002.py:9:1: `datetime.datetime.today()` used +error[DTZ002]: 9:1: `datetime.datetime.today()` used + --> DTZ002.py:8:14 | 8 | # unqualified 9 | datetime.today() diff --git a/crates/ruff_linter/src/rules/flake8_datetimez/snapshots/ruff_linter__rules__flake8_datetimez__tests__DTZ003_DTZ003.py.snap b/crates/ruff_linter/src/rules/flake8_datetimez/snapshots/ruff_linter__rules__flake8_datetimez__tests__DTZ003_DTZ003.py.snap index b711764e9e..815fa8b636 100644 --- a/crates/ruff_linter/src/rules/flake8_datetimez/snapshots/ruff_linter__rules__flake8_datetimez__tests__DTZ003_DTZ003.py.snap +++ b/crates/ruff_linter/src/rules/flake8_datetimez/snapshots/ruff_linter__rules__flake8_datetimez__tests__DTZ003_DTZ003.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_datetimez/mod.rs --- -error[DTZ003]: DTZ003.py:4:1: `datetime.datetime.utcnow()` used +error[DTZ003]: 4:1: `datetime.datetime.utcnow()` used + --> DTZ003.py:3:12 | 3 | # qualified 4 | datetime.datetime.utcnow() @@ -11,8 +12,9 @@ error[DTZ003]: DTZ003.py:4:1: `datetime.datetime.utcnow()` used 6 | from datetime import datetime | = help: Use `datetime.datetime.now(tz=...)` instead -error[DTZ003]: DTZ003.py:9:1: `datetime.datetime.utcnow()` used +error[DTZ003]: 9:1: `datetime.datetime.utcnow()` used + --> DTZ003.py:8:14 | 8 | # unqualified 9 | datetime.utcnow() diff --git a/crates/ruff_linter/src/rules/flake8_datetimez/snapshots/ruff_linter__rules__flake8_datetimez__tests__DTZ004_DTZ004.py.snap b/crates/ruff_linter/src/rules/flake8_datetimez/snapshots/ruff_linter__rules__flake8_datetimez__tests__DTZ004_DTZ004.py.snap index bf71e1316c..f5311528aa 100644 --- a/crates/ruff_linter/src/rules/flake8_datetimez/snapshots/ruff_linter__rules__flake8_datetimez__tests__DTZ004_DTZ004.py.snap +++ b/crates/ruff_linter/src/rules/flake8_datetimez/snapshots/ruff_linter__rules__flake8_datetimez__tests__DTZ004_DTZ004.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_datetimez/mod.rs --- -error[DTZ004]: DTZ004.py:4:1: `datetime.datetime.utcfromtimestamp()` used +error[DTZ004]: 4:1: `datetime.datetime.utcfromtimestamp()` used + --> DTZ004.py:3:12 | 3 | # qualified 4 | datetime.datetime.utcfromtimestamp(1234) @@ -11,8 +12,9 @@ error[DTZ004]: DTZ004.py:4:1: `datetime.datetime.utcfromtimestamp()` used 6 | from datetime import datetime | = help: Use `datetime.datetime.fromtimestamp(ts, tz=...)` instead -error[DTZ004]: DTZ004.py:9:1: `datetime.datetime.utcfromtimestamp()` used +error[DTZ004]: 9:1: `datetime.datetime.utcfromtimestamp()` used + --> DTZ004.py:8:14 | 8 | # unqualified 9 | datetime.utcfromtimestamp(1234) diff --git a/crates/ruff_linter/src/rules/flake8_datetimez/snapshots/ruff_linter__rules__flake8_datetimez__tests__DTZ005_DTZ005.py.snap b/crates/ruff_linter/src/rules/flake8_datetimez/snapshots/ruff_linter__rules__flake8_datetimez__tests__DTZ005_DTZ005.py.snap index 367d712bd2..4dbae961a8 100644 --- a/crates/ruff_linter/src/rules/flake8_datetimez/snapshots/ruff_linter__rules__flake8_datetimez__tests__DTZ005_DTZ005.py.snap +++ b/crates/ruff_linter/src/rules/flake8_datetimez/snapshots/ruff_linter__rules__flake8_datetimez__tests__DTZ005_DTZ005.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_datetimez/mod.rs --- -error[DTZ005]: DTZ005.py:4:1: `datetime.datetime.now()` called without a `tz` argument +error[DTZ005]: 4:1: `datetime.datetime.now()` called without a `tz` argument + --> DTZ005.py:3:10 | 3 | # no args 4 | datetime.datetime.now() @@ -11,8 +12,9 @@ error[DTZ005]: DTZ005.py:4:1: `datetime.datetime.now()` called without a `tz` ar 6 | # wrong keywords | = help: Pass a `datetime.timezone` object to the `tz` parameter -error[DTZ005]: DTZ005.py:7:1: `datetime.datetime.now()` called without a `tz` argument +error[DTZ005]: 7:1: `datetime.datetime.now()` called without a `tz` argument + --> DTZ005.py:6:17 | 6 | # wrong keywords 7 | datetime.datetime.now(bad=datetime.timezone.utc) @@ -21,8 +23,9 @@ error[DTZ005]: DTZ005.py:7:1: `datetime.datetime.now()` called without a `tz` ar 9 | # none args | = help: Pass a `datetime.timezone` object to the `tz` parameter -error[DTZ005]: DTZ005.py:10:1: `tz=None` passed to `datetime.datetime.now()` +error[DTZ005]: 10:1: `tz=None` passed to `datetime.datetime.now()` + --> DTZ005.py:9:12 | 9 | # none args 10 | datetime.datetime.now(None) @@ -31,8 +34,9 @@ error[DTZ005]: DTZ005.py:10:1: `tz=None` passed to `datetime.datetime.now()` 12 | # none keywords | = help: Pass a `datetime.timezone` object to the `tz` parameter -error[DTZ005]: DTZ005.py:13:1: `tz=None` passed to `datetime.datetime.now()` +error[DTZ005]: 13:1: `tz=None` passed to `datetime.datetime.now()` + --> DTZ005.py:12:16 | 12 | # none keywords 13 | datetime.datetime.now(tz=None) @@ -41,8 +45,9 @@ error[DTZ005]: DTZ005.py:13:1: `tz=None` passed to `datetime.datetime.now()` 15 | from datetime import datetime | = help: Pass a `datetime.timezone` object to the `tz` parameter -error[DTZ005]: DTZ005.py:18:1: `datetime.datetime.now()` called without a `tz` argument +error[DTZ005]: 18:1: `datetime.datetime.now()` called without a `tz` argument + --> DTZ005.py:17:22 | 17 | # no args unqualified 18 | datetime.now() diff --git a/crates/ruff_linter/src/rules/flake8_datetimez/snapshots/ruff_linter__rules__flake8_datetimez__tests__DTZ006_DTZ006.py.snap b/crates/ruff_linter/src/rules/flake8_datetimez/snapshots/ruff_linter__rules__flake8_datetimez__tests__DTZ006_DTZ006.py.snap index 4f9d25dcf7..cd639dc5d8 100644 --- a/crates/ruff_linter/src/rules/flake8_datetimez/snapshots/ruff_linter__rules__flake8_datetimez__tests__DTZ006_DTZ006.py.snap +++ b/crates/ruff_linter/src/rules/flake8_datetimez/snapshots/ruff_linter__rules__flake8_datetimez__tests__DTZ006_DTZ006.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_datetimez/mod.rs --- -error[DTZ006]: DTZ006.py:4:1: `datetime.datetime.fromtimestamp()` called without a `tz` argument +error[DTZ006]: 4:1: `datetime.datetime.fromtimestamp()` called without a `tz` argument + --> DTZ006.py:3:10 | 3 | # no args 4 | datetime.datetime.fromtimestamp(1234) @@ -11,8 +12,9 @@ error[DTZ006]: DTZ006.py:4:1: `datetime.datetime.fromtimestamp()` called without 6 | # wrong keywords | = help: Pass a `datetime.timezone` object to the `tz` parameter -error[DTZ006]: DTZ006.py:7:1: `datetime.datetime.fromtimestamp()` called without a `tz` argument +error[DTZ006]: 7:1: `datetime.datetime.fromtimestamp()` called without a `tz` argument + --> DTZ006.py:6:17 | 6 | # wrong keywords 7 | datetime.datetime.fromtimestamp(1234, bad=datetime.timezone.utc) @@ -21,8 +23,9 @@ error[DTZ006]: DTZ006.py:7:1: `datetime.datetime.fromtimestamp()` called without 9 | # none args | = help: Pass a `datetime.timezone` object to the `tz` parameter -error[DTZ006]: DTZ006.py:10:1: `tz=None` passed to `datetime.datetime.fromtimestamp()` +error[DTZ006]: 10:1: `tz=None` passed to `datetime.datetime.fromtimestamp()` + --> DTZ006.py:9:12 | 9 | # none args 10 | datetime.datetime.fromtimestamp(1234, None) @@ -31,8 +34,9 @@ error[DTZ006]: DTZ006.py:10:1: `tz=None` passed to `datetime.datetime.fromtimest 12 | # none keywords | = help: Pass a `datetime.timezone` object to the `tz` parameter -error[DTZ006]: DTZ006.py:13:1: `tz=None` passed to `datetime.datetime.fromtimestamp()` +error[DTZ006]: 13:1: `tz=None` passed to `datetime.datetime.fromtimestamp()` + --> DTZ006.py:12:16 | 12 | # none keywords 13 | datetime.datetime.fromtimestamp(1234, tz=None) @@ -41,8 +45,9 @@ error[DTZ006]: DTZ006.py:13:1: `tz=None` passed to `datetime.datetime.fromtimest 15 | from datetime import datetime | = help: Pass a `datetime.timezone` object to the `tz` parameter -error[DTZ006]: DTZ006.py:18:1: `datetime.datetime.fromtimestamp()` called without a `tz` argument +error[DTZ006]: 18:1: `datetime.datetime.fromtimestamp()` called without a `tz` argument + --> DTZ006.py:17:22 | 17 | # no args unqualified 18 | datetime.fromtimestamp(1234) diff --git a/crates/ruff_linter/src/rules/flake8_datetimez/snapshots/ruff_linter__rules__flake8_datetimez__tests__DTZ007_DTZ007.py.snap b/crates/ruff_linter/src/rules/flake8_datetimez/snapshots/ruff_linter__rules__flake8_datetimez__tests__DTZ007_DTZ007.py.snap index 5ed5763b46..5205f81ec0 100644 --- a/crates/ruff_linter/src/rules/flake8_datetimez/snapshots/ruff_linter__rules__flake8_datetimez__tests__DTZ007_DTZ007.py.snap +++ b/crates/ruff_linter/src/rules/flake8_datetimez/snapshots/ruff_linter__rules__flake8_datetimez__tests__DTZ007_DTZ007.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_datetimez/mod.rs --- -error[DTZ007]: DTZ007.py:4:1: Naive datetime constructed using `datetime.datetime.strptime()` without %z +error[DTZ007]: 4:1: Naive datetime constructed using `datetime.datetime.strptime()` without %z + --> DTZ007.py:3:13 | 3 | # bad format 4 | datetime.datetime.strptime("something", "%H:%M:%S%Z") @@ -11,8 +12,9 @@ error[DTZ007]: DTZ007.py:4:1: Naive datetime constructed using `datetime.datetim 6 | # no replace or astimezone | = help: Call `.replace(tzinfo=)` or `.astimezone()` to convert to an aware datetime -error[DTZ007]: DTZ007.py:7:1: Naive datetime constructed using `datetime.datetime.strptime()` without %z +error[DTZ007]: 7:1: Naive datetime constructed using `datetime.datetime.strptime()` without %z + --> DTZ007.py:6:27 | 6 | # no replace or astimezone 7 | datetime.datetime.strptime("something", "something") @@ -21,8 +23,9 @@ error[DTZ007]: DTZ007.py:7:1: Naive datetime constructed using `datetime.datetim 9 | # wrong replace | = help: Call `.replace(tzinfo=)` or `.astimezone()` to convert to an aware datetime -error[DTZ007]: DTZ007.py:10:1: Naive datetime constructed using `datetime.datetime.strptime()` without %z +error[DTZ007]: 10:1: Naive datetime constructed using `datetime.datetime.strptime()` without %z + --> DTZ007.py:9:16 | 9 | # wrong replace 10 | datetime.datetime.strptime("something", "something").replace(hour=1) @@ -31,8 +34,9 @@ error[DTZ007]: DTZ007.py:10:1: Naive datetime constructed using `datetime.dateti 12 | # none replace | = help: Call `.replace(tzinfo=)` or `.astimezone()` to convert to an aware datetime -error[DTZ007]: DTZ007.py:13:1: `datetime.datetime.strptime(...).replace(tz=None)` used +error[DTZ007]: 13:1: `datetime.datetime.strptime(...).replace(tz=None)` used + --> DTZ007.py:12:15 | 12 | # none replace 13 | datetime.datetime.strptime("something", "something").replace(tzinfo=None) @@ -41,8 +45,9 @@ error[DTZ007]: DTZ007.py:13:1: `datetime.datetime.strptime(...).replace(tz=None) 15 | # OK | = help: Pass a `datetime.timezone` object to the `tzinfo` parameter -error[DTZ007]: DTZ007.py:35:1: Naive datetime constructed using `datetime.datetime.strptime()` without %z +error[DTZ007]: 35:1: Naive datetime constructed using `datetime.datetime.strptime()` without %z + --> DTZ007.py:34:38 | 34 | # no replace orastimezone unqualified 35 | datetime.strptime("something", "something") diff --git a/crates/ruff_linter/src/rules/flake8_datetimez/snapshots/ruff_linter__rules__flake8_datetimez__tests__DTZ011_DTZ011.py.snap b/crates/ruff_linter/src/rules/flake8_datetimez/snapshots/ruff_linter__rules__flake8_datetimez__tests__DTZ011_DTZ011.py.snap index c35e16c397..cbdacf94eb 100644 --- a/crates/ruff_linter/src/rules/flake8_datetimez/snapshots/ruff_linter__rules__flake8_datetimez__tests__DTZ011_DTZ011.py.snap +++ b/crates/ruff_linter/src/rules/flake8_datetimez/snapshots/ruff_linter__rules__flake8_datetimez__tests__DTZ011_DTZ011.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_datetimez/mod.rs --- -error[DTZ011]: DTZ011.py:4:1: `datetime.date.today()` used +error[DTZ011]: 4:1: `datetime.date.today()` used + --> DTZ011.py:3:12 | 3 | # qualified 4 | datetime.date.today() @@ -11,8 +12,9 @@ error[DTZ011]: DTZ011.py:4:1: `datetime.date.today()` used 6 | from datetime import date | = help: Use `datetime.datetime.now(tz=...).date()` instead -error[DTZ011]: DTZ011.py:9:1: `datetime.date.today()` used +error[DTZ011]: 9:1: `datetime.date.today()` used + --> DTZ011.py:8:14 | 8 | # unqualified 9 | date.today() diff --git a/crates/ruff_linter/src/rules/flake8_datetimez/snapshots/ruff_linter__rules__flake8_datetimez__tests__DTZ012_DTZ012.py.snap b/crates/ruff_linter/src/rules/flake8_datetimez/snapshots/ruff_linter__rules__flake8_datetimez__tests__DTZ012_DTZ012.py.snap index d3fb8f18d3..ba5ca4d067 100644 --- a/crates/ruff_linter/src/rules/flake8_datetimez/snapshots/ruff_linter__rules__flake8_datetimez__tests__DTZ012_DTZ012.py.snap +++ b/crates/ruff_linter/src/rules/flake8_datetimez/snapshots/ruff_linter__rules__flake8_datetimez__tests__DTZ012_DTZ012.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_datetimez/mod.rs --- -error[DTZ012]: DTZ012.py:4:1: `datetime.date.fromtimestamp()` used +error[DTZ012]: 4:1: `datetime.date.fromtimestamp()` used + --> DTZ012.py:3:12 | 3 | # qualified 4 | datetime.date.fromtimestamp(1234) @@ -11,8 +12,9 @@ error[DTZ012]: DTZ012.py:4:1: `datetime.date.fromtimestamp()` used 6 | from datetime import date | = help: Use `datetime.datetime.fromtimestamp(ts, tz=...).date()` instead -error[DTZ012]: DTZ012.py:9:1: `datetime.date.fromtimestamp()` used +error[DTZ012]: 9:1: `datetime.date.fromtimestamp()` used + --> DTZ012.py:8:14 | 8 | # unqualified 9 | date.fromtimestamp(1234) diff --git a/crates/ruff_linter/src/rules/flake8_debugger/snapshots/ruff_linter__rules__flake8_debugger__tests__T100_T100.py.snap b/crates/ruff_linter/src/rules/flake8_debugger/snapshots/ruff_linter__rules__flake8_debugger__tests__T100_T100.py.snap index 82c7520326..180eeb7f5d 100644 --- a/crates/ruff_linter/src/rules/flake8_debugger/snapshots/ruff_linter__rules__flake8_debugger__tests__T100_T100.py.snap +++ b/crates/ruff_linter/src/rules/flake8_debugger/snapshots/ruff_linter__rules__flake8_debugger__tests__T100_T100.py.snap @@ -1,16 +1,18 @@ --- source: crates/ruff_linter/src/rules/flake8_debugger/mod.rs --- -error[T100]: T100.py:1:1: Trace found: `breakpoint` used +error[T100]: 1:1: Trace found: `breakpoint` used + --> T100.py:1:1 | 1 | breakpoint() | ^^^^^^^^^^^^ 2 | 3 | import pdb | -error[T100]: T100.py:3:1: Import for `pdb` found +error[T100]: 3:1: Import for `pdb` found + --> T100.py:2:1 | 1 | breakpoint() 2 | @@ -19,8 +21,9 @@ error[T100]: T100.py:3:1: Import for `pdb` found 4 | import builtins 5 | from builtins import breakpoint | -error[T100]: T100.py:5:1: Import for `builtins.breakpoint` found +error[T100]: 5:1: Import for `builtins.breakpoint` found + --> T100.py:4:16 | 3 | import pdb 4 | import builtins @@ -29,8 +32,9 @@ error[T100]: T100.py:5:1: Import for `builtins.breakpoint` found 6 | from pdb import set_trace as st 7 | from celery.contrib.rdb import set_trace | -error[T100]: T100.py:6:1: Import for `pdb.set_trace` found +error[T100]: 6:1: Import for `pdb.set_trace` found + --> T100.py:5:32 | 4 | import builtins 5 | from builtins import breakpoint @@ -39,8 +43,9 @@ error[T100]: T100.py:6:1: Import for `pdb.set_trace` found 7 | from celery.contrib.rdb import set_trace 8 | from celery.contrib import rdb | -error[T100]: T100.py:7:1: Import for `celery.contrib.rdb.set_trace` found +error[T100]: 7:1: Import for `celery.contrib.rdb.set_trace` found + --> T100.py:6:32 | 5 | from builtins import breakpoint 6 | from pdb import set_trace as st @@ -49,8 +54,9 @@ error[T100]: T100.py:7:1: Import for `celery.contrib.rdb.set_trace` found 8 | from celery.contrib import rdb 9 | import celery.contrib.rdb | -error[T100]: T100.py:9:1: Import for `celery.contrib.rdb` found +error[T100]: 9:1: Import for `celery.contrib.rdb` found + --> T100.py:8:31 | 7 | from celery.contrib.rdb import set_trace 8 | from celery.contrib import rdb @@ -59,8 +65,9 @@ error[T100]: T100.py:9:1: Import for `celery.contrib.rdb` found 10 | from debugpy import wait_for_client 11 | import debugpy | -error[T100]: T100.py:10:1: Import for `debugpy.wait_for_client` found +error[T100]: 10:1: Import for `debugpy.wait_for_client` found + --> T100.py:9:26 | 8 | from celery.contrib import rdb 9 | import celery.contrib.rdb @@ -69,8 +76,9 @@ error[T100]: T100.py:10:1: Import for `debugpy.wait_for_client` found 11 | import debugpy 12 | from ptvsd import break_into_debugger | -error[T100]: T100.py:11:1: Import for `debugpy` found +error[T100]: 11:1: Import for `debugpy` found + --> T100.py:10:36 | 9 | import celery.contrib.rdb 10 | from debugpy import wait_for_client @@ -79,8 +87,9 @@ error[T100]: T100.py:11:1: Import for `debugpy` found 12 | from ptvsd import break_into_debugger 13 | from ptvsd import enable_attach | -error[T100]: T100.py:12:1: Import for `ptvsd.break_into_debugger` found +error[T100]: 12:1: Import for `ptvsd.break_into_debugger` found + --> T100.py:11:15 | 10 | from debugpy import wait_for_client 11 | import debugpy @@ -89,8 +98,9 @@ error[T100]: T100.py:12:1: Import for `ptvsd.break_into_debugger` found 13 | from ptvsd import enable_attach 14 | from ptvsd import wait_for_attach | -error[T100]: T100.py:14:1: Import for `ptvsd.wait_for_attach` found +error[T100]: 14:1: Import for `ptvsd.wait_for_attach` found + --> T100.py:13:32 | 12 | from ptvsd import break_into_debugger 13 | from ptvsd import enable_attach @@ -98,8 +108,9 @@ error[T100]: T100.py:14:1: Import for `ptvsd.wait_for_attach` found | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 15 | import ptvsd | -error[T100]: T100.py:15:1: Import for `ptvsd` found +error[T100]: 15:1: Import for `ptvsd` found + --> T100.py:14:34 | 13 | from ptvsd import enable_attach 14 | from ptvsd import wait_for_attach @@ -108,8 +119,9 @@ error[T100]: T100.py:15:1: Import for `ptvsd` found 16 | 17 | breakpoint() | -error[T100]: T100.py:17:1: Trace found: `builtins.breakpoint` used +error[T100]: 17:1: Trace found: `builtins.breakpoint` used + --> T100.py:16:1 | 15 | import ptvsd 16 | @@ -118,8 +130,9 @@ error[T100]: T100.py:17:1: Trace found: `builtins.breakpoint` used 18 | st() 19 | set_trace() | -error[T100]: T100.py:18:1: Trace found: `pdb.set_trace` used +error[T100]: 18:1: Trace found: `pdb.set_trace` used + --> T100.py:17:13 | 17 | breakpoint() 18 | st() @@ -127,8 +140,9 @@ error[T100]: T100.py:18:1: Trace found: `pdb.set_trace` used 19 | set_trace() 20 | debugpy.breakpoint() | -error[T100]: T100.py:19:1: Trace found: `celery.contrib.rdb.set_trace` used +error[T100]: 19:1: Trace found: `celery.contrib.rdb.set_trace` used + --> T100.py:18:5 | 17 | breakpoint() 18 | st() @@ -137,8 +151,9 @@ error[T100]: T100.py:19:1: Trace found: `celery.contrib.rdb.set_trace` used 20 | debugpy.breakpoint() 21 | wait_for_client() | -error[T100]: T100.py:20:1: Trace found: `debugpy.breakpoint` used +error[T100]: 20:1: Trace found: `debugpy.breakpoint` used + --> T100.py:19:12 | 18 | st() 19 | set_trace() @@ -147,8 +162,9 @@ error[T100]: T100.py:20:1: Trace found: `debugpy.breakpoint` used 21 | wait_for_client() 22 | debugpy.listen(1234) | -error[T100]: T100.py:21:1: Trace found: `debugpy.wait_for_client` used +error[T100]: 21:1: Trace found: `debugpy.wait_for_client` used + --> T100.py:20:21 | 19 | set_trace() 20 | debugpy.breakpoint() @@ -157,8 +173,9 @@ error[T100]: T100.py:21:1: Trace found: `debugpy.wait_for_client` used 22 | debugpy.listen(1234) 23 | enable_attach() | -error[T100]: T100.py:22:1: Trace found: `debugpy.listen` used +error[T100]: 22:1: Trace found: `debugpy.listen` used + --> T100.py:21:18 | 20 | debugpy.breakpoint() 21 | wait_for_client() @@ -167,8 +184,9 @@ error[T100]: T100.py:22:1: Trace found: `debugpy.listen` used 23 | enable_attach() 24 | break_into_debugger() | -error[T100]: T100.py:24:1: Trace found: `ptvsd.break_into_debugger` used +error[T100]: 24:1: Trace found: `ptvsd.break_into_debugger` used + --> T100.py:23:16 | 22 | debugpy.listen(1234) 23 | enable_attach() @@ -176,8 +194,9 @@ error[T100]: T100.py:24:1: Trace found: `ptvsd.break_into_debugger` used | ^^^^^^^^^^^^^^^^^^^^^ 25 | wait_for_attach() | -error[T100]: T100.py:25:1: Trace found: `ptvsd.wait_for_attach` used +error[T100]: 25:1: Trace found: `ptvsd.wait_for_attach` used + --> T100.py:24:22 | 23 | enable_attach() 24 | break_into_debugger() diff --git a/crates/ruff_linter/src/rules/flake8_django/snapshots/ruff_linter__rules__flake8_django__tests__DJ001_DJ001.py.snap b/crates/ruff_linter/src/rules/flake8_django/snapshots/ruff_linter__rules__flake8_django__tests__DJ001_DJ001.py.snap index a7baeda261..44808b2947 100644 --- a/crates/ruff_linter/src/rules/flake8_django/snapshots/ruff_linter__rules__flake8_django__tests__DJ001_DJ001.py.snap +++ b/crates/ruff_linter/src/rules/flake8_django/snapshots/ruff_linter__rules__flake8_django__tests__DJ001_DJ001.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_django/mod.rs --- -error[DJ001]: DJ001.py:7:17: Avoid using `null=True` on string-based fields such as `CharField` +error[DJ001]: 7:17: Avoid using `null=True` on string-based fields such as `CharField` + --> DJ001.py:7:17 | 6 | class IncorrectModel(models.Model): 7 | charfield = models.CharField(max_length=255, null=True) @@ -10,8 +11,9 @@ error[DJ001]: DJ001.py:7:17: Avoid using `null=True` on string-based fields such 8 | textfield = models.TextField(max_length=255, null=True) 9 | slugfield = models.SlugField(max_length=255, null=True) | -error[DJ001]: DJ001.py:8:17: Avoid using `null=True` on string-based fields such as `TextField` +error[DJ001]: 8:17: Avoid using `null=True` on string-based fields such as `TextField` + --> DJ001.py:8:17 | 6 | class IncorrectModel(models.Model): 7 | charfield = models.CharField(max_length=255, null=True) @@ -20,8 +22,9 @@ error[DJ001]: DJ001.py:8:17: Avoid using `null=True` on string-based fields such 9 | slugfield = models.SlugField(max_length=255, null=True) 10 | emailfield = models.EmailField(max_length=255, null=True) | -error[DJ001]: DJ001.py:9:17: Avoid using `null=True` on string-based fields such as `SlugField` +error[DJ001]: 9:17: Avoid using `null=True` on string-based fields such as `SlugField` + --> DJ001.py:9:17 | 7 | charfield = models.CharField(max_length=255, null=True) 8 | textfield = models.TextField(max_length=255, null=True) @@ -30,8 +33,9 @@ error[DJ001]: DJ001.py:9:17: Avoid using `null=True` on string-based fields such 10 | emailfield = models.EmailField(max_length=255, null=True) 11 | filepathfield = models.FilePathField(max_length=255, null=True) | -error[DJ001]: DJ001.py:10:18: Avoid using `null=True` on string-based fields such as `EmailField` +error[DJ001]: 10:18: Avoid using `null=True` on string-based fields such as `EmailField` + --> DJ001.py:10:18 | 8 | textfield = models.TextField(max_length=255, null=True) 9 | slugfield = models.SlugField(max_length=255, null=True) @@ -40,8 +44,9 @@ error[DJ001]: DJ001.py:10:18: Avoid using `null=True` on string-based fields suc 11 | filepathfield = models.FilePathField(max_length=255, null=True) 12 | urlfield = models.URLField(max_length=255, null=True) | -error[DJ001]: DJ001.py:11:21: Avoid using `null=True` on string-based fields such as `FilePathField` +error[DJ001]: 11:21: Avoid using `null=True` on string-based fields such as `FilePathField` + --> DJ001.py:11:21 | 9 | slugfield = models.SlugField(max_length=255, null=True) 10 | emailfield = models.EmailField(max_length=255, null=True) @@ -49,16 +54,18 @@ error[DJ001]: DJ001.py:11:21: Avoid using `null=True` on string-based fields suc | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 12 | urlfield = models.URLField(max_length=255, null=True) | -error[DJ001]: DJ001.py:12:16: Avoid using `null=True` on string-based fields such as `URLField` +error[DJ001]: 12:16: Avoid using `null=True` on string-based fields such as `URLField` + --> DJ001.py:12:16 | 10 | emailfield = models.EmailField(max_length=255, null=True) 11 | filepathfield = models.FilePathField(max_length=255, null=True) 12 | urlfield = models.URLField(max_length=255, null=True) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -error[DJ001]: DJ001.py:16:17: Avoid using `null=True` on string-based fields such as `CharField` +error[DJ001]: 16:17: Avoid using `null=True` on string-based fields such as `CharField` + --> DJ001.py:16:17 | 15 | class IncorrectModelWithAlias(DjangoModel): 16 | charfield = DjangoModel.CharField(max_length=255, null=True) @@ -66,8 +73,9 @@ error[DJ001]: DJ001.py:16:17: Avoid using `null=True` on string-based fields suc 17 | textfield = SmthCharField(max_length=255, null=True) 18 | slugfield = models.SlugField(max_length=255, null=True) | -error[DJ001]: DJ001.py:17:17: Avoid using `null=True` on string-based fields such as `CharField` +error[DJ001]: 17:17: Avoid using `null=True` on string-based fields such as `CharField` + --> DJ001.py:17:17 | 15 | class IncorrectModelWithAlias(DjangoModel): 16 | charfield = DjangoModel.CharField(max_length=255, null=True) @@ -76,8 +84,9 @@ error[DJ001]: DJ001.py:17:17: Avoid using `null=True` on string-based fields suc 18 | slugfield = models.SlugField(max_length=255, null=True) 19 | emailfield = models.EmailField(max_length=255, null=True) | -error[DJ001]: DJ001.py:18:17: Avoid using `null=True` on string-based fields such as `SlugField` +error[DJ001]: 18:17: Avoid using `null=True` on string-based fields such as `SlugField` + --> DJ001.py:18:17 | 16 | charfield = DjangoModel.CharField(max_length=255, null=True) 17 | textfield = SmthCharField(max_length=255, null=True) @@ -86,8 +95,9 @@ error[DJ001]: DJ001.py:18:17: Avoid using `null=True` on string-based fields suc 19 | emailfield = models.EmailField(max_length=255, null=True) 20 | filepathfield = models.FilePathField(max_length=255, null=True) | -error[DJ001]: DJ001.py:19:18: Avoid using `null=True` on string-based fields such as `EmailField` +error[DJ001]: 19:18: Avoid using `null=True` on string-based fields such as `EmailField` + --> DJ001.py:19:18 | 17 | textfield = SmthCharField(max_length=255, null=True) 18 | slugfield = models.SlugField(max_length=255, null=True) @@ -96,8 +106,9 @@ error[DJ001]: DJ001.py:19:18: Avoid using `null=True` on string-based fields suc 20 | filepathfield = models.FilePathField(max_length=255, null=True) 21 | urlfield = models.URLField(max_length=255, null=True) | -error[DJ001]: DJ001.py:20:21: Avoid using `null=True` on string-based fields such as `FilePathField` +error[DJ001]: 20:21: Avoid using `null=True` on string-based fields such as `FilePathField` + --> DJ001.py:20:21 | 18 | slugfield = models.SlugField(max_length=255, null=True) 19 | emailfield = models.EmailField(max_length=255, null=True) @@ -105,16 +116,18 @@ error[DJ001]: DJ001.py:20:21: Avoid using `null=True` on string-based fields suc | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 21 | urlfield = models.URLField(max_length=255, null=True) | -error[DJ001]: DJ001.py:21:16: Avoid using `null=True` on string-based fields such as `URLField` +error[DJ001]: 21:16: Avoid using `null=True` on string-based fields such as `URLField` + --> DJ001.py:21:16 | 19 | emailfield = models.EmailField(max_length=255, null=True) 20 | filepathfield = models.FilePathField(max_length=255, null=True) 21 | urlfield = models.URLField(max_length=255, null=True) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -error[DJ001]: DJ001.py:25:17: Avoid using `null=True` on string-based fields such as `CharField` +error[DJ001]: 25:17: Avoid using `null=True` on string-based fields such as `CharField` + --> DJ001.py:25:17 | 24 | class IncorrectModelWithoutSuperclass: 25 | charfield = DjangoModel.CharField(max_length=255, null=True) @@ -122,8 +135,9 @@ error[DJ001]: DJ001.py:25:17: Avoid using `null=True` on string-based fields suc 26 | textfield = SmthCharField(max_length=255, null=True) 27 | slugfield = models.SlugField(max_length=255, null=True) | -error[DJ001]: DJ001.py:26:17: Avoid using `null=True` on string-based fields such as `CharField` +error[DJ001]: 26:17: Avoid using `null=True` on string-based fields such as `CharField` + --> DJ001.py:26:17 | 24 | class IncorrectModelWithoutSuperclass: 25 | charfield = DjangoModel.CharField(max_length=255, null=True) @@ -132,8 +146,9 @@ error[DJ001]: DJ001.py:26:17: Avoid using `null=True` on string-based fields suc 27 | slugfield = models.SlugField(max_length=255, null=True) 28 | emailfield = models.EmailField(max_length=255, null=True) | -error[DJ001]: DJ001.py:27:17: Avoid using `null=True` on string-based fields such as `SlugField` +error[DJ001]: 27:17: Avoid using `null=True` on string-based fields such as `SlugField` + --> DJ001.py:27:17 | 25 | charfield = DjangoModel.CharField(max_length=255, null=True) 26 | textfield = SmthCharField(max_length=255, null=True) @@ -142,8 +157,9 @@ error[DJ001]: DJ001.py:27:17: Avoid using `null=True` on string-based fields suc 28 | emailfield = models.EmailField(max_length=255, null=True) 29 | filepathfield = models.FilePathField(max_length=255, null=True) | -error[DJ001]: DJ001.py:28:18: Avoid using `null=True` on string-based fields such as `EmailField` +error[DJ001]: 28:18: Avoid using `null=True` on string-based fields such as `EmailField` + --> DJ001.py:28:18 | 26 | textfield = SmthCharField(max_length=255, null=True) 27 | slugfield = models.SlugField(max_length=255, null=True) @@ -152,8 +168,9 @@ error[DJ001]: DJ001.py:28:18: Avoid using `null=True` on string-based fields suc 29 | filepathfield = models.FilePathField(max_length=255, null=True) 30 | urlfield = models.URLField(max_length=255, null=True) | -error[DJ001]: DJ001.py:29:21: Avoid using `null=True` on string-based fields such as `FilePathField` +error[DJ001]: 29:21: Avoid using `null=True` on string-based fields such as `FilePathField` + --> DJ001.py:29:21 | 27 | slugfield = models.SlugField(max_length=255, null=True) 28 | emailfield = models.EmailField(max_length=255, null=True) @@ -161,8 +178,9 @@ error[DJ001]: DJ001.py:29:21: Avoid using `null=True` on string-based fields suc | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 30 | urlfield = models.URLField(max_length=255, null=True) | -error[DJ001]: DJ001.py:30:16: Avoid using `null=True` on string-based fields such as `URLField` +error[DJ001]: 30:16: Avoid using `null=True` on string-based fields such as `URLField` + --> DJ001.py:30:16 | 28 | emailfield = models.EmailField(max_length=255, null=True) 29 | filepathfield = models.FilePathField(max_length=255, null=True) diff --git a/crates/ruff_linter/src/rules/flake8_django/snapshots/ruff_linter__rules__flake8_django__tests__DJ003_DJ003.py.snap b/crates/ruff_linter/src/rules/flake8_django/snapshots/ruff_linter__rules__flake8_django__tests__DJ003_DJ003.py.snap index 6c4b7bc8b6..5c7134dd96 100644 --- a/crates/ruff_linter/src/rules/flake8_django/snapshots/ruff_linter__rules__flake8_django__tests__DJ003_DJ003.py.snap +++ b/crates/ruff_linter/src/rules/flake8_django/snapshots/ruff_linter__rules__flake8_django__tests__DJ003_DJ003.py.snap @@ -1,15 +1,17 @@ --- source: crates/ruff_linter/src/rules/flake8_django/mod.rs --- -error[DJ003]: DJ003.py:5:42: Avoid passing `locals()` as context to a `render` function +error[DJ003]: 5:42: Avoid passing `locals()` as context to a `render` function + --> DJ003.py:5:42 | 4 | def test_view1(request): 5 | return render(request, "index.html", locals()) | ^^^^^^^^ | -error[DJ003]: DJ003.py:9:50: Avoid passing `locals()` as context to a `render` function +error[DJ003]: 9:50: Avoid passing `locals()` as context to a `render` function + --> DJ003.py:9:50 | 8 | def test_view2(request): 9 | return render(request, "index.html", context=locals()) diff --git a/crates/ruff_linter/src/rules/flake8_django/snapshots/ruff_linter__rules__flake8_django__tests__DJ006_DJ006.py.snap b/crates/ruff_linter/src/rules/flake8_django/snapshots/ruff_linter__rules__flake8_django__tests__DJ006_DJ006.py.snap index 1671a8eac4..5d7e8914cc 100644 --- a/crates/ruff_linter/src/rules/flake8_django/snapshots/ruff_linter__rules__flake8_django__tests__DJ006_DJ006.py.snap +++ b/crates/ruff_linter/src/rules/flake8_django/snapshots/ruff_linter__rules__flake8_django__tests__DJ006_DJ006.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_django/mod.rs --- -error[DJ006]: DJ006.py:6:9: Do not use `exclude` with `ModelForm`, use `fields` instead +error[DJ006]: 6:9: Do not use `exclude` with `ModelForm`, use `fields` instead + --> DJ006.py:6:9 | 4 | class TestModelForm1(forms.ModelForm): 5 | class Meta: diff --git a/crates/ruff_linter/src/rules/flake8_django/snapshots/ruff_linter__rules__flake8_django__tests__DJ007_DJ007.py.snap b/crates/ruff_linter/src/rules/flake8_django/snapshots/ruff_linter__rules__flake8_django__tests__DJ007_DJ007.py.snap index 5412005443..20007b43f3 100644 --- a/crates/ruff_linter/src/rules/flake8_django/snapshots/ruff_linter__rules__flake8_django__tests__DJ007_DJ007.py.snap +++ b/crates/ruff_linter/src/rules/flake8_django/snapshots/ruff_linter__rules__flake8_django__tests__DJ007_DJ007.py.snap @@ -1,16 +1,18 @@ --- source: crates/ruff_linter/src/rules/flake8_django/mod.rs --- -error[DJ007]: DJ007.py:6:9: Do not use `__all__` with `ModelForm`, use `fields` instead +error[DJ007]: 6:9: Do not use `__all__` with `ModelForm`, use `fields` instead + --> DJ007.py:6:9 | 4 | class TestModelForm1(forms.ModelForm): 5 | class Meta: 6 | fields = "__all__" | ^^^^^^^^^^^^^^^^^^ | -error[DJ007]: DJ007.py:11:9: Do not use `__all__` with `ModelForm`, use `fields` instead +error[DJ007]: 11:9: Do not use `__all__` with `ModelForm`, use `fields` instead + --> DJ007.py:11:9 | 9 | class TestModelForm2(forms.ModelForm): 10 | class Meta: diff --git a/crates/ruff_linter/src/rules/flake8_django/snapshots/ruff_linter__rules__flake8_django__tests__DJ008_DJ008.py.snap b/crates/ruff_linter/src/rules/flake8_django/snapshots/ruff_linter__rules__flake8_django__tests__DJ008_DJ008.py.snap index e0a7aca6e6..3248c5cb87 100644 --- a/crates/ruff_linter/src/rules/flake8_django/snapshots/ruff_linter__rules__flake8_django__tests__DJ008_DJ008.py.snap +++ b/crates/ruff_linter/src/rules/flake8_django/snapshots/ruff_linter__rules__flake8_django__tests__DJ008_DJ008.py.snap @@ -1,30 +1,34 @@ --- source: crates/ruff_linter/src/rules/flake8_django/mod.rs --- -error[DJ008]: DJ008.py:6:7: Model does not define `__str__` method +error[DJ008]: 6:7: Model does not define `__str__` method + --> DJ008.py:6:7 | 5 | # Models without __str__ 6 | class TestModel1(models.Model): | ^^^^^^^^^^ 7 | new_field = models.CharField(max_length=10) | -error[DJ008]: DJ008.py:21:7: Model does not define `__str__` method +error[DJ008]: 21:7: Model does not define `__str__` method + --> DJ008.py:21:7 | 21 | class TestModel2(Model): | ^^^^^^^^^^ 22 | new_field = models.CharField(max_length=10) | -error[DJ008]: DJ008.py:36:7: Model does not define `__str__` method +error[DJ008]: 36:7: Model does not define `__str__` method + --> DJ008.py:36:7 | 36 | class TestModel3(Model): | ^^^^^^^^^^ 37 | new_field = models.CharField(max_length=10) | -error[DJ008]: DJ008.py:182:7: Model does not define `__str__` method +error[DJ008]: 182:7: Model does not define `__str__` method + --> DJ008.py:182:7 | 181 | # Subclass without __str__ 182 | class SubclassTestModel3(TestModel1): diff --git a/crates/ruff_linter/src/rules/flake8_django/snapshots/ruff_linter__rules__flake8_django__tests__DJ012_DJ012.py.snap b/crates/ruff_linter/src/rules/flake8_django/snapshots/ruff_linter__rules__flake8_django__tests__DJ012_DJ012.py.snap index d7bdee375b..2130f65cbf 100644 --- a/crates/ruff_linter/src/rules/flake8_django/snapshots/ruff_linter__rules__flake8_django__tests__DJ012_DJ012.py.snap +++ b/crates/ruff_linter/src/rules/flake8_django/snapshots/ruff_linter__rules__flake8_django__tests__DJ012_DJ012.py.snap @@ -1,24 +1,27 @@ --- source: crates/ruff_linter/src/rules/flake8_django/mod.rs --- -error[DJ012]: DJ012.py:28:5: Order of model's inner classes, methods, and fields does not follow the Django Style Guide: field declaration should come before `Meta` class +error[DJ012]: 28:5: Order of model's inner classes, methods, and fields does not follow the Django Style Guide: field declaration should come before `Meta` class + --> DJ012.py:28:5 | 26 | return "foobar" 27 | 28 | first_name = models.CharField(max_length=32) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -error[DJ012]: DJ012.py:43:5: Order of model's inner classes, methods, and fields does not follow the Django Style Guide: field declaration should come before manager declaration +error[DJ012]: 43:5: Order of model's inner classes, methods, and fields does not follow the Django Style Guide: field declaration should come before manager declaration + --> DJ012.py:43:5 | 41 | return "foobar" 42 | 43 | first_name = models.CharField(max_length=32) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -error[DJ012]: DJ012.py:56:5: Order of model's inner classes, methods, and fields does not follow the Django Style Guide: `__str__` method should come before custom method +error[DJ012]: 56:5: Order of model's inner classes, methods, and fields does not follow the Django Style Guide: `__str__` method should come before custom method + --> DJ012.py:56:5 | 54 | pass 55 | @@ -27,8 +30,9 @@ error[DJ012]: DJ012.py:56:5: Order of model's inner classes, methods, and fields 57 | | return "foobar" | |_______________________^ | -error[DJ012]: DJ012.py:69:5: Order of model's inner classes, methods, and fields does not follow the Django Style Guide: `save` method should come before `get_absolute_url` method +error[DJ012]: 69:5: Order of model's inner classes, methods, and fields does not follow the Django Style Guide: `save` method should come before `get_absolute_url` method + --> DJ012.py:69:5 | 67 | pass 68 | @@ -37,8 +41,9 @@ error[DJ012]: DJ012.py:69:5: Order of model's inner classes, methods, and fields 70 | | pass | |____________^ | -error[DJ012]: DJ012.py:123:5: Order of model's inner classes, methods, and fields does not follow the Django Style Guide: field declaration should come before `Meta` class +error[DJ012]: 123:5: Order of model's inner classes, methods, and fields does not follow the Django Style Guide: field declaration should come before `Meta` class + --> DJ012.py:123:5 | 121 | verbose_name = "test" 122 | @@ -46,16 +51,18 @@ error[DJ012]: DJ012.py:123:5: Order of model's inner classes, methods, and field | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 124 | last_name = models.CharField(max_length=32) | -error[DJ012]: DJ012.py:129:5: Order of model's inner classes, methods, and fields does not follow the Django Style Guide: field declaration should come before `Meta` class +error[DJ012]: 129:5: Order of model's inner classes, methods, and fields does not follow the Django Style Guide: field declaration should come before `Meta` class + --> DJ012.py:129:5 | 127 | pass 128 | 129 | middle_name = models.CharField(max_length=32) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -error[DJ012]: DJ012.py:146:5: Order of model's inner classes, methods, and fields does not follow the Django Style Guide: field declaration should come before `Meta` class +error[DJ012]: 146:5: Order of model's inner classes, methods, and fields does not follow the Django Style Guide: field declaration should come before `Meta` class + --> DJ012.py:146:5 | 144 | return "foobar" 145 | diff --git a/crates/ruff_linter/src/rules/flake8_django/snapshots/ruff_linter__rules__flake8_django__tests__DJ013_DJ013.py.snap b/crates/ruff_linter/src/rules/flake8_django/snapshots/ruff_linter__rules__flake8_django__tests__DJ013_DJ013.py.snap index 6f0970a895..84e3d8e3f5 100644 --- a/crates/ruff_linter/src/rules/flake8_django/snapshots/ruff_linter__rules__flake8_django__tests__DJ013_DJ013.py.snap +++ b/crates/ruff_linter/src/rules/flake8_django/snapshots/ruff_linter__rules__flake8_django__tests__DJ013_DJ013.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_django/mod.rs --- -error[DJ013]: DJ013.py:15:1: `@receiver` decorator must be on top of all the other decorators +error[DJ013]: 15:1: `@receiver` decorator must be on top of all the other decorators + --> DJ013.py:14:16 | 14 | @test_decorator 15 | @receiver(pre_save, sender=MyModel) @@ -10,8 +11,9 @@ error[DJ013]: DJ013.py:15:1: `@receiver` decorator must be on top of all the oth 16 | def incorrect_pre_save_handler(): 17 | pass | -error[DJ013]: DJ013.py:35:1: `@receiver` decorator must be on top of all the other decorators +error[DJ013]: 35:1: `@receiver` decorator must be on top of all the other decorators + --> DJ013.py:34:16 | 33 | @receiver(pre_save, sender=MyModel) 34 | @test_decorator diff --git a/crates/ruff_linter/src/rules/flake8_errmsg/snapshots/ruff_linter__rules__flake8_errmsg__tests__custom.snap b/crates/ruff_linter/src/rules/flake8_errmsg/snapshots/ruff_linter__rules__flake8_errmsg__tests__custom.snap index 4cf1d5b919..9bde5dc7d7 100644 --- a/crates/ruff_linter/src/rules/flake8_errmsg/snapshots/ruff_linter__rules__flake8_errmsg__tests__custom.snap +++ b/crates/ruff_linter/src/rules/flake8_errmsg/snapshots/ruff_linter__rules__flake8_errmsg__tests__custom.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_errmsg/mod.rs --- -error[EM101]: EM.py:5:24: [*] Exception must not use a string literal, assign to variable first +error[EM101]: 5:24: [*] Exception must not use a string literal, assign to variable first + --> EM.py:5:24 | 4 | def f_a(): 5 | raise RuntimeError("This is an example exception") @@ -20,8 +21,9 @@ error[EM101]: EM.py:5:24: [*] Exception must not use a string literal, assign to 7 8 | 8 9 | def f_a_short(): -error[EM102]: EM.py:18:24: [*] Exception must not use an f-string literal, assign to variable first +error[EM102]: 18:24: [*] Exception must not use an f-string literal, assign to variable first + --> EM.py:18:24 | 16 | def f_b(): 17 | example = "example" @@ -40,8 +42,9 @@ error[EM102]: EM.py:18:24: [*] Exception must not use an f-string literal, assig 20 21 | 21 22 | def f_c(): -error[EM103]: EM.py:22:24: [*] Exception must not use a `.format()` string directly, assign to variable first +error[EM103]: 22:24: [*] Exception must not use a `.format()` string directly, assign to variable first + --> EM.py:22:24 | 21 | def f_c(): 22 | raise RuntimeError("This is an {example} exception".format(example="example")) @@ -59,8 +62,9 @@ error[EM103]: EM.py:22:24: [*] Exception must not use a `.format()` string direc 24 25 | 25 26 | def f_ok(): -error[EM101]: EM.py:32:24: [*] Exception must not use a string literal, assign to variable first +error[EM101]: 32:24: [*] Exception must not use a string literal, assign to variable first + --> EM.py:32:24 | 30 | def f_msg_defined(): 31 | msg = "hello" @@ -79,8 +83,9 @@ error[EM101]: EM.py:32:24: [*] Exception must not use a string literal, assign t 34 35 | 35 36 | def f_msg_in_nested_scope(): -error[EM101]: EM.py:39:24: [*] Exception must not use a string literal, assign to variable first +error[EM101]: 39:24: [*] Exception must not use a string literal, assign to variable first + --> EM.py:39:24 | 37 | msg = "hello" 38 | @@ -99,8 +104,9 @@ error[EM101]: EM.py:39:24: [*] Exception must not use a string literal, assign t 41 42 | 42 43 | def f_msg_in_parent_scope(): -error[EM101]: EM.py:46:28: [*] Exception must not use a string literal, assign to variable first +error[EM101]: 46:28: [*] Exception must not use a string literal, assign to variable first + --> EM.py:46:28 | 45 | def nested(): 46 | raise RuntimeError("This is an example exception") @@ -118,8 +124,9 @@ error[EM101]: EM.py:46:28: [*] Exception must not use a string literal, assign t 48 49 | 49 50 | def f_fix_indentation_check(foo): -error[EM101]: EM.py:51:28: [*] Exception must not use a string literal, assign to variable first +error[EM101]: 51:28: [*] Exception must not use a string literal, assign to variable first + --> EM.py:51:28 | 49 | def f_fix_indentation_check(foo): 50 | if foo: @@ -140,8 +147,9 @@ error[EM101]: EM.py:51:28: [*] Exception must not use a string literal, assign t 53 54 | if foo == "foo": 54 55 | raise RuntimeError(f"This is an exception: {foo}") -error[EM102]: EM.py:54:32: [*] Exception must not use an f-string literal, assign to variable first +error[EM102]: 54:32: [*] Exception must not use an f-string literal, assign to variable first + --> EM.py:54:32 | 52 | else: 53 | if foo == "foo": @@ -161,8 +169,9 @@ error[EM102]: EM.py:54:32: [*] Exception must not use an f-string literal, assig 56 57 | 57 58 | -error[EM103]: EM.py:55:24: [*] Exception must not use a `.format()` string directly, assign to variable first +error[EM103]: 55:24: [*] Exception must not use a `.format()` string directly, assign to variable first + --> EM.py:55:24 | 53 | if foo == "foo": 54 | raise RuntimeError(f"This is an exception: {foo}") @@ -181,8 +190,9 @@ error[EM103]: EM.py:55:24: [*] Exception must not use a `.format()` string direc 57 58 | 58 59 | # Report these, but don't fix them -error[EM101]: EM.py:59:28: Exception must not use a string literal, assign to variable first +error[EM101]: 59:28: Exception must not use a string literal, assign to variable first + --> EM.py:59:28 | 58 | # Report these, but don't fix them 59 | if foo: raise RuntimeError("This is an example exception") @@ -190,8 +200,9 @@ error[EM101]: EM.py:59:28: Exception must not use a string literal, assign to va 60 | if foo: x = 1; raise RuntimeError("This is an example exception") | = help: Assign to variable; remove string literal -error[EM101]: EM.py:60:35: Exception must not use a string literal, assign to variable first +error[EM101]: 60:35: Exception must not use a string literal, assign to variable first + --> EM.py:60:35 | 58 | # Report these, but don't fix them 59 | if foo: raise RuntimeError("This is an example exception") @@ -199,8 +210,9 @@ error[EM101]: EM.py:60:35: Exception must not use a string literal, assign to va | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: Assign to variable; remove string literal -error[EM102]: EM.py:64:24: [*] Exception must not use an f-string literal, assign to variable first +error[EM102]: 64:24: [*] Exception must not use an f-string literal, assign to variable first + --> EM.py:64:24 | 63 | def f_triple_quoted_string(): 64 | raise RuntimeError(f"""This is an {"example"} exception""") @@ -218,8 +230,9 @@ error[EM102]: EM.py:64:24: [*] Exception must not use an f-string literal, assig 66 67 | 67 68 | def f_multi_line_string(): -error[EM103]: EM.py:76:9: [*] Exception must not use a `.format()` string directly, assign to variable first +error[EM103]: 76:9: [*] Exception must not use a `.format()` string directly, assign to variable first + --> EM.py:76:9 | 74 | def f_multi_line_string2(): 75 | raise RuntimeError( @@ -248,8 +261,9 @@ error[EM103]: EM.py:76:9: [*] Exception must not use a `.format()` string direct 81 84 | 82 85 | def f_multi_line_string2(): -error[EM103]: EM.py:84:9: [*] Exception must not use a `.format()` string directly, assign to variable first +error[EM103]: 84:9: [*] Exception must not use a `.format()` string directly, assign to variable first + --> EM.py:84:9 | 82 | def f_multi_line_string2(): 83 | raise RuntimeError( diff --git a/crates/ruff_linter/src/rules/flake8_errmsg/snapshots/ruff_linter__rules__flake8_errmsg__tests__defaults.snap b/crates/ruff_linter/src/rules/flake8_errmsg/snapshots/ruff_linter__rules__flake8_errmsg__tests__defaults.snap index 9bb94d5e50..c3294d5142 100644 --- a/crates/ruff_linter/src/rules/flake8_errmsg/snapshots/ruff_linter__rules__flake8_errmsg__tests__defaults.snap +++ b/crates/ruff_linter/src/rules/flake8_errmsg/snapshots/ruff_linter__rules__flake8_errmsg__tests__defaults.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_errmsg/mod.rs --- -error[EM101]: EM.py:5:24: [*] Exception must not use a string literal, assign to variable first +error[EM101]: 5:24: [*] Exception must not use a string literal, assign to variable first + --> EM.py:5:24 | 4 | def f_a(): 5 | raise RuntimeError("This is an example exception") @@ -20,8 +21,9 @@ error[EM101]: EM.py:5:24: [*] Exception must not use a string literal, assign to 7 8 | 8 9 | def f_a_short(): -error[EM101]: EM.py:9:24: [*] Exception must not use a string literal, assign to variable first +error[EM101]: 9:24: [*] Exception must not use a string literal, assign to variable first + --> EM.py:9:24 | 8 | def f_a_short(): 9 | raise RuntimeError("Error") @@ -39,8 +41,9 @@ error[EM101]: EM.py:9:24: [*] Exception must not use a string literal, assign to 11 12 | 12 13 | def f_a_empty(): -error[EM101]: EM.py:13:24: [*] Exception must not use a string literal, assign to variable first +error[EM101]: 13:24: [*] Exception must not use a string literal, assign to variable first + --> EM.py:13:24 | 12 | def f_a_empty(): 13 | raise RuntimeError("") @@ -58,8 +61,9 @@ error[EM101]: EM.py:13:24: [*] Exception must not use a string literal, assign t 15 16 | 16 17 | def f_b(): -error[EM102]: EM.py:18:24: [*] Exception must not use an f-string literal, assign to variable first +error[EM102]: 18:24: [*] Exception must not use an f-string literal, assign to variable first + --> EM.py:18:24 | 16 | def f_b(): 17 | example = "example" @@ -78,8 +82,9 @@ error[EM102]: EM.py:18:24: [*] Exception must not use an f-string literal, assig 20 21 | 21 22 | def f_c(): -error[EM103]: EM.py:22:24: [*] Exception must not use a `.format()` string directly, assign to variable first +error[EM103]: 22:24: [*] Exception must not use a `.format()` string directly, assign to variable first + --> EM.py:22:24 | 21 | def f_c(): 22 | raise RuntimeError("This is an {example} exception".format(example="example")) @@ -97,8 +102,9 @@ error[EM103]: EM.py:22:24: [*] Exception must not use a `.format()` string direc 24 25 | 25 26 | def f_ok(): -error[EM101]: EM.py:32:24: [*] Exception must not use a string literal, assign to variable first +error[EM101]: 32:24: [*] Exception must not use a string literal, assign to variable first + --> EM.py:32:24 | 30 | def f_msg_defined(): 31 | msg = "hello" @@ -117,8 +123,9 @@ error[EM101]: EM.py:32:24: [*] Exception must not use a string literal, assign t 34 35 | 35 36 | def f_msg_in_nested_scope(): -error[EM101]: EM.py:39:24: [*] Exception must not use a string literal, assign to variable first +error[EM101]: 39:24: [*] Exception must not use a string literal, assign to variable first + --> EM.py:39:24 | 37 | msg = "hello" 38 | @@ -137,8 +144,9 @@ error[EM101]: EM.py:39:24: [*] Exception must not use a string literal, assign t 41 42 | 42 43 | def f_msg_in_parent_scope(): -error[EM101]: EM.py:46:28: [*] Exception must not use a string literal, assign to variable first +error[EM101]: 46:28: [*] Exception must not use a string literal, assign to variable first + --> EM.py:46:28 | 45 | def nested(): 46 | raise RuntimeError("This is an example exception") @@ -156,8 +164,9 @@ error[EM101]: EM.py:46:28: [*] Exception must not use a string literal, assign t 48 49 | 49 50 | def f_fix_indentation_check(foo): -error[EM101]: EM.py:51:28: [*] Exception must not use a string literal, assign to variable first +error[EM101]: 51:28: [*] Exception must not use a string literal, assign to variable first + --> EM.py:51:28 | 49 | def f_fix_indentation_check(foo): 50 | if foo: @@ -178,8 +187,9 @@ error[EM101]: EM.py:51:28: [*] Exception must not use a string literal, assign t 53 54 | if foo == "foo": 54 55 | raise RuntimeError(f"This is an exception: {foo}") -error[EM102]: EM.py:54:32: [*] Exception must not use an f-string literal, assign to variable first +error[EM102]: 54:32: [*] Exception must not use an f-string literal, assign to variable first + --> EM.py:54:32 | 52 | else: 53 | if foo == "foo": @@ -199,8 +209,9 @@ error[EM102]: EM.py:54:32: [*] Exception must not use an f-string literal, assig 56 57 | 57 58 | -error[EM103]: EM.py:55:24: [*] Exception must not use a `.format()` string directly, assign to variable first +error[EM103]: 55:24: [*] Exception must not use a `.format()` string directly, assign to variable first + --> EM.py:55:24 | 53 | if foo == "foo": 54 | raise RuntimeError(f"This is an exception: {foo}") @@ -219,8 +230,9 @@ error[EM103]: EM.py:55:24: [*] Exception must not use a `.format()` string direc 57 58 | 58 59 | # Report these, but don't fix them -error[EM101]: EM.py:59:28: Exception must not use a string literal, assign to variable first +error[EM101]: 59:28: Exception must not use a string literal, assign to variable first + --> EM.py:59:28 | 58 | # Report these, but don't fix them 59 | if foo: raise RuntimeError("This is an example exception") @@ -228,8 +240,9 @@ error[EM101]: EM.py:59:28: Exception must not use a string literal, assign to va 60 | if foo: x = 1; raise RuntimeError("This is an example exception") | = help: Assign to variable; remove string literal -error[EM101]: EM.py:60:35: Exception must not use a string literal, assign to variable first +error[EM101]: 60:35: Exception must not use a string literal, assign to variable first + --> EM.py:60:35 | 58 | # Report these, but don't fix them 59 | if foo: raise RuntimeError("This is an example exception") @@ -237,8 +250,9 @@ error[EM101]: EM.py:60:35: Exception must not use a string literal, assign to va | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: Assign to variable; remove string literal -error[EM102]: EM.py:64:24: [*] Exception must not use an f-string literal, assign to variable first +error[EM102]: 64:24: [*] Exception must not use an f-string literal, assign to variable first + --> EM.py:64:24 | 63 | def f_triple_quoted_string(): 64 | raise RuntimeError(f"""This is an {"example"} exception""") @@ -256,8 +270,9 @@ error[EM102]: EM.py:64:24: [*] Exception must not use an f-string literal, assig 66 67 | 67 68 | def f_multi_line_string(): -error[EM101]: EM.py:69:9: [*] Exception must not use a string literal, assign to variable first +error[EM101]: 69:9: [*] Exception must not use a string literal, assign to variable first + --> EM.py:69:9 | 67 | def f_multi_line_string(): 68 | raise RuntimeError( @@ -284,8 +299,9 @@ error[EM101]: EM.py:69:9: [*] Exception must not use a string literal, assign to 73 76 | 74 77 | def f_multi_line_string2(): -error[EM103]: EM.py:76:9: [*] Exception must not use a `.format()` string directly, assign to variable first +error[EM103]: 76:9: [*] Exception must not use a `.format()` string directly, assign to variable first + --> EM.py:76:9 | 74 | def f_multi_line_string2(): 75 | raise RuntimeError( @@ -314,8 +330,9 @@ error[EM103]: EM.py:76:9: [*] Exception must not use a `.format()` string direct 81 84 | 82 85 | def f_multi_line_string2(): -error[EM103]: EM.py:84:9: [*] Exception must not use a `.format()` string directly, assign to variable first +error[EM103]: 84:9: [*] Exception must not use a `.format()` string directly, assign to variable first + --> EM.py:84:9 | 82 | def f_multi_line_string2(): 83 | raise RuntimeError( diff --git a/crates/ruff_linter/src/rules/flake8_executable/snapshots/ruff_linter__rules__flake8_executable__tests__EXE001_1.py.snap b/crates/ruff_linter/src/rules/flake8_executable/snapshots/ruff_linter__rules__flake8_executable__tests__EXE001_1.py.snap index 47d4717734..3650be1502 100644 --- a/crates/ruff_linter/src/rules/flake8_executable/snapshots/ruff_linter__rules__flake8_executable__tests__EXE001_1.py.snap +++ b/crates/ruff_linter/src/rules/flake8_executable/snapshots/ruff_linter__rules__flake8_executable__tests__EXE001_1.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_executable/mod.rs --- -error[EXE001]: EXE001_1.py:1:1: Shebang is present but file is not executable +error[EXE001]: 1:1: Shebang is present but file is not executable + --> EXE001_1.py:1:1 | 1 | #!/usr/bin/python | ^^^^^^^^^^^^^^^^^ diff --git a/crates/ruff_linter/src/rules/flake8_executable/snapshots/ruff_linter__rules__flake8_executable__tests__EXE002_1.py.snap b/crates/ruff_linter/src/rules/flake8_executable/snapshots/ruff_linter__rules__flake8_executable__tests__EXE002_1.py.snap index 122fcb2656..5c6739fa6e 100644 --- a/crates/ruff_linter/src/rules/flake8_executable/snapshots/ruff_linter__rules__flake8_executable__tests__EXE002_1.py.snap +++ b/crates/ruff_linter/src/rules/flake8_executable/snapshots/ruff_linter__rules__flake8_executable__tests__EXE002_1.py.snap @@ -1,4 +1,4 @@ --- source: crates/ruff_linter/src/rules/flake8_executable/mod.rs --- -EXE002_1.py:1:1: EXE002 The file is executable but no shebang is present +error[EXE002]: 1:1: The file is executable but no shebang is present diff --git a/crates/ruff_linter/src/rules/flake8_executable/snapshots/ruff_linter__rules__flake8_executable__tests__EXE003.py.snap b/crates/ruff_linter/src/rules/flake8_executable/snapshots/ruff_linter__rules__flake8_executable__tests__EXE003.py.snap index 830d19c84e..819c110f9e 100644 --- a/crates/ruff_linter/src/rules/flake8_executable/snapshots/ruff_linter__rules__flake8_executable__tests__EXE003.py.snap +++ b/crates/ruff_linter/src/rules/flake8_executable/snapshots/ruff_linter__rules__flake8_executable__tests__EXE003.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_executable/mod.rs --- -error[EXE003]: EXE003.py:1:1: Shebang should contain `python` +error[EXE003]: 1:1: Shebang should contain `python` + --> EXE003.py:1:1 | 1 | #!/usr/bin/bash | ^^^^^^^^^^^^^^^ diff --git a/crates/ruff_linter/src/rules/flake8_executable/snapshots/ruff_linter__rules__flake8_executable__tests__EXE004_1.py.snap b/crates/ruff_linter/src/rules/flake8_executable/snapshots/ruff_linter__rules__flake8_executable__tests__EXE004_1.py.snap index c7fb9934f2..5caf2f5bbe 100644 --- a/crates/ruff_linter/src/rules/flake8_executable/snapshots/ruff_linter__rules__flake8_executable__tests__EXE004_1.py.snap +++ b/crates/ruff_linter/src/rules/flake8_executable/snapshots/ruff_linter__rules__flake8_executable__tests__EXE004_1.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_executable/mod.rs --- -error[EXE004]: EXE004_1.py:1:1: [*] Avoid whitespace before shebang +error[EXE004]: 1:1: [*] Avoid whitespace before shebang + --> EXE004_1.py:1:1 | 1 | #!/usr/bin/python | ^^^^ diff --git a/crates/ruff_linter/src/rules/flake8_executable/snapshots/ruff_linter__rules__flake8_executable__tests__EXE004_3.py.snap b/crates/ruff_linter/src/rules/flake8_executable/snapshots/ruff_linter__rules__flake8_executable__tests__EXE004_3.py.snap index 40fc7ad00b..db4dd08e8a 100644 --- a/crates/ruff_linter/src/rules/flake8_executable/snapshots/ruff_linter__rules__flake8_executable__tests__EXE004_3.py.snap +++ b/crates/ruff_linter/src/rules/flake8_executable/snapshots/ruff_linter__rules__flake8_executable__tests__EXE004_3.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_executable/mod.rs --- -error[EXE005]: EXE004_3.py:2:7: Shebang should be at the beginning of the file +error[EXE005]: 2:7: Shebang should be at the beginning of the file + --> EXE004_3.py:2:7 | 2 | pass #!/usr/bin/env python | ^^^^^^^^^^^^^^^^^^^^^ diff --git a/crates/ruff_linter/src/rules/flake8_executable/snapshots/ruff_linter__rules__flake8_executable__tests__EXE004_4.py.snap b/crates/ruff_linter/src/rules/flake8_executable/snapshots/ruff_linter__rules__flake8_executable__tests__EXE004_4.py.snap index 86c27e4c4b..613e89c354 100644 --- a/crates/ruff_linter/src/rules/flake8_executable/snapshots/ruff_linter__rules__flake8_executable__tests__EXE004_4.py.snap +++ b/crates/ruff_linter/src/rules/flake8_executable/snapshots/ruff_linter__rules__flake8_executable__tests__EXE004_4.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_executable/mod.rs --- -error[EXE004]: EXE004_4.py:1:1: [*] Avoid whitespace before shebang +error[EXE004]: 1:1: [*] Avoid whitespace before shebang + --> EXE004_4.py:1:1 | 1 | / 2 | | #!/usr/bin/env python diff --git a/crates/ruff_linter/src/rules/flake8_executable/snapshots/ruff_linter__rules__flake8_executable__tests__EXE005_1.py.snap b/crates/ruff_linter/src/rules/flake8_executable/snapshots/ruff_linter__rules__flake8_executable__tests__EXE005_1.py.snap index 28f2c22d46..987ed64b7c 100644 --- a/crates/ruff_linter/src/rules/flake8_executable/snapshots/ruff_linter__rules__flake8_executable__tests__EXE005_1.py.snap +++ b/crates/ruff_linter/src/rules/flake8_executable/snapshots/ruff_linter__rules__flake8_executable__tests__EXE005_1.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_executable/mod.rs --- -error[EXE005]: EXE005_1.py:3:1: Shebang should be at the beginning of the file +error[EXE005]: 3:1: Shebang should be at the beginning of the file + --> EXE005_1.py:2:19 | 2 | # A python comment 3 | #!/usr/bin/python diff --git a/crates/ruff_linter/src/rules/flake8_executable/snapshots/ruff_linter__rules__flake8_executable__tests__EXE005_2.py.snap b/crates/ruff_linter/src/rules/flake8_executable/snapshots/ruff_linter__rules__flake8_executable__tests__EXE005_2.py.snap index 398725a531..533af3e24d 100644 --- a/crates/ruff_linter/src/rules/flake8_executable/snapshots/ruff_linter__rules__flake8_executable__tests__EXE005_2.py.snap +++ b/crates/ruff_linter/src/rules/flake8_executable/snapshots/ruff_linter__rules__flake8_executable__tests__EXE005_2.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_executable/mod.rs --- -error[EXE005]: EXE005_2.py:4:1: Shebang should be at the beginning of the file +error[EXE005]: 4:1: Shebang should be at the beginning of the file + --> EXE005_2.py:3:19 | 3 | # A python comment 4 | #!/usr/bin/python diff --git a/crates/ruff_linter/src/rules/flake8_executable/snapshots/ruff_linter__rules__flake8_executable__tests__EXE005_3.py.snap b/crates/ruff_linter/src/rules/flake8_executable/snapshots/ruff_linter__rules__flake8_executable__tests__EXE005_3.py.snap index f4277000ce..e96fb29ac9 100644 --- a/crates/ruff_linter/src/rules/flake8_executable/snapshots/ruff_linter__rules__flake8_executable__tests__EXE005_3.py.snap +++ b/crates/ruff_linter/src/rules/flake8_executable/snapshots/ruff_linter__rules__flake8_executable__tests__EXE005_3.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_executable/mod.rs --- -error[EXE005]: EXE005_3.py:6:1: Shebang should be at the beginning of the file +error[EXE005]: 6:1: Shebang should be at the beginning of the file + --> EXE005_3.py:5:19 | 4 | """ 5 | # A python comment diff --git a/crates/ruff_linter/src/rules/flake8_fixme/snapshots/ruff_linter__rules__flake8_fixme__tests__line-contains-fixme_T00.py.snap b/crates/ruff_linter/src/rules/flake8_fixme/snapshots/ruff_linter__rules__flake8_fixme__tests__line-contains-fixme_T00.py.snap index 4ebf7a6c9e..c394094ad3 100644 --- a/crates/ruff_linter/src/rules/flake8_fixme/snapshots/ruff_linter__rules__flake8_fixme__tests__line-contains-fixme_T00.py.snap +++ b/crates/ruff_linter/src/rules/flake8_fixme/snapshots/ruff_linter__rules__flake8_fixme__tests__line-contains-fixme_T00.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_fixme/mod.rs --- -error[FIX001]: T00.py:7:3: Line contains FIXME, consider resolving the issue +error[FIX001]: 7:3: Line contains FIXME, consider resolving the issue + --> T00.py:7:3 | 5 | # HACK: hack 6 | # hack: hack @@ -10,8 +11,9 @@ error[FIX001]: T00.py:7:3: Line contains FIXME, consider resolving the issue | ^^^^^ 8 | # fixme: fixme | -error[FIX001]: T00.py:8:3: Line contains FIXME, consider resolving the issue +error[FIX001]: 8:3: Line contains FIXME, consider resolving the issue + --> T00.py:8:3 | 6 | # hack: hack 7 | # FIXME: fixme diff --git a/crates/ruff_linter/src/rules/flake8_fixme/snapshots/ruff_linter__rules__flake8_fixme__tests__line-contains-hack_T00.py.snap b/crates/ruff_linter/src/rules/flake8_fixme/snapshots/ruff_linter__rules__flake8_fixme__tests__line-contains-hack_T00.py.snap index d2acdf3e81..5dc4b362b5 100644 --- a/crates/ruff_linter/src/rules/flake8_fixme/snapshots/ruff_linter__rules__flake8_fixme__tests__line-contains-hack_T00.py.snap +++ b/crates/ruff_linter/src/rules/flake8_fixme/snapshots/ruff_linter__rules__flake8_fixme__tests__line-contains-hack_T00.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_fixme/mod.rs --- -error[FIX004]: T00.py:5:3: Line contains HACK, consider resolving the issue +error[FIX004]: 5:3: Line contains HACK, consider resolving the issue + --> T00.py:5:3 | 3 | # XXX: xxx 4 | # xxx: xxx @@ -11,8 +12,9 @@ error[FIX004]: T00.py:5:3: Line contains HACK, consider resolving the issue 6 | # hack: hack 7 | # FIXME: fixme | -error[FIX004]: T00.py:6:3: Line contains HACK, consider resolving the issue +error[FIX004]: 6:3: Line contains HACK, consider resolving the issue + --> T00.py:6:3 | 4 | # xxx: xxx 5 | # HACK: hack diff --git a/crates/ruff_linter/src/rules/flake8_fixme/snapshots/ruff_linter__rules__flake8_fixme__tests__line-contains-todo_T00.py.snap b/crates/ruff_linter/src/rules/flake8_fixme/snapshots/ruff_linter__rules__flake8_fixme__tests__line-contains-todo_T00.py.snap index d5aca22d23..f4bd87040c 100644 --- a/crates/ruff_linter/src/rules/flake8_fixme/snapshots/ruff_linter__rules__flake8_fixme__tests__line-contains-todo_T00.py.snap +++ b/crates/ruff_linter/src/rules/flake8_fixme/snapshots/ruff_linter__rules__flake8_fixme__tests__line-contains-todo_T00.py.snap @@ -1,16 +1,18 @@ --- source: crates/ruff_linter/src/rules/flake8_fixme/mod.rs --- -error[FIX002]: T00.py:1:3: Line contains TODO, consider resolving the issue +error[FIX002]: 1:3: Line contains TODO, consider resolving the issue + --> T00.py:1:3 | 1 | # TODO: todo | ^^^^ 2 | # todo: todo 3 | # XXX: xxx | -error[FIX002]: T00.py:2:3: Line contains TODO, consider resolving the issue +error[FIX002]: 2:3: Line contains TODO, consider resolving the issue + --> T00.py:2:3 | 1 | # TODO: todo 2 | # todo: todo diff --git a/crates/ruff_linter/src/rules/flake8_fixme/snapshots/ruff_linter__rules__flake8_fixme__tests__line-contains-xxx_T00.py.snap b/crates/ruff_linter/src/rules/flake8_fixme/snapshots/ruff_linter__rules__flake8_fixme__tests__line-contains-xxx_T00.py.snap index f3875f826d..90da930e97 100644 --- a/crates/ruff_linter/src/rules/flake8_fixme/snapshots/ruff_linter__rules__flake8_fixme__tests__line-contains-xxx_T00.py.snap +++ b/crates/ruff_linter/src/rules/flake8_fixme/snapshots/ruff_linter__rules__flake8_fixme__tests__line-contains-xxx_T00.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_fixme/mod.rs --- -error[FIX003]: T00.py:3:3: Line contains XXX, consider resolving the issue +error[FIX003]: 3:3: Line contains XXX, consider resolving the issue + --> T00.py:3:3 | 1 | # TODO: todo 2 | # todo: todo @@ -11,8 +12,9 @@ error[FIX003]: T00.py:3:3: Line contains XXX, consider resolving the issue 4 | # xxx: xxx 5 | # HACK: hack | -error[FIX003]: T00.py:4:3: Line contains XXX, consider resolving the issue +error[FIX003]: 4:3: Line contains XXX, consider resolving the issue + --> T00.py:4:3 | 2 | # todo: todo 3 | # XXX: xxx diff --git a/crates/ruff_linter/src/rules/flake8_future_annotations/snapshots/ruff_linter__rules__flake8_future_annotations__tests__edge_case.py.snap b/crates/ruff_linter/src/rules/flake8_future_annotations/snapshots/ruff_linter__rules__flake8_future_annotations__tests__edge_case.py.snap index 65749f54d5..65fca274b4 100644 --- a/crates/ruff_linter/src/rules/flake8_future_annotations/snapshots/ruff_linter__rules__flake8_future_annotations__tests__edge_case.py.snap +++ b/crates/ruff_linter/src/rules/flake8_future_annotations/snapshots/ruff_linter__rules__flake8_future_annotations__tests__edge_case.py.snap @@ -1,16 +1,18 @@ --- source: crates/ruff_linter/src/rules/flake8_future_annotations/mod.rs --- -error[FA100]: edge_case.py:5:13: Add `from __future__ import annotations` to simplify `typing.List` +error[FA100]: 5:13: Add `from __future__ import annotations` to simplify `typing.List` + --> edge_case.py:5:13 | 5 | def main(_: List[int]) -> None: | ^^^^ 6 | a_list: t.List[str] = [] 7 | a_list.append("hello") | -error[FA100]: edge_case.py:6:13: Add `from __future__ import annotations` to simplify `typing.List` +error[FA100]: 6:13: Add `from __future__ import annotations` to simplify `typing.List` + --> edge_case.py:6:13 | 5 | def main(_: List[int]) -> None: 6 | a_list: t.List[str] = [] diff --git a/crates/ruff_linter/src/rules/flake8_future_annotations/snapshots/ruff_linter__rules__flake8_future_annotations__tests__fa102_no_future_import_uses_lowercase.py.snap b/crates/ruff_linter/src/rules/flake8_future_annotations/snapshots/ruff_linter__rules__flake8_future_annotations__tests__fa102_no_future_import_uses_lowercase.py.snap index b773edf1fd..6558b0bd67 100644 --- a/crates/ruff_linter/src/rules/flake8_future_annotations/snapshots/ruff_linter__rules__flake8_future_annotations__tests__fa102_no_future_import_uses_lowercase.py.snap +++ b/crates/ruff_linter/src/rules/flake8_future_annotations/snapshots/ruff_linter__rules__flake8_future_annotations__tests__fa102_no_future_import_uses_lowercase.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_future_annotations/mod.rs --- -error[FA102]: no_future_import_uses_lowercase.py:6:14: [*] Missing `from __future__ import annotations`, but uses PEP 585 collection +error[FA102]: 6:14: [*] Missing `from __future__ import annotations`, but uses PEP 585 collection + --> no_future_import_uses_lowercase.py:6:14 | 6 | def hello(y: dict[str, int]) -> None: | ^^^^^^^^^^^^^^ diff --git a/crates/ruff_linter/src/rules/flake8_future_annotations/snapshots/ruff_linter__rules__flake8_future_annotations__tests__fa102_no_future_import_uses_union.py.snap b/crates/ruff_linter/src/rules/flake8_future_annotations/snapshots/ruff_linter__rules__flake8_future_annotations__tests__fa102_no_future_import_uses_union.py.snap index 5e26b0c38e..58fd0a0749 100644 --- a/crates/ruff_linter/src/rules/flake8_future_annotations/snapshots/ruff_linter__rules__flake8_future_annotations__tests__fa102_no_future_import_uses_union.py.snap +++ b/crates/ruff_linter/src/rules/flake8_future_annotations/snapshots/ruff_linter__rules__flake8_future_annotations__tests__fa102_no_future_import_uses_union.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_future_annotations/mod.rs --- -error[FA102]: no_future_import_uses_union.py:6:14: [*] Missing `from __future__ import annotations`, but uses PEP 585 collection +error[FA102]: 6:14: [*] Missing `from __future__ import annotations`, but uses PEP 585 collection + --> no_future_import_uses_union.py:6:14 | 6 | def hello(y: dict[str, int] | None) -> None: | ^^^^^^^^^^^^^^ @@ -15,8 +16,9 @@ error[FA102]: no_future_import_uses_union.py:6:14: [*] Missing `from __future__ 2 3 | a_list: list[str] | None = [] 3 4 | a_list.append("hello") -error[FA102]: no_future_import_uses_union.py:6:14: [*] Missing `from __future__ import annotations`, but uses PEP 604 union +error[FA102]: 6:14: [*] Missing `from __future__ import annotations`, but uses PEP 604 union + --> no_future_import_uses_union.py:6:14 | 6 | def hello(y: dict[str, int] | None) -> None: | ^^^^^^^^^^^^^^^^^^^^^ diff --git a/crates/ruff_linter/src/rules/flake8_future_annotations/snapshots/ruff_linter__rules__flake8_future_annotations__tests__fa102_no_future_import_uses_union_inner.py.snap b/crates/ruff_linter/src/rules/flake8_future_annotations/snapshots/ruff_linter__rules__flake8_future_annotations__tests__fa102_no_future_import_uses_union_inner.py.snap index d025789fb3..fbc44b44a0 100644 --- a/crates/ruff_linter/src/rules/flake8_future_annotations/snapshots/ruff_linter__rules__flake8_future_annotations__tests__fa102_no_future_import_uses_union_inner.py.snap +++ b/crates/ruff_linter/src/rules/flake8_future_annotations/snapshots/ruff_linter__rules__flake8_future_annotations__tests__fa102_no_future_import_uses_union_inner.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_future_annotations/mod.rs --- -error[FA102]: no_future_import_uses_union_inner.py:6:14: [*] Missing `from __future__ import annotations`, but uses PEP 585 collection +error[FA102]: 6:14: [*] Missing `from __future__ import annotations`, but uses PEP 585 collection + --> no_future_import_uses_union_inner.py:6:14 | 6 | def hello(y: dict[str | None, int]) -> None: | ^^^^^^^^^^^^^^^^^^^^^ @@ -16,8 +17,9 @@ error[FA102]: no_future_import_uses_union_inner.py:6:14: [*] Missing `from __fut 2 3 | a_list: list[str | None] = [] 3 4 | a_list.append("hello") -error[FA102]: no_future_import_uses_union_inner.py:6:19: [*] Missing `from __future__ import annotations`, but uses PEP 604 union +error[FA102]: 6:19: [*] Missing `from __future__ import annotations`, but uses PEP 604 union + --> no_future_import_uses_union_inner.py:6:19 | 6 | def hello(y: dict[str | None, int]) -> None: | ^^^^^^^^^^ diff --git a/crates/ruff_linter/src/rules/flake8_future_annotations/snapshots/ruff_linter__rules__flake8_future_annotations__tests__from_typing_import.py.snap b/crates/ruff_linter/src/rules/flake8_future_annotations/snapshots/ruff_linter__rules__flake8_future_annotations__tests__from_typing_import.py.snap index 5c390a3037..a7600a4302 100644 --- a/crates/ruff_linter/src/rules/flake8_future_annotations/snapshots/ruff_linter__rules__flake8_future_annotations__tests__from_typing_import.py.snap +++ b/crates/ruff_linter/src/rules/flake8_future_annotations/snapshots/ruff_linter__rules__flake8_future_annotations__tests__from_typing_import.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_future_annotations/mod.rs --- -error[FA100]: from_typing_import.py:5:13: Add `from __future__ import annotations` to simplify `typing.List` +error[FA100]: 5:13: Add `from __future__ import annotations` to simplify `typing.List` + --> from_typing_import.py:5:13 | 4 | def main() -> None: 5 | a_list: List[str] = [] diff --git a/crates/ruff_linter/src/rules/flake8_future_annotations/snapshots/ruff_linter__rules__flake8_future_annotations__tests__from_typing_import_many.py.snap b/crates/ruff_linter/src/rules/flake8_future_annotations/snapshots/ruff_linter__rules__flake8_future_annotations__tests__from_typing_import_many.py.snap index b0591c4e97..9335de456f 100644 --- a/crates/ruff_linter/src/rules/flake8_future_annotations/snapshots/ruff_linter__rules__flake8_future_annotations__tests__from_typing_import_many.py.snap +++ b/crates/ruff_linter/src/rules/flake8_future_annotations/snapshots/ruff_linter__rules__flake8_future_annotations__tests__from_typing_import_many.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_future_annotations/mod.rs --- -error[FA100]: from_typing_import_many.py:5:13: Add `from __future__ import annotations` to simplify `typing.List` +error[FA100]: 5:13: Add `from __future__ import annotations` to simplify `typing.List` + --> from_typing_import_many.py:5:13 | 4 | def main() -> None: 5 | a_list: List[Optional[str]] = [] @@ -10,8 +11,9 @@ error[FA100]: from_typing_import_many.py:5:13: Add `from __future__ import annot 6 | a_list.append("hello") 7 | a_dict = cast(Dict[int | None, Union[int, Set[bool]]], {}) | -error[FA100]: from_typing_import_many.py:5:18: Add `from __future__ import annotations` to simplify `typing.Optional` +error[FA100]: 5:18: Add `from __future__ import annotations` to simplify `typing.Optional` + --> from_typing_import_many.py:5:18 | 4 | def main() -> None: 5 | a_list: List[Optional[str]] = [] diff --git a/crates/ruff_linter/src/rules/flake8_future_annotations/snapshots/ruff_linter__rules__flake8_future_annotations__tests__import_typing.py.snap b/crates/ruff_linter/src/rules/flake8_future_annotations/snapshots/ruff_linter__rules__flake8_future_annotations__tests__import_typing.py.snap index 28288a807b..f96bb36964 100644 --- a/crates/ruff_linter/src/rules/flake8_future_annotations/snapshots/ruff_linter__rules__flake8_future_annotations__tests__import_typing.py.snap +++ b/crates/ruff_linter/src/rules/flake8_future_annotations/snapshots/ruff_linter__rules__flake8_future_annotations__tests__import_typing.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_future_annotations/mod.rs --- -error[FA100]: import_typing.py:5:13: Add `from __future__ import annotations` to simplify `typing.List` +error[FA100]: 5:13: Add `from __future__ import annotations` to simplify `typing.List` + --> import_typing.py:5:13 | 4 | def main() -> None: 5 | a_list: typing.List[str] = [] diff --git a/crates/ruff_linter/src/rules/flake8_future_annotations/snapshots/ruff_linter__rules__flake8_future_annotations__tests__import_typing_as.py.snap b/crates/ruff_linter/src/rules/flake8_future_annotations/snapshots/ruff_linter__rules__flake8_future_annotations__tests__import_typing_as.py.snap index a8eb5798a2..7e11c8eef8 100644 --- a/crates/ruff_linter/src/rules/flake8_future_annotations/snapshots/ruff_linter__rules__flake8_future_annotations__tests__import_typing_as.py.snap +++ b/crates/ruff_linter/src/rules/flake8_future_annotations/snapshots/ruff_linter__rules__flake8_future_annotations__tests__import_typing_as.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_future_annotations/mod.rs --- -error[FA100]: import_typing_as.py:5:13: Add `from __future__ import annotations` to simplify `typing.List` +error[FA100]: 5:13: Add `from __future__ import annotations` to simplify `typing.List` + --> import_typing_as.py:5:13 | 4 | def main() -> None: 5 | a_list: t.List[str] = [] diff --git a/crates/ruff_linter/src/rules/flake8_gettext/snapshots/ruff_linter__rules__flake8_gettext__tests__f-string-in-get-text-func-call_INT001.py.snap b/crates/ruff_linter/src/rules/flake8_gettext/snapshots/ruff_linter__rules__flake8_gettext__tests__f-string-in-get-text-func-call_INT001.py.snap index f3b76fa2f0..7923e49cb4 100644 --- a/crates/ruff_linter/src/rules/flake8_gettext/snapshots/ruff_linter__rules__flake8_gettext__tests__f-string-in-get-text-func-call_INT001.py.snap +++ b/crates/ruff_linter/src/rules/flake8_gettext/snapshots/ruff_linter__rules__flake8_gettext__tests__f-string-in-get-text-func-call_INT001.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_gettext/mod.rs --- -error[INT001]: INT001.py:1:3: f-string is resolved before function call; consider `_("string %s") % arg` +error[INT001]: 1:3: f-string is resolved before function call; consider `_("string %s") % arg` + --> INT001.py:1:3 | 1 | _(f"{'value'}") | ^^^^^^^^^^^^ diff --git a/crates/ruff_linter/src/rules/flake8_gettext/snapshots/ruff_linter__rules__flake8_gettext__tests__format-in-get-text-func-call_INT002.py.snap b/crates/ruff_linter/src/rules/flake8_gettext/snapshots/ruff_linter__rules__flake8_gettext__tests__format-in-get-text-func-call_INT002.py.snap index 7b3806accd..ebb8b39415 100644 --- a/crates/ruff_linter/src/rules/flake8_gettext/snapshots/ruff_linter__rules__flake8_gettext__tests__format-in-get-text-func-call_INT002.py.snap +++ b/crates/ruff_linter/src/rules/flake8_gettext/snapshots/ruff_linter__rules__flake8_gettext__tests__format-in-get-text-func-call_INT002.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_gettext/mod.rs --- -error[INT002]: INT002.py:1:3: `format` method argument is resolved before function call; consider `_("string %s") % arg` +error[INT002]: 1:3: `format` method argument is resolved before function call; consider `_("string %s") % arg` + --> INT002.py:1:3 | 1 | _("{}".format("line")) | ^^^^^^^^^^^^^^^^^^^ diff --git a/crates/ruff_linter/src/rules/flake8_gettext/snapshots/ruff_linter__rules__flake8_gettext__tests__printf-in-get-text-func-call_INT003.py.snap b/crates/ruff_linter/src/rules/flake8_gettext/snapshots/ruff_linter__rules__flake8_gettext__tests__printf-in-get-text-func-call_INT003.py.snap index ef3aae8386..ad23ef559d 100644 --- a/crates/ruff_linter/src/rules/flake8_gettext/snapshots/ruff_linter__rules__flake8_gettext__tests__printf-in-get-text-func-call_INT003.py.snap +++ b/crates/ruff_linter/src/rules/flake8_gettext/snapshots/ruff_linter__rules__flake8_gettext__tests__printf-in-get-text-func-call_INT003.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_gettext/mod.rs --- -error[INT003]: INT003.py:1:3: printf-style format is resolved before function call; consider `_("string %s") % arg` +error[INT003]: 1:3: printf-style format is resolved before function call; consider `_("string %s") % arg` + --> INT003.py:1:3 | 1 | _("%s" % "line") | ^^^^^^^^^^^^^ diff --git a/crates/ruff_linter/src/rules/flake8_implicit_str_concat/snapshots/ruff_linter__rules__flake8_implicit_str_concat__tests__ISC001_ISC.py.snap b/crates/ruff_linter/src/rules/flake8_implicit_str_concat/snapshots/ruff_linter__rules__flake8_implicit_str_concat__tests__ISC001_ISC.py.snap index 3cb4fccc66..522b6acc53 100644 --- a/crates/ruff_linter/src/rules/flake8_implicit_str_concat/snapshots/ruff_linter__rules__flake8_implicit_str_concat__tests__ISC001_ISC.py.snap +++ b/crates/ruff_linter/src/rules/flake8_implicit_str_concat/snapshots/ruff_linter__rules__flake8_implicit_str_concat__tests__ISC001_ISC.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_implicit_str_concat/mod.rs --- -error[ISC001]: ISC.py:1:5: [*] Implicitly concatenated string literals on one line +error[ISC001]: 1:5: [*] Implicitly concatenated string literals on one line + --> ISC.py:1:5 | 1 | _ = "a" "b" "c" | ^^^^^^^ @@ -17,8 +18,9 @@ error[ISC001]: ISC.py:1:5: [*] Implicitly concatenated string literals on one li 3 3 | _ = "abc" + "def" 4 4 | -error[ISC001]: ISC.py:1:9: [*] Implicitly concatenated string literals on one line +error[ISC001]: 1:9: [*] Implicitly concatenated string literals on one line + --> ISC.py:1:9 | 1 | _ = "a" "b" "c" | ^^^^^^^ @@ -33,8 +35,9 @@ error[ISC001]: ISC.py:1:9: [*] Implicitly concatenated string literals on one li 3 3 | _ = "abc" + "def" 4 4 | -error[ISC001]: ISC.py:38:5: [*] Implicitly concatenated string literals on one line +error[ISC001]: 38:5: [*] Implicitly concatenated string literals on one line + --> ISC.py:38:5 | 36 | ) 37 | @@ -54,8 +57,9 @@ error[ISC001]: ISC.py:38:5: [*] Implicitly concatenated string literals on one l 40 40 | _ = """a 41 41 | b""" """c -error[ISC001]: ISC.py:40:5: [*] Implicitly concatenated string literals on one line +error[ISC001]: 40:5: [*] Implicitly concatenated string literals on one line + --> ISC.py:40:5 | 38 | _ = """a""" """b""" 39 | @@ -78,8 +82,9 @@ error[ISC001]: ISC.py:40:5: [*] Implicitly concatenated string literals on one l 43 43 | 44 44 | _ = f"""a""" f"""b""" -error[ISC001]: ISC.py:44:5: [*] Implicitly concatenated string literals on one line +error[ISC001]: 44:5: [*] Implicitly concatenated string literals on one line + --> ISC.py:44:5 | 42 | d""" 43 | @@ -99,8 +104,9 @@ error[ISC001]: ISC.py:44:5: [*] Implicitly concatenated string literals on one l 46 46 | _ = f"a" "b" 47 47 | -error[ISC001]: ISC.py:46:5: Implicitly concatenated string literals on one line +error[ISC001]: 46:5: Implicitly concatenated string literals on one line + --> ISC.py:46:5 | 44 | _ = f"""a""" f"""b""" 45 | @@ -110,8 +116,9 @@ error[ISC001]: ISC.py:46:5: Implicitly concatenated string literals on one line 48 | _ = """a""" "b" | = help: Combine string literals -error[ISC001]: ISC.py:48:5: Implicitly concatenated string literals on one line +error[ISC001]: 48:5: Implicitly concatenated string literals on one line + --> ISC.py:48:5 | 46 | _ = f"a" "b" 47 | @@ -121,8 +128,9 @@ error[ISC001]: ISC.py:48:5: Implicitly concatenated string literals on one line 50 | _ = 'a' "b" | = help: Combine string literals -error[ISC001]: ISC.py:50:5: Implicitly concatenated string literals on one line +error[ISC001]: 50:5: Implicitly concatenated string literals on one line + --> ISC.py:50:5 | 48 | _ = """a""" "b" 49 | @@ -132,8 +140,9 @@ error[ISC001]: ISC.py:50:5: Implicitly concatenated string literals on one line 52 | _ = rf"a" rf"b" | = help: Combine string literals -error[ISC001]: ISC.py:52:5: [*] Implicitly concatenated string literals on one line +error[ISC001]: 52:5: [*] Implicitly concatenated string literals on one line + --> ISC.py:52:5 | 50 | _ = 'a' "b" 51 | @@ -153,8 +162,9 @@ error[ISC001]: ISC.py:52:5: [*] Implicitly concatenated string literals on one l 54 54 | # Single-line explicit concatenation should be ignored. 55 55 | _ = "abc" + "def" + "ghi" -error[ISC001]: ISC.py:64:10: [*] Implicitly concatenated string literals on one line +error[ISC001]: 64:10: [*] Implicitly concatenated string literals on one line + --> ISC.py:64:10 | 63 | # Multiple strings nested inside a f-string 64 | _ = f"a {'b' 'c' 'd'} e" @@ -173,8 +183,9 @@ error[ISC001]: ISC.py:64:10: [*] Implicitly concatenated string literals on one 66 66 | _ = f"""abc { 67 67 | "def" -error[ISC001]: ISC.py:64:14: [*] Implicitly concatenated string literals on one line +error[ISC001]: 64:14: [*] Implicitly concatenated string literals on one line + --> ISC.py:64:14 | 63 | # Multiple strings nested inside a f-string 64 | _ = f"a {'b' 'c' 'd'} e" @@ -193,8 +204,9 @@ error[ISC001]: ISC.py:64:14: [*] Implicitly concatenated string literals on one 66 66 | _ = f"""abc { 67 67 | "def" -error[ISC001]: ISC.py:65:14: [*] Implicitly concatenated string literals on one line +error[ISC001]: 65:14: [*] Implicitly concatenated string literals on one line + --> ISC.py:65:14 | 63 | # Multiple strings nested inside a f-string 64 | _ = f"a {'b' 'c' 'd'} e" @@ -214,8 +226,9 @@ error[ISC001]: ISC.py:65:14: [*] Implicitly concatenated string literals on one 67 67 | "def" 68 68 | "ghi" -error[ISC001]: ISC.py:72:5: Implicitly concatenated string literals on one line +error[ISC001]: 72:5: Implicitly concatenated string literals on one line + --> ISC.py:72:5 | 71 | # Nested f-strings 72 | _ = "a" f"b {f"c" f"d"} e" "f" @@ -224,8 +237,9 @@ error[ISC001]: ISC.py:72:5: Implicitly concatenated string literals on one line 74 | _ = f"b {f"abc" \ | = help: Combine string literals -error[ISC001]: ISC.py:72:9: Implicitly concatenated string literals on one line +error[ISC001]: 72:9: Implicitly concatenated string literals on one line + --> ISC.py:72:9 | 71 | # Nested f-strings 72 | _ = "a" f"b {f"c" f"d"} e" "f" @@ -234,8 +248,9 @@ error[ISC001]: ISC.py:72:9: Implicitly concatenated string literals on one line 74 | _ = f"b {f"abc" \ | = help: Combine string literals -error[ISC001]: ISC.py:72:14: [*] Implicitly concatenated string literals on one line +error[ISC001]: 72:14: [*] Implicitly concatenated string literals on one line + --> ISC.py:72:14 | 71 | # Nested f-strings 72 | _ = "a" f"b {f"c" f"d"} e" "f" @@ -254,8 +269,9 @@ error[ISC001]: ISC.py:72:14: [*] Implicitly concatenated string literals on one 74 74 | _ = f"b {f"abc" \ 75 75 | f"def"} g" -error[ISC001]: ISC.py:73:10: [*] Implicitly concatenated string literals on one line +error[ISC001]: 73:10: [*] Implicitly concatenated string literals on one line + --> ISC.py:73:10 | 71 | # Nested f-strings 72 | _ = "a" f"b {f"c" f"d"} e" "f" @@ -275,8 +291,9 @@ error[ISC001]: ISC.py:73:10: [*] Implicitly concatenated string literals on one 75 75 | f"def"} g" 76 76 | -error[ISC001]: ISC.py:73:20: [*] Implicitly concatenated string literals on one line +error[ISC001]: 73:20: [*] Implicitly concatenated string literals on one line + --> ISC.py:73:20 | 71 | # Nested f-strings 72 | _ = "a" f"b {f"c" f"d"} e" "f" diff --git a/crates/ruff_linter/src/rules/flake8_implicit_str_concat/snapshots/ruff_linter__rules__flake8_implicit_str_concat__tests__ISC001_ISC_syntax_error.py.snap b/crates/ruff_linter/src/rules/flake8_implicit_str_concat/snapshots/ruff_linter__rules__flake8_implicit_str_concat__tests__ISC001_ISC_syntax_error.py.snap index 01fb083645..ef84c54d9a 100644 --- a/crates/ruff_linter/src/rules/flake8_implicit_str_concat/snapshots/ruff_linter__rules__flake8_implicit_str_concat__tests__ISC001_ISC_syntax_error.py.snap +++ b/crates/ruff_linter/src/rules/flake8_implicit_str_concat/snapshots/ruff_linter__rules__flake8_implicit_str_concat__tests__ISC001_ISC_syntax_error.py.snap @@ -1,7 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_implicit_str_concat/mod.rs --- -ISC_syntax_error.py:2:5: SyntaxError: missing closing quote in string literal +error[syntax-error]: 2:5: missing closing quote in string literal + + --> ISC_syntax_error.py:2:5 | 1 | # The lexer doesn't emit a string token if it's unterminated 2 | "a" "b @@ -9,8 +11,9 @@ ISC_syntax_error.py:2:5: SyntaxError: missing closing quote in string literal 3 | "a" "b" "c 4 | "a" """b | +error[syntax-error]: 2:7: Expected a statement -ISC_syntax_error.py:2:7: SyntaxError: Expected a statement + --> ISC_syntax_error.py:2:7 | 1 | # The lexer doesn't emit a string token if it's unterminated 2 | "a" "b @@ -19,19 +22,21 @@ ISC_syntax_error.py:2:7: SyntaxError: Expected a statement 4 | "a" """b 5 | c""" "d | +error[ISC001]: 3:1: Implicitly concatenated string literals on one line -ISC_syntax_error.py:3:1: ISC001 Implicitly concatenated string literals on one line + --> ISC_syntax_error.py:2:7 | 1 | # The lexer doesn't emit a string token if it's unterminated 2 | "a" "b 3 | "a" "b" "c - | ^^^^^^^ ISC001 + | ^^^^^^^ 4 | "a" """b 5 | c""" "d | = help: Combine string literals +error[syntax-error]: 3:9: missing closing quote in string literal -ISC_syntax_error.py:3:9: SyntaxError: missing closing quote in string literal + --> ISC_syntax_error.py:3:9 | 1 | # The lexer doesn't emit a string token if it's unterminated 2 | "a" "b @@ -40,8 +45,9 @@ ISC_syntax_error.py:3:9: SyntaxError: missing closing quote in string literal 4 | "a" """b 5 | c""" "d | +error[syntax-error]: 3:11: Expected a statement -ISC_syntax_error.py:3:11: SyntaxError: Expected a statement + --> ISC_syntax_error.py:3:11 | 1 | # The lexer doesn't emit a string token if it's unterminated 2 | "a" "b @@ -50,20 +56,22 @@ ISC_syntax_error.py:3:11: SyntaxError: Expected a statement 4 | "a" """b 5 | c""" "d | +error[ISC001]: 4:1: Implicitly concatenated string literals on one line -ISC_syntax_error.py:4:1: ISC001 Implicitly concatenated string literals on one line + --> ISC_syntax_error.py:3:11 | 2 | "a" "b 3 | "a" "b" "c 4 | / "a" """b 5 | | c""" "d - | |____^ ISC001 + | |____^ 6 | 7 | # For f-strings, the `FStringRanges` won't contain the range for | = help: Combine string literals +error[syntax-error]: 5:6: missing closing quote in string literal -ISC_syntax_error.py:5:6: SyntaxError: missing closing quote in string literal + --> ISC_syntax_error.py:5:6 | 3 | "a" "b" "c 4 | "a" """b @@ -72,8 +80,9 @@ ISC_syntax_error.py:5:6: SyntaxError: missing closing quote in string literal 6 | 7 | # For f-strings, the `FStringRanges` won't contain the range for | +error[syntax-error]: 5:8: Expected a statement -ISC_syntax_error.py:5:8: SyntaxError: Expected a statement + --> ISC_syntax_error.py:5:8 | 3 | "a" "b" "c 4 | "a" """b @@ -83,8 +92,9 @@ ISC_syntax_error.py:5:8: SyntaxError: Expected a statement 7 | # For f-strings, the `FStringRanges` won't contain the range for 8 | # unterminated f-strings. | +error[syntax-error]: 9:8: f-string: unterminated string -ISC_syntax_error.py:9:8: SyntaxError: f-string: unterminated string + --> ISC_syntax_error.py:9:8 | 7 | # For f-strings, the `FStringRanges` won't contain the range for 8 | # unterminated f-strings. @@ -93,8 +103,9 @@ ISC_syntax_error.py:9:8: SyntaxError: f-string: unterminated string 10 | f"a" f"b" f"c 11 | f"a" f"""b | +error[syntax-error]: 9:9: Expected FStringEnd, found newline -ISC_syntax_error.py:9:9: SyntaxError: Expected FStringEnd, found newline + --> ISC_syntax_error.py:9:9 | 7 | # For f-strings, the `FStringRanges` won't contain the range for 8 | # unterminated f-strings. @@ -104,19 +115,21 @@ ISC_syntax_error.py:9:9: SyntaxError: Expected FStringEnd, found newline 11 | f"a" f"""b 12 | c""" f"d {e | +error[ISC001]: 10:1: Implicitly concatenated string literals on one line -ISC_syntax_error.py:10:1: ISC001 Implicitly concatenated string literals on one line + --> ISC_syntax_error.py:9:9 | 8 | # unterminated f-strings. 9 | f"a" f"b 10 | f"a" f"b" f"c - | ^^^^^^^^^ ISC001 + | ^^^^^^^^^ 11 | f"a" f"""b 12 | c""" f"d {e | = help: Combine string literals +error[syntax-error]: 10:13: f-string: unterminated string -ISC_syntax_error.py:10:13: SyntaxError: f-string: unterminated string + --> ISC_syntax_error.py:10:13 | 8 | # unterminated f-strings. 9 | f"a" f"b @@ -125,8 +138,9 @@ ISC_syntax_error.py:10:13: SyntaxError: f-string: unterminated string 11 | f"a" f"""b 12 | c""" f"d {e | +error[syntax-error]: 10:14: Expected FStringEnd, found newline -ISC_syntax_error.py:10:14: SyntaxError: Expected FStringEnd, found newline + --> ISC_syntax_error.py:10:14 | 8 | # unterminated f-strings. 9 | f"a" f"b @@ -135,20 +149,22 @@ ISC_syntax_error.py:10:14: SyntaxError: Expected FStringEnd, found newline 11 | f"a" f"""b 12 | c""" f"d {e | +error[ISC001]: 11:1: Implicitly concatenated string literals on one line -ISC_syntax_error.py:11:1: ISC001 Implicitly concatenated string literals on one line + --> ISC_syntax_error.py:10:14 | 9 | f"a" f"b 10 | f"a" f"b" f"c 11 | / f"a" f"""b 12 | | c""" f"d {e - | |____^ ISC001 + | |____^ 13 | 14 | ( | = help: Combine string literals +error[syntax-error]: 16:5: missing closing quote in string literal -ISC_syntax_error.py:16:5: SyntaxError: missing closing quote in string literal + --> ISC_syntax_error.py:16:5 | 14 | ( 15 | "a" @@ -157,8 +173,9 @@ ISC_syntax_error.py:16:5: SyntaxError: missing closing quote in string literal 17 | "c" 18 | "d" | +error[syntax-error]: 26:9: f-string: unterminated triple-quoted string -ISC_syntax_error.py:26:9: SyntaxError: f-string: unterminated triple-quoted string + --> ISC_syntax_error.py:26:9 | 24 | ( 25 | """abc""" @@ -167,15 +184,19 @@ ISC_syntax_error.py:26:9: SyntaxError: f-string: unterminated triple-quoted stri 27 | "g" "h" 28 | "i" "j" | +error[syntax-error]: 30:1: unexpected EOF while parsing -ISC_syntax_error.py:30:1: SyntaxError: unexpected EOF while parsing + --> ISC_syntax_error.py:29:2 | 28 | "i" "j" 29 | ) + | ^ | +error[syntax-error]: 30:1: f-string: unterminated string -ISC_syntax_error.py:30:1: SyntaxError: f-string: unterminated string + --> ISC_syntax_error.py:29:2 | 28 | "i" "j" 29 | ) + | ^ | diff --git a/crates/ruff_linter/src/rules/flake8_implicit_str_concat/snapshots/ruff_linter__rules__flake8_implicit_str_concat__tests__ISC002_ISC.py.snap b/crates/ruff_linter/src/rules/flake8_implicit_str_concat/snapshots/ruff_linter__rules__flake8_implicit_str_concat__tests__ISC002_ISC.py.snap index 0f8a0646f5..4fefed280a 100644 --- a/crates/ruff_linter/src/rules/flake8_implicit_str_concat/snapshots/ruff_linter__rules__flake8_implicit_str_concat__tests__ISC002_ISC.py.snap +++ b/crates/ruff_linter/src/rules/flake8_implicit_str_concat/snapshots/ruff_linter__rules__flake8_implicit_str_concat__tests__ISC002_ISC.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_implicit_str_concat/mod.rs --- -error[ISC002]: ISC.py:5:5: Implicitly concatenated string literals over multiple lines +error[ISC002]: 5:5: Implicitly concatenated string literals over multiple lines + --> ISC.py:5:5 | 3 | _ = "abc" + "def" 4 | @@ -13,8 +14,9 @@ error[ISC002]: ISC.py:5:5: Implicitly concatenated string literals over multiple 7 | 8 | _ = ( | -error[ISC002]: ISC.py:74:10: Implicitly concatenated string literals over multiple lines +error[ISC002]: 74:10: Implicitly concatenated string literals over multiple lines + --> ISC.py:74:10 | 72 | _ = "a" f"b {f"c" f"d"} e" "f" 73 | _ = f"b {f"c" f"d {f"e" f"f"} g"} h" diff --git a/crates/ruff_linter/src/rules/flake8_implicit_str_concat/snapshots/ruff_linter__rules__flake8_implicit_str_concat__tests__ISC002_ISC_syntax_error.py.snap b/crates/ruff_linter/src/rules/flake8_implicit_str_concat/snapshots/ruff_linter__rules__flake8_implicit_str_concat__tests__ISC002_ISC_syntax_error.py.snap index c09ec34c0f..7462353da2 100644 --- a/crates/ruff_linter/src/rules/flake8_implicit_str_concat/snapshots/ruff_linter__rules__flake8_implicit_str_concat__tests__ISC002_ISC_syntax_error.py.snap +++ b/crates/ruff_linter/src/rules/flake8_implicit_str_concat/snapshots/ruff_linter__rules__flake8_implicit_str_concat__tests__ISC002_ISC_syntax_error.py.snap @@ -1,7 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_implicit_str_concat/mod.rs --- -ISC_syntax_error.py:2:5: SyntaxError: missing closing quote in string literal +error[syntax-error]: 2:5: missing closing quote in string literal + + --> ISC_syntax_error.py:2:5 | 1 | # The lexer doesn't emit a string token if it's unterminated 2 | "a" "b @@ -9,8 +11,9 @@ ISC_syntax_error.py:2:5: SyntaxError: missing closing quote in string literal 3 | "a" "b" "c 4 | "a" """b | +error[syntax-error]: 2:7: Expected a statement -ISC_syntax_error.py:2:7: SyntaxError: Expected a statement + --> ISC_syntax_error.py:2:7 | 1 | # The lexer doesn't emit a string token if it's unterminated 2 | "a" "b @@ -19,8 +22,9 @@ ISC_syntax_error.py:2:7: SyntaxError: Expected a statement 4 | "a" """b 5 | c""" "d | +error[syntax-error]: 3:9: missing closing quote in string literal -ISC_syntax_error.py:3:9: SyntaxError: missing closing quote in string literal + --> ISC_syntax_error.py:3:9 | 1 | # The lexer doesn't emit a string token if it's unterminated 2 | "a" "b @@ -29,8 +33,9 @@ ISC_syntax_error.py:3:9: SyntaxError: missing closing quote in string literal 4 | "a" """b 5 | c""" "d | +error[syntax-error]: 3:11: Expected a statement -ISC_syntax_error.py:3:11: SyntaxError: Expected a statement + --> ISC_syntax_error.py:3:11 | 1 | # The lexer doesn't emit a string token if it's unterminated 2 | "a" "b @@ -39,8 +44,9 @@ ISC_syntax_error.py:3:11: SyntaxError: Expected a statement 4 | "a" """b 5 | c""" "d | +error[syntax-error]: 5:6: missing closing quote in string literal -ISC_syntax_error.py:5:6: SyntaxError: missing closing quote in string literal + --> ISC_syntax_error.py:5:6 | 3 | "a" "b" "c 4 | "a" """b @@ -49,8 +55,9 @@ ISC_syntax_error.py:5:6: SyntaxError: missing closing quote in string literal 6 | 7 | # For f-strings, the `FStringRanges` won't contain the range for | +error[syntax-error]: 5:8: Expected a statement -ISC_syntax_error.py:5:8: SyntaxError: Expected a statement + --> ISC_syntax_error.py:5:8 | 3 | "a" "b" "c 4 | "a" """b @@ -60,8 +67,9 @@ ISC_syntax_error.py:5:8: SyntaxError: Expected a statement 7 | # For f-strings, the `FStringRanges` won't contain the range for 8 | # unterminated f-strings. | +error[syntax-error]: 9:8: f-string: unterminated string -ISC_syntax_error.py:9:8: SyntaxError: f-string: unterminated string + --> ISC_syntax_error.py:9:8 | 7 | # For f-strings, the `FStringRanges` won't contain the range for 8 | # unterminated f-strings. @@ -70,8 +78,9 @@ ISC_syntax_error.py:9:8: SyntaxError: f-string: unterminated string 10 | f"a" f"b" f"c 11 | f"a" f"""b | +error[syntax-error]: 9:9: Expected FStringEnd, found newline -ISC_syntax_error.py:9:9: SyntaxError: Expected FStringEnd, found newline + --> ISC_syntax_error.py:9:9 | 7 | # For f-strings, the `FStringRanges` won't contain the range for 8 | # unterminated f-strings. @@ -81,8 +90,9 @@ ISC_syntax_error.py:9:9: SyntaxError: Expected FStringEnd, found newline 11 | f"a" f"""b 12 | c""" f"d {e | +error[syntax-error]: 10:13: f-string: unterminated string -ISC_syntax_error.py:10:13: SyntaxError: f-string: unterminated string + --> ISC_syntax_error.py:10:13 | 8 | # unterminated f-strings. 9 | f"a" f"b @@ -91,8 +101,9 @@ ISC_syntax_error.py:10:13: SyntaxError: f-string: unterminated string 11 | f"a" f"""b 12 | c""" f"d {e | +error[syntax-error]: 10:14: Expected FStringEnd, found newline -ISC_syntax_error.py:10:14: SyntaxError: Expected FStringEnd, found newline + --> ISC_syntax_error.py:10:14 | 8 | # unterminated f-strings. 9 | f"a" f"b @@ -101,8 +112,9 @@ ISC_syntax_error.py:10:14: SyntaxError: Expected FStringEnd, found newline 11 | f"a" f"""b 12 | c""" f"d {e | +error[syntax-error]: 16:5: missing closing quote in string literal -ISC_syntax_error.py:16:5: SyntaxError: missing closing quote in string literal + --> ISC_syntax_error.py:16:5 | 14 | ( 15 | "a" @@ -111,8 +123,9 @@ ISC_syntax_error.py:16:5: SyntaxError: missing closing quote in string literal 17 | "c" 18 | "d" | +error[syntax-error]: 26:9: f-string: unterminated triple-quoted string -ISC_syntax_error.py:26:9: SyntaxError: f-string: unterminated triple-quoted string + --> ISC_syntax_error.py:26:9 | 24 | ( 25 | """abc""" @@ -121,15 +134,19 @@ ISC_syntax_error.py:26:9: SyntaxError: f-string: unterminated triple-quoted stri 27 | "g" "h" 28 | "i" "j" | +error[syntax-error]: 30:1: unexpected EOF while parsing -ISC_syntax_error.py:30:1: SyntaxError: unexpected EOF while parsing + --> ISC_syntax_error.py:29:2 | 28 | "i" "j" 29 | ) + | ^ | +error[syntax-error]: 30:1: f-string: unterminated string -ISC_syntax_error.py:30:1: SyntaxError: f-string: unterminated string + --> ISC_syntax_error.py:29:2 | 28 | "i" "j" 29 | ) + | ^ | diff --git a/crates/ruff_linter/src/rules/flake8_implicit_str_concat/snapshots/ruff_linter__rules__flake8_implicit_str_concat__tests__ISC003_ISC.py.snap b/crates/ruff_linter/src/rules/flake8_implicit_str_concat/snapshots/ruff_linter__rules__flake8_implicit_str_concat__tests__ISC003_ISC.py.snap index d4f3397514..6b30b7658f 100644 --- a/crates/ruff_linter/src/rules/flake8_implicit_str_concat/snapshots/ruff_linter__rules__flake8_implicit_str_concat__tests__ISC003_ISC.py.snap +++ b/crates/ruff_linter/src/rules/flake8_implicit_str_concat/snapshots/ruff_linter__rules__flake8_implicit_str_concat__tests__ISC003_ISC.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_implicit_str_concat/mod.rs --- -error[ISC003]: ISC.py:9:3: Explicitly concatenated string should be implicitly concatenated +error[ISC003]: 9:3: Explicitly concatenated string should be implicitly concatenated + --> ISC.py:9:3 | 8 | _ = ( 9 | "abc" + @@ -11,8 +12,9 @@ error[ISC003]: ISC.py:9:3: Explicitly concatenated string should be implicitly c | |_______^ 11 | ) | -error[ISC003]: ISC.py:14:3: Explicitly concatenated string should be implicitly concatenated +error[ISC003]: 14:3: Explicitly concatenated string should be implicitly concatenated + --> ISC.py:14:3 | 13 | _ = ( 14 | f"abc" + @@ -21,8 +23,9 @@ error[ISC003]: ISC.py:14:3: Explicitly concatenated string should be implicitly | |_______^ 16 | ) | -error[ISC003]: ISC.py:19:3: Explicitly concatenated string should be implicitly concatenated +error[ISC003]: 19:3: Explicitly concatenated string should be implicitly concatenated + --> ISC.py:19:3 | 18 | _ = ( 19 | b"abc" + @@ -31,8 +34,9 @@ error[ISC003]: ISC.py:19:3: Explicitly concatenated string should be implicitly | |________^ 21 | ) | -error[ISC003]: ISC.py:78:10: Explicitly concatenated string should be implicitly concatenated +error[ISC003]: 78:10: Explicitly concatenated string should be implicitly concatenated + --> ISC.py:78:10 | 77 | # Explicitly concatenated nested f-strings 78 | _ = f"a {f"first" @@ -42,8 +46,9 @@ error[ISC003]: ISC.py:78:10: Explicitly concatenated string should be implicitly 80 | _ = f"a {f"first {f"middle"}" 81 | + f"second"} d" | -error[ISC003]: ISC.py:80:10: Explicitly concatenated string should be implicitly concatenated +error[ISC003]: 80:10: Explicitly concatenated string should be implicitly concatenated + --> ISC.py:80:10 | 78 | _ = f"a {f"first" 79 | + f"second"} d" diff --git a/crates/ruff_linter/src/rules/flake8_implicit_str_concat/snapshots/ruff_linter__rules__flake8_implicit_str_concat__tests__multiline_ISC001_ISC.py.snap b/crates/ruff_linter/src/rules/flake8_implicit_str_concat/snapshots/ruff_linter__rules__flake8_implicit_str_concat__tests__multiline_ISC001_ISC.py.snap index 3cb4fccc66..522b6acc53 100644 --- a/crates/ruff_linter/src/rules/flake8_implicit_str_concat/snapshots/ruff_linter__rules__flake8_implicit_str_concat__tests__multiline_ISC001_ISC.py.snap +++ b/crates/ruff_linter/src/rules/flake8_implicit_str_concat/snapshots/ruff_linter__rules__flake8_implicit_str_concat__tests__multiline_ISC001_ISC.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_implicit_str_concat/mod.rs --- -error[ISC001]: ISC.py:1:5: [*] Implicitly concatenated string literals on one line +error[ISC001]: 1:5: [*] Implicitly concatenated string literals on one line + --> ISC.py:1:5 | 1 | _ = "a" "b" "c" | ^^^^^^^ @@ -17,8 +18,9 @@ error[ISC001]: ISC.py:1:5: [*] Implicitly concatenated string literals on one li 3 3 | _ = "abc" + "def" 4 4 | -error[ISC001]: ISC.py:1:9: [*] Implicitly concatenated string literals on one line +error[ISC001]: 1:9: [*] Implicitly concatenated string literals on one line + --> ISC.py:1:9 | 1 | _ = "a" "b" "c" | ^^^^^^^ @@ -33,8 +35,9 @@ error[ISC001]: ISC.py:1:9: [*] Implicitly concatenated string literals on one li 3 3 | _ = "abc" + "def" 4 4 | -error[ISC001]: ISC.py:38:5: [*] Implicitly concatenated string literals on one line +error[ISC001]: 38:5: [*] Implicitly concatenated string literals on one line + --> ISC.py:38:5 | 36 | ) 37 | @@ -54,8 +57,9 @@ error[ISC001]: ISC.py:38:5: [*] Implicitly concatenated string literals on one l 40 40 | _ = """a 41 41 | b""" """c -error[ISC001]: ISC.py:40:5: [*] Implicitly concatenated string literals on one line +error[ISC001]: 40:5: [*] Implicitly concatenated string literals on one line + --> ISC.py:40:5 | 38 | _ = """a""" """b""" 39 | @@ -78,8 +82,9 @@ error[ISC001]: ISC.py:40:5: [*] Implicitly concatenated string literals on one l 43 43 | 44 44 | _ = f"""a""" f"""b""" -error[ISC001]: ISC.py:44:5: [*] Implicitly concatenated string literals on one line +error[ISC001]: 44:5: [*] Implicitly concatenated string literals on one line + --> ISC.py:44:5 | 42 | d""" 43 | @@ -99,8 +104,9 @@ error[ISC001]: ISC.py:44:5: [*] Implicitly concatenated string literals on one l 46 46 | _ = f"a" "b" 47 47 | -error[ISC001]: ISC.py:46:5: Implicitly concatenated string literals on one line +error[ISC001]: 46:5: Implicitly concatenated string literals on one line + --> ISC.py:46:5 | 44 | _ = f"""a""" f"""b""" 45 | @@ -110,8 +116,9 @@ error[ISC001]: ISC.py:46:5: Implicitly concatenated string literals on one line 48 | _ = """a""" "b" | = help: Combine string literals -error[ISC001]: ISC.py:48:5: Implicitly concatenated string literals on one line +error[ISC001]: 48:5: Implicitly concatenated string literals on one line + --> ISC.py:48:5 | 46 | _ = f"a" "b" 47 | @@ -121,8 +128,9 @@ error[ISC001]: ISC.py:48:5: Implicitly concatenated string literals on one line 50 | _ = 'a' "b" | = help: Combine string literals -error[ISC001]: ISC.py:50:5: Implicitly concatenated string literals on one line +error[ISC001]: 50:5: Implicitly concatenated string literals on one line + --> ISC.py:50:5 | 48 | _ = """a""" "b" 49 | @@ -132,8 +140,9 @@ error[ISC001]: ISC.py:50:5: Implicitly concatenated string literals on one line 52 | _ = rf"a" rf"b" | = help: Combine string literals -error[ISC001]: ISC.py:52:5: [*] Implicitly concatenated string literals on one line +error[ISC001]: 52:5: [*] Implicitly concatenated string literals on one line + --> ISC.py:52:5 | 50 | _ = 'a' "b" 51 | @@ -153,8 +162,9 @@ error[ISC001]: ISC.py:52:5: [*] Implicitly concatenated string literals on one l 54 54 | # Single-line explicit concatenation should be ignored. 55 55 | _ = "abc" + "def" + "ghi" -error[ISC001]: ISC.py:64:10: [*] Implicitly concatenated string literals on one line +error[ISC001]: 64:10: [*] Implicitly concatenated string literals on one line + --> ISC.py:64:10 | 63 | # Multiple strings nested inside a f-string 64 | _ = f"a {'b' 'c' 'd'} e" @@ -173,8 +183,9 @@ error[ISC001]: ISC.py:64:10: [*] Implicitly concatenated string literals on one 66 66 | _ = f"""abc { 67 67 | "def" -error[ISC001]: ISC.py:64:14: [*] Implicitly concatenated string literals on one line +error[ISC001]: 64:14: [*] Implicitly concatenated string literals on one line + --> ISC.py:64:14 | 63 | # Multiple strings nested inside a f-string 64 | _ = f"a {'b' 'c' 'd'} e" @@ -193,8 +204,9 @@ error[ISC001]: ISC.py:64:14: [*] Implicitly concatenated string literals on one 66 66 | _ = f"""abc { 67 67 | "def" -error[ISC001]: ISC.py:65:14: [*] Implicitly concatenated string literals on one line +error[ISC001]: 65:14: [*] Implicitly concatenated string literals on one line + --> ISC.py:65:14 | 63 | # Multiple strings nested inside a f-string 64 | _ = f"a {'b' 'c' 'd'} e" @@ -214,8 +226,9 @@ error[ISC001]: ISC.py:65:14: [*] Implicitly concatenated string literals on one 67 67 | "def" 68 68 | "ghi" -error[ISC001]: ISC.py:72:5: Implicitly concatenated string literals on one line +error[ISC001]: 72:5: Implicitly concatenated string literals on one line + --> ISC.py:72:5 | 71 | # Nested f-strings 72 | _ = "a" f"b {f"c" f"d"} e" "f" @@ -224,8 +237,9 @@ error[ISC001]: ISC.py:72:5: Implicitly concatenated string literals on one line 74 | _ = f"b {f"abc" \ | = help: Combine string literals -error[ISC001]: ISC.py:72:9: Implicitly concatenated string literals on one line +error[ISC001]: 72:9: Implicitly concatenated string literals on one line + --> ISC.py:72:9 | 71 | # Nested f-strings 72 | _ = "a" f"b {f"c" f"d"} e" "f" @@ -234,8 +248,9 @@ error[ISC001]: ISC.py:72:9: Implicitly concatenated string literals on one line 74 | _ = f"b {f"abc" \ | = help: Combine string literals -error[ISC001]: ISC.py:72:14: [*] Implicitly concatenated string literals on one line +error[ISC001]: 72:14: [*] Implicitly concatenated string literals on one line + --> ISC.py:72:14 | 71 | # Nested f-strings 72 | _ = "a" f"b {f"c" f"d"} e" "f" @@ -254,8 +269,9 @@ error[ISC001]: ISC.py:72:14: [*] Implicitly concatenated string literals on one 74 74 | _ = f"b {f"abc" \ 75 75 | f"def"} g" -error[ISC001]: ISC.py:73:10: [*] Implicitly concatenated string literals on one line +error[ISC001]: 73:10: [*] Implicitly concatenated string literals on one line + --> ISC.py:73:10 | 71 | # Nested f-strings 72 | _ = "a" f"b {f"c" f"d"} e" "f" @@ -275,8 +291,9 @@ error[ISC001]: ISC.py:73:10: [*] Implicitly concatenated string literals on one 75 75 | f"def"} g" 76 76 | -error[ISC001]: ISC.py:73:20: [*] Implicitly concatenated string literals on one line +error[ISC001]: 73:20: [*] Implicitly concatenated string literals on one line + --> ISC.py:73:20 | 71 | # Nested f-strings 72 | _ = "a" f"b {f"c" f"d"} e" "f" diff --git a/crates/ruff_linter/src/rules/flake8_implicit_str_concat/snapshots/ruff_linter__rules__flake8_implicit_str_concat__tests__multiline_ISC002_ISC.py.snap b/crates/ruff_linter/src/rules/flake8_implicit_str_concat/snapshots/ruff_linter__rules__flake8_implicit_str_concat__tests__multiline_ISC002_ISC.py.snap index 3f4bddb991..004961680b 100644 --- a/crates/ruff_linter/src/rules/flake8_implicit_str_concat/snapshots/ruff_linter__rules__flake8_implicit_str_concat__tests__multiline_ISC002_ISC.py.snap +++ b/crates/ruff_linter/src/rules/flake8_implicit_str_concat/snapshots/ruff_linter__rules__flake8_implicit_str_concat__tests__multiline_ISC002_ISC.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_implicit_str_concat/mod.rs --- -error[ISC002]: ISC.py:5:5: Implicitly concatenated string literals over multiple lines +error[ISC002]: 5:5: Implicitly concatenated string literals over multiple lines + --> ISC.py:5:5 | 3 | _ = "abc" + "def" 4 | @@ -13,8 +14,9 @@ error[ISC002]: ISC.py:5:5: Implicitly concatenated string literals over multiple 7 | 8 | _ = ( | -error[ISC002]: ISC.py:24:3: Implicitly concatenated string literals over multiple lines +error[ISC002]: 24:3: Implicitly concatenated string literals over multiple lines + --> ISC.py:24:3 | 23 | _ = ( 24 | "abc" @@ -23,8 +25,9 @@ error[ISC002]: ISC.py:24:3: Implicitly concatenated string literals over multipl | |_______^ 26 | ) | -error[ISC002]: ISC.py:29:3: Implicitly concatenated string literals over multiple lines +error[ISC002]: 29:3: Implicitly concatenated string literals over multiple lines + --> ISC.py:29:3 | 28 | _ = ( 29 | f"abc" @@ -33,8 +36,9 @@ error[ISC002]: ISC.py:29:3: Implicitly concatenated string literals over multipl | |_______^ 31 | ) | -error[ISC002]: ISC.py:34:3: Implicitly concatenated string literals over multiple lines +error[ISC002]: 34:3: Implicitly concatenated string literals over multiple lines + --> ISC.py:34:3 | 33 | _ = ( 34 | b"abc" @@ -43,8 +47,9 @@ error[ISC002]: ISC.py:34:3: Implicitly concatenated string literals over multipl | |________^ 36 | ) | -error[ISC002]: ISC.py:67:5: Implicitly concatenated string literals over multiple lines +error[ISC002]: 67:5: Implicitly concatenated string literals over multiple lines + --> ISC.py:67:5 | 65 | _ = f"""abc {"def" "ghi"} jkl""" 66 | _ = f"""abc { @@ -54,8 +59,9 @@ error[ISC002]: ISC.py:67:5: Implicitly concatenated string literals over multipl | |_________^ 69 | } jkl""" | -error[ISC002]: ISC.py:74:10: Implicitly concatenated string literals over multiple lines +error[ISC002]: 74:10: Implicitly concatenated string literals over multiple lines + --> ISC.py:74:10 | 72 | _ = "a" f"b {f"c" f"d"} e" "f" 73 | _ = f"b {f"c" f"d {f"e" f"f"} g"} h" diff --git a/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__custom.snap b/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__custom.snap index b7ce7ea2e9..e533ddd5e8 100644 --- a/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__custom.snap +++ b/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__custom.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_import_conventions/mod.rs --- -error[ICN001]: custom.py:3:8: `altair` should be imported as `alt` +error[ICN001]: 3:8: `altair` should be imported as `alt` + --> custom.py:3:8 | 1 | import math # not checked 2 | @@ -12,8 +13,9 @@ error[ICN001]: custom.py:3:8: `altair` should be imported as `alt` 5 | import dask.dataframe # unconventional | = help: Alias `altair` to `alt` -error[ICN001]: custom.py:4:8: `dask.array` should be imported as `da` +error[ICN001]: 4:8: `dask.array` should be imported as `da` + --> custom.py:4:8 | 3 | import altair # unconventional 4 | import dask.array # unconventional @@ -22,8 +24,9 @@ error[ICN001]: custom.py:4:8: `dask.array` should be imported as `da` 6 | import matplotlib.pyplot # unconventional | = help: Alias `dask.array` to `da` -error[ICN001]: custom.py:5:8: `dask.dataframe` should be imported as `dd` +error[ICN001]: 5:8: `dask.dataframe` should be imported as `dd` + --> custom.py:5:8 | 3 | import altair # unconventional 4 | import dask.array # unconventional @@ -33,8 +36,9 @@ error[ICN001]: custom.py:5:8: `dask.dataframe` should be imported as `dd` 7 | import numpy # unconventional | = help: Alias `dask.dataframe` to `dd` -error[ICN001]: custom.py:6:8: `matplotlib.pyplot` should be imported as `plt` +error[ICN001]: 6:8: `matplotlib.pyplot` should be imported as `plt` + --> custom.py:6:8 | 4 | import dask.array # unconventional 5 | import dask.dataframe # unconventional @@ -44,8 +48,9 @@ error[ICN001]: custom.py:6:8: `matplotlib.pyplot` should be imported as `plt` 8 | import pandas # unconventional | = help: Alias `matplotlib.pyplot` to `plt` -error[ICN001]: custom.py:7:8: `numpy` should be imported as `np` +error[ICN001]: 7:8: `numpy` should be imported as `np` + --> custom.py:7:8 | 5 | import dask.dataframe # unconventional 6 | import matplotlib.pyplot # unconventional @@ -55,8 +60,9 @@ error[ICN001]: custom.py:7:8: `numpy` should be imported as `np` 9 | import seaborn # unconventional | = help: Alias `numpy` to `np` -error[ICN001]: custom.py:8:8: `pandas` should be imported as `pd` +error[ICN001]: 8:8: `pandas` should be imported as `pd` + --> custom.py:8:8 | 6 | import matplotlib.pyplot # unconventional 7 | import numpy # unconventional @@ -66,8 +72,9 @@ error[ICN001]: custom.py:8:8: `pandas` should be imported as `pd` 10 | import tensorflow # unconventional | = help: Alias `pandas` to `pd` -error[ICN001]: custom.py:9:8: `seaborn` should be imported as `sns` +error[ICN001]: 9:8: `seaborn` should be imported as `sns` + --> custom.py:9:8 | 7 | import numpy # unconventional 8 | import pandas # unconventional @@ -77,8 +84,9 @@ error[ICN001]: custom.py:9:8: `seaborn` should be imported as `sns` 11 | import holoviews # unconventional | = help: Alias `seaborn` to `sns` -error[ICN001]: custom.py:10:8: `tensorflow` should be imported as `tf` +error[ICN001]: 10:8: `tensorflow` should be imported as `tf` + --> custom.py:10:8 | 8 | import pandas # unconventional 9 | import seaborn # unconventional @@ -88,8 +96,9 @@ error[ICN001]: custom.py:10:8: `tensorflow` should be imported as `tf` 12 | import panel # unconventional | = help: Alias `tensorflow` to `tf` -error[ICN001]: custom.py:11:8: `holoviews` should be imported as `hv` +error[ICN001]: 11:8: `holoviews` should be imported as `hv` + --> custom.py:11:8 | 9 | import seaborn # unconventional 10 | import tensorflow # unconventional @@ -99,8 +108,9 @@ error[ICN001]: custom.py:11:8: `holoviews` should be imported as `hv` 13 | import plotly.express # unconventional | = help: Alias `holoviews` to `hv` -error[ICN001]: custom.py:12:8: `panel` should be imported as `pn` +error[ICN001]: 12:8: `panel` should be imported as `pn` + --> custom.py:12:8 | 10 | import tensorflow # unconventional 11 | import holoviews # unconventional @@ -110,8 +120,9 @@ error[ICN001]: custom.py:12:8: `panel` should be imported as `pn` 14 | import matplotlib # unconventional | = help: Alias `panel` to `pn` -error[ICN001]: custom.py:13:8: `plotly.express` should be imported as `px` +error[ICN001]: 13:8: `plotly.express` should be imported as `px` + --> custom.py:13:8 | 11 | import holoviews # unconventional 12 | import panel # unconventional @@ -121,8 +132,9 @@ error[ICN001]: custom.py:13:8: `plotly.express` should be imported as `px` 15 | import polars # unconventional | = help: Alias `plotly.express` to `px` -error[ICN001]: custom.py:14:8: `matplotlib` should be imported as `mpl` +error[ICN001]: 14:8: `matplotlib` should be imported as `mpl` + --> custom.py:14:8 | 12 | import panel # unconventional 13 | import plotly.express # unconventional @@ -132,8 +144,9 @@ error[ICN001]: custom.py:14:8: `matplotlib` should be imported as `mpl` 16 | import pyarrow # unconventional | = help: Alias `matplotlib` to `mpl` -error[ICN001]: custom.py:15:8: `polars` should be imported as `pl` +error[ICN001]: 15:8: `polars` should be imported as `pl` + --> custom.py:15:8 | 13 | import plotly.express # unconventional 14 | import matplotlib # unconventional @@ -142,8 +155,9 @@ error[ICN001]: custom.py:15:8: `polars` should be imported as `pl` 16 | import pyarrow # unconventional | = help: Alias `polars` to `pl` -error[ICN001]: custom.py:16:8: `pyarrow` should be imported as `pa` +error[ICN001]: 16:8: `pyarrow` should be imported as `pa` + --> custom.py:16:8 | 14 | import matplotlib # unconventional 15 | import polars # unconventional @@ -153,8 +167,9 @@ error[ICN001]: custom.py:16:8: `pyarrow` should be imported as `pa` 18 | import altair as altr # unconventional | = help: Alias `pyarrow` to `pa` -error[ICN001]: custom.py:18:18: `altair` should be imported as `alt` +error[ICN001]: 18:18: `altair` should be imported as `alt` + --> custom.py:18:18 | 16 | import pyarrow # unconventional 17 | @@ -164,8 +179,9 @@ error[ICN001]: custom.py:18:18: `altair` should be imported as `alt` 20 | import dask.array as darray # unconventional | = help: Alias `altair` to `alt` -error[ICN001]: custom.py:19:29: `matplotlib.pyplot` should be imported as `plt` +error[ICN001]: 19:29: `matplotlib.pyplot` should be imported as `plt` + --> custom.py:19:29 | 18 | import altair as altr # unconventional 19 | import matplotlib.pyplot as plot # unconventional @@ -174,8 +190,9 @@ error[ICN001]: custom.py:19:29: `matplotlib.pyplot` should be imported as `plt` 21 | import dask.dataframe as ddf # unconventional | = help: Alias `matplotlib.pyplot` to `plt` -error[ICN001]: custom.py:20:22: `dask.array` should be imported as `da` +error[ICN001]: 20:22: `dask.array` should be imported as `da` + --> custom.py:20:22 | 18 | import altair as altr # unconventional 19 | import matplotlib.pyplot as plot # unconventional @@ -185,8 +202,9 @@ error[ICN001]: custom.py:20:22: `dask.array` should be imported as `da` 22 | import numpy as nmp # unconventional | = help: Alias `dask.array` to `da` -error[ICN001]: custom.py:21:26: `dask.dataframe` should be imported as `dd` +error[ICN001]: 21:26: `dask.dataframe` should be imported as `dd` + --> custom.py:21:26 | 19 | import matplotlib.pyplot as plot # unconventional 20 | import dask.array as darray # unconventional @@ -196,8 +214,9 @@ error[ICN001]: custom.py:21:26: `dask.dataframe` should be imported as `dd` 23 | import pandas as pdas # unconventional | = help: Alias `dask.dataframe` to `dd` -error[ICN001]: custom.py:22:17: `numpy` should be imported as `np` +error[ICN001]: 22:17: `numpy` should be imported as `np` + --> custom.py:22:17 | 20 | import dask.array as darray # unconventional 21 | import dask.dataframe as ddf # unconventional @@ -207,8 +226,9 @@ error[ICN001]: custom.py:22:17: `numpy` should be imported as `np` 24 | import seaborn as sbrn # unconventional | = help: Alias `numpy` to `np` -error[ICN001]: custom.py:23:18: `pandas` should be imported as `pd` +error[ICN001]: 23:18: `pandas` should be imported as `pd` + --> custom.py:23:18 | 21 | import dask.dataframe as ddf # unconventional 22 | import numpy as nmp # unconventional @@ -218,8 +238,9 @@ error[ICN001]: custom.py:23:18: `pandas` should be imported as `pd` 25 | import tensorflow as tfz # unconventional | = help: Alias `pandas` to `pd` -error[ICN001]: custom.py:24:19: `seaborn` should be imported as `sns` +error[ICN001]: 24:19: `seaborn` should be imported as `sns` + --> custom.py:24:19 | 22 | import numpy as nmp # unconventional 23 | import pandas as pdas # unconventional @@ -229,8 +250,9 @@ error[ICN001]: custom.py:24:19: `seaborn` should be imported as `sns` 26 | import holoviews as hsv # unconventional | = help: Alias `seaborn` to `sns` -error[ICN001]: custom.py:25:22: `tensorflow` should be imported as `tf` +error[ICN001]: 25:22: `tensorflow` should be imported as `tf` + --> custom.py:25:22 | 23 | import pandas as pdas # unconventional 24 | import seaborn as sbrn # unconventional @@ -240,8 +262,9 @@ error[ICN001]: custom.py:25:22: `tensorflow` should be imported as `tf` 27 | import panel as pns # unconventional | = help: Alias `tensorflow` to `tf` -error[ICN001]: custom.py:26:21: `holoviews` should be imported as `hv` +error[ICN001]: 26:21: `holoviews` should be imported as `hv` + --> custom.py:26:21 | 24 | import seaborn as sbrn # unconventional 25 | import tensorflow as tfz # unconventional @@ -251,8 +274,9 @@ error[ICN001]: custom.py:26:21: `holoviews` should be imported as `hv` 28 | import plotly.express as pltx # unconventional | = help: Alias `holoviews` to `hv` -error[ICN001]: custom.py:27:17: `panel` should be imported as `pn` +error[ICN001]: 27:17: `panel` should be imported as `pn` + --> custom.py:27:17 | 25 | import tensorflow as tfz # unconventional 26 | import holoviews as hsv # unconventional @@ -262,8 +286,9 @@ error[ICN001]: custom.py:27:17: `panel` should be imported as `pn` 29 | import matplotlib as ml # unconventional | = help: Alias `panel` to `pn` -error[ICN001]: custom.py:28:26: `plotly.express` should be imported as `px` +error[ICN001]: 28:26: `plotly.express` should be imported as `px` + --> custom.py:28:26 | 26 | import holoviews as hsv # unconventional 27 | import panel as pns # unconventional @@ -273,8 +298,9 @@ error[ICN001]: custom.py:28:26: `plotly.express` should be imported as `px` 30 | import polars as ps # unconventional | = help: Alias `plotly.express` to `px` -error[ICN001]: custom.py:29:22: `matplotlib` should be imported as `mpl` +error[ICN001]: 29:22: `matplotlib` should be imported as `mpl` + --> custom.py:29:22 | 27 | import panel as pns # unconventional 28 | import plotly.express as pltx # unconventional @@ -284,8 +310,9 @@ error[ICN001]: custom.py:29:22: `matplotlib` should be imported as `mpl` 31 | import pyarrow as arr # unconventional | = help: Alias `matplotlib` to `mpl` -error[ICN001]: custom.py:30:18: `polars` should be imported as `pl` +error[ICN001]: 30:18: `polars` should be imported as `pl` + --> custom.py:30:18 | 28 | import plotly.express as pltx # unconventional 29 | import matplotlib as ml # unconventional @@ -294,8 +321,9 @@ error[ICN001]: custom.py:30:18: `polars` should be imported as `pl` 31 | import pyarrow as arr # unconventional | = help: Alias `polars` to `pl` -error[ICN001]: custom.py:31:19: `pyarrow` should be imported as `pa` +error[ICN001]: 31:19: `pyarrow` should be imported as `pa` + --> custom.py:31:19 | 29 | import matplotlib as ml # unconventional 30 | import polars as ps # unconventional diff --git a/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__custom_banned.snap b/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__custom_banned.snap index 3e3b9e056a..726d0d4c4c 100644 --- a/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__custom_banned.snap +++ b/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__custom_banned.snap @@ -1,15 +1,17 @@ --- source: crates/ruff_linter/src/rules/flake8_import_conventions/mod.rs --- -error[ICN002]: custom_banned.py:1:1: `typing` should not be imported as `t` +error[ICN002]: 1:1: `typing` should not be imported as `t` + --> custom_banned.py:1:1 | 1 | import typing as t # banned | ^^^^^^^^^^^^^^^^^^ 2 | import typing as ty # banned | -error[ICN002]: custom_banned.py:2:1: `typing` should not be imported as `ty` +error[ICN002]: 2:1: `typing` should not be imported as `ty` + --> custom_banned.py:1:29 | 1 | import typing as t # banned 2 | import typing as ty # banned @@ -17,8 +19,9 @@ error[ICN002]: custom_banned.py:2:1: `typing` should not be imported as `ty` 3 | 4 | import numpy as nmp # banned | -error[ICN002]: custom_banned.py:4:1: `numpy` should not be imported as `nmp` +error[ICN002]: 4:1: `numpy` should not be imported as `nmp` + --> custom_banned.py:3:1 | 2 | import typing as ty # banned 3 | @@ -27,8 +30,9 @@ error[ICN002]: custom_banned.py:4:1: `numpy` should not be imported as `nmp` 5 | import numpy as npy # banned 6 | import tensorflow.keras.backend as K # banned | -error[ICN002]: custom_banned.py:5:1: `numpy` should not be imported as `npy` +error[ICN002]: 5:1: `numpy` should not be imported as `npy` + --> custom_banned.py:4:30 | 4 | import numpy as nmp # banned 5 | import numpy as npy # banned @@ -36,8 +40,9 @@ error[ICN002]: custom_banned.py:5:1: `numpy` should not be imported as `npy` 6 | import tensorflow.keras.backend as K # banned 7 | import torch.nn.functional as F # banned | -error[ICN002]: custom_banned.py:6:1: `tensorflow.keras.backend` should not be imported as `K` +error[ICN002]: 6:1: `tensorflow.keras.backend` should not be imported as `K` + --> custom_banned.py:5:30 | 4 | import numpy as nmp # banned 5 | import numpy as npy # banned @@ -46,8 +51,9 @@ error[ICN002]: custom_banned.py:6:1: `tensorflow.keras.backend` should not be im 7 | import torch.nn.functional as F # banned 8 | from tensorflow.keras import backend as K # banned | -error[ICN002]: custom_banned.py:7:1: `torch.nn.functional` should not be imported as `F` +error[ICN002]: 7:1: `torch.nn.functional` should not be imported as `F` + --> custom_banned.py:6:47 | 5 | import numpy as npy # banned 6 | import tensorflow.keras.backend as K # banned @@ -56,8 +62,9 @@ error[ICN002]: custom_banned.py:7:1: `torch.nn.functional` should not be importe 8 | from tensorflow.keras import backend as K # banned 9 | from torch.nn import functional as F # banned | -error[ICN002]: custom_banned.py:8:1: `tensorflow.keras.backend` should not be imported as `K` +error[ICN002]: 8:1: `tensorflow.keras.backend` should not be imported as `K` + --> custom_banned.py:7:42 | 6 | import tensorflow.keras.backend as K # banned 7 | import torch.nn.functional as F # banned @@ -65,8 +72,9 @@ error[ICN002]: custom_banned.py:8:1: `tensorflow.keras.backend` should not be im | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 9 | from torch.nn import functional as F # banned | -error[ICN002]: custom_banned.py:9:1: `torch.nn.functional` should not be imported as `F` +error[ICN002]: 9:1: `torch.nn.functional` should not be imported as `F` + --> custom_banned.py:8:52 | 7 | import torch.nn.functional as F # banned 8 | from tensorflow.keras import backend as K # banned diff --git a/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__custom_banned_from.snap b/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__custom_banned_from.snap index 7037da2a4e..bf6c3d8479 100644 --- a/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__custom_banned_from.snap +++ b/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__custom_banned_from.snap @@ -1,24 +1,27 @@ --- source: crates/ruff_linter/src/rules/flake8_import_conventions/mod.rs --- -error[ICN003]: custom_banned_from.py:1:1: Members of `logging.config` should not be imported explicitly +error[ICN003]: 1:1: Members of `logging.config` should not be imported explicitly + --> custom_banned_from.py:1:1 | 1 | from logging.config import BaseConfigurator # banned | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2 | from typing import Any, Dict # banned 3 | from typing import * # banned | -error[ICN003]: custom_banned_from.py:2:1: Members of `typing` should not be imported explicitly +error[ICN003]: 2:1: Members of `typing` should not be imported explicitly + --> custom_banned_from.py:1:54 | 1 | from logging.config import BaseConfigurator # banned 2 | from typing import Any, Dict # banned | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 3 | from typing import * # banned | -error[ICN003]: custom_banned_from.py:3:1: Members of `typing` should not be imported explicitly +error[ICN003]: 3:1: Members of `typing` should not be imported explicitly + --> custom_banned_from.py:2:39 | 1 | from logging.config import BaseConfigurator # banned 2 | from typing import Any, Dict # banned @@ -27,8 +30,9 @@ error[ICN003]: custom_banned_from.py:3:1: Members of `typing` should not be impo 4 | 5 | from pandas import DataFrame # banned | -error[ICN003]: custom_banned_from.py:5:1: Members of `pandas` should not be imported explicitly +error[ICN003]: 5:1: Members of `pandas` should not be imported explicitly + --> custom_banned_from.py:4:1 | 3 | from typing import * # banned 4 | @@ -36,8 +40,9 @@ error[ICN003]: custom_banned_from.py:5:1: Members of `pandas` should not be impo | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 6 | from pandas import * # banned | -error[ICN003]: custom_banned_from.py:6:1: Members of `pandas` should not be imported explicitly +error[ICN003]: 6:1: Members of `pandas` should not be imported explicitly + --> custom_banned_from.py:5:39 | 5 | from pandas import DataFrame # banned 6 | from pandas import * # banned diff --git a/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__defaults.snap b/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__defaults.snap index 89b1f1868a..bf8f31e35b 100644 --- a/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__defaults.snap +++ b/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__defaults.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_import_conventions/mod.rs --- -error[ICN001]: defaults.py:6:12: [*] `altair` should be imported as `alt` +error[ICN001]: 6:12: [*] `altair` should be imported as `alt` + --> defaults.py:6:12 | 5 | def unconventional(): 6 | import altair @@ -21,8 +22,9 @@ error[ICN001]: defaults.py:6:12: [*] `altair` should be imported as `alt` 8 8 | import numpy 9 9 | import pandas -error[ICN001]: defaults.py:7:12: `matplotlib.pyplot` should be imported as `plt` +error[ICN001]: 7:12: `matplotlib.pyplot` should be imported as `plt` + --> defaults.py:7:12 | 5 | def unconventional(): 6 | import altair @@ -32,8 +34,9 @@ error[ICN001]: defaults.py:7:12: `matplotlib.pyplot` should be imported as `plt` 9 | import pandas | = help: Alias `matplotlib.pyplot` to `plt` -error[ICN001]: defaults.py:8:12: [*] `numpy` should be imported as `np` +error[ICN001]: 8:12: [*] `numpy` should be imported as `np` + --> defaults.py:8:12 | 6 | import altair 7 | import matplotlib.pyplot @@ -53,8 +56,9 @@ error[ICN001]: defaults.py:8:12: [*] `numpy` should be imported as `np` 10 10 | import seaborn 11 11 | import tkinter -error[ICN001]: defaults.py:9:12: [*] `pandas` should be imported as `pd` +error[ICN001]: 9:12: [*] `pandas` should be imported as `pd` + --> defaults.py:9:12 | 7 | import matplotlib.pyplot 8 | import numpy @@ -74,8 +78,9 @@ error[ICN001]: defaults.py:9:12: [*] `pandas` should be imported as `pd` 11 11 | import tkinter 12 12 | import networkx -error[ICN001]: defaults.py:10:12: [*] `seaborn` should be imported as `sns` +error[ICN001]: 10:12: [*] `seaborn` should be imported as `sns` + --> defaults.py:10:12 | 8 | import numpy 9 | import pandas @@ -95,8 +100,9 @@ error[ICN001]: defaults.py:10:12: [*] `seaborn` should be imported as `sns` 12 12 | import networkx 13 13 | -error[ICN001]: defaults.py:11:12: [*] `tkinter` should be imported as `tk` +error[ICN001]: 11:12: [*] `tkinter` should be imported as `tk` + --> defaults.py:11:12 | 9 | import pandas 10 | import seaborn @@ -115,8 +121,9 @@ error[ICN001]: defaults.py:11:12: [*] `tkinter` should be imported as `tk` 13 13 | 14 14 | -error[ICN001]: defaults.py:12:12: [*] `networkx` should be imported as `nx` +error[ICN001]: 12:12: [*] `networkx` should be imported as `nx` + --> defaults.py:12:12 | 10 | import seaborn 11 | import tkinter @@ -134,8 +141,9 @@ error[ICN001]: defaults.py:12:12: [*] `networkx` should be imported as `nx` 14 14 | 15 15 | def unconventional_aliases(): -error[ICN001]: defaults.py:16:22: [*] `altair` should be imported as `alt` +error[ICN001]: 16:22: [*] `altair` should be imported as `alt` + --> defaults.py:16:22 | 15 | def unconventional_aliases(): 16 | import altair as altr @@ -154,8 +162,9 @@ error[ICN001]: defaults.py:16:22: [*] `altair` should be imported as `alt` 18 18 | import numpy as nmp 19 19 | import pandas as pdas -error[ICN001]: defaults.py:17:33: [*] `matplotlib.pyplot` should be imported as `plt` +error[ICN001]: 17:33: [*] `matplotlib.pyplot` should be imported as `plt` + --> defaults.py:17:33 | 15 | def unconventional_aliases(): 16 | import altair as altr @@ -175,8 +184,9 @@ error[ICN001]: defaults.py:17:33: [*] `matplotlib.pyplot` should be imported as 19 19 | import pandas as pdas 20 20 | import seaborn as sbrn -error[ICN001]: defaults.py:18:21: [*] `numpy` should be imported as `np` +error[ICN001]: 18:21: [*] `numpy` should be imported as `np` + --> defaults.py:18:21 | 16 | import altair as altr 17 | import matplotlib.pyplot as plot @@ -196,8 +206,9 @@ error[ICN001]: defaults.py:18:21: [*] `numpy` should be imported as `np` 20 20 | import seaborn as sbrn 21 21 | import tkinter as tkr -error[ICN001]: defaults.py:19:22: [*] `pandas` should be imported as `pd` +error[ICN001]: 19:22: [*] `pandas` should be imported as `pd` + --> defaults.py:19:22 | 17 | import matplotlib.pyplot as plot 18 | import numpy as nmp @@ -217,8 +228,9 @@ error[ICN001]: defaults.py:19:22: [*] `pandas` should be imported as `pd` 21 21 | import tkinter as tkr 22 22 | import networkx as nxy -error[ICN001]: defaults.py:20:23: [*] `seaborn` should be imported as `sns` +error[ICN001]: 20:23: [*] `seaborn` should be imported as `sns` + --> defaults.py:20:23 | 18 | import numpy as nmp 19 | import pandas as pdas @@ -238,8 +250,9 @@ error[ICN001]: defaults.py:20:23: [*] `seaborn` should be imported as `sns` 22 22 | import networkx as nxy 23 23 | -error[ICN001]: defaults.py:21:23: [*] `tkinter` should be imported as `tk` +error[ICN001]: 21:23: [*] `tkinter` should be imported as `tk` + --> defaults.py:21:23 | 19 | import pandas as pdas 20 | import seaborn as sbrn @@ -258,8 +271,9 @@ error[ICN001]: defaults.py:21:23: [*] `tkinter` should be imported as `tk` 23 23 | 24 24 | -error[ICN001]: defaults.py:22:24: [*] `networkx` should be imported as `nx` +error[ICN001]: 22:24: [*] `networkx` should be imported as `nx` + --> defaults.py:22:24 | 20 | import seaborn as sbrn 21 | import tkinter as tkr diff --git a/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__from_imports.snap b/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__from_imports.snap index 10e6cf3f1e..4eabaae99b 100644 --- a/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__from_imports.snap +++ b/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__from_imports.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_import_conventions/mod.rs --- -error[ICN001]: from_imports.py:3:8: `xml.dom.minidom` should be imported as `md` +error[ICN001]: 3:8: `xml.dom.minidom` should be imported as `md` + --> from_imports.py:3:8 | 1 | # Test absolute imports 2 | # Violation cases @@ -12,8 +13,9 @@ error[ICN001]: from_imports.py:3:8: `xml.dom.minidom` should be imported as `md` 5 | from xml.dom import minidom as wrong | = help: Alias `xml.dom.minidom` to `md` -error[ICN001]: from_imports.py:4:27: `xml.dom.minidom` should be imported as `md` +error[ICN001]: 4:27: `xml.dom.minidom` should be imported as `md` + --> from_imports.py:4:27 | 2 | # Violation cases 3 | import xml.dom.minidom @@ -23,8 +25,9 @@ error[ICN001]: from_imports.py:4:27: `xml.dom.minidom` should be imported as `md 6 | from xml.dom import minidom | = help: Alias `xml.dom.minidom` to `md` -error[ICN001]: from_imports.py:5:32: `xml.dom.minidom` should be imported as `md` +error[ICN001]: 5:32: `xml.dom.minidom` should be imported as `md` + --> from_imports.py:5:32 | 3 | import xml.dom.minidom 4 | import xml.dom.minidom as wrong @@ -34,8 +37,9 @@ error[ICN001]: from_imports.py:5:32: `xml.dom.minidom` should be imported as `md 7 | from xml.dom.minidom import parseString as wrong # Ensure ICN001 throws on function import. | = help: Alias `xml.dom.minidom` to `md` -error[ICN001]: from_imports.py:6:21: `xml.dom.minidom` should be imported as `md` +error[ICN001]: 6:21: `xml.dom.minidom` should be imported as `md` + --> from_imports.py:6:21 | 4 | import xml.dom.minidom as wrong 5 | from xml.dom import minidom as wrong @@ -45,8 +49,9 @@ error[ICN001]: from_imports.py:6:21: `xml.dom.minidom` should be imported as `md 8 | from xml.dom.minidom import parseString | = help: Alias `xml.dom.minidom` to `md` -error[ICN001]: from_imports.py:7:44: `xml.dom.minidom.parseString` should be imported as `pstr` +error[ICN001]: 7:44: `xml.dom.minidom.parseString` should be imported as `pstr` + --> from_imports.py:7:44 | 5 | from xml.dom import minidom as wrong 6 | from xml.dom import minidom @@ -56,8 +61,9 @@ error[ICN001]: from_imports.py:7:44: `xml.dom.minidom.parseString` should be imp 9 | from xml.dom.minidom import parse, parseString | = help: Alias `xml.dom.minidom.parseString` to `pstr` -error[ICN001]: from_imports.py:8:29: `xml.dom.minidom.parseString` should be imported as `pstr` +error[ICN001]: 8:29: `xml.dom.minidom.parseString` should be imported as `pstr` + --> from_imports.py:8:29 | 6 | from xml.dom import minidom 7 | from xml.dom.minidom import parseString as wrong # Ensure ICN001 throws on function import. @@ -67,8 +73,9 @@ error[ICN001]: from_imports.py:8:29: `xml.dom.minidom.parseString` should be imp 10 | from xml.dom.minidom import parse as ps, parseString as wrong | = help: Alias `xml.dom.minidom.parseString` to `pstr` -error[ICN001]: from_imports.py:9:36: `xml.dom.minidom.parseString` should be imported as `pstr` +error[ICN001]: 9:36: `xml.dom.minidom.parseString` should be imported as `pstr` + --> from_imports.py:9:36 | 7 | from xml.dom.minidom import parseString as wrong # Ensure ICN001 throws on function import. 8 | from xml.dom.minidom import parseString @@ -77,8 +84,9 @@ error[ICN001]: from_imports.py:9:36: `xml.dom.minidom.parseString` should be imp 10 | from xml.dom.minidom import parse as ps, parseString as wrong | = help: Alias `xml.dom.minidom.parseString` to `pstr` -error[ICN001]: from_imports.py:10:57: `xml.dom.minidom.parseString` should be imported as `pstr` +error[ICN001]: 10:57: `xml.dom.minidom.parseString` should be imported as `pstr` + --> from_imports.py:10:57 | 8 | from xml.dom.minidom import parseString 9 | from xml.dom.minidom import parse, parseString diff --git a/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__override_defaults.snap b/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__override_defaults.snap index c701f74675..4a00f8d2fa 100644 --- a/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__override_defaults.snap +++ b/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__override_defaults.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_import_conventions/mod.rs --- -error[ICN001]: override_default.py:3:8: `altair` should be imported as `alt` +error[ICN001]: 3:8: `altair` should be imported as `alt` + --> override_default.py:3:8 | 1 | import math # not checked 2 | @@ -12,8 +13,9 @@ error[ICN001]: override_default.py:3:8: `altair` should be imported as `alt` 5 | import numpy # unconventional | = help: Alias `altair` to `alt` -error[ICN001]: override_default.py:4:8: `matplotlib.pyplot` should be imported as `plt` +error[ICN001]: 4:8: `matplotlib.pyplot` should be imported as `plt` + --> override_default.py:4:8 | 3 | import altair # unconventional 4 | import matplotlib.pyplot # unconventional @@ -22,8 +24,9 @@ error[ICN001]: override_default.py:4:8: `matplotlib.pyplot` should be imported a 6 | import pandas # unconventional | = help: Alias `matplotlib.pyplot` to `plt` -error[ICN001]: override_default.py:5:8: `numpy` should be imported as `nmp` +error[ICN001]: 5:8: `numpy` should be imported as `nmp` + --> override_default.py:5:8 | 3 | import altair # unconventional 4 | import matplotlib.pyplot # unconventional @@ -33,8 +36,9 @@ error[ICN001]: override_default.py:5:8: `numpy` should be imported as `nmp` 7 | import seaborn # unconventional | = help: Alias `numpy` to `nmp` -error[ICN001]: override_default.py:6:8: `pandas` should be imported as `pd` +error[ICN001]: 6:8: `pandas` should be imported as `pd` + --> override_default.py:6:8 | 4 | import matplotlib.pyplot # unconventional 5 | import numpy # unconventional @@ -43,8 +47,9 @@ error[ICN001]: override_default.py:6:8: `pandas` should be imported as `pd` 7 | import seaborn # unconventional | = help: Alias `pandas` to `pd` -error[ICN001]: override_default.py:7:8: `seaborn` should be imported as `sns` +error[ICN001]: 7:8: `seaborn` should be imported as `sns` + --> override_default.py:7:8 | 5 | import numpy # unconventional 6 | import pandas # unconventional @@ -54,8 +59,9 @@ error[ICN001]: override_default.py:7:8: `seaborn` should be imported as `sns` 9 | import altair as altr # unconventional | = help: Alias `seaborn` to `sns` -error[ICN001]: override_default.py:9:18: `altair` should be imported as `alt` +error[ICN001]: 9:18: `altair` should be imported as `alt` + --> override_default.py:9:18 | 7 | import seaborn # unconventional 8 | @@ -65,8 +71,9 @@ error[ICN001]: override_default.py:9:18: `altair` should be imported as `alt` 11 | import numpy as np # unconventional | = help: Alias `altair` to `alt` -error[ICN001]: override_default.py:10:29: `matplotlib.pyplot` should be imported as `plt` +error[ICN001]: 10:29: `matplotlib.pyplot` should be imported as `plt` + --> override_default.py:10:29 | 9 | import altair as altr # unconventional 10 | import matplotlib.pyplot as plot # unconventional @@ -75,8 +82,9 @@ error[ICN001]: override_default.py:10:29: `matplotlib.pyplot` should be imported 12 | import pandas as pdas # unconventional | = help: Alias `matplotlib.pyplot` to `plt` -error[ICN001]: override_default.py:11:17: `numpy` should be imported as `nmp` +error[ICN001]: 11:17: `numpy` should be imported as `nmp` + --> override_default.py:11:17 | 9 | import altair as altr # unconventional 10 | import matplotlib.pyplot as plot # unconventional @@ -86,8 +94,9 @@ error[ICN001]: override_default.py:11:17: `numpy` should be imported as `nmp` 13 | import seaborn as sbrn # unconventional | = help: Alias `numpy` to `nmp` -error[ICN001]: override_default.py:12:18: `pandas` should be imported as `pd` +error[ICN001]: 12:18: `pandas` should be imported as `pd` + --> override_default.py:12:18 | 10 | import matplotlib.pyplot as plot # unconventional 11 | import numpy as np # unconventional @@ -96,8 +105,9 @@ error[ICN001]: override_default.py:12:18: `pandas` should be imported as `pd` 13 | import seaborn as sbrn # unconventional | = help: Alias `pandas` to `pd` -error[ICN001]: override_default.py:13:19: `seaborn` should be imported as `sns` +error[ICN001]: 13:19: `seaborn` should be imported as `sns` + --> override_default.py:13:19 | 11 | import numpy as np # unconventional 12 | import pandas as pdas # unconventional diff --git a/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__remove_defaults.snap b/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__remove_defaults.snap index 3e412489c2..4568448c2d 100644 --- a/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__remove_defaults.snap +++ b/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__remove_defaults.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_import_conventions/mod.rs --- -error[ICN001]: remove_default.py:3:8: `altair` should be imported as `alt` +error[ICN001]: 3:8: `altair` should be imported as `alt` + --> remove_default.py:3:8 | 1 | import math # not checked 2 | @@ -12,8 +13,9 @@ error[ICN001]: remove_default.py:3:8: `altair` should be imported as `alt` 5 | import numpy # not checked | = help: Alias `altair` to `alt` -error[ICN001]: remove_default.py:4:8: `matplotlib.pyplot` should be imported as `plt` +error[ICN001]: 4:8: `matplotlib.pyplot` should be imported as `plt` + --> remove_default.py:4:8 | 3 | import altair # unconventional 4 | import matplotlib.pyplot # unconventional @@ -22,8 +24,9 @@ error[ICN001]: remove_default.py:4:8: `matplotlib.pyplot` should be imported as 6 | import pandas # unconventional | = help: Alias `matplotlib.pyplot` to `plt` -error[ICN001]: remove_default.py:6:8: `pandas` should be imported as `pd` +error[ICN001]: 6:8: `pandas` should be imported as `pd` + --> remove_default.py:6:8 | 4 | import matplotlib.pyplot # unconventional 5 | import numpy # not checked @@ -32,8 +35,9 @@ error[ICN001]: remove_default.py:6:8: `pandas` should be imported as `pd` 7 | import seaborn # unconventional | = help: Alias `pandas` to `pd` -error[ICN001]: remove_default.py:7:8: `seaborn` should be imported as `sns` +error[ICN001]: 7:8: `seaborn` should be imported as `sns` + --> remove_default.py:7:8 | 5 | import numpy # not checked 6 | import pandas # unconventional @@ -43,8 +47,9 @@ error[ICN001]: remove_default.py:7:8: `seaborn` should be imported as `sns` 9 | import altair as altr # unconventional | = help: Alias `seaborn` to `sns` -error[ICN001]: remove_default.py:9:18: `altair` should be imported as `alt` +error[ICN001]: 9:18: `altair` should be imported as `alt` + --> remove_default.py:9:18 | 7 | import seaborn # unconventional 8 | @@ -54,8 +59,9 @@ error[ICN001]: remove_default.py:9:18: `altair` should be imported as `alt` 11 | import numpy as nmp # not checked | = help: Alias `altair` to `alt` -error[ICN001]: remove_default.py:10:29: `matplotlib.pyplot` should be imported as `plt` +error[ICN001]: 10:29: `matplotlib.pyplot` should be imported as `plt` + --> remove_default.py:10:29 | 9 | import altair as altr # unconventional 10 | import matplotlib.pyplot as plot # unconventional @@ -64,8 +70,9 @@ error[ICN001]: remove_default.py:10:29: `matplotlib.pyplot` should be imported a 12 | import pandas as pdas # unconventional | = help: Alias `matplotlib.pyplot` to `plt` -error[ICN001]: remove_default.py:12:18: `pandas` should be imported as `pd` +error[ICN001]: 12:18: `pandas` should be imported as `pd` + --> remove_default.py:12:18 | 10 | import matplotlib.pyplot as plot # unconventional 11 | import numpy as nmp # not checked @@ -74,8 +81,9 @@ error[ICN001]: remove_default.py:12:18: `pandas` should be imported as `pd` 13 | import seaborn as sbrn # unconventional | = help: Alias `pandas` to `pd` -error[ICN001]: remove_default.py:13:19: `seaborn` should be imported as `sns` +error[ICN001]: 13:19: `seaborn` should be imported as `sns` + --> remove_default.py:13:19 | 11 | import numpy as nmp # not checked 12 | import pandas as pdas # unconventional diff --git a/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__same_name.snap b/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__same_name.snap index f55e3bbc10..ba53d239e5 100644 --- a/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__same_name.snap +++ b/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__same_name.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_import_conventions/mod.rs --- -error[ICN001]: same_name.py:10:41: [*] `django.conf.settings` should be imported as `settings` +error[ICN001]: 10:41: [*] `django.conf.settings` should be imported as `settings` + --> same_name.py:10:41 | 9 | def unconventional_alias(): 10 | from django.conf import settings as s diff --git a/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__tricky.snap b/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__tricky.snap index 422a7e3f54..8c8835d1c5 100644 --- a/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__tricky.snap +++ b/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__tricky.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_import_conventions/mod.rs --- -error[ICN001]: tricky.py:7:16: [*] `pandas` should be imported as `pd` +error[ICN001]: 7:16: [*] `pandas` should be imported as `pd` + --> tricky.py:7:16 | 5 | try: 6 | global pandas diff --git a/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG001_LOG001.py.snap b/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG001_LOG001.py.snap index c0086de320..15f23f1e81 100644 --- a/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG001_LOG001.py.snap +++ b/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG001_LOG001.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_logging/mod.rs --- -error[LOG001]: LOG001.py:3:1: [*] Use `logging.getLogger()` to instantiate loggers +error[LOG001]: 3:1: [*] Use `logging.getLogger()` to instantiate loggers + --> LOG001.py:2:1 | 1 | import logging 2 | @@ -20,8 +21,9 @@ error[LOG001]: LOG001.py:3:1: [*] Use `logging.getLogger()` to instantiate logge 4 4 | logging.Logger() 5 5 | logging.getLogger(__name__) -error[LOG001]: LOG001.py:4:1: [*] Use `logging.getLogger()` to instantiate loggers +error[LOG001]: 4:1: [*] Use `logging.getLogger()` to instantiate loggers + --> LOG001.py:3:25 | 3 | logging.Logger(__name__) 4 | logging.Logger() diff --git a/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG002_LOG002.py.snap b/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG002_LOG002.py.snap index 62f5a08375..908bc93103 100644 --- a/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG002_LOG002.py.snap +++ b/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG002_LOG002.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_logging/mod.rs --- -error[LOG002]: LOG002.py:11:11: [*] Use `__name__` with `logging.getLogger()` +error[LOG002]: 11:11: [*] Use `__name__` with `logging.getLogger()` + --> LOG002.py:11:11 | 10 | # LOG002 11 | getLogger(__file__) @@ -20,8 +21,9 @@ error[LOG002]: LOG002.py:11:11: [*] Use `__name__` with `logging.getLogger()` 13 13 | 14 14 | logging.getLogger(__cached__) -error[LOG002]: LOG002.py:12:24: [*] Use `__name__` with `logging.getLogger()` +error[LOG002]: 12:24: [*] Use `__name__` with `logging.getLogger()` + --> LOG002.py:12:24 | 10 | # LOG002 11 | getLogger(__file__) @@ -41,8 +43,9 @@ error[LOG002]: LOG002.py:12:24: [*] Use `__name__` with `logging.getLogger()` 14 14 | logging.getLogger(__cached__) 15 15 | getLogger(name=__cached__) -error[LOG002]: LOG002.py:14:19: [*] Use `__name__` with `logging.getLogger()` +error[LOG002]: 14:19: [*] Use `__name__` with `logging.getLogger()` + --> LOG002.py:14:19 | 12 | logging.getLogger(name=__file__) 13 | @@ -61,8 +64,9 @@ error[LOG002]: LOG002.py:14:19: [*] Use `__name__` with `logging.getLogger()` 16 16 | 17 17 | -error[LOG002]: LOG002.py:15:16: [*] Use `__name__` with `logging.getLogger()` +error[LOG002]: 15:16: [*] Use `__name__` with `logging.getLogger()` + --> LOG002.py:15:16 | 14 | logging.getLogger(__cached__) 15 | getLogger(name=__cached__) diff --git a/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG007_LOG007.py.snap b/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG007_LOG007.py.snap index 180d4eedd6..561afc69df 100644 --- a/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG007_LOG007.py.snap +++ b/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG007_LOG007.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_logging/mod.rs --- -error[LOG007]: LOG007.py:6:1: Use of `logging.exception` with falsy `exc_info` +error[LOG007]: 6:1: Use of `logging.exception` with falsy `exc_info` + --> LOG007.py:5:31 | 5 | logging.exception("foo") # OK 6 | logging.exception("foo", exc_info=False) # LOG007 @@ -10,8 +11,9 @@ error[LOG007]: LOG007.py:6:1: Use of `logging.exception` with falsy `exc_info` 7 | logging.exception("foo", exc_info=[]) # LOG007 8 | logger.exception("foo") # OK | -error[LOG007]: LOG007.py:7:1: Use of `logging.exception` with falsy `exc_info` +error[LOG007]: 7:1: Use of `logging.exception` with falsy `exc_info` + --> LOG007.py:6:51 | 5 | logging.exception("foo") # OK 6 | logging.exception("foo", exc_info=False) # LOG007 @@ -20,8 +22,9 @@ error[LOG007]: LOG007.py:7:1: Use of `logging.exception` with falsy `exc_info` 8 | logger.exception("foo") # OK 9 | logger.exception("foo", exc_info=False) # LOG007 | -error[LOG007]: LOG007.py:9:1: Use of `logging.exception` with falsy `exc_info` +error[LOG007]: 9:1: Use of `logging.exception` with falsy `exc_info` + --> LOG007.py:8:30 | 7 | logging.exception("foo", exc_info=[]) # LOG007 8 | logger.exception("foo") # OK @@ -30,8 +33,9 @@ error[LOG007]: LOG007.py:9:1: Use of `logging.exception` with falsy `exc_info` 10 | logger.exception("foo", exc_info=[]) # LOG007 11 | logger.error("foo", exc_info=False) # OK | -error[LOG007]: LOG007.py:10:1: Use of `logging.exception` with falsy `exc_info` +error[LOG007]: 10:1: Use of `logging.exception` with falsy `exc_info` + --> LOG007.py:9:50 | 8 | logger.exception("foo") # OK 9 | logger.exception("foo", exc_info=False) # LOG007 @@ -40,8 +44,9 @@ error[LOG007]: LOG007.py:10:1: Use of `logging.exception` with falsy `exc_info` 11 | logger.error("foo", exc_info=False) # OK 12 | logger.info("foo", exc_info=False) # OK | -error[LOG007]: LOG007.py:17:1: Use of `logging.exception` with falsy `exc_info` +error[LOG007]: 17:1: Use of `logging.exception` with falsy `exc_info` + --> LOG007.py:16:1 | 15 | from logging import exception 16 | diff --git a/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG009_LOG009.py.snap b/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG009_LOG009.py.snap index be3ae80b78..49fdd3ffbf 100644 --- a/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG009_LOG009.py.snap +++ b/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG009_LOG009.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_logging/mod.rs --- -error[LOG009]: LOG009.py:4:5: [*] Use of undocumented `logging.WARN` constant +error[LOG009]: 4:5: [*] Use of undocumented `logging.WARN` constant + --> LOG009.py:4:5 | 2 | import logging 3 | @@ -21,8 +22,9 @@ error[LOG009]: LOG009.py:4:5: [*] Use of undocumented `logging.WARN` constant 6 6 | 7 7 | -error[LOG009]: LOG009.py:11:5: [*] Use of undocumented `logging.WARN` constant +error[LOG009]: 11:5: [*] Use of undocumented `logging.WARN` constant + --> LOG009.py:11:5 | 9 | from logging import WARN, WARNING 10 | diff --git a/crates/ruff_linter/src/rules/flake8_logging_format/snapshots/ruff_linter__rules__flake8_logging_format__tests__G001.py.snap b/crates/ruff_linter/src/rules/flake8_logging_format/snapshots/ruff_linter__rules__flake8_logging_format__tests__G001.py.snap index 1d944a91f6..5dbc52ce25 100644 --- a/crates/ruff_linter/src/rules/flake8_logging_format/snapshots/ruff_linter__rules__flake8_logging_format__tests__G001.py.snap +++ b/crates/ruff_linter/src/rules/flake8_logging_format/snapshots/ruff_linter__rules__flake8_logging_format__tests__G001.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_logging_format/mod.rs --- -error[G001]: G001.py:4:14: Logging statement uses `str.format` +error[G001]: 4:14: Logging statement uses `str.format` + --> G001.py:4:14 | 2 | import logging as foo 3 | @@ -11,8 +12,9 @@ error[G001]: G001.py:4:14: Logging statement uses `str.format` 5 | logging.log(logging.INFO, "Hello {}".format("World!")) 6 | foo.info("Hello {}".format("World!")) | -error[G001]: G001.py:5:27: Logging statement uses `str.format` +error[G001]: 5:27: Logging statement uses `str.format` + --> G001.py:5:27 | 4 | logging.info("Hello {}".format("World!")) 5 | logging.log(logging.INFO, "Hello {}".format("World!")) @@ -20,8 +22,9 @@ error[G001]: G001.py:5:27: Logging statement uses `str.format` 6 | foo.info("Hello {}".format("World!")) 7 | logging.log(logging.INFO, msg="Hello {}".format("World!")) | -error[G001]: G001.py:6:10: Logging statement uses `str.format` +error[G001]: 6:10: Logging statement uses `str.format` + --> G001.py:6:10 | 4 | logging.info("Hello {}".format("World!")) 5 | logging.log(logging.INFO, "Hello {}".format("World!")) @@ -30,8 +33,9 @@ error[G001]: G001.py:6:10: Logging statement uses `str.format` 7 | logging.log(logging.INFO, msg="Hello {}".format("World!")) 8 | logging.log(level=logging.INFO, msg="Hello {}".format("World!")) | -error[G001]: G001.py:7:31: Logging statement uses `str.format` +error[G001]: 7:31: Logging statement uses `str.format` + --> G001.py:7:31 | 5 | logging.log(logging.INFO, "Hello {}".format("World!")) 6 | foo.info("Hello {}".format("World!")) @@ -40,8 +44,9 @@ error[G001]: G001.py:7:31: Logging statement uses `str.format` 8 | logging.log(level=logging.INFO, msg="Hello {}".format("World!")) 9 | logging.log(msg="Hello {}".format("World!"), level=logging.INFO) | -error[G001]: G001.py:8:37: Logging statement uses `str.format` +error[G001]: 8:37: Logging statement uses `str.format` + --> G001.py:8:37 | 6 | foo.info("Hello {}".format("World!")) 7 | logging.log(logging.INFO, msg="Hello {}".format("World!")) @@ -49,8 +54,9 @@ error[G001]: G001.py:8:37: Logging statement uses `str.format` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ 9 | logging.log(msg="Hello {}".format("World!"), level=logging.INFO) | -error[G001]: G001.py:9:17: Logging statement uses `str.format` +error[G001]: 9:17: Logging statement uses `str.format` + --> G001.py:9:17 | 7 | logging.log(logging.INFO, msg="Hello {}".format("World!")) 8 | logging.log(level=logging.INFO, msg="Hello {}".format("World!")) @@ -59,8 +65,9 @@ error[G001]: G001.py:9:17: Logging statement uses `str.format` 10 | 11 | # Flask support | -error[G001]: G001.py:16:31: Logging statement uses `str.format` +error[G001]: 16:31: Logging statement uses `str.format` + --> G001.py:16:31 | 14 | from flask import current_app as app 15 | @@ -69,16 +76,18 @@ error[G001]: G001.py:16:31: Logging statement uses `str.format` 17 | current_app.logger.info("Hello {}".format("World!")) 18 | app.logger.log(logging.INFO, "Hello {}".format("World!")) | -error[G001]: G001.py:17:25: Logging statement uses `str.format` +error[G001]: 17:25: Logging statement uses `str.format` + --> G001.py:17:25 | 16 | flask.current_app.logger.info("Hello {}".format("World!")) 17 | current_app.logger.info("Hello {}".format("World!")) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ 18 | app.logger.log(logging.INFO, "Hello {}".format("World!")) | -error[G001]: G001.py:18:30: Logging statement uses `str.format` +error[G001]: 18:30: Logging statement uses `str.format` + --> G001.py:18:30 | 16 | flask.current_app.logger.info("Hello {}".format("World!")) 17 | current_app.logger.info("Hello {}".format("World!")) @@ -87,8 +96,9 @@ error[G001]: G001.py:18:30: Logging statement uses `str.format` 19 | 20 | from logging import info, log | -error[G001]: G001.py:22:6: Logging statement uses `str.format` +error[G001]: 22:6: Logging statement uses `str.format` + --> G001.py:22:6 | 20 | from logging import info, log 21 | @@ -97,8 +107,9 @@ error[G001]: G001.py:22:6: Logging statement uses `str.format` 23 | log(logging.INFO, "Hello {}".format("World!")) 24 | info("Hello {}".format("World!")) | -error[G001]: G001.py:23:19: Logging statement uses `str.format` +error[G001]: 23:19: Logging statement uses `str.format` + --> G001.py:23:19 | 22 | info("Hello {}".format("World!")) 23 | log(logging.INFO, "Hello {}".format("World!")) @@ -106,8 +117,9 @@ error[G001]: G001.py:23:19: Logging statement uses `str.format` 24 | info("Hello {}".format("World!")) 25 | log(logging.INFO, msg="Hello {}".format("World!")) | -error[G001]: G001.py:24:6: Logging statement uses `str.format` +error[G001]: 24:6: Logging statement uses `str.format` + --> G001.py:24:6 | 22 | info("Hello {}".format("World!")) 23 | log(logging.INFO, "Hello {}".format("World!")) @@ -116,8 +128,9 @@ error[G001]: G001.py:24:6: Logging statement uses `str.format` 25 | log(logging.INFO, msg="Hello {}".format("World!")) 26 | log(level=logging.INFO, msg="Hello {}".format("World!")) | -error[G001]: G001.py:25:23: Logging statement uses `str.format` +error[G001]: 25:23: Logging statement uses `str.format` + --> G001.py:25:23 | 23 | log(logging.INFO, "Hello {}".format("World!")) 24 | info("Hello {}".format("World!")) @@ -126,8 +139,9 @@ error[G001]: G001.py:25:23: Logging statement uses `str.format` 26 | log(level=logging.INFO, msg="Hello {}".format("World!")) 27 | log(msg="Hello {}".format("World!"), level=logging.INFO) | -error[G001]: G001.py:26:29: Logging statement uses `str.format` +error[G001]: 26:29: Logging statement uses `str.format` + --> G001.py:26:29 | 24 | info("Hello {}".format("World!")) 25 | log(logging.INFO, msg="Hello {}".format("World!")) @@ -135,8 +149,9 @@ error[G001]: G001.py:26:29: Logging statement uses `str.format` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ 27 | log(msg="Hello {}".format("World!"), level=logging.INFO) | -error[G001]: G001.py:27:9: Logging statement uses `str.format` +error[G001]: 27:9: Logging statement uses `str.format` + --> G001.py:27:9 | 25 | log(logging.INFO, msg="Hello {}".format("World!")) 26 | log(level=logging.INFO, msg="Hello {}".format("World!")) diff --git a/crates/ruff_linter/src/rules/flake8_logging_format/snapshots/ruff_linter__rules__flake8_logging_format__tests__G002.py.snap b/crates/ruff_linter/src/rules/flake8_logging_format/snapshots/ruff_linter__rules__flake8_logging_format__tests__G002.py.snap index 6065d773c3..dbef608717 100644 --- a/crates/ruff_linter/src/rules/flake8_logging_format/snapshots/ruff_linter__rules__flake8_logging_format__tests__G002.py.snap +++ b/crates/ruff_linter/src/rules/flake8_logging_format/snapshots/ruff_linter__rules__flake8_logging_format__tests__G002.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_logging_format/mod.rs --- -error[G002]: G002.py:3:14: Logging statement uses `%` +error[G002]: 3:14: Logging statement uses `%` + --> G002.py:3:14 | 1 | import logging 2 | @@ -10,8 +11,9 @@ error[G002]: G002.py:3:14: Logging statement uses `%` | ^^^^^^^^^^^^^^^^^^^^^ 4 | logging.log(logging.INFO, "Hello %s" % "World!") | -error[G002]: G002.py:4:27: Logging statement uses `%` +error[G002]: 4:27: Logging statement uses `%` + --> G002.py:4:27 | 3 | logging.info("Hello %s" % "World!") 4 | logging.log(logging.INFO, "Hello %s" % "World!") @@ -19,8 +21,9 @@ error[G002]: G002.py:4:27: Logging statement uses `%` 5 | 6 | from logging import info, log | -error[G002]: G002.py:8:6: Logging statement uses `%` +error[G002]: 8:6: Logging statement uses `%` + --> G002.py:8:6 | 6 | from logging import info, log 7 | @@ -28,8 +31,9 @@ error[G002]: G002.py:8:6: Logging statement uses `%` | ^^^^^^^^^^^^^^^^^^^^^ 9 | log(logging.INFO, "Hello %s" % "World!") | -error[G002]: G002.py:9:19: Logging statement uses `%` +error[G002]: 9:19: Logging statement uses `%` + --> G002.py:9:19 | 8 | info("Hello %s" % "World!") 9 | log(logging.INFO, "Hello %s" % "World!") diff --git a/crates/ruff_linter/src/rules/flake8_logging_format/snapshots/ruff_linter__rules__flake8_logging_format__tests__G003.py.snap b/crates/ruff_linter/src/rules/flake8_logging_format/snapshots/ruff_linter__rules__flake8_logging_format__tests__G003.py.snap index 55f5428404..87d87cb1cf 100644 --- a/crates/ruff_linter/src/rules/flake8_logging_format/snapshots/ruff_linter__rules__flake8_logging_format__tests__G003.py.snap +++ b/crates/ruff_linter/src/rules/flake8_logging_format/snapshots/ruff_linter__rules__flake8_logging_format__tests__G003.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_logging_format/mod.rs --- -error[G003]: G003.py:3:14: Logging statement uses `+` +error[G003]: 3:14: Logging statement uses `+` + --> G003.py:3:14 | 1 | import logging 2 | @@ -10,8 +11,9 @@ error[G003]: G003.py:3:14: Logging statement uses `+` | ^^^^^^^^^^^^^^^^^^^^^^^^ 4 | logging.log(logging.INFO, "Hello" + " " + "World!") | -error[G003]: G003.py:4:27: Logging statement uses `+` +error[G003]: 4:27: Logging statement uses `+` + --> G003.py:4:27 | 3 | logging.info("Hello" + " " + "World!") 4 | logging.log(logging.INFO, "Hello" + " " + "World!") @@ -19,8 +21,9 @@ error[G003]: G003.py:4:27: Logging statement uses `+` 5 | 6 | from logging import info, log | -error[G003]: G003.py:8:6: Logging statement uses `+` +error[G003]: 8:6: Logging statement uses `+` + --> G003.py:8:6 | 6 | from logging import info, log 7 | @@ -28,8 +31,9 @@ error[G003]: G003.py:8:6: Logging statement uses `+` | ^^^^^^^^^^^^^^^^^^^^^^^^ 9 | log(logging.INFO, "Hello" + " " + "World!") | -error[G003]: G003.py:9:19: Logging statement uses `+` +error[G003]: 9:19: Logging statement uses `+` + --> G003.py:9:19 | 8 | info("Hello" + " " + "World!") 9 | log(logging.INFO, "Hello" + " " + "World!") diff --git a/crates/ruff_linter/src/rules/flake8_logging_format/snapshots/ruff_linter__rules__flake8_logging_format__tests__G004.py.snap b/crates/ruff_linter/src/rules/flake8_logging_format/snapshots/ruff_linter__rules__flake8_logging_format__tests__G004.py.snap index 3ee94eabbe..883d9e34ae 100644 --- a/crates/ruff_linter/src/rules/flake8_logging_format/snapshots/ruff_linter__rules__flake8_logging_format__tests__G004.py.snap +++ b/crates/ruff_linter/src/rules/flake8_logging_format/snapshots/ruff_linter__rules__flake8_logging_format__tests__G004.py.snap @@ -1,16 +1,18 @@ --- source: crates/ruff_linter/src/rules/flake8_logging_format/mod.rs --- -error[G004]: G004.py:4:14: Logging statement uses f-string +error[G004]: 4:14: Logging statement uses f-string + --> G004.py:4:14 | 3 | name = "world" 4 | logging.info(f"Hello {name}") | ^^^^^^^^^^^^^^^ 5 | logging.log(logging.INFO, f"Hello {name}") | -error[G004]: G004.py:5:27: Logging statement uses f-string +error[G004]: 5:27: Logging statement uses f-string + --> G004.py:5:27 | 3 | name = "world" 4 | logging.info(f"Hello {name}") @@ -19,8 +21,9 @@ error[G004]: G004.py:5:27: Logging statement uses f-string 6 | 7 | _LOGGER = logging.getLogger() | -error[G004]: G004.py:8:14: Logging statement uses f-string +error[G004]: 8:14: Logging statement uses f-string + --> G004.py:8:14 | 7 | _LOGGER = logging.getLogger() 8 | _LOGGER.info(f"{__name__}") @@ -28,8 +31,9 @@ error[G004]: G004.py:8:14: Logging statement uses f-string 9 | 10 | logging.getLogger().info(f"{name}") | -error[G004]: G004.py:10:26: Logging statement uses f-string +error[G004]: 10:26: Logging statement uses f-string + --> G004.py:10:26 | 8 | _LOGGER.info(f"{__name__}") 9 | @@ -38,8 +42,9 @@ error[G004]: G004.py:10:26: Logging statement uses f-string 11 | 12 | from logging import info | -error[G004]: G004.py:14:6: Logging statement uses f-string +error[G004]: 14:6: Logging statement uses f-string + --> G004.py:14:6 | 12 | from logging import info 13 | @@ -47,8 +52,9 @@ error[G004]: G004.py:14:6: Logging statement uses f-string | ^^^^^^^^^ 15 | info(f"{__name__}") | -error[G004]: G004.py:15:6: Logging statement uses f-string +error[G004]: 15:6: Logging statement uses f-string + --> G004.py:15:6 | 14 | info(f"{name}") 15 | info(f"{__name__}") diff --git a/crates/ruff_linter/src/rules/flake8_logging_format/snapshots/ruff_linter__rules__flake8_logging_format__tests__G010.py.snap b/crates/ruff_linter/src/rules/flake8_logging_format/snapshots/ruff_linter__rules__flake8_logging_format__tests__G010.py.snap index 3e63f1bfba..163bd86f66 100644 --- a/crates/ruff_linter/src/rules/flake8_logging_format/snapshots/ruff_linter__rules__flake8_logging_format__tests__G010.py.snap +++ b/crates/ruff_linter/src/rules/flake8_logging_format/snapshots/ruff_linter__rules__flake8_logging_format__tests__G010.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_logging_format/mod.rs --- -error[G010]: G010.py:6:9: [*] Logging statement uses `warn` instead of `warning` +error[G010]: 6:9: [*] Logging statement uses `warn` instead of `warning` + --> G010.py:6:9 | 4 | from logging_setup import logger 5 | @@ -22,8 +23,9 @@ error[G010]: G010.py:6:9: [*] Logging statement uses `warn` instead of `warning` 8 8 | logger.warn("Hello world!") 9 9 | -error[G010]: G010.py:8:8: [*] Logging statement uses `warn` instead of `warning` +error[G010]: 8:8: [*] Logging statement uses `warn` instead of `warning` + --> G010.py:8:8 | 6 | logging.warn("Hello World!") 7 | log.warn("Hello world!") # This shouldn't be considered as a logger candidate @@ -43,8 +45,9 @@ error[G010]: G010.py:8:8: [*] Logging statement uses `warn` instead of `warning` 10 10 | logging . warn("Hello World!") 11 11 | -error[G010]: G010.py:10:11: [*] Logging statement uses `warn` instead of `warning` +error[G010]: 10:11: [*] Logging statement uses `warn` instead of `warning` + --> G010.py:10:11 | 8 | logger.warn("Hello world!") 9 | @@ -64,8 +67,9 @@ error[G010]: G010.py:10:11: [*] Logging statement uses `warn` instead of `warnin 12 12 | from logging import warn, warning, exception 13 13 | warn("foo") -error[G010]: G010.py:13:1: [*] Logging statement uses `warn` instead of `warning` +error[G010]: 13:1: [*] Logging statement uses `warn` instead of `warning` + --> G010.py:12:45 | 12 | from logging import warn, warning, exception 13 | warn("foo") diff --git a/crates/ruff_linter/src/rules/flake8_logging_format/snapshots/ruff_linter__rules__flake8_logging_format__tests__G101_1.py.snap b/crates/ruff_linter/src/rules/flake8_logging_format/snapshots/ruff_linter__rules__flake8_logging_format__tests__G101_1.py.snap index 2a1e8e6231..ade8501ae5 100644 --- a/crates/ruff_linter/src/rules/flake8_logging_format/snapshots/ruff_linter__rules__flake8_logging_format__tests__G101_1.py.snap +++ b/crates/ruff_linter/src/rules/flake8_logging_format/snapshots/ruff_linter__rules__flake8_logging_format__tests__G101_1.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_logging_format/mod.rs --- -error[G101]: G101_1.py:6:9: Logging statement uses an `extra` field that clashes with a `LogRecord` field: `name` +error[G101]: 6:9: Logging statement uses an `extra` field that clashes with a `LogRecord` field: `name` + --> G101_1.py:6:9 | 4 | "Hello world!", 5 | extra={ @@ -11,8 +12,9 @@ error[G101]: G101_1.py:6:9: Logging statement uses an `extra` field that clashes 7 | }, 8 | ) | -error[G101]: G101_1.py:15:9: Logging statement uses an `extra` field that clashes with a `LogRecord` field: `name` +error[G101]: 15:9: Logging statement uses an `extra` field that clashes with a `LogRecord` field: `name` + --> G101_1.py:15:9 | 13 | "Hello world!", 14 | extra={ diff --git a/crates/ruff_linter/src/rules/flake8_logging_format/snapshots/ruff_linter__rules__flake8_logging_format__tests__G101_2.py.snap b/crates/ruff_linter/src/rules/flake8_logging_format/snapshots/ruff_linter__rules__flake8_logging_format__tests__G101_2.py.snap index c456a1e133..0e372d1d9a 100644 --- a/crates/ruff_linter/src/rules/flake8_logging_format/snapshots/ruff_linter__rules__flake8_logging_format__tests__G101_2.py.snap +++ b/crates/ruff_linter/src/rules/flake8_logging_format/snapshots/ruff_linter__rules__flake8_logging_format__tests__G101_2.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_logging_format/mod.rs --- -error[G101]: G101_2.py:6:9: Logging statement uses an `extra` field that clashes with a `LogRecord` field: `name` +error[G101]: 6:9: Logging statement uses an `extra` field that clashes with a `LogRecord` field: `name` + --> G101_2.py:6:9 | 4 | "Hello world!", 5 | extra=dict( @@ -11,8 +12,9 @@ error[G101]: G101_2.py:6:9: Logging statement uses an `extra` field that clashes 7 | ), 8 | ) | -error[G101]: G101_2.py:15:9: Logging statement uses an `extra` field that clashes with a `LogRecord` field: `name` +error[G101]: 15:9: Logging statement uses an `extra` field that clashes with a `LogRecord` field: `name` + --> G101_2.py:15:9 | 13 | "Hello world!", 14 | extra=dict( diff --git a/crates/ruff_linter/src/rules/flake8_logging_format/snapshots/ruff_linter__rules__flake8_logging_format__tests__G201.py.snap b/crates/ruff_linter/src/rules/flake8_logging_format/snapshots/ruff_linter__rules__flake8_logging_format__tests__G201.py.snap index 980edf1870..f119307626 100644 --- a/crates/ruff_linter/src/rules/flake8_logging_format/snapshots/ruff_linter__rules__flake8_logging_format__tests__G201.py.snap +++ b/crates/ruff_linter/src/rules/flake8_logging_format/snapshots/ruff_linter__rules__flake8_logging_format__tests__G201.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_logging_format/mod.rs --- -error[G201]: G201.py:8:13: Logging `.exception(...)` should be used instead of `.error(..., exc_info=True)` +error[G201]: 8:13: Logging `.exception(...)` should be used instead of `.error(..., exc_info=True)` + --> G201.py:8:13 | 6 | pass 7 | except: @@ -11,8 +12,9 @@ error[G201]: G201.py:8:13: Logging `.exception(...)` should be used instead of ` 9 | 10 | try: | -error[G201]: G201.py:13:13: Logging `.exception(...)` should be used instead of `.error(..., exc_info=True)` +error[G201]: 13:13: Logging `.exception(...)` should be used instead of `.error(..., exc_info=True)` + --> G201.py:13:13 | 11 | pass 12 | except: @@ -21,8 +23,9 @@ error[G201]: G201.py:13:13: Logging `.exception(...)` should be used instead of 14 | 15 | # OK | -error[G201]: G201.py:28:5: Logging `.exception(...)` should be used instead of `.error(..., exc_info=True)` +error[G201]: 28:5: Logging `.exception(...)` should be used instead of `.error(..., exc_info=True)` + --> G201.py:28:5 | 26 | pass 27 | except: @@ -31,8 +34,9 @@ error[G201]: G201.py:28:5: Logging `.exception(...)` should be used instead of ` 29 | 30 | try: | -error[G201]: G201.py:33:5: Logging `.exception(...)` should be used instead of `.error(..., exc_info=True)` +error[G201]: 33:5: Logging `.exception(...)` should be used instead of `.error(..., exc_info=True)` + --> G201.py:33:5 | 31 | pass 32 | except: diff --git a/crates/ruff_linter/src/rules/flake8_logging_format/snapshots/ruff_linter__rules__flake8_logging_format__tests__G202.py.snap b/crates/ruff_linter/src/rules/flake8_logging_format/snapshots/ruff_linter__rules__flake8_logging_format__tests__G202.py.snap index d99412f176..40edc8700f 100644 --- a/crates/ruff_linter/src/rules/flake8_logging_format/snapshots/ruff_linter__rules__flake8_logging_format__tests__G202.py.snap +++ b/crates/ruff_linter/src/rules/flake8_logging_format/snapshots/ruff_linter__rules__flake8_logging_format__tests__G202.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_logging_format/mod.rs --- -error[G202]: G202.py:8:38: Logging statement has redundant `exc_info` +error[G202]: 8:38: Logging statement has redundant `exc_info` + --> G202.py:8:38 | 6 | pass 7 | except: @@ -11,8 +12,9 @@ error[G202]: G202.py:8:38: Logging statement has redundant `exc_info` 9 | 10 | try: | -error[G202]: G202.py:13:38: Logging statement has redundant `exc_info` +error[G202]: 13:38: Logging statement has redundant `exc_info` + --> G202.py:13:38 | 11 | pass 12 | except: @@ -21,8 +23,9 @@ error[G202]: G202.py:13:38: Logging statement has redundant `exc_info` 14 | 15 | # OK | -error[G202]: G202.py:28:30: Logging statement has redundant `exc_info` +error[G202]: 28:30: Logging statement has redundant `exc_info` + --> G202.py:28:30 | 26 | pass 27 | except: @@ -31,8 +34,9 @@ error[G202]: G202.py:28:30: Logging statement has redundant `exc_info` 29 | 30 | try: | -error[G202]: G202.py:33:30: Logging statement has redundant `exc_info` +error[G202]: 33:30: Logging statement has redundant `exc_info` + --> G202.py:33:30 | 31 | pass 32 | except: diff --git a/crates/ruff_linter/src/rules/flake8_no_pep420/snapshots/ruff_linter__rules__flake8_no_pep420__tests__test_fail_empty.snap b/crates/ruff_linter/src/rules/flake8_no_pep420/snapshots/ruff_linter__rules__flake8_no_pep420__tests__test_fail_empty.snap index 764fcdac4b..47bc2ecb8d 100644 --- a/crates/ruff_linter/src/rules/flake8_no_pep420/snapshots/ruff_linter__rules__flake8_no_pep420__tests__test_fail_empty.snap +++ b/crates/ruff_linter/src/rules/flake8_no_pep420/snapshots/ruff_linter__rules__flake8_no_pep420__tests__test_fail_empty.snap @@ -1,4 +1,4 @@ --- source: crates/ruff_linter/src/rules/flake8_no_pep420/mod.rs --- -example.py:1:1: INP001 File `./resources/test/fixtures/flake8_no_pep420/test_fail_empty/example.py` is part of an implicit namespace package. Add an `__init__.py`. +error[INP001]: 1:1: File `./resources/test/fixtures/flake8_no_pep420/test_fail_empty/example.py` is part of an implicit namespace package. Add an `__init__.py`. diff --git a/crates/ruff_linter/src/rules/flake8_no_pep420/snapshots/ruff_linter__rules__flake8_no_pep420__tests__test_fail_nonempty.snap b/crates/ruff_linter/src/rules/flake8_no_pep420/snapshots/ruff_linter__rules__flake8_no_pep420__tests__test_fail_nonempty.snap index dfbb8bccba..6403cb7180 100644 --- a/crates/ruff_linter/src/rules/flake8_no_pep420/snapshots/ruff_linter__rules__flake8_no_pep420__tests__test_fail_nonempty.snap +++ b/crates/ruff_linter/src/rules/flake8_no_pep420/snapshots/ruff_linter__rules__flake8_no_pep420__tests__test_fail_nonempty.snap @@ -1,4 +1,4 @@ --- source: crates/ruff_linter/src/rules/flake8_no_pep420/mod.rs --- -example.py:1:1: INP001 File `./resources/test/fixtures/flake8_no_pep420/test_fail_nonempty/example.py` is part of an implicit namespace package. Add an `__init__.py`. +error[INP001]: 1:1: File `./resources/test/fixtures/flake8_no_pep420/test_fail_nonempty/example.py` is part of an implicit namespace package. Add an `__init__.py`. diff --git a/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE790_PIE790.py.snap b/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE790_PIE790.py.snap index a686061ab3..bc186ceb78 100644 --- a/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE790_PIE790.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE790_PIE790.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pie/mod.rs --- -error[PIE790]: PIE790.py:4:5: [*] Unnecessary `pass` statement +error[PIE790]: 4:5: [*] Unnecessary `pass` statement + --> PIE790.py:4:5 | 2 | """buzz""" 3 | @@ -19,8 +20,9 @@ error[PIE790]: PIE790.py:4:5: [*] Unnecessary `pass` statement 6 5 | 7 6 | if foo: -error[PIE790]: PIE790.py:9:5: [*] Unnecessary `pass` statement +error[PIE790]: 9:5: [*] Unnecessary `pass` statement + --> PIE790.py:9:5 | 7 | if foo: 8 | """foo""" @@ -37,8 +39,9 @@ error[PIE790]: PIE790.py:9:5: [*] Unnecessary `pass` statement 11 10 | 12 11 | def multi_statement() -> None: -error[PIE790]: PIE790.py:14:5: [*] Unnecessary `pass` statement +error[PIE790]: 14:5: [*] Unnecessary `pass` statement + --> PIE790.py:14:5 | 12 | def multi_statement() -> None: 13 | """This is a function.""" @@ -56,8 +59,9 @@ error[PIE790]: PIE790.py:14:5: [*] Unnecessary `pass` statement 16 16 | 17 17 | if foo: -error[PIE790]: PIE790.py:21:5: [*] Unnecessary `pass` statement +error[PIE790]: 21:5: [*] Unnecessary `pass` statement + --> PIE790.py:21:5 | 19 | else: 20 | """bar""" @@ -74,8 +78,9 @@ error[PIE790]: PIE790.py:21:5: [*] Unnecessary `pass` statement 23 22 | 24 23 | while True: -error[PIE790]: PIE790.py:28:5: [*] Unnecessary `pass` statement +error[PIE790]: 28:5: [*] Unnecessary `pass` statement + --> PIE790.py:28:5 | 26 | else: 27 | """bar""" @@ -92,8 +97,9 @@ error[PIE790]: PIE790.py:28:5: [*] Unnecessary `pass` statement 30 29 | 31 30 | for _ in range(10): -error[PIE790]: PIE790.py:35:5: [*] Unnecessary `pass` statement +error[PIE790]: 35:5: [*] Unnecessary `pass` statement + --> PIE790.py:35:5 | 33 | else: 34 | """bar""" @@ -110,8 +116,9 @@ error[PIE790]: PIE790.py:35:5: [*] Unnecessary `pass` statement 37 36 | 38 37 | async for _ in range(10): -error[PIE790]: PIE790.py:42:5: [*] Unnecessary `pass` statement +error[PIE790]: 42:5: [*] Unnecessary `pass` statement + --> PIE790.py:42:5 | 40 | else: 41 | """bar""" @@ -128,8 +135,9 @@ error[PIE790]: PIE790.py:42:5: [*] Unnecessary `pass` statement 44 43 | 45 44 | def foo() -> None: -error[PIE790]: PIE790.py:50:5: [*] Unnecessary `pass` statement +error[PIE790]: 50:5: [*] Unnecessary `pass` statement + --> PIE790.py:50:5 | 48 | """ 49 | @@ -146,8 +154,9 @@ error[PIE790]: PIE790.py:50:5: [*] Unnecessary `pass` statement 52 51 | 53 52 | async def foo(): -error[PIE790]: PIE790.py:58:5: [*] Unnecessary `pass` statement +error[PIE790]: 58:5: [*] Unnecessary `pass` statement + --> PIE790.py:58:5 | 56 | """ 57 | @@ -164,8 +173,9 @@ error[PIE790]: PIE790.py:58:5: [*] Unnecessary `pass` statement 60 59 | 61 60 | try: -error[PIE790]: PIE790.py:65:5: [*] Unnecessary `pass` statement +error[PIE790]: 65:5: [*] Unnecessary `pass` statement + --> PIE790.py:65:5 | 63 | buzz 64 | """ @@ -184,8 +194,9 @@ error[PIE790]: PIE790.py:65:5: [*] Unnecessary `pass` statement 67 66 | pass 68 67 | -error[PIE790]: PIE790.py:74:5: [*] Unnecessary `pass` statement +error[PIE790]: 74:5: [*] Unnecessary `pass` statement + --> PIE790.py:74:5 | 72 | except ValueError: 73 | """bar""" @@ -202,8 +213,9 @@ error[PIE790]: PIE790.py:74:5: [*] Unnecessary `pass` statement 76 75 | 77 76 | for _ in range(10): -error[PIE790]: PIE790.py:79:5: [*] Unnecessary `pass` statement +error[PIE790]: 79:5: [*] Unnecessary `pass` statement + --> PIE790.py:79:5 | 77 | for _ in range(10): 78 | """buzz""" @@ -222,8 +234,9 @@ error[PIE790]: PIE790.py:79:5: [*] Unnecessary `pass` statement 81 80 | async for _ in range(10): 82 81 | """buzz""" -error[PIE790]: PIE790.py:83:5: [*] Unnecessary `pass` statement +error[PIE790]: 83:5: [*] Unnecessary `pass` statement + --> PIE790.py:83:5 | 81 | async for _ in range(10): 82 | """buzz""" @@ -242,8 +255,9 @@ error[PIE790]: PIE790.py:83:5: [*] Unnecessary `pass` statement 85 84 | while cond: 86 85 | """buzz""" -error[PIE790]: PIE790.py:87:5: [*] Unnecessary `pass` statement +error[PIE790]: 87:5: [*] Unnecessary `pass` statement + --> PIE790.py:87:5 | 85 | while cond: 86 | """buzz""" @@ -260,8 +274,9 @@ error[PIE790]: PIE790.py:87:5: [*] Unnecessary `pass` statement 89 88 | 90 89 | with bar: -error[PIE790]: PIE790.py:92:5: [*] Unnecessary `pass` statement +error[PIE790]: 92:5: [*] Unnecessary `pass` statement + --> PIE790.py:92:5 | 90 | with bar: 91 | """buzz""" @@ -280,8 +295,9 @@ error[PIE790]: PIE790.py:92:5: [*] Unnecessary `pass` statement 94 93 | async with bar: 95 94 | """buzz""" -error[PIE790]: PIE790.py:96:5: [*] Unnecessary `pass` statement +error[PIE790]: 96:5: [*] Unnecessary `pass` statement + --> PIE790.py:96:5 | 94 | async with bar: 95 | """buzz""" @@ -298,8 +314,9 @@ error[PIE790]: PIE790.py:96:5: [*] Unnecessary `pass` statement 98 97 | 99 98 | def foo() -> None: -error[PIE790]: PIE790.py:101:5: [*] Unnecessary `pass` statement +error[PIE790]: 101:5: [*] Unnecessary `pass` statement + --> PIE790.py:101:5 | 99 | def foo() -> None: 100 | """buzz""" @@ -317,8 +334,9 @@ error[PIE790]: PIE790.py:101:5: [*] Unnecessary `pass` statement 103 103 | 104 104 | class Foo: -error[PIE790]: PIE790.py:130:5: [*] Unnecessary `pass` statement +error[PIE790]: 130:5: [*] Unnecessary `pass` statement + --> PIE790.py:130:5 | 128 | def foo(): 129 | print("foo") @@ -335,8 +353,9 @@ error[PIE790]: PIE790.py:130:5: [*] Unnecessary `pass` statement 132 131 | 133 132 | def foo(): -error[PIE790]: PIE790.py:136:5: [*] Unnecessary `pass` statement +error[PIE790]: 136:5: [*] Unnecessary `pass` statement + --> PIE790.py:136:5 | 134 | """A docstring.""" 135 | print("foo") @@ -353,8 +372,9 @@ error[PIE790]: PIE790.py:136:5: [*] Unnecessary `pass` statement 138 137 | 139 138 | for i in range(10): -error[PIE790]: PIE790.py:140:5: [*] Unnecessary `pass` statement +error[PIE790]: 140:5: [*] Unnecessary `pass` statement + --> PIE790.py:140:5 | 139 | for i in range(10): 140 | pass @@ -371,8 +391,9 @@ error[PIE790]: PIE790.py:140:5: [*] Unnecessary `pass` statement 143 142 | for i in range(10): 144 143 | pass -error[PIE790]: PIE790.py:141:5: [*] Unnecessary `pass` statement +error[PIE790]: 141:5: [*] Unnecessary `pass` statement + --> PIE790.py:141:5 | 139 | for i in range(10): 140 | pass @@ -391,8 +412,9 @@ error[PIE790]: PIE790.py:141:5: [*] Unnecessary `pass` statement 143 142 | for i in range(10): 144 143 | pass -error[PIE790]: PIE790.py:144:5: [*] Unnecessary `pass` statement +error[PIE790]: 144:5: [*] Unnecessary `pass` statement + --> PIE790.py:144:5 | 143 | for i in range(10): 144 | pass @@ -410,8 +432,9 @@ error[PIE790]: PIE790.py:144:5: [*] Unnecessary `pass` statement 146 145 | pass 147 146 | -error[PIE790]: PIE790.py:146:5: [*] Unnecessary `pass` statement +error[PIE790]: 146:5: [*] Unnecessary `pass` statement + --> PIE790.py:146:5 | 144 | pass 145 | @@ -430,8 +453,9 @@ error[PIE790]: PIE790.py:146:5: [*] Unnecessary `pass` statement 148 147 | for i in range(10): 149 148 | pass # comment -error[PIE790]: PIE790.py:149:5: [*] Unnecessary `pass` statement +error[PIE790]: 149:5: [*] Unnecessary `pass` statement + --> PIE790.py:149:5 | 148 | for i in range(10): 149 | pass # comment @@ -449,8 +473,9 @@ error[PIE790]: PIE790.py:149:5: [*] Unnecessary `pass` statement 151 151 | 152 152 | -error[PIE790]: PIE790.py:150:5: [*] Unnecessary `pass` statement +error[PIE790]: 150:5: [*] Unnecessary `pass` statement + --> PIE790.py:150:5 | 148 | for i in range(10): 149 | pass # comment @@ -467,8 +492,9 @@ error[PIE790]: PIE790.py:150:5: [*] Unnecessary `pass` statement 152 151 | 153 152 | def foo(): -error[PIE790]: PIE790.py:155:5: [*] Unnecessary `...` literal +error[PIE790]: 155:5: [*] Unnecessary `...` literal + --> PIE790.py:155:5 | 153 | def foo(): 154 | print("foo") @@ -485,8 +511,9 @@ error[PIE790]: PIE790.py:155:5: [*] Unnecessary `...` literal 157 156 | 158 157 | def foo(): -error[PIE790]: PIE790.py:161:5: [*] Unnecessary `...` literal +error[PIE790]: 161:5: [*] Unnecessary `...` literal + --> PIE790.py:161:5 | 159 | """A docstring.""" 160 | print("foo") @@ -503,8 +530,9 @@ error[PIE790]: PIE790.py:161:5: [*] Unnecessary `...` literal 163 162 | 164 163 | for i in range(10): -error[PIE790]: PIE790.py:165:5: [*] Unnecessary `...` literal +error[PIE790]: 165:5: [*] Unnecessary `...` literal + --> PIE790.py:165:5 | 164 | for i in range(10): 165 | ... @@ -521,8 +549,9 @@ error[PIE790]: PIE790.py:165:5: [*] Unnecessary `...` literal 168 167 | for i in range(10): 169 168 | ... -error[PIE790]: PIE790.py:166:5: [*] Unnecessary `...` literal +error[PIE790]: 166:5: [*] Unnecessary `...` literal + --> PIE790.py:166:5 | 164 | for i in range(10): 165 | ... @@ -541,8 +570,9 @@ error[PIE790]: PIE790.py:166:5: [*] Unnecessary `...` literal 168 167 | for i in range(10): 169 168 | ... -error[PIE790]: PIE790.py:169:5: [*] Unnecessary `...` literal +error[PIE790]: 169:5: [*] Unnecessary `...` literal + --> PIE790.py:169:5 | 168 | for i in range(10): 169 | ... @@ -560,8 +590,9 @@ error[PIE790]: PIE790.py:169:5: [*] Unnecessary `...` literal 171 170 | ... 172 171 | -error[PIE790]: PIE790.py:171:5: [*] Unnecessary `...` literal +error[PIE790]: 171:5: [*] Unnecessary `...` literal + --> PIE790.py:171:5 | 169 | ... 170 | @@ -580,8 +611,9 @@ error[PIE790]: PIE790.py:171:5: [*] Unnecessary `...` literal 173 172 | for i in range(10): 174 173 | ... # comment -error[PIE790]: PIE790.py:174:5: [*] Unnecessary `...` literal +error[PIE790]: 174:5: [*] Unnecessary `...` literal + --> PIE790.py:174:5 | 173 | for i in range(10): 174 | ... # comment @@ -599,8 +631,9 @@ error[PIE790]: PIE790.py:174:5: [*] Unnecessary `...` literal 176 176 | 177 177 | for i in range(10): -error[PIE790]: PIE790.py:175:5: [*] Unnecessary `...` literal +error[PIE790]: 175:5: [*] Unnecessary `...` literal + --> PIE790.py:175:5 | 173 | for i in range(10): 174 | ... # comment @@ -619,8 +652,9 @@ error[PIE790]: PIE790.py:175:5: [*] Unnecessary `...` literal 177 176 | for i in range(10): 178 177 | ... -error[PIE790]: PIE790.py:178:5: [*] Unnecessary `...` literal +error[PIE790]: 178:5: [*] Unnecessary `...` literal + --> PIE790.py:178:5 | 177 | for i in range(10): 178 | ... @@ -637,8 +671,9 @@ error[PIE790]: PIE790.py:178:5: [*] Unnecessary `...` literal 180 179 | 181 180 | from typing import Protocol -error[PIE790]: PIE790.py:179:5: [*] Unnecessary `pass` statement +error[PIE790]: 179:5: [*] Unnecessary `pass` statement + --> PIE790.py:179:5 | 177 | for i in range(10): 178 | ... @@ -657,8 +692,9 @@ error[PIE790]: PIE790.py:179:5: [*] Unnecessary `pass` statement 181 180 | from typing import Protocol 182 181 | -error[PIE790]: PIE790.py:209:9: [*] Unnecessary `...` literal +error[PIE790]: 209:9: [*] Unnecessary `...` literal + --> PIE790.py:209:9 | 207 | def stub(self) -> str: 208 | """Docstring""" diff --git a/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE794_PIE794.py.snap b/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE794_PIE794.py.snap index e04d1c87cc..4dac36b37d 100644 --- a/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE794_PIE794.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE794_PIE794.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pie/mod.rs --- -error[PIE794]: PIE794.py:4:5: [*] Class field `name` is defined multiple times +error[PIE794]: 4:5: [*] Class field `name` is defined multiple times + --> PIE794.py:4:5 | 2 | name = StringField() 3 | # .... @@ -21,8 +22,9 @@ error[PIE794]: PIE794.py:4:5: [*] Class field `name` is defined multiple times 6 5 | def remove(self) -> None: 7 6 | ... -error[PIE794]: PIE794.py:13:5: [*] Class field `name` is defined multiple times +error[PIE794]: 13:5: [*] Class field `name` is defined multiple times + --> PIE794.py:13:5 | 11 | name: str = StringField() 12 | # .... @@ -41,8 +43,9 @@ error[PIE794]: PIE794.py:13:5: [*] Class field `name` is defined multiple times 15 14 | def foo(self) -> None: 16 15 | ... -error[PIE794]: PIE794.py:23:5: [*] Class field `bar` is defined multiple times +error[PIE794]: 23:5: [*] Class field `bar` is defined multiple times + --> PIE794.py:23:5 | 21 | foo: bool = BooleanField() 22 | # ... @@ -59,8 +62,9 @@ error[PIE794]: PIE794.py:23:5: [*] Class field `bar` is defined multiple times 25 24 | 26 25 | class User(BaseModel): -error[PIE794]: PIE794.py:40:5: [*] Class field `bar` is defined multiple times +error[PIE794]: 40:5: [*] Class field `bar` is defined multiple times + --> PIE794.py:40:5 | 38 | foo: bool = BooleanField() 39 | # ... @@ -77,8 +81,9 @@ error[PIE794]: PIE794.py:40:5: [*] Class field `bar` is defined multiple times 42 41 | 43 42 | class Person: -error[PIE794]: PIE794.py:46:5: [*] Class field `name` is defined multiple times +error[PIE794]: 46:5: [*] Class field `name` is defined multiple times + --> PIE794.py:46:5 | 44 | name = "Foo" 45 | name = name + " Bar" @@ -95,8 +100,9 @@ error[PIE794]: PIE794.py:46:5: [*] Class field `name` is defined multiple times 48 47 | 49 48 | class Person: -error[PIE794]: PIE794.py:52:5: [*] Class field `name` is defined multiple times +error[PIE794]: 52:5: [*] Class field `name` is defined multiple times + --> PIE794.py:52:5 | 50 | name: str = "Foo" 51 | name: str = name + " Bar" diff --git a/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE796_PIE796.py.snap b/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE796_PIE796.py.snap index 6950136c97..dbade04011 100644 --- a/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE796_PIE796.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE796_PIE796.py.snap @@ -1,64 +1,72 @@ --- source: crates/ruff_linter/src/rules/flake8_pie/mod.rs --- -error[PIE796]: PIE796.py:8:5: Enum contains duplicate value: `"B"` +error[PIE796]: 8:5: Enum contains duplicate value: `"B"` + --> PIE796.py:8:5 | 6 | A = "A" 7 | B = "B" 8 | C = "B" # PIE796 | ^^^^^^^ | -error[PIE796]: PIE796.py:14:5: Enum contains duplicate value: `2` +error[PIE796]: 14:5: Enum contains duplicate value: `2` + --> PIE796.py:14:5 | 12 | A = 1 13 | B = 2 14 | C = 2 # PIE796 | ^^^^^ | -error[PIE796]: PIE796.py:20:5: Enum contains duplicate value: `"2"` +error[PIE796]: 20:5: Enum contains duplicate value: `"2"` + --> PIE796.py:20:5 | 18 | A = "1" 19 | B = "2" 20 | C = "2" # PIE796 | ^^^^^^^ | -error[PIE796]: PIE796.py:26:5: Enum contains duplicate value: `2.5` +error[PIE796]: 26:5: Enum contains duplicate value: `2.5` + --> PIE796.py:26:5 | 24 | A = 1.0 25 | B = 2.5 26 | C = 2.5 # PIE796 | ^^^^^^^ | -error[PIE796]: PIE796.py:33:5: Enum contains duplicate value: `False` +error[PIE796]: 33:5: Enum contains duplicate value: `False` + --> PIE796.py:33:5 | 31 | B = True 32 | C = False 33 | D = False # PIE796 | ^^^^^^^^^ | -error[PIE796]: PIE796.py:40:5: Enum contains duplicate value: `None` +error[PIE796]: 40:5: Enum contains duplicate value: `None` + --> PIE796.py:40:5 | 38 | B = 2 39 | C = None 40 | D = None # PIE796 | ^^^^^^^^ | -error[PIE796]: PIE796.py:54:5: Enum contains duplicate value: `2` +error[PIE796]: 54:5: Enum contains duplicate value: `2` + --> PIE796.py:54:5 | 52 | A = 1 53 | B = 2 54 | C = 2 # PIE796 | ^^^^^ | -error[PIE796]: PIE796.py:71:5: Enum contains duplicate value: `...` +error[PIE796]: 71:5: Enum contains duplicate value: `...` + --> PIE796.py:71:5 | 69 | class FakeEnum10(enum.Enum): 70 | A = ... @@ -66,8 +74,9 @@ error[PIE796]: PIE796.py:71:5: Enum contains duplicate value: `...` | ^^^^^^^ 72 | C = ... # PIE796 | -error[PIE796]: PIE796.py:72:5: Enum contains duplicate value: `...` +error[PIE796]: 72:5: Enum contains duplicate value: `...` + --> PIE796.py:72:5 | 70 | A = ... 71 | B = ... # PIE796 diff --git a/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE800_PIE800.py.snap b/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE800_PIE800.py.snap index 497cd7863d..4b74cc1416 100644 --- a/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE800_PIE800.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE800_PIE800.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pie/mod.rs --- -error[PIE800]: PIE800.py:1:14: [*] Unnecessary spread `**` +error[PIE800]: 1:14: [*] Unnecessary spread `**` + --> PIE800.py:1:14 | 1 | {"foo": 1, **{"bar": 1}} # PIE800 | ^^^^^^^^^^ @@ -17,8 +18,9 @@ error[PIE800]: PIE800.py:1:14: [*] Unnecessary spread `**` 3 3 | {**{"bar": 10}, "a": "b"} # PIE800 4 4 | -error[PIE800]: PIE800.py:3:4: [*] Unnecessary spread `**` +error[PIE800]: 3:4: [*] Unnecessary spread `**` + --> PIE800.py:3:4 | 1 | {"foo": 1, **{"bar": 1}} # PIE800 2 | @@ -37,8 +39,9 @@ error[PIE800]: PIE800.py:3:4: [*] Unnecessary spread `**` 5 5 | foo({**foo, **{"bar": True}}) # PIE800 6 6 | -error[PIE800]: PIE800.py:5:15: [*] Unnecessary spread `**` +error[PIE800]: 5:15: [*] Unnecessary spread `**` + --> PIE800.py:5:15 | 3 | {**{"bar": 10}, "a": "b"} # PIE800 4 | @@ -58,8 +61,9 @@ error[PIE800]: PIE800.py:5:15: [*] Unnecessary spread `**` 7 7 | {**foo, **{"bar": 10}} # PIE800 8 8 | -error[PIE800]: PIE800.py:7:11: [*] Unnecessary spread `**` +error[PIE800]: 7:11: [*] Unnecessary spread `**` + --> PIE800.py:7:11 | 5 | foo({**foo, **{"bar": True}}) # PIE800 6 | @@ -79,8 +83,9 @@ error[PIE800]: PIE800.py:7:11: [*] Unnecessary spread `**` 9 9 | { # PIE800 10 10 | "a": "b", -error[PIE800]: PIE800.py:12:7: [*] Unnecessary spread `**` +error[PIE800]: 12:7: [*] Unnecessary spread `**` + --> PIE800.py:12:7 | 10 | "a": "b", 11 | # Preserve @@ -110,8 +115,9 @@ error[PIE800]: PIE800.py:12:7: [*] Unnecessary spread `**` 18 18 | 19 19 | {**foo, **buzz, **{bar: 10}} # PIE800 -error[PIE800]: PIE800.py:19:19: [*] Unnecessary spread `**` +error[PIE800]: 19:19: [*] Unnecessary spread `**` + --> PIE800.py:19:19 | 17 | } 18 | diff --git a/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE804_PIE804.py.snap b/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE804_PIE804.py.snap index 2ebd975275..9cc6e0fef2 100644 --- a/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE804_PIE804.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE804_PIE804.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pie/mod.rs --- -error[PIE804]: PIE804.py:1:5: [*] Unnecessary `dict` kwargs +error[PIE804]: 1:5: [*] Unnecessary `dict` kwargs + --> PIE804.py:1:5 | 1 | foo(**{"bar": True}) # PIE804 | ^^^^^^^^^^^^^^^ @@ -17,8 +18,9 @@ error[PIE804]: PIE804.py:1:5: [*] Unnecessary `dict` kwargs 3 3 | foo(**{"r2d2": True}) # PIE804 4 4 | -error[PIE804]: PIE804.py:3:5: [*] Unnecessary `dict` kwargs +error[PIE804]: 3:5: [*] Unnecessary `dict` kwargs + --> PIE804.py:3:5 | 1 | foo(**{"bar": True}) # PIE804 2 | @@ -37,8 +39,9 @@ error[PIE804]: PIE804.py:3:5: [*] Unnecessary `dict` kwargs 5 5 | Foo.objects.create(**{"bar": True}) # PIE804 6 6 | -error[PIE804]: PIE804.py:5:20: [*] Unnecessary `dict` kwargs +error[PIE804]: 5:20: [*] Unnecessary `dict` kwargs + --> PIE804.py:5:20 | 3 | foo(**{"r2d2": True}) # PIE804 4 | @@ -58,8 +61,9 @@ error[PIE804]: PIE804.py:5:20: [*] Unnecessary `dict` kwargs 7 7 | Foo.objects.create(**{"_id": some_id}) # PIE804 8 8 | -error[PIE804]: PIE804.py:7:20: [*] Unnecessary `dict` kwargs +error[PIE804]: 7:20: [*] Unnecessary `dict` kwargs + --> PIE804.py:7:20 | 5 | Foo.objects.create(**{"bar": True}) # PIE804 6 | @@ -79,8 +83,9 @@ error[PIE804]: PIE804.py:7:20: [*] Unnecessary `dict` kwargs 9 9 | Foo.objects.create(**{**bar}) # PIE804 10 10 | -error[PIE804]: PIE804.py:9:20: [*] Unnecessary `dict` kwargs +error[PIE804]: 9:20: [*] Unnecessary `dict` kwargs + --> PIE804.py:9:20 | 7 | Foo.objects.create(**{"_id": some_id}) # PIE804 8 | @@ -100,8 +105,9 @@ error[PIE804]: PIE804.py:9:20: [*] Unnecessary `dict` kwargs 11 11 | foo(**{}) 12 12 | -error[PIE804]: PIE804.py:11:5: [*] Unnecessary `dict` kwargs +error[PIE804]: 11:5: [*] Unnecessary `dict` kwargs + --> PIE804.py:11:5 | 9 | Foo.objects.create(**{**bar}) # PIE804 10 | @@ -121,8 +127,9 @@ error[PIE804]: PIE804.py:11:5: [*] Unnecessary `dict` kwargs 13 13 | foo(**{**data, "foo": "buzz"}) 14 14 | foo(**buzz) -error[PIE804]: PIE804.py:22:5: [*] Unnecessary `dict` kwargs +error[PIE804]: 22:5: [*] Unnecessary `dict` kwargs + --> PIE804.py:22:5 | 20 | foo(**{f"buzz__{bar}": True}) 21 | abc(**{"for": 3}) @@ -142,8 +149,9 @@ error[PIE804]: PIE804.py:22:5: [*] Unnecessary `dict` kwargs 24 24 | # Duplicated key names won't be fixed, to avoid syntax errors. 25 25 | abc(**{'a': b}, **{'a': c}) # PIE804 -error[PIE804]: PIE804.py:25:5: Unnecessary `dict` kwargs +error[PIE804]: 25:5: Unnecessary `dict` kwargs + --> PIE804.py:25:5 | 24 | # Duplicated key names won't be fixed, to avoid syntax errors. 25 | abc(**{'a': b}, **{'a': c}) # PIE804 @@ -151,8 +159,9 @@ error[PIE804]: PIE804.py:25:5: Unnecessary `dict` kwargs 26 | abc(a=1, **{'a': c}, **{'b': c}) # PIE804 | = help: Remove unnecessary kwargs -error[PIE804]: PIE804.py:25:17: Unnecessary `dict` kwargs +error[PIE804]: 25:17: Unnecessary `dict` kwargs + --> PIE804.py:25:17 | 24 | # Duplicated key names won't be fixed, to avoid syntax errors. 25 | abc(**{'a': b}, **{'a': c}) # PIE804 @@ -160,8 +169,9 @@ error[PIE804]: PIE804.py:25:17: Unnecessary `dict` kwargs 26 | abc(a=1, **{'a': c}, **{'b': c}) # PIE804 | = help: Remove unnecessary kwargs -error[PIE804]: PIE804.py:26:10: Unnecessary `dict` kwargs +error[PIE804]: 26:10: Unnecessary `dict` kwargs + --> PIE804.py:26:10 | 24 | # Duplicated key names won't be fixed, to avoid syntax errors. 25 | abc(**{'a': b}, **{'a': c}) # PIE804 @@ -171,8 +181,9 @@ error[PIE804]: PIE804.py:26:10: Unnecessary `dict` kwargs 28 | # Some values need to be parenthesized. | = help: Remove unnecessary kwargs -error[PIE804]: PIE804.py:26:22: [*] Unnecessary `dict` kwargs +error[PIE804]: 26:22: [*] Unnecessary `dict` kwargs + --> PIE804.py:26:22 | 24 | # Duplicated key names won't be fixed, to avoid syntax errors. 25 | abc(**{'a': b}, **{'a': c}) # PIE804 @@ -192,8 +203,9 @@ error[PIE804]: PIE804.py:26:22: [*] Unnecessary `dict` kwargs 28 28 | # Some values need to be parenthesized. 29 29 | abc(foo=1, **{'bar': (bar := 1)}) # PIE804 -error[PIE804]: PIE804.py:29:12: [*] Unnecessary `dict` kwargs +error[PIE804]: 29:12: [*] Unnecessary `dict` kwargs + --> PIE804.py:29:12 | 28 | # Some values need to be parenthesized. 29 | abc(foo=1, **{'bar': (bar := 1)}) # PIE804 @@ -209,8 +221,9 @@ error[PIE804]: PIE804.py:29:12: [*] Unnecessary `dict` kwargs 29 |+abc(foo=1, bar=(bar := 1)) # PIE804 30 30 | abc(foo=1, **{'bar': (yield 1)}) # PIE804 -error[PIE804]: PIE804.py:30:12: [*] Unnecessary `dict` kwargs +error[PIE804]: 30:12: [*] Unnecessary `dict` kwargs + --> PIE804.py:30:12 | 28 | # Some values need to be parenthesized. 29 | abc(foo=1, **{'bar': (bar := 1)}) # PIE804 diff --git a/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE807_PIE807.py.snap b/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE807_PIE807.py.snap index 2892b87a05..d47793e022 100644 --- a/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE807_PIE807.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE807_PIE807.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pie/mod.rs --- -error[PIE807]: PIE807.py:3:44: [*] Prefer `list` over useless lambda +error[PIE807]: 3:44: [*] Prefer `list` over useless lambda + --> PIE807.py:3:44 | 1 | @dataclass 2 | class Foo: @@ -20,8 +21,9 @@ error[PIE807]: PIE807.py:3:44: [*] Prefer `list` over useless lambda 5 5 | 6 6 | -error[PIE807]: PIE807.py:4:49: [*] Prefer `dict` over useless lambda +error[PIE807]: 4:49: [*] Prefer `dict` over useless lambda + --> PIE807.py:4:49 | 2 | class Foo: 3 | foo: List[str] = field(default_factory=lambda: []) # PIE807 @@ -39,8 +41,9 @@ error[PIE807]: PIE807.py:4:49: [*] Prefer `dict` over useless lambda 6 6 | 7 7 | class FooTable(BaseTable): -error[PIE807]: PIE807.py:8:36: [*] Prefer `list` over useless lambda +error[PIE807]: 8:36: [*] Prefer `list` over useless lambda + --> PIE807.py:8:36 | 7 | class FooTable(BaseTable): 8 | foo = fields.ListField(default=lambda: []) # PIE807 @@ -58,8 +61,9 @@ error[PIE807]: PIE807.py:8:36: [*] Prefer `list` over useless lambda 10 10 | 11 11 | -error[PIE807]: PIE807.py:9:36: [*] Prefer `dict` over useless lambda +error[PIE807]: 9:36: [*] Prefer `dict` over useless lambda + --> PIE807.py:9:36 | 7 | class FooTable(BaseTable): 8 | foo = fields.ListField(default=lambda: []) # PIE807 @@ -77,8 +81,9 @@ error[PIE807]: PIE807.py:9:36: [*] Prefer `dict` over useless lambda 11 11 | 12 12 | class FooTable(BaseTable): -error[PIE807]: PIE807.py:13:28: [*] Prefer `list` over useless lambda +error[PIE807]: 13:28: [*] Prefer `list` over useless lambda + --> PIE807.py:13:28 | 12 | class FooTable(BaseTable): 13 | foo = fields.ListField(lambda: []) # PIE807 @@ -96,8 +101,9 @@ error[PIE807]: PIE807.py:13:28: [*] Prefer `list` over useless lambda 15 15 | 16 16 | -error[PIE807]: PIE807.py:14:36: [*] Prefer `dict` over useless lambda +error[PIE807]: 14:36: [*] Prefer `dict` over useless lambda + --> PIE807.py:14:36 | 12 | class FooTable(BaseTable): 13 | foo = fields.ListField(lambda: []) # PIE807 diff --git a/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE808_PIE808.py.snap b/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE808_PIE808.py.snap index 5683f2cd08..0ec738d170 100644 --- a/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE808_PIE808.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE808_PIE808.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pie/mod.rs --- -error[PIE808]: PIE808.py:2:7: [*] Unnecessary `start` argument in `range` +error[PIE808]: 2:7: [*] Unnecessary `start` argument in `range` + --> PIE808.py:2:7 | 1 | # PIE808 2 | range(0, 10) @@ -19,8 +20,9 @@ error[PIE808]: PIE808.py:2:7: [*] Unnecessary `start` argument in `range` 4 4 | import builtins 5 5 | builtins.range(0, 10) -error[PIE808]: PIE808.py:5:16: [*] Unnecessary `start` argument in `range` +error[PIE808]: 5:16: [*] Unnecessary `start` argument in `range` + --> PIE808.py:5:16 | 4 | import builtins 5 | builtins.range(0, 10) diff --git a/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE810_PIE810.py.snap b/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE810_PIE810.py.snap index 94341fbf72..b2c5c065b3 100644 --- a/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE810_PIE810.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE810_PIE810.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pie/mod.rs --- -error[PIE810]: PIE810.py:2:1: [*] Call `startswith` once with a `tuple` +error[PIE810]: 2:1: [*] Call `startswith` once with a `tuple` + --> PIE810.py:1:8 | 1 | # error 2 | obj.startswith("foo") or obj.startswith("bar") @@ -19,8 +20,9 @@ error[PIE810]: PIE810.py:2:1: [*] Call `startswith` once with a `tuple` 4 4 | obj.endswith("foo") or obj.endswith("bar") 5 5 | # error -error[PIE810]: PIE810.py:4:1: [*] Call `endswith` once with a `tuple` +error[PIE810]: 4:1: [*] Call `endswith` once with a `tuple` + --> PIE810.py:3:8 | 2 | obj.startswith("foo") or obj.startswith("bar") 3 | # error @@ -40,8 +42,9 @@ error[PIE810]: PIE810.py:4:1: [*] Call `endswith` once with a `tuple` 6 6 | obj.startswith(foo) or obj.startswith(bar) 7 7 | # error -error[PIE810]: PIE810.py:6:1: [*] Call `startswith` once with a `tuple` +error[PIE810]: 6:1: [*] Call `startswith` once with a `tuple` + --> PIE810.py:5:8 | 4 | obj.endswith("foo") or obj.endswith("bar") 5 | # error @@ -61,8 +64,9 @@ error[PIE810]: PIE810.py:6:1: [*] Call `startswith` once with a `tuple` 8 8 | obj.startswith(foo) or obj.startswith("foo") 9 9 | # error -error[PIE810]: PIE810.py:8:1: [*] Call `startswith` once with a `tuple` +error[PIE810]: 8:1: [*] Call `startswith` once with a `tuple` + --> PIE810.py:7:8 | 6 | obj.startswith(foo) or obj.startswith(bar) 7 | # error @@ -82,8 +86,9 @@ error[PIE810]: PIE810.py:8:1: [*] Call `startswith` once with a `tuple` 10 10 | obj.endswith(foo) or obj.startswith(foo) or obj.startswith("foo") 11 11 | -error[PIE810]: PIE810.py:10:1: [*] Call `startswith` once with a `tuple` +error[PIE810]: 10:1: [*] Call `startswith` once with a `tuple` + --> PIE810.py:9:8 | 8 | obj.startswith(foo) or obj.startswith("foo") 9 | # error @@ -103,8 +108,9 @@ error[PIE810]: PIE810.py:10:1: [*] Call `startswith` once with a `tuple` 12 12 | def func(): 13 13 | msg = "hello world" -error[PIE810]: PIE810.py:19:8: [*] Call `startswith` once with a `tuple` +error[PIE810]: 19:8: [*] Call `startswith` once with a `tuple` + --> PIE810.py:19:8 | 17 | z = "w" 18 | @@ -123,8 +129,9 @@ error[PIE810]: PIE810.py:19:8: [*] Call `startswith` once with a `tuple` 21 21 | 22 22 | def func(): -error[PIE810]: PIE810.py:25:8: [*] Call `startswith` once with a `tuple` +error[PIE810]: 25:8: [*] Call `startswith` once with a `tuple` + --> PIE810.py:25:8 | 23 | msg = "hello world" 24 | diff --git a/crates/ruff_linter/src/rules/flake8_print/snapshots/ruff_linter__rules__flake8_print__tests__T201_T201.py.snap b/crates/ruff_linter/src/rules/flake8_print/snapshots/ruff_linter__rules__flake8_print__tests__T201_T201.py.snap index 05dad4b7f2..4c76db94ce 100644 --- a/crates/ruff_linter/src/rules/flake8_print/snapshots/ruff_linter__rules__flake8_print__tests__T201_T201.py.snap +++ b/crates/ruff_linter/src/rules/flake8_print/snapshots/ruff_linter__rules__flake8_print__tests__T201_T201.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_print/mod.rs --- -error[T201]: T201.py:4:1: [*] `print` found +error[T201]: 4:1: [*] `print` found + --> T201.py:3:1 | 2 | import tempfile 3 | @@ -21,8 +22,9 @@ error[T201]: T201.py:4:1: [*] `print` found 6 5 | print("Hello, world!", file=sys.stdout) # T201 7 6 | print("Hello, world!", file=sys.stderr) # T201 -error[T201]: T201.py:5:1: [*] `print` found +error[T201]: 5:1: [*] `print` found + --> T201.py:4:31 | 4 | print("Hello, world!") # T201 5 | print("Hello, world!", file=None) # T201 @@ -40,8 +42,9 @@ error[T201]: T201.py:5:1: [*] `print` found 7 6 | print("Hello, world!", file=sys.stderr) # T201 8 7 | -error[T201]: T201.py:6:1: [*] `print` found +error[T201]: 6:1: [*] `print` found + --> T201.py:5:42 | 4 | print("Hello, world!") # T201 5 | print("Hello, world!", file=None) # T201 @@ -59,8 +62,9 @@ error[T201]: T201.py:6:1: [*] `print` found 8 7 | 9 8 | with tempfile.NamedTemporaryFile() as fp: -error[T201]: T201.py:7:1: [*] `print` found +error[T201]: 7:1: [*] `print` found + --> T201.py:6:48 | 5 | print("Hello, world!", file=None) # T201 6 | print("Hello, world!", file=sys.stdout) # T201 diff --git a/crates/ruff_linter/src/rules/flake8_print/snapshots/ruff_linter__rules__flake8_print__tests__T203_T203.py.snap b/crates/ruff_linter/src/rules/flake8_print/snapshots/ruff_linter__rules__flake8_print__tests__T203_T203.py.snap index ea4e33b589..37bc453886 100644 --- a/crates/ruff_linter/src/rules/flake8_print/snapshots/ruff_linter__rules__flake8_print__tests__T203_T203.py.snap +++ b/crates/ruff_linter/src/rules/flake8_print/snapshots/ruff_linter__rules__flake8_print__tests__T203_T203.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_print/mod.rs --- -error[T203]: T203.py:3:1: [*] `pprint` found +error[T203]: 3:1: [*] `pprint` found + --> T203.py:2:1 | 1 | from pprint import pprint 2 | @@ -20,8 +21,9 @@ error[T203]: T203.py:3:1: [*] `pprint` found 5 4 | import pprint 6 5 | -error[T203]: T203.py:7:1: [*] `pprint` found +error[T203]: 7:1: [*] `pprint` found + --> T203.py:6:1 | 5 | import pprint 6 | diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI001_PYI001.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI001_PYI001.pyi.snap index 71b5ae2a0a..5de81109fa 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI001_PYI001.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI001_PYI001.pyi.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI001]: PYI001.pyi:3:5: Name of private `TypeVar` must start with `_` +error[PYI001]: 3:5: Name of private `TypeVar` must start with `_` + --> PYI001.pyi:3:5 | 1 | from typing import ParamSpec, TypeVar, TypeVarTuple 2 | @@ -11,8 +12,9 @@ error[PYI001]: PYI001.pyi:3:5: Name of private `TypeVar` must start with `_` 4 | 5 | TTuple = TypeVarTuple("TTuple") # Error: TypeVarTuples must also start with _ | -error[PYI001]: PYI001.pyi:5:10: Name of private `TypeVarTuple` must start with `_` +error[PYI001]: 5:10: Name of private `TypeVarTuple` must start with `_` + --> PYI001.pyi:5:10 | 3 | T = TypeVar("T") # Error: TypeVars in stubs must start with _ 4 | @@ -21,8 +23,9 @@ error[PYI001]: PYI001.pyi:5:10: Name of private `TypeVarTuple` must start with ` 6 | 7 | P = ParamSpec("P") # Error: ParamSpecs must start with _ | -error[PYI001]: PYI001.pyi:7:5: Name of private `ParamSpec` must start with `_` +error[PYI001]: 7:5: Name of private `ParamSpec` must start with `_` + --> PYI001.pyi:7:5 | 5 | TTuple = TypeVarTuple("TTuple") # Error: TypeVarTuples must also start with _ 6 | diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI002_PYI002.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI002_PYI002.pyi.snap index 79bf6e09cf..bea8428e87 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI002_PYI002.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI002_PYI002.pyi.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI002]: PYI002.pyi:3:4: `if` test must be a simple comparison against `sys.platform` or `sys.version_info` +error[PYI002]: 3:4: `if` test must be a simple comparison against `sys.platform` or `sys.version_info` + --> PYI002.pyi:3:4 | 1 | import sys 2 | @@ -11,8 +12,9 @@ error[PYI002]: PYI002.pyi:3:4: `if` test must be a simple comparison against `sy 4 | if 'linux' == sys.platform: ... # Y002 If test must be a simple comparison against sys.platform or sys.version_info 5 | if hasattr(sys, 'maxint'): ... # Y002 If test must be a simple comparison against sys.platform or sys.version_info | -error[PYI002]: PYI002.pyi:4:4: `if` test must be a simple comparison against `sys.platform` or `sys.version_info` +error[PYI002]: 4:4: `if` test must be a simple comparison against `sys.platform` or `sys.version_info` + --> PYI002.pyi:4:4 | 3 | if sys.version == 'Python 2.7.10': ... # Y002 If test must be a simple comparison against sys.platform or sys.version_info 4 | if 'linux' == sys.platform: ... # Y002 If test must be a simple comparison against sys.platform or sys.version_info @@ -20,8 +22,9 @@ error[PYI002]: PYI002.pyi:4:4: `if` test must be a simple comparison against `sy 5 | if hasattr(sys, 'maxint'): ... # Y002 If test must be a simple comparison against sys.platform or sys.version_info 6 | if sys.maxsize == 42: ... # Y002 If test must be a simple comparison against sys.platform or sys.version_info | -error[PYI002]: PYI002.pyi:5:4: `if` test must be a simple comparison against `sys.platform` or `sys.version_info` +error[PYI002]: 5:4: `if` test must be a simple comparison against `sys.platform` or `sys.version_info` + --> PYI002.pyi:5:4 | 3 | if sys.version == 'Python 2.7.10': ... # Y002 If test must be a simple comparison against sys.platform or sys.version_info 4 | if 'linux' == sys.platform: ... # Y002 If test must be a simple comparison against sys.platform or sys.version_info @@ -29,8 +32,9 @@ error[PYI002]: PYI002.pyi:5:4: `if` test must be a simple comparison against `sy | ^^^^^^^^^^^^^^^^^^^^^^ 6 | if sys.maxsize == 42: ... # Y002 If test must be a simple comparison against sys.platform or sys.version_info | -error[PYI002]: PYI002.pyi:6:4: `if` test must be a simple comparison against `sys.platform` or `sys.version_info` +error[PYI002]: 6:4: `if` test must be a simple comparison against `sys.platform` or `sys.version_info` + --> PYI002.pyi:6:4 | 4 | if 'linux' == sys.platform: ... # Y002 If test must be a simple comparison against sys.platform or sys.version_info 5 | if hasattr(sys, 'maxint'): ... # Y002 If test must be a simple comparison against sys.platform or sys.version_info diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI003_PYI003.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI003_PYI003.pyi.snap index 616f23fb48..966499aa33 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI003_PYI003.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI003_PYI003.pyi.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI003]: PYI003.pyi:4:4: Unrecognized `sys.version_info` check +error[PYI003]: 4:4: Unrecognized `sys.version_info` check + --> PYI003.pyi:4:4 | 3 | if sys.version_info[0] == 2: ... 4 | if sys.version_info[0] == True: ... # Y003 Unrecognized sys.version_info check # E712 comparison to True should be 'if cond is True... @@ -10,8 +11,9 @@ error[PYI003]: PYI003.pyi:4:4: Unrecognized `sys.version_info` check 5 | if sys.version_info[0.0] == 2: ... # Y003 Unrecognized sys.version_info check 6 | if sys.version_info[False] == 2: ... # Y003 Unrecognized sys.version_info check | -error[PYI003]: PYI003.pyi:5:4: Unrecognized `sys.version_info` check +error[PYI003]: 5:4: Unrecognized `sys.version_info` check + --> PYI003.pyi:5:4 | 3 | if sys.version_info[0] == 2: ... 4 | if sys.version_info[0] == True: ... # Y003 Unrecognized sys.version_info check # E712 comparison to True should be 'if cond is True... @@ -20,8 +22,9 @@ error[PYI003]: PYI003.pyi:5:4: Unrecognized `sys.version_info` check 6 | if sys.version_info[False] == 2: ... # Y003 Unrecognized sys.version_info check 7 | if sys.version_info[0j] == 2: ... # Y003 Unrecognized sys.version_info check | -error[PYI003]: PYI003.pyi:6:4: Unrecognized `sys.version_info` check +error[PYI003]: 6:4: Unrecognized `sys.version_info` check + --> PYI003.pyi:6:4 | 4 | if sys.version_info[0] == True: ... # Y003 Unrecognized sys.version_info check # E712 comparison to True should be 'if cond is True... 5 | if sys.version_info[0.0] == 2: ... # Y003 Unrecognized sys.version_info check @@ -30,8 +33,9 @@ error[PYI003]: PYI003.pyi:6:4: Unrecognized `sys.version_info` check 7 | if sys.version_info[0j] == 2: ... # Y003 Unrecognized sys.version_info check 8 | if sys.version_info[0] == (2, 7): ... # Y003 Unrecognized sys.version_info check | -error[PYI003]: PYI003.pyi:7:4: Unrecognized `sys.version_info` check +error[PYI003]: 7:4: Unrecognized `sys.version_info` check + --> PYI003.pyi:7:4 | 5 | if sys.version_info[0.0] == 2: ... # Y003 Unrecognized sys.version_info check 6 | if sys.version_info[False] == 2: ... # Y003 Unrecognized sys.version_info check @@ -40,8 +44,9 @@ error[PYI003]: PYI003.pyi:7:4: Unrecognized `sys.version_info` check 8 | if sys.version_info[0] == (2, 7): ... # Y003 Unrecognized sys.version_info check 9 | if sys.version_info[0] == '2': ... # Y003 Unrecognized sys.version_info check | -error[PYI003]: PYI003.pyi:8:4: Unrecognized `sys.version_info` check +error[PYI003]: 8:4: Unrecognized `sys.version_info` check + --> PYI003.pyi:8:4 | 6 | if sys.version_info[False] == 2: ... # Y003 Unrecognized sys.version_info check 7 | if sys.version_info[0j] == 2: ... # Y003 Unrecognized sys.version_info check @@ -50,8 +55,9 @@ error[PYI003]: PYI003.pyi:8:4: Unrecognized `sys.version_info` check 9 | if sys.version_info[0] == '2': ... # Y003 Unrecognized sys.version_info check 10 | if sys.version_info[1:] >= (7, 11): ... # Y003 Unrecognized sys.version_info check | -error[PYI003]: PYI003.pyi:9:4: Unrecognized `sys.version_info` check +error[PYI003]: 9:4: Unrecognized `sys.version_info` check + --> PYI003.pyi:9:4 | 7 | if sys.version_info[0j] == 2: ... # Y003 Unrecognized sys.version_info check 8 | if sys.version_info[0] == (2, 7): ... # Y003 Unrecognized sys.version_info check @@ -60,8 +66,9 @@ error[PYI003]: PYI003.pyi:9:4: Unrecognized `sys.version_info` check 10 | if sys.version_info[1:] >= (7, 11): ... # Y003 Unrecognized sys.version_info check 11 | if sys.version_info[::-1] < (11, 7): ... # Y003 Unrecognized sys.version_info check | -error[PYI003]: PYI003.pyi:10:4: Unrecognized `sys.version_info` check +error[PYI003]: 10:4: Unrecognized `sys.version_info` check + --> PYI003.pyi:10:4 | 8 | if sys.version_info[0] == (2, 7): ... # Y003 Unrecognized sys.version_info check 9 | if sys.version_info[0] == '2': ... # Y003 Unrecognized sys.version_info check @@ -70,8 +77,9 @@ error[PYI003]: PYI003.pyi:10:4: Unrecognized `sys.version_info` check 11 | if sys.version_info[::-1] < (11, 7): ... # Y003 Unrecognized sys.version_info check 12 | if sys.version_info[:3] >= (2, 7): ... # Y003 Unrecognized sys.version_info check | -error[PYI003]: PYI003.pyi:11:4: Unrecognized `sys.version_info` check +error[PYI003]: 11:4: Unrecognized `sys.version_info` check + --> PYI003.pyi:11:4 | 9 | if sys.version_info[0] == '2': ... # Y003 Unrecognized sys.version_info check 10 | if sys.version_info[1:] >= (7, 11): ... # Y003 Unrecognized sys.version_info check @@ -80,8 +88,9 @@ error[PYI003]: PYI003.pyi:11:4: Unrecognized `sys.version_info` check 12 | if sys.version_info[:3] >= (2, 7): ... # Y003 Unrecognized sys.version_info check 13 | if sys.version_info[:True] >= (2, 7): ... # Y003 Unrecognized sys.version_info check | -error[PYI003]: PYI003.pyi:12:4: Unrecognized `sys.version_info` check +error[PYI003]: 12:4: Unrecognized `sys.version_info` check + --> PYI003.pyi:12:4 | 10 | if sys.version_info[1:] >= (7, 11): ... # Y003 Unrecognized sys.version_info check 11 | if sys.version_info[::-1] < (11, 7): ... # Y003 Unrecognized sys.version_info check @@ -90,8 +99,9 @@ error[PYI003]: PYI003.pyi:12:4: Unrecognized `sys.version_info` check 13 | if sys.version_info[:True] >= (2, 7): ... # Y003 Unrecognized sys.version_info check 14 | if sys.version_info[:1] == (2,): ... | -error[PYI003]: PYI003.pyi:13:4: Unrecognized `sys.version_info` check +error[PYI003]: 13:4: Unrecognized `sys.version_info` check + --> PYI003.pyi:13:4 | 11 | if sys.version_info[::-1] < (11, 7): ... # Y003 Unrecognized sys.version_info check 12 | if sys.version_info[:3] >= (2, 7): ... # Y003 Unrecognized sys.version_info check @@ -100,8 +110,9 @@ error[PYI003]: PYI003.pyi:13:4: Unrecognized `sys.version_info` check 14 | if sys.version_info[:1] == (2,): ... 15 | if sys.version_info[:1] == (True,): ... # Y003 Unrecognized sys.version_info check | -error[PYI003]: PYI003.pyi:15:4: Unrecognized `sys.version_info` check +error[PYI003]: 15:4: Unrecognized `sys.version_info` check + --> PYI003.pyi:15:4 | 13 | if sys.version_info[:True] >= (2, 7): ... # Y003 Unrecognized sys.version_info check 14 | if sys.version_info[:1] == (2,): ... @@ -110,8 +121,9 @@ error[PYI003]: PYI003.pyi:15:4: Unrecognized `sys.version_info` check 16 | if sys.version_info[:1] == (2, 7): ... # Y005 Version comparison must be against a length-1 tuple 17 | if sys.version_info[:2] == (2, 7): ... | -error[PYI003]: PYI003.pyi:19:4: Unrecognized `sys.version_info` check +error[PYI003]: 19:4: Unrecognized `sys.version_info` check + --> PYI003.pyi:19:4 | 17 | if sys.version_info[:2] == (2, 7): ... 18 | if sys.version_info[:2] == (2,): ... # Y005 Version comparison must be against a length-2 tuple @@ -120,8 +132,9 @@ error[PYI003]: PYI003.pyi:19:4: Unrecognized `sys.version_info` check 20 | if sys.version_info[:2.0] >= (3, 9): ... # Y003 Unrecognized sys.version_info check 21 | if sys.version_info[:2j] >= (3, 9): ... # Y003 Unrecognized sys.version_info check | -error[PYI003]: PYI003.pyi:20:4: Unrecognized `sys.version_info` check +error[PYI003]: 20:4: Unrecognized `sys.version_info` check + --> PYI003.pyi:20:4 | 18 | if sys.version_info[:2] == (2,): ... # Y005 Version comparison must be against a length-2 tuple 19 | if sys.version_info[:2] == "lol": ... # Y003 Unrecognized sys.version_info check @@ -130,8 +143,9 @@ error[PYI003]: PYI003.pyi:20:4: Unrecognized `sys.version_info` check 21 | if sys.version_info[:2j] >= (3, 9): ... # Y003 Unrecognized sys.version_info check 22 | if sys.version_info[:, :] >= (2, 7): ... # Y003 Unrecognized sys.version_info check | -error[PYI003]: PYI003.pyi:21:4: Unrecognized `sys.version_info` check +error[PYI003]: 21:4: Unrecognized `sys.version_info` check + --> PYI003.pyi:21:4 | 19 | if sys.version_info[:2] == "lol": ... # Y003 Unrecognized sys.version_info check 20 | if sys.version_info[:2.0] >= (3, 9): ... # Y003 Unrecognized sys.version_info check @@ -140,8 +154,9 @@ error[PYI003]: PYI003.pyi:21:4: Unrecognized `sys.version_info` check 22 | if sys.version_info[:, :] >= (2, 7): ... # Y003 Unrecognized sys.version_info check 23 | if sys.version_info < [3, 0]: ... # Y003 Unrecognized sys.version_info check | -error[PYI003]: PYI003.pyi:22:4: Unrecognized `sys.version_info` check +error[PYI003]: 22:4: Unrecognized `sys.version_info` check + --> PYI003.pyi:22:4 | 20 | if sys.version_info[:2.0] >= (3, 9): ... # Y003 Unrecognized sys.version_info check 21 | if sys.version_info[:2j] >= (3, 9): ... # Y003 Unrecognized sys.version_info check @@ -150,8 +165,9 @@ error[PYI003]: PYI003.pyi:22:4: Unrecognized `sys.version_info` check 23 | if sys.version_info < [3, 0]: ... # Y003 Unrecognized sys.version_info check 24 | if sys.version_info < ('3', '0'): ... # Y003 Unrecognized sys.version_info check | -error[PYI003]: PYI003.pyi:23:4: Unrecognized `sys.version_info` check +error[PYI003]: 23:4: Unrecognized `sys.version_info` check + --> PYI003.pyi:23:4 | 21 | if sys.version_info[:2j] >= (3, 9): ... # Y003 Unrecognized sys.version_info check 22 | if sys.version_info[:, :] >= (2, 7): ... # Y003 Unrecognized sys.version_info check @@ -160,8 +176,9 @@ error[PYI003]: PYI003.pyi:23:4: Unrecognized `sys.version_info` check 24 | if sys.version_info < ('3', '0'): ... # Y003 Unrecognized sys.version_info check 25 | if sys.version_info >= (3, 4, 3): ... # Y004 Version comparison must use only major and minor version | -error[PYI003]: PYI003.pyi:24:4: Unrecognized `sys.version_info` check +error[PYI003]: 24:4: Unrecognized `sys.version_info` check + --> PYI003.pyi:24:4 | 22 | if sys.version_info[:, :] >= (2, 7): ... # Y003 Unrecognized sys.version_info check 23 | if sys.version_info < [3, 0]: ... # Y003 Unrecognized sys.version_info check diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI004_PYI004.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI004_PYI004.pyi.snap index c3ed2998a1..e48bd405f2 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI004_PYI004.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI004_PYI004.pyi.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI004]: PYI004.pyi:4:4: Version comparison must use only major and minor version +error[PYI004]: 4:4: Version comparison must use only major and minor version + --> PYI004.pyi:4:4 | 2 | from sys import version_info 3 | @@ -11,8 +12,9 @@ error[PYI004]: PYI004.pyi:4:4: Version comparison must use only major and minor 5 | if sys.version_info < (3, 4, 3): ... # PYI004 6 | if sys.version_info == (3, 4, 3): ... # PYI004 | -error[PYI004]: PYI004.pyi:5:4: Version comparison must use only major and minor version +error[PYI004]: 5:4: Version comparison must use only major and minor version + --> PYI004.pyi:5:4 | 4 | if sys.version_info >= (3, 4, 3): ... # PYI004 5 | if sys.version_info < (3, 4, 3): ... # PYI004 @@ -20,8 +22,9 @@ error[PYI004]: PYI004.pyi:5:4: Version comparison must use only major and minor 6 | if sys.version_info == (3, 4, 3): ... # PYI004 7 | if sys.version_info != (3, 4, 3): ... # PYI004 | -error[PYI004]: PYI004.pyi:6:4: Version comparison must use only major and minor version +error[PYI004]: 6:4: Version comparison must use only major and minor version + --> PYI004.pyi:6:4 | 4 | if sys.version_info >= (3, 4, 3): ... # PYI004 5 | if sys.version_info < (3, 4, 3): ... # PYI004 @@ -29,8 +32,9 @@ error[PYI004]: PYI004.pyi:6:4: Version comparison must use only major and minor | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 7 | if sys.version_info != (3, 4, 3): ... # PYI004 | -error[PYI004]: PYI004.pyi:7:4: Version comparison must use only major and minor version +error[PYI004]: 7:4: Version comparison must use only major and minor version + --> PYI004.pyi:7:4 | 5 | if sys.version_info < (3, 4, 3): ... # PYI004 6 | if sys.version_info == (3, 4, 3): ... # PYI004 diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI005_PYI005.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI005_PYI005.pyi.snap index 77f8d9ab1b..4cfc58290e 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI005_PYI005.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI005_PYI005.pyi.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI005]: PYI005.pyi:4:4: Version comparison must be against a length-1 tuple +error[PYI005]: 4:4: Version comparison must be against a length-1 tuple + --> PYI005.pyi:4:4 | 2 | from sys import platform, version_info 3 | @@ -10,8 +11,9 @@ error[PYI005]: PYI005.pyi:4:4: Version comparison must be against a length-1 tup | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 5 | if sys.version_info[:2] == (2,): ... # Y005 | -error[PYI005]: PYI005.pyi:5:4: Version comparison must be against a length-2 tuple +error[PYI005]: 5:4: Version comparison must be against a length-2 tuple + --> PYI005.pyi:5:4 | 4 | if sys.version_info[:1] == (2, 7): ... # Y005 5 | if sys.version_info[:2] == (2,): ... # Y005 diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI006_PYI006.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI006_PYI006.pyi.snap index 8b2dd8c929..05cd40bd79 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI006_PYI006.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI006_PYI006.pyi.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI006]: PYI006.pyi:8:4: Use `<` or `>=` for `sys.version_info` comparisons +error[PYI006]: 8:4: Use `<` or `>=` for `sys.version_info` comparisons + --> PYI006.pyi:8:4 | 6 | if sys.version_info >= (3, 9): ... # OK 7 | @@ -11,8 +12,9 @@ error[PYI006]: PYI006.pyi:8:4: Use `<` or `>=` for `sys.version_info` comparison 9 | 10 | if sys.version_info == (3, 9): ... # Error: PYI006 Use only `<` and `>=` for version info comparisons | -error[PYI006]: PYI006.pyi:10:4: Use `<` or `>=` for `sys.version_info` comparisons +error[PYI006]: 10:4: Use `<` or `>=` for `sys.version_info` comparisons + --> PYI006.pyi:10:4 | 8 | if sys.version_info == (3, 9): ... # OK 9 | @@ -21,8 +23,9 @@ error[PYI006]: PYI006.pyi:10:4: Use `<` or `>=` for `sys.version_info` compariso 11 | 12 | if sys.version_info <= (3, 10): ... # Error: PYI006 Use only `<` and `>=` for version info comparisons | -error[PYI006]: PYI006.pyi:12:4: Use `<` or `>=` for `sys.version_info` comparisons +error[PYI006]: 12:4: Use `<` or `>=` for `sys.version_info` comparisons + --> PYI006.pyi:12:4 | 10 | if sys.version_info == (3, 9): ... # Error: PYI006 Use only `<` and `>=` for version info comparisons 11 | @@ -31,8 +34,9 @@ error[PYI006]: PYI006.pyi:12:4: Use `<` or `>=` for `sys.version_info` compariso 13 | 14 | if sys.version_info <= (3, 10): ... # Error: PYI006 Use only `<` and `>=` for version info comparisons | -error[PYI006]: PYI006.pyi:14:4: Use `<` or `>=` for `sys.version_info` comparisons +error[PYI006]: 14:4: Use `<` or `>=` for `sys.version_info` comparisons + --> PYI006.pyi:14:4 | 12 | if sys.version_info <= (3, 10): ... # Error: PYI006 Use only `<` and `>=` for version info comparisons 13 | @@ -41,8 +45,9 @@ error[PYI006]: PYI006.pyi:14:4: Use `<` or `>=` for `sys.version_info` compariso 15 | 16 | if sys.version_info > (3, 10): ... # Error: PYI006 Use only `<` and `>=` for version info comparisons | -error[PYI006]: PYI006.pyi:16:4: Use `<` or `>=` for `sys.version_info` comparisons +error[PYI006]: 16:4: Use `<` or `>=` for `sys.version_info` comparisons + --> PYI006.pyi:16:4 | 14 | if sys.version_info <= (3, 10): ... # Error: PYI006 Use only `<` and `>=` for version info comparisons 15 | @@ -50,8 +55,9 @@ error[PYI006]: PYI006.pyi:16:4: Use `<` or `>=` for `sys.version_info` compariso | ^^^^^^^^^^^^^^^^^^^^^^^^^^ 17 | elif sys.version_info > (3, 11): ... # Error: PYI006 Use only `<` and `>=` for version info comparisons | -error[PYI006]: PYI006.pyi:17:6: Use `<` or `>=` for `sys.version_info` comparisons +error[PYI006]: 17:6: Use `<` or `>=` for `sys.version_info` comparisons + --> PYI006.pyi:17:6 | 16 | if sys.version_info > (3, 10): ... # Error: PYI006 Use only `<` and `>=` for version info comparisons 17 | elif sys.version_info > (3, 11): ... # Error: PYI006 Use only `<` and `>=` for version info comparisons @@ -59,8 +65,9 @@ error[PYI006]: PYI006.pyi:17:6: Use `<` or `>=` for `sys.version_info` compariso 18 | 19 | if python_version > (3, 10): ... # Error: PYI006 Use only `<` and `>=` for version info comparisons | -error[PYI006]: PYI006.pyi:19:4: Use `<` or `>=` for `sys.version_info` comparisons +error[PYI006]: 19:4: Use `<` or `>=` for `sys.version_info` comparisons + --> PYI006.pyi:19:4 | 17 | elif sys.version_info > (3, 11): ... # Error: PYI006 Use only `<` and `>=` for version info comparisons 18 | @@ -68,8 +75,9 @@ error[PYI006]: PYI006.pyi:19:4: Use `<` or `>=` for `sys.version_info` compariso | ^^^^^^^^^^^^^^^^^^^^^^^^ 20 | elif python_version == (3, 11): ... # Error: PYI006 Use only `<` and `>=` for version info comparisons | -error[PYI006]: PYI006.pyi:20:6: Use `<` or `>=` for `sys.version_info` comparisons +error[PYI006]: 20:6: Use `<` or `>=` for `sys.version_info` comparisons + --> PYI006.pyi:20:6 | 19 | if python_version > (3, 10): ... # Error: PYI006 Use only `<` and `>=` for version info comparisons 20 | elif python_version == (3, 11): ... # Error: PYI006 Use only `<` and `>=` for version info comparisons diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI007_PYI007.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI007_PYI007.pyi.snap index 817a018a7e..5245372a98 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI007_PYI007.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI007_PYI007.pyi.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI007]: PYI007.pyi:7:4: Unrecognized `sys.platform` check +error[PYI007]: 7:4: Unrecognized `sys.platform` check + --> PYI007.pyi:7:4 | 5 | if sys.platform != "platform_name_2": ... # OK 6 | @@ -11,8 +12,9 @@ error[PYI007]: PYI007.pyi:7:4: Unrecognized `sys.platform` check 8 | 9 | if sys.platform > 3: ... # Error: PYI007 Unrecognized sys.platform check | -error[PYI007]: PYI007.pyi:9:4: Unrecognized `sys.platform` check +error[PYI007]: 9:4: Unrecognized `sys.platform` check + --> PYI007.pyi:9:4 | 7 | if sys.platform in ["linux"]: ... # Error: PYI007 Unrecognized sys.platform check 8 | @@ -21,8 +23,9 @@ error[PYI007]: PYI007.pyi:9:4: Unrecognized `sys.platform` check 10 | 11 | if sys.platform == 10.12: ... # Error: PYI007 Unrecognized sys.platform check | -error[PYI007]: PYI007.pyi:11:4: Unrecognized `sys.platform` check +error[PYI007]: 11:4: Unrecognized `sys.platform` check + --> PYI007.pyi:11:4 | 9 | if sys.platform > 3: ... # Error: PYI007 Unrecognized sys.platform check 10 | diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI008_PYI008.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI008_PYI008.pyi.snap index 749840c185..6dc07a2e79 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI008_PYI008.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI008_PYI008.pyi.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI008]: PYI008.pyi:3:20: Unrecognized platform `linus` +error[PYI008]: 3:20: Unrecognized platform `linus` + --> PYI008.pyi:3:20 | 1 | import sys 2 | diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI009_PYI009.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI009_PYI009.pyi.snap index ee6266464a..b2013c2853 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI009_PYI009.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI009_PYI009.pyi.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI009]: PYI009.pyi:3:5: [*] Empty body should contain `...`, not `pass` +error[PYI009]: 3:5: [*] Empty body should contain `...`, not `pass` + --> PYI009.pyi:3:5 | 1 | def bar(): ... # OK 2 | def foo(): @@ -21,8 +22,9 @@ error[PYI009]: PYI009.pyi:3:5: [*] Empty body should contain `...`, not `pass` 5 5 | class Bar: ... # OK 6 6 | -error[PYI009]: PYI009.pyi:8:5: [*] Empty body should contain `...`, not `pass` +error[PYI009]: 8:5: [*] Empty body should contain `...`, not `pass` + --> PYI009.pyi:8:5 | 7 | class Foo: 8 | pass # ERROR PYI009, since we're in a stub file diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI010_PYI010.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI010_PYI010.pyi.snap index a0300c706c..8f01531089 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI010_PYI010.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI010_PYI010.pyi.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI010]: PYI010.pyi:6:5: [*] Function body must contain only `...` +error[PYI010]: 6:5: [*] Function body must contain only `...` + --> PYI010.pyi:6:5 | 5 | def buzz(): 6 | print("buzz") # ERROR PYI010 @@ -21,8 +22,9 @@ error[PYI010]: PYI010.pyi:6:5: [*] Function body must contain only `...` 8 8 | def foo2(): 9 9 | 123 # ERROR PYI010 -error[PYI010]: PYI010.pyi:9:5: [*] Function body must contain only `...` +error[PYI010]: 9:5: [*] Function body must contain only `...` + --> PYI010.pyi:9:5 | 8 | def foo2(): 9 | 123 # ERROR PYI010 @@ -41,8 +43,9 @@ error[PYI010]: PYI010.pyi:9:5: [*] Function body must contain only `...` 11 11 | def bizz(): 12 12 | x = 123 # ERROR PYI010 -error[PYI010]: PYI010.pyi:12:5: [*] Function body must contain only `...` +error[PYI010]: 12:5: [*] Function body must contain only `...` + --> PYI010.pyi:12:5 | 11 | def bizz(): 12 | x = 123 # ERROR PYI010 diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI011_PYI011.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI011_PYI011.pyi.snap index faa658d3c2..278d77eb42 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI011_PYI011.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI011_PYI011.pyi.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI011]: PYI011.pyi:10:14: [*] Only simple default values allowed for typed arguments +error[PYI011]: 10:14: [*] Only simple default values allowed for typed arguments + --> PYI011.pyi:10:14 | 8 | def f12( 9 | x, @@ -22,8 +23,9 @@ error[PYI011]: PYI011.pyi:10:14: [*] Only simple default values allowed for type 12 12 | def f11(*, x: str = "x") -> None: ... # OK 13 13 | def f13( -error[PYI011]: PYI011.pyi:38:9: [*] Only simple default values allowed for typed arguments +error[PYI011]: 38:9: [*] Only simple default values allowed for typed arguments + --> PYI011.pyi:38:9 | 36 | x: dict[ 37 | int, int @@ -50,8 +52,9 @@ error[PYI011]: PYI011.pyi:38:9: [*] Only simple default values allowed for typed 43 40 | def f153( 44 41 | x: list[ -error[PYI011]: PYI011.pyi:46:9: [*] Only simple default values allowed for typed arguments +error[PYI011]: 46:9: [*] Only simple default values allowed for typed arguments + --> PYI011.pyi:46:9 | 44 | x: list[ 45 | int @@ -96,8 +99,9 @@ error[PYI011]: PYI011.pyi:46:9: [*] Only simple default values allowed for typed 60 48 | def f154( 61 49 | x: tuple[ -error[PYI011]: PYI011.pyi:63:9: [*] Only simple default values allowed for typed arguments +error[PYI011]: 63:9: [*] Only simple default values allowed for typed arguments + --> PYI011.pyi:63:9 | 61 | x: tuple[ 62 | str, tuple[str, ...] @@ -124,8 +128,9 @@ error[PYI011]: PYI011.pyi:63:9: [*] Only simple default values allowed for typed 68 65 | def f141( 69 66 | x: list[ -error[PYI011]: PYI011.pyi:71:9: [*] Only simple default values allowed for typed arguments +error[PYI011]: 71:9: [*] Only simple default values allowed for typed arguments + --> PYI011.pyi:71:9 | 69 | x: list[ 70 | int @@ -150,8 +155,9 @@ error[PYI011]: PYI011.pyi:71:9: [*] Only simple default values allowed for typed 75 73 | def f142( 76 74 | x: list[ -error[PYI011]: PYI011.pyi:78:9: [*] Only simple default values allowed for typed arguments +error[PYI011]: 78:9: [*] Only simple default values allowed for typed arguments + --> PYI011.pyi:78:9 | 76 | x: list[ 77 | int @@ -176,8 +182,9 @@ error[PYI011]: PYI011.pyi:78:9: [*] Only simple default values allowed for typed 82 80 | def f16( 83 81 | x: frozenset[ -error[PYI011]: PYI011.pyi:85:9: [*] Only simple default values allowed for typed arguments +error[PYI011]: 85:9: [*] Only simple default values allowed for typed arguments + --> PYI011.pyi:85:9 | 83 | x: frozenset[ 84 | bytes @@ -202,8 +209,9 @@ error[PYI011]: PYI011.pyi:85:9: [*] Only simple default values allowed for typed 89 87 | def f17( 90 88 | x: str = "foo" # Error PYI011 Only simple default values allowed for typed arguments -error[PYI011]: PYI011.pyi:90:14: [*] Only simple default values allowed for typed arguments +error[PYI011]: 90:14: [*] Only simple default values allowed for typed arguments + --> PYI011.pyi:90:14 | 88 | ) -> None: ... 89 | def f17( @@ -226,8 +234,9 @@ error[PYI011]: PYI011.pyi:90:14: [*] Only simple default values allowed for type 93 92 | def f18( 94 93 | x: str = b"foo" # Error PYI011 Only simple default values allowed for typed arguments -error[PYI011]: PYI011.pyi:94:14: [*] Only simple default values allowed for typed arguments +error[PYI011]: 94:14: [*] Only simple default values allowed for typed arguments + --> PYI011.pyi:94:14 | 92 | ) -> None: ... 93 | def f18( @@ -250,8 +259,9 @@ error[PYI011]: PYI011.pyi:94:14: [*] Only simple default values allowed for type 97 96 | def f19( 98 97 | x: object = "foo" # Error PYI011 Only simple default values allowed for typed arguments -error[PYI011]: PYI011.pyi:98:17: [*] Only simple default values allowed for typed arguments +error[PYI011]: 98:17: [*] Only simple default values allowed for typed arguments + --> PYI011.pyi:98:17 | 96 | ) -> None: ... 97 | def f19( @@ -274,8 +284,9 @@ error[PYI011]: PYI011.pyi:98:17: [*] Only simple default values allowed for type 101 100 | def f20( 102 101 | x: int = 5 -error[PYI011]: PYI011.pyi:102:14: [*] Only simple default values allowed for typed arguments +error[PYI011]: 102:14: [*] Only simple default values allowed for typed arguments + --> PYI011.pyi:102:14 | 100 | ) -> None: ... 101 | def f20( @@ -298,8 +309,9 @@ error[PYI011]: PYI011.pyi:102:14: [*] Only simple default values allowed for typ 105 104 | def f21( 106 105 | x: complex = 3j -error[PYI011]: PYI011.pyi:106:18: [*] Only simple default values allowed for typed arguments +error[PYI011]: 106:18: [*] Only simple default values allowed for typed arguments + --> PYI011.pyi:106:18 | 104 | ) -> None: ... 105 | def f21( @@ -322,8 +334,9 @@ error[PYI011]: PYI011.pyi:106:18: [*] Only simple default values allowed for typ 109 108 | def f22( 110 109 | x: complex = -42.5j # Error PYI011 Only simple default values allowed for typed arguments -error[PYI011]: PYI011.pyi:110:18: [*] Only simple default values allowed for typed arguments +error[PYI011]: 110:18: [*] Only simple default values allowed for typed arguments + --> PYI011.pyi:110:18 | 108 | ) -> None: ... 109 | def f22( @@ -346,8 +359,9 @@ error[PYI011]: PYI011.pyi:110:18: [*] Only simple default values allowed for typ 113 112 | def f23( 114 113 | x: bool = True, # OK -error[PYI011]: PYI011.pyi:138:16: [*] Only simple default values allowed for typed arguments +error[PYI011]: 138:16: [*] Only simple default values allowed for typed arguments + --> PYI011.pyi:138:16 | 136 | ) -> None: ... 137 | def f31( @@ -367,8 +381,9 @@ error[PYI011]: PYI011.pyi:138:16: [*] Only simple default values allowed for typ 140 140 | def f32( 141 141 | x: float = np.inf, # Error PYI011 Only simple default values allowed for typed arguments -error[PYI011]: PYI011.pyi:141:16: [*] Only simple default values allowed for typed arguments +error[PYI011]: 141:16: [*] Only simple default values allowed for typed arguments + --> PYI011.pyi:141:16 | 139 | ) -> None: ... 140 | def f32( @@ -388,8 +403,9 @@ error[PYI011]: PYI011.pyi:141:16: [*] Only simple default values allowed for typ 143 143 | def f33( 144 144 | x: float = math.nan, # OK -error[PYI011]: PYI011.pyi:147:16: [*] Only simple default values allowed for typed arguments +error[PYI011]: 147:16: [*] Only simple default values allowed for typed arguments + --> PYI011.pyi:147:16 | 145 | ) -> None: ... 146 | def f34( @@ -409,8 +425,9 @@ error[PYI011]: PYI011.pyi:147:16: [*] Only simple default values allowed for typ 149 149 | def f35( 150 150 | x: complex = math.inf # Error PYI011 Only simple default values allowed for typed arguments -error[PYI011]: PYI011.pyi:150:18: [*] Only simple default values allowed for typed arguments +error[PYI011]: 150:18: [*] Only simple default values allowed for typed arguments + --> PYI011.pyi:150:18 | 148 | ) -> None: ... 149 | def f35( @@ -433,8 +450,9 @@ error[PYI011]: PYI011.pyi:150:18: [*] Only simple default values allowed for typ 153 152 | def f36( 154 153 | *, -error[PYI011]: PYI011.pyi:159:14: [*] Only simple default values allowed for typed arguments +error[PYI011]: 159:14: [*] Only simple default values allowed for typed arguments + --> PYI011.pyi:159:14 | 157 | def f37( 158 | *, diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI012_PYI012.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI012_PYI012.pyi.snap index f725b761b9..9d9a0809f7 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI012_PYI012.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI012_PYI012.pyi.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI012]: PYI012.pyi:5:5: [*] Class body must not contain `pass` +error[PYI012]: 5:5: [*] Class body must not contain `pass` + --> PYI012.pyi:5:5 | 3 | class OneAttributeClass: 4 | value: int @@ -21,8 +22,9 @@ error[PYI012]: PYI012.pyi:5:5: [*] Class body must not contain `pass` 7 6 | class OneAttributeClassRev: 8 7 | pass # PYI012 Class body must not contain `pass` -error[PYI012]: PYI012.pyi:8:5: [*] Class body must not contain `pass` +error[PYI012]: 8:5: [*] Class body must not contain `pass` + --> PYI012.pyi:8:5 | 7 | class OneAttributeClassRev: 8 | pass # PYI012 Class body must not contain `pass` @@ -39,8 +41,9 @@ error[PYI012]: PYI012.pyi:8:5: [*] Class body must not contain `pass` 10 9 | 11 10 | class DocstringClass: -error[PYI012]: PYI012.pyi:16:5: [*] Class body must not contain `pass` +error[PYI012]: 16:5: [*] Class body must not contain `pass` + --> PYI012.pyi:16:5 | 14 | """ 15 | @@ -59,8 +62,9 @@ error[PYI012]: PYI012.pyi:16:5: [*] Class body must not contain `pass` 18 17 | class NonEmptyChild(Exception): 19 18 | value: int -error[PYI012]: PYI012.pyi:20:5: [*] Class body must not contain `pass` +error[PYI012]: 20:5: [*] Class body must not contain `pass` + --> PYI012.pyi:20:5 | 18 | class NonEmptyChild(Exception): 19 | value: int @@ -79,8 +83,9 @@ error[PYI012]: PYI012.pyi:20:5: [*] Class body must not contain `pass` 22 21 | class NonEmptyChild2(Exception): 23 22 | pass # PYI012 Class body must not contain `pass` -error[PYI012]: PYI012.pyi:23:5: [*] Class body must not contain `pass` +error[PYI012]: 23:5: [*] Class body must not contain `pass` + --> PYI012.pyi:23:5 | 22 | class NonEmptyChild2(Exception): 23 | pass # PYI012 Class body must not contain `pass` @@ -97,8 +102,9 @@ error[PYI012]: PYI012.pyi:23:5: [*] Class body must not contain `pass` 25 24 | 26 25 | class NonEmptyWithInit: -error[PYI012]: PYI012.pyi:28:5: [*] Class body must not contain `pass` +error[PYI012]: 28:5: [*] Class body must not contain `pass` + --> PYI012.pyi:28:5 | 26 | class NonEmptyWithInit: 27 | value: int diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI013_PYI013.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI013_PYI013.py.snap index a3d9a6e294..46b7916986 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI013_PYI013.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI013_PYI013.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI013]: PYI013.py:3:5: [*] Non-empty class body must not contain `...` +error[PYI013]: 3:5: [*] Non-empty class body must not contain `...` + --> PYI013.py:3:5 | 1 | class OneAttributeClass: 2 | value: int @@ -18,8 +19,9 @@ error[PYI013]: PYI013.py:3:5: [*] Non-empty class body must not contain `...` 5 4 | 6 5 | class OneAttributeClass2: -error[PYI013]: PYI013.py:7:5: [*] Non-empty class body must not contain `...` +error[PYI013]: 7:5: [*] Non-empty class body must not contain `...` + --> PYI013.py:7:5 | 6 | class OneAttributeClass2: 7 | ... @@ -36,8 +38,9 @@ error[PYI013]: PYI013.py:7:5: [*] Non-empty class body must not contain `...` 9 8 | 10 9 | -error[PYI013]: PYI013.py:12:5: [*] Non-empty class body must not contain `...` +error[PYI013]: 12:5: [*] Non-empty class body must not contain `...` + --> PYI013.py:12:5 | 11 | class TwoEllipsesClass: 12 | ... @@ -54,8 +57,9 @@ error[PYI013]: PYI013.py:12:5: [*] Non-empty class body must not contain `...` 15 14 | 16 15 | class DocstringClass: -error[PYI013]: PYI013.py:13:5: [*] Non-empty class body must not contain `...` +error[PYI013]: 13:5: [*] Non-empty class body must not contain `...` + --> PYI013.py:13:5 | 11 | class TwoEllipsesClass: 12 | ... @@ -72,8 +76,9 @@ error[PYI013]: PYI013.py:13:5: [*] Non-empty class body must not contain `...` 15 14 | 16 15 | class DocstringClass: -error[PYI013]: PYI013.py:21:5: [*] Non-empty class body must not contain `...` +error[PYI013]: 21:5: [*] Non-empty class body must not contain `...` + --> PYI013.py:21:5 | 19 | """ 20 | @@ -90,8 +95,9 @@ error[PYI013]: PYI013.py:21:5: [*] Non-empty class body must not contain `...` 23 22 | 24 23 | class NonEmptyChild(Exception): -error[PYI013]: PYI013.py:26:5: [*] Non-empty class body must not contain `...` +error[PYI013]: 26:5: [*] Non-empty class body must not contain `...` + --> PYI013.py:26:5 | 24 | class NonEmptyChild(Exception): 25 | value: int @@ -108,8 +114,9 @@ error[PYI013]: PYI013.py:26:5: [*] Non-empty class body must not contain `...` 28 27 | 29 28 | class NonEmptyChild2(Exception): -error[PYI013]: PYI013.py:30:5: [*] Non-empty class body must not contain `...` +error[PYI013]: 30:5: [*] Non-empty class body must not contain `...` + --> PYI013.py:30:5 | 29 | class NonEmptyChild2(Exception): 30 | ... @@ -126,8 +133,9 @@ error[PYI013]: PYI013.py:30:5: [*] Non-empty class body must not contain `...` 32 31 | 33 32 | -error[PYI013]: PYI013.py:36:5: [*] Non-empty class body must not contain `...` +error[PYI013]: 36:5: [*] Non-empty class body must not contain `...` + --> PYI013.py:36:5 | 34 | class NonEmptyWithInit: 35 | value: int diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI013_PYI013.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI013_PYI013.pyi.snap index 037f66ca79..c98c2fc754 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI013_PYI013.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI013_PYI013.pyi.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI013]: PYI013.pyi:5:5: [*] Non-empty class body must not contain `...` +error[PYI013]: 5:5: [*] Non-empty class body must not contain `...` + --> PYI013.pyi:5:5 | 3 | class OneAttributeClass: 4 | value: int @@ -21,8 +22,9 @@ error[PYI013]: PYI013.pyi:5:5: [*] Non-empty class body must not contain `...` 7 6 | class OneAttributeClass2: 8 7 | ... # Error -error[PYI013]: PYI013.pyi:8:5: [*] Non-empty class body must not contain `...` +error[PYI013]: 8:5: [*] Non-empty class body must not contain `...` + --> PYI013.pyi:8:5 | 7 | class OneAttributeClass2: 8 | ... # Error @@ -39,8 +41,9 @@ error[PYI013]: PYI013.pyi:8:5: [*] Non-empty class body must not contain `...` 10 9 | 11 10 | class MyClass: -error[PYI013]: PYI013.pyi:12:5: [*] Non-empty class body must not contain `...` +error[PYI013]: 12:5: [*] Non-empty class body must not contain `...` + --> PYI013.pyi:12:5 | 11 | class MyClass: 12 | ... @@ -57,8 +60,9 @@ error[PYI013]: PYI013.pyi:12:5: [*] Non-empty class body must not contain `...` 14 13 | 15 14 | class TwoEllipsesClass: -error[PYI013]: PYI013.pyi:16:5: [*] Non-empty class body must not contain `...` +error[PYI013]: 16:5: [*] Non-empty class body must not contain `...` + --> PYI013.pyi:16:5 | 15 | class TwoEllipsesClass: 16 | ... @@ -75,8 +79,9 @@ error[PYI013]: PYI013.pyi:16:5: [*] Non-empty class body must not contain `...` 18 17 | 19 18 | class DocstringClass: -error[PYI013]: PYI013.pyi:17:5: [*] Non-empty class body must not contain `...` +error[PYI013]: 17:5: [*] Non-empty class body must not contain `...` + --> PYI013.pyi:17:5 | 15 | class TwoEllipsesClass: 16 | ... @@ -95,8 +100,9 @@ error[PYI013]: PYI013.pyi:17:5: [*] Non-empty class body must not contain `...` 19 18 | class DocstringClass: 20 19 | """ -error[PYI013]: PYI013.pyi:24:5: [*] Non-empty class body must not contain `...` +error[PYI013]: 24:5: [*] Non-empty class body must not contain `...` + --> PYI013.pyi:24:5 | 22 | """ 23 | @@ -115,8 +121,9 @@ error[PYI013]: PYI013.pyi:24:5: [*] Non-empty class body must not contain `...` 26 25 | class NonEmptyChild(Exception): 27 26 | value: int -error[PYI013]: PYI013.pyi:28:5: [*] Non-empty class body must not contain `...` +error[PYI013]: 28:5: [*] Non-empty class body must not contain `...` + --> PYI013.pyi:28:5 | 26 | class NonEmptyChild(Exception): 27 | value: int @@ -135,8 +142,9 @@ error[PYI013]: PYI013.pyi:28:5: [*] Non-empty class body must not contain `...` 30 29 | class NonEmptyChild2(Exception): 31 30 | ... # Error -error[PYI013]: PYI013.pyi:31:5: [*] Non-empty class body must not contain `...` +error[PYI013]: 31:5: [*] Non-empty class body must not contain `...` + --> PYI013.pyi:31:5 | 30 | class NonEmptyChild2(Exception): 31 | ... # Error @@ -153,8 +161,9 @@ error[PYI013]: PYI013.pyi:31:5: [*] Non-empty class body must not contain `...` 33 32 | 34 33 | class NonEmptyWithInit: -error[PYI013]: PYI013.pyi:36:5: [*] Non-empty class body must not contain `...` +error[PYI013]: 36:5: [*] Non-empty class body must not contain `...` + --> PYI013.pyi:36:5 | 34 | class NonEmptyWithInit: 35 | value: int diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI014_PYI014.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI014_PYI014.pyi.snap index bc997439cf..11537b5a3e 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI014_PYI014.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI014_PYI014.pyi.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI014]: PYI014.pyi:3:7: [*] Only simple default values allowed for arguments +error[PYI014]: 3:7: [*] Only simple default values allowed for arguments + --> PYI014.pyi:3:7 | 1 | def f12( 2 | x, @@ -21,8 +22,9 @@ error[PYI014]: PYI014.pyi:3:7: [*] Only simple default values allowed for argume 5 5 | def f11(*, x="x") -> None: ... # OK 6 6 | def f13( -error[PYI014]: PYI014.pyi:29:7: [*] Only simple default values allowed for arguments +error[PYI014]: 29:7: [*] Only simple default values allowed for arguments + --> PYI014.pyi:29:7 | 27 | def f151(x={1: 2}) -> None: ... 28 | def f152( @@ -49,8 +51,9 @@ error[PYI014]: PYI014.pyi:29:7: [*] Only simple default values allowed for argum 34 31 | def f153( 35 32 | x=[ # Error PYI014 -error[PYI014]: PYI014.pyi:35:7: [*] Only simple default values allowed for arguments +error[PYI014]: 35:7: [*] Only simple default values allowed for arguments + --> PYI014.pyi:35:7 | 33 | ) -> None: ... 34 | def f153( @@ -95,8 +98,9 @@ error[PYI014]: PYI014.pyi:35:7: [*] Only simple default values allowed for argum 49 37 | def f154( 50 38 | x=( # Error PYI014 -error[PYI014]: PYI014.pyi:50:7: [*] Only simple default values allowed for arguments +error[PYI014]: 50:7: [*] Only simple default values allowed for arguments + --> PYI014.pyi:50:7 | 48 | ) -> None: ... 49 | def f154( @@ -123,8 +127,9 @@ error[PYI014]: PYI014.pyi:50:7: [*] Only simple default values allowed for argum 55 52 | def f141( 56 53 | x=[*range(10)], # Error PYI014 -error[PYI014]: PYI014.pyi:56:7: [*] Only simple default values allowed for arguments +error[PYI014]: 56:7: [*] Only simple default values allowed for arguments + --> PYI014.pyi:56:7 | 54 | ) -> None: ... 55 | def f141( @@ -144,8 +149,9 @@ error[PYI014]: PYI014.pyi:56:7: [*] Only simple default values allowed for argum 58 58 | def f142( 59 59 | x=list(range(10)), # Error PYI014 -error[PYI014]: PYI014.pyi:59:7: [*] Only simple default values allowed for arguments +error[PYI014]: 59:7: [*] Only simple default values allowed for arguments + --> PYI014.pyi:59:7 | 57 | ) -> None: ... 58 | def f142( @@ -165,8 +171,9 @@ error[PYI014]: PYI014.pyi:59:7: [*] Only simple default values allowed for argum 61 61 | def f16(x=frozenset({b"foo", b"bar", b"baz"})) -> None: ... # Error PYI014 62 62 | def f17( -error[PYI014]: PYI014.pyi:61:11: [*] Only simple default values allowed for arguments +error[PYI014]: 61:11: [*] Only simple default values allowed for arguments + --> PYI014.pyi:61:11 | 59 | x=list(range(10)), # Error PYI014 60 | ) -> None: ... @@ -186,8 +193,9 @@ error[PYI014]: PYI014.pyi:61:11: [*] Only simple default values allowed for argu 63 63 | x="foo" + "bar", # Error PYI014 64 64 | ) -> None: ... -error[PYI014]: PYI014.pyi:63:7: [*] Only simple default values allowed for arguments +error[PYI014]: 63:7: [*] Only simple default values allowed for arguments + --> PYI014.pyi:63:7 | 61 | def f16(x=frozenset({b"foo", b"bar", b"baz"})) -> None: ... # Error PYI014 62 | def f17( @@ -207,8 +215,9 @@ error[PYI014]: PYI014.pyi:63:7: [*] Only simple default values allowed for argum 65 65 | def f18( 66 66 | x=b"foo" + b"bar", # Error PYI014 -error[PYI014]: PYI014.pyi:66:7: [*] Only simple default values allowed for arguments +error[PYI014]: 66:7: [*] Only simple default values allowed for arguments + --> PYI014.pyi:66:7 | 64 | ) -> None: ... 65 | def f18( @@ -228,8 +237,9 @@ error[PYI014]: PYI014.pyi:66:7: [*] Only simple default values allowed for argum 68 68 | def f19( 69 69 | x="foo" + 4, # Error PYI014 -error[PYI014]: PYI014.pyi:69:7: [*] Only simple default values allowed for arguments +error[PYI014]: 69:7: [*] Only simple default values allowed for arguments + --> PYI014.pyi:69:7 | 67 | ) -> None: ... 68 | def f19( @@ -249,8 +259,9 @@ error[PYI014]: PYI014.pyi:69:7: [*] Only simple default values allowed for argum 71 71 | def f20( 72 72 | x=5 + 5, # Error PYI014 -error[PYI014]: PYI014.pyi:72:7: [*] Only simple default values allowed for arguments +error[PYI014]: 72:7: [*] Only simple default values allowed for arguments + --> PYI014.pyi:72:7 | 70 | ) -> None: ... 71 | def f20( @@ -270,8 +281,9 @@ error[PYI014]: PYI014.pyi:72:7: [*] Only simple default values allowed for argum 74 74 | def f21( 75 75 | x=3j - 3j, # Error PYI014 -error[PYI014]: PYI014.pyi:75:7: [*] Only simple default values allowed for arguments +error[PYI014]: 75:7: [*] Only simple default values allowed for arguments + --> PYI014.pyi:75:7 | 73 | ) -> None: ... 74 | def f21( @@ -291,8 +303,9 @@ error[PYI014]: PYI014.pyi:75:7: [*] Only simple default values allowed for argum 77 77 | def f22( 78 78 | x=-42.5j + 4.3j, # Error PYI014 -error[PYI014]: PYI014.pyi:78:7: [*] Only simple default values allowed for arguments +error[PYI014]: 78:7: [*] Only simple default values allowed for arguments + --> PYI014.pyi:78:7 | 76 | ) -> None: ... 77 | def f22( diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI015_PYI015.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI015_PYI015.pyi.snap index e2af939733..bbcc1224bb 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI015_PYI015.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI015_PYI015.pyi.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI015]: PYI015.pyi:44:23: [*] Only simple default values allowed for assignments +error[PYI015]: 44:23: [*] Only simple default values allowed for assignments + --> PYI015.pyi:44:23 | 43 | # We *should* emit Y015 for more complex default values 44 | field221: list[int] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] # Y015 Only simple default values are allowed for assignments @@ -21,8 +22,9 @@ error[PYI015]: PYI015.pyi:44:23: [*] Only simple default values allowed for assi 46 46 | field224: list[int] = list(range(10)) # Y015 Only simple default values are allowed for assignments 47 47 | field225: list[object] = [{}, 1, 2] # Y015 Only simple default values are allowed for assignments -error[PYI015]: PYI015.pyi:45:23: [*] Only simple default values allowed for assignments +error[PYI015]: 45:23: [*] Only simple default values allowed for assignments + --> PYI015.pyi:45:23 | 43 | # We *should* emit Y015 for more complex default values 44 | field221: list[int] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] # Y015 Only simple default values are allowed for assignments @@ -42,8 +44,9 @@ error[PYI015]: PYI015.pyi:45:23: [*] Only simple default values allowed for assi 47 47 | field225: list[object] = [{}, 1, 2] # Y015 Only simple default values are allowed for assignments 48 48 | field226: tuple[str | tuple[str, ...], ...] = ("foo", ("foo", "bar")) # Y015 Only simple default values are allowed for assignments -error[PYI015]: PYI015.pyi:46:23: [*] Only simple default values allowed for assignments +error[PYI015]: 46:23: [*] Only simple default values allowed for assignments + --> PYI015.pyi:46:23 | 44 | field221: list[int] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] # Y015 Only simple default values are allowed for assignments 45 | field223: list[int] = [*range(10)] # Y015 Only simple default values are allowed for assignments @@ -63,8 +66,9 @@ error[PYI015]: PYI015.pyi:46:23: [*] Only simple default values allowed for assi 48 48 | field226: tuple[str | tuple[str, ...], ...] = ("foo", ("foo", "bar")) # Y015 Only simple default values are allowed for assignments 49 49 | field227: dict[str, object] = {"foo": {"foo": "bar"}} # Y015 Only simple default values are allowed for assignments -error[PYI015]: PYI015.pyi:47:26: [*] Only simple default values allowed for assignments +error[PYI015]: 47:26: [*] Only simple default values allowed for assignments + --> PYI015.pyi:47:26 | 45 | field223: list[int] = [*range(10)] # Y015 Only simple default values are allowed for assignments 46 | field224: list[int] = list(range(10)) # Y015 Only simple default values are allowed for assignments @@ -84,8 +88,9 @@ error[PYI015]: PYI015.pyi:47:26: [*] Only simple default values allowed for assi 49 49 | field227: dict[str, object] = {"foo": {"foo": "bar"}} # Y015 Only simple default values are allowed for assignments 50 50 | field228: dict[str, list[object]] = {"foo": []} # Y015 Only simple default values are allowed for assignments -error[PYI015]: PYI015.pyi:48:47: [*] Only simple default values allowed for assignments +error[PYI015]: 48:47: [*] Only simple default values allowed for assignments + --> PYI015.pyi:48:47 | 46 | field224: list[int] = list(range(10)) # Y015 Only simple default values are allowed for assignments 47 | field225: list[object] = [{}, 1, 2] # Y015 Only simple default values are allowed for assignments @@ -105,8 +110,9 @@ error[PYI015]: PYI015.pyi:48:47: [*] Only simple default values allowed for assi 50 50 | field228: dict[str, list[object]] = {"foo": []} # Y015 Only simple default values are allowed for assignments 51 51 | # When parsed, this case results in `None` being placed in the `.keys` list for the `ast.Dict` node -error[PYI015]: PYI015.pyi:49:31: [*] Only simple default values allowed for assignments +error[PYI015]: 49:31: [*] Only simple default values allowed for assignments + --> PYI015.pyi:49:31 | 47 | field225: list[object] = [{}, 1, 2] # Y015 Only simple default values are allowed for assignments 48 | field226: tuple[str | tuple[str, ...], ...] = ("foo", ("foo", "bar")) # Y015 Only simple default values are allowed for assignments @@ -126,8 +132,9 @@ error[PYI015]: PYI015.pyi:49:31: [*] Only simple default values allowed for assi 51 51 | # When parsed, this case results in `None` being placed in the `.keys` list for the `ast.Dict` node 52 52 | field229: dict[int, int] = {1: 2, **{3: 4}} # Y015 Only simple default values are allowed for assignments -error[PYI015]: PYI015.pyi:50:37: [*] Only simple default values allowed for assignments +error[PYI015]: 50:37: [*] Only simple default values allowed for assignments + --> PYI015.pyi:50:37 | 48 | field226: tuple[str | tuple[str, ...], ...] = ("foo", ("foo", "bar")) # Y015 Only simple default values are allowed for assignments 49 | field227: dict[str, object] = {"foo": {"foo": "bar"}} # Y015 Only simple default values are allowed for assignments @@ -147,8 +154,9 @@ error[PYI015]: PYI015.pyi:50:37: [*] Only simple default values allowed for assi 52 52 | field229: dict[int, int] = {1: 2, **{3: 4}} # Y015 Only simple default values are allowed for assignments 53 53 | field23 = "foo" + "bar" # Y015 Only simple default values are allowed for assignments -error[PYI015]: PYI015.pyi:52:28: [*] Only simple default values allowed for assignments +error[PYI015]: 52:28: [*] Only simple default values allowed for assignments + --> PYI015.pyi:52:28 | 50 | field228: dict[str, list[object]] = {"foo": []} # Y015 Only simple default values are allowed for assignments 51 | # When parsed, this case results in `None` being placed in the `.keys` list for the `ast.Dict` node @@ -168,8 +176,9 @@ error[PYI015]: PYI015.pyi:52:28: [*] Only simple default values allowed for assi 54 54 | field24 = b"foo" + b"bar" # Y015 Only simple default values are allowed for assignments 55 55 | field25 = 5 * 5 # Y015 Only simple default values are allowed for assignments -error[PYI015]: PYI015.pyi:53:11: [*] Only simple default values allowed for assignments +error[PYI015]: 53:11: [*] Only simple default values allowed for assignments + --> PYI015.pyi:53:11 | 51 | # When parsed, this case results in `None` being placed in the `.keys` list for the `ast.Dict` node 52 | field229: dict[int, int] = {1: 2, **{3: 4}} # Y015 Only simple default values are allowed for assignments @@ -189,8 +198,9 @@ error[PYI015]: PYI015.pyi:53:11: [*] Only simple default values allowed for assi 55 55 | field25 = 5 * 5 # Y015 Only simple default values are allowed for assignments 56 56 | -error[PYI015]: PYI015.pyi:54:11: [*] Only simple default values allowed for assignments +error[PYI015]: 54:11: [*] Only simple default values allowed for assignments + --> PYI015.pyi:54:11 | 52 | field229: dict[int, int] = {1: 2, **{3: 4}} # Y015 Only simple default values are allowed for assignments 53 | field23 = "foo" + "bar" # Y015 Only simple default values are allowed for assignments @@ -209,8 +219,9 @@ error[PYI015]: PYI015.pyi:54:11: [*] Only simple default values allowed for assi 56 56 | 57 57 | # We shouldn't emit Y015 within functions -error[PYI015]: PYI015.pyi:55:11: [*] Only simple default values allowed for assignments +error[PYI015]: 55:11: [*] Only simple default values allowed for assignments + --> PYI015.pyi:55:11 | 53 | field23 = "foo" + "bar" # Y015 Only simple default values are allowed for assignments 54 | field24 = b"foo" + b"bar" # Y015 Only simple default values are allowed for assignments diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI016_PYI016.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI016_PYI016.py.snap index 2089b6084d..1cb64cfb1a 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI016_PYI016.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI016_PYI016.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI016]: PYI016.py:7:15: [*] Duplicate union member `str` +error[PYI016]: 7:15: [*] Duplicate union member `str` + --> PYI016.py:7:15 | 6 | # Should emit for duplicate field types. 7 | field2: str | str # PYI016: Duplicate union member `str` @@ -21,8 +22,9 @@ error[PYI016]: PYI016.py:7:15: [*] Duplicate union member `str` 9 9 | # Should emit for union types in arguments. 10 10 | def func1(arg1: int | int): # PYI016: Duplicate union member `int` -error[PYI016]: PYI016.py:10:23: [*] Duplicate union member `int` +error[PYI016]: 10:23: [*] Duplicate union member `int` + --> PYI016.py:10:23 | 9 | # Should emit for union types in arguments. 10 | def func1(arg1: int | int): # PYI016: Duplicate union member `int` @@ -40,8 +42,9 @@ error[PYI016]: PYI016.py:10:23: [*] Duplicate union member `int` 12 12 | 13 13 | # Should emit for unions in return types. -error[PYI016]: PYI016.py:14:22: [*] Duplicate union member `str` +error[PYI016]: 14:22: [*] Duplicate union member `str` + --> PYI016.py:14:22 | 13 | # Should emit for unions in return types. 14 | def func2() -> str | str: # PYI016: Duplicate union member `str` @@ -59,8 +62,9 @@ error[PYI016]: PYI016.py:14:22: [*] Duplicate union member `str` 16 16 | 17 17 | # Should emit in longer unions, even if not directly adjacent. -error[PYI016]: PYI016.py:18:15: [*] Duplicate union member `str` +error[PYI016]: 18:15: [*] Duplicate union member `str` + --> PYI016.py:18:15 | 17 | # Should emit in longer unions, even if not directly adjacent. 18 | field3: str | str | int # PYI016: Duplicate union member `str` @@ -79,8 +83,9 @@ error[PYI016]: PYI016.py:18:15: [*] Duplicate union member `str` 20 20 | field5: str | int | str # PYI016: Duplicate union member `str` 21 21 | field6: int | bool | str | int # PYI016: Duplicate union member `int` -error[PYI016]: PYI016.py:19:15: [*] Duplicate union member `int` +error[PYI016]: 19:15: [*] Duplicate union member `int` + --> PYI016.py:19:15 | 17 | # Should emit in longer unions, even if not directly adjacent. 18 | field3: str | str | int # PYI016: Duplicate union member `str` @@ -100,8 +105,9 @@ error[PYI016]: PYI016.py:19:15: [*] Duplicate union member `int` 21 21 | field6: int | bool | str | int # PYI016: Duplicate union member `int` 22 22 | -error[PYI016]: PYI016.py:20:21: [*] Duplicate union member `str` +error[PYI016]: 20:21: [*] Duplicate union member `str` + --> PYI016.py:20:21 | 18 | field3: str | str | int # PYI016: Duplicate union member `str` 19 | field4: int | int | str # PYI016: Duplicate union member `int` @@ -120,8 +126,9 @@ error[PYI016]: PYI016.py:20:21: [*] Duplicate union member `str` 22 22 | 23 23 | # Shouldn't emit for non-type unions. -error[PYI016]: PYI016.py:21:28: [*] Duplicate union member `int` +error[PYI016]: 21:28: [*] Duplicate union member `int` + --> PYI016.py:21:28 | 19 | field4: int | int | str # PYI016: Duplicate union member `int` 20 | field5: str | int | str # PYI016: Duplicate union member `str` @@ -141,8 +148,9 @@ error[PYI016]: PYI016.py:21:28: [*] Duplicate union member `int` 23 23 | # Shouldn't emit for non-type unions. 24 24 | field7 = str | str -error[PYI016]: PYI016.py:27:22: [*] Duplicate union member `int` +error[PYI016]: 27:22: [*] Duplicate union member `int` + --> PYI016.py:27:22 | 26 | # Should emit for strangely-bracketed unions. 27 | field8: int | (str | int) # PYI016: Duplicate union member `int` @@ -161,8 +169,9 @@ error[PYI016]: PYI016.py:27:22: [*] Duplicate union member `int` 29 29 | # Should handle user brackets when fixing. 30 30 | field9: int | (int | str) # PYI016: Duplicate union member `int` -error[PYI016]: PYI016.py:30:16: [*] Duplicate union member `int` +error[PYI016]: 30:16: [*] Duplicate union member `int` + --> PYI016.py:30:16 | 29 | # Should handle user brackets when fixing. 30 | field9: int | (int | str) # PYI016: Duplicate union member `int` @@ -180,8 +189,9 @@ error[PYI016]: PYI016.py:30:16: [*] Duplicate union member `int` 32 32 | 33 33 | # Should emit for nested unions. -error[PYI016]: PYI016.py:31:24: [*] Duplicate union member `str` +error[PYI016]: 31:24: [*] Duplicate union member `str` + --> PYI016.py:31:24 | 29 | # Should handle user brackets when fixing. 30 | field9: int | (int | str) # PYI016: Duplicate union member `int` @@ -201,8 +211,9 @@ error[PYI016]: PYI016.py:31:24: [*] Duplicate union member `str` 33 33 | # Should emit for nested unions. 34 34 | field11: dict[int | int, str] -error[PYI016]: PYI016.py:34:21: [*] Duplicate union member `int` +error[PYI016]: 34:21: [*] Duplicate union member `int` + --> PYI016.py:34:21 | 33 | # Should emit for nested unions. 34 | field11: dict[int | int, str] @@ -221,8 +232,9 @@ error[PYI016]: PYI016.py:34:21: [*] Duplicate union member `int` 36 36 | # Should emit for unions with more than two cases 37 37 | field12: int | int | int # Error -error[PYI016]: PYI016.py:37:16: [*] Duplicate union member `int` +error[PYI016]: 37:16: [*] Duplicate union member `int` + --> PYI016.py:37:16 | 36 | # Should emit for unions with more than two cases 37 | field12: int | int | int # Error @@ -240,8 +252,9 @@ error[PYI016]: PYI016.py:37:16: [*] Duplicate union member `int` 39 39 | 40 40 | # Should emit for unions with more than two cases, even if not directly adjacent -error[PYI016]: PYI016.py:37:22: [*] Duplicate union member `int` +error[PYI016]: 37:22: [*] Duplicate union member `int` + --> PYI016.py:37:22 | 36 | # Should emit for unions with more than two cases 37 | field12: int | int | int # Error @@ -259,8 +272,9 @@ error[PYI016]: PYI016.py:37:22: [*] Duplicate union member `int` 39 39 | 40 40 | # Should emit for unions with more than two cases, even if not directly adjacent -error[PYI016]: PYI016.py:38:16: [*] Duplicate union member `int` +error[PYI016]: 38:16: [*] Duplicate union member `int` + --> PYI016.py:38:16 | 36 | # Should emit for unions with more than two cases 37 | field12: int | int | int # Error @@ -280,8 +294,9 @@ error[PYI016]: PYI016.py:38:16: [*] Duplicate union member `int` 40 40 | # Should emit for unions with more than two cases, even if not directly adjacent 41 41 | field14: int | int | str | int # Error -error[PYI016]: PYI016.py:38:22: [*] Duplicate union member `int` +error[PYI016]: 38:22: [*] Duplicate union member `int` + --> PYI016.py:38:22 | 36 | # Should emit for unions with more than two cases 37 | field12: int | int | int # Error @@ -301,8 +316,9 @@ error[PYI016]: PYI016.py:38:22: [*] Duplicate union member `int` 40 40 | # Should emit for unions with more than two cases, even if not directly adjacent 41 41 | field14: int | int | str | int # Error -error[PYI016]: PYI016.py:38:28: [*] Duplicate union member `int` +error[PYI016]: 38:28: [*] Duplicate union member `int` + --> PYI016.py:38:28 | 36 | # Should emit for unions with more than two cases 37 | field12: int | int | int # Error @@ -322,8 +338,9 @@ error[PYI016]: PYI016.py:38:28: [*] Duplicate union member `int` 40 40 | # Should emit for unions with more than two cases, even if not directly adjacent 41 41 | field14: int | int | str | int # Error -error[PYI016]: PYI016.py:41:16: [*] Duplicate union member `int` +error[PYI016]: 41:16: [*] Duplicate union member `int` + --> PYI016.py:41:16 | 40 | # Should emit for unions with more than two cases, even if not directly adjacent 41 | field14: int | int | str | int # Error @@ -342,8 +359,9 @@ error[PYI016]: PYI016.py:41:16: [*] Duplicate union member `int` 43 43 | # Should emit for duplicate literal types; also covered by PYI030 44 44 | field15: typing.Literal[1] | typing.Literal[1] # Error -error[PYI016]: PYI016.py:41:28: [*] Duplicate union member `int` +error[PYI016]: 41:28: [*] Duplicate union member `int` + --> PYI016.py:41:28 | 40 | # Should emit for unions with more than two cases, even if not directly adjacent 41 | field14: int | int | str | int # Error @@ -362,8 +380,9 @@ error[PYI016]: PYI016.py:41:28: [*] Duplicate union member `int` 43 43 | # Should emit for duplicate literal types; also covered by PYI030 44 44 | field15: typing.Literal[1] | typing.Literal[1] # Error -error[PYI016]: PYI016.py:44:30: [*] Duplicate union member `typing.Literal[1]` +error[PYI016]: 44:30: [*] Duplicate union member `typing.Literal[1]` + --> PYI016.py:44:30 | 43 | # Should emit for duplicate literal types; also covered by PYI030 44 | field15: typing.Literal[1] | typing.Literal[1] # Error @@ -382,8 +401,9 @@ error[PYI016]: PYI016.py:44:30: [*] Duplicate union member `typing.Literal[1]` 46 46 | # Shouldn't emit if in new parent type 47 47 | field16: int | dict[int, str] # OK -error[PYI016]: PYI016.py:57:5: Duplicate union member `set[int]` +error[PYI016]: 57:5: Duplicate union member `set[int]` + --> PYI016.py:57:5 | 55 | int # foo 56 | ], @@ -395,8 +415,9 @@ error[PYI016]: PYI016.py:57:5: Duplicate union member `set[int]` 60 | ] # Error, newline and comment will not be emitted in message | = help: Remove duplicate union member `set[int]` -error[PYI016]: PYI016.py:63:28: Duplicate union member `int` +error[PYI016]: 63:28: Duplicate union member `int` + --> PYI016.py:63:28 | 62 | # Should emit in cases with `typing.Union` instead of `|` 63 | field19: typing.Union[int, int] # Error @@ -405,8 +426,9 @@ error[PYI016]: PYI016.py:63:28: Duplicate union member `int` 65 | # Should emit in cases with nested `typing.Union` | = help: Remove duplicate union member `int` -error[PYI016]: PYI016.py:66:41: Duplicate union member `int` +error[PYI016]: 66:41: Duplicate union member `int` + --> PYI016.py:66:41 | 65 | # Should emit in cases with nested `typing.Union` 66 | field20: typing.Union[int, typing.Union[int, str]] # Error @@ -415,8 +437,9 @@ error[PYI016]: PYI016.py:66:41: Duplicate union member `int` 68 | # Should emit in cases with mixed `typing.Union` and `|` | = help: Remove duplicate union member `int` -error[PYI016]: PYI016.py:69:28: [*] Duplicate union member `int` +error[PYI016]: 69:28: [*] Duplicate union member `int` + --> PYI016.py:69:28 | 68 | # Should emit in cases with mixed `typing.Union` and `|` 69 | field21: typing.Union[int, int | str] # Error @@ -435,8 +458,9 @@ error[PYI016]: PYI016.py:69:28: [*] Duplicate union member `int` 71 71 | # Should emit only once in cases with multiple nested `typing.Union` 72 72 | field22: typing.Union[int, typing.Union[int, typing.Union[int, int]]] # Error -error[PYI016]: PYI016.py:72:41: Duplicate union member `int` +error[PYI016]: 72:41: Duplicate union member `int` + --> PYI016.py:72:41 | 71 | # Should emit only once in cases with multiple nested `typing.Union` 72 | field22: typing.Union[int, typing.Union[int, typing.Union[int, int]]] # Error @@ -445,8 +469,9 @@ error[PYI016]: PYI016.py:72:41: Duplicate union member `int` 74 | # Should emit in cases with newlines | = help: Remove duplicate union member `int` -error[PYI016]: PYI016.py:72:59: Duplicate union member `int` +error[PYI016]: 72:59: Duplicate union member `int` + --> PYI016.py:72:59 | 71 | # Should emit only once in cases with multiple nested `typing.Union` 72 | field22: typing.Union[int, typing.Union[int, typing.Union[int, int]]] # Error @@ -455,8 +480,9 @@ error[PYI016]: PYI016.py:72:59: Duplicate union member `int` 74 | # Should emit in cases with newlines | = help: Remove duplicate union member `int` -error[PYI016]: PYI016.py:72:64: Duplicate union member `int` +error[PYI016]: 72:64: Duplicate union member `int` + --> PYI016.py:72:64 | 71 | # Should emit only once in cases with multiple nested `typing.Union` 72 | field22: typing.Union[int, typing.Union[int, typing.Union[int, int]]] # Error @@ -465,8 +491,9 @@ error[PYI016]: PYI016.py:72:64: Duplicate union member `int` 74 | # Should emit in cases with newlines | = help: Remove duplicate union member `int` -error[PYI016]: PYI016.py:76:12: [*] Duplicate union member `set[int]` +error[PYI016]: 76:12: [*] Duplicate union member `set[int]` + --> PYI016.py:76:12 | 74 | # Should emit in cases with newlines 75 | field23: set[ # foo @@ -486,8 +513,9 @@ error[PYI016]: PYI016.py:76:12: [*] Duplicate union member `set[int]` 78 78 | # Should emit twice (once for each `int` in the nested union, both of which are 79 79 | # duplicates of the outer `int`), but not three times (which would indicate that -error[PYI016]: PYI016.py:81:41: Duplicate union member `int` +error[PYI016]: 81:41: Duplicate union member `int` + --> PYI016.py:81:41 | 79 | # duplicates of the outer `int`), but not three times (which would indicate that 80 | # we incorrectly re-checked the nested union). @@ -497,8 +525,9 @@ error[PYI016]: PYI016.py:81:41: Duplicate union member `int` 83 | # Should emit twice (once for each `int` in the nested union, both of which are | = help: Remove duplicate union member `int` -error[PYI016]: PYI016.py:81:46: Duplicate union member `int` +error[PYI016]: 81:46: Duplicate union member `int` + --> PYI016.py:81:46 | 79 | # duplicates of the outer `int`), but not three times (which would indicate that 80 | # we incorrectly re-checked the nested union). @@ -508,8 +537,9 @@ error[PYI016]: PYI016.py:81:46: Duplicate union member `int` 83 | # Should emit twice (once for each `int` in the nested union, both of which are | = help: Remove duplicate union member `int` -error[PYI016]: PYI016.py:86:28: [*] Duplicate union member `int` +error[PYI016]: 86:28: [*] Duplicate union member `int` + --> PYI016.py:86:28 | 84 | # duplicates of the outer `int`), but not three times (which would indicate that 85 | # we incorrectly re-checked the nested union). @@ -524,8 +554,9 @@ error[PYI016]: PYI016.py:86:28: [*] Duplicate union member `int` 86 |-field25: typing.Union[int, int | int] # PYI016: Duplicate union member `int` 86 |+field25: typing.Union[int, int] # PYI016: Duplicate union member `int` -error[PYI016]: PYI016.py:86:34: [*] Duplicate union member `int` +error[PYI016]: 86:34: [*] Duplicate union member `int` + --> PYI016.py:86:34 | 84 | # duplicates of the outer `int`), but not three times (which would indicate that 85 | # we incorrectly re-checked the nested union). diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI016_PYI016.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI016_PYI016.pyi.snap index 75106ec61e..9e7b71543f 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI016_PYI016.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI016_PYI016.pyi.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI016]: PYI016.pyi:7:15: [*] Duplicate union member `str` +error[PYI016]: 7:15: [*] Duplicate union member `str` + --> PYI016.pyi:7:15 | 6 | # Should emit for duplicate field types. 7 | field2: str | str # PYI016: Duplicate union member `str` @@ -21,8 +22,9 @@ error[PYI016]: PYI016.pyi:7:15: [*] Duplicate union member `str` 9 9 | # Should emit for union types in arguments. 10 10 | def func1(arg1: int | int): # PYI016: Duplicate union member `int` -error[PYI016]: PYI016.pyi:10:23: [*] Duplicate union member `int` +error[PYI016]: 10:23: [*] Duplicate union member `int` + --> PYI016.pyi:10:23 | 9 | # Should emit for union types in arguments. 10 | def func1(arg1: int | int): # PYI016: Duplicate union member `int` @@ -40,8 +42,9 @@ error[PYI016]: PYI016.pyi:10:23: [*] Duplicate union member `int` 12 12 | 13 13 | # Should emit for unions in return types. -error[PYI016]: PYI016.pyi:14:22: [*] Duplicate union member `str` +error[PYI016]: 14:22: [*] Duplicate union member `str` + --> PYI016.pyi:14:22 | 13 | # Should emit for unions in return types. 14 | def func2() -> str | str: # PYI016: Duplicate union member `str` @@ -59,8 +62,9 @@ error[PYI016]: PYI016.pyi:14:22: [*] Duplicate union member `str` 16 16 | 17 17 | # Should emit in longer unions, even if not directly adjacent. -error[PYI016]: PYI016.pyi:18:15: [*] Duplicate union member `str` +error[PYI016]: 18:15: [*] Duplicate union member `str` + --> PYI016.pyi:18:15 | 17 | # Should emit in longer unions, even if not directly adjacent. 18 | field3: str | str | int # PYI016: Duplicate union member `str` @@ -79,8 +83,9 @@ error[PYI016]: PYI016.pyi:18:15: [*] Duplicate union member `str` 20 20 | field5: str | int | str # PYI016: Duplicate union member `str` 21 21 | field6: int | bool | str | int # PYI016: Duplicate union member `int` -error[PYI016]: PYI016.pyi:19:15: [*] Duplicate union member `int` +error[PYI016]: 19:15: [*] Duplicate union member `int` + --> PYI016.pyi:19:15 | 17 | # Should emit in longer unions, even if not directly adjacent. 18 | field3: str | str | int # PYI016: Duplicate union member `str` @@ -100,8 +105,9 @@ error[PYI016]: PYI016.pyi:19:15: [*] Duplicate union member `int` 21 21 | field6: int | bool | str | int # PYI016: Duplicate union member `int` 22 22 | -error[PYI016]: PYI016.pyi:20:21: [*] Duplicate union member `str` +error[PYI016]: 20:21: [*] Duplicate union member `str` + --> PYI016.pyi:20:21 | 18 | field3: str | str | int # PYI016: Duplicate union member `str` 19 | field4: int | int | str # PYI016: Duplicate union member `int` @@ -120,8 +126,9 @@ error[PYI016]: PYI016.pyi:20:21: [*] Duplicate union member `str` 22 22 | 23 23 | # Shouldn't emit for non-type unions. -error[PYI016]: PYI016.pyi:21:28: [*] Duplicate union member `int` +error[PYI016]: 21:28: [*] Duplicate union member `int` + --> PYI016.pyi:21:28 | 19 | field4: int | int | str # PYI016: Duplicate union member `int` 20 | field5: str | int | str # PYI016: Duplicate union member `str` @@ -141,8 +148,9 @@ error[PYI016]: PYI016.pyi:21:28: [*] Duplicate union member `int` 23 23 | # Shouldn't emit for non-type unions. 24 24 | field7 = str | str -error[PYI016]: PYI016.pyi:27:22: [*] Duplicate union member `int` +error[PYI016]: 27:22: [*] Duplicate union member `int` + --> PYI016.pyi:27:22 | 26 | # Should emit for strangely-bracketed unions. 27 | field8: int | (str | int) # PYI016: Duplicate union member `int` @@ -161,8 +169,9 @@ error[PYI016]: PYI016.pyi:27:22: [*] Duplicate union member `int` 29 29 | # Should handle user brackets when fixing. 30 30 | field9: int | (int | str) # PYI016: Duplicate union member `int` -error[PYI016]: PYI016.pyi:30:16: [*] Duplicate union member `int` +error[PYI016]: 30:16: [*] Duplicate union member `int` + --> PYI016.pyi:30:16 | 29 | # Should handle user brackets when fixing. 30 | field9: int | (int | str) # PYI016: Duplicate union member `int` @@ -180,8 +189,9 @@ error[PYI016]: PYI016.pyi:30:16: [*] Duplicate union member `int` 32 32 | 33 33 | # Should emit for nested unions. -error[PYI016]: PYI016.pyi:31:24: [*] Duplicate union member `str` +error[PYI016]: 31:24: [*] Duplicate union member `str` + --> PYI016.pyi:31:24 | 29 | # Should handle user brackets when fixing. 30 | field9: int | (int | str) # PYI016: Duplicate union member `int` @@ -201,8 +211,9 @@ error[PYI016]: PYI016.pyi:31:24: [*] Duplicate union member `str` 33 33 | # Should emit for nested unions. 34 34 | field11: dict[int | int, str] -error[PYI016]: PYI016.pyi:34:21: [*] Duplicate union member `int` +error[PYI016]: 34:21: [*] Duplicate union member `int` + --> PYI016.pyi:34:21 | 33 | # Should emit for nested unions. 34 | field11: dict[int | int, str] @@ -221,8 +232,9 @@ error[PYI016]: PYI016.pyi:34:21: [*] Duplicate union member `int` 36 36 | # Should emit for unions with more than two cases 37 37 | field12: int | int | int # Error -error[PYI016]: PYI016.pyi:37:16: [*] Duplicate union member `int` +error[PYI016]: 37:16: [*] Duplicate union member `int` + --> PYI016.pyi:37:16 | 36 | # Should emit for unions with more than two cases 37 | field12: int | int | int # Error @@ -240,8 +252,9 @@ error[PYI016]: PYI016.pyi:37:16: [*] Duplicate union member `int` 39 39 | 40 40 | # Should emit for unions with more than two cases, even if not directly adjacent -error[PYI016]: PYI016.pyi:37:22: [*] Duplicate union member `int` +error[PYI016]: 37:22: [*] Duplicate union member `int` + --> PYI016.pyi:37:22 | 36 | # Should emit for unions with more than two cases 37 | field12: int | int | int # Error @@ -259,8 +272,9 @@ error[PYI016]: PYI016.pyi:37:22: [*] Duplicate union member `int` 39 39 | 40 40 | # Should emit for unions with more than two cases, even if not directly adjacent -error[PYI016]: PYI016.pyi:38:16: [*] Duplicate union member `int` +error[PYI016]: 38:16: [*] Duplicate union member `int` + --> PYI016.pyi:38:16 | 36 | # Should emit for unions with more than two cases 37 | field12: int | int | int # Error @@ -280,8 +294,9 @@ error[PYI016]: PYI016.pyi:38:16: [*] Duplicate union member `int` 40 40 | # Should emit for unions with more than two cases, even if not directly adjacent 41 41 | field14: int | int | str | int # Error -error[PYI016]: PYI016.pyi:38:22: [*] Duplicate union member `int` +error[PYI016]: 38:22: [*] Duplicate union member `int` + --> PYI016.pyi:38:22 | 36 | # Should emit for unions with more than two cases 37 | field12: int | int | int # Error @@ -301,8 +316,9 @@ error[PYI016]: PYI016.pyi:38:22: [*] Duplicate union member `int` 40 40 | # Should emit for unions with more than two cases, even if not directly adjacent 41 41 | field14: int | int | str | int # Error -error[PYI016]: PYI016.pyi:38:28: [*] Duplicate union member `int` +error[PYI016]: 38:28: [*] Duplicate union member `int` + --> PYI016.pyi:38:28 | 36 | # Should emit for unions with more than two cases 37 | field12: int | int | int # Error @@ -322,8 +338,9 @@ error[PYI016]: PYI016.pyi:38:28: [*] Duplicate union member `int` 40 40 | # Should emit for unions with more than two cases, even if not directly adjacent 41 41 | field14: int | int | str | int # Error -error[PYI016]: PYI016.pyi:41:16: [*] Duplicate union member `int` +error[PYI016]: 41:16: [*] Duplicate union member `int` + --> PYI016.pyi:41:16 | 40 | # Should emit for unions with more than two cases, even if not directly adjacent 41 | field14: int | int | str | int # Error @@ -342,8 +359,9 @@ error[PYI016]: PYI016.pyi:41:16: [*] Duplicate union member `int` 43 43 | # Should emit for duplicate literal types; also covered by PYI030 44 44 | field15: typing.Literal[1] | typing.Literal[1] # Error -error[PYI016]: PYI016.pyi:41:28: [*] Duplicate union member `int` +error[PYI016]: 41:28: [*] Duplicate union member `int` + --> PYI016.pyi:41:28 | 40 | # Should emit for unions with more than two cases, even if not directly adjacent 41 | field14: int | int | str | int # Error @@ -362,8 +380,9 @@ error[PYI016]: PYI016.pyi:41:28: [*] Duplicate union member `int` 43 43 | # Should emit for duplicate literal types; also covered by PYI030 44 44 | field15: typing.Literal[1] | typing.Literal[1] # Error -error[PYI016]: PYI016.pyi:44:30: [*] Duplicate union member `typing.Literal[1]` +error[PYI016]: 44:30: [*] Duplicate union member `typing.Literal[1]` + --> PYI016.pyi:44:30 | 43 | # Should emit for duplicate literal types; also covered by PYI030 44 | field15: typing.Literal[1] | typing.Literal[1] # Error @@ -382,8 +401,9 @@ error[PYI016]: PYI016.pyi:44:30: [*] Duplicate union member `typing.Literal[1]` 46 46 | # Shouldn't emit if in new parent type 47 47 | field16: int | dict[int, str] # OK -error[PYI016]: PYI016.pyi:57:5: Duplicate union member `set[int]` +error[PYI016]: 57:5: Duplicate union member `set[int]` + --> PYI016.pyi:57:5 | 55 | int # foo 56 | ], @@ -395,8 +415,9 @@ error[PYI016]: PYI016.pyi:57:5: Duplicate union member `set[int]` 60 | ] # Error, newline and comment will not be emitted in message | = help: Remove duplicate union member `set[int]` -error[PYI016]: PYI016.pyi:63:28: Duplicate union member `int` +error[PYI016]: 63:28: Duplicate union member `int` + --> PYI016.pyi:63:28 | 62 | # Should emit in cases with `typing.Union` instead of `|` 63 | field19: typing.Union[int, int] # Error @@ -405,8 +426,9 @@ error[PYI016]: PYI016.pyi:63:28: Duplicate union member `int` 65 | # Should emit in cases with nested `typing.Union` | = help: Remove duplicate union member `int` -error[PYI016]: PYI016.pyi:66:41: Duplicate union member `int` +error[PYI016]: 66:41: Duplicate union member `int` + --> PYI016.pyi:66:41 | 65 | # Should emit in cases with nested `typing.Union` 66 | field20: typing.Union[int, typing.Union[int, str]] # Error @@ -415,8 +437,9 @@ error[PYI016]: PYI016.pyi:66:41: Duplicate union member `int` 68 | # Should emit in cases with mixed `typing.Union` and `|` | = help: Remove duplicate union member `int` -error[PYI016]: PYI016.pyi:69:28: [*] Duplicate union member `int` +error[PYI016]: 69:28: [*] Duplicate union member `int` + --> PYI016.pyi:69:28 | 68 | # Should emit in cases with mixed `typing.Union` and `|` 69 | field21: typing.Union[int, int | str] # Error @@ -435,8 +458,9 @@ error[PYI016]: PYI016.pyi:69:28: [*] Duplicate union member `int` 71 71 | # Should emit only once in cases with multiple nested `typing.Union` 72 72 | field22: typing.Union[int, typing.Union[int, typing.Union[int, int]]] # Error -error[PYI016]: PYI016.pyi:72:41: Duplicate union member `int` +error[PYI016]: 72:41: Duplicate union member `int` + --> PYI016.pyi:72:41 | 71 | # Should emit only once in cases with multiple nested `typing.Union` 72 | field22: typing.Union[int, typing.Union[int, typing.Union[int, int]]] # Error @@ -445,8 +469,9 @@ error[PYI016]: PYI016.pyi:72:41: Duplicate union member `int` 74 | # Should emit in cases with newlines | = help: Remove duplicate union member `int` -error[PYI016]: PYI016.pyi:72:59: Duplicate union member `int` +error[PYI016]: 72:59: Duplicate union member `int` + --> PYI016.pyi:72:59 | 71 | # Should emit only once in cases with multiple nested `typing.Union` 72 | field22: typing.Union[int, typing.Union[int, typing.Union[int, int]]] # Error @@ -455,8 +480,9 @@ error[PYI016]: PYI016.pyi:72:59: Duplicate union member `int` 74 | # Should emit in cases with newlines | = help: Remove duplicate union member `int` -error[PYI016]: PYI016.pyi:72:64: Duplicate union member `int` +error[PYI016]: 72:64: Duplicate union member `int` + --> PYI016.pyi:72:64 | 71 | # Should emit only once in cases with multiple nested `typing.Union` 72 | field22: typing.Union[int, typing.Union[int, typing.Union[int, int]]] # Error @@ -465,8 +491,9 @@ error[PYI016]: PYI016.pyi:72:64: Duplicate union member `int` 74 | # Should emit in cases with newlines | = help: Remove duplicate union member `int` -error[PYI016]: PYI016.pyi:76:12: [*] Duplicate union member `set[int]` +error[PYI016]: 76:12: [*] Duplicate union member `set[int]` + --> PYI016.pyi:76:12 | 74 | # Should emit in cases with newlines 75 | field23: set[ # foo @@ -486,8 +513,9 @@ error[PYI016]: PYI016.pyi:76:12: [*] Duplicate union member `set[int]` 78 78 | # Should emit twice (once for each `int` in the nested union, both of which are 79 79 | # duplicates of the outer `int`), but not three times (which would indicate that -error[PYI016]: PYI016.pyi:81:41: Duplicate union member `int` +error[PYI016]: 81:41: Duplicate union member `int` + --> PYI016.pyi:81:41 | 79 | # duplicates of the outer `int`), but not three times (which would indicate that 80 | # we incorrectly re-checked the nested union). @@ -497,8 +525,9 @@ error[PYI016]: PYI016.pyi:81:41: Duplicate union member `int` 83 | # Should emit twice (once for each `int` in the nested union, both of which are | = help: Remove duplicate union member `int` -error[PYI016]: PYI016.pyi:81:46: Duplicate union member `int` +error[PYI016]: 81:46: Duplicate union member `int` + --> PYI016.pyi:81:46 | 79 | # duplicates of the outer `int`), but not three times (which would indicate that 80 | # we incorrectly re-checked the nested union). @@ -508,8 +537,9 @@ error[PYI016]: PYI016.pyi:81:46: Duplicate union member `int` 83 | # Should emit twice (once for each `int` in the nested union, both of which are | = help: Remove duplicate union member `int` -error[PYI016]: PYI016.pyi:86:28: [*] Duplicate union member `int` +error[PYI016]: 86:28: [*] Duplicate union member `int` + --> PYI016.pyi:86:28 | 84 | # duplicates of the outer `int`), but not three times (which would indicate that 85 | # we incorrectly re-checked the nested union). @@ -524,8 +554,9 @@ error[PYI016]: PYI016.pyi:86:28: [*] Duplicate union member `int` 86 |-field25: typing.Union[int, int | int] # PYI016: Duplicate union member `int` 86 |+field25: typing.Union[int, int] # PYI016: Duplicate union member `int` -error[PYI016]: PYI016.pyi:86:34: [*] Duplicate union member `int` +error[PYI016]: 86:34: [*] Duplicate union member `int` + --> PYI016.pyi:86:34 | 84 | # duplicates of the outer `int`), but not three times (which would indicate that 85 | # we incorrectly re-checked the nested union). diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI017_PYI017.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI017_PYI017.pyi.snap index 8be498ebf1..dbd17f5bbb 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI017_PYI017.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI017_PYI017.pyi.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI017]: PYI017.pyi:4:1: Stubs should not contain assignments to attributes or multiple targets +error[PYI017]: 4:1: Stubs should not contain assignments to attributes or multiple targets + --> PYI017.pyi:3:1 | 2 | a = var # OK 3 | @@ -11,8 +12,9 @@ error[PYI017]: PYI017.pyi:4:1: Stubs should not contain assignments to attribute 5 | 6 | a.b = int # PYI017 | -error[PYI017]: PYI017.pyi:6:1: Stubs should not contain assignments to attributes or multiple targets +error[PYI017]: 6:1: Stubs should not contain assignments to attributes or multiple targets + --> PYI017.pyi:5:1 | 4 | b = c = int # PYI017 5 | @@ -21,8 +23,9 @@ error[PYI017]: PYI017.pyi:6:1: Stubs should not contain assignments to attribute 7 | 8 | d, e = int, str # PYI017 | -error[PYI017]: PYI017.pyi:8:1: Stubs should not contain assignments to attributes or multiple targets +error[PYI017]: 8:1: Stubs should not contain assignments to attributes or multiple targets + --> PYI017.pyi:7:1 | 6 | a.b = int # PYI017 7 | @@ -31,8 +34,9 @@ error[PYI017]: PYI017.pyi:8:1: Stubs should not contain assignments to attribute 9 | 10 | f, g, h = int, str, TypeVar("T") # PYI017 | -error[PYI017]: PYI017.pyi:10:1: Stubs should not contain assignments to attributes or multiple targets +error[PYI017]: 10:1: Stubs should not contain assignments to attributes or multiple targets + --> PYI017.pyi:9:1 | 8 | d, e = int, str # PYI017 9 | diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI018_PYI018.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI018_PYI018.py.snap index 1f3fce2af4..0fae457f4d 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI018_PYI018.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI018_PYI018.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI018]: PYI018.py:6:1: Private TypeVar `_T` is never used +error[PYI018]: 6:1: Private TypeVar `_T` is never used + --> PYI018.py:5:1 | 4 | from typing_extensions import ParamSpec, TypeVarTuple 5 | @@ -11,8 +12,9 @@ error[PYI018]: PYI018.py:6:1: Private TypeVar `_T` is never used 7 | _Ts = typing_extensions.TypeVarTuple("_Ts") 8 | _P = ParamSpec("_P") | -error[PYI018]: PYI018.py:7:1: Private TypeVarTuple `_Ts` is never used +error[PYI018]: 7:1: Private TypeVarTuple `_Ts` is never used + --> PYI018.py:6:26 | 6 | _T = typing.TypeVar("_T") 7 | _Ts = typing_extensions.TypeVarTuple("_Ts") @@ -20,8 +22,9 @@ error[PYI018]: PYI018.py:7:1: Private TypeVarTuple `_Ts` is never used 8 | _P = ParamSpec("_P") 9 | _P2 = typing.ParamSpec("_P2") | -error[PYI018]: PYI018.py:8:1: Private ParamSpec `_P` is never used +error[PYI018]: 8:1: Private ParamSpec `_P` is never used + --> PYI018.py:7:44 | 6 | _T = typing.TypeVar("_T") 7 | _Ts = typing_extensions.TypeVarTuple("_Ts") @@ -30,8 +33,9 @@ error[PYI018]: PYI018.py:8:1: Private ParamSpec `_P` is never used 9 | _P2 = typing.ParamSpec("_P2") 10 | _Ts2 = TypeVarTuple("_Ts2") | -error[PYI018]: PYI018.py:9:1: Private ParamSpec `_P2` is never used +error[PYI018]: 9:1: Private ParamSpec `_P2` is never used + --> PYI018.py:8:21 | 7 | _Ts = typing_extensions.TypeVarTuple("_Ts") 8 | _P = ParamSpec("_P") @@ -39,8 +43,9 @@ error[PYI018]: PYI018.py:9:1: Private ParamSpec `_P2` is never used | ^^^ 10 | _Ts2 = TypeVarTuple("_Ts2") | -error[PYI018]: PYI018.py:10:1: Private TypeVarTuple `_Ts2` is never used +error[PYI018]: 10:1: Private TypeVarTuple `_Ts2` is never used + --> PYI018.py:9:30 | 8 | _P = ParamSpec("_P") 9 | _P2 = typing.ParamSpec("_P2") diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI018_PYI018.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI018_PYI018.pyi.snap index 9485dd6841..fc5a8379d1 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI018_PYI018.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI018_PYI018.pyi.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI018]: PYI018.pyi:6:1: Private TypeVar `_T` is never used +error[PYI018]: 6:1: Private TypeVar `_T` is never used + --> PYI018.pyi:5:1 | 4 | from typing_extensions import ParamSpec, TypeVarTuple 5 | @@ -11,8 +12,9 @@ error[PYI018]: PYI018.pyi:6:1: Private TypeVar `_T` is never used 7 | _Ts = typing_extensions.TypeVarTuple("_Ts") 8 | _P = ParamSpec("_P") | -error[PYI018]: PYI018.pyi:7:1: Private TypeVarTuple `_Ts` is never used +error[PYI018]: 7:1: Private TypeVarTuple `_Ts` is never used + --> PYI018.pyi:6:26 | 6 | _T = typing.TypeVar("_T") 7 | _Ts = typing_extensions.TypeVarTuple("_Ts") @@ -20,8 +22,9 @@ error[PYI018]: PYI018.pyi:7:1: Private TypeVarTuple `_Ts` is never used 8 | _P = ParamSpec("_P") 9 | _P2 = typing.ParamSpec("_P2") | -error[PYI018]: PYI018.pyi:8:1: Private ParamSpec `_P` is never used +error[PYI018]: 8:1: Private ParamSpec `_P` is never used + --> PYI018.pyi:7:44 | 6 | _T = typing.TypeVar("_T") 7 | _Ts = typing_extensions.TypeVarTuple("_Ts") @@ -30,8 +33,9 @@ error[PYI018]: PYI018.pyi:8:1: Private ParamSpec `_P` is never used 9 | _P2 = typing.ParamSpec("_P2") 10 | _Ts2 = TypeVarTuple("_Ts2") | -error[PYI018]: PYI018.pyi:9:1: Private ParamSpec `_P2` is never used +error[PYI018]: 9:1: Private ParamSpec `_P2` is never used + --> PYI018.pyi:8:21 | 7 | _Ts = typing_extensions.TypeVarTuple("_Ts") 8 | _P = ParamSpec("_P") @@ -39,8 +43,9 @@ error[PYI018]: PYI018.pyi:9:1: Private ParamSpec `_P2` is never used | ^^^ 10 | _Ts2 = TypeVarTuple("_Ts2") | -error[PYI018]: PYI018.pyi:10:1: Private TypeVarTuple `_Ts2` is never used +error[PYI018]: 10:1: Private TypeVarTuple `_Ts2` is never used + --> PYI018.pyi:9:30 | 8 | _P = ParamSpec("_P") 9 | _P2 = typing.ParamSpec("_P2") diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI019_PYI019.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI019_PYI019.py.snap index 8b1c5fc9bc..5442ad7191 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI019_PYI019.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI019_PYI019.py.snap @@ -1,43 +1,49 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI019]: PYI019.py:7:62: Methods like `__new__` should return `typing.Self` instead of a custom `TypeVar` +error[PYI019]: 7:62: Methods like `__new__` should return `typing.Self` instead of a custom `TypeVar` + --> PYI019.py:7:62 | 6 | class BadClass: 7 | def __new__(cls: type[_S], *args: str, **kwargs: int) -> _S: ... # PYI019 | ^^ | -error[PYI019]: PYI019.py:10:54: Methods like `bad_instance_method` should return `typing.Self` instead of a custom `TypeVar` +error[PYI019]: 10:54: Methods like `bad_instance_method` should return `typing.Self` instead of a custom `TypeVar` + --> PYI019.py:10:54 | 10 | def bad_instance_method(self: _S, arg: bytes) -> _S: ... # PYI019 | ^^ | -error[PYI019]: PYI019.py:14:54: Methods like `bad_class_method` should return `typing.Self` instead of a custom `TypeVar` +error[PYI019]: 14:54: Methods like `bad_class_method` should return `typing.Self` instead of a custom `TypeVar` + --> PYI019.py:14:54 | 13 | @classmethod 14 | def bad_class_method(cls: type[_S], arg: int) -> _S: ... # PYI019 | ^^ | -error[PYI019]: PYI019.py:18:55: Methods like `bad_posonly_class_method` should return `typing.Self` instead of a custom `TypeVar` +error[PYI019]: 18:55: Methods like `bad_posonly_class_method` should return `typing.Self` instead of a custom `TypeVar` + --> PYI019.py:18:55 | 17 | @classmethod 18 | def bad_posonly_class_method(cls: type[_S], /) -> _S: ... # PYI019 | ^^ | -error[PYI019]: PYI019.py:39:63: Methods like `__new__` should return `typing.Self` instead of a custom `TypeVar` +error[PYI019]: 39:63: Methods like `__new__` should return `typing.Self` instead of a custom `TypeVar` + --> PYI019.py:39:63 | 37 | # Python > 3.12 38 | class PEP695BadDunderNew[T]: 39 | def __new__[S](cls: type[S], *args: Any, ** kwargs: Any) -> S: ... # PYI019 | ^ | -error[PYI019]: PYI019.py:42:46: Methods like `generic_instance_method` should return `typing.Self` instead of a custom `TypeVar` +error[PYI019]: 42:46: Methods like `generic_instance_method` should return `typing.Self` instead of a custom `TypeVar` + --> PYI019.py:42:46 | 42 | def generic_instance_method[S](self: S) -> S: ... # PYI019 | ^ diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI019_PYI019.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI019_PYI019.pyi.snap index 834767fdbf..0a543dd04a 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI019_PYI019.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI019_PYI019.pyi.snap @@ -1,43 +1,49 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI019]: PYI019.pyi:7:62: Methods like `__new__` should return `typing.Self` instead of a custom `TypeVar` +error[PYI019]: 7:62: Methods like `__new__` should return `typing.Self` instead of a custom `TypeVar` + --> PYI019.pyi:7:62 | 6 | class BadClass: 7 | def __new__(cls: type[_S], *args: str, **kwargs: int) -> _S: ... # PYI019 | ^^ | -error[PYI019]: PYI019.pyi:10:54: Methods like `bad_instance_method` should return `typing.Self` instead of a custom `TypeVar` +error[PYI019]: 10:54: Methods like `bad_instance_method` should return `typing.Self` instead of a custom `TypeVar` + --> PYI019.pyi:10:54 | 10 | def bad_instance_method(self: _S, arg: bytes) -> _S: ... # PYI019 | ^^ | -error[PYI019]: PYI019.pyi:14:54: Methods like `bad_class_method` should return `typing.Self` instead of a custom `TypeVar` +error[PYI019]: 14:54: Methods like `bad_class_method` should return `typing.Self` instead of a custom `TypeVar` + --> PYI019.pyi:14:54 | 13 | @classmethod 14 | def bad_class_method(cls: type[_S], arg: int) -> _S: ... # PYI019 | ^^ | -error[PYI019]: PYI019.pyi:18:55: Methods like `bad_posonly_class_method` should return `typing.Self` instead of a custom `TypeVar` +error[PYI019]: 18:55: Methods like `bad_posonly_class_method` should return `typing.Self` instead of a custom `TypeVar` + --> PYI019.pyi:18:55 | 17 | @classmethod 18 | def bad_posonly_class_method(cls: type[_S], /) -> _S: ... # PYI019 | ^^ | -error[PYI019]: PYI019.pyi:39:63: Methods like `__new__` should return `typing.Self` instead of a custom `TypeVar` +error[PYI019]: 39:63: Methods like `__new__` should return `typing.Self` instead of a custom `TypeVar` + --> PYI019.pyi:39:63 | 37 | # Python > 3.12 38 | class PEP695BadDunderNew[T]: 39 | def __new__[S](cls: type[S], *args: Any, ** kwargs: Any) -> S: ... # PYI019 | ^ | -error[PYI019]: PYI019.pyi:42:46: Methods like `generic_instance_method` should return `typing.Self` instead of a custom `TypeVar` +error[PYI019]: 42:46: Methods like `generic_instance_method` should return `typing.Self` instead of a custom `TypeVar` + --> PYI019.pyi:42:46 | 42 | def generic_instance_method[S](self: S) -> S: ... # PYI019 | ^ diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI020_PYI020.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI020_PYI020.pyi.snap index 459038f7da..23e080de40 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI020_PYI020.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI020_PYI020.pyi.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI020]: PYI020.pyi:7:10: [*] Quoted annotations should not be included in stubs +error[PYI020]: 7:10: [*] Quoted annotations should not be included in stubs + --> PYI020.pyi:7:10 | 5 | import typing_extensions 6 | @@ -22,8 +23,9 @@ error[PYI020]: PYI020.pyi:7:10: [*] Quoted annotations should not be included in 9 9 | _T = TypeVar("_T", bound="int") # Y020 Quoted annotations should never be used in stubs 10 10 | -error[PYI020]: PYI020.pyi:8:15: [*] Quoted annotations should not be included in stubs +error[PYI020]: 8:15: [*] Quoted annotations should not be included in stubs + --> PYI020.pyi:8:15 | 7 | def f(x: "int"): ... # Y020 Quoted annotations should never be used in stubs 8 | def g(x: list["int"]): ... # Y020 Quoted annotations should never be used in stubs @@ -41,8 +43,9 @@ error[PYI020]: PYI020.pyi:8:15: [*] Quoted annotations should not be included in 10 10 | 11 11 | def h(w: Literal["a", "b"], x: typing.Literal["c"], y: typing_extensions.Literal["d"], z: _T) -> _T: ... -error[PYI020]: PYI020.pyi:9:26: [*] Quoted annotations should not be included in stubs +error[PYI020]: 9:26: [*] Quoted annotations should not be included in stubs + --> PYI020.pyi:9:26 | 7 | def f(x: "int"): ... # Y020 Quoted annotations should never be used in stubs 8 | def g(x: list["int"]): ... # Y020 Quoted annotations should never be used in stubs @@ -62,8 +65,9 @@ error[PYI020]: PYI020.pyi:9:26: [*] Quoted annotations should not be included in 11 11 | def h(w: Literal["a", "b"], x: typing.Literal["c"], y: typing_extensions.Literal["d"], z: _T) -> _T: ... 12 12 | -error[PYI020]: PYI020.pyi:13:12: [*] Quoted annotations should not be included in stubs +error[PYI020]: 13:12: [*] Quoted annotations should not be included in stubs + --> PYI020.pyi:13:12 | 11 | def h(w: Literal["a", "b"], x: typing.Literal["c"], y: typing_extensions.Literal["d"], z: _T) -> _T: ... 12 | @@ -82,8 +86,9 @@ error[PYI020]: PYI020.pyi:13:12: [*] Quoted annotations should not be included i 15 15 | 16 16 | class Child(list["int"]): # Y020 Quoted annotations should never be used in stubs -error[PYI020]: PYI020.pyi:14:25: [*] Quoted annotations should not be included in stubs +error[PYI020]: 14:25: [*] Quoted annotations should not be included in stubs + --> PYI020.pyi:14:25 | 13 | def j() -> "int": ... # Y020 Quoted annotations should never be used in stubs 14 | Alias: TypeAlias = list["int"] # Y020 Quoted annotations should never be used in stubs @@ -102,8 +107,9 @@ error[PYI020]: PYI020.pyi:14:25: [*] Quoted annotations should not be included i 16 16 | class Child(list["int"]): # Y020 Quoted annotations should never be used in stubs 17 17 | """Documented and guaranteed useful.""" # Y021 Docstrings should not be included in stubs -error[PYI020]: PYI020.pyi:16:18: [*] Quoted annotations should not be included in stubs +error[PYI020]: 16:18: [*] Quoted annotations should not be included in stubs + --> PYI020.pyi:16:18 | 14 | Alias: TypeAlias = list["int"] # Y020 Quoted annotations should never be used in stubs 15 | @@ -122,8 +128,9 @@ error[PYI020]: PYI020.pyi:16:18: [*] Quoted annotations should not be included i 18 18 | 19 19 | if sys.platform == "linux": -error[PYI020]: PYI020.pyi:20:8: [*] Quoted annotations should not be included in stubs +error[PYI020]: 20:8: [*] Quoted annotations should not be included in stubs + --> PYI020.pyi:20:8 | 19 | if sys.platform == "linux": 20 | f: "int" # Y020 Quoted annotations should never be used in stubs @@ -142,8 +149,9 @@ error[PYI020]: PYI020.pyi:20:8: [*] Quoted annotations should not be included in 22 22 | f: "str" # Y020 Quoted annotations should never be used in stubs 23 23 | else: -error[PYI020]: PYI020.pyi:22:8: [*] Quoted annotations should not be included in stubs +error[PYI020]: 22:8: [*] Quoted annotations should not be included in stubs + --> PYI020.pyi:22:8 | 20 | f: "int" # Y020 Quoted annotations should never be used in stubs 21 | elif sys.platform == "win32": @@ -163,8 +171,9 @@ error[PYI020]: PYI020.pyi:22:8: [*] Quoted annotations should not be included in 24 24 | f: "bytes" # Y020 Quoted annotations should never be used in stubs 25 25 | -error[PYI020]: PYI020.pyi:24:8: [*] Quoted annotations should not be included in stubs +error[PYI020]: 24:8: [*] Quoted annotations should not be included in stubs + --> PYI020.pyi:24:8 | 22 | f: "str" # Y020 Quoted annotations should never be used in stubs 23 | else: diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI021_PYI021.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI021_PYI021.pyi.snap index a48053a304..5fba2cfca7 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI021_PYI021.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI021_PYI021.pyi.snap @@ -1,16 +1,18 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI021]: PYI021.pyi:1:1: Docstrings should not be included in stubs +error[PYI021]: 1:1: Docstrings should not be included in stubs + --> PYI021.pyi:1:1 | 1 | """foo""" # ERROR PYI021 | ^^^^^^^^^ 2 | 3 | def foo(): | -error[PYI021]: PYI021.pyi:4:5: Docstrings should not be included in stubs +error[PYI021]: 4:5: Docstrings should not be included in stubs + --> PYI021.pyi:4:5 | 3 | def foo(): 4 | """foo""" # ERROR PYI021 @@ -18,8 +20,9 @@ error[PYI021]: PYI021.pyi:4:5: Docstrings should not be included in stubs 5 | 6 | class Bar: | -error[PYI021]: PYI021.pyi:7:5: Docstrings should not be included in stubs +error[PYI021]: 7:5: Docstrings should not be included in stubs + --> PYI021.pyi:7:5 | 6 | class Bar: 7 | """bar""" # ERROR PYI021 diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI024_PYI024.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI024_PYI024.py.snap index b81cfe18fd..f432cc67ed 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI024_PYI024.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI024_PYI024.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI024]: PYI024.py:3:9: Use `typing.NamedTuple` instead of `collections.namedtuple` +error[PYI024]: 3:9: Use `typing.NamedTuple` instead of `collections.namedtuple` + --> PYI024.py:3:9 | 1 | import collections 2 | @@ -12,8 +13,9 @@ error[PYI024]: PYI024.py:3:9: Use `typing.NamedTuple` instead of `collections.na 5 | from collections import namedtuple | = help: Replace with `typing.NamedTuple` -error[PYI024]: PYI024.py:7:9: Use `typing.NamedTuple` instead of `collections.namedtuple` +error[PYI024]: 7:9: Use `typing.NamedTuple` instead of `collections.namedtuple` + --> PYI024.py:7:9 | 5 | from collections import namedtuple 6 | @@ -23,8 +25,9 @@ error[PYI024]: PYI024.py:7:9: Use `typing.NamedTuple` instead of `collections.na 9 | person = namedtuple( | = help: Replace with `typing.NamedTuple` -error[PYI024]: PYI024.py:9:10: Use `typing.NamedTuple` instead of `collections.namedtuple` +error[PYI024]: 9:10: Use `typing.NamedTuple` instead of `collections.namedtuple` + --> PYI024.py:9:10 | 7 | person: namedtuple # Y024 Use "typing.NamedTuple" instead of "collections.namedtuple" 8 | diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI024_PYI024.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI024_PYI024.pyi.snap index 3b821c2263..552b5b9726 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI024_PYI024.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI024_PYI024.pyi.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI024]: PYI024.pyi:3:9: Use `typing.NamedTuple` instead of `collections.namedtuple` +error[PYI024]: 3:9: Use `typing.NamedTuple` instead of `collections.namedtuple` + --> PYI024.pyi:3:9 | 1 | import collections 2 | @@ -12,8 +13,9 @@ error[PYI024]: PYI024.pyi:3:9: Use `typing.NamedTuple` instead of `collections.n 5 | from collections import namedtuple | = help: Replace with `typing.NamedTuple` -error[PYI024]: PYI024.pyi:7:9: Use `typing.NamedTuple` instead of `collections.namedtuple` +error[PYI024]: 7:9: Use `typing.NamedTuple` instead of `collections.namedtuple` + --> PYI024.pyi:7:9 | 5 | from collections import namedtuple 6 | @@ -23,8 +25,9 @@ error[PYI024]: PYI024.pyi:7:9: Use `typing.NamedTuple` instead of `collections.n 9 | person = namedtuple( | = help: Replace with `typing.NamedTuple` -error[PYI024]: PYI024.pyi:9:10: Use `typing.NamedTuple` instead of `collections.namedtuple` +error[PYI024]: 9:10: Use `typing.NamedTuple` instead of `collections.namedtuple` + --> PYI024.pyi:9:10 | 7 | person: namedtuple # Y024 Use "typing.NamedTuple" instead of "collections.namedtuple" 8 | diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_1.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_1.py.snap index 2f0ecd8a21..5ce0202302 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_1.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_1.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI025]: PYI025_1.py:10:33: [*] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin +error[PYI025]: 10:33: [*] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin + --> PYI025_1.py:10:33 | 9 | def f(): 10 | from collections.abc import Set # PYI025 @@ -19,8 +20,9 @@ error[PYI025]: PYI025_1.py:10:33: [*] Use `from collections.abc import Set as Ab 12 12 | 13 13 | def f(): -error[PYI025]: PYI025_1.py:14:51: [*] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin +error[PYI025]: 14:51: [*] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin + --> PYI025_1.py:14:51 | 13 | def f(): 14 | from collections.abc import Container, Sized, Set, ValuesView # PYI025 diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_1.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_1.pyi.snap index 1d37e53b17..d5753c27f4 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_1.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_1.pyi.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI025]: PYI025_1.pyi:8:33: [*] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin +error[PYI025]: 8:33: [*] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin + --> PYI025_1.pyi:8:33 | 7 | def f(): 8 | from collections.abc import Set # PYI025 @@ -21,8 +22,9 @@ error[PYI025]: PYI025_1.pyi:8:33: [*] Use `from collections.abc import Set as Ab 10 10 | def f(): 11 11 | from collections.abc import Container, Sized, Set, ValuesView # PYI025 -error[PYI025]: PYI025_1.pyi:11:51: [*] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin +error[PYI025]: 11:51: [*] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin + --> PYI025_1.pyi:11:51 | 10 | def f(): 11 | from collections.abc import Container, Sized, Set, ValuesView # PYI025 @@ -41,8 +43,9 @@ error[PYI025]: PYI025_1.pyi:11:51: [*] Use `from collections.abc import Set as A 13 13 | def f(): 14 14 | """Test: local symbol renaming.""" -error[PYI025]: PYI025_1.pyi:16:37: [*] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin +error[PYI025]: 16:37: [*] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin + --> PYI025_1.pyi:16:37 | 14 | """Test: local symbol renaming.""" 15 | if True: @@ -76,8 +79,9 @@ error[PYI025]: PYI025_1.pyi:16:37: [*] Use `from collections.abc import Set as A 29 29 | def Set(): 30 30 | pass -error[PYI025]: PYI025_1.pyi:33:29: [*] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin +error[PYI025]: 33:29: [*] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin + --> PYI025_1.pyi:33:29 | 31 | print(Set) 32 | @@ -119,8 +123,9 @@ error[PYI025]: PYI025_1.pyi:33:29: [*] Use `from collections.abc import Set as A 42 42 | def f(): 43 43 | """Test: nonlocal symbol renaming.""" -error[PYI025]: PYI025_1.pyi:44:33: [*] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin +error[PYI025]: 44:33: [*] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin + --> PYI025_1.pyi:44:33 | 42 | def f(): 43 | """Test: nonlocal symbol renaming.""" diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_2.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_2.py.snap index 744a8d7a4d..164d25f4bd 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_2.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_2.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI025]: PYI025_2.py:3:29: [*] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin +error[PYI025]: 3:29: [*] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin + --> PYI025_2.py:3:29 | 1 | """Tests to ensure we correctly rename references inside `__all__`""" 2 | diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_2.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_2.pyi.snap index 25c26b617f..aeb680d464 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_2.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_2.pyi.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI025]: PYI025_2.pyi:3:29: [*] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin +error[PYI025]: 3:29: [*] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin + --> PYI025_2.pyi:3:29 | 1 | """Tests to ensure we correctly rename references inside `__all__`""" 2 | diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_3.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_3.py.snap index bfa6c6c5fe..cef4a1f43a 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_3.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_3.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI025]: PYI025_3.py:6:36: [*] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin +error[PYI025]: 6:36: [*] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin + --> PYI025_3.py:6:36 | 4 | """ 5 | diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_3.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_3.pyi.snap index 0d9d2d7b65..aa5231b3c9 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_3.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_3.pyi.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI025]: PYI025_3.pyi:6:36: [*] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin +error[PYI025]: 6:36: [*] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin + --> PYI025_3.pyi:6:36 | 4 | """ 5 | diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI026_PYI026.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI026_PYI026.pyi.snap index efb43e0460..c3829eb9e6 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI026_PYI026.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI026_PYI026.pyi.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI026]: PYI026.pyi:3:1: [*] Use `typing.TypeAlias` for type alias, e.g., `NewAny: TypeAlias = Any` +error[PYI026]: 3:1: [*] Use `typing.TypeAlias` for type alias, e.g., `NewAny: TypeAlias = Any` + --> PYI026.pyi:2:1 | 1 | from typing import Literal, Any 2 | @@ -22,8 +23,9 @@ error[PYI026]: PYI026.pyi:3:1: [*] Use `typing.TypeAlias` for type alias, e.g., 5 5 | Foo = Literal["foo"] 6 6 | IntOrStr = int | str -error[PYI026]: PYI026.pyi:4:1: [*] Use `typing.TypeAlias` for type alias, e.g., `OptionalStr: TypeAlias = typing.Optional[str]` +error[PYI026]: 4:1: [*] Use `typing.TypeAlias` for type alias, e.g., `OptionalStr: TypeAlias = typing.Optional[str]` + --> PYI026.pyi:3:13 | 3 | NewAny = Any 4 | OptionalStr = typing.Optional[str] @@ -43,8 +45,9 @@ error[PYI026]: PYI026.pyi:4:1: [*] Use `typing.TypeAlias` for type alias, e.g., 6 6 | IntOrStr = int | str 7 7 | AliasNone = None -error[PYI026]: PYI026.pyi:5:1: [*] Use `typing.TypeAlias` for type alias, e.g., `Foo: TypeAlias = Literal["foo"]` +error[PYI026]: 5:1: [*] Use `typing.TypeAlias` for type alias, e.g., `Foo: TypeAlias = Literal["foo"]` + --> PYI026.pyi:4:35 | 3 | NewAny = Any 4 | OptionalStr = typing.Optional[str] @@ -66,8 +69,9 @@ error[PYI026]: PYI026.pyi:5:1: [*] Use `typing.TypeAlias` for type alias, e.g., 7 7 | AliasNone = None 8 8 | -error[PYI026]: PYI026.pyi:6:1: [*] Use `typing.TypeAlias` for type alias, e.g., `IntOrStr: TypeAlias = int | str` +error[PYI026]: 6:1: [*] Use `typing.TypeAlias` for type alias, e.g., `IntOrStr: TypeAlias = int | str` + --> PYI026.pyi:5:21 | 4 | OptionalStr = typing.Optional[str] 5 | Foo = Literal["foo"] @@ -89,8 +93,9 @@ error[PYI026]: PYI026.pyi:6:1: [*] Use `typing.TypeAlias` for type alias, e.g., 8 8 | 9 9 | NewAny: typing.TypeAlias = Any -error[PYI026]: PYI026.pyi:7:1: [*] Use `typing.TypeAlias` for type alias, e.g., `AliasNone: TypeAlias = None` +error[PYI026]: 7:1: [*] Use `typing.TypeAlias` for type alias, e.g., `AliasNone: TypeAlias = None` + --> PYI026.pyi:6:21 | 5 | Foo = Literal["foo"] 6 | IntOrStr = int | str @@ -114,8 +119,9 @@ error[PYI026]: PYI026.pyi:7:1: [*] Use `typing.TypeAlias` for type alias, e.g., 9 9 | NewAny: typing.TypeAlias = Any 10 10 | OptionalStr: TypeAlias = typing.Optional[str] -error[PYI026]: PYI026.pyi:17:5: [*] Use `typing.TypeAlias` for type alias, e.g., `FLAG_THIS: TypeAlias = None` +error[PYI026]: 17:5: [*] Use `typing.TypeAlias` for type alias, e.g., `FLAG_THIS: TypeAlias = None` + --> PYI026.pyi:17:5 | 16 | class NotAnEnum: 17 | FLAG_THIS = None diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI029_PYI029.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI029_PYI029.pyi.snap index 401bf6ad6b..4ac33d1f50 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI029_PYI029.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI029_PYI029.pyi.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI029]: PYI029.pyi:10:9: [*] Defining `__str__` in a stub is almost always redundant +error[PYI029]: 10:9: [*] Defining `__str__` in a stub is almost always redundant + --> PYI029.pyi:10:9 | 9 | class ShouldRemoveSingle: 10 | def __str__(self) -> builtins.str: ... # Error: PYI029 @@ -21,8 +22,9 @@ error[PYI029]: PYI029.pyi:10:9: [*] Defining `__str__` in a stub is almost alway 12 12 | class ShouldRemove: 13 13 | def __repr__(self) -> str: ... # Error: PYI029 -error[PYI029]: PYI029.pyi:13:9: [*] Defining `__repr__` in a stub is almost always redundant +error[PYI029]: 13:9: [*] Defining `__repr__` in a stub is almost always redundant + --> PYI029.pyi:13:9 | 12 | class ShouldRemove: 13 | def __repr__(self) -> str: ... # Error: PYI029 @@ -39,8 +41,9 @@ error[PYI029]: PYI029.pyi:13:9: [*] Defining `__repr__` in a stub is almost alwa 15 14 | 16 15 | class NoReturnSpecified: -error[PYI029]: PYI029.pyi:14:9: [*] Defining `__str__` in a stub is almost always redundant +error[PYI029]: 14:9: [*] Defining `__str__` in a stub is almost always redundant + --> PYI029.pyi:14:9 | 12 | class ShouldRemove: 13 | def __repr__(self) -> str: ... # Error: PYI029 diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI030_PYI030.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI030_PYI030.py.snap index ecda86b632..8b40e9ceca 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI030_PYI030.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI030_PYI030.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI030]: PYI030.py:9:9: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` +error[PYI030]: 9:9: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` + --> PYI030.py:9:9 | 8 | # Should emit for duplicate field types. 9 | field2: Literal[1] | Literal[2] # Error @@ -21,8 +22,9 @@ error[PYI030]: PYI030.py:9:9: [*] Multiple literal members in a union. Use a sin 11 11 | # Should emit for union types in arguments. 12 12 | def func1(arg1: Literal[1] | Literal[2]): # Error -error[PYI030]: PYI030.py:12:17: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` +error[PYI030]: 12:17: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` + --> PYI030.py:12:17 | 11 | # Should emit for union types in arguments. 12 | def func1(arg1: Literal[1] | Literal[2]): # Error @@ -40,8 +42,9 @@ error[PYI030]: PYI030.py:12:17: [*] Multiple literal members in a union. Use a s 14 14 | 15 15 | -error[PYI030]: PYI030.py:17:16: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` +error[PYI030]: 17:16: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` + --> PYI030.py:17:16 | 16 | # Should emit for unions in return types. 17 | def func2() -> Literal[1] | Literal[2]: # Error @@ -59,8 +62,9 @@ error[PYI030]: PYI030.py:17:16: [*] Multiple literal members in a union. Use a s 19 19 | 20 20 | -error[PYI030]: PYI030.py:22:9: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` +error[PYI030]: 22:9: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` + --> PYI030.py:22:9 | 21 | # Should emit in longer unions, even if not directly adjacent. 22 | field3: Literal[1] | Literal[2] | str # Error @@ -79,8 +83,9 @@ error[PYI030]: PYI030.py:22:9: [*] Multiple literal members in a union. Use a si 24 24 | field5: Literal[1] | str | Literal[2] # Error 25 25 | field6: Literal[1] | bool | Literal[2] | str # Error -error[PYI030]: PYI030.py:23:9: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` +error[PYI030]: 23:9: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` + --> PYI030.py:23:9 | 21 | # Should emit in longer unions, even if not directly adjacent. 22 | field3: Literal[1] | Literal[2] | str # Error @@ -100,8 +105,9 @@ error[PYI030]: PYI030.py:23:9: [*] Multiple literal members in a union. Use a si 25 25 | field6: Literal[1] | bool | Literal[2] | str # Error 26 26 | -error[PYI030]: PYI030.py:24:9: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` +error[PYI030]: 24:9: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` + --> PYI030.py:24:9 | 22 | field3: Literal[1] | Literal[2] | str # Error 23 | field4: str | Literal[1] | Literal[2] # Error @@ -120,8 +126,9 @@ error[PYI030]: PYI030.py:24:9: [*] Multiple literal members in a union. Use a si 26 26 | 27 27 | # Should emit for non-type unions. -error[PYI030]: PYI030.py:25:9: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` +error[PYI030]: 25:9: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` + --> PYI030.py:25:9 | 23 | field4: str | Literal[1] | Literal[2] # Error 24 | field5: Literal[1] | str | Literal[2] # Error @@ -141,8 +148,9 @@ error[PYI030]: PYI030.py:25:9: [*] Multiple literal members in a union. Use a si 27 27 | # Should emit for non-type unions. 28 28 | field7 = Literal[1] | Literal[2] # Error -error[PYI030]: PYI030.py:28:10: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` +error[PYI030]: 28:10: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` + --> PYI030.py:28:10 | 27 | # Should emit for non-type unions. 28 | field7 = Literal[1] | Literal[2] # Error @@ -161,8 +169,9 @@ error[PYI030]: PYI030.py:28:10: [*] Multiple literal members in a union. Use a s 30 30 | # Should emit for parenthesized unions. 31 31 | field8: Literal[1] | (Literal[2] | str) # Error -error[PYI030]: PYI030.py:31:9: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` +error[PYI030]: 31:9: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` + --> PYI030.py:31:9 | 30 | # Should emit for parenthesized unions. 31 | field8: Literal[1] | (Literal[2] | str) # Error @@ -181,8 +190,9 @@ error[PYI030]: PYI030.py:31:9: [*] Multiple literal members in a union. Use a si 33 33 | # Should handle user parentheses when fixing. 34 34 | field9: Literal[1] | (Literal[2] | str) # Error -error[PYI030]: PYI030.py:34:9: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` +error[PYI030]: 34:9: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` + --> PYI030.py:34:9 | 33 | # Should handle user parentheses when fixing. 34 | field9: Literal[1] | (Literal[2] | str) # Error @@ -200,8 +210,9 @@ error[PYI030]: PYI030.py:34:9: [*] Multiple literal members in a union. Use a si 36 36 | 37 37 | # Should emit for union in generic parent type. -error[PYI030]: PYI030.py:35:10: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` +error[PYI030]: 35:10: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` + --> PYI030.py:35:10 | 33 | # Should handle user parentheses when fixing. 34 | field9: Literal[1] | (Literal[2] | str) # Error @@ -221,8 +232,9 @@ error[PYI030]: PYI030.py:35:10: [*] Multiple literal members in a union. Use a s 37 37 | # Should emit for union in generic parent type. 38 38 | field11: dict[Literal[1] | Literal[2], str] # Error -error[PYI030]: PYI030.py:38:15: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` +error[PYI030]: 38:15: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` + --> PYI030.py:38:15 | 37 | # Should emit for union in generic parent type. 38 | field11: dict[Literal[1] | Literal[2], str] # Error @@ -241,8 +253,9 @@ error[PYI030]: PYI030.py:38:15: [*] Multiple literal members in a union. Use a s 40 40 | # Should emit for unions with more than two cases 41 41 | field12: Literal[1] | Literal[2] | Literal[3] # Error -error[PYI030]: PYI030.py:41:10: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2, 3]` +error[PYI030]: 41:10: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2, 3]` + --> PYI030.py:41:10 | 40 | # Should emit for unions with more than two cases 41 | field12: Literal[1] | Literal[2] | Literal[3] # Error @@ -260,8 +273,9 @@ error[PYI030]: PYI030.py:41:10: [*] Multiple literal members in a union. Use a s 43 43 | 44 44 | # Should emit for unions with more than two cases, even if not directly adjacent -error[PYI030]: PYI030.py:42:10: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2, 3, 4]` +error[PYI030]: 42:10: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2, 3, 4]` + --> PYI030.py:42:10 | 40 | # Should emit for unions with more than two cases 41 | field12: Literal[1] | Literal[2] | Literal[3] # Error @@ -281,8 +295,9 @@ error[PYI030]: PYI030.py:42:10: [*] Multiple literal members in a union. Use a s 44 44 | # Should emit for unions with more than two cases, even if not directly adjacent 45 45 | field14: Literal[1] | Literal[2] | str | Literal[3] # Error -error[PYI030]: PYI030.py:45:10: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2, 3]` +error[PYI030]: 45:10: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2, 3]` + --> PYI030.py:45:10 | 44 | # Should emit for unions with more than two cases, even if not directly adjacent 45 | field14: Literal[1] | Literal[2] | str | Literal[3] # Error @@ -301,8 +316,9 @@ error[PYI030]: PYI030.py:45:10: [*] Multiple literal members in a union. Use a s 47 47 | # Should emit for unions with mixed literal internal types 48 48 | field15: Literal[1] | Literal["foo"] | Literal[True] # Error -error[PYI030]: PYI030.py:48:10: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, "foo", True]` +error[PYI030]: 48:10: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, "foo", True]` + --> PYI030.py:48:10 | 47 | # Should emit for unions with mixed literal internal types 48 | field15: Literal[1] | Literal["foo"] | Literal[True] # Error @@ -321,8 +337,9 @@ error[PYI030]: PYI030.py:48:10: [*] Multiple literal members in a union. Use a s 50 50 | # Shouldn't emit for duplicate field types with same value; covered by Y016 51 51 | field16: Literal[1] | Literal[1] # OK -error[PYI030]: PYI030.py:51:10: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 1]` +error[PYI030]: 51:10: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 1]` + --> PYI030.py:51:10 | 50 | # Shouldn't emit for duplicate field types with same value; covered by Y016 51 | field16: Literal[1] | Literal[1] # OK @@ -341,8 +358,9 @@ error[PYI030]: PYI030.py:51:10: [*] Multiple literal members in a union. Use a s 53 53 | # Shouldn't emit if in new parent type 54 54 | field17: Literal[1] | dict[Literal[2], str] # OK -error[PYI030]: PYI030.py:60:10: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` +error[PYI030]: 60:10: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` + --> PYI030.py:60:10 | 59 | # Should respect name of literal type used 60 | field19: typing.Literal[1] | typing.Literal[2] # Error @@ -361,8 +379,9 @@ error[PYI030]: PYI030.py:60:10: [*] Multiple literal members in a union. Use a s 62 62 | # Should emit in cases with newlines 63 63 | field20: typing.Union[ -error[PYI030]: PYI030.py:63:10: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` +error[PYI030]: 63:10: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` + --> PYI030.py:63:10 | 62 | # Should emit in cases with newlines 63 | field20: typing.Union[ @@ -392,8 +411,9 @@ error[PYI030]: PYI030.py:63:10: [*] Multiple literal members in a union. Use a s 70 65 | # Should handle multiple unions with multiple members 71 66 | field21: Literal[1, 2] | Literal[3, 4] # Error -error[PYI030]: PYI030.py:71:10: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2, 3, 4]` +error[PYI030]: 71:10: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2, 3, 4]` + --> PYI030.py:71:10 | 70 | # Should handle multiple unions with multiple members 71 | field21: Literal[1, 2] | Literal[3, 4] # Error @@ -412,8 +432,9 @@ error[PYI030]: PYI030.py:71:10: [*] Multiple literal members in a union. Use a s 73 73 | # Should emit in cases with `typing.Union` instead of `|` 74 74 | field22: typing.Union[Literal[1], Literal[2]] # Error -error[PYI030]: PYI030.py:74:10: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` +error[PYI030]: 74:10: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` + --> PYI030.py:74:10 | 73 | # Should emit in cases with `typing.Union` instead of `|` 74 | field22: typing.Union[Literal[1], Literal[2]] # Error @@ -432,8 +453,9 @@ error[PYI030]: PYI030.py:74:10: [*] Multiple literal members in a union. Use a s 76 76 | # Should emit in cases with `typing_extensions.Literal` 77 77 | field23: typing_extensions.Literal[1] | typing_extensions.Literal[2] # Error -error[PYI030]: PYI030.py:77:10: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` +error[PYI030]: 77:10: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` + --> PYI030.py:77:10 | 76 | # Should emit in cases with `typing_extensions.Literal` 77 | field23: typing_extensions.Literal[1] | typing_extensions.Literal[2] # Error @@ -452,8 +474,9 @@ error[PYI030]: PYI030.py:77:10: [*] Multiple literal members in a union. Use a s 79 79 | # Should emit in cases with nested `typing.Union` 80 80 | field24: typing.Union[Literal[1], typing.Union[Literal[2], str]] # Error -error[PYI030]: PYI030.py:80:10: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` +error[PYI030]: 80:10: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` + --> PYI030.py:80:10 | 79 | # Should emit in cases with nested `typing.Union` 80 | field24: typing.Union[Literal[1], typing.Union[Literal[2], str]] # Error @@ -472,8 +495,9 @@ error[PYI030]: PYI030.py:80:10: [*] Multiple literal members in a union. Use a s 82 82 | # Should emit in cases with mixed `typing.Union` and `|` 83 83 | field25: typing.Union[Literal[1], Literal[2] | str] # Error -error[PYI030]: PYI030.py:83:10: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` +error[PYI030]: 83:10: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` + --> PYI030.py:83:10 | 82 | # Should emit in cases with mixed `typing.Union` and `|` 83 | field25: typing.Union[Literal[1], Literal[2] | str] # Error @@ -492,8 +516,9 @@ error[PYI030]: PYI030.py:83:10: [*] Multiple literal members in a union. Use a s 85 85 | # Should emit only once in cases with multiple nested `typing.Union` 86 86 | field24: typing.Union[Literal[1], typing.Union[Literal[2], typing.Union[Literal[3], Literal[4]]]] # Error -error[PYI030]: PYI030.py:86:10: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2, 3, 4]` +error[PYI030]: 86:10: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2, 3, 4]` + --> PYI030.py:86:10 | 85 | # Should emit only once in cases with multiple nested `typing.Union` 86 | field24: typing.Union[Literal[1], typing.Union[Literal[2], typing.Union[Literal[3], Literal[4]]]] # Error @@ -512,8 +537,9 @@ error[PYI030]: PYI030.py:86:10: [*] Multiple literal members in a union. Use a s 88 88 | # Should use the first literal subscript attribute when fixing 89 89 | field25: typing.Union[typing_extensions.Literal[1], typing.Union[Literal[2], typing.Union[Literal[3], Literal[4]]], str] # Error -error[PYI030]: PYI030.py:89:10: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2, 3, 4]` +error[PYI030]: 89:10: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2, 3, 4]` + --> PYI030.py:89:10 | 88 | # Should use the first literal subscript attribute when fixing 89 | field25: typing.Union[typing_extensions.Literal[1], typing.Union[Literal[2], typing.Union[Literal[3], Literal[4]]], str] # Error diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI030_PYI030.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI030_PYI030.pyi.snap index fb8ee2685e..6fdfb56ea9 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI030_PYI030.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI030_PYI030.pyi.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI030]: PYI030.pyi:9:9: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` +error[PYI030]: 9:9: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` + --> PYI030.pyi:9:9 | 8 | # Should emit for duplicate field types. 9 | field2: Literal[1] | Literal[2] # Error @@ -21,8 +22,9 @@ error[PYI030]: PYI030.pyi:9:9: [*] Multiple literal members in a union. Use a si 11 11 | # Should emit for union types in arguments. 12 12 | def func1(arg1: Literal[1] | Literal[2]): # Error -error[PYI030]: PYI030.pyi:12:17: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` +error[PYI030]: 12:17: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` + --> PYI030.pyi:12:17 | 11 | # Should emit for union types in arguments. 12 | def func1(arg1: Literal[1] | Literal[2]): # Error @@ -40,8 +42,9 @@ error[PYI030]: PYI030.pyi:12:17: [*] Multiple literal members in a union. Use a 14 14 | 15 15 | -error[PYI030]: PYI030.pyi:17:16: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` +error[PYI030]: 17:16: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` + --> PYI030.pyi:17:16 | 16 | # Should emit for unions in return types. 17 | def func2() -> Literal[1] | Literal[2]: # Error @@ -59,8 +62,9 @@ error[PYI030]: PYI030.pyi:17:16: [*] Multiple literal members in a union. Use a 19 19 | 20 20 | -error[PYI030]: PYI030.pyi:22:9: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` +error[PYI030]: 22:9: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` + --> PYI030.pyi:22:9 | 21 | # Should emit in longer unions, even if not directly adjacent. 22 | field3: Literal[1] | Literal[2] | str # Error @@ -79,8 +83,9 @@ error[PYI030]: PYI030.pyi:22:9: [*] Multiple literal members in a union. Use a s 24 24 | field5: Literal[1] | str | Literal[2] # Error 25 25 | field6: Literal[1] | bool | Literal[2] | str # Error -error[PYI030]: PYI030.pyi:23:9: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` +error[PYI030]: 23:9: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` + --> PYI030.pyi:23:9 | 21 | # Should emit in longer unions, even if not directly adjacent. 22 | field3: Literal[1] | Literal[2] | str # Error @@ -100,8 +105,9 @@ error[PYI030]: PYI030.pyi:23:9: [*] Multiple literal members in a union. Use a s 25 25 | field6: Literal[1] | bool | Literal[2] | str # Error 26 26 | -error[PYI030]: PYI030.pyi:24:9: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` +error[PYI030]: 24:9: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` + --> PYI030.pyi:24:9 | 22 | field3: Literal[1] | Literal[2] | str # Error 23 | field4: str | Literal[1] | Literal[2] # Error @@ -120,8 +126,9 @@ error[PYI030]: PYI030.pyi:24:9: [*] Multiple literal members in a union. Use a s 26 26 | 27 27 | # Should emit for non-type unions. -error[PYI030]: PYI030.pyi:25:9: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` +error[PYI030]: 25:9: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` + --> PYI030.pyi:25:9 | 23 | field4: str | Literal[1] | Literal[2] # Error 24 | field5: Literal[1] | str | Literal[2] # Error @@ -141,8 +148,9 @@ error[PYI030]: PYI030.pyi:25:9: [*] Multiple literal members in a union. Use a s 27 27 | # Should emit for non-type unions. 28 28 | field7 = Literal[1] | Literal[2] # Error -error[PYI030]: PYI030.pyi:28:10: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` +error[PYI030]: 28:10: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` + --> PYI030.pyi:28:10 | 27 | # Should emit for non-type unions. 28 | field7 = Literal[1] | Literal[2] # Error @@ -161,8 +169,9 @@ error[PYI030]: PYI030.pyi:28:10: [*] Multiple literal members in a union. Use a 30 30 | # Should emit for parenthesized unions. 31 31 | field8: Literal[1] | (Literal[2] | str) # Error -error[PYI030]: PYI030.pyi:31:9: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` +error[PYI030]: 31:9: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` + --> PYI030.pyi:31:9 | 30 | # Should emit for parenthesized unions. 31 | field8: Literal[1] | (Literal[2] | str) # Error @@ -181,8 +190,9 @@ error[PYI030]: PYI030.pyi:31:9: [*] Multiple literal members in a union. Use a s 33 33 | # Should handle user parentheses when fixing. 34 34 | field9: Literal[1] | (Literal[2] | str) # Error -error[PYI030]: PYI030.pyi:34:9: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` +error[PYI030]: 34:9: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` + --> PYI030.pyi:34:9 | 33 | # Should handle user parentheses when fixing. 34 | field9: Literal[1] | (Literal[2] | str) # Error @@ -200,8 +210,9 @@ error[PYI030]: PYI030.pyi:34:9: [*] Multiple literal members in a union. Use a s 36 36 | 37 37 | # Should emit for union in generic parent type. -error[PYI030]: PYI030.pyi:35:10: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` +error[PYI030]: 35:10: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` + --> PYI030.pyi:35:10 | 33 | # Should handle user parentheses when fixing. 34 | field9: Literal[1] | (Literal[2] | str) # Error @@ -221,8 +232,9 @@ error[PYI030]: PYI030.pyi:35:10: [*] Multiple literal members in a union. Use a 37 37 | # Should emit for union in generic parent type. 38 38 | field11: dict[Literal[1] | Literal[2], str] # Error -error[PYI030]: PYI030.pyi:38:15: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` +error[PYI030]: 38:15: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` + --> PYI030.pyi:38:15 | 37 | # Should emit for union in generic parent type. 38 | field11: dict[Literal[1] | Literal[2], str] # Error @@ -241,8 +253,9 @@ error[PYI030]: PYI030.pyi:38:15: [*] Multiple literal members in a union. Use a 40 40 | # Should emit for unions with more than two cases 41 41 | field12: Literal[1] | Literal[2] | Literal[3] # Error -error[PYI030]: PYI030.pyi:41:10: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2, 3]` +error[PYI030]: 41:10: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2, 3]` + --> PYI030.pyi:41:10 | 40 | # Should emit for unions with more than two cases 41 | field12: Literal[1] | Literal[2] | Literal[3] # Error @@ -260,8 +273,9 @@ error[PYI030]: PYI030.pyi:41:10: [*] Multiple literal members in a union. Use a 43 43 | 44 44 | # Should emit for unions with more than two cases, even if not directly adjacent -error[PYI030]: PYI030.pyi:42:10: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2, 3, 4]` +error[PYI030]: 42:10: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2, 3, 4]` + --> PYI030.pyi:42:10 | 40 | # Should emit for unions with more than two cases 41 | field12: Literal[1] | Literal[2] | Literal[3] # Error @@ -281,8 +295,9 @@ error[PYI030]: PYI030.pyi:42:10: [*] Multiple literal members in a union. Use a 44 44 | # Should emit for unions with more than two cases, even if not directly adjacent 45 45 | field14: Literal[1] | Literal[2] | str | Literal[3] # Error -error[PYI030]: PYI030.pyi:45:10: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2, 3]` +error[PYI030]: 45:10: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2, 3]` + --> PYI030.pyi:45:10 | 44 | # Should emit for unions with more than two cases, even if not directly adjacent 45 | field14: Literal[1] | Literal[2] | str | Literal[3] # Error @@ -301,8 +316,9 @@ error[PYI030]: PYI030.pyi:45:10: [*] Multiple literal members in a union. Use a 47 47 | # Should emit for unions with mixed literal internal types 48 48 | field15: Literal[1] | Literal["foo"] | Literal[True] # Error -error[PYI030]: PYI030.pyi:48:10: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, "foo", True]` +error[PYI030]: 48:10: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, "foo", True]` + --> PYI030.pyi:48:10 | 47 | # Should emit for unions with mixed literal internal types 48 | field15: Literal[1] | Literal["foo"] | Literal[True] # Error @@ -321,8 +337,9 @@ error[PYI030]: PYI030.pyi:48:10: [*] Multiple literal members in a union. Use a 50 50 | # Shouldn't emit for duplicate field types with same value; covered by Y016 51 51 | field16: Literal[1] | Literal[1] # OK -error[PYI030]: PYI030.pyi:51:10: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 1]` +error[PYI030]: 51:10: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 1]` + --> PYI030.pyi:51:10 | 50 | # Shouldn't emit for duplicate field types with same value; covered by Y016 51 | field16: Literal[1] | Literal[1] # OK @@ -341,8 +358,9 @@ error[PYI030]: PYI030.pyi:51:10: [*] Multiple literal members in a union. Use a 53 53 | # Shouldn't emit if in new parent type 54 54 | field17: Literal[1] | dict[Literal[2], str] # OK -error[PYI030]: PYI030.pyi:60:10: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` +error[PYI030]: 60:10: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` + --> PYI030.pyi:60:10 | 59 | # Should respect name of literal type used 60 | field19: typing.Literal[1] | typing.Literal[2] # Error @@ -361,8 +379,9 @@ error[PYI030]: PYI030.pyi:60:10: [*] Multiple literal members in a union. Use a 62 62 | # Should emit in cases with newlines 63 63 | field20: typing.Union[ -error[PYI030]: PYI030.pyi:63:10: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` +error[PYI030]: 63:10: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` + --> PYI030.pyi:63:10 | 62 | # Should emit in cases with newlines 63 | field20: typing.Union[ @@ -392,8 +411,9 @@ error[PYI030]: PYI030.pyi:63:10: [*] Multiple literal members in a union. Use a 70 65 | # Should handle multiple unions with multiple members 71 66 | field21: Literal[1, 2] | Literal[3, 4] # Error -error[PYI030]: PYI030.pyi:71:10: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2, 3, 4]` +error[PYI030]: 71:10: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2, 3, 4]` + --> PYI030.pyi:71:10 | 70 | # Should handle multiple unions with multiple members 71 | field21: Literal[1, 2] | Literal[3, 4] # Error @@ -412,8 +432,9 @@ error[PYI030]: PYI030.pyi:71:10: [*] Multiple literal members in a union. Use a 73 73 | # Should emit in cases with `typing.Union` instead of `|` 74 74 | field22: typing.Union[Literal[1], Literal[2]] # Error -error[PYI030]: PYI030.pyi:74:10: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` +error[PYI030]: 74:10: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` + --> PYI030.pyi:74:10 | 73 | # Should emit in cases with `typing.Union` instead of `|` 74 | field22: typing.Union[Literal[1], Literal[2]] # Error @@ -432,8 +453,9 @@ error[PYI030]: PYI030.pyi:74:10: [*] Multiple literal members in a union. Use a 76 76 | # Should emit in cases with `typing_extensions.Literal` 77 77 | field23: typing_extensions.Literal[1] | typing_extensions.Literal[2] # Error -error[PYI030]: PYI030.pyi:77:10: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` +error[PYI030]: 77:10: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` + --> PYI030.pyi:77:10 | 76 | # Should emit in cases with `typing_extensions.Literal` 77 | field23: typing_extensions.Literal[1] | typing_extensions.Literal[2] # Error @@ -452,8 +474,9 @@ error[PYI030]: PYI030.pyi:77:10: [*] Multiple literal members in a union. Use a 79 79 | # Should emit in cases with nested `typing.Union` 80 80 | field24: typing.Union[Literal[1], typing.Union[Literal[2], str]] # Error -error[PYI030]: PYI030.pyi:80:10: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` +error[PYI030]: 80:10: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` + --> PYI030.pyi:80:10 | 79 | # Should emit in cases with nested `typing.Union` 80 | field24: typing.Union[Literal[1], typing.Union[Literal[2], str]] # Error @@ -472,8 +495,9 @@ error[PYI030]: PYI030.pyi:80:10: [*] Multiple literal members in a union. Use a 82 82 | # Should emit in cases with mixed `typing.Union` and `|` 83 83 | field25: typing.Union[Literal[1], Literal[2] | str] # Error -error[PYI030]: PYI030.pyi:83:10: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` +error[PYI030]: 83:10: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` + --> PYI030.pyi:83:10 | 82 | # Should emit in cases with mixed `typing.Union` and `|` 83 | field25: typing.Union[Literal[1], Literal[2] | str] # Error @@ -492,8 +516,9 @@ error[PYI030]: PYI030.pyi:83:10: [*] Multiple literal members in a union. Use a 85 85 | # Should emit only once in cases with multiple nested `typing.Union` 86 86 | field24: typing.Union[Literal[1], typing.Union[Literal[2], typing.Union[Literal[3], Literal[4]]]] # Error -error[PYI030]: PYI030.pyi:86:10: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2, 3, 4]` +error[PYI030]: 86:10: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2, 3, 4]` + --> PYI030.pyi:86:10 | 85 | # Should emit only once in cases with multiple nested `typing.Union` 86 | field24: typing.Union[Literal[1], typing.Union[Literal[2], typing.Union[Literal[3], Literal[4]]]] # Error @@ -512,8 +537,9 @@ error[PYI030]: PYI030.pyi:86:10: [*] Multiple literal members in a union. Use a 88 88 | # Should use the first literal subscript attribute when fixing 89 89 | field25: typing.Union[typing_extensions.Literal[1], typing.Union[Literal[2], typing.Union[Literal[3], Literal[4]]], str] # Error -error[PYI030]: PYI030.pyi:89:10: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2, 3, 4]` +error[PYI030]: 89:10: [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2, 3, 4]` + --> PYI030.pyi:89:10 | 88 | # Should use the first literal subscript attribute when fixing 89 | field25: typing.Union[typing_extensions.Literal[1], typing.Union[Literal[2], typing.Union[Literal[3], Literal[4]]], str] # Error diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI032_PYI032.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI032_PYI032.py.snap index 8831bf5fcc..0bcdb785e8 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI032_PYI032.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI032_PYI032.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI032]: PYI032.py:6:29: [*] Prefer `object` to `Any` for the second parameter to `__eq__` +error[PYI032]: 6:29: [*] Prefer `object` to `Any` for the second parameter to `__eq__` + --> PYI032.py:6:29 | 5 | class Bad: 6 | def __eq__(self, other: Any) -> bool: ... # Y032 @@ -20,8 +21,9 @@ error[PYI032]: PYI032.py:6:29: [*] Prefer `object` to `Any` for the second param 8 8 | 9 9 | -error[PYI032]: PYI032.py:7:29: [*] Prefer `object` to `Any` for the second parameter to `__ne__` +error[PYI032]: 7:29: [*] Prefer `object` to `Any` for the second parameter to `__ne__` + --> PYI032.py:7:29 | 5 | class Bad: 6 | def __eq__(self, other: Any) -> bool: ... # Y032 diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI032_PYI032.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI032_PYI032.pyi.snap index 2361976f80..dd514916fb 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI032_PYI032.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI032_PYI032.pyi.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI032]: PYI032.pyi:6:29: [*] Prefer `object` to `Any` for the second parameter to `__eq__` +error[PYI032]: 6:29: [*] Prefer `object` to `Any` for the second parameter to `__eq__` + --> PYI032.pyi:6:29 | 5 | class Bad: 6 | def __eq__(self, other: Any) -> bool: ... # Y032 @@ -20,8 +21,9 @@ error[PYI032]: PYI032.pyi:6:29: [*] Prefer `object` to `Any` for the second para 8 8 | 9 9 | -error[PYI032]: PYI032.pyi:7:29: [*] Prefer `object` to `Any` for the second parameter to `__ne__` +error[PYI032]: 7:29: [*] Prefer `object` to `Any` for the second parameter to `__ne__` + --> PYI032.pyi:7:29 | 5 | class Bad: 6 | def __eq__(self, other: Any) -> bool: ... # Y032 diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI033_PYI033.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI033_PYI033.pyi.snap index 8b4f9cdab0..cd070115ab 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI033_PYI033.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI033_PYI033.pyi.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI033]: PYI033.pyi:6:22: Don't use type comments in stub file +error[PYI033]: 6:22: Don't use type comments in stub file + --> PYI033.pyi:6:22 | 4 | from typing import TypeAlias 5 | @@ -11,8 +12,9 @@ error[PYI033]: PYI033.pyi:6:22: Don't use type comments in stub file 7 | B: TypeAlias = None # type: str # And here's an extra comment about why it's that type # Y033 Do not use type comments in stubs (e... 8 | C: TypeAlias = None #type: int # Y033 Do not use type comments in stubs (e.g. use "x: int" instead of "x = ... # type: int") | -error[PYI033]: PYI033.pyi:7:22: Don't use type comments in stub file +error[PYI033]: 7:22: Don't use type comments in stub file + --> PYI033.pyi:7:22 | 6 | ...e # type: int # Y033 Do not use type comments in stubs (e.g. use "x: int" instead of "x = ... # type: int") 7 | ...e # type: str # And here's an extra comment about why it's that type # Y033 Do not use type comments in stubs (e.g. use "x: int" instead of "x = ... # type: int") @@ -20,8 +22,9 @@ error[PYI033]: PYI033.pyi:7:22: Don't use type comments in stub file 8 | ...e #type: int # Y033 Do not use type comments in stubs (e.g. use "x: int" instead of "x = ... # type: int") 9 | ...e # type: int # Y033 Do not use type comments in stubs (e.g. use "x: int" instead of "x = ... # type: int") | -error[PYI033]: PYI033.pyi:8:22: Don't use type comments in stub file +error[PYI033]: 8:22: Don't use type comments in stub file + --> PYI033.pyi:8:22 | 6 | A: TypeAlias = None # type: int # Y033 Do not use type comments in stubs (e.g. use "x: int" instead of "x = ... # type: int") 7 | B: TypeAlias = None # type: str # And here's an extra comment about why it's that type # Y033 Do not use type comments in stubs (... @@ -30,8 +33,9 @@ error[PYI033]: PYI033.pyi:8:22: Don't use type comments in stub file 9 | D: TypeAlias = None # type: int # Y033 Do not use type comments in stubs (e.g. use "x: int" instead of "x = ... # type: int") 10 | E: TypeAlias = None# type: int # Y033 Do not use type comments in stubs (e.g. use "x: int" instead of "x = ... # type: int") | -error[PYI033]: PYI033.pyi:9:22: Don't use type comments in stub file +error[PYI033]: 9:22: Don't use type comments in stub file + --> PYI033.pyi:9:22 | 7 | ... = None # type: str # And here's an extra comment about why it's that type # Y033 Do not use type comments in stubs (e.g. use ... 8 | ... = None #type: int # Y033 Do not use type comments in stubs (e.g. use "x: int" instead of "x = ... # type: int") @@ -40,8 +44,9 @@ error[PYI033]: PYI033.pyi:9:22: Don't use type comments in stub file 10 | ... = None# type: int # Y033 Do not use type comments in stubs (e.g. use "x: int" instead of "x = ... # type: int") 11 | ... = None#type:int # Y033 Do not use type comments in stubs (e.g. use "x: int" instead of "x = ... # type: int") | -error[PYI033]: PYI033.pyi:10:20: Don't use type comments in stub file +error[PYI033]: 10:20: Don't use type comments in stub file + --> PYI033.pyi:10:20 | 8 | C: TypeAlias = None #type: int # Y033 Do not use type comments in stubs (e.g. use "x: int" instead of "x = ... # type: int") 9 | D: TypeAlias = None # type: int # Y033 Do not use type comments in stubs (e.g. use "x: int" instead of "x = ... # type: int") @@ -49,8 +54,9 @@ error[PYI033]: PYI033.pyi:10:20: Don't use type comments in stub file | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 11 | F: TypeAlias = None#type:int # Y033 Do not use type comments in stubs (e.g. use "x: int" instead of "x = ... # type: int") | -error[PYI033]: PYI033.pyi:11:20: Don't use type comments in stub file +error[PYI033]: 11:20: Don't use type comments in stub file + --> PYI033.pyi:11:20 | 9 | D: TypeAlias = None # type: int # Y033 Do not use type comments in stubs (e.g. use "x: int" instead of "x = ... # type: int") 10 | E: TypeAlias = None# type: int # Y033 Do not use type comments in stubs (e.g. use "x: int" instead of "x = ... # type: int") @@ -59,8 +65,9 @@ error[PYI033]: PYI033.pyi:11:20: Don't use type comments in stub file 12 | 13 | def func( | -error[PYI033]: PYI033.pyi:14:12: Don't use type comments in stub file +error[PYI033]: 14:12: Don't use type comments in stub file + --> PYI033.pyi:14:12 | 13 | def func( 14 | arg1, # type: dict[str, int] # Y033 Do not use type comments in stubs (e.g. use "x: int" instead of "x = ... # type: int") @@ -68,8 +75,9 @@ error[PYI033]: PYI033.pyi:14:12: Don't use type comments in stub file 15 | arg2 # type: Sequence[bytes] # And here's some more info about this arg # Y033 Do not use type comments in stubs (e.g. use "x... 16 | ): ... | -error[PYI033]: PYI033.pyi:15:11: Don't use type comments in stub file +error[PYI033]: 15:11: Don't use type comments in stub file + --> PYI033.pyi:15:11 | 13 | ...c( 14 | ...1, # type: dict[str, int] # Y033 Do not use type comments in stubs (e.g. use "x: int" instead of "x = ... # type: int") @@ -77,8 +85,9 @@ error[PYI033]: PYI033.pyi:15:11: Don't use type comments in stub file | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 16 | ... | -error[PYI033]: PYI033.pyi:19:29: Don't use type comments in stub file +error[PYI033]: 19:29: Don't use type comments in stub file + --> PYI033.pyi:19:29 | 18 | ... 19 | ... = None # type: set[str] # Y033 Do not use type comments in stubs (e.g. use "x: int" instead of "x = ... # type: int") @@ -86,8 +95,9 @@ error[PYI033]: PYI033.pyi:19:29: Don't use type comments in stub file 20 | ... 21 | ... # type: ignore | -error[PYI033]: PYI033.pyi:29:22: Don't use type comments in stub file +error[PYI033]: 29:22: Don't use type comments in stub file + --> PYI033.pyi:29:22 | 28 | # Whole line commented out # type: int 29 | M: TypeAlias = None # type: can't parse me! @@ -95,8 +105,9 @@ error[PYI033]: PYI033.pyi:29:22: Don't use type comments in stub file 30 | 31 | class Bar: | -error[PYI033]: PYI033.pyi:32:26: Don't use type comments in stub file +error[PYI033]: 32:26: Don't use type comments in stub file + --> PYI033.pyi:32:26 | 31 | class Bar: 32 | N: TypeAlias = None # type: can't parse me either! diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI034_PYI034.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI034_PYI034.py.snap index 2c7a0060e0..b9639fb84c 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI034_PYI034.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI034_PYI034.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI034]: PYI034.py:21:9: `__new__` methods in classes like `Bad` usually return `self` at runtime +error[PYI034]: 21:9: `__new__` methods in classes like `Bad` usually return `self` at runtime + --> PYI034.py:21:9 | 19 | object 20 | ): # Y040 Do not inherit from "object" explicitly, as it is redundant in Python 3 @@ -11,8 +12,9 @@ error[PYI034]: PYI034.py:21:9: `__new__` methods in classes like `Bad` usually r 22 | ... # Y034 "__new__" methods usually return "self" at runtime. Consider using "typing_extensions.Self" in "Bad.__new__", e.... | = help: Consider using `typing_extensions.Self` as return type -error[PYI034]: PYI034.py:36:9: `__enter__` methods in classes like `Bad` usually return `self` at runtime +error[PYI034]: 36:9: `__enter__` methods in classes like `Bad` usually return `self` at runtime + --> PYI034.py:36:9 | 34 | ... # Y032 Prefer "object" to "Any" for the second parameter in "__ne__" methods 35 | @@ -21,8 +23,9 @@ error[PYI034]: PYI034.py:36:9: `__enter__` methods in classes like `Bad` usually 37 | ... # Y034 "__enter__" methods in classes like "Bad" usually return "self" at runtime. Consider using "typing_extensions.Se... | = help: Consider using `typing_extensions.Self` as return type -error[PYI034]: PYI034.py:39:15: `__aenter__` methods in classes like `Bad` usually return `self` at runtime +error[PYI034]: 39:15: `__aenter__` methods in classes like `Bad` usually return `self` at runtime + --> PYI034.py:39:15 | 37 | ... # Y034 "__enter__" methods in classes like "Bad" usually return "self" at runtime. Consider using "typing_extensions.Se... 38 | @@ -31,8 +34,9 @@ error[PYI034]: PYI034.py:39:15: `__aenter__` methods in classes like `Bad` usual 40 | ... # Y034 "__aenter__" methods in classes like "Bad" usually return "self" at runtime. Consider using "typing_extensions.S... | = help: Consider using `typing_extensions.Self` as return type -error[PYI034]: PYI034.py:42:9: `__iadd__` methods in classes like `Bad` usually return `self` at runtime +error[PYI034]: 42:9: `__iadd__` methods in classes like `Bad` usually return `self` at runtime + --> PYI034.py:42:9 | 40 | ... # Y034 "__aenter__" methods in classes like "Bad" usually return "self" at runtime. Consider using "typing_extensions.S... 41 | @@ -41,8 +45,9 @@ error[PYI034]: PYI034.py:42:9: `__iadd__` methods in classes like `Bad` usually 43 | ... # Y034 "__iadd__" methods in classes like "Bad" usually return "self" at runtime. Consider using "typing_extensions.Sel... | = help: Consider using `typing_extensions.Self` as return type -error[PYI034]: PYI034.py:165:9: `__iter__` methods in classes like `BadIterator1` usually return `self` at runtime +error[PYI034]: 165:9: `__iter__` methods in classes like `BadIterator1` usually return `self` at runtime + --> PYI034.py:165:9 | 164 | class BadIterator1(Iterator[int]): 165 | def __iter__(self) -> Iterator[int]: @@ -50,8 +55,9 @@ error[PYI034]: PYI034.py:165:9: `__iter__` methods in classes like `BadIterator1 166 | ... # Y034 "__iter__" methods in classes like "BadIterator1" usually return "self" at runtime. Consider using "typing_exte... | = help: Consider using `typing_extensions.Self` as return type -error[PYI034]: PYI034.py:172:9: `__iter__` methods in classes like `BadIterator2` usually return `self` at runtime +error[PYI034]: 172:9: `__iter__` methods in classes like `BadIterator2` usually return `self` at runtime + --> PYI034.py:172:9 | 170 | typing.Iterator[int] 171 | ): # Y022 Use "collections.abc.Iterator[T]" instead of "typing.Iterator[T]" (PEP 585 syntax) @@ -60,8 +66,9 @@ error[PYI034]: PYI034.py:172:9: `__iter__` methods in classes like `BadIterator2 173 | ... # Y034 "__iter__" methods in classes like "BadIterator2" usually return "self" at runtime. Consider using "typing_exte... | = help: Consider using `typing_extensions.Self` as return type -error[PYI034]: PYI034.py:179:9: `__iter__` methods in classes like `BadIterator3` usually return `self` at runtime +error[PYI034]: 179:9: `__iter__` methods in classes like `BadIterator3` usually return `self` at runtime + --> PYI034.py:179:9 | 177 | typing.Iterator[int] 178 | ): # Y022 Use "collections.abc.Iterator[T]" instead of "typing.Iterator[T]" (PEP 585 syntax) @@ -70,8 +77,9 @@ error[PYI034]: PYI034.py:179:9: `__iter__` methods in classes like `BadIterator3 180 | ... # Y034 "__iter__" methods in classes like "BadIterator3" usually return "self" at runtime. Consider using "typing_exte... | = help: Consider using `typing_extensions.Self` as return type -error[PYI034]: PYI034.py:185:9: `__iter__` methods in classes like `BadIterator4` usually return `self` at runtime +error[PYI034]: 185:9: `__iter__` methods in classes like `BadIterator4` usually return `self` at runtime + --> PYI034.py:185:9 | 183 | class BadIterator4(Iterator[int]): 184 | # Note: *Iterable*, not *Iterator*, returned! @@ -80,8 +88,9 @@ error[PYI034]: PYI034.py:185:9: `__iter__` methods in classes like `BadIterator4 186 | ... # Y034 "__iter__" methods in classes like "BadIterator4" usually return "self" at runtime. Consider using "typing_exte... | = help: Consider using `typing_extensions.Self` as return type -error[PYI034]: PYI034.py:195:9: `__aiter__` methods in classes like `BadAsyncIterator` usually return `self` at runtime +error[PYI034]: 195:9: `__aiter__` methods in classes like `BadAsyncIterator` usually return `self` at runtime + --> PYI034.py:195:9 | 194 | class BadAsyncIterator(collections.abc.AsyncIterator[str]): 195 | def __aiter__(self) -> typing.AsyncIterator[str]: @@ -89,8 +98,9 @@ error[PYI034]: PYI034.py:195:9: `__aiter__` methods in classes like `BadAsyncIte 196 | ... # Y034 "__aiter__" methods in classes like "BadAsyncIterator" usually return "self" at runtime. Consider using "typing... | = help: Consider using `typing_extensions.Self` as return type -error[PYI034]: PYI034.py:199:9: `__iter__` methods in classes like `SubclassOfBadIterator3` usually return `self` at runtime +error[PYI034]: 199:9: `__iter__` methods in classes like `SubclassOfBadIterator3` usually return `self` at runtime + --> PYI034.py:199:9 | 198 | class SubclassOfBadIterator3(BadIterator3): 199 | def __iter__(self) -> Iterator[int]: # Y034 @@ -98,8 +108,9 @@ error[PYI034]: PYI034.py:199:9: `__iter__` methods in classes like `SubclassOfBa 200 | ... | = help: Consider using `typing_extensions.Self` as return type -error[PYI034]: PYI034.py:203:9: `__aiter__` methods in classes like `SubclassOfBadAsyncIterator` usually return `self` at runtime +error[PYI034]: 203:9: `__aiter__` methods in classes like `SubclassOfBadAsyncIterator` usually return `self` at runtime + --> PYI034.py:203:9 | 202 | class SubclassOfBadAsyncIterator(BadAsyncIterator): 203 | def __aiter__(self) -> collections.abc.AsyncIterator[str]: # Y034 diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI034_PYI034.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI034_PYI034.pyi.snap index ba7d4a23f2..0b972d9ef4 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI034_PYI034.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI034_PYI034.pyi.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI034]: PYI034.pyi:20:9: `__new__` methods in classes like `Bad` usually return `self` at runtime +error[PYI034]: 20:9: `__new__` methods in classes like `Bad` usually return `self` at runtime + --> PYI034.pyi:20:9 | 18 | object 19 | ): # Y040 Do not inherit from "object" explicitly, as it is redundant in Python 3 @@ -12,8 +13,9 @@ error[PYI034]: PYI034.pyi:20:9: `__new__` methods in classes like `Bad` usually 22 | ) -> Bad: ... # Y034 "__new__" methods usually return "self" at runtime. Consider using "typing_extensions.Self" in "Bad.__new_... | = help: Consider using `typing_extensions.Self` as return type -error[PYI034]: PYI034.pyi:35:9: `__enter__` methods in classes like `Bad` usually return `self` at runtime +error[PYI034]: 35:9: `__enter__` methods in classes like `Bad` usually return `self` at runtime + --> PYI034.pyi:35:9 | 33 | self, other: typing.Any 34 | ) -> typing.Any: ... # Y032 Prefer "object" to "Any" for the second parameter in "__ne__" methods @@ -23,8 +25,9 @@ error[PYI034]: PYI034.pyi:35:9: `__enter__` methods in classes like `Bad` usuall 37 | ) -> Bad: ... # Y034 "__enter__" methods in classes like "Bad" usually return "self" at runtime. Consider using "typing_extensi... | = help: Consider using `typing_extensions.Self` as return type -error[PYI034]: PYI034.pyi:38:15: `__aenter__` methods in classes like `Bad` usually return `self` at runtime +error[PYI034]: 38:15: `__aenter__` methods in classes like `Bad` usually return `self` at runtime + --> PYI034.pyi:38:15 | 36 | self, 37 | ) -> Bad: ... # Y034 "__enter__" methods in classes like "Bad" usually return "self" at runtime. Consider using "typing_extensi... @@ -34,8 +37,9 @@ error[PYI034]: PYI034.pyi:38:15: `__aenter__` methods in classes like `Bad` usua 40 | ) -> Bad: ... # Y034 "__aenter__" methods in classes like "Bad" usually return "self" at runtime. Consider using "typing_extens... | = help: Consider using `typing_extensions.Self` as return type -error[PYI034]: PYI034.pyi:41:9: `__iadd__` methods in classes like `Bad` usually return `self` at runtime +error[PYI034]: 41:9: `__iadd__` methods in classes like `Bad` usually return `self` at runtime + --> PYI034.pyi:41:9 | 39 | self, 40 | ) -> Bad: ... # Y034 "__aenter__" methods in classes like "Bad" usually return "self" at runtime. Consider using "typing_extens... @@ -45,8 +49,9 @@ error[PYI034]: PYI034.pyi:41:9: `__iadd__` methods in classes like `Bad` usually 43 | ) -> Bad: ... # Y034 "__iadd__" methods in classes like "Bad" usually return "self" at runtime. Consider using "typing_extensio... | = help: Consider using `typing_extensions.Self` as return type -error[PYI034]: PYI034.pyi:104:9: `__iter__` methods in classes like `BadIterator1` usually return `self` at runtime +error[PYI034]: 104:9: `__iter__` methods in classes like `BadIterator1` usually return `self` at runtime + --> PYI034.pyi:104:9 | 103 | class BadIterator1(Iterator[int]): 104 | def __iter__( @@ -55,8 +60,9 @@ error[PYI034]: PYI034.pyi:104:9: `__iter__` methods in classes like `BadIterator 106 | ) -> Iterator[ | = help: Consider using `typing_extensions.Self` as return type -error[PYI034]: PYI034.pyi:113:9: `__iter__` methods in classes like `BadIterator2` usually return `self` at runtime +error[PYI034]: 113:9: `__iter__` methods in classes like `BadIterator2` usually return `self` at runtime + --> PYI034.pyi:113:9 | 111 | typing.Iterator[int] 112 | ): # Y022 Use "collections.abc.Iterator[T]" instead of "typing.Iterator[T]" (PEP 585 syntax) @@ -66,8 +72,9 @@ error[PYI034]: PYI034.pyi:113:9: `__iter__` methods in classes like `BadIterator 115 | ) -> Iterator[ | = help: Consider using `typing_extensions.Self` as return type -error[PYI034]: PYI034.pyi:122:9: `__iter__` methods in classes like `BadIterator3` usually return `self` at runtime +error[PYI034]: 122:9: `__iter__` methods in classes like `BadIterator3` usually return `self` at runtime + --> PYI034.pyi:122:9 | 120 | typing.Iterator[int] 121 | ): # Y022 Use "collections.abc.Iterator[T]" instead of "typing.Iterator[T]" (PEP 585 syntax) @@ -77,8 +84,9 @@ error[PYI034]: PYI034.pyi:122:9: `__iter__` methods in classes like `BadIterator 124 | ) -> collections.abc.Iterator[ | = help: Consider using `typing_extensions.Self` as return type -error[PYI034]: PYI034.pyi:130:9: `__iter__` methods in classes like `BadIterator4` usually return `self` at runtime +error[PYI034]: 130:9: `__iter__` methods in classes like `BadIterator4` usually return `self` at runtime + --> PYI034.pyi:130:9 | 128 | class BadIterator4(Iterator[int]): 129 | # Note: *Iterable*, not *Iterator*, returned! @@ -88,8 +96,9 @@ error[PYI034]: PYI034.pyi:130:9: `__iter__` methods in classes like `BadIterator 132 | ) -> Iterable[ | = help: Consider using `typing_extensions.Self` as return type -error[PYI034]: PYI034.pyi:144:9: `__aiter__` methods in classes like `BadAsyncIterator` usually return `self` at runtime +error[PYI034]: 144:9: `__aiter__` methods in classes like `BadAsyncIterator` usually return `self` at runtime + --> PYI034.pyi:144:9 | 143 | class BadAsyncIterator(collections.abc.AsyncIterator[str]): 144 | def __aiter__( diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI035_PYI035.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI035_PYI035.pyi.snap index 0dbd7baf83..08cd547648 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI035_PYI035.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI035_PYI035.pyi.snap @@ -1,16 +1,18 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI035]: PYI035.pyi:1:1: `__all__` in a stub file must have a value, as it has the same semantics as `__all__` at runtime +error[PYI035]: 1:1: `__all__` in a stub file must have a value, as it has the same semantics as `__all__` at runtime + --> PYI035.pyi:1:1 | 1 | __all__: list[str] # Error: PYI035 | ^^^^^^^^^^^^^^^^^^ 2 | 3 | __all__: list[str] = ["foo"] | -error[PYI035]: PYI035.pyi:7:5: `__match_args__` in a stub file must have a value, as it has the same semantics as `__match_args__` at runtime +error[PYI035]: 7:5: `__match_args__` in a stub file must have a value, as it has the same semantics as `__match_args__` at runtime + --> PYI035.pyi:7:5 | 5 | class Foo: 6 | __all__: list[str] @@ -18,8 +20,9 @@ error[PYI035]: PYI035.pyi:7:5: `__match_args__` in a stub file must have a value | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 8 | __slots__: tuple[str, ...] # Error: PYI035 | -error[PYI035]: PYI035.pyi:8:5: `__slots__` in a stub file must have a value, as it has the same semantics as `__slots__` at runtime +error[PYI035]: 8:5: `__slots__` in a stub file must have a value, as it has the same semantics as `__slots__` at runtime + --> PYI035.pyi:8:5 | 6 | __all__: list[str] 7 | __match_args__: tuple[str, ...] # Error: PYI035 diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI036_PYI036.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI036_PYI036.py.snap index b7b28529fa..38369dfdb6 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI036_PYI036.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI036_PYI036.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI036]: PYI036.py:54:31: [*] Star-args in `__exit__` should be annotated with `object` +error[PYI036]: 54:31: [*] Star-args in `__exit__` should be annotated with `object` + --> PYI036.py:54:31 | 53 | class BadOne: 54 | def __exit__(self, *args: Any) -> None: ... # PYI036: Bad star-args annotation @@ -20,8 +21,9 @@ error[PYI036]: PYI036.py:54:31: [*] Star-args in `__exit__` should be annotated 56 56 | 57 57 | class BadTwo: -error[PYI036]: PYI036.py:55:24: If there are no star-args, `__aexit__` should have at least 3 non-keyword-only args (excluding `self`) +error[PYI036]: 55:24: If there are no star-args, `__aexit__` should have at least 3 non-keyword-only args (excluding `self`) + --> PYI036.py:55:24 | 53 | class BadOne: 54 | def __exit__(self, *args: Any) -> None: ... # PYI036: Bad star-args annotation @@ -30,16 +32,18 @@ error[PYI036]: PYI036.py:55:24: If there are no star-args, `__aexit__` should ha 56 | 57 | class BadTwo: | -error[PYI036]: PYI036.py:58:38: All arguments after the first four in `__exit__` must have a default value +error[PYI036]: 58:38: All arguments after the first four in `__exit__` must have a default value + --> PYI036.py:58:38 | 57 | class BadTwo: 58 | def __exit__(self, typ, exc, tb, weird_extra_arg) -> None: ... # PYI036: Extra arg must have default | ^^^^^^^^^^^^^^^ 59 | async def __aexit__(self, typ, exc, tb, *, weird_extra_arg) -> None: ...# PYI036: Extra arg must have default | -error[PYI036]: PYI036.py:59:48: All keyword-only arguments in `__aexit__` must have a default value +error[PYI036]: 59:48: All keyword-only arguments in `__aexit__` must have a default value + --> PYI036.py:59:48 | 57 | class BadTwo: 58 | def __exit__(self, typ, exc, tb, weird_extra_arg) -> None: ... # PYI036: Extra arg must have default @@ -48,16 +52,18 @@ error[PYI036]: PYI036.py:59:48: All keyword-only arguments in `__aexit__` must h 60 | 61 | class BadThree: | -error[PYI036]: PYI036.py:62:29: The first argument in `__exit__` should be annotated with `object` or `type[BaseException] | None` +error[PYI036]: 62:29: The first argument in `__exit__` should be annotated with `object` or `type[BaseException] | None` + --> PYI036.py:62:29 | 61 | class BadThree: 62 | def __exit__(self, typ: type[BaseException], exc: BaseException | None, tb: TracebackType | None) -> None: ... # PYI036: First a... | ^^^^^^^^^^^^^^^^^^^ 63 | async def __aexit__(self, __typ: type[BaseException] | None, __exc: BaseException, __tb: TracebackType) -> bool | None: ... # PY... | -error[PYI036]: PYI036.py:63:73: The second argument in `__aexit__` should be annotated with `object` or `BaseException | None` +error[PYI036]: 63:73: The second argument in `__aexit__` should be annotated with `object` or `BaseException | None` + --> PYI036.py:63:73 | 61 | class BadThree: 62 | def __exit__(self, typ: type[BaseException], exc: BaseException | None, tb: TracebackType | None) -> None: ... # PYI036: First a... @@ -66,8 +72,9 @@ error[PYI036]: PYI036.py:63:73: The second argument in `__aexit__` should be ann 64 | 65 | class BadFour: | -error[PYI036]: PYI036.py:63:94: The third argument in `__aexit__` should be annotated with `object` or `types.TracebackType | None` +error[PYI036]: 63:94: The third argument in `__aexit__` should be annotated with `object` or `types.TracebackType | None` + --> PYI036.py:63:94 | 61 | class BadThree: 62 | def __exit__(self, typ: type[BaseException], exc: BaseException | None, tb: TracebackType | None) -> None: ... # PYI036: First a... @@ -76,16 +83,18 @@ error[PYI036]: PYI036.py:63:94: The third argument in `__aexit__` should be anno 64 | 65 | class BadFour: | -error[PYI036]: PYI036.py:66:111: The third argument in `__exit__` should be annotated with `object` or `types.TracebackType | None` +error[PYI036]: 66:111: The third argument in `__exit__` should be annotated with `object` or `types.TracebackType | None` + --> PYI036.py:66:111 | 65 | class BadFour: 66 | def __exit__(self, typ: typing.Optional[type[BaseException]], exc: typing.Union[BaseException, None], tb: TracebackType) -> None... | ^^^^^^^^^^^^^ 67 | async def __aexit__(self, __typ: type[BaseException] | None, __exc: BaseException | None, __tb: typing.Union[TracebackType, None... | -error[PYI036]: PYI036.py:67:101: The third argument in `__aexit__` should be annotated with `object` or `types.TracebackType | None` +error[PYI036]: 67:101: The third argument in `__aexit__` should be annotated with `object` or `types.TracebackType | None` + --> PYI036.py:67:101 | 65 | ... 66 | ...ception]], exc: typing.Union[BaseException, None], tb: TracebackType) -> None: ... # PYI036: Third arg has bad annotation @@ -94,16 +103,18 @@ error[PYI036]: PYI036.py:67:101: The third argument in `__aexit__` should be ann 68 | ... 69 | ... | -error[PYI036]: PYI036.py:70:29: The first argument in `__exit__` should be annotated with `object` or `type[BaseException] | None` +error[PYI036]: 70:29: The first argument in `__exit__` should be annotated with `object` or `type[BaseException] | None` + --> PYI036.py:70:29 | 69 | class BadFive: 70 | def __exit__(self, typ: BaseException | None, *args: list[str]) -> bool: ... # PYI036: Bad star-args annotation | ^^^^^^^^^^^^^^^^^^^^ 71 | async def __aexit__(self, /, typ: type[BaseException] | None, *args: Any) -> Awaitable[None]: ... # PYI036: Bad star-args annota... | -error[PYI036]: PYI036.py:70:58: [*] Star-args in `__exit__` should be annotated with `object` +error[PYI036]: 70:58: [*] Star-args in `__exit__` should be annotated with `object` + --> PYI036.py:70:58 | 69 | class BadFive: 70 | def __exit__(self, typ: BaseException | None, *args: list[str]) -> bool: ... # PYI036: Bad star-args annotation @@ -121,8 +132,9 @@ error[PYI036]: PYI036.py:70:58: [*] Star-args in `__exit__` should be annotated 72 72 | 73 73 | class BadSix: -error[PYI036]: PYI036.py:71:74: [*] Star-args in `__aexit__` should be annotated with `object` +error[PYI036]: 71:74: [*] Star-args in `__aexit__` should be annotated with `object` + --> PYI036.py:71:74 | 69 | class BadFive: 70 | def __exit__(self, typ: BaseException | None, *args: list[str]) -> bool: ... # PYI036: Bad star-args annotation @@ -142,16 +154,18 @@ error[PYI036]: PYI036.py:71:74: [*] Star-args in `__aexit__` should be annotated 73 73 | class BadSix: 74 74 | def __exit__(self, typ, exc, tb, weird_extra_arg, extra_arg2 = None) -> None: ... # PYI036: Extra arg must have default -error[PYI036]: PYI036.py:74:38: All arguments after the first four in `__exit__` must have a default value +error[PYI036]: 74:38: All arguments after the first four in `__exit__` must have a default value + --> PYI036.py:74:38 | 73 | class BadSix: 74 | def __exit__(self, typ, exc, tb, weird_extra_arg, extra_arg2 = None) -> None: ... # PYI036: Extra arg must have default | ^^^^^^^^^^^^^^^ 75 | async def __aexit__(self, typ, exc, tb, *, weird_extra_arg) -> None: ... # PYI036: kwargs must have default | -error[PYI036]: PYI036.py:75:48: All keyword-only arguments in `__aexit__` must have a default value +error[PYI036]: 75:48: All keyword-only arguments in `__aexit__` must have a default value + --> PYI036.py:75:48 | 73 | class BadSix: 74 | def __exit__(self, typ, exc, tb, weird_extra_arg, extra_arg2 = None) -> None: ... # PYI036: Extra arg must have default @@ -160,16 +174,18 @@ error[PYI036]: PYI036.py:75:48: All keyword-only arguments in `__aexit__` must h 76 | 77 | class AllPositionalOnlyArgs: | -error[PYI036]: PYI036.py:82:29: The first argument in `__exit__` should be annotated with `object` or `type[BaseException] | None` +error[PYI036]: 82:29: The first argument in `__exit__` should be annotated with `object` or `type[BaseException] | None` + --> PYI036.py:82:29 | 81 | class BadAllPositionalOnlyArgs: 82 | def __exit__(self, typ: type[Exception] | None, exc: BaseException | None, tb: TracebackType | None, /) -> None: ... | ^^^^^^^^^^^^^^^^^^^^^^ 83 | async def __aexit__(self, typ: type[BaseException] | None, exc: BaseException | None, tb: TracebackType, /) -> None: ... | -error[PYI036]: PYI036.py:83:95: The third argument in `__aexit__` should be annotated with `object` or `types.TracebackType | None` +error[PYI036]: 83:95: The third argument in `__aexit__` should be annotated with `object` or `types.TracebackType | None` + --> PYI036.py:83:95 | 81 | class BadAllPositionalOnlyArgs: 82 | def __exit__(self, typ: type[Exception] | None, exc: BaseException | None, tb: TracebackType | None, /) -> None: ... @@ -178,8 +194,9 @@ error[PYI036]: PYI036.py:83:95: The third argument in `__aexit__` should be anno 84 | 85 | # Definitions not in a class scope can do whatever, we don't care | -error[PYI036]: PYI036.py:161:17: Annotations for a three-argument `__exit__` overload (excluding `self`) should either be `None, None, None` or `type[BaseException], BaseException, types.TracebackType` +error[PYI036]: 161:17: Annotations for a three-argument `__exit__` overload (excluding `self`) should either be `None, None, None` or `type[BaseException], BaseException, types.TracebackType` + --> PYI036.py:161:17 | 159 | def __exit__(self, exc_typ: None, exc: None, tb: None) -> None: ... # Okay 160 | @overload @@ -187,8 +204,9 @@ error[PYI036]: PYI036.py:161:17: Annotations for a three-argument `__exit__` ove | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 162 | def __exit__(self, exc_typ: type[BaseException] | None, exc: BaseException | None, tb: TracebackType | None) -> None: ... | -error[PYI036]: PYI036.py:166:17: Annotations for a three-argument `__exit__` overload (excluding `self`) should either be `None, None, None` or `type[BaseException], BaseException, types.TracebackType` +error[PYI036]: 166:17: Annotations for a three-argument `__exit__` overload (excluding `self`) should either be `None, None, None` or `type[BaseException], BaseException, types.TracebackType` + --> PYI036.py:166:17 | 164 | class UnacceptableOverload2: 165 | @overload @@ -197,8 +215,9 @@ error[PYI036]: PYI036.py:166:17: Annotations for a three-argument `__exit__` ove 167 | @overload 168 | def __exit__(self, exc_typ: object, exc: Exception, tb: builtins.TracebackType) -> None: ... # PYI036 | -error[PYI036]: PYI036.py:168:17: Annotations for a three-argument `__exit__` overload (excluding `self`) should either be `None, None, None` or `type[BaseException], BaseException, types.TracebackType` +error[PYI036]: 168:17: Annotations for a three-argument `__exit__` overload (excluding `self`) should either be `None, None, None` or `type[BaseException], BaseException, types.TracebackType` + --> PYI036.py:168:17 | 166 | def __exit__(self, exc_typ: type[BaseException] | None, exc: None, tb: None) -> None: ... # PYI036 167 | @overload diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI036_PYI036.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI036_PYI036.pyi.snap index ddca7ffdbd..cbafbf4d2d 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI036_PYI036.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI036_PYI036.pyi.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI036]: PYI036.pyi:54:31: [*] Star-args in `__exit__` should be annotated with `object` +error[PYI036]: 54:31: [*] Star-args in `__exit__` should be annotated with `object` + --> PYI036.pyi:54:31 | 53 | class BadOne: 54 | def __exit__(self, *args: Any) -> None: ... # PYI036: Bad star-args annotation @@ -20,8 +21,9 @@ error[PYI036]: PYI036.pyi:54:31: [*] Star-args in `__exit__` should be annotated 56 56 | 57 57 | class BadTwo: -error[PYI036]: PYI036.pyi:55:24: If there are no star-args, `__aexit__` should have at least 3 non-keyword-only args (excluding `self`) +error[PYI036]: 55:24: If there are no star-args, `__aexit__` should have at least 3 non-keyword-only args (excluding `self`) + --> PYI036.pyi:55:24 | 53 | class BadOne: 54 | def __exit__(self, *args: Any) -> None: ... # PYI036: Bad star-args annotation @@ -30,16 +32,18 @@ error[PYI036]: PYI036.pyi:55:24: If there are no star-args, `__aexit__` should h 56 | 57 | class BadTwo: | -error[PYI036]: PYI036.pyi:58:38: All arguments after the first four in `__exit__` must have a default value +error[PYI036]: 58:38: All arguments after the first four in `__exit__` must have a default value + --> PYI036.pyi:58:38 | 57 | class BadTwo: 58 | def __exit__(self, typ, exc, tb, weird_extra_arg) -> None: ... # PYI036: Extra arg must have default | ^^^^^^^^^^^^^^^ 59 | async def __aexit__(self, typ, exc, tb, *, weird_extra_arg1, weird_extra_arg2) -> None: ...# PYI036: kwargs must have default | -error[PYI036]: PYI036.pyi:59:48: All keyword-only arguments in `__aexit__` must have a default value +error[PYI036]: 59:48: All keyword-only arguments in `__aexit__` must have a default value + --> PYI036.pyi:59:48 | 57 | class BadTwo: 58 | def __exit__(self, typ, exc, tb, weird_extra_arg) -> None: ... # PYI036: Extra arg must have default @@ -48,8 +52,9 @@ error[PYI036]: PYI036.pyi:59:48: All keyword-only arguments in `__aexit__` must 60 | 61 | class BadThree: | -error[PYI036]: PYI036.pyi:59:66: All keyword-only arguments in `__aexit__` must have a default value +error[PYI036]: 59:66: All keyword-only arguments in `__aexit__` must have a default value + --> PYI036.pyi:59:66 | 57 | class BadTwo: 58 | def __exit__(self, typ, exc, tb, weird_extra_arg) -> None: ... # PYI036: Extra arg must have default @@ -58,16 +63,18 @@ error[PYI036]: PYI036.pyi:59:66: All keyword-only arguments in `__aexit__` must 60 | 61 | class BadThree: | -error[PYI036]: PYI036.pyi:62:29: The first argument in `__exit__` should be annotated with `object` or `type[BaseException] | None` +error[PYI036]: 62:29: The first argument in `__exit__` should be annotated with `object` or `type[BaseException] | None` + --> PYI036.pyi:62:29 | 61 | class BadThree: 62 | def __exit__(self, typ: type[BaseException], exc: BaseException | None, tb: TracebackType | None) -> None: ... # PYI036: First a... | ^^^^^^^^^^^^^^^^^^^ 63 | async def __aexit__(self, __typ: type[BaseException] | None, __exc: BaseException, __tb: TracebackType) -> bool | None: ... # PY... | -error[PYI036]: PYI036.pyi:63:73: The second argument in `__aexit__` should be annotated with `object` or `BaseException | None` +error[PYI036]: 63:73: The second argument in `__aexit__` should be annotated with `object` or `BaseException | None` + --> PYI036.pyi:63:73 | 61 | class BadThree: 62 | def __exit__(self, typ: type[BaseException], exc: BaseException | None, tb: TracebackType | None) -> None: ... # PYI036: First a... @@ -76,8 +83,9 @@ error[PYI036]: PYI036.pyi:63:73: The second argument in `__aexit__` should be an 64 | 65 | class BadFour: | -error[PYI036]: PYI036.pyi:63:94: The third argument in `__aexit__` should be annotated with `object` or `types.TracebackType | None` +error[PYI036]: 63:94: The third argument in `__aexit__` should be annotated with `object` or `types.TracebackType | None` + --> PYI036.pyi:63:94 | 61 | class BadThree: 62 | def __exit__(self, typ: type[BaseException], exc: BaseException | None, tb: TracebackType | None) -> None: ... # PYI036: First a... @@ -86,16 +94,18 @@ error[PYI036]: PYI036.pyi:63:94: The third argument in `__aexit__` should be ann 64 | 65 | class BadFour: | -error[PYI036]: PYI036.pyi:66:111: The third argument in `__exit__` should be annotated with `object` or `types.TracebackType | None` +error[PYI036]: 66:111: The third argument in `__exit__` should be annotated with `object` or `types.TracebackType | None` + --> PYI036.pyi:66:111 | 65 | class BadFour: 66 | def __exit__(self, typ: typing.Optional[type[BaseException]], exc: typing.Union[BaseException, None], tb: TracebackType) -> None... | ^^^^^^^^^^^^^ 67 | async def __aexit__(self, __typ: type[BaseException] | None, __exc: BaseException | None, __tb: typing.Union[TracebackType, None... | -error[PYI036]: PYI036.pyi:67:101: The third argument in `__aexit__` should be annotated with `object` or `types.TracebackType | None` +error[PYI036]: 67:101: The third argument in `__aexit__` should be annotated with `object` or `types.TracebackType | None` + --> PYI036.pyi:67:101 | 65 | ... 66 | ...ception]], exc: typing.Union[BaseException, None], tb: TracebackType) -> None: ... # PYI036: Third arg has bad annotation @@ -104,16 +114,18 @@ error[PYI036]: PYI036.pyi:67:101: The third argument in `__aexit__` should be an 68 | ... 69 | ... | -error[PYI036]: PYI036.pyi:70:29: The first argument in `__exit__` should be annotated with `object` or `type[BaseException] | None` +error[PYI036]: 70:29: The first argument in `__exit__` should be annotated with `object` or `type[BaseException] | None` + --> PYI036.pyi:70:29 | 69 | class BadFive: 70 | def __exit__(self, typ: BaseException | None, *args: list[str]) -> bool: ... # PYI036: Bad star-args annotation | ^^^^^^^^^^^^^^^^^^^^ 71 | async def __aexit__(self, /, typ: type[BaseException] | None, *args: Any) -> Awaitable[None]: ... # PYI036: Bad star-args annota... | -error[PYI036]: PYI036.pyi:70:58: [*] Star-args in `__exit__` should be annotated with `object` +error[PYI036]: 70:58: [*] Star-args in `__exit__` should be annotated with `object` + --> PYI036.pyi:70:58 | 69 | class BadFive: 70 | def __exit__(self, typ: BaseException | None, *args: list[str]) -> bool: ... # PYI036: Bad star-args annotation @@ -131,8 +143,9 @@ error[PYI036]: PYI036.pyi:70:58: [*] Star-args in `__exit__` should be annotated 72 72 | 73 73 | class BadSix: -error[PYI036]: PYI036.pyi:71:74: [*] Star-args in `__aexit__` should be annotated with `object` +error[PYI036]: 71:74: [*] Star-args in `__aexit__` should be annotated with `object` + --> PYI036.pyi:71:74 | 69 | class BadFive: 70 | def __exit__(self, typ: BaseException | None, *args: list[str]) -> bool: ... # PYI036: Bad star-args annotation @@ -152,32 +165,36 @@ error[PYI036]: PYI036.pyi:71:74: [*] Star-args in `__aexit__` should be annotate 73 73 | class BadSix: 74 74 | def __exit__(self, typ, exc, tb, weird_extra_arg, extra_arg2 = None) -> None: ... # PYI036: Extra arg must have default -error[PYI036]: PYI036.pyi:74:38: All arguments after the first four in `__exit__` must have a default value +error[PYI036]: 74:38: All arguments after the first four in `__exit__` must have a default value + --> PYI036.pyi:74:38 | 73 | class BadSix: 74 | def __exit__(self, typ, exc, tb, weird_extra_arg, extra_arg2 = None) -> None: ... # PYI036: Extra arg must have default | ^^^^^^^^^^^^^^^ 75 | async def __aexit__(self, typ, exc, tb, *, weird_extra_arg) -> None: ... # PYI036: kwargs must have default | -error[PYI036]: PYI036.pyi:75:48: All keyword-only arguments in `__aexit__` must have a default value +error[PYI036]: 75:48: All keyword-only arguments in `__aexit__` must have a default value + --> PYI036.pyi:75:48 | 73 | class BadSix: 74 | def __exit__(self, typ, exc, tb, weird_extra_arg, extra_arg2 = None) -> None: ... # PYI036: Extra arg must have default 75 | async def __aexit__(self, typ, exc, tb, *, weird_extra_arg) -> None: ... # PYI036: kwargs must have default | ^^^^^^^^^^^^^^^ | -error[PYI036]: PYI036.pyi:89:29: The first argument in `__exit__` should be annotated with `object` or `type[BaseException] | None` +error[PYI036]: 89:29: The first argument in `__exit__` should be annotated with `object` or `type[BaseException] | None` + --> PYI036.pyi:89:29 | 88 | class BadAllPositionalOnlyArgs: 89 | def __exit__(self, typ: type[Exception] | None, exc: BaseException | None, tb: TracebackType | None, /) -> None: ... | ^^^^^^^^^^^^^^^^^^^^^^ 90 | async def __aexit__(self, typ: type[BaseException] | None, exc: BaseException | None, tb: TracebackType, /) -> None: ... | -error[PYI036]: PYI036.pyi:90:95: The third argument in `__aexit__` should be annotated with `object` or `types.TracebackType | None` +error[PYI036]: 90:95: The third argument in `__aexit__` should be annotated with `object` or `types.TracebackType | None` + --> PYI036.pyi:90:95 | 88 | class BadAllPositionalOnlyArgs: 89 | def __exit__(self, typ: type[Exception] | None, exc: BaseException | None, tb: TracebackType | None, /) -> None: ... @@ -186,8 +203,9 @@ error[PYI036]: PYI036.pyi:90:95: The third argument in `__aexit__` should be ann 91 | 92 | # Definitions not in a class scope can do whatever, we don't care | -error[PYI036]: PYI036.pyi:159:17: Annotations for a three-argument `__exit__` overload (excluding `self`) should either be `None, None, None` or `type[BaseException], BaseException, types.TracebackType` +error[PYI036]: 159:17: Annotations for a three-argument `__exit__` overload (excluding `self`) should either be `None, None, None` or `type[BaseException], BaseException, types.TracebackType` + --> PYI036.pyi:159:17 | 157 | def __exit__(self, exc_typ: None, exc: None, tb: None) -> None: ... # Okay 158 | @overload @@ -196,8 +214,9 @@ error[PYI036]: PYI036.pyi:159:17: Annotations for a three-argument `__exit__` ov 160 | 161 | class UnacceptableOverload2: | -error[PYI036]: PYI036.pyi:163:17: Annotations for a three-argument `__exit__` overload (excluding `self`) should either be `None, None, None` or `type[BaseException], BaseException, types.TracebackType` +error[PYI036]: 163:17: Annotations for a three-argument `__exit__` overload (excluding `self`) should either be `None, None, None` or `type[BaseException], BaseException, types.TracebackType` + --> PYI036.pyi:163:17 | 161 | class UnacceptableOverload2: 162 | @overload @@ -206,8 +225,9 @@ error[PYI036]: PYI036.pyi:163:17: Annotations for a three-argument `__exit__` ov 164 | @overload 165 | def __exit__(self, exc_typ: object, exc: Exception, tb: builtins.TracebackType) -> None: ... # PYI036 | -error[PYI036]: PYI036.pyi:165:17: Annotations for a three-argument `__exit__` overload (excluding `self`) should either be `None, None, None` or `type[BaseException], BaseException, types.TracebackType` +error[PYI036]: 165:17: Annotations for a three-argument `__exit__` overload (excluding `self`) should either be `None, None, None` or `type[BaseException], BaseException, types.TracebackType` + --> PYI036.pyi:165:17 | 163 | def __exit__(self, exc_typ: type[BaseException] | None, exc: None, tb: None) -> None: ... # PYI036 164 | @overload diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI041_PYI041.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI041_PYI041.py.snap index b9cc838b69..852fd1b9d4 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI041_PYI041.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI041_PYI041.py.snap @@ -1,36 +1,41 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI041]: PYI041.py:22:14: Use `float` instead of `int | float` +error[PYI041]: 22:14: Use `float` instead of `int | float` + --> PYI041.py:22:14 | 22 | def f0(arg1: float | int) -> None: | ^^^^^^^^^^^ 23 | ... | -error[PYI041]: PYI041.py:26:30: Use `complex` instead of `float | complex` +error[PYI041]: 26:30: Use `complex` instead of `float | complex` + --> PYI041.py:26:30 | 26 | def f1(arg1: float, *, arg2: float | list[str] | type[bool] | complex) -> None: | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 27 | ... | -error[PYI041]: PYI041.py:30:28: Use `float` instead of `int | float` +error[PYI041]: 30:28: Use `float` instead of `int | float` + --> PYI041.py:30:28 | 30 | def f2(arg1: int, /, arg2: int | int | float) -> None: | ^^^^^^^^^^^^^^^^^ 31 | ... | -error[PYI041]: PYI041.py:38:24: Use `float` instead of `int | float` +error[PYI041]: 38:24: Use `float` instead of `int | float` + --> PYI041.py:38:24 | 38 | async def f4(**kwargs: int | int | float) -> None: | ^^^^^^^^^^^^^^^^^ 39 | ... | -error[PYI041]: PYI041.py:46:24: Use `complex` instead of `float | complex` +error[PYI041]: 46:24: Use `complex` instead of `float | complex` + --> PYI041.py:46:24 | 44 | ... 45 | @@ -38,8 +43,9 @@ error[PYI041]: PYI041.py:46:24: Use `complex` instead of `float | complex` | ^^^^^^^^^^^^^^^^^^^^^ 47 | ... | -error[PYI041]: PYI041.py:46:24: Use `complex` instead of `int | complex` +error[PYI041]: 46:24: Use `complex` instead of `int | complex` + --> PYI041.py:46:24 | 44 | ... 45 | diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI041_PYI041.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI041_PYI041.pyi.snap index 9d045b58eb..37995af76e 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI041_PYI041.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI041_PYI041.pyi.snap @@ -1,40 +1,46 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI041]: PYI041.pyi:21:14: Use `float` instead of `int | float` +error[PYI041]: 21:14: Use `float` instead of `int | float` + --> PYI041.pyi:21:14 | 21 | def f0(arg1: float | int) -> None: ... # PYI041 | ^^^^^^^^^^^ | -error[PYI041]: PYI041.pyi:24:30: Use `complex` instead of `float | complex` +error[PYI041]: 24:30: Use `complex` instead of `float | complex` + --> PYI041.pyi:24:30 | 24 | def f1(arg1: float, *, arg2: float | list[str] | type[bool] | complex) -> None: ... # PYI041 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -error[PYI041]: PYI041.pyi:27:28: Use `float` instead of `int | float` +error[PYI041]: 27:28: Use `float` instead of `int | float` + --> PYI041.pyi:27:28 | 27 | def f2(arg1: int, /, arg2: int | int | float) -> None: ... # PYI041 | ^^^^^^^^^^^^^^^^^ | -error[PYI041]: PYI041.pyi:33:24: Use `float` instead of `int | float` +error[PYI041]: 33:24: Use `float` instead of `int | float` + --> PYI041.pyi:33:24 | 33 | async def f4(**kwargs: int | int | float) -> None: ... # PYI041 | ^^^^^^^^^^^^^^^^^ | -error[PYI041]: PYI041.pyi:39:24: Use `complex` instead of `float | complex` +error[PYI041]: 39:24: Use `complex` instead of `float | complex` + --> PYI041.pyi:39:24 | 37 | def good(self, arg: int) -> None: ... 38 | 39 | def bad(self, arg: int | float | complex) -> None: ... # PYI041 | ^^^^^^^^^^^^^^^^^^^^^ | -error[PYI041]: PYI041.pyi:39:24: Use `complex` instead of `int | complex` +error[PYI041]: 39:24: Use `complex` instead of `int | complex` + --> PYI041.pyi:39:24 | 37 | def good(self, arg: int) -> None: ... 38 | diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI042_PYI042.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI042_PYI042.py.snap index d366416127..7ec5dd82d0 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI042_PYI042.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI042_PYI042.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI042]: PYI042.py:10:1: Type alias `just_literals_pipe_union` should be CamelCase +error[PYI042]: 10:1: Type alias `just_literals_pipe_union` should be CamelCase + --> PYI042.py:9:1 | 8 | ) 9 | @@ -11,8 +12,9 @@ error[PYI042]: PYI042.py:10:1: Type alias `just_literals_pipe_union` should be C 11 | Literal[True] | Literal["idk"] 12 | ) # PYI042, since not camel case | -error[PYI042]: PYI042.py:19:1: Type alias `snake_case_alias1` should be CamelCase +error[PYI042]: 19:1: Type alias `snake_case_alias1` should be CamelCase + --> PYI042.py:18:1 | 17 | _PrivateAliasS2: TypeAlias = Annotated[str, "also okay"] 18 | @@ -21,16 +23,18 @@ error[PYI042]: PYI042.py:19:1: Type alias `snake_case_alias1` should be CamelCas 20 | _snake_case_alias2: TypeAlias = Literal["whatever"] # PYI042, since not camel case 21 | Snake_case_alias: TypeAlias = int | float # PYI042, since not camel case | -error[PYI042]: PYI042.py:20:1: Type alias `_snake_case_alias2` should be CamelCase +error[PYI042]: 20:1: Type alias `_snake_case_alias2` should be CamelCase + --> PYI042.py:19:73 | 19 | snake_case_alias1: TypeAlias = str | int # PYI042, since not camel case 20 | _snake_case_alias2: TypeAlias = Literal["whatever"] # PYI042, since not camel case | ^^^^^^^^^^^^^^^^^^ 21 | Snake_case_alias: TypeAlias = int | float # PYI042, since not camel case | -error[PYI042]: PYI042.py:27:6: Type alias `foo_bar` should be CamelCase +error[PYI042]: 27:6: Type alias `foo_bar` should be CamelCase + --> PYI042.py:27:6 | 26 | # PEP 695 27 | type foo_bar = int | str diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI042_PYI042.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI042_PYI042.pyi.snap index c5693bf73a..9fcb4d5c6c 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI042_PYI042.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI042_PYI042.pyi.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI042]: PYI042.pyi:10:1: Type alias `just_literals_pipe_union` should be CamelCase +error[PYI042]: 10:1: Type alias `just_literals_pipe_union` should be CamelCase + --> PYI042.pyi:9:1 | 8 | ) 9 | @@ -11,8 +12,9 @@ error[PYI042]: PYI042.pyi:10:1: Type alias `just_literals_pipe_union` should be 11 | Literal[True] | Literal["idk"] 12 | ) # PYI042, since not camel case | -error[PYI042]: PYI042.pyi:19:1: Type alias `snake_case_alias1` should be CamelCase +error[PYI042]: 19:1: Type alias `snake_case_alias1` should be CamelCase + --> PYI042.pyi:18:1 | 17 | _PrivateAliasS2: TypeAlias = Annotated[str, "also okay"] 18 | @@ -21,16 +23,18 @@ error[PYI042]: PYI042.pyi:19:1: Type alias `snake_case_alias1` should be CamelCa 20 | _snake_case_alias2: TypeAlias = Literal["whatever"] # PYI042, since not camel case 21 | Snake_case_alias: TypeAlias = int | float # PYI042, since not camel case | -error[PYI042]: PYI042.pyi:20:1: Type alias `_snake_case_alias2` should be CamelCase +error[PYI042]: 20:1: Type alias `_snake_case_alias2` should be CamelCase + --> PYI042.pyi:19:73 | 19 | snake_case_alias1: TypeAlias = str | int # PYI042, since not camel case 20 | _snake_case_alias2: TypeAlias = Literal["whatever"] # PYI042, since not camel case | ^^^^^^^^^^^^^^^^^^ 21 | Snake_case_alias: TypeAlias = int | float # PYI042, since not camel case | -error[PYI042]: PYI042.pyi:27:6: Type alias `foo_bar` should be CamelCase +error[PYI042]: 27:6: Type alias `foo_bar` should be CamelCase + --> PYI042.pyi:27:6 | 26 | # PEP 695 27 | type foo_bar = int | str diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI043_PYI043.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI043_PYI043.py.snap index 838974b9f8..a67fd14a1d 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI043_PYI043.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI043_PYI043.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI043]: PYI043.py:10:1: Private type alias `_PrivateAliasT` should not be suffixed with `T` (the `T` suffix implies that an object is a `TypeVar`) +error[PYI043]: 10:1: Private type alias `_PrivateAliasT` should not be suffixed with `T` (the `T` suffix implies that an object is a `TypeVar`) + --> PYI043.py:9:1 | 8 | ) 9 | @@ -11,8 +12,9 @@ error[PYI043]: PYI043.py:10:1: Private type alias `_PrivateAliasT` should not be 11 | _PrivateAliasT2: TypeAlias = typing.Any # PYI043, since this ends in a T 12 | _PrivateAliasT3: TypeAlias = Literal[ | -error[PYI043]: PYI043.py:11:1: Private type alias `_PrivateAliasT2` should not be suffixed with `T` (the `T` suffix implies that an object is a `TypeVar`) +error[PYI043]: 11:1: Private type alias `_PrivateAliasT2` should not be suffixed with `T` (the `T` suffix implies that an object is a `TypeVar`) + --> PYI043.py:10:72 | 10 | _PrivateAliasT: TypeAlias = str | int # PYI043, since this ends in a T 11 | _PrivateAliasT2: TypeAlias = typing.Any # PYI043, since this ends in a T @@ -20,8 +22,9 @@ error[PYI043]: PYI043.py:11:1: Private type alias `_PrivateAliasT2` should not b 12 | _PrivateAliasT3: TypeAlias = Literal[ 13 | "not", "a", "chance" | -error[PYI043]: PYI043.py:12:1: Private type alias `_PrivateAliasT3` should not be suffixed with `T` (the `T` suffix implies that an object is a `TypeVar`) +error[PYI043]: 12:1: Private type alias `_PrivateAliasT3` should not be suffixed with `T` (the `T` suffix implies that an object is a `TypeVar`) + --> PYI043.py:11:74 | 10 | _PrivateAliasT: TypeAlias = str | int # PYI043, since this ends in a T 11 | _PrivateAliasT2: TypeAlias = typing.Any # PYI043, since this ends in a T @@ -30,8 +33,9 @@ error[PYI043]: PYI043.py:12:1: Private type alias `_PrivateAliasT3` should not b 13 | "not", "a", "chance" 14 | ] # PYI043, since this ends in a T | -error[PYI043]: PYI043.py:26:6: Private type alias `_FooT` should not be suffixed with `T` (the `T` suffix implies that an object is a `TypeVar`) +error[PYI043]: 26:6: Private type alias `_FooT` should not be suffixed with `T` (the `T` suffix implies that an object is a `TypeVar`) + --> PYI043.py:26:6 | 25 | # PEP 695 26 | type _FooT = str | int diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI043_PYI043.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI043_PYI043.pyi.snap index 79201bfbef..32ab831f1a 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI043_PYI043.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI043_PYI043.pyi.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI043]: PYI043.pyi:10:1: Private type alias `_PrivateAliasT` should not be suffixed with `T` (the `T` suffix implies that an object is a `TypeVar`) +error[PYI043]: 10:1: Private type alias `_PrivateAliasT` should not be suffixed with `T` (the `T` suffix implies that an object is a `TypeVar`) + --> PYI043.pyi:9:1 | 8 | ) 9 | @@ -11,8 +12,9 @@ error[PYI043]: PYI043.pyi:10:1: Private type alias `_PrivateAliasT` should not b 11 | _PrivateAliasT2: TypeAlias = typing.Any # PYI043, since this ends in a T 12 | _PrivateAliasT3: TypeAlias = Literal[ | -error[PYI043]: PYI043.pyi:11:1: Private type alias `_PrivateAliasT2` should not be suffixed with `T` (the `T` suffix implies that an object is a `TypeVar`) +error[PYI043]: 11:1: Private type alias `_PrivateAliasT2` should not be suffixed with `T` (the `T` suffix implies that an object is a `TypeVar`) + --> PYI043.pyi:10:72 | 10 | _PrivateAliasT: TypeAlias = str | int # PYI043, since this ends in a T 11 | _PrivateAliasT2: TypeAlias = typing.Any # PYI043, since this ends in a T @@ -20,8 +22,9 @@ error[PYI043]: PYI043.pyi:11:1: Private type alias `_PrivateAliasT2` should not 12 | _PrivateAliasT3: TypeAlias = Literal[ 13 | "not", "a", "chance" | -error[PYI043]: PYI043.pyi:12:1: Private type alias `_PrivateAliasT3` should not be suffixed with `T` (the `T` suffix implies that an object is a `TypeVar`) +error[PYI043]: 12:1: Private type alias `_PrivateAliasT3` should not be suffixed with `T` (the `T` suffix implies that an object is a `TypeVar`) + --> PYI043.pyi:11:74 | 10 | _PrivateAliasT: TypeAlias = str | int # PYI043, since this ends in a T 11 | _PrivateAliasT2: TypeAlias = typing.Any # PYI043, since this ends in a T @@ -30,8 +33,9 @@ error[PYI043]: PYI043.pyi:12:1: Private type alias `_PrivateAliasT3` should not 13 | "not", "a", "chance" 14 | ] # PYI043, since this ends in a T | -error[PYI043]: PYI043.pyi:26:6: Private type alias `_FooT` should not be suffixed with `T` (the `T` suffix implies that an object is a `TypeVar`) +error[PYI043]: 26:6: Private type alias `_FooT` should not be suffixed with `T` (the `T` suffix implies that an object is a `TypeVar`) + --> PYI043.pyi:26:6 | 25 | # PEP 695 26 | type _FooT = str | int diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI044_PYI044.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI044_PYI044.pyi.snap index 94fa6d7a63..0803aef67c 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI044_PYI044.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI044_PYI044.pyi.snap @@ -1,21 +1,24 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -PYI044.pyi:2:1: PYI044 `from __future__ import annotations` has no effect in stub files, since type checkers automatically treat stubs as having those semantics +error[PYI044]: 2:1: `from __future__ import annotations` has no effect in stub files, since type checkers automatically treat stubs as having those semantics + + --> PYI044.pyi:1:14 | 1 | # Bad import. 2 | from __future__ import annotations # PYI044. - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI044 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 3 | from __future__ import annotations, with_statement # PYI044. | = help: Remove `from __future__ import annotations` +error[PYI044]: 3:1: `from __future__ import annotations` has no effect in stub files, since type checkers automatically treat stubs as having those semantics -PYI044.pyi:3:1: PYI044 `from __future__ import annotations` has no effect in stub files, since type checkers automatically treat stubs as having those semantics + --> PYI044.pyi:2:45 | 1 | # Bad import. 2 | from __future__ import annotations # PYI044. 3 | from __future__ import annotations, with_statement # PYI044. - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI044 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 4 | 5 | # Good imports. | diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI045_PYI045.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI045_PYI045.py.snap index 6c79f346d3..7dffa151b1 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI045_PYI045.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI045_PYI045.py.snap @@ -1,56 +1,63 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI045]: PYI045.py:12:27: `__iter__` methods should return an `Iterator`, not an `Iterable` +error[PYI045]: 12:27: `__iter__` methods should return an `Iterator`, not an `Iterable` + --> PYI045.py:12:27 | 11 | class TypingIterableTReturn: 12 | def __iter__(self) -> typing.Iterable[int]: | ^^^^^^^^^^^^^^^^^^^^ 13 | ... | -error[PYI045]: PYI045.py:20:27: `__iter__` methods should return an `Iterator`, not an `Iterable` +error[PYI045]: 20:27: `__iter__` methods should return an `Iterator`, not an `Iterable` + --> PYI045.py:20:27 | 19 | class TypingIterableReturn: 20 | def __iter__(self) -> typing.Iterable: | ^^^^^^^^^^^^^^^ 21 | ... | -error[PYI045]: PYI045.py:28:27: `__iter__` methods should return an `Iterator`, not an `Iterable` +error[PYI045]: 28:27: `__iter__` methods should return an `Iterator`, not an `Iterable` + --> PYI045.py:28:27 | 27 | class CollectionsIterableTReturn: 28 | def __iter__(self) -> collections.abc.Iterable[int]: | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 29 | ... | -error[PYI045]: PYI045.py:36:27: `__iter__` methods should return an `Iterator`, not an `Iterable` +error[PYI045]: 36:27: `__iter__` methods should return an `Iterator`, not an `Iterable` + --> PYI045.py:36:27 | 35 | class CollectionsIterableReturn: 36 | def __iter__(self) -> collections.abc.Iterable: | ^^^^^^^^^^^^^^^^^^^^^^^^ 37 | ... | -error[PYI045]: PYI045.py:44:27: `__iter__` methods should return an `Iterator`, not an `Iterable` +error[PYI045]: 44:27: `__iter__` methods should return an `Iterator`, not an `Iterable` + --> PYI045.py:44:27 | 43 | class IterableReturn: 44 | def __iter__(self) -> Iterable: | ^^^^^^^^ 45 | ... | -error[PYI045]: PYI045.py:79:28: `__aiter__` methods should return an `AsyncIterator`, not an `AsyncIterable` +error[PYI045]: 79:28: `__aiter__` methods should return an `AsyncIterator`, not an `AsyncIterable` + --> PYI045.py:79:28 | 78 | class TypingAsyncIterableTReturn: 79 | def __aiter__(self) -> typing.AsyncIterable[int]: | ^^^^^^^^^^^^^^^^^^^^^^^^^ 80 | ... | -error[PYI045]: PYI045.py:84:28: `__aiter__` methods should return an `AsyncIterator`, not an `AsyncIterable` +error[PYI045]: 84:28: `__aiter__` methods should return an `AsyncIterator`, not an `AsyncIterable` + --> PYI045.py:84:28 | 83 | class TypingAsyncIterableReturn: 84 | def __aiter__(self) -> typing.AsyncIterable: diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI045_PYI045.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI045_PYI045.pyi.snap index 8d2aff35e6..434c5db299 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI045_PYI045.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI045_PYI045.pyi.snap @@ -1,40 +1,45 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI045]: PYI045.pyi:9:27: `__iter__` methods should return an `Iterator`, not an `Iterable` +error[PYI045]: 9:27: `__iter__` methods should return an `Iterator`, not an `Iterable` + --> PYI045.pyi:9:27 | 8 | class TypingIterableTReturn: 9 | def __iter__(self) -> typing.Iterable[int]: ... # Error: PYI045 | ^^^^^^^^^^^^^^^^^^^^ 10 | def not_iter(self) -> typing.Iterable[int]: ... | -error[PYI045]: PYI045.pyi:13:27: `__iter__` methods should return an `Iterator`, not an `Iterable` +error[PYI045]: 13:27: `__iter__` methods should return an `Iterator`, not an `Iterable` + --> PYI045.pyi:13:27 | 12 | class TypingIterableReturn: 13 | def __iter__(self) -> typing.Iterable: ... # Error: PYI045 | ^^^^^^^^^^^^^^^ 14 | def not_iter(self) -> typing.Iterable: ... | -error[PYI045]: PYI045.pyi:17:27: `__iter__` methods should return an `Iterator`, not an `Iterable` +error[PYI045]: 17:27: `__iter__` methods should return an `Iterator`, not an `Iterable` + --> PYI045.pyi:17:27 | 16 | class CollectionsIterableTReturn: 17 | def __iter__(self) -> collections.abc.Iterable[int]: ... # Error: PYI045 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 18 | def not_iter(self) -> collections.abc.Iterable[int]: ... | -error[PYI045]: PYI045.pyi:21:27: `__iter__` methods should return an `Iterator`, not an `Iterable` +error[PYI045]: 21:27: `__iter__` methods should return an `Iterator`, not an `Iterable` + --> PYI045.pyi:21:27 | 20 | class CollectionsIterableReturn: 21 | def __iter__(self) -> collections.abc.Iterable: ... # Error: PYI045 | ^^^^^^^^^^^^^^^^^^^^^^^^ 22 | def not_iter(self) -> collections.abc.Iterable: ... | -error[PYI045]: PYI045.pyi:25:27: `__iter__` methods should return an `Iterator`, not an `Iterable` +error[PYI045]: 25:27: `__iter__` methods should return an `Iterator`, not an `Iterable` + --> PYI045.pyi:25:27 | 24 | class IterableReturn: 25 | def __iter__(self) -> Iterable: ... # Error: PYI045 @@ -42,8 +47,9 @@ error[PYI045]: PYI045.pyi:25:27: `__iter__` methods should return an `Iterator`, 26 | 27 | class IteratorReturn: | -error[PYI045]: PYI045.pyi:46:28: `__aiter__` methods should return an `AsyncIterator`, not an `AsyncIterable` +error[PYI045]: 46:28: `__aiter__` methods should return an `AsyncIterator`, not an `AsyncIterable` + --> PYI045.pyi:46:28 | 45 | class TypingAsyncIterableTReturn: 46 | def __aiter__(self) -> typing.AsyncIterable[int]: ... # Error: PYI045 @@ -51,8 +57,9 @@ error[PYI045]: PYI045.pyi:46:28: `__aiter__` methods should return an `AsyncIter 47 | 48 | class TypingAsyncIterableReturn: | -error[PYI045]: PYI045.pyi:49:28: `__aiter__` methods should return an `AsyncIterator`, not an `AsyncIterable` +error[PYI045]: 49:28: `__aiter__` methods should return an `AsyncIterator`, not an `AsyncIterable` + --> PYI045.pyi:49:28 | 48 | class TypingAsyncIterableReturn: 49 | def __aiter__(self) -> typing.AsyncIterable: ... # Error: PYI045 diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI046_PYI046.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI046_PYI046.py.snap index b619b85c7b..f2857330ff 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI046_PYI046.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI046_PYI046.py.snap @@ -1,22 +1,25 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI046]: PYI046.py:5:7: Private protocol `_Foo` is never used +error[PYI046]: 5:7: Private protocol `_Foo` is never used + --> PYI046.py:5:7 | 5 | class _Foo(Protocol): | ^^^^ 6 | bar: int | -error[PYI046]: PYI046.py:9:7: Private protocol `_Bar` is never used +error[PYI046]: 9:7: Private protocol `_Bar` is never used + --> PYI046.py:9:7 | 9 | class _Bar(typing.Protocol): | ^^^^ 10 | bar: int | -error[PYI046]: PYI046.py:16:7: Private protocol `_Baz` is never used +error[PYI046]: 16:7: Private protocol `_Baz` is never used + --> PYI046.py:16:7 | 16 | class _Baz(Protocol[_T]): | ^^^^ diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI046_PYI046.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI046_PYI046.pyi.snap index e5bc3aeda4..3dd0df8c46 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI046_PYI046.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI046_PYI046.pyi.snap @@ -1,22 +1,25 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI046]: PYI046.pyi:5:7: Private protocol `_Foo` is never used +error[PYI046]: 5:7: Private protocol `_Foo` is never used + --> PYI046.pyi:5:7 | 5 | class _Foo(object, Protocol): | ^^^^ 6 | bar: int | -error[PYI046]: PYI046.pyi:9:7: Private protocol `_Bar` is never used +error[PYI046]: 9:7: Private protocol `_Bar` is never used + --> PYI046.pyi:9:7 | 9 | class _Bar(typing.Protocol): | ^^^^ 10 | bar: int | -error[PYI046]: PYI046.pyi:16:7: Private protocol `_Baz` is never used +error[PYI046]: 16:7: Private protocol `_Baz` is never used + --> PYI046.pyi:16:7 | 16 | class _Baz(Protocol[_T]): | ^^^^ diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI047_PYI047.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI047_PYI047.py.snap index 9b4a4a390f..0deb024b3b 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI047_PYI047.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI047_PYI047.py.snap @@ -1,15 +1,17 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI047]: PYI047.py:6:1: Private TypeAlias `_UnusedPrivateTypeAlias` is never used +error[PYI047]: 6:1: Private TypeAlias `_UnusedPrivateTypeAlias` is never used + --> PYI047.py:6:1 | 6 | _UnusedPrivateTypeAlias: TypeAlias = int | None | ^^^^^^^^^^^^^^^^^^^^^^^ 7 | _T: typing.TypeAlias = str | -error[PYI047]: PYI047.py:7:1: Private TypeAlias `_T` is never used +error[PYI047]: 7:1: Private TypeAlias `_T` is never used + --> PYI047.py:6:48 | 6 | _UnusedPrivateTypeAlias: TypeAlias = int | None 7 | _T: typing.TypeAlias = str @@ -17,8 +19,9 @@ error[PYI047]: PYI047.py:7:1: Private TypeAlias `_T` is never used 8 | 9 | # OK | -error[PYI047]: PYI047.py:24:6: Private TypeAlias `_UnusedPEP695` is never used +error[PYI047]: 24:6: Private TypeAlias `_UnusedPEP695` is never used + --> PYI047.py:24:6 | 22 | def func2(arg: _PrivateTypeAlias) -> None: ... 23 | @@ -26,8 +29,9 @@ error[PYI047]: PYI047.py:24:6: Private TypeAlias `_UnusedPEP695` is never used | ^^^^^^^^^^^^^ 25 | type _UnusedGeneric695[T] = list[T] | -error[PYI047]: PYI047.py:25:6: Private TypeAlias `_UnusedGeneric695` is never used +error[PYI047]: 25:6: Private TypeAlias `_UnusedGeneric695` is never used + --> PYI047.py:25:6 | 24 | type _UnusedPEP695 = int 25 | type _UnusedGeneric695[T] = list[T] diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI047_PYI047.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI047_PYI047.pyi.snap index 9039cf3a16..553c10777a 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI047_PYI047.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI047_PYI047.pyi.snap @@ -1,15 +1,17 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI047]: PYI047.pyi:6:1: Private TypeAlias `_UnusedPrivateTypeAlias` is never used +error[PYI047]: 6:1: Private TypeAlias `_UnusedPrivateTypeAlias` is never used + --> PYI047.pyi:6:1 | 6 | _UnusedPrivateTypeAlias: TypeAlias = int | None | ^^^^^^^^^^^^^^^^^^^^^^^ 7 | _T: typing.TypeAlias = str | -error[PYI047]: PYI047.pyi:7:1: Private TypeAlias `_T` is never used +error[PYI047]: 7:1: Private TypeAlias `_T` is never used + --> PYI047.pyi:6:48 | 6 | _UnusedPrivateTypeAlias: TypeAlias = int | None 7 | _T: typing.TypeAlias = str @@ -17,8 +19,9 @@ error[PYI047]: PYI047.pyi:7:1: Private TypeAlias `_T` is never used 8 | 9 | # OK | -error[PYI047]: PYI047.pyi:24:6: Private TypeAlias `_UnusedPEP695` is never used +error[PYI047]: 24:6: Private TypeAlias `_UnusedPEP695` is never used + --> PYI047.pyi:24:6 | 22 | def func2(arg: _PrivateTypeAlias) -> None: ... 23 | @@ -26,8 +29,9 @@ error[PYI047]: PYI047.pyi:24:6: Private TypeAlias `_UnusedPEP695` is never used | ^^^^^^^^^^^^^ 25 | type _UnusedGeneric695[T] = list[T] | -error[PYI047]: PYI047.pyi:25:6: Private TypeAlias `_UnusedGeneric695` is never used +error[PYI047]: 25:6: Private TypeAlias `_UnusedGeneric695` is never used + --> PYI047.pyi:25:6 | 24 | type _UnusedPEP695 = int 25 | type _UnusedGeneric695[T] = list[T] diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI048_PYI048.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI048_PYI048.pyi.snap index dc2a9c6416..1aefa6eafc 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI048_PYI048.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI048_PYI048.pyi.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI048]: PYI048.pyi:8:5: Function body must contain exactly one statement +error[PYI048]: 8:5: Function body must contain exactly one statement + --> PYI048.pyi:8:5 | 6 | """oof""" # OK 7 | @@ -11,8 +12,9 @@ error[PYI048]: PYI048.pyi:8:5: Function body must contain exactly one statement 9 | """oof""" 10 | print("foo") | -error[PYI048]: PYI048.pyi:12:5: Function body must contain exactly one statement +error[PYI048]: 12:5: Function body must contain exactly one statement + --> PYI048.pyi:12:5 | 10 | print("foo") 11 | @@ -21,8 +23,9 @@ error[PYI048]: PYI048.pyi:12:5: Function body must contain exactly one statement 13 | """foo""" 14 | print("foo") | -error[PYI048]: PYI048.pyi:17:5: Function body must contain exactly one statement +error[PYI048]: 17:5: Function body must contain exactly one statement + --> PYI048.pyi:17:5 | 15 | print("foo") 16 | diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI049_PYI049.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI049_PYI049.py.snap index 2c8d9a45d2..848055d84f 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI049_PYI049.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI049_PYI049.py.snap @@ -1,22 +1,25 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI049]: PYI049.py:5:7: Private TypedDict `_UnusedTypedDict` is never used +error[PYI049]: 5:7: Private TypedDict `_UnusedTypedDict` is never used + --> PYI049.py:5:7 | 5 | class _UnusedTypedDict(TypedDict): | ^^^^^^^^^^^^^^^^ 6 | foo: str | -error[PYI049]: PYI049.py:9:7: Private TypedDict `_UnusedTypedDict2` is never used +error[PYI049]: 9:7: Private TypedDict `_UnusedTypedDict2` is never used + --> PYI049.py:9:7 | 9 | class _UnusedTypedDict2(typing.TypedDict): | ^^^^^^^^^^^^^^^^^ 10 | bar: int | -error[PYI049]: PYI049.py:21:1: Private TypedDict `_UnusedTypedDict3` is never used +error[PYI049]: 21:1: Private TypedDict `_UnusedTypedDict3` is never used + --> PYI049.py:21:1 | 21 | _UnusedTypedDict3 = TypedDict("_UnusedTypedDict3", {"foo": int}) | ^^^^^^^^^^^^^^^^^ diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI049_PYI049.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI049_PYI049.pyi.snap index b47378b236..555dffd655 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI049_PYI049.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI049_PYI049.pyi.snap @@ -1,22 +1,25 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI049]: PYI049.pyi:6:7: Private TypedDict `_UnusedTypedDict` is never used +error[PYI049]: 6:7: Private TypedDict `_UnusedTypedDict` is never used + --> PYI049.pyi:6:7 | 6 | class _UnusedTypedDict(TypedDict): | ^^^^^^^^^^^^^^^^ 7 | foo: str | -error[PYI049]: PYI049.pyi:10:7: Private TypedDict `_UnusedTypedDict2` is never used +error[PYI049]: 10:7: Private TypedDict `_UnusedTypedDict2` is never used + --> PYI049.pyi:10:7 | 10 | class _UnusedTypedDict2(typing.TypedDict): | ^^^^^^^^^^^^^^^^^ 11 | bar: int | -error[PYI049]: PYI049.pyi:34:1: Private TypedDict `_UnusedTypedDict3` is never used +error[PYI049]: 34:1: Private TypedDict `_UnusedTypedDict3` is never used + --> PYI049.pyi:33:1 | 32 | bar: list[int] 33 | @@ -24,8 +27,9 @@ error[PYI049]: PYI049.pyi:34:1: Private TypedDict `_UnusedTypedDict3` is never u | ^^^^^^^^^^^^^^^^^ 35 | _UsedTypedDict3 = TypedDict("_UsedTypedDict3", {"bar": bytes}) | -error[PYI049]: PYI049.pyi:43:11: Private TypedDict `_UnusedTypeDict4` is never used +error[PYI049]: 43:11: Private TypedDict `_UnusedTypeDict4` is never used + --> PYI049.pyi:43:11 | 41 | # scope (unlike in `.py` files). 42 | class _CustomClass3: diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI050_PYI050.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI050_PYI050.py.snap index 92eabc0c7e..f2eb73d6e7 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI050_PYI050.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI050_PYI050.py.snap @@ -1,15 +1,17 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI050]: PYI050.py:13:24: Prefer `typing.Never` over `NoReturn` for argument annotations +error[PYI050]: 13:24: Prefer `typing.Never` over `NoReturn` for argument annotations + --> PYI050.py:13:24 | 13 | def foo_no_return(arg: NoReturn): | ^^^^^^^^ 14 | ... | -error[PYI050]: PYI050.py:18:10: Prefer `typing.Never` over `NoReturn` for argument annotations +error[PYI050]: 18:10: Prefer `typing.Never` over `NoReturn` for argument annotations + --> PYI050.py:18:10 | 17 | def foo_no_return_typing_extensions( 18 | arg: typing_extensions.NoReturn, @@ -17,15 +19,17 @@ error[PYI050]: PYI050.py:18:10: Prefer `typing.Never` over `NoReturn` for argume 19 | ): 20 | ... | -error[PYI050]: PYI050.py:23:44: Prefer `typing.Never` over `NoReturn` for argument annotations +error[PYI050]: 23:44: Prefer `typing.Never` over `NoReturn` for argument annotations + --> PYI050.py:23:44 | 23 | def foo_no_return_kwarg(arg: int, *, arg2: NoReturn): | ^^^^^^^^ 24 | ... | -error[PYI050]: PYI050.py:27:47: Prefer `typing.Never` over `NoReturn` for argument annotations +error[PYI050]: 27:47: Prefer `typing.Never` over `NoReturn` for argument annotations + --> PYI050.py:27:47 | 27 | def foo_no_return_pos_only(arg: int, /, arg2: NoReturn): | ^^^^^^^^ diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI050_PYI050.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI050_PYI050.pyi.snap index c1c819ea39..28ce2fedf5 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI050_PYI050.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI050_PYI050.pyi.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI050]: PYI050.pyi:6:24: Prefer `typing.Never` over `NoReturn` for argument annotations +error[PYI050]: 6:24: Prefer `typing.Never` over `NoReturn` for argument annotations + --> PYI050.pyi:6:24 | 4 | def foo(arg): ... 5 | def foo_int(arg: int): ... @@ -11,8 +12,9 @@ error[PYI050]: PYI050.pyi:6:24: Prefer `typing.Never` over `NoReturn` for argume 7 | def foo_no_return_typing_extensions( 8 | arg: typing_extensions.NoReturn, | -error[PYI050]: PYI050.pyi:8:10: Prefer `typing.Never` over `NoReturn` for argument annotations +error[PYI050]: 8:10: Prefer `typing.Never` over `NoReturn` for argument annotations + --> PYI050.pyi:8:10 | 6 | def foo_no_return(arg: NoReturn): ... # Error: PYI050 7 | def foo_no_return_typing_extensions( @@ -21,8 +23,9 @@ error[PYI050]: PYI050.pyi:8:10: Prefer `typing.Never` over `NoReturn` for argume 9 | ): ... # Error: PYI050 10 | def foo_no_return_kwarg(arg: int, *, arg2: NoReturn): ... # Error: PYI050 | -error[PYI050]: PYI050.pyi:10:44: Prefer `typing.Never` over `NoReturn` for argument annotations +error[PYI050]: 10:44: Prefer `typing.Never` over `NoReturn` for argument annotations + --> PYI050.pyi:10:44 | 8 | arg: typing_extensions.NoReturn, 9 | ): ... # Error: PYI050 @@ -31,8 +34,9 @@ error[PYI050]: PYI050.pyi:10:44: Prefer `typing.Never` over `NoReturn` for argum 11 | def foo_no_return_pos_only(arg: int, /, arg2: NoReturn): ... # Error: PYI050 12 | def foo_never(arg: Never): ... | -error[PYI050]: PYI050.pyi:11:47: Prefer `typing.Never` over `NoReturn` for argument annotations +error[PYI050]: 11:47: Prefer `typing.Never` over `NoReturn` for argument annotations + --> PYI050.pyi:11:47 | 9 | ): ... # Error: PYI050 10 | def foo_no_return_kwarg(arg: int, *, arg2: NoReturn): ... # Error: PYI050 @@ -41,8 +45,9 @@ error[PYI050]: PYI050.pyi:11:47: Prefer `typing.Never` over `NoReturn` for argum 12 | def foo_never(arg: Never): ... 13 | def foo_args(*args: NoReturn): ... # Error: PYI050 | -error[PYI050]: PYI050.pyi:13:21: Prefer `typing.Never` over `NoReturn` for argument annotations +error[PYI050]: 13:21: Prefer `typing.Never` over `NoReturn` for argument annotations + --> PYI050.pyi:13:21 | 11 | def foo_no_return_pos_only(arg: int, /, arg2: NoReturn): ... # Error: PYI050 12 | def foo_never(arg: Never): ... @@ -51,8 +56,9 @@ error[PYI050]: PYI050.pyi:13:21: Prefer `typing.Never` over `NoReturn` for argum 14 | def foo_kwargs(**kwargs: NoReturn): ... # Error: PYI050 15 | def foo_args_kwargs(*args: NoReturn, **kwargs: NoReturn): ... # Error: PYI050 | -error[PYI050]: PYI050.pyi:14:26: Prefer `typing.Never` over `NoReturn` for argument annotations +error[PYI050]: 14:26: Prefer `typing.Never` over `NoReturn` for argument annotations + --> PYI050.pyi:14:26 | 12 | def foo_never(arg: Never): ... 13 | def foo_args(*args: NoReturn): ... # Error: PYI050 @@ -61,8 +67,9 @@ error[PYI050]: PYI050.pyi:14:26: Prefer `typing.Never` over `NoReturn` for argum 15 | def foo_args_kwargs(*args: NoReturn, **kwargs: NoReturn): ... # Error: PYI050 16 | def foo_int_args(*args: int): ... | -error[PYI050]: PYI050.pyi:15:28: Prefer `typing.Never` over `NoReturn` for argument annotations +error[PYI050]: 15:28: Prefer `typing.Never` over `NoReturn` for argument annotations + --> PYI050.pyi:15:28 | 13 | def foo_args(*args: NoReturn): ... # Error: PYI050 14 | def foo_kwargs(**kwargs: NoReturn): ... # Error: PYI050 @@ -71,8 +78,9 @@ error[PYI050]: PYI050.pyi:15:28: Prefer `typing.Never` over `NoReturn` for argum 16 | def foo_int_args(*args: int): ... 17 | def foo_int_kwargs(**kwargs: int): ... | -error[PYI050]: PYI050.pyi:15:48: Prefer `typing.Never` over `NoReturn` for argument annotations +error[PYI050]: 15:48: Prefer `typing.Never` over `NoReturn` for argument annotations + --> PYI050.pyi:15:48 | 13 | def foo_args(*args: NoReturn): ... # Error: PYI050 14 | def foo_kwargs(**kwargs: NoReturn): ... # Error: PYI050 @@ -81,8 +89,9 @@ error[PYI050]: PYI050.pyi:15:48: Prefer `typing.Never` over `NoReturn` for argum 16 | def foo_int_args(*args: int): ... 17 | def foo_int_kwargs(**kwargs: int): ... | -error[PYI050]: PYI050.pyi:19:50: Prefer `typing.Never` over `NoReturn` for argument annotations +error[PYI050]: 19:50: Prefer `typing.Never` over `NoReturn` for argument annotations + --> PYI050.pyi:19:50 | 17 | def foo_int_kwargs(**kwargs: int): ... 18 | def foo_int_args_kwargs(*args: int, **kwargs: int): ... @@ -91,8 +100,9 @@ error[PYI050]: PYI050.pyi:19:50: Prefer `typing.Never` over `NoReturn` for argum 20 | def foo_int_kwargs_no_return(*args: NoReturn, **kwargs: int): ... # Error: PYI050 21 | def foo_args_never(*args: Never): ... | -error[PYI050]: PYI050.pyi:20:37: Prefer `typing.Never` over `NoReturn` for argument annotations +error[PYI050]: 20:37: Prefer `typing.Never` over `NoReturn` for argument annotations + --> PYI050.pyi:20:37 | 18 | def foo_int_args_kwargs(*args: int, **kwargs: int): ... 19 | def foo_int_args_no_return(*args: int, **kwargs: NoReturn): ... # Error: PYI050 diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI051_PYI051.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI051_PYI051.py.snap index ddb1186c58..34af9f173b 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI051_PYI051.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI051_PYI051.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI051]: PYI051.py:4:18: `Literal["foo"]` is redundant in a union with `str` +error[PYI051]: 4:18: `Literal["foo"]` is redundant in a union with `str` + --> PYI051.py:4:18 | 2 | from typing import Literal, TypeAlias, Union 3 | @@ -11,8 +12,9 @@ error[PYI051]: PYI051.py:4:18: `Literal["foo"]` is redundant in a union with `st 5 | B: TypeAlias = typing.Union[Literal[b"bar", b"foo"], bytes, str] 6 | C: TypeAlias = typing.Union[Literal[5], int, typing.Union[Literal["foo"], str]] | -error[PYI051]: PYI051.py:5:37: `Literal[b"bar"]` is redundant in a union with `bytes` +error[PYI051]: 5:37: `Literal[b"bar"]` is redundant in a union with `bytes` + --> PYI051.py:5:37 | 4 | A: str | Literal["foo"] 5 | B: TypeAlias = typing.Union[Literal[b"bar", b"foo"], bytes, str] @@ -20,8 +22,9 @@ error[PYI051]: PYI051.py:5:37: `Literal[b"bar"]` is redundant in a union with `b 6 | C: TypeAlias = typing.Union[Literal[5], int, typing.Union[Literal["foo"], str]] 7 | D: TypeAlias = typing.Union[Literal[b"str_bytes", 42], bytes, int] | -error[PYI051]: PYI051.py:5:45: `Literal[b"foo"]` is redundant in a union with `bytes` +error[PYI051]: 5:45: `Literal[b"foo"]` is redundant in a union with `bytes` + --> PYI051.py:5:45 | 4 | A: str | Literal["foo"] 5 | B: TypeAlias = typing.Union[Literal[b"bar", b"foo"], bytes, str] @@ -29,8 +32,9 @@ error[PYI051]: PYI051.py:5:45: `Literal[b"foo"]` is redundant in a union with `b 6 | C: TypeAlias = typing.Union[Literal[5], int, typing.Union[Literal["foo"], str]] 7 | D: TypeAlias = typing.Union[Literal[b"str_bytes", 42], bytes, int] | -error[PYI051]: PYI051.py:6:37: `Literal[5]` is redundant in a union with `int` +error[PYI051]: 6:37: `Literal[5]` is redundant in a union with `int` + --> PYI051.py:6:37 | 4 | A: str | Literal["foo"] 5 | B: TypeAlias = typing.Union[Literal[b"bar", b"foo"], bytes, str] @@ -38,8 +42,9 @@ error[PYI051]: PYI051.py:6:37: `Literal[5]` is redundant in a union with `int` | ^ 7 | D: TypeAlias = typing.Union[Literal[b"str_bytes", 42], bytes, int] | -error[PYI051]: PYI051.py:6:67: `Literal["foo"]` is redundant in a union with `str` +error[PYI051]: 6:67: `Literal["foo"]` is redundant in a union with `str` + --> PYI051.py:6:67 | 4 | A: str | Literal["foo"] 5 | B: TypeAlias = typing.Union[Literal[b"bar", b"foo"], bytes, str] @@ -47,8 +52,9 @@ error[PYI051]: PYI051.py:6:67: `Literal["foo"]` is redundant in a union with `st | ^^^^^ 7 | D: TypeAlias = typing.Union[Literal[b"str_bytes", 42], bytes, int] | -error[PYI051]: PYI051.py:7:37: `Literal[b"str_bytes"]` is redundant in a union with `bytes` +error[PYI051]: 7:37: `Literal[b"str_bytes"]` is redundant in a union with `bytes` + --> PYI051.py:7:37 | 5 | B: TypeAlias = typing.Union[Literal[b"bar", b"foo"], bytes, str] 6 | C: TypeAlias = typing.Union[Literal[5], int, typing.Union[Literal["foo"], str]] @@ -57,8 +63,9 @@ error[PYI051]: PYI051.py:7:37: `Literal[b"str_bytes"]` is redundant in a union w 8 | 9 | def func(x: complex | Literal[1J], y: Union[Literal[3.14], float]): ... | -error[PYI051]: PYI051.py:7:51: `Literal[42]` is redundant in a union with `int` +error[PYI051]: 7:51: `Literal[42]` is redundant in a union with `int` + --> PYI051.py:7:51 | 5 | B: TypeAlias = typing.Union[Literal[b"bar", b"foo"], bytes, str] 6 | C: TypeAlias = typing.Union[Literal[5], int, typing.Union[Literal["foo"], str]] @@ -67,8 +74,9 @@ error[PYI051]: PYI051.py:7:51: `Literal[42]` is redundant in a union with `int` 8 | 9 | def func(x: complex | Literal[1J], y: Union[Literal[3.14], float]): ... | -error[PYI051]: PYI051.py:9:31: `Literal[1J]` is redundant in a union with `complex` +error[PYI051]: 9:31: `Literal[1J]` is redundant in a union with `complex` + --> PYI051.py:9:31 | 7 | D: TypeAlias = typing.Union[Literal[b"str_bytes", 42], bytes, int] 8 | @@ -77,8 +85,9 @@ error[PYI051]: PYI051.py:9:31: `Literal[1J]` is redundant in a union with `compl 10 | 11 | # OK | -error[PYI051]: PYI051.py:9:53: `Literal[3.14]` is redundant in a union with `float` +error[PYI051]: 9:53: `Literal[3.14]` is redundant in a union with `float` + --> PYI051.py:9:53 | 7 | D: TypeAlias = typing.Union[Literal[b"str_bytes", 42], bytes, int] 8 | diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI051_PYI051.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI051_PYI051.pyi.snap index 25c4aed428..7e229a19e0 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI051_PYI051.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI051_PYI051.pyi.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI051]: PYI051.pyi:4:18: `Literal["foo"]` is redundant in a union with `str` +error[PYI051]: 4:18: `Literal["foo"]` is redundant in a union with `str` + --> PYI051.pyi:4:18 | 2 | from typing import Literal, TypeAlias, Union 3 | @@ -11,8 +12,9 @@ error[PYI051]: PYI051.pyi:4:18: `Literal["foo"]` is redundant in a union with `s 5 | B: TypeAlias = typing.Union[Literal[b"bar", b"foo"], bytes, str] 6 | C: TypeAlias = typing.Union[Literal[5], int, typing.Union[Literal["foo"], str]] | -error[PYI051]: PYI051.pyi:5:37: `Literal[b"bar"]` is redundant in a union with `bytes` +error[PYI051]: 5:37: `Literal[b"bar"]` is redundant in a union with `bytes` + --> PYI051.pyi:5:37 | 4 | A: str | Literal["foo"] 5 | B: TypeAlias = typing.Union[Literal[b"bar", b"foo"], bytes, str] @@ -20,8 +22,9 @@ error[PYI051]: PYI051.pyi:5:37: `Literal[b"bar"]` is redundant in a union with ` 6 | C: TypeAlias = typing.Union[Literal[5], int, typing.Union[Literal["foo"], str]] 7 | D: TypeAlias = typing.Union[Literal[b"str_bytes", 42], bytes, int] | -error[PYI051]: PYI051.pyi:5:45: `Literal[b"foo"]` is redundant in a union with `bytes` +error[PYI051]: 5:45: `Literal[b"foo"]` is redundant in a union with `bytes` + --> PYI051.pyi:5:45 | 4 | A: str | Literal["foo"] 5 | B: TypeAlias = typing.Union[Literal[b"bar", b"foo"], bytes, str] @@ -29,8 +32,9 @@ error[PYI051]: PYI051.pyi:5:45: `Literal[b"foo"]` is redundant in a union with ` 6 | C: TypeAlias = typing.Union[Literal[5], int, typing.Union[Literal["foo"], str]] 7 | D: TypeAlias = typing.Union[Literal[b"str_bytes", 42], bytes, int] | -error[PYI051]: PYI051.pyi:6:37: `Literal[5]` is redundant in a union with `int` +error[PYI051]: 6:37: `Literal[5]` is redundant in a union with `int` + --> PYI051.pyi:6:37 | 4 | A: str | Literal["foo"] 5 | B: TypeAlias = typing.Union[Literal[b"bar", b"foo"], bytes, str] @@ -38,8 +42,9 @@ error[PYI051]: PYI051.pyi:6:37: `Literal[5]` is redundant in a union with `int` | ^ 7 | D: TypeAlias = typing.Union[Literal[b"str_bytes", 42], bytes, int] | -error[PYI051]: PYI051.pyi:6:67: `Literal["foo"]` is redundant in a union with `str` +error[PYI051]: 6:67: `Literal["foo"]` is redundant in a union with `str` + --> PYI051.pyi:6:67 | 4 | A: str | Literal["foo"] 5 | B: TypeAlias = typing.Union[Literal[b"bar", b"foo"], bytes, str] @@ -47,8 +52,9 @@ error[PYI051]: PYI051.pyi:6:67: `Literal["foo"]` is redundant in a union with `s | ^^^^^ 7 | D: TypeAlias = typing.Union[Literal[b"str_bytes", 42], bytes, int] | -error[PYI051]: PYI051.pyi:7:37: `Literal[b"str_bytes"]` is redundant in a union with `bytes` +error[PYI051]: 7:37: `Literal[b"str_bytes"]` is redundant in a union with `bytes` + --> PYI051.pyi:7:37 | 5 | B: TypeAlias = typing.Union[Literal[b"bar", b"foo"], bytes, str] 6 | C: TypeAlias = typing.Union[Literal[5], int, typing.Union[Literal["foo"], str]] @@ -57,8 +63,9 @@ error[PYI051]: PYI051.pyi:7:37: `Literal[b"str_bytes"]` is redundant in a union 8 | 9 | def func(x: complex | Literal[1J], y: Union[Literal[3.14], float]): ... | -error[PYI051]: PYI051.pyi:7:51: `Literal[42]` is redundant in a union with `int` +error[PYI051]: 7:51: `Literal[42]` is redundant in a union with `int` + --> PYI051.pyi:7:51 | 5 | B: TypeAlias = typing.Union[Literal[b"bar", b"foo"], bytes, str] 6 | C: TypeAlias = typing.Union[Literal[5], int, typing.Union[Literal["foo"], str]] @@ -67,8 +74,9 @@ error[PYI051]: PYI051.pyi:7:51: `Literal[42]` is redundant in a union with `int` 8 | 9 | def func(x: complex | Literal[1J], y: Union[Literal[3.14], float]): ... | -error[PYI051]: PYI051.pyi:9:31: `Literal[1J]` is redundant in a union with `complex` +error[PYI051]: 9:31: `Literal[1J]` is redundant in a union with `complex` + --> PYI051.pyi:9:31 | 7 | D: TypeAlias = typing.Union[Literal[b"str_bytes", 42], bytes, int] 8 | @@ -77,8 +85,9 @@ error[PYI051]: PYI051.pyi:9:31: `Literal[1J]` is redundant in a union with `comp 10 | 11 | # OK | -error[PYI051]: PYI051.pyi:9:53: `Literal[3.14]` is redundant in a union with `float` +error[PYI051]: 9:53: `Literal[3.14]` is redundant in a union with `float` + --> PYI051.pyi:9:53 | 7 | D: TypeAlias = typing.Union[Literal[b"str_bytes", 42], bytes, int] 8 | diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI052_PYI052.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI052_PYI052.pyi.snap index 13df4c5e72..1c03c34900 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI052_PYI052.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI052_PYI052.pyi.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI052]: PYI052.pyi:14:10: Need type annotation for `field5` +error[PYI052]: 14:10: Need type annotation for `field5` + --> PYI052.pyi:14:10 | 12 | field43: int = -0xFFFFFFFF 13 | field44: int = -1234567890 @@ -11,8 +12,9 @@ error[PYI052]: PYI052.pyi:14:10: Need type annotation for `field5` 15 | field6 = 0 # Y052 Need type annotation for "field6" 16 | field7 = b"" # Y052 Need type annotation for "field7" | -error[PYI052]: PYI052.pyi:15:10: Need type annotation for `field6` +error[PYI052]: 15:10: Need type annotation for `field6` + --> PYI052.pyi:15:10 | 13 | field44: int = -1234567890 14 | field5 = 0 # type: int # Y033 Do not use type comments in stubs (e.g. use "x: int" instead of "x = ... # type: int") # Y052 Need ... @@ -21,8 +23,9 @@ error[PYI052]: PYI052.pyi:15:10: Need type annotation for `field6` 16 | field7 = b"" # Y052 Need type annotation for "field7" 17 | field71 = "foo" # Y052 Need type annotation for "field71" | -error[PYI052]: PYI052.pyi:16:10: Need type annotation for `field7` +error[PYI052]: 16:10: Need type annotation for `field7` + --> PYI052.pyi:16:10 | 14 | field5 = 0 # type: int # Y033 Do not use type comments in stubs (e.g. use "x: int" instead of "x = ... # type: int") # Y052 Need ... 15 | field6 = 0 # Y052 Need type annotation for "field6" @@ -31,8 +34,9 @@ error[PYI052]: PYI052.pyi:16:10: Need type annotation for `field7` 17 | field71 = "foo" # Y052 Need type annotation for "field71" 18 | field72: str = "foo" | -error[PYI052]: PYI052.pyi:17:11: Need type annotation for `field71` +error[PYI052]: 17:11: Need type annotation for `field71` + --> PYI052.pyi:17:11 | 15 | field6 = 0 # Y052 Need type annotation for "field6" 16 | field7 = b"" # Y052 Need type annotation for "field7" @@ -41,8 +45,9 @@ error[PYI052]: PYI052.pyi:17:11: Need type annotation for `field71` 18 | field72: str = "foo" 19 | field8 = False # Y052 Need type annotation for "field8" | -error[PYI052]: PYI052.pyi:19:10: Need type annotation for `field8` +error[PYI052]: 19:10: Need type annotation for `field8` + --> PYI052.pyi:19:10 | 17 | field71 = "foo" # Y052 Need type annotation for "field71" 18 | field72: str = "foo" @@ -51,8 +56,9 @@ error[PYI052]: PYI052.pyi:19:10: Need type annotation for `field8` 20 | field81 = -1 # Y052 Need type annotation for "field81" 21 | field82: float = -98.43 | -error[PYI052]: PYI052.pyi:20:11: Need type annotation for `field81` +error[PYI052]: 20:11: Need type annotation for `field81` + --> PYI052.pyi:20:11 | 18 | field72: str = "foo" 19 | field8 = False # Y052 Need type annotation for "field8" @@ -61,8 +67,9 @@ error[PYI052]: PYI052.pyi:20:11: Need type annotation for `field81` 21 | field82: float = -98.43 22 | field83 = -42j # Y052 Need type annotation for "field83" | -error[PYI052]: PYI052.pyi:22:11: Need type annotation for `field83` +error[PYI052]: 22:11: Need type annotation for `field83` + --> PYI052.pyi:22:11 | 20 | field81 = -1 # Y052 Need type annotation for "field81" 21 | field82: float = -98.43 @@ -71,8 +78,9 @@ error[PYI052]: PYI052.pyi:22:11: Need type annotation for `field83` 23 | field84 = 5 + 42j # Y052 Need type annotation for "field84" 24 | field85 = -5 - 42j # Y052 Need type annotation for "field85" | -error[PYI052]: PYI052.pyi:23:11: Need type annotation for `field84` +error[PYI052]: 23:11: Need type annotation for `field84` + --> PYI052.pyi:23:11 | 21 | field82: float = -98.43 22 | field83 = -42j # Y052 Need type annotation for "field83" @@ -81,8 +89,9 @@ error[PYI052]: PYI052.pyi:23:11: Need type annotation for `field84` 24 | field85 = -5 - 42j # Y052 Need type annotation for "field85" 25 | field9 = None # Y026 Use typing_extensions.TypeAlias for type aliases, e.g. "field9: TypeAlias = None" | -error[PYI052]: PYI052.pyi:24:11: Need type annotation for `field85` +error[PYI052]: 24:11: Need type annotation for `field85` + --> PYI052.pyi:24:11 | 22 | field83 = -42j # Y052 Need type annotation for "field83" 23 | field84 = 5 + 42j # Y052 Need type annotation for "field84" @@ -91,8 +100,9 @@ error[PYI052]: PYI052.pyi:24:11: Need type annotation for `field85` 25 | field9 = None # Y026 Use typing_extensions.TypeAlias for type aliases, e.g. "field9: TypeAlias = None" 26 | Field95: TypeAlias = None | -error[PYI052]: PYI052.pyi:33:11: Need type annotation for `field19` +error[PYI052]: 33:11: Need type annotation for `field19` + --> PYI052.pyi:33:11 | 31 | Field100 = TypeVarTuple('Field100') 32 | Field101 = ParamSpec('Field101') @@ -101,8 +111,9 @@ error[PYI052]: PYI052.pyi:33:11: Need type annotation for `field19` 34 | field191: list[int] = [1, 2, 3] 35 | field20 = (1, 2, 3) # Y052 Need type annotation for "field20" | -error[PYI052]: PYI052.pyi:35:11: Need type annotation for `field20` +error[PYI052]: 35:11: Need type annotation for `field20` + --> PYI052.pyi:35:11 | 33 | field19 = [1, 2, 3] # Y052 Need type annotation for "field19" 34 | field191: list[int] = [1, 2, 3] @@ -111,8 +122,9 @@ error[PYI052]: PYI052.pyi:35:11: Need type annotation for `field20` 36 | field201: tuple[int, ...] = (1, 2, 3) 37 | field21 = {1, 2, 3} # Y052 Need type annotation for "field21" | -error[PYI052]: PYI052.pyi:37:11: Need type annotation for `field21` +error[PYI052]: 37:11: Need type annotation for `field21` + --> PYI052.pyi:37:11 | 35 | field20 = (1, 2, 3) # Y052 Need type annotation for "field20" 36 | field201: tuple[int, ...] = (1, 2, 3) @@ -121,8 +133,9 @@ error[PYI052]: PYI052.pyi:37:11: Need type annotation for `field21` 38 | field211: set[int] = {1, 2, 3} 39 | field212 = {"foo": "bar"} # Y052 Need type annotation for "field212" | -error[PYI052]: PYI052.pyi:39:12: Need type annotation for `field212` +error[PYI052]: 39:12: Need type annotation for `field212` + --> PYI052.pyi:39:12 | 37 | field21 = {1, 2, 3} # Y052 Need type annotation for "field21" 38 | field211: set[int] = {1, 2, 3} @@ -131,8 +144,9 @@ error[PYI052]: PYI052.pyi:39:12: Need type annotation for `field212` 40 | field213: dict[str, str] = {"foo": "bar"} 41 | field22: Final = {"foo": 5} | -error[PYI052]: PYI052.pyi:114:11: Need type annotation for `WIZ` +error[PYI052]: 114:11: Need type annotation for `WIZ` + --> PYI052.pyi:114:11 | 113 | class Bop: 114 | WIZ = 4 diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI053_PYI053.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI053_PYI053.pyi.snap index 501c5a3100..74ae7d36d8 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI053_PYI053.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI053_PYI053.pyi.snap @@ -1,17 +1,18 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -PYI053.pyi:7:14: PYI053 [*] String and bytes literals longer than 50 characters are not permitted +error[PYI053]: 7:14: [*] String and bytes literals longer than 50 characters are not permitted + + --> PYI053.pyi:7:14 | 5 | def f1(x: str = "50 character stringggggggggggggggggggggggggggggggg") -> None: ... # OK 6 | def f2( 7 | x: str = "51 character stringgggggggggggggggggggggggggggggggg", # Error: PYI053 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI053 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 8 | ) -> None: ... 9 | def f3( | = help: Replace with `...` - ℹ Safe fix 4 4 | 5 5 | def f1(x: str = "50 character stringggggggggggggggggggggggggggggggg") -> None: ... # OK @@ -22,17 +23,18 @@ PYI053.pyi:7:14: PYI053 [*] String and bytes literals longer than 50 characters 9 9 | def f3( 10 10 | x: str = "50 character stringgggggggggggggggggggggggggggggg\U0001f600", # OK -PYI053.pyi:13:14: PYI053 [*] String and bytes literals longer than 50 characters are not permitted +error[PYI053]: 13:14: [*] String and bytes literals longer than 50 characters are not permitted + + --> PYI053.pyi:13:14 | 11 | ) -> None: ... 12 | def f4( 13 | x: str = "51 character stringggggggggggggggggggggggggggggggg\U0001f600", # Error: PYI053 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI053 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 14 | ) -> None: ... 15 | def f5( | = help: Replace with `...` - ℹ Safe fix 10 10 | x: str = "50 character stringgggggggggggggggggggggggggggggg\U0001f600", # OK 11 11 | ) -> None: ... @@ -43,16 +45,17 @@ PYI053.pyi:13:14: PYI053 [*] String and bytes literals longer than 50 characters 15 15 | def f5( 16 16 | x: bytes = b"50 character byte stringgggggggggggggggggggggggggg", # OK -PYI053.pyi:25:16: PYI053 [*] String and bytes literals longer than 50 characters are not permitted +error[PYI053]: 25:16: [*] String and bytes literals longer than 50 characters are not permitted + + --> PYI053.pyi:25:16 | 23 | ) -> None: ... 24 | def f8( 25 | x: bytes = b"51 character byte stringgggggggggggggggggggggggggg\xff", # Error: PYI053 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI053 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 26 | ) -> None: ... | = help: Replace with `...` - ℹ Safe fix 22 22 | x: bytes = b"50 character byte stringggggggggggggggggggggggggg\xff", # OK 23 23 | ) -> None: ... @@ -63,17 +66,18 @@ PYI053.pyi:25:16: PYI053 [*] String and bytes literals longer than 50 characters 27 27 | 28 28 | foo: str = "50 character stringggggggggggggggggggggggggggggggg" # OK -PYI053.pyi:30:12: PYI053 [*] String and bytes literals longer than 50 characters are not permitted +error[PYI053]: 30:12: [*] String and bytes literals longer than 50 characters are not permitted + + --> PYI053.pyi:30:12 | 28 | foo: str = "50 character stringggggggggggggggggggggggggggggggg" # OK 29 | 30 | bar: str = "51 character stringgggggggggggggggggggggggggggggggg" # Error: PYI053 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI053 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 31 | 32 | baz: bytes = b"50 character byte stringgggggggggggggggggggggggggg" # OK | = help: Replace with `...` - ℹ Safe fix 27 27 | 28 28 | foo: str = "50 character stringggggggggggggggggggggggggggggggg" # OK @@ -84,17 +88,18 @@ PYI053.pyi:30:12: PYI053 [*] String and bytes literals longer than 50 characters 32 32 | baz: bytes = b"50 character byte stringgggggggggggggggggggggggggg" # OK 33 33 | -PYI053.pyi:34:14: PYI053 [*] String and bytes literals longer than 50 characters are not permitted +error[PYI053]: 34:14: [*] String and bytes literals longer than 50 characters are not permitted + + --> PYI053.pyi:34:14 | 32 | baz: bytes = b"50 character byte stringgggggggggggggggggggggggggg" # OK 33 | 34 | qux: bytes = b"51 character byte stringggggggggggggggggggggggggggg\xff" # Error: PYI053 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI053 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 35 | 36 | ffoo: str = f"50 character stringggggggggggggggggggggggggggggggg" # OK | = help: Replace with `...` - ℹ Safe fix 31 31 | 32 32 | baz: bytes = b"50 character byte stringgggggggggggggggggggggggggg" # OK @@ -105,17 +110,18 @@ PYI053.pyi:34:14: PYI053 [*] String and bytes literals longer than 50 characters 36 36 | ffoo: str = f"50 character stringggggggggggggggggggggggggggggggg" # OK 37 37 | -PYI053.pyi:38:13: PYI053 [*] String and bytes literals longer than 50 characters are not permitted +error[PYI053]: 38:13: [*] String and bytes literals longer than 50 characters are not permitted + + --> PYI053.pyi:38:13 | 36 | ffoo: str = f"50 character stringggggggggggggggggggggggggggggggg" # OK 37 | 38 | fbar: str = f"51 character stringgggggggggggggggggggggggggggggggg" # Error: PYI053 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI053 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 39 | 40 | class Demo: | = help: Replace with `...` - ℹ Safe fix 35 35 | 36 36 | ffoo: str = f"50 character stringggggggggggggggggggggggggggggggg" # OK @@ -126,16 +132,17 @@ PYI053.pyi:38:13: PYI053 [*] String and bytes literals longer than 50 characters 40 40 | class Demo: 41 41 | """Docstrings are excluded from this rule. Some padding.""" # OK -PYI053.pyi:64:5: PYI053 [*] String and bytes literals longer than 50 characters are not permitted +error[PYI053]: 64:5: [*] String and bytes literals longer than 50 characters are not permitted + + --> PYI053.pyi:64:5 | 63 | @not_warnings_dot_deprecated( 64 | "Not warnings.deprecated, so this one *should* lead to PYI053 in a stub!" # Error: PYI053 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI053 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 65 | ) 66 | def not_a_deprecated_function() -> None: ... | = help: Replace with `...` - ℹ Safe fix 61 61 | ) -> Callable[[Callable[[], None]], Callable[[], None]]: ... 62 62 | @@ -146,17 +153,18 @@ PYI053.pyi:64:5: PYI053 [*] String and bytes literals longer than 50 characters 66 66 | def not_a_deprecated_function() -> None: ... 67 67 | -PYI053.pyi:68:13: PYI053 [*] String and bytes literals longer than 50 characters are not permitted +error[PYI053]: 68:13: [*] String and bytes literals longer than 50 characters are not permitted + + --> PYI053.pyi:68:13 | 66 | def not_a_deprecated_function() -> None: ... 67 | 68 | fbaz: str = f"51 character {foo} stringgggggggggggggggggggggggggg" # Error: PYI053 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI053 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 69 | 70 | # see https://github.com/astral-sh/ruff/issues/12995 | = help: Replace with `...` - ℹ Safe fix 65 65 | ) 66 66 | def not_a_deprecated_function() -> None: ... diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI054_PYI054.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI054_PYI054.pyi.snap index d0aa1a0c06..c43dcebf9e 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI054_PYI054.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI054_PYI054.pyi.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI054]: PYI054.pyi:2:16: [*] Numeric literals with a string representation longer than ten characters are not permitted +error[PYI054]: 2:16: [*] Numeric literals with a string representation longer than ten characters are not permitted + --> PYI054.pyi:2:16 | 1 | field01: int = 0xFFFFFFFF 2 | field02: int = 0xFFFFFFFFF # Error: PYI054 @@ -19,8 +20,9 @@ error[PYI054]: PYI054.pyi:2:16: [*] Numeric literals with a string representatio 4 4 | field04: int = -0xFFFFFFFFF # Error: PYI054 5 5 | -error[PYI054]: PYI054.pyi:4:17: [*] Numeric literals with a string representation longer than ten characters are not permitted +error[PYI054]: 4:17: [*] Numeric literals with a string representation longer than ten characters are not permitted + --> PYI054.pyi:4:17 | 2 | field02: int = 0xFFFFFFFFF # Error: PYI054 3 | field03: int = -0xFFFFFFFF @@ -40,8 +42,9 @@ error[PYI054]: PYI054.pyi:4:17: [*] Numeric literals with a string representatio 6 6 | field05: int = 1234567890 7 7 | field06: int = 12_456_890 -error[PYI054]: PYI054.pyi:8:16: [*] Numeric literals with a string representation longer than ten characters are not permitted +error[PYI054]: 8:16: [*] Numeric literals with a string representation longer than ten characters are not permitted + --> PYI054.pyi:8:16 | 6 | field05: int = 1234567890 7 | field06: int = 12_456_890 @@ -61,8 +64,9 @@ error[PYI054]: PYI054.pyi:8:16: [*] Numeric literals with a string representatio 10 10 | field09: int = -234_567_890 # Error: PYI054 11 11 | -error[PYI054]: PYI054.pyi:10:17: [*] Numeric literals with a string representation longer than ten characters are not permitted +error[PYI054]: 10:17: [*] Numeric literals with a string representation longer than ten characters are not permitted + --> PYI054.pyi:10:17 | 8 | field07: int = 12345678901 # Error: PYI054 9 | field08: int = -1234567801 @@ -82,8 +86,9 @@ error[PYI054]: PYI054.pyi:10:17: [*] Numeric literals with a string representati 12 12 | field10: float = 123.456789 13 13 | field11: float = 123.4567890 # Error: PYI054 -error[PYI054]: PYI054.pyi:13:18: [*] Numeric literals with a string representation longer than ten characters are not permitted +error[PYI054]: 13:18: [*] Numeric literals with a string representation longer than ten characters are not permitted + --> PYI054.pyi:13:18 | 12 | field10: float = 123.456789 13 | field11: float = 123.4567890 # Error: PYI054 @@ -102,8 +107,9 @@ error[PYI054]: PYI054.pyi:13:18: [*] Numeric literals with a string representati 15 15 | field13: float = -123.567_890 # Error: PYI054 16 16 | -error[PYI054]: PYI054.pyi:15:19: [*] Numeric literals with a string representation longer than ten characters are not permitted +error[PYI054]: 15:19: [*] Numeric literals with a string representation longer than ten characters are not permitted + --> PYI054.pyi:15:19 | 13 | field11: float = 123.4567890 # Error: PYI054 14 | field12: float = -123.456789 @@ -123,8 +129,9 @@ error[PYI054]: PYI054.pyi:15:19: [*] Numeric literals with a string representati 17 17 | field14: complex = 1e1234567j 18 18 | field15: complex = 1e12345678j # Error: PYI054 -error[PYI054]: PYI054.pyi:18:20: [*] Numeric literals with a string representation longer than ten characters are not permitted +error[PYI054]: 18:20: [*] Numeric literals with a string representation longer than ten characters are not permitted + --> PYI054.pyi:18:20 | 17 | field14: complex = 1e1234567j 18 | field15: complex = 1e12345678j # Error: PYI054 @@ -142,8 +149,9 @@ error[PYI054]: PYI054.pyi:18:20: [*] Numeric literals with a string representati 19 19 | field16: complex = -1e1234567j 20 20 | field17: complex = 1e123456789j # Error: PYI054 -error[PYI054]: PYI054.pyi:20:20: [*] Numeric literals with a string representation longer than ten characters are not permitted +error[PYI054]: 20:20: [*] Numeric literals with a string representation longer than ten characters are not permitted + --> PYI054.pyi:20:20 | 18 | field15: complex = 1e12345678j # Error: PYI054 19 | field16: complex = -1e1234567j diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI055_PYI055.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI055_PYI055.py.snap index 95eeaf3196..82312d5ce3 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI055_PYI055.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI055_PYI055.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI055]: PYI055.py:31:8: [*] Multiple `type` members in a union. Combine them into one, e.g., `type[requests_mock.Mocker | httpretty | str]`. +error[PYI055]: 31:8: [*] Multiple `type` members in a union. Combine them into one, e.g., `type[requests_mock.Mocker | httpretty | str]`. + --> PYI055.py:31:8 | 29 | def func(): 30 | # PYI055 @@ -21,8 +22,9 @@ error[PYI055]: PYI055.py:31:8: [*] Multiple `type` members in a union. Combine t 33 33 | 34 34 | -error[PYI055]: PYI055.py:32:8: [*] Multiple `type` members in a union. Combine them into one, e.g., `type[Union[requests_mock.Mocker, httpretty, str]]`. +error[PYI055]: 32:8: [*] Multiple `type` members in a union. Combine them into one, e.g., `type[Union[requests_mock.Mocker, httpretty, str]]`. + --> PYI055.py:32:8 | 30 | # PYI055 31 | x: type[requests_mock.Mocker] | type[httpretty] | type[str] = requests_mock.Mocker @@ -40,8 +42,9 @@ error[PYI055]: PYI055.py:32:8: [*] Multiple `type` members in a union. Combine t 34 34 | 35 35 | def func(): -error[PYI055]: PYI055.py:39:8: [*] Multiple `type` members in a union. Combine them into one, e.g., `type[Union[requests_mock.Mocker, httpretty, str]]`. +error[PYI055]: 39:8: [*] Multiple `type` members in a union. Combine them into one, e.g., `type[Union[requests_mock.Mocker, httpretty, str]]`. + --> PYI055.py:39:8 | 38 | # PYI055 39 | x: Union[type[requests_mock.Mocker], type[httpretty], type[str]] = requests_mock.Mocker @@ -58,8 +61,9 @@ error[PYI055]: PYI055.py:39:8: [*] Multiple `type` members in a union. Combine t 41 41 | 42 42 | def convert_union(union: UnionType) -> _T | None: -error[PYI055]: PYI055.py:44:9: [*] Multiple `type` members in a union. Combine them into one, e.g., `type[_T | Converter[_T]]`. +error[PYI055]: 44:9: [*] Multiple `type` members in a union. Combine them into one, e.g., `type[_T | Converter[_T]]`. + --> PYI055.py:44:9 | 42 | def convert_union(union: UnionType) -> _T | None: 43 | converters: tuple[ @@ -79,8 +83,9 @@ error[PYI055]: PYI055.py:44:9: [*] Multiple `type` members in a union. Combine t 46 46 | ... 47 47 | -error[PYI055]: PYI055.py:50:15: [*] Multiple `type` members in a union. Combine them into one, e.g., `type[_T | Converter[_T]]`. +error[PYI055]: 50:15: [*] Multiple `type` members in a union. Combine them into one, e.g., `type[_T | Converter[_T]]`. + --> PYI055.py:50:15 | 48 | def convert_union(union: UnionType) -> _T | None: 49 | converters: tuple[ @@ -100,8 +105,9 @@ error[PYI055]: PYI055.py:50:15: [*] Multiple `type` members in a union. Combine 52 52 | ... 53 53 | -error[PYI055]: PYI055.py:56:15: [*] Multiple `type` members in a union. Combine them into one, e.g., `type[_T | Converter[_T]]`. +error[PYI055]: 56:15: [*] Multiple `type` members in a union. Combine them into one, e.g., `type[_T | Converter[_T]]`. + --> PYI055.py:56:15 | 54 | def convert_union(union: UnionType) -> _T | None: 55 | converters: tuple[ @@ -121,8 +127,9 @@ error[PYI055]: PYI055.py:56:15: [*] Multiple `type` members in a union. Combine 58 58 | ... 59 59 | -error[PYI055]: PYI055.py:62:15: [*] Multiple `type` members in a union. Combine them into one, e.g., `type[_T | Converter[_T]]`. +error[PYI055]: 62:15: [*] Multiple `type` members in a union. Combine them into one, e.g., `type[_T | Converter[_T]]`. + --> PYI055.py:62:15 | 60 | def convert_union(union: UnionType) -> _T | None: 61 | converters: tuple[ diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI055_PYI055.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI055_PYI055.pyi.snap index aa46205ead..ba56ffff39 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI055_PYI055.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI055_PYI055.pyi.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI055]: PYI055.pyi:4:4: [*] Multiple `type` members in a union. Combine them into one, e.g., `type[int | str | complex]`. +error[PYI055]: 4:4: [*] Multiple `type` members in a union. Combine them into one, e.g., `type[int | str | complex]`. + --> PYI055.pyi:4:4 | 2 | from typing import Union 3 | @@ -22,8 +23,9 @@ error[PYI055]: PYI055.pyi:4:4: [*] Multiple `type` members in a union. Combine t 6 6 | y: builtins.type[int] | type[str] | builtins.type[complex] 7 7 | z: Union[type[float], type[complex]] -error[PYI055]: PYI055.pyi:5:4: [*] Multiple `type` members in a union. Combine them into one, e.g., `type[int | str | float]`. +error[PYI055]: 5:4: [*] Multiple `type` members in a union. Combine them into one, e.g., `type[int | str | float]`. + --> PYI055.pyi:5:4 | 4 | w: builtins.type[int] | builtins.type[str] | builtins.type[complex] 5 | x: type[int] | type[str] | type[float] @@ -42,8 +44,9 @@ error[PYI055]: PYI055.pyi:5:4: [*] Multiple `type` members in a union. Combine t 7 7 | z: Union[type[float], type[complex]] 8 8 | z: Union[type[float, int], type[complex]] -error[PYI055]: PYI055.pyi:6:4: [*] Multiple `type` members in a union. Combine them into one, e.g., `type[int | str | complex]`. +error[PYI055]: 6:4: [*] Multiple `type` members in a union. Combine them into one, e.g., `type[int | str | complex]`. + --> PYI055.pyi:6:4 | 4 | w: builtins.type[int] | builtins.type[str] | builtins.type[complex] 5 | x: type[int] | type[str] | type[float] @@ -63,8 +66,9 @@ error[PYI055]: PYI055.pyi:6:4: [*] Multiple `type` members in a union. Combine t 8 8 | z: Union[type[float, int], type[complex]] 9 9 | -error[PYI055]: PYI055.pyi:7:4: [*] Multiple `type` members in a union. Combine them into one, e.g., `type[Union[float, complex]]`. +error[PYI055]: 7:4: [*] Multiple `type` members in a union. Combine them into one, e.g., `type[Union[float, complex]]`. + --> PYI055.pyi:7:4 | 5 | x: type[int] | type[str] | type[float] 6 | y: builtins.type[int] | type[str] | builtins.type[complex] @@ -83,8 +87,9 @@ error[PYI055]: PYI055.pyi:7:4: [*] Multiple `type` members in a union. Combine t 9 9 | 10 10 | def func(arg: type[int] | str | type[float]) -> None: ... -error[PYI055]: PYI055.pyi:8:4: [*] Multiple `type` members in a union. Combine them into one, e.g., `type[Union[float, int, complex]]`. +error[PYI055]: 8:4: [*] Multiple `type` members in a union. Combine them into one, e.g., `type[Union[float, int, complex]]`. + --> PYI055.pyi:8:4 | 6 | y: builtins.type[int] | type[str] | builtins.type[complex] 7 | z: Union[type[float], type[complex]] @@ -104,8 +109,9 @@ error[PYI055]: PYI055.pyi:8:4: [*] Multiple `type` members in a union. Combine t 10 10 | def func(arg: type[int] | str | type[float]) -> None: ... 11 11 | -error[PYI055]: PYI055.pyi:10:15: [*] Multiple `type` members in a union. Combine them into one, e.g., `type[int | float]`. +error[PYI055]: 10:15: [*] Multiple `type` members in a union. Combine them into one, e.g., `type[int | float]`. + --> PYI055.pyi:10:15 | 8 | z: Union[type[float, int], type[complex]] 9 | @@ -125,8 +131,9 @@ error[PYI055]: PYI055.pyi:10:15: [*] Multiple `type` members in a union. Combine 12 12 | # OK 13 13 | x: type[int, str, float] -error[PYI055]: PYI055.pyi:20:7: [*] Multiple `type` members in a union. Combine them into one, e.g., `type[requests_mock.Mocker | httpretty]`. +error[PYI055]: 20:7: [*] Multiple `type` members in a union. Combine them into one, e.g., `type[requests_mock.Mocker | httpretty]`. + --> PYI055.pyi:20:7 | 19 | # OK 20 | item: type[requests_mock.Mocker] | type[httpretty] = requests_mock.Mocker @@ -145,8 +152,9 @@ error[PYI055]: PYI055.pyi:20:7: [*] Multiple `type` members in a union. Combine 22 22 | def func(): 23 23 | # PYI055 -error[PYI055]: PYI055.pyi:24:11: [*] Multiple `type` members in a union. Combine them into one, e.g., `type[requests_mock.Mocker | httpretty | str]`. +error[PYI055]: 24:11: [*] Multiple `type` members in a union. Combine them into one, e.g., `type[requests_mock.Mocker | httpretty | str]`. + --> PYI055.pyi:24:11 | 22 | def func(): 23 | # PYI055 @@ -163,8 +171,9 @@ error[PYI055]: PYI055.pyi:24:11: [*] Multiple `type` members in a union. Combine 24 |+ item: type[requests_mock.Mocker | httpretty | str] = requests_mock.Mocker 25 25 | item2: Union[type[requests_mock.Mocker], type[httpretty], type[str]] = requests_mock.Mocker -error[PYI055]: PYI055.pyi:25:12: [*] Multiple `type` members in a union. Combine them into one, e.g., `type[Union[requests_mock.Mocker, httpretty, str]]`. +error[PYI055]: 25:12: [*] Multiple `type` members in a union. Combine them into one, e.g., `type[Union[requests_mock.Mocker, httpretty, str]]`. + --> PYI055.pyi:25:12 | 23 | # PYI055 24 | item: type[requests_mock.Mocker] | type[httpretty] | type[str] = requests_mock.Mocker diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI056_PYI056.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI056_PYI056.py.snap index 69655ec355..f199b2fa3d 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI056_PYI056.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI056_PYI056.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI056]: PYI056.py:4:1: Calling `.append()` on `__all__` may not be supported by all type checkers (use `+=` instead) +error[PYI056]: 4:1: Calling `.append()` on `__all__` may not be supported by all type checkers (use `+=` instead) + --> PYI056.py:3:9 | 3 | # Errors 4 | __all__.append("D") @@ -10,8 +11,9 @@ error[PYI056]: PYI056.py:4:1: Calling `.append()` on `__all__` may not be suppor 5 | __all__.extend(["E", "Foo"]) 6 | __all__.remove("A") | -error[PYI056]: PYI056.py:5:1: Calling `.extend()` on `__all__` may not be supported by all type checkers (use `+=` instead) +error[PYI056]: 5:1: Calling `.extend()` on `__all__` may not be supported by all type checkers (use `+=` instead) + --> PYI056.py:4:20 | 3 | # Errors 4 | __all__.append("D") @@ -19,8 +21,9 @@ error[PYI056]: PYI056.py:5:1: Calling `.extend()` on `__all__` may not be suppor | ^^^^^^^^^^^^^^ 6 | __all__.remove("A") | -error[PYI056]: PYI056.py:6:1: Calling `.remove()` on `__all__` may not be supported by all type checkers (use `+=` instead) +error[PYI056]: 6:1: Calling `.remove()` on `__all__` may not be supported by all type checkers (use `+=` instead) + --> PYI056.py:5:29 | 4 | __all__.append("D") 5 | __all__.extend(["E", "Foo"]) diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI056_PYI056.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI056_PYI056.pyi.snap index 202c837e7f..887ac74db1 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI056_PYI056.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI056_PYI056.pyi.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI056]: PYI056.pyi:4:1: Calling `.append()` on `__all__` may not be supported by all type checkers (use `+=` instead) +error[PYI056]: 4:1: Calling `.append()` on `__all__` may not be supported by all type checkers (use `+=` instead) + --> PYI056.pyi:3:9 | 3 | # Errors 4 | __all__.append("D") @@ -10,8 +11,9 @@ error[PYI056]: PYI056.pyi:4:1: Calling `.append()` on `__all__` may not be suppo 5 | __all__.extend(["E", "Foo"]) 6 | __all__.remove("A") | -error[PYI056]: PYI056.pyi:5:1: Calling `.extend()` on `__all__` may not be supported by all type checkers (use `+=` instead) +error[PYI056]: 5:1: Calling `.extend()` on `__all__` may not be supported by all type checkers (use `+=` instead) + --> PYI056.pyi:4:20 | 3 | # Errors 4 | __all__.append("D") @@ -19,8 +21,9 @@ error[PYI056]: PYI056.pyi:5:1: Calling `.extend()` on `__all__` may not be suppo | ^^^^^^^^^^^^^^ 6 | __all__.remove("A") | -error[PYI056]: PYI056.pyi:6:1: Calling `.remove()` on `__all__` may not be supported by all type checkers (use `+=` instead) +error[PYI056]: 6:1: Calling `.remove()` on `__all__` may not be supported by all type checkers (use `+=` instead) + --> PYI056.pyi:5:29 | 4 | __all__.append("D") 5 | __all__.extend(["E", "Foo"]) diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI057_PYI057.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI057_PYI057.py.snap index 48566e7e2a..d7307bc734 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI057_PYI057.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI057_PYI057.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI057]: PYI057.py:4:20: Do not use `typing.ByteString`, which has unclear semantics and is deprecated +error[PYI057]: 4:20: Do not use `typing.ByteString`, which has unclear semantics and is deprecated + --> PYI057.py:4:20 | 2 | import collections.abc 3 | import foo @@ -11,8 +12,9 @@ error[PYI057]: PYI057.py:4:20: Do not use `typing.ByteString`, which has unclear 5 | from collections.abc import ByteString 6 | from foo import ByteString | -error[PYI057]: PYI057.py:5:29: Do not use `collections.abc.ByteString`, which has unclear semantics and is deprecated +error[PYI057]: 5:29: Do not use `collections.abc.ByteString`, which has unclear semantics and is deprecated + --> PYI057.py:5:29 | 3 | import foo 4 | from typing import ByteString @@ -20,8 +22,9 @@ error[PYI057]: PYI057.py:5:29: Do not use `collections.abc.ByteString`, which ha | ^^^^^^^^^^ 6 | from foo import ByteString | -error[PYI057]: PYI057.py:8:4: Do not use `typing.ByteString`, which has unclear semantics and is deprecated +error[PYI057]: 8:4: Do not use `typing.ByteString`, which has unclear semantics and is deprecated + --> PYI057.py:8:4 | 6 | from foo import ByteString 7 | @@ -30,8 +33,9 @@ error[PYI057]: PYI057.py:8:4: Do not use `typing.ByteString`, which has unclear 9 | b: collections.abc.ByteString 10 | c: foo.ByteString | -error[PYI057]: PYI057.py:9:4: Do not use `collections.abc.ByteString`, which has unclear semantics and is deprecated +error[PYI057]: 9:4: Do not use `collections.abc.ByteString`, which has unclear semantics and is deprecated + --> PYI057.py:9:4 | 8 | a: typing.ByteString 9 | b: collections.abc.ByteString diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI057_PYI057.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI057_PYI057.pyi.snap index 3b33831c78..39cde0c3df 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI057_PYI057.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI057_PYI057.pyi.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI057]: PYI057.pyi:4:20: Do not use `typing.ByteString`, which has unclear semantics and is deprecated +error[PYI057]: 4:20: Do not use `typing.ByteString`, which has unclear semantics and is deprecated + --> PYI057.pyi:4:20 | 2 | import collections.abc 3 | import foo @@ -11,8 +12,9 @@ error[PYI057]: PYI057.pyi:4:20: Do not use `typing.ByteString`, which has unclea 5 | from collections.abc import ByteString 6 | from foo import ByteString | -error[PYI057]: PYI057.pyi:5:29: Do not use `collections.abc.ByteString`, which has unclear semantics and is deprecated +error[PYI057]: 5:29: Do not use `collections.abc.ByteString`, which has unclear semantics and is deprecated + --> PYI057.pyi:5:29 | 3 | import foo 4 | from typing import ByteString @@ -20,8 +22,9 @@ error[PYI057]: PYI057.pyi:5:29: Do not use `collections.abc.ByteString`, which h | ^^^^^^^^^^ 6 | from foo import ByteString | -error[PYI057]: PYI057.pyi:8:4: Do not use `typing.ByteString`, which has unclear semantics and is deprecated +error[PYI057]: 8:4: Do not use `typing.ByteString`, which has unclear semantics and is deprecated + --> PYI057.pyi:8:4 | 6 | from foo import ByteString 7 | @@ -30,8 +33,9 @@ error[PYI057]: PYI057.pyi:8:4: Do not use `typing.ByteString`, which has unclear 9 | b: collections.abc.ByteString 10 | c: foo.ByteString | -error[PYI057]: PYI057.pyi:9:4: Do not use `collections.abc.ByteString`, which has unclear semantics and is deprecated +error[PYI057]: 9:4: Do not use `collections.abc.ByteString`, which has unclear semantics and is deprecated + --> PYI057.pyi:9:4 | 8 | a: typing.ByteString 9 | b: collections.abc.ByteString diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI058_PYI058.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI058_PYI058.py.snap index 9d6a5d1564..863fe867e1 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI058_PYI058.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI058_PYI058.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI058]: PYI058.py:5:13: [*] Use `Iterator` as the return value for simple `__iter__` methods +error[PYI058]: 5:13: [*] Use `Iterator` as the return value for simple `__iter__` methods + --> PYI058.py:5:13 | 4 | class IteratorReturningSimpleGenerator1: 5 | def __iter__(self) -> Generator: @@ -22,8 +23,9 @@ error[PYI058]: PYI058.py:5:13: [*] Use `Iterator` as the return value for simple 7 8 | 8 9 | -error[PYI058]: PYI058.py:13:13: [*] Use `Iterator` as the return value for simple `__iter__` methods +error[PYI058]: 13:13: [*] Use `Iterator` as the return value for simple `__iter__` methods + --> PYI058.py:13:13 | 12 | class IteratorReturningSimpleGenerator2: 13 | def __iter__(self) -> typing.Generator: @@ -41,8 +43,9 @@ error[PYI058]: PYI058.py:13:13: [*] Use `Iterator` as the return value for simpl 15 15 | 16 16 | -error[PYI058]: PYI058.py:21:13: [*] Use `Iterator` as the return value for simple `__iter__` methods +error[PYI058]: 21:13: [*] Use `Iterator` as the return value for simple `__iter__` methods + --> PYI058.py:21:13 | 20 | class IteratorReturningSimpleGenerator3: 21 | def __iter__(self) -> collections.abc.Generator: @@ -60,8 +63,9 @@ error[PYI058]: PYI058.py:21:13: [*] Use `Iterator` as the return value for simpl 23 23 | 24 24 | -error[PYI058]: PYI058.py:30:13: [*] Use `Iterator` as the return value for simple `__iter__` methods +error[PYI058]: 30:13: [*] Use `Iterator` as the return value for simple `__iter__` methods + --> PYI058.py:30:13 | 29 | class IteratorReturningSimpleGenerator4: 30 | def __iter__(self, /) -> collections.abc.Generator[str, Any, None]: @@ -79,8 +83,9 @@ error[PYI058]: PYI058.py:30:13: [*] Use `Iterator` as the return value for simpl 32 32 | 33 33 | -error[PYI058]: PYI058.py:39:13: [*] Use `Iterator` as the return value for simple `__iter__` methods +error[PYI058]: 39:13: [*] Use `Iterator` as the return value for simple `__iter__` methods + --> PYI058.py:39:13 | 38 | class IteratorReturningSimpleGenerator5: 39 | def __iter__(self, /) -> collections.abc.Generator[str, None, typing.Any]: @@ -98,8 +103,9 @@ error[PYI058]: PYI058.py:39:13: [*] Use `Iterator` as the return value for simpl 41 41 | 42 42 | -error[PYI058]: PYI058.py:47:13: [*] Use `Iterator` as the return value for simple `__iter__` methods +error[PYI058]: 47:13: [*] Use `Iterator` as the return value for simple `__iter__` methods + --> PYI058.py:47:13 | 46 | class IteratorReturningSimpleGenerator6: 47 | def __iter__(self, /) -> Generator[str, None, None]: @@ -122,8 +128,9 @@ error[PYI058]: PYI058.py:47:13: [*] Use `Iterator` as the return value for simpl 49 50 | 50 51 | -error[PYI058]: PYI058.py:55:13: [*] Use `AsyncIterator` as the return value for simple `__aiter__` methods +error[PYI058]: 55:13: [*] Use `AsyncIterator` as the return value for simple `__aiter__` methods + --> PYI058.py:55:13 | 54 | class AsyncIteratorReturningSimpleAsyncGenerator1: 55 | def __aiter__( @@ -142,8 +149,9 @@ error[PYI058]: PYI058.py:55:13: [*] Use `AsyncIterator` as the return value for 59 59 | 60 60 | -error[PYI058]: PYI058.py:73:13: [*] Use `AsyncIterator` as the return value for simple `__aiter__` methods +error[PYI058]: 73:13: [*] Use `AsyncIterator` as the return value for simple `__aiter__` methods + --> PYI058.py:73:13 | 72 | class AsyncIteratorReturningSimpleAsyncGenerator3: 73 | def __aiter__(self, /) -> collections.abc.AsyncGenerator[str, None]: diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI058_PYI058.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI058_PYI058.pyi.snap index 59d7182674..639918ac86 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI058_PYI058.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI058_PYI058.pyi.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI058]: PYI058.pyi:5:13: [*] Use `Iterator` as the return value for simple `__iter__` methods +error[PYI058]: 5:13: [*] Use `Iterator` as the return value for simple `__iter__` methods + --> PYI058.pyi:5:13 | 4 | class IteratorReturningSimpleGenerator1: 5 | def __iter__(self) -> Generator: ... # PYI058 (use `Iterator`) @@ -23,8 +24,9 @@ error[PYI058]: PYI058.pyi:5:13: [*] Use `Iterator` as the return value for simpl 7 8 | def scope(): 8 9 | import typing -error[PYI058]: PYI058.pyi:11:13: [*] Use `Iterator` as the return value for simple `__iter__` methods +error[PYI058]: 11:13: [*] Use `Iterator` as the return value for simple `__iter__` methods + --> PYI058.pyi:11:13 | 10 | class IteratorReturningSimpleGenerator2: 11 | def __iter__(self) -> typing.Generator: ... # PYI058 (use `Iterator`) @@ -43,8 +45,9 @@ error[PYI058]: PYI058.pyi:11:13: [*] Use `Iterator` as the return value for simp 13 13 | def scope(): 14 14 | import collections.abc -error[PYI058]: PYI058.pyi:17:13: [*] Use `Iterator` as the return value for simple `__iter__` methods +error[PYI058]: 17:13: [*] Use `Iterator` as the return value for simple `__iter__` methods + --> PYI058.pyi:17:13 | 16 | class IteratorReturningSimpleGenerator3: 17 | def __iter__(self) -> collections.abc.Generator: ... # PYI058 (use `Iterator`) @@ -63,8 +66,9 @@ error[PYI058]: PYI058.pyi:17:13: [*] Use `Iterator` as the return value for simp 19 19 | def scope(): 20 20 | import collections.abc -error[PYI058]: PYI058.pyi:24:13: [*] Use `Iterator` as the return value for simple `__iter__` methods +error[PYI058]: 24:13: [*] Use `Iterator` as the return value for simple `__iter__` methods + --> PYI058.pyi:24:13 | 23 | class IteratorReturningSimpleGenerator4: 24 | def __iter__(self, /) -> collections.abc.Generator[str, Any, None]: ... # PYI058 (use `Iterator`) @@ -83,8 +87,9 @@ error[PYI058]: PYI058.pyi:24:13: [*] Use `Iterator` as the return value for simp 26 26 | def scope(): 27 27 | import collections.abc -error[PYI058]: PYI058.pyi:31:13: [*] Use `Iterator` as the return value for simple `__iter__` methods +error[PYI058]: 31:13: [*] Use `Iterator` as the return value for simple `__iter__` methods + --> PYI058.pyi:31:13 | 30 | class IteratorReturningSimpleGenerator5: 31 | def __iter__(self, /) -> collections.abc.Generator[str, None, typing.Any]: ... # PYI058 (use `Iterator`) @@ -103,8 +108,9 @@ error[PYI058]: PYI058.pyi:31:13: [*] Use `Iterator` as the return value for simp 33 33 | def scope(): 34 34 | from collections.abc import Generator -error[PYI058]: PYI058.pyi:37:13: [*] Use `Iterator` as the return value for simple `__iter__` methods +error[PYI058]: 37:13: [*] Use `Iterator` as the return value for simple `__iter__` methods + --> PYI058.pyi:37:13 | 36 | class IteratorReturningSimpleGenerator6: 37 | def __iter__(self, /) -> Generator[str, None, None]: ... # PYI058 (use `Iterator`) @@ -128,8 +134,9 @@ error[PYI058]: PYI058.pyi:37:13: [*] Use `Iterator` as the return value for simp 39 40 | def scope(): 40 41 | import typing_extensions -error[PYI058]: PYI058.pyi:43:13: [*] Use `AsyncIterator` as the return value for simple `__aiter__` methods +error[PYI058]: 43:13: [*] Use `AsyncIterator` as the return value for simple `__aiter__` methods + --> PYI058.pyi:43:13 | 42 | class AsyncIteratorReturningSimpleAsyncGenerator1: 43 | def __aiter__(self,) -> typing_extensions.AsyncGenerator: ... # PYI058 (Use `AsyncIterator`) @@ -148,8 +155,9 @@ error[PYI058]: PYI058.pyi:43:13: [*] Use `AsyncIterator` as the return value for 45 45 | def scope(): 46 46 | import collections.abc -error[PYI058]: PYI058.pyi:49:13: [*] Use `AsyncIterator` as the return value for simple `__aiter__` methods +error[PYI058]: 49:13: [*] Use `AsyncIterator` as the return value for simple `__aiter__` methods + --> PYI058.pyi:49:13 | 48 | class AsyncIteratorReturningSimpleAsyncGenerator3: 49 | def __aiter__(self, /) -> collections.abc.AsyncGenerator[str, None]: @@ -167,8 +175,9 @@ error[PYI058]: PYI058.pyi:49:13: [*] Use `AsyncIterator` as the return value for 51 51 | 52 52 | def scope(): -error[PYI058]: PYI058.pyi:56:13: [*] Use `AsyncIterator` as the return value for simple `__aiter__` methods +error[PYI058]: 56:13: [*] Use `AsyncIterator` as the return value for simple `__aiter__` methods + --> PYI058.pyi:56:13 | 55 | class AsyncIteratorReturningSimpleAsyncGenerator3: 56 | def __aiter__(self, /) -> collections.abc.AsyncGenerator[str, None]: ... # PYI058 (Use `AsyncIterator`) diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI059_PYI059.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI059_PYI059.py.snap index 6f33bf66d1..89c849a58e 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI059_PYI059.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI059_PYI059.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI059]: PYI059.py:8:17: [*] `Generic[]` should always be the last base class +error[PYI059]: 8:17: [*] `Generic[]` should always be the last base class + --> PYI059.py:8:17 | 6 | V = TypeVar('V') 7 | @@ -22,8 +23,9 @@ error[PYI059]: PYI059.py:8:17: [*] `Generic[]` should always be the last base cl 10 10 | self._items: List[T] = [] 11 11 | -error[PYI059]: PYI059.py:15:16: [*] `Generic[]` should always be the last base class +error[PYI059]: 15:16: [*] `Generic[]` should always be the last base class + --> PYI059.py:15:16 | 13 | self._items.append(item) 14 | @@ -49,8 +51,9 @@ error[PYI059]: PYI059.py:15:16: [*] `Generic[]` should always be the last base c 20 19 | ... 21 20 | -error[PYI059]: PYI059.py:26:10: [*] `Generic[]` should always be the last base class +error[PYI059]: 26:10: [*] `Generic[]` should always be the last base class + --> PYI059.py:26:10 | 24 | # to flag this issue in this case as well, since after fixing the error 25 | # the Generic's position issue persists. @@ -69,8 +72,9 @@ error[PYI059]: PYI059.py:26:10: [*] `Generic[]` should always be the last base c 28 28 | 29 29 | -error[PYI059]: PYI059.py:30:10: [*] `Generic[]` should always be the last base class +error[PYI059]: 30:10: [*] `Generic[]` should always be the last base class + --> PYI059.py:30:10 | 30 | class Foo( # comment about the bracket | __________^ @@ -104,8 +108,9 @@ error[PYI059]: PYI059.py:30:10: [*] `Generic[]` should always be the last base c 40 38 | ): # and another one for good measure 41 39 | ... -error[PYI059]: PYI059.py:45:8: `Generic[]` should always be the last base class +error[PYI059]: 45:8: `Generic[]` should always be the last base class + --> PYI059.py:45:8 | 44 | # in case of multiple Generic[] inheritance, don't fix it. 45 | class C(Generic[T], Generic[K, V]): ... # PYI059 diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI059_PYI059.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI059_PYI059.pyi.snap index 66374e77ea..2989fca4ec 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI059_PYI059.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI059_PYI059.pyi.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI059]: PYI059.pyi:8:17: [*] `Generic[]` should always be the last base class +error[PYI059]: 8:17: [*] `Generic[]` should always be the last base class + --> PYI059.pyi:8:17 | 6 | V = TypeVar('V') 7 | @@ -22,8 +23,9 @@ error[PYI059]: PYI059.pyi:8:17: [*] `Generic[]` should always be the last base c 10 10 | def push(self, item: T) -> None: ... 11 11 | -error[PYI059]: PYI059.pyi:12:16: [*] `Generic[]` should always be the last base class +error[PYI059]: 12:16: [*] `Generic[]` should always be the last base class + --> PYI059.pyi:12:16 | 10 | def push(self, item: T) -> None: ... 11 | @@ -49,8 +51,9 @@ error[PYI059]: PYI059.pyi:12:16: [*] `Generic[]` should always be the last base 17 16 | ... 18 17 | -error[PYI059]: PYI059.pyi:22:10: [*] `Generic[]` should always be the last base class +error[PYI059]: 22:10: [*] `Generic[]` should always be the last base class + --> PYI059.pyi:22:10 | 20 | # to flag this issue in this case as well, since after fixing the error 21 | # the Generic's position issue persists. @@ -68,8 +71,9 @@ error[PYI059]: PYI059.pyi:22:10: [*] `Generic[]` should always be the last base 24 24 | 25 25 | class Foo( # comment about the bracket -error[PYI059]: PYI059.pyi:25:10: [*] `Generic[]` should always be the last base class +error[PYI059]: 25:10: [*] `Generic[]` should always be the last base class + --> PYI059.pyi:25:10 | 25 | class Foo( # comment about the bracket | __________^ @@ -103,8 +107,9 @@ error[PYI059]: PYI059.pyi:25:10: [*] `Generic[]` should always be the last base 35 33 | ): # and another one for good measure 36 34 | ... -error[PYI059]: PYI059.pyi:40:8: `Generic[]` should always be the last base class +error[PYI059]: 40:8: `Generic[]` should always be the last base class + --> PYI059.pyi:40:8 | 39 | # in case of multiple Generic[] inheritance, don't fix it. 40 | class C(Generic[T], Generic[K, V]): ... # PYI059 diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI062_PYI062.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI062_PYI062.py.snap index 2cab72db08..479f4bf947 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI062_PYI062.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI062_PYI062.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI062]: PYI062.py:5:25: Duplicate literal member `True` +error[PYI062]: 5:25: Duplicate literal member `True` + --> PYI062.py:5:25 | 3 | import typing_extensions 4 | @@ -11,8 +12,9 @@ error[PYI062]: PYI062.py:5:25: Duplicate literal member `True` 6 | 7 | y: Literal[1, print("hello"), 3, Literal[4, 1]] # PYI062 on the last 1 | -error[PYI062]: PYI062.py:5:31: Duplicate literal member `False` +error[PYI062]: 5:31: Duplicate literal member `False` + --> PYI062.py:5:31 | 3 | import typing_extensions 4 | @@ -21,8 +23,9 @@ error[PYI062]: PYI062.py:5:31: Duplicate literal member `False` 6 | 7 | y: Literal[1, print("hello"), 3, Literal[4, 1]] # PYI062 on the last 1 | -error[PYI062]: PYI062.py:7:45: Duplicate literal member `1` +error[PYI062]: 7:45: Duplicate literal member `1` + --> PYI062.py:7:45 | 5 | x: Literal[True, False, True, False] # PYI062 twice here 6 | @@ -31,8 +34,9 @@ error[PYI062]: PYI062.py:7:45: Duplicate literal member `1` 8 | 9 | z: Literal[{1, 3, 5}, "foobar", {1,3,5}] # PYI062 on the set literal | -error[PYI062]: PYI062.py:9:33: Duplicate literal member `{1, 3, 5}` +error[PYI062]: 9:33: Duplicate literal member `{1, 3, 5}` + --> PYI062.py:9:33 | 7 | y: Literal[1, print("hello"), 3, Literal[4, 1]] # PYI062 on the last 1 8 | @@ -41,8 +45,9 @@ error[PYI062]: PYI062.py:9:33: Duplicate literal member `{1, 3, 5}` 10 | 11 | Literal[1, Literal[1]] # once | -error[PYI062]: PYI062.py:11:20: Duplicate literal member `1` +error[PYI062]: 11:20: Duplicate literal member `1` + --> PYI062.py:11:20 | 9 | z: Literal[{1, 3, 5}, "foobar", {1,3,5}] # PYI062 on the set literal 10 | @@ -51,8 +56,9 @@ error[PYI062]: PYI062.py:11:20: Duplicate literal member `1` 12 | Literal[1, 2, Literal[1, 2]] # twice 13 | Literal[1, Literal[1], Literal[1]] # twice | -error[PYI062]: PYI062.py:12:23: Duplicate literal member `1` +error[PYI062]: 12:23: Duplicate literal member `1` + --> PYI062.py:12:23 | 11 | Literal[1, Literal[1]] # once 12 | Literal[1, 2, Literal[1, 2]] # twice @@ -60,8 +66,9 @@ error[PYI062]: PYI062.py:12:23: Duplicate literal member `1` 13 | Literal[1, Literal[1], Literal[1]] # twice 14 | Literal[1, Literal[2], Literal[2]] # once | -error[PYI062]: PYI062.py:12:26: Duplicate literal member `2` +error[PYI062]: 12:26: Duplicate literal member `2` + --> PYI062.py:12:26 | 11 | Literal[1, Literal[1]] # once 12 | Literal[1, 2, Literal[1, 2]] # twice @@ -69,8 +76,9 @@ error[PYI062]: PYI062.py:12:26: Duplicate literal member `2` 13 | Literal[1, Literal[1], Literal[1]] # twice 14 | Literal[1, Literal[2], Literal[2]] # once | -error[PYI062]: PYI062.py:13:20: Duplicate literal member `1` +error[PYI062]: 13:20: Duplicate literal member `1` + --> PYI062.py:13:20 | 11 | Literal[1, Literal[1]] # once 12 | Literal[1, 2, Literal[1, 2]] # twice @@ -79,8 +87,9 @@ error[PYI062]: PYI062.py:13:20: Duplicate literal member `1` 14 | Literal[1, Literal[2], Literal[2]] # once 15 | t.Literal[1, t.Literal[2, t.Literal[1]]] # once | -error[PYI062]: PYI062.py:13:32: Duplicate literal member `1` +error[PYI062]: 13:32: Duplicate literal member `1` + --> PYI062.py:13:32 | 11 | Literal[1, Literal[1]] # once 12 | Literal[1, 2, Literal[1, 2]] # twice @@ -89,8 +98,9 @@ error[PYI062]: PYI062.py:13:32: Duplicate literal member `1` 14 | Literal[1, Literal[2], Literal[2]] # once 15 | t.Literal[1, t.Literal[2, t.Literal[1]]] # once | -error[PYI062]: PYI062.py:14:32: Duplicate literal member `2` +error[PYI062]: 14:32: Duplicate literal member `2` + --> PYI062.py:14:32 | 12 | Literal[1, 2, Literal[1, 2]] # twice 13 | Literal[1, Literal[1], Literal[1]] # twice @@ -99,8 +109,9 @@ error[PYI062]: PYI062.py:14:32: Duplicate literal member `2` 15 | t.Literal[1, t.Literal[2, t.Literal[1]]] # once 16 | typing_extensions.Literal[1, 1, 1] # twice | -error[PYI062]: PYI062.py:15:37: Duplicate literal member `1` +error[PYI062]: 15:37: Duplicate literal member `1` + --> PYI062.py:15:37 | 13 | Literal[1, Literal[1], Literal[1]] # twice 14 | Literal[1, Literal[2], Literal[2]] # once @@ -108,8 +119,9 @@ error[PYI062]: PYI062.py:15:37: Duplicate literal member `1` | ^ 16 | typing_extensions.Literal[1, 1, 1] # twice | -error[PYI062]: PYI062.py:16:30: Duplicate literal member `1` +error[PYI062]: 16:30: Duplicate literal member `1` + --> PYI062.py:16:30 | 14 | Literal[1, Literal[2], Literal[2]] # once 15 | t.Literal[1, t.Literal[2, t.Literal[1]]] # once @@ -118,8 +130,9 @@ error[PYI062]: PYI062.py:16:30: Duplicate literal member `1` 17 | 18 | # Ensure issue is only raised once, even on nested literals | -error[PYI062]: PYI062.py:16:33: Duplicate literal member `1` +error[PYI062]: 16:33: Duplicate literal member `1` + --> PYI062.py:16:33 | 14 | Literal[1, Literal[2], Literal[2]] # once 15 | t.Literal[1, t.Literal[2, t.Literal[1]]] # once @@ -128,8 +141,9 @@ error[PYI062]: PYI062.py:16:33: Duplicate literal member `1` 17 | 18 | # Ensure issue is only raised once, even on nested literals | -error[PYI062]: PYI062.py:19:46: Duplicate literal member `True` +error[PYI062]: 19:46: Duplicate literal member `True` + --> PYI062.py:19:46 | 18 | # Ensure issue is only raised once, even on nested literals 19 | MyType = Literal["foo", Literal[True, False, True], "bar"] # PYI062 diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI062_PYI062.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI062_PYI062.pyi.snap index 44a6a07e0c..8c1fa04a22 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI062_PYI062.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI062_PYI062.pyi.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI062]: PYI062.pyi:5:25: Duplicate literal member `True` +error[PYI062]: 5:25: Duplicate literal member `True` + --> PYI062.pyi:5:25 | 3 | import typing_extensions 4 | @@ -11,8 +12,9 @@ error[PYI062]: PYI062.pyi:5:25: Duplicate literal member `True` 6 | 7 | y: Literal[1, print("hello"), 3, Literal[4, 1]] # PY062 on the last 1 | -error[PYI062]: PYI062.pyi:5:31: Duplicate literal member `False` +error[PYI062]: 5:31: Duplicate literal member `False` + --> PYI062.pyi:5:31 | 3 | import typing_extensions 4 | @@ -21,8 +23,9 @@ error[PYI062]: PYI062.pyi:5:31: Duplicate literal member `False` 6 | 7 | y: Literal[1, print("hello"), 3, Literal[4, 1]] # PY062 on the last 1 | -error[PYI062]: PYI062.pyi:7:45: Duplicate literal member `1` +error[PYI062]: 7:45: Duplicate literal member `1` + --> PYI062.pyi:7:45 | 5 | x: Literal[True, False, True, False] # PY062 twice here 6 | @@ -31,8 +34,9 @@ error[PYI062]: PYI062.pyi:7:45: Duplicate literal member `1` 8 | 9 | z: Literal[{1, 3, 5}, "foobar", {1,3,5}] # PY062 on the set literal | -error[PYI062]: PYI062.pyi:9:33: Duplicate literal member `{1, 3, 5}` +error[PYI062]: 9:33: Duplicate literal member `{1, 3, 5}` + --> PYI062.pyi:9:33 | 7 | y: Literal[1, print("hello"), 3, Literal[4, 1]] # PY062 on the last 1 8 | @@ -41,8 +45,9 @@ error[PYI062]: PYI062.pyi:9:33: Duplicate literal member `{1, 3, 5}` 10 | 11 | Literal[1, Literal[1]] # once | -error[PYI062]: PYI062.pyi:11:20: Duplicate literal member `1` +error[PYI062]: 11:20: Duplicate literal member `1` + --> PYI062.pyi:11:20 | 9 | z: Literal[{1, 3, 5}, "foobar", {1,3,5}] # PY062 on the set literal 10 | @@ -51,8 +56,9 @@ error[PYI062]: PYI062.pyi:11:20: Duplicate literal member `1` 12 | Literal[1, 2, Literal[1, 2]] # twice 13 | Literal[1, Literal[1], Literal[1]] # twice | -error[PYI062]: PYI062.pyi:12:23: Duplicate literal member `1` +error[PYI062]: 12:23: Duplicate literal member `1` + --> PYI062.pyi:12:23 | 11 | Literal[1, Literal[1]] # once 12 | Literal[1, 2, Literal[1, 2]] # twice @@ -60,8 +66,9 @@ error[PYI062]: PYI062.pyi:12:23: Duplicate literal member `1` 13 | Literal[1, Literal[1], Literal[1]] # twice 14 | Literal[1, Literal[2], Literal[2]] # once | -error[PYI062]: PYI062.pyi:12:26: Duplicate literal member `2` +error[PYI062]: 12:26: Duplicate literal member `2` + --> PYI062.pyi:12:26 | 11 | Literal[1, Literal[1]] # once 12 | Literal[1, 2, Literal[1, 2]] # twice @@ -69,8 +76,9 @@ error[PYI062]: PYI062.pyi:12:26: Duplicate literal member `2` 13 | Literal[1, Literal[1], Literal[1]] # twice 14 | Literal[1, Literal[2], Literal[2]] # once | -error[PYI062]: PYI062.pyi:13:20: Duplicate literal member `1` +error[PYI062]: 13:20: Duplicate literal member `1` + --> PYI062.pyi:13:20 | 11 | Literal[1, Literal[1]] # once 12 | Literal[1, 2, Literal[1, 2]] # twice @@ -79,8 +87,9 @@ error[PYI062]: PYI062.pyi:13:20: Duplicate literal member `1` 14 | Literal[1, Literal[2], Literal[2]] # once 15 | t.Literal[1, t.Literal[2, t.Literal[1]]] # once | -error[PYI062]: PYI062.pyi:13:32: Duplicate literal member `1` +error[PYI062]: 13:32: Duplicate literal member `1` + --> PYI062.pyi:13:32 | 11 | Literal[1, Literal[1]] # once 12 | Literal[1, 2, Literal[1, 2]] # twice @@ -89,8 +98,9 @@ error[PYI062]: PYI062.pyi:13:32: Duplicate literal member `1` 14 | Literal[1, Literal[2], Literal[2]] # once 15 | t.Literal[1, t.Literal[2, t.Literal[1]]] # once | -error[PYI062]: PYI062.pyi:14:32: Duplicate literal member `2` +error[PYI062]: 14:32: Duplicate literal member `2` + --> PYI062.pyi:14:32 | 12 | Literal[1, 2, Literal[1, 2]] # twice 13 | Literal[1, Literal[1], Literal[1]] # twice @@ -99,8 +109,9 @@ error[PYI062]: PYI062.pyi:14:32: Duplicate literal member `2` 15 | t.Literal[1, t.Literal[2, t.Literal[1]]] # once 16 | typing_extensions.Literal[1, 1, 1] # twice | -error[PYI062]: PYI062.pyi:15:37: Duplicate literal member `1` +error[PYI062]: 15:37: Duplicate literal member `1` + --> PYI062.pyi:15:37 | 13 | Literal[1, Literal[1], Literal[1]] # twice 14 | Literal[1, Literal[2], Literal[2]] # once @@ -108,8 +119,9 @@ error[PYI062]: PYI062.pyi:15:37: Duplicate literal member `1` | ^ 16 | typing_extensions.Literal[1, 1, 1] # twice | -error[PYI062]: PYI062.pyi:16:30: Duplicate literal member `1` +error[PYI062]: 16:30: Duplicate literal member `1` + --> PYI062.pyi:16:30 | 14 | Literal[1, Literal[2], Literal[2]] # once 15 | t.Literal[1, t.Literal[2, t.Literal[1]]] # once @@ -118,8 +130,9 @@ error[PYI062]: PYI062.pyi:16:30: Duplicate literal member `1` 17 | 18 | # Ensure issue is only raised once, even on nested literals | -error[PYI062]: PYI062.pyi:16:33: Duplicate literal member `1` +error[PYI062]: 16:33: Duplicate literal member `1` + --> PYI062.pyi:16:33 | 14 | Literal[1, Literal[2], Literal[2]] # once 15 | t.Literal[1, t.Literal[2, t.Literal[1]]] # once @@ -128,8 +141,9 @@ error[PYI062]: PYI062.pyi:16:33: Duplicate literal member `1` 17 | 18 | # Ensure issue is only raised once, even on nested literals | -error[PYI062]: PYI062.pyi:19:46: Duplicate literal member `True` +error[PYI062]: 19:46: Duplicate literal member `True` + --> PYI062.pyi:19:46 | 18 | # Ensure issue is only raised once, even on nested literals 19 | MyType = Literal["foo", Literal[True, False, True], "bar"] # PYI062 diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI063_PYI063.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI063_PYI063.py.snap index 030bdd99cf..06b1b19a4c 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI063_PYI063.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI063_PYI063.py.snap @@ -1,109 +1,120 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -PYI063.py:6:9: PYI063 Use PEP 570 syntax for positional-only arguments +error[PYI063]: 6:9: Use PEP 570 syntax for positional-only arguments + + --> PYI063.py:6:9 | 4 | from typing import Self 5 | 6 | def bad(__x: int) -> None: ... # PYI063 - | ^^^ PYI063 + | ^^^ 7 | def also_bad(__x: int, __y: str) -> None: ... # PYI063 8 | def still_bad(__x_: int) -> None: ... # PYI063 | = help: Add `/` to function signature +error[PYI063]: 7:14: Use PEP 570 syntax for positional-only arguments -PYI063.py:7:14: PYI063 Use PEP 570 syntax for positional-only arguments + --> PYI063.py:7:14 | 6 | def bad(__x: int) -> None: ... # PYI063 7 | def also_bad(__x: int, __y: str) -> None: ... # PYI063 - | ^^^ PYI063 + | ^^^ 8 | def still_bad(__x_: int) -> None: ... # PYI063 | = help: Add `/` to function signature +error[PYI063]: 8:15: Use PEP 570 syntax for positional-only arguments -PYI063.py:8:15: PYI063 Use PEP 570 syntax for positional-only arguments + --> PYI063.py:8:15 | 6 | def bad(__x: int) -> None: ... # PYI063 7 | def also_bad(__x: int, __y: str) -> None: ... # PYI063 8 | def still_bad(__x_: int) -> None: ... # PYI063 - | ^^^^ PYI063 + | ^^^^ 9 | 10 | def no_args() -> None: ... | = help: Add `/` to function signature +error[PYI063]: 24:14: Use PEP 570 syntax for positional-only arguments -PYI063.py:24:14: PYI063 Use PEP 570 syntax for positional-only arguments + --> PYI063.py:24:14 | 22 | def bad(__self) -> None: ... # PYI063 23 | @staticmethod 24 | def bad2(__self) -> None: ... # PYI063 - | ^^^^^^ PYI063 + | ^^^^^^ 25 | def bad3(__self, __x: int) -> None: ... # PYI063 26 | def still_bad(self, __x_: int) -> None: ... # PYI063 | = help: Add `/` to function signature +error[PYI063]: 25:22: Use PEP 570 syntax for positional-only arguments -PYI063.py:25:22: PYI063 Use PEP 570 syntax for positional-only arguments + --> PYI063.py:25:22 | 23 | @staticmethod 24 | def bad2(__self) -> None: ... # PYI063 25 | def bad3(__self, __x: int) -> None: ... # PYI063 - | ^^^ PYI063 + | ^^^ 26 | def still_bad(self, __x_: int) -> None: ... # PYI063 27 | @staticmethod | = help: Add `/` to function signature +error[PYI063]: 26:25: Use PEP 570 syntax for positional-only arguments -PYI063.py:26:25: PYI063 Use PEP 570 syntax for positional-only arguments + --> PYI063.py:26:25 | 24 | def bad2(__self) -> None: ... # PYI063 25 | def bad3(__self, __x: int) -> None: ... # PYI063 26 | def still_bad(self, __x_: int) -> None: ... # PYI063 - | ^^^^ PYI063 + | ^^^^ 27 | @staticmethod 28 | def this_is_bad_too(__x: int) -> None: ... # PYI063 | = help: Add `/` to function signature +error[PYI063]: 28:25: Use PEP 570 syntax for positional-only arguments -PYI063.py:28:25: PYI063 Use PEP 570 syntax for positional-only arguments + --> PYI063.py:28:25 | 26 | def still_bad(self, __x_: int) -> None: ... # PYI063 27 | @staticmethod 28 | def this_is_bad_too(__x: int) -> None: ... # PYI063 - | ^^^ PYI063 + | ^^^ 29 | @classmethod 30 | def not_good(cls, __foo: int) -> None: ... # PYI063 | = help: Add `/` to function signature +error[PYI063]: 30:23: Use PEP 570 syntax for positional-only arguments -PYI063.py:30:23: PYI063 Use PEP 570 syntax for positional-only arguments + --> PYI063.py:30:23 | 28 | def this_is_bad_too(__x: int) -> None: ... # PYI063 29 | @classmethod 30 | def not_good(cls, __foo: int) -> None: ... # PYI063 - | ^^^^^ PYI063 + | ^^^^^ 31 | 32 | # The first non-self argument isn't positional-only, so logically the second can't be either: | = help: Add `/` to function signature +error[PYI063]: 52:23: Use PEP 570 syntax for positional-only arguments -PYI063.py:52:23: PYI063 Use PEP 570 syntax for positional-only arguments + --> PYI063.py:52:23 | 50 | class Metaclass(type): 51 | @classmethod 52 | def __new__(mcls, __name: str, __bases: tuple[type, ...], __namespace: dict, **kwds) -> Self: ... # PYI063 - | ^^^^^^ PYI063 + | ^^^^^^ 53 | 54 | class Metaclass2(type): | = help: Add `/` to function signature +error[PYI063]: 56:26: Use PEP 570 syntax for positional-only arguments -PYI063.py:56:26: PYI063 Use PEP 570 syntax for positional-only arguments + --> PYI063.py:56:26 | 54 | class Metaclass2(type): 55 | @classmethod 56 | def __new__(metacls, __name: str, __bases: tuple[type, ...], __namespace: dict, **kwds) -> Self: ... # PYI063 - | ^^^^^^ PYI063 + | ^^^^^^ 57 | 58 | class GoodMetaclass(type): | diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI063_PYI063.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI063_PYI063.pyi.snap index 8a943194f3..ac95e9ce86 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI063_PYI063.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI063_PYI063.pyi.snap @@ -1,109 +1,120 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -PYI063.pyi:6:9: PYI063 Use PEP 570 syntax for positional-only arguments +error[PYI063]: 6:9: Use PEP 570 syntax for positional-only arguments + + --> PYI063.pyi:6:9 | 4 | from typing import Self 5 | 6 | def bad(__x: int) -> None: ... # PYI063 - | ^^^ PYI063 + | ^^^ 7 | def also_bad(__x: int, __y: str) -> None: ... # PYI063 8 | def still_bad(__x_: int) -> None: ... # PYI063 | = help: Add `/` to function signature +error[PYI063]: 7:14: Use PEP 570 syntax for positional-only arguments -PYI063.pyi:7:14: PYI063 Use PEP 570 syntax for positional-only arguments + --> PYI063.pyi:7:14 | 6 | def bad(__x: int) -> None: ... # PYI063 7 | def also_bad(__x: int, __y: str) -> None: ... # PYI063 - | ^^^ PYI063 + | ^^^ 8 | def still_bad(__x_: int) -> None: ... # PYI063 | = help: Add `/` to function signature +error[PYI063]: 8:15: Use PEP 570 syntax for positional-only arguments -PYI063.pyi:8:15: PYI063 Use PEP 570 syntax for positional-only arguments + --> PYI063.pyi:8:15 | 6 | def bad(__x: int) -> None: ... # PYI063 7 | def also_bad(__x: int, __y: str) -> None: ... # PYI063 8 | def still_bad(__x_: int) -> None: ... # PYI063 - | ^^^^ PYI063 + | ^^^^ 9 | 10 | def no_args() -> None: ... | = help: Add `/` to function signature +error[PYI063]: 24:14: Use PEP 570 syntax for positional-only arguments -PYI063.pyi:24:14: PYI063 Use PEP 570 syntax for positional-only arguments + --> PYI063.pyi:24:14 | 22 | def bad(__self) -> None: ... # PYI063 23 | @staticmethod 24 | def bad2(__self) -> None: ... # PYI063 - | ^^^^^^ PYI063 + | ^^^^^^ 25 | def bad3(__self, __x: int) -> None: ... # PYI063 26 | def still_bad(self, __x_: int) -> None: ... # PYI063 # TODO: doesn't get raised here | = help: Add `/` to function signature +error[PYI063]: 25:22: Use PEP 570 syntax for positional-only arguments -PYI063.pyi:25:22: PYI063 Use PEP 570 syntax for positional-only arguments + --> PYI063.pyi:25:22 | 23 | @staticmethod 24 | def bad2(__self) -> None: ... # PYI063 25 | def bad3(__self, __x: int) -> None: ... # PYI063 - | ^^^ PYI063 + | ^^^ 26 | def still_bad(self, __x_: int) -> None: ... # PYI063 # TODO: doesn't get raised here 27 | @staticmethod | = help: Add `/` to function signature +error[PYI063]: 26:25: Use PEP 570 syntax for positional-only arguments -PYI063.pyi:26:25: PYI063 Use PEP 570 syntax for positional-only arguments + --> PYI063.pyi:26:25 | 24 | def bad2(__self) -> None: ... # PYI063 25 | def bad3(__self, __x: int) -> None: ... # PYI063 26 | def still_bad(self, __x_: int) -> None: ... # PYI063 # TODO: doesn't get raised here - | ^^^^ PYI063 + | ^^^^ 27 | @staticmethod 28 | def this_is_bad_too(__x: int) -> None: ... # PYI063 | = help: Add `/` to function signature +error[PYI063]: 28:25: Use PEP 570 syntax for positional-only arguments -PYI063.pyi:28:25: PYI063 Use PEP 570 syntax for positional-only arguments + --> PYI063.pyi:28:25 | 26 | def still_bad(self, __x_: int) -> None: ... # PYI063 # TODO: doesn't get raised here 27 | @staticmethod 28 | def this_is_bad_too(__x: int) -> None: ... # PYI063 - | ^^^ PYI063 + | ^^^ 29 | @classmethod 30 | def not_good(cls, __foo: int) -> None: ... # PYI063 | = help: Add `/` to function signature +error[PYI063]: 30:23: Use PEP 570 syntax for positional-only arguments -PYI063.pyi:30:23: PYI063 Use PEP 570 syntax for positional-only arguments + --> PYI063.pyi:30:23 | 28 | def this_is_bad_too(__x: int) -> None: ... # PYI063 29 | @classmethod 30 | def not_good(cls, __foo: int) -> None: ... # PYI063 - | ^^^^^ PYI063 + | ^^^^^ 31 | 32 | # The first non-self argument isn't positional-only, so logically the second can't be either: | = help: Add `/` to function signature +error[PYI063]: 52:23: Use PEP 570 syntax for positional-only arguments -PYI063.pyi:52:23: PYI063 Use PEP 570 syntax for positional-only arguments + --> PYI063.pyi:52:23 | 50 | class Metaclass(type): 51 | @classmethod 52 | def __new__(mcls, __name: str, __bases: tuple[type, ...], __namespace: dict, **kwds) -> Self: ... # PYI063 - | ^^^^^^ PYI063 + | ^^^^^^ 53 | 54 | class Metaclass2(type): | = help: Add `/` to function signature +error[PYI063]: 56:26: Use PEP 570 syntax for positional-only arguments -PYI063.pyi:56:26: PYI063 Use PEP 570 syntax for positional-only arguments + --> PYI063.pyi:56:26 | 54 | class Metaclass2(type): 55 | @classmethod 56 | def __new__(metacls, __name: str, __bases: tuple[type, ...], __namespace: dict, **kwds) -> Self: ... # PYI063 - | ^^^^^^ PYI063 + | ^^^^^^ 57 | 58 | class GoodMetaclass(type): | diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI064_PYI064.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI064_PYI064.py.snap index 4fd97ec0a4..d1410baf3d 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI064_PYI064.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI064_PYI064.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI064]: PYI064.py:3:1: [*] `Final[Literal[True]]` can be replaced with a bare `Final` +error[PYI064]: 3:1: [*] `Final[Literal[True]]` can be replaced with a bare `Final` + --> PYI064.py:2:1 | 1 | from typing import Final, Literal 2 | @@ -21,8 +22,9 @@ error[PYI064]: PYI064.py:3:1: [*] `Final[Literal[True]]` can be replaced with a 5 5 | z: Final[Literal[ # PYI064 6 6 | "this is a really long literal, that won't be rendered in the issue text" -error[PYI064]: PYI064.py:4:1: [*] `Final[Literal[None]]` can be replaced with a bare `Final` +error[PYI064]: 4:1: [*] `Final[Literal[None]]` can be replaced with a bare `Final` + --> PYI064.py:3:41 | 3 | x: Final[Literal[True]] = True # PYI064 4 | y: Final[Literal[None]] = None # PYI064 @@ -41,8 +43,9 @@ error[PYI064]: PYI064.py:4:1: [*] `Final[Literal[None]]` can be replaced with a 6 6 | "this is a really long literal, that won't be rendered in the issue text" 7 7 | ]] = "this is a really long literal, that won't be rendered in the issue text" -error[PYI064]: PYI064.py:5:1: [*] `Final[Literal[...]]` can be replaced with a bare `Final` +error[PYI064]: 5:1: [*] `Final[Literal[...]]` can be replaced with a bare `Final` + --> PYI064.py:4:41 | 3 | x: Final[Literal[True]] = True # PYI064 4 | y: Final[Literal[None]] = None # PYI064 @@ -66,8 +69,9 @@ error[PYI064]: PYI064.py:5:1: [*] `Final[Literal[...]]` can be replaced with a b 9 7 | # This should be fixable, and marked as safe 10 8 | w1: Final[Literal[123]] # PYI064 -error[PYI064]: PYI064.py:10:1: [*] `Final[Literal[123]]` can be replaced with a bare `Final` +error[PYI064]: 10:1: [*] `Final[Literal[123]]` can be replaced with a bare `Final` + --> PYI064.py:9:45 | 9 | # This should be fixable, and marked as safe 10 | w1: Final[Literal[123]] # PYI064 @@ -86,8 +90,9 @@ error[PYI064]: PYI064.py:10:1: [*] `Final[Literal[123]]` can be replaced with a 12 12 | # This should not be fixable 13 13 | w2: Final[Literal[123]] = "random value" # PYI064 -error[PYI064]: PYI064.py:13:1: `Final[Literal[123]]` can be replaced with a bare `Final` +error[PYI064]: 13:1: `Final[Literal[123]]` can be replaced with a bare `Final` + --> PYI064.py:12:29 | 12 | # This should not be fixable 13 | w2: Final[Literal[123]] = "random value" # PYI064 diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI064_PYI064.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI064_PYI064.pyi.snap index 9216a99684..3c8279bd73 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI064_PYI064.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI064_PYI064.pyi.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI064]: PYI064.pyi:3:1: [*] `Final[Literal[True]]` can be replaced with a bare `Final` +error[PYI064]: 3:1: [*] `Final[Literal[True]]` can be replaced with a bare `Final` + --> PYI064.pyi:2:1 | 1 | from typing import Final, Literal 2 | @@ -21,8 +22,9 @@ error[PYI064]: PYI064.pyi:3:1: [*] `Final[Literal[True]]` can be replaced with a 5 5 | z: Final[Literal["this is a really long literal, that won't be rendered in the issue text"]] # PYI064 6 6 | -error[PYI064]: PYI064.pyi:4:1: [*] `Final[Literal[None]]` can be replaced with a bare `Final` +error[PYI064]: 4:1: [*] `Final[Literal[None]]` can be replaced with a bare `Final` + --> PYI064.pyi:3:34 | 3 | x: Final[Literal[True]] # PYI064 4 | y: Final[Literal[None]] = None # PYI064 @@ -40,8 +42,9 @@ error[PYI064]: PYI064.pyi:4:1: [*] `Final[Literal[None]]` can be replaced with a 6 6 | 7 7 | # This should be fixable, and marked as safe -error[PYI064]: PYI064.pyi:5:1: [*] `Final[Literal[...]]` can be replaced with a bare `Final` +error[PYI064]: 5:1: [*] `Final[Literal[...]]` can be replaced with a bare `Final` + --> PYI064.pyi:4:41 | 3 | x: Final[Literal[True]] # PYI064 4 | y: Final[Literal[None]] = None # PYI064 @@ -61,8 +64,9 @@ error[PYI064]: PYI064.pyi:5:1: [*] `Final[Literal[...]]` can be replaced with a 7 7 | # This should be fixable, and marked as safe 8 8 | w1: Final[Literal[123]] # PYI064 -error[PYI064]: PYI064.pyi:8:1: [*] `Final[Literal[123]]` can be replaced with a bare `Final` +error[PYI064]: 8:1: [*] `Final[Literal[123]]` can be replaced with a bare `Final` + --> PYI064.pyi:7:45 | 7 | # This should be fixable, and marked as safe 8 | w1: Final[Literal[123]] # PYI064 @@ -81,8 +85,9 @@ error[PYI064]: PYI064.pyi:8:1: [*] `Final[Literal[123]]` can be replaced with a 10 10 | # This should not be fixable 11 11 | w2: Final[Literal[123]] = "random value" # PYI064 -error[PYI064]: PYI064.pyi:11:1: `Final[Literal[123]]` can be replaced with a bare `Final` +error[PYI064]: 11:1: `Final[Literal[123]]` can be replaced with a bare `Final` + --> PYI064.pyi:10:29 | 10 | # This should not be fixable 11 | w2: Final[Literal[123]] = "random value" # PYI064 diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI066_PYI066.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI066_PYI066.pyi.snap index 2c4ec083cd..286df8f267 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI066_PYI066.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI066_PYI066.pyi.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI066]: PYI066.pyi:3:4: Use `>=` when using `if`-`else` with `sys.version_info` comparisons +error[PYI066]: 3:4: Use `>=` when using `if`-`else` with `sys.version_info` comparisons + --> PYI066.pyi:3:4 | 1 | import sys 2 | @@ -11,8 +12,9 @@ error[PYI066]: PYI066.pyi:3:4: Use `>=` when using `if`-`else` with `sys.version 4 | def foo(x): ... 5 | else: | -error[PYI066]: PYI066.pyi:8:4: Use `>=` when using `if`-`else` with `sys.version_info` comparisons +error[PYI066]: 8:4: Use `>=` when using `if`-`else` with `sys.version_info` comparisons + --> PYI066.pyi:8:4 | 6 | def foo(x, *, bar=True): ... 7 | @@ -21,8 +23,9 @@ error[PYI066]: PYI066.pyi:8:4: Use `>=` when using `if`-`else` with `sys.version 9 | def bar(x): ... 10 | elif sys.version_info < (3, 9): # Y066 When using if/else with sys.version_info, put the code for new Python versions first, e.g. "... | -error[PYI066]: PYI066.pyi:10:6: Use `>=` when using `if`-`else` with `sys.version_info` comparisons +error[PYI066]: 10:6: Use `>=` when using `if`-`else` with `sys.version_info` comparisons + --> PYI066.pyi:10:6 | 8 | if sys.version_info < (3, 8): # Y066 When using if/else with sys.version_info, put the code for new Python versions first, e.g. "if... 9 | def bar(x): ... @@ -31,8 +34,9 @@ error[PYI066]: PYI066.pyi:10:6: Use `>=` when using `if`-`else` with `sys.versio 11 | def bar(x, *, bar=True): ... 12 | elif sys.version_info < (3, 11): # Y066 When using if/else with sys.version_info, put the code for new Python versions first, e.g. ... | -error[PYI066]: PYI066.pyi:12:6: Use `>=` when using `if`-`else` with `sys.version_info` comparisons +error[PYI066]: 12:6: Use `>=` when using `if`-`else` with `sys.version_info` comparisons + --> PYI066.pyi:12:6 | 10 | elif sys.version_info < (3, 9): # Y066 When using if/else with sys.version_info, put the code for new Python versions first, e.g. "... 11 | def bar(x, *, bar=True): ... @@ -41,8 +45,9 @@ error[PYI066]: PYI066.pyi:12:6: Use `>=` when using `if`-`else` with `sys.versio 13 | def bar(x, *, bar=True, baz=False): ... 14 | else: | -error[PYI066]: PYI066.pyi:20:6: Use `>=` when using `if`-`else` with `sys.version_info` comparisons +error[PYI066]: 20:6: Use `>=` when using `if`-`else` with `sys.version_info` comparisons + --> PYI066.pyi:20:6 | 18 | if sys.version_info >= (3, 5): 19 | ... diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__preview__PYI044_PYI044.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__preview__PYI044_PYI044.pyi.snap index 5ddf8be331..e5b4ea8835 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__preview__PYI044_PYI044.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__preview__PYI044_PYI044.pyi.snap @@ -1,15 +1,16 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -PYI044.pyi:2:1: PYI044 [*] `from __future__ import annotations` has no effect in stub files, since type checkers automatically treat stubs as having those semantics +error[PYI044]: 2:1: [*] `from __future__ import annotations` has no effect in stub files, since type checkers automatically treat stubs as having those semantics + + --> PYI044.pyi:1:14 | 1 | # Bad import. 2 | from __future__ import annotations # PYI044. - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI044 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 3 | from __future__ import annotations, with_statement # PYI044. | = help: Remove `from __future__ import annotations` - ℹ Safe fix 1 1 | # Bad import. 2 |-from __future__ import annotations # PYI044. @@ -17,17 +18,18 @@ PYI044.pyi:2:1: PYI044 [*] `from __future__ import annotations` has no effect in 4 3 | 5 4 | # Good imports. -PYI044.pyi:3:1: PYI044 [*] `from __future__ import annotations` has no effect in stub files, since type checkers automatically treat stubs as having those semantics +error[PYI044]: 3:1: [*] `from __future__ import annotations` has no effect in stub files, since type checkers automatically treat stubs as having those semantics + + --> PYI044.pyi:2:45 | 1 | # Bad import. 2 | from __future__ import annotations # PYI044. 3 | from __future__ import annotations, with_statement # PYI044. - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI044 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 4 | 5 | # Good imports. | = help: Remove `from __future__ import annotations` - ℹ Safe fix 1 1 | # Bad import. 2 2 | from __future__ import annotations # PYI044. diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__py38_PYI026_PYI026.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__py38_PYI026_PYI026.pyi.snap index e5d8d52518..f9c1697402 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__py38_PYI026_PYI026.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__py38_PYI026_PYI026.pyi.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -error[PYI026]: PYI026.pyi:3:1: [*] Use `typing_extensions.TypeAlias` for type alias, e.g., `NewAny: TypeAlias = Any` +error[PYI026]: 3:1: [*] Use `typing_extensions.TypeAlias` for type alias, e.g., `NewAny: TypeAlias = Any` + --> PYI026.pyi:2:1 | 1 | from typing import Literal, Any 2 | @@ -22,8 +23,9 @@ error[PYI026]: PYI026.pyi:3:1: [*] Use `typing_extensions.TypeAlias` for type al 5 6 | Foo = Literal["foo"] 6 7 | IntOrStr = int | str -error[PYI026]: PYI026.pyi:4:1: [*] Use `typing_extensions.TypeAlias` for type alias, e.g., `OptionalStr: TypeAlias = typing.Optional[str]` +error[PYI026]: 4:1: [*] Use `typing_extensions.TypeAlias` for type alias, e.g., `OptionalStr: TypeAlias = typing.Optional[str]` + --> PYI026.pyi:3:13 | 3 | NewAny = Any 4 | OptionalStr = typing.Optional[str] @@ -43,8 +45,9 @@ error[PYI026]: PYI026.pyi:4:1: [*] Use `typing_extensions.TypeAlias` for type al 6 7 | IntOrStr = int | str 7 8 | AliasNone = None -error[PYI026]: PYI026.pyi:5:1: [*] Use `typing_extensions.TypeAlias` for type alias, e.g., `Foo: TypeAlias = Literal["foo"]` +error[PYI026]: 5:1: [*] Use `typing_extensions.TypeAlias` for type alias, e.g., `Foo: TypeAlias = Literal["foo"]` + --> PYI026.pyi:4:35 | 3 | NewAny = Any 4 | OptionalStr = typing.Optional[str] @@ -66,8 +69,9 @@ error[PYI026]: PYI026.pyi:5:1: [*] Use `typing_extensions.TypeAlias` for type al 7 8 | AliasNone = None 8 9 | -error[PYI026]: PYI026.pyi:6:1: [*] Use `typing_extensions.TypeAlias` for type alias, e.g., `IntOrStr: TypeAlias = int | str` +error[PYI026]: 6:1: [*] Use `typing_extensions.TypeAlias` for type alias, e.g., `IntOrStr: TypeAlias = int | str` + --> PYI026.pyi:5:21 | 4 | OptionalStr = typing.Optional[str] 5 | Foo = Literal["foo"] @@ -89,8 +93,9 @@ error[PYI026]: PYI026.pyi:6:1: [*] Use `typing_extensions.TypeAlias` for type al 8 9 | 9 10 | NewAny: typing.TypeAlias = Any -error[PYI026]: PYI026.pyi:7:1: [*] Use `typing_extensions.TypeAlias` for type alias, e.g., `AliasNone: TypeAlias = None` +error[PYI026]: 7:1: [*] Use `typing_extensions.TypeAlias` for type alias, e.g., `AliasNone: TypeAlias = None` + --> PYI026.pyi:6:21 | 5 | Foo = Literal["foo"] 6 | IntOrStr = int | str @@ -114,8 +119,9 @@ error[PYI026]: PYI026.pyi:7:1: [*] Use `typing_extensions.TypeAlias` for type al 9 10 | NewAny: typing.TypeAlias = Any 10 11 | OptionalStr: TypeAlias = typing.Optional[str] -error[PYI026]: PYI026.pyi:17:5: [*] Use `typing_extensions.TypeAlias` for type alias, e.g., `FLAG_THIS: TypeAlias = None` +error[PYI026]: 17:5: [*] Use `typing_extensions.TypeAlias` for type alias, e.g., `FLAG_THIS: TypeAlias = None` + --> PYI026.pyi:17:5 | 16 | class NotAnEnum: 17 | FLAG_THIS = None diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT001_default.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT001_default.snap index 62b6b322b3..356230f158 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT001_default.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT001_default.snap @@ -1,15 +1,16 @@ --- source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs --- -PT001.py:14:1: PT001 [*] Use `@pytest.fixture` over `@pytest.fixture()` +error[PT001]: 14:1: [*] Use `@pytest.fixture` over `@pytest.fixture()` + + --> PT001.py:14:1 | 14 | @pytest.fixture() - | ^^^^^^^^^^^^^^^^^ PT001 + | ^^^^^^^^^^^^^^^^^ 15 | def parentheses_no_params(): 16 | return 42 | = help: Remove parentheses - ℹ Safe fix 11 11 | return 42 12 12 | @@ -20,17 +21,18 @@ PT001.py:14:1: PT001 [*] Use `@pytest.fixture` over `@pytest.fixture()` 16 16 | return 42 17 17 | -PT001.py:24:1: PT001 [*] Use `@pytest.fixture` over `@pytest.fixture()` +error[PT001]: 24:1: [*] Use `@pytest.fixture` over `@pytest.fixture()` + + --> PT001.py:24:1 | 24 | / @pytest.fixture( 25 | | 26 | | ) - | |_^ PT001 + | |_^ 27 | def parentheses_no_params_multiline(): 28 | return 42 | = help: Remove parentheses - ℹ Safe fix 21 21 | return 42 22 22 | @@ -43,15 +45,16 @@ PT001.py:24:1: PT001 [*] Use `@pytest.fixture` over `@pytest.fixture()` 28 26 | return 42 29 27 | -PT001.py:39:1: PT001 [*] Use `@pytest.fixture` over `@pytest.fixture()` +error[PT001]: 39:1: [*] Use `@pytest.fixture` over `@pytest.fixture()` + + --> PT001.py:39:1 | 39 | @fixture() - | ^^^^^^^^^^ PT001 + | ^^^^^^^^^^ 40 | def imported_from_parentheses_no_params(): 41 | return 42 | = help: Remove parentheses - ℹ Safe fix 36 36 | return 42 37 37 | @@ -62,17 +65,18 @@ PT001.py:39:1: PT001 [*] Use `@pytest.fixture` over `@pytest.fixture()` 41 41 | return 42 42 42 | -PT001.py:49:1: PT001 [*] Use `@pytest.fixture` over `@pytest.fixture()` +error[PT001]: 49:1: [*] Use `@pytest.fixture` over `@pytest.fixture()` + + --> PT001.py:49:1 | 49 | / @fixture( 50 | | 51 | | ) - | |_^ PT001 + | |_^ 52 | def imported_from_parentheses_no_params_multiline(): 53 | return 42 | = help: Remove parentheses - ℹ Safe fix 46 46 | return 42 47 47 | @@ -85,15 +89,16 @@ PT001.py:49:1: PT001 [*] Use `@pytest.fixture` over `@pytest.fixture()` 53 51 | return 42 54 52 | -PT001.py:64:1: PT001 [*] Use `@pytest.fixture` over `@pytest.fixture()` +error[PT001]: 64:1: [*] Use `@pytest.fixture` over `@pytest.fixture()` + + --> PT001.py:64:1 | 64 | @aliased() - | ^^^^^^^^^^ PT001 + | ^^^^^^^^^^ 65 | def aliased_parentheses_no_params(): 66 | return 42 | = help: Remove parentheses - ℹ Safe fix 61 61 | return 42 62 62 | @@ -104,17 +109,18 @@ PT001.py:64:1: PT001 [*] Use `@pytest.fixture` over `@pytest.fixture()` 66 66 | return 42 67 67 | -PT001.py:74:1: PT001 [*] Use `@pytest.fixture` over `@pytest.fixture()` +error[PT001]: 74:1: [*] Use `@pytest.fixture` over `@pytest.fixture()` + + --> PT001.py:74:1 | 74 | / @aliased( 75 | | 76 | | ) - | |_^ PT001 + | |_^ 77 | def aliased_parentheses_no_params_multiline(): 78 | return 42 | = help: Remove parentheses - ℹ Safe fix 71 71 | return 42 72 72 | diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT001_parentheses.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT001_parentheses.snap index 05e4fcdcba..92ceabfc9f 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT001_parentheses.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT001_parentheses.snap @@ -1,15 +1,16 @@ --- source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs --- -PT001.py:9:1: PT001 [*] Use `@pytest.fixture()` over `@pytest.fixture` +error[PT001]: 9:1: [*] Use `@pytest.fixture()` over `@pytest.fixture` + + --> PT001.py:9:1 | 9 | @pytest.fixture - | ^^^^^^^^^^^^^^^ PT001 + | ^^^^^^^^^^^^^^^ 10 | def no_parentheses(): 11 | return 42 | = help: Add parentheses - ℹ Safe fix 6 6 | # `import pytest` 7 7 | @@ -20,15 +21,16 @@ PT001.py:9:1: PT001 [*] Use `@pytest.fixture()` over `@pytest.fixture` 11 11 | return 42 12 12 | -PT001.py:34:1: PT001 [*] Use `@pytest.fixture()` over `@pytest.fixture` +error[PT001]: 34:1: [*] Use `@pytest.fixture()` over `@pytest.fixture` + + --> PT001.py:34:1 | 34 | @fixture - | ^^^^^^^^ PT001 + | ^^^^^^^^ 35 | def imported_from_no_parentheses(): 36 | return 42 | = help: Add parentheses - ℹ Safe fix 31 31 | # `from pytest import fixture` 32 32 | @@ -39,15 +41,16 @@ PT001.py:34:1: PT001 [*] Use `@pytest.fixture()` over `@pytest.fixture` 36 36 | return 42 37 37 | -PT001.py:59:1: PT001 [*] Use `@pytest.fixture()` over `@pytest.fixture` +error[PT001]: 59:1: [*] Use `@pytest.fixture()` over `@pytest.fixture` + + --> PT001.py:59:1 | 59 | @aliased - | ^^^^^^^^ PT001 + | ^^^^^^^^ 60 | def aliased_no_parentheses(): 61 | return 42 | = help: Add parentheses - ℹ Safe fix 56 56 | # `from pytest import fixture as aliased` 57 57 | diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT002.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT002.snap index 35cba3cf23..19a86bdb89 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT002.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT002.snap @@ -1,16 +1,18 @@ --- source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs --- -error[PT002]: PT002.py:14:1: Configuration for fixture `my_fixture` specified via positional args, use kwargs +error[PT002]: 14:1: Configuration for fixture `my_fixture` specified via positional args, use kwargs + --> PT002.py:14:1 | 14 | @pytest.fixture("module") | ^^^^^^^^^^^^^^^^^^^^^^^^^ 15 | def my_fixture(): # Error only args 16 | return 0 | -error[PT002]: PT002.py:19:1: Configuration for fixture `my_fixture` specified via positional args, use kwargs +error[PT002]: 19:1: Configuration for fixture `my_fixture` specified via positional args, use kwargs + --> PT002.py:19:1 | 19 | @pytest.fixture("module", autouse=True) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT003.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT003.snap index 199b3b79a9..62d13dcd75 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT003.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT003.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs --- -error[PT003]: PT003.py:14:17: [*] `scope='function'` is implied in `@pytest.fixture()` +error[PT003]: 14:17: [*] `scope='function'` is implied in `@pytest.fixture()` + --> PT003.py:14:17 | 14 | @pytest.fixture(scope="function") | ^^^^^^^^^^^^^^^^ @@ -20,8 +21,9 @@ error[PT003]: PT003.py:14:17: [*] `scope='function'` is implied in `@pytest.fixt 16 16 | ... 17 17 | -error[PT003]: PT003.py:19:17: [*] `scope='function'` is implied in `@pytest.fixture()` +error[PT003]: 19:17: [*] `scope='function'` is implied in `@pytest.fixture()` + --> PT003.py:19:17 | 19 | @pytest.fixture(scope="function", name="my_fixture") | ^^^^^^^^^^^^^^^^ @@ -39,8 +41,9 @@ error[PT003]: PT003.py:19:17: [*] `scope='function'` is implied in `@pytest.fixt 21 21 | ... 22 22 | -error[PT003]: PT003.py:24:36: [*] `scope='function'` is implied in `@pytest.fixture()` +error[PT003]: 24:36: [*] `scope='function'` is implied in `@pytest.fixture()` + --> PT003.py:24:36 | 24 | @pytest.fixture(name="my_fixture", scope="function") | ^^^^^^^^^^^^^^^^ @@ -58,8 +61,9 @@ error[PT003]: PT003.py:24:36: [*] `scope='function'` is implied in `@pytest.fixt 26 26 | ... 27 27 | -error[PT003]: PT003.py:29:36: [*] `scope='function'` is implied in `@pytest.fixture()` +error[PT003]: 29:36: [*] `scope='function'` is implied in `@pytest.fixture()` + --> PT003.py:29:36 | 29 | @pytest.fixture(name="my_fixture", scope="function", **kwargs) | ^^^^^^^^^^^^^^^^ @@ -77,8 +81,9 @@ error[PT003]: PT003.py:29:36: [*] `scope='function'` is implied in `@pytest.fixt 31 31 | ... 32 32 | -error[PT003]: PT003.py:37:31: [*] `scope='function'` is implied in `@pytest.fixture()` +error[PT003]: 37:31: [*] `scope='function'` is implied in `@pytest.fixture()` + --> PT003.py:37:31 | 35 | # tests the general case as we use a helper function that should 36 | # work for all cases. @@ -98,8 +103,9 @@ error[PT003]: PT003.py:37:31: [*] `scope='function'` is implied in `@pytest.fixt 39 39 | ... 40 40 | -error[PT003]: PT003.py:43:5: [*] `scope='function'` is implied in `@pytest.fixture()` +error[PT003]: 43:5: [*] `scope='function'` is implied in `@pytest.fixture()` + --> PT003.py:43:5 | 42 | @pytest.fixture( 43 | scope="function", @@ -117,8 +123,9 @@ error[PT003]: PT003.py:43:5: [*] `scope='function'` is implied in `@pytest.fixtu 45 44 | ) 46 45 | def error_multiple_args(): -error[PT003]: PT003.py:52:5: [*] `scope='function'` is implied in `@pytest.fixture()` +error[PT003]: 52:5: [*] `scope='function'` is implied in `@pytest.fixture()` + --> PT003.py:52:5 | 50 | @pytest.fixture( 51 | name="my_fixture", @@ -137,8 +144,9 @@ error[PT003]: PT003.py:52:5: [*] `scope='function'` is implied in `@pytest.fixtu 54 53 | def error_multiple_args(): 55 54 | ... -error[PT003]: PT003.py:66:5: [*] `scope='function'` is implied in `@pytest.fixture()` +error[PT003]: 66:5: [*] `scope='function'` is implied in `@pytest.fixture()` + --> PT003.py:66:5 | 64 | # another comment ,) 65 | diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT004.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT004.snap index d5e79f7116..ba38957d04 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT004.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT004.snap @@ -1,16 +1,18 @@ --- source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs --- -error[PT004]: PT004.py:51:5: Fixture `patch_something` does not return anything, add leading underscore +error[PT004]: 51:5: Fixture `patch_something` does not return anything, add leading underscore + --> PT004.py:51:5 | 50 | @pytest.fixture() 51 | def patch_something(mocker): # Error simple | ^^^^^^^^^^^^^^^ 52 | mocker.patch("some.thing") | -error[PT004]: PT004.py:56:5: Fixture `activate_context` does not return anything, add leading underscore +error[PT004]: 56:5: Fixture `activate_context` does not return anything, add leading underscore + --> PT004.py:56:5 | 55 | @pytest.fixture() 56 | def activate_context(): # Error with yield diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT005.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT005.snap index e5704612f4..fc786fd4d0 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT005.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT005.snap @@ -1,16 +1,18 @@ --- source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs --- -error[PT005]: PT005.py:41:5: Fixture `_my_fixture` returns a value, remove leading underscore +error[PT005]: 41:5: Fixture `_my_fixture` returns a value, remove leading underscore + --> PT005.py:41:5 | 40 | @pytest.fixture() 41 | def _my_fixture(mocker): # Error with return | ^^^^^^^^^^^ 42 | return 0 | -error[PT005]: PT005.py:46:5: Fixture `_activate_context` returns a value, remove leading underscore +error[PT005]: 46:5: Fixture `_activate_context` returns a value, remove leading underscore + --> PT005.py:46:5 | 45 | @pytest.fixture() 46 | def _activate_context(): # Error with yield @@ -18,8 +20,9 @@ error[PT005]: PT005.py:46:5: Fixture `_activate_context` returns a value, remove 47 | with get_context() as context: 48 | yield context | -error[PT005]: PT005.py:52:5: Fixture `_activate_context` returns a value, remove leading underscore +error[PT005]: 52:5: Fixture `_activate_context` returns a value, remove leading underscore + --> PT005.py:52:5 | 51 | @pytest.fixture() 52 | def _activate_context(): # Error with conditional yield from diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_csv.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_csv.snap index 36389dd889..5423e4d7bb 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_csv.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_csv.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs --- -error[PT006]: PT006.py:24:26: [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected a string of comma-separated values +error[PT006]: 24:26: [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected a string of comma-separated values + --> PT006.py:24:26 | 24 | @pytest.mark.parametrize(("param1", "param2"), [(1, 2), (3, 4)]) | ^^^^^^^^^^^^^^^^^^^^ @@ -20,8 +21,9 @@ error[PT006]: PT006.py:24:26: [*] Wrong type passed to first argument of `@pytes 26 26 | ... 27 27 | -error[PT006]: PT006.py:29:26: [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `str` +error[PT006]: 29:26: [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `str` + --> PT006.py:29:26 | 29 | @pytest.mark.parametrize(("param1",), [1, 2, 3]) | ^^^^^^^^^^^ @@ -39,8 +41,9 @@ error[PT006]: PT006.py:29:26: [*] Wrong type passed to first argument of `@pytes 31 31 | ... 32 32 | -error[PT006]: PT006.py:34:26: [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected a string of comma-separated values +error[PT006]: 34:26: [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected a string of comma-separated values + --> PT006.py:34:26 | 34 | @pytest.mark.parametrize(["param1", "param2"], [(1, 2), (3, 4)]) | ^^^^^^^^^^^^^^^^^^^^ @@ -58,8 +61,9 @@ error[PT006]: PT006.py:34:26: [*] Wrong type passed to first argument of `@pytes 36 36 | ... 37 37 | -error[PT006]: PT006.py:39:26: [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `str` +error[PT006]: 39:26: [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `str` + --> PT006.py:39:26 | 39 | @pytest.mark.parametrize(["param1"], [1, 2, 3]) | ^^^^^^^^^^ @@ -77,8 +81,9 @@ error[PT006]: PT006.py:39:26: [*] Wrong type passed to first argument of `@pytes 41 41 | ... 42 42 | -error[PT006]: PT006.py:44:26: Wrong type passed to first argument of `@pytest.mark.parametrize`; expected a string of comma-separated values +error[PT006]: 44:26: Wrong type passed to first argument of `@pytest.mark.parametrize`; expected a string of comma-separated values + --> PT006.py:44:26 | 44 | @pytest.mark.parametrize([some_expr, another_expr], [1, 2, 3]) | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -86,8 +91,9 @@ error[PT006]: PT006.py:44:26: Wrong type passed to first argument of `@pytest.ma 46 | ... | = help: Use a string of comma-separated values for the first argument -error[PT006]: PT006.py:49:26: Wrong type passed to first argument of `@pytest.mark.parametrize`; expected a string of comma-separated values +error[PT006]: 49:26: Wrong type passed to first argument of `@pytest.mark.parametrize`; expected a string of comma-separated values + --> PT006.py:49:26 | 49 | @pytest.mark.parametrize([some_expr, "param2"], [1, 2, 3]) | ^^^^^^^^^^^^^^^^^^^^^ diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_default.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_default.snap index aeb8f60757..77293ef790 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_default.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_default.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs --- -error[PT006]: PT006.py:9:26: [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `tuple` +error[PT006]: 9:26: [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `tuple` + --> PT006.py:9:26 | 9 | @pytest.mark.parametrize("param1,param2", [(1, 2), (3, 4)]) | ^^^^^^^^^^^^^^^ @@ -20,8 +21,9 @@ error[PT006]: PT006.py:9:26: [*] Wrong type passed to first argument of `@pytest 11 11 | ... 12 12 | -error[PT006]: PT006.py:14:26: [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `tuple` +error[PT006]: 14:26: [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `tuple` + --> PT006.py:14:26 | 14 | @pytest.mark.parametrize(" param1, , param2 , ", [(1, 2), (3, 4)]) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -39,8 +41,9 @@ error[PT006]: PT006.py:14:26: [*] Wrong type passed to first argument of `@pytes 16 16 | ... 17 17 | -error[PT006]: PT006.py:19:26: [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `tuple` +error[PT006]: 19:26: [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `tuple` + --> PT006.py:19:26 | 19 | @pytest.mark.parametrize("param1,param2", [(1, 2), (3, 4)]) | ^^^^^^^^^^^^^^^ @@ -58,8 +61,9 @@ error[PT006]: PT006.py:19:26: [*] Wrong type passed to first argument of `@pytes 21 21 | ... 22 22 | -error[PT006]: PT006.py:29:26: [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `str` +error[PT006]: 29:26: [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `str` + --> PT006.py:29:26 | 29 | @pytest.mark.parametrize(("param1",), [1, 2, 3]) | ^^^^^^^^^^^ @@ -77,8 +81,9 @@ error[PT006]: PT006.py:29:26: [*] Wrong type passed to first argument of `@pytes 31 31 | ... 32 32 | -error[PT006]: PT006.py:34:26: [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `tuple` +error[PT006]: 34:26: [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `tuple` + --> PT006.py:34:26 | 34 | @pytest.mark.parametrize(["param1", "param2"], [(1, 2), (3, 4)]) | ^^^^^^^^^^^^^^^^^^^^ @@ -96,8 +101,9 @@ error[PT006]: PT006.py:34:26: [*] Wrong type passed to first argument of `@pytes 36 36 | ... 37 37 | -error[PT006]: PT006.py:39:26: [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `str` +error[PT006]: 39:26: [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `str` + --> PT006.py:39:26 | 39 | @pytest.mark.parametrize(["param1"], [1, 2, 3]) | ^^^^^^^^^^ @@ -115,8 +121,9 @@ error[PT006]: PT006.py:39:26: [*] Wrong type passed to first argument of `@pytes 41 41 | ... 42 42 | -error[PT006]: PT006.py:44:26: [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `tuple` +error[PT006]: 44:26: [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `tuple` + --> PT006.py:44:26 | 44 | @pytest.mark.parametrize([some_expr, another_expr], [1, 2, 3]) | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -134,8 +141,9 @@ error[PT006]: PT006.py:44:26: [*] Wrong type passed to first argument of `@pytes 46 46 | ... 47 47 | -error[PT006]: PT006.py:49:26: [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `tuple` +error[PT006]: 49:26: [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `tuple` + --> PT006.py:49:26 | 49 | @pytest.mark.parametrize([some_expr, "param2"], [1, 2, 3]) | ^^^^^^^^^^^^^^^^^^^^^ @@ -153,8 +161,9 @@ error[PT006]: PT006.py:49:26: [*] Wrong type passed to first argument of `@pytes 51 51 | ... 52 52 | -error[PT006]: PT006.py:54:26: [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `tuple` +error[PT006]: 54:26: [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `tuple` + --> PT006.py:54:26 | 54 | @pytest.mark.parametrize(("param1, " "param2, " "param3"), [(1, 2, 3), (4, 5, 6)]) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -172,8 +181,9 @@ error[PT006]: PT006.py:54:26: [*] Wrong type passed to first argument of `@pytes 56 56 | ... 57 57 | -error[PT006]: PT006.py:59:26: [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `tuple` +error[PT006]: 59:26: [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `tuple` + --> PT006.py:59:26 | 59 | @pytest.mark.parametrize("param1, " "param2, " "param3", [(1, 2, 3), (4, 5, 6)]) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -191,8 +201,9 @@ error[PT006]: PT006.py:59:26: [*] Wrong type passed to first argument of `@pytes 61 61 | ... 62 62 | -error[PT006]: PT006.py:64:26: [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `tuple` +error[PT006]: 64:26: [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `tuple` + --> PT006.py:64:26 | 64 | @pytest.mark.parametrize((("param1, " "param2, " "param3")), [(1, 2, 3), (4, 5, 6)]) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -210,8 +221,9 @@ error[PT006]: PT006.py:64:26: [*] Wrong type passed to first argument of `@pytes 66 66 | ... 67 67 | -error[PT006]: PT006.py:69:26: [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `tuple` +error[PT006]: 69:26: [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `tuple` + --> PT006.py:69:26 | 69 | @pytest.mark.parametrize(("param1,param2"), [(1, 2), (3, 4)]) | ^^^^^^^^^^^^^^^^^ diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_list.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_list.snap index a12c755fc4..0c476cdd3e 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_list.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_list.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs --- -error[PT006]: PT006.py:9:26: [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `list` +error[PT006]: 9:26: [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `list` + --> PT006.py:9:26 | 9 | @pytest.mark.parametrize("param1,param2", [(1, 2), (3, 4)]) | ^^^^^^^^^^^^^^^ @@ -20,8 +21,9 @@ error[PT006]: PT006.py:9:26: [*] Wrong type passed to first argument of `@pytest 11 11 | ... 12 12 | -error[PT006]: PT006.py:14:26: [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `list` +error[PT006]: 14:26: [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `list` + --> PT006.py:14:26 | 14 | @pytest.mark.parametrize(" param1, , param2 , ", [(1, 2), (3, 4)]) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -39,8 +41,9 @@ error[PT006]: PT006.py:14:26: [*] Wrong type passed to first argument of `@pytes 16 16 | ... 17 17 | -error[PT006]: PT006.py:19:26: [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `list` +error[PT006]: 19:26: [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `list` + --> PT006.py:19:26 | 19 | @pytest.mark.parametrize("param1,param2", [(1, 2), (3, 4)]) | ^^^^^^^^^^^^^^^ @@ -58,8 +61,9 @@ error[PT006]: PT006.py:19:26: [*] Wrong type passed to first argument of `@pytes 21 21 | ... 22 22 | -error[PT006]: PT006.py:24:26: [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `list` +error[PT006]: 24:26: [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `list` + --> PT006.py:24:26 | 24 | @pytest.mark.parametrize(("param1", "param2"), [(1, 2), (3, 4)]) | ^^^^^^^^^^^^^^^^^^^^ @@ -77,8 +81,9 @@ error[PT006]: PT006.py:24:26: [*] Wrong type passed to first argument of `@pytes 26 26 | ... 27 27 | -error[PT006]: PT006.py:29:26: [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `str` +error[PT006]: 29:26: [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `str` + --> PT006.py:29:26 | 29 | @pytest.mark.parametrize(("param1",), [1, 2, 3]) | ^^^^^^^^^^^ @@ -96,8 +101,9 @@ error[PT006]: PT006.py:29:26: [*] Wrong type passed to first argument of `@pytes 31 31 | ... 32 32 | -error[PT006]: PT006.py:39:26: [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `str` +error[PT006]: 39:26: [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `str` + --> PT006.py:39:26 | 39 | @pytest.mark.parametrize(["param1"], [1, 2, 3]) | ^^^^^^^^^^ @@ -115,8 +121,9 @@ error[PT006]: PT006.py:39:26: [*] Wrong type passed to first argument of `@pytes 41 41 | ... 42 42 | -error[PT006]: PT006.py:54:26: [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `list` +error[PT006]: 54:26: [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `list` + --> PT006.py:54:26 | 54 | @pytest.mark.parametrize(("param1, " "param2, " "param3"), [(1, 2, 3), (4, 5, 6)]) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -134,8 +141,9 @@ error[PT006]: PT006.py:54:26: [*] Wrong type passed to first argument of `@pytes 56 56 | ... 57 57 | -error[PT006]: PT006.py:59:26: [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `list` +error[PT006]: 59:26: [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `list` + --> PT006.py:59:26 | 59 | @pytest.mark.parametrize("param1, " "param2, " "param3", [(1, 2, 3), (4, 5, 6)]) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -153,8 +161,9 @@ error[PT006]: PT006.py:59:26: [*] Wrong type passed to first argument of `@pytes 61 61 | ... 62 62 | -error[PT006]: PT006.py:64:26: [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `list` +error[PT006]: 64:26: [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `list` + --> PT006.py:64:26 | 64 | @pytest.mark.parametrize((("param1, " "param2, " "param3")), [(1, 2, 3), (4, 5, 6)]) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -172,8 +181,9 @@ error[PT006]: PT006.py:64:26: [*] Wrong type passed to first argument of `@pytes 66 66 | ... 67 67 | -error[PT006]: PT006.py:69:26: [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `list` +error[PT006]: 69:26: [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `list` + --> PT006.py:69:26 | 69 | @pytest.mark.parametrize(("param1,param2"), [(1, 2), (3, 4)]) | ^^^^^^^^^^^^^^^^^ diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT007_list_of_lists.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT007_list_of_lists.snap index 54cf2a97b3..5764011dd9 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT007_list_of_lists.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT007_list_of_lists.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs --- -error[PT007]: PT007.py:4:35: [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `list` +error[PT007]: 4:35: [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `list` + --> PT007.py:4:35 | 4 | @pytest.mark.parametrize("param", (1, 2)) | ^^^^^^ @@ -20,8 +21,9 @@ error[PT007]: PT007.py:4:35: [*] Wrong values type in `@pytest.mark.parametrize` 6 6 | ... 7 7 | -error[PT007]: PT007.py:11:5: [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `list` +error[PT007]: 11:5: [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `list` + --> PT007.py:11:5 | 9 | @pytest.mark.parametrize( 10 | ("param1", "param2"), @@ -49,8 +51,9 @@ error[PT007]: PT007.py:11:5: [*] Wrong values type in `@pytest.mark.parametrize` 16 16 | def test_tuple_of_tuples(param1, param2): 17 17 | ... -error[PT007]: PT007.py:12:9: [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `list` +error[PT007]: 12:9: [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `list` + --> PT007.py:12:9 | 10 | ("param1", "param2"), 11 | ( @@ -70,8 +73,9 @@ error[PT007]: PT007.py:12:9: [*] Wrong values type in `@pytest.mark.parametrize` 14 14 | ), 15 15 | ) -error[PT007]: PT007.py:13:9: [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `list` +error[PT007]: 13:9: [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `list` + --> PT007.py:13:9 | 11 | ( 12 | (1, 2), @@ -91,8 +95,9 @@ error[PT007]: PT007.py:13:9: [*] Wrong values type in `@pytest.mark.parametrize` 15 15 | ) 16 16 | def test_tuple_of_tuples(param1, param2): -error[PT007]: PT007.py:22:5: [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `list` +error[PT007]: 22:5: [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `list` + --> PT007.py:22:5 | 20 | @pytest.mark.parametrize( 21 | ("param1", "param2"), @@ -120,8 +125,9 @@ error[PT007]: PT007.py:22:5: [*] Wrong values type in `@pytest.mark.parametrize` 27 27 | def test_tuple_of_lists(param1, param2): 28 28 | ... -error[PT007]: PT007.py:39:9: [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `list` +error[PT007]: 39:9: [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `list` + --> PT007.py:39:9 | 37 | ("param1", "param2"), 38 | [ @@ -141,8 +147,9 @@ error[PT007]: PT007.py:39:9: [*] Wrong values type in `@pytest.mark.parametrize` 41 41 | ], 42 42 | ) -error[PT007]: PT007.py:40:9: [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `list` +error[PT007]: 40:9: [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `list` + --> PT007.py:40:9 | 38 | [ 39 | (1, 2), @@ -162,8 +169,9 @@ error[PT007]: PT007.py:40:9: [*] Wrong values type in `@pytest.mark.parametrize` 42 42 | ) 43 43 | def test_list_of_tuples(param1, param2): -error[PT007]: PT007.py:81:38: [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `list` +error[PT007]: 81:38: [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `list` + --> PT007.py:81:38 | 80 | @pytest.mark.parametrize("a", [1, 2]) 81 | @pytest.mark.parametrize(("b", "c"), ((3, 4), (5, 6))) @@ -182,8 +190,9 @@ error[PT007]: PT007.py:81:38: [*] Wrong values type in `@pytest.mark.parametrize 83 83 | @pytest.mark.parametrize( 84 84 | "d", -error[PT007]: PT007.py:81:39: [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `list` +error[PT007]: 81:39: [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `list` + --> PT007.py:81:39 | 80 | @pytest.mark.parametrize("a", [1, 2]) 81 | @pytest.mark.parametrize(("b", "c"), ((3, 4), (5, 6))) @@ -202,8 +211,9 @@ error[PT007]: PT007.py:81:39: [*] Wrong values type in `@pytest.mark.parametrize 83 83 | @pytest.mark.parametrize( 84 84 | "d", -error[PT007]: PT007.py:81:47: [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `list` +error[PT007]: 81:47: [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `list` + --> PT007.py:81:47 | 80 | @pytest.mark.parametrize("a", [1, 2]) 81 | @pytest.mark.parametrize(("b", "c"), ((3, 4), (5, 6))) diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT007_list_of_tuples.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT007_list_of_tuples.snap index f08e65a3a2..f136d79c13 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT007_list_of_tuples.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT007_list_of_tuples.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs --- -error[PT007]: PT007.py:4:35: [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `tuple` +error[PT007]: 4:35: [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `tuple` + --> PT007.py:4:35 | 4 | @pytest.mark.parametrize("param", (1, 2)) | ^^^^^^ @@ -20,8 +21,9 @@ error[PT007]: PT007.py:4:35: [*] Wrong values type in `@pytest.mark.parametrize` 6 6 | ... 7 7 | -error[PT007]: PT007.py:11:5: [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `tuple` +error[PT007]: 11:5: [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `tuple` + --> PT007.py:11:5 | 9 | @pytest.mark.parametrize( 10 | ("param1", "param2"), @@ -49,8 +51,9 @@ error[PT007]: PT007.py:11:5: [*] Wrong values type in `@pytest.mark.parametrize` 16 16 | def test_tuple_of_tuples(param1, param2): 17 17 | ... -error[PT007]: PT007.py:22:5: [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `tuple` +error[PT007]: 22:5: [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `tuple` + --> PT007.py:22:5 | 20 | @pytest.mark.parametrize( 21 | ("param1", "param2"), @@ -78,8 +81,9 @@ error[PT007]: PT007.py:22:5: [*] Wrong values type in `@pytest.mark.parametrize` 27 27 | def test_tuple_of_lists(param1, param2): 28 28 | ... -error[PT007]: PT007.py:23:9: [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `tuple` +error[PT007]: 23:9: [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `tuple` + --> PT007.py:23:9 | 21 | ("param1", "param2"), 22 | ( @@ -99,8 +103,9 @@ error[PT007]: PT007.py:23:9: [*] Wrong values type in `@pytest.mark.parametrize` 25 25 | ), 26 26 | ) -error[PT007]: PT007.py:24:9: [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `tuple` +error[PT007]: 24:9: [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `tuple` + --> PT007.py:24:9 | 22 | ( 23 | [1, 2], @@ -120,8 +125,9 @@ error[PT007]: PT007.py:24:9: [*] Wrong values type in `@pytest.mark.parametrize` 26 26 | ) 27 27 | def test_tuple_of_lists(param1, param2): -error[PT007]: PT007.py:50:9: [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `tuple` +error[PT007]: 50:9: [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `tuple` + --> PT007.py:50:9 | 48 | ("param1", "param2"), 49 | [ @@ -141,8 +147,9 @@ error[PT007]: PT007.py:50:9: [*] Wrong values type in `@pytest.mark.parametrize` 52 52 | ], 53 53 | ) -error[PT007]: PT007.py:51:9: [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `tuple` +error[PT007]: 51:9: [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `tuple` + --> PT007.py:51:9 | 49 | [ 50 | [1, 2], @@ -162,8 +169,9 @@ error[PT007]: PT007.py:51:9: [*] Wrong values type in `@pytest.mark.parametrize` 53 53 | ) 54 54 | def test_list_of_lists(param1, param2): -error[PT007]: PT007.py:61:9: [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `tuple` +error[PT007]: 61:9: [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `tuple` + --> PT007.py:61:9 | 59 | "param1,param2", 60 | [ @@ -183,8 +191,9 @@ error[PT007]: PT007.py:61:9: [*] Wrong values type in `@pytest.mark.parametrize` 63 63 | ], 64 64 | ) -error[PT007]: PT007.py:62:9: [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `tuple` +error[PT007]: 62:9: [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `tuple` + --> PT007.py:62:9 | 60 | [ 61 | [1, 2], @@ -204,8 +213,9 @@ error[PT007]: PT007.py:62:9: [*] Wrong values type in `@pytest.mark.parametrize` 64 64 | ) 65 65 | def test_csv_name_list_of_lists(param1, param2): -error[PT007]: PT007.py:81:38: [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `tuple` +error[PT007]: 81:38: [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `tuple` + --> PT007.py:81:38 | 80 | @pytest.mark.parametrize("a", [1, 2]) 81 | @pytest.mark.parametrize(("b", "c"), ((3, 4), (5, 6))) diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT007_tuple_of_lists.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT007_tuple_of_lists.snap index 923ea81d69..32343e5e6d 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT007_tuple_of_lists.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT007_tuple_of_lists.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs --- -error[PT007]: PT007.py:12:9: [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `list` +error[PT007]: 12:9: [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `list` + --> PT007.py:12:9 | 10 | ("param1", "param2"), 11 | ( @@ -22,8 +23,9 @@ error[PT007]: PT007.py:12:9: [*] Wrong values type in `@pytest.mark.parametrize` 14 14 | ), 15 15 | ) -error[PT007]: PT007.py:13:9: [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `list` +error[PT007]: 13:9: [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `list` + --> PT007.py:13:9 | 11 | ( 12 | (1, 2), @@ -43,8 +45,9 @@ error[PT007]: PT007.py:13:9: [*] Wrong values type in `@pytest.mark.parametrize` 15 15 | ) 16 16 | def test_tuple_of_tuples(param1, param2): -error[PT007]: PT007.py:31:35: [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `list` +error[PT007]: 31:35: [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `list` + --> PT007.py:31:35 | 31 | @pytest.mark.parametrize("param", [1, 2]) | ^^^^^^ @@ -62,8 +65,9 @@ error[PT007]: PT007.py:31:35: [*] Wrong values type in `@pytest.mark.parametrize 33 33 | ... 34 34 | -error[PT007]: PT007.py:38:5: [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `list` +error[PT007]: 38:5: [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `list` + --> PT007.py:38:5 | 36 | @pytest.mark.parametrize( 37 | ("param1", "param2"), @@ -91,8 +95,9 @@ error[PT007]: PT007.py:38:5: [*] Wrong values type in `@pytest.mark.parametrize` 43 43 | def test_list_of_tuples(param1, param2): 44 44 | ... -error[PT007]: PT007.py:39:9: [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `list` +error[PT007]: 39:9: [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `list` + --> PT007.py:39:9 | 37 | ("param1", "param2"), 38 | [ @@ -112,8 +117,9 @@ error[PT007]: PT007.py:39:9: [*] Wrong values type in `@pytest.mark.parametrize` 41 41 | ], 42 42 | ) -error[PT007]: PT007.py:40:9: [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `list` +error[PT007]: 40:9: [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `list` + --> PT007.py:40:9 | 38 | [ 39 | (1, 2), @@ -133,8 +139,9 @@ error[PT007]: PT007.py:40:9: [*] Wrong values type in `@pytest.mark.parametrize` 42 42 | ) 43 43 | def test_list_of_tuples(param1, param2): -error[PT007]: PT007.py:49:5: [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `list` +error[PT007]: 49:5: [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `list` + --> PT007.py:49:5 | 47 | @pytest.mark.parametrize( 48 | ("param1", "param2"), @@ -162,8 +169,9 @@ error[PT007]: PT007.py:49:5: [*] Wrong values type in `@pytest.mark.parametrize` 54 54 | def test_list_of_lists(param1, param2): 55 55 | ... -error[PT007]: PT007.py:60:5: [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `list` +error[PT007]: 60:5: [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `list` + --> PT007.py:60:5 | 58 | @pytest.mark.parametrize( 59 | "param1,param2", @@ -191,8 +199,9 @@ error[PT007]: PT007.py:60:5: [*] Wrong values type in `@pytest.mark.parametrize` 65 65 | def test_csv_name_list_of_lists(param1, param2): 66 66 | ... -error[PT007]: PT007.py:71:5: [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `list` +error[PT007]: 71:5: [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `list` + --> PT007.py:71:5 | 69 | @pytest.mark.parametrize( 70 | "param", @@ -220,8 +229,9 @@ error[PT007]: PT007.py:71:5: [*] Wrong values type in `@pytest.mark.parametrize` 76 76 | def test_single_list_of_lists(param): 77 77 | ... -error[PT007]: PT007.py:80:31: [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `list` +error[PT007]: 80:31: [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `list` + --> PT007.py:80:31 | 80 | @pytest.mark.parametrize("a", [1, 2]) | ^^^^^^ @@ -239,8 +249,9 @@ error[PT007]: PT007.py:80:31: [*] Wrong values type in `@pytest.mark.parametrize 82 82 | @pytest.mark.parametrize("d", [3,]) 83 83 | @pytest.mark.parametrize( -error[PT007]: PT007.py:81:39: [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `list` +error[PT007]: 81:39: [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `list` + --> PT007.py:81:39 | 80 | @pytest.mark.parametrize("a", [1, 2]) 81 | @pytest.mark.parametrize(("b", "c"), ((3, 4), (5, 6))) @@ -259,8 +270,9 @@ error[PT007]: PT007.py:81:39: [*] Wrong values type in `@pytest.mark.parametrize 83 83 | @pytest.mark.parametrize( 84 84 | "d", -error[PT007]: PT007.py:81:47: [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `list` +error[PT007]: 81:47: [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `list` + --> PT007.py:81:47 | 80 | @pytest.mark.parametrize("a", [1, 2]) 81 | @pytest.mark.parametrize(("b", "c"), ((3, 4), (5, 6))) @@ -279,8 +291,9 @@ error[PT007]: PT007.py:81:47: [*] Wrong values type in `@pytest.mark.parametrize 83 83 | @pytest.mark.parametrize( 84 84 | "d", -error[PT007]: PT007.py:82:31: [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `list` +error[PT007]: 82:31: [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `list` + --> PT007.py:82:31 | 80 | @pytest.mark.parametrize("a", [1, 2]) 81 | @pytest.mark.parametrize(("b", "c"), ((3, 4), (5, 6))) @@ -300,8 +313,9 @@ error[PT007]: PT007.py:82:31: [*] Wrong values type in `@pytest.mark.parametrize 84 84 | "d", 85 85 | [("3", "4")], -error[PT007]: PT007.py:85:5: [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `list` +error[PT007]: 85:5: [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `list` + --> PT007.py:85:5 | 83 | @pytest.mark.parametrize( 84 | "d", @@ -321,8 +335,9 @@ error[PT007]: PT007.py:85:5: [*] Wrong values type in `@pytest.mark.parametrize` 87 87 | @pytest.mark.parametrize( 88 88 | "e", -error[PT007]: PT007.py:89:5: [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `list` +error[PT007]: 89:5: [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `list` + --> PT007.py:89:5 | 87 | @pytest.mark.parametrize( 88 | "e", diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT007_tuple_of_tuples.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT007_tuple_of_tuples.snap index 249e618975..c8383ee428 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT007_tuple_of_tuples.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT007_tuple_of_tuples.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs --- -error[PT007]: PT007.py:23:9: [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `tuple` +error[PT007]: 23:9: [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `tuple` + --> PT007.py:23:9 | 21 | ("param1", "param2"), 22 | ( @@ -22,8 +23,9 @@ error[PT007]: PT007.py:23:9: [*] Wrong values type in `@pytest.mark.parametrize` 25 25 | ), 26 26 | ) -error[PT007]: PT007.py:24:9: [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `tuple` +error[PT007]: 24:9: [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `tuple` + --> PT007.py:24:9 | 22 | ( 23 | [1, 2], @@ -43,8 +45,9 @@ error[PT007]: PT007.py:24:9: [*] Wrong values type in `@pytest.mark.parametrize` 26 26 | ) 27 27 | def test_tuple_of_lists(param1, param2): -error[PT007]: PT007.py:31:35: [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `tuple` +error[PT007]: 31:35: [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `tuple` + --> PT007.py:31:35 | 31 | @pytest.mark.parametrize("param", [1, 2]) | ^^^^^^ @@ -62,8 +65,9 @@ error[PT007]: PT007.py:31:35: [*] Wrong values type in `@pytest.mark.parametrize 33 33 | ... 34 34 | -error[PT007]: PT007.py:38:5: [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `tuple` +error[PT007]: 38:5: [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `tuple` + --> PT007.py:38:5 | 36 | @pytest.mark.parametrize( 37 | ("param1", "param2"), @@ -91,8 +95,9 @@ error[PT007]: PT007.py:38:5: [*] Wrong values type in `@pytest.mark.parametrize` 43 43 | def test_list_of_tuples(param1, param2): 44 44 | ... -error[PT007]: PT007.py:49:5: [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `tuple` +error[PT007]: 49:5: [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `tuple` + --> PT007.py:49:5 | 47 | @pytest.mark.parametrize( 48 | ("param1", "param2"), @@ -120,8 +125,9 @@ error[PT007]: PT007.py:49:5: [*] Wrong values type in `@pytest.mark.parametrize` 54 54 | def test_list_of_lists(param1, param2): 55 55 | ... -error[PT007]: PT007.py:50:9: [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `tuple` +error[PT007]: 50:9: [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `tuple` + --> PT007.py:50:9 | 48 | ("param1", "param2"), 49 | [ @@ -141,8 +147,9 @@ error[PT007]: PT007.py:50:9: [*] Wrong values type in `@pytest.mark.parametrize` 52 52 | ], 53 53 | ) -error[PT007]: PT007.py:51:9: [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `tuple` +error[PT007]: 51:9: [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `tuple` + --> PT007.py:51:9 | 49 | [ 50 | [1, 2], @@ -162,8 +169,9 @@ error[PT007]: PT007.py:51:9: [*] Wrong values type in `@pytest.mark.parametrize` 53 53 | ) 54 54 | def test_list_of_lists(param1, param2): -error[PT007]: PT007.py:60:5: [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `tuple` +error[PT007]: 60:5: [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `tuple` + --> PT007.py:60:5 | 58 | @pytest.mark.parametrize( 59 | "param1,param2", @@ -191,8 +199,9 @@ error[PT007]: PT007.py:60:5: [*] Wrong values type in `@pytest.mark.parametrize` 65 65 | def test_csv_name_list_of_lists(param1, param2): 66 66 | ... -error[PT007]: PT007.py:61:9: [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `tuple` +error[PT007]: 61:9: [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `tuple` + --> PT007.py:61:9 | 59 | "param1,param2", 60 | [ @@ -212,8 +221,9 @@ error[PT007]: PT007.py:61:9: [*] Wrong values type in `@pytest.mark.parametrize` 63 63 | ], 64 64 | ) -error[PT007]: PT007.py:62:9: [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `tuple` +error[PT007]: 62:9: [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `tuple` + --> PT007.py:62:9 | 60 | [ 61 | [1, 2], @@ -233,8 +243,9 @@ error[PT007]: PT007.py:62:9: [*] Wrong values type in `@pytest.mark.parametrize` 64 64 | ) 65 65 | def test_csv_name_list_of_lists(param1, param2): -error[PT007]: PT007.py:71:5: [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `tuple` +error[PT007]: 71:5: [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `tuple` + --> PT007.py:71:5 | 69 | @pytest.mark.parametrize( 70 | "param", @@ -262,8 +273,9 @@ error[PT007]: PT007.py:71:5: [*] Wrong values type in `@pytest.mark.parametrize` 76 76 | def test_single_list_of_lists(param): 77 77 | ... -error[PT007]: PT007.py:80:31: [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `tuple` +error[PT007]: 80:31: [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `tuple` + --> PT007.py:80:31 | 80 | @pytest.mark.parametrize("a", [1, 2]) | ^^^^^^ @@ -281,8 +293,9 @@ error[PT007]: PT007.py:80:31: [*] Wrong values type in `@pytest.mark.parametrize 82 82 | @pytest.mark.parametrize("d", [3,]) 83 83 | @pytest.mark.parametrize( -error[PT007]: PT007.py:82:31: [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `tuple` +error[PT007]: 82:31: [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `tuple` + --> PT007.py:82:31 | 80 | @pytest.mark.parametrize("a", [1, 2]) 81 | @pytest.mark.parametrize(("b", "c"), ((3, 4), (5, 6))) @@ -302,8 +315,9 @@ error[PT007]: PT007.py:82:31: [*] Wrong values type in `@pytest.mark.parametrize 84 84 | "d", 85 85 | [("3", "4")], -error[PT007]: PT007.py:85:5: [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `tuple` +error[PT007]: 85:5: [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `tuple` + --> PT007.py:85:5 | 83 | @pytest.mark.parametrize( 84 | "d", @@ -323,8 +337,9 @@ error[PT007]: PT007.py:85:5: [*] Wrong values type in `@pytest.mark.parametrize` 87 87 | @pytest.mark.parametrize( 88 88 | "e", -error[PT007]: PT007.py:89:5: [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `tuple` +error[PT007]: 89:5: [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `tuple` + --> PT007.py:89:5 | 87 | @pytest.mark.parametrize( 88 | "e", diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT008.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT008.snap index 80a7872923..1aa37a5885 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT008.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT008.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs --- -error[PT008]: PT008.py:35:1: Use `return_value=` instead of patching with `lambda` +error[PT008]: 35:1: Use `return_value=` instead of patching with `lambda` + --> PT008.py:34:1 | 33 | # Error 34 | @@ -11,8 +12,9 @@ error[PT008]: PT008.py:35:1: Use `return_value=` instead of patching with `lambd 36 | module_mocker.patch("module.name", lambda: None) 37 | mocker.patch.object(obj, "attr", lambda: None) | -error[PT008]: PT008.py:36:1: Use `return_value=` instead of patching with `lambda` +error[PT008]: 36:1: Use `return_value=` instead of patching with `lambda` + --> PT008.py:35:42 | 35 | mocker.patch("module.name", lambda: None) 36 | module_mocker.patch("module.name", lambda: None) @@ -20,8 +22,9 @@ error[PT008]: PT008.py:36:1: Use `return_value=` instead of patching with `lambd 37 | mocker.patch.object(obj, "attr", lambda: None) 38 | module_mocker.patch.object(obj, "attr", lambda: None) | -error[PT008]: PT008.py:37:1: Use `return_value=` instead of patching with `lambda` +error[PT008]: 37:1: Use `return_value=` instead of patching with `lambda` + --> PT008.py:36:49 | 35 | mocker.patch("module.name", lambda: None) 36 | module_mocker.patch("module.name", lambda: None) @@ -29,8 +32,9 @@ error[PT008]: PT008.py:37:1: Use `return_value=` instead of patching with `lambd | ^^^^^^^^^^^^^^^^^^^ 38 | module_mocker.patch.object(obj, "attr", lambda: None) | -error[PT008]: PT008.py:38:1: Use `return_value=` instead of patching with `lambda` +error[PT008]: 38:1: Use `return_value=` instead of patching with `lambda` + --> PT008.py:37:47 | 36 | module_mocker.patch("module.name", lambda: None) 37 | mocker.patch.object(obj, "attr", lambda: None) @@ -39,8 +43,9 @@ error[PT008]: PT008.py:38:1: Use `return_value=` instead of patching with `lambd 39 | 40 | mocker.patch("module.name", lambda x, y: None) | -error[PT008]: PT008.py:40:1: Use `return_value=` instead of patching with `lambda` +error[PT008]: 40:1: Use `return_value=` instead of patching with `lambda` + --> PT008.py:39:1 | 38 | module_mocker.patch.object(obj, "attr", lambda: None) 39 | @@ -49,8 +54,9 @@ error[PT008]: PT008.py:40:1: Use `return_value=` instead of patching with `lambd 41 | module_mocker.patch("module.name", lambda x, y: None) 42 | mocker.patch.object(obj, "attr", lambda x, y: None) | -error[PT008]: PT008.py:41:1: Use `return_value=` instead of patching with `lambda` +error[PT008]: 41:1: Use `return_value=` instead of patching with `lambda` + --> PT008.py:40:47 | 40 | mocker.patch("module.name", lambda x, y: None) 41 | module_mocker.patch("module.name", lambda x, y: None) @@ -58,8 +64,9 @@ error[PT008]: PT008.py:41:1: Use `return_value=` instead of patching with `lambd 42 | mocker.patch.object(obj, "attr", lambda x, y: None) 43 | module_mocker.patch.object(obj, "attr", lambda x, y: None) | -error[PT008]: PT008.py:42:1: Use `return_value=` instead of patching with `lambda` +error[PT008]: 42:1: Use `return_value=` instead of patching with `lambda` + --> PT008.py:41:54 | 40 | mocker.patch("module.name", lambda x, y: None) 41 | module_mocker.patch("module.name", lambda x, y: None) @@ -67,8 +74,9 @@ error[PT008]: PT008.py:42:1: Use `return_value=` instead of patching with `lambd | ^^^^^^^^^^^^^^^^^^^ 43 | module_mocker.patch.object(obj, "attr", lambda x, y: None) | -error[PT008]: PT008.py:43:1: Use `return_value=` instead of patching with `lambda` +error[PT008]: 43:1: Use `return_value=` instead of patching with `lambda` + --> PT008.py:42:52 | 41 | module_mocker.patch("module.name", lambda x, y: None) 42 | mocker.patch.object(obj, "attr", lambda x, y: None) @@ -77,8 +85,9 @@ error[PT008]: PT008.py:43:1: Use `return_value=` instead of patching with `lambd 44 | 45 | mocker.patch("module.name", lambda *args, **kwargs: None) | -error[PT008]: PT008.py:45:1: Use `return_value=` instead of patching with `lambda` +error[PT008]: 45:1: Use `return_value=` instead of patching with `lambda` + --> PT008.py:44:1 | 43 | module_mocker.patch.object(obj, "attr", lambda x, y: None) 44 | @@ -87,8 +96,9 @@ error[PT008]: PT008.py:45:1: Use `return_value=` instead of patching with `lambd 46 | module_mocker.patch("module.name", lambda *args, **kwargs: None) 47 | mocker.patch.object(obj, "attr", lambda *args, **kwargs: None) | -error[PT008]: PT008.py:46:1: Use `return_value=` instead of patching with `lambda` +error[PT008]: 46:1: Use `return_value=` instead of patching with `lambda` + --> PT008.py:45:58 | 45 | mocker.patch("module.name", lambda *args, **kwargs: None) 46 | module_mocker.patch("module.name", lambda *args, **kwargs: None) @@ -96,8 +106,9 @@ error[PT008]: PT008.py:46:1: Use `return_value=` instead of patching with `lambd 47 | mocker.patch.object(obj, "attr", lambda *args, **kwargs: None) 48 | module_mocker.patch.object(obj, "attr", lambda *args, **kwargs: None) | -error[PT008]: PT008.py:47:1: Use `return_value=` instead of patching with `lambda` +error[PT008]: 47:1: Use `return_value=` instead of patching with `lambda` + --> PT008.py:46:65 | 45 | mocker.patch("module.name", lambda *args, **kwargs: None) 46 | module_mocker.patch("module.name", lambda *args, **kwargs: None) @@ -105,8 +116,9 @@ error[PT008]: PT008.py:47:1: Use `return_value=` instead of patching with `lambd | ^^^^^^^^^^^^^^^^^^^ 48 | module_mocker.patch.object(obj, "attr", lambda *args, **kwargs: None) | -error[PT008]: PT008.py:48:1: Use `return_value=` instead of patching with `lambda` +error[PT008]: 48:1: Use `return_value=` instead of patching with `lambda` + --> PT008.py:47:63 | 46 | module_mocker.patch("module.name", lambda *args, **kwargs: None) 47 | mocker.patch.object(obj, "attr", lambda *args, **kwargs: None) diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT009.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT009.snap index e9fdf93a88..c609d40511 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT009.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT009.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs --- -error[PT009]: PT009.py:11:9: [*] Use a regular `assert` instead of unittest-style `assertTrue` +error[PT009]: 11:9: [*] Use a regular `assert` instead of unittest-style `assertTrue` + --> PT009.py:11:9 | 9 | expr = 1 10 | msg = "Must be True" @@ -22,8 +23,9 @@ error[PT009]: PT009.py:11:9: [*] Use a regular `assert` instead of unittest-styl 13 13 | self.assertTrue(expr, msg) # Error 14 14 | self.assertTrue(expr=expr, msg=msg) # Error -error[PT009]: PT009.py:12:9: [*] Use a regular `assert` instead of unittest-style `assertTrue` +error[PT009]: 12:9: [*] Use a regular `assert` instead of unittest-style `assertTrue` + --> PT009.py:12:9 | 10 | msg = "Must be True" 11 | self.assertTrue(expr) # Error @@ -43,8 +45,9 @@ error[PT009]: PT009.py:12:9: [*] Use a regular `assert` instead of unittest-styl 14 14 | self.assertTrue(expr=expr, msg=msg) # Error 15 15 | self.assertTrue(msg=msg, expr=expr) # Error -error[PT009]: PT009.py:13:9: [*] Use a regular `assert` instead of unittest-style `assertTrue` +error[PT009]: 13:9: [*] Use a regular `assert` instead of unittest-style `assertTrue` + --> PT009.py:13:9 | 11 | self.assertTrue(expr) # Error 12 | self.assertTrue(expr=expr) # Error @@ -64,8 +67,9 @@ error[PT009]: PT009.py:13:9: [*] Use a regular `assert` instead of unittest-styl 15 15 | self.assertTrue(msg=msg, expr=expr) # Error 16 16 | self.assertTrue(*(expr, msg)) # Error, unfixable -error[PT009]: PT009.py:14:9: [*] Use a regular `assert` instead of unittest-style `assertTrue` +error[PT009]: 14:9: [*] Use a regular `assert` instead of unittest-style `assertTrue` + --> PT009.py:14:9 | 12 | self.assertTrue(expr=expr) # Error 13 | self.assertTrue(expr, msg) # Error @@ -85,8 +89,9 @@ error[PT009]: PT009.py:14:9: [*] Use a regular `assert` instead of unittest-styl 16 16 | self.assertTrue(*(expr, msg)) # Error, unfixable 17 17 | self.assertTrue(**{"expr": expr, "msg": msg}) # Error, unfixable -error[PT009]: PT009.py:15:9: [*] Use a regular `assert` instead of unittest-style `assertTrue` +error[PT009]: 15:9: [*] Use a regular `assert` instead of unittest-style `assertTrue` + --> PT009.py:15:9 | 13 | self.assertTrue(expr, msg) # Error 14 | self.assertTrue(expr=expr, msg=msg) # Error @@ -106,8 +111,9 @@ error[PT009]: PT009.py:15:9: [*] Use a regular `assert` instead of unittest-styl 17 17 | self.assertTrue(**{"expr": expr, "msg": msg}) # Error, unfixable 18 18 | self.assertTrue(msg=msg, expr=expr, unexpected_arg=False) # Error, unfixable -error[PT009]: PT009.py:16:9: Use a regular `assert` instead of unittest-style `assertTrue` +error[PT009]: 16:9: Use a regular `assert` instead of unittest-style `assertTrue` + --> PT009.py:16:9 | 14 | self.assertTrue(expr=expr, msg=msg) # Error 15 | self.assertTrue(msg=msg, expr=expr) # Error @@ -117,8 +123,9 @@ error[PT009]: PT009.py:16:9: Use a regular `assert` instead of unittest-style `a 18 | self.assertTrue(msg=msg, expr=expr, unexpected_arg=False) # Error, unfixable | = help: Replace `assertTrue(...)` with `assert ...` -error[PT009]: PT009.py:17:9: Use a regular `assert` instead of unittest-style `assertTrue` +error[PT009]: 17:9: Use a regular `assert` instead of unittest-style `assertTrue` + --> PT009.py:17:9 | 15 | self.assertTrue(msg=msg, expr=expr) # Error 16 | self.assertTrue(*(expr, msg)) # Error, unfixable @@ -128,8 +135,9 @@ error[PT009]: PT009.py:17:9: Use a regular `assert` instead of unittest-style `a 19 | self.assertTrue(msg=msg) # Error, unfixable | = help: Replace `assertTrue(...)` with `assert ...` -error[PT009]: PT009.py:18:9: Use a regular `assert` instead of unittest-style `assertTrue` +error[PT009]: 18:9: Use a regular `assert` instead of unittest-style `assertTrue` + --> PT009.py:18:9 | 16 | self.assertTrue(*(expr, msg)) # Error, unfixable 17 | self.assertTrue(**{"expr": expr, "msg": msg}) # Error, unfixable @@ -139,8 +147,9 @@ error[PT009]: PT009.py:18:9: Use a regular `assert` instead of unittest-style `a 20 | ( | = help: Replace `assertTrue(...)` with `assert ...` -error[PT009]: PT009.py:19:9: Use a regular `assert` instead of unittest-style `assertTrue` +error[PT009]: 19:9: Use a regular `assert` instead of unittest-style `assertTrue` + --> PT009.py:19:9 | 17 | self.assertTrue(**{"expr": expr, "msg": msg}) # Error, unfixable 18 | self.assertTrue(msg=msg, expr=expr, unexpected_arg=False) # Error, unfixable @@ -150,8 +159,9 @@ error[PT009]: PT009.py:19:9: Use a regular `assert` instead of unittest-style `a 21 | self.assertIsNotNone(value) # Error, unfixable | = help: Replace `assertTrue(...)` with `assert ...` -error[PT009]: PT009.py:21:13: Use a regular `assert` instead of unittest-style `assertIsNotNone` +error[PT009]: 21:13: Use a regular `assert` instead of unittest-style `assertIsNotNone` + --> PT009.py:21:13 | 19 | self.assertTrue(msg=msg) # Error, unfixable 20 | ( @@ -161,8 +171,9 @@ error[PT009]: PT009.py:21:13: Use a regular `assert` instead of unittest-style ` 23 | else self.assertIsNone(value) # Error, unfixable | = help: Replace `assertIsNotNone(...)` with `assert ...` -error[PT009]: PT009.py:23:18: Use a regular `assert` instead of unittest-style `assertIsNone` +error[PT009]: 23:18: Use a regular `assert` instead of unittest-style `assertIsNone` + --> PT009.py:23:18 | 21 | self.assertIsNotNone(value) # Error, unfixable 22 | if expect_condition @@ -172,8 +183,9 @@ error[PT009]: PT009.py:23:18: Use a regular `assert` instead of unittest-style ` 25 | return self.assertEqual(True, False) # Error, unfixable | = help: Replace `assertIsNone(...)` with `assert ...` -error[PT009]: PT009.py:25:16: Use a regular `assert` instead of unittest-style `assertEqual` +error[PT009]: 25:16: Use a regular `assert` instead of unittest-style `assertEqual` + --> PT009.py:25:16 | 23 | else self.assertIsNone(value) # Error, unfixable 24 | ) @@ -183,8 +195,9 @@ error[PT009]: PT009.py:25:16: Use a regular `assert` instead of unittest-style ` 27 | def test_assert_false(self): | = help: Replace `assertEqual(...)` with `assert ...` -error[PT009]: PT009.py:28:9: [*] Use a regular `assert` instead of unittest-style `assertFalse` +error[PT009]: 28:9: [*] Use a regular `assert` instead of unittest-style `assertFalse` + --> PT009.py:28:9 | 27 | def test_assert_false(self): 28 | self.assertFalse(True) # Error @@ -203,8 +216,9 @@ error[PT009]: PT009.py:28:9: [*] Use a regular `assert` instead of unittest-styl 30 30 | def test_assert_equal(self): 31 31 | self.assertEqual(1, 2) # Error -error[PT009]: PT009.py:31:9: [*] Use a regular `assert` instead of unittest-style `assertEqual` +error[PT009]: 31:9: [*] Use a regular `assert` instead of unittest-style `assertEqual` + --> PT009.py:31:9 | 30 | def test_assert_equal(self): 31 | self.assertEqual(1, 2) # Error @@ -223,8 +237,9 @@ error[PT009]: PT009.py:31:9: [*] Use a regular `assert` instead of unittest-styl 33 33 | def test_assert_not_equal(self): 34 34 | self.assertNotEqual(1, 1) # Error -error[PT009]: PT009.py:34:9: [*] Use a regular `assert` instead of unittest-style `assertNotEqual` +error[PT009]: 34:9: [*] Use a regular `assert` instead of unittest-style `assertNotEqual` + --> PT009.py:34:9 | 33 | def test_assert_not_equal(self): 34 | self.assertNotEqual(1, 1) # Error @@ -243,8 +258,9 @@ error[PT009]: PT009.py:34:9: [*] Use a regular `assert` instead of unittest-styl 36 36 | def test_assert_greater(self): 37 37 | self.assertGreater(1, 2) # Error -error[PT009]: PT009.py:37:9: [*] Use a regular `assert` instead of unittest-style `assertGreater` +error[PT009]: 37:9: [*] Use a regular `assert` instead of unittest-style `assertGreater` + --> PT009.py:37:9 | 36 | def test_assert_greater(self): 37 | self.assertGreater(1, 2) # Error @@ -263,8 +279,9 @@ error[PT009]: PT009.py:37:9: [*] Use a regular `assert` instead of unittest-styl 39 39 | def test_assert_greater_equal(self): 40 40 | self.assertGreaterEqual(1, 2) # Error -error[PT009]: PT009.py:40:9: [*] Use a regular `assert` instead of unittest-style `assertGreaterEqual` +error[PT009]: 40:9: [*] Use a regular `assert` instead of unittest-style `assertGreaterEqual` + --> PT009.py:40:9 | 39 | def test_assert_greater_equal(self): 40 | self.assertGreaterEqual(1, 2) # Error @@ -283,8 +300,9 @@ error[PT009]: PT009.py:40:9: [*] Use a regular `assert` instead of unittest-styl 42 42 | def test_assert_less(self): 43 43 | self.assertLess(2, 1) # Error -error[PT009]: PT009.py:43:9: [*] Use a regular `assert` instead of unittest-style `assertLess` +error[PT009]: 43:9: [*] Use a regular `assert` instead of unittest-style `assertLess` + --> PT009.py:43:9 | 42 | def test_assert_less(self): 43 | self.assertLess(2, 1) # Error @@ -303,8 +321,9 @@ error[PT009]: PT009.py:43:9: [*] Use a regular `assert` instead of unittest-styl 45 45 | def test_assert_less_equal(self): 46 46 | self.assertLessEqual(1, 2) # Error -error[PT009]: PT009.py:46:9: [*] Use a regular `assert` instead of unittest-style `assertLessEqual` +error[PT009]: 46:9: [*] Use a regular `assert` instead of unittest-style `assertLessEqual` + --> PT009.py:46:9 | 45 | def test_assert_less_equal(self): 46 | self.assertLessEqual(1, 2) # Error @@ -323,8 +342,9 @@ error[PT009]: PT009.py:46:9: [*] Use a regular `assert` instead of unittest-styl 48 48 | def test_assert_in(self): 49 49 | self.assertIn(1, [2, 3]) # Error -error[PT009]: PT009.py:49:9: [*] Use a regular `assert` instead of unittest-style `assertIn` +error[PT009]: 49:9: [*] Use a regular `assert` instead of unittest-style `assertIn` + --> PT009.py:49:9 | 48 | def test_assert_in(self): 49 | self.assertIn(1, [2, 3]) # Error @@ -343,8 +363,9 @@ error[PT009]: PT009.py:49:9: [*] Use a regular `assert` instead of unittest-styl 51 51 | def test_assert_not_in(self): 52 52 | self.assertNotIn(2, [2, 3]) # Error -error[PT009]: PT009.py:52:9: [*] Use a regular `assert` instead of unittest-style `assertNotIn` +error[PT009]: 52:9: [*] Use a regular `assert` instead of unittest-style `assertNotIn` + --> PT009.py:52:9 | 51 | def test_assert_not_in(self): 52 | self.assertNotIn(2, [2, 3]) # Error @@ -363,8 +384,9 @@ error[PT009]: PT009.py:52:9: [*] Use a regular `assert` instead of unittest-styl 54 54 | def test_assert_is_none(self): 55 55 | self.assertIsNone(0) # Error -error[PT009]: PT009.py:55:9: [*] Use a regular `assert` instead of unittest-style `assertIsNone` +error[PT009]: 55:9: [*] Use a regular `assert` instead of unittest-style `assertIsNone` + --> PT009.py:55:9 | 54 | def test_assert_is_none(self): 55 | self.assertIsNone(0) # Error @@ -383,8 +405,9 @@ error[PT009]: PT009.py:55:9: [*] Use a regular `assert` instead of unittest-styl 57 57 | def test_assert_is_not_none(self): 58 58 | self.assertIsNotNone(0) # Error -error[PT009]: PT009.py:58:9: [*] Use a regular `assert` instead of unittest-style `assertIsNotNone` +error[PT009]: 58:9: [*] Use a regular `assert` instead of unittest-style `assertIsNotNone` + --> PT009.py:58:9 | 57 | def test_assert_is_not_none(self): 58 | self.assertIsNotNone(0) # Error @@ -403,8 +426,9 @@ error[PT009]: PT009.py:58:9: [*] Use a regular `assert` instead of unittest-styl 60 60 | def test_assert_is(self): 61 61 | self.assertIs([], []) # Error -error[PT009]: PT009.py:61:9: [*] Use a regular `assert` instead of unittest-style `assertIs` +error[PT009]: 61:9: [*] Use a regular `assert` instead of unittest-style `assertIs` + --> PT009.py:61:9 | 60 | def test_assert_is(self): 61 | self.assertIs([], []) # Error @@ -423,8 +447,9 @@ error[PT009]: PT009.py:61:9: [*] Use a regular `assert` instead of unittest-styl 63 63 | def test_assert_is_not(self): 64 64 | self.assertIsNot(1, 1) # Error -error[PT009]: PT009.py:64:9: [*] Use a regular `assert` instead of unittest-style `assertIsNot` +error[PT009]: 64:9: [*] Use a regular `assert` instead of unittest-style `assertIsNot` + --> PT009.py:64:9 | 63 | def test_assert_is_not(self): 64 | self.assertIsNot(1, 1) # Error @@ -443,8 +468,9 @@ error[PT009]: PT009.py:64:9: [*] Use a regular `assert` instead of unittest-styl 66 66 | def test_assert_is_instance(self): 67 67 | self.assertIsInstance(1, str) # Error -error[PT009]: PT009.py:67:9: [*] Use a regular `assert` instead of unittest-style `assertIsInstance` +error[PT009]: 67:9: [*] Use a regular `assert` instead of unittest-style `assertIsInstance` + --> PT009.py:67:9 | 66 | def test_assert_is_instance(self): 67 | self.assertIsInstance(1, str) # Error @@ -463,8 +489,9 @@ error[PT009]: PT009.py:67:9: [*] Use a regular `assert` instead of unittest-styl 69 69 | def test_assert_is_not_instance(self): 70 70 | self.assertNotIsInstance(1, int) # Error -error[PT009]: PT009.py:70:9: [*] Use a regular `assert` instead of unittest-style `assertNotIsInstance` +error[PT009]: 70:9: [*] Use a regular `assert` instead of unittest-style `assertNotIsInstance` + --> PT009.py:70:9 | 69 | def test_assert_is_not_instance(self): 70 | self.assertNotIsInstance(1, int) # Error @@ -483,8 +510,9 @@ error[PT009]: PT009.py:70:9: [*] Use a regular `assert` instead of unittest-styl 72 72 | def test_assert_regex(self): 73 73 | self.assertRegex("abc", r"def") # Error -error[PT009]: PT009.py:73:9: [*] Use a regular `assert` instead of unittest-style `assertRegex` +error[PT009]: 73:9: [*] Use a regular `assert` instead of unittest-style `assertRegex` + --> PT009.py:73:9 | 72 | def test_assert_regex(self): 73 | self.assertRegex("abc", r"def") # Error @@ -503,8 +531,9 @@ error[PT009]: PT009.py:73:9: [*] Use a regular `assert` instead of unittest-styl 75 75 | def test_assert_not_regex(self): 76 76 | self.assertNotRegex("abc", r"abc") # Error -error[PT009]: PT009.py:76:9: [*] Use a regular `assert` instead of unittest-style `assertNotRegex` +error[PT009]: 76:9: [*] Use a regular `assert` instead of unittest-style `assertNotRegex` + --> PT009.py:76:9 | 75 | def test_assert_not_regex(self): 76 | self.assertNotRegex("abc", r"abc") # Error @@ -523,8 +552,9 @@ error[PT009]: PT009.py:76:9: [*] Use a regular `assert` instead of unittest-styl 78 78 | def test_assert_regexp_matches(self): 79 79 | self.assertRegexpMatches("abc", r"def") # Error -error[PT009]: PT009.py:79:9: [*] Use a regular `assert` instead of unittest-style `assertRegexpMatches` +error[PT009]: 79:9: [*] Use a regular `assert` instead of unittest-style `assertRegexpMatches` + --> PT009.py:79:9 | 78 | def test_assert_regexp_matches(self): 79 | self.assertRegexpMatches("abc", r"def") # Error @@ -543,8 +573,9 @@ error[PT009]: PT009.py:79:9: [*] Use a regular `assert` instead of unittest-styl 81 81 | def test_assert_not_regexp_matches(self): 82 82 | self.assertNotRegex("abc", r"abc") # Error -error[PT009]: PT009.py:82:9: [*] Use a regular `assert` instead of unittest-style `assertNotRegex` +error[PT009]: 82:9: [*] Use a regular `assert` instead of unittest-style `assertNotRegex` + --> PT009.py:82:9 | 81 | def test_assert_not_regexp_matches(self): 82 | self.assertNotRegex("abc", r"abc") # Error @@ -563,8 +594,9 @@ error[PT009]: PT009.py:82:9: [*] Use a regular `assert` instead of unittest-styl 84 84 | def test_fail_if(self): 85 85 | self.failIf("abc") # Error -error[PT009]: PT009.py:85:9: [*] Use a regular `assert` instead of unittest-style `failIf` +error[PT009]: 85:9: [*] Use a regular `assert` instead of unittest-style `failIf` + --> PT009.py:85:9 | 84 | def test_fail_if(self): 85 | self.failIf("abc") # Error @@ -583,8 +615,9 @@ error[PT009]: PT009.py:85:9: [*] Use a regular `assert` instead of unittest-styl 87 87 | def test_fail_unless(self): 88 88 | self.failUnless("abc") # Error -error[PT009]: PT009.py:88:9: [*] Use a regular `assert` instead of unittest-style `failUnless` +error[PT009]: 88:9: [*] Use a regular `assert` instead of unittest-style `failUnless` + --> PT009.py:88:9 | 87 | def test_fail_unless(self): 88 | self.failUnless("abc") # Error @@ -603,8 +636,9 @@ error[PT009]: PT009.py:88:9: [*] Use a regular `assert` instead of unittest-styl 90 90 | def test_fail_unless_equal(self): 91 91 | self.failUnlessEqual(1, 2) # Error -error[PT009]: PT009.py:91:9: [*] Use a regular `assert` instead of unittest-style `failUnlessEqual` +error[PT009]: 91:9: [*] Use a regular `assert` instead of unittest-style `failUnlessEqual` + --> PT009.py:91:9 | 90 | def test_fail_unless_equal(self): 91 | self.failUnlessEqual(1, 2) # Error @@ -623,8 +657,9 @@ error[PT009]: PT009.py:91:9: [*] Use a regular `assert` instead of unittest-styl 93 93 | def test_fail_if_equal(self): 94 94 | self.failIfEqual(1, 2) # Error -error[PT009]: PT009.py:94:9: [*] Use a regular `assert` instead of unittest-style `failIfEqual` +error[PT009]: 94:9: [*] Use a regular `assert` instead of unittest-style `failIfEqual` + --> PT009.py:94:9 | 93 | def test_fail_if_equal(self): 94 | self.failIfEqual(1, 2) # Error @@ -641,8 +676,9 @@ error[PT009]: PT009.py:94:9: [*] Use a regular `assert` instead of unittest-styl 96 96 | 97 97 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1722459517 -error[PT009]: PT009.py:98:2: [*] Use a regular `assert` instead of unittest-style `assertTrue` +error[PT009]: 98:2: [*] Use a regular `assert` instead of unittest-style `assertTrue` + --> PT009.py:98:2 | 97 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1722459517 98 | (self.assertTrue( diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT010.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT010.snap index 0fa0be41c2..254f44f12e 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT010.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT010.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs --- -error[PT010]: PT010.py:5:10: set the expected exception in `pytest.raises()` +error[PT010]: 5:10: set the expected exception in `pytest.raises()` + --> PT010.py:5:10 | 4 | def test_ok(): 5 | with pytest.raises(): diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT011_default.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT011_default.snap index 4b5ac1f574..208673d3c5 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT011_default.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT011_default.snap @@ -1,16 +1,18 @@ --- source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs --- -error[PT011]: PT011.py:18:24: `pytest.raises(ValueError)` is too broad, set the `match` parameter or use a more specific exception +error[PT011]: 18:24: `pytest.raises(ValueError)` is too broad, set the `match` parameter or use a more specific exception + --> PT011.py:18:24 | 17 | def test_error_no_argument_given(): 18 | with pytest.raises(ValueError): | ^^^^^^^^^^ 19 | raise ValueError("Can't divide 1 by 0") | -error[PT011]: PT011.py:21:24: `pytest.raises(socket.error)` is too broad, set the `match` parameter or use a more specific exception +error[PT011]: 21:24: `pytest.raises(socket.error)` is too broad, set the `match` parameter or use a more specific exception + --> PT011.py:21:24 | 19 | raise ValueError("Can't divide 1 by 0") 20 | @@ -18,16 +20,18 @@ error[PT011]: PT011.py:21:24: `pytest.raises(socket.error)` is too broad, set th | ^^^^^^^^^^^^ 22 | raise ValueError("Can't divide 1 by 0") | -error[PT011]: PT011.py:32:24: `pytest.raises(ValueError)` is too broad, set the `match` parameter or use a more specific exception +error[PT011]: 32:24: `pytest.raises(ValueError)` is too broad, set the `match` parameter or use a more specific exception + --> PT011.py:32:24 | 31 | def test_error_match_is_empty(): 32 | with pytest.raises(ValueError, match=None): | ^^^^^^^^^^ 33 | raise ValueError("Can't divide 1 by 0") | -error[PT011]: PT011.py:35:24: `pytest.raises(ValueError)` is too broad, set the `match` parameter or use a more specific exception +error[PT011]: 35:24: `pytest.raises(ValueError)` is too broad, set the `match` parameter or use a more specific exception + --> PT011.py:35:24 | 33 | raise ValueError("Can't divide 1 by 0") 34 | @@ -35,8 +39,9 @@ error[PT011]: PT011.py:35:24: `pytest.raises(ValueError)` is too broad, set the | ^^^^^^^^^^ 36 | raise ValueError("Can't divide 1 by 0") | -error[PT011]: PT011.py:38:24: `pytest.raises(ValueError)` is too broad, set the `match` parameter or use a more specific exception +error[PT011]: 38:24: `pytest.raises(ValueError)` is too broad, set the `match` parameter or use a more specific exception + --> PT011.py:38:24 | 36 | raise ValueError("Can't divide 1 by 0") 37 | diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT011_extend_broad_exceptions.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT011_extend_broad_exceptions.snap index 5a7f1a5212..fadfdb0f5e 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT011_extend_broad_exceptions.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT011_extend_broad_exceptions.snap @@ -1,24 +1,27 @@ --- source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs --- -error[PT011]: PT011.py:13:24: `pytest.raises(ZeroDivisionError)` is too broad, set the `match` parameter or use a more specific exception +error[PT011]: 13:24: `pytest.raises(ZeroDivisionError)` is too broad, set the `match` parameter or use a more specific exception + --> PT011.py:13:24 | 12 | def test_ok_different_error_from_config(): 13 | with pytest.raises(ZeroDivisionError): | ^^^^^^^^^^^^^^^^^ 14 | raise ZeroDivisionError("Can't divide by 0") | -error[PT011]: PT011.py:18:24: `pytest.raises(ValueError)` is too broad, set the `match` parameter or use a more specific exception +error[PT011]: 18:24: `pytest.raises(ValueError)` is too broad, set the `match` parameter or use a more specific exception + --> PT011.py:18:24 | 17 | def test_error_no_argument_given(): 18 | with pytest.raises(ValueError): | ^^^^^^^^^^ 19 | raise ValueError("Can't divide 1 by 0") | -error[PT011]: PT011.py:21:24: `pytest.raises(socket.error)` is too broad, set the `match` parameter or use a more specific exception +error[PT011]: 21:24: `pytest.raises(socket.error)` is too broad, set the `match` parameter or use a more specific exception + --> PT011.py:21:24 | 19 | raise ValueError("Can't divide 1 by 0") 20 | @@ -26,16 +29,18 @@ error[PT011]: PT011.py:21:24: `pytest.raises(socket.error)` is too broad, set th | ^^^^^^^^^^^^ 22 | raise ValueError("Can't divide 1 by 0") | -error[PT011]: PT011.py:32:24: `pytest.raises(ValueError)` is too broad, set the `match` parameter or use a more specific exception +error[PT011]: 32:24: `pytest.raises(ValueError)` is too broad, set the `match` parameter or use a more specific exception + --> PT011.py:32:24 | 31 | def test_error_match_is_empty(): 32 | with pytest.raises(ValueError, match=None): | ^^^^^^^^^^ 33 | raise ValueError("Can't divide 1 by 0") | -error[PT011]: PT011.py:35:24: `pytest.raises(ValueError)` is too broad, set the `match` parameter or use a more specific exception +error[PT011]: 35:24: `pytest.raises(ValueError)` is too broad, set the `match` parameter or use a more specific exception + --> PT011.py:35:24 | 33 | raise ValueError("Can't divide 1 by 0") 34 | @@ -43,8 +48,9 @@ error[PT011]: PT011.py:35:24: `pytest.raises(ValueError)` is too broad, set the | ^^^^^^^^^^ 36 | raise ValueError("Can't divide 1 by 0") | -error[PT011]: PT011.py:38:24: `pytest.raises(ValueError)` is too broad, set the `match` parameter or use a more specific exception +error[PT011]: 38:24: `pytest.raises(ValueError)` is too broad, set the `match` parameter or use a more specific exception + --> PT011.py:38:24 | 36 | raise ValueError("Can't divide 1 by 0") 37 | diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT011_glob_all.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT011_glob_all.snap index 682125aed5..aab5b17c9b 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT011_glob_all.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT011_glob_all.snap @@ -1,24 +1,27 @@ --- source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs --- -error[PT011]: PT011.py:13:24: `pytest.raises(ZeroDivisionError)` is too broad, set the `match` parameter or use a more specific exception +error[PT011]: 13:24: `pytest.raises(ZeroDivisionError)` is too broad, set the `match` parameter or use a more specific exception + --> PT011.py:13:24 | 12 | def test_ok_different_error_from_config(): 13 | with pytest.raises(ZeroDivisionError): | ^^^^^^^^^^^^^^^^^ 14 | raise ZeroDivisionError("Can't divide by 0") | -error[PT011]: PT011.py:18:24: `pytest.raises(ValueError)` is too broad, set the `match` parameter or use a more specific exception +error[PT011]: 18:24: `pytest.raises(ValueError)` is too broad, set the `match` parameter or use a more specific exception + --> PT011.py:18:24 | 17 | def test_error_no_argument_given(): 18 | with pytest.raises(ValueError): | ^^^^^^^^^^ 19 | raise ValueError("Can't divide 1 by 0") | -error[PT011]: PT011.py:21:24: `pytest.raises(socket.error)` is too broad, set the `match` parameter or use a more specific exception +error[PT011]: 21:24: `pytest.raises(socket.error)` is too broad, set the `match` parameter or use a more specific exception + --> PT011.py:21:24 | 19 | raise ValueError("Can't divide 1 by 0") 20 | @@ -26,8 +29,9 @@ error[PT011]: PT011.py:21:24: `pytest.raises(socket.error)` is too broad, set th | ^^^^^^^^^^^^ 22 | raise ValueError("Can't divide 1 by 0") | -error[PT011]: PT011.py:24:24: `pytest.raises(pickle.PicklingError)` is too broad, set the `match` parameter or use a more specific exception +error[PT011]: 24:24: `pytest.raises(pickle.PicklingError)` is too broad, set the `match` parameter or use a more specific exception + --> PT011.py:24:24 | 22 | raise ValueError("Can't divide 1 by 0") 23 | @@ -35,8 +39,9 @@ error[PT011]: PT011.py:24:24: `pytest.raises(pickle.PicklingError)` is too broad | ^^^^^^^^^^^^^ 25 | raise PicklingError("Can't pickle") | -error[PT011]: PT011.py:27:24: `pytest.raises(pickle.UnpicklingError)` is too broad, set the `match` parameter or use a more specific exception +error[PT011]: 27:24: `pytest.raises(pickle.UnpicklingError)` is too broad, set the `match` parameter or use a more specific exception + --> PT011.py:27:24 | 25 | raise PicklingError("Can't pickle") 26 | @@ -44,16 +49,18 @@ error[PT011]: PT011.py:27:24: `pytest.raises(pickle.UnpicklingError)` is too bro | ^^^^^^^^^^^^^^^ 28 | raise UnpicklingError("Can't unpickle") | -error[PT011]: PT011.py:32:24: `pytest.raises(ValueError)` is too broad, set the `match` parameter or use a more specific exception +error[PT011]: 32:24: `pytest.raises(ValueError)` is too broad, set the `match` parameter or use a more specific exception + --> PT011.py:32:24 | 31 | def test_error_match_is_empty(): 32 | with pytest.raises(ValueError, match=None): | ^^^^^^^^^^ 33 | raise ValueError("Can't divide 1 by 0") | -error[PT011]: PT011.py:35:24: `pytest.raises(ValueError)` is too broad, set the `match` parameter or use a more specific exception +error[PT011]: 35:24: `pytest.raises(ValueError)` is too broad, set the `match` parameter or use a more specific exception + --> PT011.py:35:24 | 33 | raise ValueError("Can't divide 1 by 0") 34 | @@ -61,8 +68,9 @@ error[PT011]: PT011.py:35:24: `pytest.raises(ValueError)` is too broad, set the | ^^^^^^^^^^ 36 | raise ValueError("Can't divide 1 by 0") | -error[PT011]: PT011.py:38:24: `pytest.raises(ValueError)` is too broad, set the `match` parameter or use a more specific exception +error[PT011]: 38:24: `pytest.raises(ValueError)` is too broad, set the `match` parameter or use a more specific exception + --> PT011.py:38:24 | 36 | raise ValueError("Can't divide 1 by 0") 37 | diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT011_glob_prefix.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT011_glob_prefix.snap index a081f4370c..bf51811f5a 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT011_glob_prefix.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT011_glob_prefix.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs --- -error[PT011]: PT011.py:24:24: `pytest.raises(pickle.PicklingError)` is too broad, set the `match` parameter or use a more specific exception +error[PT011]: 24:24: `pytest.raises(pickle.PicklingError)` is too broad, set the `match` parameter or use a more specific exception + --> PT011.py:24:24 | 22 | raise ValueError("Can't divide 1 by 0") 23 | @@ -10,8 +11,9 @@ error[PT011]: PT011.py:24:24: `pytest.raises(pickle.PicklingError)` is too broad | ^^^^^^^^^^^^^ 25 | raise PicklingError("Can't pickle") | -error[PT011]: PT011.py:27:24: `pytest.raises(pickle.UnpicklingError)` is too broad, set the `match` parameter or use a more specific exception +error[PT011]: 27:24: `pytest.raises(pickle.UnpicklingError)` is too broad, set the `match` parameter or use a more specific exception + --> PT011.py:27:24 | 25 | raise PicklingError("Can't pickle") 26 | diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT011_replace_broad_exceptions.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT011_replace_broad_exceptions.snap index e5ce467a75..3fec410305 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT011_replace_broad_exceptions.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT011_replace_broad_exceptions.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs --- -error[PT011]: PT011.py:13:24: `pytest.raises(ZeroDivisionError)` is too broad, set the `match` parameter or use a more specific exception +error[PT011]: 13:24: `pytest.raises(ZeroDivisionError)` is too broad, set the `match` parameter or use a more specific exception + --> PT011.py:13:24 | 12 | def test_ok_different_error_from_config(): 13 | with pytest.raises(ZeroDivisionError): diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT012.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT012.snap index 57ef664cd3..8764172200 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT012.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT012.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs --- -error[PT012]: PT012.py:42:5: `pytest.raises()` block should contain a single simple statement +error[PT012]: 42:5: `pytest.raises()` block should contain a single simple statement + --> PT012.py:42:5 | 41 | def test_error_multiple_statements(): 42 | with pytest.raises(AttributeError): @@ -11,8 +12,9 @@ error[PT012]: PT012.py:42:5: `pytest.raises()` block should contain a single sim 44 | | [].size | |_______________^ | -error[PT012]: PT012.py:48:5: `pytest.raises()` block should contain a single simple statement +error[PT012]: 48:5: `pytest.raises()` block should contain a single simple statement + --> PT012.py:48:5 | 47 | async def test_error_complex_statement(): 48 | with pytest.raises(AttributeError): @@ -23,8 +25,9 @@ error[PT012]: PT012.py:48:5: `pytest.raises()` block should contain a single sim 51 | 52 | with pytest.raises(AttributeError): | -error[PT012]: PT012.py:52:5: `pytest.raises()` block should contain a single simple statement +error[PT012]: 52:5: `pytest.raises()` block should contain a single simple statement + --> PT012.py:52:5 | 50 | [].size 51 | @@ -36,8 +39,9 @@ error[PT012]: PT012.py:52:5: `pytest.raises()` block should contain a single sim 55 | 56 | with pytest.raises(AttributeError): | -error[PT012]: PT012.py:56:5: `pytest.raises()` block should contain a single simple statement +error[PT012]: 56:5: `pytest.raises()` block should contain a single simple statement + --> PT012.py:56:5 | 54 | [].size 55 | @@ -49,8 +53,9 @@ error[PT012]: PT012.py:56:5: `pytest.raises()` block should contain a single sim 59 | 60 | with pytest.raises(AttributeError): | -error[PT012]: PT012.py:60:5: `pytest.raises()` block should contain a single simple statement +error[PT012]: 60:5: `pytest.raises()` block should contain a single simple statement + --> PT012.py:60:5 | 58 | [].size 59 | @@ -62,8 +67,9 @@ error[PT012]: PT012.py:60:5: `pytest.raises()` block should contain a single sim 63 | 64 | with pytest.raises(AttributeError): | -error[PT012]: PT012.py:64:5: `pytest.raises()` block should contain a single simple statement +error[PT012]: 64:5: `pytest.raises()` block should contain a single simple statement + --> PT012.py:64:5 | 62 | [].size 63 | @@ -74,8 +80,9 @@ error[PT012]: PT012.py:64:5: `pytest.raises()` block should contain a single sim 67 | | raise Exception | |_______________________________^ | -error[PT012]: PT012.py:71:5: `pytest.raises()` block should contain a single simple statement +error[PT012]: 71:5: `pytest.raises()` block should contain a single simple statement + --> PT012.py:71:5 | 70 | def test_error_try(): 71 | with pytest.raises(AttributeError): diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT013.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT013.snap index 5906a24987..c3b7632610 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT013.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT013.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs --- -error[PT013]: PT013.py:11:1: Incorrect import of `pytest`; use `import pytest` instead +error[PT013]: 11:1: Incorrect import of `pytest`; use `import pytest` instead + --> PT013.py:10:1 | 9 | # Error 10 | @@ -11,16 +12,18 @@ error[PT013]: PT013.py:11:1: Incorrect import of `pytest`; use `import pytest` i 12 | from pytest import fixture 13 | from pytest import fixture as other_name | -error[PT013]: PT013.py:12:1: Incorrect import of `pytest`; use `import pytest` instead +error[PT013]: 12:1: Incorrect import of `pytest`; use `import pytest` instead + --> PT013.py:11:28 | 11 | import pytest as other_name 12 | from pytest import fixture | ^^^^^^^^^^^^^^^^^^^^^^^^^^ 13 | from pytest import fixture as other_name | -error[PT013]: PT013.py:13:1: Incorrect import of `pytest`; use `import pytest` instead +error[PT013]: 13:1: Incorrect import of `pytest`; use `import pytest` instead + --> PT013.py:12:27 | 11 | import pytest as other_name 12 | from pytest import fixture diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT014.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT014.snap index 5ef1d01182..f966a0e17b 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT014.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT014.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs --- -error[PT014]: PT014.py:4:35: [*] Duplicate of test case at index 0 in `@pytest_mark.parametrize` +error[PT014]: 4:35: [*] Duplicate of test case at index 0 in `@pytest_mark.parametrize` + --> PT014.py:4:35 | 4 | @pytest.mark.parametrize("x", [1, 1, 2]) | ^ @@ -20,8 +21,9 @@ error[PT014]: PT014.py:4:35: [*] Duplicate of test case at index 0 in `@pytest_m 6 6 | ... 7 7 | -error[PT014]: PT014.py:14:35: [*] Duplicate of test case at index 0 in `@pytest_mark.parametrize` +error[PT014]: 14:35: [*] Duplicate of test case at index 0 in `@pytest_mark.parametrize` + --> PT014.py:14:35 | 14 | @pytest.mark.parametrize("x", [a, a, b, b, b, c]) | ^ @@ -39,8 +41,9 @@ error[PT014]: PT014.py:14:35: [*] Duplicate of test case at index 0 in `@pytest_ 16 16 | ... 17 17 | -error[PT014]: PT014.py:14:41: [*] Duplicate of test case at index 2 in `@pytest_mark.parametrize` +error[PT014]: 14:41: [*] Duplicate of test case at index 2 in `@pytest_mark.parametrize` + --> PT014.py:14:41 | 14 | @pytest.mark.parametrize("x", [a, a, b, b, b, c]) | ^ @@ -58,8 +61,9 @@ error[PT014]: PT014.py:14:41: [*] Duplicate of test case at index 2 in `@pytest_ 16 16 | ... 17 17 | -error[PT014]: PT014.py:14:44: [*] Duplicate of test case at index 2 in `@pytest_mark.parametrize` +error[PT014]: 14:44: [*] Duplicate of test case at index 2 in `@pytest_mark.parametrize` + --> PT014.py:14:44 | 14 | @pytest.mark.parametrize("x", [a, a, b, b, b, c]) | ^ @@ -77,8 +81,9 @@ error[PT014]: PT014.py:14:44: [*] Duplicate of test case at index 2 in `@pytest_ 16 16 | ... 17 17 | -error[PT014]: PT014.py:24:9: Duplicate of test case at index 0 in `@pytest_mark.parametrize` +error[PT014]: 24:9: Duplicate of test case at index 0 in `@pytest_mark.parametrize` + --> PT014.py:24:9 | 22 | (a, b), 23 | # comment @@ -88,8 +93,9 @@ error[PT014]: PT014.py:24:9: Duplicate of test case at index 0 in `@pytest_mark. 26 | ], | = help: Remove duplicate test case -error[PT014]: PT014.py:32:39: [*] Duplicate of test case at index 0 in `@pytest_mark.parametrize` +error[PT014]: 32:39: [*] Duplicate of test case at index 0 in `@pytest_mark.parametrize` + --> PT014.py:32:39 | 32 | @pytest.mark.parametrize("x", [a, b, (a), c, ((a))]) | ^ @@ -107,8 +113,9 @@ error[PT014]: PT014.py:32:39: [*] Duplicate of test case at index 0 in `@pytest_ 34 34 | ... 35 35 | -error[PT014]: PT014.py:32:48: [*] Duplicate of test case at index 0 in `@pytest_mark.parametrize` +error[PT014]: 32:48: [*] Duplicate of test case at index 0 in `@pytest_mark.parametrize` + --> PT014.py:32:48 | 32 | @pytest.mark.parametrize("x", [a, b, (a), c, ((a))]) | ^ @@ -126,8 +133,9 @@ error[PT014]: PT014.py:32:48: [*] Duplicate of test case at index 0 in `@pytest_ 34 34 | ... 35 35 | -error[PT014]: PT014.py:42:10: [*] Duplicate of test case at index 0 in `@pytest_mark.parametrize` +error[PT014]: 42:10: [*] Duplicate of test case at index 0 in `@pytest_mark.parametrize` + --> PT014.py:42:10 | 40 | a, 41 | b, @@ -146,8 +154,9 @@ error[PT014]: PT014.py:42:10: [*] Duplicate of test case at index 0 in `@pytest_ 44 43 | ((a)), 45 44 | ], -error[PT014]: PT014.py:44:11: [*] Duplicate of test case at index 0 in `@pytest_mark.parametrize` +error[PT014]: 44:11: [*] Duplicate of test case at index 0 in `@pytest_mark.parametrize` + --> PT014.py:44:11 | 42 | (a), 43 | c, @@ -166,8 +175,9 @@ error[PT014]: PT014.py:44:11: [*] Duplicate of test case at index 0 in `@pytest_ 46 45 | ) 47 46 | def test_error_parentheses_trailing_comma(x): -error[PT014]: PT014.py:56:53: [*] Duplicate of test case at index 0 in `@pytest_mark.parametrize` +error[PT014]: 56:53: [*] Duplicate of test case at index 0 in `@pytest_mark.parametrize` + --> PT014.py:56:53 | 56 | @pytest.mark.parametrize('data, spec', [(1.0, 1.0), (1.0, 1.0)]) | ^^^^^^^^^^ diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT015.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT015.snap index 5b908fd331..dd89d99ea9 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT015.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT015.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs --- -error[PT015]: PT015.py:9:5: Assertion always fails, replace with `pytest.fail()` +error[PT015]: 9:5: Assertion always fails, replace with `pytest.fail()` + --> PT015.py:9:5 | 8 | def test_error(): 9 | assert None @@ -10,8 +11,9 @@ error[PT015]: PT015.py:9:5: Assertion always fails, replace with `pytest.fail()` 10 | assert False 11 | assert 0 | -error[PT015]: PT015.py:10:5: Assertion always fails, replace with `pytest.fail()` +error[PT015]: 10:5: Assertion always fails, replace with `pytest.fail()` + --> PT015.py:10:5 | 8 | def test_error(): 9 | assert None @@ -20,8 +22,9 @@ error[PT015]: PT015.py:10:5: Assertion always fails, replace with `pytest.fail() 11 | assert 0 12 | assert 0.0 | -error[PT015]: PT015.py:11:5: Assertion always fails, replace with `pytest.fail()` +error[PT015]: 11:5: Assertion always fails, replace with `pytest.fail()` + --> PT015.py:11:5 | 9 | assert None 10 | assert False @@ -30,8 +33,9 @@ error[PT015]: PT015.py:11:5: Assertion always fails, replace with `pytest.fail() 12 | assert 0.0 13 | assert "" | -error[PT015]: PT015.py:12:5: Assertion always fails, replace with `pytest.fail()` +error[PT015]: 12:5: Assertion always fails, replace with `pytest.fail()` + --> PT015.py:12:5 | 10 | assert False 11 | assert 0 @@ -40,8 +44,9 @@ error[PT015]: PT015.py:12:5: Assertion always fails, replace with `pytest.fail() 13 | assert "" 14 | assert f"" | -error[PT015]: PT015.py:13:5: Assertion always fails, replace with `pytest.fail()` +error[PT015]: 13:5: Assertion always fails, replace with `pytest.fail()` + --> PT015.py:13:5 | 11 | assert 0 12 | assert 0.0 @@ -50,8 +55,9 @@ error[PT015]: PT015.py:13:5: Assertion always fails, replace with `pytest.fail() 14 | assert f"" 15 | assert [] | -error[PT015]: PT015.py:14:5: Assertion always fails, replace with `pytest.fail()` +error[PT015]: 14:5: Assertion always fails, replace with `pytest.fail()` + --> PT015.py:14:5 | 12 | assert 0.0 13 | assert "" @@ -60,8 +66,9 @@ error[PT015]: PT015.py:14:5: Assertion always fails, replace with `pytest.fail() 15 | assert [] 16 | assert () | -error[PT015]: PT015.py:15:5: Assertion always fails, replace with `pytest.fail()` +error[PT015]: 15:5: Assertion always fails, replace with `pytest.fail()` + --> PT015.py:15:5 | 13 | assert "" 14 | assert f"" @@ -70,8 +77,9 @@ error[PT015]: PT015.py:15:5: Assertion always fails, replace with `pytest.fail() 16 | assert () 17 | assert {} | -error[PT015]: PT015.py:16:5: Assertion always fails, replace with `pytest.fail()` +error[PT015]: 16:5: Assertion always fails, replace with `pytest.fail()` + --> PT015.py:16:5 | 14 | assert f"" 15 | assert [] @@ -80,8 +88,9 @@ error[PT015]: PT015.py:16:5: Assertion always fails, replace with `pytest.fail() 17 | assert {} 18 | assert list() | -error[PT015]: PT015.py:17:5: Assertion always fails, replace with `pytest.fail()` +error[PT015]: 17:5: Assertion always fails, replace with `pytest.fail()` + --> PT015.py:17:5 | 15 | assert [] 16 | assert () @@ -90,8 +99,9 @@ error[PT015]: PT015.py:17:5: Assertion always fails, replace with `pytest.fail() 18 | assert list() 19 | assert set() | -error[PT015]: PT015.py:18:5: Assertion always fails, replace with `pytest.fail()` +error[PT015]: 18:5: Assertion always fails, replace with `pytest.fail()` + --> PT015.py:18:5 | 16 | assert () 17 | assert {} @@ -100,8 +110,9 @@ error[PT015]: PT015.py:18:5: Assertion always fails, replace with `pytest.fail() 19 | assert set() 20 | assert tuple() | -error[PT015]: PT015.py:19:5: Assertion always fails, replace with `pytest.fail()` +error[PT015]: 19:5: Assertion always fails, replace with `pytest.fail()` + --> PT015.py:19:5 | 17 | assert {} 18 | assert list() @@ -110,8 +121,9 @@ error[PT015]: PT015.py:19:5: Assertion always fails, replace with `pytest.fail() 20 | assert tuple() 21 | assert dict() | -error[PT015]: PT015.py:20:5: Assertion always fails, replace with `pytest.fail()` +error[PT015]: 20:5: Assertion always fails, replace with `pytest.fail()` + --> PT015.py:20:5 | 18 | assert list() 19 | assert set() @@ -120,8 +132,9 @@ error[PT015]: PT015.py:20:5: Assertion always fails, replace with `pytest.fail() 21 | assert dict() 22 | assert frozenset() | -error[PT015]: PT015.py:21:5: Assertion always fails, replace with `pytest.fail()` +error[PT015]: 21:5: Assertion always fails, replace with `pytest.fail()` + --> PT015.py:21:5 | 19 | assert set() 20 | assert tuple() @@ -130,8 +143,9 @@ error[PT015]: PT015.py:21:5: Assertion always fails, replace with `pytest.fail() 22 | assert frozenset() 23 | assert list([]) | -error[PT015]: PT015.py:22:5: Assertion always fails, replace with `pytest.fail()` +error[PT015]: 22:5: Assertion always fails, replace with `pytest.fail()` + --> PT015.py:22:5 | 20 | assert tuple() 21 | assert dict() @@ -140,8 +154,9 @@ error[PT015]: PT015.py:22:5: Assertion always fails, replace with `pytest.fail() 23 | assert list([]) 24 | assert set(set()) | -error[PT015]: PT015.py:23:5: Assertion always fails, replace with `pytest.fail()` +error[PT015]: 23:5: Assertion always fails, replace with `pytest.fail()` + --> PT015.py:23:5 | 21 | assert dict() 22 | assert frozenset() @@ -150,8 +165,9 @@ error[PT015]: PT015.py:23:5: Assertion always fails, replace with `pytest.fail() 24 | assert set(set()) 25 | assert tuple("") | -error[PT015]: PT015.py:24:5: Assertion always fails, replace with `pytest.fail()` +error[PT015]: 24:5: Assertion always fails, replace with `pytest.fail()` + --> PT015.py:24:5 | 22 | assert frozenset() 23 | assert list([]) @@ -159,8 +175,9 @@ error[PT015]: PT015.py:24:5: Assertion always fails, replace with `pytest.fail() | ^^^^^^^^^^^^^^^^^ 25 | assert tuple("") | -error[PT015]: PT015.py:25:5: Assertion always fails, replace with `pytest.fail()` +error[PT015]: 25:5: Assertion always fails, replace with `pytest.fail()` + --> PT015.py:25:5 | 23 | assert list([]) 24 | assert set(set()) diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT016.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT016.snap index eec911b31a..5e07682524 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT016.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT016.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs --- -error[PT016]: PT016.py:19:5: No message passed to `pytest.fail()` +error[PT016]: 19:5: No message passed to `pytest.fail()` + --> PT016.py:19:5 | 17 | # Errors 18 | def f(): @@ -11,8 +12,9 @@ error[PT016]: PT016.py:19:5: No message passed to `pytest.fail()` 20 | pytest.fail("") 21 | pytest.fail(f"") | -error[PT016]: PT016.py:20:5: No message passed to `pytest.fail()` +error[PT016]: 20:5: No message passed to `pytest.fail()` + --> PT016.py:20:5 | 18 | def f(): 19 | pytest.fail() @@ -21,8 +23,9 @@ error[PT016]: PT016.py:20:5: No message passed to `pytest.fail()` 21 | pytest.fail(f"") 22 | pytest.fail(msg="") | -error[PT016]: PT016.py:21:5: No message passed to `pytest.fail()` +error[PT016]: 21:5: No message passed to `pytest.fail()` + --> PT016.py:21:5 | 19 | pytest.fail() 20 | pytest.fail("") @@ -31,8 +34,9 @@ error[PT016]: PT016.py:21:5: No message passed to `pytest.fail()` 22 | pytest.fail(msg="") 23 | pytest.fail(msg=f"") | -error[PT016]: PT016.py:22:5: No message passed to `pytest.fail()` +error[PT016]: 22:5: No message passed to `pytest.fail()` + --> PT016.py:22:5 | 20 | pytest.fail("") 21 | pytest.fail(f"") @@ -41,8 +45,9 @@ error[PT016]: PT016.py:22:5: No message passed to `pytest.fail()` 23 | pytest.fail(msg=f"") 24 | pytest.fail(reason="") | -error[PT016]: PT016.py:23:5: No message passed to `pytest.fail()` +error[PT016]: 23:5: No message passed to `pytest.fail()` + --> PT016.py:23:5 | 21 | pytest.fail(f"") 22 | pytest.fail(msg="") @@ -51,8 +56,9 @@ error[PT016]: PT016.py:23:5: No message passed to `pytest.fail()` 24 | pytest.fail(reason="") 25 | pytest.fail(reason=f"") | -error[PT016]: PT016.py:24:5: No message passed to `pytest.fail()` +error[PT016]: 24:5: No message passed to `pytest.fail()` + --> PT016.py:24:5 | 22 | pytest.fail(msg="") 23 | pytest.fail(msg=f"") @@ -60,8 +66,9 @@ error[PT016]: PT016.py:24:5: No message passed to `pytest.fail()` | ^^^^^^^^^^^ 25 | pytest.fail(reason=f"") | -error[PT016]: PT016.py:25:5: No message passed to `pytest.fail()` +error[PT016]: 25:5: No message passed to `pytest.fail()` + --> PT016.py:25:5 | 23 | pytest.fail(msg=f"") 24 | pytest.fail(reason="") diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT017.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT017.snap index aa66b4f460..c9e128a299 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT017.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT017.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs --- -error[PT017]: PT017.py:19:9: Found assertion on exception `e` in `except` block, use `pytest.raises()` instead +error[PT017]: 19:9: Found assertion on exception `e` in `except` block, use `pytest.raises()` instead + --> PT017.py:19:9 | 17 | something() 18 | except Exception as e: diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT018.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT018.snap index 9a4bd69088..506c64541d 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT018.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT018.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs --- -error[PT018]: PT018.py:14:5: [*] Assertion should be broken down into multiple parts +error[PT018]: 14:5: [*] Assertion should be broken down into multiple parts + --> PT018.py:14:5 | 13 | def test_error(): 14 | assert something and something_else @@ -22,8 +23,9 @@ error[PT018]: PT018.py:14:5: [*] Assertion should be broken down into multiple p 16 17 | assert something and not something_else 17 18 | assert something and (something_else or something_third) -error[PT018]: PT018.py:15:5: [*] Assertion should be broken down into multiple parts +error[PT018]: 15:5: [*] Assertion should be broken down into multiple parts + --> PT018.py:15:5 | 13 | def test_error(): 14 | assert something and something_else @@ -44,8 +46,9 @@ error[PT018]: PT018.py:15:5: [*] Assertion should be broken down into multiple p 17 18 | assert something and (something_else or something_third) 18 19 | assert not something and something_else -error[PT018]: PT018.py:16:5: [*] Assertion should be broken down into multiple parts +error[PT018]: 16:5: [*] Assertion should be broken down into multiple parts + --> PT018.py:16:5 | 14 | assert something and something_else 15 | assert something and something_else and something_third @@ -66,8 +69,9 @@ error[PT018]: PT018.py:16:5: [*] Assertion should be broken down into multiple p 18 19 | assert not something and something_else 19 20 | assert not (something or something_else) -error[PT018]: PT018.py:17:5: [*] Assertion should be broken down into multiple parts +error[PT018]: 17:5: [*] Assertion should be broken down into multiple parts + --> PT018.py:17:5 | 15 | assert something and something_else and something_third 16 | assert something and not something_else @@ -88,8 +92,9 @@ error[PT018]: PT018.py:17:5: [*] Assertion should be broken down into multiple p 19 20 | assert not (something or something_else) 20 21 | assert not (something or something_else or something_third) -error[PT018]: PT018.py:18:5: [*] Assertion should be broken down into multiple parts +error[PT018]: 18:5: [*] Assertion should be broken down into multiple parts + --> PT018.py:18:5 | 16 | assert something and not something_else 17 | assert something and (something_else or something_third) @@ -110,8 +115,9 @@ error[PT018]: PT018.py:18:5: [*] Assertion should be broken down into multiple p 20 21 | assert not (something or something_else or something_third) 21 22 | assert something and something_else == """error -error[PT018]: PT018.py:19:5: [*] Assertion should be broken down into multiple parts +error[PT018]: 19:5: [*] Assertion should be broken down into multiple parts + --> PT018.py:19:5 | 17 | assert something and (something_else or something_third) 18 | assert not something and something_else @@ -132,8 +138,9 @@ error[PT018]: PT018.py:19:5: [*] Assertion should be broken down into multiple p 21 22 | assert something and something_else == """error 22 23 | message -error[PT018]: PT018.py:20:5: [*] Assertion should be broken down into multiple parts +error[PT018]: 20:5: [*] Assertion should be broken down into multiple parts + --> PT018.py:20:5 | 18 | assert not something and something_else 19 | assert not (something or something_else) @@ -154,8 +161,9 @@ error[PT018]: PT018.py:20:5: [*] Assertion should be broken down into multiple p 22 23 | message 23 24 | """ -error[PT018]: PT018.py:21:5: [*] Assertion should be broken down into multiple parts +error[PT018]: 21:5: [*] Assertion should be broken down into multiple parts + --> PT018.py:21:5 | 19 | assert not (something or something_else) 20 | assert not (something or something_else or something_third) @@ -179,8 +187,9 @@ error[PT018]: PT018.py:21:5: [*] Assertion should be broken down into multiple p 23 24 | """ 24 25 | assert ( -error[PT018]: PT018.py:24:5: [*] Assertion should be broken down into multiple parts +error[PT018]: 24:5: [*] Assertion should be broken down into multiple parts + --> PT018.py:24:5 | 22 | message 23 | """ @@ -210,8 +219,9 @@ error[PT018]: PT018.py:24:5: [*] Assertion should be broken down into multiple p 28 28 | message 29 29 | """ -error[PT018]: PT018.py:33:5: [*] Assertion should be broken down into multiple parts +error[PT018]: 33:5: [*] Assertion should be broken down into multiple parts + --> PT018.py:33:5 | 32 | # recursive case 33 | assert not (a or not (b or c)) @@ -230,8 +240,9 @@ error[PT018]: PT018.py:33:5: [*] Assertion should be broken down into multiple p 35 36 | 36 37 | # detected, but no fix for messages -error[PT018]: PT018.py:34:5: [*] Assertion should be broken down into multiple parts +error[PT018]: 34:5: [*] Assertion should be broken down into multiple parts + --> PT018.py:34:5 | 32 | # recursive case 33 | assert not (a or not (b or c)) @@ -252,8 +263,9 @@ error[PT018]: PT018.py:34:5: [*] Assertion should be broken down into multiple p 36 37 | # detected, but no fix for messages 37 38 | assert something and something_else, "error message" -error[PT018]: PT018.py:37:5: Assertion should be broken down into multiple parts +error[PT018]: 37:5: Assertion should be broken down into multiple parts + --> PT018.py:37:5 | 36 | # detected, but no fix for messages 37 | assert something and something_else, "error message" @@ -262,8 +274,9 @@ error[PT018]: PT018.py:37:5: Assertion should be broken down into multiple parts 39 | # detected, but no fix for mixed conditions (e.g. `a or b and c`) | = help: Break down assertion into multiple parts -error[PT018]: PT018.py:38:5: Assertion should be broken down into multiple parts +error[PT018]: 38:5: Assertion should be broken down into multiple parts + --> PT018.py:38:5 | 36 | # detected, but no fix for messages 37 | assert something and something_else, "error message" @@ -273,8 +286,9 @@ error[PT018]: PT018.py:38:5: Assertion should be broken down into multiple parts 40 | assert not (something or something_else and something_third) | = help: Break down assertion into multiple parts -error[PT018]: PT018.py:40:5: Assertion should be broken down into multiple parts +error[PT018]: 40:5: Assertion should be broken down into multiple parts + --> PT018.py:40:5 | 38 | assert not (something or something_else and something_third), "with message" 39 | # detected, but no fix for mixed conditions (e.g. `a or b and c`) @@ -282,8 +296,9 @@ error[PT018]: PT018.py:40:5: Assertion should be broken down into multiple parts | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: Break down assertion into multiple parts -error[PT018]: PT018.py:44:1: [*] Assertion should be broken down into multiple parts +error[PT018]: 44:1: [*] Assertion should be broken down into multiple parts + --> PT018.py:43:23 | 43 | assert something # OK 44 | assert something and something_else # Error @@ -302,8 +317,9 @@ error[PT018]: PT018.py:44:1: [*] Assertion should be broken down into multiple p 46 47 | 47 48 | -error[PT018]: PT018.py:45:1: [*] Assertion should be broken down into multiple parts +error[PT018]: 45:1: [*] Assertion should be broken down into multiple parts + --> PT018.py:44:45 | 43 | assert something # OK 44 | assert something and something_else # Error @@ -322,8 +338,9 @@ error[PT018]: PT018.py:45:1: [*] Assertion should be broken down into multiple p 47 48 | 48 49 | def test_multiline(): -error[PT018]: PT018.py:49:5: Assertion should be broken down into multiple parts +error[PT018]: 49:5: Assertion should be broken down into multiple parts + --> PT018.py:49:5 | 48 | def test_multiline(): 49 | assert something and something_else; x = 1 @@ -332,8 +349,9 @@ error[PT018]: PT018.py:49:5: Assertion should be broken down into multiple parts 51 | x = 1; assert something and something_else | = help: Break down assertion into multiple parts -error[PT018]: PT018.py:51:12: Assertion should be broken down into multiple parts +error[PT018]: 51:12: Assertion should be broken down into multiple parts + --> PT018.py:51:12 | 49 | assert something and something_else; x = 1 50 | @@ -343,16 +361,18 @@ error[PT018]: PT018.py:51:12: Assertion should be broken down into multiple part 53 | x = 1; \ | = help: Break down assertion into multiple parts -error[PT018]: PT018.py:54:9: Assertion should be broken down into multiple parts +error[PT018]: 54:9: Assertion should be broken down into multiple parts + --> PT018.py:54:9 | 53 | x = 1; \ 54 | assert something and something_else | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: Break down assertion into multiple parts -error[PT018]: PT018.py:59:5: [*] Assertion should be broken down into multiple parts +error[PT018]: 59:5: [*] Assertion should be broken down into multiple parts + --> PT018.py:59:5 | 57 | # Regression test for: https://github.com/astral-sh/ruff/issues/7143 58 | def test_parenthesized_not(): @@ -380,8 +400,9 @@ error[PT018]: PT018.py:59:5: [*] Assertion should be broken down into multiple p 65 67 | assert (not ( 66 68 | self.find_graph_output(node.output[0]) -error[PT018]: PT018.py:65:5: [*] Assertion should be broken down into multiple parts +error[PT018]: 65:5: [*] Assertion should be broken down into multiple parts + --> PT018.py:65:5 | 63 | ) 64 | diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT019.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT019.snap index d05518a2fd..411de8d0e3 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT019.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT019.snap @@ -1,15 +1,17 @@ --- source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs --- -error[PT019]: PT019.py:9:14: Fixture `_fixture` without value is injected as parameter, use `@pytest.mark.usefixtures` instead +error[PT019]: 9:14: Fixture `_fixture` without value is injected as parameter, use `@pytest.mark.usefixtures` instead + --> PT019.py:9:14 | 9 | def test_xxx(_fixture): # Error arg | ^^^^^^^^ 10 | pass | -error[PT019]: PT019.py:13:17: Fixture `_fixture` without value is injected as parameter, use `@pytest.mark.usefixtures` instead +error[PT019]: 13:17: Fixture `_fixture` without value is injected as parameter, use `@pytest.mark.usefixtures` instead + --> PT019.py:13:17 | 13 | def test_xxx(*, _fixture): # Error kwonly | ^^^^^^^^ diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT020.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT020.snap index 063571bf18..e0b88f44c0 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT020.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT020.snap @@ -1,16 +1,18 @@ --- source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs --- -error[PT020]: PT020.py:14:1: `@pytest.yield_fixture` is deprecated, use `@pytest.fixture` +error[PT020]: 14:1: `@pytest.yield_fixture` is deprecated, use `@pytest.fixture` + --> PT020.py:14:1 | 14 | @pytest.yield_fixture() | ^^^^^^^^^^^^^^^^^^^^^^^ 15 | def error_without_parens(): 16 | return 0 | -error[PT020]: PT020.py:19:1: `@pytest.yield_fixture` is deprecated, use `@pytest.fixture` +error[PT020]: 19:1: `@pytest.yield_fixture` is deprecated, use `@pytest.fixture` + --> PT020.py:19:1 | 19 | @pytest.yield_fixture | ^^^^^^^^^^^^^^^^^^^^^ diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT021.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT021.snap index a26d3b3967..5fc8acbb4c 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT021.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT021.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs --- -error[PT021]: PT021.py:49:5: Use `yield` instead of `request.addfinalizer` +error[PT021]: 49:5: Use `yield` instead of `request.addfinalizer` + --> PT021.py:49:5 | 47 | def my_fixture(request): # Error return 48 | resource = acquire_resource() @@ -10,8 +11,9 @@ error[PT021]: PT021.py:49:5: Use `yield` instead of `request.addfinalizer` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 50 | return resource | -error[PT021]: PT021.py:56:5: Use `yield` instead of `request.addfinalizer` +error[PT021]: 56:5: Use `yield` instead of `request.addfinalizer` + --> PT021.py:56:5 | 54 | def my_fixture(request): # Error yield 55 | resource = acquire_resource() diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT022.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT022.snap index b1d27d06ed..bb9374787c 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT022.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT022.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs --- -error[PT022]: PT022.py:17:5: [*] No teardown in fixture `error`, use `return` instead of `yield` +error[PT022]: 17:5: [*] No teardown in fixture `error`, use `return` instead of `yield` + --> PT022.py:17:5 | 15 | def error(): 16 | resource = acquire_resource() @@ -20,8 +21,9 @@ error[PT022]: PT022.py:17:5: [*] No teardown in fixture `error`, use `return` in 19 19 | 20 20 | import typing -error[PT022]: PT022.py:37:5: [*] No teardown in fixture `error`, use `return` instead of `yield` +error[PT022]: 37:5: [*] No teardown in fixture `error`, use `return` instead of `yield` + --> PT022.py:37:5 | 35 | def error() -> typing.Generator[typing.Any, None, None]: 36 | resource = acquire_resource() @@ -42,8 +44,9 @@ error[PT022]: PT022.py:37:5: [*] No teardown in fixture `error`, use `return` in 39 39 | 40 40 | @pytest.fixture() -error[PT022]: PT022.py:43:5: [*] No teardown in fixture `error`, use `return` instead of `yield` +error[PT022]: 43:5: [*] No teardown in fixture `error`, use `return` instead of `yield` + --> PT022.py:43:5 | 41 | def error() -> Generator[Resource, None, None]: 42 | resource = acquire_resource() diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT023_default.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT023_default.snap index d53baff08e..bcd3bb7145 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT023_default.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT023_default.snap @@ -1,15 +1,16 @@ --- source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs --- -PT023.py:46:1: PT023 [*] Use `@pytest.mark.foo` over `@pytest.mark.foo()` +error[PT023]: 46:1: [*] Use `@pytest.mark.foo` over `@pytest.mark.foo()` + + --> PT023.py:46:1 | 46 | @pytest.mark.foo() - | ^^^^^^^^^^^^^^^^^^ PT023 + | ^^^^^^^^^^^^^^^^^^ 47 | def test_something(): 48 | pass | = help: Add/remove parentheses - ℹ Safe fix 43 43 | # With parentheses 44 44 | @@ -20,15 +21,16 @@ PT023.py:46:1: PT023 [*] Use `@pytest.mark.foo` over `@pytest.mark.foo()` 48 48 | pass 49 49 | -PT023.py:51:1: PT023 [*] Use `@pytest.mark.foo` over `@pytest.mark.foo()` +error[PT023]: 51:1: [*] Use `@pytest.mark.foo` over `@pytest.mark.foo()` + + --> PT023.py:51:1 | 51 | @pytest.mark.foo() - | ^^^^^^^^^^^^^^^^^^ PT023 + | ^^^^^^^^^^^^^^^^^^ 52 | class TestClass: 53 | def test_something(): | = help: Add/remove parentheses - ℹ Safe fix 48 48 | pass 49 49 | @@ -39,16 +41,17 @@ PT023.py:51:1: PT023 [*] Use `@pytest.mark.foo` over `@pytest.mark.foo()` 53 53 | def test_something(): 54 54 | pass -PT023.py:58:5: PT023 [*] Use `@pytest.mark.foo` over `@pytest.mark.foo()` +error[PT023]: 58:5: [*] Use `@pytest.mark.foo` over `@pytest.mark.foo()` + + --> PT023.py:58:5 | 57 | class TestClass: 58 | @pytest.mark.foo() - | ^^^^^^^^^^^^^^^^^^ PT023 + | ^^^^^^^^^^^^^^^^^^ 59 | def test_something(): 60 | pass | = help: Add/remove parentheses - ℹ Safe fix 55 55 | 56 56 | @@ -59,16 +62,17 @@ PT023.py:58:5: PT023 [*] Use `@pytest.mark.foo` over `@pytest.mark.foo()` 60 60 | pass 61 61 | -PT023.py:64:5: PT023 [*] Use `@pytest.mark.foo` over `@pytest.mark.foo()` +error[PT023]: 64:5: [*] Use `@pytest.mark.foo` over `@pytest.mark.foo()` + + --> PT023.py:64:5 | 63 | class TestClass: 64 | @pytest.mark.foo() - | ^^^^^^^^^^^^^^^^^^ PT023 + | ^^^^^^^^^^^^^^^^^^ 65 | class TestNestedClass: 66 | def test_something(): | = help: Add/remove parentheses - ℹ Safe fix 61 61 | 62 62 | @@ -79,17 +83,18 @@ PT023.py:64:5: PT023 [*] Use `@pytest.mark.foo` over `@pytest.mark.foo()` 66 66 | def test_something(): 67 67 | pass -PT023.py:72:9: PT023 [*] Use `@pytest.mark.foo` over `@pytest.mark.foo()` +error[PT023]: 72:9: [*] Use `@pytest.mark.foo` over `@pytest.mark.foo()` + + --> PT023.py:72:9 | 70 | class TestClass: 71 | class TestNestedClass: 72 | @pytest.mark.foo() - | ^^^^^^^^^^^^^^^^^^ PT023 + | ^^^^^^^^^^^^^^^^^^ 73 | def test_something(): 74 | pass | = help: Add/remove parentheses - ℹ Safe fix 69 69 | 70 70 | class TestClass: diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT023_parentheses.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT023_parentheses.snap index 2b2a29aafb..ec28a2c0b7 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT023_parentheses.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT023_parentheses.snap @@ -1,15 +1,16 @@ --- source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs --- -PT023.py:12:1: PT023 [*] Use `@pytest.mark.foo()` over `@pytest.mark.foo` +error[PT023]: 12:1: [*] Use `@pytest.mark.foo()` over `@pytest.mark.foo` + + --> PT023.py:12:1 | 12 | @pytest.mark.foo - | ^^^^^^^^^^^^^^^^ PT023 + | ^^^^^^^^^^^^^^^^ 13 | def test_something(): 14 | pass | = help: Add/remove parentheses - ℹ Safe fix 9 9 | # Without parentheses 10 10 | @@ -20,15 +21,16 @@ PT023.py:12:1: PT023 [*] Use `@pytest.mark.foo()` over `@pytest.mark.foo` 14 14 | pass 15 15 | -PT023.py:17:1: PT023 [*] Use `@pytest.mark.foo()` over `@pytest.mark.foo` +error[PT023]: 17:1: [*] Use `@pytest.mark.foo()` over `@pytest.mark.foo` + + --> PT023.py:17:1 | 17 | @pytest.mark.foo - | ^^^^^^^^^^^^^^^^ PT023 + | ^^^^^^^^^^^^^^^^ 18 | class TestClass: 19 | def test_something(): | = help: Add/remove parentheses - ℹ Safe fix 14 14 | pass 15 15 | @@ -39,16 +41,17 @@ PT023.py:17:1: PT023 [*] Use `@pytest.mark.foo()` over `@pytest.mark.foo` 19 19 | def test_something(): 20 20 | pass -PT023.py:24:5: PT023 [*] Use `@pytest.mark.foo()` over `@pytest.mark.foo` +error[PT023]: 24:5: [*] Use `@pytest.mark.foo()` over `@pytest.mark.foo` + + --> PT023.py:24:5 | 23 | class TestClass: 24 | @pytest.mark.foo - | ^^^^^^^^^^^^^^^^ PT023 + | ^^^^^^^^^^^^^^^^ 25 | def test_something(): 26 | pass | = help: Add/remove parentheses - ℹ Safe fix 21 21 | 22 22 | @@ -59,16 +62,17 @@ PT023.py:24:5: PT023 [*] Use `@pytest.mark.foo()` over `@pytest.mark.foo` 26 26 | pass 27 27 | -PT023.py:30:5: PT023 [*] Use `@pytest.mark.foo()` over `@pytest.mark.foo` +error[PT023]: 30:5: [*] Use `@pytest.mark.foo()` over `@pytest.mark.foo` + + --> PT023.py:30:5 | 29 | class TestClass: 30 | @pytest.mark.foo - | ^^^^^^^^^^^^^^^^ PT023 + | ^^^^^^^^^^^^^^^^ 31 | class TestNestedClass: 32 | def test_something(): | = help: Add/remove parentheses - ℹ Safe fix 27 27 | 28 28 | @@ -79,17 +83,18 @@ PT023.py:30:5: PT023 [*] Use `@pytest.mark.foo()` over `@pytest.mark.foo` 32 32 | def test_something(): 33 33 | pass -PT023.py:38:9: PT023 [*] Use `@pytest.mark.foo()` over `@pytest.mark.foo` +error[PT023]: 38:9: [*] Use `@pytest.mark.foo()` over `@pytest.mark.foo` + + --> PT023.py:38:9 | 36 | class TestClass: 37 | class TestNestedClass: 38 | @pytest.mark.foo - | ^^^^^^^^^^^^^^^^ PT023 + | ^^^^^^^^^^^^^^^^ 39 | def test_something(): 40 | pass | = help: Add/remove parentheses - ℹ Safe fix 35 35 | 36 36 | class TestClass: diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT024.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT024.snap index 66e27a5ff1..97aaa0c72a 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT024.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT024.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs --- -error[PT024]: PT024.py:14:1: [*] `pytest.mark.asyncio` is unnecessary for fixtures +error[PT024]: 14:1: [*] `pytest.mark.asyncio` is unnecessary for fixtures + --> PT024.py:14:1 | 14 | @pytest.mark.asyncio() | ^^^^^^^^^^^^^^^^^^^^^^ @@ -19,8 +20,9 @@ error[PT024]: PT024.py:14:1: [*] `pytest.mark.asyncio` is unnecessary for fixtur 16 15 | async def my_fixture(): # Error before 17 16 | return 0 -error[PT024]: PT024.py:20:1: [*] `pytest.mark.asyncio` is unnecessary for fixtures +error[PT024]: 20:1: [*] `pytest.mark.asyncio` is unnecessary for fixtures + --> PT024.py:20:1 | 20 | @pytest.mark.asyncio | ^^^^^^^^^^^^^^^^^^^^ @@ -37,8 +39,9 @@ error[PT024]: PT024.py:20:1: [*] `pytest.mark.asyncio` is unnecessary for fixtur 22 21 | async def my_fixture(): # Error before no parens 23 22 | return 0 -error[PT024]: PT024.py:27:1: [*] `pytest.mark.asyncio` is unnecessary for fixtures +error[PT024]: 27:1: [*] `pytest.mark.asyncio` is unnecessary for fixtures + --> PT024.py:26:18 | 26 | @pytest.fixture() 27 | @pytest.mark.asyncio() @@ -56,8 +59,9 @@ error[PT024]: PT024.py:27:1: [*] `pytest.mark.asyncio` is unnecessary for fixtur 29 28 | return 0 30 29 | -error[PT024]: PT024.py:33:1: [*] `pytest.mark.asyncio` is unnecessary for fixtures +error[PT024]: 33:1: [*] `pytest.mark.asyncio` is unnecessary for fixtures + --> PT024.py:32:18 | 32 | @pytest.fixture() 33 | @pytest.mark.asyncio diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT025.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT025.snap index 52c3395829..d5249208c7 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT025.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT025.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs --- -error[PT025]: PT025.py:9:1: [*] `pytest.mark.usefixtures` has no effect on fixtures +error[PT025]: 9:1: [*] `pytest.mark.usefixtures` has no effect on fixtures + --> PT025.py:9:1 | 9 | @pytest.mark.usefixtures("a") | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -19,8 +20,9 @@ error[PT025]: PT025.py:9:1: [*] `pytest.mark.usefixtures` has no effect on fixtu 11 10 | def my_fixture(): # Error before 12 11 | return 0 -error[PT025]: PT025.py:16:1: [*] `pytest.mark.usefixtures` has no effect on fixtures +error[PT025]: 16:1: [*] `pytest.mark.usefixtures` has no effect on fixtures + --> PT025.py:15:18 | 15 | @pytest.fixture() 16 | @pytest.mark.usefixtures("a") diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT026.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT026.snap index 30ccaab730..98510319f4 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT026.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT026.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs --- -error[PT026]: PT026.py:19:1: [*] Useless `pytest.mark.usefixtures` without parameters +error[PT026]: 19:1: [*] Useless `pytest.mark.usefixtures` without parameters + --> PT026.py:19:1 | 19 | @pytest.mark.usefixtures() | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -20,8 +21,9 @@ error[PT026]: PT026.py:19:1: [*] Useless `pytest.mark.usefixtures` without param 21 21 | pass 22 22 | -error[PT026]: PT026.py:24:1: [*] Useless `pytest.mark.usefixtures` without parameters +error[PT026]: 24:1: [*] Useless `pytest.mark.usefixtures` without parameters + --> PT026.py:24:1 | 24 | @pytest.mark.usefixtures | ^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT027_0.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT027_0.snap index 3463cd30c7..a6c1e03282 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT027_0.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT027_0.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs --- -error[PT027]: PT027_0.py:6:14: [*] Use `pytest.raises` instead of unittest-style `assertRaises` +error[PT027]: 6:14: [*] Use `pytest.raises` instead of unittest-style `assertRaises` + --> PT027_0.py:6:14 | 4 | class Test(unittest.TestCase): 5 | def test_errors(self): @@ -25,8 +26,9 @@ error[PT027]: PT027_0.py:6:14: [*] Use `pytest.raises` instead of unittest-style 8 9 | with self.assertRaises(expected_exception=ValueError): 9 10 | raise ValueError -error[PT027]: PT027_0.py:8:14: [*] Use `pytest.raises` instead of unittest-style `assertRaises` +error[PT027]: 8:14: [*] Use `pytest.raises` instead of unittest-style `assertRaises` + --> PT027_0.py:8:14 | 6 | with self.assertRaises(ValueError): 7 | raise ValueError @@ -50,8 +52,9 @@ error[PT027]: PT027_0.py:8:14: [*] Use `pytest.raises` instead of unittest-style 10 11 | 11 12 | with self.failUnlessRaises(ValueError): -error[PT027]: PT027_0.py:11:14: [*] Use `pytest.raises` instead of unittest-style `failUnlessRaises` +error[PT027]: 11:14: [*] Use `pytest.raises` instead of unittest-style `failUnlessRaises` + --> PT027_0.py:11:14 | 9 | raise ValueError 10 | @@ -76,8 +79,9 @@ error[PT027]: PT027_0.py:11:14: [*] Use `pytest.raises` instead of unittest-styl 13 14 | 14 15 | with self.assertRaisesRegex(ValueError, "test"): -error[PT027]: PT027_0.py:14:14: [*] Use `pytest.raises` instead of unittest-style `assertRaisesRegex` +error[PT027]: 14:14: [*] Use `pytest.raises` instead of unittest-style `assertRaisesRegex` + --> PT027_0.py:14:14 | 12 | raise ValueError 13 | @@ -102,8 +106,9 @@ error[PT027]: PT027_0.py:14:14: [*] Use `pytest.raises` instead of unittest-styl 16 17 | 17 18 | with self.assertRaisesRegex(ValueError, expected_regex="test"): -error[PT027]: PT027_0.py:17:14: [*] Use `pytest.raises` instead of unittest-style `assertRaisesRegex` +error[PT027]: 17:14: [*] Use `pytest.raises` instead of unittest-style `assertRaisesRegex` + --> PT027_0.py:17:14 | 15 | raise ValueError("test") 16 | @@ -128,8 +133,9 @@ error[PT027]: PT027_0.py:17:14: [*] Use `pytest.raises` instead of unittest-styl 19 20 | 20 21 | with self.assertRaisesRegex( -error[PT027]: PT027_0.py:20:14: [*] Use `pytest.raises` instead of unittest-style `assertRaisesRegex` +error[PT027]: 20:14: [*] Use `pytest.raises` instead of unittest-style `assertRaisesRegex` + --> PT027_0.py:20:14 | 18 | raise ValueError("test") 19 | @@ -157,8 +163,9 @@ error[PT027]: PT027_0.py:20:14: [*] Use `pytest.raises` instead of unittest-styl 24 23 | 25 24 | with self.assertRaisesRegex( -error[PT027]: PT027_0.py:25:14: [*] Use `pytest.raises` instead of unittest-style `assertRaisesRegex` +error[PT027]: 25:14: [*] Use `pytest.raises` instead of unittest-style `assertRaisesRegex` + --> PT027_0.py:25:14 | 23 | raise ValueError("test") 24 | @@ -186,8 +193,9 @@ error[PT027]: PT027_0.py:25:14: [*] Use `pytest.raises` instead of unittest-styl 29 28 | 30 29 | with self.assertRaisesRegexp(ValueError, "test"): -error[PT027]: PT027_0.py:30:14: [*] Use `pytest.raises` instead of unittest-style `assertRaisesRegexp` +error[PT027]: 30:14: [*] Use `pytest.raises` instead of unittest-style `assertRaisesRegexp` + --> PT027_0.py:30:14 | 28 | raise ValueError("test") 29 | @@ -212,8 +220,9 @@ error[PT027]: PT027_0.py:30:14: [*] Use `pytest.raises` instead of unittest-styl 32 33 | 33 34 | def test_unfixable_errors(self): -error[PT027]: PT027_0.py:34:14: Use `pytest.raises` instead of unittest-style `assertRaises` +error[PT027]: 34:14: Use `pytest.raises` instead of unittest-style `assertRaises` + --> PT027_0.py:34:14 | 33 | def test_unfixable_errors(self): 34 | with self.assertRaises(ValueError, msg="msg"): @@ -221,8 +230,9 @@ error[PT027]: PT027_0.py:34:14: Use `pytest.raises` instead of unittest-style `a 35 | raise ValueError | = help: Replace `assertRaises` with `pytest.raises` -error[PT027]: PT027_0.py:37:14: Use `pytest.raises` instead of unittest-style `assertRaises` +error[PT027]: 37:14: Use `pytest.raises` instead of unittest-style `assertRaises` + --> PT027_0.py:37:14 | 35 | raise ValueError 36 | @@ -232,8 +242,9 @@ error[PT027]: PT027_0.py:37:14: Use `pytest.raises` instead of unittest-style `a 39 | ValueError | = help: Replace `assertRaises` with `pytest.raises` -error[PT027]: PT027_0.py:44:13: Use `pytest.raises` instead of unittest-style `assertRaises` +error[PT027]: 44:13: Use `pytest.raises` instead of unittest-style `assertRaises` + --> PT027_0.py:44:13 | 43 | with ( 44 | self diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT027_1.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT027_1.snap index c56fe71c1e..858a38c3ab 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT027_1.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT027_1.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs --- -error[PT027]: PT027_1.py:11:14: [*] Use `pytest.raises` instead of unittest-style `assertRaises` +error[PT027]: 11:14: [*] Use `pytest.raises` instead of unittest-style `assertRaises` + --> PT027_1.py:11:14 | 10 | def test_errors(self): 11 | with self.assertRaises(ValueError): diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__only_docstring_doubles_all.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__only_docstring_doubles_all.py.snap index 40d3780657..2c5f9eccbe 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__only_docstring_doubles_all.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__only_docstring_doubles_all.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs --- -error[Q002]: doubles_all.py:1:1: [*] Double quote docstring found but single quotes preferred +error[Q002]: 1:1: [*] Double quote docstring found but single quotes preferred + --> doubles_all.py:1:1 | 1 | """This is a docstring.""" | ^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__only_inline_doubles_all.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__only_inline_doubles_all.py.snap index 6e7e99a35e..e3c0af62f8 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__only_inline_doubles_all.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__only_inline_doubles_all.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs --- -error[Q000]: doubles_all.py:3:28: [*] Double quotes found but single quotes preferred +error[Q000]: 3:28: [*] Double quotes found but single quotes preferred + --> doubles_all.py:3:28 | 1 | """This is a docstring.""" 2 | diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__only_multiline_doubles_all.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__only_multiline_doubles_all.py.snap index de4b1053ad..4b26e40020 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__only_multiline_doubles_all.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__only_multiline_doubles_all.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs --- -error[Q001]: doubles_all.py:5:30: [*] Double quote multiline found but single quotes preferred +error[Q001]: 5:30: [*] Double quote multiline found but single quotes preferred + --> doubles_all.py:5:30 | 3 | this_is_an_inline_string = "double quote string" 4 | diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles.py.snap index b99c6dd5ba..06bc3c5b1c 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs --- -error[Q001]: docstring_doubles.py:5:1: [*] Double quote multiline found but single quotes preferred +error[Q001]: 5:1: [*] Double quote multiline found but single quotes preferred + --> docstring_doubles.py:4:1 | 3 | """ 4 | @@ -27,8 +28,9 @@ error[Q001]: docstring_doubles.py:5:1: [*] Double quote multiline found but sing 9 9 | l = [] 10 10 | -error[Q001]: docstring_doubles.py:16:5: [*] Double quote multiline found but single quotes preferred +error[Q001]: 16:5: [*] Double quote multiline found but single quotes preferred + --> docstring_doubles.py:16:5 | 14 | """ 15 | @@ -54,8 +56,9 @@ error[Q001]: docstring_doubles.py:16:5: [*] Double quote multiline found but sin 20 20 | # The colon in the list indexing below is an edge case for the docstring scanner 21 21 | def f(self, bar=""" -error[Q001]: docstring_doubles.py:21:21: [*] Double quote multiline found but single quotes preferred +error[Q001]: 21:21: [*] Double quote multiline found but single quotes preferred + --> docstring_doubles.py:21:21 | 20 | # The colon in the list indexing below is an edge case for the docstring scanner 21 | def f(self, bar=""" @@ -78,8 +81,9 @@ error[Q001]: docstring_doubles.py:21:21: [*] Double quote multiline found but si 24 24 | """ 25 25 | Double quotes multiline function docstring -error[Q001]: docstring_doubles.py:30:9: [*] Double quote multiline found but single quotes preferred +error[Q001]: 30:9: [*] Double quote multiline found but single quotes preferred + --> docstring_doubles.py:30:9 | 28 | some_expression = 'hello world' 29 | @@ -105,8 +109,9 @@ error[Q001]: docstring_doubles.py:30:9: [*] Double quote multiline found but sin 34 34 | if l: 35 35 | """ -error[Q001]: docstring_doubles.py:35:13: [*] Double quote multiline found but single quotes preferred +error[Q001]: 35:13: [*] Double quote multiline found but single quotes preferred + --> docstring_doubles.py:35:13 | 34 | if l: 35 | """ diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_class.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_class.py.snap index ff91fafdfc..81b2663f27 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_class.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_class.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs --- -error[Q001]: docstring_doubles_class.py:3:5: [*] Double quote multiline found but single quotes preferred +error[Q001]: 3:5: [*] Double quote multiline found but single quotes preferred + --> docstring_doubles_class.py:3:5 | 1 | class SingleLineDocstrings(): 2 | """ Double quotes single line class docstring """ @@ -21,8 +22,9 @@ error[Q001]: docstring_doubles_class.py:3:5: [*] Double quote multiline found bu 5 5 | def foo(self, bar="""not a docstring"""): 6 6 | """ Double quotes single line method docstring""" -error[Q001]: docstring_doubles_class.py:5:23: [*] Double quote multiline found but single quotes preferred +error[Q001]: 5:23: [*] Double quote multiline found but single quotes preferred + --> docstring_doubles_class.py:5:23 | 3 | """ Not a docstring """ 4 | diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_function.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_function.py.snap index 62ce1adae5..a7c4f019a9 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_function.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_function.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs --- -error[Q001]: docstring_doubles_function.py:3:5: [*] Double quote multiline found but single quotes preferred +error[Q001]: 3:5: [*] Double quote multiline found but single quotes preferred + --> docstring_doubles_function.py:3:5 | 1 | def foo(): 2 | """function without params, single line docstring""" @@ -20,8 +21,9 @@ error[Q001]: docstring_doubles_function.py:3:5: [*] Double quote multiline found 5 5 | 6 6 | -error[Q001]: docstring_doubles_function.py:11:5: [*] Double quote multiline found but single quotes preferred +error[Q001]: 11:5: [*] Double quote multiline found but single quotes preferred + --> docstring_doubles_function.py:11:5 | 9 | function without params, multiline docstring 10 | """ @@ -40,8 +42,9 @@ error[Q001]: docstring_doubles_function.py:11:5: [*] Double quote multiline foun 13 13 | 14 14 | -error[Q001]: docstring_doubles_function.py:15:39: [*] Double quote multiline found but single quotes preferred +error[Q001]: 15:39: [*] Double quote multiline found but single quotes preferred + --> docstring_doubles_function.py:15:39 | 15 | def fun_with_params_no_docstring(a, b=""" | _______________________________________^ @@ -64,8 +67,9 @@ error[Q001]: docstring_doubles_function.py:15:39: [*] Double quote multiline fou 19 19 | 20 20 | -error[Q001]: docstring_doubles_function.py:17:5: [*] Double quote multiline found but single quotes preferred +error[Q001]: 17:5: [*] Double quote multiline found but single quotes preferred + --> docstring_doubles_function.py:17:5 | 15 | def fun_with_params_no_docstring(a, b=""" 16 | not a @@ -84,8 +88,9 @@ error[Q001]: docstring_doubles_function.py:17:5: [*] Double quote multiline foun 19 19 | 20 20 | -error[Q001]: docstring_doubles_function.py:22:5: [*] Double quote multiline found but single quotes preferred +error[Q001]: 22:5: [*] Double quote multiline found but single quotes preferred + --> docstring_doubles_function.py:22:5 | 21 | def fun_with_params_no_docstring2(a, b=c[foo():], c=\ 22 | """ not a docstring """): diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_module_multiline.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_module_multiline.py.snap index 5409e244eb..27c776ac0e 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_module_multiline.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_module_multiline.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs --- -error[Q001]: docstring_doubles_module_multiline.py:4:1: [*] Double quote multiline found but single quotes preferred +error[Q001]: 4:1: [*] Double quote multiline found but single quotes preferred + --> docstring_doubles_module_multiline.py:3:4 | 2 | Double quotes multiline module docstring 3 | """ @@ -27,8 +28,9 @@ error[Q001]: docstring_doubles_module_multiline.py:4:1: [*] Double quote multili 8 8 | pass 9 9 | """ -error[Q001]: docstring_doubles_module_multiline.py:9:1: [*] Double quote multiline found but single quotes preferred +error[Q001]: 9:1: [*] Double quote multiline found but single quotes preferred + --> docstring_doubles_module_multiline.py:8:9 | 7 | def foo(): 8 | pass diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_module_singleline.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_module_singleline.py.snap index be9d846d5b..fb9fcbc373 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_module_singleline.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_module_singleline.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs --- -error[Q001]: docstring_doubles_module_singleline.py:2:1: [*] Double quote multiline found but single quotes preferred +error[Q001]: 2:1: [*] Double quote multiline found but single quotes preferred + --> docstring_doubles_module_singleline.py:1:50 | 1 | """ Double quotes singleline module docstring """ 2 | """ this is not a docstring """ @@ -19,8 +20,9 @@ error[Q001]: docstring_doubles_module_singleline.py:2:1: [*] Double quote multil 4 4 | def foo(): 5 5 | pass -error[Q001]: docstring_doubles_module_singleline.py:6:1: [*] Double quote multiline found but single quotes preferred +error[Q001]: 6:1: [*] Double quote multiline found but single quotes preferred + --> docstring_doubles_module_singleline.py:5:9 | 4 | def foo(): 5 | pass diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles.py.snap index b659db156c..d9655e111e 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs --- -error[Q002]: docstring_singles.py:1:1: [*] Single quote docstring found but double quotes preferred +error[Q002]: 1:1: [*] Single quote docstring found but double quotes preferred + --> docstring_singles.py:1:1 | 1 | / ''' 2 | | Single quotes multiline module docstring @@ -22,8 +23,9 @@ error[Q002]: docstring_singles.py:1:1: [*] Single quote docstring found but doub 5 5 | ''' 6 6 | this is not a docstring -error[Q002]: docstring_singles.py:14:5: [*] Single quote docstring found but double quotes preferred +error[Q002]: 14:5: [*] Single quote docstring found but double quotes preferred + --> docstring_singles.py:14:5 | 12 | class params \t not a docstring 13 | ''')): @@ -49,8 +51,9 @@ error[Q002]: docstring_singles.py:14:5: [*] Single quote docstring found but dou 18 18 | ''' 19 19 | this is not a docstring -error[Q002]: docstring_singles.py:26:9: [*] Single quote docstring found but double quotes preferred +error[Q002]: 26:9: [*] Single quote docstring found but double quotes preferred + --> docstring_singles.py:26:9 | 24 | definitely not a docstring''', 25 | val=l[Cls():3]): diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_class.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_class.py.snap index 634f94411d..b2802d71a4 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_class.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_class.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs --- -error[Q002]: docstring_singles_class.py:2:5: [*] Single quote docstring found but double quotes preferred +error[Q002]: 2:5: [*] Single quote docstring found but double quotes preferred + --> docstring_singles_class.py:2:5 | 1 | class SingleLineDocstrings(): 2 | ''' Double quotes single line class docstring ''' @@ -18,8 +19,9 @@ error[Q002]: docstring_singles_class.py:2:5: [*] Single quote docstring found bu 4 4 | 5 5 | def foo(self, bar='''not a docstring'''): -error[Q002]: docstring_singles_class.py:6:9: [*] Single quote docstring found but double quotes preferred +error[Q002]: 6:9: [*] Single quote docstring found but double quotes preferred + --> docstring_singles_class.py:6:9 | 5 | def foo(self, bar='''not a docstring'''): 6 | ''' Double quotes single line method docstring''' @@ -37,8 +39,9 @@ error[Q002]: docstring_singles_class.py:6:9: [*] Single quote docstring found bu 8 8 | 9 9 | class Nested(foo()[:]): ''' inline docstring '''; pass -error[Q002]: docstring_singles_class.py:9:29: [*] Single quote docstring found but double quotes preferred +error[Q002]: 9:29: [*] Single quote docstring found but double quotes preferred + --> docstring_singles_class.py:9:29 | 7 | pass 8 | diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_function.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_function.py.snap index 0b0ead98c9..5593f8d1e6 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_function.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_function.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs --- -error[Q002]: docstring_singles_function.py:2:5: [*] Single quote docstring found but double quotes preferred +error[Q002]: 2:5: [*] Single quote docstring found but double quotes preferred + --> docstring_singles_function.py:2:5 | 1 | def foo(): 2 | '''function without params, single line docstring''' @@ -19,8 +20,9 @@ error[Q002]: docstring_singles_function.py:2:5: [*] Single quote docstring found 4 4 | return 5 5 | -error[Q002]: docstring_singles_function.py:8:5: [*] Single quote docstring found but double quotes preferred +error[Q002]: 8:5: [*] Single quote docstring found but double quotes preferred + --> docstring_singles_function.py:8:5 | 7 | def foo2(): 8 | ''' @@ -45,8 +47,9 @@ error[Q002]: docstring_singles_function.py:8:5: [*] Single quote docstring found 12 12 | return 13 13 | -error[Q002]: docstring_singles_function.py:27:5: [*] Single quote docstring found but double quotes preferred +error[Q002]: 27:5: [*] Single quote docstring found but double quotes preferred + --> docstring_singles_function.py:27:5 | 26 | def function_with_single_docstring(a): 27 | 'Single line docstring' diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_class_var_1.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_class_var_1.py.snap index 16e90239f9..332e6f6a99 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_class_var_1.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_class_var_1.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs --- -error[Q002]: docstring_singles_mixed_quotes_class_var_1.py:2:5: Single quote docstring found but double quotes preferred +error[Q002]: 2:5: Single quote docstring found but double quotes preferred + --> docstring_singles_mixed_quotes_class_var_1.py:2:5 | 1 | class SingleLineDocstrings(): 2 | ''"Start with empty string" ' and lint docstring safely' @@ -10,8 +11,9 @@ error[Q002]: docstring_singles_mixed_quotes_class_var_1.py:2:5: Single quote doc 3 | ''' Not a docstring ''' | = help: Replace single quotes docstring with double quotes -error[Q002]: docstring_singles_mixed_quotes_class_var_1.py:2:33: [*] Single quote docstring found but double quotes preferred +error[Q002]: 2:33: [*] Single quote docstring found but double quotes preferred + --> docstring_singles_mixed_quotes_class_var_1.py:2:33 | 1 | class SingleLineDocstrings(): 2 | ''"Start with empty string" ' and lint docstring safely' @@ -27,8 +29,9 @@ error[Q002]: docstring_singles_mixed_quotes_class_var_1.py:2:33: [*] Single quot 4 4 | 5 5 | def foo(self, bar='''not a docstring'''): -error[Q002]: docstring_singles_mixed_quotes_class_var_1.py:6:9: Single quote docstring found but double quotes preferred +error[Q002]: 6:9: Single quote docstring found but double quotes preferred + --> docstring_singles_mixed_quotes_class_var_1.py:6:9 | 5 | def foo(self, bar='''not a docstring'''): 6 | ''"Start with empty string" ' and lint docstring safely' @@ -36,8 +39,9 @@ error[Q002]: docstring_singles_mixed_quotes_class_var_1.py:6:9: Single quote doc 7 | pass | = help: Replace single quotes docstring with double quotes -error[Q002]: docstring_singles_mixed_quotes_class_var_1.py:6:37: [*] Single quote docstring found but double quotes preferred +error[Q002]: 6:37: [*] Single quote docstring found but double quotes preferred + --> docstring_singles_mixed_quotes_class_var_1.py:6:37 | 5 | def foo(self, bar='''not a docstring'''): 6 | ''"Start with empty string" ' and lint docstring safely' @@ -55,8 +59,9 @@ error[Q002]: docstring_singles_mixed_quotes_class_var_1.py:6:37: [*] Single quot 8 8 | 9 9 | class Nested(foo()[:]): ''"Start with empty string" ' and lint docstring safely'; pass -error[Q002]: docstring_singles_mixed_quotes_class_var_1.py:9:29: Single quote docstring found but double quotes preferred +error[Q002]: 9:29: Single quote docstring found but double quotes preferred + --> docstring_singles_mixed_quotes_class_var_1.py:9:29 | 7 | pass 8 | @@ -64,8 +69,9 @@ error[Q002]: docstring_singles_mixed_quotes_class_var_1.py:9:29: Single quote do | ^^ | = help: Replace single quotes docstring with double quotes -error[Q002]: docstring_singles_mixed_quotes_class_var_1.py:9:57: [*] Single quote docstring found but double quotes preferred +error[Q002]: 9:57: [*] Single quote docstring found but double quotes preferred + --> docstring_singles_mixed_quotes_class_var_1.py:9:57 | 7 | pass 8 | diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_class_var_2.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_class_var_2.py.snap index ac8dcb78c8..8ab92a6a65 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_class_var_2.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_class_var_2.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs --- -error[Q002]: docstring_singles_mixed_quotes_class_var_2.py:2:5: [*] Single quote docstring found but double quotes preferred +error[Q002]: 2:5: [*] Single quote docstring found but double quotes preferred + --> docstring_singles_mixed_quotes_class_var_2.py:2:5 | 1 | class SingleLineDocstrings(): 2 | 'Do not'" start with empty string" ' and lint docstring safely' @@ -18,8 +19,9 @@ error[Q002]: docstring_singles_mixed_quotes_class_var_2.py:2:5: [*] Single quote 4 4 | 5 5 | def foo(self, bar='''not a docstring'''): -error[Q002]: docstring_singles_mixed_quotes_class_var_2.py:2:40: [*] Single quote docstring found but double quotes preferred +error[Q002]: 2:40: [*] Single quote docstring found but double quotes preferred + --> docstring_singles_mixed_quotes_class_var_2.py:2:40 | 1 | class SingleLineDocstrings(): 2 | 'Do not'" start with empty string" ' and lint docstring safely' @@ -35,8 +37,9 @@ error[Q002]: docstring_singles_mixed_quotes_class_var_2.py:2:40: [*] Single quot 4 4 | 5 5 | def foo(self, bar='''not a docstring'''): -error[Q002]: docstring_singles_mixed_quotes_class_var_2.py:6:9: [*] Single quote docstring found but double quotes preferred +error[Q002]: 6:9: [*] Single quote docstring found but double quotes preferred + --> docstring_singles_mixed_quotes_class_var_2.py:6:9 | 5 | def foo(self, bar='''not a docstring'''): 6 | 'Do not'" start with empty string" ' and lint docstring safely' @@ -54,8 +57,9 @@ error[Q002]: docstring_singles_mixed_quotes_class_var_2.py:6:9: [*] Single quote 8 8 | 9 9 | class Nested(foo()[:]): 'Do not'" start with empty string" ' and lint docstring safely'; pass -error[Q002]: docstring_singles_mixed_quotes_class_var_2.py:6:44: [*] Single quote docstring found but double quotes preferred +error[Q002]: 6:44: [*] Single quote docstring found but double quotes preferred + --> docstring_singles_mixed_quotes_class_var_2.py:6:44 | 5 | def foo(self, bar='''not a docstring'''): 6 | 'Do not'" start with empty string" ' and lint docstring safely' @@ -73,8 +77,9 @@ error[Q002]: docstring_singles_mixed_quotes_class_var_2.py:6:44: [*] Single quot 8 8 | 9 9 | class Nested(foo()[:]): 'Do not'" start with empty string" ' and lint docstring safely'; pass -error[Q002]: docstring_singles_mixed_quotes_class_var_2.py:9:29: [*] Single quote docstring found but double quotes preferred +error[Q002]: 9:29: [*] Single quote docstring found but double quotes preferred + --> docstring_singles_mixed_quotes_class_var_2.py:9:29 | 7 | pass 8 | @@ -89,8 +94,9 @@ error[Q002]: docstring_singles_mixed_quotes_class_var_2.py:9:29: [*] Single quot 9 |- class Nested(foo()[:]): 'Do not'" start with empty string" ' and lint docstring safely'; pass 9 |+ class Nested(foo()[:]): "Do not"" start with empty string" ' and lint docstring safely'; pass -error[Q002]: docstring_singles_mixed_quotes_class_var_2.py:9:64: [*] Single quote docstring found but double quotes preferred +error[Q002]: 9:64: [*] Single quote docstring found but double quotes preferred + --> docstring_singles_mixed_quotes_class_var_2.py:9:64 | 7 | pass 8 | diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_module_singleline_var_1.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_module_singleline_var_1.py.snap index 88fccab71f..df4e65f624 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_module_singleline_var_1.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_module_singleline_var_1.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs --- -error[Q002]: docstring_singles_mixed_quotes_module_singleline_var_1.py:1:1: Single quote docstring found but double quotes preferred +error[Q002]: 1:1: Single quote docstring found but double quotes preferred + --> docstring_singles_mixed_quotes_module_singleline_var_1.py:1:1 | 1 | ''"Start with empty string" ' and lint docstring safely' | ^^ @@ -10,8 +11,9 @@ error[Q002]: docstring_singles_mixed_quotes_module_singleline_var_1.py:1:1: Sing 3 | def foo(): | = help: Replace single quotes docstring with double quotes -error[Q002]: docstring_singles_mixed_quotes_module_singleline_var_1.py:1:29: [*] Single quote docstring found but double quotes preferred +error[Q002]: 1:29: [*] Single quote docstring found but double quotes preferred + --> docstring_singles_mixed_quotes_module_singleline_var_1.py:1:29 | 1 | ''"Start with empty string" ' and lint docstring safely' | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -26,8 +28,9 @@ error[Q002]: docstring_singles_mixed_quotes_module_singleline_var_1.py:1:29: [*] 3 3 | def foo(): 4 4 | pass -error[Q001]: docstring_singles_mixed_quotes_module_singleline_var_1.py:5:1: [*] Double quote multiline found but single quotes preferred +error[Q001]: 5:1: [*] Double quote multiline found but single quotes preferred + --> docstring_singles_mixed_quotes_module_singleline_var_1.py:4:9 | 3 | def foo(): 4 | pass diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_module_singleline_var_2.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_module_singleline_var_2.py.snap index 1a98c89c2e..8c592fbdca 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_module_singleline_var_2.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_module_singleline_var_2.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs --- -error[Q002]: docstring_singles_mixed_quotes_module_singleline_var_2.py:1:1: [*] Single quote docstring found but double quotes preferred +error[Q002]: 1:1: [*] Single quote docstring found but double quotes preferred + --> docstring_singles_mixed_quotes_module_singleline_var_2.py:1:1 | 1 | 'Do not'" start with empty string" ' and lint docstring safely' | ^^^^^^^^ @@ -17,8 +18,9 @@ error[Q002]: docstring_singles_mixed_quotes_module_singleline_var_2.py:1:1: [*] 3 3 | def foo(): 4 4 | pass -error[Q002]: docstring_singles_mixed_quotes_module_singleline_var_2.py:1:36: [*] Single quote docstring found but double quotes preferred +error[Q002]: 1:36: [*] Single quote docstring found but double quotes preferred + --> docstring_singles_mixed_quotes_module_singleline_var_2.py:1:36 | 1 | 'Do not'" start with empty string" ' and lint docstring safely' | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -33,8 +35,9 @@ error[Q002]: docstring_singles_mixed_quotes_module_singleline_var_2.py:1:36: [*] 3 3 | def foo(): 4 4 | pass -error[Q001]: docstring_singles_mixed_quotes_module_singleline_var_2.py:5:1: [*] Double quote multiline found but single quotes preferred +error[Q001]: 5:1: [*] Double quote multiline found but single quotes preferred + --> docstring_singles_mixed_quotes_module_singleline_var_2.py:4:9 | 3 | def foo(): 4 | pass diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_module_multiline.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_module_multiline.py.snap index 0bcab4f4a9..6e8f5ecc63 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_module_multiline.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_module_multiline.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs --- -error[Q002]: docstring_singles_module_multiline.py:1:1: [*] Single quote docstring found but double quotes preferred +error[Q002]: 1:1: [*] Single quote docstring found but double quotes preferred + --> docstring_singles_module_multiline.py:1:1 | 1 | / ''' 2 | | Double quotes multiline module docstring diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_module_singleline.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_module_singleline.py.snap index ae0d0d5855..a973bd2832 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_module_singleline.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_module_singleline.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs --- -error[Q002]: docstring_singles_module_singleline.py:1:1: [*] Single quote docstring found but double quotes preferred +error[Q002]: 1:1: [*] Single quote docstring found but double quotes preferred + --> docstring_singles_module_singleline.py:1:1 | 1 | ''' Double quotes singleline module docstring ''' | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles.py.snap index 256698ca76..d4161eb53b 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs --- -error[Q002]: docstring_doubles.py:1:1: [*] Double quote docstring found but single quotes preferred +error[Q002]: 1:1: [*] Double quote docstring found but single quotes preferred + --> docstring_doubles.py:1:1 | 1 | / """ 2 | | Double quotes multiline module docstring @@ -22,8 +23,9 @@ error[Q002]: docstring_doubles.py:1:1: [*] Double quote docstring found but sing 5 5 | """ 6 6 | this is not a docstring -error[Q002]: docstring_doubles.py:12:5: [*] Double quote docstring found but single quotes preferred +error[Q002]: 12:5: [*] Double quote docstring found but single quotes preferred + --> docstring_doubles.py:12:5 | 11 | class Cls: 12 | """ @@ -48,8 +50,9 @@ error[Q002]: docstring_doubles.py:12:5: [*] Double quote docstring found but sin 16 16 | """ 17 17 | this is not a docstring -error[Q002]: docstring_doubles.py:24:9: [*] Double quote docstring found but single quotes preferred +error[Q002]: 24:9: [*] Double quote docstring found but single quotes preferred + --> docstring_doubles.py:24:9 | 22 | definitely not a docstring""", 23 | val=l[Cls():3]): diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_class.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_class.py.snap index 3f43fd055a..d4ed9bcb44 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_class.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_class.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs --- -error[Q002]: docstring_doubles_class.py:2:5: [*] Double quote docstring found but single quotes preferred +error[Q002]: 2:5: [*] Double quote docstring found but single quotes preferred + --> docstring_doubles_class.py:2:5 | 1 | class SingleLineDocstrings(): 2 | """ Double quotes single line class docstring """ @@ -18,8 +19,9 @@ error[Q002]: docstring_doubles_class.py:2:5: [*] Double quote docstring found bu 4 4 | 5 5 | def foo(self, bar="""not a docstring"""): -error[Q002]: docstring_doubles_class.py:6:9: [*] Double quote docstring found but single quotes preferred +error[Q002]: 6:9: [*] Double quote docstring found but single quotes preferred + --> docstring_doubles_class.py:6:9 | 5 | def foo(self, bar="""not a docstring"""): 6 | """ Double quotes single line method docstring""" @@ -37,8 +39,9 @@ error[Q002]: docstring_doubles_class.py:6:9: [*] Double quote docstring found bu 8 8 | 9 9 | class Nested(foo()[:]): """ inline docstring """; pass -error[Q002]: docstring_doubles_class.py:9:29: [*] Double quote docstring found but single quotes preferred +error[Q002]: 9:29: [*] Double quote docstring found but single quotes preferred + --> docstring_doubles_class.py:9:29 | 7 | pass 8 | diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_function.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_function.py.snap index 94ad93d219..d4e14d59b5 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_function.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_function.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs --- -error[Q002]: docstring_doubles_function.py:2:5: [*] Double quote docstring found but single quotes preferred +error[Q002]: 2:5: [*] Double quote docstring found but single quotes preferred + --> docstring_doubles_function.py:2:5 | 1 | def foo(): 2 | """function without params, single line docstring""" @@ -19,8 +20,9 @@ error[Q002]: docstring_doubles_function.py:2:5: [*] Double quote docstring found 4 4 | return 5 5 | -error[Q002]: docstring_doubles_function.py:8:5: [*] Double quote docstring found but single quotes preferred +error[Q002]: 8:5: [*] Double quote docstring found but single quotes preferred + --> docstring_doubles_function.py:8:5 | 7 | def foo2(): 8 | """ @@ -45,8 +47,9 @@ error[Q002]: docstring_doubles_function.py:8:5: [*] Double quote docstring found 12 12 | return 13 13 | -error[Q002]: docstring_doubles_function.py:27:5: [*] Double quote docstring found but single quotes preferred +error[Q002]: 27:5: [*] Double quote docstring found but single quotes preferred + --> docstring_doubles_function.py:27:5 | 26 | def function_with_single_docstring(a): 27 | "Single line docstring" diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_mixed_quotes_class_var_1.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_mixed_quotes_class_var_1.py.snap index 7f4388f18f..432af98fe0 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_mixed_quotes_class_var_1.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_mixed_quotes_class_var_1.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs --- -error[Q002]: docstring_doubles_mixed_quotes_class_var_1.py:2:5: Double quote docstring found but single quotes preferred +error[Q002]: 2:5: Double quote docstring found but single quotes preferred + --> docstring_doubles_mixed_quotes_class_var_1.py:2:5 | 1 | class SingleLineDocstrings(): 2 | ""'Start with empty string' ' and lint docstring safely' @@ -10,8 +11,9 @@ error[Q002]: docstring_doubles_mixed_quotes_class_var_1.py:2:5: Double quote doc 3 | """ Not a docstring """ | = help: Replace double quotes docstring with single quotes -error[Q002]: docstring_doubles_mixed_quotes_class_var_1.py:6:9: Double quote docstring found but single quotes preferred +error[Q002]: 6:9: Double quote docstring found but single quotes preferred + --> docstring_doubles_mixed_quotes_class_var_1.py:6:9 | 5 | def foo(self, bar="""not a docstring"""): 6 | ""'Start with empty string' ' and lint docstring safely' @@ -19,8 +21,9 @@ error[Q002]: docstring_doubles_mixed_quotes_class_var_1.py:6:9: Double quote doc 7 | pass | = help: Replace double quotes docstring with single quotes -error[Q002]: docstring_doubles_mixed_quotes_class_var_1.py:9:29: Double quote docstring found but single quotes preferred +error[Q002]: 9:29: Double quote docstring found but single quotes preferred + --> docstring_doubles_mixed_quotes_class_var_1.py:9:29 | 7 | pass 8 | diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_mixed_quotes_class_var_2.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_mixed_quotes_class_var_2.py.snap index dca02c5afb..78508a4991 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_mixed_quotes_class_var_2.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_mixed_quotes_class_var_2.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs --- -error[Q002]: docstring_doubles_mixed_quotes_class_var_2.py:2:5: [*] Double quote docstring found but single quotes preferred +error[Q002]: 2:5: [*] Double quote docstring found but single quotes preferred + --> docstring_doubles_mixed_quotes_class_var_2.py:2:5 | 1 | class SingleLineDocstrings(): 2 | "Do not"' start with empty string' ' and lint docstring safely' @@ -18,8 +19,9 @@ error[Q002]: docstring_doubles_mixed_quotes_class_var_2.py:2:5: [*] Double quote 4 4 | 5 5 | def foo(self, bar="""not a docstring"""): -error[Q002]: docstring_doubles_mixed_quotes_class_var_2.py:6:9: [*] Double quote docstring found but single quotes preferred +error[Q002]: 6:9: [*] Double quote docstring found but single quotes preferred + --> docstring_doubles_mixed_quotes_class_var_2.py:6:9 | 5 | def foo(self, bar="""not a docstring"""): 6 | "Do not"' start with empty string' ' and lint docstring safely' @@ -37,8 +39,9 @@ error[Q002]: docstring_doubles_mixed_quotes_class_var_2.py:6:9: [*] Double quote 8 8 | 9 9 | class Nested(foo()[:]): "Do not"' start with empty string' ' and lint docstring safely'; pass -error[Q002]: docstring_doubles_mixed_quotes_class_var_2.py:9:29: [*] Double quote docstring found but single quotes preferred +error[Q002]: 9:29: [*] Double quote docstring found but single quotes preferred + --> docstring_doubles_mixed_quotes_class_var_2.py:9:29 | 7 | pass 8 | diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_mixed_quotes_module_singleline_var_1.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_mixed_quotes_module_singleline_var_1.py.snap index 03141875b2..f8e5e3c9af 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_mixed_quotes_module_singleline_var_1.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_mixed_quotes_module_singleline_var_1.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs --- -error[Q002]: docstring_doubles_mixed_quotes_module_singleline_var_1.py:1:1: Double quote docstring found but single quotes preferred +error[Q002]: 1:1: Double quote docstring found but single quotes preferred + --> docstring_doubles_mixed_quotes_module_singleline_var_1.py:1:1 | 1 | ""'Start with empty string' ' and lint docstring safely' | ^^ diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_mixed_quotes_module_singleline_var_2.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_mixed_quotes_module_singleline_var_2.py.snap index d4e55a2a2f..ea6bd3d95e 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_mixed_quotes_module_singleline_var_2.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_mixed_quotes_module_singleline_var_2.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs --- -error[Q002]: docstring_doubles_mixed_quotes_module_singleline_var_2.py:1:1: [*] Double quote docstring found but single quotes preferred +error[Q002]: 1:1: [*] Double quote docstring found but single quotes preferred + --> docstring_doubles_mixed_quotes_module_singleline_var_2.py:1:1 | 1 | "Do not"' start with empty string' ' and lint docstring safely' | ^^^^^^^^ diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_module_multiline.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_module_multiline.py.snap index b6debd5cd3..4004c648ba 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_module_multiline.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_module_multiline.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs --- -error[Q002]: docstring_doubles_module_multiline.py:1:1: [*] Double quote docstring found but single quotes preferred +error[Q002]: 1:1: [*] Double quote docstring found but single quotes preferred + --> docstring_doubles_module_multiline.py:1:1 | 1 | / """ 2 | | Double quotes multiline module docstring diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_module_singleline.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_module_singleline.py.snap index bc496c4333..270a363e19 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_module_singleline.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_module_singleline.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs --- -error[Q002]: docstring_doubles_module_singleline.py:1:1: [*] Double quote docstring found but single quotes preferred +error[Q002]: 1:1: [*] Double quote docstring found but single quotes preferred + --> docstring_doubles_module_singleline.py:1:1 | 1 | """ Double quotes singleline module docstring """ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles.py.snap index 2e324eb5e6..d7c061729a 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs --- -error[Q001]: docstring_singles.py:5:1: [*] Single quote multiline found but double quotes preferred +error[Q001]: 5:1: [*] Single quote multiline found but double quotes preferred + --> docstring_singles.py:4:1 | 3 | ''' 4 | @@ -27,8 +28,9 @@ error[Q001]: docstring_singles.py:5:1: [*] Single quote multiline found but doub 9 9 | l = [] 10 10 | -error[Q001]: docstring_singles.py:11:21: [*] Single quote multiline found but double quotes preferred +error[Q001]: 11:21: [*] Single quote multiline found but double quotes preferred + --> docstring_singles.py:11:21 | 9 | l = [] 10 | @@ -54,8 +56,9 @@ error[Q001]: docstring_singles.py:11:21: [*] Single quote multiline found but do 15 15 | Single quotes multiline class docstring 16 16 | ''' -error[Q001]: docstring_singles.py:18:5: [*] Single quote multiline found but double quotes preferred +error[Q001]: 18:5: [*] Single quote multiline found but double quotes preferred + --> docstring_singles.py:18:5 | 16 | ''' 17 | @@ -81,8 +84,9 @@ error[Q001]: docstring_singles.py:18:5: [*] Single quote multiline found but dou 22 22 | # The colon in the list indexing below is an edge case for the docstring scanner 23 23 | def f(self, bar=''' -error[Q001]: docstring_singles.py:23:21: [*] Single quote multiline found but double quotes preferred +error[Q001]: 23:21: [*] Single quote multiline found but double quotes preferred + --> docstring_singles.py:23:21 | 22 | # The colon in the list indexing below is an edge case for the docstring scanner 23 | def f(self, bar=''' @@ -105,8 +109,9 @@ error[Q001]: docstring_singles.py:23:21: [*] Single quote multiline found but do 26 26 | ''' 27 27 | Single quotes multiline function docstring -error[Q001]: docstring_singles.py:32:9: [*] Single quote multiline found but double quotes preferred +error[Q001]: 32:9: [*] Single quote multiline found but double quotes preferred + --> docstring_singles.py:32:9 | 30 | some_expression = 'hello world' 31 | @@ -132,8 +137,9 @@ error[Q001]: docstring_singles.py:32:9: [*] Single quote multiline found but dou 36 36 | if l: 37 37 | ''' -error[Q001]: docstring_singles.py:37:13: [*] Single quote multiline found but double quotes preferred +error[Q001]: 37:13: [*] Single quote multiline found but double quotes preferred + --> docstring_singles.py:37:13 | 36 | if l: 37 | ''' diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_class.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_class.py.snap index a9f42290fa..408c6b4d84 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_class.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_class.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs --- -error[Q001]: docstring_singles_class.py:3:5: [*] Single quote multiline found but double quotes preferred +error[Q001]: 3:5: [*] Single quote multiline found but double quotes preferred + --> docstring_singles_class.py:3:5 | 1 | class SingleLineDocstrings(): 2 | ''' Double quotes single line class docstring ''' @@ -21,8 +22,9 @@ error[Q001]: docstring_singles_class.py:3:5: [*] Single quote multiline found bu 5 5 | def foo(self, bar='''not a docstring'''): 6 6 | ''' Double quotes single line method docstring''' -error[Q001]: docstring_singles_class.py:5:23: [*] Single quote multiline found but double quotes preferred +error[Q001]: 5:23: [*] Single quote multiline found but double quotes preferred + --> docstring_singles_class.py:5:23 | 3 | ''' Not a docstring ''' 4 | diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_function.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_function.py.snap index 04f9b35b23..43438a0c01 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_function.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_function.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs --- -error[Q001]: docstring_singles_function.py:3:5: [*] Single quote multiline found but double quotes preferred +error[Q001]: 3:5: [*] Single quote multiline found but double quotes preferred + --> docstring_singles_function.py:3:5 | 1 | def foo(): 2 | '''function without params, single line docstring''' @@ -20,8 +21,9 @@ error[Q001]: docstring_singles_function.py:3:5: [*] Single quote multiline found 5 5 | 6 6 | -error[Q001]: docstring_singles_function.py:11:5: [*] Single quote multiline found but double quotes preferred +error[Q001]: 11:5: [*] Single quote multiline found but double quotes preferred + --> docstring_singles_function.py:11:5 | 9 | function without params, multiline docstring 10 | ''' @@ -40,8 +42,9 @@ error[Q001]: docstring_singles_function.py:11:5: [*] Single quote multiline foun 13 13 | 14 14 | -error[Q001]: docstring_singles_function.py:15:39: [*] Single quote multiline found but double quotes preferred +error[Q001]: 15:39: [*] Single quote multiline found but double quotes preferred + --> docstring_singles_function.py:15:39 | 15 | def fun_with_params_no_docstring(a, b=''' | _______________________________________^ @@ -64,8 +67,9 @@ error[Q001]: docstring_singles_function.py:15:39: [*] Single quote multiline fou 19 19 | 20 20 | -error[Q001]: docstring_singles_function.py:17:5: [*] Single quote multiline found but double quotes preferred +error[Q001]: 17:5: [*] Single quote multiline found but double quotes preferred + --> docstring_singles_function.py:17:5 | 15 | def fun_with_params_no_docstring(a, b=''' 16 | not a @@ -84,8 +88,9 @@ error[Q001]: docstring_singles_function.py:17:5: [*] Single quote multiline foun 19 19 | 20 20 | -error[Q001]: docstring_singles_function.py:22:5: [*] Single quote multiline found but double quotes preferred +error[Q001]: 22:5: [*] Single quote multiline found but double quotes preferred + --> docstring_singles_function.py:22:5 | 21 | def fun_with_params_no_docstring2(a, b=c[foo():], c=\ 22 | ''' not a docstring '''): diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_module_multiline.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_module_multiline.py.snap index 75d4b711f5..3171e7a9bd 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_module_multiline.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_module_multiline.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs --- -error[Q001]: docstring_singles_module_multiline.py:4:1: [*] Single quote multiline found but double quotes preferred +error[Q001]: 4:1: [*] Single quote multiline found but double quotes preferred + --> docstring_singles_module_multiline.py:3:4 | 2 | Double quotes multiline module docstring 3 | ''' @@ -27,8 +28,9 @@ error[Q001]: docstring_singles_module_multiline.py:4:1: [*] Single quote multili 8 8 | pass 9 9 | ''' -error[Q001]: docstring_singles_module_multiline.py:9:1: [*] Single quote multiline found but double quotes preferred +error[Q001]: 9:1: [*] Single quote multiline found but double quotes preferred + --> docstring_singles_module_multiline.py:8:9 | 7 | def foo(): 8 | pass diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_module_singleline.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_module_singleline.py.snap index 4166dc6ed0..ffda5f4fc4 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_module_singleline.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_module_singleline.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs --- -error[Q001]: docstring_singles_module_singleline.py:2:1: [*] Single quote multiline found but double quotes preferred +error[Q001]: 2:1: [*] Single quote multiline found but double quotes preferred + --> docstring_singles_module_singleline.py:1:50 | 1 | ''' Double quotes singleline module docstring ''' 2 | ''' this is not a docstring ''' @@ -19,8 +20,9 @@ error[Q001]: docstring_singles_module_singleline.py:2:1: [*] Single quote multil 4 4 | def foo(): 5 5 | pass -error[Q001]: docstring_singles_module_singleline.py:6:1: [*] Single quote multiline found but double quotes preferred +error[Q001]: 6:1: [*] Single quote multiline found but double quotes preferred + --> docstring_singles_module_singleline.py:5:9 | 4 | def foo(): 5 | pass diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles.py.snap index 38922b195a..b2511da375 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs --- -error[Q000]: singles.py:1:25: [*] Single quotes found but double quotes preferred +error[Q000]: 1:25: [*] Single quotes found but double quotes preferred + --> singles.py:1:25 | 1 | this_should_be_linted = 'single quote string' | ^^^^^^^^^^^^^^^^^^^^^ @@ -17,8 +18,9 @@ error[Q000]: singles.py:1:25: [*] Single quotes found but double quotes preferre 3 3 | this_should_be_linted = f'double quote string' 4 4 | this_should_be_linted = f'double {"quote"} string' -error[Q000]: singles.py:2:25: [*] Single quotes found but double quotes preferred +error[Q000]: 2:25: [*] Single quotes found but double quotes preferred + --> singles.py:2:25 | 1 | this_should_be_linted = 'single quote string' 2 | this_should_be_linted = u'double quote string' @@ -35,8 +37,9 @@ error[Q000]: singles.py:2:25: [*] Single quotes found but double quotes preferre 4 4 | this_should_be_linted = f'double {"quote"} string' 5 5 | -error[Q000]: singles.py:3:25: [*] Single quotes found but double quotes preferred +error[Q000]: 3:25: [*] Single quotes found but double quotes preferred + --> singles.py:3:25 | 1 | this_should_be_linted = 'single quote string' 2 | this_should_be_linted = u'double quote string' diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_escaped.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_escaped.py.snap index b0e067358e..8eb93b30c1 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_escaped.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_escaped.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs --- -error[Q003]: singles_escaped.py:1:26: [*] Change outer quotes to avoid escaping inner quotes +error[Q003]: 1:26: [*] Change outer quotes to avoid escaping inner quotes + --> singles_escaped.py:1:26 | 1 | this_should_raise_Q003 = "This is a \"string\"" | ^^^^^^^^^^^^^^^^^^^^^^ @@ -17,8 +18,9 @@ error[Q003]: singles_escaped.py:1:26: [*] Change outer quotes to avoid escaping 3 3 | this_is_fine = 'This is a "string"' 4 4 | this_is_fine = '\'This\' is a "string"' -error[Q003]: singles_escaped.py:9:5: [*] Change outer quotes to avoid escaping inner quotes +error[Q003]: 9:5: [*] Change outer quotes to avoid escaping inner quotes + --> singles_escaped.py:9:5 | 7 | this_should_raise = ( 8 | "This is a" @@ -37,8 +39,9 @@ error[Q003]: singles_escaped.py:9:5: [*] Change outer quotes to avoid escaping i 11 11 | 12 12 | # Same as above, but with f-strings -error[Q003]: singles_escaped.py:13:1: [*] Change outer quotes to avoid escaping inner quotes +error[Q003]: 13:1: [*] Change outer quotes to avoid escaping inner quotes + --> singles_escaped.py:12:36 | 12 | # Same as above, but with f-strings 13 | f"This is a \"string\"" @@ -57,8 +60,9 @@ error[Q003]: singles_escaped.py:13:1: [*] Change outer quotes to avoid escaping 15 15 | f'This is a "string"' 16 16 | f'\'This\' is a "string"' -error[Q003]: singles_escaped.py:21:5: [*] Change outer quotes to avoid escaping inner quotes +error[Q003]: 21:5: [*] Change outer quotes to avoid escaping inner quotes + --> singles_escaped.py:21:5 | 19 | foo = ( 20 | f"This is a" @@ -77,8 +81,9 @@ error[Q003]: singles_escaped.py:21:5: [*] Change outer quotes to avoid escaping 23 23 | 24 24 | # Nested f-strings (Python 3.12+) -error[Q003]: singles_escaped.py:31:1: [*] Change outer quotes to avoid escaping inner quotes +error[Q003]: 31:1: [*] Change outer quotes to avoid escaping inner quotes + --> singles_escaped.py:30:74 | 29 | # 30 | # but as the actual string itself is invalid pre 3.12, we don't catch it. @@ -98,8 +103,9 @@ error[Q003]: singles_escaped.py:31:1: [*] Change outer quotes to avoid escaping 33 33 | f"\"foo\" {f"\"foo\""} \"\"" # Q003 34 34 | -error[Q003]: singles_escaped.py:32:1: [*] Change outer quotes to avoid escaping inner quotes +error[Q003]: 32:1: [*] Change outer quotes to avoid escaping inner quotes + --> singles_escaped.py:31:27 | 30 | # but as the actual string itself is invalid pre 3.12, we don't catch it. 31 | f"\"foo\" {"foo"}" # Q003 @@ -118,8 +124,9 @@ error[Q003]: singles_escaped.py:32:1: [*] Change outer quotes to avoid escaping 34 34 | 35 35 | f"normal {f"nested"} normal" -error[Q003]: singles_escaped.py:33:1: [*] Change outer quotes to avoid escaping inner quotes +error[Q003]: 33:1: [*] Change outer quotes to avoid escaping inner quotes + --> singles_escaped.py:32:28 | 31 | f"\"foo\" {"foo"}" # Q003 32 | f"\"foo\" {f"foo"}" # Q003 @@ -139,8 +146,9 @@ error[Q003]: singles_escaped.py:33:1: [*] Change outer quotes to avoid escaping 35 35 | f"normal {f"nested"} normal" 36 36 | f"\"normal\" {f"nested"} normal" # Q003 -error[Q003]: singles_escaped.py:33:12: [*] Change outer quotes to avoid escaping inner quotes +error[Q003]: 33:12: [*] Change outer quotes to avoid escaping inner quotes + --> singles_escaped.py:33:12 | 31 | f"\"foo\" {"foo"}" # Q003 32 | f"\"foo\" {f"foo"}" # Q003 @@ -160,8 +168,9 @@ error[Q003]: singles_escaped.py:33:12: [*] Change outer quotes to avoid escaping 35 35 | f"normal {f"nested"} normal" 36 36 | f"\"normal\" {f"nested"} normal" # Q003 -error[Q003]: singles_escaped.py:36:1: [*] Change outer quotes to avoid escaping inner quotes +error[Q003]: 36:1: [*] Change outer quotes to avoid escaping inner quotes + --> singles_escaped.py:35:29 | 35 | f"normal {f"nested"} normal" 36 | f"\"normal\" {f"nested"} normal" # Q003 @@ -180,8 +189,9 @@ error[Q003]: singles_escaped.py:36:1: [*] Change outer quotes to avoid escaping 38 38 | f"\"normal\" {f"\"nested\" {"other"} normal"} 'single quotes'" # Q003 39 39 | f"\"normal\" {f"\"nested\" {"other"} 'single quotes'"} normal" # Q003 -error[Q003]: singles_escaped.py:38:15: [*] Change outer quotes to avoid escaping inner quotes +error[Q003]: 38:15: [*] Change outer quotes to avoid escaping inner quotes + --> singles_escaped.py:38:15 | 36 | f"\"normal\" {f"nested"} normal" # Q003 37 | f"\"normal\" {f"nested"} 'single quotes'" @@ -198,8 +208,9 @@ error[Q003]: singles_escaped.py:38:15: [*] Change outer quotes to avoid escaping 38 |+f"\"normal\" {f'"nested" {"other"} normal'} 'single quotes'" # Q003 39 39 | f"\"normal\" {f"\"nested\" {"other"} 'single quotes'"} normal" # Q003 -error[Q003]: singles_escaped.py:39:1: [*] Change outer quotes to avoid escaping inner quotes +error[Q003]: 39:1: [*] Change outer quotes to avoid escaping inner quotes + --> singles_escaped.py:38:71 | 37 | f"\"normal\" {f"nested"} 'single quotes'" 38 | f"\"normal\" {f"\"nested\" {"other"} normal"} 'single quotes'" # Q003 diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_escaped_py311.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_escaped_py311.snap index cc131b233d..b86295c0af 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_escaped_py311.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_escaped_py311.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs --- -error[Q003]: singles_escaped.py:1:26: [*] Change outer quotes to avoid escaping inner quotes +error[Q003]: 1:26: [*] Change outer quotes to avoid escaping inner quotes + --> singles_escaped.py:1:26 | 1 | this_should_raise_Q003 = "This is a \"string\"" | ^^^^^^^^^^^^^^^^^^^^^^ @@ -17,8 +18,9 @@ error[Q003]: singles_escaped.py:1:26: [*] Change outer quotes to avoid escaping 3 3 | this_is_fine = 'This is a "string"' 4 4 | this_is_fine = '\'This\' is a "string"' -error[Q003]: singles_escaped.py:9:5: [*] Change outer quotes to avoid escaping inner quotes +error[Q003]: 9:5: [*] Change outer quotes to avoid escaping inner quotes + --> singles_escaped.py:9:5 | 7 | this_should_raise = ( 8 | "This is a" @@ -37,8 +39,9 @@ error[Q003]: singles_escaped.py:9:5: [*] Change outer quotes to avoid escaping i 11 11 | 12 12 | # Same as above, but with f-strings -error[Q003]: singles_escaped.py:13:1: [*] Change outer quotes to avoid escaping inner quotes +error[Q003]: 13:1: [*] Change outer quotes to avoid escaping inner quotes + --> singles_escaped.py:12:36 | 12 | # Same as above, but with f-strings 13 | f"This is a \"string\"" @@ -57,8 +60,9 @@ error[Q003]: singles_escaped.py:13:1: [*] Change outer quotes to avoid escaping 15 15 | f'This is a "string"' 16 16 | f'\'This\' is a "string"' -error[Q003]: singles_escaped.py:21:5: [*] Change outer quotes to avoid escaping inner quotes +error[Q003]: 21:5: [*] Change outer quotes to avoid escaping inner quotes + --> singles_escaped.py:21:5 | 19 | foo = ( 20 | f"This is a" diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_escaped_unnecessary.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_escaped_unnecessary.py.snap index 058fb1967f..5b588f589c 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_escaped_unnecessary.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_escaped_unnecessary.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs --- -error[Q004]: singles_escaped_unnecessary.py:1:26: [*] Unnecessary escape on inner quote character +error[Q004]: 1:26: [*] Unnecessary escape on inner quote character + --> singles_escaped_unnecessary.py:1:26 | 1 | this_should_raise_Q004 = "This is a \'string\'" | ^^^^^^^^^^^^^^^^^^^^^^ @@ -17,8 +18,9 @@ error[Q004]: singles_escaped_unnecessary.py:1:26: [*] Unnecessary escape on inne 3 3 | this_is_fine = 'This is a "string"' 4 4 | this_is_fine = '\'This\' is a "string"' -error[Q004]: singles_escaped_unnecessary.py:2:26: [*] Unnecessary escape on inner quote character +error[Q004]: 2:26: [*] Unnecessary escape on inner quote character + --> singles_escaped_unnecessary.py:2:26 | 1 | this_should_raise_Q004 = "This is a \'string\'" 2 | this_should_raise_Q004 = "'This' is a \'string\'" @@ -35,8 +37,9 @@ error[Q004]: singles_escaped_unnecessary.py:2:26: [*] Unnecessary escape on inne 4 4 | this_is_fine = '\'This\' is a "string"' 5 5 | this_is_fine = r"This is a \'string\'" -error[Q004]: singles_escaped_unnecessary.py:9:5: [*] Unnecessary escape on inner quote character +error[Q004]: 9:5: [*] Unnecessary escape on inner quote character + --> singles_escaped_unnecessary.py:9:5 | 7 | this_should_raise_Q004 = ( 8 | "This is a" @@ -55,8 +58,9 @@ error[Q004]: singles_escaped_unnecessary.py:9:5: [*] Unnecessary escape on inner 11 11 | 12 12 | # Same as above, but with f-strings -error[Q004]: singles_escaped_unnecessary.py:13:1: [*] Unnecessary escape on inner quote character +error[Q004]: 13:1: [*] Unnecessary escape on inner quote character + --> singles_escaped_unnecessary.py:12:36 | 12 | # Same as above, but with f-strings 13 | f"This is a \'string\'" # Q004 @@ -75,8 +79,9 @@ error[Q004]: singles_escaped_unnecessary.py:13:1: [*] Unnecessary escape on inne 15 15 | f'This is a "string"' 16 16 | f'\'This\' is a "string"' -error[Q004]: singles_escaped_unnecessary.py:14:1: [*] Unnecessary escape on inner quote character +error[Q004]: 14:1: [*] Unnecessary escape on inner quote character + --> singles_escaped_unnecessary.py:13:32 | 12 | # Same as above, but with f-strings 13 | f"This is a \'string\'" # Q004 @@ -96,8 +101,9 @@ error[Q004]: singles_escaped_unnecessary.py:14:1: [*] Unnecessary escape on inne 16 16 | f'\'This\' is a "string"' 17 17 | fr"This is a \'string\'" -error[Q004]: singles_escaped_unnecessary.py:21:5: [*] Unnecessary escape on inner quote character +error[Q004]: 21:5: [*] Unnecessary escape on inner quote character + --> singles_escaped_unnecessary.py:21:5 | 19 | this_should_raise_Q004 = ( 20 | f"This is a" @@ -116,8 +122,9 @@ error[Q004]: singles_escaped_unnecessary.py:21:5: [*] Unnecessary escape on inne 23 23 | 24 24 | # Nested f-strings (Python 3.12+) -error[Q004]: singles_escaped_unnecessary.py:31:1: [*] Unnecessary escape on inner quote character +error[Q004]: 31:1: [*] Unnecessary escape on inner quote character + --> singles_escaped_unnecessary.py:30:74 | 29 | # 30 | # but as the actual string itself is invalid pre 3.12, we don't catch it. @@ -137,8 +144,9 @@ error[Q004]: singles_escaped_unnecessary.py:31:1: [*] Unnecessary escape on inne 33 33 | f"\'foo\' {f"\'foo\'"} \'\'" # Q004 34 34 | -error[Q004]: singles_escaped_unnecessary.py:32:1: [*] Unnecessary escape on inner quote character +error[Q004]: 32:1: [*] Unnecessary escape on inner quote character + --> singles_escaped_unnecessary.py:31:27 | 30 | # but as the actual string itself is invalid pre 3.12, we don't catch it. 31 | f"\'foo\' {"foo"}" # Q004 @@ -157,8 +165,9 @@ error[Q004]: singles_escaped_unnecessary.py:32:1: [*] Unnecessary escape on inne 34 34 | 35 35 | f"normal {f"nested"} normal" -error[Q004]: singles_escaped_unnecessary.py:33:1: [*] Unnecessary escape on inner quote character +error[Q004]: 33:1: [*] Unnecessary escape on inner quote character + --> singles_escaped_unnecessary.py:32:28 | 31 | f"\'foo\' {"foo"}" # Q004 32 | f"\'foo\' {f"foo"}" # Q004 @@ -178,8 +187,9 @@ error[Q004]: singles_escaped_unnecessary.py:33:1: [*] Unnecessary escape on inne 35 35 | f"normal {f"nested"} normal" 36 36 | f"\'normal\' {f"nested"} normal" # Q004 -error[Q004]: singles_escaped_unnecessary.py:33:12: [*] Unnecessary escape on inner quote character +error[Q004]: 33:12: [*] Unnecessary escape on inner quote character + --> singles_escaped_unnecessary.py:33:12 | 31 | f"\'foo\' {"foo"}" # Q004 32 | f"\'foo\' {f"foo"}" # Q004 @@ -199,8 +209,9 @@ error[Q004]: singles_escaped_unnecessary.py:33:12: [*] Unnecessary escape on inn 35 35 | f"normal {f"nested"} normal" 36 36 | f"\'normal\' {f"nested"} normal" # Q004 -error[Q004]: singles_escaped_unnecessary.py:36:1: [*] Unnecessary escape on inner quote character +error[Q004]: 36:1: [*] Unnecessary escape on inner quote character + --> singles_escaped_unnecessary.py:35:29 | 35 | f"normal {f"nested"} normal" 36 | f"\'normal\' {f"nested"} normal" # Q004 @@ -219,8 +230,9 @@ error[Q004]: singles_escaped_unnecessary.py:36:1: [*] Unnecessary escape on inne 38 38 | f"\'normal\' {f"\'nested\' {"other"} normal"} 'single quotes'" # Q004 39 39 | f"\'normal\' {f"\'nested\' {"other"} 'single quotes'"} normal" # Q004 -error[Q004]: singles_escaped_unnecessary.py:37:1: [*] Unnecessary escape on inner quote character +error[Q004]: 37:1: [*] Unnecessary escape on inner quote character + --> singles_escaped_unnecessary.py:36:41 | 35 | f"normal {f"nested"} normal" 36 | f"\'normal\' {f"nested"} normal" # Q004 @@ -240,8 +252,9 @@ error[Q004]: singles_escaped_unnecessary.py:37:1: [*] Unnecessary escape on inne 39 39 | f"\'normal\' {f"\'nested\' {"other"} 'single quotes'"} normal" # Q004 40 40 | -error[Q004]: singles_escaped_unnecessary.py:38:1: [*] Unnecessary escape on inner quote character +error[Q004]: 38:1: [*] Unnecessary escape on inner quote character + --> singles_escaped_unnecessary.py:37:42 | 36 | f"\'normal\' {f"nested"} normal" # Q004 37 | f"\'normal\' {f"nested"} 'single quotes'" @@ -260,8 +273,9 @@ error[Q004]: singles_escaped_unnecessary.py:38:1: [*] Unnecessary escape on inne 40 40 | 41 41 | # Make sure we do not unescape quotes -error[Q004]: singles_escaped_unnecessary.py:38:15: [*] Unnecessary escape on inner quote character +error[Q004]: 38:15: [*] Unnecessary escape on inner quote character + --> singles_escaped_unnecessary.py:38:15 | 36 | f"\'normal\' {f"nested"} normal" # Q004 37 | f"\'normal\' {f"nested"} 'single quotes'" @@ -280,8 +294,9 @@ error[Q004]: singles_escaped_unnecessary.py:38:15: [*] Unnecessary escape on inn 40 40 | 41 41 | # Make sure we do not unescape quotes -error[Q004]: singles_escaped_unnecessary.py:39:1: [*] Unnecessary escape on inner quote character +error[Q004]: 39:1: [*] Unnecessary escape on inner quote character + --> singles_escaped_unnecessary.py:38:71 | 37 | f"\'normal\' {f"nested"} 'single quotes'" 38 | f"\'normal\' {f"\'nested\' {"other"} normal"} 'single quotes'" # Q004 @@ -301,8 +316,9 @@ error[Q004]: singles_escaped_unnecessary.py:39:1: [*] Unnecessary escape on inne 41 41 | # Make sure we do not unescape quotes 42 42 | this_is_fine = "This is an \\'escaped\\' quote" -error[Q004]: singles_escaped_unnecessary.py:39:15: [*] Unnecessary escape on inner quote character +error[Q004]: 39:15: [*] Unnecessary escape on inner quote character + --> singles_escaped_unnecessary.py:39:15 | 37 | f"\'normal\' {f"nested"} 'single quotes'" 38 | f"\'normal\' {f"\'nested\' {"other"} normal"} 'single quotes'" # Q004 @@ -322,8 +338,9 @@ error[Q004]: singles_escaped_unnecessary.py:39:15: [*] Unnecessary escape on inn 41 41 | # Make sure we do not unescape quotes 42 42 | this_is_fine = "This is an \\'escaped\\' quote" -error[Q004]: singles_escaped_unnecessary.py:43:26: [*] Unnecessary escape on inner quote character +error[Q004]: 43:26: [*] Unnecessary escape on inner quote character + --> singles_escaped_unnecessary.py:43:26 | 41 | # Make sure we do not unescape quotes 42 | this_is_fine = "This is an \\'escaped\\' quote" @@ -343,8 +360,9 @@ error[Q004]: singles_escaped_unnecessary.py:43:26: [*] Unnecessary escape on inn 45 45 | # Invalid escapes in bytestrings are also triggered: 46 46 | x = b"\xe7\xeb\x0c\xa1\x1b\x83tN\xce=x\xe9\xbe\x01\xb9\x13B_\xba\xe7\x0c2\xce\'rm\x0e\xcd\xe9.\xf8\xd2" # Q004 -error[Q004]: singles_escaped_unnecessary.py:46:5: [*] Unnecessary escape on inner quote character +error[Q004]: 46:5: [*] Unnecessary escape on inner quote character + --> singles_escaped_unnecessary.py:46:5 | 45 | # Invalid escapes in bytestrings are also triggered: 46 | x = b"\xe7\xeb\x0c\xa1\x1b\x83tN\xce=x\xe9\xbe\x01\xb9\x13B_\xba\xe7\x0c2\xce\'rm\x0e\xcd\xe9.\xf8\xd2" # Q004 diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_implicit.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_implicit.py.snap index 59c6ce92db..006fc20175 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_implicit.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_implicit.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs --- -error[Q000]: singles_implicit.py:2:5: [*] Single quotes found but double quotes preferred +error[Q000]: 2:5: [*] Single quotes found but double quotes preferred + --> singles_implicit.py:2:5 | 1 | x = ( 2 | 'This' @@ -19,8 +20,9 @@ error[Q000]: singles_implicit.py:2:5: [*] Single quotes found but double quotes 4 4 | 'not' 5 5 | ) -error[Q000]: singles_implicit.py:3:5: [*] Single quotes found but double quotes preferred +error[Q000]: 3:5: [*] Single quotes found but double quotes preferred + --> singles_implicit.py:3:5 | 1 | x = ( 2 | 'This' @@ -39,8 +41,9 @@ error[Q000]: singles_implicit.py:3:5: [*] Single quotes found but double quotes 5 5 | ) 6 6 | -error[Q000]: singles_implicit.py:4:5: [*] Single quotes found but double quotes preferred +error[Q000]: 4:5: [*] Single quotes found but double quotes preferred + --> singles_implicit.py:4:5 | 2 | 'This' 3 | 'is' @@ -59,8 +62,9 @@ error[Q000]: singles_implicit.py:4:5: [*] Single quotes found but double quotes 6 6 | 7 7 | x = ( -error[Q000]: singles_implicit.py:8:5: [*] Single quotes found but double quotes preferred +error[Q000]: 8:5: [*] Single quotes found but double quotes preferred + --> singles_implicit.py:8:5 | 7 | x = ( 8 | 'This' \ @@ -79,8 +83,9 @@ error[Q000]: singles_implicit.py:8:5: [*] Single quotes found but double quotes 10 10 | 'not' 11 11 | ) -error[Q000]: singles_implicit.py:9:5: [*] Single quotes found but double quotes preferred +error[Q000]: 9:5: [*] Single quotes found but double quotes preferred + --> singles_implicit.py:9:5 | 7 | x = ( 8 | 'This' \ @@ -100,8 +105,9 @@ error[Q000]: singles_implicit.py:9:5: [*] Single quotes found but double quotes 11 11 | ) 12 12 | -error[Q000]: singles_implicit.py:10:5: [*] Single quotes found but double quotes preferred +error[Q000]: 10:5: [*] Single quotes found but double quotes preferred + --> singles_implicit.py:10:5 | 8 | 'This' \ 9 | 'is' \ @@ -120,8 +126,9 @@ error[Q000]: singles_implicit.py:10:5: [*] Single quotes found but double quotes 12 12 | 13 13 | x = ( -error[Q000]: singles_implicit.py:27:1: [*] Single quotes found but double quotes preferred +error[Q000]: 27:1: [*] Single quotes found but double quotes preferred + --> singles_implicit.py:26:35 | 25 | if True: 26 | 'This can use "single" quotes' diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_multiline_string.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_multiline_string.py.snap index e56538cae2..847dc75594 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_multiline_string.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_multiline_string.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs --- -error[Q001]: singles_multiline_string.py:1:5: [*] Single quote multiline found but double quotes preferred +error[Q001]: 1:5: [*] Single quote multiline found but double quotes preferred + --> singles_multiline_string.py:1:5 | 1 | s = ''' This 'should' | _____^ diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_would_be_triple_quotes.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_would_be_triple_quotes.py.snap index 9067ad457c..ac317b3f16 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_would_be_triple_quotes.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_would_be_triple_quotes.py.snap @@ -1,16 +1,18 @@ --- source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs --- -error[Q000]: singles_would_be_triple_quotes.py:1:5: Single quotes found but double quotes preferred +error[Q000]: 1:5: Single quotes found but double quotes preferred + --> singles_would_be_triple_quotes.py:1:5 | 1 | s = ''"Start with empty string" ' and lint docstring safely' | ^^ 2 | s = 'Do not'" start with empty string" ' and lint docstring safely' | = help: Replace single quotes with double quotes -error[Q000]: singles_would_be_triple_quotes.py:1:33: [*] Single quotes found but double quotes preferred +error[Q000]: 1:33: [*] Single quotes found but double quotes preferred + --> singles_would_be_triple_quotes.py:1:33 | 1 | s = ''"Start with empty string" ' and lint docstring safely' | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -22,8 +24,9 @@ error[Q000]: singles_would_be_triple_quotes.py:1:33: [*] Single quotes found but 1 |+s = ''"Start with empty string" " and lint docstring safely" 2 2 | s = 'Do not'" start with empty string" ' and lint docstring safely' -error[Q000]: singles_would_be_triple_quotes.py:2:5: [*] Single quotes found but double quotes preferred +error[Q000]: 2:5: [*] Single quotes found but double quotes preferred + --> singles_would_be_triple_quotes.py:2:5 | 1 | s = ''"Start with empty string" ' and lint docstring safely' 2 | s = 'Do not'" start with empty string" ' and lint docstring safely' @@ -35,8 +38,9 @@ error[Q000]: singles_would_be_triple_quotes.py:2:5: [*] Single quotes found but 2 |-s = 'Do not'" start with empty string" ' and lint docstring safely' 2 |+s = "Do not"" start with empty string" ' and lint docstring safely' -error[Q000]: singles_would_be_triple_quotes.py:2:40: [*] Single quotes found but double quotes preferred +error[Q000]: 2:40: [*] Single quotes found but double quotes preferred + --> singles_would_be_triple_quotes.py:2:40 | 1 | s = ''"Start with empty string" ' and lint docstring safely' 2 | s = 'Do not'" start with empty string" ' and lint docstring safely' diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles.py.snap index a0044c4473..b37e53be9b 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs --- -error[Q000]: doubles.py:1:25: [*] Double quotes found but single quotes preferred +error[Q000]: 1:25: [*] Double quotes found but single quotes preferred + --> doubles.py:1:25 | 1 | this_should_be_linted = "double quote string" | ^^^^^^^^^^^^^^^^^^^^^ @@ -17,8 +18,9 @@ error[Q000]: doubles.py:1:25: [*] Double quotes found but single quotes preferre 3 3 | this_should_be_linted = f"double quote string" 4 4 | this_should_be_linted = f"double {'quote'} string" -error[Q000]: doubles.py:2:25: [*] Double quotes found but single quotes preferred +error[Q000]: 2:25: [*] Double quotes found but single quotes preferred + --> doubles.py:2:25 | 1 | this_should_be_linted = "double quote string" 2 | this_should_be_linted = u"double quote string" @@ -34,8 +36,9 @@ error[Q000]: doubles.py:2:25: [*] Double quotes found but single quotes preferre 3 3 | this_should_be_linted = f"double quote string" 4 4 | this_should_be_linted = f"double {'quote'} string" -error[Q000]: doubles.py:3:25: [*] Double quotes found but single quotes preferred +error[Q000]: 3:25: [*] Double quotes found but single quotes preferred + --> doubles.py:3:25 | 1 | this_should_be_linted = "double quote string" 2 | this_should_be_linted = u"double quote string" diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_escaped.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_escaped.py.snap index dd63635e95..805e30758b 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_escaped.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_escaped.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs --- -error[Q003]: doubles_escaped.py:1:26: [*] Change outer quotes to avoid escaping inner quotes +error[Q003]: 1:26: [*] Change outer quotes to avoid escaping inner quotes + --> doubles_escaped.py:1:26 | 1 | this_should_raise_Q003 = 'This is a \'string\'' | ^^^^^^^^^^^^^^^^^^^^^^ @@ -17,8 +18,9 @@ error[Q003]: doubles_escaped.py:1:26: [*] Change outer quotes to avoid escaping 3 3 | this_is_fine = '"This" is a \'string\'' 4 4 | this_is_fine = "This is a 'string'" -error[Q003]: doubles_escaped.py:2:26: [*] Change outer quotes to avoid escaping inner quotes +error[Q003]: 2:26: [*] Change outer quotes to avoid escaping inner quotes + --> doubles_escaped.py:2:26 | 1 | this_should_raise_Q003 = 'This is a \'string\'' 2 | this_should_raise_Q003 = 'This is \\ a \\\'string\'' @@ -35,8 +37,9 @@ error[Q003]: doubles_escaped.py:2:26: [*] Change outer quotes to avoid escaping 4 4 | this_is_fine = "This is a 'string'" 5 5 | this_is_fine = "\"This\" is a 'string'" -error[Q003]: doubles_escaped.py:10:5: [*] Change outer quotes to avoid escaping inner quotes +error[Q003]: 10:5: [*] Change outer quotes to avoid escaping inner quotes + --> doubles_escaped.py:10:5 | 8 | this_should_raise = ( 9 | 'This is a' @@ -55,8 +58,9 @@ error[Q003]: doubles_escaped.py:10:5: [*] Change outer quotes to avoid escaping 12 12 | 13 13 | # Same as above, but with f-strings -error[Q003]: doubles_escaped.py:14:1: [*] Change outer quotes to avoid escaping inner quotes +error[Q003]: 14:1: [*] Change outer quotes to avoid escaping inner quotes + --> doubles_escaped.py:13:36 | 13 | # Same as above, but with f-strings 14 | f'This is a \'string\'' # Q003 @@ -75,8 +79,9 @@ error[Q003]: doubles_escaped.py:14:1: [*] Change outer quotes to avoid escaping 16 16 | f'"This" is a \'string\'' 17 17 | f"This is a 'string'" -error[Q003]: doubles_escaped.py:15:1: [*] Change outer quotes to avoid escaping inner quotes +error[Q003]: 15:1: [*] Change outer quotes to avoid escaping inner quotes + --> doubles_escaped.py:14:32 | 13 | # Same as above, but with f-strings 14 | f'This is a \'string\'' # Q003 @@ -96,8 +101,9 @@ error[Q003]: doubles_escaped.py:15:1: [*] Change outer quotes to avoid escaping 17 17 | f"This is a 'string'" 18 18 | f"\"This\" is a 'string'" -error[Q003]: doubles_escaped.py:23:5: [*] Change outer quotes to avoid escaping inner quotes +error[Q003]: 23:5: [*] Change outer quotes to avoid escaping inner quotes + --> doubles_escaped.py:23:5 | 21 | foo = ( 22 | f'This is a' @@ -116,8 +122,9 @@ error[Q003]: doubles_escaped.py:23:5: [*] Change outer quotes to avoid escaping 25 25 | 26 26 | # Nested f-strings (Python 3.12+) -error[Q003]: doubles_escaped.py:33:1: [*] Change outer quotes to avoid escaping inner quotes +error[Q003]: 33:1: [*] Change outer quotes to avoid escaping inner quotes + --> doubles_escaped.py:32:74 | 31 | # 32 | # but as the actual string itself is invalid pre 3.12, we don't catch it. @@ -137,8 +144,9 @@ error[Q003]: doubles_escaped.py:33:1: [*] Change outer quotes to avoid escaping 35 35 | f'\'foo\' {f'\'nested\''} \'\'' # Q003 36 36 | -error[Q003]: doubles_escaped.py:34:1: [*] Change outer quotes to avoid escaping inner quotes +error[Q003]: 34:1: [*] Change outer quotes to avoid escaping inner quotes + --> doubles_escaped.py:33:30 | 32 | # but as the actual string itself is invalid pre 3.12, we don't catch it. 33 | f'\'foo\' {'nested'}' # Q003 @@ -157,8 +165,9 @@ error[Q003]: doubles_escaped.py:34:1: [*] Change outer quotes to avoid escaping 36 36 | 37 37 | f'normal {f'nested'} normal' -error[Q003]: doubles_escaped.py:35:1: [*] Change outer quotes to avoid escaping inner quotes +error[Q003]: 35:1: [*] Change outer quotes to avoid escaping inner quotes + --> doubles_escaped.py:34:31 | 33 | f'\'foo\' {'nested'}' # Q003 34 | f'\'foo\' {f'nested'}' # Q003 @@ -178,8 +187,9 @@ error[Q003]: doubles_escaped.py:35:1: [*] Change outer quotes to avoid escaping 37 37 | f'normal {f'nested'} normal' 38 38 | f'\'normal\' {f'nested'} normal' # Q003 -error[Q003]: doubles_escaped.py:35:12: [*] Change outer quotes to avoid escaping inner quotes +error[Q003]: 35:12: [*] Change outer quotes to avoid escaping inner quotes + --> doubles_escaped.py:35:12 | 33 | f'\'foo\' {'nested'}' # Q003 34 | f'\'foo\' {f'nested'}' # Q003 @@ -199,8 +209,9 @@ error[Q003]: doubles_escaped.py:35:12: [*] Change outer quotes to avoid escaping 37 37 | f'normal {f'nested'} normal' 38 38 | f'\'normal\' {f'nested'} normal' # Q003 -error[Q003]: doubles_escaped.py:38:1: [*] Change outer quotes to avoid escaping inner quotes +error[Q003]: 38:1: [*] Change outer quotes to avoid escaping inner quotes + --> doubles_escaped.py:37:29 | 37 | f'normal {f'nested'} normal' 38 | f'\'normal\' {f'nested'} normal' # Q003 @@ -219,8 +230,9 @@ error[Q003]: doubles_escaped.py:38:1: [*] Change outer quotes to avoid escaping 40 40 | f'\'normal\' {f'\'nested\' {'other'} normal'} "double quotes"' # Q003 41 41 | f'\'normal\' {f'\'nested\' {'other'} "double quotes"'} normal' # Q00l -error[Q003]: doubles_escaped.py:40:15: [*] Change outer quotes to avoid escaping inner quotes +error[Q003]: 40:15: [*] Change outer quotes to avoid escaping inner quotes + --> doubles_escaped.py:40:15 | 38 | f'\'normal\' {f'nested'} normal' # Q003 39 | f'\'normal\' {f'nested'} "double quotes"' @@ -237,8 +249,9 @@ error[Q003]: doubles_escaped.py:40:15: [*] Change outer quotes to avoid escaping 40 |+f'\'normal\' {f"'nested' {'other'} normal"} "double quotes"' # Q003 41 41 | f'\'normal\' {f'\'nested\' {'other'} "double quotes"'} normal' # Q00l -error[Q003]: doubles_escaped.py:41:1: [*] Change outer quotes to avoid escaping inner quotes +error[Q003]: 41:1: [*] Change outer quotes to avoid escaping inner quotes + --> doubles_escaped.py:40:71 | 39 | f'\'normal\' {f'nested'} "double quotes"' 40 | f'\'normal\' {f'\'nested\' {'other'} normal'} "double quotes"' # Q003 diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_escaped_py311.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_escaped_py311.snap index 594af0cf7c..5ec7358cd8 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_escaped_py311.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_escaped_py311.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs --- -error[Q003]: doubles_escaped.py:1:26: [*] Change outer quotes to avoid escaping inner quotes +error[Q003]: 1:26: [*] Change outer quotes to avoid escaping inner quotes + --> doubles_escaped.py:1:26 | 1 | this_should_raise_Q003 = 'This is a \'string\'' | ^^^^^^^^^^^^^^^^^^^^^^ @@ -17,8 +18,9 @@ error[Q003]: doubles_escaped.py:1:26: [*] Change outer quotes to avoid escaping 3 3 | this_is_fine = '"This" is a \'string\'' 4 4 | this_is_fine = "This is a 'string'" -error[Q003]: doubles_escaped.py:2:26: [*] Change outer quotes to avoid escaping inner quotes +error[Q003]: 2:26: [*] Change outer quotes to avoid escaping inner quotes + --> doubles_escaped.py:2:26 | 1 | this_should_raise_Q003 = 'This is a \'string\'' 2 | this_should_raise_Q003 = 'This is \\ a \\\'string\'' @@ -35,8 +37,9 @@ error[Q003]: doubles_escaped.py:2:26: [*] Change outer quotes to avoid escaping 4 4 | this_is_fine = "This is a 'string'" 5 5 | this_is_fine = "\"This\" is a 'string'" -error[Q003]: doubles_escaped.py:10:5: [*] Change outer quotes to avoid escaping inner quotes +error[Q003]: 10:5: [*] Change outer quotes to avoid escaping inner quotes + --> doubles_escaped.py:10:5 | 8 | this_should_raise = ( 9 | 'This is a' @@ -55,8 +58,9 @@ error[Q003]: doubles_escaped.py:10:5: [*] Change outer quotes to avoid escaping 12 12 | 13 13 | # Same as above, but with f-strings -error[Q003]: doubles_escaped.py:14:1: [*] Change outer quotes to avoid escaping inner quotes +error[Q003]: 14:1: [*] Change outer quotes to avoid escaping inner quotes + --> doubles_escaped.py:13:36 | 13 | # Same as above, but with f-strings 14 | f'This is a \'string\'' # Q003 @@ -75,8 +79,9 @@ error[Q003]: doubles_escaped.py:14:1: [*] Change outer quotes to avoid escaping 16 16 | f'"This" is a \'string\'' 17 17 | f"This is a 'string'" -error[Q003]: doubles_escaped.py:15:1: [*] Change outer quotes to avoid escaping inner quotes +error[Q003]: 15:1: [*] Change outer quotes to avoid escaping inner quotes + --> doubles_escaped.py:14:32 | 13 | # Same as above, but with f-strings 14 | f'This is a \'string\'' # Q003 @@ -96,8 +101,9 @@ error[Q003]: doubles_escaped.py:15:1: [*] Change outer quotes to avoid escaping 17 17 | f"This is a 'string'" 18 18 | f"\"This\" is a 'string'" -error[Q003]: doubles_escaped.py:23:5: [*] Change outer quotes to avoid escaping inner quotes +error[Q003]: 23:5: [*] Change outer quotes to avoid escaping inner quotes + --> doubles_escaped.py:23:5 | 21 | foo = ( 22 | f'This is a' diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_escaped_unnecessary.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_escaped_unnecessary.py.snap index 4dc47b15da..87e859cdda 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_escaped_unnecessary.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_escaped_unnecessary.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs --- -error[Q004]: doubles_escaped_unnecessary.py:1:26: [*] Unnecessary escape on inner quote character +error[Q004]: 1:26: [*] Unnecessary escape on inner quote character + --> doubles_escaped_unnecessary.py:1:26 | 1 | this_should_raise_Q004 = 'This is a \"string\"' | ^^^^^^^^^^^^^^^^^^^^^^ @@ -17,8 +18,9 @@ error[Q004]: doubles_escaped_unnecessary.py:1:26: [*] Unnecessary escape on inne 3 3 | this_is_fine = '"This" is a \"string\"' 4 4 | this_is_fine = "This is a 'string'" -error[Q004]: doubles_escaped_unnecessary.py:2:26: [*] Unnecessary escape on inner quote character +error[Q004]: 2:26: [*] Unnecessary escape on inner quote character + --> doubles_escaped_unnecessary.py:2:26 | 1 | this_should_raise_Q004 = 'This is a \"string\"' 2 | this_should_raise_Q004 = 'This is \\ a \\\"string\"' @@ -35,8 +37,9 @@ error[Q004]: doubles_escaped_unnecessary.py:2:26: [*] Unnecessary escape on inne 4 4 | this_is_fine = "This is a 'string'" 5 5 | this_is_fine = "\"This\" is a 'string'" -error[Q004]: doubles_escaped_unnecessary.py:3:16: [*] Unnecessary escape on inner quote character +error[Q004]: 3:16: [*] Unnecessary escape on inner quote character + --> doubles_escaped_unnecessary.py:3:16 | 1 | this_should_raise_Q004 = 'This is a \"string\"' 2 | this_should_raise_Q004 = 'This is \\ a \\\"string\"' @@ -55,8 +58,9 @@ error[Q004]: doubles_escaped_unnecessary.py:3:16: [*] Unnecessary escape on inne 5 5 | this_is_fine = "\"This\" is a 'string'" 6 6 | this_is_fine = r'This is a \"string\"' -error[Q004]: doubles_escaped_unnecessary.py:10:5: [*] Unnecessary escape on inner quote character +error[Q004]: 10:5: [*] Unnecessary escape on inner quote character + --> doubles_escaped_unnecessary.py:10:5 | 8 | this_should_raise_Q004 = ( 9 | 'This is a' @@ -75,8 +79,9 @@ error[Q004]: doubles_escaped_unnecessary.py:10:5: [*] Unnecessary escape on inne 12 12 | 13 13 | # Same as above, but with f-strings -error[Q004]: doubles_escaped_unnecessary.py:14:1: [*] Unnecessary escape on inner quote character +error[Q004]: 14:1: [*] Unnecessary escape on inner quote character + --> doubles_escaped_unnecessary.py:13:36 | 13 | # Same as above, but with f-strings 14 | f'This is a \"string\"' # Q004 @@ -95,8 +100,9 @@ error[Q004]: doubles_escaped_unnecessary.py:14:1: [*] Unnecessary escape on inne 16 16 | f'"This" is a \"string\"' 17 17 | f"This is a 'string'" -error[Q004]: doubles_escaped_unnecessary.py:15:1: [*] Unnecessary escape on inner quote character +error[Q004]: 15:1: [*] Unnecessary escape on inner quote character + --> doubles_escaped_unnecessary.py:14:32 | 13 | # Same as above, but with f-strings 14 | f'This is a \"string\"' # Q004 @@ -116,8 +122,9 @@ error[Q004]: doubles_escaped_unnecessary.py:15:1: [*] Unnecessary escape on inne 17 17 | f"This is a 'string'" 18 18 | f"\"This\" is a 'string'" -error[Q004]: doubles_escaped_unnecessary.py:16:1: [*] Unnecessary escape on inner quote character +error[Q004]: 16:1: [*] Unnecessary escape on inner quote character + --> doubles_escaped_unnecessary.py:15:37 | 14 | f'This is a \"string\"' # Q004 15 | f'This is \\ a \\\"string\"' # Q004 @@ -137,8 +144,9 @@ error[Q004]: doubles_escaped_unnecessary.py:16:1: [*] Unnecessary escape on inne 18 18 | f"\"This\" is a 'string'" 19 19 | fr'This is a \"string\"' -error[Q004]: doubles_escaped_unnecessary.py:23:5: [*] Unnecessary escape on inner quote character +error[Q004]: 23:5: [*] Unnecessary escape on inner quote character + --> doubles_escaped_unnecessary.py:23:5 | 21 | this_should_raise_Q004 = ( 22 | f'This is a' @@ -157,8 +165,9 @@ error[Q004]: doubles_escaped_unnecessary.py:23:5: [*] Unnecessary escape on inne 25 25 | 26 26 | # Nested f-strings (Python 3.12+) -error[Q004]: doubles_escaped_unnecessary.py:33:1: [*] Unnecessary escape on inner quote character +error[Q004]: 33:1: [*] Unnecessary escape on inner quote character + --> doubles_escaped_unnecessary.py:32:74 | 31 | # 32 | # but as the actual string itself is invalid pre 3.12, we don't catch it. @@ -178,8 +187,9 @@ error[Q004]: doubles_escaped_unnecessary.py:33:1: [*] Unnecessary escape on inne 35 35 | f'\"foo\" {f'\"nested\"'} \"\"' # Q004 36 36 | -error[Q004]: doubles_escaped_unnecessary.py:34:1: [*] Unnecessary escape on inner quote character +error[Q004]: 34:1: [*] Unnecessary escape on inner quote character + --> doubles_escaped_unnecessary.py:33:30 | 32 | # but as the actual string itself is invalid pre 3.12, we don't catch it. 33 | f'\"foo\" {'nested'}' # Q004 @@ -198,8 +208,9 @@ error[Q004]: doubles_escaped_unnecessary.py:34:1: [*] Unnecessary escape on inne 36 36 | 37 37 | f'normal {f'nested'} normal' -error[Q004]: doubles_escaped_unnecessary.py:35:1: [*] Unnecessary escape on inner quote character +error[Q004]: 35:1: [*] Unnecessary escape on inner quote character + --> doubles_escaped_unnecessary.py:34:31 | 33 | f'\"foo\" {'nested'}' # Q004 34 | f'\"foo\" {f'nested'}' # Q004 @@ -219,8 +230,9 @@ error[Q004]: doubles_escaped_unnecessary.py:35:1: [*] Unnecessary escape on inne 37 37 | f'normal {f'nested'} normal' 38 38 | f'\"normal\" {f'nested'} normal' # Q004 -error[Q004]: doubles_escaped_unnecessary.py:35:12: [*] Unnecessary escape on inner quote character +error[Q004]: 35:12: [*] Unnecessary escape on inner quote character + --> doubles_escaped_unnecessary.py:35:12 | 33 | f'\"foo\" {'nested'}' # Q004 34 | f'\"foo\" {f'nested'}' # Q004 @@ -240,8 +252,9 @@ error[Q004]: doubles_escaped_unnecessary.py:35:12: [*] Unnecessary escape on inn 37 37 | f'normal {f'nested'} normal' 38 38 | f'\"normal\" {f'nested'} normal' # Q004 -error[Q004]: doubles_escaped_unnecessary.py:38:1: [*] Unnecessary escape on inner quote character +error[Q004]: 38:1: [*] Unnecessary escape on inner quote character + --> doubles_escaped_unnecessary.py:37:29 | 37 | f'normal {f'nested'} normal' 38 | f'\"normal\" {f'nested'} normal' # Q004 @@ -260,8 +273,9 @@ error[Q004]: doubles_escaped_unnecessary.py:38:1: [*] Unnecessary escape on inne 40 40 | f'\"normal\" {f'\"nested\" {'other'} normal'} "double quotes"' # Q004 41 41 | f'\"normal\" {f'\"nested\" {'other'} "double quotes"'} normal' # Q004 -error[Q004]: doubles_escaped_unnecessary.py:39:1: [*] Unnecessary escape on inner quote character +error[Q004]: 39:1: [*] Unnecessary escape on inner quote character + --> doubles_escaped_unnecessary.py:38:41 | 37 | f'normal {f'nested'} normal' 38 | f'\"normal\" {f'nested'} normal' # Q004 @@ -281,8 +295,9 @@ error[Q004]: doubles_escaped_unnecessary.py:39:1: [*] Unnecessary escape on inne 41 41 | f'\"normal\" {f'\"nested\" {'other'} "double quotes"'} normal' # Q004 42 42 | -error[Q004]: doubles_escaped_unnecessary.py:40:1: [*] Unnecessary escape on inner quote character +error[Q004]: 40:1: [*] Unnecessary escape on inner quote character + --> doubles_escaped_unnecessary.py:39:42 | 38 | f'\"normal\" {f'nested'} normal' # Q004 39 | f'\"normal\" {f'nested'} "double quotes"' @@ -301,8 +316,9 @@ error[Q004]: doubles_escaped_unnecessary.py:40:1: [*] Unnecessary escape on inne 42 42 | 43 43 | # Make sure we do not unescape quotes -error[Q004]: doubles_escaped_unnecessary.py:40:15: [*] Unnecessary escape on inner quote character +error[Q004]: 40:15: [*] Unnecessary escape on inner quote character + --> doubles_escaped_unnecessary.py:40:15 | 38 | f'\"normal\" {f'nested'} normal' # Q004 39 | f'\"normal\" {f'nested'} "double quotes"' @@ -321,8 +337,9 @@ error[Q004]: doubles_escaped_unnecessary.py:40:15: [*] Unnecessary escape on inn 42 42 | 43 43 | # Make sure we do not unescape quotes -error[Q004]: doubles_escaped_unnecessary.py:41:1: [*] Unnecessary escape on inner quote character +error[Q004]: 41:1: [*] Unnecessary escape on inner quote character + --> doubles_escaped_unnecessary.py:40:71 | 39 | f'\"normal\" {f'nested'} "double quotes"' 40 | f'\"normal\" {f'\"nested\" {'other'} normal'} "double quotes"' # Q004 @@ -342,8 +359,9 @@ error[Q004]: doubles_escaped_unnecessary.py:41:1: [*] Unnecessary escape on inne 43 43 | # Make sure we do not unescape quotes 44 44 | this_is_fine = 'This is an \\"escaped\\" quote' -error[Q004]: doubles_escaped_unnecessary.py:41:15: [*] Unnecessary escape on inner quote character +error[Q004]: 41:15: [*] Unnecessary escape on inner quote character + --> doubles_escaped_unnecessary.py:41:15 | 39 | f'\"normal\" {f'nested'} "double quotes"' 40 | f'\"normal\" {f'\"nested\" {'other'} normal'} "double quotes"' # Q004 @@ -363,8 +381,9 @@ error[Q004]: doubles_escaped_unnecessary.py:41:15: [*] Unnecessary escape on inn 43 43 | # Make sure we do not unescape quotes 44 44 | this_is_fine = 'This is an \\"escaped\\" quote' -error[Q004]: doubles_escaped_unnecessary.py:45:26: [*] Unnecessary escape on inner quote character +error[Q004]: 45:26: [*] Unnecessary escape on inner quote character + --> doubles_escaped_unnecessary.py:45:26 | 43 | # Make sure we do not unescape quotes 44 | this_is_fine = 'This is an \\"escaped\\" quote' diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_implicit.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_implicit.py.snap index 55fb849604..bebbf48011 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_implicit.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_implicit.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs --- -error[Q000]: doubles_implicit.py:2:5: [*] Double quotes found but single quotes preferred +error[Q000]: 2:5: [*] Double quotes found but single quotes preferred + --> doubles_implicit.py:2:5 | 1 | x = ( 2 | "This" @@ -19,8 +20,9 @@ error[Q000]: doubles_implicit.py:2:5: [*] Double quotes found but single quotes 4 4 | "not" 5 5 | ) -error[Q000]: doubles_implicit.py:3:5: [*] Double quotes found but single quotes preferred +error[Q000]: 3:5: [*] Double quotes found but single quotes preferred + --> doubles_implicit.py:3:5 | 1 | x = ( 2 | "This" @@ -39,8 +41,9 @@ error[Q000]: doubles_implicit.py:3:5: [*] Double quotes found but single quotes 5 5 | ) 6 6 | -error[Q000]: doubles_implicit.py:4:5: [*] Double quotes found but single quotes preferred +error[Q000]: 4:5: [*] Double quotes found but single quotes preferred + --> doubles_implicit.py:4:5 | 2 | "This" 3 | "is" @@ -59,8 +62,9 @@ error[Q000]: doubles_implicit.py:4:5: [*] Double quotes found but single quotes 6 6 | 7 7 | x = ( -error[Q000]: doubles_implicit.py:8:5: [*] Double quotes found but single quotes preferred +error[Q000]: 8:5: [*] Double quotes found but single quotes preferred + --> doubles_implicit.py:8:5 | 7 | x = ( 8 | "This" \ @@ -79,8 +83,9 @@ error[Q000]: doubles_implicit.py:8:5: [*] Double quotes found but single quotes 10 10 | "not" 11 11 | ) -error[Q000]: doubles_implicit.py:9:5: [*] Double quotes found but single quotes preferred +error[Q000]: 9:5: [*] Double quotes found but single quotes preferred + --> doubles_implicit.py:9:5 | 7 | x = ( 8 | "This" \ @@ -100,8 +105,9 @@ error[Q000]: doubles_implicit.py:9:5: [*] Double quotes found but single quotes 11 11 | ) 12 12 | -error[Q000]: doubles_implicit.py:10:5: [*] Double quotes found but single quotes preferred +error[Q000]: 10:5: [*] Double quotes found but single quotes preferred + --> doubles_implicit.py:10:5 | 8 | "This" \ 9 | "is" \ @@ -120,8 +126,9 @@ error[Q000]: doubles_implicit.py:10:5: [*] Double quotes found but single quotes 12 12 | 13 13 | x = ( -error[Q000]: doubles_implicit.py:27:1: [*] Double quotes found but single quotes preferred +error[Q000]: 27:1: [*] Double quotes found but single quotes preferred + --> doubles_implicit.py:26:35 | 25 | if True: 26 | "This can use 'double' quotes" diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_multiline_string.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_multiline_string.py.snap index 3b5c4951e7..e7f01b5d60 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_multiline_string.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_multiline_string.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs --- -error[Q001]: doubles_multiline_string.py:1:5: [*] Double quote multiline found but single quotes preferred +error[Q001]: 1:5: [*] Double quote multiline found but single quotes preferred + --> doubles_multiline_string.py:1:5 | 1 | s = """ This "should" | _____^ diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_would_be_triple_quotes.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_would_be_triple_quotes.py.snap index 9d61e2b199..948d03c62a 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_would_be_triple_quotes.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_would_be_triple_quotes.py.snap @@ -1,16 +1,18 @@ --- source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs --- -error[Q000]: doubles_would_be_triple_quotes.py:1:5: Double quotes found but single quotes preferred +error[Q000]: 1:5: Double quotes found but single quotes preferred + --> doubles_would_be_triple_quotes.py:1:5 | 1 | s = ""'Start with empty string' ' and lint docstring safely' | ^^ 2 | s = "Do not"' start with empty string' ' and lint docstring safely' | = help: Replace double quotes with single quotes -error[Q000]: doubles_would_be_triple_quotes.py:2:5: [*] Double quotes found but single quotes preferred +error[Q000]: 2:5: [*] Double quotes found but single quotes preferred + --> doubles_would_be_triple_quotes.py:2:5 | 1 | s = ""'Start with empty string' ' and lint docstring safely' 2 | s = "Do not"' start with empty string' ' and lint docstring safely' diff --git a/crates/ruff_linter/src/rules/flake8_raise/snapshots/ruff_linter__rules__flake8_raise__tests__unnecessary-paren-on-raise-exception_RSE102.py.snap b/crates/ruff_linter/src/rules/flake8_raise/snapshots/ruff_linter__rules__flake8_raise__tests__unnecessary-paren-on-raise-exception_RSE102.py.snap index 3f607db378..3ff25786af 100644 --- a/crates/ruff_linter/src/rules/flake8_raise/snapshots/ruff_linter__rules__flake8_raise__tests__unnecessary-paren-on-raise-exception_RSE102.py.snap +++ b/crates/ruff_linter/src/rules/flake8_raise/snapshots/ruff_linter__rules__flake8_raise__tests__unnecessary-paren-on-raise-exception_RSE102.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_raise/mod.rs --- -error[RSE102]: RSE102.py:5:21: [*] Unnecessary parentheses on raised exception +error[RSE102]: 5:21: [*] Unnecessary parentheses on raised exception + --> RSE102.py:5:21 | 3 | except TypeError: 4 | # RSE102 @@ -22,8 +23,9 @@ error[RSE102]: RSE102.py:5:21: [*] Unnecessary parentheses on raised exception 7 7 | try: 8 8 | x = 1 / 0 -error[RSE102]: RSE102.py:13:16: [*] Unnecessary parentheses on raised exception +error[RSE102]: 13:16: [*] Unnecessary parentheses on raised exception + --> RSE102.py:13:16 | 12 | # RSE102 13 | raise TypeError() @@ -42,8 +44,9 @@ error[RSE102]: RSE102.py:13:16: [*] Unnecessary parentheses on raised exception 15 15 | # RSE102 16 16 | raise TypeError () -error[RSE102]: RSE102.py:16:17: [*] Unnecessary parentheses on raised exception +error[RSE102]: 16:17: [*] Unnecessary parentheses on raised exception + --> RSE102.py:16:17 | 15 | # RSE102 16 | raise TypeError () @@ -62,8 +65,9 @@ error[RSE102]: RSE102.py:16:17: [*] Unnecessary parentheses on raised exception 18 18 | # RSE102 19 19 | raise TypeError \ -error[RSE102]: RSE102.py:20:5: [*] Unnecessary parentheses on raised exception +error[RSE102]: 20:5: [*] Unnecessary parentheses on raised exception + --> RSE102.py:20:5 | 18 | # RSE102 19 | raise TypeError \ @@ -83,8 +87,9 @@ error[RSE102]: RSE102.py:20:5: [*] Unnecessary parentheses on raised exception 22 22 | # RSE102 23 23 | raise TypeError \ -error[RSE102]: RSE102.py:24:5: [*] Unnecessary parentheses on raised exception +error[RSE102]: 24:5: [*] Unnecessary parentheses on raised exception + --> RSE102.py:24:5 | 22 | # RSE102 23 | raise TypeError \ @@ -104,8 +109,9 @@ error[RSE102]: RSE102.py:24:5: [*] Unnecessary parentheses on raised exception 26 26 | # RSE102 27 27 | raise TypeError( -error[RSE102]: RSE102.py:27:16: [*] Unnecessary parentheses on raised exception +error[RSE102]: 27:16: [*] Unnecessary parentheses on raised exception + --> RSE102.py:27:16 | 26 | # RSE102 27 | raise TypeError( @@ -129,8 +135,9 @@ error[RSE102]: RSE102.py:27:16: [*] Unnecessary parentheses on raised exception 31 29 | # RSE102 32 30 | raise (TypeError) ( -error[RSE102]: RSE102.py:32:19: [*] Unnecessary parentheses on raised exception +error[RSE102]: 32:19: [*] Unnecessary parentheses on raised exception + --> RSE102.py:32:19 | 31 | # RSE102 32 | raise (TypeError) ( @@ -154,8 +161,9 @@ error[RSE102]: RSE102.py:32:19: [*] Unnecessary parentheses on raised exception 36 34 | # RSE102 37 35 | raise TypeError( -error[RSE102]: RSE102.py:37:16: [*] Unnecessary parentheses on raised exception +error[RSE102]: 37:16: [*] Unnecessary parentheses on raised exception + --> RSE102.py:37:16 | 36 | # RSE102 37 | raise TypeError( @@ -179,8 +187,9 @@ error[RSE102]: RSE102.py:37:16: [*] Unnecessary parentheses on raised exception 41 39 | # OK 42 40 | raise AssertionError -error[RSE102]: RSE102.py:74:17: [*] Unnecessary parentheses on raised exception +error[RSE102]: 74:17: [*] Unnecessary parentheses on raised exception + --> RSE102.py:74:17 | 73 | # RSE102 74 | raise IndexError()from ZeroDivisionError @@ -199,8 +208,9 @@ error[RSE102]: RSE102.py:74:17: [*] Unnecessary parentheses on raised exception 76 76 | raise IndexError()\ 77 77 | from ZeroDivisionError -error[RSE102]: RSE102.py:76:17: [*] Unnecessary parentheses on raised exception +error[RSE102]: 76:17: [*] Unnecessary parentheses on raised exception + --> RSE102.py:76:17 | 74 | raise IndexError()from ZeroDivisionError 75 | @@ -219,8 +229,9 @@ error[RSE102]: RSE102.py:76:17: [*] Unnecessary parentheses on raised exception 78 78 | 79 79 | raise IndexError() from ZeroDivisionError -error[RSE102]: RSE102.py:79:17: [*] Unnecessary parentheses on raised exception +error[RSE102]: 79:17: [*] Unnecessary parentheses on raised exception + --> RSE102.py:79:17 | 77 | from ZeroDivisionError 78 | @@ -240,8 +251,9 @@ error[RSE102]: RSE102.py:79:17: [*] Unnecessary parentheses on raised exception 81 81 | raise IndexError(); 82 82 | -error[RSE102]: RSE102.py:81:17: [*] Unnecessary parentheses on raised exception +error[RSE102]: 81:17: [*] Unnecessary parentheses on raised exception + --> RSE102.py:81:17 | 79 | raise IndexError() from ZeroDivisionError 80 | @@ -261,8 +273,9 @@ error[RSE102]: RSE102.py:81:17: [*] Unnecessary parentheses on raised exception 83 83 | # RSE102 84 84 | raise Foo() -error[RSE102]: RSE102.py:84:10: [*] Unnecessary parentheses on raised exception +error[RSE102]: 84:10: [*] Unnecessary parentheses on raised exception + --> RSE102.py:84:10 | 83 | # RSE102 84 | raise Foo() @@ -281,8 +294,9 @@ error[RSE102]: RSE102.py:84:10: [*] Unnecessary parentheses on raised exception 86 86 | # OK 87 87 | raise ctypes.WinError() -error[RSE102]: RSE102.py:107:27: [*] Unnecessary parentheses on raised exception +error[RSE102]: 107:27: [*] Unnecessary parentheses on raised exception + --> RSE102.py:107:27 | 105 | future = executor.submit(float, "a") 106 | if future.exception(): diff --git a/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET501_RET501.py.snap b/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET501_RET501.py.snap index 889492cab6..1894c644bd 100644 --- a/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET501_RET501.py.snap +++ b/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET501_RET501.py.snap @@ -1,15 +1,16 @@ --- source: crates/ruff_linter/src/rules/flake8_return/mod.rs --- -RET501.py:4:5: RET501 [*] Do not explicitly `return None` in function if it is the only possible return value +error[RET501]: 4:5: [*] Do not explicitly `return None` in function if it is the only possible return value + + --> RET501.py:4:5 | 2 | if not y: 3 | return 4 | return None # error - | ^^^^^^^^^^^ RET501 + | ^^^^^^^^^^^ | = help: Remove explicit `return None` - ℹ Safe fix 1 1 | def x(y): 2 2 | if not y: @@ -20,17 +21,18 @@ RET501.py:4:5: RET501 [*] Do not explicitly `return None` in function if it is t 6 6 | 7 7 | class BaseCache: -RET501.py:14:9: RET501 [*] Do not explicitly `return None` in function if it is the only possible return value +error[RET501]: 14:9: [*] Do not explicitly `return None` in function if it is the only possible return value + + --> RET501.py:14:9 | 12 | def get(self, key: str) -> None: 13 | print(f"{key} not found") 14 | return None - | ^^^^^^^^^^^ RET501 + | ^^^^^^^^^^^ 15 | 16 | @property | = help: Remove explicit `return None` - ℹ Safe fix 11 11 | 12 12 | def get(self, key: str) -> None: diff --git a/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET502_RET502.py.snap b/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET502_RET502.py.snap index 34afd7b68b..7bbf64970d 100644 --- a/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET502_RET502.py.snap +++ b/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET502_RET502.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_return/mod.rs --- -error[RET502]: RET502.py:3:9: [*] Do not implicitly `return None` in function able to return non-`None` value +error[RET502]: 3:9: [*] Do not implicitly `return None` in function able to return non-`None` value + --> RET502.py:3:9 | 1 | def x(y): 2 | if not y: diff --git a/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET503_RET503.py.snap b/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET503_RET503.py.snap index 38a7781530..d8eac248d6 100644 --- a/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET503_RET503.py.snap +++ b/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET503_RET503.py.snap @@ -1,18 +1,19 @@ --- source: crates/ruff_linter/src/rules/flake8_return/mod.rs --- -RET503.py:21:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value +error[RET503]: 21:5: [*] Missing explicit `return` at the end of function able to return non-`None` value + + --> RET503.py:21:5 | 19 | # if/elif/else 20 | def x(y): 21 | if not y: | _____^ 22 | | return 1 - | |________________^ RET503 + | |________________^ 23 | # error | = help: Add explicit `return` statement - ℹ Unsafe fix 20 20 | def x(y): 21 21 | if not y: @@ -22,17 +23,18 @@ RET503.py:21:5: RET503 [*] Missing explicit `return` at the end of function able 24 25 | 25 26 | -RET503.py:28:9: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value +error[RET503]: 28:9: [*] Missing explicit `return` at the end of function able to return non-`None` value + + --> RET503.py:28:9 | 26 | def x(y): 27 | if not y: 28 | print() # error - | ^^^^^^^ RET503 + | ^^^^^^^ 29 | else: 30 | return 2 | = help: Add explicit `return` statement - ℹ Unsafe fix 26 26 | def x(y): 27 27 | if not y: @@ -42,15 +44,16 @@ RET503.py:28:9: RET503 [*] Missing explicit `return` at the end of function able 30 31 | return 2 31 32 | -RET503.py:37:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value +error[RET503]: 37:5: [*] Missing explicit `return` at the end of function able to return non-`None` value + + --> RET503.py:37:5 | 35 | return 1 36 | 37 | print() # error - | ^^^^^^^ RET503 + | ^^^^^^^ | = help: Add explicit `return` statement - ℹ Unsafe fix 35 35 | return 1 36 36 | @@ -60,7 +63,9 @@ RET503.py:37:5: RET503 [*] Missing explicit `return` at the end of function able 39 40 | 40 41 | # for -RET503.py:42:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value +error[RET503]: 42:5: [*] Missing explicit `return` at the end of function able to return non-`None` value + + --> RET503.py:42:5 | 40 | # for 41 | def x(y): @@ -68,11 +73,10 @@ RET503.py:42:5: RET503 [*] Missing explicit `return` at the end of function able | _____^ 43 | | if i > 10: 44 | | return i - | |____________________^ RET503 + | |____________________^ 45 | # error | = help: Add explicit `return` statement - ℹ Unsafe fix 42 42 | for i in range(10): 43 43 | if i > 10: @@ -82,15 +86,16 @@ RET503.py:42:5: RET503 [*] Missing explicit `return` at the end of function able 46 47 | 47 48 | -RET503.py:53:9: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value +error[RET503]: 53:9: [*] Missing explicit `return` at the end of function able to return non-`None` value + + --> RET503.py:53:9 | 51 | return i 52 | else: 53 | print() # error - | ^^^^^^^ RET503 + | ^^^^^^^ | = help: Add explicit `return` statement - ℹ Unsafe fix 51 51 | return i 52 52 | else: @@ -100,15 +105,16 @@ RET503.py:53:9: RET503 [*] Missing explicit `return` at the end of function able 55 56 | 56 57 | # A nonexistent function -RET503.py:60:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value +error[RET503]: 60:5: [*] Missing explicit `return` at the end of function able to return non-`None` value + + --> RET503.py:60:5 | 58 | if x > 0: 59 | return False 60 | no_such_function() # error - | ^^^^^^^^^^^^^^^^^^ RET503 + | ^^^^^^^^^^^^^^^^^^ | = help: Add explicit `return` statement - ℹ Unsafe fix 58 58 | if x > 0: 59 59 | return False @@ -118,15 +124,16 @@ RET503.py:60:5: RET503 [*] Missing explicit `return` at the end of function able 62 63 | 63 64 | # A function that does return the control -RET503.py:67:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value +error[RET503]: 67:5: [*] Missing explicit `return` at the end of function able to return non-`None` value + + --> RET503.py:67:5 | 65 | if x > 0: 66 | return False 67 | print("", end="") # error - | ^^^^^^^^^^^^^^^^^ RET503 + | ^^^^^^^^^^^^^^^^^ | = help: Add explicit `return` statement - ℹ Unsafe fix 65 65 | if x > 0: 66 66 | return False @@ -136,7 +143,9 @@ RET503.py:67:5: RET503 [*] Missing explicit `return` at the end of function able 69 70 | 70 71 | ### -RET503.py:83:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value +error[RET503]: 83:5: [*] Missing explicit `return` at the end of function able to return non-`None` value + + --> RET503.py:83:5 | 81 | # last line in while loop 82 | def x(y): @@ -145,10 +154,9 @@ RET503.py:83:5: RET503 [*] Missing explicit `return` at the end of function able 84 | | if y > 0: 85 | | return 1 86 | | y += 1 - | |______________^ RET503 + | |______________^ | = help: Add explicit `return` statement - ℹ Unsafe fix 84 84 | if y > 0: 85 85 | return 1 @@ -158,7 +166,9 @@ RET503.py:83:5: RET503 [*] Missing explicit `return` at the end of function able 88 89 | 89 90 | # exclude empty functions -RET503.py:114:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value +error[RET503]: 114:5: [*] Missing explicit `return` at the end of function able to return non-`None` value + + --> RET503.py:114:5 | 112 | # return value within loop 113 | def bar1(x, y, z): @@ -167,10 +177,9 @@ RET503.py:114:5: RET503 [*] Missing explicit `return` at the end of function abl 115 | | if i > y: 116 | | break 117 | | return z - | |________________^ RET503 + | |________________^ | = help: Add explicit `return` statement - ℹ Unsafe fix 115 115 | if i > y: 116 116 | break @@ -180,7 +189,9 @@ RET503.py:114:5: RET503 [*] Missing explicit `return` at the end of function abl 119 120 | 120 121 | def bar3(x, y, z): -RET503.py:121:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value +error[RET503]: 121:5: [*] Missing explicit `return` at the end of function able to return non-`None` value + + --> RET503.py:121:5 | 120 | def bar3(x, y, z): 121 | for i in x: @@ -191,10 +202,9 @@ RET503.py:121:5: RET503 [*] Missing explicit `return` at the end of function abl 125 | | else: 126 | | return z 127 | | return None - | |___________________^ RET503 + | |___________________^ | = help: Add explicit `return` statement - ℹ Unsafe fix 125 125 | else: 126 126 | return z @@ -204,7 +214,9 @@ RET503.py:121:5: RET503 [*] Missing explicit `return` at the end of function abl 129 130 | 130 131 | def bar1(x, y, z): -RET503.py:131:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value +error[RET503]: 131:5: [*] Missing explicit `return` at the end of function able to return non-`None` value + + --> RET503.py:131:5 | 130 | def bar1(x, y, z): 131 | for i in x: @@ -212,10 +224,9 @@ RET503.py:131:5: RET503 [*] Missing explicit `return` at the end of function abl 132 | | if i < y: 133 | | continue 134 | | return z - | |________________^ RET503 + | |________________^ | = help: Add explicit `return` statement - ℹ Unsafe fix 132 132 | if i < y: 133 133 | continue @@ -225,7 +236,9 @@ RET503.py:131:5: RET503 [*] Missing explicit `return` at the end of function abl 136 137 | 137 138 | def bar3(x, y, z): -RET503.py:138:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value +error[RET503]: 138:5: [*] Missing explicit `return` at the end of function able to return non-`None` value + + --> RET503.py:138:5 | 137 | def bar3(x, y, z): 138 | for i in x: @@ -236,10 +249,9 @@ RET503.py:138:5: RET503 [*] Missing explicit `return` at the end of function abl 142 | | else: 143 | | return z 144 | | return None - | |___________________^ RET503 + | |___________________^ | = help: Add explicit `return` statement - ℹ Unsafe fix 142 142 | else: 143 143 | return z @@ -249,17 +261,18 @@ RET503.py:138:5: RET503 [*] Missing explicit `return` at the end of function abl 146 147 | 147 148 | def prompts(self, foo): -RET503.py:275:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value +error[RET503]: 275:5: [*] Missing explicit `return` at the end of function able to return non-`None` value + + --> RET503.py:275:5 | 273 | return False 274 | 275 | for value in values: | _____^ 276 | | print(value) - | |____________________^ RET503 + | |____________________^ | = help: Add explicit `return` statement - ℹ Unsafe fix 274 274 | 275 275 | for value in values: @@ -269,15 +282,16 @@ RET503.py:275:5: RET503 [*] Missing explicit `return` at the end of function abl 278 279 | 279 280 | def while_true(): -RET503.py:292:13: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value +error[RET503]: 292:13: [*] Missing explicit `return` at the end of function able to return non-`None` value + + --> RET503.py:292:13 | 290 | return 1 291 | case 1: 292 | print() # error - | ^^^^^^^ RET503 + | ^^^^^^^ | = help: Add explicit `return` statement - ℹ Unsafe fix 290 290 | return 1 291 291 | case 1: @@ -287,17 +301,18 @@ RET503.py:292:13: RET503 [*] Missing explicit `return` at the end of function ab 294 295 | 295 296 | def foo(baz: str) -> str: -RET503.py:301:9: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value +error[RET503]: 301:9: [*] Missing explicit `return` at the end of function able to return non-`None` value + + --> RET503.py:301:9 | 299 | def end_of_statement(): 300 | def example(): 301 | if True: | _________^ 302 | | return "" - | |_____________________^ RET503 + | |_____________________^ | = help: Add explicit `return` statement - ℹ Unsafe fix 300 300 | def example(): 301 301 | if True: @@ -307,16 +322,17 @@ RET503.py:301:9: RET503 [*] Missing explicit `return` at the end of function abl 304 305 | 305 306 | def example(): -RET503.py:306:9: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value +error[RET503]: 306:9: [*] Missing explicit `return` at the end of function able to return non-`None` value + + --> RET503.py:306:9 | 305 | def example(): 306 | if True: | _________^ 307 | | return "" - | |_____________________^ RET503 + | |_____________________^ | = help: Add explicit `return` statement - ℹ Unsafe fix 305 305 | def example(): 306 306 | if True: @@ -326,16 +342,17 @@ RET503.py:306:9: RET503 [*] Missing explicit `return` at the end of function abl 309 310 | 310 311 | def example(): -RET503.py:311:9: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value +error[RET503]: 311:9: [*] Missing explicit `return` at the end of function able to return non-`None` value + + --> RET503.py:311:9 | 310 | def example(): 311 | if True: | _________^ 312 | | return "" # type: ignore - | |_____________________^ RET503 + | |_____________________^ | = help: Add explicit `return` statement - ℹ Unsafe fix 310 310 | def example(): 311 311 | if True: @@ -345,16 +362,17 @@ RET503.py:311:9: RET503 [*] Missing explicit `return` at the end of function abl 314 315 | 315 316 | def example(): -RET503.py:316:9: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value +error[RET503]: 316:9: [*] Missing explicit `return` at the end of function able to return non-`None` value + + --> RET503.py:316:9 | 315 | def example(): 316 | if True: | _________^ 317 | | return "" ; - | |_____________________^ RET503 + | |_____________________^ | = help: Add explicit `return` statement - ℹ Unsafe fix 315 315 | def example(): 316 316 | if True: @@ -364,17 +382,18 @@ RET503.py:316:9: RET503 [*] Missing explicit `return` at the end of function abl 319 320 | 320 321 | def example(): -RET503.py:321:9: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value +error[RET503]: 321:9: [*] Missing explicit `return` at the end of function able to return non-`None` value + + --> RET503.py:321:9 | 320 | def example(): 321 | if True: | _________^ 322 | | return "" \ - | |_____________________^ RET503 + | |_____________________^ 323 | ; # type: ignore | = help: Add explicit `return` statement - ℹ Unsafe fix 321 321 | if True: 322 322 | return "" \ @@ -384,15 +403,16 @@ RET503.py:321:9: RET503 [*] Missing explicit `return` at the end of function abl 325 326 | 326 327 | def end_of_file(): -RET503.py:329:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value +error[RET503]: 329:5: [*] Missing explicit `return` at the end of function able to return non-`None` value + + --> RET503.py:329:5 | 327 | if False: 328 | return 1 329 | x = 2 \ - | ^^^^^ RET503 + | ^^^^^ | = help: Add explicit `return` statement - ℹ Unsafe fix 328 328 | return 1 329 329 | x = 2 \ @@ -402,15 +422,16 @@ RET503.py:329:5: RET503 [*] Missing explicit `return` at the end of function abl 332 333 | 333 334 | # function return type annotation NoReturn -RET503.py:339:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value +error[RET503]: 339:5: [*] Missing explicit `return` at the end of function able to return non-`None` value + + --> RET503.py:339:5 | 337 | if x == 5: 338 | return 5 339 | bar() - | ^^^^^ RET503 + | ^^^^^ | = help: Add explicit `return` statement - ℹ Unsafe fix 337 337 | if x == 5: 338 338 | return 5 @@ -420,15 +441,16 @@ RET503.py:339:5: RET503 [*] Missing explicit `return` at the end of function abl 341 342 | 342 343 | def foo(string: str) -> str: -RET503.py:354:13: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value +error[RET503]: 354:13: [*] Missing explicit `return` at the end of function able to return non-`None` value + + --> RET503.py:354:13 | 352 | return "third" 353 | case _: 354 | raises(string) - | ^^^^^^^^^^^^^^ RET503 + | ^^^^^^^^^^^^^^ | = help: Add explicit `return` statement - ℹ Unsafe fix 352 352 | return "third" 353 353 | case _: @@ -438,15 +460,16 @@ RET503.py:354:13: RET503 [*] Missing explicit `return` at the end of function ab 356 357 | 357 358 | def foo() -> int: -RET503.py:370:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value +error[RET503]: 370:5: [*] Missing explicit `return` at the end of function able to return non-`None` value + + --> RET503.py:370:5 | 368 | if baz() > 3: 369 | return 1 370 | bar() - | ^^^^^ RET503 + | ^^^^^ | = help: Add explicit `return` statement - ℹ Unsafe fix 368 368 | if baz() > 3: 369 369 | return 1 @@ -456,15 +479,16 @@ RET503.py:370:5: RET503 [*] Missing explicit `return` at the end of function abl 372 373 | 373 374 | def f(): -RET503.py:378:13: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value +error[RET503]: 378:13: [*] Missing explicit `return` at the end of function able to return non-`None` value + + --> RET503.py:378:13 | 376 | else: 377 | with c: 378 | d - | ^ RET503 + | ^ | = help: Add explicit `return` statement - ℹ Unsafe fix 376 376 | else: 377 377 | with c: diff --git a/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET504_RET504.py.snap b/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET504_RET504.py.snap index a5805e4836..466dd8ffdb 100644 --- a/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET504_RET504.py.snap +++ b/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET504_RET504.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_return/mod.rs --- -error[RET504]: RET504.py:6:12: [*] Unnecessary assignment to `a` before `return` statement +error[RET504]: 6:12: [*] Unnecessary assignment to `a` before `return` statement + --> RET504.py:6:12 | 4 | def x(): 5 | a = 1 @@ -21,8 +22,9 @@ error[RET504]: RET504.py:6:12: [*] Unnecessary assignment to `a` before `return` 8 7 | 9 8 | # Can be refactored false positives -error[RET504]: RET504.py:23:12: [*] Unnecessary assignment to `formatted` before `return` statement +error[RET504]: 23:12: [*] Unnecessary assignment to `formatted` before `return` statement + --> RET504.py:23:12 | 21 | # clean up after any blank components 22 | formatted = formatted.replace("()", "").replace(" ", " ").strip() @@ -41,8 +43,9 @@ error[RET504]: RET504.py:23:12: [*] Unnecessary assignment to `formatted` before 25 24 | 26 25 | # https://github.com/afonasev/flake8-return/issues/47#issue-641117366 -error[RET504]: RET504.py:246:12: [*] Unnecessary assignment to `queryset` before `return` statement +error[RET504]: 246:12: [*] Unnecessary assignment to `queryset` before `return` statement + --> RET504.py:246:12 | 244 | queryset = Model.filter(a=1) 245 | queryset = queryset.filter(c=3) @@ -61,8 +64,9 @@ error[RET504]: RET504.py:246:12: [*] Unnecessary assignment to `queryset` before 248 247 | 249 248 | def get_queryset(): -error[RET504]: RET504.py:251:12: [*] Unnecessary assignment to `queryset` before `return` statement +error[RET504]: 251:12: [*] Unnecessary assignment to `queryset` before `return` statement + --> RET504.py:251:12 | 249 | def get_queryset(): 250 | queryset = Model.filter(a=1) @@ -81,8 +85,9 @@ error[RET504]: RET504.py:251:12: [*] Unnecessary assignment to `queryset` before 253 252 | 254 253 | # Function arguments -error[RET504]: RET504.py:269:12: [*] Unnecessary assignment to `val` before `return` statement +error[RET504]: 269:12: [*] Unnecessary assignment to `val` before `return` statement + --> RET504.py:269:12 | 267 | return val 268 | val = 1 @@ -101,8 +106,9 @@ error[RET504]: RET504.py:269:12: [*] Unnecessary assignment to `val` before `ret 271 270 | 272 271 | def str_to_bool(val): -error[RET504]: RET504.py:321:12: [*] Unnecessary assignment to `x` before `return` statement +error[RET504]: 321:12: [*] Unnecessary assignment to `x` before `return` statement + --> RET504.py:321:12 | 319 | with open("foo.txt", "r") as f: 320 | x = f.read() @@ -121,8 +127,9 @@ error[RET504]: RET504.py:321:12: [*] Unnecessary assignment to `x` before `retur 323 322 | 324 323 | def foo(): -error[RET504]: RET504.py:342:12: [*] Unnecessary assignment to `b` before `return` statement +error[RET504]: 342:12: [*] Unnecessary assignment to `b` before `return` statement + --> RET504.py:342:12 | 340 | a = 1 341 | b=a @@ -141,8 +148,9 @@ error[RET504]: RET504.py:342:12: [*] Unnecessary assignment to `b` before `retur 344 343 | 345 344 | def foo(): -error[RET504]: RET504.py:348:12: [*] Unnecessary assignment to `b` before `return` statement +error[RET504]: 348:12: [*] Unnecessary assignment to `b` before `return` statement + --> RET504.py:348:12 | 346 | a = 1 347 | b =a @@ -161,8 +169,9 @@ error[RET504]: RET504.py:348:12: [*] Unnecessary assignment to `b` before `retur 350 349 | 351 350 | def foo(): -error[RET504]: RET504.py:354:12: [*] Unnecessary assignment to `b` before `return` statement +error[RET504]: 354:12: [*] Unnecessary assignment to `b` before `return` statement + --> RET504.py:354:12 | 352 | a = 1 353 | b= a @@ -181,8 +190,9 @@ error[RET504]: RET504.py:354:12: [*] Unnecessary assignment to `b` before `retur 356 355 | 357 356 | def foo(): -error[RET504]: RET504.py:359:12: [*] Unnecessary assignment to `a` before `return` statement +error[RET504]: 359:12: [*] Unnecessary assignment to `a` before `return` statement + --> RET504.py:359:12 | 357 | def foo(): 358 | a = 1 # Comment @@ -201,8 +211,9 @@ error[RET504]: RET504.py:359:12: [*] Unnecessary assignment to `a` before `retur 361 360 | 362 361 | # Regression test for: https://github.com/astral-sh/ruff/issues/7098 -error[RET504]: RET504.py:365:12: [*] Unnecessary assignment to `D` before `return` statement +error[RET504]: 365:12: [*] Unnecessary assignment to `D` before `return` statement + --> RET504.py:365:12 | 363 | def mavko_debari(P_kbar): 364 | D=0.4853881 + 3.6006116*P - 0.0117368*(P-1.3822)**2 @@ -221,8 +232,9 @@ error[RET504]: RET504.py:365:12: [*] Unnecessary assignment to `D` before `retur 367 366 | 368 367 | # contextlib suppress in with statement -error[RET504]: RET504.py:400:12: [*] Unnecessary assignment to `y` before `return` statement +error[RET504]: 400:12: [*] Unnecessary assignment to `y` before `return` statement + --> RET504.py:400:12 | 398 | x = 1 399 | y = y + 2 @@ -241,8 +253,9 @@ error[RET504]: RET504.py:400:12: [*] Unnecessary assignment to `y` before `retur 402 401 | 403 402 | def foo(): -error[RET504]: RET504.py:423:16: [*] Unnecessary assignment to `services` before `return` statement +error[RET504]: 423:16: [*] Unnecessary assignment to `services` before `return` statement + --> RET504.py:423:16 | 421 | if "services" in a: 422 | services = a["services"] diff --git a/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET505_RET505.py.snap b/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET505_RET505.py.snap index 08f4b537b3..fdb6d2d815 100644 --- a/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET505_RET505.py.snap +++ b/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET505_RET505.py.snap @@ -1,17 +1,18 @@ --- source: crates/ruff_linter/src/rules/flake8_return/mod.rs --- -RET505.py:8:5: RET505 [*] Unnecessary `elif` after `return` statement +error[RET505]: 8:5: [*] Unnecessary `elif` after `return` statement + + --> RET505.py:8:5 | 6 | a = 1 7 | return y 8 | elif z: - | ^^^^ RET505 + | ^^^^ 9 | b = 2 10 | return w | = help: Remove unnecessary `elif` - ℹ Safe fix 5 5 | if x: # [no-else-return] 6 6 | a = 1 @@ -22,17 +23,18 @@ RET505.py:8:5: RET505 [*] Unnecessary `elif` after `return` statement 10 10 | return w 11 11 | else: -RET505.py:23:5: RET505 [*] Unnecessary `elif` after `return` statement +error[RET505]: 23:5: [*] Unnecessary `elif` after `return` statement + + --> RET505.py:23:5 | 21 | b = 2 22 | return 23 | elif z: - | ^^^^ RET505 + | ^^^^ 24 | c = 2 25 | else: | = help: Remove unnecessary `elif` - ℹ Safe fix 20 20 | else: 21 21 | b = 2 @@ -43,17 +45,18 @@ RET505.py:23:5: RET505 [*] Unnecessary `elif` after `return` statement 25 25 | else: 26 26 | c = 3 -RET505.py:41:5: RET505 [*] Unnecessary `elif` after `return` statement +error[RET505]: 41:5: [*] Unnecessary `elif` after `return` statement + + --> RET505.py:41:5 | 39 | a = 1 40 | return y 41 | elif z: - | ^^^^ RET505 + | ^^^^ 42 | b = 2 43 | return w | = help: Remove unnecessary `elif` - ℹ Safe fix 38 38 | if x: # [no-else-return] 39 39 | a = 1 @@ -64,17 +67,18 @@ RET505.py:41:5: RET505 [*] Unnecessary `elif` after `return` statement 43 43 | return w 44 44 | else: -RET505.py:53:5: RET505 [*] Unnecessary `else` after `return` statement +error[RET505]: 53:5: [*] Unnecessary `else` after `return` statement + + --> RET505.py:53:5 | 51 | a = 1 52 | return y 53 | else: - | ^^^^ RET505 + | ^^^^ 54 | b = 2 55 | return z | = help: Remove unnecessary `else` - ℹ Safe fix 50 50 | if x: # [no-else-return] 51 51 | a = 1 @@ -88,17 +92,18 @@ RET505.py:53:5: RET505 [*] Unnecessary `else` after `return` statement 57 56 | 58 57 | def foo3(x, y, z): -RET505.py:64:9: RET505 [*] Unnecessary `else` after `return` statement +error[RET505]: 64:9: [*] Unnecessary `else` after `return` statement + + --> RET505.py:64:9 | 62 | b = 2 63 | return y 64 | else: - | ^^^^ RET505 + | ^^^^ 65 | c = 3 66 | return x | = help: Remove unnecessary `else` - ℹ Safe fix 61 61 | if y: # [no-else-return] 62 62 | b = 2 @@ -112,17 +117,18 @@ RET505.py:64:9: RET505 [*] Unnecessary `else` after `return` statement 68 67 | d = 4 69 68 | return z -RET505.py:79:5: RET505 [*] Unnecessary `else` after `return` statement +error[RET505]: 79:5: [*] Unnecessary `else` after `return` statement + + --> RET505.py:79:5 | 77 | b = 2 78 | return 79 | else: - | ^^^^ RET505 + | ^^^^ 80 | c = 3 81 | return | = help: Remove unnecessary `else` - ℹ Safe fix 76 76 | else: 77 77 | b = 2 @@ -134,17 +140,18 @@ RET505.py:79:5: RET505 [*] Unnecessary `else` after `return` statement 82 81 | 83 82 | -RET505.py:89:9: RET505 [*] Unnecessary `else` after `return` statement +error[RET505]: 89:9: [*] Unnecessary `else` after `return` statement + + --> RET505.py:89:9 | 87 | a = 4 88 | return 89 | else: - | ^^^^ RET505 + | ^^^^ 90 | b = 2 91 | else: | = help: Remove unnecessary `else` - ℹ Safe fix 86 86 | if y: # [no-else-return] 87 87 | a = 4 @@ -156,17 +163,18 @@ RET505.py:89:9: RET505 [*] Unnecessary `else` after `return` statement 92 91 | c = 3 93 92 | return -RET505.py:99:5: RET505 [*] Unnecessary `else` after `return` statement +error[RET505]: 99:5: [*] Unnecessary `else` after `return` statement + + --> RET505.py:99:5 | 97 | if x: # [no-else-return] 98 | return True 99 | else: - | ^^^^ RET505 + | ^^^^ 100 | try: 101 | return False | = help: Remove unnecessary `else` - ℹ Safe fix 96 96 | def bar4(x): 97 97 | if x: # [no-else-return] @@ -184,17 +192,18 @@ RET505.py:99:5: RET505 [*] Unnecessary `else` after `return` statement 105 104 | 106 105 | def fibo(n): -RET505.py:109:5: RET505 [*] Unnecessary `else` after `return` statement +error[RET505]: 109:5: [*] Unnecessary `else` after `return` statement + + --> RET505.py:109:5 | 107 | if n<2: 108 | return n; 109 | else: - | ^^^^ RET505 + | ^^^^ 110 | last = 1; 111 | last2 = 0; | = help: Remove unnecessary `else` - ℹ Safe fix 106 106 | def fibo(n): 107 107 | if n<2: @@ -208,17 +217,18 @@ RET505.py:109:5: RET505 [*] Unnecessary `else` after `return` statement 113 112 | 114 113 | ### -RET505.py:145:5: RET505 [*] Unnecessary `else` after `return` statement +error[RET505]: 145:5: [*] Unnecessary `else` after `return` statement + + --> RET505.py:145:5 | 143 | if True: 144 | return 145 | else: - | ^^^^ RET505 + | ^^^^ 146 | # comment 147 | pass | = help: Remove unnecessary `else` - ℹ Safe fix 142 142 | def bar4(x): 143 143 | if True: @@ -232,16 +242,17 @@ RET505.py:145:5: RET505 [*] Unnecessary `else` after `return` statement 149 148 | 150 149 | def bar5(): -RET505.py:153:5: RET505 [*] Unnecessary `else` after `return` statement +error[RET505]: 153:5: [*] Unnecessary `else` after `return` statement + + --> RET505.py:153:5 | 151 | if True: 152 | return 153 | else: # comment - | ^^^^ RET505 + | ^^^^ 154 | pass | = help: Remove unnecessary `else` - ℹ Safe fix 150 150 | def bar5(): 151 151 | if True: @@ -254,17 +265,18 @@ RET505.py:153:5: RET505 [*] Unnecessary `else` after `return` statement 156 156 | 157 157 | def bar6(): -RET505.py:160:5: RET505 [*] Unnecessary `else` after `return` statement +error[RET505]: 160:5: [*] Unnecessary `else` after `return` statement + + --> RET505.py:160:5 | 158 | if True: 159 | return 160 | else\ - | ^^^^ RET505 + | ^^^^ 161 | :\ 162 | # comment | = help: Remove unnecessary `else` - ℹ Safe fix 157 157 | def bar6(): 158 158 | if True: @@ -279,17 +291,18 @@ RET505.py:160:5: RET505 [*] Unnecessary `else` after `return` statement 165 163 | 166 164 | def bar7(): -RET505.py:169:5: RET505 [*] Unnecessary `else` after `return` statement +error[RET505]: 169:5: [*] Unnecessary `else` after `return` statement + + --> RET505.py:169:5 | 167 | if True: 168 | return 169 | else\ - | ^^^^ RET505 + | ^^^^ 170 | : # comment 171 | pass | = help: Remove unnecessary `else` - ℹ Safe fix 166 166 | def bar7(): 167 167 | if True: @@ -303,15 +316,16 @@ RET505.py:169:5: RET505 [*] Unnecessary `else` after `return` statement 173 172 | 174 173 | def bar8(): -RET505.py:177:5: RET505 [*] Unnecessary `else` after `return` statement +error[RET505]: 177:5: [*] Unnecessary `else` after `return` statement + + --> RET505.py:177:5 | 175 | if True: 176 | return 177 | else: pass - | ^^^^ RET505 + | ^^^^ | = help: Remove unnecessary `else` - ℹ Safe fix 174 174 | def bar8(): 175 175 | if True: @@ -322,16 +336,17 @@ RET505.py:177:5: RET505 [*] Unnecessary `else` after `return` statement 179 179 | 180 180 | def bar9(): -RET505.py:183:5: RET505 [*] Unnecessary `else` after `return` statement +error[RET505]: 183:5: [*] Unnecessary `else` after `return` statement + + --> RET505.py:183:5 | 181 | if True: 182 | return 183 | else:\ - | ^^^^ RET505 + | ^^^^ 184 | pass | = help: Remove unnecessary `else` - ℹ Safe fix 180 180 | def bar9(): 181 181 | if True: @@ -343,15 +358,16 @@ RET505.py:183:5: RET505 [*] Unnecessary `else` after `return` statement 186 185 | 187 186 | x = 0 -RET505.py:200:5: RET505 [*] Unnecessary `else` after `return` statement +error[RET505]: 200:5: [*] Unnecessary `else` after `return` statement + + --> RET505.py:200:5 | 198 | def sb(self): 199 | if self._sb is not None: return self._sb 200 | else: self._sb = '\033[01;%dm'; self._sa = '\033[0;0m'; - | ^^^^ RET505 + | ^^^^ | = help: Remove unnecessary `else` - ℹ Safe fix 197 197 | # Regression test for: https://github.com/astral-sh/ruff/issues/9732 198 198 | def sb(self): @@ -362,17 +378,18 @@ RET505.py:200:5: RET505 [*] Unnecessary `else` after `return` statement 202 202 | 203 203 | def indent(x, y, w, z): -RET505.py:207:5: RET505 [*] Unnecessary `else` after `return` statement +error[RET505]: 207:5: [*] Unnecessary `else` after `return` statement + + --> RET505.py:207:5 | 205 | a = 1 206 | return y 207 | else: - | ^^^^ RET505 + | ^^^^ 208 | 209 | c = 3 | = help: Remove unnecessary `else` - ℹ Safe fix 204 204 | if x: # [no-else-return] 205 205 | a = 1 @@ -387,17 +404,18 @@ RET505.py:207:5: RET505 [*] Unnecessary `else` after `return` statement 212 211 | 213 212 | def indent(x, y, w, z): -RET505.py:217:5: RET505 [*] Unnecessary `else` after `return` statement +error[RET505]: 217:5: [*] Unnecessary `else` after `return` statement + + --> RET505.py:217:5 | 215 | a = 1 216 | return y 217 | else: - | ^^^^ RET505 + | ^^^^ 218 | # comment 219 | c = 3 | = help: Remove unnecessary `else` - ℹ Safe fix 214 214 | if x: # [no-else-return] 215 215 | a = 1 @@ -413,17 +431,18 @@ RET505.py:217:5: RET505 [*] Unnecessary `else` after `return` statement 222 221 | 223 222 | def indent(x, y, w, z): -RET505.py:227:5: RET505 [*] Unnecessary `else` after `return` statement +error[RET505]: 227:5: [*] Unnecessary `else` after `return` statement + + --> RET505.py:227:5 | 225 | a = 1 226 | return y 227 | else: - | ^^^^ RET505 + | ^^^^ 228 | # comment 229 | c = 3 | = help: Remove unnecessary `else` - ℹ Safe fix 224 224 | if x: # [no-else-return] 225 225 | a = 1 @@ -439,17 +458,18 @@ RET505.py:227:5: RET505 [*] Unnecessary `else` after `return` statement 232 231 | 233 232 | def indent(x, y, w, z): -RET505.py:237:5: RET505 [*] Unnecessary `else` after `return` statement +error[RET505]: 237:5: [*] Unnecessary `else` after `return` statement + + --> RET505.py:237:5 | 235 | a = 1 236 | return y 237 | else: - | ^^^^ RET505 + | ^^^^ 238 | # comment 239 | c = 3 | = help: Remove unnecessary `else` - ℹ Safe fix 234 234 | if x: # [no-else-return] 235 235 | a = 1 @@ -464,16 +484,17 @@ RET505.py:237:5: RET505 [*] Unnecessary `else` after `return` statement 242 241 | def f(): 243 242 | if True: -RET505.py:245:2: RET505 [*] Unnecessary `else` after `return` statement +error[RET505]: 245:2: [*] Unnecessary `else` after `return` statement + + --> RET505.py:245:5 | 243 | if True: 244 | return True 245 | else: - | ^^^^ RET505 + | ^^^^ 246 | return False | = help: Remove unnecessary `else` - ℹ Safe fix 242 242 | def f(): 243 243 | if True: @@ -485,12 +506,14 @@ RET505.py:245:2: RET505 [*] Unnecessary `else` after `return` statement 248 247 | 249 248 | def has_untracted_files(): -RET505.py:252:5: RET505 Unnecessary `else` after `return` statement +error[RET505]: 252:5: Unnecessary `else` after `return` statement + + --> RET505.py:252:5 | 250 | if b'Untracked files' in result.stdout: 251 | return True 252 | else: - | ^^^^ RET505 + | ^^^^ 253 | \ 254 | return False | diff --git a/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET506_RET506.py.snap b/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET506_RET506.py.snap index b526b1a6fb..87032c7bba 100644 --- a/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET506_RET506.py.snap +++ b/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET506_RET506.py.snap @@ -1,17 +1,18 @@ --- source: crates/ruff_linter/src/rules/flake8_return/mod.rs --- -RET506.py:8:5: RET506 [*] Unnecessary `elif` after `raise` statement +error[RET506]: 8:5: [*] Unnecessary `elif` after `raise` statement + + --> RET506.py:8:5 | 6 | a = 1 7 | raise Exception(y) 8 | elif z: - | ^^^^ RET506 + | ^^^^ 9 | b = 2 10 | raise Exception(w) | = help: Remove unnecessary `elif` - ℹ Safe fix 5 5 | if x: # [no-else-raise] 6 6 | a = 1 @@ -22,17 +23,18 @@ RET506.py:8:5: RET506 [*] Unnecessary `elif` after `raise` statement 10 10 | raise Exception(w) 11 11 | else: -RET506.py:23:5: RET506 [*] Unnecessary `elif` after `raise` statement +error[RET506]: 23:5: [*] Unnecessary `elif` after `raise` statement + + --> RET506.py:23:5 | 21 | b = 2 22 | raise Exception(x) 23 | elif z: - | ^^^^ RET506 + | ^^^^ 24 | raise Exception(y) 25 | else: | = help: Remove unnecessary `elif` - ℹ Safe fix 20 20 | else: 21 21 | b = 2 @@ -43,17 +45,18 @@ RET506.py:23:5: RET506 [*] Unnecessary `elif` after `raise` statement 25 25 | else: 26 26 | c = 3 -RET506.py:34:5: RET506 [*] Unnecessary `else` after `raise` statement +error[RET506]: 34:5: [*] Unnecessary `else` after `raise` statement + + --> RET506.py:34:5 | 32 | a = 1 33 | raise Exception(y) 34 | else: - | ^^^^ RET506 + | ^^^^ 35 | b = 2 36 | raise Exception(z) | = help: Remove unnecessary `else` - ℹ Safe fix 31 31 | if x: # [no-else-raise] 32 32 | a = 1 @@ -67,17 +70,18 @@ RET506.py:34:5: RET506 [*] Unnecessary `else` after `raise` statement 38 37 | 39 38 | def foo3(x, y, z): -RET506.py:45:9: RET506 [*] Unnecessary `else` after `raise` statement +error[RET506]: 45:9: [*] Unnecessary `else` after `raise` statement + + --> RET506.py:45:9 | 43 | b = 2 44 | raise Exception(y) 45 | else: - | ^^^^ RET506 + | ^^^^ 46 | c = 3 47 | raise Exception(x) | = help: Remove unnecessary `else` - ℹ Safe fix 42 42 | if y: # [no-else-raise] 43 43 | b = 2 @@ -91,17 +95,18 @@ RET506.py:45:9: RET506 [*] Unnecessary `else` after `raise` statement 49 48 | d = 4 50 49 | raise Exception(z) -RET506.py:60:5: RET506 [*] Unnecessary `else` after `raise` statement +error[RET506]: 60:5: [*] Unnecessary `else` after `raise` statement + + --> RET506.py:60:5 | 58 | b = 2 59 | raise Exception(x) 60 | else: - | ^^^^ RET506 + | ^^^^ 61 | c = 3 62 | raise Exception(y) | = help: Remove unnecessary `else` - ℹ Safe fix 57 57 | else: 58 58 | b = 2 @@ -113,17 +118,18 @@ RET506.py:60:5: RET506 [*] Unnecessary `else` after `raise` statement 63 62 | 64 63 | -RET506.py:70:9: RET506 [*] Unnecessary `else` after `raise` statement +error[RET506]: 70:9: [*] Unnecessary `else` after `raise` statement + + --> RET506.py:70:9 | 68 | a = 4 69 | raise Exception(x) 70 | else: - | ^^^^ RET506 + | ^^^^ 71 | b = 2 72 | else: | = help: Remove unnecessary `else` - ℹ Safe fix 67 67 | if y: # [no-else-raise] 68 68 | a = 4 @@ -135,17 +141,18 @@ RET506.py:70:9: RET506 [*] Unnecessary `else` after `raise` statement 73 72 | c = 3 74 73 | raise Exception(y) -RET506.py:80:5: RET506 [*] Unnecessary `else` after `raise` statement +error[RET506]: 80:5: [*] Unnecessary `else` after `raise` statement + + --> RET506.py:80:5 | 78 | if x: # [no-else-raise] 79 | raise Exception(True) 80 | else: - | ^^^^ RET506 + | ^^^^ 81 | try: 82 | raise Exception(False) | = help: Remove unnecessary `else` - ℹ Safe fix 77 77 | def bar4(x): 78 78 | if x: # [no-else-raise] diff --git a/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET507_RET507.py.snap b/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET507_RET507.py.snap index 6b8e47c961..d041397127 100644 --- a/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET507_RET507.py.snap +++ b/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET507_RET507.py.snap @@ -1,17 +1,18 @@ --- source: crates/ruff_linter/src/rules/flake8_return/mod.rs --- -RET507.py:8:9: RET507 [*] Unnecessary `elif` after `continue` statement +error[RET507]: 8:9: [*] Unnecessary `elif` after `continue` statement + + --> RET507.py:8:9 | 6 | if i < y: # [no-else-continue] 7 | continue 8 | elif i < w: - | ^^^^ RET507 + | ^^^^ 9 | continue 10 | else: | = help: Remove unnecessary `elif` - ℹ Safe fix 5 5 | for i in x: 6 6 | if i < y: # [no-else-continue] @@ -22,17 +23,18 @@ RET507.py:8:9: RET507 [*] Unnecessary `elif` after `continue` statement 10 10 | else: 11 11 | a = z -RET507.py:22:9: RET507 [*] Unnecessary `elif` after `continue` statement +error[RET507]: 22:9: [*] Unnecessary `elif` after `continue` statement + + --> RET507.py:22:9 | 20 | b = 2 21 | continue 22 | elif z: - | ^^^^ RET507 + | ^^^^ 23 | c = 2 24 | else: | = help: Remove unnecessary `elif` - ℹ Safe fix 19 19 | else: 20 20 | b = 2 @@ -43,16 +45,17 @@ RET507.py:22:9: RET507 [*] Unnecessary `elif` after `continue` statement 24 24 | else: 25 25 | c = 3 -RET507.py:36:9: RET507 [*] Unnecessary `else` after `continue` statement +error[RET507]: 36:9: [*] Unnecessary `else` after `continue` statement + + --> RET507.py:36:9 | 34 | if i < y: # [no-else-continue] 35 | continue 36 | else: - | ^^^^ RET507 + | ^^^^ 37 | a = z | = help: Remove unnecessary `else` - ℹ Safe fix 33 33 | for i in x: 34 34 | if i < y: # [no-else-continue] @@ -64,17 +67,18 @@ RET507.py:36:9: RET507 [*] Unnecessary `else` after `continue` statement 39 38 | 40 39 | def foo3(x, y, z): -RET507.py:47:13: RET507 [*] Unnecessary `else` after `continue` statement +error[RET507]: 47:13: [*] Unnecessary `else` after `continue` statement + + --> RET507.py:47:13 | 45 | b = 2 46 | continue 47 | else: - | ^^^^ RET507 + | ^^^^ 48 | c = 3 49 | continue | = help: Remove unnecessary `else` - ℹ Safe fix 44 44 | if z: # [no-else-continue] 45 45 | b = 2 @@ -88,17 +92,18 @@ RET507.py:47:13: RET507 [*] Unnecessary `else` after `continue` statement 51 50 | d = 4 52 51 | continue -RET507.py:63:9: RET507 [*] Unnecessary `else` after `continue` statement +error[RET507]: 63:9: [*] Unnecessary `else` after `continue` statement + + --> RET507.py:63:9 | 61 | b = 2 62 | continue 63 | else: - | ^^^^ RET507 + | ^^^^ 64 | c = 3 65 | continue | = help: Remove unnecessary `else` - ℹ Safe fix 60 60 | else: 61 61 | b = 2 @@ -110,17 +115,18 @@ RET507.py:63:9: RET507 [*] Unnecessary `else` after `continue` statement 66 65 | 67 66 | -RET507.py:74:13: RET507 [*] Unnecessary `else` after `continue` statement +error[RET507]: 74:13: [*] Unnecessary `else` after `continue` statement + + --> RET507.py:74:13 | 72 | a = 4 73 | continue 74 | else: - | ^^^^ RET507 + | ^^^^ 75 | b = 2 76 | else: | = help: Remove unnecessary `else` - ℹ Safe fix 71 71 | if y: # [no-else-continue] 72 72 | a = 4 @@ -132,17 +138,18 @@ RET507.py:74:13: RET507 [*] Unnecessary `else` after `continue` statement 77 76 | c = 3 78 77 | continue -RET507.py:85:9: RET507 [*] Unnecessary `else` after `continue` statement +error[RET507]: 85:9: [*] Unnecessary `else` after `continue` statement + + --> RET507.py:85:9 | 83 | if x: # [no-else-continue] 84 | continue 85 | else: - | ^^^^ RET507 + | ^^^^ 86 | try: 87 | return | = help: Remove unnecessary `else` - ℹ Safe fix 82 82 | for i in range(10): 83 83 | if x: # [no-else-continue] diff --git a/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET508_RET508.py.snap b/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET508_RET508.py.snap index 072b97b754..c9fd5f2f67 100644 --- a/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET508_RET508.py.snap +++ b/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET508_RET508.py.snap @@ -1,17 +1,18 @@ --- source: crates/ruff_linter/src/rules/flake8_return/mod.rs --- -RET508.py:8:9: RET508 [*] Unnecessary `elif` after `break` statement +error[RET508]: 8:9: [*] Unnecessary `elif` after `break` statement + + --> RET508.py:8:9 | 6 | if i > y: # [no-else-break] 7 | break 8 | elif i > w: - | ^^^^ RET508 + | ^^^^ 9 | break 10 | else: | = help: Remove unnecessary `elif` - ℹ Safe fix 5 5 | for i in x: 6 6 | if i > y: # [no-else-break] @@ -22,17 +23,18 @@ RET508.py:8:9: RET508 [*] Unnecessary `elif` after `break` statement 10 10 | else: 11 11 | a = z -RET508.py:22:9: RET508 [*] Unnecessary `elif` after `break` statement +error[RET508]: 22:9: [*] Unnecessary `elif` after `break` statement + + --> RET508.py:22:9 | 20 | b = 2 21 | break 22 | elif z: - | ^^^^ RET508 + | ^^^^ 23 | c = 2 24 | else: | = help: Remove unnecessary `elif` - ℹ Safe fix 19 19 | else: 20 20 | b = 2 @@ -43,16 +45,17 @@ RET508.py:22:9: RET508 [*] Unnecessary `elif` after `break` statement 24 24 | else: 25 25 | c = 3 -RET508.py:33:9: RET508 [*] Unnecessary `else` after `break` statement +error[RET508]: 33:9: [*] Unnecessary `else` after `break` statement + + --> RET508.py:33:9 | 31 | if i > y: # [no-else-break] 32 | break 33 | else: - | ^^^^ RET508 + | ^^^^ 34 | a = z | = help: Remove unnecessary `else` - ℹ Safe fix 30 30 | for i in x: 31 31 | if i > y: # [no-else-break] @@ -64,17 +67,18 @@ RET508.py:33:9: RET508 [*] Unnecessary `else` after `break` statement 36 35 | 37 36 | def foo3(x, y, z): -RET508.py:44:13: RET508 [*] Unnecessary `else` after `break` statement +error[RET508]: 44:13: [*] Unnecessary `else` after `break` statement + + --> RET508.py:44:13 | 42 | b = 2 43 | break 44 | else: - | ^^^^ RET508 + | ^^^^ 45 | c = 3 46 | break | = help: Remove unnecessary `else` - ℹ Safe fix 41 41 | if z: # [no-else-break] 42 42 | b = 2 @@ -88,17 +92,18 @@ RET508.py:44:13: RET508 [*] Unnecessary `else` after `break` statement 48 47 | d = 4 49 48 | break -RET508.py:60:9: RET508 [*] Unnecessary `else` after `break` statement +error[RET508]: 60:9: [*] Unnecessary `else` after `break` statement + + --> RET508.py:60:9 | 58 | b = 2 59 | break 60 | else: - | ^^^^ RET508 + | ^^^^ 61 | c = 3 62 | break | = help: Remove unnecessary `else` - ℹ Safe fix 57 57 | else: 58 58 | b = 2 @@ -110,17 +115,18 @@ RET508.py:60:9: RET508 [*] Unnecessary `else` after `break` statement 63 62 | 64 63 | -RET508.py:71:13: RET508 [*] Unnecessary `else` after `break` statement +error[RET508]: 71:13: [*] Unnecessary `else` after `break` statement + + --> RET508.py:71:13 | 69 | a = 4 70 | break 71 | else: - | ^^^^ RET508 + | ^^^^ 72 | b = 2 73 | else: | = help: Remove unnecessary `else` - ℹ Safe fix 68 68 | if y: # [no-else-break] 69 69 | a = 4 @@ -132,17 +138,18 @@ RET508.py:71:13: RET508 [*] Unnecessary `else` after `break` statement 74 73 | c = 3 75 74 | break -RET508.py:82:9: RET508 [*] Unnecessary `else` after `break` statement +error[RET508]: 82:9: [*] Unnecessary `else` after `break` statement + + --> RET508.py:82:9 | 80 | if x: # [no-else-break] 81 | break 82 | else: - | ^^^^ RET508 + | ^^^^ 83 | try: 84 | return | = help: Remove unnecessary `else` - ℹ Safe fix 79 79 | for i in range(10): 80 80 | if x: # [no-else-break] @@ -160,16 +167,17 @@ RET508.py:82:9: RET508 [*] Unnecessary `else` after `break` statement 88 87 | 89 88 | ### -RET508.py:158:13: RET508 [*] Unnecessary `else` after `break` statement +error[RET508]: 158:13: [*] Unnecessary `else` after `break` statement + + --> RET508.py:158:13 | 156 | if i > w: 157 | break 158 | else: - | ^^^^ RET508 + | ^^^^ 159 | a = z | = help: Remove unnecessary `else` - ℹ Safe fix 155 155 | else: 156 156 | if i > w: diff --git a/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__preview__RET503_RET503.py.snap b/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__preview__RET503_RET503.py.snap index 96478e899a..36fa7699ce 100644 --- a/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__preview__RET503_RET503.py.snap +++ b/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__preview__RET503_RET503.py.snap @@ -1,17 +1,18 @@ --- source: crates/ruff_linter/src/rules/flake8_return/mod.rs --- -RET503.py:20:1: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value +error[RET503]: 20:1: [*] Missing explicit `return` at the end of function able to return non-`None` value + + --> RET503.py:19:15 | 19 | # if/elif/else 20 | / def x(y): 21 | | if not y: 22 | | return 1 - | |________________^ RET503 + | |________________^ 23 | # error | = help: Add explicit `return` statement - ℹ Unsafe fix 20 20 | def x(y): 21 21 | if not y: @@ -21,17 +22,18 @@ RET503.py:20:1: RET503 [*] Missing explicit `return` at the end of function able 24 25 | 25 26 | -RET503.py:26:1: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value +error[RET503]: 26:1: [*] Missing explicit `return` at the end of function able to return non-`None` value + + --> RET503.py:26:1 | 26 | / def x(y): 27 | | if not y: 28 | | print() # error 29 | | else: 30 | | return 2 - | |________________^ RET503 + | |________________^ | = help: Add explicit `return` statement - ℹ Unsafe fix 28 28 | print() # error 29 29 | else: @@ -41,17 +43,18 @@ RET503.py:26:1: RET503 [*] Missing explicit `return` at the end of function able 32 33 | 33 34 | def x(y): -RET503.py:33:1: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value +error[RET503]: 33:1: [*] Missing explicit `return` at the end of function able to return non-`None` value + + --> RET503.py:33:1 | 33 | / def x(y): 34 | | if not y: 35 | | return 1 36 | | 37 | | print() # error - | |___________^ RET503 + | |___________^ | = help: Add explicit `return` statement - ℹ Unsafe fix 35 35 | return 1 36 36 | @@ -61,18 +64,19 @@ RET503.py:33:1: RET503 [*] Missing explicit `return` at the end of function able 39 40 | 40 41 | # for -RET503.py:41:1: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value +error[RET503]: 41:1: [*] Missing explicit `return` at the end of function able to return non-`None` value + + --> RET503.py:40:6 | 40 | # for 41 | / def x(y): 42 | | for i in range(10): 43 | | if i > 10: 44 | | return i - | |____________________^ RET503 + | |____________________^ 45 | # error | = help: Add explicit `return` statement - ℹ Unsafe fix 42 42 | for i in range(10): 43 43 | if i > 10: @@ -82,7 +86,9 @@ RET503.py:41:1: RET503 [*] Missing explicit `return` at the end of function able 46 47 | 47 48 | -RET503.py:48:1: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value +error[RET503]: 48:1: [*] Missing explicit `return` at the end of function able to return non-`None` value + + --> RET503.py:48:1 | 48 | / def x(y): 49 | | for i in range(10): @@ -90,10 +96,9 @@ RET503.py:48:1: RET503 [*] Missing explicit `return` at the end of function able 51 | | return i 52 | | else: 53 | | print() # error - | |_______________^ RET503 + | |_______________^ | = help: Add explicit `return` statement - ℹ Unsafe fix 51 51 | return i 52 52 | else: @@ -103,17 +108,18 @@ RET503.py:48:1: RET503 [*] Missing explicit `return` at the end of function able 55 56 | 56 57 | # A nonexistent function -RET503.py:57:1: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value +error[RET503]: 57:1: [*] Missing explicit `return` at the end of function able to return non-`None` value + + --> RET503.py:56:25 | 56 | # A nonexistent function 57 | / def func_unknown(x): 58 | | if x > 0: 59 | | return False 60 | | no_such_function() # error - | |______________________^ RET503 + | |______________________^ | = help: Add explicit `return` statement - ℹ Unsafe fix 58 58 | if x > 0: 59 59 | return False @@ -123,17 +129,18 @@ RET503.py:57:1: RET503 [*] Missing explicit `return` at the end of function able 62 63 | 63 64 | # A function that does return the control -RET503.py:64:1: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value +error[RET503]: 64:1: [*] Missing explicit `return` at the end of function able to return non-`None` value + + --> RET503.py:63:42 | 63 | # A function that does return the control 64 | / def func_no_noreturn(x): 65 | | if x > 0: 66 | | return False 67 | | print("", end="") # error - | |_____________________^ RET503 + | |_____________________^ | = help: Add explicit `return` statement - ℹ Unsafe fix 65 65 | if x > 0: 66 66 | return False @@ -143,7 +150,9 @@ RET503.py:64:1: RET503 [*] Missing explicit `return` at the end of function able 69 70 | 70 71 | ### -RET503.py:82:1: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value +error[RET503]: 82:1: [*] Missing explicit `return` at the end of function able to return non-`None` value + + --> RET503.py:81:26 | 81 | # last line in while loop 82 | / def x(y): @@ -151,10 +160,9 @@ RET503.py:82:1: RET503 [*] Missing explicit `return` at the end of function able 84 | | if y > 0: 85 | | return 1 86 | | y += 1 - | |______________^ RET503 + | |______________^ | = help: Add explicit `return` statement - ℹ Unsafe fix 84 84 | if y > 0: 85 85 | return 1 @@ -164,7 +172,9 @@ RET503.py:82:1: RET503 [*] Missing explicit `return` at the end of function able 88 89 | 89 90 | # exclude empty functions -RET503.py:113:1: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value +error[RET503]: 113:1: [*] Missing explicit `return` at the end of function able to return non-`None` value + + --> RET503.py:112:27 | 112 | # return value within loop 113 | / def bar1(x, y, z): @@ -172,10 +182,9 @@ RET503.py:113:1: RET503 [*] Missing explicit `return` at the end of function abl 115 | | if i > y: 116 | | break 117 | | return z - | |________________^ RET503 + | |________________^ | = help: Add explicit `return` statement - ℹ Unsafe fix 115 115 | if i > y: 116 116 | break @@ -185,7 +194,9 @@ RET503.py:113:1: RET503 [*] Missing explicit `return` at the end of function abl 119 120 | 120 121 | def bar3(x, y, z): -RET503.py:120:1: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value +error[RET503]: 120:1: [*] Missing explicit `return` at the end of function able to return non-`None` value + + --> RET503.py:120:1 | 120 | / def bar3(x, y, z): 121 | | for i in x: @@ -195,10 +206,9 @@ RET503.py:120:1: RET503 [*] Missing explicit `return` at the end of function abl 125 | | else: 126 | | return z 127 | | return None - | |___________________^ RET503 + | |___________________^ | = help: Add explicit `return` statement - ℹ Unsafe fix 125 125 | else: 126 126 | return z @@ -208,17 +218,18 @@ RET503.py:120:1: RET503 [*] Missing explicit `return` at the end of function abl 129 130 | 130 131 | def bar1(x, y, z): -RET503.py:130:1: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value +error[RET503]: 130:1: [*] Missing explicit `return` at the end of function able to return non-`None` value + + --> RET503.py:130:1 | 130 | / def bar1(x, y, z): 131 | | for i in x: 132 | | if i < y: 133 | | continue 134 | | return z - | |________________^ RET503 + | |________________^ | = help: Add explicit `return` statement - ℹ Unsafe fix 132 132 | if i < y: 133 133 | continue @@ -228,7 +239,9 @@ RET503.py:130:1: RET503 [*] Missing explicit `return` at the end of function abl 136 137 | 137 138 | def bar3(x, y, z): -RET503.py:137:1: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value +error[RET503]: 137:1: [*] Missing explicit `return` at the end of function able to return non-`None` value + + --> RET503.py:137:1 | 137 | / def bar3(x, y, z): 138 | | for i in x: @@ -238,10 +251,9 @@ RET503.py:137:1: RET503 [*] Missing explicit `return` at the end of function abl 142 | | else: 143 | | return z 144 | | return None - | |___________________^ RET503 + | |___________________^ | = help: Add explicit `return` statement - ℹ Unsafe fix 142 142 | else: 143 143 | return z @@ -251,7 +263,9 @@ RET503.py:137:1: RET503 [*] Missing explicit `return` at the end of function abl 146 147 | 147 148 | def prompts(self, foo): -RET503.py:271:1: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value +error[RET503]: 271:1: [*] Missing explicit `return` at the end of function able to return non-`None` value + + --> RET503.py:271:1 | 271 | / def nested(values): 272 | | if not values: @@ -259,10 +273,9 @@ RET503.py:271:1: RET503 [*] Missing explicit `return` at the end of function abl 274 | | 275 | | for value in values: 276 | | print(value) - | |____________________^ RET503 + | |____________________^ | = help: Add explicit `return` statement - ℹ Unsafe fix 274 274 | 275 275 | for value in values: @@ -272,7 +285,9 @@ RET503.py:271:1: RET503 [*] Missing explicit `return` at the end of function abl 278 279 | 279 280 | def while_true(): -RET503.py:287:1: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value +error[RET503]: 287:1: [*] Missing explicit `return` at the end of function able to return non-`None` value + + --> RET503.py:286:8 | 286 | # match 287 | / def x(y): @@ -281,10 +296,9 @@ RET503.py:287:1: RET503 [*] Missing explicit `return` at the end of function abl 290 | | return 1 291 | | case 1: 292 | | print() # error - | |___________________^ RET503 + | |___________________^ | = help: Add explicit `return` statement - ℹ Unsafe fix 290 290 | return 1 291 291 | case 1: @@ -294,17 +308,18 @@ RET503.py:287:1: RET503 [*] Missing explicit `return` at the end of function abl 294 295 | 295 296 | def foo(baz: str) -> str: -RET503.py:300:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value +error[RET503]: 300:5: [*] Missing explicit `return` at the end of function able to return non-`None` value + + --> RET503.py:300:5 | 299 | def end_of_statement(): 300 | def example(): | _____^ 301 | | if True: 302 | | return "" - | |_____________________^ RET503 + | |_____________________^ | = help: Add explicit `return` statement - ℹ Unsafe fix 300 300 | def example(): 301 301 | if True: @@ -314,16 +329,17 @@ RET503.py:300:5: RET503 [*] Missing explicit `return` at the end of function abl 304 305 | 305 306 | def example(): -RET503.py:305:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value +error[RET503]: 305:5: [*] Missing explicit `return` at the end of function able to return non-`None` value + + --> RET503.py:305:5 | 305 | def example(): | _____^ 306 | | if True: 307 | | return "" - | |_____________________^ RET503 + | |_____________________^ | = help: Add explicit `return` statement - ℹ Unsafe fix 305 305 | def example(): 306 306 | if True: @@ -333,16 +349,17 @@ RET503.py:305:5: RET503 [*] Missing explicit `return` at the end of function abl 309 310 | 310 311 | def example(): -RET503.py:310:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value +error[RET503]: 310:5: [*] Missing explicit `return` at the end of function able to return non-`None` value + + --> RET503.py:310:5 | 310 | def example(): | _____^ 311 | | if True: 312 | | return "" # type: ignore - | |_____________________^ RET503 + | |_____________________^ | = help: Add explicit `return` statement - ℹ Unsafe fix 310 310 | def example(): 311 311 | if True: @@ -352,16 +369,17 @@ RET503.py:310:5: RET503 [*] Missing explicit `return` at the end of function abl 314 315 | 315 316 | def example(): -RET503.py:315:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value +error[RET503]: 315:5: [*] Missing explicit `return` at the end of function able to return non-`None` value + + --> RET503.py:315:5 | 315 | def example(): | _____^ 316 | | if True: 317 | | return "" ; - | |_____________________^ RET503 + | |_____________________^ | = help: Add explicit `return` statement - ℹ Unsafe fix 315 315 | def example(): 316 316 | if True: @@ -371,17 +389,18 @@ RET503.py:315:5: RET503 [*] Missing explicit `return` at the end of function abl 319 320 | 320 321 | def example(): -RET503.py:320:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value +error[RET503]: 320:5: [*] Missing explicit `return` at the end of function able to return non-`None` value + + --> RET503.py:320:5 | 320 | def example(): | _____^ 321 | | if True: 322 | | return "" \ - | |_____________________^ RET503 + | |_____________________^ 323 | ; # type: ignore | = help: Add explicit `return` statement - ℹ Unsafe fix 321 321 | if True: 322 322 | return "" \ @@ -391,16 +410,17 @@ RET503.py:320:5: RET503 [*] Missing explicit `return` at the end of function abl 325 326 | 326 327 | def end_of_file(): -RET503.py:326:1: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value +error[RET503]: 326:1: [*] Missing explicit `return` at the end of function able to return non-`None` value + + --> RET503.py:326:1 | 326 | / def end_of_file(): 327 | | if False: 328 | | return 1 329 | | x = 2 \ - | |_________^ RET503 + | |_________^ | = help: Add explicit `return` statement - ℹ Unsafe fix 328 328 | return 1 329 329 | x = 2 \ @@ -410,7 +430,9 @@ RET503.py:326:1: RET503 [*] Missing explicit `return` at the end of function abl 332 333 | 333 334 | # function return type annotation NoReturn -RET503.py:334:1: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value +error[RET503]: 334:1: [*] Missing explicit `return` at the end of function able to return non-`None` value + + --> RET503.py:333:43 | 333 | # function return type annotation NoReturn 334 | / def foo(x: int) -> int: @@ -419,10 +441,9 @@ RET503.py:334:1: RET503 [*] Missing explicit `return` at the end of function abl 337 | | if x == 5: 338 | | return 5 339 | | bar() - | |_________^ RET503 + | |_________^ | = help: Add explicit `return` statement - ℹ Unsafe fix 337 337 | if x == 5: 338 338 | return 5 @@ -432,7 +453,9 @@ RET503.py:334:1: RET503 [*] Missing explicit `return` at the end of function abl 341 342 | 342 343 | def foo(string: str) -> str: -RET503.py:342:1: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value +error[RET503]: 342:1: [*] Missing explicit `return` at the end of function able to return non-`None` value + + --> RET503.py:342:1 | 342 | / def foo(string: str) -> str: 343 | | def raises(value: str) -> NoReturn: @@ -447,10 +470,9 @@ RET503.py:342:1: RET503 [*] Missing explicit `return` at the end of function abl 352 | | return "third" 353 | | case _: 354 | | raises(string) - | |__________________________^ RET503 + | |__________________________^ | = help: Add explicit `return` statement - ℹ Unsafe fix 352 352 | return "third" 353 353 | case _: @@ -460,7 +482,9 @@ RET503.py:342:1: RET503 [*] Missing explicit `return` at the end of function abl 356 357 | 357 358 | def foo() -> int: -RET503.py:357:1: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value +error[RET503]: 357:1: [*] Missing explicit `return` at the end of function able to return non-`None` value + + --> RET503.py:357:1 | 357 | / def foo() -> int: 358 | | def baz() -> int: @@ -476,10 +500,9 @@ RET503.py:357:1: RET503 [*] Missing explicit `return` at the end of function abl 368 | | if baz() > 3: 369 | | return 1 370 | | bar() - | |_________^ RET503 + | |_________^ | = help: Add explicit `return` statement - ℹ Unsafe fix 368 368 | if baz() > 3: 369 369 | return 1 @@ -489,7 +512,9 @@ RET503.py:357:1: RET503 [*] Missing explicit `return` at the end of function abl 372 373 | 373 374 | def f(): -RET503.py:373:1: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value +error[RET503]: 373:1: [*] Missing explicit `return` at the end of function able to return non-`None` value + + --> RET503.py:373:1 | 373 | / def f(): 374 | | if a: @@ -497,10 +522,9 @@ RET503.py:373:1: RET503 [*] Missing explicit `return` at the end of function abl 376 | | else: 377 | | with c: 378 | | d - | |_____________^ RET503 + | |_____________^ | = help: Add explicit `return` statement - ℹ Unsafe fix 376 376 | else: 377 377 | with c: diff --git a/crates/ruff_linter/src/rules/flake8_self/snapshots/ruff_linter__rules__flake8_self__tests__ignore_names.snap b/crates/ruff_linter/src/rules/flake8_self/snapshots/ruff_linter__rules__flake8_self__tests__ignore_names.snap index 15e63110d5..72d6d049d7 100644 --- a/crates/ruff_linter/src/rules/flake8_self/snapshots/ruff_linter__rules__flake8_self__tests__ignore_names.snap +++ b/crates/ruff_linter/src/rules/flake8_self/snapshots/ruff_linter__rules__flake8_self__tests__ignore_names.snap @@ -1,15 +1,17 @@ --- source: crates/ruff_linter/src/rules/flake8_self/mod.rs --- -error[SLF001]: SLF001_extended.py:6:5: Private member accessed: `_asdict` +error[SLF001]: 6:5: Private member accessed: `_asdict` + --> SLF001_extended.py:6:5 | 5 | def foo(obj): 6 | obj._asdict # SLF001 | ^^^^^^^^^^^ | -error[SLF001]: SLF001_extended.py:10:5: Private member accessed: `_bar` +error[SLF001]: 10:5: Private member accessed: `_bar` + --> SLF001_extended.py:10:5 | 9 | def foo(obj): 10 | obj._bar # SLF001 diff --git a/crates/ruff_linter/src/rules/flake8_self/snapshots/ruff_linter__rules__flake8_self__tests__private-member-access_SLF001.py.snap b/crates/ruff_linter/src/rules/flake8_self/snapshots/ruff_linter__rules__flake8_self__tests__private-member-access_SLF001.py.snap index a9f1c4ca05..4a80f1e6a2 100644 --- a/crates/ruff_linter/src/rules/flake8_self/snapshots/ruff_linter__rules__flake8_self__tests__private-member-access_SLF001.py.snap +++ b/crates/ruff_linter/src/rules/flake8_self/snapshots/ruff_linter__rules__flake8_self__tests__private-member-access_SLF001.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_self/mod.rs --- -error[SLF001]: SLF001.py:34:12: Private member accessed: `_private` +error[SLF001]: 34:12: Private member accessed: `_private` + --> SLF001.py:34:12 | 33 | def get_bar(): 34 | if self.bar._private: # SLF001 @@ -10,8 +11,9 @@ error[SLF001]: SLF001.py:34:12: Private member accessed: `_private` 35 | return None 36 | if self.bar()._private: # SLF001 | -error[SLF001]: SLF001.py:36:12: Private member accessed: `_private` +error[SLF001]: 36:12: Private member accessed: `_private` + --> SLF001.py:36:12 | 34 | if self.bar._private: # SLF001 35 | return None @@ -20,8 +22,9 @@ error[SLF001]: SLF001.py:36:12: Private member accessed: `_private` 37 | return None 38 | if Bar._private_thing: # SLF001 | -error[SLF001]: SLF001.py:38:12: Private member accessed: `_private_thing` +error[SLF001]: 38:12: Private member accessed: `_private_thing` + --> SLF001.py:38:12 | 36 | if self.bar()._private: # SLF001 37 | return None @@ -30,8 +33,9 @@ error[SLF001]: SLF001.py:38:12: Private member accessed: `_private_thing` 39 | return None 40 | if Foo._private_thing: | -error[SLF001]: SLF001.py:43:12: Private member accessed: `_private_thing` +error[SLF001]: 43:12: Private member accessed: `_private_thing` + --> SLF001.py:43:12 | 41 | return None 42 | Foo = Bar() @@ -40,8 +44,9 @@ error[SLF001]: SLF001.py:43:12: Private member accessed: `_private_thing` 44 | return None 45 | return self.bar | -error[SLF001]: SLF001.py:62:7: Private member accessed: `_private_thing` +error[SLF001]: 62:7: Private member accessed: `_private_thing` + --> SLF001.py:62:7 | 60 | foo = Foo() 61 | @@ -50,8 +55,9 @@ error[SLF001]: SLF001.py:62:7: Private member accessed: `_private_thing` 63 | print(foo.__really_private_thing) # SLF001 64 | print(foo._private_func()) # SLF001 | -error[SLF001]: SLF001.py:63:7: Private member accessed: `__really_private_thing` +error[SLF001]: 63:7: Private member accessed: `__really_private_thing` + --> SLF001.py:63:7 | 62 | print(foo._private_thing) # SLF001 63 | print(foo.__really_private_thing) # SLF001 @@ -59,8 +65,9 @@ error[SLF001]: SLF001.py:63:7: Private member accessed: `__really_private_thing` 64 | print(foo._private_func()) # SLF001 65 | print(foo.__really_private_func(1)) # SLF001 | -error[SLF001]: SLF001.py:64:7: Private member accessed: `_private_func` +error[SLF001]: 64:7: Private member accessed: `_private_func` + --> SLF001.py:64:7 | 62 | print(foo._private_thing) # SLF001 63 | print(foo.__really_private_thing) # SLF001 @@ -69,8 +76,9 @@ error[SLF001]: SLF001.py:64:7: Private member accessed: `_private_func` 65 | print(foo.__really_private_func(1)) # SLF001 66 | print(foo.bar._private) # SLF001 | -error[SLF001]: SLF001.py:65:7: Private member accessed: `__really_private_func` +error[SLF001]: 65:7: Private member accessed: `__really_private_func` + --> SLF001.py:65:7 | 63 | print(foo.__really_private_thing) # SLF001 64 | print(foo._private_func()) # SLF001 @@ -79,8 +87,9 @@ error[SLF001]: SLF001.py:65:7: Private member accessed: `__really_private_func` 66 | print(foo.bar._private) # SLF001 67 | print(foo()._private_thing) # SLF001 | -error[SLF001]: SLF001.py:66:7: Private member accessed: `_private` +error[SLF001]: 66:7: Private member accessed: `_private` + --> SLF001.py:66:7 | 64 | print(foo._private_func()) # SLF001 65 | print(foo.__really_private_func(1)) # SLF001 @@ -89,8 +98,9 @@ error[SLF001]: SLF001.py:66:7: Private member accessed: `_private` 67 | print(foo()._private_thing) # SLF001 68 | print(foo()._private_thing__) # SLF001 | -error[SLF001]: SLF001.py:67:7: Private member accessed: `_private_thing` +error[SLF001]: 67:7: Private member accessed: `_private_thing` + --> SLF001.py:67:7 | 65 | print(foo.__really_private_func(1)) # SLF001 66 | print(foo.bar._private) # SLF001 @@ -98,8 +108,9 @@ error[SLF001]: SLF001.py:67:7: Private member accessed: `_private_thing` | ^^^^^^^^^^^^^^^^^^^^ 68 | print(foo()._private_thing__) # SLF001 | -error[SLF001]: SLF001.py:68:7: Private member accessed: `_private_thing__` +error[SLF001]: 68:7: Private member accessed: `_private_thing__` + --> SLF001.py:68:7 | 66 | print(foo.bar._private) # SLF001 67 | print(foo()._private_thing) # SLF001 diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM101_SIM101.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM101_SIM101.py.snap index 7fe5ffe88b..e717508124 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM101_SIM101.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM101_SIM101.py.snap @@ -1,14 +1,15 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -SIM101.py:1:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a single call +error[SIM101]: 1:4: [*] Multiple `isinstance` calls for `a`, merge into a single call + + --> SIM101.py:1:4 | 1 | if isinstance(a, int) or isinstance(a, float): # SIM101 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SIM101 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2 | pass | = help: Merge `isinstance` calls for `a` - ℹ Unsafe fix 1 |-if isinstance(a, int) or isinstance(a, float): # SIM101 1 |+if isinstance(a, (int, float)): # SIM101 @@ -16,16 +17,17 @@ SIM101.py:1:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a sing 3 3 | 4 4 | if isinstance(a, (int, float)) or isinstance(a, bool): # SIM101 -SIM101.py:4:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a single call +error[SIM101]: 4:4: [*] Multiple `isinstance` calls for `a`, merge into a single call + + --> SIM101.py:4:4 | 2 | pass 3 | 4 | if isinstance(a, (int, float)) or isinstance(a, bool): # SIM101 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SIM101 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 5 | pass | = help: Merge `isinstance` calls for `a` - ℹ Unsafe fix 1 1 | if isinstance(a, int) or isinstance(a, float): # SIM101 2 2 | pass @@ -36,16 +38,17 @@ SIM101.py:4:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a sing 6 6 | 7 7 | if isinstance(a, int) or isinstance(a, float) or isinstance(b, bool): # SIM101 -SIM101.py:7:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a single call +error[SIM101]: 7:4: [*] Multiple `isinstance` calls for `a`, merge into a single call + + --> SIM101.py:7:4 | 5 | pass 6 | 7 | if isinstance(a, int) or isinstance(a, float) or isinstance(b, bool): # SIM101 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SIM101 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 8 | pass | = help: Merge `isinstance` calls for `a` - ℹ Unsafe fix 4 4 | if isinstance(a, (int, float)) or isinstance(a, bool): # SIM101 5 5 | pass @@ -56,16 +59,17 @@ SIM101.py:7:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a sing 9 9 | 10 10 | if isinstance(b, bool) or isinstance(a, int) or isinstance(a, float): # SIM101 -SIM101.py:10:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a single call +error[SIM101]: 10:4: [*] Multiple `isinstance` calls for `a`, merge into a single call + + --> SIM101.py:10:4 | 8 | pass 9 | 10 | if isinstance(b, bool) or isinstance(a, int) or isinstance(a, float): # SIM101 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SIM101 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 11 | pass | = help: Merge `isinstance` calls for `a` - ℹ Unsafe fix 7 7 | if isinstance(a, int) or isinstance(a, float) or isinstance(b, bool): # SIM101 8 8 | pass @@ -76,16 +80,17 @@ SIM101.py:10:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a sin 12 12 | 13 13 | if isinstance(a, int) or isinstance(b, bool) or isinstance(a, float): # SIM101 -SIM101.py:16:5: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a single call +error[SIM101]: 16:5: [*] Multiple `isinstance` calls for `a`, merge into a single call + + --> SIM101.py:16:5 | 14 | pass 15 | 16 | if (isinstance(a, int) or isinstance(a, float)) and isinstance(b, bool): # SIM101 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SIM101 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 17 | pass | = help: Merge `isinstance` calls for `a` - ℹ Unsafe fix 13 13 | if isinstance(a, int) or isinstance(b, bool) or isinstance(a, float): # SIM101 14 14 | pass @@ -96,16 +101,17 @@ SIM101.py:16:5: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a sin 18 18 | 19 19 | if isinstance(a.b, int) or isinstance(a.b, float): # SIM101 -SIM101.py:19:4: SIM101 [*] Multiple `isinstance` calls for expression, merge into a single call +error[SIM101]: 19:4: [*] Multiple `isinstance` calls for expression, merge into a single call + + --> SIM101.py:19:4 | 17 | pass 18 | 19 | if isinstance(a.b, int) or isinstance(a.b, float): # SIM101 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SIM101 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 20 | pass | = help: Merge `isinstance` calls - ℹ Unsafe fix 16 16 | if (isinstance(a, int) or isinstance(a, float)) and isinstance(b, bool): # SIM101 17 17 | pass @@ -116,26 +122,28 @@ SIM101.py:19:4: SIM101 [*] Multiple `isinstance` calls for expression, merge int 21 21 | 22 22 | if isinstance(a(), int) or isinstance(a(), float): # SIM101 -SIM101.py:22:4: SIM101 Multiple `isinstance` calls for expression, merge into a single call +error[SIM101]: 22:4: Multiple `isinstance` calls for expression, merge into a single call + + --> SIM101.py:22:4 | 20 | pass 21 | 22 | if isinstance(a(), int) or isinstance(a(), float): # SIM101 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SIM101 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 23 | pass | = help: Merge `isinstance` calls +error[SIM101]: 38:4: [*] Multiple `isinstance` calls for `a`, merge into a single call -SIM101.py:38:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a single call + --> SIM101.py:38:4 | 36 | pass 37 | 38 | if x or isinstance(a, int) or isinstance(a, float): - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SIM101 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 39 | pass | = help: Merge `isinstance` calls for `a` - ℹ Unsafe fix 35 35 | if isinstance(a, int) or unrelated_condition or isinstance(a, float): 36 36 | pass @@ -146,16 +154,17 @@ SIM101.py:38:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a sin 40 40 | 41 41 | if x or y or isinstance(a, int) or isinstance(a, float) or z: -SIM101.py:41:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a single call +error[SIM101]: 41:4: [*] Multiple `isinstance` calls for `a`, merge into a single call + + --> SIM101.py:41:4 | 39 | pass 40 | 41 | if x or y or isinstance(a, int) or isinstance(a, float) or z: - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SIM101 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 42 | pass | = help: Merge `isinstance` calls for `a` - ℹ Unsafe fix 38 38 | if x or isinstance(a, int) or isinstance(a, float): 39 39 | pass @@ -166,15 +175,16 @@ SIM101.py:41:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a sin 43 43 | 44 44 | def f(): -SIM101.py:53:3: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a single call +error[SIM101]: 53:3: [*] Multiple `isinstance` calls for `a`, merge into a single call + + --> SIM101.py:53:3 | 52 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1722460483 53 | if(isinstance(a, int)) or (isinstance(a, float)): - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SIM101 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 54 | pass | = help: Merge `isinstance` calls for `a` - ℹ Unsafe fix 50 50 | pass 51 51 | diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM102_SIM102.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM102_SIM102.py.snap index aa88188bfd..ffca9c8454 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM102_SIM102.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM102_SIM102.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -error[SIM102]: SIM102.py:2:1: [*] Use a single `if` statement instead of nested `if` statements +error[SIM102]: 2:1: [*] Use a single `if` statement instead of nested `if` statements + --> SIM102.py:1:9 | 1 | # SIM102 2 | / if a: @@ -22,8 +23,9 @@ error[SIM102]: SIM102.py:2:1: [*] Use a single `if` statement instead of nested 6 5 | # SIM102 7 6 | if a: -error[SIM102]: SIM102.py:7:1: [*] Use a single `if` statement instead of nested `if` statements +error[SIM102]: 7:1: [*] Use a single `if` statement instead of nested `if` statements + --> SIM102.py:6:9 | 6 | # SIM102 7 | / if a: @@ -48,8 +50,9 @@ error[SIM102]: SIM102.py:7:1: [*] Use a single `if` statement instead of nested 12 11 | # SIM102 13 12 | if a: -error[SIM102]: SIM102.py:8:5: [*] Use a single `if` statement instead of nested `if` statements +error[SIM102]: 8:5: [*] Use a single `if` statement instead of nested `if` statements + --> SIM102.py:8:5 | 6 | # SIM102 7 | if a: @@ -73,8 +76,9 @@ error[SIM102]: SIM102.py:8:5: [*] Use a single `if` statement instead of nested 12 11 | # SIM102 13 12 | if a: -error[SIM102]: SIM102.py:15:1: [*] Use a single `if` statement instead of nested `if` statements +error[SIM102]: 15:1: [*] Use a single `if` statement instead of nested `if` statements + --> SIM102.py:14:9 | 13 | if a: 14 | pass @@ -97,8 +101,9 @@ error[SIM102]: SIM102.py:15:1: [*] Use a single `if` statement instead of nested 19 18 | # SIM102 20 19 | if a: -error[SIM102]: SIM102.py:20:1: Use a single `if` statement instead of nested `if` statements +error[SIM102]: 20:1: Use a single `if` statement instead of nested `if` statements + --> SIM102.py:19:9 | 19 | # SIM102 20 | / if a: @@ -108,8 +113,9 @@ error[SIM102]: SIM102.py:20:1: Use a single `if` statement instead of nested `if 23 | c | = help: Combine `if` statements using `and` -error[SIM102]: SIM102.py:26:1: [*] Use a single `if` statement instead of nested `if` statements +error[SIM102]: 26:1: [*] Use a single `if` statement instead of nested `if` statements + --> SIM102.py:25:9 | 25 | # SIM102 26 | / if a: @@ -134,8 +140,9 @@ error[SIM102]: SIM102.py:26:1: [*] Use a single `if` statement instead of nested 31 30 | # OK 32 31 | if a: -error[SIM102]: SIM102.py:51:5: [*] Use a single `if` statement instead of nested `if` statements +error[SIM102]: 51:5: [*] Use a single `if` statement instead of nested `if` statements + --> SIM102.py:51:5 | 49 | while x > 0: 50 | # SIM102 @@ -172,8 +179,9 @@ error[SIM102]: SIM102.py:51:5: [*] Use a single `if` statement instead of nested 64 63 | 65 64 | -error[SIM102]: SIM102.py:67:1: [*] Use a single `if` statement instead of nested `if` statements +error[SIM102]: 67:1: [*] Use a single `if` statement instead of nested `if` statements + --> SIM102.py:66:9 | 66 | # SIM102 67 | / if x > 0: @@ -208,8 +216,9 @@ error[SIM102]: SIM102.py:67:1: [*] Use a single `if` statement instead of nested 80 79 | 81 80 | while x > 0: -error[SIM102]: SIM102.py:83:5: [*] Use a single `if` statement instead of nested `if` statements +error[SIM102]: 83:5: [*] Use a single `if` statement instead of nested `if` statements + --> SIM102.py:83:5 | 81 | while x > 0: 82 | # SIM102 @@ -239,8 +248,9 @@ error[SIM102]: SIM102.py:83:5: [*] Use a single `if` statement instead of nested 89 88 | # SIM102 (auto-fixable) 90 89 | if node.module012345678: -error[SIM102]: SIM102.py:90:1: [*] Use a single `if` statement instead of nested `if` statements +error[SIM102]: 90:1: [*] Use a single `if` statement instead of nested `if` statements + --> SIM102.py:89:24 | 89 | # SIM102 (auto-fixable) 90 | / if node.module012345678: @@ -268,8 +278,9 @@ error[SIM102]: SIM102.py:90:1: [*] Use a single `if` statement instead of nested 96 95 | # SIM102 (not auto-fixable) 97 96 | if node.module0123456789: -error[SIM102]: SIM102.py:97:1: Use a single `if` statement instead of nested `if` statements +error[SIM102]: 97:1: Use a single `if` statement instead of nested `if` statements + --> SIM102.py:96:28 | 96 | # SIM102 (not auto-fixable) 97 | / if node.module0123456789: @@ -280,8 +291,9 @@ error[SIM102]: SIM102.py:97:1: Use a single `if` statement instead of nested `if 101 | print("Bad module!") | = help: Combine `if` statements using `and` -error[SIM102]: SIM102.py:106:5: [*] Use a single `if` statement instead of nested `if` statements +error[SIM102]: 106:5: [*] Use a single `if` statement instead of nested `if` statements + --> SIM102.py:106:5 | 104 | # Regression test for https://github.com/apache/airflow/blob/145b16caaa43f0c42bffd97344df916c602cddde/airflow/configuration.py#L1161 105 | if a: @@ -306,8 +318,9 @@ error[SIM102]: SIM102.py:106:5: [*] Use a single `if` statement instead of neste 110 109 | print("elif") 111 110 | -error[SIM102]: SIM102.py:132:5: [*] Use a single `if` statement instead of nested `if` statements +error[SIM102]: 132:5: [*] Use a single `if` statement instead of nested `if` statements + --> SIM102.py:132:5 | 130 | if a: 131 | # SIM 102 @@ -332,8 +345,9 @@ error[SIM102]: SIM102.py:132:5: [*] Use a single `if` statement instead of neste 136 135 | print("bar") 137 136 | -error[SIM102]: SIM102.py:165:5: [*] Use a single `if` statement instead of nested `if` statements +error[SIM102]: 165:5: [*] Use a single `if` statement instead of nested `if` statements + --> SIM102.py:165:5 | 163 | if a: 164 | pass diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM103_SIM103.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM103_SIM103.py.snap index 2fba247f61..7dc961aa93 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM103_SIM103.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM103_SIM103.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -error[SIM103]: SIM103.py:3:5: [*] Return the condition `bool(a)` directly +error[SIM103]: 3:5: [*] Return the condition `bool(a)` directly + --> SIM103.py:3:5 | 1 | def f(): 2 | # SIM103 @@ -26,8 +27,9 @@ error[SIM103]: SIM103.py:3:5: [*] Return the condition `bool(a)` directly 8 5 | 9 6 | def f(): -error[SIM103]: SIM103.py:11:5: [*] Return the condition `a == b` directly +error[SIM103]: 11:5: [*] Return the condition `a == b` directly + --> SIM103.py:11:5 | 9 | def f(): 10 | # SIM103 @@ -52,8 +54,9 @@ error[SIM103]: SIM103.py:11:5: [*] Return the condition `a == b` directly 16 13 | 17 14 | def f(): -error[SIM103]: SIM103.py:21:5: [*] Return the condition `bool(b)` directly +error[SIM103]: 21:5: [*] Return the condition `bool(b)` directly + --> SIM103.py:21:5 | 19 | if a: 20 | return 1 @@ -78,8 +81,9 @@ error[SIM103]: SIM103.py:21:5: [*] Return the condition `bool(b)` directly 26 23 | 27 24 | def f(): -error[SIM103]: SIM103.py:32:9: [*] Return the condition `bool(b)` directly +error[SIM103]: 32:9: [*] Return the condition `bool(b)` directly + --> SIM103.py:32:9 | 30 | return 1 31 | else: @@ -104,8 +108,9 @@ error[SIM103]: SIM103.py:32:9: [*] Return the condition `bool(b)` directly 37 34 | 38 35 | def f(): -error[SIM103]: SIM103.py:57:5: [*] Return the condition `not a` directly +error[SIM103]: 57:5: [*] Return the condition `not a` directly + --> SIM103.py:57:5 | 55 | def f(): 56 | # SIM103 @@ -130,8 +135,9 @@ error[SIM103]: SIM103.py:57:5: [*] Return the condition `not a` directly 62 59 | 63 60 | def f(): -error[SIM103]: SIM103.py:83:5: Return the condition directly +error[SIM103]: 83:5: Return the condition directly + --> SIM103.py:83:5 | 81 | def bool(): 82 | return False @@ -143,8 +149,9 @@ error[SIM103]: SIM103.py:83:5: Return the condition directly | |____________________^ | = help: Inline condition -error[SIM103]: SIM103.py:91:5: [*] Return the condition `not (keys is not None and notice.key not in keys)` directly +error[SIM103]: 91:5: [*] Return the condition `not (keys is not None and notice.key not in keys)` directly + --> SIM103.py:91:5 | 89 | def f(): 90 | # SIM103 @@ -169,7 +176,9 @@ error[SIM103]: SIM103.py:91:5: [*] Return the condition `not (keys is not None a 96 93 | 97 94 | ### -SIM103.py:104:5: SIM103 [*] Return the condition `bool(a)` directly +error[SIM103]: 104:5: [*] Return the condition `bool(a)` directly + + --> SIM103.py:104:5 | 102 | def f(): 103 | # SIM103 @@ -177,10 +186,9 @@ SIM103.py:104:5: SIM103 [*] Return the condition `bool(a)` directly | _____^ 105 | | return True 106 | | return False - | |________________^ SIM103 + | |________________^ | = help: Replace with `return bool(a)` - ℹ Unsafe fix 101 101 | 102 102 | def f(): @@ -193,7 +201,9 @@ SIM103.py:104:5: SIM103 [*] Return the condition `bool(a)` directly 108 106 | 109 107 | def f(): -SIM103.py:111:5: SIM103 [*] Return the condition `not a` directly +error[SIM103]: 111:5: [*] Return the condition `not a` directly + + --> SIM103.py:111:5 | 109 | def f(): 110 | # SIM103 @@ -201,10 +211,9 @@ SIM103.py:111:5: SIM103 [*] Return the condition `not a` directly | _____^ 112 | | return False 113 | | return True - | |_______________^ SIM103 + | |_______________^ | = help: Replace with `return not a` - ℹ Unsafe fix 108 108 | 109 109 | def f(): @@ -217,17 +226,18 @@ SIM103.py:111:5: SIM103 [*] Return the condition `not a` directly 115 113 | 116 114 | def f(): -SIM103.py:117:5: SIM103 [*] Return the condition `10 < a` directly +error[SIM103]: 117:5: [*] Return the condition `10 < a` directly + + --> SIM103.py:117:5 | 116 | def f(): 117 | if not 10 < a: | _____^ 118 | | return False 119 | | return True - | |_______________^ SIM103 + | |_______________^ | = help: Replace with `return 10 < a` - ℹ Unsafe fix 114 114 | 115 115 | @@ -240,17 +250,18 @@ SIM103.py:117:5: SIM103 [*] Return the condition `10 < a` directly 121 119 | 122 120 | def f(): -SIM103.py:123:5: SIM103 [*] Return the condition `not 10 < a` directly +error[SIM103]: 123:5: [*] Return the condition `not 10 < a` directly + + --> SIM103.py:123:5 | 122 | def f(): 123 | if 10 < a: | _____^ 124 | | return False 125 | | return True - | |_______________^ SIM103 + | |_______________^ | = help: Replace with `return not 10 < a` - ℹ Unsafe fix 120 120 | 121 121 | diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_0.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_0.py.snap index e322446781..ab4f0924eb 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_0.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_0.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -error[SIM105]: SIM105_0.py:6:1: [*] Use `contextlib.suppress(ValueError)` instead of `try`-`except`-`pass` +error[SIM105]: 6:1: [*] Use `contextlib.suppress(ValueError)` instead of `try`-`except`-`pass` + --> SIM105_0.py:5:9 | 5 | # SIM105 6 | / try: @@ -28,8 +29,9 @@ error[SIM105]: SIM105_0.py:6:1: [*] Use `contextlib.suppress(ValueError)` instea 11 10 | 12 11 | # SIM105 -error[SIM105]: SIM105_0.py:13:1: [*] Use `contextlib.suppress(ValueError, OSError)` instead of `try`-`except`-`pass` +error[SIM105]: 13:1: [*] Use `contextlib.suppress(ValueError, OSError)` instead of `try`-`except`-`pass` + --> SIM105_0.py:12:9 | 12 | # SIM105 13 | / try: @@ -59,8 +61,9 @@ error[SIM105]: SIM105_0.py:13:1: [*] Use `contextlib.suppress(ValueError, OSErro 18 17 | # SIM105 19 18 | try: -error[SIM105]: SIM105_0.py:19:1: [*] Use `contextlib.suppress(ValueError, OSError)` instead of `try`-`except`-`pass` +error[SIM105]: 19:1: [*] Use `contextlib.suppress(ValueError, OSError)` instead of `try`-`except`-`pass` + --> SIM105_0.py:18:9 | 18 | # SIM105 19 | / try: @@ -90,8 +93,9 @@ error[SIM105]: SIM105_0.py:19:1: [*] Use `contextlib.suppress(ValueError, OSErro 24 23 | # SIM105 25 24 | try: -error[SIM105]: SIM105_0.py:25:1: [*] Use `contextlib.suppress(Exception)` instead of `try`-`except`-`pass` +error[SIM105]: 25:1: [*] Use `contextlib.suppress(Exception)` instead of `try`-`except`-`pass` + --> SIM105_0.py:24:9 | 24 | # SIM105 25 | / try: @@ -121,8 +125,9 @@ error[SIM105]: SIM105_0.py:25:1: [*] Use `contextlib.suppress(Exception)` instea 30 29 | # SIM105 31 30 | try: -error[SIM105]: SIM105_0.py:31:1: [*] Use `contextlib.suppress(a.Error, b.Error)` instead of `try`-`except`-`pass` +error[SIM105]: 31:1: [*] Use `contextlib.suppress(a.Error, b.Error)` instead of `try`-`except`-`pass` + --> SIM105_0.py:30:9 | 30 | # SIM105 31 | / try: @@ -152,8 +157,9 @@ error[SIM105]: SIM105_0.py:31:1: [*] Use `contextlib.suppress(a.Error, b.Error)` 36 35 | # OK 37 36 | try: -error[SIM105]: SIM105_0.py:85:5: [*] Use `contextlib.suppress(ValueError)` instead of `try`-`except`-`pass` +error[SIM105]: 85:5: [*] Use `contextlib.suppress(ValueError)` instead of `try`-`except`-`pass` + --> SIM105_0.py:85:5 | 83 | def with_ellipsis(): 84 | # OK @@ -183,8 +189,9 @@ error[SIM105]: SIM105_0.py:85:5: [*] Use `contextlib.suppress(ValueError)` inste 90 89 | 91 90 | def with_ellipsis_and_return(): -error[SIM105]: SIM105_0.py:100:5: Use `contextlib.suppress(ValueError, OSError)` instead of `try`-`except`-`pass` +error[SIM105]: 100:5: Use `contextlib.suppress(ValueError, OSError)` instead of `try`-`except`-`pass` + --> SIM105_0.py:100:5 | 99 | def with_comment(): 100 | try: @@ -197,8 +204,9 @@ error[SIM105]: SIM105_0.py:100:5: Use `contextlib.suppress(ValueError, OSError)` 105 | try: | = help: Replace with `contextlib.suppress(ValueError, OSError)` -error[SIM105]: SIM105_0.py:117:5: [*] Use `contextlib.suppress(OSError)` instead of `try`-`except`-`pass` +error[SIM105]: 117:5: [*] Use `contextlib.suppress(OSError)` instead of `try`-`except`-`pass` + --> SIM105_0.py:117:5 | 115 | # Regression test for: https://github.com/astral-sh/ruff/issues/7123 116 | def write_models(directory, Models): @@ -230,8 +238,9 @@ error[SIM105]: SIM105_0.py:117:5: [*] Use `contextlib.suppress(OSError)` instead 122 121 | try: os.makedirs(model_dir); 123 122 | except OSError: -error[SIM105]: SIM105_0.py:122:5: [*] Use `contextlib.suppress(OSError)` instead of `try`-`except`-`pass` +error[SIM105]: 122:5: [*] Use `contextlib.suppress(OSError)` instead of `try`-`except`-`pass` + --> SIM105_0.py:122:5 | 120 | pass; 121 | @@ -261,8 +270,9 @@ error[SIM105]: SIM105_0.py:122:5: [*] Use `contextlib.suppress(OSError)` instead 126 125 | try: os.makedirs(model_dir); 127 126 | except OSError: -error[SIM105]: SIM105_0.py:126:5: [*] Use `contextlib.suppress(OSError)` instead of `try`-`except`-`pass` +error[SIM105]: 126:5: [*] Use `contextlib.suppress(OSError)` instead of `try`-`except`-`pass` + --> SIM105_0.py:126:5 | 124 | pass; 125 | diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_1.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_1.py.snap index 60dab09fe8..fba50bdbfd 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_1.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_1.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -error[SIM105]: SIM105_1.py:5:1: [*] Use `contextlib.suppress(ValueError)` instead of `try`-`except`-`pass` +error[SIM105]: 5:1: [*] Use `contextlib.suppress(ValueError)` instead of `try`-`except`-`pass` + --> SIM105_1.py:4:9 | 4 | # SIM105 5 | / try: diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_2.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_2.py.snap index 4afff94010..8109079ca8 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_2.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_2.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -error[SIM105]: SIM105_2.py:10:1: [*] Use `contextlib.suppress(ValueError)` instead of `try`-`except`-`pass` +error[SIM105]: 10:1: [*] Use `contextlib.suppress(ValueError)` instead of `try`-`except`-`pass` + --> SIM105_2.py:9:9 | 9 | # SIM105 10 | / try: diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_3.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_3.py.snap index 66cbb3bbdc..51837b0113 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_3.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_3.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -error[SIM105]: SIM105_3.py:10:5: Use `contextlib.suppress(ValueError)` instead of `try`-`except`-`pass` +error[SIM105]: 10:5: Use `contextlib.suppress(ValueError)` instead of `try`-`except`-`pass` + --> SIM105_3.py:10:5 | 8 | def bar(): 9 | # SIM105 diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_4.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_4.py.snap index 58b59e9a2a..03eb34e598 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_4.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_4.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -error[SIM105]: SIM105_4.py:2:1: [*] Use `contextlib.suppress(ImportError)` instead of `try`-`except`-`pass` +error[SIM105]: 2:1: [*] Use `contextlib.suppress(ImportError)` instead of `try`-`except`-`pass` + --> SIM105_4.py:1:23 | 1 | #!/usr/bin/env python 2 | / try: diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM107_SIM107.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM107_SIM107.py.snap index a9ee8447ab..a7884b1f00 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM107_SIM107.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM107_SIM107.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -error[SIM107]: SIM107.py:9:9: Don't use `return` in `try`-`except` and `finally` +error[SIM107]: 9:9: Don't use `return` in `try`-`except` and `finally` + --> SIM107.py:9:9 | 7 | return "2" 8 | finally: diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM108_SIM108.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM108_SIM108.py.snap index 12e9c96372..1db51f9b01 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM108_SIM108.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM108_SIM108.py.snap @@ -1,19 +1,20 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -SIM108.py:2:1: SIM108 [*] Use ternary operator `b = c if a else d` instead of `if`-`else`-block +error[SIM108]: 2:1: [*] Use ternary operator `b = c if a else d` instead of `if`-`else`-block + + --> SIM108.py:1:9 | 1 | # SIM108 2 | / if a: 3 | | b = c 4 | | else: 5 | | b = d - | |_________^ SIM108 + | |_________^ 6 | 7 | # OK | = help: Replace `if`-`else`-block with `b = c if a else d` - ℹ Unsafe fix 1 1 | # SIM108 2 |-if a: @@ -25,7 +26,9 @@ SIM108.py:2:1: SIM108 [*] Use ternary operator `b = c if a else d` instead of `i 7 4 | # OK 8 5 | b = c if a else d -SIM108.py:30:5: SIM108 [*] Use ternary operator `b = 1 if a else 2` instead of `if`-`else`-block +error[SIM108]: 30:5: [*] Use ternary operator `b = 1 if a else 2` instead of `if`-`else`-block + + --> SIM108.py:30:5 | 28 | pass 29 | else: @@ -34,10 +37,9 @@ SIM108.py:30:5: SIM108 [*] Use ternary operator `b = 1 if a else 2` instead of ` 31 | | b = 1 32 | | else: 33 | | b = 2 - | |_____________^ SIM108 + | |_____________^ | = help: Replace `if`-`else`-block with `b = 1 if a else 2` - ℹ Unsafe fix 27 27 | if True: 28 28 | pass @@ -51,7 +53,9 @@ SIM108.py:30:5: SIM108 [*] Use ternary operator `b = 1 if a else 2` instead of ` 35 32 | 36 33 | import sys -SIM108.py:58:1: SIM108 Use ternary operator `abc = x if x > 0 else -x` instead of `if`-`else`-block +error[SIM108]: 58:1: Use ternary operator `abc = x if x > 0 else -x` instead of `if`-`else`-block + + --> SIM108.py:57:39 | 57 | # SIM108 (without fix due to comments) 58 | / if x > 0: @@ -60,21 +64,21 @@ SIM108.py:58:1: SIM108 Use ternary operator `abc = x if x > 0 else -x` instead o 61 | | else: 62 | | # test test test 63 | | abc = -x - | |____________^ SIM108 + | |____________^ | = help: Replace `if`-`else`-block with `abc = x if x > 0 else -x` +error[SIM108]: 82:1: [*] Use ternary operator `b = "cccccccccccccccccccccccccccccccccß" if a else "ddddddddddddddddddddddddddddddddd💣"` instead of `if`-`else`-block -SIM108.py:82:1: SIM108 [*] Use ternary operator `b = "cccccccccccccccccccccccccccccccccß" if a else "ddddddddddddddddddddddddddddddddd💣"` instead of `if`-`else`-block + --> SIM108.py:81:9 | 81 | # SIM108 82 | / if a: 83 | | b = "cccccccccccccccccccccccccccccccccß" 84 | | else: 85 | | b = "ddddddddddddddddddddddddddddddddd💣" - | |_____________________________________________^ SIM108 + | |_____________________________________________^ | = help: Replace `if`-`else`-block with `b = "cccccccccccccccccccccccccccccccccß" if a else "ddddddddddddddddddddddddddddddddd💣"` - ℹ Unsafe fix 79 79 | 80 80 | @@ -88,38 +92,43 @@ SIM108.py:82:1: SIM108 [*] Use ternary operator `b = "cccccccccccccccccccccccccc 87 84 | 88 85 | # OK (too long) -SIM108.py:105:1: SIM108 Use ternary operator `exitcode = 0 if True else 1` instead of `if`-`else`-block +error[SIM108]: 105:1: Use ternary operator `exitcode = 0 if True else 1` instead of `if`-`else`-block + + --> SIM108.py:104:47 | 104 | # SIM108 (without fix due to trailing comment) 105 | / if True: 106 | | exitcode = 0 107 | | else: 108 | | exitcode = 1 # Trailing comment - | |________________^ SIM108 + | |________________^ | = help: Replace `if`-`else`-block with `exitcode = 0 if True else 1` +error[SIM108]: 112:1: Use ternary operator `x = 3 if True else 5` instead of `if`-`else`-block -SIM108.py:112:1: SIM108 Use ternary operator `x = 3 if True else 5` instead of `if`-`else`-block + --> SIM108.py:111:9 | 111 | # SIM108 112 | / if True: x = 3 # Foo 113 | | else: x = 5 - | |___________^ SIM108 + | |___________^ | = help: Replace `if`-`else`-block with `x = 3 if True else 5` +error[SIM108]: 117:1: Use ternary operator `x = 3 if True else 5` instead of `if`-`else`-block -SIM108.py:117:1: SIM108 Use ternary operator `x = 3 if True else 5` instead of `if`-`else`-block + --> SIM108.py:116:9 | 116 | # SIM108 117 | / if True: # Foo 118 | | x = 3 119 | | else: 120 | | x = 5 - | |_________^ SIM108 + | |_________^ | = help: Replace `if`-`else`-block with `x = 3 if True else 5` +error[SIM108]: 141:1: [*] Use ternary operator `z = cond if cond else other_cond` instead of `if`-`else`-block -SIM108.py:141:1: SIM108 [*] Use ternary operator `z = cond if cond else other_cond` instead of `if`-`else`-block + --> SIM108.py:140:25 | 139 | # SIM108 - should suggest 140 | # z = cond or other_cond @@ -127,12 +136,11 @@ SIM108.py:141:1: SIM108 [*] Use ternary operator `z = cond if cond else other_co 142 | | z = cond 143 | | else: 144 | | z = other_cond - | |__________________^ SIM108 + | |__________________^ 145 | 146 | # SIM108 - should suggest | = help: Replace `if`-`else`-block with `z = cond if cond else other_cond` - ℹ Unsafe fix 138 138 | 139 139 | # SIM108 - should suggest @@ -146,7 +154,9 @@ SIM108.py:141:1: SIM108 [*] Use ternary operator `z = cond if cond else other_co 146 143 | # SIM108 - should suggest 147 144 | # z = cond and other_cond -SIM108.py:148:1: SIM108 [*] Use ternary operator `z = cond if not cond else other_cond` instead of `if`-`else`-block +error[SIM108]: 148:1: [*] Use ternary operator `z = cond if not cond else other_cond` instead of `if`-`else`-block + + --> SIM108.py:147:26 | 146 | # SIM108 - should suggest 147 | # z = cond and other_cond @@ -154,12 +164,11 @@ SIM108.py:148:1: SIM108 [*] Use ternary operator `z = cond if not cond else othe 149 | | z = cond 150 | | else: 151 | | z = other_cond - | |__________________^ SIM108 + | |__________________^ 152 | 153 | # SIM108 - should suggest | = help: Replace `if`-`else`-block with `z = cond if not cond else other_cond` - ℹ Unsafe fix 145 145 | 146 146 | # SIM108 - should suggest @@ -173,7 +182,9 @@ SIM108.py:148:1: SIM108 [*] Use ternary operator `z = cond if not cond else othe 153 150 | # SIM108 - should suggest 154 151 | # z = not cond and other_cond -SIM108.py:155:1: SIM108 [*] Use ternary operator `z = not cond if cond else other_cond` instead of `if`-`else`-block +error[SIM108]: 155:1: [*] Use ternary operator `z = not cond if cond else other_cond` instead of `if`-`else`-block + + --> SIM108.py:154:30 | 153 | # SIM108 - should suggest 154 | # z = not cond and other_cond @@ -181,12 +192,11 @@ SIM108.py:155:1: SIM108 [*] Use ternary operator `z = not cond if cond else othe 156 | | z = not cond 157 | | else: 158 | | z = other_cond - | |__________________^ SIM108 + | |__________________^ 159 | 160 | # SIM108 does not suggest | = help: Replace `if`-`else`-block with `z = not cond if cond else other_cond` - ℹ Unsafe fix 152 152 | 153 153 | # SIM108 - should suggest @@ -200,7 +210,9 @@ SIM108.py:155:1: SIM108 [*] Use ternary operator `z = not cond if cond else othe 160 157 | # SIM108 does not suggest 161 158 | # a binary option in these cases, -SIM108.py:167:1: SIM108 [*] Use ternary operator `z = 1 if True else other` instead of `if`-`else`-block +error[SIM108]: 167:1: [*] Use ternary operator `z = 1 if True else other` instead of `if`-`else`-block + + --> SIM108.py:166:45 | 165 | # (Of course, these specific expressions 166 | # should be simplified for other reasons...) @@ -208,12 +220,11 @@ SIM108.py:167:1: SIM108 [*] Use ternary operator `z = 1 if True else other` inst 168 | | z = 1 169 | | else: 170 | | z = other - | |_____________^ SIM108 + | |_____________^ 171 | 172 | if False: | = help: Replace `if`-`else`-block with `z = 1 if True else other` - ℹ Unsafe fix 164 164 | # so, e.g. `True == 1`. 165 165 | # (Of course, these specific expressions @@ -227,7 +238,9 @@ SIM108.py:167:1: SIM108 [*] Use ternary operator `z = 1 if True else other` inst 172 169 | if False: 173 170 | z = 1 -SIM108.py:177:1: SIM108 [*] Use ternary operator `z = True if 1 else other` instead of `if`-`else`-block +error[SIM108]: 177:1: [*] Use ternary operator `z = True if 1 else other` instead of `if`-`else`-block + + --> SIM108.py:176:1 | 175 | z = other 176 | @@ -235,12 +248,11 @@ SIM108.py:177:1: SIM108 [*] Use ternary operator `z = True if 1 else other` inst 178 | | z = True 179 | | else: 180 | | z = other - | |_____________^ SIM108 + | |_____________^ 181 | 182 | # SIM108 does not suggest a binary option in this | = help: Replace `if`-`else`-block with `z = True if 1 else other` - ℹ Unsafe fix 174 174 | else: 175 175 | z = other @@ -254,7 +266,9 @@ SIM108.py:177:1: SIM108 [*] Use ternary operator `z = True if 1 else other` inst 182 179 | # SIM108 does not suggest a binary option in this 183 180 | # case, since we'd be reducing the number of calls -SIM108.py:185:1: SIM108 [*] Use ternary operator `z = foo() if foo() else other` instead of `if`-`else`-block +error[SIM108]: 185:1: [*] Use ternary operator `z = foo() if foo() else other` instead of `if`-`else`-block + + --> SIM108.py:184:19 | 183 | # case, since we'd be reducing the number of calls 184 | # from Two to one. @@ -262,12 +276,11 @@ SIM108.py:185:1: SIM108 [*] Use ternary operator `z = foo() if foo() else other` 186 | | z = foo() 187 | | else: 188 | | z = other - | |_____________^ SIM108 + | |_____________^ 189 | 190 | # SIM108 does not suggest a binary option in this | = help: Replace `if`-`else`-block with `z = foo() if foo() else other` - ℹ Unsafe fix 182 182 | # SIM108 does not suggest a binary option in this 183 183 | # case, since we'd be reducing the number of calls @@ -281,7 +294,9 @@ SIM108.py:185:1: SIM108 [*] Use ternary operator `z = foo() if foo() else other` 190 187 | # SIM108 does not suggest a binary option in this 191 188 | # case, since we'd be reducing the number of calls -SIM108.py:193:1: SIM108 [*] Use ternary operator `z = not foo() if foo() else other` instead of `if`-`else`-block +error[SIM108]: 193:1: [*] Use ternary operator `z = not foo() if foo() else other` instead of `if`-`else`-block + + --> SIM108.py:192:19 | 191 | # case, since we'd be reducing the number of calls 192 | # from Two to one. @@ -289,10 +304,9 @@ SIM108.py:193:1: SIM108 [*] Use ternary operator `z = not foo() if foo() else ot 194 | | z = not foo() 195 | | else: 196 | | z = other - | |_____________^ SIM108 + | |_____________^ | = help: Replace `if`-`else`-block with `z = not foo() if foo() else other` - ℹ Unsafe fix 190 190 | # SIM108 does not suggest a binary option in this 191 191 | # case, since we'd be reducing the number of calls diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM109_SIM109.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM109_SIM109.py.snap index e5897ac570..bdf8cec8a2 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM109_SIM109.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM109_SIM109.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -error[SIM109]: SIM109.py:2:4: [*] Use `a in (b, c)` instead of multiple equality comparisons +error[SIM109]: 2:4: [*] Use `a in (b, c)` instead of multiple equality comparisons + --> SIM109.py:2:4 | 1 | # SIM109 2 | if a == b or a == c: @@ -18,8 +19,9 @@ error[SIM109]: SIM109.py:2:4: [*] Use `a in (b, c)` instead of multiple equality 4 4 | 5 5 | # SIM109 -error[SIM109]: SIM109.py:6:5: [*] Use `a in (b, c)` instead of multiple equality comparisons +error[SIM109]: 6:5: [*] Use `a in (b, c)` instead of multiple equality comparisons + --> SIM109.py:6:5 | 5 | # SIM109 6 | if (a == b or a == c) and None: @@ -37,8 +39,9 @@ error[SIM109]: SIM109.py:6:5: [*] Use `a in (b, c)` instead of multiple equality 8 8 | 9 9 | # SIM109 -error[SIM109]: SIM109.py:10:4: [*] Use `a in (b, c)` instead of multiple equality comparisons +error[SIM109]: 10:4: [*] Use `a in (b, c)` instead of multiple equality comparisons + --> SIM109.py:10:4 | 9 | # SIM109 10 | if a == b or a == c or None: @@ -56,8 +59,9 @@ error[SIM109]: SIM109.py:10:4: [*] Use `a in (b, c)` instead of multiple equalit 12 12 | 13 13 | # SIM109 -error[SIM109]: SIM109.py:14:4: [*] Use `a in (b, c)` instead of multiple equality comparisons +error[SIM109]: 14:4: [*] Use `a in (b, c)` instead of multiple equality comparisons + --> SIM109.py:14:4 | 13 | # SIM109 14 | if a == b or None or a == c: diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM110_SIM110.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM110_SIM110.py.snap index 84e7597b2b..d1bc198417 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM110_SIM110.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM110_SIM110.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -error[SIM110]: SIM110.py:3:5: [*] Use `return any(check(x) for x in iterable)` instead of `for` loop +error[SIM110]: 3:5: [*] Use `return any(check(x) for x in iterable)` instead of `for` loop + --> SIM110.py:3:5 | 1 | def f(): 2 | # SIM110 @@ -26,8 +27,9 @@ error[SIM110]: SIM110.py:3:5: [*] Use `return any(check(x) for x in iterable)` i 8 5 | 9 6 | def f(): -error[SIM110]: SIM110.py:25:5: [*] Use `return all(not check(x) for x in iterable)` instead of `for` loop +error[SIM110]: 25:5: [*] Use `return all(not check(x) for x in iterable)` instead of `for` loop + --> SIM110.py:25:5 | 23 | def f(): 24 | # SIM111 @@ -52,8 +54,9 @@ error[SIM110]: SIM110.py:25:5: [*] Use `return all(not check(x) for x in iterabl 30 27 | 31 28 | def f(): -error[SIM110]: SIM110.py:33:5: [*] Use `return all(x.is_empty() for x in iterable)` instead of `for` loop +error[SIM110]: 33:5: [*] Use `return all(x.is_empty() for x in iterable)` instead of `for` loop + --> SIM110.py:33:5 | 31 | def f(): 32 | # SIM111 @@ -78,8 +81,9 @@ error[SIM110]: SIM110.py:33:5: [*] Use `return all(x.is_empty() for x in iterabl 38 35 | 39 36 | def f(): -error[SIM110]: SIM110.py:55:5: [*] Use `return any(check(x) for x in iterable)` instead of `for` loop +error[SIM110]: 55:5: [*] Use `return any(check(x) for x in iterable)` instead of `for` loop + --> SIM110.py:55:5 | 53 | def f(): 54 | # SIM110 @@ -106,8 +110,9 @@ error[SIM110]: SIM110.py:55:5: [*] Use `return any(check(x) for x in iterable)` 61 57 | 62 58 | def f(): -error[SIM110]: SIM110.py:64:5: [*] Use `return all(not check(x) for x in iterable)` instead of `for` loop +error[SIM110]: 64:5: [*] Use `return all(not check(x) for x in iterable)` instead of `for` loop + --> SIM110.py:64:5 | 62 | def f(): 63 | # SIM111 @@ -134,8 +139,9 @@ error[SIM110]: SIM110.py:64:5: [*] Use `return all(not check(x) for x in iterabl 70 66 | 71 67 | def f(): -error[SIM110]: SIM110.py:73:5: [*] Use `return any(check(x) for x in iterable)` instead of `for` loop +error[SIM110]: 73:5: [*] Use `return any(check(x) for x in iterable)` instead of `for` loop + --> SIM110.py:73:5 | 71 | def f(): 72 | # SIM110 @@ -163,8 +169,9 @@ error[SIM110]: SIM110.py:73:5: [*] Use `return any(check(x) for x in iterable)` 79 75 | 80 76 | -error[SIM110]: SIM110.py:83:5: [*] Use `return all(not check(x) for x in iterable)` instead of `for` loop +error[SIM110]: 83:5: [*] Use `return all(not check(x) for x in iterable)` instead of `for` loop + --> SIM110.py:83:5 | 81 | def f(): 82 | # SIM111 @@ -192,8 +199,9 @@ error[SIM110]: SIM110.py:83:5: [*] Use `return all(not check(x) for x in iterabl 89 85 | 90 86 | -error[SIM110]: SIM110.py:124:5: Use `return any(check(x) for x in iterable)` instead of `for` loop +error[SIM110]: 124:5: Use `return any(check(x) for x in iterable)` instead of `for` loop + --> SIM110.py:124:5 | 122 | pass 123 | @@ -205,8 +213,9 @@ error[SIM110]: SIM110.py:124:5: Use `return any(check(x) for x in iterable)` ins | |________________^ | = help: Replace with `return any(check(x) for x in iterable)` -error[SIM110]: SIM110.py:134:5: Use `return all(not check(x) for x in iterable)` instead of `for` loop +error[SIM110]: 134:5: Use `return all(not check(x) for x in iterable)` instead of `for` loop + --> SIM110.py:134:5 | 132 | pass 133 | @@ -218,8 +227,9 @@ error[SIM110]: SIM110.py:134:5: Use `return all(not check(x) for x in iterable)` | |_______________^ | = help: Replace with `return all(not check(x) for x in iterable)` -error[SIM110]: SIM110.py:144:5: [*] Use `return any(check(x) for x in iterable)` instead of `for` loop +error[SIM110]: 144:5: [*] Use `return any(check(x) for x in iterable)` instead of `for` loop + --> SIM110.py:144:5 | 143 | # SIM110 144 | for x in iterable: @@ -243,8 +253,9 @@ error[SIM110]: SIM110.py:144:5: [*] Use `return any(check(x) for x in iterable)` 149 146 | 150 147 | def f(): -error[SIM110]: SIM110.py:154:5: [*] Use `return all(not check(x) for x in iterable)` instead of `for` loop +error[SIM110]: 154:5: [*] Use `return all(not check(x) for x in iterable)` instead of `for` loop + --> SIM110.py:154:5 | 153 | # SIM111 154 | for x in iterable: @@ -268,8 +279,9 @@ error[SIM110]: SIM110.py:154:5: [*] Use `return all(not check(x) for x in iterab 159 156 | 160 157 | def f(): -error[SIM110]: SIM110.py:162:5: [*] Use `return any(x.isdigit() for x in "012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ")` instead of `for` loop +error[SIM110]: 162:5: [*] Use `return any(x.isdigit() for x in "012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ")` instead of `for` loop + --> SIM110.py:162:5 | 160 | def f(): 161 | # SIM110 @@ -294,8 +306,9 @@ error[SIM110]: SIM110.py:162:5: [*] Use `return any(x.isdigit() for x in "012ß9 167 164 | 168 165 | def f(): -error[SIM110]: SIM110.py:184:5: [*] Use `return any(check(x) for x in iterable)` instead of `for` loop +error[SIM110]: 184:5: [*] Use `return any(check(x) for x in iterable)` instead of `for` loop + --> SIM110.py:184:5 | 182 | async def f(): 183 | # SIM110 @@ -322,8 +335,9 @@ error[SIM110]: SIM110.py:184:5: [*] Use `return any(check(x) for x in iterable)` 189 186 | async def f(): 190 187 | # SIM110 -error[SIM110]: SIM110.py:191:5: [*] Use `return any(check(x) for x in await iterable)` instead of `for` loop +error[SIM110]: 191:5: [*] Use `return any(check(x) for x in await iterable)` instead of `for` loop + --> SIM110.py:191:5 | 189 | async def f(): 190 | # SIM110 diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM110_SIM111.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM110_SIM111.py.snap index c6f3b89d3f..a086909459 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM110_SIM111.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM110_SIM111.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -error[SIM110]: SIM111.py:3:5: [*] Use `return any(check(x) for x in iterable)` instead of `for` loop +error[SIM110]: 3:5: [*] Use `return any(check(x) for x in iterable)` instead of `for` loop + --> SIM111.py:3:5 | 1 | def f(): 2 | # SIM110 @@ -26,8 +27,9 @@ error[SIM110]: SIM111.py:3:5: [*] Use `return any(check(x) for x in iterable)` i 8 5 | 9 6 | def f(): -error[SIM110]: SIM111.py:25:5: [*] Use `return all(not check(x) for x in iterable)` instead of `for` loop +error[SIM110]: 25:5: [*] Use `return all(not check(x) for x in iterable)` instead of `for` loop + --> SIM111.py:25:5 | 23 | def f(): 24 | # SIM111 @@ -52,8 +54,9 @@ error[SIM110]: SIM111.py:25:5: [*] Use `return all(not check(x) for x in iterabl 30 27 | 31 28 | def f(): -error[SIM110]: SIM111.py:33:5: [*] Use `return all(x.is_empty() for x in iterable)` instead of `for` loop +error[SIM110]: 33:5: [*] Use `return all(x.is_empty() for x in iterable)` instead of `for` loop + --> SIM111.py:33:5 | 31 | def f(): 32 | # SIM111 @@ -78,8 +81,9 @@ error[SIM110]: SIM111.py:33:5: [*] Use `return all(x.is_empty() for x in iterabl 38 35 | 39 36 | def f(): -error[SIM110]: SIM111.py:55:5: [*] Use `return any(check(x) for x in iterable)` instead of `for` loop +error[SIM110]: 55:5: [*] Use `return any(check(x) for x in iterable)` instead of `for` loop + --> SIM111.py:55:5 | 53 | def f(): 54 | # SIM110 @@ -106,8 +110,9 @@ error[SIM110]: SIM111.py:55:5: [*] Use `return any(check(x) for x in iterable)` 61 57 | 62 58 | def f(): -error[SIM110]: SIM111.py:64:5: [*] Use `return all(not check(x) for x in iterable)` instead of `for` loop +error[SIM110]: 64:5: [*] Use `return all(not check(x) for x in iterable)` instead of `for` loop + --> SIM111.py:64:5 | 62 | def f(): 63 | # SIM111 @@ -134,8 +139,9 @@ error[SIM110]: SIM111.py:64:5: [*] Use `return all(not check(x) for x in iterabl 70 66 | 71 67 | def f(): -error[SIM110]: SIM111.py:73:5: [*] Use `return any(check(x) for x in iterable)` instead of `for` loop +error[SIM110]: 73:5: [*] Use `return any(check(x) for x in iterable)` instead of `for` loop + --> SIM111.py:73:5 | 71 | def f(): 72 | # SIM110 @@ -163,8 +169,9 @@ error[SIM110]: SIM111.py:73:5: [*] Use `return any(check(x) for x in iterable)` 79 75 | 80 76 | -error[SIM110]: SIM111.py:83:5: [*] Use `return all(not check(x) for x in iterable)` instead of `for` loop +error[SIM110]: 83:5: [*] Use `return all(not check(x) for x in iterable)` instead of `for` loop + --> SIM111.py:83:5 | 81 | def f(): 82 | # SIM111 @@ -192,8 +199,9 @@ error[SIM110]: SIM111.py:83:5: [*] Use `return all(not check(x) for x in iterabl 89 85 | 90 86 | -error[SIM110]: SIM111.py:124:5: Use `return any(check(x) for x in iterable)` instead of `for` loop +error[SIM110]: 124:5: Use `return any(check(x) for x in iterable)` instead of `for` loop + --> SIM111.py:124:5 | 122 | pass 123 | @@ -205,8 +213,9 @@ error[SIM110]: SIM111.py:124:5: Use `return any(check(x) for x in iterable)` ins | |________________^ | = help: Replace with `return any(check(x) for x in iterable)` -error[SIM110]: SIM111.py:134:5: Use `return all(not check(x) for x in iterable)` instead of `for` loop +error[SIM110]: 134:5: Use `return all(not check(x) for x in iterable)` instead of `for` loop + --> SIM111.py:134:5 | 132 | pass 133 | @@ -218,8 +227,9 @@ error[SIM110]: SIM111.py:134:5: Use `return all(not check(x) for x in iterable)` | |_______________^ | = help: Replace with `return all(not check(x) for x in iterable)` -error[SIM110]: SIM111.py:144:5: [*] Use `return any(check(x) for x in iterable)` instead of `for` loop +error[SIM110]: 144:5: [*] Use `return any(check(x) for x in iterable)` instead of `for` loop + --> SIM111.py:144:5 | 143 | # SIM110 144 | for x in iterable: @@ -243,8 +253,9 @@ error[SIM110]: SIM111.py:144:5: [*] Use `return any(check(x) for x in iterable)` 149 146 | 150 147 | def f(): -error[SIM110]: SIM111.py:154:5: [*] Use `return all(not check(x) for x in iterable)` instead of `for` loop +error[SIM110]: 154:5: [*] Use `return all(not check(x) for x in iterable)` instead of `for` loop + --> SIM111.py:154:5 | 153 | # SIM111 154 | for x in iterable: @@ -268,8 +279,9 @@ error[SIM110]: SIM111.py:154:5: [*] Use `return all(not check(x) for x in iterab 159 156 | 160 157 | def f(): -error[SIM110]: SIM111.py:162:5: [*] Use `return all(x in y for x in iterable)` instead of `for` loop +error[SIM110]: 162:5: [*] Use `return all(x in y for x in iterable)` instead of `for` loop + --> SIM111.py:162:5 | 160 | def f(): 161 | # SIM111 @@ -294,8 +306,9 @@ error[SIM110]: SIM111.py:162:5: [*] Use `return all(x in y for x in iterable)` i 167 164 | 168 165 | def f(): -error[SIM110]: SIM111.py:170:5: [*] Use `return all(x <= y for x in iterable)` instead of `for` loop +error[SIM110]: 170:5: [*] Use `return all(x <= y for x in iterable)` instead of `for` loop + --> SIM111.py:170:5 | 168 | def f(): 169 | # SIM111 @@ -320,8 +333,9 @@ error[SIM110]: SIM111.py:170:5: [*] Use `return all(x <= y for x in iterable)` i 175 172 | 176 173 | def f(): -error[SIM110]: SIM111.py:178:5: [*] Use `return all(not x.isdigit() for x in "012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9")` instead of `for` loop +error[SIM110]: 178:5: [*] Use `return all(not x.isdigit() for x in "012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9")` instead of `for` loop + --> SIM111.py:178:5 | 176 | def f(): 177 | # SIM111 diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM112_SIM112.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM112_SIM112.py.snap index 86b9616663..427b91cd46 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM112_SIM112.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM112_SIM112.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -error[SIM112]: SIM112.py:4:12: [*] Use capitalized environment variable `FOO` instead of `foo` +error[SIM112]: 4:12: [*] Use capitalized environment variable `FOO` instead of `foo` + --> SIM112.py:4:12 | 3 | # Bad 4 | os.environ['foo'] @@ -21,8 +22,9 @@ error[SIM112]: SIM112.py:4:12: [*] Use capitalized environment variable `FOO` in 6 6 | os.environ.get('foo') 7 7 | -error[SIM112]: SIM112.py:6:16: Use capitalized environment variable `FOO` instead of `foo` +error[SIM112]: 6:16: Use capitalized environment variable `FOO` instead of `foo` + --> SIM112.py:6:16 | 4 | os.environ['foo'] 5 | @@ -32,8 +34,9 @@ error[SIM112]: SIM112.py:6:16: Use capitalized environment variable `FOO` instea 8 | os.environ.get('foo', 'bar') | = help: Replace `foo` with `FOO` -error[SIM112]: SIM112.py:8:16: Use capitalized environment variable `FOO` instead of `foo` +error[SIM112]: 8:16: Use capitalized environment variable `FOO` instead of `foo` + --> SIM112.py:8:16 | 6 | os.environ.get('foo') 7 | @@ -43,8 +46,9 @@ error[SIM112]: SIM112.py:8:16: Use capitalized environment variable `FOO` instea 10 | os.getenv('foo') | = help: Replace `foo` with `FOO` -error[SIM112]: SIM112.py:10:11: Use capitalized environment variable `FOO` instead of `foo` +error[SIM112]: 10:11: Use capitalized environment variable `FOO` instead of `foo` + --> SIM112.py:10:11 | 8 | os.environ.get('foo', 'bar') 9 | @@ -54,8 +58,9 @@ error[SIM112]: SIM112.py:10:11: Use capitalized environment variable `FOO` inste 12 | env = os.environ.get('foo') | = help: Replace `foo` with `FOO` -error[SIM112]: SIM112.py:12:22: Use capitalized environment variable `FOO` instead of `foo` +error[SIM112]: 12:22: Use capitalized environment variable `FOO` instead of `foo` + --> SIM112.py:12:22 | 10 | os.getenv('foo') 11 | @@ -65,8 +70,9 @@ error[SIM112]: SIM112.py:12:22: Use capitalized environment variable `FOO` inste 14 | env = os.environ['foo'] | = help: Replace `foo` with `FOO` -error[SIM112]: SIM112.py:14:18: [*] Use capitalized environment variable `FOO` instead of `foo` +error[SIM112]: 14:18: [*] Use capitalized environment variable `FOO` instead of `foo` + --> SIM112.py:14:18 | 12 | env = os.environ.get('foo') 13 | @@ -86,8 +92,9 @@ error[SIM112]: SIM112.py:14:18: [*] Use capitalized environment variable `FOO` i 16 16 | if env := os.environ.get('foo'): 17 17 | pass -error[SIM112]: SIM112.py:16:26: Use capitalized environment variable `FOO` instead of `foo` +error[SIM112]: 16:26: Use capitalized environment variable `FOO` instead of `foo` + --> SIM112.py:16:26 | 14 | env = os.environ['foo'] 15 | @@ -96,8 +103,9 @@ error[SIM112]: SIM112.py:16:26: Use capitalized environment variable `FOO` inste 17 | pass | = help: Replace `foo` with `FOO` -error[SIM112]: SIM112.py:19:22: [*] Use capitalized environment variable `FOO` instead of `foo` +error[SIM112]: 19:22: [*] Use capitalized environment variable `FOO` instead of `foo` + --> SIM112.py:19:22 | 17 | pass 18 | diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM113_SIM113.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM113_SIM113.py.snap index 84432f07b0..13a39fa04a 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM113_SIM113.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM113_SIM113.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -error[SIM113]: SIM113.py:6:9: Use `enumerate()` for index variable `idx` in `for` loop +error[SIM113]: 6:9: Use `enumerate()` for index variable `idx` in `for` loop + --> SIM113.py:6:9 | 4 | for x in range(5): 5 | g(x, idx) @@ -10,8 +11,9 @@ error[SIM113]: SIM113.py:6:9: Use `enumerate()` for index variable `idx` in `for | ^^^^^^^^ 7 | h(x) | -error[SIM113]: SIM113.py:17:9: Use `enumerate()` for index variable `idx` in `for` loop +error[SIM113]: 17:9: Use `enumerate()` for index variable `idx` in `for` loop + --> SIM113.py:17:9 | 15 | if g(x): 16 | break @@ -19,24 +21,27 @@ error[SIM113]: SIM113.py:17:9: Use `enumerate()` for index variable `idx` in `fo | ^^^^^^^^ 18 | sum += h(x, idx) | -error[SIM113]: SIM113.py:27:9: Use `enumerate()` for index variable `idx` in `for` loop +error[SIM113]: 27:9: Use `enumerate()` for index variable `idx` in `for` loop + --> SIM113.py:27:9 | 25 | g(x) 26 | h(x, y) 27 | idx += 1 | ^^^^^^^^ | -error[SIM113]: SIM113.py:36:9: Use `enumerate()` for index variable `idx` in `for` loop +error[SIM113]: 36:9: Use `enumerate()` for index variable `idx` in `for` loop + --> SIM113.py:36:9 | 34 | for x in range(5): 35 | sum += h(x, idx) 36 | idx += 1 | ^^^^^^^^ | -error[SIM113]: SIM113.py:44:9: Use `enumerate()` for index variable `idx` in `for` loop +error[SIM113]: 44:9: Use `enumerate()` for index variable `idx` in `for` loop + --> SIM113.py:44:9 | 42 | for x in range(5): 43 | g(x, idx) diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM114_SIM114.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM114_SIM114.py.snap index 8eb406515e..12a3019c24 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM114_SIM114.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM114_SIM114.py.snap @@ -1,19 +1,20 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -SIM114.py:2:1: SIM114 [*] Combine `if` branches using logical `or` operator +error[SIM114]: 2:1: [*] Combine `if` branches using logical `or` operator + + --> SIM114.py:1:9 | 1 | # Errors 2 | / if a: 3 | | b 4 | | elif c: 5 | | b - | |_____^ SIM114 + | |_____^ 6 | 7 | if a: # we preserve comments, too! | = help: Combine `if` branches - ℹ Safe fix 1 1 | # Errors 2 |-if a: @@ -24,7 +25,9 @@ SIM114.py:2:1: SIM114 [*] Combine `if` branches using logical `or` operator 6 4 | 7 5 | if a: # we preserve comments, too! -SIM114.py:7:1: SIM114 [*] Combine `if` branches using logical `or` operator +error[SIM114]: 7:1: [*] Combine `if` branches using logical `or` operator + + --> SIM114.py:6:1 | 5 | b 6 | @@ -32,12 +35,11 @@ SIM114.py:7:1: SIM114 [*] Combine `if` branches using logical `or` operator 8 | | b 9 | | elif c: # but not on the second branch 10 | | b - | |_____^ SIM114 + | |_____^ 11 | 12 | if x == 1: | = help: Combine `if` branches - ℹ Safe fix 4 4 | elif c: 5 5 | b @@ -50,7 +52,9 @@ SIM114.py:7:1: SIM114 [*] Combine `if` branches using logical `or` operator 11 9 | 12 10 | if x == 1: -SIM114.py:12:1: SIM114 [*] Combine `if` branches using logical `or` operator +error[SIM114]: 12:1: [*] Combine `if` branches using logical `or` operator + + --> SIM114.py:11:1 | 10 | b 11 | @@ -60,12 +64,11 @@ SIM114.py:12:1: SIM114 [*] Combine `if` branches using logical `or` operator 15 | | elif x == 2: 16 | | for _ in range(20): 17 | | print("hello") - | |______________________^ SIM114 + | |______________________^ 18 | 19 | if x == 1: | = help: Combine `if` branches - ℹ Safe fix 9 9 | elif c: # but not on the second branch 10 10 | b @@ -79,7 +82,9 @@ SIM114.py:12:1: SIM114 [*] Combine `if` branches using logical `or` operator 17 14 | print("hello") 18 15 | -SIM114.py:19:1: SIM114 [*] Combine `if` branches using logical `or` operator +error[SIM114]: 19:1: [*] Combine `if` branches using logical `or` operator + + --> SIM114.py:18:1 | 17 | print("hello") 18 | @@ -91,12 +96,11 @@ SIM114.py:19:1: SIM114 [*] Combine `if` branches using logical `or` operator 24 | | if True: 25 | | for _ in range(20): 26 | | print("hello") - | |__________________________^ SIM114 + | |__________________________^ 27 | 28 | if x == 1: | = help: Combine `if` branches - ℹ Safe fix 16 16 | for _ in range(20): 17 17 | print("hello") @@ -111,7 +115,9 @@ SIM114.py:19:1: SIM114 [*] Combine `if` branches using logical `or` operator 25 21 | for _ in range(20): 26 22 | print("hello") -SIM114.py:28:1: SIM114 [*] Combine `if` branches using logical `or` operator +error[SIM114]: 28:1: [*] Combine `if` branches using logical `or` operator + + --> SIM114.py:27:1 | 26 | print("hello") 27 | @@ -129,12 +135,11 @@ SIM114.py:28:1: SIM114 [*] Combine `if` branches using logical `or` operator 39 | | elif False: 40 | | for _ in range(20): 41 | | print("hello") - | |__________________________^ SIM114 + | |__________________________^ 42 | 43 | if ( | = help: Combine `if` branches - ℹ Safe fix 25 25 | for _ in range(20): 26 26 | print("hello") @@ -152,7 +157,9 @@ SIM114.py:28:1: SIM114 [*] Combine `if` branches using logical `or` operator 37 30 | for _ in range(20): 38 31 | print("hello") -SIM114.py:29:5: SIM114 [*] Combine `if` branches using logical `or` operator +error[SIM114]: 29:5: [*] Combine `if` branches using logical `or` operator + + --> SIM114.py:29:5 | 28 | if x == 1: 29 | if True: @@ -162,12 +169,11 @@ SIM114.py:29:5: SIM114 [*] Combine `if` branches using logical `or` operator 32 | | elif False: 33 | | for _ in range(20): 34 | | print("hello") - | |__________________________^ SIM114 + | |__________________________^ 35 | elif x == 2: 36 | if True: | = help: Combine `if` branches - ℹ Safe fix 26 26 | print("hello") 27 27 | @@ -181,7 +187,9 @@ SIM114.py:29:5: SIM114 [*] Combine `if` branches using logical `or` operator 34 31 | print("hello") 35 32 | elif x == 2: -SIM114.py:36:5: SIM114 [*] Combine `if` branches using logical `or` operator +error[SIM114]: 36:5: [*] Combine `if` branches using logical `or` operator + + --> SIM114.py:36:5 | 34 | print("hello") 35 | elif x == 2: @@ -192,12 +200,11 @@ SIM114.py:36:5: SIM114 [*] Combine `if` branches using logical `or` operator 39 | | elif False: 40 | | for _ in range(20): 41 | | print("hello") - | |__________________________^ SIM114 + | |__________________________^ 42 | 43 | if ( | = help: Combine `if` branches - ℹ Safe fix 33 33 | for _ in range(20): 34 34 | print("hello") @@ -211,7 +218,9 @@ SIM114.py:36:5: SIM114 [*] Combine `if` branches using logical `or` operator 41 38 | print("hello") 42 39 | -SIM114.py:43:1: SIM114 [*] Combine `if` branches using logical `or` operator +error[SIM114]: 43:1: [*] Combine `if` branches using logical `or` operator + + --> SIM114.py:42:1 | 41 | print("hello") 42 | @@ -234,12 +243,11 @@ SIM114.py:43:1: SIM114 [*] Combine `if` branches using logical `or` operator 59 | | pass 60 | | elif 1 == 2: 61 | | pass - | |________^ SIM114 + | |________^ 62 | 63 | if result.eofs == "O": | = help: Combine `if` branches - ℹ Safe fix 55 55 | and i == 12 56 56 | and j == 13 @@ -252,7 +260,9 @@ SIM114.py:43:1: SIM114 [*] Combine `if` branches using logical `or` operator 62 60 | 63 61 | if result.eofs == "O": -SIM114.py:67:1: SIM114 [*] Combine `if` branches using logical `or` operator +error[SIM114]: 67:1: [*] Combine `if` branches using logical `or` operator + + --> SIM114.py:66:16 | 65 | elif result.eofs == "S": 66 | skipped = 1 @@ -260,12 +270,11 @@ SIM114.py:67:1: SIM114 [*] Combine `if` branches using logical `or` operator 68 | | errors = 1 69 | | elif result.eofs == "E": 70 | | errors = 1 - | |______________^ SIM114 + | |______________^ 71 | elif result.eofs == "X": 72 | errors = 1 | = help: Combine `if` branches - ℹ Safe fix 64 64 | pass 65 65 | elif result.eofs == "S": @@ -278,7 +287,9 @@ SIM114.py:67:1: SIM114 [*] Combine `if` branches using logical `or` operator 71 69 | elif result.eofs == "X": 72 70 | errors = 1 -SIM114.py:69:1: SIM114 [*] Combine `if` branches using logical `or` operator +error[SIM114]: 69:1: [*] Combine `if` branches using logical `or` operator + + --> SIM114.py:68:15 | 67 | elif result.eofs == "F": 68 | errors = 1 @@ -286,12 +297,11 @@ SIM114.py:69:1: SIM114 [*] Combine `if` branches using logical `or` operator 70 | | errors = 1 71 | | elif result.eofs == "X": 72 | | errors = 1 - | |______________^ SIM114 + | |______________^ 73 | elif result.eofs == "C": 74 | errors = 1 | = help: Combine `if` branches - ℹ Safe fix 66 66 | skipped = 1 67 67 | elif result.eofs == "F": @@ -304,7 +314,9 @@ SIM114.py:69:1: SIM114 [*] Combine `if` branches using logical `or` operator 73 71 | elif result.eofs == "C": 74 72 | errors = 1 -SIM114.py:71:1: SIM114 [*] Combine `if` branches using logical `or` operator +error[SIM114]: 71:1: [*] Combine `if` branches using logical `or` operator + + --> SIM114.py:70:15 | 69 | elif result.eofs == "E": 70 | errors = 1 @@ -312,10 +324,9 @@ SIM114.py:71:1: SIM114 [*] Combine `if` branches using logical `or` operator 72 | | errors = 1 73 | | elif result.eofs == "C": 74 | | errors = 1 - | |______________^ SIM114 + | |______________^ | = help: Combine `if` branches - ℹ Safe fix 68 68 | errors = 1 69 69 | elif result.eofs == "E": @@ -328,7 +339,9 @@ SIM114.py:71:1: SIM114 [*] Combine `if` branches using logical `or` operator 75 73 | 76 74 | -SIM114.py:118:5: SIM114 [*] Combine `if` branches using logical `or` operator +error[SIM114]: 118:5: [*] Combine `if` branches using logical `or` operator + + --> SIM114.py:118:5 | 116 | a = True 117 | b = False @@ -337,12 +350,11 @@ SIM114.py:118:5: SIM114 [*] Combine `if` branches using logical `or` operator 119 | | return 3 120 | | elif a == b: 121 | | return 3 - | |________________^ SIM114 + | |________________^ 122 | elif a < b: # end-of-line 123 | return 4 | = help: Combine `if` branches - ℹ Safe fix 115 115 | def func(): 116 116 | a = True @@ -355,7 +367,9 @@ SIM114.py:118:5: SIM114 [*] Combine `if` branches using logical `or` operator 122 120 | elif a < b: # end-of-line 123 121 | return 4 -SIM114.py:122:5: SIM114 [*] Combine `if` branches using logical `or` operator +error[SIM114]: 122:5: [*] Combine `if` branches using logical `or` operator + + --> SIM114.py:122:5 | 120 | elif a == b: 121 | return 3 @@ -364,10 +378,9 @@ SIM114.py:122:5: SIM114 [*] Combine `if` branches using logical `or` operator 123 | | return 4 124 | | elif b is None: 125 | | return 4 - | |________________^ SIM114 + | |________________^ | = help: Combine `if` branches - ℹ Safe fix 119 119 | return 3 120 120 | elif a == b: @@ -380,7 +393,9 @@ SIM114.py:122:5: SIM114 [*] Combine `if` branches using logical `or` operator 126 124 | 127 125 | -SIM114.py:132:5: SIM114 [*] Combine `if` branches using logical `or` operator +error[SIM114]: 132:5: [*] Combine `if` branches using logical `or` operator + + --> SIM114.py:132:5 | 130 | a = True 131 | b = False @@ -389,10 +404,9 @@ SIM114.py:132:5: SIM114 [*] Combine `if` branches using logical `or` operator 133 | | return 3 134 | | elif a := 1: 135 | | return 3 - | |________________^ SIM114 + | |________________^ | = help: Combine `if` branches - ℹ Safe fix 129 129 | """Ensure that the named expression is parenthesized when merged.""" 130 130 | a = True @@ -405,16 +419,17 @@ SIM114.py:132:5: SIM114 [*] Combine `if` branches using logical `or` operator 136 134 | 137 135 | -SIM114.py:138:1: SIM114 [*] Combine `if` branches using logical `or` operator +error[SIM114]: 138:1: [*] Combine `if` branches using logical `or` operator + + --> SIM114.py:138:1 | 138 | / if a: # we preserve comments, too! 139 | | b 140 | | elif c: # but not on the second branch 141 | | b - | |_____^ SIM114 + | |_____^ | = help: Combine `if` branches - ℹ Safe fix 135 135 | return 3 136 136 | @@ -427,14 +442,15 @@ SIM114.py:138:1: SIM114 [*] Combine `if` branches using logical `or` operator 142 140 | 143 141 | -SIM114.py:144:1: SIM114 [*] Combine `if` branches using logical `or` operator +error[SIM114]: 144:1: [*] Combine `if` branches using logical `or` operator + + --> SIM114.py:144:1 | 144 | / if a: b # here's a comment 145 | | elif c: b - | |_________^ SIM114 + | |_________^ | = help: Combine `if` branches - ℹ Safe fix 141 141 | b 142 142 | @@ -446,15 +462,16 @@ SIM114.py:144:1: SIM114 [*] Combine `if` branches using logical `or` operator 147 146 | 148 147 | if(x > 200): pass -SIM114.py:148:1: SIM114 [*] Combine `if` branches using logical `or` operator +error[SIM114]: 148:1: [*] Combine `if` branches using logical `or` operator + + --> SIM114.py:148:1 | 148 | / if(x > 200): pass 149 | | elif(100 < x and x < 200 and 300 < y and y < 800): 150 | | pass - | |________^ SIM114 + | |________^ | = help: Combine `if` branches - ℹ Safe fix 145 145 | elif c: b 146 146 | @@ -467,19 +484,20 @@ SIM114.py:148:1: SIM114 [*] Combine `if` branches using logical `or` operator 152 150 | 153 151 | # See: https://github.com/astral-sh/ruff/issues/12732 -SIM114.py:154:1: SIM114 [*] Combine `if` branches using logical `or` operator +error[SIM114]: 154:1: [*] Combine `if` branches using logical `or` operator + + --> SIM114.py:153:54 | 153 | # See: https://github.com/astral-sh/ruff/issues/12732 154 | / if False if True else False: 155 | | print(1) 156 | | elif True: 157 | | print(1) - | |____________^ SIM114 + | |____________^ 158 | else: 159 | print(2) | = help: Combine `if` branches - ℹ Safe fix 151 151 | 152 152 | diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM115_SIM115.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM115_SIM115.py.snap index dd5bd207e5..d58c7a8852 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM115_SIM115.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM115_SIM115.py.snap @@ -1,61 +1,68 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -SIM115.py:8:5: SIM115 Use a context manager for opening files +error[SIM115]: 8:5: Use a context manager for opening files + + --> SIM115.py:8:5 | 7 | # SIM115 8 | f = open("foo.txt") - | ^^^^ SIM115 + | ^^^^ 9 | f = Path("foo.txt").open() 10 | f = pathlib.Path("foo.txt").open() | +error[SIM115]: 9:5: Use a context manager for opening files -SIM115.py:9:5: SIM115 Use a context manager for opening files + --> SIM115.py:9:5 | 7 | # SIM115 8 | f = open("foo.txt") 9 | f = Path("foo.txt").open() - | ^^^^^^^^^^^^^^^^^^^^ SIM115 + | ^^^^^^^^^^^^^^^^^^^^ 10 | f = pathlib.Path("foo.txt").open() 11 | f = pl.Path("foo.txt").open() | +error[SIM115]: 10:5: Use a context manager for opening files -SIM115.py:10:5: SIM115 Use a context manager for opening files + --> SIM115.py:10:5 | 8 | f = open("foo.txt") 9 | f = Path("foo.txt").open() 10 | f = pathlib.Path("foo.txt").open() - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SIM115 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 11 | f = pl.Path("foo.txt").open() 12 | f = P("foo.txt").open() | +error[SIM115]: 11:5: Use a context manager for opening files -SIM115.py:11:5: SIM115 Use a context manager for opening files + --> SIM115.py:11:5 | 9 | f = Path("foo.txt").open() 10 | f = pathlib.Path("foo.txt").open() 11 | f = pl.Path("foo.txt").open() - | ^^^^^^^^^^^^^^^^^^^^^^^ SIM115 + | ^^^^^^^^^^^^^^^^^^^^^^^ 12 | f = P("foo.txt").open() 13 | data = f.read() | +error[SIM115]: 12:5: Use a context manager for opening files -SIM115.py:12:5: SIM115 Use a context manager for opening files + --> SIM115.py:12:5 | 10 | f = pathlib.Path("foo.txt").open() 11 | f = pl.Path("foo.txt").open() 12 | f = P("foo.txt").open() - | ^^^^^^^^^^^^^^^^^ SIM115 + | ^^^^^^^^^^^^^^^^^ 13 | data = f.read() 14 | f.close() | +error[SIM115]: 39:9: Use a context manager for opening files -SIM115.py:39:9: SIM115 Use a context manager for opening files + --> SIM115.py:39:9 | 37 | # SIM115 38 | with contextlib.ExitStack(): 39 | f = open("filename") - | ^^^^ SIM115 + | ^^^^ 40 | 41 | # OK | diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM116_SIM116.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM116_SIM116.py.snap index 9437b519f7..d76697d0fa 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM116_SIM116.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM116_SIM116.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -error[SIM116]: SIM116.py:5:1: Use a dictionary instead of consecutive `if` statements +error[SIM116]: 5:1: Use a dictionary instead of consecutive `if` statements + --> SIM116.py:4:9 | 4 | # SIM116 5 | / if a == "foo": @@ -17,8 +18,9 @@ error[SIM116]: SIM116.py:5:1: Use a dictionary instead of consecutive `if` state 13 | 14 | # SIM116 | -error[SIM116]: SIM116.py:15:1: Use a dictionary instead of consecutive `if` statements +error[SIM116]: 15:1: Use a dictionary instead of consecutive `if` statements + --> SIM116.py:14:9 | 14 | # SIM116 15 | / if a == 1: @@ -33,8 +35,9 @@ error[SIM116]: SIM116.py:15:1: Use a dictionary instead of consecutive `if` stat 23 | 24 | # SIM116 | -error[SIM116]: SIM116.py:25:1: Use a dictionary instead of consecutive `if` statements +error[SIM116]: 25:1: Use a dictionary instead of consecutive `if` statements + --> SIM116.py:24:9 | 24 | # SIM116 25 | / if a == 1: @@ -47,8 +50,9 @@ error[SIM116]: SIM116.py:25:1: Use a dictionary instead of consecutive `if` stat 31 | 32 | # SIM116 | -error[SIM116]: SIM116.py:33:1: Use a dictionary instead of consecutive `if` statements +error[SIM116]: 33:1: Use a dictionary instead of consecutive `if` statements + --> SIM116.py:32:9 | 32 | # SIM116 33 | / if a == "hello 'sir'": @@ -63,8 +67,9 @@ error[SIM116]: SIM116.py:33:1: Use a dictionary instead of consecutive `if` stat 41 | 42 | # SIM116 | -error[SIM116]: SIM116.py:43:1: Use a dictionary instead of consecutive `if` statements +error[SIM116]: 43:1: Use a dictionary instead of consecutive `if` statements + --> SIM116.py:42:9 | 42 | # SIM116 43 | / if a == b"one": @@ -77,8 +82,9 @@ error[SIM116]: SIM116.py:43:1: Use a dictionary instead of consecutive `if` stat 49 | 50 | # SIM116 | -error[SIM116]: SIM116.py:51:1: Use a dictionary instead of consecutive `if` statements +error[SIM116]: 51:1: Use a dictionary instead of consecutive `if` statements + --> SIM116.py:50:9 | 50 | # SIM116 51 | / if a == "hello 'sir'": @@ -93,8 +99,9 @@ error[SIM116]: SIM116.py:51:1: Use a dictionary instead of consecutive `if` stat 59 | 60 | # OK | -error[SIM116]: SIM116.py:79:1: Use a dictionary instead of consecutive `if` statements +error[SIM116]: 79:1: Use a dictionary instead of consecutive `if` statements + --> SIM116.py:78:9 | 78 | # SIM116 79 | / if func_name == "create": diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM117_SIM117.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM117_SIM117.py.snap index 98a2347a8f..fb7b8b0ebb 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM117_SIM117.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM117_SIM117.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -error[SIM117]: SIM117.py:2:1: [*] Use a single `with` statement with multiple contexts instead of nested `with` statements +error[SIM117]: 2:1: [*] Use a single `with` statement with multiple contexts instead of nested `with` statements + --> SIM117.py:1:9 | 1 | # SIM117 2 | / with A() as a: @@ -22,8 +23,9 @@ error[SIM117]: SIM117.py:2:1: [*] Use a single `with` statement with multiple co 6 5 | # SIM117 7 6 | with A(): -error[SIM117]: SIM117.py:7:1: [*] Use a single `with` statement with multiple contexts instead of nested `with` statements +error[SIM117]: 7:1: [*] Use a single `with` statement with multiple contexts instead of nested `with` statements + --> SIM117.py:6:9 | 6 | # SIM117 7 | / with A(): @@ -48,8 +50,9 @@ error[SIM117]: SIM117.py:7:1: [*] Use a single `with` statement with multiple co 12 11 | # SIM117 13 12 | with A() as a: -error[SIM117]: SIM117.py:13:1: Use a single `with` statement with multiple contexts instead of nested `with` statements +error[SIM117]: 13:1: Use a single `with` statement with multiple contexts instead of nested `with` statements + --> SIM117.py:12:9 | 12 | # SIM117 13 | / with A() as a: @@ -59,8 +62,9 @@ error[SIM117]: SIM117.py:13:1: Use a single `with` statement with multiple conte 16 | print("hello") | = help: Combine `with` statements -error[SIM117]: SIM117.py:19:1: [*] Use a single `with` statement with multiple contexts instead of nested `with` statements +error[SIM117]: 19:1: [*] Use a single `with` statement with multiple contexts instead of nested `with` statements + --> SIM117.py:18:9 | 18 | # SIM117 19 | / with A() as a: @@ -85,8 +89,9 @@ error[SIM117]: SIM117.py:19:1: [*] Use a single `with` statement with multiple c 24 23 | # OK 25 24 | with A() as a: -error[SIM117]: SIM117.py:47:1: [*] Use a single `with` statement with multiple contexts instead of nested `with` statements +error[SIM117]: 47:1: [*] Use a single `with` statement with multiple contexts instead of nested `with` statements + --> SIM117.py:46:9 | 46 | # SIM117 47 | / async with A() as a: @@ -108,8 +113,9 @@ error[SIM117]: SIM117.py:47:1: [*] Use a single `with` statement with multiple c 51 50 | while True: 52 51 | # SIM117 -error[SIM117]: SIM117.py:53:5: [*] Use a single `with` statement with multiple contexts instead of nested `with` statements +error[SIM117]: 53:5: [*] Use a single `with` statement with multiple contexts instead of nested `with` statements + --> SIM117.py:53:5 | 51 | while True: 52 | # SIM117 @@ -146,8 +152,9 @@ error[SIM117]: SIM117.py:53:5: [*] Use a single `with` statement with multiple c 66 65 | 67 66 | # SIM117 -error[SIM117]: SIM117.py:68:1: [*] Use a single `with` statement with multiple contexts instead of nested `with` statements +error[SIM117]: 68:1: [*] Use a single `with` statement with multiple contexts instead of nested `with` statements + --> SIM117.py:67:9 | 67 | # SIM117 68 | / with ( @@ -173,8 +180,9 @@ error[SIM117]: SIM117.py:68:1: [*] Use a single `with` statement with multiple c 75 74 | # SIM117 76 75 | with A() as a: -error[SIM117]: SIM117.py:76:1: [*] Use a single `with` statement with multiple contexts instead of nested `with` statements +error[SIM117]: 76:1: [*] Use a single `with` statement with multiple contexts instead of nested `with` statements + --> SIM117.py:75:9 | 75 | # SIM117 76 | / with A() as a: @@ -205,8 +213,9 @@ error[SIM117]: SIM117.py:76:1: [*] Use a single `with` statement with multiple c 83 82 | # SIM117 84 83 | with ( -error[SIM117]: SIM117.py:84:1: [*] Use a single `with` statement with multiple contexts instead of nested `with` statements +error[SIM117]: 84:1: [*] Use a single `with` statement with multiple contexts instead of nested `with` statements + --> SIM117.py:83:9 | 83 | # SIM117 84 | / with ( @@ -239,8 +248,9 @@ error[SIM117]: SIM117.py:84:1: [*] Use a single `with` statement with multiple c 94 91 | # SIM117 (auto-fixable) 95 92 | with A("01ß9💣2ℝ8901ß9💣2ℝ8901ß9💣2ℝ89") as a: -error[SIM117]: SIM117.py:95:1: [*] Use a single `with` statement with multiple contexts instead of nested `with` statements +error[SIM117]: 95:1: [*] Use a single `with` statement with multiple contexts instead of nested `with` statements + --> SIM117.py:94:24 | 94 | # SIM117 (auto-fixable) 95 | / with A("01ß9💣2ℝ8901ß9💣2ℝ8901ß9💣2ℝ89") as a: @@ -262,8 +272,9 @@ error[SIM117]: SIM117.py:95:1: [*] Use a single `with` statement with multiple c 99 98 | # SIM117 (not auto-fixable too long) 100 99 | with A("01ß9💣2ℝ8901ß9💣2ℝ8901ß9💣2ℝ890") as a: -error[SIM117]: SIM117.py:100:1: Use a single `with` statement with multiple contexts instead of nested `with` statements +error[SIM117]: 100:1: Use a single `with` statement with multiple contexts instead of nested `with` statements + --> SIM117.py:99:37 | 99 | # SIM117 (not auto-fixable too long) 100 | / with A("01ß9💣2ℝ8901ß9💣2ℝ8901ß9💣2ℝ890") as a: @@ -272,8 +283,9 @@ error[SIM117]: SIM117.py:100:1: Use a single `with` statement with multiple cont 102 | print("hello") | = help: Combine `with` statements -error[SIM117]: SIM117.py:106:5: Use a single `with` statement with multiple contexts instead of nested `with` statements +error[SIM117]: 106:5: Use a single `with` statement with multiple contexts instead of nested `with` statements + --> SIM117.py:106:5 | 104 | # From issue #3025. 105 | async def main(): @@ -284,8 +296,9 @@ error[SIM117]: SIM117.py:106:5: Use a single `with` statement with multiple cont 108 | print("async-inside!") | = help: Combine `with` statements -error[SIM117]: SIM117.py:126:1: [*] Use a single `with` statement with multiple contexts instead of nested `with` statements +error[SIM117]: 126:1: [*] Use a single `with` statement with multiple contexts instead of nested `with` statements + --> SIM117.py:125:9 | 125 | # SIM117 126 | / with A() as a: @@ -320,8 +333,9 @@ error[SIM117]: SIM117.py:126:1: [*] Use a single `with` statement with multiple 138 137 | # Allow cascading for some statements. 139 138 | import anyio -error[SIM117]: SIM117.py:163:1: [*] Use a single `with` statement with multiple contexts instead of nested `with` statements +error[SIM117]: 163:1: [*] Use a single `with` statement with multiple contexts instead of nested `with` statements + --> SIM117.py:162:86 | 162 | # Do not suppress combination, if a context manager is already combined with another. 163 | / async with asyncio.timeout(1), A(): diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM118_SIM118.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM118_SIM118.py.snap index 5087839b72..bdc4cdc1f7 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM118_SIM118.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM118_SIM118.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -error[SIM118]: SIM118.py:3:1: [*] Use `key in dict` instead of `key in dict.keys()` +error[SIM118]: 3:1: [*] Use `key in dict` instead of `key in dict.keys()` + --> SIM118.py:2:1 | 1 | obj = {} 2 | @@ -21,8 +22,9 @@ error[SIM118]: SIM118.py:3:1: [*] Use `key in dict` instead of `key in dict.keys 5 5 | key not in obj.keys() # SIM118 6 6 | -error[SIM118]: SIM118.py:5:1: [*] Use `key not in dict` instead of `key not in dict.keys()` +error[SIM118]: 5:1: [*] Use `key not in dict` instead of `key not in dict.keys()` + --> SIM118.py:4:1 | 3 | key in obj.keys() # SIM118 4 | @@ -42,8 +44,9 @@ error[SIM118]: SIM118.py:5:1: [*] Use `key not in dict` instead of `key not in d 7 7 | foo["bar"] in obj.keys() # SIM118 8 8 | -error[SIM118]: SIM118.py:7:1: [*] Use `key in dict` instead of `key in dict.keys()` +error[SIM118]: 7:1: [*] Use `key in dict` instead of `key in dict.keys()` + --> SIM118.py:6:1 | 5 | key not in obj.keys() # SIM118 6 | @@ -63,8 +66,9 @@ error[SIM118]: SIM118.py:7:1: [*] Use `key in dict` instead of `key in dict.keys 9 9 | foo["bar"] not in obj.keys() # SIM118 10 10 | -error[SIM118]: SIM118.py:9:1: [*] Use `key not in dict` instead of `key not in dict.keys()` +error[SIM118]: 9:1: [*] Use `key not in dict` instead of `key not in dict.keys()` + --> SIM118.py:8:1 | 7 | foo["bar"] in obj.keys() # SIM118 8 | @@ -84,8 +88,9 @@ error[SIM118]: SIM118.py:9:1: [*] Use `key not in dict` instead of `key not in d 11 11 | foo['bar'] in obj.keys() # SIM118 12 12 | -error[SIM118]: SIM118.py:11:1: [*] Use `key in dict` instead of `key in dict.keys()` +error[SIM118]: 11:1: [*] Use `key in dict` instead of `key in dict.keys()` + --> SIM118.py:10:1 | 9 | foo["bar"] not in obj.keys() # SIM118 10 | @@ -105,8 +110,9 @@ error[SIM118]: SIM118.py:11:1: [*] Use `key in dict` instead of `key in dict.key 13 13 | foo['bar'] not in obj.keys() # SIM118 14 14 | -error[SIM118]: SIM118.py:13:1: [*] Use `key not in dict` instead of `key not in dict.keys()` +error[SIM118]: 13:1: [*] Use `key not in dict` instead of `key not in dict.keys()` + --> SIM118.py:12:1 | 11 | foo['bar'] in obj.keys() # SIM118 12 | @@ -126,8 +132,9 @@ error[SIM118]: SIM118.py:13:1: [*] Use `key not in dict` instead of `key not in 15 15 | foo() in obj.keys() # SIM118 16 16 | -error[SIM118]: SIM118.py:15:1: [*] Use `key in dict` instead of `key in dict.keys()` +error[SIM118]: 15:1: [*] Use `key in dict` instead of `key in dict.keys()` + --> SIM118.py:14:1 | 13 | foo['bar'] not in obj.keys() # SIM118 14 | @@ -147,8 +154,9 @@ error[SIM118]: SIM118.py:15:1: [*] Use `key in dict` instead of `key in dict.key 17 17 | foo() not in obj.keys() # SIM118 18 18 | -error[SIM118]: SIM118.py:17:1: [*] Use `key not in dict` instead of `key not in dict.keys()` +error[SIM118]: 17:1: [*] Use `key not in dict` instead of `key not in dict.keys()` + --> SIM118.py:16:1 | 15 | foo() in obj.keys() # SIM118 16 | @@ -168,8 +176,9 @@ error[SIM118]: SIM118.py:17:1: [*] Use `key not in dict` instead of `key not in 19 19 | for key in obj.keys(): # SIM118 20 20 | pass -error[SIM118]: SIM118.py:19:5: [*] Use `key in dict` instead of `key in dict.keys()` +error[SIM118]: 19:5: [*] Use `key in dict` instead of `key in dict.keys()` + --> SIM118.py:19:5 | 17 | foo() not in obj.keys() # SIM118 18 | @@ -188,8 +197,9 @@ error[SIM118]: SIM118.py:19:5: [*] Use `key in dict` instead of `key in dict.key 21 21 | 22 22 | for key in list(obj.keys()): -error[SIM118]: SIM118.py:26:8: [*] Use `key in dict` instead of `key in dict.keys()` +error[SIM118]: 26:8: [*] Use `key in dict` instead of `key in dict.keys()` + --> SIM118.py:26:8 | 24 | del obj[key] 25 | @@ -209,8 +219,9 @@ error[SIM118]: SIM118.py:26:8: [*] Use `key in dict` instead of `key in dict.key 28 28 | {k for k in obj.keys()} # SIM118 29 29 | -error[SIM118]: SIM118.py:28:8: [*] Use `key in dict` instead of `key in dict.keys()` +error[SIM118]: 28:8: [*] Use `key in dict` instead of `key in dict.keys()` + --> SIM118.py:28:8 | 26 | [k for k in obj.keys()] # SIM118 27 | @@ -230,8 +241,9 @@ error[SIM118]: SIM118.py:28:8: [*] Use `key in dict` instead of `key in dict.key 30 30 | {k: k for k in obj.keys()} # SIM118 31 31 | -error[SIM118]: SIM118.py:30:11: [*] Use `key in dict` instead of `key in dict.keys()` +error[SIM118]: 30:11: [*] Use `key in dict` instead of `key in dict.keys()` + --> SIM118.py:30:11 | 28 | {k for k in obj.keys()} # SIM118 29 | @@ -251,8 +263,9 @@ error[SIM118]: SIM118.py:30:11: [*] Use `key in dict` instead of `key in dict.ke 32 32 | (k for k in obj.keys()) # SIM118 33 33 | -error[SIM118]: SIM118.py:32:8: [*] Use `key in dict` instead of `key in dict.keys()` +error[SIM118]: 32:8: [*] Use `key in dict` instead of `key in dict.keys()` + --> SIM118.py:32:8 | 30 | {k: k for k in obj.keys()} # SIM118 31 | @@ -272,8 +285,9 @@ error[SIM118]: SIM118.py:32:8: [*] Use `key in dict` instead of `key in dict.key 34 34 | key in (obj or {}).keys() # SIM118 35 35 | -error[SIM118]: SIM118.py:34:1: [*] Use `key in dict` instead of `key in dict.keys()` +error[SIM118]: 34:1: [*] Use `key in dict` instead of `key in dict.keys()` + --> SIM118.py:33:1 | 32 | (k for k in obj.keys()) # SIM118 33 | @@ -293,8 +307,9 @@ error[SIM118]: SIM118.py:34:1: [*] Use `key in dict` instead of `key in dict.key 36 36 | (key) in (obj or {}).keys() # SIM118 37 37 | -error[SIM118]: SIM118.py:36:1: [*] Use `key in dict` instead of `key in dict.keys()` +error[SIM118]: 36:1: [*] Use `key in dict` instead of `key in dict.keys()` + --> SIM118.py:35:1 | 34 | key in (obj or {}).keys() # SIM118 35 | @@ -314,8 +329,9 @@ error[SIM118]: SIM118.py:36:1: [*] Use `key in dict` instead of `key in dict.key 38 38 | from typing import KeysView 39 39 | -error[SIM118]: SIM118.py:50:1: [*] Use `key in dict` instead of `key in dict.keys()` +error[SIM118]: 50:1: [*] Use `key in dict` instead of `key in dict.keys()` + --> SIM118.py:49:69 | 49 | # Regression test for: https://github.com/astral-sh/ruff/issues/7124 50 | key in obj.keys()and foo @@ -334,8 +350,9 @@ error[SIM118]: SIM118.py:50:1: [*] Use `key in dict` instead of `key in dict.key 52 52 | key in (obj.keys())and foo 53 53 | -error[SIM118]: SIM118.py:51:2: [*] Use `key in dict` instead of `key in dict.keys()` +error[SIM118]: 51:2: [*] Use `key in dict` instead of `key in dict.keys()` + --> SIM118.py:51:2 | 49 | # Regression test for: https://github.com/astral-sh/ruff/issues/7124 50 | key in obj.keys()and foo @@ -354,8 +371,9 @@ error[SIM118]: SIM118.py:51:2: [*] Use `key in dict` instead of `key in dict.key 53 53 | 54 54 | # Regression test for: https://github.com/astral-sh/ruff/issues/7200 -error[SIM118]: SIM118.py:52:1: [*] Use `key in dict` instead of `key in dict.keys()` +error[SIM118]: 52:1: [*] Use `key in dict` instead of `key in dict.keys()` + --> SIM118.py:51:27 | 50 | key in obj.keys()and foo 51 | (key in obj.keys())and foo @@ -375,8 +393,9 @@ error[SIM118]: SIM118.py:52:1: [*] Use `key in dict` instead of `key in dict.key 54 54 | # Regression test for: https://github.com/astral-sh/ruff/issues/7200 55 55 | for key in ( -error[SIM118]: SIM118.py:55:5: [*] Use `key in dict` instead of `key in dict.keys()` +error[SIM118]: 55:5: [*] Use `key in dict` instead of `key in dict.keys()` + --> SIM118.py:55:5 | 54 | # Regression test for: https://github.com/astral-sh/ruff/issues/7200 55 | for key in ( @@ -399,8 +418,9 @@ error[SIM118]: SIM118.py:55:5: [*] Use `key in dict` instead of `key in dict.key 60 60 | continue 61 61 | -error[SIM118]: SIM118.py:65:1: [*] Use `key in dict` instead of `key in dict.keys()` +error[SIM118]: 65:1: [*] Use `key in dict` instead of `key in dict.keys()` + --> SIM118.py:64:17 | 64 | d = SneakyDict() 65 | key in d.keys() # SIM118 diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM201_SIM201.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM201_SIM201.py.snap index 1ba2dbf5fa..50c09260fd 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM201_SIM201.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM201_SIM201.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -error[SIM201]: SIM201.py:2:4: [*] Use `a != b` instead of `not a == b` +error[SIM201]: 2:4: [*] Use `a != b` instead of `not a == b` + --> SIM201.py:2:4 | 1 | # SIM201 2 | if not a == b: @@ -18,8 +19,9 @@ error[SIM201]: SIM201.py:2:4: [*] Use `a != b` instead of `not a == b` 4 4 | 5 5 | # SIM201 -error[SIM201]: SIM201.py:6:4: [*] Use `a != b + c` instead of `not a == b + c` +error[SIM201]: 6:4: [*] Use `a != b + c` instead of `not a == b + c` + --> SIM201.py:6:4 | 5 | # SIM201 6 | if not a == (b + c): @@ -37,8 +39,9 @@ error[SIM201]: SIM201.py:6:4: [*] Use `a != b + c` instead of `not a == b + c` 8 8 | 9 9 | # SIM201 -error[SIM201]: SIM201.py:10:4: [*] Use `a + b != c` instead of `not a + b == c` +error[SIM201]: 10:4: [*] Use `a + b != c` instead of `not a + b == c` + --> SIM201.py:10:4 | 9 | # SIM201 10 | if not (a + b) == c: diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM202_SIM202.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM202_SIM202.py.snap index 74b3d67da0..db4791a903 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM202_SIM202.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM202_SIM202.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -error[SIM202]: SIM202.py:2:4: [*] Use `a == b` instead of `not a != b` +error[SIM202]: 2:4: [*] Use `a == b` instead of `not a != b` + --> SIM202.py:2:4 | 1 | # SIM202 2 | if not a != b: @@ -18,8 +19,9 @@ error[SIM202]: SIM202.py:2:4: [*] Use `a == b` instead of `not a != b` 4 4 | 5 5 | # SIM202 -error[SIM202]: SIM202.py:6:4: [*] Use `a == b + c` instead of `not a != b + c` +error[SIM202]: 6:4: [*] Use `a == b + c` instead of `not a != b + c` + --> SIM202.py:6:4 | 5 | # SIM202 6 | if not a != (b + c): @@ -37,8 +39,9 @@ error[SIM202]: SIM202.py:6:4: [*] Use `a == b + c` instead of `not a != b + c` 8 8 | 9 9 | # SIM202 -error[SIM202]: SIM202.py:10:4: [*] Use `a + b == c` instead of `not a + b != c` +error[SIM202]: 10:4: [*] Use `a + b == c` instead of `not a + b != c` + --> SIM202.py:10:4 | 9 | # SIM202 10 | if not (a + b) != c: diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM208_SIM208.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM208_SIM208.py.snap index d43b49300a..4226aa32cd 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM208_SIM208.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM208_SIM208.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -error[SIM208]: SIM208.py:1:4: [*] Use `a` instead of `not (not a)` +error[SIM208]: 1:4: [*] Use `a` instead of `not (not a)` + --> SIM208.py:1:4 | 1 | if not (not a): # SIM208 | ^^^^^^^^^^^ @@ -16,8 +17,9 @@ error[SIM208]: SIM208.py:1:4: [*] Use `a` instead of `not (not a)` 3 3 | 4 4 | if not (not (a == b)): # SIM208 -error[SIM208]: SIM208.py:4:4: [*] Use `a == b` instead of `not (not a == b)` +error[SIM208]: 4:4: [*] Use `a == b` instead of `not (not a == b)` + --> SIM208.py:4:4 | 2 | pass 3 | @@ -36,8 +38,9 @@ error[SIM208]: SIM208.py:4:4: [*] Use `a == b` instead of `not (not a == b)` 6 6 | 7 7 | if not a: # OK -error[SIM208]: SIM208.py:16:5: [*] Use `b` instead of `not (not b)` +error[SIM208]: 16:5: [*] Use `b` instead of `not (not b)` + --> SIM208.py:16:5 | 14 | pass 15 | @@ -57,8 +60,9 @@ error[SIM208]: SIM208.py:16:5: [*] Use `b` instead of `not (not b)` 18 18 | f(not not a) # SIM208 19 19 | -error[SIM208]: SIM208.py:18:3: [*] Use `a` instead of `not (not a)` +error[SIM208]: 18:3: [*] Use `a` instead of `not (not a)` + --> SIM208.py:18:3 | 16 | a = not not b # SIM208 17 | @@ -78,8 +82,9 @@ error[SIM208]: SIM208.py:18:3: [*] Use `a` instead of `not (not a)` 20 20 | if 1 + (not (not a)): # SIM208 21 21 | pass -error[SIM208]: SIM208.py:20:9: [*] Use `a` instead of `not (not a)` +error[SIM208]: 20:9: [*] Use `a` instead of `not (not a)` + --> SIM208.py:20:9 | 18 | f(not not a) # SIM208 19 | diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM210_SIM210.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM210_SIM210.py.snap index 300a1b6800..0c4a072350 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM210_SIM210.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM210_SIM210.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -error[SIM210]: SIM210.py:1:5: [*] Use `bool(...)` instead of `True if ... else False` +error[SIM210]: 1:5: [*] Use `bool(...)` instead of `True if ... else False` + --> SIM210.py:1:5 | 1 | a = True if b else False # SIM210 | ^^^^^^^^^^^^^^^^^^^^ @@ -17,8 +18,9 @@ error[SIM210]: SIM210.py:1:5: [*] Use `bool(...)` instead of `True if ... else F 3 3 | a = True if b != c else False # SIM210 4 4 | -error[SIM210]: SIM210.py:3:5: [*] Remove unnecessary `True if ... else False` +error[SIM210]: 3:5: [*] Remove unnecessary `True if ... else False` + --> SIM210.py:3:5 | 1 | a = True if b else False # SIM210 2 | @@ -37,8 +39,9 @@ error[SIM210]: SIM210.py:3:5: [*] Remove unnecessary `True if ... else False` 5 5 | a = True if b + c else False # SIM210 6 6 | -error[SIM210]: SIM210.py:5:5: [*] Use `bool(...)` instead of `True if ... else False` +error[SIM210]: 5:5: [*] Use `bool(...)` instead of `True if ... else False` + --> SIM210.py:5:5 | 3 | a = True if b != c else False # SIM210 4 | @@ -58,8 +61,9 @@ error[SIM210]: SIM210.py:5:5: [*] Use `bool(...)` instead of `True if ... else F 7 7 | a = False if b else True # OK 8 8 | -error[SIM210]: SIM210.py:15:9: Use `bool(...)` instead of `True if ... else False` +error[SIM210]: 15:9: Use `bool(...)` instead of `True if ... else False` + --> SIM210.py:15:9 | 13 | return False 14 | @@ -67,8 +71,9 @@ error[SIM210]: SIM210.py:15:9: Use `bool(...)` instead of `True if ... else Fals | ^^^^^^^^^^^^^^^^^^^^ | = help: Replace with `bool(...) -error[SIM210]: SIM210.py:19:11: [*] Remove unnecessary `True if ... else False` +error[SIM210]: 19:11: [*] Remove unnecessary `True if ... else False` + --> SIM210.py:19:11 | 18 | # Regression test for: https://github.com/astral-sh/ruff/issues/7076 19 | samesld = True if (psl.privatesuffix(urlparse(response.url).netloc) == diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM211_SIM211.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM211_SIM211.py.snap index 1eef5b8d13..bdef0f55a5 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM211_SIM211.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM211_SIM211.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -error[SIM211]: SIM211.py:1:5: [*] Use `not ...` instead of `False if ... else True` +error[SIM211]: 1:5: [*] Use `not ...` instead of `False if ... else True` + --> SIM211.py:1:5 | 1 | a = False if b else True # SIM211 | ^^^^^^^^^^^^^^^^^^^^ @@ -17,8 +18,9 @@ error[SIM211]: SIM211.py:1:5: [*] Use `not ...` instead of `False if ... else Tr 3 3 | a = False if b != c else True # SIM211 4 4 | -error[SIM211]: SIM211.py:3:5: [*] Use `not ...` instead of `False if ... else True` +error[SIM211]: 3:5: [*] Use `not ...` instead of `False if ... else True` + --> SIM211.py:3:5 | 1 | a = False if b else True # SIM211 2 | @@ -37,8 +39,9 @@ error[SIM211]: SIM211.py:3:5: [*] Use `not ...` instead of `False if ... else Tr 5 5 | a = False if b + c else True # SIM211 6 6 | -error[SIM211]: SIM211.py:5:5: [*] Use `not ...` instead of `False if ... else True` +error[SIM211]: 5:5: [*] Use `not ...` instead of `False if ... else True` + --> SIM211.py:5:5 | 3 | a = False if b != c else True # SIM211 4 | diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM212_SIM212.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM212_SIM212.py.snap index 8623ccc3e3..97c63d3ce7 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM212_SIM212.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM212_SIM212.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -error[SIM212]: SIM212.py:1:5: [*] Use `a if a else b` instead of `b if not a else a` +error[SIM212]: 1:5: [*] Use `a if a else b` instead of `b if not a else a` + --> SIM212.py:1:5 | 1 | c = b if not a else a # SIM212 | ^^^^^^^^^^^^^^^^^ @@ -17,8 +18,9 @@ error[SIM212]: SIM212.py:1:5: [*] Use `a if a else b` instead of `b if not a els 3 3 | c = b + c if not a else a # SIM212 4 4 | -error[SIM212]: SIM212.py:3:5: [*] Use `a if a else b + c` instead of `b + c if not a else a` +error[SIM212]: 3:5: [*] Use `a if a else b + c` instead of `b + c if not a else a` + --> SIM212.py:3:5 | 1 | c = b if not a else a # SIM212 2 | diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM220_SIM220.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM220_SIM220.py.snap index 19f37ee5e5..c06fc03fc4 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM220_SIM220.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM220_SIM220.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -error[SIM220]: SIM220.py:1:4: [*] Use `False` instead of `a and not a` +error[SIM220]: 1:4: [*] Use `False` instead of `a and not a` + --> SIM220.py:1:4 | 1 | if a and not a: | ^^^^^^^^^^^ @@ -16,8 +17,9 @@ error[SIM220]: SIM220.py:1:4: [*] Use `False` instead of `a and not a` 3 3 | 4 4 | if (a and not a) and b: -error[SIM220]: SIM220.py:4:5: [*] Use `False` instead of `a and not a` +error[SIM220]: 4:5: [*] Use `False` instead of `a and not a` + --> SIM220.py:4:5 | 2 | pass 3 | @@ -36,8 +38,9 @@ error[SIM220]: SIM220.py:4:5: [*] Use `False` instead of `a and not a` 6 6 | 7 7 | if (a and not a) or b: -error[SIM220]: SIM220.py:7:5: [*] Use `False` instead of `a and not a` +error[SIM220]: 7:5: [*] Use `False` instead of `a and not a` + --> SIM220.py:7:5 | 5 | pass 6 | diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM221_SIM221.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM221_SIM221.py.snap index 2ebe8b5b15..11c4e0d740 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM221_SIM221.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM221_SIM221.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -error[SIM221]: SIM221.py:1:4: [*] Use `True` instead of `a or not a` +error[SIM221]: 1:4: [*] Use `True` instead of `a or not a` + --> SIM221.py:1:4 | 1 | if a or not a: | ^^^^^^^^^^ @@ -16,8 +17,9 @@ error[SIM221]: SIM221.py:1:4: [*] Use `True` instead of `a or not a` 3 3 | 4 4 | if (a or not a) or b: -error[SIM221]: SIM221.py:4:5: [*] Use `True` instead of `a or not a` +error[SIM221]: 4:5: [*] Use `True` instead of `a or not a` + --> SIM221.py:4:5 | 2 | pass 3 | @@ -36,8 +38,9 @@ error[SIM221]: SIM221.py:4:5: [*] Use `True` instead of `a or not a` 6 6 | 7 7 | if (a or not a) and b: -error[SIM221]: SIM221.py:7:5: [*] Use `True` instead of `a or not a` +error[SIM221]: 7:5: [*] Use `True` instead of `a or not a` + --> SIM221.py:7:5 | 5 | pass 6 | diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM222_SIM222.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM222_SIM222.py.snap index 0cf9032de1..ce0f44c89b 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM222_SIM222.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM222_SIM222.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -error[SIM222]: SIM222.py:1:4: [*] Use `True` instead of `... or True` +error[SIM222]: 1:4: [*] Use `True` instead of `... or True` + --> SIM222.py:1:4 | 1 | if a or True: # SIM222 | ^^^^^^^^^ @@ -16,8 +17,9 @@ error[SIM222]: SIM222.py:1:4: [*] Use `True` instead of `... or True` 3 3 | 4 4 | if (a or b) or True: # SIM222 -error[SIM222]: SIM222.py:4:4: [*] Use `True` instead of `... or True` +error[SIM222]: 4:4: [*] Use `True` instead of `... or True` + --> SIM222.py:4:4 | 2 | pass 3 | @@ -36,8 +38,9 @@ error[SIM222]: SIM222.py:4:4: [*] Use `True` instead of `... or True` 6 6 | 7 7 | if a or (b or True): # SIM222 -error[SIM222]: SIM222.py:7:10: [*] Use `True` instead of `... or True` +error[SIM222]: 7:10: [*] Use `True` instead of `... or True` + --> SIM222.py:7:10 | 5 | pass 6 | @@ -56,8 +59,9 @@ error[SIM222]: SIM222.py:7:10: [*] Use `True` instead of `... or True` 9 9 | 10 10 | if a and True: # OK -error[SIM222]: SIM222.py:24:16: [*] Use `True` instead of `True or ...` +error[SIM222]: 24:16: [*] Use `True` instead of `True or ...` + --> SIM222.py:24:16 | 22 | pass 23 | @@ -76,8 +80,9 @@ error[SIM222]: SIM222.py:24:16: [*] Use `True` instead of `True or ...` 26 26 | 27 27 | if True or f() or a or g() or b: # SIM222 -error[SIM222]: SIM222.py:27:4: [*] Use `True` instead of `True or ...` +error[SIM222]: 27:4: [*] Use `True` instead of `True or ...` + --> SIM222.py:27:4 | 25 | pass 26 | @@ -96,8 +101,9 @@ error[SIM222]: SIM222.py:27:4: [*] Use `True` instead of `True or ...` 29 29 | 30 30 | if a or True or f() or b or g(): # SIM222 -error[SIM222]: SIM222.py:30:4: [*] Use `True` instead of `... or True or ...` +error[SIM222]: 30:4: [*] Use `True` instead of `... or True or ...` + --> SIM222.py:30:4 | 28 | pass 29 | @@ -116,8 +122,9 @@ error[SIM222]: SIM222.py:30:4: [*] Use `True` instead of `... or True or ...` 32 32 | 33 33 | -error[SIM222]: SIM222.py:47:6: [*] Use `True` instead of `... or True` +error[SIM222]: 47:6: [*] Use `True` instead of `... or True` + --> SIM222.py:47:6 | 47 | a or "" or True # SIM222 | ^^^^^^^^^^ @@ -135,8 +142,9 @@ error[SIM222]: SIM222.py:47:6: [*] Use `True` instead of `... or True` 49 49 | a or "foo" or True or "bar" # SIM222 50 50 | -error[SIM222]: SIM222.py:49:6: [*] Use `"foo"` instead of `"foo" or ...` +error[SIM222]: 49:6: [*] Use `"foo"` instead of `"foo" or ...` + --> SIM222.py:49:6 | 47 | a or "" or True # SIM222 48 | @@ -156,8 +164,9 @@ error[SIM222]: SIM222.py:49:6: [*] Use `"foo"` instead of `"foo" or ...` 51 51 | a or 0 or True # SIM222 52 52 | -error[SIM222]: SIM222.py:51:6: [*] Use `True` instead of `... or True` +error[SIM222]: 51:6: [*] Use `True` instead of `... or True` + --> SIM222.py:51:6 | 49 | a or "foo" or True or "bar" # SIM222 50 | @@ -177,8 +186,9 @@ error[SIM222]: SIM222.py:51:6: [*] Use `True` instead of `... or True` 53 53 | a or 1 or True or 2 # SIM222 54 54 | -error[SIM222]: SIM222.py:53:6: [*] Use `1` instead of `1 or ...` +error[SIM222]: 53:6: [*] Use `1` instead of `1 or ...` + --> SIM222.py:53:6 | 51 | a or 0 or True # SIM222 52 | @@ -198,8 +208,9 @@ error[SIM222]: SIM222.py:53:6: [*] Use `1` instead of `1 or ...` 55 55 | a or 0.0 or True # SIM222 56 56 | -error[SIM222]: SIM222.py:55:6: [*] Use `True` instead of `... or True` +error[SIM222]: 55:6: [*] Use `True` instead of `... or True` + --> SIM222.py:55:6 | 53 | a or 1 or True or 2 # SIM222 54 | @@ -219,8 +230,9 @@ error[SIM222]: SIM222.py:55:6: [*] Use `True` instead of `... or True` 57 57 | a or 0.1 or True or 0.2 # SIM222 58 58 | -error[SIM222]: SIM222.py:57:6: [*] Use `0.1` instead of `0.1 or ...` +error[SIM222]: 57:6: [*] Use `0.1` instead of `0.1 or ...` + --> SIM222.py:57:6 | 55 | a or 0.0 or True # SIM222 56 | @@ -240,8 +252,9 @@ error[SIM222]: SIM222.py:57:6: [*] Use `0.1` instead of `0.1 or ...` 59 59 | a or [] or True # SIM222 60 60 | -error[SIM222]: SIM222.py:59:6: [*] Use `True` instead of `... or True` +error[SIM222]: 59:6: [*] Use `True` instead of `... or True` + --> SIM222.py:59:6 | 57 | a or 0.1 or True or 0.2 # SIM222 58 | @@ -261,8 +274,9 @@ error[SIM222]: SIM222.py:59:6: [*] Use `True` instead of `... or True` 61 61 | a or list([]) or True # SIM222 62 62 | -error[SIM222]: SIM222.py:61:6: [*] Use `True` instead of `... or True` +error[SIM222]: 61:6: [*] Use `True` instead of `... or True` + --> SIM222.py:61:6 | 59 | a or [] or True # SIM222 60 | @@ -282,8 +296,9 @@ error[SIM222]: SIM222.py:61:6: [*] Use `True` instead of `... or True` 63 63 | a or [1] or True or [2] # SIM222 64 64 | -error[SIM222]: SIM222.py:63:6: [*] Use `[1]` instead of `[1] or ...` +error[SIM222]: 63:6: [*] Use `[1]` instead of `[1] or ...` + --> SIM222.py:63:6 | 61 | a or list([]) or True # SIM222 62 | @@ -303,8 +318,9 @@ error[SIM222]: SIM222.py:63:6: [*] Use `[1]` instead of `[1] or ...` 65 65 | a or list([1]) or True or list([2]) # SIM222 66 66 | -error[SIM222]: SIM222.py:65:6: [*] Use `list([1])` instead of `list([1]) or ...` +error[SIM222]: 65:6: [*] Use `list([1])` instead of `list([1]) or ...` + --> SIM222.py:65:6 | 63 | a or [1] or True or [2] # SIM222 64 | @@ -324,8 +340,9 @@ error[SIM222]: SIM222.py:65:6: [*] Use `list([1])` instead of `list([1]) or ...` 67 67 | a or {} or True # SIM222 68 68 | -error[SIM222]: SIM222.py:67:6: [*] Use `True` instead of `... or True` +error[SIM222]: 67:6: [*] Use `True` instead of `... or True` + --> SIM222.py:67:6 | 65 | a or list([1]) or True or list([2]) # SIM222 66 | @@ -345,8 +362,9 @@ error[SIM222]: SIM222.py:67:6: [*] Use `True` instead of `... or True` 69 69 | a or dict() or True # SIM222 70 70 | -error[SIM222]: SIM222.py:69:6: [*] Use `True` instead of `... or True` +error[SIM222]: 69:6: [*] Use `True` instead of `... or True` + --> SIM222.py:69:6 | 67 | a or {} or True # SIM222 68 | @@ -366,8 +384,9 @@ error[SIM222]: SIM222.py:69:6: [*] Use `True` instead of `... or True` 71 71 | a or {1: 1} or True or {2: 2} # SIM222 72 72 | -error[SIM222]: SIM222.py:71:6: [*] Use `{1: 1}` instead of `{1: 1} or ...` +error[SIM222]: 71:6: [*] Use `{1: 1}` instead of `{1: 1} or ...` + --> SIM222.py:71:6 | 69 | a or dict() or True # SIM222 70 | @@ -387,8 +406,9 @@ error[SIM222]: SIM222.py:71:6: [*] Use `{1: 1}` instead of `{1: 1} or ...` 73 73 | a or dict({1: 1}) or True or dict({2: 2}) # SIM222 74 74 | -error[SIM222]: SIM222.py:73:6: [*] Use `dict({1: 1})` instead of `dict({1: 1}) or ...` +error[SIM222]: 73:6: [*] Use `dict({1: 1})` instead of `dict({1: 1}) or ...` + --> SIM222.py:73:6 | 71 | a or {1: 1} or True or {2: 2} # SIM222 72 | @@ -408,8 +428,9 @@ error[SIM222]: SIM222.py:73:6: [*] Use `dict({1: 1})` instead of `dict({1: 1}) o 75 75 | a or set() or True # SIM222 76 76 | -error[SIM222]: SIM222.py:75:6: [*] Use `True` instead of `... or True` +error[SIM222]: 75:6: [*] Use `True` instead of `... or True` + --> SIM222.py:75:6 | 73 | a or dict({1: 1}) or True or dict({2: 2}) # SIM222 74 | @@ -429,8 +450,9 @@ error[SIM222]: SIM222.py:75:6: [*] Use `True` instead of `... or True` 77 77 | a or set(set()) or True # SIM222 78 78 | -error[SIM222]: SIM222.py:77:6: [*] Use `True` instead of `... or True` +error[SIM222]: 77:6: [*] Use `True` instead of `... or True` + --> SIM222.py:77:6 | 75 | a or set() or True # SIM222 76 | @@ -450,8 +472,9 @@ error[SIM222]: SIM222.py:77:6: [*] Use `True` instead of `... or True` 79 79 | a or {1} or True or {2} # SIM222 80 80 | -error[SIM222]: SIM222.py:79:6: [*] Use `{1}` instead of `{1} or ...` +error[SIM222]: 79:6: [*] Use `{1}` instead of `{1} or ...` + --> SIM222.py:79:6 | 77 | a or set(set()) or True # SIM222 78 | @@ -471,8 +494,9 @@ error[SIM222]: SIM222.py:79:6: [*] Use `{1}` instead of `{1} or ...` 81 81 | a or set({1}) or True or set({2}) # SIM222 82 82 | -error[SIM222]: SIM222.py:81:6: [*] Use `set({1})` instead of `set({1}) or ...` +error[SIM222]: 81:6: [*] Use `set({1})` instead of `set({1}) or ...` + --> SIM222.py:81:6 | 79 | a or {1} or True or {2} # SIM222 80 | @@ -492,8 +516,9 @@ error[SIM222]: SIM222.py:81:6: [*] Use `set({1})` instead of `set({1}) or ...` 83 83 | a or () or True # SIM222 84 84 | -error[SIM222]: SIM222.py:83:6: [*] Use `True` instead of `... or True` +error[SIM222]: 83:6: [*] Use `True` instead of `... or True` + --> SIM222.py:83:6 | 81 | a or set({1}) or True or set({2}) # SIM222 82 | @@ -513,8 +538,9 @@ error[SIM222]: SIM222.py:83:6: [*] Use `True` instead of `... or True` 85 85 | a or tuple(()) or True # SIM222 86 86 | -error[SIM222]: SIM222.py:85:6: [*] Use `True` instead of `... or True` +error[SIM222]: 85:6: [*] Use `True` instead of `... or True` + --> SIM222.py:85:6 | 83 | a or () or True # SIM222 84 | @@ -534,8 +560,9 @@ error[SIM222]: SIM222.py:85:6: [*] Use `True` instead of `... or True` 87 87 | a or (1,) or True or (2,) # SIM222 88 88 | -error[SIM222]: SIM222.py:87:6: [*] Use `(1,)` instead of `(1,) or ...` +error[SIM222]: 87:6: [*] Use `(1,)` instead of `(1,) or ...` + --> SIM222.py:87:6 | 85 | a or tuple(()) or True # SIM222 86 | @@ -555,8 +582,9 @@ error[SIM222]: SIM222.py:87:6: [*] Use `(1,)` instead of `(1,) or ...` 89 89 | a or tuple((1,)) or True or tuple((2,)) # SIM222 90 90 | -error[SIM222]: SIM222.py:89:6: [*] Use `tuple((1,))` instead of `tuple((1,)) or ...` +error[SIM222]: 89:6: [*] Use `tuple((1,))` instead of `tuple((1,)) or ...` + --> SIM222.py:89:6 | 87 | a or (1,) or True or (2,) # SIM222 88 | @@ -576,8 +604,9 @@ error[SIM222]: SIM222.py:89:6: [*] Use `tuple((1,))` instead of `tuple((1,)) or 91 91 | a or frozenset() or True # SIM222 92 92 | -error[SIM222]: SIM222.py:91:6: [*] Use `True` instead of `... or True` +error[SIM222]: 91:6: [*] Use `True` instead of `... or True` + --> SIM222.py:91:6 | 89 | a or tuple((1,)) or True or tuple((2,)) # SIM222 90 | @@ -597,8 +626,9 @@ error[SIM222]: SIM222.py:91:6: [*] Use `True` instead of `... or True` 93 93 | a or frozenset(frozenset()) or True # SIM222 94 94 | -error[SIM222]: SIM222.py:93:6: [*] Use `True` instead of `... or True` +error[SIM222]: 93:6: [*] Use `True` instead of `... or True` + --> SIM222.py:93:6 | 91 | a or frozenset() or True # SIM222 92 | @@ -618,8 +648,9 @@ error[SIM222]: SIM222.py:93:6: [*] Use `True` instead of `... or True` 95 95 | a or frozenset({1}) or True or frozenset({2}) # SIM222 96 96 | -error[SIM222]: SIM222.py:95:6: [*] Use `frozenset({1})` instead of `frozenset({1}) or ...` +error[SIM222]: 95:6: [*] Use `frozenset({1})` instead of `frozenset({1}) or ...` + --> SIM222.py:95:6 | 93 | a or frozenset(frozenset()) or True # SIM222 94 | @@ -639,8 +670,9 @@ error[SIM222]: SIM222.py:95:6: [*] Use `frozenset({1})` instead of `frozenset({1 97 97 | a or frozenset(frozenset({1})) or True or frozenset(frozenset({2})) # SIM222 98 98 | -error[SIM222]: SIM222.py:97:6: [*] Use `frozenset(frozenset({1}))` instead of `frozenset(frozenset({1})) or ...` +error[SIM222]: 97:6: [*] Use `frozenset(frozenset({1}))` instead of `frozenset(frozenset({1})) or ...` + --> SIM222.py:97:6 | 95 | a or frozenset({1}) or True or frozenset({2}) # SIM222 96 | @@ -658,8 +690,9 @@ error[SIM222]: SIM222.py:97:6: [*] Use `frozenset(frozenset({1}))` instead of `f 99 99 | 100 100 | # Inside test `a` is simplified. -error[SIM222]: SIM222.py:102:6: [*] Use `True` instead of `... or True or ...` +error[SIM222]: 102:6: [*] Use `True` instead of `... or True or ...` + --> SIM222.py:102:6 | 100 | # Inside test `a` is simplified. 101 | @@ -679,8 +712,9 @@ error[SIM222]: SIM222.py:102:6: [*] Use `True` instead of `... or True or ...` 104 104 | assert a or [1] or True or [2] # SIM222 105 105 | -error[SIM222]: SIM222.py:104:8: [*] Use `True` instead of `... or True or ...` +error[SIM222]: 104:8: [*] Use `True` instead of `... or True or ...` + --> SIM222.py:104:8 | 102 | bool(a or [1] or True or [2]) # SIM222 103 | @@ -700,8 +734,9 @@ error[SIM222]: SIM222.py:104:8: [*] Use `True` instead of `... or True or ...` 106 106 | if (a or [1] or True or [2]) and (a or [1] or True or [2]): # SIM222 107 107 | pass -error[SIM222]: SIM222.py:106:5: [*] Use `True` instead of `... or True or ...` +error[SIM222]: 106:5: [*] Use `True` instead of `... or True or ...` + --> SIM222.py:106:5 | 104 | assert a or [1] or True or [2] # SIM222 105 | @@ -720,8 +755,9 @@ error[SIM222]: SIM222.py:106:5: [*] Use `True` instead of `... or True or ...` 108 108 | 109 109 | 0 if a or [1] or True or [2] else 1 # SIM222 -error[SIM222]: SIM222.py:106:35: [*] Use `True` instead of `... or True or ...` +error[SIM222]: 106:35: [*] Use `True` instead of `... or True or ...` + --> SIM222.py:106:35 | 104 | assert a or [1] or True or [2] # SIM222 105 | @@ -740,8 +776,9 @@ error[SIM222]: SIM222.py:106:35: [*] Use `True` instead of `... or True or ...` 108 108 | 109 109 | 0 if a or [1] or True or [2] else 1 # SIM222 -error[SIM222]: SIM222.py:109:6: [*] Use `True` instead of `... or True or ...` +error[SIM222]: 109:6: [*] Use `True` instead of `... or True or ...` + --> SIM222.py:109:6 | 107 | pass 108 | @@ -761,8 +798,9 @@ error[SIM222]: SIM222.py:109:6: [*] Use `True` instead of `... or True or ...` 111 111 | while a or [1] or True or [2]: # SIM222 112 112 | pass -error[SIM222]: SIM222.py:111:7: [*] Use `True` instead of `... or True or ...` +error[SIM222]: 111:7: [*] Use `True` instead of `... or True or ...` + --> SIM222.py:111:7 | 109 | 0 if a or [1] or True or [2] else 1 # SIM222 110 | @@ -781,8 +819,9 @@ error[SIM222]: SIM222.py:111:7: [*] Use `True` instead of `... or True or ...` 113 113 | 114 114 | [ -error[SIM222]: SIM222.py:118:8: [*] Use `True` instead of `... or True or ...` +error[SIM222]: 118:8: [*] Use `True` instead of `... or True or ...` + --> SIM222.py:118:8 | 116 | for a in range(10) 117 | for b in range(10) @@ -802,8 +841,9 @@ error[SIM222]: SIM222.py:118:8: [*] Use `True` instead of `... or True or ...` 120 120 | ] 121 121 | -error[SIM222]: SIM222.py:119:8: [*] Use `True` instead of `... or True or ...` +error[SIM222]: 119:8: [*] Use `True` instead of `... or True or ...` + --> SIM222.py:119:8 | 117 | for b in range(10) 118 | if a or [1] or True or [2] # SIM222 @@ -822,8 +862,9 @@ error[SIM222]: SIM222.py:119:8: [*] Use `True` instead of `... or True or ...` 121 121 | 122 122 | { -error[SIM222]: SIM222.py:126:8: [*] Use `True` instead of `... or True or ...` +error[SIM222]: 126:8: [*] Use `True` instead of `... or True or ...` + --> SIM222.py:126:8 | 124 | for a in range(10) 125 | for b in range(10) @@ -843,8 +884,9 @@ error[SIM222]: SIM222.py:126:8: [*] Use `True` instead of `... or True or ...` 128 128 | } 129 129 | -error[SIM222]: SIM222.py:127:8: [*] Use `True` instead of `... or True or ...` +error[SIM222]: 127:8: [*] Use `True` instead of `... or True or ...` + --> SIM222.py:127:8 | 125 | for b in range(10) 126 | if a or [1] or True or [2] # SIM222 @@ -863,8 +905,9 @@ error[SIM222]: SIM222.py:127:8: [*] Use `True` instead of `... or True or ...` 129 129 | 130 130 | { -error[SIM222]: SIM222.py:134:8: [*] Use `True` instead of `... or True or ...` +error[SIM222]: 134:8: [*] Use `True` instead of `... or True or ...` + --> SIM222.py:134:8 | 132 | for a in range(10) 133 | for b in range(10) @@ -884,8 +927,9 @@ error[SIM222]: SIM222.py:134:8: [*] Use `True` instead of `... or True or ...` 136 136 | } 137 137 | -error[SIM222]: SIM222.py:135:8: [*] Use `True` instead of `... or True or ...` +error[SIM222]: 135:8: [*] Use `True` instead of `... or True or ...` + --> SIM222.py:135:8 | 133 | for b in range(10) 134 | if a or [1] or True or [2] # SIM222 @@ -904,8 +948,9 @@ error[SIM222]: SIM222.py:135:8: [*] Use `True` instead of `... or True or ...` 137 137 | 138 138 | ( -error[SIM222]: SIM222.py:142:8: [*] Use `True` instead of `... or True or ...` +error[SIM222]: 142:8: [*] Use `True` instead of `... or True or ...` + --> SIM222.py:142:8 | 140 | for a in range(10) 141 | for b in range(10) @@ -925,8 +970,9 @@ error[SIM222]: SIM222.py:142:8: [*] Use `True` instead of `... or True or ...` 144 144 | ) 145 145 | -error[SIM222]: SIM222.py:143:8: [*] Use `True` instead of `... or True or ...` +error[SIM222]: 143:8: [*] Use `True` instead of `... or True or ...` + --> SIM222.py:143:8 | 141 | for b in range(10) 142 | if a or [1] or True or [2] # SIM222 @@ -945,8 +991,9 @@ error[SIM222]: SIM222.py:143:8: [*] Use `True` instead of `... or True or ...` 145 145 | 146 146 | # Outside test `a` is not simplified. -error[SIM222]: SIM222.py:148:6: [*] Use `[1]` instead of `[1] or ...` +error[SIM222]: 148:6: [*] Use `[1]` instead of `[1] or ...` + --> SIM222.py:148:6 | 146 | # Outside test `a` is not simplified. 147 | @@ -966,8 +1013,9 @@ error[SIM222]: SIM222.py:148:6: [*] Use `[1]` instead of `[1] or ...` 150 150 | if (a or [1] or True or [2]) == (a or [1]): # SIM222 151 151 | pass -error[SIM222]: SIM222.py:150:10: [*] Use `[1]` instead of `[1] or ...` +error[SIM222]: 150:10: [*] Use `[1]` instead of `[1] or ...` + --> SIM222.py:150:10 | 148 | a or [1] or True or [2] # SIM222 149 | @@ -986,8 +1034,9 @@ error[SIM222]: SIM222.py:150:10: [*] Use `[1]` instead of `[1] or ...` 152 152 | 153 153 | if f(a or [1] or True or [2]): # SIM222 -error[SIM222]: SIM222.py:153:11: [*] Use `[1]` instead of `[1] or ...` +error[SIM222]: 153:11: [*] Use `[1]` instead of `[1] or ...` + --> SIM222.py:153:11 | 151 | pass 152 | @@ -1006,8 +1055,9 @@ error[SIM222]: SIM222.py:153:11: [*] Use `[1]` instead of `[1] or ...` 155 155 | 156 156 | # Regression test for: https://github.com/astral-sh/ruff/issues/7099 -error[SIM222]: SIM222.py:157:30: [*] Use `(int, int, int)` instead of `(int, int, int) or ...` +error[SIM222]: 157:30: [*] Use `(int, int, int)` instead of `(int, int, int) or ...` + --> SIM222.py:157:30 | 156 | # Regression test for: https://github.com/astral-sh/ruff/issues/7099 157 | def secondToTime(s0: int) -> (int, int, int) or str: @@ -1025,8 +1075,9 @@ error[SIM222]: SIM222.py:157:30: [*] Use `(int, int, int)` instead of `(int, int 159 159 | 160 160 | -error[SIM222]: SIM222.py:161:31: [*] Use `(int, int, int)` instead of `(int, int, int) or ...` +error[SIM222]: 161:31: [*] Use `(int, int, int)` instead of `(int, int, int) or ...` + --> SIM222.py:161:31 | 161 | def secondToTime(s0: int) -> ((int, int, int) or str): | ^^^^^^^^^^^^^^^^^^^^^^ @@ -1043,8 +1094,9 @@ error[SIM222]: SIM222.py:161:31: [*] Use `(int, int, int)` instead of `(int, int 163 163 | 164 164 | -error[SIM222]: SIM222.py:168:7: [*] Use `"bar"` instead of `... or "bar"` +error[SIM222]: 168:7: [*] Use `"bar"` instead of `... or "bar"` + --> SIM222.py:168:7 | 166 | print(f"{a}{b}" or "bar") 167 | print(f"{a}{''}" or "bar") diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM223_SIM223.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM223_SIM223.py.snap index 6195252be2..476ad43679 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM223_SIM223.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM223_SIM223.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -error[SIM223]: SIM223.py:1:4: [*] Use `False` instead of `... and False` +error[SIM223]: 1:4: [*] Use `False` instead of `... and False` + --> SIM223.py:1:4 | 1 | if a and False: # SIM223 | ^^^^^^^^^^^ @@ -16,8 +17,9 @@ error[SIM223]: SIM223.py:1:4: [*] Use `False` instead of `... and False` 3 3 | 4 4 | if (a or b) and False: # SIM223 -error[SIM223]: SIM223.py:4:4: [*] Use `False` instead of `... and False` +error[SIM223]: 4:4: [*] Use `False` instead of `... and False` + --> SIM223.py:4:4 | 2 | pass 3 | @@ -36,8 +38,9 @@ error[SIM223]: SIM223.py:4:4: [*] Use `False` instead of `... and False` 6 6 | 7 7 | if a or (b and False): # SIM223 -error[SIM223]: SIM223.py:7:10: [*] Use `False` instead of `... and False` +error[SIM223]: 7:10: [*] Use `False` instead of `... and False` + --> SIM223.py:7:10 | 5 | pass 6 | @@ -56,8 +59,9 @@ error[SIM223]: SIM223.py:7:10: [*] Use `False` instead of `... and False` 9 9 | 10 10 | if a or False: -error[SIM223]: SIM223.py:19:18: [*] Use `False` instead of `False and ...` +error[SIM223]: 19:18: [*] Use `False` instead of `False and ...` + --> SIM223.py:19:18 | 17 | pass 18 | @@ -76,8 +80,9 @@ error[SIM223]: SIM223.py:19:18: [*] Use `False` instead of `False and ...` 21 21 | 22 22 | if False and f() and a and g() and b: # SIM223 -error[SIM223]: SIM223.py:22:4: [*] Use `False` instead of `False and ...` +error[SIM223]: 22:4: [*] Use `False` instead of `False and ...` + --> SIM223.py:22:4 | 20 | pass 21 | @@ -96,8 +101,9 @@ error[SIM223]: SIM223.py:22:4: [*] Use `False` instead of `False and ...` 24 24 | 25 25 | if a and False and f() and b and g(): # SIM223 -error[SIM223]: SIM223.py:25:4: [*] Use `False` instead of `... and False and ...` +error[SIM223]: 25:4: [*] Use `False` instead of `... and False and ...` + --> SIM223.py:25:4 | 23 | pass 24 | @@ -116,8 +122,9 @@ error[SIM223]: SIM223.py:25:4: [*] Use `False` instead of `... and False and ... 27 27 | 28 28 | -error[SIM223]: SIM223.py:42:7: [*] Use `""` instead of `"" and ...` +error[SIM223]: 42:7: [*] Use `""` instead of `"" and ...` + --> SIM223.py:42:7 | 42 | a and "" and False # SIM223 | ^^^^^^^^^^^^ @@ -135,8 +142,9 @@ error[SIM223]: SIM223.py:42:7: [*] Use `""` instead of `"" and ...` 44 44 | a and "foo" and False and "bar" # SIM223 45 45 | -error[SIM223]: SIM223.py:44:7: [*] Use `False` instead of `... and False and ...` +error[SIM223]: 44:7: [*] Use `False` instead of `... and False and ...` + --> SIM223.py:44:7 | 42 | a and "" and False # SIM223 43 | @@ -156,8 +164,9 @@ error[SIM223]: SIM223.py:44:7: [*] Use `False` instead of `... and False and ... 46 46 | a and 0 and False # SIM223 47 47 | -error[SIM223]: SIM223.py:46:7: [*] Use `0` instead of `0 and ...` +error[SIM223]: 46:7: [*] Use `0` instead of `0 and ...` + --> SIM223.py:46:7 | 44 | a and "foo" and False and "bar" # SIM223 45 | @@ -177,8 +186,9 @@ error[SIM223]: SIM223.py:46:7: [*] Use `0` instead of `0 and ...` 48 48 | a and 1 and False and 2 # SIM223 49 49 | -error[SIM223]: SIM223.py:48:7: [*] Use `False` instead of `... and False and ...` +error[SIM223]: 48:7: [*] Use `False` instead of `... and False and ...` + --> SIM223.py:48:7 | 46 | a and 0 and False # SIM223 47 | @@ -198,8 +208,9 @@ error[SIM223]: SIM223.py:48:7: [*] Use `False` instead of `... and False and ... 50 50 | a and 0.0 and False # SIM223 51 51 | -error[SIM223]: SIM223.py:50:7: [*] Use `0.0` instead of `0.0 and ...` +error[SIM223]: 50:7: [*] Use `0.0` instead of `0.0 and ...` + --> SIM223.py:50:7 | 48 | a and 1 and False and 2 # SIM223 49 | @@ -219,8 +230,9 @@ error[SIM223]: SIM223.py:50:7: [*] Use `0.0` instead of `0.0 and ...` 52 52 | a and 0.1 and False and 0.2 # SIM223 53 53 | -error[SIM223]: SIM223.py:52:7: [*] Use `False` instead of `... and False and ...` +error[SIM223]: 52:7: [*] Use `False` instead of `... and False and ...` + --> SIM223.py:52:7 | 50 | a and 0.0 and False # SIM223 51 | @@ -240,8 +252,9 @@ error[SIM223]: SIM223.py:52:7: [*] Use `False` instead of `... and False and ... 54 54 | a and [] and False # SIM223 55 55 | -error[SIM223]: SIM223.py:54:7: [*] Use `[]` instead of `[] and ...` +error[SIM223]: 54:7: [*] Use `[]` instead of `[] and ...` + --> SIM223.py:54:7 | 52 | a and 0.1 and False and 0.2 # SIM223 53 | @@ -261,8 +274,9 @@ error[SIM223]: SIM223.py:54:7: [*] Use `[]` instead of `[] and ...` 56 56 | a and list([]) and False # SIM223 57 57 | -error[SIM223]: SIM223.py:56:7: [*] Use `list([])` instead of `list([]) and ...` +error[SIM223]: 56:7: [*] Use `list([])` instead of `list([]) and ...` + --> SIM223.py:56:7 | 54 | a and [] and False # SIM223 55 | @@ -282,8 +296,9 @@ error[SIM223]: SIM223.py:56:7: [*] Use `list([])` instead of `list([]) and ...` 58 58 | a and [1] and False and [2] # SIM223 59 59 | -error[SIM223]: SIM223.py:58:7: [*] Use `False` instead of `... and False and ...` +error[SIM223]: 58:7: [*] Use `False` instead of `... and False and ...` + --> SIM223.py:58:7 | 56 | a and list([]) and False # SIM223 57 | @@ -303,8 +318,9 @@ error[SIM223]: SIM223.py:58:7: [*] Use `False` instead of `... and False and ... 60 60 | a and list([1]) and False and list([2]) # SIM223 61 61 | -error[SIM223]: SIM223.py:60:7: [*] Use `False` instead of `... and False and ...` +error[SIM223]: 60:7: [*] Use `False` instead of `... and False and ...` + --> SIM223.py:60:7 | 58 | a and [1] and False and [2] # SIM223 59 | @@ -324,8 +340,9 @@ error[SIM223]: SIM223.py:60:7: [*] Use `False` instead of `... and False and ... 62 62 | a and {} and False # SIM223 63 63 | -error[SIM223]: SIM223.py:62:7: [*] Use `{}` instead of `{} and ...` +error[SIM223]: 62:7: [*] Use `{}` instead of `{} and ...` + --> SIM223.py:62:7 | 60 | a and list([1]) and False and list([2]) # SIM223 61 | @@ -345,8 +362,9 @@ error[SIM223]: SIM223.py:62:7: [*] Use `{}` instead of `{} and ...` 64 64 | a and dict() and False # SIM223 65 65 | -error[SIM223]: SIM223.py:64:7: [*] Use `dict()` instead of `dict() and ...` +error[SIM223]: 64:7: [*] Use `dict()` instead of `dict() and ...` + --> SIM223.py:64:7 | 62 | a and {} and False # SIM223 63 | @@ -366,8 +384,9 @@ error[SIM223]: SIM223.py:64:7: [*] Use `dict()` instead of `dict() and ...` 66 66 | a and {1: 1} and False and {2: 2} # SIM223 67 67 | -error[SIM223]: SIM223.py:66:7: [*] Use `False` instead of `... and False and ...` +error[SIM223]: 66:7: [*] Use `False` instead of `... and False and ...` + --> SIM223.py:66:7 | 64 | a and dict() and False # SIM223 65 | @@ -387,8 +406,9 @@ error[SIM223]: SIM223.py:66:7: [*] Use `False` instead of `... and False and ... 68 68 | a and dict({1: 1}) and False and dict({2: 2}) # SIM223 69 69 | -error[SIM223]: SIM223.py:68:7: [*] Use `False` instead of `... and False and ...` +error[SIM223]: 68:7: [*] Use `False` instead of `... and False and ...` + --> SIM223.py:68:7 | 66 | a and {1: 1} and False and {2: 2} # SIM223 67 | @@ -408,8 +428,9 @@ error[SIM223]: SIM223.py:68:7: [*] Use `False` instead of `... and False and ... 70 70 | a and set() and False # SIM223 71 71 | -error[SIM223]: SIM223.py:70:7: [*] Use `set()` instead of `set() and ...` +error[SIM223]: 70:7: [*] Use `set()` instead of `set() and ...` + --> SIM223.py:70:7 | 68 | a and dict({1: 1}) and False and dict({2: 2}) # SIM223 69 | @@ -429,8 +450,9 @@ error[SIM223]: SIM223.py:70:7: [*] Use `set()` instead of `set() and ...` 72 72 | a and set(set()) and False # SIM223 73 73 | -error[SIM223]: SIM223.py:72:7: [*] Use `set(set())` instead of `set(set()) and ...` +error[SIM223]: 72:7: [*] Use `set(set())` instead of `set(set()) and ...` + --> SIM223.py:72:7 | 70 | a and set() and False # SIM223 71 | @@ -450,8 +472,9 @@ error[SIM223]: SIM223.py:72:7: [*] Use `set(set())` instead of `set(set()) and . 74 74 | a and {1} and False and {2} # SIM223 75 75 | -error[SIM223]: SIM223.py:74:7: [*] Use `False` instead of `... and False and ...` +error[SIM223]: 74:7: [*] Use `False` instead of `... and False and ...` + --> SIM223.py:74:7 | 72 | a and set(set()) and False # SIM223 73 | @@ -471,8 +494,9 @@ error[SIM223]: SIM223.py:74:7: [*] Use `False` instead of `... and False and ... 76 76 | a and set({1}) and False and set({2}) # SIM223 77 77 | -error[SIM223]: SIM223.py:76:7: [*] Use `False` instead of `... and False and ...` +error[SIM223]: 76:7: [*] Use `False` instead of `... and False and ...` + --> SIM223.py:76:7 | 74 | a and {1} and False and {2} # SIM223 75 | @@ -492,8 +516,9 @@ error[SIM223]: SIM223.py:76:7: [*] Use `False` instead of `... and False and ... 78 78 | a and () and False # SIM222 79 79 | -error[SIM223]: SIM223.py:78:7: [*] Use `()` instead of `() and ...` +error[SIM223]: 78:7: [*] Use `()` instead of `() and ...` + --> SIM223.py:78:7 | 76 | a and set({1}) and False and set({2}) # SIM223 77 | @@ -513,8 +538,9 @@ error[SIM223]: SIM223.py:78:7: [*] Use `()` instead of `() and ...` 80 80 | a and tuple(()) and False # SIM222 81 81 | -error[SIM223]: SIM223.py:80:7: [*] Use `tuple(())` instead of `tuple(()) and ...` +error[SIM223]: 80:7: [*] Use `tuple(())` instead of `tuple(()) and ...` + --> SIM223.py:80:7 | 78 | a and () and False # SIM222 79 | @@ -534,8 +560,9 @@ error[SIM223]: SIM223.py:80:7: [*] Use `tuple(())` instead of `tuple(()) and ... 82 82 | a and (1,) and False and (2,) # SIM222 83 83 | -error[SIM223]: SIM223.py:82:7: [*] Use `False` instead of `... and False and ...` +error[SIM223]: 82:7: [*] Use `False` instead of `... and False and ...` + --> SIM223.py:82:7 | 80 | a and tuple(()) and False # SIM222 81 | @@ -555,8 +582,9 @@ error[SIM223]: SIM223.py:82:7: [*] Use `False` instead of `... and False and ... 84 84 | a and tuple((1,)) and False and tuple((2,)) # SIM222 85 85 | -error[SIM223]: SIM223.py:84:7: [*] Use `False` instead of `... and False and ...` +error[SIM223]: 84:7: [*] Use `False` instead of `... and False and ...` + --> SIM223.py:84:7 | 82 | a and (1,) and False and (2,) # SIM222 83 | @@ -576,8 +604,9 @@ error[SIM223]: SIM223.py:84:7: [*] Use `False` instead of `... and False and ... 86 86 | a and frozenset() and False # SIM222 87 87 | -error[SIM223]: SIM223.py:86:7: [*] Use `frozenset()` instead of `frozenset() and ...` +error[SIM223]: 86:7: [*] Use `frozenset()` instead of `frozenset() and ...` + --> SIM223.py:86:7 | 84 | a and tuple((1,)) and False and tuple((2,)) # SIM222 85 | @@ -597,8 +626,9 @@ error[SIM223]: SIM223.py:86:7: [*] Use `frozenset()` instead of `frozenset() and 88 88 | a and frozenset(frozenset()) and False # SIM222 89 89 | -error[SIM223]: SIM223.py:88:7: [*] Use `frozenset(frozenset())` instead of `frozenset(frozenset()) and ...` +error[SIM223]: 88:7: [*] Use `frozenset(frozenset())` instead of `frozenset(frozenset()) and ...` + --> SIM223.py:88:7 | 86 | a and frozenset() and False # SIM222 87 | @@ -618,8 +648,9 @@ error[SIM223]: SIM223.py:88:7: [*] Use `frozenset(frozenset())` instead of `froz 90 90 | a and frozenset({1}) and False and frozenset({2}) # SIM222 91 91 | -error[SIM223]: SIM223.py:90:7: [*] Use `False` instead of `... and False and ...` +error[SIM223]: 90:7: [*] Use `False` instead of `... and False and ...` + --> SIM223.py:90:7 | 88 | a and frozenset(frozenset()) and False # SIM222 89 | @@ -639,8 +670,9 @@ error[SIM223]: SIM223.py:90:7: [*] Use `False` instead of `... and False and ... 92 92 | a and frozenset(frozenset({1})) and False and frozenset(frozenset({2})) # SIM222 93 93 | -error[SIM223]: SIM223.py:92:7: [*] Use `False` instead of `... and False and ...` +error[SIM223]: 92:7: [*] Use `False` instead of `... and False and ...` + --> SIM223.py:92:7 | 90 | a and frozenset({1}) and False and frozenset({2}) # SIM222 91 | @@ -658,8 +690,9 @@ error[SIM223]: SIM223.py:92:7: [*] Use `False` instead of `... and False and ... 94 94 | 95 95 | # Inside test `a` is simplified. -error[SIM223]: SIM223.py:97:6: [*] Use `False` instead of `... and False and ...` +error[SIM223]: 97:6: [*] Use `False` instead of `... and False and ...` + --> SIM223.py:97:6 | 95 | # Inside test `a` is simplified. 96 | @@ -679,8 +712,9 @@ error[SIM223]: SIM223.py:97:6: [*] Use `False` instead of `... and False and ... 99 99 | assert a and [] and False and [] # SIM223 100 100 | -error[SIM223]: SIM223.py:99:8: [*] Use `False` instead of `... and False and ...` +error[SIM223]: 99:8: [*] Use `False` instead of `... and False and ...` + --> SIM223.py:99:8 | 97 | bool(a and [] and False and []) # SIM223 98 | @@ -700,8 +734,9 @@ error[SIM223]: SIM223.py:99:8: [*] Use `False` instead of `... and False and ... 101 101 | if (a and [] and False and []) or (a and [] and False and []): # SIM223 102 102 | pass -error[SIM223]: SIM223.py:101:5: [*] Use `False` instead of `... and False and ...` +error[SIM223]: 101:5: [*] Use `False` instead of `... and False and ...` + --> SIM223.py:101:5 | 99 | assert a and [] and False and [] # SIM223 100 | @@ -720,8 +755,9 @@ error[SIM223]: SIM223.py:101:5: [*] Use `False` instead of `... and False and .. 103 103 | 104 104 | 0 if a and [] and False and [] else 1 # SIM222 -error[SIM223]: SIM223.py:101:36: [*] Use `False` instead of `... and False and ...` +error[SIM223]: 101:36: [*] Use `False` instead of `... and False and ...` + --> SIM223.py:101:36 | 99 | assert a and [] and False and [] # SIM223 100 | @@ -740,8 +776,9 @@ error[SIM223]: SIM223.py:101:36: [*] Use `False` instead of `... and False and . 103 103 | 104 104 | 0 if a and [] and False and [] else 1 # SIM222 -error[SIM223]: SIM223.py:104:6: [*] Use `False` instead of `... and False and ...` +error[SIM223]: 104:6: [*] Use `False` instead of `... and False and ...` + --> SIM223.py:104:6 | 102 | pass 103 | @@ -761,8 +798,9 @@ error[SIM223]: SIM223.py:104:6: [*] Use `False` instead of `... and False and .. 106 106 | while a and [] and False and []: # SIM223 107 107 | pass -error[SIM223]: SIM223.py:106:7: [*] Use `False` instead of `... and False and ...` +error[SIM223]: 106:7: [*] Use `False` instead of `... and False and ...` + --> SIM223.py:106:7 | 104 | 0 if a and [] and False and [] else 1 # SIM222 105 | @@ -781,8 +819,9 @@ error[SIM223]: SIM223.py:106:7: [*] Use `False` instead of `... and False and .. 108 108 | 109 109 | [ -error[SIM223]: SIM223.py:113:8: [*] Use `False` instead of `... and False and ...` +error[SIM223]: 113:8: [*] Use `False` instead of `... and False and ...` + --> SIM223.py:113:8 | 111 | for a in range(10) 112 | for b in range(10) @@ -802,8 +841,9 @@ error[SIM223]: SIM223.py:113:8: [*] Use `False` instead of `... and False and .. 115 115 | ] 116 116 | -error[SIM223]: SIM223.py:114:8: [*] Use `False` instead of `... and False and ...` +error[SIM223]: 114:8: [*] Use `False` instead of `... and False and ...` + --> SIM223.py:114:8 | 112 | for b in range(10) 113 | if a and [] and False and [] # SIM223 @@ -822,8 +862,9 @@ error[SIM223]: SIM223.py:114:8: [*] Use `False` instead of `... and False and .. 116 116 | 117 117 | { -error[SIM223]: SIM223.py:121:8: [*] Use `False` instead of `... and False and ...` +error[SIM223]: 121:8: [*] Use `False` instead of `... and False and ...` + --> SIM223.py:121:8 | 119 | for a in range(10) 120 | for b in range(10) @@ -843,8 +884,9 @@ error[SIM223]: SIM223.py:121:8: [*] Use `False` instead of `... and False and .. 123 123 | } 124 124 | -error[SIM223]: SIM223.py:122:8: [*] Use `False` instead of `... and False and ...` +error[SIM223]: 122:8: [*] Use `False` instead of `... and False and ...` + --> SIM223.py:122:8 | 120 | for b in range(10) 121 | if a and [] and False and [] # SIM223 @@ -863,8 +905,9 @@ error[SIM223]: SIM223.py:122:8: [*] Use `False` instead of `... and False and .. 124 124 | 125 125 | { -error[SIM223]: SIM223.py:129:8: [*] Use `False` instead of `... and False and ...` +error[SIM223]: 129:8: [*] Use `False` instead of `... and False and ...` + --> SIM223.py:129:8 | 127 | for a in range(10) 128 | for b in range(10) @@ -884,8 +927,9 @@ error[SIM223]: SIM223.py:129:8: [*] Use `False` instead of `... and False and .. 131 131 | } 132 132 | -error[SIM223]: SIM223.py:130:8: [*] Use `False` instead of `... and False and ...` +error[SIM223]: 130:8: [*] Use `False` instead of `... and False and ...` + --> SIM223.py:130:8 | 128 | for b in range(10) 129 | if a and [] and False and [] # SIM223 @@ -904,8 +948,9 @@ error[SIM223]: SIM223.py:130:8: [*] Use `False` instead of `... and False and .. 132 132 | 133 133 | ( -error[SIM223]: SIM223.py:137:8: [*] Use `False` instead of `... and False and ...` +error[SIM223]: 137:8: [*] Use `False` instead of `... and False and ...` + --> SIM223.py:137:8 | 135 | for a in range(10) 136 | for b in range(10) @@ -925,8 +970,9 @@ error[SIM223]: SIM223.py:137:8: [*] Use `False` instead of `... and False and .. 139 139 | ) 140 140 | -error[SIM223]: SIM223.py:138:8: [*] Use `False` instead of `... and False and ...` +error[SIM223]: 138:8: [*] Use `False` instead of `... and False and ...` + --> SIM223.py:138:8 | 136 | for b in range(10) 137 | if a and [] and False and [] # SIM223 @@ -945,8 +991,9 @@ error[SIM223]: SIM223.py:138:8: [*] Use `False` instead of `... and False and .. 140 140 | 141 141 | # Outside test `a` is not simplified. -error[SIM223]: SIM223.py:143:7: [*] Use `[]` instead of `[] and ...` +error[SIM223]: 143:7: [*] Use `[]` instead of `[] and ...` + --> SIM223.py:143:7 | 141 | # Outside test `a` is not simplified. 142 | @@ -966,8 +1013,9 @@ error[SIM223]: SIM223.py:143:7: [*] Use `[]` instead of `[] and ...` 145 145 | if (a and [] and False and []) == (a and []): # SIM223 146 146 | pass -error[SIM223]: SIM223.py:145:11: [*] Use `[]` instead of `[] and ...` +error[SIM223]: 145:11: [*] Use `[]` instead of `[] and ...` + --> SIM223.py:145:11 | 143 | a and [] and False and [] # SIM223 144 | @@ -986,8 +1034,9 @@ error[SIM223]: SIM223.py:145:11: [*] Use `[]` instead of `[] and ...` 147 147 | 148 148 | if f(a and [] and False and []): # SIM223 -error[SIM223]: SIM223.py:148:12: [*] Use `[]` instead of `[] and ...` +error[SIM223]: 148:12: [*] Use `[]` instead of `[] and ...` + --> SIM223.py:148:12 | 146 | pass 147 | @@ -1006,8 +1055,9 @@ error[SIM223]: SIM223.py:148:12: [*] Use `[]` instead of `[] and ...` 150 150 | 151 151 | # Regression test for: https://github.com/astral-sh/ruff/issues/9479 -error[SIM223]: SIM223.py:154:7: [*] Use `f"{''}{''}"` instead of `f"{''}{''}" and ...` +error[SIM223]: 154:7: [*] Use `f"{''}{''}"` instead of `f"{''}{''}" and ...` + --> SIM223.py:154:7 | 152 | print(f"{a}{b}" and "bar") 153 | print(f"{a}{''}" and "bar") diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM300_SIM300.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM300_SIM300.py.snap index 8af686ef85..259dc01807 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM300_SIM300.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM300_SIM300.py.snap @@ -1,16 +1,17 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -SIM300.py:2:1: SIM300 [*] Yoda condition detected +error[SIM300]: 2:1: [*] Yoda condition detected + + --> SIM300.py:1:9 | 1 | # Errors 2 | "yoda" == compare # SIM300 - | ^^^^^^^^^^^^^^^^^ SIM300 + | ^^^^^^^^^^^^^^^^^ 3 | 42 == age # SIM300 4 | ("a", "b") == compare # SIM300 | = help: Rewrite as `compare == "yoda"` - ℹ Safe fix 1 1 | # Errors 2 |-"yoda" == compare # SIM300 @@ -19,17 +20,18 @@ SIM300.py:2:1: SIM300 [*] Yoda condition detected 4 4 | ("a", "b") == compare # SIM300 5 5 | "yoda" <= compare # SIM300 -SIM300.py:3:1: SIM300 [*] Yoda condition detected +error[SIM300]: 3:1: [*] Yoda condition detected + + --> SIM300.py:2:28 | 1 | # Errors 2 | "yoda" == compare # SIM300 3 | 42 == age # SIM300 - | ^^^^^^^^^ SIM300 + | ^^^^^^^^^ 4 | ("a", "b") == compare # SIM300 5 | "yoda" <= compare # SIM300 | = help: Rewrite as `age == 42` - ℹ Safe fix 1 1 | # Errors 2 2 | "yoda" == compare # SIM300 @@ -39,17 +41,18 @@ SIM300.py:3:1: SIM300 [*] Yoda condition detected 5 5 | "yoda" <= compare # SIM300 6 6 | "yoda" < compare # SIM300 -SIM300.py:4:1: SIM300 [*] Yoda condition detected +error[SIM300]: 4:1: [*] Yoda condition detected + + --> SIM300.py:3:20 | 2 | "yoda" == compare # SIM300 3 | 42 == age # SIM300 4 | ("a", "b") == compare # SIM300 - | ^^^^^^^^^^^^^^^^^^^^^ SIM300 + | ^^^^^^^^^^^^^^^^^^^^^ 5 | "yoda" <= compare # SIM300 6 | "yoda" < compare # SIM300 | = help: Rewrite as `compare == ("a", "b")` - ℹ Safe fix 1 1 | # Errors 2 2 | "yoda" == compare # SIM300 @@ -60,17 +63,18 @@ SIM300.py:4:1: SIM300 [*] Yoda condition detected 6 6 | "yoda" < compare # SIM300 7 7 | 42 > age # SIM300 -SIM300.py:5:1: SIM300 [*] Yoda condition detected +error[SIM300]: 5:1: [*] Yoda condition detected + + --> SIM300.py:4:32 | 3 | 42 == age # SIM300 4 | ("a", "b") == compare # SIM300 5 | "yoda" <= compare # SIM300 - | ^^^^^^^^^^^^^^^^^ SIM300 + | ^^^^^^^^^^^^^^^^^ 6 | "yoda" < compare # SIM300 7 | 42 > age # SIM300 | = help: Rewrite as `compare >= "yoda"` - ℹ Safe fix 2 2 | "yoda" == compare # SIM300 3 3 | 42 == age # SIM300 @@ -81,17 +85,18 @@ SIM300.py:5:1: SIM300 [*] Yoda condition detected 7 7 | 42 > age # SIM300 8 8 | -42 > age # SIM300 -SIM300.py:6:1: SIM300 [*] Yoda condition detected +error[SIM300]: 6:1: [*] Yoda condition detected + + --> SIM300.py:5:28 | 4 | ("a", "b") == compare # SIM300 5 | "yoda" <= compare # SIM300 6 | "yoda" < compare # SIM300 - | ^^^^^^^^^^^^^^^^ SIM300 + | ^^^^^^^^^^^^^^^^ 7 | 42 > age # SIM300 8 | -42 > age # SIM300 | = help: Rewrite as `compare > "yoda"` - ℹ Safe fix 3 3 | 42 == age # SIM300 4 4 | ("a", "b") == compare # SIM300 @@ -102,17 +107,18 @@ SIM300.py:6:1: SIM300 [*] Yoda condition detected 8 8 | -42 > age # SIM300 9 9 | +42 > age # SIM300 -SIM300.py:7:1: SIM300 [*] Yoda condition detected +error[SIM300]: 7:1: [*] Yoda condition detected + + --> SIM300.py:6:27 | 5 | "yoda" <= compare # SIM300 6 | "yoda" < compare # SIM300 7 | 42 > age # SIM300 - | ^^^^^^^^ SIM300 + | ^^^^^^^^ 8 | -42 > age # SIM300 9 | +42 > age # SIM300 | = help: Rewrite as `age < 42` - ℹ Safe fix 4 4 | ("a", "b") == compare # SIM300 5 5 | "yoda" <= compare # SIM300 @@ -123,17 +129,18 @@ SIM300.py:7:1: SIM300 [*] Yoda condition detected 9 9 | +42 > age # SIM300 10 10 | YODA == age # SIM300 -SIM300.py:8:1: SIM300 [*] Yoda condition detected +error[SIM300]: 8:1: [*] Yoda condition detected + + --> SIM300.py:7:19 | 6 | "yoda" < compare # SIM300 7 | 42 > age # SIM300 8 | -42 > age # SIM300 - | ^^^^^^^^^ SIM300 + | ^^^^^^^^^ 9 | +42 > age # SIM300 10 | YODA == age # SIM300 | = help: Rewrite as `age < -42` - ℹ Safe fix 5 5 | "yoda" <= compare # SIM300 6 6 | "yoda" < compare # SIM300 @@ -144,17 +151,18 @@ SIM300.py:8:1: SIM300 [*] Yoda condition detected 10 10 | YODA == age # SIM300 11 11 | YODA > age # SIM300 -SIM300.py:9:1: SIM300 [*] Yoda condition detected +error[SIM300]: 9:1: [*] Yoda condition detected + + --> SIM300.py:8:20 | 7 | 42 > age # SIM300 8 | -42 > age # SIM300 9 | +42 > age # SIM300 - | ^^^^^^^^^ SIM300 + | ^^^^^^^^^ 10 | YODA == age # SIM300 11 | YODA > age # SIM300 | = help: Rewrite as `age < +42` - ℹ Safe fix 6 6 | "yoda" < compare # SIM300 7 7 | 42 > age # SIM300 @@ -165,17 +173,18 @@ SIM300.py:9:1: SIM300 [*] Yoda condition detected 11 11 | YODA > age # SIM300 12 12 | YODA >= age # SIM300 -SIM300.py:10:1: SIM300 [*] Yoda condition detected +error[SIM300]: 10:1: [*] Yoda condition detected + + --> SIM300.py:9:20 | 8 | -42 > age # SIM300 9 | +42 > age # SIM300 10 | YODA == age # SIM300 - | ^^^^^^^^^^^ SIM300 + | ^^^^^^^^^^^ 11 | YODA > age # SIM300 12 | YODA >= age # SIM300 | = help: Rewrite as `age == YODA` - ℹ Safe fix 7 7 | 42 > age # SIM300 8 8 | -42 > age # SIM300 @@ -186,17 +195,18 @@ SIM300.py:10:1: SIM300 [*] Yoda condition detected 12 12 | YODA >= age # SIM300 13 13 | JediOrder.YODA == age # SIM300 -SIM300.py:11:1: SIM300 [*] Yoda condition detected +error[SIM300]: 11:1: [*] Yoda condition detected + + --> SIM300.py:10:22 | 9 | +42 > age # SIM300 10 | YODA == age # SIM300 11 | YODA > age # SIM300 - | ^^^^^^^^^^ SIM300 + | ^^^^^^^^^^ 12 | YODA >= age # SIM300 13 | JediOrder.YODA == age # SIM300 | = help: Rewrite as `age < YODA` - ℹ Safe fix 8 8 | -42 > age # SIM300 9 9 | +42 > age # SIM300 @@ -207,17 +217,18 @@ SIM300.py:11:1: SIM300 [*] Yoda condition detected 13 13 | JediOrder.YODA == age # SIM300 14 14 | 0 < (number - 100) # SIM300 -SIM300.py:12:1: SIM300 [*] Yoda condition detected +error[SIM300]: 12:1: [*] Yoda condition detected + + --> SIM300.py:11:21 | 10 | YODA == age # SIM300 11 | YODA > age # SIM300 12 | YODA >= age # SIM300 - | ^^^^^^^^^^^ SIM300 + | ^^^^^^^^^^^ 13 | JediOrder.YODA == age # SIM300 14 | 0 < (number - 100) # SIM300 | = help: Rewrite as `age <= YODA` - ℹ Safe fix 9 9 | +42 > age # SIM300 10 10 | YODA == age # SIM300 @@ -228,17 +239,18 @@ SIM300.py:12:1: SIM300 [*] Yoda condition detected 14 14 | 0 < (number - 100) # SIM300 15 15 | B SIM300.py:12:22 | 11 | YODA > age # SIM300 12 | YODA >= age # SIM300 13 | JediOrder.YODA == age # SIM300 - | ^^^^^^^^^^^^^^^^^^^^^ SIM300 + | ^^^^^^^^^^^^^^^^^^^^^ 14 | 0 < (number - 100) # SIM300 15 | B age # SIM300 @@ -249,17 +261,18 @@ SIM300.py:13:1: SIM300 [*] Yoda condition detected 15 15 | B SIM300.py:13:32 | 12 | YODA >= age # SIM300 13 | JediOrder.YODA == age # SIM300 14 | 0 < (number - 100) # SIM300 - | ^^^^^^^^^^^^^^^^^^ SIM300 + | ^^^^^^^^^^^^^^^^^^ 15 | B 0` - ℹ Safe fix 11 11 | YODA > age # SIM300 12 12 | YODA >= age # SIM300 @@ -270,16 +283,17 @@ SIM300.py:14:1: SIM300 [*] Yoda condition detected 16 16 | B or(B) SIM300.py:14:29 | 13 | JediOrder.YODA == age # SIM300 14 | 0 < (number - 100) # SIM300 15 | B B` - ℹ Safe fix 12 12 | YODA >= age # SIM300 13 13 | JediOrder.YODA == age # SIM300 @@ -290,17 +304,18 @@ SIM300.py:15:1: SIM300 [*] Yoda condition detected 17 17 | 18 18 | # Errors in preview -SIM300.py:16:5: SIM300 [*] Yoda condition detected +error[SIM300]: 16:5: [*] Yoda condition detected + + --> SIM300.py:16:5 | 14 | 0 < (number - 100) # SIM300 15 | B (B)` - ℹ Safe fix 13 13 | JediOrder.YODA == age # SIM300 14 14 | 0 < (number - 100) # SIM300 @@ -311,15 +326,16 @@ SIM300.py:16:5: SIM300 [*] Yoda condition detected 18 18 | # Errors in preview 19 19 | ['upper'] == UPPER_LIST -SIM300.py:19:1: SIM300 [*] Yoda condition detected +error[SIM300]: 19:1: [*] Yoda condition detected + + --> SIM300.py:18:20 | 18 | # Errors in preview 19 | ['upper'] == UPPER_LIST - | ^^^^^^^^^^^^^^^^^^^^^^^ SIM300 + | ^^^^^^^^^^^^^^^^^^^^^^^ 20 | {} == DummyHandler.CONFIG | = help: Rewrite as `UPPER_LIST == ['upper']` - ℹ Safe fix 16 16 | B or(B) SIM300.py:19:24 | 18 | # Errors in preview 19 | ['upper'] == UPPER_LIST 20 | {} == DummyHandler.CONFIG - | ^^^^^^^^^^^^^^^^^^^^^^^^^ SIM300 + | ^^^^^^^^^^^^^^^^^^^^^^^^^ 21 | 22 | # Errors in stable | = help: Rewrite as `DummyHandler.CONFIG == {}` - ℹ Safe fix 17 17 | 18 18 | # Errors in preview diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM401_SIM401.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM401_SIM401.py.snap index 668804215a..f68db1c668 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM401_SIM401.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM401_SIM401.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -error[SIM401]: SIM401.py:6:1: [*] Use `var = a_dict.get(key, "default1")` instead of an `if` block +error[SIM401]: 6:1: [*] Use `var = a_dict.get(key, "default1")` instead of an `if` block + --> SIM401.py:5:21 | 5 | # SIM401 (pattern-1) 6 | / if key in a_dict: @@ -27,8 +28,9 @@ error[SIM401]: SIM401.py:6:1: [*] Use `var = a_dict.get(key, "default1")` instea 11 8 | # SIM401 (pattern-2) 12 9 | if key not in a_dict: -error[SIM401]: SIM401.py:12:1: [*] Use `var = a_dict.get(key, "default2")` instead of an `if` block +error[SIM401]: 12:1: [*] Use `var = a_dict.get(key, "default2")` instead of an `if` block + --> SIM401.py:11:21 | 11 | # SIM401 (pattern-2) 12 | / if key not in a_dict: @@ -53,8 +55,9 @@ error[SIM401]: SIM401.py:12:1: [*] Use `var = a_dict.get(key, "default2")` inste 17 14 | # OK (default contains effect) 18 15 | if key in a_dict: -error[SIM401]: SIM401.py:24:1: [*] Use `var = a_dict.get(keys[idx], "default")` instead of an `if` block +error[SIM401]: 24:1: [*] Use `var = a_dict.get(keys[idx], "default")` instead of an `if` block + --> SIM401.py:23:37 | 23 | # SIM401 (complex expression in key) 24 | / if keys[idx] in a_dict: @@ -79,8 +82,9 @@ error[SIM401]: SIM401.py:24:1: [*] Use `var = a_dict.get(keys[idx], "default")` 29 26 | # SIM401 (complex expression in dict) 30 27 | if key in dicts[idx]: -error[SIM401]: SIM401.py:30:1: [*] Use `var = dicts[idx].get(key, "default")` instead of an `if` block +error[SIM401]: 30:1: [*] Use `var = dicts[idx].get(key, "default")` instead of an `if` block + --> SIM401.py:29:38 | 29 | # SIM401 (complex expression in dict) 30 | / if key in dicts[idx]: @@ -105,8 +109,9 @@ error[SIM401]: SIM401.py:30:1: [*] Use `var = dicts[idx].get(key, "default")` in 35 32 | # SIM401 (complex expression in var) 36 33 | if key in a_dict: -error[SIM401]: SIM401.py:36:1: [*] Use `vars[idx] = a_dict.get(key, "defaultß9💣2ℝ6789ß9💣2ℝ6789ß9💣2ℝ6789ß9💣2ℝ6789ß9💣2ℝ6789")` instead of an `if` block +error[SIM401]: 36:1: [*] Use `vars[idx] = a_dict.get(key, "defaultß9💣2ℝ6789ß9💣2ℝ6789ß9💣2ℝ6789ß9💣2ℝ6789ß9💣2ℝ6789")` instead of an `if` block + --> SIM401.py:35:37 | 35 | # SIM401 (complex expression in var) 36 | / if key in a_dict: @@ -131,8 +136,9 @@ error[SIM401]: SIM401.py:36:1: [*] Use `vars[idx] = a_dict.get(key, "defaultß9 41 38 | # SIM401 42 39 | if foo(): -error[SIM401]: SIM401.py:45:5: [*] Use `vars[idx] = a_dict.get(key, "default")` instead of an `if` block +error[SIM401]: 45:5: [*] Use `vars[idx] = a_dict.get(key, "default")` instead of an `if` block + --> SIM401.py:45:5 | 43 | pass 44 | else: @@ -159,8 +165,9 @@ error[SIM401]: SIM401.py:45:5: [*] Use `vars[idx] = a_dict.get(key, "default")` 50 47 | ### 51 48 | # Negative cases -error[SIM401]: SIM401.py:123:7: [*] Use `a_dict.get(key, "default3")` instead of an `if` block +error[SIM401]: 123:7: [*] Use `a_dict.get(key, "default3")` instead of an `if` block + --> SIM401.py:123:7 | 122 | # SIM401 123 | var = a_dict[key] if key in a_dict else "default3" @@ -179,8 +186,9 @@ error[SIM401]: SIM401.py:123:7: [*] Use `a_dict.get(key, "default3")` instead of 125 125 | # SIM401 126 126 | var = "default-1" if key not in a_dict else a_dict[key] -error[SIM401]: SIM401.py:126:7: [*] Use `a_dict.get(key, "default-1")` instead of an `if` block +error[SIM401]: 126:7: [*] Use `a_dict.get(key, "default-1")` instead of an `if` block + --> SIM401.py:126:7 | 125 | # SIM401 126 | var = "default-1" if key not in a_dict else a_dict[key] diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM910_SIM910.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM910_SIM910.py.snap index 9c4df3dccc..a53d4bf4b6 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM910_SIM910.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM910_SIM910.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -error[SIM910]: SIM910.py:2:1: [*] Use `{}.get(key)` instead of `{}.get(key, None)` +error[SIM910]: 2:1: [*] Use `{}.get(key)` instead of `{}.get(key, None)` + --> SIM910.py:1:9 | 1 | # SIM910 2 | {}.get(key, None) @@ -19,8 +20,9 @@ error[SIM910]: SIM910.py:2:1: [*] Use `{}.get(key)` instead of `{}.get(key, None 4 4 | # SIM910 5 5 | {}.get("key", None) -error[SIM910]: SIM910.py:5:1: [*] Use `{}.get("key")` instead of `{}.get("key", None)` +error[SIM910]: 5:1: [*] Use `{}.get("key")` instead of `{}.get("key", None)` + --> SIM910.py:4:9 | 4 | # SIM910 5 | {}.get("key", None) @@ -39,8 +41,9 @@ error[SIM910]: SIM910.py:5:1: [*] Use `{}.get("key")` instead of `{}.get("key", 7 7 | # OK 8 8 | {}.get(key) -error[SIM910]: SIM910.py:20:9: [*] Use `{}.get(key)` instead of `{}.get(key, None)` +error[SIM910]: 20:9: [*] Use `{}.get(key)` instead of `{}.get(key, None)` + --> SIM910.py:20:9 | 19 | # SIM910 20 | if a := {}.get(key, None): @@ -58,8 +61,9 @@ error[SIM910]: SIM910.py:20:9: [*] Use `{}.get(key)` instead of `{}.get(key, Non 22 22 | 23 23 | # SIM910 -error[SIM910]: SIM910.py:24:5: [*] Use `{}.get(key)` instead of `{}.get(key, None)` +error[SIM910]: 24:5: [*] Use `{}.get(key)` instead of `{}.get(key, None)` + --> SIM910.py:24:5 | 23 | # SIM910 24 | a = {}.get(key, None) @@ -78,8 +82,9 @@ error[SIM910]: SIM910.py:24:5: [*] Use `{}.get(key)` instead of `{}.get(key, Non 26 26 | # SIM910 27 27 | ({}).get(key, None) -error[SIM910]: SIM910.py:27:1: [*] Use `({}).get(key)` instead of `({}).get(key, None)` +error[SIM910]: 27:1: [*] Use `({}).get(key)` instead of `({}).get(key, None)` + --> SIM910.py:26:9 | 26 | # SIM910 27 | ({}).get(key, None) @@ -98,8 +103,9 @@ error[SIM910]: SIM910.py:27:1: [*] Use `({}).get(key)` instead of `({}).get(key, 29 29 | # SIM910 30 30 | ages = {"Tom": 23, "Maria": 23, "Dog": 11} -error[SIM910]: SIM910.py:31:7: [*] Use `ages.get("Cat")` instead of `ages.get("Cat", None)` +error[SIM910]: 31:7: [*] Use `ages.get("Cat")` instead of `ages.get("Cat", None)` + --> SIM910.py:31:7 | 29 | # SIM910 30 | ages = {"Tom": 23, "Maria": 23, "Dog": 11} diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__preview__SIM108_SIM108.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__preview__SIM108_SIM108.py.snap index 0be8a6b7ca..32c5fcdf9f 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__preview__SIM108_SIM108.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__preview__SIM108_SIM108.py.snap @@ -1,19 +1,20 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -SIM108.py:2:1: SIM108 [*] Use ternary operator `b = c if a else d` instead of `if`-`else`-block +error[SIM108]: 2:1: [*] Use ternary operator `b = c if a else d` instead of `if`-`else`-block + + --> SIM108.py:1:9 | 1 | # SIM108 2 | / if a: 3 | | b = c 4 | | else: 5 | | b = d - | |_________^ SIM108 + | |_________^ 6 | 7 | # OK | = help: Replace `if`-`else`-block with `b = c if a else d` - ℹ Unsafe fix 1 1 | # SIM108 2 |-if a: @@ -25,7 +26,9 @@ SIM108.py:2:1: SIM108 [*] Use ternary operator `b = c if a else d` instead of `i 7 4 | # OK 8 5 | b = c if a else d -SIM108.py:30:5: SIM108 [*] Use ternary operator `b = 1 if a else 2` instead of `if`-`else`-block +error[SIM108]: 30:5: [*] Use ternary operator `b = 1 if a else 2` instead of `if`-`else`-block + + --> SIM108.py:30:5 | 28 | pass 29 | else: @@ -34,10 +37,9 @@ SIM108.py:30:5: SIM108 [*] Use ternary operator `b = 1 if a else 2` instead of ` 31 | | b = 1 32 | | else: 33 | | b = 2 - | |_____________^ SIM108 + | |_____________^ | = help: Replace `if`-`else`-block with `b = 1 if a else 2` - ℹ Unsafe fix 27 27 | if True: 28 28 | pass @@ -51,7 +53,9 @@ SIM108.py:30:5: SIM108 [*] Use ternary operator `b = 1 if a else 2` instead of ` 35 32 | 36 33 | import sys -SIM108.py:58:1: SIM108 Use ternary operator `abc = x if x > 0 else -x` instead of `if`-`else`-block +error[SIM108]: 58:1: Use ternary operator `abc = x if x > 0 else -x` instead of `if`-`else`-block + + --> SIM108.py:57:39 | 57 | # SIM108 (without fix due to comments) 58 | / if x > 0: @@ -60,21 +64,21 @@ SIM108.py:58:1: SIM108 Use ternary operator `abc = x if x > 0 else -x` instead o 61 | | else: 62 | | # test test test 63 | | abc = -x - | |____________^ SIM108 + | |____________^ | = help: Replace `if`-`else`-block with `abc = x if x > 0 else -x` +error[SIM108]: 82:1: [*] Use ternary operator `b = "cccccccccccccccccccccccccccccccccß" if a else "ddddddddddddddddddddddddddddddddd💣"` instead of `if`-`else`-block -SIM108.py:82:1: SIM108 [*] Use ternary operator `b = "cccccccccccccccccccccccccccccccccß" if a else "ddddddddddddddddddddddddddddddddd💣"` instead of `if`-`else`-block + --> SIM108.py:81:9 | 81 | # SIM108 82 | / if a: 83 | | b = "cccccccccccccccccccccccccccccccccß" 84 | | else: 85 | | b = "ddddddddddddddddddddddddddddddddd💣" - | |_____________________________________________^ SIM108 + | |_____________________________________________^ | = help: Replace `if`-`else`-block with `b = "cccccccccccccccccccccccccccccccccß" if a else "ddddddddddddddddddddddddddddddddd💣"` - ℹ Unsafe fix 79 79 | 80 80 | @@ -88,38 +92,43 @@ SIM108.py:82:1: SIM108 [*] Use ternary operator `b = "cccccccccccccccccccccccccc 87 84 | 88 85 | # OK (too long) -SIM108.py:105:1: SIM108 Use ternary operator `exitcode = 0 if True else 1` instead of `if`-`else`-block +error[SIM108]: 105:1: Use ternary operator `exitcode = 0 if True else 1` instead of `if`-`else`-block + + --> SIM108.py:104:47 | 104 | # SIM108 (without fix due to trailing comment) 105 | / if True: 106 | | exitcode = 0 107 | | else: 108 | | exitcode = 1 # Trailing comment - | |________________^ SIM108 + | |________________^ | = help: Replace `if`-`else`-block with `exitcode = 0 if True else 1` +error[SIM108]: 112:1: Use ternary operator `x = 3 if True else 5` instead of `if`-`else`-block -SIM108.py:112:1: SIM108 Use ternary operator `x = 3 if True else 5` instead of `if`-`else`-block + --> SIM108.py:111:9 | 111 | # SIM108 112 | / if True: x = 3 # Foo 113 | | else: x = 5 - | |___________^ SIM108 + | |___________^ | = help: Replace `if`-`else`-block with `x = 3 if True else 5` +error[SIM108]: 117:1: Use ternary operator `x = 3 if True else 5` instead of `if`-`else`-block -SIM108.py:117:1: SIM108 Use ternary operator `x = 3 if True else 5` instead of `if`-`else`-block + --> SIM108.py:116:9 | 116 | # SIM108 117 | / if True: # Foo 118 | | x = 3 119 | | else: 120 | | x = 5 - | |_________^ SIM108 + | |_________^ | = help: Replace `if`-`else`-block with `x = 3 if True else 5` +error[SIM108]: 141:1: [*] Use binary operator `z = cond or other_cond` instead of `if`-`else`-block -SIM108.py:141:1: SIM108 [*] Use binary operator `z = cond or other_cond` instead of `if`-`else`-block + --> SIM108.py:140:25 | 139 | # SIM108 - should suggest 140 | # z = cond or other_cond @@ -127,12 +136,11 @@ SIM108.py:141:1: SIM108 [*] Use binary operator `z = cond or other_cond` instead 142 | | z = cond 143 | | else: 144 | | z = other_cond - | |__________________^ SIM108 + | |__________________^ 145 | 146 | # SIM108 - should suggest | = help: Replace `if`-`else`-block with `z = cond or other_cond` - ℹ Unsafe fix 138 138 | 139 139 | # SIM108 - should suggest @@ -146,7 +154,9 @@ SIM108.py:141:1: SIM108 [*] Use binary operator `z = cond or other_cond` instead 146 143 | # SIM108 - should suggest 147 144 | # z = cond and other_cond -SIM108.py:148:1: SIM108 [*] Use binary operator `z = cond and other_cond` instead of `if`-`else`-block +error[SIM108]: 148:1: [*] Use binary operator `z = cond and other_cond` instead of `if`-`else`-block + + --> SIM108.py:147:26 | 146 | # SIM108 - should suggest 147 | # z = cond and other_cond @@ -154,12 +164,11 @@ SIM108.py:148:1: SIM108 [*] Use binary operator `z = cond and other_cond` instea 149 | | z = cond 150 | | else: 151 | | z = other_cond - | |__________________^ SIM108 + | |__________________^ 152 | 153 | # SIM108 - should suggest | = help: Replace `if`-`else`-block with `z = cond and other_cond` - ℹ Unsafe fix 145 145 | 146 146 | # SIM108 - should suggest @@ -173,7 +182,9 @@ SIM108.py:148:1: SIM108 [*] Use binary operator `z = cond and other_cond` instea 153 150 | # SIM108 - should suggest 154 151 | # z = not cond and other_cond -SIM108.py:155:1: SIM108 [*] Use binary operator `z = not cond and other_cond` instead of `if`-`else`-block +error[SIM108]: 155:1: [*] Use binary operator `z = not cond and other_cond` instead of `if`-`else`-block + + --> SIM108.py:154:30 | 153 | # SIM108 - should suggest 154 | # z = not cond and other_cond @@ -181,12 +192,11 @@ SIM108.py:155:1: SIM108 [*] Use binary operator `z = not cond and other_cond` in 156 | | z = not cond 157 | | else: 158 | | z = other_cond - | |__________________^ SIM108 + | |__________________^ 159 | 160 | # SIM108 does not suggest | = help: Replace `if`-`else`-block with `z = not cond and other_cond` - ℹ Unsafe fix 152 152 | 153 153 | # SIM108 - should suggest @@ -200,7 +210,9 @@ SIM108.py:155:1: SIM108 [*] Use binary operator `z = not cond and other_cond` in 160 157 | # SIM108 does not suggest 161 158 | # a binary option in these cases, -SIM108.py:167:1: SIM108 [*] Use ternary operator `z = 1 if True else other` instead of `if`-`else`-block +error[SIM108]: 167:1: [*] Use ternary operator `z = 1 if True else other` instead of `if`-`else`-block + + --> SIM108.py:166:45 | 165 | # (Of course, these specific expressions 166 | # should be simplified for other reasons...) @@ -208,12 +220,11 @@ SIM108.py:167:1: SIM108 [*] Use ternary operator `z = 1 if True else other` inst 168 | | z = 1 169 | | else: 170 | | z = other - | |_____________^ SIM108 + | |_____________^ 171 | 172 | if False: | = help: Replace `if`-`else`-block with `z = 1 if True else other` - ℹ Unsafe fix 164 164 | # so, e.g. `True == 1`. 165 165 | # (Of course, these specific expressions @@ -227,7 +238,9 @@ SIM108.py:167:1: SIM108 [*] Use ternary operator `z = 1 if True else other` inst 172 169 | if False: 173 170 | z = 1 -SIM108.py:177:1: SIM108 [*] Use ternary operator `z = True if 1 else other` instead of `if`-`else`-block +error[SIM108]: 177:1: [*] Use ternary operator `z = True if 1 else other` instead of `if`-`else`-block + + --> SIM108.py:176:1 | 175 | z = other 176 | @@ -235,12 +248,11 @@ SIM108.py:177:1: SIM108 [*] Use ternary operator `z = True if 1 else other` inst 178 | | z = True 179 | | else: 180 | | z = other - | |_____________^ SIM108 + | |_____________^ 181 | 182 | # SIM108 does not suggest a binary option in this | = help: Replace `if`-`else`-block with `z = True if 1 else other` - ℹ Unsafe fix 174 174 | else: 175 175 | z = other @@ -254,7 +266,9 @@ SIM108.py:177:1: SIM108 [*] Use ternary operator `z = True if 1 else other` inst 182 179 | # SIM108 does not suggest a binary option in this 183 180 | # case, since we'd be reducing the number of calls -SIM108.py:185:1: SIM108 [*] Use ternary operator `z = foo() if foo() else other` instead of `if`-`else`-block +error[SIM108]: 185:1: [*] Use ternary operator `z = foo() if foo() else other` instead of `if`-`else`-block + + --> SIM108.py:184:19 | 183 | # case, since we'd be reducing the number of calls 184 | # from Two to one. @@ -262,12 +276,11 @@ SIM108.py:185:1: SIM108 [*] Use ternary operator `z = foo() if foo() else other` 186 | | z = foo() 187 | | else: 188 | | z = other - | |_____________^ SIM108 + | |_____________^ 189 | 190 | # SIM108 does not suggest a binary option in this | = help: Replace `if`-`else`-block with `z = foo() if foo() else other` - ℹ Unsafe fix 182 182 | # SIM108 does not suggest a binary option in this 183 183 | # case, since we'd be reducing the number of calls @@ -281,7 +294,9 @@ SIM108.py:185:1: SIM108 [*] Use ternary operator `z = foo() if foo() else other` 190 187 | # SIM108 does not suggest a binary option in this 191 188 | # case, since we'd be reducing the number of calls -SIM108.py:193:1: SIM108 [*] Use ternary operator `z = not foo() if foo() else other` instead of `if`-`else`-block +error[SIM108]: 193:1: [*] Use ternary operator `z = not foo() if foo() else other` instead of `if`-`else`-block + + --> SIM108.py:192:19 | 191 | # case, since we'd be reducing the number of calls 192 | # from Two to one. @@ -289,10 +304,9 @@ SIM108.py:193:1: SIM108 [*] Use ternary operator `z = not foo() if foo() else ot 194 | | z = not foo() 195 | | else: 196 | | z = other - | |_____________^ SIM108 + | |_____________^ | = help: Replace `if`-`else`-block with `z = not foo() if foo() else other` - ℹ Unsafe fix 190 190 | # SIM108 does not suggest a binary option in this 191 191 | # case, since we'd be reducing the number of calls diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__preview__SIM115_SIM115.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__preview__SIM115_SIM115.py.snap index 53cef314b4..594e9fcc5f 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__preview__SIM115_SIM115.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__preview__SIM115_SIM115.py.snap @@ -1,326 +1,360 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -SIM115.py:8:5: SIM115 Use a context manager for opening files +error[SIM115]: 8:5: Use a context manager for opening files + + --> SIM115.py:8:5 | 7 | # SIM115 8 | f = open("foo.txt") - | ^^^^ SIM115 + | ^^^^ 9 | f = Path("foo.txt").open() 10 | f = pathlib.Path("foo.txt").open() | +error[SIM115]: 9:5: Use a context manager for opening files -SIM115.py:9:5: SIM115 Use a context manager for opening files + --> SIM115.py:9:5 | 7 | # SIM115 8 | f = open("foo.txt") 9 | f = Path("foo.txt").open() - | ^^^^^^^^^^^^^^^^^^^^ SIM115 + | ^^^^^^^^^^^^^^^^^^^^ 10 | f = pathlib.Path("foo.txt").open() 11 | f = pl.Path("foo.txt").open() | +error[SIM115]: 10:5: Use a context manager for opening files -SIM115.py:10:5: SIM115 Use a context manager for opening files + --> SIM115.py:10:5 | 8 | f = open("foo.txt") 9 | f = Path("foo.txt").open() 10 | f = pathlib.Path("foo.txt").open() - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SIM115 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 11 | f = pl.Path("foo.txt").open() 12 | f = P("foo.txt").open() | +error[SIM115]: 11:5: Use a context manager for opening files -SIM115.py:11:5: SIM115 Use a context manager for opening files + --> SIM115.py:11:5 | 9 | f = Path("foo.txt").open() 10 | f = pathlib.Path("foo.txt").open() 11 | f = pl.Path("foo.txt").open() - | ^^^^^^^^^^^^^^^^^^^^^^^ SIM115 + | ^^^^^^^^^^^^^^^^^^^^^^^ 12 | f = P("foo.txt").open() 13 | data = f.read() | +error[SIM115]: 12:5: Use a context manager for opening files -SIM115.py:12:5: SIM115 Use a context manager for opening files + --> SIM115.py:12:5 | 10 | f = pathlib.Path("foo.txt").open() 11 | f = pl.Path("foo.txt").open() 12 | f = P("foo.txt").open() - | ^^^^^^^^^^^^^^^^^ SIM115 + | ^^^^^^^^^^^^^^^^^ 13 | data = f.read() 14 | f.close() | +error[SIM115]: 39:9: Use a context manager for opening files -SIM115.py:39:9: SIM115 Use a context manager for opening files + --> SIM115.py:39:9 | 37 | # SIM115 38 | with contextlib.ExitStack(): 39 | f = open("filename") - | ^^^^ SIM115 + | ^^^^ 40 | 41 | # OK | +error[SIM115]: 80:5: Use a context manager for opening files -SIM115.py:80:5: SIM115 Use a context manager for opening files + --> SIM115.py:80:5 | 78 | import fileinput 79 | 80 | f = tempfile.NamedTemporaryFile() - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ SIM115 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ 81 | f = tempfile.TemporaryFile() 82 | f = tempfile.SpooledTemporaryFile() | +error[SIM115]: 81:5: Use a context manager for opening files -SIM115.py:81:5: SIM115 Use a context manager for opening files + --> SIM115.py:81:5 | 80 | f = tempfile.NamedTemporaryFile() 81 | f = tempfile.TemporaryFile() - | ^^^^^^^^^^^^^^^^^^^^^^ SIM115 + | ^^^^^^^^^^^^^^^^^^^^^^ 82 | f = tempfile.SpooledTemporaryFile() 83 | f = tarfile.open("foo.tar") | +error[SIM115]: 82:5: Use a context manager for opening files -SIM115.py:82:5: SIM115 Use a context manager for opening files + --> SIM115.py:82:5 | 80 | f = tempfile.NamedTemporaryFile() 81 | f = tempfile.TemporaryFile() 82 | f = tempfile.SpooledTemporaryFile() - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SIM115 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 83 | f = tarfile.open("foo.tar") 84 | f = TarFile("foo.tar").open() | +error[SIM115]: 83:5: Use a context manager for opening files -SIM115.py:83:5: SIM115 Use a context manager for opening files + --> SIM115.py:83:5 | 81 | f = tempfile.TemporaryFile() 82 | f = tempfile.SpooledTemporaryFile() 83 | f = tarfile.open("foo.tar") - | ^^^^^^^^^^^^ SIM115 + | ^^^^^^^^^^^^ 84 | f = TarFile("foo.tar").open() 85 | f = tarfile.TarFile("foo.tar").open() | +error[SIM115]: 84:5: Use a context manager for opening files -SIM115.py:84:5: SIM115 Use a context manager for opening files + --> SIM115.py:84:5 | 82 | f = tempfile.SpooledTemporaryFile() 83 | f = tarfile.open("foo.tar") 84 | f = TarFile("foo.tar").open() - | ^^^^^^^^^^^^^^^^^^^^^^^ SIM115 + | ^^^^^^^^^^^^^^^^^^^^^^^ 85 | f = tarfile.TarFile("foo.tar").open() 86 | f = tarfile.TarFile().open() | +error[SIM115]: 85:5: Use a context manager for opening files -SIM115.py:85:5: SIM115 Use a context manager for opening files + --> SIM115.py:85:5 | 83 | f = tarfile.open("foo.tar") 84 | f = TarFile("foo.tar").open() 85 | f = tarfile.TarFile("foo.tar").open() - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SIM115 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 86 | f = tarfile.TarFile().open() 87 | f = zipfile.ZipFile("foo.zip").open("foo.txt") | +error[SIM115]: 86:5: Use a context manager for opening files -SIM115.py:86:5: SIM115 Use a context manager for opening files + --> SIM115.py:86:5 | 84 | f = TarFile("foo.tar").open() 85 | f = tarfile.TarFile("foo.tar").open() 86 | f = tarfile.TarFile().open() - | ^^^^^^^^^^^^^^^^^^^^^^ SIM115 + | ^^^^^^^^^^^^^^^^^^^^^^ 87 | f = zipfile.ZipFile("foo.zip").open("foo.txt") 88 | f = io.open("foo.txt") | +error[SIM115]: 87:5: Use a context manager for opening files -SIM115.py:87:5: SIM115 Use a context manager for opening files + --> SIM115.py:87:5 | 85 | f = tarfile.TarFile("foo.tar").open() 86 | f = tarfile.TarFile().open() 87 | f = zipfile.ZipFile("foo.zip").open("foo.txt") - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SIM115 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 88 | f = io.open("foo.txt") 89 | f = io.open_code("foo.txt") | +error[SIM115]: 88:5: Use a context manager for opening files -SIM115.py:88:5: SIM115 Use a context manager for opening files + --> SIM115.py:88:5 | 86 | f = tarfile.TarFile().open() 87 | f = zipfile.ZipFile("foo.zip").open("foo.txt") 88 | f = io.open("foo.txt") - | ^^^^^^^ SIM115 + | ^^^^^^^ 89 | f = io.open_code("foo.txt") 90 | f = codecs.open("foo.txt") | +error[SIM115]: 89:5: Use a context manager for opening files -SIM115.py:89:5: SIM115 Use a context manager for opening files + --> SIM115.py:89:5 | 87 | f = zipfile.ZipFile("foo.zip").open("foo.txt") 88 | f = io.open("foo.txt") 89 | f = io.open_code("foo.txt") - | ^^^^^^^^^^^^ SIM115 + | ^^^^^^^^^^^^ 90 | f = codecs.open("foo.txt") 91 | f = bz2.open("foo.txt") | +error[SIM115]: 90:5: Use a context manager for opening files -SIM115.py:90:5: SIM115 Use a context manager for opening files + --> SIM115.py:90:5 | 88 | f = io.open("foo.txt") 89 | f = io.open_code("foo.txt") 90 | f = codecs.open("foo.txt") - | ^^^^^^^^^^^ SIM115 + | ^^^^^^^^^^^ 91 | f = bz2.open("foo.txt") 92 | f = gzip.open("foo.txt") | +error[SIM115]: 91:5: Use a context manager for opening files -SIM115.py:91:5: SIM115 Use a context manager for opening files + --> SIM115.py:91:5 | 89 | f = io.open_code("foo.txt") 90 | f = codecs.open("foo.txt") 91 | f = bz2.open("foo.txt") - | ^^^^^^^^ SIM115 + | ^^^^^^^^ 92 | f = gzip.open("foo.txt") 93 | f = dbm.open("foo.db") | +error[SIM115]: 92:5: Use a context manager for opening files -SIM115.py:92:5: SIM115 Use a context manager for opening files + --> SIM115.py:92:5 | 90 | f = codecs.open("foo.txt") 91 | f = bz2.open("foo.txt") 92 | f = gzip.open("foo.txt") - | ^^^^^^^^^ SIM115 + | ^^^^^^^^^ 93 | f = dbm.open("foo.db") 94 | f = dbm.gnu.open("foo.db") | +error[SIM115]: 93:5: Use a context manager for opening files -SIM115.py:93:5: SIM115 Use a context manager for opening files + --> SIM115.py:93:5 | 91 | f = bz2.open("foo.txt") 92 | f = gzip.open("foo.txt") 93 | f = dbm.open("foo.db") - | ^^^^^^^^ SIM115 + | ^^^^^^^^ 94 | f = dbm.gnu.open("foo.db") 95 | f = dbm.ndbm.open("foo.db") | +error[SIM115]: 94:5: Use a context manager for opening files -SIM115.py:94:5: SIM115 Use a context manager for opening files + --> SIM115.py:94:5 | 92 | f = gzip.open("foo.txt") 93 | f = dbm.open("foo.db") 94 | f = dbm.gnu.open("foo.db") - | ^^^^^^^^^^^^ SIM115 + | ^^^^^^^^^^^^ 95 | f = dbm.ndbm.open("foo.db") 96 | f = dbm.dumb.open("foo.db") | +error[SIM115]: 95:5: Use a context manager for opening files -SIM115.py:95:5: SIM115 Use a context manager for opening files + --> SIM115.py:95:5 | 93 | f = dbm.open("foo.db") 94 | f = dbm.gnu.open("foo.db") 95 | f = dbm.ndbm.open("foo.db") - | ^^^^^^^^^^^^^ SIM115 + | ^^^^^^^^^^^^^ 96 | f = dbm.dumb.open("foo.db") 97 | f = lzma.open("foo.xz") | +error[SIM115]: 96:5: Use a context manager for opening files -SIM115.py:96:5: SIM115 Use a context manager for opening files + --> SIM115.py:96:5 | 94 | f = dbm.gnu.open("foo.db") 95 | f = dbm.ndbm.open("foo.db") 96 | f = dbm.dumb.open("foo.db") - | ^^^^^^^^^^^^^ SIM115 + | ^^^^^^^^^^^^^ 97 | f = lzma.open("foo.xz") 98 | f = lzma.LZMAFile("foo.xz") | +error[SIM115]: 97:5: Use a context manager for opening files -SIM115.py:97:5: SIM115 Use a context manager for opening files + --> SIM115.py:97:5 | 95 | f = dbm.ndbm.open("foo.db") 96 | f = dbm.dumb.open("foo.db") 97 | f = lzma.open("foo.xz") - | ^^^^^^^^^ SIM115 + | ^^^^^^^^^ 98 | f = lzma.LZMAFile("foo.xz") 99 | f = shelve.open("foo.db") | +error[SIM115]: 98:5: Use a context manager for opening files -SIM115.py:98:5: SIM115 Use a context manager for opening files + --> SIM115.py:98:5 | 96 | f = dbm.dumb.open("foo.db") 97 | f = lzma.open("foo.xz") 98 | f = lzma.LZMAFile("foo.xz") - | ^^^^^^^^^^^^^ SIM115 + | ^^^^^^^^^^^^^ 99 | f = shelve.open("foo.db") 100 | f = tokenize.open("foo.py") | +error[SIM115]: 99:5: Use a context manager for opening files -SIM115.py:99:5: SIM115 Use a context manager for opening files + --> SIM115.py:99:5 | 97 | f = lzma.open("foo.xz") 98 | f = lzma.LZMAFile("foo.xz") 99 | f = shelve.open("foo.db") - | ^^^^^^^^^^^ SIM115 + | ^^^^^^^^^^^ 100 | f = tokenize.open("foo.py") 101 | f = wave.open("foo.wav") | +error[SIM115]: 100:5: Use a context manager for opening files -SIM115.py:100:5: SIM115 Use a context manager for opening files + --> SIM115.py:100:5 | 98 | f = lzma.LZMAFile("foo.xz") 99 | f = shelve.open("foo.db") 100 | f = tokenize.open("foo.py") - | ^^^^^^^^^^^^^ SIM115 + | ^^^^^^^^^^^^^ 101 | f = wave.open("foo.wav") 102 | f = tarfile.TarFile.taropen("foo.tar") | +error[SIM115]: 101:5: Use a context manager for opening files -SIM115.py:101:5: SIM115 Use a context manager for opening files + --> SIM115.py:101:5 | 99 | f = shelve.open("foo.db") 100 | f = tokenize.open("foo.py") 101 | f = wave.open("foo.wav") - | ^^^^^^^^^ SIM115 + | ^^^^^^^^^ 102 | f = tarfile.TarFile.taropen("foo.tar") 103 | f = fileinput.input("foo.txt") | +error[SIM115]: 102:5: Use a context manager for opening files -SIM115.py:102:5: SIM115 Use a context manager for opening files + --> SIM115.py:102:5 | 100 | f = tokenize.open("foo.py") 101 | f = wave.open("foo.wav") 102 | f = tarfile.TarFile.taropen("foo.tar") - | ^^^^^^^^^^^^^^^^^^^^^^^ SIM115 + | ^^^^^^^^^^^^^^^^^^^^^^^ 103 | f = fileinput.input("foo.txt") 104 | f = fileinput.FileInput("foo.txt") | +error[SIM115]: 103:5: Use a context manager for opening files -SIM115.py:103:5: SIM115 Use a context manager for opening files + --> SIM115.py:103:5 | 101 | f = wave.open("foo.wav") 102 | f = tarfile.TarFile.taropen("foo.tar") 103 | f = fileinput.input("foo.txt") - | ^^^^^^^^^^^^^^^ SIM115 + | ^^^^^^^^^^^^^^^ 104 | f = fileinput.FileInput("foo.txt") | +error[SIM115]: 104:5: Use a context manager for opening files -SIM115.py:104:5: SIM115 Use a context manager for opening files + --> SIM115.py:104:5 | 102 | f = tarfile.TarFile.taropen("foo.tar") 103 | f = fileinput.input("foo.txt") 104 | f = fileinput.FileInput("foo.txt") - | ^^^^^^^^^^^^^^^^^^^ SIM115 + | ^^^^^^^^^^^^^^^^^^^ 105 | 106 | with contextlib.suppress(Exception): | +error[SIM115]: 240:9: Use a context manager for opening files -SIM115.py:240:9: SIM115 Use a context manager for opening files + --> SIM115.py:240:9 | 238 | def aliased(): 239 | from shelve import open as open_shelf 240 | x = open_shelf("foo.dbm") - | ^^^^^^^^^^ SIM115 + | ^^^^^^^^^^ 241 | x.close() | +error[SIM115]: 244:9: Use a context manager for opening files -SIM115.py:244:9: SIM115 Use a context manager for opening files + --> SIM115.py:244:9 | 243 | from tarfile import TarFile as TF 244 | f = TF("foo").open() - | ^^^^^^^^^^^^^^ SIM115 + | ^^^^^^^^^^^^^^ 245 | f.close() | diff --git a/crates/ruff_linter/src/rules/flake8_slots/snapshots/ruff_linter__rules__flake8_slots__tests__SLOT000_SLOT000.py.snap b/crates/ruff_linter/src/rules/flake8_slots/snapshots/ruff_linter__rules__flake8_slots__tests__SLOT000_SLOT000.py.snap index c657cbc7b4..7c9bc11df2 100644 --- a/crates/ruff_linter/src/rules/flake8_slots/snapshots/ruff_linter__rules__flake8_slots__tests__SLOT000_SLOT000.py.snap +++ b/crates/ruff_linter/src/rules/flake8_slots/snapshots/ruff_linter__rules__flake8_slots__tests__SLOT000_SLOT000.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_slots/mod.rs --- -error[SLOT000]: SLOT000.py:1:7: Subclasses of `str` should define `__slots__` +error[SLOT000]: 1:7: Subclasses of `str` should define `__slots__` + --> SLOT000.py:1:7 | 1 | class Bad(str): # SLOT000 | ^^^ diff --git a/crates/ruff_linter/src/rules/flake8_slots/snapshots/ruff_linter__rules__flake8_slots__tests__SLOT001_SLOT001.py.snap b/crates/ruff_linter/src/rules/flake8_slots/snapshots/ruff_linter__rules__flake8_slots__tests__SLOT001_SLOT001.py.snap index dd9ce948fb..7d09568510 100644 --- a/crates/ruff_linter/src/rules/flake8_slots/snapshots/ruff_linter__rules__flake8_slots__tests__SLOT001_SLOT001.py.snap +++ b/crates/ruff_linter/src/rules/flake8_slots/snapshots/ruff_linter__rules__flake8_slots__tests__SLOT001_SLOT001.py.snap @@ -1,29 +1,33 @@ --- source: crates/ruff_linter/src/rules/flake8_slots/mod.rs --- -error[SLOT001]: SLOT001.py:1:7: Subclasses of `tuple` should define `__slots__` +error[SLOT001]: 1:7: Subclasses of `tuple` should define `__slots__` + --> SLOT001.py:1:7 | 1 | class Bad(tuple): # SLOT001 | ^^^ 2 | pass | -error[SLOT001]: SLOT001.py:12:7: Subclasses of `tuple` should define `__slots__` +error[SLOT001]: 12:7: Subclasses of `tuple` should define `__slots__` + --> SLOT001.py:12:7 | 12 | class Bad(Tuple): # SLOT001 | ^^^ 13 | pass | -error[SLOT001]: SLOT001.py:16:7: Subclasses of `tuple` should define `__slots__` +error[SLOT001]: 16:7: Subclasses of `tuple` should define `__slots__` + --> SLOT001.py:16:7 | 16 | class Bad(Tuple[str, int, float]): # SLOT001 | ^^^ 17 | pass | -error[SLOT001]: SLOT001.py:26:7: Subclasses of `tuple` should define `__slots__` +error[SLOT001]: 26:7: Subclasses of `tuple` should define `__slots__` + --> SLOT001.py:26:7 | 24 | import builtins 25 | diff --git a/crates/ruff_linter/src/rules/flake8_slots/snapshots/ruff_linter__rules__flake8_slots__tests__SLOT002_SLOT002.py.snap b/crates/ruff_linter/src/rules/flake8_slots/snapshots/ruff_linter__rules__flake8_slots__tests__SLOT002_SLOT002.py.snap index d59497d98b..2b9fe5f105 100644 --- a/crates/ruff_linter/src/rules/flake8_slots/snapshots/ruff_linter__rules__flake8_slots__tests__SLOT002_SLOT002.py.snap +++ b/crates/ruff_linter/src/rules/flake8_slots/snapshots/ruff_linter__rules__flake8_slots__tests__SLOT002_SLOT002.py.snap @@ -1,30 +1,35 @@ --- source: crates/ruff_linter/src/rules/flake8_slots/mod.rs --- -SLOT002.py:6:7: SLOT002 Subclasses of `collections.namedtuple()` should define `__slots__` +error[SLOT002]: 6:7: Subclasses of `collections.namedtuple()` should define `__slots__` + + --> SLOT002.py:6:7 | 6 | class Bad(namedtuple("foo", ["str", "int"])): # SLOT002 - | ^^^ SLOT002 + | ^^^ 7 | pass | +error[SLOT002]: 10:7: Subclasses of call-based `typing.NamedTuple()` should define `__slots__` -SLOT002.py:10:7: SLOT002 Subclasses of call-based `typing.NamedTuple()` should define `__slots__` + --> SLOT002.py:10:7 | 10 | class UnusualButStillBad(NamedTuple("foo", [("x", int, "y", int)])): # SLOT002 - | ^^^^^^^^^^^^^^^^^^ SLOT002 + | ^^^^^^^^^^^^^^^^^^ 11 | pass | +error[SLOT002]: 30:7: Subclasses of `collections.namedtuple()` should define `__slots__` -SLOT002.py:30:7: SLOT002 Subclasses of `collections.namedtuple()` should define `__slots__` + --> SLOT002.py:30:7 | 30 | class UnusualButStillBad(namedtuple("foo", ["str", "int"]), NamedTuple("foo", [("x", int, "y", int)])): - | ^^^^^^^^^^^^^^^^^^ SLOT002 + | ^^^^^^^^^^^^^^^^^^ 31 | pass | +error[SLOT002]: 34:7: Subclasses of `collections.namedtuple()` should define `__slots__` -SLOT002.py:34:7: SLOT002 Subclasses of `collections.namedtuple()` should define `__slots__` + --> SLOT002.py:34:7 | 34 | class UnusualButStillBad(namedtuple("foo", ["str", "int"]), object): - | ^^^^^^^^^^^^^^^^^^ SLOT002 + | ^^^^^^^^^^^^^^^^^^ 35 | pass | diff --git a/crates/ruff_linter/src/rules/flake8_tidy_imports/snapshots/ruff_linter__rules__flake8_tidy_imports__tests__ban_all_imports.snap b/crates/ruff_linter/src/rules/flake8_tidy_imports/snapshots/ruff_linter__rules__flake8_tidy_imports__tests__ban_all_imports.snap index ea70a2e833..8dcd6299ad 100644 --- a/crates/ruff_linter/src/rules/flake8_tidy_imports/snapshots/ruff_linter__rules__flake8_tidy_imports__tests__ban_all_imports.snap +++ b/crates/ruff_linter/src/rules/flake8_tidy_imports/snapshots/ruff_linter__rules__flake8_tidy_imports__tests__ban_all_imports.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_tidy_imports/mod.rs --- -error[TID252]: TID252.py:7:1: Prefer absolute imports over relative imports +error[TID252]: 7:1: Prefer absolute imports over relative imports + --> TID252.py:6:9 | 6 | # TID252 7 | from . import sibling @@ -11,8 +12,9 @@ error[TID252]: TID252.py:7:1: Prefer absolute imports over relative imports 9 | from .. import parent | = help: Replace relative imports with absolute imports -error[TID252]: TID252.py:8:1: Prefer absolute imports over relative imports +error[TID252]: 8:1: Prefer absolute imports over relative imports + --> TID252.py:7:22 | 6 | # TID252 7 | from . import sibling @@ -22,8 +24,9 @@ error[TID252]: TID252.py:8:1: Prefer absolute imports over relative imports 10 | from ..parent import example | = help: Replace relative imports with absolute imports -error[TID252]: TID252.py:9:1: Prefer absolute imports over relative imports +error[TID252]: 9:1: Prefer absolute imports over relative imports + --> TID252.py:8:29 | 7 | from . import sibling 8 | from .sibling import example @@ -33,8 +36,9 @@ error[TID252]: TID252.py:9:1: Prefer absolute imports over relative imports 11 | from ... import grandparent | = help: Replace relative imports with absolute imports -error[TID252]: TID252.py:10:1: Prefer absolute imports over relative imports +error[TID252]: 10:1: Prefer absolute imports over relative imports + --> TID252.py:9:22 | 8 | from .sibling import example 9 | from .. import parent @@ -44,8 +48,9 @@ error[TID252]: TID252.py:10:1: Prefer absolute imports over relative imports 12 | from ...grandparent import example | = help: Replace relative imports with absolute imports -error[TID252]: TID252.py:11:1: Prefer absolute imports over relative imports +error[TID252]: 11:1: Prefer absolute imports over relative imports + --> TID252.py:10:29 | 9 | from .. import parent 10 | from ..parent import example @@ -55,8 +60,9 @@ error[TID252]: TID252.py:11:1: Prefer absolute imports over relative imports 13 | from .parent import hello | = help: Replace relative imports with absolute imports -error[TID252]: TID252.py:12:1: Prefer absolute imports over relative imports +error[TID252]: 12:1: Prefer absolute imports over relative imports + --> TID252.py:11:28 | 10 | from ..parent import example 11 | from ... import grandparent @@ -66,8 +72,9 @@ error[TID252]: TID252.py:12:1: Prefer absolute imports over relative imports 14 | from .\ | = help: Replace relative imports with absolute imports -error[TID252]: TID252.py:13:1: Prefer absolute imports over relative imports +error[TID252]: 13:1: Prefer absolute imports over relative imports + --> TID252.py:12:35 | 11 | from ... import grandparent 12 | from ...grandparent import example @@ -77,8 +84,9 @@ error[TID252]: TID252.py:13:1: Prefer absolute imports over relative imports 15 | parent import \ | = help: Replace relative imports with absolute imports -error[TID252]: TID252.py:14:1: Prefer absolute imports over relative imports +error[TID252]: 14:1: Prefer absolute imports over relative imports + --> TID252.py:13:27 | 12 | from ...grandparent import example 13 | from .parent import hello @@ -90,8 +98,9 @@ error[TID252]: TID252.py:14:1: Prefer absolute imports over relative imports 18 | ..parent\ | = help: Replace relative imports with absolute imports -error[TID252]: TID252.py:17:1: Prefer absolute imports over relative imports +error[TID252]: 17:1: Prefer absolute imports over relative imports + --> TID252.py:16:20 | 15 | parent import \ 16 | hello_world @@ -104,8 +113,9 @@ error[TID252]: TID252.py:17:1: Prefer absolute imports over relative imports 22 | from ...... import ultragrantparent | = help: Replace relative imports with absolute imports -error[TID252]: TID252.py:21:1: Prefer absolute imports over relative imports +error[TID252]: 21:1: Prefer absolute imports over relative imports + --> TID252.py:20:16 | 19 | import \ 20 | world_hello @@ -115,8 +125,9 @@ error[TID252]: TID252.py:21:1: Prefer absolute imports over relative imports 23 | from ....... import ultragrantparent | = help: Replace relative imports with absolute imports -error[TID252]: TID252.py:22:1: Prefer absolute imports over relative imports +error[TID252]: 22:1: Prefer absolute imports over relative imports + --> TID252.py:21:35 | 20 | world_hello 21 | from ..... import ultragrantparent @@ -126,8 +137,9 @@ error[TID252]: TID252.py:22:1: Prefer absolute imports over relative imports 24 | from ......... import ultragrantparent | = help: Replace relative imports with absolute imports -error[TID252]: TID252.py:23:1: Prefer absolute imports over relative imports +error[TID252]: 23:1: Prefer absolute imports over relative imports + --> TID252.py:22:36 | 21 | from ..... import ultragrantparent 22 | from ...... import ultragrantparent @@ -137,8 +149,9 @@ error[TID252]: TID252.py:23:1: Prefer absolute imports over relative imports 25 | from ........................... import ultragrantparent | = help: Replace relative imports with absolute imports -error[TID252]: TID252.py:24:1: Prefer absolute imports over relative imports +error[TID252]: 24:1: Prefer absolute imports over relative imports + --> TID252.py:23:37 | 22 | from ...... import ultragrantparent 23 | from ....... import ultragrantparent @@ -148,8 +161,9 @@ error[TID252]: TID252.py:24:1: Prefer absolute imports over relative imports 26 | from .....parent import ultragrantparent | = help: Replace relative imports with absolute imports -error[TID252]: TID252.py:25:1: Prefer absolute imports over relative imports +error[TID252]: 25:1: Prefer absolute imports over relative imports + --> TID252.py:24:39 | 23 | from ....... import ultragrantparent 24 | from ......... import ultragrantparent @@ -159,8 +173,9 @@ error[TID252]: TID252.py:25:1: Prefer absolute imports over relative imports 27 | from .........parent import ultragrantparent | = help: Replace relative imports with absolute imports -error[TID252]: TID252.py:26:1: Prefer absolute imports over relative imports +error[TID252]: 26:1: Prefer absolute imports over relative imports + --> TID252.py:25:57 | 24 | from ......... import ultragrantparent 25 | from ........................... import ultragrantparent @@ -170,8 +185,9 @@ error[TID252]: TID252.py:26:1: Prefer absolute imports over relative imports 28 | from ...........................parent import ultragrantparent | = help: Replace relative imports with absolute imports -error[TID252]: TID252.py:27:1: Prefer absolute imports over relative imports +error[TID252]: 27:1: Prefer absolute imports over relative imports + --> TID252.py:26:41 | 25 | from ........................... import ultragrantparent 26 | from .....parent import ultragrantparent @@ -180,8 +196,9 @@ error[TID252]: TID252.py:27:1: Prefer absolute imports over relative imports 28 | from ...........................parent import ultragrantparent | = help: Replace relative imports with absolute imports -error[TID252]: TID252.py:28:1: Prefer absolute imports over relative imports +error[TID252]: 28:1: Prefer absolute imports over relative imports + --> TID252.py:27:45 | 26 | from .....parent import ultragrantparent 27 | from .........parent import ultragrantparent diff --git a/crates/ruff_linter/src/rules/flake8_tidy_imports/snapshots/ruff_linter__rules__flake8_tidy_imports__tests__ban_parent_imports.snap b/crates/ruff_linter/src/rules/flake8_tidy_imports/snapshots/ruff_linter__rules__flake8_tidy_imports__tests__ban_parent_imports.snap index 5a43044c76..d911bf8265 100644 --- a/crates/ruff_linter/src/rules/flake8_tidy_imports/snapshots/ruff_linter__rules__flake8_tidy_imports__tests__ban_parent_imports.snap +++ b/crates/ruff_linter/src/rules/flake8_tidy_imports/snapshots/ruff_linter__rules__flake8_tidy_imports__tests__ban_parent_imports.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_tidy_imports/mod.rs --- -error[TID252]: TID252.py:9:1: Prefer absolute imports over relative imports from parent modules +error[TID252]: 9:1: Prefer absolute imports over relative imports from parent modules + --> TID252.py:8:29 | 7 | from . import sibling 8 | from .sibling import example @@ -12,8 +13,9 @@ error[TID252]: TID252.py:9:1: Prefer absolute imports over relative imports from 11 | from ... import grandparent | = help: Replace relative imports from parent modules with absolute imports -error[TID252]: TID252.py:10:1: Prefer absolute imports over relative imports from parent modules +error[TID252]: 10:1: Prefer absolute imports over relative imports from parent modules + --> TID252.py:9:22 | 8 | from .sibling import example 9 | from .. import parent @@ -23,8 +25,9 @@ error[TID252]: TID252.py:10:1: Prefer absolute imports over relative imports fro 12 | from ...grandparent import example | = help: Replace relative imports from parent modules with absolute imports -error[TID252]: TID252.py:11:1: Prefer absolute imports over relative imports from parent modules +error[TID252]: 11:1: Prefer absolute imports over relative imports from parent modules + --> TID252.py:10:29 | 9 | from .. import parent 10 | from ..parent import example @@ -34,8 +37,9 @@ error[TID252]: TID252.py:11:1: Prefer absolute imports over relative imports fro 13 | from .parent import hello | = help: Replace relative imports from parent modules with absolute imports -error[TID252]: TID252.py:12:1: Prefer absolute imports over relative imports from parent modules +error[TID252]: 12:1: Prefer absolute imports over relative imports from parent modules + --> TID252.py:11:28 | 10 | from ..parent import example 11 | from ... import grandparent @@ -45,8 +49,9 @@ error[TID252]: TID252.py:12:1: Prefer absolute imports over relative imports fro 14 | from .\ | = help: Replace relative imports from parent modules with absolute imports -error[TID252]: TID252.py:17:1: Prefer absolute imports over relative imports from parent modules +error[TID252]: 17:1: Prefer absolute imports over relative imports from parent modules + --> TID252.py:16:20 | 15 | parent import \ 16 | hello_world @@ -59,8 +64,9 @@ error[TID252]: TID252.py:17:1: Prefer absolute imports over relative imports fro 22 | from ...... import ultragrantparent | = help: Replace relative imports from parent modules with absolute imports -error[TID252]: TID252.py:21:1: Prefer absolute imports over relative imports from parent modules +error[TID252]: 21:1: Prefer absolute imports over relative imports from parent modules + --> TID252.py:20:16 | 19 | import \ 20 | world_hello @@ -70,8 +76,9 @@ error[TID252]: TID252.py:21:1: Prefer absolute imports over relative imports fro 23 | from ....... import ultragrantparent | = help: Replace relative imports from parent modules with absolute imports -error[TID252]: TID252.py:22:1: Prefer absolute imports over relative imports from parent modules +error[TID252]: 22:1: Prefer absolute imports over relative imports from parent modules + --> TID252.py:21:35 | 20 | world_hello 21 | from ..... import ultragrantparent @@ -81,8 +88,9 @@ error[TID252]: TID252.py:22:1: Prefer absolute imports over relative imports fro 24 | from ......... import ultragrantparent | = help: Replace relative imports from parent modules with absolute imports -error[TID252]: TID252.py:23:1: Prefer absolute imports over relative imports from parent modules +error[TID252]: 23:1: Prefer absolute imports over relative imports from parent modules + --> TID252.py:22:36 | 21 | from ..... import ultragrantparent 22 | from ...... import ultragrantparent @@ -92,8 +100,9 @@ error[TID252]: TID252.py:23:1: Prefer absolute imports over relative imports fro 25 | from ........................... import ultragrantparent | = help: Replace relative imports from parent modules with absolute imports -error[TID252]: TID252.py:24:1: Prefer absolute imports over relative imports from parent modules +error[TID252]: 24:1: Prefer absolute imports over relative imports from parent modules + --> TID252.py:23:37 | 22 | from ...... import ultragrantparent 23 | from ....... import ultragrantparent @@ -103,8 +112,9 @@ error[TID252]: TID252.py:24:1: Prefer absolute imports over relative imports fro 26 | from .....parent import ultragrantparent | = help: Replace relative imports from parent modules with absolute imports -error[TID252]: TID252.py:25:1: Prefer absolute imports over relative imports from parent modules +error[TID252]: 25:1: Prefer absolute imports over relative imports from parent modules + --> TID252.py:24:39 | 23 | from ....... import ultragrantparent 24 | from ......... import ultragrantparent @@ -114,8 +124,9 @@ error[TID252]: TID252.py:25:1: Prefer absolute imports over relative imports fro 27 | from .........parent import ultragrantparent | = help: Replace relative imports from parent modules with absolute imports -error[TID252]: TID252.py:26:1: Prefer absolute imports over relative imports from parent modules +error[TID252]: 26:1: Prefer absolute imports over relative imports from parent modules + --> TID252.py:25:57 | 24 | from ......... import ultragrantparent 25 | from ........................... import ultragrantparent @@ -125,8 +136,9 @@ error[TID252]: TID252.py:26:1: Prefer absolute imports over relative imports fro 28 | from ...........................parent import ultragrantparent | = help: Replace relative imports from parent modules with absolute imports -error[TID252]: TID252.py:27:1: Prefer absolute imports over relative imports from parent modules +error[TID252]: 27:1: Prefer absolute imports over relative imports from parent modules + --> TID252.py:26:41 | 25 | from ........................... import ultragrantparent 26 | from .....parent import ultragrantparent @@ -135,8 +147,9 @@ error[TID252]: TID252.py:27:1: Prefer absolute imports over relative imports fro 28 | from ...........................parent import ultragrantparent | = help: Replace relative imports from parent modules with absolute imports -error[TID252]: TID252.py:28:1: Prefer absolute imports over relative imports from parent modules +error[TID252]: 28:1: Prefer absolute imports over relative imports from parent modules + --> TID252.py:27:45 | 26 | from .....parent import ultragrantparent 27 | from .........parent import ultragrantparent diff --git a/crates/ruff_linter/src/rules/flake8_tidy_imports/snapshots/ruff_linter__rules__flake8_tidy_imports__tests__ban_parent_imports_package.snap b/crates/ruff_linter/src/rules/flake8_tidy_imports/snapshots/ruff_linter__rules__flake8_tidy_imports__tests__ban_parent_imports_package.snap index 46d225b393..b97d350a01 100644 --- a/crates/ruff_linter/src/rules/flake8_tidy_imports/snapshots/ruff_linter__rules__flake8_tidy_imports__tests__ban_parent_imports_package.snap +++ b/crates/ruff_linter/src/rules/flake8_tidy_imports/snapshots/ruff_linter__rules__flake8_tidy_imports__tests__ban_parent_imports_package.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_tidy_imports/mod.rs --- -error[TID252]: application.py:5:1: Prefer absolute imports over relative imports from parent modules +error[TID252]: 5:1: Prefer absolute imports over relative imports from parent modules + --> application.py:4:1 | 3 | import attrs 4 | @@ -12,8 +13,9 @@ error[TID252]: application.py:5:1: Prefer absolute imports over relative imports 7 | from ..server import example | = help: Replace relative imports from parent modules with absolute imports -error[TID252]: application.py:6:1: [*] Prefer absolute imports over relative imports from parent modules +error[TID252]: 6:1: [*] Prefer absolute imports over relative imports from parent modules + --> application.py:5:24 | 5 | from ....import unknown 6 | from ..protocol import commands, definitions, responses @@ -32,8 +34,9 @@ error[TID252]: application.py:6:1: [*] Prefer absolute imports over relative imp 8 8 | from .. import server 9 9 | from . import logger, models -error[TID252]: application.py:6:1: [*] Prefer absolute imports over relative imports from parent modules +error[TID252]: 6:1: [*] Prefer absolute imports over relative imports from parent modules + --> application.py:5:24 | 5 | from ....import unknown 6 | from ..protocol import commands, definitions, responses @@ -52,8 +55,9 @@ error[TID252]: application.py:6:1: [*] Prefer absolute imports over relative imp 8 8 | from .. import server 9 9 | from . import logger, models -error[TID252]: application.py:6:1: [*] Prefer absolute imports over relative imports from parent modules +error[TID252]: 6:1: [*] Prefer absolute imports over relative imports from parent modules + --> application.py:5:24 | 5 | from ....import unknown 6 | from ..protocol import commands, definitions, responses @@ -72,8 +76,9 @@ error[TID252]: application.py:6:1: [*] Prefer absolute imports over relative imp 8 8 | from .. import server 9 9 | from . import logger, models -error[TID252]: application.py:7:1: [*] Prefer absolute imports over relative imports from parent modules +error[TID252]: 7:1: [*] Prefer absolute imports over relative imports from parent modules + --> application.py:6:56 | 5 | from ....import unknown 6 | from ..protocol import commands, definitions, responses @@ -93,8 +98,9 @@ error[TID252]: application.py:7:1: [*] Prefer absolute imports over relative imp 9 9 | from . import logger, models 10 10 | from ..protocol.UpperCaseModule import some_function -error[TID252]: application.py:8:1: [*] Prefer absolute imports over relative imports from parent modules +error[TID252]: 8:1: [*] Prefer absolute imports over relative imports from parent modules + --> application.py:7:29 | 6 | from ..protocol import commands, definitions, responses 7 | from ..server import example @@ -113,8 +119,9 @@ error[TID252]: application.py:8:1: [*] Prefer absolute imports over relative imp 9 9 | from . import logger, models 10 10 | from ..protocol.UpperCaseModule import some_function -error[TID252]: application.py:10:1: [*] Prefer absolute imports over relative imports from parent modules +error[TID252]: 10:1: [*] Prefer absolute imports over relative imports from parent modules + --> application.py:9:29 | 8 | from .. import server 9 | from . import logger, models diff --git a/crates/ruff_linter/src/rules/flake8_tidy_imports/snapshots/ruff_linter__rules__flake8_tidy_imports__tests__banned_api.snap b/crates/ruff_linter/src/rules/flake8_tidy_imports/snapshots/ruff_linter__rules__flake8_tidy_imports__tests__banned_api.snap index 84cf111071..d65dbbac9c 100644 --- a/crates/ruff_linter/src/rules/flake8_tidy_imports/snapshots/ruff_linter__rules__flake8_tidy_imports__tests__banned_api.snap +++ b/crates/ruff_linter/src/rules/flake8_tidy_imports/snapshots/ruff_linter__rules__flake8_tidy_imports__tests__banned_api.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_tidy_imports/mod.rs --- -error[TID251]: TID251.py:2:8: `cgi` is banned: The cgi module is deprecated. +error[TID251]: 2:8: `cgi` is banned: The cgi module is deprecated. + --> TID251.py:2:8 | 1 | ## Banned modules ## 2 | import cgi @@ -10,8 +11,9 @@ error[TID251]: TID251.py:2:8: `cgi` is banned: The cgi module is deprecated. 3 | 4 | from cgi import * | -error[TID251]: TID251.py:4:1: `cgi` is banned: The cgi module is deprecated. +error[TID251]: 4:1: `cgi` is banned: The cgi module is deprecated. + --> TID251.py:3:1 | 2 | import cgi 3 | @@ -20,8 +22,9 @@ error[TID251]: TID251.py:4:1: `cgi` is banned: The cgi module is deprecated. 5 | 6 | from cgi import a, b, c | -error[TID251]: TID251.py:6:1: `cgi` is banned: The cgi module is deprecated. +error[TID251]: 6:1: `cgi` is banned: The cgi module is deprecated. + --> TID251.py:5:1 | 4 | from cgi import * 5 | @@ -30,8 +33,9 @@ error[TID251]: TID251.py:6:1: `cgi` is banned: The cgi module is deprecated. 7 | 8 | # banning a module also bans any submodules | -error[TID251]: TID251.py:9:8: `cgi` is banned: The cgi module is deprecated. +error[TID251]: 9:8: `cgi` is banned: The cgi module is deprecated. + --> TID251.py:9:8 | 8 | # banning a module also bans any submodules 9 | import cgi.foo.bar @@ -39,8 +43,9 @@ error[TID251]: TID251.py:9:8: `cgi` is banned: The cgi module is deprecated. 10 | 11 | from cgi.foo import bar | -error[TID251]: TID251.py:11:1: `cgi` is banned: The cgi module is deprecated. +error[TID251]: 11:1: `cgi` is banned: The cgi module is deprecated. + --> TID251.py:10:1 | 9 | import cgi.foo.bar 10 | @@ -49,8 +54,9 @@ error[TID251]: TID251.py:11:1: `cgi` is banned: The cgi module is deprecated. 12 | 13 | from cgi.foo.bar import * | -error[TID251]: TID251.py:13:1: `cgi` is banned: The cgi module is deprecated. +error[TID251]: 13:1: `cgi` is banned: The cgi module is deprecated. + --> TID251.py:12:1 | 11 | from cgi.foo import bar 12 | @@ -59,8 +65,9 @@ error[TID251]: TID251.py:13:1: `cgi` is banned: The cgi module is deprecated. 14 | 15 | ## Banned module members ## | -error[TID251]: TID251.py:17:20: `typing.TypedDict` is banned: Use typing_extensions.TypedDict instead. +error[TID251]: 17:20: `typing.TypedDict` is banned: Use typing_extensions.TypedDict instead. + --> TID251.py:17:20 | 15 | ## Banned module members ## 16 | @@ -69,8 +76,9 @@ error[TID251]: TID251.py:17:20: `typing.TypedDict` is banned: Use typing_extensi 18 | 19 | import typing | -error[TID251]: TID251.py:22:1: `typing.TypedDict` is banned: Use typing_extensions.TypedDict instead. +error[TID251]: 22:1: `typing.TypedDict` is banned: Use typing_extensions.TypedDict instead. + --> TID251.py:21:30 | 21 | # attribute access is checked 22 | typing.TypedDict @@ -78,8 +86,9 @@ error[TID251]: TID251.py:22:1: `typing.TypedDict` is banned: Use typing_extensio 23 | 24 | typing.TypedDict.anything | -error[TID251]: TID251.py:24:1: `typing.TypedDict` is banned: Use typing_extensions.TypedDict instead. +error[TID251]: 24:1: `typing.TypedDict` is banned: Use typing_extensions.TypedDict instead. + --> TID251.py:23:1 | 22 | typing.TypedDict 23 | @@ -88,8 +97,9 @@ error[TID251]: TID251.py:24:1: `typing.TypedDict` is banned: Use typing_extensio 25 | 26 | # function calls are checked | -error[TID251]: TID251.py:27:1: `typing.TypedDict` is banned: Use typing_extensions.TypedDict instead. +error[TID251]: 27:1: `typing.TypedDict` is banned: Use typing_extensions.TypedDict instead. + --> TID251.py:26:29 | 26 | # function calls are checked 27 | typing.TypedDict() @@ -97,8 +107,9 @@ error[TID251]: TID251.py:27:1: `typing.TypedDict` is banned: Use typing_extensio 28 | 29 | typing.TypedDict.anything() | -error[TID251]: TID251.py:29:1: `typing.TypedDict` is banned: Use typing_extensions.TypedDict instead. +error[TID251]: 29:1: `typing.TypedDict` is banned: Use typing_extensions.TypedDict instead. + --> TID251.py:28:1 | 27 | typing.TypedDict() 28 | @@ -107,8 +118,9 @@ error[TID251]: TID251.py:29:1: `typing.TypedDict` is banned: Use typing_extensio 30 | 31 | # import aliases are resolved | -error[TID251]: TID251.py:33:1: `typing.TypedDict` is banned: Use typing_extensions.TypedDict instead. +error[TID251]: 33:1: `typing.TypedDict` is banned: Use typing_extensions.TypedDict instead. + --> TID251.py:32:36 | 31 | # import aliases are resolved 32 | import typing as totally_not_typing diff --git a/crates/ruff_linter/src/rules/flake8_tidy_imports/snapshots/ruff_linter__rules__flake8_tidy_imports__tests__banned_api_package.snap b/crates/ruff_linter/src/rules/flake8_tidy_imports/snapshots/ruff_linter__rules__flake8_tidy_imports__tests__banned_api_package.snap index 31c137a22f..7e27e5722a 100644 --- a/crates/ruff_linter/src/rules/flake8_tidy_imports/snapshots/ruff_linter__rules__flake8_tidy_imports__tests__banned_api_package.snap +++ b/crates/ruff_linter/src/rules/flake8_tidy_imports/snapshots/ruff_linter__rules__flake8_tidy_imports__tests__banned_api_package.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_tidy_imports/mod.rs --- -error[TID251]: application.py:3:8: `attrs` is banned: The attrs module is deprecated. +error[TID251]: 3:8: `attrs` is banned: The attrs module is deprecated. + --> application.py:3:8 | 1 | from typing import TYPE_CHECKING, Any, ClassVar 2 | @@ -11,8 +12,9 @@ error[TID251]: application.py:3:8: `attrs` is banned: The attrs module is deprec 4 | 5 | from ....import unknown | -error[TID251]: application.py:6:1: `my_package.sublib.protocol` is banned: The protocol module is deprecated. +error[TID251]: 6:1: `my_package.sublib.protocol` is banned: The protocol module is deprecated. + --> application.py:5:24 | 5 | from ....import unknown 6 | from ..protocol import commands, definitions, responses @@ -20,8 +22,9 @@ error[TID251]: application.py:6:1: `my_package.sublib.protocol` is banned: The p 7 | from ..server import example 8 | from .. import server | -error[TID251]: application.py:10:1: `my_package.sublib.protocol` is banned: The protocol module is deprecated. +error[TID251]: 10:1: `my_package.sublib.protocol` is banned: The protocol module is deprecated. + --> application.py:9:29 | 8 | from .. import server 9 | from . import logger, models diff --git a/crates/ruff_linter/src/rules/flake8_tidy_imports/snapshots/ruff_linter__rules__flake8_tidy_imports__tests__banned_module_level_imports.snap b/crates/ruff_linter/src/rules/flake8_tidy_imports/snapshots/ruff_linter__rules__flake8_tidy_imports__tests__banned_module_level_imports.snap index 5e6947dd99..3ef6d9fee3 100644 --- a/crates/ruff_linter/src/rules/flake8_tidy_imports/snapshots/ruff_linter__rules__flake8_tidy_imports__tests__banned_module_level_imports.snap +++ b/crates/ruff_linter/src/rules/flake8_tidy_imports/snapshots/ruff_linter__rules__flake8_tidy_imports__tests__banned_module_level_imports.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_tidy_imports/mod.rs --- -error[TID253]: TID253.py:2:8: `torch` is banned at the module level +error[TID253]: 2:8: `torch` is banned at the module level + --> TID253.py:2:8 | 1 | ## Banned modules ## 2 | import torch @@ -10,8 +11,9 @@ error[TID253]: TID253.py:2:8: `torch` is banned at the module level 3 | 4 | from torch import * | -error[TID253]: TID253.py:4:1: `torch` is banned at the module level +error[TID253]: 4:1: `torch` is banned at the module level + --> TID253.py:3:1 | 2 | import torch 3 | @@ -20,8 +22,9 @@ error[TID253]: TID253.py:4:1: `torch` is banned at the module level 5 | 6 | from tensorflow import a, b, c | -error[TID253]: TID253.py:6:1: `tensorflow` is banned at the module level +error[TID253]: 6:1: `tensorflow` is banned at the module level + --> TID253.py:5:1 | 4 | from torch import * 5 | @@ -30,8 +33,9 @@ error[TID253]: TID253.py:6:1: `tensorflow` is banned at the module level 7 | 8 | import torch as torch_wearing_a_trenchcoat | -error[TID253]: TID253.py:8:8: `torch` is banned at the module level +error[TID253]: 8:8: `torch` is banned at the module level + --> TID253.py:8:8 | 6 | from tensorflow import a, b, c 7 | @@ -40,8 +44,9 @@ error[TID253]: TID253.py:8:8: `torch` is banned at the module level 9 | 10 | # this should count as module level | -error[TID253]: TID253.py:11:15: `tensorflow` is banned at the module level +error[TID253]: 11:15: `tensorflow` is banned at the module level + --> TID253.py:11:15 | 10 | # this should count as module level 11 | x = 1; import tensorflow @@ -49,8 +54,9 @@ error[TID253]: TID253.py:11:15: `tensorflow` is banned at the module level 12 | 13 | # banning a module also bans any submodules | -error[TID253]: TID253.py:14:8: `torch` is banned at the module level +error[TID253]: 14:8: `torch` is banned at the module level + --> TID253.py:14:8 | 13 | # banning a module also bans any submodules 14 | import torch.foo.bar @@ -58,8 +64,9 @@ error[TID253]: TID253.py:14:8: `torch` is banned at the module level 15 | 16 | from tensorflow.foo import bar | -error[TID253]: TID253.py:16:1: `tensorflow` is banned at the module level +error[TID253]: 16:1: `tensorflow` is banned at the module level + --> TID253.py:15:1 | 14 | import torch.foo.bar 15 | @@ -68,8 +75,9 @@ error[TID253]: TID253.py:16:1: `tensorflow` is banned at the module level 17 | 18 | from torch.foo.bar import * | -error[TID253]: TID253.py:18:1: `torch` is banned at the module level +error[TID253]: 18:1: `torch` is banned at the module level + --> TID253.py:17:1 | 16 | from tensorflow.foo import bar 17 | diff --git a/crates/ruff_linter/src/rules/flake8_todos/snapshots/ruff_linter__rules__flake8_todos__tests__invalid-todo-capitalization_TD006.py.snap b/crates/ruff_linter/src/rules/flake8_todos/snapshots/ruff_linter__rules__flake8_todos__tests__invalid-todo-capitalization_TD006.py.snap index 75ee017739..ea27a153fb 100644 --- a/crates/ruff_linter/src/rules/flake8_todos/snapshots/ruff_linter__rules__flake8_todos__tests__invalid-todo-capitalization_TD006.py.snap +++ b/crates/ruff_linter/src/rules/flake8_todos/snapshots/ruff_linter__rules__flake8_todos__tests__invalid-todo-capitalization_TD006.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_todos/mod.rs --- -error[TD006]: TD006.py:4:3: [*] Invalid TODO capitalization: `ToDo` should be `TODO` +error[TD006]: 4:3: [*] Invalid TODO capitalization: `ToDo` should be `TODO` + --> TD006.py:4:3 | 2 | # TODO (evanrittenhouse): this is a valid TODO 3 | # TDO006 - error @@ -21,8 +22,9 @@ error[TD006]: TD006.py:4:3: [*] Invalid TODO capitalization: `ToDo` should be `T 5 5 | # todo (evanrittenhouse): another invalid capitalization 6 6 | # foo # todo: invalid capitalization -error[TD006]: TD006.py:5:3: [*] Invalid TODO capitalization: `todo` should be `TODO` +error[TD006]: 5:3: [*] Invalid TODO capitalization: `todo` should be `TODO` + --> TD006.py:5:3 | 3 | # TDO006 - error 4 | # ToDo (evanrittenhouse): invalid capitalization @@ -39,8 +41,9 @@ error[TD006]: TD006.py:5:3: [*] Invalid TODO capitalization: `todo` should be `T 5 |+# TODO (evanrittenhouse): another invalid capitalization 6 6 | # foo # todo: invalid capitalization -error[TD006]: TD006.py:6:9: [*] Invalid TODO capitalization: `todo` should be `TODO` +error[TD006]: 6:9: [*] Invalid TODO capitalization: `todo` should be `TODO` + --> TD006.py:6:9 | 4 | # ToDo (evanrittenhouse): invalid capitalization 5 | # todo (evanrittenhouse): another invalid capitalization diff --git a/crates/ruff_linter/src/rules/flake8_todos/snapshots/ruff_linter__rules__flake8_todos__tests__invalid-todo-tag_TD001.py.snap b/crates/ruff_linter/src/rules/flake8_todos/snapshots/ruff_linter__rules__flake8_todos__tests__invalid-todo-tag_TD001.py.snap index a878d53d57..6eebcf421b 100644 --- a/crates/ruff_linter/src/rules/flake8_todos/snapshots/ruff_linter__rules__flake8_todos__tests__invalid-todo-tag_TD001.py.snap +++ b/crates/ruff_linter/src/rules/flake8_todos/snapshots/ruff_linter__rules__flake8_todos__tests__invalid-todo-tag_TD001.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_todos/mod.rs --- -error[TD001]: TD001.py:7:3: Invalid TODO tag: `XXX` +error[TD001]: 7:3: Invalid TODO tag: `XXX` + --> TD001.py:7:3 | 6 | # T001 - errors 7 | # XXX (evanrittenhouse): this is not fine @@ -10,8 +11,9 @@ error[TD001]: TD001.py:7:3: Invalid TODO tag: `XXX` 8 | # FIXME (evanrittenhouse): this is not fine 9 | # foo # XXX: this isn't fine either | -error[TD001]: TD001.py:8:3: Invalid TODO tag: `FIXME` +error[TD001]: 8:3: Invalid TODO tag: `FIXME` + --> TD001.py:8:3 | 6 | # T001 - errors 7 | # XXX (evanrittenhouse): this is not fine @@ -19,8 +21,9 @@ error[TD001]: TD001.py:8:3: Invalid TODO tag: `FIXME` | ^^^^^ 9 | # foo # XXX: this isn't fine either | -error[TD001]: TD001.py:9:9: Invalid TODO tag: `XXX` +error[TD001]: 9:9: Invalid TODO tag: `XXX` + --> TD001.py:9:9 | 7 | # XXX (evanrittenhouse): this is not fine 8 | # FIXME (evanrittenhouse): this is not fine diff --git a/crates/ruff_linter/src/rules/flake8_todos/snapshots/ruff_linter__rules__flake8_todos__tests__missing-space-after-todo-colon_TD007.py.snap b/crates/ruff_linter/src/rules/flake8_todos/snapshots/ruff_linter__rules__flake8_todos__tests__missing-space-after-todo-colon_TD007.py.snap index b4f8af1937..af384d5736 100644 --- a/crates/ruff_linter/src/rules/flake8_todos/snapshots/ruff_linter__rules__flake8_todos__tests__missing-space-after-todo-colon_TD007.py.snap +++ b/crates/ruff_linter/src/rules/flake8_todos/snapshots/ruff_linter__rules__flake8_todos__tests__missing-space-after-todo-colon_TD007.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_todos/mod.rs --- -error[TD007]: TD007.py:5:3: Missing space after colon in TODO +error[TD007]: 5:3: Missing space after colon in TODO + --> TD007.py:5:3 | 3 | # TODO: so does this 4 | # T007 - errors @@ -11,8 +12,9 @@ error[TD007]: TD007.py:5:3: Missing space after colon in TODO 6 | # TODO (evanrittenhouse):this doesn't either 7 | # TODO:neither does this | -error[TD007]: TD007.py:6:3: Missing space after colon in TODO +error[TD007]: 6:3: Missing space after colon in TODO + --> TD007.py:6:3 | 4 | # T007 - errors 5 | # TODO(evanrittenhouse):this has no space after a colon @@ -21,8 +23,9 @@ error[TD007]: TD007.py:6:3: Missing space after colon in TODO 7 | # TODO:neither does this 8 | # FIXME:and lastly neither does this | -error[TD007]: TD007.py:7:3: Missing space after colon in TODO +error[TD007]: 7:3: Missing space after colon in TODO + --> TD007.py:7:3 | 5 | # TODO(evanrittenhouse):this has no space after a colon 6 | # TODO (evanrittenhouse):this doesn't either @@ -31,8 +34,9 @@ error[TD007]: TD007.py:7:3: Missing space after colon in TODO 8 | # FIXME:and lastly neither does this 9 | # foo # TODO:this is really the last one | -error[TD007]: TD007.py:8:3: Missing space after colon in TODO +error[TD007]: 8:3: Missing space after colon in TODO + --> TD007.py:8:3 | 6 | # TODO (evanrittenhouse):this doesn't either 7 | # TODO:neither does this @@ -41,8 +45,9 @@ error[TD007]: TD007.py:8:3: Missing space after colon in TODO 9 | # foo # TODO:this is really the last one 10 | # TODO this colon doesn't terminate the tag, so don't check it. https://www.google.com | -error[TD007]: TD007.py:9:9: Missing space after colon in TODO +error[TD007]: 9:9: Missing space after colon in TODO + --> TD007.py:9:9 | 7 | # TODO:neither does this 8 | # FIXME:and lastly neither does this diff --git a/crates/ruff_linter/src/rules/flake8_todos/snapshots/ruff_linter__rules__flake8_todos__tests__missing-todo-author_TD002.py.snap b/crates/ruff_linter/src/rules/flake8_todos/snapshots/ruff_linter__rules__flake8_todos__tests__missing-todo-author_TD002.py.snap index cb20a9629f..43f543bf15 100644 --- a/crates/ruff_linter/src/rules/flake8_todos/snapshots/ruff_linter__rules__flake8_todos__tests__missing-todo-author_TD002.py.snap +++ b/crates/ruff_linter/src/rules/flake8_todos/snapshots/ruff_linter__rules__flake8_todos__tests__missing-todo-author_TD002.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_todos/mod.rs --- -error[TD002]: TD002.py:11:3: Missing author in TODO; try: `# TODO(): ...` or `# TODO @: ...` +error[TD002]: 11:3: Missing author in TODO; try: `# TODO(): ...` or `# TODO @: ...` + --> TD002.py:11:3 | 9 | # TODO @mayrholu and more: this has an author 10 | # T002 - errors @@ -11,8 +12,9 @@ error[TD002]: TD002.py:11:3: Missing author in TODO; try: `# TODO() 12 | # FIXME: neither does this 13 | # TODO : and neither does this | -error[TD002]: TD002.py:12:3: Missing author in TODO; try: `# TODO(): ...` or `# TODO @: ...` +error[TD002]: 12:3: Missing author in TODO; try: `# TODO(): ...` or `# TODO @: ...` + --> TD002.py:12:3 | 10 | # T002 - errors 11 | # TODO: this has no author @@ -21,8 +23,9 @@ error[TD002]: TD002.py:12:3: Missing author in TODO; try: `# TODO() 13 | # TODO : and neither does this 14 | # foo # TODO: this doesn't either | -error[TD002]: TD002.py:13:3: Missing author in TODO; try: `# TODO(): ...` or `# TODO @: ...` +error[TD002]: 13:3: Missing author in TODO; try: `# TODO(): ...` or `# TODO @: ...` + --> TD002.py:13:3 | 11 | # TODO: this has no author 12 | # FIXME: neither does this @@ -30,8 +33,9 @@ error[TD002]: TD002.py:13:3: Missing author in TODO; try: `# TODO() | ^^^^ 14 | # foo # TODO: this doesn't either | -error[TD002]: TD002.py:14:9: Missing author in TODO; try: `# TODO(): ...` or `# TODO @: ...` +error[TD002]: 14:9: Missing author in TODO; try: `# TODO(): ...` or `# TODO @: ...` + --> TD002.py:14:9 | 12 | # FIXME: neither does this 13 | # TODO : and neither does this diff --git a/crates/ruff_linter/src/rules/flake8_todos/snapshots/ruff_linter__rules__flake8_todos__tests__missing-todo-colon_TD004.py.snap b/crates/ruff_linter/src/rules/flake8_todos/snapshots/ruff_linter__rules__flake8_todos__tests__missing-todo-colon_TD004.py.snap index ace9db6864..309565fbc6 100644 --- a/crates/ruff_linter/src/rules/flake8_todos/snapshots/ruff_linter__rules__flake8_todos__tests__missing-todo-colon_TD004.py.snap +++ b/crates/ruff_linter/src/rules/flake8_todos/snapshots/ruff_linter__rules__flake8_todos__tests__missing-todo-colon_TD004.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_todos/mod.rs --- -error[TD004]: TD004.py:4:3: Missing colon in TODO +error[TD004]: 4:3: Missing colon in TODO + --> TD004.py:4:3 | 2 | # TODO(evanrittenhouse): this has a colon 3 | # T004 - errors @@ -11,8 +12,9 @@ error[TD004]: TD004.py:4:3: Missing colon in TODO 5 | # TODO(evanrittenhouse 😀) this has no colon 6 | # FIXME add a colon | -error[TD004]: TD004.py:5:3: Missing colon in TODO +error[TD004]: 5:3: Missing colon in TODO + --> TD004.py:5:3 | 3 | # T004 - errors 4 | # TODO this has no colon @@ -21,8 +23,9 @@ error[TD004]: TD004.py:5:3: Missing colon in TODO 6 | # FIXME add a colon 7 | # foo # TODO add a colon | -error[TD004]: TD004.py:6:3: Missing colon in TODO +error[TD004]: 6:3: Missing colon in TODO + --> TD004.py:6:3 | 4 | # TODO this has no colon 5 | # TODO(evanrittenhouse 😀) this has no colon @@ -31,8 +34,9 @@ error[TD004]: TD004.py:6:3: Missing colon in TODO 7 | # foo # TODO add a colon 8 | # TODO this has a colon but it doesn't terminate the tag, so this should throw. https://www.google.com | -error[TD004]: TD004.py:7:9: Missing colon in TODO +error[TD004]: 7:9: Missing colon in TODO + --> TD004.py:7:9 | 5 | # TODO(evanrittenhouse 😀) this has no colon 6 | # FIXME add a colon @@ -40,8 +44,9 @@ error[TD004]: TD004.py:7:9: Missing colon in TODO | ^^^^ 8 | # TODO this has a colon but it doesn't terminate the tag, so this should throw. https://www.google.com | -error[TD004]: TD004.py:8:3: Missing colon in TODO +error[TD004]: 8:3: Missing colon in TODO + --> TD004.py:8:3 | 6 | # FIXME add a colon 7 | # foo # TODO add a colon diff --git a/crates/ruff_linter/src/rules/flake8_todos/snapshots/ruff_linter__rules__flake8_todos__tests__missing-todo-description_TD005.py.snap b/crates/ruff_linter/src/rules/flake8_todos/snapshots/ruff_linter__rules__flake8_todos__tests__missing-todo-description_TD005.py.snap index 3b8845901f..09c2c03279 100644 --- a/crates/ruff_linter/src/rules/flake8_todos/snapshots/ruff_linter__rules__flake8_todos__tests__missing-todo-description_TD005.py.snap +++ b/crates/ruff_linter/src/rules/flake8_todos/snapshots/ruff_linter__rules__flake8_todos__tests__missing-todo-description_TD005.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_todos/mod.rs --- -error[TD005]: TD005.py:4:3: Missing issue description after `TODO` +error[TD005]: 4:3: Missing issue description after `TODO` + --> TD005.py:4:3 | 2 | # TODO(evanrittenhouse): this has text, while the errors do not 3 | # T005 - errors @@ -11,8 +12,9 @@ error[TD005]: TD005.py:4:3: Missing issue description after `TODO` 5 | # TODO(evanrittenhouse) 6 | # FIXME | -error[TD005]: TD005.py:5:3: Missing issue description after `TODO` +error[TD005]: 5:3: Missing issue description after `TODO` + --> TD005.py:5:3 | 3 | # T005 - errors 4 | # TODO(evanrittenhouse): @@ -21,8 +23,9 @@ error[TD005]: TD005.py:5:3: Missing issue description after `TODO` 6 | # FIXME 7 | # foo # TODO | -error[TD005]: TD005.py:6:3: Missing issue description after `TODO` +error[TD005]: 6:3: Missing issue description after `TODO` + --> TD005.py:6:3 | 4 | # TODO(evanrittenhouse): 5 | # TODO(evanrittenhouse) @@ -30,8 +33,9 @@ error[TD005]: TD005.py:6:3: Missing issue description after `TODO` | ^^^^^ 7 | # foo # TODO | -error[TD005]: TD005.py:7:9: Missing issue description after `TODO` +error[TD005]: 7:9: Missing issue description after `TODO` + --> TD005.py:7:9 | 5 | # TODO(evanrittenhouse) 6 | # FIXME diff --git a/crates/ruff_linter/src/rules/flake8_todos/snapshots/ruff_linter__rules__flake8_todos__tests__missing-todo-link_TD003.py.snap b/crates/ruff_linter/src/rules/flake8_todos/snapshots/ruff_linter__rules__flake8_todos__tests__missing-todo-link_TD003.py.snap index 18dc66efcf..fbe1e5ba9e 100644 --- a/crates/ruff_linter/src/rules/flake8_todos/snapshots/ruff_linter__rules__flake8_todos__tests__missing-todo-link_TD003.py.snap +++ b/crates/ruff_linter/src/rules/flake8_todos/snapshots/ruff_linter__rules__flake8_todos__tests__missing-todo-link_TD003.py.snap @@ -1,16 +1,18 @@ --- source: crates/ruff_linter/src/rules/flake8_todos/mod.rs --- -error[TD003]: TD003.py:9:3: Missing issue link on the line following this TODO +error[TD003]: 9:3: Missing issue link on the line following this TODO + --> TD003.py:9:3 | 8 | # TDO003 - errors 9 | # TODO: this comment has no | ^^^^ 10 | # link after it | -error[TD003]: TD003.py:12:3: Missing issue link on the line following this TODO +error[TD003]: 12:3: Missing issue link on the line following this TODO + --> TD003.py:12:3 | 10 | # link after it 11 | @@ -19,8 +21,9 @@ error[TD003]: TD003.py:12:3: Missing issue link on the line following this TODO 13 | def foo(x): 14 | return x | -error[TD003]: TD003.py:25:3: Missing issue link on the line following this TODO +error[TD003]: 25:3: Missing issue link on the line following this TODO + --> TD003.py:25:3 | 23 | # TDO-3870 24 | @@ -29,8 +32,9 @@ error[TD003]: TD003.py:25:3: Missing issue link on the line following this TODO 26 | # TODO: followed by a new TODO with an issue link 27 | # TDO-3870 | -error[TD003]: TD003.py:29:9: Missing issue link on the line following this TODO +error[TD003]: 29:9: Missing issue link on the line following this TODO + --> TD003.py:29:9 | 27 | # TDO-3870 28 | @@ -39,8 +43,9 @@ error[TD003]: TD003.py:29:9: Missing issue link on the line following this TODO 30 | 31 | # TODO: here's a TODO on the last line with no link | -error[TD003]: TD003.py:31:3: Missing issue link on the line following this TODO +error[TD003]: 31:3: Missing issue link on the line following this TODO + --> TD003.py:31:3 | 29 | # foo # TODO: no link! 30 | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__empty-type-checking-block_TCH005.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__empty-type-checking-block_TCH005.py.snap index 2fbff3295a..57bd8719a6 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__empty-type-checking-block_TCH005.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__empty-type-checking-block_TCH005.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -error[TCH005]: TCH005.py:4:5: [*] Found empty type-checking block +error[TCH005]: 4:5: [*] Found empty type-checking block + --> TCH005.py:4:5 | 3 | if TYPE_CHECKING: 4 | pass # TCH005 @@ -18,8 +19,9 @@ error[TCH005]: TCH005.py:4:5: [*] Found empty type-checking block 6 4 | 7 5 | if False: -error[TCH005]: TCH005.py:8:5: [*] Found empty type-checking block +error[TCH005]: 8:5: [*] Found empty type-checking block + --> TCH005.py:8:5 | 7 | if False: 8 | pass # TCH005 @@ -38,8 +40,9 @@ error[TCH005]: TCH005.py:8:5: [*] Found empty type-checking block 10 8 | if 0: 11 9 | pass # TCH005 -error[TCH005]: TCH005.py:11:5: [*] Found empty type-checking block +error[TCH005]: 11:5: [*] Found empty type-checking block + --> TCH005.py:11:5 | 10 | if 0: 11 | pass # TCH005 @@ -56,8 +59,9 @@ error[TCH005]: TCH005.py:11:5: [*] Found empty type-checking block 13 11 | 14 12 | def example(): -error[TCH005]: TCH005.py:16:9: [*] Found empty type-checking block +error[TCH005]: 16:9: [*] Found empty type-checking block + --> TCH005.py:16:9 | 14 | def example(): 15 | if TYPE_CHECKING: @@ -76,8 +80,9 @@ error[TCH005]: TCH005.py:16:9: [*] Found empty type-checking block 18 16 | 19 17 | -error[TCH005]: TCH005.py:22:9: [*] Found empty type-checking block +error[TCH005]: 22:9: [*] Found empty type-checking block + --> TCH005.py:22:9 | 20 | class Test: 21 | if TYPE_CHECKING: @@ -96,8 +101,9 @@ error[TCH005]: TCH005.py:22:9: [*] Found empty type-checking block 24 22 | 25 23 | -error[TCH005]: TCH005.py:45:5: [*] Found empty type-checking block +error[TCH005]: 45:5: [*] Found empty type-checking block + --> TCH005.py:45:5 | 44 | if TYPE_CHECKING: 45 | pass # TCH005 diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__exempt_modules.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__exempt_modules.snap index 6e49a4db2c..2997c350e7 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__exempt_modules.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__exempt_modules.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -error[TCH002]: exempt_modules.py:14:12: [*] Move third-party import `flask` into a type-checking block +error[TCH002]: 14:12: [*] Move third-party import `flask` into a type-checking block + --> exempt_modules.py:14:12 | 13 | def f(): 14 | import flask diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__import_from.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__import_from.snap index 1fd2cba516..828ca1fe60 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__import_from.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__import_from.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -error[TCH002]: :5:5: [*] Move third-party import `pandas.DataFrame` into a type-checking block +error[TCH002]: 5:5: [*] Move third-party import `pandas.DataFrame` into a type-checking block + --> :5:5 | 4 | from pandas import ( 5 | DataFrame, # DataFrame diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__import_from_type_checking_block.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__import_from_type_checking_block.snap index e70fb816bf..c819230e68 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__import_from_type_checking_block.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__import_from_type_checking_block.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -error[TCH002]: :7:5: [*] Move third-party import `pandas.DataFrame` into a type-checking block +error[TCH002]: 7:5: [*] Move third-party import `pandas.DataFrame` into a type-checking block + --> :7:5 | 6 | from pandas import ( 7 | DataFrame, # DataFrame diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__multiple_members.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__multiple_members.snap index 4014f8ba87..3b67bf3839 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__multiple_members.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__multiple_members.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -error[TCH002]: :7:5: [*] Move third-party import `pandas.DataFrame` into a type-checking block +error[TCH002]: 7:5: [*] Move third-party import `pandas.DataFrame` into a type-checking block + --> :7:5 | 6 | from pandas import ( 7 | DataFrame, # DataFrame @@ -29,8 +30,9 @@ error[TCH002]: :7:5: [*] Move third-party import `pandas.DataFrame` in 11 13 | def f(x: DataFrame, y: Series): 12 14 | pass -error[TCH002]: :8:5: [*] Move third-party import `pandas.Series` into a type-checking block +error[TCH002]: 8:5: [*] Move third-party import `pandas.Series` into a type-checking block + --> :8:5 | 6 | from pandas import ( 7 | DataFrame, # DataFrame diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__multiple_modules_different_types.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__multiple_modules_different_types.snap index 2986e7b8f7..cdc5f57557 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__multiple_modules_different_types.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__multiple_modules_different_types.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -error[TCH003]: :6:8: [*] Move standard library import `os` into a type-checking block +error[TCH003]: 6:8: [*] Move standard library import `os` into a type-checking block + --> :6:8 | 4 | from typing import TYPE_CHECKING 5 | @@ -25,8 +26,9 @@ error[TCH003]: :6:8: [*] Move standard library import `os` into a type 8 11 | def f(x: os, y: pandas): 9 12 | pass -error[TCH002]: :6:12: [*] Move third-party import `pandas` into a type-checking block +error[TCH002]: 6:12: [*] Move third-party import `pandas` into a type-checking block + --> :6:12 | 4 | from typing import TYPE_CHECKING 5 | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__multiple_modules_same_type.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__multiple_modules_same_type.snap index 13deb18a26..db87f480d6 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__multiple_modules_same_type.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__multiple_modules_same_type.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -error[TCH003]: :6:8: [*] Move standard library import `os` into a type-checking block +error[TCH003]: 6:8: [*] Move standard library import `os` into a type-checking block + --> :6:8 | 4 | from typing import TYPE_CHECKING 5 | @@ -24,8 +25,9 @@ error[TCH003]: :6:8: [*] Move standard library import `os` into a type 8 10 | def f(x: os, y: sys): 9 11 | pass -error[TCH003]: :6:12: [*] Move standard library import `sys` into a type-checking block +error[TCH003]: 6:12: [*] Move standard library import `sys` into a type-checking block + --> :6:12 | 4 | from typing import TYPE_CHECKING 5 | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__no_typing_import.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__no_typing_import.snap index 58c976c20e..4acf6f3113 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__no_typing_import.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__no_typing_import.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -error[TCH002]: :4:18: [*] Move third-party import `pandas` into a type-checking block +error[TCH002]: 4:18: [*] Move third-party import `pandas` into a type-checking block + --> :4:18 | 2 | from __future__ import annotations 3 | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__quote_runtime-import-in-type-checking-block_quote.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__quote_runtime-import-in-type-checking-block_quote.py.snap index 3201b12eb9..2e689d5940 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__quote_runtime-import-in-type-checking-block_quote.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__quote_runtime-import-in-type-checking-block_quote.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -error[TCH004]: quote.py:64:28: [*] Quote references to `pandas.DataFrame`. Import is in a type-checking block. +error[TCH004]: 64:28: [*] Quote references to `pandas.DataFrame`. Import is in a type-checking block. + --> quote.py:64:28 | 63 | if TYPE_CHECKING: 64 | from pandas import DataFrame diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__quote_typing-only-third-party-import_quote.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__quote_typing-only-third-party-import_quote.py.snap index 755f5e225d..66a3239d5c 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__quote_typing-only-third-party-import_quote.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__quote_typing-only-third-party-import_quote.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -error[TCH002]: quote.py:2:24: [*] Move third-party import `pandas.DataFrame` into a type-checking block +error[TCH002]: 2:24: [*] Move third-party import `pandas.DataFrame` into a type-checking block + --> quote.py:2:24 | 1 | def f(): 2 | from pandas import DataFrame @@ -25,8 +26,9 @@ error[TCH002]: quote.py:2:24: [*] Move third-party import `pandas.DataFrame` int 6 9 | 7 10 | -error[TCH002]: quote.py:9:24: [*] Move third-party import `pandas.DataFrame` into a type-checking block +error[TCH002]: 9:24: [*] Move third-party import `pandas.DataFrame` into a type-checking block + --> quote.py:9:24 | 8 | def f(): 9 | from pandas import DataFrame @@ -55,8 +57,9 @@ error[TCH002]: quote.py:9:24: [*] Move third-party import `pandas.DataFrame` int 13 16 | 14 17 | -error[TCH002]: quote.py:16:24: Move third-party import `pandas.DataFrame` into a type-checking block +error[TCH002]: 16:24: Move third-party import `pandas.DataFrame` into a type-checking block + --> quote.py:16:24 | 15 | def f(): 16 | from pandas import DataFrame @@ -65,8 +68,9 @@ error[TCH002]: quote.py:16:24: Move third-party import `pandas.DataFrame` into a 18 | def baz() -> DataFrame["int"]: | = help: Move into type-checking block -error[TCH002]: quote.py:23:22: [*] Move third-party import `pandas` into a type-checking block +error[TCH002]: 23:22: [*] Move third-party import `pandas` into a type-checking block + --> quote.py:23:22 | 22 | def f(): 23 | import pandas as pd @@ -95,8 +99,9 @@ error[TCH002]: quote.py:23:22: [*] Move third-party import `pandas` into a type- 27 30 | 28 31 | -error[TCH002]: quote.py:30:22: [*] Move third-party import `pandas` into a type-checking block +error[TCH002]: 30:22: [*] Move third-party import `pandas` into a type-checking block + --> quote.py:30:22 | 29 | def f(): 30 | import pandas as pd @@ -125,8 +130,9 @@ error[TCH002]: quote.py:30:22: [*] Move third-party import `pandas` into a type- 34 37 | 35 38 | -error[TCH002]: quote.py:37:22: [*] Move third-party import `pandas` into a type-checking block +error[TCH002]: 37:22: [*] Move third-party import `pandas` into a type-checking block + --> quote.py:37:22 | 36 | def f(): 37 | import pandas as pd @@ -155,8 +161,9 @@ error[TCH002]: quote.py:37:22: [*] Move third-party import `pandas` into a type- 41 44 | 42 45 | -error[TCH002]: quote.py:45:24: [*] Move third-party import `pandas.DataFrame` into a type-checking block +error[TCH002]: 45:24: [*] Move third-party import `pandas.DataFrame` into a type-checking block + --> quote.py:45:24 | 44 | def f(): 45 | from pandas import DataFrame @@ -185,8 +192,9 @@ error[TCH002]: quote.py:45:24: [*] Move third-party import `pandas.DataFrame` in 49 52 | 50 53 | -error[TCH002]: quote.py:54:24: Move third-party import `pandas.DataFrame` into a type-checking block +error[TCH002]: 54:24: Move third-party import `pandas.DataFrame` into a type-checking block + --> quote.py:54:24 | 52 | from typing import Literal 53 | @@ -196,8 +204,9 @@ error[TCH002]: quote.py:54:24: Move third-party import `pandas.DataFrame` into a 56 | def baz() -> DataFrame[Literal["int"]]: | = help: Move into type-checking block -error[TCH002]: quote.py:71:24: [*] Move third-party import `pandas.DataFrame` into a type-checking block +error[TCH002]: 71:24: [*] Move third-party import `pandas.DataFrame` into a type-checking block + --> quote.py:71:24 | 70 | def f(): 71 | from pandas import DataFrame, Series @@ -226,8 +235,9 @@ error[TCH002]: quote.py:71:24: [*] Move third-party import `pandas.DataFrame` in 75 78 | 76 79 | -error[TCH002]: quote.py:71:35: [*] Move third-party import `pandas.Series` into a type-checking block +error[TCH002]: 71:35: [*] Move third-party import `pandas.Series` into a type-checking block + --> quote.py:71:35 | 70 | def f(): 71 | from pandas import DataFrame, Series @@ -256,8 +266,9 @@ error[TCH002]: quote.py:71:35: [*] Move third-party import `pandas.Series` into 75 78 | 76 79 | -error[TCH002]: quote.py:78:24: [*] Move third-party import `pandas.DataFrame` into a type-checking block +error[TCH002]: 78:24: [*] Move third-party import `pandas.DataFrame` into a type-checking block + --> quote.py:78:24 | 77 | def f(): 78 | from pandas import DataFrame, Series @@ -299,8 +310,9 @@ error[TCH002]: quote.py:78:24: [*] Move third-party import `pandas.DataFrame` in 93 93 | 94 94 | -error[TCH002]: quote.py:78:35: [*] Move third-party import `pandas.Series` into a type-checking block +error[TCH002]: 78:35: [*] Move third-party import `pandas.Series` into a type-checking block + --> quote.py:78:35 | 77 | def f(): 78 | from pandas import DataFrame, Series @@ -342,8 +354,9 @@ error[TCH002]: quote.py:78:35: [*] Move third-party import `pandas.Series` into 93 93 | 94 94 | -error[TCH002]: quote.py:96:24: [*] Move third-party import `pandas.DataFrame` into a type-checking block +error[TCH002]: 96:24: [*] Move third-party import `pandas.DataFrame` into a type-checking block + --> quote.py:96:24 | 95 | def f(): 96 | from pandas import DataFrame, Series @@ -370,8 +383,9 @@ error[TCH002]: quote.py:96:24: [*] Move third-party import `pandas.DataFrame` in 101 |+ def func(self) -> "DataFrame | list[Series]": 99 102 | pass -error[TCH002]: quote.py:96:35: [*] Move third-party import `pandas.Series` into a type-checking block +error[TCH002]: 96:35: [*] Move third-party import `pandas.Series` into a type-checking block + --> quote.py:96:35 | 95 | def f(): 96 | from pandas import DataFrame, Series diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_1.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_1.py.snap index 18ea2823a1..7c13ed5bbb 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_1.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_1.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -error[TCH004]: TCH004_1.py:4:26: [*] Move import `datetime.datetime` out of type-checking block. Import is used for more than type hinting. +error[TCH004]: 4:26: [*] Move import `datetime.datetime` out of type-checking block. Import is used for more than type hinting. + --> TCH004_1.py:4:26 | 3 | if TYPE_CHECKING: 4 | from datetime import datetime diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_11.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_11.py.snap index 713fc0d542..9a9bb8ed4a 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_11.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_11.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -error[TCH004]: TCH004_11.py:4:24: [*] Move import `typing.List` out of type-checking block. Import is used for more than type hinting. +error[TCH004]: 4:24: [*] Move import `typing.List` out of type-checking block. Import is used for more than type hinting. + --> TCH004_11.py:4:24 | 3 | if TYPE_CHECKING: 4 | from typing import List diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_12.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_12.py.snap index f59092dc77..421649a3f1 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_12.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_12.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -error[TCH004]: TCH004_12.py:6:33: [*] Move import `collections.abc.Callable` out of type-checking block. Import is used for more than type hinting. +error[TCH004]: 6:33: [*] Move import `collections.abc.Callable` out of type-checking block. Import is used for more than type hinting. + --> TCH004_12.py:6:33 | 5 | if TYPE_CHECKING: 6 | from collections.abc import Callable diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_17.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_17.py.snap index 4f587eb732..e5122c2661 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_17.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_17.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -error[TCH004]: TCH004_17.py:6:24: [*] Move import `pandas.DataFrame` out of type-checking block. Import is used for more than type hinting. +error[TCH004]: 6:24: [*] Move import `pandas.DataFrame` out of type-checking block. Import is used for more than type hinting. + --> TCH004_17.py:6:24 | 5 | if TYPE_CHECKING: 6 | from pandas import DataFrame diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_2.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_2.py.snap index 9c71e9ca3c..47dad865f4 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_2.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_2.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -error[TCH004]: TCH004_2.py:4:26: [*] Move import `datetime.date` out of type-checking block. Import is used for more than type hinting. +error[TCH004]: 4:26: [*] Move import `datetime.date` out of type-checking block. Import is used for more than type hinting. + --> TCH004_2.py:4:26 | 3 | if TYPE_CHECKING: 4 | from datetime import date diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_4.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_4.py.snap index c1e1c0f7e2..0e5c8547b0 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_4.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_4.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -error[TCH004]: TCH004_4.py:4:24: [*] Move import `typing.Any` out of type-checking block. Import is used for more than type hinting. +error[TCH004]: 4:24: [*] Move import `typing.Any` out of type-checking block. Import is used for more than type hinting. + --> TCH004_4.py:4:24 | 3 | if TYPE_CHECKING: 4 | from typing import Any diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_5.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_5.py.snap index 649178fd36..09de76aa8c 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_5.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_5.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -error[TCH004]: TCH004_5.py:4:24: [*] Move import `typing.List` out of type-checking block. Import is used for more than type hinting. +error[TCH004]: 4:24: [*] Move import `typing.List` out of type-checking block. Import is used for more than type hinting. + --> TCH004_5.py:4:24 | 3 | if TYPE_CHECKING: 4 | from typing import List, Sequence, Set @@ -20,8 +21,9 @@ error[TCH004]: TCH004_5.py:4:24: [*] Move import `typing.List` out of type-check 6 7 | 7 8 | def example(a: List[int], /, b: Sequence[int], *, c: Set[int]): -error[TCH004]: TCH004_5.py:4:30: [*] Move import `typing.Sequence` out of type-checking block. Import is used for more than type hinting. +error[TCH004]: 4:30: [*] Move import `typing.Sequence` out of type-checking block. Import is used for more than type hinting. + --> TCH004_5.py:4:30 | 3 | if TYPE_CHECKING: 4 | from typing import List, Sequence, Set @@ -39,8 +41,9 @@ error[TCH004]: TCH004_5.py:4:30: [*] Move import `typing.Sequence` out of type-c 6 7 | 7 8 | def example(a: List[int], /, b: Sequence[int], *, c: Set[int]): -error[TCH004]: TCH004_5.py:4:40: [*] Move import `typing.Set` out of type-checking block. Import is used for more than type hinting. +error[TCH004]: 4:40: [*] Move import `typing.Set` out of type-checking block. Import is used for more than type hinting. + --> TCH004_5.py:4:40 | 3 | if TYPE_CHECKING: 4 | from typing import List, Sequence, Set diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_9.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_9.py.snap index 574c7add05..aaa4feed5e 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_9.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_9.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -error[TCH004]: TCH004_9.py:4:24: [*] Move import `typing.Tuple` out of type-checking block. Import is used for more than type hinting. +error[TCH004]: 4:24: [*] Move import `typing.Tuple` out of type-checking block. Import is used for more than type hinting. + --> TCH004_9.py:4:24 | 3 | if TYPE_CHECKING: 4 | from typing import Tuple, List, Dict @@ -22,8 +23,9 @@ error[TCH004]: TCH004_9.py:4:24: [*] Move import `typing.Tuple` out of type-chec 6 7 | x: Tuple 7 8 | -error[TCH004]: TCH004_9.py:4:31: [*] Move import `typing.List` out of type-checking block. Import is used for more than type hinting. +error[TCH004]: 4:31: [*] Move import `typing.List` out of type-checking block. Import is used for more than type hinting. + --> TCH004_9.py:4:31 | 3 | if TYPE_CHECKING: 4 | from typing import Tuple, List, Dict diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_quote.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_quote.py.snap index 94374319b6..8a6326112c 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_quote.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_quote.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -error[TCH004]: quote.py:64:28: [*] Move import `pandas.DataFrame` out of type-checking block. Import is used for more than type hinting. +error[TCH004]: 64:28: [*] Move import `pandas.DataFrame` out of type-checking block. Import is used for more than type hinting. + --> quote.py:64:28 | 63 | if TYPE_CHECKING: 64 | from pandas import DataFrame diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_runtime_evaluated_base_classes_1.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_runtime_evaluated_base_classes_1.py.snap index 70b5aea0df..f963e3e540 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_runtime_evaluated_base_classes_1.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_runtime_evaluated_base_classes_1.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -error[TCH004]: runtime_evaluated_base_classes_1.py:10:12: [*] Move import `datetime` out of type-checking block. Import is used for more than type hinting. +error[TCH004]: 10:12: [*] Move import `datetime` out of type-checking block. Import is used for more than type hinting. + --> runtime_evaluated_base_classes_1.py:10:12 | 9 | if TYPE_CHECKING: 10 | import datetime # TCH004 @@ -22,8 +23,9 @@ error[TCH004]: runtime_evaluated_base_classes_1.py:10:12: [*] Move import `datet 12 12 | 13 13 | import pandas # TCH004 -error[TCH004]: runtime_evaluated_base_classes_1.py:11:23: [*] Move import `array.array` out of type-checking block. Import is used for more than type hinting. +error[TCH004]: 11:23: [*] Move import `array.array` out of type-checking block. Import is used for more than type hinting. + --> runtime_evaluated_base_classes_1.py:11:23 | 9 | if TYPE_CHECKING: 10 | import datetime # TCH004 @@ -46,8 +48,9 @@ error[TCH004]: runtime_evaluated_base_classes_1.py:11:23: [*] Move import `array 13 13 | import pandas # TCH004 14 14 | import pyproj -error[TCH004]: runtime_evaluated_base_classes_1.py:13:12: [*] Move import `pandas` out of type-checking block. Import is used for more than type hinting. +error[TCH004]: 13:12: [*] Move import `pandas` out of type-checking block. Import is used for more than type hinting. + --> runtime_evaluated_base_classes_1.py:13:12 | 11 | from array import array # TCH004 12 | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_runtime_evaluated_decorators_1.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_runtime_evaluated_decorators_1.py.snap index e07333e81a..2763801f54 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_runtime_evaluated_decorators_1.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_runtime_evaluated_decorators_1.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -error[TCH004]: runtime_evaluated_decorators_1.py:12:12: [*] Move import `datetime` out of type-checking block. Import is used for more than type hinting. +error[TCH004]: 12:12: [*] Move import `datetime` out of type-checking block. Import is used for more than type hinting. + --> runtime_evaluated_decorators_1.py:12:12 | 11 | if TYPE_CHECKING: 12 | import datetime # TCH004 @@ -22,8 +23,9 @@ error[TCH004]: runtime_evaluated_decorators_1.py:12:12: [*] Move import `datetim 14 14 | 15 15 | import pandas # TCH004 -error[TCH004]: runtime_evaluated_decorators_1.py:13:23: [*] Move import `array.array` out of type-checking block. Import is used for more than type hinting. +error[TCH004]: 13:23: [*] Move import `array.array` out of type-checking block. Import is used for more than type hinting. + --> runtime_evaluated_decorators_1.py:13:23 | 11 | if TYPE_CHECKING: 12 | import datetime # TCH004 @@ -46,8 +48,9 @@ error[TCH004]: runtime_evaluated_decorators_1.py:13:23: [*] Move import `array.a 15 15 | import pandas # TCH004 16 16 | import pyproj -error[TCH004]: runtime_evaluated_decorators_1.py:15:12: [*] Move import `pandas` out of type-checking block. Import is used for more than type hinting. +error[TCH004]: 15:12: [*] Move import `pandas` out of type-checking block. Import is used for more than type hinting. + --> runtime_evaluated_decorators_1.py:15:12 | 13 | from array import array # TCH004 14 | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-string-union_TCH010_1.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-string-union_TCH010_1.py.snap index 22956fc6e3..cb203f1a88 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-string-union_TCH010_1.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-string-union_TCH010_1.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -error[TCH010]: TCH010_1.py:18:30: Invalid string member in `X | Y`-style union type +error[TCH010]: 18:30: Invalid string member in `X | Y`-style union type + --> TCH010_1.py:18:30 | 16 | type A = Value["int" | str] # OK 17 | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-string-union_TCH010_2.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-string-union_TCH010_2.py.snap index fd5aedeb9c..2cb2baed0e 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-string-union_TCH010_2.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-string-union_TCH010_2.py.snap @@ -1,37 +1,42 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -error[TCH010]: TCH010_2.py:4:4: Invalid string member in `X | Y`-style union type +error[TCH010]: 4:4: Invalid string member in `X | Y`-style union type + --> TCH010_2.py:4:4 | 4 | x: "int" | str # TCH010 | ^^^^^ 5 | x: ("int" | str) | "bool" # TCH010 | -error[TCH010]: TCH010_2.py:5:5: Invalid string member in `X | Y`-style union type +error[TCH010]: 5:5: Invalid string member in `X | Y`-style union type + --> TCH010_2.py:5:5 | 4 | x: "int" | str # TCH010 5 | x: ("int" | str) | "bool" # TCH010 | ^^^^^ | -error[TCH010]: TCH010_2.py:5:20: Invalid string member in `X | Y`-style union type +error[TCH010]: 5:20: Invalid string member in `X | Y`-style union type + --> TCH010_2.py:5:20 | 4 | x: "int" | str # TCH010 5 | x: ("int" | str) | "bool" # TCH010 | ^^^^^^ | -error[TCH010]: TCH010_2.py:12:20: Invalid string member in `X | Y`-style union type +error[TCH010]: 12:20: Invalid string member in `X | Y`-style union type + --> TCH010_2.py:12:20 | 12 | z: list[str, str | "int"] = [] # TCH010 | ^^^^^ 13 | 14 | type A = Value["int" | str] # OK | -error[TCH010]: TCH010_2.py:16:30: Invalid string member in `X | Y`-style union type +error[TCH010]: 16:30: Invalid string member in `X | Y`-style union type + --> TCH010_2.py:16:30 | 14 | type A = Value["int" | str] # OK 15 | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__strict_typing-only-standard-library-import_init_var.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__strict_typing-only-standard-library-import_init_var.py.snap index e290ab9cfb..cf999fb14b 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__strict_typing-only-standard-library-import_init_var.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__strict_typing-only-standard-library-import_init_var.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -error[TCH003]: init_var.py:5:25: [*] Move standard library import `dataclasses.FrozenInstanceError` into a type-checking block +error[TCH003]: 5:25: [*] Move standard library import `dataclasses.FrozenInstanceError` into a type-checking block + --> init_var.py:5:25 | 3 | from __future__ import annotations 4 | @@ -26,8 +27,9 @@ error[TCH003]: init_var.py:5:25: [*] Move standard library import `dataclasses.F 8 12 | 9 13 | @dataclass -error[TCH003]: init_var.py:6:21: [*] Move standard library import `pathlib.Path` into a type-checking block +error[TCH003]: 6:21: [*] Move standard library import `pathlib.Path` into a type-checking block + --> init_var.py:6:21 | 5 | from dataclasses import FrozenInstanceError, InitVar, dataclass 6 | from pathlib import Path diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__strict_typing-only-standard-library-import_kw_only.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__strict_typing-only-standard-library-import_kw_only.py.snap index 478af5eba4..48d1afce81 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__strict_typing-only-standard-library-import_kw_only.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__strict_typing-only-standard-library-import_kw_only.py.snap @@ -1,15 +1,16 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -kw_only.py:5:45: TCH003 [*] Move standard library import `dataclasses.Field` into a type-checking block +error[TCH003]: 5:45: [*] Move standard library import `dataclasses.Field` into a type-checking block + + --> kw_only.py:5:45 | 3 | from __future__ import annotations 4 | 5 | from dataclasses import KW_ONLY, dataclass, Field - | ^^^^^ TCH003 + | ^^^^^ | = help: Move into type-checking block - ℹ Unsafe fix 2 2 | 3 3 | from __future__ import annotations diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__strict_typing-only-third-party-import_strict.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__strict_typing-only-third-party-import_strict.py.snap index 5c9de2c37b..86350c5acd 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__strict_typing-only-third-party-import_strict.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__strict_typing-only-third-party-import_strict.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -error[TCH002]: strict.py:27:21: [*] Move third-party import `pkg.A` into a type-checking block +error[TCH002]: 27:21: [*] Move third-party import `pkg.A` into a type-checking block + --> strict.py:27:21 | 25 | # In un-strict mode, this shouldn't raise an error, since `pkg` is used at runtime. 26 | import pkg @@ -30,8 +31,9 @@ error[TCH002]: strict.py:27:21: [*] Move third-party import `pkg.A` into a type- 29 32 | def test(value: A): 30 33 | return pkg.B() -error[TCH002]: strict.py:35:21: [*] Move third-party import `pkg.A` into a type-checking block +error[TCH002]: 35:21: [*] Move third-party import `pkg.A` into a type-checking block + --> strict.py:35:21 | 33 | def f(): 34 | # In un-strict mode, this shouldn't raise an error, since `pkg` is used at runtime. @@ -60,8 +62,9 @@ error[TCH002]: strict.py:35:21: [*] Move third-party import `pkg.A` into a type- 37 41 | def test(value: A): 38 42 | return B() -error[TCH002]: strict.py:54:25: [*] Move third-party import `pkg.bar.A` into a type-checking block +error[TCH002]: 54:25: [*] Move third-party import `pkg.bar.A` into a type-checking block + --> strict.py:54:25 | 52 | # In un-strict mode, this _should_ raise an error, since `pkg.bar` isn't used at runtime 53 | import pkg @@ -89,8 +92,9 @@ error[TCH002]: strict.py:54:25: [*] Move third-party import `pkg.bar.A` into a t 56 59 | def test(value: A): 57 60 | return pkg.B() -error[TCH002]: strict.py:62:12: [*] Move third-party import `pkg` into a type-checking block +error[TCH002]: 62:12: [*] Move third-party import `pkg` into a type-checking block + --> strict.py:62:12 | 60 | def f(): 61 | # In un-strict mode, this shouldn't raise an error, since `pkg.bar` is used at runtime. @@ -117,8 +121,9 @@ error[TCH002]: strict.py:62:12: [*] Move third-party import `pkg` into a type-ch 64 67 | 65 68 | def test(value: pkg.A): -error[TCH002]: strict.py:71:23: [*] Move third-party import `pkg.foo` into a type-checking block +error[TCH002]: 71:23: [*] Move third-party import `pkg.foo` into a type-checking block + --> strict.py:71:23 | 69 | def f(): 70 | # In un-strict mode, this shouldn't raise an error, since `pkg.foo.bar` is used at runtime. @@ -145,8 +150,9 @@ error[TCH002]: strict.py:71:23: [*] Move third-party import `pkg.foo` into a typ 73 76 | 74 77 | def test(value: F.Foo): -error[TCH002]: strict.py:80:12: [*] Move third-party import `pkg` into a type-checking block +error[TCH002]: 80:12: [*] Move third-party import `pkg` into a type-checking block + --> strict.py:80:12 | 78 | def f(): 79 | # In un-strict mode, this shouldn't raise an error, since `pkg.foo.bar` is used at runtime. @@ -173,8 +179,9 @@ error[TCH002]: strict.py:80:12: [*] Move third-party import `pkg` into a type-ch 82 85 | 83 86 | def test(value: pkg.A): -error[TCH002]: strict.py:91:12: [*] Move third-party import `pkg` into a type-checking block +error[TCH002]: 91:12: [*] Move third-party import `pkg` into a type-checking block + --> strict.py:91:12 | 89 | # Note that `pkg` is a prefix of `pkgfoo` which are both different modules. This is 90 | # testing the implementation. @@ -201,8 +208,9 @@ error[TCH002]: strict.py:91:12: [*] Move third-party import `pkg` into a type-ch 93 96 | 94 97 | def test(value: pkg.A): -error[TCH002]: strict.py:101:23: [*] Move third-party import `pkg.foo` into a type-checking block +error[TCH002]: 101:23: [*] Move third-party import `pkg.foo` into a type-checking block + --> strict.py:101:23 | 99 | # In un-strict mode, this shouldn't raise an error, since `pkg` is used at runtime. 100 | import pkg.bar as B diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_after_usage.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_after_usage.snap index 21958c60b6..20b8eed19a 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_after_usage.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_after_usage.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -error[TCH002]: :6:18: [*] Move third-party import `pandas` into a type-checking block +error[TCH002]: 6:18: [*] Move third-party import `pandas` into a type-checking block + --> :6:18 | 4 | from typing import TYPE_CHECKING 5 | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_comment.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_comment.snap index 96eff0d39f..52478eb1b4 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_comment.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_comment.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -error[TCH002]: :6:18: [*] Move third-party import `pandas` into a type-checking block +error[TCH002]: 6:18: [*] Move third-party import `pandas` into a type-checking block + --> :6:18 | 4 | from typing import TYPE_CHECKING 5 | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_inline.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_inline.snap index 6386fc00df..23a65baabf 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_inline.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_inline.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -error[TCH002]: :6:18: [*] Move third-party import `pandas` into a type-checking block +error[TCH002]: 6:18: [*] Move third-party import `pandas` into a type-checking block + --> :6:18 | 4 | from typing import TYPE_CHECKING 5 | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_own_line.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_own_line.snap index 18f0236061..12e78509fe 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_own_line.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_own_line.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -error[TCH002]: :6:18: [*] Move third-party import `pandas` into a type-checking block +error[TCH002]: 6:18: [*] Move third-party import `pandas` into a type-checking block + --> :6:18 | 4 | from typing import TYPE_CHECKING 5 | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-first-party-import_TCH001.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-first-party-import_TCH001.py.snap index ad51cb2de2..bbcde9b9cd 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-first-party-import_TCH001.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-first-party-import_TCH001.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -error[TCH001]: TCH001.py:20:19: [*] Move application import `.TYP001` into a type-checking block +error[TCH001]: 20:19: [*] Move application import `.TYP001` into a type-checking block + --> TCH001.py:20:19 | 19 | def f(): 20 | from . import TYP001 diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_TCH003.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_TCH003.py.snap index ea73b4df1e..3ad1207049 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_TCH003.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_TCH003.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -error[TCH003]: TCH003.py:8:12: [*] Move standard library import `os` into a type-checking block +error[TCH003]: 8:12: [*] Move standard library import `os` into a type-checking block + --> TCH003.py:8:12 | 7 | def f(): 8 | import os diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_exempt_type_checking_1.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_exempt_type_checking_1.py.snap index d39bebd7b0..33f16675b5 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_exempt_type_checking_1.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_exempt_type_checking_1.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -error[TCH003]: exempt_type_checking_1.py:5:20: [*] Move standard library import `typing.Final` into a type-checking block +error[TCH003]: 5:20: [*] Move standard library import `typing.Final` into a type-checking block + --> exempt_type_checking_1.py:5:20 | 3 | from __future__ import annotations 4 | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_exempt_type_checking_2.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_exempt_type_checking_2.py.snap index 16050bfb96..bc1527d9c2 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_exempt_type_checking_2.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_exempt_type_checking_2.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -error[TCH003]: exempt_type_checking_2.py:5:20: [*] Move standard library import `typing.Final` into a type-checking block +error[TCH003]: 5:20: [*] Move standard library import `typing.Final` into a type-checking block + --> exempt_type_checking_2.py:5:20 | 3 | from __future__ import annotations 4 | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_exempt_type_checking_3.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_exempt_type_checking_3.py.snap index c2805ed94c..31430cbe35 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_exempt_type_checking_3.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_exempt_type_checking_3.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -error[TCH003]: exempt_type_checking_3.py:5:20: [*] Move standard library import `typing.Final` into a type-checking block +error[TCH003]: 5:20: [*] Move standard library import `typing.Final` into a type-checking block + --> exempt_type_checking_3.py:5:20 | 3 | from __future__ import annotations 4 | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_init_var.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_init_var.py.snap index 56e61cec69..b49ae82a64 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_init_var.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_init_var.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -error[TCH003]: init_var.py:6:21: [*] Move standard library import `pathlib.Path` into a type-checking block +error[TCH003]: 6:21: [*] Move standard library import `pathlib.Path` into a type-checking block + --> init_var.py:6:21 | 5 | from dataclasses import FrozenInstanceError, InitVar, dataclass 6 | from pathlib import Path diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_module__undefined.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_module__undefined.py.snap index c8fd634458..eff0d89577 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_module__undefined.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_module__undefined.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -error[TCH003]: undefined.py:3:29: [*] Move standard library import `collections.abc.Sequence` into a type-checking block +error[TCH003]: 3:29: [*] Move standard library import `collections.abc.Sequence` into a type-checking block + --> undefined.py:3:29 | 1 | from __future__ import annotations 2 | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_runtime_evaluated_base_classes_3.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_runtime_evaluated_base_classes_3.py.snap index 4b9cb759c0..b96f92238f 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_runtime_evaluated_base_classes_3.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_runtime_evaluated_base_classes_3.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -error[TCH003]: runtime_evaluated_base_classes_3.py:5:18: [*] Move standard library import `uuid.UUID` into a type-checking block +error[TCH003]: 5:18: [*] Move standard library import `uuid.UUID` into a type-checking block + --> runtime_evaluated_base_classes_3.py:5:18 | 3 | import datetime 4 | import pathlib diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_runtime_evaluated_decorators_3.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_runtime_evaluated_decorators_3.py.snap index 7046951c91..c4acef05a4 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_runtime_evaluated_decorators_3.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_runtime_evaluated_decorators_3.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -error[TCH003]: runtime_evaluated_decorators_3.py:6:18: [*] Move standard library import `uuid.UUID` into a type-checking block +error[TCH003]: 6:18: [*] Move standard library import `uuid.UUID` into a type-checking block + --> runtime_evaluated_decorators_3.py:6:18 | 4 | from array import array 5 | from dataclasses import dataclass diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_TCH002.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_TCH002.py.snap index 5d567690a4..ea8f385964 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_TCH002.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_TCH002.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -error[TCH002]: TCH002.py:5:22: [*] Move third-party import `pandas` into a type-checking block +error[TCH002]: 5:22: [*] Move third-party import `pandas` into a type-checking block + --> TCH002.py:5:22 | 4 | def f(): 5 | import pandas as pd # TCH002 @@ -25,8 +26,9 @@ error[TCH002]: TCH002.py:5:22: [*] Move third-party import `pandas` into a type- 7 10 | x: pd.DataFrame 8 11 | -error[TCH002]: TCH002.py:11:24: [*] Move third-party import `pandas.DataFrame` into a type-checking block +error[TCH002]: 11:24: [*] Move third-party import `pandas.DataFrame` into a type-checking block + --> TCH002.py:11:24 | 10 | def f(): 11 | from pandas import DataFrame # TCH002 @@ -53,8 +55,9 @@ error[TCH002]: TCH002.py:11:24: [*] Move third-party import `pandas.DataFrame` i 13 16 | x: DataFrame 14 17 | -error[TCH002]: TCH002.py:17:37: [*] Move third-party import `pandas.DataFrame` into a type-checking block +error[TCH002]: 17:37: [*] Move third-party import `pandas.DataFrame` into a type-checking block + --> TCH002.py:17:37 | 16 | def f(): 17 | from pandas import DataFrame as df # TCH002 @@ -81,8 +84,9 @@ error[TCH002]: TCH002.py:17:37: [*] Move third-party import `pandas.DataFrame` i 19 22 | x: df 20 23 | -error[TCH002]: TCH002.py:23:22: [*] Move third-party import `pandas` into a type-checking block +error[TCH002]: 23:22: [*] Move third-party import `pandas` into a type-checking block + --> TCH002.py:23:22 | 22 | def f(): 23 | import pandas as pd # TCH002 @@ -109,8 +113,9 @@ error[TCH002]: TCH002.py:23:22: [*] Move third-party import `pandas` into a type 25 28 | x: pd.DataFrame = 1 26 29 | -error[TCH002]: TCH002.py:29:24: [*] Move third-party import `pandas.DataFrame` into a type-checking block +error[TCH002]: 29:24: [*] Move third-party import `pandas.DataFrame` into a type-checking block + --> TCH002.py:29:24 | 28 | def f(): 29 | from pandas import DataFrame # TCH002 @@ -137,8 +142,9 @@ error[TCH002]: TCH002.py:29:24: [*] Move third-party import `pandas.DataFrame` i 31 34 | x: DataFrame = 2 32 35 | -error[TCH002]: TCH002.py:35:37: [*] Move third-party import `pandas.DataFrame` into a type-checking block +error[TCH002]: 35:37: [*] Move third-party import `pandas.DataFrame` into a type-checking block + --> TCH002.py:35:37 | 34 | def f(): 35 | from pandas import DataFrame as df # TCH002 @@ -165,8 +171,9 @@ error[TCH002]: TCH002.py:35:37: [*] Move third-party import `pandas.DataFrame` i 37 40 | x: df = 3 38 41 | -error[TCH002]: TCH002.py:41:22: [*] Move third-party import `pandas` into a type-checking block +error[TCH002]: 41:22: [*] Move third-party import `pandas` into a type-checking block + --> TCH002.py:41:22 | 40 | def f(): 41 | import pandas as pd # TCH002 @@ -193,8 +200,9 @@ error[TCH002]: TCH002.py:41:22: [*] Move third-party import `pandas` into a type 43 46 | x: "pd.DataFrame" = 1 44 47 | -error[TCH002]: TCH002.py:47:22: [*] Move third-party import `pandas` into a type-checking block +error[TCH002]: 47:22: [*] Move third-party import `pandas` into a type-checking block + --> TCH002.py:47:22 | 46 | def f(): 47 | import pandas as pd # TCH002 @@ -221,8 +229,9 @@ error[TCH002]: TCH002.py:47:22: [*] Move third-party import `pandas` into a type 49 52 | x = dict["pd.DataFrame", "pd.DataFrame"] 50 53 | -error[TCH002]: TCH002.py:172:24: [*] Move third-party import `module.Member` into a type-checking block +error[TCH002]: 172:24: [*] Move third-party import `module.Member` into a type-checking block + --> TCH002.py:172:24 | 170 | global Member 171 | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_runtime_evaluated_base_classes_2.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_runtime_evaluated_base_classes_2.py.snap index d2d3b6a768..a6a6104f65 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_runtime_evaluated_base_classes_2.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_runtime_evaluated_base_classes_2.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -error[TCH002]: runtime_evaluated_base_classes_2.py:3:21: [*] Move third-party import `geopandas` into a type-checking block +error[TCH002]: 3:21: [*] Move third-party import `geopandas` into a type-checking block + --> runtime_evaluated_base_classes_2.py:3:21 | 1 | from __future__ import annotations 2 | @@ -29,8 +30,9 @@ error[TCH002]: runtime_evaluated_base_classes_2.py:3:21: [*] Move third-party im 10 13 | 11 14 | class A(BaseModel): -error[TCH002]: runtime_evaluated_base_classes_2.py:5:8: [*] Move third-party import `pyproj` into a type-checking block +error[TCH002]: 5:8: [*] Move third-party import `pyproj` into a type-checking block + --> runtime_evaluated_base_classes_2.py:5:8 | 3 | import geopandas as gpd # TCH002 4 | import pydantic diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_runtime_evaluated_decorators_2.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_runtime_evaluated_decorators_2.py.snap index 740ab700c6..54d9f69479 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_runtime_evaluated_decorators_2.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_runtime_evaluated_decorators_2.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -error[TCH002]: runtime_evaluated_decorators_2.py:10:8: [*] Move third-party import `numpy` into a type-checking block +error[TCH002]: 10:8: [*] Move third-party import `numpy` into a type-checking block + --> runtime_evaluated_decorators_2.py:10:8 | 8 | from attrs import frozen 9 | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_singledispatch.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_singledispatch.py.snap index 59d6561f83..e7b52b54ff 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_singledispatch.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_singledispatch.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -error[TCH002]: singledispatch.py:11:20: [*] Move third-party import `pandas.DataFrame` into a type-checking block +error[TCH002]: 11:20: [*] Move third-party import `pandas.DataFrame` into a type-checking block + --> singledispatch.py:11:20 | 9 | from numpy.typing import ArrayLike 10 | from scipy.sparse import spmatrix diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_strict.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_strict.py.snap index c4483df7f9..621db01a2d 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_strict.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_strict.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -error[TCH002]: strict.py:54:25: [*] Move third-party import `pkg.bar.A` into a type-checking block +error[TCH002]: 54:25: [*] Move third-party import `pkg.bar.A` into a type-checking block + --> strict.py:54:25 | 52 | # In un-strict mode, this _should_ raise an error, since `pkg.bar` isn't used at runtime 53 | import pkg @@ -30,8 +31,9 @@ error[TCH002]: strict.py:54:25: [*] Move third-party import `pkg.bar.A` into a t 56 59 | def test(value: A): 57 60 | return pkg.B() -error[TCH002]: strict.py:91:12: [*] Move third-party import `pkg` into a type-checking block +error[TCH002]: 91:12: [*] Move third-party import `pkg` into a type-checking block + --> strict.py:91:12 | 89 | # Note that `pkg` is a prefix of `pkgfoo` which are both different modules. This is 90 | # testing the implementation. diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_typing_modules_1.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_typing_modules_1.py.snap index fb6d3c7233..2a2e7d8a13 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_typing_modules_1.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_typing_modules_1.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -error[TCH002]: typing_modules_1.py:7:24: [*] Move third-party import `pandas.DataFrame` into a type-checking block +error[TCH002]: 7:24: [*] Move third-party import `pandas.DataFrame` into a type-checking block + --> typing_modules_1.py:7:24 | 6 | def func(): 7 | from pandas import DataFrame diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_typing_modules_2.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_typing_modules_2.py.snap index 29b71796da..53abe99859 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_typing_modules_2.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_typing_modules_2.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -error[TCH002]: typing_modules_2.py:7:24: [*] Move third-party import `pandas.DataFrame` into a type-checking block +error[TCH002]: 7:24: [*] Move third-party import `pandas.DataFrame` into a type-checking block + --> typing_modules_2.py:7:24 | 6 | def func(): 7 | from pandas import DataFrame diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing_import_after_package_import.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing_import_after_package_import.snap index b099d085ef..59cf419cf7 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing_import_after_package_import.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing_import_after_package_import.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -error[TCH002]: :4:18: [*] Move third-party import `pandas` into a type-checking block +error[TCH002]: 4:18: [*] Move third-party import `pandas` into a type-checking block + --> :4:18 | 2 | from __future__ import annotations 3 | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing_import_after_usage.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing_import_after_usage.snap index dec48c1f47..296bb6a6dd 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing_import_after_usage.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing_import_after_usage.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -error[TCH002]: :4:18: Move third-party import `pandas` into a type-checking block +error[TCH002]: 4:18: Move third-party import `pandas` into a type-checking block + --> :4:18 | 2 | from __future__ import annotations 3 | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing_import_before_package_import.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing_import_before_package_import.snap index e58e5b13db..cfc5435c9a 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing_import_before_package_import.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing_import_before_package_import.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -error[TCH002]: :6:18: [*] Move third-party import `pandas` into a type-checking block +error[TCH002]: 6:18: [*] Move third-party import `pandas` into a type-checking block + --> :6:18 | 4 | from typing import TYPE_CHECKING 5 | diff --git a/crates/ruff_linter/src/rules/flake8_unused_arguments/snapshots/ruff_linter__rules__flake8_unused_arguments__tests__ARG001_ARG.py.snap b/crates/ruff_linter/src/rules/flake8_unused_arguments/snapshots/ruff_linter__rules__flake8_unused_arguments__tests__ARG001_ARG.py.snap index 0b65aed7a1..ecac277a7a 100644 --- a/crates/ruff_linter/src/rules/flake8_unused_arguments/snapshots/ruff_linter__rules__flake8_unused_arguments__tests__ARG001_ARG.py.snap +++ b/crates/ruff_linter/src/rules/flake8_unused_arguments/snapshots/ruff_linter__rules__flake8_unused_arguments__tests__ARG001_ARG.py.snap @@ -1,34 +1,39 @@ --- source: crates/ruff_linter/src/rules/flake8_unused_arguments/mod.rs --- -ARG.py:9:7: ARG001 Unused function argument: `self` +error[ARG001]: 9:7: Unused function argument: `self` + + --> ARG.py:9:7 | 7 | # Unused arguments on functions. 8 | ### 9 | def f(self, x): - | ^^^^ ARG001 + | ^^^^ 10 | print("Hello, world!") | +error[ARG001]: 9:13: Unused function argument: `x` -ARG.py:9:13: ARG001 Unused function argument: `x` + --> ARG.py:9:13 | 7 | # Unused arguments on functions. 8 | ### 9 | def f(self, x): - | ^ ARG001 + | ^ 10 | print("Hello, world!") | +error[ARG001]: 13:7: Unused function argument: `cls` -ARG.py:13:7: ARG001 Unused function argument: `cls` + --> ARG.py:13:7 | 13 | def f(cls, x): - | ^^^ ARG001 + | ^^^ 14 | print("Hello, world!") | +error[ARG001]: 13:12: Unused function argument: `x` -ARG.py:13:12: ARG001 Unused function argument: `x` + --> ARG.py:13:12 | 13 | def f(cls, x): - | ^ ARG001 + | ^ 14 | print("Hello, world!") | diff --git a/crates/ruff_linter/src/rules/flake8_unused_arguments/snapshots/ruff_linter__rules__flake8_unused_arguments__tests__ARG002_ARG.py.snap b/crates/ruff_linter/src/rules/flake8_unused_arguments/snapshots/ruff_linter__rules__flake8_unused_arguments__tests__ARG002_ARG.py.snap index 5881368feb..90196fe8cf 100644 --- a/crates/ruff_linter/src/rules/flake8_unused_arguments/snapshots/ruff_linter__rules__flake8_unused_arguments__tests__ARG002_ARG.py.snap +++ b/crates/ruff_linter/src/rules/flake8_unused_arguments/snapshots/ruff_linter__rules__flake8_unused_arguments__tests__ARG002_ARG.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_unused_arguments/mod.rs --- -error[ARG002]: ARG.py:37:17: Unused method argument: `x` +error[ARG002]: 37:17: Unused method argument: `x` + --> ARG.py:37:17 | 35 | # Unused arguments. 36 | ### @@ -10,8 +11,9 @@ error[ARG002]: ARG.py:37:17: Unused method argument: `x` | ^ 38 | print("Hello, world!") | -error[ARG002]: ARG.py:40:20: Unused method argument: `x` +error[ARG002]: 40:20: Unused method argument: `x` + --> ARG.py:40:20 | 38 | print("Hello, world!") 39 | @@ -19,8 +21,9 @@ error[ARG002]: ARG.py:40:20: Unused method argument: `x` | ^ 41 | print("Hello, world!") | -error[ARG002]: ARG.py:43:16: Unused method argument: `x` +error[ARG002]: 43:16: Unused method argument: `x` + --> ARG.py:43:16 | 41 | print("Hello, world!") 42 | @@ -28,8 +31,9 @@ error[ARG002]: ARG.py:43:16: Unused method argument: `x` | ^ 44 | print("Hello, world!") | -error[ARG002]: ARG.py:192:24: Unused method argument: `x` +error[ARG002]: 192:24: Unused method argument: `x` + --> ARG.py:192:24 | 190 | ### 191 | class C: diff --git a/crates/ruff_linter/src/rules/flake8_unused_arguments/snapshots/ruff_linter__rules__flake8_unused_arguments__tests__ARG003_ARG.py.snap b/crates/ruff_linter/src/rules/flake8_unused_arguments/snapshots/ruff_linter__rules__flake8_unused_arguments__tests__ARG003_ARG.py.snap index 1cc660d951..921306ca3c 100644 --- a/crates/ruff_linter/src/rules/flake8_unused_arguments/snapshots/ruff_linter__rules__flake8_unused_arguments__tests__ARG003_ARG.py.snap +++ b/crates/ruff_linter/src/rules/flake8_unused_arguments/snapshots/ruff_linter__rules__flake8_unused_arguments__tests__ARG003_ARG.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_unused_arguments/mod.rs --- -error[ARG003]: ARG.py:47:16: Unused class method argument: `x` +error[ARG003]: 47:16: Unused class method argument: `x` + --> ARG.py:47:16 | 46 | @classmethod 47 | def f(cls, x): diff --git a/crates/ruff_linter/src/rules/flake8_unused_arguments/snapshots/ruff_linter__rules__flake8_unused_arguments__tests__ARG004_ARG.py.snap b/crates/ruff_linter/src/rules/flake8_unused_arguments/snapshots/ruff_linter__rules__flake8_unused_arguments__tests__ARG004_ARG.py.snap index 08f266603b..4fd155527d 100644 --- a/crates/ruff_linter/src/rules/flake8_unused_arguments/snapshots/ruff_linter__rules__flake8_unused_arguments__tests__ARG004_ARG.py.snap +++ b/crates/ruff_linter/src/rules/flake8_unused_arguments/snapshots/ruff_linter__rules__flake8_unused_arguments__tests__ARG004_ARG.py.snap @@ -1,24 +1,27 @@ --- source: crates/ruff_linter/src/rules/flake8_unused_arguments/mod.rs --- -error[ARG004]: ARG.py:51:11: Unused static method argument: `cls` +error[ARG004]: 51:11: Unused static method argument: `cls` + --> ARG.py:51:11 | 50 | @staticmethod 51 | def f(cls, x): | ^^^ 52 | print("Hello, world!") | -error[ARG004]: ARG.py:51:16: Unused static method argument: `x` +error[ARG004]: 51:16: Unused static method argument: `x` + --> ARG.py:51:16 | 50 | @staticmethod 51 | def f(cls, x): | ^ 52 | print("Hello, world!") | -error[ARG004]: ARG.py:55:11: Unused static method argument: `x` +error[ARG004]: 55:11: Unused static method argument: `x` + --> ARG.py:55:11 | 54 | @staticmethod 55 | def f(x): diff --git a/crates/ruff_linter/src/rules/flake8_unused_arguments/snapshots/ruff_linter__rules__flake8_unused_arguments__tests__ARG005_ARG.py.snap b/crates/ruff_linter/src/rules/flake8_unused_arguments/snapshots/ruff_linter__rules__flake8_unused_arguments__tests__ARG005_ARG.py.snap index 3791460a7b..fd950c6c17 100644 --- a/crates/ruff_linter/src/rules/flake8_unused_arguments/snapshots/ruff_linter__rules__flake8_unused_arguments__tests__ARG005_ARG.py.snap +++ b/crates/ruff_linter/src/rules/flake8_unused_arguments/snapshots/ruff_linter__rules__flake8_unused_arguments__tests__ARG005_ARG.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_unused_arguments/mod.rs --- -error[ARG005]: ARG.py:28:8: Unused lambda argument: `x` +error[ARG005]: 28:8: Unused lambda argument: `x` + --> ARG.py:28:8 | 26 | # Unused arguments on lambdas. 27 | ### diff --git a/crates/ruff_linter/src/rules/flake8_unused_arguments/snapshots/ruff_linter__rules__flake8_unused_arguments__tests__enforce_variadic_names.snap b/crates/ruff_linter/src/rules/flake8_unused_arguments/snapshots/ruff_linter__rules__flake8_unused_arguments__tests__enforce_variadic_names.snap index 3a55274025..955946ce51 100644 --- a/crates/ruff_linter/src/rules/flake8_unused_arguments/snapshots/ruff_linter__rules__flake8_unused_arguments__tests__enforce_variadic_names.snap +++ b/crates/ruff_linter/src/rules/flake8_unused_arguments/snapshots/ruff_linter__rules__flake8_unused_arguments__tests__enforce_variadic_names.snap @@ -1,66 +1,75 @@ --- source: crates/ruff_linter/src/rules/flake8_unused_arguments/mod.rs --- -error[ARG001]: ignore_variadic_names.py:1:7: Unused function argument: `a` +error[ARG001]: 1:7: Unused function argument: `a` + --> ignore_variadic_names.py:1:7 | 1 | def f(a, b): | ^ 2 | print("Hello, world!") | -error[ARG001]: ignore_variadic_names.py:1:10: Unused function argument: `b` +error[ARG001]: 1:10: Unused function argument: `b` + --> ignore_variadic_names.py:1:10 | 1 | def f(a, b): | ^ 2 | print("Hello, world!") | -error[ARG001]: ignore_variadic_names.py:5:7: Unused function argument: `a` +error[ARG001]: 5:7: Unused function argument: `a` + --> ignore_variadic_names.py:5:7 | 5 | def f(a, b, *args, **kwargs): | ^ 6 | print("Hello, world!") | -error[ARG001]: ignore_variadic_names.py:5:10: Unused function argument: `b` +error[ARG001]: 5:10: Unused function argument: `b` + --> ignore_variadic_names.py:5:10 | 5 | def f(a, b, *args, **kwargs): | ^ 6 | print("Hello, world!") | -error[ARG001]: ignore_variadic_names.py:5:14: Unused function argument: `args` +error[ARG001]: 5:14: Unused function argument: `args` + --> ignore_variadic_names.py:5:14 | 5 | def f(a, b, *args, **kwargs): | ^^^^ 6 | print("Hello, world!") | -error[ARG001]: ignore_variadic_names.py:5:22: Unused function argument: `kwargs` +error[ARG001]: 5:22: Unused function argument: `kwargs` + --> ignore_variadic_names.py:5:22 | 5 | def f(a, b, *args, **kwargs): | ^^^^^^ 6 | print("Hello, world!") | -error[ARG002]: ignore_variadic_names.py:10:17: Unused method argument: `a` +error[ARG002]: 10:17: Unused method argument: `a` + --> ignore_variadic_names.py:10:17 | 9 | class C: 10 | def f(self, a, b): | ^ 11 | print("Hello, world!") | -error[ARG002]: ignore_variadic_names.py:10:20: Unused method argument: `b` +error[ARG002]: 10:20: Unused method argument: `b` + --> ignore_variadic_names.py:10:20 | 9 | class C: 10 | def f(self, a, b): | ^ 11 | print("Hello, world!") | -error[ARG002]: ignore_variadic_names.py:13:17: Unused method argument: `a` +error[ARG002]: 13:17: Unused method argument: `a` + --> ignore_variadic_names.py:13:17 | 11 | print("Hello, world!") 12 | @@ -68,8 +77,9 @@ error[ARG002]: ignore_variadic_names.py:13:17: Unused method argument: `a` | ^ 14 | print("Hello, world!") | -error[ARG002]: ignore_variadic_names.py:13:20: Unused method argument: `b` +error[ARG002]: 13:20: Unused method argument: `b` + --> ignore_variadic_names.py:13:20 | 11 | print("Hello, world!") 12 | @@ -77,8 +87,9 @@ error[ARG002]: ignore_variadic_names.py:13:20: Unused method argument: `b` | ^ 14 | print("Hello, world!") | -error[ARG002]: ignore_variadic_names.py:13:24: Unused method argument: `args` +error[ARG002]: 13:24: Unused method argument: `args` + --> ignore_variadic_names.py:13:24 | 11 | print("Hello, world!") 12 | @@ -86,8 +97,9 @@ error[ARG002]: ignore_variadic_names.py:13:24: Unused method argument: `args` | ^^^^ 14 | print("Hello, world!") | -error[ARG002]: ignore_variadic_names.py:13:32: Unused method argument: `kwargs` +error[ARG002]: 13:32: Unused method argument: `kwargs` + --> ignore_variadic_names.py:13:32 | 11 | print("Hello, world!") 12 | diff --git a/crates/ruff_linter/src/rules/flake8_unused_arguments/snapshots/ruff_linter__rules__flake8_unused_arguments__tests__ignore_variadic_names.snap b/crates/ruff_linter/src/rules/flake8_unused_arguments/snapshots/ruff_linter__rules__flake8_unused_arguments__tests__ignore_variadic_names.snap index 15d1ba6e5f..24afcaa2a3 100644 --- a/crates/ruff_linter/src/rules/flake8_unused_arguments/snapshots/ruff_linter__rules__flake8_unused_arguments__tests__ignore_variadic_names.snap +++ b/crates/ruff_linter/src/rules/flake8_unused_arguments/snapshots/ruff_linter__rules__flake8_unused_arguments__tests__ignore_variadic_names.snap @@ -1,52 +1,59 @@ --- source: crates/ruff_linter/src/rules/flake8_unused_arguments/mod.rs --- -error[ARG001]: ignore_variadic_names.py:1:7: Unused function argument: `a` +error[ARG001]: 1:7: Unused function argument: `a` + --> ignore_variadic_names.py:1:7 | 1 | def f(a, b): | ^ 2 | print("Hello, world!") | -error[ARG001]: ignore_variadic_names.py:1:10: Unused function argument: `b` +error[ARG001]: 1:10: Unused function argument: `b` + --> ignore_variadic_names.py:1:10 | 1 | def f(a, b): | ^ 2 | print("Hello, world!") | -error[ARG001]: ignore_variadic_names.py:5:7: Unused function argument: `a` +error[ARG001]: 5:7: Unused function argument: `a` + --> ignore_variadic_names.py:5:7 | 5 | def f(a, b, *args, **kwargs): | ^ 6 | print("Hello, world!") | -error[ARG001]: ignore_variadic_names.py:5:10: Unused function argument: `b` +error[ARG001]: 5:10: Unused function argument: `b` + --> ignore_variadic_names.py:5:10 | 5 | def f(a, b, *args, **kwargs): | ^ 6 | print("Hello, world!") | -error[ARG002]: ignore_variadic_names.py:10:17: Unused method argument: `a` +error[ARG002]: 10:17: Unused method argument: `a` + --> ignore_variadic_names.py:10:17 | 9 | class C: 10 | def f(self, a, b): | ^ 11 | print("Hello, world!") | -error[ARG002]: ignore_variadic_names.py:10:20: Unused method argument: `b` +error[ARG002]: 10:20: Unused method argument: `b` + --> ignore_variadic_names.py:10:20 | 9 | class C: 10 | def f(self, a, b): | ^ 11 | print("Hello, world!") | -error[ARG002]: ignore_variadic_names.py:13:17: Unused method argument: `a` +error[ARG002]: 13:17: Unused method argument: `a` + --> ignore_variadic_names.py:13:17 | 11 | print("Hello, world!") 12 | @@ -54,8 +61,9 @@ error[ARG002]: ignore_variadic_names.py:13:17: Unused method argument: `a` | ^ 14 | print("Hello, world!") | -error[ARG002]: ignore_variadic_names.py:13:20: Unused method argument: `b` +error[ARG002]: 13:20: Unused method argument: `b` + --> ignore_variadic_names.py:13:20 | 11 | print("Hello, world!") 12 | diff --git a/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__PTH124_py_path_1.py.snap b/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__PTH124_py_path_1.py.snap index 6367349c1c..732a03587e 100644 --- a/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__PTH124_py_path_1.py.snap +++ b/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__PTH124_py_path_1.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_use_pathlib/mod.rs --- -error[PTH124]: py_path_1.py:3:5: `py.path` is in maintenance mode, use `pathlib` instead +error[PTH124]: 3:5: `py.path` is in maintenance mode, use `pathlib` instead + --> py_path_1.py:3:5 | 1 | import py 2 | diff --git a/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__PTH124_py_path_2.py.snap b/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__PTH124_py_path_2.py.snap index 3787b62aff..d2fbe099ad 100644 --- a/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__PTH124_py_path_2.py.snap +++ b/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__PTH124_py_path_2.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_use_pathlib/mod.rs --- -error[PTH124]: py_path_2.py:3:5: `py.path` is in maintenance mode, use `pathlib` instead +error[PTH124]: 3:5: `py.path` is in maintenance mode, use `pathlib` instead + --> py_path_2.py:3:5 | 1 | from py.path import local as path 2 | diff --git a/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__PTH201_PTH201.py.snap b/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__PTH201_PTH201.py.snap index 1feda549f2..cfd0147439 100644 --- a/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__PTH201_PTH201.py.snap +++ b/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__PTH201_PTH201.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_use_pathlib/mod.rs --- -error[PTH201]: PTH201.py:5:10: [*] Do not pass the current directory explicitly to `Path` +error[PTH201]: 5:10: [*] Do not pass the current directory explicitly to `Path` + --> PTH201.py:5:10 | 4 | # match 5 | _ = Path(".") @@ -21,8 +22,9 @@ error[PTH201]: PTH201.py:5:10: [*] Do not pass the current directory explicitly 7 7 | _ = PurePath(".") 8 8 | _ = Path("") -error[PTH201]: PTH201.py:6:9: [*] Do not pass the current directory explicitly to `Path` +error[PTH201]: 6:9: [*] Do not pass the current directory explicitly to `Path` + --> PTH201.py:6:9 | 4 | # match 5 | _ = Path(".") @@ -42,8 +44,9 @@ error[PTH201]: PTH201.py:6:9: [*] Do not pass the current directory explicitly t 8 8 | _ = Path("") 9 9 | -error[PTH201]: PTH201.py:7:14: [*] Do not pass the current directory explicitly to `Path` +error[PTH201]: 7:14: [*] Do not pass the current directory explicitly to `Path` + --> PTH201.py:7:14 | 5 | _ = Path(".") 6 | _ = pth(".") @@ -62,8 +65,9 @@ error[PTH201]: PTH201.py:7:14: [*] Do not pass the current directory explicitly 9 9 | 10 10 | # no match -error[PTH201]: PTH201.py:8:10: [*] Do not pass the current directory explicitly to `Path` +error[PTH201]: 8:10: [*] Do not pass the current directory explicitly to `Path` + --> PTH201.py:8:10 | 6 | _ = pth(".") 7 | _ = PurePath(".") diff --git a/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__PTH202_PTH202.py.snap b/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__PTH202_PTH202.py.snap index 6335314e24..7d703eef24 100644 --- a/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__PTH202_PTH202.py.snap +++ b/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__PTH202_PTH202.py.snap @@ -1,16 +1,18 @@ --- source: crates/ruff_linter/src/rules/flake8_use_pathlib/mod.rs --- -error[PTH202]: PTH202.py:6:1: `os.path.getsize` should be replaced by `Path.stat().st_size` +error[PTH202]: 6:1: `os.path.getsize` should be replaced by `Path.stat().st_size` + --> PTH202.py:6:1 | 6 | os.path.getsize("filename") | ^^^^^^^^^^^^^^^ 7 | os.path.getsize(b"filename") 8 | os.path.getsize(Path("filename")) | -error[PTH202]: PTH202.py:7:1: `os.path.getsize` should be replaced by `Path.stat().st_size` +error[PTH202]: 7:1: `os.path.getsize` should be replaced by `Path.stat().st_size` + --> PTH202.py:6:28 | 6 | os.path.getsize("filename") 7 | os.path.getsize(b"filename") @@ -18,8 +20,9 @@ error[PTH202]: PTH202.py:7:1: `os.path.getsize` should be replaced by `Path.stat 8 | os.path.getsize(Path("filename")) 9 | os.path.getsize(__file__) | -error[PTH202]: PTH202.py:8:1: `os.path.getsize` should be replaced by `Path.stat().st_size` +error[PTH202]: 8:1: `os.path.getsize` should be replaced by `Path.stat().st_size` + --> PTH202.py:7:29 | 6 | os.path.getsize("filename") 7 | os.path.getsize(b"filename") @@ -27,8 +30,9 @@ error[PTH202]: PTH202.py:8:1: `os.path.getsize` should be replaced by `Path.stat | ^^^^^^^^^^^^^^^ 9 | os.path.getsize(__file__) | -error[PTH202]: PTH202.py:9:1: `os.path.getsize` should be replaced by `Path.stat().st_size` +error[PTH202]: 9:1: `os.path.getsize` should be replaced by `Path.stat().st_size` + --> PTH202.py:8:34 | 7 | os.path.getsize(b"filename") 8 | os.path.getsize(Path("filename")) @@ -37,8 +41,9 @@ error[PTH202]: PTH202.py:9:1: `os.path.getsize` should be replaced by `Path.stat 10 | 11 | getsize("filename") | -error[PTH202]: PTH202.py:11:1: `os.path.getsize` should be replaced by `Path.stat().st_size` +error[PTH202]: 11:1: `os.path.getsize` should be replaced by `Path.stat().st_size` + --> PTH202.py:10:1 | 9 | os.path.getsize(__file__) 10 | @@ -47,8 +52,9 @@ error[PTH202]: PTH202.py:11:1: `os.path.getsize` should be replaced by `Path.sta 12 | getsize(b"filename") 13 | getsize(Path("filename")) | -error[PTH202]: PTH202.py:12:1: `os.path.getsize` should be replaced by `Path.stat().st_size` +error[PTH202]: 12:1: `os.path.getsize` should be replaced by `Path.stat().st_size` + --> PTH202.py:11:20 | 11 | getsize("filename") 12 | getsize(b"filename") @@ -56,8 +62,9 @@ error[PTH202]: PTH202.py:12:1: `os.path.getsize` should be replaced by `Path.sta 13 | getsize(Path("filename")) 14 | getsize(__file__) | -error[PTH202]: PTH202.py:13:1: `os.path.getsize` should be replaced by `Path.stat().st_size` +error[PTH202]: 13:1: `os.path.getsize` should be replaced by `Path.stat().st_size` + --> PTH202.py:12:21 | 11 | getsize("filename") 12 | getsize(b"filename") @@ -65,8 +72,9 @@ error[PTH202]: PTH202.py:13:1: `os.path.getsize` should be replaced by `Path.sta | ^^^^^^^ 14 | getsize(__file__) | -error[PTH202]: PTH202.py:14:1: `os.path.getsize` should be replaced by `Path.stat().st_size` +error[PTH202]: 14:1: `os.path.getsize` should be replaced by `Path.stat().st_size` + --> PTH202.py:13:26 | 12 | getsize(b"filename") 13 | getsize(Path("filename")) diff --git a/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__PTH203_PTH203.py.snap b/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__PTH203_PTH203.py.snap index f6770926fc..9eae7883e6 100644 --- a/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__PTH203_PTH203.py.snap +++ b/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__PTH203_PTH203.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_use_pathlib/mod.rs --- -error[PTH203]: PTH203.py:5:1: `os.path.getatime` should be replaced by `Path.stat().st_atime` +error[PTH203]: 5:1: `os.path.getatime` should be replaced by `Path.stat().st_atime` + --> PTH203.py:4:1 | 3 | from os.path import getatime 4 | @@ -11,40 +12,45 @@ error[PTH203]: PTH203.py:5:1: `os.path.getatime` should be replaced by `Path.sta 6 | os.path.getatime(b"filename") 7 | os.path.getatime(Path("filename")) | -error[PTH203]: PTH203.py:6:1: `os.path.getatime` should be replaced by `Path.stat().st_atime` +error[PTH203]: 6:1: `os.path.getatime` should be replaced by `Path.stat().st_atime` + --> PTH203.py:5:29 | 5 | os.path.getatime("filename") 6 | os.path.getatime(b"filename") | ^^^^^^^^^^^^^^^^ 7 | os.path.getatime(Path("filename")) | -error[PTH203]: PTH203.py:7:1: `os.path.getatime` should be replaced by `Path.stat().st_atime` +error[PTH203]: 7:1: `os.path.getatime` should be replaced by `Path.stat().st_atime` + --> PTH203.py:6:30 | 5 | os.path.getatime("filename") 6 | os.path.getatime(b"filename") 7 | os.path.getatime(Path("filename")) | ^^^^^^^^^^^^^^^^ | -error[PTH203]: PTH203.py:10:1: `os.path.getatime` should be replaced by `Path.stat().st_atime` +error[PTH203]: 10:1: `os.path.getatime` should be replaced by `Path.stat().st_atime` + --> PTH203.py:10:1 | 10 | getatime("filename") | ^^^^^^^^ 11 | getatime(b"filename") 12 | getatime(Path("filename")) | -error[PTH203]: PTH203.py:11:1: `os.path.getatime` should be replaced by `Path.stat().st_atime` +error[PTH203]: 11:1: `os.path.getatime` should be replaced by `Path.stat().st_atime` + --> PTH203.py:10:21 | 10 | getatime("filename") 11 | getatime(b"filename") | ^^^^^^^^ 12 | getatime(Path("filename")) | -error[PTH203]: PTH203.py:12:1: `os.path.getatime` should be replaced by `Path.stat().st_atime` +error[PTH203]: 12:1: `os.path.getatime` should be replaced by `Path.stat().st_atime` + --> PTH203.py:11:22 | 10 | getatime("filename") 11 | getatime(b"filename") diff --git a/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__PTH204_PTH204.py.snap b/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__PTH204_PTH204.py.snap index afe825394f..dfb9995abd 100644 --- a/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__PTH204_PTH204.py.snap +++ b/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__PTH204_PTH204.py.snap @@ -1,48 +1,54 @@ --- source: crates/ruff_linter/src/rules/flake8_use_pathlib/mod.rs --- -error[PTH204]: PTH204.py:6:1: `os.path.getmtime` should be replaced by `Path.stat().st_mtime` +error[PTH204]: 6:1: `os.path.getmtime` should be replaced by `Path.stat().st_mtime` + --> PTH204.py:6:1 | 6 | os.path.getmtime("filename") | ^^^^^^^^^^^^^^^^ 7 | os.path.getmtime(b"filename") 8 | os.path.getmtime(Path("filename")) | -error[PTH204]: PTH204.py:7:1: `os.path.getmtime` should be replaced by `Path.stat().st_mtime` +error[PTH204]: 7:1: `os.path.getmtime` should be replaced by `Path.stat().st_mtime` + --> PTH204.py:6:29 | 6 | os.path.getmtime("filename") 7 | os.path.getmtime(b"filename") | ^^^^^^^^^^^^^^^^ 8 | os.path.getmtime(Path("filename")) | -error[PTH204]: PTH204.py:8:1: `os.path.getmtime` should be replaced by `Path.stat().st_mtime` +error[PTH204]: 8:1: `os.path.getmtime` should be replaced by `Path.stat().st_mtime` + --> PTH204.py:7:30 | 6 | os.path.getmtime("filename") 7 | os.path.getmtime(b"filename") 8 | os.path.getmtime(Path("filename")) | ^^^^^^^^^^^^^^^^ | -error[PTH204]: PTH204.py:11:1: `os.path.getmtime` should be replaced by `Path.stat().st_mtime` +error[PTH204]: 11:1: `os.path.getmtime` should be replaced by `Path.stat().st_mtime` + --> PTH204.py:11:1 | 11 | getmtime("filename") | ^^^^^^^^ 12 | getmtime(b"filename") 13 | getmtime(Path("filename")) | -error[PTH204]: PTH204.py:12:1: `os.path.getmtime` should be replaced by `Path.stat().st_mtime` +error[PTH204]: 12:1: `os.path.getmtime` should be replaced by `Path.stat().st_mtime` + --> PTH204.py:11:21 | 11 | getmtime("filename") 12 | getmtime(b"filename") | ^^^^^^^^ 13 | getmtime(Path("filename")) | -error[PTH204]: PTH204.py:13:1: `os.path.getmtime` should be replaced by `Path.stat().st_mtime` +error[PTH204]: 13:1: `os.path.getmtime` should be replaced by `Path.stat().st_mtime` + --> PTH204.py:12:22 | 11 | getmtime("filename") 12 | getmtime(b"filename") diff --git a/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__PTH205_PTH205.py.snap b/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__PTH205_PTH205.py.snap index 959a0b6497..1c0712bf79 100644 --- a/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__PTH205_PTH205.py.snap +++ b/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__PTH205_PTH205.py.snap @@ -1,24 +1,27 @@ --- source: crates/ruff_linter/src/rules/flake8_use_pathlib/mod.rs --- -error[PTH205]: PTH205.py:6:1: `os.path.getctime` should be replaced by `Path.stat().st_ctime` +error[PTH205]: 6:1: `os.path.getctime` should be replaced by `Path.stat().st_ctime` + --> PTH205.py:6:1 | 6 | os.path.getctime("filename") | ^^^^^^^^^^^^^^^^ 7 | os.path.getctime(b"filename") 8 | os.path.getctime(Path("filename")) | -error[PTH205]: PTH205.py:7:1: `os.path.getctime` should be replaced by `Path.stat().st_ctime` +error[PTH205]: 7:1: `os.path.getctime` should be replaced by `Path.stat().st_ctime` + --> PTH205.py:6:29 | 6 | os.path.getctime("filename") 7 | os.path.getctime(b"filename") | ^^^^^^^^^^^^^^^^ 8 | os.path.getctime(Path("filename")) | -error[PTH205]: PTH205.py:8:1: `os.path.getctime` should be replaced by `Path.stat().st_ctime` +error[PTH205]: 8:1: `os.path.getctime` should be replaced by `Path.stat().st_ctime` + --> PTH205.py:7:30 | 6 | os.path.getctime("filename") 7 | os.path.getctime(b"filename") @@ -27,8 +30,9 @@ error[PTH205]: PTH205.py:8:1: `os.path.getctime` should be replaced by `Path.sta 9 | 10 | getctime("filename") | -error[PTH205]: PTH205.py:10:1: `os.path.getctime` should be replaced by `Path.stat().st_ctime` +error[PTH205]: 10:1: `os.path.getctime` should be replaced by `Path.stat().st_ctime` + --> PTH205.py:9:1 | 8 | os.path.getctime(Path("filename")) 9 | @@ -37,16 +41,18 @@ error[PTH205]: PTH205.py:10:1: `os.path.getctime` should be replaced by `Path.st 11 | getctime(b"filename") 12 | getctime(Path("filename")) | -error[PTH205]: PTH205.py:11:1: `os.path.getctime` should be replaced by `Path.stat().st_ctime` +error[PTH205]: 11:1: `os.path.getctime` should be replaced by `Path.stat().st_ctime` + --> PTH205.py:10:21 | 10 | getctime("filename") 11 | getctime(b"filename") | ^^^^^^^^ 12 | getctime(Path("filename")) | -error[PTH205]: PTH205.py:12:1: `os.path.getctime` should be replaced by `Path.stat().st_ctime` +error[PTH205]: 12:1: `os.path.getctime` should be replaced by `Path.stat().st_ctime` + --> PTH205.py:11:22 | 10 | getctime("filename") 11 | getctime(b"filename") diff --git a/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__PTH206_PTH206.py.snap b/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__PTH206_PTH206.py.snap index 8c8b94e115..b3ec270bff 100644 --- a/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__PTH206_PTH206.py.snap +++ b/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__PTH206_PTH206.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_use_pathlib/mod.rs --- -error[PTH206]: PTH206.py:8:12: Replace `.split(os.sep)` with `Path.parts` +error[PTH206]: 8:12: Replace `.split(os.sep)` with `Path.parts` + --> PTH206.py:8:12 | 7 | # PTH206 8 | "foo/bar/".split(os.sep) @@ -10,8 +11,9 @@ error[PTH206]: PTH206.py:8:12: Replace `.split(os.sep)` with `Path.parts` 9 | "foo/bar/".split(sep=os.sep) 10 | "foo/bar/".split(os.sep)[-1] | -error[PTH206]: PTH206.py:9:12: Replace `.split(os.sep)` with `Path.parts` +error[PTH206]: 9:12: Replace `.split(os.sep)` with `Path.parts` + --> PTH206.py:9:12 | 7 | # PTH206 8 | "foo/bar/".split(os.sep) @@ -20,8 +22,9 @@ error[PTH206]: PTH206.py:9:12: Replace `.split(os.sep)` with `Path.parts` 10 | "foo/bar/".split(os.sep)[-1] 11 | "foo/bar/".split(os.sep)[-2] | -error[PTH206]: PTH206.py:10:12: Replace `.split(os.sep)` with `Path.parts` +error[PTH206]: 10:12: Replace `.split(os.sep)` with `Path.parts` + --> PTH206.py:10:12 | 8 | "foo/bar/".split(os.sep) 9 | "foo/bar/".split(sep=os.sep) @@ -30,8 +33,9 @@ error[PTH206]: PTH206.py:10:12: Replace `.split(os.sep)` with `Path.parts` 11 | "foo/bar/".split(os.sep)[-2] 12 | "foo/bar/".split(os.sep)[-2:] | -error[PTH206]: PTH206.py:11:12: Replace `.split(os.sep)` with `Path.parts` +error[PTH206]: 11:12: Replace `.split(os.sep)` with `Path.parts` + --> PTH206.py:11:12 | 9 | "foo/bar/".split(sep=os.sep) 10 | "foo/bar/".split(os.sep)[-1] @@ -40,8 +44,9 @@ error[PTH206]: PTH206.py:11:12: Replace `.split(os.sep)` with `Path.parts` 12 | "foo/bar/".split(os.sep)[-2:] 13 | "fizz/buzz".split(sep) | -error[PTH206]: PTH206.py:12:12: Replace `.split(os.sep)` with `Path.parts` +error[PTH206]: 12:12: Replace `.split(os.sep)` with `Path.parts` + --> PTH206.py:12:12 | 10 | "foo/bar/".split(os.sep)[-1] 11 | "foo/bar/".split(os.sep)[-2] @@ -50,8 +55,9 @@ error[PTH206]: PTH206.py:12:12: Replace `.split(os.sep)` with `Path.parts` 13 | "fizz/buzz".split(sep) 14 | "fizz/buzz".split(sep)[-1] | -error[PTH206]: PTH206.py:13:13: Replace `.split(os.sep)` with `Path.parts` +error[PTH206]: 13:13: Replace `.split(os.sep)` with `Path.parts` + --> PTH206.py:13:13 | 11 | "foo/bar/".split(os.sep)[-2] 12 | "foo/bar/".split(os.sep)[-2:] @@ -60,8 +66,9 @@ error[PTH206]: PTH206.py:13:13: Replace `.split(os.sep)` with `Path.parts` 14 | "fizz/buzz".split(sep)[-1] 15 | os.path.splitext("path/to/hello_world.py")[0].split(os.sep)[-1] | -error[PTH206]: PTH206.py:14:13: Replace `.split(os.sep)` with `Path.parts` +error[PTH206]: 14:13: Replace `.split(os.sep)` with `Path.parts` + --> PTH206.py:14:13 | 12 | "foo/bar/".split(os.sep)[-2:] 13 | "fizz/buzz".split(sep) @@ -70,8 +77,9 @@ error[PTH206]: PTH206.py:14:13: Replace `.split(os.sep)` with `Path.parts` 15 | os.path.splitext("path/to/hello_world.py")[0].split(os.sep)[-1] 16 | file_name.split(os.sep) | -error[PTH206]: PTH206.py:15:47: Replace `.split(os.sep)` with `Path.parts` +error[PTH206]: 15:47: Replace `.split(os.sep)` with `Path.parts` + --> PTH206.py:15:47 | 13 | "fizz/buzz".split(sep) 14 | "fizz/buzz".split(sep)[-1] @@ -80,8 +88,9 @@ error[PTH206]: PTH206.py:15:47: Replace `.split(os.sep)` with `Path.parts` 16 | file_name.split(os.sep) 17 | (os.path.abspath(file_name)).split(os.sep) | -error[PTH206]: PTH206.py:16:11: Replace `.split(os.sep)` with `Path.parts` +error[PTH206]: 16:11: Replace `.split(os.sep)` with `Path.parts` + --> PTH206.py:16:11 | 14 | "fizz/buzz".split(sep)[-1] 15 | os.path.splitext("path/to/hello_world.py")[0].split(os.sep)[-1] @@ -89,8 +98,9 @@ error[PTH206]: PTH206.py:16:11: Replace `.split(os.sep)` with `Path.parts` | ^^^^^ 17 | (os.path.abspath(file_name)).split(os.sep) | -error[PTH206]: PTH206.py:17:30: Replace `.split(os.sep)` with `Path.parts` +error[PTH206]: 17:30: Replace `.split(os.sep)` with `Path.parts` + --> PTH206.py:17:30 | 15 | os.path.splitext("path/to/hello_world.py")[0].split(os.sep)[-1] 16 | file_name.split(os.sep) diff --git a/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__PTH207_PTH207.py.snap b/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__PTH207_PTH207.py.snap index 4417ca9cdb..064d47686f 100644 --- a/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__PTH207_PTH207.py.snap +++ b/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__PTH207_PTH207.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_use_pathlib/mod.rs --- -error[PTH207]: PTH207.py:9:1: Replace `glob` with `Path.glob` or `Path.rglob` +error[PTH207]: 9:1: Replace `glob` with `Path.glob` or `Path.rglob` + --> PTH207.py:8:9 | 8 | # PTH207 9 | glob.glob(os.path.join(extensions_dir, "ops", "autograd", "*.cpp")) @@ -10,8 +11,9 @@ error[PTH207]: PTH207.py:9:1: Replace `glob` with `Path.glob` or `Path.rglob` 10 | list(glob.iglob(os.path.join(extensions_dir, "ops", "autograd", "*.cpp"))) 11 | search("*.png") | -error[PTH207]: PTH207.py:10:6: Replace `iglob` with `Path.glob` or `Path.rglob` +error[PTH207]: 10:6: Replace `iglob` with `Path.glob` or `Path.rglob` + --> PTH207.py:10:6 | 8 | # PTH207 9 | glob.glob(os.path.join(extensions_dir, "ops", "autograd", "*.cpp")) @@ -19,8 +21,9 @@ error[PTH207]: PTH207.py:10:6: Replace `iglob` with `Path.glob` or `Path.rglob` | ^^^^^^^^^^ 11 | search("*.png") | -error[PTH207]: PTH207.py:11:1: Replace `glob` with `Path.glob` or `Path.rglob` +error[PTH207]: 11:1: Replace `glob` with `Path.glob` or `Path.rglob` + --> PTH207.py:10:75 | 9 | glob.glob(os.path.join(extensions_dir, "ops", "autograd", "*.cpp")) 10 | list(glob.iglob(os.path.join(extensions_dir, "ops", "autograd", "*.cpp"))) diff --git a/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__full_name.py.snap b/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__full_name.py.snap index 02a12bd877..ac0299c712 100644 --- a/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__full_name.py.snap +++ b/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__full_name.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_use_pathlib/mod.rs --- -error[PTH100]: full_name.py:7:5: `os.path.abspath()` should be replaced by `Path.resolve()` +error[PTH100]: 7:5: `os.path.abspath()` should be replaced by `Path.resolve()` + --> full_name.py:7:5 | 5 | q = "bar" 6 | @@ -11,8 +12,9 @@ error[PTH100]: full_name.py:7:5: `os.path.abspath()` should be replaced by `Path 8 | aa = os.chmod(p) 9 | aaa = os.mkdir(p) | -error[PTH101]: full_name.py:8:6: `os.chmod()` should be replaced by `Path.chmod()` +error[PTH101]: 8:6: `os.chmod()` should be replaced by `Path.chmod()` + --> full_name.py:8:6 | 7 | a = os.path.abspath(p) 8 | aa = os.chmod(p) @@ -20,8 +22,9 @@ error[PTH101]: full_name.py:8:6: `os.chmod()` should be replaced by `Path.chmod( 9 | aaa = os.mkdir(p) 10 | os.makedirs(p) | -error[PTH102]: full_name.py:9:7: `os.mkdir()` should be replaced by `Path.mkdir()` +error[PTH102]: 9:7: `os.mkdir()` should be replaced by `Path.mkdir()` + --> full_name.py:9:7 | 7 | a = os.path.abspath(p) 8 | aa = os.chmod(p) @@ -30,8 +33,9 @@ error[PTH102]: full_name.py:9:7: `os.mkdir()` should be replaced by `Path.mkdir( 10 | os.makedirs(p) 11 | os.rename(p) | -error[PTH103]: full_name.py:10:1: `os.makedirs()` should be replaced by `Path.mkdir(parents=True)` +error[PTH103]: 10:1: `os.makedirs()` should be replaced by `Path.mkdir(parents=True)` + --> full_name.py:9:18 | 8 | aa = os.chmod(p) 9 | aaa = os.mkdir(p) @@ -40,8 +44,9 @@ error[PTH103]: full_name.py:10:1: `os.makedirs()` should be replaced by `Path.mk 11 | os.rename(p) 12 | os.replace(p) | -error[PTH104]: full_name.py:11:1: `os.rename()` should be replaced by `Path.rename()` +error[PTH104]: 11:1: `os.rename()` should be replaced by `Path.rename()` + --> full_name.py:10:15 | 9 | aaa = os.mkdir(p) 10 | os.makedirs(p) @@ -50,8 +55,9 @@ error[PTH104]: full_name.py:11:1: `os.rename()` should be replaced by `Path.rena 12 | os.replace(p) 13 | os.rmdir(p) | -error[PTH105]: full_name.py:12:1: `os.replace()` should be replaced by `Path.replace()` +error[PTH105]: 12:1: `os.replace()` should be replaced by `Path.replace()` + --> full_name.py:11:13 | 10 | os.makedirs(p) 11 | os.rename(p) @@ -60,8 +66,9 @@ error[PTH105]: full_name.py:12:1: `os.replace()` should be replaced by `Path.rep 13 | os.rmdir(p) 14 | os.remove(p) | -error[PTH106]: full_name.py:13:1: `os.rmdir()` should be replaced by `Path.rmdir()` +error[PTH106]: 13:1: `os.rmdir()` should be replaced by `Path.rmdir()` + --> full_name.py:12:14 | 11 | os.rename(p) 12 | os.replace(p) @@ -70,8 +77,9 @@ error[PTH106]: full_name.py:13:1: `os.rmdir()` should be replaced by `Path.rmdir 14 | os.remove(p) 15 | os.unlink(p) | -error[PTH107]: full_name.py:14:1: `os.remove()` should be replaced by `Path.unlink()` +error[PTH107]: 14:1: `os.remove()` should be replaced by `Path.unlink()` + --> full_name.py:13:12 | 12 | os.replace(p) 13 | os.rmdir(p) @@ -80,8 +88,9 @@ error[PTH107]: full_name.py:14:1: `os.remove()` should be replaced by `Path.unli 15 | os.unlink(p) 16 | os.getcwd(p) | -error[PTH108]: full_name.py:15:1: `os.unlink()` should be replaced by `Path.unlink()` +error[PTH108]: 15:1: `os.unlink()` should be replaced by `Path.unlink()` + --> full_name.py:14:13 | 13 | os.rmdir(p) 14 | os.remove(p) @@ -90,8 +99,9 @@ error[PTH108]: full_name.py:15:1: `os.unlink()` should be replaced by `Path.unli 16 | os.getcwd(p) 17 | b = os.path.exists(p) | -error[PTH109]: full_name.py:16:1: `os.getcwd()` should be replaced by `Path.cwd()` +error[PTH109]: 16:1: `os.getcwd()` should be replaced by `Path.cwd()` + --> full_name.py:15:13 | 14 | os.remove(p) 15 | os.unlink(p) @@ -100,8 +110,9 @@ error[PTH109]: full_name.py:16:1: `os.getcwd()` should be replaced by `Path.cwd( 17 | b = os.path.exists(p) 18 | bb = os.path.expanduser(p) | -error[PTH110]: full_name.py:17:5: `os.path.exists()` should be replaced by `Path.exists()` +error[PTH110]: 17:5: `os.path.exists()` should be replaced by `Path.exists()` + --> full_name.py:17:5 | 15 | os.unlink(p) 16 | os.getcwd(p) @@ -110,8 +121,9 @@ error[PTH110]: full_name.py:17:5: `os.path.exists()` should be replaced by `Path 18 | bb = os.path.expanduser(p) 19 | bbb = os.path.isdir(p) | -error[PTH111]: full_name.py:18:6: `os.path.expanduser()` should be replaced by `Path.expanduser()` +error[PTH111]: 18:6: `os.path.expanduser()` should be replaced by `Path.expanduser()` + --> full_name.py:18:6 | 16 | os.getcwd(p) 17 | b = os.path.exists(p) @@ -120,8 +132,9 @@ error[PTH111]: full_name.py:18:6: `os.path.expanduser()` should be replaced by ` 19 | bbb = os.path.isdir(p) 20 | bbbb = os.path.isfile(p) | -error[PTH112]: full_name.py:19:7: `os.path.isdir()` should be replaced by `Path.is_dir()` +error[PTH112]: 19:7: `os.path.isdir()` should be replaced by `Path.is_dir()` + --> full_name.py:19:7 | 17 | b = os.path.exists(p) 18 | bb = os.path.expanduser(p) @@ -130,8 +143,9 @@ error[PTH112]: full_name.py:19:7: `os.path.isdir()` should be replaced by `Path. 20 | bbbb = os.path.isfile(p) 21 | bbbbb = os.path.islink(p) | -error[PTH113]: full_name.py:20:8: `os.path.isfile()` should be replaced by `Path.is_file()` +error[PTH113]: 20:8: `os.path.isfile()` should be replaced by `Path.is_file()` + --> full_name.py:20:8 | 18 | bb = os.path.expanduser(p) 19 | bbb = os.path.isdir(p) @@ -140,8 +154,9 @@ error[PTH113]: full_name.py:20:8: `os.path.isfile()` should be replaced by `Path 21 | bbbbb = os.path.islink(p) 22 | os.readlink(p) | -error[PTH114]: full_name.py:21:9: `os.path.islink()` should be replaced by `Path.is_symlink()` +error[PTH114]: 21:9: `os.path.islink()` should be replaced by `Path.is_symlink()` + --> full_name.py:21:9 | 19 | bbb = os.path.isdir(p) 20 | bbbb = os.path.isfile(p) @@ -150,8 +165,9 @@ error[PTH114]: full_name.py:21:9: `os.path.islink()` should be replaced by `Path 22 | os.readlink(p) 23 | os.stat(p) | -error[PTH115]: full_name.py:22:1: `os.readlink()` should be replaced by `Path.readlink()` +error[PTH115]: 22:1: `os.readlink()` should be replaced by `Path.readlink()` + --> full_name.py:21:26 | 20 | bbbb = os.path.isfile(p) 21 | bbbbb = os.path.islink(p) @@ -160,8 +176,9 @@ error[PTH115]: full_name.py:22:1: `os.readlink()` should be replaced by `Path.re 23 | os.stat(p) 24 | os.path.isabs(p) | -error[PTH116]: full_name.py:23:1: `os.stat()` should be replaced by `Path.stat()`, `Path.owner()`, or `Path.group()` +error[PTH116]: 23:1: `os.stat()` should be replaced by `Path.stat()`, `Path.owner()`, or `Path.group()` + --> full_name.py:22:15 | 21 | bbbbb = os.path.islink(p) 22 | os.readlink(p) @@ -170,8 +187,9 @@ error[PTH116]: full_name.py:23:1: `os.stat()` should be replaced by `Path.stat() 24 | os.path.isabs(p) 25 | os.path.join(p, q) | -error[PTH117]: full_name.py:24:1: `os.path.isabs()` should be replaced by `Path.is_absolute()` +error[PTH117]: 24:1: `os.path.isabs()` should be replaced by `Path.is_absolute()` + --> full_name.py:23:11 | 22 | os.readlink(p) 23 | os.stat(p) @@ -180,8 +198,9 @@ error[PTH117]: full_name.py:24:1: `os.path.isabs()` should be replaced by `Path. 25 | os.path.join(p, q) 26 | os.sep.join([p, q]) | -error[PTH118]: full_name.py:25:1: `os.path.join()` should be replaced by `Path` with `/` operator +error[PTH118]: 25:1: `os.path.join()` should be replaced by `Path` with `/` operator + --> full_name.py:24:17 | 23 | os.stat(p) 24 | os.path.isabs(p) @@ -190,8 +209,9 @@ error[PTH118]: full_name.py:25:1: `os.path.join()` should be replaced by `Path` 26 | os.sep.join([p, q]) 27 | os.sep.join((p, q)) | -error[PTH118]: full_name.py:26:1: `os.sep.join()` should be replaced by `Path` with `/` operator +error[PTH118]: 26:1: `os.sep.join()` should be replaced by `Path` with `/` operator + --> full_name.py:25:19 | 24 | os.path.isabs(p) 25 | os.path.join(p, q) @@ -200,8 +220,9 @@ error[PTH118]: full_name.py:26:1: `os.sep.join()` should be replaced by `Path` w 27 | os.sep.join((p, q)) 28 | os.path.basename(p) | -error[PTH118]: full_name.py:27:1: `os.sep.join()` should be replaced by `Path` with `/` operator +error[PTH118]: 27:1: `os.sep.join()` should be replaced by `Path` with `/` operator + --> full_name.py:26:20 | 25 | os.path.join(p, q) 26 | os.sep.join([p, q]) @@ -210,8 +231,9 @@ error[PTH118]: full_name.py:27:1: `os.sep.join()` should be replaced by `Path` w 28 | os.path.basename(p) 29 | os.path.dirname(p) | -error[PTH119]: full_name.py:28:1: `os.path.basename()` should be replaced by `Path.name` +error[PTH119]: 28:1: `os.path.basename()` should be replaced by `Path.name` + --> full_name.py:27:20 | 26 | os.sep.join([p, q]) 27 | os.sep.join((p, q)) @@ -220,8 +242,9 @@ error[PTH119]: full_name.py:28:1: `os.path.basename()` should be replaced by `Pa 29 | os.path.dirname(p) 30 | os.path.samefile(p) | -error[PTH120]: full_name.py:29:1: `os.path.dirname()` should be replaced by `Path.parent` +error[PTH120]: 29:1: `os.path.dirname()` should be replaced by `Path.parent` + --> full_name.py:28:20 | 27 | os.sep.join((p, q)) 28 | os.path.basename(p) @@ -230,8 +253,9 @@ error[PTH120]: full_name.py:29:1: `os.path.dirname()` should be replaced by `Pat 30 | os.path.samefile(p) 31 | os.path.splitext(p) | -error[PTH121]: full_name.py:30:1: `os.path.samefile()` should be replaced by `Path.samefile()` +error[PTH121]: 30:1: `os.path.samefile()` should be replaced by `Path.samefile()` + --> full_name.py:29:19 | 28 | os.path.basename(p) 29 | os.path.dirname(p) @@ -240,8 +264,9 @@ error[PTH121]: full_name.py:30:1: `os.path.samefile()` should be replaced by `Pa 31 | os.path.splitext(p) 32 | with open(p) as fp: | -error[PTH122]: full_name.py:31:1: `os.path.splitext()` should be replaced by `Path.suffix`, `Path.stem`, and `Path.parent` +error[PTH122]: 31:1: `os.path.splitext()` should be replaced by `Path.suffix`, `Path.stem`, and `Path.parent` + --> full_name.py:30:20 | 29 | os.path.dirname(p) 30 | os.path.samefile(p) @@ -250,8 +275,9 @@ error[PTH122]: full_name.py:31:1: `os.path.splitext()` should be replaced by `Pa 32 | with open(p) as fp: 33 | fp.read() | -error[PTH123]: full_name.py:32:6: `open()` should be replaced by `Path.open()` +error[PTH123]: 32:6: `open()` should be replaced by `Path.open()` + --> full_name.py:32:6 | 30 | os.path.samefile(p) 31 | os.path.splitext(p) @@ -260,8 +286,9 @@ error[PTH123]: full_name.py:32:6: `open()` should be replaced by `Path.open()` 33 | fp.read() 34 | open(p).close() | -error[PTH123]: full_name.py:34:1: `open()` should be replaced by `Path.open()` +error[PTH123]: 34:1: `open()` should be replaced by `Path.open()` + --> full_name.py:33:14 | 32 | with open(p) as fp: 33 | fp.read() @@ -270,8 +297,9 @@ error[PTH123]: full_name.py:34:1: `open()` should be replaced by `Path.open()` 35 | os.getcwdb(p) 36 | os.path.join(p, *q) | -error[PTH109]: full_name.py:35:1: `os.getcwd()` should be replaced by `Path.cwd()` +error[PTH109]: 35:1: `os.getcwd()` should be replaced by `Path.cwd()` + --> full_name.py:34:16 | 33 | fp.read() 34 | open(p).close() @@ -280,8 +308,9 @@ error[PTH109]: full_name.py:35:1: `os.getcwd()` should be replaced by `Path.cwd( 36 | os.path.join(p, *q) 37 | os.sep.join(p, *q) | -error[PTH118]: full_name.py:36:1: `os.path.join()` should be replaced by `Path.joinpath()` +error[PTH118]: 36:1: `os.path.join()` should be replaced by `Path.joinpath()` + --> full_name.py:35:14 | 34 | open(p).close() 35 | os.getcwdb(p) @@ -289,8 +318,9 @@ error[PTH118]: full_name.py:36:1: `os.path.join()` should be replaced by `Path.j | ^^^^^^^^^^^^ 37 | os.sep.join(p, *q) | -error[PTH118]: full_name.py:37:1: `os.sep.join()` should be replaced by `Path.joinpath()` +error[PTH118]: 37:1: `os.sep.join()` should be replaced by `Path.joinpath()` + --> full_name.py:36:20 | 35 | os.getcwdb(p) 36 | os.path.join(p, *q) @@ -299,8 +329,9 @@ error[PTH118]: full_name.py:37:1: `os.sep.join()` should be replaced by `Path.jo 38 | 39 | # https://github.com/astral-sh/ruff/issues/7620 | -error[PTH123]: full_name.py:46:1: `open()` should be replaced by `Path.open()` +error[PTH123]: 46:1: `open()` should be replaced by `Path.open()` + --> full_name.py:45:23 | 44 | open(p, closefd=False) 45 | open(p, opener=opener) @@ -309,8 +340,9 @@ error[PTH123]: full_name.py:46:1: `open()` should be replaced by `Path.open()` 47 | open(p, 'r', - 1, None, None, None, True, None) 48 | open(p, 'r', - 1, None, None, None, False, opener) | -error[PTH123]: full_name.py:47:1: `open()` should be replaced by `Path.open()` +error[PTH123]: 47:1: `open()` should be replaced by `Path.open()` + --> full_name.py:46:101 | 45 | open(p, opener=opener) 46 | open(p, mode='r', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None) diff --git a/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__import_as.py.snap b/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__import_as.py.snap index ae4a8daabf..06f3e88a7c 100644 --- a/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__import_as.py.snap +++ b/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__import_as.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_use_pathlib/mod.rs --- -error[PTH100]: import_as.py:7:5: `os.path.abspath()` should be replaced by `Path.resolve()` +error[PTH100]: 7:5: `os.path.abspath()` should be replaced by `Path.resolve()` + --> import_as.py:7:5 | 5 | q = "bar" 6 | @@ -11,8 +12,9 @@ error[PTH100]: import_as.py:7:5: `os.path.abspath()` should be replaced by `Path 8 | aa = foo.chmod(p) 9 | aaa = foo.mkdir(p) | -error[PTH101]: import_as.py:8:6: `os.chmod()` should be replaced by `Path.chmod()` +error[PTH101]: 8:6: `os.chmod()` should be replaced by `Path.chmod()` + --> import_as.py:8:6 | 7 | a = foo_p.abspath(p) 8 | aa = foo.chmod(p) @@ -20,8 +22,9 @@ error[PTH101]: import_as.py:8:6: `os.chmod()` should be replaced by `Path.chmod( 9 | aaa = foo.mkdir(p) 10 | foo.makedirs(p) | -error[PTH102]: import_as.py:9:7: `os.mkdir()` should be replaced by `Path.mkdir()` +error[PTH102]: 9:7: `os.mkdir()` should be replaced by `Path.mkdir()` + --> import_as.py:9:7 | 7 | a = foo_p.abspath(p) 8 | aa = foo.chmod(p) @@ -30,8 +33,9 @@ error[PTH102]: import_as.py:9:7: `os.mkdir()` should be replaced by `Path.mkdir( 10 | foo.makedirs(p) 11 | foo.rename(p) | -error[PTH103]: import_as.py:10:1: `os.makedirs()` should be replaced by `Path.mkdir(parents=True)` +error[PTH103]: 10:1: `os.makedirs()` should be replaced by `Path.mkdir(parents=True)` + --> import_as.py:9:19 | 8 | aa = foo.chmod(p) 9 | aaa = foo.mkdir(p) @@ -40,8 +44,9 @@ error[PTH103]: import_as.py:10:1: `os.makedirs()` should be replaced by `Path.mk 11 | foo.rename(p) 12 | foo.replace(p) | -error[PTH104]: import_as.py:11:1: `os.rename()` should be replaced by `Path.rename()` +error[PTH104]: 11:1: `os.rename()` should be replaced by `Path.rename()` + --> import_as.py:10:16 | 9 | aaa = foo.mkdir(p) 10 | foo.makedirs(p) @@ -50,8 +55,9 @@ error[PTH104]: import_as.py:11:1: `os.rename()` should be replaced by `Path.rena 12 | foo.replace(p) 13 | foo.rmdir(p) | -error[PTH105]: import_as.py:12:1: `os.replace()` should be replaced by `Path.replace()` +error[PTH105]: 12:1: `os.replace()` should be replaced by `Path.replace()` + --> import_as.py:11:14 | 10 | foo.makedirs(p) 11 | foo.rename(p) @@ -60,8 +66,9 @@ error[PTH105]: import_as.py:12:1: `os.replace()` should be replaced by `Path.rep 13 | foo.rmdir(p) 14 | foo.remove(p) | -error[PTH106]: import_as.py:13:1: `os.rmdir()` should be replaced by `Path.rmdir()` +error[PTH106]: 13:1: `os.rmdir()` should be replaced by `Path.rmdir()` + --> import_as.py:12:15 | 11 | foo.rename(p) 12 | foo.replace(p) @@ -70,8 +77,9 @@ error[PTH106]: import_as.py:13:1: `os.rmdir()` should be replaced by `Path.rmdir 14 | foo.remove(p) 15 | foo.unlink(p) | -error[PTH107]: import_as.py:14:1: `os.remove()` should be replaced by `Path.unlink()` +error[PTH107]: 14:1: `os.remove()` should be replaced by `Path.unlink()` + --> import_as.py:13:13 | 12 | foo.replace(p) 13 | foo.rmdir(p) @@ -80,8 +88,9 @@ error[PTH107]: import_as.py:14:1: `os.remove()` should be replaced by `Path.unli 15 | foo.unlink(p) 16 | foo.getcwd(p) | -error[PTH108]: import_as.py:15:1: `os.unlink()` should be replaced by `Path.unlink()` +error[PTH108]: 15:1: `os.unlink()` should be replaced by `Path.unlink()` + --> import_as.py:14:14 | 13 | foo.rmdir(p) 14 | foo.remove(p) @@ -90,8 +99,9 @@ error[PTH108]: import_as.py:15:1: `os.unlink()` should be replaced by `Path.unli 16 | foo.getcwd(p) 17 | b = foo_p.exists(p) | -error[PTH109]: import_as.py:16:1: `os.getcwd()` should be replaced by `Path.cwd()` +error[PTH109]: 16:1: `os.getcwd()` should be replaced by `Path.cwd()` + --> import_as.py:15:14 | 14 | foo.remove(p) 15 | foo.unlink(p) @@ -100,8 +110,9 @@ error[PTH109]: import_as.py:16:1: `os.getcwd()` should be replaced by `Path.cwd( 17 | b = foo_p.exists(p) 18 | bb = foo_p.expanduser(p) | -error[PTH110]: import_as.py:17:5: `os.path.exists()` should be replaced by `Path.exists()` +error[PTH110]: 17:5: `os.path.exists()` should be replaced by `Path.exists()` + --> import_as.py:17:5 | 15 | foo.unlink(p) 16 | foo.getcwd(p) @@ -110,8 +121,9 @@ error[PTH110]: import_as.py:17:5: `os.path.exists()` should be replaced by `Path 18 | bb = foo_p.expanduser(p) 19 | bbb = foo_p.isdir(p) | -error[PTH111]: import_as.py:18:6: `os.path.expanduser()` should be replaced by `Path.expanduser()` +error[PTH111]: 18:6: `os.path.expanduser()` should be replaced by `Path.expanduser()` + --> import_as.py:18:6 | 16 | foo.getcwd(p) 17 | b = foo_p.exists(p) @@ -120,8 +132,9 @@ error[PTH111]: import_as.py:18:6: `os.path.expanduser()` should be replaced by ` 19 | bbb = foo_p.isdir(p) 20 | bbbb = foo_p.isfile(p) | -error[PTH112]: import_as.py:19:7: `os.path.isdir()` should be replaced by `Path.is_dir()` +error[PTH112]: 19:7: `os.path.isdir()` should be replaced by `Path.is_dir()` + --> import_as.py:19:7 | 17 | b = foo_p.exists(p) 18 | bb = foo_p.expanduser(p) @@ -130,8 +143,9 @@ error[PTH112]: import_as.py:19:7: `os.path.isdir()` should be replaced by `Path. 20 | bbbb = foo_p.isfile(p) 21 | bbbbb = foo_p.islink(p) | -error[PTH113]: import_as.py:20:8: `os.path.isfile()` should be replaced by `Path.is_file()` +error[PTH113]: 20:8: `os.path.isfile()` should be replaced by `Path.is_file()` + --> import_as.py:20:8 | 18 | bb = foo_p.expanduser(p) 19 | bbb = foo_p.isdir(p) @@ -140,8 +154,9 @@ error[PTH113]: import_as.py:20:8: `os.path.isfile()` should be replaced by `Path 21 | bbbbb = foo_p.islink(p) 22 | foo.readlink(p) | -error[PTH114]: import_as.py:21:9: `os.path.islink()` should be replaced by `Path.is_symlink()` +error[PTH114]: 21:9: `os.path.islink()` should be replaced by `Path.is_symlink()` + --> import_as.py:21:9 | 19 | bbb = foo_p.isdir(p) 20 | bbbb = foo_p.isfile(p) @@ -150,8 +165,9 @@ error[PTH114]: import_as.py:21:9: `os.path.islink()` should be replaced by `Path 22 | foo.readlink(p) 23 | foo.stat(p) | -error[PTH115]: import_as.py:22:1: `os.readlink()` should be replaced by `Path.readlink()` +error[PTH115]: 22:1: `os.readlink()` should be replaced by `Path.readlink()` + --> import_as.py:21:24 | 20 | bbbb = foo_p.isfile(p) 21 | bbbbb = foo_p.islink(p) @@ -160,8 +176,9 @@ error[PTH115]: import_as.py:22:1: `os.readlink()` should be replaced by `Path.re 23 | foo.stat(p) 24 | foo_p.isabs(p) | -error[PTH116]: import_as.py:23:1: `os.stat()` should be replaced by `Path.stat()`, `Path.owner()`, or `Path.group()` +error[PTH116]: 23:1: `os.stat()` should be replaced by `Path.stat()`, `Path.owner()`, or `Path.group()` + --> import_as.py:22:16 | 21 | bbbbb = foo_p.islink(p) 22 | foo.readlink(p) @@ -170,8 +187,9 @@ error[PTH116]: import_as.py:23:1: `os.stat()` should be replaced by `Path.stat() 24 | foo_p.isabs(p) 25 | foo_p.join(p, q) | -error[PTH117]: import_as.py:24:1: `os.path.isabs()` should be replaced by `Path.is_absolute()` +error[PTH117]: 24:1: `os.path.isabs()` should be replaced by `Path.is_absolute()` + --> import_as.py:23:12 | 22 | foo.readlink(p) 23 | foo.stat(p) @@ -180,8 +198,9 @@ error[PTH117]: import_as.py:24:1: `os.path.isabs()` should be replaced by `Path. 25 | foo_p.join(p, q) 26 | foo.sep.join([p, q]) | -error[PTH118]: import_as.py:25:1: `os.path.join()` should be replaced by `Path` with `/` operator +error[PTH118]: 25:1: `os.path.join()` should be replaced by `Path` with `/` operator + --> import_as.py:24:15 | 23 | foo.stat(p) 24 | foo_p.isabs(p) @@ -190,8 +209,9 @@ error[PTH118]: import_as.py:25:1: `os.path.join()` should be replaced by `Path` 26 | foo.sep.join([p, q]) 27 | foo.sep.join((p, q)) | -error[PTH118]: import_as.py:26:1: `os.sep.join()` should be replaced by `Path` with `/` operator +error[PTH118]: 26:1: `os.sep.join()` should be replaced by `Path` with `/` operator + --> import_as.py:25:17 | 24 | foo_p.isabs(p) 25 | foo_p.join(p, q) @@ -200,8 +220,9 @@ error[PTH118]: import_as.py:26:1: `os.sep.join()` should be replaced by `Path` w 27 | foo.sep.join((p, q)) 28 | foo_p.basename(p) | -error[PTH118]: import_as.py:27:1: `os.sep.join()` should be replaced by `Path` with `/` operator +error[PTH118]: 27:1: `os.sep.join()` should be replaced by `Path` with `/` operator + --> import_as.py:26:21 | 25 | foo_p.join(p, q) 26 | foo.sep.join([p, q]) @@ -210,8 +231,9 @@ error[PTH118]: import_as.py:27:1: `os.sep.join()` should be replaced by `Path` w 28 | foo_p.basename(p) 29 | foo_p.dirname(p) | -error[PTH119]: import_as.py:28:1: `os.path.basename()` should be replaced by `Path.name` +error[PTH119]: 28:1: `os.path.basename()` should be replaced by `Path.name` + --> import_as.py:27:21 | 26 | foo.sep.join([p, q]) 27 | foo.sep.join((p, q)) @@ -220,8 +242,9 @@ error[PTH119]: import_as.py:28:1: `os.path.basename()` should be replaced by `Pa 29 | foo_p.dirname(p) 30 | foo_p.samefile(p) | -error[PTH120]: import_as.py:29:1: `os.path.dirname()` should be replaced by `Path.parent` +error[PTH120]: 29:1: `os.path.dirname()` should be replaced by `Path.parent` + --> import_as.py:28:18 | 27 | foo.sep.join((p, q)) 28 | foo_p.basename(p) @@ -230,8 +253,9 @@ error[PTH120]: import_as.py:29:1: `os.path.dirname()` should be replaced by `Pat 30 | foo_p.samefile(p) 31 | foo_p.splitext(p) | -error[PTH121]: import_as.py:30:1: `os.path.samefile()` should be replaced by `Path.samefile()` +error[PTH121]: 30:1: `os.path.samefile()` should be replaced by `Path.samefile()` + --> import_as.py:29:17 | 28 | foo_p.basename(p) 29 | foo_p.dirname(p) @@ -239,8 +263,9 @@ error[PTH121]: import_as.py:30:1: `os.path.samefile()` should be replaced by `Pa | ^^^^^^^^^^^^^^ 31 | foo_p.splitext(p) | -error[PTH122]: import_as.py:31:1: `os.path.splitext()` should be replaced by `Path.suffix`, `Path.stem`, and `Path.parent` +error[PTH122]: 31:1: `os.path.splitext()` should be replaced by `Path.suffix`, `Path.stem`, and `Path.parent` + --> import_as.py:30:18 | 29 | foo_p.dirname(p) 30 | foo_p.samefile(p) diff --git a/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__import_from.py.snap b/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__import_from.py.snap index d2c227e0d0..c9b5f30bb0 100644 --- a/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__import_from.py.snap +++ b/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__import_from.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_use_pathlib/mod.rs --- -error[PTH100]: import_from.py:9:5: `os.path.abspath()` should be replaced by `Path.resolve()` +error[PTH100]: 9:5: `os.path.abspath()` should be replaced by `Path.resolve()` + --> import_from.py:9:5 | 7 | q = "bar" 8 | @@ -11,8 +12,9 @@ error[PTH100]: import_from.py:9:5: `os.path.abspath()` should be replaced by `Pa 10 | aa = chmod(p) 11 | aaa = mkdir(p) | -error[PTH101]: import_from.py:10:6: `os.chmod()` should be replaced by `Path.chmod()` +error[PTH101]: 10:6: `os.chmod()` should be replaced by `Path.chmod()` + --> import_from.py:10:6 | 9 | a = abspath(p) 10 | aa = chmod(p) @@ -20,8 +22,9 @@ error[PTH101]: import_from.py:10:6: `os.chmod()` should be replaced by `Path.chm 11 | aaa = mkdir(p) 12 | makedirs(p) | -error[PTH102]: import_from.py:11:7: `os.mkdir()` should be replaced by `Path.mkdir()` +error[PTH102]: 11:7: `os.mkdir()` should be replaced by `Path.mkdir()` + --> import_from.py:11:7 | 9 | a = abspath(p) 10 | aa = chmod(p) @@ -30,8 +33,9 @@ error[PTH102]: import_from.py:11:7: `os.mkdir()` should be replaced by `Path.mkd 12 | makedirs(p) 13 | rename(p) | -error[PTH103]: import_from.py:12:1: `os.makedirs()` should be replaced by `Path.mkdir(parents=True)` +error[PTH103]: 12:1: `os.makedirs()` should be replaced by `Path.mkdir(parents=True)` + --> import_from.py:11:15 | 10 | aa = chmod(p) 11 | aaa = mkdir(p) @@ -40,8 +44,9 @@ error[PTH103]: import_from.py:12:1: `os.makedirs()` should be replaced by `Path. 13 | rename(p) 14 | replace(p) | -error[PTH104]: import_from.py:13:1: `os.rename()` should be replaced by `Path.rename()` +error[PTH104]: 13:1: `os.rename()` should be replaced by `Path.rename()` + --> import_from.py:12:12 | 11 | aaa = mkdir(p) 12 | makedirs(p) @@ -50,8 +55,9 @@ error[PTH104]: import_from.py:13:1: `os.rename()` should be replaced by `Path.re 14 | replace(p) 15 | rmdir(p) | -error[PTH105]: import_from.py:14:1: `os.replace()` should be replaced by `Path.replace()` +error[PTH105]: 14:1: `os.replace()` should be replaced by `Path.replace()` + --> import_from.py:13:10 | 12 | makedirs(p) 13 | rename(p) @@ -60,8 +66,9 @@ error[PTH105]: import_from.py:14:1: `os.replace()` should be replaced by `Path.r 15 | rmdir(p) 16 | remove(p) | -error[PTH106]: import_from.py:15:1: `os.rmdir()` should be replaced by `Path.rmdir()` +error[PTH106]: 15:1: `os.rmdir()` should be replaced by `Path.rmdir()` + --> import_from.py:14:11 | 13 | rename(p) 14 | replace(p) @@ -70,8 +77,9 @@ error[PTH106]: import_from.py:15:1: `os.rmdir()` should be replaced by `Path.rmd 16 | remove(p) 17 | unlink(p) | -error[PTH107]: import_from.py:16:1: `os.remove()` should be replaced by `Path.unlink()` +error[PTH107]: 16:1: `os.remove()` should be replaced by `Path.unlink()` + --> import_from.py:15:9 | 14 | replace(p) 15 | rmdir(p) @@ -80,8 +88,9 @@ error[PTH107]: import_from.py:16:1: `os.remove()` should be replaced by `Path.un 17 | unlink(p) 18 | getcwd(p) | -error[PTH108]: import_from.py:17:1: `os.unlink()` should be replaced by `Path.unlink()` +error[PTH108]: 17:1: `os.unlink()` should be replaced by `Path.unlink()` + --> import_from.py:16:10 | 15 | rmdir(p) 16 | remove(p) @@ -90,8 +99,9 @@ error[PTH108]: import_from.py:17:1: `os.unlink()` should be replaced by `Path.un 18 | getcwd(p) 19 | b = exists(p) | -error[PTH109]: import_from.py:18:1: `os.getcwd()` should be replaced by `Path.cwd()` +error[PTH109]: 18:1: `os.getcwd()` should be replaced by `Path.cwd()` + --> import_from.py:17:10 | 16 | remove(p) 17 | unlink(p) @@ -100,8 +110,9 @@ error[PTH109]: import_from.py:18:1: `os.getcwd()` should be replaced by `Path.cw 19 | b = exists(p) 20 | bb = expanduser(p) | -error[PTH110]: import_from.py:19:5: `os.path.exists()` should be replaced by `Path.exists()` +error[PTH110]: 19:5: `os.path.exists()` should be replaced by `Path.exists()` + --> import_from.py:19:5 | 17 | unlink(p) 18 | getcwd(p) @@ -110,8 +121,9 @@ error[PTH110]: import_from.py:19:5: `os.path.exists()` should be replaced by `Pa 20 | bb = expanduser(p) 21 | bbb = isdir(p) | -error[PTH111]: import_from.py:20:6: `os.path.expanduser()` should be replaced by `Path.expanduser()` +error[PTH111]: 20:6: `os.path.expanduser()` should be replaced by `Path.expanduser()` + --> import_from.py:20:6 | 18 | getcwd(p) 19 | b = exists(p) @@ -120,8 +132,9 @@ error[PTH111]: import_from.py:20:6: `os.path.expanduser()` should be replaced by 21 | bbb = isdir(p) 22 | bbbb = isfile(p) | -error[PTH112]: import_from.py:21:7: `os.path.isdir()` should be replaced by `Path.is_dir()` +error[PTH112]: 21:7: `os.path.isdir()` should be replaced by `Path.is_dir()` + --> import_from.py:21:7 | 19 | b = exists(p) 20 | bb = expanduser(p) @@ -130,8 +143,9 @@ error[PTH112]: import_from.py:21:7: `os.path.isdir()` should be replaced by `Pat 22 | bbbb = isfile(p) 23 | bbbbb = islink(p) | -error[PTH113]: import_from.py:22:8: `os.path.isfile()` should be replaced by `Path.is_file()` +error[PTH113]: 22:8: `os.path.isfile()` should be replaced by `Path.is_file()` + --> import_from.py:22:8 | 20 | bb = expanduser(p) 21 | bbb = isdir(p) @@ -140,8 +154,9 @@ error[PTH113]: import_from.py:22:8: `os.path.isfile()` should be replaced by `Pa 23 | bbbbb = islink(p) 24 | readlink(p) | -error[PTH114]: import_from.py:23:9: `os.path.islink()` should be replaced by `Path.is_symlink()` +error[PTH114]: 23:9: `os.path.islink()` should be replaced by `Path.is_symlink()` + --> import_from.py:23:9 | 21 | bbb = isdir(p) 22 | bbbb = isfile(p) @@ -150,8 +165,9 @@ error[PTH114]: import_from.py:23:9: `os.path.islink()` should be replaced by `Pa 24 | readlink(p) 25 | stat(p) | -error[PTH115]: import_from.py:24:1: `os.readlink()` should be replaced by `Path.readlink()` +error[PTH115]: 24:1: `os.readlink()` should be replaced by `Path.readlink()` + --> import_from.py:23:18 | 22 | bbbb = isfile(p) 23 | bbbbb = islink(p) @@ -160,8 +176,9 @@ error[PTH115]: import_from.py:24:1: `os.readlink()` should be replaced by `Path. 25 | stat(p) 26 | isabs(p) | -error[PTH116]: import_from.py:25:1: `os.stat()` should be replaced by `Path.stat()`, `Path.owner()`, or `Path.group()` +error[PTH116]: 25:1: `os.stat()` should be replaced by `Path.stat()`, `Path.owner()`, or `Path.group()` + --> import_from.py:24:12 | 23 | bbbbb = islink(p) 24 | readlink(p) @@ -170,8 +187,9 @@ error[PTH116]: import_from.py:25:1: `os.stat()` should be replaced by `Path.stat 26 | isabs(p) 27 | join(p, q) | -error[PTH117]: import_from.py:26:1: `os.path.isabs()` should be replaced by `Path.is_absolute()` +error[PTH117]: 26:1: `os.path.isabs()` should be replaced by `Path.is_absolute()` + --> import_from.py:25:8 | 24 | readlink(p) 25 | stat(p) @@ -180,8 +198,9 @@ error[PTH117]: import_from.py:26:1: `os.path.isabs()` should be replaced by `Pat 27 | join(p, q) 28 | sep.join((p, q)) | -error[PTH118]: import_from.py:27:1: `os.path.join()` should be replaced by `Path` with `/` operator +error[PTH118]: 27:1: `os.path.join()` should be replaced by `Path` with `/` operator + --> import_from.py:26:9 | 25 | stat(p) 26 | isabs(p) @@ -190,8 +209,9 @@ error[PTH118]: import_from.py:27:1: `os.path.join()` should be replaced by `Path 28 | sep.join((p, q)) 29 | sep.join([p, q]) | -error[PTH118]: import_from.py:28:1: `os.sep.join()` should be replaced by `Path` with `/` operator +error[PTH118]: 28:1: `os.sep.join()` should be replaced by `Path` with `/` operator + --> import_from.py:27:11 | 26 | isabs(p) 27 | join(p, q) @@ -200,8 +220,9 @@ error[PTH118]: import_from.py:28:1: `os.sep.join()` should be replaced by `Path` 29 | sep.join([p, q]) 30 | basename(p) | -error[PTH118]: import_from.py:29:1: `os.sep.join()` should be replaced by `Path` with `/` operator +error[PTH118]: 29:1: `os.sep.join()` should be replaced by `Path` with `/` operator + --> import_from.py:28:17 | 27 | join(p, q) 28 | sep.join((p, q)) @@ -210,8 +231,9 @@ error[PTH118]: import_from.py:29:1: `os.sep.join()` should be replaced by `Path` 30 | basename(p) 31 | dirname(p) | -error[PTH119]: import_from.py:30:1: `os.path.basename()` should be replaced by `Path.name` +error[PTH119]: 30:1: `os.path.basename()` should be replaced by `Path.name` + --> import_from.py:29:17 | 28 | sep.join((p, q)) 29 | sep.join([p, q]) @@ -220,8 +242,9 @@ error[PTH119]: import_from.py:30:1: `os.path.basename()` should be replaced by ` 31 | dirname(p) 32 | samefile(p) | -error[PTH120]: import_from.py:31:1: `os.path.dirname()` should be replaced by `Path.parent` +error[PTH120]: 31:1: `os.path.dirname()` should be replaced by `Path.parent` + --> import_from.py:30:12 | 29 | sep.join([p, q]) 30 | basename(p) @@ -230,8 +253,9 @@ error[PTH120]: import_from.py:31:1: `os.path.dirname()` should be replaced by `P 32 | samefile(p) 33 | splitext(p) | -error[PTH121]: import_from.py:32:1: `os.path.samefile()` should be replaced by `Path.samefile()` +error[PTH121]: 32:1: `os.path.samefile()` should be replaced by `Path.samefile()` + --> import_from.py:31:11 | 30 | basename(p) 31 | dirname(p) @@ -240,8 +264,9 @@ error[PTH121]: import_from.py:32:1: `os.path.samefile()` should be replaced by ` 33 | splitext(p) 34 | with open(p) as fp: | -error[PTH122]: import_from.py:33:1: `os.path.splitext()` should be replaced by `Path.suffix`, `Path.stem`, and `Path.parent` +error[PTH122]: 33:1: `os.path.splitext()` should be replaced by `Path.suffix`, `Path.stem`, and `Path.parent` + --> import_from.py:32:12 | 31 | dirname(p) 32 | samefile(p) @@ -250,8 +275,9 @@ error[PTH122]: import_from.py:33:1: `os.path.splitext()` should be replaced by ` 34 | with open(p) as fp: 35 | fp.read() | -error[PTH123]: import_from.py:34:6: `open()` should be replaced by `Path.open()` +error[PTH123]: 34:6: `open()` should be replaced by `Path.open()` + --> import_from.py:34:6 | 32 | samefile(p) 33 | splitext(p) @@ -260,8 +286,9 @@ error[PTH123]: import_from.py:34:6: `open()` should be replaced by `Path.open()` 35 | fp.read() 36 | open(p).close() | -error[PTH123]: import_from.py:36:1: `open()` should be replaced by `Path.open()` +error[PTH123]: 36:1: `open()` should be replaced by `Path.open()` + --> import_from.py:35:14 | 34 | with open(p) as fp: 35 | fp.read() diff --git a/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__import_from_as.py.snap b/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__import_from_as.py.snap index 79049fdd13..c358ccbc8f 100644 --- a/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__import_from_as.py.snap +++ b/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__import_from_as.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flake8_use_pathlib/mod.rs --- -error[PTH100]: import_from_as.py:14:5: `os.path.abspath()` should be replaced by `Path.resolve()` +error[PTH100]: 14:5: `os.path.abspath()` should be replaced by `Path.resolve()` + --> import_from_as.py:14:5 | 12 | q = "bar" 13 | @@ -11,8 +12,9 @@ error[PTH100]: import_from_as.py:14:5: `os.path.abspath()` should be replaced by 15 | aa = xchmod(p) 16 | aaa = xmkdir(p) | -error[PTH101]: import_from_as.py:15:6: `os.chmod()` should be replaced by `Path.chmod()` +error[PTH101]: 15:6: `os.chmod()` should be replaced by `Path.chmod()` + --> import_from_as.py:15:6 | 14 | a = xabspath(p) 15 | aa = xchmod(p) @@ -20,8 +22,9 @@ error[PTH101]: import_from_as.py:15:6: `os.chmod()` should be replaced by `Path. 16 | aaa = xmkdir(p) 17 | xmakedirs(p) | -error[PTH102]: import_from_as.py:16:7: `os.mkdir()` should be replaced by `Path.mkdir()` +error[PTH102]: 16:7: `os.mkdir()` should be replaced by `Path.mkdir()` + --> import_from_as.py:16:7 | 14 | a = xabspath(p) 15 | aa = xchmod(p) @@ -30,8 +33,9 @@ error[PTH102]: import_from_as.py:16:7: `os.mkdir()` should be replaced by `Path. 17 | xmakedirs(p) 18 | xrename(p) | -error[PTH103]: import_from_as.py:17:1: `os.makedirs()` should be replaced by `Path.mkdir(parents=True)` +error[PTH103]: 17:1: `os.makedirs()` should be replaced by `Path.mkdir(parents=True)` + --> import_from_as.py:16:16 | 15 | aa = xchmod(p) 16 | aaa = xmkdir(p) @@ -40,8 +44,9 @@ error[PTH103]: import_from_as.py:17:1: `os.makedirs()` should be replaced by `Pa 18 | xrename(p) 19 | xreplace(p) | -error[PTH104]: import_from_as.py:18:1: `os.rename()` should be replaced by `Path.rename()` +error[PTH104]: 18:1: `os.rename()` should be replaced by `Path.rename()` + --> import_from_as.py:17:13 | 16 | aaa = xmkdir(p) 17 | xmakedirs(p) @@ -50,8 +55,9 @@ error[PTH104]: import_from_as.py:18:1: `os.rename()` should be replaced by `Path 19 | xreplace(p) 20 | xrmdir(p) | -error[PTH105]: import_from_as.py:19:1: `os.replace()` should be replaced by `Path.replace()` +error[PTH105]: 19:1: `os.replace()` should be replaced by `Path.replace()` + --> import_from_as.py:18:11 | 17 | xmakedirs(p) 18 | xrename(p) @@ -60,8 +66,9 @@ error[PTH105]: import_from_as.py:19:1: `os.replace()` should be replaced by `Pat 20 | xrmdir(p) 21 | xremove(p) | -error[PTH106]: import_from_as.py:20:1: `os.rmdir()` should be replaced by `Path.rmdir()` +error[PTH106]: 20:1: `os.rmdir()` should be replaced by `Path.rmdir()` + --> import_from_as.py:19:12 | 18 | xrename(p) 19 | xreplace(p) @@ -70,8 +77,9 @@ error[PTH106]: import_from_as.py:20:1: `os.rmdir()` should be replaced by `Path. 21 | xremove(p) 22 | xunlink(p) | -error[PTH107]: import_from_as.py:21:1: `os.remove()` should be replaced by `Path.unlink()` +error[PTH107]: 21:1: `os.remove()` should be replaced by `Path.unlink()` + --> import_from_as.py:20:10 | 19 | xreplace(p) 20 | xrmdir(p) @@ -80,8 +88,9 @@ error[PTH107]: import_from_as.py:21:1: `os.remove()` should be replaced by `Path 22 | xunlink(p) 23 | xgetcwd(p) | -error[PTH108]: import_from_as.py:22:1: `os.unlink()` should be replaced by `Path.unlink()` +error[PTH108]: 22:1: `os.unlink()` should be replaced by `Path.unlink()` + --> import_from_as.py:21:11 | 20 | xrmdir(p) 21 | xremove(p) @@ -90,8 +99,9 @@ error[PTH108]: import_from_as.py:22:1: `os.unlink()` should be replaced by `Path 23 | xgetcwd(p) 24 | b = xexists(p) | -error[PTH109]: import_from_as.py:23:1: `os.getcwd()` should be replaced by `Path.cwd()` +error[PTH109]: 23:1: `os.getcwd()` should be replaced by `Path.cwd()` + --> import_from_as.py:22:11 | 21 | xremove(p) 22 | xunlink(p) @@ -100,8 +110,9 @@ error[PTH109]: import_from_as.py:23:1: `os.getcwd()` should be replaced by `Path 24 | b = xexists(p) 25 | bb = xexpanduser(p) | -error[PTH110]: import_from_as.py:24:5: `os.path.exists()` should be replaced by `Path.exists()` +error[PTH110]: 24:5: `os.path.exists()` should be replaced by `Path.exists()` + --> import_from_as.py:24:5 | 22 | xunlink(p) 23 | xgetcwd(p) @@ -110,8 +121,9 @@ error[PTH110]: import_from_as.py:24:5: `os.path.exists()` should be replaced by 25 | bb = xexpanduser(p) 26 | bbb = xisdir(p) | -error[PTH111]: import_from_as.py:25:6: `os.path.expanduser()` should be replaced by `Path.expanduser()` +error[PTH111]: 25:6: `os.path.expanduser()` should be replaced by `Path.expanduser()` + --> import_from_as.py:25:6 | 23 | xgetcwd(p) 24 | b = xexists(p) @@ -120,8 +132,9 @@ error[PTH111]: import_from_as.py:25:6: `os.path.expanduser()` should be replaced 26 | bbb = xisdir(p) 27 | bbbb = xisfile(p) | -error[PTH112]: import_from_as.py:26:7: `os.path.isdir()` should be replaced by `Path.is_dir()` +error[PTH112]: 26:7: `os.path.isdir()` should be replaced by `Path.is_dir()` + --> import_from_as.py:26:7 | 24 | b = xexists(p) 25 | bb = xexpanduser(p) @@ -130,8 +143,9 @@ error[PTH112]: import_from_as.py:26:7: `os.path.isdir()` should be replaced by ` 27 | bbbb = xisfile(p) 28 | bbbbb = xislink(p) | -error[PTH113]: import_from_as.py:27:8: `os.path.isfile()` should be replaced by `Path.is_file()` +error[PTH113]: 27:8: `os.path.isfile()` should be replaced by `Path.is_file()` + --> import_from_as.py:27:8 | 25 | bb = xexpanduser(p) 26 | bbb = xisdir(p) @@ -140,8 +154,9 @@ error[PTH113]: import_from_as.py:27:8: `os.path.isfile()` should be replaced by 28 | bbbbb = xislink(p) 29 | xreadlink(p) | -error[PTH114]: import_from_as.py:28:9: `os.path.islink()` should be replaced by `Path.is_symlink()` +error[PTH114]: 28:9: `os.path.islink()` should be replaced by `Path.is_symlink()` + --> import_from_as.py:28:9 | 26 | bbb = xisdir(p) 27 | bbbb = xisfile(p) @@ -150,8 +165,9 @@ error[PTH114]: import_from_as.py:28:9: `os.path.islink()` should be replaced by 29 | xreadlink(p) 30 | xstat(p) | -error[PTH115]: import_from_as.py:29:1: `os.readlink()` should be replaced by `Path.readlink()` +error[PTH115]: 29:1: `os.readlink()` should be replaced by `Path.readlink()` + --> import_from_as.py:28:19 | 27 | bbbb = xisfile(p) 28 | bbbbb = xislink(p) @@ -160,8 +176,9 @@ error[PTH115]: import_from_as.py:29:1: `os.readlink()` should be replaced by `Pa 30 | xstat(p) 31 | xisabs(p) | -error[PTH116]: import_from_as.py:30:1: `os.stat()` should be replaced by `Path.stat()`, `Path.owner()`, or `Path.group()` +error[PTH116]: 30:1: `os.stat()` should be replaced by `Path.stat()`, `Path.owner()`, or `Path.group()` + --> import_from_as.py:29:13 | 28 | bbbbb = xislink(p) 29 | xreadlink(p) @@ -170,8 +187,9 @@ error[PTH116]: import_from_as.py:30:1: `os.stat()` should be replaced by `Path.s 31 | xisabs(p) 32 | xjoin(p, q) | -error[PTH117]: import_from_as.py:31:1: `os.path.isabs()` should be replaced by `Path.is_absolute()` +error[PTH117]: 31:1: `os.path.isabs()` should be replaced by `Path.is_absolute()` + --> import_from_as.py:30:9 | 29 | xreadlink(p) 30 | xstat(p) @@ -180,8 +198,9 @@ error[PTH117]: import_from_as.py:31:1: `os.path.isabs()` should be replaced by ` 32 | xjoin(p, q) 33 | s.join((p, q)) | -error[PTH118]: import_from_as.py:32:1: `os.path.join()` should be replaced by `Path` with `/` operator +error[PTH118]: 32:1: `os.path.join()` should be replaced by `Path` with `/` operator + --> import_from_as.py:31:10 | 30 | xstat(p) 31 | xisabs(p) @@ -190,8 +209,9 @@ error[PTH118]: import_from_as.py:32:1: `os.path.join()` should be replaced by `P 33 | s.join((p, q)) 34 | s.join([p, q]) | -error[PTH118]: import_from_as.py:33:1: `os.sep.join()` should be replaced by `Path` with `/` operator +error[PTH118]: 33:1: `os.sep.join()` should be replaced by `Path` with `/` operator + --> import_from_as.py:32:12 | 31 | xisabs(p) 32 | xjoin(p, q) @@ -200,8 +220,9 @@ error[PTH118]: import_from_as.py:33:1: `os.sep.join()` should be replaced by `Pa 34 | s.join([p, q]) 35 | xbasename(p) | -error[PTH118]: import_from_as.py:34:1: `os.sep.join()` should be replaced by `Path` with `/` operator +error[PTH118]: 34:1: `os.sep.join()` should be replaced by `Path` with `/` operator + --> import_from_as.py:33:15 | 32 | xjoin(p, q) 33 | s.join((p, q)) @@ -210,8 +231,9 @@ error[PTH118]: import_from_as.py:34:1: `os.sep.join()` should be replaced by `Pa 35 | xbasename(p) 36 | xdirname(p) | -error[PTH119]: import_from_as.py:35:1: `os.path.basename()` should be replaced by `Path.name` +error[PTH119]: 35:1: `os.path.basename()` should be replaced by `Path.name` + --> import_from_as.py:34:15 | 33 | s.join((p, q)) 34 | s.join([p, q]) @@ -220,8 +242,9 @@ error[PTH119]: import_from_as.py:35:1: `os.path.basename()` should be replaced b 36 | xdirname(p) 37 | xsamefile(p) | -error[PTH120]: import_from_as.py:36:1: `os.path.dirname()` should be replaced by `Path.parent` +error[PTH120]: 36:1: `os.path.dirname()` should be replaced by `Path.parent` + --> import_from_as.py:35:13 | 34 | s.join([p, q]) 35 | xbasename(p) @@ -230,8 +253,9 @@ error[PTH120]: import_from_as.py:36:1: `os.path.dirname()` should be replaced by 37 | xsamefile(p) 38 | xsplitext(p) | -error[PTH121]: import_from_as.py:37:1: `os.path.samefile()` should be replaced by `Path.samefile()` +error[PTH121]: 37:1: `os.path.samefile()` should be replaced by `Path.samefile()` + --> import_from_as.py:36:12 | 35 | xbasename(p) 36 | xdirname(p) @@ -239,8 +263,9 @@ error[PTH121]: import_from_as.py:37:1: `os.path.samefile()` should be replaced b | ^^^^^^^^^ 38 | xsplitext(p) | -error[PTH122]: import_from_as.py:38:1: `os.path.splitext()` should be replaced by `Path.suffix`, `Path.stem`, and `Path.parent` +error[PTH122]: 38:1: `os.path.splitext()` should be replaced by `Path.suffix`, `Path.stem`, and `Path.parent` + --> import_from_as.py:37:13 | 36 | xdirname(p) 37 | xsamefile(p) diff --git a/crates/ruff_linter/src/rules/flynt/snapshots/ruff_linter__rules__flynt__tests__FLY002_FLY002.py.snap b/crates/ruff_linter/src/rules/flynt/snapshots/ruff_linter__rules__flynt__tests__FLY002_FLY002.py.snap index 8e15f79491..88590971d5 100644 --- a/crates/ruff_linter/src/rules/flynt/snapshots/ruff_linter__rules__flynt__tests__FLY002_FLY002.py.snap +++ b/crates/ruff_linter/src/rules/flynt/snapshots/ruff_linter__rules__flynt__tests__FLY002_FLY002.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/flynt/mod.rs --- -error[FLY002]: FLY002.py:5:7: [*] Consider `f"{a} World"` instead of string join +error[FLY002]: 5:7: [*] Consider `f"{a} World"` instead of string join + --> FLY002.py:5:7 | 4 | a = "Hello" 5 | ok1 = " ".join([a, " World"]) # OK @@ -21,8 +22,9 @@ error[FLY002]: FLY002.py:5:7: [*] Consider `f"{a} World"` instead of string joi 7 7 | ok3 = "x".join(("1", "2", "3")) # OK 8 8 | ok4 = "y".join([1, 2, 3]) # Technically OK, though would've been an error originally -error[FLY002]: FLY002.py:6:7: [*] Consider `f"Finally, {a} World"` instead of string join +error[FLY002]: 6:7: [*] Consider `f"Finally, {a} World"` instead of string join + --> FLY002.py:6:7 | 4 | a = "Hello" 5 | ok1 = " ".join([a, " World"]) # OK @@ -42,8 +44,9 @@ error[FLY002]: FLY002.py:6:7: [*] Consider `f"Finally, {a} World"` instead of st 8 8 | ok4 = "y".join([1, 2, 3]) # Technically OK, though would've been an error originally 9 9 | ok5 = "a".join([random(), random()]) # OK (simple calls) -error[FLY002]: FLY002.py:7:7: [*] Consider `"1x2x3"` instead of string join +error[FLY002]: 7:7: [*] Consider `"1x2x3"` instead of string join + --> FLY002.py:7:7 | 5 | ok1 = " ".join([a, " World"]) # OK 6 | ok2 = "".join(["Finally, ", a, " World"]) # OK @@ -63,8 +66,9 @@ error[FLY002]: FLY002.py:7:7: [*] Consider `"1x2x3"` instead of string join 9 9 | ok5 = "a".join([random(), random()]) # OK (simple calls) 10 10 | ok6 = "a".join([secrets.token_urlsafe(), secrets.token_hex()]) # OK (attr calls) -error[FLY002]: FLY002.py:8:7: [*] Consider `f"{1}y{2}y{3}"` instead of string join +error[FLY002]: 8:7: [*] Consider `f"{1}y{2}y{3}"` instead of string join + --> FLY002.py:8:7 | 6 | ok2 = "".join(["Finally, ", a, " World"]) # OK 7 | ok3 = "x".join(("1", "2", "3")) # OK @@ -84,8 +88,9 @@ error[FLY002]: FLY002.py:8:7: [*] Consider `f"{1}y{2}y{3}"` instead of string jo 10 10 | ok6 = "a".join([secrets.token_urlsafe(), secrets.token_hex()]) # OK (attr calls) 11 11 | -error[FLY002]: FLY002.py:9:7: [*] Consider `f"{random()}a{random()}"` instead of string join +error[FLY002]: 9:7: [*] Consider `f"{random()}a{random()}"` instead of string join + --> FLY002.py:9:7 | 7 | ok3 = "x".join(("1", "2", "3")) # OK 8 | ok4 = "y".join([1, 2, 3]) # Technically OK, though would've been an error originally @@ -104,8 +109,9 @@ error[FLY002]: FLY002.py:9:7: [*] Consider `f"{random()}a{random()}"` instead of 11 11 | 12 12 | nok1 = "x".join({"4", "5", "yee"}) # Not OK (set) -error[FLY002]: FLY002.py:10:7: [*] Consider `f"{secrets.token_urlsafe()}a{secrets.token_hex()}"` instead of string join +error[FLY002]: 10:7: [*] Consider `f"{secrets.token_urlsafe()}a{secrets.token_hex()}"` instead of string join + --> FLY002.py:10:7 | 8 | ok4 = "y".join([1, 2, 3]) # Technically OK, though would've been an error originally 9 | ok5 = "a".join([random(), random()]) # OK (simple calls) @@ -125,8 +131,9 @@ error[FLY002]: FLY002.py:10:7: [*] Consider `f"{secrets.token_urlsafe()}a{secret 12 12 | nok1 = "x".join({"4", "5", "yee"}) # Not OK (set) 13 13 | nok2 = a.join(["1", "2", "3"]) # Not OK (not a static joiner) -error[FLY002]: FLY002.py:23:11: [*] Consider `f"{url}{filename}"` instead of string join +error[FLY002]: 23:11: [*] Consider `f"{url}{filename}"` instead of string join + --> FLY002.py:23:11 | 21 | # Regression test for: https://github.com/astral-sh/ruff/issues/7197 22 | def create_file_public_url(url, filename): diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__1_separate_subpackage_first_and_third_party_imports.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__1_separate_subpackage_first_and_third_party_imports.py.snap index cd0648eea7..fae07fabf9 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__1_separate_subpackage_first_and_third_party_imports.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__1_separate_subpackage_first_and_third_party_imports.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: separate_subpackage_first_and_third_party_imports.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> separate_subpackage_first_and_third_party_imports.py:1:1 | 1 | / import sys 2 | | import baz @@ -12,6 +13,7 @@ error[I001]: separate_subpackage_first_and_third_party_imports.py:1:1: [*] Impor 6 | | import foo 7 | | import foo.bar 8 | | import foo.bar.baz + | |___________________^ | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__2_separate_subpackage_first_and_third_party_imports.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__2_separate_subpackage_first_and_third_party_imports.py.snap index 8cd2c0c48e..b924d7822b 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__2_separate_subpackage_first_and_third_party_imports.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__2_separate_subpackage_first_and_third_party_imports.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: separate_subpackage_first_and_third_party_imports.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> separate_subpackage_first_and_third_party_imports.py:1:1 | 1 | / import sys 2 | | import baz @@ -12,6 +13,7 @@ error[I001]: separate_subpackage_first_and_third_party_imports.py:1:1: [*] Impor 6 | | import foo 7 | | import foo.bar 8 | | import foo.bar.baz + | |___________________^ | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__add_newline_before_comments.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__add_newline_before_comments.py.snap index a465500626..0d1673519f 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__add_newline_before_comments.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__add_newline_before_comments.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: add_newline_before_comments.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> add_newline_before_comments.py:1:1 | 1 | / import os 2 | | # This is a comment in the same section, so we need to add one newline. @@ -11,6 +12,7 @@ error[I001]: add_newline_before_comments.py:1:1: [*] Import block is un-sorted o 5 | | # This is a comment, but it starts a new section, so we don't need to add a newline 6 | | # before it. 7 | | import leading_prefix + | |______________________^ | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__as_imports_comments.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__as_imports_comments.py.snap index 2ea834a17e..a7a501d5f7 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__as_imports_comments.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__as_imports_comments.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: as_imports_comments.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> as_imports_comments.py:1:1 | 1 | / from foo import ( # Comment on `foo` 2 | | Member as Alias, # Comment on `Alias` @@ -19,6 +20,7 @@ error[I001]: as_imports_comments.py:1:1: [*] Import block is un-sorted or un-for 13 | | from bop import ( # Comment on `bop` 14 | | Member # Comment on `Member` 15 | | ) + | |__^ | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__bom_unsorted.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__bom_unsorted.py.snap index 1c3712880e..866ff06577 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__bom_unsorted.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__bom_unsorted.py.snap @@ -1,12 +1,14 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: bom_unsorted.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> bom_unsorted.py:1:2 | 1 | import foo | _^ 2 | | import bar + | |___________^ | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__case_sensitive_case_sensitive.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__case_sensitive_case_sensitive.py.snap index 214840d48a..0f34db4435 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__case_sensitive_case_sensitive.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__case_sensitive_case_sensitive.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: case_sensitive.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> case_sensitive.py:1:1 | 1 | / import A 2 | | import B @@ -13,6 +14,7 @@ error[I001]: case_sensitive.py:1:1: [*] Import block is un-sorted or un-formatte 7 | | import f 8 | | from g import a, B, c 9 | | from h import A, b, C + | |______________________^ | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__closest_to_furthest_relative_imports_order.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__closest_to_furthest_relative_imports_order.py.snap index 1348ccb4fa..bedf1be84d 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__closest_to_furthest_relative_imports_order.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__closest_to_furthest_relative_imports_order.py.snap @@ -1,12 +1,14 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: relative_imports_order.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> relative_imports_order.py:1:1 | 1 | / from ... import a 2 | | from .. import b 3 | | from . import c + | |________________^ | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__combine_as_imports.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__combine_as_imports.py.snap index 0999139977..1ab5613305 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__combine_as_imports.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__combine_as_imports.py.snap @@ -1,13 +1,15 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: combine_as_imports.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> combine_as_imports.py:1:1 | 1 | / from module import Class as C 2 | | from module import CONSTANT 3 | | from module import function 4 | | from module import function as f + | |_________________________________^ | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__combine_as_imports_combine_as_imports.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__combine_as_imports_combine_as_imports.py.snap index 62bea3aab3..054cb5b28f 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__combine_as_imports_combine_as_imports.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__combine_as_imports_combine_as_imports.py.snap @@ -1,13 +1,15 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: combine_as_imports.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> combine_as_imports.py:1:1 | 1 | / from module import Class as C 2 | | from module import CONSTANT 3 | | from module import function 4 | | from module import function as f + | |_________________________________^ | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__combine_import_from.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__combine_import_from.py.snap index 4e0b4463b8..e5dd6efd3c 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__combine_import_from.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__combine_import_from.py.snap @@ -1,14 +1,16 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: combine_import_from.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> combine_import_from.py:1:1 | 1 | / from collections import Awaitable 2 | | from collections import AsyncIterable 3 | | from collections import Collection 4 | | from collections import ChainMap 5 | | from collections import MutableSequence, MutableMapping + | |________________________________________________________^ | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__comments.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__comments.py.snap index bf8613b54b..2bbf87b61a 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__comments.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__comments.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: comments.py:3:1: [*] Import block is un-sorted or un-formatted +error[I001]: 3:1: [*] Import block is un-sorted or un-formatted + --> comments.py:2:12 | 1 | # Comment 1 2 | # Comment 2 @@ -37,6 +38,7 @@ error[I001]: comments.py:3:1: [*] Import block is un-sorted or un-formatted 31 | | 32 | | from F import a # Comment 1 33 | | from F import b + | |________________^ | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__deduplicate_imports.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__deduplicate_imports.py.snap index 030699c3a8..c2190c831c 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__deduplicate_imports.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__deduplicate_imports.py.snap @@ -1,13 +1,15 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: deduplicate_imports.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> deduplicate_imports.py:1:1 | 1 | / import os 2 | | import os 3 | | import os as os1 4 | | import os as os2 + | |_________________^ | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__detect_same_package.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__detect_same_package.snap index aca5393b21..fa1ce8a1e2 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__detect_same_package.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__detect_same_package.snap @@ -1,12 +1,14 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: bar.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> bar.py:1:1 | 1 | / import os 2 | | import pandas 3 | | import foo.baz + | |_______________^ | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__fit_line_length.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__fit_line_length.py.snap index 16742df308..41282ace6e 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__fit_line_length.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__fit_line_length.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: fit_line_length.py:7:1: [*] Import block is un-sorted or un-formatted +error[I001]: 7:1: [*] Import block is un-sorted or un-formatted + --> fit_line_length.py:6:13 | 6 | if indented: 7 | / from line_with_88 import aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa @@ -13,6 +14,7 @@ error[I001]: fit_line_length.py:7:1: [*] Import block is un-sorted or un-formatt 12 | | from line_with_93 import ( 13 | | aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, 14 | | ) + | |______^ | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__fit_line_length_comment.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__fit_line_length_comment.py.snap index 82d4db8946..6e24023074 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__fit_line_length_comment.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__fit_line_length_comment.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: fit_line_length_comment.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> fit_line_length_comment.py:1:1 | 1 | / import a 2 | | # Don't take this comment into account when determining whether the next import can fit on one line. @@ -12,6 +13,7 @@ error[I001]: fit_line_length_comment.py:1:1: [*] Import block is un-sorted or un 6 | | from f import g # 012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ 7 | | # The next import doesn't fit on one line. 8 | | from h import i # 012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9 + | |__________________________________________________________________________________________^ | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__force_single_line_force_single_line.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__force_single_line_force_single_line.py.snap index ebc4beee59..1106722a4c 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__force_single_line_force_single_line.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__force_single_line_force_single_line.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: force_single_line.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> force_single_line.py:1:1 | 1 | / import sys, math 2 | | from os import path, uname @@ -31,6 +32,7 @@ error[I001]: force_single_line.py:1:1: [*] Import block is un-sorted or un-forma 25 | | 26 | | # comment 9 27 | | from baz import * # comment 10 + | |________________________________^ | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__force_sort_within_sections.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__force_sort_within_sections.py.snap index e1b008b380..cd85de641f 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__force_sort_within_sections.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__force_sort_within_sections.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: force_sort_within_sections.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> force_sort_within_sections.py:1:1 | 1 | / from a import a1 # import_from 2 | | from c import * # import_from_star @@ -17,6 +18,7 @@ error[I001]: force_sort_within_sections.py:1:1: [*] Import block is un-sorted or 11 | | from . import my 12 | | from .my.nested import fn2 13 | | from ...grandparent import fn3 + | |_______________________________^ | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__force_sort_within_sections_force_sort_within_sections.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__force_sort_within_sections_force_sort_within_sections.py.snap index 77221a92b2..29bd2298f2 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__force_sort_within_sections_force_sort_within_sections.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__force_sort_within_sections_force_sort_within_sections.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: force_sort_within_sections.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> force_sort_within_sections.py:1:1 | 1 | / from a import a1 # import_from 2 | | from c import * # import_from_star @@ -17,6 +18,7 @@ error[I001]: force_sort_within_sections.py:1:1: [*] Import block is un-sorted or 11 | | from . import my 12 | | from .my.nested import fn2 13 | | from ...grandparent import fn3 + | |_______________________________^ | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__force_sort_within_sections_force_sort_within_sections_future.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__force_sort_within_sections_force_sort_within_sections_future.py.snap index 2c0616e8b9..b916345dc6 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__force_sort_within_sections_force_sort_within_sections_future.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__force_sort_within_sections_force_sort_within_sections_future.py.snap @@ -1,11 +1,13 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: force_sort_within_sections_future.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> force_sort_within_sections_future.py:1:1 | 1 | / import __future__ 2 | | from __future__ import annotations + | |___________________________________^ | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__force_sort_within_sections_force_sort_within_sections_with_as_names.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__force_sort_within_sections_force_sort_within_sections_with_as_names.py.snap index 318d0d0aaf..6395ceb32d 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__force_sort_within_sections_force_sort_within_sections_with_as_names.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__force_sort_within_sections_force_sort_within_sections_with_as_names.py.snap @@ -1,14 +1,16 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: force_sort_within_sections_with_as_names.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> force_sort_within_sections_with_as_names.py:1:1 | 1 | / import encodings 2 | | from datetime import timezone as tz 3 | | from datetime import timedelta 4 | | import datetime as dt 5 | | import datetime + | |________________^ | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__force_to_top.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__force_to_top.py.snap index 26792157e7..14932ecf90 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__force_to_top.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__force_to_top.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: force_to_top.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> force_to_top.py:1:1 | 1 | / import lib6 2 | | import lib2 @@ -27,6 +28,7 @@ error[I001]: force_to_top.py:1:1: [*] Import block is un-sorted or un-formatted 21 | | import lib3.lib4.lib5 22 | | from lib3.lib4 import foo 23 | | from lib3.lib4.lib5 import foo + | |_______________________________^ | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__force_to_top_force_to_top.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__force_to_top_force_to_top.py.snap index 17eac9d093..a6124f44c2 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__force_to_top_force_to_top.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__force_to_top_force_to_top.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: force_to_top.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> force_to_top.py:1:1 | 1 | / import lib6 2 | | import lib2 @@ -27,6 +28,7 @@ error[I001]: force_to_top.py:1:1: [*] Import block is un-sorted or un-formatted 21 | | import lib3.lib4.lib5 22 | | from lib3.lib4 import foo 23 | | from lib3.lib4.lib5 import foo + | |_______________________________^ | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__force_wrap_aliases.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__force_wrap_aliases.py.snap index 28e1d80059..ceed28e44f 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__force_wrap_aliases.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__force_wrap_aliases.py.snap @@ -1,12 +1,14 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: force_wrap_aliases.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> force_wrap_aliases.py:1:1 | 1 | / from .a import a1 as a1, a2 as a2 2 | | from .b import b1 as b1 3 | | from .c import c1 + | |__________________^ | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__force_wrap_aliases_force_wrap_aliases.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__force_wrap_aliases_force_wrap_aliases.py.snap index 7dec4e70e7..d70a1a46ff 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__force_wrap_aliases_force_wrap_aliases.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__force_wrap_aliases_force_wrap_aliases.py.snap @@ -1,12 +1,14 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: force_wrap_aliases.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> force_wrap_aliases.py:1:1 | 1 | / from .a import a1 as a1, a2 as a2 2 | | from .b import b1 as b1 3 | | from .c import c1 + | |__________________^ | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__forced_separate.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__forced_separate.py.snap index d546fc6a58..026dcb7543 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__forced_separate.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__forced_separate.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: forced_separate.py:3:1: [*] Import block is un-sorted or un-formatted +error[I001]: 3:1: [*] Import block is un-sorted or un-formatted + --> forced_separate.py:2:67 | 1 | # office_helper and tests are both first-party, 2 | # but we want tests and experiments to be separated, in that order @@ -12,6 +13,7 @@ error[I001]: forced_separate.py:3:1: [*] Import block is un-sorted or un-formatt 6 | | from experiments.starry import * 7 | | from experiments.weird import varieties 8 | | from office_helper.assistants import entity_registry as er + | |___________________________________________________________^ | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__future_from.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__future_from.py.snap index 8015135201..c71d17db80 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__future_from.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__future_from.py.snap @@ -1,11 +1,13 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: future_from.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> future_from.py:1:1 | 1 | / import __future__ 2 | | from __future__ import annotations + | |___________________________________^ | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__glob_1_separate_subpackage_first_and_third_party_imports.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__glob_1_separate_subpackage_first_and_third_party_imports.py.snap index cd0648eea7..fae07fabf9 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__glob_1_separate_subpackage_first_and_third_party_imports.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__glob_1_separate_subpackage_first_and_third_party_imports.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: separate_subpackage_first_and_third_party_imports.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> separate_subpackage_first_and_third_party_imports.py:1:1 | 1 | / import sys 2 | | import baz @@ -12,6 +13,7 @@ error[I001]: separate_subpackage_first_and_third_party_imports.py:1:1: [*] Impor 6 | | import foo 7 | | import foo.bar 8 | | import foo.bar.baz + | |___________________^ | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__if_elif_else.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__if_elif_else.py.snap index 890c4eaf20..c8f2a8a3a5 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__if_elif_else.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__if_elif_else.py.snap @@ -1,13 +1,15 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: if_elif_else.py:6:1: [*] Import block is un-sorted or un-formatted +error[I001]: 6:1: [*] Import block is un-sorted or un-formatted + --> if_elif_else.py:5:6 | 4 | from setuptools.command.sdist import sdist as _sdist 5 | else: 6 | / from setuptools.command.sdist import sdist as _sdist 7 | | from distutils.command.sdist import sdist as _sdist + | |________________________________________________________^ | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__import_from_after_import.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__import_from_after_import.py.snap index 797a94577e..0e14e31301 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__import_from_after_import.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__import_from_after_import.py.snap @@ -1,11 +1,13 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: import_from_after_import.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> import_from_after_import.py:1:1 | 1 | / from collections import Collection 2 | | import os + | |__________^ | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__inline_comments.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__inline_comments.py.snap index c4e6c74818..da7092895b 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__inline_comments.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__inline_comments.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: inline_comments.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> inline_comments.py:1:1 | 1 | / from a.prometheus.metrics import ( # type:ignore[attr-defined] 2 | | TERMINAL_CURRENTLY_RUNNING_TOTAL, @@ -15,6 +16,7 @@ error[I001]: inline_comments.py:1:1: [*] Import block is un-sorted or un-formatt 9 | | from c.prometheus.metrics import TERMINAL_CURRENTLY_RUNNING_TOTAL # type:ignore[attr-defined] 10 | | 11 | | from d.prometheus.metrics import TERMINAL_CURRENTLY_RUNNING_TOTAL, OTHER_RUNNING_TOTAL # type:ignore[attr-defined] + | |____________________________________________________________________________________________________________________^ | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__insert_empty_lines.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__insert_empty_lines.py.snap index 028d922464..352b6df8aa 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__insert_empty_lines.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__insert_empty_lines.py.snap @@ -1,13 +1,14 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: insert_empty_lines.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> insert_empty_lines.py:1:1 | 1 | / import a 2 | | import b -3 | | x = 1 - | |_^ + | |_________^ +3 | x = 1 4 | import os 5 | import sys | @@ -20,15 +21,16 @@ error[I001]: insert_empty_lines.py:1:1: [*] Import block is un-sorted or un-form 4 5 | import os 5 6 | import sys -error[I001]: insert_empty_lines.py:4:1: [*] Import block is un-sorted or un-formatted +error[I001]: 4:1: [*] Import block is un-sorted or un-formatted + --> insert_empty_lines.py:3:6 | 2 | import b 3 | x = 1 4 | / import os 5 | | import sys -6 | | def f(): - | |_^ + | |___________^ +6 | def f(): 7 | pass 8 | if True: | @@ -43,15 +45,16 @@ error[I001]: insert_empty_lines.py:4:1: [*] Import block is un-sorted or un-form 7 9 | pass 8 10 | if True: -error[I001]: insert_empty_lines.py:14:1: [*] Import block is un-sorted or un-formatted +error[I001]: 14:1: [*] Import block is un-sorted or un-formatted + --> insert_empty_lines.py:13:6 | 12 | class X: pass 13 | y = 1 14 | / import os 15 | | import sys -16 | | """Docstring""" - | |_^ + | |___________^ +16 | """Docstring""" 17 | 18 | if True: | @@ -65,13 +68,14 @@ error[I001]: insert_empty_lines.py:14:1: [*] Import block is un-sorted or un-for 17 18 | 18 19 | if True: -error[I001]: insert_empty_lines.py:52:1: [*] Import block is un-sorted or un-formatted +error[I001]: 52:1: [*] Import block is un-sorted or un-formatted + --> insert_empty_lines.py:52:1 | 52 | / import os 53 | | -54 | | # Comment goes here. - | |_^ + | |__^ +54 | # Comment goes here. 55 | def f(): 56 | pass | diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__insert_empty_lines.pyi.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__insert_empty_lines.pyi.snap index ffd9ddf878..615bd3ce26 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__insert_empty_lines.pyi.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__insert_empty_lines.pyi.snap @@ -1,13 +1,14 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: insert_empty_lines.pyi:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> insert_empty_lines.pyi:1:1 | 1 | / import a 2 | | import b -3 | | x = 1 - | |_^ + | |_________^ +3 | x = 1 4 | import os 5 | import sys | @@ -20,15 +21,16 @@ error[I001]: insert_empty_lines.pyi:1:1: [*] Import block is un-sorted or un-for 4 5 | import os 5 6 | import sys -error[I001]: insert_empty_lines.pyi:4:1: [*] Import block is un-sorted or un-formatted +error[I001]: 4:1: [*] Import block is un-sorted or un-formatted + --> insert_empty_lines.pyi:3:6 | 2 | import b 3 | x = 1 4 | / import os 5 | | import sys -6 | | def f(): - | |_^ + | |___________^ +6 | def f(): 7 | pass 8 | if True: | @@ -42,15 +44,16 @@ error[I001]: insert_empty_lines.pyi:4:1: [*] Import block is un-sorted or un-for 7 8 | pass 8 9 | if True: -error[I001]: insert_empty_lines.pyi:14:1: [*] Import block is un-sorted or un-formatted +error[I001]: 14:1: [*] Import block is un-sorted or un-formatted + --> insert_empty_lines.pyi:13:6 | 12 | class X: pass 13 | y = 1 14 | / import os 15 | | import sys -16 | | """Docstring""" - | |_^ + | |___________^ +16 | """Docstring""" 17 | 18 | if True: | diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__known_local_folder_closest_separate_local_folder_imports.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__known_local_folder_closest_separate_local_folder_imports.py.snap index 3d65aec3ad..a94bcfc38c 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__known_local_folder_closest_separate_local_folder_imports.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__known_local_folder_closest_separate_local_folder_imports.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: separate_local_folder_imports.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> separate_local_folder_imports.py:1:1 | 1 | / import sys 2 | | import ruff @@ -11,6 +12,7 @@ error[I001]: separate_local_folder_imports.py:1:1: [*] Import block is un-sorted 5 | | from . import leading_prefix 6 | | from .. import trailing_prefix 7 | | from ruff import check + | |_______________________^ | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__known_local_folder_separate_local_folder_imports.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__known_local_folder_separate_local_folder_imports.py.snap index 8b0300097b..38360ef031 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__known_local_folder_separate_local_folder_imports.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__known_local_folder_separate_local_folder_imports.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: separate_local_folder_imports.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> separate_local_folder_imports.py:1:1 | 1 | / import sys 2 | | import ruff @@ -11,6 +12,7 @@ error[I001]: separate_local_folder_imports.py:1:1: [*] Import block is un-sorted 5 | | from . import leading_prefix 6 | | from .. import trailing_prefix 7 | | from ruff import check + | |_______________________^ | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__leading_prefix.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__leading_prefix.py.snap index 6aa7a94eaf..1b004baf0f 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__leading_prefix.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__leading_prefix.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: leading_prefix.py:1:8: Import block is un-sorted or un-formatted +error[I001]: 1:8: Import block is un-sorted or un-formatted + --> leading_prefix.py:1:8 | 1 | x = 1; import sys | ________^ @@ -12,8 +13,9 @@ error[I001]: leading_prefix.py:1:8: Import block is un-sorted or un-formatted 4 | if True: | = help: Organize imports -error[I001]: leading_prefix.py:5:12: Import block is un-sorted or un-formatted +error[I001]: 5:12: Import block is un-sorted or un-formatted + --> leading_prefix.py:5:12 | 4 | if True: 5 | x = 1; import sys @@ -24,8 +26,9 @@ error[I001]: leading_prefix.py:5:12: Import block is un-sorted or un-formatted 8 | if True: | = help: Organize imports -error[I001]: leading_prefix.py:10:9: Import block is un-sorted or un-formatted +error[I001]: 10:9: Import block is un-sorted or un-formatted + --> leading_prefix.py:10:9 | 8 | if True: 9 | x = 1; \ @@ -35,8 +38,9 @@ error[I001]: leading_prefix.py:10:9: Import block is un-sorted or un-formatted 12 | x = 1; \ | = help: Organize imports -error[I001]: leading_prefix.py:13:1: Import block is un-sorted or un-formatted +error[I001]: 13:1: Import block is un-sorted or un-formatted + --> leading_prefix.py:12:9 | 12 | x = 1; \ 13 | import os diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__length_sort__length_sort_from_imports.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__length_sort__length_sort_from_imports.py.snap index 4bd502803e..142cea3d9e 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__length_sort__length_sort_from_imports.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__length_sort__length_sort_from_imports.py.snap @@ -1,12 +1,14 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: length_sort_from_imports.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> length_sort_from_imports.py:1:1 | 1 | / from mediuuuuuuuuuuum import a 2 | | from short import b 3 | | from loooooooooooooooooooooog import c + | |_______________________________________^ | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__length_sort__length_sort_non_ascii_members.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__length_sort__length_sort_non_ascii_members.py.snap index 63746f281a..40e133712b 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__length_sort__length_sort_non_ascii_members.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__length_sort__length_sort_non_ascii_members.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: length_sort_non_ascii_members.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> length_sort_non_ascii_members.py:1:1 | 1 | / from module1 import ( 2 | | loooooooooooooong, @@ -15,6 +16,7 @@ error[I001]: length_sort_non_ascii_members.py:1:1: [*] Import block is un-sorted 9 | | mediuuuuuum, 10 | | λοοοοοοοοοοοοοονγ, 11 | | ) + | |__^ | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__length_sort__length_sort_non_ascii_modules.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__length_sort__length_sort_non_ascii_modules.py.snap index 36864e1e88..b24d0ad9bc 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__length_sort__length_sort_non_ascii_modules.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__length_sort__length_sort_non_ascii_modules.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: length_sort_non_ascii_modules.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> length_sort_non_ascii_modules.py:1:1 | 1 | / import loooooooooooooong 2 | | import mediuuuuuum @@ -13,6 +14,7 @@ error[I001]: length_sort_non_ascii_modules.py:1:1: [*] Import block is un-sorted 7 | | import λοοοοοοοοοοοοοονγ 8 | | import μεδιυυυυυμ 9 | | import looooooooooooooong + | |__________________________^ | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__length_sort__length_sort_straight_and_from_imports.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__length_sort__length_sort_straight_and_from_imports.py.snap index ebb1922b2c..0b3e8bd069 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__length_sort__length_sort_straight_and_from_imports.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__length_sort__length_sort_straight_and_from_imports.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: length_sort_straight_and_from_imports.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> length_sort_straight_and_from_imports.py:1:1 | 1 | / import mediuuuuuum 2 | | import short @@ -10,6 +11,7 @@ error[I001]: length_sort_straight_and_from_imports.py:1:1: [*] Import block is u 4 | | from looooooooooooooong import a 5 | | from mediuuuum import c 6 | | from short import b + | |____________________^ | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__length_sort__length_sort_straight_imports.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__length_sort__length_sort_straight_imports.py.snap index 7171e46897..084f3b69f2 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__length_sort__length_sort_straight_imports.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__length_sort__length_sort_straight_imports.py.snap @@ -1,13 +1,15 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: length_sort_straight_imports.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> length_sort_straight_imports.py:1:1 | 1 | / import mediuuuuuumb 2 | | import short 3 | | import looooooooooooooooong 4 | | import mediuuuuuuma + | |____________________^ | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__length_sort__length_sort_with_relative_imports.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__length_sort__length_sort_with_relative_imports.py.snap index e0ef2022c2..61211829e7 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__length_sort__length_sort_with_relative_imports.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__length_sort__length_sort_with_relative_imports.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: length_sort_with_relative_imports.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> length_sort_with_relative_imports.py:1:1 | 1 | / from ..looooooooooooooong import a 2 | | from ...mediuuuum import b @@ -11,6 +12,7 @@ error[I001]: length_sort_with_relative_imports.py:1:1: [*] Import block is un-so 5 | | from . import d 6 | | from .mediuuuum import a 7 | | from ......short import b + | |__________________________^ | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__length_sort_straight__length_sort_from_imports.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__length_sort_straight__length_sort_from_imports.py.snap index 9d8f3797f9..67351fcc53 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__length_sort_straight__length_sort_from_imports.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__length_sort_straight__length_sort_from_imports.py.snap @@ -1,12 +1,14 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: length_sort_from_imports.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> length_sort_from_imports.py:1:1 | 1 | / from mediuuuuuuuuuuum import a 2 | | from short import b 3 | | from loooooooooooooooooooooog import c + | |_______________________________________^ | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__length_sort_straight__length_sort_straight_and_from_imports.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__length_sort_straight__length_sort_straight_and_from_imports.py.snap index f5776dd6b8..99ad337ed1 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__length_sort_straight__length_sort_straight_and_from_imports.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__length_sort_straight__length_sort_straight_and_from_imports.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: length_sort_straight_and_from_imports.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> length_sort_straight_and_from_imports.py:1:1 | 1 | / import mediuuuuuum 2 | | import short @@ -10,6 +11,7 @@ error[I001]: length_sort_straight_and_from_imports.py:1:1: [*] Import block is u 4 | | from looooooooooooooong import a 5 | | from mediuuuum import c 6 | | from short import b + | |____________________^ | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__length_sort_straight__length_sort_straight_imports.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__length_sort_straight__length_sort_straight_imports.py.snap index 7171e46897..084f3b69f2 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__length_sort_straight__length_sort_straight_imports.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__length_sort_straight__length_sort_straight_imports.py.snap @@ -1,13 +1,15 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: length_sort_straight_imports.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> length_sort_straight_imports.py:1:1 | 1 | / import mediuuuuuumb 2 | | import short 3 | | import looooooooooooooooong 4 | | import mediuuuuuuma + | |____________________^ | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__line_ending_crlf.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__line_ending_crlf.py.snap index 633535949d..b5aa0d972e 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__line_ending_crlf.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__line_ending_crlf.py.snap @@ -1,12 +1,13 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: line_ending_crlf.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> line_ending_crlf.py:1:1 | -1 | / from long_module_name import member_one, member_two, member_three, member_four, member_five -2 | | - | |_^ +1 | from long_module_name import member_one, member_two, member_three, member_four, member_five + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +2 | | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__line_ending_lf.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__line_ending_lf.py.snap index 68f0c7ba6e..36882175cb 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__line_ending_lf.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__line_ending_lf.py.snap @@ -1,12 +1,13 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: line_ending_lf.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> line_ending_lf.py:1:1 | -1 | / from long_module_name import member_one, member_two, member_three, member_four, member_five -2 | | - | |_^ +1 | from long_module_name import member_one, member_two, member_three, member_four, member_five + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +2 | | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__lines_after_imports.pyi.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__lines_after_imports.pyi.snap index 7159774772..7283ac14e8 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__lines_after_imports.pyi.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__lines_after_imports.pyi.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: lines_after_imports.pyi:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> lines_after_imports.pyi:1:1 | 1 | / from __future__ import annotations 2 | | @@ -16,8 +17,8 @@ error[I001]: lines_after_imports.pyi:1:1: [*] Import block is un-sorted or un-fo 10 | | 11 | | 12 | | -13 | | class Thing(object): - | |_^ + | |__^ +13 | class Thing(object): 14 | name: str 15 | def __init__(self, name: str): | diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__lines_after_imports_class_after.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__lines_after_imports_class_after.py.snap index d9fdb94647..3ca60aa4cd 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__lines_after_imports_class_after.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__lines_after_imports_class_after.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: lines_after_imports_class_after.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> lines_after_imports_class_after.py:1:1 | 1 | / from __future__ import annotations 2 | | @@ -13,8 +14,8 @@ error[I001]: lines_after_imports_class_after.py:1:1: [*] Import block is un-sort 7 | | from my_first_party import my_first_party_object 8 | | 9 | | from . import my_local_folder_object -10 | | class Thing(object): - | |_^ + | |_____________________________________^ +10 | class Thing(object): 11 | name: str 12 | def __init__(self, name: str): | diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__lines_after_imports_func_after.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__lines_after_imports_func_after.py.snap index 0ec4e80ec1..3e2cbfc737 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__lines_after_imports_func_after.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__lines_after_imports_func_after.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: lines_after_imports_func_after.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> lines_after_imports_func_after.py:1:1 | 1 | / from __future__ import annotations 2 | | @@ -24,8 +25,8 @@ error[I001]: lines_after_imports_func_after.py:1:1: [*] Import block is un-sorte 18 | | 19 | | 20 | | -21 | | def main(): - | |_^ + | |__^ +21 | def main(): 22 | my_local_folder_object.get() | = help: Organize imports diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__lines_after_imports_lines_after_imports.pyi.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__lines_after_imports_lines_after_imports.pyi.snap index 7159774772..7283ac14e8 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__lines_after_imports_lines_after_imports.pyi.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__lines_after_imports_lines_after_imports.pyi.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: lines_after_imports.pyi:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> lines_after_imports.pyi:1:1 | 1 | / from __future__ import annotations 2 | | @@ -16,8 +17,8 @@ error[I001]: lines_after_imports.pyi:1:1: [*] Import block is un-sorted or un-fo 10 | | 11 | | 12 | | -13 | | class Thing(object): - | |_^ + | |__^ +13 | class Thing(object): 14 | name: str 15 | def __init__(self, name: str): | diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__lines_after_imports_lines_after_imports_class_after.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__lines_after_imports_lines_after_imports_class_after.py.snap index 6838d03e0c..4fe7da5a5d 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__lines_after_imports_lines_after_imports_class_after.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__lines_after_imports_lines_after_imports_class_after.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: lines_after_imports_class_after.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> lines_after_imports_class_after.py:1:1 | 1 | / from __future__ import annotations 2 | | @@ -13,8 +14,8 @@ error[I001]: lines_after_imports_class_after.py:1:1: [*] Import block is un-sort 7 | | from my_first_party import my_first_party_object 8 | | 9 | | from . import my_local_folder_object -10 | | class Thing(object): - | |_^ + | |_____________________________________^ +10 | class Thing(object): 11 | name: str 12 | def __init__(self, name: str): | diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__lines_after_imports_lines_after_imports_func_after.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__lines_after_imports_lines_after_imports_func_after.py.snap index 9f16af0b81..c56f46c5c1 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__lines_after_imports_lines_after_imports_func_after.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__lines_after_imports_lines_after_imports_func_after.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: lines_after_imports_func_after.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> lines_after_imports_func_after.py:1:1 | 1 | / from __future__ import annotations 2 | | @@ -24,8 +25,8 @@ error[I001]: lines_after_imports_func_after.py:1:1: [*] Import block is un-sorte 18 | | 19 | | 20 | | -21 | | def main(): - | |_^ + | |__^ +21 | def main(): 22 | my_local_folder_object.get() | = help: Organize imports diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__lines_after_imports_lines_after_imports_nothing_after.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__lines_after_imports_lines_after_imports_nothing_after.py.snap index 6ce0a37708..4218766ff7 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__lines_after_imports_lines_after_imports_nothing_after.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__lines_after_imports_lines_after_imports_nothing_after.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: lines_after_imports_nothing_after.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> lines_after_imports_nothing_after.py:1:1 | 1 | / from __future__ import annotations 2 | | @@ -13,6 +14,7 @@ error[I001]: lines_after_imports_nothing_after.py:1:1: [*] Import block is un-so 7 | | from my_first_party import my_first_party_object 8 | | 9 | | from . import my_local_folder_object + | |_____________________________________^ | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__lines_between_typeslines_between_types.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__lines_between_typeslines_between_types.py.snap index 1fe1867667..c3a8ee2527 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__lines_between_typeslines_between_types.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__lines_between_typeslines_between_types.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: lines_between_types.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> lines_between_types.py:1:1 | 1 | / from __future__ import annotations 2 | | @@ -20,6 +21,7 @@ error[I001]: lines_between_types.py:1:1: [*] Import block is un-sorted or un-for 14 | | 15 | | from . import config 16 | | from .data import Data + | |_______________________^ | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__magic_trailing_comma.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__magic_trailing_comma.py.snap index c441caeb51..326623986d 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__magic_trailing_comma.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__magic_trailing_comma.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: magic_trailing_comma.py:2:1: [*] Import block is un-sorted or un-formatted +error[I001]: 2:1: [*] Import block is un-sorted or un-formatted + --> magic_trailing_comma.py:1:80 | 1 | # This has a magic trailing comma, will be sorted, but not rolled into one line 2 | / from sys import ( @@ -42,6 +43,7 @@ error[I001]: magic_trailing_comma.py:2:1: [*] Import block is un-sorted or un-fo 36 | | from module2 import ( 37 | | member3, 38 | | ) + | |__^ | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__match_case.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__match_case.py.snap index 2de75eb01f..dbc9996569 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__match_case.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__match_case.py.snap @@ -1,15 +1,16 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: match_case.py:3:1: [*] Import block is un-sorted or un-formatted +error[I001]: 3:1: [*] Import block is un-sorted or un-formatted + --> match_case.py:2:12 | 1 | match 1: 2 | case 1: 3 | / import sys 4 | | import os -5 | | case 2: - | |_^ + | |__________________^ +5 | case 2: 6 | import collections 7 | import abc | @@ -24,13 +25,15 @@ error[I001]: match_case.py:3:1: [*] Import block is un-sorted or un-formatted 6 6 | import collections 7 7 | import abc -error[I001]: match_case.py:6:1: [*] Import block is un-sorted or un-formatted +error[I001]: 6:1: [*] Import block is un-sorted or un-formatted + --> match_case.py:5:12 | 4 | import os 5 | case 2: 6 | / import collections 7 | | import abc + | |___________________^ | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__natural_order.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__natural_order.py.snap index 0393a91240..c3d25a3fe1 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__natural_order.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__natural_order.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: natural_order.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> natural_order.py:1:1 | 1 | / import numpy1 2 | | import numpy10 @@ -20,6 +21,7 @@ error[I001]: natural_order.py:1:1: [*] Import block is un-sorted or un-formatted 14 | | uint32, 15 | | uint64, 16 | | ) + | |__^ | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__no_detect_same_package.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__no_detect_same_package.snap index b37079ac92..e48b3415c6 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__no_detect_same_package.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__no_detect_same_package.snap @@ -1,12 +1,14 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: bar.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> bar.py:1:1 | 1 | / import os 2 | | import pandas 3 | | import foo.baz + | |_______________^ | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__no_lines_before.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__no_lines_before.py.snap index f4545257ae..782f5b657f 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__no_lines_before.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__no_lines_before.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: no_lines_before.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> no_lines_before.py:1:1 | 1 | / from __future__ import annotations 2 | | @@ -13,6 +14,7 @@ error[I001]: no_lines_before.py:1:1: [*] Import block is un-sorted or un-formatt 7 | | from my_first_party import my_first_party_object 8 | | 9 | | from . import my_local_folder_object + | |_____________________________________^ | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__no_lines_before.py_no_lines_before.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__no_lines_before.py_no_lines_before.py.snap index ce2f5c8f90..7598ad4713 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__no_lines_before.py_no_lines_before.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__no_lines_before.py_no_lines_before.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: no_lines_before.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> no_lines_before.py:1:1 | 1 | / from __future__ import annotations 2 | | @@ -13,6 +14,7 @@ error[I001]: no_lines_before.py:1:1: [*] Import block is un-sorted or un-formatt 7 | | from my_first_party import my_first_party_object 8 | | 9 | | from . import my_local_folder_object + | |_____________________________________^ | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__no_lines_before_with_empty_sections.py_no_lines_before_with_empty_sections.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__no_lines_before_with_empty_sections.py_no_lines_before_with_empty_sections.py.snap index 57b2eff7a9..5f6339c4b6 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__no_lines_before_with_empty_sections.py_no_lines_before_with_empty_sections.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__no_lines_before_with_empty_sections.py_no_lines_before_with_empty_sections.py.snap @@ -1,12 +1,14 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: no_lines_before_with_empty_sections.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> no_lines_before_with_empty_sections.py:1:1 | 1 | / from __future__ import annotations 2 | | from typing import Any 3 | | from . import my_local_folder_object + | |_____________________________________^ | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__no_standard_library_no_standard_library.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__no_standard_library_no_standard_library.py.snap index f5e3aba9d1..a246adbe5b 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__no_standard_library_no_standard_library.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__no_standard_library_no_standard_library.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: no_standard_library.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> no_standard_library.py:1:1 | 1 | / from __future__ import annotations 2 | | @@ -13,6 +14,7 @@ error[I001]: no_standard_library.py:1:1: [*] Import block is un-sorted or un-for 7 | | 8 | | from . import local 9 | | import sys + | |___________^ | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__no_wrap_star.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__no_wrap_star.py.snap index 991bac4c52..382e9578cd 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__no_wrap_star.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__no_wrap_star.py.snap @@ -1,10 +1,12 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: no_wrap_star.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> no_wrap_star.py:1:1 | -1 | / from .subscription import * # type: ignore # some very long comment explaining why this needs a type ignore +1 | from .subscription import * # type: ignore # some very long comment explaining why this needs a type ignore + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__order_by_type.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__order_by_type.py.snap index c9d9d6b110..6144f02522 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__order_by_type.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__order_by_type.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: order_by_type.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> order_by_type.py:1:1 | 1 | / import StringIO 2 | | import glob @@ -16,6 +17,7 @@ error[I001]: order_by_type.py:1:1: [*] Import block is un-sorted or un-formatted 10 | | import FOO 11 | | import BAR 12 | | import bar + | |___________^ | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__order_by_type_false_order_by_type.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__order_by_type_false_order_by_type.py.snap index 1ba85f06c7..cd82df3e51 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__order_by_type_false_order_by_type.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__order_by_type_false_order_by_type.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: order_by_type.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> order_by_type.py:1:1 | 1 | / import StringIO 2 | | import glob @@ -16,6 +17,7 @@ error[I001]: order_by_type.py:1:1: [*] Import block is un-sorted or un-formatted 10 | | import FOO 11 | | import BAR 12 | | import bar + | |___________^ | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__order_by_type_with_custom_classes.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__order_by_type_with_custom_classes.py.snap index 04906355e3..c427d84d43 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__order_by_type_with_custom_classes.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__order_by_type_with_custom_classes.py.snap @@ -1,13 +1,15 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: order_by_type_with_custom_classes.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> order_by_type_with_custom_classes.py:1:1 | 1 | / from sklearn.svm import func, SVC, CONST, Klass 2 | | from subprocess import N_CLASS, PIPE, Popen, STDOUT 3 | | from module import CLASS, Class, CONSTANT, function, BASIC, Apple 4 | | from torch.nn import SELU, AClass, A_CONSTANT + | |______________________________________________^ | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__order_by_type_with_custom_classes_order_by_type_with_custom_classes.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__order_by_type_with_custom_classes_order_by_type_with_custom_classes.py.snap index c83a7102e2..245962fcd9 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__order_by_type_with_custom_classes_order_by_type_with_custom_classes.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__order_by_type_with_custom_classes_order_by_type_with_custom_classes.py.snap @@ -1,13 +1,15 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: order_by_type_with_custom_classes.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> order_by_type_with_custom_classes.py:1:1 | 1 | / from sklearn.svm import func, SVC, CONST, Klass 2 | | from subprocess import N_CLASS, PIPE, Popen, STDOUT 3 | | from module import CLASS, Class, CONSTANT, function, BASIC, Apple 4 | | from torch.nn import SELU, AClass, A_CONSTANT + | |______________________________________________^ | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__order_by_type_with_custom_constants.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__order_by_type_with_custom_constants.py.snap index c55d5fdc89..b5170a2331 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__order_by_type_with_custom_constants.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__order_by_type_with_custom_constants.py.snap @@ -1,11 +1,13 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: order_by_type_with_custom_constants.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> order_by_type_with_custom_constants.py:1:1 | 1 | / from sklearn.svm import XYZ, func, variable, Const, Klass, constant 2 | | from subprocess import First, var, func, Class, konst, A_constant, Last, STDOUT + | |________________________________________________________________________________^ | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__order_by_type_with_custom_constants_order_by_type_with_custom_constants.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__order_by_type_with_custom_constants_order_by_type_with_custom_constants.py.snap index 3073ff856f..5b5ed3bce6 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__order_by_type_with_custom_constants_order_by_type_with_custom_constants.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__order_by_type_with_custom_constants_order_by_type_with_custom_constants.py.snap @@ -1,11 +1,13 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: order_by_type_with_custom_constants.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> order_by_type_with_custom_constants.py:1:1 | 1 | / from sklearn.svm import XYZ, func, variable, Const, Klass, constant 2 | | from subprocess import First, var, func, Class, konst, A_constant, Last, STDOUT + | |________________________________________________________________________________^ | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__order_by_type_with_custom_variables.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__order_by_type_with_custom_variables.py.snap index f98cb3e41d..59b808009c 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__order_by_type_with_custom_variables.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__order_by_type_with_custom_variables.py.snap @@ -1,11 +1,13 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: order_by_type_with_custom_variables.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> order_by_type_with_custom_variables.py:1:1 | 1 | / from sklearn.svm import VAR, Class, MyVar, CONST, abc 2 | | from subprocess import utils, var_ABC, Variable, Klass, CONSTANT, exe + | |______________________________________________________________________^ | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__order_by_type_with_custom_variables_order_by_type_with_custom_variables.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__order_by_type_with_custom_variables_order_by_type_with_custom_variables.py.snap index faaa4785e2..74fd45a52c 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__order_by_type_with_custom_variables_order_by_type_with_custom_variables.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__order_by_type_with_custom_variables_order_by_type_with_custom_variables.py.snap @@ -1,11 +1,13 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: order_by_type_with_custom_variables.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> order_by_type_with_custom_variables.py:1:1 | 1 | / from sklearn.svm import VAR, Class, MyVar, CONST, abc 2 | | from subprocess import utils, var_ABC, Variable, Klass, CONSTANT, exe + | |______________________________________________________________________^ | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__order_relative_imports_by_level.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__order_relative_imports_by_level.py.snap index d079f749af..eda7494c95 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__order_relative_imports_by_level.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__order_relative_imports_by_level.py.snap @@ -1,13 +1,15 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: order_relative_imports_by_level.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> order_relative_imports_by_level.py:1:1 | 1 | / from .a import a 2 | | from ..a import a 3 | | from ..b import a 4 | | from .b import a + | |_________________^ | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__preserve_comment_order.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__preserve_comment_order.py.snap index 059c2b0472..100d05a9c7 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__preserve_comment_order.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__preserve_comment_order.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: preserve_comment_order.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> preserve_comment_order.py:1:1 | 1 | / import io 2 | | # Old MacDonald had a farm, @@ -15,6 +16,7 @@ error[I001]: preserve_comment_order.py:1:1: [*] Import block is un-sorted or un- 9 | | # EIEIO 10 | | from errno import EIO 11 | | import abc + | |___________^ | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__preserve_import_star.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__preserve_import_star.py.snap index 34a0077e24..ff6e7cb9a0 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__preserve_import_star.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__preserve_import_star.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: preserve_import_star.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> preserve_import_star.py:1:1 | 1 | / from some_other_module import some_class 2 | | from some_other_module import * @@ -10,6 +11,7 @@ error[I001]: preserve_import_star.py:1:1: [*] Import block is un-sorted or un-fo 4 | | from some_module import some_class # Aside 5 | | # Above 6 | | from some_module import * # Aside + | |___________________________________^ | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__preserve_indentation.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__preserve_indentation.py.snap index 6fc6659bdd..c961723218 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__preserve_indentation.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__preserve_indentation.py.snap @@ -1,14 +1,15 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: preserve_indentation.py:2:1: [*] Import block is un-sorted or un-formatted +error[I001]: 2:1: [*] Import block is un-sorted or un-formatted + --> preserve_indentation.py:1:9 | 1 | if True: 2 | / import sys 3 | | import os -4 | | else: - | |_^ + | |______________^ +4 | else: 5 | import sys 6 | import os | @@ -22,13 +23,15 @@ error[I001]: preserve_indentation.py:2:1: [*] Import block is un-sorted or un-fo 5 5 | import sys 6 6 | import os -error[I001]: preserve_indentation.py:5:1: [*] Import block is un-sorted or un-formatted +error[I001]: 5:1: [*] Import block is un-sorted or un-formatted + --> preserve_indentation.py:4:6 | 3 | import os 4 | else: 5 | / import sys 6 | | import os + | |______________^ | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__propagate_inline_comments_propagate_inline_comments.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__propagate_inline_comments_propagate_inline_comments.py.snap index 693fa1d243..774f850e08 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__propagate_inline_comments_propagate_inline_comments.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__propagate_inline_comments_propagate_inline_comments.py.snap @@ -1,13 +1,15 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: propagate_inline_comments.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> propagate_inline_comments.py:1:1 | 1 | / from mypackage.subpackage import ( # long comment that seems to be a problem 2 | | a_long_variable_name_that_causes_problems, 3 | | items, 4 | | ) + | |__^ | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__reorder_within_section.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__reorder_within_section.py.snap index f2b10cc718..04a7e7eef6 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__reorder_within_section.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__reorder_within_section.py.snap @@ -1,11 +1,13 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: reorder_within_section.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> reorder_within_section.py:1:1 | 1 | / import sys 2 | | import os + | |__________^ | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_comment.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_comment.py.snap index 313ec7cbb4..815957d349 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_comment.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_comment.py.snap @@ -1,7 +1,8 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -comment.py:1:1: I002 [*] Missing required import: `from __future__ import annotations` +error[I002]: 1:1: [*] Missing required import: `from __future__ import annotations` + ℹ Safe fix 1 1 | #!/usr/bin/env python3 2 |+from __future__ import annotations diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_comments_and_newlines.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_comments_and_newlines.py.snap index c5d92854a2..25a45a83bd 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_comments_and_newlines.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_comments_and_newlines.py.snap @@ -1,7 +1,8 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -comments_and_newlines.py:1:1: I002 [*] Missing required import: `from __future__ import annotations` +error[I002]: 1:1: [*] Missing required import: `from __future__ import annotations` + ℹ Safe fix 2 2 | # A copyright notice could go here 3 3 | diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_docstring.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_docstring.py.snap index 4a51354685..8c7523c005 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_docstring.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_docstring.py.snap @@ -1,7 +1,8 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -docstring.py:1:1: I002 [*] Missing required import: `from __future__ import annotations` +error[I002]: 1:1: [*] Missing required import: `from __future__ import annotations` + ℹ Safe fix 1 1 | """Hello, world!""" 2 |+from __future__ import annotations diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_docstring_with_continuation.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_docstring_with_continuation.py.snap index c48ef63610..67a49588af 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_docstring_with_continuation.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_docstring_with_continuation.py.snap @@ -1,7 +1,8 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -docstring_with_continuation.py:1:1: I002 [*] Missing required import: `from __future__ import annotations` +error[I002]: 1:1: [*] Missing required import: `from __future__ import annotations` + ℹ Safe fix 1 |-"""Hello, world!"""; x = \ 1 |+"""Hello, world!"""; from __future__ import annotations; x = \ diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_docstring_with_semicolon.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_docstring_with_semicolon.py.snap index dfd35beb25..2af40c391c 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_docstring_with_semicolon.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_docstring_with_semicolon.py.snap @@ -1,7 +1,8 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -docstring_with_semicolon.py:1:1: I002 [*] Missing required import: `from __future__ import annotations` +error[I002]: 1:1: [*] Missing required import: `from __future__ import annotations` + ℹ Safe fix 1 |-"""Hello, world!"""; x = 1 1 |+"""Hello, world!"""; from __future__ import annotations; x = 1 diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_existing_import.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_existing_import.py.snap index 12ff6dbd5c..b1c6ae038e 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_existing_import.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_existing_import.py.snap @@ -1,7 +1,8 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -existing_import.py:1:1: I002 [*] Missing required import: `from __future__ import annotations` +error[I002]: 1:1: [*] Missing required import: `from __future__ import annotations` + ℹ Safe fix 1 |+from __future__ import annotations 1 2 | from __future__ import generator_stop diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_multiline_docstring.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_multiline_docstring.py.snap index 18e6b94876..02d6351b9c 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_multiline_docstring.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_multiline_docstring.py.snap @@ -1,7 +1,8 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -multiline_docstring.py:1:1: I002 [*] Missing required import: `from __future__ import annotations` +error[I002]: 1:1: [*] Missing required import: `from __future__ import annotations` + ℹ Safe fix 1 1 | """a 2 2 | b""" diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_off.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_off.py.snap index 5107b91290..b9fb4fc34a 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_off.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_off.py.snap @@ -1,7 +1,8 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -off.py:1:1: I002 [*] Missing required import: `from __future__ import annotations` +error[I002]: 1:1: [*] Missing required import: `from __future__ import annotations` + ℹ Safe fix 1 1 | # isort: off 2 |+from __future__ import annotations diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_unused.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_unused.py.snap index 0d79276e0e..66b7dacfaa 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_unused.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_unused.py.snap @@ -1,16 +1,17 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -unused.py:5:8: F401 [*] `sys` imported but unused +error[F401]: 5:8: [*] `sys` imported but unused + + --> unused.py:5:8 | 4 | # Unused, _not_ marked as required. 5 | import sys - | ^^^ F401 + | ^^^ 6 | 7 | # Unused, _not_ marked as required (due to the alias). | = help: Remove unused import: `sys` - ℹ Safe fix 2 2 | import os 3 3 | @@ -20,16 +21,17 @@ unused.py:5:8: F401 [*] `sys` imported but unused 7 6 | # Unused, _not_ marked as required (due to the alias). 8 7 | import pathlib as non_alias -unused.py:8:19: F401 [*] `pathlib` imported but unused +error[F401]: 8:19: [*] `pathlib` imported but unused + + --> unused.py:8:19 | 7 | # Unused, _not_ marked as required (due to the alias). 8 | import pathlib as non_alias - | ^^^^^^^^^ F401 + | ^^^^^^^^^ 9 | 10 | # Unused, marked as required. | = help: Remove unused import: `pathlib` - ℹ Safe fix 5 5 | import sys 6 6 | diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_with_alias_comment.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_with_alias_comment.py.snap index ea3f16c36b..8d7959b498 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_with_alias_comment.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_with_alias_comment.py.snap @@ -1,7 +1,8 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -comment.py:1:1: I002 [*] Missing required import: `from __future__ import annotations as _annotations` +error[I002]: 1:1: [*] Missing required import: `from __future__ import annotations as _annotations` + ℹ Safe fix 1 1 | #!/usr/bin/env python3 2 |+from __future__ import annotations as _annotations diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_with_alias_comments_and_newlines.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_with_alias_comments_and_newlines.py.snap index 509094af63..051dc49a90 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_with_alias_comments_and_newlines.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_with_alias_comments_and_newlines.py.snap @@ -1,7 +1,8 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -comments_and_newlines.py:1:1: I002 [*] Missing required import: `from __future__ import annotations as _annotations` +error[I002]: 1:1: [*] Missing required import: `from __future__ import annotations as _annotations` + ℹ Safe fix 2 2 | # A copyright notice could go here 3 3 | diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_with_alias_docstring.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_with_alias_docstring.py.snap index 21c36c4e30..4814ef15e3 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_with_alias_docstring.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_with_alias_docstring.py.snap @@ -1,7 +1,8 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -docstring.py:1:1: I002 [*] Missing required import: `from __future__ import annotations as _annotations` +error[I002]: 1:1: [*] Missing required import: `from __future__ import annotations as _annotations` + ℹ Safe fix 1 1 | """Hello, world!""" 2 |+from __future__ import annotations as _annotations diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_with_alias_docstring_with_continuation.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_with_alias_docstring_with_continuation.py.snap index 0a40adb35a..e748e183f4 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_with_alias_docstring_with_continuation.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_with_alias_docstring_with_continuation.py.snap @@ -1,7 +1,8 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -docstring_with_continuation.py:1:1: I002 [*] Missing required import: `from __future__ import annotations as _annotations` +error[I002]: 1:1: [*] Missing required import: `from __future__ import annotations as _annotations` + ℹ Safe fix 1 |-"""Hello, world!"""; x = \ 1 |+"""Hello, world!"""; from __future__ import annotations as _annotations; x = \ diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_with_alias_docstring_with_semicolon.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_with_alias_docstring_with_semicolon.py.snap index 3c61e64a8b..c029834b6f 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_with_alias_docstring_with_semicolon.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_with_alias_docstring_with_semicolon.py.snap @@ -1,7 +1,8 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -docstring_with_semicolon.py:1:1: I002 [*] Missing required import: `from __future__ import annotations as _annotations` +error[I002]: 1:1: [*] Missing required import: `from __future__ import annotations as _annotations` + ℹ Safe fix 1 |-"""Hello, world!"""; x = 1 1 |+"""Hello, world!"""; from __future__ import annotations as _annotations; x = 1 diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_with_alias_existing_import.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_with_alias_existing_import.py.snap index 96e891413b..cc1933cdfe 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_with_alias_existing_import.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_with_alias_existing_import.py.snap @@ -1,7 +1,8 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -existing_import.py:1:1: I002 [*] Missing required import: `from __future__ import annotations as _annotations` +error[I002]: 1:1: [*] Missing required import: `from __future__ import annotations as _annotations` + ℹ Safe fix 1 |+from __future__ import annotations as _annotations 1 2 | from __future__ import generator_stop diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_with_alias_multiline_docstring.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_with_alias_multiline_docstring.py.snap index 6426ab3898..6f0eac44dc 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_with_alias_multiline_docstring.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_with_alias_multiline_docstring.py.snap @@ -1,7 +1,8 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -multiline_docstring.py:1:1: I002 [*] Missing required import: `from __future__ import annotations as _annotations` +error[I002]: 1:1: [*] Missing required import: `from __future__ import annotations as _annotations` + ℹ Safe fix 1 1 | """a 2 2 | b""" diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_with_alias_off.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_with_alias_off.py.snap index 4387774ddd..b996a8b63f 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_with_alias_off.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_with_alias_off.py.snap @@ -1,7 +1,8 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -off.py:1:1: I002 [*] Missing required import: `from __future__ import annotations as _annotations` +error[I002]: 1:1: [*] Missing required import: `from __future__ import annotations as _annotations` + ℹ Safe fix 1 1 | # isort: off 2 |+from __future__ import annotations as _annotations diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_imports_docstring.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_imports_docstring.py.snap index d65d89b703..385e0746f9 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_imports_docstring.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_imports_docstring.py.snap @@ -1,14 +1,16 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -docstring.py:1:1: I002 [*] Missing required import: `from __future__ import annotations` +error[I002]: 1:1: [*] Missing required import: `from __future__ import annotations` + ℹ Safe fix 1 1 | """Hello, world!""" 2 |+from __future__ import annotations 2 3 | 3 4 | x = 1 -docstring.py:1:1: I002 [*] Missing required import: `from __future__ import generator_stop` +error[I002]: 1:1: [*] Missing required import: `from __future__ import generator_stop` + ℹ Safe fix 1 1 | """Hello, world!""" 2 |+from __future__ import generator_stop diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__section_order_sections.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__section_order_sections.py.snap index 3576871b72..45a8ddad19 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__section_order_sections.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__section_order_sections.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: sections.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> sections.py:1:1 | 1 | / from __future__ import annotations 2 | | import os @@ -11,6 +12,7 @@ error[I001]: sections.py:1:1: [*] Import block is un-sorted or un-formatted 5 | | import django.settings 6 | | from library import foo 7 | | from . import local + | |____________________^ | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__sections_main_first_party.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__sections_main_first_party.py.snap index 17f8ddd978..0c62438723 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__sections_main_first_party.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__sections_main_first_party.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: main_first_party.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> main_first_party.py:1:1 | 1 | / import os 2 | | @@ -11,8 +12,8 @@ error[I001]: main_first_party.py:1:1: [*] Import block is un-sorted or un-format 5 | | 6 | | import first_party 7 | | - 8 | | os.a - | |_^ + | |__^ + 8 | os.a 9 | third_party.a 10 | __main__.a | diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__sections_sections.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__sections_sections.py.snap index 46a476a725..413431212b 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__sections_sections.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__sections_sections.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: sections.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> sections.py:1:1 | 1 | / from __future__ import annotations 2 | | import os @@ -11,6 +12,7 @@ error[I001]: sections.py:1:1: [*] Import block is un-sorted or un-formatted 5 | | import django.settings 6 | | from library import foo 7 | | from . import local + | |____________________^ | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__separate_first_party_imports.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__separate_first_party_imports.py.snap index ba877bfbaf..76d584ad4a 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__separate_first_party_imports.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__separate_first_party_imports.py.snap @@ -1,14 +1,16 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: separate_first_party_imports.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> separate_first_party_imports.py:1:1 | 1 | / import sys 2 | | import leading_prefix 3 | | import numpy as np 4 | | import os 5 | | from leading_prefix import Class + | |_________________________________^ | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__separate_future_imports.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__separate_future_imports.py.snap index 9fb017ace2..de08f2cbfb 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__separate_future_imports.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__separate_future_imports.py.snap @@ -1,12 +1,14 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: separate_future_imports.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> separate_future_imports.py:1:1 | 1 | / import sys 2 | | import os 3 | | from __future__ import annotations + | |___________________________________^ | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__separate_local_folder_imports.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__separate_local_folder_imports.py.snap index cc3729f2f5..8749e43dba 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__separate_local_folder_imports.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__separate_local_folder_imports.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: separate_local_folder_imports.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> separate_local_folder_imports.py:1:1 | 1 | / import sys 2 | | import ruff @@ -11,6 +12,7 @@ error[I001]: separate_local_folder_imports.py:1:1: [*] Import block is un-sorted 5 | | from . import leading_prefix 6 | | from .. import trailing_prefix 7 | | from ruff import check + | |_______________________^ | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__separate_third_party_imports.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__separate_third_party_imports.py.snap index 76d1f98609..f6529ef857 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__separate_third_party_imports.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__separate_third_party_imports.py.snap @@ -1,13 +1,15 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: separate_third_party_imports.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> separate_third_party_imports.py:1:1 | 1 | / import pandas as pd 2 | | import sys 3 | | import numpy as np 4 | | import os + | |__________^ | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__skip.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__skip.py.snap index b23aa0dd36..ca635f0f92 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__skip.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__skip.py.snap @@ -1,15 +1,16 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: skip.py:20:1: [*] Import block is un-sorted or un-formatted +error[I001]: 20:1: [*] Import block is un-sorted or un-formatted + --> skip.py:19:29 | 18 | import sys 19 | import os # isort: skip 20 | / import collections 21 | | import abc -22 | | - | |_^ + | |_______________^ +22 | 23 | 24 | def f(): | @@ -25,15 +26,16 @@ error[I001]: skip.py:20:1: [*] Import block is un-sorted or un-formatted 23 23 | 24 24 | def f(): -error[I001]: skip.py:27:1: [*] Import block is un-sorted or un-formatted +error[I001]: 27:1: [*] Import block is un-sorted or un-formatted + --> skip.py:26:28 | 25 | import sys 26 | import os # isort:skip 27 | / import collections 28 | | import abc -29 | | - | |_^ + | |_______________^ +29 | 30 | 31 | def f(): | @@ -49,12 +51,14 @@ error[I001]: skip.py:27:1: [*] Import block is un-sorted or un-formatted 30 30 | 31 31 | def f(): -error[I001]: skip.py:34:1: [*] Import block is un-sorted or un-formatted +error[I001]: 34:1: [*] Import block is un-sorted or un-formatted + --> skip.py:33:54 | -32 | import sys; import os # isort:skip -33 | import sys; import os # isort:skip # isort:skip -34 | / import sys; import os +32 | import sys; import os # isort:skip +33 | import sys; import os # isort:skip # isort:skip +34 | import sys; import os + | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__sort_similar_imports.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__sort_similar_imports.py.snap index 286439fde7..83944cba1a 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__sort_similar_imports.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__sort_similar_imports.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: sort_similar_imports.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> sort_similar_imports.py:1:1 | 1 | / from a import b 2 | | from a import BAD as DEF @@ -30,6 +31,7 @@ error[I001]: sort_similar_imports.py:1:1: [*] Import block is un-sorted or un-fo 24 | | import x as Y 25 | | import x 26 | | import x as a + | |______________^ | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__split.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__split.py.snap index 69c3757cc1..0ed1be5324 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__split.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__split.py.snap @@ -1,14 +1,15 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: split.py:15:1: [*] Import block is un-sorted or un-formatted +error[I001]: 15:1: [*] Import block is un-sorted or un-formatted + --> split.py:14:9 | 14 | if True: 15 | / import C 16 | | import A -17 | | - | |_^ + | |_____________^ +17 | 18 | # isort: split | = help: Organize imports @@ -23,15 +24,16 @@ error[I001]: split.py:15:1: [*] Import block is un-sorted or un-formatted 18 18 | # isort: split 19 19 | -error[I001]: split.py:20:1: [*] Import block is un-sorted or un-formatted +error[I001]: 20:1: [*] Import block is un-sorted or un-formatted + --> split.py:19:1 | 18 | # isort: split 19 | 20 | / import D 21 | | import B -22 | | - | |_^ + | |_____________^ +22 | 23 | 24 | import e | @@ -47,13 +49,15 @@ error[I001]: split.py:20:1: [*] Import block is un-sorted or un-formatted 23 23 | 24 24 | import e -error[I001]: split.py:30:1: [*] Import block is un-sorted or un-formatted +error[I001]: 30:1: [*] Import block is un-sorted or un-formatted + --> split.py:29:1 | 28 | # isort: split 29 | 30 | / import d 31 | | import c + | |_________^ | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__split_on_trailing_comma_magic_trailing_comma.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__split_on_trailing_comma_magic_trailing_comma.py.snap index 1debd3102b..81dba153a0 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__split_on_trailing_comma_magic_trailing_comma.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__split_on_trailing_comma_magic_trailing_comma.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: magic_trailing_comma.py:2:1: [*] Import block is un-sorted or un-formatted +error[I001]: 2:1: [*] Import block is un-sorted or un-formatted + --> magic_trailing_comma.py:1:80 | 1 | # This has a magic trailing comma, will be sorted, but not rolled into one line 2 | / from sys import ( @@ -42,6 +43,7 @@ error[I001]: magic_trailing_comma.py:2:1: [*] Import block is un-sorted or un-fo 36 | | from module2 import ( 37 | | member3, 38 | | ) + | |__^ | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__star_before_others.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__star_before_others.py.snap index 24579fdd1d..8e49bc7a32 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__star_before_others.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__star_before_others.py.snap @@ -1,12 +1,14 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: star_before_others.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> star_before_others.py:1:1 | 1 | / from .logging import config_logging 2 | | from .settings import ENV 3 | | from .settings import * + | |________________________^ | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__straight_required_import_docstring.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__straight_required_import_docstring.py.snap index 6ce4357615..ed7b2209aa 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__straight_required_import_docstring.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__straight_required_import_docstring.py.snap @@ -1,7 +1,8 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -docstring.py:1:1: I002 [*] Missing required import: `import os` +error[I002]: 1:1: [*] Missing required import: `import os` + ℹ Safe fix 1 1 | """Hello, world!""" 2 |+import os diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__straight_required_import_docstring.pyi.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__straight_required_import_docstring.pyi.snap index 9c789cb79e..ed7b2209aa 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__straight_required_import_docstring.pyi.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__straight_required_import_docstring.pyi.snap @@ -1,7 +1,8 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -docstring.pyi:1:1: I002 [*] Missing required import: `import os` +error[I002]: 1:1: [*] Missing required import: `import os` + ℹ Safe fix 1 1 | """Hello, world!""" 2 |+import os diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__trailing_comment.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__trailing_comment.py.snap index 8a1f7e61d3..f646f14980 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__trailing_comment.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__trailing_comment.py.snap @@ -1,7 +1,9 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -trailing_comment.py:8:1: I001 [*] Import block is un-sorted or un-formatted +error[I001]: 8:1: [*] Import block is un-sorted or un-formatted + + --> trailing_comment.py:7:1 | 6 | pass 7 | @@ -12,13 +14,12 @@ trailing_comment.py:8:1: I001 [*] Import block is un-sorted or un-formatted 12 | | bar 13 | | )# some comment 14 | | -15 | | pass - | |_^ I001 + | |__^ +15 | pass 16 | 17 | from foo import ( | = help: Organize imports - ℹ Safe fix 5 5 | 6 6 | pass @@ -35,7 +36,9 @@ trailing_comment.py:8:1: I001 [*] Import block is un-sorted or un-formatted 15 14 | pass 16 15 | -trailing_comment.py:17:1: I001 [*] Import block is un-sorted or un-formatted +error[I001]: 17:1: [*] Import block is un-sorted or un-formatted + + --> trailing_comment.py:16:1 | 15 | pass 16 | @@ -48,13 +51,12 @@ trailing_comment.py:17:1: I001 [*] Import block is un-sorted or un-formatted 23 | | # some comment 24 | | ) 25 | | -26 | | pass - | |_^ I001 + | |__^ +26 | pass 27 | 28 | from mylib import ( | = help: Organize imports - ℹ Safe fix 14 14 | 15 15 | pass @@ -67,7 +69,9 @@ trailing_comment.py:17:1: I001 [*] Import block is un-sorted or un-formatted 21 19 | MyClient, 22 20 | MyMgmtClient, -trailing_comment.py:35:1: I001 [*] Import block is un-sorted or un-formatted +error[I001]: 35:1: [*] Import block is un-sorted or un-formatted + + --> trailing_comment.py:34:1 | 33 | pass 34 | @@ -76,13 +80,12 @@ trailing_comment.py:35:1: I001 [*] Import block is un-sorted or un-formatted 37 | | # some comment 38 | | ) 39 | | -40 | | pass - | |_^ I001 + | |__^ +40 | pass 41 | 42 | from mylib import ( | = help: Organize imports - ℹ Safe fix 32 32 | 33 33 | pass @@ -96,7 +99,9 @@ trailing_comment.py:35:1: I001 [*] Import block is un-sorted or un-formatted 40 37 | pass 41 38 | -trailing_comment.py:42:1: I001 [*] Import block is un-sorted or un-formatted +error[I001]: 42:1: [*] Import block is un-sorted or un-formatted + + --> trailing_comment.py:41:1 | 40 | pass 41 | @@ -105,13 +110,12 @@ trailing_comment.py:42:1: I001 [*] Import block is un-sorted or un-formatted 44 | | MyClient 45 | | ) 46 | | -47 | | pass - | |_^ I001 + | |__^ +47 | pass 48 | 49 | # a | = help: Organize imports - ℹ Safe fix 39 39 | 40 40 | pass @@ -125,7 +129,9 @@ trailing_comment.py:42:1: I001 [*] Import block is un-sorted or un-formatted 47 44 | pass 48 45 | -trailing_comment.py:50:1: I001 [*] Import block is un-sorted or un-formatted +error[I001]: 50:1: [*] Import block is un-sorted or un-formatted + + --> trailing_comment.py:49:4 | 49 | # a 50 | / from mylib import ( # b @@ -133,9 +139,9 @@ trailing_comment.py:50:1: I001 [*] Import block is un-sorted or un-formatted 52 | | MyClient # d 53 | | # e 54 | | ) # f + | |______^ | = help: Organize imports - ℹ Safe fix 47 47 | pass 48 48 | diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__trailing_suffix.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__trailing_suffix.py.snap index 09801ee416..b0f24b99cd 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__trailing_suffix.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__trailing_suffix.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: trailing_suffix.py:1:1: Import block is un-sorted or un-formatted +error[I001]: 1:1: Import block is un-sorted or un-formatted + --> trailing_suffix.py:1:1 | 1 | / import sys 2 | | import os; x = 1 @@ -11,8 +12,9 @@ error[I001]: trailing_suffix.py:1:1: Import block is un-sorted or un-formatted 4 | if True: | = help: Organize imports -error[I001]: trailing_suffix.py:5:5: Import block is un-sorted or un-formatted +error[I001]: 5:5: Import block is un-sorted or un-formatted + --> trailing_suffix.py:5:5 | 4 | if True: 5 | import sys diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__two_space.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__two_space.py.snap index 42305ed341..8c29b8702a 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__two_space.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__two_space.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: two_space.py:2:1: [*] Import block is un-sorted or un-formatted +error[I001]: 2:1: [*] Import block is un-sorted or un-formatted + --> two_space.py:1:111 | 1 | # If the file doesn't contain a logical indent token, we should still detect two-space indentation on imports. 2 | / from math import ( @@ -13,8 +14,8 @@ error[I001]: two_space.py:2:1: [*] Import block is un-sorted or un-formatted 7 | | pi, 8 | | ) 9 | | -10 | | del sin, cos, tan, pi, nan - | |_^ + | |__^ +10 | del sin, cos, tan, pi, nan | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__unicode.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__unicode.py.snap index f1340c990b..14d871da04 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__unicode.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__unicode.py.snap @@ -1,16 +1,17 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs --- -error[I001]: unicode.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> unicode.py:1:1 | 1 | / from astropy.constants import hbar as ℏ 2 | | from numpy import pi as π 3 | | import numpy as ℂℇℊℋℌℍℎℐℑℒℓℕℤΩℨKÅℬℭℯℰℱℹℴ 4 | | import numpy as CƐgHHHhIILlNZΩZKÅBCeEFio 5 | | -6 | | h = 2 * π * ℏ - | |_^ + | |__^ +6 | h = 2 * π * ℏ | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/mccabe/snapshots/ruff_linter__rules__mccabe__tests__max_complexity_0.snap b/crates/ruff_linter/src/rules/mccabe/snapshots/ruff_linter__rules__mccabe__tests__max_complexity_0.snap index fc461c6363..9d389fcbde 100644 --- a/crates/ruff_linter/src/rules/mccabe/snapshots/ruff_linter__rules__mccabe__tests__max_complexity_0.snap +++ b/crates/ruff_linter/src/rules/mccabe/snapshots/ruff_linter__rules__mccabe__tests__max_complexity_0.snap @@ -1,24 +1,27 @@ --- source: crates/ruff_linter/src/rules/mccabe/mod.rs --- -error[C901]: C901.py:2:5: `trivial` is too complex (1 > 0) +error[C901]: 2:5: `trivial` is too complex (1 > 0) + --> C901.py:2:5 | 1 | # Complexity = 1 2 | def trivial(): | ^^^^^^^ 3 | pass | -error[C901]: C901.py:7:5: `expr_as_statement` is too complex (1 > 0) +error[C901]: 7:5: `expr_as_statement` is too complex (1 > 0) + --> C901.py:7:5 | 6 | # Complexity = 1 7 | def expr_as_statement(): | ^^^^^^^^^^^^^^^^^ 8 | 0xF00D | -error[C901]: C901.py:12:5: `sequential` is too complex (1 > 0) +error[C901]: 12:5: `sequential` is too complex (1 > 0) + --> C901.py:12:5 | 11 | # Complexity = 1 12 | def sequential(n): @@ -26,8 +29,9 @@ error[C901]: C901.py:12:5: `sequential` is too complex (1 > 0) 13 | k = n + 4 14 | s = k + n | -error[C901]: C901.py:19:5: `if_elif_else_dead_path` is too complex (3 > 0) +error[C901]: 19:5: `if_elif_else_dead_path` is too complex (3 > 0) + --> C901.py:19:5 | 18 | # Complexity = 3 19 | def if_elif_else_dead_path(n): @@ -35,8 +39,9 @@ error[C901]: C901.py:19:5: `if_elif_else_dead_path` is too complex (3 > 0) 20 | if n > 3: 21 | return "bigger than three" | -error[C901]: C901.py:29:5: `nested_ifs` is too complex (3 > 0) +error[C901]: 29:5: `nested_ifs` is too complex (3 > 0) + --> C901.py:29:5 | 28 | # Complexity = 3 29 | def nested_ifs(): @@ -44,8 +49,9 @@ error[C901]: C901.py:29:5: `nested_ifs` is too complex (3 > 0) 30 | if n > 3: 31 | if n > 4: | -error[C901]: C901.py:40:5: `for_loop` is too complex (2 > 0) +error[C901]: 40:5: `for_loop` is too complex (2 > 0) + --> C901.py:40:5 | 39 | # Complexity = 2 40 | def for_loop(): @@ -53,8 +59,9 @@ error[C901]: C901.py:40:5: `for_loop` is too complex (2 > 0) 41 | for i in range(10): 42 | print(i) | -error[C901]: C901.py:46:5: `for_else` is too complex (2 > 0) +error[C901]: 46:5: `for_else` is too complex (2 > 0) + --> C901.py:46:5 | 45 | # Complexity = 2 46 | def for_else(mylist): @@ -62,8 +69,9 @@ error[C901]: C901.py:46:5: `for_else` is too complex (2 > 0) 47 | for i in mylist: 48 | print(i) | -error[C901]: C901.py:54:5: `recursive` is too complex (2 > 0) +error[C901]: 54:5: `recursive` is too complex (2 > 0) + --> C901.py:54:5 | 53 | # Complexity = 2 54 | def recursive(n): @@ -71,8 +79,9 @@ error[C901]: C901.py:54:5: `recursive` is too complex (2 > 0) 55 | if n > 4: 56 | return f(n - 1) | -error[C901]: C901.py:62:5: `nested_functions` is too complex (3 > 0) +error[C901]: 62:5: `nested_functions` is too complex (3 > 0) + --> C901.py:62:5 | 61 | # Complexity = 3 62 | def nested_functions(): @@ -80,8 +89,9 @@ error[C901]: C901.py:62:5: `nested_functions` is too complex (3 > 0) 63 | def a(): 64 | def b(): | -error[C901]: C901.py:63:9: `a` is too complex (2 > 0) +error[C901]: 63:9: `a` is too complex (2 > 0) + --> C901.py:63:9 | 61 | # Complexity = 3 62 | def nested_functions(): @@ -90,8 +100,9 @@ error[C901]: C901.py:63:9: `a` is too complex (2 > 0) 64 | def b(): 65 | pass | -error[C901]: C901.py:64:13: `b` is too complex (1 > 0) +error[C901]: 64:13: `b` is too complex (1 > 0) + --> C901.py:64:13 | 62 | def nested_functions(): 63 | def a(): @@ -99,8 +110,9 @@ error[C901]: C901.py:64:13: `b` is too complex (1 > 0) | ^ 65 | pass | -error[C901]: C901.py:73:5: `try_else` is too complex (4 > 0) +error[C901]: 73:5: `try_else` is too complex (4 > 0) + --> C901.py:73:5 | 72 | # Complexity = 4 73 | def try_else(): @@ -108,8 +120,9 @@ error[C901]: C901.py:73:5: `try_else` is too complex (4 > 0) 74 | try: 75 | print(1) | -error[C901]: C901.py:85:5: `nested_try_finally` is too complex (1 > 0) +error[C901]: 85:5: `nested_try_finally` is too complex (1 > 0) + --> C901.py:85:5 | 84 | # Complexity = 3 85 | def nested_try_finally(): @@ -117,8 +130,9 @@ error[C901]: C901.py:85:5: `nested_try_finally` is too complex (1 > 0) 86 | try: 87 | try: | -error[C901]: C901.py:96:11: `foobar` is too complex (3 > 0) +error[C901]: 96:11: `foobar` is too complex (3 > 0) + --> C901.py:96:11 | 95 | # Complexity = 3 96 | async def foobar(a, b, c): @@ -126,16 +140,18 @@ error[C901]: C901.py:96:11: `foobar` is too complex (3 > 0) 97 | await whatever(a, b, c) 98 | if await b: | -error[C901]: C901.py:107:5: `annotated_assign` is too complex (1 > 0) +error[C901]: 107:5: `annotated_assign` is too complex (1 > 0) + --> C901.py:107:5 | 106 | # Complexity = 1 107 | def annotated_assign(): | ^^^^^^^^^^^^^^^^ 108 | x: Any = None | -error[C901]: C901.py:113:9: `handle` is too complex (9 > 0) +error[C901]: 113:9: `handle` is too complex (9 > 0) + --> C901.py:113:9 | 111 | # Complexity = 9 112 | class Class: @@ -144,16 +160,18 @@ error[C901]: C901.py:113:9: `handle` is too complex (9 > 0) 114 | if args: 115 | return | -error[C901]: C901.py:118:17: `a` is too complex (1 > 0) +error[C901]: 118:17: `a` is too complex (1 > 0) + --> C901.py:118:17 | 117 | class ServiceProvider: 118 | def a(self): | ^ 119 | pass | -error[C901]: C901.py:121:17: `b` is too complex (2 > 0) +error[C901]: 121:17: `b` is too complex (2 > 0) + --> C901.py:121:17 | 119 | pass 120 | @@ -162,16 +180,18 @@ error[C901]: C901.py:121:17: `b` is too complex (2 > 0) 122 | if not args: 123 | pass | -error[C901]: C901.py:126:17: `c` is too complex (1 > 0) +error[C901]: 126:17: `c` is too complex (1 > 0) + --> C901.py:126:17 | 125 | class Logger: 126 | def c(*args, **kwargs): | ^ 127 | pass | -error[C901]: C901.py:129:17: `error` is too complex (1 > 0) +error[C901]: 129:17: `error` is too complex (1 > 0) + --> C901.py:129:17 | 127 | pass 128 | @@ -179,8 +199,9 @@ error[C901]: C901.py:129:17: `error` is too complex (1 > 0) | ^^^^^ 130 | pass | -error[C901]: C901.py:132:17: `info` is too complex (1 > 0) +error[C901]: 132:17: `info` is too complex (1 > 0) + --> C901.py:132:17 | 130 | pass 131 | @@ -188,8 +209,9 @@ error[C901]: C901.py:132:17: `info` is too complex (1 > 0) | ^^^^ 133 | pass | -error[C901]: C901.py:135:17: `exception` is too complex (1 > 0) +error[C901]: 135:17: `exception` is too complex (1 > 0) + --> C901.py:135:17 | 133 | pass 134 | diff --git a/crates/ruff_linter/src/rules/mccabe/snapshots/ruff_linter__rules__mccabe__tests__max_complexity_3.snap b/crates/ruff_linter/src/rules/mccabe/snapshots/ruff_linter__rules__mccabe__tests__max_complexity_3.snap index ffc63214e9..cb510f1310 100644 --- a/crates/ruff_linter/src/rules/mccabe/snapshots/ruff_linter__rules__mccabe__tests__max_complexity_3.snap +++ b/crates/ruff_linter/src/rules/mccabe/snapshots/ruff_linter__rules__mccabe__tests__max_complexity_3.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/mccabe/mod.rs --- -error[C901]: C901.py:73:5: `try_else` is too complex (4 > 3) +error[C901]: 73:5: `try_else` is too complex (4 > 3) + --> C901.py:73:5 | 72 | # Complexity = 4 73 | def try_else(): @@ -10,8 +11,9 @@ error[C901]: C901.py:73:5: `try_else` is too complex (4 > 3) 74 | try: 75 | print(1) | -error[C901]: C901.py:113:9: `handle` is too complex (9 > 3) +error[C901]: 113:9: `handle` is too complex (9 > 3) + --> C901.py:113:9 | 111 | # Complexity = 9 112 | class Class: diff --git a/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy-deprecated-function_NPY003.py.snap b/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy-deprecated-function_NPY003.py.snap index 64204b5974..3594469512 100644 --- a/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy-deprecated-function_NPY003.py.snap +++ b/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy-deprecated-function_NPY003.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/numpy/mod.rs --- -error[NPY003]: NPY003.py:4:5: [*] `np.round_` is deprecated; use `np.round` instead +error[NPY003]: 4:5: [*] `np.round_` is deprecated; use `np.round` instead + --> NPY003.py:4:5 | 2 | import numpy as np 3 | @@ -22,8 +23,9 @@ error[NPY003]: NPY003.py:4:5: [*] `np.round_` is deprecated; use `np.round` inst 6 6 | np.cumproduct(np.random.rand(5, 5)) 7 7 | np.sometrue(np.random.rand(5, 5)) -error[NPY003]: NPY003.py:5:5: [*] `np.product` is deprecated; use `np.prod` instead +error[NPY003]: 5:5: [*] `np.product` is deprecated; use `np.prod` instead + --> NPY003.py:5:5 | 4 | np.round_(np.random.rand(5, 5), 2) 5 | np.product(np.random.rand(5, 5)) @@ -42,8 +44,9 @@ error[NPY003]: NPY003.py:5:5: [*] `np.product` is deprecated; use `np.prod` inst 7 7 | np.sometrue(np.random.rand(5, 5)) 8 8 | np.alltrue(np.random.rand(5, 5)) -error[NPY003]: NPY003.py:6:5: [*] `np.cumproduct` is deprecated; use `np.cumprod` instead +error[NPY003]: 6:5: [*] `np.cumproduct` is deprecated; use `np.cumprod` instead + --> NPY003.py:6:5 | 4 | np.round_(np.random.rand(5, 5), 2) 5 | np.product(np.random.rand(5, 5)) @@ -63,8 +66,9 @@ error[NPY003]: NPY003.py:6:5: [*] `np.cumproduct` is deprecated; use `np.cumprod 8 8 | np.alltrue(np.random.rand(5, 5)) 9 9 | -error[NPY003]: NPY003.py:7:5: [*] `np.sometrue` is deprecated; use `np.any` instead +error[NPY003]: 7:5: [*] `np.sometrue` is deprecated; use `np.any` instead + --> NPY003.py:7:5 | 5 | np.product(np.random.rand(5, 5)) 6 | np.cumproduct(np.random.rand(5, 5)) @@ -83,8 +87,9 @@ error[NPY003]: NPY003.py:7:5: [*] `np.sometrue` is deprecated; use `np.any` inst 9 9 | 10 10 | -error[NPY003]: NPY003.py:8:5: [*] `np.alltrue` is deprecated; use `np.all` instead +error[NPY003]: 8:5: [*] `np.alltrue` is deprecated; use `np.all` instead + --> NPY003.py:8:5 | 6 | np.cumproduct(np.random.rand(5, 5)) 7 | np.sometrue(np.random.rand(5, 5)) @@ -102,8 +107,9 @@ error[NPY003]: NPY003.py:8:5: [*] `np.alltrue` is deprecated; use `np.all` inste 10 10 | 11 11 | def func(): -error[NPY003]: NPY003.py:14:5: [*] `np.round_` is deprecated; use `np.round` instead +error[NPY003]: 14:5: [*] `np.round_` is deprecated; use `np.round` instead + --> NPY003.py:14:5 | 12 | from numpy import round_, product, cumproduct, sometrue, alltrue 13 | @@ -128,8 +134,9 @@ error[NPY003]: NPY003.py:14:5: [*] `np.round_` is deprecated; use `np.round` ins 16 17 | cumproduct(np.random.rand(5, 5)) 17 18 | sometrue(np.random.rand(5, 5)) -error[NPY003]: NPY003.py:15:5: [*] `np.product` is deprecated; use `np.prod` instead +error[NPY003]: 15:5: [*] `np.product` is deprecated; use `np.prod` instead + --> NPY003.py:15:5 | 14 | round_(np.random.rand(5, 5), 2) 15 | product(np.random.rand(5, 5)) @@ -153,8 +160,9 @@ error[NPY003]: NPY003.py:15:5: [*] `np.product` is deprecated; use `np.prod` ins 17 18 | sometrue(np.random.rand(5, 5)) 18 19 | alltrue(np.random.rand(5, 5)) -error[NPY003]: NPY003.py:16:5: [*] `np.cumproduct` is deprecated; use `np.cumprod` instead +error[NPY003]: 16:5: [*] `np.cumproduct` is deprecated; use `np.cumprod` instead + --> NPY003.py:16:5 | 14 | round_(np.random.rand(5, 5), 2) 15 | product(np.random.rand(5, 5)) @@ -178,8 +186,9 @@ error[NPY003]: NPY003.py:16:5: [*] `np.cumproduct` is deprecated; use `np.cumpro 17 18 | sometrue(np.random.rand(5, 5)) 18 19 | alltrue(np.random.rand(5, 5)) -error[NPY003]: NPY003.py:17:5: [*] `np.sometrue` is deprecated; use `np.any` instead +error[NPY003]: 17:5: [*] `np.sometrue` is deprecated; use `np.any` instead + --> NPY003.py:17:5 | 15 | product(np.random.rand(5, 5)) 16 | cumproduct(np.random.rand(5, 5)) @@ -201,8 +210,9 @@ error[NPY003]: NPY003.py:17:5: [*] `np.sometrue` is deprecated; use `np.any` ins 18 |+ any(np.random.rand(5, 5)) 18 19 | alltrue(np.random.rand(5, 5)) -error[NPY003]: NPY003.py:18:5: [*] `np.alltrue` is deprecated; use `np.all` instead +error[NPY003]: 18:5: [*] `np.alltrue` is deprecated; use `np.all` instead + --> NPY003.py:18:5 | 16 | cumproduct(np.random.rand(5, 5)) 17 | sometrue(np.random.rand(5, 5)) diff --git a/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy-deprecated-type-alias_NPY001.py.snap b/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy-deprecated-type-alias_NPY001.py.snap index 6af2e8eac1..82b3e38f89 100644 --- a/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy-deprecated-type-alias_NPY001.py.snap +++ b/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy-deprecated-type-alias_NPY001.py.snap @@ -1,15 +1,16 @@ --- source: crates/ruff_linter/src/rules/numpy/mod.rs --- -NPY001.py:6:1: NPY001 [*] Type alias `np.float` is deprecated, replace with builtin type +error[NPY001]: 6:1: [*] Type alias `np.float` is deprecated, replace with builtin type + + --> NPY001.py:5:8 | 5 | # Error 6 | npy.float - | ^^^^^^^^^ NPY001 + | ^^^^^^^^^ 7 | npy.int | = help: Replace `np.float` with builtin type - ℹ Safe fix 3 3 | import numpy 4 4 | @@ -20,17 +21,18 @@ NPY001.py:6:1: NPY001 [*] Type alias `np.float` is deprecated, replace with buil 8 8 | 9 9 | if dtype == np.object: -NPY001.py:7:1: NPY001 [*] Type alias `np.int` is deprecated, replace with builtin type +error[NPY001]: 7:1: [*] Type alias `np.int` is deprecated, replace with builtin type + + --> NPY001.py:6:10 | 5 | # Error 6 | npy.float 7 | npy.int - | ^^^^^^^ NPY001 + | ^^^^^^^ 8 | 9 | if dtype == np.object: | = help: Replace `np.int` with builtin type - ℹ Safe fix 4 4 | 5 5 | # Error @@ -41,16 +43,17 @@ NPY001.py:7:1: NPY001 [*] Type alias `np.int` is deprecated, replace with builti 9 9 | if dtype == np.object: 10 10 | ... -NPY001.py:9:13: NPY001 [*] Type alias `np.object` is deprecated, replace with builtin type +error[NPY001]: 9:13: [*] Type alias `np.object` is deprecated, replace with builtin type + + --> NPY001.py:9:13 | 7 | npy.int 8 | 9 | if dtype == np.object: - | ^^^^^^^^^ NPY001 + | ^^^^^^^^^ 10 | ... | = help: Replace `np.object` with builtin type - ℹ Safe fix 6 6 | npy.float 7 7 | npy.int @@ -61,17 +64,18 @@ NPY001.py:9:13: NPY001 [*] Type alias `np.object` is deprecated, replace with bu 11 11 | 12 12 | result = result.select_dtypes([np.byte, np.ubyte, np.short, np.ushort, np.int, np.complex]) -NPY001.py:12:72: NPY001 [*] Type alias `np.int` is deprecated, replace with builtin type +error[NPY001]: 12:72: [*] Type alias `np.int` is deprecated, replace with builtin type + + --> NPY001.py:12:72 | 10 | ... 11 | 12 | result = result.select_dtypes([np.byte, np.ubyte, np.short, np.ushort, np.int, np.complex]) - | ^^^^^^ NPY001 + | ^^^^^^ 13 | 14 | pdf = pd.DataFrame( | = help: Replace `np.int` with builtin type - ℹ Safe fix 9 9 | if dtype == np.object: 10 10 | ... @@ -82,17 +86,18 @@ NPY001.py:12:72: NPY001 [*] Type alias `np.int` is deprecated, replace with buil 14 14 | pdf = pd.DataFrame( 15 15 | data=[[1, 2, 3]], -NPY001.py:12:80: NPY001 [*] Type alias `np.complex` is deprecated, replace with builtin type +error[NPY001]: 12:80: [*] Type alias `np.complex` is deprecated, replace with builtin type + + --> NPY001.py:12:80 | 10 | ... 11 | 12 | result = result.select_dtypes([np.byte, np.ubyte, np.short, np.ushort, np.int, np.complex]) - | ^^^^^^^^^^ NPY001 + | ^^^^^^^^^^ 13 | 14 | pdf = pd.DataFrame( | = help: Replace `np.complex` with builtin type - ℹ Safe fix 9 9 | if dtype == np.object: 10 10 | ... @@ -103,16 +108,17 @@ NPY001.py:12:80: NPY001 [*] Type alias `np.complex` is deprecated, replace with 14 14 | pdf = pd.DataFrame( 15 15 | data=[[1, 2, 3]], -NPY001.py:17:11: NPY001 [*] Type alias `np.object` is deprecated, replace with builtin type +error[NPY001]: 17:11: [*] Type alias `np.object` is deprecated, replace with builtin type + + --> NPY001.py:17:11 | 15 | data=[[1, 2, 3]], 16 | columns=["a", "b", "c"], 17 | dtype=numpy.object, - | ^^^^^^^^^^^^ NPY001 + | ^^^^^^^^^^^^ 18 | ) | = help: Replace `np.object` with builtin type - ℹ Safe fix 14 14 | pdf = pd.DataFrame( 15 15 | data=[[1, 2, 3]], @@ -123,17 +129,18 @@ NPY001.py:17:11: NPY001 [*] Type alias `np.object` is deprecated, replace with b 19 19 | 20 20 | _ = arr.astype(np.int) -NPY001.py:20:16: NPY001 [*] Type alias `np.int` is deprecated, replace with builtin type +error[NPY001]: 20:16: [*] Type alias `np.int` is deprecated, replace with builtin type + + --> NPY001.py:20:16 | 18 | ) 19 | 20 | _ = arr.astype(np.int) - | ^^^^^^ NPY001 + | ^^^^^^ 21 | 22 | # Regression test for: https://github.com/astral-sh/ruff/issues/6952 | = help: Replace `np.int` with builtin type - ℹ Safe fix 17 17 | dtype=numpy.object, 18 18 | ) @@ -144,15 +151,16 @@ NPY001.py:20:16: NPY001 [*] Type alias `np.int` is deprecated, replace with buil 22 22 | # Regression test for: https://github.com/astral-sh/ruff/issues/6952 23 23 | from numpy import float -NPY001.py:25:1: NPY001 [*] Type alias `np.float` is deprecated, replace with builtin type +error[NPY001]: 25:1: [*] Type alias `np.float` is deprecated, replace with builtin type + + --> NPY001.py:24:1 | 23 | from numpy import float 24 | 25 | float(1) - | ^^^^^ NPY001 + | ^^^^^ | = help: Replace `np.float` with builtin type - ℹ Safe fix 21 21 | 22 22 | # Regression test for: https://github.com/astral-sh/ruff/issues/6952 diff --git a/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy-legacy-random_NPY002.py.snap b/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy-legacy-random_NPY002.py.snap index 71a6360568..c91e52fc54 100644 --- a/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy-legacy-random_NPY002.py.snap +++ b/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy-legacy-random_NPY002.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/numpy/mod.rs --- -error[NPY002]: NPY002.py:12:8: Replace legacy `np.random.standard_normal` call with `np.random.Generator` +error[NPY002]: 12:8: Replace legacy `np.random.standard_normal` call with `np.random.Generator` + --> NPY002.py:12:8 | 10 | from numpy import random 11 | @@ -11,16 +12,18 @@ error[NPY002]: NPY002.py:12:8: Replace legacy `np.random.standard_normal` call w 13 | more_vals = random.standard_normal(10) 14 | numbers = random.integers(high, size=5) | -error[NPY002]: NPY002.py:13:13: Replace legacy `np.random.standard_normal` call with `np.random.Generator` +error[NPY002]: 13:13: Replace legacy `np.random.standard_normal` call with `np.random.Generator` + --> NPY002.py:13:13 | 12 | vals = random.standard_normal(10) 13 | more_vals = random.standard_normal(10) | ^^^^^^^^^^^^^^^^^^^^^^ 14 | numbers = random.integers(high, size=5) | -error[NPY002]: NPY002.py:18:1: Replace legacy `np.random.seed` call with `np.random.Generator` +error[NPY002]: 18:1: Replace legacy `np.random.seed` call with `np.random.Generator` + --> NPY002.py:17:1 | 16 | import numpy 17 | @@ -29,8 +32,9 @@ error[NPY002]: NPY002.py:18:1: Replace legacy `np.random.seed` call with `np.ran 19 | numpy.random.get_state() 20 | numpy.random.set_state() | -error[NPY002]: NPY002.py:19:1: Replace legacy `np.random.get_state` call with `np.random.Generator` +error[NPY002]: 19:1: Replace legacy `np.random.get_state` call with `np.random.Generator` + --> NPY002.py:18:20 | 18 | numpy.random.seed() 19 | numpy.random.get_state() @@ -38,8 +42,9 @@ error[NPY002]: NPY002.py:19:1: Replace legacy `np.random.get_state` call with `n 20 | numpy.random.set_state() 21 | numpy.random.rand() | -error[NPY002]: NPY002.py:20:1: Replace legacy `np.random.set_state` call with `np.random.Generator` +error[NPY002]: 20:1: Replace legacy `np.random.set_state` call with `np.random.Generator` + --> NPY002.py:19:25 | 18 | numpy.random.seed() 19 | numpy.random.get_state() @@ -48,8 +53,9 @@ error[NPY002]: NPY002.py:20:1: Replace legacy `np.random.set_state` call with `n 21 | numpy.random.rand() 22 | numpy.random.ranf() | -error[NPY002]: NPY002.py:21:1: Replace legacy `np.random.rand` call with `np.random.Generator` +error[NPY002]: 21:1: Replace legacy `np.random.rand` call with `np.random.Generator` + --> NPY002.py:20:25 | 19 | numpy.random.get_state() 20 | numpy.random.set_state() @@ -58,8 +64,9 @@ error[NPY002]: NPY002.py:21:1: Replace legacy `np.random.rand` call with `np.ran 22 | numpy.random.ranf() 23 | numpy.random.sample() | -error[NPY002]: NPY002.py:22:1: Replace legacy `np.random.ranf` call with `np.random.Generator` +error[NPY002]: 22:1: Replace legacy `np.random.ranf` call with `np.random.Generator` + --> NPY002.py:21:20 | 20 | numpy.random.set_state() 21 | numpy.random.rand() @@ -68,8 +75,9 @@ error[NPY002]: NPY002.py:22:1: Replace legacy `np.random.ranf` call with `np.ran 23 | numpy.random.sample() 24 | numpy.random.randn() | -error[NPY002]: NPY002.py:23:1: Replace legacy `np.random.sample` call with `np.random.Generator` +error[NPY002]: 23:1: Replace legacy `np.random.sample` call with `np.random.Generator` + --> NPY002.py:22:20 | 21 | numpy.random.rand() 22 | numpy.random.ranf() @@ -78,8 +86,9 @@ error[NPY002]: NPY002.py:23:1: Replace legacy `np.random.sample` call with `np.r 24 | numpy.random.randn() 25 | numpy.random.randint() | -error[NPY002]: NPY002.py:24:1: Replace legacy `np.random.randn` call with `np.random.Generator` +error[NPY002]: 24:1: Replace legacy `np.random.randn` call with `np.random.Generator` + --> NPY002.py:23:22 | 22 | numpy.random.ranf() 23 | numpy.random.sample() @@ -88,8 +97,9 @@ error[NPY002]: NPY002.py:24:1: Replace legacy `np.random.randn` call with `np.ra 25 | numpy.random.randint() 26 | numpy.random.random() | -error[NPY002]: NPY002.py:25:1: Replace legacy `np.random.randint` call with `np.random.Generator` +error[NPY002]: 25:1: Replace legacy `np.random.randint` call with `np.random.Generator` + --> NPY002.py:24:21 | 23 | numpy.random.sample() 24 | numpy.random.randn() @@ -98,8 +108,9 @@ error[NPY002]: NPY002.py:25:1: Replace legacy `np.random.randint` call with `np. 26 | numpy.random.random() 27 | numpy.random.random_integers() | -error[NPY002]: NPY002.py:26:1: Replace legacy `np.random.random` call with `np.random.Generator` +error[NPY002]: 26:1: Replace legacy `np.random.random` call with `np.random.Generator` + --> NPY002.py:25:23 | 24 | numpy.random.randn() 25 | numpy.random.randint() @@ -108,8 +119,9 @@ error[NPY002]: NPY002.py:26:1: Replace legacy `np.random.random` call with `np.r 27 | numpy.random.random_integers() 28 | numpy.random.random_sample() | -error[NPY002]: NPY002.py:27:1: Replace legacy `np.random.random_integers` call with `np.random.Generator` +error[NPY002]: 27:1: Replace legacy `np.random.random_integers` call with `np.random.Generator` + --> NPY002.py:26:22 | 25 | numpy.random.randint() 26 | numpy.random.random() @@ -118,8 +130,9 @@ error[NPY002]: NPY002.py:27:1: Replace legacy `np.random.random_integers` call w 28 | numpy.random.random_sample() 29 | numpy.random.choice() | -error[NPY002]: NPY002.py:28:1: Replace legacy `np.random.random_sample` call with `np.random.Generator` +error[NPY002]: 28:1: Replace legacy `np.random.random_sample` call with `np.random.Generator` + --> NPY002.py:27:31 | 26 | numpy.random.random() 27 | numpy.random.random_integers() @@ -128,8 +141,9 @@ error[NPY002]: NPY002.py:28:1: Replace legacy `np.random.random_sample` call wit 29 | numpy.random.choice() 30 | numpy.random.bytes() | -error[NPY002]: NPY002.py:29:1: Replace legacy `np.random.choice` call with `np.random.Generator` +error[NPY002]: 29:1: Replace legacy `np.random.choice` call with `np.random.Generator` + --> NPY002.py:28:29 | 27 | numpy.random.random_integers() 28 | numpy.random.random_sample() @@ -138,8 +152,9 @@ error[NPY002]: NPY002.py:29:1: Replace legacy `np.random.choice` call with `np.r 30 | numpy.random.bytes() 31 | numpy.random.shuffle() | -error[NPY002]: NPY002.py:30:1: Replace legacy `np.random.bytes` call with `np.random.Generator` +error[NPY002]: 30:1: Replace legacy `np.random.bytes` call with `np.random.Generator` + --> NPY002.py:29:22 | 28 | numpy.random.random_sample() 29 | numpy.random.choice() @@ -148,8 +163,9 @@ error[NPY002]: NPY002.py:30:1: Replace legacy `np.random.bytes` call with `np.ra 31 | numpy.random.shuffle() 32 | numpy.random.permutation() | -error[NPY002]: NPY002.py:31:1: Replace legacy `np.random.shuffle` call with `np.random.Generator` +error[NPY002]: 31:1: Replace legacy `np.random.shuffle` call with `np.random.Generator` + --> NPY002.py:30:21 | 29 | numpy.random.choice() 30 | numpy.random.bytes() @@ -158,8 +174,9 @@ error[NPY002]: NPY002.py:31:1: Replace legacy `np.random.shuffle` call with `np. 32 | numpy.random.permutation() 33 | numpy.random.beta() | -error[NPY002]: NPY002.py:32:1: Replace legacy `np.random.permutation` call with `np.random.Generator` +error[NPY002]: 32:1: Replace legacy `np.random.permutation` call with `np.random.Generator` + --> NPY002.py:31:23 | 30 | numpy.random.bytes() 31 | numpy.random.shuffle() @@ -168,8 +185,9 @@ error[NPY002]: NPY002.py:32:1: Replace legacy `np.random.permutation` call with 33 | numpy.random.beta() 34 | numpy.random.binomial() | -error[NPY002]: NPY002.py:33:1: Replace legacy `np.random.beta` call with `np.random.Generator` +error[NPY002]: 33:1: Replace legacy `np.random.beta` call with `np.random.Generator` + --> NPY002.py:32:27 | 31 | numpy.random.shuffle() 32 | numpy.random.permutation() @@ -178,8 +196,9 @@ error[NPY002]: NPY002.py:33:1: Replace legacy `np.random.beta` call with `np.ran 34 | numpy.random.binomial() 35 | numpy.random.chisquare() | -error[NPY002]: NPY002.py:34:1: Replace legacy `np.random.binomial` call with `np.random.Generator` +error[NPY002]: 34:1: Replace legacy `np.random.binomial` call with `np.random.Generator` + --> NPY002.py:33:20 | 32 | numpy.random.permutation() 33 | numpy.random.beta() @@ -188,8 +207,9 @@ error[NPY002]: NPY002.py:34:1: Replace legacy `np.random.binomial` call with `np 35 | numpy.random.chisquare() 36 | numpy.random.dirichlet() | -error[NPY002]: NPY002.py:35:1: Replace legacy `np.random.chisquare` call with `np.random.Generator` +error[NPY002]: 35:1: Replace legacy `np.random.chisquare` call with `np.random.Generator` + --> NPY002.py:34:24 | 33 | numpy.random.beta() 34 | numpy.random.binomial() @@ -198,8 +218,9 @@ error[NPY002]: NPY002.py:35:1: Replace legacy `np.random.chisquare` call with `n 36 | numpy.random.dirichlet() 37 | numpy.random.exponential() | -error[NPY002]: NPY002.py:36:1: Replace legacy `np.random.dirichlet` call with `np.random.Generator` +error[NPY002]: 36:1: Replace legacy `np.random.dirichlet` call with `np.random.Generator` + --> NPY002.py:35:25 | 34 | numpy.random.binomial() 35 | numpy.random.chisquare() @@ -208,8 +229,9 @@ error[NPY002]: NPY002.py:36:1: Replace legacy `np.random.dirichlet` call with `n 37 | numpy.random.exponential() 38 | numpy.random.f() | -error[NPY002]: NPY002.py:37:1: Replace legacy `np.random.exponential` call with `np.random.Generator` +error[NPY002]: 37:1: Replace legacy `np.random.exponential` call with `np.random.Generator` + --> NPY002.py:36:25 | 35 | numpy.random.chisquare() 36 | numpy.random.dirichlet() @@ -218,8 +240,9 @@ error[NPY002]: NPY002.py:37:1: Replace legacy `np.random.exponential` call with 38 | numpy.random.f() 39 | numpy.random.gamma() | -error[NPY002]: NPY002.py:38:1: Replace legacy `np.random.f` call with `np.random.Generator` +error[NPY002]: 38:1: Replace legacy `np.random.f` call with `np.random.Generator` + --> NPY002.py:37:27 | 36 | numpy.random.dirichlet() 37 | numpy.random.exponential() @@ -228,8 +251,9 @@ error[NPY002]: NPY002.py:38:1: Replace legacy `np.random.f` call with `np.random 39 | numpy.random.gamma() 40 | numpy.random.geometric() | -error[NPY002]: NPY002.py:39:1: Replace legacy `np.random.gamma` call with `np.random.Generator` +error[NPY002]: 39:1: Replace legacy `np.random.gamma` call with `np.random.Generator` + --> NPY002.py:38:17 | 37 | numpy.random.exponential() 38 | numpy.random.f() @@ -238,8 +262,9 @@ error[NPY002]: NPY002.py:39:1: Replace legacy `np.random.gamma` call with `np.ra 40 | numpy.random.geometric() 41 | numpy.random.gumbel() | -error[NPY002]: NPY002.py:40:1: Replace legacy `np.random.geometric` call with `np.random.Generator` +error[NPY002]: 40:1: Replace legacy `np.random.geometric` call with `np.random.Generator` + --> NPY002.py:39:21 | 38 | numpy.random.f() 39 | numpy.random.gamma() @@ -248,8 +273,9 @@ error[NPY002]: NPY002.py:40:1: Replace legacy `np.random.geometric` call with `n 41 | numpy.random.gumbel() 42 | numpy.random.hypergeometric() | -error[NPY002]: NPY002.py:41:1: Replace legacy `np.random.gumbel` call with `np.random.Generator` +error[NPY002]: 41:1: Replace legacy `np.random.gumbel` call with `np.random.Generator` + --> NPY002.py:40:25 | 39 | numpy.random.gamma() 40 | numpy.random.geometric() @@ -258,8 +284,9 @@ error[NPY002]: NPY002.py:41:1: Replace legacy `np.random.gumbel` call with `np.r 42 | numpy.random.hypergeometric() 43 | numpy.random.laplace() | -error[NPY002]: NPY002.py:42:1: Replace legacy `np.random.hypergeometric` call with `np.random.Generator` +error[NPY002]: 42:1: Replace legacy `np.random.hypergeometric` call with `np.random.Generator` + --> NPY002.py:41:22 | 40 | numpy.random.geometric() 41 | numpy.random.gumbel() @@ -268,8 +295,9 @@ error[NPY002]: NPY002.py:42:1: Replace legacy `np.random.hypergeometric` call wi 43 | numpy.random.laplace() 44 | numpy.random.logistic() | -error[NPY002]: NPY002.py:43:1: Replace legacy `np.random.laplace` call with `np.random.Generator` +error[NPY002]: 43:1: Replace legacy `np.random.laplace` call with `np.random.Generator` + --> NPY002.py:42:30 | 41 | numpy.random.gumbel() 42 | numpy.random.hypergeometric() @@ -278,8 +306,9 @@ error[NPY002]: NPY002.py:43:1: Replace legacy `np.random.laplace` call with `np. 44 | numpy.random.logistic() 45 | numpy.random.lognormal() | -error[NPY002]: NPY002.py:44:1: Replace legacy `np.random.logistic` call with `np.random.Generator` +error[NPY002]: 44:1: Replace legacy `np.random.logistic` call with `np.random.Generator` + --> NPY002.py:43:23 | 42 | numpy.random.hypergeometric() 43 | numpy.random.laplace() @@ -288,8 +317,9 @@ error[NPY002]: NPY002.py:44:1: Replace legacy `np.random.logistic` call with `np 45 | numpy.random.lognormal() 46 | numpy.random.logseries() | -error[NPY002]: NPY002.py:45:1: Replace legacy `np.random.lognormal` call with `np.random.Generator` +error[NPY002]: 45:1: Replace legacy `np.random.lognormal` call with `np.random.Generator` + --> NPY002.py:44:24 | 43 | numpy.random.laplace() 44 | numpy.random.logistic() @@ -298,8 +328,9 @@ error[NPY002]: NPY002.py:45:1: Replace legacy `np.random.lognormal` call with `n 46 | numpy.random.logseries() 47 | numpy.random.multinomial() | -error[NPY002]: NPY002.py:46:1: Replace legacy `np.random.logseries` call with `np.random.Generator` +error[NPY002]: 46:1: Replace legacy `np.random.logseries` call with `np.random.Generator` + --> NPY002.py:45:25 | 44 | numpy.random.logistic() 45 | numpy.random.lognormal() @@ -308,8 +339,9 @@ error[NPY002]: NPY002.py:46:1: Replace legacy `np.random.logseries` call with `n 47 | numpy.random.multinomial() 48 | numpy.random.multivariate_normal() | -error[NPY002]: NPY002.py:47:1: Replace legacy `np.random.multinomial` call with `np.random.Generator` +error[NPY002]: 47:1: Replace legacy `np.random.multinomial` call with `np.random.Generator` + --> NPY002.py:46:25 | 45 | numpy.random.lognormal() 46 | numpy.random.logseries() @@ -318,8 +350,9 @@ error[NPY002]: NPY002.py:47:1: Replace legacy `np.random.multinomial` call with 48 | numpy.random.multivariate_normal() 49 | numpy.random.negative_binomial() | -error[NPY002]: NPY002.py:48:1: Replace legacy `np.random.multivariate_normal` call with `np.random.Generator` +error[NPY002]: 48:1: Replace legacy `np.random.multivariate_normal` call with `np.random.Generator` + --> NPY002.py:47:27 | 46 | numpy.random.logseries() 47 | numpy.random.multinomial() @@ -328,8 +361,9 @@ error[NPY002]: NPY002.py:48:1: Replace legacy `np.random.multivariate_normal` ca 49 | numpy.random.negative_binomial() 50 | numpy.random.noncentral_chisquare() | -error[NPY002]: NPY002.py:49:1: Replace legacy `np.random.negative_binomial` call with `np.random.Generator` +error[NPY002]: 49:1: Replace legacy `np.random.negative_binomial` call with `np.random.Generator` + --> NPY002.py:48:35 | 47 | numpy.random.multinomial() 48 | numpy.random.multivariate_normal() @@ -338,8 +372,9 @@ error[NPY002]: NPY002.py:49:1: Replace legacy `np.random.negative_binomial` call 50 | numpy.random.noncentral_chisquare() 51 | numpy.random.noncentral_f() | -error[NPY002]: NPY002.py:50:1: Replace legacy `np.random.noncentral_chisquare` call with `np.random.Generator` +error[NPY002]: 50:1: Replace legacy `np.random.noncentral_chisquare` call with `np.random.Generator` + --> NPY002.py:49:33 | 48 | numpy.random.multivariate_normal() 49 | numpy.random.negative_binomial() @@ -348,8 +383,9 @@ error[NPY002]: NPY002.py:50:1: Replace legacy `np.random.noncentral_chisquare` c 51 | numpy.random.noncentral_f() 52 | numpy.random.normal() | -error[NPY002]: NPY002.py:51:1: Replace legacy `np.random.noncentral_f` call with `np.random.Generator` +error[NPY002]: 51:1: Replace legacy `np.random.noncentral_f` call with `np.random.Generator` + --> NPY002.py:50:36 | 49 | numpy.random.negative_binomial() 50 | numpy.random.noncentral_chisquare() @@ -358,8 +394,9 @@ error[NPY002]: NPY002.py:51:1: Replace legacy `np.random.noncentral_f` call with 52 | numpy.random.normal() 53 | numpy.random.pareto() | -error[NPY002]: NPY002.py:52:1: Replace legacy `np.random.normal` call with `np.random.Generator` +error[NPY002]: 52:1: Replace legacy `np.random.normal` call with `np.random.Generator` + --> NPY002.py:51:28 | 50 | numpy.random.noncentral_chisquare() 51 | numpy.random.noncentral_f() @@ -368,8 +405,9 @@ error[NPY002]: NPY002.py:52:1: Replace legacy `np.random.normal` call with `np.r 53 | numpy.random.pareto() 54 | numpy.random.poisson() | -error[NPY002]: NPY002.py:53:1: Replace legacy `np.random.pareto` call with `np.random.Generator` +error[NPY002]: 53:1: Replace legacy `np.random.pareto` call with `np.random.Generator` + --> NPY002.py:52:22 | 51 | numpy.random.noncentral_f() 52 | numpy.random.normal() @@ -378,8 +416,9 @@ error[NPY002]: NPY002.py:53:1: Replace legacy `np.random.pareto` call with `np.r 54 | numpy.random.poisson() 55 | numpy.random.power() | -error[NPY002]: NPY002.py:54:1: Replace legacy `np.random.poisson` call with `np.random.Generator` +error[NPY002]: 54:1: Replace legacy `np.random.poisson` call with `np.random.Generator` + --> NPY002.py:53:22 | 52 | numpy.random.normal() 53 | numpy.random.pareto() @@ -388,8 +427,9 @@ error[NPY002]: NPY002.py:54:1: Replace legacy `np.random.poisson` call with `np. 55 | numpy.random.power() 56 | numpy.random.rayleigh() | -error[NPY002]: NPY002.py:55:1: Replace legacy `np.random.power` call with `np.random.Generator` +error[NPY002]: 55:1: Replace legacy `np.random.power` call with `np.random.Generator` + --> NPY002.py:54:23 | 53 | numpy.random.pareto() 54 | numpy.random.poisson() @@ -398,8 +438,9 @@ error[NPY002]: NPY002.py:55:1: Replace legacy `np.random.power` call with `np.ra 56 | numpy.random.rayleigh() 57 | numpy.random.standard_cauchy() | -error[NPY002]: NPY002.py:56:1: Replace legacy `np.random.rayleigh` call with `np.random.Generator` +error[NPY002]: 56:1: Replace legacy `np.random.rayleigh` call with `np.random.Generator` + --> NPY002.py:55:21 | 54 | numpy.random.poisson() 55 | numpy.random.power() @@ -408,8 +449,9 @@ error[NPY002]: NPY002.py:56:1: Replace legacy `np.random.rayleigh` call with `np 57 | numpy.random.standard_cauchy() 58 | numpy.random.standard_exponential() | -error[NPY002]: NPY002.py:57:1: Replace legacy `np.random.standard_cauchy` call with `np.random.Generator` +error[NPY002]: 57:1: Replace legacy `np.random.standard_cauchy` call with `np.random.Generator` + --> NPY002.py:56:24 | 55 | numpy.random.power() 56 | numpy.random.rayleigh() @@ -418,8 +460,9 @@ error[NPY002]: NPY002.py:57:1: Replace legacy `np.random.standard_cauchy` call w 58 | numpy.random.standard_exponential() 59 | numpy.random.standard_gamma() | -error[NPY002]: NPY002.py:58:1: Replace legacy `np.random.standard_exponential` call with `np.random.Generator` +error[NPY002]: 58:1: Replace legacy `np.random.standard_exponential` call with `np.random.Generator` + --> NPY002.py:57:31 | 56 | numpy.random.rayleigh() 57 | numpy.random.standard_cauchy() @@ -428,8 +471,9 @@ error[NPY002]: NPY002.py:58:1: Replace legacy `np.random.standard_exponential` c 59 | numpy.random.standard_gamma() 60 | numpy.random.standard_normal() | -error[NPY002]: NPY002.py:59:1: Replace legacy `np.random.standard_gamma` call with `np.random.Generator` +error[NPY002]: 59:1: Replace legacy `np.random.standard_gamma` call with `np.random.Generator` + --> NPY002.py:58:36 | 57 | numpy.random.standard_cauchy() 58 | numpy.random.standard_exponential() @@ -438,8 +482,9 @@ error[NPY002]: NPY002.py:59:1: Replace legacy `np.random.standard_gamma` call wi 60 | numpy.random.standard_normal() 61 | numpy.random.standard_t() | -error[NPY002]: NPY002.py:60:1: Replace legacy `np.random.standard_normal` call with `np.random.Generator` +error[NPY002]: 60:1: Replace legacy `np.random.standard_normal` call with `np.random.Generator` + --> NPY002.py:59:30 | 58 | numpy.random.standard_exponential() 59 | numpy.random.standard_gamma() @@ -448,8 +493,9 @@ error[NPY002]: NPY002.py:60:1: Replace legacy `np.random.standard_normal` call w 61 | numpy.random.standard_t() 62 | numpy.random.triangular() | -error[NPY002]: NPY002.py:61:1: Replace legacy `np.random.standard_t` call with `np.random.Generator` +error[NPY002]: 61:1: Replace legacy `np.random.standard_t` call with `np.random.Generator` + --> NPY002.py:60:31 | 59 | numpy.random.standard_gamma() 60 | numpy.random.standard_normal() @@ -458,8 +504,9 @@ error[NPY002]: NPY002.py:61:1: Replace legacy `np.random.standard_t` call with ` 62 | numpy.random.triangular() 63 | numpy.random.uniform() | -error[NPY002]: NPY002.py:62:1: Replace legacy `np.random.triangular` call with `np.random.Generator` +error[NPY002]: 62:1: Replace legacy `np.random.triangular` call with `np.random.Generator` + --> NPY002.py:61:26 | 60 | numpy.random.standard_normal() 61 | numpy.random.standard_t() @@ -468,8 +515,9 @@ error[NPY002]: NPY002.py:62:1: Replace legacy `np.random.triangular` call with ` 63 | numpy.random.uniform() 64 | numpy.random.vonmises() | -error[NPY002]: NPY002.py:63:1: Replace legacy `np.random.uniform` call with `np.random.Generator` +error[NPY002]: 63:1: Replace legacy `np.random.uniform` call with `np.random.Generator` + --> NPY002.py:62:26 | 61 | numpy.random.standard_t() 62 | numpy.random.triangular() @@ -478,8 +526,9 @@ error[NPY002]: NPY002.py:63:1: Replace legacy `np.random.uniform` call with `np. 64 | numpy.random.vonmises() 65 | numpy.random.wald() | -error[NPY002]: NPY002.py:64:1: Replace legacy `np.random.vonmises` call with `np.random.Generator` +error[NPY002]: 64:1: Replace legacy `np.random.vonmises` call with `np.random.Generator` + --> NPY002.py:63:23 | 62 | numpy.random.triangular() 63 | numpy.random.uniform() @@ -488,8 +537,9 @@ error[NPY002]: NPY002.py:64:1: Replace legacy `np.random.vonmises` call with `np 65 | numpy.random.wald() 66 | numpy.random.weibull() | -error[NPY002]: NPY002.py:65:1: Replace legacy `np.random.wald` call with `np.random.Generator` +error[NPY002]: 65:1: Replace legacy `np.random.wald` call with `np.random.Generator` + --> NPY002.py:64:24 | 63 | numpy.random.uniform() 64 | numpy.random.vonmises() @@ -498,8 +548,9 @@ error[NPY002]: NPY002.py:65:1: Replace legacy `np.random.wald` call with `np.ran 66 | numpy.random.weibull() 67 | numpy.random.zipf() | -error[NPY002]: NPY002.py:66:1: Replace legacy `np.random.weibull` call with `np.random.Generator` +error[NPY002]: 66:1: Replace legacy `np.random.weibull` call with `np.random.Generator` + --> NPY002.py:65:20 | 64 | numpy.random.vonmises() 65 | numpy.random.wald() @@ -507,8 +558,9 @@ error[NPY002]: NPY002.py:66:1: Replace legacy `np.random.weibull` call with `np. | ^^^^^^^^^^^^^^^^^^^^ 67 | numpy.random.zipf() | -error[NPY002]: NPY002.py:67:1: Replace legacy `np.random.zipf` call with `np.random.Generator` +error[NPY002]: 67:1: Replace legacy `np.random.zipf` call with `np.random.Generator` + --> NPY002.py:66:23 | 65 | numpy.random.wald() 66 | numpy.random.weibull() diff --git a/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy2-deprecation_NPY201.py.snap b/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy2-deprecation_NPY201.py.snap index 6941c9efc9..872491b09d 100644 --- a/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy2-deprecation_NPY201.py.snap +++ b/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy2-deprecation_NPY201.py.snap @@ -1,17 +1,18 @@ --- source: crates/ruff_linter/src/rules/numpy/mod.rs --- -NPY201.py:4:5: NPY201 [*] `np.add_docstring` will be removed in NumPy 2.0. Use `numpy.lib.add_docstring` instead. +error[NPY201]: 4:5: [*] `np.add_docstring` will be removed in NumPy 2.0. Use `numpy.lib.add_docstring` instead. + + --> NPY201.py:4:5 | 2 | import numpy as np 3 | 4 | np.add_docstring - | ^^^^^^^^^^^^^^^^ NPY201 + | ^^^^^^^^^^^^^^^^ 5 | 6 | np.add_newdoc | = help: Replace with `numpy.lib.add_docstring` - ℹ Safe fix 1 |+from numpy.lib import add_docstring 1 2 | def func(): @@ -23,17 +24,18 @@ NPY201.py:4:5: NPY201 [*] `np.add_docstring` will be removed in NumPy 2.0. Use ` 6 7 | np.add_newdoc 7 8 | -NPY201.py:6:5: NPY201 [*] `np.add_newdoc` will be removed in NumPy 2.0. Use `numpy.lib.add_newdoc` instead. +error[NPY201]: 6:5: [*] `np.add_newdoc` will be removed in NumPy 2.0. Use `numpy.lib.add_newdoc` instead. + + --> NPY201.py:6:5 | 4 | np.add_docstring 5 | 6 | np.add_newdoc - | ^^^^^^^^^^^^^ NPY201 + | ^^^^^^^^^^^^^ 7 | 8 | np.add_newdoc_ufunc | = help: Replace with `numpy.lib.add_newdoc` - ℹ Safe fix 1 |+from numpy.lib import add_newdoc 1 2 | def func(): @@ -47,37 +49,40 @@ NPY201.py:6:5: NPY201 [*] `np.add_newdoc` will be removed in NumPy 2.0. Use `num 8 9 | np.add_newdoc_ufunc 9 10 | -NPY201.py:8:5: NPY201 `np.add_newdoc_ufunc` will be removed in NumPy 2.0. `add_newdoc_ufunc` is an internal function. +error[NPY201]: 8:5: `np.add_newdoc_ufunc` will be removed in NumPy 2.0. `add_newdoc_ufunc` is an internal function. + + --> NPY201.py:8:5 | 6 | np.add_newdoc 7 | 8 | np.add_newdoc_ufunc - | ^^^^^^^^^^^^^^^^^^^ NPY201 + | ^^^^^^^^^^^^^^^^^^^ 9 | 10 | np.asfarray([1,2,3]) | +error[NPY201]: 10:5: `np.asfarray` will be removed in NumPy 2.0. Use `np.asarray` with a `float` dtype instead. -NPY201.py:10:5: NPY201 `np.asfarray` will be removed in NumPy 2.0. Use `np.asarray` with a `float` dtype instead. + --> NPY201.py:10:5 | 8 | np.add_newdoc_ufunc 9 | 10 | np.asfarray([1,2,3]) - | ^^^^^^^^^^^ NPY201 + | ^^^^^^^^^^^ 11 | 12 | np.byte_bounds(np.array([1,2,3])) | +error[NPY201]: 12:5: [*] `np.byte_bounds` will be removed in NumPy 2.0. Use `numpy.lib.array_utils.byte_bounds` on NumPy 2.0, or ignore this warning on earlier versions. -NPY201.py:12:5: NPY201 [*] `np.byte_bounds` will be removed in NumPy 2.0. Use `numpy.lib.array_utils.byte_bounds` on NumPy 2.0, or ignore this warning on earlier versions. + --> NPY201.py:12:5 | 10 | np.asfarray([1,2,3]) 11 | 12 | np.byte_bounds(np.array([1,2,3])) - | ^^^^^^^^^^^^^^ NPY201 + | ^^^^^^^^^^^^^^ 13 | 14 | np.cast | = help: Replace with `numpy.lib.array_utils.byte_bounds` (requires NumPy 2.0 or greater) - ℹ Unsafe fix 1 |+from numpy.lib.array_utils import byte_bounds 1 2 | def func(): @@ -93,27 +98,29 @@ NPY201.py:12:5: NPY201 [*] `np.byte_bounds` will be removed in NumPy 2.0. Use `n 14 15 | np.cast 15 16 | -NPY201.py:14:5: NPY201 `np.cast` will be removed in NumPy 2.0. Use `np.asarray(arr, dtype=dtype)` instead. +error[NPY201]: 14:5: `np.cast` will be removed in NumPy 2.0. Use `np.asarray(arr, dtype=dtype)` instead. + + --> NPY201.py:14:5 | 12 | np.byte_bounds(np.array([1,2,3])) 13 | 14 | np.cast - | ^^^^^^^ NPY201 + | ^^^^^^^ 15 | 16 | np.cfloat(12+34j) | +error[NPY201]: 16:5: [*] `np.cfloat` will be removed in NumPy 2.0. Use `numpy.complex128` instead. -NPY201.py:16:5: NPY201 [*] `np.cfloat` will be removed in NumPy 2.0. Use `numpy.complex128` instead. + --> NPY201.py:16:5 | 14 | np.cast 15 | 16 | np.cfloat(12+34j) - | ^^^^^^^^^ NPY201 + | ^^^^^^^^^ 17 | 18 | np.clongfloat(12+34j) | = help: Replace with `numpy.complex128` - ℹ Safe fix 13 13 | 14 14 | np.cast @@ -124,17 +131,18 @@ NPY201.py:16:5: NPY201 [*] `np.cfloat` will be removed in NumPy 2.0. Use `numpy. 18 18 | np.clongfloat(12+34j) 19 19 | -NPY201.py:18:5: NPY201 [*] `np.clongfloat` will be removed in NumPy 2.0. Use `numpy.clongdouble` instead. +error[NPY201]: 18:5: [*] `np.clongfloat` will be removed in NumPy 2.0. Use `numpy.clongdouble` instead. + + --> NPY201.py:18:5 | 16 | np.cfloat(12+34j) 17 | 18 | np.clongfloat(12+34j) - | ^^^^^^^^^^^^^ NPY201 + | ^^^^^^^^^^^^^ 19 | 20 | np.compat | = help: Replace with `numpy.clongdouble` - ℹ Safe fix 15 15 | 16 16 | np.cfloat(12+34j) @@ -145,27 +153,29 @@ NPY201.py:18:5: NPY201 [*] `np.clongfloat` will be removed in NumPy 2.0. Use `nu 20 20 | np.compat 21 21 | -NPY201.py:20:5: NPY201 `np.compat` will be removed in NumPy 2.0. Python 2 is no longer supported. +error[NPY201]: 20:5: `np.compat` will be removed in NumPy 2.0. Python 2 is no longer supported. + + --> NPY201.py:20:5 | 18 | np.clongfloat(12+34j) 19 | 20 | np.compat - | ^^^^^^^^^ NPY201 + | ^^^^^^^^^ 21 | 22 | np.complex_(12+34j) | +error[NPY201]: 22:5: [*] `np.complex_` will be removed in NumPy 2.0. Use `numpy.complex128` instead. -NPY201.py:22:5: NPY201 [*] `np.complex_` will be removed in NumPy 2.0. Use `numpy.complex128` instead. + --> NPY201.py:22:5 | 20 | np.compat 21 | 22 | np.complex_(12+34j) - | ^^^^^^^^^^^ NPY201 + | ^^^^^^^^^^^ 23 | 24 | np.DataSource | = help: Replace with `numpy.complex128` - ℹ Safe fix 19 19 | 20 20 | np.compat @@ -176,17 +186,18 @@ NPY201.py:22:5: NPY201 [*] `np.complex_` will be removed in NumPy 2.0. Use `nump 24 24 | np.DataSource 25 25 | -NPY201.py:24:5: NPY201 [*] `np.DataSource` will be removed in NumPy 2.0. Use `numpy.lib.npyio.DataSource` instead. +error[NPY201]: 24:5: [*] `np.DataSource` will be removed in NumPy 2.0. Use `numpy.lib.npyio.DataSource` instead. + + --> NPY201.py:24:5 | 22 | np.complex_(12+34j) 23 | 24 | np.DataSource - | ^^^^^^^^^^^^^ NPY201 + | ^^^^^^^^^^^^^ 25 | 26 | np.deprecate | = help: Replace with `numpy.lib.npyio.DataSource` - ℹ Safe fix 1 |+from numpy.lib.npyio import DataSource 1 2 | def func(): @@ -202,77 +213,84 @@ NPY201.py:24:5: NPY201 [*] `np.DataSource` will be removed in NumPy 2.0. Use `nu 26 27 | np.deprecate 27 28 | -NPY201.py:26:5: NPY201 `np.deprecate` will be removed in NumPy 2.0. Emit `DeprecationWarning` with `warnings.warn` directly, or use `typing.deprecated`. +error[NPY201]: 26:5: `np.deprecate` will be removed in NumPy 2.0. Emit `DeprecationWarning` with `warnings.warn` directly, or use `typing.deprecated`. + + --> NPY201.py:26:5 | 24 | np.DataSource 25 | 26 | np.deprecate - | ^^^^^^^^^^^^ NPY201 + | ^^^^^^^^^^^^ 27 | 28 | np.deprecate_with_doc | +error[NPY201]: 28:5: `np.deprecate_with_doc` will be removed in NumPy 2.0. Emit `DeprecationWarning` with `warnings.warn` directly, or use `typing.deprecated`. -NPY201.py:28:5: NPY201 `np.deprecate_with_doc` will be removed in NumPy 2.0. Emit `DeprecationWarning` with `warnings.warn` directly, or use `typing.deprecated`. + --> NPY201.py:28:5 | 26 | np.deprecate 27 | 28 | np.deprecate_with_doc - | ^^^^^^^^^^^^^^^^^^^^^ NPY201 + | ^^^^^^^^^^^^^^^^^^^^^ 29 | 30 | np.disp(10) | +error[NPY201]: 30:5: `np.disp` will be removed in NumPy 2.0. Use a dedicated print function instead. -NPY201.py:30:5: NPY201 `np.disp` will be removed in NumPy 2.0. Use a dedicated print function instead. + --> NPY201.py:30:5 | 28 | np.deprecate_with_doc 29 | 30 | np.disp(10) - | ^^^^^^^ NPY201 + | ^^^^^^^ 31 | 32 | np.fastCopyAndTranspose | +error[NPY201]: 32:5: `np.fastCopyAndTranspose` will be removed in NumPy 2.0. Use `arr.T.copy()` instead. -NPY201.py:32:5: NPY201 `np.fastCopyAndTranspose` will be removed in NumPy 2.0. Use `arr.T.copy()` instead. + --> NPY201.py:32:5 | 30 | np.disp(10) 31 | 32 | np.fastCopyAndTranspose - | ^^^^^^^^^^^^^^^^^^^^^^^ NPY201 + | ^^^^^^^^^^^^^^^^^^^^^^^ 33 | 34 | np.find_common_type | +error[NPY201]: 34:5: `np.find_common_type` will be removed in NumPy 2.0. Use `numpy.promote_types` or `numpy.result_type` instead. To achieve semantics for the `scalar_types` argument, use `numpy.result_type` and pass the Python values `0`, `0.0`, or `0j`. -NPY201.py:34:5: NPY201 `np.find_common_type` will be removed in NumPy 2.0. Use `numpy.promote_types` or `numpy.result_type` instead. To achieve semantics for the `scalar_types` argument, use `numpy.result_type` and pass the Python values `0`, `0.0`, or `0j`. + --> NPY201.py:34:5 | 32 | np.fastCopyAndTranspose 33 | 34 | np.find_common_type - | ^^^^^^^^^^^^^^^^^^^ NPY201 + | ^^^^^^^^^^^^^^^^^^^ 35 | 36 | np.get_array_wrap | +error[NPY201]: 36:5: `np.get_array_wrap` will be removed without replacement in NumPy 2.0 -NPY201.py:36:5: NPY201 `np.get_array_wrap` will be removed without replacement in NumPy 2.0 + --> NPY201.py:36:5 | 34 | np.find_common_type 35 | 36 | np.get_array_wrap - | ^^^^^^^^^^^^^^^^^ NPY201 + | ^^^^^^^^^^^^^^^^^ 37 | 38 | np.float_ | +error[NPY201]: 38:5: [*] `np.float_` will be removed in NumPy 2.0. Use `numpy.float64` instead. -NPY201.py:38:5: NPY201 [*] `np.float_` will be removed in NumPy 2.0. Use `numpy.float64` instead. + --> NPY201.py:38:5 | 36 | np.get_array_wrap 37 | 38 | np.float_ - | ^^^^^^^^^ NPY201 + | ^^^^^^^^^ 39 | 40 | np.geterrobj | = help: Replace with `numpy.float64` - ℹ Safe fix 35 35 | 36 36 | np.get_array_wrap @@ -283,27 +301,29 @@ NPY201.py:38:5: NPY201 [*] `np.float_` will be removed in NumPy 2.0. Use `numpy. 40 40 | np.geterrobj 41 41 | -NPY201.py:40:5: NPY201 `np.geterrobj` will be removed in NumPy 2.0. Use the `np.errstate` context manager instead. +error[NPY201]: 40:5: `np.geterrobj` will be removed in NumPy 2.0. Use the `np.errstate` context manager instead. + + --> NPY201.py:40:5 | 38 | np.float_ 39 | 40 | np.geterrobj - | ^^^^^^^^^^^^ NPY201 + | ^^^^^^^^^^^^ 41 | 42 | np.Inf | +error[NPY201]: 42:5: [*] `np.Inf` will be removed in NumPy 2.0. Use `numpy.inf` instead. -NPY201.py:42:5: NPY201 [*] `np.Inf` will be removed in NumPy 2.0. Use `numpy.inf` instead. + --> NPY201.py:42:5 | 40 | np.geterrobj 41 | 42 | np.Inf - | ^^^^^^ NPY201 + | ^^^^^^ 43 | 44 | np.Infinity | = help: Replace with `numpy.inf` - ℹ Safe fix 39 39 | 40 40 | np.geterrobj @@ -314,17 +334,18 @@ NPY201.py:42:5: NPY201 [*] `np.Inf` will be removed in NumPy 2.0. Use `numpy.inf 44 44 | np.Infinity 45 45 | -NPY201.py:44:5: NPY201 [*] `np.Infinity` will be removed in NumPy 2.0. Use `numpy.inf` instead. +error[NPY201]: 44:5: [*] `np.Infinity` will be removed in NumPy 2.0. Use `numpy.inf` instead. + + --> NPY201.py:44:5 | 42 | np.Inf 43 | 44 | np.Infinity - | ^^^^^^^^^^^ NPY201 + | ^^^^^^^^^^^ 45 | 46 | np.infty | = help: Replace with `numpy.inf` - ℹ Safe fix 41 41 | 42 42 | np.Inf @@ -335,17 +356,18 @@ NPY201.py:44:5: NPY201 [*] `np.Infinity` will be removed in NumPy 2.0. Use `nump 46 46 | np.infty 47 47 | -NPY201.py:46:5: NPY201 [*] `np.infty` will be removed in NumPy 2.0. Use `numpy.inf` instead. +error[NPY201]: 46:5: [*] `np.infty` will be removed in NumPy 2.0. Use `numpy.inf` instead. + + --> NPY201.py:46:5 | 44 | np.Infinity 45 | 46 | np.infty - | ^^^^^^^^ NPY201 + | ^^^^^^^^ 47 | 48 | np.issctype | = help: Replace with `numpy.inf` - ℹ Safe fix 43 43 | 44 44 | np.Infinity @@ -356,27 +378,29 @@ NPY201.py:46:5: NPY201 [*] `np.infty` will be removed in NumPy 2.0. Use `numpy.i 48 48 | np.issctype 49 49 | -NPY201.py:48:5: NPY201 `np.issctype` will be removed without replacement in NumPy 2.0 +error[NPY201]: 48:5: `np.issctype` will be removed without replacement in NumPy 2.0 + + --> NPY201.py:48:5 | 46 | np.infty 47 | 48 | np.issctype - | ^^^^^^^^^^^ NPY201 + | ^^^^^^^^^^^ 49 | 50 | np.issubclass_(np.int32, np.integer) | +error[NPY201]: 50:5: [*] `np.issubclass_` will be removed in NumPy 2.0. Use `issubclass` instead. -NPY201.py:50:5: NPY201 [*] `np.issubclass_` will be removed in NumPy 2.0. Use `issubclass` instead. + --> NPY201.py:50:5 | 48 | np.issctype 49 | 50 | np.issubclass_(np.int32, np.integer) - | ^^^^^^^^^^^^^^ NPY201 + | ^^^^^^^^^^^^^^ 51 | 52 | np.issubsctype | = help: Replace with `issubclass` - ℹ Safe fix 47 47 | 48 48 | np.issctype @@ -387,17 +411,18 @@ NPY201.py:50:5: NPY201 [*] `np.issubclass_` will be removed in NumPy 2.0. Use `i 52 52 | np.issubsctype 53 53 | -NPY201.py:52:5: NPY201 [*] `np.issubsctype` will be removed in NumPy 2.0. Use `numpy.issubdtype` instead. +error[NPY201]: 52:5: [*] `np.issubsctype` will be removed in NumPy 2.0. Use `numpy.issubdtype` instead. + + --> NPY201.py:52:5 | 50 | np.issubclass_(np.int32, np.integer) 51 | 52 | np.issubsctype - | ^^^^^^^^^^^^^^ NPY201 + | ^^^^^^^^^^^^^^ 53 | 54 | np.mat | = help: Replace with `numpy.issubdtype` - ℹ Safe fix 49 49 | 50 50 | np.issubclass_(np.int32, np.integer) @@ -408,17 +433,18 @@ NPY201.py:52:5: NPY201 [*] `np.issubsctype` will be removed in NumPy 2.0. Use `n 54 54 | np.mat 55 55 | -NPY201.py:54:5: NPY201 [*] `np.mat` will be removed in NumPy 2.0. Use `numpy.asmatrix` instead. +error[NPY201]: 54:5: [*] `np.mat` will be removed in NumPy 2.0. Use `numpy.asmatrix` instead. + + --> NPY201.py:54:5 | 52 | np.issubsctype 53 | 54 | np.mat - | ^^^^^^ NPY201 + | ^^^^^^ 55 | 56 | np.maximum_sctype | = help: Replace with `numpy.asmatrix` - ℹ Safe fix 51 51 | 52 52 | np.issubsctype @@ -429,27 +455,29 @@ NPY201.py:54:5: NPY201 [*] `np.mat` will be removed in NumPy 2.0. Use `numpy.asm 56 56 | np.maximum_sctype 57 57 | -NPY201.py:56:5: NPY201 `np.maximum_sctype` will be removed without replacement in NumPy 2.0 +error[NPY201]: 56:5: `np.maximum_sctype` will be removed without replacement in NumPy 2.0 + + --> NPY201.py:56:5 | 54 | np.mat 55 | 56 | np.maximum_sctype - | ^^^^^^^^^^^^^^^^^ NPY201 + | ^^^^^^^^^^^^^^^^^ 57 | 58 | np.NaN | +error[NPY201]: 58:5: [*] `np.NaN` will be removed in NumPy 2.0. Use `numpy.nan` instead. -NPY201.py:58:5: NPY201 [*] `np.NaN` will be removed in NumPy 2.0. Use `numpy.nan` instead. + --> NPY201.py:58:5 | 56 | np.maximum_sctype 57 | 58 | np.NaN - | ^^^^^^ NPY201 + | ^^^^^^ 59 | 60 | np.nbytes[np.int64] | = help: Replace with `numpy.nan` - ℹ Safe fix 55 55 | 56 56 | np.maximum_sctype @@ -460,27 +488,29 @@ NPY201.py:58:5: NPY201 [*] `np.NaN` will be removed in NumPy 2.0. Use `numpy.nan 60 60 | np.nbytes[np.int64] 61 61 | -NPY201.py:60:5: NPY201 `np.nbytes` will be removed in NumPy 2.0. Use `np.dtype().itemsize` instead. +error[NPY201]: 60:5: `np.nbytes` will be removed in NumPy 2.0. Use `np.dtype().itemsize` instead. + + --> NPY201.py:60:5 | 58 | np.NaN 59 | 60 | np.nbytes[np.int64] - | ^^^^^^^^^ NPY201 + | ^^^^^^^^^ 61 | 62 | np.NINF | +error[NPY201]: 62:5: [*] `np.NINF` will be removed in NumPy 2.0. Use `-np.inf` instead. -NPY201.py:62:5: NPY201 [*] `np.NINF` will be removed in NumPy 2.0. Use `-np.inf` instead. + --> NPY201.py:62:5 | 60 | np.nbytes[np.int64] 61 | 62 | np.NINF - | ^^^^^^^ NPY201 + | ^^^^^^^ 63 | 64 | np.NZERO | = help: Replace with `-np.inf` - ℹ Safe fix 59 59 | 60 60 | np.nbytes[np.int64] @@ -491,17 +521,18 @@ NPY201.py:62:5: NPY201 [*] `np.NINF` will be removed in NumPy 2.0. Use `-np.inf` 64 64 | np.NZERO 65 65 | -NPY201.py:64:5: NPY201 [*] `np.NZERO` will be removed in NumPy 2.0. Use `-0.0` instead. +error[NPY201]: 64:5: [*] `np.NZERO` will be removed in NumPy 2.0. Use `-0.0` instead. + + --> NPY201.py:64:5 | 62 | np.NINF 63 | 64 | np.NZERO - | ^^^^^^^^ NPY201 + | ^^^^^^^^ 65 | 66 | np.longcomplex(12+34j) | = help: Replace with `-0.0` - ℹ Safe fix 61 61 | 62 62 | np.NINF @@ -512,17 +543,18 @@ NPY201.py:64:5: NPY201 [*] `np.NZERO` will be removed in NumPy 2.0. Use `-0.0` i 66 66 | np.longcomplex(12+34j) 67 67 | -NPY201.py:66:5: NPY201 [*] `np.longcomplex` will be removed in NumPy 2.0. Use `numpy.clongdouble` instead. +error[NPY201]: 66:5: [*] `np.longcomplex` will be removed in NumPy 2.0. Use `numpy.clongdouble` instead. + + --> NPY201.py:66:5 | 64 | np.NZERO 65 | 66 | np.longcomplex(12+34j) - | ^^^^^^^^^^^^^^ NPY201 + | ^^^^^^^^^^^^^^ 67 | 68 | np.longfloat(12+34j) | = help: Replace with `numpy.clongdouble` - ℹ Safe fix 63 63 | 64 64 | np.NZERO @@ -533,17 +565,18 @@ NPY201.py:66:5: NPY201 [*] `np.longcomplex` will be removed in NumPy 2.0. Use `n 68 68 | np.longfloat(12+34j) 69 69 | -NPY201.py:68:5: NPY201 [*] `np.longfloat` will be removed in NumPy 2.0. Use `numpy.longdouble` instead. +error[NPY201]: 68:5: [*] `np.longfloat` will be removed in NumPy 2.0. Use `numpy.longdouble` instead. + + --> NPY201.py:68:5 | 66 | np.longcomplex(12+34j) 67 | 68 | np.longfloat(12+34j) - | ^^^^^^^^^^^^ NPY201 + | ^^^^^^^^^^^^ 69 | 70 | np.lookfor | = help: Replace with `numpy.longdouble` - ℹ Safe fix 65 65 | 66 66 | np.longcomplex(12+34j) @@ -554,27 +587,29 @@ NPY201.py:68:5: NPY201 [*] `np.longfloat` will be removed in NumPy 2.0. Use `num 70 70 | np.lookfor 71 71 | -NPY201.py:70:5: NPY201 `np.lookfor` will be removed in NumPy 2.0. Search NumPy’s documentation directly. +error[NPY201]: 70:5: `np.lookfor` will be removed in NumPy 2.0. Search NumPy’s documentation directly. + + --> NPY201.py:70:5 | 68 | np.longfloat(12+34j) 69 | 70 | np.lookfor - | ^^^^^^^^^^ NPY201 + | ^^^^^^^^^^ 71 | 72 | np.NAN | +error[NPY201]: 72:5: [*] `np.NAN` will be removed in NumPy 2.0. Use `numpy.nan` instead. -NPY201.py:72:5: NPY201 [*] `np.NAN` will be removed in NumPy 2.0. Use `numpy.nan` instead. + --> NPY201.py:72:5 | 70 | np.lookfor 71 | 72 | np.NAN - | ^^^^^^ NPY201 + | ^^^^^^ 73 | 74 | try: | = help: Replace with `numpy.nan` - ℹ Safe fix 69 69 | 70 70 | np.lookfor diff --git a/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy2-deprecation_NPY201_2.py.snap b/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy2-deprecation_NPY201_2.py.snap index 56be229615..8deb9babd3 100644 --- a/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy2-deprecation_NPY201_2.py.snap +++ b/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy2-deprecation_NPY201_2.py.snap @@ -1,27 +1,29 @@ --- source: crates/ruff_linter/src/rules/numpy/mod.rs --- -NPY201_2.py:4:5: NPY201 `np.obj2sctype` will be removed without replacement in NumPy 2.0 +error[NPY201]: 4:5: `np.obj2sctype` will be removed without replacement in NumPy 2.0 + + --> NPY201_2.py:4:5 | 2 | import numpy as np 3 | 4 | np.obj2sctype(int) - | ^^^^^^^^^^^^^ NPY201 + | ^^^^^^^^^^^^^ 5 | 6 | np.PINF | +error[NPY201]: 6:5: [*] `np.PINF` will be removed in NumPy 2.0. Use `numpy.inf` instead. -NPY201_2.py:6:5: NPY201 [*] `np.PINF` will be removed in NumPy 2.0. Use `numpy.inf` instead. + --> NPY201_2.py:6:5 | 4 | np.obj2sctype(int) 5 | 6 | np.PINF - | ^^^^^^^ NPY201 + | ^^^^^^^ 7 | 8 | np.PZERO | = help: Replace with `numpy.inf` - ℹ Safe fix 3 3 | 4 4 | np.obj2sctype(int) @@ -32,17 +34,18 @@ NPY201_2.py:6:5: NPY201 [*] `np.PINF` will be removed in NumPy 2.0. Use `numpy.i 8 8 | np.PZERO 9 9 | -NPY201_2.py:8:5: NPY201 [*] `np.PZERO` will be removed in NumPy 2.0. Use `0.0` instead. +error[NPY201]: 8:5: [*] `np.PZERO` will be removed in NumPy 2.0. Use `0.0` instead. + + --> NPY201_2.py:8:5 | 6 | np.PINF 7 | 8 | np.PZERO - | ^^^^^^^^ NPY201 + | ^^^^^^^^ 9 | 10 | np.recfromcsv | = help: Replace with `0.0` - ℹ Safe fix 5 5 | 6 6 | np.PINF @@ -53,37 +56,40 @@ NPY201_2.py:8:5: NPY201 [*] `np.PZERO` will be removed in NumPy 2.0. Use `0.0` i 10 10 | np.recfromcsv 11 11 | -NPY201_2.py:10:5: NPY201 `np.recfromcsv` will be removed in NumPy 2.0. Use `np.genfromtxt` with comma delimiter instead. +error[NPY201]: 10:5: `np.recfromcsv` will be removed in NumPy 2.0. Use `np.genfromtxt` with comma delimiter instead. + + --> NPY201_2.py:10:5 | 8 | np.PZERO 9 | 10 | np.recfromcsv - | ^^^^^^^^^^^^^ NPY201 + | ^^^^^^^^^^^^^ 11 | 12 | np.recfromtxt | +error[NPY201]: 12:5: `np.recfromtxt` will be removed in NumPy 2.0. Use `np.genfromtxt` instead. -NPY201_2.py:12:5: NPY201 `np.recfromtxt` will be removed in NumPy 2.0. Use `np.genfromtxt` instead. + --> NPY201_2.py:12:5 | 10 | np.recfromcsv 11 | 12 | np.recfromtxt - | ^^^^^^^^^^^^^ NPY201 + | ^^^^^^^^^^^^^ 13 | 14 | np.round_(12.34) | +error[NPY201]: 14:5: [*] `np.round_` will be removed in NumPy 2.0. Use `numpy.round` instead. -NPY201_2.py:14:5: NPY201 [*] `np.round_` will be removed in NumPy 2.0. Use `numpy.round` instead. + --> NPY201_2.py:14:5 | 12 | np.recfromtxt 13 | 14 | np.round_(12.34) - | ^^^^^^^^^ NPY201 + | ^^^^^^^^^ 15 | 16 | np.safe_eval | = help: Replace with `numpy.round` - ℹ Safe fix 11 11 | 12 12 | np.recfromtxt @@ -94,17 +100,18 @@ NPY201_2.py:14:5: NPY201 [*] `np.round_` will be removed in NumPy 2.0. Use `nump 16 16 | np.safe_eval 17 17 | -NPY201_2.py:16:5: NPY201 [*] `np.safe_eval` will be removed in NumPy 2.0. Use `ast.literal_eval` instead. +error[NPY201]: 16:5: [*] `np.safe_eval` will be removed in NumPy 2.0. Use `ast.literal_eval` instead. + + --> NPY201_2.py:16:5 | 14 | np.round_(12.34) 15 | 16 | np.safe_eval - | ^^^^^^^^^^^^ NPY201 + | ^^^^^^^^^^^^ 17 | 18 | np.sctype2char | = help: Replace with `ast.literal_eval` - ℹ Safe fix 1 |+from ast import literal_eval 1 2 | def func(): @@ -120,57 +127,62 @@ NPY201_2.py:16:5: NPY201 [*] `np.safe_eval` will be removed in NumPy 2.0. Use `a 18 19 | np.sctype2char 19 20 | -NPY201_2.py:18:5: NPY201 `np.sctype2char` will be removed without replacement in NumPy 2.0 +error[NPY201]: 18:5: `np.sctype2char` will be removed without replacement in NumPy 2.0 + + --> NPY201_2.py:18:5 | 16 | np.safe_eval 17 | 18 | np.sctype2char - | ^^^^^^^^^^^^^^ NPY201 + | ^^^^^^^^^^^^^^ 19 | 20 | np.sctypes | +error[NPY201]: 20:5: `np.sctypes` will be removed without replacement in NumPy 2.0 -NPY201_2.py:20:5: NPY201 `np.sctypes` will be removed without replacement in NumPy 2.0 + --> NPY201_2.py:20:5 | 18 | np.sctype2char 19 | 20 | np.sctypes - | ^^^^^^^^^^ NPY201 + | ^^^^^^^^^^ 21 | 22 | np.seterrobj | +error[NPY201]: 22:5: `np.seterrobj` will be removed in NumPy 2.0. Use the `np.errstate` context manager instead. -NPY201_2.py:22:5: NPY201 `np.seterrobj` will be removed in NumPy 2.0. Use the `np.errstate` context manager instead. + --> NPY201_2.py:22:5 | 20 | np.sctypes 21 | 22 | np.seterrobj - | ^^^^^^^^^^^^ NPY201 + | ^^^^^^^^^^^^ 23 | 24 | np.set_numeric_ops | +error[NPY201]: 26:5: `np.set_string_function` will be removed in NumPy 2.0. Use `np.set_printoptions` for custom printing of NumPy objects. -NPY201_2.py:26:5: NPY201 `np.set_string_function` will be removed in NumPy 2.0. Use `np.set_printoptions` for custom printing of NumPy objects. + --> NPY201_2.py:26:5 | 24 | np.set_numeric_ops 25 | 26 | np.set_string_function - | ^^^^^^^^^^^^^^^^^^^^^^ NPY201 + | ^^^^^^^^^^^^^^^^^^^^^^ 27 | 28 | np.singlecomplex(12+1j) | +error[NPY201]: 28:5: [*] `np.singlecomplex` will be removed in NumPy 2.0. Use `numpy.complex64` instead. -NPY201_2.py:28:5: NPY201 [*] `np.singlecomplex` will be removed in NumPy 2.0. Use `numpy.complex64` instead. + --> NPY201_2.py:28:5 | 26 | np.set_string_function 27 | 28 | np.singlecomplex(12+1j) - | ^^^^^^^^^^^^^^^^ NPY201 + | ^^^^^^^^^^^^^^^^ 29 | 30 | np.string_("asdf") | = help: Replace with `numpy.complex64` - ℹ Safe fix 25 25 | 26 26 | np.set_string_function @@ -181,17 +193,18 @@ NPY201_2.py:28:5: NPY201 [*] `np.singlecomplex` will be removed in NumPy 2.0. Us 30 30 | np.string_("asdf") 31 31 | -NPY201_2.py:30:5: NPY201 [*] `np.string_` will be removed in NumPy 2.0. Use `numpy.bytes_` instead. +error[NPY201]: 30:5: [*] `np.string_` will be removed in NumPy 2.0. Use `numpy.bytes_` instead. + + --> NPY201_2.py:30:5 | 28 | np.singlecomplex(12+1j) 29 | 30 | np.string_("asdf") - | ^^^^^^^^^^ NPY201 + | ^^^^^^^^^^ 31 | 32 | np.source | = help: Replace with `numpy.bytes_` - ℹ Safe fix 27 27 | 28 28 | np.singlecomplex(12+1j) @@ -202,17 +215,18 @@ NPY201_2.py:30:5: NPY201 [*] `np.string_` will be removed in NumPy 2.0. Use `num 32 32 | np.source 33 33 | -NPY201_2.py:32:5: NPY201 [*] `np.source` will be removed in NumPy 2.0. Use `inspect.getsource` instead. +error[NPY201]: 32:5: [*] `np.source` will be removed in NumPy 2.0. Use `inspect.getsource` instead. + + --> NPY201_2.py:32:5 | 30 | np.string_("asdf") 31 | 32 | np.source - | ^^^^^^^^^ NPY201 + | ^^^^^^^^^ 33 | 34 | np.tracemalloc_domain | = help: Replace with `inspect.getsource` - ℹ Safe fix 1 |+from inspect import getsource 1 2 | def func(): @@ -228,17 +242,18 @@ NPY201_2.py:32:5: NPY201 [*] `np.source` will be removed in NumPy 2.0. Use `insp 34 35 | np.tracemalloc_domain 35 36 | -NPY201_2.py:34:5: NPY201 [*] `np.tracemalloc_domain` will be removed in NumPy 2.0. Use `numpy.lib.tracemalloc_domain` instead. +error[NPY201]: 34:5: [*] `np.tracemalloc_domain` will be removed in NumPy 2.0. Use `numpy.lib.tracemalloc_domain` instead. + + --> NPY201_2.py:34:5 | 32 | np.source 33 | 34 | np.tracemalloc_domain - | ^^^^^^^^^^^^^^^^^^^^^ NPY201 + | ^^^^^^^^^^^^^^^^^^^^^ 35 | 36 | np.unicode_("asf") | = help: Replace with `numpy.lib.tracemalloc_domain` - ℹ Safe fix 1 |+from numpy.lib import tracemalloc_domain 1 2 | def func(): @@ -254,17 +269,18 @@ NPY201_2.py:34:5: NPY201 [*] `np.tracemalloc_domain` will be removed in NumPy 2. 36 37 | np.unicode_("asf") 37 38 | -NPY201_2.py:36:5: NPY201 [*] `np.unicode_` will be removed in NumPy 2.0. Use `numpy.str_` instead. +error[NPY201]: 36:5: [*] `np.unicode_` will be removed in NumPy 2.0. Use `numpy.str_` instead. + + --> NPY201_2.py:36:5 | 34 | np.tracemalloc_domain 35 | 36 | np.unicode_("asf") - | ^^^^^^^^^^^ NPY201 + | ^^^^^^^^^^^ 37 | 38 | np.who() | = help: Replace with `numpy.str_` - ℹ Safe fix 33 33 | 34 34 | np.tracemalloc_domain @@ -275,27 +291,29 @@ NPY201_2.py:36:5: NPY201 [*] `np.unicode_` will be removed in NumPy 2.0. Use `nu 38 38 | np.who() 39 39 | -NPY201_2.py:38:5: NPY201 `np.who` will be removed in NumPy 2.0. Use an IDE variable explorer or `locals()` instead. +error[NPY201]: 38:5: `np.who` will be removed in NumPy 2.0. Use an IDE variable explorer or `locals()` instead. + + --> NPY201_2.py:38:5 | 36 | np.unicode_("asf") 37 | 38 | np.who() - | ^^^^^^ NPY201 + | ^^^^^^ 39 | 40 | np.row_stack(([1,2], [3,4])) | +error[NPY201]: 40:5: [*] `np.row_stack` will be removed in NumPy 2.0. Use `numpy.vstack` instead. -NPY201_2.py:40:5: NPY201 [*] `np.row_stack` will be removed in NumPy 2.0. Use `numpy.vstack` instead. + --> NPY201_2.py:40:5 | 38 | np.who() 39 | 40 | np.row_stack(([1,2], [3,4])) - | ^^^^^^^^^^^^ NPY201 + | ^^^^^^^^^^^^ 41 | 42 | np.alltrue([True, True]) | = help: Replace with `numpy.vstack` - ℹ Safe fix 37 37 | 38 38 | np.who() @@ -306,17 +324,18 @@ NPY201_2.py:40:5: NPY201 [*] `np.row_stack` will be removed in NumPy 2.0. Use `n 42 42 | np.alltrue([True, True]) 43 43 | -NPY201_2.py:42:5: NPY201 [*] `np.alltrue` will be removed in NumPy 2.0. Use `numpy.all` instead. +error[NPY201]: 42:5: [*] `np.alltrue` will be removed in NumPy 2.0. Use `numpy.all` instead. + + --> NPY201_2.py:42:5 | 40 | np.row_stack(([1,2], [3,4])) 41 | 42 | np.alltrue([True, True]) - | ^^^^^^^^^^ NPY201 + | ^^^^^^^^^^ 43 | 44 | np.sometrue([True, False]) | = help: Replace with `numpy.all` - ℹ Safe fix 39 39 | 40 40 | np.row_stack(([1,2], [3,4])) @@ -327,17 +346,18 @@ NPY201_2.py:42:5: NPY201 [*] `np.alltrue` will be removed in NumPy 2.0. Use `num 44 44 | np.sometrue([True, False]) 45 45 | -NPY201_2.py:44:5: NPY201 [*] `np.sometrue` will be removed in NumPy 2.0. Use `numpy.any` instead. +error[NPY201]: 44:5: [*] `np.sometrue` will be removed in NumPy 2.0. Use `numpy.any` instead. + + --> NPY201_2.py:44:5 | 42 | np.alltrue([True, True]) 43 | 44 | np.sometrue([True, False]) - | ^^^^^^^^^^^ NPY201 + | ^^^^^^^^^^^ 45 | 46 | np.cumproduct([1, 2, 3]) | = help: Replace with `numpy.any` - ℹ Safe fix 41 41 | 42 42 | np.alltrue([True, True]) @@ -348,17 +368,18 @@ NPY201_2.py:44:5: NPY201 [*] `np.sometrue` will be removed in NumPy 2.0. Use `nu 46 46 | np.cumproduct([1, 2, 3]) 47 47 | -NPY201_2.py:46:5: NPY201 [*] `np.cumproduct` will be removed in NumPy 2.0. Use `numpy.cumprod` instead. +error[NPY201]: 46:5: [*] `np.cumproduct` will be removed in NumPy 2.0. Use `numpy.cumprod` instead. + + --> NPY201_2.py:46:5 | 44 | np.sometrue([True, False]) 45 | 46 | np.cumproduct([1, 2, 3]) - | ^^^^^^^^^^^^^ NPY201 + | ^^^^^^^^^^^^^ 47 | 48 | np.product([1, 2, 3]) | = help: Replace with `numpy.cumprod` - ℹ Safe fix 43 43 | 44 44 | np.sometrue([True, False]) @@ -369,17 +390,18 @@ NPY201_2.py:46:5: NPY201 [*] `np.cumproduct` will be removed in NumPy 2.0. Use ` 48 48 | np.product([1, 2, 3]) 49 49 | -NPY201_2.py:48:5: NPY201 [*] `np.product` will be removed in NumPy 2.0. Use `numpy.prod` instead. +error[NPY201]: 48:5: [*] `np.product` will be removed in NumPy 2.0. Use `numpy.prod` instead. + + --> NPY201_2.py:48:5 | 46 | np.cumproduct([1, 2, 3]) 47 | 48 | np.product([1, 2, 3]) - | ^^^^^^^^^^ NPY201 + | ^^^^^^^^^^ 49 | 50 | np.trapz([1, 2, 3]) | = help: Replace with `numpy.prod` - ℹ Safe fix 45 45 | 46 46 | np.cumproduct([1, 2, 3]) @@ -390,17 +412,18 @@ NPY201_2.py:48:5: NPY201 [*] `np.product` will be removed in NumPy 2.0. Use `num 50 50 | np.trapz([1, 2, 3]) 51 51 | -NPY201_2.py:50:5: NPY201 [*] `np.trapz` will be removed in NumPy 2.0. Use `numpy.trapezoid` on NumPy 2.0, or ignore this warning on earlier versions. +error[NPY201]: 50:5: [*] `np.trapz` will be removed in NumPy 2.0. Use `numpy.trapezoid` on NumPy 2.0, or ignore this warning on earlier versions. + + --> NPY201_2.py:50:5 | 48 | np.product([1, 2, 3]) 49 | 50 | np.trapz([1, 2, 3]) - | ^^^^^^^^ NPY201 + | ^^^^^^^^ 51 | 52 | np.in1d([1, 2], [1, 3, 5]) | = help: Replace with `numpy.trapezoid` (requires NumPy 2.0 or greater) - ℹ Unsafe fix 47 47 | 48 48 | np.product([1, 2, 3]) @@ -411,17 +434,18 @@ NPY201_2.py:50:5: NPY201 [*] `np.trapz` will be removed in NumPy 2.0. Use `numpy 52 52 | np.in1d([1, 2], [1, 3, 5]) 53 53 | -NPY201_2.py:52:5: NPY201 [*] `np.in1d` will be removed in NumPy 2.0. Use `numpy.isin` instead. +error[NPY201]: 52:5: [*] `np.in1d` will be removed in NumPy 2.0. Use `numpy.isin` instead. + + --> NPY201_2.py:52:5 | 50 | np.trapz([1, 2, 3]) 51 | 52 | np.in1d([1, 2], [1, 3, 5]) - | ^^^^^^^ NPY201 + | ^^^^^^^ 53 | 54 | np.AxisError | = help: Replace with `numpy.isin` - ℹ Safe fix 49 49 | 50 50 | np.trapz([1, 2, 3]) @@ -432,17 +456,18 @@ NPY201_2.py:52:5: NPY201 [*] `np.in1d` will be removed in NumPy 2.0. Use `numpy. 54 54 | np.AxisError 55 55 | -NPY201_2.py:54:5: NPY201 [*] `np.AxisError` will be removed in NumPy 2.0. Use `numpy.exceptions.AxisError` instead. +error[NPY201]: 54:5: [*] `np.AxisError` will be removed in NumPy 2.0. Use `numpy.exceptions.AxisError` instead. + + --> NPY201_2.py:54:5 | 52 | np.in1d([1, 2], [1, 3, 5]) 53 | 54 | np.AxisError - | ^^^^^^^^^^^^ NPY201 + | ^^^^^^^^^^^^ 55 | 56 | np.ComplexWarning | = help: Replace with `numpy.exceptions.AxisError` - ℹ Safe fix 1 |+from numpy.exceptions import AxisError 1 2 | def func(): @@ -458,17 +483,18 @@ NPY201_2.py:54:5: NPY201 [*] `np.AxisError` will be removed in NumPy 2.0. Use `n 56 57 | np.ComplexWarning 57 58 | -NPY201_2.py:56:5: NPY201 [*] `np.ComplexWarning` will be removed in NumPy 2.0. Use `numpy.exceptions.ComplexWarning` instead. +error[NPY201]: 56:5: [*] `np.ComplexWarning` will be removed in NumPy 2.0. Use `numpy.exceptions.ComplexWarning` instead. + + --> NPY201_2.py:56:5 | 54 | np.AxisError 55 | 56 | np.ComplexWarning - | ^^^^^^^^^^^^^^^^^ NPY201 + | ^^^^^^^^^^^^^^^^^ 57 | 58 | np.compare_chararrays | = help: Replace with `numpy.exceptions.ComplexWarning` - ℹ Safe fix 1 |+from numpy.exceptions import ComplexWarning 1 2 | def func(): @@ -484,17 +510,18 @@ NPY201_2.py:56:5: NPY201 [*] `np.ComplexWarning` will be removed in NumPy 2.0. U 58 59 | np.compare_chararrays 59 60 | -NPY201_2.py:58:5: NPY201 [*] `np.compare_chararrays` will be removed in NumPy 2.0. Use `numpy.char.compare_chararrays` instead. +error[NPY201]: 58:5: [*] `np.compare_chararrays` will be removed in NumPy 2.0. Use `numpy.char.compare_chararrays` instead. + + --> NPY201_2.py:58:5 | 56 | np.ComplexWarning 57 | 58 | np.compare_chararrays - | ^^^^^^^^^^^^^^^^^^^^^ NPY201 + | ^^^^^^^^^^^^^^^^^^^^^ 59 | 60 | try: | = help: Replace with `numpy.char.compare_chararrays` - ℹ Safe fix 1 |+from numpy.char import compare_chararrays 1 2 | def func(): @@ -510,17 +537,18 @@ NPY201_2.py:58:5: NPY201 [*] `np.compare_chararrays` will be removed in NumPy 2. 60 61 | try: 61 62 | np.all([True, True]) -NPY201_2.py:63:9: NPY201 [*] `np.alltrue` will be removed in NumPy 2.0. Use `numpy.all` instead. +error[NPY201]: 63:9: [*] `np.alltrue` will be removed in NumPy 2.0. Use `numpy.all` instead. + + --> NPY201_2.py:63:9 | 61 | np.all([True, True]) 62 | except TypeError: 63 | np.alltrue([True, True]) # Should emit a warning here (`except TypeError`, not `except AttributeError`) - | ^^^^^^^^^^ NPY201 + | ^^^^^^^^^^ 64 | 65 | try: | = help: Replace with `numpy.all` - ℹ Safe fix 60 60 | try: 61 61 | np.all([True, True]) @@ -531,16 +559,17 @@ NPY201_2.py:63:9: NPY201 [*] `np.alltrue` will be removed in NumPy 2.0. Use `num 65 65 | try: 66 66 | np.anyyyy([True, True]) -NPY201_2.py:68:9: NPY201 [*] `np.sometrue` will be removed in NumPy 2.0. Use `numpy.any` instead. +error[NPY201]: 68:9: [*] `np.sometrue` will be removed in NumPy 2.0. Use `numpy.any` instead. + + --> NPY201_2.py:68:9 | 66 | np.anyyyy([True, True]) 67 | except AttributeError: 68 | np.sometrue([True, True]) # Should emit a warning here - | ^^^^^^^^^^^ NPY201 + | ^^^^^^^^^^^ 69 | # (must have an attribute access of the undeprecated name in the `try` body for it to be ignored) | = help: Replace with `numpy.any` - ℹ Safe fix 65 65 | try: 66 66 | np.anyyyy([True, True]) diff --git a/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy2-deprecation_NPY201_3.py.snap b/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy2-deprecation_NPY201_3.py.snap index 2ba8e85fa3..74ba01a1bc 100644 --- a/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy2-deprecation_NPY201_3.py.snap +++ b/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy2-deprecation_NPY201_3.py.snap @@ -1,17 +1,18 @@ --- source: crates/ruff_linter/src/rules/numpy/mod.rs --- -NPY201_3.py:4:5: NPY201 [*] `np.DTypePromotionError` will be removed in NumPy 2.0. Use `numpy.exceptions.DTypePromotionError` instead. +error[NPY201]: 4:5: [*] `np.DTypePromotionError` will be removed in NumPy 2.0. Use `numpy.exceptions.DTypePromotionError` instead. + + --> NPY201_3.py:4:5 | 2 | import numpy as np 3 | 4 | np.DTypePromotionError - | ^^^^^^^^^^^^^^^^^^^^^^ NPY201 + | ^^^^^^^^^^^^^^^^^^^^^^ 5 | 6 | np.ModuleDeprecationWarning | = help: Replace with `numpy.exceptions.DTypePromotionError` - ℹ Safe fix 1 |+from numpy.exceptions import DTypePromotionError 1 2 | def func(): @@ -23,17 +24,18 @@ NPY201_3.py:4:5: NPY201 [*] `np.DTypePromotionError` will be removed in NumPy 2. 6 7 | np.ModuleDeprecationWarning 7 8 | -NPY201_3.py:6:5: NPY201 [*] `np.ModuleDeprecationWarning` will be removed in NumPy 2.0. Use `numpy.exceptions.ModuleDeprecationWarning` instead. +error[NPY201]: 6:5: [*] `np.ModuleDeprecationWarning` will be removed in NumPy 2.0. Use `numpy.exceptions.ModuleDeprecationWarning` instead. + + --> NPY201_3.py:6:5 | 4 | np.DTypePromotionError 5 | 6 | np.ModuleDeprecationWarning - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ NPY201 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ 7 | 8 | np.RankWarning | = help: Replace with `numpy.exceptions.ModuleDeprecationWarning` - ℹ Safe fix 1 |+from numpy.exceptions import ModuleDeprecationWarning 1 2 | def func(): @@ -47,17 +49,18 @@ NPY201_3.py:6:5: NPY201 [*] `np.ModuleDeprecationWarning` will be removed in Num 8 9 | np.RankWarning 9 10 | -NPY201_3.py:8:5: NPY201 [*] `np.RankWarning` will be removed in NumPy 2.0. Use `numpy.exceptions.RankWarning` on NumPy 2.0, or ignore this warning on earlier versions. +error[NPY201]: 8:5: [*] `np.RankWarning` will be removed in NumPy 2.0. Use `numpy.exceptions.RankWarning` on NumPy 2.0, or ignore this warning on earlier versions. + + --> NPY201_3.py:8:5 | 6 | np.ModuleDeprecationWarning 7 | 8 | np.RankWarning - | ^^^^^^^^^^^^^^ NPY201 + | ^^^^^^^^^^^^^^ 9 | 10 | np.TooHardError | = help: Replace with `numpy.exceptions.RankWarning` (requires NumPy 2.0 or greater) - ℹ Unsafe fix 1 |+from numpy.exceptions import RankWarning 1 2 | def func(): @@ -73,17 +76,18 @@ NPY201_3.py:8:5: NPY201 [*] `np.RankWarning` will be removed in NumPy 2.0. Use ` 10 11 | np.TooHardError 11 12 | -NPY201_3.py:10:5: NPY201 [*] `np.TooHardError` will be removed in NumPy 2.0. Use `numpy.exceptions.TooHardError` instead. +error[NPY201]: 10:5: [*] `np.TooHardError` will be removed in NumPy 2.0. Use `numpy.exceptions.TooHardError` instead. + + --> NPY201_3.py:10:5 | 8 | np.RankWarning 9 | 10 | np.TooHardError - | ^^^^^^^^^^^^^^^ NPY201 + | ^^^^^^^^^^^^^^^ 11 | 12 | np.VisibleDeprecationWarning | = help: Replace with `numpy.exceptions.TooHardError` - ℹ Safe fix 1 |+from numpy.exceptions import TooHardError 1 2 | def func(): @@ -99,17 +103,18 @@ NPY201_3.py:10:5: NPY201 [*] `np.TooHardError` will be removed in NumPy 2.0. Use 12 13 | np.VisibleDeprecationWarning 13 14 | -NPY201_3.py:12:5: NPY201 [*] `np.VisibleDeprecationWarning` will be removed in NumPy 2.0. Use `numpy.exceptions.VisibleDeprecationWarning` instead. +error[NPY201]: 12:5: [*] `np.VisibleDeprecationWarning` will be removed in NumPy 2.0. Use `numpy.exceptions.VisibleDeprecationWarning` instead. + + --> NPY201_3.py:12:5 | 10 | np.TooHardError 11 | 12 | np.VisibleDeprecationWarning - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ NPY201 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 13 | 14 | np.chararray | = help: Replace with `numpy.exceptions.VisibleDeprecationWarning` - ℹ Safe fix 1 |+from numpy.exceptions import VisibleDeprecationWarning 1 2 | def func(): @@ -125,17 +130,18 @@ NPY201_3.py:12:5: NPY201 [*] `np.VisibleDeprecationWarning` will be removed in N 14 15 | np.chararray 15 16 | -NPY201_3.py:14:5: NPY201 [*] `np.chararray` will be removed in NumPy 2.0. Use `numpy.char.chararray` instead. +error[NPY201]: 14:5: [*] `np.chararray` will be removed in NumPy 2.0. Use `numpy.char.chararray` instead. + + --> NPY201_3.py:14:5 | 12 | np.VisibleDeprecationWarning 13 | 14 | np.chararray - | ^^^^^^^^^^^^ NPY201 + | ^^^^^^^^^^^^ 15 | 16 | np.format_parser | = help: Replace with `numpy.char.chararray` - ℹ Safe fix 1 |+from numpy.char import chararray 1 2 | def func(): @@ -150,15 +156,16 @@ NPY201_3.py:14:5: NPY201 [*] `np.chararray` will be removed in NumPy 2.0. Use `n 15 16 | 16 17 | np.format_parser -NPY201_3.py:16:5: NPY201 [*] `np.format_parser` will be removed in NumPy 2.0. Use `numpy.rec.format_parser` instead. +error[NPY201]: 16:5: [*] `np.format_parser` will be removed in NumPy 2.0. Use `numpy.rec.format_parser` instead. + + --> NPY201_3.py:16:5 | 14 | np.chararray 15 | 16 | np.format_parser - | ^^^^^^^^^^^^^^^^ NPY201 + | ^^^^^^^^^^^^^^^^ | = help: Replace with `numpy.rec.format_parser` - ℹ Safe fix 1 |+from numpy.rec import format_parser 1 2 | def func(): diff --git a/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD002_PD002.py.snap b/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD002_PD002.py.snap index 78ef7b70c6..f462d79b99 100644 --- a/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD002_PD002.py.snap +++ b/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD002_PD002.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pandas_vet/mod.rs --- -error[PD002]: PD002.py:5:23: [*] `inplace=True` should be avoided; it has inconsistent behavior +error[PD002]: 5:23: [*] `inplace=True` should be avoided; it has inconsistent behavior + --> PD002.py:5:23 | 3 | x = pd.DataFrame() 4 | @@ -22,8 +23,9 @@ error[PD002]: PD002.py:5:23: [*] `inplace=True` should be avoided; it has incons 7 7 | x.y.drop(["a"], axis=1, inplace=True) 8 8 | -error[PD002]: PD002.py:7:25: [*] `inplace=True` should be avoided; it has inconsistent behavior +error[PD002]: 7:25: [*] `inplace=True` should be avoided; it has inconsistent behavior + --> PD002.py:7:25 | 5 | x.drop(["a"], axis=1, inplace=True) 6 | @@ -43,8 +45,9 @@ error[PD002]: PD002.py:7:25: [*] `inplace=True` should be avoided; it has incons 9 9 | x["y"].drop(["a"], axis=1, inplace=True) 10 10 | -error[PD002]: PD002.py:9:28: [*] `inplace=True` should be avoided; it has inconsistent behavior +error[PD002]: 9:28: [*] `inplace=True` should be avoided; it has inconsistent behavior + --> PD002.py:9:28 | 7 | x.y.drop(["a"], axis=1, inplace=True) 8 | @@ -64,8 +67,9 @@ error[PD002]: PD002.py:9:28: [*] `inplace=True` should be avoided; it has incons 11 11 | x.drop( 12 12 | inplace=True, -error[PD002]: PD002.py:12:5: [*] `inplace=True` should be avoided; it has inconsistent behavior +error[PD002]: 12:5: [*] `inplace=True` should be avoided; it has inconsistent behavior + --> PD002.py:12:5 | 11 | x.drop( 12 | inplace=True, @@ -85,8 +89,9 @@ error[PD002]: PD002.py:12:5: [*] `inplace=True` should be avoided; it has incons 14 13 | axis=1, 15 14 | ) -error[PD002]: PD002.py:19:9: [*] `inplace=True` should be avoided; it has inconsistent behavior +error[PD002]: 19:9: [*] `inplace=True` should be avoided; it has inconsistent behavior + --> PD002.py:19:9 | 17 | if True: 18 | x.drop( @@ -107,8 +112,9 @@ error[PD002]: PD002.py:19:9: [*] `inplace=True` should be avoided; it has incons 21 20 | axis=1, 22 21 | ) -error[PD002]: PD002.py:24:33: [*] `inplace=True` should be avoided; it has inconsistent behavior +error[PD002]: 24:33: [*] `inplace=True` should be avoided; it has inconsistent behavior + --> PD002.py:24:33 | 22 | ) 23 | @@ -128,8 +134,9 @@ error[PD002]: PD002.py:24:33: [*] `inplace=True` should be avoided; it has incon 26 26 | f(x.drop(["a"], axis=1, inplace=True)) 27 27 | -error[PD002]: PD002.py:25:23: `inplace=True` should be avoided; it has inconsistent behavior +error[PD002]: 25:23: `inplace=True` should be avoided; it has inconsistent behavior + --> PD002.py:25:23 | 24 | x.drop(["a"], axis=1, **kwargs, inplace=True) 25 | x.drop(["a"], axis=1, inplace=True, **kwargs) @@ -137,8 +144,9 @@ error[PD002]: PD002.py:25:23: `inplace=True` should be avoided; it has inconsist 26 | f(x.drop(["a"], axis=1, inplace=True)) | = help: Assign to variable; remove `inplace` arg -error[PD002]: PD002.py:26:25: `inplace=True` should be avoided; it has inconsistent behavior +error[PD002]: 26:25: `inplace=True` should be avoided; it has inconsistent behavior + --> PD002.py:26:25 | 24 | x.drop(["a"], axis=1, **kwargs, inplace=True) 25 | x.drop(["a"], axis=1, inplace=True, **kwargs) @@ -148,8 +156,9 @@ error[PD002]: PD002.py:26:25: `inplace=True` should be avoided; it has inconsist 28 | x.apply(lambda x: x.sort_values("a", inplace=True)) | = help: Assign to variable; remove `inplace` arg -error[PD002]: PD002.py:28:38: `inplace=True` should be avoided; it has inconsistent behavior +error[PD002]: 28:38: `inplace=True` should be avoided; it has inconsistent behavior + --> PD002.py:28:38 | 26 | f(x.drop(["a"], axis=1, inplace=True)) 27 | @@ -158,8 +167,9 @@ error[PD002]: PD002.py:28:38: `inplace=True` should be avoided; it has inconsist 29 | import torch | = help: Assign to variable; remove `inplace` arg -error[PD002]: PD002.py:33:24: [*] `inplace=True` should be avoided; it has inconsistent behavior +error[PD002]: 33:24: [*] `inplace=True` should be avoided; it has inconsistent behavior + --> PD002.py:33:24 | 31 | torch.m.ReLU(inplace=True) # safe because this isn't a pandas call 32 | diff --git a/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD002_fail.snap b/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD002_fail.snap index 62883aed77..d7cd790e87 100644 --- a/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD002_fail.snap +++ b/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD002_fail.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pandas_vet/mod.rs --- -error[PD002]: :4:23: [*] `inplace=True` should be avoided; it has inconsistent behavior +error[PD002]: 4:23: [*] `inplace=True` should be avoided; it has inconsistent behavior + --> :4:23 | 2 | import pandas as pd 3 | x = pd.DataFrame() diff --git a/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD003_fail.snap b/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD003_fail.snap index 75c1bcf941..8f9b92f79f 100644 --- a/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD003_fail.snap +++ b/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD003_fail.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pandas_vet/mod.rs --- -error[PD003]: :3:9: `.isna` is preferred to `.isnull`; functionality is equivalent +error[PD003]: 3:9: `.isna` is preferred to `.isnull`; functionality is equivalent + --> :3:9 | 2 | import pandas as pd 3 | nulls = pd.isnull(val) diff --git a/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD004_fail.snap b/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD004_fail.snap index 02381c7507..5d0b0b649c 100644 --- a/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD004_fail.snap +++ b/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD004_fail.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pandas_vet/mod.rs --- -error[PD004]: :3:13: `.notna` is preferred to `.notnull`; functionality is equivalent +error[PD004]: 3:13: `.notna` is preferred to `.notnull`; functionality is equivalent + --> :3:13 | 2 | import pandas as pd 3 | not_nulls = pd.notnull(val) diff --git a/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD007_fail.snap b/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD007_fail.snap index 3a317ec4a3..66bbd76d1b 100644 --- a/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD007_fail.snap +++ b/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD007_fail.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pandas_vet/mod.rs --- -error[PD007]: :4:5: `.ix` is deprecated; use more explicit `.loc` or `.iloc` +error[PD007]: 4:5: `.ix` is deprecated; use more explicit `.loc` or `.iloc` + --> :4:5 | 2 | import pandas as pd 3 | x = pd.DataFrame() diff --git a/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD008_fail.snap b/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD008_fail.snap index eaf94baf11..48cb8ee02b 100644 --- a/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD008_fail.snap +++ b/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD008_fail.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pandas_vet/mod.rs --- -error[PD008]: :4:9: Use `.loc` instead of `.at`. If speed is important, use NumPy. +error[PD008]: 4:9: Use `.loc` instead of `.at`. If speed is important, use NumPy. + --> :4:9 | 2 | import pandas as pd 3 | x = pd.DataFrame() diff --git a/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD009_fail.snap b/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD009_fail.snap index ad151214c2..17e2495fc0 100644 --- a/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD009_fail.snap +++ b/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD009_fail.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pandas_vet/mod.rs --- -error[PD009]: :4:9: Use `.iloc` instead of `.iat`. If speed is important, use NumPy. +error[PD009]: 4:9: Use `.iloc` instead of `.iat`. If speed is important, use NumPy. + --> :4:9 | 2 | import pandas as pd 3 | x = pd.DataFrame() diff --git a/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD010_fail_pivot.snap b/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD010_fail_pivot.snap index 5880aafd20..3814ea718b 100644 --- a/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD010_fail_pivot.snap +++ b/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD010_fail_pivot.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pandas_vet/mod.rs --- -error[PD010]: :4:9: `.pivot_table` is preferred to `.pivot` or `.unstack`; provides same functionality +error[PD010]: 4:9: `.pivot_table` is preferred to `.pivot` or `.unstack`; provides same functionality + --> :4:9 | 2 | import pandas as pd 3 | x = pd.DataFrame() diff --git a/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD011_fail_values.snap b/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD011_fail_values.snap index 32d8a448e7..05e2e24a90 100644 --- a/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD011_fail_values.snap +++ b/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD011_fail_values.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pandas_vet/mod.rs --- -error[PD011]: :4:10: Use `.to_numpy()` instead of `.values` +error[PD011]: 4:10: Use `.to_numpy()` instead of `.values` + --> :4:10 | 2 | import pandas as pd 3 | x = pd.DataFrame() diff --git a/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD012_pandas_use_of_dot_read_table.py.snap b/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD012_pandas_use_of_dot_read_table.py.snap index b6323c441b..0238e9bc80 100644 --- a/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD012_pandas_use_of_dot_read_table.py.snap +++ b/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD012_pandas_use_of_dot_read_table.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pandas_vet/mod.rs --- -error[PD012]: pandas_use_of_dot_read_table.py:4:6: Use `.read_csv` instead of `.read_table` to read CSV files +error[PD012]: 4:6: Use `.read_csv` instead of `.read_table` to read CSV files + --> pandas_use_of_dot_read_table.py:4:6 | 3 | # Errors. 4 | df = pd.read_table("data.csv", sep=",") @@ -10,8 +11,9 @@ error[PD012]: pandas_use_of_dot_read_table.py:4:6: Use `.read_csv` instead of `. 5 | df = pd.read_table("data.csv", sep=",", header=0) 6 | filename = "data.csv" | -error[PD012]: pandas_use_of_dot_read_table.py:5:6: Use `.read_csv` instead of `.read_table` to read CSV files +error[PD012]: 5:6: Use `.read_csv` instead of `.read_table` to read CSV files + --> pandas_use_of_dot_read_table.py:5:6 | 3 | # Errors. 4 | df = pd.read_table("data.csv", sep=",") @@ -20,8 +22,9 @@ error[PD012]: pandas_use_of_dot_read_table.py:5:6: Use `.read_csv` instead of `. 6 | filename = "data.csv" 7 | df = pd.read_table(filename, sep=",") | -error[PD012]: pandas_use_of_dot_read_table.py:7:6: Use `.read_csv` instead of `.read_table` to read CSV files +error[PD012]: 7:6: Use `.read_csv` instead of `.read_table` to read CSV files + --> pandas_use_of_dot_read_table.py:7:6 | 5 | df = pd.read_table("data.csv", sep=",", header=0) 6 | filename = "data.csv" @@ -29,8 +32,9 @@ error[PD012]: pandas_use_of_dot_read_table.py:7:6: Use `.read_csv` instead of `. | ^^^^^^^^^^^^^ 8 | df = pd.read_table(filename, sep=",", header=0) | -error[PD012]: pandas_use_of_dot_read_table.py:8:6: Use `.read_csv` instead of `.read_table` to read CSV files +error[PD012]: 8:6: Use `.read_csv` instead of `.read_table` to read CSV files + --> pandas_use_of_dot_read_table.py:8:6 | 6 | filename = "data.csv" 7 | df = pd.read_table(filename, sep=",") diff --git a/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD013_fail_stack.snap b/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD013_fail_stack.snap index 0f8f39bd45..03bfe50d4c 100644 --- a/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD013_fail_stack.snap +++ b/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD013_fail_stack.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pandas_vet/mod.rs --- -error[PD013]: :4:5: `.melt` is preferred to `.stack`; provides same functionality +error[PD013]: 4:5: `.melt` is preferred to `.stack`; provides same functionality + --> :4:5 | 2 | import pandas as pd 3 | x = pd.DataFrame() diff --git a/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD015_fail_merge_on_pandas_object.snap b/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD015_fail_merge_on_pandas_object.snap index 86bb5e5422..12bd23fafe 100644 --- a/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD015_fail_merge_on_pandas_object.snap +++ b/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD015_fail_merge_on_pandas_object.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pandas_vet/mod.rs --- -error[PD015]: :5:1: Use `.merge` method instead of `pd.merge` function. They have equivalent functionality. +error[PD015]: 5:1: Use `.merge` method instead of `pd.merge` function. They have equivalent functionality. + --> :4:19 | 3 | x = pd.DataFrame() 4 | y = pd.DataFrame() diff --git a/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD101_PD101.py.snap b/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD101_PD101.py.snap index 76155fab03..1101e5ce29 100644 --- a/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD101_PD101.py.snap +++ b/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD101_PD101.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pandas_vet/mod.rs --- -error[PD101]: PD101.py:7:1: Using `series.nunique()` for checking that a series is constant is inefficient +error[PD101]: 7:1: Using `series.nunique()` for checking that a series is constant is inefficient + --> PD101.py:6:8 | 6 | # PD101 7 | data.nunique() <= 1 @@ -10,8 +11,9 @@ error[PD101]: PD101.py:7:1: Using `series.nunique()` for checking that a series 8 | data.nunique(dropna=True) <= 1 9 | data.nunique(dropna=False) <= 1 | -error[PD101]: PD101.py:8:1: Using `series.nunique()` for checking that a series is constant is inefficient +error[PD101]: 8:1: Using `series.nunique()` for checking that a series is constant is inefficient + --> PD101.py:7:20 | 6 | # PD101 7 | data.nunique() <= 1 @@ -20,8 +22,9 @@ error[PD101]: PD101.py:8:1: Using `series.nunique()` for checking that a series 9 | data.nunique(dropna=False) <= 1 10 | data.nunique() == 1 | -error[PD101]: PD101.py:9:1: Using `series.nunique()` for checking that a series is constant is inefficient +error[PD101]: 9:1: Using `series.nunique()` for checking that a series is constant is inefficient + --> PD101.py:8:31 | 7 | data.nunique() <= 1 8 | data.nunique(dropna=True) <= 1 @@ -30,8 +33,9 @@ error[PD101]: PD101.py:9:1: Using `series.nunique()` for checking that a series 10 | data.nunique() == 1 11 | data.nunique(dropna=True) == 1 | -error[PD101]: PD101.py:10:1: Using `series.nunique()` for checking that a series is constant is inefficient +error[PD101]: 10:1: Using `series.nunique()` for checking that a series is constant is inefficient + --> PD101.py:9:32 | 8 | data.nunique(dropna=True) <= 1 9 | data.nunique(dropna=False) <= 1 @@ -40,8 +44,9 @@ error[PD101]: PD101.py:10:1: Using `series.nunique()` for checking that a series 11 | data.nunique(dropna=True) == 1 12 | data.nunique(dropna=False) == 1 | -error[PD101]: PD101.py:11:1: Using `series.nunique()` for checking that a series is constant is inefficient +error[PD101]: 11:1: Using `series.nunique()` for checking that a series is constant is inefficient + --> PD101.py:10:20 | 9 | data.nunique(dropna=False) <= 1 10 | data.nunique() == 1 @@ -50,8 +55,9 @@ error[PD101]: PD101.py:11:1: Using `series.nunique()` for checking that a series 12 | data.nunique(dropna=False) == 1 13 | data.nunique() != 1 | -error[PD101]: PD101.py:12:1: Using `series.nunique()` for checking that a series is constant is inefficient +error[PD101]: 12:1: Using `series.nunique()` for checking that a series is constant is inefficient + --> PD101.py:11:31 | 10 | data.nunique() == 1 11 | data.nunique(dropna=True) == 1 @@ -60,8 +66,9 @@ error[PD101]: PD101.py:12:1: Using `series.nunique()` for checking that a series 13 | data.nunique() != 1 14 | data.nunique(dropna=True) != 1 | -error[PD101]: PD101.py:13:1: Using `series.nunique()` for checking that a series is constant is inefficient +error[PD101]: 13:1: Using `series.nunique()` for checking that a series is constant is inefficient + --> PD101.py:12:32 | 11 | data.nunique(dropna=True) == 1 12 | data.nunique(dropna=False) == 1 @@ -70,8 +77,9 @@ error[PD101]: PD101.py:13:1: Using `series.nunique()` for checking that a series 14 | data.nunique(dropna=True) != 1 15 | data.nunique(dropna=False) != 1 | -error[PD101]: PD101.py:14:1: Using `series.nunique()` for checking that a series is constant is inefficient +error[PD101]: 14:1: Using `series.nunique()` for checking that a series is constant is inefficient + --> PD101.py:13:20 | 12 | data.nunique(dropna=False) == 1 13 | data.nunique() != 1 @@ -80,8 +88,9 @@ error[PD101]: PD101.py:14:1: Using `series.nunique()` for checking that a series 15 | data.nunique(dropna=False) != 1 16 | data.nunique() > 1 | -error[PD101]: PD101.py:15:1: Using `series.nunique()` for checking that a series is constant is inefficient +error[PD101]: 15:1: Using `series.nunique()` for checking that a series is constant is inefficient + --> PD101.py:14:31 | 13 | data.nunique() != 1 14 | data.nunique(dropna=True) != 1 @@ -90,8 +99,9 @@ error[PD101]: PD101.py:15:1: Using `series.nunique()` for checking that a series 16 | data.nunique() > 1 17 | data.dropna().nunique() == 1 | -error[PD101]: PD101.py:16:1: Using `series.nunique()` for checking that a series is constant is inefficient +error[PD101]: 16:1: Using `series.nunique()` for checking that a series is constant is inefficient + --> PD101.py:15:32 | 14 | data.nunique(dropna=True) != 1 15 | data.nunique(dropna=False) != 1 @@ -100,8 +110,9 @@ error[PD101]: PD101.py:16:1: Using `series.nunique()` for checking that a series 17 | data.dropna().nunique() == 1 18 | data[data.notnull()].nunique() == 1 | -error[PD101]: PD101.py:17:1: Using `series.nunique()` for checking that a series is constant is inefficient +error[PD101]: 17:1: Using `series.nunique()` for checking that a series is constant is inefficient + --> PD101.py:16:19 | 15 | data.nunique(dropna=False) != 1 16 | data.nunique() > 1 @@ -109,8 +120,9 @@ error[PD101]: PD101.py:17:1: Using `series.nunique()` for checking that a series | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 18 | data[data.notnull()].nunique() == 1 | -error[PD101]: PD101.py:18:1: Using `series.nunique()` for checking that a series is constant is inefficient +error[PD101]: 18:1: Using `series.nunique()` for checking that a series is constant is inefficient + --> PD101.py:17:29 | 16 | data.nunique() > 1 17 | data.dropna().nunique() == 1 diff --git a/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD901_fail_df_var.snap b/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD901_fail_df_var.snap index 2488bbe9d5..4b4eb35680 100644 --- a/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD901_fail_df_var.snap +++ b/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD901_fail_df_var.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pandas_vet/mod.rs --- -error[PD901]: :3:1: Avoid using the generic variable name `df` for DataFrames +error[PD901]: 3:1: Avoid using the generic variable name `df` for DataFrames + --> :2:20 | 2 | import pandas as pd 3 | df = pd.DataFrame() diff --git a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N801_N801.py.snap b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N801_N801.py.snap index 71cba6eaa5..104ac06dad 100644 --- a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N801_N801.py.snap +++ b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N801_N801.py.snap @@ -1,36 +1,41 @@ --- source: crates/ruff_linter/src/rules/pep8_naming/mod.rs --- -error[N801]: N801.py:1:7: Class name `bad` should use CapWords convention +error[N801]: 1:7: Class name `bad` should use CapWords convention + --> N801.py:1:7 | 1 | class bad: | ^^^ 2 | pass | -error[N801]: N801.py:5:7: Class name `_bad` should use CapWords convention +error[N801]: 5:7: Class name `_bad` should use CapWords convention + --> N801.py:5:7 | 5 | class _bad: | ^^^^ 6 | pass | -error[N801]: N801.py:9:7: Class name `bad_class` should use CapWords convention +error[N801]: 9:7: Class name `bad_class` should use CapWords convention + --> N801.py:9:7 | 9 | class bad_class: | ^^^^^^^^^ 10 | pass | -error[N801]: N801.py:13:7: Class name `Bad_Class` should use CapWords convention +error[N801]: 13:7: Class name `Bad_Class` should use CapWords convention + --> N801.py:13:7 | 13 | class Bad_Class: | ^^^^^^^^^ 14 | pass | -error[N801]: N801.py:17:7: Class name `BAD_CLASS` should use CapWords convention +error[N801]: 17:7: Class name `BAD_CLASS` should use CapWords convention + --> N801.py:17:7 | 17 | class BAD_CLASS: | ^^^^^^^^^ diff --git a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N802_N802.py.snap b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N802_N802.py.snap index b87458d479..3a8daf63d0 100644 --- a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N802_N802.py.snap +++ b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N802_N802.py.snap @@ -1,36 +1,41 @@ --- source: crates/ruff_linter/src/rules/pep8_naming/mod.rs --- -error[N802]: N802.py:4:5: Function name `Bad` should be lowercase +error[N802]: 4:5: Function name `Bad` should be lowercase + --> N802.py:4:5 | 4 | def Bad(): | ^^^ 5 | pass | -error[N802]: N802.py:8:5: Function name `_Bad` should be lowercase +error[N802]: 8:5: Function name `_Bad` should be lowercase + --> N802.py:8:5 | 8 | def _Bad(): | ^^^^ 9 | pass | -error[N802]: N802.py:12:5: Function name `BAD` should be lowercase +error[N802]: 12:5: Function name `BAD` should be lowercase + --> N802.py:12:5 | 12 | def BAD(): | ^^^ 13 | pass | -error[N802]: N802.py:16:5: Function name `BAD_FUNC` should be lowercase +error[N802]: 16:5: Function name `BAD_FUNC` should be lowercase + --> N802.py:16:5 | 16 | def BAD_FUNC(): | ^^^^^^^^ 17 | pass | -error[N802]: N802.py:40:9: Function name `testTest` should be lowercase +error[N802]: 40:9: Function name `testTest` should be lowercase + --> N802.py:40:9 | 38 | return super().tearDown() 39 | diff --git a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N803_N803.py.snap b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N803_N803.py.snap index 50f71bae0a..d69d3d97e0 100644 --- a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N803_N803.py.snap +++ b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N803_N803.py.snap @@ -1,15 +1,17 @@ --- source: crates/ruff_linter/src/rules/pep8_naming/mod.rs --- -error[N803]: N803.py:1:16: Argument name `A` should be lowercase +error[N803]: 1:16: Argument name `A` should be lowercase + --> N803.py:1:16 | 1 | def func(_, a, A): | ^ 2 | return _, a, A | -error[N803]: N803.py:6:28: Argument name `A` should be lowercase +error[N803]: 6:28: Argument name `A` should be lowercase + --> N803.py:6:28 | 5 | class Class: 6 | def method(self, _, a, A): diff --git a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N804_N804.py.snap b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N804_N804.py.snap index 90c618520b..afd31d81c0 100644 --- a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N804_N804.py.snap +++ b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N804_N804.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pep8_naming/mod.rs --- -error[N804]: N804.py:30:27: [*] First argument of a class method should be named `cls` +error[N804]: 30:27: [*] First argument of a class method should be named `cls` + --> N804.py:30:27 | 28 | ... 29 | @@ -21,8 +22,9 @@ error[N804]: N804.py:30:27: [*] First argument of a class method should be named 32 32 | 33 33 | @classmethod -error[N804]: N804.py:38:56: [*] First argument of a class method should be named `cls` +error[N804]: 38:56: [*] First argument of a class method should be named `cls` + --> N804.py:38:56 | 37 | @classmethod 38 | def bad_class_method_with_positional_only_argument(self, x, /, other): @@ -40,8 +42,9 @@ error[N804]: N804.py:38:56: [*] First argument of a class method should be named 40 40 | 41 41 | -error[N804]: N804.py:43:20: [*] First argument of a class method should be named `cls` +error[N804]: 43:20: [*] First argument of a class method should be named `cls` + --> N804.py:43:20 | 42 | class MetaClass(ABCMeta): 43 | def bad_method(self): @@ -59,8 +62,9 @@ error[N804]: N804.py:43:20: [*] First argument of a class method should be named 45 45 | 46 46 | def good_method(cls): -error[N804]: N804.py:54:25: First argument of a class method should be named `cls` +error[N804]: 54:25: First argument of a class method should be named `cls` + --> N804.py:54:25 | 53 | class ClsInArgsClass(ABCMeta): 54 | def cls_as_argument(this, cls): @@ -68,8 +72,9 @@ error[N804]: N804.py:54:25: First argument of a class method should be named `cl 55 | pass | = help: Rename `this` to `cls` -error[N804]: N804.py:57:34: First argument of a class method should be named `cls` +error[N804]: 57:34: First argument of a class method should be named `cls` + --> N804.py:57:34 | 55 | pass 56 | @@ -78,8 +83,9 @@ error[N804]: N804.py:57:34: First argument of a class method should be named `cl 58 | pass | = help: Rename `this` to `cls` -error[N804]: N804.py:60:33: First argument of a class method should be named `cls` +error[N804]: 60:33: First argument of a class method should be named `cls` + --> N804.py:60:33 | 58 | pass 59 | @@ -88,8 +94,9 @@ error[N804]: N804.py:60:33: First argument of a class method should be named `cl 61 | pass | = help: Rename `this` to `cls` -error[N804]: N804.py:63:23: First argument of a class method should be named `cls` +error[N804]: 63:23: First argument of a class method should be named `cls` + --> N804.py:63:23 | 61 | pass 62 | @@ -98,8 +105,9 @@ error[N804]: N804.py:63:23: First argument of a class method should be named `cl 64 | pass | = help: Rename `this` to `cls` -error[N804]: N804.py:66:23: First argument of a class method should be named `cls` +error[N804]: 66:23: First argument of a class method should be named `cls` + --> N804.py:66:23 | 64 | pass 65 | @@ -108,8 +116,9 @@ error[N804]: N804.py:66:23: First argument of a class method should be named `cl 67 | pass | = help: Rename `this` to `cls` -error[N804]: N804.py:70:20: [*] First argument of a class method should be named `cls` +error[N804]: 70:20: [*] First argument of a class method should be named `cls` + --> N804.py:70:20 | 69 | class RenamingInMethodBodyClass(ABCMeta): 70 | def bad_method(this): @@ -132,8 +141,9 @@ error[N804]: N804.py:70:20: [*] First argument of a class method should be named 74 74 | def bad_method(this): 75 75 | self = this -error[N804]: N804.py:74:20: [*] First argument of a class method should be named `cls` +error[N804]: 74:20: [*] First argument of a class method should be named `cls` + --> N804.py:74:20 | 72 | this 73 | diff --git a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N805_N805.py.snap b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N805_N805.py.snap index 480d81d01d..bac06c42e0 100644 --- a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N805_N805.py.snap +++ b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N805_N805.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pep8_naming/mod.rs --- -error[N805]: N805.py:7:20: [*] First argument of a method should be named `self` +error[N805]: 7:20: [*] First argument of a method should be named `self` + --> N805.py:7:20 | 6 | class Class: 7 | def bad_method(this): @@ -20,8 +21,9 @@ error[N805]: N805.py:7:20: [*] First argument of a method should be named `self` 9 9 | 10 10 | if False: -error[N805]: N805.py:11:30: [*] First argument of a method should be named `self` +error[N805]: 11:30: [*] First argument of a method should be named `self` + --> N805.py:11:30 | 10 | if False: 11 | def extra_bad_method(this): @@ -39,8 +41,9 @@ error[N805]: N805.py:11:30: [*] First argument of a method should be named `self 13 13 | 14 14 | def good_method(self): -error[N805]: N805.py:30:15: [*] First argument of a method should be named `self` +error[N805]: 30:15: [*] First argument of a method should be named `self` + --> N805.py:30:15 | 29 | @pydantic.validator 30 | def lower(cls, my_field: str) -> str: @@ -58,8 +61,9 @@ error[N805]: N805.py:30:15: [*] First argument of a method should be named `self 32 32 | 33 33 | @pydantic.validator("my_field") -error[N805]: N805.py:34:15: [*] First argument of a method should be named `self` +error[N805]: 34:15: [*] First argument of a method should be named `self` + --> N805.py:34:15 | 33 | @pydantic.validator("my_field") 34 | def lower(cls, my_field: str) -> str: @@ -77,8 +81,9 @@ error[N805]: N805.py:34:15: [*] First argument of a method should be named `self 36 36 | 37 37 | def __init__(self): -error[N805]: N805.py:63:29: [*] First argument of a method should be named `self` +error[N805]: 63:29: [*] First argument of a method should be named `self` + --> N805.py:63:29 | 61 | pass 62 | @@ -97,8 +102,9 @@ error[N805]: N805.py:63:29: [*] First argument of a method should be named `self 65 65 | 66 66 | -error[N805]: N805.py:69:13: [*] First argument of a method should be named `self` +error[N805]: 69:13: [*] First argument of a method should be named `self` + --> N805.py:69:13 | 67 | class ModelClass: 68 | @hybrid_property @@ -117,8 +123,9 @@ error[N805]: N805.py:69:13: [*] First argument of a method should be named `self 71 71 | 72 72 | @bad.expression -error[N805]: N805.py:77:13: [*] First argument of a method should be named `self` +error[N805]: 77:13: [*] First argument of a method should be named `self` + --> N805.py:77:13 | 76 | @bad.wtf 77 | def bad(cls): @@ -136,8 +143,9 @@ error[N805]: N805.py:77:13: [*] First argument of a method should be named `self 79 79 | 80 80 | @hybrid_property -error[N805]: N805.py:85:14: [*] First argument of a method should be named `self` +error[N805]: 85:14: [*] First argument of a method should be named `self` + --> N805.py:85:14 | 84 | @good.expression 85 | def good(cls): @@ -155,8 +163,9 @@ error[N805]: N805.py:85:14: [*] First argument of a method should be named `self 87 87 | 88 88 | @good.wtf -error[N805]: N805.py:93:19: [*] First argument of a method should be named `self` +error[N805]: 93:19: [*] First argument of a method should be named `self` + --> N805.py:93:19 | 92 | @foobar.thisisstatic 93 | def badstatic(foo): @@ -174,8 +183,9 @@ error[N805]: N805.py:93:19: [*] First argument of a method should be named `self 95 95 | 96 96 | -error[N805]: N805.py:98:26: First argument of a method should be named `self` +error[N805]: 98:26: First argument of a method should be named `self` + --> N805.py:98:26 | 97 | class SelfInArgsClass: 98 | def self_as_argument(this, self): @@ -183,8 +193,9 @@ error[N805]: N805.py:98:26: First argument of a method should be named `self` 99 | pass | = help: Rename `this` to `self` -error[N805]: N805.py:101:35: First argument of a method should be named `self` +error[N805]: 101:35: First argument of a method should be named `self` + --> N805.py:101:35 | 99 | pass 100 | @@ -193,8 +204,9 @@ error[N805]: N805.py:101:35: First argument of a method should be named `self` 102 | pass | = help: Rename `this` to `self` -error[N805]: N805.py:104:34: First argument of a method should be named `self` +error[N805]: 104:34: First argument of a method should be named `self` + --> N805.py:104:34 | 102 | pass 103 | @@ -203,8 +215,9 @@ error[N805]: N805.py:104:34: First argument of a method should be named `self` 105 | pass | = help: Rename `this` to `self` -error[N805]: N805.py:107:24: First argument of a method should be named `self` +error[N805]: 107:24: First argument of a method should be named `self` + --> N805.py:107:24 | 105 | pass 106 | @@ -213,8 +226,9 @@ error[N805]: N805.py:107:24: First argument of a method should be named `self` 108 | pass | = help: Rename `this` to `self` -error[N805]: N805.py:110:24: First argument of a method should be named `self` +error[N805]: 110:24: First argument of a method should be named `self` + --> N805.py:110:24 | 108 | pass 109 | @@ -223,8 +237,9 @@ error[N805]: N805.py:110:24: First argument of a method should be named `self` 111 | pass | = help: Rename `this` to `self` -error[N805]: N805.py:115:20: [*] First argument of a method should be named `self` +error[N805]: 115:20: [*] First argument of a method should be named `self` + --> N805.py:115:20 | 114 | class RenamingInMethodBodyClass: 115 | def bad_method(this): @@ -247,8 +262,9 @@ error[N805]: N805.py:115:20: [*] First argument of a method should be named `sel 119 119 | def bad_method(this): 120 120 | self = this -error[N805]: N805.py:119:20: [*] First argument of a method should be named `self` +error[N805]: 119:20: [*] First argument of a method should be named `self` + --> N805.py:119:20 | 117 | this 118 | @@ -269,8 +285,9 @@ error[N805]: N805.py:119:20: [*] First argument of a method should be named `sel 122 122 | 123 123 | class RenamingWithNFKC: -error[N805]: N805.py:124:17: [*] First argument of a method should be named `self` +error[N805]: 124:17: [*] First argument of a method should be named `self` + --> N805.py:124:17 | 123 | class RenamingWithNFKC: 124 | def formula(household): diff --git a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N806_N806.py.snap b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N806_N806.py.snap index 2702f7b1d9..72bd362701 100644 --- a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N806_N806.py.snap +++ b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N806_N806.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pep8_naming/mod.rs --- -error[N806]: N806.py:12:5: Variable `Camel` in function should be lowercase +error[N806]: 12:5: Variable `Camel` in function should be lowercase + --> N806.py:12:5 | 10 | GLOBAL = "bar" 11 | lower = 0 @@ -11,8 +12,9 @@ error[N806]: N806.py:12:5: Variable `Camel` in function should be lowercase 13 | CONSTANT = 0 14 | _ = 0 | -error[N806]: N806.py:13:5: Variable `CONSTANT` in function should be lowercase +error[N806]: 13:5: Variable `CONSTANT` in function should be lowercase + --> N806.py:13:5 | 11 | lower = 0 12 | Camel = 0 @@ -20,8 +22,9 @@ error[N806]: N806.py:13:5: Variable `CONSTANT` in function should be lowercase | ^^^^^^^^ 14 | _ = 0 | -error[N806]: N806.py:46:5: Variable `Bad` in function should be lowercase +error[N806]: 46:5: Variable `Bad` in function should be lowercase + --> N806.py:46:5 | 45 | def model_assign() -> None: 46 | Bad = apps.get_model("zerver", "Stream") # N806 @@ -29,8 +32,9 @@ error[N806]: N806.py:46:5: Variable `Bad` in function should be lowercase 47 | Attachment = apps.get_model("zerver", "Attachment") # OK 48 | Recipient = apps.get_model("zerver", model_name="Recipient") # OK | -error[N806]: N806.py:53:5: Variable `Bad` in function should be lowercase +error[N806]: 53:5: Variable `Bad` in function should be lowercase + --> N806.py:53:5 | 51 | from django.utils.module_loading import import_string 52 | @@ -38,8 +42,9 @@ error[N806]: N806.py:53:5: Variable `Bad` in function should be lowercase | ^^^ 54 | ValidationError = import_string("django.core.exceptions.ValidationError") # OK | -error[N806]: N806.py:56:5: Variable `Bad` in function should be lowercase +error[N806]: 56:5: Variable `Bad` in function should be lowercase + --> N806.py:56:5 | 54 | ValidationError = import_string("django.core.exceptions.ValidationError") # OK 55 | @@ -47,8 +52,9 @@ error[N806]: N806.py:56:5: Variable `Bad` in function should be lowercase | ^^^ 57 | Bad = apps.get_model(model_name="Stream") # N806 | -error[N806]: N806.py:57:5: Variable `Bad` in function should be lowercase +error[N806]: 57:5: Variable `Bad` in function should be lowercase + --> N806.py:57:5 | 56 | Bad = apps.get_model() # N806 57 | Bad = apps.get_model(model_name="Stream") # N806 @@ -56,8 +62,9 @@ error[N806]: N806.py:57:5: Variable `Bad` in function should be lowercase 58 | 59 | Address: Type = apps.get_model("zerver", variable) # OK | -error[N806]: N806.py:60:5: Variable `ValidationError` in function should be lowercase +error[N806]: 60:5: Variable `ValidationError` in function should be lowercase + --> N806.py:60:5 | 59 | Address: Type = apps.get_model("zerver", variable) # OK 60 | ValidationError = import_string(variable) # N806 diff --git a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N807_N807.py.snap b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N807_N807.py.snap index 89befdb8d4..69a01ac68c 100644 --- a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N807_N807.py.snap +++ b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N807_N807.py.snap @@ -1,15 +1,17 @@ --- source: crates/ruff_linter/src/rules/pep8_naming/mod.rs --- -error[N807]: N807.py:1:5: Function name should not start and end with `__` +error[N807]: 1:5: Function name should not start and end with `__` + --> N807.py:1:5 | 1 | def __bad__(): | ^^^^^^^ 2 | pass | -error[N807]: N807.py:14:9: Function name should not start and end with `__` +error[N807]: 14:9: Function name should not start and end with `__` + --> N807.py:14:9 | 13 | def nested(): 14 | def __bad__(): diff --git a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N811_N811.py.snap b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N811_N811.py.snap index 512ac1ba33..8fd44eb264 100644 --- a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N811_N811.py.snap +++ b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N811_N811.py.snap @@ -1,24 +1,27 @@ --- source: crates/ruff_linter/src/rules/pep8_naming/mod.rs --- -error[N811]: N811.py:1:8: Constant `CONST` imported as non-constant `const` +error[N811]: 1:8: Constant `CONST` imported as non-constant `const` + --> N811.py:1:8 | 1 | import mod.CONST as const | ^^^^^^^^^^^^^^^^^^ 2 | from mod import CONSTANT as constant 3 | from mod import ANOTHER_CONSTANT as another_constant | -error[N811]: N811.py:2:17: Constant `CONSTANT` imported as non-constant `constant` +error[N811]: 2:17: Constant `CONSTANT` imported as non-constant `constant` + --> N811.py:2:17 | 1 | import mod.CONST as const 2 | from mod import CONSTANT as constant | ^^^^^^^^^^^^^^^^^^^^ 3 | from mod import ANOTHER_CONSTANT as another_constant | -error[N811]: N811.py:3:17: Constant `ANOTHER_CONSTANT` imported as non-constant `another_constant` +error[N811]: 3:17: Constant `ANOTHER_CONSTANT` imported as non-constant `another_constant` + --> N811.py:3:17 | 1 | import mod.CONST as const 2 | from mod import CONSTANT as constant diff --git a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N812_N812.py.snap b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N812_N812.py.snap index 5aa84e21f0..75dddd2112 100644 --- a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N812_N812.py.snap +++ b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N812_N812.py.snap @@ -1,24 +1,27 @@ --- source: crates/ruff_linter/src/rules/pep8_naming/mod.rs --- -error[N812]: N812.py:1:8: Lowercase `lowercase` imported as non-lowercase `Lower` +error[N812]: 1:8: Lowercase `lowercase` imported as non-lowercase `Lower` + --> N812.py:1:8 | 1 | import modl.lowercase as Lower | ^^^^^^^^^^^^^^^^^^^^^^^ 2 | from mod import lowercase as Lowercase 3 | from mod import another_lowercase as AnotherLowercase | -error[N812]: N812.py:2:17: Lowercase `lowercase` imported as non-lowercase `Lowercase` +error[N812]: 2:17: Lowercase `lowercase` imported as non-lowercase `Lowercase` + --> N812.py:2:17 | 1 | import modl.lowercase as Lower 2 | from mod import lowercase as Lowercase | ^^^^^^^^^^^^^^^^^^^^^^ 3 | from mod import another_lowercase as AnotherLowercase | -error[N812]: N812.py:3:17: Lowercase `another_lowercase` imported as non-lowercase `AnotherLowercase` +error[N812]: 3:17: Lowercase `another_lowercase` imported as non-lowercase `AnotherLowercase` + --> N812.py:3:17 | 1 | import modl.lowercase as Lower 2 | from mod import lowercase as Lowercase diff --git a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N813_N813.py.snap b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N813_N813.py.snap index b485f98070..799c3e2315 100644 --- a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N813_N813.py.snap +++ b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N813_N813.py.snap @@ -1,24 +1,27 @@ --- source: crates/ruff_linter/src/rules/pep8_naming/mod.rs --- -error[N813]: N813.py:1:8: Camelcase `Camel` imported as lowercase `camel` +error[N813]: 1:8: Camelcase `Camel` imported as lowercase `camel` + --> N813.py:1:8 | 1 | import mod.Camel as camel | ^^^^^^^^^^^^^^^^^^ 2 | from mod import CamelCase as camelcase 3 | from mod import AnotherCamelCase as another_camelcase | -error[N813]: N813.py:2:17: Camelcase `CamelCase` imported as lowercase `camelcase` +error[N813]: 2:17: Camelcase `CamelCase` imported as lowercase `camelcase` + --> N813.py:2:17 | 1 | import mod.Camel as camel 2 | from mod import CamelCase as camelcase | ^^^^^^^^^^^^^^^^^^^^^^ 3 | from mod import AnotherCamelCase as another_camelcase | -error[N813]: N813.py:3:17: Camelcase `AnotherCamelCase` imported as lowercase `another_camelcase` +error[N813]: 3:17: Camelcase `AnotherCamelCase` imported as lowercase `another_camelcase` + --> N813.py:3:17 | 1 | import mod.Camel as camel 2 | from mod import CamelCase as camelcase diff --git a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N814_N814.py.snap b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N814_N814.py.snap index afb31507e5..0d5899b3d8 100644 --- a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N814_N814.py.snap +++ b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N814_N814.py.snap @@ -1,24 +1,27 @@ --- source: crates/ruff_linter/src/rules/pep8_naming/mod.rs --- -error[N814]: N814.py:1:8: Camelcase `Camel` imported as constant `CAMEL` +error[N814]: 1:8: Camelcase `Camel` imported as constant `CAMEL` + --> N814.py:1:8 | 1 | import mod.Camel as CAMEL | ^^^^^^^^^^^^^^^^^^ 2 | from mod import CamelCase as CAMELCASE 3 | from mod import AnotherCamelCase as ANOTHER_CAMELCASE | -error[N814]: N814.py:2:17: Camelcase `CamelCase` imported as constant `CAMELCASE` +error[N814]: 2:17: Camelcase `CamelCase` imported as constant `CAMELCASE` + --> N814.py:2:17 | 1 | import mod.Camel as CAMEL 2 | from mod import CamelCase as CAMELCASE | ^^^^^^^^^^^^^^^^^^^^^^ 3 | from mod import AnotherCamelCase as ANOTHER_CAMELCASE | -error[N814]: N814.py:3:17: Camelcase `AnotherCamelCase` imported as constant `ANOTHER_CAMELCASE` +error[N814]: 3:17: Camelcase `AnotherCamelCase` imported as constant `ANOTHER_CAMELCASE` + --> N814.py:3:17 | 1 | import mod.Camel as CAMEL 2 | from mod import CamelCase as CAMELCASE diff --git a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N815_N815.py.snap b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N815_N815.py.snap index 7665edb591..9388ad2a7f 100644 --- a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N815_N815.py.snap +++ b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N815_N815.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pep8_naming/mod.rs --- -error[N815]: N815.py:9:5: Variable `mixedCase` in class scope should not be mixedCase +error[N815]: 9:5: Variable `mixedCase` in class scope should not be mixedCase + --> N815.py:9:5 | 7 | lower = 0 8 | CONSTANT = 0 @@ -11,8 +12,9 @@ error[N815]: N815.py:9:5: Variable `mixedCase` in class scope should not be mixe 10 | _mixedCase = 0 11 | mixed_Case = 0 | -error[N815]: N815.py:10:5: Variable `_mixedCase` in class scope should not be mixedCase +error[N815]: 10:5: Variable `_mixedCase` in class scope should not be mixedCase + --> N815.py:10:5 | 8 | CONSTANT = 0 9 | mixedCase = 0 @@ -21,8 +23,9 @@ error[N815]: N815.py:10:5: Variable `_mixedCase` in class scope should not be mi 11 | mixed_Case = 0 12 | myObj1 = collections.namedtuple("MyObj1", ["a", "b"]) | -error[N815]: N815.py:11:5: Variable `mixed_Case` in class scope should not be mixedCase +error[N815]: 11:5: Variable `mixed_Case` in class scope should not be mixedCase + --> N815.py:11:5 | 9 | mixedCase = 0 10 | _mixedCase = 0 diff --git a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N816_N816.py.snap b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N816_N816.py.snap index 2471cb29e2..ad834079a4 100644 --- a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N816_N816.py.snap +++ b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N816_N816.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pep8_naming/mod.rs --- -error[N816]: N816.py:7:1: Variable `mixedCase` in global scope should not be mixedCase +error[N816]: 7:1: Variable `mixedCase` in global scope should not be mixedCase + --> N816.py:6:13 | 5 | lower = 0 6 | CONSTANT = 0 @@ -11,8 +12,9 @@ error[N816]: N816.py:7:1: Variable `mixedCase` in global scope should not be mix 8 | _mixedCase = 0 9 | mixed_Case = 0 | -error[N816]: N816.py:8:1: Variable `_mixedCase` in global scope should not be mixedCase +error[N816]: 8:1: Variable `_mixedCase` in global scope should not be mixedCase + --> N816.py:7:14 | 6 | CONSTANT = 0 7 | mixedCase = 0 @@ -21,8 +23,9 @@ error[N816]: N816.py:8:1: Variable `_mixedCase` in global scope should not be mi 9 | mixed_Case = 0 10 | myObj1 = collections.namedtuple("MyObj1", ["a", "b"]) | -error[N816]: N816.py:9:1: Variable `mixed_Case` in global scope should not be mixedCase +error[N816]: 9:1: Variable `mixed_Case` in global scope should not be mixedCase + --> N816.py:8:15 | 7 | mixedCase = 0 8 | _mixedCase = 0 diff --git a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N817_N817.py.snap b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N817_N817.py.snap index 63fa4b0f16..643b4fd849 100644 --- a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N817_N817.py.snap +++ b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N817_N817.py.snap @@ -1,23 +1,27 @@ --- source: crates/ruff_linter/src/rules/pep8_naming/mod.rs --- -N817.py:1:8: N817 CamelCase `CaMel` imported as acronym `CM` +error[N817]: 1:8: CamelCase `CaMel` imported as acronym `CM` + + --> N817.py:1:8 | 1 | import mod.CaMel as CM - | ^^^^^^^^^^^^^^^ N817 + | ^^^^^^^^^^^^^^^ 2 | from mod import CamelCase as CC | +error[N817]: 2:17: CamelCase `CamelCase` imported as acronym `CC` -N817.py:2:17: N817 CamelCase `CamelCase` imported as acronym `CC` + --> N817.py:2:17 | 1 | import mod.CaMel as CM 2 | from mod import CamelCase as CC - | ^^^^^^^^^^^^^^^ N817 + | ^^^^^^^^^^^^^^^ | +error[N817]: 10:26: CamelCase `ElementTree` imported as acronym `ET` -N817.py:10:26: N817 CamelCase `ElementTree` imported as acronym `ET` + --> N817.py:10:26 | 9 | # Always an error (relative import) 10 | from ..xml.eltree import ElementTree as ET - | ^^^^^^^^^^^^^^^^^ N817 + | ^^^^^^^^^^^^^^^^^ | diff --git a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N818_N818.py.snap b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N818_N818.py.snap index eebaa7aa49..9d46cf1969 100644 --- a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N818_N818.py.snap +++ b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N818_N818.py.snap @@ -1,15 +1,17 @@ --- source: crates/ruff_linter/src/rules/pep8_naming/mod.rs --- -error[N818]: N818.py:9:7: Exception name `C` should be named with an Error suffix +error[N818]: 9:7: Exception name `C` should be named with an Error suffix + --> N818.py:9:7 | 9 | class C(Exception): | ^ 10 | pass | -error[N818]: N818.py:17:7: Exception name `E` should be named with an Error suffix +error[N818]: 17:7: Exception name `E` should be named with an Error suffix + --> N818.py:17:7 | 17 | class E(AnotherError): | ^ diff --git a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N999_N999__module__MODULE____init__.py.snap b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N999_N999__module__MODULE____init__.py.snap index d1796d8cb2..551bf62516 100644 --- a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N999_N999__module__MODULE____init__.py.snap +++ b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N999_N999__module__MODULE____init__.py.snap @@ -1,4 +1,4 @@ --- source: crates/ruff_linter/src/rules/pep8_naming/mod.rs --- -__init__.py:1:1: N999 Invalid module name: 'MODULE' +error[N999]: 1:1: Invalid module name: 'MODULE' diff --git a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N999_N999__module__invalid_name__0001_initial.py.snap b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N999_N999__module__invalid_name__0001_initial.py.snap index b173f1cdd9..c34c94bb23 100644 --- a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N999_N999__module__invalid_name__0001_initial.py.snap +++ b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N999_N999__module__invalid_name__0001_initial.py.snap @@ -1,4 +1,4 @@ --- source: crates/ruff_linter/src/rules/pep8_naming/mod.rs --- -0001_initial.py:1:1: N999 Invalid module name: '0001_initial' +error[N999]: 1:1: Invalid module name: '0001_initial' diff --git a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N999_N999__module__invalid_name__import.py.snap b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N999_N999__module__invalid_name__import.py.snap index ba4c79f6d5..176f919735 100644 --- a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N999_N999__module__invalid_name__import.py.snap +++ b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N999_N999__module__invalid_name__import.py.snap @@ -1,4 +1,4 @@ --- source: crates/ruff_linter/src/rules/pep8_naming/mod.rs --- -import.py:1:1: N999 Invalid module name: 'import' +error[N999]: 1:1: Invalid module name: 'import' diff --git a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N999_N999__module__mod with spaces____init__.py.snap b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N999_N999__module__mod with spaces____init__.py.snap index 9a3176db80..685752c3a1 100644 --- a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N999_N999__module__mod with spaces____init__.py.snap +++ b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N999_N999__module__mod with spaces____init__.py.snap @@ -1,4 +1,4 @@ --- source: crates/ruff_linter/src/rules/pep8_naming/mod.rs --- -__init__.py:1:1: N999 Invalid module name: 'mod with spaces' +error[N999]: 1:1: Invalid module name: 'mod with spaces' diff --git a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N999_N999__module__mod-with-dashes____init__.py.snap b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N999_N999__module__mod-with-dashes____init__.py.snap index f9bd14831b..aacb5a3f94 100644 --- a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N999_N999__module__mod-with-dashes____init__.py.snap +++ b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N999_N999__module__mod-with-dashes____init__.py.snap @@ -1,4 +1,4 @@ --- source: crates/ruff_linter/src/rules/pep8_naming/mod.rs --- -__init__.py:1:1: N999 Invalid module name: 'mod-with-dashes' +error[N999]: 1:1: Invalid module name: 'mod-with-dashes' diff --git a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N999_N999__module__valid_name__file-with-dashes.py.snap b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N999_N999__module__valid_name__file-with-dashes.py.snap index 06a6465c61..221d8a476b 100644 --- a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N999_N999__module__valid_name__file-with-dashes.py.snap +++ b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N999_N999__module__valid_name__file-with-dashes.py.snap @@ -1,4 +1,4 @@ --- source: crates/ruff_linter/src/rules/pep8_naming/mod.rs --- -file-with-dashes.py:1:1: N999 Invalid module name: 'file-with-dashes' +error[N999]: 1:1: Invalid module name: 'file-with-dashes' diff --git a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__camelcase_imported_as_incorrect_convention.snap b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__camelcase_imported_as_incorrect_convention.snap index 9eb17d9ae9..bd51dc0294 100644 --- a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__camelcase_imported_as_incorrect_convention.snap +++ b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__camelcase_imported_as_incorrect_convention.snap @@ -1,41 +1,47 @@ --- source: crates/ruff_linter/src/rules/pep8_naming/mod.rs --- -N817.py:1:8: N817 CamelCase `CaMel` imported as acronym `CM` +error[N817]: 1:8: CamelCase `CaMel` imported as acronym `CM` + + --> N817.py:1:8 | 1 | import mod.CaMel as CM - | ^^^^^^^^^^^^^^^ N817 + | ^^^^^^^^^^^^^^^ 2 | from mod import CamelCase as CC | +error[N817]: 2:17: CamelCase `CamelCase` imported as acronym `CC` -N817.py:2:17: N817 CamelCase `CamelCase` imported as acronym `CC` + --> N817.py:2:17 | 1 | import mod.CaMel as CM 2 | from mod import CamelCase as CC - | ^^^^^^^^^^^^^^^ N817 + | ^^^^^^^^^^^^^^^ | +error[N817]: 6:8: CamelCase `ElementTree` imported as acronym `ET` -N817.py:6:8: N817 CamelCase `ElementTree` imported as acronym `ET` + --> N817.py:6:8 | 5 | # OK depending on configured import convention 6 | import xml.etree.ElementTree as ET - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ N817 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ 7 | from xml.etree import ElementTree as ET | +error[N817]: 7:23: CamelCase `ElementTree` imported as acronym `ET` -N817.py:7:23: N817 CamelCase `ElementTree` imported as acronym `ET` + --> N817.py:7:23 | 5 | # OK depending on configured import convention 6 | import xml.etree.ElementTree as ET 7 | from xml.etree import ElementTree as ET - | ^^^^^^^^^^^^^^^^^ N817 + | ^^^^^^^^^^^^^^^^^ 8 | 9 | # Always an error (relative import) | +error[N817]: 10:26: CamelCase `ElementTree` imported as acronym `ET` -N817.py:10:26: N817 CamelCase `ElementTree` imported as acronym `ET` + --> N817.py:10:26 | 9 | # Always an error (relative import) 10 | from ..xml.eltree import ElementTree as ET - | ^^^^^^^^^^^^^^^^^ N817 + | ^^^^^^^^^^^^^^^^^ | diff --git a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__classmethod_decorators.snap b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__classmethod_decorators.snap index ee268f6f5b..5fba1b91a8 100644 --- a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__classmethod_decorators.snap +++ b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__classmethod_decorators.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pep8_naming/mod.rs --- -error[N805]: N805.py:7:20: [*] First argument of a method should be named `self` +error[N805]: 7:20: [*] First argument of a method should be named `self` + --> N805.py:7:20 | 6 | class Class: 7 | def bad_method(this): @@ -20,8 +21,9 @@ error[N805]: N805.py:7:20: [*] First argument of a method should be named `self` 9 9 | 10 10 | if False: -error[N805]: N805.py:11:30: [*] First argument of a method should be named `self` +error[N805]: 11:30: [*] First argument of a method should be named `self` + --> N805.py:11:30 | 10 | if False: 11 | def extra_bad_method(this): @@ -39,8 +41,9 @@ error[N805]: N805.py:11:30: [*] First argument of a method should be named `self 13 13 | 14 14 | def good_method(self): -error[N805]: N805.py:63:29: [*] First argument of a method should be named `self` +error[N805]: 63:29: [*] First argument of a method should be named `self` + --> N805.py:63:29 | 61 | pass 62 | @@ -59,8 +62,9 @@ error[N805]: N805.py:63:29: [*] First argument of a method should be named `self 65 65 | 66 66 | -error[N805]: N805.py:69:13: [*] First argument of a method should be named `self` +error[N805]: 69:13: [*] First argument of a method should be named `self` + --> N805.py:69:13 | 67 | class ModelClass: 68 | @hybrid_property @@ -79,8 +83,9 @@ error[N805]: N805.py:69:13: [*] First argument of a method should be named `self 71 71 | 72 72 | @bad.expression -error[N805]: N805.py:77:13: [*] First argument of a method should be named `self` +error[N805]: 77:13: [*] First argument of a method should be named `self` + --> N805.py:77:13 | 76 | @bad.wtf 77 | def bad(cls): @@ -98,8 +103,9 @@ error[N805]: N805.py:77:13: [*] First argument of a method should be named `self 79 79 | 80 80 | @hybrid_property -error[N805]: N805.py:93:19: [*] First argument of a method should be named `self` +error[N805]: 93:19: [*] First argument of a method should be named `self` + --> N805.py:93:19 | 92 | @foobar.thisisstatic 93 | def badstatic(foo): @@ -117,8 +123,9 @@ error[N805]: N805.py:93:19: [*] First argument of a method should be named `self 95 95 | 96 96 | -error[N805]: N805.py:98:26: First argument of a method should be named `self` +error[N805]: 98:26: First argument of a method should be named `self` + --> N805.py:98:26 | 97 | class SelfInArgsClass: 98 | def self_as_argument(this, self): @@ -126,8 +133,9 @@ error[N805]: N805.py:98:26: First argument of a method should be named `self` 99 | pass | = help: Rename `this` to `self` -error[N805]: N805.py:101:35: First argument of a method should be named `self` +error[N805]: 101:35: First argument of a method should be named `self` + --> N805.py:101:35 | 99 | pass 100 | @@ -136,8 +144,9 @@ error[N805]: N805.py:101:35: First argument of a method should be named `self` 102 | pass | = help: Rename `this` to `self` -error[N805]: N805.py:104:34: First argument of a method should be named `self` +error[N805]: 104:34: First argument of a method should be named `self` + --> N805.py:104:34 | 102 | pass 103 | @@ -146,8 +155,9 @@ error[N805]: N805.py:104:34: First argument of a method should be named `self` 105 | pass | = help: Rename `this` to `self` -error[N805]: N805.py:107:24: First argument of a method should be named `self` +error[N805]: 107:24: First argument of a method should be named `self` + --> N805.py:107:24 | 105 | pass 106 | @@ -156,8 +166,9 @@ error[N805]: N805.py:107:24: First argument of a method should be named `self` 108 | pass | = help: Rename `this` to `self` -error[N805]: N805.py:110:24: First argument of a method should be named `self` +error[N805]: 110:24: First argument of a method should be named `self` + --> N805.py:110:24 | 108 | pass 109 | @@ -166,8 +177,9 @@ error[N805]: N805.py:110:24: First argument of a method should be named `self` 111 | pass | = help: Rename `this` to `self` -error[N805]: N805.py:115:20: [*] First argument of a method should be named `self` +error[N805]: 115:20: [*] First argument of a method should be named `self` + --> N805.py:115:20 | 114 | class RenamingInMethodBodyClass: 115 | def bad_method(this): @@ -190,8 +202,9 @@ error[N805]: N805.py:115:20: [*] First argument of a method should be named `sel 119 119 | def bad_method(this): 120 120 | self = this -error[N805]: N805.py:119:20: [*] First argument of a method should be named `self` +error[N805]: 119:20: [*] First argument of a method should be named `self` + --> N805.py:119:20 | 117 | this 118 | @@ -212,8 +225,9 @@ error[N805]: N805.py:119:20: [*] First argument of a method should be named `sel 122 122 | 123 123 | class RenamingWithNFKC: -error[N805]: N805.py:124:17: [*] First argument of a method should be named `self` +error[N805]: 124:17: [*] First argument of a method should be named `self` + --> N805.py:124:17 | 123 | class RenamingWithNFKC: 124 | def formula(household): diff --git a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N801_N801.py.snap b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N801_N801.py.snap index a8285c31cb..e656e8c0f8 100644 --- a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N801_N801.py.snap +++ b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N801_N801.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pep8_naming/mod.rs --- -error[N801]: N801.py:4:7: Class name `stillBad` should use CapWords convention +error[N801]: 4:7: Class name `stillBad` should use CapWords convention + --> N801.py:4:7 | 2 | pass 3 | @@ -10,8 +11,9 @@ error[N801]: N801.py:4:7: Class name `stillBad` should use CapWords convention | ^^^^^^^^ 5 | pass | -error[N801]: N801.py:10:7: Class name `STILL_BAD` should use CapWords convention +error[N801]: 10:7: Class name `STILL_BAD` should use CapWords convention + --> N801.py:10:7 | 8 | pass 9 | diff --git a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N802_N802.py.snap b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N802_N802.py.snap index 83debbfbc2..5e5172838f 100644 --- a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N802_N802.py.snap +++ b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N802_N802.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pep8_naming/mod.rs --- -error[N802]: N802.py:6:5: Function name `stillBad` should be lowercase +error[N802]: 6:5: Function name `stillBad` should be lowercase + --> N802.py:6:5 | 4 | pass 5 | @@ -10,8 +11,9 @@ error[N802]: N802.py:6:5: Function name `stillBad` should be lowercase | ^^^^^^^^ 7 | pass | -error[N802]: N802.py:13:9: Function name `stillBad` should be lowercase +error[N802]: 13:9: Function name `stillBad` should be lowercase + --> N802.py:13:9 | 11 | return super().tearDown() 12 | diff --git a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N803_N803.py.snap b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N803_N803.py.snap index 66b1a749a8..f6e51adfad 100644 --- a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N803_N803.py.snap +++ b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N803_N803.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pep8_naming/mod.rs --- -error[N803]: N803.py:4:16: Argument name `stillBad` should be lowercase +error[N803]: 4:16: Argument name `stillBad` should be lowercase + --> N803.py:4:16 | 2 | return _, a, badAllowed 3 | @@ -10,8 +11,9 @@ error[N803]: N803.py:4:16: Argument name `stillBad` should be lowercase | ^^^^^^^^ 5 | return _, a, stillBad | -error[N803]: N803.py:11:28: Argument name `stillBad` should be lowercase +error[N803]: 11:28: Argument name `stillBad` should be lowercase + --> N803.py:11:28 | 9 | return _, a, badAllowed 10 | diff --git a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N804_N804.py.snap b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N804_N804.py.snap index 678a2358c4..dc5e6c321f 100644 --- a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N804_N804.py.snap +++ b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N804_N804.py.snap @@ -1,15 +1,16 @@ --- source: crates/ruff_linter/src/rules/pep8_naming/mod.rs --- -N804.py:5:27: N804 [*] First argument of a class method should be named `cls` +error[N804]: 5:27: [*] First argument of a class method should be named `cls` + + --> N804.py:5:27 | 4 | class Class: 5 | def __init_subclass__(self, default_name, **kwargs): - | ^^^^ N804 + | ^^^^ 6 | ... | = help: Rename `self` to `cls` - ℹ Unsafe fix 2 2 | 3 3 | @@ -20,15 +21,16 @@ N804.py:5:27: N804 [*] First argument of a class method should be named `cls` 7 7 | 8 8 | @classmethod -N804.py:9:20: N804 [*] First argument of a class method should be named `cls` +error[N804]: 9:20: [*] First argument of a class method should be named `cls` + + --> N804.py:9:20 | 8 | @classmethod 9 | def badAllowed(self, x, /, other): - | ^^^^ N804 + | ^^^^ 10 | ... | = help: Rename `self` to `cls` - ℹ Unsafe fix 6 6 | ... 7 7 | @@ -39,15 +41,16 @@ N804.py:9:20: N804 [*] First argument of a class method should be named `cls` 11 11 | 12 12 | @classmethod -N804.py:13:18: N804 [*] First argument of a class method should be named `cls` +error[N804]: 13:18: [*] First argument of a class method should be named `cls` + + --> N804.py:13:18 | 12 | @classmethod 13 | def stillBad(self, x, /, other): - | ^^^^ N804 + | ^^^^ 14 | ... | = help: Rename `self` to `cls` - ℹ Unsafe fix 10 10 | ... 11 11 | @@ -58,15 +61,16 @@ N804.py:13:18: N804 [*] First argument of a class method should be named `cls` 15 15 | 16 16 | -N804.py:18:20: N804 [*] First argument of a class method should be named `cls` +error[N804]: 18:20: [*] First argument of a class method should be named `cls` + + --> N804.py:18:20 | 17 | class MetaClass(ABCMeta): 18 | def badAllowed(self): - | ^^^^ N804 + | ^^^^ 19 | pass | = help: Rename `self` to `cls` - ℹ Unsafe fix 15 15 | 16 16 | @@ -77,16 +81,17 @@ N804.py:18:20: N804 [*] First argument of a class method should be named `cls` 20 20 | 21 21 | def stillBad(self): -N804.py:21:18: N804 [*] First argument of a class method should be named `cls` +error[N804]: 21:18: [*] First argument of a class method should be named `cls` + + --> N804.py:21:18 | 19 | pass 20 | 21 | def stillBad(self): - | ^^^^ N804 + | ^^^^ 22 | pass | = help: Rename `self` to `cls` - ℹ Unsafe fix 18 18 | def badAllowed(self): 19 19 | pass diff --git a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N805_N805.py.snap b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N805_N805.py.snap index 0d5d100f42..dd9df173fb 100644 --- a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N805_N805.py.snap +++ b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N805_N805.py.snap @@ -1,15 +1,16 @@ --- source: crates/ruff_linter/src/rules/pep8_naming/mod.rs --- -N805.py:7:20: N805 [*] First argument of a method should be named `self` +error[N805]: 7:20: [*] First argument of a method should be named `self` + + --> N805.py:7:20 | 6 | class Class: 7 | def badAllowed(this): - | ^^^^ N805 + | ^^^^ 8 | pass | = help: Rename `this` to `self` - ℹ Unsafe fix 4 4 | 5 5 | @@ -20,16 +21,17 @@ N805.py:7:20: N805 [*] First argument of a method should be named `self` 9 9 | 10 10 | def stillBad(this): -N805.py:10:18: N805 [*] First argument of a method should be named `self` +error[N805]: 10:18: [*] First argument of a method should be named `self` + + --> N805.py:10:18 | 8 | pass 9 | 10 | def stillBad(this): - | ^^^^ N805 + | ^^^^ 11 | pass | = help: Rename `this` to `self` - ℹ Unsafe fix 7 7 | def badAllowed(this): 8 8 | pass @@ -40,16 +42,17 @@ N805.py:10:18: N805 [*] First argument of a method should be named `self` 12 12 | 13 13 | if False: -N805.py:15:24: N805 [*] First argument of a method should be named `self` +error[N805]: 15:24: [*] First argument of a method should be named `self` + + --> N805.py:15:24 | 13 | if False: 14 | 15 | def badAllowed(this): - | ^^^^ N805 + | ^^^^ 16 | pass | = help: Rename `this` to `self` - ℹ Unsafe fix 12 12 | 13 13 | if False: @@ -60,16 +63,17 @@ N805.py:15:24: N805 [*] First argument of a method should be named `self` 17 17 | 18 18 | def stillBad(this): -N805.py:18:22: N805 [*] First argument of a method should be named `self` +error[N805]: 18:22: [*] First argument of a method should be named `self` + + --> N805.py:18:22 | 16 | pass 17 | 18 | def stillBad(this): - | ^^^^ N805 + | ^^^^ 19 | pass | = help: Rename `this` to `self` - ℹ Unsafe fix 15 15 | def badAllowed(this): 16 16 | pass @@ -80,15 +84,16 @@ N805.py:18:22: N805 [*] First argument of a method should be named `self` 20 20 | 21 21 | @pydantic.validator -N805.py:22:20: N805 [*] First argument of a method should be named `self` +error[N805]: 22:20: [*] First argument of a method should be named `self` + + --> N805.py:22:20 | 21 | @pydantic.validator 22 | def badAllowed(cls, my_field: str) -> str: - | ^^^ N805 + | ^^^ 23 | pass | = help: Rename `cls` to `self` - ℹ Unsafe fix 19 19 | pass 20 20 | @@ -99,15 +104,16 @@ N805.py:22:20: N805 [*] First argument of a method should be named `self` 24 24 | 25 25 | @pydantic.validator -N805.py:26:18: N805 [*] First argument of a method should be named `self` +error[N805]: 26:18: [*] First argument of a method should be named `self` + + --> N805.py:26:18 | 25 | @pydantic.validator 26 | def stillBad(cls, my_field: str) -> str: - | ^^^ N805 + | ^^^ 27 | pass | = help: Rename `cls` to `self` - ℹ Unsafe fix 23 23 | pass 24 24 | @@ -118,15 +124,16 @@ N805.py:26:18: N805 [*] First argument of a method should be named `self` 28 28 | 29 29 | @pydantic.validator("my_field") -N805.py:30:20: N805 [*] First argument of a method should be named `self` +error[N805]: 30:20: [*] First argument of a method should be named `self` + + --> N805.py:30:20 | 29 | @pydantic.validator("my_field") 30 | def badAllowed(cls, my_field: str) -> str: - | ^^^ N805 + | ^^^ 31 | pass | = help: Rename `cls` to `self` - ℹ Unsafe fix 27 27 | pass 28 28 | @@ -137,15 +144,16 @@ N805.py:30:20: N805 [*] First argument of a method should be named `self` 32 32 | 33 33 | @pydantic.validator("my_field") -N805.py:34:18: N805 [*] First argument of a method should be named `self` +error[N805]: 34:18: [*] First argument of a method should be named `self` + + --> N805.py:34:18 | 33 | @pydantic.validator("my_field") 34 | def stillBad(cls, my_field: str) -> str: - | ^^^ N805 + | ^^^ 35 | pass | = help: Rename `cls` to `self` - ℹ Unsafe fix 31 31 | pass 32 32 | @@ -156,21 +164,24 @@ N805.py:34:18: N805 [*] First argument of a method should be named `self` 36 36 | 37 37 | @classmethod -N805.py:55:20: N805 First argument of a method should be named `self` +error[N805]: 55:20: First argument of a method should be named `self` + + --> N805.py:55:20 | 54 | class PosOnlyClass: 55 | def badAllowed(this, blah, /, self, something: str): - | ^^^^ N805 + | ^^^^ 56 | pass | = help: Rename `this` to `self` +error[N805]: 58:18: First argument of a method should be named `self` -N805.py:58:18: N805 First argument of a method should be named `self` + --> N805.py:58:18 | 56 | pass 57 | 58 | def stillBad(this, blah, /, self, something: str): - | ^^^^ N805 + | ^^^^ 59 | pass | = help: Rename `this` to `self` diff --git a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N806_N806.py.snap b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N806_N806.py.snap index b617646b02..0838012276 100644 --- a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N806_N806.py.snap +++ b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N806_N806.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pep8_naming/mod.rs --- -error[N806]: N806.py:3:5: Variable `stillBad` in function should be lowercase +error[N806]: 3:5: Variable `stillBad` in function should be lowercase + --> N806.py:3:5 | 1 | def assign(): 2 | badAllowed = 0 @@ -11,8 +12,9 @@ error[N806]: N806.py:3:5: Variable `stillBad` in function should be lowercase 4 | 5 | BAD_ALLOWED = 0 | -error[N806]: N806.py:6:5: Variable `STILL_BAD` in function should be lowercase +error[N806]: 6:5: Variable `STILL_BAD` in function should be lowercase + --> N806.py:6:5 | 5 | BAD_ALLOWED = 0 6 | STILL_BAD = 0 diff --git a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N807_N807.py.snap b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N807_N807.py.snap index 96094502dd..ac2744f278 100644 --- a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N807_N807.py.snap +++ b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N807_N807.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pep8_naming/mod.rs --- -error[N807]: N807.py:4:5: Function name should not start and end with `__` +error[N807]: 4:5: Function name should not start and end with `__` + --> N807.py:4:5 | 2 | pass 3 | @@ -10,8 +11,9 @@ error[N807]: N807.py:4:5: Function name should not start and end with `__` | ^^^^^^^^^^^^ 5 | pass | -error[N807]: N807.py:12:9: Function name should not start and end with `__` +error[N807]: 12:9: Function name should not start and end with `__` + --> N807.py:12:9 | 10 | pass 11 | diff --git a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N811_N811.py.snap b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N811_N811.py.snap index 002daa2aed..5dea6025e0 100644 --- a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N811_N811.py.snap +++ b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N811_N811.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pep8_naming/mod.rs --- -error[N811]: N811.py:2:8: Constant `STILL_BAD` imported as non-constant `stillBad` +error[N811]: 2:8: Constant `STILL_BAD` imported as non-constant `stillBad` + --> N811.py:2:8 | 1 | import mod.BAD_ALLOWED as badAllowed 2 | import mod.STILL_BAD as stillBad @@ -10,8 +11,9 @@ error[N811]: N811.py:2:8: Constant `STILL_BAD` imported as non-constant `stillBa 3 | 4 | from mod import BAD_ALLOWED as badAllowed | -error[N811]: N811.py:5:17: Constant `STILL_BAD` imported as non-constant `stillBad` +error[N811]: 5:17: Constant `STILL_BAD` imported as non-constant `stillBad` + --> N811.py:5:17 | 4 | from mod import BAD_ALLOWED as badAllowed 5 | from mod import STILL_BAD as stillBad diff --git a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N812_N812.py.snap b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N812_N812.py.snap index 1eb68dd9db..bfab451ede 100644 --- a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N812_N812.py.snap +++ b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N812_N812.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pep8_naming/mod.rs --- -error[N812]: N812.py:2:8: Lowercase `stillbad` imported as non-lowercase `stillBad` +error[N812]: 2:8: Lowercase `stillbad` imported as non-lowercase `stillBad` + --> N812.py:2:8 | 1 | import mod.badallowed as badAllowed 2 | import mod.stillbad as stillBad @@ -10,8 +11,9 @@ error[N812]: N812.py:2:8: Lowercase `stillbad` imported as non-lowercase `stillB 3 | 4 | from mod import badallowed as BadAllowed | -error[N812]: N812.py:5:17: Lowercase `stillbad` imported as non-lowercase `StillBad` +error[N812]: 5:17: Lowercase `stillbad` imported as non-lowercase `StillBad` + --> N812.py:5:17 | 4 | from mod import badallowed as BadAllowed 5 | from mod import stillbad as StillBad diff --git a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N813_N813.py.snap b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N813_N813.py.snap index 07bb0182f2..b6d8188731 100644 --- a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N813_N813.py.snap +++ b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N813_N813.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pep8_naming/mod.rs --- -error[N813]: N813.py:2:8: Camelcase `stillBad` imported as lowercase `stillbad` +error[N813]: 2:8: Camelcase `stillBad` imported as lowercase `stillbad` + --> N813.py:2:8 | 1 | import mod.BadAllowed as badallowed 2 | import mod.stillBad as stillbad @@ -10,8 +11,9 @@ error[N813]: N813.py:2:8: Camelcase `stillBad` imported as lowercase `stillbad` 3 | 4 | from mod import BadAllowed as badallowed | -error[N813]: N813.py:5:17: Camelcase `StillBad` imported as lowercase `stillbad` +error[N813]: 5:17: Camelcase `StillBad` imported as lowercase `stillbad` + --> N813.py:5:17 | 4 | from mod import BadAllowed as badallowed 5 | from mod import StillBad as stillbad @@ -19,8 +21,9 @@ error[N813]: N813.py:5:17: Camelcase `StillBad` imported as lowercase `stillbad` 6 | 7 | from mod import BadAllowed as bad_allowed | -error[N813]: N813.py:8:17: Camelcase `StillBad` imported as lowercase `still_bad` +error[N813]: 8:17: Camelcase `StillBad` imported as lowercase `still_bad` + --> N813.py:8:17 | 7 | from mod import BadAllowed as bad_allowed 8 | from mod import StillBad as still_bad diff --git a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N814_N814.py.snap b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N814_N814.py.snap index e9f889e126..3ba774d89e 100644 --- a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N814_N814.py.snap +++ b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N814_N814.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pep8_naming/mod.rs --- -error[N814]: N814.py:2:8: Camelcase `StillBad` imported as constant `STILLBAD` +error[N814]: 2:8: Camelcase `StillBad` imported as constant `STILLBAD` + --> N814.py:2:8 | 1 | import mod.BadAllowed as BADALLOWED 2 | import mod.StillBad as STILLBAD @@ -10,8 +11,9 @@ error[N814]: N814.py:2:8: Camelcase `StillBad` imported as constant `STILLBAD` 3 | 4 | from mod import BadAllowed as BADALLOWED | -error[N814]: N814.py:5:17: Camelcase `StillBad` imported as constant `STILLBAD` +error[N814]: 5:17: Camelcase `StillBad` imported as constant `STILLBAD` + --> N814.py:5:17 | 4 | from mod import BadAllowed as BADALLOWED 5 | from mod import StillBad as STILLBAD @@ -19,8 +21,9 @@ error[N814]: N814.py:5:17: Camelcase `StillBad` imported as constant `STILLBAD` 6 | 7 | from mod import BadAllowed as BAD_ALLOWED | -error[N814]: N814.py:8:17: Camelcase `StillBad` imported as constant `STILL_BAD` +error[N814]: 8:17: Camelcase `StillBad` imported as constant `STILL_BAD` + --> N814.py:8:17 | 7 | from mod import BadAllowed as BAD_ALLOWED 8 | from mod import StillBad as STILL_BAD diff --git a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N815_N815.py.snap b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N815_N815.py.snap index 3360d71e97..98086dd2ad 100644 --- a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N815_N815.py.snap +++ b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N815_N815.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pep8_naming/mod.rs --- -error[N815]: N815.py:3:5: Variable `stillBad` in class scope should not be mixedCase +error[N815]: 3:5: Variable `stillBad` in class scope should not be mixedCase + --> N815.py:3:5 | 1 | class C: 2 | badAllowed = 0 @@ -11,8 +12,9 @@ error[N815]: N815.py:3:5: Variable `stillBad` in class scope should not be mixed 4 | 5 | _badAllowed = 0 | -error[N815]: N815.py:6:5: Variable `_stillBad` in class scope should not be mixedCase +error[N815]: 6:5: Variable `_stillBad` in class scope should not be mixedCase + --> N815.py:6:5 | 5 | _badAllowed = 0 6 | _stillBad = 0 @@ -20,8 +22,9 @@ error[N815]: N815.py:6:5: Variable `_stillBad` in class scope should not be mixe 7 | 8 | bad_Allowed = 0 | -error[N815]: N815.py:9:5: Variable `still_Bad` in class scope should not be mixedCase +error[N815]: 9:5: Variable `still_Bad` in class scope should not be mixedCase + --> N815.py:9:5 | 8 | bad_Allowed = 0 9 | still_Bad = 0 @@ -29,8 +32,9 @@ error[N815]: N815.py:9:5: Variable `still_Bad` in class scope should not be mixe 10 | 11 | class D(TypedDict): | -error[N815]: N815.py:13:5: Variable `stillBad` in class scope should not be mixedCase +error[N815]: 13:5: Variable `stillBad` in class scope should not be mixedCase + --> N815.py:13:5 | 11 | class D(TypedDict): 12 | badAllowed: bool @@ -39,8 +43,9 @@ error[N815]: N815.py:13:5: Variable `stillBad` in class scope should not be mixe 14 | 15 | _badAllowed: list | -error[N815]: N815.py:16:5: Variable `_stillBad` in class scope should not be mixedCase +error[N815]: 16:5: Variable `_stillBad` in class scope should not be mixedCase + --> N815.py:16:5 | 15 | _badAllowed: list 16 | _stillBad: list @@ -48,8 +53,9 @@ error[N815]: N815.py:16:5: Variable `_stillBad` in class scope should not be mix 17 | 18 | bad_Allowed: set | -error[N815]: N815.py:19:5: Variable `still_Bad` in class scope should not be mixedCase +error[N815]: 19:5: Variable `still_Bad` in class scope should not be mixedCase + --> N815.py:19:5 | 18 | bad_Allowed: set 19 | still_Bad: set diff --git a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N816_N816.py.snap b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N816_N816.py.snap index 42b70057a6..14982f4706 100644 --- a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N816_N816.py.snap +++ b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N816_N816.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pep8_naming/mod.rs --- -error[N816]: N816.py:2:1: Variable `stillBad` in global scope should not be mixedCase +error[N816]: 2:1: Variable `stillBad` in global scope should not be mixedCase + --> N816.py:1:15 | 1 | badAllowed = 0 2 | stillBad = 0 @@ -10,8 +11,9 @@ error[N816]: N816.py:2:1: Variable `stillBad` in global scope should not be mixe 3 | 4 | _badAllowed = 0 | -error[N816]: N816.py:5:1: Variable `_stillBad` in global scope should not be mixedCase +error[N816]: 5:1: Variable `_stillBad` in global scope should not be mixedCase + --> N816.py:4:16 | 4 | _badAllowed = 0 5 | _stillBad = 0 @@ -19,8 +21,9 @@ error[N816]: N816.py:5:1: Variable `_stillBad` in global scope should not be mix 6 | 7 | bad_Allowed = 0 | -error[N816]: N816.py:8:1: Variable `still_Bad` in global scope should not be mixedCase +error[N816]: 8:1: Variable `still_Bad` in global scope should not be mixedCase + --> N816.py:7:16 | 7 | bad_Allowed = 0 8 | still_Bad = 0 diff --git a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N817_N817.py.snap b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N817_N817.py.snap index a66d09f5a6..0b9e3ff1ef 100644 --- a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N817_N817.py.snap +++ b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N817_N817.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pep8_naming/mod.rs --- -error[N817]: N817.py:2:8: CamelCase `StillBad` imported as acronym `SB` +error[N817]: 2:8: CamelCase `StillBad` imported as acronym `SB` + --> N817.py:2:8 | 1 | import mod.BadAllowed as BA 2 | import mod.StillBad as SB @@ -10,8 +11,9 @@ error[N817]: N817.py:2:8: CamelCase `StillBad` imported as acronym `SB` 3 | 4 | from mod import BadAllowed as BA | -error[N817]: N817.py:5:17: CamelCase `StillBad` imported as acronym `SB` +error[N817]: 5:17: CamelCase `StillBad` imported as acronym `SB` + --> N817.py:5:17 | 4 | from mod import BadAllowed as BA 5 | from mod import StillBad as SB diff --git a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N818_N818.py.snap b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N818_N818.py.snap index 2822a8a850..ff1dd8c6fd 100644 --- a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N818_N818.py.snap +++ b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N818_N818.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pep8_naming/mod.rs --- -error[N818]: N818.py:4:7: Exception name `StillBad` should be named with an Error suffix +error[N818]: 4:7: Exception name `StillBad` should be named with an Error suffix + --> N818.py:4:7 | 2 | pass 3 | @@ -10,8 +11,9 @@ error[N818]: N818.py:4:7: Exception name `StillBad` should be named with an Erro | ^^^^^^^^ 5 | pass | -error[N818]: N818.py:10:7: Exception name `StillBad` should be named with an Error suffix +error[N818]: 10:7: Exception name `StillBad` should be named with an Error suffix + --> N818.py:10:7 | 8 | pass 9 | diff --git a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__staticmethod_decorators.snap b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__staticmethod_decorators.snap index 3eae81e814..933a98cff2 100644 --- a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__staticmethod_decorators.snap +++ b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__staticmethod_decorators.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pep8_naming/mod.rs --- -error[N805]: N805.py:7:20: [*] First argument of a method should be named `self` +error[N805]: 7:20: [*] First argument of a method should be named `self` + --> N805.py:7:20 | 6 | class Class: 7 | def bad_method(this): @@ -20,8 +21,9 @@ error[N805]: N805.py:7:20: [*] First argument of a method should be named `self` 9 9 | 10 10 | if False: -error[N805]: N805.py:11:30: [*] First argument of a method should be named `self` +error[N805]: 11:30: [*] First argument of a method should be named `self` + --> N805.py:11:30 | 10 | if False: 11 | def extra_bad_method(this): @@ -39,8 +41,9 @@ error[N805]: N805.py:11:30: [*] First argument of a method should be named `self 13 13 | 14 14 | def good_method(self): -error[N805]: N805.py:30:15: [*] First argument of a method should be named `self` +error[N805]: 30:15: [*] First argument of a method should be named `self` + --> N805.py:30:15 | 29 | @pydantic.validator 30 | def lower(cls, my_field: str) -> str: @@ -58,8 +61,9 @@ error[N805]: N805.py:30:15: [*] First argument of a method should be named `self 32 32 | 33 33 | @pydantic.validator("my_field") -error[N805]: N805.py:34:15: [*] First argument of a method should be named `self` +error[N805]: 34:15: [*] First argument of a method should be named `self` + --> N805.py:34:15 | 33 | @pydantic.validator("my_field") 34 | def lower(cls, my_field: str) -> str: @@ -77,8 +81,9 @@ error[N805]: N805.py:34:15: [*] First argument of a method should be named `self 36 36 | 37 37 | def __init__(self): -error[N805]: N805.py:63:29: [*] First argument of a method should be named `self` +error[N805]: 63:29: [*] First argument of a method should be named `self` + --> N805.py:63:29 | 61 | pass 62 | @@ -97,8 +102,9 @@ error[N805]: N805.py:63:29: [*] First argument of a method should be named `self 65 65 | 66 66 | -error[N805]: N805.py:69:13: [*] First argument of a method should be named `self` +error[N805]: 69:13: [*] First argument of a method should be named `self` + --> N805.py:69:13 | 67 | class ModelClass: 68 | @hybrid_property @@ -117,8 +123,9 @@ error[N805]: N805.py:69:13: [*] First argument of a method should be named `self 71 71 | 72 72 | @bad.expression -error[N805]: N805.py:77:13: [*] First argument of a method should be named `self` +error[N805]: 77:13: [*] First argument of a method should be named `self` + --> N805.py:77:13 | 76 | @bad.wtf 77 | def bad(cls): @@ -136,8 +143,9 @@ error[N805]: N805.py:77:13: [*] First argument of a method should be named `self 79 79 | 80 80 | @hybrid_property -error[N805]: N805.py:85:14: [*] First argument of a method should be named `self` +error[N805]: 85:14: [*] First argument of a method should be named `self` + --> N805.py:85:14 | 84 | @good.expression 85 | def good(cls): @@ -155,8 +163,9 @@ error[N805]: N805.py:85:14: [*] First argument of a method should be named `self 87 87 | 88 88 | @good.wtf -error[N805]: N805.py:98:26: First argument of a method should be named `self` +error[N805]: 98:26: First argument of a method should be named `self` + --> N805.py:98:26 | 97 | class SelfInArgsClass: 98 | def self_as_argument(this, self): @@ -164,8 +173,9 @@ error[N805]: N805.py:98:26: First argument of a method should be named `self` 99 | pass | = help: Rename `this` to `self` -error[N805]: N805.py:101:35: First argument of a method should be named `self` +error[N805]: 101:35: First argument of a method should be named `self` + --> N805.py:101:35 | 99 | pass 100 | @@ -174,8 +184,9 @@ error[N805]: N805.py:101:35: First argument of a method should be named `self` 102 | pass | = help: Rename `this` to `self` -error[N805]: N805.py:104:34: First argument of a method should be named `self` +error[N805]: 104:34: First argument of a method should be named `self` + --> N805.py:104:34 | 102 | pass 103 | @@ -184,8 +195,9 @@ error[N805]: N805.py:104:34: First argument of a method should be named `self` 105 | pass | = help: Rename `this` to `self` -error[N805]: N805.py:107:24: First argument of a method should be named `self` +error[N805]: 107:24: First argument of a method should be named `self` + --> N805.py:107:24 | 105 | pass 106 | @@ -194,8 +206,9 @@ error[N805]: N805.py:107:24: First argument of a method should be named `self` 108 | pass | = help: Rename `this` to `self` -error[N805]: N805.py:110:24: First argument of a method should be named `self` +error[N805]: 110:24: First argument of a method should be named `self` + --> N805.py:110:24 | 108 | pass 109 | @@ -204,8 +217,9 @@ error[N805]: N805.py:110:24: First argument of a method should be named `self` 111 | pass | = help: Rename `this` to `self` -error[N805]: N805.py:115:20: [*] First argument of a method should be named `self` +error[N805]: 115:20: [*] First argument of a method should be named `self` + --> N805.py:115:20 | 114 | class RenamingInMethodBodyClass: 115 | def bad_method(this): @@ -228,8 +242,9 @@ error[N805]: N805.py:115:20: [*] First argument of a method should be named `sel 119 119 | def bad_method(this): 120 120 | self = this -error[N805]: N805.py:119:20: [*] First argument of a method should be named `self` +error[N805]: 119:20: [*] First argument of a method should be named `self` + --> N805.py:119:20 | 117 | this 118 | @@ -250,8 +265,9 @@ error[N805]: N805.py:119:20: [*] First argument of a method should be named `sel 122 122 | 123 123 | class RenamingWithNFKC: -error[N805]: N805.py:124:17: [*] First argument of a method should be named `self` +error[N805]: 124:17: [*] First argument of a method should be named `self` + --> N805.py:124:17 | 123 | class RenamingWithNFKC: 124 | def formula(household): diff --git a/crates/ruff_linter/src/rules/perflint/snapshots/ruff_linter__rules__perflint__tests__PERF101_PERF101.py.snap b/crates/ruff_linter/src/rules/perflint/snapshots/ruff_linter__rules__perflint__tests__PERF101_PERF101.py.snap index 7b60bbcfb9..08d3721742 100644 --- a/crates/ruff_linter/src/rules/perflint/snapshots/ruff_linter__rules__perflint__tests__PERF101_PERF101.py.snap +++ b/crates/ruff_linter/src/rules/perflint/snapshots/ruff_linter__rules__perflint__tests__PERF101_PERF101.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/perflint/mod.rs --- -error[PERF101]: PERF101.py:7:10: [*] Do not cast an iterable to `list` before iterating over it +error[PERF101]: 7:10: [*] Do not cast an iterable to `list` before iterating over it + --> PERF101.py:7:10 | 5 | foo_int = 123 6 | @@ -21,8 +22,9 @@ error[PERF101]: PERF101.py:7:10: [*] Do not cast an iterable to `list` before it 9 9 | 10 10 | for i in list(foo_list): # PERF101 -error[PERF101]: PERF101.py:10:10: [*] Do not cast an iterable to `list` before iterating over it +error[PERF101]: 10:10: [*] Do not cast an iterable to `list` before iterating over it + --> PERF101.py:10:10 | 8 | pass 9 | @@ -41,8 +43,9 @@ error[PERF101]: PERF101.py:10:10: [*] Do not cast an iterable to `list` before i 12 12 | 13 13 | for i in list(foo_set): # PERF101 -error[PERF101]: PERF101.py:13:10: [*] Do not cast an iterable to `list` before iterating over it +error[PERF101]: 13:10: [*] Do not cast an iterable to `list` before iterating over it + --> PERF101.py:13:10 | 11 | pass 12 | @@ -61,8 +64,9 @@ error[PERF101]: PERF101.py:13:10: [*] Do not cast an iterable to `list` before i 15 15 | 16 16 | for i in list((1, 2, 3)): # PERF101 -error[PERF101]: PERF101.py:16:10: [*] Do not cast an iterable to `list` before iterating over it +error[PERF101]: 16:10: [*] Do not cast an iterable to `list` before iterating over it + --> PERF101.py:16:10 | 14 | pass 15 | @@ -81,8 +85,9 @@ error[PERF101]: PERF101.py:16:10: [*] Do not cast an iterable to `list` before i 18 18 | 19 19 | for i in list([1, 2, 3]): # PERF101 -error[PERF101]: PERF101.py:19:10: [*] Do not cast an iterable to `list` before iterating over it +error[PERF101]: 19:10: [*] Do not cast an iterable to `list` before iterating over it + --> PERF101.py:19:10 | 17 | pass 18 | @@ -101,8 +106,9 @@ error[PERF101]: PERF101.py:19:10: [*] Do not cast an iterable to `list` before i 21 21 | 22 22 | for i in list({1, 2, 3}): # PERF101 -error[PERF101]: PERF101.py:22:10: [*] Do not cast an iterable to `list` before iterating over it +error[PERF101]: 22:10: [*] Do not cast an iterable to `list` before iterating over it + --> PERF101.py:22:10 | 20 | pass 21 | @@ -121,8 +127,9 @@ error[PERF101]: PERF101.py:22:10: [*] Do not cast an iterable to `list` before i 24 24 | 25 25 | for i in list( -error[PERF101]: PERF101.py:25:10: [*] Do not cast an iterable to `list` before iterating over it +error[PERF101]: 25:10: [*] Do not cast an iterable to `list` before iterating over it + --> PERF101.py:25:10 | 23 | pass 24 | @@ -155,8 +162,9 @@ error[PERF101]: PERF101.py:25:10: [*] Do not cast an iterable to `list` before i 33 31 | 34 32 | for i in list( # Comment -error[PERF101]: PERF101.py:34:10: [*] Do not cast an iterable to `list` before iterating over it +error[PERF101]: 34:10: [*] Do not cast an iterable to `list` before iterating over it + --> PERF101.py:34:10 | 32 | pass 33 | @@ -180,8 +188,9 @@ error[PERF101]: PERF101.py:34:10: [*] Do not cast an iterable to `list` before i 38 36 | 39 37 | for i in list(foo_dict): # OK -error[PERF101]: PERF101.py:57:10: [*] Do not cast an iterable to `list` before iterating over it +error[PERF101]: 57:10: [*] Do not cast an iterable to `list` before iterating over it + --> PERF101.py:57:10 | 55 | foo_list.append(i + 1) 56 | @@ -201,8 +210,9 @@ error[PERF101]: PERF101.py:57:10: [*] Do not cast an iterable to `list` before i 59 59 | other_list.append(i + 1) 60 60 | -error[PERF101]: PERF101.py:69:10: [*] Do not cast an iterable to `list` before iterating over it +error[PERF101]: 69:10: [*] Do not cast an iterable to `list` before iterating over it + --> PERF101.py:69:10 | 67 | x, y, nested_tuple = (1, 2, (3, 4, 5)) 68 | @@ -221,8 +231,9 @@ error[PERF101]: PERF101.py:69:10: [*] Do not cast an iterable to `list` before i 71 71 | 72 72 | for i in list(foo_list): # OK -error[PERF101]: PERF101.py:86:10: [*] Do not cast an iterable to `list` before iterating over it +error[PERF101]: 86:10: [*] Do not cast an iterable to `list` before iterating over it + --> PERF101.py:86:10 | 84 | import builtins 85 | diff --git a/crates/ruff_linter/src/rules/perflint/snapshots/ruff_linter__rules__perflint__tests__PERF102_PERF102.py.snap b/crates/ruff_linter/src/rules/perflint/snapshots/ruff_linter__rules__perflint__tests__PERF102_PERF102.py.snap index 9eb6840c2a..28527c1659 100644 --- a/crates/ruff_linter/src/rules/perflint/snapshots/ruff_linter__rules__perflint__tests__PERF102_PERF102.py.snap +++ b/crates/ruff_linter/src/rules/perflint/snapshots/ruff_linter__rules__perflint__tests__PERF102_PERF102.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/perflint/mod.rs --- -error[PERF102]: PERF102.py:5:21: [*] When using only the values of a dict use the `values()` method +error[PERF102]: 5:21: [*] When using only the values of a dict use the `values()` method + --> PERF102.py:5:21 | 4 | def f(): 5 | for _, value in some_dict.items(): # PERF102 @@ -20,8 +21,9 @@ error[PERF102]: PERF102.py:5:21: [*] When using only the values of a dict use th 7 7 | 8 8 | -error[PERF102]: PERF102.py:10:19: [*] When using only the keys of a dict use the `keys()` method +error[PERF102]: 10:19: [*] When using only the keys of a dict use the `keys()` method + --> PERF102.py:10:19 | 9 | def f(): 10 | for key, _ in some_dict.items(): # PERF102 @@ -39,8 +41,9 @@ error[PERF102]: PERF102.py:10:19: [*] When using only the keys of a dict use the 12 12 | 13 13 | -error[PERF102]: PERF102.py:15:30: [*] When using only the keys of a dict use the `keys()` method +error[PERF102]: 15:30: [*] When using only the keys of a dict use the `keys()` method + --> PERF102.py:15:30 | 14 | def f(): 15 | for weird_arg_name, _ in some_dict.items(): # PERF102 @@ -58,8 +61,9 @@ error[PERF102]: PERF102.py:15:30: [*] When using only the keys of a dict use the 17 17 | 18 18 | -error[PERF102]: PERF102.py:20:25: [*] When using only the keys of a dict use the `keys()` method +error[PERF102]: 20:25: [*] When using only the keys of a dict use the `keys()` method + --> PERF102.py:20:25 | 19 | def f(): 20 | for name, (_, _) in some_dict.items(): # PERF102 @@ -77,8 +81,9 @@ error[PERF102]: PERF102.py:20:25: [*] When using only the keys of a dict use the 22 22 | 23 23 | -error[PERF102]: PERF102.py:30:30: [*] When using only the keys of a dict use the `keys()` method +error[PERF102]: 30:30: [*] When using only the keys of a dict use the `keys()` method + --> PERF102.py:30:30 | 29 | def f(): 30 | for (key1, _), (_, _) in some_dict.items(): # PERF102 @@ -96,8 +101,9 @@ error[PERF102]: PERF102.py:30:30: [*] When using only the keys of a dict use the 32 32 | 33 33 | -error[PERF102]: PERF102.py:35:36: [*] When using only the values of a dict use the `values()` method +error[PERF102]: 35:36: [*] When using only the values of a dict use the `values()` method + --> PERF102.py:35:36 | 34 | def f(): 35 | for (_, (_, _)), (value, _) in some_dict.items(): # PERF102 @@ -115,8 +121,9 @@ error[PERF102]: PERF102.py:35:36: [*] When using only the values of a dict use t 37 37 | 38 38 | -error[PERF102]: PERF102.py:50:32: [*] When using only the keys of a dict use the `keys()` method +error[PERF102]: 50:32: [*] When using only the keys of a dict use the `keys()` method + --> PERF102.py:50:32 | 49 | def f(): 50 | for ((_, key2), (_, _)) in some_dict.items(): # PERF102 @@ -134,8 +141,9 @@ error[PERF102]: PERF102.py:50:32: [*] When using only the keys of a dict use the 52 52 | 53 53 | -error[PERF102]: PERF102.py:85:25: [*] When using only the keys of a dict use the `keys()` method +error[PERF102]: 85:25: [*] When using only the keys of a dict use the `keys()` method + --> PERF102.py:85:25 | 84 | def f(): 85 | for name, (_, _) in (some_function()).items(): # PERF102 @@ -153,8 +161,9 @@ error[PERF102]: PERF102.py:85:25: [*] When using only the keys of a dict use the 87 87 | 88 88 | -error[PERF102]: PERF102.py:90:25: [*] When using only the keys of a dict use the `keys()` method +error[PERF102]: 90:25: [*] When using only the keys of a dict use the `keys()` method + --> PERF102.py:90:25 | 89 | def f(): 90 | for name, (_, _) in (some_function().some_attribute).items(): # PERF102 @@ -172,8 +181,9 @@ error[PERF102]: PERF102.py:90:25: [*] When using only the keys of a dict use the 92 92 | 93 93 | -error[PERF102]: PERF102.py:95:31: [*] When using only the keys of a dict use the `keys()` method +error[PERF102]: 95:31: [*] When using only the keys of a dict use the `keys()` method + --> PERF102.py:95:31 | 94 | def f(): 95 | for name, unused_value in some_dict.items(): # PERF102 @@ -191,8 +201,9 @@ error[PERF102]: PERF102.py:95:31: [*] When using only the keys of a dict use the 97 97 | 98 98 | -error[PERF102]: PERF102.py:100:31: [*] When using only the values of a dict use the `values()` method +error[PERF102]: 100:31: [*] When using only the values of a dict use the `values()` method + --> PERF102.py:100:31 | 99 | def f(): 100 | for unused_name, value in some_dict.items(): # PERF102 @@ -210,8 +221,9 @@ error[PERF102]: PERF102.py:100:31: [*] When using only the values of a dict use 102 102 | 103 103 | -error[PERF102]: PERF102.py:106:16: [*] When using only the keys of a dict use the `keys()` method +error[PERF102]: 106:16: [*] When using only the keys of a dict use the `keys()` method + --> PERF102.py:106:16 | 104 | # Regression test for: https://github.com/astral-sh/ruff/issues/7097 105 | def _create_context(name_to_value): diff --git a/crates/ruff_linter/src/rules/perflint/snapshots/ruff_linter__rules__perflint__tests__PERF203_PERF203.py.snap b/crates/ruff_linter/src/rules/perflint/snapshots/ruff_linter__rules__perflint__tests__PERF203_PERF203.py.snap index c0556f62ec..135a20b51d 100644 --- a/crates/ruff_linter/src/rules/perflint/snapshots/ruff_linter__rules__perflint__tests__PERF203_PERF203.py.snap +++ b/crates/ruff_linter/src/rules/perflint/snapshots/ruff_linter__rules__perflint__tests__PERF203_PERF203.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/perflint/mod.rs --- -error[PERF203]: PERF203.py:5:5: `try`-`except` within a loop incurs performance overhead +error[PERF203]: 5:5: `try`-`except` within a loop incurs performance overhead + --> PERF203.py:5:5 | 3 | try: 4 | print(f"{i}") diff --git a/crates/ruff_linter/src/rules/perflint/snapshots/ruff_linter__rules__perflint__tests__PERF401_PERF401.py.snap b/crates/ruff_linter/src/rules/perflint/snapshots/ruff_linter__rules__perflint__tests__PERF401_PERF401.py.snap index eced5b0eef..36a8ea74b9 100644 --- a/crates/ruff_linter/src/rules/perflint/snapshots/ruff_linter__rules__perflint__tests__PERF401_PERF401.py.snap +++ b/crates/ruff_linter/src/rules/perflint/snapshots/ruff_linter__rules__perflint__tests__PERF401_PERF401.py.snap @@ -1,32 +1,36 @@ --- source: crates/ruff_linter/src/rules/perflint/mod.rs --- -error[PERF401]: PERF401.py:6:13: Use a list comprehension to create a transformed list +error[PERF401]: 6:13: Use a list comprehension to create a transformed list + --> PERF401.py:6:13 | 4 | for i in items: 5 | if i % 2: 6 | result.append(i) # PERF401 | ^^^^^^^^^^^^^^^^ | -error[PERF401]: PERF401.py:13:9: Use a list comprehension to create a transformed list +error[PERF401]: 13:9: Use a list comprehension to create a transformed list + --> PERF401.py:13:9 | 11 | result = [] 12 | for i in items: 13 | result.append(i * i) # PERF401 | ^^^^^^^^^^^^^^^^^^^^ | -error[PERF401]: PERF401.py:82:13: Use an async list comprehension to create a transformed list +error[PERF401]: 82:13: Use an async list comprehension to create a transformed list + --> PERF401.py:82:13 | 80 | async for i in items: 81 | if i % 2: 82 | result.append(i) # PERF401 | ^^^^^^^^^^^^^^^^ | -error[PERF401]: PERF401.py:89:9: Use an async list comprehension to create a transformed list +error[PERF401]: 89:9: Use an async list comprehension to create a transformed list + --> PERF401.py:89:9 | 87 | result = [] 88 | async for i in items: diff --git a/crates/ruff_linter/src/rules/perflint/snapshots/ruff_linter__rules__perflint__tests__PERF402_PERF402.py.snap b/crates/ruff_linter/src/rules/perflint/snapshots/ruff_linter__rules__perflint__tests__PERF402_PERF402.py.snap index d3c6bfc8a7..c7c425e31e 100644 --- a/crates/ruff_linter/src/rules/perflint/snapshots/ruff_linter__rules__perflint__tests__PERF402_PERF402.py.snap +++ b/crates/ruff_linter/src/rules/perflint/snapshots/ruff_linter__rules__perflint__tests__PERF402_PERF402.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/perflint/mod.rs --- -error[PERF402]: PERF402.py:5:9: Use `list` or `list.copy` to create a copy of a list +error[PERF402]: 5:9: Use `list` or `list.copy` to create a copy of a list + --> PERF402.py:5:9 | 3 | result = [] 4 | for i in items: diff --git a/crates/ruff_linter/src/rules/perflint/snapshots/ruff_linter__rules__perflint__tests__PERF403_PERF403.py.snap b/crates/ruff_linter/src/rules/perflint/snapshots/ruff_linter__rules__perflint__tests__PERF403_PERF403.py.snap index 083804bdcd..8085d0524d 100644 --- a/crates/ruff_linter/src/rules/perflint/snapshots/ruff_linter__rules__perflint__tests__PERF403_PERF403.py.snap +++ b/crates/ruff_linter/src/rules/perflint/snapshots/ruff_linter__rules__perflint__tests__PERF403_PERF403.py.snap @@ -1,56 +1,63 @@ --- source: crates/ruff_linter/src/rules/perflint/mod.rs --- -error[PERF403]: PERF403.py:5:9: Use a dictionary comprehension instead of a for-loop +error[PERF403]: 5:9: Use a dictionary comprehension instead of a for-loop + --> PERF403.py:5:9 | 3 | result = {} 4 | for idx, name in enumerate(fruit): 5 | result[idx] = name # PERF403 | ^^^^^^^^^^^^^^^^^^ | -error[PERF403]: PERF403.py:13:13: Use a dictionary comprehension instead of a for-loop +error[PERF403]: 13:13: Use a dictionary comprehension instead of a for-loop + --> PERF403.py:13:13 | 11 | for idx, name in enumerate(fruit): 12 | if idx % 2: 13 | result[idx] = name # PERF403 | ^^^^^^^^^^^^^^^^^^ | -error[PERF403]: PERF403.py:31:13: Use a dictionary comprehension instead of a for-loop +error[PERF403]: 31:13: Use a dictionary comprehension instead of a for-loop + --> PERF403.py:31:13 | 29 | for idx, name in enumerate(fruit): 30 | if idx % 2: 31 | result[idx] = name # PERF403 | ^^^^^^^^^^^^^^^^^^ | -error[PERF403]: PERF403.py:61:13: Use a dictionary comprehension instead of a for-loop +error[PERF403]: 61:13: Use a dictionary comprehension instead of a for-loop + --> PERF403.py:61:13 | 59 | for idx, name in enumerate(fruit): 60 | if idx % 2: 61 | result[idx] = name # PERF403 | ^^^^^^^^^^^^^^^^^^ | -error[PERF403]: PERF403.py:76:9: Use a dictionary comprehension instead of a for-loop +error[PERF403]: 76:9: Use a dictionary comprehension instead of a for-loop + --> PERF403.py:76:9 | 74 | result = {} 75 | for name in fruit: 76 | result[name] = name # PERF403 | ^^^^^^^^^^^^^^^^^^^ | -error[PERF403]: PERF403.py:83:9: Use a dictionary comprehension instead of a for-loop +error[PERF403]: 83:9: Use a dictionary comprehension instead of a for-loop + --> PERF403.py:83:9 | 81 | result = {} 82 | for idx, name in enumerate(fruit): 83 | result[name] = idx # PERF403 | ^^^^^^^^^^^^^^^^^^ | -error[PERF403]: PERF403.py:91:9: Use a dictionary comprehension instead of a for-loop +error[PERF403]: 91:9: Use a dictionary comprehension instead of a for-loop + --> PERF403.py:91:9 | 89 | result = SneakyDict() 90 | for idx, name in enumerate(fruit): diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E101_E101.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E101_E101.py.snap index 5c39230581..aab044977c 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E101_E101.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E101_E101.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[E101]: E101.py:11:1: Indentation contains mixed spaces and tabs +error[E101]: 11:1: Indentation contains mixed spaces and tabs + --> E101.py:10:11 | 9 | def func_mixed_start_with_tab(): 10 | # E101 @@ -11,8 +12,9 @@ error[E101]: E101.py:11:1: Indentation contains mixed spaces and tabs 12 | 13 | def func_mixed_start_with_space(): | -error[E101]: E101.py:15:1: Indentation contains mixed spaces and tabs +error[E101]: 15:1: Indentation contains mixed spaces and tabs + --> E101.py:14:11 | 13 | def func_mixed_start_with_space(): 14 | # E101 @@ -21,8 +23,9 @@ error[E101]: E101.py:15:1: Indentation contains mixed spaces and tabs 16 | 17 | def xyz(): | -error[E101]: E101.py:19:1: Indentation contains mixed spaces and tabs +error[E101]: 19:1: Indentation contains mixed spaces and tabs + --> E101.py:18:11 | 17 | def xyz(): 18 | # E101 diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E111_E11.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E111_E11.py.snap index 97ce990df6..7b652f7d37 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E111_E11.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E111_E11.py.snap @@ -1,27 +1,31 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -E11.py:3:1: E111 Indentation is not a multiple of 4 +error[E111]: 3:1: Indentation is not a multiple of 4 + + --> E11.py:2:10 | 1 | #: E111 2 | if x > 2: 3 | print(x) - | ^^ E111 + | ^^ 4 | #: E111 E117 5 | if True: | +error[E111]: 6:1: Indentation is not a multiple of 4 -E11.py:6:1: E111 Indentation is not a multiple of 4 + --> E11.py:5:9 | 4 | #: E111 E117 5 | if True: 6 | print() - | ^^^^^ E111 + | ^^^^^ 7 | #: E112 8 | if False: | +error[syntax-error]: 9:1: Expected an indented block after `if` statement -E11.py:9:1: SyntaxError: Expected an indented block after `if` statement + --> E11.py:8:10 | 7 | #: E112 8 | if False: @@ -30,8 +34,9 @@ E11.py:9:1: SyntaxError: Expected an indented block after `if` statement 10 | #: E113 11 | print() | +error[syntax-error]: 12:1: Unexpected indentation -E11.py:12:1: SyntaxError: Unexpected indentation + --> E11.py:11:8 | 10 | #: E113 11 | print() @@ -40,8 +45,9 @@ E11.py:12:1: SyntaxError: Unexpected indentation 13 | #: E114 E116 14 | mimetype = 'application/x-directory' | +error[syntax-error]: 14:1: Expected a statement -E11.py:14:1: SyntaxError: Expected a statement + --> E11.py:13:13 | 12 | print() 13 | #: E114 E116 @@ -50,8 +56,9 @@ E11.py:14:1: SyntaxError: Expected a statement 15 | # 'httpd/unix-directory' 16 | create_date = False | +error[syntax-error]: 45:1: Expected an indented block after `if` statement -E11.py:45:1: SyntaxError: Expected an indented block after `if` statement + --> E11.py:44:13 | 43 | #: E112 44 | if False: # diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E112_E11.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E112_E11.py.snap index 70373df6f6..70a90bb31c 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E112_E11.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E112_E11.py.snap @@ -1,17 +1,20 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -E11.py:9:1: E112 Expected an indented block +error[E112]: 9:1: Expected an indented block + + --> E11.py:8:10 | 7 | #: E112 8 | if False: + | ^ 9 | print() - | E112 10 | #: E113 11 | print() | +error[syntax-error]: 9:1: Expected an indented block after `if` statement -E11.py:9:1: SyntaxError: Expected an indented block after `if` statement + --> E11.py:8:10 | 7 | #: E112 8 | if False: @@ -20,8 +23,9 @@ E11.py:9:1: SyntaxError: Expected an indented block after `if` statement 10 | #: E113 11 | print() | +error[syntax-error]: 12:1: Unexpected indentation -E11.py:12:1: SyntaxError: Unexpected indentation + --> E11.py:11:8 | 10 | #: E113 11 | print() @@ -30,8 +34,9 @@ E11.py:12:1: SyntaxError: Unexpected indentation 13 | #: E114 E116 14 | mimetype = 'application/x-directory' | +error[syntax-error]: 14:1: Expected a statement -E11.py:14:1: SyntaxError: Expected a statement + --> E11.py:13:13 | 12 | print() 13 | #: E114 E116 @@ -40,18 +45,20 @@ E11.py:14:1: SyntaxError: Expected a statement 15 | # 'httpd/unix-directory' 16 | create_date = False | +error[E112]: 45:1: Expected an indented block -E11.py:45:1: E112 Expected an indented block + --> E11.py:44:13 | 43 | #: E112 44 | if False: # + | ^ 45 | print() - | E112 46 | #: 47 | if False: | +error[syntax-error]: 45:1: Expected an indented block after `if` statement -E11.py:45:1: SyntaxError: Expected an indented block after `if` statement + --> E11.py:44:13 | 43 | #: E112 44 | if False: # diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E113_E11.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E113_E11.py.snap index 295b8830d3..713af49d89 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E113_E11.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E113_E11.py.snap @@ -1,7 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -E11.py:9:1: SyntaxError: Expected an indented block after `if` statement +error[syntax-error]: 9:1: Expected an indented block after `if` statement + + --> E11.py:8:10 | 7 | #: E112 8 | if False: @@ -10,18 +12,20 @@ E11.py:9:1: SyntaxError: Expected an indented block after `if` statement 10 | #: E113 11 | print() | +error[E113]: 12:1: Unexpected indentation -E11.py:12:1: E113 Unexpected indentation + --> E11.py:11:8 | 10 | #: E113 11 | print() 12 | print() - | ^^^^ E113 + | ^^^^ 13 | #: E114 E116 14 | mimetype = 'application/x-directory' | +error[syntax-error]: 12:1: Unexpected indentation -E11.py:12:1: SyntaxError: Unexpected indentation + --> E11.py:11:8 | 10 | #: E113 11 | print() @@ -30,8 +34,9 @@ E11.py:12:1: SyntaxError: Unexpected indentation 13 | #: E114 E116 14 | mimetype = 'application/x-directory' | +error[syntax-error]: 14:1: Expected a statement -E11.py:14:1: SyntaxError: Expected a statement + --> E11.py:13:13 | 12 | print() 13 | #: E114 E116 @@ -40,8 +45,9 @@ E11.py:14:1: SyntaxError: Expected a statement 15 | # 'httpd/unix-directory' 16 | create_date = False | +error[syntax-error]: 45:1: Expected an indented block after `if` statement -E11.py:45:1: SyntaxError: Expected an indented block after `if` statement + --> E11.py:44:13 | 43 | #: E112 44 | if False: # diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E114_E11.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E114_E11.py.snap index 46722a22f4..cf6a25a691 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E114_E11.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E114_E11.py.snap @@ -1,7 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -E11.py:9:1: SyntaxError: Expected an indented block after `if` statement +error[syntax-error]: 9:1: Expected an indented block after `if` statement + + --> E11.py:8:10 | 7 | #: E112 8 | if False: @@ -10,8 +12,9 @@ E11.py:9:1: SyntaxError: Expected an indented block after `if` statement 10 | #: E113 11 | print() | +error[syntax-error]: 12:1: Unexpected indentation -E11.py:12:1: SyntaxError: Unexpected indentation + --> E11.py:11:8 | 10 | #: E113 11 | print() @@ -20,8 +23,9 @@ E11.py:12:1: SyntaxError: Unexpected indentation 13 | #: E114 E116 14 | mimetype = 'application/x-directory' | +error[syntax-error]: 14:1: Expected a statement -E11.py:14:1: SyntaxError: Expected a statement + --> E11.py:13:13 | 12 | print() 13 | #: E114 E116 @@ -30,18 +34,20 @@ E11.py:14:1: SyntaxError: Expected a statement 15 | # 'httpd/unix-directory' 16 | create_date = False | +error[E114]: 15:1: Indentation is not a multiple of 4 (comment) -E11.py:15:1: E114 Indentation is not a multiple of 4 (comment) + --> E11.py:14:37 | 13 | #: E114 E116 14 | mimetype = 'application/x-directory' 15 | # 'httpd/unix-directory' - | ^^^^^ E114 + | ^^^^^ 16 | create_date = False 17 | #: E116 E116 E116 | +error[syntax-error]: 45:1: Expected an indented block after `if` statement -E11.py:45:1: SyntaxError: Expected an indented block after `if` statement + --> E11.py:44:13 | 43 | #: E112 44 | if False: # diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E115_E11.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E115_E11.py.snap index e51700d109..4c8fd6f1e2 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E115_E11.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E115_E11.py.snap @@ -1,7 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -E11.py:9:1: SyntaxError: Expected an indented block after `if` statement +error[syntax-error]: 9:1: Expected an indented block after `if` statement + + --> E11.py:8:10 | 7 | #: E112 8 | if False: @@ -10,8 +12,9 @@ E11.py:9:1: SyntaxError: Expected an indented block after `if` statement 10 | #: E113 11 | print() | +error[syntax-error]: 12:1: Unexpected indentation -E11.py:12:1: SyntaxError: Unexpected indentation + --> E11.py:11:8 | 10 | #: E113 11 | print() @@ -20,8 +23,9 @@ E11.py:12:1: SyntaxError: Unexpected indentation 13 | #: E114 E116 14 | mimetype = 'application/x-directory' | +error[syntax-error]: 14:1: Expected a statement -E11.py:14:1: SyntaxError: Expected a statement + --> E11.py:13:13 | 12 | print() 13 | #: E114 E116 @@ -30,68 +34,75 @@ E11.py:14:1: SyntaxError: Expected a statement 15 | # 'httpd/unix-directory' 16 | create_date = False | +error[E115]: 30:1: Expected an indented block (comment) -E11.py:30:1: E115 Expected an indented block (comment) + --> E11.py:29:13 | 28 | def start(self): 29 | if True: + | ^ 30 | # try: - | E115 31 | # self.master.start() 32 | # except MasterExit: | +error[E115]: 31:1: Expected an indented block (comment) -E11.py:31:1: E115 Expected an indented block (comment) + --> E11.py:30:13 | 29 | if True: 30 | # try: + | ^ 31 | # self.master.start() - | E115 32 | # except MasterExit: 33 | # self.shutdown() | +error[E115]: 32:1: Expected an indented block (comment) -E11.py:32:1: E115 Expected an indented block (comment) + --> E11.py:31:32 | 30 | # try: 31 | # self.master.start() + | ^ 32 | # except MasterExit: - | E115 33 | # self.shutdown() 34 | # finally: | +error[E115]: 33:1: Expected an indented block (comment) -E11.py:33:1: E115 Expected an indented block (comment) + --> E11.py:32:27 | 31 | # self.master.start() 32 | # except MasterExit: + | ^ 33 | # self.shutdown() - | E115 34 | # finally: 35 | # sys.exit() | +error[E115]: 34:1: Expected an indented block (comment) -E11.py:34:1: E115 Expected an indented block (comment) + --> E11.py:33:28 | 32 | # except MasterExit: 33 | # self.shutdown() + | ^ 34 | # finally: - | E115 35 | # sys.exit() 36 | self.master.start() | +error[E115]: 35:1: Expected an indented block (comment) -E11.py:35:1: E115 Expected an indented block (comment) + --> E11.py:34:17 | 33 | # self.shutdown() 34 | # finally: + | ^ 35 | # sys.exit() - | E115 36 | self.master.start() 37 | #: E117 | +error[syntax-error]: 45:1: Expected an indented block after `if` statement -E11.py:45:1: SyntaxError: Expected an indented block after `if` statement + --> E11.py:44:13 | 43 | #: E112 44 | if False: # diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E116_E11.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E116_E11.py.snap index 5a378f63e5..0dcfa5bce7 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E116_E11.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E116_E11.py.snap @@ -1,7 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -E11.py:9:1: SyntaxError: Expected an indented block after `if` statement +error[syntax-error]: 9:1: Expected an indented block after `if` statement + + --> E11.py:8:10 | 7 | #: E112 8 | if False: @@ -10,8 +12,9 @@ E11.py:9:1: SyntaxError: Expected an indented block after `if` statement 10 | #: E113 11 | print() | +error[syntax-error]: 12:1: Unexpected indentation -E11.py:12:1: SyntaxError: Unexpected indentation + --> E11.py:11:8 | 10 | #: E113 11 | print() @@ -20,8 +23,9 @@ E11.py:12:1: SyntaxError: Unexpected indentation 13 | #: E114 E116 14 | mimetype = 'application/x-directory' | +error[syntax-error]: 14:1: Expected a statement -E11.py:14:1: SyntaxError: Expected a statement + --> E11.py:13:13 | 12 | print() 13 | #: E114 E116 @@ -30,48 +34,53 @@ E11.py:14:1: SyntaxError: Expected a statement 15 | # 'httpd/unix-directory' 16 | create_date = False | +error[E116]: 15:1: Unexpected indentation (comment) -E11.py:15:1: E116 Unexpected indentation (comment) + --> E11.py:14:37 | 13 | #: E114 E116 14 | mimetype = 'application/x-directory' 15 | # 'httpd/unix-directory' - | ^^^^^ E116 + | ^^^^^ 16 | create_date = False 17 | #: E116 E116 E116 | +error[E116]: 22:1: Unexpected indentation (comment) -E11.py:22:1: E116 Unexpected indentation (comment) + --> E11.py:21:15 | 20 | self.master.start() 21 | # try: 22 | # self.master.start() - | ^^^^^^^^^^^^ E116 + | ^^^^^^^^^^^^ 23 | # except MasterExit: 24 | # self.shutdown() | +error[E116]: 24:1: Unexpected indentation (comment) -E11.py:24:1: E116 Unexpected indentation (comment) + --> E11.py:23:29 | 22 | # self.master.start() 23 | # except MasterExit: 24 | # self.shutdown() - | ^^^^^^^^^^^^ E116 + | ^^^^^^^^^^^^ 25 | # finally: 26 | # sys.exit() | +error[E116]: 26:1: Unexpected indentation (comment) -E11.py:26:1: E116 Unexpected indentation (comment) + --> E11.py:25:19 | 24 | # self.shutdown() 25 | # finally: 26 | # sys.exit() - | ^^^^^^^^^^^^ E116 + | ^^^^^^^^^^^^ 27 | #: E115 E115 E115 E115 E115 E115 28 | def start(self): | +error[syntax-error]: 45:1: Expected an indented block after `if` statement -E11.py:45:1: SyntaxError: Expected an indented block after `if` statement + --> E11.py:44:13 | 43 | #: E112 44 | if False: # diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E117_E11.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E117_E11.py.snap index 22ca83d0b0..f0741ce0f6 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E117_E11.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E117_E11.py.snap @@ -1,17 +1,20 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -E11.py:6:1: E117 Over-indented +error[E117]: 6:1: Over-indented + + --> E11.py:5:9 | 4 | #: E111 E117 5 | if True: 6 | print() - | ^^^^^ E117 + | ^^^^^ 7 | #: E112 8 | if False: | +error[syntax-error]: 9:1: Expected an indented block after `if` statement -E11.py:9:1: SyntaxError: Expected an indented block after `if` statement + --> E11.py:8:10 | 7 | #: E112 8 | if False: @@ -20,8 +23,9 @@ E11.py:9:1: SyntaxError: Expected an indented block after `if` statement 10 | #: E113 11 | print() | +error[syntax-error]: 12:1: Unexpected indentation -E11.py:12:1: SyntaxError: Unexpected indentation + --> E11.py:11:8 | 10 | #: E113 11 | print() @@ -30,8 +34,9 @@ E11.py:12:1: SyntaxError: Unexpected indentation 13 | #: E114 E116 14 | mimetype = 'application/x-directory' | +error[syntax-error]: 14:1: Expected a statement -E11.py:14:1: SyntaxError: Expected a statement + --> E11.py:13:13 | 12 | print() 13 | #: E114 E116 @@ -40,28 +45,31 @@ E11.py:14:1: SyntaxError: Expected a statement 15 | # 'httpd/unix-directory' 16 | create_date = False | +error[E117]: 39:1: Over-indented -E11.py:39:1: E117 Over-indented + --> E11.py:38:13 | 37 | #: E117 38 | def start(): 39 | print() - | ^^^^^^^^ E117 + | ^^^^^^^^ 40 | #: E117 W191 41 | def start(): | +error[E117]: 42:1: Over-indented -E11.py:42:1: E117 Over-indented + --> E11.py:41:13 | 40 | #: E117 W191 41 | def start(): 42 | print() - | ^^^^^^^^ E117 + | ^^^^^^^^ 43 | #: E112 44 | if False: # | +error[syntax-error]: 45:1: Expected an indented block after `if` statement -E11.py:45:1: SyntaxError: Expected an indented block after `if` statement + --> E11.py:44:13 | 43 | #: E112 44 | if False: # diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E201_E20.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E201_E20.py.snap index 4d0dbb2645..699db338ae 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E201_E20.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E201_E20.py.snap @@ -1,16 +1,17 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -E20.py:2:6: E201 [*] Whitespace after '(' +error[E201]: 2:6: [*] Whitespace after '(' + + --> E20.py:2:6 | 1 | #: E201:1:6 2 | spam( ham[1], {eggs: 2}) - | ^ E201 + | ^ 3 | #: E201:1:10 4 | spam(ham[ 1], {eggs: 2}) | = help: Remove whitespace before '(' - ℹ Safe fix 1 1 | #: E201:1:6 2 |-spam( ham[1], {eggs: 2}) @@ -19,17 +20,18 @@ E20.py:2:6: E201 [*] Whitespace after '(' 4 4 | spam(ham[ 1], {eggs: 2}) 5 5 | #: E201:1:15 -E20.py:4:10: E201 [*] Whitespace after '[' +error[E201]: 4:10: [*] Whitespace after '[' + + --> E20.py:4:10 | 2 | spam( ham[1], {eggs: 2}) 3 | #: E201:1:10 4 | spam(ham[ 1], {eggs: 2}) - | ^ E201 + | ^ 5 | #: E201:1:15 6 | spam(ham[1], { eggs: 2}) | = help: Remove whitespace before '[' - ℹ Safe fix 1 1 | #: E201:1:6 2 2 | spam( ham[1], {eggs: 2}) @@ -40,17 +42,18 @@ E20.py:4:10: E201 [*] Whitespace after '[' 6 6 | spam(ham[1], { eggs: 2}) 7 7 | #: E201:1:6 -E20.py:6:15: E201 [*] Whitespace after '{' +error[E201]: 6:15: [*] Whitespace after '{' + + --> E20.py:6:15 | 4 | spam(ham[ 1], {eggs: 2}) 5 | #: E201:1:15 6 | spam(ham[1], { eggs: 2}) - | ^ E201 + | ^ 7 | #: E201:1:6 8 | spam( ham[1], {eggs: 2}) | = help: Remove whitespace before '{' - ℹ Safe fix 3 3 | #: E201:1:10 4 4 | spam(ham[ 1], {eggs: 2}) @@ -61,17 +64,18 @@ E20.py:6:15: E201 [*] Whitespace after '{' 8 8 | spam( ham[1], {eggs: 2}) 9 9 | #: E201:1:10 -E20.py:8:6: E201 [*] Whitespace after '(' +error[E201]: 8:6: [*] Whitespace after '(' + + --> E20.py:8:6 | 6 | spam(ham[1], { eggs: 2}) 7 | #: E201:1:6 8 | spam( ham[1], {eggs: 2}) - | ^^^ E201 + | ^^^ 9 | #: E201:1:10 10 | spam(ham[ 1], {eggs: 2}) | = help: Remove whitespace before '(' - ℹ Safe fix 5 5 | #: E201:1:15 6 6 | spam(ham[1], { eggs: 2}) @@ -82,17 +86,18 @@ E20.py:8:6: E201 [*] Whitespace after '(' 10 10 | spam(ham[ 1], {eggs: 2}) 11 11 | #: E201:1:15 -E20.py:10:10: E201 [*] Whitespace after '[' +error[E201]: 10:10: [*] Whitespace after '[' + + --> E20.py:10:10 | 8 | spam( ham[1], {eggs: 2}) 9 | #: E201:1:10 10 | spam(ham[ 1], {eggs: 2}) - | ^^^ E201 + | ^^^ 11 | #: E201:1:15 12 | spam(ham[1], { eggs: 2}) | = help: Remove whitespace before '[' - ℹ Safe fix 7 7 | #: E201:1:6 8 8 | spam( ham[1], {eggs: 2}) @@ -103,17 +108,18 @@ E20.py:10:10: E201 [*] Whitespace after '[' 12 12 | spam(ham[1], { eggs: 2}) 13 13 | #: Okay -E20.py:12:15: E201 [*] Whitespace after '{' +error[E201]: 12:15: [*] Whitespace after '{' + + --> E20.py:12:15 | 10 | spam(ham[ 1], {eggs: 2}) 11 | #: E201:1:15 12 | spam(ham[1], { eggs: 2}) - | ^^ E201 + | ^^ 13 | #: Okay 14 | spam(ham[1], {eggs: 2}) | = help: Remove whitespace before '{' - ℹ Safe fix 9 9 | #: E201:1:10 10 10 | spam(ham[ 1], {eggs: 2}) @@ -124,16 +130,17 @@ E20.py:12:15: E201 [*] Whitespace after '{' 14 14 | spam(ham[1], {eggs: 2}) 15 15 | #: -E20.py:107:6: E201 [*] Whitespace after '[' +error[E201]: 107:6: [*] Whitespace after '[' + + --> E20.py:107:6 | 106 | #: E201:1:6 107 | spam[ ~ham] - | ^ E201 + | ^ 108 | 109 | #: Okay | = help: Remove whitespace before '[' - ℹ Safe fix 104 104 | #: 105 105 | @@ -144,16 +151,17 @@ E20.py:107:6: E201 [*] Whitespace after '[' 109 109 | #: Okay 110 110 | x = [ # -E20.py:116:5: E201 [*] Whitespace after '[' +error[E201]: 116:5: [*] Whitespace after '[' + + --> E20.py:116:5 | 114 | # F-strings 115 | f"{ {'a': 1} }" 116 | f"{[ { {'a': 1} } ]}" - | ^ E201 + | ^ 117 | f"normal { {f"{ { [1, 2] } }" } } normal" | = help: Remove whitespace before '[' - ℹ Safe fix 113 113 | 114 114 | # F-strings @@ -164,16 +172,17 @@ E20.py:116:5: E201 [*] Whitespace after '[' 118 118 | 119 119 | #: Okay -E20.py:145:5: E201 [*] Whitespace after '[' +error[E201]: 145:5: [*] Whitespace after '[' + + --> E20.py:145:5 | 144 | #: E201:1:5 145 | ham[ : upper] - | ^ E201 + | ^ 146 | 147 | #: Okay | = help: Remove whitespace before '[' - ℹ Safe fix 142 142 | ham[lower + offset : upper + offset] 143 143 | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E202_E20.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E202_E20.py.snap index d4044ba4a5..47bffb6c36 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E202_E20.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E202_E20.py.snap @@ -1,16 +1,17 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -E20.py:19:23: E202 [*] Whitespace before ')' +error[E202]: 19:23: [*] Whitespace before ')' + + --> E20.py:19:23 | 18 | #: E202:1:23 19 | spam(ham[1], {eggs: 2} ) - | ^ E202 + | ^ 20 | #: E202:1:22 21 | spam(ham[1], {eggs: 2 }) | = help: Remove whitespace before ')' - ℹ Safe fix 16 16 | 17 17 | @@ -21,17 +22,18 @@ E20.py:19:23: E202 [*] Whitespace before ')' 21 21 | spam(ham[1], {eggs: 2 }) 22 22 | #: E202:1:11 -E20.py:21:22: E202 [*] Whitespace before '}' +error[E202]: 21:22: [*] Whitespace before '}' + + --> E20.py:21:22 | 19 | spam(ham[1], {eggs: 2} ) 20 | #: E202:1:22 21 | spam(ham[1], {eggs: 2 }) - | ^ E202 + | ^ 22 | #: E202:1:11 23 | spam(ham[1 ], {eggs: 2}) | = help: Remove whitespace before '}' - ℹ Safe fix 18 18 | #: E202:1:23 19 19 | spam(ham[1], {eggs: 2} ) @@ -42,17 +44,18 @@ E20.py:21:22: E202 [*] Whitespace before '}' 23 23 | spam(ham[1 ], {eggs: 2}) 24 24 | #: E202:1:23 -E20.py:23:11: E202 [*] Whitespace before ']' +error[E202]: 23:11: [*] Whitespace before ']' + + --> E20.py:23:11 | 21 | spam(ham[1], {eggs: 2 }) 22 | #: E202:1:11 23 | spam(ham[1 ], {eggs: 2}) - | ^ E202 + | ^ 24 | #: E202:1:23 25 | spam(ham[1], {eggs: 2} ) | = help: Remove whitespace before ']' - ℹ Safe fix 20 20 | #: E202:1:22 21 21 | spam(ham[1], {eggs: 2 }) @@ -63,17 +66,18 @@ E20.py:23:11: E202 [*] Whitespace before ']' 25 25 | spam(ham[1], {eggs: 2} ) 26 26 | #: E202:1:22 -E20.py:25:23: E202 [*] Whitespace before ')' +error[E202]: 25:23: [*] Whitespace before ')' + + --> E20.py:25:23 | 23 | spam(ham[1 ], {eggs: 2}) 24 | #: E202:1:23 25 | spam(ham[1], {eggs: 2} ) - | ^^ E202 + | ^^ 26 | #: E202:1:22 27 | spam(ham[1], {eggs: 2 }) | = help: Remove whitespace before ')' - ℹ Safe fix 22 22 | #: E202:1:11 23 23 | spam(ham[1 ], {eggs: 2}) @@ -84,17 +88,18 @@ E20.py:25:23: E202 [*] Whitespace before ')' 27 27 | spam(ham[1], {eggs: 2 }) 28 28 | #: E202:1:11 -E20.py:27:22: E202 [*] Whitespace before '}' +error[E202]: 27:22: [*] Whitespace before '}' + + --> E20.py:27:22 | 25 | spam(ham[1], {eggs: 2} ) 26 | #: E202:1:22 27 | spam(ham[1], {eggs: 2 }) - | ^^^ E202 + | ^^^ 28 | #: E202:1:11 29 | spam(ham[1 ], {eggs: 2}) | = help: Remove whitespace before '}' - ℹ Safe fix 24 24 | #: E202:1:23 25 25 | spam(ham[1], {eggs: 2} ) @@ -105,17 +110,18 @@ E20.py:27:22: E202 [*] Whitespace before '}' 29 29 | spam(ham[1 ], {eggs: 2}) 30 30 | #: Okay -E20.py:29:11: E202 [*] Whitespace before ']' +error[E202]: 29:11: [*] Whitespace before ']' + + --> E20.py:29:11 | 27 | spam(ham[1], {eggs: 2 }) 28 | #: E202:1:11 29 | spam(ham[1 ], {eggs: 2}) - | ^^ E202 + | ^^ 30 | #: Okay 31 | spam(ham[1], {eggs: 2}) | = help: Remove whitespace before ']' - ℹ Safe fix 26 26 | #: E202:1:22 27 27 | spam(ham[1], {eggs: 2 }) @@ -126,16 +132,17 @@ E20.py:29:11: E202 [*] Whitespace before ']' 31 31 | spam(ham[1], {eggs: 2}) 32 32 | -E20.py:116:18: E202 [*] Whitespace before ']' +error[E202]: 116:18: [*] Whitespace before ']' + + --> E20.py:116:18 | 114 | # F-strings 115 | f"{ {'a': 1} }" 116 | f"{[ { {'a': 1} } ]}" - | ^ E202 + | ^ 117 | f"normal { {f"{ { [1, 2] } }" } } normal" | = help: Remove whitespace before ']' - ℹ Safe fix 113 113 | 114 114 | # F-strings @@ -146,16 +153,17 @@ E20.py:116:18: E202 [*] Whitespace before ']' 118 118 | 119 119 | #: Okay -E20.py:172:12: E202 [*] Whitespace before ']' +error[E202]: 172:12: [*] Whitespace before ']' + + --> E20.py:172:12 | 171 | #: E202:1:12 172 | ham[upper : ] - | ^ E202 + | ^ 173 | 174 | #: E203:1:10 | = help: Remove whitespace before ']' - ℹ Safe fix 169 169 | ham[upper :] 170 170 | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E203_E20.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E203_E20.py.snap index 7422f4309a..f64963d3a7 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E203_E20.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E203_E20.py.snap @@ -1,16 +1,17 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -E20.py:51:10: E203 [*] Whitespace before ':' +error[E203]: 51:10: [*] Whitespace before ':' + + --> E20.py:51:10 | 50 | #: E203:1:10 51 | if x == 4 : - | ^ E203 + | ^ 52 | print(x, y) 53 | x, y = y, x | = help: Remove whitespace before ':' - ℹ Safe fix 48 48 | 49 49 | @@ -21,17 +22,18 @@ E20.py:51:10: E203 [*] Whitespace before ':' 53 53 | x, y = y, x 54 54 | #: E203:1:10 -E20.py:55:10: E203 [*] Whitespace before ':' +error[E203]: 55:10: [*] Whitespace before ':' + + --> E20.py:55:10 | 53 | x, y = y, x 54 | #: E203:1:10 55 | if x == 4 : - | ^^^ E203 + | ^^^ 56 | print(x, y) 57 | x, y = y, x | = help: Remove whitespace before ':' - ℹ Safe fix 52 52 | print(x, y) 53 53 | x, y = y, x @@ -42,17 +44,18 @@ E20.py:55:10: E203 [*] Whitespace before ':' 57 57 | x, y = y, x 58 58 | #: E203:2:15 E702:2:16 -E20.py:60:16: E203 [*] Whitespace before ';' +error[E203]: 60:16: [*] Whitespace before ';' + + --> E20.py:60:16 | 58 | #: E203:2:15 E702:2:16 59 | if x == 4: 60 | print(x, y) ; x, y = y, x - | ^ E203 + | ^ 61 | #: E203:2:15 E702:2:16 62 | if x == 4: | = help: Remove whitespace before ';' - ℹ Safe fix 57 57 | x, y = y, x 58 58 | #: E203:2:15 E702:2:16 @@ -63,17 +66,18 @@ E20.py:60:16: E203 [*] Whitespace before ';' 62 62 | if x == 4: 63 63 | print(x, y) ; x, y = y, x -E20.py:63:16: E203 [*] Whitespace before ';' +error[E203]: 63:16: [*] Whitespace before ';' + + --> E20.py:63:16 | 61 | #: E203:2:15 E702:2:16 62 | if x == 4: 63 | print(x, y) ; x, y = y, x - | ^ E203 + | ^ 64 | #: E203:3:13 65 | if x == 4: | = help: Remove whitespace before ';' - ℹ Safe fix 60 60 | print(x, y) ; x, y = y, x 61 61 | #: E203:2:15 E702:2:16 @@ -84,17 +88,18 @@ E20.py:63:16: E203 [*] Whitespace before ';' 65 65 | if x == 4: 66 66 | print(x, y) -E20.py:67:13: E203 [*] Whitespace before ',' +error[E203]: 67:13: [*] Whitespace before ',' + + --> E20.py:67:13 | 65 | if x == 4: 66 | print(x, y) 67 | x, y = y , x - | ^ E203 + | ^ 68 | #: E203:3:13 69 | if x == 4: | = help: Remove whitespace before ',' - ℹ Safe fix 64 64 | #: E203:3:13 65 65 | if x == 4: @@ -105,17 +110,18 @@ E20.py:67:13: E203 [*] Whitespace before ',' 69 69 | if x == 4: 70 70 | print(x, y) -E20.py:71:13: E203 [*] Whitespace before ',' +error[E203]: 71:13: [*] Whitespace before ',' + + --> E20.py:71:13 | 69 | if x == 4: 70 | print(x, y) 71 | x, y = y , x - | ^^^^ E203 + | ^^^^ 72 | #: Okay 73 | if x == 4: | = help: Remove whitespace before ',' - ℹ Safe fix 68 68 | #: E203:3:13 69 69 | if x == 4: @@ -126,16 +132,17 @@ E20.py:71:13: E203 [*] Whitespace before ',' 73 73 | if x == 4: 74 74 | print(x, y) -E20.py:86:61: E203 [*] Whitespace before ':' +error[E203]: 86:61: [*] Whitespace before ':' + + --> E20.py:86:61 | 84 | #: E203 multi whitespace before : 85 | predictions = predictions[ 86 | len(past_covariates) // datamodule.hparams["downsample"] : - | ^^ E203 + | ^^ 87 | ] | = help: Remove whitespace before ':' - ℹ Safe fix 83 83 | 84 84 | #: E203 multi whitespace before : @@ -146,16 +153,17 @@ E20.py:86:61: E203 [*] Whitespace before ':' 88 88 | 89 89 | #: E203 tab before : -E20.py:91:61: E203 [*] Whitespace before ':' +error[E203]: 91:61: [*] Whitespace before ':' + + --> E20.py:91:61 | 89 | #: E203 tab before : 90 | predictions = predictions[ 91 | len(past_covariates) // datamodule.hparams["downsample"] : - | ^^^^ E203 + | ^^^^ 92 | ] | = help: Remove whitespace before ':' - ℹ Safe fix 88 88 | 89 89 | #: E203 tab before : @@ -166,16 +174,17 @@ E20.py:91:61: E203 [*] Whitespace before ':' 93 93 | 94 94 | #: E203 single whitespace before : with line a comment -E20.py:101:61: E203 [*] Whitespace before ':' +error[E203]: 101:61: [*] Whitespace before ':' + + --> E20.py:101:61 | 99 | #: E203 multi whitespace before : with line a comment 100 | predictions = predictions[ 101 | len(past_covariates) // datamodule.hparams["downsample"] : # Just some comment - | ^^ E203 + | ^^ 102 | ] | = help: Remove whitespace before ':' - ℹ Safe fix 98 98 | 99 99 | #: E203 multi whitespace before : with line a comment @@ -186,16 +195,17 @@ E20.py:101:61: E203 [*] Whitespace before ':' 103 103 | 104 104 | #: -E20.py:126:16: E203 [*] Whitespace before ':' +error[E203]: 126:16: [*] Whitespace before ':' + + --> E20.py:126:16 | 125 | #: E203:1:19 126 | {lower + offset : upper + offset} - | ^ E203 + | ^ 127 | 128 | #: E203:1:19 | = help: Remove whitespace before ':' - ℹ Safe fix 123 123 | ham[(lower + offset) : upper + offset] 124 124 | @@ -206,16 +216,17 @@ E20.py:126:16: E203 [*] Whitespace before ':' 128 128 | #: E203:1:19 129 129 | ham[lower + offset : upper + offset] -E20.py:129:19: E203 [*] Whitespace before ':' +error[E203]: 129:19: [*] Whitespace before ':' + + --> E20.py:129:19 | 128 | #: E203:1:19 129 | ham[lower + offset : upper + offset] - | ^^ E203 + | ^^ 130 | 131 | #: Okay | = help: Remove whitespace before ':' - ℹ Safe fix 126 126 | {lower + offset : upper + offset} 127 127 | @@ -226,16 +237,17 @@ E20.py:129:19: E203 [*] Whitespace before ':' 131 131 | #: Okay 132 132 | release_lines = history_file_lines[history_file_lines.index('## Unreleased') + 1: -1] -E20.py:157:21: E203 [*] Whitespace before ':' +error[E203]: 157:21: [*] Whitespace before ':' + + --> E20.py:157:21 | 156 | #: E203:1:21 157 | ham[lower + offset : : upper + offset] - | ^ E203 + | ^ 158 | 159 | #: E203:1:20 | = help: Remove whitespace before ':' - ℹ Safe fix 154 154 | ham[lower + offset::upper + offset] 155 155 | @@ -246,16 +258,17 @@ E20.py:157:21: E203 [*] Whitespace before ':' 159 159 | #: E203:1:20 160 160 | ham[lower + offset: :upper + offset] -E20.py:160:20: E203 [*] Whitespace before ':' +error[E203]: 160:20: [*] Whitespace before ':' + + --> E20.py:160:20 | 159 | #: E203:1:20 160 | ham[lower + offset: :upper + offset] - | ^ E203 + | ^ 161 | 162 | #: E203:1:20 | = help: Remove whitespace before ':' - ℹ Safe fix 157 157 | ham[lower + offset : : upper + offset] 158 158 | @@ -266,16 +279,17 @@ E20.py:160:20: E203 [*] Whitespace before ':' 162 162 | #: E203:1:20 163 163 | ham[{lower + offset : upper + offset} : upper + offset] -E20.py:163:20: E203 [*] Whitespace before ':' +error[E203]: 163:20: [*] Whitespace before ':' + + --> E20.py:163:20 | 162 | #: E203:1:20 163 | ham[{lower + offset : upper + offset} : upper + offset] - | ^ E203 + | ^ 164 | 165 | #: Okay | = help: Remove whitespace before ':' - ℹ Safe fix 160 160 | ham[lower + offset: :upper + offset] 161 161 | @@ -286,16 +300,17 @@ E20.py:163:20: E203 [*] Whitespace before ':' 165 165 | #: Okay 166 166 | ham[upper:] -E20.py:175:10: E203 [*] Whitespace before ':' +error[E203]: 175:10: [*] Whitespace before ':' + + --> E20.py:175:10 | 174 | #: E203:1:10 175 | ham[upper :] - | ^^ E203 + | ^^ 176 | 177 | #: Okay | = help: Remove whitespace before ':' - ℹ Safe fix 172 172 | ham[upper : ] 173 173 | @@ -306,16 +321,17 @@ E20.py:175:10: E203 [*] Whitespace before ':' 177 177 | #: Okay 178 178 | ham[lower +1 :, "columnname"] -E20.py:181:14: E203 [*] Whitespace before ':' +error[E203]: 181:14: [*] Whitespace before ':' + + --> E20.py:181:14 | 180 | #: E203:1:13 181 | ham[lower + 1 :, "columnname"] - | ^^ E203 + | ^^ 182 | 183 | #: Okay | = help: Remove whitespace before ':' - ℹ Safe fix 178 178 | ham[lower +1 :, "columnname"] 179 179 | @@ -326,16 +342,17 @@ E20.py:181:14: E203 [*] Whitespace before ':' 183 183 | #: Okay 184 184 | f"{ham[lower +1 :, "columnname"]}" -E20.py:187:17: E203 [*] Whitespace before ':' +error[E203]: 187:17: [*] Whitespace before ':' + + --> E20.py:187:17 | 186 | #: E203:1:13 187 | f"{ham[lower + 1 :, "columnname"]}" - | ^^ E203 + | ^^ 188 | 189 | #: Okay: https://github.com/astral-sh/ruff/issues/12023 | = help: Remove whitespace before ':' - ℹ Safe fix 184 184 | f"{ham[lower +1 :, "columnname"]}" 185 185 | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E204_E204.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E204_E204.py.snap index 050562950c..3e4499ba33 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E204_E204.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E204_E204.py.snap @@ -1,16 +1,17 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -E204.py:14:2: E204 [*] Whitespace after decorator +error[E204]: 14:2: [*] Whitespace after decorator + + --> E204.py:14:2 | 13 | # E204 14 | @ foo - | ^ E204 + | ^ 15 | def baz(): 16 | print('baz') | = help: Remove whitespace - ℹ Safe fix 11 11 | print('bar') 12 12 | @@ -21,16 +22,17 @@ E204.py:14:2: E204 [*] Whitespace after decorator 16 16 | print('baz') 17 17 | -E204.py:25:6: E204 [*] Whitespace after decorator +error[E204]: 25:6: [*] Whitespace after decorator + + --> E204.py:25:6 | 24 | # E204 25 | @ foo - | ^ E204 + | ^ 26 | def baz(self): 27 | print('baz') | = help: Remove whitespace - ℹ Safe fix 22 22 | print('bar') 23 23 | @@ -41,18 +43,18 @@ E204.py:25:6: E204 [*] Whitespace after decorator 27 27 | print('baz') 28 28 | -E204.py:31:2: E204 [*] Whitespace after decorator +error[E204]: 31:2: [*] Whitespace after decorator + + --> E204.py:31:2 | -30 | # E204 -31 | @ \ - | __^ -32 | | foo - | |_^ E204 -33 | def baz(): -34 | print('baz') +30 | # E204 +31 | @ \ + | ^^ +32 | foo +33 | def baz(): +34 | print('baz') | = help: Remove whitespace - ℹ Safe fix 28 28 | 29 29 | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E211_E21.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E211_E21.py.snap index 7079b9e3eb..171dad90c7 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E211_E21.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E211_E21.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[E211]: E21.py:2:5: [*] Whitespace before '(' +error[E211]: 2:5: [*] Whitespace before '(' + --> E21.py:2:5 | 1 | #: E211 2 | spam (1) @@ -19,8 +20,9 @@ error[E211]: E21.py:2:5: [*] Whitespace before '(' 4 4 | dict ['key'] = list [index] 5 5 | #: E211 -error[E211]: E21.py:4:5: [*] Whitespace before '[' +error[E211]: 4:5: [*] Whitespace before '[' + --> E21.py:4:5 | 2 | spam (1) 3 | #: E211 E211 @@ -40,8 +42,9 @@ error[E211]: E21.py:4:5: [*] Whitespace before '[' 6 6 | dict['key'] ['subkey'] = list[index] 7 7 | #: Okay -error[E211]: E21.py:4:20: [*] Whitespace before '[' +error[E211]: 4:20: [*] Whitespace before '[' + --> E21.py:4:20 | 2 | spam (1) 3 | #: E211 E211 @@ -61,8 +64,9 @@ error[E211]: E21.py:4:20: [*] Whitespace before '[' 6 6 | dict['key'] ['subkey'] = list[index] 7 7 | #: Okay -error[E211]: E21.py:6:12: [*] Whitespace before '[' +error[E211]: 6:12: [*] Whitespace before '[' + --> E21.py:6:12 | 4 | dict ['key'] = list [index] 5 | #: E211 @@ -82,8 +86,9 @@ error[E211]: E21.py:6:12: [*] Whitespace before '[' 8 8 | spam(1) 9 9 | dict['key'] = list[index] -error[E211]: E21.py:17:15: [*] Whitespace before '(' +error[E211]: 17:15: [*] Whitespace before '(' + --> E21.py:17:15 | 17 | def fetch_name () -> Union[str, None]: | ^ @@ -100,8 +105,9 @@ error[E211]: E21.py:17:15: [*] Whitespace before '(' 19 19 | 20 20 | Returns: -error[E211]: E21.py:27:19: [*] Whitespace before '(' +error[E211]: 27:19: [*] Whitespace before '(' + --> E21.py:27:19 | 25 | # test commented code 26 | # Logger.info("test code") @@ -121,8 +127,9 @@ error[E211]: E21.py:27:19: [*] Whitespace before '(' 29 29 | return sys.argv[i + 1] 30 30 | return None -error[E211]: E21.py:27:27: [*] Whitespace before '(' +error[E211]: 27:27: [*] Whitespace before '(' + --> E21.py:27:27 | 25 | # test commented code 26 | # Logger.info("test code") diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E221_E22.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E221_E22.py.snap index 456429cfcd..c9336dd621 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E221_E22.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E221_E22.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[E221]: E22.py:3:6: [*] Multiple spaces before operator +error[E221]: 3:6: [*] Multiple spaces before operator + --> E22.py:3:6 | 1 | #: E221 2 | a = 12 + 3 @@ -21,8 +22,9 @@ error[E221]: E22.py:3:6: [*] Multiple spaces before operator 5 5 | x = 1 6 6 | y = 2 -error[E221]: E22.py:5:2: [*] Multiple spaces before operator +error[E221]: 5:2: [*] Multiple spaces before operator + --> E22.py:5:2 | 3 | b = 4 + 5 4 | #: E221 E221 @@ -42,8 +44,9 @@ error[E221]: E22.py:5:2: [*] Multiple spaces before operator 7 7 | long_variable = 3 8 8 | #: E221 E221 -error[E221]: E22.py:6:2: [*] Multiple spaces before operator +error[E221]: 6:2: [*] Multiple spaces before operator + --> E22.py:6:2 | 4 | #: E221 E221 5 | x = 1 @@ -63,8 +66,9 @@ error[E221]: E22.py:6:2: [*] Multiple spaces before operator 8 8 | #: E221 E221 9 9 | x[0] = 1 -error[E221]: E22.py:9:5: [*] Multiple spaces before operator +error[E221]: 9:5: [*] Multiple spaces before operator + --> E22.py:9:5 | 7 | long_variable = 3 8 | #: E221 E221 @@ -84,8 +88,9 @@ error[E221]: E22.py:9:5: [*] Multiple spaces before operator 11 11 | long_variable = 3 12 12 | #: E221 E221 -error[E221]: E22.py:10:5: [*] Multiple spaces before operator +error[E221]: 10:5: [*] Multiple spaces before operator + --> E22.py:10:5 | 8 | #: E221 E221 9 | x[0] = 1 @@ -105,8 +110,9 @@ error[E221]: E22.py:10:5: [*] Multiple spaces before operator 12 12 | #: E221 E221 13 13 | x = f(x) + 1 -error[E221]: E22.py:13:9: [*] Multiple spaces before operator +error[E221]: 13:9: [*] Multiple spaces before operator + --> E22.py:13:9 | 11 | long_variable = 3 12 | #: E221 E221 @@ -126,8 +132,9 @@ error[E221]: E22.py:13:9: [*] Multiple spaces before operator 15 15 | z = x[0] + 3 16 16 | #: E221:3:14 -error[E221]: E22.py:15:9: [*] Multiple spaces before operator +error[E221]: 15:9: [*] Multiple spaces before operator + --> E22.py:15:9 | 13 | x = f(x) + 1 14 | y = long_variable + 2 @@ -147,8 +154,9 @@ error[E221]: E22.py:15:9: [*] Multiple spaces before operator 17 17 | text = """ 18 18 | bar -error[E221]: E22.py:19:14: [*] Multiple spaces before operator +error[E221]: 19:14: [*] Multiple spaces before operator + --> E22.py:19:14 | 17 | text = """ 18 | bar diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E222_E22.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E222_E22.py.snap index 8250d5ae63..a6e0b3f308 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E222_E22.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E222_E22.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[E222]: E22.py:28:8: [*] Multiple spaces after operator +error[E222]: 28:8: [*] Multiple spaces after operator + --> E22.py:28:8 | 27 | #: E222 28 | a = a + 1 @@ -21,8 +22,9 @@ error[E222]: E22.py:28:8: [*] Multiple spaces after operator 30 30 | #: E222 E222 31 31 | x = -1 -error[E222]: E22.py:31:4: [*] Multiple spaces after operator +error[E222]: 31:4: [*] Multiple spaces after operator + --> E22.py:31:4 | 29 | b = b + 10 30 | #: E222 E222 @@ -42,8 +44,9 @@ error[E222]: E22.py:31:4: [*] Multiple spaces after operator 33 33 | long_variable = 3 34 34 | #: E222 E222 -error[E222]: E22.py:32:4: [*] Multiple spaces after operator +error[E222]: 32:4: [*] Multiple spaces after operator + --> E22.py:32:4 | 30 | #: E222 E222 31 | x = -1 @@ -63,8 +66,9 @@ error[E222]: E22.py:32:4: [*] Multiple spaces after operator 34 34 | #: E222 E222 35 35 | x[0] = 1 -error[E222]: E22.py:35:7: [*] Multiple spaces after operator +error[E222]: 35:7: [*] Multiple spaces after operator + --> E22.py:35:7 | 33 | long_variable = 3 34 | #: E222 E222 @@ -84,8 +88,9 @@ error[E222]: E22.py:35:7: [*] Multiple spaces after operator 37 37 | long_variable = 3 38 38 | #: -error[E222]: E22.py:36:7: [*] Multiple spaces after operator +error[E222]: 36:7: [*] Multiple spaces after operator + --> E22.py:36:7 | 34 | #: E222 E222 35 | x[0] = 1 diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E223_E22.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E223_E22.py.snap index c3874b0dd5..77b03948a7 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E223_E22.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E223_E22.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[E223]: E22.py:43:2: [*] Tab before operator +error[E223]: 43:2: [*] Tab before operator + --> E22.py:43:2 | 41 | #: E223 42 | foobart = 4 diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E224_E22.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E224_E22.py.snap index 9104316471..92b1bf1c04 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E224_E22.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E224_E22.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[E224]: E22.py:48:5: [*] Tab after operator +error[E224]: 48:5: [*] Tab after operator + --> E22.py:48:5 | 47 | #: E224 48 | a += 1 diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E225_E22.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E225_E22.py.snap index 0b9ab71e8c..f3975af446 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E225_E22.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E225_E22.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[E225]: E22.py:54:11: [*] Missing whitespace around operator +error[E225]: 54:11: [*] Missing whitespace around operator + --> E22.py:54:11 | 53 | #: E225 54 | submitted +=1 @@ -21,8 +22,9 @@ error[E225]: E22.py:54:11: [*] Missing whitespace around operator 56 56 | submitted+= 1 57 57 | #: E225 -error[E225]: E22.py:56:10: [*] Missing whitespace around operator +error[E225]: 56:10: [*] Missing whitespace around operator + --> E22.py:56:10 | 54 | submitted +=1 55 | #: E225 @@ -42,8 +44,9 @@ error[E225]: E22.py:56:10: [*] Missing whitespace around operator 58 58 | c =-1 59 59 | #: E225 -error[E225]: E22.py:58:3: [*] Missing whitespace around operator +error[E225]: 58:3: [*] Missing whitespace around operator + --> E22.py:58:3 | 56 | submitted+= 1 57 | #: E225 @@ -63,8 +66,9 @@ error[E225]: E22.py:58:3: [*] Missing whitespace around operator 60 60 | x = x /2 - 1 61 61 | #: E225 -error[E225]: E22.py:76:2: [*] Missing whitespace around operator +error[E225]: 76:2: [*] Missing whitespace around operator + --> E22.py:76:2 | 74 | _1kB = _1MB>> 10 75 | #: E225 E225 @@ -84,8 +88,9 @@ error[E225]: E22.py:76:2: [*] Missing whitespace around operator 78 78 | i=i +1 79 79 | #: E225 -error[E225]: E22.py:78:2: [*] Missing whitespace around operator +error[E225]: 78:2: [*] Missing whitespace around operator + --> E22.py:78:2 | 76 | i=i+ 1 77 | #: E225 E225 @@ -105,8 +110,9 @@ error[E225]: E22.py:78:2: [*] Missing whitespace around operator 80 80 | i = 1and 1 81 81 | #: E225 -error[E225]: E22.py:80:6: [*] Missing whitespace around operator +error[E225]: 80:6: [*] Missing whitespace around operator + --> E22.py:80:6 | 78 | i=i +1 79 | #: E225 @@ -126,8 +132,9 @@ error[E225]: E22.py:80:6: [*] Missing whitespace around operator 82 82 | i = 1or 0 83 83 | #: E225 -error[E225]: E22.py:82:6: [*] Missing whitespace around operator +error[E225]: 82:6: [*] Missing whitespace around operator + --> E22.py:82:6 | 80 | i = 1and 1 81 | #: E225 @@ -147,8 +154,9 @@ error[E225]: E22.py:82:6: [*] Missing whitespace around operator 84 84 | 1is 1 85 85 | #: E225 -error[E225]: E22.py:84:2: [*] Missing whitespace around operator +error[E225]: 84:2: [*] Missing whitespace around operator + --> E22.py:84:2 | 82 | i = 1or 0 83 | #: E225 @@ -168,8 +176,9 @@ error[E225]: E22.py:84:2: [*] Missing whitespace around operator 86 86 | 1in [] 87 87 | #: E225 -error[E225]: E22.py:86:2: [*] Missing whitespace around operator +error[E225]: 86:2: [*] Missing whitespace around operator + --> E22.py:86:2 | 84 | 1is 1 85 | #: E225 @@ -189,8 +198,9 @@ error[E225]: E22.py:86:2: [*] Missing whitespace around operator 88 88 | i = 1 @2 89 89 | #: E225 -error[E225]: E22.py:92:2: [*] Missing whitespace around operator +error[E225]: 92:2: [*] Missing whitespace around operator + --> E22.py:92:2 | 90 | i = 1@ 2 91 | #: E225 E226 @@ -210,8 +220,9 @@ error[E225]: E22.py:92:2: [*] Missing whitespace around operator 94 94 | i =i+1 95 95 | #: E225 E226 -error[E225]: E22.py:94:3: [*] Missing whitespace around operator +error[E225]: 94:3: [*] Missing whitespace around operator + --> E22.py:94:3 | 92 | i=i+1 93 | #: E225 E226 @@ -231,8 +242,9 @@ error[E225]: E22.py:94:3: [*] Missing whitespace around operator 96 96 | i= i+1 97 97 | #: E225 E226 -error[E225]: E22.py:96:2: [*] Missing whitespace around operator +error[E225]: 96:2: [*] Missing whitespace around operator + --> E22.py:96:2 | 94 | i =i+1 95 | #: E225 E226 diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E226_E22.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E226_E22.py.snap index 78ec5543f6..2b0b45e833 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E226_E22.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E226_E22.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[E226]: E22.py:60:7: [*] Missing whitespace around arithmetic operator +error[E226]: 60:7: [*] Missing whitespace around arithmetic operator + --> E22.py:60:7 | 58 | c =-1 59 | #: E225 @@ -22,8 +23,9 @@ error[E226]: E22.py:60:7: [*] Missing whitespace around arithmetic operator 62 62 | c = alpha -4 63 63 | #: E225 -error[E226]: E22.py:62:11: [*] Missing whitespace around arithmetic operator +error[E226]: 62:11: [*] Missing whitespace around arithmetic operator + --> E22.py:62:11 | 60 | x = x /2 - 1 61 | #: E225 @@ -43,8 +45,9 @@ error[E226]: E22.py:62:11: [*] Missing whitespace around arithmetic operator 64 64 | c = alpha- 4 65 65 | #: E225 -error[E226]: E22.py:64:10: [*] Missing whitespace around arithmetic operator +error[E226]: 64:10: [*] Missing whitespace around arithmetic operator + --> E22.py:64:10 | 62 | c = alpha -4 63 | #: E225 @@ -64,8 +67,9 @@ error[E226]: E22.py:64:10: [*] Missing whitespace around arithmetic operator 66 66 | z = x **y 67 67 | #: E225 -error[E226]: E22.py:66:7: [*] Missing whitespace around arithmetic operator +error[E226]: 66:7: [*] Missing whitespace around arithmetic operator + --> E22.py:66:7 | 64 | c = alpha- 4 65 | #: E225 @@ -85,8 +89,9 @@ error[E226]: E22.py:66:7: [*] Missing whitespace around arithmetic operator 68 68 | z = (x + 1) **y 69 69 | #: E225 -error[E226]: E22.py:68:13: [*] Missing whitespace around arithmetic operator +error[E226]: 68:13: [*] Missing whitespace around arithmetic operator + --> E22.py:68:13 | 66 | z = x **y 67 | #: E225 @@ -106,8 +111,9 @@ error[E226]: E22.py:68:13: [*] Missing whitespace around arithmetic operator 70 70 | z = (x + 1)** y 71 71 | #: E225 -error[E226]: E22.py:70:12: [*] Missing whitespace around arithmetic operator +error[E226]: 70:12: [*] Missing whitespace around arithmetic operator + --> E22.py:70:12 | 68 | z = (x + 1) **y 69 | #: E225 @@ -127,8 +133,9 @@ error[E226]: E22.py:70:12: [*] Missing whitespace around arithmetic operator 72 72 | _1kB = _1MB >>10 73 73 | #: E225 -error[E226]: E22.py:76:4: [*] Missing whitespace around arithmetic operator +error[E226]: 76:4: [*] Missing whitespace around arithmetic operator + --> E22.py:76:4 | 74 | _1kB = _1MB>> 10 75 | #: E225 E225 @@ -148,8 +155,9 @@ error[E226]: E22.py:76:4: [*] Missing whitespace around arithmetic operator 78 78 | i=i +1 79 79 | #: E225 -error[E226]: E22.py:78:5: [*] Missing whitespace around arithmetic operator +error[E226]: 78:5: [*] Missing whitespace around arithmetic operator + --> E22.py:78:5 | 76 | i=i+ 1 77 | #: E225 E225 @@ -169,8 +177,9 @@ error[E226]: E22.py:78:5: [*] Missing whitespace around arithmetic operator 80 80 | i = 1and 1 81 81 | #: E225 -error[E226]: E22.py:88:7: [*] Missing whitespace around arithmetic operator +error[E226]: 88:7: [*] Missing whitespace around arithmetic operator + --> E22.py:88:7 | 86 | 1in [] 87 | #: E225 @@ -190,8 +199,9 @@ error[E226]: E22.py:88:7: [*] Missing whitespace around arithmetic operator 90 90 | i = 1@ 2 91 91 | #: E225 E226 -error[E226]: E22.py:90:6: [*] Missing whitespace around arithmetic operator +error[E226]: 90:6: [*] Missing whitespace around arithmetic operator + --> E22.py:90:6 | 88 | i = 1 @2 89 | #: E225 @@ -211,8 +221,9 @@ error[E226]: E22.py:90:6: [*] Missing whitespace around arithmetic operator 92 92 | i=i+1 93 93 | #: E225 E226 -error[E226]: E22.py:92:4: [*] Missing whitespace around arithmetic operator +error[E226]: 92:4: [*] Missing whitespace around arithmetic operator + --> E22.py:92:4 | 90 | i = 1@ 2 91 | #: E225 E226 @@ -232,8 +243,9 @@ error[E226]: E22.py:92:4: [*] Missing whitespace around arithmetic operator 94 94 | i =i+1 95 95 | #: E225 E226 -error[E226]: E22.py:94:5: [*] Missing whitespace around arithmetic operator +error[E226]: 94:5: [*] Missing whitespace around arithmetic operator + --> E22.py:94:5 | 92 | i=i+1 93 | #: E225 E226 @@ -253,8 +265,9 @@ error[E226]: E22.py:94:5: [*] Missing whitespace around arithmetic operator 96 96 | i= i+1 97 97 | #: E225 E226 -error[E226]: E22.py:96:5: [*] Missing whitespace around arithmetic operator +error[E226]: 96:5: [*] Missing whitespace around arithmetic operator + --> E22.py:96:5 | 94 | i =i+1 95 | #: E225 E226 @@ -274,8 +287,9 @@ error[E226]: E22.py:96:5: [*] Missing whitespace around arithmetic operator 98 98 | c = (a +b)*(a - b) 99 99 | #: E225 E226 -error[E226]: E22.py:98:8: [*] Missing whitespace around arithmetic operator +error[E226]: 98:8: [*] Missing whitespace around arithmetic operator + --> E22.py:98:8 | 96 | i= i+1 97 | #: E225 E226 @@ -295,8 +309,9 @@ error[E226]: E22.py:98:8: [*] Missing whitespace around arithmetic operator 100 100 | c = (a+ b)*(a - b) 101 101 | #: -error[E226]: E22.py:98:11: [*] Missing whitespace around arithmetic operator +error[E226]: 98:11: [*] Missing whitespace around arithmetic operator + --> E22.py:98:11 | 96 | i= i+1 97 | #: E225 E226 @@ -316,8 +331,9 @@ error[E226]: E22.py:98:11: [*] Missing whitespace around arithmetic operator 100 100 | c = (a+ b)*(a - b) 101 101 | #: -error[E226]: E22.py:100:7: [*] Missing whitespace around arithmetic operator +error[E226]: 100:7: [*] Missing whitespace around arithmetic operator + --> E22.py:100:7 | 98 | c = (a +b)*(a - b) 99 | #: E225 E226 @@ -336,8 +352,9 @@ error[E226]: E22.py:100:7: [*] Missing whitespace around arithmetic operator 102 102 | 103 103 | #: E226 -error[E226]: E22.py:100:11: [*] Missing whitespace around arithmetic operator +error[E226]: 100:11: [*] Missing whitespace around arithmetic operator + --> E22.py:100:11 | 98 | c = (a +b)*(a - b) 99 | #: E225 E226 @@ -356,8 +373,9 @@ error[E226]: E22.py:100:11: [*] Missing whitespace around arithmetic operator 102 102 | 103 103 | #: E226 -error[E226]: E22.py:104:6: [*] Missing whitespace around arithmetic operator +error[E226]: 104:6: [*] Missing whitespace around arithmetic operator + --> E22.py:104:6 | 103 | #: E226 104 | z = 2//30 @@ -376,8 +394,9 @@ error[E226]: E22.py:104:6: [*] Missing whitespace around arithmetic operator 106 106 | c = (a+b) * (a-b) 107 107 | #: E226 -error[E226]: E22.py:106:7: [*] Missing whitespace around arithmetic operator +error[E226]: 106:7: [*] Missing whitespace around arithmetic operator + --> E22.py:106:7 | 104 | z = 2//30 105 | #: E226 E226 @@ -397,8 +416,9 @@ error[E226]: E22.py:106:7: [*] Missing whitespace around arithmetic operator 108 108 | norman = True+False 109 109 | #: E226 -error[E226]: E22.py:106:15: [*] Missing whitespace around arithmetic operator +error[E226]: 106:15: [*] Missing whitespace around arithmetic operator + --> E22.py:106:15 | 104 | z = 2//30 105 | #: E226 E226 @@ -418,8 +438,9 @@ error[E226]: E22.py:106:15: [*] Missing whitespace around arithmetic operator 108 108 | norman = True+False 109 109 | #: E226 -error[E226]: E22.py:110:6: [*] Missing whitespace around arithmetic operator +error[E226]: 110:6: [*] Missing whitespace around arithmetic operator + --> E22.py:110:6 | 108 | norman = True+False 109 | #: E226 @@ -439,8 +460,9 @@ error[E226]: E22.py:110:6: [*] Missing whitespace around arithmetic operator 112 112 | x = x/2 - 1 113 113 | #: E226 E226 -error[E226]: E22.py:112:6: [*] Missing whitespace around arithmetic operator +error[E226]: 112:6: [*] Missing whitespace around arithmetic operator + --> E22.py:112:6 | 110 | x = x*2 - 1 111 | #: E226 @@ -460,8 +482,9 @@ error[E226]: E22.py:112:6: [*] Missing whitespace around arithmetic operator 114 114 | hypot2 = x*x + y*y 115 115 | #: E226 -error[E226]: E22.py:114:11: [*] Missing whitespace around arithmetic operator +error[E226]: 114:11: [*] Missing whitespace around arithmetic operator + --> E22.py:114:11 | 112 | x = x/2 - 1 113 | #: E226 E226 @@ -481,8 +504,9 @@ error[E226]: E22.py:114:11: [*] Missing whitespace around arithmetic operator 116 116 | c = (a + b)*(a - b) 117 117 | #: E226 -error[E226]: E22.py:114:17: [*] Missing whitespace around arithmetic operator +error[E226]: 114:17: [*] Missing whitespace around arithmetic operator + --> E22.py:114:17 | 112 | x = x/2 - 1 113 | #: E226 E226 @@ -502,8 +526,9 @@ error[E226]: E22.py:114:17: [*] Missing whitespace around arithmetic operator 116 116 | c = (a + b)*(a - b) 117 117 | #: E226 -error[E226]: E22.py:116:12: [*] Missing whitespace around arithmetic operator +error[E226]: 116:12: [*] Missing whitespace around arithmetic operator + --> E22.py:116:12 | 114 | hypot2 = x*x + y*y 115 | #: E226 @@ -523,8 +548,9 @@ error[E226]: E22.py:116:12: [*] Missing whitespace around arithmetic operator 118 118 | def halves(n): 119 119 | return (i//2 for i in range(n)) -error[E226]: E22.py:119:14: [*] Missing whitespace around arithmetic operator +error[E226]: 119:14: [*] Missing whitespace around arithmetic operator + --> E22.py:119:14 | 117 | #: E226 118 | def halves(n): diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E227_E22.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E227_E22.py.snap index b6ac92a9b0..705757939c 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E227_E22.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E227_E22.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[E227]: E22.py:72:13: [*] Missing whitespace around bitwise or shift operator +error[E227]: 72:13: [*] Missing whitespace around bitwise or shift operator + --> E22.py:72:13 | 70 | z = (x + 1)** y 71 | #: E225 @@ -22,8 +23,9 @@ error[E227]: E22.py:72:13: [*] Missing whitespace around bitwise or shift operat 74 74 | _1kB = _1MB>> 10 75 75 | #: E225 E225 -error[E227]: E22.py:74:12: [*] Missing whitespace around bitwise or shift operator +error[E227]: 74:12: [*] Missing whitespace around bitwise or shift operator + --> E22.py:74:12 | 72 | _1kB = _1MB >>10 73 | #: E225 @@ -43,8 +45,9 @@ error[E227]: E22.py:74:12: [*] Missing whitespace around bitwise or shift operat 76 76 | i=i+ 1 77 77 | #: E225 E225 -error[E227]: E22.py:121:12: [*] Missing whitespace around bitwise or shift operator +error[E227]: 121:12: [*] Missing whitespace around bitwise or shift operator + --> E22.py:121:12 | 119 | return (i//2 for i in range(n)) 120 | #: E227 @@ -64,8 +67,9 @@ error[E227]: E22.py:121:12: [*] Missing whitespace around bitwise or shift opera 123 123 | _1MB = _1kB<<10 124 124 | #: E227 -error[E227]: E22.py:123:12: [*] Missing whitespace around bitwise or shift operator +error[E227]: 123:12: [*] Missing whitespace around bitwise or shift operator + --> E22.py:123:12 | 121 | _1kB = _1MB>>10 122 | #: E227 @@ -85,8 +89,9 @@ error[E227]: E22.py:123:12: [*] Missing whitespace around bitwise or shift opera 125 125 | a = b|c 126 126 | #: E227 -error[E227]: E22.py:125:6: [*] Missing whitespace around bitwise or shift operator +error[E227]: 125:6: [*] Missing whitespace around bitwise or shift operator + --> E22.py:125:6 | 123 | _1MB = _1kB<<10 124 | #: E227 @@ -106,8 +111,9 @@ error[E227]: E22.py:125:6: [*] Missing whitespace around bitwise or shift operat 127 127 | b = c&a 128 128 | #: E227 -error[E227]: E22.py:127:6: [*] Missing whitespace around bitwise or shift operator +error[E227]: 127:6: [*] Missing whitespace around bitwise or shift operator + --> E22.py:127:6 | 125 | a = b|c 126 | #: E227 @@ -127,8 +133,9 @@ error[E227]: E22.py:127:6: [*] Missing whitespace around bitwise or shift operat 129 129 | c = b^a 130 130 | #: E228 -error[E227]: E22.py:129:6: [*] Missing whitespace around bitwise or shift operator +error[E227]: 129:6: [*] Missing whitespace around bitwise or shift operator + --> E22.py:129:6 | 127 | b = c&a 128 | #: E227 @@ -148,8 +155,9 @@ error[E227]: E22.py:129:6: [*] Missing whitespace around bitwise or shift operat 131 131 | a = b%c 132 132 | #: E228 -error[E227]: E22.py:154:11: [*] Missing whitespace around bitwise or shift operator +error[E227]: 154:11: [*] Missing whitespace around bitwise or shift operator + --> E22.py:154:11 | 152 | func2(lambda a, b=h[:], c=0: (a, b, c)) 153 | if not -5 < x < +5: diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E228_E22.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E228_E22.py.snap index 697df370ea..fa9a9d0994 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E228_E22.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E228_E22.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[E228]: E22.py:131:6: [*] Missing whitespace around modulo operator +error[E228]: 131:6: [*] Missing whitespace around modulo operator + --> E22.py:131:6 | 129 | c = b^a 130 | #: E228 @@ -22,8 +23,9 @@ error[E228]: E22.py:131:6: [*] Missing whitespace around modulo operator 133 133 | msg = fmt%(errno, errmsg) 134 134 | #: E228 -error[E228]: E22.py:133:10: [*] Missing whitespace around modulo operator +error[E228]: 133:10: [*] Missing whitespace around modulo operator + --> E22.py:133:10 | 131 | a = b%c 132 | #: E228 @@ -43,8 +45,9 @@ error[E228]: E22.py:133:10: [*] Missing whitespace around modulo operator 135 135 | msg = "Error %d occurred"%errno 136 136 | #: -error[E228]: E22.py:135:26: [*] Missing whitespace around modulo operator +error[E228]: 135:26: [*] Missing whitespace around modulo operator + --> E22.py:135:26 | 133 | msg = fmt%(errno, errmsg) 134 | #: E228 diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E231_E23.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E231_E23.py.snap index 62abb9df58..caf033630f 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E231_E23.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E231_E23.py.snap @@ -1,16 +1,17 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -E23.py:2:7: E231 [*] Missing whitespace after ',' +error[E231]: 2:7: [*] Missing whitespace after ',' + + --> E23.py:2:7 | 1 | #: E231 2 | a = (1,2) - | ^ E231 + | ^ 3 | #: E231 4 | a[b1,:] | = help: Add missing whitespace - ℹ Safe fix 1 1 | #: E231 2 |-a = (1,2) @@ -19,17 +20,18 @@ E23.py:2:7: E231 [*] Missing whitespace after ',' 4 4 | a[b1,:] 5 5 | #: E231 -E23.py:4:5: E231 [*] Missing whitespace after ',' +error[E231]: 4:5: [*] Missing whitespace after ',' + + --> E23.py:4:5 | 2 | a = (1,2) 3 | #: E231 4 | a[b1,:] - | ^ E231 + | ^ 5 | #: E231 6 | a = [{'a':''}] | = help: Add missing whitespace - ℹ Safe fix 1 1 | #: E231 2 2 | a = (1,2) @@ -40,17 +42,18 @@ E23.py:4:5: E231 [*] Missing whitespace after ',' 6 6 | a = [{'a':''}] 7 7 | #: Okay -E23.py:6:10: E231 [*] Missing whitespace after ':' +error[E231]: 6:10: [*] Missing whitespace after ':' + + --> E23.py:6:10 | 4 | a[b1,:] 5 | #: E231 6 | a = [{'a':''}] - | ^ E231 + | ^ 7 | #: Okay 8 | a = (4,) | = help: Add missing whitespace - ℹ Safe fix 3 3 | #: E231 4 4 | a[b1,:] @@ -61,16 +64,17 @@ E23.py:6:10: E231 [*] Missing whitespace after ':' 8 8 | a = (4,) 9 9 | b = (5, ) -E23.py:19:10: E231 [*] Missing whitespace after ',' +error[E231]: 19:10: [*] Missing whitespace after ',' + + --> E23.py:19:10 | 17 | def foo() -> None: 18 | #: E231 19 | if (1,2): - | ^ E231 + | ^ 20 | pass | = help: Add missing whitespace - ℹ Safe fix 16 16 | 17 17 | def foo() -> None: @@ -81,16 +85,17 @@ E23.py:19:10: E231 [*] Missing whitespace after ',' 21 21 | 22 22 | #: Okay -E23.py:29:20: E231 [*] Missing whitespace after ':' +error[E231]: 29:20: [*] Missing whitespace after ':' + + --> E23.py:29:20 | 27 | mdtypes_template = { 28 | 'tag_full': [('mdtype', 'u4'), ('byte_count', 'u4')], 29 | 'tag_smalldata':[('byte_count_mdtype', 'u4'), ('data', 'S4')], - | ^ E231 + | ^ 30 | } | = help: Add missing whitespace - ℹ Safe fix 26 26 | #: E231:2:20 27 27 | mdtypes_template = { @@ -101,16 +106,17 @@ E23.py:29:20: E231 [*] Missing whitespace after ':' 31 31 | 32 32 | # E231 -E23.py:33:6: E231 [*] Missing whitespace after ',' +error[E231]: 33:6: [*] Missing whitespace after ',' + + --> E23.py:33:6 | 32 | # E231 33 | f"{(a,b)}" - | ^ E231 + | ^ 34 | 35 | # Okay because it's hard to differentiate between the usages of a colon in a f-string | = help: Add missing whitespace - ℹ Safe fix 30 30 | } 31 31 | @@ -121,16 +127,17 @@ E23.py:33:6: E231 [*] Missing whitespace after ',' 35 35 | # Okay because it's hard to differentiate between the usages of a colon in a f-string 36 36 | f"{a:=1}" -E23.py:47:37: E231 [*] Missing whitespace after ':' +error[E231]: 47:37: [*] Missing whitespace after ':' + + --> E23.py:47:37 | 46 | #: E231 47 | {len(f's3://{self.s3_bucket_name}/'):1} - | ^ E231 + | ^ 48 | 49 | #: Okay | = help: Add missing whitespace - ℹ Safe fix 44 44 | snapshot.file_uri[len(f's3://{self.s3_bucket_name}/'):] 45 45 | @@ -141,17 +148,18 @@ E23.py:47:37: E231 [*] Missing whitespace after ':' 49 49 | #: Okay 50 50 | a = (1,) -E23.py:60:13: E231 [*] Missing whitespace after ':' +error[E231]: 60:13: [*] Missing whitespace after ':' + + --> E23.py:60:13 | 58 | results = { 59 | "k1": [1], 60 | "k2":[2], - | ^ E231 + | ^ 61 | } 62 | results_in_tuple = ( | = help: Add missing whitespace - ℹ Safe fix 57 57 | """Primary function.""" 58 58 | results = { @@ -162,17 +170,18 @@ E23.py:60:13: E231 [*] Missing whitespace after ':' 62 62 | results_in_tuple = ( 63 63 | { -E23.py:65:17: E231 [*] Missing whitespace after ':' +error[E231]: 65:17: [*] Missing whitespace after ':' + + --> E23.py:65:17 | 63 | { 64 | "k1": [1], 65 | "k2":[2], - | ^ E231 + | ^ 66 | }, 67 | ) | = help: Add missing whitespace - ℹ Safe fix 62 62 | results_in_tuple = ( 63 63 | { @@ -183,17 +192,18 @@ E23.py:65:17: E231 [*] Missing whitespace after ':' 67 67 | ) 68 68 | results_in_list = [ -E23.py:71:17: E231 [*] Missing whitespace after ':' +error[E231]: 71:17: [*] Missing whitespace after ':' + + --> E23.py:71:17 | 69 | { 70 | "k1": [1], 71 | "k2":[2], - | ^ E231 + | ^ 72 | } 73 | ] | = help: Add missing whitespace - ℹ Safe fix 68 68 | results_in_list = [ 69 69 | { @@ -204,17 +214,18 @@ E23.py:71:17: E231 [*] Missing whitespace after ':' 73 73 | ] 74 74 | results_in_list_first = [ -E23.py:76:17: E231 [*] Missing whitespace after ':' +error[E231]: 76:17: [*] Missing whitespace after ':' + + --> E23.py:76:17 | 74 | results_in_list_first = [ 75 | { 76 | "k2":[2], - | ^ E231 + | ^ 77 | } 78 | ] | = help: Add missing whitespace - ℹ Safe fix 73 73 | ] 74 74 | results_in_list_first = [ @@ -225,17 +236,18 @@ E23.py:76:17: E231 [*] Missing whitespace after ':' 78 78 | ] 79 79 | -E23.py:82:13: E231 [*] Missing whitespace after ':' +error[E231]: 82:13: [*] Missing whitespace after ':' + + --> E23.py:82:13 | 80 | x = [ 81 | { 82 | "k1":[2], # E231 - | ^ E231 + | ^ 83 | "k2": x[2:4], 84 | "k3":[2], # E231 | = help: Add missing whitespace - ℹ Safe fix 79 79 | 80 80 | x = [ @@ -246,17 +258,18 @@ E23.py:82:13: E231 [*] Missing whitespace after ':' 84 84 | "k3":[2], # E231 85 85 | "k4": [2], -E23.py:84:13: E231 [*] Missing whitespace after ':' +error[E231]: 84:13: [*] Missing whitespace after ':' + + --> E23.py:84:13 | 82 | "k1":[2], # E231 83 | "k2": x[2:4], 84 | "k3":[2], # E231 - | ^ E231 + | ^ 85 | "k4": [2], 86 | "k5": [2], | = help: Add missing whitespace - ℹ Safe fix 81 81 | { 82 82 | "k1":[2], # E231 @@ -267,17 +280,18 @@ E23.py:84:13: E231 [*] Missing whitespace after ':' 86 86 | "k5": [2], 87 87 | "k6": [1, 2, 3, 4,5,6,7] # E231 -E23.py:87:26: E231 [*] Missing whitespace after ',' +error[E231]: 87:26: [*] Missing whitespace after ',' + + --> E23.py:87:26 | 85 | "k4": [2], 86 | "k5": [2], 87 | "k6": [1, 2, 3, 4,5,6,7] # E231 - | ^ E231 + | ^ 88 | }, 89 | { | = help: Add missing whitespace - ℹ Safe fix 84 84 | "k3":[2], # E231 85 85 | "k4": [2], @@ -288,17 +302,18 @@ E23.py:87:26: E231 [*] Missing whitespace after ',' 89 89 | { 90 90 | "k1": [ -E23.py:87:28: E231 [*] Missing whitespace after ',' +error[E231]: 87:28: [*] Missing whitespace after ',' + + --> E23.py:87:28 | 85 | "k4": [2], 86 | "k5": [2], 87 | "k6": [1, 2, 3, 4,5,6,7] # E231 - | ^ E231 + | ^ 88 | }, 89 | { | = help: Add missing whitespace - ℹ Safe fix 84 84 | "k3":[2], # E231 85 85 | "k4": [2], @@ -309,17 +324,18 @@ E23.py:87:28: E231 [*] Missing whitespace after ',' 89 89 | { 90 90 | "k1": [ -E23.py:87:30: E231 [*] Missing whitespace after ',' +error[E231]: 87:30: [*] Missing whitespace after ',' + + --> E23.py:87:30 | 85 | "k4": [2], 86 | "k5": [2], 87 | "k6": [1, 2, 3, 4,5,6,7] # E231 - | ^ E231 + | ^ 88 | }, 89 | { | = help: Add missing whitespace - ℹ Safe fix 84 84 | "k3":[2], # E231 85 85 | "k4": [2], @@ -330,17 +346,18 @@ E23.py:87:30: E231 [*] Missing whitespace after ',' 89 89 | { 90 90 | "k1": [ -E23.py:92:21: E231 [*] Missing whitespace after ':' +error[E231]: 92:21: [*] Missing whitespace after ':' + + --> E23.py:92:21 | 90 | "k1": [ 91 | { 92 | "ka":[2,3], # E231 - | ^ E231 + | ^ 93 | }, 94 | { | = help: Add missing whitespace - ℹ Safe fix 89 89 | { 90 90 | "k1": [ @@ -351,17 +368,18 @@ E23.py:92:21: E231 [*] Missing whitespace after ':' 94 94 | { 95 95 | "kb": [2,3], # E231 -E23.py:92:24: E231 [*] Missing whitespace after ',' +error[E231]: 92:24: [*] Missing whitespace after ',' + + --> E23.py:92:24 | 90 | "k1": [ 91 | { 92 | "ka":[2,3], # E231 - | ^ E231 + | ^ 93 | }, 94 | { | = help: Add missing whitespace - ℹ Safe fix 89 89 | { 90 90 | "k1": [ @@ -372,17 +390,18 @@ E23.py:92:24: E231 [*] Missing whitespace after ',' 94 94 | { 95 95 | "kb": [2,3], # E231 -E23.py:95:25: E231 [*] Missing whitespace after ',' +error[E231]: 95:25: [*] Missing whitespace after ',' + + --> E23.py:95:25 | 93 | }, 94 | { 95 | "kb": [2,3], # E231 - | ^ E231 + | ^ 96 | }, 97 | { | = help: Add missing whitespace - ℹ Safe fix 92 92 | "ka":[2,3], # E231 93 93 | }, @@ -393,17 +412,18 @@ E23.py:95:25: E231 [*] Missing whitespace after ',' 97 97 | { 98 98 | "ka":[2, 3], # E231 -E23.py:98:21: E231 [*] Missing whitespace after ':' +error[E231]: 98:21: [*] Missing whitespace after ':' + + --> E23.py:98:21 | 96 | }, 97 | { 98 | "ka":[2, 3], # E231 - | ^ E231 + | ^ 99 | "kb": [2, 3], # Ok 100 | "kc": [2, 3], # Ok | = help: Add missing whitespace - ℹ Safe fix 95 95 | "kb": [2,3], # E231 96 96 | }, @@ -414,17 +434,18 @@ E23.py:98:21: E231 [*] Missing whitespace after ':' 100 100 | "kc": [2, 3], # Ok 101 101 | "kd": [2,3], # E231 -E23.py:101:25: E231 [*] Missing whitespace after ',' +error[E231]: 101:25: [*] Missing whitespace after ',' + + --> E23.py:101:25 | 99 | "kb": [2, 3], # Ok 100 | "kc": [2, 3], # Ok 101 | "kd": [2,3], # E231 - | ^ E231 + | ^ 102 | "ke":[2,3], # E231 103 | }, | = help: Add missing whitespace - ℹ Safe fix 98 98 | "ka":[2, 3], # E231 99 99 | "kb": [2, 3], # Ok @@ -435,17 +456,18 @@ E23.py:101:25: E231 [*] Missing whitespace after ',' 103 103 | }, 104 104 | ] -E23.py:102:21: E231 [*] Missing whitespace after ':' +error[E231]: 102:21: [*] Missing whitespace after ':' + + --> E23.py:102:21 | 100 | "kc": [2, 3], # Ok 101 | "kd": [2,3], # E231 102 | "ke":[2,3], # E231 - | ^ E231 + | ^ 103 | }, 104 | ] | = help: Add missing whitespace - ℹ Safe fix 99 99 | "kb": [2, 3], # Ok 100 100 | "kc": [2, 3], # Ok @@ -456,17 +478,18 @@ E23.py:102:21: E231 [*] Missing whitespace after ':' 104 104 | ] 105 105 | } -E23.py:102:24: E231 [*] Missing whitespace after ',' +error[E231]: 102:24: [*] Missing whitespace after ',' + + --> E23.py:102:24 | 100 | "kc": [2, 3], # Ok 101 | "kd": [2,3], # E231 102 | "ke":[2,3], # E231 - | ^ E231 + | ^ 103 | }, 104 | ] | = help: Add missing whitespace - ℹ Safe fix 99 99 | "kb": [2, 3], # Ok 100 100 | "kc": [2, 3], # Ok diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E241_E24.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E241_E24.py.snap index 55bc6959c1..e53c0661e0 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E241_E24.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E241_E24.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[E241]: E24.py:2:8: [*] Multiple spaces after comma +error[E241]: 2:8: [*] Multiple spaces after comma + --> E24.py:2:8 | 1 | #: E241 2 | a = (1, 2) @@ -19,8 +20,9 @@ error[E241]: E24.py:2:8: [*] Multiple spaces after comma 4 4 | b = (1, 20) 5 5 | #: E242 -error[E241]: E24.py:11:18: [*] Multiple spaces after comma +error[E241]: 11:18: [*] Multiple spaces after comma + --> E24.py:11:18 | 9 | #: E241 E241 E241 10 | # issue 135 @@ -39,8 +41,9 @@ error[E241]: E24.py:11:18: [*] Multiple spaces after comma 12 12 | ef, +h, 13 13 | c, -d] -error[E241]: E24.py:12:19: [*] Multiple spaces after comma +error[E241]: 12:19: [*] Multiple spaces after comma + --> E24.py:12:19 | 10 | # issue 135 11 | more_spaces = [a, b, @@ -57,8 +60,9 @@ error[E241]: E24.py:12:19: [*] Multiple spaces after comma 12 |+ ef, +h, 13 13 | c, -d] -error[E241]: E24.py:13:18: [*] Multiple spaces after comma +error[E241]: 13:18: [*] Multiple spaces after comma + --> E24.py:13:18 | 11 | more_spaces = [a, b, 12 | ef, +h, diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E242_E24.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E242_E24.py.snap index d25f4476e2..fa81b1cd19 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E242_E24.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E242_E24.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[E242]: E24.py:6:8: [*] Tab after comma +error[E242]: 6:8: [*] Tab after comma + --> E24.py:6:8 | 4 | b = (1, 20) 5 | #: E242 diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E251_E25.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E251_E25.py.snap index 52b293c3f4..2a87abb673 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E251_E25.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E251_E25.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[E251]: E25.py:2:12: [*] Unexpected spaces around keyword / parameter equals +error[E251]: 2:12: [*] Unexpected spaces around keyword / parameter equals + --> E25.py:2:12 | 1 | #: E251 E251 2 | def foo(bar = False): @@ -19,8 +20,9 @@ error[E251]: E25.py:2:12: [*] Unexpected spaces around keyword / parameter equal 4 4 | pass 5 5 | #: E251 -error[E251]: E25.py:2:14: [*] Unexpected spaces around keyword / parameter equals +error[E251]: 2:14: [*] Unexpected spaces around keyword / parameter equals + --> E25.py:2:14 | 1 | #: E251 E251 2 | def foo(bar = False): @@ -37,8 +39,9 @@ error[E251]: E25.py:2:14: [*] Unexpected spaces around keyword / parameter equal 4 4 | pass 5 5 | #: E251 -error[E251]: E25.py:6:9: [*] Unexpected spaces around keyword / parameter equals +error[E251]: 6:9: [*] Unexpected spaces around keyword / parameter equals + --> E25.py:6:9 | 4 | pass 5 | #: E251 @@ -58,8 +61,9 @@ error[E251]: E25.py:6:9: [*] Unexpected spaces around keyword / parameter equals 8 8 | foo(bar =True) 9 9 | #: E251 E251 -error[E251]: E25.py:8:8: [*] Unexpected spaces around keyword / parameter equals +error[E251]: 8:8: [*] Unexpected spaces around keyword / parameter equals + --> E25.py:8:8 | 6 | foo(bar= True) 7 | #: E251 @@ -79,8 +83,9 @@ error[E251]: E25.py:8:8: [*] Unexpected spaces around keyword / parameter equals 10 10 | foo(bar = True) 11 11 | #: E251 -error[E251]: E25.py:10:8: [*] Unexpected spaces around keyword / parameter equals +error[E251]: 10:8: [*] Unexpected spaces around keyword / parameter equals + --> E25.py:10:8 | 8 | foo(bar =True) 9 | #: E251 E251 @@ -100,8 +105,9 @@ error[E251]: E25.py:10:8: [*] Unexpected spaces around keyword / parameter equal 12 12 | y = bar(root= "sdasd") 13 13 | #: E251:2:29 -error[E251]: E25.py:10:10: [*] Unexpected spaces around keyword / parameter equals +error[E251]: 10:10: [*] Unexpected spaces around keyword / parameter equals + --> E25.py:10:10 | 8 | foo(bar =True) 9 | #: E251 E251 @@ -121,8 +127,9 @@ error[E251]: E25.py:10:10: [*] Unexpected spaces around keyword / parameter equa 12 12 | y = bar(root= "sdasd") 13 13 | #: E251:2:29 -error[E251]: E25.py:12:14: [*] Unexpected spaces around keyword / parameter equals +error[E251]: 12:14: [*] Unexpected spaces around keyword / parameter equals + --> E25.py:12:14 | 10 | foo(bar = True) 11 | #: E251 @@ -142,8 +149,9 @@ error[E251]: E25.py:12:14: [*] Unexpected spaces around keyword / parameter equa 14 14 | parser.add_argument('--long-option', 15 15 | default= -error[E251]: E25.py:15:29: [*] Unexpected spaces around keyword / parameter equals +error[E251]: 15:29: [*] Unexpected spaces around keyword / parameter equals + --> E25.py:15:29 | 13 | #: E251:2:29 14 | parser.add_argument('--long-option', @@ -166,8 +174,9 @@ error[E251]: E25.py:15:29: [*] Unexpected spaces around keyword / parameter equa 18 17 | parser.add_argument('--long-option', default 19 18 | ="/rather/long/filesystem/path/here/blah/blah/blah") -error[E251]: E25.py:18:45: [*] Unexpected spaces around keyword / parameter equals +error[E251]: 18:45: [*] Unexpected spaces around keyword / parameter equals + --> E25.py:18:45 | 16 | "/rather/long/filesystem/path/here/blah/blah/blah") 17 | #: E251:1:45 @@ -190,8 +199,9 @@ error[E251]: E25.py:18:45: [*] Unexpected spaces around keyword / parameter equa 21 20 | foo(True, 22 21 | baz=(1, 2), -error[E251]: E25.py:23:8: [*] Unexpected spaces around keyword / parameter equals +error[E251]: 23:8: [*] Unexpected spaces around keyword / parameter equals + --> E25.py:23:8 | 21 | foo(True, 22 | baz=(1, 2), @@ -211,8 +221,9 @@ error[E251]: E25.py:23:8: [*] Unexpected spaces around keyword / parameter equal 25 25 | #: Okay 26 26 | foo(bar=(1 == 1)) -error[E251]: E25.py:23:10: [*] Unexpected spaces around keyword / parameter equals +error[E251]: 23:10: [*] Unexpected spaces around keyword / parameter equals + --> E25.py:23:10 | 21 | foo(True, 22 | baz=(1, 2), diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E252_E25.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E252_E25.py.snap index 02abde17ca..7420f3f518 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E252_E25.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E252_E25.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[E252]: E25.py:46:15: [*] Missing whitespace around parameter equals +error[E252]: 46:15: [*] Missing whitespace around parameter equals + --> E25.py:46:15 | 44 | return a + b 45 | #: E252:1:15 E252:1:16 E252:1:27 E252:1:36 @@ -22,8 +23,9 @@ error[E252]: E25.py:46:15: [*] Missing whitespace around parameter equals 48 48 | #: Okay 49 49 | def add(a: int = _default(name='f')): -error[E252]: E25.py:46:15: [*] Missing whitespace around parameter equals +error[E252]: 46:15: [*] Missing whitespace around parameter equals + --> E25.py:46:15 | 44 | return a + b 45 | #: E252:1:15 E252:1:16 E252:1:27 E252:1:36 @@ -43,8 +45,9 @@ error[E252]: E25.py:46:15: [*] Missing whitespace around parameter equals 48 48 | #: Okay 49 49 | def add(a: int = _default(name='f')): -error[E252]: E25.py:46:26: [*] Missing whitespace around parameter equals +error[E252]: 46:26: [*] Missing whitespace around parameter equals + --> E25.py:46:26 | 44 | return a + b 45 | #: E252:1:15 E252:1:16 E252:1:27 E252:1:36 @@ -64,8 +67,9 @@ error[E252]: E25.py:46:26: [*] Missing whitespace around parameter equals 48 48 | #: Okay 49 49 | def add(a: int = _default(name='f')): -error[E252]: E25.py:46:36: [*] Missing whitespace around parameter equals +error[E252]: 46:36: [*] Missing whitespace around parameter equals + --> E25.py:46:36 | 44 | return a + b 45 | #: E252:1:15 E252:1:16 E252:1:27 E252:1:36 diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E261_E26.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E261_E26.py.snap index 29766614fc..dc316a6005 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E261_E26.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E261_E26.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[E261]: E26.py:2:5: [*] Insert at least two spaces before an inline comment +error[E261]: 2:5: [*] Insert at least two spaces before an inline comment + --> E26.py:2:5 | 1 | #: E261:1:5 2 | pass # an inline comment diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E262_E26.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E262_E26.py.snap index c7271f7fe7..3196d795b3 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E262_E26.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E262_E26.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[E262]: E26.py:4:12: [*] Inline comment should start with `# ` +error[E262]: 4:12: [*] Inline comment should start with `# ` + --> E26.py:4:12 | 2 | pass # an inline comment 3 | #: E262:1:12 @@ -22,8 +23,9 @@ error[E262]: E26.py:4:12: [*] Inline comment should start with `# ` 6 6 | x = x + 1 # Increment x 7 7 | #: E262:1:12 -error[E262]: E26.py:6:12: [*] Inline comment should start with `# ` +error[E262]: 6:12: [*] Inline comment should start with `# ` + --> E26.py:6:12 | 4 | x = x + 1 #Increment x 5 | #: E262:1:12 @@ -43,8 +45,9 @@ error[E262]: E26.py:6:12: [*] Inline comment should start with `# ` 8 8 | x = y + 1 #: Increment x 9 9 | #: E265:1:1 -error[E262]: E26.py:8:12: [*] Inline comment should start with `# ` +error[E262]: 8:12: [*] Inline comment should start with `# ` + --> E26.py:8:12 | 6 | x = x + 1 # Increment x 7 | #: E262:1:12 @@ -64,8 +67,9 @@ error[E262]: E26.py:8:12: [*] Inline comment should start with `# ` 10 10 | #Block comment 11 11 | a = 1 -error[E262]: E26.py:63:9: [*] Inline comment should start with `# ` +error[E262]: 63:9: [*] Inline comment should start with `# ` + --> E26.py:63:9 | 61 | # -*- coding: utf8 -*- 62 | #  (One space one NBSP) Ok for block comment @@ -85,8 +89,9 @@ error[E262]: E26.py:63:9: [*] Inline comment should start with `# ` 65 65 | # (Two spaces) Ok for block comment 66 66 | a = 42 # (Two spaces) -error[E262]: E26.py:66:9: [*] Inline comment should start with `# ` +error[E262]: 66:9: [*] Inline comment should start with `# ` + --> E26.py:66:9 | 64 | #: E262:2:9 65 | # (Two spaces) Ok for block comment @@ -106,8 +111,9 @@ error[E262]: E26.py:66:9: [*] Inline comment should start with `# ` 68 68 | #: E265:5:1 69 69 | ### Means test is not done yet -error[E262]: E26.py:84:8: [*] Inline comment should start with `# ` +error[E262]: 84:8: [*] Inline comment should start with `# ` + --> E26.py:84:8 | 82 | ## Foo 83 | @@ -126,8 +132,9 @@ error[E262]: E26.py:84:8: [*] Inline comment should start with `# ` 85 85 | 86 86 | a = 1 #:Foo -error[E262]: E26.py:86:8: [*] Inline comment should start with `# ` +error[E262]: 86:8: [*] Inline comment should start with `# ` + --> E26.py:86:8 | 84 | a = 1 ## Foo 85 | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E265_E26.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E265_E26.py.snap index f62ba41d46..ce63c1d11d 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E265_E26.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E265_E26.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[E265]: E26.py:10:1: [*] Block comment should start with `# ` +error[E265]: 10:1: [*] Block comment should start with `# ` + --> E26.py:9:12 | 8 | x = y + 1 #: Increment x 9 | #: E265:1:1 @@ -22,8 +23,9 @@ error[E265]: E26.py:10:1: [*] Block comment should start with `# ` 12 12 | #: E265:2:1 13 13 | m = 42 -error[E265]: E26.py:14:1: [*] Block comment should start with `# ` +error[E265]: 14:1: [*] Block comment should start with `# ` + --> E26.py:13:7 | 12 | #: E265:2:1 13 | m = 42 @@ -43,8 +45,9 @@ error[E265]: E26.py:14:1: [*] Block comment should start with `# ` 16 16 | #: E266:3:5 E266:6:5 17 17 | def how_it_feel(r): -error[E265]: E26.py:25:1: [*] Block comment should start with `# ` +error[E265]: 25:1: [*] Block comment should start with `# ` + --> E26.py:24:21 | 23 | return 24 | #: E265:1:1 E266:2:1 @@ -64,8 +67,9 @@ error[E265]: E26.py:25:1: [*] Block comment should start with `# ` 27 27 | #: W291:1:42 28 28 | ######################################### -error[E265]: E26.py:32:1: [*] Block comment should start with `# ` +error[E265]: 32:1: [*] Block comment should start with `# ` + --> E26.py:31:8 | 31 | #: Okay 32 | #!/usr/bin/env python @@ -84,8 +88,9 @@ error[E265]: E26.py:32:1: [*] Block comment should start with `# ` 34 34 | pass # an inline comment 35 35 | x = x + 1 # Increment x -error[E265]: E26.py:73:1: [*] Block comment should start with `# ` +error[E265]: 73:1: [*] Block comment should start with `# ` + --> E26.py:72:45 | 71 | # F Means test is failing (F) 72 | # EF Means test is giving error and Failing @@ -104,8 +109,9 @@ error[E265]: E26.py:73:1: [*] Block comment should start with `# ` 75 75 | 76 76 | #: Colon prefix is okay -error[E265]: E26.py:78:1: [*] Block comment should start with `# ` +error[E265]: 78:1: [*] Block comment should start with `# ` + --> E26.py:77:1 | 76 | #: Colon prefix is okay 77 | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E266_E26.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E266_E26.py.snap index e41ca1463a..e13f378ca8 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E266_E26.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E266_E26.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[E266]: E26.py:19:5: [*] Too many leading `#` before block comment +error[E266]: 19:5: [*] Too many leading `#` before block comment + --> E26.py:19:5 | 17 | def how_it_feel(r): 18 | @@ -21,8 +22,9 @@ error[E266]: E26.py:19:5: [*] Too many leading `#` before block comment 21 21 | 22 22 | ### Of course it is unused -error[E266]: E26.py:22:5: [*] Too many leading `#` before block comment +error[E266]: 22:5: [*] Too many leading `#` before block comment + --> E26.py:22:5 | 20 | a = 42 21 | @@ -42,8 +44,9 @@ error[E266]: E26.py:22:5: [*] Too many leading `#` before block comment 24 24 | #: E265:1:1 E266:2:1 25 25 | ##if DEBUG: -error[E266]: E26.py:26:1: [*] Too many leading `#` before block comment +error[E266]: 26:1: [*] Too many leading `#` before block comment + --> E26.py:25:12 | 24 | #: E265:1:1 E266:2:1 25 | ##if DEBUG: @@ -63,8 +66,9 @@ error[E266]: E26.py:26:1: [*] Too many leading `#` before block comment 28 28 | ######################################### 29 29 | #: -error[E266]: E26.py:69:1: [*] Too many leading `#` before block comment +error[E266]: 69:1: [*] Too many leading `#` before block comment + --> E26.py:68:12 | 68 | #: E265:5:1 69 | ### Means test is not done yet @@ -83,8 +87,9 @@ error[E266]: E26.py:69:1: [*] Too many leading `#` before block comment 71 71 | # F Means test is failing (F) 72 72 | # EF Means test is giving error and Failing -error[E266]: E26.py:82:1: [*] Too many leading `#` before block comment +error[E266]: 82:1: [*] Too many leading `#` before block comment + --> E26.py:81:12 | 80 | # We should strip the space, but preserve the hashes. 81 | #: E266:1:3 diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E271_E27.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E271_E27.py.snap index ffd296ba6a..c9adf7e4bf 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E271_E27.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E271_E27.py.snap @@ -1,17 +1,18 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -E27.py:4:9: E271 [*] Multiple spaces after keyword +error[E271]: 4:9: [*] Multiple spaces after keyword + + --> E27.py:4:9 | 2 | True and False 3 | #: E271 4 | True and False - | ^^ E271 + | ^^ 5 | #: E272 6 | True and False | = help: Replace with single space - ℹ Safe fix 1 1 | #: Okay 2 2 | True and False @@ -22,17 +23,18 @@ E27.py:4:9: E271 [*] Multiple spaces after keyword 6 6 | True and False 7 7 | #: E271 -E27.py:6:5: E271 [*] Multiple spaces after keyword +error[E271]: 6:5: [*] Multiple spaces after keyword + + --> E27.py:6:5 | 4 | True and False 5 | #: E272 6 | True and False - | ^^ E271 + | ^^ 7 | #: E271 8 | if 1: | = help: Replace with single space - ℹ Safe fix 3 3 | #: E271 4 4 | True and False @@ -43,17 +45,18 @@ E27.py:6:5: E271 [*] Multiple spaces after keyword 8 8 | if 1: 9 9 | pass -E27.py:8:3: E271 [*] Multiple spaces after keyword +error[E271]: 8:3: [*] Multiple spaces after keyword + + --> E27.py:8:3 | 6 | True and False 7 | #: E271 8 | if 1: - | ^^^ E271 + | ^^^ 9 | pass 10 | #: E273 | = help: Replace with single space - ℹ Safe fix 5 5 | #: E272 6 6 | True and False @@ -64,17 +67,18 @@ E27.py:8:3: E271 [*] Multiple spaces after keyword 10 10 | #: E273 11 11 | True and False -E27.py:15:6: E271 [*] Multiple spaces after keyword +error[E271]: 15:6: [*] Multiple spaces after keyword + + --> E27.py:15:6 | 13 | True and False 14 | #: E271 15 | a and b - | ^^ E271 + | ^^ 16 | #: E271 17 | 1 and b | = help: Replace with single space - ℹ Safe fix 12 12 | #: E273 E274 13 13 | True and False @@ -85,17 +89,18 @@ E27.py:15:6: E271 [*] Multiple spaces after keyword 17 17 | 1 and b 18 18 | #: E271 -E27.py:17:6: E271 [*] Multiple spaces after keyword +error[E271]: 17:6: [*] Multiple spaces after keyword + + --> E27.py:17:6 | 15 | a and b 16 | #: E271 17 | 1 and b - | ^^ E271 + | ^^ 18 | #: E271 19 | a and 2 | = help: Replace with single space - ℹ Safe fix 14 14 | #: E271 15 15 | a and b @@ -106,17 +111,18 @@ E27.py:17:6: E271 [*] Multiple spaces after keyword 19 19 | a and 2 20 20 | #: E271 E272 -E27.py:19:6: E271 [*] Multiple spaces after keyword +error[E271]: 19:6: [*] Multiple spaces after keyword + + --> E27.py:19:6 | 17 | 1 and b 18 | #: E271 19 | a and 2 - | ^^ E271 + | ^^ 20 | #: E271 E272 21 | 1 and b | = help: Replace with single space - ℹ Safe fix 16 16 | #: E271 17 17 | 1 and b @@ -127,17 +133,18 @@ E27.py:19:6: E271 [*] Multiple spaces after keyword 21 21 | 1 and b 22 22 | #: E271 E272 -E27.py:21:7: E271 [*] Multiple spaces after keyword +error[E271]: 21:7: [*] Multiple spaces after keyword + + --> E27.py:21:7 | 19 | a and 2 20 | #: E271 E272 21 | 1 and b - | ^^ E271 + | ^^ 22 | #: E271 E272 23 | a and 2 | = help: Replace with single space - ℹ Safe fix 18 18 | #: E271 19 19 | a and 2 @@ -148,17 +155,18 @@ E27.py:21:7: E271 [*] Multiple spaces after keyword 23 23 | a and 2 24 24 | #: E272 -E27.py:23:7: E271 [*] Multiple spaces after keyword +error[E271]: 23:7: [*] Multiple spaces after keyword + + --> E27.py:23:7 | 21 | 1 and b 22 | #: E271 E272 23 | a and 2 - | ^^ E271 + | ^^ 24 | #: E272 25 | this and False | = help: Replace with single space - ℹ Safe fix 20 20 | #: E271 E272 21 21 | 1 and b @@ -169,17 +177,18 @@ E27.py:23:7: E271 [*] Multiple spaces after keyword 25 25 | this and False 26 26 | #: E273 -E27.py:36:14: E271 [*] Multiple spaces after keyword +error[E271]: 36:14: [*] Multiple spaces after keyword + + --> E27.py:36:14 | 34 | from v import c, d 35 | #: E271 36 | from w import (e, f) - | ^^ E271 + | ^^ 37 | #: E275 38 | from w import(e, f) | = help: Replace with single space - ℹ Safe fix 33 33 | from u import (a, b) 34 34 | from v import c, d @@ -190,16 +199,17 @@ E27.py:36:14: E271 [*] Multiple spaces after keyword 38 38 | from w import(e, f) 39 39 | #: E275 -E27.py:71:5: E271 [*] Multiple spaces after keyword +error[E271]: 71:5: [*] Multiple spaces after keyword + + --> E27.py:71:5 | 70 | #: E271 71 | type Number = int - | ^^ E271 + | ^^ 72 | 73 | #: E273 | = help: Replace with single space - ℹ Safe fix 68 68 | # Soft keywords 69 69 | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E272_E27.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E272_E27.py.snap index c9f27f6f2a..0eb92356c6 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E272_E27.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E272_E27.py.snap @@ -1,17 +1,18 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -E27.py:21:2: E272 [*] Multiple spaces before keyword +error[E272]: 21:2: [*] Multiple spaces before keyword + + --> E27.py:21:2 | 19 | a and 2 20 | #: E271 E272 21 | 1 and b - | ^^ E272 + | ^^ 22 | #: E271 E272 23 | a and 2 | = help: Replace with single space - ℹ Safe fix 18 18 | #: E271 19 19 | a and 2 @@ -22,17 +23,18 @@ E27.py:21:2: E272 [*] Multiple spaces before keyword 23 23 | a and 2 24 24 | #: E272 -E27.py:23:2: E272 [*] Multiple spaces before keyword +error[E272]: 23:2: [*] Multiple spaces before keyword + + --> E27.py:23:2 | 21 | 1 and b 22 | #: E271 E272 23 | a and 2 - | ^^ E272 + | ^^ 24 | #: E272 25 | this and False | = help: Replace with single space - ℹ Safe fix 20 20 | #: E271 E272 21 21 | 1 and b @@ -43,17 +45,18 @@ E27.py:23:2: E272 [*] Multiple spaces before keyword 25 25 | this and False 26 26 | #: E273 -E27.py:25:5: E272 [*] Multiple spaces before keyword +error[E272]: 25:5: [*] Multiple spaces before keyword + + --> E27.py:25:5 | 23 | a and 2 24 | #: E272 25 | this and False - | ^^ E272 + | ^^ 26 | #: E273 27 | a and b | = help: Replace with single space - ℹ Safe fix 22 22 | #: E271 E272 23 23 | a and 2 diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E273_E27.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E273_E27.py.snap index ecdb9d3a29..e2f0218add 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E273_E27.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E273_E27.py.snap @@ -1,17 +1,18 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -E27.py:11:9: E273 [*] Tab after keyword +error[E273]: 11:9: [*] Tab after keyword + + --> E27.py:11:9 | 9 | pass 10 | #: E273 11 | True and False - | ^^^^^^^^ E273 + | ^^^^^^^^ 12 | #: E273 E274 13 | True and False | = help: Replace with single space - ℹ Safe fix 8 8 | if 1: 9 9 | pass @@ -22,17 +23,18 @@ E27.py:11:9: E273 [*] Tab after keyword 13 13 | True and False 14 14 | #: E271 -E27.py:13:5: E273 [*] Tab after keyword +error[E273]: 13:5: [*] Tab after keyword + + --> E27.py:13:5 | 11 | True and False 12 | #: E273 E274 13 | True and False - | ^^^^^^^^ E273 + | ^^^^^^^^ 14 | #: E271 15 | a and b | = help: Replace with single space - ℹ Safe fix 10 10 | #: E273 11 11 | True and False @@ -43,17 +45,18 @@ E27.py:13:5: E273 [*] Tab after keyword 15 15 | a and b 16 16 | #: E271 -E27.py:13:10: E273 [*] Tab after keyword +error[E273]: 13:10: [*] Tab after keyword + + --> E27.py:13:16 | 11 | True and False 12 | #: E273 E274 13 | True and False - | ^ E273 + | ^ 14 | #: E271 15 | a and b | = help: Replace with single space - ℹ Safe fix 10 10 | #: E273 11 11 | True and False @@ -64,17 +67,18 @@ E27.py:13:10: E273 [*] Tab after keyword 15 15 | a and b 16 16 | #: E271 -E27.py:27:6: E273 [*] Tab after keyword +error[E273]: 27:6: [*] Tab after keyword + + --> E27.py:27:6 | 25 | this and False 26 | #: E273 27 | a and b - | ^^^ E273 + | ^^^ 28 | #: E274 29 | a and b | = help: Replace with single space - ℹ Safe fix 24 24 | #: E272 25 25 | this and False @@ -85,17 +89,18 @@ E27.py:27:6: E273 [*] Tab after keyword 29 29 | a and b 30 30 | #: E273 E274 -E27.py:31:10: E273 [*] Tab after keyword +error[E273]: 31:10: [*] Tab after keyword + + --> E27.py:31:16 | 29 | a and b 30 | #: E273 E274 31 | this and False - | ^ E273 + | ^ 32 | #: Okay 33 | from u import (a, b) | = help: Replace with single space - ℹ Safe fix 28 28 | #: E274 29 29 | a and b @@ -106,16 +111,17 @@ E27.py:31:10: E273 [*] Tab after keyword 33 33 | from u import (a, b) 34 34 | from v import c, d -E27.py:74:5: E273 [*] Tab after keyword +error[E273]: 74:5: [*] Tab after keyword + + --> E27.py:74:5 | 73 | #: E273 74 | type Number = int - | ^^^^ E273 + | ^^^^ 75 | 76 | #: E275 | = help: Replace with single space - ℹ Safe fix 71 71 | type Number = int 72 72 | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E274_E27.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E274_E27.py.snap index 062a61bebf..722ac9eb58 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E274_E27.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E274_E27.py.snap @@ -1,17 +1,18 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -E27.py:29:2: E274 [*] Tab before keyword +error[E274]: 29:2: [*] Tab before keyword + + --> E27.py:29:2 | 27 | a and b 28 | #: E274 29 | a and b - | ^^^^^^^ E274 + | ^^^^^^^ 30 | #: E273 E274 31 | this and False | = help: Replace with single space - ℹ Safe fix 26 26 | #: E273 27 27 | a and b @@ -22,17 +23,18 @@ E27.py:29:2: E274 [*] Tab before keyword 31 31 | this and False 32 32 | #: Okay -E27.py:31:5: E274 [*] Tab before keyword +error[E274]: 31:5: [*] Tab before keyword + + --> E27.py:31:5 | 29 | a and b 30 | #: E273 E274 31 | this and False - | ^^^^^^^^ E274 + | ^^^^^^^^ 32 | #: Okay 33 | from u import (a, b) | = help: Replace with single space - ℹ Safe fix 28 28 | #: E274 29 29 | a and b diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E275_E27.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E275_E27.py.snap index 0d0cc6d0df..8e83718b32 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E275_E27.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E275_E27.py.snap @@ -1,17 +1,18 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -E27.py:38:8: E275 [*] Missing whitespace after keyword +error[E275]: 38:8: [*] Missing whitespace after keyword + + --> E27.py:38:8 | 36 | from w import (e, f) 37 | #: E275 38 | from w import(e, f) - | ^^^^^^ E275 + | ^^^^^^ 39 | #: E275 40 | from importable.module import(e, f) | = help: Added missing whitespace after keyword - ℹ Safe fix 35 35 | #: E271 36 36 | from w import (e, f) @@ -22,17 +23,18 @@ E27.py:38:8: E275 [*] Missing whitespace after keyword 40 40 | from importable.module import(e, f) 41 41 | #: E275 -E27.py:40:24: E275 [*] Missing whitespace after keyword +error[E275]: 40:24: [*] Missing whitespace after keyword + + --> E27.py:40:24 | 38 | from w import(e, f) 39 | #: E275 40 | from importable.module import(e, f) - | ^^^^^^ E275 + | ^^^^^^ 41 | #: E275 42 | try: | = help: Added missing whitespace after keyword - ℹ Safe fix 37 37 | #: E275 38 38 | from w import(e, f) @@ -43,17 +45,18 @@ E27.py:40:24: E275 [*] Missing whitespace after keyword 42 42 | try: 43 43 | from importable.module import(e, f) -E27.py:43:28: E275 [*] Missing whitespace after keyword +error[E275]: 43:28: [*] Missing whitespace after keyword + + --> E27.py:43:28 | 41 | #: E275 42 | try: 43 | from importable.module import(e, f) - | ^^^^^^ E275 + | ^^^^^^ 44 | except ImportError: 45 | pass | = help: Added missing whitespace after keyword - ℹ Safe fix 40 40 | from importable.module import(e, f) 41 41 | #: E275 @@ -64,17 +67,18 @@ E27.py:43:28: E275 [*] Missing whitespace after keyword 45 45 | pass 46 46 | #: E275 -E27.py:47:1: E275 [*] Missing whitespace after keyword +error[E275]: 47:1: [*] Missing whitespace after keyword + + --> E27.py:46:8 | 45 | pass 46 | #: E275 47 | if(foo): - | ^^ E275 + | ^^ 48 | pass 49 | else: | = help: Added missing whitespace after keyword - ℹ Safe fix 44 44 | except ImportError: 45 45 | pass @@ -85,17 +89,18 @@ E27.py:47:1: E275 [*] Missing whitespace after keyword 49 49 | else: 50 50 | pass -E27.py:55:5: E275 [*] Missing whitespace after keyword +error[E275]: 55:5: [*] Missing whitespace after keyword + + --> E27.py:55:5 | 53 | #: E275:2:11 54 | if True: 55 | assert(1) - | ^^^^^^ E275 + | ^^^^^^ 56 | #: Okay 57 | def f(): | = help: Added missing whitespace after keyword - ℹ Safe fix 52 52 | matched = {"true": True, "false": False} 53 53 | #: E275:2:11 @@ -106,16 +111,17 @@ E27.py:55:5: E275 [*] Missing whitespace after keyword 57 57 | def f(): 58 58 | print((yield)) -E27.py:77:1: E275 [*] Missing whitespace after keyword +error[E275]: 77:1: [*] Missing whitespace after keyword + + --> E27.py:76:8 | 76 | #: E275 77 | match(foo): - | ^^^^^ E275 + | ^^^^^ 78 | case(1): 79 | pass | = help: Added missing whitespace after keyword - ℹ Safe fix 74 74 | type Number = int 75 75 | @@ -126,16 +132,17 @@ E27.py:77:1: E275 [*] Missing whitespace after keyword 79 79 | pass 80 80 | -E27.py:78:5: E275 [*] Missing whitespace after keyword +error[E275]: 78:5: [*] Missing whitespace after keyword + + --> E27.py:78:5 | 76 | #: E275 77 | match(foo): 78 | case(1): - | ^^^^ E275 + | ^^^^ 79 | pass | = help: Added missing whitespace after keyword - ℹ Safe fix 75 75 | 76 76 | #: E275 diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E301_E30.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E301_E30.py.snap index c224ebbeb7..de2a27acce 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E301_E30.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E301_E30.py.snap @@ -1,17 +1,18 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -E30.py:478:5: E301 [*] Expected 1 blank line, found 0 +error[E301]: 478:5: [*] Expected 1 blank line, found 0 + + --> E30.py:478:5 | 476 | def func1(): 477 | pass 478 | def func2(): - | ^^^ E301 + | ^^^ 479 | pass 480 | # end | = help: Add missing blank line - ℹ Safe fix 475 475 | 476 476 | def func1(): @@ -21,17 +22,18 @@ E30.py:478:5: E301 [*] Expected 1 blank line, found 0 479 480 | pass 480 481 | # end -E30.py:489:5: E301 [*] Expected 1 blank line, found 0 +error[E301]: 489:5: [*] Expected 1 blank line, found 0 + + --> E30.py:489:5 | 487 | pass 488 | # comment 489 | def fn2(): - | ^^^ E301 + | ^^^ 490 | pass 491 | # end | = help: Add missing blank line - ℹ Safe fix 485 485 | 486 486 | def fn1(): @@ -41,16 +43,17 @@ E30.py:489:5: E301 [*] Expected 1 blank line, found 0 489 490 | def fn2(): 490 491 | pass -E30.py:499:5: E301 [*] Expected 1 blank line, found 0 +error[E301]: 499:5: [*] Expected 1 blank line, found 0 + + --> E30.py:499:5 | 498 | columns = [] 499 | @classmethod - | ^ E301 + | ^ 500 | def cls_method(cls) -> None: 501 | pass | = help: Add missing blank line - ℹ Safe fix 496 496 | """Class for minimal repo.""" 497 497 | @@ -60,17 +63,18 @@ E30.py:499:5: E301 [*] Expected 1 blank line, found 0 500 501 | def cls_method(cls) -> None: 501 502 | pass -E30.py:511:5: E301 [*] Expected 1 blank line, found 0 +error[E301]: 511:5: [*] Expected 1 blank line, found 0 + + --> E30.py:511:5 | 509 | def method(cls) -> None: 510 | pass 511 | @classmethod - | ^ E301 + | ^ 512 | def cls_method(cls) -> None: 513 | pass | = help: Add missing blank line - ℹ Safe fix 508 508 | 509 509 | def method(cls) -> None: @@ -80,17 +84,18 @@ E30.py:511:5: E301 [*] Expected 1 blank line, found 0 512 513 | def cls_method(cls) -> None: 513 514 | pass -E30.py:526:5: E301 [*] Expected 1 blank line, found 0 +error[E301]: 526:5: [*] Expected 1 blank line, found 0 + + --> E30.py:526:5 | 524 | def bar(self, x: str) -> str: 525 | ... 526 | def bar(self, x: int | str) -> int | str: - | ^^^ E301 + | ^^^ 527 | return x 528 | # end | = help: Add missing blank line - ℹ Safe fix 523 523 | @overload 524 524 | def bar(self, x: str) -> str: diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E301_E30_syntax_error.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E301_E30_syntax_error.py.snap index 195fb4189a..a3d5e5f201 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E301_E30_syntax_error.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E301_E30_syntax_error.py.snap @@ -1,7 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -E30_syntax_error.py:4:15: SyntaxError: Expected ']', found '(' +error[syntax-error]: 4:15: Expected ']', found '(' + + --> E30_syntax_error.py:4:15 | 2 | # parenthesis. 3 | @@ -9,8 +11,9 @@ E30_syntax_error.py:4:15: SyntaxError: Expected ']', found '(' | ^ 5 | pass | +error[syntax-error]: 13:18: Expected ')', found newline -E30_syntax_error.py:13:18: SyntaxError: Expected ')', found newline + --> E30_syntax_error.py:13:18 | 12 | class Foo: 13 | def __init__( @@ -19,18 +22,20 @@ E30_syntax_error.py:13:18: SyntaxError: Expected ')', found newline 15 | def method(): 16 | pass | +error[E301]: 15:5: Expected 1 blank line, found 0 -E30_syntax_error.py:15:5: E301 Expected 1 blank line, found 0 + --> E30_syntax_error.py:15:5 | 13 | def __init__( 14 | pass 15 | def method(): - | ^^^ E301 + | ^^^ 16 | pass | = help: Add missing blank line +error[syntax-error]: 18:11: Expected ')', found newline -E30_syntax_error.py:18:11: SyntaxError: Expected ')', found newline + --> E30_syntax_error.py:18:11 | 16 | pass 17 | @@ -40,8 +45,9 @@ E30_syntax_error.py:18:11: SyntaxError: Expected ')', found newline 20 | 21 | def top( | +error[syntax-error]: 21:9: Expected ')', found newline -E30_syntax_error.py:21:9: SyntaxError: Expected ')', found newline + --> E30_syntax_error.py:21:9 | 21 | def top( | ^ diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E30.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E30.py.snap index e3fe5c1f33..62fa5c802f 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E30.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E30.py.snap @@ -1,17 +1,18 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -E30.py:533:1: E302 [*] Expected 2 blank lines, found 0 +error[E302]: 533:1: [*] Expected 2 blank lines, found 0 + + --> E30.py:532:19 | 531 | # E302 532 | """Main module.""" 533 | def fn(): - | ^^^ E302 + | ^^^ 534 | pass 535 | # end | = help: Add missing blank line(s) - ℹ Safe fix 530 530 | 531 531 | # E302 @@ -22,17 +23,18 @@ E30.py:533:1: E302 [*] Expected 2 blank lines, found 0 534 536 | pass 535 537 | # end -E30.py:540:1: E302 [*] Expected 2 blank lines, found 0 +error[E302]: 540:1: [*] Expected 2 blank lines, found 0 + + --> E30.py:539:11 | 538 | # E302 539 | import sys 540 | def get_sys_path(): - | ^^^ E302 + | ^^^ 541 | return sys.path 542 | # end | = help: Add missing blank line(s) - ℹ Safe fix 537 537 | 538 538 | # E302 @@ -43,17 +45,18 @@ E30.py:540:1: E302 [*] Expected 2 blank lines, found 0 541 543 | return sys.path 542 544 | # end -E30.py:549:1: E302 [*] Expected 2 blank lines, found 1 +error[E302]: 549:1: [*] Expected 2 blank lines, found 1 + + --> E30.py:548:1 | 547 | pass 548 | 549 | def b(): - | ^^^ E302 + | ^^^ 550 | pass 551 | # end | = help: Add missing blank line(s) - ℹ Safe fix 546 546 | def a(): 547 547 | pass @@ -63,17 +66,18 @@ E30.py:549:1: E302 [*] Expected 2 blank lines, found 1 550 551 | pass 551 552 | # end -E30.py:560:1: E302 [*] Expected 2 blank lines, found 1 +error[E302]: 560:1: [*] Expected 2 blank lines, found 1 + + --> E30.py:559:1 | 558 | # comment 559 | 560 | def b(): - | ^^^ E302 + | ^^^ 561 | pass 562 | # end | = help: Add missing blank line(s) - ℹ Safe fix 557 557 | 558 558 | # comment @@ -83,17 +87,18 @@ E30.py:560:1: E302 [*] Expected 2 blank lines, found 1 561 562 | pass 562 563 | # end -E30.py:569:1: E302 [*] Expected 2 blank lines, found 1 +error[E302]: 569:1: [*] Expected 2 blank lines, found 1 + + --> E30.py:568:1 | 567 | pass 568 | 569 | async def b(): - | ^^^^^ E302 + | ^^^^^ 570 | pass 571 | # end | = help: Add missing blank line(s) - ℹ Safe fix 566 566 | def a(): 567 567 | pass @@ -103,17 +108,18 @@ E30.py:569:1: E302 [*] Expected 2 blank lines, found 1 570 571 | pass 571 572 | # end -E30.py:578:1: E302 [*] Expected 2 blank lines, found 1 +error[E302]: 578:1: [*] Expected 2 blank lines, found 1 + + --> E30.py:577:1 | 576 | pass 577 | 578 | async def x(y: int = 1): - | ^^^^^ E302 + | ^^^^^ 579 | pass 580 | # end | = help: Add missing blank line(s) - ℹ Safe fix 575 575 | async def x(): 576 576 | pass @@ -123,16 +129,17 @@ E30.py:578:1: E302 [*] Expected 2 blank lines, found 1 579 580 | pass 580 581 | # end -E30.py:586:1: E302 [*] Expected 2 blank lines, found 0 +error[E302]: 586:1: [*] Expected 2 blank lines, found 0 + + --> E30.py:585:9 | 584 | def bar(): 585 | pass 586 | def baz(): pass - | ^^^ E302 + | ^^^ 587 | # end | = help: Add missing blank line(s) - ℹ Safe fix 583 583 | # E302 584 584 | def bar(): @@ -143,17 +150,18 @@ E30.py:586:1: E302 [*] Expected 2 blank lines, found 0 587 589 | # end 588 590 | -E30.py:592:1: E302 [*] Expected 2 blank lines, found 0 +error[E302]: 592:1: [*] Expected 2 blank lines, found 0 + + --> E30.py:591:16 | 590 | # E302 591 | def bar(): pass 592 | def baz(): - | ^^^ E302 + | ^^^ 593 | pass 594 | # end | = help: Add missing blank line(s) - ℹ Safe fix 589 589 | 590 590 | # E302 @@ -164,16 +172,17 @@ E30.py:592:1: E302 [*] Expected 2 blank lines, found 0 593 595 | pass 594 596 | # end -E30.py:602:1: E302 [*] Expected 2 blank lines, found 1 +error[E302]: 602:1: [*] Expected 2 blank lines, found 1 + + --> E30.py:601:10 | 601 | # comment 602 | @decorator - | ^ E302 + | ^ 603 | def g(): 604 | pass | = help: Add missing blank line(s) - ℹ Safe fix 598 598 | def f(): 599 599 | pass @@ -183,16 +192,17 @@ E30.py:602:1: E302 [*] Expected 2 blank lines, found 1 602 603 | @decorator 603 604 | def g(): -E30.py:624:1: E302 [*] Expected 2 blank lines, found 0 +error[E302]: 624:1: [*] Expected 2 blank lines, found 0 + + --> E30.py:623:12 | 622 | # E302 623 | class A:... 624 | class B: ... - | ^^^^^ E302 + | ^^^^^ 625 | # end | = help: Add missing blank line(s) - ℹ Safe fix 621 621 | 622 622 | # E302 @@ -203,17 +213,18 @@ E30.py:624:1: E302 [*] Expected 2 blank lines, found 0 625 627 | # end 626 628 | -E30.py:634:1: E302 [*] Expected 2 blank lines, found 1 +error[E302]: 634:1: [*] Expected 2 blank lines, found 1 + + --> E30.py:633:1 | 632 | def fn(a: str) -> str: ... 633 | 634 | def fn(a: int | str) -> int | str: - | ^^^ E302 + | ^^^ 635 | ... 636 | # end | = help: Add missing blank line(s) - ℹ Safe fix 631 631 | @overload 632 632 | def fn(a: str) -> str: ... @@ -223,17 +234,18 @@ E30.py:634:1: E302 [*] Expected 2 blank lines, found 1 635 636 | ... 636 637 | # end -E30.py:944:1: E302 [*] Expected 2 blank lines, found 0 +error[E302]: 944:1: [*] Expected 2 blank lines, found 0 + + --> E30.py:943:14 | 942 | pass 943 | # comment 944 | def test_clientmodel(): - | ^^^ E302 + | ^^^ 945 | pass 946 | # end | = help: Add missing blank line(s) - ℹ Safe fix 941 941 | def test_update(): 942 942 | pass @@ -244,17 +256,18 @@ E30.py:944:1: E302 [*] Expected 2 blank lines, found 0 945 947 | pass 946 948 | # end -E30.py:953:1: E302 [*] Expected 2 blank lines, found 0 +error[E302]: 953:1: [*] Expected 2 blank lines, found 0 + + --> E30.py:952:18 | 951 | pass 952 | # comment 953 | def test_clientmodel(): - | ^^^ E302 + | ^^^ 954 | pass 955 | # end | = help: Add missing blank line(s) - ℹ Safe fix 950 950 | def test_update(): 951 951 | pass @@ -265,17 +278,18 @@ E30.py:953:1: E302 [*] Expected 2 blank lines, found 0 954 956 | pass 955 957 | # end -E30.py:962:1: E302 [*] Expected 2 blank lines, found 0 +error[E302]: 962:1: [*] Expected 2 blank lines, found 0 + + --> E30.py:961:10 | 960 | pass 961 | # comment 962 | def test_clientmodel(): - | ^^^ E302 + | ^^^ 963 | pass 964 | # end | = help: Add missing blank line(s) - ℹ Safe fix 958 958 | # E302 959 959 | def test_update(): diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_docstring.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_docstring.py.snap index 2dc9f21a74..a7f9efe0ee 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_docstring.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_docstring.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[E302]: E302_first_line_docstring.py:3:1: [*] Expected 2 blank lines, found 1 +error[E302]: 3:1: [*] Expected 2 blank lines, found 1 + --> E302_first_line_docstring.py:2:1 | 1 | """Test where the error is after the module's docstring.""" 2 | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_expression.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_expression.py.snap index 5e08d2f281..4cb6cc9ee2 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_expression.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_expression.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[E302]: E302_first_line_expression.py:3:1: [*] Expected 2 blank lines, found 1 +error[E302]: 3:1: [*] Expected 2 blank lines, found 1 + --> E302_first_line_expression.py:2:1 | 1 | "Test where the first line is a comment, " + "and the rule violation follows it." 2 | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_function.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_function.py.snap index ff4af1b834..c568ea8a51 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_function.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_function.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[E302]: E302_first_line_function.py:4:1: [*] Expected 2 blank lines, found 1 +error[E302]: 4:1: [*] Expected 2 blank lines, found 1 + --> E302_first_line_function.py:3:1 | 2 | pass 3 | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_statement.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_statement.py.snap index 1e3d0c1c27..ba612da928 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_statement.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_statement.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[E302]: E302_first_line_statement.py:3:1: [*] Expected 2 blank lines, found 1 +error[E302]: 3:1: [*] Expected 2 blank lines, found 1 + --> E302_first_line_statement.py:2:1 | 1 | print("Test where the first line is a statement, and the rule violation follows it.") 2 | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E30_syntax_error.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E30_syntax_error.py.snap index 4f0249230c..5ccb40a7f9 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E30_syntax_error.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E30_syntax_error.py.snap @@ -1,7 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -E30_syntax_error.py:4:15: SyntaxError: Expected ']', found '(' +error[syntax-error]: 4:15: Expected ']', found '(' + + --> E30_syntax_error.py:4:15 | 2 | # parenthesis. 3 | @@ -9,18 +11,20 @@ E30_syntax_error.py:4:15: SyntaxError: Expected ']', found '(' | ^ 5 | pass | +error[E302]: 7:1: Expected 2 blank lines, found 1 -E30_syntax_error.py:7:1: E302 Expected 2 blank lines, found 1 + --> E30_syntax_error.py:6:1 | 5 | pass 6 | 7 | def bar(): - | ^^^ E302 + | ^^^ 8 | pass | = help: Add missing blank line(s) +error[syntax-error]: 13:18: Expected ')', found newline -E30_syntax_error.py:13:18: SyntaxError: Expected ')', found newline + --> E30_syntax_error.py:13:18 | 12 | class Foo: 13 | def __init__( @@ -29,8 +33,9 @@ E30_syntax_error.py:13:18: SyntaxError: Expected ')', found newline 15 | def method(): 16 | pass | +error[syntax-error]: 18:11: Expected ')', found newline -E30_syntax_error.py:18:11: SyntaxError: Expected ')', found newline + --> E30_syntax_error.py:18:11 | 16 | pass 17 | @@ -40,8 +45,9 @@ E30_syntax_error.py:18:11: SyntaxError: Expected ')', found newline 20 | 21 | def top( | +error[syntax-error]: 21:9: Expected ')', found newline -E30_syntax_error.py:21:9: SyntaxError: Expected ')', found newline + --> E30_syntax_error.py:21:9 | 21 | def top( | ^ diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E30.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E30.py.snap index a5f47acd9e..ec6c81a39c 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E30.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E30.py.snap @@ -1,15 +1,16 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -E30.py:617:2: E303 [*] Too many blank lines (2) +error[E303]: 617:2: [*] Too many blank lines (2) + + --> E30.py:617:5 | 617 | def method2(): - | ^^^ E303 + | ^^^ 618 | return 22 619 | # end | = help: Remove extraneous blank line(s) - ℹ Safe fix 613 613 | def method1(): 614 614 | return 1 @@ -19,15 +20,16 @@ E30.py:617:2: E303 [*] Too many blank lines (2) 618 617 | return 22 619 618 | # end -E30.py:644:5: E303 [*] Too many blank lines (2) +error[E303]: 644:5: [*] Too many blank lines (2) + + --> E30.py:644:5 | 644 | # arbitrary comment - | ^^^^^^^^^^^^^^^^^^^ E303 + | ^^^^^^^^^^^^^^^^^^^ 645 | 646 | def inner(): # E306 not expected (pycodestyle detects E306) | = help: Remove extraneous blank line(s) - ℹ Safe fix 640 640 | def fn(): 641 641 | _ = None @@ -37,15 +39,16 @@ E30.py:644:5: E303 [*] Too many blank lines (2) 645 644 | 646 645 | def inner(): # E306 not expected (pycodestyle detects E306) -E30.py:656:5: E303 [*] Too many blank lines (2) +error[E303]: 656:5: [*] Too many blank lines (2) + + --> E30.py:656:5 | 656 | # arbitrary comment - | ^^^^^^^^^^^^^^^^^^^ E303 + | ^^^^^^^^^^^^^^^^^^^ 657 | def inner(): # E306 not expected (pycodestyle detects E306) 658 | pass | = help: Remove extraneous blank line(s) - ℹ Safe fix 652 652 | def fn(): 653 653 | _ = None @@ -55,14 +58,15 @@ E30.py:656:5: E303 [*] Too many blank lines (2) 657 656 | def inner(): # E306 not expected (pycodestyle detects E306) 658 657 | pass -E30.py:667:1: E303 [*] Too many blank lines (3) +error[E303]: 667:1: [*] Too many blank lines (3) + + --> E30.py:667:1 | 667 | print() - | ^^^^^ E303 + | ^^^^^ 668 | # end | = help: Remove extraneous blank line(s) - ℹ Safe fix 663 663 | print() 664 664 | @@ -72,15 +76,16 @@ E30.py:667:1: E303 [*] Too many blank lines (3) 668 667 | # end 669 668 | -E30.py:676:1: E303 [*] Too many blank lines (3) +error[E303]: 676:1: [*] Too many blank lines (3) + + --> E30.py:676:1 | 676 | # comment - | ^^^^^^^^^ E303 + | ^^^^^^^^^ 677 | 678 | print() | = help: Remove extraneous blank line(s) - ℹ Safe fix 672 672 | print() 673 673 | @@ -90,13 +95,14 @@ E30.py:676:1: E303 [*] Too many blank lines (3) 677 676 | 678 677 | print() -E30.py:687:5: E303 [*] Too many blank lines (2) +error[E303]: 687:5: [*] Too many blank lines (2) + + --> E30.py:687:5 | 687 | # comment - | ^^^^^^^^^ E303 + | ^^^^^^^^^ | = help: Remove extraneous blank line(s) - ℹ Safe fix 683 683 | def a(): 684 684 | print() @@ -106,15 +112,16 @@ E30.py:687:5: E303 [*] Too many blank lines (2) 688 687 | 689 688 | -E30.py:690:5: E303 [*] Too many blank lines (2) +error[E303]: 690:5: [*] Too many blank lines (2) + + --> E30.py:690:5 | 690 | # another comment - | ^^^^^^^^^^^^^^^^^ E303 + | ^^^^^^^^^^^^^^^^^ 691 | 692 | print() | = help: Remove extraneous blank line(s) - ℹ Safe fix 686 686 | 687 687 | # comment @@ -124,16 +131,17 @@ E30.py:690:5: E303 [*] Too many blank lines (2) 691 690 | 692 691 | print() -E30.py:701:1: E303 [*] Too many blank lines (3) +error[E303]: 701:1: [*] Too many blank lines (3) + + --> E30.py:701:1 | 701 | / """This class docstring comes on line 5. 702 | | It gives error E303: too many blank lines (3) 703 | | """ - | |___^ E303 + | |___^ 704 | # end | = help: Remove extraneous blank line(s) - ℹ Safe fix 697 697 | #!python 698 698 | @@ -143,15 +151,16 @@ E30.py:701:1: E303 [*] Too many blank lines (3) 702 701 | It gives error E303: too many blank lines (3) 703 702 | """ -E30.py:713:5: E303 [*] Too many blank lines (2) +error[E303]: 713:5: [*] Too many blank lines (2) + + --> E30.py:713:5 | 713 | def b(self): - | ^^^ E303 + | ^^^ 714 | pass 715 | # end | = help: Remove extraneous blank line(s) - ℹ Safe fix 709 709 | def a(self): 710 710 | pass @@ -161,14 +170,15 @@ E30.py:713:5: E303 [*] Too many blank lines (2) 714 713 | pass 715 714 | # end -E30.py:723:5: E303 [*] Too many blank lines (2) +error[E303]: 723:5: [*] Too many blank lines (2) + + --> E30.py:723:5 | 723 | a = 2 - | ^ E303 + | ^ 724 | # end | = help: Remove extraneous blank line(s) - ℹ Safe fix 719 719 | if True: 720 720 | a = 1 @@ -178,13 +188,14 @@ E30.py:723:5: E303 [*] Too many blank lines (2) 724 723 | # end 725 724 | -E30.py:731:5: E303 [*] Too many blank lines (2) +error[E303]: 731:5: [*] Too many blank lines (2) + + --> E30.py:731:5 | 731 | # comment - | ^^^^^^^^^ E303 + | ^^^^^^^^^ | = help: Remove extraneous blank line(s) - ℹ Safe fix 727 727 | # E303 728 728 | class Test: @@ -194,15 +205,16 @@ E30.py:731:5: E303 [*] Too many blank lines (2) 732 731 | 733 732 | -E30.py:734:5: E303 [*] Too many blank lines (2) +error[E303]: 734:5: [*] Too many blank lines (2) + + --> E30.py:734:5 | 734 | # another comment - | ^^^^^^^^^^^^^^^^^ E303 + | ^^^^^^^^^^^^^^^^^ 735 | 736 | def test(self): pass | = help: Remove extraneous blank line(s) - ℹ Safe fix 730 730 | 731 731 | # comment @@ -212,15 +224,16 @@ E30.py:734:5: E303 [*] Too many blank lines (2) 735 734 | 736 735 | def test(self): pass -E30.py:748:5: E303 [*] Too many blank lines (2) +error[E303]: 748:5: [*] Too many blank lines (2) + + --> E30.py:748:5 | 748 | def b(self): - | ^^^ E303 + | ^^^ 749 | pass 750 | # end | = help: Remove extraneous blank line(s) - ℹ Safe fix 744 744 | 745 745 | # wrongly indented comment @@ -230,14 +243,15 @@ E30.py:748:5: E303 [*] Too many blank lines (2) 749 748 | pass 750 749 | # end -E30.py:758:5: E303 [*] Too many blank lines (2) +error[E303]: 758:5: [*] Too many blank lines (2) + + --> E30.py:758:5 | 758 | pass - | ^^^^ E303 + | ^^^^ 759 | # end | = help: Remove extraneous blank line(s) - ℹ Safe fix 754 754 | def fn(): 755 755 | pass diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E303_first_line_comment.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E303_first_line_comment.py.snap index 01063712b8..866cf9f77b 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E303_first_line_comment.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E303_first_line_comment.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[E303]: E303_first_line_comment.py:5:1: [*] Too many blank lines (3) +error[E303]: 5:1: [*] Too many blank lines (3) + --> E303_first_line_comment.py:5:1 | 5 | def fn(): | ^^^ diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E303_first_line_docstring.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E303_first_line_docstring.py.snap index b1eedb4bc3..80a994f45d 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E303_first_line_docstring.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E303_first_line_docstring.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[E303]: E303_first_line_docstring.py:5:1: [*] Too many blank lines (3) +error[E303]: 5:1: [*] Too many blank lines (3) + --> E303_first_line_docstring.py:5:1 | 5 | def fn(): | ^^^ diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E303_first_line_expression.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E303_first_line_expression.py.snap index 94eb9d1699..1d64f03ba6 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E303_first_line_expression.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E303_first_line_expression.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[E303]: E303_first_line_expression.py:5:1: [*] Too many blank lines (3) +error[E303]: 5:1: [*] Too many blank lines (3) + --> E303_first_line_expression.py:5:1 | 5 | def fn(): | ^^^ diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E303_first_line_statement.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E303_first_line_statement.py.snap index eeba3fa999..aa4840f0a3 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E303_first_line_statement.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E303_first_line_statement.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[E303]: E303_first_line_statement.py:5:1: [*] Too many blank lines (3) +error[E303]: 5:1: [*] Too many blank lines (3) + --> E303_first_line_statement.py:5:1 | 5 | def fn(): | ^^^ diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E30_syntax_error.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E30_syntax_error.py.snap index cc3a491b98..fc348a032f 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E30_syntax_error.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E30_syntax_error.py.snap @@ -1,7 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -E30_syntax_error.py:4:15: SyntaxError: Expected ']', found '(' +error[syntax-error]: 4:15: Expected ']', found '(' + + --> E30_syntax_error.py:4:15 | 2 | # parenthesis. 3 | @@ -9,17 +11,19 @@ E30_syntax_error.py:4:15: SyntaxError: Expected ']', found '(' | ^ 5 | pass | +error[E303]: 12:1: Too many blank lines (3) -E30_syntax_error.py:12:1: E303 Too many blank lines (3) + --> E30_syntax_error.py:12:1 | 12 | class Foo: - | ^^^^^ E303 + | ^^^^^ 13 | def __init__( 14 | pass | = help: Remove extraneous blank line(s) +error[syntax-error]: 13:18: Expected ')', found newline -E30_syntax_error.py:13:18: SyntaxError: Expected ')', found newline + --> E30_syntax_error.py:13:18 | 12 | class Foo: 13 | def __init__( @@ -28,8 +32,9 @@ E30_syntax_error.py:13:18: SyntaxError: Expected ')', found newline 15 | def method(): 16 | pass | +error[syntax-error]: 18:11: Expected ')', found newline -E30_syntax_error.py:18:11: SyntaxError: Expected ')', found newline + --> E30_syntax_error.py:18:11 | 16 | pass 17 | @@ -39,8 +44,9 @@ E30_syntax_error.py:18:11: SyntaxError: Expected ')', found newline 20 | 21 | def top( | +error[syntax-error]: 21:9: Expected ')', found newline -E30_syntax_error.py:21:9: SyntaxError: Expected ')', found newline + --> E30_syntax_error.py:21:9 | 21 | def top( | ^ diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E304_E30.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E304_E30.py.snap index 2c53c6bbf7..c37c958eb3 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E304_E30.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E304_E30.py.snap @@ -1,17 +1,18 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -E30.py:765:1: E304 [*] Blank lines found after function decorator (1) +error[E304]: 765:1: [*] Blank lines found after function decorator (1) + + --> E30.py:764:1 | 763 | @decorator 764 | 765 | def function(): - | ^^^ E304 + | ^^^ 766 | pass 767 | # end | = help: Remove extraneous blank line(s) - ℹ Safe fix 761 761 | 762 762 | # E304 @@ -21,16 +22,17 @@ E30.py:765:1: E304 [*] Blank lines found after function decorator (1) 766 765 | pass 767 766 | # end -E30.py:774:1: E304 [*] Blank lines found after function decorator (1) +error[E304]: 774:1: [*] Blank lines found after function decorator (1) + + --> E30.py:773:31 | 773 | # comment E304 not expected 774 | def function(): - | ^^^ E304 + | ^^^ 775 | pass 776 | # end | = help: Remove extraneous blank line(s) - ℹ Safe fix 769 769 | 770 770 | # E304 @@ -40,16 +42,17 @@ E30.py:774:1: E304 [*] Blank lines found after function decorator (1) 774 773 | def function(): 775 774 | pass -E30.py:786:1: E304 [*] Blank lines found after function decorator (2) +error[E304]: 786:1: [*] Blank lines found after function decorator (2) + + --> E30.py:785:36 | 785 | # second comment E304 not expected 786 | def function(): - | ^^^ E304 + | ^^^ 787 | pass 788 | # end | = help: Remove extraneous blank line(s) - ℹ Safe fix 778 778 | 779 779 | # E304 diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E305_E30.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E305_E30.py.snap index 275e9a19ef..e9ab857191 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E305_E30.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E305_E30.py.snap @@ -1,15 +1,16 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -E30.py:798:1: E305 [*] Expected 2 blank lines after class or function definition, found (1) +error[E305]: 798:1: [*] Expected 2 blank lines after class or function definition, found (1) + + --> E30.py:797:22 | 797 | # another comment 798 | fn() - | ^^ E305 + | ^^ 799 | # end | = help: Add missing blank line(s) - ℹ Safe fix 795 795 | # comment 796 796 | @@ -19,15 +20,16 @@ E30.py:798:1: E305 [*] Expected 2 blank lines after class or function definition 799 800 | # end 800 801 | -E30.py:809:1: E305 [*] Expected 2 blank lines after class or function definition, found (1) +error[E305]: 809:1: [*] Expected 2 blank lines after class or function definition, found (1) + + --> E30.py:808:22 | 808 | # another comment 809 | a = 1 - | ^ E305 + | ^ 810 | # end | = help: Add missing blank line(s) - ℹ Safe fix 806 806 | # comment 807 807 | @@ -37,17 +39,18 @@ E30.py:809:1: E305 [*] Expected 2 blank lines after class or function definition 810 811 | # end 811 812 | -E30.py:821:1: E305 [*] Expected 2 blank lines after class or function definition, found (1) +error[E305]: 821:1: [*] Expected 2 blank lines after class or function definition, found (1) + + --> E30.py:820:1 | 819 | # another comment 820 | 821 | try: - | ^^^ E305 + | ^^^ 822 | fn() 823 | except Exception: | = help: Add missing blank line(s) - ℹ Safe fix 818 818 | 819 819 | # another comment @@ -57,16 +60,17 @@ E30.py:821:1: E305 [*] Expected 2 blank lines after class or function definition 822 823 | fn() 823 824 | except Exception: -E30.py:833:1: E305 [*] Expected 2 blank lines after class or function definition, found (1) +error[E305]: 833:1: [*] Expected 2 blank lines after class or function definition, found (1) + + --> E30.py:832:35 | 832 | # Two spaces before comments, too. 833 | if a(): - | ^^ E305 + | ^^ 834 | a() 835 | # end | = help: Add missing blank line(s) - ℹ Safe fix 829 829 | def a(): 830 830 | print() @@ -76,17 +80,18 @@ E30.py:833:1: E305 [*] Expected 2 blank lines after class or function definition 833 834 | if a(): 834 835 | a() -E30.py:846:1: E305 [*] Expected 2 blank lines after class or function definition, found (1) +error[E305]: 846:1: [*] Expected 2 blank lines after class or function definition, found (1) + + --> E30.py:845:1 | 844 | blah, blah 845 | 846 | if __name__ == '__main__': - | ^^ E305 + | ^^ 847 | main() 848 | # end | = help: Add missing blank line(s) - ℹ Safe fix 843 843 | def main(): 844 844 | blah, blah @@ -96,15 +101,16 @@ E30.py:846:1: E305 [*] Expected 2 blank lines after class or function definition 847 848 | main() 848 849 | # end -E30.py:973:1: E305 [*] Expected 2 blank lines after class or function definition, found (1) +error[E305]: 973:1: [*] Expected 2 blank lines after class or function definition, found (1) + + --> E30.py:972:33 | 972 | # ====== Cool constants ======== 973 | BANANA = 100 - | ^^^^^^ E305 + | ^^^^^^ 974 | APPLE = 200 | = help: Add missing blank line(s) - ℹ Safe fix 969 969 | class A: 970 970 | pass diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E305_E30_syntax_error.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E305_E30_syntax_error.py.snap index 8a63b25af3..5ff1b4e70f 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E305_E30_syntax_error.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E305_E30_syntax_error.py.snap @@ -1,7 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -E30_syntax_error.py:4:15: SyntaxError: Expected ']', found '(' +error[syntax-error]: 4:15: Expected ']', found '(' + + --> E30_syntax_error.py:4:15 | 2 | # parenthesis. 3 | @@ -9,8 +11,9 @@ E30_syntax_error.py:4:15: SyntaxError: Expected ']', found '(' | ^ 5 | pass | +error[syntax-error]: 13:18: Expected ')', found newline -E30_syntax_error.py:13:18: SyntaxError: Expected ')', found newline + --> E30_syntax_error.py:13:18 | 12 | class Foo: 13 | def __init__( @@ -19,17 +22,19 @@ E30_syntax_error.py:13:18: SyntaxError: Expected ')', found newline 15 | def method(): 16 | pass | +error[E305]: 18:1: Expected 2 blank lines after class or function definition, found (1) -E30_syntax_error.py:18:1: E305 Expected 2 blank lines after class or function definition, found (1) + --> E30_syntax_error.py:17:1 | 16 | pass 17 | 18 | foo = Foo( - | ^^^ E305 + | ^^^ | = help: Add missing blank line(s) +error[syntax-error]: 18:11: Expected ')', found newline -E30_syntax_error.py:18:11: SyntaxError: Expected ')', found newline + --> E30_syntax_error.py:18:11 | 16 | pass 17 | @@ -39,8 +44,9 @@ E30_syntax_error.py:18:11: SyntaxError: Expected ')', found newline 20 | 21 | def top( | +error[syntax-error]: 21:9: Expected ')', found newline -E30_syntax_error.py:21:9: SyntaxError: Expected ')', found newline + --> E30_syntax_error.py:21:9 | 21 | def top( | ^ diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E306_E30.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E306_E30.py.snap index 8f83acc86f..0b16f3375a 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E306_E30.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E306_E30.py.snap @@ -1,17 +1,18 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -E30.py:854:5: E306 [*] Expected 1 blank line before a nested definition, found 0 +error[E306]: 854:5: [*] Expected 1 blank line before a nested definition, found 0 + + --> E30.py:854:5 | 852 | def a(): 853 | x = 1 854 | def b(): - | ^^^ E306 + | ^^^ 855 | pass 856 | # end | = help: Add missing blank line - ℹ Safe fix 851 851 | # E306:3:5 852 852 | def a(): @@ -21,17 +22,18 @@ E30.py:854:5: E306 [*] Expected 1 blank line before a nested definition, found 0 855 856 | pass 856 857 | # end -E30.py:862:5: E306 [*] Expected 1 blank line before a nested definition, found 0 +error[E306]: 862:5: [*] Expected 1 blank line before a nested definition, found 0 + + --> E30.py:862:5 | 860 | async def a(): 861 | x = 1 862 | def b(): - | ^^^ E306 + | ^^^ 863 | pass 864 | # end | = help: Add missing blank line - ℹ Safe fix 859 859 | #: E306:3:5 860 860 | async def a(): @@ -41,17 +43,18 @@ E30.py:862:5: E306 [*] Expected 1 blank line before a nested definition, found 0 863 864 | pass 864 865 | # end -E30.py:870:5: E306 [*] Expected 1 blank line before a nested definition, found 0 +error[E306]: 870:5: [*] Expected 1 blank line before a nested definition, found 0 + + --> E30.py:870:5 | 868 | def a(): 869 | x = 2 870 | def b(): - | ^^^ E306 + | ^^^ 871 | x = 1 872 | def c(): | = help: Add missing blank line - ℹ Safe fix 867 867 | #: E306:3:5 E306:5:9 868 868 | def a(): @@ -61,17 +64,18 @@ E30.py:870:5: E306 [*] Expected 1 blank line before a nested definition, found 0 871 872 | x = 1 872 873 | def c(): -E30.py:872:9: E306 [*] Expected 1 blank line before a nested definition, found 0 +error[E306]: 872:9: [*] Expected 1 blank line before a nested definition, found 0 + + --> E30.py:872:9 | 870 | def b(): 871 | x = 1 872 | def c(): - | ^^^ E306 + | ^^^ 873 | pass 874 | # end | = help: Add missing blank line - ℹ Safe fix 869 869 | x = 2 870 870 | def b(): @@ -81,17 +85,18 @@ E30.py:872:9: E306 [*] Expected 1 blank line before a nested definition, found 0 873 874 | pass 874 875 | # end -E30.py:880:5: E306 [*] Expected 1 blank line before a nested definition, found 0 +error[E306]: 880:5: [*] Expected 1 blank line before a nested definition, found 0 + + --> E30.py:880:5 | 878 | def a(): 879 | x = 1 880 | class C: - | ^^^^^ E306 + | ^^^^^ 881 | pass 882 | x = 2 | = help: Add missing blank line - ℹ Safe fix 877 877 | # E306:3:5 E306:6:5 878 878 | def a(): @@ -101,17 +106,18 @@ E30.py:880:5: E306 [*] Expected 1 blank line before a nested definition, found 0 881 882 | pass 882 883 | x = 2 -E30.py:883:5: E306 [*] Expected 1 blank line before a nested definition, found 0 +error[E306]: 883:5: [*] Expected 1 blank line before a nested definition, found 0 + + --> E30.py:883:5 | 881 | pass 882 | x = 2 883 | def b(): - | ^^^ E306 + | ^^^ 884 | pass 885 | # end | = help: Add missing blank line - ℹ Safe fix 880 880 | class C: 881 881 | pass @@ -121,16 +127,17 @@ E30.py:883:5: E306 [*] Expected 1 blank line before a nested definition, found 0 884 885 | pass 885 886 | # end -E30.py:892:5: E306 [*] Expected 1 blank line before a nested definition, found 0 +error[E306]: 892:5: [*] Expected 1 blank line before a nested definition, found 0 + + --> E30.py:892:5 | 890 | def bar(): 891 | pass 892 | def baz(): pass - | ^^^ E306 + | ^^^ 893 | # end | = help: Add missing blank line - ℹ Safe fix 889 889 | def foo(): 890 890 | def bar(): @@ -140,17 +147,18 @@ E30.py:892:5: E306 [*] Expected 1 blank line before a nested definition, found 0 893 894 | # end 894 895 | -E30.py:899:5: E306 [*] Expected 1 blank line before a nested definition, found 0 +error[E306]: 899:5: [*] Expected 1 blank line before a nested definition, found 0 + + --> E30.py:899:5 | 897 | def foo(): 898 | def bar(): pass 899 | def baz(): - | ^^^ E306 + | ^^^ 900 | pass 901 | # end | = help: Add missing blank line - ℹ Safe fix 896 896 | # E306:3:5 897 897 | def foo(): @@ -160,17 +168,18 @@ E30.py:899:5: E306 [*] Expected 1 blank line before a nested definition, found 0 900 901 | pass 901 902 | # end -E30.py:907:5: E306 [*] Expected 1 blank line before a nested definition, found 0 +error[E306]: 907:5: [*] Expected 1 blank line before a nested definition, found 0 + + --> E30.py:907:5 | 905 | def a(): 906 | x = 2 907 | @decorator - | ^ E306 + | ^ 908 | def b(): 909 | pass | = help: Add missing blank line - ℹ Safe fix 904 904 | # E306 905 905 | def a(): @@ -180,17 +189,18 @@ E30.py:907:5: E306 [*] Expected 1 blank line before a nested definition, found 0 908 909 | def b(): 909 910 | pass -E30.py:916:5: E306 [*] Expected 1 blank line before a nested definition, found 0 +error[E306]: 916:5: [*] Expected 1 blank line before a nested definition, found 0 + + --> E30.py:916:5 | 914 | def a(): 915 | x = 2 916 | @decorator - | ^ E306 + | ^ 917 | async def b(): 918 | pass | = help: Add missing blank line - ℹ Safe fix 913 913 | # E306 914 914 | def a(): @@ -200,17 +210,18 @@ E30.py:916:5: E306 [*] Expected 1 blank line before a nested definition, found 0 917 918 | async def b(): 918 919 | pass -E30.py:925:5: E306 [*] Expected 1 blank line before a nested definition, found 0 +error[E306]: 925:5: [*] Expected 1 blank line before a nested definition, found 0 + + --> E30.py:925:5 | 923 | def a(): 924 | x = 2 925 | async def b(): - | ^^^^^ E306 + | ^^^^^ 926 | pass 927 | # end | = help: Add missing blank line - ℹ Safe fix 922 922 | # E306 923 923 | def a(): diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E306_E30_syntax_error.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E306_E30_syntax_error.py.snap index 726be4dd3d..f717bb3a3f 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E306_E30_syntax_error.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E306_E30_syntax_error.py.snap @@ -1,7 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -E30_syntax_error.py:4:15: SyntaxError: Expected ']', found '(' +error[syntax-error]: 4:15: Expected ']', found '(' + + --> E30_syntax_error.py:4:15 | 2 | # parenthesis. 3 | @@ -9,8 +11,9 @@ E30_syntax_error.py:4:15: SyntaxError: Expected ']', found '(' | ^ 5 | pass | +error[syntax-error]: 13:18: Expected ')', found newline -E30_syntax_error.py:13:18: SyntaxError: Expected ')', found newline + --> E30_syntax_error.py:13:18 | 12 | class Foo: 13 | def __init__( @@ -19,8 +22,9 @@ E30_syntax_error.py:13:18: SyntaxError: Expected ')', found newline 15 | def method(): 16 | pass | +error[syntax-error]: 18:11: Expected ')', found newline -E30_syntax_error.py:18:11: SyntaxError: Expected ')', found newline + --> E30_syntax_error.py:18:11 | 16 | pass 17 | @@ -30,8 +34,9 @@ E30_syntax_error.py:18:11: SyntaxError: Expected ')', found newline 20 | 21 | def top( | +error[syntax-error]: 21:9: Expected ')', found newline -E30_syntax_error.py:21:9: SyntaxError: Expected ')', found newline + --> E30_syntax_error.py:21:9 | 21 | def top( | ^ @@ -39,13 +44,14 @@ E30_syntax_error.py:21:9: SyntaxError: Expected ')', found newline 23 | pass 24 | def nested2(): | +error[E306]: 24:5: Expected 1 blank line before a nested definition, found 0 -E30_syntax_error.py:24:5: E306 Expected 1 blank line before a nested definition, found 0 + --> E30_syntax_error.py:24:5 | 22 | def nested1(): 23 | pass 24 | def nested2(): - | ^^^ E306 + | ^^^ 25 | pass | = help: Add missing blank line diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E401_E40.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E401_E40.py.snap index cf2665859e..35191108d1 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E401_E40.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E401_E40.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[E401]: E40.py:2:1: [*] Multiple imports on one line +error[E401]: 2:1: [*] Multiple imports on one line + --> E40.py:1:8 | 1 | #: E401 2 | import os, sys @@ -20,8 +21,9 @@ error[E401]: E40.py:2:1: [*] Multiple imports on one line 4 5 | #: Okay 5 6 | import os -error[E401]: E40.py:65:1: [*] Multiple imports on one line +error[E401]: 65:1: [*] Multiple imports on one line + --> E40.py:64:8 | 64 | #: E401 65 | import re as regex, string # also with a comment! @@ -40,8 +42,9 @@ error[E401]: E40.py:65:1: [*] Multiple imports on one line 67 68 | 68 69 | x = 1; import re as regex, string -error[E401]: E40.py:66:1: [*] Multiple imports on one line +error[E401]: 66:1: [*] Multiple imports on one line + --> E40.py:65:51 | 64 | #: E401 65 | import re as regex, string # also with a comment! @@ -61,8 +64,9 @@ error[E401]: E40.py:66:1: [*] Multiple imports on one line 68 68 | x = 1; import re as regex, string 69 69 | -error[E401]: E40.py:68:8: [*] Multiple imports on one line +error[E401]: 68:8: [*] Multiple imports on one line + --> E40.py:68:8 | 66 | import re as regex, string; x = 1 67 | @@ -80,8 +84,9 @@ error[E401]: E40.py:68:8: [*] Multiple imports on one line 70 70 | 71 71 | def blah(): -error[E401]: E40.py:72:5: [*] Multiple imports on one line +error[E401]: 72:5: [*] Multiple imports on one line + --> E40.py:72:5 | 71 | def blah(): 72 | import datetime as dt, copy @@ -101,8 +106,9 @@ error[E401]: E40.py:72:5: [*] Multiple imports on one line 74 75 | def nested_and_tested(): 75 76 | import builtins, textwrap as tw -error[E401]: E40.py:75:9: [*] Multiple imports on one line +error[E401]: 75:9: [*] Multiple imports on one line + --> E40.py:75:9 | 74 | def nested_and_tested(): 75 | import builtins, textwrap as tw @@ -122,8 +128,9 @@ error[E401]: E40.py:75:9: [*] Multiple imports on one line 77 78 | x = 1; import re as regex, string 78 79 | import re as regex, string; x = 1 -error[E401]: E40.py:77:16: [*] Multiple imports on one line +error[E401]: 77:16: [*] Multiple imports on one line + --> E40.py:77:16 | 75 | import builtins, textwrap as tw 76 | @@ -142,8 +149,9 @@ error[E401]: E40.py:77:16: [*] Multiple imports on one line 79 79 | 80 80 | if True: import re as regex, string -error[E401]: E40.py:78:9: [*] Multiple imports on one line +error[E401]: 78:9: [*] Multiple imports on one line + --> E40.py:78:9 | 77 | x = 1; import re as regex, string 78 | import re as regex, string; x = 1 @@ -161,8 +169,9 @@ error[E401]: E40.py:78:9: [*] Multiple imports on one line 79 79 | 80 80 | if True: import re as regex, string -error[E401]: E40.py:80:14: [*] Multiple imports on one line +error[E401]: 80:14: [*] Multiple imports on one line + --> E40.py:80:14 | 78 | import re as regex, string; x = 1 79 | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E402_E40.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E402_E40.py.snap index 6f0453b8f0..1ee9e23b42 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E402_E40.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E402_E40.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[E402]: E40.py:56:1: Module level import not at top of file +error[E402]: 56:1: Module level import not at top of file + --> E40.py:55:1 | 54 | VERSION = '1.2.3' 55 | @@ -11,8 +12,9 @@ error[E402]: E40.py:56:1: Module level import not at top of file 57 | #: E402 58 | import foo | -error[E402]: E40.py:58:1: Module level import not at top of file +error[E402]: 58:1: Module level import not at top of file + --> E40.py:57:8 | 56 | import foo 57 | #: E402 @@ -21,8 +23,9 @@ error[E402]: E40.py:58:1: Module level import not at top of file 59 | 60 | a = 1 | -error[E402]: E40.py:62:1: Module level import not at top of file +error[E402]: 62:1: Module level import not at top of file + --> E40.py:61:1 | 60 | a = 1 61 | @@ -31,16 +34,18 @@ error[E402]: E40.py:62:1: Module level import not at top of file 63 | 64 | #: E401 | -error[E402]: E40.py:65:1: Module level import not at top of file +error[E402]: 65:1: Module level import not at top of file + --> E40.py:64:8 | 64 | #: E401 65 | import re as regex, string # also with a comment! | ^^^^^^^^^^^^^^^^^^^^^^^^^^ 66 | import re as regex, string; x = 1 | -error[E402]: E40.py:66:1: Module level import not at top of file +error[E402]: 66:1: Module level import not at top of file + --> E40.py:65:51 | 64 | #: E401 65 | import re as regex, string # also with a comment! @@ -49,8 +54,9 @@ error[E402]: E40.py:66:1: Module level import not at top of file 67 | 68 | x = 1; import re as regex, string | -error[E402]: E40.py:68:8: Module level import not at top of file +error[E402]: 68:8: Module level import not at top of file + --> E40.py:68:8 | 66 | import re as regex, string; x = 1 67 | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E402_E402.ipynb.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E402_E402.ipynb.snap index 6996634fa7..e9732a29a4 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E402_E402.ipynb.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E402_E402.ipynb.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[E402]: E402.ipynb:9:1: Module level import not at top of cell +error[E402]: 9:1: Module level import not at top of cell + --> E402.ipynb:8:1 | 7 | os.path 8 | @@ -11,8 +12,9 @@ error[E402]: E402.ipynb:9:1: Module level import not at top of cell 10 | 11 | import a | -error[E402]: E402.ipynb:22:1: Module level import not at top of cell +error[E402]: 22:1: Module level import not at top of cell + --> E402.ipynb:21:1 | 20 | __some__magic = 1 21 | @@ -20,8 +22,9 @@ error[E402]: E402.ipynb:22:1: Module level import not at top of cell | ^^^^^^^^ 23 | import ok | -error[E402]: E402.ipynb:30:1: Module level import not at top of cell +error[E402]: 30:1: Module level import not at top of cell + --> E402.ipynb:30:1 | 30 | import no_ok | ^^^^^^^^^^^^ diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E402_E402_0.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E402_E402_0.py.snap index 15ef0e411e..aca2a40ddd 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E402_E402_0.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E402_E402_0.py.snap @@ -1,24 +1,27 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[E402]: E402_0.py:35:1: Module level import not at top of file +error[E402]: 35:1: Module level import not at top of file + --> E402_0.py:34:1 | 33 | __some__magic = 1 34 | 35 | import h | ^^^^^^^^ | -error[E402]: E402_0.py:45:1: Module level import not at top of file +error[E402]: 45:1: Module level import not at top of file + --> E402_0.py:44:1 | 43 | import j 44 | 45 | import k; import l | ^^^^^^^^ | -error[E402]: E402_0.py:45:11: Module level import not at top of file +error[E402]: 45:11: Module level import not at top of file + --> E402_0.py:45:11 | 43 | import j 44 | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E402_E402_1.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E402_E402_1.py.snap index dd97575ca3..404f4a1ec2 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E402_E402_1.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E402_E402_1.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[E402]: E402_1.py:5:1: Module level import not at top of file +error[E402]: 5:1: Module level import not at top of file + --> E402_1.py:4:1 | 3 | """Some other docstring.""" 4 | @@ -11,8 +12,9 @@ error[E402]: E402_1.py:5:1: Module level import not at top of file 6 | 7 | """Some other docstring.""" | -error[E402]: E402_1.py:9:1: Module level import not at top of file +error[E402]: 9:1: Module level import not at top of file + --> E402_1.py:8:1 | 7 | """Some other docstring.""" 8 | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E501_E501.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E501_E501.py.snap index 27c6ed9ebf..58001777f0 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E501_E501.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E501_E501.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[E501]: E501.py:5:89: Line too long (123 > 88) +error[E501]: 5:89: Line too long (123 > 88) + --> E501.py:5:89 | 3 | https://github.com/PyCQA/pycodestyle/pull/258/files#diff-841c622497a8033d10152bfdfb15b20b92437ecdea21a260944ea86b77b51533 4 | @@ -10,15 +11,17 @@ error[E501]: E501.py:5:89: Line too long (123 > 88) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 6 | """ | -error[E501]: E501.py:16:85: Line too long (95 > 88) +error[E501]: 16:85: Line too long (95 > 88) + --> E501.py:16:85 | 15 | _ = "---------------------------------------------------------------------------AAAAAAA" 16 | _ = "---------------------------------------------------------------------------亜亜亜亜亜亜亜" | ^^^^^^^ | -error[E501]: E501.py:25:89: Line too long (127 > 88) +error[E501]: 25:89: Line too long (127 > 88) + --> E501.py:25:89 | 23 | caller( 24 | """ @@ -27,8 +30,9 @@ error[E501]: E501.py:25:89: Line too long (127 > 88) 26 | """, 27 | ) | -error[E501]: E501.py:40:89: Line too long (132 > 88) +error[E501]: 40:89: Line too long (132 > 88) + --> E501.py:40:89 | 38 | "Lorem ipsum dolor": "sit amet", 39 | # E501 Line too long @@ -37,8 +41,9 @@ error[E501]: E501.py:40:89: Line too long (132 > 88) 41 | # E501 Line too long 42 | "Lorem ipsum dolor": """ | -error[E501]: E501.py:43:89: Line too long (105 > 88) +error[E501]: 43:89: Line too long (105 > 88) + --> E501.py:43:89 | 41 | # E501 Line too long 42 | "Lorem ipsum dolor": """ @@ -47,8 +52,9 @@ error[E501]: E501.py:43:89: Line too long (105 > 88) 44 | """, 45 | # OK | -error[E501]: E501.py:83:89: Line too long (147 > 88) +error[E501]: 83:89: Line too long (147 > 88) + --> E501.py:83:89 | 81 | ... 82 | ... diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E501_E501_3.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E501_E501_3.py.snap index 1755d2f6a6..a0a75d5e83 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E501_E501_3.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E501_E501_3.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[E501]: E501_3.py:11:89: Line too long (89 > 88) +error[E501]: 11:89: Line too long (89 > 88) + --> E501_3.py:11:89 | 10 | # Error (89 characters) 11 | "shape:" + "shape:" + "shape:" + "shape:" + "shape:" + "shape:" + "shape:" + "shape:aaaa" # type: ignore diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E501_E501_4.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E501_E501_4.py.snap index 268c8156fc..176116b74d 100644 Binary files a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E501_E501_4.py.snap and b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E501_E501_4.py.snap differ diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E701_E70.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E701_E70.py.snap index 7986e97d32..13a14ebde7 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E701_E70.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E701_E70.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[E701]: E70.py:2:5: Multiple statements on one line (colon) +error[E701]: 2:5: Multiple statements on one line (colon) + --> E70.py:2:5 | 1 | #: E701:1:5 2 | if a: a = False @@ -10,8 +11,9 @@ error[E701]: E70.py:2:5: Multiple statements on one line (colon) 3 | #: E701:1:40 4 | if not header or header[:6] != 'bytes=': return | -error[E701]: E70.py:4:40: Multiple statements on one line (colon) +error[E701]: 4:40: Multiple statements on one line (colon) + --> E70.py:4:40 | 2 | if a: a = False 3 | #: E701:1:40 @@ -20,8 +22,9 @@ error[E701]: E70.py:4:40: Multiple statements on one line (colon) 5 | #: E702:1:10 6 | a = False; b = True | -error[E701]: E70.py:25:8: Multiple statements on one line (colon) +error[E701]: 25:8: Multiple statements on one line (colon) + --> E70.py:25:8 | 23 | def f(x): return 2*x 24 | #: E704:1:8 E702:1:11 E703:1:14 @@ -30,8 +33,9 @@ error[E701]: E70.py:25:8: Multiple statements on one line (colon) 26 | #: E701:1:8 27 | if True: lambda a: b | -error[E701]: E70.py:27:8: Multiple statements on one line (colon) +error[E701]: 27:8: Multiple statements on one line (colon) + --> E70.py:27:8 | 25 | if True: x; y; 26 | #: E701:1:8 @@ -40,8 +44,9 @@ error[E701]: E70.py:27:8: Multiple statements on one line (colon) 28 | #: E701:1:10 29 | if a := 1: pass | -error[E701]: E70.py:29:10: Multiple statements on one line (colon) +error[E701]: 29:10: Multiple statements on one line (colon) + --> E70.py:29:10 | 27 | if True: lambda a: b 28 | #: E701:1:10 @@ -50,8 +55,9 @@ error[E701]: E70.py:29:10: Multiple statements on one line (colon) 30 | # E701:1:4 E701:2:18 E701:3:8 31 | try: lambda foo: bar | -error[E701]: E70.py:31:4: Multiple statements on one line (colon) +error[E701]: 31:4: Multiple statements on one line (colon) + --> E70.py:31:4 | 29 | if a := 1: pass 30 | # E701:1:4 E701:2:18 E701:3:8 @@ -60,8 +66,9 @@ error[E701]: E70.py:31:4: Multiple statements on one line (colon) 32 | except ValueError: pass 33 | finally: pass | -error[E701]: E70.py:32:18: Multiple statements on one line (colon) +error[E701]: 32:18: Multiple statements on one line (colon) + --> E70.py:32:18 | 30 | # E701:1:4 E701:2:18 E701:3:8 31 | try: lambda foo: bar @@ -70,8 +77,9 @@ error[E701]: E70.py:32:18: Multiple statements on one line (colon) 33 | finally: pass 34 | # E701:1:7 | -error[E701]: E70.py:33:8: Multiple statements on one line (colon) +error[E701]: 33:8: Multiple statements on one line (colon) + --> E70.py:33:8 | 31 | try: lambda foo: bar 32 | except ValueError: pass @@ -80,8 +88,9 @@ error[E701]: E70.py:33:8: Multiple statements on one line (colon) 34 | # E701:1:7 35 | class C: pass | -error[E701]: E70.py:35:8: Multiple statements on one line (colon) +error[E701]: 35:8: Multiple statements on one line (colon) + --> E70.py:35:8 | 33 | finally: pass 34 | # E701:1:7 @@ -90,8 +99,9 @@ error[E701]: E70.py:35:8: Multiple statements on one line (colon) 36 | # E701:1:7 37 | with C(): pass | -error[E701]: E70.py:37:9: Multiple statements on one line (colon) +error[E701]: 37:9: Multiple statements on one line (colon) + --> E70.py:37:9 | 35 | class C: pass 36 | # E701:1:7 @@ -100,8 +110,9 @@ error[E701]: E70.py:37:9: Multiple statements on one line (colon) 38 | # E701:1:14 39 | async with C(): pass | -error[E701]: E70.py:39:15: Multiple statements on one line (colon) +error[E701]: 39:15: Multiple statements on one line (colon) + --> E70.py:39:15 | 37 | with C(): pass 38 | # E701:1:14 @@ -110,8 +121,9 @@ error[E701]: E70.py:39:15: Multiple statements on one line (colon) 40 | #: 41 | lambda a: b | -error[E701]: E70.py:54:8: Multiple statements on one line (colon) +error[E701]: 54:8: Multiple statements on one line (colon) + --> E70.py:54:8 | 52 | def f(): ... 53 | #: E701:1:8 E702:1:13 @@ -120,8 +132,9 @@ error[E701]: E70.py:54:8: Multiple statements on one line (colon) 55 | #: E701:1:8 E702:1:13 56 | class C: ...; ... | -error[E701]: E70.py:56:8: Multiple statements on one line (colon) +error[E701]: 56:8: Multiple statements on one line (colon) + --> E70.py:56:8 | 54 | class C: ...; x = 1 55 | #: E701:1:8 E702:1:13 @@ -130,8 +143,9 @@ error[E701]: E70.py:56:8: Multiple statements on one line (colon) 57 | #: E701:2:12 58 | match *0, 1, *2: | -error[E701]: E70.py:59:12: Multiple statements on one line (colon) +error[E701]: 59:12: Multiple statements on one line (colon) + --> E70.py:59:12 | 57 | #: E701:2:12 58 | match *0, 1, *2: diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E702_E70.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E702_E70.py.snap index b3c921212b..7117b86837 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E702_E70.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E702_E70.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[E702]: E70.py:6:10: Multiple statements on one line (semicolon) +error[E702]: 6:10: Multiple statements on one line (semicolon) + --> E70.py:6:10 | 4 | if not header or header[:6] != 'bytes=': return 5 | #: E702:1:10 @@ -11,8 +12,9 @@ error[E702]: E70.py:6:10: Multiple statements on one line (semicolon) 7 | #: E702:1:17 8 | import bdist_egg; bdist_egg.write_safety_flag(cmd.egg_info, safe) | -error[E702]: E70.py:8:17: Multiple statements on one line (semicolon) +error[E702]: 8:17: Multiple statements on one line (semicolon) + --> E70.py:8:17 | 6 | a = False; b = True 7 | #: E702:1:17 @@ -21,8 +23,9 @@ error[E702]: E70.py:8:17: Multiple statements on one line (semicolon) 9 | #: E703:1:13 10 | import shlex; | -error[E702]: E70.py:12:9: Multiple statements on one line (semicolon) +error[E702]: 12:9: Multiple statements on one line (semicolon) + --> E70.py:12:9 | 10 | import shlex; 11 | #: E702:1:9 E703:1:23 @@ -31,8 +34,9 @@ error[E702]: E70.py:12:9: Multiple statements on one line (semicolon) 13 | #: E704:1:1 14 | def f(x): return 2 | -error[E702]: E70.py:25:11: Multiple statements on one line (semicolon) +error[E702]: 25:11: Multiple statements on one line (semicolon) + --> E70.py:25:11 | 23 | def f(x): return 2*x 24 | #: E704:1:8 E702:1:11 E703:1:14 @@ -41,8 +45,9 @@ error[E702]: E70.py:25:11: Multiple statements on one line (semicolon) 26 | #: E701:1:8 27 | if True: lambda a: b | -error[E702]: E70.py:54:13: Multiple statements on one line (semicolon) +error[E702]: 54:13: Multiple statements on one line (semicolon) + --> E70.py:54:13 | 52 | def f(): ... 53 | #: E701:1:8 E702:1:13 @@ -51,8 +56,9 @@ error[E702]: E70.py:54:13: Multiple statements on one line (semicolon) 55 | #: E701:1:8 E702:1:13 56 | class C: ...; ... | -error[E702]: E70.py:56:13: Multiple statements on one line (semicolon) +error[E702]: 56:13: Multiple statements on one line (semicolon) + --> E70.py:56:13 | 54 | class C: ...; x = 1 55 | #: E701:1:8 E702:1:13 @@ -61,8 +67,9 @@ error[E702]: E70.py:56:13: Multiple statements on one line (semicolon) 57 | #: E701:2:12 58 | match *0, 1, *2: | -error[E702]: E70.py:65:4: Multiple statements on one line (semicolon) +error[E702]: 65:4: Multiple statements on one line (semicolon) + --> E70.py:65:4 | 63 | #: E702:2:4 64 | while 1: diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E703_E70.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E703_E70.py.snap index 4dced3d04b..53d1b18e96 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E703_E70.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E703_E70.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[E703]: E70.py:10:13: [*] Statement ends with an unnecessary semicolon +error[E703]: 10:13: [*] Statement ends with an unnecessary semicolon + --> E70.py:10:13 | 8 | import bdist_egg; bdist_egg.write_safety_flag(cmd.egg_info, safe) 9 | #: E703:1:13 @@ -22,8 +23,9 @@ error[E703]: E70.py:10:13: [*] Statement ends with an unnecessary semicolon 12 12 | del a[:]; a.append(42); 13 13 | #: E704:1:1 -error[E703]: E70.py:12:23: [*] Statement ends with an unnecessary semicolon +error[E703]: 12:23: [*] Statement ends with an unnecessary semicolon + --> E70.py:12:23 | 10 | import shlex; 11 | #: E702:1:9 E703:1:23 @@ -43,8 +45,9 @@ error[E703]: E70.py:12:23: [*] Statement ends with an unnecessary semicolon 14 14 | def f(x): return 2 15 15 | #: E704:1:1 -error[E703]: E70.py:25:14: [*] Statement ends with an unnecessary semicolon +error[E703]: 25:14: [*] Statement ends with an unnecessary semicolon + --> E70.py:25:14 | 23 | def f(x): return 2*x 24 | #: E704:1:8 E702:1:11 E703:1:14 @@ -64,8 +67,9 @@ error[E703]: E70.py:25:14: [*] Statement ends with an unnecessary semicolon 27 27 | if True: lambda a: b 28 28 | #: E701:1:10 -error[E703]: E70.py:68:1: [*] Statement ends with an unnecessary semicolon +error[E703]: 68:1: [*] Statement ends with an unnecessary semicolon + --> E70.py:67:3 | 66 | #: E703:2:1 67 | 0\ @@ -86,8 +90,9 @@ error[E703]: E70.py:68:1: [*] Statement ends with an unnecessary semicolon 70 69 | a = \ 71 70 | 5; -error[E703]: E70.py:71:4: [*] Statement ends with an unnecessary semicolon +error[E703]: 71:4: [*] Statement ends with an unnecessary semicolon + --> E70.py:71:4 | 69 | #: E701:2:3 70 | a = \ diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E703_E703.ipynb.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E703_E703.ipynb.snap index 86b05dbc3d..c7a3336f91 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E703_E703.ipynb.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E703_E703.ipynb.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[E703]: E703.ipynb:5:2: [*] Statement ends with an unnecessary semicolon +error[E703]: 5:2: [*] Statement ends with an unnecessary semicolon + --> E703.ipynb:5:2 | 3 | x; 4 | # Only skip the last expression @@ -22,8 +23,9 @@ error[E703]: E703.ipynb:5:2: [*] Statement ends with an unnecessary semicolon 7 7 | # Nested expressions isn't relevant 8 8 | if True: -error[E703]: E703.ipynb:9:6: [*] Statement ends with an unnecessary semicolon +error[E703]: 9:6: [*] Statement ends with an unnecessary semicolon + --> E703.ipynb:9:6 | 7 | # Nested expressions isn't relevant 8 | if True: diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E711_E711.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E711_E711.py.snap index b520c86a0a..5136e7e27a 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E711_E711.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E711_E711.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[E711]: E711.py:2:11: [*] Comparison to `None` should be `cond is None` +error[E711]: 2:11: [*] Comparison to `None` should be `cond is None` + --> E711.py:2:11 | 1 | #: E711 2 | if res == None: @@ -19,8 +20,9 @@ error[E711]: E711.py:2:11: [*] Comparison to `None` should be `cond is None` 4 4 | #: E711 5 5 | if res != None: -error[E711]: E711.py:5:11: [*] Comparison to `None` should be `cond is not None` +error[E711]: 5:11: [*] Comparison to `None` should be `cond is not None` + --> E711.py:5:11 | 3 | pass 4 | #: E711 @@ -40,8 +42,9 @@ error[E711]: E711.py:5:11: [*] Comparison to `None` should be `cond is not None` 7 7 | #: E711 8 8 | if None == res: -error[E711]: E711.py:8:4: [*] Comparison to `None` should be `cond is None` +error[E711]: 8:4: [*] Comparison to `None` should be `cond is None` + --> E711.py:8:4 | 6 | pass 7 | #: E711 @@ -61,8 +64,9 @@ error[E711]: E711.py:8:4: [*] Comparison to `None` should be `cond is None` 10 10 | #: E711 11 11 | if None != res: -error[E711]: E711.py:11:4: [*] Comparison to `None` should be `cond is not None` +error[E711]: 11:4: [*] Comparison to `None` should be `cond is not None` + --> E711.py:11:4 | 9 | pass 10 | #: E711 @@ -82,8 +86,9 @@ error[E711]: E711.py:11:4: [*] Comparison to `None` should be `cond is not None` 13 13 | #: E711 14 14 | if res[1] == None: -error[E711]: E711.py:14:14: [*] Comparison to `None` should be `cond is None` +error[E711]: 14:14: [*] Comparison to `None` should be `cond is None` + --> E711.py:14:14 | 12 | pass 13 | #: E711 @@ -103,8 +108,9 @@ error[E711]: E711.py:14:14: [*] Comparison to `None` should be `cond is None` 16 16 | #: E711 17 17 | if res[1] != None: -error[E711]: E711.py:17:14: [*] Comparison to `None` should be `cond is not None` +error[E711]: 17:14: [*] Comparison to `None` should be `cond is not None` + --> E711.py:17:14 | 15 | pass 16 | #: E711 @@ -124,8 +130,9 @@ error[E711]: E711.py:17:14: [*] Comparison to `None` should be `cond is not None 19 19 | #: E711 20 20 | if None != res[1]: -error[E711]: E711.py:20:4: [*] Comparison to `None` should be `cond is not None` +error[E711]: 20:4: [*] Comparison to `None` should be `cond is not None` + --> E711.py:20:4 | 18 | pass 19 | #: E711 @@ -145,8 +152,9 @@ error[E711]: E711.py:20:4: [*] Comparison to `None` should be `cond is not None` 22 22 | #: E711 23 23 | if None == res[1]: -error[E711]: E711.py:23:4: [*] Comparison to `None` should be `cond is None` +error[E711]: 23:4: [*] Comparison to `None` should be `cond is None` + --> E711.py:23:4 | 21 | pass 22 | #: E711 @@ -165,8 +173,9 @@ error[E711]: E711.py:23:4: [*] Comparison to `None` should be `cond is None` 25 25 | 26 26 | if x == None != None: -error[E711]: E711.py:26:9: [*] Comparison to `None` should be `cond is None` +error[E711]: 26:9: [*] Comparison to `None` should be `cond is None` + --> E711.py:26:9 | 24 | pass 25 | @@ -185,8 +194,9 @@ error[E711]: E711.py:26:9: [*] Comparison to `None` should be `cond is None` 28 28 | 29 29 | #: Okay -error[E711]: E711.py:26:17: [*] Comparison to `None` should be `cond is not None` +error[E711]: 26:17: [*] Comparison to `None` should be `cond is not None` + --> E711.py:26:17 | 24 | pass 25 | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E712_E712.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E712_E712.py.snap index ec1458d14c..830ebd35ee 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E712_E712.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E712_E712.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[E712]: E712.py:2:4: [*] Avoid equality comparisons to `True`; use `if res:` for truth checks +error[E712]: 2:4: [*] Avoid equality comparisons to `True`; use `if res:` for truth checks + --> E712.py:2:4 | 1 | #: E712 2 | if res == True: @@ -19,8 +20,9 @@ error[E712]: E712.py:2:4: [*] Avoid equality comparisons to `True`; use `if res: 4 4 | #: E712 5 5 | if res != False: -error[E712]: E712.py:5:4: [*] Avoid inequality comparisons to `False`; use `if res:` for truth checks +error[E712]: 5:4: [*] Avoid inequality comparisons to `False`; use `if res:` for truth checks + --> E712.py:5:4 | 3 | pass 4 | #: E712 @@ -40,8 +42,9 @@ error[E712]: E712.py:5:4: [*] Avoid inequality comparisons to `False`; use `if r 7 7 | #: E712 8 8 | if True != res: -error[E712]: E712.py:8:4: [*] Avoid inequality comparisons to `True`; use `if not res:` for false checks +error[E712]: 8:4: [*] Avoid inequality comparisons to `True`; use `if not res:` for false checks + --> E712.py:8:4 | 6 | pass 7 | #: E712 @@ -61,8 +64,9 @@ error[E712]: E712.py:8:4: [*] Avoid inequality comparisons to `True`; use `if no 10 10 | #: E712 11 11 | if False == res: -error[E712]: E712.py:11:4: [*] Avoid equality comparisons to `False`; use `if not res:` for false checks +error[E712]: 11:4: [*] Avoid equality comparisons to `False`; use `if not res:` for false checks + --> E712.py:11:4 | 9 | pass 10 | #: E712 @@ -82,8 +86,9 @@ error[E712]: E712.py:11:4: [*] Avoid equality comparisons to `False`; use `if no 13 13 | #: E712 14 14 | if res[1] == True: -error[E712]: E712.py:14:4: [*] Avoid equality comparisons to `True`; use `if res[1]:` for truth checks +error[E712]: 14:4: [*] Avoid equality comparisons to `True`; use `if res[1]:` for truth checks + --> E712.py:14:4 | 12 | pass 13 | #: E712 @@ -103,8 +108,9 @@ error[E712]: E712.py:14:4: [*] Avoid equality comparisons to `True`; use `if res 16 16 | #: E712 17 17 | if res[1] != False: -error[E712]: E712.py:17:4: [*] Avoid inequality comparisons to `False`; use `if res[1]:` for truth checks +error[E712]: 17:4: [*] Avoid inequality comparisons to `False`; use `if res[1]:` for truth checks + --> E712.py:17:4 | 15 | pass 16 | #: E712 @@ -124,8 +130,9 @@ error[E712]: E712.py:17:4: [*] Avoid inequality comparisons to `False`; use `if 19 19 | #: E712 20 20 | var = 1 if cond == True else -1 if cond == False else cond -error[E712]: E712.py:20:12: [*] Avoid equality comparisons to `True`; use `if cond:` for truth checks +error[E712]: 20:12: [*] Avoid equality comparisons to `True`; use `if cond:` for truth checks + --> E712.py:20:12 | 18 | pass 19 | #: E712 @@ -145,8 +152,9 @@ error[E712]: E712.py:20:12: [*] Avoid equality comparisons to `True`; use `if co 22 22 | if (True) == TrueElement or x == TrueElement: 23 23 | pass -error[E712]: E712.py:20:36: [*] Avoid equality comparisons to `False`; use `if not cond:` for false checks +error[E712]: 20:36: [*] Avoid equality comparisons to `False`; use `if not cond:` for false checks + --> E712.py:20:36 | 18 | pass 19 | #: E712 @@ -166,8 +174,9 @@ error[E712]: E712.py:20:36: [*] Avoid equality comparisons to `False`; use `if n 22 22 | if (True) == TrueElement or x == TrueElement: 23 23 | pass -error[E712]: E712.py:22:4: [*] Avoid equality comparisons to `True`; use `if TrueElement:` for truth checks +error[E712]: 22:4: [*] Avoid equality comparisons to `True`; use `if TrueElement:` for truth checks + --> E712.py:22:4 | 20 | var = 1 if cond == True else -1 if cond == False else cond 21 | #: E712 @@ -186,8 +195,9 @@ error[E712]: E712.py:22:4: [*] Avoid equality comparisons to `True`; use `if Tru 24 24 | 25 25 | if res == True != False: -error[E712]: E712.py:25:4: [*] Avoid equality comparisons to `True` or `False` +error[E712]: 25:4: [*] Avoid equality comparisons to `True` or `False` + --> E712.py:25:4 | 23 | pass 24 | @@ -206,8 +216,9 @@ error[E712]: E712.py:25:4: [*] Avoid equality comparisons to `True` or `False` 27 27 | 28 28 | if(True) == TrueElement or x == TrueElement: -error[E712]: E712.py:25:4: [*] Avoid equality comparisons to `True` or `False` +error[E712]: 25:4: [*] Avoid equality comparisons to `True` or `False` + --> E712.py:25:4 | 23 | pass 24 | @@ -226,8 +237,9 @@ error[E712]: E712.py:25:4: [*] Avoid equality comparisons to `True` or `False` 27 27 | 28 28 | if(True) == TrueElement or x == TrueElement: -error[E712]: E712.py:28:3: [*] Avoid equality comparisons to `True`; use `if TrueElement:` for truth checks +error[E712]: 28:3: [*] Avoid equality comparisons to `True`; use `if TrueElement:` for truth checks + --> E712.py:28:3 | 26 | pass 27 | @@ -246,8 +258,9 @@ error[E712]: E712.py:28:3: [*] Avoid equality comparisons to `True`; use `if Tru 30 30 | 31 31 | if (yield i) == True: -error[E712]: E712.py:31:4: [*] Avoid equality comparisons to `True`; use `if yield i:` for truth checks +error[E712]: 31:4: [*] Avoid equality comparisons to `True`; use `if yield i:` for truth checks + --> E712.py:31:4 | 29 | pass 30 | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E713_E713.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E713_E713.py.snap index 4e495b9c63..a396d07f26 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E713_E713.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E713_E713.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[E713]: E713.py:2:8: [*] Test for membership should be `not in` +error[E713]: 2:8: [*] Test for membership should be `not in` + --> E713.py:2:8 | 1 | #: E713 2 | if not X in Y: @@ -19,8 +20,9 @@ error[E713]: E713.py:2:8: [*] Test for membership should be `not in` 4 4 | #: E713 5 5 | if not X.B in Y: -error[E713]: E713.py:5:8: [*] Test for membership should be `not in` +error[E713]: 5:8: [*] Test for membership should be `not in` + --> E713.py:5:8 | 3 | pass 4 | #: E713 @@ -40,8 +42,9 @@ error[E713]: E713.py:5:8: [*] Test for membership should be `not in` 7 7 | #: E713 8 8 | if not X in Y and Z == "zero": -error[E713]: E713.py:8:8: [*] Test for membership should be `not in` +error[E713]: 8:8: [*] Test for membership should be `not in` + --> E713.py:8:8 | 6 | pass 7 | #: E713 @@ -61,8 +64,9 @@ error[E713]: E713.py:8:8: [*] Test for membership should be `not in` 10 10 | #: E713 11 11 | if X == "zero" or not Y in Z: -error[E713]: E713.py:11:23: [*] Test for membership should be `not in` +error[E713]: 11:23: [*] Test for membership should be `not in` + --> E713.py:11:23 | 9 | pass 10 | #: E713 @@ -82,8 +86,9 @@ error[E713]: E713.py:11:23: [*] Test for membership should be `not in` 13 13 | #: E713 14 14 | if not (X in Y): -error[E713]: E713.py:14:9: [*] Test for membership should be `not in` +error[E713]: 14:9: [*] Test for membership should be `not in` + --> E713.py:14:9 | 12 | pass 13 | #: E713 @@ -102,8 +107,9 @@ error[E713]: E713.py:14:9: [*] Test for membership should be `not in` 16 16 | 17 17 | #: Okay -error[E713]: E713.py:40:12: [*] Test for membership should be `not in` +error[E713]: 40:12: [*] Test for membership should be `not in` + --> E713.py:40:12 | 38 | assert [42, not foo] in bar 39 | assert not (re.search(r"^.:\\Users\\[^\\]*\\Downloads\\.*") is None) diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E714_E714.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E714_E714.py.snap index 1fc868b25d..855c4cf0b5 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E714_E714.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E714_E714.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[E714]: E714.py:2:8: [*] Test for object identity should be `is not` +error[E714]: 2:8: [*] Test for object identity should be `is not` + --> E714.py:2:8 | 1 | #: E714 2 | if not X is Y: @@ -19,8 +20,9 @@ error[E714]: E714.py:2:8: [*] Test for object identity should be `is not` 4 4 | #: E714 5 5 | if not X.B is Y: -error[E714]: E714.py:5:8: [*] Test for object identity should be `is not` +error[E714]: 5:8: [*] Test for object identity should be `is not` + --> E714.py:5:8 | 3 | pass 4 | #: E714 @@ -39,8 +41,9 @@ error[E714]: E714.py:5:8: [*] Test for object identity should be `is not` 7 7 | 8 8 | #: Okay -error[E714]: E714.py:39:13: [*] Test for object identity should be `is not` +error[E714]: 39:13: [*] Test for object identity should be `is not` + --> E714.py:39:13 | 37 | assert {"x": not foo} in bar 38 | assert [42, not foo] in bar diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E721_E721.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E721_E721.py.snap index 6d167b4801..104118523b 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E721_E721.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E721_E721.py.snap @@ -1,158 +1,175 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -E721.py:2:4: E721 Use `is` and `is not` for type comparisons, or `isinstance()` for isinstance checks +error[E721]: 2:4: Use `is` and `is not` for type comparisons, or `isinstance()` for isinstance checks + + --> E721.py:2:4 | 1 | #: E721 2 | if type(res) == type(42): - | ^^^^^^^^^^^^^^^^^^^^^ E721 + | ^^^^^^^^^^^^^^^^^^^^^ 3 | pass 4 | #: E721 | +error[E721]: 5:4: Use `is` and `is not` for type comparisons, or `isinstance()` for isinstance checks -E721.py:5:4: E721 Use `is` and `is not` for type comparisons, or `isinstance()` for isinstance checks + --> E721.py:5:4 | 3 | pass 4 | #: E721 5 | if type(res) != type(""): - | ^^^^^^^^^^^^^^^^^^^^^ E721 + | ^^^^^^^^^^^^^^^^^^^^^ 6 | pass 7 | #: E721 | +error[E721]: 8:4: Use `is` and `is not` for type comparisons, or `isinstance()` for isinstance checks -E721.py:8:4: E721 Use `is` and `is not` for type comparisons, or `isinstance()` for isinstance checks + --> E721.py:8:4 | 6 | pass 7 | #: E721 8 | if type(res) == memoryview: - | ^^^^^^^^^^^^^^^^^^^^^^^ E721 + | ^^^^^^^^^^^^^^^^^^^^^^^ 9 | pass 10 | #: Okay | +error[E721]: 21:8: Use `is` and `is not` for type comparisons, or `isinstance()` for isinstance checks -E721.py:21:8: E721 Use `is` and `is not` for type comparisons, or `isinstance()` for isinstance checks + --> E721.py:21:8 | 19 | pass 20 | #: E721 21 | assert type(res) == type(False) or type(res) == type(None) - | ^^^^^^^^^^^^^^^^^^^^^^^^ E721 + | ^^^^^^^^^^^^^^^^^^^^^^^^ 22 | #: E721 23 | assert type(res) == type([]) | +error[E721]: 21:36: Use `is` and `is not` for type comparisons, or `isinstance()` for isinstance checks -E721.py:21:36: E721 Use `is` and `is not` for type comparisons, or `isinstance()` for isinstance checks + --> E721.py:21:36 | 19 | pass 20 | #: E721 21 | assert type(res) == type(False) or type(res) == type(None) - | ^^^^^^^^^^^^^^^^^^^^^^^ E721 + | ^^^^^^^^^^^^^^^^^^^^^^^ 22 | #: E721 23 | assert type(res) == type([]) | +error[E721]: 23:8: Use `is` and `is not` for type comparisons, or `isinstance()` for isinstance checks -E721.py:23:8: E721 Use `is` and `is not` for type comparisons, or `isinstance()` for isinstance checks + --> E721.py:23:8 | 21 | assert type(res) == type(False) or type(res) == type(None) 22 | #: E721 23 | assert type(res) == type([]) - | ^^^^^^^^^^^^^^^^^^^^^ E721 + | ^^^^^^^^^^^^^^^^^^^^^ 24 | #: E721 25 | assert type(res) == type(()) | +error[E721]: 25:8: Use `is` and `is not` for type comparisons, or `isinstance()` for isinstance checks -E721.py:25:8: E721 Use `is` and `is not` for type comparisons, or `isinstance()` for isinstance checks + --> E721.py:25:8 | 23 | assert type(res) == type([]) 24 | #: E721 25 | assert type(res) == type(()) - | ^^^^^^^^^^^^^^^^^^^^^ E721 + | ^^^^^^^^^^^^^^^^^^^^^ 26 | #: E721 27 | assert type(res) == type((0,)) | +error[E721]: 27:8: Use `is` and `is not` for type comparisons, or `isinstance()` for isinstance checks -E721.py:27:8: E721 Use `is` and `is not` for type comparisons, or `isinstance()` for isinstance checks + --> E721.py:27:8 | 25 | assert type(res) == type(()) 26 | #: E721 27 | assert type(res) == type((0,)) - | ^^^^^^^^^^^^^^^^^^^^^^^ E721 + | ^^^^^^^^^^^^^^^^^^^^^^^ 28 | #: E721 29 | assert type(res) == type((0)) | +error[E721]: 29:8: Use `is` and `is not` for type comparisons, or `isinstance()` for isinstance checks -E721.py:29:8: E721 Use `is` and `is not` for type comparisons, or `isinstance()` for isinstance checks + --> E721.py:29:8 | 27 | assert type(res) == type((0,)) 28 | #: E721 29 | assert type(res) == type((0)) - | ^^^^^^^^^^^^^^^^^^^^^^ E721 + | ^^^^^^^^^^^^^^^^^^^^^^ 30 | #: E721 31 | assert type(res) != type((1, )) | +error[E721]: 31:8: Use `is` and `is not` for type comparisons, or `isinstance()` for isinstance checks -E721.py:31:8: E721 Use `is` and `is not` for type comparisons, or `isinstance()` for isinstance checks + --> E721.py:31:8 | 29 | assert type(res) == type((0)) 30 | #: E721 31 | assert type(res) != type((1, )) - | ^^^^^^^^^^^^^^^^^^^^^^^^ E721 + | ^^^^^^^^^^^^^^^^^^^^^^^^ 32 | #: Okay 33 | assert type(res) is type((1, )) | +error[E721]: 37:8: Use `is` and `is not` for type comparisons, or `isinstance()` for isinstance checks -E721.py:37:8: E721 Use `is` and `is not` for type comparisons, or `isinstance()` for isinstance checks + --> E721.py:37:8 | 35 | assert type(res) is not type((1, )) 36 | #: E211 E721 37 | assert type(res) == type ([2, ]) - | ^^^^^^^^^^^^^^^^^^^^^^^^^ E721 + | ^^^^^^^^^^^^^^^^^^^^^^^^^ 38 | #: E201 E201 E202 E721 39 | assert type(res) == type( ( ) ) | +error[E721]: 39:8: Use `is` and `is not` for type comparisons, or `isinstance()` for isinstance checks -E721.py:39:8: E721 Use `is` and `is not` for type comparisons, or `isinstance()` for isinstance checks + --> E721.py:39:8 | 37 | assert type(res) == type ([2, ]) 38 | #: E201 E201 E202 E721 39 | assert type(res) == type( ( ) ) - | ^^^^^^^^^^^^^^^^^^^^^^^^ E721 + | ^^^^^^^^^^^^^^^^^^^^^^^^ 40 | #: E201 E202 E721 41 | assert type(res) == type( (0, ) ) | +error[E721]: 41:8: Use `is` and `is not` for type comparisons, or `isinstance()` for isinstance checks -E721.py:41:8: E721 Use `is` and `is not` for type comparisons, or `isinstance()` for isinstance checks + --> E721.py:41:8 | 39 | assert type(res) == type( ( ) ) 40 | #: E201 E202 E721 41 | assert type(res) == type( (0, ) ) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ E721 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ 42 | #: | +error[E721]: 59:4: Use `is` and `is not` for type comparisons, or `isinstance()` for isinstance checks -E721.py:59:4: E721 Use `is` and `is not` for type comparisons, or `isinstance()` for isinstance checks + --> E721.py:59:4 | 57 | pass 58 | #: E721 59 | if type(res) == type: - | ^^^^^^^^^^^^^^^^^ E721 + | ^^^^^^^^^^^^^^^^^ 60 | pass 61 | #: Okay | +error[E721]: 140:1: Use `is` and `is not` for type comparisons, or `isinstance()` for isinstance checks -E721.py:140:1: E721 Use `is` and `is not` for type comparisons, or `isinstance()` for isinstance checks + --> E721.py:139:8 | 139 | #: E721 140 | dtype == float - | ^^^^^^^^^^^^^^ E721 + | ^^^^^^^^^^^^^^ 141 | 142 | import builtins | +error[E721]: 144:4: Use `is` and `is not` for type comparisons, or `isinstance()` for isinstance checks -E721.py:144:4: E721 Use `is` and `is not` for type comparisons, or `isinstance()` for isinstance checks + --> E721.py:144:4 | 142 | import builtins 143 | 144 | if builtins.type(res) == memoryview: # E721 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ E721 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 145 | pass | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E722_E722.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E722_E722.py.snap index e6393f23cf..d564593c7b 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E722_E722.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E722_E722.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[E722]: E722.py:4:1: Do not use bare `except` +error[E722]: 4:1: Do not use bare `except` + --> E722.py:3:9 | 2 | try: 3 | pass @@ -11,8 +12,9 @@ error[E722]: E722.py:4:1: Do not use bare `except` 5 | pass 6 | #: E722 | -error[E722]: E722.py:11:1: Do not use bare `except` +error[E722]: 11:1: Do not use bare `except` + --> E722.py:10:9 | 9 | except Exception: 10 | pass @@ -21,8 +23,9 @@ error[E722]: E722.py:11:1: Do not use bare `except` 12 | pass 13 | #: E722 | -error[E722]: E722.py:16:1: Do not use bare `except` +error[E722]: 16:1: Do not use bare `except` + --> E722.py:15:9 | 14 | try: 15 | pass diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E731_E731.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E731_E731.py.snap index e9cdd9ea19..f541df60e2 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E731_E731.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E731_E731.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[E731]: E731.py:3:5: [*] Do not assign a `lambda` expression, use a `def` +error[E731]: 3:5: [*] Do not assign a `lambda` expression, use a `def` + --> E731.py:3:5 | 1 | def scope(): 2 | # E731 @@ -20,8 +21,9 @@ error[E731]: E731.py:3:5: [*] Do not assign a `lambda` expression, use a `def` 5 6 | 6 7 | def scope(): -error[E731]: E731.py:8:5: [*] Do not assign a `lambda` expression, use a `def` +error[E731]: 8:5: [*] Do not assign a `lambda` expression, use a `def` + --> E731.py:8:5 | 6 | def scope(): 7 | # E731 @@ -40,8 +42,9 @@ error[E731]: E731.py:8:5: [*] Do not assign a `lambda` expression, use a `def` 10 11 | 11 12 | def scope(): -error[E731]: E731.py:14:9: [*] Do not assign a `lambda` expression, use a `def` +error[E731]: 14:9: [*] Do not assign a `lambda` expression, use a `def` + --> E731.py:14:9 | 12 | # E731 13 | while False: @@ -60,8 +63,9 @@ error[E731]: E731.py:14:9: [*] Do not assign a `lambda` expression, use a `def` 16 17 | 17 18 | def scope(): -error[E731]: E731.py:19:5: [*] Do not assign a `lambda` expression, use a `def` +error[E731]: 19:5: [*] Do not assign a `lambda` expression, use a `def` + --> E731.py:19:5 | 17 | def scope(): 18 | # E731 @@ -80,8 +84,9 @@ error[E731]: E731.py:19:5: [*] Do not assign a `lambda` expression, use a `def` 21 22 | 22 23 | def scope(): -error[E731]: E731.py:24:5: [*] Do not assign a `lambda` expression, use a `def` +error[E731]: 24:5: [*] Do not assign a `lambda` expression, use a `def` + --> E731.py:24:5 | 22 | def scope(): 23 | # E731 @@ -100,8 +105,9 @@ error[E731]: E731.py:24:5: [*] Do not assign a `lambda` expression, use a `def` 26 27 | 27 28 | def scope(): -error[E731]: E731.py:57:5: Do not assign a `lambda` expression, use a `def` +error[E731]: 57:5: Do not assign a `lambda` expression, use a `def` + --> E731.py:57:5 | 55 | class Scope: 56 | # E731 @@ -120,8 +126,9 @@ error[E731]: E731.py:57:5: Do not assign a `lambda` expression, use a `def` 59 60 | 60 61 | class Scope: -error[E731]: E731.py:73:9: Do not assign a `lambda` expression, use a `def` +error[E731]: 73:9: Do not assign a `lambda` expression, use a `def` + --> E731.py:73:9 | 71 | x: Callable[[int], int] 72 | if True: @@ -142,8 +149,9 @@ error[E731]: E731.py:73:9: Do not assign a `lambda` expression, use a `def` 75 76 | x = lambda: 2 76 77 | return x -error[E731]: E731.py:75:9: Do not assign a `lambda` expression, use a `def` +error[E731]: 75:9: Do not assign a `lambda` expression, use a `def` + --> E731.py:75:9 | 73 | x = lambda: 1 74 | else: @@ -163,8 +171,9 @@ error[E731]: E731.py:75:9: Do not assign a `lambda` expression, use a `def` 77 78 | 78 79 | -error[E731]: E731.py:86:5: [*] Do not assign a `lambda` expression, use a `def` +error[E731]: 86:5: [*] Do not assign a `lambda` expression, use a `def` + --> E731.py:86:5 | 84 | # ParamSpec cannot be used in this context, so do not preserve the annotation. 85 | P = ParamSpec("P") @@ -183,8 +192,9 @@ error[E731]: E731.py:86:5: [*] Do not assign a `lambda` expression, use a `def` 88 89 | 89 90 | def scope(): -error[E731]: E731.py:94:5: [*] Do not assign a `lambda` expression, use a `def` +error[E731]: 94:5: [*] Do not assign a `lambda` expression, use a `def` + --> E731.py:94:5 | 92 | from typing import Callable 93 | @@ -203,8 +213,9 @@ error[E731]: E731.py:94:5: [*] Do not assign a `lambda` expression, use a `def` 96 97 | 97 98 | def scope(): -error[E731]: E731.py:102:5: [*] Do not assign a `lambda` expression, use a `def` +error[E731]: 102:5: [*] Do not assign a `lambda` expression, use a `def` + --> E731.py:102:5 | 100 | from typing import Callable 101 | @@ -223,8 +234,9 @@ error[E731]: E731.py:102:5: [*] Do not assign a `lambda` expression, use a `def` 104 105 | 105 106 | def scope(): -error[E731]: E731.py:110:5: [*] Do not assign a `lambda` expression, use a `def` +error[E731]: 110:5: [*] Do not assign a `lambda` expression, use a `def` + --> E731.py:110:5 | 108 | from typing import Callable 109 | @@ -243,8 +255,9 @@ error[E731]: E731.py:110:5: [*] Do not assign a `lambda` expression, use a `def` 112 113 | 113 114 | # Let's use the `Callable` type from `collections.abc` instead. -error[E731]: E731.py:119:5: [*] Do not assign a `lambda` expression, use a `def` +error[E731]: 119:5: [*] Do not assign a `lambda` expression, use a `def` + --> E731.py:119:5 | 117 | from collections.abc import Callable 118 | @@ -263,8 +276,9 @@ error[E731]: E731.py:119:5: [*] Do not assign a `lambda` expression, use a `def` 121 122 | 122 123 | def scope(): -error[E731]: E731.py:127:5: [*] Do not assign a `lambda` expression, use a `def` +error[E731]: 127:5: [*] Do not assign a `lambda` expression, use a `def` + --> E731.py:127:5 | 125 | from collections.abc import Callable 126 | @@ -283,8 +297,9 @@ error[E731]: E731.py:127:5: [*] Do not assign a `lambda` expression, use a `def` 129 130 | 130 131 | def scope(): -error[E731]: E731.py:135:5: [*] Do not assign a `lambda` expression, use a `def` +error[E731]: 135:5: [*] Do not assign a `lambda` expression, use a `def` + --> E731.py:135:5 | 133 | from collections.abc import Callable 134 | @@ -303,8 +318,9 @@ error[E731]: E731.py:135:5: [*] Do not assign a `lambda` expression, use a `def` 137 138 | 138 139 | class TemperatureScales(Enum): -error[E731]: E731.py:139:5: Do not assign a `lambda` expression, use a `def` +error[E731]: 139:5: Do not assign a `lambda` expression, use a `def` + --> E731.py:139:5 | 138 | class TemperatureScales(Enum): 139 | CELSIUS = (lambda deg_c: deg_c) @@ -323,8 +339,9 @@ error[E731]: E731.py:139:5: Do not assign a `lambda` expression, use a `def` 141 142 | 142 143 | -error[E731]: E731.py:140:5: Do not assign a `lambda` expression, use a `def` +error[E731]: 140:5: Do not assign a `lambda` expression, use a `def` + --> E731.py:140:5 | 138 | class TemperatureScales(Enum): 139 | CELSIUS = (lambda deg_c: deg_c) @@ -343,8 +360,9 @@ error[E731]: E731.py:140:5: Do not assign a `lambda` expression, use a `def` 142 143 | 143 144 | # Regression test for: https://github.com/astral-sh/ruff/issues/7141 -error[E731]: E731.py:147:5: [*] Do not assign a `lambda` expression, use a `def` +error[E731]: 147:5: [*] Do not assign a `lambda` expression, use a `def` + --> E731.py:147:5 | 145 | # E731 146 | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E741_E741.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E741_E741.py.snap index 52223d03c9..82ae57f532 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E741_E741.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E741_E741.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[E741]: E741.py:3:1: Ambiguous variable name: `l` +error[E741]: 3:1: Ambiguous variable name: `l` + --> E741.py:2:1 | 1 | from contextlib import contextmanager 2 | @@ -11,8 +12,9 @@ error[E741]: E741.py:3:1: Ambiguous variable name: `l` 4 | I = 0 5 | O = 0 | -error[E741]: E741.py:4:1: Ambiguous variable name: `I` +error[E741]: 4:1: Ambiguous variable name: `I` + --> E741.py:3:6 | 3 | l = 0 4 | I = 0 @@ -20,8 +22,9 @@ error[E741]: E741.py:4:1: Ambiguous variable name: `I` 5 | O = 0 6 | l: int = 0 | -error[E741]: E741.py:5:1: Ambiguous variable name: `O` +error[E741]: 5:1: Ambiguous variable name: `O` + --> E741.py:4:6 | 3 | l = 0 4 | I = 0 @@ -29,8 +32,9 @@ error[E741]: E741.py:5:1: Ambiguous variable name: `O` | ^ 6 | l: int = 0 | -error[E741]: E741.py:6:1: Ambiguous variable name: `l` +error[E741]: 6:1: Ambiguous variable name: `l` + --> E741.py:5:6 | 4 | I = 0 5 | O = 0 @@ -39,8 +43,9 @@ error[E741]: E741.py:6:1: Ambiguous variable name: `l` 7 | 8 | a, l = 0, 1 | -error[E741]: E741.py:8:4: Ambiguous variable name: `l` +error[E741]: 8:4: Ambiguous variable name: `l` + --> E741.py:8:4 | 6 | l: int = 0 7 | @@ -49,8 +54,9 @@ error[E741]: E741.py:8:4: Ambiguous variable name: `l` 9 | [a, l] = 0, 1 10 | a, *l = 0, 1, 2 | -error[E741]: E741.py:9:5: Ambiguous variable name: `l` +error[E741]: 9:5: Ambiguous variable name: `l` + --> E741.py:9:5 | 8 | a, l = 0, 1 9 | [a, l] = 0, 1 @@ -58,8 +64,9 @@ error[E741]: E741.py:9:5: Ambiguous variable name: `l` 10 | a, *l = 0, 1, 2 11 | a = l = 0 | -error[E741]: E741.py:10:5: Ambiguous variable name: `l` +error[E741]: 10:5: Ambiguous variable name: `l` + --> E741.py:10:5 | 8 | a, l = 0, 1 9 | [a, l] = 0, 1 @@ -67,8 +74,9 @@ error[E741]: E741.py:10:5: Ambiguous variable name: `l` | ^ 11 | a = l = 0 | -error[E741]: E741.py:11:5: Ambiguous variable name: `l` +error[E741]: 11:5: Ambiguous variable name: `l` + --> E741.py:11:5 | 9 | [a, l] = 0, 1 10 | a, *l = 0, 1, 2 @@ -77,8 +85,9 @@ error[E741]: E741.py:11:5: Ambiguous variable name: `l` 12 | 13 | o = 0 | -error[E741]: E741.py:16:5: Ambiguous variable name: `l` +error[E741]: 16:5: Ambiguous variable name: `l` + --> E741.py:16:5 | 14 | i = 0 15 | @@ -86,31 +95,35 @@ error[E741]: E741.py:16:5: Ambiguous variable name: `l` | ^ 17 | pass | -error[E741]: E741.py:20:8: Ambiguous variable name: `l` +error[E741]: 20:8: Ambiguous variable name: `l` + --> E741.py:20:8 | 20 | for a, l in zip(range(3), range(3)): | ^ 21 | pass | -error[E741]: E741.py:25:12: Ambiguous variable name: `l` +error[E741]: 25:12: Ambiguous variable name: `l` + --> E741.py:25:12 | 24 | def f1(): 25 | global l | ^ 26 | l = 0 | -error[E741]: E741.py:26:5: Ambiguous variable name: `l` +error[E741]: 26:5: Ambiguous variable name: `l` + --> E741.py:26:5 | 24 | def f1(): 25 | global l 26 | l = 0 | ^ | -error[E741]: E741.py:30:5: Ambiguous variable name: `l` +error[E741]: 30:5: Ambiguous variable name: `l` + --> E741.py:30:5 | 29 | def f2(): 30 | l = 0 @@ -118,16 +131,18 @@ error[E741]: E741.py:30:5: Ambiguous variable name: `l` 31 | 32 | def f3(): | -error[E741]: E741.py:33:18: Ambiguous variable name: `l` +error[E741]: 33:18: Ambiguous variable name: `l` + --> E741.py:33:18 | 32 | def f3(): 33 | nonlocal l | ^ 34 | l = 1 | -error[E741]: E741.py:34:9: Ambiguous variable name: `l` +error[E741]: 34:9: Ambiguous variable name: `l` + --> E741.py:34:9 | 32 | def f3(): 33 | nonlocal l @@ -136,64 +151,73 @@ error[E741]: E741.py:34:9: Ambiguous variable name: `l` 35 | 36 | f3() | -error[E741]: E741.py:40:8: Ambiguous variable name: `l` +error[E741]: 40:8: Ambiguous variable name: `l` + --> E741.py:40:8 | 40 | def f4(l, /, I): | ^ 41 | return l, I, O | -error[E741]: E741.py:40:14: Ambiguous variable name: `I` +error[E741]: 40:14: Ambiguous variable name: `I` + --> E741.py:40:14 | 40 | def f4(l, /, I): | ^ 41 | return l, I, O | -error[E741]: E741.py:44:8: Ambiguous variable name: `l` +error[E741]: 44:8: Ambiguous variable name: `l` + --> E741.py:44:8 | 44 | def f5(l=0, *, I=1): | ^ 45 | return l, I | -error[E741]: E741.py:44:16: Ambiguous variable name: `I` +error[E741]: 44:16: Ambiguous variable name: `I` + --> E741.py:44:16 | 44 | def f5(l=0, *, I=1): | ^ 45 | return l, I | -error[E741]: E741.py:48:9: Ambiguous variable name: `l` +error[E741]: 48:9: Ambiguous variable name: `l` + --> E741.py:48:9 | 48 | def f6(*l, **I): | ^ 49 | return l, I | -error[E741]: E741.py:48:14: Ambiguous variable name: `I` +error[E741]: 48:14: Ambiguous variable name: `I` + --> E741.py:48:14 | 48 | def f6(*l, **I): | ^ 49 | return l, I | -error[E741]: E741.py:57:16: Ambiguous variable name: `l` +error[E741]: 57:16: Ambiguous variable name: `l` + --> E741.py:57:16 | 57 | with ctx1() as l: | ^ 58 | pass | -error[E741]: E741.py:66:20: Ambiguous variable name: `l` +error[E741]: 66:20: Ambiguous variable name: `l` + --> E741.py:66:20 | 66 | with ctx2() as (a, l): | ^ 67 | pass | -error[E741]: E741.py:71:22: Ambiguous variable name: `l` +error[E741]: 71:22: Ambiguous variable name: `l` + --> E741.py:71:22 | 69 | try: 70 | pass @@ -201,8 +225,9 @@ error[E741]: E741.py:71:22: Ambiguous variable name: `l` | ^ 72 | pass | -error[E741]: E741.py:74:5: Ambiguous variable name: `l` +error[E741]: 74:5: Ambiguous variable name: `l` + --> E741.py:74:5 | 72 | pass 73 | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E742_E742.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E742_E742.py.snap index 6746062b7a..060c57d66c 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E742_E742.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E742_E742.py.snap @@ -1,22 +1,25 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[E742]: E742.py:1:7: Ambiguous class name: `l` +error[E742]: 1:7: Ambiguous class name: `l` + --> E742.py:1:7 | 1 | class l: | ^ 2 | pass | -error[E742]: E742.py:5:7: Ambiguous class name: `I` +error[E742]: 5:7: Ambiguous class name: `I` + --> E742.py:5:7 | 5 | class I: | ^ 6 | pass | -error[E742]: E742.py:9:7: Ambiguous class name: `O` +error[E742]: 9:7: Ambiguous class name: `O` + --> E742.py:9:7 | 9 | class O: | ^ diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E743_E743.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E743_E743.py.snap index 79a10cbfaf..fc044bd8fc 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E743_E743.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E743_E743.py.snap @@ -1,22 +1,25 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[E743]: E743.py:1:5: Ambiguous function name: `l` +error[E743]: 1:5: Ambiguous function name: `l` + --> E743.py:1:5 | 1 | def l(): | ^ 2 | pass | -error[E743]: E743.py:5:5: Ambiguous function name: `I` +error[E743]: 5:5: Ambiguous function name: `I` + --> E743.py:5:5 | 5 | def I(): | ^ 6 | pass | -error[E743]: E743.py:10:9: Ambiguous function name: `O` +error[E743]: 10:9: Ambiguous function name: `O` + --> E743.py:10:9 | 9 | class X: 10 | def O(self): diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W191_W19.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W191_W19.py.snap index a47fc90aff..768f1f4d6e 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W191_W19.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W191_W19.py.snap @@ -1,21 +1,25 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -W19.py:1:1: W191 Indentation contains tabs - | -1 | '''File starts with a tab - | ^^^^ W191 -2 | multiline string with tab in it''' - | +error[W191]: 1:1: Indentation contains tabs -W19.py:1:1: SyntaxError: Unexpected indentation + --> W19.py:1:1 | 1 | '''File starts with a tab | ^^^^ 2 | multiline string with tab in it''' | +error[syntax-error]: 1:1: Unexpected indentation -W19.py:5:1: SyntaxError: Expected a statement + --> W19.py:1:1 + | +1 | '''File starts with a tab + | ^^^^ +2 | multiline string with tab in it''' + | +error[syntax-error]: 5:1: Expected a statement + + --> W19.py:4:8 | 4 | #: W191 5 | if False: @@ -23,360 +27,397 @@ W19.py:5:1: SyntaxError: Expected a statement 6 | print # indented with 1 tab 7 | #: | +error[W191]: 6:1: Indentation contains tabs -W19.py:6:1: W191 Indentation contains tabs + --> W19.py:5:10 | 4 | #: W191 5 | if False: 6 | print # indented with 1 tab - | ^^^^ W191 + | ^^^^ 7 | #: | +error[W191]: 12:1: Indentation contains tabs -W19.py:12:1: W191 Indentation contains tabs + --> W19.py:11:13 | 10 | #: W191 11 | y = x == 2 \ 12 | or x == 3 - | ^^^^ W191 + | ^^^^ 13 | #: E101 W191 W504 14 | if ( | +error[W191]: 19:1: Indentation contains tabs -W19.py:19:1: W191 Indentation contains tabs + --> W19.py:18:17 | 17 | ) or 18 | y == 4): 19 | pass - | ^^^^ W191 + | ^^^^ 20 | #: E101 W191 21 | if x == 2 \ | +error[W191]: 24:1: Indentation contains tabs -W19.py:24:1: W191 Indentation contains tabs + --> W19.py:23:19 | 22 | or y > 1 \ 23 | or x == 3: 24 | pass - | ^^^^ W191 + | ^^^^ 25 | #: E101 W191 26 | if x == 2 \ | +error[W191]: 29:1: Indentation contains tabs -W19.py:29:1: W191 Indentation contains tabs + --> W19.py:28:19 | 27 | or y > 1 \ 28 | or x == 3: 29 | pass - | ^^^^ W191 + | ^^^^ 30 | #: | +error[W191]: 35:1: Indentation contains tabs -W19.py:35:1: W191 Indentation contains tabs + --> W19.py:34:21 | 33 | if (foo == bar and 34 | baz == bop): 35 | pass - | ^^^^ W191 + | ^^^^ 36 | #: E101 W191 W504 37 | if ( | +error[W191]: 41:1: Indentation contains tabs -W19.py:41:1: W191 Indentation contains tabs + --> W19.py:40:3 | 39 | baz == bop 40 | ): 41 | pass - | ^^^^ W191 + | ^^^^ 42 | #: | +error[W191]: 47:1: Indentation contains tabs -W19.py:47:1: W191 Indentation contains tabs + --> W19.py:46:43 | 45 | if start[1] > end_col and not ( 46 | over_indent == 4 and indent_next): 47 | return (0, "E121 continuation line over-" - | ^^^^ W191 + | ^^^^ 48 | "indented for visual indent") 49 | #: | +error[W191]: 48:1: Indentation contains tabs -W19.py:48:1: W191 Indentation contains tabs + --> W19.py:47:46 | 46 | over_indent == 4 and indent_next): 47 | return (0, "E121 continuation line over-" 48 | "indented for visual indent") - | ^^^^^^^^^^^^ W191 + | ^^^^^^^^^^^^ 49 | #: | +error[W191]: 57:1: Indentation contains tabs -W19.py:57:1: W191 Indentation contains tabs + --> W19.py:56:19 | 55 | var_one, var_two, var_three, 56 | var_four): 57 | print(var_one) - | ^^^^ W191 + | ^^^^ 58 | #: E101 W191 W504 59 | if ((row < 0 or self.moduleCount <= row or | +error[W191]: 61:1: Indentation contains tabs -W19.py:61:1: W191 Indentation contains tabs + --> W19.py:60:43 | 59 | if ((row < 0 or self.moduleCount <= row or 60 | col < 0 or self.moduleCount <= col)): 61 | raise Exception("%s,%s - %s" % (row, col, self.moduleCount)) - | ^^^^ W191 + | ^^^^ 62 | #: E101 E101 E101 E101 W191 W191 W191 W191 W191 W191 63 | if bar: | +error[W191]: 64:1: Indentation contains tabs -W19.py:64:1: W191 Indentation contains tabs + --> W19.py:63:8 | 62 | #: E101 E101 E101 E101 W191 W191 W191 W191 W191 W191 63 | if bar: 64 | return ( - | ^^^^ W191 + | ^^^^ 65 | start, 'E121 lines starting with a ' 66 | 'closing bracket should be indented ' | +error[W191]: 65:1: Indentation contains tabs -W19.py:65:1: W191 Indentation contains tabs + --> W19.py:64:13 | 63 | if bar: 64 | return ( 65 | start, 'E121 lines starting with a ' - | ^^^^^^^^ W191 + | ^^^^^^^^ 66 | 'closing bracket should be indented ' 67 | "to match that of the opening " | +error[W191]: 66:1: Indentation contains tabs -W19.py:66:1: W191 Indentation contains tabs + --> W19.py:65:45 | 64 | return ( 65 | start, 'E121 lines starting with a ' 66 | 'closing bracket should be indented ' - | ^^^^^^^^ W191 + | ^^^^^^^^ 67 | "to match that of the opening " 68 | "bracket's line" | +error[W191]: 67:1: Indentation contains tabs -W19.py:67:1: W191 Indentation contains tabs + --> W19.py:66:46 | 65 | start, 'E121 lines starting with a ' 66 | 'closing bracket should be indented ' 67 | "to match that of the opening " - | ^^^^^^^^ W191 + | ^^^^^^^^ 68 | "bracket's line" 69 | ) | +error[W191]: 68:1: Indentation contains tabs -W19.py:68:1: W191 Indentation contains tabs + --> W19.py:67:40 | 66 | 'closing bracket should be indented ' 67 | "to match that of the opening " 68 | "bracket's line" - | ^^^^^^^^ W191 + | ^^^^^^^^ 69 | ) 70 | # | +error[W191]: 69:1: Indentation contains tabs -W19.py:69:1: W191 Indentation contains tabs + --> W19.py:68:25 | 67 | "to match that of the opening " 68 | "bracket's line" 69 | ) - | ^^^^ W191 + | ^^^^ 70 | # 71 | #: E101 W191 W504 | +error[W191]: 76:1: Indentation contains tabs -W19.py:76:1: W191 Indentation contains tabs + --> W19.py:75:9 | 74 | foo.bar("bop") 75 | )): 76 | print("yes") - | ^^^^ W191 + | ^^^^ 77 | #: E101 W191 W504 78 | # also ok, but starting to look like LISP | +error[W191]: 81:1: Indentation contains tabs -W19.py:81:1: W191 Indentation contains tabs + --> W19.py:80:23 | 79 | if ((foo.bar("baz") and 80 | foo.bar("bop"))): 81 | print("yes") - | ^^^^ W191 + | ^^^^ 82 | #: E101 W191 W504 83 | if (a == 2 or | +error[W191]: 86:1: Indentation contains tabs -W19.py:86:1: W191 Indentation contains tabs + --> W19.py:85:21 | 84 | b == "abc def ghi" 85 | "jkl mno"): 86 | return True - | ^^^^ W191 + | ^^^^ 87 | #: E101 W191 W504 88 | if (a == 2 or | +error[W191]: 91:1: Indentation contains tabs -W19.py:91:1: W191 Indentation contains tabs + --> W19.py:90:13 | 89 | b == """abc def ghi 90 | jkl mno"""): 91 | return True - | ^^^^ W191 + | ^^^^ 92 | #: W191:2:1 W191:3:1 E101:3:2 93 | if length > options.max_line_length: | +error[W191]: 94:1: Indentation contains tabs -W19.py:94:1: W191 Indentation contains tabs + --> W19.py:93:37 | 92 | #: W191:2:1 W191:3:1 E101:3:2 93 | if length > options.max_line_length: 94 | return options.max_line_length, \ - | ^^^^ W191 + | ^^^^ 95 | "E501 line too long (%d characters)" % length | +error[W191]: 95:1: Indentation contains tabs -W19.py:95:1: W191 Indentation contains tabs + --> W19.py:94:38 | 93 | if length > options.max_line_length: 94 | return options.max_line_length, \ 95 | "E501 line too long (%d characters)" % length - | ^^^^^^^^ W191 + | ^^^^^^^^ | +error[W191]: 101:1: Indentation contains tabs -W19.py:101:1: W191 Indentation contains tabs + --> W19.py:100:49 | 99 | #: E101 W191 W191 W504 100 | if os.path.exists(os.path.join(path, PEP8_BIN)): 101 | cmd = ([os.path.join(path, PEP8_BIN)] + - | ^^^^ W191 + | ^^^^ 102 | self._pep8_options(targetfile)) 103 | #: W191 - okay | +error[W191]: 102:1: Indentation contains tabs -W19.py:102:1: W191 Indentation contains tabs + --> W19.py:101:44 | 100 | if os.path.exists(os.path.join(path, PEP8_BIN)): 101 | cmd = ([os.path.join(path, PEP8_BIN)] + 102 | self._pep8_options(targetfile)) - | ^^^^^^^^^^^ W191 + | ^^^^^^^^^^^ 103 | #: W191 - okay 104 | ''' | +error[W191]: 128:1: Indentation contains tabs -W19.py:128:1: W191 Indentation contains tabs + --> W19.py:127:24 | 126 | if foo is None and bar is "bop" and \ 127 | blah == 'yeah': 128 | blah = 'yeahnah' - | ^^^^ W191 + | ^^^^ | +error[W191]: 134:1: Indentation contains tabs -W19.py:134:1: W191 Indentation contains tabs + --> W19.py:133:9 | 132 | #: W191 W191 W191 133 | if True: 134 | foo( - | ^^^^ W191 + | ^^^^ 135 | 1, 136 | 2) | +error[W191]: 135:1: Indentation contains tabs -W19.py:135:1: W191 Indentation contains tabs + --> W19.py:134:9 | 133 | if True: 134 | foo( 135 | 1, - | ^^^^^^^^ W191 + | ^^^^^^^^ 136 | 2) 137 | #: W191 W191 W191 W191 W191 | +error[W191]: 136:1: Indentation contains tabs -W19.py:136:1: W191 Indentation contains tabs + --> W19.py:135:11 | 134 | foo( 135 | 1, 136 | 2) - | ^^^^^^^^ W191 + | ^^^^^^^^ 137 | #: W191 W191 W191 W191 W191 138 | def test_keys(self): | +error[W191]: 139:1: Indentation contains tabs -W19.py:139:1: W191 Indentation contains tabs + --> W19.py:138:21 | 137 | #: W191 W191 W191 W191 W191 138 | def test_keys(self): 139 | """areas.json - All regions are accounted for.""" - | ^^^^ W191 + | ^^^^ 140 | expected = set([ 141 | u'Norrbotten', | +error[W191]: 140:1: Indentation contains tabs -W19.py:140:1: W191 Indentation contains tabs + --> W19.py:139:54 | 138 | def test_keys(self): 139 | """areas.json - All regions are accounted for.""" 140 | expected = set([ - | ^^^^ W191 + | ^^^^ 141 | u'Norrbotten', 142 | u'V\xe4sterbotten', | +error[W191]: 141:1: Indentation contains tabs -W19.py:141:1: W191 Indentation contains tabs + --> W19.py:140:21 | 139 | """areas.json - All regions are accounted for.""" 140 | expected = set([ 141 | u'Norrbotten', - | ^^^^^^^^ W191 + | ^^^^^^^^ 142 | u'V\xe4sterbotten', 143 | ]) | +error[W191]: 142:1: Indentation contains tabs -W19.py:142:1: W191 Indentation contains tabs + --> W19.py:141:23 | 140 | expected = set([ 141 | u'Norrbotten', 142 | u'V\xe4sterbotten', - | ^^^^^^^^ W191 + | ^^^^^^^^ 143 | ]) 144 | #: W191 | +error[W191]: 143:1: Indentation contains tabs -W19.py:143:1: W191 Indentation contains tabs + --> W19.py:142:28 | 141 | u'Norrbotten', 142 | u'V\xe4sterbotten', 143 | ]) - | ^^^^ W191 + | ^^^^ 144 | #: W191 145 | x = [ | +error[W191]: 146:1: Indentation contains tabs -W19.py:146:1: W191 Indentation contains tabs + --> W19.py:145:6 | 144 | #: W191 145 | x = [ 146 | 'abc' - | ^^^^ W191 + | ^^^^ 147 | ] 148 | #: W191 - okay | +error[W191]: 157:1: Indentation contains tabs -W19.py:157:1: W191 Indentation contains tabs + --> W19.py:156:8 | 156 | f"test{ 157 | tab_indented_should_be_flagged - | ^^^^ W191 + | ^^^^ 158 | } <- this tab is fine" | +error[W191]: 161:1: Indentation contains tabs -W19.py:161:1: W191 Indentation contains tabs + --> W19.py:160:10 | 160 | f"""test{ 161 | tab_indented_should_be_flagged - | ^^^^ W191 + | ^^^^ 162 | } <- this tab is fine""" | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W291_W29.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W291_W29.py.snap index cc0dd6da96..76e44c5a69 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W291_W29.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W291_W29.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[W291]: W29.py:4:6: [*] Trailing whitespace +error[W291]: 4:6: [*] Trailing whitespace + --> W29.py:4:6 | 2 | # 情 3 | #: W291:1:6 @@ -22,8 +23,9 @@ error[W291]: W29.py:4:6: [*] Trailing whitespace 6 6 | class Foo(object): 7 7 | -error[W291]: W29.py:11:35: [*] Trailing whitespace +error[W291]: 11:35: [*] Trailing whitespace + --> W29.py:11:35 | 9 | #: W291:2:35 10 | '''multiline @@ -43,8 +45,9 @@ error[W291]: W29.py:11:35: [*] Trailing whitespace 13 13 | x = 1 14 14 | #: W191 W292 noeol -error[W291]: W29.py:13:6: [*] Trailing whitespace +error[W291]: 13:6: [*] Trailing whitespace + --> W29.py:13:6 | 11 | string with trailing whitespace''' 12 | #: W291 W292 noeol diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W291_W291.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W291_W291.py.snap index ad8cd180f8..31792bce1b 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W291_W291.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W291_W291.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[W291]: W291.py:1:23: [*] Trailing whitespace +error[W291]: 1:23: [*] Trailing whitespace + --> W291.py:1:23 | 1 | '''trailing whitespace | ^ @@ -16,8 +17,9 @@ error[W291]: W291.py:1:23: [*] Trailing whitespace 3 3 | 4 4 | f'''trailing whitespace -error[W291]: W291.py:4:24: [*] Trailing whitespace +error[W291]: 4:24: [*] Trailing whitespace + --> W291.py:4:24 | 2 | inside a multiline string''' 3 | @@ -36,8 +38,9 @@ error[W291]: W291.py:4:24: [*] Trailing whitespace 6 6 | 7 7 | # Trailing whitespace after `{` -error[W291]: W291.py:8:8: [*] Trailing whitespace +error[W291]: 8:8: [*] Trailing whitespace + --> W291.py:8:8 | 7 | # Trailing whitespace after `{` 8 | f'abc { @@ -56,8 +59,9 @@ error[W291]: W291.py:8:8: [*] Trailing whitespace 10 10 | }' 11 11 | -error[W291]: W291.py:14:10: [*] Trailing whitespace +error[W291]: 14:10: [*] Trailing whitespace + --> W291.py:14:10 | 12 | # Trailing whitespace after `2` 13 | f'abc { diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W292_W292_0.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W292_W292_0.py.snap index 1daa173651..fa12f0696b 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W292_W292_0.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W292_W292_0.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[W292]: W292_0.py:2:9: [*] No newline at end of file +error[W292]: 2:9: [*] No newline at end of file + --> W292_0.py:2:9 | 1 | def fn() -> None: 2 | pass diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W293_W29.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W293_W29.py.snap index c46c597f3f..afc5f18784 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W293_W29.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W293_W29.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[W293]: W29.py:7:1: [*] Blank line contains whitespace +error[W293]: 7:1: [*] Blank line contains whitespace + --> W29.py:6:19 | 5 | #: W293:2:1 6 | class Foo(object): diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W293_W293.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W293_W293.py.snap index 65904f2ef6..2c1aa51cc9 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W293_W293.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W293_W293.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[W293]: W293.py:4:1: [*] Blank line contains whitespace +error[W293]: 4:1: [*] Blank line contains whitespace + --> W293.py:3:16 | 2 | class Chassis(RobotModuleTemplate): 3 | """底盘信息推送控制 @@ -21,8 +22,9 @@ error[W293]: W293.py:4:1: [*] Blank line contains whitespace 6 6 | 7 7 | -error[W293]: W293.py:10:1: [*] Blank line contains whitespace +error[W293]: 10:1: [*] Blank line contains whitespace + --> W293.py:9:6 | 8 | """""" \ 9 | \ @@ -42,8 +44,9 @@ error[W293]: W293.py:10:1: [*] Blank line contains whitespace 12 10 | 13 11 | "abc\ -error[W293]: W293.py:16:1: [*] Blank line contains whitespace +error[W293]: 16:1: [*] Blank line contains whitespace + --> W293.py:15:6 | 14 | " \ 15 | \ @@ -64,8 +67,9 @@ error[W293]: W293.py:16:1: [*] Blank line contains whitespace 18 16 | 19 17 | inside a multiline string''' -error[W293]: W293.py:18:1: [*] Blank line contains whitespace +error[W293]: 18:1: [*] Blank line contains whitespace + --> W293.py:17:30 | 17 | '''blank line with whitespace 18 | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W605_W605_0.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W605_W605_0.py.snap index 09a9023dcd..c81321ef9f 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W605_W605_0.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W605_W605_0.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[W605]: W605_0.py:2:10: [*] Invalid escape sequence: `\.` +error[W605]: 2:10: [*] Invalid escape sequence: `\.` + --> W605_0.py:2:10 | 1 | #: W605:1:10 2 | regex = '\.png$' @@ -19,8 +20,9 @@ error[W605]: W605_0.py:2:10: [*] Invalid escape sequence: `\.` 4 4 | #: W605:2:1 5 5 | regex = ''' -error[W605]: W605_0.py:6:1: [*] Invalid escape sequence: `\.` +error[W605]: 6:1: [*] Invalid escape sequence: `\.` + --> W605_0.py:5:12 | 4 | #: W605:2:1 5 | regex = ''' @@ -39,8 +41,9 @@ error[W605]: W605_0.py:6:1: [*] Invalid escape sequence: `\.` 7 7 | ''' 8 8 | -error[W605]: W605_0.py:11:6: [*] Invalid escape sequence: `\_` +error[W605]: 11:6: [*] Invalid escape sequence: `\_` + --> W605_0.py:11:6 | 9 | #: W605:2:6 10 | f( @@ -59,8 +62,9 @@ error[W605]: W605_0.py:11:6: [*] Invalid escape sequence: `\_` 13 13 | 14 14 | #: W605:4:6 -error[W605]: W605_0.py:18:6: [*] Invalid escape sequence: `\_` +error[W605]: 18:6: [*] Invalid escape sequence: `\_` + --> W605_0.py:18:6 | 16 | multi-line 17 | literal @@ -80,8 +84,9 @@ error[W605]: W605_0.py:18:6: [*] Invalid escape sequence: `\_` 17 17 | literal 18 18 | with \_ somewhere -error[W605]: W605_0.py:23:39: [*] Invalid escape sequence: `\_` +error[W605]: 23:39: [*] Invalid escape sequence: `\_` + --> W605_0.py:23:39 | 22 | #: W605:1:38 23 | value = 'new line\nand invalid escape \_ here' @@ -98,8 +103,9 @@ error[W605]: W605_0.py:23:39: [*] Invalid escape sequence: `\_` 25 25 | 26 26 | def f(): -error[W605]: W605_0.py:28:12: [*] Invalid escape sequence: `\.` +error[W605]: 28:12: [*] Invalid escape sequence: `\.` + --> W605_0.py:28:12 | 26 | def f(): 27 | #: W605:1:11 @@ -119,8 +125,9 @@ error[W605]: W605_0.py:28:12: [*] Invalid escape sequence: `\.` 30 30 | #: Okay 31 31 | regex = r'\.png$' -error[W605]: W605_0.py:45:12: [*] Invalid escape sequence: `\_` +error[W605]: 45:12: [*] Invalid escape sequence: `\_` + --> W605_0.py:45:12 | 43 | ''' # noqa 44 | @@ -140,8 +147,9 @@ error[W605]: W605_0.py:45:12: [*] Invalid escape sequence: `\_` 47 47 | #: W605:1:7 48 48 | u'foo\ bar' -error[W605]: W605_0.py:48:6: [*] Invalid escape sequence: `\ ` +error[W605]: 48:6: [*] Invalid escape sequence: `\ ` + --> W605_0.py:48:6 | 47 | #: W605:1:7 48 | u'foo\ bar' @@ -160,8 +168,9 @@ error[W605]: W605_0.py:48:6: [*] Invalid escape sequence: `\ ` 50 50 | #: W605:1:13 51 51 | ( -error[W605]: W605_0.py:53:9: [*] Invalid escape sequence: `\.` +error[W605]: 53:9: [*] Invalid escape sequence: `\.` + --> W605_0.py:53:9 | 51 | ( 52 | "foo \ @@ -180,8 +189,9 @@ error[W605]: W605_0.py:53:9: [*] Invalid escape sequence: `\.` 55 55 | 56 56 | #: W605:1:6 -error[W605]: W605_0.py:57:6: [*] Invalid escape sequence: `\.` +error[W605]: 57:6: [*] Invalid escape sequence: `\.` + --> W605_0.py:57:6 | 56 | #: W605:1:6 57 | "foo \. bar \t" @@ -200,8 +210,9 @@ error[W605]: W605_0.py:57:6: [*] Invalid escape sequence: `\.` 59 59 | #: W605:1:13 60 60 | "foo \t bar \." -error[W605]: W605_0.py:60:13: [*] Invalid escape sequence: `\.` +error[W605]: 60:13: [*] Invalid escape sequence: `\.` + --> W605_0.py:60:13 | 59 | #: W605:1:13 60 | "foo \t bar \." diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W605_W605_1.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W605_W605_1.py.snap index f64a89484b..bc5c1be275 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W605_W605_1.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W605_W605_1.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[W605]: W605_1.py:4:11: [*] Invalid escape sequence: `\.` +error[W605]: 4:11: [*] Invalid escape sequence: `\.` + --> W605_1.py:4:11 | 3 | #: W605:1:10 4 | regex = f'\.png$' @@ -21,8 +22,9 @@ error[W605]: W605_1.py:4:11: [*] Invalid escape sequence: `\.` 6 6 | #: W605:2:1 7 7 | regex = f''' -error[W605]: W605_1.py:8:1: [*] Invalid escape sequence: `\.` +error[W605]: 8:1: [*] Invalid escape sequence: `\.` + --> W605_1.py:7:13 | 6 | #: W605:2:1 7 | regex = f''' @@ -41,8 +43,9 @@ error[W605]: W605_1.py:8:1: [*] Invalid escape sequence: `\.` 9 9 | ''' 10 10 | -error[W605]: W605_1.py:13:7: [*] Invalid escape sequence: `\_` +error[W605]: 13:7: [*] Invalid escape sequence: `\_` + --> W605_1.py:13:7 | 11 | #: W605:2:6 12 | f( @@ -61,8 +64,9 @@ error[W605]: W605_1.py:13:7: [*] Invalid escape sequence: `\_` 15 15 | 16 16 | #: W605:4:6 -error[W605]: W605_1.py:20:6: [*] Invalid escape sequence: `\_` +error[W605]: 20:6: [*] Invalid escape sequence: `\_` + --> W605_1.py:20:6 | 18 | multi-line 19 | literal @@ -82,8 +86,9 @@ error[W605]: W605_1.py:20:6: [*] Invalid escape sequence: `\_` 19 19 | literal 20 20 | with \_ somewhere -error[W605]: W605_1.py:25:40: [*] Invalid escape sequence: `\_` +error[W605]: 25:40: [*] Invalid escape sequence: `\_` + --> W605_1.py:25:40 | 24 | #: W605:1:38 25 | value = f'new line\nand invalid escape \_ here' @@ -100,8 +105,9 @@ error[W605]: W605_1.py:25:40: [*] Invalid escape sequence: `\_` 27 27 | 28 28 | #: Okay -error[W605]: W605_1.py:43:13: [*] Invalid escape sequence: `\_` +error[W605]: 43:13: [*] Invalid escape sequence: `\_` + --> W605_1.py:43:13 | 41 | ''' # noqa 42 | @@ -121,8 +127,9 @@ error[W605]: W605_1.py:43:13: [*] Invalid escape sequence: `\_` 45 45 | value = f'\{1}' 46 46 | value = f'{1:\}' -error[W605]: W605_1.py:44:11: [*] Invalid escape sequence: `\{` +error[W605]: 44:11: [*] Invalid escape sequence: `\{` + --> W605_1.py:44:11 | 43 | regex = f'\\\_' 44 | value = f'\{{1}}' @@ -141,8 +148,9 @@ error[W605]: W605_1.py:44:11: [*] Invalid escape sequence: `\{` 46 46 | value = f'{1:\}' 47 47 | value = f"{f"\{1}"}" -error[W605]: W605_1.py:45:11: [*] Invalid escape sequence: `\{` +error[W605]: 45:11: [*] Invalid escape sequence: `\{` + --> W605_1.py:45:11 | 43 | regex = f'\\\_' 44 | value = f'\{{1}}' @@ -162,8 +170,9 @@ error[W605]: W605_1.py:45:11: [*] Invalid escape sequence: `\{` 47 47 | value = f"{f"\{1}"}" 48 48 | value = rf"{f"\{1}"}" -error[W605]: W605_1.py:46:14: [*] Invalid escape sequence: `\}` +error[W605]: 46:14: [*] Invalid escape sequence: `\}` + --> W605_1.py:46:14 | 44 | value = f'\{{1}}' 45 | value = f'\{1}' @@ -183,8 +192,9 @@ error[W605]: W605_1.py:46:14: [*] Invalid escape sequence: `\}` 48 48 | value = rf"{f"\{1}"}" 49 49 | -error[W605]: W605_1.py:47:14: [*] Invalid escape sequence: `\{` +error[W605]: 47:14: [*] Invalid escape sequence: `\{` + --> W605_1.py:47:14 | 45 | value = f'\{1}' 46 | value = f'{1:\}' @@ -203,8 +213,9 @@ error[W605]: W605_1.py:47:14: [*] Invalid escape sequence: `\{` 49 49 | 50 50 | # Okay -error[W605]: W605_1.py:48:15: [*] Invalid escape sequence: `\{` +error[W605]: 48:15: [*] Invalid escape sequence: `\{` + --> W605_1.py:48:15 | 46 | value = f'{1:\}' 47 | value = f"{f"\{1}"}" @@ -224,8 +235,9 @@ error[W605]: W605_1.py:48:15: [*] Invalid escape sequence: `\{` 50 50 | # Okay 51 51 | value = rf'\{{1}}' -error[W605]: W605_1.py:57:9: [*] Invalid escape sequence: `\d` +error[W605]: 57:9: [*] Invalid escape sequence: `\d` + --> W605_1.py:57:9 | 56 | # Regression tests for https://github.com/astral-sh/ruff/issues/10434 57 | f"{{}}+-\d" @@ -243,8 +255,9 @@ error[W605]: W605_1.py:57:9: [*] Invalid escape sequence: `\d` 58 58 | f"\n{{}}+-\d+" 59 59 | f"\n{{}}�+-\d+" -error[W605]: W605_1.py:58:11: [*] Invalid escape sequence: `\d` +error[W605]: 58:11: [*] Invalid escape sequence: `\d` + --> W605_1.py:58:11 | 56 | # Regression tests for https://github.com/astral-sh/ruff/issues/10434 57 | f"{{}}+-\d" @@ -261,8 +274,9 @@ error[W605]: W605_1.py:58:11: [*] Invalid escape sequence: `\d` 58 |+f"\n{{}}+-\\d+" 59 59 | f"\n{{}}�+-\d+" -error[W605]: W605_1.py:59:12: [*] Invalid escape sequence: `\d` +error[W605]: 59:12: [*] Invalid escape sequence: `\d` + --> W605_1.py:59:12 | 57 | f"{{}}+-\d" 58 | f"\n{{}}+-\d+" diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E301_notebook.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E301_notebook.snap index 38428ef854..3e9c8f4fdc 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E301_notebook.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E301_notebook.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[E301]: E30.ipynb:13:5: [*] Expected 1 blank line, found 0 +error[E301]: 13:5: [*] Expected 1 blank line, found 0 + --> E30.ipynb:13:5 | 11 | def method(cls) -> None: 12 | pass diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E302_notebook.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E302_notebook.snap index a48ec9354b..4fe875fbec 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E302_notebook.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E302_notebook.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[E302]: E30.ipynb:21:1: [*] Expected 2 blank lines, found 1 +error[E302]: 21:1: [*] Expected 2 blank lines, found 1 + --> E30.ipynb:20:1 | 19 | pass 20 | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E303_notebook.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E303_notebook.snap index 20510586f6..fafe3c8c21 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E303_notebook.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E303_notebook.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[E303]: E30.ipynb:29:5: [*] Too many blank lines (2) +error[E303]: 29:5: [*] Too many blank lines (2) + --> E30.ipynb:29:5 | 29 | # arbitrary comment | ^^^^^^^^^^^^^^^^^^^ @@ -19,8 +20,9 @@ error[E303]: E30.ipynb:29:5: [*] Too many blank lines (2) 30 29 | 31 30 | def inner(): # E306 not expected (pycodestyle detects E306) -error[E303]: E30.ipynb:39:1: [*] Too many blank lines (4) +error[E303]: 39:1: [*] Too many blank lines (4) + --> E30.ipynb:39:1 | 39 | def fn(): | ^^^ diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E303_typing_stub.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E303_typing_stub.snap index 9e33f53904..baba386fef 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E303_typing_stub.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E303_typing_stub.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[E303]: E30.pyi:17:1: [*] Too many blank lines (2) +error[E303]: 17:1: [*] Too many blank lines (2) + --> E30.pyi:17:1 | 17 | def grouped1(): ... | ^^^ @@ -19,8 +20,9 @@ error[E303]: E30.pyi:17:1: [*] Too many blank lines (2) 18 17 | def grouped2(): ... 19 18 | def grouped3( ): ... -error[E303]: E30.pyi:22:1: [*] Too many blank lines (2) +error[E303]: 22:1: [*] Too many blank lines (2) + --> E30.pyi:22:1 | 22 | class BackendProxy: | ^^^^^ @@ -37,8 +39,9 @@ error[E303]: E30.pyi:22:1: [*] Too many blank lines (2) 23 22 | backend_module: str 24 23 | backend_object: str | None -error[E303]: E30.pyi:35:5: [*] Too many blank lines (2) +error[E303]: 35:5: [*] Too many blank lines (2) + --> E30.pyi:35:5 | 35 | def ungrouped(): ... | ^^^ @@ -54,8 +57,9 @@ error[E303]: E30.pyi:35:5: [*] Too many blank lines (2) 36 35 | a = "test" 37 36 | -error[E303]: E30.pyi:43:1: [*] Too many blank lines (2) +error[E303]: 43:1: [*] Too many blank lines (2) + --> E30.pyi:43:1 | 43 | def outer(): | ^^^ diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E304_notebook.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E304_notebook.snap index 87b50bb34d..dd7f49f6a8 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E304_notebook.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E304_notebook.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[E304]: E30.ipynb:45:1: [*] Blank lines found after function decorator (1) +error[E304]: 45:1: [*] Blank lines found after function decorator (1) + --> E30.ipynb:44:1 | 43 | @decorator 44 | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E304_typing_stub.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E304_typing_stub.snap index 904ae4556c..9877dfaf2c 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E304_typing_stub.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E304_typing_stub.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[E304]: E30.pyi:32:5: [*] Blank lines found after function decorator (1) +error[E304]: 32:5: [*] Blank lines found after function decorator (1) + --> E30.pyi:32:5 | 30 | @decorated 31 | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E305_notebook.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E305_notebook.snap index f39b32d856..b258a75094 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E305_notebook.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E305_notebook.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[E305]: E30.ipynb:55:1: [*] Expected 2 blank lines after class or function definition, found (1) +error[E305]: 55:1: [*] Expected 2 blank lines after class or function definition, found (1) + --> E30.ipynb:54:22 | 54 | # another comment 55 | fn() diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E306_notebook.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E306_notebook.snap index 93e9109c26..87454cb63e 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E306_notebook.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E306_notebook.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[E306]: E30.ipynb:60:5: [*] Expected 1 blank line before a nested definition, found 0 +error[E306]: 60:5: [*] Expected 1 blank line before a nested definition, found 0 + --> E30.ipynb:60:5 | 58 | def a(): 59 | x = 1 diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_top_level_isort_compatibility-lines-after(-1)-between(0).snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_top_level_isort_compatibility-lines-after(-1)-between(0).snap index e0f317e983..319b3264cf 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_top_level_isort_compatibility-lines-after(-1)-between(0).snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_top_level_isort_compatibility-lines-after(-1)-between(0).snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[I001]: E30_isort.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> E30_isort.py:1:1 | 1 | / import json 2 | | @@ -11,8 +12,8 @@ error[I001]: E30_isort.py:1:1: [*] Import block is un-sorted or un-formatted 5 | | from typing import Any, Sequence 6 | | 7 | | -8 | | class MissingCommand(TypeError): ... # noqa: N818 - | |_^ + | |__^ +8 | class MissingCommand(TypeError): ... # noqa: N818 | = help: Organize imports ℹ Safe fix @@ -24,8 +25,9 @@ error[I001]: E30_isort.py:1:1: [*] Import block is un-sorted or un-formatted 6 3 | 7 4 | -error[E302]: E30_isort.py:23:1: [*] Expected 2 blank lines, found 1 +error[E302]: 23:1: [*] Expected 2 blank lines, found 1 + --> E30_isort.py:22:1 | 21 | abcd.foo() 22 | @@ -44,8 +46,9 @@ error[E302]: E30_isort.py:23:1: [*] Expected 2 blank lines, found 1 24 25 | 25 26 | if TYPE_CHECKING: -error[I001]: E30_isort.py:26:1: [*] Import block is un-sorted or un-formatted +error[I001]: 26:1: [*] Import block is un-sorted or un-formatted + --> E30_isort.py:25:18 | 25 | if TYPE_CHECKING: 26 | / import os @@ -53,8 +56,8 @@ error[I001]: E30_isort.py:26:1: [*] Import block is un-sorted or un-formatted 28 | | 29 | | 30 | | from typing_extensions import TypeAlias -31 | | - | |_^ + | |____________________________________________^ +31 | 32 | 33 | abcd.foo() | @@ -69,8 +72,9 @@ error[I001]: E30_isort.py:26:1: [*] Import block is un-sorted or un-formatted 31 29 | 32 30 | -error[E302]: E30_isort.py:35:1: [*] Expected 2 blank lines, found 1 +error[E302]: 35:1: [*] Expected 2 blank lines, found 1 + --> E30_isort.py:34:1 | 33 | abcd.foo() 34 | @@ -88,8 +92,9 @@ error[E302]: E30_isort.py:35:1: [*] Expected 2 blank lines, found 1 36 37 | ... 37 38 | -error[E302]: E30_isort.py:41:1: [*] Expected 2 blank lines, found 1 +error[E302]: 41:1: [*] Expected 2 blank lines, found 1 + --> E30_isort.py:40:1 | 39 | from typing_extensions import TypeAlias 40 | @@ -107,13 +112,14 @@ error[E302]: E30_isort.py:41:1: [*] Expected 2 blank lines, found 1 42 43 | ... 43 44 | -error[I001]: E30_isort.py:60:1: [*] Import block is un-sorted or un-formatted +error[I001]: 60:1: [*] Import block is un-sorted or un-formatted + --> E30_isort.py:60:1 | 60 | / from typing import Any, Sequence 61 | | -62 | | class MissingCommand(TypeError): ... # noqa: N818 - | |_^ + | |__^ +62 | class MissingCommand(TypeError): ... # noqa: N818 | = help: Organize imports ℹ Safe fix @@ -123,8 +129,9 @@ error[I001]: E30_isort.py:60:1: [*] Import block is un-sorted or un-formatted 62 |+ 62 63 | class MissingCommand(TypeError): ... # noqa: N818 -error[E302]: E30_isort.py:62:1: [*] Expected 2 blank lines, found 1 +error[E302]: 62:1: [*] Expected 2 blank lines, found 1 + --> E30_isort.py:61:1 | 60 | from typing import Any, Sequence 61 | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_top_level_isort_compatibility-lines-after(0)-between(0).snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_top_level_isort_compatibility-lines-after(0)-between(0).snap index 629876fe35..8f496cd240 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_top_level_isort_compatibility-lines-after(0)-between(0).snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_top_level_isort_compatibility-lines-after(0)-between(0).snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[I001]: E30_isort.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> E30_isort.py:1:1 | 1 | / import json 2 | | @@ -11,8 +12,8 @@ error[I001]: E30_isort.py:1:1: [*] Import block is un-sorted or un-formatted 5 | | from typing import Any, Sequence 6 | | 7 | | -8 | | class MissingCommand(TypeError): ... # noqa: N818 - | |_^ + | |__^ +8 | class MissingCommand(TypeError): ... # noqa: N818 | = help: Organize imports ℹ Safe fix @@ -27,8 +28,9 @@ error[I001]: E30_isort.py:1:1: [*] Import block is un-sorted or un-formatted 9 4 | 10 5 | -error[E302]: E30_isort.py:23:1: [*] Expected 2 blank lines, found 1 +error[E302]: 23:1: [*] Expected 2 blank lines, found 1 + --> E30_isort.py:22:1 | 21 | abcd.foo() 22 | @@ -47,8 +49,9 @@ error[E302]: E30_isort.py:23:1: [*] Expected 2 blank lines, found 1 24 25 | 25 26 | if TYPE_CHECKING: -error[I001]: E30_isort.py:26:1: [*] Import block is un-sorted or un-formatted +error[I001]: 26:1: [*] Import block is un-sorted or un-formatted + --> E30_isort.py:25:18 | 25 | if TYPE_CHECKING: 26 | / import os @@ -56,8 +59,8 @@ error[I001]: E30_isort.py:26:1: [*] Import block is un-sorted or un-formatted 28 | | 29 | | 30 | | from typing_extensions import TypeAlias -31 | | - | |_^ + | |____________________________________________^ +31 | 32 | 33 | abcd.foo() | @@ -72,8 +75,9 @@ error[I001]: E30_isort.py:26:1: [*] Import block is un-sorted or un-formatted 31 29 | 32 30 | -error[E302]: E30_isort.py:35:1: [*] Expected 2 blank lines, found 1 +error[E302]: 35:1: [*] Expected 2 blank lines, found 1 + --> E30_isort.py:34:1 | 33 | abcd.foo() 34 | @@ -91,8 +95,9 @@ error[E302]: E30_isort.py:35:1: [*] Expected 2 blank lines, found 1 36 37 | ... 37 38 | -error[E302]: E30_isort.py:41:1: [*] Expected 2 blank lines, found 1 +error[E302]: 41:1: [*] Expected 2 blank lines, found 1 + --> E30_isort.py:40:1 | 39 | from typing_extensions import TypeAlias 40 | @@ -110,13 +115,14 @@ error[E302]: E30_isort.py:41:1: [*] Expected 2 blank lines, found 1 42 43 | ... 43 44 | -error[I001]: E30_isort.py:60:1: [*] Import block is un-sorted or un-formatted +error[I001]: 60:1: [*] Import block is un-sorted or un-formatted + --> E30_isort.py:60:1 | 60 | / from typing import Any, Sequence 61 | | -62 | | class MissingCommand(TypeError): ... # noqa: N818 - | |_^ + | |__^ +62 | class MissingCommand(TypeError): ... # noqa: N818 | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_top_level_isort_compatibility-lines-after(1)-between(1).snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_top_level_isort_compatibility-lines-after(1)-between(1).snap index b05d4c3310..6a6525cab8 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_top_level_isort_compatibility-lines-after(1)-between(1).snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_top_level_isort_compatibility-lines-after(1)-between(1).snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[I001]: E30_isort.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> E30_isort.py:1:1 | 1 | / import json 2 | | @@ -11,8 +12,8 @@ error[I001]: E30_isort.py:1:1: [*] Import block is un-sorted or un-formatted 5 | | from typing import Any, Sequence 6 | | 7 | | -8 | | class MissingCommand(TypeError): ... # noqa: N818 - | |_^ + | |__^ +8 | class MissingCommand(TypeError): ... # noqa: N818 | = help: Organize imports ℹ Safe fix @@ -26,8 +27,9 @@ error[I001]: E30_isort.py:1:1: [*] Import block is un-sorted or un-formatted 8 5 | class MissingCommand(TypeError): ... # noqa: N818 9 6 | -error[E302]: E30_isort.py:23:1: [*] Expected 2 blank lines, found 1 +error[E302]: 23:1: [*] Expected 2 blank lines, found 1 + --> E30_isort.py:22:1 | 21 | abcd.foo() 22 | @@ -46,8 +48,9 @@ error[E302]: E30_isort.py:23:1: [*] Expected 2 blank lines, found 1 24 25 | 25 26 | if TYPE_CHECKING: -error[I001]: E30_isort.py:26:1: [*] Import block is un-sorted or un-formatted +error[I001]: 26:1: [*] Import block is un-sorted or un-formatted + --> E30_isort.py:25:18 | 25 | if TYPE_CHECKING: 26 | / import os @@ -55,8 +58,8 @@ error[I001]: E30_isort.py:26:1: [*] Import block is un-sorted or un-formatted 28 | | 29 | | 30 | | from typing_extensions import TypeAlias -31 | | - | |_^ + | |____________________________________________^ +31 | 32 | 33 | abcd.foo() | @@ -71,8 +74,9 @@ error[I001]: E30_isort.py:26:1: [*] Import block is un-sorted or un-formatted 31 29 | 32 30 | -error[E302]: E30_isort.py:35:1: [*] Expected 2 blank lines, found 1 +error[E302]: 35:1: [*] Expected 2 blank lines, found 1 + --> E30_isort.py:34:1 | 33 | abcd.foo() 34 | @@ -90,8 +94,9 @@ error[E302]: E30_isort.py:35:1: [*] Expected 2 blank lines, found 1 36 37 | ... 37 38 | -error[E302]: E30_isort.py:41:1: [*] Expected 2 blank lines, found 1 +error[E302]: 41:1: [*] Expected 2 blank lines, found 1 + --> E30_isort.py:40:1 | 39 | from typing_extensions import TypeAlias 40 | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_top_level_isort_compatibility-lines-after(4)-between(4).snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_top_level_isort_compatibility-lines-after(4)-between(4).snap index 8df0c189e3..ec6403a32a 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_top_level_isort_compatibility-lines-after(4)-between(4).snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_top_level_isort_compatibility-lines-after(4)-between(4).snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[I001]: E30_isort.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> E30_isort.py:1:1 | 1 | / import json 2 | | @@ -11,8 +12,8 @@ error[I001]: E30_isort.py:1:1: [*] Import block is un-sorted or un-formatted 5 | | from typing import Any, Sequence 6 | | 7 | | -8 | | class MissingCommand(TypeError): ... # noqa: N818 - | |_^ + | |__^ +8 | class MissingCommand(TypeError): ... # noqa: N818 | = help: Organize imports ℹ Safe fix @@ -29,8 +30,9 @@ error[I001]: E30_isort.py:1:1: [*] Import block is un-sorted or un-formatted 9 12 | 10 13 | -error[E302]: E30_isort.py:8:1: [*] Expected 4 blank lines, found 2 +error[E302]: 8:1: [*] Expected 4 blank lines, found 2 + --> E30_isort.py:8:1 | 8 | class MissingCommand(TypeError): ... # noqa: N818 | ^^^^^ @@ -46,8 +48,9 @@ error[E302]: E30_isort.py:8:1: [*] Expected 4 blank lines, found 2 9 11 | 10 12 | -error[E302]: E30_isort.py:23:1: [*] Expected 2 blank lines, found 1 +error[E302]: 23:1: [*] Expected 2 blank lines, found 1 + --> E30_isort.py:22:1 | 21 | abcd.foo() 22 | @@ -66,8 +69,9 @@ error[E302]: E30_isort.py:23:1: [*] Expected 2 blank lines, found 1 24 25 | 25 26 | if TYPE_CHECKING: -error[I001]: E30_isort.py:26:1: [*] Import block is un-sorted or un-formatted +error[I001]: 26:1: [*] Import block is un-sorted or un-formatted + --> E30_isort.py:25:18 | 25 | if TYPE_CHECKING: 26 | / import os @@ -75,8 +79,8 @@ error[I001]: E30_isort.py:26:1: [*] Import block is un-sorted or un-formatted 28 | | 29 | | 30 | | from typing_extensions import TypeAlias -31 | | - | |_^ + | |____________________________________________^ +31 | 32 | 33 | abcd.foo() | @@ -91,8 +95,9 @@ error[I001]: E30_isort.py:26:1: [*] Import block is un-sorted or un-formatted 31 29 | 32 30 | -error[E302]: E30_isort.py:35:1: [*] Expected 2 blank lines, found 1 +error[E302]: 35:1: [*] Expected 2 blank lines, found 1 + --> E30_isort.py:34:1 | 33 | abcd.foo() 34 | @@ -110,8 +115,9 @@ error[E302]: E30_isort.py:35:1: [*] Expected 2 blank lines, found 1 36 37 | ... 37 38 | -error[E302]: E30_isort.py:41:1: [*] Expected 2 blank lines, found 1 +error[E302]: 41:1: [*] Expected 2 blank lines, found 1 + --> E30_isort.py:40:1 | 39 | from typing_extensions import TypeAlias 40 | @@ -129,13 +135,14 @@ error[E302]: E30_isort.py:41:1: [*] Expected 2 blank lines, found 1 42 43 | ... 43 44 | -error[I001]: E30_isort.py:60:1: [*] Import block is un-sorted or un-formatted +error[I001]: 60:1: [*] Import block is un-sorted or un-formatted + --> E30_isort.py:60:1 | 60 | / from typing import Any, Sequence 61 | | -62 | | class MissingCommand(TypeError): ... # noqa: N818 - | |_^ + | |__^ +62 | class MissingCommand(TypeError): ... # noqa: N818 | = help: Organize imports ℹ Safe fix @@ -147,8 +154,9 @@ error[I001]: E30_isort.py:60:1: [*] Import block is un-sorted or un-formatted 64 |+ 62 65 | class MissingCommand(TypeError): ... # noqa: N818 -error[E302]: E30_isort.py:62:1: [*] Expected 4 blank lines, found 1 +error[E302]: 62:1: [*] Expected 4 blank lines, found 1 + --> E30_isort.py:61:1 | 60 | from typing import Any, Sequence 61 | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_typing_stub_isort.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_typing_stub_isort.snap index 258616c1a8..0fa4236932 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_typing_stub_isort.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_typing_stub_isort.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[I001]: E30_isort.pyi:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> E30_isort.pyi:1:1 | 1 | / import json 2 | | @@ -11,8 +12,8 @@ error[I001]: E30_isort.pyi:1:1: [*] Import block is un-sorted or un-formatted 5 | | from typing import Any, Sequence 6 | | 7 | | -8 | | class MissingCommand(TypeError): ... # noqa: N818 - | |_^ + | |__^ +8 | class MissingCommand(TypeError): ... # noqa: N818 | = help: Organize imports ℹ Safe fix @@ -26,8 +27,9 @@ error[I001]: E30_isort.pyi:1:1: [*] Import block is un-sorted or un-formatted 8 4 | class MissingCommand(TypeError): ... # noqa: N818 9 5 | -error[E303]: E30_isort.pyi:5:1: [*] Too many blank lines (3) +error[E303]: 5:1: [*] Too many blank lines (3) + --> E30_isort.pyi:5:1 | 5 | from typing import Any, Sequence | ^^^^ @@ -42,8 +44,9 @@ error[E303]: E30_isort.pyi:5:1: [*] Too many blank lines (3) 6 4 | 7 5 | -error[E303]: E30_isort.pyi:8:1: [*] Too many blank lines (2) +error[E303]: 8:1: [*] Too many blank lines (2) + --> E30_isort.pyi:8:1 | 8 | class MissingCommand(TypeError): ... # noqa: N818 | ^^^^^ @@ -58,8 +61,9 @@ error[E303]: E30_isort.pyi:8:1: [*] Too many blank lines (2) 9 8 | 10 9 | -error[E303]: E30_isort.pyi:11:1: [*] Too many blank lines (2) +error[E303]: 11:1: [*] Too many blank lines (2) + --> E30_isort.pyi:11:1 | 11 | class BackendProxy: | ^^^^^ @@ -76,8 +80,9 @@ error[E303]: E30_isort.pyi:11:1: [*] Too many blank lines (2) 12 11 | backend_module: str 13 12 | backend_object: str | None -error[E303]: E30_isort.pyi:17:1: [*] Too many blank lines (2) +error[E303]: 17:1: [*] Too many blank lines (2) + --> E30_isort.pyi:17:1 | 17 | if __name__ == "__main__": | ^^ @@ -93,8 +98,9 @@ error[E303]: E30_isort.pyi:17:1: [*] Too many blank lines (2) 18 17 | import abcd 19 18 | -error[E303]: E30_isort.pyi:21:5: [*] Too many blank lines (2) +error[E303]: 21:5: [*] Too many blank lines (2) + --> E30_isort.pyi:21:5 | 21 | abcd.foo() | ^^^^ @@ -111,8 +117,9 @@ error[E303]: E30_isort.pyi:21:5: [*] Too many blank lines (2) 22 21 | 23 22 | def __init__(self, backend_module: str, backend_obj: str | None) -> None: ... -error[I001]: E30_isort.pyi:26:1: [*] Import block is un-sorted or un-formatted +error[I001]: 26:1: [*] Import block is un-sorted or un-formatted + --> E30_isort.pyi:25:18 | 25 | if TYPE_CHECKING: 26 | / import os @@ -120,8 +127,8 @@ error[I001]: E30_isort.pyi:26:1: [*] Import block is un-sorted or un-formatted 28 | | 29 | | 30 | | from typing_extensions import TypeAlias -31 | | - | |_^ + | |____________________________________________^ +31 | 32 | 33 | abcd.foo() | @@ -136,8 +143,9 @@ error[I001]: E30_isort.pyi:26:1: [*] Import block is un-sorted or un-formatted 31 29 | 32 30 | -error[E303]: E30_isort.pyi:30:5: [*] Too many blank lines (3) +error[E303]: 30:5: [*] Too many blank lines (3) + --> E30_isort.pyi:30:5 | 30 | from typing_extensions import TypeAlias | ^^^^ @@ -153,8 +161,9 @@ error[E303]: E30_isort.pyi:30:5: [*] Too many blank lines (3) 31 29 | 32 30 | -error[E303]: E30_isort.pyi:33:5: [*] Too many blank lines (2) +error[E303]: 33:5: [*] Too many blank lines (2) + --> E30_isort.pyi:33:5 | 33 | abcd.foo() | ^^^^ @@ -171,8 +180,9 @@ error[E303]: E30_isort.pyi:33:5: [*] Too many blank lines (2) 34 33 | 35 34 | def __call__(self, name: str, *args: Any, **kwargs: Any) -> Any: -error[E303]: E30_isort.pyi:45:1: [*] Too many blank lines (2) +error[E303]: 45:1: [*] Too many blank lines (2) + --> E30_isort.pyi:45:1 | 45 | def _exit(self) -> None: ... | ^^^ @@ -187,8 +197,9 @@ error[E303]: E30_isort.pyi:45:1: [*] Too many blank lines (2) 46 45 | 47 46 | -error[E303]: E30_isort.pyi:48:1: [*] Too many blank lines (2) +error[E303]: 48:1: [*] Too many blank lines (2) + --> E30_isort.pyi:48:1 | 48 | def _optional_commands(self) -> dict[str, bool]: ... | ^^^ @@ -203,8 +214,9 @@ error[E303]: E30_isort.pyi:48:1: [*] Too many blank lines (2) 49 48 | 50 49 | -error[E303]: E30_isort.pyi:51:1: [*] Too many blank lines (2) +error[E303]: 51:1: [*] Too many blank lines (2) + --> E30_isort.pyi:51:1 | 51 | def run(argv: Sequence[str]) -> int: ... | ^^^ @@ -219,8 +231,9 @@ error[E303]: E30_isort.pyi:51:1: [*] Too many blank lines (2) 52 51 | 53 52 | -error[E303]: E30_isort.pyi:54:1: [*] Too many blank lines (2) +error[E303]: 54:1: [*] Too many blank lines (2) + --> E30_isort.pyi:54:1 | 54 | def read_line(fd: int = 0) -> bytearray: ... | ^^^ @@ -235,8 +248,9 @@ error[E303]: E30_isort.pyi:54:1: [*] Too many blank lines (2) 55 54 | 56 55 | -error[E303]: E30_isort.pyi:57:1: [*] Too many blank lines (2) +error[E303]: 57:1: [*] Too many blank lines (2) + --> E30_isort.pyi:57:1 | 57 | def flush() -> None: ... | ^^^ @@ -251,8 +265,9 @@ error[E303]: E30_isort.pyi:57:1: [*] Too many blank lines (2) 58 57 | 59 58 | -error[E303]: E30_isort.pyi:60:1: [*] Too many blank lines (2) +error[E303]: 60:1: [*] Too many blank lines (2) + --> E30_isort.pyi:60:1 | 60 | from typing import Any, Sequence | ^^^^ diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__constant_literals.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__constant_literals.snap index e207e58d1c..6199c995e0 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__constant_literals.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__constant_literals.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[F632]: constant_literals.py:4:4: [*] Use `==` to compare constant literals +error[F632]: 4:4: [*] Use `==` to compare constant literals + --> constant_literals.py:4:4 | 2 | # Errors 3 | ### @@ -22,8 +23,9 @@ error[F632]: constant_literals.py:4:4: [*] Use `==` to compare constant literals 6 6 | if "abc" is None: # F632 (fix, but leaves behind unfixable E711) 7 7 | pass -error[F632]: constant_literals.py:6:4: [*] Use `==` to compare constant literals +error[F632]: 6:4: [*] Use `==` to compare constant literals + --> constant_literals.py:6:4 | 4 | if "abc" is "def": # F632 (fix) 5 | pass @@ -43,8 +45,9 @@ error[F632]: constant_literals.py:6:4: [*] Use `==` to compare constant literals 8 8 | if None is "abc": # F632 (fix, but leaves behind unfixable E711) 9 9 | pass -error[F632]: constant_literals.py:8:4: [*] Use `==` to compare constant literals +error[F632]: 8:4: [*] Use `==` to compare constant literals + --> constant_literals.py:8:4 | 6 | if "abc" is None: # F632 (fix, but leaves behind unfixable E711) 7 | pass @@ -64,8 +67,9 @@ error[F632]: constant_literals.py:8:4: [*] Use `==` to compare constant literals 10 10 | if "abc" is False: # F632 (fix, but leaves behind unfixable E712) 11 11 | pass -error[F632]: constant_literals.py:10:4: [*] Use `==` to compare constant literals +error[F632]: 10:4: [*] Use `==` to compare constant literals + --> constant_literals.py:10:4 | 8 | if None is "abc": # F632 (fix, but leaves behind unfixable E711) 9 | pass @@ -85,8 +89,9 @@ error[F632]: constant_literals.py:10:4: [*] Use `==` to compare constant literal 12 12 | if False is "abc": # F632 (fix, but leaves behind unfixable E712) 13 13 | pass -error[F632]: constant_literals.py:12:4: [*] Use `==` to compare constant literals +error[F632]: 12:4: [*] Use `==` to compare constant literals + --> constant_literals.py:12:4 | 10 | if "abc" is False: # F632 (fix, but leaves behind unfixable E712) 11 | pass @@ -106,8 +111,9 @@ error[F632]: constant_literals.py:12:4: [*] Use `==` to compare constant literal 14 14 | if False == None: # E711, E712 (fix) 15 15 | pass -error[E712]: constant_literals.py:14:4: [*] Avoid equality comparisons to `False`; use `if not None:` for false checks +error[E712]: 14:4: [*] Avoid equality comparisons to `False`; use `if not None:` for false checks + --> constant_literals.py:14:4 | 12 | if False is "abc": # F632 (fix, but leaves behind unfixable E712) 13 | pass @@ -127,8 +133,9 @@ error[E712]: constant_literals.py:14:4: [*] Avoid equality comparisons to `False 16 16 | if None == False: # E711, E712 (fix) 17 17 | pass -error[E711]: constant_literals.py:14:13: [*] Comparison to `None` should be `cond is None` +error[E711]: 14:13: [*] Comparison to `None` should be `cond is None` + --> constant_literals.py:14:13 | 12 | if False is "abc": # F632 (fix, but leaves behind unfixable E712) 13 | pass @@ -148,8 +155,9 @@ error[E711]: constant_literals.py:14:13: [*] Comparison to `None` should be `con 16 16 | if None == False: # E711, E712 (fix) 17 17 | pass -error[E711]: constant_literals.py:16:4: [*] Comparison to `None` should be `cond is None` +error[E711]: 16:4: [*] Comparison to `None` should be `cond is None` + --> constant_literals.py:16:4 | 14 | if False == None: # E711, E712 (fix) 15 | pass @@ -168,8 +176,9 @@ error[E711]: constant_literals.py:16:4: [*] Comparison to `None` should be `cond 18 18 | 19 19 | named_var = [] -error[E712]: constant_literals.py:16:4: [*] Avoid equality comparisons to `False`; use `if not None:` for false checks +error[E712]: 16:4: [*] Avoid equality comparisons to `False`; use `if not None:` for false checks + --> constant_literals.py:16:4 | 14 | if False == None: # E711, E712 (fix) 15 | pass @@ -188,16 +197,17 @@ error[E712]: constant_literals.py:16:4: [*] Avoid equality comparisons to `False 18 18 | 19 19 | named_var = [] -constant_literals.py:20:4: F632 [*] Use `==` to compare constant literals +error[F632]: 20:4: [*] Use `==` to compare constant literals + + --> constant_literals.py:20:4 | 19 | named_var = [] 20 | if [] is []: # F632 (fix) - | ^^^^^^^^ F632 + | ^^^^^^^^ 21 | pass 22 | if named_var is []: # F632 (fix) | = help: Replace `is` with `==` - ℹ Safe fix 17 17 | pass 18 18 | @@ -208,17 +218,18 @@ constant_literals.py:20:4: F632 [*] Use `==` to compare constant literals 22 22 | if named_var is []: # F632 (fix) 23 23 | pass -constant_literals.py:22:4: F632 [*] Use `==` to compare constant literals +error[F632]: 22:4: [*] Use `==` to compare constant literals + + --> constant_literals.py:22:4 | 20 | if [] is []: # F632 (fix) 21 | pass 22 | if named_var is []: # F632 (fix) - | ^^^^^^^^^^^^^^^ F632 + | ^^^^^^^^^^^^^^^ 23 | pass 24 | if [] is named_var: # F632 (fix) | = help: Replace `is` with `==` - ℹ Safe fix 19 19 | named_var = [] 20 20 | if [] is []: # F632 (fix) @@ -229,17 +240,18 @@ constant_literals.py:22:4: F632 [*] Use `==` to compare constant literals 24 24 | if [] is named_var: # F632 (fix) 25 25 | pass -constant_literals.py:24:4: F632 [*] Use `==` to compare constant literals +error[F632]: 24:4: [*] Use `==` to compare constant literals + + --> constant_literals.py:24:4 | 22 | if named_var is []: # F632 (fix) 23 | pass 24 | if [] is named_var: # F632 (fix) - | ^^^^^^^^^^^^^^^ F632 + | ^^^^^^^^^^^^^^^ 25 | pass 26 | if named_var is [1]: # F632 (fix) | = help: Replace `is` with `==` - ℹ Safe fix 21 21 | pass 22 22 | if named_var is []: # F632 (fix) @@ -250,17 +262,18 @@ constant_literals.py:24:4: F632 [*] Use `==` to compare constant literals 26 26 | if named_var is [1]: # F632 (fix) 27 27 | pass -constant_literals.py:26:4: F632 [*] Use `==` to compare constant literals +error[F632]: 26:4: [*] Use `==` to compare constant literals + + --> constant_literals.py:26:4 | 24 | if [] is named_var: # F632 (fix) 25 | pass 26 | if named_var is [1]: # F632 (fix) - | ^^^^^^^^^^^^^^^^ F632 + | ^^^^^^^^^^^^^^^^ 27 | pass 28 | if [1] is named_var: # F632 (fix) | = help: Replace `is` with `==` - ℹ Safe fix 23 23 | pass 24 24 | if [] is named_var: # F632 (fix) @@ -271,17 +284,18 @@ constant_literals.py:26:4: F632 [*] Use `==` to compare constant literals 28 28 | if [1] is named_var: # F632 (fix) 29 29 | pass -constant_literals.py:28:4: F632 [*] Use `==` to compare constant literals +error[F632]: 28:4: [*] Use `==` to compare constant literals + + --> constant_literals.py:28:4 | 26 | if named_var is [1]: # F632 (fix) 27 | pass 28 | if [1] is named_var: # F632 (fix) - | ^^^^^^^^^^^^^^^^ F632 + | ^^^^^^^^^^^^^^^^ 29 | pass 30 | if named_var is [i for i in [1]]: # F632 (fix) | = help: Replace `is` with `==` - ℹ Safe fix 25 25 | pass 26 26 | if named_var is [1]: # F632 (fix) @@ -292,16 +306,17 @@ constant_literals.py:28:4: F632 [*] Use `==` to compare constant literals 30 30 | if named_var is [i for i in [1]]: # F632 (fix) 31 31 | pass -constant_literals.py:30:4: F632 [*] Use `==` to compare constant literals +error[F632]: 30:4: [*] Use `==` to compare constant literals + + --> constant_literals.py:30:4 | 28 | if [1] is named_var: # F632 (fix) 29 | pass 30 | if named_var is [i for i in [1]]: # F632 (fix) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ F632 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 31 | pass | = help: Replace `is` with `==` - ℹ Safe fix 27 27 | pass 28 28 | if [1] is named_var: # F632 (fix) @@ -312,16 +327,17 @@ constant_literals.py:30:4: F632 [*] Use `==` to compare constant literals 32 32 | 33 33 | named_var = {} -constant_literals.py:34:4: F632 [*] Use `==` to compare constant literals +error[F632]: 34:4: [*] Use `==` to compare constant literals + + --> constant_literals.py:34:4 | 33 | named_var = {} 34 | if {} is {}: # F632 (fix) - | ^^^^^^^^ F632 + | ^^^^^^^^ 35 | pass 36 | if named_var is {}: # F632 (fix) | = help: Replace `is` with `==` - ℹ Safe fix 31 31 | pass 32 32 | @@ -332,17 +348,18 @@ constant_literals.py:34:4: F632 [*] Use `==` to compare constant literals 36 36 | if named_var is {}: # F632 (fix) 37 37 | pass -constant_literals.py:36:4: F632 [*] Use `==` to compare constant literals +error[F632]: 36:4: [*] Use `==` to compare constant literals + + --> constant_literals.py:36:4 | 34 | if {} is {}: # F632 (fix) 35 | pass 36 | if named_var is {}: # F632 (fix) - | ^^^^^^^^^^^^^^^ F632 + | ^^^^^^^^^^^^^^^ 37 | pass 38 | if {} is named_var: # F632 (fix) | = help: Replace `is` with `==` - ℹ Safe fix 33 33 | named_var = {} 34 34 | if {} is {}: # F632 (fix) @@ -353,17 +370,18 @@ constant_literals.py:36:4: F632 [*] Use `==` to compare constant literals 38 38 | if {} is named_var: # F632 (fix) 39 39 | pass -constant_literals.py:38:4: F632 [*] Use `==` to compare constant literals +error[F632]: 38:4: [*] Use `==` to compare constant literals + + --> constant_literals.py:38:4 | 36 | if named_var is {}: # F632 (fix) 37 | pass 38 | if {} is named_var: # F632 (fix) - | ^^^^^^^^^^^^^^^ F632 + | ^^^^^^^^^^^^^^^ 39 | pass 40 | if named_var is {1}: # F632 (fix) | = help: Replace `is` with `==` - ℹ Safe fix 35 35 | pass 36 36 | if named_var is {}: # F632 (fix) @@ -374,17 +392,18 @@ constant_literals.py:38:4: F632 [*] Use `==` to compare constant literals 40 40 | if named_var is {1}: # F632 (fix) 41 41 | pass -constant_literals.py:40:4: F632 [*] Use `==` to compare constant literals +error[F632]: 40:4: [*] Use `==` to compare constant literals + + --> constant_literals.py:40:4 | 38 | if {} is named_var: # F632 (fix) 39 | pass 40 | if named_var is {1}: # F632 (fix) - | ^^^^^^^^^^^^^^^^ F632 + | ^^^^^^^^^^^^^^^^ 41 | pass 42 | if {1} is named_var: # F632 (fix) | = help: Replace `is` with `==` - ℹ Safe fix 37 37 | pass 38 38 | if {} is named_var: # F632 (fix) @@ -395,17 +414,18 @@ constant_literals.py:40:4: F632 [*] Use `==` to compare constant literals 42 42 | if {1} is named_var: # F632 (fix) 43 43 | pass -constant_literals.py:42:4: F632 [*] Use `==` to compare constant literals +error[F632]: 42:4: [*] Use `==` to compare constant literals + + --> constant_literals.py:42:4 | 40 | if named_var is {1}: # F632 (fix) 41 | pass 42 | if {1} is named_var: # F632 (fix) - | ^^^^^^^^^^^^^^^^ F632 + | ^^^^^^^^^^^^^^^^ 43 | pass 44 | if named_var is {i for i in [1]}: # F632 (fix) | = help: Replace `is` with `==` - ℹ Safe fix 39 39 | pass 40 40 | if named_var is {1}: # F632 (fix) @@ -416,16 +436,17 @@ constant_literals.py:42:4: F632 [*] Use `==` to compare constant literals 44 44 | if named_var is {i for i in [1]}: # F632 (fix) 45 45 | pass -constant_literals.py:44:4: F632 [*] Use `==` to compare constant literals +error[F632]: 44:4: [*] Use `==` to compare constant literals + + --> constant_literals.py:44:4 | 42 | if {1} is named_var: # F632 (fix) 43 | pass 44 | if named_var is {i for i in [1]}: # F632 (fix) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ F632 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 45 | pass | = help: Replace `is` with `==` - ℹ Safe fix 41 41 | pass 42 42 | if {1} is named_var: # F632 (fix) @@ -436,16 +457,17 @@ constant_literals.py:44:4: F632 [*] Use `==` to compare constant literals 46 46 | 47 47 | named_var = {1: 1} -constant_literals.py:48:4: F632 [*] Use `==` to compare constant literals +error[F632]: 48:4: [*] Use `==` to compare constant literals + + --> constant_literals.py:48:4 | 47 | named_var = {1: 1} 48 | if {1: 1} is {1: 1}: # F632 (fix) - | ^^^^^^^^^^^^^^^^ F632 + | ^^^^^^^^^^^^^^^^ 49 | pass 50 | if named_var is {1: 1}: # F632 (fix) | = help: Replace `is` with `==` - ℹ Safe fix 45 45 | pass 46 46 | @@ -456,17 +478,18 @@ constant_literals.py:48:4: F632 [*] Use `==` to compare constant literals 50 50 | if named_var is {1: 1}: # F632 (fix) 51 51 | pass -constant_literals.py:50:4: F632 [*] Use `==` to compare constant literals +error[F632]: 50:4: [*] Use `==` to compare constant literals + + --> constant_literals.py:50:4 | 48 | if {1: 1} is {1: 1}: # F632 (fix) 49 | pass 50 | if named_var is {1: 1}: # F632 (fix) - | ^^^^^^^^^^^^^^^^^^^ F632 + | ^^^^^^^^^^^^^^^^^^^ 51 | pass 52 | if {1: 1} is named_var: # F632 (fix) | = help: Replace `is` with `==` - ℹ Safe fix 47 47 | named_var = {1: 1} 48 48 | if {1: 1} is {1: 1}: # F632 (fix) @@ -477,17 +500,18 @@ constant_literals.py:50:4: F632 [*] Use `==` to compare constant literals 52 52 | if {1: 1} is named_var: # F632 (fix) 53 53 | pass -constant_literals.py:52:4: F632 [*] Use `==` to compare constant literals +error[F632]: 52:4: [*] Use `==` to compare constant literals + + --> constant_literals.py:52:4 | 50 | if named_var is {1: 1}: # F632 (fix) 51 | pass 52 | if {1: 1} is named_var: # F632 (fix) - | ^^^^^^^^^^^^^^^^^^^ F632 + | ^^^^^^^^^^^^^^^^^^^ 53 | pass 54 | if named_var is {1: 1}: # F632 (fix) | = help: Replace `is` with `==` - ℹ Safe fix 49 49 | pass 50 50 | if named_var is {1: 1}: # F632 (fix) @@ -498,17 +522,18 @@ constant_literals.py:52:4: F632 [*] Use `==` to compare constant literals 54 54 | if named_var is {1: 1}: # F632 (fix) 55 55 | pass -constant_literals.py:54:4: F632 [*] Use `==` to compare constant literals +error[F632]: 54:4: [*] Use `==` to compare constant literals + + --> constant_literals.py:54:4 | 52 | if {1: 1} is named_var: # F632 (fix) 53 | pass 54 | if named_var is {1: 1}: # F632 (fix) - | ^^^^^^^^^^^^^^^^^^^ F632 + | ^^^^^^^^^^^^^^^^^^^ 55 | pass 56 | if {1: 1} is named_var: # F632 (fix) | = help: Replace `is` with `==` - ℹ Safe fix 51 51 | pass 52 52 | if {1: 1} is named_var: # F632 (fix) @@ -519,17 +544,18 @@ constant_literals.py:54:4: F632 [*] Use `==` to compare constant literals 56 56 | if {1: 1} is named_var: # F632 (fix) 57 57 | pass -constant_literals.py:56:4: F632 [*] Use `==` to compare constant literals +error[F632]: 56:4: [*] Use `==` to compare constant literals + + --> constant_literals.py:56:4 | 54 | if named_var is {1: 1}: # F632 (fix) 55 | pass 56 | if {1: 1} is named_var: # F632 (fix) - | ^^^^^^^^^^^^^^^^^^^ F632 + | ^^^^^^^^^^^^^^^^^^^ 57 | pass 58 | if named_var is {i: 1 for i in [1]}: # F632 (fix) | = help: Replace `is` with `==` - ℹ Safe fix 53 53 | pass 54 54 | if named_var is {1: 1}: # F632 (fix) @@ -540,16 +566,17 @@ constant_literals.py:56:4: F632 [*] Use `==` to compare constant literals 58 58 | if named_var is {i: 1 for i in [1]}: # F632 (fix) 59 59 | pass -constant_literals.py:58:4: F632 [*] Use `==` to compare constant literals +error[F632]: 58:4: [*] Use `==` to compare constant literals + + --> constant_literals.py:58:4 | 56 | if {1: 1} is named_var: # F632 (fix) 57 | pass 58 | if named_var is {i: 1 for i in [1]}: # F632 (fix) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ F632 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 59 | pass | = help: Replace `is` with `==` - ℹ Safe fix 55 55 | pass 56 56 | if {1: 1} is named_var: # F632 (fix) diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__max_doc_length.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__max_doc_length.snap index 62025a5236..18b1352d52 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__max_doc_length.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__max_doc_length.snap @@ -1,15 +1,17 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[W505]: W505.py:2:51: Doc line too long (57 > 50) +error[W505]: 2:51: Doc line too long (57 > 50) + --> W505.py:2:51 | 1 | #!/usr/bin/env python3 2 | """Here's a top-level docstring that's over the limit.""" | ^^^^^^^ | -error[W505]: W505.py:6:51: Doc line too long (56 > 50) +error[W505]: 6:51: Doc line too long (56 > 50) + --> W505.py:6:51 | 5 | def f1(): 6 | """Here's a docstring that's also over the limit.""" @@ -17,8 +19,9 @@ error[W505]: W505.py:6:51: Doc line too long (56 > 50) 7 | 8 | x = 1 # Here's a comment that's over the limit, but it's not standalone. | -error[W505]: W505.py:10:51: Doc line too long (56 > 50) +error[W505]: 10:51: Doc line too long (56 > 50) + --> W505.py:10:51 | 8 | x = 1 # Here's a comment that's over the limit, but it's not standalone. 9 | @@ -27,8 +30,9 @@ error[W505]: W505.py:10:51: Doc line too long (56 > 50) 11 | 12 | x = 2 | -error[W505]: W505.py:13:51: Doc line too long (94 > 50) +error[W505]: 13:51: Doc line too long (94 > 50) + --> W505.py:13:51 | 12 | x = 2 13 | # Another standalone that is preceded by a newline and indent token and is over the limit. @@ -36,14 +40,16 @@ error[W505]: W505.py:13:51: Doc line too long (94 > 50) 14 | 15 | print("Here's a string that's over the limit, but it's not a docstring.") | -error[W505]: W505.py:18:51: Doc line too long (61 > 50) +error[W505]: 18:51: Doc line too long (61 > 50) + --> W505.py:18:51 | 18 | "This is also considered a docstring, and is over the limit." | ^^^^^^^^^^^ | -error[W505]: W505.py:24:51: Doc line too long (82 > 50) +error[W505]: 24:51: Doc line too long (82 > 50) + --> W505.py:24:51 | 22 | """Here's a multi-line docstring. 23 | @@ -51,8 +57,9 @@ error[W505]: W505.py:24:51: Doc line too long (82 > 50) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 25 | """ | -error[W505]: W505.py:31:51: Doc line too long (85 > 50) +error[W505]: 31:51: Doc line too long (85 > 50) + --> W505.py:31:51 | 29 | """Here's a multi-line docstring. 30 | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__max_doc_length_with_utf_8.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__max_doc_length_with_utf_8.snap index 05bc57daf9..8962710840 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__max_doc_length_with_utf_8.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__max_doc_length_with_utf_8.snap @@ -1,15 +1,17 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[W505]: W505_utf_8.py:2:50: Doc line too long (57 > 50) +error[W505]: 2:50: Doc line too long (57 > 50) + --> W505_utf_8.py:2:50 | 1 | #!/usr/bin/env python3 2 | """Here's a top-level ß9💣2ℝing that's over theß9💣2ℝ.""" | ^^^^^^ | -error[W505]: W505_utf_8.py:6:49: Doc line too long (56 > 50) +error[W505]: 6:49: Doc line too long (56 > 50) + --> W505_utf_8.py:6:49 | 5 | def f1(): 6 | """Here's a ß9💣2ℝing that's also over theß9💣2ℝ.""" @@ -17,8 +19,9 @@ error[W505]: W505_utf_8.py:6:49: Doc line too long (56 > 50) 7 | 8 | x = 1 # Here's a comment that's over theß9💣2ℝ, but it's not standalone. | -error[W505]: W505_utf_8.py:10:51: Doc line too long (56 > 50) +error[W505]: 10:51: Doc line too long (56 > 50) + --> W505_utf_8.py:10:51 | 8 | x = 1 # Here's a comment that's over theß9💣2ℝ, but it's not standalone. 9 | @@ -27,8 +30,9 @@ error[W505]: W505_utf_8.py:10:51: Doc line too long (56 > 50) 11 | 12 | x = 2 | -error[W505]: W505_utf_8.py:13:51: Doc line too long (94 > 50) +error[W505]: 13:51: Doc line too long (94 > 50) + --> W505_utf_8.py:13:51 | 12 | x = 2 13 | # Another standalone that is preceded by a newline and indent token and is over theß9💣2ℝ. @@ -36,14 +40,16 @@ error[W505]: W505_utf_8.py:13:51: Doc line too long (94 > 50) 14 | 15 | print("Here's a string that's over theß9💣2ℝ, but it's not a ß9💣2ℝing.") | -error[W505]: W505_utf_8.py:18:50: Doc line too long (61 > 50) +error[W505]: 18:50: Doc line too long (61 > 50) + --> W505_utf_8.py:18:50 | 18 | "This is also considered a ß9💣2ℝing, and is over theß9💣2ℝ." | ^^^^^^^^^^^ | -error[W505]: W505_utf_8.py:24:50: Doc line too long (82 > 50) +error[W505]: 24:50: Doc line too long (82 > 50) + --> W505_utf_8.py:24:50 | 22 | """Here's a multi-line ß9💣2ℝing. 23 | @@ -51,8 +57,9 @@ error[W505]: W505_utf_8.py:24:50: Doc line too long (82 > 50) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 25 | """ | -error[W505]: W505_utf_8.py:31:50: Doc line too long (85 > 50) +error[W505]: 31:50: Doc line too long (85 > 50) + --> W505_utf_8.py:31:50 | 29 | """Here's a multi-line ß9💣2ℝing. 30 | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__preview__E502_E502.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__preview__E502_E502.py.snap index 5c86d53f20..b72089f8c1 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__preview__E502_E502.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__preview__E502_E502.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[E502]: E502.py:9:9: [*] Redundant backslash +error[E502]: 9:9: [*] Redundant backslash + --> E502.py:9:9 | 7 | + 4 8 | @@ -22,8 +23,9 @@ error[E502]: E502.py:9:9: [*] Redundant backslash 11 11 | 7) 12 12 | -error[E502]: E502.py:10:11: [*] Redundant backslash +error[E502]: 10:11: [*] Redundant backslash + --> E502.py:10:11 | 9 | a = (3 -\ 10 | 2 + \ @@ -41,8 +43,9 @@ error[E502]: E502.py:10:11: [*] Redundant backslash 12 12 | 13 13 | z = 5 + \ -error[E502]: E502.py:14:9: [*] Redundant backslash +error[E502]: 14:9: [*] Redundant backslash + --> E502.py:14:9 | 13 | z = 5 + \ 14 | (3 -\ @@ -61,8 +64,9 @@ error[E502]: E502.py:14:9: [*] Redundant backslash 16 16 | 7) + \ 17 17 | 4 -error[E502]: E502.py:15:11: [*] Redundant backslash +error[E502]: 15:11: [*] Redundant backslash + --> E502.py:15:11 | 13 | z = 5 + \ 14 | (3 -\ @@ -82,8 +86,9 @@ error[E502]: E502.py:15:11: [*] Redundant backslash 17 17 | 4 18 18 | -error[E502]: E502.py:23:17: [*] Redundant backslash +error[E502]: 23:17: [*] Redundant backslash + --> E502.py:23:17 | 22 | b = [ 23 | 2 + 4 + 5 + \ @@ -102,8 +107,9 @@ error[E502]: E502.py:23:17: [*] Redundant backslash 25 25 | - 5 26 26 | ] -error[E502]: E502.py:24:8: [*] Redundant backslash +error[E502]: 24:8: [*] Redundant backslash + --> E502.py:24:8 | 22 | b = [ 23 | 2 + 4 + 5 + \ @@ -123,8 +129,9 @@ error[E502]: E502.py:24:8: [*] Redundant backslash 26 26 | ] 27 27 | -error[E502]: E502.py:29:11: [*] Redundant backslash +error[E502]: 29:11: [*] Redundant backslash + --> E502.py:29:11 | 28 | c = (True and 29 | False \ @@ -143,8 +150,9 @@ error[E502]: E502.py:29:11: [*] Redundant backslash 31 31 | and True \ 32 32 | ) -error[E502]: E502.py:30:14: [*] Redundant backslash +error[E502]: 30:14: [*] Redundant backslash + --> E502.py:30:14 | 28 | c = (True and 29 | False \ @@ -164,8 +172,9 @@ error[E502]: E502.py:30:14: [*] Redundant backslash 32 32 | ) 33 33 | -error[E502]: E502.py:31:14: [*] Redundant backslash +error[E502]: 31:14: [*] Redundant backslash + --> E502.py:31:14 | 29 | False \ 30 | or False \ @@ -184,8 +193,9 @@ error[E502]: E502.py:31:14: [*] Redundant backslash 33 33 | 34 34 | c = (True and -error[E502]: E502.py:44:14: [*] Redundant backslash +error[E502]: 44:14: [*] Redundant backslash + --> E502.py:44:14 | 43 | s = { 44 | 'x': 2 + \ @@ -204,8 +214,9 @@ error[E502]: E502.py:44:14: [*] Redundant backslash 46 46 | } 47 47 | -error[E502]: E502.py:55:12: [*] Redundant backslash +error[E502]: 55:12: [*] Redundant backslash + --> E502.py:55:12 | 55 | x = {2 + 4 \ | ^ @@ -222,8 +233,9 @@ error[E502]: E502.py:55:12: [*] Redundant backslash 57 57 | 58 58 | y = ( -error[E502]: E502.py:61:9: [*] Redundant backslash +error[E502]: 61:9: [*] Redundant backslash + --> E502.py:61:9 | 59 | 2 + 2 # \ 60 | + 3 # \ @@ -243,8 +255,9 @@ error[E502]: E502.py:61:9: [*] Redundant backslash 63 63 | ) 64 64 | -error[E502]: E502.py:82:12: [*] Redundant backslash +error[E502]: 82:12: [*] Redundant backslash + --> E502.py:82:12 | 80 | "xyz" 81 | @@ -263,8 +276,9 @@ error[E502]: E502.py:82:12: [*] Redundant backslash 84 84 | 85 85 | -error[E502]: E502.py:87:14: [*] Redundant backslash +error[E502]: 87:14: [*] Redundant backslash + --> E502.py:87:14 | 86 | def foo(): 87 | x = (a + \ diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__preview__W391_W391_0.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__preview__W391_W391_0.py.snap index 791713fa4d..4f022064f5 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__preview__W391_W391_0.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__preview__W391_W391_0.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[W391]: W391_0.py:14:1: [*] Extra newline at end of file +error[W391]: 14:1: [*] Extra newline at end of file + --> W391_0.py:13:10 | 12 | foo() 13 | bar() diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__preview__W391_W391_2.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__preview__W391_W391_2.py.snap index dfe179fecf..693ba09166 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__preview__W391_W391_2.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__preview__W391_W391_2.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[W391]: W391_2.py:14:1: [*] Too many newlines at end of file +error[W391]: 14:1: [*] Too many newlines at end of file + --> W391_2.py:13:10 | 12 | foo() 13 | bar() @@ -10,6 +11,7 @@ error[W391]: W391_2.py:14:1: [*] Too many newlines at end of file 15 | | 16 | | 17 | | + | |__^ | = help: Remove trailing newlines ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__shebang.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__shebang.snap index e4562ef829..058a6a08e0 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__shebang.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__shebang.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[E265]: shebang.py:3:1: [*] Block comment should start with `# ` +error[E265]: 3:1: [*] Block comment should start with `# ` + --> shebang.py:2:2 | 1 | #!/usr/bin/python 2 | # diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__tab_size_1.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__tab_size_1.snap index 3e140ae717..cafe2477a7 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__tab_size_1.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__tab_size_1.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[E501]: E501_2.py:2:7: Line too long (7 > 6) +error[E501]: 2:7: Line too long (7 > 6) + --> E501_2.py:2:7 | 1 | # aaaa 2 | # aaaaa @@ -10,8 +11,9 @@ error[E501]: E501_2.py:2:7: Line too long (7 > 6) 3 | # a 4 | # a | -error[E501]: E501_2.py:3:7: Line too long (7 > 6) +error[E501]: 3:7: Line too long (7 > 6) + --> E501_2.py:3:7 | 1 | # aaaa 2 | # aaaaa @@ -20,8 +22,9 @@ error[E501]: E501_2.py:3:7: Line too long (7 > 6) 4 | # a 5 | # aa | -error[E501]: E501_2.py:7:7: Line too long (7 > 6) +error[E501]: 7:7: Line too long (7 > 6) + --> E501_2.py:7:10 | 5 | # aa 6 | # aaa @@ -30,8 +33,9 @@ error[E501]: E501_2.py:7:7: Line too long (7 > 6) 8 | # a 9 | # aa | -error[E501]: E501_2.py:10:7: Line too long (7 > 6) +error[E501]: 10:7: Line too long (7 > 6) + --> E501_2.py:10:13 | 8 | # a 9 | # aa @@ -40,8 +44,9 @@ error[E501]: E501_2.py:10:7: Line too long (7 > 6) 11 | 12 | if True: # noqa: E501 | -error[E501]: E501_2.py:16:7: Line too long (7 > 6) +error[E501]: 16:7: Line too long (7 > 6) + --> E501_2.py:16:10 | 14 | [12 ] 15 | [1,2] diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__tab_size_2.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__tab_size_2.snap index c43f64f714..3cb8a6271e 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__tab_size_2.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__tab_size_2.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[E501]: E501_2.py:2:7: Line too long (7 > 6) +error[E501]: 2:7: Line too long (7 > 6) + --> E501_2.py:2:7 | 1 | # aaaa 2 | # aaaaa @@ -10,8 +11,9 @@ error[E501]: E501_2.py:2:7: Line too long (7 > 6) 3 | # a 4 | # a | -error[E501]: E501_2.py:3:7: Line too long (7 > 6) +error[E501]: 3:7: Line too long (7 > 6) + --> E501_2.py:3:7 | 1 | # aaaa 2 | # aaaaa @@ -20,8 +22,9 @@ error[E501]: E501_2.py:3:7: Line too long (7 > 6) 4 | # a 5 | # aa | -error[E501]: E501_2.py:6:6: Line too long (7 > 6) +error[E501]: 6:6: Line too long (7 > 6) + --> E501_2.py:6:9 | 4 | # a 5 | # aa @@ -30,8 +33,9 @@ error[E501]: E501_2.py:6:6: Line too long (7 > 6) 7 | # aaaa 8 | # a | -error[E501]: E501_2.py:7:6: Line too long (8 > 6) +error[E501]: 7:6: Line too long (8 > 6) + --> E501_2.py:7:9 | 5 | # aa 6 | # aaa @@ -40,8 +44,9 @@ error[E501]: E501_2.py:7:6: Line too long (8 > 6) 8 | # a 9 | # aa | -error[E501]: E501_2.py:8:5: Line too long (7 > 6) +error[E501]: 8:5: Line too long (7 > 6) + --> E501_2.py:8:11 | 6 | # aaa 7 | # aaaa @@ -50,8 +55,9 @@ error[E501]: E501_2.py:8:5: Line too long (7 > 6) 9 | # aa 10 | # aaa | -error[E501]: E501_2.py:9:5: Line too long (8 > 6) +error[E501]: 9:5: Line too long (8 > 6) + --> E501_2.py:9:11 | 7 | # aaaa 8 | # a @@ -59,8 +65,9 @@ error[E501]: E501_2.py:9:5: Line too long (8 > 6) | ^^ 10 | # aaa | -error[E501]: E501_2.py:10:5: Line too long (9 > 6) +error[E501]: 10:5: Line too long (9 > 6) + --> E501_2.py:10:11 | 8 | # a 9 | # aa @@ -69,8 +76,9 @@ error[E501]: E501_2.py:10:5: Line too long (9 > 6) 11 | 12 | if True: # noqa: E501 | -error[E501]: E501_2.py:14:6: Line too long (7 > 6) +error[E501]: 14:6: Line too long (7 > 6) + --> E501_2.py:14:9 | 12 | if True: # noqa: E501 13 | [12] @@ -79,8 +87,9 @@ error[E501]: E501_2.py:14:6: Line too long (7 > 6) 15 | [1,2] 16 | [1, 2] | -error[E501]: E501_2.py:16:6: Line too long (8 > 6) +error[E501]: 16:6: Line too long (8 > 6) + --> E501_2.py:16:9 | 14 | [12 ] 15 | [1,2] diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__tab_size_4.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__tab_size_4.snap index be0613f1ea..86c6a87156 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__tab_size_4.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__tab_size_4.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[E501]: E501_2.py:2:7: Line too long (7 > 6) +error[E501]: 2:7: Line too long (7 > 6) + --> E501_2.py:2:7 | 1 | # aaaa 2 | # aaaaa @@ -10,8 +11,9 @@ error[E501]: E501_2.py:2:7: Line too long (7 > 6) 3 | # a 4 | # a | -error[E501]: E501_2.py:3:7: Line too long (7 > 6) +error[E501]: 3:7: Line too long (7 > 6) + --> E501_2.py:3:7 | 1 | # aaaa 2 | # aaaaa @@ -20,8 +22,9 @@ error[E501]: E501_2.py:3:7: Line too long (7 > 6) 4 | # a 5 | # aa | -error[E501]: E501_2.py:4:4: Line too long (7 > 6) +error[E501]: 4:4: Line too long (7 > 6) + --> E501_2.py:4:7 | 2 | # aaaaa 3 | # a @@ -30,8 +33,9 @@ error[E501]: E501_2.py:4:4: Line too long (7 > 6) 5 | # aa 6 | # aaa | -error[E501]: E501_2.py:5:4: Line too long (8 > 6) +error[E501]: 5:4: Line too long (8 > 6) + --> E501_2.py:5:7 | 3 | # a 4 | # a @@ -40,8 +44,9 @@ error[E501]: E501_2.py:5:4: Line too long (8 > 6) 6 | # aaa 7 | # aaaa | -error[E501]: E501_2.py:6:4: Line too long (9 > 6) +error[E501]: 6:4: Line too long (9 > 6) + --> E501_2.py:6:7 | 4 | # a 5 | # aa @@ -50,8 +55,9 @@ error[E501]: E501_2.py:6:4: Line too long (9 > 6) 7 | # aaaa 8 | # a | -error[E501]: E501_2.py:7:4: Line too long (10 > 6) +error[E501]: 7:4: Line too long (10 > 6) + --> E501_2.py:7:7 | 5 | # aa 6 | # aaa @@ -60,8 +66,9 @@ error[E501]: E501_2.py:7:4: Line too long (10 > 6) 8 | # a 9 | # aa | -error[E501]: E501_2.py:8:3: Line too long (11 > 6) +error[E501]: 8:3: Line too long (11 > 6) + --> E501_2.py:8:9 | 6 | # aaa 7 | # aaaa @@ -70,8 +77,9 @@ error[E501]: E501_2.py:8:3: Line too long (11 > 6) 9 | # aa 10 | # aaa | -error[E501]: E501_2.py:9:3: Line too long (12 > 6) +error[E501]: 9:3: Line too long (12 > 6) + --> E501_2.py:9:9 | 7 | # aaaa 8 | # a @@ -79,8 +87,9 @@ error[E501]: E501_2.py:9:3: Line too long (12 > 6) | ^^^^ 10 | # aaa | -error[E501]: E501_2.py:10:3: Line too long (13 > 6) +error[E501]: 10:3: Line too long (13 > 6) + --> E501_2.py:10:9 | 8 | # a 9 | # aa @@ -89,8 +98,9 @@ error[E501]: E501_2.py:10:3: Line too long (13 > 6) 11 | 12 | if True: # noqa: E501 | -error[E501]: E501_2.py:14:4: Line too long (9 > 6) +error[E501]: 14:4: Line too long (9 > 6) + --> E501_2.py:14:7 | 12 | if True: # noqa: E501 13 | [12] @@ -99,8 +109,9 @@ error[E501]: E501_2.py:14:4: Line too long (9 > 6) 15 | [1,2] 16 | [1, 2] | -error[E501]: E501_2.py:16:4: Line too long (10 > 6) +error[E501]: 16:4: Line too long (10 > 6) + --> E501_2.py:16:7 | 14 | [12 ] 15 | [1,2] diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__tab_size_8.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__tab_size_8.snap index 72813a37b9..623dc23dda 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__tab_size_8.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__tab_size_8.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[E501]: E501_2.py:2:7: Line too long (7 > 6) +error[E501]: 2:7: Line too long (7 > 6) + --> E501_2.py:2:7 | 1 | # aaaa 2 | # aaaaa @@ -10,8 +11,9 @@ error[E501]: E501_2.py:2:7: Line too long (7 > 6) 3 | # a 4 | # a | -error[E501]: E501_2.py:3:7: Line too long (7 > 6) +error[E501]: 3:7: Line too long (7 > 6) + --> E501_2.py:3:7 | 1 | # aaaa 2 | # aaaaa @@ -20,8 +22,9 @@ error[E501]: E501_2.py:3:7: Line too long (7 > 6) 4 | # a 5 | # aa | -error[E501]: E501_2.py:4:2: Line too long (11 > 6) +error[E501]: 4:2: Line too long (11 > 6) + --> E501_2.py:4:5 | 2 | # aaaaa 3 | # a @@ -30,8 +33,9 @@ error[E501]: E501_2.py:4:2: Line too long (11 > 6) 5 | # aa 6 | # aaa | -error[E501]: E501_2.py:5:2: Line too long (12 > 6) +error[E501]: 5:2: Line too long (12 > 6) + --> E501_2.py:5:5 | 3 | # a 4 | # a @@ -40,8 +44,9 @@ error[E501]: E501_2.py:5:2: Line too long (12 > 6) 6 | # aaa 7 | # aaaa | -error[E501]: E501_2.py:6:2: Line too long (13 > 6) +error[E501]: 6:2: Line too long (13 > 6) + --> E501_2.py:6:5 | 4 | # a 5 | # aa @@ -50,8 +55,9 @@ error[E501]: E501_2.py:6:2: Line too long (13 > 6) 7 | # aaaa 8 | # a | -error[E501]: E501_2.py:7:2: Line too long (14 > 6) +error[E501]: 7:2: Line too long (14 > 6) + --> E501_2.py:7:5 | 5 | # aa 6 | # aaa @@ -60,8 +66,9 @@ error[E501]: E501_2.py:7:2: Line too long (14 > 6) 8 | # a 9 | # aa | -error[E501]: E501_2.py:8:2: Line too long (19 > 6) +error[E501]: 8:2: Line too long (19 > 6) + --> E501_2.py:8:5 | 6 | # aaa 7 | # aaaa @@ -70,8 +77,9 @@ error[E501]: E501_2.py:8:2: Line too long (19 > 6) 9 | # aa 10 | # aaa | -error[E501]: E501_2.py:9:2: Line too long (20 > 6) +error[E501]: 9:2: Line too long (20 > 6) + --> E501_2.py:9:5 | 7 | # aaaa 8 | # a @@ -79,8 +87,9 @@ error[E501]: E501_2.py:9:2: Line too long (20 > 6) | ^^^^^^^^ 10 | # aaa | -error[E501]: E501_2.py:10:2: Line too long (21 > 6) +error[E501]: 10:2: Line too long (21 > 6) + --> E501_2.py:10:5 | 8 | # a 9 | # aa @@ -89,8 +98,9 @@ error[E501]: E501_2.py:10:2: Line too long (21 > 6) 11 | 12 | if True: # noqa: E501 | -error[E501]: E501_2.py:14:2: Line too long (13 > 6) +error[E501]: 14:2: Line too long (13 > 6) + --> E501_2.py:14:5 | 12 | if True: # noqa: E501 13 | [12] @@ -99,8 +109,9 @@ error[E501]: E501_2.py:14:2: Line too long (13 > 6) 15 | [1,2] 16 | [1, 2] | -error[E501]: E501_2.py:16:2: Line too long (14 > 6) +error[E501]: 16:2: Line too long (14 > 6) + --> E501_2.py:16:5 | 14 | [12 ] 15 | [1,2] diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__task_tags_false.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__task_tags_false.snap index 583a764212..1b04973794 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__task_tags_false.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__task_tags_false.snap @@ -1,16 +1,18 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[E501]: E501_1.py:1:89: Line too long (149 > 88) +error[E501]: 1:89: Line too long (149 > 88) + --> E501_1.py:1:89 | 1 | ...ask-tags sometimes are longer than line-length so that you can easily find them with `git grep` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2 | ...figured task-tags sometimes are longer than line-length so that you can easily find them with `git grep` 3 | ...sk-tags sometimes are longer than line-length so that you can easily find them with `git grep` | -error[E501]: E501_1.py:2:89: Line too long (158 > 88) +error[E501]: 2:89: Line too long (158 > 88) + --> E501_1.py:2:89 | 1 | ...tags sometimes are longer than line-length so that you can easily find them with `git grep` 2 | ...red task-tags sometimes are longer than line-length so that you can easily find them with `git grep` @@ -18,8 +20,9 @@ error[E501]: E501_1.py:2:89: Line too long (158 > 88) 3 | ...ags sometimes are longer than line-length so that you can easily find them with `git grep` 4 | ... task-tags sometimes are longer than line-length so that you can easily find them with `git grep` | -error[E501]: E501_1.py:3:89: Line too long (148 > 88) +error[E501]: 3:89: Line too long (148 > 88) + --> E501_1.py:3:89 | 1 | ...task-tags sometimes are longer than line-length so that you can easily find them with `git grep` 2 | ...nfigured task-tags sometimes are longer than line-length so that you can easily find them with `git grep` @@ -28,8 +31,9 @@ error[E501]: E501_1.py:3:89: Line too long (148 > 88) 4 | ...gured task-tags sometimes are longer than line-length so that you can easily find them with `git grep` 5 | ... task-tags sometimes are longer than line-length so that you can easily find them with `git grep` | -error[E501]: E501_1.py:4:89: Line too long (155 > 88) +error[E501]: 4:89: Line too long (155 > 88) + --> E501_1.py:4:89 | 2 | ...ured task-tags sometimes are longer than line-length so that you can easily find them with `git grep` 3 | ...tags sometimes are longer than line-length so that you can easily find them with `git grep` @@ -38,8 +42,9 @@ error[E501]: E501_1.py:4:89: Line too long (155 > 88) 5 | ...k-tags sometimes are longer than line-length so that you can easily find them with `git grep` 6 | ...-tags sometimes are longer than line-length so that you can easily find them with `git grep` | -error[E501]: E501_1.py:5:89: Line too long (150 > 88) +error[E501]: 5:89: Line too long (150 > 88) + --> E501_1.py:5:89 | 3 | ...sk-tags sometimes are longer than line-length so that you can easily find them with `git grep` 4 | ...ured task-tags sometimes are longer than line-length so that you can easily find them with `git grep` @@ -48,8 +53,9 @@ error[E501]: E501_1.py:5:89: Line too long (150 > 88) 6 | ...ask-tags sometimes are longer than line-length so that you can easily find them with `git grep` 7 | ...gured task-tags sometimes are longer than line-length so that you can easily find them with `git grep` | -error[E501]: E501_1.py:6:89: Line too long (149 > 88) +error[E501]: 6:89: Line too long (149 > 88) + --> E501_1.py:6:89 | 4 | ...ured task-tags sometimes are longer than line-length so that you can easily find them with `git grep` 5 | ...task-tags sometimes are longer than line-length so that you can easily find them with `git grep` @@ -58,8 +64,9 @@ error[E501]: E501_1.py:6:89: Line too long (149 > 88) 7 | ...gured task-tags sometimes are longer than line-length so that you can easily find them with `git grep` 8 | ...nfigured task-tags sometimes are longer than line-length so that you can easily find them with `git grep` | -error[E501]: E501_1.py:7:89: Line too long (156 > 88) +error[E501]: 7:89: Line too long (156 > 88) + --> E501_1.py:7:89 | 5 | ...k-tags sometimes are longer than line-length so that you can easily find them with `git grep` 6 | ...-tags sometimes are longer than line-length so that you can easily find them with `git grep` @@ -67,8 +74,9 @@ error[E501]: E501_1.py:7:89: Line too long (156 > 88) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 8 | ...gured task-tags sometimes are longer than line-length so that you can easily find them with `git grep` | -error[E501]: E501_1.py:8:89: Line too long (159 > 88) +error[E501]: 8:89: Line too long (159 > 88) + --> E501_1.py:8:89 | 6 | ...ags sometimes are longer than line-length so that you can easily find them with `git grep` 7 | ... task-tags sometimes are longer than line-length so that you can easily find them with `git grep` diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__too_many_blank_lines_isort_compatibility-lines-after(-1)-between(0).snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__too_many_blank_lines_isort_compatibility-lines-after(-1)-between(0).snap index 090223a71a..2d0434c620 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__too_many_blank_lines_isort_compatibility-lines-after(-1)-between(0).snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__too_many_blank_lines_isort_compatibility-lines-after(-1)-between(0).snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[I001]: E30_isort.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> E30_isort.py:1:1 | 1 | / import json 2 | | @@ -11,8 +12,8 @@ error[I001]: E30_isort.py:1:1: [*] Import block is un-sorted or un-formatted 5 | | from typing import Any, Sequence 6 | | 7 | | -8 | | class MissingCommand(TypeError): ... # noqa: N818 - | |_^ + | |__^ +8 | class MissingCommand(TypeError): ... # noqa: N818 | = help: Organize imports ℹ Safe fix @@ -24,8 +25,9 @@ error[I001]: E30_isort.py:1:1: [*] Import block is un-sorted or un-formatted 6 3 | 7 4 | -error[E303]: E30_isort.py:5:1: [*] Too many blank lines (3) +error[E303]: 5:1: [*] Too many blank lines (3) + --> E30_isort.py:5:1 | 5 | from typing import Any, Sequence | ^^^^ @@ -40,8 +42,9 @@ error[E303]: E30_isort.py:5:1: [*] Too many blank lines (3) 6 5 | 7 6 | -error[E303]: E30_isort.py:21:5: [*] Too many blank lines (2) +error[E303]: 21:5: [*] Too many blank lines (2) + --> E30_isort.py:21:5 | 21 | abcd.foo() | ^^^^ @@ -58,8 +61,9 @@ error[E303]: E30_isort.py:21:5: [*] Too many blank lines (2) 22 21 | 23 22 | def __init__(self, backend_module: str, backend_obj: str | None) -> None: ... -error[I001]: E30_isort.py:26:1: [*] Import block is un-sorted or un-formatted +error[I001]: 26:1: [*] Import block is un-sorted or un-formatted + --> E30_isort.py:25:18 | 25 | if TYPE_CHECKING: 26 | / import os @@ -67,8 +71,8 @@ error[I001]: E30_isort.py:26:1: [*] Import block is un-sorted or un-formatted 28 | | 29 | | 30 | | from typing_extensions import TypeAlias -31 | | - | |_^ + | |____________________________________________^ +31 | 32 | 33 | abcd.foo() | @@ -83,8 +87,9 @@ error[I001]: E30_isort.py:26:1: [*] Import block is un-sorted or un-formatted 31 29 | 32 30 | -error[E303]: E30_isort.py:30:5: [*] Too many blank lines (3) +error[E303]: 30:5: [*] Too many blank lines (3) + --> E30_isort.py:30:5 | 30 | from typing_extensions import TypeAlias | ^^^^ @@ -100,8 +105,9 @@ error[E303]: E30_isort.py:30:5: [*] Too many blank lines (3) 31 29 | 32 30 | -error[E303]: E30_isort.py:33:5: [*] Too many blank lines (2) +error[E303]: 33:5: [*] Too many blank lines (2) + --> E30_isort.py:33:5 | 33 | abcd.foo() | ^^^^ @@ -118,13 +124,14 @@ error[E303]: E30_isort.py:33:5: [*] Too many blank lines (2) 34 33 | 35 34 | def __call__(self, name: str, *args: Any, **kwargs: Any) -> Any: -error[I001]: E30_isort.py:60:1: [*] Import block is un-sorted or un-formatted +error[I001]: 60:1: [*] Import block is un-sorted or un-formatted + --> E30_isort.py:60:1 | 60 | / from typing import Any, Sequence 61 | | -62 | | class MissingCommand(TypeError): ... # noqa: N818 - | |_^ + | |__^ +62 | class MissingCommand(TypeError): ... # noqa: N818 | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__too_many_blank_lines_isort_compatibility-lines-after(0)-between(0).snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__too_many_blank_lines_isort_compatibility-lines-after(0)-between(0).snap index 321dddf164..6a8cf61420 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__too_many_blank_lines_isort_compatibility-lines-after(0)-between(0).snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__too_many_blank_lines_isort_compatibility-lines-after(0)-between(0).snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[I001]: E30_isort.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> E30_isort.py:1:1 | 1 | / import json 2 | | @@ -11,8 +12,8 @@ error[I001]: E30_isort.py:1:1: [*] Import block is un-sorted or un-formatted 5 | | from typing import Any, Sequence 6 | | 7 | | -8 | | class MissingCommand(TypeError): ... # noqa: N818 - | |_^ + | |__^ +8 | class MissingCommand(TypeError): ... # noqa: N818 | = help: Organize imports ℹ Safe fix @@ -27,8 +28,9 @@ error[I001]: E30_isort.py:1:1: [*] Import block is un-sorted or un-formatted 9 4 | 10 5 | -error[E303]: E30_isort.py:5:1: [*] Too many blank lines (3) +error[E303]: 5:1: [*] Too many blank lines (3) + --> E30_isort.py:5:1 | 5 | from typing import Any, Sequence | ^^^^ @@ -43,8 +45,9 @@ error[E303]: E30_isort.py:5:1: [*] Too many blank lines (3) 6 5 | 7 6 | -error[E303]: E30_isort.py:8:1: [*] Too many blank lines (2) +error[E303]: 8:1: [*] Too many blank lines (2) + --> E30_isort.py:8:1 | 8 | class MissingCommand(TypeError): ... # noqa: N818 | ^^^^^ @@ -60,8 +63,9 @@ error[E303]: E30_isort.py:8:1: [*] Too many blank lines (2) 9 7 | 10 8 | -error[E303]: E30_isort.py:21:5: [*] Too many blank lines (2) +error[E303]: 21:5: [*] Too many blank lines (2) + --> E30_isort.py:21:5 | 21 | abcd.foo() | ^^^^ @@ -78,8 +82,9 @@ error[E303]: E30_isort.py:21:5: [*] Too many blank lines (2) 22 21 | 23 22 | def __init__(self, backend_module: str, backend_obj: str | None) -> None: ... -error[I001]: E30_isort.py:26:1: [*] Import block is un-sorted or un-formatted +error[I001]: 26:1: [*] Import block is un-sorted or un-formatted + --> E30_isort.py:25:18 | 25 | if TYPE_CHECKING: 26 | / import os @@ -87,8 +92,8 @@ error[I001]: E30_isort.py:26:1: [*] Import block is un-sorted or un-formatted 28 | | 29 | | 30 | | from typing_extensions import TypeAlias -31 | | - | |_^ + | |____________________________________________^ +31 | 32 | 33 | abcd.foo() | @@ -103,8 +108,9 @@ error[I001]: E30_isort.py:26:1: [*] Import block is un-sorted or un-formatted 31 29 | 32 30 | -error[E303]: E30_isort.py:30:5: [*] Too many blank lines (3) +error[E303]: 30:5: [*] Too many blank lines (3) + --> E30_isort.py:30:5 | 30 | from typing_extensions import TypeAlias | ^^^^ @@ -120,8 +126,9 @@ error[E303]: E30_isort.py:30:5: [*] Too many blank lines (3) 31 29 | 32 30 | -error[E303]: E30_isort.py:33:5: [*] Too many blank lines (2) +error[E303]: 33:5: [*] Too many blank lines (2) + --> E30_isort.py:33:5 | 33 | abcd.foo() | ^^^^ @@ -138,13 +145,14 @@ error[E303]: E30_isort.py:33:5: [*] Too many blank lines (2) 34 33 | 35 34 | def __call__(self, name: str, *args: Any, **kwargs: Any) -> Any: -error[I001]: E30_isort.py:60:1: [*] Import block is un-sorted or un-formatted +error[I001]: 60:1: [*] Import block is un-sorted or un-formatted + --> E30_isort.py:60:1 | 60 | / from typing import Any, Sequence 61 | | -62 | | class MissingCommand(TypeError): ... # noqa: N818 - | |_^ + | |__^ +62 | class MissingCommand(TypeError): ... # noqa: N818 | = help: Organize imports ℹ Safe fix @@ -154,8 +162,9 @@ error[I001]: E30_isort.py:60:1: [*] Import block is un-sorted or un-formatted 61 |- 62 61 | class MissingCommand(TypeError): ... # noqa: N818 -error[E303]: E30_isort.py:62:1: [*] Too many blank lines (1) +error[E303]: 62:1: [*] Too many blank lines (1) + --> E30_isort.py:61:1 | 60 | from typing import Any, Sequence 61 | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__too_many_blank_lines_isort_compatibility-lines-after(1)-between(1).snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__too_many_blank_lines_isort_compatibility-lines-after(1)-between(1).snap index 639e529ce0..488ce9e917 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__too_many_blank_lines_isort_compatibility-lines-after(1)-between(1).snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__too_many_blank_lines_isort_compatibility-lines-after(1)-between(1).snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[I001]: E30_isort.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> E30_isort.py:1:1 | 1 | / import json 2 | | @@ -11,8 +12,8 @@ error[I001]: E30_isort.py:1:1: [*] Import block is un-sorted or un-formatted 5 | | from typing import Any, Sequence 6 | | 7 | | -8 | | class MissingCommand(TypeError): ... # noqa: N818 - | |_^ + | |__^ +8 | class MissingCommand(TypeError): ... # noqa: N818 | = help: Organize imports ℹ Safe fix @@ -26,8 +27,9 @@ error[I001]: E30_isort.py:1:1: [*] Import block is un-sorted or un-formatted 8 5 | class MissingCommand(TypeError): ... # noqa: N818 9 6 | -error[E303]: E30_isort.py:5:1: [*] Too many blank lines (3) +error[E303]: 5:1: [*] Too many blank lines (3) + --> E30_isort.py:5:1 | 5 | from typing import Any, Sequence | ^^^^ @@ -42,8 +44,9 @@ error[E303]: E30_isort.py:5:1: [*] Too many blank lines (3) 6 5 | 7 6 | -error[E303]: E30_isort.py:8:1: [*] Too many blank lines (2) +error[E303]: 8:1: [*] Too many blank lines (2) + --> E30_isort.py:8:1 | 8 | class MissingCommand(TypeError): ... # noqa: N818 | ^^^^^ @@ -58,8 +61,9 @@ error[E303]: E30_isort.py:8:1: [*] Too many blank lines (2) 9 8 | 10 9 | -error[E303]: E30_isort.py:21:5: [*] Too many blank lines (2) +error[E303]: 21:5: [*] Too many blank lines (2) + --> E30_isort.py:21:5 | 21 | abcd.foo() | ^^^^ @@ -76,8 +80,9 @@ error[E303]: E30_isort.py:21:5: [*] Too many blank lines (2) 22 21 | 23 22 | def __init__(self, backend_module: str, backend_obj: str | None) -> None: ... -error[I001]: E30_isort.py:26:1: [*] Import block is un-sorted or un-formatted +error[I001]: 26:1: [*] Import block is un-sorted or un-formatted + --> E30_isort.py:25:18 | 25 | if TYPE_CHECKING: 26 | / import os @@ -85,8 +90,8 @@ error[I001]: E30_isort.py:26:1: [*] Import block is un-sorted or un-formatted 28 | | 29 | | 30 | | from typing_extensions import TypeAlias -31 | | - | |_^ + | |____________________________________________^ +31 | 32 | 33 | abcd.foo() | @@ -101,8 +106,9 @@ error[I001]: E30_isort.py:26:1: [*] Import block is un-sorted or un-formatted 31 29 | 32 30 | -error[E303]: E30_isort.py:30:5: [*] Too many blank lines (3) +error[E303]: 30:5: [*] Too many blank lines (3) + --> E30_isort.py:30:5 | 30 | from typing_extensions import TypeAlias | ^^^^ @@ -118,8 +124,9 @@ error[E303]: E30_isort.py:30:5: [*] Too many blank lines (3) 31 29 | 32 30 | -error[E303]: E30_isort.py:33:5: [*] Too many blank lines (2) +error[E303]: 33:5: [*] Too many blank lines (2) + --> E30_isort.py:33:5 | 33 | abcd.foo() | ^^^^ diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__too_many_blank_lines_isort_compatibility-lines-after(4)-between(4).snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__too_many_blank_lines_isort_compatibility-lines-after(4)-between(4).snap index cbdc0c9122..3ae7448531 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__too_many_blank_lines_isort_compatibility-lines-after(4)-between(4).snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__too_many_blank_lines_isort_compatibility-lines-after(4)-between(4).snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[I001]: E30_isort.py:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: 1:1: [*] Import block is un-sorted or un-formatted + --> E30_isort.py:1:1 | 1 | / import json 2 | | @@ -11,8 +12,8 @@ error[I001]: E30_isort.py:1:1: [*] Import block is un-sorted or un-formatted 5 | | from typing import Any, Sequence 6 | | 7 | | -8 | | class MissingCommand(TypeError): ... # noqa: N818 - | |_^ + | |__^ +8 | class MissingCommand(TypeError): ... # noqa: N818 | = help: Organize imports ℹ Safe fix @@ -29,8 +30,9 @@ error[I001]: E30_isort.py:1:1: [*] Import block is un-sorted or un-formatted 9 12 | 10 13 | -error[E303]: E30_isort.py:21:5: [*] Too many blank lines (2) +error[E303]: 21:5: [*] Too many blank lines (2) + --> E30_isort.py:21:5 | 21 | abcd.foo() | ^^^^ @@ -47,8 +49,9 @@ error[E303]: E30_isort.py:21:5: [*] Too many blank lines (2) 22 21 | 23 22 | def __init__(self, backend_module: str, backend_obj: str | None) -> None: ... -error[I001]: E30_isort.py:26:1: [*] Import block is un-sorted or un-formatted +error[I001]: 26:1: [*] Import block is un-sorted or un-formatted + --> E30_isort.py:25:18 | 25 | if TYPE_CHECKING: 26 | / import os @@ -56,8 +59,8 @@ error[I001]: E30_isort.py:26:1: [*] Import block is un-sorted or un-formatted 28 | | 29 | | 30 | | from typing_extensions import TypeAlias -31 | | - | |_^ + | |____________________________________________^ +31 | 32 | 33 | abcd.foo() | @@ -72,8 +75,9 @@ error[I001]: E30_isort.py:26:1: [*] Import block is un-sorted or un-formatted 31 29 | 32 30 | -error[E303]: E30_isort.py:33:5: [*] Too many blank lines (2) +error[E303]: 33:5: [*] Too many blank lines (2) + --> E30_isort.py:33:5 | 33 | abcd.foo() | ^^^^ @@ -90,13 +94,14 @@ error[E303]: E30_isort.py:33:5: [*] Too many blank lines (2) 34 33 | 35 34 | def __call__(self, name: str, *args: Any, **kwargs: Any) -> Any: -error[I001]: E30_isort.py:60:1: [*] Import block is un-sorted or un-formatted +error[I001]: 60:1: [*] Import block is un-sorted or un-formatted + --> E30_isort.py:60:1 | 60 | / from typing import Any, Sequence 61 | | -62 | | class MissingCommand(TypeError): ... # noqa: N818 - | |_^ + | |__^ +62 | class MissingCommand(TypeError): ... # noqa: N818 | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__w292_4.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__w292_4.snap index 1062d773de..5281d3ed42 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__w292_4.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__w292_4.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -error[W292]: W292_4.py:1:2: [*] No newline at end of file +error[W292]: 1:2: [*] No newline at end of file + --> W292_4.py:1:2 | 1 | ... | ^ diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__white_space_syntax_error_compatibility.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__white_space_syntax_error_compatibility.snap index 73c770d6cb..1ef1f6b86e 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__white_space_syntax_error_compatibility.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__white_space_syntax_error_compatibility.snap @@ -1,7 +1,9 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -E2_syntax_error.py:1:10: SyntaxError: Expected an expression +error[syntax-error]: 1:10: Expected an expression + + --> E2_syntax_error.py:1:10 | 1 | a = (1 or) | ^ diff --git a/crates/ruff_linter/src/rules/pydoclint/snapshots/ruff_linter__rules__pydoclint__tests__docstring-extraneous-exception_DOC502_google.py.snap b/crates/ruff_linter/src/rules/pydoclint/snapshots/ruff_linter__rules__pydoclint__tests__docstring-extraneous-exception_DOC502_google.py.snap index 58a44b6914..82e6dbb168 100644 --- a/crates/ruff_linter/src/rules/pydoclint/snapshots/ruff_linter__rules__pydoclint__tests__docstring-extraneous-exception_DOC502_google.py.snap +++ b/crates/ruff_linter/src/rules/pydoclint/snapshots/ruff_linter__rules__pydoclint__tests__docstring-extraneous-exception_DOC502_google.py.snap @@ -1,19 +1,22 @@ --- source: crates/ruff_linter/src/rules/pydoclint/mod.rs --- -DOC502_google.py:16:1: DOC502 Raised exception is not explicitly raised: `FasterThanLightError` +error[DOC502]: 16:1: Raised exception is not explicitly raised: `FasterThanLightError` + + --> DOC502_google.py:15:1 | 14 | Speed as distance divided by time. 15 | 16 | / Raises: 17 | | FasterThanLightError: If speed is greater than the speed of light. 18 | | """ - | |____^ DOC502 + | |____^ 19 | return distance / time | = help: Remove `FasterThanLightError` from the docstring +error[DOC502]: 33:1: Raised exceptions are not explicitly raised: `FasterThanLightError`, `DivisionByZero` -DOC502_google.py:33:1: DOC502 Raised exceptions are not explicitly raised: `FasterThanLightError`, `DivisionByZero` + --> DOC502_google.py:32:1 | 31 | Speed as distance divided by time. 32 | @@ -21,12 +24,13 @@ DOC502_google.py:33:1: DOC502 Raised exceptions are not explicitly raised: `Fast 34 | | FasterThanLightError: If speed is greater than the speed of light. 35 | | DivisionByZero: Divide by zero. 36 | | """ - | |____^ DOC502 + | |____^ 37 | return distance / time | = help: Remove `FasterThanLightError`, `DivisionByZero` from the docstring +error[DOC502]: 51:1: Raised exception is not explicitly raised: `DivisionByZero` -DOC502_google.py:51:1: DOC502 Raised exception is not explicitly raised: `DivisionByZero` + --> DOC502_google.py:50:1 | 49 | Speed as distance divided by time. 50 | @@ -34,7 +38,7 @@ DOC502_google.py:51:1: DOC502 Raised exception is not explicitly raised: `Divisi 52 | | FasterThanLightError: If speed is greater than the speed of light. 53 | | DivisionByZero: Divide by zero. 54 | | """ - | |____^ DOC502 + | |____^ 55 | try: 56 | return distance / time | diff --git a/crates/ruff_linter/src/rules/pydoclint/snapshots/ruff_linter__rules__pydoclint__tests__docstring-extraneous-exception_DOC502_numpy.py.snap b/crates/ruff_linter/src/rules/pydoclint/snapshots/ruff_linter__rules__pydoclint__tests__docstring-extraneous-exception_DOC502_numpy.py.snap index 34a0964a08..73eea52f09 100644 --- a/crates/ruff_linter/src/rules/pydoclint/snapshots/ruff_linter__rules__pydoclint__tests__docstring-extraneous-exception_DOC502_numpy.py.snap +++ b/crates/ruff_linter/src/rules/pydoclint/snapshots/ruff_linter__rules__pydoclint__tests__docstring-extraneous-exception_DOC502_numpy.py.snap @@ -1,7 +1,9 @@ --- source: crates/ruff_linter/src/rules/pydoclint/mod.rs --- -DOC502_numpy.py:22:1: DOC502 Raised exception is not explicitly raised: `FasterThanLightError` +error[DOC502]: 22:1: Raised exception is not explicitly raised: `FasterThanLightError` + + --> DOC502_numpy.py:21:1 | 20 | Speed as distance divided by time. 21 | @@ -10,12 +12,13 @@ DOC502_numpy.py:22:1: DOC502 Raised exception is not explicitly raised: `FasterT 24 | | FasterThanLightError 25 | | If speed is greater than the speed of light. 26 | | """ - | |____^ DOC502 + | |____^ 27 | return distance / time | = help: Remove `FasterThanLightError` from the docstring +error[DOC502]: 47:1: Raised exceptions are not explicitly raised: `FasterThanLightError`, `DivisionByZero` -DOC502_numpy.py:47:1: DOC502 Raised exceptions are not explicitly raised: `FasterThanLightError`, `DivisionByZero` + --> DOC502_numpy.py:46:1 | 45 | Speed as distance divided by time. 46 | @@ -26,12 +29,13 @@ DOC502_numpy.py:47:1: DOC502 Raised exceptions are not explicitly raised: `Faste 51 | | DivisionByZero 52 | | If attempting to divide by zero. 53 | | """ - | |____^ DOC502 + | |____^ 54 | return distance / time | = help: Remove `FasterThanLightError`, `DivisionByZero` from the docstring +error[DOC502]: 74:1: Raised exception is not explicitly raised: `DivisionByZero` -DOC502_numpy.py:74:1: DOC502 Raised exception is not explicitly raised: `DivisionByZero` + --> DOC502_numpy.py:73:1 | 72 | Speed as distance divided by time. 73 | @@ -42,7 +46,7 @@ DOC502_numpy.py:74:1: DOC502 Raised exception is not explicitly raised: `Divisio 78 | | DivisionByZero 79 | | If attempting to divide by zero. 80 | | """ - | |____^ DOC502 + | |____^ 81 | try: 82 | return distance / time | diff --git a/crates/ruff_linter/src/rules/pydoclint/snapshots/ruff_linter__rules__pydoclint__tests__docstring-extraneous-returns_DOC202_google.py.snap b/crates/ruff_linter/src/rules/pydoclint/snapshots/ruff_linter__rules__pydoclint__tests__docstring-extraneous-returns_DOC202_google.py.snap index 16aa8e5fb2..7cf8c0c654 100644 --- a/crates/ruff_linter/src/rules/pydoclint/snapshots/ruff_linter__rules__pydoclint__tests__docstring-extraneous-returns_DOC202_google.py.snap +++ b/crates/ruff_linter/src/rules/pydoclint/snapshots/ruff_linter__rules__pydoclint__tests__docstring-extraneous-returns_DOC202_google.py.snap @@ -1,26 +1,29 @@ --- source: crates/ruff_linter/src/rules/pydoclint/mod.rs --- -DOC202_google.py:20:1: DOC202 Docstring should not have a returns section because the function doesn't return anything +error[DOC202]: 20:1: Docstring should not have a returns section because the function doesn't return anything + + --> DOC202_google.py:19:1 | 18 | num (int): A number 19 | 20 | / Returns: 21 | | str: A string 22 | | """ - | |____^ DOC202 + | |____^ 23 | print('test') | = help: Remove the "Returns" section +error[DOC202]: 36:1: Docstring should not have a returns section because the function doesn't return anything -DOC202_google.py:36:1: DOC202 Docstring should not have a returns section because the function doesn't return anything + --> DOC202_google.py:35:1 | 34 | num (int): A number 35 | 36 | / Returns: 37 | | str: A string 38 | | """ - | |________^ DOC202 + | |________^ 39 | print('test') | = help: Remove the "Returns" section diff --git a/crates/ruff_linter/src/rules/pydoclint/snapshots/ruff_linter__rules__pydoclint__tests__docstring-extraneous-returns_DOC202_numpy.py.snap b/crates/ruff_linter/src/rules/pydoclint/snapshots/ruff_linter__rules__pydoclint__tests__docstring-extraneous-returns_DOC202_numpy.py.snap index 4c1e3fffe4..2c1601fc02 100644 --- a/crates/ruff_linter/src/rules/pydoclint/snapshots/ruff_linter__rules__pydoclint__tests__docstring-extraneous-returns_DOC202_numpy.py.snap +++ b/crates/ruff_linter/src/rules/pydoclint/snapshots/ruff_linter__rules__pydoclint__tests__docstring-extraneous-returns_DOC202_numpy.py.snap @@ -1,7 +1,9 @@ --- source: crates/ruff_linter/src/rules/pydoclint/mod.rs --- -DOC202_numpy.py:24:1: DOC202 Docstring should not have a returns section because the function doesn't return anything +error[DOC202]: 24:1: Docstring should not have a returns section because the function doesn't return anything + + --> DOC202_numpy.py:23:1 | 22 | A number 23 | @@ -10,12 +12,13 @@ DOC202_numpy.py:24:1: DOC202 Docstring should not have a returns section because 26 | | str 27 | | A string 28 | | """ - | |____^ DOC202 + | |____^ 29 | print('test') | = help: Remove the "Returns" section +error[DOC202]: 44:1: Docstring should not have a returns section because the function doesn't return anything -DOC202_numpy.py:44:1: DOC202 Docstring should not have a returns section because the function doesn't return anything + --> DOC202_numpy.py:43:1 | 42 | A number 43 | @@ -24,7 +27,7 @@ DOC202_numpy.py:44:1: DOC202 Docstring should not have a returns section because 46 | | str 47 | | A string 48 | | """ - | |________^ DOC202 + | |________^ 49 | print('test') | = help: Remove the "Returns" section diff --git a/crates/ruff_linter/src/rules/pydoclint/snapshots/ruff_linter__rules__pydoclint__tests__docstring-extraneous-yields_DOC403_google.py.snap b/crates/ruff_linter/src/rules/pydoclint/snapshots/ruff_linter__rules__pydoclint__tests__docstring-extraneous-yields_DOC403_google.py.snap index 2c3c651b22..7dc728e6e2 100644 --- a/crates/ruff_linter/src/rules/pydoclint/snapshots/ruff_linter__rules__pydoclint__tests__docstring-extraneous-yields_DOC403_google.py.snap +++ b/crates/ruff_linter/src/rules/pydoclint/snapshots/ruff_linter__rules__pydoclint__tests__docstring-extraneous-yields_DOC403_google.py.snap @@ -1,26 +1,29 @@ --- source: crates/ruff_linter/src/rules/pydoclint/mod.rs --- -DOC403_google.py:20:1: DOC403 Docstring has a "Yields" section but the function doesn't yield anything +error[DOC403]: 20:1: Docstring has a "Yields" section but the function doesn't yield anything + + --> DOC403_google.py:19:1 | 18 | num (int): A number 19 | 20 | / Yields: 21 | | str: A string 22 | | """ - | |____^ DOC403 + | |____^ 23 | print('test') | = help: Remove the "Yields" section +error[DOC403]: 36:1: Docstring has a "Yields" section but the function doesn't yield anything -DOC403_google.py:36:1: DOC403 Docstring has a "Yields" section but the function doesn't yield anything + --> DOC403_google.py:35:1 | 34 | num (int): A number 35 | 36 | / Yields: 37 | | str: A string 38 | | """ - | |________^ DOC403 + | |________^ 39 | print('test') | = help: Remove the "Yields" section diff --git a/crates/ruff_linter/src/rules/pydoclint/snapshots/ruff_linter__rules__pydoclint__tests__docstring-extraneous-yields_DOC403_numpy.py.snap b/crates/ruff_linter/src/rules/pydoclint/snapshots/ruff_linter__rules__pydoclint__tests__docstring-extraneous-yields_DOC403_numpy.py.snap index aff49d2869..5ed61ca02a 100644 --- a/crates/ruff_linter/src/rules/pydoclint/snapshots/ruff_linter__rules__pydoclint__tests__docstring-extraneous-yields_DOC403_numpy.py.snap +++ b/crates/ruff_linter/src/rules/pydoclint/snapshots/ruff_linter__rules__pydoclint__tests__docstring-extraneous-yields_DOC403_numpy.py.snap @@ -1,7 +1,9 @@ --- source: crates/ruff_linter/src/rules/pydoclint/mod.rs --- -DOC403_numpy.py:24:1: DOC403 Docstring has a "Yields" section but the function doesn't yield anything +error[DOC403]: 24:1: Docstring has a "Yields" section but the function doesn't yield anything + + --> DOC403_numpy.py:23:1 | 22 | A number 23 | @@ -10,12 +12,13 @@ DOC403_numpy.py:24:1: DOC403 Docstring has a "Yields" section but the function d 26 | | str 27 | | A string 28 | | """ - | |____^ DOC403 + | |____^ 29 | print('test') | = help: Remove the "Yields" section +error[DOC403]: 44:1: Docstring has a "Yields" section but the function doesn't yield anything -DOC403_numpy.py:44:1: DOC403 Docstring has a "Yields" section but the function doesn't yield anything + --> DOC403_numpy.py:43:1 | 42 | A number 43 | @@ -24,7 +27,7 @@ DOC403_numpy.py:44:1: DOC403 Docstring has a "Yields" section but the function d 46 | | str 47 | | A string 48 | | """ - | |________^ DOC403 + | |________^ 49 | print('test') | = help: Remove the "Yields" section diff --git a/crates/ruff_linter/src/rules/pydoclint/snapshots/ruff_linter__rules__pydoclint__tests__docstring-missing-exception_DOC501_google.py.snap b/crates/ruff_linter/src/rules/pydoclint/snapshots/ruff_linter__rules__pydoclint__tests__docstring-missing-exception_DOC501_google.py.snap index e8fbdff46c..f120b84fca 100644 --- a/crates/ruff_linter/src/rules/pydoclint/snapshots/ruff_linter__rules__pydoclint__tests__docstring-missing-exception_DOC501_google.py.snap +++ b/crates/ruff_linter/src/rules/pydoclint/snapshots/ruff_linter__rules__pydoclint__tests__docstring-missing-exception_DOC501_google.py.snap @@ -1,90 +1,100 @@ --- source: crates/ruff_linter/src/rules/pydoclint/mod.rs --- -DOC501_google.py:46:15: DOC501 Raised exception `FasterThanLightError` missing from docstring +error[DOC501]: 46:15: Raised exception `FasterThanLightError` missing from docstring + + --> DOC501_google.py:46:15 | 44 | return distance / time 45 | except ZeroDivisionError as exc: 46 | raise FasterThanLightError from exc - | ^^^^^^^^^^^^^^^^^^^^ DOC501 + | ^^^^^^^^^^^^^^^^^^^^ | = help: Add `FasterThanLightError` to the docstring +error[DOC501]: 63:15: Raised exception `FasterThanLightError` missing from docstring -DOC501_google.py:63:15: DOC501 Raised exception `FasterThanLightError` missing from docstring + --> DOC501_google.py:63:15 | 61 | return distance / time 62 | except ZeroDivisionError as exc: 63 | raise FasterThanLightError from exc - | ^^^^^^^^^^^^^^^^^^^^ DOC501 + | ^^^^^^^^^^^^^^^^^^^^ 64 | except: 65 | raise ValueError | = help: Add `FasterThanLightError` to the docstring +error[DOC501]: 65:15: Raised exception `ValueError` missing from docstring -DOC501_google.py:65:15: DOC501 Raised exception `ValueError` missing from docstring + --> DOC501_google.py:65:15 | 63 | raise FasterThanLightError from exc 64 | except: 65 | raise ValueError - | ^^^^^^^^^^ DOC501 + | ^^^^^^^^^^ | = help: Add `ValueError` to the docstring +error[DOC501]: 115:11: Raised exception `AnotherError` missing from docstring -DOC501_google.py:115:11: DOC501 Raised exception `AnotherError` missing from docstring + --> DOC501_google.py:115:11 | 113 | Speed as distance divided by time. 114 | """ 115 | raise AnotherError - | ^^^^^^^^^^^^ DOC501 + | ^^^^^^^^^^^^ | = help: Add `AnotherError` to the docstring +error[DOC501]: 129:11: Raised exception `AnotherError` missing from docstring -DOC501_google.py:129:11: DOC501 Raised exception `AnotherError` missing from docstring + --> DOC501_google.py:129:11 | 127 | Speed as distance divided by time. 128 | """ 129 | raise AnotherError() - | ^^^^^^^^^^^^^^ DOC501 + | ^^^^^^^^^^^^^^ | = help: Add `AnotherError` to the docstring +error[DOC501]: 139:11: Raised exception `SomeError` missing from docstring -DOC501_google.py:139:11: DOC501 Raised exception `SomeError` missing from docstring + --> DOC501_google.py:139:11 | 137 | bar: Bar. 138 | """ 139 | raise something.SomeError - | ^^^^^^^^^^^^^^^^^^^ DOC501 + | ^^^^^^^^^^^^^^^^^^^ | = help: Add `SomeError` to the docstring +error[DOC501]: 213:9: Raised exception `ZeroDivisionError` missing from docstring -DOC501_google.py:213:9: DOC501 Raised exception `ZeroDivisionError` missing from docstring + --> DOC501_google.py:213:9 | 211 | except ZeroDivisionError: 212 | print("Oh no, why would you divide something by zero?") 213 | raise - | ^^^^^ DOC501 + | ^^^^^ 214 | except TypeError: 215 | print("Not a number? Shame on you!") | = help: Add `ZeroDivisionError` to the docstring +error[DOC501]: 244:15: Raised exception `TypeError` missing from docstring -DOC501_google.py:244:15: DOC501 Raised exception `TypeError` missing from docstring + --> DOC501_google.py:244:15 | 242 | """ 243 | if True: 244 | raise TypeError # DOC501 - | ^^^^^^^^^ DOC501 + | ^^^^^^^^^ 245 | else: 246 | raise TypeError # no DOC501 here because we already emitted a diagnostic for the earlier `raise TypeError` | = help: Add `TypeError` to the docstring +error[DOC501]: 247:11: Raised exception `ValueError` missing from docstring -DOC501_google.py:247:11: DOC501 Raised exception `ValueError` missing from docstring + --> DOC501_google.py:247:11 | 245 | else: 246 | raise TypeError # no DOC501 here because we already emitted a diagnostic for the earlier `raise TypeError` 247 | raise ValueError # DOC501 - | ^^^^^^^^^^ DOC501 + | ^^^^^^^^^^ 248 | return 42 | = help: Add `ValueError` to the docstring diff --git a/crates/ruff_linter/src/rules/pydoclint/snapshots/ruff_linter__rules__pydoclint__tests__docstring-missing-exception_DOC501_numpy.py.snap b/crates/ruff_linter/src/rules/pydoclint/snapshots/ruff_linter__rules__pydoclint__tests__docstring-missing-exception_DOC501_numpy.py.snap index 3511ea7a6a..d06756110d 100644 --- a/crates/ruff_linter/src/rules/pydoclint/snapshots/ruff_linter__rules__pydoclint__tests__docstring-missing-exception_DOC501_numpy.py.snap +++ b/crates/ruff_linter/src/rules/pydoclint/snapshots/ruff_linter__rules__pydoclint__tests__docstring-missing-exception_DOC501_numpy.py.snap @@ -1,61 +1,68 @@ --- source: crates/ruff_linter/src/rules/pydoclint/mod.rs --- -DOC501_numpy.py:53:15: DOC501 Raised exception `FasterThanLightError` missing from docstring +error[DOC501]: 53:15: Raised exception `FasterThanLightError` missing from docstring + + --> DOC501_numpy.py:53:15 | 51 | return distance / time 52 | except ZeroDivisionError as exc: 53 | raise FasterThanLightError from exc - | ^^^^^^^^^^^^^^^^^^^^ DOC501 + | ^^^^^^^^^^^^^^^^^^^^ | = help: Add `FasterThanLightError` to the docstring +error[DOC501]: 76:15: Raised exception `FasterThanLightError` missing from docstring -DOC501_numpy.py:76:15: DOC501 Raised exception `FasterThanLightError` missing from docstring + --> DOC501_numpy.py:76:15 | 74 | return distance / time 75 | except ZeroDivisionError as exc: 76 | raise FasterThanLightError from exc - | ^^^^^^^^^^^^^^^^^^^^ DOC501 + | ^^^^^^^^^^^^^^^^^^^^ 77 | except: 78 | raise ValueError | = help: Add `FasterThanLightError` to the docstring +error[DOC501]: 78:15: Raised exception `ValueError` missing from docstring -DOC501_numpy.py:78:15: DOC501 Raised exception `ValueError` missing from docstring + --> DOC501_numpy.py:78:15 | 76 | raise FasterThanLightError from exc 77 | except: 78 | raise ValueError - | ^^^^^^^^^^ DOC501 + | ^^^^^^^^^^ | = help: Add `ValueError` to the docstring +error[DOC501]: 111:9: Raised exception `TypeError` missing from docstring -DOC501_numpy.py:111:9: DOC501 Raised exception `TypeError` missing from docstring + --> DOC501_numpy.py:111:9 | 109 | except TypeError: 110 | print("Not a number? Shame on you!") 111 | raise - | ^^^^^ DOC501 + | ^^^^^ | = help: Add `TypeError` to the docstring +error[DOC501]: 147:15: Raised exception `TypeError` missing from docstring -DOC501_numpy.py:147:15: DOC501 Raised exception `TypeError` missing from docstring + --> DOC501_numpy.py:147:15 | 145 | """ 146 | if True: 147 | raise TypeError # DOC501 - | ^^^^^^^^^ DOC501 + | ^^^^^^^^^ 148 | else: 149 | raise TypeError # no DOC501 here because we already emitted a diagnostic for the earlier `raise TypeError` | = help: Add `TypeError` to the docstring +error[DOC501]: 150:11: Raised exception `ValueError` missing from docstring -DOC501_numpy.py:150:11: DOC501 Raised exception `ValueError` missing from docstring + --> DOC501_numpy.py:150:11 | 148 | else: 149 | raise TypeError # no DOC501 here because we already emitted a diagnostic for the earlier `raise TypeError` 150 | raise ValueError # DOC501 - | ^^^^^^^^^^ DOC501 + | ^^^^^^^^^^ 151 | return 42 | = help: Add `ValueError` to the docstring diff --git a/crates/ruff_linter/src/rules/pydoclint/snapshots/ruff_linter__rules__pydoclint__tests__docstring-missing-returns_DOC201_google.py.snap b/crates/ruff_linter/src/rules/pydoclint/snapshots/ruff_linter__rules__pydoclint__tests__docstring-missing-returns_DOC201_google.py.snap index 16534806d0..30474a7b63 100644 --- a/crates/ruff_linter/src/rules/pydoclint/snapshots/ruff_linter__rules__pydoclint__tests__docstring-missing-returns_DOC201_google.py.snap +++ b/crates/ruff_linter/src/rules/pydoclint/snapshots/ruff_linter__rules__pydoclint__tests__docstring-missing-returns_DOC201_google.py.snap @@ -1,40 +1,45 @@ --- source: crates/ruff_linter/src/rules/pydoclint/mod.rs --- -DOC201_google.py:9:5: DOC201 `return` is not documented in docstring +error[DOC201]: 9:5: `return` is not documented in docstring + + --> DOC201_google.py:9:5 | 7 | num (int): A number 8 | """ 9 | return 'test' - | ^^^^^^^^^^^^^ DOC201 + | ^^^^^^^^^^^^^ | = help: Add a "Returns" section to the docstring +error[DOC201]: 50:9: `return` is not documented in docstring -DOC201_google.py:50:9: DOC201 `return` is not documented in docstring + --> DOC201_google.py:50:9 | 48 | num (int): A number 49 | """ 50 | return 'test' - | ^^^^^^^^^^^^^ DOC201 + | ^^^^^^^^^^^^^ | = help: Add a "Returns" section to the docstring +error[DOC201]: 71:9: `return` is not documented in docstring -DOC201_google.py:71:9: DOC201 `return` is not documented in docstring + --> DOC201_google.py:71:9 | 69 | def nested(): 70 | """Do something nested.""" 71 | return 5 - | ^^^^^^^^ DOC201 + | ^^^^^^^^ 72 | 73 | print("I never return") | = help: Add a "Returns" section to the docstring +error[DOC201]: 121:9: `return` is not documented in docstring -DOC201_google.py:121:9: DOC201 `return` is not documented in docstring + --> DOC201_google.py:121:9 | 119 | def f(self): 120 | """Lorem ipsum.""" 121 | return True - | ^^^^^^^^^^^ DOC201 + | ^^^^^^^^^^^ | = help: Add a "Returns" section to the docstring diff --git a/crates/ruff_linter/src/rules/pydoclint/snapshots/ruff_linter__rules__pydoclint__tests__docstring-missing-returns_DOC201_numpy.py.snap b/crates/ruff_linter/src/rules/pydoclint/snapshots/ruff_linter__rules__pydoclint__tests__docstring-missing-returns_DOC201_numpy.py.snap index 04d87deb5a..dd6d8aec99 100644 --- a/crates/ruff_linter/src/rules/pydoclint/snapshots/ruff_linter__rules__pydoclint__tests__docstring-missing-returns_DOC201_numpy.py.snap +++ b/crates/ruff_linter/src/rules/pydoclint/snapshots/ruff_linter__rules__pydoclint__tests__docstring-missing-returns_DOC201_numpy.py.snap @@ -1,29 +1,33 @@ --- source: crates/ruff_linter/src/rules/pydoclint/mod.rs --- -DOC201_numpy.py:11:5: DOC201 `return` is not documented in docstring +error[DOC201]: 11:5: `return` is not documented in docstring + + --> DOC201_numpy.py:11:5 | 9 | A number 10 | """ 11 | return 'test' - | ^^^^^^^^^^^^^ DOC201 + | ^^^^^^^^^^^^^ | = help: Add a "Returns" section to the docstring +error[DOC201]: 62:9: `return` is not documented in docstring -DOC201_numpy.py:62:9: DOC201 `return` is not documented in docstring + --> DOC201_numpy.py:62:9 | 60 | A number 61 | """ 62 | return 'test' - | ^^^^^^^^^^^^^ DOC201 + | ^^^^^^^^^^^^^ | = help: Add a "Returns" section to the docstring +error[DOC201]: 87:9: `return` is not documented in docstring -DOC201_numpy.py:87:9: DOC201 `return` is not documented in docstring + --> DOC201_numpy.py:87:9 | 85 | def f(self): 86 | """Lorem ipsum.""" 87 | return True - | ^^^^^^^^^^^ DOC201 + | ^^^^^^^^^^^ | = help: Add a "Returns" section to the docstring diff --git a/crates/ruff_linter/src/rules/pydoclint/snapshots/ruff_linter__rules__pydoclint__tests__docstring-missing-yields_DOC402_google.py.snap b/crates/ruff_linter/src/rules/pydoclint/snapshots/ruff_linter__rules__pydoclint__tests__docstring-missing-yields_DOC402_google.py.snap index c9ebc3f280..f6bd8121fd 100644 --- a/crates/ruff_linter/src/rules/pydoclint/snapshots/ruff_linter__rules__pydoclint__tests__docstring-missing-yields_DOC402_google.py.snap +++ b/crates/ruff_linter/src/rules/pydoclint/snapshots/ruff_linter__rules__pydoclint__tests__docstring-missing-yields_DOC402_google.py.snap @@ -1,40 +1,45 @@ --- source: crates/ruff_linter/src/rules/pydoclint/mod.rs --- -DOC402_google.py:9:5: DOC402 `yield` is not documented in docstring +error[DOC402]: 9:5: `yield` is not documented in docstring + + --> DOC402_google.py:9:5 | 7 | num (int): A number 8 | """ 9 | yield 'test' - | ^^^^^^^^^^^^ DOC402 + | ^^^^^^^^^^^^ | = help: Add a "Yields" section to the docstring +error[DOC402]: 50:9: `yield` is not documented in docstring -DOC402_google.py:50:9: DOC402 `yield` is not documented in docstring + --> DOC402_google.py:50:9 | 48 | num (int): A number 49 | """ 50 | yield 'test' - | ^^^^^^^^^^^^ DOC402 + | ^^^^^^^^^^^^ | = help: Add a "Yields" section to the docstring +error[DOC402]: 59:9: `yield` is not documented in docstring -DOC402_google.py:59:9: DOC402 `yield` is not documented in docstring + --> DOC402_google.py:59:9 | 57 | def nested(): 58 | """Do something nested.""" 59 | yield 5 - | ^^^^^^^ DOC402 + | ^^^^^^^ 60 | 61 | print("I never yield") | = help: Add a "Yields" section to the docstring +error[DOC402]: 67:5: `yield` is not documented in docstring -DOC402_google.py:67:5: DOC402 `yield` is not documented in docstring + --> DOC402_google.py:67:5 | 65 | def test(): 66 | """Do something.""" 67 | yield from range(10) - | ^^^^^^^^^^^^^^^^^^^^ DOC402 + | ^^^^^^^^^^^^^^^^^^^^ | = help: Add a "Yields" section to the docstring diff --git a/crates/ruff_linter/src/rules/pydoclint/snapshots/ruff_linter__rules__pydoclint__tests__docstring-missing-yields_DOC402_numpy.py.snap b/crates/ruff_linter/src/rules/pydoclint/snapshots/ruff_linter__rules__pydoclint__tests__docstring-missing-yields_DOC402_numpy.py.snap index 4737fe1603..c1536f9dd8 100644 --- a/crates/ruff_linter/src/rules/pydoclint/snapshots/ruff_linter__rules__pydoclint__tests__docstring-missing-yields_DOC402_numpy.py.snap +++ b/crates/ruff_linter/src/rules/pydoclint/snapshots/ruff_linter__rules__pydoclint__tests__docstring-missing-yields_DOC402_numpy.py.snap @@ -1,20 +1,23 @@ --- source: crates/ruff_linter/src/rules/pydoclint/mod.rs --- -DOC402_numpy.py:11:5: DOC402 `yield` is not documented in docstring +error[DOC402]: 11:5: `yield` is not documented in docstring + + --> DOC402_numpy.py:11:5 | 9 | A number 10 | """ 11 | yield 'test' - | ^^^^^^^^^^^^ DOC402 + | ^^^^^^^^^^^^ | = help: Add a "Yields" section to the docstring +error[DOC402]: 62:9: `yield` is not documented in docstring -DOC402_numpy.py:62:9: DOC402 `yield` is not documented in docstring + --> DOC402_numpy.py:62:9 | 60 | A number 61 | """ 62 | yield 'test' - | ^^^^^^^^^^^^ DOC402 + | ^^^^^^^^^^^^ | = help: Add a "Yields" section to the docstring diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D100_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D100_D.py.snap index 6f91c05384..da23ffdcc9 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D100_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D100_D.py.snap @@ -1,4 +1,4 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs --- -D.py:1:1: D100 Missing docstring in public module +error[D100]: 1:1: Missing docstring in public module diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D100__unrelated__pkg__D100_pub.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D100__unrelated__pkg__D100_pub.py.snap index 0d611a61a2..da23ffdcc9 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D100__unrelated__pkg__D100_pub.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D100__unrelated__pkg__D100_pub.py.snap @@ -1,4 +1,4 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs --- -D100_pub.py:1:1: D100 Missing docstring in public module +error[D100]: 1:1: Missing docstring in public module diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D101_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D101_D.py.snap index 728fbf0b95..8cabba2e24 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D101_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D101_D.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs --- -error[D101]: D.py:15:7: Missing docstring in public class +error[D101]: 15:7: Missing docstring in public class + --> D.py:15:7 | 15 | class class_: | ^^^^^^ diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D102_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D102_D.py.snap index 69aba0fb03..bf74453c10 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D102_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D102_D.py.snap @@ -1,32 +1,36 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs --- -error[D102]: D.py:23:9: Missing docstring in public method +error[D102]: 23:9: Missing docstring in public method + --> D.py:23:9 | 22 | @expect('D102: Missing docstring in public method') 23 | def method(self=None): | ^^^^^^ 24 | pass | -error[D102]: D.py:56:9: Missing docstring in public method +error[D102]: 56:9: Missing docstring in public method + --> D.py:56:9 | 55 | @expect('D102: Missing docstring in public method') 56 | def __new__(self=None): | ^^^^^^^ 57 | pass | -error[D102]: D.py:68:9: Missing docstring in public method +error[D102]: 68:9: Missing docstring in public method + --> D.py:68:9 | 67 | @expect('D102: Missing docstring in public method') 68 | def __call__(self=None, x=None, y=None, z=None): | ^^^^^^^^ 69 | pass | -error[D102]: D.py:650:9: Missing docstring in public method +error[D102]: 650:9: Missing docstring in public method + --> D.py:650:9 | 648 | class StatementOnSameLineAsDocstring: 649 | "After this docstring there's another statement on the same line separated by a semicolon." ; priorities=1 @@ -34,8 +38,9 @@ error[D102]: D.py:650:9: Missing docstring in public method | ^^^^^^^^^^^^^ 651 | pass | -error[D102]: D.py:659:9: Missing docstring in public method +error[D102]: 659:9: Missing docstring in public method + --> D.py:659:9 | 657 | class CommentAfterDocstring: 658 | "After this docstring there's a comment." # priorities=1 diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D102_setter.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D102_setter.py.snap index 88cdc92612..a0f6ce2df5 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D102_setter.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D102_setter.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs --- -error[D102]: setter.py:16:9: Missing docstring in public method +error[D102]: 16:9: Missing docstring in public method + --> setter.py:16:9 | 15 | @foo 16 | def foo(self, value: str) -> None: diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D103_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D103_D.py.snap index cecb940731..5e6d8ee4f0 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D103_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D103_D.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs --- -error[D103]: D.py:400:5: Missing docstring in public function +error[D103]: 400:5: Missing docstring in public function + --> D.py:400:5 | 399 | @expect("D103: Missing docstring in public function") 400 | def oneliner_d102(): return diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D104_D104____init__.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D104_D104____init__.py.snap index 5885932f5b..797c776737 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D104_D104____init__.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D104_D104____init__.py.snap @@ -1,4 +1,4 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs --- -__init__.py:1:1: D104 Missing docstring in public package +error[D104]: 1:1: Missing docstring in public package diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D105_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D105_D.py.snap index ae61a2a854..c525228b15 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D105_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D105_D.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs --- -error[D105]: D.py:64:9: Missing docstring in magic method +error[D105]: 64:9: Missing docstring in magic method + --> D.py:64:9 | 63 | @expect('D105: Missing docstring in magic method') 64 | def __str__(self=None): diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D107_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D107_D.py.snap index 0d6c6c7539..c9682d0f86 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D107_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D107_D.py.snap @@ -1,16 +1,18 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs --- -error[D107]: D.py:60:9: Missing docstring in `__init__` +error[D107]: 60:9: Missing docstring in `__init__` + --> D.py:60:9 | 59 | @expect('D107: Missing docstring in __init__') 60 | def __init__(self=None): | ^^^^^^^^ 61 | pass | -error[D107]: D.py:534:9: Missing docstring in `__init__` +error[D107]: 534:9: Missing docstring in `__init__` + --> D.py:534:9 | 532 | """ 533 | diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D200_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D200_D.py.snap index 16c9c47429..0877afa8d7 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D200_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D200_D.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs --- -error[D200]: D.py:129:5: [*] One-line docstring should fit on one line +error[D200]: 129:5: [*] One-line docstring should fit on one line + --> D.py:129:5 | 127 | @expect('D212: Multi-line docstring summary should start at the first line') 128 | def asdlkfasd(): @@ -25,8 +26,9 @@ error[D200]: D.py:129:5: [*] One-line docstring should fit on one line 133 131 | 134 132 | @expect('D201: No blank lines allowed before function docstring (found 1)') -error[D200]: D.py:597:5: [*] One-line docstring should fit on one line +error[D200]: 597:5: [*] One-line docstring should fit on one line + --> D.py:597:5 | 595 | @expect('D212: Multi-line docstring summary should start at the first line') 596 | def one_liner(): @@ -49,8 +51,9 @@ error[D200]: D.py:597:5: [*] One-line docstring should fit on one line 601 599 | 602 600 | @expect('D200: One-line docstring should fit on one line with quotes ' -error[D200]: D.py:606:5: [*] One-line docstring should fit on one line +error[D200]: 606:5: [*] One-line docstring should fit on one line + --> D.py:606:5 | 604 | @expect('D212: Multi-line docstring summary should start at the first line') 605 | def one_liner(): @@ -73,8 +76,9 @@ error[D200]: D.py:606:5: [*] One-line docstring should fit on one line 610 608 | 611 609 | @expect('D200: One-line docstring should fit on one line with quotes ' -error[D200]: D.py:615:5: One-line docstring should fit on one line +error[D200]: 615:5: One-line docstring should fit on one line + --> D.py:615:5 | 613 | @expect('D212: Multi-line docstring summary should start at the first line') 614 | def one_liner(): @@ -85,8 +89,9 @@ error[D200]: D.py:615:5: One-line docstring should fit on one line | |_______^ | = help: Reformat to one line -error[D200]: D.py:624:5: One-line docstring should fit on one line +error[D200]: 624:5: One-line docstring should fit on one line + --> D.py:624:5 | 622 | @expect('D212: Multi-line docstring summary should start at the first line') 623 | def one_liner(): @@ -97,8 +102,9 @@ error[D200]: D.py:624:5: One-line docstring should fit on one line | |______________^ | = help: Reformat to one line -error[D200]: D.py:645:5: One-line docstring should fit on one line +error[D200]: 645:5: One-line docstring should fit on one line + --> D.py:645:5 | 644 | def single_line_docstring_with_an_escaped_backslash(): 645 | "\ diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D200_D200.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D200_D200.py.snap index 1e49fc73fd..b43dd7a993 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D200_D200.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D200_D200.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs --- -error[D200]: D200.py:2:5: One-line docstring should fit on one line +error[D200]: 2:5: One-line docstring should fit on one line + --> D200.py:2:5 | 1 | def func(): 2 | """\ @@ -11,8 +12,9 @@ error[D200]: D200.py:2:5: One-line docstring should fit on one line | |_______^ | = help: Reformat to one line -error[D200]: D200.py:7:5: [*] One-line docstring should fit on one line +error[D200]: 7:5: [*] One-line docstring should fit on one line + --> D200.py:7:5 | 6 | def func(): 7 | """\\ @@ -32,8 +34,9 @@ error[D200]: D200.py:7:5: [*] One-line docstring should fit on one line 10 9 | 11 10 | def func(): -error[D200]: D200.py:12:5: One-line docstring should fit on one line +error[D200]: 12:5: One-line docstring should fit on one line + --> D200.py:12:5 | 11 | def func(): 12 | """\ \ diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D201_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D201_D.py.snap index cf7c2bc166..1de7f4c20b 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D201_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D201_D.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs --- -error[D201]: D.py:137:5: [*] No blank lines allowed before function docstring (found 1) +error[D201]: 137:5: [*] No blank lines allowed before function docstring (found 1) + --> D.py:137:5 | 135 | def leading_space(): 136 | @@ -19,8 +20,9 @@ error[D201]: D.py:137:5: [*] No blank lines allowed before function docstring (f 138 137 | 139 138 | -error[D201]: D.py:151:5: [*] No blank lines allowed before function docstring (found 1) +error[D201]: 151:5: [*] No blank lines allowed before function docstring (found 1) + --> D.py:151:5 | 149 | def trailing_and_leading_space(): 150 | @@ -39,8 +41,9 @@ error[D201]: D.py:151:5: [*] No blank lines allowed before function docstring (f 152 151 | 153 152 | pass -error[D201]: D.py:546:5: [*] No blank lines allowed before function docstring (found 1) +error[D201]: 546:5: [*] No blank lines allowed before function docstring (found 1) + --> D.py:546:5 | 544 | def multiline_leading_space(): 545 | @@ -61,8 +64,9 @@ error[D201]: D.py:546:5: [*] No blank lines allowed before function docstring (f 547 546 | 548 547 | More content. -error[D201]: D.py:568:5: [*] No blank lines allowed before function docstring (found 1) +error[D201]: 568:5: [*] No blank lines allowed before function docstring (found 1) + --> D.py:568:5 | 566 | def multiline_trailing_and_leading_space(): 567 | diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D202_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D202_D.py.snap index e74a05b5aa..fdea2e90c7 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D202_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D202_D.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs --- -error[D202]: D.py:142:5: [*] No blank lines allowed after function docstring (found 1) +error[D202]: 142:5: [*] No blank lines allowed after function docstring (found 1) + --> D.py:142:5 | 140 | @expect('D202: No blank lines allowed after function docstring (found 1)') 141 | def trailing_space(): @@ -21,8 +22,9 @@ error[D202]: D.py:142:5: [*] No blank lines allowed after function docstring (fo 145 144 | 146 145 | -error[D202]: D.py:151:5: [*] No blank lines allowed after function docstring (found 1) +error[D202]: 151:5: [*] No blank lines allowed after function docstring (found 1) + --> D.py:151:5 | 149 | def trailing_and_leading_space(): 150 | @@ -41,8 +43,9 @@ error[D202]: D.py:151:5: [*] No blank lines allowed after function docstring (fo 154 153 | 155 154 | -error[D202]: D.py:555:5: [*] No blank lines allowed after function docstring (found 1) +error[D202]: 555:5: [*] No blank lines allowed after function docstring (found 1) + --> D.py:555:5 | 553 | @expect('D213: Multi-line docstring summary should start at the second line') 554 | def multiline_trailing_space(): @@ -65,8 +68,9 @@ error[D202]: D.py:555:5: [*] No blank lines allowed after function docstring (fo 561 560 | 562 561 | -error[D202]: D.py:568:5: [*] No blank lines allowed after function docstring (found 1) +error[D202]: 568:5: [*] No blank lines allowed after function docstring (found 1) + --> D.py:568:5 | 566 | def multiline_trailing_and_leading_space(): 567 | diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D202_D202.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D202_D202.py.snap index 0802680e79..db3eb97529 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D202_D202.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D202_D202.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs --- -error[D202]: D202.py:57:5: [*] No blank lines allowed after function docstring (found 2) +error[D202]: 57:5: [*] No blank lines allowed after function docstring (found 2) + --> D202.py:57:5 | 55 | # D202 56 | def outer(): @@ -20,8 +21,9 @@ error[D202]: D202.py:57:5: [*] No blank lines allowed after function docstring ( 61 59 | return 62 60 | -error[D202]: D202.py:68:5: [*] No blank lines allowed after function docstring (found 2) +error[D202]: 68:5: [*] No blank lines allowed after function docstring (found 2) + --> D202.py:68:5 | 66 | # D202 67 | def outer(): @@ -39,8 +41,9 @@ error[D202]: D202.py:68:5: [*] No blank lines allowed after function docstring ( 72 70 | def inner(): 73 71 | return -error[D202]: D202.py:80:5: [*] No blank lines allowed after function docstring (found 1) +error[D202]: 80:5: [*] No blank lines allowed after function docstring (found 1) + --> D202.py:80:5 | 78 | # D202 79 | def outer(): diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D203_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D203_D.py.snap index 0653a9610a..01f7686022 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D203_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D203_D.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs --- -error[D203]: D.py:161:5: [*] 1 blank line required before class docstring +error[D203]: 161:5: [*] 1 blank line required before class docstring + --> D.py:161:5 | 160 | class LeadingSpaceMissing: 161 | """Leading space missing.""" @@ -18,8 +19,9 @@ error[D203]: D.py:161:5: [*] 1 blank line required before class docstring 162 163 | 163 164 | -error[D203]: D.py:192:5: [*] 1 blank line required before class docstring +error[D203]: 192:5: [*] 1 blank line required before class docstring + --> D.py:192:5 | 191 | class LeadingAndTrailingSpaceMissing: 192 | """Leading and trailing space missing.""" @@ -36,8 +38,9 @@ error[D203]: D.py:192:5: [*] 1 blank line required before class docstring 193 194 | pass 194 195 | -error[D203]: D.py:526:5: [*] 1 blank line required before class docstring +error[D203]: 526:5: [*] 1 blank line required before class docstring + --> D.py:526:5 | 524 | # parameters as functions for Google / Numpy conventions. 525 | class Blah: # noqa: D203,D213 @@ -63,8 +66,9 @@ error[D203]: D.py:526:5: [*] 1 blank line required before class docstring 527 528 | 528 529 | Parameters -error[D203]: D.py:649:5: [*] 1 blank line required before class docstring +error[D203]: 649:5: [*] 1 blank line required before class docstring + --> D.py:649:5 | 648 | class StatementOnSameLineAsDocstring: 649 | "After this docstring there's another statement on the same line separated by a semicolon." ; priorities=1 @@ -82,8 +86,9 @@ error[D203]: D.py:649:5: [*] 1 blank line required before class docstring 650 651 | def sort_services(self): 651 652 | pass -error[D203]: D.py:654:5: [*] 1 blank line required before class docstring +error[D203]: 654:5: [*] 1 blank line required before class docstring + --> D.py:654:5 | 653 | class StatementOnSameLineAsDocstring: 654 | "After this docstring there's another statement on the same line separated by a semicolon."; priorities=1 @@ -99,8 +104,9 @@ error[D203]: D.py:654:5: [*] 1 blank line required before class docstring 655 656 | 656 657 | -error[D203]: D.py:658:5: [*] 1 blank line required before class docstring +error[D203]: 658:5: [*] 1 blank line required before class docstring + --> D.py:658:5 | 657 | class CommentAfterDocstring: 658 | "After this docstring there's a comment." # priorities=1 diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D204_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D204_D.py.snap index 98ef44909a..8d23bed247 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D204_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D204_D.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs --- -error[D204]: D.py:181:5: [*] 1 blank line required after class docstring +error[D204]: 181:5: [*] 1 blank line required after class docstring + --> D.py:181:5 | 179 | class TrailingSpace: 180 | @@ -20,8 +21,9 @@ error[D204]: D.py:181:5: [*] 1 blank line required after class docstring 183 184 | 184 185 | -error[D204]: D.py:192:5: [*] 1 blank line required after class docstring +error[D204]: 192:5: [*] 1 blank line required after class docstring + --> D.py:192:5 | 191 | class LeadingAndTrailingSpaceMissing: 192 | """Leading and trailing space missing.""" @@ -38,8 +40,9 @@ error[D204]: D.py:192:5: [*] 1 blank line required after class docstring 194 195 | 195 196 | -error[D204]: D.py:649:5: [*] 1 blank line required after class docstring +error[D204]: 649:5: [*] 1 blank line required after class docstring + --> D.py:649:5 | 648 | class StatementOnSameLineAsDocstring: 649 | "After this docstring there's another statement on the same line separated by a semicolon." ; priorities=1 @@ -60,8 +63,9 @@ error[D204]: D.py:649:5: [*] 1 blank line required after class docstring 651 653 | pass 652 654 | -error[D204]: D.py:654:5: [*] 1 blank line required after class docstring +error[D204]: 654:5: [*] 1 blank line required after class docstring + --> D.py:654:5 | 653 | class StatementOnSameLineAsDocstring: 654 | "After this docstring there's another statement on the same line separated by a semicolon."; priorities=1 @@ -80,8 +84,9 @@ error[D204]: D.py:654:5: [*] 1 blank line required after class docstring 656 658 | 657 659 | class CommentAfterDocstring: -error[D204]: D.py:658:5: [*] 1 blank line required after class docstring +error[D204]: 658:5: [*] 1 blank line required after class docstring + --> D.py:658:5 | 657 | class CommentAfterDocstring: 658 | "After this docstring there's a comment." # priorities=1 diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D205_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D205_D.py.snap index 2a13123bcf..cdd4832dd8 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D205_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D205_D.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs --- -error[D205]: D.py:200:5: 1 blank line required between summary line and description +error[D205]: 200:5: 1 blank line required between summary line and description + --> D.py:200:5 | 198 | @expect('D213: Multi-line docstring summary should start at the second line') 199 | def multi_line_zero_separating_blanks(): @@ -14,8 +15,9 @@ error[D205]: D.py:200:5: 1 blank line required between summary line and descript | |_______^ | = help: Insert single blank line -error[D205]: D.py:210:5: [*] 1 blank line required between summary line and description (found 2) +error[D205]: 210:5: [*] 1 blank line required between summary line and description (found 2) + --> D.py:210:5 | 208 | @expect('D213: Multi-line docstring summary should start at the second line') 209 | def multi_line_two_separating_blanks(): diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D207_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D207_D.py.snap index d7a0d016f9..1bccf223a9 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D207_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D207_D.py.snap @@ -1,13 +1,14 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs --- -error[D207]: D.py:232:1: [*] Docstring is under-indented +error[D207]: 232:1: [*] Docstring is under-indented + --> D.py:231:1 | 230 | """Summary. 231 | -232 | Description. | ^ +232 | Description. 233 | 234 | """ | @@ -22,13 +23,14 @@ error[D207]: D.py:232:1: [*] Docstring is under-indented 234 234 | """ 235 235 | -error[D207]: D.py:244:1: [*] Docstring is under-indented +error[D207]: 244:1: [*] Docstring is under-indented + --> D.py:243:1 | 242 | Description. 243 | -244 | """ | ^ +244 | """ | = help: Increase indentation ℹ Safe fix @@ -41,13 +43,14 @@ error[D207]: D.py:244:1: [*] Docstring is under-indented 246 246 | 247 247 | @expect('D208: Docstring is over-indented') -error[D207]: D.py:440:1: [*] Docstring is under-indented +error[D207]: 440:1: [*] Docstring is under-indented + --> D.py:439:1 | 438 | def docstring_start_in_same_line(): """First Line. 439 | -440 | Second Line | ^ +440 | Second Line 441 | """ | = help: Increase indentation @@ -61,12 +64,13 @@ error[D207]: D.py:440:1: [*] Docstring is under-indented 442 442 | 443 443 | -error[D207]: D.py:441:1: [*] Docstring is under-indented +error[D207]: 441:1: [*] Docstring is under-indented + --> D.py:440:16 | 440 | Second Line + | ^ 441 | """ - | ^ | = help: Increase indentation ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D208_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D208_D.py.snap index 7708b08e93..2ad6990caf 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D208_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D208_D.py.snap @@ -1,13 +1,14 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs --- -error[D208]: D.py:252:1: [*] Docstring is over-indented +error[D208]: 252:1: [*] Docstring is over-indented + --> D.py:251:1 | 250 | """Summary. 251 | -252 | Description. | ^ +252 | Description. 253 | 254 | """ | @@ -22,13 +23,14 @@ error[D208]: D.py:252:1: [*] Docstring is over-indented 254 254 | """ 255 255 | -error[D208]: D.py:264:1: [*] Docstring is over-indented +error[D208]: 264:1: [*] Docstring is over-indented + --> D.py:263:1 | 262 | Description. 263 | -264 | """ | ^ +264 | """ | = help: Remove over-indentation ℹ Safe fix @@ -41,13 +43,14 @@ error[D208]: D.py:264:1: [*] Docstring is over-indented 266 266 | 267 267 | @expect('D208: Docstring is over-indented') -error[D208]: D.py:272:1: [*] Docstring is over-indented +error[D208]: 272:1: [*] Docstring is over-indented + --> D.py:271:1 | 270 | """Summary. 271 | -272 | Description. | ^ +272 | Description. 273 | 274 | """ | @@ -62,13 +65,14 @@ error[D208]: D.py:272:1: [*] Docstring is over-indented 274 274 | """ 275 275 | -error[D208]: D.py:673:1: [*] Docstring is over-indented +error[D208]: 673:1: [*] Docstring is over-indented + --> D.py:672:1 | 671 | """Summary. 672 | -673 | This is overindented | ^ +673 | This is overindented 674 | And so is this, but it we should preserve the extra space on this line relative 675 | to the one before | @@ -83,12 +87,13 @@ error[D208]: D.py:673:1: [*] Docstring is over-indented 675 675 | to the one before 676 676 | """ -error[D208]: D.py:674:1: [*] Docstring is over-indented +error[D208]: 674:1: [*] Docstring is over-indented + --> D.py:673:29 | 673 | This is overindented + | ^ 674 | And so is this, but it we should preserve the extra space on this line relative - | ^ 675 | to the one before 676 | """ | @@ -103,13 +108,14 @@ error[D208]: D.py:674:1: [*] Docstring is over-indented 676 676 | """ 677 677 | -error[D208]: D.py:675:1: [*] Docstring is over-indented +error[D208]: 675:1: [*] Docstring is over-indented + --> D.py:674:92 | 673 | This is overindented 674 | And so is this, but it we should preserve the extra space on this line relative + | ^ 675 | to the one before - | ^ 676 | """ | = help: Remove over-indentation @@ -123,13 +129,14 @@ error[D208]: D.py:675:1: [*] Docstring is over-indented 677 677 | 678 678 | -error[D208]: D.py:682:1: [*] Docstring is over-indented +error[D208]: 682:1: [*] Docstring is over-indented + --> D.py:681:1 | 680 | """Summary. 681 | -682 | This is overindented | ^ +682 | This is overindented 683 | And so is this, but it we should preserve the extra space on this line relative 684 | to the one before | @@ -144,12 +151,13 @@ error[D208]: D.py:682:1: [*] Docstring is over-indented 684 684 | to the one before 685 685 | This is also overindented -error[D208]: D.py:683:1: [*] Docstring is over-indented +error[D208]: 683:1: [*] Docstring is over-indented + --> D.py:682:29 | 682 | This is overindented + | ^ 683 | And so is this, but it we should preserve the extra space on this line relative - | ^ 684 | to the one before 685 | This is also overindented | @@ -164,13 +172,14 @@ error[D208]: D.py:683:1: [*] Docstring is over-indented 685 685 | This is also overindented 686 686 | And so is this, but it we should preserve the extra space on this line relative -error[D208]: D.py:684:1: [*] Docstring is over-indented +error[D208]: 684:1: [*] Docstring is over-indented + --> D.py:683:92 | 682 | This is overindented 683 | And so is this, but it we should preserve the extra space on this line relative + | ^ 684 | to the one before - | ^ 685 | This is also overindented 686 | And so is this, but it we should preserve the extra space on this line relative | @@ -185,13 +194,14 @@ error[D208]: D.py:684:1: [*] Docstring is over-indented 686 686 | And so is this, but it we should preserve the extra space on this line relative 687 687 | to the one before -error[D208]: D.py:685:1: [*] Docstring is over-indented +error[D208]: 685:1: [*] Docstring is over-indented + --> D.py:684:30 | 683 | And so is this, but it we should preserve the extra space on this line relative 684 | to the one before + | ^ 685 | This is also overindented - | ^ 686 | And so is this, but it we should preserve the extra space on this line relative 687 | to the one before | @@ -206,13 +216,14 @@ error[D208]: D.py:685:1: [*] Docstring is over-indented 687 687 | to the one before 688 688 | """ -error[D208]: D.py:686:1: [*] Docstring is over-indented +error[D208]: 686:1: [*] Docstring is over-indented + --> D.py:685:34 | 684 | to the one before 685 | This is also overindented + | ^ 686 | And so is this, but it we should preserve the extra space on this line relative - | ^ 687 | to the one before 688 | """ | @@ -227,13 +238,14 @@ error[D208]: D.py:686:1: [*] Docstring is over-indented 688 688 | """ 689 689 | -error[D208]: D.py:687:1: [*] Docstring is over-indented +error[D208]: 687:1: [*] Docstring is over-indented + --> D.py:686:92 | 685 | This is also overindented 686 | And so is this, but it we should preserve the extra space on this line relative + | ^ 687 | to the one before - | ^ 688 | """ | = help: Remove over-indentation @@ -247,13 +259,14 @@ error[D208]: D.py:687:1: [*] Docstring is over-indented 689 689 | 690 690 | -error[D208]: D.py:695:1: [*] Docstring is over-indented +error[D208]: 695:1: [*] Docstring is over-indented + --> D.py:694:1 | 693 | """Summary. 694 | -695 | This is overindented | ^ +695 | This is overindented 696 | And so is this, but it we should preserve the extra space on this line relative 697 | to the one before | @@ -268,12 +281,13 @@ error[D208]: D.py:695:1: [*] Docstring is over-indented 697 697 | to the one before 698 698 | And the relative indent here should be preserved too -error[D208]: D.py:696:1: [*] Docstring is over-indented +error[D208]: 696:1: [*] Docstring is over-indented + --> D.py:695:29 | 695 | This is overindented + | ^ 696 | And so is this, but it we should preserve the extra space on this line relative - | ^ 697 | to the one before 698 | And the relative indent here should be preserved too | @@ -288,13 +302,14 @@ error[D208]: D.py:696:1: [*] Docstring is over-indented 698 698 | And the relative indent here should be preserved too 699 699 | """ -error[D208]: D.py:697:1: [*] Docstring is over-indented +error[D208]: 697:1: [*] Docstring is over-indented + --> D.py:696:92 | 695 | This is overindented 696 | And so is this, but it we should preserve the extra space on this line relative + | ^ 697 | to the one before - | ^ 698 | And the relative indent here should be preserved too 699 | """ | @@ -309,13 +324,14 @@ error[D208]: D.py:697:1: [*] Docstring is over-indented 699 699 | """ 700 700 | -error[D208]: D.py:698:1: [*] Docstring is over-indented +error[D208]: 698:1: [*] Docstring is over-indented + --> D.py:697:30 | 696 | And so is this, but it we should preserve the extra space on this line relative 697 | to the one before + | ^ 698 | And the relative indent here should be preserved too - | ^ 699 | """ | = help: Remove over-indentation @@ -329,13 +345,14 @@ error[D208]: D.py:698:1: [*] Docstring is over-indented 700 700 | 701 701 | def retain_extra_whitespace_followed_by_same_offset(): -error[D208]: D.py:704:1: [*] Docstring is over-indented +error[D208]: 704:1: [*] Docstring is over-indented + --> D.py:703:1 | 702 | """Summary. 703 | -704 | This is overindented | ^ +704 | This is overindented 705 | And so is this, but it we should preserve the extra space on this line relative 706 | This is overindented | @@ -350,12 +367,13 @@ error[D208]: D.py:704:1: [*] Docstring is over-indented 706 706 | This is overindented 707 707 | This is overindented -error[D208]: D.py:705:1: [*] Docstring is over-indented +error[D208]: 705:1: [*] Docstring is over-indented + --> D.py:704:29 | 704 | This is overindented + | ^ 705 | And so is this, but it we should preserve the extra space on this line relative - | ^ 706 | This is overindented 707 | This is overindented | @@ -370,13 +388,14 @@ error[D208]: D.py:705:1: [*] Docstring is over-indented 707 707 | This is overindented 708 708 | """ -error[D208]: D.py:706:1: [*] Docstring is over-indented +error[D208]: 706:1: [*] Docstring is over-indented + --> D.py:705:92 | 704 | This is overindented 705 | And so is this, but it we should preserve the extra space on this line relative + | ^ 706 | This is overindented - | ^ 707 | This is overindented 708 | """ | @@ -391,13 +410,14 @@ error[D208]: D.py:706:1: [*] Docstring is over-indented 708 708 | """ 709 709 | -error[D208]: D.py:707:1: [*] Docstring is over-indented +error[D208]: 707:1: [*] Docstring is over-indented + --> D.py:706:29 | 705 | And so is this, but it we should preserve the extra space on this line relative 706 | This is overindented + | ^ 707 | This is overindented - | ^ 708 | """ | = help: Remove over-indentation @@ -411,13 +431,14 @@ error[D208]: D.py:707:1: [*] Docstring is over-indented 709 709 | 710 710 | -error[D208]: D.py:723:1: [*] Docstring is over-indented +error[D208]: 723:1: [*] Docstring is over-indented + --> D.py:722:1 | 721 | """There's a non-breaking space (2-bytes) after 3 spaces (https://github.com/astral-sh/ruff/issues/9080). 722 | -723 |     Returns: | ^ +723 |     Returns: 724 | """ | = help: Remove over-indentation diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D208_D208.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D208_D208.py.snap index 917e535d33..e6ceafdfd7 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D208_D208.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D208_D208.py.snap @@ -1,12 +1,13 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs --- -error[D208]: D208.py:2:1: [*] Docstring is over-indented +error[D208]: 2:1: [*] Docstring is over-indented + --> D208.py:1:4 | 1 | """ + | ^ 2 | Author - | ^ 3 | """ | = help: Remove over-indentation @@ -18,13 +19,14 @@ error[D208]: D208.py:2:1: [*] Docstring is over-indented 4 4 | 5 5 | -error[D208]: D208.py:8:1: [*] Docstring is over-indented +error[D208]: 8:1: [*] Docstring is over-indented + --> D208.py:7:23 | 6 | class Platform: 7 | """ Remove sampler + | ^ 8 | Args: - | ^ 9 |     Returns: 10 | """ | @@ -39,13 +41,14 @@ error[D208]: D208.py:8:1: [*] Docstring is over-indented 10 10 | """ 11 11 | -error[D208]: D208.py:9:1: [*] Docstring is over-indented +error[D208]: 9:1: [*] Docstring is over-indented + --> D208.py:8:18 | 7 | """ Remove sampler 8 | Args: + | ^ 9 |     Returns: - | ^ 10 | """ | = help: Remove over-indentation @@ -59,13 +62,14 @@ error[D208]: D208.py:9:1: [*] Docstring is over-indented 11 11 | 12 12 | -error[D208]: D208.py:10:1: [*] Docstring is over-indented +error[D208]: 10:1: [*] Docstring is over-indented + --> D208.py:9:21 | 8 | Args: 9 |     Returns: + | ^ 10 | """ - | ^ | = help: Remove over-indentation ℹ Safe fix diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D209_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D209_D.py.snap index 575cd314b7..bb242534fa 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D209_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D209_D.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs --- -error[D209]: D.py:281:5: [*] Multi-line docstring closing quotes should be on a separate line +error[D209]: 281:5: [*] Multi-line docstring closing quotes should be on a separate line + --> D.py:281:5 | 279 | @expect('D213: Multi-line docstring summary should start at the second line') 280 | def asdfljdf24(): @@ -24,8 +25,9 @@ error[D209]: D.py:281:5: [*] Multi-line docstring closing quotes should be on a 285 286 | 286 287 | @expect('D210: No whitespaces allowed surrounding docstring text') -error[D209]: D.py:588:5: [*] Multi-line docstring closing quotes should be on a separate line +error[D209]: 588:5: [*] Multi-line docstring closing quotes should be on a separate line + --> D.py:588:5 | 586 | @expect('D213: Multi-line docstring summary should start at the second line') 587 | def asdfljdjgf24(): diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D210_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D210_D.py.snap index 3e0a1e7fc7..081934081e 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D210_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D210_D.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs --- -error[D210]: D.py:288:5: [*] No whitespaces allowed surrounding docstring text +error[D210]: 288:5: [*] No whitespaces allowed surrounding docstring text + --> D.py:288:5 | 286 | @expect('D210: No whitespaces allowed surrounding docstring text') 287 | def endswith(): @@ -20,8 +21,9 @@ error[D210]: D.py:288:5: [*] No whitespaces allowed surrounding docstring text 290 290 | 291 291 | @expect('D210: No whitespaces allowed surrounding docstring text') -error[D210]: D.py:293:5: [*] No whitespaces allowed surrounding docstring text +error[D210]: 293:5: [*] No whitespaces allowed surrounding docstring text + --> D.py:293:5 | 291 | @expect('D210: No whitespaces allowed surrounding docstring text') 292 | def around(): @@ -39,8 +41,9 @@ error[D210]: D.py:293:5: [*] No whitespaces allowed surrounding docstring text 295 295 | 296 296 | @expect('D210: No whitespaces allowed surrounding docstring text') -error[D210]: D.py:299:5: [*] No whitespaces allowed surrounding docstring text +error[D210]: 299:5: [*] No whitespaces allowed surrounding docstring text + --> D.py:299:5 | 297 | @expect('D213: Multi-line docstring summary should start at the second line') 298 | def multiline(): @@ -62,8 +65,9 @@ error[D210]: D.py:299:5: [*] No whitespaces allowed surrounding docstring text 301 301 | This is the end. 302 302 | """ -error[D210]: D.py:581:5: No whitespaces allowed surrounding docstring text +error[D210]: 581:5: No whitespaces allowed surrounding docstring text + --> D.py:581:5 | 579 | "or exclamation point (not '\"')") 580 | def endswith_quote(): diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D211_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D211_D.py.snap index ccbac4c63e..1a74681495 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D211_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D211_D.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs --- -error[D211]: D.py:170:5: [*] No blank lines allowed before class docstring +error[D211]: 170:5: [*] No blank lines allowed before class docstring + --> D.py:170:5 | 168 | class WithLeadingSpace: 169 | @@ -19,8 +20,9 @@ error[D211]: D.py:170:5: [*] No blank lines allowed before class docstring 171 170 | 172 171 | -error[D211]: D.py:181:5: [*] No blank lines allowed before class docstring +error[D211]: 181:5: [*] No blank lines allowed before class docstring + --> D.py:181:5 | 179 | class TrailingSpace: 180 | diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D212_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D212_D.py.snap index 8d8837ae65..720d73c1d3 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D212_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D212_D.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs --- -error[D212]: D.py:129:5: [*] Multi-line docstring summary should start at the first line +error[D212]: 129:5: [*] Multi-line docstring summary should start at the first line + --> D.py:129:5 | 127 | @expect('D212: Multi-line docstring summary should start at the first line') 128 | def asdlkfasd(): @@ -24,8 +25,9 @@ error[D212]: D.py:129:5: [*] Multi-line docstring summary should start at the fi 132 131 | 133 132 | -error[D212]: D.py:597:5: [*] Multi-line docstring summary should start at the first line +error[D212]: 597:5: [*] Multi-line docstring summary should start at the first line + --> D.py:597:5 | 595 | @expect('D212: Multi-line docstring summary should start at the first line') 596 | def one_liner(): @@ -48,8 +50,9 @@ error[D212]: D.py:597:5: [*] Multi-line docstring summary should start at the fi 601 599 | 602 600 | @expect('D200: One-line docstring should fit on one line with quotes ' -error[D212]: D.py:624:5: [*] Multi-line docstring summary should start at the first line +error[D212]: 624:5: [*] Multi-line docstring summary should start at the first line + --> D.py:624:5 | 622 | @expect('D212: Multi-line docstring summary should start at the first line') 623 | def one_liner(): diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D213_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D213_D.py.snap index fb1327991b..3609f1206e 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D213_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D213_D.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs --- -error[D213]: D.py:200:5: [*] Multi-line docstring summary should start at the second line +error[D213]: 200:5: [*] Multi-line docstring summary should start at the second line + --> D.py:200:5 | 198 | @expect('D213: Multi-line docstring summary should start at the second line') 199 | def multi_line_zero_separating_blanks(): @@ -25,8 +26,9 @@ error[D213]: D.py:200:5: [*] Multi-line docstring summary should start at the se 202 203 | 203 204 | """ -error[D213]: D.py:210:5: [*] Multi-line docstring summary should start at the second line +error[D213]: 210:5: [*] Multi-line docstring summary should start at the second line + --> D.py:210:5 | 208 | @expect('D213: Multi-line docstring summary should start at the second line') 209 | def multi_line_two_separating_blanks(): @@ -51,8 +53,9 @@ error[D213]: D.py:210:5: [*] Multi-line docstring summary should start at the se 212 213 | 213 214 | Description. -error[D213]: D.py:220:5: [*] Multi-line docstring summary should start at the second line +error[D213]: 220:5: [*] Multi-line docstring summary should start at the second line + --> D.py:220:5 | 218 | @expect('D213: Multi-line docstring summary should start at the second line') 219 | def multi_line_one_separating_blanks(): @@ -76,8 +79,9 @@ error[D213]: D.py:220:5: [*] Multi-line docstring summary should start at the se 222 223 | Description. 223 224 | -error[D213]: D.py:230:5: [*] Multi-line docstring summary should start at the second line +error[D213]: 230:5: [*] Multi-line docstring summary should start at the second line + --> D.py:230:5 | 228 | @expect('D213: Multi-line docstring summary should start at the second line') 229 | def asdfsdf(): @@ -101,8 +105,9 @@ error[D213]: D.py:230:5: [*] Multi-line docstring summary should start at the se 232 233 | Description. 233 234 | -error[D213]: D.py:240:5: [*] Multi-line docstring summary should start at the second line +error[D213]: 240:5: [*] Multi-line docstring summary should start at the second line + --> D.py:240:5 | 238 | @expect('D213: Multi-line docstring summary should start at the second line') 239 | def asdsdfsdffsdf(): @@ -126,8 +131,9 @@ error[D213]: D.py:240:5: [*] Multi-line docstring summary should start at the se 242 243 | Description. 243 244 | -error[D213]: D.py:250:5: [*] Multi-line docstring summary should start at the second line +error[D213]: 250:5: [*] Multi-line docstring summary should start at the second line + --> D.py:250:5 | 248 | @expect('D213: Multi-line docstring summary should start at the second line') 249 | def asdfsdsdf24(): @@ -151,8 +157,9 @@ error[D213]: D.py:250:5: [*] Multi-line docstring summary should start at the se 252 253 | Description. 253 254 | -error[D213]: D.py:260:5: [*] Multi-line docstring summary should start at the second line +error[D213]: 260:5: [*] Multi-line docstring summary should start at the second line + --> D.py:260:5 | 258 | @expect('D213: Multi-line docstring summary should start at the second line') 259 | def asdfsdsdfsdf24(): @@ -176,8 +183,9 @@ error[D213]: D.py:260:5: [*] Multi-line docstring summary should start at the se 262 263 | Description. 263 264 | -error[D213]: D.py:270:5: [*] Multi-line docstring summary should start at the second line +error[D213]: 270:5: [*] Multi-line docstring summary should start at the second line + --> D.py:270:5 | 268 | @expect('D213: Multi-line docstring summary should start at the second line') 269 | def asdfsdfsdsdsdfsdf24(): @@ -201,8 +209,9 @@ error[D213]: D.py:270:5: [*] Multi-line docstring summary should start at the se 272 273 | Description. 273 274 | -error[D213]: D.py:281:5: [*] Multi-line docstring summary should start at the second line +error[D213]: 281:5: [*] Multi-line docstring summary should start at the second line + --> D.py:281:5 | 279 | @expect('D213: Multi-line docstring summary should start at the second line') 280 | def asdfljdf24(): @@ -224,8 +233,9 @@ error[D213]: D.py:281:5: [*] Multi-line docstring summary should start at the se 283 284 | Description.""" 284 285 | -error[D213]: D.py:299:5: [*] Multi-line docstring summary should start at the second line +error[D213]: 299:5: [*] Multi-line docstring summary should start at the second line + --> D.py:299:5 | 297 | @expect('D213: Multi-line docstring summary should start at the second line') 298 | def multiline(): @@ -248,8 +258,9 @@ error[D213]: D.py:299:5: [*] Multi-line docstring summary should start at the se 301 302 | This is the end. 302 303 | """ -error[D213]: D.py:343:5: [*] Multi-line docstring summary should start at the second line +error[D213]: 343:5: [*] Multi-line docstring summary should start at the second line + --> D.py:343:5 | 341 | @expect('D213: Multi-line docstring summary should start at the second line') 342 | def exceptions_of_D301(): @@ -274,8 +285,9 @@ error[D213]: D.py:343:5: [*] Multi-line docstring summary should start at the se 345 346 | In particular, line continuations \ 346 347 | and unicode literals \u0394 and \N{GREEK CAPITAL LETTER DELTA}. -error[D213]: D.py:383:5: [*] Multi-line docstring summary should start at the second line +error[D213]: 383:5: [*] Multi-line docstring summary should start at the second line + --> D.py:383:5 | 381 | @expect('D213: Multi-line docstring summary should start at the second line') 382 | def new_209(): @@ -299,8 +311,9 @@ error[D213]: D.py:383:5: [*] Multi-line docstring summary should start at the se 385 386 | More lines. 386 387 | """ -error[D213]: D.py:392:5: [*] Multi-line docstring summary should start at the second line +error[D213]: 392:5: [*] Multi-line docstring summary should start at the second line + --> D.py:392:5 | 390 | @expect('D213: Multi-line docstring summary should start at the second line') 391 | def old_209(): @@ -324,8 +337,9 @@ error[D213]: D.py:392:5: [*] Multi-line docstring summary should start at the se 394 395 | Multi-line comments. OK to have extra blank line 395 396 | -error[D213]: D.py:438:37: [*] Multi-line docstring summary should start at the second line +error[D213]: 438:37: [*] Multi-line docstring summary should start at the second line + --> D.py:438:37 | 436 | @expect("D207: Docstring is under-indented") 437 | @expect('D213: Multi-line docstring summary should start at the second line') @@ -348,8 +362,9 @@ error[D213]: D.py:438:37: [*] Multi-line docstring summary should start at the s 440 441 | Second Line 441 442 | """ -error[D213]: D.py:450:5: [*] Multi-line docstring summary should start at the second line +error[D213]: 450:5: [*] Multi-line docstring summary should start at the second line + --> D.py:450:5 | 448 | @expect('D213: Multi-line docstring summary should start at the second line') 449 | def a_following_valid_function(x=None): @@ -373,8 +388,9 @@ error[D213]: D.py:450:5: [*] Multi-line docstring summary should start at the se 452 453 | The assertion was caused in the next function, so this one is necessary. 453 454 | -error[D213]: D.py:526:5: [*] Multi-line docstring summary should start at the second line +error[D213]: 526:5: [*] Multi-line docstring summary should start at the second line + --> D.py:526:5 | 524 | # parameters as functions for Google / Numpy conventions. 525 | class Blah: # noqa: D203,D213 @@ -402,8 +418,9 @@ error[D213]: D.py:526:5: [*] Multi-line docstring summary should start at the se 528 529 | Parameters 529 530 | ---------- -error[D213]: D.py:546:5: [*] Multi-line docstring summary should start at the second line +error[D213]: 546:5: [*] Multi-line docstring summary should start at the second line + --> D.py:546:5 | 544 | def multiline_leading_space(): 545 | @@ -426,8 +443,9 @@ error[D213]: D.py:546:5: [*] Multi-line docstring summary should start at the se 548 549 | More content. 549 550 | """ -error[D213]: D.py:555:5: [*] Multi-line docstring summary should start at the second line +error[D213]: 555:5: [*] Multi-line docstring summary should start at the second line + --> D.py:555:5 | 553 | @expect('D213: Multi-line docstring summary should start at the second line') 554 | def multiline_trailing_space(): @@ -452,8 +470,9 @@ error[D213]: D.py:555:5: [*] Multi-line docstring summary should start at the se 557 558 | More content. 558 559 | """ -error[D213]: D.py:568:5: [*] Multi-line docstring summary should start at the second line +error[D213]: 568:5: [*] Multi-line docstring summary should start at the second line + --> D.py:568:5 | 566 | def multiline_trailing_and_leading_space(): 567 | @@ -478,8 +497,9 @@ error[D213]: D.py:568:5: [*] Multi-line docstring summary should start at the se 570 571 | More content. 571 572 | """ -error[D213]: D.py:588:5: [*] Multi-line docstring summary should start at the second line +error[D213]: 588:5: [*] Multi-line docstring summary should start at the second line + --> D.py:588:5 | 586 | @expect('D213: Multi-line docstring summary should start at the second line') 587 | def asdfljdjgf24(): @@ -501,8 +521,9 @@ error[D213]: D.py:588:5: [*] Multi-line docstring summary should start at the se 590 591 | Description. """ 591 592 | -error[D213]: D.py:606:5: [*] Multi-line docstring summary should start at the second line +error[D213]: 606:5: [*] Multi-line docstring summary should start at the second line + --> D.py:606:5 | 604 | @expect('D212: Multi-line docstring summary should start at the first line') 605 | def one_liner(): @@ -524,8 +545,9 @@ error[D213]: D.py:606:5: [*] Multi-line docstring summary should start at the se 608 609 | """ 609 610 | -error[D213]: D.py:615:5: [*] Multi-line docstring summary should start at the second line +error[D213]: 615:5: [*] Multi-line docstring summary should start at the second line + --> D.py:615:5 | 613 | @expect('D212: Multi-line docstring summary should start at the first line') 614 | def one_liner(): @@ -547,8 +569,9 @@ error[D213]: D.py:615:5: [*] Multi-line docstring summary should start at the se 617 618 | """ 618 619 | -error[D213]: D.py:671:5: [*] Multi-line docstring summary should start at the second line +error[D213]: 671:5: [*] Multi-line docstring summary should start at the second line + --> D.py:671:5 | 670 | def retain_extra_whitespace(): 671 | """Summary. @@ -572,8 +595,9 @@ error[D213]: D.py:671:5: [*] Multi-line docstring summary should start at the se 673 674 | This is overindented 674 675 | And so is this, but it we should preserve the extra space on this line relative -error[D213]: D.py:680:5: [*] Multi-line docstring summary should start at the second line +error[D213]: 680:5: [*] Multi-line docstring summary should start at the second line + --> D.py:680:5 | 679 | def retain_extra_whitespace_multiple(): 680 | """Summary. @@ -600,8 +624,9 @@ error[D213]: D.py:680:5: [*] Multi-line docstring summary should start at the se 682 683 | This is overindented 683 684 | And so is this, but it we should preserve the extra space on this line relative -error[D213]: D.py:693:5: [*] Multi-line docstring summary should start at the second line +error[D213]: 693:5: [*] Multi-line docstring summary should start at the second line + --> D.py:693:5 | 692 | def retain_extra_whitespace_deeper(): 693 | """Summary. @@ -628,8 +653,9 @@ error[D213]: D.py:693:5: [*] Multi-line docstring summary should start at the se 695 696 | This is overindented 696 697 | And so is this, but it we should preserve the extra space on this line relative -error[D213]: D.py:702:5: [*] Multi-line docstring summary should start at the second line +error[D213]: 702:5: [*] Multi-line docstring summary should start at the second line + --> D.py:702:5 | 701 | def retain_extra_whitespace_followed_by_same_offset(): 702 | """Summary. @@ -654,8 +680,9 @@ error[D213]: D.py:702:5: [*] Multi-line docstring summary should start at the se 704 705 | This is overindented 705 706 | And so is this, but it we should preserve the extra space on this line relative -error[D213]: D.py:712:5: [*] Multi-line docstring summary should start at the second line +error[D213]: 712:5: [*] Multi-line docstring summary should start at the second line + --> D.py:712:5 | 711 | def retain_extra_whitespace_not_overindented(): 712 | """Summary. @@ -679,8 +706,9 @@ error[D213]: D.py:712:5: [*] Multi-line docstring summary should start at the se 714 715 | This is not overindented 715 716 | This is overindented, but since one line is not overindented this should not raise -error[D213]: D.py:721:5: [*] Multi-line docstring summary should start at the second line +error[D213]: 721:5: [*] Multi-line docstring summary should start at the second line + --> D.py:721:5 | 720 | def inconsistent_indent_byte_size(): 721 | """There's a non-breaking space (2-bytes) after 3 spaces (https://github.com/astral-sh/ruff/issues/9080). diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D214_D214_module.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D214_D214_module.py.snap index 41713d56c8..2adad1a51b 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D214_D214_module.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D214_D214_module.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs --- -error[D214]: D214_module.py:3:5: [*] Section is over-indented ("Returns") +error[D214]: 3:5: [*] Section is over-indented ("Returns") + --> D214_module.py:3:5 | 1 | """A module docstring with D214 violations 2 | @@ -21,8 +22,9 @@ error[D214]: D214_module.py:3:5: [*] Section is over-indented ("Returns") 5 5 | valid returns 6 6 | -error[D214]: D214_module.py:7:5: [*] Section is over-indented ("Args") +error[D214]: 7:5: [*] Section is over-indented ("Args") + --> D214_module.py:7:5 | 5 | valid returns 6 | diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D214_sections.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D214_sections.py.snap index 8771087502..ebb5388362 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D214_sections.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D214_sections.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs --- -error[D214]: sections.py:146:9: [*] Section is over-indented ("Returns") +error[D214]: 146:9: [*] Section is over-indented ("Returns") + --> sections.py:146:9 | 144 | """Toggle the gizmo. 145 | @@ -22,8 +23,9 @@ error[D214]: sections.py:146:9: [*] Section is over-indented ("Returns") 148 148 | A value of some sort. 149 149 | -error[D214]: sections.py:563:9: [*] Section is over-indented ("Returns") +error[D214]: 563:9: [*] Section is over-indented ("Returns") + --> sections.py:563:9 | 561 | Here's a note. 562 | diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D215_D215.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D215_D215.py.snap index 9d6e69726b..abd0af8213 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D215_D215.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D215_D215.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs --- -error[D215]: D215.py:3:5: [*] Section underline is over-indented ("TODO") +error[D215]: 3:5: [*] Section underline is over-indented ("TODO") + --> D215.py:3:5 | 1 | """ 2 | TODO: diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D215_sections.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D215_sections.py.snap index 746d011d0f..1bf94c356b 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D215_sections.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D215_sections.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs --- -error[D215]: sections.py:159:9: [*] Section underline is over-indented ("Returns") +error[D215]: 159:9: [*] Section underline is over-indented ("Returns") + --> sections.py:159:9 | 158 | Returns 159 | ------- @@ -20,8 +21,9 @@ error[D215]: sections.py:159:9: [*] Section underline is over-indented ("Returns 161 161 | 162 162 | """ -error[D215]: sections.py:173:9: [*] Section underline is over-indented ("Returns") +error[D215]: 173:9: [*] Section underline is over-indented ("Returns") + --> sections.py:173:9 | 172 | Returns 173 | ------- diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D300_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D300_D.py.snap index b61ece4601..af6e1c10b5 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D300_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D300_D.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs --- -error[D300]: D.py:307:5: [*] Use triple double quotes `"""` +error[D300]: 307:5: [*] Use triple double quotes `"""` + --> D.py:307:5 | 305 | @expect('D300: Use """triple double quotes""" (found \'\'\'-quotes)') 306 | def triple_single_quotes_raw(): @@ -20,8 +21,9 @@ error[D300]: D.py:307:5: [*] Use triple double quotes `"""` 309 309 | 310 310 | @expect('D300: Use """triple double quotes""" (found \'\'\'-quotes)') -error[D300]: D.py:312:5: [*] Use triple double quotes `"""` +error[D300]: 312:5: [*] Use triple double quotes `"""` + --> D.py:312:5 | 310 | @expect('D300: Use """triple double quotes""" (found \'\'\'-quotes)') 311 | def triple_single_quotes_raw_uppercase(): @@ -39,8 +41,9 @@ error[D300]: D.py:312:5: [*] Use triple double quotes `"""` 314 314 | 315 315 | @expect('D300: Use """triple double quotes""" (found \'-quotes)') -error[D300]: D.py:317:5: [*] Use triple double quotes `"""` +error[D300]: 317:5: [*] Use triple double quotes `"""` + --> D.py:317:5 | 315 | @expect('D300: Use """triple double quotes""" (found \'-quotes)') 316 | def single_quotes_raw(): @@ -58,8 +61,9 @@ error[D300]: D.py:317:5: [*] Use triple double quotes `"""` 319 319 | 320 320 | @expect('D300: Use """triple double quotes""" (found \'-quotes)') -error[D300]: D.py:322:5: [*] Use triple double quotes `"""` +error[D300]: 322:5: [*] Use triple double quotes `"""` + --> D.py:322:5 | 320 | @expect('D300: Use """triple double quotes""" (found \'-quotes)') 321 | def single_quotes_raw_uppercase(): @@ -77,8 +81,9 @@ error[D300]: D.py:322:5: [*] Use triple double quotes `"""` 324 324 | 325 325 | @expect('D300: Use """triple double quotes""" (found \'-quotes)') -error[D300]: D.py:328:5: [*] Use triple double quotes `"""` +error[D300]: 328:5: [*] Use triple double quotes `"""` + --> D.py:328:5 | 326 | @expect('D301: Use r""" if any backslashes in a docstring') 327 | def single_quotes_raw_uppercase_backslash(): @@ -96,8 +101,9 @@ error[D300]: D.py:328:5: [*] Use triple double quotes `"""` 330 330 | 331 331 | @expect('D301: Use r""" if any backslashes in a docstring') -error[D300]: D.py:645:5: [*] Use triple double quotes `"""` +error[D300]: 645:5: [*] Use triple double quotes `"""` + --> D.py:645:5 | 644 | def single_line_docstring_with_an_escaped_backslash(): 645 | "\ @@ -120,8 +126,9 @@ error[D300]: D.py:645:5: [*] Use triple double quotes `"""` 648 648 | class StatementOnSameLineAsDocstring: 649 649 | "After this docstring there's another statement on the same line separated by a semicolon." ; priorities=1 -error[D300]: D.py:649:5: [*] Use triple double quotes `"""` +error[D300]: 649:5: [*] Use triple double quotes `"""` + --> D.py:649:5 | 648 | class StatementOnSameLineAsDocstring: 649 | "After this docstring there's another statement on the same line separated by a semicolon." ; priorities=1 @@ -140,8 +147,9 @@ error[D300]: D.py:649:5: [*] Use triple double quotes `"""` 651 651 | pass 652 652 | -error[D300]: D.py:654:5: [*] Use triple double quotes `"""` +error[D300]: 654:5: [*] Use triple double quotes `"""` + --> D.py:654:5 | 653 | class StatementOnSameLineAsDocstring: 654 | "After this docstring there's another statement on the same line separated by a semicolon."; priorities=1 @@ -158,8 +166,9 @@ error[D300]: D.py:654:5: [*] Use triple double quotes `"""` 656 656 | 657 657 | class CommentAfterDocstring: -error[D300]: D.py:658:5: [*] Use triple double quotes `"""` +error[D300]: 658:5: [*] Use triple double quotes `"""` + --> D.py:658:5 | 657 | class CommentAfterDocstring: 658 | "After this docstring there's a comment." # priorities=1 @@ -178,8 +187,9 @@ error[D300]: D.py:658:5: [*] Use triple double quotes `"""` 660 660 | pass 661 661 | -error[D300]: D.py:664:5: [*] Use triple double quotes `"""` +error[D300]: 664:5: [*] Use triple double quotes `"""` + --> D.py:664:5 | 663 | def newline_after_closing_quote(self): 664 | "We enforce a newline after the closing quote for a multi-line docstring \ diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D300_D300.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D300_D300.py.snap index f259d0ce59..6290527e7d 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D300_D300.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D300_D300.py.snap @@ -1,16 +1,18 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs --- -error[D300]: D300.py:6:5: Use triple double quotes `"""` +error[D300]: 6:5: Use triple double quotes `"""` + --> D300.py:6:5 | 5 | def ends_in_quote(): 6 | 'Sum\\mary."' | ^^^^^^^^^^^^^ | = help: Convert to triple double quotes -error[D300]: D300.py:10:5: [*] Use triple double quotes `"""` +error[D300]: 10:5: [*] Use triple double quotes `"""` + --> D300.py:10:5 | 9 | def contains_quote(): 10 | 'Sum"\\mary.' diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D301_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D301_D.py.snap index 4ed727c9d0..86cec13c4a 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D301_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D301_D.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs --- -error[D301]: D.py:333:5: [*] Use `r"""` if any backslashes in a docstring +error[D301]: 333:5: [*] Use `r"""` if any backslashes in a docstring + --> D.py:333:5 | 331 | @expect('D301: Use r""" if any backslashes in a docstring') 332 | def double_quotes_backslash(): diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D301_D301.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D301_D301.py.snap index 2d72918693..a863a1ba5c 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D301_D301.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D301_D301.py.snap @@ -1,14 +1,15 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs --- -D301.py:2:5: D301 [*] Use `r"""` if any backslashes in a docstring +error[D301]: 2:5: [*] Use `r"""` if any backslashes in a docstring + + --> D301.py:2:5 | 1 | def double_quotes_backslash(): 2 | """Sum\\mary.""" - | ^^^^^^^^^^^^^^^^ D301 + | ^^^^^^^^^^^^^^^^ | = help: Add `r` prefix - ℹ Unsafe fix 1 1 | def double_quotes_backslash(): 2 |- """Sum\\mary.""" @@ -17,25 +18,27 @@ D301.py:2:5: D301 [*] Use `r"""` if any backslashes in a docstring 4 4 | 5 5 | def double_quotes_backslash_raw(): -D301.py:37:5: D301 Use `r"""` if any backslashes in a docstring +error[D301]: 37:5: Use `r"""` if any backslashes in a docstring + + --> D301.py:37:5 | 36 | def shouldnt_add_raw_here2(): 37 | u"Sum\\mary." - | ^^^^^^^^^^^^^ D301 + | ^^^^^^^^^^^^^ | = help: Add `r` prefix +error[D301]: 93:5: [*] Use `r"""` if any backslashes in a docstring -D301.py:93:5: D301 [*] Use `r"""` if any backslashes in a docstring + --> D301.py:93:5 | 92 | def should_add_raw_for_single_double_quote_escape(): 93 | """ | _____^ 94 | | This is single quote escape \". 95 | | """ - | |_______^ D301 + | |_______^ | = help: Add `r` prefix - ℹ Unsafe fix 90 90 | 91 91 | @@ -46,17 +49,18 @@ D301.py:93:5: D301 [*] Use `r"""` if any backslashes in a docstring 95 95 | """ 96 96 | -D301.py:99:5: D301 [*] Use `r"""` if any backslashes in a docstring +error[D301]: 99:5: [*] Use `r"""` if any backslashes in a docstring + + --> D301.py:99:5 | 98 | def should_add_raw_for_single_single_quote_escape(): 99 | ''' | _____^ 100 | | This is single quote escape \'. 101 | | ''' - | |_______^ D301 + | |_______^ | = help: Add `r` prefix - ℹ Unsafe fix 96 96 | 97 97 | diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D400_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D400_D.py.snap index 6f7f5c3025..1ceaf702cc 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D400_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D400_D.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs --- -error[D400]: D.py:355:5: [*] First line should end with a period +error[D400]: 355:5: [*] First line should end with a period + --> D.py:355:5 | 353 | "or exclamation point (not 'y')") 354 | def lwnlkjl(): @@ -20,8 +21,9 @@ error[D400]: D.py:355:5: [*] First line should end with a period 357 357 | 358 358 | @expect("D401: First line should be in imperative mood " -error[D400]: D.py:406:25: [*] First line should end with a period +error[D400]: 406:25: [*] First line should end with a period + --> D.py:406:25 | 404 | @expect("D415: First line should end with a period, question mark," 405 | " or exclamation point (not 'r')") @@ -39,8 +41,9 @@ error[D400]: D.py:406:25: [*] First line should end with a period 408 408 | 409 409 | def ignored_decorator(func): # noqa: D400,D401,D415 -error[D400]: D.py:410:5: [*] First line should end with a period +error[D400]: 410:5: [*] First line should end with a period + --> D.py:410:5 | 409 | def ignored_decorator(func): # noqa: D400,D401,D415 410 | """Runs something""" @@ -59,8 +62,9 @@ error[D400]: D.py:410:5: [*] First line should end with a period 412 412 | pass 413 413 | -error[D400]: D.py:416:5: [*] First line should end with a period +error[D400]: 416:5: [*] First line should end with a period + --> D.py:416:5 | 415 | def decorator_for_test(func): # noqa: D400,D401,D415 416 | """Runs something""" @@ -79,8 +83,9 @@ error[D400]: D.py:416:5: [*] First line should end with a period 418 418 | pass 419 419 | -error[D400]: D.py:422:35: [*] First line should end with a period +error[D400]: 422:35: [*] First line should end with a period + --> D.py:422:35 | 421 | @ignored_decorator 422 | def oneliner_ignored_decorator(): """One liner""" @@ -97,8 +102,9 @@ error[D400]: D.py:422:35: [*] First line should end with a period 424 424 | 425 425 | @decorator_for_test -error[D400]: D.py:429:49: [*] First line should end with a period +error[D400]: 429:49: [*] First line should end with a period + --> D.py:429:49 | 427 | @expect("D415: First line should end with a period, question mark," 428 | " or exclamation point (not 'r')") @@ -116,8 +122,9 @@ error[D400]: D.py:429:49: [*] First line should end with a period 431 431 | 432 432 | @decorator_for_test -error[D400]: D.py:470:5: [*] First line should end with a period +error[D400]: 470:5: [*] First line should end with a period + --> D.py:470:5 | 468 | "or exclamation point (not 'g')") 469 | def docstring_bad(): @@ -136,8 +143,9 @@ error[D400]: D.py:470:5: [*] First line should end with a period 472 472 | 473 473 | -error[D400]: D.py:475:5: [*] First line should end with a period +error[D400]: 475:5: [*] First line should end with a period + --> D.py:475:5 | 474 | def docstring_bad_ignore_all(): # noqa 475 | """Runs something""" @@ -155,8 +163,9 @@ error[D400]: D.py:475:5: [*] First line should end with a period 477 477 | 478 478 | -error[D400]: D.py:480:5: [*] First line should end with a period +error[D400]: 480:5: [*] First line should end with a period + --> D.py:480:5 | 479 | def docstring_bad_ignore_one(): # noqa: D400,D401,D415 480 | """Runs something""" @@ -174,8 +183,9 @@ error[D400]: D.py:480:5: [*] First line should end with a period 482 482 | 483 483 | -error[D400]: D.py:487:5: [*] First line should end with a period +error[D400]: 487:5: [*] First line should end with a period + --> D.py:487:5 | 485 | "(perhaps 'Run', not 'Runs')") 486 | def docstring_ignore_some_violations_but_catch_D401(): # noqa: E501,D400,D415 @@ -194,8 +204,9 @@ error[D400]: D.py:487:5: [*] First line should end with a period 489 489 | 490 490 | -error[D400]: D.py:514:5: [*] First line should end with a period +error[D400]: 514:5: [*] First line should end with a period + --> D.py:514:5 | 513 | def valid_google_string(): # noqa: D400 514 | """Test a valid something!""" @@ -212,8 +223,9 @@ error[D400]: D.py:514:5: [*] First line should end with a period 516 516 | 517 517 | @expect("D415: First line should end with a period, question mark, " -error[D400]: D.py:520:5: [*] First line should end with a period +error[D400]: 520:5: [*] First line should end with a period + --> D.py:520:5 | 518 | "or exclamation point (not 'g')") 519 | def bad_google_string(): # noqa: D400 @@ -231,8 +243,9 @@ error[D400]: D.py:520:5: [*] First line should end with a period 522 522 | 523 523 | # This is reproducing a bug where AttributeError is raised when parsing class -error[D400]: D.py:581:5: [*] First line should end with a period +error[D400]: 581:5: [*] First line should end with a period + --> D.py:581:5 | 579 | "or exclamation point (not '\"')") 580 | def endswith_quote(): @@ -250,8 +263,9 @@ error[D400]: D.py:581:5: [*] First line should end with a period 583 583 | 584 584 | @expect('D209: Multi-line docstring closing quotes should be on a separate ' -error[D400]: D.py:615:5: [*] First line should end with a period +error[D400]: 615:5: [*] First line should end with a period + --> D.py:615:5 | 613 | @expect('D212: Multi-line docstring summary should start at the first line') 614 | def one_liner(): @@ -272,8 +286,9 @@ error[D400]: D.py:615:5: [*] First line should end with a period 617 617 | """ 618 618 | -error[D400]: D.py:639:17: [*] First line should end with a period +error[D400]: 639:17: [*] First line should end with a period + --> D.py:639:17 | 639 | class SameLine: """This is a docstring on the same line""" | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -291,8 +306,9 @@ error[D400]: D.py:639:17: [*] First line should end with a period 641 641 | def same_line(): """This is a docstring on the same line""" 642 642 | -error[D400]: D.py:641:18: [*] First line should end with a period +error[D400]: 641:18: [*] First line should end with a period + --> D.py:641:18 | 639 | class SameLine: """This is a docstring on the same line""" 640 | @@ -310,8 +326,9 @@ error[D400]: D.py:641:18: [*] First line should end with a period 643 643 | 644 644 | def single_line_docstring_with_an_escaped_backslash(): -error[D400]: D.py:664:5: [*] First line should end with a period +error[D400]: 664:5: [*] First line should end with a period + --> D.py:664:5 | 663 | def newline_after_closing_quote(self): 664 | "We enforce a newline after the closing quote for a multi-line docstring \ diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D400_D400.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D400_D400.py.snap index 665dba76e7..d757d500ae 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D400_D400.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D400_D400.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs --- -error[D400]: D400.py:2:5: [*] First line should end with a period +error[D400]: 2:5: [*] First line should end with a period + --> D400.py:2:5 | 1 | def f(): 2 | "Here's a line without a period" @@ -18,8 +19,9 @@ error[D400]: D400.py:2:5: [*] First line should end with a period 4 4 | 5 5 | -error[D400]: D400.py:7:5: [*] First line should end with a period +error[D400]: 7:5: [*] First line should end with a period + --> D400.py:7:5 | 6 | def f(): 7 | """Here's a line without a period""" @@ -37,8 +39,9 @@ error[D400]: D400.py:7:5: [*] First line should end with a period 9 9 | 10 10 | -error[D400]: D400.py:12:5: [*] First line should end with a period +error[D400]: 12:5: [*] First line should end with a period + --> D400.py:12:5 | 11 | def f(): 12 | """ @@ -60,8 +63,9 @@ error[D400]: D400.py:12:5: [*] First line should end with a period 16 16 | ... 17 17 | -error[D400]: D400.py:20:5: [*] First line should end with a period +error[D400]: 20:5: [*] First line should end with a period + --> D400.py:20:5 | 19 | def f(): 20 | """Here's a line without a period""" @@ -79,8 +83,9 @@ error[D400]: D400.py:20:5: [*] First line should end with a period 22 22 | 23 23 | -error[D400]: D400.py:25:5: [*] First line should end with a period +error[D400]: 25:5: [*] First line should end with a period + --> D400.py:25:5 | 24 | def f(): 25 | """ @@ -101,8 +106,9 @@ error[D400]: D400.py:25:5: [*] First line should end with a period 29 29 | 30 30 | -error[D400]: D400.py:32:5: [*] First line should end with a period +error[D400]: 32:5: [*] First line should end with a period + --> D400.py:32:5 | 31 | def f(): 32 | """ @@ -123,8 +129,9 @@ error[D400]: D400.py:32:5: [*] First line should end with a period 36 36 | 37 37 | -error[D400]: D400.py:39:5: [*] First line should end with a period +error[D400]: 39:5: [*] First line should end with a period + --> D400.py:39:5 | 38 | def f(): 39 | r"Here's a line without a period" @@ -142,8 +149,9 @@ error[D400]: D400.py:39:5: [*] First line should end with a period 41 41 | 42 42 | -error[D400]: D400.py:44:5: [*] First line should end with a period +error[D400]: 44:5: [*] First line should end with a period + --> D400.py:44:5 | 43 | def f(): 44 | r"""Here's a line without a period""" @@ -161,8 +169,9 @@ error[D400]: D400.py:44:5: [*] First line should end with a period 46 46 | 47 47 | -error[D400]: D400.py:49:5: [*] First line should end with a period +error[D400]: 49:5: [*] First line should end with a period + --> D400.py:49:5 | 48 | def f(): 49 | r""" @@ -184,8 +193,9 @@ error[D400]: D400.py:49:5: [*] First line should end with a period 53 53 | ... 54 54 | -error[D400]: D400.py:57:5: [*] First line should end with a period +error[D400]: 57:5: [*] First line should end with a period + --> D400.py:57:5 | 56 | def f(): 57 | r"""Here's a line without a period""" @@ -203,8 +213,9 @@ error[D400]: D400.py:57:5: [*] First line should end with a period 59 59 | 60 60 | -error[D400]: D400.py:62:5: [*] First line should end with a period +error[D400]: 62:5: [*] First line should end with a period + --> D400.py:62:5 | 61 | def f(): 62 | r""" @@ -225,8 +236,9 @@ error[D400]: D400.py:62:5: [*] First line should end with a period 66 66 | 67 67 | -error[D400]: D400.py:69:5: [*] First line should end with a period +error[D400]: 69:5: [*] First line should end with a period + --> D400.py:69:5 | 68 | def f(): 69 | r""" @@ -247,8 +259,9 @@ error[D400]: D400.py:69:5: [*] First line should end with a period 73 73 | 74 74 | -error[D400]: D400.py:97:5: [*] First line should end with a period +error[D400]: 97:5: [*] First line should end with a period + --> D400.py:97:5 | 96 | def f(): 97 | """ diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D401_D401.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D401_D401.py.snap index 30136b8471..8e6bde996c 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D401_D401.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D401_D401.py.snap @@ -1,22 +1,25 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs --- -error[D401]: D401.py:10:5: First line of docstring should be in imperative mood: "Returns foo." +error[D401]: 10:5: First line of docstring should be in imperative mood: "Returns foo." + --> D401.py:10:5 | 9 | def bad_liouiwnlkjl(): 10 | """Returns foo.""" | ^^^^^^^^^^^^^^^^^^ | -error[D401]: D401.py:14:5: First line of docstring should be in imperative mood: "Constructor for a foo." +error[D401]: 14:5: First line of docstring should be in imperative mood: "Constructor for a foo." + --> D401.py:14:5 | 13 | def bad_sdgfsdg23245(): 14 | """Constructor for a foo.""" | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -error[D401]: D401.py:18:5: First line of docstring should be in imperative mood: "Constructor for a boa." +error[D401]: 18:5: First line of docstring should be in imperative mood: "Constructor for a boa." + --> D401.py:18:5 | 17 | def bad_sdgfsdg23245777(): 18 | """ @@ -27,8 +30,9 @@ error[D401]: D401.py:18:5: First line of docstring should be in imperative mood: 22 | | """ | |_______^ | -error[D401]: D401.py:26:5: First line of docstring should be in imperative mood: "Runs something" +error[D401]: 26:5: First line of docstring should be in imperative mood: "Runs something" + --> D401.py:26:5 | 25 | def bad_run_something(): 26 | """Runs something""" @@ -36,8 +40,9 @@ error[D401]: D401.py:26:5: First line of docstring should be in imperative mood: 27 | 28 | def bad_nested(): | -error[D401]: D401.py:29:9: First line of docstring should be in imperative mood: "Runs other things, nested" +error[D401]: 29:9: First line of docstring should be in imperative mood: "Runs other things, nested" + --> D401.py:29:9 | 28 | def bad_nested(): 29 | """Runs other things, nested""" @@ -45,8 +50,9 @@ error[D401]: D401.py:29:9: First line of docstring should be in imperative mood: 30 | 31 | bad_nested() | -error[D401]: D401.py:35:5: First line of docstring should be in imperative mood: "Writes a logical line that" +error[D401]: 35:5: First line of docstring should be in imperative mood: "Writes a logical line that" + --> D401.py:35:5 | 34 | def multi_line(): 35 | """Writes a logical line that @@ -55,8 +61,9 @@ error[D401]: D401.py:35:5: First line of docstring should be in imperative mood: 37 | | """ | |_______^ | -error[D401]: D401.py:74:9: First line of docstring should be in imperative mood: "This method docstring should be written in imperative mood." +error[D401]: 74:9: First line of docstring should be in imperative mood: "This method docstring should be written in imperative mood." + --> D401.py:74:9 | 73 | def bad_method(self): 74 | """This method docstring should be written in imperative mood.""" diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D402_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D402_D.py.snap index ff4e57373d..5ab8f78071 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D402_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D402_D.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs --- -error[D402]: D.py:378:5: First line should not be the function's signature +error[D402]: 378:5: First line should not be the function's signature + --> D.py:378:5 | 376 | @expect('D402: First line should not be the function\'s "signature"') 377 | def foobar(): diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D403_D403.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D403_D403.py.snap index 3477c08f32..c0c679a21c 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D403_D403.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D403_D403.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs --- -error[D403]: D403.py:2:5: [*] First word of the first line should be capitalized: `this` -> `This` +error[D403]: 2:5: [*] First word of the first line should be capitalized: `this` -> `This` + --> D403.py:2:5 | 1 | def bad_function(): 2 | """this docstring is not capitalized""" @@ -19,8 +20,9 @@ error[D403]: D403.py:2:5: [*] First word of the first line should be capitalized 4 4 | def good_function(): 5 5 | """This docstring is capitalized.""" -error[D403]: D403.py:30:5: [*] First word of the first line should be capitalized: `singleword` -> `Singleword` +error[D403]: 30:5: [*] First word of the first line should be capitalized: `singleword` -> `Singleword` + --> D403.py:30:5 | 29 | def single_word(): 30 | """singleword.""" @@ -39,8 +41,9 @@ error[D403]: D403.py:30:5: [*] First word of the first line should be capitalize 32 32 | def single_word_no_dot(): 33 33 | """singleword""" -error[D403]: D403.py:33:5: [*] First word of the first line should be capitalized: `singleword` -> `Singleword` +error[D403]: 33:5: [*] First word of the first line should be capitalized: `singleword` -> `Singleword` + --> D403.py:33:5 | 32 | def single_word_no_dot(): 33 | """singleword""" diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D404_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D404_D.py.snap index 0a2dce748c..5992f01388 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D404_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D404_D.py.snap @@ -1,32 +1,36 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs --- -error[D404]: D.py:631:5: First word of the docstring should not be "This" +error[D404]: 631:5: First word of the docstring should not be "This" + --> D.py:631:5 | 629 | @expect('D404: First word of the docstring should not be "This"') 630 | def starts_with_this(): 631 | """This is a docstring.""" | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | -error[D404]: D.py:636:5: First word of the docstring should not be "This" +error[D404]: 636:5: First word of the docstring should not be "This" + --> D.py:636:5 | 634 | @expect('D404: First word of the docstring should not be "This"') 635 | def starts_with_space_then_this(): 636 | """ This is a docstring that starts with a space.""" # noqa: D210 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -error[D404]: D.py:639:17: First word of the docstring should not be "This" +error[D404]: 639:17: First word of the docstring should not be "This" + --> D.py:639:17 | 639 | class SameLine: """This is a docstring on the same line""" | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 640 | 641 | def same_line(): """This is a docstring on the same line""" | -error[D404]: D.py:641:18: First word of the docstring should not be "This" +error[D404]: 641:18: First word of the docstring should not be "This" + --> D.py:641:18 | 639 | class SameLine: """This is a docstring on the same line""" 640 | diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D405_sections.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D405_sections.py.snap index 0e9a8193da..ebf3d8a3ce 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D405_sections.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D405_sections.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs --- -error[D405]: sections.py:19:5: [*] Section name should be properly capitalized ("returns") +error[D405]: 19:5: [*] Section name should be properly capitalized ("returns") + --> sections.py:19:5 | 17 | """Toggle the gizmo. 18 | @@ -22,8 +23,9 @@ error[D405]: sections.py:19:5: [*] Section name should be properly capitalized ( 21 21 | A value of some sort. 22 22 | -error[D405]: sections.py:218:5: [*] Section name should be properly capitalized ("Short summary") +error[D405]: 218:5: [*] Section name should be properly capitalized ("Short summary") + --> sections.py:218:5 | 216 | """Toggle the gizmo. 217 | diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D406_sections.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D406_sections.py.snap index 6613b8b1c4..4fa9a2c338 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D406_sections.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D406_sections.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs --- -error[D406]: sections.py:32:5: [*] Section name should end with a newline ("Returns") +error[D406]: 32:5: [*] Section name should end with a newline ("Returns") + --> sections.py:32:5 | 30 | """Toggle the gizmo. 31 | @@ -22,8 +23,9 @@ error[D406]: sections.py:32:5: [*] Section name should end with a newline ("Retu 34 34 | A value of some sort. 35 35 | -error[D406]: sections.py:227:5: [*] Section name should end with a newline ("Raises") +error[D406]: 227:5: [*] Section name should end with a newline ("Raises") + --> sections.py:227:5 | 225 | ------ 226 | Many many wonderful things. @@ -42,8 +44,9 @@ error[D406]: sections.py:227:5: [*] Section name should end with a newline ("Rai 229 229 | 230 230 | """ -error[D406]: sections.py:590:5: [*] Section name should end with a newline ("Parameters") +error[D406]: 590:5: [*] Section name should end with a newline ("Parameters") + --> sections.py:590:5 | 588 | """Test that lower case subsection header is valid even if it has the same name as section kind. 589 | diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D407_sections.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D407_sections.py.snap index 7a009fa1ba..467da48180 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D407_sections.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D407_sections.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs --- -error[D407]: sections.py:44:5: [*] Missing dashed underline after section ("Returns") +error[D407]: 44:5: [*] Missing dashed underline after section ("Returns") + --> sections.py:44:5 | 42 | """Toggle the gizmo. 43 | @@ -20,8 +21,9 @@ error[D407]: sections.py:44:5: [*] Missing dashed underline after section ("Retu 46 47 | 47 48 | """ -error[D407]: sections.py:56:5: [*] Missing dashed underline after section ("Returns") +error[D407]: 56:5: [*] Missing dashed underline after section ("Returns") + --> sections.py:56:5 | 54 | """Toggle the gizmo. 55 | @@ -40,8 +42,9 @@ error[D407]: sections.py:56:5: [*] Missing dashed underline after section ("Retu 58 59 | """ 59 60 | -error[D407]: sections.py:67:5: [*] Missing dashed underline after section ("Returns") +error[D407]: 67:5: [*] Missing dashed underline after section ("Returns") + --> sections.py:67:5 | 65 | """Toggle the gizmo. 66 | @@ -60,8 +63,9 @@ error[D407]: sections.py:67:5: [*] Missing dashed underline after section ("Retu 69 70 | 70 71 | @expect(_D213) -error[D407]: sections.py:227:5: [*] Missing dashed underline after section ("Raises") +error[D407]: 227:5: [*] Missing dashed underline after section ("Raises") + --> sections.py:227:5 | 225 | ------ 226 | Many many wonderful things. @@ -79,8 +83,9 @@ error[D407]: sections.py:227:5: [*] Missing dashed underline after section ("Rai 229 230 | 230 231 | """ -error[D407]: sections.py:263:5: [*] Missing dashed underline after section ("Args") +error[D407]: 263:5: [*] Missing dashed underline after section ("Args") + --> sections.py:263:5 | 261 | """Toggle the gizmo. 262 | @@ -98,8 +103,9 @@ error[D407]: sections.py:263:5: [*] Missing dashed underline after section ("Arg 265 266 | 266 267 | Returns: -error[D407]: sections.py:266:5: [*] Missing dashed underline after section ("Returns") +error[D407]: 266:5: [*] Missing dashed underline after section ("Returns") + --> sections.py:266:5 | 264 | note: A random string. 265 | @@ -118,8 +124,9 @@ error[D407]: sections.py:266:5: [*] Missing dashed underline after section ("Ret 268 269 | Raises: 269 270 | RandomError: A random error that occurs randomly. -error[D407]: sections.py:268:5: [*] Missing dashed underline after section ("Raises") +error[D407]: 268:5: [*] Missing dashed underline after section ("Raises") + --> sections.py:268:5 | 266 | Returns: 267 | @@ -137,8 +144,9 @@ error[D407]: sections.py:268:5: [*] Missing dashed underline after section ("Rai 270 271 | 271 272 | """ -error[D407]: sections.py:280:5: [*] Missing dashed underline after section ("Args") +error[D407]: 280:5: [*] Missing dashed underline after section ("Args") + --> sections.py:280:5 | 278 | """Toggle the gizmo. 279 | @@ -156,8 +164,9 @@ error[D407]: sections.py:280:5: [*] Missing dashed underline after section ("Arg 282 283 | 283 284 | """ -error[D407]: sections.py:297:9: [*] Missing dashed underline after section ("Args") +error[D407]: 297:9: [*] Missing dashed underline after section ("Args") + --> sections.py:297:9 | 295 | Will this work when referencing x? 296 | @@ -176,8 +185,9 @@ error[D407]: sections.py:297:9: [*] Missing dashed underline after section ("Arg 299 300 | that is broken. 300 301 | -error[D407]: sections.py:312:5: [*] Missing dashed underline after section ("Args") +error[D407]: 312:5: [*] Missing dashed underline after section ("Args") + --> sections.py:312:5 | 310 | """Toggle the gizmo. 311 | @@ -195,8 +205,9 @@ error[D407]: sections.py:312:5: [*] Missing dashed underline after section ("Arg 314 315 | 315 316 | """ -error[D407]: sections.py:324:9: [*] Missing dashed underline after section ("Args") +error[D407]: 324:9: [*] Missing dashed underline after section ("Args") + --> sections.py:324:9 | 322 | """Test a valid args section. 323 | @@ -215,8 +226,9 @@ error[D407]: sections.py:324:9: [*] Missing dashed underline after section ("Arg 326 327 | another_test: Another parameter. 327 328 | -error[D407]: sections.py:336:9: [*] Missing dashed underline after section ("Args") +error[D407]: 336:9: [*] Missing dashed underline after section ("Args") + --> sections.py:336:9 | 334 | """Test a valid args section. 335 | @@ -234,8 +246,9 @@ error[D407]: sections.py:336:9: [*] Missing dashed underline after section ("Arg 338 339 | 339 340 | """ -error[D407]: sections.py:348:9: [*] Missing dashed underline after section ("Args") +error[D407]: 348:9: [*] Missing dashed underline after section ("Args") + --> sections.py:348:9 | 346 | """Test a valid args section. 347 | @@ -254,8 +267,9 @@ error[D407]: sections.py:348:9: [*] Missing dashed underline after section ("Arg 350 351 | y: 351 352 | -error[D407]: sections.py:361:9: [*] Missing dashed underline after section ("Args") +error[D407]: 361:9: [*] Missing dashed underline after section ("Args") + --> sections.py:361:9 | 359 | """Test a valid args section. 360 | @@ -273,8 +287,9 @@ error[D407]: sections.py:361:9: [*] Missing dashed underline after section ("Arg 363 364 | 364 365 | """ -error[D407]: sections.py:373:9: [*] Missing dashed underline after section ("Args") +error[D407]: 373:9: [*] Missing dashed underline after section ("Args") + --> sections.py:373:9 | 371 | """Test a valid args section. 372 | @@ -292,8 +307,9 @@ error[D407]: sections.py:373:9: [*] Missing dashed underline after section ("Arg 375 376 | 376 377 | """ -error[D407]: sections.py:382:9: [*] Missing dashed underline after section ("Args") +error[D407]: 382:9: [*] Missing dashed underline after section ("Args") + --> sections.py:382:9 | 380 | """Do stuff. 381 | @@ -312,8 +328,9 @@ error[D407]: sections.py:382:9: [*] Missing dashed underline after section ("Arg 384 385 | Lorem ipsum dolor sit amet, consectetur adipiscing elit. 385 386 | Etiam at tellus a tellus faucibus maximus. Curabitur tellus -error[D407]: sections.py:503:9: [*] Missing dashed underline after section ("Args") +error[D407]: 503:9: [*] Missing dashed underline after section ("Args") + --> sections.py:503:9 | 501 | Testing this incorrectly indented docstring. 502 | @@ -331,8 +348,9 @@ error[D407]: sections.py:503:9: [*] Missing dashed underline after section ("Arg 505 506 | 506 507 | """ -error[D407]: sections.py:522:5: [*] Missing dashed underline after section ("Parameters") +error[D407]: 522:5: [*] Missing dashed underline after section ("Parameters") + --> sections.py:522:5 | 521 | Parameters 522 | ========== @@ -350,8 +368,9 @@ error[D407]: sections.py:522:5: [*] Missing dashed underline after section ("Par 524 524 | 525 525 | -error[D407]: sections.py:530:5: [*] Missing dashed underline after section ("Parameters") +error[D407]: 530:5: [*] Missing dashed underline after section ("Parameters") + --> sections.py:530:5 | 529 | Parameters 530 | =========== @@ -369,8 +388,9 @@ error[D407]: sections.py:530:5: [*] Missing dashed underline after section ("Par 532 532 | 533 533 | -error[D407]: sections.py:550:5: [*] Missing dashed underline after section ("Args") +error[D407]: 550:5: [*] Missing dashed underline after section ("Args") + --> sections.py:550:5 | 548 | """Below, `returns:` should _not_ be considered a section header. 549 | @@ -388,8 +408,9 @@ error[D407]: sections.py:550:5: [*] Missing dashed underline after section ("Arg 552 553 | 553 554 | returns: -error[D407]: sections.py:560:5: [*] Missing dashed underline after section ("Args") +error[D407]: 560:5: [*] Missing dashed underline after section ("Args") + --> sections.py:560:5 | 558 | """Below, `Returns:` should be considered a section header. 559 | @@ -407,8 +428,9 @@ error[D407]: sections.py:560:5: [*] Missing dashed underline after section ("Arg 562 563 | 563 564 | Returns: -error[D407]: sections.py:563:9: [*] Missing dashed underline after section ("Returns") +error[D407]: 563:9: [*] Missing dashed underline after section ("Returns") + --> sections.py:563:9 | 561 | Here's a note. 562 | @@ -426,8 +448,9 @@ error[D407]: sections.py:563:9: [*] Missing dashed underline after section ("Ret 565 566 | 566 567 | -error[D407]: sections.py:602:4: [*] Missing dashed underline after section ("Parameters") +error[D407]: 602:4: [*] Missing dashed underline after section ("Parameters") + --> sections.py:602:4 | 600 | """Test that lower case subsection header is valid even if it is of a different kind. 601 | diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D408_sections.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D408_sections.py.snap index b5a57f309d..bf794c7cba 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D408_sections.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D408_sections.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs --- -error[D408]: sections.py:98:5: [*] Section underline should be in the line following the section's name ("Returns") +error[D408]: 98:5: [*] Section underline should be in the line following the section's name ("Returns") + --> sections.py:98:5 | 96 | Returns 97 | diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D409_sections.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D409_sections.py.snap index 382731570b..6bbd0c209f 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D409_sections.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D409_sections.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs --- -error[D409]: sections.py:111:5: [*] Section underline should match the length of its name ("Returns") +error[D409]: 111:5: [*] Section underline should match the length of its name ("Returns") + --> sections.py:111:5 | 110 | Returns 111 | -- @@ -20,8 +21,9 @@ error[D409]: sections.py:111:5: [*] Section underline should match the length of 113 113 | 114 114 | """ -error[D409]: sections.py:225:5: [*] Section underline should match the length of its name ("Returns") +error[D409]: 225:5: [*] Section underline should match the length of its name ("Returns") + --> sections.py:225:5 | 224 | Returns 225 | ------ @@ -40,8 +42,9 @@ error[D409]: sections.py:225:5: [*] Section underline should match the length of 227 227 | Raises: 228 228 | My attention. -error[D409]: sections.py:578:5: [*] Section underline should match the length of its name ("Other Parameters") +error[D409]: 578:5: [*] Section underline should match the length of its name ("Other Parameters") + --> sections.py:578:5 | 577 | Other Parameters 578 | ---------- diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D410_D410.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D410_D410.py.snap index 3283af5e0b..31eeabead3 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D410_D410.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D410_D410.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs --- -error[D410]: D410.py:4:5: [*] Missing blank line after section ("Parameters") +error[D410]: 4:5: [*] Missing blank line after section ("Parameters") + --> D410.py:4:5 | 2 | """Showcase function. 3 | @@ -21,8 +22,9 @@ error[D410]: D410.py:4:5: [*] Missing blank line after section ("Parameters") 11 12 | ------- 12 13 | int -error[D410]: D410.py:21:5: [*] Missing blank line after section ("Parameters") +error[D410]: 21:5: [*] Missing blank line after section ("Parameters") + --> D410.py:21:5 | 19 | """Showcase function. 20 | diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D410_sections.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D410_sections.py.snap index 843daf2ee4..ba782763e8 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D410_sections.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D410_sections.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs --- -error[D410]: sections.py:78:5: [*] Missing blank line after section ("Returns") +error[D410]: 78:5: [*] Missing blank line after section ("Returns") + --> sections.py:78:5 | 76 | """Toggle the gizmo. 77 | @@ -21,8 +22,9 @@ error[D410]: sections.py:78:5: [*] Missing blank line after section ("Returns") 81 82 | ------ 82 83 | -error[D410]: sections.py:224:5: [*] Missing blank line after section ("Returns") +error[D410]: 224:5: [*] Missing blank line after section ("Returns") + --> sections.py:224:5 | 222 | returns. 223 | diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D411_sections.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D411_sections.py.snap index dd65cd29cc..570d6b5ccc 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D411_sections.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D411_sections.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs --- -error[D411]: sections.py:80:5: [*] Missing blank line before section ("Yields") +error[D411]: 80:5: [*] Missing blank line before section ("Yields") + --> sections.py:80:5 | 78 | Returns 79 | ------- @@ -20,8 +21,9 @@ error[D411]: sections.py:80:5: [*] Missing blank line before section ("Yields") 81 82 | ------ 82 83 | -error[D411]: sections.py:134:5: [*] Missing blank line before section ("Returns") +error[D411]: 134:5: [*] Missing blank line before section ("Returns") + --> sections.py:134:5 | 133 | The function's description. 134 | Returns @@ -39,8 +41,9 @@ error[D411]: sections.py:134:5: [*] Missing blank line before section ("Returns" 135 136 | ------- 136 137 | A value of some sort. -error[D411]: sections.py:227:5: [*] Missing blank line before section ("Raises") +error[D411]: 227:5: [*] Missing blank line before section ("Raises") + --> sections.py:227:5 | 225 | ------ 226 | Many many wonderful things. diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D412_sections.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D412_sections.py.snap index d1a75c93c4..f723ec12b5 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D412_sections.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D412_sections.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs --- -error[D412]: sections.py:218:5: [*] No blank lines allowed between a section header and its content ("Short summary") +error[D412]: 218:5: [*] No blank lines allowed between a section header and its content ("Short summary") + --> sections.py:218:5 | 216 | """Toggle the gizmo. 217 | diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D412_sphinx.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D412_sphinx.py.snap index 8c9f7c45dc..9665016aa0 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D412_sphinx.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D412_sphinx.py.snap @@ -1,15 +1,16 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs --- -sphinx.py:13:5: D412 [*] No blank lines allowed between a section header and its content ("Example") +error[D412]: 13:5: [*] No blank lines allowed between a section header and its content ("Example") + + --> sphinx.py:13:5 | 11 | def func(): 12 | """ 13 | Example: - | ^^^^^^^ D412 + | ^^^^^^^ | = help: Remove blank line(s) - ℹ Safe fix 12 12 | """ 13 13 | Example: @@ -19,15 +20,16 @@ sphinx.py:13:5: D412 [*] No blank lines allowed between a section header and its 17 16 | 18 17 | import foo -sphinx.py:24:5: D412 [*] No blank lines allowed between a section header and its content ("Example") +error[D412]: 24:5: [*] No blank lines allowed between a section header and its content ("Example") + + --> sphinx.py:24:5 | 22 | def func(): 23 | """ 24 | Example: - | ^^^^^^^ D412 + | ^^^^^^^ | = help: Remove blank line(s) - ℹ Safe fix 23 23 | """ 24 24 | Example: @@ -38,16 +40,17 @@ sphinx.py:24:5: D412 [*] No blank lines allowed between a section header and its 29 27 | 30 28 | import foo -sphinx.py:47:5: D412 [*] No blank lines allowed between a section header and its content ("Example") +error[D412]: 47:5: [*] No blank lines allowed between a section header and its content ("Example") + + --> sphinx.py:47:5 | 45 | def func(): 46 | """ 47 | Example - | ^^^^^^^ D412 + | ^^^^^^^ 48 | ------- | = help: Remove blank line(s) - ℹ Safe fix 47 47 | Example 48 48 | ------- @@ -57,16 +60,17 @@ sphinx.py:47:5: D412 [*] No blank lines allowed between a section header and its 52 51 | 53 52 | import foo -sphinx.py:59:5: D412 [*] No blank lines allowed between a section header and its content ("Example") +error[D412]: 59:5: [*] No blank lines allowed between a section header and its content ("Example") + + --> sphinx.py:59:5 | 57 | def func(): 58 | """ 59 | Example - | ^^^^^^^ D412 + | ^^^^^^^ 60 | ------- | = help: Remove blank line(s) - ℹ Safe fix 59 59 | Example 60 60 | ------- diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D413_D413.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D413_D413.py.snap index 68ebaa576a..92a6211fe4 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D413_D413.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D413_D413.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs --- -error[D413]: D413.py:7:1: [*] Missing blank line after last section ("Returns") +error[D413]: 7:1: [*] Missing blank line after last section ("Returns") + --> D413.py:6:1 | 5 | with a hanging indent 6 | @@ -21,8 +22,9 @@ error[D413]: D413.py:7:1: [*] Missing blank line after last section ("Returns") 10 11 | 11 12 | -error[D413]: D413.py:19:5: [*] Missing blank line after last section ("Returns") +error[D413]: 19:5: [*] Missing blank line after last section ("Returns") + --> D413.py:19:5 | 17 | with a hanging indent 18 | @@ -41,8 +43,9 @@ error[D413]: D413.py:19:5: [*] Missing blank line after last section ("Returns") 22 23 | 23 24 | -error[D413]: D413.py:58:5: [*] Missing blank line after last section ("Returns") +error[D413]: 58:5: [*] Missing blank line after last section ("Returns") + --> D413.py:58:5 | 56 | with a hanging indent 57 | @@ -63,8 +66,9 @@ error[D413]: D413.py:58:5: [*] Missing blank line after last section ("Returns") 61 63 | 62 64 | def func(): -error[D413]: D413.py:69:5: [*] Missing blank line after last section ("Returns") +error[D413]: 69:5: [*] Missing blank line after last section ("Returns") + --> D413.py:69:5 | 67 | with a hanging indent 68 | diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D413_sections.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D413_sections.py.snap index e29696ae53..ea61b78e68 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D413_sections.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D413_sections.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs --- -error[D413]: sections.py:67:5: [*] Missing blank line after last section ("Returns") +error[D413]: 67:5: [*] Missing blank line after last section ("Returns") + --> sections.py:67:5 | 65 | """Toggle the gizmo. 66 | @@ -22,8 +23,9 @@ error[D413]: sections.py:67:5: [*] Missing blank line after last section ("Retur 69 71 | 70 72 | @expect(_D213) -error[D413]: sections.py:122:5: [*] Missing blank line after last section ("Returns") +error[D413]: 122:5: [*] Missing blank line after last section ("Returns") + --> sections.py:122:5 | 120 | """Toggle the gizmo. 121 | @@ -42,8 +44,9 @@ error[D413]: sections.py:122:5: [*] Missing blank line after last section ("Retu 126 127 | 127 128 | -error[D413]: sections.py:172:5: [*] Missing blank line after last section ("Returns") +error[D413]: 172:5: [*] Missing blank line after last section ("Returns") + --> sections.py:172:5 | 170 | """Toggle the gizmo. 171 | @@ -62,8 +65,9 @@ error[D413]: sections.py:172:5: [*] Missing blank line after last section ("Retu 175 176 | 176 177 | -error[D413]: sections.py:521:5: [*] Missing blank line after last section ("Parameters") +error[D413]: 521:5: [*] Missing blank line after last section ("Parameters") + --> sections.py:521:5 | 519 | """Equal length equals should be replaced with dashes. 520 | @@ -82,8 +86,9 @@ error[D413]: sections.py:521:5: [*] Missing blank line after last section ("Para 524 525 | 525 526 | -error[D413]: sections.py:529:5: [*] Missing blank line after last section ("Parameters") +error[D413]: 529:5: [*] Missing blank line after last section ("Parameters") + --> sections.py:529:5 | 527 | """Here, the length of equals is not the same. 528 | @@ -102,8 +107,9 @@ error[D413]: sections.py:529:5: [*] Missing blank line after last section ("Para 532 533 | 533 534 | -error[D413]: sections.py:550:5: [*] Missing blank line after last section ("Args") +error[D413]: 550:5: [*] Missing blank line after last section ("Args") + --> sections.py:550:5 | 548 | """Below, `returns:` should _not_ be considered a section header. 549 | @@ -121,8 +127,9 @@ error[D413]: sections.py:550:5: [*] Missing blank line after last section ("Args 555 556 | 556 557 | -error[D413]: sections.py:563:9: [*] Missing blank line after last section ("Returns") +error[D413]: 563:9: [*] Missing blank line after last section ("Returns") + --> sections.py:563:9 | 561 | Here's a note. 562 | @@ -140,8 +147,9 @@ error[D413]: sections.py:563:9: [*] Missing blank line after last section ("Retu 565 566 | 566 567 | -error[D413]: sections.py:590:5: [*] Missing blank line after last section ("Parameters") +error[D413]: 590:5: [*] Missing blank line after last section ("Parameters") + --> sections.py:590:5 | 588 | """Test that lower case subsection header is valid even if it has the same name as section kind. 589 | diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D414_sections.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D414_sections.py.snap index 559902b469..7fcaa78a9f 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D414_sections.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D414_sections.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs --- -error[D414]: sections.py:56:5: Section has no content ("Returns") +error[D414]: 56:5: Section has no content ("Returns") + --> sections.py:56:5 | 54 | """Toggle the gizmo. 55 | @@ -11,16 +12,18 @@ error[D414]: sections.py:56:5: Section has no content ("Returns") 57 | 58 | """ | -error[D414]: sections.py:67:5: Section has no content ("Returns") +error[D414]: 67:5: Section has no content ("Returns") + --> sections.py:67:5 | 65 | """Toggle the gizmo. 66 | 67 | Returns""" | ^^^^^^^ | -error[D414]: sections.py:78:5: Section has no content ("Returns") +error[D414]: 78:5: Section has no content ("Returns") + --> sections.py:78:5 | 76 | """Toggle the gizmo. 77 | @@ -29,8 +32,9 @@ error[D414]: sections.py:78:5: Section has no content ("Returns") 79 | ------- 80 | Yields | -error[D414]: sections.py:80:5: Section has no content ("Yields") +error[D414]: 80:5: Section has no content ("Yields") + --> sections.py:80:5 | 78 | Returns 79 | ------- @@ -38,8 +42,9 @@ error[D414]: sections.py:80:5: Section has no content ("Yields") | ^^^^^^ 81 | ------ | -error[D414]: sections.py:172:5: Section has no content ("Returns") +error[D414]: 172:5: Section has no content ("Returns") + --> sections.py:172:5 | 170 | """Toggle the gizmo. 171 | @@ -48,8 +53,9 @@ error[D414]: sections.py:172:5: Section has no content ("Returns") 173 | ------- 174 | """ | -error[D414]: sections.py:266:5: Section has no content ("Returns") +error[D414]: 266:5: Section has no content ("Returns") + --> sections.py:266:5 | 264 | note: A random string. 265 | @@ -58,8 +64,9 @@ error[D414]: sections.py:266:5: Section has no content ("Returns") 267 | 268 | Raises: | -error[D414]: sections.py:563:9: Section has no content ("Returns") +error[D414]: 563:9: Section has no content ("Returns") + --> sections.py:563:9 | 561 | Here's a note. 562 | diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D415_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D415_D.py.snap index 1f9f4e7d9c..fb5ecb5882 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D415_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D415_D.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs --- -error[D415]: D.py:355:5: [*] First line should end with a period, question mark, or exclamation point +error[D415]: 355:5: [*] First line should end with a period, question mark, or exclamation point + --> D.py:355:5 | 353 | "or exclamation point (not 'y')") 354 | def lwnlkjl(): @@ -20,8 +21,9 @@ error[D415]: D.py:355:5: [*] First line should end with a period, question mark, 357 357 | 358 358 | @expect("D401: First line should be in imperative mood " -error[D415]: D.py:406:25: [*] First line should end with a period, question mark, or exclamation point +error[D415]: 406:25: [*] First line should end with a period, question mark, or exclamation point + --> D.py:406:25 | 404 | @expect("D415: First line should end with a period, question mark," 405 | " or exclamation point (not 'r')") @@ -39,8 +41,9 @@ error[D415]: D.py:406:25: [*] First line should end with a period, question mark 408 408 | 409 409 | def ignored_decorator(func): # noqa: D400,D401,D415 -error[D415]: D.py:410:5: [*] First line should end with a period, question mark, or exclamation point +error[D415]: 410:5: [*] First line should end with a period, question mark, or exclamation point + --> D.py:410:5 | 409 | def ignored_decorator(func): # noqa: D400,D401,D415 410 | """Runs something""" @@ -59,8 +62,9 @@ error[D415]: D.py:410:5: [*] First line should end with a period, question mark, 412 412 | pass 413 413 | -error[D415]: D.py:416:5: [*] First line should end with a period, question mark, or exclamation point +error[D415]: 416:5: [*] First line should end with a period, question mark, or exclamation point + --> D.py:416:5 | 415 | def decorator_for_test(func): # noqa: D400,D401,D415 416 | """Runs something""" @@ -79,8 +83,9 @@ error[D415]: D.py:416:5: [*] First line should end with a period, question mark, 418 418 | pass 419 419 | -error[D415]: D.py:422:35: [*] First line should end with a period, question mark, or exclamation point +error[D415]: 422:35: [*] First line should end with a period, question mark, or exclamation point + --> D.py:422:35 | 421 | @ignored_decorator 422 | def oneliner_ignored_decorator(): """One liner""" @@ -97,8 +102,9 @@ error[D415]: D.py:422:35: [*] First line should end with a period, question mark 424 424 | 425 425 | @decorator_for_test -error[D415]: D.py:429:49: [*] First line should end with a period, question mark, or exclamation point +error[D415]: 429:49: [*] First line should end with a period, question mark, or exclamation point + --> D.py:429:49 | 427 | @expect("D415: First line should end with a period, question mark," 428 | " or exclamation point (not 'r')") @@ -116,8 +122,9 @@ error[D415]: D.py:429:49: [*] First line should end with a period, question mark 431 431 | 432 432 | @decorator_for_test -error[D415]: D.py:470:5: [*] First line should end with a period, question mark, or exclamation point +error[D415]: 470:5: [*] First line should end with a period, question mark, or exclamation point + --> D.py:470:5 | 468 | "or exclamation point (not 'g')") 469 | def docstring_bad(): @@ -136,8 +143,9 @@ error[D415]: D.py:470:5: [*] First line should end with a period, question mark, 472 472 | 473 473 | -error[D415]: D.py:475:5: [*] First line should end with a period, question mark, or exclamation point +error[D415]: 475:5: [*] First line should end with a period, question mark, or exclamation point + --> D.py:475:5 | 474 | def docstring_bad_ignore_all(): # noqa 475 | """Runs something""" @@ -155,8 +163,9 @@ error[D415]: D.py:475:5: [*] First line should end with a period, question mark, 477 477 | 478 478 | -error[D415]: D.py:480:5: [*] First line should end with a period, question mark, or exclamation point +error[D415]: 480:5: [*] First line should end with a period, question mark, or exclamation point + --> D.py:480:5 | 479 | def docstring_bad_ignore_one(): # noqa: D400,D401,D415 480 | """Runs something""" @@ -174,8 +183,9 @@ error[D415]: D.py:480:5: [*] First line should end with a period, question mark, 482 482 | 483 483 | -error[D415]: D.py:487:5: [*] First line should end with a period, question mark, or exclamation point +error[D415]: 487:5: [*] First line should end with a period, question mark, or exclamation point + --> D.py:487:5 | 485 | "(perhaps 'Run', not 'Runs')") 486 | def docstring_ignore_some_violations_but_catch_D401(): # noqa: E501,D400,D415 @@ -194,8 +204,9 @@ error[D415]: D.py:487:5: [*] First line should end with a period, question mark, 489 489 | 490 490 | -error[D415]: D.py:520:5: [*] First line should end with a period, question mark, or exclamation point +error[D415]: 520:5: [*] First line should end with a period, question mark, or exclamation point + --> D.py:520:5 | 518 | "or exclamation point (not 'g')") 519 | def bad_google_string(): # noqa: D400 @@ -213,8 +224,9 @@ error[D415]: D.py:520:5: [*] First line should end with a period, question mark, 522 522 | 523 523 | # This is reproducing a bug where AttributeError is raised when parsing class -error[D415]: D.py:581:5: [*] First line should end with a period, question mark, or exclamation point +error[D415]: 581:5: [*] First line should end with a period, question mark, or exclamation point + --> D.py:581:5 | 579 | "or exclamation point (not '\"')") 580 | def endswith_quote(): @@ -232,8 +244,9 @@ error[D415]: D.py:581:5: [*] First line should end with a period, question mark, 583 583 | 584 584 | @expect('D209: Multi-line docstring closing quotes should be on a separate ' -error[D415]: D.py:615:5: [*] First line should end with a period, question mark, or exclamation point +error[D415]: 615:5: [*] First line should end with a period, question mark, or exclamation point + --> D.py:615:5 | 613 | @expect('D212: Multi-line docstring summary should start at the first line') 614 | def one_liner(): @@ -254,8 +267,9 @@ error[D415]: D.py:615:5: [*] First line should end with a period, question mark, 617 617 | """ 618 618 | -error[D415]: D.py:639:17: [*] First line should end with a period, question mark, or exclamation point +error[D415]: 639:17: [*] First line should end with a period, question mark, or exclamation point + --> D.py:639:17 | 639 | class SameLine: """This is a docstring on the same line""" | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -273,8 +287,9 @@ error[D415]: D.py:639:17: [*] First line should end with a period, question mark 641 641 | def same_line(): """This is a docstring on the same line""" 642 642 | -error[D415]: D.py:641:18: [*] First line should end with a period, question mark, or exclamation point +error[D415]: 641:18: [*] First line should end with a period, question mark, or exclamation point + --> D.py:641:18 | 639 | class SameLine: """This is a docstring on the same line""" 640 | @@ -292,8 +307,9 @@ error[D415]: D.py:641:18: [*] First line should end with a period, question mark 643 643 | 644 644 | def single_line_docstring_with_an_escaped_backslash(): -error[D415]: D.py:664:5: [*] First line should end with a period, question mark, or exclamation point +error[D415]: 664:5: [*] First line should end with a period, question mark, or exclamation point + --> D.py:664:5 | 663 | def newline_after_closing_quote(self): 664 | "We enforce a newline after the closing quote for a multi-line docstring \ diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D417_sections.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D417_sections.py.snap index f5975ee7ea..e21780566b 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D417_sections.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D417_sections.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs --- -error[D417]: sections.py:292:9: Missing argument description in the docstring for `bar`: `y` +error[D417]: 292:9: Missing argument description in the docstring for `bar`: `y` + --> sections.py:292:9 | 290 | x = 1 291 | @@ -10,8 +11,9 @@ error[D417]: sections.py:292:9: Missing argument description in the docstring fo | ^^^ 293 | """Nested function test for docstrings. | -error[D417]: sections.py:309:5: Missing argument description in the docstring for `test_missing_google_args`: `y` +error[D417]: 309:5: Missing argument description in the docstring for `test_missing_google_args`: `y` + --> sections.py:309:5 | 307 | "(argument(s) y are missing descriptions in " 308 | "'test_missing_google_args' docstring)") @@ -19,8 +21,9 @@ error[D417]: sections.py:309:5: Missing argument description in the docstring fo | ^^^^^^^^^^^^^^^^^^^^^^^^ 310 | """Toggle the gizmo. | -error[D417]: sections.py:333:9: Missing argument descriptions in the docstring for `test_missing_args`: `test`, `y`, `z` +error[D417]: 333:9: Missing argument descriptions in the docstring for `test_missing_args`: `test`, `y`, `z` + --> sections.py:333:9 | 331 | "(argument(s) test, y, z are missing descriptions in " 332 | "'test_missing_args' docstring)", arg_count=5) @@ -28,8 +31,9 @@ error[D417]: sections.py:333:9: Missing argument descriptions in the docstring f | ^^^^^^^^^^^^^^^^^ 334 | """Test a valid args section. | -error[D417]: sections.py:345:9: Missing argument descriptions in the docstring for `test_missing_args_class_method`: `test`, `y`, `z` +error[D417]: 345:9: Missing argument descriptions in the docstring for `test_missing_args_class_method`: `test`, `y`, `z` + --> sections.py:345:9 | 343 | "(argument(s) test, y, z are missing descriptions in " 344 | "'test_missing_args_class_method' docstring)", arg_count=5) @@ -37,8 +41,9 @@ error[D417]: sections.py:345:9: Missing argument descriptions in the docstring f | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 346 | """Test a valid args section. | -error[D417]: sections.py:358:9: Missing argument descriptions in the docstring for `test_missing_args_static_method`: `a`, `y`, `z` +error[D417]: 358:9: Missing argument descriptions in the docstring for `test_missing_args_static_method`: `a`, `y`, `z` + --> sections.py:358:9 | 356 | "(argument(s) a, y, z are missing descriptions in " 357 | "'test_missing_args_static_method' docstring)", arg_count=4) @@ -46,8 +51,9 @@ error[D417]: sections.py:358:9: Missing argument descriptions in the docstring f | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 359 | """Test a valid args section. | -error[D417]: sections.py:370:9: Missing argument descriptions in the docstring for `test_missing_docstring`: `a`, `b` +error[D417]: 370:9: Missing argument descriptions in the docstring for `test_missing_docstring`: `a`, `b` + --> sections.py:370:9 | 368 | "(argument(s) a, b are missing descriptions in " 369 | "'test_missing_docstring' docstring)", arg_count=2) @@ -55,8 +61,9 @@ error[D417]: sections.py:370:9: Missing argument descriptions in the docstring f | ^^^^^^^^^^^^^^^^^^^^^^ 371 | """Test a valid args section. | -error[D417]: sections.py:398:5: Missing argument description in the docstring for `test_missing_numpy_args`: `y` +error[D417]: 398:5: Missing argument description in the docstring for `test_missing_numpy_args`: `y` + --> sections.py:398:5 | 396 | "(argument(s) y are missing descriptions in " 397 | "'test_missing_numpy_args' docstring)") @@ -64,8 +71,9 @@ error[D417]: sections.py:398:5: Missing argument description in the docstring fo | ^^^^^^^^^^^^^^^^^^^^^^^ 399 | """Toggle the gizmo. | -error[D417]: sections.py:434:9: Missing argument descriptions in the docstring for `test_missing_args`: `test`, `y`, `z` +error[D417]: 434:9: Missing argument descriptions in the docstring for `test_missing_args`: `test`, `y`, `z` + --> sections.py:434:9 | 432 | "(argument(s) test, y, z are missing descriptions in " 433 | "'test_missing_args' docstring)", arg_count=5) @@ -73,8 +81,9 @@ error[D417]: sections.py:434:9: Missing argument descriptions in the docstring f | ^^^^^^^^^^^^^^^^^ 435 | """Test a valid args section. | -error[D417]: sections.py:449:9: Missing argument descriptions in the docstring for `test_missing_args_class_method`: `test`, `y`, `z` +error[D417]: 449:9: Missing argument descriptions in the docstring for `test_missing_args_class_method`: `test`, `y`, `z` + --> sections.py:449:9 | 447 | "(argument(s) test, y, z are missing descriptions in " 448 | "'test_missing_args_class_method' docstring)", arg_count=4) @@ -82,8 +91,9 @@ error[D417]: sections.py:449:9: Missing argument descriptions in the docstring f | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 450 | """Test a valid args section. | -error[D417]: sections.py:468:9: Missing argument descriptions in the docstring for `test_missing_args_static_method`: `a`, `z` +error[D417]: 468:9: Missing argument descriptions in the docstring for `test_missing_args_static_method`: `a`, `z` + --> sections.py:468:9 | 466 | "(argument(s) a, z are missing descriptions in " 467 | "'test_missing_args_static_method' docstring)", arg_count=3) @@ -91,8 +101,9 @@ error[D417]: sections.py:468:9: Missing argument descriptions in the docstring f | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 469 | """Test a valid args section. | -error[D417]: sections.py:498:9: Missing argument description in the docstring for `test_incorrect_indent`: `y` +error[D417]: 498:9: Missing argument description in the docstring for `test_incorrect_indent`: `y` + --> sections.py:498:9 | 496 | "(argument(s) y are missing descriptions in " 497 | "'test_incorrect_indent' docstring)", arg_count=3) diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D418_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D418_D.py.snap index fa3a83011e..66853b0267 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D418_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D418_D.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs --- -error[D418]: D.py:34:9: Function decorated with `@overload` shouldn't contain a docstring +error[D418]: 34:9: Function decorated with `@overload` shouldn't contain a docstring + --> D.py:34:9 | 33 | @overload 34 | def overloaded_method(self, a: str) -> str: @@ -10,8 +11,9 @@ error[D418]: D.py:34:9: Function decorated with `@overload` shouldn't contain a 35 | """Foo bar documentation.""" 36 | ... | -error[D418]: D.py:90:9: Function decorated with `@overload` shouldn't contain a docstring +error[D418]: 90:9: Function decorated with `@overload` shouldn't contain a docstring + --> D.py:90:9 | 89 | @overload 90 | def nested_overloaded_func(a: str) -> str: @@ -19,8 +21,9 @@ error[D418]: D.py:90:9: Function decorated with `@overload` shouldn't contain a 91 | """Foo bar documentation.""" 92 | ... | -error[D418]: D.py:110:5: Function decorated with `@overload` shouldn't contain a docstring +error[D418]: 110:5: Function decorated with `@overload` shouldn't contain a docstring + --> D.py:110:5 | 109 | @overload 110 | def overloaded_func(a: str) -> str: diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D419_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D419_D.py.snap index a4fa2a6e15..9d68e5509f 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D419_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D419_D.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs --- -error[D419]: D.py:20:9: Docstring is empty +error[D419]: 20:9: Docstring is empty + --> D.py:20:9 | 19 | class meta: 20 | """""" @@ -10,8 +11,9 @@ error[D419]: D.py:20:9: Docstring is empty 21 | 22 | @expect('D102: Missing docstring in public method') | -error[D419]: D.py:74:5: Docstring is empty +error[D419]: 74:5: Docstring is empty + --> D.py:74:5 | 72 | @expect('D419: Docstring is empty') 73 | def function(): @@ -20,8 +22,9 @@ error[D419]: D.py:74:5: Docstring is empty 75 | def ok_since_nested(): 76 | pass | -error[D419]: D.py:80:9: Docstring is empty +error[D419]: 80:9: Docstring is empty + --> D.py:80:9 | 78 | @expect('D419: Docstring is empty') 79 | def nested(): diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__all.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__all.snap index 8ab522d021..d1a89751b2 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__all.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__all.snap @@ -1,26 +1,31 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs --- -all.py:1:1: D100 Missing docstring in public module -all.py:1:5: D103 Missing docstring in public function +error[D100]: 1:1: Missing docstring in public module + +error[D103]: 1:5: Missing docstring in public function + + --> all.py:1:5 | 1 | def public_func(): - | ^^^^^^^^^^^ D103 + | ^^^^^^^^^^^ 2 | pass | +error[D101]: 9:7: Missing docstring in public class -all.py:9:7: D101 Missing docstring in public class + --> all.py:9:7 | 9 | class PublicClass: - | ^^^^^^^^^^^ D101 + | ^^^^^^^^^^^ 10 | class PublicNestedClass: 11 | pass | +error[D106]: 10:11: Missing docstring in public nested class -all.py:10:11: D106 Missing docstring in public nested class + --> all.py:10:11 | 9 | class PublicClass: 10 | class PublicNestedClass: - | ^^^^^^^^^^^^^^^^^ D106 + | ^^^^^^^^^^^^^^^^^ 11 | pass | diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__bom.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__bom.snap index 4e46abacf0..e46148b17d 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__bom.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__bom.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs --- -error[D300]: bom.py:1:1: [*] Use triple double quotes `"""` +error[D300]: 1:1: [*] Use triple double quotes `"""` + --> bom.py:1:2 | 1 | ''' SAM macro definitions ''' | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__d209_d400.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__d209_d400.snap index 6a01df4c50..8221b485eb 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__d209_d400.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__d209_d400.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs --- -error[D209]: D209_D400.py:2:5: [*] Multi-line docstring closing quotes should be on a separate line +error[D209]: 2:5: [*] Multi-line docstring closing quotes should be on a separate line + --> D209_D400.py:2:5 | 1 | def lorem(): 2 | """lorem ipsum dolor sit amet consectetur adipiscing elit @@ -18,8 +19,9 @@ error[D209]: D209_D400.py:2:5: [*] Multi-line docstring closing quotes should be 3 |+ sed do eiusmod tempor incididunt ut labore et dolore magna aliqua 4 |+ """ -error[D400]: D209_D400.py:2:5: [*] First line should end with a period +error[D400]: 2:5: [*] First line should end with a period + --> D209_D400.py:2:5 | 1 | def lorem(): 2 | """lorem ipsum dolor sit amet consectetur adipiscing elit diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__d417_google.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__d417_google.snap index 239e138211..6eb82df08a 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__d417_google.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__d417_google.snap @@ -1,71 +1,81 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs --- -error[D417]: D417.py:1:5: Missing argument descriptions in the docstring for `f`: `y`, `z` +error[D417]: 1:5: Missing argument descriptions in the docstring for `f`: `y`, `z` + --> D417.py:1:5 | 1 | def f(x, y, z): | ^ 2 | """Do something. | -error[D417]: D417.py:14:5: Missing argument descriptions in the docstring for `f`: `y`, `z` +error[D417]: 14:5: Missing argument descriptions in the docstring for `f`: `y`, `z` + --> D417.py:14:5 | 14 | def f(x, y, z): | ^ 15 | """Do something. | -error[D417]: D417.py:27:5: Missing argument descriptions in the docstring for `f`: `y`, `z` +error[D417]: 27:5: Missing argument descriptions in the docstring for `f`: `y`, `z` + --> D417.py:27:5 | 27 | def f(x, y, z): | ^ 28 | """Do something. | -error[D417]: D417.py:39:5: Missing argument descriptions in the docstring for `f`: `y`, `z` +error[D417]: 39:5: Missing argument descriptions in the docstring for `f`: `y`, `z` + --> D417.py:39:5 | 39 | def f(x, y, z): | ^ 40 | """Do something. | -error[D417]: D417.py:52:5: Missing argument description in the docstring for `f`: `y` +error[D417]: 52:5: Missing argument description in the docstring for `f`: `y` + --> D417.py:52:5 | 52 | def f(x, y, z): | ^ 53 | """Do something. | -error[D417]: D417.py:65:5: Missing argument description in the docstring for `f`: `y` +error[D417]: 65:5: Missing argument description in the docstring for `f`: `y` + --> D417.py:65:5 | 65 | def f(x, y, z): | ^ 66 | """Do something. | -error[D417]: D417.py:77:5: Missing argument description in the docstring for `f`: `y` +error[D417]: 77:5: Missing argument description in the docstring for `f`: `y` + --> D417.py:77:5 | 77 | def f(x, y, z): | ^ 78 | """Do something. | -error[D417]: D417.py:98:5: Missing argument description in the docstring for `f`: `x` +error[D417]: 98:5: Missing argument description in the docstring for `f`: `x` + --> D417.py:98:5 | 98 | def f(x, *args, **kwargs): | ^ 99 | """Do something. | -error[D417]: D417.py:108:5: Missing argument description in the docstring for `f`: `*args` +error[D417]: 108:5: Missing argument description in the docstring for `f`: `*args` + --> D417.py:108:5 | 108 | def f(x, *args, **kwargs): | ^ 109 | """Do something. | -error[D417]: D417.py:155:5: Missing argument description in the docstring for `select_data`: `auto_save` +error[D417]: 155:5: Missing argument description in the docstring for `select_data`: `auto_save` + --> D417.py:155:5 | 155 | def select_data( | ^^^^^^^^^^^ diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__d417_unspecified.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__d417_unspecified.snap index 239e138211..6eb82df08a 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__d417_unspecified.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__d417_unspecified.snap @@ -1,71 +1,81 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs --- -error[D417]: D417.py:1:5: Missing argument descriptions in the docstring for `f`: `y`, `z` +error[D417]: 1:5: Missing argument descriptions in the docstring for `f`: `y`, `z` + --> D417.py:1:5 | 1 | def f(x, y, z): | ^ 2 | """Do something. | -error[D417]: D417.py:14:5: Missing argument descriptions in the docstring for `f`: `y`, `z` +error[D417]: 14:5: Missing argument descriptions in the docstring for `f`: `y`, `z` + --> D417.py:14:5 | 14 | def f(x, y, z): | ^ 15 | """Do something. | -error[D417]: D417.py:27:5: Missing argument descriptions in the docstring for `f`: `y`, `z` +error[D417]: 27:5: Missing argument descriptions in the docstring for `f`: `y`, `z` + --> D417.py:27:5 | 27 | def f(x, y, z): | ^ 28 | """Do something. | -error[D417]: D417.py:39:5: Missing argument descriptions in the docstring for `f`: `y`, `z` +error[D417]: 39:5: Missing argument descriptions in the docstring for `f`: `y`, `z` + --> D417.py:39:5 | 39 | def f(x, y, z): | ^ 40 | """Do something. | -error[D417]: D417.py:52:5: Missing argument description in the docstring for `f`: `y` +error[D417]: 52:5: Missing argument description in the docstring for `f`: `y` + --> D417.py:52:5 | 52 | def f(x, y, z): | ^ 53 | """Do something. | -error[D417]: D417.py:65:5: Missing argument description in the docstring for `f`: `y` +error[D417]: 65:5: Missing argument description in the docstring for `f`: `y` + --> D417.py:65:5 | 65 | def f(x, y, z): | ^ 66 | """Do something. | -error[D417]: D417.py:77:5: Missing argument description in the docstring for `f`: `y` +error[D417]: 77:5: Missing argument description in the docstring for `f`: `y` + --> D417.py:77:5 | 77 | def f(x, y, z): | ^ 78 | """Do something. | -error[D417]: D417.py:98:5: Missing argument description in the docstring for `f`: `x` +error[D417]: 98:5: Missing argument description in the docstring for `f`: `x` + --> D417.py:98:5 | 98 | def f(x, *args, **kwargs): | ^ 99 | """Do something. | -error[D417]: D417.py:108:5: Missing argument description in the docstring for `f`: `*args` +error[D417]: 108:5: Missing argument description in the docstring for `f`: `*args` + --> D417.py:108:5 | 108 | def f(x, *args, **kwargs): | ^ 109 | """Do something. | -error[D417]: D417.py:155:5: Missing argument description in the docstring for `select_data`: `auto_save` +error[D417]: 155:5: Missing argument description in the docstring for `select_data`: `auto_save` + --> D417.py:155:5 | 155 | def select_data( | ^^^^^^^^^^^ diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_0.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_0.py.snap index 198ba37e1f..64f1962c55 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_0.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_0.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F401]: F401_0.py:2:8: [*] `functools` imported but unused +error[F401]: 2:8: [*] `functools` imported but unused + --> F401_0.py:2:8 | 1 | from __future__ import all_feature_names 2 | import functools, os @@ -19,8 +20,9 @@ error[F401]: F401_0.py:2:8: [*] `functools` imported but unused 4 4 | from collections import ( 5 5 | Counter, -error[F401]: F401_0.py:6:5: [*] `collections.OrderedDict` imported but unused +error[F401]: 6:5: [*] `collections.OrderedDict` imported but unused + --> F401_0.py:6:5 | 4 | from collections import ( 5 | Counter, @@ -39,8 +41,9 @@ error[F401]: F401_0.py:6:5: [*] `collections.OrderedDict` imported but unused 8 7 | ) 9 8 | import multiprocessing.pool -error[F401]: F401_0.py:12:8: [*] `logging.handlers` imported but unused +error[F401]: 12:8: [*] `logging.handlers` imported but unused + --> F401_0.py:12:8 | 10 | import multiprocessing.process 11 | import logging.config @@ -59,8 +62,9 @@ error[F401]: F401_0.py:12:8: [*] `logging.handlers` imported but unused 14 13 | TYPE_CHECKING, 15 14 | NamedTuple, -error[F401]: F401_0.py:32:12: [*] `shelve` imported but unused +error[F401]: 32:12: [*] `shelve` imported but unused + --> F401_0.py:32:12 | 31 | if TYPE_CHECKING: 32 | import shelve @@ -77,8 +81,9 @@ error[F401]: F401_0.py:32:12: [*] `shelve` imported but unused 34 33 | 35 34 | if TYPE_CHECKING: -error[F401]: F401_0.py:33:12: [*] `importlib` imported but unused +error[F401]: 33:12: [*] `importlib` imported but unused + --> F401_0.py:33:12 | 31 | if TYPE_CHECKING: 32 | import shelve @@ -97,8 +102,9 @@ error[F401]: F401_0.py:33:12: [*] `importlib` imported but unused 35 34 | if TYPE_CHECKING: 36 35 | """Hello, world!""" -error[F401]: F401_0.py:37:12: [*] `pathlib` imported but unused +error[F401]: 37:12: [*] `pathlib` imported but unused + --> F401_0.py:37:12 | 35 | if TYPE_CHECKING: 36 | """Hello, world!""" @@ -117,8 +123,9 @@ error[F401]: F401_0.py:37:12: [*] `pathlib` imported but unused 39 38 | z = 1 40 39 | -error[F401]: F401_0.py:52:16: [*] `pickle` imported but unused +error[F401]: 52:16: [*] `pickle` imported but unused + --> F401_0.py:52:16 | 51 | def b(self) -> None: 52 | import pickle @@ -135,8 +142,9 @@ error[F401]: F401_0.py:52:16: [*] `pickle` imported but unused 54 54 | 55 55 | __all__ = ["ClassA"] + ["ClassB"] -error[F401]: F401_0.py:93:16: [*] `x` imported but unused +error[F401]: 93:16: [*] `x` imported but unused + --> F401_0.py:93:16 | 91 | match *0, 1, *2: 92 | case 0,: @@ -154,8 +162,9 @@ error[F401]: F401_0.py:93:16: [*] `x` imported but unused 95 94 | 96 95 | -error[F401]: F401_0.py:94:16: [*] `y` imported but unused +error[F401]: 94:16: [*] `y` imported but unused + --> F401_0.py:94:16 | 92 | case 0,: 93 | import x @@ -172,8 +181,9 @@ error[F401]: F401_0.py:94:16: [*] `y` imported but unused 96 95 | 97 96 | # Test: access a sub-importation via an alias. -error[F401]: F401_0.py:99:8: [*] `foo.bar.baz` imported but unused +error[F401]: 99:8: [*] `foo.bar.baz` imported but unused + --> F401_0.py:99:8 | 97 | # Test: access a sub-importation via an alias. 98 | import foo.bar as bop @@ -192,8 +202,9 @@ error[F401]: F401_0.py:99:8: [*] `foo.bar.baz` imported but unused 101 100 | print(bop.baz.read_csv("test.csv")) 102 101 | -error[F401]: F401_0.py:105:12: [*] `a1` imported but unused +error[F401]: 105:12: [*] `a1` imported but unused + --> F401_0.py:105:12 | 103 | # Test: isolated deletions. 104 | if TYPE_CHECKING: @@ -212,8 +223,9 @@ error[F401]: F401_0.py:105:12: [*] `a1` imported but unused 107 106 | import a2 108 107 | -error[F401]: F401_0.py:107:12: [*] `a2` imported but unused +error[F401]: 107:12: [*] `a2` imported but unused + --> F401_0.py:107:12 | 105 | import a1 106 | @@ -230,8 +242,9 @@ error[F401]: F401_0.py:107:12: [*] `a2` imported but unused 109 108 | 110 109 | match *0, 1, *2: -error[F401]: F401_0.py:112:16: [*] `b1` imported but unused +error[F401]: 112:16: [*] `b1` imported but unused + --> F401_0.py:112:16 | 110 | match *0, 1, *2: 111 | case 0,: @@ -250,8 +263,9 @@ error[F401]: F401_0.py:112:16: [*] `b1` imported but unused 114 113 | import b2 115 114 | -error[F401]: F401_0.py:114:16: [*] `b2` imported but unused +error[F401]: 114:16: [*] `b2` imported but unused + --> F401_0.py:114:16 | 112 | import b1 113 | @@ -268,8 +282,9 @@ error[F401]: F401_0.py:114:16: [*] `b2` imported but unused 116 115 | 117 116 | # Regression test for: https://github.com/astral-sh/ruff/issues/7244 -error[F401]: F401_0.py:122:1: [*] `datameta_client_lib.model_helpers.noqa` imported but unused +error[F401]: 122:1: [*] `datameta_client_lib.model_helpers.noqa` imported but unused + --> F401_0.py:121:48 | 121 | from datameta_client_lib.model_helpers import ( 122 | noqa ) diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_10.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_10.py.snap index 0d00a654d0..79ac69cd27 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_10.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_10.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F401]: F401_10.py:6:16: `orjson` imported but unused; consider using `importlib.util.find_spec` to test for availability +error[F401]: 6:16: `orjson` imported but unused; consider using `importlib.util.find_spec` to test for availability + --> F401_10.py:6:16 | 4 | def module_not_found_error(): 5 | try: @@ -12,8 +13,9 @@ error[F401]: F401_10.py:6:16: `orjson` imported but unused; consider using `impo 8 | return True | = help: Remove unused import: `orjson` -error[F401]: F401_10.py:15:16: `orjson` imported but unused; consider using `importlib.util.find_spec` to test for availability +error[F401]: 15:16: `orjson` imported but unused; consider using `importlib.util.find_spec` to test for availability + --> F401_10.py:15:16 | 13 | def import_error(): 14 | try: diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_11.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_11.py.snap index d50b27b006..6e3be3ba4e 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_11.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_11.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F401]: F401_11.py:4:27: [*] `pathlib.PurePath` imported but unused +error[F401]: 4:27: [*] `pathlib.PurePath` imported but unused + --> F401_11.py:4:27 | 3 | from typing import List 4 | from pathlib import Path, PurePath diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_15.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_15.py.snap index 43b7123cf6..c6504fc5ed 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_15.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_15.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F401]: F401_15.py:5:25: [*] `pathlib.Path` imported but unused +error[F401]: 5:25: [*] `pathlib.Path` imported but unused + --> F401_15.py:5:25 | 4 | if TYPE_CHECKING: 5 | from pathlib import Path diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_17.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_17.py.snap index b7460bbb12..c898fef60c 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_17.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_17.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F401]: F401_17.py:12:27: [*] `threading.Thread` imported but unused +error[F401]: 12:27: [*] `threading.Thread` imported but unused + --> F401_17.py:12:27 | 11 | def fn(thread: Thread): 12 | from threading import Thread @@ -20,8 +21,9 @@ error[F401]: F401_17.py:12:27: [*] `threading.Thread` imported but unused 14 13 | # The `Thread` on the left-hand side should resolve to the `Thread` imported at the 15 14 | # top level. -error[F401]: F401_17.py:20:27: [*] `threading.Thread` imported but unused +error[F401]: 20:27: [*] `threading.Thread` imported but unused + --> F401_17.py:20:27 | 19 | def fn(thread: Thread): 20 | from threading import Thread diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_18.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_18.py.snap index 171a119378..81f6287827 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_18.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_18.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F401]: F401_18.py:5:12: [*] `__future__` imported but unused +error[F401]: 5:12: [*] `__future__` imported but unused + --> F401_18.py:5:12 | 4 | def f(): 5 | import __future__ diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_23.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_23.py.snap index 9e741a7346..315d0ad522 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_23.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_23.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F401]: F401_23.py:4:16: [*] `re.RegexFlag` imported but unused +error[F401]: 4:16: [*] `re.RegexFlag` imported but unused + --> F401_23.py:4:16 | 3 | from pathlib import Path 4 | from re import RegexFlag diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_5.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_5.py.snap index 3943e81769..b48028a300 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_5.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_5.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F401]: F401_5.py:2:17: [*] `a.b.c` imported but unused +error[F401]: 2:17: [*] `a.b.c` imported but unused + --> F401_5.py:2:17 | 1 | """Test: removal of multi-segment and aliases imports.""" 2 | from a.b import c @@ -18,8 +19,9 @@ error[F401]: F401_5.py:2:17: [*] `a.b.c` imported but unused 4 3 | import h.i 5 4 | import j.k as l -error[F401]: F401_5.py:3:22: [*] `d.e.f` imported but unused +error[F401]: 3:22: [*] `d.e.f` imported but unused + --> F401_5.py:3:22 | 1 | """Test: removal of multi-segment and aliases imports.""" 2 | from a.b import c @@ -36,8 +38,9 @@ error[F401]: F401_5.py:3:22: [*] `d.e.f` imported but unused 4 3 | import h.i 5 4 | import j.k as l -error[F401]: F401_5.py:4:8: [*] `h.i` imported but unused +error[F401]: 4:8: [*] `h.i` imported but unused + --> F401_5.py:4:8 | 2 | from a.b import c 3 | from d.e import f as g @@ -53,8 +56,9 @@ error[F401]: F401_5.py:4:8: [*] `h.i` imported but unused 4 |-import h.i 5 4 | import j.k as l -error[F401]: F401_5.py:5:15: [*] `j.k` imported but unused +error[F401]: 5:15: [*] `j.k` imported but unused + --> F401_5.py:5:15 | 3 | from d.e import f as g 4 | import h.i diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_6.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_6.py.snap index 19be852063..5883b6dcd5 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_6.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_6.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F401]: F401_6.py:7:25: [*] `.background.BackgroundTasks` imported but unused +error[F401]: 7:25: [*] `.background.BackgroundTasks` imported but unused + --> F401_6.py:7:25 | 6 | # F401 `background.BackgroundTasks` imported but unused 7 | from .background import BackgroundTasks @@ -20,8 +21,9 @@ error[F401]: F401_6.py:7:25: [*] `.background.BackgroundTasks` imported but unus 9 8 | # F401 `datastructures.UploadFile` imported but unused 10 9 | from .datastructures import UploadFile as FileUpload -error[F401]: F401_6.py:10:43: [*] `.datastructures.UploadFile` imported but unused +error[F401]: 10:43: [*] `.datastructures.UploadFile` imported but unused + --> F401_6.py:10:43 | 9 | # F401 `datastructures.UploadFile` imported but unused 10 | from .datastructures import UploadFile as FileUpload @@ -39,8 +41,9 @@ error[F401]: F401_6.py:10:43: [*] `.datastructures.UploadFile` imported but unus 12 11 | # OK 13 12 | import applications as applications -error[F401]: F401_6.py:16:8: [*] `background` imported but unused +error[F401]: 16:8: [*] `background` imported but unused + --> F401_6.py:16:8 | 15 | # F401 `background` imported but unused 16 | import background @@ -58,8 +61,9 @@ error[F401]: F401_6.py:16:8: [*] `background` imported but unused 18 17 | # F401 `datastructures` imported but unused 19 18 | import datastructures as structures -error[F401]: F401_6.py:19:26: [*] `datastructures` imported but unused +error[F401]: 19:26: [*] `datastructures` imported but unused + --> F401_6.py:19:26 | 18 | # F401 `datastructures` imported but unused 19 | import datastructures as structures diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_7.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_7.py.snap index 590f9bb19a..990dd65dc7 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_7.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_7.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F401]: F401_7.py:30:5: [*] `typing.Union` imported but unused +error[F401]: 30:5: [*] `typing.Union` imported but unused + --> F401_7.py:30:5 | 28 | from typing import ( 29 | Mapping, # noqa: F401 @@ -22,8 +23,9 @@ error[F401]: F401_7.py:30:5: [*] `typing.Union` imported but unused 33 32 | # This should ignore both errors. 34 33 | from typing import ( # noqa -error[F401]: F401_7.py:66:20: [*] `typing.Awaitable` imported but unused +error[F401]: 66:20: [*] `typing.Awaitable` imported but unused + --> F401_7.py:66:20 | 65 | # This should mark F501 as unused. 66 | from typing import Awaitable, AwaitableGenerator # noqa: F501 @@ -36,8 +38,9 @@ error[F401]: F401_7.py:66:20: [*] `typing.Awaitable` imported but unused 65 65 | # This should mark F501 as unused. 66 |-from typing import Awaitable, AwaitableGenerator # noqa: F501 -error[F401]: F401_7.py:66:31: [*] `typing.AwaitableGenerator` imported but unused +error[F401]: 66:31: [*] `typing.AwaitableGenerator` imported but unused + --> F401_7.py:66:31 | 65 | # This should mark F501 as unused. 66 | from typing import Awaitable, AwaitableGenerator # noqa: F501 diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_9.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_9.py.snap index 1b139e832a..cf66cf4c86 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_9.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_9.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F401]: F401_9.py:4:22: [*] `foo.baz` imported but unused +error[F401]: 4:22: [*] `foo.baz` imported but unused + --> F401_9.py:4:22 | 3 | __all__ = ("bar",) 4 | from foo import bar, baz diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_24____init__.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_24____init__.py.snap index 019ddc0195..f7e23277ff 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_24____init__.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_24____init__.py.snap @@ -1,13 +1,14 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -__init__.py:19:8: F401 [*] `sys` imported but unused +error[F401]: 19:8: [*] `sys` imported but unused + + --> __init__.py:19:8 | 19 | import sys # F401: remove unused - | ^^^ F401 + | ^^^ | = help: Remove unused import: `sys` - ℹ Unsafe fix 16 16 | import argparse as argparse # Ok: is redundant alias 17 17 | @@ -17,13 +18,14 @@ __init__.py:19:8: F401 [*] `sys` imported but unused 21 20 | 22 21 | # first-party -__init__.py:33:15: F401 [*] `.unused` imported but unused; consider removing, adding to `__all__`, or using a redundant alias +error[F401]: 33:15: [*] `.unused` imported but unused; consider removing, adding to `__all__`, or using a redundant alias + + --> __init__.py:33:15 | 33 | from . import unused # F401: change to redundant alias - | ^^^^^^ F401 + | ^^^^^^ | = help: Remove unused import: `.unused` - ℹ Unsafe fix 30 30 | from . import aliased as aliased # Ok: is redundant alias 31 31 | @@ -33,13 +35,14 @@ __init__.py:33:15: F401 [*] `.unused` imported but unused; consider removing, ad 35 34 | 36 35 | from . import renamed as bees # F401: no fix -__init__.py:36:26: F401 [*] `.renamed` imported but unused; consider removing, adding to `__all__`, or using a redundant alias +error[F401]: 36:26: [*] `.renamed` imported but unused; consider removing, adding to `__all__`, or using a redundant alias + + --> __init__.py:36:26 | 36 | from . import renamed as bees # F401: no fix - | ^^^^ F401 + | ^^^^ | = help: Remove unused import: `.renamed` - ℹ Unsafe fix 33 33 | from . import unused # F401: change to redundant alias 34 34 | diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_25__all_nonempty____init__.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_25__all_nonempty____init__.py.snap index 2d1d54e348..ff7c36c2c7 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_25__all_nonempty____init__.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_25__all_nonempty____init__.py.snap @@ -1,13 +1,14 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -__init__.py:19:8: F401 [*] `sys` imported but unused +error[F401]: 19:8: [*] `sys` imported but unused + + --> __init__.py:19:8 | 19 | import sys # F401: remove unused - | ^^^ F401 + | ^^^ | = help: Remove unused import: `sys` - ℹ Unsafe fix 16 16 | import argparse # Ok: is exported in __all__ 17 17 | @@ -17,13 +18,14 @@ __init__.py:19:8: F401 [*] `sys` imported but unused 21 20 | 22 21 | # first-party -__init__.py:36:15: F401 [*] `.unused` imported but unused; consider removing, adding to `__all__`, or using a redundant alias +error[F401]: 36:15: [*] `.unused` imported but unused; consider removing, adding to `__all__`, or using a redundant alias + + --> __init__.py:36:15 | 36 | from . import unused # F401: add to __all__ - | ^^^^^^ F401 + | ^^^^^^ | = help: Remove unused import: `.unused` - ℹ Unsafe fix 33 33 | from . import exported # Ok: is exported in __all__ 34 34 | @@ -33,13 +35,14 @@ __init__.py:36:15: F401 [*] `.unused` imported but unused; consider removing, ad 38 37 | 39 38 | from . import renamed as bees # F401: add to __all__ -__init__.py:39:26: F401 [*] `.renamed` imported but unused; consider removing, adding to `__all__`, or using a redundant alias +error[F401]: 39:26: [*] `.renamed` imported but unused; consider removing, adding to `__all__`, or using a redundant alias + + --> __init__.py:39:26 | 39 | from . import renamed as bees # F401: add to __all__ - | ^^^^ F401 + | ^^^^ | = help: Remove unused import: `.renamed` - ℹ Unsafe fix 36 36 | from . import unused # F401: add to __all__ 37 37 | diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_26__all_empty____init__.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_26__all_empty____init__.py.snap index 539fd6fa26..bad656314f 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_26__all_empty____init__.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_26__all_empty____init__.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F401]: __init__.py:5:15: [*] `.unused` imported but unused; consider removing, adding to `__all__`, or using a redundant alias +error[F401]: 5:15: [*] `.unused` imported but unused; consider removing, adding to `__all__`, or using a redundant alias + --> __init__.py:5:15 | 5 | from . import unused # F401: add to __all__ | ^^^^^^ @@ -17,8 +18,9 @@ error[F401]: __init__.py:5:15: [*] `.unused` imported but unused; consider remov 7 6 | 8 7 | from . import renamed as bees # F401: add to __all__ -error[F401]: __init__.py:8:26: [*] `.renamed` imported but unused; consider removing, adding to `__all__`, or using a redundant alias +error[F401]: 8:26: [*] `.renamed` imported but unused; consider removing, adding to `__all__`, or using a redundant alias + --> __init__.py:8:26 | 8 | from . import renamed as bees # F401: add to __all__ | ^^^^ diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_27__all_mistyped____init__.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_27__all_mistyped____init__.py.snap index 99c6412203..525124af99 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_27__all_mistyped____init__.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_27__all_mistyped____init__.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F401]: __init__.py:5:15: [*] `.unused` imported but unused; consider removing, adding to `__all__`, or using a redundant alias +error[F401]: 5:15: [*] `.unused` imported but unused; consider removing, adding to `__all__`, or using a redundant alias + --> __init__.py:5:15 | 5 | from . import unused # F401: recommend add to all w/o fix | ^^^^^^ @@ -17,8 +18,9 @@ error[F401]: __init__.py:5:15: [*] `.unused` imported but unused; consider remov 7 6 | 8 7 | from . import renamed as bees # F401: recommend add to all w/o fix -error[F401]: __init__.py:8:26: [*] `.renamed` imported but unused; consider removing, adding to `__all__`, or using a redundant alias +error[F401]: 8:26: [*] `.renamed` imported but unused; consider removing, adding to `__all__`, or using a redundant alias + --> __init__.py:8:26 | 8 | from . import renamed as bees # F401: recommend add to all w/o fix | ^^^^ diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_28__all_multiple____init__.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_28__all_multiple____init__.py.snap index d3300d3be9..848c244605 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_28__all_multiple____init__.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_28__all_multiple____init__.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F401]: __init__.py:5:15: [*] `.unused` imported but unused; consider removing, adding to `__all__`, or using a redundant alias +error[F401]: 5:15: [*] `.unused` imported but unused; consider removing, adding to `__all__`, or using a redundant alias + --> __init__.py:5:15 | 5 | from . import unused, renamed as bees # F401: add to __all__ | ^^^^^^ @@ -17,8 +18,9 @@ error[F401]: __init__.py:5:15: [*] `.unused` imported but unused; consider remov 7 6 | 8 7 | __all__ = []; -error[F401]: __init__.py:5:34: [*] `.renamed` imported but unused; consider removing, adding to `__all__`, or using a redundant alias +error[F401]: 5:34: [*] `.renamed` imported but unused; consider removing, adding to `__all__`, or using a redundant alias + --> __init__.py:5:34 | 5 | from . import unused, renamed as bees # F401: add to __all__ | ^^^^ diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_29__all_conditional____init__.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_29__all_conditional____init__.py.snap index 9b6bb69272..d495487109 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_29__all_conditional____init__.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_29__all_conditional____init__.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F401]: __init__.py:8:15: [*] `.unused` imported but unused; consider removing, adding to `__all__`, or using a redundant alias +error[F401]: 8:15: [*] `.unused` imported but unused; consider removing, adding to `__all__`, or using a redundant alias + --> __init__.py:8:15 | 6 | import sys 7 | @@ -22,8 +23,9 @@ error[F401]: __init__.py:8:15: [*] `.unused` imported but unused; consider remov 10 10 | if sys.version_info > (3, 9): 11 11 | from . import also_exported -error[F401]: __init__.py:8:44: [*] `.renamed` imported but unused; consider removing, adding to `__all__`, or using a redundant alias +error[F401]: 8:44: [*] `.renamed` imported but unused; consider removing, adding to `__all__`, or using a redundant alias + --> __init__.py:8:44 | 6 | import sys 7 | diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_30.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_30.py.snap index 7b42b5f341..0c923394ef 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_30.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_30.py.snap @@ -1,15 +1,16 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -F401_30.py:6:19: F401 [*] `.main.MaμToMan` imported but unused +error[F401]: 6:19: [*] `.main.MaμToMan` imported but unused + + --> F401_30.py:6:19 | 4 | """ 5 | 6 | from .main import MaµToMan - | ^^^^^^^^ F401 + | ^^^^^^^^ | = help: Remove unused import: `.main.MaμToMan` - ℹ Safe fix 3 3 | even if they have characters in them that undergo NFKC normalization 4 4 | """ diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_stable_F401_24____init__.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_stable_F401_24____init__.py.snap index 02a82d9ec0..6c47c6fcb3 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_stable_F401_24____init__.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_stable_F401_24____init__.py.snap @@ -1,23 +1,27 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -__init__.py:19:8: F401 `sys` imported but unused +error[F401]: 19:8: `sys` imported but unused + + --> __init__.py:19:8 | 19 | import sys # F401: remove unused - | ^^^ F401 + | ^^^ | = help: Remove unused import: `sys` +error[F401]: 33:15: `.unused` imported but unused; consider removing, adding to `__all__`, or using a redundant alias -__init__.py:33:15: F401 `.unused` imported but unused; consider removing, adding to `__all__`, or using a redundant alias + --> __init__.py:33:15 | 33 | from . import unused # F401: change to redundant alias - | ^^^^^^ F401 + | ^^^^^^ | = help: Use an explicit re-export: `unused as unused` +error[F401]: 36:26: `.renamed` imported but unused; consider removing, adding to `__all__`, or using a redundant alias -__init__.py:36:26: F401 `.renamed` imported but unused; consider removing, adding to `__all__`, or using a redundant alias + --> __init__.py:36:26 | 36 | from . import renamed as bees # F401: no fix - | ^^^^ F401 + | ^^^^ | = help: Use an explicit re-export: `renamed as renamed` diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_stable_F401_25__all_nonempty____init__.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_stable_F401_25__all_nonempty____init__.py.snap index 16f8364dd6..c925337cec 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_stable_F401_25__all_nonempty____init__.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_stable_F401_25__all_nonempty____init__.py.snap @@ -1,23 +1,27 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -__init__.py:19:8: F401 `sys` imported but unused +error[F401]: 19:8: `sys` imported but unused + + --> __init__.py:19:8 | 19 | import sys # F401: remove unused - | ^^^ F401 + | ^^^ | = help: Remove unused import: `sys` +error[F401]: 36:15: `.unused` imported but unused; consider removing, adding to `__all__`, or using a redundant alias -__init__.py:36:15: F401 `.unused` imported but unused; consider removing, adding to `__all__`, or using a redundant alias + --> __init__.py:36:15 | 36 | from . import unused # F401: add to __all__ - | ^^^^^^ F401 + | ^^^^^^ | = help: Add unused import `unused` to __all__ +error[F401]: 39:26: `.renamed` imported but unused; consider removing, adding to `__all__`, or using a redundant alias -__init__.py:39:26: F401 `.renamed` imported but unused; consider removing, adding to `__all__`, or using a redundant alias + --> __init__.py:39:26 | 39 | from . import renamed as bees # F401: add to __all__ - | ^^^^ F401 + | ^^^^ | = help: Add unused import `bees` to __all__ diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_stable_F401_26__all_empty____init__.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_stable_F401_26__all_empty____init__.py.snap index dfd991c18d..b5aab6b2f7 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_stable_F401_26__all_empty____init__.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_stable_F401_26__all_empty____init__.py.snap @@ -1,15 +1,17 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F401]: __init__.py:5:15: `.unused` imported but unused; consider removing, adding to `__all__`, or using a redundant alias +error[F401]: 5:15: `.unused` imported but unused; consider removing, adding to `__all__`, or using a redundant alias + --> __init__.py:5:15 | 5 | from . import unused # F401: add to __all__ | ^^^^^^ | = help: Add unused import `unused` to __all__ -error[F401]: __init__.py:8:26: `.renamed` imported but unused; consider removing, adding to `__all__`, or using a redundant alias +error[F401]: 8:26: `.renamed` imported but unused; consider removing, adding to `__all__`, or using a redundant alias + --> __init__.py:8:26 | 8 | from . import renamed as bees # F401: add to __all__ | ^^^^ diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_stable_F401_27__all_mistyped____init__.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_stable_F401_27__all_mistyped____init__.py.snap index 60263009b9..d2cfaedfa5 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_stable_F401_27__all_mistyped____init__.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_stable_F401_27__all_mistyped____init__.py.snap @@ -1,15 +1,17 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F401]: __init__.py:5:15: `.unused` imported but unused; consider removing, adding to `__all__`, or using a redundant alias +error[F401]: 5:15: `.unused` imported but unused; consider removing, adding to `__all__`, or using a redundant alias + --> __init__.py:5:15 | 5 | from . import unused # F401: recommend add to all w/o fix | ^^^^^^ | = help: Add unused import `unused` to __all__ -error[F401]: __init__.py:8:26: `.renamed` imported but unused; consider removing, adding to `__all__`, or using a redundant alias +error[F401]: 8:26: `.renamed` imported but unused; consider removing, adding to `__all__`, or using a redundant alias + --> __init__.py:8:26 | 8 | from . import renamed as bees # F401: recommend add to all w/o fix | ^^^^ diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_stable_F401_28__all_multiple____init__.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_stable_F401_28__all_multiple____init__.py.snap index 81bdbb3792..432843561e 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_stable_F401_28__all_multiple____init__.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_stable_F401_28__all_multiple____init__.py.snap @@ -1,15 +1,17 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F401]: __init__.py:5:15: `.unused` imported but unused; consider removing, adding to `__all__`, or using a redundant alias +error[F401]: 5:15: `.unused` imported but unused; consider removing, adding to `__all__`, or using a redundant alias + --> __init__.py:5:15 | 5 | from . import unused, renamed as bees # F401: add to __all__ | ^^^^^^ | = help: Add unused import `unused` to __all__ -error[F401]: __init__.py:5:34: `.renamed` imported but unused; consider removing, adding to `__all__`, or using a redundant alias +error[F401]: 5:34: `.renamed` imported but unused; consider removing, adding to `__all__`, or using a redundant alias + --> __init__.py:5:34 | 5 | from . import unused, renamed as bees # F401: add to __all__ | ^^^^ diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_stable_F401_29__all_conditional____init__.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_stable_F401_29__all_conditional____init__.py.snap index 298e2e6df7..8deea8468b 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_stable_F401_29__all_conditional____init__.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_stable_F401_29__all_conditional____init__.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F401]: __init__.py:8:15: `.unused` imported but unused; consider removing, adding to `__all__`, or using a redundant alias +error[F401]: 8:15: `.unused` imported but unused; consider removing, adding to `__all__`, or using a redundant alias + --> __init__.py:8:15 | 6 | import sys 7 | @@ -12,8 +13,9 @@ error[F401]: __init__.py:8:15: `.unused` imported but unused; consider removing, 10 | if sys.version_info > (3, 9): | = help: Remove unused import -error[F401]: __init__.py:8:44: `.renamed` imported but unused; consider removing, adding to `__all__`, or using a redundant alias +error[F401]: 8:44: `.renamed` imported but unused; consider removing, adding to `__all__`, or using a redundant alias + --> __init__.py:8:44 | 6 | import sys 7 | diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F402_F402.ipynb.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F402_F402.ipynb.snap index 25cef0bf2a..bc2679b2df 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F402_F402.ipynb.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F402_F402.ipynb.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F402]: F402.ipynb:3:5: Import `os` from cell 1, line 1 shadowed by loop variable +error[F402]: 3:5: Import `os` from cell 1, line 1 shadowed by loop variable + --> F402.ipynb:3:5 | 1 | import os 2 | import os.path as path @@ -11,8 +12,9 @@ error[F402]: F402.ipynb:3:5: Import `os` from cell 1, line 1 shadowed by loop va 4 | pass 5 | for path in range(3): | -error[F402]: F402.ipynb:5:5: Import `path` from cell 1, line 2 shadowed by loop variable +error[F402]: 5:5: Import `path` from cell 1, line 2 shadowed by loop variable + --> F402.ipynb:5:5 | 3 | for os in range(3): 4 | pass diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F402_F402.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F402_F402.py.snap index 773681c37b..92c16bef40 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F402_F402.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F402_F402.py.snap @@ -1,15 +1,17 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F402]: F402.py:5:5: Import `os` from line 1 shadowed by loop variable +error[F402]: 5:5: Import `os` from line 1 shadowed by loop variable + --> F402.py:5:5 | 5 | for os in range(3): | ^^ 6 | pass | -error[F402]: F402.py:8:5: Import `path` from line 2 shadowed by loop variable +error[F402]: 8:5: Import `path` from line 2 shadowed by loop variable + --> F402.py:8:5 | 6 | pass 7 | diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F403_F403.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F403_F403.py.snap index 75a2de868d..180af45f7c 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F403_F403.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F403_F403.py.snap @@ -1,15 +1,17 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F403]: F403.py:1:1: `from F634 import *` used; unable to detect undefined names +error[F403]: 1:1: `from F634 import *` used; unable to detect undefined names + --> F403.py:1:1 | 1 | from F634 import * | ^^^^^^^^^^^^^^^^^^ 2 | from F634 import * # noqa: E501 | -error[F403]: F403.py:2:1: `from F634 import *` used; unable to detect undefined names +error[F403]: 2:1: `from F634 import *` used; unable to detect undefined names + --> F403.py:1:19 | 1 | from F634 import * 2 | from F634 import * # noqa: E501 diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F404_F404_0.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F404_F404_0.py.snap index bd54fb4c64..3dbdd7bf89 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F404_F404_0.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F404_F404_0.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F404]: F404_0.py:6:1: `from __future__` imports must occur at the beginning of the file +error[F404]: 6:1: `from __future__` imports must occur at the beginning of the file + --> F404_0.py:5:1 | 4 | from collections import namedtuple 5 | diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F404_F404_1.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F404_F404_1.py.snap index fa620ceb47..9d708f6e28 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F404_F404_1.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F404_F404_1.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F404]: F404_1.py:5:1: `from __future__` imports must occur at the beginning of the file +error[F404]: 5:1: `from __future__` imports must occur at the beginning of the file + --> F404_1.py:4:1 | 3 | """Non-docstring""" 4 | diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F405_F405.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F405_F405.py.snap index 7a278cf878..db746ff274 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F405_F405.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F405_F405.py.snap @@ -1,15 +1,17 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F405]: F405.py:5:11: `name` may be undefined, or defined from star imports +error[F405]: 5:11: `name` may be undefined, or defined from star imports + --> F405.py:5:11 | 4 | def print_name(): 5 | print(name) | ^^^^ | -error[F405]: F405.py:11:12: `a` may be undefined, or defined from star imports +error[F405]: 11:12: `a` may be undefined, or defined from star imports + --> F405.py:11:12 | 9 | print(name) 10 | diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F406_F406.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F406_F406.py.snap index 732654917a..5c29d55861 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F406_F406.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F406_F406.py.snap @@ -1,15 +1,17 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F406]: F406.py:5:5: `from F634 import *` only allowed at module level +error[F406]: 5:5: `from F634 import *` only allowed at module level + --> F406.py:5:5 | 4 | def f(): 5 | from F634 import * | ^^^^^^^^^^^^^^^^^^ | -error[F406]: F406.py:9:5: `from F634 import *` only allowed at module level +error[F406]: 9:5: `from F634 import *` only allowed at module level + --> F406.py:9:5 | 8 | class F: 9 | from F634 import * diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F407_F407.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F407_F407.py.snap index b04cf801ae..f1f47c40d6 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F407_F407.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F407_F407.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F407]: F407.py:2:24: Future feature `non_existent_feature` is not defined +error[F407]: 2:24: Future feature `non_existent_feature` is not defined + --> F407.py:2:24 | 1 | from __future__ import print_function 2 | from __future__ import non_existent_feature diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F501_F50x.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F501_F50x.py.snap index b1ec05ac8b..9447438aa2 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F501_F50x.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F501_F50x.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F501]: F50x.py:1:1: `%`-format string has invalid format string: incomplete format +error[F501]: 1:1: `%`-format string has invalid format string: incomplete format + --> F50x.py:1:1 | 1 | '%(foo)' % {'foo': 'bar'} # F501 | ^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F502_F502.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F502_F502.py.snap index 4c4084bcc6..f3a81c8cb6 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F502_F502.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F502_F502.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F502]: F502.py:6:1: `%`-format string expected mapping but got sequence +error[F502]: 6:1: `%`-format string expected mapping but got sequence + --> F502.py:5:31 | 4 | "%(bob)s" % {"bob": "bob"} 5 | "%(bob)s" % {**{"bob": "bob"}} @@ -11,8 +12,9 @@ error[F502]: F502.py:6:1: `%`-format string expected mapping but got sequence 7 | "%(bob)s" % ("bob",) # F202 8 | "%(bob)s" % {"bob"} # F202 | -error[F502]: F502.py:7:1: `%`-format string expected mapping but got sequence +error[F502]: 7:1: `%`-format string expected mapping but got sequence + --> F502.py:6:28 | 5 | "%(bob)s" % {**{"bob": "bob"}} 6 | "%(bob)s" % ["bob"] # F202 @@ -21,8 +23,9 @@ error[F502]: F502.py:7:1: `%`-format string expected mapping but got sequence 8 | "%(bob)s" % {"bob"} # F202 9 | "%(bob)s" % [*["bob"]] # F202 | -error[F502]: F502.py:8:1: `%`-format string expected mapping but got sequence +error[F502]: 8:1: `%`-format string expected mapping but got sequence + --> F502.py:7:29 | 6 | "%(bob)s" % ["bob"] # F202 7 | "%(bob)s" % ("bob",) # F202 @@ -31,8 +34,9 @@ error[F502]: F502.py:8:1: `%`-format string expected mapping but got sequence 9 | "%(bob)s" % [*["bob"]] # F202 10 | "%(bob)s" % {"bob": "bob" for _ in range(1)} | -error[F502]: F502.py:9:1: `%`-format string expected mapping but got sequence +error[F502]: 9:1: `%`-format string expected mapping but got sequence + --> F502.py:8:28 | 7 | "%(bob)s" % ("bob",) # F202 8 | "%(bob)s" % {"bob"} # F202 @@ -41,8 +45,9 @@ error[F502]: F502.py:9:1: `%`-format string expected mapping but got sequence 10 | "%(bob)s" % {"bob": "bob" for _ in range(1)} 11 | "%(bob)s" % ["bob" for _ in range(1)] # F202 | -error[F502]: F502.py:11:1: `%`-format string expected mapping but got sequence +error[F502]: 11:1: `%`-format string expected mapping but got sequence + --> F502.py:10:45 | 9 | "%(bob)s" % [*["bob"]] # F202 10 | "%(bob)s" % {"bob": "bob" for _ in range(1)} @@ -51,8 +56,9 @@ error[F502]: F502.py:11:1: `%`-format string expected mapping but got sequence 12 | "%(bob)s" % ("bob" for _ in range(1)) # F202 13 | "%(bob)s" % {"bob" for _ in range(1)} # F202 | -error[F502]: F502.py:12:1: `%`-format string expected mapping but got sequence +error[F502]: 12:1: `%`-format string expected mapping but got sequence + --> F502.py:11:46 | 10 | "%(bob)s" % {"bob": "bob" for _ in range(1)} 11 | "%(bob)s" % ["bob" for _ in range(1)] # F202 @@ -60,8 +66,9 @@ error[F502]: F502.py:12:1: `%`-format string expected mapping but got sequence | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 13 | "%(bob)s" % {"bob" for _ in range(1)} # F202 | -error[F502]: F502.py:13:1: `%`-format string expected mapping but got sequence +error[F502]: 13:1: `%`-format string expected mapping but got sequence + --> F502.py:12:46 | 11 | "%(bob)s" % ["bob" for _ in range(1)] # F202 12 | "%(bob)s" % ("bob" for _ in range(1)) # F202 diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F502_F50x.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F502_F50x.py.snap index 32d290150c..dae64ace60 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F502_F50x.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F502_F50x.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F502]: F50x.py:9:1: `%`-format string expected mapping but got sequence +error[F502]: 9:1: `%`-format string expected mapping but got sequence + --> F50x.py:8:41 | 7 | '%(bar)s' % {} # F505 8 | '%(bar)s' % {'bar': 1, 'baz': 2} # F504 diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F503_F503.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F503_F503.py.snap index b39a727a01..db0f352c19 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F503_F503.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F503_F503.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F503]: F503.py:17:1: `%`-format string expected sequence but got mapping +error[F503]: 17:1: `%`-format string expected sequence but got mapping + --> F503.py:16:14 | 15 | # Multiple placeholders 16 | "%s %s" % dog @@ -11,8 +12,9 @@ error[F503]: F503.py:17:1: `%`-format string expected sequence but got mapping 18 | "%s %s" % {**{"bob": "bob"}} # F503 19 | "%s %s" % ["bob"] | -error[F503]: F503.py:18:1: `%`-format string expected sequence but got mapping +error[F503]: 18:1: `%`-format string expected sequence but got mapping + --> F503.py:17:33 | 16 | "%s %s" % dog 17 | "%s %s" % {"bob": "bob"} # F503 @@ -21,8 +23,9 @@ error[F503]: F503.py:18:1: `%`-format string expected sequence but got mapping 19 | "%s %s" % ["bob"] 20 | "%s %s" % ("bob",) | -error[F503]: F503.py:23:1: `%`-format string expected sequence but got mapping +error[F503]: 23:1: `%`-format string expected sequence but got mapping + --> F503.py:22:21 | 21 | "%s %s" % {"bob"} 22 | "%s %s" % [*["bob"]] diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F503_F50x.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F503_F50x.py.snap index c6a8f7cb23..c9b4c2a9a6 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F503_F50x.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F503_F50x.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F503]: F50x.py:10:1: `%`-format string expected sequence but got mapping +error[F503]: 10:1: `%`-format string expected sequence but got mapping + --> F50x.py:9:30 | 8 | '%(bar)s' % {'bar': 1, 'baz': 2} # F504 9 | '%(bar)s' % (1, 2, 3) # F502 diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F504_F504.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F504_F504.py.snap index 4b92ed8c0a..e88ac7ea87 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F504_F504.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F504_F504.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F504]: F504.py:3:1: [*] `%`-format string has unused named argument(s): b +error[F504]: 3:1: [*] `%`-format string has unused named argument(s): b + --> F504.py:2:12 | 1 | # Ruff has no way of knowing if the following are F505s 2 | a = "wrong" @@ -21,8 +22,9 @@ error[F504]: F504.py:3:1: [*] `%`-format string has unused named argument(s): b 5 5 | hidden = {"a": "!"} 6 6 | "%(a)s %(c)s" % {"x": 1, **hidden} # Ok (cannot see through splat) -error[F504]: F504.py:8:1: [*] `%`-format string has unused named argument(s): b +error[F504]: 8:1: [*] `%`-format string has unused named argument(s): b + --> F504.py:7:1 | 6 | "%(a)s %(c)s" % {"x": 1, **hidden} # Ok (cannot see through splat) 7 | @@ -41,8 +43,9 @@ error[F504]: F504.py:8:1: [*] `%`-format string has unused named argument(s): b 10 10 | 11 11 | '' % {'a''b' : ''} # F504 ("ab" not used) -error[F504]: F504.py:9:1: [*] `%`-format string has unused named argument(s): b +error[F504]: 9:1: [*] `%`-format string has unused named argument(s): b + --> F504.py:8:53 | 8 | "%(a)s" % {"a": 1, r"b": "!"} # F504 ("b" not used) 9 | "%(a)s" % {'a': 1, u"b": "!"} # F504 ("b" not used) @@ -61,8 +64,9 @@ error[F504]: F504.py:9:1: [*] `%`-format string has unused named argument(s): b 11 11 | '' % {'a''b' : ''} # F504 ("ab" not used) 12 12 | -error[F504]: F504.py:11:1: [*] `%`-format string has unused named argument(s): ab +error[F504]: 11:1: [*] `%`-format string has unused named argument(s): ab + --> F504.py:10:1 | 9 | "%(a)s" % {'a': 1, u"b": "!"} # F504 ("b" not used) 10 | @@ -82,8 +86,9 @@ error[F504]: F504.py:11:1: [*] `%`-format string has unused named argument(s): a 13 13 | # https://github.com/astral-sh/ruff/issues/4899 14 14 | "" % { -error[F504]: F504.py:14:1: [*] `%`-format string has unused named argument(s): test1, test2 +error[F504]: 14:1: [*] `%`-format string has unused named argument(s): test1, test2 + --> F504.py:13:48 | 13 | # https://github.com/astral-sh/ruff/issues/4899 14 | / "" % { diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F504_F50x.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F504_F50x.py.snap index 09e5121ddb..d282aa8b76 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F504_F50x.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F504_F50x.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F504]: F50x.py:8:1: [*] `%`-format string has unused named argument(s): baz +error[F504]: 8:1: [*] `%`-format string has unused named argument(s): baz + --> F50x.py:7:23 | 6 | '%s %s' % (1, 2, 3) # F507 7 | '%(bar)s' % {} # F505 diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F505_F50x.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F505_F50x.py.snap index 2c6984941e..04887c2b8f 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F505_F50x.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F505_F50x.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F505]: F50x.py:7:1: `%`-format string is missing argument(s) for placeholder(s): bar +error[F505]: 7:1: `%`-format string is missing argument(s) for placeholder(s): bar + --> F50x.py:6:28 | 5 | '%s %s' % (1,) # F507 6 | '%s %s' % (1, 2, 3) # F507 diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F506_F50x.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F506_F50x.py.snap index fa917e6049..d45cfda760 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F506_F50x.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F506_F50x.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F506]: F50x.py:2:1: `%`-format string has mixed positional and named placeholders +error[F506]: 2:1: `%`-format string has mixed positional and named placeholders + --> F50x.py:1:34 | 1 | '%(foo)' % {'foo': 'bar'} # F501 2 | '%s %(foo)s' % {'foo': 'bar'} # F506 @@ -10,8 +11,9 @@ error[F506]: F50x.py:2:1: `%`-format string has mixed positional and named place 3 | '%(foo)s %s' % {'foo': 'bar'} # F506 4 | '%j' % (1,) # F509 | -error[F506]: F50x.py:3:1: `%`-format string has mixed positional and named placeholders +error[F506]: 3:1: `%`-format string has mixed positional and named placeholders + --> F50x.py:2:38 | 1 | '%(foo)' % {'foo': 'bar'} # F501 2 | '%s %(foo)s' % {'foo': 'bar'} # F506 @@ -20,8 +22,9 @@ error[F506]: F50x.py:3:1: `%`-format string has mixed positional and named place 4 | '%j' % (1,) # F509 5 | '%s %s' % (1,) # F507 | -error[F506]: F50x.py:11:1: `%`-format string has mixed positional and named placeholders +error[F506]: 11:1: `%`-format string has mixed positional and named placeholders + --> F50x.py:10:29 | 9 | '%(bar)s' % (1, 2, 3) # F502 10 | '%s %s' % {'k': 'v'} # F503 diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F507_F50x.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F507_F50x.py.snap index 1abd411098..68ccea28ff 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F507_F50x.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F507_F50x.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F507]: F50x.py:5:1: `%`-format string has 2 placeholder(s) but 1 substitution(s) +error[F507]: 5:1: `%`-format string has 2 placeholder(s) but 1 substitution(s) + --> F50x.py:4:20 | 3 | '%(foo)s %s' % {'foo': 'bar'} # F506 4 | '%j' % (1,) # F509 @@ -11,8 +12,9 @@ error[F507]: F50x.py:5:1: `%`-format string has 2 placeholder(s) but 1 substitut 6 | '%s %s' % (1, 2, 3) # F507 7 | '%(bar)s' % {} # F505 | -error[F507]: F50x.py:6:1: `%`-format string has 2 placeholder(s) but 3 substitution(s) +error[F507]: 6:1: `%`-format string has 2 placeholder(s) but 3 substitution(s) + --> F50x.py:5:23 | 4 | '%j' % (1,) # F509 5 | '%s %s' % (1,) # F507 diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F508_F50x.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F508_F50x.py.snap index 741fa846b8..6864297448 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F508_F50x.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F508_F50x.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F508]: F50x.py:11:1: `%`-format string `*` specifier requires sequence +error[F508]: 11:1: `%`-format string `*` specifier requires sequence + --> F50x.py:10:29 | 9 | '%(bar)s' % (1, 2, 3) # F502 10 | '%s %s' % {'k': 'v'} # F503 diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F509_F50x.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F509_F50x.py.snap index 444a9d8650..54dc51178f 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F509_F50x.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F509_F50x.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F509]: F50x.py:4:1: `%`-format string has unsupported format character `j` +error[F509]: 4:1: `%`-format string has unsupported format character `j` + --> F50x.py:3:38 | 2 | '%s %(foo)s' % {'foo': 'bar'} # F506 3 | '%(foo)s %s' % {'foo': 'bar'} # F506 diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F521_F521.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F521_F521.py.snap index 11508b468b..348d4f8370 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F521_F521.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F521_F521.py.snap @@ -1,16 +1,18 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F521]: F521.py:1:1: `.format` call has invalid format string: Single '{' encountered in format string +error[F521]: 1:1: `.format` call has invalid format string: Single '{' encountered in format string + --> F521.py:1:1 | 1 | "{".format(1) | ^^^^^^^^^^^^^ 2 | "}".format(1) 3 | "{foo[}".format(foo=1) | -error[F521]: F521.py:2:1: `.format` call has invalid format string: Single '}' encountered in format string +error[F521]: 2:1: `.format` call has invalid format string: Single '}' encountered in format string + --> F521.py:1:14 | 1 | "{".format(1) 2 | "}".format(1) @@ -18,8 +20,9 @@ error[F521]: F521.py:2:1: `.format` call has invalid format string: Single '}' e 3 | "{foo[}".format(foo=1) 4 | # too much string recursion (placeholder-in-placeholder) | -error[F521]: F521.py:3:1: `.format` call has invalid format string: Expected '}' before end of string +error[F521]: 3:1: `.format` call has invalid format string: Expected '}' before end of string + --> F521.py:2:14 | 1 | "{".format(1) 2 | "}".format(1) @@ -28,8 +31,9 @@ error[F521]: F521.py:3:1: `.format` call has invalid format string: Expected '}' 4 | # too much string recursion (placeholder-in-placeholder) 5 | "{:{:{}}}".format(1, 2, 3) | -error[F521]: F521.py:5:1: `.format` call has invalid format string: Max format placeholder recursion exceeded +error[F521]: 5:1: `.format` call has invalid format string: Max format placeholder recursion exceeded + --> F521.py:4:57 | 3 | "{foo[}".format(foo=1) 4 | # too much string recursion (placeholder-in-placeholder) @@ -38,8 +42,9 @@ error[F521]: F521.py:5:1: `.format` call has invalid format string: Max format p 6 | # ruff picks these issues up, but flake8 doesn't 7 | "{foo[]}".format(foo={"": 1}) | -error[F521]: F521.py:7:1: `.format` call has invalid format string: Empty attribute in format string +error[F521]: 7:1: `.format` call has invalid format string: Empty attribute in format string + --> F521.py:6:49 | 5 | "{:{:{}}}".format(1, 2, 3) 6 | # ruff picks these issues up, but flake8 doesn't @@ -48,8 +53,9 @@ error[F521]: F521.py:7:1: `.format` call has invalid format string: Empty attrib 8 | "{foo..}".format(foo=1) 9 | "{foo..bar}".format(foo=1) | -error[F521]: F521.py:8:1: `.format` call has invalid format string: Empty attribute in format string +error[F521]: 8:1: `.format` call has invalid format string: Empty attribute in format string + --> F521.py:7:30 | 6 | # ruff picks these issues up, but flake8 doesn't 7 | "{foo[]}".format(foo={"": 1}) @@ -57,8 +63,9 @@ error[F521]: F521.py:8:1: `.format` call has invalid format string: Empty attrib | ^^^^^^^^^^^^^^^^^^^^^^^ 9 | "{foo..bar}".format(foo=1) | -error[F521]: F521.py:9:1: `.format` call has invalid format string: Empty attribute in format string +error[F521]: 9:1: `.format` call has invalid format string: Empty attribute in format string + --> F521.py:8:24 | 7 | "{foo[]}".format(foo={"": 1}) 8 | "{foo..}".format(foo=1) diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F522_F522.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F522_F522.py.snap index 62b686e073..ff2b7d0e62 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F522_F522.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F522_F522.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F522]: F522.py:1:1: [*] `.format` call has unused named argument(s): bar +error[F522]: 1:1: [*] `.format` call has unused named argument(s): bar + --> F522.py:1:1 | 1 | "{}".format(1, bar=2) # F522 | ^^^^^^^^^^^^^^^^^^^^^ @@ -17,8 +18,9 @@ error[F522]: F522.py:1:1: [*] `.format` call has unused named argument(s): bar 3 3 | "{bar:{spam}}".format(bar=2, spam=3) # No issues 4 4 | "{bar:{spam}}".format(bar=2, spam=3, eggs=4, ham=5) # F522 -error[F522]: F522.py:2:1: [*] `.format` call has unused named argument(s): spam +error[F522]: 2:1: [*] `.format` call has unused named argument(s): spam + --> F522.py:1:30 | 1 | "{}".format(1, bar=2) # F522 2 | "{bar}{}".format(1, bar=2, spam=3) # F522 @@ -35,8 +37,9 @@ error[F522]: F522.py:2:1: [*] `.format` call has unused named argument(s): spam 4 4 | "{bar:{spam}}".format(bar=2, spam=3, eggs=4, ham=5) # F522 5 5 | ('' -error[F522]: F522.py:4:1: [*] `.format` call has unused named argument(s): eggs, ham +error[F522]: 4:1: [*] `.format` call has unused named argument(s): eggs, ham + --> F522.py:3:50 | 2 | "{bar}{}".format(1, bar=2, spam=3) # F522 3 | "{bar:{spam}}".format(bar=2, spam=3) # No issues @@ -55,8 +58,9 @@ error[F522]: F522.py:4:1: [*] `.format` call has unused named argument(s): eggs, 5 5 | ('' 6 6 | .format(x=2)) # F522 -error[F522]: F522.py:5:2: [*] `.format` call has unused named argument(s): x +error[F522]: 5:2: [*] `.format` call has unused named argument(s): x + --> F522.py:5:2 | 3 | "{bar:{spam}}".format(bar=2, spam=3) # No issues 4 | "{bar:{spam}}".format(bar=2, spam=3, eggs=4, ham=5) # F522 diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F523_F523.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F523_F523.py.snap index cbb48f6bec..549b4a7c42 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F523_F523.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F523_F523.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F523]: F523.py:2:1: [*] `.format` call has unused arguments at position(s): 1 +error[F523]: 2:1: [*] `.format` call has unused arguments at position(s): 1 + --> F523.py:1:15 | 1 | # With indexes 2 | "{0}".format(1, 2) # F523 @@ -19,8 +20,9 @@ error[F523]: F523.py:2:1: [*] `.format` call has unused arguments at position(s) 4 4 | "{1:{0}}".format(1, 2) # No issues 5 5 | "{1:{0}}".format(1, 2, 3) # F523 -error[F523]: F523.py:3:1: `.format` call has unused arguments at position(s): 0, 2 +error[F523]: 3:1: `.format` call has unused arguments at position(s): 0, 2 + --> F523.py:2:27 | 1 | # With indexes 2 | "{0}".format(1, 2) # F523 @@ -30,8 +32,9 @@ error[F523]: F523.py:3:1: `.format` call has unused arguments at position(s): 0, 5 | "{1:{0}}".format(1, 2, 3) # F523 | = help: Remove extra positional arguments at position(s): 0, 2 -error[F523]: F523.py:5:1: [*] `.format` call has unused arguments at position(s): 2 +error[F523]: 5:1: [*] `.format` call has unused arguments at position(s): 2 + --> F523.py:4:36 | 3 | "{1}".format(1, 2, 3) # F523 4 | "{1:{0}}".format(1, 2) # No issues @@ -51,8 +54,9 @@ error[F523]: F523.py:5:1: [*] `.format` call has unused arguments at position(s) 7 7 | "{1.arg[1]!r:0{2['arg']}{1}}".format(1, 2, 3, 4) # F523 8 8 | -error[F523]: F523.py:6:1: [*] `.format` call has unused arguments at position(s): 1 +error[F523]: 6:1: [*] `.format` call has unused arguments at position(s): 1 + --> F523.py:5:34 | 4 | "{1:{0}}".format(1, 2) # No issues 5 | "{1:{0}}".format(1, 2, 3) # F523 @@ -71,8 +75,9 @@ error[F523]: F523.py:6:1: [*] `.format` call has unused arguments at position(s) 8 8 | 9 9 | # With no indexes -error[F523]: F523.py:7:1: `.format` call has unused arguments at position(s): 0, 3 +error[F523]: 7:1: `.format` call has unused arguments at position(s): 0, 3 + --> F523.py:6:38 | 5 | "{1:{0}}".format(1, 2, 3) # F523 6 | "{0}{2}".format(1, 2) # F523, # F524 @@ -82,8 +87,9 @@ error[F523]: F523.py:7:1: `.format` call has unused arguments at position(s): 0, 9 | # With no indexes | = help: Remove extra positional arguments at position(s): 0, 3 -error[F523]: F523.py:10:1: [*] `.format` call has unused arguments at position(s): 1 +error[F523]: 10:1: [*] `.format` call has unused arguments at position(s): 1 + --> F523.py:9:18 | 9 | # With no indexes 10 | "{}".format(1, 2) # F523 @@ -102,8 +108,9 @@ error[F523]: F523.py:10:1: [*] `.format` call has unused arguments at position(s 12 12 | "{:{}}".format(1, 2) # No issues 13 13 | "{:{}}".format(1, 2, 3) # F523 -error[F523]: F523.py:11:1: [*] `.format` call has unused arguments at position(s): 1, 2 +error[F523]: 11:1: [*] `.format` call has unused arguments at position(s): 1, 2 + --> F523.py:10:26 | 9 | # With no indexes 10 | "{}".format(1, 2) # F523 @@ -123,8 +130,9 @@ error[F523]: F523.py:11:1: [*] `.format` call has unused arguments at position(s 13 13 | "{:{}}".format(1, 2, 3) # F523 14 14 | -error[F523]: F523.py:13:1: [*] `.format` call has unused arguments at position(s): 2 +error[F523]: 13:1: [*] `.format` call has unused arguments at position(s): 2 + --> F523.py:12:34 | 11 | "{}".format(1, 2, 3) # F523 12 | "{:{}}".format(1, 2) # No issues @@ -144,8 +152,9 @@ error[F523]: F523.py:13:1: [*] `.format` call has unused arguments at position(s 15 15 | # With *args 16 16 | "{0}{1}".format(*args) # No issues -error[F523]: F523.py:19:1: `.format` call has unused arguments at position(s): 2 +error[F523]: 19:1: `.format` call has unused arguments at position(s): 2 + --> F523.py:18:42 | 17 | "{0}{1}".format(1, *args) # No issues 18 | "{0}{1}".format(1, 2, *args) # No issues @@ -155,8 +164,9 @@ error[F523]: F523.py:19:1: `.format` call has unused arguments at position(s): 2 21 | # With nested quotes | = help: Remove extra positional arguments at position(s): 2 -error[F523]: F523.py:22:1: [*] `.format` call has unused arguments at position(s): 1, 2 +error[F523]: 22:1: [*] `.format` call has unused arguments at position(s): 1, 2 + --> F523.py:21:21 | 21 | # With nested quotes 22 | "''1{0}".format(1, 2, 3) # F523 @@ -175,8 +185,9 @@ error[F523]: F523.py:22:1: [*] `.format` call has unused arguments at position(s 24 24 | '""{1}{0}'.format(1, 2, 3) # F523 25 25 | -error[F523]: F523.py:23:1: [*] `.format` call has unused arguments at position(s): 2 +error[F523]: 23:1: [*] `.format` call has unused arguments at position(s): 2 + --> F523.py:22:33 | 21 | # With nested quotes 22 | "''1{0}".format(1, 2, 3) # F523 @@ -195,8 +206,9 @@ error[F523]: F523.py:23:1: [*] `.format` call has unused arguments at position(s 25 25 | 26 26 | # With modified indexes -error[F523]: F523.py:24:1: [*] `.format` call has unused arguments at position(s): 2 +error[F523]: 24:1: [*] `.format` call has unused arguments at position(s): 2 + --> F523.py:23:37 | 22 | "''1{0}".format(1, 2, 3) # F523 23 | "\"\"{1}{0}".format(1, 2, 3) # F523 @@ -216,8 +228,9 @@ error[F523]: F523.py:24:1: [*] `.format` call has unused arguments at position(s 26 26 | # With modified indexes 27 27 | "{1}{2}".format(1, 2, 3) # F523, # F524 -error[F523]: F523.py:27:1: `.format` call has unused arguments at position(s): 0 +error[F523]: 27:1: `.format` call has unused arguments at position(s): 0 + --> F523.py:26:24 | 26 | # With modified indexes 27 | "{1}{2}".format(1, 2, 3) # F523, # F524 @@ -226,8 +239,9 @@ error[F523]: F523.py:27:1: `.format` call has unused arguments at position(s): 0 29 | "{1} {8}".format(0, 1) # F523, # F524 | = help: Remove extra positional arguments at position(s): 0 -error[F523]: F523.py:28:1: `.format` call has unused arguments at position(s): 0, 2 +error[F523]: 28:1: `.format` call has unused arguments at position(s): 0, 2 + --> F523.py:27:41 | 26 | # With modified indexes 27 | "{1}{2}".format(1, 2, 3) # F523, # F524 @@ -236,8 +250,9 @@ error[F523]: F523.py:28:1: `.format` call has unused arguments at position(s): 0 29 | "{1} {8}".format(0, 1) # F523, # F524 | = help: Remove extra positional arguments at position(s): 0, 2 -error[F523]: F523.py:29:1: `.format` call has unused arguments at position(s): 0 +error[F523]: 29:1: `.format` call has unused arguments at position(s): 0 + --> F523.py:28:44 | 27 | "{1}{2}".format(1, 2, 3) # F523, # F524 28 | "{1}{3}".format(1, 2, 3, 4) # F523, # F524 @@ -247,8 +262,9 @@ error[F523]: F523.py:29:1: `.format` call has unused arguments at position(s): 0 31 | # Multiline | = help: Remove extra positional arguments at position(s): 0 -error[F523]: F523.py:32:2: [*] `.format` call has unused arguments at position(s): 0 +error[F523]: 32:2: [*] `.format` call has unused arguments at position(s): 0 + --> F523.py:32:2 | 31 | # Multiline 32 | ('' diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F524_F524.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F524_F524.py.snap index c310e10f9c..dc9ae748de 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F524_F524.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F524_F524.py.snap @@ -1,16 +1,18 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F524]: F524.py:1:1: `.format` call is missing argument(s) for placeholder(s): 1 +error[F524]: 1:1: `.format` call is missing argument(s) for placeholder(s): 1 + --> F524.py:1:1 | 1 | "{} {}".format(1) # F524 | ^^^^^^^^^^^^^^^^^ 2 | "{2}".format() # F524 3 | "{bar}".format() # F524 | -error[F524]: F524.py:2:1: `.format` call is missing argument(s) for placeholder(s): 2 +error[F524]: 2:1: `.format` call is missing argument(s) for placeholder(s): 2 + --> F524.py:1:26 | 1 | "{} {}".format(1) # F524 2 | "{2}".format() # F524 @@ -18,8 +20,9 @@ error[F524]: F524.py:2:1: `.format` call is missing argument(s) for placeholder( 3 | "{bar}".format() # F524 4 | "{0} {bar}".format(1) # F524 | -error[F524]: F524.py:3:1: `.format` call is missing argument(s) for placeholder(s): bar +error[F524]: 3:1: `.format` call is missing argument(s) for placeholder(s): bar + --> F524.py:2:23 | 1 | "{} {}".format(1) # F524 2 | "{2}".format() # F524 @@ -28,8 +31,9 @@ error[F524]: F524.py:3:1: `.format` call is missing argument(s) for placeholder( 4 | "{0} {bar}".format(1) # F524 5 | "{0} {bar}".format() # F524 | -error[F524]: F524.py:4:1: `.format` call is missing argument(s) for placeholder(s): bar +error[F524]: 4:1: `.format` call is missing argument(s) for placeholder(s): bar + --> F524.py:3:25 | 2 | "{2}".format() # F524 3 | "{bar}".format() # F524 @@ -38,8 +42,9 @@ error[F524]: F524.py:4:1: `.format` call is missing argument(s) for placeholder( 5 | "{0} {bar}".format() # F524 6 | "{bar} {0}".format() # F524 | -error[F524]: F524.py:5:1: `.format` call is missing argument(s) for placeholder(s): 0, bar +error[F524]: 5:1: `.format` call is missing argument(s) for placeholder(s): 0, bar + --> F524.py:4:30 | 3 | "{bar}".format() # F524 4 | "{0} {bar}".format(1) # F524 @@ -48,8 +53,9 @@ error[F524]: F524.py:5:1: `.format` call is missing argument(s) for placeholder( 6 | "{bar} {0}".format() # F524 7 | "{1} {8}".format(0, 1) | -error[F524]: F524.py:6:1: `.format` call is missing argument(s) for placeholder(s): 0, bar +error[F524]: 6:1: `.format` call is missing argument(s) for placeholder(s): 0, bar + --> F524.py:5:29 | 4 | "{0} {bar}".format(1) # F524 5 | "{0} {bar}".format() # F524 @@ -57,8 +63,9 @@ error[F524]: F524.py:6:1: `.format` call is missing argument(s) for placeholder( | ^^^^^^^^^^^^^^^^^^^^ 7 | "{1} {8}".format(0, 1) | -error[F524]: F524.py:7:1: `.format` call is missing argument(s) for placeholder(s): 8 +error[F524]: 7:1: `.format` call is missing argument(s) for placeholder(s): 8 + --> F524.py:6:29 | 5 | "{0} {bar}".format() # F524 6 | "{bar} {0}".format() # F524 diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F525_F525.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F525_F525.py.snap index ea13c4e756..15af50a849 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F525_F525.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F525_F525.py.snap @@ -1,15 +1,17 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F525]: F525.py:1:1: `.format` string mixes automatic and manual numbering +error[F525]: 1:1: `.format` string mixes automatic and manual numbering + --> F525.py:1:1 | 1 | "{} {1}".format(1, 2) # F525 | ^^^^^^^^^^^^^^^^^^^^^ 2 | "{0} {}".format(1, 2) # F523, F525 | -error[F525]: F525.py:2:1: `.format` string mixes automatic and manual numbering +error[F525]: 2:1: `.format` string mixes automatic and manual numbering + --> F525.py:1:30 | 1 | "{} {1}".format(1, 2) # F525 2 | "{0} {}".format(1, 2) # F523, F525 diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F541_F541.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F541_F541.py.snap index d061847ac3..d1f9a2f686 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F541_F541.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F541_F541.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F541]: F541.py:6:5: [*] f-string without any placeholders +error[F541]: 6:5: [*] f-string without any placeholders + --> F541.py:6:5 | 5 | # Errors 6 | c = f"def" @@ -21,8 +22,9 @@ error[F541]: F541.py:6:5: [*] f-string without any placeholders 8 8 | e = ( 9 9 | f"def" + -error[F541]: F541.py:7:5: [*] f-string without any placeholders +error[F541]: 7:5: [*] f-string without any placeholders + --> F541.py:7:5 | 5 | # Errors 6 | c = f"def" @@ -42,8 +44,9 @@ error[F541]: F541.py:7:5: [*] f-string without any placeholders 9 9 | f"def" + 10 10 | "ghi" -error[F541]: F541.py:9:5: [*] f-string without any placeholders +error[F541]: 9:5: [*] f-string without any placeholders + --> F541.py:9:5 | 7 | d = f"def" + "ghi" 8 | e = ( @@ -63,8 +66,9 @@ error[F541]: F541.py:9:5: [*] f-string without any placeholders 11 11 | ) 12 12 | f = ( -error[F541]: F541.py:13:5: [*] f-string without any placeholders +error[F541]: 13:5: [*] f-string without any placeholders + --> F541.py:13:5 | 11 | ) 12 | f = ( @@ -84,8 +88,9 @@ error[F541]: F541.py:13:5: [*] f-string without any placeholders 15 15 | "c" 16 16 | rf"d" -error[F541]: F541.py:14:5: [*] f-string without any placeholders +error[F541]: 14:5: [*] f-string without any placeholders + --> F541.py:14:5 | 12 | f = ( 13 | f"a" @@ -105,8 +110,9 @@ error[F541]: F541.py:14:5: [*] f-string without any placeholders 16 16 | rf"d" 17 17 | fr"e" -error[F541]: F541.py:16:5: [*] f-string without any placeholders +error[F541]: 16:5: [*] f-string without any placeholders + --> F541.py:16:5 | 14 | F"b" 15 | "c" @@ -126,8 +132,9 @@ error[F541]: F541.py:16:5: [*] f-string without any placeholders 18 18 | ) 19 19 | g = f"" -error[F541]: F541.py:17:5: [*] f-string without any placeholders +error[F541]: 17:5: [*] f-string without any placeholders + --> F541.py:17:5 | 15 | "c" 16 | rf"d" @@ -147,8 +154,9 @@ error[F541]: F541.py:17:5: [*] f-string without any placeholders 19 19 | g = f"" 20 20 | -error[F541]: F541.py:19:5: [*] f-string without any placeholders +error[F541]: 19:5: [*] f-string without any placeholders + --> F541.py:19:5 | 17 | fr"e" 18 | ) @@ -168,8 +176,9 @@ error[F541]: F541.py:19:5: [*] f-string without any placeholders 21 21 | # OK 22 22 | g = f"ghi{123:{45}}" -error[F541]: F541.py:25:13: [*] f-string without any placeholders +error[F541]: 25:13: [*] f-string without any placeholders + --> F541.py:25:13 | 24 | # Error 25 | h = "x" "y" f"z" @@ -188,8 +197,9 @@ error[F541]: F541.py:25:13: [*] f-string without any placeholders 27 27 | v = 23.234234 28 28 | -error[F541]: F541.py:34:7: [*] f-string without any placeholders +error[F541]: 34:7: [*] f-string without any placeholders + --> F541.py:34:7 | 33 | # Errors 34 | f"{v:{f'0.2f'}}" @@ -208,8 +218,9 @@ error[F541]: F541.py:34:7: [*] f-string without any placeholders 36 36 | f"{{test}}" 37 37 | f'{{ 40 }}' -error[F541]: F541.py:35:4: [*] f-string without any placeholders +error[F541]: 35:4: [*] f-string without any placeholders + --> F541.py:35:4 | 33 | # Errors 34 | f"{v:{f'0.2f'}}" @@ -229,8 +240,9 @@ error[F541]: F541.py:35:4: [*] f-string without any placeholders 37 37 | f'{{ 40 }}' 38 38 | f"{{a {{x}}" -error[F541]: F541.py:36:1: [*] f-string without any placeholders +error[F541]: 36:1: [*] f-string without any placeholders + --> F541.py:35:9 | 34 | f"{v:{f'0.2f'}}" 35 | f"{f''}" @@ -250,8 +262,9 @@ error[F541]: F541.py:36:1: [*] f-string without any placeholders 38 38 | f"{{a {{x}}" 39 39 | f"{{{{x}}}}" -error[F541]: F541.py:37:1: [*] f-string without any placeholders +error[F541]: 37:1: [*] f-string without any placeholders + --> F541.py:36:12 | 35 | f"{f''}" 36 | f"{{test}}" @@ -271,8 +284,9 @@ error[F541]: F541.py:37:1: [*] f-string without any placeholders 39 39 | f"{{{{x}}}}" 40 40 | ""f"" -error[F541]: F541.py:38:1: [*] f-string without any placeholders +error[F541]: 38:1: [*] f-string without any placeholders + --> F541.py:37:12 | 36 | f"{{test}}" 37 | f'{{ 40 }}' @@ -292,8 +306,9 @@ error[F541]: F541.py:38:1: [*] f-string without any placeholders 40 40 | ""f"" 41 41 | ''f"" -error[F541]: F541.py:39:1: [*] f-string without any placeholders +error[F541]: 39:1: [*] f-string without any placeholders + --> F541.py:38:13 | 37 | f'{{ 40 }}' 38 | f"{{a {{x}}" @@ -313,8 +328,9 @@ error[F541]: F541.py:39:1: [*] f-string without any placeholders 41 41 | ''f"" 42 42 | (""f""r"") -error[F541]: F541.py:40:3: [*] f-string without any placeholders +error[F541]: 40:3: [*] f-string without any placeholders + --> F541.py:40:3 | 38 | f"{{a {{x}}" 39 | f"{{{{x}}}}" @@ -334,8 +350,9 @@ error[F541]: F541.py:40:3: [*] f-string without any placeholders 42 42 | (""f""r"") 43 43 | f"{v:{f"0.2f"}}" -error[F541]: F541.py:41:3: [*] f-string without any placeholders +error[F541]: 41:3: [*] f-string without any placeholders + --> F541.py:41:3 | 39 | f"{{{{x}}}}" 40 | ""f"" @@ -355,8 +372,9 @@ error[F541]: F541.py:41:3: [*] f-string without any placeholders 43 43 | f"{v:{f"0.2f"}}" 44 44 | f"\{{x}}" -error[F541]: F541.py:42:4: [*] f-string without any placeholders +error[F541]: 42:4: [*] f-string without any placeholders + --> F541.py:42:4 | 40 | ""f"" 41 | ''f"" @@ -375,8 +393,9 @@ error[F541]: F541.py:42:4: [*] f-string without any placeholders 43 43 | f"{v:{f"0.2f"}}" 44 44 | f"\{{x}}" -error[F541]: F541.py:43:7: [*] f-string without any placeholders +error[F541]: 43:7: [*] f-string without any placeholders + --> F541.py:43:7 | 41 | ''f"" 42 | (""f""r"") @@ -393,8 +412,9 @@ error[F541]: F541.py:43:7: [*] f-string without any placeholders 43 |+f"{v:{"0.2f"}}" 44 44 | f"\{{x}}" -error[F541]: F541.py:44:1: [*] f-string without any placeholders +error[F541]: 44:1: [*] f-string without any placeholders + --> F541.py:43:17 | 42 | (""f""r"") 43 | f"{v:{f"0.2f"}}" diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F601_F601.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F601_F601.py.snap index bba81176c1..a339dfc665 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F601_F601.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F601_F601.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F601]: F601.py:3:5: Dictionary key literal `"a"` repeated +error[F601]: 3:5: Dictionary key literal `"a"` repeated + --> F601.py:3:5 | 1 | x = { 2 | "a": 1, @@ -12,8 +13,9 @@ error[F601]: F601.py:3:5: Dictionary key literal `"a"` repeated 5 | ("a", "b"): 3, | = help: Remove repeated key literal `"a"` -error[F601]: F601.py:6:5: Dictionary key literal `("a", "b")` repeated +error[F601]: 6:5: Dictionary key literal `("a", "b")` repeated + --> F601.py:6:5 | 4 | "b": 3, 5 | ("a", "b"): 3, @@ -23,8 +25,9 @@ error[F601]: F601.py:6:5: Dictionary key literal `("a", "b")` repeated 8 | 1: 0, | = help: Remove repeated key literal `("a", "b")` -error[F601]: F601.py:9:5: Dictionary key literal `1` repeated +error[F601]: 9:5: Dictionary key literal `1` repeated + --> F601.py:9:5 | 7 | 1.0: 2, 8 | 1: 0, @@ -34,8 +37,9 @@ error[F601]: F601.py:9:5: Dictionary key literal `1` repeated 11 | b"123": 4, | = help: Remove repeated key literal `1` -error[F601]: F601.py:11:5: Dictionary key literal `b"123"` repeated +error[F601]: 11:5: Dictionary key literal `b"123"` repeated + --> F601.py:11:5 | 9 | 1: 3, 10 | b"123": 1, @@ -44,8 +48,9 @@ error[F601]: F601.py:11:5: Dictionary key literal `b"123"` repeated 12 | } | = help: Remove repeated key literal `b"123"` -error[F601]: F601.py:16:5: Dictionary key literal `"a"` repeated +error[F601]: 16:5: Dictionary key literal `"a"` repeated + --> F601.py:16:5 | 14 | x = { 15 | "a": 1, @@ -55,8 +60,9 @@ error[F601]: F601.py:16:5: Dictionary key literal `"a"` repeated 18 | "a": 3, | = help: Remove repeated key literal `"a"` -error[F601]: F601.py:17:5: Dictionary key literal `"a"` repeated +error[F601]: 17:5: Dictionary key literal `"a"` repeated + --> F601.py:17:5 | 15 | "a": 1, 16 | "a": 2, @@ -66,8 +72,9 @@ error[F601]: F601.py:17:5: Dictionary key literal `"a"` repeated 19 | } | = help: Remove repeated key literal `"a"` -error[F601]: F601.py:18:5: [*] Dictionary key literal `"a"` repeated +error[F601]: 18:5: [*] Dictionary key literal `"a"` repeated + --> F601.py:18:5 | 16 | "a": 2, 17 | "a": 3, @@ -85,8 +92,9 @@ error[F601]: F601.py:18:5: [*] Dictionary key literal `"a"` repeated 20 19 | 21 20 | x = { -error[F601]: F601.py:23:5: Dictionary key literal `"a"` repeated +error[F601]: 23:5: Dictionary key literal `"a"` repeated + --> F601.py:23:5 | 21 | x = { 22 | "a": 1, @@ -96,8 +104,9 @@ error[F601]: F601.py:23:5: Dictionary key literal `"a"` repeated 25 | "a": 3, | = help: Remove repeated key literal `"a"` -error[F601]: F601.py:24:5: Dictionary key literal `"a"` repeated +error[F601]: 24:5: Dictionary key literal `"a"` repeated + --> F601.py:24:5 | 22 | "a": 1, 23 | "a": 2, @@ -107,8 +116,9 @@ error[F601]: F601.py:24:5: Dictionary key literal `"a"` repeated 26 | "a": 4, | = help: Remove repeated key literal `"a"` -error[F601]: F601.py:25:5: [*] Dictionary key literal `"a"` repeated +error[F601]: 25:5: [*] Dictionary key literal `"a"` repeated + --> F601.py:25:5 | 23 | "a": 2, 24 | "a": 3, @@ -127,8 +137,9 @@ error[F601]: F601.py:25:5: [*] Dictionary key literal `"a"` repeated 27 26 | } 28 27 | -error[F601]: F601.py:26:5: Dictionary key literal `"a"` repeated +error[F601]: 26:5: Dictionary key literal `"a"` repeated + --> F601.py:26:5 | 24 | "a": 3, 25 | "a": 3, @@ -137,8 +148,9 @@ error[F601]: F601.py:26:5: Dictionary key literal `"a"` repeated 27 | } | = help: Remove repeated key literal `"a"` -error[F601]: F601.py:31:5: [*] Dictionary key literal `"a"` repeated +error[F601]: 31:5: [*] Dictionary key literal `"a"` repeated + --> F601.py:31:5 | 29 | x = { 30 | "a": 1, @@ -157,8 +169,9 @@ error[F601]: F601.py:31:5: [*] Dictionary key literal `"a"` repeated 33 32 | "a": 3, 34 33 | "a": 4, -error[F601]: F601.py:32:5: Dictionary key literal `"a"` repeated +error[F601]: 32:5: Dictionary key literal `"a"` repeated + --> F601.py:32:5 | 30 | "a": 1, 31 | "a": 1, @@ -168,8 +181,9 @@ error[F601]: F601.py:32:5: Dictionary key literal `"a"` repeated 34 | "a": 4, | = help: Remove repeated key literal `"a"` -error[F601]: F601.py:33:5: Dictionary key literal `"a"` repeated +error[F601]: 33:5: Dictionary key literal `"a"` repeated + --> F601.py:33:5 | 31 | "a": 1, 32 | "a": 2, @@ -179,8 +193,9 @@ error[F601]: F601.py:33:5: Dictionary key literal `"a"` repeated 35 | } | = help: Remove repeated key literal `"a"` -error[F601]: F601.py:34:5: Dictionary key literal `"a"` repeated +error[F601]: 34:5: Dictionary key literal `"a"` repeated + --> F601.py:34:5 | 32 | "a": 2, 33 | "a": 3, @@ -189,8 +204,9 @@ error[F601]: F601.py:34:5: Dictionary key literal `"a"` repeated 35 | } | = help: Remove repeated key literal `"a"` -error[F601]: F601.py:41:5: Dictionary key literal `"a"` repeated +error[F601]: 41:5: Dictionary key literal `"a"` repeated + --> F601.py:41:5 | 39 | "a": 1, 40 | a: 1, @@ -200,8 +216,9 @@ error[F601]: F601.py:41:5: Dictionary key literal `"a"` repeated 43 | "a": 3, | = help: Remove repeated key literal `"a"` -error[F601]: F601.py:43:5: Dictionary key literal `"a"` repeated +error[F601]: 43:5: Dictionary key literal `"a"` repeated + --> F601.py:43:5 | 41 | "a": 2, 42 | a: 2, @@ -211,8 +228,9 @@ error[F601]: F601.py:43:5: Dictionary key literal `"a"` repeated 45 | "a": 3, | = help: Remove repeated key literal `"a"` -error[F601]: F601.py:45:5: [*] Dictionary key literal `"a"` repeated +error[F601]: 45:5: [*] Dictionary key literal `"a"` repeated + --> F601.py:45:5 | 43 | "a": 3, 44 | a: 3, @@ -231,8 +249,9 @@ error[F601]: F601.py:45:5: [*] Dictionary key literal `"a"` repeated 47 46 | } 48 47 | -error[F601]: F601.py:49:14: [*] Dictionary key literal `"a"` repeated +error[F601]: 49:14: [*] Dictionary key literal `"a"` repeated + --> F601.py:49:14 | 47 | } 48 | @@ -251,8 +270,9 @@ error[F601]: F601.py:49:14: [*] Dictionary key literal `"a"` repeated 51 51 | 52 52 | x = { -error[F601]: F601.py:50:22: [*] Dictionary key literal `"a"` repeated +error[F601]: 50:22: [*] Dictionary key literal `"a"` repeated + --> F601.py:50:22 | 49 | x = {"a": 1, "a": 1} 50 | x = {"a": 1, "b": 2, "a": 1} @@ -271,8 +291,9 @@ error[F601]: F601.py:50:22: [*] Dictionary key literal `"a"` repeated 52 52 | x = { 53 53 | ('a', 'b'): 'asdf', -error[F601]: F601.py:54:5: Dictionary key literal `('a', 'b')` repeated +error[F601]: 54:5: Dictionary key literal `('a', 'b')` repeated + --> F601.py:54:5 | 52 | x = { 53 | ('a', 'b'): 'asdf', @@ -281,8 +302,9 @@ error[F601]: F601.py:54:5: Dictionary key literal `('a', 'b')` repeated 55 | } | = help: Remove repeated key literal `('a', 'b')` -error[F601]: F601.py:58:19: [*] Dictionary key literal `"x"` repeated +error[F601]: 58:19: [*] Dictionary key literal `"x"` repeated + --> F601.py:58:19 | 57 | # Regression test for: https://github.com/astral-sh/ruff/issues/4897 58 | t={"x":"test123", "x":("test123")} @@ -300,8 +322,9 @@ error[F601]: F601.py:58:19: [*] Dictionary key literal `"x"` repeated 59 59 | 60 60 | t={"x":("test123"), "x":"test123"} -error[F601]: F601.py:60:21: [*] Dictionary key literal `"x"` repeated +error[F601]: 60:21: [*] Dictionary key literal `"x"` repeated + --> F601.py:60:21 | 58 | t={"x":"test123", "x":("test123")} 59 | diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F602_F602.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F602_F602.py.snap index 5b5ff29358..4d8004b9af 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F602_F602.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F602_F602.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F602]: F602.py:5:5: Dictionary key `a` repeated +error[F602]: 5:5: Dictionary key `a` repeated + --> F602.py:5:5 | 3 | x = { 4 | a: 1, @@ -12,8 +13,9 @@ error[F602]: F602.py:5:5: Dictionary key `a` repeated 7 | } | = help: Remove repeated key `a` -error[F602]: F602.py:11:5: Dictionary key `a` repeated +error[F602]: 11:5: Dictionary key `a` repeated + --> F602.py:11:5 | 9 | x = { 10 | a: 1, @@ -23,8 +25,9 @@ error[F602]: F602.py:11:5: Dictionary key `a` repeated 13 | a: 3, | = help: Remove repeated key `a` -error[F602]: F602.py:12:5: Dictionary key `a` repeated +error[F602]: 12:5: Dictionary key `a` repeated + --> F602.py:12:5 | 10 | a: 1, 11 | a: 2, @@ -34,8 +37,9 @@ error[F602]: F602.py:12:5: Dictionary key `a` repeated 14 | } | = help: Remove repeated key `a` -error[F602]: F602.py:13:5: [*] Dictionary key `a` repeated +error[F602]: 13:5: [*] Dictionary key `a` repeated + --> F602.py:13:5 | 11 | a: 2, 12 | a: 3, @@ -53,8 +57,9 @@ error[F602]: F602.py:13:5: [*] Dictionary key `a` repeated 15 14 | 16 15 | x = { -error[F602]: F602.py:18:5: Dictionary key `a` repeated +error[F602]: 18:5: Dictionary key `a` repeated + --> F602.py:18:5 | 16 | x = { 17 | a: 1, @@ -64,8 +69,9 @@ error[F602]: F602.py:18:5: Dictionary key `a` repeated 20 | a: 3, | = help: Remove repeated key `a` -error[F602]: F602.py:19:5: Dictionary key `a` repeated +error[F602]: 19:5: Dictionary key `a` repeated + --> F602.py:19:5 | 17 | a: 1, 18 | a: 2, @@ -75,8 +81,9 @@ error[F602]: F602.py:19:5: Dictionary key `a` repeated 21 | a: 4, | = help: Remove repeated key `a` -error[F602]: F602.py:20:5: [*] Dictionary key `a` repeated +error[F602]: 20:5: [*] Dictionary key `a` repeated + --> F602.py:20:5 | 18 | a: 2, 19 | a: 3, @@ -95,8 +102,9 @@ error[F602]: F602.py:20:5: [*] Dictionary key `a` repeated 22 21 | } 23 22 | -error[F602]: F602.py:21:5: Dictionary key `a` repeated +error[F602]: 21:5: Dictionary key `a` repeated + --> F602.py:21:5 | 19 | a: 3, 20 | a: 3, @@ -105,8 +113,9 @@ error[F602]: F602.py:21:5: Dictionary key `a` repeated 22 | } | = help: Remove repeated key `a` -error[F602]: F602.py:26:5: [*] Dictionary key `a` repeated +error[F602]: 26:5: [*] Dictionary key `a` repeated + --> F602.py:26:5 | 24 | x = { 25 | a: 1, @@ -125,8 +134,9 @@ error[F602]: F602.py:26:5: [*] Dictionary key `a` repeated 28 27 | a: 3, 29 28 | a: 4, -error[F602]: F602.py:27:5: Dictionary key `a` repeated +error[F602]: 27:5: Dictionary key `a` repeated + --> F602.py:27:5 | 25 | a: 1, 26 | a: 1, @@ -136,8 +146,9 @@ error[F602]: F602.py:27:5: Dictionary key `a` repeated 29 | a: 4, | = help: Remove repeated key `a` -error[F602]: F602.py:28:5: Dictionary key `a` repeated +error[F602]: 28:5: Dictionary key `a` repeated + --> F602.py:28:5 | 26 | a: 1, 27 | a: 2, @@ -147,8 +158,9 @@ error[F602]: F602.py:28:5: Dictionary key `a` repeated 30 | } | = help: Remove repeated key `a` -error[F602]: F602.py:29:5: Dictionary key `a` repeated +error[F602]: 29:5: Dictionary key `a` repeated + --> F602.py:29:5 | 27 | a: 2, 28 | a: 3, @@ -157,8 +169,9 @@ error[F602]: F602.py:29:5: Dictionary key `a` repeated 30 | } | = help: Remove repeated key `a` -error[F602]: F602.py:35:5: [*] Dictionary key `a` repeated +error[F602]: 35:5: [*] Dictionary key `a` repeated + --> F602.py:35:5 | 33 | a: 1, 34 | "a": 1, @@ -177,8 +190,9 @@ error[F602]: F602.py:35:5: [*] Dictionary key `a` repeated 37 36 | a: 2, 38 37 | "a": 3, -error[F602]: F602.py:37:5: Dictionary key `a` repeated +error[F602]: 37:5: Dictionary key `a` repeated + --> F602.py:37:5 | 35 | a: 1, 36 | "a": 2, @@ -188,8 +202,9 @@ error[F602]: F602.py:37:5: Dictionary key `a` repeated 39 | a: 3, | = help: Remove repeated key `a` -error[F602]: F602.py:39:5: Dictionary key `a` repeated +error[F602]: 39:5: Dictionary key `a` repeated + --> F602.py:39:5 | 37 | a: 2, 38 | "a": 3, @@ -199,8 +214,9 @@ error[F602]: F602.py:39:5: Dictionary key `a` repeated 41 | a: 4, | = help: Remove repeated key `a` -error[F602]: F602.py:41:5: Dictionary key `a` repeated +error[F602]: 41:5: Dictionary key `a` repeated + --> F602.py:41:5 | 39 | a: 3, 40 | "a": 3, @@ -209,8 +225,9 @@ error[F602]: F602.py:41:5: Dictionary key `a` repeated 42 | } | = help: Remove repeated key `a` -error[F602]: F602.py:44:12: [*] Dictionary key `a` repeated +error[F602]: 44:12: [*] Dictionary key `a` repeated + --> F602.py:44:12 | 42 | } 43 | @@ -227,8 +244,9 @@ error[F602]: F602.py:44:12: [*] Dictionary key `a` repeated 44 |+x = {a: 1} 45 45 | x = {a: 1, b: 2, a: 1} -error[F602]: F602.py:45:18: [*] Dictionary key `a` repeated +error[F602]: 45:18: [*] Dictionary key `a` repeated + --> F602.py:45:18 | 44 | x = {a: 1, a: 1} 45 | x = {a: 1, b: 2, a: 1} diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F622_F622.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F622_F622.py.snap index 5c8741711e..3ae70ac7da 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F622_F622.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F622_F622.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F622]: F622.py:1:1: Two starred expressions in assignment +error[F622]: 1:1: Two starred expressions in assignment + --> F622.py:1:1 | 1 | *a, *b, c = (1, 2, 3) | ^^^^^^^^^ diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F631_F631.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F631_F631.py.snap index fa4b23d9cf..1a910939ac 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F631_F631.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F631_F631.py.snap @@ -1,16 +1,18 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F631]: F631.py:1:1: Assert test is a non-empty tuple, which is always `True` +error[F631]: 1:1: Assert test is a non-empty tuple, which is always `True` + --> F631.py:1:1 | 1 | assert (False, "x") | ^^^^^^^^^^^^^^^^^^^ 2 | assert (False,) 3 | assert () | -error[F631]: F631.py:2:1: Assert test is a non-empty tuple, which is always `True` +error[F631]: 2:1: Assert test is a non-empty tuple, which is always `True` + --> F631.py:1:20 | 1 | assert (False, "x") 2 | assert (False,) diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F632_F632.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F632_F632.py.snap index a20f5d5c45..8d1b345e39 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F632_F632.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F632_F632.py.snap @@ -1,14 +1,15 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -F632.py:1:4: F632 [*] Use `==` to compare constant literals +error[F632]: 1:4: [*] Use `==` to compare constant literals + + --> F632.py:1:4 | 1 | if x is "abc": - | ^^^^^^^^^^ F632 + | ^^^^^^^^^^ 2 | pass | = help: Replace `is` with `==` - ℹ Safe fix 1 |-if x is "abc": 1 |+if x == "abc": @@ -16,16 +17,17 @@ F632.py:1:4: F632 [*] Use `==` to compare constant literals 3 3 | 4 4 | if 123 is not y: -F632.py:4:4: F632 [*] Use `!=` to compare constant literals +error[F632]: 4:4: [*] Use `!=` to compare constant literals + + --> F632.py:4:4 | 2 | pass 3 | 4 | if 123 is not y: - | ^^^^^^^^^^^^ F632 + | ^^^^^^^^^^^^ 5 | pass | = help: Replace `is not` with `!=` - ℹ Safe fix 1 1 | if x is "abc": 2 2 | pass @@ -36,18 +38,19 @@ F632.py:4:4: F632 [*] Use `!=` to compare constant literals 6 6 | 7 7 | if 123 is \ -F632.py:7:4: F632 [*] Use `!=` to compare constant literals +error[F632]: 7:4: [*] Use `!=` to compare constant literals + + --> F632.py:7:4 | 5 | pass 6 | 7 | if 123 is \ | ____^ 8 | | not y: - | |_____________^ F632 + | |_____________^ 9 | pass | = help: Replace `is not` with `!=` - ℹ Safe fix 4 4 | if 123 is not y: 5 5 | pass @@ -59,16 +62,17 @@ F632.py:7:4: F632 [*] Use `!=` to compare constant literals 10 9 | 11 10 | if "123" is x < 3: -F632.py:11:4: F632 [*] Use `==` to compare constant literals +error[F632]: 11:4: [*] Use `==` to compare constant literals + + --> F632.py:11:4 | 9 | pass 10 | 11 | if "123" is x < 3: - | ^^^^^^^^^^^^^^ F632 + | ^^^^^^^^^^^^^^ 12 | pass | = help: Replace `is` with `==` - ℹ Safe fix 8 8 | not y: 9 9 | pass @@ -79,16 +83,17 @@ F632.py:11:4: F632 [*] Use `==` to compare constant literals 13 13 | 14 14 | if "123" != x is 3: -F632.py:14:4: F632 [*] Use `==` to compare constant literals +error[F632]: 14:4: [*] Use `==` to compare constant literals + + --> F632.py:14:4 | 12 | pass 13 | 14 | if "123" != x is 3: - | ^^^^^^^^^^^^^^^ F632 + | ^^^^^^^^^^^^^^^ 15 | pass | = help: Replace `is` with `==` - ℹ Safe fix 11 11 | if "123" is x < 3: 12 12 | pass @@ -99,16 +104,17 @@ F632.py:14:4: F632 [*] Use `==` to compare constant literals 16 16 | 17 17 | if ("123" != x) is 3: -F632.py:17:4: F632 [*] Use `==` to compare constant literals +error[F632]: 17:4: [*] Use `==` to compare constant literals + + --> F632.py:17:4 | 15 | pass 16 | 17 | if ("123" != x) is 3: - | ^^^^^^^^^^^^^^^^^ F632 + | ^^^^^^^^^^^^^^^^^ 18 | pass | = help: Replace `is` with `==` - ℹ Safe fix 14 14 | if "123" != x is 3: 15 15 | pass @@ -119,16 +125,17 @@ F632.py:17:4: F632 [*] Use `==` to compare constant literals 19 19 | 20 20 | if "123" != (x is 3): -F632.py:20:14: F632 [*] Use `==` to compare constant literals +error[F632]: 20:14: [*] Use `==` to compare constant literals + + --> F632.py:20:14 | 18 | pass 19 | 20 | if "123" != (x is 3): - | ^^^^^^ F632 + | ^^^^^^ 21 | pass | = help: Replace `is` with `==` - ℹ Safe fix 17 17 | if ("123" != x) is 3: 18 18 | pass @@ -139,19 +146,20 @@ F632.py:20:14: F632 [*] Use `==` to compare constant literals 22 22 | 23 23 | {2 is -F632.py:23:2: F632 [*] Use `!=` to compare constant literals +error[F632]: 23:2: [*] Use `!=` to compare constant literals + + --> F632.py:23:2 | 21 | pass 22 | 23 | {2 is | __^ 24 | | not ''} - | |______^ F632 + | |______^ 25 | 26 | {2 is | = help: Replace `is not` with `!=` - ℹ Safe fix 20 20 | if "123" != (x is 3): 21 21 | pass @@ -163,19 +171,20 @@ F632.py:23:2: F632 [*] Use `!=` to compare constant literals 26 25 | {2 is 27 26 | not ''} -F632.py:26:2: F632 [*] Use `!=` to compare constant literals +error[F632]: 26:2: [*] Use `!=` to compare constant literals + + --> F632.py:26:2 | 24 | not ''} 25 | 26 | {2 is | __^ 27 | | not ''} - | |_______^ F632 + | |_______^ 28 | 29 | # Regression test for | = help: Replace `is not` with `!=` - ℹ Safe fix 23 23 | {2 is 24 24 | not ''} @@ -187,15 +196,16 @@ F632.py:26:2: F632 [*] Use `!=` to compare constant literals 29 28 | # Regression test for 30 29 | if values[1is not None ] is not '-': -F632.py:30:4: F632 [*] Use `!=` to compare constant literals +error[F632]: 30:4: [*] Use `!=` to compare constant literals + + --> F632.py:30:4 | 29 | # Regression test for 30 | if values[1is not None ] is not '-': - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ F632 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 31 | pass | = help: Replace `is not` with `!=` - ℹ Safe fix 27 27 | not ''} 28 28 | @@ -206,15 +216,16 @@ F632.py:30:4: F632 [*] Use `!=` to compare constant literals 32 32 | 33 33 | # Regression test for https://github.com/astral-sh/ruff/issues/11736 -F632.py:30:11: F632 [*] Use `!=` to compare constant literals +error[F632]: 30:11: [*] Use `!=` to compare constant literals + + --> F632.py:30:11 | 29 | # Regression test for 30 | if values[1is not None ] is not '-': - | ^^^^^^^^^^^^ F632 + | ^^^^^^^^^^^^ 31 | pass | = help: Replace `is not` with `!=` - ℹ Safe fix 27 27 | not ''} 28 28 | @@ -225,14 +236,15 @@ F632.py:30:11: F632 [*] Use `!=` to compare constant literals 32 32 | 33 33 | # Regression test for https://github.com/astral-sh/ruff/issues/11736 -F632.py:34:12: F632 [*] Use `!=` to compare constant literals +error[F632]: 34:12: [*] Use `!=` to compare constant literals + + --> F632.py:34:12 | 33 | # Regression test for https://github.com/astral-sh/ruff/issues/11736 34 | variable: "123 is not y" - | ^^^^^^^^^^^^ F632 + | ^^^^^^^^^^^^ | = help: Replace `is not` with `!=` - ℹ Safe fix 31 31 | pass 32 32 | diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F633_F633.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F633_F633.py.snap index c9de8074f4..3ec83c9bab 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F633_F633.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F633_F633.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F633]: F633.py:4:1: Use of `>>` is invalid with `print` function +error[F633]: 4:1: Use of `>>` is invalid with `print` function + --> F633.py:3:1 | 2 | import sys 3 | diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F634_F634.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F634_F634.py.snap index 0972f73b9b..ba46c37f20 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F634_F634.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F634_F634.py.snap @@ -1,15 +1,17 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F634]: F634.py:1:4: If test is a tuple, which is always `True` +error[F634]: 1:4: If test is a tuple, which is always `True` + --> F634.py:1:4 | 1 | if (1, 2): | ^^^^^^ 2 | pass | -error[F634]: F634.py:4:4: If test is a tuple, which is always `True` +error[F634]: 4:4: If test is a tuple, which is always `True` + --> F634.py:4:4 | 2 | pass 3 | @@ -18,8 +20,9 @@ error[F634]: F634.py:4:4: If test is a tuple, which is always `True` 5 | pass 6 | elif foo: | -error[F634]: F634.py:12:10: If test is a tuple, which is always `True` +error[F634]: 12:10: If test is a tuple, which is always `True` + --> F634.py:12:10 | 10 | if True: 11 | pass diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F701_F701.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F701_F701.py.snap index b282006834..ed4832210e 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F701_F701.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F701_F701.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F701]: F701.py:4:5: `break` outside loop +error[F701]: 4:5: `break` outside loop + --> F701.py:4:5 | 2 | break 3 | else: @@ -11,23 +12,26 @@ error[F701]: F701.py:4:5: `break` outside loop 5 | 6 | i = 0 | -error[F701]: F701.py:16:5: `break` outside loop +error[F701]: 16:5: `break` outside loop + --> F701.py:16:5 | 14 | break 15 | 16 | break | ^^^^^ | -error[F701]: F701.py:20:5: `break` outside loop +error[F701]: 20:5: `break` outside loop + --> F701.py:20:5 | 19 | class Foo: 20 | break | ^^^^^ | -error[F701]: F701.py:23:1: `break` outside loop +error[F701]: 23:1: `break` outside loop + --> F701.py:23:1 | 23 | break | ^^^^^ diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F702_F702.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F702_F702.py.snap index b5ce203253..2ec0e7e110 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F702_F702.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F702_F702.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F702]: F702.py:4:5: `continue` not properly in loop +error[F702]: 4:5: `continue` not properly in loop + --> F702.py:4:5 | 2 | continue 3 | else: @@ -11,23 +12,26 @@ error[F702]: F702.py:4:5: `continue` not properly in loop 5 | 6 | i = 0 | -error[F702]: F702.py:16:5: `continue` not properly in loop +error[F702]: 16:5: `continue` not properly in loop + --> F702.py:16:5 | 14 | continue 15 | 16 | continue | ^^^^^^^^ | -error[F702]: F702.py:20:5: `continue` not properly in loop +error[F702]: 20:5: `continue` not properly in loop + --> F702.py:20:5 | 19 | class Foo: 20 | continue | ^^^^^^^^ | -error[F702]: F702.py:23:1: `continue` not properly in loop +error[F702]: 23:1: `continue` not properly in loop + --> F702.py:23:1 | 23 | continue | ^^^^^^^^ diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F704_F704.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F704_F704.py.snap index 319b095a63..3193353a24 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F704_F704.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F704_F704.py.snap @@ -1,31 +1,35 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F704]: F704.py:6:5: `yield` statement outside of a function +error[F704]: 6:5: `yield` statement outside of a function + --> F704.py:6:5 | 5 | class Foo: 6 | yield 2 | ^^^^^^^ | -error[F704]: F704.py:9:1: `yield` statement outside of a function +error[F704]: 9:1: `yield` statement outside of a function + --> F704.py:9:1 | 9 | yield 3 | ^^^^^^^ 10 | yield from 3 11 | await f() | -error[F704]: F704.py:10:1: `yield from` statement outside of a function +error[F704]: 10:1: `yield from` statement outside of a function + --> F704.py:9:8 | 9 | yield 3 10 | yield from 3 | ^^^^^^^^^^^^ 11 | await f() | -error[F704]: F704.py:11:1: `await` statement outside of a function +error[F704]: 11:1: `await` statement outside of a function + --> F704.py:10:13 | 9 | yield 3 10 | yield from 3 diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F706_F706.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F706_F706.py.snap index 3bee80cbc9..11d7fcea1c 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F706_F706.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F706_F706.py.snap @@ -1,15 +1,17 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F706]: F706.py:6:5: `return` statement outside of a function/method +error[F706]: 6:5: `return` statement outside of a function/method + --> F706.py:6:5 | 5 | class Foo: 6 | return 2 | ^^^^^^^^ | -error[F706]: F706.py:9:1: `return` statement outside of a function/method +error[F706]: 9:1: `return` statement outside of a function/method + --> F706.py:9:1 | 9 | return 3 | ^^^^^^^^ diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F707_F707.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F707_F707.py.snap index b8d629abe2..79c0226ae0 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F707_F707.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F707_F707.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F707]: F707.py:3:1: An `except` block as not the last exception handler +error[F707]: 3:1: An `except` block as not the last exception handler + --> F707.py:2:9 | 1 | try: 2 | pass @@ -11,8 +12,9 @@ error[F707]: F707.py:3:1: An `except` block as not the last exception handler 4 | pass 5 | except ValueError: | -error[F707]: F707.py:10:1: An `except` block as not the last exception handler +error[F707]: 10:1: An `except` block as not the last exception handler + --> F707.py:9:9 | 8 | try: 9 | pass @@ -21,8 +23,9 @@ error[F707]: F707.py:10:1: An `except` block as not the last exception handler 11 | pass 12 | except ValueError: | -error[F707]: F707.py:19:1: An `except` block as not the last exception handler +error[F707]: 19:1: An `except` block as not the last exception handler + --> F707.py:18:9 | 17 | try: 18 | pass diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F722_F722.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F722_F722.py.snap index caa6da5d1e..b9fc38afd6 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F722_F722.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F722_F722.py.snap @@ -1,15 +1,17 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F722]: F722.py:9:12: Syntax error in forward annotation: `///` +error[F722]: 9:12: Syntax error in forward annotation: `///` + --> F722.py:9:12 | 9 | def g() -> "///": | ^^^^^ 10 | pass | -error[F722]: F722.py:13:4: Syntax error in forward annotation: `List[int]☃` +error[F722]: 13:4: Syntax error in forward annotation: `List[int]☃` + --> F722.py:13:4 | 13 | X: """List[int]"""'☃' = [] | ^^^^^^^^^^^^^^^^^^ diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_0.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_0.py.snap index 41adf43047..23f242d061 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_0.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_0.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F811]: F811_0.py:10:5: Redefinition of unused `bar` from line 6 +error[F811]: 10:5: Redefinition of unused `bar` from line 6 + --> F811_0.py:10:5 | 10 | def bar(): | ^^^ diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_1.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_1.py.snap index 6acdd53ecc..1324c25769 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_1.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_1.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F811]: F811_1.py:1:25: Redefinition of unused `FU` from line 1 +error[F811]: 1:25: Redefinition of unused `FU` from line 1 + --> F811_1.py:1:25 | 1 | import fu as FU, bar as FU | ^^ diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_12.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_12.py.snap index 3120f384e4..80fcc85852 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_12.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_12.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F811]: F811_12.py:6:20: Redefinition of unused `mixer` from line 2 +error[F811]: 6:20: Redefinition of unused `mixer` from line 2 + --> F811_12.py:6:20 | 4 | pass 5 | else: diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_15.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_15.py.snap index 3a2d58aaa8..54be349ea2 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_15.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_15.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F811]: F811_15.py:4:5: Redefinition of unused `fu` from line 1 +error[F811]: 4:5: Redefinition of unused `fu` from line 1 + --> F811_15.py:4:5 | 4 | def fu(): | ^^ diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_16.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_16.py.snap index 488432d325..c7178440fe 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_16.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_16.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F811]: F811_16.py:8:13: Redefinition of unused `fu` from line 3 +error[F811]: 8:13: Redefinition of unused `fu` from line 3 + --> F811_16.py:8:13 | 6 | def bar(): 7 | def baz(): diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_17.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_17.py.snap index 58b467fba8..fc583a18ae 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_17.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_17.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F811]: F811_17.py:6:12: [*] Redefinition of unused `fu` from line 2 +error[F811]: 6:12: [*] Redefinition of unused `fu` from line 2 + --> F811_17.py:6:12 | 5 | def bar(): 6 | import fu @@ -20,8 +21,9 @@ error[F811]: F811_17.py:6:12: [*] Redefinition of unused `fu` from line 2 8 7 | def baz(): 9 8 | def fu(): -error[F811]: F811_17.py:9:13: Redefinition of unused `fu` from line 6 +error[F811]: 9:13: Redefinition of unused `fu` from line 6 + --> F811_17.py:9:13 | 8 | def baz(): 9 | def fu(): diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_2.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_2.py.snap index 592bdbb4b7..836816c283 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_2.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_2.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F811]: F811_2.py:1:34: Redefinition of unused `FU` from line 1 +error[F811]: 1:34: Redefinition of unused `FU` from line 1 + --> F811_2.py:1:34 | 1 | from moo import fu as FU, bar as FU | ^^ diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_21.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_21.py.snap index 9cbe588853..7770a9695a 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_21.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_21.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F811]: F811_21.py:32:5: [*] Redefinition of unused `Sequence` from line 26 +error[F811]: 32:5: [*] Redefinition of unused `Sequence` from line 26 + --> F811_21.py:32:5 | 30 | from typing import ( 31 | List, # noqa: F811 diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_23.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_23.py.snap index 3a57c2c223..b500780792 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_23.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_23.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F811]: F811_23.py:4:15: Redefinition of unused `foo` from line 3 +error[F811]: 4:15: Redefinition of unused `foo` from line 3 + --> F811_23.py:4:15 | 3 | import foo as foo 4 | import bar as foo diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_26.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_26.py.snap index 7c8a75a75f..9e45fe67b5 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_26.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_26.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F811]: F811_26.py:5:9: Redefinition of unused `func` from line 2 +error[F811]: 5:9: Redefinition of unused `func` from line 2 + --> F811_26.py:5:9 | 3 | pass 4 | diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_28.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_28.py.snap index 55d50fb6d8..d8ec023e51 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_28.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_28.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F811]: F811_28.py:4:22: Redefinition of unused `datetime` from line 3 +error[F811]: 4:22: Redefinition of unused `datetime` from line 3 + --> F811_28.py:4:22 | 3 | import datetime 4 | from datetime import datetime diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_29.pyi.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_29.pyi.snap index 5bc66605cc..3ceabdb1b7 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_29.pyi.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_29.pyi.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F811]: F811_29.pyi:8:1: Redefinition of unused `Bar` from line 3 +error[F811]: 8:1: Redefinition of unused `Bar` from line 3 + --> F811_29.pyi:7:1 | 6 | Bar: int # OK 7 | diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_3.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_3.py.snap index 24a88c5ed1..a00261e73b 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_3.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_3.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F811]: F811_3.py:1:12: Redefinition of unused `fu` from line 1 +error[F811]: 1:12: Redefinition of unused `fu` from line 1 + --> F811_3.py:1:12 | 1 | import fu; fu = 3 | ^^ diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_30.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_30.py.snap index e785583128..ab45419941 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_30.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_30.py.snap @@ -1,30 +1,34 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -F811_30.py:12:9: F811 Redefinition of unused `bar` from line 10 +error[F811]: 12:9: Redefinition of unused `bar` from line 10 + + --> F811_30.py:12:9 | 10 | bar = foo 11 | 12 | def bar(self) -> None: - | ^^^ F811 + | ^^^ 13 | """Bar.""" | = help: Remove definition: `bar` +error[F811]: 21:5: Redefinition of unused `baz` from line 18 -F811_30.py:21:5: F811 Redefinition of unused `baz` from line 18 + --> F811_30.py:21:5 | 19 | """Baz.""" 20 | 21 | baz = 1 - | ^^^ F811 + | ^^^ | = help: Remove definition: `baz` +error[F811]: 29:12: Redefinition of unused `foo` from line 26 -F811_30.py:29:12: F811 Redefinition of unused `foo` from line 26 + --> F811_30.py:29:12 | 27 | """Foo.""" 28 | 29 | bar = (foo := 1) - | ^^^ F811 + | ^^^ | = help: Remove definition: `foo` diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_31.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_31.py.snap index 75de2fbbce..43c12458cc 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_31.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_31.py.snap @@ -1,12 +1,14 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -F811_31.py:19:29: F811 Redefinition of unused `baz` from line 17 +error[F811]: 19:29: Redefinition of unused `baz` from line 17 + + --> F811_31.py:19:29 | 17 | baz = None 18 | 19 | from some_module import baz - | ^^^ F811 + | ^^^ 20 | except ImportError: 21 | pass | diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_4.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_4.py.snap index bd3e62283c..b5aae04485 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_4.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_4.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F811]: F811_4.py:1:12: Redefinition of unused `fu` from line 1 +error[F811]: 1:12: Redefinition of unused `fu` from line 1 + --> F811_4.py:1:12 | 1 | import fu; fu, bar = 3 | ^^ diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_5.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_5.py.snap index 24b5e96124..ecd0bf04bd 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_5.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_5.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F811]: F811_5.py:1:13: Redefinition of unused `fu` from line 1 +error[F811]: 1:13: Redefinition of unused `fu` from line 1 + --> F811_5.py:1:13 | 1 | import fu; [fu, bar] = 3 | ^^ diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_6.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_6.py.snap index a918023a6c..903dfca8b9 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_6.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_6.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F811]: F811_6.py:6:12: [*] Redefinition of unused `os` from line 5 +error[F811]: 6:12: [*] Redefinition of unused `os` from line 5 + --> F811_6.py:6:12 | 4 | if i == 1: 5 | import os diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_8.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_8.py.snap index 04126aae0b..3dac7009a7 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_8.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_8.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F811]: F811_8.py:5:12: [*] Redefinition of unused `os` from line 4 +error[F811]: 5:12: [*] Redefinition of unused `os` from line 4 + --> F811_8.py:5:12 | 3 | try: 4 | import os diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_0.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_0.py.snap index d8eb98afff..b3f235ad19 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_0.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_0.py.snap @@ -1,36 +1,41 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F821]: F821_0.py:2:12: Undefined name `self` +error[F821]: 2:12: Undefined name `self` + --> F821_0.py:2:12 | 1 | def get_name(): 2 | return self.name | ^^^^ | -error[F821]: F821_0.py:6:13: Undefined name `self` +error[F821]: 6:13: Undefined name `self` + --> F821_0.py:6:13 | 5 | def get_name(): 6 | return (self.name,) | ^^^^ | -error[F821]: F821_0.py:10:9: Undefined name `self` +error[F821]: 10:9: Undefined name `self` + --> F821_0.py:10:9 | 9 | def get_name(): 10 | del self.name | ^^^^ | -error[F821]: F821_0.py:21:12: Undefined name `numeric_string` +error[F821]: 21:12: Undefined name `numeric_string` + --> F821_0.py:21:12 | 20 | def randdec(maxprec, maxexp): 21 | return numeric_string(maxprec, maxexp) | ^^^^^^^^^^^^^^ | -error[F821]: F821_0.py:58:5: Undefined name `Bar` +error[F821]: 58:5: Undefined name `Bar` + --> F821_0.py:58:5 | 56 | y: int = 1 57 | @@ -39,24 +44,27 @@ error[F821]: F821_0.py:58:5: Undefined name `Bar` 59 | 60 | [first] = ["yup"] | -error[F821]: F821_0.py:83:11: Undefined name `TOMATO` +error[F821]: 83:11: Undefined name `TOMATO` + --> F821_0.py:83:11 | 82 | def update_tomato(): 83 | print(TOMATO) | ^^^^^^ 84 | TOMATO = "cherry tomato" | -error[F821]: F821_0.py:87:8: Undefined name `B` +error[F821]: 87:8: Undefined name `B` + --> F821_0.py:87:8 | 87 | A = f'{B}' | ^ 88 | A = ( 89 | f'B' | -error[F821]: F821_0.py:90:8: Undefined name `B` +error[F821]: 90:8: Undefined name `B` + --> F821_0.py:90:8 | 88 | A = ( 89 | f'B' @@ -65,8 +73,9 @@ error[F821]: F821_0.py:90:8: Undefined name `B` 91 | ) 92 | C = f'{A:{B}}' | -error[F821]: F821_0.py:92:11: Undefined name `B` +error[F821]: 92:11: Undefined name `B` + --> F821_0.py:92:11 | 90 | f'{B}' 91 | ) @@ -74,8 +83,9 @@ error[F821]: F821_0.py:92:11: Undefined name `B` | ^ 93 | C = f'{A:{f"{B}"}}' | -error[F821]: F821_0.py:93:14: Undefined name `B` +error[F821]: 93:14: Undefined name `B` + --> F821_0.py:93:14 | 91 | ) 92 | C = f'{A:{B}}' @@ -84,8 +94,9 @@ error[F821]: F821_0.py:93:14: Undefined name `B` 94 | 95 | from typing import Annotated, Literal | -error[F821]: F821_0.py:115:10: Undefined name `PEP593Test123` +error[F821]: 115:10: Undefined name `PEP593Test123` + --> F821_0.py:115:10 | 113 | ] 114 | field_with_undefined_stringified_type: Annotated[ @@ -94,8 +105,9 @@ error[F821]: F821_0.py:115:10: Undefined name `PEP593Test123` 116 | 123, 117 | ] | -error[F821]: F821_0.py:123:15: Undefined name `foo` +error[F821]: 123:15: Undefined name `foo` + --> F821_0.py:123:15 | 121 | ] 122 | field_with_undefined_nested_subscript: Annotated[ @@ -104,8 +116,9 @@ error[F821]: F821_0.py:123:15: Undefined name `foo` 124 | 123, 125 | ] | -error[F821]: F821_0.py:123:22: Undefined name `bar` +error[F821]: 123:22: Undefined name `bar` + --> F821_0.py:123:22 | 121 | ] 122 | field_with_undefined_nested_subscript: Annotated[ diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_1.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_1.py.snap index d323928409..6ff0d9dafe 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_1.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_1.py.snap @@ -1,29 +1,33 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F821]: F821_1.py:11:11: Undefined name `Model` +error[F821]: 11:11: Undefined name `Model` + --> F821_1.py:11:11 | 10 | # F821 Undefined name `Model` 11 | x = cast("Model", x) | ^^^^^ | -error[F821]: F821_1.py:18:18: Undefined name `Model` +error[F821]: 18:18: Undefined name `Model` + --> F821_1.py:18:18 | 17 | # F821 Undefined name `Model` 18 | x = typing.cast("Model", x) | ^^^^^ | -error[F821]: F821_1.py:24:14: Undefined name `Model` +error[F821]: 24:14: Undefined name `Model` + --> F821_1.py:24:14 | 23 | # F821 Undefined name `Model` 24 | x = Pattern["Model"] | ^^^^^ | -error[F821]: F821_1.py:30:12: Undefined name `Model` +error[F821]: 30:12: Undefined name `Model` + --> F821_1.py:30:12 | 29 | # F821 Undefined name `Model` 30 | x = Match["Model"] diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_11.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_11.py.snap index 8c5e52fde8..94448ec930 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_11.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_11.py.snap @@ -1,15 +1,17 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F821]: F821_11.py:18:28: Undefined name `os` +error[F821]: 18:28: Undefined name `os` + --> F821_11.py:18:28 | 18 | def f(x: Callable[[VarArg("os")], None]): # F821 | ^^ 19 | pass | -error[F821]: F821_11.py:23:14: Undefined name `Baz` +error[F821]: 23:14: Undefined name `Baz` + --> F821_11.py:23:14 | 22 | f(Callable[["Bar"], None]) 23 | f(Callable[["Baz"], None]) diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_11.pyi.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_11.pyi.snap index b2ba727469..6ada33ae39 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_11.pyi.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_11.pyi.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F821]: F821_11.pyi:15:28: Undefined name `os` +error[F821]: 15:28: Undefined name `os` + --> F821_11.pyi:15:28 | 15 | def f(x: Callable[[VarArg("os")], None]): # F821 | ^^ diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_12.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_12.py.snap index 3be355addb..0596b893ba 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_12.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_12.py.snap @@ -1,15 +1,17 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F821]: F821_12.py:20:28: Undefined name `os` +error[F821]: 20:28: Undefined name `os` + --> F821_12.py:20:28 | 20 | def f(x: Callable[[VarArg("os")], None]): # F821 | ^^ 21 | pass | -error[F821]: F821_12.py:25:14: Undefined name `Baz` +error[F821]: 25:14: Undefined name `Baz` + --> F821_12.py:25:14 | 24 | f(Callable[["Bar"], None]) 25 | f(Callable[["Baz"], None]) diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_13.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_13.py.snap index 00a9196702..afb53e92d9 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_13.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_13.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F821]: F821_13.py:8:19: Undefined name `List` +error[F821]: 8:19: Undefined name `List` + --> F821_13.py:8:19 | 6 | Y: ForwardRef("List[int]") 7 | diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_17.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_17.py.snap index 4b5985533d..1d59acd4cc 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_17.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_17.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F821]: F821_17.py:16:12: Undefined name `DoesNotExist` +error[F821]: 16:12: Undefined name `DoesNotExist` + --> F821_17.py:16:12 | 14 | # Types used in aliased assignment must exist 15 | @@ -10,8 +11,9 @@ error[F821]: F821_17.py:16:12: Undefined name `DoesNotExist` | ^^^^^^^^^^^^ 17 | type Foo = list[DoesNotExist] # F821: Undefined name `DoesNotExist` | -error[F821]: F821_17.py:17:17: Undefined name `DoesNotExist` +error[F821]: 17:17: Undefined name `DoesNotExist` + --> F821_17.py:17:17 | 16 | type Foo = DoesNotExist # F821: Undefined name `DoesNotExist` 17 | type Foo = list[DoesNotExist] # F821: Undefined name `DoesNotExist` @@ -19,8 +21,9 @@ error[F821]: F821_17.py:17:17: Undefined name `DoesNotExist` 18 | 19 | # Type parameters do not escape alias scopes | -error[F821]: F821_17.py:22:1: Undefined name `T` +error[F821]: 22:1: Undefined name `T` + --> F821_17.py:21:16 | 21 | type Foo[T] = T 22 | T # F821: Undefined name `T` - not accessible afterward alias scope @@ -28,8 +31,9 @@ error[F821]: F821_17.py:22:1: Undefined name `T` 23 | 24 | # Type parameters in functions | -error[F821]: F821_17.py:39:17: Undefined name `T` +error[F821]: 39:17: Undefined name `T` + --> F821_17.py:39:17 | 37 | from some_library import some_decorator 38 | @@ -38,15 +42,17 @@ error[F821]: F821_17.py:39:17: Undefined name `T` 40 | 41 | def foo[T](t: T) -> None: ... | -error[F821]: F821_17.py:42:1: Undefined name `T` +error[F821]: 42:1: Undefined name `T` + --> F821_17.py:41:30 | 41 | def foo[T](t: T) -> None: ... 42 | T # F821: Undefined name `T` - not accessible afterward function scope | ^ | -error[F821]: F821_17.py:64:17: Undefined name `T` +error[F821]: 64:17: Undefined name `T` + --> F821_17.py:64:17 | 63 | from some_library import some_decorator 64 | @some_decorator(T) # F821: Undefined name `T` - not accessible in decorators @@ -54,8 +60,9 @@ error[F821]: F821_17.py:64:17: Undefined name `T` 65 | 66 | class Foo[T](list[T]): ... | -error[F821]: F821_17.py:67:1: Undefined name `T` +error[F821]: 67:1: Undefined name `T` + --> F821_17.py:66:27 | 66 | class Foo[T](list[T]): ... 67 | T # F821: Undefined name `T` - not accessible after class scope @@ -63,8 +70,9 @@ error[F821]: F821_17.py:67:1: Undefined name `T` 68 | 69 | # Types specified in bounds should exist | -error[F821]: F821_17.py:71:13: Undefined name `DoesNotExist` +error[F821]: 71:13: Undefined name `DoesNotExist` + --> F821_17.py:71:13 | 69 | # Types specified in bounds should exist 70 | @@ -73,16 +81,18 @@ error[F821]: F821_17.py:71:13: Undefined name `DoesNotExist` 72 | def foo[T: DoesNotExist](t: T) -> T: return t # F821: Undefined name `DoesNotExist` 73 | class Foo[T: DoesNotExist](list[T]): ... # F821: Undefined name `DoesNotExist` | -error[F821]: F821_17.py:72:12: Undefined name `DoesNotExist` +error[F821]: 72:12: Undefined name `DoesNotExist` + --> F821_17.py:72:12 | 71 | type Foo[T: DoesNotExist] = T # F821: Undefined name `DoesNotExist` 72 | def foo[T: DoesNotExist](t: T) -> T: return t # F821: Undefined name `DoesNotExist` | ^^^^^^^^^^^^ 73 | class Foo[T: DoesNotExist](list[T]): ... # F821: Undefined name `DoesNotExist` | -error[F821]: F821_17.py:73:14: Undefined name `DoesNotExist` +error[F821]: 73:14: Undefined name `DoesNotExist` + --> F821_17.py:73:14 | 71 | type Foo[T: DoesNotExist] = T # F821: Undefined name `DoesNotExist` 72 | def foo[T: DoesNotExist](t: T) -> T: return t # F821: Undefined name `DoesNotExist` @@ -91,8 +101,9 @@ error[F821]: F821_17.py:73:14: Undefined name `DoesNotExist` 74 | 75 | type Foo[T: (DoesNotExist1, DoesNotExist2)] = T # F821: Undefined name `DoesNotExist1`, Undefined name `DoesNotExist2` | -error[F821]: F821_17.py:75:14: Undefined name `DoesNotExist1` +error[F821]: 75:14: Undefined name `DoesNotExist1` + --> F821_17.py:75:14 | 73 | class Foo[T: DoesNotExist](list[T]): ... # F821: Undefined name `DoesNotExist` 74 | @@ -101,8 +112,9 @@ error[F821]: F821_17.py:75:14: Undefined name `DoesNotExist1` 76 | def foo[T: (DoesNotExist1, DoesNotExist2)](t: T) -> T: return t # F821: Undefined name `DoesNotExist1`, Undefined name `DoesNotExist2` 77 | class Foo[T: (DoesNotExist1, DoesNotExist2)](list[T]): ... # F821: Undefined name `DoesNotExist1`, Undefined name `DoesNotExist2` | -error[F821]: F821_17.py:75:29: Undefined name `DoesNotExist2` +error[F821]: 75:29: Undefined name `DoesNotExist2` + --> F821_17.py:75:29 | 73 | class Foo[T: DoesNotExist](list[T]): ... # F821: Undefined name `DoesNotExist` 74 | @@ -111,24 +123,27 @@ error[F821]: F821_17.py:75:29: Undefined name `DoesNotExist2` 76 | def foo[T: (DoesNotExist1, DoesNotExist2)](t: T) -> T: return t # F821: Undefined name `DoesNotExist1`, Undefined name `DoesNotExist2` 77 | class Foo[T: (DoesNotExist1, DoesNotExist2)](list[T]): ... # F821: Undefined name `DoesNotExist1`, Undefined name `DoesNotExist2` | -error[F821]: F821_17.py:76:13: Undefined name `DoesNotExist1` +error[F821]: 76:13: Undefined name `DoesNotExist1` + --> F821_17.py:76:13 | 75 | type Foo[T: (DoesNotExist1, DoesNotExist2)] = T # F821: Undefined name `DoesNotExist1`, Undefined name `DoesNotExist2` 76 | def foo[T: (DoesNotExist1, DoesNotExist2)](t: T) -> T: return t # F821: Undefined name `DoesNotExist1`, Undefined name `DoesNotExist2` | ^^^^^^^^^^^^^ 77 | class Foo[T: (DoesNotExist1, DoesNotExist2)](list[T]): ... # F821: Undefined name `DoesNotExist1`, Undefined name `DoesNotExist2` | -error[F821]: F821_17.py:76:28: Undefined name `DoesNotExist2` +error[F821]: 76:28: Undefined name `DoesNotExist2` + --> F821_17.py:76:28 | 75 | type Foo[T: (DoesNotExist1, DoesNotExist2)] = T # F821: Undefined name `DoesNotExist1`, Undefined name `DoesNotExist2` 76 | def foo[T: (DoesNotExist1, DoesNotExist2)](t: T) -> T: return t # F821: Undefined name `DoesNotExist1`, Undefined name `DoesNotExist2` | ^^^^^^^^^^^^^ 77 | class Foo[T: (DoesNotExist1, DoesNotExist2)](list[T]): ... # F821: Undefined name `DoesNotExist1`, Undefined name `DoesNotExist2` | -error[F821]: F821_17.py:77:15: Undefined name `DoesNotExist1` +error[F821]: 77:15: Undefined name `DoesNotExist1` + --> F821_17.py:77:15 | 75 | type Foo[T: (DoesNotExist1, DoesNotExist2)] = T # F821: Undefined name `DoesNotExist1`, Undefined name `DoesNotExist2` 76 | def foo[T: (DoesNotExist1, DoesNotExist2)](t: T) -> T: return t # F821: Undefined name `DoesNotExist1`, Undefined name `DoesNotExist2` @@ -137,8 +152,9 @@ error[F821]: F821_17.py:77:15: Undefined name `DoesNotExist1` 78 | 79 | # Same in defaults | -error[F821]: F821_17.py:77:30: Undefined name `DoesNotExist2` +error[F821]: 77:30: Undefined name `DoesNotExist2` + --> F821_17.py:77:30 | 75 | type Foo[T: (DoesNotExist1, DoesNotExist2)] = T # F821: Undefined name `DoesNotExist1`, Undefined name `DoesNotExist2` 76 | def foo[T: (DoesNotExist1, DoesNotExist2)](t: T) -> T: return t # F821: Undefined name `DoesNotExist1`, Undefined name `DoesNotExist2` @@ -147,8 +163,9 @@ error[F821]: F821_17.py:77:30: Undefined name `DoesNotExist2` 78 | 79 | # Same in defaults | -error[F821]: F821_17.py:81:14: Undefined name `DoesNotExist` +error[F821]: 81:14: Undefined name `DoesNotExist` + --> F821_17.py:81:14 | 79 | # Same in defaults 80 | @@ -157,16 +174,18 @@ error[F821]: F821_17.py:81:14: Undefined name `DoesNotExist` 82 | def foo[T = DoesNotExist](t: T) -> T: return t # F821: Undefined name `DoesNotExist` 83 | class Foo[T = DoesNotExist](list[T]): ... # F821: Undefined name `DoesNotExist` | -error[F821]: F821_17.py:82:13: Undefined name `DoesNotExist` +error[F821]: 82:13: Undefined name `DoesNotExist` + --> F821_17.py:82:13 | 81 | type Foo[T = DoesNotExist] = T # F821: Undefined name `DoesNotExist` 82 | def foo[T = DoesNotExist](t: T) -> T: return t # F821: Undefined name `DoesNotExist` | ^^^^^^^^^^^^ 83 | class Foo[T = DoesNotExist](list[T]): ... # F821: Undefined name `DoesNotExist` | -error[F821]: F821_17.py:83:15: Undefined name `DoesNotExist` +error[F821]: 83:15: Undefined name `DoesNotExist` + --> F821_17.py:83:15 | 81 | type Foo[T = DoesNotExist] = T # F821: Undefined name `DoesNotExist` 82 | def foo[T = DoesNotExist](t: T) -> T: return t # F821: Undefined name `DoesNotExist` @@ -175,8 +194,9 @@ error[F821]: F821_17.py:83:15: Undefined name `DoesNotExist` 84 | 85 | type Foo[T = (DoesNotExist1, DoesNotExist2)] = T # F821: Undefined name `DoesNotExist1`, Undefined name `DoesNotExist2` | -error[F821]: F821_17.py:85:15: Undefined name `DoesNotExist1` +error[F821]: 85:15: Undefined name `DoesNotExist1` + --> F821_17.py:85:15 | 83 | class Foo[T = DoesNotExist](list[T]): ... # F821: Undefined name `DoesNotExist` 84 | @@ -185,8 +205,9 @@ error[F821]: F821_17.py:85:15: Undefined name `DoesNotExist1` 86 | def foo[T = (DoesNotExist1, DoesNotExist2)](t: T) -> T: return t # F821: Undefined name `DoesNotExist1`, Undefined name `DoesNotExi... 87 | class Foo[T = (DoesNotExist1, DoesNotExist2)](list[T]): ... # F821: Undefined name `DoesNotExist1`, Undefined name `DoesNotExist2` | -error[F821]: F821_17.py:85:30: Undefined name `DoesNotExist2` +error[F821]: 85:30: Undefined name `DoesNotExist2` + --> F821_17.py:85:30 | 83 | class Foo[T = DoesNotExist](list[T]): ... # F821: Undefined name `DoesNotExist` 84 | @@ -195,24 +216,27 @@ error[F821]: F821_17.py:85:30: Undefined name `DoesNotExist2` 86 | def foo[T = (DoesNotExist1, DoesNotExist2)](t: T) -> T: return t # F821: Undefined name `DoesNotExist1`, Undefined name `DoesNotExi... 87 | class Foo[T = (DoesNotExist1, DoesNotExist2)](list[T]): ... # F821: Undefined name `DoesNotExist1`, Undefined name `DoesNotExist2` | -error[F821]: F821_17.py:86:14: Undefined name `DoesNotExist1` +error[F821]: 86:14: Undefined name `DoesNotExist1` + --> F821_17.py:86:14 | 85 | type Foo[T = (DoesNotExist1, DoesNotExist2)] = T # F821: Undefined name `DoesNotExist1`, Undefined name `DoesNotExist2` 86 | def foo[T = (DoesNotExist1, DoesNotExist2)](t: T) -> T: return t # F821: Undefined name `DoesNotExist1`, Undefined name `DoesNotExi... | ^^^^^^^^^^^^^ 87 | class Foo[T = (DoesNotExist1, DoesNotExist2)](list[T]): ... # F821: Undefined name `DoesNotExist1`, Undefined name `DoesNotExist2` | -error[F821]: F821_17.py:86:29: Undefined name `DoesNotExist2` +error[F821]: 86:29: Undefined name `DoesNotExist2` + --> F821_17.py:86:29 | 85 | type Foo[T = (DoesNotExist1, DoesNotExist2)] = T # F821: Undefined name `DoesNotExist1`, Undefined name `DoesNotExist2` 86 | def foo[T = (DoesNotExist1, DoesNotExist2)](t: T) -> T: return t # F821: Undefined name `DoesNotExist1`, Undefined name `DoesNotExi... | ^^^^^^^^^^^^^ 87 | class Foo[T = (DoesNotExist1, DoesNotExist2)](list[T]): ... # F821: Undefined name `DoesNotExist1`, Undefined name `DoesNotExist2` | -error[F821]: F821_17.py:87:16: Undefined name `DoesNotExist1` +error[F821]: 87:16: Undefined name `DoesNotExist1` + --> F821_17.py:87:16 | 85 | type Foo[T = (DoesNotExist1, DoesNotExist2)] = T # F821: Undefined name `DoesNotExist1`, Undefined name `DoesNotExist2` 86 | def foo[T = (DoesNotExist1, DoesNotExist2)](t: T) -> T: return t # F821: Undefined name `DoesNotExist1`, Undefined name `DoesNotExi... @@ -221,8 +245,9 @@ error[F821]: F821_17.py:87:16: Undefined name `DoesNotExist1` 88 | 89 | # Type parameters in nested classes | -error[F821]: F821_17.py:87:31: Undefined name `DoesNotExist2` +error[F821]: 87:31: Undefined name `DoesNotExist2` + --> F821_17.py:87:31 | 85 | type Foo[T = (DoesNotExist1, DoesNotExist2)] = T # F821: Undefined name `DoesNotExist1`, Undefined name `DoesNotExist2` 86 | def foo[T = (DoesNotExist1, DoesNotExist2)](t: T) -> T: return t # F821: Undefined name `DoesNotExist1`, Undefined name `DoesNotExi... @@ -231,8 +256,9 @@ error[F821]: F821_17.py:87:31: Undefined name `DoesNotExist2` 88 | 89 | # Type parameters in nested classes | -error[F821]: F821_17.py:102:52: Undefined name `t` +error[F821]: 102:52: Undefined name `t` + --> F821_17.py:102:52 | 100 | return x 101 | @@ -241,8 +267,9 @@ error[F821]: F821_17.py:102:52: Undefined name `t` 103 | t # F821: Undefined name `t` 104 | return x | -error[F821]: F821_17.py:102:58: Undefined name `t` +error[F821]: 102:58: Undefined name `t` + --> F821_17.py:102:58 | 100 | return x 101 | @@ -251,18 +278,20 @@ error[F821]: F821_17.py:102:58: Undefined name `t` 103 | t # F821: Undefined name `t` 104 | return x | -error[F821]: F821_17.py:103:17: Undefined name `t` +error[F821]: 103:17: Undefined name `t` + --> F821_17.py:103:17 | 102 | def cannot_access_parent_variable(self, x: t) -> t: # F821: Undefined name `T` 103 | t # F821: Undefined name `t` | ^ 104 | return x | +error[F821]: 116:40: Undefined name `T` -F821_17.py:116:40: F821 Undefined name `T` + --> F821_17.py:116:40 | 116 | def cannot_access_in_default[T](t: T = T): # F821 - | ^ F821 + | ^ 117 | pass | diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_19.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_19.py.snap index 8bfe7d896e..591595a81d 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_19.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_19.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F821]: F821_19.py:21:7: Undefined name `y` +error[F821]: 21:7: Undefined name `y` + --> F821_19.py:21:7 | 19 | # Error: `y` is not defined. 20 | x: (y := 1) diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_2.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_2.py.snap index ecfdecfc19..bd7983ba99 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_2.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_2.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F821]: F821_2.py:5:13: Undefined name `Model` +error[F821]: 5:13: Undefined name `Model` + --> F821_2.py:5:13 | 4 | # F821 Undefined name `Model` 5 | x: Literal["Model"] diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_20.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_20.py.snap index fad24e3b22..ad3eab5f17 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_20.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_20.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F821]: F821_20.py:3:24: Undefined name `Record` +error[F821]: 3:24: Undefined name `Record` + --> F821_20.py:3:24 | 1 | """Test lazy evaluation of type alias values.""" 2 | diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_21.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_21.py.snap index d63bb2eba7..96a0fb76c0 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_21.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_21.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F821]: F821_21.py:4:1: Undefined name `display` +error[F821]: 4:1: Undefined name `display` + --> F821_21.py:3:6 | 3 | x = 1 4 | display(x) diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_26.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_26.py.snap index 82bbd320db..698b047b79 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_26.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_26.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F821]: F821_26.py:9:33: Undefined name `CStr` +error[F821]: 9:33: Undefined name `CStr` + --> F821_26.py:9:33 | 8 | # Forward references: 9 | MaybeCStr: TypeAlias = Optional[CStr] # valid in a `.pyi` stub file, not in a `.py` runtime file @@ -10,8 +11,9 @@ error[F821]: F821_26.py:9:33: Undefined name `CStr` 10 | MaybeCStr2: TypeAlias = Optional["CStr"] # always okay 11 | CStr: TypeAlias = Union[C, str] # valid in a `.pyi` stub file, not in a `.py` runtime file | -error[F821]: F821_26.py:11:25: Undefined name `C` +error[F821]: 11:25: Undefined name `C` + --> F821_26.py:11:25 | 9 | MaybeCStr: TypeAlias = Optional[CStr] # valid in a `.pyi` stub file, not in a `.py` runtime file 10 | MaybeCStr2: TypeAlias = Optional["CStr"] # always okay @@ -19,8 +21,9 @@ error[F821]: F821_26.py:11:25: Undefined name `C` | ^ 12 | CStr2: TypeAlias = Union["C", str] # always okay | -error[F821]: F821_26.py:16:12: Undefined name `C` +error[F821]: 16:12: Undefined name `C` + --> F821_26.py:16:12 | 14 | # References to a class from inside the class: 15 | class C: @@ -29,8 +32,9 @@ error[F821]: F821_26.py:16:12: Undefined name `C` 17 | other2: "C" = ... # always okay 18 | def from_str(self, s: str) -> C: ... # valid in a `.pyi` stub file, not in a `.py` runtime file | -error[F821]: F821_26.py:18:35: Undefined name `C` +error[F821]: 18:35: Undefined name `C` + --> F821_26.py:18:35 | 16 | other: C = ... # valid in a `.pyi` stub file, not in a `.py` runtime file 17 | other2: "C" = ... # always okay @@ -38,8 +42,9 @@ error[F821]: F821_26.py:18:35: Undefined name `C` | ^ 19 | def from_str2(self, s: str) -> "C": ... # always okay | -error[F821]: F821_26.py:23:10: Undefined name `B` +error[F821]: 23:10: Undefined name `B` + --> F821_26.py:23:10 | 21 | # Circular references: 22 | class A: @@ -48,8 +53,9 @@ error[F821]: F821_26.py:23:10: Undefined name `B` 24 | foo2: "B" # always okay 25 | bar: dict[str, B] # valid in a `.pyi` stub file, not in a `.py` runtime file | -error[F821]: F821_26.py:25:20: Undefined name `B` +error[F821]: 25:20: Undefined name `B` + --> F821_26.py:25:20 | 23 | foo: B # valid in a `.pyi` stub file, not in a `.py` runtime file 24 | foo2: "B" # always okay @@ -57,16 +63,18 @@ error[F821]: F821_26.py:25:20: Undefined name `B` | ^ 26 | bar2: dict[str, "A"] # always okay | -error[F821]: F821_26.py:33:17: Undefined name `Tree` +error[F821]: 33:17: Undefined name `Tree` + --> F821_26.py:33:17 | 32 | class Leaf: ... 33 | class Tree(list[Tree | Leaf]): ... # valid in a `.pyi` stub file, not in a `.py` runtime file | ^^^^ 34 | class Tree2(list["Tree | Leaf"]): ... # always okay | -error[F821]: F821_26.py:39:11: Undefined name `foo` +error[F821]: 39:11: Undefined name `foo` + --> F821_26.py:39:11 | 37 | class MyClass: 38 | foo: int @@ -74,8 +82,9 @@ error[F821]: F821_26.py:39:11: Undefined name `foo` | ^^^ 40 | bar = "foo" # always okay | -error[F821]: F821_26.py:43:8: Undefined name `baz` +error[F821]: 43:8: Undefined name `baz` + --> F821_26.py:43:8 | 42 | baz: MyClass 43 | eggs = baz # valid in a `.pyi` stub file, not in a `.py` runtime file diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_27.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_27.py.snap index dfbee64d0e..63484c1f10 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_27.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_27.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F821]: F821_27.py:30:11: Undefined name `foo` +error[F821]: 30:11: Undefined name `foo` + --> F821_27.py:30:11 | 28 | class MyClass: 29 | foo: int @@ -10,16 +11,18 @@ error[F821]: F821_27.py:30:11: Undefined name `foo` | ^^^ 31 | bar = "foo" # always okay | -error[F821]: F821_27.py:34:8: Undefined name `baz` +error[F821]: 34:8: Undefined name `baz` + --> F821_27.py:34:8 | 33 | baz: MyClass 34 | eggs = baz # Still invalid even when `__future__.annotations` are enabled | ^^^ 35 | eggs = "baz" # always okay | -error[F821]: F821_27.py:38:33: Undefined name `DStr` +error[F821]: 38:33: Undefined name `DStr` + --> F821_27.py:38:33 | 37 | # Forward references: 38 | MaybeDStr: TypeAlias = Optional[DStr] # Still invalid even when `__future__.annotations` are enabled @@ -27,8 +30,9 @@ error[F821]: F821_27.py:38:33: Undefined name `DStr` 39 | MaybeDStr2: TypeAlias = Optional["DStr"] # always okay 40 | DStr: TypeAlias = Union[D, str] # Still invalid even when `__future__.annotations` are enabled | -error[F821]: F821_27.py:40:25: Undefined name `D` +error[F821]: 40:25: Undefined name `D` + --> F821_27.py:40:25 | 38 | MaybeDStr: TypeAlias = Optional[DStr] # Still invalid even when `__future__.annotations` are enabled 39 | MaybeDStr2: TypeAlias = Optional["DStr"] # always okay @@ -36,8 +40,9 @@ error[F821]: F821_27.py:40:25: Undefined name `D` | ^ 41 | DStr2: TypeAlias = Union["D", str] # always okay | -error[F821]: F821_27.py:47:17: Undefined name `Tree` +error[F821]: 47:17: Undefined name `Tree` + --> F821_27.py:47:17 | 45 | # More circular references 46 | class Leaf: ... diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_28.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_28.py.snap index ed56437cbe..349deee79d 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_28.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_28.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F821]: F821_28.py:9:7: Undefined name `𝒟` +error[F821]: 9:7: Undefined name `𝒟` + --> F821_28.py:9:7 | 7 | print(C == 𝑪 == 𝒞 == 𝓒 == 𝕮) 8 | diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_3.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_3.py.snap index 18991d0b1b..0d2c43ee2a 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_3.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_3.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F821]: F821_3.py:11:10: Undefined name `key` +error[F821]: 11:10: Undefined name `key` + --> F821_3.py:11:10 | 9 | # F821 Undefined name `key` 10 | # F821 Undefined name `value` @@ -11,8 +12,9 @@ error[F821]: F821_3.py:11:10: Undefined name `key` 12 | 13 | # OK | -error[F821]: F821_3.py:11:17: Undefined name `value` +error[F821]: 11:17: Undefined name `value` + --> F821_3.py:11:17 | 9 | # F821 Undefined name `key` 10 | # F821 Undefined name `value` diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_4.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_4.py.snap index 5481272236..1de7231284 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_4.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_4.py.snap @@ -1,40 +1,45 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F821]: F821_4.py:4:11: Undefined name `Model` +error[F821]: 4:11: Undefined name `Model` + --> F821_4.py:4:11 | 2 | from typing import List 3 | 4 | _ = List["Model"] | ^^^^^ | -error[F821]: F821_4.py:9:12: Undefined name `Model` +error[F821]: 9:12: Undefined name `Model` + --> F821_4.py:9:12 | 7 | from typing import List as IList 8 | 9 | _ = IList["Model"] | ^^^^^ | -error[F821]: F821_4.py:14:16: Undefined name `Model` +error[F821]: 14:16: Undefined name `Model` + --> F821_4.py:14:16 | 12 | from collections.abc import ItemsView 13 | 14 | _ = ItemsView["Model"] | ^^^^^ | -error[F821]: F821_4.py:19:32: Undefined name `Model` +error[F821]: 19:32: Undefined name `Model` + --> F821_4.py:19:32 | 17 | import collections.abc 18 | 19 | _ = collections.abc.ItemsView["Model"] | ^^^^^ | -error[F821]: F821_4.py:24:20: Undefined name `Model` +error[F821]: 24:20: Undefined name `Model` + --> F821_4.py:24:20 | 22 | from collections import abc 23 | diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_5.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_5.py.snap index 7be71c63d9..980c2ac53b 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_5.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_5.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F821]: F821_5.py:5:31: Undefined name `InnerClass` +error[F821]: 5:31: Undefined name `InnerClass` + --> F821_5.py:5:31 | 4 | class RandomClass: 5 | def random_func(self) -> "InnerClass": diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_5.pyi.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_5.pyi.snap index d58ef27813..92c27c439e 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_5.pyi.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_5.pyi.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F821]: F821_5.pyi:4:27: Undefined name `InnerClass` +error[F821]: 4:27: Undefined name `InnerClass` + --> F821_5.pyi:4:27 | 3 | class RandomClass: 4 | def bad_func(self) -> InnerClass: ... # F821 diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_7.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_7.py.snap index be4e8cb4de..9927d73512 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_7.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_7.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F821]: F821_7.py:11:22: Undefined name `Undefined` +error[F821]: 11:22: Undefined name `Undefined` + --> F821_7.py:11:22 | 10 | # Not OK 11 | _ = DefaultNamedArg("Undefined", name="some_prop_name") @@ -10,8 +11,9 @@ error[F821]: F821_7.py:11:22: Undefined name `Undefined` 12 | _ = DefaultNamedArg(type="Undefined", name="some_prop_name") 13 | _ = DefaultNamedArg("Undefined", "some_prop_name") | -error[F821]: F821_7.py:12:27: Undefined name `Undefined` +error[F821]: 12:27: Undefined name `Undefined` + --> F821_7.py:12:27 | 10 | # Not OK 11 | _ = DefaultNamedArg("Undefined", name="some_prop_name") @@ -19,8 +21,9 @@ error[F821]: F821_7.py:12:27: Undefined name `Undefined` | ^^^^^^^^^ 13 | _ = DefaultNamedArg("Undefined", "some_prop_name") | -error[F821]: F821_7.py:13:22: Undefined name `Undefined` +error[F821]: 13:22: Undefined name `Undefined` + --> F821_7.py:13:22 | 11 | _ = DefaultNamedArg("Undefined", name="some_prop_name") 12 | _ = DefaultNamedArg(type="Undefined", name="some_prop_name") diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_9.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_9.py.snap index 961bf0f88a..9b31c35c33 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_9.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_9.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F821]: F821_9.py:22:20: Undefined name `captured` +error[F821]: 22:20: Undefined name `captured` + --> F821_9.py:22:20 | 20 | match provided: 21 | case True: diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F822_F822_0.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F822_F822_0.py.snap index 70e216611f..03592b5d7f 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F822_F822_0.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F822_F822_0.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F822]: F822_0.py:3:17: Undefined name `b` in `__all__` +error[F822]: 3:17: Undefined name `b` in `__all__` + --> F822_0.py:3:17 | 1 | a = 1 2 | diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F822_F822_0.pyi.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F822_F822_0.pyi.snap index b4db557d18..a2b8a02352 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F822_F822_0.pyi.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F822_F822_0.pyi.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F822]: F822_0.pyi:4:22: Undefined name `c` in `__all__` +error[F822]: 4:22: Undefined name `c` in `__all__` + --> F822_0.pyi:4:22 | 2 | b: int # Considered a binding in a `.pyi` stub file, not in a `.py` runtime file 3 | diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F822_F822_1.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F822_F822_1.py.snap index 950963b2b9..f2a12df0b0 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F822_F822_1.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F822_F822_1.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F822]: F822_1.py:3:22: Undefined name `b` in `__all__` +error[F822]: 3:22: Undefined name `b` in `__all__` + --> F822_1.py:3:22 | 1 | a = 1 2 | diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F822_F822_1b.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F822_F822_1b.py.snap index 2a8e096877..c4d2abb9c5 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F822_F822_1b.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F822_F822_1b.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F822]: F822_1b.py:4:31: Undefined name `b` in `__all__` +error[F822]: 4:31: Undefined name `b` in `__all__` + --> F822_1b.py:4:31 | 2 | a = 1 3 | diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F822_F822_3.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F822_F822_3.py.snap index a0d7edbc85..c606a8da31 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F822_F822_3.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F822_F822_3.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F822]: F822_3.py:12:5: Undefined name `ExponentialFamily` in `__all__` +error[F822]: 12:5: Undefined name `ExponentialFamily` in `__all__` + --> F822_3.py:12:5 | 10 | __all__ += [ 11 | "ContinuousBernoulli", # noqa: F822 diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F823_F823.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F823_F823.py.snap index 5af43b4329..79a0b74982 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F823_F823.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F823_F823.py.snap @@ -1,15 +1,17 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F823]: F823.py:6:5: Local variable `my_var` referenced before assignment +error[F823]: 6:5: Local variable `my_var` referenced before assignment + --> F823.py:6:5 | 5 | def foo(): 6 | my_var += 1 | ^^^^^^ | -error[F823]: F823.py:32:15: Local variable `my_var` referenced before assignment +error[F823]: 32:15: Local variable `my_var` referenced before assignment + --> F823.py:32:15 | 30 | class Class: 31 | def f(self): @@ -17,16 +19,18 @@ error[F823]: F823.py:32:15: Local variable `my_var` referenced before assignment | ^^^^^^ 33 | my_var = 1 | -error[F823]: F823.py:40:15: Local variable `my_var` referenced before assignment +error[F823]: 40:15: Local variable `my_var` referenced before assignment + --> F823.py:40:15 | 39 | def f(self): 40 | print(my_var) | ^^^^^^ 41 | my_var = 1 | -error[F823]: F823.py:48:11: Local variable `sys` referenced before assignment +error[F823]: 48:11: Local variable `sys` referenced before assignment + --> F823.py:48:11 | 47 | def main(): 48 | print(sys.argv) @@ -34,8 +38,9 @@ error[F823]: F823.py:48:11: Local variable `sys` referenced before assignment 49 | 50 | try: | -error[F823]: F823.py:62:11: Local variable `sys` referenced before assignment +error[F823]: 62:11: Local variable `sys` referenced before assignment + --> F823.py:62:11 | 61 | def main(): 62 | print(sys.argv) diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_0.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_0.py.snap index dfcc677e35..01aed7341d 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_0.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_0.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F841]: F841_0.py:3:22: [*] Local variable `e` is assigned to but never used +error[F841]: 3:22: [*] Local variable `e` is assigned to but never used + --> F841_0.py:3:22 | 1 | try: 2 | 1 / 0 @@ -20,8 +21,9 @@ error[F841]: F841_0.py:3:22: [*] Local variable `e` is assigned to but never use 5 5 | 6 6 | -error[F841]: F841_0.py:16:5: [*] Local variable `z` is assigned to but never used +error[F841]: 16:5: [*] Local variable `z` is assigned to but never used + --> F841_0.py:16:5 | 14 | x = 1 15 | y = 2 @@ -39,8 +41,9 @@ error[F841]: F841_0.py:16:5: [*] Local variable `z` is assigned to but never use 18 18 | 19 19 | def f(): -error[F841]: F841_0.py:20:5: [*] Local variable `foo` is assigned to but never used +error[F841]: 20:5: [*] Local variable `foo` is assigned to but never used + --> F841_0.py:20:5 | 19 | def f(): 20 | foo = (1, 2) @@ -57,8 +60,9 @@ error[F841]: F841_0.py:20:5: [*] Local variable `foo` is assigned to but never u 22 21 | 23 22 | bar = (1, 2) -error[F841]: F841_0.py:21:6: [*] Local variable `a` is assigned to but never used +error[F841]: 21:6: [*] Local variable `a` is assigned to but never used + --> F841_0.py:21:6 | 19 | def f(): 20 | foo = (1, 2) @@ -78,8 +82,9 @@ error[F841]: F841_0.py:21:6: [*] Local variable `a` is assigned to but never use 23 23 | bar = (1, 2) 24 24 | (c, d) = bar -error[F841]: F841_0.py:21:9: [*] Local variable `b` is assigned to but never used +error[F841]: 21:9: [*] Local variable `b` is assigned to but never used + --> F841_0.py:21:9 | 19 | def f(): 20 | foo = (1, 2) @@ -99,8 +104,9 @@ error[F841]: F841_0.py:21:9: [*] Local variable `b` is assigned to but never use 23 23 | bar = (1, 2) 24 24 | (c, d) = bar -error[F841]: F841_0.py:26:14: [*] Local variable `baz` is assigned to but never used +error[F841]: 26:14: [*] Local variable `baz` is assigned to but never used + --> F841_0.py:26:14 | 24 | (c, d) = bar 25 | @@ -118,8 +124,9 @@ error[F841]: F841_0.py:26:14: [*] Local variable `baz` is assigned to but never 28 28 | 29 29 | def f(): -error[F841]: F841_0.py:51:9: [*] Local variable `b` is assigned to but never used +error[F841]: 51:9: [*] Local variable `b` is assigned to but never used + --> F841_0.py:51:9 | 49 | def c(): 50 | # F841 @@ -139,8 +146,9 @@ error[F841]: F841_0.py:51:9: [*] Local variable `b` is assigned to but never use 53 53 | def d(): 54 54 | nonlocal b -error[F841]: F841_0.py:79:26: [*] Local variable `my_file` is assigned to but never used +error[F841]: 79:26: [*] Local variable `my_file` is assigned to but never used + --> F841_0.py:79:26 | 78 | def f(): 79 | with open("file") as my_file, open("") as ((this, that)): @@ -158,8 +166,9 @@ error[F841]: F841_0.py:79:26: [*] Local variable `my_file` is assigned to but ne 81 81 | 82 82 | -error[F841]: F841_0.py:85:25: [*] Local variable `my_file` is assigned to but never used +error[F841]: 85:25: [*] Local variable `my_file` is assigned to but never used + --> F841_0.py:85:25 | 83 | def f(): 84 | with ( @@ -179,8 +188,9 @@ error[F841]: F841_0.py:85:25: [*] Local variable `my_file` is assigned to but ne 87 87 | ): 88 88 | print("hello") -error[F841]: F841_0.py:102:5: [*] Local variable `msg3` is assigned to but never used +error[F841]: 102:5: [*] Local variable `msg3` is assigned to but never used + --> F841_0.py:102:5 | 100 | msg1 = "Hello, world!" 101 | msg2 = "Hello, world!" @@ -199,8 +209,9 @@ error[F841]: F841_0.py:102:5: [*] Local variable `msg3` is assigned to but never 104 103 | case 1: 105 104 | print(msg1) -error[F841]: F841_0.py:115:5: [*] Local variable `Baz` is assigned to but never used +error[F841]: 115:5: [*] Local variable `Baz` is assigned to but never used + --> F841_0.py:115:5 | 113 | Foo = enum.Enum("Foo", "A B") 114 | Bar = enum.Enum("Bar", "A B") @@ -220,8 +231,9 @@ error[F841]: F841_0.py:115:5: [*] Local variable `Baz` is assigned to but never 117 117 | match x: 118 118 | case (Foo.A): -error[F841]: F841_0.py:122:14: Local variable `y` is assigned to but never used +error[F841]: 122:14: Local variable `y` is assigned to but never used + --> F841_0.py:122:14 | 120 | case [Bar.A, *_]: 121 | print("A") @@ -230,8 +242,9 @@ error[F841]: F841_0.py:122:14: Local variable `y` is assigned to but never used 123 | pass | = help: Remove assignment to unused variable `y` -error[F841]: F841_0.py:127:21: Local variable `value` is assigned to but never used +error[F841]: 127:21: Local variable `value` is assigned to but never used + --> F841_0.py:127:21 | 126 | def f(): 127 | if any((key := (value := x)) for x in ["ok"]): diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_1.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_1.py.snap index a2af477cca..805e043f74 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_1.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_1.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F841]: F841_1.py:6:5: [*] Local variable `x` is assigned to but never used +error[F841]: 6:5: [*] Local variable `x` is assigned to but never used + --> F841_1.py:6:5 | 5 | def f(): 6 | x, y = 1, 2 # this triggers F841 as it's just a simple assignment where unpacking isn't needed @@ -19,8 +20,9 @@ error[F841]: F841_1.py:6:5: [*] Local variable `x` is assigned to but never used 8 8 | 9 9 | def f(): -error[F841]: F841_1.py:6:8: [*] Local variable `y` is assigned to but never used +error[F841]: 6:8: [*] Local variable `y` is assigned to but never used + --> F841_1.py:6:8 | 5 | def f(): 6 | x, y = 1, 2 # this triggers F841 as it's just a simple assignment where unpacking isn't needed @@ -37,8 +39,9 @@ error[F841]: F841_1.py:6:8: [*] Local variable `y` is assigned to but never used 8 8 | 9 9 | def f(): -error[F841]: F841_1.py:16:14: [*] Local variable `coords` is assigned to but never used +error[F841]: 16:14: [*] Local variable `coords` is assigned to but never used + --> F841_1.py:16:14 | 15 | def f(): 16 | (x, y) = coords = 1, 2 @@ -55,8 +58,9 @@ error[F841]: F841_1.py:16:14: [*] Local variable `coords` is assigned to but nev 18 18 | 19 19 | def f(): -error[F841]: F841_1.py:20:5: [*] Local variable `coords` is assigned to but never used +error[F841]: 20:5: [*] Local variable `coords` is assigned to but never used + --> F841_1.py:20:5 | 19 | def f(): 20 | coords = (x, y) = 1, 2 @@ -73,8 +77,9 @@ error[F841]: F841_1.py:20:5: [*] Local variable `coords` is assigned to but neve 22 22 | 23 23 | def f(): -error[F841]: F841_1.py:24:6: [*] Local variable `a` is assigned to but never used +error[F841]: 24:6: [*] Local variable `a` is assigned to but never used + --> F841_1.py:24:6 | 23 | def f(): 24 | (a, b) = (x, y) = 1, 2 # this triggers F841 on everything @@ -88,8 +93,9 @@ error[F841]: F841_1.py:24:6: [*] Local variable `a` is assigned to but never use 24 |- (a, b) = (x, y) = 1, 2 # this triggers F841 on everything 24 |+ (_a, b) = (x, y) = 1, 2 # this triggers F841 on everything -error[F841]: F841_1.py:24:9: [*] Local variable `b` is assigned to but never used +error[F841]: 24:9: [*] Local variable `b` is assigned to but never used + --> F841_1.py:24:9 | 23 | def f(): 24 | (a, b) = (x, y) = 1, 2 # this triggers F841 on everything @@ -103,8 +109,9 @@ error[F841]: F841_1.py:24:9: [*] Local variable `b` is assigned to but never use 24 |- (a, b) = (x, y) = 1, 2 # this triggers F841 on everything 24 |+ (a, _b) = (x, y) = 1, 2 # this triggers F841 on everything -error[F841]: F841_1.py:24:15: [*] Local variable `x` is assigned to but never used +error[F841]: 24:15: [*] Local variable `x` is assigned to but never used + --> F841_1.py:24:15 | 23 | def f(): 24 | (a, b) = (x, y) = 1, 2 # this triggers F841 on everything @@ -118,8 +125,9 @@ error[F841]: F841_1.py:24:15: [*] Local variable `x` is assigned to but never us 24 |- (a, b) = (x, y) = 1, 2 # this triggers F841 on everything 24 |+ (a, b) = (_x, y) = 1, 2 # this triggers F841 on everything -error[F841]: F841_1.py:24:18: [*] Local variable `y` is assigned to but never used +error[F841]: 24:18: [*] Local variable `y` is assigned to but never used + --> F841_1.py:24:18 | 23 | def f(): 24 | (a, b) = (x, y) = 1, 2 # this triggers F841 on everything diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_3.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_3.py.snap index 1c3bdd6bba..769d2c9ad6 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_3.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_3.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F841]: F841_3.py:5:5: [*] Local variable `x` is assigned to but never used +error[F841]: 5:5: [*] Local variable `x` is assigned to but never used + --> F841_3.py:5:5 | 4 | def f(): 5 | x = 1 @@ -19,8 +20,9 @@ error[F841]: F841_3.py:5:5: [*] Local variable `x` is assigned to but never used 7 6 | 8 7 | z = 3 -error[F841]: F841_3.py:6:5: [*] Local variable `y` is assigned to but never used +error[F841]: 6:5: [*] Local variable `y` is assigned to but never used + --> F841_3.py:6:5 | 4 | def f(): 5 | x = 1 @@ -39,8 +41,9 @@ error[F841]: F841_3.py:6:5: [*] Local variable `y` is assigned to but never used 8 7 | z = 3 9 8 | print(z) -error[F841]: F841_3.py:13:5: [*] Local variable `x` is assigned to but never used +error[F841]: 13:5: [*] Local variable `x` is assigned to but never used + --> F841_3.py:13:5 | 12 | def f(): 13 | x: int = 1 @@ -57,8 +60,9 @@ error[F841]: F841_3.py:13:5: [*] Local variable `x` is assigned to but never use 15 14 | 16 15 | z: int = 3 -error[F841]: F841_3.py:14:5: [*] Local variable `y` is assigned to but never used +error[F841]: 14:5: [*] Local variable `y` is assigned to but never used + --> F841_3.py:14:5 | 12 | def f(): 13 | x: int = 1 @@ -77,8 +81,9 @@ error[F841]: F841_3.py:14:5: [*] Local variable `y` is assigned to but never use 16 15 | z: int = 3 17 16 | print(z) -error[F841]: F841_3.py:21:19: [*] Local variable `x1` is assigned to but never used +error[F841]: 21:19: [*] Local variable `x1` is assigned to but never used + --> F841_3.py:21:19 | 20 | def f(): 21 | with foo() as x1: @@ -96,8 +101,9 @@ error[F841]: F841_3.py:21:19: [*] Local variable `x1` is assigned to but never u 23 23 | 24 24 | with foo() as (x2, y2): -error[F841]: F841_3.py:27:20: [*] Local variable `x3` is assigned to but never used +error[F841]: 27:20: [*] Local variable `x3` is assigned to but never used + --> F841_3.py:27:20 | 25 | pass 26 | @@ -116,8 +122,9 @@ error[F841]: F841_3.py:27:20: [*] Local variable `x3` is assigned to but never u 29 29 | 30 30 | -error[F841]: F841_3.py:27:33: [*] Local variable `y3` is assigned to but never used +error[F841]: 27:33: [*] Local variable `y3` is assigned to but never used + --> F841_3.py:27:33 | 25 | pass 26 | @@ -136,8 +143,9 @@ error[F841]: F841_3.py:27:33: [*] Local variable `y3` is assigned to but never u 29 29 | 30 30 | -error[F841]: F841_3.py:27:46: [*] Local variable `z3` is assigned to but never used +error[F841]: 27:46: [*] Local variable `z3` is assigned to but never used + --> F841_3.py:27:46 | 25 | pass 26 | @@ -156,8 +164,9 @@ error[F841]: F841_3.py:27:46: [*] Local variable `z3` is assigned to but never u 29 29 | 30 30 | -error[F841]: F841_3.py:32:6: [*] Local variable `x1` is assigned to but never used +error[F841]: 32:6: [*] Local variable `x1` is assigned to but never used + --> F841_3.py:32:6 | 31 | def f(): 32 | (x1, y1) = (1, 2) @@ -176,8 +185,9 @@ error[F841]: F841_3.py:32:6: [*] Local variable `x1` is assigned to but never us 34 34 | coords3 = (x3, y3) = (1, 2) 35 35 | -error[F841]: F841_3.py:32:10: [*] Local variable `y1` is assigned to but never used +error[F841]: 32:10: [*] Local variable `y1` is assigned to but never used + --> F841_3.py:32:10 | 31 | def f(): 32 | (x1, y1) = (1, 2) @@ -196,8 +206,9 @@ error[F841]: F841_3.py:32:10: [*] Local variable `y1` is assigned to but never u 34 34 | coords3 = (x3, y3) = (1, 2) 35 35 | -error[F841]: F841_3.py:33:16: [*] Local variable `coords2` is assigned to but never used +error[F841]: 33:16: [*] Local variable `coords2` is assigned to but never used + --> F841_3.py:33:16 | 31 | def f(): 32 | (x1, y1) = (1, 2) @@ -216,8 +227,9 @@ error[F841]: F841_3.py:33:16: [*] Local variable `coords2` is assigned to but ne 35 35 | 36 36 | -error[F841]: F841_3.py:34:5: [*] Local variable `coords3` is assigned to but never used +error[F841]: 34:5: [*] Local variable `coords3` is assigned to but never used + --> F841_3.py:34:5 | 32 | (x1, y1) = (1, 2) 33 | (x2, y2) = coords2 = (1, 2) @@ -235,8 +247,9 @@ error[F841]: F841_3.py:34:5: [*] Local variable `coords3` is assigned to but nev 36 36 | 37 37 | def f(): -error[F841]: F841_3.py:40:26: [*] Local variable `x1` is assigned to but never used +error[F841]: 40:26: [*] Local variable `x1` is assigned to but never used + --> F841_3.py:40:26 | 38 | try: 39 | 1 / 0 @@ -255,8 +268,9 @@ error[F841]: F841_3.py:40:26: [*] Local variable `x1` is assigned to but never u 42 42 | 43 43 | try: -error[F841]: F841_3.py:45:47: [*] Local variable `x2` is assigned to but never used +error[F841]: 45:47: [*] Local variable `x2` is assigned to but never used + --> F841_3.py:45:47 | 43 | try: 44 | 1 / 0 @@ -275,8 +289,9 @@ error[F841]: F841_3.py:45:47: [*] Local variable `x2` is assigned to but never u 47 47 | 48 48 | -error[F841]: F841_3.py:50:5: [*] Local variable `x` is assigned to but never used +error[F841]: 50:5: [*] Local variable `x` is assigned to but never used + --> F841_3.py:50:5 | 49 | def f(a, b): 50 | x = ( @@ -295,8 +310,9 @@ error[F841]: F841_3.py:50:5: [*] Local variable `x` is assigned to but never use 52 52 | if a is not None 53 53 | else b -error[F841]: F841_3.py:56:5: [*] Local variable `y` is assigned to but never used +error[F841]: 56:5: [*] Local variable `y` is assigned to but never used + --> F841_3.py:56:5 | 54 | ) 55 | @@ -316,8 +332,9 @@ error[F841]: F841_3.py:56:5: [*] Local variable `y` is assigned to but never use 59 58 | 60 59 | def f(a, b): -error[F841]: F841_3.py:61:5: [*] Local variable `x` is assigned to but never used +error[F841]: 61:5: [*] Local variable `x` is assigned to but never used + --> F841_3.py:61:5 | 60 | def f(a, b): 61 | x = ( @@ -339,8 +356,9 @@ error[F841]: F841_3.py:61:5: [*] Local variable `x` is assigned to but never use 67 62 | y = \ 68 63 | a if a is not None else b -error[F841]: F841_3.py:67:5: [*] Local variable `y` is assigned to but never used +error[F841]: 67:5: [*] Local variable `y` is assigned to but never used + --> F841_3.py:67:5 | 65 | ) 66 | @@ -359,8 +377,9 @@ error[F841]: F841_3.py:67:5: [*] Local variable `y` is assigned to but never use 70 68 | 71 69 | def f(): -error[F841]: F841_3.py:72:24: [*] Local variable `cm` is assigned to but never used +error[F841]: 72:24: [*] Local variable `cm` is assigned to but never used + --> F841_3.py:72:24 | 71 | def f(): 72 | with Nested(m) as (cm): @@ -378,8 +397,9 @@ error[F841]: F841_3.py:72:24: [*] Local variable `cm` is assigned to but never u 74 74 | 75 75 | -error[F841]: F841_3.py:77:25: [*] Local variable `cm` is assigned to but never used +error[F841]: 77:25: [*] Local variable `cm` is assigned to but never used + --> F841_3.py:77:25 | 76 | def f(): 77 | with (Nested(m) as (cm),): @@ -397,8 +417,9 @@ error[F841]: F841_3.py:77:25: [*] Local variable `cm` is assigned to but never u 79 79 | 80 80 | -error[F841]: F841_3.py:87:26: [*] Local variable `cm` is assigned to but never used +error[F841]: 87:26: [*] Local variable `cm` is assigned to but never used + --> F841_3.py:87:26 | 86 | def f(): 87 | with (Nested(m)) as (cm): @@ -416,8 +437,9 @@ error[F841]: F841_3.py:87:26: [*] Local variable `cm` is assigned to but never u 89 89 | 90 90 | -error[F841]: F841_3.py:92:5: [*] Local variable `toplevel` is assigned to but never used +error[F841]: 92:5: [*] Local variable `toplevel` is assigned to but never used + --> F841_3.py:92:5 | 91 | def f(): 92 | toplevel = tt = lexer.get_token() @@ -436,8 +458,9 @@ error[F841]: F841_3.py:92:5: [*] Local variable `toplevel` is assigned to but ne 94 94 | break 95 95 | -error[F841]: F841_3.py:98:5: [*] Local variable `toplevel` is assigned to but never used +error[F841]: 98:5: [*] Local variable `toplevel` is assigned to but never used + --> F841_3.py:98:5 | 97 | def f(): 98 | toplevel = tt = lexer.get_token() @@ -454,8 +477,9 @@ error[F841]: F841_3.py:98:5: [*] Local variable `toplevel` is assigned to but ne 100 100 | 101 101 | def f(): -error[F841]: F841_3.py:98:16: [*] Local variable `tt` is assigned to but never used +error[F841]: 98:16: [*] Local variable `tt` is assigned to but never used + --> F841_3.py:98:16 | 97 | def f(): 98 | toplevel = tt = lexer.get_token() @@ -472,8 +496,9 @@ error[F841]: F841_3.py:98:16: [*] Local variable `tt` is assigned to but never u 100 100 | 101 101 | def f(): -error[F841]: F841_3.py:102:5: [*] Local variable `toplevel` is assigned to but never used +error[F841]: 102:5: [*] Local variable `toplevel` is assigned to but never used + --> F841_3.py:102:5 | 101 | def f(): 102 | toplevel = (a, b) = lexer.get_token() @@ -490,8 +515,9 @@ error[F841]: F841_3.py:102:5: [*] Local variable `toplevel` is assigned to but n 104 104 | 105 105 | def f(): -error[F841]: F841_3.py:106:14: [*] Local variable `toplevel` is assigned to but never used +error[F841]: 106:14: [*] Local variable `toplevel` is assigned to but never used + --> F841_3.py:106:14 | 105 | def f(): 106 | (a, b) = toplevel = lexer.get_token() @@ -508,8 +534,9 @@ error[F841]: F841_3.py:106:14: [*] Local variable `toplevel` is assigned to but 108 108 | 109 109 | def f(): -error[F841]: F841_3.py:110:5: [*] Local variable `toplevel` is assigned to but never used +error[F841]: 110:5: [*] Local variable `toplevel` is assigned to but never used + --> F841_3.py:110:5 | 109 | def f(): 110 | toplevel = tt = 1 @@ -526,8 +553,9 @@ error[F841]: F841_3.py:110:5: [*] Local variable `toplevel` is assigned to but n 112 112 | 113 113 | def f(provided: int) -> int: -error[F841]: F841_3.py:110:16: [*] Local variable `tt` is assigned to but never used +error[F841]: 110:16: [*] Local variable `tt` is assigned to but never used + --> F841_3.py:110:16 | 109 | def f(): 110 | toplevel = tt = 1 @@ -544,8 +572,9 @@ error[F841]: F841_3.py:110:16: [*] Local variable `tt` is assigned to but never 112 112 | 113 113 | def f(provided: int) -> int: -error[F841]: F841_3.py:115:19: Local variable `x` is assigned to but never used +error[F841]: 115:19: Local variable `x` is assigned to but never used + --> F841_3.py:115:19 | 113 | def f(provided: int) -> int: 114 | match provided: @@ -554,8 +583,9 @@ error[F841]: F841_3.py:115:19: Local variable `x` is assigned to but never used 116 | pass | = help: Remove assignment to unused variable `x` -error[F841]: F841_3.py:121:14: Local variable `x` is assigned to but never used +error[F841]: 121:14: Local variable `x` is assigned to but never used + --> F841_3.py:121:14 | 119 | def f(provided: int) -> int: 120 | match provided: @@ -564,8 +594,9 @@ error[F841]: F841_3.py:121:14: Local variable `x` is assigned to but never used 122 | pass | = help: Remove assignment to unused variable `x` -error[F841]: F841_3.py:127:18: Local variable `bar` is assigned to but never used +error[F841]: 127:18: Local variable `bar` is assigned to but never used + --> F841_3.py:127:18 | 125 | def f(provided: int) -> int: 126 | match provided: @@ -574,8 +605,9 @@ error[F841]: F841_3.py:127:18: Local variable `bar` is assigned to but never use 128 | pass | = help: Remove assignment to unused variable `bar` -error[F841]: F841_3.py:127:26: Local variable `x` is assigned to but never used +error[F841]: 127:26: Local variable `x` is assigned to but never used + --> F841_3.py:127:26 | 125 | def f(provided: int) -> int: 126 | match provided: @@ -584,8 +616,9 @@ error[F841]: F841_3.py:127:26: Local variable `x` is assigned to but never used 128 | pass | = help: Remove assignment to unused variable `x` -error[F841]: F841_3.py:133:27: Local variable `x` is assigned to but never used +error[F841]: 133:27: Local variable `x` is assigned to but never used + --> F841_3.py:133:27 | 131 | def f(provided: int) -> int: 132 | match provided: @@ -594,8 +627,9 @@ error[F841]: F841_3.py:133:27: Local variable `x` is assigned to but never used 134 | pass | = help: Remove assignment to unused variable `x` -error[F841]: F841_3.py:139:17: Local variable `x` is assigned to but never used +error[F841]: 139:17: Local variable `x` is assigned to but never used + --> F841_3.py:139:17 | 137 | def f(provided: int) -> int: 138 | match provided: @@ -604,8 +638,9 @@ error[F841]: F841_3.py:139:17: Local variable `x` is assigned to but never used 140 | pass | = help: Remove assignment to unused variable `x` -error[F841]: F841_3.py:155:17: [*] Local variable `e` is assigned to but never used +error[F841]: 155:17: [*] Local variable `e` is assigned to but never used + --> F841_3.py:155:17 | 153 | try: 154 | print("hello") @@ -624,8 +659,9 @@ error[F841]: F841_3.py:155:17: [*] Local variable `e` is assigned to but never u 157 157 | 158 158 | -error[F841]: F841_3.py:160:5: [*] Local variable `x` is assigned to but never used +error[F841]: 160:5: [*] Local variable `x` is assigned to but never used + --> F841_3.py:160:5 | 159 | def f(): 160 | x = 1 @@ -642,8 +678,9 @@ error[F841]: F841_3.py:160:5: [*] Local variable `x` is assigned to but never us 162 161 | 163 162 | -error[F841]: F841_3.py:161:5: [*] Local variable `y` is assigned to but never used +error[F841]: 161:5: [*] Local variable `y` is assigned to but never used + --> F841_3.py:161:5 | 159 | def f(): 160 | x = 1 @@ -660,8 +697,9 @@ error[F841]: F841_3.py:161:5: [*] Local variable `y` is assigned to but never us 163 162 | 164 163 | def f(): -error[F841]: F841_3.py:165:5: [*] Local variable `x` is assigned to but never used +error[F841]: 165:5: [*] Local variable `x` is assigned to but never used + --> F841_3.py:165:5 | 164 | def f(): 165 | x = 1 @@ -679,8 +717,9 @@ error[F841]: F841_3.py:165:5: [*] Local variable `x` is assigned to but never us 167 166 | y = 2 168 167 | -error[F841]: F841_3.py:167:5: [*] Local variable `y` is assigned to but never used +error[F841]: 167:5: [*] Local variable `y` is assigned to but never used + --> F841_3.py:167:5 | 165 | x = 1 166 | @@ -697,8 +736,9 @@ error[F841]: F841_3.py:167:5: [*] Local variable `y` is assigned to but never us 169 168 | 170 169 | def f(): -error[F841]: F841_3.py:173:6: [*] Local variable `x` is assigned to but never used +error[F841]: 173:6: [*] Local variable `x` is assigned to but never used + --> F841_3.py:173:6 | 171 | (x) = foo() 172 | ((x)) = foo() diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_4.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_4.py.snap index abca4e0b73..4c032d7e1e 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_4.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_4.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F841]: F841_4.py:12:5: [*] Local variable `a` is assigned to but never used +error[F841]: 12:5: [*] Local variable `a` is assigned to but never used + --> F841_4.py:12:5 | 11 | def bar(): 12 | a = foo() diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F842_F842.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F842_F842.py.snap index 4ffef7a5c5..308036cb5e 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F842_F842.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F842_F842.py.snap @@ -1,16 +1,18 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F842]: F842.py:2:5: Local variable `name` is annotated but never used +error[F842]: 2:5: Local variable `name` is annotated but never used + --> F842.py:2:5 | 1 | def f(): 2 | name: str | ^^^^ 3 | age: int | -error[F842]: F842.py:3:5: Local variable `age` is annotated but never used +error[F842]: 3:5: Local variable `age` is annotated but never used + --> F842.py:3:5 | 1 | def f(): 2 | name: str diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F901_F901.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F901_F901.py.snap index 694066bee5..e259812ec6 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F901_F901.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F901_F901.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F901]: F901.py:2:11: [*] `raise NotImplemented` should be `raise NotImplementedError` +error[F901]: 2:11: [*] `raise NotImplemented` should be `raise NotImplementedError` + --> F901.py:2:11 | 1 | def f() -> None: 2 | raise NotImplemented() @@ -17,8 +18,9 @@ error[F901]: F901.py:2:11: [*] `raise NotImplemented` should be `raise NotImplem 4 4 | 5 5 | def g() -> None: -error[F901]: F901.py:6:11: [*] `raise NotImplemented` should be `raise NotImplementedError` +error[F901]: 6:11: [*] `raise NotImplemented` should be `raise NotImplementedError` + --> F901.py:6:11 | 5 | def g() -> None: 6 | raise NotImplemented @@ -35,8 +37,9 @@ error[F901]: F901.py:6:11: [*] `raise NotImplemented` should be `raise NotImplem 8 8 | 9 9 | def h() -> None: -error[F901]: F901.py:11:11: [*] `raise NotImplemented` should be `raise NotImplementedError` +error[F901]: 11:11: [*] `raise NotImplemented` should be `raise NotImplementedError` + --> F901.py:11:11 | 9 | def h() -> None: 10 | NotImplementedError = "foo" diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__augmented_assignment_after_del.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__augmented_assignment_after_del.snap index 34c5e7355d..bbe44a85ad 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__augmented_assignment_after_del.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__augmented_assignment_after_del.snap @@ -1,16 +1,18 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F821]: :10:5: Undefined name `x` +error[F821]: 10:5: Undefined name `x` + --> :10:5 | 8 | # entirely after the `del` statement. However, it should be an F821 9 | # error, because the name is defined in the scope, but unbound. 10 | x += 1 | ^ | -error[F841]: :10:5: Local variable `x` is assigned to but never used +error[F841]: 10:5: Local variable `x` is assigned to but never used + --> :10:5 | 8 | # entirely after the `del` statement. However, it should be an F821 9 | # error, because the name is defined in the scope, but unbound. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__default_builtins.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__default_builtins.snap index 9bf1150cda..5dd0aa27ff 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__default_builtins.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__default_builtins.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F821]: builtins.py:1:1: Undefined name `_` +error[F821]: 1:1: Undefined name `_` + --> builtins.py:1:1 | 1 | _("Translations") | ^ diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__default_typing_modules.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__default_typing_modules.snap index d19d11f8c0..5fe71e0fe9 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__default_typing_modules.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__default_typing_modules.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F821]: typing_modules.py:6:36: Undefined name `db` +error[F821]: 6:36: Undefined name `db` + --> typing_modules.py:6:36 | 6 | X = Union[Literal[False], Literal["db"]] | ^^ diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__del_shadowed_global_import_in_global_scope.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__del_shadowed_global_import_in_global_scope.snap index a5dc4c8d2b..b4eecc474c 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__del_shadowed_global_import_in_global_scope.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__del_shadowed_global_import_in_global_scope.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F401]: :5:12: [*] `os` imported but unused +error[F401]: 5:12: [*] `os` imported but unused + --> :5:12 | 4 | def f(): 5 | import os diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__del_shadowed_global_import_in_local_scope.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__del_shadowed_global_import_in_local_scope.snap index 9d662cd713..c91b1ddce6 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__del_shadowed_global_import_in_local_scope.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__del_shadowed_global_import_in_local_scope.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F401]: :2:8: [*] `os` imported but unused +error[F401]: 2:8: [*] `os` imported but unused + --> :2:8 | 2 | import os | ^^ @@ -17,8 +18,9 @@ error[F401]: :2:8: [*] `os` imported but unused 4 3 | def f(): 5 4 | import os -error[F811]: :5:12: [*] Redefinition of unused `os` from line 2 +error[F811]: 5:12: [*] Redefinition of unused `os` from line 2 + --> :5:12 | 4 | def f(): 5 | import os diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__del_shadowed_import_shadow_in_local_scope.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__del_shadowed_import_shadow_in_local_scope.snap index 339f941d86..4007a88907 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__del_shadowed_import_shadow_in_local_scope.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__del_shadowed_import_shadow_in_local_scope.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F401]: :2:8: [*] `os` imported but unused +error[F401]: 2:8: [*] `os` imported but unused + --> :2:8 | 2 | import os | ^^ @@ -17,8 +18,9 @@ error[F401]: :2:8: [*] `os` imported but unused 4 3 | def f(): 5 4 | os = 1 -error[F811]: :5:5: Redefinition of unused `os` from line 2 +error[F811]: 5:5: Redefinition of unused `os` from line 2 + --> :5:5 | 4 | def f(): 5 | os = 1 diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__del_shadowed_local_import_in_local_scope.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__del_shadowed_local_import_in_local_scope.snap index c93dd918ac..ab4130a158 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__del_shadowed_local_import_in_local_scope.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__del_shadowed_local_import_in_local_scope.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F811]: :4:12: [*] Redefinition of unused `os` from line 3 +error[F811]: 4:12: [*] Redefinition of unused `os` from line 3 + --> :4:12 | 2 | def f(): 3 | import os diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__double_del.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__double_del.snap index 0d2a074836..d1be6a4166 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__double_del.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__double_del.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F821]: :5:9: Undefined name `x` +error[F821]: 5:9: Undefined name `x` + --> :5:9 | 3 | x = 1 4 | del x diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__extra_typing_modules.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__extra_typing_modules.snap index 3323cc1850..948ccbbe6e 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__extra_typing_modules.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__extra_typing_modules.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F821]: typing_modules.py:7:15: Undefined name `Class` +error[F821]: 7:15: Undefined name `Class` + --> typing_modules.py:7:15 | 6 | X = Union[Literal[False], Literal["db"]] 7 | y = Optional["Class"] diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__f401_preview_first_party_submodule_dunder_all.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__f401_preview_first_party_submodule_dunder_all.snap index 0d7b4c4505..572fd5789f 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__f401_preview_first_party_submodule_dunder_all.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__f401_preview_first_party_submodule_dunder_all.snap @@ -1,15 +1,16 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -__init__.py:2:8: F401 [*] `submodule.a` imported but unused; consider removing, adding to `__all__`, or using a redundant alias +error[F401]: 2:8: [*] `submodule.a` imported but unused; consider removing, adding to `__all__`, or using a redundant alias + + --> __init__.py:2:8 | 2 | import submodule.a - | ^^^^^^^^^^^ F401 + | ^^^^^^^^^^^ 3 | __all__ = ['FOO'] 4 | FOO = 42 | = help: Add `submodule` to __all__ - ℹ Safe fix 1 1 | 2 2 | import submodule.a diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__f401_preview_first_party_submodule_no_dunder_all.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__f401_preview_first_party_submodule_no_dunder_all.snap index 07dbda1e72..53aa2cf232 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__f401_preview_first_party_submodule_no_dunder_all.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__f401_preview_first_party_submodule_no_dunder_all.snap @@ -1,9 +1,11 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -__init__.py:1:8: F401 `submodule.a` imported but unused; consider removing, adding to `__all__`, or using a redundant alias +error[F401]: 1:8: `submodule.a` imported but unused; consider removing, adding to `__all__`, or using a redundant alias + + --> __init__.py:1:8 | 1 | import submodule.a - | ^^^^^^^^^^^ F401 + | ^^^^^^^^^^^ | = help: Use an explicit re-export: `import submodule as submodule; import submodule.a` diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__f841_dummy_variable_rgx.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__f841_dummy_variable_rgx.snap index 1f506776e6..d39ac7c4c7 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__f841_dummy_variable_rgx.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__f841_dummy_variable_rgx.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F841]: F841_0.py:3:22: [*] Local variable `e` is assigned to but never used +error[F841]: 3:22: [*] Local variable `e` is assigned to but never used + --> F841_0.py:3:22 | 1 | try: 2 | 1 / 0 @@ -20,8 +21,9 @@ error[F841]: F841_0.py:3:22: [*] Local variable `e` is assigned to but never use 5 5 | 6 6 | -error[F841]: F841_0.py:20:5: [*] Local variable `foo` is assigned to but never used +error[F841]: 20:5: [*] Local variable `foo` is assigned to but never used + --> F841_0.py:20:5 | 19 | def f(): 20 | foo = (1, 2) @@ -38,8 +40,9 @@ error[F841]: F841_0.py:20:5: [*] Local variable `foo` is assigned to but never u 22 21 | 23 22 | bar = (1, 2) -error[F841]: F841_0.py:21:6: Local variable `a` is assigned to but never used +error[F841]: 21:6: Local variable `a` is assigned to but never used + --> F841_0.py:21:6 | 19 | def f(): 20 | foo = (1, 2) @@ -49,8 +52,9 @@ error[F841]: F841_0.py:21:6: Local variable `a` is assigned to but never used 23 | bar = (1, 2) | = help: Remove assignment to unused variable `a` -error[F841]: F841_0.py:21:9: Local variable `b` is assigned to but never used +error[F841]: 21:9: Local variable `b` is assigned to but never used + --> F841_0.py:21:9 | 19 | def f(): 20 | foo = (1, 2) @@ -60,8 +64,9 @@ error[F841]: F841_0.py:21:9: Local variable `b` is assigned to but never used 23 | bar = (1, 2) | = help: Remove assignment to unused variable `b` -error[F841]: F841_0.py:26:14: [*] Local variable `baz` is assigned to but never used +error[F841]: 26:14: [*] Local variable `baz` is assigned to but never used + --> F841_0.py:26:14 | 24 | (c, d) = bar 25 | @@ -79,8 +84,9 @@ error[F841]: F841_0.py:26:14: [*] Local variable `baz` is assigned to but never 28 28 | 29 29 | def f(): -error[F841]: F841_0.py:35:5: [*] Local variable `_` is assigned to but never used +error[F841]: 35:5: [*] Local variable `_` is assigned to but never used + --> F841_0.py:35:5 | 34 | def f(): 35 | _ = 1 @@ -98,8 +104,9 @@ error[F841]: F841_0.py:35:5: [*] Local variable `_` is assigned to but never use 37 36 | _discarded = 1 38 37 | -error[F841]: F841_0.py:36:5: [*] Local variable `__` is assigned to but never used +error[F841]: 36:5: [*] Local variable `__` is assigned to but never used + --> F841_0.py:36:5 | 34 | def f(): 35 | _ = 1 @@ -117,8 +124,9 @@ error[F841]: F841_0.py:36:5: [*] Local variable `__` is assigned to but never us 38 37 | 39 38 | -error[F841]: F841_0.py:37:5: [*] Local variable `_discarded` is assigned to but never used +error[F841]: 37:5: [*] Local variable `_discarded` is assigned to but never used + --> F841_0.py:37:5 | 35 | _ = 1 36 | __ = 1 @@ -135,8 +143,9 @@ error[F841]: F841_0.py:37:5: [*] Local variable `_discarded` is assigned to but 39 38 | 40 39 | a = 1 -error[F841]: F841_0.py:51:9: [*] Local variable `b` is assigned to but never used +error[F841]: 51:9: [*] Local variable `b` is assigned to but never used + --> F841_0.py:51:9 | 49 | def c(): 50 | # F841 @@ -156,8 +165,9 @@ error[F841]: F841_0.py:51:9: [*] Local variable `b` is assigned to but never use 53 53 | def d(): 54 54 | nonlocal b -error[F841]: F841_0.py:79:26: [*] Local variable `my_file` is assigned to but never used +error[F841]: 79:26: [*] Local variable `my_file` is assigned to but never used + --> F841_0.py:79:26 | 78 | def f(): 79 | with open("file") as my_file, open("") as ((this, that)): @@ -175,8 +185,9 @@ error[F841]: F841_0.py:79:26: [*] Local variable `my_file` is assigned to but ne 81 81 | 82 82 | -error[F841]: F841_0.py:85:25: [*] Local variable `my_file` is assigned to but never used +error[F841]: 85:25: [*] Local variable `my_file` is assigned to but never used + --> F841_0.py:85:25 | 83 | def f(): 84 | with ( @@ -196,8 +207,9 @@ error[F841]: F841_0.py:85:25: [*] Local variable `my_file` is assigned to but ne 87 87 | ): 88 88 | print("hello") -error[F841]: F841_0.py:102:5: [*] Local variable `msg3` is assigned to but never used +error[F841]: 102:5: [*] Local variable `msg3` is assigned to but never used + --> F841_0.py:102:5 | 100 | msg1 = "Hello, world!" 101 | msg2 = "Hello, world!" @@ -216,8 +228,9 @@ error[F841]: F841_0.py:102:5: [*] Local variable `msg3` is assigned to but never 104 103 | case 1: 105 104 | print(msg1) -error[F841]: F841_0.py:115:5: [*] Local variable `Baz` is assigned to but never used +error[F841]: 115:5: [*] Local variable `Baz` is assigned to but never used + --> F841_0.py:115:5 | 113 | Foo = enum.Enum("Foo", "A B") 114 | Bar = enum.Enum("Bar", "A B") @@ -237,8 +250,9 @@ error[F841]: F841_0.py:115:5: [*] Local variable `Baz` is assigned to but never 117 117 | match x: 118 118 | case (Foo.A): -error[F841]: F841_0.py:122:14: Local variable `y` is assigned to but never used +error[F841]: 122:14: Local variable `y` is assigned to but never used + --> F841_0.py:122:14 | 120 | case [Bar.A, *_]: 121 | print("A") @@ -247,8 +261,9 @@ error[F841]: F841_0.py:122:14: Local variable `y` is assigned to but never used 123 | pass | = help: Remove assignment to unused variable `y` -error[F841]: F841_0.py:127:21: Local variable `value` is assigned to but never used +error[F841]: 127:21: Local variable `value` is assigned to but never used + --> F841_0.py:127:21 | 126 | def f(): 127 | if any((key := (value := x)) for x in ["ok"]): @@ -256,8 +271,9 @@ error[F841]: F841_0.py:127:21: Local variable `value` is assigned to but never u 128 | print(key) | = help: Remove assignment to unused variable `value` -error[F841]: F841_0.py:152:25: [*] Local variable `_` is assigned to but never used +error[F841]: 152:25: [*] Local variable `_` is assigned to but never used + --> F841_0.py:152:25 | 150 | try: 151 | pass diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__future_annotations.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__future_annotations.snap index 2ab3a0aa85..cd3cfa0669 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__future_annotations.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__future_annotations.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F401]: future_annotations.py:8:5: [*] `models.Nut` imported but unused +error[F401]: 8:5: [*] `models.Nut` imported but unused + --> future_annotations.py:8:5 | 6 | from models import ( 7 | Fruit, @@ -20,8 +21,9 @@ error[F401]: future_annotations.py:8:5: [*] `models.Nut` imported but unused 10 9 | 11 10 | -error[F821]: future_annotations.py:26:19: Undefined name `Bar` +error[F821]: 26:19: Undefined name `Bar` + --> future_annotations.py:26:19 | 25 | @classmethod 26 | def c(cls) -> Bar: diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__init.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__init.snap index cd22f83847..83c198e647 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__init.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__init.snap @@ -1,10 +1,12 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -__init__.py:1:8: F401 `os` imported but unused +error[F401]: 1:8: `os` imported but unused + + --> __init__.py:1:8 | 1 | import os - | ^^ F401 + | ^^ 2 | 3 | print(__path__) | diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__load_after_multiple_unbinds_from_module_scope.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__load_after_multiple_unbinds_from_module_scope.snap index 63939acafb..e94d3658b7 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__load_after_multiple_unbinds_from_module_scope.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__load_after_multiple_unbinds_from_module_scope.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F841]: :7:26: [*] Local variable `x` is assigned to but never used +error[F841]: 7:26: [*] Local variable `x` is assigned to but never used + --> :7:26 | 5 | try: 6 | pass @@ -21,8 +22,9 @@ error[F841]: :7:26: [*] Local variable `x` is assigned to but never us 9 9 | 10 10 | try: -error[F841]: :12:26: [*] Local variable `x` is assigned to but never used +error[F841]: 12:26: [*] Local variable `x` is assigned to but never used + --> :12:26 | 10 | try: 11 | pass diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__load_after_unbind_from_class_scope.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__load_after_unbind_from_class_scope.snap index 31e213124d..0ce3f2bcb6 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__load_after_unbind_from_class_scope.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__load_after_unbind_from_class_scope.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F841]: :8:30: [*] Local variable `x` is assigned to but never used +error[F841]: 8:30: [*] Local variable `x` is assigned to but never used + --> :8:30 | 6 | try: 7 | pass @@ -21,8 +22,9 @@ error[F841]: :8:30: [*] Local variable `x` is assigned to but never us 10 10 | 11 11 | # This should raise an F821 error, rather than resolving to the -error[F821]: :13:15: Undefined name `x` +error[F821]: 13:15: Undefined name `x` + --> :13:15 | 11 | # This should raise an F821 error, rather than resolving to the 12 | # `x` in `x = 1`. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__load_after_unbind_from_module_scope.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__load_after_unbind_from_module_scope.snap index 7ef160e0db..17477a82bc 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__load_after_unbind_from_module_scope.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__load_after_unbind_from_module_scope.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F841]: :7:26: [*] Local variable `x` is assigned to but never used +error[F841]: 7:26: [*] Local variable `x` is assigned to but never used + --> :7:26 | 5 | try: 6 | pass diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__load_after_unbind_from_nested_module_scope.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__load_after_unbind_from_nested_module_scope.snap index eeebea1e69..220a62d56a 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__load_after_unbind_from_nested_module_scope.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__load_after_unbind_from_nested_module_scope.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F841]: :7:26: [*] Local variable `x` is assigned to but never used +error[F841]: 7:26: [*] Local variable `x` is assigned to but never used + --> :7:26 | 5 | try: 6 | pass @@ -21,8 +22,9 @@ error[F841]: :7:26: [*] Local variable `x` is assigned to but never us 9 9 | 10 10 | def g(): -error[F841]: :13:30: [*] Local variable `x` is assigned to but never used +error[F841]: 13:30: [*] Local variable `x` is assigned to but never used + --> :13:30 | 11 | try: 12 | pass diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__multi_statement_lines.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__multi_statement_lines.snap index 4d45dcbd52..454f45c148 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__multi_statement_lines.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__multi_statement_lines.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F401]: multi_statement_lines.py:2:12: [*] `foo1` imported but unused +error[F401]: 2:12: [*] `foo1` imported but unused + --> multi_statement_lines.py:2:12 | 1 | if True: 2 | import foo1; x = 1 @@ -18,8 +19,9 @@ error[F401]: multi_statement_lines.py:2:12: [*] `foo1` imported but unused 4 4 | 5 5 | if True: -error[F401]: multi_statement_lines.py:3:12: [*] `foo2` imported but unused +error[F401]: 3:12: [*] `foo2` imported but unused + --> multi_statement_lines.py:3:12 | 1 | if True: 2 | import foo1; x = 1 @@ -38,8 +40,9 @@ error[F401]: multi_statement_lines.py:3:12: [*] `foo2` imported but unused 5 5 | if True: 6 6 | import foo3; \ -error[F401]: multi_statement_lines.py:6:12: [*] `foo3` imported but unused +error[F401]: 6:12: [*] `foo3` imported but unused + --> multi_statement_lines.py:6:12 | 5 | if True: 6 | import foo3; \ @@ -58,8 +61,9 @@ error[F401]: multi_statement_lines.py:6:12: [*] `foo3` imported but unused 9 8 | if True: 10 9 | import foo4 \ -error[F401]: multi_statement_lines.py:10:12: [*] `foo4` imported but unused +error[F401]: 10:12: [*] `foo4` imported but unused + --> multi_statement_lines.py:10:12 | 9 | if True: 10 | import foo4 \ @@ -78,8 +82,9 @@ error[F401]: multi_statement_lines.py:10:12: [*] `foo4` imported but unused 13 12 | if True: 14 13 | x = 1; import foo5 -error[F401]: multi_statement_lines.py:14:19: [*] `foo5` imported but unused +error[F401]: 14:19: [*] `foo5` imported but unused + --> multi_statement_lines.py:14:19 | 13 | if True: 14 | x = 1; import foo5 @@ -96,8 +101,9 @@ error[F401]: multi_statement_lines.py:14:19: [*] `foo5` imported but unused 16 16 | 17 17 | if True: -error[F401]: multi_statement_lines.py:19:17: [*] `foo6` imported but unused +error[F401]: 19:17: [*] `foo6` imported but unused + --> multi_statement_lines.py:19:17 | 17 | if True: 18 | x = 1; \ @@ -118,8 +124,9 @@ error[F401]: multi_statement_lines.py:19:17: [*] `foo6` imported but unused 21 20 | if True: 22 21 | x = 1 \ -error[F401]: multi_statement_lines.py:23:18: [*] `foo7` imported but unused +error[F401]: 23:18: [*] `foo7` imported but unused + --> multi_statement_lines.py:23:18 | 21 | if True: 22 | x = 1 \ @@ -139,8 +146,9 @@ error[F401]: multi_statement_lines.py:23:18: [*] `foo7` imported but unused 25 25 | if True: 26 26 | x = 1; import foo8; x = 1 -error[F401]: multi_statement_lines.py:26:19: [*] `foo8` imported but unused +error[F401]: 26:19: [*] `foo8` imported but unused + --> multi_statement_lines.py:26:19 | 25 | if True: 26 | x = 1; import foo8; x = 1 @@ -158,8 +166,9 @@ error[F401]: multi_statement_lines.py:26:19: [*] `foo8` imported but unused 28 28 | 29 29 | if True: -error[F401]: multi_statement_lines.py:27:23: [*] `foo9` imported but unused +error[F401]: 27:23: [*] `foo9` imported but unused + --> multi_statement_lines.py:27:23 | 25 | if True: 26 | x = 1; import foo8; x = 1 @@ -179,8 +188,9 @@ error[F401]: multi_statement_lines.py:27:23: [*] `foo9` imported but unused 29 29 | if True: 30 30 | x = 1; \ -error[F401]: multi_statement_lines.py:31:16: [*] `foo10` imported but unused +error[F401]: 31:16: [*] `foo10` imported but unused + --> multi_statement_lines.py:31:16 | 29 | if True: 30 | x = 1; \ @@ -200,8 +210,9 @@ error[F401]: multi_statement_lines.py:31:16: [*] `foo10` imported but unused 34 33 | if True: 35 34 | x = 1 \ -error[F401]: multi_statement_lines.py:36:17: [*] `foo11` imported but unused +error[F401]: 36:17: [*] `foo11` imported but unused + --> multi_statement_lines.py:36:17 | 34 | if True: 35 | x = 1 \ @@ -219,8 +230,9 @@ error[F401]: multi_statement_lines.py:36:17: [*] `foo11` imported but unused 38 37 | 39 38 | if True: -error[F401]: multi_statement_lines.py:42:16: [*] `foo12` imported but unused +error[F401]: 42:16: [*] `foo12` imported but unused + --> multi_statement_lines.py:42:16 | 40 | x = 1; \ 41 | \ @@ -242,8 +254,9 @@ error[F401]: multi_statement_lines.py:42:16: [*] `foo12` imported but unused 44 42 | if True: 45 43 | x = 1; \ -error[F401]: multi_statement_lines.py:47:12: [*] `foo13` imported but unused +error[F401]: 47:12: [*] `foo13` imported but unused + --> multi_statement_lines.py:47:12 | 45 | x = 1; \ 46 | \ @@ -263,8 +276,9 @@ error[F401]: multi_statement_lines.py:47:12: [*] `foo13` imported but unused 49 47 | 50 48 | if True: -error[F401]: multi_statement_lines.py:53:12: [*] `foo14` imported but unused +error[F401]: 53:12: [*] `foo14` imported but unused + --> multi_statement_lines.py:53:12 | 51 | x = 1; \ 52 | # \ @@ -283,8 +297,9 @@ error[F401]: multi_statement_lines.py:53:12: [*] `foo14` imported but unused 55 54 | # Continuation, but not as the last content in the file. 56 55 | x = 1; \ -error[F401]: multi_statement_lines.py:57:8: [*] `foo15` imported but unused +error[F401]: 57:8: [*] `foo15` imported but unused + --> multi_statement_lines.py:57:8 | 55 | # Continuation, but not as the last content in the file. 56 | x = 1; \ @@ -305,8 +320,9 @@ error[F401]: multi_statement_lines.py:57:8: [*] `foo15` imported but unused 59 58 | # Continuation, followed by end-of-file. (Removing `import foo` would cause a syntax 60 59 | # error.) -error[F401]: multi_statement_lines.py:62:8: [*] `foo16` imported but unused +error[F401]: 62:8: [*] `foo16` imported but unused + --> multi_statement_lines.py:62:8 | 60 | # error.) 61 | x = 1; \ diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__nested_relative_typing_module.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__nested_relative_typing_module.snap index 2bb2541590..c40b4c0c03 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__nested_relative_typing_module.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__nested_relative_typing_module.snap @@ -1,15 +1,17 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F821]: baz.py:26:17: Undefined name `foo` +error[F821]: 26:17: Undefined name `foo` + --> baz.py:26:17 | 25 | # F821 26 | x: Literal["foo"] | ^^^ | -error[F821]: baz.py:33:17: Undefined name `foo` +error[F821]: 33:17: Undefined name `foo` + --> baz.py:33:17 | 32 | # F821 33 | x: Literal["foo"] diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_24____init__.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_24____init__.py.snap index 1c7ce2e8a7..1c8350020e 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_24____init__.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_24____init__.py.snap @@ -1,13 +1,14 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -__init__.py:19:8: F401 [*] `sys` imported but unused +error[F401]: 19:8: [*] `sys` imported but unused + + --> __init__.py:19:8 | 19 | import sys # F401: remove unused - | ^^^ F401 + | ^^^ | = help: Remove unused import: `sys` - ℹ Unsafe fix 16 16 | import argparse as argparse # Ok: is redundant alias 17 17 | @@ -17,13 +18,14 @@ __init__.py:19:8: F401 [*] `sys` imported but unused 21 20 | 22 21 | # first-party -__init__.py:33:15: F401 [*] `.unused` imported but unused; consider removing, adding to `__all__`, or using a redundant alias +error[F401]: 33:15: [*] `.unused` imported but unused; consider removing, adding to `__all__`, or using a redundant alias + + --> __init__.py:33:15 | 33 | from . import unused # F401: change to redundant alias - | ^^^^^^ F401 + | ^^^^^^ | = help: Use an explicit re-export: `unused as unused` - ℹ Safe fix 30 30 | from . import aliased as aliased # Ok: is redundant alias 31 31 | @@ -34,9 +36,11 @@ __init__.py:33:15: F401 [*] `.unused` imported but unused; consider removing, ad 35 35 | 36 36 | from . import renamed as bees # F401: no fix -__init__.py:36:26: F401 `.renamed` imported but unused; consider removing, adding to `__all__`, or using a redundant alias +error[F401]: 36:26: `.renamed` imported but unused; consider removing, adding to `__all__`, or using a redundant alias + + --> __init__.py:36:26 | 36 | from . import renamed as bees # F401: no fix - | ^^^^ F401 + | ^^^^ | = help: Use an explicit re-export: `renamed as renamed` diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_25__all_nonempty____init__.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_25__all_nonempty____init__.py.snap index cb3e3848d5..fa97b33f5a 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_25__all_nonempty____init__.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_25__all_nonempty____init__.py.snap @@ -1,13 +1,14 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -__init__.py:19:8: F401 [*] `sys` imported but unused +error[F401]: 19:8: [*] `sys` imported but unused + + --> __init__.py:19:8 | 19 | import sys # F401: remove unused - | ^^^ F401 + | ^^^ | = help: Remove unused import: `sys` - ℹ Unsafe fix 16 16 | import argparse # Ok: is exported in __all__ 17 17 | @@ -17,13 +18,14 @@ __init__.py:19:8: F401 [*] `sys` imported but unused 21 20 | 22 21 | # first-party -__init__.py:36:15: F401 [*] `.unused` imported but unused; consider removing, adding to `__all__`, or using a redundant alias +error[F401]: 36:15: [*] `.unused` imported but unused; consider removing, adding to `__all__`, or using a redundant alias + + --> __init__.py:36:15 | 36 | from . import unused # F401: add to __all__ - | ^^^^^^ F401 + | ^^^^^^ | = help: Add unused import `unused` to __all__ - ℹ Safe fix 39 39 | from . import renamed as bees # F401: add to __all__ 40 40 | @@ -31,13 +33,14 @@ __init__.py:36:15: F401 [*] `.unused` imported but unused; consider removing, ad 42 |-__all__ = ["argparse", "exported"] 42 |+__all__ = ["argparse", "exported", "unused"] -__init__.py:39:26: F401 [*] `.renamed` imported but unused; consider removing, adding to `__all__`, or using a redundant alias +error[F401]: 39:26: [*] `.renamed` imported but unused; consider removing, adding to `__all__`, or using a redundant alias + + --> __init__.py:39:26 | 39 | from . import renamed as bees # F401: add to __all__ - | ^^^^ F401 + | ^^^^ | = help: Add unused import `bees` to __all__ - ℹ Safe fix 39 39 | from . import renamed as bees # F401: add to __all__ 40 40 | diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_26__all_empty____init__.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_26__all_empty____init__.py.snap index 1ccfae7465..d6bf4faebd 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_26__all_empty____init__.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_26__all_empty____init__.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F401]: __init__.py:5:15: [*] `.unused` imported but unused; consider removing, adding to `__all__`, or using a redundant alias +error[F401]: 5:15: [*] `.unused` imported but unused; consider removing, adding to `__all__`, or using a redundant alias + --> __init__.py:5:15 | 5 | from . import unused # F401: add to __all__ | ^^^^^^ @@ -15,8 +16,9 @@ error[F401]: __init__.py:5:15: [*] `.unused` imported but unused; consider remov 11 |-__all__ = [] 11 |+__all__ = ["unused"] -error[F401]: __init__.py:8:26: [*] `.renamed` imported but unused; consider removing, adding to `__all__`, or using a redundant alias +error[F401]: 8:26: [*] `.renamed` imported but unused; consider removing, adding to `__all__`, or using a redundant alias + --> __init__.py:8:26 | 8 | from . import renamed as bees # F401: add to __all__ | ^^^^ diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_27__all_mistyped____init__.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_27__all_mistyped____init__.py.snap index 60263009b9..d2cfaedfa5 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_27__all_mistyped____init__.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_27__all_mistyped____init__.py.snap @@ -1,15 +1,17 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F401]: __init__.py:5:15: `.unused` imported but unused; consider removing, adding to `__all__`, or using a redundant alias +error[F401]: 5:15: `.unused` imported but unused; consider removing, adding to `__all__`, or using a redundant alias + --> __init__.py:5:15 | 5 | from . import unused # F401: recommend add to all w/o fix | ^^^^^^ | = help: Add unused import `unused` to __all__ -error[F401]: __init__.py:8:26: `.renamed` imported but unused; consider removing, adding to `__all__`, or using a redundant alias +error[F401]: 8:26: `.renamed` imported but unused; consider removing, adding to `__all__`, or using a redundant alias + --> __init__.py:8:26 | 8 | from . import renamed as bees # F401: recommend add to all w/o fix | ^^^^ diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_28__all_multiple____init__.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_28__all_multiple____init__.py.snap index ae90ef775b..846f8b71bb 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_28__all_multiple____init__.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_28__all_multiple____init__.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F401]: __init__.py:5:15: [*] `.unused` imported but unused; consider removing, adding to `__all__`, or using a redundant alias +error[F401]: 5:15: [*] `.unused` imported but unused; consider removing, adding to `__all__`, or using a redundant alias + --> __init__.py:5:15 | 5 | from . import unused, renamed as bees # F401: add to __all__ | ^^^^^^ @@ -15,8 +16,9 @@ error[F401]: __init__.py:5:15: [*] `.unused` imported but unused; consider remov 8 |-__all__ = []; 8 |+__all__ = ["bees", "unused"]; -error[F401]: __init__.py:5:34: [*] `.renamed` imported but unused; consider removing, adding to `__all__`, or using a redundant alias +error[F401]: 5:34: [*] `.renamed` imported but unused; consider removing, adding to `__all__`, or using a redundant alias + --> __init__.py:5:34 | 5 | from . import unused, renamed as bees # F401: add to __all__ | ^^^^ diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_29__all_conditional____init__.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_29__all_conditional____init__.py.snap index 298e2e6df7..8deea8468b 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_29__all_conditional____init__.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_29__all_conditional____init__.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F401]: __init__.py:8:15: `.unused` imported but unused; consider removing, adding to `__all__`, or using a redundant alias +error[F401]: 8:15: `.unused` imported but unused; consider removing, adding to `__all__`, or using a redundant alias + --> __init__.py:8:15 | 6 | import sys 7 | @@ -12,8 +13,9 @@ error[F401]: __init__.py:8:15: `.unused` imported but unused; consider removing, 10 | if sys.version_info > (3, 9): | = help: Remove unused import -error[F401]: __init__.py:8:44: `.renamed` imported but unused; consider removing, adding to `__all__`, or using a redundant alias +error[F401]: 8:44: `.renamed` imported but unused; consider removing, adding to `__all__`, or using a redundant alias + --> __init__.py:8:44 | 6 | import sys 7 | diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401___init__.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401___init__.py.snap index 3f4855817c..740e2b3341 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401___init__.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401___init__.py.snap @@ -1,15 +1,16 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -__init__.py:1:8: F401 [*] `os` imported but unused +error[F401]: 1:8: [*] `os` imported but unused + + --> __init__.py:1:8 | 1 | import os - | ^^ F401 + | ^^ 2 | 3 | print(__path__) | = help: Remove unused import: `os` - ℹ Unsafe fix 1 |-import os 2 1 | diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F822___init__.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F822___init__.py.snap index 66536f87ff..df63d978e3 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F822___init__.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F822___init__.py.snap @@ -1,24 +1,27 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F822]: __init__.py:5:12: Undefined name `a` in `__all__` +error[F822]: 5:12: Undefined name `a` in `__all__` + --> __init__.py:5:12 | 3 | print(__path__) 4 | 5 | __all__ = ["a", "b", "c"] | ^^^ | -error[F822]: __init__.py:5:17: Undefined name `b` in `__all__` +error[F822]: 5:17: Undefined name `b` in `__all__` + --> __init__.py:5:17 | 3 | print(__path__) 4 | 5 | __all__ = ["a", "b", "c"] | ^^^ | -error[F822]: __init__.py:5:22: Undefined name `c` in `__all__` +error[F822]: 5:22: Undefined name `c` in `__all__` + --> __init__.py:5:22 | 3 | print(__path__) 4 | diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F841_F841_4.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F841_F841_4.py.snap index 4fddcec992..d4608520c1 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F841_F841_4.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F841_F841_4.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F841]: F841_4.py:12:5: [*] Local variable `a` is assigned to but never used +error[F841]: 12:5: [*] Local variable `a` is assigned to but never used + --> F841_4.py:12:5 | 11 | def bar(): 12 | a = foo() @@ -20,8 +21,9 @@ error[F841]: F841_4.py:12:5: [*] Local variable `a` is assigned to but never use 14 14 | 15 15 | -error[F841]: F841_4.py:13:5: [*] Local variable `b` is assigned to but never used +error[F841]: 13:5: [*] Local variable `b` is assigned to but never used + --> F841_4.py:13:5 | 11 | def bar(): 12 | a = foo() @@ -39,8 +41,9 @@ error[F841]: F841_4.py:13:5: [*] Local variable `b` is assigned to but never use 15 15 | 16 16 | def baz(): -error[F841]: F841_4.py:13:8: [*] Local variable `c` is assigned to but never used +error[F841]: 13:8: [*] Local variable `c` is assigned to but never used + --> F841_4.py:13:8 | 11 | def bar(): 12 | a = foo() diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__print_in_body_after_double_shadowing_except.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__print_in_body_after_double_shadowing_except.snap index a2c4a8b4f9..679ed29026 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__print_in_body_after_double_shadowing_except.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__print_in_body_after_double_shadowing_except.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F841]: :7:26: [*] Local variable `x` is assigned to but never used +error[F841]: 7:26: [*] Local variable `x` is assigned to but never used + --> :7:26 | 5 | try: 6 | 1 / 0 @@ -22,8 +23,9 @@ error[F841]: :7:26: [*] Local variable `x` is assigned to but never us 9 9 | except ImportError as x: 10 10 | pass -error[F841]: :9:27: [*] Local variable `x` is assigned to but never used +error[F841]: 9:27: [*] Local variable `x` is assigned to but never used + --> :9:27 | 7 | except ValueError as x: 8 | pass diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__print_in_body_after_shadowing_except.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__print_in_body_after_shadowing_except.snap index aa08884610..38b3bda439 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__print_in_body_after_shadowing_except.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__print_in_body_after_shadowing_except.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F841]: :7:25: [*] Local variable `x` is assigned to but never used +error[F841]: 7:25: [*] Local variable `x` is assigned to but never used + --> :7:25 | 5 | try: 6 | 1 / 0 diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__relative_typing_module.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__relative_typing_module.snap index 766c42c32b..d10360042e 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__relative_typing_module.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__relative_typing_module.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -error[F821]: bar.py:26:17: Undefined name `foo` +error[F821]: 26:17: Undefined name `foo` + --> bar.py:26:17 | 25 | # F821 26 | x: Literal["foo"] diff --git a/crates/ruff_linter/src/rules/pygrep_hooks/snapshots/ruff_linter__rules__pygrep_hooks__tests__PGH003_PGH003_0.py.snap b/crates/ruff_linter/src/rules/pygrep_hooks/snapshots/ruff_linter__rules__pygrep_hooks__tests__PGH003_PGH003_0.py.snap index e564ac1768..ded7231b6e 100644 --- a/crates/ruff_linter/src/rules/pygrep_hooks/snapshots/ruff_linter__rules__pygrep_hooks__tests__PGH003_PGH003_0.py.snap +++ b/crates/ruff_linter/src/rules/pygrep_hooks/snapshots/ruff_linter__rules__pygrep_hooks__tests__PGH003_PGH003_0.py.snap @@ -1,16 +1,18 @@ --- source: crates/ruff_linter/src/rules/pygrep_hooks/mod.rs --- -error[PGH003]: PGH003_0.py:1:8: Use specific rule codes when ignoring type issues +error[PGH003]: 1:8: Use specific rule codes when ignoring type issues + --> PGH003_0.py:1:8 | 1 | x = 1 # type: ignore | ^^^^^^^^^^^^^^ 2 | x = 1 # type:ignore 3 | x = 1 # type: ignore[attr-defined] # type: ignore | -error[PGH003]: PGH003_0.py:2:8: Use specific rule codes when ignoring type issues +error[PGH003]: 2:8: Use specific rule codes when ignoring type issues + --> PGH003_0.py:2:8 | 1 | x = 1 # type: ignore 2 | x = 1 # type:ignore @@ -18,8 +20,9 @@ error[PGH003]: PGH003_0.py:2:8: Use specific rule codes when ignoring type issue 3 | x = 1 # type: ignore[attr-defined] # type: ignore 4 | x = 1 # type: ignoreme # type: ignore | -error[PGH003]: PGH003_0.py:3:38: Use specific rule codes when ignoring type issues +error[PGH003]: 3:38: Use specific rule codes when ignoring type issues + --> PGH003_0.py:3:38 | 1 | x = 1 # type: ignore 2 | x = 1 # type:ignore @@ -27,8 +30,9 @@ error[PGH003]: PGH003_0.py:3:38: Use specific rule codes when ignoring type issu | ^^^^^^^^^^^^^^ 4 | x = 1 # type: ignoreme # type: ignore | -error[PGH003]: PGH003_0.py:4:25: Use specific rule codes when ignoring type issues +error[PGH003]: 4:25: Use specific rule codes when ignoring type issues + --> PGH003_0.py:4:25 | 2 | x = 1 # type:ignore 3 | x = 1 # type: ignore[attr-defined] # type: ignore diff --git a/crates/ruff_linter/src/rules/pygrep_hooks/snapshots/ruff_linter__rules__pygrep_hooks__tests__PGH003_PGH003_1.py.snap b/crates/ruff_linter/src/rules/pygrep_hooks/snapshots/ruff_linter__rules__pygrep_hooks__tests__PGH003_PGH003_1.py.snap index d70d78055b..16b7074c1d 100644 --- a/crates/ruff_linter/src/rules/pygrep_hooks/snapshots/ruff_linter__rules__pygrep_hooks__tests__PGH003_PGH003_1.py.snap +++ b/crates/ruff_linter/src/rules/pygrep_hooks/snapshots/ruff_linter__rules__pygrep_hooks__tests__PGH003_PGH003_1.py.snap @@ -1,24 +1,27 @@ --- source: crates/ruff_linter/src/rules/pygrep_hooks/mod.rs --- -error[PGH003]: PGH003_1.py:1:8: Use specific rule codes when ignoring type issues +error[PGH003]: 1:8: Use specific rule codes when ignoring type issues + --> PGH003_1.py:1:8 | 1 | x = 1 # pyright: ignore | ^^^^^^^^^^^^^^^^^ 2 | x = 1 # pyright:ignore 3 | x = 1 # pyright: ignore[attr-defined] # pyright: ignore | -error[PGH003]: PGH003_1.py:2:8: Use specific rule codes when ignoring type issues +error[PGH003]: 2:8: Use specific rule codes when ignoring type issues + --> PGH003_1.py:2:8 | 1 | x = 1 # pyright: ignore 2 | x = 1 # pyright:ignore | ^^^^^^^^^^^^^^^^ 3 | x = 1 # pyright: ignore[attr-defined] # pyright: ignore | -error[PGH003]: PGH003_1.py:3:41: Use specific rule codes when ignoring type issues +error[PGH003]: 3:41: Use specific rule codes when ignoring type issues + --> PGH003_1.py:3:41 | 1 | x = 1 # pyright: ignore 2 | x = 1 # pyright:ignore diff --git a/crates/ruff_linter/src/rules/pygrep_hooks/snapshots/ruff_linter__rules__pygrep_hooks__tests__PGH004_PGH004_0.py.snap b/crates/ruff_linter/src/rules/pygrep_hooks/snapshots/ruff_linter__rules__pygrep_hooks__tests__PGH004_PGH004_0.py.snap index d4fa09047c..f80e24a95d 100644 --- a/crates/ruff_linter/src/rules/pygrep_hooks/snapshots/ruff_linter__rules__pygrep_hooks__tests__PGH004_PGH004_0.py.snap +++ b/crates/ruff_linter/src/rules/pygrep_hooks/snapshots/ruff_linter__rules__pygrep_hooks__tests__PGH004_PGH004_0.py.snap @@ -1,16 +1,18 @@ --- source: crates/ruff_linter/src/rules/pygrep_hooks/mod.rs --- -error[PGH004]: PGH004_0.py:1:8: Use specific rule codes when using `noqa` +error[PGH004]: 1:8: Use specific rule codes when using `noqa` + --> PGH004_0.py:1:8 | 1 | x = 1 # noqa | ^^^^^^ 2 | x = 1 # NOQA:F401,W203 3 | # noqa | -error[PGH004]: PGH004_0.py:3:1: Use specific rule codes when using `noqa` +error[PGH004]: 3:1: Use specific rule codes when using `noqa` + --> PGH004_0.py:2:24 | 1 | x = 1 # noqa 2 | x = 1 # NOQA:F401,W203 @@ -19,8 +21,9 @@ error[PGH004]: PGH004_0.py:3:1: Use specific rule codes when using `noqa` 4 | # NOQA 5 | # noqa:F401 | -error[PGH004]: PGH004_0.py:4:1: Use specific rule codes when using `noqa` +error[PGH004]: 4:1: Use specific rule codes when using `noqa` + --> PGH004_0.py:3:7 | 2 | x = 1 # NOQA:F401,W203 3 | # noqa @@ -29,8 +32,9 @@ error[PGH004]: PGH004_0.py:4:1: Use specific rule codes when using `noqa` 5 | # noqa:F401 6 | # noqa:F401,W203 | -error[PGH004]: PGH004_0.py:18:8: [*] Use a colon when specifying `noqa` rule codes +error[PGH004]: 18:8: [*] Use a colon when specifying `noqa` rule codes + --> PGH004_0.py:18:8 | 17 | # PGH004 18 | x = 2 # noqa X100 @@ -49,8 +53,9 @@ error[PGH004]: PGH004_0.py:18:8: [*] Use a colon when specifying `noqa` rule cod 20 20 | # PGH004 21 21 | x = 2 # noqa X100, X200 -error[PGH004]: PGH004_0.py:21:8: [*] Use a colon when specifying `noqa` rule codes +error[PGH004]: 21:8: [*] Use a colon when specifying `noqa` rule codes + --> PGH004_0.py:21:8 | 20 | # PGH004 21 | x = 2 # noqa X100, X200 @@ -69,8 +74,9 @@ error[PGH004]: PGH004_0.py:21:8: [*] Use a colon when specifying `noqa` rule cod 23 23 | # PGH004 24 24 | x = 2 # noqa : X300 -error[PGH004]: PGH004_0.py:24:8: [*] Do not add spaces between `noqa` and its colon +error[PGH004]: 24:8: [*] Do not add spaces between `noqa` and its colon + --> PGH004_0.py:24:8 | 23 | # PGH004 24 | x = 2 # noqa : X300 @@ -89,8 +95,9 @@ error[PGH004]: PGH004_0.py:24:8: [*] Do not add spaces between `noqa` and its co 26 26 | # PGH004 27 27 | x = 2 # noqa : X400 -error[PGH004]: PGH004_0.py:27:8: [*] Do not add spaces between `noqa` and its colon +error[PGH004]: 27:8: [*] Do not add spaces between `noqa` and its colon + --> PGH004_0.py:27:8 | 26 | # PGH004 27 | x = 2 # noqa : X400 @@ -109,8 +116,9 @@ error[PGH004]: PGH004_0.py:27:8: [*] Do not add spaces between `noqa` and its co 29 29 | # PGH004 30 30 | x = 2 # noqa :X500 -error[PGH004]: PGH004_0.py:30:8: [*] Do not add spaces between `noqa` and its colon +error[PGH004]: 30:8: [*] Do not add spaces between `noqa` and its colon + --> PGH004_0.py:30:8 | 29 | # PGH004 30 | x = 2 # noqa :X500 diff --git a/crates/ruff_linter/src/rules/pygrep_hooks/snapshots/ruff_linter__rules__pygrep_hooks__tests__PGH004_PGH004_1.py.snap b/crates/ruff_linter/src/rules/pygrep_hooks/snapshots/ruff_linter__rules__pygrep_hooks__tests__PGH004_PGH004_1.py.snap index a17087861d..1c96abdc5b 100644 --- a/crates/ruff_linter/src/rules/pygrep_hooks/snapshots/ruff_linter__rules__pygrep_hooks__tests__PGH004_PGH004_1.py.snap +++ b/crates/ruff_linter/src/rules/pygrep_hooks/snapshots/ruff_linter__rules__pygrep_hooks__tests__PGH004_PGH004_1.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pygrep_hooks/mod.rs --- -error[PGH004]: PGH004_1.py:1:1: Use specific rule codes when using `noqa` +error[PGH004]: 1:1: Use specific rule codes when using `noqa` + --> PGH004_1.py:1:1 | 1 | #noqa | ^^^^^ diff --git a/crates/ruff_linter/src/rules/pygrep_hooks/snapshots/ruff_linter__rules__pygrep_hooks__tests__PGH004_PGH004_2.py.snap b/crates/ruff_linter/src/rules/pygrep_hooks/snapshots/ruff_linter__rules__pygrep_hooks__tests__PGH004_PGH004_2.py.snap index e2b9bdf292..fd32f261c1 100644 --- a/crates/ruff_linter/src/rules/pygrep_hooks/snapshots/ruff_linter__rules__pygrep_hooks__tests__PGH004_PGH004_2.py.snap +++ b/crates/ruff_linter/src/rules/pygrep_hooks/snapshots/ruff_linter__rules__pygrep_hooks__tests__PGH004_PGH004_2.py.snap @@ -1,10 +1,12 @@ --- source: crates/ruff_linter/src/rules/pygrep_hooks/mod.rs --- -PGH004_2.py:1:1: PGH004 Use specific rule codes when using `noqa` +error[PGH004]: 1:1: Use specific rule codes when using `noqa` + + --> PGH004_2.py:1:1 | 1 | # noqa - | ^^^^^^ PGH004 + | ^^^^^^ 2 | # ruff : noqa 3 | # ruff: noqa: F401 | diff --git a/crates/ruff_linter/src/rules/pygrep_hooks/snapshots/ruff_linter__rules__pygrep_hooks__tests__PGH005_PGH005_0.py.snap b/crates/ruff_linter/src/rules/pygrep_hooks/snapshots/ruff_linter__rules__pygrep_hooks__tests__PGH005_PGH005_0.py.snap index 41dd4a1eb7..af27a09e48 100644 --- a/crates/ruff_linter/src/rules/pygrep_hooks/snapshots/ruff_linter__rules__pygrep_hooks__tests__PGH005_PGH005_0.py.snap +++ b/crates/ruff_linter/src/rules/pygrep_hooks/snapshots/ruff_linter__rules__pygrep_hooks__tests__PGH005_PGH005_0.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pygrep_hooks/mod.rs --- -error[PGH005]: PGH005_0.py:2:8: Non-existent mock method: `not_called` +error[PGH005]: 2:8: Non-existent mock method: `not_called` + --> PGH005_0.py:2:8 | 1 | # Errors 2 | assert my_mock.not_called() @@ -10,8 +11,9 @@ error[PGH005]: PGH005_0.py:2:8: Non-existent mock method: `not_called` 3 | assert my_mock.called_once_with() 4 | assert my_mock.not_called | -error[PGH005]: PGH005_0.py:3:8: Non-existent mock method: `called_once_with` +error[PGH005]: 3:8: Non-existent mock method: `called_once_with` + --> PGH005_0.py:3:8 | 1 | # Errors 2 | assert my_mock.not_called() @@ -20,8 +22,9 @@ error[PGH005]: PGH005_0.py:3:8: Non-existent mock method: `called_once_with` 4 | assert my_mock.not_called 5 | assert my_mock.called_once_with | -error[PGH005]: PGH005_0.py:4:8: Non-existent mock method: `not_called` +error[PGH005]: 4:8: Non-existent mock method: `not_called` + --> PGH005_0.py:4:8 | 2 | assert my_mock.not_called() 3 | assert my_mock.called_once_with() @@ -30,8 +33,9 @@ error[PGH005]: PGH005_0.py:4:8: Non-existent mock method: `not_called` 5 | assert my_mock.called_once_with 6 | my_mock.assert_not_called | -error[PGH005]: PGH005_0.py:5:8: Non-existent mock method: `called_once_with` +error[PGH005]: 5:8: Non-existent mock method: `called_once_with` + --> PGH005_0.py:5:8 | 3 | assert my_mock.called_once_with() 4 | assert my_mock.not_called @@ -40,8 +44,9 @@ error[PGH005]: PGH005_0.py:5:8: Non-existent mock method: `called_once_with` 6 | my_mock.assert_not_called 7 | my_mock.assert_called | -error[PGH005]: PGH005_0.py:6:1: Mock method should be called: `assert_not_called` +error[PGH005]: 6:1: Mock method should be called: `assert_not_called` + --> PGH005_0.py:5:32 | 4 | assert my_mock.not_called 5 | assert my_mock.called_once_with @@ -50,8 +55,9 @@ error[PGH005]: PGH005_0.py:6:1: Mock method should be called: `assert_not_called 7 | my_mock.assert_called 8 | my_mock.assert_called_once_with | -error[PGH005]: PGH005_0.py:7:1: Mock method should be called: `assert_called` +error[PGH005]: 7:1: Mock method should be called: `assert_called` + --> PGH005_0.py:6:26 | 5 | assert my_mock.called_once_with 6 | my_mock.assert_not_called @@ -60,8 +66,9 @@ error[PGH005]: PGH005_0.py:7:1: Mock method should be called: `assert_called` 8 | my_mock.assert_called_once_with 9 | my_mock.assert_called_once_with | -error[PGH005]: PGH005_0.py:8:1: Mock method should be called: `assert_called_once_with` +error[PGH005]: 8:1: Mock method should be called: `assert_called_once_with` + --> PGH005_0.py:7:22 | 6 | my_mock.assert_not_called 7 | my_mock.assert_called @@ -70,8 +77,9 @@ error[PGH005]: PGH005_0.py:8:1: Mock method should be called: `assert_called_onc 9 | my_mock.assert_called_once_with 10 | MyMock.assert_called_once_with | -error[PGH005]: PGH005_0.py:9:1: Mock method should be called: `assert_called_once_with` +error[PGH005]: 9:1: Mock method should be called: `assert_called_once_with` + --> PGH005_0.py:8:32 | 7 | my_mock.assert_called 8 | my_mock.assert_called_once_with @@ -79,8 +87,9 @@ error[PGH005]: PGH005_0.py:9:1: Mock method should be called: `assert_called_onc | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 10 | MyMock.assert_called_once_with | -error[PGH005]: PGH005_0.py:10:1: Mock method should be called: `assert_called_once_with` +error[PGH005]: 10:1: Mock method should be called: `assert_called_once_with` + --> PGH005_0.py:9:32 | 8 | my_mock.assert_called_once_with 9 | my_mock.assert_called_once_with diff --git a/crates/ruff_linter/src/rules/pygrep_hooks/snapshots/ruff_linter__rules__pygrep_hooks__tests__preview__PGH004_PGH004_2.py.snap b/crates/ruff_linter/src/rules/pygrep_hooks/snapshots/ruff_linter__rules__pygrep_hooks__tests__preview__PGH004_PGH004_2.py.snap index 6c93b8a108..6cab476447 100644 --- a/crates/ruff_linter/src/rules/pygrep_hooks/snapshots/ruff_linter__rules__pygrep_hooks__tests__preview__PGH004_PGH004_2.py.snap +++ b/crates/ruff_linter/src/rules/pygrep_hooks/snapshots/ruff_linter__rules__pygrep_hooks__tests__preview__PGH004_PGH004_2.py.snap @@ -1,25 +1,29 @@ --- source: crates/ruff_linter/src/rules/pygrep_hooks/mod.rs --- -PGH004_2.py:1:1: PGH004 Use specific rule codes when using `noqa` +error[PGH004]: 1:1: Use specific rule codes when using `noqa` + + --> PGH004_2.py:1:1 | 1 | # noqa - | ^^^^^^ PGH004 + | ^^^^^^ 2 | # ruff : noqa 3 | # ruff: noqa: F401 | +error[PGH004]: 2:1: Use specific rule codes when using `ruff: noqa` -PGH004_2.py:2:1: PGH004 Use specific rule codes when using `ruff: noqa` + --> PGH004_2.py:1:7 | 1 | # noqa 2 | # ruff : noqa - | ^^^^^^^^^^^^^ PGH004 + | ^^^^^^^^^^^^^ 3 | # ruff: noqa: F401 | +error[PGH004]: 6:1: Use specific rule codes when using `ruff: noqa` -PGH004_2.py:6:1: PGH004 Use specific rule codes when using `ruff: noqa` + --> PGH004_2.py:6:1 | 6 | # flake8: noqa - | ^^^^^^^^^^^^^^ PGH004 + | ^^^^^^^^^^^^^^ 7 | import math as m | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0105_type_name_incorrect_variance.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0105_type_name_incorrect_variance.py.snap index acb3ae2b2b..240e5bc6ab 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0105_type_name_incorrect_variance.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0105_type_name_incorrect_variance.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLC0105]: type_name_incorrect_variance.py:5:5: `TypeVar` name "T" does not reflect its covariance; consider renaming it to "T_co" +error[PLC0105]: 5:5: `TypeVar` name "T" does not reflect its covariance; consider renaming it to "T_co" + --> type_name_incorrect_variance.py:5:5 | 3 | # Errors. 4 | @@ -11,8 +12,9 @@ error[PLC0105]: type_name_incorrect_variance.py:5:5: `TypeVar` name "T" does not 6 | T = TypeVar("T", covariant=True, contravariant=False) 7 | T = TypeVar("T", contravariant=True) | -error[PLC0105]: type_name_incorrect_variance.py:6:5: `TypeVar` name "T" does not reflect its covariance; consider renaming it to "T_co" +error[PLC0105]: 6:5: `TypeVar` name "T" does not reflect its covariance; consider renaming it to "T_co" + --> type_name_incorrect_variance.py:6:5 | 5 | T = TypeVar("T", covariant=True) 6 | T = TypeVar("T", covariant=True, contravariant=False) @@ -20,8 +22,9 @@ error[PLC0105]: type_name_incorrect_variance.py:6:5: `TypeVar` name "T" does not 7 | T = TypeVar("T", contravariant=True) 8 | T = TypeVar("T", covariant=False, contravariant=True) | -error[PLC0105]: type_name_incorrect_variance.py:7:5: `TypeVar` name "T" does not reflect its contravariance; consider renaming it to "T_contra" +error[PLC0105]: 7:5: `TypeVar` name "T" does not reflect its contravariance; consider renaming it to "T_contra" + --> type_name_incorrect_variance.py:7:5 | 5 | T = TypeVar("T", covariant=True) 6 | T = TypeVar("T", covariant=True, contravariant=False) @@ -30,8 +33,9 @@ error[PLC0105]: type_name_incorrect_variance.py:7:5: `TypeVar` name "T" does not 8 | T = TypeVar("T", covariant=False, contravariant=True) 9 | P = ParamSpec("P", covariant=True) | -error[PLC0105]: type_name_incorrect_variance.py:8:5: `TypeVar` name "T" does not reflect its contravariance; consider renaming it to "T_contra" +error[PLC0105]: 8:5: `TypeVar` name "T" does not reflect its contravariance; consider renaming it to "T_contra" + --> type_name_incorrect_variance.py:8:5 | 6 | T = TypeVar("T", covariant=True, contravariant=False) 7 | T = TypeVar("T", contravariant=True) @@ -40,8 +44,9 @@ error[PLC0105]: type_name_incorrect_variance.py:8:5: `TypeVar` name "T" does not 9 | P = ParamSpec("P", covariant=True) 10 | P = ParamSpec("P", covariant=True, contravariant=False) | -error[PLC0105]: type_name_incorrect_variance.py:9:5: `ParamSpec` name "P" does not reflect its covariance; consider renaming it to "P_co" +error[PLC0105]: 9:5: `ParamSpec` name "P" does not reflect its covariance; consider renaming it to "P_co" + --> type_name_incorrect_variance.py:9:5 | 7 | T = TypeVar("T", contravariant=True) 8 | T = TypeVar("T", covariant=False, contravariant=True) @@ -50,8 +55,9 @@ error[PLC0105]: type_name_incorrect_variance.py:9:5: `ParamSpec` name "P" does n 10 | P = ParamSpec("P", covariant=True, contravariant=False) 11 | P = ParamSpec("P", contravariant=True) | -error[PLC0105]: type_name_incorrect_variance.py:10:5: `ParamSpec` name "P" does not reflect its covariance; consider renaming it to "P_co" +error[PLC0105]: 10:5: `ParamSpec` name "P" does not reflect its covariance; consider renaming it to "P_co" + --> type_name_incorrect_variance.py:10:5 | 8 | T = TypeVar("T", covariant=False, contravariant=True) 9 | P = ParamSpec("P", covariant=True) @@ -60,8 +66,9 @@ error[PLC0105]: type_name_incorrect_variance.py:10:5: `ParamSpec` name "P" does 11 | P = ParamSpec("P", contravariant=True) 12 | P = ParamSpec("P", covariant=False, contravariant=True) | -error[PLC0105]: type_name_incorrect_variance.py:11:5: `ParamSpec` name "P" does not reflect its contravariance; consider renaming it to "P_contra" +error[PLC0105]: 11:5: `ParamSpec` name "P" does not reflect its contravariance; consider renaming it to "P_contra" + --> type_name_incorrect_variance.py:11:5 | 9 | P = ParamSpec("P", covariant=True) 10 | P = ParamSpec("P", covariant=True, contravariant=False) @@ -69,8 +76,9 @@ error[PLC0105]: type_name_incorrect_variance.py:11:5: `ParamSpec` name "P" does | ^^^^^^^^^ 12 | P = ParamSpec("P", covariant=False, contravariant=True) | -error[PLC0105]: type_name_incorrect_variance.py:12:5: `ParamSpec` name "P" does not reflect its contravariance; consider renaming it to "P_contra" +error[PLC0105]: 12:5: `ParamSpec` name "P" does not reflect its contravariance; consider renaming it to "P_contra" + --> type_name_incorrect_variance.py:12:5 | 10 | P = ParamSpec("P", covariant=True, contravariant=False) 11 | P = ParamSpec("P", contravariant=True) @@ -79,8 +87,9 @@ error[PLC0105]: type_name_incorrect_variance.py:12:5: `ParamSpec` name "P" does 13 | 14 | T_co = TypeVar("T_co") | -error[PLC0105]: type_name_incorrect_variance.py:14:8: `TypeVar` name "T_co" does not reflect its invariance; consider renaming it to "T" +error[PLC0105]: 14:8: `TypeVar` name "T_co" does not reflect its invariance; consider renaming it to "T" + --> type_name_incorrect_variance.py:14:8 | 12 | P = ParamSpec("P", covariant=False, contravariant=True) 13 | @@ -89,8 +98,9 @@ error[PLC0105]: type_name_incorrect_variance.py:14:8: `TypeVar` name "T_co" does 15 | T_co = TypeVar("T_co", covariant=False) 16 | T_co = TypeVar("T_co", contravariant=False) | -error[PLC0105]: type_name_incorrect_variance.py:15:8: `TypeVar` name "T_co" does not reflect its invariance; consider renaming it to "T" +error[PLC0105]: 15:8: `TypeVar` name "T_co" does not reflect its invariance; consider renaming it to "T" + --> type_name_incorrect_variance.py:15:8 | 14 | T_co = TypeVar("T_co") 15 | T_co = TypeVar("T_co", covariant=False) @@ -98,8 +108,9 @@ error[PLC0105]: type_name_incorrect_variance.py:15:8: `TypeVar` name "T_co" does 16 | T_co = TypeVar("T_co", contravariant=False) 17 | T_co = TypeVar("T_co", covariant=False, contravariant=False) | -error[PLC0105]: type_name_incorrect_variance.py:16:8: `TypeVar` name "T_co" does not reflect its invariance; consider renaming it to "T" +error[PLC0105]: 16:8: `TypeVar` name "T_co" does not reflect its invariance; consider renaming it to "T" + --> type_name_incorrect_variance.py:16:8 | 14 | T_co = TypeVar("T_co") 15 | T_co = TypeVar("T_co", covariant=False) @@ -108,8 +119,9 @@ error[PLC0105]: type_name_incorrect_variance.py:16:8: `TypeVar` name "T_co" does 17 | T_co = TypeVar("T_co", covariant=False, contravariant=False) 18 | T_co = TypeVar("T_co", contravariant=True) | -error[PLC0105]: type_name_incorrect_variance.py:17:8: `TypeVar` name "T_co" does not reflect its invariance; consider renaming it to "T" +error[PLC0105]: 17:8: `TypeVar` name "T_co" does not reflect its invariance; consider renaming it to "T" + --> type_name_incorrect_variance.py:17:8 | 15 | T_co = TypeVar("T_co", covariant=False) 16 | T_co = TypeVar("T_co", contravariant=False) @@ -118,8 +130,9 @@ error[PLC0105]: type_name_incorrect_variance.py:17:8: `TypeVar` name "T_co" does 18 | T_co = TypeVar("T_co", contravariant=True) 19 | T_co = TypeVar("T_co", covariant=False, contravariant=True) | -error[PLC0105]: type_name_incorrect_variance.py:18:8: `TypeVar` name "T_co" does not reflect its contravariance; consider renaming it to "T_contra" +error[PLC0105]: 18:8: `TypeVar` name "T_co" does not reflect its contravariance; consider renaming it to "T_contra" + --> type_name_incorrect_variance.py:18:8 | 16 | T_co = TypeVar("T_co", contravariant=False) 17 | T_co = TypeVar("T_co", covariant=False, contravariant=False) @@ -128,8 +141,9 @@ error[PLC0105]: type_name_incorrect_variance.py:18:8: `TypeVar` name "T_co" does 19 | T_co = TypeVar("T_co", covariant=False, contravariant=True) 20 | P_co = ParamSpec("P_co") | -error[PLC0105]: type_name_incorrect_variance.py:19:8: `TypeVar` name "T_co" does not reflect its contravariance; consider renaming it to "T_contra" +error[PLC0105]: 19:8: `TypeVar` name "T_co" does not reflect its contravariance; consider renaming it to "T_contra" + --> type_name_incorrect_variance.py:19:8 | 17 | T_co = TypeVar("T_co", covariant=False, contravariant=False) 18 | T_co = TypeVar("T_co", contravariant=True) @@ -138,8 +152,9 @@ error[PLC0105]: type_name_incorrect_variance.py:19:8: `TypeVar` name "T_co" does 20 | P_co = ParamSpec("P_co") 21 | P_co = ParamSpec("P_co", covariant=False) | -error[PLC0105]: type_name_incorrect_variance.py:20:8: `ParamSpec` name "P_co" does not reflect its invariance; consider renaming it to "P" +error[PLC0105]: 20:8: `ParamSpec` name "P_co" does not reflect its invariance; consider renaming it to "P" + --> type_name_incorrect_variance.py:20:8 | 18 | T_co = TypeVar("T_co", contravariant=True) 19 | T_co = TypeVar("T_co", covariant=False, contravariant=True) @@ -148,8 +163,9 @@ error[PLC0105]: type_name_incorrect_variance.py:20:8: `ParamSpec` name "P_co" do 21 | P_co = ParamSpec("P_co", covariant=False) 22 | P_co = ParamSpec("P_co", contravariant=False) | -error[PLC0105]: type_name_incorrect_variance.py:21:8: `ParamSpec` name "P_co" does not reflect its invariance; consider renaming it to "P" +error[PLC0105]: 21:8: `ParamSpec` name "P_co" does not reflect its invariance; consider renaming it to "P" + --> type_name_incorrect_variance.py:21:8 | 19 | T_co = TypeVar("T_co", covariant=False, contravariant=True) 20 | P_co = ParamSpec("P_co") @@ -158,8 +174,9 @@ error[PLC0105]: type_name_incorrect_variance.py:21:8: `ParamSpec` name "P_co" do 22 | P_co = ParamSpec("P_co", contravariant=False) 23 | P_co = ParamSpec("P_co", covariant=False, contravariant=False) | -error[PLC0105]: type_name_incorrect_variance.py:22:8: `ParamSpec` name "P_co" does not reflect its invariance; consider renaming it to "P" +error[PLC0105]: 22:8: `ParamSpec` name "P_co" does not reflect its invariance; consider renaming it to "P" + --> type_name_incorrect_variance.py:22:8 | 20 | P_co = ParamSpec("P_co") 21 | P_co = ParamSpec("P_co", covariant=False) @@ -168,8 +185,9 @@ error[PLC0105]: type_name_incorrect_variance.py:22:8: `ParamSpec` name "P_co" do 23 | P_co = ParamSpec("P_co", covariant=False, contravariant=False) 24 | P_co = ParamSpec("P_co", contravariant=True) | -error[PLC0105]: type_name_incorrect_variance.py:23:8: `ParamSpec` name "P_co" does not reflect its invariance; consider renaming it to "P" +error[PLC0105]: 23:8: `ParamSpec` name "P_co" does not reflect its invariance; consider renaming it to "P" + --> type_name_incorrect_variance.py:23:8 | 21 | P_co = ParamSpec("P_co", covariant=False) 22 | P_co = ParamSpec("P_co", contravariant=False) @@ -178,8 +196,9 @@ error[PLC0105]: type_name_incorrect_variance.py:23:8: `ParamSpec` name "P_co" do 24 | P_co = ParamSpec("P_co", contravariant=True) 25 | P_co = ParamSpec("P_co", covariant=False, contravariant=True) | -error[PLC0105]: type_name_incorrect_variance.py:24:8: `ParamSpec` name "P_co" does not reflect its contravariance; consider renaming it to "P_contra" +error[PLC0105]: 24:8: `ParamSpec` name "P_co" does not reflect its contravariance; consider renaming it to "P_contra" + --> type_name_incorrect_variance.py:24:8 | 22 | P_co = ParamSpec("P_co", contravariant=False) 23 | P_co = ParamSpec("P_co", covariant=False, contravariant=False) @@ -187,8 +206,9 @@ error[PLC0105]: type_name_incorrect_variance.py:24:8: `ParamSpec` name "P_co" do | ^^^^^^^^^ 25 | P_co = ParamSpec("P_co", covariant=False, contravariant=True) | -error[PLC0105]: type_name_incorrect_variance.py:25:8: `ParamSpec` name "P_co" does not reflect its contravariance; consider renaming it to "P_contra" +error[PLC0105]: 25:8: `ParamSpec` name "P_co" does not reflect its contravariance; consider renaming it to "P_contra" + --> type_name_incorrect_variance.py:25:8 | 23 | P_co = ParamSpec("P_co", covariant=False, contravariant=False) 24 | P_co = ParamSpec("P_co", contravariant=True) @@ -197,8 +217,9 @@ error[PLC0105]: type_name_incorrect_variance.py:25:8: `ParamSpec` name "P_co" do 26 | 27 | T_contra = TypeVar("T_contra") | -error[PLC0105]: type_name_incorrect_variance.py:27:12: `TypeVar` name "T_contra" does not reflect its invariance; consider renaming it to "T" +error[PLC0105]: 27:12: `TypeVar` name "T_contra" does not reflect its invariance; consider renaming it to "T" + --> type_name_incorrect_variance.py:27:12 | 25 | P_co = ParamSpec("P_co", covariant=False, contravariant=True) 26 | @@ -207,8 +228,9 @@ error[PLC0105]: type_name_incorrect_variance.py:27:12: `TypeVar` name "T_contra" 28 | T_contra = TypeVar("T_contra", covariant=False) 29 | T_contra = TypeVar("T_contra", contravariant=False) | -error[PLC0105]: type_name_incorrect_variance.py:28:12: `TypeVar` name "T_contra" does not reflect its invariance; consider renaming it to "T" +error[PLC0105]: 28:12: `TypeVar` name "T_contra" does not reflect its invariance; consider renaming it to "T" + --> type_name_incorrect_variance.py:28:12 | 27 | T_contra = TypeVar("T_contra") 28 | T_contra = TypeVar("T_contra", covariant=False) @@ -216,8 +238,9 @@ error[PLC0105]: type_name_incorrect_variance.py:28:12: `TypeVar` name "T_contra" 29 | T_contra = TypeVar("T_contra", contravariant=False) 30 | T_contra = TypeVar("T_contra", covariant=False, contravariant=False) | -error[PLC0105]: type_name_incorrect_variance.py:29:12: `TypeVar` name "T_contra" does not reflect its invariance; consider renaming it to "T" +error[PLC0105]: 29:12: `TypeVar` name "T_contra" does not reflect its invariance; consider renaming it to "T" + --> type_name_incorrect_variance.py:29:12 | 27 | T_contra = TypeVar("T_contra") 28 | T_contra = TypeVar("T_contra", covariant=False) @@ -226,8 +249,9 @@ error[PLC0105]: type_name_incorrect_variance.py:29:12: `TypeVar` name "T_contra" 30 | T_contra = TypeVar("T_contra", covariant=False, contravariant=False) 31 | T_contra = TypeVar("T_contra", covariant=True) | -error[PLC0105]: type_name_incorrect_variance.py:30:12: `TypeVar` name "T_contra" does not reflect its invariance; consider renaming it to "T" +error[PLC0105]: 30:12: `TypeVar` name "T_contra" does not reflect its invariance; consider renaming it to "T" + --> type_name_incorrect_variance.py:30:12 | 28 | T_contra = TypeVar("T_contra", covariant=False) 29 | T_contra = TypeVar("T_contra", contravariant=False) @@ -236,8 +260,9 @@ error[PLC0105]: type_name_incorrect_variance.py:30:12: `TypeVar` name "T_contra" 31 | T_contra = TypeVar("T_contra", covariant=True) 32 | T_contra = TypeVar("T_contra", covariant=True, contravariant=False) | -error[PLC0105]: type_name_incorrect_variance.py:31:12: `TypeVar` name "T_contra" does not reflect its covariance; consider renaming it to "T_co" +error[PLC0105]: 31:12: `TypeVar` name "T_contra" does not reflect its covariance; consider renaming it to "T_co" + --> type_name_incorrect_variance.py:31:12 | 29 | T_contra = TypeVar("T_contra", contravariant=False) 30 | T_contra = TypeVar("T_contra", covariant=False, contravariant=False) @@ -246,8 +271,9 @@ error[PLC0105]: type_name_incorrect_variance.py:31:12: `TypeVar` name "T_contra" 32 | T_contra = TypeVar("T_contra", covariant=True, contravariant=False) 33 | P_contra = ParamSpec("P_contra") | -error[PLC0105]: type_name_incorrect_variance.py:32:12: `TypeVar` name "T_contra" does not reflect its covariance; consider renaming it to "T_co" +error[PLC0105]: 32:12: `TypeVar` name "T_contra" does not reflect its covariance; consider renaming it to "T_co" + --> type_name_incorrect_variance.py:32:12 | 30 | T_contra = TypeVar("T_contra", covariant=False, contravariant=False) 31 | T_contra = TypeVar("T_contra", covariant=True) @@ -256,8 +282,9 @@ error[PLC0105]: type_name_incorrect_variance.py:32:12: `TypeVar` name "T_contra" 33 | P_contra = ParamSpec("P_contra") 34 | P_contra = ParamSpec("P_contra", covariant=False) | -error[PLC0105]: type_name_incorrect_variance.py:33:12: `ParamSpec` name "P_contra" does not reflect its invariance; consider renaming it to "P" +error[PLC0105]: 33:12: `ParamSpec` name "P_contra" does not reflect its invariance; consider renaming it to "P" + --> type_name_incorrect_variance.py:33:12 | 31 | T_contra = TypeVar("T_contra", covariant=True) 32 | T_contra = TypeVar("T_contra", covariant=True, contravariant=False) @@ -266,8 +293,9 @@ error[PLC0105]: type_name_incorrect_variance.py:33:12: `ParamSpec` name "P_contr 34 | P_contra = ParamSpec("P_contra", covariant=False) 35 | P_contra = ParamSpec("P_contra", contravariant=False) | -error[PLC0105]: type_name_incorrect_variance.py:34:12: `ParamSpec` name "P_contra" does not reflect its invariance; consider renaming it to "P" +error[PLC0105]: 34:12: `ParamSpec` name "P_contra" does not reflect its invariance; consider renaming it to "P" + --> type_name_incorrect_variance.py:34:12 | 32 | T_contra = TypeVar("T_contra", covariant=True, contravariant=False) 33 | P_contra = ParamSpec("P_contra") @@ -276,8 +304,9 @@ error[PLC0105]: type_name_incorrect_variance.py:34:12: `ParamSpec` name "P_contr 35 | P_contra = ParamSpec("P_contra", contravariant=False) 36 | P_contra = ParamSpec("P_contra", covariant=False, contravariant=False) | -error[PLC0105]: type_name_incorrect_variance.py:35:12: `ParamSpec` name "P_contra" does not reflect its invariance; consider renaming it to "P" +error[PLC0105]: 35:12: `ParamSpec` name "P_contra" does not reflect its invariance; consider renaming it to "P" + --> type_name_incorrect_variance.py:35:12 | 33 | P_contra = ParamSpec("P_contra") 34 | P_contra = ParamSpec("P_contra", covariant=False) @@ -286,8 +315,9 @@ error[PLC0105]: type_name_incorrect_variance.py:35:12: `ParamSpec` name "P_contr 36 | P_contra = ParamSpec("P_contra", covariant=False, contravariant=False) 37 | P_contra = ParamSpec("P_contra", covariant=True) | -error[PLC0105]: type_name_incorrect_variance.py:36:12: `ParamSpec` name "P_contra" does not reflect its invariance; consider renaming it to "P" +error[PLC0105]: 36:12: `ParamSpec` name "P_contra" does not reflect its invariance; consider renaming it to "P" + --> type_name_incorrect_variance.py:36:12 | 34 | P_contra = ParamSpec("P_contra", covariant=False) 35 | P_contra = ParamSpec("P_contra", contravariant=False) @@ -296,8 +326,9 @@ error[PLC0105]: type_name_incorrect_variance.py:36:12: `ParamSpec` name "P_contr 37 | P_contra = ParamSpec("P_contra", covariant=True) 38 | P_contra = ParamSpec("P_contra", covariant=True, contravariant=False) | -error[PLC0105]: type_name_incorrect_variance.py:37:12: `ParamSpec` name "P_contra" does not reflect its covariance; consider renaming it to "P_co" +error[PLC0105]: 37:12: `ParamSpec` name "P_contra" does not reflect its covariance; consider renaming it to "P_co" + --> type_name_incorrect_variance.py:37:12 | 35 | P_contra = ParamSpec("P_contra", contravariant=False) 36 | P_contra = ParamSpec("P_contra", covariant=False, contravariant=False) @@ -305,8 +336,9 @@ error[PLC0105]: type_name_incorrect_variance.py:37:12: `ParamSpec` name "P_contr | ^^^^^^^^^ 38 | P_contra = ParamSpec("P_contra", covariant=True, contravariant=False) | -error[PLC0105]: type_name_incorrect_variance.py:38:12: `ParamSpec` name "P_contra" does not reflect its covariance; consider renaming it to "P_co" +error[PLC0105]: 38:12: `ParamSpec` name "P_contra" does not reflect its covariance; consider renaming it to "P_co" + --> type_name_incorrect_variance.py:38:12 | 36 | P_contra = ParamSpec("P_contra", covariant=False, contravariant=False) 37 | P_contra = ParamSpec("P_contra", covariant=True) diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0131_type_bivariance.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0131_type_bivariance.py.snap index cb7e03a4a1..d8e42095ed 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0131_type_bivariance.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0131_type_bivariance.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLC0131]: type_bivariance.py:5:5: `TypeVar` "T" cannot be both covariant and contravariant +error[PLC0131]: 5:5: `TypeVar` "T" cannot be both covariant and contravariant + --> type_bivariance.py:5:5 | 3 | # Errors. 4 | @@ -10,8 +11,9 @@ error[PLC0131]: type_bivariance.py:5:5: `TypeVar` "T" cannot be both covariant a | ^^^^^^^ 6 | T = TypeVar(name="T", covariant=True, contravariant=True) | -error[PLC0131]: type_bivariance.py:6:5: `TypeVar` "T" cannot be both covariant and contravariant +error[PLC0131]: 6:5: `TypeVar` "T" cannot be both covariant and contravariant + --> type_bivariance.py:6:5 | 5 | T = TypeVar("T", covariant=True, contravariant=True) 6 | T = TypeVar(name="T", covariant=True, contravariant=True) @@ -19,8 +21,9 @@ error[PLC0131]: type_bivariance.py:6:5: `TypeVar` "T" cannot be both covariant a 7 | 8 | T = ParamSpec("T", covariant=True, contravariant=True) | -error[PLC0131]: type_bivariance.py:8:5: `ParamSpec` "T" cannot be both covariant and contravariant +error[PLC0131]: 8:5: `ParamSpec` "T" cannot be both covariant and contravariant + --> type_bivariance.py:8:5 | 6 | T = TypeVar(name="T", covariant=True, contravariant=True) 7 | @@ -28,8 +31,9 @@ error[PLC0131]: type_bivariance.py:8:5: `ParamSpec` "T" cannot be both covariant | ^^^^^^^^^ 9 | T = ParamSpec(name="T", covariant=True, contravariant=True) | -error[PLC0131]: type_bivariance.py:9:5: `ParamSpec` "T" cannot be both covariant and contravariant +error[PLC0131]: 9:5: `ParamSpec` "T" cannot be both covariant and contravariant + --> type_bivariance.py:9:5 | 8 | T = ParamSpec("T", covariant=True, contravariant=True) 9 | T = ParamSpec(name="T", covariant=True, contravariant=True) diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0132_type_param_name_mismatch.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0132_type_param_name_mismatch.py.snap index fdedbf421e..1ed5095590 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0132_type_param_name_mismatch.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0132_type_param_name_mismatch.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLC0132]: type_param_name_mismatch.py:5:5: `TypeVar` name `T` does not match assigned variable name `X` +error[PLC0132]: 5:5: `TypeVar` name `T` does not match assigned variable name `X` + --> type_param_name_mismatch.py:5:5 | 3 | # Errors. 4 | @@ -10,8 +11,9 @@ error[PLC0132]: type_param_name_mismatch.py:5:5: `TypeVar` name `T` does not mat | ^^^^^^^^^^^^ 6 | X = TypeVar(name="T") | -error[PLC0132]: type_param_name_mismatch.py:6:5: `TypeVar` name `T` does not match assigned variable name `X` +error[PLC0132]: 6:5: `TypeVar` name `T` does not match assigned variable name `X` + --> type_param_name_mismatch.py:6:5 | 5 | X = TypeVar("T") 6 | X = TypeVar(name="T") @@ -19,8 +21,9 @@ error[PLC0132]: type_param_name_mismatch.py:6:5: `TypeVar` name `T` does not mat 7 | 8 | Y = ParamSpec("T") | -error[PLC0132]: type_param_name_mismatch.py:8:5: `ParamSpec` name `T` does not match assigned variable name `Y` +error[PLC0132]: 8:5: `ParamSpec` name `T` does not match assigned variable name `Y` + --> type_param_name_mismatch.py:8:5 | 6 | X = TypeVar(name="T") 7 | @@ -28,8 +31,9 @@ error[PLC0132]: type_param_name_mismatch.py:8:5: `ParamSpec` name `T` does not m | ^^^^^^^^^^^^^^ 9 | Y = ParamSpec(name="T") | -error[PLC0132]: type_param_name_mismatch.py:9:5: `ParamSpec` name `T` does not match assigned variable name `Y` +error[PLC0132]: 9:5: `ParamSpec` name `T` does not match assigned variable name `Y` + --> type_param_name_mismatch.py:9:5 | 8 | Y = ParamSpec("T") 9 | Y = ParamSpec(name="T") @@ -37,8 +41,9 @@ error[PLC0132]: type_param_name_mismatch.py:9:5: `ParamSpec` name `T` does not m 10 | 11 | Z = NewType("T", int) | -error[PLC0132]: type_param_name_mismatch.py:11:5: `NewType` name `T` does not match assigned variable name `Z` +error[PLC0132]: 11:5: `NewType` name `T` does not match assigned variable name `Z` + --> type_param_name_mismatch.py:11:5 | 9 | Y = ParamSpec(name="T") 10 | @@ -46,8 +51,9 @@ error[PLC0132]: type_param_name_mismatch.py:11:5: `NewType` name `T` does not ma | ^^^^^^^^^^^^^^^^^ 12 | Z = NewType(name="T", tp=int) | -error[PLC0132]: type_param_name_mismatch.py:12:5: `NewType` name `T` does not match assigned variable name `Z` +error[PLC0132]: 12:5: `NewType` name `T` does not match assigned variable name `Z` + --> type_param_name_mismatch.py:12:5 | 11 | Z = NewType("T", int) 12 | Z = NewType(name="T", tp=int) @@ -55,8 +61,9 @@ error[PLC0132]: type_param_name_mismatch.py:12:5: `NewType` name `T` does not ma 13 | 14 | Ws = TypeVarTuple("Ts") | -error[PLC0132]: type_param_name_mismatch.py:14:6: `TypeVarTuple` name `Ts` does not match assigned variable name `Ws` +error[PLC0132]: 14:6: `TypeVarTuple` name `Ts` does not match assigned variable name `Ws` + --> type_param_name_mismatch.py:14:6 | 12 | Z = NewType(name="T", tp=int) 13 | @@ -64,8 +71,9 @@ error[PLC0132]: type_param_name_mismatch.py:14:6: `TypeVarTuple` name `Ts` does | ^^^^^^^^^^^^^^^^^^ 15 | Ws = TypeVarTuple(name="Ts") | -error[PLC0132]: type_param_name_mismatch.py:15:6: `TypeVarTuple` name `Ts` does not match assigned variable name `Ws` +error[PLC0132]: 15:6: `TypeVarTuple` name `Ts` does not match assigned variable name `Ws` + --> type_param_name_mismatch.py:15:6 | 14 | Ws = TypeVarTuple("Ts") 15 | Ws = TypeVarTuple(name="Ts") diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0205_single_string_slots.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0205_single_string_slots.py.snap index ea13371a2e..06c49d142d 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0205_single_string_slots.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0205_single_string_slots.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLC0205]: single_string_slots.py:3:5: Class `__slots__` should be a non-string iterable +error[PLC0205]: 3:5: Class `__slots__` should be a non-string iterable + --> single_string_slots.py:3:5 | 1 | # Errors. 2 | class Foo: @@ -11,8 +12,9 @@ error[PLC0205]: single_string_slots.py:3:5: Class `__slots__` should be a non-st 4 | 5 | def __init__(self, bar): | -error[PLC0205]: single_string_slots.py:10:5: Class `__slots__` should be a non-string iterable +error[PLC0205]: 10:5: Class `__slots__` should be a non-string iterable + --> single_string_slots.py:10:5 | 9 | class Foo: 10 | __slots__: str = "bar" @@ -20,8 +22,9 @@ error[PLC0205]: single_string_slots.py:10:5: Class `__slots__` should be a non-s 11 | 12 | def __init__(self, bar): | -error[PLC0205]: single_string_slots.py:17:5: Class `__slots__` should be a non-string iterable +error[PLC0205]: 17:5: Class `__slots__` should be a non-string iterable + --> single_string_slots.py:17:5 | 16 | class Foo: 17 | __slots__: str = f"bar" diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0206_dict_index_missing_items.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0206_dict_index_missing_items.py.snap index 49e59491f1..086cd9753c 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0206_dict_index_missing_items.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0206_dict_index_missing_items.py.snap @@ -1,67 +1,74 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -dict_index_missing_items.py:9:1: PLC0206 Extracting value from dictionary without calling `.items()` +error[PLC0206]: 9:1: Extracting value from dictionary without calling `.items()` + + --> dict_index_missing_items.py:8:9 | 8 | # Errors 9 | / for instrument in ORCHESTRA: 10 | | print(f"{instrument}: {ORCHESTRA[instrument]}") - | |___________________________________________________^ PLC0206 + | |___________________________________________________^ 11 | 12 | for instrument in ORCHESTRA: | +error[PLC0206]: 12:1: Extracting value from dictionary without calling `.items()` -dict_index_missing_items.py:12:1: PLC0206 Extracting value from dictionary without calling `.items()` + --> dict_index_missing_items.py:11:1 | 10 | print(f"{instrument}: {ORCHESTRA[instrument]}") 11 | 12 | / for instrument in ORCHESTRA: 13 | | ORCHESTRA[instrument] - | |_________________________^ PLC0206 + | |_________________________^ 14 | 15 | for instrument in ORCHESTRA.keys(): | +error[PLC0206]: 15:1: Extracting value from dictionary without calling `.items()` -dict_index_missing_items.py:15:1: PLC0206 Extracting value from dictionary without calling `.items()` + --> dict_index_missing_items.py:14:1 | 13 | ORCHESTRA[instrument] 14 | 15 | / for instrument in ORCHESTRA.keys(): 16 | | print(f"{instrument}: {ORCHESTRA[instrument]}") - | |___________________________________________________^ PLC0206 + | |___________________________________________________^ 17 | 18 | for instrument in ORCHESTRA.keys(): | +error[PLC0206]: 18:1: Extracting value from dictionary without calling `.items()` -dict_index_missing_items.py:18:1: PLC0206 Extracting value from dictionary without calling `.items()` + --> dict_index_missing_items.py:17:1 | 16 | print(f"{instrument}: {ORCHESTRA[instrument]}") 17 | 18 | / for instrument in ORCHESTRA.keys(): 19 | | ORCHESTRA[instrument] - | |_________________________^ PLC0206 + | |_________________________^ 20 | 21 | for instrument in (temp_orchestra := {"violin": "strings", "oboe": "woodwind"}): | +error[PLC0206]: 21:1: Extracting value from dictionary without calling `.items()` -dict_index_missing_items.py:21:1: PLC0206 Extracting value from dictionary without calling `.items()` + --> dict_index_missing_items.py:20:1 | 19 | ORCHESTRA[instrument] 20 | 21 | / for instrument in (temp_orchestra := {"violin": "strings", "oboe": "woodwind"}): 22 | | print(f"{instrument}: {temp_orchestra[instrument]}") - | |________________________________________________________^ PLC0206 + | |________________________________________________________^ 23 | 24 | for instrument in (temp_orchestra := {"violin": "strings", "oboe": "woodwind"}): | +error[PLC0206]: 24:1: Extracting value from dictionary without calling `.items()` -dict_index_missing_items.py:24:1: PLC0206 Extracting value from dictionary without calling `.items()` + --> dict_index_missing_items.py:23:1 | 22 | print(f"{instrument}: {temp_orchestra[instrument]}") 23 | 24 | / for instrument in (temp_orchestra := {"violin": "strings", "oboe": "woodwind"}): 25 | | temp_orchestra[instrument] - | |______________________________^ PLC0206 + | |______________________________^ 26 | 27 | # # OK | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0208_iteration_over_set.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0208_iteration_over_set.py.snap index 37a07df470..568b87bb78 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0208_iteration_over_set.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0208_iteration_over_set.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLC0208]: iteration_over_set.py:3:13: [*] Use a sequence type instead of a `set` when iterating over values +error[PLC0208]: 3:13: [*] Use a sequence type instead of a `set` when iterating over values + --> iteration_over_set.py:3:13 | 1 | # Errors 2 | @@ -20,8 +21,9 @@ error[PLC0208]: iteration_over_set.py:3:13: [*] Use a sequence type instead of a 5 5 | 6 6 | for item in {"apples", "lemons", "water"}: # flags in-line set literals -error[PLC0208]: iteration_over_set.py:6:13: [*] Use a sequence type instead of a `set` when iterating over values +error[PLC0208]: 6:13: [*] Use a sequence type instead of a `set` when iterating over values + --> iteration_over_set.py:6:13 | 4 | print(f"I can count to {item}!") 5 | @@ -40,8 +42,9 @@ error[PLC0208]: iteration_over_set.py:6:13: [*] Use a sequence type instead of a 8 8 | 9 9 | for item in {1,}: -error[PLC0208]: iteration_over_set.py:9:13: [*] Use a sequence type instead of a `set` when iterating over values +error[PLC0208]: 9:13: [*] Use a sequence type instead of a `set` when iterating over values + --> iteration_over_set.py:9:13 | 7 | print(f"I like {item}.") 8 | @@ -60,8 +63,9 @@ error[PLC0208]: iteration_over_set.py:9:13: [*] Use a sequence type instead of a 11 11 | 12 12 | for item in { -error[PLC0208]: iteration_over_set.py:12:13: [*] Use a sequence type instead of a `set` when iterating over values +error[PLC0208]: 12:13: [*] Use a sequence type instead of a `set` when iterating over values + --> iteration_over_set.py:12:13 | 10 | print(f"I can count to {item}!") 11 | @@ -86,8 +90,9 @@ error[PLC0208]: iteration_over_set.py:12:13: [*] Use a sequence type instead of 16 16 | 17 17 | numbers_list = [i for i in {1, 2, 3}] # flags sets in list comprehensions -error[PLC0208]: iteration_over_set.py:17:28: [*] Use a sequence type instead of a `set` when iterating over values +error[PLC0208]: 17:28: [*] Use a sequence type instead of a `set` when iterating over values + --> iteration_over_set.py:17:28 | 15 | print(f"I like {item}.") 16 | @@ -107,8 +112,9 @@ error[PLC0208]: iteration_over_set.py:17:28: [*] Use a sequence type instead of 19 19 | numbers_set = {i for i in {1, 2, 3}} # flags sets in set comprehensions 20 20 | -error[PLC0208]: iteration_over_set.py:19:27: [*] Use a sequence type instead of a `set` when iterating over values +error[PLC0208]: 19:27: [*] Use a sequence type instead of a `set` when iterating over values + --> iteration_over_set.py:19:27 | 17 | numbers_list = [i for i in {1, 2, 3}] # flags sets in list comprehensions 18 | @@ -128,8 +134,9 @@ error[PLC0208]: iteration_over_set.py:19:27: [*] Use a sequence type instead of 21 21 | numbers_dict = {str(i): i for i in {1, 2, 3}} # flags sets in dict comprehensions 22 22 | -error[PLC0208]: iteration_over_set.py:21:36: [*] Use a sequence type instead of a `set` when iterating over values +error[PLC0208]: 21:36: [*] Use a sequence type instead of a `set` when iterating over values + --> iteration_over_set.py:21:36 | 19 | numbers_set = {i for i in {1, 2, 3}} # flags sets in set comprehensions 20 | @@ -149,8 +156,9 @@ error[PLC0208]: iteration_over_set.py:21:36: [*] Use a sequence type instead of 23 23 | numbers_gen = (i for i in {1, 2, 3}) # flags sets in generator expressions 24 24 | -error[PLC0208]: iteration_over_set.py:23:27: [*] Use a sequence type instead of a `set` when iterating over values +error[PLC0208]: 23:27: [*] Use a sequence type instead of a `set` when iterating over values + --> iteration_over_set.py:23:27 | 21 | numbers_dict = {str(i): i for i in {1, 2, 3}} # flags sets in dict comprehensions 22 | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0414_import_aliasing.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0414_import_aliasing.py.snap index 285f7f3a5f..0322456d59 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0414_import_aliasing.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0414_import_aliasing.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLC0414]: import_aliasing.py:6:8: [*] Import alias does not rename original package +error[PLC0414]: 6:8: [*] Import alias does not rename original package + --> import_aliasing.py:6:8 | 4 | # 2. consider-using-from-import 5 | @@ -22,8 +23,9 @@ error[PLC0414]: import_aliasing.py:6:8: [*] Import alias does not rename origina 8 8 | from collections import OrderedDict as o_dict 9 9 | import os.path as path # [consider-using-from-import] -error[PLC0414]: import_aliasing.py:7:25: [*] Import alias does not rename original package +error[PLC0414]: 7:25: [*] Import alias does not rename original package + --> import_aliasing.py:7:25 | 6 | import collections as collections # [useless-import-alias] 7 | from collections import OrderedDict as OrderedDict # [useless-import-alias] @@ -42,8 +44,9 @@ error[PLC0414]: import_aliasing.py:7:25: [*] Import alias does not rename origin 9 9 | import os.path as path # [consider-using-from-import] 10 10 | import os.path as p -error[PLC0414]: import_aliasing.py:16:15: [*] Import alias does not rename original package +error[PLC0414]: 16:15: [*] Import alias does not rename original package + --> import_aliasing.py:16:15 | 14 | import os as OS 15 | from sys import version @@ -63,8 +66,9 @@ error[PLC0414]: import_aliasing.py:16:15: [*] Import alias does not rename origi 18 18 | from . import bar 19 19 | from ..foo import bar as bar # [useless-import-alias] -error[PLC0414]: import_aliasing.py:19:19: [*] Import alias does not rename original package +error[PLC0414]: 19:19: [*] Import alias does not rename original package + --> import_aliasing.py:19:19 | 17 | from . import bar as Bar 18 | from . import bar @@ -84,8 +88,9 @@ error[PLC0414]: import_aliasing.py:19:19: [*] Import alias does not rename origi 21 21 | from ..foo.bar import foobar as anotherfoobar 22 22 | from . import foo as foo, foo2 as bar2 # [useless-import-alias] -error[PLC0414]: import_aliasing.py:20:23: [*] Import alias does not rename original package +error[PLC0414]: 20:23: [*] Import alias does not rename original package + --> import_aliasing.py:20:23 | 18 | from . import bar 19 | from ..foo import bar as bar # [useless-import-alias] @@ -105,8 +110,9 @@ error[PLC0414]: import_aliasing.py:20:23: [*] Import alias does not rename origi 22 22 | from . import foo as foo, foo2 as bar2 # [useless-import-alias] 23 23 | from . import foo as bar, foo2 as foo2 # [useless-import-alias] -error[PLC0414]: import_aliasing.py:22:15: [*] Import alias does not rename original package +error[PLC0414]: 22:15: [*] Import alias does not rename original package + --> import_aliasing.py:22:15 | 20 | from ..foo.bar import foobar as foobar # [useless-import-alias] 21 | from ..foo.bar import foobar as anotherfoobar @@ -126,8 +132,9 @@ error[PLC0414]: import_aliasing.py:22:15: [*] Import alias does not rename origi 24 24 | from . import foo as bar, foo2 as bar2 25 25 | from foo.bar import foobar as foobar # [useless-import-alias] -error[PLC0414]: import_aliasing.py:23:27: [*] Import alias does not rename original package +error[PLC0414]: 23:27: [*] Import alias does not rename original package + --> import_aliasing.py:23:27 | 21 | from ..foo.bar import foobar as anotherfoobar 22 | from . import foo as foo, foo2 as bar2 # [useless-import-alias] @@ -147,8 +154,9 @@ error[PLC0414]: import_aliasing.py:23:27: [*] Import alias does not rename origi 25 25 | from foo.bar import foobar as foobar # [useless-import-alias] 26 26 | from foo.bar import foobar as foo -error[PLC0414]: import_aliasing.py:25:21: [*] Import alias does not rename original package +error[PLC0414]: 25:21: [*] Import alias does not rename original package + --> import_aliasing.py:25:21 | 23 | from . import foo as bar, foo2 as foo2 # [useless-import-alias] 24 | from . import foo as bar, foo2 as bar2 diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0415_import_outside_top_level.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0415_import_outside_top_level.py.snap index c34e29c637..ba64bb9d46 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0415_import_outside_top_level.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0415_import_outside_top_level.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLC0415]: import_outside_top_level.py:10:5: `import` should be at the top-level of a file +error[PLC0415]: 10:5: `import` should be at the top-level of a file + --> import_outside_top_level.py:10:5 | 9 | def import_in_function(): 10 | import symtable # [import-outside-toplevel] @@ -10,8 +11,9 @@ error[PLC0415]: import_outside_top_level.py:10:5: `import` should be at the top- 11 | import os, sys # [import-outside-toplevel] 12 | import time as thyme # [import-outside-toplevel] | -error[PLC0415]: import_outside_top_level.py:11:5: `import` should be at the top-level of a file +error[PLC0415]: 11:5: `import` should be at the top-level of a file + --> import_outside_top_level.py:11:5 | 9 | def import_in_function(): 10 | import symtable # [import-outside-toplevel] @@ -20,8 +22,9 @@ error[PLC0415]: import_outside_top_level.py:11:5: `import` should be at the top- 12 | import time as thyme # [import-outside-toplevel] 13 | import random as rand, socket as sock # [import-outside-toplevel] | -error[PLC0415]: import_outside_top_level.py:12:5: `import` should be at the top-level of a file +error[PLC0415]: 12:5: `import` should be at the top-level of a file + --> import_outside_top_level.py:12:5 | 10 | import symtable # [import-outside-toplevel] 11 | import os, sys # [import-outside-toplevel] @@ -30,8 +33,9 @@ error[PLC0415]: import_outside_top_level.py:12:5: `import` should be at the top- 13 | import random as rand, socket as sock # [import-outside-toplevel] 14 | from collections import defaultdict # [import-outside-toplevel] | -error[PLC0415]: import_outside_top_level.py:13:5: `import` should be at the top-level of a file +error[PLC0415]: 13:5: `import` should be at the top-level of a file + --> import_outside_top_level.py:13:5 | 11 | import os, sys # [import-outside-toplevel] 12 | import time as thyme # [import-outside-toplevel] @@ -40,8 +44,9 @@ error[PLC0415]: import_outside_top_level.py:13:5: `import` should be at the top- 14 | from collections import defaultdict # [import-outside-toplevel] 15 | from math import sin as sign, cos as cosplay # [import-outside-toplevel] | -error[PLC0415]: import_outside_top_level.py:14:5: `import` should be at the top-level of a file +error[PLC0415]: 14:5: `import` should be at the top-level of a file + --> import_outside_top_level.py:14:5 | 12 | import time as thyme # [import-outside-toplevel] 13 | import random as rand, socket as sock # [import-outside-toplevel] @@ -49,16 +54,18 @@ error[PLC0415]: import_outside_top_level.py:14:5: `import` should be at the top- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 15 | from math import sin as sign, cos as cosplay # [import-outside-toplevel] | -error[PLC0415]: import_outside_top_level.py:15:5: `import` should be at the top-level of a file +error[PLC0415]: 15:5: `import` should be at the top-level of a file + --> import_outside_top_level.py:15:5 | 13 | import random as rand, socket as sock # [import-outside-toplevel] 14 | from collections import defaultdict # [import-outside-toplevel] 15 | from math import sin as sign, cos as cosplay # [import-outside-toplevel] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -error[PLC0415]: import_outside_top_level.py:19:5: `import` should be at the top-level of a file +error[PLC0415]: 19:5: `import` should be at the top-level of a file + --> import_outside_top_level.py:19:5 | 18 | class ClassWithImports: 19 | import tokenize # [import-outside-toplevel] @@ -66,8 +73,9 @@ error[PLC0415]: import_outside_top_level.py:19:5: `import` should be at the top- 20 | 21 | def __init__(self): | -error[PLC0415]: import_outside_top_level.py:22:9: `import` should be at the top-level of a file +error[PLC0415]: 22:9: `import` should be at the top-level of a file + --> import_outside_top_level.py:22:9 | 21 | def __init__(self): 22 | import trace # [import-outside-toplevel] diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC1901_compare_to_empty_string.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC1901_compare_to_empty_string.py.snap index dba9e41b2f..0d9564f2bd 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC1901_compare_to_empty_string.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC1901_compare_to_empty_string.py.snap @@ -1,24 +1,27 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLC1901]: compare_to_empty_string.py:7:13: `x is ""` can be simplified to `not x` as an empty string is falsey +error[PLC1901]: 7:13: `x is ""` can be simplified to `not x` as an empty string is falsey + --> compare_to_empty_string.py:7:13 | 6 | def errors(): 7 | if x is "" or x == "": | ^^ 8 | print("x is an empty string") | -error[PLC1901]: compare_to_empty_string.py:7:24: `x == ""` can be simplified to `not x` as an empty string is falsey +error[PLC1901]: 7:24: `x == ""` can be simplified to `not x` as an empty string is falsey + --> compare_to_empty_string.py:7:24 | 6 | def errors(): 7 | if x is "" or x == "": | ^^ 8 | print("x is an empty string") | -error[PLC1901]: compare_to_empty_string.py:10:17: `y is not ""` can be simplified to `y` as an empty string is falsey +error[PLC1901]: 10:17: `y is not ""` can be simplified to `y` as an empty string is falsey + --> compare_to_empty_string.py:10:17 | 8 | print("x is an empty string") 9 | @@ -26,8 +29,9 @@ error[PLC1901]: compare_to_empty_string.py:10:17: `y is not ""` can be simplifie | ^^ 11 | print("y is not an empty string") | -error[PLC1901]: compare_to_empty_string.py:10:28: `y != ""` can be simplified to `y` as an empty string is falsey +error[PLC1901]: 10:28: `y != ""` can be simplified to `y` as an empty string is falsey + --> compare_to_empty_string.py:10:28 | 8 | print("x is an empty string") 9 | @@ -35,8 +39,9 @@ error[PLC1901]: compare_to_empty_string.py:10:28: `y != ""` can be simplified to | ^^ 11 | print("y is not an empty string") | -error[PLC1901]: compare_to_empty_string.py:13:8: `"" != z` can be simplified to `z` as an empty string is falsey +error[PLC1901]: 13:8: `"" != z` can be simplified to `z` as an empty string is falsey + --> compare_to_empty_string.py:13:8 | 11 | print("y is not an empty string") 12 | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC2401_non_ascii_name.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC2401_non_ascii_name.py.snap index 7c7ac5e96e..edd9e479f1 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC2401_non_ascii_name.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC2401_non_ascii_name.py.snap @@ -1,85 +1,95 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -non_ascii_name.py:1:1: PLC2401 Variable name `ápple_count` contains a non-ASCII character +error[PLC2401]: 1:1: Variable name `ápple_count` contains a non-ASCII character + + --> non_ascii_name.py:1:1 | 1 | ápple_count: int = 1 # C2401 - | ^^^^^^^^^^^ PLC2401 + | ^^^^^^^^^^^ 2 | ápple_count += 2 # C2401 3 | ápple_count = 3 # C2401 | = help: Rename the variable using ASCII characters +error[PLC2401]: 2:1: Variable name `ápple_count` contains a non-ASCII character -non_ascii_name.py:2:1: PLC2401 Variable name `ápple_count` contains a non-ASCII character + --> non_ascii_name.py:1:30 | 1 | ápple_count: int = 1 # C2401 2 | ápple_count += 2 # C2401 - | ^^^^^^^^^^^ PLC2401 + | ^^^^^^^^^^^ 3 | ápple_count = 3 # C2401 | = help: Rename the variable using ASCII characters +error[PLC2401]: 3:1: Variable name `ápple_count` contains a non-ASCII character -non_ascii_name.py:3:1: PLC2401 Variable name `ápple_count` contains a non-ASCII character + --> non_ascii_name.py:2:26 | 1 | ápple_count: int = 1 # C2401 2 | ápple_count += 2 # C2401 3 | ápple_count = 3 # C2401 - | ^^^^^^^^^^^ PLC2401 + | ^^^^^^^^^^^ 4 | 5 | (ápple_count for ápple_count in y) | = help: Rename the variable using ASCII characters +error[PLC2401]: 5:18: Variable name `ápple_count` contains a non-ASCII character -non_ascii_name.py:5:18: PLC2401 Variable name `ápple_count` contains a non-ASCII character + --> non_ascii_name.py:5:18 | 3 | ápple_count = 3 # C2401 4 | 5 | (ápple_count for ápple_count in y) - | ^^^^^^^^^^^ PLC2401 + | ^^^^^^^^^^^ | = help: Rename the variable using ASCII characters +error[PLC2401]: 8:10: Argument name `ápple_count` contains a non-ASCII character -non_ascii_name.py:8:10: PLC2401 Argument name `ápple_count` contains a non-ASCII character + --> non_ascii_name.py:8:10 | 8 | def func(ápple_count): - | ^^^^^^^^^^^ PLC2401 + | ^^^^^^^^^^^ 9 | global ápple_count 10 | nonlocal ápple_count | = help: Rename the variable using ASCII characters +error[PLC2401]: 9:12: Global name `ápple_count` contains a non-ASCII character -non_ascii_name.py:9:12: PLC2401 Global name `ápple_count` contains a non-ASCII character + --> non_ascii_name.py:9:12 | 8 | def func(ápple_count): 9 | global ápple_count - | ^^^^^^^^^^^ PLC2401 + | ^^^^^^^^^^^ 10 | nonlocal ápple_count | = help: Rename the variable using ASCII characters +error[PLC2401]: 13:5: Function name `ápple_count` contains a non-ASCII character -non_ascii_name.py:13:5: PLC2401 Function name `ápple_count` contains a non-ASCII character + --> non_ascii_name.py:13:5 | 13 | def ápple_count(): - | ^^^^^^^^^^^ PLC2401 + | ^^^^^^^^^^^ 14 | pass | = help: Rename the variable using ASCII characters +error[PLC2401]: 18:10: Variable name `ápple_count` contains a non-ASCII character -non_ascii_name.py:18:10: PLC2401 Variable name `ápple_count` contains a non-ASCII character + --> non_ascii_name.py:18:10 | 17 | match ápple_count: 18 | case ápple_count: - | ^^^^^^^^^^^ PLC2401 + | ^^^^^^^^^^^ 19 | pass | = help: Rename the variable using ASCII characters +error[PLC2401]: 21:1: Annotation name `ápple_count` contains a non-ASCII character -non_ascii_name.py:21:1: PLC2401 Annotation name `ápple_count` contains a non-ASCII character + --> non_ascii_name.py:20:1 | 19 | pass 20 | 21 | ápple_count: int - | ^^^^^^^^^^^ PLC2401 + | ^^^^^^^^^^^ 22 | 23 | try: | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC2403_non_ascii_module_import.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC2403_non_ascii_module_import.py.snap index 6d8a7c610b..9b43907811 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC2403_non_ascii_module_import.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC2403_non_ascii_module_import.py.snap @@ -1,40 +1,45 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -non_ascii_module_import.py:1:29: PLC2403 Module alias `łos` contains a non-ASCII character +error[PLC2403]: 1:29: Module alias `łos` contains a non-ASCII character + + --> non_ascii_module_import.py:1:29 | 1 | from os.path import join as łos # Error - | ^^^ PLC2403 + | ^^^ 2 | from os.path import join as los # OK | = help: Use an ASCII-only alias +error[PLC2403]: 4:24: Module alias `łos` contains a non-ASCII character -non_ascii_module_import.py:4:24: PLC2403 Module alias `łos` contains a non-ASCII character + --> non_ascii_module_import.py:4:24 | 2 | from os.path import join as los # OK 3 | 4 | import os.path.join as łos # Error - | ^^^ PLC2403 + | ^^^ 5 | import os.path.join as los # OK | = help: Use an ASCII-only alias +error[PLC2403]: 7:8: Module name `os.path.łos` contains a non-ASCII character -non_ascii_module_import.py:7:8: PLC2403 Module name `os.path.łos` contains a non-ASCII character + --> non_ascii_module_import.py:7:8 | 5 | import os.path.join as los # OK 6 | 7 | import os.path.łos # Error (recommend an ASCII alias) - | ^^^^^^^^^^^ PLC2403 + | ^^^^^^^^^^^ 8 | import os.path.los # OK | = help: Use an ASCII-only alias +error[PLC2403]: 10:21: Module name `łos` contains a non-ASCII character -non_ascii_module_import.py:10:21: PLC2403 Module name `łos` contains a non-ASCII character + --> non_ascii_module_import.py:10:21 | 8 | import os.path.los # OK 9 | 10 | from os.path import łos # Error (recommend an ASCII alias) - | ^^^ PLC2403 + | ^^^ 11 | from os.path import los # OK | = help: Use an ASCII-only alias diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC2701_import_private_name__submodule____main__.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC2701_import_private_name__submodule____main__.py.snap index 1af8c087a2..5fd55829f6 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC2701_import_private_name__submodule____main__.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC2701_import_private_name__submodule____main__.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLC2701]: __main__.py:2:16: Private name import `_a` +error[PLC2701]: 2:16: Private name import `_a` + --> __main__.py:2:16 | 1 | # Errors. 2 | from _a import b @@ -10,8 +11,9 @@ error[PLC2701]: __main__.py:2:16: Private name import `_a` 3 | from c._d import e 4 | from _f.g import h | -error[PLC2701]: __main__.py:3:18: Private name import `_d` from external module `c` +error[PLC2701]: 3:18: Private name import `_d` from external module `c` + --> __main__.py:3:18 | 1 | # Errors. 2 | from _a import b @@ -20,8 +22,9 @@ error[PLC2701]: __main__.py:3:18: Private name import `_d` from external module 4 | from _f.g import h 5 | from i import _j | -error[PLC2701]: __main__.py:4:18: Private name import `_f` +error[PLC2701]: 4:18: Private name import `_f` + --> __main__.py:4:18 | 2 | from _a import b 3 | from c._d import e @@ -30,8 +33,9 @@ error[PLC2701]: __main__.py:4:18: Private name import `_f` 5 | from i import _j 6 | from k import _l as m | -error[PLC2701]: __main__.py:5:15: Private name import `_j` from external module `i` +error[PLC2701]: 5:15: Private name import `_j` from external module `i` + --> __main__.py:5:15 | 3 | from c._d import e 4 | from _f.g import h @@ -40,8 +44,9 @@ error[PLC2701]: __main__.py:5:15: Private name import `_j` from external module 6 | from k import _l as m 7 | import _aaa | -error[PLC2701]: __main__.py:6:21: Private name import `_l` from external module `k` +error[PLC2701]: 6:21: Private name import `_l` from external module `k` + --> __main__.py:6:21 | 4 | from _f.g import h 5 | from i import _j @@ -50,8 +55,9 @@ error[PLC2701]: __main__.py:6:21: Private name import `_l` from external module 7 | import _aaa 8 | import bbb.ccc._ddd as eee # Panicked in https://github.com/astral-sh/ruff/pull/5920 | -error[PLC2701]: __main__.py:7:8: Private name import `_aaa` +error[PLC2701]: 7:8: Private name import `_aaa` + --> __main__.py:7:8 | 5 | from i import _j 6 | from k import _l as m @@ -59,8 +65,9 @@ error[PLC2701]: __main__.py:7:8: Private name import `_aaa` | ^^^^ 8 | import bbb.ccc._ddd as eee # Panicked in https://github.com/astral-sh/ruff/pull/5920 | -error[PLC2701]: __main__.py:8:24: Private name import `_ddd` from external module `bbb.ccc` +error[PLC2701]: 8:24: Private name import `_ddd` from external module `bbb.ccc` + --> __main__.py:8:24 | 6 | from k import _l as m 7 | import _aaa diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC2801_unnecessary_dunder_call.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC2801_unnecessary_dunder_call.py.snap index 93a46f5b6e..e7ebfc27ec 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC2801_unnecessary_dunder_call.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC2801_unnecessary_dunder_call.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLC2801]: unnecessary_dunder_call.py:4:7: [*] Unnecessary dunder call to `__add__`. Use `+` operator. +error[PLC2801]: 4:7: [*] Unnecessary dunder call to `__add__`. Use `+` operator. + --> unnecessary_dunder_call.py:4:7 | 3 | a = 2 4 | print((3.0).__add__(4.0)) # PLC2801 @@ -21,8 +22,9 @@ error[PLC2801]: unnecessary_dunder_call.py:4:7: [*] Unnecessary dunder call to ` 6 6 | print((3.0).__mul__(4.0)) # PLC2801 7 7 | print((3.0).__truediv__(4.0)) # PLC2801 -error[PLC2801]: unnecessary_dunder_call.py:5:7: [*] Unnecessary dunder call to `__sub__`. Use `-` operator. +error[PLC2801]: 5:7: [*] Unnecessary dunder call to `__sub__`. Use `-` operator. + --> unnecessary_dunder_call.py:5:7 | 3 | a = 2 4 | print((3.0).__add__(4.0)) # PLC2801 @@ -42,8 +44,9 @@ error[PLC2801]: unnecessary_dunder_call.py:5:7: [*] Unnecessary dunder call to ` 7 7 | print((3.0).__truediv__(4.0)) # PLC2801 8 8 | print((3.0).__floordiv__(4.0)) # PLC2801 -error[PLC2801]: unnecessary_dunder_call.py:6:7: [*] Unnecessary dunder call to `__mul__`. Use `*` operator. +error[PLC2801]: 6:7: [*] Unnecessary dunder call to `__mul__`. Use `*` operator. + --> unnecessary_dunder_call.py:6:7 | 4 | print((3.0).__add__(4.0)) # PLC2801 5 | print((3.0).__sub__(4.0)) # PLC2801 @@ -63,8 +66,9 @@ error[PLC2801]: unnecessary_dunder_call.py:6:7: [*] Unnecessary dunder call to ` 8 8 | print((3.0).__floordiv__(4.0)) # PLC2801 9 9 | print((3.0).__mod__(4.0)) # PLC2801 -error[PLC2801]: unnecessary_dunder_call.py:7:7: [*] Unnecessary dunder call to `__truediv__`. Use `/` operator. +error[PLC2801]: 7:7: [*] Unnecessary dunder call to `__truediv__`. Use `/` operator. + --> unnecessary_dunder_call.py:7:7 | 5 | print((3.0).__sub__(4.0)) # PLC2801 6 | print((3.0).__mul__(4.0)) # PLC2801 @@ -84,8 +88,9 @@ error[PLC2801]: unnecessary_dunder_call.py:7:7: [*] Unnecessary dunder call to ` 9 9 | print((3.0).__mod__(4.0)) # PLC2801 10 10 | print((3.0).__eq__(4.0)) # PLC2801 -error[PLC2801]: unnecessary_dunder_call.py:8:7: [*] Unnecessary dunder call to `__floordiv__`. Use `//` operator. +error[PLC2801]: 8:7: [*] Unnecessary dunder call to `__floordiv__`. Use `//` operator. + --> unnecessary_dunder_call.py:8:7 | 6 | print((3.0).__mul__(4.0)) # PLC2801 7 | print((3.0).__truediv__(4.0)) # PLC2801 @@ -105,8 +110,9 @@ error[PLC2801]: unnecessary_dunder_call.py:8:7: [*] Unnecessary dunder call to ` 10 10 | print((3.0).__eq__(4.0)) # PLC2801 11 11 | print((3.0).__ne__(4.0)) # PLC2801 -error[PLC2801]: unnecessary_dunder_call.py:9:7: [*] Unnecessary dunder call to `__mod__`. Use `%` operator. +error[PLC2801]: 9:7: [*] Unnecessary dunder call to `__mod__`. Use `%` operator. + --> unnecessary_dunder_call.py:9:7 | 7 | print((3.0).__truediv__(4.0)) # PLC2801 8 | print((3.0).__floordiv__(4.0)) # PLC2801 @@ -126,8 +132,9 @@ error[PLC2801]: unnecessary_dunder_call.py:9:7: [*] Unnecessary dunder call to ` 11 11 | print((3.0).__ne__(4.0)) # PLC2801 12 12 | print((3.0).__lt__(4.0)) # PLC2801 -error[PLC2801]: unnecessary_dunder_call.py:10:7: [*] Unnecessary dunder call to `__eq__`. Use `==` operator. +error[PLC2801]: 10:7: [*] Unnecessary dunder call to `__eq__`. Use `==` operator. + --> unnecessary_dunder_call.py:10:7 | 8 | print((3.0).__floordiv__(4.0)) # PLC2801 9 | print((3.0).__mod__(4.0)) # PLC2801 @@ -147,8 +154,9 @@ error[PLC2801]: unnecessary_dunder_call.py:10:7: [*] Unnecessary dunder call to 12 12 | print((3.0).__lt__(4.0)) # PLC2801 13 13 | print((3.0).__le__(4.0)) # PLC2801 -error[PLC2801]: unnecessary_dunder_call.py:11:7: [*] Unnecessary dunder call to `__ne__`. Use `!=` operator. +error[PLC2801]: 11:7: [*] Unnecessary dunder call to `__ne__`. Use `!=` operator. + --> unnecessary_dunder_call.py:11:7 | 9 | print((3.0).__mod__(4.0)) # PLC2801 10 | print((3.0).__eq__(4.0)) # PLC2801 @@ -168,8 +176,9 @@ error[PLC2801]: unnecessary_dunder_call.py:11:7: [*] Unnecessary dunder call to 13 13 | print((3.0).__le__(4.0)) # PLC2801 14 14 | print((3.0).__gt__(4.0)) # PLC2801 -error[PLC2801]: unnecessary_dunder_call.py:12:7: [*] Unnecessary dunder call to `__lt__`. Use `<` operator. +error[PLC2801]: 12:7: [*] Unnecessary dunder call to `__lt__`. Use `<` operator. + --> unnecessary_dunder_call.py:12:7 | 10 | print((3.0).__eq__(4.0)) # PLC2801 11 | print((3.0).__ne__(4.0)) # PLC2801 @@ -189,8 +198,9 @@ error[PLC2801]: unnecessary_dunder_call.py:12:7: [*] Unnecessary dunder call to 14 14 | print((3.0).__gt__(4.0)) # PLC2801 15 15 | print((3.0).__ge__(4.0)) # PLC2801 -error[PLC2801]: unnecessary_dunder_call.py:13:7: [*] Unnecessary dunder call to `__le__`. Use `<=` operator. +error[PLC2801]: 13:7: [*] Unnecessary dunder call to `__le__`. Use `<=` operator. + --> unnecessary_dunder_call.py:13:7 | 11 | print((3.0).__ne__(4.0)) # PLC2801 12 | print((3.0).__lt__(4.0)) # PLC2801 @@ -210,8 +220,9 @@ error[PLC2801]: unnecessary_dunder_call.py:13:7: [*] Unnecessary dunder call to 15 15 | print((3.0).__ge__(4.0)) # PLC2801 16 16 | print((3.0).__str__()) # PLC2801 -error[PLC2801]: unnecessary_dunder_call.py:14:7: [*] Unnecessary dunder call to `__gt__`. Use `>` operator. +error[PLC2801]: 14:7: [*] Unnecessary dunder call to `__gt__`. Use `>` operator. + --> unnecessary_dunder_call.py:14:7 | 12 | print((3.0).__lt__(4.0)) # PLC2801 13 | print((3.0).__le__(4.0)) # PLC2801 @@ -231,8 +242,9 @@ error[PLC2801]: unnecessary_dunder_call.py:14:7: [*] Unnecessary dunder call to 16 16 | print((3.0).__str__()) # PLC2801 17 17 | print((3.0).__repr__()) # PLC2801 -error[PLC2801]: unnecessary_dunder_call.py:15:7: [*] Unnecessary dunder call to `__ge__`. Use `>=` operator. +error[PLC2801]: 15:7: [*] Unnecessary dunder call to `__ge__`. Use `>=` operator. + --> unnecessary_dunder_call.py:15:7 | 13 | print((3.0).__le__(4.0)) # PLC2801 14 | print((3.0).__gt__(4.0)) # PLC2801 @@ -252,8 +264,9 @@ error[PLC2801]: unnecessary_dunder_call.py:15:7: [*] Unnecessary dunder call to 17 17 | print((3.0).__repr__()) # PLC2801 18 18 | print([1, 2, 3].__len__()) # PLC2801 -error[PLC2801]: unnecessary_dunder_call.py:16:7: [*] Unnecessary dunder call to `__str__`. Use `str()` builtin. +error[PLC2801]: 16:7: [*] Unnecessary dunder call to `__str__`. Use `str()` builtin. + --> unnecessary_dunder_call.py:16:7 | 14 | print((3.0).__gt__(4.0)) # PLC2801 15 | print((3.0).__ge__(4.0)) # PLC2801 @@ -273,8 +286,9 @@ error[PLC2801]: unnecessary_dunder_call.py:16:7: [*] Unnecessary dunder call to 18 18 | print([1, 2, 3].__len__()) # PLC2801 19 19 | print((1).__neg__()) # PLC2801 -error[PLC2801]: unnecessary_dunder_call.py:17:7: [*] Unnecessary dunder call to `__repr__`. Use `repr()` builtin. +error[PLC2801]: 17:7: [*] Unnecessary dunder call to `__repr__`. Use `repr()` builtin. + --> unnecessary_dunder_call.py:17:7 | 15 | print((3.0).__ge__(4.0)) # PLC2801 16 | print((3.0).__str__()) # PLC2801 @@ -294,8 +308,9 @@ error[PLC2801]: unnecessary_dunder_call.py:17:7: [*] Unnecessary dunder call to 19 19 | print((1).__neg__()) # PLC2801 20 20 | print(-a.__sub__(1)) # PLC2801 -error[PLC2801]: unnecessary_dunder_call.py:18:7: [*] Unnecessary dunder call to `__len__`. Use `len()` builtin. +error[PLC2801]: 18:7: [*] Unnecessary dunder call to `__len__`. Use `len()` builtin. + --> unnecessary_dunder_call.py:18:7 | 16 | print((3.0).__str__()) # PLC2801 17 | print((3.0).__repr__()) # PLC2801 @@ -315,8 +330,9 @@ error[PLC2801]: unnecessary_dunder_call.py:18:7: [*] Unnecessary dunder call to 20 20 | print(-a.__sub__(1)) # PLC2801 21 21 | print(-(a).__sub__(1)) # PLC2801 -error[PLC2801]: unnecessary_dunder_call.py:19:7: Unnecessary dunder call to `__neg__`. Multiply by -1 instead. +error[PLC2801]: 19:7: Unnecessary dunder call to `__neg__`. Multiply by -1 instead. + --> unnecessary_dunder_call.py:19:7 | 17 | print((3.0).__repr__()) # PLC2801 18 | print([1, 2, 3].__len__()) # PLC2801 @@ -326,8 +342,9 @@ error[PLC2801]: unnecessary_dunder_call.py:19:7: Unnecessary dunder call to `__n 21 | print(-(a).__sub__(1)) # PLC2801 | = help: Multiply by -1 instead -error[PLC2801]: unnecessary_dunder_call.py:20:8: [*] Unnecessary dunder call to `__sub__`. Use `-` operator. +error[PLC2801]: 20:8: [*] Unnecessary dunder call to `__sub__`. Use `-` operator. + --> unnecessary_dunder_call.py:20:8 | 18 | print([1, 2, 3].__len__()) # PLC2801 19 | print((1).__neg__()) # PLC2801 @@ -347,8 +364,9 @@ error[PLC2801]: unnecessary_dunder_call.py:20:8: [*] Unnecessary dunder call to 22 22 | print(-(-a.__sub__(1))) # PLC2801 23 23 | print((5 - a).__sub__(1)) # PLC2801 -error[PLC2801]: unnecessary_dunder_call.py:21:8: [*] Unnecessary dunder call to `__sub__`. Use `-` operator. +error[PLC2801]: 21:8: [*] Unnecessary dunder call to `__sub__`. Use `-` operator. + --> unnecessary_dunder_call.py:21:8 | 19 | print((1).__neg__()) # PLC2801 20 | print(-a.__sub__(1)) # PLC2801 @@ -368,8 +386,9 @@ error[PLC2801]: unnecessary_dunder_call.py:21:8: [*] Unnecessary dunder call to 23 23 | print((5 - a).__sub__(1)) # PLC2801 24 24 | print(-(5 - a).__sub__(1)) # PLC2801 -error[PLC2801]: unnecessary_dunder_call.py:22:10: [*] Unnecessary dunder call to `__sub__`. Use `-` operator. +error[PLC2801]: 22:10: [*] Unnecessary dunder call to `__sub__`. Use `-` operator. + --> unnecessary_dunder_call.py:22:10 | 20 | print(-a.__sub__(1)) # PLC2801 21 | print(-(a).__sub__(1)) # PLC2801 @@ -389,8 +408,9 @@ error[PLC2801]: unnecessary_dunder_call.py:22:10: [*] Unnecessary dunder call to 24 24 | print(-(5 - a).__sub__(1)) # PLC2801 25 25 | print(-(-5 - a).__sub__(1)) # PLC2801 -error[PLC2801]: unnecessary_dunder_call.py:23:7: [*] Unnecessary dunder call to `__sub__`. Use `-` operator. +error[PLC2801]: 23:7: [*] Unnecessary dunder call to `__sub__`. Use `-` operator. + --> unnecessary_dunder_call.py:23:7 | 21 | print(-(a).__sub__(1)) # PLC2801 22 | print(-(-a.__sub__(1))) # PLC2801 @@ -410,8 +430,9 @@ error[PLC2801]: unnecessary_dunder_call.py:23:7: [*] Unnecessary dunder call to 25 25 | print(-(-5 - a).__sub__(1)) # PLC2801 26 26 | print(+-+-+-a.__sub__(1)) # PLC2801 -error[PLC2801]: unnecessary_dunder_call.py:24:8: [*] Unnecessary dunder call to `__sub__`. Use `-` operator. +error[PLC2801]: 24:8: [*] Unnecessary dunder call to `__sub__`. Use `-` operator. + --> unnecessary_dunder_call.py:24:8 | 22 | print(-(-a.__sub__(1))) # PLC2801 23 | print((5 - a).__sub__(1)) # PLC2801 @@ -431,8 +452,9 @@ error[PLC2801]: unnecessary_dunder_call.py:24:8: [*] Unnecessary dunder call to 26 26 | print(+-+-+-a.__sub__(1)) # PLC2801 27 27 | print(a.__rsub__(2 - 1)) # PLC2801 -error[PLC2801]: unnecessary_dunder_call.py:25:8: [*] Unnecessary dunder call to `__sub__`. Use `-` operator. +error[PLC2801]: 25:8: [*] Unnecessary dunder call to `__sub__`. Use `-` operator. + --> unnecessary_dunder_call.py:25:8 | 23 | print((5 - a).__sub__(1)) # PLC2801 24 | print(-(5 - a).__sub__(1)) # PLC2801 @@ -452,8 +474,9 @@ error[PLC2801]: unnecessary_dunder_call.py:25:8: [*] Unnecessary dunder call to 27 27 | print(a.__rsub__(2 - 1)) # PLC2801 28 28 | print(a.__sub__(((((1)))))) # PLC2801 -error[PLC2801]: unnecessary_dunder_call.py:26:13: [*] Unnecessary dunder call to `__sub__`. Use `-` operator. +error[PLC2801]: 26:13: [*] Unnecessary dunder call to `__sub__`. Use `-` operator. + --> unnecessary_dunder_call.py:26:13 | 24 | print(-(5 - a).__sub__(1)) # PLC2801 25 | print(-(-5 - a).__sub__(1)) # PLC2801 @@ -473,8 +496,9 @@ error[PLC2801]: unnecessary_dunder_call.py:26:13: [*] Unnecessary dunder call to 28 28 | print(a.__sub__(((((1)))))) # PLC2801 29 29 | print(a.__sub__(((((2 - 1)))))) # PLC2801 -error[PLC2801]: unnecessary_dunder_call.py:27:7: [*] Unnecessary dunder call to `__rsub__`. Use `-` operator. +error[PLC2801]: 27:7: [*] Unnecessary dunder call to `__rsub__`. Use `-` operator. + --> unnecessary_dunder_call.py:27:7 | 25 | print(-(-5 - a).__sub__(1)) # PLC2801 26 | print(+-+-+-a.__sub__(1)) # PLC2801 @@ -494,8 +518,9 @@ error[PLC2801]: unnecessary_dunder_call.py:27:7: [*] Unnecessary dunder call to 29 29 | print(a.__sub__(((((2 - 1)))))) # PLC2801 30 30 | print(a.__sub__( -error[PLC2801]: unnecessary_dunder_call.py:28:7: [*] Unnecessary dunder call to `__sub__`. Use `-` operator. +error[PLC2801]: 28:7: [*] Unnecessary dunder call to `__sub__`. Use `-` operator. + --> unnecessary_dunder_call.py:28:7 | 26 | print(+-+-+-a.__sub__(1)) # PLC2801 27 | print(a.__rsub__(2 - 1)) # PLC2801 @@ -515,8 +540,9 @@ error[PLC2801]: unnecessary_dunder_call.py:28:7: [*] Unnecessary dunder call to 30 30 | print(a.__sub__( 31 31 | 3 -error[PLC2801]: unnecessary_dunder_call.py:29:7: [*] Unnecessary dunder call to `__sub__`. Use `-` operator. +error[PLC2801]: 29:7: [*] Unnecessary dunder call to `__sub__`. Use `-` operator. + --> unnecessary_dunder_call.py:29:7 | 27 | print(a.__rsub__(2 - 1)) # PLC2801 28 | print(a.__sub__(((((1)))))) # PLC2801 @@ -536,8 +562,9 @@ error[PLC2801]: unnecessary_dunder_call.py:29:7: [*] Unnecessary dunder call to 31 31 | 3 32 32 | + -error[PLC2801]: unnecessary_dunder_call.py:30:7: [*] Unnecessary dunder call to `__sub__`. Use `-` operator. +error[PLC2801]: 30:7: [*] Unnecessary dunder call to `__sub__`. Use `-` operator. + --> unnecessary_dunder_call.py:30:7 | 28 | print(a.__sub__(((((1)))))) # PLC2801 29 | print(a.__sub__(((((2 - 1)))))) # PLC2801 @@ -567,8 +594,9 @@ error[PLC2801]: unnecessary_dunder_call.py:30:7: [*] Unnecessary dunder call to 36 34 | 3 37 35 | + -error[PLC2801]: unnecessary_dunder_call.py:35:7: [*] Unnecessary dunder call to `__rsub__`. Use `-` operator. +error[PLC2801]: 35:7: [*] Unnecessary dunder call to `__rsub__`. Use `-` operator. + --> unnecessary_dunder_call.py:35:7 | 33 | 4 34 | )) @@ -598,8 +626,9 @@ error[PLC2801]: unnecessary_dunder_call.py:35:7: [*] Unnecessary dunder call to 41 39 | x = 2 * a.__add__(3) # PLC2801 42 40 | x = 2 * -a.__add__(3) # PLC2801 -error[PLC2801]: unnecessary_dunder_call.py:40:11: [*] Unnecessary dunder call to `__add__`. Use `+` operator. +error[PLC2801]: 40:11: [*] Unnecessary dunder call to `__add__`. Use `+` operator. + --> unnecessary_dunder_call.py:40:11 | 38 | 4 39 | )) @@ -619,8 +648,9 @@ error[PLC2801]: unnecessary_dunder_call.py:40:11: [*] Unnecessary dunder call to 42 42 | x = 2 * -a.__add__(3) # PLC2801 43 43 | x = a.__add__(3) # PLC2801 -error[PLC2801]: unnecessary_dunder_call.py:41:9: [*] Unnecessary dunder call to `__add__`. Use `+` operator. +error[PLC2801]: 41:9: [*] Unnecessary dunder call to `__add__`. Use `+` operator. + --> unnecessary_dunder_call.py:41:9 | 39 | )) 40 | print(2 * a.__add__(3)) # PLC2801 @@ -640,8 +670,9 @@ error[PLC2801]: unnecessary_dunder_call.py:41:9: [*] Unnecessary dunder call to 43 43 | x = a.__add__(3) # PLC2801 44 44 | x = -a.__add__(3) # PLC2801 -error[PLC2801]: unnecessary_dunder_call.py:42:10: [*] Unnecessary dunder call to `__add__`. Use `+` operator. +error[PLC2801]: 42:10: [*] Unnecessary dunder call to `__add__`. Use `+` operator. + --> unnecessary_dunder_call.py:42:10 | 40 | print(2 * a.__add__(3)) # PLC2801 41 | x = 2 * a.__add__(3) # PLC2801 @@ -661,8 +692,9 @@ error[PLC2801]: unnecessary_dunder_call.py:42:10: [*] Unnecessary dunder call to 44 44 | x = -a.__add__(3) # PLC2801 45 45 | x = (-a).__add__(3) # PLC2801 -error[PLC2801]: unnecessary_dunder_call.py:43:5: [*] Unnecessary dunder call to `__add__`. Use `+` operator. +error[PLC2801]: 43:5: [*] Unnecessary dunder call to `__add__`. Use `+` operator. + --> unnecessary_dunder_call.py:43:5 | 41 | x = 2 * a.__add__(3) # PLC2801 42 | x = 2 * -a.__add__(3) # PLC2801 @@ -682,8 +714,9 @@ error[PLC2801]: unnecessary_dunder_call.py:43:5: [*] Unnecessary dunder call to 45 45 | x = (-a).__add__(3) # PLC2801 46 46 | x = -(-a).__add__(3) # PLC2801 -error[PLC2801]: unnecessary_dunder_call.py:44:6: [*] Unnecessary dunder call to `__add__`. Use `+` operator. +error[PLC2801]: 44:6: [*] Unnecessary dunder call to `__add__`. Use `+` operator. + --> unnecessary_dunder_call.py:44:6 | 42 | x = 2 * -a.__add__(3) # PLC2801 43 | x = a.__add__(3) # PLC2801 @@ -703,8 +736,9 @@ error[PLC2801]: unnecessary_dunder_call.py:44:6: [*] Unnecessary dunder call to 46 46 | x = -(-a).__add__(3) # PLC2801 47 47 | -error[PLC2801]: unnecessary_dunder_call.py:45:5: [*] Unnecessary dunder call to `__add__`. Use `+` operator. +error[PLC2801]: 45:5: [*] Unnecessary dunder call to `__add__`. Use `+` operator. + --> unnecessary_dunder_call.py:45:5 | 43 | x = a.__add__(3) # PLC2801 44 | x = -a.__add__(3) # PLC2801 @@ -723,8 +757,9 @@ error[PLC2801]: unnecessary_dunder_call.py:45:5: [*] Unnecessary dunder call to 47 47 | 48 48 | # Calls -error[PLC2801]: unnecessary_dunder_call.py:46:6: [*] Unnecessary dunder call to `__add__`. Use `+` operator. +error[PLC2801]: 46:6: [*] Unnecessary dunder call to `__add__`. Use `+` operator. + --> unnecessary_dunder_call.py:46:6 | 44 | x = -a.__add__(3) # PLC2801 45 | x = (-a).__add__(3) # PLC2801 @@ -744,8 +779,9 @@ error[PLC2801]: unnecessary_dunder_call.py:46:6: [*] Unnecessary dunder call to 48 48 | # Calls 49 49 | print(a.__call__()) # PLC2801 (no fix, intentional) -error[PLC2801]: unnecessary_dunder_call.py:49:7: Unnecessary dunder call to `__call__` +error[PLC2801]: 49:7: Unnecessary dunder call to `__call__` + --> unnecessary_dunder_call.py:49:7 | 48 | # Calls 49 | print(a.__call__()) # PLC2801 (no fix, intentional) @@ -753,8 +789,9 @@ error[PLC2801]: unnecessary_dunder_call.py:49:7: Unnecessary dunder call to `__c 50 | 51 | # Lambda expressions | -error[PLC2801]: unnecessary_dunder_call.py:52:16: [*] Unnecessary dunder call to `__add__`. Use `+` operator. +error[PLC2801]: 52:16: [*] Unnecessary dunder call to `__add__`. Use `+` operator. + --> unnecessary_dunder_call.py:52:16 | 51 | # Lambda expressions 52 | blah = lambda: a.__add__(1) # PLC2801 @@ -773,8 +810,9 @@ error[PLC2801]: unnecessary_dunder_call.py:52:16: [*] Unnecessary dunder call to 54 54 | # If expressions 55 55 | print(a.__add__(1) if a > 0 else a.__sub__(1)) # PLC2801 -error[PLC2801]: unnecessary_dunder_call.py:55:7: [*] Unnecessary dunder call to `__add__`. Use `+` operator. +error[PLC2801]: 55:7: [*] Unnecessary dunder call to `__add__`. Use `+` operator. + --> unnecessary_dunder_call.py:55:7 | 54 | # If expressions 55 | print(a.__add__(1) if a > 0 else a.__sub__(1)) # PLC2801 @@ -793,8 +831,9 @@ error[PLC2801]: unnecessary_dunder_call.py:55:7: [*] Unnecessary dunder call to 57 57 | # Dict/Set/List/Tuple 58 58 | print({"a": a.__add__(1)}) # PLC2801 -error[PLC2801]: unnecessary_dunder_call.py:55:34: [*] Unnecessary dunder call to `__sub__`. Use `-` operator. +error[PLC2801]: 55:34: [*] Unnecessary dunder call to `__sub__`. Use `-` operator. + --> unnecessary_dunder_call.py:55:34 | 54 | # If expressions 55 | print(a.__add__(1) if a > 0 else a.__sub__(1)) # PLC2801 @@ -813,8 +852,9 @@ error[PLC2801]: unnecessary_dunder_call.py:55:34: [*] Unnecessary dunder call to 57 57 | # Dict/Set/List/Tuple 58 58 | print({"a": a.__add__(1)}) # PLC2801 -error[PLC2801]: unnecessary_dunder_call.py:58:13: [*] Unnecessary dunder call to `__add__`. Use `+` operator. +error[PLC2801]: 58:13: [*] Unnecessary dunder call to `__add__`. Use `+` operator. + --> unnecessary_dunder_call.py:58:13 | 57 | # Dict/Set/List/Tuple 58 | print({"a": a.__add__(1)}) # PLC2801 @@ -833,8 +873,9 @@ error[PLC2801]: unnecessary_dunder_call.py:58:13: [*] Unnecessary dunder call to 60 60 | print([a.__add__(1)]) # PLC2801 61 61 | print((a.__add__(1),)) # PLC2801 -error[PLC2801]: unnecessary_dunder_call.py:59:8: [*] Unnecessary dunder call to `__add__`. Use `+` operator. +error[PLC2801]: 59:8: [*] Unnecessary dunder call to `__add__`. Use `+` operator. + --> unnecessary_dunder_call.py:59:8 | 57 | # Dict/Set/List/Tuple 58 | print({"a": a.__add__(1)}) # PLC2801 @@ -854,8 +895,9 @@ error[PLC2801]: unnecessary_dunder_call.py:59:8: [*] Unnecessary dunder call to 61 61 | print((a.__add__(1),)) # PLC2801 62 62 | -error[PLC2801]: unnecessary_dunder_call.py:60:8: [*] Unnecessary dunder call to `__add__`. Use `+` operator. +error[PLC2801]: 60:8: [*] Unnecessary dunder call to `__add__`. Use `+` operator. + --> unnecessary_dunder_call.py:60:8 | 58 | print({"a": a.__add__(1)}) # PLC2801 59 | print({a.__add__(1)}) # PLC2801 @@ -874,8 +916,9 @@ error[PLC2801]: unnecessary_dunder_call.py:60:8: [*] Unnecessary dunder call to 62 62 | 63 63 | # Comprehension variants -error[PLC2801]: unnecessary_dunder_call.py:61:8: [*] Unnecessary dunder call to `__add__`. Use `+` operator. +error[PLC2801]: 61:8: [*] Unnecessary dunder call to `__add__`. Use `+` operator. + --> unnecessary_dunder_call.py:61:8 | 59 | print({a.__add__(1)}) # PLC2801 60 | print([a.__add__(1)]) # PLC2801 @@ -895,8 +938,9 @@ error[PLC2801]: unnecessary_dunder_call.py:61:8: [*] Unnecessary dunder call to 63 63 | # Comprehension variants 64 64 | print({i: i.__add__(1) for i in range(5)}) # PLC2801 -error[PLC2801]: unnecessary_dunder_call.py:64:11: [*] Unnecessary dunder call to `__add__`. Use `+` operator. +error[PLC2801]: 64:11: [*] Unnecessary dunder call to `__add__`. Use `+` operator. + --> unnecessary_dunder_call.py:64:11 | 63 | # Comprehension variants 64 | print({i: i.__add__(1) for i in range(5)}) # PLC2801 @@ -915,8 +959,9 @@ error[PLC2801]: unnecessary_dunder_call.py:64:11: [*] Unnecessary dunder call to 66 66 | print([i.__add__(1) for i in range(5)]) # PLC2801 67 67 | print((i.__add__(1) for i in range(5))) # PLC2801 -error[PLC2801]: unnecessary_dunder_call.py:65:8: [*] Unnecessary dunder call to `__add__`. Use `+` operator. +error[PLC2801]: 65:8: [*] Unnecessary dunder call to `__add__`. Use `+` operator. + --> unnecessary_dunder_call.py:65:8 | 63 | # Comprehension variants 64 | print({i: i.__add__(1) for i in range(5)}) # PLC2801 @@ -936,8 +981,9 @@ error[PLC2801]: unnecessary_dunder_call.py:65:8: [*] Unnecessary dunder call to 67 67 | print((i.__add__(1) for i in range(5))) # PLC2801 68 68 | -error[PLC2801]: unnecessary_dunder_call.py:66:8: [*] Unnecessary dunder call to `__add__`. Use `+` operator. +error[PLC2801]: 66:8: [*] Unnecessary dunder call to `__add__`. Use `+` operator. + --> unnecessary_dunder_call.py:66:8 | 64 | print({i: i.__add__(1) for i in range(5)}) # PLC2801 65 | print({i.__add__(1) for i in range(5)}) # PLC2801 @@ -956,8 +1002,9 @@ error[PLC2801]: unnecessary_dunder_call.py:66:8: [*] Unnecessary dunder call to 68 68 | 69 69 | # Generators -error[PLC2801]: unnecessary_dunder_call.py:67:8: [*] Unnecessary dunder call to `__add__`. Use `+` operator. +error[PLC2801]: 67:8: [*] Unnecessary dunder call to `__add__`. Use `+` operator. + --> unnecessary_dunder_call.py:67:8 | 65 | print({i.__add__(1) for i in range(5)}) # PLC2801 66 | print([i.__add__(1) for i in range(5)]) # PLC2801 @@ -977,8 +1024,9 @@ error[PLC2801]: unnecessary_dunder_call.py:67:8: [*] Unnecessary dunder call to 69 69 | # Generators 70 70 | gen = (i.__add__(1) for i in range(5)) # PLC2801 -error[PLC2801]: unnecessary_dunder_call.py:70:8: [*] Unnecessary dunder call to `__add__`. Use `+` operator. +error[PLC2801]: 70:8: [*] Unnecessary dunder call to `__add__`. Use `+` operator. + --> unnecessary_dunder_call.py:70:8 | 69 | # Generators 70 | gen = (i.__add__(1) for i in range(5)) # PLC2801 @@ -996,8 +1044,9 @@ error[PLC2801]: unnecessary_dunder_call.py:70:8: [*] Unnecessary dunder call to 72 72 | 73 73 | # Subscripts -error[PLC2801]: unnecessary_dunder_call.py:74:13: [*] Unnecessary dunder call to `__add__`. Use `+` operator. +error[PLC2801]: 74:13: [*] Unnecessary dunder call to `__add__`. Use `+` operator. + --> unnecessary_dunder_call.py:74:13 | 73 | # Subscripts 74 | print({"a": a.__add__(1)}["a"]) # PLC2801 @@ -1016,8 +1065,9 @@ error[PLC2801]: unnecessary_dunder_call.py:74:13: [*] Unnecessary dunder call to 76 76 | # Starred 77 77 | print(*[a.__add__(1)]) # PLC2801 -error[PLC2801]: unnecessary_dunder_call.py:77:9: [*] Unnecessary dunder call to `__add__`. Use `+` operator. +error[PLC2801]: 77:9: [*] Unnecessary dunder call to `__add__`. Use `+` operator. + --> unnecessary_dunder_call.py:77:9 | 76 | # Starred 77 | print(*[a.__add__(1)]) # PLC2801 @@ -1036,8 +1086,9 @@ error[PLC2801]: unnecessary_dunder_call.py:77:9: [*] Unnecessary dunder call to 79 79 | # Slices 80 80 | print([a.__add__(1), a.__sub__(1)][0:1]) # PLC2801 -error[PLC2801]: unnecessary_dunder_call.py:80:8: [*] Unnecessary dunder call to `__add__`. Use `+` operator. +error[PLC2801]: 80:8: [*] Unnecessary dunder call to `__add__`. Use `+` operator. + --> unnecessary_dunder_call.py:80:8 | 79 | # Slices 80 | print([a.__add__(1), a.__sub__(1)][0:1]) # PLC2801 @@ -1054,8 +1105,9 @@ error[PLC2801]: unnecessary_dunder_call.py:80:8: [*] Unnecessary dunder call to 82 82 | 83 83 | class Thing: -error[PLC2801]: unnecessary_dunder_call.py:80:22: [*] Unnecessary dunder call to `__sub__`. Use `-` operator. +error[PLC2801]: 80:22: [*] Unnecessary dunder call to `__sub__`. Use `-` operator. + --> unnecessary_dunder_call.py:80:22 | 79 | # Slices 80 | print([a.__add__(1), a.__sub__(1)][0:1]) # PLC2801 @@ -1072,8 +1124,9 @@ error[PLC2801]: unnecessary_dunder_call.py:80:22: [*] Unnecessary dunder call to 82 82 | 83 83 | class Thing: -error[PLC2801]: unnecessary_dunder_call.py:92:16: Unnecessary dunder call to `__getattribute__`. Access attribute directly or use getattr built-in function. +error[PLC2801]: 92:16: Unnecessary dunder call to `__getattribute__`. Access attribute directly or use getattr built-in function. + --> unnecessary_dunder_call.py:92:16 | 91 | def do_thing(self, item): 92 | return object.__getattribute__(self, item) # PLC2801 diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC3002_unnecessary_direct_lambda_call.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC3002_unnecessary_direct_lambda_call.py.snap index a396b88771..eccd3ffd00 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC3002_unnecessary_direct_lambda_call.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC3002_unnecessary_direct_lambda_call.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLC3002]: unnecessary_direct_lambda_call.py:4:5: Lambda expression called directly. Execute the expression inline instead. +error[PLC3002]: 4:5: Lambda expression called directly. Execute the expression inline instead. + --> unnecessary_direct_lambda_call.py:4:5 | 2 | # pylint: disable=undefined-variable, line-too-long 3 | @@ -10,15 +11,17 @@ error[PLC3002]: unnecessary_direct_lambda_call.py:4:5: Lambda expression called | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 5 | y = max((lambda x: x**2)(a), (lambda x: x+1)(a)) # [unnecessary-direct-lambda-call,unnecessary-direct-lambda-call] | -error[PLC3002]: unnecessary_direct_lambda_call.py:5:9: Lambda expression called directly. Execute the expression inline instead. +error[PLC3002]: 5:9: Lambda expression called directly. Execute the expression inline instead. + --> unnecessary_direct_lambda_call.py:5:9 | 4 | y = (lambda x: x**2 + 2*x + 1)(a) # [unnecessary-direct-lambda-call] 5 | y = max((lambda x: x**2)(a), (lambda x: x+1)(a)) # [unnecessary-direct-lambda-call,unnecessary-direct-lambda-call] | ^^^^^^^^^^^^^^^^^^^ | -error[PLC3002]: unnecessary_direct_lambda_call.py:5:30: Lambda expression called directly. Execute the expression inline instead. +error[PLC3002]: 5:30: Lambda expression called directly. Execute the expression inline instead. + --> unnecessary_direct_lambda_call.py:5:30 | 4 | y = (lambda x: x**2 + 2*x + 1)(a) # [unnecessary-direct-lambda-call] 5 | y = max((lambda x: x**2)(a), (lambda x: x+1)(a)) # [unnecessary-direct-lambda-call,unnecessary-direct-lambda-call] diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0100_yield_in_init.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0100_yield_in_init.py.snap index e48aec3c63..b88991025a 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0100_yield_in_init.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0100_yield_in_init.py.snap @@ -1,16 +1,18 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLE0100]: yield_in_init.py:9:9: `__init__` method is a generator +error[PLE0100]: 9:9: `__init__` method is a generator + --> yield_in_init.py:9:9 | 7 | class A: 8 | def __init__(self): 9 | yield | ^^^^^ | -error[PLE0100]: yield_in_init.py:14:9: `__init__` method is a generator +error[PLE0100]: 14:9: `__init__` method is a generator + --> yield_in_init.py:14:9 | 12 | class B: 13 | def __init__(self): diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0101_return_in_init.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0101_return_in_init.py.snap index 2f6f91659d..a73da341cb 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0101_return_in_init.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0101_return_in_init.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLE0101]: return_in_init.py:14:9: Explicit return in `__init__` +error[PLE0101]: 14:9: Explicit return in `__init__` + --> return_in_init.py:14:9 | 12 | class B: 13 | def __init__(self): @@ -11,8 +12,9 @@ error[PLE0101]: return_in_init.py:14:9: Explicit return in `__init__` 15 | 16 | def gen(self): | -error[PLE0101]: return_in_init.py:22:9: Explicit return in `__init__` +error[PLE0101]: 22:9: Explicit return in `__init__` + --> return_in_init.py:22:9 | 21 | def __init__(self): 22 | return 1 diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0115_nonlocal_and_global.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0115_nonlocal_and_global.py.snap index cc03da1ab8..943de0a3d8 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0115_nonlocal_and_global.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0115_nonlocal_and_global.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLE0115]: nonlocal_and_global.py:7:12: Name `counter` is both `nonlocal` and `global` +error[PLE0115]: 7:12: Name `counter` is both `nonlocal` and `global` + --> nonlocal_and_global.py:7:12 | 6 | def count(): 7 | global counter @@ -10,8 +11,9 @@ error[PLE0115]: nonlocal_and_global.py:7:12: Name `counter` is both `nonlocal` a 8 | nonlocal counter 9 | counter += 1 | -error[PLE0115]: nonlocal_and_global.py:20:20: Name `counter` is both `nonlocal` and `global` +error[PLE0115]: 20:20: Name `counter` is both `nonlocal` and `global` + --> nonlocal_and_global.py:20:20 | 18 | counter += 1 19 | else: @@ -19,16 +21,18 @@ error[PLE0115]: nonlocal_and_global.py:20:20: Name `counter` is both `nonlocal` | ^^^^^^^ 21 | counter += 1 | -error[PLE0115]: nonlocal_and_global.py:31:16: Name `counter` is both `nonlocal` and `global` +error[PLE0115]: 31:16: Name `counter` is both `nonlocal` and `global` + --> nonlocal_and_global.py:31:16 | 29 | nonlocal counter 30 | counter += 1 31 | global counter | ^^^^^^^ | -error[PLE0115]: nonlocal_and_global.py:36:12: Name `counter` is both `nonlocal` and `global` +error[PLE0115]: 36:12: Name `counter` is both `nonlocal` and `global` + --> nonlocal_and_global.py:36:12 | 34 | def count(): 35 | nonlocal counter diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0117_nonlocal_without_binding.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0117_nonlocal_without_binding.py.snap index ee044c2cea..2f3634c726 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0117_nonlocal_without_binding.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0117_nonlocal_without_binding.py.snap @@ -1,22 +1,25 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLE0117]: nonlocal_without_binding.py:5:14: Nonlocal name `x` found without binding +error[PLE0117]: 5:14: Nonlocal name `x` found without binding + --> nonlocal_without_binding.py:5:14 | 4 | def f(): 5 | nonlocal x | ^ | -error[PLE0117]: nonlocal_without_binding.py:9:14: Nonlocal name `y` found without binding +error[PLE0117]: 9:14: Nonlocal name `y` found without binding + --> nonlocal_without_binding.py:9:14 | 8 | def f(): 9 | nonlocal y | ^ | -error[PLE0117]: nonlocal_without_binding.py:19:18: Nonlocal name `y` found without binding +error[PLE0117]: 19:18: Nonlocal name `y` found without binding + --> nonlocal_without_binding.py:19:18 | 18 | def f(): 19 | nonlocal y diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0118_load_before_global_declaration.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0118_load_before_global_declaration.py.snap index 316dd9dcdb..090b5fe517 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0118_load_before_global_declaration.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0118_load_before_global_declaration.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLE0118]: load_before_global_declaration.py:5:11: Name `x` is used prior to global declaration on line 7 +error[PLE0118]: 5:11: Name `x` is used prior to global declaration on line 7 + --> load_before_global_declaration.py:5:11 | 3 | ### 4 | def f(): @@ -11,8 +12,9 @@ error[PLE0118]: load_before_global_declaration.py:5:11: Name `x` is used prior t 6 | 7 | global x | -error[PLE0118]: load_before_global_declaration.py:15:11: Name `x` is used prior to global declaration on line 17 +error[PLE0118]: 15:11: Name `x` is used prior to global declaration on line 17 + --> load_before_global_declaration.py:15:11 | 13 | global x 14 | @@ -21,8 +23,9 @@ error[PLE0118]: load_before_global_declaration.py:15:11: Name `x` is used prior 16 | 17 | global x | -error[PLE0118]: load_before_global_declaration.py:23:11: Name `x` is used prior to global declaration on line 25 +error[PLE0118]: 23:11: Name `x` is used prior to global declaration on line 25 + --> load_before_global_declaration.py:23:11 | 22 | def f(): 23 | print(x) @@ -30,8 +33,9 @@ error[PLE0118]: load_before_global_declaration.py:23:11: Name `x` is used prior 24 | 25 | global x, y | -error[PLE0118]: load_before_global_declaration.py:33:11: Name `x` is used prior to global declaration on line 35 +error[PLE0118]: 33:11: Name `x` is used prior to global declaration on line 35 + --> load_before_global_declaration.py:33:11 | 31 | global x, y 32 | @@ -40,8 +44,9 @@ error[PLE0118]: load_before_global_declaration.py:33:11: Name `x` is used prior 34 | 35 | global x, y | -error[PLE0118]: load_before_global_declaration.py:41:5: Name `x` is used prior to global declaration on line 43 +error[PLE0118]: 41:5: Name `x` is used prior to global declaration on line 43 + --> load_before_global_declaration.py:41:5 | 40 | def f(): 41 | x = 1 @@ -49,8 +54,9 @@ error[PLE0118]: load_before_global_declaration.py:41:5: Name `x` is used prior t 42 | 43 | global x | -error[PLE0118]: load_before_global_declaration.py:51:5: Name `x` is used prior to global declaration on line 53 +error[PLE0118]: 51:5: Name `x` is used prior to global declaration on line 53 + --> load_before_global_declaration.py:51:5 | 49 | global x 50 | @@ -59,8 +65,9 @@ error[PLE0118]: load_before_global_declaration.py:51:5: Name `x` is used prior t 52 | 53 | global x | -error[PLE0118]: load_before_global_declaration.py:59:9: Name `x` is used prior to global declaration on line 61 +error[PLE0118]: 59:9: Name `x` is used prior to global declaration on line 61 + --> load_before_global_declaration.py:59:9 | 58 | def f(): 59 | del x @@ -68,8 +75,9 @@ error[PLE0118]: load_before_global_declaration.py:59:9: Name `x` is used prior t 60 | 61 | global x, y | -error[PLE0118]: load_before_global_declaration.py:69:9: Name `x` is used prior to global declaration on line 71 +error[PLE0118]: 69:9: Name `x` is used prior to global declaration on line 71 + --> load_before_global_declaration.py:69:9 | 67 | global x, y 68 | @@ -78,8 +86,9 @@ error[PLE0118]: load_before_global_declaration.py:69:9: Name `x` is used prior t 70 | 71 | global x, y | -error[PLE0118]: load_before_global_declaration.py:77:9: Name `x` is used prior to global declaration on line 79 +error[PLE0118]: 77:9: Name `x` is used prior to global declaration on line 79 + --> load_before_global_declaration.py:77:9 | 76 | def f(): 77 | del x @@ -87,8 +96,9 @@ error[PLE0118]: load_before_global_declaration.py:77:9: Name `x` is used prior t 78 | 79 | global x | -error[PLE0118]: load_before_global_declaration.py:87:9: Name `x` is used prior to global declaration on line 89 +error[PLE0118]: 87:9: Name `x` is used prior to global declaration on line 89 + --> load_before_global_declaration.py:87:9 | 85 | global x 86 | @@ -97,8 +107,9 @@ error[PLE0118]: load_before_global_declaration.py:87:9: Name `x` is used prior t 88 | 89 | global x | -error[PLE0118]: load_before_global_declaration.py:95:9: Name `x` is used prior to global declaration on line 97 +error[PLE0118]: 95:9: Name `x` is used prior to global declaration on line 97 + --> load_before_global_declaration.py:95:9 | 94 | def f(): 95 | del x @@ -106,8 +117,9 @@ error[PLE0118]: load_before_global_declaration.py:95:9: Name `x` is used prior t 96 | 97 | global x, y | -error[PLE0118]: load_before_global_declaration.py:105:9: Name `x` is used prior to global declaration on line 107 +error[PLE0118]: 105:9: Name `x` is used prior to global declaration on line 107 + --> load_before_global_declaration.py:105:9 | 103 | global x, y 104 | @@ -116,8 +128,9 @@ error[PLE0118]: load_before_global_declaration.py:105:9: Name `x` is used prior 106 | 107 | global x, y | -error[PLE0118]: load_before_global_declaration.py:113:14: Name `x` is used prior to global declaration on line 114 +error[PLE0118]: 113:14: Name `x` is used prior to global declaration on line 114 + --> load_before_global_declaration.py:113:14 | 112 | def f(): 113 | print(f"{x=}") diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0237_non_slot_assignment.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0237_non_slot_assignment.py.snap index 56a7db4e01..e644f7c4d2 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0237_non_slot_assignment.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0237_non_slot_assignment.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLE0237]: non_slot_assignment.py:6:9: Attribute `surname` is not defined in class's `__slots__` +error[PLE0237]: 6:9: Attribute `surname` is not defined in class's `__slots__` + --> non_slot_assignment.py:6:9 | 4 | def __init__(self, name, surname): 5 | self.name = name @@ -10,8 +11,9 @@ error[PLE0237]: non_slot_assignment.py:6:9: Attribute `surname` is not defined i | ^^^^^^^^^^^^ 7 | self.setup() | -error[PLE0237]: non_slot_assignment.py:18:9: Attribute `middle_name` is not defined in class's `__slots__` +error[PLE0237]: 18:9: Attribute `middle_name` is not defined in class's `__slots__` + --> non_slot_assignment.py:18:9 | 16 | def __init__(self, name, middle_name): 17 | self.name = name @@ -19,8 +21,9 @@ error[PLE0237]: non_slot_assignment.py:18:9: Attribute `middle_name` is not defi | ^^^^^^^^^^^^^^^^ 19 | self.setup() | -error[PLE0237]: non_slot_assignment.py:42:9: Attribute `middle_name` is not defined in class's `__slots__` +error[PLE0237]: 42:9: Attribute `middle_name` is not defined in class's `__slots__` + --> non_slot_assignment.py:42:9 | 40 | def __init__(self, name, middle_name): 41 | self.name = name diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0241_duplicate_bases.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0241_duplicate_bases.py.snap index f939250ceb..ac8b5a3e7e 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0241_duplicate_bases.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0241_duplicate_bases.py.snap @@ -1,15 +1,16 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -duplicate_bases.py:13:13: PLE0241 [*] Duplicate base `A` for class `F1` +error[PLE0241]: 13:13: [*] Duplicate base `A` for class `F1` + + --> duplicate_bases.py:13:13 | 12 | # Duplicate base class is last. 13 | class F1(A, A): - | ^ PLE0241 + | ^ 14 | ... | = help: Remove duplicate base - ℹ Safe fix 10 10 | 11 11 | @@ -20,14 +21,15 @@ duplicate_bases.py:13:13: PLE0241 [*] Duplicate base `A` for class `F1` 15 15 | 16 16 | -duplicate_bases.py:17:13: PLE0241 [*] Duplicate base `A` for class `F2` +error[PLE0241]: 17:13: [*] Duplicate base `A` for class `F2` + + --> duplicate_bases.py:17:13 | 17 | class F2(A, A,): - | ^ PLE0241 + | ^ 18 | ... | = help: Remove duplicate base - ℹ Safe fix 14 14 | ... 15 15 | @@ -38,17 +40,18 @@ duplicate_bases.py:17:13: PLE0241 [*] Duplicate base `A` for class `F2` 19 19 | 20 20 | -duplicate_bases.py:23:5: PLE0241 [*] Duplicate base `A` for class `F3` +error[PLE0241]: 23:5: [*] Duplicate base `A` for class `F3` + + --> duplicate_bases.py:23:5 | 21 | class F3( 22 | A, 23 | A - | ^ PLE0241 + | ^ 24 | ): 25 | ... | = help: Remove duplicate base - ℹ Safe fix 19 19 | 20 20 | @@ -58,17 +61,18 @@ duplicate_bases.py:23:5: PLE0241 [*] Duplicate base `A` for class `F3` 24 23 | ): 25 24 | ... -duplicate_bases.py:30:5: PLE0241 [*] Duplicate base `A` for class `F4` +error[PLE0241]: 30:5: [*] Duplicate base `A` for class `F4` + + --> duplicate_bases.py:30:5 | 28 | class F4( 29 | A, 30 | A, - | ^ PLE0241 + | ^ 31 | ): 32 | ... | = help: Remove duplicate base - ℹ Safe fix 27 27 | 28 28 | class F4( @@ -78,15 +82,16 @@ duplicate_bases.py:30:5: PLE0241 [*] Duplicate base `A` for class `F4` 32 31 | ... 33 32 | -duplicate_bases.py:36:13: PLE0241 [*] Duplicate base `A` for class `G1` +error[PLE0241]: 36:13: [*] Duplicate base `A` for class `G1` + + --> duplicate_bases.py:36:13 | 35 | # Duplicate base class is not last. 36 | class G1(A, A, B): - | ^ PLE0241 + | ^ 37 | ... | = help: Remove duplicate base - ℹ Safe fix 33 33 | 34 34 | @@ -97,14 +102,15 @@ duplicate_bases.py:36:13: PLE0241 [*] Duplicate base `A` for class `G1` 38 38 | 39 39 | -duplicate_bases.py:40:13: PLE0241 [*] Duplicate base `A` for class `G2` +error[PLE0241]: 40:13: [*] Duplicate base `A` for class `G2` + + --> duplicate_bases.py:40:13 | 40 | class G2(A, A, B,): - | ^ PLE0241 + | ^ 41 | ... | = help: Remove duplicate base - ℹ Safe fix 37 37 | ... 38 38 | @@ -115,17 +121,18 @@ duplicate_bases.py:40:13: PLE0241 [*] Duplicate base `A` for class `G2` 42 42 | 43 43 | -duplicate_bases.py:46:5: PLE0241 [*] Duplicate base `A` for class `G3` +error[PLE0241]: 46:5: [*] Duplicate base `A` for class `G3` + + --> duplicate_bases.py:46:5 | 44 | class G3( 45 | A, 46 | A, - | ^ PLE0241 + | ^ 47 | B 48 | ): | = help: Remove duplicate base - ℹ Safe fix 43 43 | 44 44 | class G3( @@ -135,17 +142,18 @@ duplicate_bases.py:46:5: PLE0241 [*] Duplicate base `A` for class `G3` 48 47 | ): 49 48 | ... -duplicate_bases.py:54:5: PLE0241 [*] Duplicate base `A` for class `G4` +error[PLE0241]: 54:5: [*] Duplicate base `A` for class `G4` + + --> duplicate_bases.py:54:5 | 52 | class G4( 53 | A, 54 | A, - | ^ PLE0241 + | ^ 55 | B, 56 | ): | = help: Remove duplicate base - ℹ Safe fix 51 51 | 52 52 | class G4( diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0302_unexpected_special_method_signature.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0302_unexpected_special_method_signature.py.snap index e221a70e88..accf680ee9 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0302_unexpected_special_method_signature.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0302_unexpected_special_method_signature.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLE0302]: unexpected_special_method_signature.py:5:9: The special method `__bool__` expects 1 parameter, 2 were given +error[PLE0302]: 5:9: The special method `__bool__` expects 1 parameter, 2 were given + --> unexpected_special_method_signature.py:5:9 | 3 | ... 4 | @@ -10,16 +11,18 @@ error[PLE0302]: unexpected_special_method_signature.py:5:9: The special method ` | ^^^^^^^^ 6 | ... | -error[PLE0302]: unexpected_special_method_signature.py:19:9: The special method `__bool__` expects 0 parameters, 1 was given +error[PLE0302]: 19:9: The special method `__bool__` expects 0 parameters, 1 was given + --> unexpected_special_method_signature.py:19:9 | 18 | @staticmethod 19 | def __bool__(x): # too many mandatory args | ^^^^^^^^ 20 | ... | -error[PLE0302]: unexpected_special_method_signature.py:32:9: The special method `__eq__` expects 2 parameters, 1 was given +error[PLE0302]: 32:9: The special method `__eq__` expects 2 parameters, 1 was given + --> unexpected_special_method_signature.py:32:9 | 30 | ... 31 | @@ -27,8 +30,9 @@ error[PLE0302]: unexpected_special_method_signature.py:32:9: The special method | ^^^^^^ 33 | ... | -error[PLE0302]: unexpected_special_method_signature.py:35:9: The special method `__eq__` expects 2 parameters, 3 were given +error[PLE0302]: 35:9: The special method `__eq__` expects 2 parameters, 3 were given + --> unexpected_special_method_signature.py:35:9 | 33 | ... 34 | @@ -36,8 +40,9 @@ error[PLE0302]: unexpected_special_method_signature.py:35:9: The special method | ^^^^^^ 36 | ... | -error[PLE0302]: unexpected_special_method_signature.py:44:9: The special method `__round__` expects between 1 and 2 parameters, 3 were given +error[PLE0302]: 44:9: The special method `__round__` expects between 1 and 2 parameters, 3 were given + --> unexpected_special_method_signature.py:44:9 | 42 | ... 43 | @@ -45,8 +50,9 @@ error[PLE0302]: unexpected_special_method_signature.py:44:9: The special method | ^^^^^^^^^ 45 | ... | -error[PLE0302]: unexpected_special_method_signature.py:47:9: The special method `__round__` expects between 1 and 2 parameters, 4 were given +error[PLE0302]: 47:9: The special method `__round__` expects between 1 and 2 parameters, 4 were given + --> unexpected_special_method_signature.py:47:9 | 45 | ... 46 | @@ -54,8 +60,9 @@ error[PLE0302]: unexpected_special_method_signature.py:47:9: The special method | ^^^^^^^^^ 48 | ... | -error[PLE0302]: unexpected_special_method_signature.py:56:9: The special method `__eq__` expects 2 parameters, 3 were given +error[PLE0302]: 56:9: The special method `__eq__` expects 2 parameters, 3 were given + --> unexpected_special_method_signature.py:56:9 | 54 | ... 55 | @@ -63,8 +70,9 @@ error[PLE0302]: unexpected_special_method_signature.py:56:9: The special method | ^^^^^^ 57 | ... | -error[PLE0302]: unexpected_special_method_signature.py:65:9: The special method `__round__` expects between 1 and 2 parameters, 3 were given +error[PLE0302]: 65:9: The special method `__round__` expects between 1 and 2 parameters, 3 were given + --> unexpected_special_method_signature.py:65:9 | 63 | ... 64 | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0303_invalid_return_type_length.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0303_invalid_return_type_length.py.snap index 90b78553c9..6937e7c1ef 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0303_invalid_return_type_length.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0303_invalid_return_type_length.py.snap @@ -1,40 +1,45 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLE0303]: invalid_return_type_length.py:6:16: `__len__` does not return a non-negative integer +error[PLE0303]: 6:16: `__len__` does not return a non-negative integer + --> invalid_return_type_length.py:6:16 | 4 | class Bool: 5 | def __len__(self): 6 | return True # [invalid-length-return] | ^^^^ | -error[PLE0303]: invalid_return_type_length.py:11:16: `__len__` does not return a non-negative integer +error[PLE0303]: 11:16: `__len__` does not return a non-negative integer + --> invalid_return_type_length.py:11:16 | 9 | class Float: 10 | def __len__(self): 11 | return 3.05 # [invalid-length-return] | ^^^^ | -error[PLE0303]: invalid_return_type_length.py:16:16: `__len__` does not return a non-negative integer +error[PLE0303]: 16:16: `__len__` does not return a non-negative integer + --> invalid_return_type_length.py:16:16 | 14 | class Str: 15 | def __len__(self): 16 | return "ruff" # [invalid-length-return] | ^^^^^^ | -error[PLE0303]: invalid_return_type_length.py:20:9: `__len__` does not return a non-negative integer +error[PLE0303]: 20:9: `__len__` does not return a non-negative integer + --> invalid_return_type_length.py:20:9 | 19 | class LengthNoReturn: 20 | def __len__(self): | ^^^^^^^ 21 | print("ruff") # [invalid-length-return] | -error[PLE0303]: invalid_return_type_length.py:26:16: `__len__` does not return a non-negative integer +error[PLE0303]: 26:16: `__len__` does not return a non-negative integer + --> invalid_return_type_length.py:26:16 | 24 | class LengthNegative: 25 | def __len__(self): diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0304_invalid_return_type_bool.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0304_invalid_return_type_bool.py.snap index 1ed0c564b5..234529a20d 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0304_invalid_return_type_bool.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0304_invalid_return_type_bool.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLE0304]: invalid_return_type_bool.py:5:16: `__bool__` does not return `bool` +error[PLE0304]: 5:16: `__bool__` does not return `bool` + --> invalid_return_type_bool.py:5:16 | 3 | class Float: 4 | def __bool__(self): @@ -11,8 +12,9 @@ error[PLE0304]: invalid_return_type_bool.py:5:16: `__bool__` does not return `bo 6 | 7 | class Int: | -error[PLE0304]: invalid_return_type_bool.py:9:16: `__bool__` does not return `bool` +error[PLE0304]: 9:16: `__bool__` does not return `bool` + --> invalid_return_type_bool.py:9:16 | 7 | class Int: 8 | def __bool__(self): diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0305_invalid_return_type_index.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0305_invalid_return_type_index.py.snap index c52df4f7fa..fed5837865 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0305_invalid_return_type_index.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0305_invalid_return_type_index.py.snap @@ -1,39 +1,44 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLE0305]: invalid_return_type_index.py:8:16: `__index__` does not return an integer +error[PLE0305]: 8:16: `__index__` does not return an integer + --> invalid_return_type_index.py:8:16 | 7 | def __index__(self): 8 | return True # [invalid-index-return] | ^^^^ | -error[PLE0305]: invalid_return_type_index.py:13:16: `__index__` does not return an integer +error[PLE0305]: 13:16: `__index__` does not return an integer + --> invalid_return_type_index.py:13:16 | 11 | class Float: 12 | def __index__(self): 13 | return 3.05 # [invalid-index-return] | ^^^^ | -error[PLE0305]: invalid_return_type_index.py:18:16: `__index__` does not return an integer +error[PLE0305]: 18:16: `__index__` does not return an integer + --> invalid_return_type_index.py:18:16 | 16 | class Dict: 17 | def __index__(self): 18 | return {"1": "1"} # [invalid-index-return] | ^^^^^^^^^^ | -error[PLE0305]: invalid_return_type_index.py:23:16: `__index__` does not return an integer +error[PLE0305]: 23:16: `__index__` does not return an integer + --> invalid_return_type_index.py:23:16 | 21 | class Str: 22 | def __index__(self): 23 | return "ruff" # [invalid-index-return] | ^^^^^^ | -error[PLE0305]: invalid_return_type_index.py:27:9: `__index__` does not return an integer +error[PLE0305]: 27:9: `__index__` does not return an integer + --> invalid_return_type_index.py:27:9 | 26 | class IndexNoReturn: 27 | def __index__(self): diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0307_invalid_return_type_str.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0307_invalid_return_type_str.py.snap index 855519b416..b46672edea 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0307_invalid_return_type_str.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0307_invalid_return_type_str.py.snap @@ -1,40 +1,45 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLE0307]: invalid_return_type_str.py:6:16: `__str__` does not return `str` +error[PLE0307]: 6:16: `__str__` does not return `str` + --> invalid_return_type_str.py:6:16 | 4 | class Float: 5 | def __str__(self): 6 | return 3.05 | ^^^^ | -error[PLE0307]: invalid_return_type_str.py:11:16: `__str__` does not return `str` +error[PLE0307]: 11:16: `__str__` does not return `str` + --> invalid_return_type_str.py:11:16 | 9 | class Int: 10 | def __str__(self): 11 | return 1 | ^ | -error[PLE0307]: invalid_return_type_str.py:16:16: `__str__` does not return `str` +error[PLE0307]: 16:16: `__str__` does not return `str` + --> invalid_return_type_str.py:16:16 | 14 | class Int2: 15 | def __str__(self): 16 | return 0 | ^ | -error[PLE0307]: invalid_return_type_str.py:21:16: `__str__` does not return `str` +error[PLE0307]: 21:16: `__str__` does not return `str` + --> invalid_return_type_str.py:21:16 | 19 | class Bool: 20 | def __str__(self): 21 | return False | ^^^^^ | -error[PLE0307]: invalid_return_type_str.py:58:9: `__str__` does not return `str` +error[PLE0307]: 58:9: `__str__` does not return `str` + --> invalid_return_type_str.py:58:9 | 57 | class Str5: 58 | def __str__(self): # PLE0307 (returns None if x <= 0) diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0308_invalid_return_type_bytes.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0308_invalid_return_type_bytes.py.snap index fababb9ed9..cefc56675f 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0308_invalid_return_type_bytes.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0308_invalid_return_type_bytes.py.snap @@ -1,32 +1,36 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLE0308]: invalid_return_type_bytes.py:6:16: `__bytes__` does not return `bytes` +error[PLE0308]: 6:16: `__bytes__` does not return `bytes` + --> invalid_return_type_bytes.py:6:16 | 4 | class Float: 5 | def __bytes__(self): 6 | return 3.05 # [invalid-bytes-return] | ^^^^ | -error[PLE0308]: invalid_return_type_bytes.py:11:16: `__bytes__` does not return `bytes` +error[PLE0308]: 11:16: `__bytes__` does not return `bytes` + --> invalid_return_type_bytes.py:11:16 | 9 | class Int: 10 | def __bytes__(self): 11 | return 0 # [invalid-bytes-return] | ^ | -error[PLE0308]: invalid_return_type_bytes.py:16:16: `__bytes__` does not return `bytes` +error[PLE0308]: 16:16: `__bytes__` does not return `bytes` + --> invalid_return_type_bytes.py:16:16 | 14 | class Str: 15 | def __bytes__(self): 16 | return "some bytes" # [invalid-bytes-return] | ^^^^^^^^^^^^ | -error[PLE0308]: invalid_return_type_bytes.py:20:9: `__bytes__` does not return `bytes` +error[PLE0308]: 20:9: `__bytes__` does not return `bytes` + --> invalid_return_type_bytes.py:20:9 | 19 | class BytesNoReturn: 20 | def __bytes__(self): diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0309_invalid_return_type_hash.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0309_invalid_return_type_hash.py.snap index 0cb68f7143..80f0c57470 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0309_invalid_return_type_hash.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0309_invalid_return_type_hash.py.snap @@ -1,32 +1,36 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLE0309]: invalid_return_type_hash.py:6:16: `__hash__` does not return an integer +error[PLE0309]: 6:16: `__hash__` does not return an integer + --> invalid_return_type_hash.py:6:16 | 4 | class Bool: 5 | def __hash__(self): 6 | return True # [invalid-hash-return] | ^^^^ | -error[PLE0309]: invalid_return_type_hash.py:11:16: `__hash__` does not return an integer +error[PLE0309]: 11:16: `__hash__` does not return an integer + --> invalid_return_type_hash.py:11:16 | 9 | class Float: 10 | def __hash__(self): 11 | return 3.05 # [invalid-hash-return] | ^^^^ | -error[PLE0309]: invalid_return_type_hash.py:16:16: `__hash__` does not return an integer +error[PLE0309]: 16:16: `__hash__` does not return an integer + --> invalid_return_type_hash.py:16:16 | 14 | class Str: 15 | def __hash__(self): 16 | return "ruff" # [invalid-hash-return] | ^^^^^^ | -error[PLE0309]: invalid_return_type_hash.py:20:9: `__hash__` does not return an integer +error[PLE0309]: 20:9: `__hash__` does not return an integer + --> invalid_return_type_hash.py:20:9 | 19 | class HashNoReturn: 20 | def __hash__(self): diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0604_invalid_all_object.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0604_invalid_all_object.py.snap index 245725c21f..f1beb7ee48 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0604_invalid_all_object.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0604_invalid_all_object.py.snap @@ -1,16 +1,18 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLE0604]: invalid_all_object.py:1:1: Invalid object in `__all__`, must contain only strings +error[PLE0604]: 1:1: Invalid object in `__all__`, must contain only strings + --> invalid_all_object.py:1:1 | 1 | __all__ = ( | ^^^^^^^ 2 | None, # [invalid-all-object] 3 | Fruit, | -error[PLE0604]: invalid_all_object.py:7:1: Invalid object in `__all__`, must contain only strings +error[PLE0604]: 7:1: Invalid object in `__all__`, must contain only strings + --> invalid_all_object.py:6:1 | 5 | ) 6 | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0605_invalid_all_format.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0605_invalid_all_format.py.snap index 087623148d..35a993e76a 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0605_invalid_all_format.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0605_invalid_all_format.py.snap @@ -1,16 +1,18 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLE0605]: invalid_all_format.py:1:1: Invalid format for `__all__`, must be `tuple` or `list` +error[PLE0605]: 1:1: Invalid format for `__all__`, must be `tuple` or `list` + --> invalid_all_format.py:1:1 | 1 | __all__ = "CONST" # [invalid-all-format] | ^^^^^^^ 2 | 3 | __all__ = ["Hello"] + {"world"} # [invalid-all-format] | -error[PLE0605]: invalid_all_format.py:3:1: Invalid format for `__all__`, must be `tuple` or `list` +error[PLE0605]: 3:1: Invalid format for `__all__`, must be `tuple` or `list` + --> invalid_all_format.py:2:1 | 1 | __all__ = "CONST" # [invalid-all-format] 2 | @@ -19,8 +21,9 @@ error[PLE0605]: invalid_all_format.py:3:1: Invalid format for `__all__`, must be 4 | 5 | __all__ += {"world"} # [invalid-all-format] | -error[PLE0605]: invalid_all_format.py:5:1: Invalid format for `__all__`, must be `tuple` or `list` +error[PLE0605]: 5:1: Invalid format for `__all__`, must be `tuple` or `list` + --> invalid_all_format.py:4:1 | 3 | __all__ = ["Hello"] + {"world"} # [invalid-all-format] 4 | @@ -29,8 +32,9 @@ error[PLE0605]: invalid_all_format.py:5:1: Invalid format for `__all__`, must be 6 | 7 | __all__ = {"world"} + ["Hello"] # [invalid-all-format] | -error[PLE0605]: invalid_all_format.py:7:1: Invalid format for `__all__`, must be `tuple` or `list` +error[PLE0605]: 7:1: Invalid format for `__all__`, must be `tuple` or `list` + --> invalid_all_format.py:6:1 | 5 | __all__ += {"world"} # [invalid-all-format] 6 | @@ -39,8 +43,9 @@ error[PLE0605]: invalid_all_format.py:7:1: Invalid format for `__all__`, must be 8 | 9 | __all__ = {"world"} + list(["Hello"]) # [invalid-all-format] | -error[PLE0605]: invalid_all_format.py:9:1: Invalid format for `__all__`, must be `tuple` or `list` +error[PLE0605]: 9:1: Invalid format for `__all__`, must be `tuple` or `list` + --> invalid_all_format.py:8:1 | 7 | __all__ = {"world"} + ["Hello"] # [invalid-all-format] 8 | @@ -49,8 +54,9 @@ error[PLE0605]: invalid_all_format.py:9:1: Invalid format for `__all__`, must be 10 | 11 | __all__ = list(["Hello"]) + {"world"} # [invalid-all-format] | -error[PLE0605]: invalid_all_format.py:11:1: Invalid format for `__all__`, must be `tuple` or `list` +error[PLE0605]: 11:1: Invalid format for `__all__`, must be `tuple` or `list` + --> invalid_all_format.py:10:1 | 9 | __all__ = {"world"} + list(["Hello"]) # [invalid-all-format] 10 | @@ -59,8 +65,9 @@ error[PLE0605]: invalid_all_format.py:11:1: Invalid format for `__all__`, must b 12 | 13 | __all__ = (x for x in ["Hello", "world"]) # [invalid-all-format] | -error[PLE0605]: invalid_all_format.py:13:1: Invalid format for `__all__`, must be `tuple` or `list` +error[PLE0605]: 13:1: Invalid format for `__all__`, must be `tuple` or `list` + --> invalid_all_format.py:12:1 | 11 | __all__ = list(["Hello"]) + {"world"} # [invalid-all-format] 12 | @@ -69,8 +76,9 @@ error[PLE0605]: invalid_all_format.py:13:1: Invalid format for `__all__`, must b 14 | 15 | __all__ = {x for x in ["Hello", "world"]} # [invalid-all-format] | -error[PLE0605]: invalid_all_format.py:15:1: Invalid format for `__all__`, must be `tuple` or `list` +error[PLE0605]: 15:1: Invalid format for `__all__`, must be `tuple` or `list` + --> invalid_all_format.py:14:1 | 13 | __all__ = (x for x in ["Hello", "world"]) # [invalid-all-format] 14 | @@ -79,8 +87,9 @@ error[PLE0605]: invalid_all_format.py:15:1: Invalid format for `__all__`, must b 16 | 17 | __all__ = foo # [invalid-all-format] | -error[PLE0605]: invalid_all_format.py:17:1: Invalid format for `__all__`, must be `tuple` or `list` +error[PLE0605]: 17:1: Invalid format for `__all__`, must be `tuple` or `list` + --> invalid_all_format.py:16:1 | 15 | __all__ = {x for x in ["Hello", "world"]} # [invalid-all-format] 16 | @@ -89,8 +98,9 @@ error[PLE0605]: invalid_all_format.py:17:1: Invalid format for `__all__`, must b 18 | 19 | __all__ = foo.bar # [invalid-all-format] | -error[PLE0605]: invalid_all_format.py:19:1: Invalid format for `__all__`, must be `tuple` or `list` +error[PLE0605]: 19:1: Invalid format for `__all__`, must be `tuple` or `list` + --> invalid_all_format.py:18:1 | 17 | __all__ = foo # [invalid-all-format] 18 | @@ -99,8 +109,9 @@ error[PLE0605]: invalid_all_format.py:19:1: Invalid format for `__all__`, must b 20 | 21 | __all__ = foo["bar"] # [invalid-all-format] | -error[PLE0605]: invalid_all_format.py:21:1: Invalid format for `__all__`, must be `tuple` or `list` +error[PLE0605]: 21:1: Invalid format for `__all__`, must be `tuple` or `list` + --> invalid_all_format.py:20:1 | 19 | __all__ = foo.bar # [invalid-all-format] 20 | @@ -109,8 +120,9 @@ error[PLE0605]: invalid_all_format.py:21:1: Invalid format for `__all__`, must b 22 | 23 | __all__ = (foo := bar) # [invalid-all-format] | -error[PLE0605]: invalid_all_format.py:23:1: Invalid format for `__all__`, must be `tuple` or `list` +error[PLE0605]: 23:1: Invalid format for `__all__`, must be `tuple` or `list` + --> invalid_all_format.py:22:1 | 21 | __all__ = foo["bar"] # [invalid-all-format] 22 | @@ -119,8 +131,9 @@ error[PLE0605]: invalid_all_format.py:23:1: Invalid format for `__all__`, must b 24 | 25 | __all__ = ["Hello"] | -error[PLE0605]: invalid_all_format.py:23:12: Invalid format for `__all__`, must be `tuple` or `list` +error[PLE0605]: 23:12: Invalid format for `__all__`, must be `tuple` or `list` + --> invalid_all_format.py:23:12 | 21 | __all__ = foo["bar"] # [invalid-all-format] 22 | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0643_potential_index_error.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0643_potential_index_error.py.snap index 4c90ee3f58..30874f9d0a 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0643_potential_index_error.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0643_potential_index_error.py.snap @@ -1,38 +1,43 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -potential_index_error.py:1:17: PLE0643 Expression is likely to raise `IndexError` +error[PLE0643]: 1:17: Expression is likely to raise `IndexError` + + --> potential_index_error.py:1:17 | 1 | print([1, 2, 3][3]) # PLE0643 - | ^ PLE0643 + | ^ 2 | print([1, 2, 3][-4]) # PLE0643 3 | print([1, 2, 3][999999999999999999999999999999999999999999]) # PLE0643 | +error[PLE0643]: 2:17: Expression is likely to raise `IndexError` -potential_index_error.py:2:17: PLE0643 Expression is likely to raise `IndexError` + --> potential_index_error.py:2:17 | 1 | print([1, 2, 3][3]) # PLE0643 2 | print([1, 2, 3][-4]) # PLE0643 - | ^^ PLE0643 + | ^^ 3 | print([1, 2, 3][999999999999999999999999999999999999999999]) # PLE0643 4 | print([1, 2, 3][-999999999999999999999999999999999999999999]) # PLE0643 | +error[PLE0643]: 3:17: Expression is likely to raise `IndexError` -potential_index_error.py:3:17: PLE0643 Expression is likely to raise `IndexError` + --> potential_index_error.py:3:17 | 1 | print([1, 2, 3][3]) # PLE0643 2 | print([1, 2, 3][-4]) # PLE0643 3 | print([1, 2, 3][999999999999999999999999999999999999999999]) # PLE0643 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PLE0643 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 4 | print([1, 2, 3][-999999999999999999999999999999999999999999]) # PLE0643 | +error[PLE0643]: 4:17: Expression is likely to raise `IndexError` -potential_index_error.py:4:17: PLE0643 Expression is likely to raise `IndexError` + --> potential_index_error.py:4:17 | 2 | print([1, 2, 3][-4]) # PLE0643 3 | print([1, 2, 3][999999999999999999999999999999999999999999]) # PLE0643 4 | print([1, 2, 3][-999999999999999999999999999999999999999999]) # PLE0643 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PLE0643 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 5 | 6 | print([1, 2, 3][2]) # OK | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0704_misplaced_bare_raise.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0704_misplaced_bare_raise.py.snap index be4e101fc8..1304e33c3b 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0704_misplaced_bare_raise.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0704_misplaced_bare_raise.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLE0704]: misplaced_bare_raise.py:30:5: Bare `raise` statement is not inside an exception handler +error[PLE0704]: 30:5: Bare `raise` statement is not inside an exception handler + --> misplaced_bare_raise.py:30:5 | 29 | try: 30 | raise # [misplaced-bare-raise] @@ -10,8 +11,9 @@ error[PLE0704]: misplaced_bare_raise.py:30:5: Bare `raise` statement is not insi 31 | except Exception: 32 | pass | -error[PLE0704]: misplaced_bare_raise.py:36:9: Bare `raise` statement is not inside an exception handler +error[PLE0704]: 36:9: Bare `raise` statement is not inside an exception handler + --> misplaced_bare_raise.py:36:9 | 34 | def f(): 35 | try: @@ -20,8 +22,9 @@ error[PLE0704]: misplaced_bare_raise.py:36:9: Bare `raise` statement is not insi 37 | except Exception: 38 | pass | -error[PLE0704]: misplaced_bare_raise.py:41:5: Bare `raise` statement is not inside an exception handler +error[PLE0704]: 41:5: Bare `raise` statement is not inside an exception handler + --> misplaced_bare_raise.py:41:5 | 40 | def g(): 41 | raise # [misplaced-bare-raise] @@ -29,8 +32,9 @@ error[PLE0704]: misplaced_bare_raise.py:41:5: Bare `raise` statement is not insi 42 | 43 | def h(): | -error[PLE0704]: misplaced_bare_raise.py:47:17: Bare `raise` statement is not inside an exception handler +error[PLE0704]: 47:17: Bare `raise` statement is not inside an exception handler + --> misplaced_bare_raise.py:47:17 | 45 | if True: 46 | def i(): @@ -39,8 +43,9 @@ error[PLE0704]: misplaced_bare_raise.py:47:17: Bare `raise` statement is not ins 48 | except Exception: 49 | pass | -error[PLE0704]: misplaced_bare_raise.py:50:5: Bare `raise` statement is not inside an exception handler +error[PLE0704]: 50:5: Bare `raise` statement is not inside an exception handler + --> misplaced_bare_raise.py:50:5 | 48 | except Exception: 49 | pass @@ -49,8 +54,9 @@ error[PLE0704]: misplaced_bare_raise.py:50:5: Bare `raise` statement is not insi 51 | 52 | raise # [misplaced-bare-raise] | -error[PLE0704]: misplaced_bare_raise.py:52:1: Bare `raise` statement is not inside an exception handler +error[PLE0704]: 52:1: Bare `raise` statement is not inside an exception handler + --> misplaced_bare_raise.py:51:1 | 50 | raise # [misplaced-bare-raise] 51 | @@ -59,8 +65,9 @@ error[PLE0704]: misplaced_bare_raise.py:52:1: Bare `raise` statement is not insi 53 | 54 | try: | -error[PLE0704]: misplaced_bare_raise.py:58:9: Bare `raise` statement is not inside an exception handler +error[PLE0704]: 58:9: Bare `raise` statement is not inside an exception handler + --> misplaced_bare_raise.py:58:9 | 56 | except: 57 | def i(): @@ -69,8 +76,9 @@ error[PLE0704]: misplaced_bare_raise.py:58:9: Bare `raise` statement is not insi 59 | 60 | try: | -error[PLE0704]: misplaced_bare_raise.py:64:9: Bare `raise` statement is not inside an exception handler +error[PLE0704]: 64:9: Bare `raise` statement is not inside an exception handler + --> misplaced_bare_raise.py:64:9 | 62 | except: 63 | class C: @@ -79,8 +87,9 @@ error[PLE0704]: misplaced_bare_raise.py:64:9: Bare `raise` statement is not insi 65 | 66 | try: | -error[PLE0704]: misplaced_bare_raise.py:71:5: Bare `raise` statement is not inside an exception handler +error[PLE0704]: 71:5: Bare `raise` statement is not inside an exception handler + --> misplaced_bare_raise.py:71:5 | 69 | pass 70 | finally: diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1132_repeated_keyword_argument.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1132_repeated_keyword_argument.py.snap index 86bfc26a2a..11a7659c8d 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1132_repeated_keyword_argument.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1132_repeated_keyword_argument.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLE1132]: repeated_keyword_argument.py:16:21: Repeated keyword argument: `c` +error[PLE1132]: 16:21: Repeated keyword argument: `c` + --> repeated_keyword_argument.py:16:21 | 15 | # Invalid 16 | func(a=11, c=31, **{"c": 41}) @@ -10,8 +11,9 @@ error[PLE1132]: repeated_keyword_argument.py:16:21: Repeated keyword argument: ` 17 | func(a=11, c=31, **{"c": 41, "a": 51}) 18 | func(a=11, b=21, c=31, **{"b": 22, "c": 41, "a": 51}) | -error[PLE1132]: repeated_keyword_argument.py:17:21: Repeated keyword argument: `c` +error[PLE1132]: 17:21: Repeated keyword argument: `c` + --> repeated_keyword_argument.py:17:21 | 15 | # Invalid 16 | func(a=11, c=31, **{"c": 41}) @@ -20,8 +22,9 @@ error[PLE1132]: repeated_keyword_argument.py:17:21: Repeated keyword argument: ` 18 | func(a=11, b=21, c=31, **{"b": 22, "c": 41, "a": 51}) 19 | func(a=11, b=21, **{"c": 31}, **{"c": 32}) | -error[PLE1132]: repeated_keyword_argument.py:17:30: Repeated keyword argument: `a` +error[PLE1132]: 17:30: Repeated keyword argument: `a` + --> repeated_keyword_argument.py:17:30 | 15 | # Invalid 16 | func(a=11, c=31, **{"c": 41}) @@ -30,8 +33,9 @@ error[PLE1132]: repeated_keyword_argument.py:17:30: Repeated keyword argument: ` 18 | func(a=11, b=21, c=31, **{"b": 22, "c": 41, "a": 51}) 19 | func(a=11, b=21, **{"c": 31}, **{"c": 32}) | -error[PLE1132]: repeated_keyword_argument.py:18:27: Repeated keyword argument: `b` +error[PLE1132]: 18:27: Repeated keyword argument: `b` + --> repeated_keyword_argument.py:18:27 | 16 | func(a=11, c=31, **{"c": 41}) 17 | func(a=11, c=31, **{"c": 41, "a": 51}) @@ -40,8 +44,9 @@ error[PLE1132]: repeated_keyword_argument.py:18:27: Repeated keyword argument: ` 19 | func(a=11, b=21, **{"c": 31}, **{"c": 32}) 20 | func(a=11, b=21, **{"c": 31, "c": 32}) | -error[PLE1132]: repeated_keyword_argument.py:18:36: Repeated keyword argument: `c` +error[PLE1132]: 18:36: Repeated keyword argument: `c` + --> repeated_keyword_argument.py:18:36 | 16 | func(a=11, c=31, **{"c": 41}) 17 | func(a=11, c=31, **{"c": 41, "a": 51}) @@ -50,8 +55,9 @@ error[PLE1132]: repeated_keyword_argument.py:18:36: Repeated keyword argument: ` 19 | func(a=11, b=21, **{"c": 31}, **{"c": 32}) 20 | func(a=11, b=21, **{"c": 31, "c": 32}) | -error[PLE1132]: repeated_keyword_argument.py:18:45: Repeated keyword argument: `a` +error[PLE1132]: 18:45: Repeated keyword argument: `a` + --> repeated_keyword_argument.py:18:45 | 16 | func(a=11, c=31, **{"c": 41}) 17 | func(a=11, c=31, **{"c": 41, "a": 51}) @@ -60,8 +66,9 @@ error[PLE1132]: repeated_keyword_argument.py:18:45: Repeated keyword argument: ` 19 | func(a=11, b=21, **{"c": 31}, **{"c": 32}) 20 | func(a=11, b=21, **{"c": 31, "c": 32}) | -error[PLE1132]: repeated_keyword_argument.py:19:34: Repeated keyword argument: `c` +error[PLE1132]: 19:34: Repeated keyword argument: `c` + --> repeated_keyword_argument.py:19:34 | 17 | func(a=11, c=31, **{"c": 41, "a": 51}) 18 | func(a=11, b=21, c=31, **{"b": 22, "c": 41, "a": 51}) @@ -69,8 +76,9 @@ error[PLE1132]: repeated_keyword_argument.py:19:34: Repeated keyword argument: ` | ^^^ 20 | func(a=11, b=21, **{"c": 31, "c": 32}) | -error[PLE1132]: repeated_keyword_argument.py:20:30: Repeated keyword argument: `c` +error[PLE1132]: 20:30: Repeated keyword argument: `c` + --> repeated_keyword_argument.py:20:30 | 18 | func(a=11, b=21, c=31, **{"b": 22, "c": 41, "a": 51}) 19 | func(a=11, b=21, **{"c": 31}, **{"c": 32}) diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1141_dict_iter_missing_items.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1141_dict_iter_missing_items.py.snap index 82be96b297..0dacce3841 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1141_dict_iter_missing_items.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1141_dict_iter_missing_items.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLE1141]: dict_iter_missing_items.py:13:13: [*] Unpacking a dictionary in iteration without calling `.items()` +error[PLE1141]: 13:13: [*] Unpacking a dictionary in iteration without calling `.items()` + --> dict_iter_missing_items.py:13:13 | 12 | # Errors 13 | for k, v in d: @@ -20,8 +21,9 @@ error[PLE1141]: dict_iter_missing_items.py:13:13: [*] Unpacking a dictionary in 15 15 | 16 16 | for k, v in d_tuple_incorrect_tuple: -error[PLE1141]: dict_iter_missing_items.py:16:13: [*] Unpacking a dictionary in iteration without calling `.items()` +error[PLE1141]: 16:13: [*] Unpacking a dictionary in iteration without calling `.items()` + --> dict_iter_missing_items.py:16:13 | 14 | pass 15 | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1142_await_outside_async.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1142_await_outside_async.py.snap index dc0fd27068..5948621f40 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1142_await_outside_async.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1142_await_outside_async.py.snap @@ -1,15 +1,17 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLE1142]: await_outside_async.py:12:11: `await` should be used within an async function +error[PLE1142]: 12:11: `await` should be used within an async function + --> await_outside_async.py:12:11 | 11 | def not_async(): 12 | print(await nested()) # [await-outside-async] | ^^^^^^^^^^^^^^ | -error[PLE1142]: await_outside_async.py:25:9: `await` should be used within an async function +error[PLE1142]: 25:9: `await` should be used within an async function + --> await_outside_async.py:25:9 | 23 | async def func2(): 24 | def inner_func(): diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1205_logging_too_many_args.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1205_logging_too_many_args.py.snap index 334d48efcb..5e48d8bd77 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1205_logging_too_many_args.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1205_logging_too_many_args.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLE1205]: logging_too_many_args.py:3:1: Too many arguments for `logging` format string +error[PLE1205]: 3:1: Too many arguments for `logging` format string + --> logging_too_many_args.py:2:1 | 1 | import logging 2 | @@ -11,8 +12,9 @@ error[PLE1205]: logging_too_many_args.py:3:1: Too many arguments for `logging` f 4 | 5 | logging.warning("Hello %s", "World!", "again", something="else") | -error[PLE1205]: logging_too_many_args.py:5:1: Too many arguments for `logging` format string +error[PLE1205]: 5:1: Too many arguments for `logging` format string + --> logging_too_many_args.py:4:1 | 3 | logging.warning("Hello %s", "World!", "again") # [logging-too-many-args] 4 | @@ -21,8 +23,9 @@ error[PLE1205]: logging_too_many_args.py:5:1: Too many arguments for `logging` f 6 | 7 | logging.warning("Hello %s", "World!") | -error[PLE1205]: logging_too_many_args.py:29:1: Too many arguments for `logging` format string +error[PLE1205]: 29:1: Too many arguments for `logging` format string + --> logging_too_many_args.py:28:1 | 27 | from logging import info, error, warning 28 | @@ -31,8 +34,9 @@ error[PLE1205]: logging_too_many_args.py:29:1: Too many arguments for `logging` 30 | 31 | warning("Hello %s", "World!", "again", something="else") | -error[PLE1205]: logging_too_many_args.py:31:1: Too many arguments for `logging` format string +error[PLE1205]: 31:1: Too many arguments for `logging` format string + --> logging_too_many_args.py:30:1 | 29 | warning("Hello %s", "World!", "again") # [logging-too-many-args] 30 | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1206_logging_too_few_args.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1206_logging_too_few_args.py.snap index 84b7008c51..9cf13faad5 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1206_logging_too_few_args.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1206_logging_too_few_args.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLE1206]: logging_too_few_args.py:3:1: Not enough arguments for `logging` format string +error[PLE1206]: 3:1: Not enough arguments for `logging` format string + --> logging_too_few_args.py:2:1 | 1 | import logging 2 | @@ -11,8 +12,9 @@ error[PLE1206]: logging_too_few_args.py:3:1: Not enough arguments for `logging` 4 | 5 | # do not handle calls with kwargs (like pylint) | -error[PLE1206]: logging_too_few_args.py:33:1: Not enough arguments for `logging` format string +error[PLE1206]: 33:1: Not enough arguments for `logging` format string + --> logging_too_few_args.py:32:1 | 31 | from logging import error, info, warning 32 | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1300_bad_string_format_character.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1300_bad_string_format_character.py.snap index 97085ddad2..62d89bf802 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1300_bad_string_format_character.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1300_bad_string_format_character.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLE1300]: bad_string_format_character.py:5:1: Unsupported format character 'z' +error[PLE1300]: 5:1: Unsupported format character 'z' + --> bad_string_format_character.py:4:1 | 3 | ## Old style formatting 4 | @@ -11,8 +12,9 @@ error[PLE1300]: bad_string_format_character.py:5:1: Unsupported format character 6 | 7 | "%s" "%z" % ("hello", "world") # [bad-format-character] | -error[PLE1300]: bad_string_format_character.py:7:1: Unsupported format character 'z' +error[PLE1300]: 7:1: Unsupported format character 'z' + --> bad_string_format_character.py:6:1 | 5 | "%s %z" % ("hello", "world") # [bad-format-character] 6 | @@ -21,8 +23,9 @@ error[PLE1300]: bad_string_format_character.py:7:1: Unsupported format character 8 | 9 | """%s %z""" % ("hello", "world") # [bad-format-character] | -error[PLE1300]: bad_string_format_character.py:9:1: Unsupported format character 'z' +error[PLE1300]: 9:1: Unsupported format character 'z' + --> bad_string_format_character.py:8:1 | 7 | "%s" "%z" % ("hello", "world") # [bad-format-character] 8 | @@ -31,8 +34,9 @@ error[PLE1300]: bad_string_format_character.py:9:1: Unsupported format character 10 | 11 | """%s""" """%z""" % ("hello", "world") # [bad-format-character] | -error[PLE1300]: bad_string_format_character.py:11:1: Unsupported format character 'z' +error[PLE1300]: 11:1: Unsupported format character 'z' + --> bad_string_format_character.py:10:1 | 9 | """%s %z""" % ("hello", "world") # [bad-format-character] 10 | @@ -41,8 +45,9 @@ error[PLE1300]: bad_string_format_character.py:11:1: Unsupported format characte 12 | 13 | ## New style formatting | -error[PLE1300]: bad_string_format_character.py:15:1: Unsupported format character 'y' +error[PLE1300]: 15:1: Unsupported format character 'y' + --> bad_string_format_character.py:14:1 | 13 | ## New style formatting 14 | @@ -51,8 +56,9 @@ error[PLE1300]: bad_string_format_character.py:15:1: Unsupported format characte 16 | 17 | "{:*^30s}".format("centered") # OK | -error[PLE1300]: bad_string_format_character.py:19:1: Unsupported format character 'y' +error[PLE1300]: 19:1: Unsupported format character 'y' + --> bad_string_format_character.py:18:77 | 17 | "{:*^30s}".format("centered") # OK 18 | "{:{s}}".format("hello", s="s") # OK (nested placeholder value not checked) diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1307_bad_string_format_type.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1307_bad_string_format_type.py.snap index cc3fb3ae11..c8c44df691 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1307_bad_string_format_type.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1307_bad_string_format_type.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLE1307]: bad_string_format_type.py:2:7: Format type does not match argument type +error[PLE1307]: 2:7: Format type does not match argument type + --> bad_string_format_type.py:2:7 | 1 | # Errors 2 | print("foo %(foo)d bar %(bar)d" % {"foo": "1", "bar": "2"}) @@ -10,8 +11,9 @@ error[PLE1307]: bad_string_format_type.py:2:7: Format type does not match argume 3 | 4 | "foo %e bar %s" % ("1", 2) | -error[PLE1307]: bad_string_format_type.py:4:1: Format type does not match argument type +error[PLE1307]: 4:1: Format type does not match argument type + --> bad_string_format_type.py:3:1 | 2 | print("foo %(foo)d bar %(bar)d" % {"foo": "1", "bar": "2"}) 3 | @@ -20,8 +22,9 @@ error[PLE1307]: bad_string_format_type.py:4:1: Format type does not match argume 5 | 6 | "%d" % "1" | -error[PLE1307]: bad_string_format_type.py:6:1: Format type does not match argument type +error[PLE1307]: 6:1: Format type does not match argument type + --> bad_string_format_type.py:5:1 | 4 | "foo %e bar %s" % ("1", 2) 5 | @@ -30,8 +33,9 @@ error[PLE1307]: bad_string_format_type.py:6:1: Format type does not match argume 7 | "%o" % "1" 8 | "%(key)d" % {"key": "1"} | -error[PLE1307]: bad_string_format_type.py:7:1: Format type does not match argument type +error[PLE1307]: 7:1: Format type does not match argument type + --> bad_string_format_type.py:6:11 | 6 | "%d" % "1" 7 | "%o" % "1" @@ -39,8 +43,9 @@ error[PLE1307]: bad_string_format_type.py:7:1: Format type does not match argume 8 | "%(key)d" % {"key": "1"} 9 | "%x" % 1.1 | -error[PLE1307]: bad_string_format_type.py:8:1: Format type does not match argument type +error[PLE1307]: 8:1: Format type does not match argument type + --> bad_string_format_type.py:7:11 | 6 | "%d" % "1" 7 | "%o" % "1" @@ -49,8 +54,9 @@ error[PLE1307]: bad_string_format_type.py:8:1: Format type does not match argume 9 | "%x" % 1.1 10 | "%(key)x" % {"key": 1.1} | -error[PLE1307]: bad_string_format_type.py:9:1: Format type does not match argument type +error[PLE1307]: 9:1: Format type does not match argument type + --> bad_string_format_type.py:8:25 | 7 | "%o" % "1" 8 | "%(key)d" % {"key": "1"} @@ -59,8 +65,9 @@ error[PLE1307]: bad_string_format_type.py:9:1: Format type does not match argume 10 | "%(key)x" % {"key": 1.1} 11 | "%d" % [] | -error[PLE1307]: bad_string_format_type.py:10:1: Format type does not match argument type +error[PLE1307]: 10:1: Format type does not match argument type + --> bad_string_format_type.py:9:11 | 8 | "%(key)d" % {"key": "1"} 9 | "%x" % 1.1 @@ -69,8 +76,9 @@ error[PLE1307]: bad_string_format_type.py:10:1: Format type does not match argum 11 | "%d" % [] 12 | "%d" % ([],) | -error[PLE1307]: bad_string_format_type.py:11:1: Format type does not match argument type +error[PLE1307]: 11:1: Format type does not match argument type + --> bad_string_format_type.py:10:25 | 9 | "%x" % 1.1 10 | "%(key)x" % {"key": 1.1} @@ -79,8 +87,9 @@ error[PLE1307]: bad_string_format_type.py:11:1: Format type does not match argum 12 | "%d" % ([],) 13 | "%(key)d" % {"key": []} | -error[PLE1307]: bad_string_format_type.py:12:1: Format type does not match argument type +error[PLE1307]: 12:1: Format type does not match argument type + --> bad_string_format_type.py:11:10 | 10 | "%(key)x" % {"key": 1.1} 11 | "%d" % [] @@ -89,8 +98,9 @@ error[PLE1307]: bad_string_format_type.py:12:1: Format type does not match argum 13 | "%(key)d" % {"key": []} 14 | print("%d" % ("%s" % ("nested",),)) | -error[PLE1307]: bad_string_format_type.py:13:1: Format type does not match argument type +error[PLE1307]: 13:1: Format type does not match argument type + --> bad_string_format_type.py:12:13 | 11 | "%d" % [] 12 | "%d" % ([],) @@ -99,8 +109,9 @@ error[PLE1307]: bad_string_format_type.py:13:1: Format type does not match argum 14 | print("%d" % ("%s" % ("nested",),)) 15 | "%d" % ((1, 2, 3),) | -error[PLE1307]: bad_string_format_type.py:14:7: Format type does not match argument type +error[PLE1307]: 14:7: Format type does not match argument type + --> bad_string_format_type.py:14:7 | 12 | "%d" % ([],) 13 | "%(key)d" % {"key": []} @@ -109,8 +120,9 @@ error[PLE1307]: bad_string_format_type.py:14:7: Format type does not match argum 15 | "%d" % ((1, 2, 3),) 16 | "%d" % (1 if x > 0 else []) | -error[PLE1307]: bad_string_format_type.py:15:1: Format type does not match argument type +error[PLE1307]: 15:1: Format type does not match argument type + --> bad_string_format_type.py:14:36 | 13 | "%(key)d" % {"key": []} 14 | print("%d" % ("%s" % ("nested",),)) @@ -118,8 +130,9 @@ error[PLE1307]: bad_string_format_type.py:15:1: Format type does not match argum | ^^^^^^^^^^^^^^^^^^^ 16 | "%d" % (1 if x > 0 else []) | -error[PLE1307]: bad_string_format_type.py:16:1: Format type does not match argument type +error[PLE1307]: 16:1: Format type does not match argument type + --> bad_string_format_type.py:15:20 | 14 | print("%d" % ("%s" % ("nested",),)) 15 | "%d" % ((1, 2, 3),) diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1310_bad_str_strip_call.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1310_bad_str_strip_call.py.snap index 7ea5bcbbc4..ea55acb6bb 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1310_bad_str_strip_call.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1310_bad_str_strip_call.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLE1310]: bad_str_strip_call.py:2:21: String `strip` call contains duplicate characters +error[PLE1310]: 2:21: String `strip` call contains duplicate characters + --> bad_str_strip_call.py:2:21 | 1 | # PLE1310 2 | "Hello World".strip("Hello") @@ -10,8 +11,9 @@ error[PLE1310]: bad_str_strip_call.py:2:21: String `strip` call contains duplica 3 | 4 | # PLE1310 | -error[PLE1310]: bad_str_strip_call.py:5:21: String `strip` call contains duplicate characters +error[PLE1310]: 5:21: String `strip` call contains duplicate characters + --> bad_str_strip_call.py:5:21 | 4 | # PLE1310 5 | "Hello World".strip("Hello") @@ -19,8 +21,9 @@ error[PLE1310]: bad_str_strip_call.py:5:21: String `strip` call contains duplica 6 | 7 | # PLE1310 | -error[PLE1310]: bad_str_strip_call.py:8:21: String `strip` call contains duplicate characters +error[PLE1310]: 8:21: String `strip` call contains duplicate characters + --> bad_str_strip_call.py:8:21 | 7 | # PLE1310 8 | "Hello World".strip(u"Hello") @@ -28,8 +31,9 @@ error[PLE1310]: bad_str_strip_call.py:8:21: String `strip` call contains duplica 9 | 10 | # PLE1310 | -error[PLE1310]: bad_str_strip_call.py:11:21: String `strip` call contains duplicate characters +error[PLE1310]: 11:21: String `strip` call contains duplicate characters + --> bad_str_strip_call.py:11:21 | 10 | # PLE1310 11 | "Hello World".strip(r"Hello") @@ -37,8 +41,9 @@ error[PLE1310]: bad_str_strip_call.py:11:21: String `strip` call contains duplic 12 | 13 | # PLE1310 | -error[PLE1310]: bad_str_strip_call.py:14:21: String `strip` call contains duplicate characters +error[PLE1310]: 14:21: String `strip` call contains duplicate characters + --> bad_str_strip_call.py:14:21 | 13 | # PLE1310 14 | "Hello World".strip("Hello\t") @@ -46,8 +51,9 @@ error[PLE1310]: bad_str_strip_call.py:14:21: String `strip` call contains duplic 15 | 16 | # PLE1310 | -error[PLE1310]: bad_str_strip_call.py:17:21: String `strip` call contains duplicate characters +error[PLE1310]: 17:21: String `strip` call contains duplicate characters + --> bad_str_strip_call.py:17:21 | 16 | # PLE1310 17 | "Hello World".strip(r"Hello\t") @@ -55,8 +61,9 @@ error[PLE1310]: bad_str_strip_call.py:17:21: String `strip` call contains duplic 18 | 19 | # PLE1310 | -error[PLE1310]: bad_str_strip_call.py:20:21: String `strip` call contains duplicate characters +error[PLE1310]: 20:21: String `strip` call contains duplicate characters + --> bad_str_strip_call.py:20:21 | 19 | # PLE1310 20 | "Hello World".strip("Hello\\") @@ -64,8 +71,9 @@ error[PLE1310]: bad_str_strip_call.py:20:21: String `strip` call contains duplic 21 | 22 | # PLE1310 | -error[PLE1310]: bad_str_strip_call.py:23:21: String `strip` call contains duplicate characters +error[PLE1310]: 23:21: String `strip` call contains duplicate characters + --> bad_str_strip_call.py:23:21 | 22 | # PLE1310 23 | "Hello World".strip(r"Hello\\") @@ -73,8 +81,9 @@ error[PLE1310]: bad_str_strip_call.py:23:21: String `strip` call contains duplic 24 | 25 | # PLE1310 | -error[PLE1310]: bad_str_strip_call.py:26:21: String `strip` call contains duplicate characters +error[PLE1310]: 26:21: String `strip` call contains duplicate characters + --> bad_str_strip_call.py:26:21 | 25 | # PLE1310 26 | "Hello World".strip("🤣🤣🤣🤣🙃👀😀") @@ -82,8 +91,9 @@ error[PLE1310]: bad_str_strip_call.py:26:21: String `strip` call contains duplic 27 | 28 | # PLE1310 | -error[PLE1310]: bad_str_strip_call.py:30:5: String `strip` call contains duplicate characters +error[PLE1310]: 30:5: String `strip` call contains duplicate characters + --> bad_str_strip_call.py:30:5 | 28 | # PLE1310 29 | "Hello World".strip( @@ -94,8 +104,9 @@ error[PLE1310]: bad_str_strip_call.py:30:5: String `strip` call contains duplica | |___^ 33 | ) | -error[PLE1310]: bad_str_strip_call.py:36:21: String `strip` call contains duplicate characters +error[PLE1310]: 36:21: String `strip` call contains duplicate characters + --> bad_str_strip_call.py:36:21 | 35 | # PLE1310 36 | "Hello World".strip("can we get a long " \ @@ -106,8 +117,9 @@ error[PLE1310]: bad_str_strip_call.py:36:21: String `strip` call contains duplic 39 | 40 | # PLE1310 | -error[PLE1310]: bad_str_strip_call.py:42:5: String `strip` call contains duplicate characters +error[PLE1310]: 42:5: String `strip` call contains duplicate characters + --> bad_str_strip_call.py:42:5 | 40 | # PLE1310 41 | "Hello World".strip( @@ -118,8 +130,9 @@ error[PLE1310]: bad_str_strip_call.py:42:5: String `strip` call contains duplica | |_____________^ 45 | ) | -error[PLE1310]: bad_str_strip_call.py:49:5: String `strip` call contains duplicate characters +error[PLE1310]: 49:5: String `strip` call contains duplicate characters + --> bad_str_strip_call.py:49:5 | 47 | # PLE1310 48 | "Hello World".strip( @@ -130,8 +143,9 @@ error[PLE1310]: bad_str_strip_call.py:49:5: String `strip` call contains duplica | |_____________^ 52 | ) | -error[PLE1310]: bad_str_strip_call.py:61:11: String `strip` call contains duplicate characters +error[PLE1310]: 61:11: String `strip` call contains duplicate characters + --> bad_str_strip_call.py:61:11 | 60 | # PLE1310 61 | u''.strip('http://') @@ -139,8 +153,9 @@ error[PLE1310]: bad_str_strip_call.py:61:11: String `strip` call contains duplic 62 | 63 | # PLE1310 | -error[PLE1310]: bad_str_strip_call.py:64:12: String `lstrip` call contains duplicate characters (did you mean `removeprefix`?) +error[PLE1310]: 64:12: String `lstrip` call contains duplicate characters (did you mean `removeprefix`?) + --> bad_str_strip_call.py:64:12 | 63 | # PLE1310 64 | u''.lstrip('http://') @@ -148,8 +163,9 @@ error[PLE1310]: bad_str_strip_call.py:64:12: String `lstrip` call contains dupli 65 | 66 | # PLE1310 | -error[PLE1310]: bad_str_strip_call.py:67:12: String `rstrip` call contains duplicate characters (did you mean `removesuffix`?) +error[PLE1310]: 67:12: String `rstrip` call contains duplicate characters (did you mean `removesuffix`?) + --> bad_str_strip_call.py:67:12 | 66 | # PLE1310 67 | b''.rstrip('http://') diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1507_invalid_envvar_value.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1507_invalid_envvar_value.py.snap index c09028c00e..5990078459 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1507_invalid_envvar_value.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1507_invalid_envvar_value.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLE1507]: invalid_envvar_value.py:3:11: Invalid type for initial `os.getenv` argument; expected `str` +error[PLE1507]: 3:11: Invalid type for initial `os.getenv` argument; expected `str` + --> invalid_envvar_value.py:3:11 | 1 | import os 2 | @@ -11,8 +12,9 @@ error[PLE1507]: invalid_envvar_value.py:3:11: Invalid type for initial `os.geten 4 | os.getenv("a") 5 | os.getenv("test") | -error[PLE1507]: invalid_envvar_value.py:7:15: Invalid type for initial `os.getenv` argument; expected `str` +error[PLE1507]: 7:15: Invalid type for initial `os.getenv` argument; expected `str` + --> invalid_envvar_value.py:7:15 | 5 | os.getenv("test") 6 | os.getenv(key="testingAgain") @@ -21,8 +23,9 @@ error[PLE1507]: invalid_envvar_value.py:7:15: Invalid type for initial `os.geten 8 | os.getenv(["hello"]) # [invalid-envvar-value] 9 | os.getenv(key="foo", default="bar") | -error[PLE1507]: invalid_envvar_value.py:8:11: Invalid type for initial `os.getenv` argument; expected `str` +error[PLE1507]: 8:11: Invalid type for initial `os.getenv` argument; expected `str` + --> invalid_envvar_value.py:8:11 | 6 | os.getenv(key="testingAgain") 7 | os.getenv(key=11) # [invalid-envvar-value] @@ -31,8 +34,9 @@ error[PLE1507]: invalid_envvar_value.py:8:11: Invalid type for initial `os.geten 9 | os.getenv(key="foo", default="bar") 10 | os.getenv(key=f"foo", default="bar") | -error[PLE1507]: invalid_envvar_value.py:12:15: Invalid type for initial `os.getenv` argument; expected `str` +error[PLE1507]: 12:15: Invalid type for initial `os.getenv` argument; expected `str` + --> invalid_envvar_value.py:12:15 | 10 | os.getenv(key=f"foo", default="bar") 11 | os.getenv(key="foo" + "bar", default=1) @@ -41,8 +45,9 @@ error[PLE1507]: invalid_envvar_value.py:12:15: Invalid type for initial `os.gete 13 | os.getenv("PATH_TEST" if using_clear_path else "PATH_ORIG") 14 | os.getenv(1 if using_clear_path else "PATH_ORIG") | -error[PLE1507]: invalid_envvar_value.py:14:11: Invalid type for initial `os.getenv` argument; expected `str` +error[PLE1507]: 14:11: Invalid type for initial `os.getenv` argument; expected `str` + --> invalid_envvar_value.py:14:11 | 12 | os.getenv(key=1 + "bar", default=1) # [invalid-envvar-value] 13 | os.getenv("PATH_TEST" if using_clear_path else "PATH_ORIG") diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1519_singledispatch_method.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1519_singledispatch_method.py.snap index 5f9f7b4d38..29dad2f339 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1519_singledispatch_method.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1519_singledispatch_method.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLE1519]: singledispatch_method.py:10:5: [*] `@singledispatch` decorator should not be used on methods +error[PLE1519]: 10:5: [*] `@singledispatch` decorator should not be used on methods + --> singledispatch_method.py:10:5 | 9 | class Board: 10 | @singledispatch # [singledispatch-method] @@ -21,8 +22,9 @@ error[PLE1519]: singledispatch_method.py:10:5: [*] `@singledispatch` decorator s 12 12 | def convert_position(cls, position): 13 13 | pass -error[PLE1519]: singledispatch_method.py:15:5: [*] `@singledispatch` decorator should not be used on methods +error[PLE1519]: 15:5: [*] `@singledispatch` decorator should not be used on methods + --> singledispatch_method.py:15:5 | 13 | pass 14 | @@ -42,8 +44,9 @@ error[PLE1519]: singledispatch_method.py:15:5: [*] `@singledispatch` decorator s 17 17 | pass 18 18 | -error[PLE1519]: singledispatch_method.py:23:5: [*] `@singledispatch` decorator should not be used on methods +error[PLE1519]: 23:5: [*] `@singledispatch` decorator should not be used on methods + --> singledispatch_method.py:23:5 | 21 | pass 22 | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1520_singledispatchmethod_function.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1520_singledispatchmethod_function.py.snap index eedc135429..2e07b0de7d 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1520_singledispatchmethod_function.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1520_singledispatchmethod_function.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLE1520]: singledispatchmethod_function.py:4:1: [*] `@singledispatchmethod` decorator should not be used on non-method functions +error[PLE1520]: 4:1: [*] `@singledispatchmethod` decorator should not be used on non-method functions + --> singledispatchmethod_function.py:4:1 | 4 | @singledispatchmethod # [singledispatchmethod-function] | ^^^^^^^^^^^^^^^^^^^^^ diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1700_yield_from_in_async_function.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1700_yield_from_in_async_function.py.snap index bdd46fe539..6e4d0c32fa 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1700_yield_from_in_async_function.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1700_yield_from_in_async_function.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLE1700]: yield_from_in_async_function.py:7:5: `yield from` statement in async function; use `async for` instead +error[PLE1700]: 7:5: `yield from` statement in async function; use `async for` instead + --> yield_from_in_async_function.py:7:5 | 5 | async def fail(): 6 | l = (1, 2, 3) diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2502_bidirectional_unicode.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2502_bidirectional_unicode.py.snap index 301caa932b..9486336a7d 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2502_bidirectional_unicode.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2502_bidirectional_unicode.py.snap @@ -1,42 +1,46 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLE2502]: bidirectional_unicode.py:2:1: Contains control characters that can permit obfuscated code +error[PLE2502]: 2:1: Contains control characters that can permit obfuscated code + --> bidirectional_unicode.py:1:8 | -1 | # E2502 -2 | / print("שלום") -3 | | - | |_^ -4 | # E2502 -5 | example = "x‏" * 100 # "‏x" is assigned +1 | # E2502 +2 | print("שלום") + | ^^^^^^^^^^^^^ +3 | +4 | # E2502 +5 | example = "x‏" * 100 # "‏x" is assigned | -error[PLE2502]: bidirectional_unicode.py:5:1: Contains control characters that can permit obfuscated code +error[PLE2502]: 5:1: Contains control characters that can permit obfuscated code + --> bidirectional_unicode.py:4:8 | -4 | # E2502 -5 | / example = "x‏" * 100 # "‏x" is assigned -6 | | - | |_^ -7 | # E2502 -8 | if access_level != "none": # Check if admin ' and access_level != 'user +4 | # E2502 +5 | example = "x‏" * 100 # "‏x" is assigned + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +6 | +7 | # E2502 +8 | if access_level != "none": # Check if admin ' and access_level != 'user | -error[PLE2502]: bidirectional_unicode.py:8:1: Contains control characters that can permit obfuscated code +error[PLE2502]: 8:1: Contains control characters that can permit obfuscated code + --> bidirectional_unicode.py:7:8 | -7 | # E2502 -8 | / if access_level != "none": # Check if admin ' and access_level != 'user -9 | | print("You are an admin.") - | |_^ +7 | # E2502 +8 | if access_level != "none": # Check if admin ' and access_level != 'user + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +9 | print("You are an admin.") | -error[PLE2502]: bidirectional_unicode.py:14:1: Contains control characters that can permit obfuscated code +error[PLE2502]: 14:1: Contains control characters that can permit obfuscated code + --> bidirectional_unicode.py:13:47 | -12 | # E2502 -13 | def subtract_funds(account: str, amount: int): -14 | / """Subtract funds from bank account then """ -15 | | return - | |_^ -16 | bank[account] -= amount -17 | return +12 | # E2502 +13 | def subtract_funds(account: str, amount: int): +14 | """Subtract funds from bank account then """ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +15 | return +16 | bank[account] -= amount +17 | return | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2510_invalid_characters.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2510_invalid_characters.py.snap index 3f23d12764..326426791d 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2510_invalid_characters.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2510_invalid_characters.py.snap @@ -1,16 +1,17 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -invalid_characters.py:15:6: PLE2510 [*] Invalid unescaped character backspace, use "\b" instead +error[PLE2510]: 15:6: [*] Invalid unescaped character backspace, use "\b" instead + + --> invalid_characters.py:15:6 | 13 | # (Pylint, "C3002") => Rule::UnnecessaryDirectLambdaCall, 14 | #foo = 'hi' -15 | b = '␈' - | ^ PLE2510 -16 | b = f'␈' +15 | b = '' + | ^ +16 | b = f'' | = help: Replace with escape sequence - ℹ Safe fix 12 12 | # (Pylint, "C0414") => Rule::UselessImportAlias, 13 13 | # (Pylint, "C3002") => Rule::UnnecessaryDirectLambdaCall, @@ -21,17 +22,18 @@ invalid_characters.py:15:6: PLE2510 [*] Invalid unescaped character backspace, u 17 17 | 18 18 | b_ok = '\\b' -invalid_characters.py:16:7: PLE2510 [*] Invalid unescaped character backspace, use "\b" instead +error[PLE2510]: 16:7: [*] Invalid unescaped character backspace, use "\b" instead + + --> invalid_characters.py:16:7 | 14 | #foo = 'hi' -15 | b = '␈' -16 | b = f'␈' - | ^ PLE2510 +15 | b = '' +16 | b = f'' + | ^ 17 | 18 | b_ok = '\\b' | = help: Replace with escape sequence - ℹ Safe fix 13 13 | # (Pylint, "C3002") => Rule::UnnecessaryDirectLambdaCall, 14 14 | #foo = 'hi' @@ -42,17 +44,18 @@ invalid_characters.py:16:7: PLE2510 [*] Invalid unescaped character backspace, u 18 18 | b_ok = '\\b' 19 19 | b_ok = f'\\b' -invalid_characters.py:55:21: PLE2510 [*] Invalid unescaped character backspace, use "\b" instead +error[PLE2510]: 55:21: [*] Invalid unescaped character backspace, use "\b" instead + + --> invalid_characters.py:55:21 | 53 | zwsp_after_multicharacter_grapheme_cluster = f"ಫ್ರಾನ್ಸಿಸ್ಕೊ ​​" 54 | -55 | nested_fstrings = f'␈{f'{f'␛'}'}' - | ^ PLE2510 +55 | nested_fstrings = f'{f'{f''}'}' + | ^ 56 | 57 | # https://github.com/astral-sh/ruff/issues/7455#issuecomment-1741998106 | = help: Replace with escape sequence - ℹ Safe fix 52 52 | zwsp_after_multicharacter_grapheme_cluster = "ಫ್ರಾನ್ಸಿಸ್ಕೊ ​​" 53 53 | zwsp_after_multicharacter_grapheme_cluster = f"ಫ್ರಾನ್ಸಿಸ್ಕೊ ​​" diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2510_invalid_characters_syntax_error.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2510_invalid_characters_syntax_error.py.snap index ac7bb4abc9..ad5ade72f6 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2510_invalid_characters_syntax_error.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2510_invalid_characters_syntax_error.py.snap @@ -1,110 +1,122 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -invalid_characters_syntax_error.py:5:6: PLE2510 Invalid unescaped character backspace, use "\b" instead +error[PLE2510]: 5:6: Invalid unescaped character backspace, use "\b" instead + + --> invalid_characters_syntax_error.py:5:6 | 4 | # Before any syntax error -5 | b = '␈' - | ^ PLE2510 +5 | b = '' + | ^ 6 | # Unterminated string -7 | b = '␈ +7 | b = ' | = help: Replace with escape sequence +error[syntax-error]: 7:5: missing closing quote in string literal -invalid_characters_syntax_error.py:7:5: SyntaxError: missing closing quote in string literal + --> invalid_characters_syntax_error.py:7:5 | -5 | b = '␈' +5 | b = '' 6 | # Unterminated string -7 | b = '␈ +7 | b = ' | ^ -8 | b = '␈' +8 | b = '' 9 | # Unterminated f-string | +error[syntax-error]: 7:7: Expected a statement -invalid_characters_syntax_error.py:7:7: SyntaxError: Expected a statement + --> invalid_characters_syntax_error.py:7:7 | - 5 | b = '␈' + 5 | b = '' 6 | # Unterminated string - 7 | b = '␈ - | ^ - 8 | b = '␈' + 7 | b = ' + | ^ + 8 | b = '' 9 | # Unterminated f-string -10 | b = f'␈ +10 | b = f' | +error[PLE2510]: 8:6: Invalid unescaped character backspace, use "\b" instead -invalid_characters_syntax_error.py:8:6: PLE2510 Invalid unescaped character backspace, use "\b" instead + --> invalid_characters_syntax_error.py:8:6 | 6 | # Unterminated string - 7 | b = '␈ - 8 | b = '␈' - | ^ PLE2510 + 7 | b = ' + 8 | b = '' + | ^ 9 | # Unterminated f-string -10 | b = f'␈ +10 | b = f' | = help: Replace with escape sequence +error[syntax-error]: 10:7: f-string: unterminated string -invalid_characters_syntax_error.py:10:7: SyntaxError: f-string: unterminated string + --> invalid_characters_syntax_error.py:10:7 | - 8 | b = '␈' + 8 | b = '' 9 | # Unterminated f-string -10 | b = f'␈ +10 | b = f' | ^ -11 | b = f'␈' +11 | b = f'' 12 | # Implicitly concatenated | +error[syntax-error]: 10:8: Expected FStringEnd, found newline -invalid_characters_syntax_error.py:10:8: SyntaxError: Expected FStringEnd, found newline + --> invalid_characters_syntax_error.py:10:8 | - 8 | b = '␈' + 8 | b = '' 9 | # Unterminated f-string -10 | b = f'␈ - | ^ -11 | b = f'␈' +10 | b = f' + | ^ +11 | b = f'' 12 | # Implicitly concatenated -13 | b = '␈' f'␈' '␈ +13 | b = '' f'' ' | +error[PLE2510]: 11:7: Invalid unescaped character backspace, use "\b" instead -invalid_characters_syntax_error.py:11:7: PLE2510 Invalid unescaped character backspace, use "\b" instead + --> invalid_characters_syntax_error.py:11:7 | 9 | # Unterminated f-string -10 | b = f'␈ -11 | b = f'␈' - | ^ PLE2510 +10 | b = f' +11 | b = f'' + | ^ 12 | # Implicitly concatenated -13 | b = '␈' f'␈' '␈ +13 | b = '' f'' ' | = help: Replace with escape sequence +error[PLE2510]: 13:6: Invalid unescaped character backspace, use "\b" instead -invalid_characters_syntax_error.py:13:6: PLE2510 Invalid unescaped character backspace, use "\b" instead + --> invalid_characters_syntax_error.py:13:6 | -11 | b = f'␈' +11 | b = f'' 12 | # Implicitly concatenated -13 | b = '␈' f'␈' '␈ - | ^ PLE2510 +13 | b = '' f'' ' + | ^ | = help: Replace with escape sequence +error[PLE2510]: 13:11: Invalid unescaped character backspace, use "\b" instead -invalid_characters_syntax_error.py:13:11: PLE2510 Invalid unescaped character backspace, use "\b" instead + --> invalid_characters_syntax_error.py:13:11 | -11 | b = f'␈' +11 | b = f'' 12 | # Implicitly concatenated -13 | b = '␈' f'␈' '␈ - | ^ PLE2510 +13 | b = '' f'' ' + | ^ | = help: Replace with escape sequence +error[syntax-error]: 13:14: missing closing quote in string literal -invalid_characters_syntax_error.py:13:14: SyntaxError: missing closing quote in string literal + --> invalid_characters_syntax_error.py:13:14 | -11 | b = f'␈' +11 | b = f'' 12 | # Implicitly concatenated -13 | b = '␈' f'␈' '␈ - | ^ +13 | b = '' f'' ' + | ^ | +error[syntax-error]: 13:16: Expected a statement -invalid_characters_syntax_error.py:13:16: SyntaxError: Expected a statement + --> invalid_characters_syntax_error.py:13:16 | -11 | b = f'␈' +11 | b = f'' 12 | # Implicitly concatenated -13 | b = '␈' f'␈' '␈ - | ^ +13 | b = '' f'' ' + | ^ | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2512_invalid_characters.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2512_invalid_characters.py.snap index 3ef59bd929..b100226870 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2512_invalid_characters.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2512_invalid_characters.py.snap @@ -1,16 +1,17 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -invalid_characters.py:24:12: PLE2512 [*] Invalid unescaped character SUB, use "\x1A" instead +error[PLE2512]: 24:12: [*] Invalid unescaped character SUB, use "\x1A" instead + + --> invalid_characters.py:24:12 | 22 | cr_ok = f'\\r' 23 | 24 | sub = 'sub ' - | PLE2512 + | ^ 25 | sub = f'sub ' | = help: Replace with escape sequence - ℹ Safe fix 21 21 | cr_ok = '\\r' 22 22 | cr_ok = f'\\r' @@ -21,16 +22,17 @@ invalid_characters.py:24:12: PLE2512 [*] Invalid unescaped character SUB, use "\ 26 26 | 27 27 | sub_ok = '\x1a' -invalid_characters.py:25:13: PLE2512 [*] Invalid unescaped character SUB, use "\x1A" instead +error[PLE2512]: 25:13: [*] Invalid unescaped character SUB, use "\x1A" instead + + --> invalid_characters.py:25:13 | 24 | sub = 'sub ' 25 | sub = f'sub ' - | PLE2512 + | ^ 26 | 27 | sub_ok = '\x1a' | = help: Replace with escape sequence - ℹ Safe fix 22 22 | cr_ok = f'\\r' 23 23 | @@ -41,17 +43,18 @@ invalid_characters.py:25:13: PLE2512 [*] Invalid unescaped character SUB, use "\ 27 27 | sub_ok = '\x1a' 28 28 | sub_ok = f'\x1a' -invalid_characters.py:55:25: PLE2512 [*] Invalid unescaped character SUB, use "\x1A" instead +error[PLE2512]: 55:25: [*] Invalid unescaped character SUB, use "\x1A" instead + + --> invalid_characters.py:55:25 | 53 | zwsp_after_multicharacter_grapheme_cluster = f"ಫ್ರಾನ್ಸಿಸ್ಕೊ ​​" 54 | -55 | nested_fstrings = f'␈{f'{f'␛'}'}' - | PLE2512 +55 | nested_fstrings = f'{f'{f''}'}' + | ^ 56 | 57 | # https://github.com/astral-sh/ruff/issues/7455#issuecomment-1741998106 | = help: Replace with escape sequence - ℹ Safe fix 52 52 | zwsp_after_multicharacter_grapheme_cluster = "ಫ್ರಾನ್ಸಿಸ್ಕೊ ​​" 53 53 | zwsp_after_multicharacter_grapheme_cluster = f"ಫ್ರಾನ್ಸಿಸ್ಕೊ ​​" @@ -62,16 +65,17 @@ invalid_characters.py:55:25: PLE2512 [*] Invalid unescaped character SUB, use "\ 57 57 | # https://github.com/astral-sh/ruff/issues/7455#issuecomment-1741998106 58 58 | x = f"""}}ab""" -invalid_characters.py:58:12: PLE2512 [*] Invalid unescaped character SUB, use "\x1A" instead +error[PLE2512]: 58:12: [*] Invalid unescaped character SUB, use "\x1A" instead + + --> invalid_characters.py:58:12 | 57 | # https://github.com/astral-sh/ruff/issues/7455#issuecomment-1741998106 58 | x = f"""}}ab""" - | PLE2512 + | ^ 59 | # https://github.com/astral-sh/ruff/issues/7455#issuecomment-1741998256 -60 | x = f"""}}a␛b""" +60 | x = f"""}}ab""" | = help: Replace with escape sequence - ℹ Safe fix 55 55 | nested_fstrings = f'␈{f'{f'␛'}'}' 56 56 | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2513_invalid_characters.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2513_invalid_characters.py.snap index 993c89041e..9a0316c858 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2513_invalid_characters.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2513_invalid_characters.py.snap @@ -1,16 +1,17 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -invalid_characters.py:30:16: PLE2513 [*] Invalid unescaped character ESC, use "\x1B" instead +error[PLE2513]: 30:16: [*] Invalid unescaped character ESC, use "\x1B" instead + + --> invalid_characters.py:30:16 | 28 | sub_ok = f'\x1a' 29 | -30 | esc = 'esc esc ␛' - | ^ PLE2513 -31 | esc = f'esc esc ␛' +30 | esc = 'esc esc ' + | ^ +31 | esc = f'esc esc ' | = help: Replace with escape sequence - ℹ Safe fix 27 27 | sub_ok = '\x1a' 28 28 | sub_ok = f'\x1a' @@ -21,16 +22,17 @@ invalid_characters.py:30:16: PLE2513 [*] Invalid unescaped character ESC, use "\ 32 32 | 33 33 | esc_ok = '\x1b' -invalid_characters.py:31:17: PLE2513 [*] Invalid unescaped character ESC, use "\x1B" instead +error[PLE2513]: 31:17: [*] Invalid unescaped character ESC, use "\x1B" instead + + --> invalid_characters.py:31:17 | -30 | esc = 'esc esc ␛' -31 | esc = f'esc esc ␛' - | ^ PLE2513 +30 | esc = 'esc esc ' +31 | esc = f'esc esc ' + | ^ 32 | 33 | esc_ok = '\x1b' | = help: Replace with escape sequence - ℹ Safe fix 28 28 | sub_ok = f'\x1a' 29 29 | @@ -41,17 +43,18 @@ invalid_characters.py:31:17: PLE2513 [*] Invalid unescaped character ESC, use "\ 33 33 | esc_ok = '\x1b' 34 34 | esc_ok = f'\x1b' -invalid_characters.py:55:29: PLE2513 [*] Invalid unescaped character ESC, use "\x1B" instead +error[PLE2513]: 55:29: [*] Invalid unescaped character ESC, use "\x1B" instead + + --> invalid_characters.py:55:29 | 53 | zwsp_after_multicharacter_grapheme_cluster = f"ಫ್ರಾನ್ಸಿಸ್ಕೊ ​​" 54 | -55 | nested_fstrings = f'␈{f'{f'␛'}'}' - | ^ PLE2513 +55 | nested_fstrings = f'{f'{f''}'}' + | ^ 56 | 57 | # https://github.com/astral-sh/ruff/issues/7455#issuecomment-1741998106 | = help: Replace with escape sequence - ℹ Safe fix 52 52 | zwsp_after_multicharacter_grapheme_cluster = "ಫ್ರಾನ್ಸಿಸ್ಕೊ ​​" 53 53 | zwsp_after_multicharacter_grapheme_cluster = f"ಫ್ರಾನ್ಸಿಸ್ಕೊ ​​" @@ -62,15 +65,16 @@ invalid_characters.py:55:29: PLE2513 [*] Invalid unescaped character ESC, use "\ 57 57 | # https://github.com/astral-sh/ruff/issues/7455#issuecomment-1741998106 58 58 | x = f"""}}ab""" -invalid_characters.py:60:12: PLE2513 [*] Invalid unescaped character ESC, use "\x1B" instead +error[PLE2513]: 60:12: [*] Invalid unescaped character ESC, use "\x1B" instead + + --> invalid_characters.py:60:12 | 58 | x = f"""}}ab""" 59 | # https://github.com/astral-sh/ruff/issues/7455#issuecomment-1741998256 -60 | x = f"""}}a␛b""" - | ^ PLE2513 +60 | x = f"""}}ab""" + | ^ | = help: Replace with escape sequence - ℹ Safe fix 57 57 | # https://github.com/astral-sh/ruff/issues/7455#issuecomment-1741998106 58 58 | x = f"""}}ab""" diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2514_invalid_characters.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2514_invalid_characters.py.snap index 150d6528f3..e3635abc3d 100644 Binary files a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2514_invalid_characters.py.snap and b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2514_invalid_characters.py.snap differ diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2515_invalid_characters.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2515_invalid_characters.py.snap index bf097d02f2..430359ed24 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2515_invalid_characters.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2515_invalid_characters.py.snap @@ -1,16 +1,17 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -invalid_characters.py:44:13: PLE2515 [*] Invalid unescaped character zero-width-space, use "\u200B" instead +error[PLE2515]: 44:13: [*] Invalid unescaped character zero-width-space, use "\u200B" instead + + --> invalid_characters.py:44:13 | 42 | nul_ok = f'\0' 43 | 44 | zwsp = 'zero​width' - | PLE2515 + | ^ 45 | zwsp = f'zero​width' | = help: Replace with escape sequence - ℹ Safe fix 41 41 | nul_ok = '\0' 42 42 | nul_ok = f'\0' @@ -21,16 +22,17 @@ invalid_characters.py:44:13: PLE2515 [*] Invalid unescaped character zero-width- 46 46 | 47 47 | zwsp_ok = '\u200b' -invalid_characters.py:45:14: PLE2515 [*] Invalid unescaped character zero-width-space, use "\u200B" instead +error[PLE2515]: 45:14: [*] Invalid unescaped character zero-width-space, use "\u200B" instead + + --> invalid_characters.py:45:14 | 44 | zwsp = 'zero​width' 45 | zwsp = f'zero​width' - | PLE2515 + | ^ 46 | 47 | zwsp_ok = '\u200b' | = help: Replace with escape sequence - ℹ Safe fix 42 42 | nul_ok = f'\0' 43 43 | @@ -41,17 +43,18 @@ invalid_characters.py:45:14: PLE2515 [*] Invalid unescaped character zero-width- 47 47 | zwsp_ok = '\u200b' 48 48 | zwsp_ok = f'\u200b' -invalid_characters.py:50:36: PLE2515 [*] Invalid unescaped character zero-width-space, use "\u200B" instead +error[PLE2515]: 50:36: [*] Invalid unescaped character zero-width-space, use "\u200B" instead + + --> invalid_characters.py:50:36 | 48 | zwsp_ok = f'\u200b' 49 | 50 | zwsp_after_multibyte_character = "ಫ​" - | PLE2515 + | ^ 51 | zwsp_after_multibyte_character = f"ಫ​" 52 | zwsp_after_multicharacter_grapheme_cluster = "ಫ್ರಾನ್ಸಿಸ್ಕೊ ​​" | = help: Replace with escape sequence - ℹ Safe fix 47 47 | zwsp_ok = '\u200b' 48 48 | zwsp_ok = f'\u200b' @@ -62,16 +65,17 @@ invalid_characters.py:50:36: PLE2515 [*] Invalid unescaped character zero-width- 52 52 | zwsp_after_multicharacter_grapheme_cluster = "ಫ್ರಾನ್ಸಿಸ್ಕೊ ​​" 53 53 | zwsp_after_multicharacter_grapheme_cluster = f"ಫ್ರಾನ್ಸಿಸ್ಕೊ ​​" -invalid_characters.py:51:37: PLE2515 [*] Invalid unescaped character zero-width-space, use "\u200B" instead +error[PLE2515]: 51:37: [*] Invalid unescaped character zero-width-space, use "\u200B" instead + + --> invalid_characters.py:51:37 | 50 | zwsp_after_multibyte_character = "ಫ​" 51 | zwsp_after_multibyte_character = f"ಫ​" - | PLE2515 + | ^ 52 | zwsp_after_multicharacter_grapheme_cluster = "ಫ್ರಾನ್ಸಿಸ್ಕೊ ​​" 53 | zwsp_after_multicharacter_grapheme_cluster = f"ಫ್ರಾನ್ಸಿಸ್ಕೊ ​​" | = help: Replace with escape sequence - ℹ Safe fix 48 48 | zwsp_ok = f'\u200b' 49 49 | @@ -82,16 +86,17 @@ invalid_characters.py:51:37: PLE2515 [*] Invalid unescaped character zero-width- 53 53 | zwsp_after_multicharacter_grapheme_cluster = f"ಫ್ರಾನ್ಸಿಸ್ಕೊ ​​" 54 54 | -invalid_characters.py:52:60: PLE2515 [*] Invalid unescaped character zero-width-space, use "\u200B" instead +error[PLE2515]: 52:60: [*] Invalid unescaped character zero-width-space, use "\u200B" instead + + --> invalid_characters.py:52:60 | 50 | zwsp_after_multibyte_character = "ಫ​" 51 | zwsp_after_multibyte_character = f"ಫ​" 52 | zwsp_after_multicharacter_grapheme_cluster = "ಫ್ರಾನ್ಸಿಸ್ಕೊ ​​" - | PLE2515 + | ^ 53 | zwsp_after_multicharacter_grapheme_cluster = f"ಫ್ರಾನ್ಸಿಸ್ಕೊ ​​" | = help: Replace with escape sequence - ℹ Safe fix 49 49 | 50 50 | zwsp_after_multibyte_character = "ಫ​" @@ -102,16 +107,17 @@ invalid_characters.py:52:60: PLE2515 [*] Invalid unescaped character zero-width- 54 54 | 55 55 | nested_fstrings = f'␈{f'{f'␛'}'}' -invalid_characters.py:52:61: PLE2515 [*] Invalid unescaped character zero-width-space, use "\u200B" instead +error[PLE2515]: 52:61: [*] Invalid unescaped character zero-width-space, use "\u200B" instead + + --> invalid_characters.py:52:61 | 50 | zwsp_after_multibyte_character = "ಫ​" 51 | zwsp_after_multibyte_character = f"ಫ​" 52 | zwsp_after_multicharacter_grapheme_cluster = "ಫ್ರಾನ್ಸಿಸ್ಕೊ ​​" - | PLE2515 + | ^ 53 | zwsp_after_multicharacter_grapheme_cluster = f"ಫ್ರಾನ್ಸಿಸ್ಕೊ ​​" | = help: Replace with escape sequence - ℹ Safe fix 49 49 | 50 50 | zwsp_after_multibyte_character = "ಫ​" @@ -122,17 +128,18 @@ invalid_characters.py:52:61: PLE2515 [*] Invalid unescaped character zero-width- 54 54 | 55 55 | nested_fstrings = f'␈{f'{f'␛'}'}' -invalid_characters.py:53:61: PLE2515 [*] Invalid unescaped character zero-width-space, use "\u200B" instead +error[PLE2515]: 53:61: [*] Invalid unescaped character zero-width-space, use "\u200B" instead + + --> invalid_characters.py:53:61 | 51 | zwsp_after_multibyte_character = f"ಫ​" 52 | zwsp_after_multicharacter_grapheme_cluster = "ಫ್ರಾನ್ಸಿಸ್ಕೊ ​​" 53 | zwsp_after_multicharacter_grapheme_cluster = f"ಫ್ರಾನ್ಸಿಸ್ಕೊ ​​" - | PLE2515 + | ^ 54 | -55 | nested_fstrings = f'␈{f'{f'␛'}'}' +55 | nested_fstrings = f'{f'{f''}'}' | = help: Replace with escape sequence - ℹ Safe fix 50 50 | zwsp_after_multibyte_character = "ಫ​" 51 51 | zwsp_after_multibyte_character = f"ಫ​" @@ -143,17 +150,18 @@ invalid_characters.py:53:61: PLE2515 [*] Invalid unescaped character zero-width- 55 55 | nested_fstrings = f'␈{f'{f'␛'}'}' 56 56 | -invalid_characters.py:53:62: PLE2515 [*] Invalid unescaped character zero-width-space, use "\u200B" instead +error[PLE2515]: 53:62: [*] Invalid unescaped character zero-width-space, use "\u200B" instead + + --> invalid_characters.py:53:62 | 51 | zwsp_after_multibyte_character = f"ಫ​" 52 | zwsp_after_multicharacter_grapheme_cluster = "ಫ್ರಾನ್ಸಿಸ್ಕೊ ​​" 53 | zwsp_after_multicharacter_grapheme_cluster = f"ಫ್ರಾನ್ಸಿಸ್ಕೊ ​​" - | PLE2515 + | ^ 54 | -55 | nested_fstrings = f'␈{f'{f'␛'}'}' +55 | nested_fstrings = f'{f'{f''}'}' | = help: Replace with escape sequence - ℹ Safe fix 50 50 | zwsp_after_multibyte_character = "ಫ​" 51 51 | zwsp_after_multibyte_character = f"ಫ​" diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE4703_modified_iterating_set.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE4703_modified_iterating_set.py.snap index 82bb0fc707..cc22d95cbd 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE4703_modified_iterating_set.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE4703_modified_iterating_set.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLE4703]: modified_iterating_set.py:4:1: [*] Iterated set `nums` is modified within the `for` loop +error[PLE4703]: 4:1: [*] Iterated set `nums` is modified within the `for` loop + --> modified_iterating_set.py:3:17 | 3 | nums = {1, 2, 3} 4 | / for num in nums: @@ -22,8 +23,9 @@ error[PLE4703]: modified_iterating_set.py:4:1: [*] Iterated set `nums` is modifi 6 6 | 7 7 | animals = {"dog", "cat", "cow"} -error[PLE4703]: modified_iterating_set.py:8:1: [*] Iterated set `animals` is modified within the `for` loop +error[PLE4703]: 8:1: [*] Iterated set `animals` is modified within the `for` loop + --> modified_iterating_set.py:7:32 | 7 | animals = {"dog", "cat", "cow"} 8 | / for animal in animals: @@ -43,8 +45,9 @@ error[PLE4703]: modified_iterating_set.py:8:1: [*] Iterated set `animals` is mod 10 10 | 11 11 | fruits = {"apple", "orange", "grape"} -error[PLE4703]: modified_iterating_set.py:12:1: [*] Iterated set `fruits` is modified within the `for` loop +error[PLE4703]: 12:1: [*] Iterated set `fruits` is modified within the `for` loop + --> modified_iterating_set.py:11:38 | 11 | fruits = {"apple", "orange", "grape"} 12 | / for fruit in fruits: @@ -64,8 +67,9 @@ error[PLE4703]: modified_iterating_set.py:12:1: [*] Iterated set `fruits` is mod 14 14 | 15 15 | planets = {"mercury", "venus", "earth"} -error[PLE4703]: modified_iterating_set.py:16:1: [*] Iterated set `planets` is modified within the `for` loop +error[PLE4703]: 16:1: [*] Iterated set `planets` is modified within the `for` loop + --> modified_iterating_set.py:15:40 | 15 | planets = {"mercury", "venus", "earth"} 16 | / for planet in planets: @@ -85,8 +89,9 @@ error[PLE4703]: modified_iterating_set.py:16:1: [*] Iterated set `planets` is mo 18 18 | 19 19 | colors = {"red", "green", "blue"} -error[PLE4703]: modified_iterating_set.py:20:1: [*] Iterated set `colors` is modified within the `for` loop +error[PLE4703]: 20:1: [*] Iterated set `colors` is modified within the `for` loop + --> modified_iterating_set.py:19:34 | 19 | colors = {"red", "green", "blue"} 20 | / for color in colors: @@ -106,8 +111,9 @@ error[PLE4703]: modified_iterating_set.py:20:1: [*] Iterated set `colors` is mod 22 22 | 23 23 | odds = {1, 3, 5} -error[PLE4703]: modified_iterating_set.py:24:1: [*] Iterated set `odds` is modified within the `for` loop +error[PLE4703]: 24:1: [*] Iterated set `odds` is modified within the `for` loop + --> modified_iterating_set.py:23:17 | 23 | odds = {1, 3, 5} 24 | / for num in odds: diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0124_comparison_with_itself.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0124_comparison_with_itself.py.snap index 708e54b200..0cb2e5a24c 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0124_comparison_with_itself.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0124_comparison_with_itself.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLR0124]: comparison_with_itself.py:2:1: Name compared with itself, consider replacing `foo == foo` +error[PLR0124]: 2:1: Name compared with itself, consider replacing `foo == foo` + --> comparison_with_itself.py:1:10 | 1 | # Errors. 2 | foo == foo @@ -10,8 +11,9 @@ error[PLR0124]: comparison_with_itself.py:2:1: Name compared with itself, consid 3 | 4 | foo != foo | -error[PLR0124]: comparison_with_itself.py:4:1: Name compared with itself, consider replacing `foo != foo` +error[PLR0124]: 4:1: Name compared with itself, consider replacing `foo != foo` + --> comparison_with_itself.py:3:1 | 2 | foo == foo 3 | @@ -20,8 +22,9 @@ error[PLR0124]: comparison_with_itself.py:4:1: Name compared with itself, consid 5 | 6 | foo > foo | -error[PLR0124]: comparison_with_itself.py:6:1: Name compared with itself, consider replacing `foo > foo` +error[PLR0124]: 6:1: Name compared with itself, consider replacing `foo > foo` + --> comparison_with_itself.py:5:1 | 4 | foo != foo 5 | @@ -30,8 +33,9 @@ error[PLR0124]: comparison_with_itself.py:6:1: Name compared with itself, consid 7 | 8 | foo >= foo | -error[PLR0124]: comparison_with_itself.py:8:1: Name compared with itself, consider replacing `foo >= foo` +error[PLR0124]: 8:1: Name compared with itself, consider replacing `foo >= foo` + --> comparison_with_itself.py:7:1 | 6 | foo > foo 7 | @@ -40,8 +44,9 @@ error[PLR0124]: comparison_with_itself.py:8:1: Name compared with itself, consid 9 | 10 | foo < foo | -error[PLR0124]: comparison_with_itself.py:10:1: Name compared with itself, consider replacing `foo < foo` +error[PLR0124]: 10:1: Name compared with itself, consider replacing `foo < foo` + --> comparison_with_itself.py:9:1 | 8 | foo >= foo 9 | @@ -50,8 +55,9 @@ error[PLR0124]: comparison_with_itself.py:10:1: Name compared with itself, consi 11 | 12 | foo <= foo | -error[PLR0124]: comparison_with_itself.py:12:1: Name compared with itself, consider replacing `foo <= foo` +error[PLR0124]: 12:1: Name compared with itself, consider replacing `foo <= foo` + --> comparison_with_itself.py:11:1 | 10 | foo < foo 11 | @@ -60,8 +66,9 @@ error[PLR0124]: comparison_with_itself.py:12:1: Name compared with itself, consi 13 | 14 | foo is foo | -error[PLR0124]: comparison_with_itself.py:14:1: Name compared with itself, consider replacing `foo is foo` +error[PLR0124]: 14:1: Name compared with itself, consider replacing `foo is foo` + --> comparison_with_itself.py:13:1 | 12 | foo <= foo 13 | @@ -70,8 +77,9 @@ error[PLR0124]: comparison_with_itself.py:14:1: Name compared with itself, consi 15 | 16 | foo is not foo | -error[PLR0124]: comparison_with_itself.py:16:1: Name compared with itself, consider replacing `foo is not foo` +error[PLR0124]: 16:1: Name compared with itself, consider replacing `foo is not foo` + --> comparison_with_itself.py:15:1 | 14 | foo is foo 15 | @@ -80,8 +88,9 @@ error[PLR0124]: comparison_with_itself.py:16:1: Name compared with itself, consi 17 | 18 | foo in foo | -error[PLR0124]: comparison_with_itself.py:18:1: Name compared with itself, consider replacing `foo in foo` +error[PLR0124]: 18:1: Name compared with itself, consider replacing `foo in foo` + --> comparison_with_itself.py:17:1 | 16 | foo is not foo 17 | @@ -90,8 +99,9 @@ error[PLR0124]: comparison_with_itself.py:18:1: Name compared with itself, consi 19 | 20 | foo not in foo | -error[PLR0124]: comparison_with_itself.py:20:1: Name compared with itself, consider replacing `foo not in foo` +error[PLR0124]: 20:1: Name compared with itself, consider replacing `foo not in foo` + --> comparison_with_itself.py:19:1 | 18 | foo in foo 19 | @@ -100,8 +110,9 @@ error[PLR0124]: comparison_with_itself.py:20:1: Name compared with itself, consi 21 | 22 | id(foo) == id(foo) | -error[PLR0124]: comparison_with_itself.py:22:1: Name compared with itself, consider replacing `id(foo) == id(foo)` +error[PLR0124]: 22:1: Name compared with itself, consider replacing `id(foo) == id(foo)` + --> comparison_with_itself.py:21:1 | 20 | foo not in foo 21 | @@ -110,8 +121,9 @@ error[PLR0124]: comparison_with_itself.py:22:1: Name compared with itself, consi 23 | 24 | len(foo) == len(foo) | -error[PLR0124]: comparison_with_itself.py:24:1: Name compared with itself, consider replacing `len(foo) == len(foo)` +error[PLR0124]: 24:1: Name compared with itself, consider replacing `len(foo) == len(foo)` + --> comparison_with_itself.py:23:1 | 22 | id(foo) == id(foo) 23 | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0133_comparison_of_constant.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0133_comparison_of_constant.py.snap index 0a545ac8f3..12dbd1b4c9 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0133_comparison_of_constant.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0133_comparison_of_constant.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLR0133]: comparison_of_constant.py:3:4: Two constants compared in a comparison, consider replacing `100 == 100` +error[PLR0133]: 3:4: Two constants compared in a comparison, consider replacing `100 == 100` + --> comparison_of_constant.py:3:4 | 1 | """Check that magic values are not used in comparisons""" 2 | @@ -10,8 +11,9 @@ error[PLR0133]: comparison_of_constant.py:3:4: Two constants compared in a compa | ^^^ 4 | pass | -error[PLR0133]: comparison_of_constant.py:6:4: Two constants compared in a comparison, consider replacing `1 == 3` +error[PLR0133]: 6:4: Two constants compared in a comparison, consider replacing `1 == 3` + --> comparison_of_constant.py:6:4 | 4 | pass 5 | @@ -19,8 +21,9 @@ error[PLR0133]: comparison_of_constant.py:6:4: Two constants compared in a compa | ^ 7 | pass | -error[PLR0133]: comparison_of_constant.py:9:4: Two constants compared in a comparison, consider replacing `1 != 3` +error[PLR0133]: 9:4: Two constants compared in a comparison, consider replacing `1 != 3` + --> comparison_of_constant.py:9:4 | 7 | pass 8 | @@ -28,16 +31,18 @@ error[PLR0133]: comparison_of_constant.py:9:4: Two constants compared in a compa | ^ 10 | pass | -error[PLR0133]: comparison_of_constant.py:13:4: Two constants compared in a comparison, consider replacing `4 == 3` +error[PLR0133]: 13:4: Two constants compared in a comparison, consider replacing `4 == 3` + --> comparison_of_constant.py:13:4 | 12 | x = 0 13 | if 4 == 3 == x: # [comparison-of-constants] | ^ 14 | pass | -error[PLR0133]: comparison_of_constant.py:23:4: Two constants compared in a comparison, consider replacing `1 > 0` +error[PLR0133]: 23:4: Two constants compared in a comparison, consider replacing `1 > 0` + --> comparison_of_constant.py:23:4 | 21 | pass 22 | @@ -45,8 +50,9 @@ error[PLR0133]: comparison_of_constant.py:23:4: Two constants compared in a comp | ^ 24 | pass | -error[PLR0133]: comparison_of_constant.py:29:4: Two constants compared in a comparison, consider replacing `1 >= 0` +error[PLR0133]: 29:4: Two constants compared in a comparison, consider replacing `1 >= 0` + --> comparison_of_constant.py:29:4 | 27 | pass 28 | @@ -54,8 +60,9 @@ error[PLR0133]: comparison_of_constant.py:29:4: Two constants compared in a comp | ^ 30 | pass | -error[PLR0133]: comparison_of_constant.py:35:4: Two constants compared in a comparison, consider replacing `1 < 0` +error[PLR0133]: 35:4: Two constants compared in a comparison, consider replacing `1 < 0` + --> comparison_of_constant.py:35:4 | 33 | pass 34 | @@ -63,8 +70,9 @@ error[PLR0133]: comparison_of_constant.py:35:4: Two constants compared in a comp | ^ 36 | pass | -error[PLR0133]: comparison_of_constant.py:41:4: Two constants compared in a comparison, consider replacing `1 <= 0` +error[PLR0133]: 41:4: Two constants compared in a comparison, consider replacing `1 <= 0` + --> comparison_of_constant.py:41:4 | 39 | pass 40 | @@ -72,8 +80,9 @@ error[PLR0133]: comparison_of_constant.py:41:4: Two constants compared in a comp | ^ 42 | pass | -error[PLR0133]: comparison_of_constant.py:51:4: Two constants compared in a comparison, consider replacing `"hello" == ""` +error[PLR0133]: 51:4: Two constants compared in a comparison, consider replacing `"hello" == ""` + --> comparison_of_constant.py:51:4 | 49 | pass 50 | @@ -81,8 +90,9 @@ error[PLR0133]: comparison_of_constant.py:51:4: Two constants compared in a comp | ^^^^^^^ 52 | pass | -error[PLR0133]: comparison_of_constant.py:58:4: Two constants compared in a comparison, consider replacing `True == False` +error[PLR0133]: 58:4: Two constants compared in a comparison, consider replacing `True == False` + --> comparison_of_constant.py:58:4 | 56 | pass 57 | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0202_no_method_decorator.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0202_no_method_decorator.py.snap index 31fa86cde3..d589f2b65c 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0202_no_method_decorator.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0202_no_method_decorator.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLR0202]: no_method_decorator.py:9:5: [*] Class method defined without decorator +error[PLR0202]: 9:5: [*] Class method defined without decorator + --> no_method_decorator.py:9:5 | 7 | self.color = color 8 | @@ -26,8 +27,9 @@ error[PLR0202]: no_method_decorator.py:9:5: [*] Class method defined without dec 15 15 | def pick_one_color(): # [no-staticmethod-decorator] 16 16 | """staticmethod to pick one fruit color""" -error[PLR0202]: no_method_decorator.py:22:5: [*] Class method defined without decorator +error[PLR0202]: 22:5: [*] Class method defined without decorator + --> no_method_decorator.py:22:5 | 21 | class Class: 22 | def class_method(cls): diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0203_no_method_decorator.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0203_no_method_decorator.py.snap index 4e17fa8210..4af9b8d4af 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0203_no_method_decorator.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0203_no_method_decorator.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLR0203]: no_method_decorator.py:15:5: [*] Static method defined without decorator +error[PLR0203]: 15:5: [*] Static method defined without decorator + --> no_method_decorator.py:15:5 | 13 | pick_colors = classmethod(pick_colors) 14 | @@ -26,8 +27,9 @@ error[PLR0203]: no_method_decorator.py:15:5: [*] Static method defined without d 21 21 | class Class: 22 22 | def class_method(cls): -error[PLR0203]: no_method_decorator.py:27:5: [*] Static method defined without decorator +error[PLR0203]: 27:5: [*] Static method defined without decorator + --> no_method_decorator.py:27:5 | 25 | class_method = classmethod(class_method);another_statement 26 | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0206_property_with_parameters.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0206_property_with_parameters.py.snap index cc2e8c7ab8..02aae7c3b4 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0206_property_with_parameters.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0206_property_with_parameters.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLR0206]: property_with_parameters.py:7:9: Cannot have defined parameters for properties +error[PLR0206]: 7:9: Cannot have defined parameters for properties + --> property_with_parameters.py:7:9 | 5 | class Cls: 6 | @property @@ -10,24 +11,27 @@ error[PLR0206]: property_with_parameters.py:7:9: Cannot have defined parameters | ^^^^^^^^^ 8 | return param + param1 | -error[PLR0206]: property_with_parameters.py:11:9: Cannot have defined parameters for properties +error[PLR0206]: 11:9: Cannot have defined parameters for properties + --> property_with_parameters.py:11:9 | 10 | @property 11 | def attribute_keyword_only(self, *, param, param1): # [property-with-parameters] | ^^^^^^^^^^^^^^^^^^^^^^ 12 | return param + param1 | -error[PLR0206]: property_with_parameters.py:15:9: Cannot have defined parameters for properties +error[PLR0206]: 15:9: Cannot have defined parameters for properties + --> property_with_parameters.py:15:9 | 14 | @property 15 | def attribute_positional_only(self, param, param1, /): # [property-with-parameters] | ^^^^^^^^^^^^^^^^^^^^^^^^^ 16 | return param + param1 | -error[PLR0206]: property_with_parameters.py:35:9: Cannot have defined parameters for properties +error[PLR0206]: 35:9: Cannot have defined parameters for properties + --> property_with_parameters.py:35:9 | 33 | class VariadicParameters: 34 | @property @@ -35,45 +39,50 @@ error[PLR0206]: property_with_parameters.py:35:9: Cannot have defined parameters | ^^^^^^^^^^^^^^^^^^ 36 | return sum(args) | -error[PLR0206]: property_with_parameters.py:39:9: Cannot have defined parameters for properties +error[PLR0206]: 39:9: Cannot have defined parameters for properties + --> property_with_parameters.py:39:9 | 38 | @property 39 | def attribute_var_kwargs(self, **kwargs): #[property-with-parameters] | ^^^^^^^^^^^^^^^^^^^^ 40 | return {key: value * 2 for key, value in kwargs.items()} | +error[PLR0206]: 48:9: Cannot have defined parameters for properties -property_with_parameters.py:48:9: PLR0206 Cannot have defined parameters for properties + --> property_with_parameters.py:48:9 | 46 | class Cached: 47 | @cached_property 48 | def cached_prop(self, value): # [property-with-parameters] - | ^^^^^^^^^^^ PLR0206 + | ^^^^^^^^^^^ 49 | ... | +error[PLR0206]: 59:9: Cannot have defined parameters for properties -property_with_parameters.py:59:9: PLR0206 Cannot have defined parameters for properties + --> property_with_parameters.py:59:9 | 57 | class Baz: 58 | @abc.abstractproperty 59 | def prop2(self, param) -> None: # [property-with-parameters] - | ^^^^^ PLR0206 + | ^^^^^ 60 | return None | +error[PLR0206]: 63:9: Cannot have defined parameters for properties -property_with_parameters.py:63:9: PLR0206 Cannot have defined parameters for properties + --> property_with_parameters.py:63:9 | 62 | @types.DynamicClassAttribute 63 | def prop3(self, param) -> None: # [property-with-parameters] - | ^^^^^ PLR0206 + | ^^^^^ 64 | return None | +error[PLR0206]: 67:9: Cannot have defined parameters for properties -property_with_parameters.py:67:9: PLR0206 Cannot have defined parameters for properties + --> property_with_parameters.py:67:9 | 66 | @enum.property 67 | def prop4(self, param) -> None: # [property-with-parameters] - | ^^^^^ PLR0206 + | ^^^^^ 68 | return None | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0402_import_aliasing.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0402_import_aliasing.py.snap index 6d8c7645b0..88b06f936c 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0402_import_aliasing.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0402_import_aliasing.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLR0402]: import_aliasing.py:9:8: [*] Use `from os import path` in lieu of alias +error[PLR0402]: 9:8: [*] Use `from os import path` in lieu of alias + --> import_aliasing.py:9:8 | 7 | from collections import OrderedDict as OrderedDict # [useless-import-alias] 8 | from collections import OrderedDict as o_dict @@ -22,8 +23,9 @@ error[PLR0402]: import_aliasing.py:9:8: [*] Use `from os import path` in lieu of 11 11 | import foo.bar.foobar as foobar # [consider-using-from-import] 12 12 | import foo.bar.foobar as foobar, sys # [consider-using-from-import] -error[PLR0402]: import_aliasing.py:11:8: [*] Use `from foo.bar import foobar` in lieu of alias +error[PLR0402]: 11:8: [*] Use `from foo.bar import foobar` in lieu of alias + --> import_aliasing.py:11:8 | 9 | import os.path as path # [consider-using-from-import] 10 | import os.path as p @@ -43,8 +45,9 @@ error[PLR0402]: import_aliasing.py:11:8: [*] Use `from foo.bar import foobar` in 13 13 | import os 14 14 | import os as OS -error[PLR0402]: import_aliasing.py:12:8: Use `from foo.bar import foobar` in lieu of alias +error[PLR0402]: 12:8: Use `from foo.bar import foobar` in lieu of alias + --> import_aliasing.py:12:8 | 10 | import os.path as p 11 | import foo.bar.foobar as foobar # [consider-using-from-import] diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0911_too_many_return_statements.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0911_too_many_return_statements.py.snap index 70ec062c32..4922fb9236 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0911_too_many_return_statements.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0911_too_many_return_statements.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLR0911]: too_many_return_statements.py:4:5: Too many return statements (11 > 6) +error[PLR0911]: 4:5: Too many return statements (11 > 6) + --> too_many_return_statements.py:4:5 | 2 | https://github.com/PyCQA/pylint/blob/69eca9b3f9856c3033957b769358803ee48e8e47/tests/functional/t/too/too_many_return_statements.py 3 | """ diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0912_too_many_branches.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0912_too_many_branches.py.snap index 54d787af78..714701702a 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0912_too_many_branches.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0912_too_many_branches.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLR0912]: too_many_branches.py:8:5: Too many branches (13 > 12) +error[PLR0912]: 8:5: Too many branches (13 > 12) + --> too_many_branches.py:8:5 | 7 | # pylint: disable=using-constant-test 8 | def wrong(): # [too-many-branches] @@ -10,8 +11,9 @@ error[PLR0912]: too_many_branches.py:8:5: Too many branches (13 > 12) 9 | """ Has too many branches. """ 10 | if 1: | -error[PLR0912]: too_many_branches.py:80:5: Too many branches (13 > 12) +error[PLR0912]: 80:5: Too many branches (13 > 12) + --> too_many_branches.py:80:5 | 78 | pass 79 | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0913_too_many_arguments.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0913_too_many_arguments.py.snap index a66df27fbd..277dfecb14 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0913_too_many_arguments.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0913_too_many_arguments.py.snap @@ -1,69 +1,79 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -too_many_arguments.py:1:5: PLR0913 Too many arguments in function definition (8 > 5) +error[PLR0913]: 1:5: Too many arguments in function definition (8 > 5) + + --> too_many_arguments.py:1:5 | 1 | def f(x, y, z, t, u, v, w, r): # Too many arguments (8/5) - | ^ PLR0913 + | ^ 2 | pass | +error[PLR0913]: 17:5: Too many arguments in function definition (6 > 5) -too_many_arguments.py:17:5: PLR0913 Too many arguments in function definition (6 > 5) + --> too_many_arguments.py:17:5 | 17 | def f(x, y, z, u=1, v=1, r=1): # Too many arguments (6/5) - | ^ PLR0913 + | ^ 18 | pass | +error[PLR0913]: 25:5: Too many arguments in function definition (6 > 5) -too_many_arguments.py:25:5: PLR0913 Too many arguments in function definition (6 > 5) + --> too_many_arguments.py:25:5 | 25 | def f(x, y, z, /, u, v, w): # Too many arguments (6/5) - | ^ PLR0913 + | ^ 26 | pass | +error[PLR0913]: 29:5: Too many arguments in function definition (6 > 5) -too_many_arguments.py:29:5: PLR0913 Too many arguments in function definition (6 > 5) + --> too_many_arguments.py:29:5 | 29 | def f(x, y, z, *, u, v, w): # Too many arguments (6/5) - | ^ PLR0913 + | ^ 30 | pass | +error[PLR0913]: 33:5: Too many arguments in function definition (9 > 5) -too_many_arguments.py:33:5: PLR0913 Too many arguments in function definition (9 > 5) + --> too_many_arguments.py:33:5 | 33 | def f(x, y, z, a, b, c, *, u, v, w): # Too many arguments (9/5) - | ^ PLR0913 + | ^ 34 | pass | +error[PLR0913]: 51:9: Too many arguments in function definition (8 > 5) -too_many_arguments.py:51:9: PLR0913 Too many arguments in function definition (8 > 5) + --> too_many_arguments.py:51:9 | 50 | class C: 51 | def f(self, y, z, a, b, c, *, u, v, w): # Too many arguments (8/5) - | ^ PLR0913 + | ^ 52 | pass | +error[PLR0913]: 58:9: Too many arguments in function definition (8 > 5) -too_many_arguments.py:58:9: PLR0913 Too many arguments in function definition (8 > 5) + --> too_many_arguments.py:58:9 | 57 | @classmethod 58 | def f(cls, y, z, a, b, c, *, u, v, w): # Too many arguments (8/5) - | ^ PLR0913 + | ^ 59 | pass | +error[PLR0913]: 66:9: Too many arguments in function definition (8 > 5) -too_many_arguments.py:66:9: PLR0913 Too many arguments in function definition (8 > 5) + --> too_many_arguments.py:66:9 | 65 | @staticmethod 66 | def f(y, z, a, b, c, *, u, v, w): # Too many arguments (8/5) - | ^ PLR0913 + | ^ 67 | pass | +error[PLR0913]: 70:9: Too many arguments in function definition (6 > 5) -too_many_arguments.py:70:9: PLR0913 Too many arguments in function definition (6 > 5) + --> too_many_arguments.py:70:9 | 69 | @staticmethod 70 | def f(y, z, a, b, c, d): # OK - | ^ PLR0913 + | ^ 71 | pass | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0915_too_many_statements.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0915_too_many_statements.py.snap index 7eff7fe328..98a6c347d9 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0915_too_many_statements.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0915_too_many_statements.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLR0915]: too_many_statements.py:5:11: Too many statements (51 > 50) +error[PLR0915]: 5:11: Too many statements (51 > 50) + --> too_many_statements.py:5:11 | 5 | async def f(): # Too many statements (52/50) | ^ diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0917_too_many_positional_arguments.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0917_too_many_positional_arguments.py.snap index 52182d288a..5d2278980c 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0917_too_many_positional_arguments.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0917_too_many_positional_arguments.py.snap @@ -1,40 +1,46 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -too_many_positional_arguments.py:1:5: PLR0917 Too many positional arguments (8/5) +error[PLR0917]: 1:5: Too many positional arguments (8/5) + + --> too_many_positional_arguments.py:1:5 | 1 | def f(x, y, z, t, u, v, w, r): # Too many positional arguments (8/5) - | ^ PLR0917 + | ^ 2 | pass | +error[PLR0917]: 21:5: Too many positional arguments (6/5) -too_many_positional_arguments.py:21:5: PLR0917 Too many positional arguments (6/5) + --> too_many_positional_arguments.py:21:5 | 21 | def f(x, y, z, /, u, v, w): # Too many positional arguments (6/5) - | ^ PLR0917 + | ^ 22 | pass | +error[PLR0917]: 29:5: Too many positional arguments (6/5) -too_many_positional_arguments.py:29:5: PLR0917 Too many positional arguments (6/5) + --> too_many_positional_arguments.py:29:5 | 29 | def f(x, y, z, a, b, c, *, u, v, w): # Too many positional arguments (6/5) - | ^ PLR0917 + | ^ 30 | pass | +error[PLR0917]: 43:9: Too many positional arguments (6/5) -too_many_positional_arguments.py:43:9: PLR0917 Too many positional arguments (6/5) + --> too_many_positional_arguments.py:43:9 | 41 | pass 42 | 43 | def f(self, a, b, c, d, e, g): # Too many positional arguments (6/5) - | ^ PLR0917 + | ^ 44 | pass | +error[PLR0917]: 47:9: Too many positional arguments (6/5) -too_many_positional_arguments.py:47:9: PLR0917 Too many positional arguments (6/5) + --> too_many_positional_arguments.py:47:9 | 46 | @staticmethod 47 | def f(self, a, b, c, d, e): # Too many positional arguments (6/5) - | ^ PLR0917 + | ^ 48 | pass | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1702_too_many_nested_blocks.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1702_too_many_nested_blocks.py.snap index e96ffae34c..6f030cff31 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1702_too_many_nested_blocks.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1702_too_many_nested_blocks.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLR1702]: too_many_nested_blocks.py:2:5: Too many nested blocks (6 > 5) +error[PLR1702]: 2:5: Too many nested blocks (6 > 5) + --> too_many_nested_blocks.py:2:5 | 1 | def correct_fruits(fruits) -> bool: 2 | if len(fruits) > 1: # PLR1702 diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1704_redefined_argument_from_local.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1704_redefined_argument_from_local.py.snap index 246e255ce8..4a8d6ab63d 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1704_redefined_argument_from_local.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1704_redefined_argument_from_local.py.snap @@ -1,113 +1,127 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -redefined_argument_from_local.py:41:9: PLR1704 Redefining argument with the local name `a` +error[PLR1704]: 41:9: Redefining argument with the local name `a` + + --> redefined_argument_from_local.py:41:9 | 39 | # Errors 40 | def func(a): 41 | for a in range(1): - | ^ PLR1704 + | ^ 42 | ... | +error[PLR1704]: 46:9: Redefining argument with the local name `i` -redefined_argument_from_local.py:46:9: PLR1704 Redefining argument with the local name `i` + --> redefined_argument_from_local.py:46:9 | 45 | def func(i): 46 | for i in range(10): - | ^ PLR1704 + | ^ 47 | print(i) | +error[PLR1704]: 53:25: Redefining argument with the local name `e` -redefined_argument_from_local.py:53:25: PLR1704 Redefining argument with the local name `e` + --> redefined_argument_from_local.py:53:25 | 51 | try: 52 | ... 53 | except Exception as e: - | ^ PLR1704 + | ^ 54 | print(e) | +error[PLR1704]: 58:24: Redefining argument with the local name `f` -redefined_argument_from_local.py:58:24: PLR1704 Redefining argument with the local name `f` + --> redefined_argument_from_local.py:58:24 | 57 | def func(f): 58 | with open('', ) as f: - | ^ PLR1704 + | ^ 59 | print(f) | +error[PLR1704]: 63:24: Redefining argument with the local name `a` -redefined_argument_from_local.py:63:24: PLR1704 Redefining argument with the local name `a` + --> redefined_argument_from_local.py:63:24 | 62 | def func(a, b): 63 | with context() as (a, b, c): - | ^ PLR1704 + | ^ 64 | print(a, b, c) | +error[PLR1704]: 63:27: Redefining argument with the local name `b` -redefined_argument_from_local.py:63:27: PLR1704 Redefining argument with the local name `b` + --> redefined_argument_from_local.py:63:27 | 62 | def func(a, b): 63 | with context() as (a, b, c): - | ^ PLR1704 + | ^ 64 | print(a, b, c) | +error[PLR1704]: 68:24: Redefining argument with the local name `a` -redefined_argument_from_local.py:68:24: PLR1704 Redefining argument with the local name `a` + --> redefined_argument_from_local.py:68:24 | 67 | def func(a, b): 68 | with context() as [a, b, c]: - | ^ PLR1704 + | ^ 69 | print(a, b, c) | +error[PLR1704]: 68:27: Redefining argument with the local name `b` -redefined_argument_from_local.py:68:27: PLR1704 Redefining argument with the local name `b` + --> redefined_argument_from_local.py:68:27 | 67 | def func(a, b): 68 | with context() as [a, b, c]: - | ^ PLR1704 + | ^ 69 | print(a, b, c) | +error[PLR1704]: 73:51: Redefining argument with the local name `a` -redefined_argument_from_local.py:73:51: PLR1704 Redefining argument with the local name `a` + --> redefined_argument_from_local.py:73:51 | 72 | def func(a): 73 | with open('foo.py', ) as f, open('bar.py') as a: - | ^ PLR1704 + | ^ 74 | ... | +error[PLR1704]: 79:13: Redefining argument with the local name `a` -redefined_argument_from_local.py:79:13: PLR1704 Redefining argument with the local name `a` + --> redefined_argument_from_local.py:79:13 | 77 | def func(a): 78 | def bar(b): 79 | for a in range(1): - | ^ PLR1704 + | ^ 80 | print(a) | +error[PLR1704]: 85:13: Redefining argument with the local name `b` -redefined_argument_from_local.py:85:13: PLR1704 Redefining argument with the local name `b` + --> redefined_argument_from_local.py:85:13 | 83 | def func(a): 84 | def bar(b): 85 | for b in range(1): - | ^ PLR1704 + | ^ 86 | print(b) | +error[PLR1704]: 91:13: Redefining argument with the local name `a` -redefined_argument_from_local.py:91:13: PLR1704 Redefining argument with the local name `a` + --> redefined_argument_from_local.py:91:13 | 89 | def func(a=1): 90 | def bar(b=2): 91 | for a in range(1): - | ^ PLR1704 + | ^ 92 | print(a) 93 | for b in range(1): | +error[PLR1704]: 93:13: Redefining argument with the local name `b` -redefined_argument_from_local.py:93:13: PLR1704 Redefining argument with the local name `b` + --> redefined_argument_from_local.py:93:13 | 91 | for a in range(1): 92 | print(a) 93 | for b in range(1): - | ^ PLR1704 + | ^ 94 | print(b) | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1711_useless_return.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1711_useless_return.py.snap index 2fb17778eb..db06c6821f 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1711_useless_return.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1711_useless_return.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLR1711]: useless_return.py:6:5: [*] Useless `return` statement at end of function +error[PLR1711]: 6:5: [*] Useless `return` statement at end of function + --> useless_return.py:6:5 | 4 | def print_python_version(): 5 | print(sys.version) @@ -19,8 +20,9 @@ error[PLR1711]: useless_return.py:6:5: [*] Useless `return` statement at end of 8 7 | 9 8 | def print_python_version(): -error[PLR1711]: useless_return.py:11:5: [*] Useless `return` statement at end of function +error[PLR1711]: 11:5: [*] Useless `return` statement at end of function + --> useless_return.py:11:5 | 9 | def print_python_version(): 10 | print(sys.version) @@ -37,8 +39,9 @@ error[PLR1711]: useless_return.py:11:5: [*] Useless `return` statement at end of 13 12 | 14 13 | def print_python_version(): -error[PLR1711]: useless_return.py:16:5: [*] Useless `return` statement at end of function +error[PLR1711]: 16:5: [*] Useless `return` statement at end of function + --> useless_return.py:16:5 | 14 | def print_python_version(): 15 | print(sys.version) @@ -55,8 +58,9 @@ error[PLR1711]: useless_return.py:16:5: [*] Useless `return` statement at end of 18 17 | 19 18 | class SomeClass: -error[PLR1711]: useless_return.py:22:9: [*] Useless `return` statement at end of function +error[PLR1711]: 22:9: [*] Useless `return` statement at end of function + --> useless_return.py:22:9 | 20 | def print_python_version(self): 21 | print(sys.version) @@ -73,8 +77,9 @@ error[PLR1711]: useless_return.py:22:9: [*] Useless `return` statement at end of 24 23 | 25 24 | def print_python_version(): -error[PLR1711]: useless_return.py:50:5: [*] Useless `return` statement at end of function +error[PLR1711]: 50:5: [*] Useless `return` statement at end of function + --> useless_return.py:50:5 | 48 | """This function returns None.""" 49 | print(sys.version) @@ -91,8 +96,9 @@ error[PLR1711]: useless_return.py:50:5: [*] Useless `return` statement at end of 52 51 | 53 52 | class BaseCache: -error[PLR1711]: useless_return.py:60:9: [*] Useless `return` statement at end of function +error[PLR1711]: 60:9: [*] Useless `return` statement at end of function + --> useless_return.py:60:9 | 58 | def get(self, key: str) -> None: 59 | print(f"{key} not found") diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1714_repeated_equality_comparison.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1714_repeated_equality_comparison.py.snap index 0c02246b06..3fa46abfdc 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1714_repeated_equality_comparison.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1714_repeated_equality_comparison.py.snap @@ -1,16 +1,17 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -repeated_equality_comparison.py:2:1: PLR1714 [*] Consider merging multiple comparisons: `foo in ("a", "b")`. Use a `set` if the elements are hashable. +error[PLR1714]: 2:1: [*] Consider merging multiple comparisons: `foo in ("a", "b")`. Use a `set` if the elements are hashable. + + --> repeated_equality_comparison.py:1:10 | 1 | # Errors. 2 | foo == "a" or foo == "b" - | ^^^^^^^^^^^^^^^^^^^^^^^^ PLR1714 + | ^^^^^^^^^^^^^^^^^^^^^^^^ 3 | 4 | foo != "a" and foo != "b" | = help: Merge multiple comparisons - ℹ Unsafe fix 1 1 | # Errors. 2 |-foo == "a" or foo == "b" @@ -19,17 +20,18 @@ repeated_equality_comparison.py:2:1: PLR1714 [*] Consider merging multiple compa 4 4 | foo != "a" and foo != "b" 5 5 | -repeated_equality_comparison.py:4:1: PLR1714 [*] Consider merging multiple comparisons: `foo not in ("a", "b")`. Use a `set` if the elements are hashable. +error[PLR1714]: 4:1: [*] Consider merging multiple comparisons: `foo not in ("a", "b")`. Use a `set` if the elements are hashable. + + --> repeated_equality_comparison.py:3:1 | 2 | foo == "a" or foo == "b" 3 | 4 | foo != "a" and foo != "b" - | ^^^^^^^^^^^^^^^^^^^^^^^^^ PLR1714 + | ^^^^^^^^^^^^^^^^^^^^^^^^^ 5 | 6 | foo == "a" or foo == "b" or foo == "c" | = help: Merge multiple comparisons - ℹ Unsafe fix 1 1 | # Errors. 2 2 | foo == "a" or foo == "b" @@ -40,17 +42,18 @@ repeated_equality_comparison.py:4:1: PLR1714 [*] Consider merging multiple compa 6 6 | foo == "a" or foo == "b" or foo == "c" 7 7 | -repeated_equality_comparison.py:6:1: PLR1714 [*] Consider merging multiple comparisons: `foo in ("a", "b", "c")`. Use a `set` if the elements are hashable. +error[PLR1714]: 6:1: [*] Consider merging multiple comparisons: `foo in ("a", "b", "c")`. Use a `set` if the elements are hashable. + + --> repeated_equality_comparison.py:5:1 | 4 | foo != "a" and foo != "b" 5 | 6 | foo == "a" or foo == "b" or foo == "c" - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PLR1714 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 7 | 8 | foo != "a" and foo != "b" and foo != "c" | = help: Merge multiple comparisons - ℹ Unsafe fix 3 3 | 4 4 | foo != "a" and foo != "b" @@ -61,17 +64,18 @@ repeated_equality_comparison.py:6:1: PLR1714 [*] Consider merging multiple compa 8 8 | foo != "a" and foo != "b" and foo != "c" 9 9 | -repeated_equality_comparison.py:8:1: PLR1714 [*] Consider merging multiple comparisons: `foo not in ("a", "b", "c")`. Use a `set` if the elements are hashable. +error[PLR1714]: 8:1: [*] Consider merging multiple comparisons: `foo not in ("a", "b", "c")`. Use a `set` if the elements are hashable. + + --> repeated_equality_comparison.py:7:1 | 6 | foo == "a" or foo == "b" or foo == "c" 7 | 8 | foo != "a" and foo != "b" and foo != "c" - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PLR1714 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 9 | 10 | foo == a or foo == "b" or foo == 3 # Mixed types. | = help: Merge multiple comparisons - ℹ Unsafe fix 5 5 | 6 6 | foo == "a" or foo == "b" or foo == "c" @@ -82,17 +86,18 @@ repeated_equality_comparison.py:8:1: PLR1714 [*] Consider merging multiple compa 10 10 | foo == a or foo == "b" or foo == 3 # Mixed types. 11 11 | -repeated_equality_comparison.py:10:1: PLR1714 [*] Consider merging multiple comparisons: `foo in (a, "b", 3)`. Use a `set` if the elements are hashable. +error[PLR1714]: 10:1: [*] Consider merging multiple comparisons: `foo in (a, "b", 3)`. Use a `set` if the elements are hashable. + + --> repeated_equality_comparison.py:9:1 | 8 | foo != "a" and foo != "b" and foo != "c" 9 | 10 | foo == a or foo == "b" or foo == 3 # Mixed types. - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PLR1714 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 11 | 12 | "a" == foo or "b" == foo or "c" == foo | = help: Merge multiple comparisons - ℹ Unsafe fix 7 7 | 8 8 | foo != "a" and foo != "b" and foo != "c" @@ -103,17 +108,18 @@ repeated_equality_comparison.py:10:1: PLR1714 [*] Consider merging multiple comp 12 12 | "a" == foo or "b" == foo or "c" == foo 13 13 | -repeated_equality_comparison.py:12:1: PLR1714 [*] Consider merging multiple comparisons: `foo in ("a", "b", "c")`. Use a `set` if the elements are hashable. +error[PLR1714]: 12:1: [*] Consider merging multiple comparisons: `foo in ("a", "b", "c")`. Use a `set` if the elements are hashable. + + --> repeated_equality_comparison.py:11:1 | 10 | foo == a or foo == "b" or foo == 3 # Mixed types. 11 | 12 | "a" == foo or "b" == foo or "c" == foo - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PLR1714 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 13 | 14 | "a" != foo and "b" != foo and "c" != foo | = help: Merge multiple comparisons - ℹ Unsafe fix 9 9 | 10 10 | foo == a or foo == "b" or foo == 3 # Mixed types. @@ -124,17 +130,18 @@ repeated_equality_comparison.py:12:1: PLR1714 [*] Consider merging multiple comp 14 14 | "a" != foo and "b" != foo and "c" != foo 15 15 | -repeated_equality_comparison.py:14:1: PLR1714 [*] Consider merging multiple comparisons: `foo not in ("a", "b", "c")`. Use a `set` if the elements are hashable. +error[PLR1714]: 14:1: [*] Consider merging multiple comparisons: `foo not in ("a", "b", "c")`. Use a `set` if the elements are hashable. + + --> repeated_equality_comparison.py:13:1 | 12 | "a" == foo or "b" == foo or "c" == foo 13 | 14 | "a" != foo and "b" != foo and "c" != foo - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PLR1714 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 15 | 16 | "a" == foo or foo == "b" or "c" == foo | = help: Merge multiple comparisons - ℹ Unsafe fix 11 11 | 12 12 | "a" == foo or "b" == foo or "c" == foo @@ -145,17 +152,18 @@ repeated_equality_comparison.py:14:1: PLR1714 [*] Consider merging multiple comp 16 16 | "a" == foo or foo == "b" or "c" == foo 17 17 | -repeated_equality_comparison.py:16:1: PLR1714 [*] Consider merging multiple comparisons: `foo in ("a", "b", "c")`. Use a `set` if the elements are hashable. +error[PLR1714]: 16:1: [*] Consider merging multiple comparisons: `foo in ("a", "b", "c")`. Use a `set` if the elements are hashable. + + --> repeated_equality_comparison.py:15:1 | 14 | "a" != foo and "b" != foo and "c" != foo 15 | 16 | "a" == foo or foo == "b" or "c" == foo - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PLR1714 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 17 | 18 | foo == bar or baz == foo or qux == foo | = help: Merge multiple comparisons - ℹ Unsafe fix 13 13 | 14 14 | "a" != foo and "b" != foo and "c" != foo @@ -166,17 +174,18 @@ repeated_equality_comparison.py:16:1: PLR1714 [*] Consider merging multiple comp 18 18 | foo == bar or baz == foo or qux == foo 19 19 | -repeated_equality_comparison.py:18:1: PLR1714 [*] Consider merging multiple comparisons: `foo in (bar, baz, qux)`. Use a `set` if the elements are hashable. +error[PLR1714]: 18:1: [*] Consider merging multiple comparisons: `foo in (bar, baz, qux)`. Use a `set` if the elements are hashable. + + --> repeated_equality_comparison.py:17:1 | 16 | "a" == foo or foo == "b" or "c" == foo 17 | 18 | foo == bar or baz == foo or qux == foo - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PLR1714 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 19 | 20 | foo == "a" or "b" == foo or foo == "c" | = help: Merge multiple comparisons - ℹ Unsafe fix 15 15 | 16 16 | "a" == foo or foo == "b" or "c" == foo @@ -187,17 +196,18 @@ repeated_equality_comparison.py:18:1: PLR1714 [*] Consider merging multiple comp 20 20 | foo == "a" or "b" == foo or foo == "c" 21 21 | -repeated_equality_comparison.py:20:1: PLR1714 [*] Consider merging multiple comparisons: `foo in ("a", "b", "c")`. Use a `set` if the elements are hashable. +error[PLR1714]: 20:1: [*] Consider merging multiple comparisons: `foo in ("a", "b", "c")`. Use a `set` if the elements are hashable. + + --> repeated_equality_comparison.py:19:1 | 18 | foo == bar or baz == foo or qux == foo 19 | 20 | foo == "a" or "b" == foo or foo == "c" - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PLR1714 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 21 | 22 | foo != "a" and "b" != foo and foo != "c" | = help: Merge multiple comparisons - ℹ Unsafe fix 17 17 | 18 18 | foo == bar or baz == foo or qux == foo @@ -208,17 +218,18 @@ repeated_equality_comparison.py:20:1: PLR1714 [*] Consider merging multiple comp 22 22 | foo != "a" and "b" != foo and foo != "c" 23 23 | -repeated_equality_comparison.py:22:1: PLR1714 [*] Consider merging multiple comparisons: `foo not in ("a", "b", "c")`. Use a `set` if the elements are hashable. +error[PLR1714]: 22:1: [*] Consider merging multiple comparisons: `foo not in ("a", "b", "c")`. Use a `set` if the elements are hashable. + + --> repeated_equality_comparison.py:21:1 | 20 | foo == "a" or "b" == foo or foo == "c" 21 | 22 | foo != "a" and "b" != foo and foo != "c" - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PLR1714 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 23 | 24 | foo == "a" or foo == "b" or "c" == bar or "d" == bar # Multiple targets | = help: Merge multiple comparisons - ℹ Unsafe fix 19 19 | 20 20 | foo == "a" or "b" == foo or foo == "c" @@ -229,17 +240,18 @@ repeated_equality_comparison.py:22:1: PLR1714 [*] Consider merging multiple comp 24 24 | foo == "a" or foo == "b" or "c" == bar or "d" == bar # Multiple targets 25 25 | -repeated_equality_comparison.py:24:1: PLR1714 [*] Consider merging multiple comparisons: `foo in ("a", "b")`. Use a `set` if the elements are hashable. +error[PLR1714]: 24:1: [*] Consider merging multiple comparisons: `foo in ("a", "b")`. Use a `set` if the elements are hashable. + + --> repeated_equality_comparison.py:23:1 | 22 | foo != "a" and "b" != foo and foo != "c" 23 | 24 | foo == "a" or foo == "b" or "c" == bar or "d" == bar # Multiple targets - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PLR1714 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 25 | 26 | foo.bar == "a" or foo.bar == "b" # Attributes. | = help: Merge multiple comparisons - ℹ Unsafe fix 21 21 | 22 22 | foo != "a" and "b" != foo and foo != "c" @@ -250,17 +262,18 @@ repeated_equality_comparison.py:24:1: PLR1714 [*] Consider merging multiple comp 26 26 | foo.bar == "a" or foo.bar == "b" # Attributes. 27 27 | -repeated_equality_comparison.py:24:1: PLR1714 [*] Consider merging multiple comparisons: `bar in ("c", "d")`. Use a `set` if the elements are hashable. +error[PLR1714]: 24:1: [*] Consider merging multiple comparisons: `bar in ("c", "d")`. Use a `set` if the elements are hashable. + + --> repeated_equality_comparison.py:23:1 | 22 | foo != "a" and "b" != foo and foo != "c" 23 | 24 | foo == "a" or foo == "b" or "c" == bar or "d" == bar # Multiple targets - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PLR1714 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 25 | 26 | foo.bar == "a" or foo.bar == "b" # Attributes. | = help: Merge multiple comparisons - ℹ Unsafe fix 21 21 | 22 22 | foo != "a" and "b" != foo and foo != "c" @@ -271,17 +284,18 @@ repeated_equality_comparison.py:24:1: PLR1714 [*] Consider merging multiple comp 26 26 | foo.bar == "a" or foo.bar == "b" # Attributes. 27 27 | -repeated_equality_comparison.py:26:1: PLR1714 [*] Consider merging multiple comparisons: `foo.bar in ("a", "b")`. Use a `set` if the elements are hashable. +error[PLR1714]: 26:1: [*] Consider merging multiple comparisons: `foo.bar in ("a", "b")`. Use a `set` if the elements are hashable. + + --> repeated_equality_comparison.py:25:1 | 24 | foo == "a" or foo == "b" or "c" == bar or "d" == bar # Multiple targets 25 | 26 | foo.bar == "a" or foo.bar == "b" # Attributes. - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PLR1714 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 27 | 28 | # OK | = help: Merge multiple comparisons - ℹ Unsafe fix 23 23 | 24 24 | foo == "a" or foo == "b" or "c" == bar or "d" == bar # Multiple targets @@ -292,17 +306,18 @@ repeated_equality_comparison.py:26:1: PLR1714 [*] Consider merging multiple comp 28 28 | # OK 29 29 | foo == "a" and foo == "b" and foo == "c" # `and` mixed with `==`. -repeated_equality_comparison.py:61:16: PLR1714 [*] Consider merging multiple comparisons: `bar in ("c", "d")`. Use a `set` if the elements are hashable. +error[PLR1714]: 61:16: [*] Consider merging multiple comparisons: `bar in ("c", "d")`. Use a `set` if the elements are hashable. + + --> repeated_equality_comparison.py:61:16 | 59 | foo == "a" or "c" == bar or foo == "b" or "d" == bar # Multiple targets 60 | 61 | foo == "a" or ("c" == bar or "d" == bar) or foo == "b" # Multiple targets - | ^^^^^^^^^^^^^^^^^^^^^^^^ PLR1714 + | ^^^^^^^^^^^^^^^^^^^^^^^^ 62 | 63 | foo == "a" or foo == "b" or "c" != bar and "d" != bar # Multiple targets | = help: Merge multiple comparisons - ℹ Unsafe fix 58 58 | 59 59 | foo == "a" or "c" == bar or foo == "b" or "d" == bar # Multiple targets @@ -313,17 +328,18 @@ repeated_equality_comparison.py:61:16: PLR1714 [*] Consider merging multiple com 63 63 | foo == "a" or foo == "b" or "c" != bar and "d" != bar # Multiple targets 64 64 | -repeated_equality_comparison.py:63:1: PLR1714 [*] Consider merging multiple comparisons: `foo in ("a", "b")`. Use a `set` if the elements are hashable. +error[PLR1714]: 63:1: [*] Consider merging multiple comparisons: `foo in ("a", "b")`. Use a `set` if the elements are hashable. + + --> repeated_equality_comparison.py:62:1 | 61 | foo == "a" or ("c" == bar or "d" == bar) or foo == "b" # Multiple targets 62 | 63 | foo == "a" or foo == "b" or "c" != bar and "d" != bar # Multiple targets - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PLR1714 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 64 | 65 | foo == "a" or ("c" != bar and "d" != bar) or foo == "b" # Multiple targets | = help: Merge multiple comparisons - ℹ Unsafe fix 60 60 | 61 61 | foo == "a" or ("c" == bar or "d" == bar) or foo == "b" # Multiple targets @@ -334,17 +350,18 @@ repeated_equality_comparison.py:63:1: PLR1714 [*] Consider merging multiple comp 65 65 | foo == "a" or ("c" != bar and "d" != bar) or foo == "b" # Multiple targets 66 66 | -repeated_equality_comparison.py:63:29: PLR1714 [*] Consider merging multiple comparisons: `bar not in ("c", "d")`. Use a `set` if the elements are hashable. +error[PLR1714]: 63:29: [*] Consider merging multiple comparisons: `bar not in ("c", "d")`. Use a `set` if the elements are hashable. + + --> repeated_equality_comparison.py:63:29 | 61 | foo == "a" or ("c" == bar or "d" == bar) or foo == "b" # Multiple targets 62 | 63 | foo == "a" or foo == "b" or "c" != bar and "d" != bar # Multiple targets - | ^^^^^^^^^^^^^^^^^^^^^^^^^ PLR1714 + | ^^^^^^^^^^^^^^^^^^^^^^^^^ 64 | 65 | foo == "a" or ("c" != bar and "d" != bar) or foo == "b" # Multiple targets | = help: Merge multiple comparisons - ℹ Unsafe fix 60 60 | 61 61 | foo == "a" or ("c" == bar or "d" == bar) or foo == "b" # Multiple targets @@ -355,17 +372,18 @@ repeated_equality_comparison.py:63:29: PLR1714 [*] Consider merging multiple com 65 65 | foo == "a" or ("c" != bar and "d" != bar) or foo == "b" # Multiple targets 66 66 | -repeated_equality_comparison.py:65:16: PLR1714 [*] Consider merging multiple comparisons: `bar not in ("c", "d")`. Use a `set` if the elements are hashable. +error[PLR1714]: 65:16: [*] Consider merging multiple comparisons: `bar not in ("c", "d")`. Use a `set` if the elements are hashable. + + --> repeated_equality_comparison.py:65:16 | 63 | foo == "a" or foo == "b" or "c" != bar and "d" != bar # Multiple targets 64 | 65 | foo == "a" or ("c" != bar and "d" != bar) or foo == "b" # Multiple targets - | ^^^^^^^^^^^^^^^^^^^^^^^^^ PLR1714 + | ^^^^^^^^^^^^^^^^^^^^^^^^^ 66 | 67 | foo == "a" and "c" != bar or foo == "b" and "d" != bar # Multiple targets | = help: Merge multiple comparisons - ℹ Unsafe fix 62 62 | 63 63 | foo == "a" or foo == "b" or "c" != bar and "d" != bar # Multiple targets diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_0.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_0.py.snap index 8685401a6b..f1956f4d8e 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_0.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_0.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLR1722]: sys_exit_alias_0.py:1:1: [*] Use `sys.exit()` instead of `exit` +error[PLR1722]: 1:1: [*] Use `sys.exit()` instead of `exit` + --> sys_exit_alias_0.py:1:1 | 1 | exit(0) | ^^^^ @@ -17,8 +18,9 @@ error[PLR1722]: sys_exit_alias_0.py:1:1: [*] Use `sys.exit()` instead of `exit` 3 4 | 4 5 | -error[PLR1722]: sys_exit_alias_0.py:2:1: [*] Use `sys.exit()` instead of `quit` +error[PLR1722]: 2:1: [*] Use `sys.exit()` instead of `quit` + --> sys_exit_alias_0.py:1:8 | 1 | exit(0) 2 | quit(0) @@ -34,8 +36,9 @@ error[PLR1722]: sys_exit_alias_0.py:2:1: [*] Use `sys.exit()` instead of `quit` 4 5 | 5 6 | def main(): -error[PLR1722]: sys_exit_alias_0.py:6:5: [*] Use `sys.exit()` instead of `exit` +error[PLR1722]: 6:5: [*] Use `sys.exit()` instead of `exit` + --> sys_exit_alias_0.py:6:5 | 5 | def main(): 6 | exit(2) @@ -54,8 +57,9 @@ error[PLR1722]: sys_exit_alias_0.py:6:5: [*] Use `sys.exit()` instead of `exit` 7 |+ sys.exit(2) 7 8 | quit(2) -error[PLR1722]: sys_exit_alias_0.py:7:5: [*] Use `sys.exit()` instead of `quit` +error[PLR1722]: 7:5: [*] Use `sys.exit()` instead of `quit` + --> sys_exit_alias_0.py:7:5 | 5 | def main(): 6 | exit(2) diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_1.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_1.py.snap index 48cff01d7c..8e8b066465 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_1.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_1.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLR1722]: sys_exit_alias_1.py:3:1: [*] Use `sys.exit()` instead of `exit` +error[PLR1722]: 3:1: [*] Use `sys.exit()` instead of `exit` + --> sys_exit_alias_1.py:2:1 | 1 | import sys 2 | @@ -20,8 +21,9 @@ error[PLR1722]: sys_exit_alias_1.py:3:1: [*] Use `sys.exit()` instead of `exit` 5 5 | 6 6 | -error[PLR1722]: sys_exit_alias_1.py:4:1: [*] Use `sys.exit()` instead of `quit` +error[PLR1722]: 4:1: [*] Use `sys.exit()` instead of `quit` + --> sys_exit_alias_1.py:3:8 | 3 | exit(0) 4 | quit(0) @@ -38,8 +40,9 @@ error[PLR1722]: sys_exit_alias_1.py:4:1: [*] Use `sys.exit()` instead of `quit` 6 6 | 7 7 | def main(): -error[PLR1722]: sys_exit_alias_1.py:8:5: [*] Use `sys.exit()` instead of `exit` +error[PLR1722]: 8:5: [*] Use `sys.exit()` instead of `exit` + --> sys_exit_alias_1.py:8:5 | 7 | def main(): 8 | exit(1) @@ -57,8 +60,9 @@ error[PLR1722]: sys_exit_alias_1.py:8:5: [*] Use `sys.exit()` instead of `exit` 10 10 | 11 11 | -error[PLR1722]: sys_exit_alias_1.py:9:5: [*] Use `sys.exit()` instead of `quit` +error[PLR1722]: 9:5: [*] Use `sys.exit()` instead of `quit` + --> sys_exit_alias_1.py:9:5 | 7 | def main(): 8 | exit(1) @@ -76,8 +80,9 @@ error[PLR1722]: sys_exit_alias_1.py:9:5: [*] Use `sys.exit()` instead of `quit` 11 11 | 12 12 | def main(): -error[PLR1722]: sys_exit_alias_1.py:15:5: Use `sys.exit()` instead of `exit` +error[PLR1722]: 15:5: Use `sys.exit()` instead of `exit` + --> sys_exit_alias_1.py:15:5 | 13 | sys = 1 14 | @@ -86,8 +91,9 @@ error[PLR1722]: sys_exit_alias_1.py:15:5: Use `sys.exit()` instead of `exit` 16 | quit(1) | = help: Replace `exit` with `sys.exit()` -error[PLR1722]: sys_exit_alias_1.py:16:5: Use `sys.exit()` instead of `quit` +error[PLR1722]: 16:5: Use `sys.exit()` instead of `quit` + --> sys_exit_alias_1.py:16:5 | 15 | exit(1) 16 | quit(1) diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_10.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_10.py.snap index 4444dc3b16..16408b44e2 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_10.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_10.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLR1722]: sys_exit_alias_10.py:8:5: Use `sys.exit()` instead of `exit` +error[PLR1722]: 8:5: Use `sys.exit()` instead of `exit` + --> sys_exit_alias_10.py:8:5 | 7 | def main(): 8 | exit(0) diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_11.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_11.py.snap index 98fb8093e9..4a060b3450 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_11.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_11.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLR1722]: sys_exit_alias_11.py:3:1: [*] Use `sys.exit()` instead of `exit` +error[PLR1722]: 3:1: [*] Use `sys.exit()` instead of `exit` + --> sys_exit_alias_11.py:2:1 | 1 | from sys import * 2 | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_12.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_12.py.snap index 6f8e10c8a4..8603d47e2a 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_12.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_12.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLR1722]: sys_exit_alias_12.py:3:1: [*] Use `sys.exit()` instead of `exit` +error[PLR1722]: 3:1: [*] Use `sys.exit()` instead of `exit` + --> sys_exit_alias_12.py:2:1 | 1 | import os \ 2 | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_2.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_2.py.snap index 190a7e5608..5832cec36e 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_2.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_2.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLR1722]: sys_exit_alias_2.py:3:1: [*] Use `sys.exit()` instead of `exit` +error[PLR1722]: 3:1: [*] Use `sys.exit()` instead of `exit` + --> sys_exit_alias_2.py:2:1 | 1 | import sys as sys2 2 | @@ -20,8 +21,9 @@ error[PLR1722]: sys_exit_alias_2.py:3:1: [*] Use `sys.exit()` instead of `exit` 5 5 | 6 6 | -error[PLR1722]: sys_exit_alias_2.py:4:1: [*] Use `sys.exit()` instead of `quit` +error[PLR1722]: 4:1: [*] Use `sys.exit()` instead of `quit` + --> sys_exit_alias_2.py:3:8 | 3 | exit(0) 4 | quit(0) @@ -38,8 +40,9 @@ error[PLR1722]: sys_exit_alias_2.py:4:1: [*] Use `sys.exit()` instead of `quit` 6 6 | 7 7 | def main(): -error[PLR1722]: sys_exit_alias_2.py:8:5: [*] Use `sys.exit()` instead of `exit` +error[PLR1722]: 8:5: [*] Use `sys.exit()` instead of `exit` + --> sys_exit_alias_2.py:8:5 | 7 | def main(): 8 | exit(1) @@ -55,8 +58,9 @@ error[PLR1722]: sys_exit_alias_2.py:8:5: [*] Use `sys.exit()` instead of `exit` 8 |+ sys2.exit(1) 9 9 | quit(1) -error[PLR1722]: sys_exit_alias_2.py:9:5: [*] Use `sys.exit()` instead of `quit` +error[PLR1722]: 9:5: [*] Use `sys.exit()` instead of `quit` + --> sys_exit_alias_2.py:9:5 | 7 | def main(): 8 | exit(1) diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_3.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_3.py.snap index 8d56a76e77..c02e1194b6 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_3.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_3.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLR1722]: sys_exit_alias_3.py:4:1: [*] Use `sys.exit()` instead of `quit` +error[PLR1722]: 4:1: [*] Use `sys.exit()` instead of `quit` + --> sys_exit_alias_3.py:3:8 | 3 | exit(0) 4 | quit(0) @@ -19,8 +20,9 @@ error[PLR1722]: sys_exit_alias_3.py:4:1: [*] Use `sys.exit()` instead of `quit` 6 6 | 7 7 | def main(): -error[PLR1722]: sys_exit_alias_3.py:9:5: [*] Use `sys.exit()` instead of `quit` +error[PLR1722]: 9:5: [*] Use `sys.exit()` instead of `quit` + --> sys_exit_alias_3.py:9:5 | 7 | def main(): 8 | exit(1) @@ -38,8 +40,9 @@ error[PLR1722]: sys_exit_alias_3.py:9:5: [*] Use `sys.exit()` instead of `quit` 11 11 | 12 12 | def main(): -error[PLR1722]: sys_exit_alias_3.py:16:5: Use `sys.exit()` instead of `quit` +error[PLR1722]: 16:5: Use `sys.exit()` instead of `quit` + --> sys_exit_alias_3.py:16:5 | 15 | exit(1) 16 | quit(1) diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_4.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_4.py.snap index 42ac33098a..af36b62a0d 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_4.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_4.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLR1722]: sys_exit_alias_4.py:3:1: [*] Use `sys.exit()` instead of `exit` +error[PLR1722]: 3:1: [*] Use `sys.exit()` instead of `exit` + --> sys_exit_alias_4.py:2:1 | 1 | from sys import exit as exit2 2 | @@ -20,8 +21,9 @@ error[PLR1722]: sys_exit_alias_4.py:3:1: [*] Use `sys.exit()` instead of `exit` 5 5 | 6 6 | -error[PLR1722]: sys_exit_alias_4.py:4:1: [*] Use `sys.exit()` instead of `quit` +error[PLR1722]: 4:1: [*] Use `sys.exit()` instead of `quit` + --> sys_exit_alias_4.py:3:8 | 3 | exit(0) 4 | quit(0) @@ -38,8 +40,9 @@ error[PLR1722]: sys_exit_alias_4.py:4:1: [*] Use `sys.exit()` instead of `quit` 6 6 | 7 7 | def main(): -error[PLR1722]: sys_exit_alias_4.py:8:5: [*] Use `sys.exit()` instead of `exit` +error[PLR1722]: 8:5: [*] Use `sys.exit()` instead of `exit` + --> sys_exit_alias_4.py:8:5 | 7 | def main(): 8 | exit(1) @@ -55,8 +58,9 @@ error[PLR1722]: sys_exit_alias_4.py:8:5: [*] Use `sys.exit()` instead of `exit` 8 |+ exit2(1) 9 9 | quit(1) -error[PLR1722]: sys_exit_alias_4.py:9:5: [*] Use `sys.exit()` instead of `quit` +error[PLR1722]: 9:5: [*] Use `sys.exit()` instead of `quit` + --> sys_exit_alias_4.py:9:5 | 7 | def main(): 8 | exit(1) diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_5.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_5.py.snap index beb4e19bd6..09db364425 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_5.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_5.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLR1722]: sys_exit_alias_5.py:3:1: [*] Use `sys.exit()` instead of `exit` +error[PLR1722]: 3:1: [*] Use `sys.exit()` instead of `exit` + --> sys_exit_alias_5.py:2:1 | 1 | from sys import * 2 | @@ -21,8 +22,9 @@ error[PLR1722]: sys_exit_alias_5.py:3:1: [*] Use `sys.exit()` instead of `exit` 5 6 | 6 7 | -error[PLR1722]: sys_exit_alias_5.py:4:1: [*] Use `sys.exit()` instead of `quit` +error[PLR1722]: 4:1: [*] Use `sys.exit()` instead of `quit` + --> sys_exit_alias_5.py:3:8 | 3 | exit(0) 4 | quit(0) @@ -40,8 +42,9 @@ error[PLR1722]: sys_exit_alias_5.py:4:1: [*] Use `sys.exit()` instead of `quit` 6 7 | 7 8 | def main(): -error[PLR1722]: sys_exit_alias_5.py:8:5: [*] Use `sys.exit()` instead of `exit` +error[PLR1722]: 8:5: [*] Use `sys.exit()` instead of `exit` + --> sys_exit_alias_5.py:8:5 | 7 | def main(): 8 | exit(1) @@ -62,8 +65,9 @@ error[PLR1722]: sys_exit_alias_5.py:8:5: [*] Use `sys.exit()` instead of `exit` 9 |+ sys.exit(1) 9 10 | quit(1) -error[PLR1722]: sys_exit_alias_5.py:9:5: [*] Use `sys.exit()` instead of `quit` +error[PLR1722]: 9:5: [*] Use `sys.exit()` instead of `quit` + --> sys_exit_alias_5.py:9:5 | 7 | def main(): 8 | exit(1) diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_6.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_6.py.snap index a4ffc0c398..f601075f20 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_6.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_6.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLR1722]: sys_exit_alias_6.py:1:1: [*] Use `sys.exit()` instead of `exit` +error[PLR1722]: 1:1: [*] Use `sys.exit()` instead of `exit` + --> sys_exit_alias_6.py:1:1 | 1 | exit(0) | ^^^^ @@ -17,8 +18,9 @@ error[PLR1722]: sys_exit_alias_6.py:1:1: [*] Use `sys.exit()` instead of `exit` 3 4 | 4 5 | -error[PLR1722]: sys_exit_alias_6.py:2:1: [*] Use `sys.exit()` instead of `quit` +error[PLR1722]: 2:1: [*] Use `sys.exit()` instead of `quit` + --> sys_exit_alias_6.py:1:8 | 1 | exit(0) 2 | quit(0) diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_7.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_7.py.snap index 784eb78be9..dc414bd932 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_7.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_7.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLR1722]: sys_exit_alias_7.py:2:5: [*] Use `sys.exit()` instead of `exit` +error[PLR1722]: 2:5: [*] Use `sys.exit()` instead of `exit` + --> sys_exit_alias_7.py:2:5 | 1 | def main(): 2 | exit(0) diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_8.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_8.py.snap index 45c08c3abf..713a7afb26 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_8.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_8.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLR1722]: sys_exit_alias_8.py:5:5: [*] Use `sys.exit()` instead of `exit` +error[PLR1722]: 5:5: [*] Use `sys.exit()` instead of `exit` + --> sys_exit_alias_8.py:5:5 | 4 | def main(): 5 | exit(0) diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_9.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_9.py.snap index 2f42a659ea..3ecc765ad4 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_9.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_9.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLR1722]: sys_exit_alias_9.py:2:5: [*] Use `sys.exit()` instead of `exit` +error[PLR1722]: 2:5: [*] Use `sys.exit()` instead of `exit` + --> sys_exit_alias_9.py:2:5 | 1 | def main(): 2 | exit(0) diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1730_if_stmt_min_max.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1730_if_stmt_min_max.py.snap index 4aa451f23e..b10fbfc1bf 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1730_if_stmt_min_max.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1730_if_stmt_min_max.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLR1730]: if_stmt_min_max.py:8:1: [*] Replace `if` statement with `value = max(value, 10)` +error[PLR1730]: 8:1: [*] Replace `if` statement with `value = max(value, 10)` + --> if_stmt_min_max.py:7:11 | 7 | # Positive 8 | / if value < 10: # [max-instead-of-if] @@ -23,8 +24,9 @@ error[PLR1730]: if_stmt_min_max.py:8:1: [*] Replace `if` statement with `value = 11 10 | if value <= 10: # [max-instead-of-if] 12 11 | value = 10 -error[PLR1730]: if_stmt_min_max.py:11:1: [*] Replace `if` statement with `value = max(10, value)` +error[PLR1730]: 11:1: [*] Replace `if` statement with `value = max(10, value)` + --> if_stmt_min_max.py:10:1 | 9 | value = 10 10 | @@ -46,8 +48,9 @@ error[PLR1730]: if_stmt_min_max.py:11:1: [*] Replace `if` statement with `value 14 13 | if value < value2: # [max-instead-of-if] 15 14 | value = value2 -error[PLR1730]: if_stmt_min_max.py:14:1: [*] Replace `if` statement with `value = max(value, value2)` +error[PLR1730]: 14:1: [*] Replace `if` statement with `value = max(value, value2)` + --> if_stmt_min_max.py:13:1 | 12 | value = 10 13 | @@ -69,8 +72,9 @@ error[PLR1730]: if_stmt_min_max.py:14:1: [*] Replace `if` statement with `value 17 16 | if value > 10: # [min-instead-of-if] 18 17 | value = 10 -error[PLR1730]: if_stmt_min_max.py:17:1: [*] Replace `if` statement with `value = min(value, 10)` +error[PLR1730]: 17:1: [*] Replace `if` statement with `value = min(value, 10)` + --> if_stmt_min_max.py:16:1 | 15 | value = value2 16 | @@ -92,8 +96,9 @@ error[PLR1730]: if_stmt_min_max.py:17:1: [*] Replace `if` statement with `value 20 19 | if value >= 10: # [min-instead-of-if] 21 20 | value = 10 -error[PLR1730]: if_stmt_min_max.py:20:1: [*] Replace `if` statement with `value = min(10, value)` +error[PLR1730]: 20:1: [*] Replace `if` statement with `value = min(10, value)` + --> if_stmt_min_max.py:19:1 | 18 | value = 10 19 | @@ -115,8 +120,9 @@ error[PLR1730]: if_stmt_min_max.py:20:1: [*] Replace `if` statement with `value 23 22 | if value > value2: # [min-instead-of-if] 24 23 | value = value2 -error[PLR1730]: if_stmt_min_max.py:23:1: [*] Replace `if` statement with `value = min(value, value2)` +error[PLR1730]: 23:1: [*] Replace `if` statement with `value = min(value, value2)` + --> if_stmt_min_max.py:22:1 | 21 | value = 10 22 | @@ -136,8 +142,9 @@ error[PLR1730]: if_stmt_min_max.py:23:1: [*] Replace `if` statement with `value 26 25 | 27 26 | class A: -error[PLR1730]: if_stmt_min_max.py:33:1: [*] Replace `if` statement with `A1.value = max(A1.value, 10)` +error[PLR1730]: 33:1: [*] Replace `if` statement with `A1.value = max(A1.value, 10)` + --> if_stmt_min_max.py:32:9 | 32 | A1 = A() 33 | / if A1.value < 10: # [max-instead-of-if] @@ -158,8 +165,9 @@ error[PLR1730]: if_stmt_min_max.py:33:1: [*] Replace `if` statement with `A1.val 36 35 | if A1.value > 10: # [min-instead-of-if] 37 36 | A1.value = 10 -error[PLR1730]: if_stmt_min_max.py:36:1: [*] Replace `if` statement with `A1.value = min(A1.value, 10)` +error[PLR1730]: 36:1: [*] Replace `if` statement with `A1.value = min(A1.value, 10)` + --> if_stmt_min_max.py:35:1 | 34 | A1.value = 10 35 | @@ -179,8 +187,9 @@ error[PLR1730]: if_stmt_min_max.py:36:1: [*] Replace `if` statement with `A1.val 39 38 | 40 39 | class AA: -error[PLR1730]: if_stmt_min_max.py:60:1: [*] Replace `if` statement with `A2 = max(A2, A1)` +error[PLR1730]: 60:1: [*] Replace `if` statement with `A2 = max(A2, A1)` + --> if_stmt_min_max.py:59:1 | 58 | A2 = AA(3) 59 | @@ -202,8 +211,9 @@ error[PLR1730]: if_stmt_min_max.py:60:1: [*] Replace `if` statement with `A2 = m 63 62 | if A2 <= A1: # [max-instead-of-if] 64 63 | A2 = A1 -error[PLR1730]: if_stmt_min_max.py:63:1: [*] Replace `if` statement with `A2 = max(A1, A2)` +error[PLR1730]: 63:1: [*] Replace `if` statement with `A2 = max(A1, A2)` + --> if_stmt_min_max.py:62:1 | 61 | A2 = A1 62 | @@ -225,8 +235,9 @@ error[PLR1730]: if_stmt_min_max.py:63:1: [*] Replace `if` statement with `A2 = m 66 65 | if A2 > A1: # [min-instead-of-if] 67 66 | A2 = A1 -error[PLR1730]: if_stmt_min_max.py:66:1: [*] Replace `if` statement with `A2 = min(A2, A1)` +error[PLR1730]: 66:1: [*] Replace `if` statement with `A2 = min(A2, A1)` + --> if_stmt_min_max.py:65:1 | 64 | A2 = A1 65 | @@ -248,8 +259,9 @@ error[PLR1730]: if_stmt_min_max.py:66:1: [*] Replace `if` statement with `A2 = m 69 68 | if A2 >= A1: # [min-instead-of-if] 70 69 | A2 = A1 -error[PLR1730]: if_stmt_min_max.py:69:1: [*] Replace `if` statement with `A2 = min(A1, A2)` +error[PLR1730]: 69:1: [*] Replace `if` statement with `A2 = min(A1, A2)` + --> if_stmt_min_max.py:68:1 | 67 | A2 = A1 68 | @@ -271,8 +283,9 @@ error[PLR1730]: if_stmt_min_max.py:69:1: [*] Replace `if` statement with `A2 = m 72 71 | # Negative 73 72 | if value < 10: -error[PLR1730]: if_stmt_min_max.py:132:1: [*] Replace `if` statement with `min` call +error[PLR1730]: 132:1: [*] Replace `if` statement with `min` call + --> if_stmt_min_max.py:131:28 | 131 | # Parenthesized expressions 132 | / if value.attr > 3: @@ -300,8 +313,9 @@ error[PLR1730]: if_stmt_min_max.py:132:1: [*] Replace `if` statement with `min` 138 137 | class Foo: 139 138 | _min = 0 -error[PLR1730]: if_stmt_min_max.py:143:9: [*] Replace `if` statement with `self._min = min(value, self._min)` +error[PLR1730]: 143:9: [*] Replace `if` statement with `self._min = min(value, self._min)` + --> if_stmt_min_max.py:143:9 | 142 | def foo(self, value) -> None: 143 | if value < self._min: @@ -323,8 +337,9 @@ error[PLR1730]: if_stmt_min_max.py:143:9: [*] Replace `if` statement with `self. 146 145 | self._max = value 147 146 | -error[PLR1730]: if_stmt_min_max.py:145:9: [*] Replace `if` statement with `self._max = max(value, self._max)` +error[PLR1730]: 145:9: [*] Replace `if` statement with `self._max = max(value, self._max)` + --> if_stmt_min_max.py:145:9 | 143 | if value < self._min: 144 | self._min = value @@ -347,8 +362,9 @@ error[PLR1730]: if_stmt_min_max.py:145:9: [*] Replace `if` statement with `self. 148 147 | if self._min < value: 149 148 | self._min = value -error[PLR1730]: if_stmt_min_max.py:148:9: [*] Replace `if` statement with `self._min = max(self._min, value)` +error[PLR1730]: 148:9: [*] Replace `if` statement with `self._min = max(self._min, value)` + --> if_stmt_min_max.py:148:9 | 146 | self._max = value 147 | @@ -371,8 +387,9 @@ error[PLR1730]: if_stmt_min_max.py:148:9: [*] Replace `if` statement with `self. 151 150 | self._max = value 152 151 | -error[PLR1730]: if_stmt_min_max.py:150:9: [*] Replace `if` statement with `self._max = min(self._max, value)` +error[PLR1730]: 150:9: [*] Replace `if` statement with `self._max = min(self._max, value)` + --> if_stmt_min_max.py:150:9 | 148 | if self._min < value: 149 | self._min = value @@ -395,8 +412,9 @@ error[PLR1730]: if_stmt_min_max.py:150:9: [*] Replace `if` statement with `self. 153 152 | if value <= self._min: 154 153 | self._min = value -error[PLR1730]: if_stmt_min_max.py:153:9: [*] Replace `if` statement with `self._min = min(self._min, value)` +error[PLR1730]: 153:9: [*] Replace `if` statement with `self._min = min(self._min, value)` + --> if_stmt_min_max.py:153:9 | 151 | self._max = value 152 | @@ -419,8 +437,9 @@ error[PLR1730]: if_stmt_min_max.py:153:9: [*] Replace `if` statement with `self. 156 155 | self._max = value 157 156 | -error[PLR1730]: if_stmt_min_max.py:155:9: [*] Replace `if` statement with `self._max = max(self._max, value)` +error[PLR1730]: 155:9: [*] Replace `if` statement with `self._max = max(self._max, value)` + --> if_stmt_min_max.py:155:9 | 153 | if value <= self._min: 154 | self._min = value @@ -443,8 +462,9 @@ error[PLR1730]: if_stmt_min_max.py:155:9: [*] Replace `if` statement with `self. 158 157 | if self._min <= value: 159 158 | self._min = value -error[PLR1730]: if_stmt_min_max.py:158:9: [*] Replace `if` statement with `self._min = max(value, self._min)` +error[PLR1730]: 158:9: [*] Replace `if` statement with `self._min = max(value, self._min)` + --> if_stmt_min_max.py:158:9 | 156 | self._max = value 157 | @@ -466,8 +486,9 @@ error[PLR1730]: if_stmt_min_max.py:158:9: [*] Replace `if` statement with `self. 160 159 | if self._max >= value: 161 160 | self._max = value -error[PLR1730]: if_stmt_min_max.py:160:9: [*] Replace `if` statement with `self._max = min(value, self._max)` +error[PLR1730]: 160:9: [*] Replace `if` statement with `self._max = min(value, self._max)` + --> if_stmt_min_max.py:160:9 | 158 | if self._min <= value: 159 | self._min = value diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1733_unnecessary_dict_index_lookup.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1733_unnecessary_dict_index_lookup.py.snap index 1571470491..5c9fc03c09 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1733_unnecessary_dict_index_lookup.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1733_unnecessary_dict_index_lookup.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLR1733]: unnecessary_dict_index_lookup.py:4:6: [*] Unnecessary lookup of dictionary value by key +error[PLR1733]: 4:6: [*] Unnecessary lookup of dictionary value by key + --> unnecessary_dict_index_lookup.py:4:6 | 3 | def fix_these(): 4 | [FRUITS[fruit_name] for fruit_name, fruit_count in FRUITS.items()] # PLR1733 @@ -21,8 +22,9 @@ error[PLR1733]: unnecessary_dict_index_lookup.py:4:6: [*] Unnecessary lookup of 6 6 | {fruit_name: FRUITS[fruit_name] for fruit_name, fruit_count in FRUITS.items()} # PLR1733 7 7 | -error[PLR1733]: unnecessary_dict_index_lookup.py:5:6: [*] Unnecessary lookup of dictionary value by key +error[PLR1733]: 5:6: [*] Unnecessary lookup of dictionary value by key + --> unnecessary_dict_index_lookup.py:5:6 | 3 | def fix_these(): 4 | [FRUITS[fruit_name] for fruit_name, fruit_count in FRUITS.items()] # PLR1733 @@ -41,8 +43,9 @@ error[PLR1733]: unnecessary_dict_index_lookup.py:5:6: [*] Unnecessary lookup of 7 7 | 8 8 | for fruit_name, fruit_count in FRUITS.items(): -error[PLR1733]: unnecessary_dict_index_lookup.py:6:18: [*] Unnecessary lookup of dictionary value by key +error[PLR1733]: 6:18: [*] Unnecessary lookup of dictionary value by key + --> unnecessary_dict_index_lookup.py:6:18 | 4 | [FRUITS[fruit_name] for fruit_name, fruit_count in FRUITS.items()] # PLR1733 5 | {FRUITS[fruit_name] for fruit_name, fruit_count in FRUITS.items()} # PLR1733 @@ -62,8 +65,9 @@ error[PLR1733]: unnecessary_dict_index_lookup.py:6:18: [*] Unnecessary lookup of 8 8 | for fruit_name, fruit_count in FRUITS.items(): 9 9 | print(FRUITS[fruit_name]) # PLR1733 -error[PLR1733]: unnecessary_dict_index_lookup.py:9:15: [*] Unnecessary lookup of dictionary value by key +error[PLR1733]: 9:15: [*] Unnecessary lookup of dictionary value by key + --> unnecessary_dict_index_lookup.py:9:15 | 8 | for fruit_name, fruit_count in FRUITS.items(): 9 | print(FRUITS[fruit_name]) # PLR1733 @@ -82,8 +86,9 @@ error[PLR1733]: unnecessary_dict_index_lookup.py:9:15: [*] Unnecessary lookup of 11 11 | assert FRUITS[fruit_name] == "pear" # PLR1733 12 12 | -error[PLR1733]: unnecessary_dict_index_lookup.py:10:16: [*] Unnecessary lookup of dictionary value by key +error[PLR1733]: 10:16: [*] Unnecessary lookup of dictionary value by key + --> unnecessary_dict_index_lookup.py:10:16 | 8 | for fruit_name, fruit_count in FRUITS.items(): 9 | print(FRUITS[fruit_name]) # PLR1733 @@ -102,8 +107,9 @@ error[PLR1733]: unnecessary_dict_index_lookup.py:10:16: [*] Unnecessary lookup o 12 12 | 13 13 | -error[PLR1733]: unnecessary_dict_index_lookup.py:11:16: [*] Unnecessary lookup of dictionary value by key +error[PLR1733]: 11:16: [*] Unnecessary lookup of dictionary value by key + --> unnecessary_dict_index_lookup.py:11:16 | 9 | print(FRUITS[fruit_name]) # PLR1733 10 | blah = FRUITS[fruit_name] # PLR1733 diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1736_unnecessary_list_index_lookup.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1736_unnecessary_list_index_lookup.py.snap index afdb950361..0f4dc58118 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1736_unnecessary_list_index_lookup.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1736_unnecessary_list_index_lookup.py.snap @@ -1,16 +1,17 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -unnecessary_list_index_lookup.py:7:6: PLR1736 [*] List index lookup in `enumerate()` loop +error[PLR1736]: 7:6: [*] List index lookup in `enumerate()` loop + + --> unnecessary_list_index_lookup.py:7:6 | 6 | def fix_these(): 7 | [letters[index] for index, letter in enumerate(letters)] # PLR1736 - | ^^^^^^^^^^^^^^ PLR1736 + | ^^^^^^^^^^^^^^ 8 | {letters[index] for index, letter in enumerate(letters)} # PLR1736 9 | {letter: letters[index] for index, letter in enumerate(letters)} # PLR1736 | = help: Use the loop variable directly - ℹ Safe fix 4 4 | 5 5 | @@ -21,16 +22,17 @@ unnecessary_list_index_lookup.py:7:6: PLR1736 [*] List index lookup in `enumerat 9 9 | {letter: letters[index] for index, letter in enumerate(letters)} # PLR1736 10 10 | -unnecessary_list_index_lookup.py:8:6: PLR1736 [*] List index lookup in `enumerate()` loop +error[PLR1736]: 8:6: [*] List index lookup in `enumerate()` loop + + --> unnecessary_list_index_lookup.py:8:6 | 6 | def fix_these(): 7 | [letters[index] for index, letter in enumerate(letters)] # PLR1736 8 | {letters[index] for index, letter in enumerate(letters)} # PLR1736 - | ^^^^^^^^^^^^^^ PLR1736 + | ^^^^^^^^^^^^^^ 9 | {letter: letters[index] for index, letter in enumerate(letters)} # PLR1736 | = help: Use the loop variable directly - ℹ Safe fix 5 5 | 6 6 | def fix_these(): @@ -41,17 +43,18 @@ unnecessary_list_index_lookup.py:8:6: PLR1736 [*] List index lookup in `enumerat 10 10 | 11 11 | for index, letter in enumerate(letters): -unnecessary_list_index_lookup.py:9:14: PLR1736 [*] List index lookup in `enumerate()` loop +error[PLR1736]: 9:14: [*] List index lookup in `enumerate()` loop + + --> unnecessary_list_index_lookup.py:9:14 | 7 | [letters[index] for index, letter in enumerate(letters)] # PLR1736 8 | {letters[index] for index, letter in enumerate(letters)} # PLR1736 9 | {letter: letters[index] for index, letter in enumerate(letters)} # PLR1736 - | ^^^^^^^^^^^^^^ PLR1736 + | ^^^^^^^^^^^^^^ 10 | 11 | for index, letter in enumerate(letters): | = help: Use the loop variable directly - ℹ Safe fix 6 6 | def fix_these(): 7 7 | [letters[index] for index, letter in enumerate(letters)] # PLR1736 @@ -62,16 +65,17 @@ unnecessary_list_index_lookup.py:9:14: PLR1736 [*] List index lookup in `enumera 11 11 | for index, letter in enumerate(letters): 12 12 | print(letters[index]) # PLR1736 -unnecessary_list_index_lookup.py:12:15: PLR1736 [*] List index lookup in `enumerate()` loop +error[PLR1736]: 12:15: [*] List index lookup in `enumerate()` loop + + --> unnecessary_list_index_lookup.py:12:15 | 11 | for index, letter in enumerate(letters): 12 | print(letters[index]) # PLR1736 - | ^^^^^^^^^^^^^^ PLR1736 + | ^^^^^^^^^^^^^^ 13 | blah = letters[index] # PLR1736 14 | assert letters[index] == "d" # PLR1736 | = help: Use the loop variable directly - ℹ Safe fix 9 9 | {letter: letters[index] for index, letter in enumerate(letters)} # PLR1736 10 10 | @@ -82,16 +86,17 @@ unnecessary_list_index_lookup.py:12:15: PLR1736 [*] List index lookup in `enumer 14 14 | assert letters[index] == "d" # PLR1736 15 15 | -unnecessary_list_index_lookup.py:13:16: PLR1736 [*] List index lookup in `enumerate()` loop +error[PLR1736]: 13:16: [*] List index lookup in `enumerate()` loop + + --> unnecessary_list_index_lookup.py:13:16 | 11 | for index, letter in enumerate(letters): 12 | print(letters[index]) # PLR1736 13 | blah = letters[index] # PLR1736 - | ^^^^^^^^^^^^^^ PLR1736 + | ^^^^^^^^^^^^^^ 14 | assert letters[index] == "d" # PLR1736 | = help: Use the loop variable directly - ℹ Safe fix 10 10 | 11 11 | for index, letter in enumerate(letters): @@ -102,17 +107,18 @@ unnecessary_list_index_lookup.py:13:16: PLR1736 [*] List index lookup in `enumer 15 15 | 16 16 | for index, letter in builtins.enumerate(letters): -unnecessary_list_index_lookup.py:14:16: PLR1736 [*] List index lookup in `enumerate()` loop +error[PLR1736]: 14:16: [*] List index lookup in `enumerate()` loop + + --> unnecessary_list_index_lookup.py:14:16 | 12 | print(letters[index]) # PLR1736 13 | blah = letters[index] # PLR1736 14 | assert letters[index] == "d" # PLR1736 - | ^^^^^^^^^^^^^^ PLR1736 + | ^^^^^^^^^^^^^^ 15 | 16 | for index, letter in builtins.enumerate(letters): | = help: Use the loop variable directly - ℹ Safe fix 11 11 | for index, letter in enumerate(letters): 12 12 | print(letters[index]) # PLR1736 @@ -123,16 +129,17 @@ unnecessary_list_index_lookup.py:14:16: PLR1736 [*] List index lookup in `enumer 16 16 | for index, letter in builtins.enumerate(letters): 17 17 | print(letters[index]) # PLR1736 -unnecessary_list_index_lookup.py:17:15: PLR1736 [*] List index lookup in `enumerate()` loop +error[PLR1736]: 17:15: [*] List index lookup in `enumerate()` loop + + --> unnecessary_list_index_lookup.py:17:15 | 16 | for index, letter in builtins.enumerate(letters): 17 | print(letters[index]) # PLR1736 - | ^^^^^^^^^^^^^^ PLR1736 + | ^^^^^^^^^^^^^^ 18 | blah = letters[index] # PLR1736 19 | assert letters[index] == "d" # PLR1736 | = help: Use the loop variable directly - ℹ Safe fix 14 14 | assert letters[index] == "d" # PLR1736 15 15 | @@ -143,16 +150,17 @@ unnecessary_list_index_lookup.py:17:15: PLR1736 [*] List index lookup in `enumer 19 19 | assert letters[index] == "d" # PLR1736 20 20 | -unnecessary_list_index_lookup.py:18:16: PLR1736 [*] List index lookup in `enumerate()` loop +error[PLR1736]: 18:16: [*] List index lookup in `enumerate()` loop + + --> unnecessary_list_index_lookup.py:18:16 | 16 | for index, letter in builtins.enumerate(letters): 17 | print(letters[index]) # PLR1736 18 | blah = letters[index] # PLR1736 - | ^^^^^^^^^^^^^^ PLR1736 + | ^^^^^^^^^^^^^^ 19 | assert letters[index] == "d" # PLR1736 | = help: Use the loop variable directly - ℹ Safe fix 15 15 | 16 16 | for index, letter in builtins.enumerate(letters): @@ -163,15 +171,16 @@ unnecessary_list_index_lookup.py:18:16: PLR1736 [*] List index lookup in `enumer 20 20 | 21 21 | -unnecessary_list_index_lookup.py:19:16: PLR1736 [*] List index lookup in `enumerate()` loop +error[PLR1736]: 19:16: [*] List index lookup in `enumerate()` loop + + --> unnecessary_list_index_lookup.py:19:16 | 17 | print(letters[index]) # PLR1736 18 | blah = letters[index] # PLR1736 19 | assert letters[index] == "d" # PLR1736 - | ^^^^^^^^^^^^^^ PLR1736 + | ^^^^^^^^^^^^^^ | = help: Use the loop variable directly - ℹ Safe fix 16 16 | for index, letter in builtins.enumerate(letters): 17 17 | print(letters[index]) # PLR1736 @@ -182,17 +191,18 @@ unnecessary_list_index_lookup.py:19:16: PLR1736 [*] List index lookup in `enumer 21 21 | 22 22 | def dont_fix_these(): -unnecessary_list_index_lookup.py:74:15: PLR1736 [*] List index lookup in `enumerate()` loop +error[PLR1736]: 74:15: [*] List index lookup in `enumerate()` loop + + --> unnecessary_list_index_lookup.py:74:15 | 72 | # PLR1736 73 | for index, list_item in enumerate(some_list, start=0): 74 | print(some_list[index]) - | ^^^^^^^^^^^^^^^^ PLR1736 + | ^^^^^^^^^^^^^^^^ 75 | 76 | # PLR1736 | = help: Use the loop variable directly - ℹ Safe fix 71 71 | 72 72 | # PLR1736 @@ -203,15 +213,16 @@ unnecessary_list_index_lookup.py:74:15: PLR1736 [*] List index lookup in `enumer 76 76 | # PLR1736 77 77 | for index, list_item in enumerate(some_list): -unnecessary_list_index_lookup.py:78:15: PLR1736 [*] List index lookup in `enumerate()` loop +error[PLR1736]: 78:15: [*] List index lookup in `enumerate()` loop + + --> unnecessary_list_index_lookup.py:78:15 | 76 | # PLR1736 77 | for index, list_item in enumerate(some_list): 78 | print(some_list[index]) - | ^^^^^^^^^^^^^^^^ PLR1736 + | ^^^^^^^^^^^^^^^^ | = help: Use the loop variable directly - ℹ Safe fix 75 75 | 76 76 | # PLR1736 diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR2004_magic_value_comparison.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR2004_magic_value_comparison.py.snap index aa03b2a4de..13dd1a10a5 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR2004_magic_value_comparison.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR2004_magic_value_comparison.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLR2004]: magic_value_comparison.py:5:4: Magic value used in comparison, consider replacing `10` with a constant variable +error[PLR2004]: 5:4: Magic value used in comparison, consider replacing `10` with a constant variable + --> magic_value_comparison.py:5:4 | 3 | user_input = 10 4 | @@ -10,8 +11,9 @@ error[PLR2004]: magic_value_comparison.py:5:4: Magic value used in comparison, c | ^^ 6 | pass | -error[PLR2004]: magic_value_comparison.py:47:12: Magic value used in comparison, consider replacing `2` with a constant variable +error[PLR2004]: 47:12: Magic value used in comparison, consider replacing `2` with a constant variable + --> magic_value_comparison.py:47:12 | 45 | pass 46 | @@ -19,8 +21,9 @@ error[PLR2004]: magic_value_comparison.py:47:12: Magic value used in comparison, | ^ 48 | pass | -error[PLR2004]: magic_value_comparison.py:50:12: Magic value used in comparison, consider replacing `-2` with a constant variable +error[PLR2004]: 50:12: Magic value used in comparison, consider replacing `-2` with a constant variable + --> magic_value_comparison.py:50:12 | 48 | pass 49 | @@ -28,8 +31,9 @@ error[PLR2004]: magic_value_comparison.py:50:12: Magic value used in comparison, | ^^ 51 | pass | -error[PLR2004]: magic_value_comparison.py:53:12: Magic value used in comparison, consider replacing `+2` with a constant variable +error[PLR2004]: 53:12: Magic value used in comparison, consider replacing `+2` with a constant variable + --> magic_value_comparison.py:53:12 | 51 | pass 52 | @@ -37,8 +41,9 @@ error[PLR2004]: magic_value_comparison.py:53:12: Magic value used in comparison, | ^^ 54 | pass | -error[PLR2004]: magic_value_comparison.py:56:12: Magic value used in comparison, consider replacing `-2.0` with a constant variable +error[PLR2004]: 56:12: Magic value used in comparison, consider replacing `-2.0` with a constant variable + --> magic_value_comparison.py:56:12 | 54 | pass 55 | @@ -46,8 +51,9 @@ error[PLR2004]: magic_value_comparison.py:56:12: Magic value used in comparison, | ^^^^ 57 | pass | -error[PLR2004]: magic_value_comparison.py:59:12: Magic value used in comparison, consider replacing `+2.0` with a constant variable +error[PLR2004]: 59:12: Magic value used in comparison, consider replacing `+2.0` with a constant variable + --> magic_value_comparison.py:59:12 | 57 | pass 58 | @@ -55,8 +61,9 @@ error[PLR2004]: magic_value_comparison.py:59:12: Magic value used in comparison, | ^^^^ 60 | pass | -error[PLR2004]: magic_value_comparison.py:80:21: Magic value used in comparison, consider replacing `3.141592653589793238` with a constant variable +error[PLR2004]: 80:21: Magic value used in comparison, consider replacing `3.141592653589793238` with a constant variable + --> magic_value_comparison.py:80:21 | 78 | pi_estimation = 3.14 79 | @@ -64,8 +71,9 @@ error[PLR2004]: magic_value_comparison.py:80:21: Magic value used in comparison, | ^^^^^^^^^^^^^^^^^^^^ 81 | pass | -error[PLR2004]: magic_value_comparison.py:86:21: Magic value used in comparison, consider replacing `0x3` with a constant variable +error[PLR2004]: 86:21: Magic value used in comparison, consider replacing `0x3` with a constant variable + --> magic_value_comparison.py:86:21 | 84 | pass 85 | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR2044_empty_comment.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR2044_empty_comment.py.snap index 2aa6aed0e2..12c572e462 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR2044_empty_comment.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR2044_empty_comment.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLR2044]: empty_comment.py:3:1: [*] Line with empty comment +error[PLR2044]: 3:1: [*] Line with empty comment + --> empty_comment.py:2:66 | 1 | # this line has a non-empty comment and is OK 2 | # this line is also OK, but the three following lines are not @@ -20,8 +21,9 @@ error[PLR2044]: empty_comment.py:3:1: [*] Line with empty comment 5 4 | # 6 5 | -error[PLR2044]: empty_comment.py:4:5: [*] Line with empty comment +error[PLR2044]: 4:5: [*] Line with empty comment + --> empty_comment.py:4:5 | 2 | # this line is also OK, but the three following lines are not 3 | # @@ -39,8 +41,9 @@ error[PLR2044]: empty_comment.py:4:5: [*] Line with empty comment 6 5 | 7 6 | # this non-empty comment has trailing whitespace and is OK -error[PLR2044]: empty_comment.py:5:9: [*] Line with empty comment +error[PLR2044]: 5:9: [*] Line with empty comment + --> empty_comment.py:5:9 | 3 | # 4 | # @@ -59,8 +62,9 @@ error[PLR2044]: empty_comment.py:5:9: [*] Line with empty comment 7 6 | # this non-empty comment has trailing whitespace and is OK 8 7 | -error[PLR2044]: empty_comment.py:18:11: [*] Line with empty comment +error[PLR2044]: 18:11: [*] Line with empty comment + --> empty_comment.py:18:11 | 17 | def foo(): # this comment is OK, the one below is not 18 | pass # @@ -77,8 +81,9 @@ error[PLR2044]: empty_comment.py:18:11: [*] Line with empty comment 20 20 | 21 21 | # the lines below have no comments and are OK -error[PLR2044]: empty_comment.py:44:1: [*] Line with empty comment +error[PLR2044]: 44:1: [*] Line with empty comment + --> empty_comment.py:43:1 | 42 | # These should be removed, despite being an empty "block comment". 43 | @@ -96,8 +101,9 @@ error[PLR2044]: empty_comment.py:44:1: [*] Line with empty comment 47 46 | # These should also be removed. 48 47 | -error[PLR2044]: empty_comment.py:45:1: [*] Line with empty comment +error[PLR2044]: 45:1: [*] Line with empty comment + --> empty_comment.py:44:2 | 44 | # 45 | # @@ -115,8 +121,9 @@ error[PLR2044]: empty_comment.py:45:1: [*] Line with empty comment 47 46 | # These should also be removed. 48 47 | -error[PLR2044]: empty_comment.py:58:2: [*] Line with empty comment +error[PLR2044]: 58:2: [*] Line with empty comment + --> empty_comment.py:58:2 | 57 | α = 1 58 | α# diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR5501_collapsible_else_if.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR5501_collapsible_else_if.py.snap index 4679306fc9..c33868007c 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR5501_collapsible_else_if.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR5501_collapsible_else_if.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLR5501]: collapsible_else_if.py:37:5: [*] Use `elif` instead of `else` then `if`, to reduce indentation +error[PLR5501]: 37:5: [*] Use `elif` instead of `else` then `if`, to reduce indentation + --> collapsible_else_if.py:37:5 | 35 | if 1: 36 | pass @@ -26,8 +27,9 @@ error[PLR5501]: collapsible_else_if.py:37:5: [*] Use `elif` instead of `else` th 41 40 | 42 41 | def not_ok1(): -error[PLR5501]: collapsible_else_if.py:45:5: [*] Use `elif` instead of `else` then `if`, to reduce indentation +error[PLR5501]: 45:5: [*] Use `elif` instead of `else` then `if`, to reduce indentation + --> collapsible_else_if.py:45:5 | 43 | if 1: 44 | pass @@ -55,8 +57,9 @@ error[PLR5501]: collapsible_else_if.py:45:5: [*] Use `elif` instead of `else` th 51 50 | 52 51 | def not_ok1_with_comments(): -error[PLR5501]: collapsible_else_if.py:55:5: [*] Use `elif` instead of `else` then `if`, to reduce indentation +error[PLR5501]: 55:5: [*] Use `elif` instead of `else` then `if`, to reduce indentation + --> collapsible_else_if.py:55:5 | 53 | if 1: 54 | pass @@ -86,8 +89,9 @@ error[PLR5501]: collapsible_else_if.py:55:5: [*] Use `elif` instead of `else` th 62 60 | 63 61 | # Regression test for https://github.com/apache/airflow/blob/f1e1cdcc3b2826e68ba133f350300b5065bbca33/airflow/models/dag.py#L1737 -error[PLR5501]: collapsible_else_if.py:69:5: [*] Use `elif` instead of `else` then `if`, to reduce indentation +error[PLR5501]: 69:5: [*] Use `elif` instead of `else` then `if`, to reduce indentation + --> collapsible_else_if.py:69:5 | 67 | elif True: 68 | print(2) @@ -115,8 +119,9 @@ error[PLR5501]: collapsible_else_if.py:69:5: [*] Use `elif` instead of `else` th 75 74 | 76 75 | def not_ok3(): -error[PLR5501]: collapsible_else_if.py:79:5: [*] Use `elif` instead of `else` then `if`, to reduce indentation +error[PLR5501]: 79:5: [*] Use `elif` instead of `else` then `if`, to reduce indentation + --> collapsible_else_if.py:79:5 | 77 | if 1: 78 | pass @@ -140,8 +145,9 @@ error[PLR5501]: collapsible_else_if.py:79:5: [*] Use `elif` instead of `else` th 83 82 | 84 83 | def not_ok4(): -error[PLR5501]: collapsible_else_if.py:87:5: [*] Use `elif` instead of `else` then `if`, to reduce indentation +error[PLR5501]: 87:5: [*] Use `elif` instead of `else` then `if`, to reduce indentation + --> collapsible_else_if.py:87:5 | 85 | if 1: 86 | pass @@ -167,8 +173,9 @@ error[PLR5501]: collapsible_else_if.py:87:5: [*] Use `elif` instead of `else` th 92 91 | 93 92 | def not_ok5(): -error[PLR5501]: collapsible_else_if.py:96:5: [*] Use `elif` instead of `else` then `if`, to reduce indentation +error[PLR5501]: 96:5: [*] Use `elif` instead of `else` then `if`, to reduce indentation + --> collapsible_else_if.py:96:5 | 94 | if 1: 95 | pass diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR6104_non_augmented_assignment.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR6104_non_augmented_assignment.py.snap index 8c03918ee0..7585c56962 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR6104_non_augmented_assignment.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR6104_non_augmented_assignment.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLR6104]: non_augmented_assignment.py:16:1: [*] Use `+=` to perform an augmented assignment directly +error[PLR6104]: 16:1: [*] Use `+=` to perform an augmented assignment directly + --> non_augmented_assignment.py:15:1 | 14 | mat1, mat2 = None, None 15 | @@ -22,8 +23,9 @@ error[PLR6104]: non_augmented_assignment.py:16:1: [*] Use `+=` to perform an aug 18 18 | a_list = a_list + ["to concat"] 19 19 | some_set = some_set | {"to concat"} -error[PLR6104]: non_augmented_assignment.py:17:1: [*] Use `-=` to perform an augmented assignment directly +error[PLR6104]: 17:1: [*] Use `-=` to perform an augmented assignment directly + --> non_augmented_assignment.py:16:56 | 16 | some_string = some_string + "a very long end of string" 17 | index = index - 1 @@ -42,8 +44,9 @@ error[PLR6104]: non_augmented_assignment.py:17:1: [*] Use `-=` to perform an aug 19 19 | some_set = some_set | {"to concat"} 20 20 | to_multiply = to_multiply * 5 -error[PLR6104]: non_augmented_assignment.py:18:1: [*] Use `+=` to perform an augmented assignment directly +error[PLR6104]: 18:1: [*] Use `+=` to perform an augmented assignment directly + --> non_augmented_assignment.py:17:18 | 16 | some_string = some_string + "a very long end of string" 17 | index = index - 1 @@ -63,8 +66,9 @@ error[PLR6104]: non_augmented_assignment.py:18:1: [*] Use `+=` to perform an aug 20 20 | to_multiply = to_multiply * 5 21 21 | to_multiply = 5 * to_multiply -error[PLR6104]: non_augmented_assignment.py:19:1: [*] Use `|=` to perform an augmented assignment directly +error[PLR6104]: 19:1: [*] Use `|=` to perform an augmented assignment directly + --> non_augmented_assignment.py:18:32 | 17 | index = index - 1 18 | a_list = a_list + ["to concat"] @@ -84,8 +88,9 @@ error[PLR6104]: non_augmented_assignment.py:19:1: [*] Use `|=` to perform an aug 21 21 | to_multiply = 5 * to_multiply 22 22 | to_multiply = to_multiply * to_multiply -error[PLR6104]: non_augmented_assignment.py:20:1: [*] Use `*=` to perform an augmented assignment directly +error[PLR6104]: 20:1: [*] Use `*=` to perform an augmented assignment directly + --> non_augmented_assignment.py:19:36 | 18 | a_list = a_list + ["to concat"] 19 | some_set = some_set | {"to concat"} @@ -105,8 +110,9 @@ error[PLR6104]: non_augmented_assignment.py:20:1: [*] Use `*=` to perform an aug 22 22 | to_multiply = to_multiply * to_multiply 23 23 | to_divide = to_divide / 5 -error[PLR6104]: non_augmented_assignment.py:21:1: [*] Use `*=` to perform an augmented assignment directly +error[PLR6104]: 21:1: [*] Use `*=` to perform an augmented assignment directly + --> non_augmented_assignment.py:20:30 | 19 | some_set = some_set | {"to concat"} 20 | to_multiply = to_multiply * 5 @@ -126,8 +132,9 @@ error[PLR6104]: non_augmented_assignment.py:21:1: [*] Use `*=` to perform an aug 23 23 | to_divide = to_divide / 5 24 24 | to_divide = to_divide // 5 -error[PLR6104]: non_augmented_assignment.py:22:1: [*] Use `*=` to perform an augmented assignment directly +error[PLR6104]: 22:1: [*] Use `*=` to perform an augmented assignment directly + --> non_augmented_assignment.py:21:30 | 20 | to_multiply = to_multiply * 5 21 | to_multiply = 5 * to_multiply @@ -147,8 +154,9 @@ error[PLR6104]: non_augmented_assignment.py:22:1: [*] Use `*=` to perform an aug 24 24 | to_divide = to_divide // 5 25 25 | to_cube = to_cube**3 -error[PLR6104]: non_augmented_assignment.py:23:1: [*] Use `/=` to perform an augmented assignment directly +error[PLR6104]: 23:1: [*] Use `/=` to perform an augmented assignment directly + --> non_augmented_assignment.py:22:40 | 21 | to_multiply = 5 * to_multiply 22 | to_multiply = to_multiply * to_multiply @@ -168,8 +176,9 @@ error[PLR6104]: non_augmented_assignment.py:23:1: [*] Use `/=` to perform an aug 25 25 | to_cube = to_cube**3 26 26 | to_cube = 3**to_cube -error[PLR6104]: non_augmented_assignment.py:24:1: [*] Use `//=` to perform an augmented assignment directly +error[PLR6104]: 24:1: [*] Use `//=` to perform an augmented assignment directly + --> non_augmented_assignment.py:23:26 | 22 | to_multiply = to_multiply * to_multiply 23 | to_divide = to_divide / 5 @@ -189,8 +198,9 @@ error[PLR6104]: non_augmented_assignment.py:24:1: [*] Use `//=` to perform an au 26 26 | to_cube = 3**to_cube 27 27 | to_cube = to_cube**to_cube -error[PLR6104]: non_augmented_assignment.py:25:1: [*] Use `**=` to perform an augmented assignment directly +error[PLR6104]: 25:1: [*] Use `**=` to perform an augmented assignment directly + --> non_augmented_assignment.py:24:27 | 23 | to_divide = to_divide / 5 24 | to_divide = to_divide // 5 @@ -210,8 +220,9 @@ error[PLR6104]: non_augmented_assignment.py:25:1: [*] Use `**=` to perform an au 27 27 | to_cube = to_cube**to_cube 28 28 | timeDiffSeconds = timeDiffSeconds % 60 -error[PLR6104]: non_augmented_assignment.py:27:1: [*] Use `**=` to perform an augmented assignment directly +error[PLR6104]: 27:1: [*] Use `**=` to perform an augmented assignment directly + --> non_augmented_assignment.py:26:21 | 25 | to_cube = to_cube**3 26 | to_cube = 3**to_cube @@ -231,8 +242,9 @@ error[PLR6104]: non_augmented_assignment.py:27:1: [*] Use `**=` to perform an au 29 29 | flags = flags & 0x1 30 30 | flags = flags | 0x1 -error[PLR6104]: non_augmented_assignment.py:28:1: [*] Use `%=` to perform an augmented assignment directly +error[PLR6104]: 28:1: [*] Use `%=` to perform an augmented assignment directly + --> non_augmented_assignment.py:27:27 | 26 | to_cube = 3**to_cube 27 | to_cube = to_cube**to_cube @@ -252,8 +264,9 @@ error[PLR6104]: non_augmented_assignment.py:28:1: [*] Use `%=` to perform an aug 30 30 | flags = flags | 0x1 31 31 | flags = flags ^ 0x1 -error[PLR6104]: non_augmented_assignment.py:29:1: [*] Use `&=` to perform an augmented assignment directly +error[PLR6104]: 29:1: [*] Use `&=` to perform an augmented assignment directly + --> non_augmented_assignment.py:28:39 | 27 | to_cube = to_cube**to_cube 28 | timeDiffSeconds = timeDiffSeconds % 60 @@ -273,8 +286,9 @@ error[PLR6104]: non_augmented_assignment.py:29:1: [*] Use `&=` to perform an aug 31 31 | flags = flags ^ 0x1 32 32 | flags = flags << 1 -error[PLR6104]: non_augmented_assignment.py:30:1: [*] Use `|=` to perform an augmented assignment directly +error[PLR6104]: 30:1: [*] Use `|=` to perform an augmented assignment directly + --> non_augmented_assignment.py:29:20 | 28 | timeDiffSeconds = timeDiffSeconds % 60 29 | flags = flags & 0x1 @@ -294,8 +308,9 @@ error[PLR6104]: non_augmented_assignment.py:30:1: [*] Use `|=` to perform an aug 32 32 | flags = flags << 1 33 33 | flags = flags >> 1 -error[PLR6104]: non_augmented_assignment.py:31:1: [*] Use `^=` to perform an augmented assignment directly +error[PLR6104]: 31:1: [*] Use `^=` to perform an augmented assignment directly + --> non_augmented_assignment.py:30:20 | 29 | flags = flags & 0x1 30 | flags = flags | 0x1 @@ -315,8 +330,9 @@ error[PLR6104]: non_augmented_assignment.py:31:1: [*] Use `^=` to perform an aug 33 33 | flags = flags >> 1 34 34 | mat1 = mat1 @ mat2 -error[PLR6104]: non_augmented_assignment.py:32:1: [*] Use `<<=` to perform an augmented assignment directly +error[PLR6104]: 32:1: [*] Use `<<=` to perform an augmented assignment directly + --> non_augmented_assignment.py:31:20 | 30 | flags = flags | 0x1 31 | flags = flags ^ 0x1 @@ -336,8 +352,9 @@ error[PLR6104]: non_augmented_assignment.py:32:1: [*] Use `<<=` to perform an au 34 34 | mat1 = mat1 @ mat2 35 35 | a_list[1] = a_list[1] + 1 -error[PLR6104]: non_augmented_assignment.py:33:1: [*] Use `>>=` to perform an augmented assignment directly +error[PLR6104]: 33:1: [*] Use `>>=` to perform an augmented assignment directly + --> non_augmented_assignment.py:32:19 | 31 | flags = flags ^ 0x1 32 | flags = flags << 1 @@ -357,8 +374,9 @@ error[PLR6104]: non_augmented_assignment.py:33:1: [*] Use `>>=` to perform an au 35 35 | a_list[1] = a_list[1] + 1 36 36 | -error[PLR6104]: non_augmented_assignment.py:34:1: [*] Use `@=` to perform an augmented assignment directly +error[PLR6104]: 34:1: [*] Use `@=` to perform an augmented assignment directly + --> non_augmented_assignment.py:33:19 | 32 | flags = flags << 1 33 | flags = flags >> 1 @@ -377,8 +395,9 @@ error[PLR6104]: non_augmented_assignment.py:34:1: [*] Use `@=` to perform an aug 36 36 | 37 37 | a_list[0:2] = a_list[0:2] * 3 -error[PLR6104]: non_augmented_assignment.py:35:1: [*] Use `+=` to perform an augmented assignment directly +error[PLR6104]: 35:1: [*] Use `+=` to perform an augmented assignment directly + --> non_augmented_assignment.py:34:19 | 33 | flags = flags >> 1 34 | mat1 = mat1 @ mat2 @@ -398,8 +417,9 @@ error[PLR6104]: non_augmented_assignment.py:35:1: [*] Use `+=` to perform an aug 37 37 | a_list[0:2] = a_list[0:2] * 3 38 38 | a_list[:2] = a_list[:2] * 3 -error[PLR6104]: non_augmented_assignment.py:37:1: [*] Use `*=` to perform an augmented assignment directly +error[PLR6104]: 37:1: [*] Use `*=` to perform an augmented assignment directly + --> non_augmented_assignment.py:36:1 | 35 | a_list[1] = a_list[1] + 1 36 | @@ -419,8 +439,9 @@ error[PLR6104]: non_augmented_assignment.py:37:1: [*] Use `*=` to perform an aug 39 39 | a_list[1:] = a_list[1:] * 3 40 40 | a_list[:] = a_list[:] * 3 -error[PLR6104]: non_augmented_assignment.py:38:1: [*] Use `*=` to perform an augmented assignment directly +error[PLR6104]: 38:1: [*] Use `*=` to perform an augmented assignment directly + --> non_augmented_assignment.py:37:30 | 37 | a_list[0:2] = a_list[0:2] * 3 38 | a_list[:2] = a_list[:2] * 3 @@ -439,8 +460,9 @@ error[PLR6104]: non_augmented_assignment.py:38:1: [*] Use `*=` to perform an aug 40 40 | a_list[:] = a_list[:] * 3 41 41 | -error[PLR6104]: non_augmented_assignment.py:39:1: [*] Use `*=` to perform an augmented assignment directly +error[PLR6104]: 39:1: [*] Use `*=` to perform an augmented assignment directly + --> non_augmented_assignment.py:38:28 | 37 | a_list[0:2] = a_list[0:2] * 3 38 | a_list[:2] = a_list[:2] * 3 @@ -459,8 +481,9 @@ error[PLR6104]: non_augmented_assignment.py:39:1: [*] Use `*=` to perform an aug 41 41 | 42 42 | index = index * (index + 10) -error[PLR6104]: non_augmented_assignment.py:40:1: [*] Use `*=` to perform an augmented assignment directly +error[PLR6104]: 40:1: [*] Use `*=` to perform an augmented assignment directly + --> non_augmented_assignment.py:39:28 | 38 | a_list[:2] = a_list[:2] * 3 39 | a_list[1:] = a_list[1:] * 3 @@ -480,8 +503,9 @@ error[PLR6104]: non_augmented_assignment.py:40:1: [*] Use `*=` to perform an aug 42 42 | index = index * (index + 10) 43 43 | -error[PLR6104]: non_augmented_assignment.py:42:1: [*] Use `*=` to perform an augmented assignment directly +error[PLR6104]: 42:1: [*] Use `*=` to perform an augmented assignment directly + --> non_augmented_assignment.py:41:1 | 40 | a_list[:] = a_list[:] * 3 41 | @@ -499,8 +523,9 @@ error[PLR6104]: non_augmented_assignment.py:42:1: [*] Use `*=` to perform an aug 44 44 | 45 45 | class T: -error[PLR6104]: non_augmented_assignment.py:47:9: [*] Use `+=` to perform an augmented assignment directly +error[PLR6104]: 47:9: [*] Use `+=` to perform an augmented assignment directly + --> non_augmented_assignment.py:47:9 | 45 | class T: 46 | def t(self): @@ -518,8 +543,9 @@ error[PLR6104]: non_augmented_assignment.py:47:9: [*] Use `+=` to perform an aug 49 49 | 50 50 | obj = T() -error[PLR6104]: non_augmented_assignment.py:51:1: [*] Use `+=` to perform an augmented assignment directly +error[PLR6104]: 51:1: [*] Use `+=` to perform an augmented assignment directly + --> non_augmented_assignment.py:50:10 | 50 | obj = T() 51 | obj.a = obj.a + 1 diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR6201_literal_membership.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR6201_literal_membership.py.snap index 98cd73be36..2703e9c746 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR6201_literal_membership.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR6201_literal_membership.py.snap @@ -1,16 +1,17 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -literal_membership.py:2:6: PLR6201 [*] Use a set literal when testing for membership +error[PLR6201]: 2:6: [*] Use a set literal when testing for membership + + --> literal_membership.py:2:6 | 1 | # Errors 2 | 1 in [1, 2, 3] - | ^^^^^^^^^ PLR6201 + | ^^^^^^^^^ 3 | 1 in (1, 2, 3) 4 | 1 in ( | = help: Convert to `set` - ℹ Unsafe fix 1 1 | # Errors 2 |-1 in [1, 2, 3] @@ -19,17 +20,18 @@ literal_membership.py:2:6: PLR6201 [*] Use a set literal when testing for member 4 4 | 1 in ( 5 5 | 1, 2, 3 -literal_membership.py:3:6: PLR6201 [*] Use a set literal when testing for membership +error[PLR6201]: 3:6: [*] Use a set literal when testing for membership + + --> literal_membership.py:3:6 | 1 | # Errors 2 | 1 in [1, 2, 3] 3 | 1 in (1, 2, 3) - | ^^^^^^^^^ PLR6201 + | ^^^^^^^^^ 4 | 1 in ( 5 | 1, 2, 3 | = help: Convert to `set` - ℹ Unsafe fix 1 1 | # Errors 2 2 | 1 in [1, 2, 3] @@ -39,7 +41,9 @@ literal_membership.py:3:6: PLR6201 [*] Use a set literal when testing for member 5 5 | 1, 2, 3 6 6 | ) -literal_membership.py:4:6: PLR6201 [*] Use a set literal when testing for membership +error[PLR6201]: 4:6: [*] Use a set literal when testing for membership + + --> literal_membership.py:4:6 | 2 | 1 in [1, 2, 3] 3 | 1 in (1, 2, 3) @@ -47,12 +51,11 @@ literal_membership.py:4:6: PLR6201 [*] Use a set literal when testing for member | ______^ 5 | | 1, 2, 3 6 | | ) - | |_^ PLR6201 + | |_^ 7 | fruits = ["cherry", "grapes"] 8 | "cherry" in fruits | = help: Convert to `set` - ℹ Unsafe fix 1 1 | # Errors 2 2 | 1 in [1, 2, 3] @@ -66,17 +69,18 @@ literal_membership.py:4:6: PLR6201 [*] Use a set literal when testing for member 8 8 | "cherry" in fruits 9 9 | _ = {key: value for key, value in {"a": 1, "b": 2}.items() if key in ("a", "b")} -literal_membership.py:9:70: PLR6201 [*] Use a set literal when testing for membership +error[PLR6201]: 9:70: [*] Use a set literal when testing for membership + + --> literal_membership.py:9:70 | 7 | fruits = ["cherry", "grapes"] 8 | "cherry" in fruits 9 | _ = {key: value for key, value in {"a": 1, "b": 2}.items() if key in ("a", "b")} - | ^^^^^^^^^^ PLR6201 + | ^^^^^^^^^^ 10 | 11 | # OK | = help: Convert to `set` - ℹ Unsafe fix 6 6 | ) 7 7 | fruits = ["cherry", "grapes"] diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR6301_no_self_use.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR6301_no_self_use.py.snap index 2e57c6f032..0f210e1ea9 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR6301_no_self_use.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR6301_no_self_use.py.snap @@ -1,16 +1,18 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLR6301]: no_self_use.py:7:9: Method `developer_greeting` could be a function, class method, or static method +error[PLR6301]: 7:9: Method `developer_greeting` could be a function, class method, or static method + --> no_self_use.py:7:9 | 6 | class Person: 7 | def developer_greeting(self, name): # [no-self-use] | ^^^^^^^^^^^^^^^^^^ 8 | print(f"Greetings {name}!") | -error[PLR6301]: no_self_use.py:10:9: Method `greeting_1` could be a function, class method, or static method +error[PLR6301]: 10:9: Method `greeting_1` could be a function, class method, or static method + --> no_self_use.py:10:9 | 8 | print(f"Greetings {name}!") 9 | @@ -18,8 +20,9 @@ error[PLR6301]: no_self_use.py:10:9: Method `greeting_1` could be a function, cl | ^^^^^^^^^^ 11 | print("Hello!") | -error[PLR6301]: no_self_use.py:13:9: Method `greeting_2` could be a function, class method, or static method +error[PLR6301]: 13:9: Method `greeting_2` could be a function, class method, or static method + --> no_self_use.py:13:9 | 11 | print("Hello!") 12 | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0108_unnecessary_lambda.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0108_unnecessary_lambda.py.snap index b4fac997a2..694b0462d7 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0108_unnecessary_lambda.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0108_unnecessary_lambda.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLW0108]: unnecessary_lambda.py:1:5: [*] Lambda may be unnecessary; consider inlining inner function +error[PLW0108]: 1:5: [*] Lambda may be unnecessary; consider inlining inner function + --> unnecessary_lambda.py:1:5 | 1 | _ = lambda: print() # [unnecessary-lambda] | ^^^^^^^^^^^^^^^ @@ -16,8 +17,9 @@ error[PLW0108]: unnecessary_lambda.py:1:5: [*] Lambda may be unnecessary; consid 3 3 | 4 4 | _ = lambda *args: f(*args) # [unnecessary-lambda] -error[PLW0108]: unnecessary_lambda.py:2:5: [*] Lambda may be unnecessary; consider inlining inner function +error[PLW0108]: 2:5: [*] Lambda may be unnecessary; consider inlining inner function + --> unnecessary_lambda.py:2:5 | 1 | _ = lambda: print() # [unnecessary-lambda] 2 | _ = lambda x, y: min(x, y) # [unnecessary-lambda] @@ -34,8 +36,9 @@ error[PLW0108]: unnecessary_lambda.py:2:5: [*] Lambda may be unnecessary; consid 4 4 | _ = lambda *args: f(*args) # [unnecessary-lambda] 5 5 | _ = lambda **kwargs: f(**kwargs) # [unnecessary-lambda] -error[PLW0108]: unnecessary_lambda.py:4:5: [*] Lambda may be unnecessary; consider inlining inner function +error[PLW0108]: 4:5: [*] Lambda may be unnecessary; consider inlining inner function + --> unnecessary_lambda.py:4:5 | 2 | _ = lambda x, y: min(x, y) # [unnecessary-lambda] 3 | @@ -55,8 +58,9 @@ error[PLW0108]: unnecessary_lambda.py:4:5: [*] Lambda may be unnecessary; consid 6 6 | _ = lambda *args, **kwargs: f(*args, **kwargs) # [unnecessary-lambda] 7 7 | _ = lambda x, y, z, *args, **kwargs: f(x, y, z, *args, **kwargs) # [unnecessary-lambda] -error[PLW0108]: unnecessary_lambda.py:5:5: [*] Lambda may be unnecessary; consider inlining inner function +error[PLW0108]: 5:5: [*] Lambda may be unnecessary; consider inlining inner function + --> unnecessary_lambda.py:5:5 | 4 | _ = lambda *args: f(*args) # [unnecessary-lambda] 5 | _ = lambda **kwargs: f(**kwargs) # [unnecessary-lambda] @@ -75,8 +79,9 @@ error[PLW0108]: unnecessary_lambda.py:5:5: [*] Lambda may be unnecessary; consid 7 7 | _ = lambda x, y, z, *args, **kwargs: f(x, y, z, *args, **kwargs) # [unnecessary-lambda] 8 8 | -error[PLW0108]: unnecessary_lambda.py:6:5: [*] Lambda may be unnecessary; consider inlining inner function +error[PLW0108]: 6:5: [*] Lambda may be unnecessary; consider inlining inner function + --> unnecessary_lambda.py:6:5 | 4 | _ = lambda *args: f(*args) # [unnecessary-lambda] 5 | _ = lambda **kwargs: f(**kwargs) # [unnecessary-lambda] @@ -95,8 +100,9 @@ error[PLW0108]: unnecessary_lambda.py:6:5: [*] Lambda may be unnecessary; consid 8 8 | 9 9 | _ = lambda x: f(lambda x: x)(x) # [unnecessary-lambda] -error[PLW0108]: unnecessary_lambda.py:7:5: [*] Lambda may be unnecessary; consider inlining inner function +error[PLW0108]: 7:5: [*] Lambda may be unnecessary; consider inlining inner function + --> unnecessary_lambda.py:7:5 | 5 | _ = lambda **kwargs: f(**kwargs) # [unnecessary-lambda] 6 | _ = lambda *args, **kwargs: f(*args, **kwargs) # [unnecessary-lambda] @@ -116,8 +122,9 @@ error[PLW0108]: unnecessary_lambda.py:7:5: [*] Lambda may be unnecessary; consid 9 9 | _ = lambda x: f(lambda x: x)(x) # [unnecessary-lambda] 10 10 | _ = lambda x, y: f(lambda x, y: x + y)(x, y) # [unnecessary-lambda] -error[PLW0108]: unnecessary_lambda.py:9:5: [*] Lambda may be unnecessary; consider inlining inner function +error[PLW0108]: 9:5: [*] Lambda may be unnecessary; consider inlining inner function + --> unnecessary_lambda.py:9:5 | 7 | _ = lambda x, y, z, *args, **kwargs: f(x, y, z, *args, **kwargs) # [unnecessary-lambda] 8 | @@ -136,8 +143,9 @@ error[PLW0108]: unnecessary_lambda.py:9:5: [*] Lambda may be unnecessary; consid 11 11 | 12 12 | # default value in lambda parameters -error[PLW0108]: unnecessary_lambda.py:10:5: [*] Lambda may be unnecessary; consider inlining inner function +error[PLW0108]: 10:5: [*] Lambda may be unnecessary; consider inlining inner function + --> unnecessary_lambda.py:10:5 | 9 | _ = lambda x: f(lambda x: x)(x) # [unnecessary-lambda] 10 | _ = lambda x, y: f(lambda x, y: x + y)(x, y) # [unnecessary-lambda] diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0120_useless_else_on_loop.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0120_useless_else_on_loop.py.snap index 47d52b7c58..c191ebc001 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0120_useless_else_on_loop.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0120_useless_else_on_loop.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLW0120]: useless_else_on_loop.py:9:5: [*] `else` clause on loop without a `break` statement; remove the `else` and dedent its contents +error[PLW0120]: 9:5: [*] `else` clause on loop without a `break` statement; remove the `else` and dedent its contents + --> useless_else_on_loop.py:9:5 | 7 | if i % 2: 8 | return i @@ -23,8 +24,9 @@ error[PLW0120]: useless_else_on_loop.py:9:5: [*] `else` clause on loop without a 12 11 | 13 12 | -error[PLW0120]: useless_else_on_loop.py:18:5: [*] `else` clause on loop without a `break` statement; remove the `else` and dedent its contents +error[PLW0120]: 18:5: [*] `else` clause on loop without a `break` statement; remove the `else` and dedent its contents + --> useless_else_on_loop.py:18:5 | 16 | while True: 17 | return 1 @@ -45,8 +47,9 @@ error[PLW0120]: useless_else_on_loop.py:18:5: [*] `else` clause on loop without 21 20 | 22 21 | -error[PLW0120]: useless_else_on_loop.py:30:1: [*] `else` clause on loop without a `break` statement; remove the `else` and dedent its contents +error[PLW0120]: 30:1: [*] `else` clause on loop without a `break` statement; remove the `else` and dedent its contents + --> useless_else_on_loop.py:29:1 | 28 | break 29 | @@ -66,8 +69,9 @@ error[PLW0120]: useless_else_on_loop.py:30:1: [*] `else` clause on loop without 33 32 | 34 33 | while True: -error[PLW0120]: useless_else_on_loop.py:37:1: [*] `else` clause on loop without a `break` statement; remove the `else` and dedent its contents +error[PLW0120]: 37:1: [*] `else` clause on loop without a `break` statement; remove the `else` and dedent its contents + --> useless_else_on_loop.py:36:14 | 35 | while False: 36 | break @@ -87,8 +91,9 @@ error[PLW0120]: useless_else_on_loop.py:37:1: [*] `else` clause on loop without 40 39 | for j in range(10): 41 40 | pass -error[PLW0120]: useless_else_on_loop.py:42:1: [*] `else` clause on loop without a `break` statement; remove the `else` and dedent its contents +error[PLW0120]: 42:1: [*] `else` clause on loop without a `break` statement; remove the `else` and dedent its contents + --> useless_else_on_loop.py:41:9 | 40 | for j in range(10): 41 | pass @@ -113,8 +118,9 @@ error[PLW0120]: useless_else_on_loop.py:42:1: [*] `else` clause on loop without 47 46 | 48 47 | def test_return_for2(): -error[PLW0120]: useless_else_on_loop.py:88:5: [*] `else` clause on loop without a `break` statement; remove the `else` and dedent its contents +error[PLW0120]: 88:5: [*] `else` clause on loop without a `break` statement; remove the `else` and dedent its contents + --> useless_else_on_loop.py:88:5 | 86 | else: 87 | print("all right") @@ -135,8 +141,9 @@ error[PLW0120]: useless_else_on_loop.py:88:5: [*] `else` clause on loop without 91 90 | 92 91 | -error[PLW0120]: useless_else_on_loop.py:98:9: [*] `else` clause on loop without a `break` statement; remove the `else` and dedent its contents +error[PLW0120]: 98:9: [*] `else` clause on loop without a `break` statement; remove the `else` and dedent its contents + --> useless_else_on_loop.py:98:9 | 96 | for _ in range(3): 97 | pass @@ -159,8 +166,9 @@ error[PLW0120]: useless_else_on_loop.py:98:9: [*] `else` clause on loop without 102 101 | return True 103 102 | return False -error[PLW0120]: useless_else_on_loop.py:144:5: [*] `else` clause on loop without a `break` statement; remove the `else` and dedent its contents +error[PLW0120]: 144:5: [*] `else` clause on loop without a `break` statement; remove the `else` and dedent its contents + --> useless_else_on_loop.py:144:5 | 142 | for j in range(10): 143 | pass diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0127_self_assigning_variable.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0127_self_assigning_variable.py.snap index f6ca2851e7..83181761d0 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0127_self_assigning_variable.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0127_self_assigning_variable.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLW0127]: self_assigning_variable.py:6:1: Self-assignment of variable `foo` +error[PLW0127]: 6:1: Self-assignment of variable `foo` + --> self_assigning_variable.py:5:10 | 5 | # Errors. 6 | foo = foo @@ -10,8 +11,9 @@ error[PLW0127]: self_assigning_variable.py:6:1: Self-assignment of variable `foo 7 | bar = bar 8 | foo, bar = foo, bar | -error[PLW0127]: self_assigning_variable.py:7:1: Self-assignment of variable `bar` +error[PLW0127]: 7:1: Self-assignment of variable `bar` + --> self_assigning_variable.py:6:10 | 5 | # Errors. 6 | foo = foo @@ -20,8 +22,9 @@ error[PLW0127]: self_assigning_variable.py:7:1: Self-assignment of variable `bar 8 | foo, bar = foo, bar 9 | bar, foo = bar, foo | -error[PLW0127]: self_assigning_variable.py:8:1: Self-assignment of variable `foo` +error[PLW0127]: 8:1: Self-assignment of variable `foo` + --> self_assigning_variable.py:7:10 | 6 | foo = foo 7 | bar = bar @@ -30,8 +33,9 @@ error[PLW0127]: self_assigning_variable.py:8:1: Self-assignment of variable `foo 9 | bar, foo = bar, foo 10 | (foo, bar) = (foo, bar) | -error[PLW0127]: self_assigning_variable.py:8:6: Self-assignment of variable `bar` +error[PLW0127]: 8:6: Self-assignment of variable `bar` + --> self_assigning_variable.py:8:6 | 6 | foo = foo 7 | bar = bar @@ -40,8 +44,9 @@ error[PLW0127]: self_assigning_variable.py:8:6: Self-assignment of variable `bar 9 | bar, foo = bar, foo 10 | (foo, bar) = (foo, bar) | -error[PLW0127]: self_assigning_variable.py:9:1: Self-assignment of variable `bar` +error[PLW0127]: 9:1: Self-assignment of variable `bar` + --> self_assigning_variable.py:8:20 | 7 | bar = bar 8 | foo, bar = foo, bar @@ -50,8 +55,9 @@ error[PLW0127]: self_assigning_variable.py:9:1: Self-assignment of variable `bar 10 | (foo, bar) = (foo, bar) 11 | (bar, foo) = (bar, foo) | -error[PLW0127]: self_assigning_variable.py:9:6: Self-assignment of variable `foo` +error[PLW0127]: 9:6: Self-assignment of variable `foo` + --> self_assigning_variable.py:9:6 | 7 | bar = bar 8 | foo, bar = foo, bar @@ -60,8 +66,9 @@ error[PLW0127]: self_assigning_variable.py:9:6: Self-assignment of variable `foo 10 | (foo, bar) = (foo, bar) 11 | (bar, foo) = (bar, foo) | -error[PLW0127]: self_assigning_variable.py:10:2: Self-assignment of variable `foo` +error[PLW0127]: 10:2: Self-assignment of variable `foo` + --> self_assigning_variable.py:10:2 | 8 | foo, bar = foo, bar 9 | bar, foo = bar, foo @@ -70,8 +77,9 @@ error[PLW0127]: self_assigning_variable.py:10:2: Self-assignment of variable `fo 11 | (bar, foo) = (bar, foo) 12 | foo, (bar, baz) = foo, (bar, baz) | -error[PLW0127]: self_assigning_variable.py:10:7: Self-assignment of variable `bar` +error[PLW0127]: 10:7: Self-assignment of variable `bar` + --> self_assigning_variable.py:10:7 | 8 | foo, bar = foo, bar 9 | bar, foo = bar, foo @@ -80,8 +88,9 @@ error[PLW0127]: self_assigning_variable.py:10:7: Self-assignment of variable `ba 11 | (bar, foo) = (bar, foo) 12 | foo, (bar, baz) = foo, (bar, baz) | -error[PLW0127]: self_assigning_variable.py:11:2: Self-assignment of variable `bar` +error[PLW0127]: 11:2: Self-assignment of variable `bar` + --> self_assigning_variable.py:11:2 | 9 | bar, foo = bar, foo 10 | (foo, bar) = (foo, bar) @@ -90,8 +99,9 @@ error[PLW0127]: self_assigning_variable.py:11:2: Self-assignment of variable `ba 12 | foo, (bar, baz) = foo, (bar, baz) 13 | bar, (foo, baz) = bar, (foo, baz) | -error[PLW0127]: self_assigning_variable.py:11:7: Self-assignment of variable `foo` +error[PLW0127]: 11:7: Self-assignment of variable `foo` + --> self_assigning_variable.py:11:7 | 9 | bar, foo = bar, foo 10 | (foo, bar) = (foo, bar) @@ -100,8 +110,9 @@ error[PLW0127]: self_assigning_variable.py:11:7: Self-assignment of variable `fo 12 | foo, (bar, baz) = foo, (bar, baz) 13 | bar, (foo, baz) = bar, (foo, baz) | -error[PLW0127]: self_assigning_variable.py:12:1: Self-assignment of variable `foo` +error[PLW0127]: 12:1: Self-assignment of variable `foo` + --> self_assigning_variable.py:11:24 | 10 | (foo, bar) = (foo, bar) 11 | (bar, foo) = (bar, foo) @@ -110,8 +121,9 @@ error[PLW0127]: self_assigning_variable.py:12:1: Self-assignment of variable `fo 13 | bar, (foo, baz) = bar, (foo, baz) 14 | (foo, bar), baz = (foo, bar), baz | -error[PLW0127]: self_assigning_variable.py:12:7: Self-assignment of variable `bar` +error[PLW0127]: 12:7: Self-assignment of variable `bar` + --> self_assigning_variable.py:12:7 | 10 | (foo, bar) = (foo, bar) 11 | (bar, foo) = (bar, foo) @@ -120,8 +132,9 @@ error[PLW0127]: self_assigning_variable.py:12:7: Self-assignment of variable `ba 13 | bar, (foo, baz) = bar, (foo, baz) 14 | (foo, bar), baz = (foo, bar), baz | -error[PLW0127]: self_assigning_variable.py:12:12: Self-assignment of variable `baz` +error[PLW0127]: 12:12: Self-assignment of variable `baz` + --> self_assigning_variable.py:12:12 | 10 | (foo, bar) = (foo, bar) 11 | (bar, foo) = (bar, foo) @@ -130,8 +143,9 @@ error[PLW0127]: self_assigning_variable.py:12:12: Self-assignment of variable `b 13 | bar, (foo, baz) = bar, (foo, baz) 14 | (foo, bar), baz = (foo, bar), baz | -error[PLW0127]: self_assigning_variable.py:13:1: Self-assignment of variable `bar` +error[PLW0127]: 13:1: Self-assignment of variable `bar` + --> self_assigning_variable.py:12:34 | 11 | (bar, foo) = (bar, foo) 12 | foo, (bar, baz) = foo, (bar, baz) @@ -140,8 +154,9 @@ error[PLW0127]: self_assigning_variable.py:13:1: Self-assignment of variable `ba 14 | (foo, bar), baz = (foo, bar), baz 15 | (foo, (bar, baz)) = (foo, (bar, baz)) | -error[PLW0127]: self_assigning_variable.py:13:7: Self-assignment of variable `foo` +error[PLW0127]: 13:7: Self-assignment of variable `foo` + --> self_assigning_variable.py:13:7 | 11 | (bar, foo) = (bar, foo) 12 | foo, (bar, baz) = foo, (bar, baz) @@ -150,8 +165,9 @@ error[PLW0127]: self_assigning_variable.py:13:7: Self-assignment of variable `fo 14 | (foo, bar), baz = (foo, bar), baz 15 | (foo, (bar, baz)) = (foo, (bar, baz)) | -error[PLW0127]: self_assigning_variable.py:13:12: Self-assignment of variable `baz` +error[PLW0127]: 13:12: Self-assignment of variable `baz` + --> self_assigning_variable.py:13:12 | 11 | (bar, foo) = (bar, foo) 12 | foo, (bar, baz) = foo, (bar, baz) @@ -160,8 +176,9 @@ error[PLW0127]: self_assigning_variable.py:13:12: Self-assignment of variable `b 14 | (foo, bar), baz = (foo, bar), baz 15 | (foo, (bar, baz)) = (foo, (bar, baz)) | -error[PLW0127]: self_assigning_variable.py:14:2: Self-assignment of variable `foo` +error[PLW0127]: 14:2: Self-assignment of variable `foo` + --> self_assigning_variable.py:14:2 | 12 | foo, (bar, baz) = foo, (bar, baz) 13 | bar, (foo, baz) = bar, (foo, baz) @@ -170,8 +187,9 @@ error[PLW0127]: self_assigning_variable.py:14:2: Self-assignment of variable `fo 15 | (foo, (bar, baz)) = (foo, (bar, baz)) 16 | foo, bar = foo, 1 | -error[PLW0127]: self_assigning_variable.py:14:7: Self-assignment of variable `bar` +error[PLW0127]: 14:7: Self-assignment of variable `bar` + --> self_assigning_variable.py:14:7 | 12 | foo, (bar, baz) = foo, (bar, baz) 13 | bar, (foo, baz) = bar, (foo, baz) @@ -180,8 +198,9 @@ error[PLW0127]: self_assigning_variable.py:14:7: Self-assignment of variable `ba 15 | (foo, (bar, baz)) = (foo, (bar, baz)) 16 | foo, bar = foo, 1 | -error[PLW0127]: self_assigning_variable.py:14:13: Self-assignment of variable `baz` +error[PLW0127]: 14:13: Self-assignment of variable `baz` + --> self_assigning_variable.py:14:13 | 12 | foo, (bar, baz) = foo, (bar, baz) 13 | bar, (foo, baz) = bar, (foo, baz) @@ -190,8 +209,9 @@ error[PLW0127]: self_assigning_variable.py:14:13: Self-assignment of variable `b 15 | (foo, (bar, baz)) = (foo, (bar, baz)) 16 | foo, bar = foo, 1 | -error[PLW0127]: self_assigning_variable.py:15:2: Self-assignment of variable `foo` +error[PLW0127]: 15:2: Self-assignment of variable `foo` + --> self_assigning_variable.py:15:2 | 13 | bar, (foo, baz) = bar, (foo, baz) 14 | (foo, bar), baz = (foo, bar), baz @@ -200,8 +220,9 @@ error[PLW0127]: self_assigning_variable.py:15:2: Self-assignment of variable `fo 16 | foo, bar = foo, 1 17 | bar, foo = bar, 1 | -error[PLW0127]: self_assigning_variable.py:15:8: Self-assignment of variable `bar` +error[PLW0127]: 15:8: Self-assignment of variable `bar` + --> self_assigning_variable.py:15:8 | 13 | bar, (foo, baz) = bar, (foo, baz) 14 | (foo, bar), baz = (foo, bar), baz @@ -210,8 +231,9 @@ error[PLW0127]: self_assigning_variable.py:15:8: Self-assignment of variable `ba 16 | foo, bar = foo, 1 17 | bar, foo = bar, 1 | -error[PLW0127]: self_assigning_variable.py:15:13: Self-assignment of variable `baz` +error[PLW0127]: 15:13: Self-assignment of variable `baz` + --> self_assigning_variable.py:15:13 | 13 | bar, (foo, baz) = bar, (foo, baz) 14 | (foo, bar), baz = (foo, bar), baz @@ -220,8 +242,9 @@ error[PLW0127]: self_assigning_variable.py:15:13: Self-assignment of variable `b 16 | foo, bar = foo, 1 17 | bar, foo = bar, 1 | -error[PLW0127]: self_assigning_variable.py:16:1: Self-assignment of variable `foo` +error[PLW0127]: 16:1: Self-assignment of variable `foo` + --> self_assigning_variable.py:15:38 | 14 | (foo, bar), baz = (foo, bar), baz 15 | (foo, (bar, baz)) = (foo, (bar, baz)) @@ -230,8 +253,9 @@ error[PLW0127]: self_assigning_variable.py:16:1: Self-assignment of variable `fo 17 | bar, foo = bar, 1 18 | (foo, bar) = (foo, 1) | -error[PLW0127]: self_assigning_variable.py:17:1: Self-assignment of variable `bar` +error[PLW0127]: 17:1: Self-assignment of variable `bar` + --> self_assigning_variable.py:16:18 | 15 | (foo, (bar, baz)) = (foo, (bar, baz)) 16 | foo, bar = foo, 1 @@ -240,8 +264,9 @@ error[PLW0127]: self_assigning_variable.py:17:1: Self-assignment of variable `ba 18 | (foo, bar) = (foo, 1) 19 | (bar, foo) = (bar, 1) | -error[PLW0127]: self_assigning_variable.py:18:2: Self-assignment of variable `foo` +error[PLW0127]: 18:2: Self-assignment of variable `foo` + --> self_assigning_variable.py:18:2 | 16 | foo, bar = foo, 1 17 | bar, foo = bar, 1 @@ -250,8 +275,9 @@ error[PLW0127]: self_assigning_variable.py:18:2: Self-assignment of variable `fo 19 | (bar, foo) = (bar, 1) 20 | foo, (bar, baz) = foo, (bar, 1) | -error[PLW0127]: self_assigning_variable.py:19:2: Self-assignment of variable `bar` +error[PLW0127]: 19:2: Self-assignment of variable `bar` + --> self_assigning_variable.py:19:2 | 17 | bar, foo = bar, 1 18 | (foo, bar) = (foo, 1) @@ -260,8 +286,9 @@ error[PLW0127]: self_assigning_variable.py:19:2: Self-assignment of variable `ba 20 | foo, (bar, baz) = foo, (bar, 1) 21 | bar, (foo, baz) = bar, (foo, 1) | -error[PLW0127]: self_assigning_variable.py:20:1: Self-assignment of variable `foo` +error[PLW0127]: 20:1: Self-assignment of variable `foo` + --> self_assigning_variable.py:19:22 | 18 | (foo, bar) = (foo, 1) 19 | (bar, foo) = (bar, 1) @@ -270,8 +297,9 @@ error[PLW0127]: self_assigning_variable.py:20:1: Self-assignment of variable `fo 21 | bar, (foo, baz) = bar, (foo, 1) 22 | (foo, bar), baz = (foo, bar), 1 | -error[PLW0127]: self_assigning_variable.py:20:7: Self-assignment of variable `bar` +error[PLW0127]: 20:7: Self-assignment of variable `bar` + --> self_assigning_variable.py:20:7 | 18 | (foo, bar) = (foo, 1) 19 | (bar, foo) = (bar, 1) @@ -280,8 +308,9 @@ error[PLW0127]: self_assigning_variable.py:20:7: Self-assignment of variable `ba 21 | bar, (foo, baz) = bar, (foo, 1) 22 | (foo, bar), baz = (foo, bar), 1 | -error[PLW0127]: self_assigning_variable.py:21:1: Self-assignment of variable `bar` +error[PLW0127]: 21:1: Self-assignment of variable `bar` + --> self_assigning_variable.py:20:32 | 19 | (bar, foo) = (bar, 1) 20 | foo, (bar, baz) = foo, (bar, 1) @@ -290,8 +319,9 @@ error[PLW0127]: self_assigning_variable.py:21:1: Self-assignment of variable `ba 22 | (foo, bar), baz = (foo, bar), 1 23 | (foo, (bar, baz)) = (foo, (bar, 1)) | -error[PLW0127]: self_assigning_variable.py:21:7: Self-assignment of variable `foo` +error[PLW0127]: 21:7: Self-assignment of variable `foo` + --> self_assigning_variable.py:21:7 | 19 | (bar, foo) = (bar, 1) 20 | foo, (bar, baz) = foo, (bar, 1) @@ -300,8 +330,9 @@ error[PLW0127]: self_assigning_variable.py:21:7: Self-assignment of variable `fo 22 | (foo, bar), baz = (foo, bar), 1 23 | (foo, (bar, baz)) = (foo, (bar, 1)) | -error[PLW0127]: self_assigning_variable.py:22:2: Self-assignment of variable `foo` +error[PLW0127]: 22:2: Self-assignment of variable `foo` + --> self_assigning_variable.py:22:2 | 20 | foo, (bar, baz) = foo, (bar, 1) 21 | bar, (foo, baz) = bar, (foo, 1) @@ -310,8 +341,9 @@ error[PLW0127]: self_assigning_variable.py:22:2: Self-assignment of variable `fo 23 | (foo, (bar, baz)) = (foo, (bar, 1)) 24 | foo: int = foo | -error[PLW0127]: self_assigning_variable.py:22:7: Self-assignment of variable `bar` +error[PLW0127]: 22:7: Self-assignment of variable `bar` + --> self_assigning_variable.py:22:7 | 20 | foo, (bar, baz) = foo, (bar, 1) 21 | bar, (foo, baz) = bar, (foo, 1) @@ -320,8 +352,9 @@ error[PLW0127]: self_assigning_variable.py:22:7: Self-assignment of variable `ba 23 | (foo, (bar, baz)) = (foo, (bar, 1)) 24 | foo: int = foo | -error[PLW0127]: self_assigning_variable.py:23:2: Self-assignment of variable `foo` +error[PLW0127]: 23:2: Self-assignment of variable `foo` + --> self_assigning_variable.py:23:2 | 21 | bar, (foo, baz) = bar, (foo, 1) 22 | (foo, bar), baz = (foo, bar), 1 @@ -330,8 +363,9 @@ error[PLW0127]: self_assigning_variable.py:23:2: Self-assignment of variable `fo 24 | foo: int = foo 25 | bar: int = bar | -error[PLW0127]: self_assigning_variable.py:23:8: Self-assignment of variable `bar` +error[PLW0127]: 23:8: Self-assignment of variable `bar` + --> self_assigning_variable.py:23:8 | 21 | bar, (foo, baz) = bar, (foo, 1) 22 | (foo, bar), baz = (foo, bar), 1 @@ -340,8 +374,9 @@ error[PLW0127]: self_assigning_variable.py:23:8: Self-assignment of variable `ba 24 | foo: int = foo 25 | bar: int = bar | -error[PLW0127]: self_assigning_variable.py:24:1: Self-assignment of variable `foo` +error[PLW0127]: 24:1: Self-assignment of variable `foo` + --> self_assigning_variable.py:23:36 | 22 | (foo, bar), baz = (foo, bar), 1 23 | (foo, (bar, baz)) = (foo, (bar, 1)) @@ -350,8 +385,9 @@ error[PLW0127]: self_assigning_variable.py:24:1: Self-assignment of variable `fo 25 | bar: int = bar 26 | foo = foo = bar | -error[PLW0127]: self_assigning_variable.py:25:1: Self-assignment of variable `bar` +error[PLW0127]: 25:1: Self-assignment of variable `bar` + --> self_assigning_variable.py:24:15 | 23 | (foo, (bar, baz)) = (foo, (bar, 1)) 24 | foo: int = foo @@ -360,8 +396,9 @@ error[PLW0127]: self_assigning_variable.py:25:1: Self-assignment of variable `ba 26 | foo = foo = bar 27 | (foo, bar) = (foo, bar) = baz | -error[PLW0127]: self_assigning_variable.py:26:1: Self-assignment of variable `foo` +error[PLW0127]: 26:1: Self-assignment of variable `foo` + --> self_assigning_variable.py:25:15 | 24 | foo: int = foo 25 | bar: int = bar @@ -370,8 +407,9 @@ error[PLW0127]: self_assigning_variable.py:26:1: Self-assignment of variable `fo 27 | (foo, bar) = (foo, bar) = baz 28 | (foo, bar) = baz = (foo, bar) = 1 | -error[PLW0127]: self_assigning_variable.py:27:2: Self-assignment of variable `foo` +error[PLW0127]: 27:2: Self-assignment of variable `foo` + --> self_assigning_variable.py:27:2 | 25 | bar: int = bar 26 | foo = foo = bar @@ -379,8 +417,9 @@ error[PLW0127]: self_assigning_variable.py:27:2: Self-assignment of variable `fo | ^^^ 28 | (foo, bar) = baz = (foo, bar) = 1 | -error[PLW0127]: self_assigning_variable.py:27:7: Self-assignment of variable `bar` +error[PLW0127]: 27:7: Self-assignment of variable `bar` + --> self_assigning_variable.py:27:7 | 25 | bar: int = bar 26 | foo = foo = bar @@ -388,8 +427,9 @@ error[PLW0127]: self_assigning_variable.py:27:7: Self-assignment of variable `ba | ^^^ 28 | (foo, bar) = baz = (foo, bar) = 1 | -error[PLW0127]: self_assigning_variable.py:28:2: Self-assignment of variable `foo` +error[PLW0127]: 28:2: Self-assignment of variable `foo` + --> self_assigning_variable.py:28:2 | 26 | foo = foo = bar 27 | (foo, bar) = (foo, bar) = baz @@ -398,8 +438,9 @@ error[PLW0127]: self_assigning_variable.py:28:2: Self-assignment of variable `fo 29 | 30 | # Non-errors. | -error[PLW0127]: self_assigning_variable.py:28:7: Self-assignment of variable `bar` +error[PLW0127]: 28:7: Self-assignment of variable `bar` + --> self_assigning_variable.py:28:7 | 26 | foo = foo = bar 27 | (foo, bar) = (foo, bar) = baz diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0128_redeclared_assigned_name.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0128_redeclared_assigned_name.py.snap index 50d5cfb44a..27ce21802a 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0128_redeclared_assigned_name.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0128_redeclared_assigned_name.py.snap @@ -1,16 +1,18 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLW0128]: redeclared_assigned_name.py:1:8: Redeclared variable `FIRST` in assignment +error[PLW0128]: 1:8: Redeclared variable `FIRST` in assignment + --> redeclared_assigned_name.py:1:8 | 1 | FIRST, FIRST = (1, 2) # PLW0128 | ^^^^^ 2 | FIRST, (FIRST, SECOND) = (1, (1, 2)) # PLW0128 3 | FIRST, (FIRST, SECOND, (THIRD, FIRST)) = (1, (1, 2)) # PLW0128 | -error[PLW0128]: redeclared_assigned_name.py:2:9: Redeclared variable `FIRST` in assignment +error[PLW0128]: 2:9: Redeclared variable `FIRST` in assignment + --> redeclared_assigned_name.py:2:9 | 1 | FIRST, FIRST = (1, 2) # PLW0128 2 | FIRST, (FIRST, SECOND) = (1, (1, 2)) # PLW0128 @@ -18,8 +20,9 @@ error[PLW0128]: redeclared_assigned_name.py:2:9: Redeclared variable `FIRST` in 3 | FIRST, (FIRST, SECOND, (THIRD, FIRST)) = (1, (1, 2)) # PLW0128 4 | FIRST, SECOND, THIRD, FIRST, SECOND = (1, 2, 3, 4) # PLW0128 | -error[PLW0128]: redeclared_assigned_name.py:3:9: Redeclared variable `FIRST` in assignment +error[PLW0128]: 3:9: Redeclared variable `FIRST` in assignment + --> redeclared_assigned_name.py:3:9 | 1 | FIRST, FIRST = (1, 2) # PLW0128 2 | FIRST, (FIRST, SECOND) = (1, (1, 2)) # PLW0128 @@ -27,8 +30,9 @@ error[PLW0128]: redeclared_assigned_name.py:3:9: Redeclared variable `FIRST` in | ^^^^^ 4 | FIRST, SECOND, THIRD, FIRST, SECOND = (1, 2, 3, 4) # PLW0128 | -error[PLW0128]: redeclared_assigned_name.py:3:32: Redeclared variable `FIRST` in assignment +error[PLW0128]: 3:32: Redeclared variable `FIRST` in assignment + --> redeclared_assigned_name.py:3:32 | 1 | FIRST, FIRST = (1, 2) # PLW0128 2 | FIRST, (FIRST, SECOND) = (1, (1, 2)) # PLW0128 @@ -36,8 +40,9 @@ error[PLW0128]: redeclared_assigned_name.py:3:32: Redeclared variable `FIRST` in | ^^^^^ 4 | FIRST, SECOND, THIRD, FIRST, SECOND = (1, 2, 3, 4) # PLW0128 | -error[PLW0128]: redeclared_assigned_name.py:4:23: Redeclared variable `FIRST` in assignment +error[PLW0128]: 4:23: Redeclared variable `FIRST` in assignment + --> redeclared_assigned_name.py:4:23 | 2 | FIRST, (FIRST, SECOND) = (1, (1, 2)) # PLW0128 3 | FIRST, (FIRST, SECOND, (THIRD, FIRST)) = (1, (1, 2)) # PLW0128 @@ -46,8 +51,9 @@ error[PLW0128]: redeclared_assigned_name.py:4:23: Redeclared variable `FIRST` in 5 | 6 | FIRST, SECOND, _, _, _ignored = (1, 2, 3, 4, 5) # OK | -error[PLW0128]: redeclared_assigned_name.py:4:30: Redeclared variable `SECOND` in assignment +error[PLW0128]: 4:30: Redeclared variable `SECOND` in assignment + --> redeclared_assigned_name.py:4:30 | 2 | FIRST, (FIRST, SECOND) = (1, (1, 2)) # PLW0128 3 | FIRST, (FIRST, SECOND, (THIRD, FIRST)) = (1, (1, 2)) # PLW0128 diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0129_assert_on_string_literal.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0129_assert_on_string_literal.py.snap index 7fc01448f0..72d7c47cd6 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0129_assert_on_string_literal.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0129_assert_on_string_literal.py.snap @@ -1,16 +1,18 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLW0129]: assert_on_string_literal.py:3:12: Asserting on a non-empty string literal will always pass +error[PLW0129]: 3:12: Asserting on a non-empty string literal will always pass + --> assert_on_string_literal.py:3:12 | 1 | def test_division(): 2 | a = 9 / 3 3 | assert "No ZeroDivisionError were raised" # [assert-on-string-literal] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -error[PLW0129]: assert_on_string_literal.py:12:12: Asserting on a non-empty string literal will always pass +error[PLW0129]: 12:12: Asserting on a non-empty string literal will always pass + --> assert_on_string_literal.py:12:12 | 11 | try: 12 | assert "bad" # [assert-on-string-literal] @@ -18,8 +20,9 @@ error[PLW0129]: assert_on_string_literal.py:12:12: Asserting on a non-empty stri 13 | except: 14 | assert "bad again" # [assert-on-string-literal] | -error[PLW0129]: assert_on_string_literal.py:14:12: Asserting on a non-empty string literal will always pass +error[PLW0129]: 14:12: Asserting on a non-empty string literal will always pass + --> assert_on_string_literal.py:14:12 | 12 | assert "bad" # [assert-on-string-literal] 13 | except: @@ -28,8 +31,9 @@ error[PLW0129]: assert_on_string_literal.py:14:12: Asserting on a non-empty stri 15 | 16 | a = 12 | -error[PLW0129]: assert_on_string_literal.py:17:8: Asserting on a non-empty string literal will always pass +error[PLW0129]: 17:8: Asserting on a non-empty string literal will always pass + --> assert_on_string_literal.py:17:8 | 16 | a = 12 17 | assert f"hello {a}" # [assert-on-string-literal] @@ -37,8 +41,9 @@ error[PLW0129]: assert_on_string_literal.py:17:8: Asserting on a non-empty strin 18 | assert f"{a}" # [assert-on-string-literal] 19 | assert f"" # [assert-on-string-literal] | -error[PLW0129]: assert_on_string_literal.py:18:8: Asserting on a string literal may have unintended results +error[PLW0129]: 18:8: Asserting on a string literal may have unintended results + --> assert_on_string_literal.py:18:8 | 16 | a = 12 17 | assert f"hello {a}" # [assert-on-string-literal] @@ -47,8 +52,9 @@ error[PLW0129]: assert_on_string_literal.py:18:8: Asserting on a string literal 19 | assert f"" # [assert-on-string-literal] 20 | assert "" # [assert-on-string-literal] | -error[PLW0129]: assert_on_string_literal.py:19:8: Asserting on an empty string literal will never pass +error[PLW0129]: 19:8: Asserting on an empty string literal will never pass + --> assert_on_string_literal.py:19:8 | 17 | assert f"hello {a}" # [assert-on-string-literal] 18 | assert f"{a}" # [assert-on-string-literal] @@ -57,8 +63,9 @@ error[PLW0129]: assert_on_string_literal.py:19:8: Asserting on an empty string l 20 | assert "" # [assert-on-string-literal] 21 | assert b"hello" # [assert-on-string-literal] | -error[PLW0129]: assert_on_string_literal.py:20:8: Asserting on an empty string literal will never pass +error[PLW0129]: 20:8: Asserting on an empty string literal will never pass + --> assert_on_string_literal.py:20:8 | 18 | assert f"{a}" # [assert-on-string-literal] 19 | assert f"" # [assert-on-string-literal] @@ -67,8 +74,9 @@ error[PLW0129]: assert_on_string_literal.py:20:8: Asserting on an empty string l 21 | assert b"hello" # [assert-on-string-literal] 22 | assert "", b"hi" # [assert-on-string-literal] | -error[PLW0129]: assert_on_string_literal.py:21:8: Asserting on a non-empty string literal will always pass +error[PLW0129]: 21:8: Asserting on a non-empty string literal will always pass + --> assert_on_string_literal.py:21:8 | 19 | assert f"" # [assert-on-string-literal] 20 | assert "" # [assert-on-string-literal] @@ -77,8 +85,9 @@ error[PLW0129]: assert_on_string_literal.py:21:8: Asserting on a non-empty strin 22 | assert "", b"hi" # [assert-on-string-literal] 23 | assert "WhyNotHere?", "HereIsOk" # [assert-on-string-literal] | -error[PLW0129]: assert_on_string_literal.py:22:8: Asserting on an empty string literal will never pass +error[PLW0129]: 22:8: Asserting on an empty string literal will never pass + --> assert_on_string_literal.py:22:8 | 20 | assert "" # [assert-on-string-literal] 21 | assert b"hello" # [assert-on-string-literal] @@ -87,8 +96,9 @@ error[PLW0129]: assert_on_string_literal.py:22:8: Asserting on an empty string l 23 | assert "WhyNotHere?", "HereIsOk" # [assert-on-string-literal] 24 | assert 12, "ok here" | -error[PLW0129]: assert_on_string_literal.py:23:8: Asserting on a non-empty string literal will always pass +error[PLW0129]: 23:8: Asserting on a non-empty string literal will always pass + --> assert_on_string_literal.py:23:8 | 21 | assert b"hello" # [assert-on-string-literal] 22 | assert "", b"hi" # [assert-on-string-literal] diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0131_named_expr_without_context.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0131_named_expr_without_context.py.snap index ad3e8488c9..fd9143d99f 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0131_named_expr_without_context.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0131_named_expr_without_context.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLW0131]: named_expr_without_context.py:2:2: Named expression used without context +error[PLW0131]: 2:2: Named expression used without context + --> named_expr_without_context.py:2:2 | 1 | # Errors 2 | (a := 42) @@ -10,16 +11,18 @@ error[PLW0131]: named_expr_without_context.py:2:2: Named expression used without 3 | if True: 4 | (b := 1) | -error[PLW0131]: named_expr_without_context.py:4:6: Named expression used without context +error[PLW0131]: 4:6: Named expression used without context + --> named_expr_without_context.py:4:6 | 2 | (a := 42) 3 | if True: 4 | (b := 1) | ^^^^^^ | -error[PLW0131]: named_expr_without_context.py:8:6: Named expression used without context +error[PLW0131]: 8:6: Named expression used without context + --> named_expr_without_context.py:8:6 | 7 | class Foo: 8 | (c := 1) diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0133_useless_exception_statement.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0133_useless_exception_statement.py.snap index b157d08b5c..21e06e5298 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0133_useless_exception_statement.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0133_useless_exception_statement.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLW0133]: useless_exception_statement.py:7:5: [*] Missing `raise` statement on exception +error[PLW0133]: 7:5: [*] Missing `raise` statement on exception + --> useless_exception_statement.py:7:5 | 5 | # Test case 1: Useless exception statement 6 | def func(): @@ -20,8 +21,9 @@ error[PLW0133]: useless_exception_statement.py:7:5: [*] Missing `raise` statemen 9 9 | 10 10 | # Test case 2: Useless exception statement in try-except block -error[PLW0133]: useless_exception_statement.py:13:9: [*] Missing `raise` statement on exception +error[PLW0133]: 13:9: [*] Missing `raise` statement on exception + --> useless_exception_statement.py:13:9 | 11 | def func(): 12 | try: @@ -41,8 +43,9 @@ error[PLW0133]: useless_exception_statement.py:13:9: [*] Missing `raise` stateme 15 15 | pass 16 16 | -error[PLW0133]: useless_exception_statement.py:21:9: [*] Missing `raise` statement on exception +error[PLW0133]: 21:9: [*] Missing `raise` statement on exception + --> useless_exception_statement.py:21:9 | 19 | def func(): 20 | if True: @@ -60,8 +63,9 @@ error[PLW0133]: useless_exception_statement.py:21:9: [*] Missing `raise` stateme 23 23 | 24 24 | # Test case 4: Useless exception statement in class -error[PLW0133]: useless_exception_statement.py:28:13: [*] Missing `raise` statement on exception +error[PLW0133]: 28:13: [*] Missing `raise` statement on exception + --> useless_exception_statement.py:28:13 | 26 | class Class: 27 | def __init__(self): @@ -79,8 +83,9 @@ error[PLW0133]: useless_exception_statement.py:28:13: [*] Missing `raise` statem 30 30 | 31 31 | # Test case 5: Useless exception statement in function -error[PLW0133]: useless_exception_statement.py:34:9: [*] Missing `raise` statement on exception +error[PLW0133]: 34:9: [*] Missing `raise` statement on exception + --> useless_exception_statement.py:34:9 | 32 | def func(): 33 | def inner(): @@ -100,8 +105,9 @@ error[PLW0133]: useless_exception_statement.py:34:9: [*] Missing `raise` stateme 36 36 | inner() 37 37 | -error[PLW0133]: useless_exception_statement.py:42:9: [*] Missing `raise` statement on exception +error[PLW0133]: 42:9: [*] Missing `raise` statement on exception + --> useless_exception_statement.py:42:9 | 40 | def func(): 41 | while True: @@ -119,8 +125,9 @@ error[PLW0133]: useless_exception_statement.py:42:9: [*] Missing `raise` stateme 44 44 | 45 45 | # Test case 7: Useless exception statement in abstract class -error[PLW0133]: useless_exception_statement.py:50:13: [*] Missing `raise` statement on exception +error[PLW0133]: 50:13: [*] Missing `raise` statement on exception + --> useless_exception_statement.py:50:13 | 48 | @abstractmethod 49 | def method(self): @@ -138,8 +145,9 @@ error[PLW0133]: useless_exception_statement.py:50:13: [*] Missing `raise` statem 52 52 | 53 53 | # Test case 8: Useless exception statement inside context manager -error[PLW0133]: useless_exception_statement.py:56:9: [*] Missing `raise` statement on exception +error[PLW0133]: 56:9: [*] Missing `raise` statement on exception + --> useless_exception_statement.py:56:9 | 54 | def func(): 55 | with suppress(AttributeError): @@ -157,8 +165,9 @@ error[PLW0133]: useless_exception_statement.py:56:9: [*] Missing `raise` stateme 58 58 | 59 59 | # Test case 9: Useless exception statement in parentheses -error[PLW0133]: useless_exception_statement.py:61:5: [*] Missing `raise` statement on exception +error[PLW0133]: 61:5: [*] Missing `raise` statement on exception + --> useless_exception_statement.py:61:5 | 59 | # Test case 9: Useless exception statement in parentheses 60 | def func(): @@ -176,8 +185,9 @@ error[PLW0133]: useless_exception_statement.py:61:5: [*] Missing `raise` stateme 63 63 | 64 64 | # Test case 10: Useless exception statement in continuation -error[PLW0133]: useless_exception_statement.py:66:12: [*] Missing `raise` statement on exception +error[PLW0133]: 66:12: [*] Missing `raise` statement on exception + --> useless_exception_statement.py:66:12 | 64 | # Test case 10: Useless exception statement in continuation 65 | def func(): @@ -195,8 +205,9 @@ error[PLW0133]: useless_exception_statement.py:66:12: [*] Missing `raise` statem 68 68 | 69 69 | # Test case 11: Useless warning statement -error[PLW0133]: useless_exception_statement.py:71:5: [*] Missing `raise` statement on exception +error[PLW0133]: 71:5: [*] Missing `raise` statement on exception + --> useless_exception_statement.py:71:5 | 69 | # Test case 11: Useless warning statement 70 | def func(): diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0177_nan_comparison.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0177_nan_comparison.py.snap index e4a3a79ab3..97653e3014 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0177_nan_comparison.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0177_nan_comparison.py.snap @@ -1,88 +1,99 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLW0177]: nan_comparison.py:11:9: Comparing against a NaN value; use `math.isnan` instead +error[PLW0177]: 11:9: Comparing against a NaN value; use `math.isnan` instead + --> nan_comparison.py:11:9 | 10 | # PLW0117 11 | if x == float("nan"): | ^^^^^^^^^^^^ 12 | pass | -error[PLW0177]: nan_comparison.py:15:9: Comparing against a NaN value; use `math.isnan` instead +error[PLW0177]: 15:9: Comparing against a NaN value; use `math.isnan` instead + --> nan_comparison.py:15:9 | 14 | # PLW0117 15 | if x == float("NaN"): | ^^^^^^^^^^^^ 16 | pass | -error[PLW0177]: nan_comparison.py:19:9: Comparing against a NaN value; use `math.isnan` instead +error[PLW0177]: 19:9: Comparing against a NaN value; use `math.isnan` instead + --> nan_comparison.py:19:9 | 18 | # PLW0117 19 | if x == float("NAN"): | ^^^^^^^^^^^^ 20 | pass | -error[PLW0177]: nan_comparison.py:23:9: Comparing against a NaN value; use `math.isnan` instead +error[PLW0177]: 23:9: Comparing against a NaN value; use `math.isnan` instead + --> nan_comparison.py:23:9 | 22 | # PLW0117 23 | if x == float("Nan"): | ^^^^^^^^^^^^ 24 | pass | -error[PLW0177]: nan_comparison.py:27:9: Comparing against a NaN value; use `math.isnan` instead +error[PLW0177]: 27:9: Comparing against a NaN value; use `math.isnan` instead + --> nan_comparison.py:27:9 | 26 | # PLW0117 27 | if x == math.nan: | ^^^^^^^^ 28 | pass | -error[PLW0177]: nan_comparison.py:31:9: Comparing against a NaN value; use `math.isnan` instead +error[PLW0177]: 31:9: Comparing against a NaN value; use `math.isnan` instead + --> nan_comparison.py:31:9 | 30 | # PLW0117 31 | if x == bad_val: | ^^^^^^^ 32 | pass | -error[PLW0177]: nan_comparison.py:35:9: Comparing against a NaN value; use `np.isnan` instead +error[PLW0177]: 35:9: Comparing against a NaN value; use `np.isnan` instead + --> nan_comparison.py:35:9 | 34 | # PLW0117 35 | if y == np.NaN: | ^^^^^^ 36 | pass | -error[PLW0177]: nan_comparison.py:39:9: Comparing against a NaN value; use `np.isnan` instead +error[PLW0177]: 39:9: Comparing against a NaN value; use `np.isnan` instead + --> nan_comparison.py:39:9 | 38 | # PLW0117 39 | if y == np.NAN: | ^^^^^^ 40 | pass | -error[PLW0177]: nan_comparison.py:43:9: Comparing against a NaN value; use `np.isnan` instead +error[PLW0177]: 43:9: Comparing against a NaN value; use `np.isnan` instead + --> nan_comparison.py:43:9 | 42 | # PLW0117 43 | if y == np.nan: | ^^^^^^ 44 | pass | -error[PLW0177]: nan_comparison.py:47:9: Comparing against a NaN value; use `np.isnan` instead +error[PLW0177]: 47:9: Comparing against a NaN value; use `np.isnan` instead + --> nan_comparison.py:47:9 | 46 | # PLW0117 47 | if y == npy_nan: | ^^^^^^^ 48 | pass | -error[PLW0177]: nan_comparison.py:53:9: Comparing against a NaN value; use `math.isnan` instead +error[PLW0177]: 53:9: Comparing against a NaN value; use `math.isnan` instead + --> nan_comparison.py:53:9 | 52 | # PLW0117 53 | if x == builtins.float("nan"): diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0211_bad_staticmethod_argument.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0211_bad_staticmethod_argument.py.snap index 6420d2847a..5e8d0a9322 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0211_bad_staticmethod_argument.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0211_bad_staticmethod_argument.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLW0211]: bad_staticmethod_argument.py:3:13: First argument of a static method should not be named `self` +error[PLW0211]: 3:13: First argument of a static method should not be named `self` + --> bad_staticmethod_argument.py:3:13 | 1 | class Wolf: 2 | @staticmethod @@ -10,8 +11,9 @@ error[PLW0211]: bad_staticmethod_argument.py:3:13: First argument of a static me | ^^^^ 4 | pass | -error[PLW0211]: bad_staticmethod_argument.py:15:13: First argument of a static method should not be named `cls` +error[PLW0211]: 15:13: First argument of a static method should not be named `cls` + --> bad_staticmethod_argument.py:15:13 | 13 | class Sheep: 14 | @staticmethod @@ -19,8 +21,9 @@ error[PLW0211]: bad_staticmethod_argument.py:15:13: First argument of a static m | ^^^ 16 | pass | -error[PLW0211]: bad_staticmethod_argument.py:19:15: First argument of a static method should not be named `self` +error[PLW0211]: 19:15: First argument of a static method should not be named `self` + --> bad_staticmethod_argument.py:19:15 | 18 | @staticmethod 19 | def sleep(self, x, y, z): # [bad-staticmethod-argument] diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0245_super_without_brackets.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0245_super_without_brackets.py.snap index 1d73a1eee1..5c391ae364 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0245_super_without_brackets.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0245_super_without_brackets.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLW0245]: super_without_brackets.py:10:26: [*] `super` call is missing parentheses +error[PLW0245]: 10:26: [*] `super` call is missing parentheses + --> super_without_brackets.py:10:26 | 8 | @staticmethod 9 | def speak(): diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0406_import_self__module.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0406_import_self__module.py.snap index a3babe0c8b..1b84e24b99 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0406_import_self__module.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0406_import_self__module.py.snap @@ -1,24 +1,27 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLW0406]: module.py:1:8: Module `import_self.module` imports itself +error[PLW0406]: 1:8: Module `import_self.module` imports itself + --> module.py:1:8 | 1 | import import_self.module | ^^^^^^^^^^^^^^^^^^ 2 | from import_self import module 3 | from . import module | -error[PLW0406]: module.py:2:25: Module `import_self.module` imports itself +error[PLW0406]: 2:25: Module `import_self.module` imports itself + --> module.py:2:25 | 1 | import import_self.module 2 | from import_self import module | ^^^^^^ 3 | from . import module | -error[PLW0406]: module.py:3:15: Module `import_self.module` imports itself +error[PLW0406]: 3:15: Module `import_self.module` imports itself + --> module.py:3:15 | 1 | import import_self.module 2 | from import_self import module diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0602_global_variable_not_assigned.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0602_global_variable_not_assigned.py.snap index b572be7562..023e89cea2 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0602_global_variable_not_assigned.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0602_global_variable_not_assigned.py.snap @@ -1,16 +1,18 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLW0602]: global_variable_not_assigned.py:5:12: Using global for `X` but no assignment is done +error[PLW0602]: 5:12: Using global for `X` but no assignment is done + --> global_variable_not_assigned.py:5:12 | 3 | ### 4 | def f(): 5 | global X | ^ | -error[PLW0602]: global_variable_not_assigned.py:9:12: Using global for `X` but no assignment is done +error[PLW0602]: 9:12: Using global for `X` but no assignment is done + --> global_variable_not_assigned.py:9:12 | 8 | def f(): 9 | global X diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0603_global_statement.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0603_global_statement.py.snap index fa8b787cc8..9b9d277d44 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0603_global_statement.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0603_global_statement.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLW0603]: global_statement.py:17:12: Using the global statement to update `CONSTANT` is discouraged +error[PLW0603]: 17:12: Using the global statement to update `CONSTANT` is discouraged + --> global_statement.py:17:12 | 15 | def fix_constant(value): 16 | """All this is ok, but try not to use `global` ;)""" @@ -11,8 +12,9 @@ error[PLW0603]: global_statement.py:17:12: Using the global statement to update 18 | print(CONSTANT) 19 | CONSTANT = value | -error[PLW0603]: global_statement.py:24:12: Using the global statement to update `sys` is discouraged +error[PLW0603]: 24:12: Using the global statement to update `sys` is discouraged + --> global_statement.py:24:12 | 22 | def global_with_import(): 23 | """Should only warn for global-statement when using `Import` node""" @@ -20,8 +22,9 @@ error[PLW0603]: global_statement.py:24:12: Using the global statement to update | ^^^ 25 | import sys | -error[PLW0603]: global_statement.py:30:12: Using the global statement to update `namedtuple` is discouraged +error[PLW0603]: 30:12: Using the global statement to update `namedtuple` is discouraged + --> global_statement.py:30:12 | 28 | def global_with_import_from(): 29 | """Should only warn for global-statement when using `ImportFrom` node""" @@ -29,8 +32,9 @@ error[PLW0603]: global_statement.py:30:12: Using the global statement to update | ^^^^^^^^^^ 31 | from collections import namedtuple | -error[PLW0603]: global_statement.py:36:12: Using the global statement to update `CONSTANT` is discouraged +error[PLW0603]: 36:12: Using the global statement to update `CONSTANT` is discouraged + --> global_statement.py:36:12 | 34 | def global_del(): 35 | """Deleting the global name prevents `global-variable-not-assigned`""" @@ -39,8 +43,9 @@ error[PLW0603]: global_statement.py:36:12: Using the global statement to update 37 | print(CONSTANT) 38 | del CONSTANT | -error[PLW0603]: global_statement.py:43:12: Using the global statement to update `CONSTANT` is discouraged +error[PLW0603]: 43:12: Using the global statement to update `CONSTANT` is discouraged + --> global_statement.py:43:12 | 41 | def global_operator_assign(): 42 | """Operator assigns should only throw a global statement error""" @@ -49,8 +54,9 @@ error[PLW0603]: global_statement.py:43:12: Using the global statement to update 44 | print(CONSTANT) 45 | CONSTANT += 1 | -error[PLW0603]: global_statement.py:50:12: Using the global statement to update `CONSTANT` is discouraged +error[PLW0603]: 50:12: Using the global statement to update `CONSTANT` is discouraged + --> global_statement.py:50:12 | 48 | def global_function_assign(): 49 | """Function assigns should only throw a global statement error""" @@ -59,8 +65,9 @@ error[PLW0603]: global_statement.py:50:12: Using the global statement to update 51 | 52 | def CONSTANT(): | -error[PLW0603]: global_statement.py:60:12: Using the global statement to update `FUNC` is discouraged +error[PLW0603]: 60:12: Using the global statement to update `FUNC` is discouraged + --> global_statement.py:60:12 | 58 | def override_func(): 59 | """Overriding a function should only throw a global statement error""" @@ -69,8 +76,9 @@ error[PLW0603]: global_statement.py:60:12: Using the global statement to update 61 | 62 | def FUNC(): | -error[PLW0603]: global_statement.py:70:12: Using the global statement to update `CLASS` is discouraged +error[PLW0603]: 70:12: Using the global statement to update `CLASS` is discouraged + --> global_statement.py:70:12 | 68 | def override_class(): 69 | """Overriding a class should only throw a global statement error""" @@ -79,8 +87,9 @@ error[PLW0603]: global_statement.py:70:12: Using the global statement to update 71 | 72 | class CLASS: | -error[PLW0603]: global_statement.py:80:12: Using the global statement to update `CONSTANT` is discouraged +error[PLW0603]: 80:12: Using the global statement to update `CONSTANT` is discouraged + --> global_statement.py:80:12 | 78 | def multiple_assignment(): 79 | """Should warn on every assignment.""" @@ -89,8 +98,9 @@ error[PLW0603]: global_statement.py:80:12: Using the global statement to update 81 | CONSTANT = 1 82 | CONSTANT = 2 | -error[PLW0603]: global_statement.py:80:12: Using the global statement to update `CONSTANT` is discouraged +error[PLW0603]: 80:12: Using the global statement to update `CONSTANT` is discouraged + --> global_statement.py:80:12 | 78 | def multiple_assignment(): 79 | """Should warn on every assignment.""" diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0604_global_at_module_level.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0604_global_at_module_level.py.snap index 50916ead72..778e685de8 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0604_global_at_module_level.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0604_global_at_module_level.py.snap @@ -1,16 +1,18 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLW0604]: global_at_module_level.py:1:1: `global` at module level is redundant +error[PLW0604]: 1:1: `global` at module level is redundant + --> global_at_module_level.py:1:1 | 1 | global price # W0604 | ^^^^^^^^^^^^ 2 | 3 | price = 25 | -error[PLW0604]: global_at_module_level.py:6:5: `global` at module level is redundant +error[PLW0604]: 6:5: `global` at module level is redundant + --> global_at_module_level.py:6:5 | 5 | if True: 6 | global X # W0604 diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0642_self_or_cls_assignment.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0642_self_or_cls_assignment.py.snap index 315998894e..cfd50c39a3 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0642_self_or_cls_assignment.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0642_self_or_cls_assignment.py.snap @@ -1,151 +1,166 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -self_or_cls_assignment.py:4:9: PLW0642 Reassigned `cls` variable in class method +error[PLW0642]: 4:9: Reassigned `cls` variable in class method + + --> self_or_cls_assignment.py:4:9 | 2 | @classmethod 3 | def list_fruits(cls) -> None: 4 | cls = "apple" # PLW0642 - | ^^^ PLW0642 + | ^^^ 5 | cls: Fruit = "apple" # PLW0642 6 | cls += "orange" # OK, augmented assignments are ignored | = help: Consider using a different variable name +error[PLW0642]: 5:9: Reassigned `cls` variable in class method -self_or_cls_assignment.py:5:9: PLW0642 Reassigned `cls` variable in class method + --> self_or_cls_assignment.py:5:9 | 3 | def list_fruits(cls) -> None: 4 | cls = "apple" # PLW0642 5 | cls: Fruit = "apple" # PLW0642 - | ^^^ PLW0642 + | ^^^ 6 | cls += "orange" # OK, augmented assignments are ignored 7 | *cls = "banana" # PLW0642 | = help: Consider using a different variable name +error[PLW0642]: 7:10: Reassigned `cls` variable in class method -self_or_cls_assignment.py:7:10: PLW0642 Reassigned `cls` variable in class method + --> self_or_cls_assignment.py:7:10 | 5 | cls: Fruit = "apple" # PLW0642 6 | cls += "orange" # OK, augmented assignments are ignored 7 | *cls = "banana" # PLW0642 - | ^^^ PLW0642 + | ^^^ 8 | cls, blah = "apple", "orange" # PLW0642 9 | blah, (cls, blah2) = "apple", ("orange", "banana") # PLW0642 | = help: Consider using a different variable name +error[PLW0642]: 8:9: Reassigned `cls` variable in class method -self_or_cls_assignment.py:8:9: PLW0642 Reassigned `cls` variable in class method + --> self_or_cls_assignment.py:8:9 | 6 | cls += "orange" # OK, augmented assignments are ignored 7 | *cls = "banana" # PLW0642 8 | cls, blah = "apple", "orange" # PLW0642 - | ^^^ PLW0642 + | ^^^ 9 | blah, (cls, blah2) = "apple", ("orange", "banana") # PLW0642 10 | blah, [cls, blah2] = "apple", ("orange", "banana") # PLW0642 | = help: Consider using a different variable name +error[PLW0642]: 9:16: Reassigned `cls` variable in class method -self_or_cls_assignment.py:9:16: PLW0642 Reassigned `cls` variable in class method + --> self_or_cls_assignment.py:9:16 | 7 | *cls = "banana" # PLW0642 8 | cls, blah = "apple", "orange" # PLW0642 9 | blah, (cls, blah2) = "apple", ("orange", "banana") # PLW0642 - | ^^^ PLW0642 + | ^^^ 10 | blah, [cls, blah2] = "apple", ("orange", "banana") # PLW0642 | = help: Consider using a different variable name +error[PLW0642]: 10:16: Reassigned `cls` variable in class method -self_or_cls_assignment.py:10:16: PLW0642 Reassigned `cls` variable in class method + --> self_or_cls_assignment.py:10:16 | 8 | cls, blah = "apple", "orange" # PLW0642 9 | blah, (cls, blah2) = "apple", ("orange", "banana") # PLW0642 10 | blah, [cls, blah2] = "apple", ("orange", "banana") # PLW0642 - | ^^^ PLW0642 + | ^^^ 11 | 12 | @classmethod | = help: Consider using a different variable name +error[PLW0642]: 14:9: Reassigned `cls` variable in class method -self_or_cls_assignment.py:14:9: PLW0642 Reassigned `cls` variable in class method + --> self_or_cls_assignment.py:14:9 | 12 | @classmethod 13 | def add_fruits(cls, fruits, /) -> None: 14 | cls = fruits # PLW0642 - | ^^^ PLW0642 + | ^^^ 15 | 16 | def print_color(self) -> None: | = help: Consider using a different variable name +error[PLW0642]: 17:9: Reassigned `self` variable in instance method -self_or_cls_assignment.py:17:9: PLW0642 Reassigned `self` variable in instance method + --> self_or_cls_assignment.py:17:9 | 16 | def print_color(self) -> None: 17 | self = "red" # PLW0642 - | ^^^^ PLW0642 + | ^^^^ 18 | self: Self = "red" # PLW0642 19 | self += "blue" # OK, augmented assignments are ignored | = help: Consider using a different variable name +error[PLW0642]: 18:9: Reassigned `self` variable in instance method -self_or_cls_assignment.py:18:9: PLW0642 Reassigned `self` variable in instance method + --> self_or_cls_assignment.py:18:9 | 16 | def print_color(self) -> None: 17 | self = "red" # PLW0642 18 | self: Self = "red" # PLW0642 - | ^^^^ PLW0642 + | ^^^^ 19 | self += "blue" # OK, augmented assignments are ignored 20 | *self = "blue" # PLW0642 | = help: Consider using a different variable name +error[PLW0642]: 20:10: Reassigned `self` variable in instance method -self_or_cls_assignment.py:20:10: PLW0642 Reassigned `self` variable in instance method + --> self_or_cls_assignment.py:20:10 | 18 | self: Self = "red" # PLW0642 19 | self += "blue" # OK, augmented assignments are ignored 20 | *self = "blue" # PLW0642 - | ^^^^ PLW0642 + | ^^^^ 21 | self, blah = "red", "blue" # PLW0642 22 | blah, (self, blah2) = "apple", ("orange", "banana") # PLW0642 | = help: Consider using a different variable name +error[PLW0642]: 21:9: Reassigned `self` variable in instance method -self_or_cls_assignment.py:21:9: PLW0642 Reassigned `self` variable in instance method + --> self_or_cls_assignment.py:21:9 | 19 | self += "blue" # OK, augmented assignments are ignored 20 | *self = "blue" # PLW0642 21 | self, blah = "red", "blue" # PLW0642 - | ^^^^ PLW0642 + | ^^^^ 22 | blah, (self, blah2) = "apple", ("orange", "banana") # PLW0642 23 | blah, [self, blah2] = "apple", ("orange", "banana") # PLW0642 | = help: Consider using a different variable name +error[PLW0642]: 22:16: Reassigned `self` variable in instance method -self_or_cls_assignment.py:22:16: PLW0642 Reassigned `self` variable in instance method + --> self_or_cls_assignment.py:22:16 | 20 | *self = "blue" # PLW0642 21 | self, blah = "red", "blue" # PLW0642 22 | blah, (self, blah2) = "apple", ("orange", "banana") # PLW0642 - | ^^^^ PLW0642 + | ^^^^ 23 | blah, [self, blah2] = "apple", ("orange", "banana") # PLW0642 | = help: Consider using a different variable name +error[PLW0642]: 23:16: Reassigned `self` variable in instance method -self_or_cls_assignment.py:23:16: PLW0642 Reassigned `self` variable in instance method + --> self_or_cls_assignment.py:23:16 | 21 | self, blah = "red", "blue" # PLW0642 22 | blah, (self, blah2) = "apple", ("orange", "banana") # PLW0642 23 | blah, [self, blah2] = "apple", ("orange", "banana") # PLW0642 - | ^^^^ PLW0642 + | ^^^^ 24 | 25 | def print_color(self, color, /) -> None: | = help: Consider using a different variable name +error[PLW0642]: 26:9: Reassigned `self` variable in instance method -self_or_cls_assignment.py:26:9: PLW0642 Reassigned `self` variable in instance method + --> self_or_cls_assignment.py:26:9 | 25 | def print_color(self, color, /) -> None: 26 | self = color - | ^^^^ PLW0642 + | ^^^^ 27 | 28 | def ok(self) -> None: | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0711_binary_op_exception.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0711_binary_op_exception.py.snap index d1f8d1b9f2..ab9644a0d7 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0711_binary_op_exception.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0711_binary_op_exception.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLW0711]: binary_op_exception.py:3:8: Exception to catch is the result of a binary `or` operation +error[PLW0711]: 3:8: Exception to catch is the result of a binary `or` operation + --> binary_op_exception.py:3:8 | 1 | try: 2 | 1 / 0 @@ -10,8 +11,9 @@ error[PLW0711]: binary_op_exception.py:3:8: Exception to catch is the result of | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 4 | pass | -error[PLW0711]: binary_op_exception.py:8:8: Exception to catch is the result of a binary `and` operation +error[PLW0711]: 8:8: Exception to catch is the result of a binary `and` operation + --> binary_op_exception.py:8:8 | 6 | try: 7 | raise ValueError diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1501_bad_open_mode.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1501_bad_open_mode.py.snap index 8b08895f7e..fcd6e8da0b 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1501_bad_open_mode.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1501_bad_open_mode.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLW1501]: bad_open_mode.py:11:12: `rwx` is not a valid mode for `open` +error[PLW1501]: 11:12: `rwx` is not a valid mode for `open` + --> bad_open_mode.py:11:12 | 9 | open(NAME, "+r", encoding="utf-8") 10 | open(NAME, "xb") @@ -11,8 +12,9 @@ error[PLW1501]: bad_open_mode.py:11:12: `rwx` is not a valid mode for `open` 12 | open(NAME, mode="rwx") # [bad-open-mode] 13 | open(NAME, "rwx", encoding="utf-8") # [bad-open-mode] | -error[PLW1501]: bad_open_mode.py:12:17: `rwx` is not a valid mode for `open` +error[PLW1501]: 12:17: `rwx` is not a valid mode for `open` + --> bad_open_mode.py:12:17 | 10 | open(NAME, "xb") 11 | open(NAME, "rwx") # [bad-open-mode] @@ -21,8 +23,9 @@ error[PLW1501]: bad_open_mode.py:12:17: `rwx` is not a valid mode for `open` 13 | open(NAME, "rwx", encoding="utf-8") # [bad-open-mode] 14 | open(NAME, "rr", encoding="utf-8") # [bad-open-mode] | -error[PLW1501]: bad_open_mode.py:13:12: `rwx` is not a valid mode for `open` +error[PLW1501]: 13:12: `rwx` is not a valid mode for `open` + --> bad_open_mode.py:13:12 | 11 | open(NAME, "rwx") # [bad-open-mode] 12 | open(NAME, mode="rwx") # [bad-open-mode] @@ -31,8 +34,9 @@ error[PLW1501]: bad_open_mode.py:13:12: `rwx` is not a valid mode for `open` 14 | open(NAME, "rr", encoding="utf-8") # [bad-open-mode] 15 | open(NAME, "+", encoding="utf-8") # [bad-open-mode] | -error[PLW1501]: bad_open_mode.py:14:12: `rr` is not a valid mode for `open` +error[PLW1501]: 14:12: `rr` is not a valid mode for `open` + --> bad_open_mode.py:14:12 | 12 | open(NAME, mode="rwx") # [bad-open-mode] 13 | open(NAME, "rwx", encoding="utf-8") # [bad-open-mode] @@ -41,8 +45,9 @@ error[PLW1501]: bad_open_mode.py:14:12: `rr` is not a valid mode for `open` 15 | open(NAME, "+", encoding="utf-8") # [bad-open-mode] 16 | open(NAME, "xw", encoding="utf-8") # [bad-open-mode] | -error[PLW1501]: bad_open_mode.py:15:12: `+` is not a valid mode for `open` +error[PLW1501]: 15:12: `+` is not a valid mode for `open` + --> bad_open_mode.py:15:12 | 13 | open(NAME, "rwx", encoding="utf-8") # [bad-open-mode] 14 | open(NAME, "rr", encoding="utf-8") # [bad-open-mode] @@ -51,8 +56,9 @@ error[PLW1501]: bad_open_mode.py:15:12: `+` is not a valid mode for `open` 16 | open(NAME, "xw", encoding="utf-8") # [bad-open-mode] 17 | open(NAME, "ab+") | -error[PLW1501]: bad_open_mode.py:16:12: `xw` is not a valid mode for `open` +error[PLW1501]: 16:12: `xw` is not a valid mode for `open` + --> bad_open_mode.py:16:12 | 14 | open(NAME, "rr", encoding="utf-8") # [bad-open-mode] 15 | open(NAME, "+", encoding="utf-8") # [bad-open-mode] @@ -61,8 +67,9 @@ error[PLW1501]: bad_open_mode.py:16:12: `xw` is not a valid mode for `open` 17 | open(NAME, "ab+") 18 | open(NAME, "a+b") | -error[PLW1501]: bad_open_mode.py:22:12: `Ua` is not a valid mode for `open` +error[PLW1501]: 22:12: `Ua` is not a valid mode for `open` + --> bad_open_mode.py:22:12 | 20 | open(NAME, "+rUb") 21 | open(NAME, "x+b") @@ -71,8 +78,9 @@ error[PLW1501]: bad_open_mode.py:22:12: `Ua` is not a valid mode for `open` 23 | open(NAME, "Ur++", encoding="utf-8") # [bad-open-mode] 24 | open(NAME, "Ut", encoding="utf-8") | -error[PLW1501]: bad_open_mode.py:23:12: `Ur++` is not a valid mode for `open` +error[PLW1501]: 23:12: `Ur++` is not a valid mode for `open` + --> bad_open_mode.py:23:12 | 21 | open(NAME, "x+b") 22 | open(NAME, "Ua", encoding="utf-8") # [bad-open-mode] @@ -81,8 +89,9 @@ error[PLW1501]: bad_open_mode.py:23:12: `Ur++` is not a valid mode for `open` 24 | open(NAME, "Ut", encoding="utf-8") 25 | open(NAME, "Ubr") | -error[PLW1501]: bad_open_mode.py:32:25: `rwx` is not a valid mode for `open` +error[PLW1501]: 32:25: `rwx` is not a valid mode for `open` + --> bad_open_mode.py:32:25 | 30 | pathlib.Path(NAME).open("wb") 31 | pathlib.Path(NAME).open(mode) @@ -91,8 +100,9 @@ error[PLW1501]: bad_open_mode.py:32:25: `rwx` is not a valid mode for `open` 33 | pathlib.Path(NAME).open(mode="rwx") # [bad-open-mode] 34 | pathlib.Path(NAME).open("rwx", encoding="utf-8") # [bad-open-mode] | -error[PLW1501]: bad_open_mode.py:33:30: `rwx` is not a valid mode for `open` +error[PLW1501]: 33:30: `rwx` is not a valid mode for `open` + --> bad_open_mode.py:33:30 | 31 | pathlib.Path(NAME).open(mode) 32 | pathlib.Path(NAME).open("rwx") # [bad-open-mode] @@ -100,8 +110,9 @@ error[PLW1501]: bad_open_mode.py:33:30: `rwx` is not a valid mode for `open` | ^^^^^ 34 | pathlib.Path(NAME).open("rwx", encoding="utf-8") # [bad-open-mode] | -error[PLW1501]: bad_open_mode.py:34:25: `rwx` is not a valid mode for `open` +error[PLW1501]: 34:25: `rwx` is not a valid mode for `open` + --> bad_open_mode.py:34:25 | 32 | pathlib.Path(NAME).open("rwx") # [bad-open-mode] 33 | pathlib.Path(NAME).open(mode="rwx") # [bad-open-mode] @@ -110,8 +121,9 @@ error[PLW1501]: bad_open_mode.py:34:25: `rwx` is not a valid mode for `open` 35 | 36 | import builtins | -error[PLW1501]: bad_open_mode.py:37:21: `Ua` is not a valid mode for `open` +error[PLW1501]: 37:21: `Ua` is not a valid mode for `open` + --> bad_open_mode.py:37:21 | 36 | import builtins 37 | builtins.open(NAME, "Ua", encoding="utf-8") diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1508_invalid_envvar_default.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1508_invalid_envvar_default.py.snap index 92ad6b4cb4..4727a2b714 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1508_invalid_envvar_default.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1508_invalid_envvar_default.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLW1508]: invalid_envvar_default.py:3:29: Invalid type for environment variable default; expected `str` or `None` +error[PLW1508]: 3:29: Invalid type for environment variable default; expected `str` or `None` + --> invalid_envvar_default.py:3:29 | 1 | import os 2 | @@ -11,8 +12,9 @@ error[PLW1508]: invalid_envvar_default.py:3:29: Invalid type for environment var 4 | goodVar = os.getenv("TESTING", None) 5 | dictVarBad = os.getenv("AAA", {"a", 7}) # [invalid-envvar-default] | -error[PLW1508]: invalid_envvar_default.py:5:31: Invalid type for environment variable default; expected `str` or `None` +error[PLW1508]: 5:31: Invalid type for environment variable default; expected `str` or `None` + --> invalid_envvar_default.py:5:31 | 3 | tempVar = os.getenv("TEST", 12) # [invalid-envvar-default] 4 | goodVar = os.getenv("TESTING", None) @@ -21,8 +23,9 @@ error[PLW1508]: invalid_envvar_default.py:5:31: Invalid type for environment var 6 | print(os.getenv("TEST", False)) # [invalid-envvar-default] 7 | os.getenv("AA", "GOOD") | -error[PLW1508]: invalid_envvar_default.py:6:25: Invalid type for environment variable default; expected `str` or `None` +error[PLW1508]: 6:25: Invalid type for environment variable default; expected `str` or `None` + --> invalid_envvar_default.py:6:25 | 4 | goodVar = os.getenv("TESTING", None) 5 | dictVarBad = os.getenv("AAA", {"a", 7}) # [invalid-envvar-default] @@ -31,8 +34,9 @@ error[PLW1508]: invalid_envvar_default.py:6:25: Invalid type for environment var 7 | os.getenv("AA", "GOOD") 8 | os.getenv("AA", f"GOOD") | -error[PLW1508]: invalid_envvar_default.py:10:17: Invalid type for environment variable default; expected `str` or `None` +error[PLW1508]: 10:17: Invalid type for environment variable default; expected `str` or `None` + --> invalid_envvar_default.py:10:17 | 8 | os.getenv("AA", f"GOOD") 9 | os.getenv("AA", "GOOD" + "BAR") @@ -41,8 +45,9 @@ error[PLW1508]: invalid_envvar_default.py:10:17: Invalid type for environment va 11 | os.getenv("AA", "GOOD %s" % "BAR") 12 | os.getenv("B", Z) | -error[PLW1508]: invalid_envvar_default.py:14:17: Invalid type for environment variable default; expected `str` or `None` +error[PLW1508]: 14:17: Invalid type for environment variable default; expected `str` or `None` + --> invalid_envvar_default.py:14:17 | 12 | os.getenv("B", Z) 13 | os.getenv("AA", "GOOD" if Z else "BAR") diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1509_subprocess_popen_preexec_fn.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1509_subprocess_popen_preexec_fn.py.snap index 0a4be64301..1e332379d9 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1509_subprocess_popen_preexec_fn.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1509_subprocess_popen_preexec_fn.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLW1509]: subprocess_popen_preexec_fn.py:9:18: `preexec_fn` argument is unsafe when using threads +error[PLW1509]: 9:18: `preexec_fn` argument is unsafe when using threads + --> subprocess_popen_preexec_fn.py:9:18 | 8 | # Errors. 9 | subprocess.Popen(preexec_fn=foo) @@ -10,8 +11,9 @@ error[PLW1509]: subprocess_popen_preexec_fn.py:9:18: `preexec_fn` argument is un 10 | subprocess.Popen(["ls"], preexec_fn=foo) 11 | subprocess.Popen(preexec_fn=lambda: print("Hello, world!")) | -error[PLW1509]: subprocess_popen_preexec_fn.py:10:26: `preexec_fn` argument is unsafe when using threads +error[PLW1509]: 10:26: `preexec_fn` argument is unsafe when using threads + --> subprocess_popen_preexec_fn.py:10:26 | 8 | # Errors. 9 | subprocess.Popen(preexec_fn=foo) @@ -20,8 +22,9 @@ error[PLW1509]: subprocess_popen_preexec_fn.py:10:26: `preexec_fn` argument is u 11 | subprocess.Popen(preexec_fn=lambda: print("Hello, world!")) 12 | subprocess.Popen(["ls"], preexec_fn=lambda: print("Hello, world!")) | -error[PLW1509]: subprocess_popen_preexec_fn.py:11:18: `preexec_fn` argument is unsafe when using threads +error[PLW1509]: 11:18: `preexec_fn` argument is unsafe when using threads + --> subprocess_popen_preexec_fn.py:11:18 | 9 | subprocess.Popen(preexec_fn=foo) 10 | subprocess.Popen(["ls"], preexec_fn=foo) @@ -29,8 +32,9 @@ error[PLW1509]: subprocess_popen_preexec_fn.py:11:18: `preexec_fn` argument is u | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 12 | subprocess.Popen(["ls"], preexec_fn=lambda: print("Hello, world!")) | -error[PLW1509]: subprocess_popen_preexec_fn.py:12:26: `preexec_fn` argument is unsafe when using threads +error[PLW1509]: 12:26: `preexec_fn` argument is unsafe when using threads + --> subprocess_popen_preexec_fn.py:12:26 | 10 | subprocess.Popen(["ls"], preexec_fn=foo) 11 | subprocess.Popen(preexec_fn=lambda: print("Hello, world!")) diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1510_subprocess_run_without_check.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1510_subprocess_run_without_check.py.snap index dea3fdde65..920c24669d 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1510_subprocess_run_without_check.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1510_subprocess_run_without_check.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLW1510]: subprocess_run_without_check.py:4:1: [*] `subprocess.run` without explicit `check` argument +error[PLW1510]: 4:1: [*] `subprocess.run` without explicit `check` argument + --> subprocess_run_without_check.py:3:10 | 3 | # Errors. 4 | subprocess.run("ls") @@ -21,8 +22,9 @@ error[PLW1510]: subprocess_run_without_check.py:4:1: [*] `subprocess.run` withou 6 6 | subprocess.run( 7 7 | ["ls"], -error[PLW1510]: subprocess_run_without_check.py:5:1: [*] `subprocess.run` without explicit `check` argument +error[PLW1510]: 5:1: [*] `subprocess.run` without explicit `check` argument + --> subprocess_run_without_check.py:4:21 | 3 | # Errors. 4 | subprocess.run("ls") @@ -42,8 +44,9 @@ error[PLW1510]: subprocess_run_without_check.py:5:1: [*] `subprocess.run` withou 7 7 | ["ls"], 8 8 | shell=False, -error[PLW1510]: subprocess_run_without_check.py:6:1: [*] `subprocess.run` without explicit `check` argument +error[PLW1510]: 6:1: [*] `subprocess.run` without explicit `check` argument + --> subprocess_run_without_check.py:5:33 | 4 | subprocess.run("ls") 5 | subprocess.run("ls", shell=True) @@ -63,8 +66,9 @@ error[PLW1510]: subprocess_run_without_check.py:6:1: [*] `subprocess.run` withou 10 10 | subprocess.run(["ls"], **kwargs) 11 11 | -error[PLW1510]: subprocess_run_without_check.py:10:1: [*] `subprocess.run` without explicit `check` argument +error[PLW1510]: 10:1: [*] `subprocess.run` without explicit `check` argument + --> subprocess_run_without_check.py:9:2 | 8 | shell=False, 9 | ) diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1514_unspecified_encoding.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1514_unspecified_encoding.py.snap index fba16730f6..5345565e11 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1514_unspecified_encoding.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1514_unspecified_encoding.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLW1514]: unspecified_encoding.py:8:1: [*] `open` in text mode without explicit `encoding` argument +error[PLW1514]: 8:1: [*] `open` in text mode without explicit `encoding` argument + --> unspecified_encoding.py:7:10 | 7 | # Errors. 8 | open("test.txt") @@ -21,8 +22,9 @@ error[PLW1514]: unspecified_encoding.py:8:1: [*] `open` in text mode without exp 10 10 | hugo.TextIOWrapper(hugo.FileIO("test.txt")) 11 11 | tempfile.NamedTemporaryFile("w") -error[PLW1514]: unspecified_encoding.py:9:1: [*] `io.TextIOWrapper` without explicit `encoding` argument +error[PLW1514]: 9:1: [*] `io.TextIOWrapper` without explicit `encoding` argument + --> unspecified_encoding.py:8:17 | 7 | # Errors. 8 | open("test.txt") @@ -42,8 +44,9 @@ error[PLW1514]: unspecified_encoding.py:9:1: [*] `io.TextIOWrapper` without expl 11 11 | tempfile.NamedTemporaryFile("w") 12 12 | tempfile.TemporaryFile("w") -error[PLW1514]: unspecified_encoding.py:10:1: [*] `io.TextIOWrapper` without explicit `encoding` argument +error[PLW1514]: 10:1: [*] `io.TextIOWrapper` without explicit `encoding` argument + --> unspecified_encoding.py:9:40 | 8 | open("test.txt") 9 | io.TextIOWrapper(io.FileIO("test.txt")) @@ -63,8 +66,9 @@ error[PLW1514]: unspecified_encoding.py:10:1: [*] `io.TextIOWrapper` without exp 12 12 | tempfile.TemporaryFile("w") 13 13 | codecs.open("test.txt") -error[PLW1514]: unspecified_encoding.py:11:1: [*] `tempfile.NamedTemporaryFile` in text mode without explicit `encoding` argument +error[PLW1514]: 11:1: [*] `tempfile.NamedTemporaryFile` in text mode without explicit `encoding` argument + --> unspecified_encoding.py:10:44 | 9 | io.TextIOWrapper(io.FileIO("test.txt")) 10 | hugo.TextIOWrapper(hugo.FileIO("test.txt")) @@ -84,8 +88,9 @@ error[PLW1514]: unspecified_encoding.py:11:1: [*] `tempfile.NamedTemporaryFile` 13 13 | codecs.open("test.txt") 14 14 | tempfile.SpooledTemporaryFile(0, "w") -error[PLW1514]: unspecified_encoding.py:12:1: [*] `tempfile.TemporaryFile` in text mode without explicit `encoding` argument +error[PLW1514]: 12:1: [*] `tempfile.TemporaryFile` in text mode without explicit `encoding` argument + --> unspecified_encoding.py:11:33 | 10 | hugo.TextIOWrapper(hugo.FileIO("test.txt")) 11 | tempfile.NamedTemporaryFile("w") @@ -105,8 +110,9 @@ error[PLW1514]: unspecified_encoding.py:12:1: [*] `tempfile.TemporaryFile` in te 14 14 | tempfile.SpooledTemporaryFile(0, "w") 15 15 | -error[PLW1514]: unspecified_encoding.py:13:1: [*] `codecs.open` in text mode without explicit `encoding` argument +error[PLW1514]: 13:1: [*] `codecs.open` in text mode without explicit `encoding` argument + --> unspecified_encoding.py:12:28 | 11 | tempfile.NamedTemporaryFile("w") 12 | tempfile.TemporaryFile("w") @@ -125,8 +131,9 @@ error[PLW1514]: unspecified_encoding.py:13:1: [*] `codecs.open` in text mode wit 15 15 | 16 16 | # Non-errors. -error[PLW1514]: unspecified_encoding.py:14:1: [*] `tempfile.SpooledTemporaryFile` in text mode without explicit `encoding` argument +error[PLW1514]: 14:1: [*] `tempfile.SpooledTemporaryFile` in text mode without explicit `encoding` argument + --> unspecified_encoding.py:13:24 | 12 | tempfile.TemporaryFile("w") 13 | codecs.open("test.txt") @@ -146,8 +153,9 @@ error[PLW1514]: unspecified_encoding.py:14:1: [*] `tempfile.SpooledTemporaryFile 16 16 | # Non-errors. 17 17 | open("test.txt", encoding="utf-8") -error[PLW1514]: unspecified_encoding.py:46:1: [*] `open` in text mode without explicit `encoding` argument +error[PLW1514]: 46:1: [*] `open` in text mode without explicit `encoding` argument + --> unspecified_encoding.py:45:1 | 44 | tempfile.SpooledTemporaryFile(0, ) 45 | @@ -167,8 +175,9 @@ error[PLW1514]: unspecified_encoding.py:46:1: [*] `open` in text mode without ex 48 48 | open( 49 49 | "test.txt", # comment -error[PLW1514]: unspecified_encoding.py:47:1: [*] `open` in text mode without explicit `encoding` argument +error[PLW1514]: 47:1: [*] `open` in text mode without explicit `encoding` argument + --> unspecified_encoding.py:46:18 | 46 | open("test.txt",) 47 | open() @@ -187,8 +196,9 @@ error[PLW1514]: unspecified_encoding.py:47:1: [*] `open` in text mode without ex 49 49 | "test.txt", # comment 50 50 | ) -error[PLW1514]: unspecified_encoding.py:48:1: [*] `open` in text mode without explicit `encoding` argument +error[PLW1514]: 48:1: [*] `open` in text mode without explicit `encoding` argument + --> unspecified_encoding.py:47:7 | 46 | open("test.txt",) 47 | open() @@ -208,8 +218,9 @@ error[PLW1514]: unspecified_encoding.py:48:1: [*] `open` in text mode without ex 51 51 | open( 52 52 | "test.txt", -error[PLW1514]: unspecified_encoding.py:51:1: [*] `open` in text mode without explicit `encoding` argument +error[PLW1514]: 51:1: [*] `open` in text mode without explicit `encoding` argument + --> unspecified_encoding.py:50:2 | 49 | "test.txt", # comment 50 | ) @@ -229,8 +240,9 @@ error[PLW1514]: unspecified_encoding.py:51:1: [*] `open` in text mode without ex 54 54 | ) 55 55 | open(("test.txt"),) -error[PLW1514]: unspecified_encoding.py:55:1: [*] `open` in text mode without explicit `encoding` argument +error[PLW1514]: 55:1: [*] `open` in text mode without explicit `encoding` argument + --> unspecified_encoding.py:54:2 | 53 | # comment 54 | ) @@ -250,8 +262,9 @@ error[PLW1514]: unspecified_encoding.py:55:1: [*] `open` in text mode without ex 57 57 | ("test.txt"), # comment 58 58 | ) -error[PLW1514]: unspecified_encoding.py:56:1: [*] `open` in text mode without explicit `encoding` argument +error[PLW1514]: 56:1: [*] `open` in text mode without explicit `encoding` argument + --> unspecified_encoding.py:55:20 | 54 | ) 55 | open(("test.txt"),) @@ -271,8 +284,9 @@ error[PLW1514]: unspecified_encoding.py:56:1: [*] `open` in text mode without ex 59 59 | open( 60 60 | ("test.txt"), -error[PLW1514]: unspecified_encoding.py:59:1: [*] `open` in text mode without explicit `encoding` argument +error[PLW1514]: 59:1: [*] `open` in text mode without explicit `encoding` argument + --> unspecified_encoding.py:58:2 | 57 | ("test.txt"), # comment 58 | ) @@ -292,8 +306,9 @@ error[PLW1514]: unspecified_encoding.py:59:1: [*] `open` in text mode without ex 62 62 | ) 63 63 | -error[PLW1514]: unspecified_encoding.py:64:1: [*] `open` in text mode without explicit `encoding` argument +error[PLW1514]: 64:1: [*] `open` in text mode without explicit `encoding` argument + --> unspecified_encoding.py:63:1 | 62 | ) 63 | @@ -313,8 +328,9 @@ error[PLW1514]: unspecified_encoding.py:64:1: [*] `open` in text mode without ex 66 66 | (("test.txt")), # comment 67 67 | ) -error[PLW1514]: unspecified_encoding.py:65:1: [*] `open` in text mode without explicit `encoding` argument +error[PLW1514]: 65:1: [*] `open` in text mode without explicit `encoding` argument + --> unspecified_encoding.py:64:22 | 64 | open((("test.txt")),) 65 | open( @@ -333,8 +349,9 @@ error[PLW1514]: unspecified_encoding.py:65:1: [*] `open` in text mode without ex 68 68 | open( 69 69 | (("test.txt")), -error[PLW1514]: unspecified_encoding.py:68:1: [*] `open` in text mode without explicit `encoding` argument +error[PLW1514]: 68:1: [*] `open` in text mode without explicit `encoding` argument + --> unspecified_encoding.py:67:2 | 66 | (("test.txt")), # comment 67 | ) @@ -354,8 +371,9 @@ error[PLW1514]: unspecified_encoding.py:68:1: [*] `open` in text mode without ex 71 71 | ) 72 72 | -error[PLW1514]: unspecified_encoding.py:77:1: [*] `pathlib.Path(...).open` in text mode without explicit `encoding` argument +error[PLW1514]: 77:1: [*] `pathlib.Path(...).open` in text mode without explicit `encoding` argument + --> unspecified_encoding.py:76:10 | 76 | # Errors. 77 | Path("foo.txt").open() @@ -374,8 +392,9 @@ error[PLW1514]: unspecified_encoding.py:77:1: [*] `pathlib.Path(...).open` in te 79 79 | text = Path("foo.txt").read_text() 80 80 | Path("foo.txt").write_text(text) -error[PLW1514]: unspecified_encoding.py:78:1: [*] `pathlib.Path(...).open` in text mode without explicit `encoding` argument +error[PLW1514]: 78:1: [*] `pathlib.Path(...).open` in text mode without explicit `encoding` argument + --> unspecified_encoding.py:77:23 | 76 | # Errors. 77 | Path("foo.txt").open() @@ -395,8 +414,9 @@ error[PLW1514]: unspecified_encoding.py:78:1: [*] `pathlib.Path(...).open` in te 80 80 | Path("foo.txt").write_text(text) 81 81 | -error[PLW1514]: unspecified_encoding.py:79:8: [*] `pathlib.Path(...).read_text` without explicit `encoding` argument +error[PLW1514]: 79:8: [*] `pathlib.Path(...).read_text` without explicit `encoding` argument + --> unspecified_encoding.py:79:8 | 77 | Path("foo.txt").open() 78 | Path("foo.txt").open("w") @@ -415,8 +435,9 @@ error[PLW1514]: unspecified_encoding.py:79:8: [*] `pathlib.Path(...).read_text` 81 81 | 82 82 | # Non-errors. -error[PLW1514]: unspecified_encoding.py:80:1: [*] `pathlib.Path(...).write_text` without explicit `encoding` argument +error[PLW1514]: 80:1: [*] `pathlib.Path(...).write_text` without explicit `encoding` argument + --> unspecified_encoding.py:79:35 | 78 | Path("foo.txt").open("w") 79 | text = Path("foo.txt").read_text() diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1641_eq_without_hash.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1641_eq_without_hash.py.snap index 5e200c916c..72fc7ef278 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1641_eq_without_hash.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1641_eq_without_hash.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLW1641]: eq_without_hash.py:1:7: Object does not implement `__hash__` method +error[PLW1641]: 1:7: Object does not implement `__hash__` method + --> eq_without_hash.py:1:7 | 1 | class Person: # [eq-without-hash] | ^^^^^^ diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW2101_useless_with_lock.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW2101_useless_with_lock.py.snap index 6415edf666..982da6e555 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW2101_useless_with_lock.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW2101_useless_with_lock.py.snap @@ -1,15 +1,17 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLW2101]: useless_with_lock.py:5:6: Threading lock directly created in `with` statement has no effect +error[PLW2101]: 5:6: Threading lock directly created in `with` statement has no effect + --> useless_with_lock.py:5:6 | 5 | with threading.Lock(): # [useless-with-lock] | ^^^^^^^^^^^^^^^^ 6 | ... | -error[PLW2101]: useless_with_lock.py:8:6: Threading lock directly created in `with` statement has no effect +error[PLW2101]: 8:6: Threading lock directly created in `with` statement has no effect + --> useless_with_lock.py:8:6 | 6 | ... 7 | @@ -17,8 +19,9 @@ error[PLW2101]: useless_with_lock.py:8:6: Threading lock directly created in `wi | ^^^^^^ 9 | ... | -error[PLW2101]: useless_with_lock.py:11:6: Threading lock directly created in `with` statement has no effect +error[PLW2101]: 11:6: Threading lock directly created in `with` statement has no effect + --> useless_with_lock.py:11:6 | 9 | ... 10 | @@ -26,8 +29,9 @@ error[PLW2101]: useless_with_lock.py:11:6: Threading lock directly created in `w | ^^^^^^^^^^^^^^^^ 12 | ... | -error[PLW2101]: useless_with_lock.py:14:6: Threading lock directly created in `with` statement has no effect +error[PLW2101]: 14:6: Threading lock directly created in `with` statement has no effect + --> useless_with_lock.py:14:6 | 12 | ... 13 | @@ -35,8 +39,9 @@ error[PLW2101]: useless_with_lock.py:14:6: Threading lock directly created in `w | ^^^^^^^^^^^^^^^^^ 15 | ... | -error[PLW2101]: useless_with_lock.py:17:6: Threading lock directly created in `with` statement has no effect +error[PLW2101]: 17:6: Threading lock directly created in `with` statement has no effect + --> useless_with_lock.py:17:6 | 15 | ... 16 | @@ -44,8 +49,9 @@ error[PLW2101]: useless_with_lock.py:17:6: Threading lock directly created in `w | ^^^^^^^ 18 | ... | -error[PLW2101]: useless_with_lock.py:20:6: Threading lock directly created in `with` statement has no effect +error[PLW2101]: 20:6: Threading lock directly created in `with` statement has no effect + --> useless_with_lock.py:20:6 | 18 | ... 19 | @@ -53,8 +59,9 @@ error[PLW2101]: useless_with_lock.py:20:6: Threading lock directly created in `w | ^^^^^^^^^^^^^^^^^^^^^ 21 | ... | -error[PLW2101]: useless_with_lock.py:23:6: Threading lock directly created in `with` statement has no effect +error[PLW2101]: 23:6: Threading lock directly created in `with` statement has no effect + --> useless_with_lock.py:23:6 | 21 | ... 22 | @@ -62,8 +69,9 @@ error[PLW2101]: useless_with_lock.py:23:6: Threading lock directly created in `w | ^^^^^^^^^^^ 24 | ... | -error[PLW2101]: useless_with_lock.py:26:6: Threading lock directly created in `with` statement has no effect +error[PLW2101]: 26:6: Threading lock directly created in `with` statement has no effect + --> useless_with_lock.py:26:6 | 24 | ... 25 | @@ -71,8 +79,9 @@ error[PLW2101]: useless_with_lock.py:26:6: Threading lock directly created in `w | ^^^^^^^^^^^^^^^^^^^^^ 27 | ... | -error[PLW2101]: useless_with_lock.py:29:6: Threading lock directly created in `with` statement has no effect +error[PLW2101]: 29:6: Threading lock directly created in `with` statement has no effect + --> useless_with_lock.py:29:6 | 27 | ... 28 | @@ -80,8 +89,9 @@ error[PLW2101]: useless_with_lock.py:29:6: Threading lock directly created in `w | ^^^^^^^^^^^ 30 | ... | -error[PLW2101]: useless_with_lock.py:32:6: Threading lock directly created in `with` statement has no effect +error[PLW2101]: 32:6: Threading lock directly created in `with` statement has no effect + --> useless_with_lock.py:32:6 | 30 | ... 31 | @@ -89,8 +99,9 @@ error[PLW2101]: useless_with_lock.py:32:6: Threading lock directly created in `w | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 33 | ... | -error[PLW2101]: useless_with_lock.py:35:6: Threading lock directly created in `with` statement has no effect +error[PLW2101]: 35:6: Threading lock directly created in `with` statement has no effect + --> useless_with_lock.py:35:6 | 33 | ... 34 | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW2901_redefined_loop_name.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW2901_redefined_loop_name.py.snap index e1b5e52f68..108609c76d 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW2901_redefined_loop_name.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW2901_redefined_loop_name.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLW2901]: redefined_loop_name.py:6:9: Outer `for` loop variable `i` overwritten by inner `for` loop target +error[PLW2901]: 6:9: Outer `for` loop variable `i` overwritten by inner `for` loop target + --> redefined_loop_name.py:6:9 | 4 | # For -> for, variable reused 5 | for i in []: @@ -10,8 +11,9 @@ error[PLW2901]: redefined_loop_name.py:6:9: Outer `for` loop variable `i` overwr | ^ 7 | pass | -error[PLW2901]: redefined_loop_name.py:11:9: `with` statement variable `i` overwritten by `for` loop target +error[PLW2901]: 11:9: `with` statement variable `i` overwritten by `for` loop target + --> redefined_loop_name.py:11:9 | 9 | # With -> for, variable reused 10 | with None as i: @@ -19,8 +21,9 @@ error[PLW2901]: redefined_loop_name.py:11:9: `with` statement variable `i` overw | ^ 12 | pass | -error[PLW2901]: redefined_loop_name.py:16:18: `for` loop variable `i` overwritten by `with` statement target +error[PLW2901]: 16:18: `for` loop variable `i` overwritten by `with` statement target + --> redefined_loop_name.py:16:18 | 14 | # For -> with, variable reused 15 | for i in []: @@ -28,8 +31,9 @@ error[PLW2901]: redefined_loop_name.py:16:18: `for` loop variable `i` overwritte | ^ 17 | pass | -error[PLW2901]: redefined_loop_name.py:21:18: Outer `with` statement variable `i` overwritten by inner `with` statement target +error[PLW2901]: 21:18: Outer `with` statement variable `i` overwritten by inner `with` statement target + --> redefined_loop_name.py:21:18 | 19 | # With -> with, variable reused 20 | with None as i: @@ -37,8 +41,9 @@ error[PLW2901]: redefined_loop_name.py:21:18: Outer `with` statement variable `i | ^ 22 | pass | -error[PLW2901]: redefined_loop_name.py:36:18: Outer `with` statement variable `i` overwritten by inner `with` statement target +error[PLW2901]: 36:18: Outer `with` statement variable `i` overwritten by inner `with` statement target + --> redefined_loop_name.py:36:18 | 34 | # Async with -> with, variable reused 35 | async with None as i: @@ -46,8 +51,9 @@ error[PLW2901]: redefined_loop_name.py:36:18: Outer `with` statement variable `i | ^ 37 | pass | -error[PLW2901]: redefined_loop_name.py:46:9: Outer `for` loop variable `i` overwritten by inner `for` loop target +error[PLW2901]: 46:9: Outer `for` loop variable `i` overwritten by inner `for` loop target + --> redefined_loop_name.py:46:9 | 44 | # Async for -> for, variable reused 45 | async for i in []: @@ -55,8 +61,9 @@ error[PLW2901]: redefined_loop_name.py:46:9: Outer `for` loop variable `i` overw | ^ 47 | pass | -error[PLW2901]: redefined_loop_name.py:52:13: Outer `for` loop variable `i` overwritten by inner `for` loop target +error[PLW2901]: 52:13: Outer `for` loop variable `i` overwritten by inner `for` loop target + --> redefined_loop_name.py:52:13 | 50 | for i in []: 51 | for j in []: @@ -64,8 +71,9 @@ error[PLW2901]: redefined_loop_name.py:52:13: Outer `for` loop variable `i` over | ^ 53 | pass | -error[PLW2901]: redefined_loop_name.py:58:13: Outer `for` loop variable `i` overwritten by inner `for` loop target +error[PLW2901]: 58:13: Outer `for` loop variable `i` overwritten by inner `for` loop target + --> redefined_loop_name.py:58:13 | 56 | for i in []: 57 | for j in []: @@ -74,8 +82,9 @@ error[PLW2901]: redefined_loop_name.py:58:13: Outer `for` loop variable `i` over 59 | for j in []: # error 60 | pass | -error[PLW2901]: redefined_loop_name.py:59:17: Outer `for` loop variable `j` overwritten by inner `for` loop target +error[PLW2901]: 59:17: Outer `for` loop variable `j` overwritten by inner `for` loop target + --> redefined_loop_name.py:59:17 | 57 | for j in []: 58 | for i in []: # error @@ -83,8 +92,9 @@ error[PLW2901]: redefined_loop_name.py:59:17: Outer `for` loop variable `j` over | ^ 60 | pass | -error[PLW2901]: redefined_loop_name.py:67:5: `for` loop variable `i` overwritten by assignment target +error[PLW2901]: 67:5: `for` loop variable `i` overwritten by assignment target + --> redefined_loop_name.py:67:5 | 65 | i = cast(int, i) 66 | i = typing.cast(int, i) @@ -93,8 +103,9 @@ error[PLW2901]: redefined_loop_name.py:67:5: `for` loop variable `i` overwritten 68 | 69 | # For -> augmented assignment | -error[PLW2901]: redefined_loop_name.py:71:5: `for` loop variable `i` overwritten by assignment target +error[PLW2901]: 71:5: `for` loop variable `i` overwritten by assignment target + --> redefined_loop_name.py:71:5 | 69 | # For -> augmented assignment 70 | for i in []: @@ -103,8 +114,9 @@ error[PLW2901]: redefined_loop_name.py:71:5: `for` loop variable `i` overwritten 72 | 73 | # For -> annotated assignment | -error[PLW2901]: redefined_loop_name.py:75:5: `for` loop variable `i` overwritten by assignment target +error[PLW2901]: 75:5: `for` loop variable `i` overwritten by assignment target + --> redefined_loop_name.py:75:5 | 73 | # For -> annotated assignment 74 | for i in []: @@ -113,8 +125,9 @@ error[PLW2901]: redefined_loop_name.py:75:5: `for` loop variable `i` overwritten 76 | 77 | # For -> annotated assignment without value | -error[PLW2901]: redefined_loop_name.py:83:9: Outer `for` loop variable `i` overwritten by inner `for` loop target +error[PLW2901]: 83:9: Outer `for` loop variable `i` overwritten by inner `for` loop target + --> redefined_loop_name.py:83:9 | 81 | # Async for -> for, variable reused 82 | async for i in []: @@ -122,8 +135,9 @@ error[PLW2901]: redefined_loop_name.py:83:9: Outer `for` loop variable `i` overw | ^ 84 | pass | -error[PLW2901]: redefined_loop_name.py:88:15: Outer `for` loop variable `i` overwritten by inner `for` loop target +error[PLW2901]: 88:15: Outer `for` loop variable `i` overwritten by inner `for` loop target + --> redefined_loop_name.py:88:15 | 86 | # For -> async for, variable reused 87 | for i in []: @@ -131,8 +145,9 @@ error[PLW2901]: redefined_loop_name.py:88:15: Outer `for` loop variable `i` over | ^ 89 | pass | -error[PLW2901]: redefined_loop_name.py:93:9: Outer `for` loop variable `i` overwritten by inner `for` loop target +error[PLW2901]: 93:9: Outer `for` loop variable `i` overwritten by inner `for` loop target + --> redefined_loop_name.py:93:9 | 91 | # For -> for, outer loop unpacks tuple 92 | for i, j in enumerate([]): @@ -140,8 +155,9 @@ error[PLW2901]: redefined_loop_name.py:93:9: Outer `for` loop variable `i` overw | ^ 94 | pass | -error[PLW2901]: redefined_loop_name.py:98:9: Outer `for` loop variable `i` overwritten by inner `for` loop target +error[PLW2901]: 98:9: Outer `for` loop variable `i` overwritten by inner `for` loop target + --> redefined_loop_name.py:98:9 | 96 | # For -> for, inner loop unpacks tuple 97 | for i in []: @@ -149,8 +165,9 @@ error[PLW2901]: redefined_loop_name.py:98:9: Outer `for` loop variable `i` overw | ^ 99 | pass | -error[PLW2901]: redefined_loop_name.py:103:9: Outer `for` loop variable `i` overwritten by inner `for` loop target +error[PLW2901]: 103:9: Outer `for` loop variable `i` overwritten by inner `for` loop target + --> redefined_loop_name.py:103:9 | 101 | # For -> for, both loops unpack tuple 102 | for (i, (j, k)) in []: @@ -158,8 +175,9 @@ error[PLW2901]: redefined_loop_name.py:103:9: Outer `for` loop variable `i` over | ^ 104 | pass | -error[PLW2901]: redefined_loop_name.py:103:12: Outer `for` loop variable `j` overwritten by inner `for` loop target +error[PLW2901]: 103:12: Outer `for` loop variable `j` overwritten by inner `for` loop target + --> redefined_loop_name.py:103:12 | 101 | # For -> for, both loops unpack tuple 102 | for (i, (j, k)) in []: @@ -167,8 +185,9 @@ error[PLW2901]: redefined_loop_name.py:103:12: Outer `for` loop variable `j` ove | ^ 104 | pass | -error[PLW2901]: redefined_loop_name.py:120:9: Outer `for` loop variable `j` overwritten by inner `for` loop target +error[PLW2901]: 120:9: Outer `for` loop variable `j` overwritten by inner `for` loop target + --> redefined_loop_name.py:120:9 | 118 | # For -> for, outer loop unpacks with asterisk 119 | for i, *j in []: @@ -176,8 +195,9 @@ error[PLW2901]: redefined_loop_name.py:120:9: Outer `for` loop variable `j` over | ^ 121 | pass | -error[PLW2901]: redefined_loop_name.py:137:13: `for` loop variable `i` overwritten by assignment target +error[PLW2901]: 137:13: `for` loop variable `i` overwritten by assignment target + --> redefined_loop_name.py:137:13 | 135 | def f(): 136 | for i in []: # no error @@ -186,8 +206,9 @@ error[PLW2901]: redefined_loop_name.py:137:13: `for` loop variable `i` overwritt 138 | 139 | # For -> class definition -> for -> for | -error[PLW2901]: redefined_loop_name.py:143:17: Outer `for` loop variable `i` overwritten by inner `for` loop target +error[PLW2901]: 143:17: Outer `for` loop variable `i` overwritten by inner `for` loop target + --> redefined_loop_name.py:143:17 | 141 | class A: 142 | for i in []: # no error @@ -195,8 +216,9 @@ error[PLW2901]: redefined_loop_name.py:143:17: Outer `for` loop variable `i` ove | ^ 144 | pass | -error[PLW2901]: redefined_loop_name.py:158:5: `for` loop variable `a[0]` overwritten by assignment target +error[PLW2901]: 158:5: `for` loop variable `a[0]` overwritten by assignment target + --> redefined_loop_name.py:158:5 | 156 | # For target with subscript -> assignment 157 | for a[0] in []: @@ -204,8 +226,9 @@ error[PLW2901]: redefined_loop_name.py:158:5: `for` loop variable `a[0]` overwri | ^^^^ 159 | a[1] = 2 # no error | -error[PLW2901]: redefined_loop_name.py:163:5: `for` loop variable `a['i']` overwritten by assignment target +error[PLW2901]: 163:5: `for` loop variable `a['i']` overwritten by assignment target + --> redefined_loop_name.py:163:5 | 161 | # For target with subscript -> assignment 162 | for a['i'] in []: @@ -213,8 +236,9 @@ error[PLW2901]: redefined_loop_name.py:163:5: `for` loop variable `a['i']` overw | ^^^^^^ 164 | a['j'] = 2 # no error | -error[PLW2901]: redefined_loop_name.py:168:5: `for` loop variable `a.i` overwritten by assignment target +error[PLW2901]: 168:5: `for` loop variable `a.i` overwritten by assignment target + --> redefined_loop_name.py:168:5 | 166 | # For target with attribute -> assignment 167 | for a.i in []: @@ -222,8 +246,9 @@ error[PLW2901]: redefined_loop_name.py:168:5: `for` loop variable `a.i` overwrit | ^^^ 169 | a.j = 2 # no error | -error[PLW2901]: redefined_loop_name.py:173:5: `for` loop variable `a.i.j` overwritten by assignment target +error[PLW2901]: 173:5: `for` loop variable `a.i.j` overwritten by assignment target + --> redefined_loop_name.py:173:5 | 171 | # For target with double nested attribute -> assignment 172 | for a.i.j in []: @@ -231,8 +256,9 @@ error[PLW2901]: redefined_loop_name.py:173:5: `for` loop variable `a.i.j` overwr | ^^^^^ 174 | a.j.i = 2 # no error | -error[PLW2901]: redefined_loop_name.py:178:5: `for` loop variable `a.i` overwritten by assignment target +error[PLW2901]: 178:5: `for` loop variable `a.i` overwritten by assignment target + --> redefined_loop_name.py:178:5 | 176 | # For target with attribute -> assignment with different spacing 177 | for a.i in []: @@ -241,8 +267,9 @@ error[PLW2901]: redefined_loop_name.py:178:5: `for` loop variable `a.i` overwrit 179 | for a. i in []: 180 | a.i = 2 # error | -error[PLW2901]: redefined_loop_name.py:180:5: `for` loop variable `a.i` overwritten by assignment target +error[PLW2901]: 180:5: `for` loop variable `a.i` overwritten by assignment target + --> redefined_loop_name.py:180:5 | 178 | a. i = 2 # error 179 | for a. i in []: diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW3201_bad_dunder_method_name.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW3201_bad_dunder_method_name.py.snap index d29c746915..096a063a80 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW3201_bad_dunder_method_name.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW3201_bad_dunder_method_name.py.snap @@ -1,16 +1,18 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLW3201]: bad_dunder_method_name.py:5:9: Bad or misspelled dunder method name `_init_` +error[PLW3201]: 5:9: Bad or misspelled dunder method name `_init_` + --> bad_dunder_method_name.py:5:9 | 4 | class Apples: 5 | def _init_(self): # [bad-dunder-name] | ^^^^^^ 6 | pass | -error[PLW3201]: bad_dunder_method_name.py:8:9: Bad or misspelled dunder method name `__hello__` +error[PLW3201]: 8:9: Bad or misspelled dunder method name `__hello__` + --> bad_dunder_method_name.py:8:9 | 6 | pass 7 | @@ -18,8 +20,9 @@ error[PLW3201]: bad_dunder_method_name.py:8:9: Bad or misspelled dunder method n | ^^^^^^^^^ 9 | print("hello") | -error[PLW3201]: bad_dunder_method_name.py:11:9: Bad or misspelled dunder method name `__init_` +error[PLW3201]: 11:9: Bad or misspelled dunder method name `__init_` + --> bad_dunder_method_name.py:11:9 | 9 | print("hello") 10 | @@ -28,8 +31,9 @@ error[PLW3201]: bad_dunder_method_name.py:11:9: Bad or misspelled dunder method 12 | # author likely unintentionally misspelled the correct init dunder. 13 | pass | -error[PLW3201]: bad_dunder_method_name.py:15:9: Bad or misspelled dunder method name `_init_` +error[PLW3201]: 15:9: Bad or misspelled dunder method name `_init_` + --> bad_dunder_method_name.py:15:9 | 13 | pass 14 | @@ -38,8 +42,9 @@ error[PLW3201]: bad_dunder_method_name.py:15:9: Bad or misspelled dunder method 16 | # author likely unintentionally misspelled the correct init dunder. 17 | pass | -error[PLW3201]: bad_dunder_method_name.py:19:9: Bad or misspelled dunder method name `___neg__` +error[PLW3201]: 19:9: Bad or misspelled dunder method name `___neg__` + --> bad_dunder_method_name.py:19:9 | 17 | pass 18 | @@ -48,8 +53,9 @@ error[PLW3201]: bad_dunder_method_name.py:19:9: Bad or misspelled dunder method 20 | # author likely accidentally added an additional `_` 21 | pass | -error[PLW3201]: bad_dunder_method_name.py:23:9: Bad or misspelled dunder method name `__inv__` +error[PLW3201]: 23:9: Bad or misspelled dunder method name `__inv__` + --> bad_dunder_method_name.py:23:9 | 21 | pass 22 | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW3301_nested_min_max.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW3301_nested_min_max.py.snap index 9d6b0bbd87..7782ad3e41 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW3301_nested_min_max.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW3301_nested_min_max.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLW3301]: nested_min_max.py:2:1: [*] Nested `min` calls can be flattened +error[PLW3301]: 2:1: [*] Nested `min` calls can be flattened + --> nested_min_max.py:1:13 | 1 | min(1, 2, 3) 2 | min(1, min(2, 3)) @@ -19,8 +20,9 @@ error[PLW3301]: nested_min_max.py:2:1: [*] Nested `min` calls can be flattened 4 4 | min(1, foo("a", "b"), min(3, 4)) 5 5 | min(1, max(2, 3)) -error[PLW3301]: nested_min_max.py:3:1: [*] Nested `min` calls can be flattened +error[PLW3301]: 3:1: [*] Nested `min` calls can be flattened + --> nested_min_max.py:2:18 | 1 | min(1, 2, 3) 2 | min(1, min(2, 3)) @@ -39,8 +41,9 @@ error[PLW3301]: nested_min_max.py:3:1: [*] Nested `min` calls can be flattened 5 5 | min(1, max(2, 3)) 6 6 | max(1, 2, 3) -error[PLW3301]: nested_min_max.py:3:8: [*] Nested `min` calls can be flattened +error[PLW3301]: 3:8: [*] Nested `min` calls can be flattened + --> nested_min_max.py:3:8 | 1 | min(1, 2, 3) 2 | min(1, min(2, 3)) @@ -59,8 +62,9 @@ error[PLW3301]: nested_min_max.py:3:8: [*] Nested `min` calls can be flattened 5 5 | min(1, max(2, 3)) 6 6 | max(1, 2, 3) -error[PLW3301]: nested_min_max.py:4:1: [*] Nested `min` calls can be flattened +error[PLW3301]: 4:1: [*] Nested `min` calls can be flattened + --> nested_min_max.py:3:26 | 2 | min(1, min(2, 3)) 3 | min(1, min(2, min(3, 4))) @@ -80,8 +84,9 @@ error[PLW3301]: nested_min_max.py:4:1: [*] Nested `min` calls can be flattened 6 6 | max(1, 2, 3) 7 7 | max(1, max(2, 3)) -error[PLW3301]: nested_min_max.py:7:1: [*] Nested `max` calls can be flattened +error[PLW3301]: 7:1: [*] Nested `max` calls can be flattened + --> nested_min_max.py:6:13 | 5 | min(1, max(2, 3)) 6 | max(1, 2, 3) @@ -101,8 +106,9 @@ error[PLW3301]: nested_min_max.py:7:1: [*] Nested `max` calls can be flattened 9 9 | max(1, foo("a", "b"), max(3, 4)) 10 10 | -error[PLW3301]: nested_min_max.py:8:1: [*] Nested `max` calls can be flattened +error[PLW3301]: 8:1: [*] Nested `max` calls can be flattened + --> nested_min_max.py:7:18 | 6 | max(1, 2, 3) 7 | max(1, max(2, 3)) @@ -121,8 +127,9 @@ error[PLW3301]: nested_min_max.py:8:1: [*] Nested `max` calls can be flattened 10 10 | 11 11 | # These should not trigger; we do not flag cases with keyword args. -error[PLW3301]: nested_min_max.py:8:8: [*] Nested `max` calls can be flattened +error[PLW3301]: 8:8: [*] Nested `max` calls can be flattened + --> nested_min_max.py:8:8 | 6 | max(1, 2, 3) 7 | max(1, max(2, 3)) @@ -141,8 +148,9 @@ error[PLW3301]: nested_min_max.py:8:8: [*] Nested `max` calls can be flattened 10 10 | 11 11 | # These should not trigger; we do not flag cases with keyword args. -error[PLW3301]: nested_min_max.py:9:1: [*] Nested `max` calls can be flattened +error[PLW3301]: 9:1: [*] Nested `max` calls can be flattened + --> nested_min_max.py:8:26 | 7 | max(1, max(2, 3)) 8 | max(1, max(2, max(3, 4))) @@ -162,8 +170,9 @@ error[PLW3301]: nested_min_max.py:9:1: [*] Nested `max` calls can be flattened 11 11 | # These should not trigger; we do not flag cases with keyword args. 12 12 | min(1, min(2, 3), key=test) -error[PLW3301]: nested_min_max.py:15:1: [*] Nested `min` calls can be flattened +error[PLW3301]: 15:1: [*] Nested `min` calls can be flattened + --> nested_min_max.py:14:68 | 13 | min(1, min(2, 3, key=test)) 14 | # This will still trigger, to merge the calls without keyword args. @@ -183,8 +192,9 @@ error[PLW3301]: nested_min_max.py:15:1: [*] Nested `min` calls can be flattened 17 17 | # Don't provide a fix if there are comments within the call. 18 18 | min( -error[PLW3301]: nested_min_max.py:18:1: Nested `min` calls can be flattened +error[PLW3301]: 18:1: Nested `min` calls can be flattened + --> nested_min_max.py:17:61 | 17 | # Don't provide a fix if there are comments within the call. 18 | / min( @@ -196,8 +206,9 @@ error[PLW3301]: nested_min_max.py:18:1: Nested `min` calls can be flattened 23 | # Handle iterable expressions. | = help: Flatten nested `min` calls -error[PLW3301]: nested_min_max.py:24:1: [*] Nested `min` calls can be flattened +error[PLW3301]: 24:1: [*] Nested `min` calls can be flattened + --> nested_min_max.py:23:31 | 23 | # Handle iterable expressions. 24 | min(1, min(a)) @@ -216,8 +227,9 @@ error[PLW3301]: nested_min_max.py:24:1: [*] Nested `min` calls can be flattened 26 26 | max(1, max(a)) 27 27 | max(1, max(i for i in range(10))) -error[PLW3301]: nested_min_max.py:25:1: [*] Nested `min` calls can be flattened +error[PLW3301]: 25:1: [*] Nested `min` calls can be flattened + --> nested_min_max.py:24:15 | 23 | # Handle iterable expressions. 24 | min(1, min(a)) @@ -237,8 +249,9 @@ error[PLW3301]: nested_min_max.py:25:1: [*] Nested `min` calls can be flattened 27 27 | max(1, max(i for i in range(10))) 28 28 | -error[PLW3301]: nested_min_max.py:26:1: [*] Nested `max` calls can be flattened +error[PLW3301]: 26:1: [*] Nested `max` calls can be flattened + --> nested_min_max.py:25:34 | 24 | min(1, min(a)) 25 | min(1, min(i for i in range(10))) @@ -257,8 +270,9 @@ error[PLW3301]: nested_min_max.py:26:1: [*] Nested `max` calls can be flattened 28 28 | 29 29 | tuples_list = [ -error[PLW3301]: nested_min_max.py:27:1: [*] Nested `max` calls can be flattened +error[PLW3301]: 27:1: [*] Nested `max` calls can be flattened + --> nested_min_max.py:26:15 | 25 | min(1, min(i for i in range(10))) 26 | max(1, max(a)) @@ -278,8 +292,9 @@ error[PLW3301]: nested_min_max.py:27:1: [*] Nested `max` calls can be flattened 29 29 | tuples_list = [ 30 30 | (1, 2), -error[PLW3301]: nested_min_max.py:41:1: [*] Nested `max` calls can be flattened +error[PLW3301]: 41:1: [*] Nested `max` calls can be flattened + --> nested_min_max.py:40:46 | 40 | # Starred argument should be copied as it is. 41 | max(1, max(*a)) @@ -298,8 +313,9 @@ error[PLW3301]: nested_min_max.py:41:1: [*] Nested `max` calls can be flattened 43 43 | import builtins 44 44 | builtins.min(1, min(2, 3)) -error[PLW3301]: nested_min_max.py:44:1: [*] Nested `min` calls can be flattened +error[PLW3301]: 44:1: [*] Nested `min` calls can be flattened + --> nested_min_max.py:43:16 | 43 | import builtins 44 | builtins.min(1, min(2, 3)) diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__allow_magic_value_types.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__allow_magic_value_types.snap index 3f1ee985c8..6fb81b6253 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__allow_magic_value_types.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__allow_magic_value_types.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLR2004]: magic_value_comparison.py:56:12: Magic value used in comparison, consider replacing `-2.0` with a constant variable +error[PLR2004]: 56:12: Magic value used in comparison, consider replacing `-2.0` with a constant variable + --> magic_value_comparison.py:56:12 | 54 | pass 55 | @@ -10,8 +11,9 @@ error[PLR2004]: magic_value_comparison.py:56:12: Magic value used in comparison, | ^^^^ 57 | pass | -error[PLR2004]: magic_value_comparison.py:59:12: Magic value used in comparison, consider replacing `+2.0` with a constant variable +error[PLR2004]: 59:12: Magic value used in comparison, consider replacing `+2.0` with a constant variable + --> magic_value_comparison.py:59:12 | 57 | pass 58 | @@ -19,8 +21,9 @@ error[PLR2004]: magic_value_comparison.py:59:12: Magic value used in comparison, | ^^^^ 60 | pass | -error[PLR2004]: magic_value_comparison.py:74:22: Magic value used in comparison, consider replacing `"Hunter2"` with a constant variable +error[PLR2004]: 74:22: Magic value used in comparison, consider replacing `"Hunter2"` with a constant variable + --> magic_value_comparison.py:74:22 | 72 | pass 73 | @@ -28,8 +31,9 @@ error[PLR2004]: magic_value_comparison.py:74:22: Magic value used in comparison, | ^^^^^^^^^ 75 | pass | -error[PLR2004]: magic_value_comparison.py:80:21: Magic value used in comparison, consider replacing `3.141592653589793238` with a constant variable +error[PLR2004]: 80:21: Magic value used in comparison, consider replacing `3.141592653589793238` with a constant variable + --> magic_value_comparison.py:80:21 | 78 | pi_estimation = 3.14 79 | @@ -37,8 +41,9 @@ error[PLR2004]: magic_value_comparison.py:80:21: Magic value used in comparison, | ^^^^^^^^^^^^^^^^^^^^ 81 | pass | -error[PLR2004]: magic_value_comparison.py:92:18: Magic value used in comparison, consider replacing `b"something"` with a constant variable +error[PLR2004]: 92:18: Magic value used in comparison, consider replacing `b"something"` with a constant variable + --> magic_value_comparison.py:92:18 | 90 | user_input = b"Hello, There!" 91 | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__continue_in_finally.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__continue_in_finally.snap index 7eb58ebd6b..f9e12ff5ce 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__continue_in_finally.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__continue_in_finally.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLE0116]: continue_in_finally.py:5:9: `continue` not supported inside `finally` clause +error[PLE0116]: 5:9: `continue` not supported inside `finally` clause + --> continue_in_finally.py:5:9 | 3 | pass 4 | finally: @@ -11,8 +12,9 @@ error[PLE0116]: continue_in_finally.py:5:9: `continue` not supported inside `fin 6 | 7 | while True: | -error[PLE0116]: continue_in_finally.py:16:13: `continue` not supported inside `finally` clause +error[PLE0116]: 16:13: `continue` not supported inside `finally` clause + --> continue_in_finally.py:16:13 | 14 | pass 15 | finally: @@ -20,8 +22,9 @@ error[PLE0116]: continue_in_finally.py:16:13: `continue` not supported inside `f | ^^^^^^^^ 17 | pass | -error[PLE0116]: continue_in_finally.py:26:17: `continue` not supported inside `finally` clause +error[PLE0116]: 26:17: `continue` not supported inside `finally` clause + --> continue_in_finally.py:26:17 | 24 | match test: 25 | case "aa": @@ -30,8 +33,9 @@ error[PLE0116]: continue_in_finally.py:26:17: `continue` not supported inside `f 27 | 28 | while True: | -error[PLE0116]: continue_in_finally.py:33:13: `continue` not supported inside `finally` clause +error[PLE0116]: 33:13: `continue` not supported inside `finally` clause + --> continue_in_finally.py:33:13 | 31 | finally: 32 | with "aa" as f: @@ -40,8 +44,9 @@ error[PLE0116]: continue_in_finally.py:33:13: `continue` not supported inside `f 34 | 35 | while True: | -error[PLE0116]: continue_in_finally.py:40:13: `continue` not supported inside `finally` clause +error[PLE0116]: 40:13: `continue` not supported inside `finally` clause + --> continue_in_finally.py:40:13 | 38 | finally: 39 | if True: @@ -49,8 +54,9 @@ error[PLE0116]: continue_in_finally.py:40:13: `continue` not supported inside `f | ^^^^^^^^ 41 | continue # [continue-in-finally] | -error[PLE0116]: continue_in_finally.py:41:9: `continue` not supported inside `finally` clause +error[PLE0116]: 41:9: `continue` not supported inside `finally` clause + --> continue_in_finally.py:41:9 | 39 | if True: 40 | continue # [continue-in-finally] @@ -59,16 +65,18 @@ error[PLE0116]: continue_in_finally.py:41:9: `continue` not supported inside `fi 42 | 43 | def test(): | -error[PLE0116]: continue_in_finally.py:49:17: `continue` not supported inside `finally` clause +error[PLE0116]: 49:17: `continue` not supported inside `finally` clause + --> continue_in_finally.py:49:17 | 47 | pass 48 | finally: 49 | continue # [continue-in-finally] | ^^^^^^^^ | -error[PLE0116]: continue_in_finally.py:56:9: `continue` not supported inside `finally` clause +error[PLE0116]: 56:9: `continue` not supported inside `finally` clause + --> continue_in_finally.py:56:9 | 54 | pass 55 | finally: @@ -77,8 +85,9 @@ error[PLE0116]: continue_in_finally.py:56:9: `continue` not supported inside `fi 57 | 58 | def test(): | -error[PLE0116]: continue_in_finally.py:69:9: `continue` not supported inside `finally` clause +error[PLE0116]: 69:9: `continue` not supported inside `finally` clause + --> continue_in_finally.py:69:9 | 67 | for i in range(12): 68 | continue @@ -87,8 +96,9 @@ error[PLE0116]: continue_in_finally.py:69:9: `continue` not supported inside `fi 70 | 71 | while True: | -error[PLE0116]: continue_in_finally.py:74:13: `continue` not supported inside `finally` clause +error[PLE0116]: 74:13: `continue` not supported inside `finally` clause + --> continue_in_finally.py:74:13 | 72 | pass 73 | else: @@ -97,8 +107,9 @@ error[PLE0116]: continue_in_finally.py:74:13: `continue` not supported inside `f 75 | 76 | def test(): | -error[PLE0116]: continue_in_finally.py:89:13: `continue` not supported inside `finally` clause +error[PLE0116]: 89:13: `continue` not supported inside `finally` clause + --> continue_in_finally.py:89:13 | 87 | pass 88 | elif False: @@ -107,8 +118,9 @@ error[PLE0116]: continue_in_finally.py:89:13: `continue` not supported inside `f 90 | else: 91 | continue # [continue-in-finally] | -error[PLE0116]: continue_in_finally.py:91:13: `continue` not supported inside `finally` clause +error[PLE0116]: 91:13: `continue` not supported inside `finally` clause + --> continue_in_finally.py:91:13 | 89 | continue # [continue-in-finally] 90 | else: @@ -117,8 +129,9 @@ error[PLE0116]: continue_in_finally.py:91:13: `continue` not supported inside `f 92 | for i in range(10): 93 | pass | -error[PLE0116]: continue_in_finally.py:95:17: `continue` not supported inside `finally` clause +error[PLE0116]: 95:17: `continue` not supported inside `finally` clause + --> continue_in_finally.py:95:17 | 93 | pass 94 | else: diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__max_args.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__max_args.snap index 08d1803528..75e62582cf 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__max_args.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__max_args.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLR0913]: too_many_arguments_params.py:3:5: Too many arguments in function definition (6 > 4) +error[PLR0913]: 3:5: Too many arguments in function definition (6 > 4) + --> too_many_arguments_params.py:3:5 | 1 | # Too many args (6/4) for max_args=4 2 | # OK for dummy_variable_rgx ~ "skip_.*" @@ -10,8 +11,9 @@ error[PLR0913]: too_many_arguments_params.py:3:5: Too many arguments in function | ^ 4 | pass | -error[PLR0913]: too_many_arguments_params.py:9:5: Too many arguments in function definition (6 > 4) +error[PLR0913]: 9:5: Too many arguments in function definition (6 > 4) + --> too_many_arguments_params.py:9:5 | 7 | # Too many args (6/4) for max_args=4 8 | # Too many args (6/5) for dummy_variable_rgx ~ "skip_.*" diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__max_args_with_dummy_variables.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__max_args_with_dummy_variables.snap index 1a5bcb324a..77cd108e0e 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__max_args_with_dummy_variables.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__max_args_with_dummy_variables.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLR0913]: too_many_arguments_params.py:9:5: Too many arguments in function definition (6 > 5) +error[PLR0913]: 9:5: Too many arguments in function definition (6 > 5) + --> too_many_arguments_params.py:9:5 | 7 | # Too many args (6/4) for max_args=4 8 | # Too many args (6/5) for dummy_variable_rgx ~ "skip_.*" diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__max_boolean_expressions.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__max_boolean_expressions.snap index b4f88f8e7c..88ec7137ac 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__max_boolean_expressions.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__max_boolean_expressions.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLR0916]: too_many_boolean_expressions.py:11:6: Too many Boolean expressions (6 > 5) +error[PLR0916]: 11:6: Too many Boolean expressions (6 > 5) + --> too_many_boolean_expressions.py:11:6 | 9 | elif (a and b) and c and d and e: 10 | ... @@ -11,8 +12,9 @@ error[PLR0916]: too_many_boolean_expressions.py:11:6: Too many Boolean expressio 12 | ... 13 | elif (a and b) and c and d and e and f and g: | -error[PLR0916]: too_many_boolean_expressions.py:13:6: Too many Boolean expressions (7 > 5) +error[PLR0916]: 13:6: Too many Boolean expressions (7 > 5) + --> too_many_boolean_expressions.py:13:6 | 11 | elif (a and b) and c and d and e and f: 12 | ... @@ -21,8 +23,9 @@ error[PLR0916]: too_many_boolean_expressions.py:13:6: Too many Boolean expressio 14 | ... 15 | elif (a and b) and c and d and e and f and g and h: | -error[PLR0916]: too_many_boolean_expressions.py:15:6: Too many Boolean expressions (8 > 5) +error[PLR0916]: 15:6: Too many Boolean expressions (8 > 5) + --> too_many_boolean_expressions.py:15:6 | 13 | elif (a and b) and c and d and e and f and g: 14 | ... @@ -31,8 +34,9 @@ error[PLR0916]: too_many_boolean_expressions.py:15:6: Too many Boolean expressio 16 | ... 17 | elif (a and b) and c and d and e and f and g and h and i: | -error[PLR0916]: too_many_boolean_expressions.py:17:6: Too many Boolean expressions (9 > 5) +error[PLR0916]: 17:6: Too many Boolean expressions (9 > 5) + --> too_many_boolean_expressions.py:17:6 | 15 | elif (a and b) and c and d and e and f and g and h: 16 | ... @@ -41,8 +45,9 @@ error[PLR0916]: too_many_boolean_expressions.py:17:6: Too many Boolean expressio 18 | ... 19 | elif (a and b) and c and d and e and f and g and h and i and j: | -error[PLR0916]: too_many_boolean_expressions.py:19:6: Too many Boolean expressions (10 > 5) +error[PLR0916]: 19:6: Too many Boolean expressions (10 > 5) + --> too_many_boolean_expressions.py:19:6 | 17 | elif (a and b) and c and d and e and f and g and h and i: 18 | ... @@ -51,8 +56,9 @@ error[PLR0916]: too_many_boolean_expressions.py:19:6: Too many Boolean expressio 20 | ... 21 | elif (a and b) and c and d and e and f and g and h and i and j and k: | -error[PLR0916]: too_many_boolean_expressions.py:21:6: Too many Boolean expressions (11 > 5) +error[PLR0916]: 21:6: Too many Boolean expressions (11 > 5) + --> too_many_boolean_expressions.py:21:6 | 19 | elif (a and b) and c and d and e and f and g and h and i and j: 20 | ... @@ -61,8 +67,9 @@ error[PLR0916]: too_many_boolean_expressions.py:21:6: Too many Boolean expressio 22 | ... 23 | elif (a and b) and c and d and e and f and g and h and i and j and k and l: | -error[PLR0916]: too_many_boolean_expressions.py:23:6: Too many Boolean expressions (12 > 5) +error[PLR0916]: 23:6: Too many Boolean expressions (12 > 5) + --> too_many_boolean_expressions.py:23:6 | 21 | elif (a and b) and c and d and e and f and g and h and i and j and k: 22 | ... @@ -71,8 +78,9 @@ error[PLR0916]: too_many_boolean_expressions.py:23:6: Too many Boolean expressio 24 | ... 25 | elif (a and b) and c and d and e and f and g and h and i and j and k and l and m: | -error[PLR0916]: too_many_boolean_expressions.py:25:6: Too many Boolean expressions (13 > 5) +error[PLR0916]: 25:6: Too many Boolean expressions (13 > 5) + --> too_many_boolean_expressions.py:25:6 | 23 | elif (a and b) and c and d and e and f and g and h and i and j and k and l: 24 | ... @@ -81,8 +89,9 @@ error[PLR0916]: too_many_boolean_expressions.py:25:6: Too many Boolean expressio 26 | ... 27 | elif (a and b) and c and d and e and f and g and h and i and j and k and l and m and n: | -error[PLR0916]: too_many_boolean_expressions.py:27:6: Too many Boolean expressions (14 > 5) +error[PLR0916]: 27:6: Too many Boolean expressions (14 > 5) + --> too_many_boolean_expressions.py:27:6 | 25 | elif (a and b) and c and d and e and f and g and h and i and j and k and l and m: 26 | ... @@ -91,8 +100,9 @@ error[PLR0916]: too_many_boolean_expressions.py:27:6: Too many Boolean expressio 28 | ... 29 | elif (a and b) and c and d and e and f and g and h and i and j and k and l and m and n and o: | -error[PLR0916]: too_many_boolean_expressions.py:29:6: Too many Boolean expressions (15 > 5) +error[PLR0916]: 29:6: Too many Boolean expressions (15 > 5) + --> too_many_boolean_expressions.py:29:6 | 27 | elif (a and b) and c and d and e and f and g and h and i and j and k and l and m and n: 28 | ... @@ -101,8 +111,9 @@ error[PLR0916]: too_many_boolean_expressions.py:29:6: Too many Boolean expressio 30 | ... 31 | elif (a and b) and c and d and e and f and g and h and i and j and k and l and m and n and o and p: | -error[PLR0916]: too_many_boolean_expressions.py:31:6: Too many Boolean expressions (16 > 5) +error[PLR0916]: 31:6: Too many Boolean expressions (16 > 5) + --> too_many_boolean_expressions.py:31:6 | 29 | elif (a and b) and c and d and e and f and g and h and i and j and k and l and m and n and o: 30 | ... @@ -111,8 +122,9 @@ error[PLR0916]: too_many_boolean_expressions.py:31:6: Too many Boolean expressio 32 | ... 33 | elif (a and b) and c and d and e and f and g and h and i and j and k and l and m and n and o and p and q: | -error[PLR0916]: too_many_boolean_expressions.py:33:6: Too many Boolean expressions (17 > 5) +error[PLR0916]: 33:6: Too many Boolean expressions (17 > 5) + --> too_many_boolean_expressions.py:33:6 | 31 | elif (a and b) and c and d and e and f and g and h and i and j and k and l and m and n and o and p: 32 | ... @@ -121,8 +133,9 @@ error[PLR0916]: too_many_boolean_expressions.py:33:6: Too many Boolean expressio 34 | ... 35 | elif (a and b) and c and d and e and f and g and h and i and j and k and l and m and n and o and p and q and r: | -error[PLR0916]: too_many_boolean_expressions.py:35:6: Too many Boolean expressions (18 > 5) +error[PLR0916]: 35:6: Too many Boolean expressions (18 > 5) + --> too_many_boolean_expressions.py:35:6 | 33 | elif (a and b) and c and d and e and f and g and h and i and j and k and l and m and n and o and p and q: 34 | ... @@ -131,8 +144,9 @@ error[PLR0916]: too_many_boolean_expressions.py:35:6: Too many Boolean expressio 36 | ... 37 | elif (a and b) and c and d and e and f and g and h and i and j and k and l and m and n and o and p and q and r and s: | -error[PLR0916]: too_many_boolean_expressions.py:37:6: Too many Boolean expressions (19 > 5) +error[PLR0916]: 37:6: Too many Boolean expressions (19 > 5) + --> too_many_boolean_expressions.py:37:6 | 35 | elif (a and b) and c and d and e and f and g and h and i and j and k and l and m and n and o and p and q and r: 36 | ... @@ -141,8 +155,9 @@ error[PLR0916]: too_many_boolean_expressions.py:37:6: Too many Boolean expressio 38 | ... 39 | elif (a and b) and c and d and e and f and g and h and i and j and k and l and m and n and o and p and q and r and s and t: | -error[PLR0916]: too_many_boolean_expressions.py:39:6: Too many Boolean expressions (20 > 5) +error[PLR0916]: 39:6: Too many Boolean expressions (20 > 5) + --> too_many_boolean_expressions.py:39:6 | 37 | elif (a and b) and c and d and e and f and g and h and i and j and k and l and m and n and o and p and q and r and s: 38 | ... @@ -151,8 +166,9 @@ error[PLR0916]: too_many_boolean_expressions.py:39:6: Too many Boolean expressio 40 | ... 41 | elif (a and b) and c and d and e and f and g and h and i and j and k and l and m and n and o and p and q and r and s and t and u: | -error[PLR0916]: too_many_boolean_expressions.py:41:6: Too many Boolean expressions (21 > 5) +error[PLR0916]: 41:6: Too many Boolean expressions (21 > 5) + --> too_many_boolean_expressions.py:41:6 | 39 | elif (a and b) and c and d and e and f and g and h and i and j and k and l and m and n and o and p and q and r and s and t: 40 | ... @@ -161,8 +177,9 @@ error[PLR0916]: too_many_boolean_expressions.py:41:6: Too many Boolean expressio 42 | ... 43 | elif (a and b) and c and d and e and f and g and h and i and j and k and l and m and n and o and p and q and r and s and t and u and v: | -error[PLR0916]: too_many_boolean_expressions.py:43:6: Too many Boolean expressions (22 > 5) +error[PLR0916]: 43:6: Too many Boolean expressions (22 > 5) + --> too_many_boolean_expressions.py:43:6 | 41 | elif (a and b) and c and d and e and f and g and h and i and j and k and l and m and n and o and p and q and r and s and t and u: 42 | ... @@ -171,8 +188,9 @@ error[PLR0916]: too_many_boolean_expressions.py:43:6: Too many Boolean expressio 44 | ... 45 | elif (a and b) and c and d and e and f and g and h and i and j and k and l and m and n and o and p and q and r and s and t and u and v an... | -error[PLR0916]: too_many_boolean_expressions.py:45:6: Too many Boolean expressions (23 > 5) +error[PLR0916]: 45:6: Too many Boolean expressions (23 > 5) + --> too_many_boolean_expressions.py:45:6 | 43 | elif (a and b) and c and d and e and f and g and h and i and j and k and l and m and n and o and p and q and r and s and t and u and v: 44 | ... @@ -181,8 +199,9 @@ error[PLR0916]: too_many_boolean_expressions.py:45:6: Too many Boolean expressio 46 | ... 47 | elif (a and b) and c and d and e and f and g and h and i and j and k and l and m and n and o and p and q and r and s and t and u and v and w an... | -error[PLR0916]: too_many_boolean_expressions.py:47:6: Too many Boolean expressions (24 > 5) +error[PLR0916]: 47:6: Too many Boolean expressions (24 > 5) + --> too_many_boolean_expressions.py:47:6 | 45 | elif (a and b) and c and d and e and f and g and h and i and j and k and l and m and n and o and p and q and r and s and t and u and v and w: 46 | ... @@ -191,8 +210,9 @@ error[PLR0916]: too_many_boolean_expressions.py:47:6: Too many Boolean expressio 48 | ... 49 | elif (a and b) and c and d and e and f and g and h and i and j and k and l and m and n and o and p and q and r and s and t and u and v and w and x an... | -error[PLR0916]: too_many_boolean_expressions.py:49:6: Too many Boolean expressions (25 > 5) +error[PLR0916]: 49:6: Too many Boolean expressions (25 > 5) + --> too_many_boolean_expressions.py:49:6 | 47 | elif (a and b) and c and d and e and f and g and h and i and j and k and l and m and n and o and p and q and r and s and t and u and v and w and x: 48 | ... @@ -201,8 +221,9 @@ error[PLR0916]: too_many_boolean_expressions.py:49:6: Too many Boolean expressio 50 | ... 51 | elif (a and b) and c and d and e and f and g and h and i and j and k and l and m and n and o and p and q and r and s and t and u and v and w and x and y an... | -error[PLR0916]: too_many_boolean_expressions.py:51:6: Too many Boolean expressions (26 > 5) +error[PLR0916]: 51:6: Too many Boolean expressions (26 > 5) + --> too_many_boolean_expressions.py:51:6 | 49 | elif (a and b) and c and d and e and f and g and h and i and j and k and l and m and n and o and p and q and r and s and t and u and v and w and x and y: 50 | ... diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__max_branches.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__max_branches.snap index b84e55d863..aaa36330e0 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__max_branches.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__max_branches.snap @@ -1,16 +1,18 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLR0912]: too_many_branches_params.py:6:5: Too many branches (2 > 1) +error[PLR0912]: 6:5: Too many branches (2 > 1) + --> too_many_branches_params.py:6:5 | 6 | def g(x): | ^ 7 | if x: 8 | pass | -error[PLR0912]: too_many_branches_params.py:15:9: Too many branches (2 > 1) +error[PLR0912]: 15:9: Too many branches (2 > 1) + --> too_many_branches_params.py:15:9 | 13 | return 14 | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__max_positional_args.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__max_positional_args.snap index d4dacce054..0414770c76 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__max_positional_args.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__max_positional_args.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLR0917]: too_many_positional_params.py:3:5: Too many positional arguments (7/4) +error[PLR0917]: 3:5: Too many positional arguments (7/4) + --> too_many_positional_params.py:3:5 | 1 | # Too many positional arguments (7/4) for max_positional=4 2 | # OK for dummy_variable_rgx ~ "skip_.*" @@ -10,8 +11,9 @@ error[PLR0917]: too_many_positional_params.py:3:5: Too many positional arguments | ^ 4 | pass | -error[PLR0917]: too_many_positional_params.py:9:5: Too many positional arguments (7/4) +error[PLR0917]: 9:5: Too many positional arguments (7/4) + --> too_many_positional_params.py:9:5 | 7 | # Too many positional arguments (7/4) for max_args=4 8 | # Too many positional arguments (7/3) for dummy_variable_rgx ~ "skip_.*" diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__max_return_statements.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__max_return_statements.snap index 97bc05d4a1..77c6dead88 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__max_return_statements.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__max_return_statements.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLR0911]: too_many_return_statements_params.py:1:5: Too many return statements (2 > 1) +error[PLR0911]: 1:5: Too many return statements (2 > 1) + --> too_many_return_statements_params.py:1:5 | 1 | def f(x): # Too many return statements (2/1) | ^ diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__max_statements.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__max_statements.snap index bef3de4118..c00cbc9bc5 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__max_statements.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__max_statements.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLR0915]: too_many_statements_params.py:6:5: Too many statements (2 > 1) +error[PLR0915]: 6:5: Too many statements (2 > 1) + --> too_many_statements_params.py:6:5 | 6 | def f(x): | ^ diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__too_many_locals.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__too_many_locals.snap index 757ba0b8d3..e8ed9ca4bb 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__too_many_locals.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__too_many_locals.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLR0914]: too_many_locals.py:20:5: Too many local variables (16/15) +error[PLR0914]: 20:5: Too many local variables (16/15) + --> too_many_locals.py:20:5 | 20 | def func() -> None: # PLR0914 | ^^^^ diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__too_many_public_methods.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__too_many_public_methods.snap index c6f893db1b..46113014e6 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__too_many_public_methods.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__too_many_public_methods.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -error[PLR0904]: too_many_public_methods.py:1:1: Too many public methods (10 > 7) +error[PLR0904]: 1:1: Too many public methods (10 > 7) + --> too_many_public_methods.py:1:1 | 1 | / class Everything: 2 | | foo = 1 diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP001.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP001.py.snap index 96342525ee..8ec5f340a0 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP001.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP001.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -error[UP001]: UP001.py:2:5: [*] `__metaclass__ = type` is implied +error[UP001]: 2:5: [*] `__metaclass__ = type` is implied + --> UP001.py:2:5 | 1 | class A: 2 | __metaclass__ = type @@ -17,8 +18,9 @@ error[UP001]: UP001.py:2:5: [*] `__metaclass__ = type` is implied 4 4 | 5 5 | class B: -error[UP001]: UP001.py:6:5: [*] `__metaclass__ = type` is implied +error[UP001]: 6:5: [*] `__metaclass__ = type` is implied + --> UP001.py:6:5 | 5 | class B: 6 | __metaclass__ = type diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP003.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP003.py.snap index da5fe21fc6..ef1da8c5e1 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP003.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP003.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -error[UP003]: UP003.py:1:1: [*] Use `str` instead of `type(...)` +error[UP003]: 1:1: [*] Use `str` instead of `type(...)` + --> UP003.py:1:1 | 1 | type("") | ^^^^^^^^ @@ -17,8 +18,9 @@ error[UP003]: UP003.py:1:1: [*] Use `str` instead of `type(...)` 3 3 | type(0) 4 4 | type(0.0) -error[UP003]: UP003.py:2:1: [*] Use `bytes` instead of `type(...)` +error[UP003]: 2:1: [*] Use `bytes` instead of `type(...)` + --> UP003.py:1:9 | 1 | type("") 2 | type(b"") @@ -35,8 +37,9 @@ error[UP003]: UP003.py:2:1: [*] Use `bytes` instead of `type(...)` 4 4 | type(0.0) 5 5 | type(0j) -error[UP003]: UP003.py:3:1: [*] Use `int` instead of `type(...)` +error[UP003]: 3:1: [*] Use `int` instead of `type(...)` + --> UP003.py:2:10 | 1 | type("") 2 | type(b"") @@ -55,8 +58,9 @@ error[UP003]: UP003.py:3:1: [*] Use `int` instead of `type(...)` 5 5 | type(0j) 6 6 | -error[UP003]: UP003.py:4:1: [*] Use `float` instead of `type(...)` +error[UP003]: 4:1: [*] Use `float` instead of `type(...)` + --> UP003.py:3:8 | 2 | type(b"") 3 | type(0) @@ -75,8 +79,9 @@ error[UP003]: UP003.py:4:1: [*] Use `float` instead of `type(...)` 6 6 | 7 7 | # OK -error[UP003]: UP003.py:5:1: [*] Use `complex` instead of `type(...)` +error[UP003]: 5:1: [*] Use `complex` instead of `type(...)` + --> UP003.py:4:10 | 3 | type(0) 4 | type(0.0) @@ -96,8 +101,9 @@ error[UP003]: UP003.py:5:1: [*] Use `complex` instead of `type(...)` 7 7 | # OK 8 8 | type(arg)(" ") -error[UP003]: UP003.py:14:29: [*] Use `str` instead of `type(...)` +error[UP003]: 14:29: [*] Use `str` instead of `type(...)` + --> UP003.py:14:29 | 13 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1722459841 14 | assert isinstance(fullname, type("")is not True) diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP004.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP004.py.snap index 5dad38c48c..2d4bd54b10 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP004.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP004.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -error[UP004]: UP004.py:5:9: [*] Class `A` inherits from `object` +error[UP004]: 5:9: [*] Class `A` inherits from `object` + --> UP004.py:5:9 | 5 | class A(object): | ^^^^^^ @@ -19,8 +20,9 @@ error[UP004]: UP004.py:5:9: [*] Class `A` inherits from `object` 7 7 | 8 8 | -error[UP004]: UP004.py:10:5: [*] Class `A` inherits from `object` +error[UP004]: 10:5: [*] Class `A` inherits from `object` + --> UP004.py:10:5 | 9 | class A( 10 | object, @@ -41,8 +43,9 @@ error[UP004]: UP004.py:10:5: [*] Class `A` inherits from `object` 13 11 | 14 12 | -error[UP004]: UP004.py:16:5: [*] Class `A` inherits from `object` +error[UP004]: 16:5: [*] Class `A` inherits from `object` + --> UP004.py:16:5 | 15 | class A( 16 | object, @@ -64,8 +67,9 @@ error[UP004]: UP004.py:16:5: [*] Class `A` inherits from `object` 20 17 | 21 18 | -error[UP004]: UP004.py:24:5: [*] Class `A` inherits from `object` +error[UP004]: 24:5: [*] Class `A` inherits from `object` + --> UP004.py:24:5 | 22 | class A( 23 | # @@ -88,8 +92,9 @@ error[UP004]: UP004.py:24:5: [*] Class `A` inherits from `object` 27 24 | 28 25 | -error[UP004]: UP004.py:31:5: [*] Class `A` inherits from `object` +error[UP004]: 31:5: [*] Class `A` inherits from `object` + --> UP004.py:31:5 | 29 | class A( 30 | # @@ -112,8 +117,9 @@ error[UP004]: UP004.py:31:5: [*] Class `A` inherits from `object` 34 31 | 35 32 | -error[UP004]: UP004.py:37:5: [*] Class `A` inherits from `object` +error[UP004]: 37:5: [*] Class `A` inherits from `object` + --> UP004.py:37:5 | 36 | class A( 37 | object @@ -135,8 +141,9 @@ error[UP004]: UP004.py:37:5: [*] Class `A` inherits from `object` 41 38 | 42 39 | -error[UP004]: UP004.py:45:5: [*] Class `A` inherits from `object` +error[UP004]: 45:5: [*] Class `A` inherits from `object` + --> UP004.py:45:5 | 43 | class A( 44 | # @@ -160,8 +167,9 @@ error[UP004]: UP004.py:45:5: [*] Class `A` inherits from `object` 49 45 | 50 46 | -error[UP004]: UP004.py:53:5: [*] Class `A` inherits from `object` +error[UP004]: 53:5: [*] Class `A` inherits from `object` + --> UP004.py:53:5 | 51 | class A( 52 | # @@ -185,8 +193,9 @@ error[UP004]: UP004.py:53:5: [*] Class `A` inherits from `object` 57 53 | 58 54 | -error[UP004]: UP004.py:61:5: [*] Class `A` inherits from `object` +error[UP004]: 61:5: [*] Class `A` inherits from `object` + --> UP004.py:61:5 | 59 | class A( 60 | # @@ -210,8 +219,9 @@ error[UP004]: UP004.py:61:5: [*] Class `A` inherits from `object` 65 61 | 66 62 | -error[UP004]: UP004.py:69:5: [*] Class `A` inherits from `object` +error[UP004]: 69:5: [*] Class `A` inherits from `object` + --> UP004.py:69:5 | 67 | class A( 68 | # @@ -235,8 +245,9 @@ error[UP004]: UP004.py:69:5: [*] Class `A` inherits from `object` 73 69 | 74 70 | -error[UP004]: UP004.py:75:12: [*] Class `B` inherits from `object` +error[UP004]: 75:12: [*] Class `B` inherits from `object` + --> UP004.py:75:12 | 75 | class B(A, object): | ^^^^^^ @@ -253,8 +264,9 @@ error[UP004]: UP004.py:75:12: [*] Class `B` inherits from `object` 77 77 | 78 78 | -error[UP004]: UP004.py:79:9: [*] Class `B` inherits from `object` +error[UP004]: 79:9: [*] Class `B` inherits from `object` + --> UP004.py:79:9 | 79 | class B(object, A): | ^^^^^^ @@ -271,8 +283,9 @@ error[UP004]: UP004.py:79:9: [*] Class `B` inherits from `object` 81 81 | 82 82 | -error[UP004]: UP004.py:84:5: [*] Class `B` inherits from `object` +error[UP004]: 84:5: [*] Class `B` inherits from `object` + --> UP004.py:84:5 | 83 | class B( 84 | object, @@ -290,8 +303,9 @@ error[UP004]: UP004.py:84:5: [*] Class `B` inherits from `object` 86 85 | ): 87 86 | ... -error[UP004]: UP004.py:92:5: [*] Class `B` inherits from `object` +error[UP004]: 92:5: [*] Class `B` inherits from `object` + --> UP004.py:92:5 | 90 | class B( 91 | A, @@ -310,8 +324,9 @@ error[UP004]: UP004.py:92:5: [*] Class `B` inherits from `object` 94 93 | ... 95 94 | -error[UP004]: UP004.py:98:5: [*] Class `B` inherits from `object` +error[UP004]: 98:5: [*] Class `B` inherits from `object` + --> UP004.py:98:5 | 97 | class B( 98 | object, @@ -329,8 +344,9 @@ error[UP004]: UP004.py:98:5: [*] Class `B` inherits from `object` 100 99 | A, 101 100 | ): -error[UP004]: UP004.py:108:5: [*] Class `B` inherits from `object` +error[UP004]: 108:5: [*] Class `B` inherits from `object` + --> UP004.py:108:5 | 106 | # Comment on A. 107 | A, @@ -349,8 +365,9 @@ error[UP004]: UP004.py:108:5: [*] Class `B` inherits from `object` 110 109 | ... 111 110 | -error[UP004]: UP004.py:119:5: [*] Class `A` inherits from `object` +error[UP004]: 119:5: [*] Class `A` inherits from `object` + --> UP004.py:119:5 | 118 | class A( 119 | object, @@ -371,8 +388,9 @@ error[UP004]: UP004.py:119:5: [*] Class `A` inherits from `object` 122 120 | 123 121 | -error[UP004]: UP004.py:125:5: [*] Class `A` inherits from `object` +error[UP004]: 125:5: [*] Class `A` inherits from `object` + --> UP004.py:125:5 | 124 | class A( 125 | object, # ) @@ -393,8 +411,9 @@ error[UP004]: UP004.py:125:5: [*] Class `A` inherits from `object` 128 126 | 129 127 | -error[UP004]: UP004.py:131:5: [*] Class `A` inherits from `object` +error[UP004]: 131:5: [*] Class `A` inherits from `object` + --> UP004.py:131:5 | 130 | class A( 131 | object # ) @@ -416,8 +435,9 @@ error[UP004]: UP004.py:131:5: [*] Class `A` inherits from `object` 135 132 | 136 133 | -error[UP004]: UP004.py:137:9: [*] Class `A` inherits from `object` +error[UP004]: 137:9: [*] Class `A` inherits from `object` + --> UP004.py:137:9 | 137 | class A(object, object): | ^^^^^^ @@ -434,8 +454,9 @@ error[UP004]: UP004.py:137:9: [*] Class `A` inherits from `object` 139 139 | 140 140 | -error[UP004]: UP004.py:137:17: [*] Class `A` inherits from `object` +error[UP004]: 137:17: [*] Class `A` inherits from `object` + --> UP004.py:137:17 | 137 | class A(object, object): | ^^^^^^ @@ -452,8 +473,9 @@ error[UP004]: UP004.py:137:17: [*] Class `A` inherits from `object` 139 139 | 140 140 | -error[UP004]: UP004.py:142:9: [*] Class `A` inherits from `object` +error[UP004]: 142:9: [*] Class `A` inherits from `object` + --> UP004.py:142:9 | 141 | @decorator() 142 | class A(object): @@ -471,8 +493,9 @@ error[UP004]: UP004.py:142:9: [*] Class `A` inherits from `object` 144 144 | 145 145 | @decorator() # class A(object): -error[UP004]: UP004.py:146:9: [*] Class `A` inherits from `object` +error[UP004]: 146:9: [*] Class `A` inherits from `object` + --> UP004.py:146:9 | 145 | @decorator() # class A(object): 146 | class A(object): @@ -490,8 +513,9 @@ error[UP004]: UP004.py:146:9: [*] Class `A` inherits from `object` 148 148 | 149 149 | -error[UP004]: UP004.py:159:15: [*] Class `Unusual` inherits from `object` +error[UP004]: 159:15: [*] Class `Unusual` inherits from `object` + --> UP004.py:159:15 | 157 | import builtins 158 | diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP005.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP005.py.snap index d13a2c8d27..eb9bf08315 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP005.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP005.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -error[UP005]: UP005.py:6:9: [*] `assertEquals` is deprecated, use `assertEqual` +error[UP005]: 6:9: [*] `assertEquals` is deprecated, use `assertEqual` + --> UP005.py:6:9 | 4 | class Suite(unittest.TestCase): 5 | def test(self) -> None: @@ -22,8 +23,9 @@ error[UP005]: UP005.py:6:9: [*] `assertEquals` is deprecated, use `assertEqual` 8 8 | self.assertEqual(3, 4) 9 9 | self.failUnlessAlmostEqual(1, 1.1) -error[UP005]: UP005.py:7:9: [*] `assertEquals` is deprecated, use `assertEqual` +error[UP005]: 7:9: [*] `assertEquals` is deprecated, use `assertEqual` + --> UP005.py:7:9 | 5 | def test(self) -> None: 6 | self.assertEquals (1, 2) @@ -43,8 +45,9 @@ error[UP005]: UP005.py:7:9: [*] `assertEquals` is deprecated, use `assertEqual` 9 9 | self.failUnlessAlmostEqual(1, 1.1) 10 10 | self.assertNotRegexpMatches("a", "b") -error[UP005]: UP005.py:9:9: [*] `failUnlessAlmostEqual` is deprecated, use `assertAlmostEqual` +error[UP005]: 9:9: [*] `failUnlessAlmostEqual` is deprecated, use `assertAlmostEqual` + --> UP005.py:9:9 | 7 | self.assertEquals(1, 2) 8 | self.assertEqual(3, 4) @@ -61,8 +64,9 @@ error[UP005]: UP005.py:9:9: [*] `failUnlessAlmostEqual` is deprecated, use `asse 9 |+ self.assertAlmostEqual(1, 1.1) 10 10 | self.assertNotRegexpMatches("a", "b") -error[UP005]: UP005.py:10:9: [*] `assertNotRegexpMatches` is deprecated, use `assertNotRegex` +error[UP005]: 10:9: [*] `assertNotRegexpMatches` is deprecated, use `assertNotRegex` + --> UP005.py:10:9 | 8 | self.assertEqual(3, 4) 9 | self.failUnlessAlmostEqual(1, 1.1) diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP006_0.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP006_0.py.snap index eece6e8463..3b86a14eb2 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP006_0.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP006_0.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -error[UP006]: UP006_0.py:4:10: [*] Use `list` instead of `typing.List` for type annotation +error[UP006]: 4:10: [*] Use `list` instead of `typing.List` for type annotation + --> UP006_0.py:4:10 | 4 | def f(x: typing.List[str]) -> None: | ^^^^^^^^^^^ @@ -19,8 +20,9 @@ error[UP006]: UP006_0.py:4:10: [*] Use `list` instead of `typing.List` for type 6 6 | 7 7 | -error[UP006]: UP006_0.py:11:10: [*] Use `list` instead of `List` for type annotation +error[UP006]: 11:10: [*] Use `list` instead of `List` for type annotation + --> UP006_0.py:11:10 | 11 | def f(x: List[str]) -> None: | ^^^^ @@ -37,8 +39,9 @@ error[UP006]: UP006_0.py:11:10: [*] Use `list` instead of `List` for type annota 13 13 | 14 14 | -error[UP006]: UP006_0.py:18:10: [*] Use `list` instead of `t.List` for type annotation +error[UP006]: 18:10: [*] Use `list` instead of `t.List` for type annotation + --> UP006_0.py:18:10 | 18 | def f(x: t.List[str]) -> None: | ^^^^^^ @@ -55,8 +58,9 @@ error[UP006]: UP006_0.py:18:10: [*] Use `list` instead of `t.List` for type anno 20 20 | 21 21 | -error[UP006]: UP006_0.py:25:10: [*] Use `list` instead of `IList` for type annotation +error[UP006]: 25:10: [*] Use `list` instead of `IList` for type annotation + --> UP006_0.py:25:10 | 25 | def f(x: IList[str]) -> None: | ^^^^^ @@ -73,8 +77,9 @@ error[UP006]: UP006_0.py:25:10: [*] Use `list` instead of `IList` for type annot 27 27 | 28 28 | -error[UP006]: UP006_0.py:29:11: [*] Use `list` instead of `List` for type annotation +error[UP006]: 29:11: [*] Use `list` instead of `List` for type annotation + --> UP006_0.py:29:11 | 29 | def f(x: "List[str]") -> None: | ^^^^ @@ -91,8 +96,9 @@ error[UP006]: UP006_0.py:29:11: [*] Use `list` instead of `List` for type annota 31 31 | 32 32 | -error[UP006]: UP006_0.py:33:12: [*] Use `list` instead of `List` for type annotation +error[UP006]: 33:12: [*] Use `list` instead of `List` for type annotation + --> UP006_0.py:33:12 | 33 | def f(x: r"List[str]") -> None: | ^^^^ @@ -109,8 +115,9 @@ error[UP006]: UP006_0.py:33:12: [*] Use `list` instead of `List` for type annota 35 35 | 36 36 | -error[UP006]: UP006_0.py:37:11: [*] Use `list` instead of `List` for type annotation +error[UP006]: 37:11: [*] Use `list` instead of `List` for type annotation + --> UP006_0.py:37:11 | 37 | def f(x: "List[str]") -> None: | ^^^^ @@ -127,8 +134,9 @@ error[UP006]: UP006_0.py:37:11: [*] Use `list` instead of `List` for type annota 39 39 | 40 40 | -error[UP006]: UP006_0.py:41:13: [*] Use `list` instead of `List` for type annotation +error[UP006]: 41:13: [*] Use `list` instead of `List` for type annotation + --> UP006_0.py:41:13 | 41 | def f(x: """List[str]""") -> None: | ^^^^ @@ -145,16 +153,18 @@ error[UP006]: UP006_0.py:41:13: [*] Use `list` instead of `List` for type annota 43 43 | 44 44 | -error[UP006]: UP006_0.py:45:10: Use `list` instead of `List` for type annotation +error[UP006]: 45:10: Use `list` instead of `List` for type annotation + --> UP006_0.py:45:10 | 45 | def f(x: "Li" "st[str]") -> None: | ^^^^^^^^^^^^^^ 46 | ... | = help: Replace with `list` -error[UP006]: UP006_0.py:49:11: [*] Use `list` instead of `List` for type annotation +error[UP006]: 49:11: [*] Use `list` instead of `List` for type annotation + --> UP006_0.py:49:11 | 49 | def f(x: "List['List[str]']") -> None: | ^^^^ @@ -171,8 +181,9 @@ error[UP006]: UP006_0.py:49:11: [*] Use `list` instead of `List` for type annota 51 51 | 52 52 | -error[UP006]: UP006_0.py:49:17: [*] Use `list` instead of `List` for type annotation +error[UP006]: 49:17: [*] Use `list` instead of `List` for type annotation + --> UP006_0.py:49:17 | 49 | def f(x: "List['List[str]']") -> None: | ^^^^ @@ -189,8 +200,9 @@ error[UP006]: UP006_0.py:49:17: [*] Use `list` instead of `List` for type annota 51 51 | 52 52 | -error[UP006]: UP006_0.py:53:11: [*] Use `list` instead of `List` for type annotation +error[UP006]: 53:11: [*] Use `list` instead of `List` for type annotation + --> UP006_0.py:53:11 | 53 | def f(x: "List['Li' 'st[str]']") -> None: | ^^^^ @@ -207,32 +219,36 @@ error[UP006]: UP006_0.py:53:11: [*] Use `list` instead of `List` for type annota 55 55 | 56 56 | -error[UP006]: UP006_0.py:53:16: Use `list` instead of `List` for type annotation +error[UP006]: 53:16: Use `list` instead of `List` for type annotation + --> UP006_0.py:53:16 | 53 | def f(x: "List['Li' 'st[str]']") -> None: | ^^^^^^^^^^^^^^ 54 | ... | = help: Replace with `list` -error[UP006]: UP006_0.py:57:10: Use `list` instead of `List` for type annotation +error[UP006]: 57:10: Use `list` instead of `List` for type annotation + --> UP006_0.py:57:10 | 57 | def f(x: "Li" "st['List[str]']") -> None: | ^^^^^^^^^^^^^^^^^^^^^^ 58 | ... | = help: Replace with `list` -error[UP006]: UP006_0.py:57:10: Use `list` instead of `List` for type annotation +error[UP006]: 57:10: Use `list` instead of `List` for type annotation + --> UP006_0.py:57:10 | 57 | def f(x: "Li" "st['List[str]']") -> None: | ^^^^^^^^^^^^^^^^^^^^^^ 58 | ... | = help: Replace with `list` -error[UP006]: UP006_0.py:61:10: [*] Use `collections.deque` instead of `typing.Deque` for type annotation +error[UP006]: 61:10: [*] Use `collections.deque` instead of `typing.Deque` for type annotation + --> UP006_0.py:61:10 | 61 | def f(x: typing.Deque[str]) -> None: | ^^^^^^^^^^^^ @@ -257,8 +273,9 @@ error[UP006]: UP006_0.py:61:10: [*] Use `collections.deque` instead of `typing.D 63 64 | 64 65 | -error[UP006]: UP006_0.py:65:10: [*] Use `collections.defaultdict` instead of `typing.DefaultDict` for type annotation +error[UP006]: 65:10: [*] Use `collections.defaultdict` instead of `typing.DefaultDict` for type annotation + --> UP006_0.py:65:10 | 65 | def f(x: typing.DefaultDict[str, str]) -> None: | ^^^^^^^^^^^^^^^^^^ diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP006_1.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP006_1.py.snap index 2a2c63cf88..16bd06bc18 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP006_1.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP006_1.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -error[UP006]: UP006_1.py:9:10: [*] Use `collections.defaultdict` instead of `typing.DefaultDict` for type annotation +error[UP006]: 9:10: [*] Use `collections.defaultdict` instead of `typing.DefaultDict` for type annotation + --> UP006_1.py:9:10 | 9 | def f(x: typing.DefaultDict[str, str]) -> None: | ^^^^^^^^^^^^^^^^^^ diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP006_2.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP006_2.py.snap index 303e94e6a9..72096ff523 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP006_2.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP006_2.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -error[UP006]: UP006_2.py:7:10: Use `collections.defaultdict` instead of `typing.DefaultDict` for type annotation +error[UP006]: 7:10: Use `collections.defaultdict` instead of `typing.DefaultDict` for type annotation + --> UP006_2.py:7:10 | 7 | def f(x: typing.DefaultDict[str, str]) -> None: | ^^^^^^^^^^^^^^^^^^ diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP006_3.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP006_3.py.snap index 8cc4c7f779..0e217e2459 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP006_3.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP006_3.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -error[UP006]: UP006_3.py:7:11: [*] Use `collections.defaultdict` instead of `typing.DefaultDict` for type annotation +error[UP006]: 7:11: [*] Use `collections.defaultdict` instead of `typing.DefaultDict` for type annotation + --> UP006_3.py:7:11 | 7 | def f(x: "typing.DefaultDict[str, str]") -> None: | ^^^^^^^^^^^^^^^^^^ diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP007.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP007.py.snap index e2b1d297cb..4b938fe606 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP007.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP007.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -error[UP007]: UP007.py:6:10: [*] Use `X | Y` for type annotations +error[UP007]: 6:10: [*] Use `X | Y` for type annotations + --> UP007.py:6:10 | 6 | def f(x: Optional[str]) -> None: | ^^^^^^^^^^^^^ @@ -19,8 +20,9 @@ error[UP007]: UP007.py:6:10: [*] Use `X | Y` for type annotations 8 8 | 9 9 | -error[UP007]: UP007.py:10:10: [*] Use `X | Y` for type annotations +error[UP007]: 10:10: [*] Use `X | Y` for type annotations + --> UP007.py:10:10 | 10 | def f(x: typing.Optional[str]) -> None: | ^^^^^^^^^^^^^^^^^^^^ @@ -37,8 +39,9 @@ error[UP007]: UP007.py:10:10: [*] Use `X | Y` for type annotations 12 12 | 13 13 | -error[UP007]: UP007.py:14:10: [*] Use `X | Y` for type annotations +error[UP007]: 14:10: [*] Use `X | Y` for type annotations + --> UP007.py:14:10 | 14 | def f(x: Union[str, int, Union[float, bytes]]) -> None: | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -55,8 +58,9 @@ error[UP007]: UP007.py:14:10: [*] Use `X | Y` for type annotations 16 16 | 17 17 | -error[UP007]: UP007.py:14:26: [*] Use `X | Y` for type annotations +error[UP007]: 14:26: [*] Use `X | Y` for type annotations + --> UP007.py:14:26 | 14 | def f(x: Union[str, int, Union[float, bytes]]) -> None: | ^^^^^^^^^^^^^^^^^^^ @@ -73,8 +77,9 @@ error[UP007]: UP007.py:14:26: [*] Use `X | Y` for type annotations 16 16 | 17 17 | -error[UP007]: UP007.py:18:10: [*] Use `X | Y` for type annotations +error[UP007]: 18:10: [*] Use `X | Y` for type annotations + --> UP007.py:18:10 | 18 | def f(x: typing.Union[str, int]) -> None: | ^^^^^^^^^^^^^^^^^^^^^^ @@ -91,8 +96,9 @@ error[UP007]: UP007.py:18:10: [*] Use `X | Y` for type annotations 20 20 | 21 21 | -error[UP007]: UP007.py:22:10: [*] Use `X | Y` for type annotations +error[UP007]: 22:10: [*] Use `X | Y` for type annotations + --> UP007.py:22:10 | 22 | def f(x: typing.Union[(str, int)]) -> None: | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -109,8 +115,9 @@ error[UP007]: UP007.py:22:10: [*] Use `X | Y` for type annotations 24 24 | 25 25 | -error[UP007]: UP007.py:26:10: [*] Use `X | Y` for type annotations +error[UP007]: 26:10: [*] Use `X | Y` for type annotations + --> UP007.py:26:10 | 26 | def f(x: typing.Union[(str, int), float]) -> None: | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -127,8 +134,9 @@ error[UP007]: UP007.py:26:10: [*] Use `X | Y` for type annotations 28 28 | 29 29 | -error[UP007]: UP007.py:30:10: [*] Use `X | Y` for type annotations +error[UP007]: 30:10: [*] Use `X | Y` for type annotations + --> UP007.py:30:10 | 30 | def f(x: typing.Union[(int,)]) -> None: | ^^^^^^^^^^^^^^^^^^^^ @@ -145,8 +153,9 @@ error[UP007]: UP007.py:30:10: [*] Use `X | Y` for type annotations 32 32 | 33 33 | -error[UP007]: UP007.py:34:10: [*] Use `X | Y` for type annotations +error[UP007]: 34:10: [*] Use `X | Y` for type annotations + --> UP007.py:34:10 | 34 | def f(x: typing.Union[()]) -> None: | ^^^^^^^^^^^^^^^^ @@ -163,8 +172,9 @@ error[UP007]: UP007.py:34:10: [*] Use `X | Y` for type annotations 36 36 | 37 37 | -error[UP007]: UP007.py:38:11: [*] Use `X | Y` for type annotations +error[UP007]: 38:11: [*] Use `X | Y` for type annotations + --> UP007.py:38:11 | 38 | def f(x: "Union[str, int, Union[float, bytes]]") -> None: | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -181,8 +191,9 @@ error[UP007]: UP007.py:38:11: [*] Use `X | Y` for type annotations 40 40 | 41 41 | -error[UP007]: UP007.py:38:27: [*] Use `X | Y` for type annotations +error[UP007]: 38:27: [*] Use `X | Y` for type annotations + --> UP007.py:38:27 | 38 | def f(x: "Union[str, int, Union[float, bytes]]") -> None: | ^^^^^^^^^^^^^^^^^^^ @@ -199,8 +210,9 @@ error[UP007]: UP007.py:38:27: [*] Use `X | Y` for type annotations 40 40 | 41 41 | -error[UP007]: UP007.py:42:11: [*] Use `X | Y` for type annotations +error[UP007]: 42:11: [*] Use `X | Y` for type annotations + --> UP007.py:42:11 | 42 | def f(x: "typing.Union[str, int]") -> None: | ^^^^^^^^^^^^^^^^^^^^^^ @@ -217,8 +229,9 @@ error[UP007]: UP007.py:42:11: [*] Use `X | Y` for type annotations 44 44 | 45 45 | -error[UP007]: UP007.py:55:8: [*] Use `X | Y` for type annotations +error[UP007]: 55:8: [*] Use `X | Y` for type annotations + --> UP007.py:55:8 | 54 | def f() -> None: 55 | x: Optional[str] @@ -236,8 +249,9 @@ error[UP007]: UP007.py:55:8: [*] Use `X | Y` for type annotations 57 57 | 58 58 | x = Union[str, int] -error[UP007]: UP007.py:56:9: Use `X | Y` for type annotations +error[UP007]: 56:9: Use `X | Y` for type annotations + --> UP007.py:56:9 | 54 | def f() -> None: 55 | x: Optional[str] @@ -247,8 +261,9 @@ error[UP007]: UP007.py:56:9: Use `X | Y` for type annotations 58 | x = Union[str, int] | = help: Convert to `X | Y` -error[UP007]: UP007.py:58:9: Use `X | Y` for type annotations +error[UP007]: 58:9: Use `X | Y` for type annotations + --> UP007.py:58:9 | 56 | x = Optional[str] 57 | @@ -258,8 +273,9 @@ error[UP007]: UP007.py:58:9: Use `X | Y` for type annotations 60 | x: Union[str, int] | = help: Convert to `X | Y` -error[UP007]: UP007.py:60:8: [*] Use `X | Y` for type annotations +error[UP007]: 60:8: [*] Use `X | Y` for type annotations + --> UP007.py:60:8 | 58 | x = Union[str, int] 59 | x = Union["str", "int"] @@ -278,8 +294,9 @@ error[UP007]: UP007.py:60:8: [*] Use `X | Y` for type annotations 62 62 | 63 63 | -error[UP007]: UP007.py:61:8: [*] Use `X | Y` for type annotations +error[UP007]: 61:8: [*] Use `X | Y` for type annotations + --> UP007.py:61:8 | 59 | x = Union["str", "int"] 60 | x: Union[str, int] @@ -297,80 +314,90 @@ error[UP007]: UP007.py:61:8: [*] Use `X | Y` for type annotations 63 63 | 64 64 | def f(x: Union[int : float]) -> None: -error[UP007]: UP007.py:64:10: Use `X | Y` for type annotations +error[UP007]: 64:10: Use `X | Y` for type annotations + --> UP007.py:64:10 | 64 | def f(x: Union[int : float]) -> None: | ^^^^^^^^^^^^^^^^^^ 65 | ... | = help: Convert to `X | Y` -error[UP007]: UP007.py:68:10: Use `X | Y` for type annotations +error[UP007]: 68:10: Use `X | Y` for type annotations + --> UP007.py:68:10 | 68 | def f(x: Union[str, int : float]) -> None: | ^^^^^^^^^^^^^^^^^^^^^^^ 69 | ... | = help: Convert to `X | Y` -error[UP007]: UP007.py:72:10: Use `X | Y` for type annotations +error[UP007]: 72:10: Use `X | Y` for type annotations + --> UP007.py:72:10 | 72 | def f(x: Union[x := int]) -> None: | ^^^^^^^^^^^^^^^ 73 | ... | = help: Convert to `X | Y` -error[UP007]: UP007.py:76:10: Use `X | Y` for type annotations +error[UP007]: 76:10: Use `X | Y` for type annotations + --> UP007.py:76:10 | 76 | def f(x: Union[str, x := int]) -> None: | ^^^^^^^^^^^^^^^^^^^^ 77 | ... | = help: Convert to `X | Y` -error[UP007]: UP007.py:80:10: Use `X | Y` for type annotations +error[UP007]: 80:10: Use `X | Y` for type annotations + --> UP007.py:80:10 | 80 | def f(x: Union[lambda: int]) -> None: | ^^^^^^^^^^^^^^^^^^ 81 | ... | = help: Convert to `X | Y` -error[UP007]: UP007.py:84:10: Use `X | Y` for type annotations +error[UP007]: 84:10: Use `X | Y` for type annotations + --> UP007.py:84:10 | 84 | def f(x: Union[str, lambda: int]) -> None: | ^^^^^^^^^^^^^^^^^^^^^^^ 85 | ... | = help: Convert to `X | Y` -error[UP007]: UP007.py:88:10: Use `X | Y` for type annotations +error[UP007]: 88:10: Use `X | Y` for type annotations + --> UP007.py:88:10 | 88 | def f(x: Optional[int : float]) -> None: | ^^^^^^^^^^^^^^^^^^^^^ 89 | ... | = help: Convert to `X | Y` -error[UP007]: UP007.py:92:10: Use `X | Y` for type annotations +error[UP007]: 92:10: Use `X | Y` for type annotations + --> UP007.py:92:10 | 92 | def f(x: Optional[str, int : float]) -> None: | ^^^^^^^^^^^^^^^^^^^^^^^^^^ 93 | ... | = help: Convert to `X | Y` -error[UP007]: UP007.py:96:10: Use `X | Y` for type annotations +error[UP007]: 96:10: Use `X | Y` for type annotations + --> UP007.py:96:10 | 96 | def f(x: Optional[int, float]) -> None: | ^^^^^^^^^^^^^^^^^^^^ 97 | ... | = help: Convert to `X | Y` -error[UP007]: UP007.py:102:28: [*] Use `X | Y` for type annotations +error[UP007]: 102:28: [*] Use `X | Y` for type annotations + --> UP007.py:102:28 | 100 | # Regression test for: https://github.com/astral-sh/ruff/issues/7131 101 | class ServiceRefOrValue: @@ -395,8 +422,9 @@ error[UP007]: UP007.py:102:28: [*] Use `X | Y` for type annotations 107 104 | 108 105 | # Regression test for: https://github.com/astral-sh/ruff/issues/7201 -error[UP007]: UP007.py:110:28: [*] Use `X | Y` for type annotations +error[UP007]: 110:28: [*] Use `X | Y` for type annotations + --> UP007.py:110:28 | 108 | # Regression test for: https://github.com/astral-sh/ruff/issues/7201 109 | class ServiceRefOrValue: @@ -414,8 +442,9 @@ error[UP007]: UP007.py:110:28: [*] Use `X | Y` for type annotations 112 112 | 113 113 | # Regression test for: https://github.com/astral-sh/ruff/issues/7452 -error[UP007]: UP007.py:120:10: [*] Use `X | Y` for type annotations +error[UP007]: 120:10: [*] Use `X | Y` for type annotations + --> UP007.py:120:10 | 119 | # Regression test for: https://github.com/astral-sh/ruff/issues/8609 120 | def f(x: Union[int, str, bytes]) -> None: diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP008.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP008.py.snap index da6e68284d..f95607f0ad 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP008.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP008.py.snap @@ -1,16 +1,17 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -UP008.py:17:23: UP008 [*] Use `super()` instead of `super(__class__, self)` +error[UP008]: 17:23: [*] Use `super()` instead of `super(__class__, self)` + + --> UP008.py:17:23 | 16 | def wrong(self): 17 | parent = super(Child, self) # wrong - | ^^^^^^^^^^^^^ UP008 + | ^^^^^^^^^^^^^ 18 | super(Child, self).method # wrong 19 | super( | = help: Remove `__super__` parameters - ℹ Unsafe fix 14 14 | Parent.super(1, 2) # ok 15 15 | @@ -21,17 +22,18 @@ UP008.py:17:23: UP008 [*] Use `super()` instead of `super(__class__, self)` 19 19 | super( 20 20 | Child, -UP008.py:18:14: UP008 [*] Use `super()` instead of `super(__class__, self)` +error[UP008]: 18:14: [*] Use `super()` instead of `super(__class__, self)` + + --> UP008.py:18:14 | 16 | def wrong(self): 17 | parent = super(Child, self) # wrong 18 | super(Child, self).method # wrong - | ^^^^^^^^^^^^^ UP008 + | ^^^^^^^^^^^^^ 19 | super( 20 | Child, | = help: Remove `__super__` parameters - ℹ Unsafe fix 15 15 | 16 16 | def wrong(self): @@ -42,7 +44,9 @@ UP008.py:18:14: UP008 [*] Use `super()` instead of `super(__class__, self)` 20 20 | Child, 21 21 | self, -UP008.py:19:14: UP008 [*] Use `super()` instead of `super(__class__, self)` +error[UP008]: 19:14: [*] Use `super()` instead of `super(__class__, self)` + + --> UP008.py:19:14 | 17 | parent = super(Child, self) # wrong 18 | super(Child, self).method # wrong @@ -51,10 +55,9 @@ UP008.py:19:14: UP008 [*] Use `super()` instead of `super(__class__, self)` 20 | | Child, 21 | | self, 22 | | ).method() # wrong - | |_________^ UP008 + | |_________^ | = help: Remove `__super__` parameters - ℹ Unsafe fix 16 16 | def wrong(self): 17 17 | parent = super(Child, self) # wrong @@ -68,16 +71,17 @@ UP008.py:19:14: UP008 [*] Use `super()` instead of `super(__class__, self)` 24 21 | 25 22 | class BaseClass: -UP008.py:36:14: UP008 [*] Use `super()` instead of `super(__class__, self)` +error[UP008]: 36:14: [*] Use `super()` instead of `super(__class__, self)` + + --> UP008.py:36:14 | 34 | class MyClass(BaseClass): 35 | def normal(self): 36 | super(MyClass, self).f() # can use super() - | ^^^^^^^^^^^^^^^ UP008 + | ^^^^^^^^^^^^^^^ 37 | super().f() | = help: Remove `__super__` parameters - ℹ Unsafe fix 33 33 | 34 34 | class MyClass(BaseClass): @@ -88,15 +92,16 @@ UP008.py:36:14: UP008 [*] Use `super()` instead of `super(__class__, self)` 38 38 | 39 39 | def different_argument(self, other): -UP008.py:50:18: UP008 [*] Use `super()` instead of `super(__class__, self)` +error[UP008]: 50:18: [*] Use `super()` instead of `super(__class__, self)` + + --> UP008.py:50:18 | 49 | def inner_argument(self): 50 | super(MyClass, self).f() # can use super() - | ^^^^^^^^^^^^^^^ UP008 + | ^^^^^^^^^^^^^^^ 51 | super().f() | = help: Remove `__super__` parameters - ℹ Unsafe fix 47 47 | super(MyClass, self).f() # CANNOT use super() 48 48 | @@ -107,16 +112,17 @@ UP008.py:50:18: UP008 [*] Use `super()` instead of `super(__class__, self)` 52 52 | 53 53 | outer_argument() -UP008.py:74:14: UP008 [*] Use `super()` instead of `super(__class__, self)` +error[UP008]: 74:14: [*] Use `super()` instead of `super(__class__, self)` + + --> UP008.py:74:14 | 72 | class DataClass: 73 | def normal(self): 74 | super(DataClass, self).f() # Error - | ^^^^^^^^^^^^^^^^^ UP008 + | ^^^^^^^^^^^^^^^^^ 75 | super().f() # OK | = help: Remove `__super__` parameters - ℹ Unsafe fix 71 71 | @dataclass 72 72 | class DataClass: diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP009_0.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP009_0.py.snap index cddaac75bd..7684076a8d 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP009_0.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP009_0.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -error[UP009]: UP009_0.py:1:1: [*] UTF-8 encoding declaration is unnecessary +error[UP009]: 1:1: [*] UTF-8 encoding declaration is unnecessary + --> UP009_0.py:1:1 | 1 | # coding=utf8 | ^^^^^^^^^^^^^ diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP009_1.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP009_1.py.snap index d8c78e9c1f..4cc025ac95 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP009_1.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP009_1.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -error[UP009]: UP009_1.py:2:1: [*] UTF-8 encoding declaration is unnecessary +error[UP009]: 2:1: [*] UTF-8 encoding declaration is unnecessary + --> UP009_1.py:1:18 | 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 -*- diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP009_6.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP009_6.py.snap index 437187be5b..91da03ae6a 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP009_6.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP009_6.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -error[UP009]: UP009_6.py:1:2: [*] UTF-8 encoding declaration is unnecessary +error[UP009]: 1:2: [*] UTF-8 encoding declaration is unnecessary + --> UP009_6.py:1:2 | 1 | # coding=utf8 | ^^^^^^^^^^^^^ diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP009_7.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP009_7.py.snap index edd0b672d3..9c2517352f 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP009_7.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP009_7.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -error[UP009]: UP009_7.py:1:2: [*] UTF-8 encoding declaration is unnecessary +error[UP009]: 1:2: [*] UTF-8 encoding declaration is unnecessary + --> UP009_7.py:1:5 | 1 | # coding=utf8 | ^^^^^^^^^^^^^ diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP010.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP010.py.snap index 4781cc5c32..513161699f 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP010.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP010.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -error[UP010]: UP010.py:1:1: [*] Unnecessary `__future__` imports `generators`, `nested_scopes` for target Python version +error[UP010]: 1:1: [*] Unnecessary `__future__` imports `generators`, `nested_scopes` for target Python version + --> UP010.py:1:1 | 1 | from __future__ import nested_scopes, generators | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -16,8 +17,9 @@ error[UP010]: UP010.py:1:1: [*] Unnecessary `__future__` imports `generators`, ` 3 2 | from __future__ import absolute_import, division 4 3 | from __future__ import generator_stop -error[UP010]: UP010.py:2:1: [*] Unnecessary `__future__` imports `unicode_literals`, `with_statement` for target Python version +error[UP010]: 2:1: [*] Unnecessary `__future__` imports `unicode_literals`, `with_statement` for target Python version + --> UP010.py:1:49 | 1 | from __future__ import nested_scopes, generators 2 | from __future__ import with_statement, unicode_literals @@ -33,8 +35,9 @@ error[UP010]: UP010.py:2:1: [*] Unnecessary `__future__` imports `unicode_litera 4 3 | from __future__ import generator_stop 5 4 | from __future__ import print_function, generator_stop -error[UP010]: UP010.py:3:1: [*] Unnecessary `__future__` imports `absolute_import`, `division` for target Python version +error[UP010]: 3:1: [*] Unnecessary `__future__` imports `absolute_import`, `division` for target Python version + --> UP010.py:2:56 | 1 | from __future__ import nested_scopes, generators 2 | from __future__ import with_statement, unicode_literals @@ -52,8 +55,9 @@ error[UP010]: UP010.py:3:1: [*] Unnecessary `__future__` imports `absolute_impor 5 4 | from __future__ import print_function, generator_stop 6 5 | from __future__ import invalid_module, generators -error[UP010]: UP010.py:4:1: [*] Unnecessary `__future__` import `generator_stop` for target Python version +error[UP010]: 4:1: [*] Unnecessary `__future__` import `generator_stop` for target Python version + --> UP010.py:3:49 | 2 | from __future__ import with_statement, unicode_literals 3 | from __future__ import absolute_import, division @@ -72,8 +76,9 @@ error[UP010]: UP010.py:4:1: [*] Unnecessary `__future__` import `generator_stop` 6 5 | from __future__ import invalid_module, generators 7 6 | -error[UP010]: UP010.py:5:1: [*] Unnecessary `__future__` imports `generator_stop`, `print_function` for target Python version +error[UP010]: 5:1: [*] Unnecessary `__future__` imports `generator_stop`, `print_function` for target Python version + --> UP010.py:4:38 | 3 | from __future__ import absolute_import, division 4 | from __future__ import generator_stop @@ -91,8 +96,9 @@ error[UP010]: UP010.py:5:1: [*] Unnecessary `__future__` imports `generator_stop 7 6 | 8 7 | if True: -error[UP010]: UP010.py:6:1: [*] Unnecessary `__future__` import `generators` for target Python version +error[UP010]: 6:1: [*] Unnecessary `__future__` import `generators` for target Python version + --> UP010.py:5:54 | 4 | from __future__ import generator_stop 5 | from __future__ import print_function, generator_stop @@ -112,8 +118,9 @@ error[UP010]: UP010.py:6:1: [*] Unnecessary `__future__` import `generators` for 8 8 | if True: 9 9 | from __future__ import generator_stop -error[UP010]: UP010.py:9:5: [*] Unnecessary `__future__` import `generator_stop` for target Python version +error[UP010]: 9:5: [*] Unnecessary `__future__` import `generator_stop` for target Python version + --> UP010.py:9:5 | 8 | if True: 9 | from __future__ import generator_stop @@ -130,8 +137,9 @@ error[UP010]: UP010.py:9:5: [*] Unnecessary `__future__` import `generator_stop` 11 10 | 12 11 | if True: -error[UP010]: UP010.py:10:5: [*] Unnecessary `__future__` import `generators` for target Python version +error[UP010]: 10:5: [*] Unnecessary `__future__` import `generators` for target Python version + --> UP010.py:10:5 | 8 | if True: 9 | from __future__ import generator_stop @@ -150,8 +158,9 @@ error[UP010]: UP010.py:10:5: [*] Unnecessary `__future__` import `generators` fo 12 11 | if True: 13 12 | from __future__ import generator_stop -error[UP010]: UP010.py:13:5: [*] Unnecessary `__future__` import `generator_stop` for target Python version +error[UP010]: 13:5: [*] Unnecessary `__future__` import `generator_stop` for target Python version + --> UP010.py:13:5 | 12 | if True: 13 | from __future__ import generator_stop @@ -166,8 +175,9 @@ error[UP010]: UP010.py:13:5: [*] Unnecessary `__future__` import `generator_stop 13 |- from __future__ import generator_stop 14 13 | from __future__ import invalid_module, generators -error[UP010]: UP010.py:14:5: [*] Unnecessary `__future__` import `generators` for target Python version +error[UP010]: 14:5: [*] Unnecessary `__future__` import `generators` for target Python version + --> UP010.py:14:5 | 12 | if True: 13 | from __future__ import generator_stop diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP011.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP011.py.snap index 8ec56c4e8f..cd568b59eb 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP011.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP011.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -error[UP011]: UP011.py:5:21: [*] Unnecessary parentheses to `functools.lru_cache` +error[UP011]: 5:21: [*] Unnecessary parentheses to `functools.lru_cache` + --> UP011.py:5:21 | 5 | @functools.lru_cache() | ^^ @@ -20,8 +21,9 @@ error[UP011]: UP011.py:5:21: [*] Unnecessary parentheses to `functools.lru_cache 7 7 | pass 8 8 | -error[UP011]: UP011.py:10:11: [*] Unnecessary parentheses to `functools.lru_cache` +error[UP011]: 10:11: [*] Unnecessary parentheses to `functools.lru_cache` + --> UP011.py:10:11 | 10 | @lru_cache() | ^^ @@ -39,8 +41,9 @@ error[UP011]: UP011.py:10:11: [*] Unnecessary parentheses to `functools.lru_cach 12 12 | pass 13 13 | -error[UP011]: UP011.py:16:21: [*] Unnecessary parentheses to `functools.lru_cache` +error[UP011]: 16:21: [*] Unnecessary parentheses to `functools.lru_cache` + --> UP011.py:16:21 | 15 | @other_decorator 16 | @functools.lru_cache() @@ -59,8 +62,9 @@ error[UP011]: UP011.py:16:21: [*] Unnecessary parentheses to `functools.lru_cach 18 18 | pass 19 19 | -error[UP011]: UP011.py:21:21: [*] Unnecessary parentheses to `functools.lru_cache` +error[UP011]: 21:21: [*] Unnecessary parentheses to `functools.lru_cache` + --> UP011.py:21:21 | 21 | @functools.lru_cache() | ^^ diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP012.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP012.py.snap index f19df78488..5b72024333 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP012.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP012.py.snap @@ -1,16 +1,17 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -UP012.py:2:1: UP012 [*] Unnecessary call to `encode` as UTF-8 +error[UP012]: 2:1: [*] Unnecessary call to `encode` as UTF-8 + + --> UP012.py:1:55 | 1 | # ASCII literals should be replaced by a bytes literal 2 | "foo".encode("utf-8") # b"foo" - | ^^^^^^^^^^^^^^^^^^^^^ UP012 + | ^^^^^^^^^^^^^^^^^^^^^ 3 | "foo".encode("u8") # b"foo" 4 | "foo".encode() # b"foo" | = help: Rewrite as bytes literal - ℹ Safe fix 1 1 | # ASCII literals should be replaced by a bytes literal 2 |-"foo".encode("utf-8") # b"foo" @@ -19,17 +20,18 @@ UP012.py:2:1: UP012 [*] Unnecessary call to `encode` as UTF-8 4 4 | "foo".encode() # b"foo" 5 5 | "foo".encode("UTF8") # b"foo" -UP012.py:3:1: UP012 [*] Unnecessary call to `encode` as UTF-8 +error[UP012]: 3:1: [*] Unnecessary call to `encode` as UTF-8 + + --> UP012.py:2:32 | 1 | # ASCII literals should be replaced by a bytes literal 2 | "foo".encode("utf-8") # b"foo" 3 | "foo".encode("u8") # b"foo" - | ^^^^^^^^^^^^^^^^^^ UP012 + | ^^^^^^^^^^^^^^^^^^ 4 | "foo".encode() # b"foo" 5 | "foo".encode("UTF8") # b"foo" | = help: Rewrite as bytes literal - ℹ Safe fix 1 1 | # ASCII literals should be replaced by a bytes literal 2 2 | "foo".encode("utf-8") # b"foo" @@ -39,17 +41,18 @@ UP012.py:3:1: UP012 [*] Unnecessary call to `encode` as UTF-8 5 5 | "foo".encode("UTF8") # b"foo" 6 6 | U"foo".encode("utf-8") # b"foo" -UP012.py:4:1: UP012 [*] Unnecessary call to `encode` as UTF-8 +error[UP012]: 4:1: [*] Unnecessary call to `encode` as UTF-8 + + --> UP012.py:3:29 | 2 | "foo".encode("utf-8") # b"foo" 3 | "foo".encode("u8") # b"foo" 4 | "foo".encode() # b"foo" - | ^^^^^^^^^^^^^^ UP012 + | ^^^^^^^^^^^^^^ 5 | "foo".encode("UTF8") # b"foo" 6 | U"foo".encode("utf-8") # b"foo" | = help: Rewrite as bytes literal - ℹ Safe fix 1 1 | # ASCII literals should be replaced by a bytes literal 2 2 | "foo".encode("utf-8") # b"foo" @@ -60,17 +63,18 @@ UP012.py:4:1: UP012 [*] Unnecessary call to `encode` as UTF-8 6 6 | U"foo".encode("utf-8") # b"foo" 7 7 | "foo".encode(encoding="utf-8") # b"foo" -UP012.py:5:1: UP012 [*] Unnecessary call to `encode` as UTF-8 +error[UP012]: 5:1: [*] Unnecessary call to `encode` as UTF-8 + + --> UP012.py:4:25 | 3 | "foo".encode("u8") # b"foo" 4 | "foo".encode() # b"foo" 5 | "foo".encode("UTF8") # b"foo" - | ^^^^^^^^^^^^^^^^^^^^ UP012 + | ^^^^^^^^^^^^^^^^^^^^ 6 | U"foo".encode("utf-8") # b"foo" 7 | "foo".encode(encoding="utf-8") # b"foo" | = help: Rewrite as bytes literal - ℹ Safe fix 2 2 | "foo".encode("utf-8") # b"foo" 3 3 | "foo".encode("u8") # b"foo" @@ -81,17 +85,18 @@ UP012.py:5:1: UP012 [*] Unnecessary call to `encode` as UTF-8 7 7 | "foo".encode(encoding="utf-8") # b"foo" 8 8 | """ -UP012.py:6:1: UP012 [*] Unnecessary call to `encode` as UTF-8 +error[UP012]: 6:1: [*] Unnecessary call to `encode` as UTF-8 + + --> UP012.py:5:31 | 4 | "foo".encode() # b"foo" 5 | "foo".encode("UTF8") # b"foo" 6 | U"foo".encode("utf-8") # b"foo" - | ^^^^^^^^^^^^^^^^^^^^^^ UP012 + | ^^^^^^^^^^^^^^^^^^^^^^ 7 | "foo".encode(encoding="utf-8") # b"foo" 8 | """ | = help: Rewrite as bytes literal - ℹ Safe fix 3 3 | "foo".encode("u8") # b"foo" 4 4 | "foo".encode() # b"foo" @@ -102,17 +107,18 @@ UP012.py:6:1: UP012 [*] Unnecessary call to `encode` as UTF-8 8 8 | """ 9 9 | Lorem -UP012.py:7:1: UP012 [*] Unnecessary call to `encode` as UTF-8 +error[UP012]: 7:1: [*] Unnecessary call to `encode` as UTF-8 + + --> UP012.py:6:33 | 5 | "foo".encode("UTF8") # b"foo" 6 | U"foo".encode("utf-8") # b"foo" 7 | "foo".encode(encoding="utf-8") # b"foo" - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP012 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 8 | """ 9 | Lorem | = help: Rewrite as bytes literal - ℹ Safe fix 4 4 | "foo".encode() # b"foo" 5 5 | "foo".encode("UTF8") # b"foo" @@ -123,7 +129,9 @@ UP012.py:7:1: UP012 [*] Unnecessary call to `encode` as UTF-8 9 9 | Lorem 10 10 | -UP012.py:8:1: UP012 [*] Unnecessary call to `encode` as UTF-8 +error[UP012]: 8:1: [*] Unnecessary call to `encode` as UTF-8 + + --> UP012.py:7:41 | 6 | U"foo".encode("utf-8") # b"foo" 7 | "foo".encode(encoding="utf-8") # b"foo" @@ -134,12 +142,11 @@ UP012.py:8:1: UP012 [*] Unnecessary call to `encode` as UTF-8 12 | | """.encode( 13 | | "utf-8" 14 | | ) - | |_^ UP012 + | |_^ 15 | ( 16 | "Lorem " | = help: Rewrite as bytes literal - ℹ Safe fix 5 5 | "foo".encode("UTF8") # b"foo" 6 6 | U"foo".encode("utf-8") # b"foo" @@ -157,19 +164,20 @@ UP012.py:8:1: UP012 [*] Unnecessary call to `encode` as UTF-8 16 14 | "Lorem " 17 15 | "Ipsum".encode() -UP012.py:16:5: UP012 [*] Unnecessary call to `encode` as UTF-8 +error[UP012]: 16:5: [*] Unnecessary call to `encode` as UTF-8 + + --> UP012.py:16:5 | 14 | ) 15 | ( 16 | "Lorem " | _____^ 17 | | "Ipsum".encode() - | |____________________^ UP012 + | |____________________^ 18 | ) 19 | ( | = help: Rewrite as bytes literal - ℹ Safe fix 13 13 | "utf-8" 14 14 | ) @@ -182,19 +190,20 @@ UP012.py:16:5: UP012 [*] Unnecessary call to `encode` as UTF-8 19 19 | ( 20 20 | "Lorem " # Comment -UP012.py:20:5: UP012 [*] Unnecessary call to `encode` as UTF-8 +error[UP012]: 20:5: [*] Unnecessary call to `encode` as UTF-8 + + --> UP012.py:20:5 | 18 | ) 19 | ( 20 | "Lorem " # Comment | _____^ 21 | | "Ipsum".encode() # Comment - | |____________________^ UP012 + | |____________________^ 22 | ) 23 | ( | = help: Rewrite as bytes literal - ℹ Safe fix 17 17 | "Ipsum".encode() 18 18 | ) @@ -207,16 +216,17 @@ UP012.py:20:5: UP012 [*] Unnecessary call to `encode` as UTF-8 23 23 | ( 24 24 | "Lorem " "Ipsum".encode() -UP012.py:24:5: UP012 [*] Unnecessary call to `encode` as UTF-8 +error[UP012]: 24:5: [*] Unnecessary call to `encode` as UTF-8 + + --> UP012.py:24:5 | 22 | ) 23 | ( 24 | "Lorem " "Ipsum".encode() - | ^^^^^^^^^^^^^^^^^^^^^^^^^ UP012 + | ^^^^^^^^^^^^^^^^^^^^^^^^^ 25 | ) | = help: Rewrite as bytes literal - ℹ Safe fix 21 21 | "Ipsum".encode() # Comment 22 22 | ) @@ -227,16 +237,17 @@ UP012.py:24:5: UP012 [*] Unnecessary call to `encode` as UTF-8 26 26 | 27 27 | # `encode` on variables should not be processed. -UP012.py:32:1: UP012 [*] Unnecessary UTF-8 `encoding` argument to `encode` +error[UP012]: 32:1: [*] Unnecessary UTF-8 `encoding` argument to `encode` + + --> UP012.py:31:12 | 31 | bar = "bar" 32 | f"foo{bar}".encode("utf-8") - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP012 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ 33 | encoding = "latin" 34 | "foo".encode(encoding) | = help: Remove unnecessary `encoding` argument - ℹ Safe fix 29 29 | string.encode("utf-8") 30 30 | @@ -247,19 +258,20 @@ UP012.py:32:1: UP012 [*] Unnecessary UTF-8 `encoding` argument to `encode` 34 34 | "foo".encode(encoding) 35 35 | f"foo{bar}".encode(encoding) -UP012.py:36:1: UP012 [*] Unnecessary UTF-8 `encoding` argument to `encode` +error[UP012]: 36:1: [*] Unnecessary UTF-8 `encoding` argument to `encode` + + --> UP012.py:35:29 | 34 | "foo".encode(encoding) 35 | f"foo{bar}".encode(encoding) 36 | / f"{a=} {b=}".encode( 37 | | "utf-8", 38 | | ) - | |_^ UP012 + | |_^ 39 | 40 | # `encode` with custom args and kwargs should not be processed. | = help: Remove unnecessary `encoding` argument - ℹ Safe fix 33 33 | encoding = "latin" 34 34 | "foo".encode(encoding) @@ -272,16 +284,17 @@ UP012.py:36:1: UP012 [*] Unnecessary UTF-8 `encoding` argument to `encode` 40 38 | # `encode` with custom args and kwargs should not be processed. 41 39 | "foo".encode("utf-8", errors="replace") -UP012.py:53:1: UP012 [*] Unnecessary UTF-8 `encoding` argument to `encode` +error[UP012]: 53:1: [*] Unnecessary UTF-8 `encoding` argument to `encode` + + --> UP012.py:52:64 | 52 | # Unicode literals should only be stripped of default encoding. 53 | "unicode text©".encode("utf-8") # "unicode text©".encode() - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP012 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 54 | "unicode text©".encode() 55 | "unicode text©".encode(encoding="UTF8") # "unicode text©".encode() | = help: Remove unnecessary `encoding` argument - ℹ Safe fix 50 50 | "unicode text©".encode(encoding="utf-8", errors="replace") 51 51 | @@ -292,17 +305,18 @@ UP012.py:53:1: UP012 [*] Unnecessary UTF-8 `encoding` argument to `encode` 55 55 | "unicode text©".encode(encoding="UTF8") # "unicode text©".encode() 56 56 | -UP012.py:55:1: UP012 [*] Unnecessary UTF-8 `encoding` argument to `encode` +error[UP012]: 55:1: [*] Unnecessary UTF-8 `encoding` argument to `encode` + + --> UP012.py:54:25 | 53 | "unicode text©".encode("utf-8") # "unicode text©".encode() 54 | "unicode text©".encode() 55 | "unicode text©".encode(encoding="UTF8") # "unicode text©".encode() - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP012 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 56 | 57 | r"foo\o".encode("utf-8") # br"foo\o" | = help: Remove unnecessary `encoding` argument - ℹ Safe fix 52 52 | # Unicode literals should only be stripped of default encoding. 53 53 | "unicode text©".encode("utf-8") # "unicode text©".encode() @@ -313,17 +327,18 @@ UP012.py:55:1: UP012 [*] Unnecessary UTF-8 `encoding` argument to `encode` 57 57 | r"foo\o".encode("utf-8") # br"foo\o" 58 58 | u"foo".encode("utf-8") # b"foo" -UP012.py:57:1: UP012 [*] Unnecessary call to `encode` as UTF-8 +error[UP012]: 57:1: [*] Unnecessary call to `encode` as UTF-8 + + --> UP012.py:56:1 | 55 | "unicode text©".encode(encoding="UTF8") # "unicode text©".encode() 56 | 57 | r"foo\o".encode("utf-8") # br"foo\o" - | ^^^^^^^^^^^^^^^^^^^^^^^^ UP012 + | ^^^^^^^^^^^^^^^^^^^^^^^^ 58 | u"foo".encode("utf-8") # b"foo" 59 | R"foo\o".encode("utf-8") # br"foo\o" | = help: Rewrite as bytes literal - ℹ Safe fix 54 54 | "unicode text©".encode() 55 55 | "unicode text©".encode(encoding="UTF8") # "unicode text©".encode() @@ -334,16 +349,17 @@ UP012.py:57:1: UP012 [*] Unnecessary call to `encode` as UTF-8 59 59 | R"foo\o".encode("utf-8") # br"foo\o" 60 60 | U"foo".encode("utf-8") # b"foo" -UP012.py:58:1: UP012 [*] Unnecessary call to `encode` as UTF-8 +error[UP012]: 58:1: [*] Unnecessary call to `encode` as UTF-8 + + --> UP012.py:57:38 | 57 | r"foo\o".encode("utf-8") # br"foo\o" 58 | u"foo".encode("utf-8") # b"foo" - | ^^^^^^^^^^^^^^^^^^^^^^ UP012 + | ^^^^^^^^^^^^^^^^^^^^^^ 59 | R"foo\o".encode("utf-8") # br"foo\o" 60 | U"foo".encode("utf-8") # b"foo" | = help: Rewrite as bytes literal - ℹ Safe fix 55 55 | "unicode text©".encode(encoding="UTF8") # "unicode text©".encode() 56 56 | @@ -354,17 +370,18 @@ UP012.py:58:1: UP012 [*] Unnecessary call to `encode` as UTF-8 60 60 | U"foo".encode("utf-8") # b"foo" 61 61 | print("foo".encode()) # print(b"foo") -UP012.py:59:1: UP012 [*] Unnecessary call to `encode` as UTF-8 +error[UP012]: 59:1: [*] Unnecessary call to `encode` as UTF-8 + + --> UP012.py:58:33 | 57 | r"foo\o".encode("utf-8") # br"foo\o" 58 | u"foo".encode("utf-8") # b"foo" 59 | R"foo\o".encode("utf-8") # br"foo\o" - | ^^^^^^^^^^^^^^^^^^^^^^^^ UP012 + | ^^^^^^^^^^^^^^^^^^^^^^^^ 60 | U"foo".encode("utf-8") # b"foo" 61 | print("foo".encode()) # print(b"foo") | = help: Rewrite as bytes literal - ℹ Safe fix 56 56 | 57 57 | r"foo\o".encode("utf-8") # br"foo\o" @@ -375,16 +392,17 @@ UP012.py:59:1: UP012 [*] Unnecessary call to `encode` as UTF-8 61 61 | print("foo".encode()) # print(b"foo") 62 62 | -UP012.py:60:1: UP012 [*] Unnecessary call to `encode` as UTF-8 +error[UP012]: 60:1: [*] Unnecessary call to `encode` as UTF-8 + + --> UP012.py:59:38 | 58 | u"foo".encode("utf-8") # b"foo" 59 | R"foo\o".encode("utf-8") # br"foo\o" 60 | U"foo".encode("utf-8") # b"foo" - | ^^^^^^^^^^^^^^^^^^^^^^ UP012 + | ^^^^^^^^^^^^^^^^^^^^^^ 61 | print("foo".encode()) # print(b"foo") | = help: Rewrite as bytes literal - ℹ Safe fix 57 57 | r"foo\o".encode("utf-8") # br"foo\o" 58 58 | u"foo".encode("utf-8") # b"foo" @@ -395,17 +413,18 @@ UP012.py:60:1: UP012 [*] Unnecessary call to `encode` as UTF-8 62 62 | 63 63 | # `encode` on parenthesized strings. -UP012.py:61:7: UP012 [*] Unnecessary call to `encode` as UTF-8 +error[UP012]: 61:7: [*] Unnecessary call to `encode` as UTF-8 + + --> UP012.py:61:7 | 59 | R"foo\o".encode("utf-8") # br"foo\o" 60 | U"foo".encode("utf-8") # b"foo" 61 | print("foo".encode()) # print(b"foo") - | ^^^^^^^^^^^^^^ UP012 + | ^^^^^^^^^^^^^^ 62 | 63 | # `encode` on parenthesized strings. | = help: Rewrite as bytes literal - ℹ Safe fix 58 58 | u"foo".encode("utf-8") # b"foo" 59 59 | R"foo\o".encode("utf-8") # br"foo\o" @@ -416,19 +435,20 @@ UP012.py:61:7: UP012 [*] Unnecessary call to `encode` as UTF-8 63 63 | # `encode` on parenthesized strings. 64 64 | ( -UP012.py:64:1: UP012 [*] Unnecessary call to `encode` as UTF-8 +error[UP012]: 64:1: [*] Unnecessary call to `encode` as UTF-8 + + --> UP012.py:63:37 | 63 | # `encode` on parenthesized strings. 64 | / ( 65 | | "abc" 66 | | "def" 67 | | ).encode() - | |__________^ UP012 + | |__________^ 68 | 69 | (( | = help: Rewrite as bytes literal - ℹ Safe fix 62 62 | 63 63 | # `encode` on parenthesized strings. @@ -443,7 +463,9 @@ UP012.py:64:1: UP012 [*] Unnecessary call to `encode` as UTF-8 69 69 | (( 70 70 | "abc" -UP012.py:69:1: UP012 [*] Unnecessary call to `encode` as UTF-8 +error[UP012]: 69:1: [*] Unnecessary call to `encode` as UTF-8 + + --> UP012.py:68:1 | 67 | ).encode() 68 | @@ -451,12 +473,11 @@ UP012.py:69:1: UP012 [*] Unnecessary call to `encode` as UTF-8 70 | | "abc" 71 | | "def" 72 | | )).encode() - | |___________^ UP012 + | |___________^ 73 | 74 | (f"foo{bar}").encode("utf-8") | = help: Rewrite as bytes literal - ℹ Safe fix 67 67 | ).encode() 68 68 | @@ -471,17 +492,18 @@ UP012.py:69:1: UP012 [*] Unnecessary call to `encode` as UTF-8 74 74 | (f"foo{bar}").encode("utf-8") 75 75 | (f"foo{bar}").encode(encoding="utf-8") -UP012.py:74:1: UP012 [*] Unnecessary UTF-8 `encoding` argument to `encode` +error[UP012]: 74:1: [*] Unnecessary UTF-8 `encoding` argument to `encode` + + --> UP012.py:73:1 | 72 | )).encode() 73 | 74 | (f"foo{bar}").encode("utf-8") - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP012 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 75 | (f"foo{bar}").encode(encoding="utf-8") 76 | ("unicode text©").encode("utf-8") | = help: Remove unnecessary `encoding` argument - ℹ Safe fix 71 71 | "def" 72 72 | )).encode() @@ -492,16 +514,17 @@ UP012.py:74:1: UP012 [*] Unnecessary UTF-8 `encoding` argument to `encode` 76 76 | ("unicode text©").encode("utf-8") 77 77 | ("unicode text©").encode(encoding="utf-8") -UP012.py:75:1: UP012 [*] Unnecessary UTF-8 `encoding` argument to `encode` +error[UP012]: 75:1: [*] Unnecessary UTF-8 `encoding` argument to `encode` + + --> UP012.py:74:30 | 74 | (f"foo{bar}").encode("utf-8") 75 | (f"foo{bar}").encode(encoding="utf-8") - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP012 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 76 | ("unicode text©").encode("utf-8") 77 | ("unicode text©").encode(encoding="utf-8") | = help: Remove unnecessary `encoding` argument - ℹ Safe fix 72 72 | )).encode() 73 73 | @@ -512,16 +535,17 @@ UP012.py:75:1: UP012 [*] Unnecessary UTF-8 `encoding` argument to `encode` 77 77 | ("unicode text©").encode(encoding="utf-8") 78 78 | -UP012.py:76:1: UP012 [*] Unnecessary UTF-8 `encoding` argument to `encode` +error[UP012]: 76:1: [*] Unnecessary UTF-8 `encoding` argument to `encode` + + --> UP012.py:75:39 | 74 | (f"foo{bar}").encode("utf-8") 75 | (f"foo{bar}").encode(encoding="utf-8") 76 | ("unicode text©").encode("utf-8") - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP012 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 77 | ("unicode text©").encode(encoding="utf-8") | = help: Remove unnecessary `encoding` argument - ℹ Safe fix 73 73 | 74 74 | (f"foo{bar}").encode("utf-8") @@ -532,15 +556,16 @@ UP012.py:76:1: UP012 [*] Unnecessary UTF-8 `encoding` argument to `encode` 78 78 | 79 79 | -UP012.py:77:1: UP012 [*] Unnecessary UTF-8 `encoding` argument to `encode` +error[UP012]: 77:1: [*] Unnecessary UTF-8 `encoding` argument to `encode` + + --> UP012.py:76:34 | 75 | (f"foo{bar}").encode(encoding="utf-8") 76 | ("unicode text©").encode("utf-8") 77 | ("unicode text©").encode(encoding="utf-8") - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP012 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: Remove unnecessary `encoding` argument - ℹ Safe fix 74 74 | (f"foo{bar}").encode("utf-8") 75 75 | (f"foo{bar}").encode(encoding="utf-8") @@ -551,17 +576,18 @@ UP012.py:77:1: UP012 [*] Unnecessary UTF-8 `encoding` argument to `encode` 79 79 | 80 80 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1722459882 -UP012.py:82:17: UP012 [*] Unnecessary call to `encode` as UTF-8 +error[UP012]: 82:17: [*] Unnecessary call to `encode` as UTF-8 + + --> UP012.py:82:20 | 80 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1722459882 81 | def _match_ignore(line): 82 | input=stdin and'\n'.encode()or None - | ^^^^^^^^^^^^^ UP012 + | ^^^^^^^^^^^^^ 83 | 84 | # Not a valid type annotation but this test shouldn't result in a panic. | = help: Rewrite as bytes literal - ℹ Safe fix 79 79 | 80 80 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1722459882 @@ -572,15 +598,16 @@ UP012.py:82:17: UP012 [*] Unnecessary call to `encode` as UTF-8 84 84 | # Not a valid type annotation but this test shouldn't result in a panic. 85 85 | # Refer: https://github.com/astral-sh/ruff/issues/11736 -UP012.py:86:5: UP012 [*] Unnecessary call to `encode` as UTF-8 +error[UP012]: 86:5: [*] Unnecessary call to `encode` as UTF-8 + + --> UP012.py:86:5 | 84 | # Not a valid type annotation but this test shouldn't result in a panic. 85 | # Refer: https://github.com/astral-sh/ruff/issues/11736 86 | x: '"foo".encode("utf-8")' - | ^^^^^^^^^^^^^^^^^^^^^ UP012 + | ^^^^^^^^^^^^^^^^^^^^^ | = help: Rewrite as bytes literal - ℹ Safe fix 83 83 | 84 84 | # Not a valid type annotation but this test shouldn't result in a panic. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP013.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP013.py.snap index 265b01eb2d..216943dbe5 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP013.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP013.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -error[UP013]: UP013.py:5:1: [*] Convert `MyType` from `TypedDict` functional to class syntax +error[UP013]: 5:1: [*] Convert `MyType` from `TypedDict` functional to class syntax + --> UP013.py:4:15 | 4 | # dict literal 5 | MyType = TypedDict("MyType", {"a": int, "b": str}) @@ -23,8 +24,9 @@ error[UP013]: UP013.py:5:1: [*] Convert `MyType` from `TypedDict` functional to 7 9 | # dict call 8 10 | MyType = TypedDict("MyType", dict(a=int, b=str)) -error[UP013]: UP013.py:8:1: [*] Convert `MyType` from `TypedDict` functional to class syntax +error[UP013]: 8:1: [*] Convert `MyType` from `TypedDict` functional to class syntax + --> UP013.py:7:12 | 7 | # dict call 8 | MyType = TypedDict("MyType", dict(a=int, b=str)) @@ -45,8 +47,9 @@ error[UP013]: UP013.py:8:1: [*] Convert `MyType` from `TypedDict` functional to 10 12 | # kwargs 11 13 | MyType = TypedDict("MyType", a=int, b=str) -error[UP013]: UP013.py:11:1: [*] Convert `MyType` from `TypedDict` functional to class syntax +error[UP013]: 11:1: [*] Convert `MyType` from `TypedDict` functional to class syntax + --> UP013.py:10:9 | 10 | # kwargs 11 | MyType = TypedDict("MyType", a=int, b=str) @@ -67,8 +70,9 @@ error[UP013]: UP013.py:11:1: [*] Convert `MyType` from `TypedDict` functional to 13 15 | # Empty TypedDict 14 16 | MyType = TypedDict("MyType") -error[UP013]: UP013.py:14:1: [*] Convert `MyType` from `TypedDict` functional to class syntax +error[UP013]: 14:1: [*] Convert `MyType` from `TypedDict` functional to class syntax + --> UP013.py:13:18 | 13 | # Empty TypedDict 14 | MyType = TypedDict("MyType") @@ -88,8 +92,9 @@ error[UP013]: UP013.py:14:1: [*] Convert `MyType` from `TypedDict` functional to 16 17 | # Literal values 17 18 | MyType = TypedDict("MyType", {"a": "hello"}) -error[UP013]: UP013.py:17:1: [*] Convert `MyType` from `TypedDict` functional to class syntax +error[UP013]: 17:1: [*] Convert `MyType` from `TypedDict` functional to class syntax + --> UP013.py:16:17 | 16 | # Literal values 17 | MyType = TypedDict("MyType", {"a": "hello"}) @@ -108,8 +113,9 @@ error[UP013]: UP013.py:17:1: [*] Convert `MyType` from `TypedDict` functional to 19 20 | 20 21 | # NotRequired -error[UP013]: UP013.py:18:1: [*] Convert `MyType` from `TypedDict` functional to class syntax +error[UP013]: 18:1: [*] Convert `MyType` from `TypedDict` functional to class syntax + --> UP013.py:17:45 | 16 | # Literal values 17 | MyType = TypedDict("MyType", {"a": "hello"}) @@ -130,8 +136,9 @@ error[UP013]: UP013.py:18:1: [*] Convert `MyType` from `TypedDict` functional to 20 21 | # NotRequired 21 22 | MyType = TypedDict("MyType", {"a": NotRequired[dict]}) -error[UP013]: UP013.py:21:1: [*] Convert `MyType` from `TypedDict` functional to class syntax +error[UP013]: 21:1: [*] Convert `MyType` from `TypedDict` functional to class syntax + --> UP013.py:20:14 | 20 | # NotRequired 21 | MyType = TypedDict("MyType", {"a": NotRequired[dict]}) @@ -151,8 +158,9 @@ error[UP013]: UP013.py:21:1: [*] Convert `MyType` from `TypedDict` functional to 23 24 | # total 24 25 | MyType = TypedDict("MyType", {"x": int, "y": int}, total=False) -error[UP013]: UP013.py:24:1: [*] Convert `MyType` from `TypedDict` functional to class syntax +error[UP013]: 24:1: [*] Convert `MyType` from `TypedDict` functional to class syntax + --> UP013.py:23:8 | 23 | # total 24 | MyType = TypedDict("MyType", {"x": int, "y": int}, total=False) @@ -173,8 +181,9 @@ error[UP013]: UP013.py:24:1: [*] Convert `MyType` from `TypedDict` functional to 26 28 | # using Literal type 27 29 | MyType = TypedDict("MyType", {"key": Literal["value"]}) -error[UP013]: UP013.py:27:1: [*] Convert `MyType` from `TypedDict` functional to class syntax +error[UP013]: 27:1: [*] Convert `MyType` from `TypedDict` functional to class syntax + --> UP013.py:26:21 | 26 | # using Literal type 27 | MyType = TypedDict("MyType", {"key": Literal["value"]}) @@ -194,8 +203,9 @@ error[UP013]: UP013.py:27:1: [*] Convert `MyType` from `TypedDict` functional to 29 30 | # using namespace TypedDict 30 31 | MyType = typing.TypedDict("MyType", {"key": int}) -error[UP013]: UP013.py:30:1: [*] Convert `MyType` from `TypedDict` functional to class syntax +error[UP013]: 30:1: [*] Convert `MyType` from `TypedDict` functional to class syntax + --> UP013.py:29:28 | 29 | # using namespace TypedDict 30 | MyType = typing.TypedDict("MyType", {"key": int}) @@ -215,8 +225,9 @@ error[UP013]: UP013.py:30:1: [*] Convert `MyType` from `TypedDict` functional to 32 33 | # invalid identifiers (OK) 33 34 | MyType = TypedDict("MyType", {"in": int, "x-y": int}) -error[UP013]: UP013.py:40:1: [*] Convert `MyType` from `TypedDict` functional to class syntax +error[UP013]: 40:1: [*] Convert `MyType` from `TypedDict` functional to class syntax + --> UP013.py:39:21 | 39 | # Empty dict literal 40 | MyType = TypedDict("MyType", {}) @@ -236,8 +247,9 @@ error[UP013]: UP013.py:40:1: [*] Convert `MyType` from `TypedDict` functional to 42 43 | # Empty dict call 43 44 | MyType = TypedDict("MyType", dict()) -error[UP013]: UP013.py:43:1: [*] Convert `MyType` from `TypedDict` functional to class syntax +error[UP013]: 43:1: [*] Convert `MyType` from `TypedDict` functional to class syntax + --> UP013.py:42:18 | 42 | # Empty dict call 43 | MyType = TypedDict("MyType", dict()) diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP014.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP014.py.snap index 52d25451da..4ca003c3ce 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP014.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP014.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -error[UP014]: UP014.py:5:1: [*] Convert `MyType` from `NamedTuple` functional to class syntax +error[UP014]: 5:1: [*] Convert `MyType` from `NamedTuple` functional to class syntax + --> UP014.py:4:27 | 4 | # with complex annotations 5 | MyType = NamedTuple("MyType", [("a", int), ("b", tuple[str, ...])]) @@ -23,8 +24,9 @@ error[UP014]: UP014.py:5:1: [*] Convert `MyType` from `NamedTuple` functional to 7 9 | # with namespace 8 10 | MyType = typing.NamedTuple("MyType", [("a", int), ("b", str)]) -error[UP014]: UP014.py:8:1: [*] Convert `MyType` from `NamedTuple` functional to class syntax +error[UP014]: 8:1: [*] Convert `MyType` from `NamedTuple` functional to class syntax + --> UP014.py:7:17 | 7 | # with namespace 8 | MyType = typing.NamedTuple("MyType", [("a", int), ("b", str)]) @@ -45,8 +47,9 @@ error[UP014]: UP014.py:8:1: [*] Convert `MyType` from `NamedTuple` functional to 10 12 | # invalid identifiers (OK) 11 13 | MyType = NamedTuple("MyType", [("x-y", int), ("b", tuple[str, ...])]) -error[UP014]: UP014.py:14:1: [*] Convert `MyType` from `NamedTuple` functional to class syntax +error[UP014]: 14:1: [*] Convert `MyType` from `NamedTuple` functional to class syntax + --> UP014.py:13:12 | 13 | # no fields 14 | MyType = typing.NamedTuple("MyType") @@ -66,8 +69,9 @@ error[UP014]: UP014.py:14:1: [*] Convert `MyType` from `NamedTuple` functional t 16 17 | # empty fields 17 18 | MyType = typing.NamedTuple("MyType", []) -error[UP014]: UP014.py:17:1: [*] Convert `MyType` from `NamedTuple` functional to class syntax +error[UP014]: 17:1: [*] Convert `MyType` from `NamedTuple` functional to class syntax + --> UP014.py:16:15 | 16 | # empty fields 17 | MyType = typing.NamedTuple("MyType", []) @@ -87,8 +91,9 @@ error[UP014]: UP014.py:17:1: [*] Convert `MyType` from `NamedTuple` functional t 19 20 | # keywords 20 21 | MyType = typing.NamedTuple("MyType", a=int, b=tuple[str, ...]) -error[UP014]: UP014.py:20:1: [*] Convert `MyType` from `NamedTuple` functional to class syntax +error[UP014]: 20:1: [*] Convert `MyType` from `NamedTuple` functional to class syntax + --> UP014.py:19:11 | 19 | # keywords 20 | MyType = typing.NamedTuple("MyType", a=int, b=tuple[str, ...]) diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP015.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP015.py.snap index 0fb7fc2099..fac3b68bd5 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP015.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP015.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -error[UP015]: UP015.py:1:1: [*] Unnecessary open mode parameters +error[UP015]: 1:1: [*] Unnecessary open mode parameters + --> UP015.py:1:1 | 1 | open("foo", "U") | ^^^^^^^^^^^^^^^^ @@ -17,8 +18,9 @@ error[UP015]: UP015.py:1:1: [*] Unnecessary open mode parameters 3 3 | open("foo", "Ub") 4 4 | open("foo", "rUb") -error[UP015]: UP015.py:2:1: [*] Unnecessary open mode parameters +error[UP015]: 2:1: [*] Unnecessary open mode parameters + --> UP015.py:1:17 | 1 | open("foo", "U") 2 | open("foo", "Ur") @@ -35,8 +37,9 @@ error[UP015]: UP015.py:2:1: [*] Unnecessary open mode parameters 4 4 | open("foo", "rUb") 5 5 | open("foo", "r") -error[UP015]: UP015.py:3:1: [*] Unnecessary open mode parameters, use ""rb"" +error[UP015]: 3:1: [*] Unnecessary open mode parameters, use ""rb"" + --> UP015.py:2:18 | 1 | open("foo", "U") 2 | open("foo", "Ur") @@ -55,8 +58,9 @@ error[UP015]: UP015.py:3:1: [*] Unnecessary open mode parameters, use ""rb"" 5 5 | open("foo", "r") 6 6 | open("foo", "rt") -error[UP015]: UP015.py:4:1: [*] Unnecessary open mode parameters, use ""rb"" +error[UP015]: 4:1: [*] Unnecessary open mode parameters, use ""rb"" + --> UP015.py:3:18 | 2 | open("foo", "Ur") 3 | open("foo", "Ub") @@ -76,8 +80,9 @@ error[UP015]: UP015.py:4:1: [*] Unnecessary open mode parameters, use ""rb"" 6 6 | open("foo", "rt") 7 7 | open("f", "r", encoding="UTF-8") -error[UP015]: UP015.py:5:1: [*] Unnecessary open mode parameters +error[UP015]: 5:1: [*] Unnecessary open mode parameters + --> UP015.py:4:19 | 3 | open("foo", "Ub") 4 | open("foo", "rUb") @@ -97,8 +102,9 @@ error[UP015]: UP015.py:5:1: [*] Unnecessary open mode parameters 7 7 | open("f", "r", encoding="UTF-8") 8 8 | open("f", "wt") -error[UP015]: UP015.py:6:1: [*] Unnecessary open mode parameters +error[UP015]: 6:1: [*] Unnecessary open mode parameters + --> UP015.py:5:17 | 4 | open("foo", "rUb") 5 | open("foo", "r") @@ -118,8 +124,9 @@ error[UP015]: UP015.py:6:1: [*] Unnecessary open mode parameters 8 8 | open("f", "wt") 9 9 | -error[UP015]: UP015.py:7:1: [*] Unnecessary open mode parameters +error[UP015]: 7:1: [*] Unnecessary open mode parameters + --> UP015.py:6:18 | 5 | open("foo", "r") 6 | open("foo", "rt") @@ -138,8 +145,9 @@ error[UP015]: UP015.py:7:1: [*] Unnecessary open mode parameters 9 9 | 10 10 | with open("foo", "U") as f: -error[UP015]: UP015.py:8:1: [*] Unnecessary open mode parameters, use ""w"" +error[UP015]: 8:1: [*] Unnecessary open mode parameters, use ""w"" + --> UP015.py:7:33 | 6 | open("foo", "rt") 7 | open("f", "r", encoding="UTF-8") @@ -159,8 +167,9 @@ error[UP015]: UP015.py:8:1: [*] Unnecessary open mode parameters, use ""w"" 10 10 | with open("foo", "U") as f: 11 11 | pass -error[UP015]: UP015.py:10:6: [*] Unnecessary open mode parameters +error[UP015]: 10:6: [*] Unnecessary open mode parameters + --> UP015.py:10:6 | 8 | open("f", "wt") 9 | @@ -180,8 +189,9 @@ error[UP015]: UP015.py:10:6: [*] Unnecessary open mode parameters 12 12 | with open("foo", "Ur") as f: 13 13 | pass -error[UP015]: UP015.py:12:6: [*] Unnecessary open mode parameters +error[UP015]: 12:6: [*] Unnecessary open mode parameters + --> UP015.py:12:6 | 10 | with open("foo", "U") as f: 11 | pass @@ -201,8 +211,9 @@ error[UP015]: UP015.py:12:6: [*] Unnecessary open mode parameters 14 14 | with open("foo", "Ub") as f: 15 15 | pass -error[UP015]: UP015.py:14:6: [*] Unnecessary open mode parameters, use ""rb"" +error[UP015]: 14:6: [*] Unnecessary open mode parameters, use ""rb"" + --> UP015.py:14:6 | 12 | with open("foo", "Ur") as f: 13 | pass @@ -222,8 +233,9 @@ error[UP015]: UP015.py:14:6: [*] Unnecessary open mode parameters, use ""rb"" 16 16 | with open("foo", "rUb") as f: 17 17 | pass -error[UP015]: UP015.py:16:6: [*] Unnecessary open mode parameters, use ""rb"" +error[UP015]: 16:6: [*] Unnecessary open mode parameters, use ""rb"" + --> UP015.py:16:6 | 14 | with open("foo", "Ub") as f: 15 | pass @@ -243,8 +255,9 @@ error[UP015]: UP015.py:16:6: [*] Unnecessary open mode parameters, use ""rb"" 18 18 | with open("foo", "r") as f: 19 19 | pass -error[UP015]: UP015.py:18:6: [*] Unnecessary open mode parameters +error[UP015]: 18:6: [*] Unnecessary open mode parameters + --> UP015.py:18:6 | 16 | with open("foo", "rUb") as f: 17 | pass @@ -264,8 +277,9 @@ error[UP015]: UP015.py:18:6: [*] Unnecessary open mode parameters 20 20 | with open("foo", "rt") as f: 21 21 | pass -error[UP015]: UP015.py:20:6: [*] Unnecessary open mode parameters +error[UP015]: 20:6: [*] Unnecessary open mode parameters + --> UP015.py:20:6 | 18 | with open("foo", "r") as f: 19 | pass @@ -285,8 +299,9 @@ error[UP015]: UP015.py:20:6: [*] Unnecessary open mode parameters 22 22 | with open("foo", "r", encoding="UTF-8") as f: 23 23 | pass -error[UP015]: UP015.py:22:6: [*] Unnecessary open mode parameters +error[UP015]: 22:6: [*] Unnecessary open mode parameters + --> UP015.py:22:6 | 20 | with open("foo", "rt") as f: 21 | pass @@ -306,8 +321,9 @@ error[UP015]: UP015.py:22:6: [*] Unnecessary open mode parameters 24 24 | with open("foo", "wt") as f: 25 25 | pass -error[UP015]: UP015.py:24:6: [*] Unnecessary open mode parameters, use ""w"" +error[UP015]: 24:6: [*] Unnecessary open mode parameters, use ""w"" + --> UP015.py:24:6 | 22 | with open("foo", "r", encoding="UTF-8") as f: 23 | pass @@ -326,8 +342,9 @@ error[UP015]: UP015.py:24:6: [*] Unnecessary open mode parameters, use ""w"" 26 26 | 27 27 | open(f("a", "b", "c"), "U") -error[UP015]: UP015.py:27:1: [*] Unnecessary open mode parameters +error[UP015]: 27:1: [*] Unnecessary open mode parameters + --> UP015.py:26:1 | 25 | pass 26 | @@ -346,8 +363,9 @@ error[UP015]: UP015.py:27:1: [*] Unnecessary open mode parameters 29 29 | 30 30 | with open(f("a", "b", "c"), "U") as f: -error[UP015]: UP015.py:28:1: [*] Unnecessary open mode parameters, use ""rb"" +error[UP015]: 28:1: [*] Unnecessary open mode parameters, use ""rb"" + --> UP015.py:27:28 | 27 | open(f("a", "b", "c"), "U") 28 | open(f("a", "b", "c"), "Ub") @@ -366,8 +384,9 @@ error[UP015]: UP015.py:28:1: [*] Unnecessary open mode parameters, use ""rb"" 30 30 | with open(f("a", "b", "c"), "U") as f: 31 31 | pass -error[UP015]: UP015.py:30:6: [*] Unnecessary open mode parameters +error[UP015]: 30:6: [*] Unnecessary open mode parameters + --> UP015.py:30:6 | 28 | open(f("a", "b", "c"), "Ub") 29 | @@ -387,8 +406,9 @@ error[UP015]: UP015.py:30:6: [*] Unnecessary open mode parameters 32 32 | with open(f("a", "b", "c"), "Ub") as f: 33 33 | pass -error[UP015]: UP015.py:32:6: [*] Unnecessary open mode parameters, use ""rb"" +error[UP015]: 32:6: [*] Unnecessary open mode parameters, use ""rb"" + --> UP015.py:32:6 | 30 | with open(f("a", "b", "c"), "U") as f: 31 | pass @@ -407,8 +427,9 @@ error[UP015]: UP015.py:32:6: [*] Unnecessary open mode parameters, use ""rb"" 34 34 | 35 35 | with open("foo", "U") as fa, open("bar", "U") as fb: -error[UP015]: UP015.py:35:6: [*] Unnecessary open mode parameters +error[UP015]: 35:6: [*] Unnecessary open mode parameters + --> UP015.py:35:6 | 33 | pass 34 | @@ -428,8 +449,9 @@ error[UP015]: UP015.py:35:6: [*] Unnecessary open mode parameters 37 37 | with open("foo", "Ub") as fa, open("bar", "Ub") as fb: 38 38 | pass -error[UP015]: UP015.py:35:30: [*] Unnecessary open mode parameters +error[UP015]: 35:30: [*] Unnecessary open mode parameters + --> UP015.py:35:30 | 33 | pass 34 | @@ -449,8 +471,9 @@ error[UP015]: UP015.py:35:30: [*] Unnecessary open mode parameters 37 37 | with open("foo", "Ub") as fa, open("bar", "Ub") as fb: 38 38 | pass -error[UP015]: UP015.py:37:6: [*] Unnecessary open mode parameters, use ""rb"" +error[UP015]: 37:6: [*] Unnecessary open mode parameters, use ""rb"" + --> UP015.py:37:6 | 35 | with open("foo", "U") as fa, open("bar", "U") as fb: 36 | pass @@ -469,8 +492,9 @@ error[UP015]: UP015.py:37:6: [*] Unnecessary open mode parameters, use ""rb"" 39 39 | 40 40 | open("foo", mode="U") -error[UP015]: UP015.py:37:31: [*] Unnecessary open mode parameters, use ""rb"" +error[UP015]: 37:31: [*] Unnecessary open mode parameters, use ""rb"" + --> UP015.py:37:31 | 35 | with open("foo", "U") as fa, open("bar", "U") as fb: 36 | pass @@ -489,8 +513,9 @@ error[UP015]: UP015.py:37:31: [*] Unnecessary open mode parameters, use ""rb"" 39 39 | 40 40 | open("foo", mode="U") -error[UP015]: UP015.py:40:1: [*] Unnecessary open mode parameters +error[UP015]: 40:1: [*] Unnecessary open mode parameters + --> UP015.py:39:1 | 38 | pass 39 | @@ -510,8 +535,9 @@ error[UP015]: UP015.py:40:1: [*] Unnecessary open mode parameters 42 42 | open(mode="U", name="foo") 43 43 | -error[UP015]: UP015.py:41:1: [*] Unnecessary open mode parameters +error[UP015]: 41:1: [*] Unnecessary open mode parameters + --> UP015.py:40:22 | 40 | open("foo", mode="U") 41 | open(name="foo", mode="U") @@ -529,8 +555,9 @@ error[UP015]: UP015.py:41:1: [*] Unnecessary open mode parameters 43 43 | 44 44 | with open("foo", mode="U") as f: -error[UP015]: UP015.py:42:1: [*] Unnecessary open mode parameters +error[UP015]: 42:1: [*] Unnecessary open mode parameters + --> UP015.py:41:27 | 40 | open("foo", mode="U") 41 | open(name="foo", mode="U") @@ -550,8 +577,9 @@ error[UP015]: UP015.py:42:1: [*] Unnecessary open mode parameters 44 44 | with open("foo", mode="U") as f: 45 45 | pass -error[UP015]: UP015.py:44:6: [*] Unnecessary open mode parameters +error[UP015]: 44:6: [*] Unnecessary open mode parameters + --> UP015.py:44:6 | 42 | open(mode="U", name="foo") 43 | @@ -571,8 +599,9 @@ error[UP015]: UP015.py:44:6: [*] Unnecessary open mode parameters 46 46 | with open(name="foo", mode="U") as f: 47 47 | pass -error[UP015]: UP015.py:46:6: [*] Unnecessary open mode parameters +error[UP015]: 46:6: [*] Unnecessary open mode parameters + --> UP015.py:46:6 | 44 | with open("foo", mode="U") as f: 45 | pass @@ -592,8 +621,9 @@ error[UP015]: UP015.py:46:6: [*] Unnecessary open mode parameters 48 48 | with open(mode="U", name="foo") as f: 49 49 | pass -error[UP015]: UP015.py:48:6: [*] Unnecessary open mode parameters +error[UP015]: 48:6: [*] Unnecessary open mode parameters + --> UP015.py:48:6 | 46 | with open(name="foo", mode="U") as f: 47 | pass @@ -612,8 +642,9 @@ error[UP015]: UP015.py:48:6: [*] Unnecessary open mode parameters 50 50 | 51 51 | open("foo", mode="Ub") -error[UP015]: UP015.py:51:1: [*] Unnecessary open mode parameters, use ""rb"" +error[UP015]: 51:1: [*] Unnecessary open mode parameters, use ""rb"" + --> UP015.py:50:1 | 49 | pass 50 | @@ -633,8 +664,9 @@ error[UP015]: UP015.py:51:1: [*] Unnecessary open mode parameters, use ""rb"" 53 53 | open(mode="Ub", name="foo") 54 54 | -error[UP015]: UP015.py:52:1: [*] Unnecessary open mode parameters, use ""rb"" +error[UP015]: 52:1: [*] Unnecessary open mode parameters, use ""rb"" + --> UP015.py:51:23 | 51 | open("foo", mode="Ub") 52 | open(name="foo", mode="Ub") @@ -652,8 +684,9 @@ error[UP015]: UP015.py:52:1: [*] Unnecessary open mode parameters, use ""rb"" 54 54 | 55 55 | with open("foo", mode="Ub") as f: -error[UP015]: UP015.py:53:1: [*] Unnecessary open mode parameters, use ""rb"" +error[UP015]: 53:1: [*] Unnecessary open mode parameters, use ""rb"" + --> UP015.py:52:28 | 51 | open("foo", mode="Ub") 52 | open(name="foo", mode="Ub") @@ -673,8 +706,9 @@ error[UP015]: UP015.py:53:1: [*] Unnecessary open mode parameters, use ""rb"" 55 55 | with open("foo", mode="Ub") as f: 56 56 | pass -error[UP015]: UP015.py:55:6: [*] Unnecessary open mode parameters, use ""rb"" +error[UP015]: 55:6: [*] Unnecessary open mode parameters, use ""rb"" + --> UP015.py:55:6 | 53 | open(mode="Ub", name="foo") 54 | @@ -694,8 +728,9 @@ error[UP015]: UP015.py:55:6: [*] Unnecessary open mode parameters, use ""rb"" 57 57 | with open(name="foo", mode="Ub") as f: 58 58 | pass -error[UP015]: UP015.py:57:6: [*] Unnecessary open mode parameters, use ""rb"" +error[UP015]: 57:6: [*] Unnecessary open mode parameters, use ""rb"" + --> UP015.py:57:6 | 55 | with open("foo", mode="Ub") as f: 56 | pass @@ -715,8 +750,9 @@ error[UP015]: UP015.py:57:6: [*] Unnecessary open mode parameters, use ""rb"" 59 59 | with open(mode="Ub", name="foo") as f: 60 60 | pass -error[UP015]: UP015.py:59:6: [*] Unnecessary open mode parameters, use ""rb"" +error[UP015]: 59:6: [*] Unnecessary open mode parameters, use ""rb"" + --> UP015.py:59:6 | 57 | with open(name="foo", mode="Ub") as f: 58 | pass @@ -735,8 +771,9 @@ error[UP015]: UP015.py:59:6: [*] Unnecessary open mode parameters, use ""rb"" 61 61 | 62 62 | open(file="foo", mode='U', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None) -error[UP015]: UP015.py:62:1: [*] Unnecessary open mode parameters +error[UP015]: 62:1: [*] Unnecessary open mode parameters + --> UP015.py:61:1 | 60 | pass 61 | @@ -756,8 +793,9 @@ error[UP015]: UP015.py:62:1: [*] Unnecessary open mode parameters 64 64 | open(file="foo", buffering=-1, encoding=None, errors=None, mode='U', newline=None, closefd=True, opener=None) 65 65 | open(mode='U', file="foo", buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None) -error[UP015]: UP015.py:63:1: [*] Unnecessary open mode parameters +error[UP015]: 63:1: [*] Unnecessary open mode parameters + --> UP015.py:62:110 | 62 | open(file="foo", mode='U', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None) 63 | open(file="foo", buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None, mode='U') @@ -776,8 +814,9 @@ error[UP015]: UP015.py:63:1: [*] Unnecessary open mode parameters 65 65 | open(mode='U', file="foo", buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None) 66 66 | -error[UP015]: UP015.py:64:1: [*] Unnecessary open mode parameters +error[UP015]: 64:1: [*] Unnecessary open mode parameters + --> UP015.py:63:110 | 62 | open(file="foo", mode='U', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None) 63 | open(file="foo", buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None, mode='U') @@ -796,8 +835,9 @@ error[UP015]: UP015.py:64:1: [*] Unnecessary open mode parameters 66 66 | 67 67 | open(file="foo", mode='Ub', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None) -error[UP015]: UP015.py:65:1: [*] Unnecessary open mode parameters +error[UP015]: 65:1: [*] Unnecessary open mode parameters + --> UP015.py:64:110 | 63 | open(file="foo", buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None, mode='U') 64 | open(file="foo", buffering=-1, encoding=None, errors=None, mode='U', newline=None, closefd=True, opener=None) @@ -817,8 +857,9 @@ error[UP015]: UP015.py:65:1: [*] Unnecessary open mode parameters 67 67 | open(file="foo", mode='Ub', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None) 68 68 | open(file="foo", buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None, mode='Ub') -error[UP015]: UP015.py:67:1: [*] Unnecessary open mode parameters, use ""rb"" +error[UP015]: 67:1: [*] Unnecessary open mode parameters, use ""rb"" + --> UP015.py:66:1 | 65 | open(mode='U', file="foo", buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None) 66 | @@ -838,8 +879,9 @@ error[UP015]: UP015.py:67:1: [*] Unnecessary open mode parameters, use ""rb"" 69 69 | open(file="foo", buffering=-1, encoding=None, errors=None, mode='Ub', newline=None, closefd=True, opener=None) 70 70 | open(mode='Ub', file="foo", buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None) -error[UP015]: UP015.py:68:1: [*] Unnecessary open mode parameters, use ""rb"" +error[UP015]: 68:1: [*] Unnecessary open mode parameters, use ""rb"" + --> UP015.py:67:111 | 67 | open(file="foo", mode='Ub', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None) 68 | open(file="foo", buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None, mode='Ub') @@ -858,8 +900,9 @@ error[UP015]: UP015.py:68:1: [*] Unnecessary open mode parameters, use ""rb"" 70 70 | open(mode='Ub', file="foo", buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None) 71 71 | -error[UP015]: UP015.py:69:1: [*] Unnecessary open mode parameters, use ""rb"" +error[UP015]: 69:1: [*] Unnecessary open mode parameters, use ""rb"" + --> UP015.py:68:111 | 67 | open(file="foo", mode='Ub', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None) 68 | open(file="foo", buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None, mode='Ub') @@ -878,8 +921,9 @@ error[UP015]: UP015.py:69:1: [*] Unnecessary open mode parameters, use ""rb"" 71 71 | 72 72 | open = 1 -error[UP015]: UP015.py:70:1: [*] Unnecessary open mode parameters, use ""rb"" +error[UP015]: 70:1: [*] Unnecessary open mode parameters, use ""rb"" + --> UP015.py:69:111 | 68 | open(file="foo", buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None, mode='Ub') 69 | open(file="foo", buffering=-1, encoding=None, errors=None, mode='Ub', newline=None, closefd=True, opener=None) diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP015_1.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP015_1.py.snap index 03a9caacb8..eaf65932d6 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP015_1.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP015_1.py.snap @@ -1,15 +1,16 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -UP015_1.py:3:5: UP015 [*] Unnecessary open mode parameters +error[UP015]: 3:5: [*] Unnecessary open mode parameters + + --> UP015_1.py:3:5 | 1 | # Not a valid type annotation but this test shouldn't result in a panic. 2 | # Refer: https://github.com/astral-sh/ruff/issues/11736 3 | x: 'open("foo", "r")' - | ^^^^^^^^^^^^^^^^ UP015 + | ^^^^^^^^^^^^^^^^ | = help: Remove open mode parameters - ℹ Safe fix 1 1 | # Not a valid type annotation but this test shouldn't result in a panic. 2 2 | # Refer: https://github.com/astral-sh/ruff/issues/11736 diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP018.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP018.py.snap index 5c3d6aacbe..06b70648fc 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP018.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP018.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -error[UP018]: UP018.py:37:1: [*] Unnecessary `str` call (rewrite as a literal) +error[UP018]: 37:1: [*] Unnecessary `str` call (rewrite as a literal) + --> UP018.py:36:24 | 36 | # These become literals 37 | str() @@ -21,8 +22,9 @@ error[UP018]: UP018.py:37:1: [*] Unnecessary `str` call (rewrite as a literal) 39 39 | str(""" 40 40 | foo""") -error[UP018]: UP018.py:38:1: [*] Unnecessary `str` call (rewrite as a literal) +error[UP018]: 38:1: [*] Unnecessary `str` call (rewrite as a literal) + --> UP018.py:37:6 | 36 | # These become literals 37 | str() @@ -42,8 +44,9 @@ error[UP018]: UP018.py:38:1: [*] Unnecessary `str` call (rewrite as a literal) 40 40 | foo""") 41 41 | bytes() -error[UP018]: UP018.py:39:1: [*] Unnecessary `str` call (rewrite as a literal) +error[UP018]: 39:1: [*] Unnecessary `str` call (rewrite as a literal) + --> UP018.py:38:11 | 37 | str() 38 | str("foo") @@ -66,8 +69,9 @@ error[UP018]: UP018.py:39:1: [*] Unnecessary `str` call (rewrite as a literal) 42 42 | bytes(b"foo") 43 43 | bytes(b""" -error[UP018]: UP018.py:41:1: [*] Unnecessary `bytes` call (rewrite as a literal) +error[UP018]: 41:1: [*] Unnecessary `bytes` call (rewrite as a literal) + --> UP018.py:40:8 | 39 | str(""" 40 | foo""") @@ -87,8 +91,9 @@ error[UP018]: UP018.py:41:1: [*] Unnecessary `bytes` call (rewrite as a literal) 43 43 | bytes(b""" 44 44 | foo""") -error[UP018]: UP018.py:42:1: [*] Unnecessary `bytes` call (rewrite as a literal) +error[UP018]: 42:1: [*] Unnecessary `bytes` call (rewrite as a literal) + --> UP018.py:41:8 | 40 | foo""") 41 | bytes() @@ -108,8 +113,9 @@ error[UP018]: UP018.py:42:1: [*] Unnecessary `bytes` call (rewrite as a literal) 44 44 | foo""") 45 45 | f"{str()}" -error[UP018]: UP018.py:43:1: [*] Unnecessary `bytes` call (rewrite as a literal) +error[UP018]: 43:1: [*] Unnecessary `bytes` call (rewrite as a literal) + --> UP018.py:42:14 | 41 | bytes() 42 | bytes(b"foo") @@ -132,8 +138,9 @@ error[UP018]: UP018.py:43:1: [*] Unnecessary `bytes` call (rewrite as a literal) 46 46 | int() 47 47 | int(1) -error[UP018]: UP018.py:45:4: [*] Unnecessary `str` call (rewrite as a literal) +error[UP018]: 45:4: [*] Unnecessary `str` call (rewrite as a literal) + --> UP018.py:45:4 | 43 | bytes(b""" 44 | foo""") @@ -153,8 +160,9 @@ error[UP018]: UP018.py:45:4: [*] Unnecessary `str` call (rewrite as a literal) 47 47 | int(1) 48 48 | float() -error[UP018]: UP018.py:46:1: [*] Unnecessary `int` call (rewrite as a literal) +error[UP018]: 46:1: [*] Unnecessary `int` call (rewrite as a literal) + --> UP018.py:45:11 | 44 | foo""") 45 | f"{str()}" @@ -174,8 +182,9 @@ error[UP018]: UP018.py:46:1: [*] Unnecessary `int` call (rewrite as a literal) 48 48 | float() 49 49 | float(1.0) -error[UP018]: UP018.py:47:1: [*] Unnecessary `int` call (rewrite as a literal) +error[UP018]: 47:1: [*] Unnecessary `int` call (rewrite as a literal) + --> UP018.py:46:6 | 45 | f"{str()}" 46 | int() @@ -195,8 +204,9 @@ error[UP018]: UP018.py:47:1: [*] Unnecessary `int` call (rewrite as a literal) 49 49 | float(1.0) 50 50 | bool() -error[UP018]: UP018.py:48:1: [*] Unnecessary `float` call (rewrite as a literal) +error[UP018]: 48:1: [*] Unnecessary `float` call (rewrite as a literal) + --> UP018.py:47:7 | 46 | int() 47 | int(1) @@ -216,8 +226,9 @@ error[UP018]: UP018.py:48:1: [*] Unnecessary `float` call (rewrite as a literal) 50 50 | bool() 51 51 | bool(True) -error[UP018]: UP018.py:49:1: [*] Unnecessary `float` call (rewrite as a literal) +error[UP018]: 49:1: [*] Unnecessary `float` call (rewrite as a literal) + --> UP018.py:48:8 | 47 | int(1) 48 | float() @@ -237,8 +248,9 @@ error[UP018]: UP018.py:49:1: [*] Unnecessary `float` call (rewrite as a literal) 51 51 | bool(True) 52 52 | bool(False) -error[UP018]: UP018.py:50:1: [*] Unnecessary `bool` call (rewrite as a literal) +error[UP018]: 50:1: [*] Unnecessary `bool` call (rewrite as a literal) + --> UP018.py:49:11 | 48 | float() 49 | float(1.0) @@ -258,8 +270,9 @@ error[UP018]: UP018.py:50:1: [*] Unnecessary `bool` call (rewrite as a literal) 52 52 | bool(False) 53 53 | -error[UP018]: UP018.py:51:1: [*] Unnecessary `bool` call (rewrite as a literal) +error[UP018]: 51:1: [*] Unnecessary `bool` call (rewrite as a literal) + --> UP018.py:50:7 | 49 | float(1.0) 50 | bool() @@ -278,8 +291,9 @@ error[UP018]: UP018.py:51:1: [*] Unnecessary `bool` call (rewrite as a literal) 53 53 | 54 54 | # These become a literal but retain parentheses -error[UP018]: UP018.py:52:1: [*] Unnecessary `bool` call (rewrite as a literal) +error[UP018]: 52:1: [*] Unnecessary `bool` call (rewrite as a literal) + --> UP018.py:51:11 | 50 | bool() 51 | bool(True) @@ -299,8 +313,9 @@ error[UP018]: UP018.py:52:1: [*] Unnecessary `bool` call (rewrite as a literal) 54 54 | # These become a literal but retain parentheses 55 55 | int(1).denominator -error[UP018]: UP018.py:55:1: [*] Unnecessary `int` call (rewrite as a literal) +error[UP018]: 55:1: [*] Unnecessary `int` call (rewrite as a literal) + --> UP018.py:54:48 | 54 | # These become a literal but retain parentheses 55 | int(1).denominator @@ -319,8 +334,9 @@ error[UP018]: UP018.py:55:1: [*] Unnecessary `int` call (rewrite as a literal) 57 57 | # These too are literals in spirit 58 58 | int(+1) -error[UP018]: UP018.py:58:1: [*] Unnecessary `int` call (rewrite as a literal) +error[UP018]: 58:1: [*] Unnecessary `int` call (rewrite as a literal) + --> UP018.py:57:35 | 57 | # These too are literals in spirit 58 | int(+1) @@ -339,8 +355,9 @@ error[UP018]: UP018.py:58:1: [*] Unnecessary `int` call (rewrite as a literal) 60 60 | float(+1.0) 61 61 | float(-1.0) -error[UP018]: UP018.py:59:1: [*] Unnecessary `int` call (rewrite as a literal) +error[UP018]: 59:1: [*] Unnecessary `int` call (rewrite as a literal) + --> UP018.py:58:8 | 57 | # These too are literals in spirit 58 | int(+1) @@ -359,8 +376,9 @@ error[UP018]: UP018.py:59:1: [*] Unnecessary `int` call (rewrite as a literal) 60 60 | float(+1.0) 61 61 | float(-1.0) -error[UP018]: UP018.py:60:1: [*] Unnecessary `float` call (rewrite as a literal) +error[UP018]: 60:1: [*] Unnecessary `float` call (rewrite as a literal) + --> UP018.py:59:8 | 58 | int(+1) 59 | int(-1) @@ -377,8 +395,9 @@ error[UP018]: UP018.py:60:1: [*] Unnecessary `float` call (rewrite as a literal) 60 |++1.0 61 61 | float(-1.0) -error[UP018]: UP018.py:61:1: [*] Unnecessary `float` call (rewrite as a literal) +error[UP018]: 61:1: [*] Unnecessary `float` call (rewrite as a literal) + --> UP018.py:60:12 | 59 | int(-1) 60 | float(+1.0) diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP019.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP019.py.snap index 808f61503b..826b08d4a8 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP019.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP019.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -error[UP019]: UP019.py:7:22: [*] `typing.Text` is deprecated, use `str` +error[UP019]: 7:22: [*] `typing.Text` is deprecated, use `str` + --> UP019.py:7:22 | 7 | def print_word(word: Text) -> None: | ^^^^ @@ -19,8 +20,9 @@ error[UP019]: UP019.py:7:22: [*] `typing.Text` is deprecated, use `str` 9 9 | 10 10 | -error[UP019]: UP019.py:11:29: [*] `typing.Text` is deprecated, use `str` +error[UP019]: 11:29: [*] `typing.Text` is deprecated, use `str` + --> UP019.py:11:29 | 11 | def print_second_word(word: typing.Text) -> None: | ^^^^^^^^^^^ @@ -37,8 +39,9 @@ error[UP019]: UP019.py:11:29: [*] `typing.Text` is deprecated, use `str` 13 13 | 14 14 | -error[UP019]: UP019.py:15:28: [*] `typing.Text` is deprecated, use `str` +error[UP019]: 15:28: [*] `typing.Text` is deprecated, use `str` + --> UP019.py:15:28 | 15 | def print_third_word(word: Hello.Text) -> None: | ^^^^^^^^^^ @@ -55,8 +58,9 @@ error[UP019]: UP019.py:15:28: [*] `typing.Text` is deprecated, use `str` 17 17 | 18 18 | -error[UP019]: UP019.py:19:29: [*] `typing.Text` is deprecated, use `str` +error[UP019]: 19:29: [*] `typing.Text` is deprecated, use `str` + --> UP019.py:19:29 | 19 | def print_fourth_word(word: Goodbye) -> None: | ^^^^^^^ diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP020.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP020.py.snap index 8295550dab..720d3d4db0 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP020.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP020.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -error[UP020]: UP020.py:3:6: [*] Use builtin `open` +error[UP020]: 3:6: [*] Use builtin `open` + --> UP020.py:3:6 | 1 | import io 2 | @@ -20,8 +21,9 @@ error[UP020]: UP020.py:3:6: [*] Use builtin `open` 5 5 | 6 6 | from io import open -error[UP020]: UP020.py:8:6: [*] Use builtin `open` +error[UP020]: 8:6: [*] Use builtin `open` + --> UP020.py:8:6 | 6 | from io import open 7 | diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP021.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP021.py.snap index 5eddc4a4c3..d4b2014e08 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP021.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP021.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -error[UP021]: UP021.py:5:25: [*] `universal_newlines` is deprecated, use `text` +error[UP021]: 5:25: [*] `universal_newlines` is deprecated, use `text` + --> UP021.py:5:25 | 4 | # Errors 5 | subprocess.run(["foo"], universal_newlines=True, check=True) @@ -21,8 +22,9 @@ error[UP021]: UP021.py:5:25: [*] `universal_newlines` is deprecated, use `text` 7 7 | run(["foo"], universal_newlines=True, check=False) 8 8 | -error[UP021]: UP021.py:6:25: [*] `universal_newlines` is deprecated, use `text` +error[UP021]: 6:25: [*] `universal_newlines` is deprecated, use `text` + --> UP021.py:6:25 | 4 | # Errors 5 | subprocess.run(["foo"], universal_newlines=True, check=True) @@ -41,8 +43,9 @@ error[UP021]: UP021.py:6:25: [*] `universal_newlines` is deprecated, use `text` 8 8 | 9 9 | # OK -error[UP021]: UP021.py:7:14: [*] `universal_newlines` is deprecated, use `text` +error[UP021]: 7:14: [*] `universal_newlines` is deprecated, use `text` + --> UP021.py:7:14 | 5 | subprocess.run(["foo"], universal_newlines=True, check=True) 6 | subprocess.run(["foo"], universal_newlines=True, text=True) diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP022.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP022.py.snap index df76b5717d..06fecb335c 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP022.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP022.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -error[UP022]: UP022.py:4:10: [*] Prefer `capture_output` over sending `stdout` and `stderr` to `PIPE` +error[UP022]: 4:10: [*] Prefer `capture_output` over sending `stdout` and `stderr` to `PIPE` + --> UP022.py:4:10 | 2 | import subprocess 3 | @@ -22,8 +23,9 @@ error[UP022]: UP022.py:4:10: [*] Prefer `capture_output` over sending `stdout` a 6 6 | output = subprocess.run(["foo"], stdout=subprocess.PIPE, stderr=subprocess.PIPE) 7 7 | -error[UP022]: UP022.py:6:10: [*] Prefer `capture_output` over sending `stdout` and `stderr` to `PIPE` +error[UP022]: 6:10: [*] Prefer `capture_output` over sending `stdout` and `stderr` to `PIPE` + --> UP022.py:6:10 | 4 | output = run(["foo"], stdout=subprocess.PIPE, stderr=subprocess.PIPE) 5 | @@ -43,8 +45,9 @@ error[UP022]: UP022.py:6:10: [*] Prefer `capture_output` over sending `stdout` a 8 8 | output = subprocess.run(stdout=subprocess.PIPE, args=["foo"], stderr=subprocess.PIPE) 9 9 | -error[UP022]: UP022.py:8:10: [*] Prefer `capture_output` over sending `stdout` and `stderr` to `PIPE` +error[UP022]: 8:10: [*] Prefer `capture_output` over sending `stdout` and `stderr` to `PIPE` + --> UP022.py:8:10 | 6 | output = subprocess.run(["foo"], stdout=subprocess.PIPE, stderr=subprocess.PIPE) 7 | @@ -64,8 +67,9 @@ error[UP022]: UP022.py:8:10: [*] Prefer `capture_output` over sending `stdout` a 10 10 | output = subprocess.run( 11 11 | ["foo"], stdout=subprocess.PIPE, check=True, stderr=subprocess.PIPE -error[UP022]: UP022.py:10:10: [*] Prefer `capture_output` over sending `stdout` and `stderr` to `PIPE` +error[UP022]: 10:10: [*] Prefer `capture_output` over sending `stdout` and `stderr` to `PIPE` + --> UP022.py:10:10 | 8 | output = subprocess.run(stdout=subprocess.PIPE, args=["foo"], stderr=subprocess.PIPE) 9 | @@ -88,8 +92,9 @@ error[UP022]: UP022.py:10:10: [*] Prefer `capture_output` over sending `stdout` 13 13 | 14 14 | output = subprocess.run( -error[UP022]: UP022.py:14:10: [*] Prefer `capture_output` over sending `stdout` and `stderr` to `PIPE` +error[UP022]: 14:10: [*] Prefer `capture_output` over sending `stdout` and `stderr` to `PIPE` + --> UP022.py:14:10 | 12 | ) 13 | @@ -112,8 +117,9 @@ error[UP022]: UP022.py:14:10: [*] Prefer `capture_output` over sending `stdout` 17 17 | 18 18 | output = subprocess.run( -error[UP022]: UP022.py:18:10: [*] Prefer `capture_output` over sending `stdout` and `stderr` to `PIPE` +error[UP022]: 18:10: [*] Prefer `capture_output` over sending `stdout` and `stderr` to `PIPE` + --> UP022.py:18:10 | 16 | ) 17 | @@ -144,8 +150,9 @@ error[UP022]: UP022.py:18:10: [*] Prefer `capture_output` over sending `stdout` 24 23 | encoding="utf-8", 25 24 | close_fds=True, -error[UP022]: UP022.py:29:14: [*] Prefer `capture_output` over sending `stdout` and `stderr` to `PIPE` +error[UP022]: 29:14: [*] Prefer `capture_output` over sending `stdout` and `stderr` to `PIPE` + --> UP022.py:29:14 | 28 | if output: 29 | output = subprocess.run( @@ -174,8 +181,9 @@ error[UP022]: UP022.py:29:14: [*] Prefer `capture_output` over sending `stdout` 35 34 | encoding="utf-8", 36 35 | ) -error[UP022]: UP022.py:38:10: Prefer `capture_output` over sending `stdout` and `stderr` to `PIPE` +error[UP022]: 38:10: Prefer `capture_output` over sending `stdout` and `stderr` to `PIPE` + --> UP022.py:38:10 | 36 | ) 37 | @@ -188,8 +196,9 @@ error[UP022]: UP022.py:38:10: Prefer `capture_output` over sending `stdout` and 42 | output = subprocess.run( | = help: Replace with `capture_output` keyword argument -error[UP022]: UP022.py:42:10: Prefer `capture_output` over sending `stdout` and `stderr` to `PIPE` +error[UP022]: 42:10: Prefer `capture_output` over sending `stdout` and `stderr` to `PIPE` + --> UP022.py:42:10 | 40 | ) 41 | @@ -202,8 +211,9 @@ error[UP022]: UP022.py:42:10: Prefer `capture_output` over sending `stdout` and 46 | output = subprocess.run( | = help: Replace with `capture_output` keyword argument -error[UP022]: UP022.py:46:10: Prefer `capture_output` over sending `stdout` and `stderr` to `PIPE` +error[UP022]: 46:10: Prefer `capture_output` over sending `stdout` and `stderr` to `PIPE` + --> UP022.py:46:10 | 44 | ) 45 | diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP023.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP023.py.snap index 69bc5b7318..cfd5d849f7 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP023.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP023.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -error[UP023]: UP023.py:2:1: [*] `cElementTree` is deprecated, use `ElementTree` +error[UP023]: 2:1: [*] `cElementTree` is deprecated, use `ElementTree` + --> UP023.py:1:80 | 1 | # These two imports have something after cElementTree, so they should be fixed. 2 | from xml.etree.cElementTree import XML, Element, SubElement @@ -18,8 +19,9 @@ error[UP023]: UP023.py:2:1: [*] `cElementTree` is deprecated, use `ElementTree` 4 4 | 5 5 | # Weird spacing should not cause issues. -error[UP023]: UP023.py:3:8: [*] `cElementTree` is deprecated, use `ElementTree` +error[UP023]: 3:8: [*] `cElementTree` is deprecated, use `ElementTree` + --> UP023.py:3:8 | 1 | # These two imports have something after cElementTree, so they should be fixed. 2 | from xml.etree.cElementTree import XML, Element, SubElement @@ -38,8 +40,9 @@ error[UP023]: UP023.py:3:8: [*] `cElementTree` is deprecated, use `ElementTree` 5 5 | # Weird spacing should not cause issues. 6 6 | from xml.etree.cElementTree import XML -error[UP023]: UP023.py:6:1: [*] `cElementTree` is deprecated, use `ElementTree` +error[UP023]: 6:1: [*] `cElementTree` is deprecated, use `ElementTree` + --> UP023.py:5:41 | 5 | # Weird spacing should not cause issues. 6 | from xml.etree.cElementTree import XML @@ -57,8 +60,9 @@ error[UP023]: UP023.py:6:1: [*] `cElementTree` is deprecated, use `ElementTree` 8 8 | 9 9 | # Multi line imports should also work fine. -error[UP023]: UP023.py:7:11: [*] `cElementTree` is deprecated, use `ElementTree` +error[UP023]: 7:11: [*] `cElementTree` is deprecated, use `ElementTree` + --> UP023.py:7:11 | 5 | # Weird spacing should not cause issues. 6 | from xml.etree.cElementTree import XML @@ -78,8 +82,9 @@ error[UP023]: UP023.py:7:11: [*] `cElementTree` is deprecated, use `ElementTree` 9 9 | # Multi line imports should also work fine. 10 10 | from xml.etree.cElementTree import ( -error[UP023]: UP023.py:10:1: [*] `cElementTree` is deprecated, use `ElementTree` +error[UP023]: 10:1: [*] `cElementTree` is deprecated, use `ElementTree` + --> UP023.py:9:44 | 9 | # Multi line imports should also work fine. 10 | / from xml.etree.cElementTree import ( @@ -102,8 +107,9 @@ error[UP023]: UP023.py:10:1: [*] `cElementTree` is deprecated, use `ElementTree` 12 12 | Element, 13 13 | SubElement, -error[UP023]: UP023.py:16:12: [*] `cElementTree` is deprecated, use `ElementTree` +error[UP023]: 16:12: [*] `cElementTree` is deprecated, use `ElementTree` + --> UP023.py:16:12 | 14 | ) 15 | if True: @@ -122,8 +128,9 @@ error[UP023]: UP023.py:16:12: [*] `cElementTree` is deprecated, use `ElementTree 18 18 | 19 19 | from xml.etree import cElementTree as ET -error[UP023]: UP023.py:17:27: [*] `cElementTree` is deprecated, use `ElementTree` +error[UP023]: 17:27: [*] `cElementTree` is deprecated, use `ElementTree` + --> UP023.py:17:27 | 15 | if True: 16 | import xml.etree.cElementTree as ET @@ -143,8 +150,9 @@ error[UP023]: UP023.py:17:27: [*] `cElementTree` is deprecated, use `ElementTree 19 19 | from xml.etree import cElementTree as ET 20 20 | -error[UP023]: UP023.py:19:23: [*] `cElementTree` is deprecated, use `ElementTree` +error[UP023]: 19:23: [*] `cElementTree` is deprecated, use `ElementTree` + --> UP023.py:19:23 | 17 | from xml.etree import cElementTree as CET 18 | @@ -164,8 +172,9 @@ error[UP023]: UP023.py:19:23: [*] `cElementTree` is deprecated, use `ElementTree 21 21 | import contextlib, xml.etree.cElementTree as ET 22 22 | -error[UP023]: UP023.py:21:20: [*] `cElementTree` is deprecated, use `ElementTree` +error[UP023]: 21:20: [*] `cElementTree` is deprecated, use `ElementTree` + --> UP023.py:21:20 | 19 | from xml.etree import cElementTree as ET 20 | @@ -185,8 +194,9 @@ error[UP023]: UP023.py:21:20: [*] `cElementTree` is deprecated, use `ElementTree 23 23 | # This should fix the second, but not the first invocation. 24 24 | import xml.etree.cElementTree, xml.etree.cElementTree as ET -error[UP023]: UP023.py:24:32: [*] `cElementTree` is deprecated, use `ElementTree` +error[UP023]: 24:32: [*] `cElementTree` is deprecated, use `ElementTree` + --> UP023.py:24:32 | 23 | # This should fix the second, but not the first invocation. 24 | import xml.etree.cElementTree, xml.etree.cElementTree as ET diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP024_0.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP024_0.py.snap index 55616bfe32..ba3f3718fe 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP024_0.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP024_0.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -error[UP024]: UP024_0.py:6:8: [*] Replace aliased errors with `OSError` +error[UP024]: 6:8: [*] Replace aliased errors with `OSError` + --> UP024_0.py:6:8 | 4 | try: 5 | pass @@ -21,8 +22,9 @@ error[UP024]: UP024_0.py:6:8: [*] Replace aliased errors with `OSError` 8 8 | 9 9 | try: -error[UP024]: UP024_0.py:11:8: [*] Replace aliased errors with `OSError` +error[UP024]: 11:8: [*] Replace aliased errors with `OSError` + --> UP024_0.py:11:8 | 9 | try: 10 | pass @@ -41,8 +43,9 @@ error[UP024]: UP024_0.py:11:8: [*] Replace aliased errors with `OSError` 13 13 | 14 14 | try: -error[UP024]: UP024_0.py:16:8: [*] Replace aliased errors with `OSError` +error[UP024]: 16:8: [*] Replace aliased errors with `OSError` + --> UP024_0.py:16:8 | 14 | try: 15 | pass @@ -61,8 +64,9 @@ error[UP024]: UP024_0.py:16:8: [*] Replace aliased errors with `OSError` 18 18 | 19 19 | try: -error[UP024]: UP024_0.py:21:8: [*] Replace aliased errors with `OSError` +error[UP024]: 21:8: [*] Replace aliased errors with `OSError` + --> UP024_0.py:21:8 | 19 | try: 20 | pass @@ -81,8 +85,9 @@ error[UP024]: UP024_0.py:21:8: [*] Replace aliased errors with `OSError` 23 23 | 24 24 | try: -error[UP024]: UP024_0.py:26:8: [*] Replace aliased errors with `OSError` +error[UP024]: 26:8: [*] Replace aliased errors with `OSError` + --> UP024_0.py:26:8 | 24 | try: 25 | pass @@ -101,8 +106,9 @@ error[UP024]: UP024_0.py:26:8: [*] Replace aliased errors with `OSError` 28 28 | 29 29 | try: -error[UP024]: UP024_0.py:31:8: [*] Replace aliased errors with `OSError` +error[UP024]: 31:8: [*] Replace aliased errors with `OSError` + --> UP024_0.py:31:8 | 29 | try: 30 | pass @@ -121,8 +127,9 @@ error[UP024]: UP024_0.py:31:8: [*] Replace aliased errors with `OSError` 33 33 | 34 34 | try: -error[UP024]: UP024_0.py:36:8: [*] Replace aliased errors with `OSError` +error[UP024]: 36:8: [*] Replace aliased errors with `OSError` + --> UP024_0.py:36:8 | 34 | try: 35 | pass @@ -141,8 +148,9 @@ error[UP024]: UP024_0.py:36:8: [*] Replace aliased errors with `OSError` 38 38 | 39 39 | # Should NOT be in parentheses when replaced -error[UP024]: UP024_0.py:43:8: [*] Replace aliased errors with `OSError` +error[UP024]: 43:8: [*] Replace aliased errors with `OSError` + --> UP024_0.py:43:8 | 41 | try: 42 | pass @@ -162,8 +170,9 @@ error[UP024]: UP024_0.py:43:8: [*] Replace aliased errors with `OSError` 45 45 | try: 46 46 | pass -error[UP024]: UP024_0.py:47:8: [*] Replace aliased errors with `OSError` +error[UP024]: 47:8: [*] Replace aliased errors with `OSError` + --> UP024_0.py:47:8 | 45 | try: 46 | pass @@ -183,8 +192,9 @@ error[UP024]: UP024_0.py:47:8: [*] Replace aliased errors with `OSError` 49 49 | try: 50 50 | pass -error[UP024]: UP024_0.py:51:8: [*] Replace aliased errors with `OSError` +error[UP024]: 51:8: [*] Replace aliased errors with `OSError` + --> UP024_0.py:51:8 | 49 | try: 50 | pass @@ -203,8 +213,9 @@ error[UP024]: UP024_0.py:51:8: [*] Replace aliased errors with `OSError` 53 53 | 54 54 | # Should be kept in parentheses (because multiple) -error[UP024]: UP024_0.py:58:8: [*] Replace aliased errors with `OSError` +error[UP024]: 58:8: [*] Replace aliased errors with `OSError` + --> UP024_0.py:58:8 | 56 | try: 57 | pass @@ -223,8 +234,9 @@ error[UP024]: UP024_0.py:58:8: [*] Replace aliased errors with `OSError` 60 60 | 61 61 | # First should change, second should not -error[UP024]: UP024_0.py:65:8: [*] Replace aliased errors with `OSError` +error[UP024]: 65:8: [*] Replace aliased errors with `OSError` + --> UP024_0.py:65:8 | 63 | try: 64 | pass @@ -244,8 +256,9 @@ error[UP024]: UP024_0.py:65:8: [*] Replace aliased errors with `OSError` 67 67 | # These should not change 68 68 | -error[UP024]: UP024_0.py:87:8: [*] Replace aliased errors with `OSError` +error[UP024]: 87:8: [*] Replace aliased errors with `OSError` + --> UP024_0.py:87:8 | 85 | try: 86 | pass @@ -264,8 +277,9 @@ error[UP024]: UP024_0.py:87:8: [*] Replace aliased errors with `OSError` 89 89 | 90 90 | try: -error[UP024]: UP024_0.py:105:11: [*] Replace aliased errors with `OSError` +error[UP024]: 105:11: [*] Replace aliased errors with `OSError` + --> UP024_0.py:105:11 | 103 | try: 104 | mac_address = get_primary_mac_address() @@ -284,8 +298,9 @@ error[UP024]: UP024_0.py:105:11: [*] Replace aliased errors with `OSError` 107 107 | 108 108 | -error[UP024]: UP024_0.py:114:8: [*] Replace aliased errors with `OSError` +error[UP024]: 114:8: [*] Replace aliased errors with `OSError` + --> UP024_0.py:114:8 | 112 | try: 113 | pass diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP024_1.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP024_1.py.snap index dc48903142..46e6495c9c 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP024_1.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP024_1.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -error[UP024]: UP024_1.py:5:8: [*] Replace aliased errors with `OSError` +error[UP024]: 5:8: [*] Replace aliased errors with `OSError` + --> UP024_1.py:5:8 | 3 | try: 4 | pass @@ -22,8 +23,9 @@ error[UP024]: UP024_1.py:5:8: [*] Replace aliased errors with `OSError` 7 7 | except (OSError, socket.error, KeyError): 8 8 | pass -error[UP024]: UP024_1.py:7:8: [*] Replace aliased errors with `OSError` +error[UP024]: 7:8: [*] Replace aliased errors with `OSError` + --> UP024_1.py:7:8 | 5 | except (OSError, mmap.error, IOError): 6 | pass @@ -42,8 +44,9 @@ error[UP024]: UP024_1.py:7:8: [*] Replace aliased errors with `OSError` 9 9 | 10 10 | try: -error[UP024]: UP024_1.py:12:8: [*] Replace aliased errors with `OSError` +error[UP024]: 12:8: [*] Replace aliased errors with `OSError` + --> UP024_1.py:12:8 | 10 | try: 11 | pass diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP024_2.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP024_2.py.snap index a4af993949..639952a0a2 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP024_2.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP024_2.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -error[UP024]: UP024_2.py:10:7: [*] Replace aliased errors with `OSError` +error[UP024]: 10:7: [*] Replace aliased errors with `OSError` + --> UP024_2.py:10:7 | 8 | # Testing the modules 9 | import socket, mmap, select @@ -22,8 +23,9 @@ error[UP024]: UP024_2.py:10:7: [*] Replace aliased errors with `OSError` 12 12 | raise select.error 13 13 | -error[UP024]: UP024_2.py:11:7: [*] Replace aliased errors with `OSError` +error[UP024]: 11:7: [*] Replace aliased errors with `OSError` + --> UP024_2.py:11:7 | 9 | import socket, mmap, select 10 | raise socket.error @@ -42,8 +44,9 @@ error[UP024]: UP024_2.py:11:7: [*] Replace aliased errors with `OSError` 13 13 | 14 14 | raise socket.error() -error[UP024]: UP024_2.py:12:7: [*] Replace aliased errors with `OSError` +error[UP024]: 12:7: [*] Replace aliased errors with `OSError` + --> UP024_2.py:12:7 | 10 | raise socket.error 11 | raise mmap.error @@ -63,8 +66,9 @@ error[UP024]: UP024_2.py:12:7: [*] Replace aliased errors with `OSError` 14 14 | raise socket.error() 15 15 | raise mmap.error(1) -error[UP024]: UP024_2.py:14:7: [*] Replace aliased errors with `OSError` +error[UP024]: 14:7: [*] Replace aliased errors with `OSError` + --> UP024_2.py:14:7 | 12 | raise select.error 13 | @@ -84,8 +88,9 @@ error[UP024]: UP024_2.py:14:7: [*] Replace aliased errors with `OSError` 16 16 | raise select.error(1, 2) 17 17 | -error[UP024]: UP024_2.py:15:7: [*] Replace aliased errors with `OSError` +error[UP024]: 15:7: [*] Replace aliased errors with `OSError` + --> UP024_2.py:15:7 | 14 | raise socket.error() 15 | raise mmap.error(1) @@ -103,8 +108,9 @@ error[UP024]: UP024_2.py:15:7: [*] Replace aliased errors with `OSError` 17 17 | 18 18 | raise socket.error( -error[UP024]: UP024_2.py:16:7: [*] Replace aliased errors with `OSError` +error[UP024]: 16:7: [*] Replace aliased errors with `OSError` + --> UP024_2.py:16:7 | 14 | raise socket.error() 15 | raise mmap.error(1) @@ -124,8 +130,9 @@ error[UP024]: UP024_2.py:16:7: [*] Replace aliased errors with `OSError` 18 18 | raise socket.error( 19 19 | 1, -error[UP024]: UP024_2.py:18:7: [*] Replace aliased errors with `OSError` +error[UP024]: 18:7: [*] Replace aliased errors with `OSError` + --> UP024_2.py:18:7 | 16 | raise select.error(1, 2) 17 | @@ -145,8 +152,9 @@ error[UP024]: UP024_2.py:18:7: [*] Replace aliased errors with `OSError` 20 20 | 2, 21 21 | 3, -error[UP024]: UP024_2.py:25:7: [*] Replace aliased errors with `OSError` +error[UP024]: 25:7: [*] Replace aliased errors with `OSError` + --> UP024_2.py:25:7 | 24 | from mmap import error 25 | raise error @@ -165,8 +173,9 @@ error[UP024]: UP024_2.py:25:7: [*] Replace aliased errors with `OSError` 27 27 | from socket import error 28 28 | raise error(1) -error[UP024]: UP024_2.py:28:7: [*] Replace aliased errors with `OSError` +error[UP024]: 28:7: [*] Replace aliased errors with `OSError` + --> UP024_2.py:28:7 | 27 | from socket import error 28 | raise error(1) @@ -185,8 +194,9 @@ error[UP024]: UP024_2.py:28:7: [*] Replace aliased errors with `OSError` 30 30 | from select import error 31 31 | raise error(1, 2) -error[UP024]: UP024_2.py:31:7: [*] Replace aliased errors with `OSError` +error[UP024]: 31:7: [*] Replace aliased errors with `OSError` + --> UP024_2.py:31:7 | 30 | from select import error 31 | raise error(1, 2) @@ -205,8 +215,9 @@ error[UP024]: UP024_2.py:31:7: [*] Replace aliased errors with `OSError` 33 33 | # Testing the names 34 34 | raise EnvironmentError -error[UP024]: UP024_2.py:34:7: [*] Replace aliased errors with `OSError` +error[UP024]: 34:7: [*] Replace aliased errors with `OSError` + --> UP024_2.py:34:7 | 33 | # Testing the names 34 | raise EnvironmentError @@ -225,8 +236,9 @@ error[UP024]: UP024_2.py:34:7: [*] Replace aliased errors with `OSError` 36 36 | raise WindowsError 37 37 | -error[UP024]: UP024_2.py:35:7: [*] Replace aliased errors with `OSError` +error[UP024]: 35:7: [*] Replace aliased errors with `OSError` + --> UP024_2.py:35:7 | 33 | # Testing the names 34 | raise EnvironmentError @@ -245,8 +257,9 @@ error[UP024]: UP024_2.py:35:7: [*] Replace aliased errors with `OSError` 37 37 | 38 38 | raise EnvironmentError() -error[UP024]: UP024_2.py:36:7: [*] Replace aliased errors with `OSError` +error[UP024]: 36:7: [*] Replace aliased errors with `OSError` + --> UP024_2.py:36:7 | 34 | raise EnvironmentError 35 | raise IOError @@ -266,8 +279,9 @@ error[UP024]: UP024_2.py:36:7: [*] Replace aliased errors with `OSError` 38 38 | raise EnvironmentError() 39 39 | raise IOError(1) -error[UP024]: UP024_2.py:38:7: [*] Replace aliased errors with `OSError` +error[UP024]: 38:7: [*] Replace aliased errors with `OSError` + --> UP024_2.py:38:7 | 36 | raise WindowsError 37 | @@ -287,8 +301,9 @@ error[UP024]: UP024_2.py:38:7: [*] Replace aliased errors with `OSError` 40 40 | raise WindowsError(1, 2) 41 41 | -error[UP024]: UP024_2.py:39:7: [*] Replace aliased errors with `OSError` +error[UP024]: 39:7: [*] Replace aliased errors with `OSError` + --> UP024_2.py:39:7 | 38 | raise EnvironmentError() 39 | raise IOError(1) @@ -306,8 +321,9 @@ error[UP024]: UP024_2.py:39:7: [*] Replace aliased errors with `OSError` 41 41 | 42 42 | raise EnvironmentError( -error[UP024]: UP024_2.py:40:7: [*] Replace aliased errors with `OSError` +error[UP024]: 40:7: [*] Replace aliased errors with `OSError` + --> UP024_2.py:40:7 | 38 | raise EnvironmentError() 39 | raise IOError(1) @@ -327,8 +343,9 @@ error[UP024]: UP024_2.py:40:7: [*] Replace aliased errors with `OSError` 42 42 | raise EnvironmentError( 43 43 | 1, -error[UP024]: UP024_2.py:42:7: [*] Replace aliased errors with `OSError` +error[UP024]: 42:7: [*] Replace aliased errors with `OSError` + --> UP024_2.py:42:7 | 40 | raise WindowsError(1, 2) 41 | @@ -348,8 +365,9 @@ error[UP024]: UP024_2.py:42:7: [*] Replace aliased errors with `OSError` 44 44 | 2, 45 45 | 3, -error[UP024]: UP024_2.py:48:7: [*] Replace aliased errors with `OSError` +error[UP024]: 48:7: [*] Replace aliased errors with `OSError` + --> UP024_2.py:48:7 | 46 | ) 47 | @@ -368,8 +386,9 @@ error[UP024]: UP024_2.py:48:7: [*] Replace aliased errors with `OSError` 49 49 | raise EnvironmentError(1) 50 50 | raise IOError(1, 2) -error[UP024]: UP024_2.py:49:7: [*] Replace aliased errors with `OSError` +error[UP024]: 49:7: [*] Replace aliased errors with `OSError` + --> UP024_2.py:49:7 | 48 | raise WindowsError 49 | raise EnvironmentError(1) @@ -385,8 +404,9 @@ error[UP024]: UP024_2.py:49:7: [*] Replace aliased errors with `OSError` 49 |+raise OSError(1) 50 50 | raise IOError(1, 2) -error[UP024]: UP024_2.py:50:7: [*] Replace aliased errors with `OSError` +error[UP024]: 50:7: [*] Replace aliased errors with `OSError` + --> UP024_2.py:50:7 | 48 | raise WindowsError 49 | raise EnvironmentError(1) diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP024_4.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP024_4.py.snap index 260cd1db40..91956399bf 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP024_4.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP024_4.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -error[UP024]: UP024_4.py:9:8: [*] Replace aliased errors with `OSError` +error[UP024]: 9:8: [*] Replace aliased errors with `OSError` + --> UP024_4.py:9:8 | 7 | conn.ensure_connection(max_retries=2) 8 | conn._close() diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP025.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP025.py.snap index 46b3162256..bcfbc3b62a 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP025.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP025.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -error[UP025]: UP025.py:1:1: [*] Remove unicode literals from strings +error[UP025]: 1:1: [*] Remove unicode literals from strings + --> UP025.py:1:1 | 1 | u"Hello" | ^^^^^^^^ @@ -17,8 +18,9 @@ error[UP025]: UP025.py:1:1: [*] Remove unicode literals from strings 3 3 | x = u"Hello" # UP025 4 4 | -error[UP025]: UP025.py:3:5: [*] Remove unicode literals from strings +error[UP025]: 3:5: [*] Remove unicode literals from strings + --> UP025.py:3:5 | 1 | u"Hello" 2 | @@ -37,8 +39,9 @@ error[UP025]: UP025.py:3:5: [*] Remove unicode literals from strings 5 5 | u'world' # UP025 6 6 | -error[UP025]: UP025.py:5:1: [*] Remove unicode literals from strings +error[UP025]: 5:1: [*] Remove unicode literals from strings + --> UP025.py:4:1 | 3 | x = u"Hello" # UP025 4 | @@ -58,8 +61,9 @@ error[UP025]: UP025.py:5:1: [*] Remove unicode literals from strings 7 7 | print(u"Hello") # UP025 8 8 | -error[UP025]: UP025.py:7:7: [*] Remove unicode literals from strings +error[UP025]: 7:7: [*] Remove unicode literals from strings + --> UP025.py:7:7 | 5 | u'world' # UP025 6 | @@ -79,8 +83,9 @@ error[UP025]: UP025.py:7:7: [*] Remove unicode literals from strings 9 9 | print(u'world') # UP025 10 10 | -error[UP025]: UP025.py:9:7: [*] Remove unicode literals from strings +error[UP025]: 9:7: [*] Remove unicode literals from strings + --> UP025.py:9:7 | 7 | print(u"Hello") # UP025 8 | @@ -100,8 +105,9 @@ error[UP025]: UP025.py:9:7: [*] Remove unicode literals from strings 11 11 | import foo 12 12 | -error[UP025]: UP025.py:13:5: [*] Remove unicode literals from strings +error[UP025]: 13:5: [*] Remove unicode literals from strings + --> UP025.py:13:5 | 11 | import foo 12 | @@ -121,8 +127,9 @@ error[UP025]: UP025.py:13:5: [*] Remove unicode literals from strings 15 15 | # Retain quotes when fixing. 16 16 | x = u'hello' # UP025 -error[UP025]: UP025.py:13:15: [*] Remove unicode literals from strings +error[UP025]: 13:15: [*] Remove unicode literals from strings + --> UP025.py:13:15 | 11 | import foo 12 | @@ -142,8 +149,9 @@ error[UP025]: UP025.py:13:15: [*] Remove unicode literals from strings 15 15 | # Retain quotes when fixing. 16 16 | x = u'hello' # UP025 -error[UP025]: UP025.py:13:27: [*] Remove unicode literals from strings +error[UP025]: 13:27: [*] Remove unicode literals from strings + --> UP025.py:13:27 | 11 | import foo 12 | @@ -163,8 +171,9 @@ error[UP025]: UP025.py:13:27: [*] Remove unicode literals from strings 15 15 | # Retain quotes when fixing. 16 16 | x = u'hello' # UP025 -error[UP025]: UP025.py:13:39: [*] Remove unicode literals from strings +error[UP025]: 13:39: [*] Remove unicode literals from strings + --> UP025.py:13:39 | 11 | import foo 12 | @@ -184,8 +193,9 @@ error[UP025]: UP025.py:13:39: [*] Remove unicode literals from strings 15 15 | # Retain quotes when fixing. 16 16 | x = u'hello' # UP025 -error[UP025]: UP025.py:16:5: [*] Remove unicode literals from strings +error[UP025]: 16:5: [*] Remove unicode literals from strings + --> UP025.py:16:5 | 15 | # Retain quotes when fixing. 16 | x = u'hello' # UP025 @@ -204,8 +214,9 @@ error[UP025]: UP025.py:16:5: [*] Remove unicode literals from strings 18 18 | x = u'''hello''' # UP025 19 19 | x = u'Hello "World"' # UP025 -error[UP025]: UP025.py:17:5: [*] Remove unicode literals from strings +error[UP025]: 17:5: [*] Remove unicode literals from strings + --> UP025.py:17:5 | 15 | # Retain quotes when fixing. 16 | x = u'hello' # UP025 @@ -225,8 +236,9 @@ error[UP025]: UP025.py:17:5: [*] Remove unicode literals from strings 19 19 | x = u'Hello "World"' # UP025 20 20 | -error[UP025]: UP025.py:18:5: [*] Remove unicode literals from strings +error[UP025]: 18:5: [*] Remove unicode literals from strings + --> UP025.py:18:5 | 16 | x = u'hello' # UP025 17 | x = u"""hello""" # UP025 @@ -245,8 +257,9 @@ error[UP025]: UP025.py:18:5: [*] Remove unicode literals from strings 20 20 | 21 21 | u = "Hello" # OK -error[UP025]: UP025.py:19:5: [*] Remove unicode literals from strings +error[UP025]: 19:5: [*] Remove unicode literals from strings + --> UP025.py:19:5 | 17 | x = u"""hello""" # UP025 18 | x = u'''hello''' # UP025 @@ -266,8 +279,9 @@ error[UP025]: UP025.py:19:5: [*] Remove unicode literals from strings 21 21 | u = "Hello" # OK 22 22 | u = u # OK -error[UP025]: UP025.py:27:7: [*] Remove unicode literals from strings +error[UP025]: 27:7: [*] Remove unicode literals from strings + --> UP025.py:27:7 | 25 | return"Hello" # OK 26 | @@ -284,8 +298,9 @@ error[UP025]: UP025.py:27:7: [*] Remove unicode literals from strings 27 |+f"foo""bar" # OK 28 28 | f"foo" u"bar" # OK -error[UP025]: UP025.py:28:8: [*] Remove unicode literals from strings +error[UP025]: 28:8: [*] Remove unicode literals from strings + --> UP025.py:28:8 | 27 | f"foo"u"bar" # OK 28 | f"foo" u"bar" # OK diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP026.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP026.py.snap index ab67aa12cb..66230438e0 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP026.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP026.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -error[UP026]: UP026.py:3:12: [*] `mock` is deprecated, use `unittest.mock` +error[UP026]: 3:12: [*] `mock` is deprecated, use `unittest.mock` + --> UP026.py:3:12 | 1 | # Error (`from unittest import mock`) 2 | if True: @@ -21,8 +22,9 @@ error[UP026]: UP026.py:3:12: [*] `mock` is deprecated, use `unittest.mock` 5 5 | # Error (`from unittest import mock`) 6 6 | if True: -error[UP026]: UP026.py:7:12: [*] `mock` is deprecated, use `unittest.mock` +error[UP026]: 7:12: [*] `mock` is deprecated, use `unittest.mock` + --> UP026.py:7:12 | 5 | # Error (`from unittest import mock`) 6 | if True: @@ -43,8 +45,9 @@ error[UP026]: UP026.py:7:12: [*] `mock` is deprecated, use `unittest.mock` 9 10 | # Error (`from unittest.mock import *`) 10 11 | if True: -error[UP026]: UP026.py:11:5: [*] `mock` is deprecated, use `unittest.mock` +error[UP026]: 11:5: [*] `mock` is deprecated, use `unittest.mock` + --> UP026.py:11:5 | 9 | # Error (`from unittest.mock import *`) 10 | if True: @@ -64,8 +67,9 @@ error[UP026]: UP026.py:11:5: [*] `mock` is deprecated, use `unittest.mock` 13 13 | # Error (`from unittest import mock`) 14 14 | import mock.mock -error[UP026]: UP026.py:14:8: [*] `mock` is deprecated, use `unittest.mock` +error[UP026]: 14:8: [*] `mock` is deprecated, use `unittest.mock` + --> UP026.py:14:8 | 13 | # Error (`from unittest import mock`) 14 | import mock.mock @@ -84,8 +88,9 @@ error[UP026]: UP026.py:14:8: [*] `mock` is deprecated, use `unittest.mock` 16 16 | # Error (`from unittest import mock`) 17 17 | import contextlib, mock, sys -error[UP026]: UP026.py:17:20: [*] `mock` is deprecated, use `unittest.mock` +error[UP026]: 17:20: [*] `mock` is deprecated, use `unittest.mock` + --> UP026.py:17:20 | 16 | # Error (`from unittest import mock`) 17 | import contextlib, mock, sys @@ -105,8 +110,9 @@ error[UP026]: UP026.py:17:20: [*] `mock` is deprecated, use `unittest.mock` 19 20 | # Error (`from unittest import mock`) 20 21 | import mock, sys -error[UP026]: UP026.py:20:8: [*] `mock` is deprecated, use `unittest.mock` +error[UP026]: 20:8: [*] `mock` is deprecated, use `unittest.mock` + --> UP026.py:20:8 | 19 | # Error (`from unittest import mock`) 20 | import mock, sys @@ -125,8 +131,9 @@ error[UP026]: UP026.py:20:8: [*] `mock` is deprecated, use `unittest.mock` 22 23 | 23 24 | # Error (`from unittest import mock`) -error[UP026]: UP026.py:24:1: [*] `mock` is deprecated, use `unittest.mock` +error[UP026]: 24:1: [*] `mock` is deprecated, use `unittest.mock` + --> UP026.py:23:38 | 23 | # Error (`from unittest import mock`) 24 | from mock import mock @@ -145,8 +152,9 @@ error[UP026]: UP026.py:24:1: [*] `mock` is deprecated, use `unittest.mock` 26 26 | # Error (keep trailing comma) 27 27 | from mock import ( -error[UP026]: UP026.py:27:1: [*] `mock` is deprecated, use `unittest.mock` +error[UP026]: 27:1: [*] `mock` is deprecated, use `unittest.mock` + --> UP026.py:26:30 | 26 | # Error (keep trailing comma) 27 | / from mock import ( @@ -176,8 +184,9 @@ error[UP026]: UP026.py:27:1: [*] `mock` is deprecated, use `unittest.mock` 34 34 | a, 35 35 | b, -error[UP026]: UP026.py:33:1: [*] `mock` is deprecated, use `unittest.mock` +error[UP026]: 33:1: [*] `mock` is deprecated, use `unittest.mock` + --> UP026.py:32:2 | 31 | c, 32 | ) @@ -208,8 +217,9 @@ error[UP026]: UP026.py:33:1: [*] `mock` is deprecated, use `unittest.mock` 40 40 | # Error (avoid trailing comma) 41 41 | from mock import ( -error[UP026]: UP026.py:41:1: [*] `mock` is deprecated, use `unittest.mock` +error[UP026]: 41:1: [*] `mock` is deprecated, use `unittest.mock` + --> UP026.py:40:31 | 40 | # Error (avoid trailing comma) 41 | / from mock import ( @@ -239,8 +249,9 @@ error[UP026]: UP026.py:41:1: [*] `mock` is deprecated, use `unittest.mock` 48 48 | a, 49 49 | b, -error[UP026]: UP026.py:47:1: [*] `mock` is deprecated, use `unittest.mock` +error[UP026]: 47:1: [*] `mock` is deprecated, use `unittest.mock` + --> UP026.py:46:2 | 45 | c 46 | ) @@ -272,8 +283,9 @@ error[UP026]: UP026.py:47:1: [*] `mock` is deprecated, use `unittest.mock` 54 54 | from mock import a, b, c, mock 55 55 | -error[UP026]: UP026.py:53:1: [*] `mock` is deprecated, use `unittest.mock` +error[UP026]: 53:1: [*] `mock` is deprecated, use `unittest.mock` + --> UP026.py:52:2 | 51 | mock 52 | ) @@ -293,8 +305,9 @@ error[UP026]: UP026.py:53:1: [*] `mock` is deprecated, use `unittest.mock` 55 56 | 56 57 | if True: -error[UP026]: UP026.py:54:1: [*] `mock` is deprecated, use `unittest.mock` +error[UP026]: 54:1: [*] `mock` is deprecated, use `unittest.mock` + --> UP026.py:53:31 | 52 | ) 53 | from mock import mock, a, b, c @@ -315,8 +328,9 @@ error[UP026]: UP026.py:54:1: [*] `mock` is deprecated, use `unittest.mock` 56 57 | if True: 57 58 | if False: -error[UP026]: UP026.py:58:9: [*] `mock` is deprecated, use `unittest.mock` +error[UP026]: 58:9: [*] `mock` is deprecated, use `unittest.mock` + --> UP026.py:58:9 | 56 | if True: 57 | if False: @@ -348,8 +362,9 @@ error[UP026]: UP026.py:58:9: [*] `mock` is deprecated, use `unittest.mock` 65 65 | # OK 66 66 | import os, io -error[UP026]: UP026.py:69:8: [*] `mock` is deprecated, use `unittest.mock` +error[UP026]: 69:8: [*] `mock` is deprecated, use `unittest.mock` + --> UP026.py:69:8 | 68 | # Error (`from unittest import mock`) 69 | import mock, mock @@ -369,8 +384,9 @@ error[UP026]: UP026.py:69:8: [*] `mock` is deprecated, use `unittest.mock` 71 72 | # Error (`from unittest import mock as foo`) 72 73 | import mock as foo -error[UP026]: UP026.py:69:14: [*] `mock` is deprecated, use `unittest.mock` +error[UP026]: 69:14: [*] `mock` is deprecated, use `unittest.mock` + --> UP026.py:69:14 | 68 | # Error (`from unittest import mock`) 69 | import mock, mock @@ -390,8 +406,9 @@ error[UP026]: UP026.py:69:14: [*] `mock` is deprecated, use `unittest.mock` 71 72 | # Error (`from unittest import mock as foo`) 72 73 | import mock as foo -error[UP026]: UP026.py:72:8: [*] `mock` is deprecated, use `unittest.mock` +error[UP026]: 72:8: [*] `mock` is deprecated, use `unittest.mock` + --> UP026.py:72:8 | 71 | # Error (`from unittest import mock as foo`) 72 | import mock as foo @@ -410,8 +427,9 @@ error[UP026]: UP026.py:72:8: [*] `mock` is deprecated, use `unittest.mock` 74 74 | # Error (`from unittest import mock as foo`) 75 75 | from mock import mock as foo -error[UP026]: UP026.py:75:1: [*] `mock` is deprecated, use `unittest.mock` +error[UP026]: 75:1: [*] `mock` is deprecated, use `unittest.mock` + --> UP026.py:74:45 | 74 | # Error (`from unittest import mock as foo`) 75 | from mock import mock as foo @@ -430,8 +448,9 @@ error[UP026]: UP026.py:75:1: [*] `mock` is deprecated, use `unittest.mock` 77 77 | if True: 78 78 | # This should yield multiple, aliased imports. -error[UP026]: UP026.py:79:12: [*] `mock` is deprecated, use `unittest.mock` +error[UP026]: 79:12: [*] `mock` is deprecated, use `unittest.mock` + --> UP026.py:79:12 | 77 | if True: 78 | # This should yield multiple, aliased imports. @@ -453,8 +472,9 @@ error[UP026]: UP026.py:79:12: [*] `mock` is deprecated, use `unittest.mock` 81 83 | # This should yield multiple, aliased imports, and preserve `os`. 82 84 | import mock as foo, mock as bar, mock, os -error[UP026]: UP026.py:79:25: [*] `mock` is deprecated, use `unittest.mock` +error[UP026]: 79:25: [*] `mock` is deprecated, use `unittest.mock` + --> UP026.py:79:25 | 77 | if True: 78 | # This should yield multiple, aliased imports. @@ -476,8 +496,9 @@ error[UP026]: UP026.py:79:25: [*] `mock` is deprecated, use `unittest.mock` 81 83 | # This should yield multiple, aliased imports, and preserve `os`. 82 84 | import mock as foo, mock as bar, mock, os -error[UP026]: UP026.py:79:38: [*] `mock` is deprecated, use `unittest.mock` +error[UP026]: 79:38: [*] `mock` is deprecated, use `unittest.mock` + --> UP026.py:79:38 | 77 | if True: 78 | # This should yield multiple, aliased imports. @@ -499,8 +520,9 @@ error[UP026]: UP026.py:79:38: [*] `mock` is deprecated, use `unittest.mock` 81 83 | # This should yield multiple, aliased imports, and preserve `os`. 82 84 | import mock as foo, mock as bar, mock, os -error[UP026]: UP026.py:82:12: [*] `mock` is deprecated, use `unittest.mock` +error[UP026]: 82:12: [*] `mock` is deprecated, use `unittest.mock` + --> UP026.py:82:12 | 81 | # This should yield multiple, aliased imports, and preserve `os`. 82 | import mock as foo, mock as bar, mock, os @@ -522,8 +544,9 @@ error[UP026]: UP026.py:82:12: [*] `mock` is deprecated, use `unittest.mock` 84 87 | if True: 85 88 | # This should yield multiple, aliased imports. -error[UP026]: UP026.py:82:25: [*] `mock` is deprecated, use `unittest.mock` +error[UP026]: 82:25: [*] `mock` is deprecated, use `unittest.mock` + --> UP026.py:82:25 | 81 | # This should yield multiple, aliased imports, and preserve `os`. 82 | import mock as foo, mock as bar, mock, os @@ -545,8 +568,9 @@ error[UP026]: UP026.py:82:25: [*] `mock` is deprecated, use `unittest.mock` 84 87 | if True: 85 88 | # This should yield multiple, aliased imports. -error[UP026]: UP026.py:82:38: [*] `mock` is deprecated, use `unittest.mock` +error[UP026]: 82:38: [*] `mock` is deprecated, use `unittest.mock` + --> UP026.py:82:38 | 81 | # This should yield multiple, aliased imports, and preserve `os`. 82 | import mock as foo, mock as bar, mock, os @@ -568,8 +592,9 @@ error[UP026]: UP026.py:82:38: [*] `mock` is deprecated, use `unittest.mock` 84 87 | if True: 85 88 | # This should yield multiple, aliased imports. -error[UP026]: UP026.py:86:5: [*] `mock` is deprecated, use `unittest.mock` +error[UP026]: 86:5: [*] `mock` is deprecated, use `unittest.mock` + --> UP026.py:86:5 | 84 | if True: 85 | # This should yield multiple, aliased imports. @@ -589,8 +614,9 @@ error[UP026]: UP026.py:86:5: [*] `mock` is deprecated, use `unittest.mock` 88 90 | 89 91 | # OK. -error[UP026]: UP026.py:93:5: [*] `mock` is deprecated, use `unittest.mock` +error[UP026]: 93:5: [*] `mock` is deprecated, use `unittest.mock` + --> UP026.py:93:5 | 92 | # Error (`mock.Mock()`). 93 | x = mock.mock.Mock() diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP027.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP027.py.snap index bd112fe3d6..66ff9b5054 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP027.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP027.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -error[UP027]: UP027.py:2:17: [*] Replace unpacked list comprehension with a generator expression +error[UP027]: 2:17: [*] Replace unpacked list comprehension with a generator expression + --> UP027.py:2:17 | 1 | # Should change 2 | foo, bar, baz = [fn(x) for x in items] @@ -19,8 +20,9 @@ error[UP027]: UP027.py:2:17: [*] Replace unpacked list comprehension with a gene 4 4 | foo, bar, baz =[fn(x) for x in items] 5 5 | -error[UP027]: UP027.py:4:16: [*] Replace unpacked list comprehension with a generator expression +error[UP027]: 4:16: [*] Replace unpacked list comprehension with a generator expression + --> UP027.py:4:16 | 2 | foo, bar, baz = [fn(x) for x in items] 3 | @@ -40,8 +42,9 @@ error[UP027]: UP027.py:4:16: [*] Replace unpacked list comprehension with a gene 6 6 | foo, bar, baz = [fn(x) for x in items] 7 7 | -error[UP027]: UP027.py:6:26: [*] Replace unpacked list comprehension with a generator expression +error[UP027]: 6:26: [*] Replace unpacked list comprehension with a generator expression + --> UP027.py:6:26 | 4 | foo, bar, baz =[fn(x) for x in items] 5 | @@ -61,8 +64,9 @@ error[UP027]: UP027.py:6:26: [*] Replace unpacked list comprehension with a gene 8 8 | foo, bar, baz = [[i for i in fn(x)] for x in items] 9 9 | -error[UP027]: UP027.py:8:17: [*] Replace unpacked list comprehension with a generator expression +error[UP027]: 8:17: [*] Replace unpacked list comprehension with a generator expression + --> UP027.py:8:17 | 6 | foo, bar, baz = [fn(x) for x in items] 7 | @@ -82,8 +86,9 @@ error[UP027]: UP027.py:8:17: [*] Replace unpacked list comprehension with a gene 10 10 | foo, bar, baz = [ 11 11 | fn(x) -error[UP027]: UP027.py:10:17: [*] Replace unpacked list comprehension with a generator expression +error[UP027]: 10:17: [*] Replace unpacked list comprehension with a generator expression + --> UP027.py:10:17 | 8 | foo, bar, baz = [[i for i in fn(x)] for x in items] 9 | diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP028_0.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP028_0.py.snap index 30f0d54fc6..c86264cb56 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP028_0.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP028_0.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -error[UP028]: UP028_0.py:2:5: [*] Replace `yield` over `for` loop with `yield from` +error[UP028]: 2:5: [*] Replace `yield` over `for` loop with `yield from` + --> UP028_0.py:2:5 | 1 | def f(): 2 | for x in y: @@ -20,8 +21,9 @@ error[UP028]: UP028_0.py:2:5: [*] Replace `yield` over `for` loop with `yield fr 5 4 | 6 5 | def g(): -error[UP028]: UP028_0.py:7:5: [*] Replace `yield` over `for` loop with `yield from` +error[UP028]: 7:5: [*] Replace `yield` over `for` loop with `yield from` + --> UP028_0.py:7:5 | 6 | def g(): 7 | for x, y in z: @@ -41,8 +43,9 @@ error[UP028]: UP028_0.py:7:5: [*] Replace `yield` over `for` loop with `yield fr 10 9 | 11 10 | def h(): -error[UP028]: UP028_0.py:12:5: [*] Replace `yield` over `for` loop with `yield from` +error[UP028]: 12:5: [*] Replace `yield` over `for` loop with `yield from` + --> UP028_0.py:12:5 | 11 | def h(): 12 | for x in [1, 2, 3]: @@ -62,8 +65,9 @@ error[UP028]: UP028_0.py:12:5: [*] Replace `yield` over `for` loop with `yield f 15 14 | 16 15 | def i(): -error[UP028]: UP028_0.py:17:5: [*] Replace `yield` over `for` loop with `yield from` +error[UP028]: 17:5: [*] Replace `yield` over `for` loop with `yield from` + --> UP028_0.py:17:5 | 16 | def i(): 17 | for x in {x for x in y}: @@ -83,8 +87,9 @@ error[UP028]: UP028_0.py:17:5: [*] Replace `yield` over `for` loop with `yield f 20 19 | 21 20 | def j(): -error[UP028]: UP028_0.py:22:5: [*] Replace `yield` over `for` loop with `yield from` +error[UP028]: 22:5: [*] Replace `yield` over `for` loop with `yield from` + --> UP028_0.py:22:5 | 21 | def j(): 22 | for x in (1, 2, 3): @@ -104,8 +109,9 @@ error[UP028]: UP028_0.py:22:5: [*] Replace `yield` over `for` loop with `yield f 25 24 | 26 25 | def k(): -error[UP028]: UP028_0.py:27:5: [*] Replace `yield` over `for` loop with `yield from` +error[UP028]: 27:5: [*] Replace `yield` over `for` loop with `yield from` + --> UP028_0.py:27:5 | 26 | def k(): 27 | for x, y in {3: "x", 6: "y"}: @@ -125,8 +131,9 @@ error[UP028]: UP028_0.py:27:5: [*] Replace `yield` over `for` loop with `yield f 30 29 | 31 30 | def f(): # Comment one\n' -error[UP028]: UP028_0.py:33:5: [*] Replace `yield` over `for` loop with `yield from` +error[UP028]: 33:5: [*] Replace `yield` over `for` loop with `yield from` + --> UP028_0.py:33:5 | 31 | def f(): # Comment one\n' 32 | # Comment two\n' @@ -159,8 +166,9 @@ error[UP028]: UP028_0.py:33:5: [*] Replace `yield` over `for` loop with `yield f 41 39 | 42 40 | -error[UP028]: UP028_0.py:44:5: [*] Replace `yield` over `for` loop with `yield from` +error[UP028]: 44:5: [*] Replace `yield` over `for` loop with `yield from` + --> UP028_0.py:44:5 | 43 | def f(): 44 | for x, y in [{3: (3, [44, "long ss"]), 6: "y"}]: @@ -180,8 +188,9 @@ error[UP028]: UP028_0.py:44:5: [*] Replace `yield` over `for` loop with `yield f 47 46 | 48 47 | def f(): -error[UP028]: UP028_0.py:49:5: [*] Replace `yield` over `for` loop with `yield from` +error[UP028]: 49:5: [*] Replace `yield` over `for` loop with `yield from` + --> UP028_0.py:49:5 | 48 | def f(): 49 | for x, y in z(): @@ -203,8 +212,9 @@ error[UP028]: UP028_0.py:49:5: [*] Replace `yield` over `for` loop with `yield f 52 51 | def f(): 53 52 | def func(): -error[UP028]: UP028_0.py:55:9: [*] Replace `yield` over `for` loop with `yield from` +error[UP028]: 55:9: [*] Replace `yield` over `for` loop with `yield from` + --> UP028_0.py:55:9 | 53 | def func(): 54 | # This comment is preserved\n' @@ -229,8 +239,9 @@ error[UP028]: UP028_0.py:55:9: [*] Replace `yield` over `for` loop with `yield f 59 57 | # Comment\n' 60 58 | def g(): -error[UP028]: UP028_0.py:67:5: [*] Replace `yield` over `for` loop with `yield from` +error[UP028]: 67:5: [*] Replace `yield` over `for` loop with `yield from` + --> UP028_0.py:67:5 | 65 | for x in y: 66 | yield x @@ -251,8 +262,9 @@ error[UP028]: UP028_0.py:67:5: [*] Replace `yield` over `for` loop with `yield f 70 69 | 71 70 | def f(): -error[UP028]: UP028_0.py:72:5: [*] Replace `yield` over `for` loop with `yield from` +error[UP028]: 72:5: [*] Replace `yield` over `for` loop with `yield from` + --> UP028_0.py:72:5 | 71 | def f(): 72 | for x, y in z(): @@ -273,8 +285,9 @@ error[UP028]: UP028_0.py:72:5: [*] Replace `yield` over `for` loop with `yield f 75 74 | 76 75 | -error[UP028]: UP028_0.py:79:5: [*] Replace `yield` over `for` loop with `yield from` +error[UP028]: 79:5: [*] Replace `yield` over `for` loop with `yield from` + --> UP028_0.py:79:5 | 77 | # Regression test for: https://github.com/astral-sh/ruff/issues/7103 78 | def _serve_method(fn): diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP029.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP029.py.snap index 92c35ac09f..f44aa92127 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP029.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP029.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -error[UP029]: UP029.py:1:1: [*] Unnecessary builtin import: `*` +error[UP029]: 1:1: [*] Unnecessary builtin import: `*` + --> UP029.py:1:1 | 1 | from builtins import * | ^^^^^^^^^^^^^^^^^^^^^^ @@ -16,8 +17,9 @@ error[UP029]: UP029.py:1:1: [*] Unnecessary builtin import: `*` 3 2 | from builtins import str as _str 4 3 | from six.moves import filter, zip, zip_longest -error[UP029]: UP029.py:2:1: [*] Unnecessary builtin imports: `ascii`, `bytes` +error[UP029]: 2:1: [*] Unnecessary builtin imports: `ascii`, `bytes` + --> UP029.py:1:23 | 1 | from builtins import * 2 | from builtins import ascii, bytes, compile @@ -34,8 +36,9 @@ error[UP029]: UP029.py:2:1: [*] Unnecessary builtin imports: `ascii`, `bytes` 4 4 | from six.moves import filter, zip, zip_longest 5 5 | from io import open -error[UP029]: UP029.py:4:1: [*] Unnecessary builtin imports: `filter`, `zip` +error[UP029]: 4:1: [*] Unnecessary builtin imports: `filter`, `zip` + --> UP029.py:3:33 | 2 | from builtins import ascii, bytes, compile 3 | from builtins import str as _str @@ -55,8 +58,9 @@ error[UP029]: UP029.py:4:1: [*] Unnecessary builtin imports: `filter`, `zip` 6 6 | import io 7 7 | import six -error[UP029]: UP029.py:5:1: [*] Unnecessary builtin import: `open` +error[UP029]: 5:1: [*] Unnecessary builtin import: `open` + --> UP029.py:4:47 | 3 | from builtins import str as _str 4 | from six.moves import filter, zip, zip_longest diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP030_0.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP030_0.py.snap index 02da04b084..0bd7229568 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP030_0.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP030_0.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -error[UP030]: UP030_0.py:3:1: [*] Use implicit references for positional format fields +error[UP030]: 3:1: [*] Use implicit references for positional format fields + --> UP030_0.py:2:1 | 1 | # Invalid calls; errors expected. 2 | @@ -21,8 +22,9 @@ error[UP030]: UP030_0.py:3:1: [*] Use implicit references for positional format 5 5 | "a {3} complicated {1} string with {0} {2}".format( 6 6 | "first", "second", "third", "fourth" -error[UP030]: UP030_0.py:5:1: [*] Use implicit references for positional format fields +error[UP030]: 5:1: [*] Use implicit references for positional format fields + --> UP030_0.py:4:1 | 3 | "{0}" "{1}" "{2}".format(1, 2, 3) 4 | @@ -46,8 +48,9 @@ error[UP030]: UP030_0.py:5:1: [*] Use implicit references for positional format 8 8 | 9 9 | '{0}'.format(1) -error[UP030]: UP030_0.py:9:1: [*] Use implicit references for positional format fields +error[UP030]: 9:1: [*] Use implicit references for positional format fields + --> UP030_0.py:8:1 | 7 | ) 8 | @@ -67,8 +70,9 @@ error[UP030]: UP030_0.py:9:1: [*] Use implicit references for positional format 11 11 | '{0:x}'.format(30) 12 12 | -error[UP030]: UP030_0.py:11:1: [*] Use implicit references for positional format fields +error[UP030]: 11:1: [*] Use implicit references for positional format fields + --> UP030_0.py:10:1 | 9 | '{0}'.format(1) 10 | @@ -88,8 +92,9 @@ error[UP030]: UP030_0.py:11:1: [*] Use implicit references for positional format 13 13 | x = '{0}'.format(1) 14 14 | -error[UP030]: UP030_0.py:13:5: [*] Use implicit references for positional format fields +error[UP030]: 13:5: [*] Use implicit references for positional format fields + --> UP030_0.py:13:5 | 11 | '{0:x}'.format(30) 12 | @@ -109,8 +114,9 @@ error[UP030]: UP030_0.py:13:5: [*] Use implicit references for positional format 15 15 | '''{0}\n{1}\n'''.format(1, 2) 16 16 | -error[UP030]: UP030_0.py:15:1: [*] Use implicit references for positional format fields +error[UP030]: 15:1: [*] Use implicit references for positional format fields + --> UP030_0.py:14:1 | 13 | x = '{0}'.format(1) 14 | @@ -130,8 +136,9 @@ error[UP030]: UP030_0.py:15:1: [*] Use implicit references for positional format 17 17 | x = "foo {0}" \ 18 18 | "bar {1}".format(1, 2) -error[UP030]: UP030_0.py:17:5: [*] Use implicit references for positional format fields +error[UP030]: 17:5: [*] Use implicit references for positional format fields + --> UP030_0.py:17:5 | 15 | '''{0}\n{1}\n'''.format(1, 2) 16 | @@ -155,8 +162,9 @@ error[UP030]: UP030_0.py:17:5: [*] Use implicit references for positional format 20 20 | ("{0}").format(1) 21 21 | -error[UP030]: UP030_0.py:20:1: [*] Use implicit references for positional format fields +error[UP030]: 20:1: [*] Use implicit references for positional format fields + --> UP030_0.py:19:1 | 18 | "bar {1}".format(1, 2) 19 | @@ -176,8 +184,9 @@ error[UP030]: UP030_0.py:20:1: [*] Use implicit references for positional format 22 22 | "\N{snowman} {0}".format(1) 23 23 | -error[UP030]: UP030_0.py:22:1: [*] Use implicit references for positional format fields +error[UP030]: 22:1: [*] Use implicit references for positional format fields + --> UP030_0.py:21:1 | 20 | ("{0}").format(1) 21 | @@ -197,8 +206,9 @@ error[UP030]: UP030_0.py:22:1: [*] Use implicit references for positional format 24 24 | print( 25 25 | 'foo{0}' -error[UP030]: UP030_0.py:25:5: [*] Use implicit references for positional format fields +error[UP030]: 25:5: [*] Use implicit references for positional format fields + --> UP030_0.py:25:5 | 24 | print( 25 | 'foo{0}' @@ -220,8 +230,9 @@ error[UP030]: UP030_0.py:25:5: [*] Use implicit references for positional format 28 28 | 29 29 | print( -error[UP030]: UP030_0.py:30:5: [*] Use implicit references for positional format fields +error[UP030]: 30:5: [*] Use implicit references for positional format fields + --> UP030_0.py:30:5 | 29 | print( 30 | 'foo{0}' # ohai\n" @@ -243,8 +254,9 @@ error[UP030]: UP030_0.py:30:5: [*] Use implicit references for positional format 33 33 | 34 34 | '{' '0}'.format(1) -error[UP030]: UP030_0.py:34:1: Use implicit references for positional format fields +error[UP030]: 34:1: Use implicit references for positional format fields + --> UP030_0.py:33:1 | 32 | ) 33 | @@ -254,8 +266,9 @@ error[UP030]: UP030_0.py:34:1: Use implicit references for positional format fie 36 | args = list(range(10)) | = help: Remove explicit positional indices -error[UP030]: UP030_0.py:39:1: [*] Use implicit references for positional format fields +error[UP030]: 39:1: [*] Use implicit references for positional format fields + --> UP030_0.py:38:1 | 37 | kwargs = {x: x for x in range(10)} 38 | @@ -275,8 +288,9 @@ error[UP030]: UP030_0.py:39:1: [*] Use implicit references for positional format 41 41 | "{0}".format(**kwargs) 42 42 | -error[UP030]: UP030_0.py:41:1: [*] Use implicit references for positional format fields +error[UP030]: 41:1: [*] Use implicit references for positional format fields + --> UP030_0.py:40:1 | 39 | "{0}".format(*args) 40 | @@ -296,8 +310,9 @@ error[UP030]: UP030_0.py:41:1: [*] Use implicit references for positional format 43 43 | "{0}_{1}".format(*args) 44 44 | -error[UP030]: UP030_0.py:43:1: [*] Use implicit references for positional format fields +error[UP030]: 43:1: [*] Use implicit references for positional format fields + --> UP030_0.py:42:1 | 41 | "{0}".format(**kwargs) 42 | @@ -317,8 +332,9 @@ error[UP030]: UP030_0.py:43:1: [*] Use implicit references for positional format 45 45 | "{0}_{1}".format(1, *args) 46 46 | -error[UP030]: UP030_0.py:45:1: [*] Use implicit references for positional format fields +error[UP030]: 45:1: [*] Use implicit references for positional format fields + --> UP030_0.py:44:1 | 43 | "{0}_{1}".format(*args) 44 | @@ -338,8 +354,9 @@ error[UP030]: UP030_0.py:45:1: [*] Use implicit references for positional format 47 47 | "{0}_{1}".format(1, 2, *args) 48 48 | -error[UP030]: UP030_0.py:47:1: [*] Use implicit references for positional format fields +error[UP030]: 47:1: [*] Use implicit references for positional format fields + --> UP030_0.py:46:1 | 45 | "{0}_{1}".format(1, *args) 46 | @@ -359,8 +376,9 @@ error[UP030]: UP030_0.py:47:1: [*] Use implicit references for positional format 49 49 | "{0}_{1}".format(*args, 1, 2) 50 50 | -error[UP030]: UP030_0.py:49:1: [*] Use implicit references for positional format fields +error[UP030]: 49:1: [*] Use implicit references for positional format fields + --> UP030_0.py:48:1 | 47 | "{0}_{1}".format(1, 2, *args) 48 | @@ -380,8 +398,9 @@ error[UP030]: UP030_0.py:49:1: [*] Use implicit references for positional format 51 51 | "{0}_{1}_{2}".format(1, **kwargs) 52 52 | -error[UP030]: UP030_0.py:51:1: [*] Use implicit references for positional format fields +error[UP030]: 51:1: [*] Use implicit references for positional format fields + --> UP030_0.py:50:1 | 49 | "{0}_{1}".format(*args, 1, 2) 50 | @@ -401,8 +420,9 @@ error[UP030]: UP030_0.py:51:1: [*] Use implicit references for positional format 53 53 | "{0}_{1}_{2}".format(1, 2, **kwargs) 54 54 | -error[UP030]: UP030_0.py:53:1: [*] Use implicit references for positional format fields +error[UP030]: 53:1: [*] Use implicit references for positional format fields + --> UP030_0.py:52:1 | 51 | "{0}_{1}_{2}".format(1, **kwargs) 52 | @@ -422,8 +442,9 @@ error[UP030]: UP030_0.py:53:1: [*] Use implicit references for positional format 55 55 | "{0}_{1}_{2}".format(1, 2, 3, **kwargs) 56 56 | -error[UP030]: UP030_0.py:55:1: [*] Use implicit references for positional format fields +error[UP030]: 55:1: [*] Use implicit references for positional format fields + --> UP030_0.py:54:1 | 53 | "{0}_{1}_{2}".format(1, 2, **kwargs) 54 | @@ -443,8 +464,9 @@ error[UP030]: UP030_0.py:55:1: [*] Use implicit references for positional format 57 57 | "{0}_{1}_{2}".format(1, 2, 3, *args, **kwargs) 58 58 | -error[UP030]: UP030_0.py:57:1: [*] Use implicit references for positional format fields +error[UP030]: 57:1: [*] Use implicit references for positional format fields + --> UP030_0.py:56:1 | 55 | "{0}_{1}_{2}".format(1, 2, 3, **kwargs) 56 | @@ -464,8 +486,9 @@ error[UP030]: UP030_0.py:57:1: [*] Use implicit references for positional format 59 59 | "{1}_{0}".format(1, 2, *args) 60 60 | -error[UP030]: UP030_0.py:59:1: [*] Use implicit references for positional format fields +error[UP030]: 59:1: [*] Use implicit references for positional format fields + --> UP030_0.py:58:1 | 57 | "{0}_{1}_{2}".format(1, 2, 3, *args, **kwargs) 58 | @@ -484,8 +507,9 @@ error[UP030]: UP030_0.py:59:1: [*] Use implicit references for positional format 60 60 | 61 61 | "{1}_{0}".format(1, 2) -error[UP030]: UP030_0.py:61:1: [*] Use implicit references for positional format fields +error[UP030]: 61:1: [*] Use implicit references for positional format fields + --> UP030_0.py:60:1 | 59 | "{1}_{0}".format(1, 2, *args) 60 | diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP031_0.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP031_0.py.snap index 2b72d13959..823d862d45 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP031_0.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP031_0.py.snap @@ -1,16 +1,17 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -UP031_0.py:4:7: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 4:7: [*] Use format specifiers instead of percent format + + --> UP031_0.py:4:7 | 3 | # UP031 4 | print('%s %s' % (a, b)) - | ^^^^^^^^^^^^^^^^ UP031 + | ^^^^^^^^^^^^^^^^ 5 | 6 | print('%s%s' % (a, b)) | = help: Replace with format specifiers - ℹ Unsafe fix 1 1 | a, b, x, y = 1, 2, 3, 4 2 2 | @@ -21,17 +22,18 @@ UP031_0.py:4:7: UP031 [*] Use format specifiers instead of percent format 6 6 | print('%s%s' % (a, b)) 7 7 | -UP031_0.py:6:7: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 6:7: [*] Use format specifiers instead of percent format + + --> UP031_0.py:6:7 | 4 | print('%s %s' % (a, b)) 5 | 6 | print('%s%s' % (a, b)) - | ^^^^^^^^^^^^^^^ UP031 + | ^^^^^^^^^^^^^^^ 7 | 8 | print("trivial" % ()) | = help: Replace with format specifiers - ℹ Unsafe fix 3 3 | # UP031 4 4 | print('%s %s' % (a, b)) @@ -42,17 +44,18 @@ UP031_0.py:6:7: UP031 [*] Use format specifiers instead of percent format 8 8 | print("trivial" % ()) 9 9 | -UP031_0.py:8:7: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 8:7: [*] Use format specifiers instead of percent format + + --> UP031_0.py:8:7 | 6 | print('%s%s' % (a, b)) 7 | 8 | print("trivial" % ()) - | ^^^^^^^^^^^^^^ UP031 + | ^^^^^^^^^^^^^^ 9 | 10 | print("%s" % ("simple",)) | = help: Replace with format specifiers - ℹ Unsafe fix 5 5 | 6 6 | print('%s%s' % (a, b)) @@ -63,17 +66,18 @@ UP031_0.py:8:7: UP031 [*] Use format specifiers instead of percent format 10 10 | print("%s" % ("simple",)) 11 11 | -UP031_0.py:10:7: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 10:7: [*] Use format specifiers instead of percent format + + --> UP031_0.py:10:7 | 8 | print("trivial" % ()) 9 | 10 | print("%s" % ("simple",)) - | ^^^^^^^^^^^^^^^^^^ UP031 + | ^^^^^^^^^^^^^^^^^^ 11 | 12 | print("%s" % ("%s" % ("nested",),)) | = help: Replace with format specifiers - ℹ Unsafe fix 7 7 | 8 8 | print("trivial" % ()) @@ -84,17 +88,18 @@ UP031_0.py:10:7: UP031 [*] Use format specifiers instead of percent format 12 12 | print("%s" % ("%s" % ("nested",),)) 13 13 | -UP031_0.py:12:7: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 12:7: [*] Use format specifiers instead of percent format + + --> UP031_0.py:12:7 | 10 | print("%s" % ("simple",)) 11 | 12 | print("%s" % ("%s" % ("nested",),)) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP031 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 13 | 14 | print("%s%% percent" % (15,)) | = help: Replace with format specifiers - ℹ Unsafe fix 9 9 | 10 10 | print("%s" % ("simple",)) @@ -105,17 +110,18 @@ UP031_0.py:12:7: UP031 [*] Use format specifiers instead of percent format 14 14 | print("%s%% percent" % (15,)) 15 15 | -UP031_0.py:12:15: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 12:15: [*] Use format specifiers instead of percent format + + --> UP031_0.py:12:15 | 10 | print("%s" % ("simple",)) 11 | 12 | print("%s" % ("%s" % ("nested",),)) - | ^^^^^^^^^^^^^^^^^^ UP031 + | ^^^^^^^^^^^^^^^^^^ 13 | 14 | print("%s%% percent" % (15,)) | = help: Replace with format specifiers - ℹ Unsafe fix 9 9 | 10 10 | print("%s" % ("simple",)) @@ -126,17 +132,18 @@ UP031_0.py:12:15: UP031 [*] Use format specifiers instead of percent format 14 14 | print("%s%% percent" % (15,)) 15 15 | -UP031_0.py:14:7: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 14:7: [*] Use format specifiers instead of percent format + + --> UP031_0.py:14:7 | 12 | print("%s" % ("%s" % ("nested",),)) 13 | 14 | print("%s%% percent" % (15,)) - | ^^^^^^^^^^^^^^^^^^^^^^ UP031 + | ^^^^^^^^^^^^^^^^^^^^^^ 15 | 16 | print("%f" % (15,)) | = help: Replace with format specifiers - ℹ Unsafe fix 11 11 | 12 12 | print("%s" % ("%s" % ("nested",),)) @@ -147,17 +154,18 @@ UP031_0.py:14:7: UP031 [*] Use format specifiers instead of percent format 16 16 | print("%f" % (15,)) 17 17 | -UP031_0.py:16:7: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 16:7: [*] Use format specifiers instead of percent format + + --> UP031_0.py:16:7 | 14 | print("%s%% percent" % (15,)) 15 | 16 | print("%f" % (15,)) - | ^^^^^^^^^^^^ UP031 + | ^^^^^^^^^^^^ 17 | 18 | print("%.f" % (15,)) | = help: Replace with format specifiers - ℹ Unsafe fix 13 13 | 14 14 | print("%s%% percent" % (15,)) @@ -168,17 +176,18 @@ UP031_0.py:16:7: UP031 [*] Use format specifiers instead of percent format 18 18 | print("%.f" % (15,)) 19 19 | -UP031_0.py:18:7: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 18:7: [*] Use format specifiers instead of percent format + + --> UP031_0.py:18:7 | 16 | print("%f" % (15,)) 17 | 18 | print("%.f" % (15,)) - | ^^^^^^^^^^^^^ UP031 + | ^^^^^^^^^^^^^ 19 | 20 | print("%.3f" % (15,)) | = help: Replace with format specifiers - ℹ Unsafe fix 15 15 | 16 16 | print("%f" % (15,)) @@ -189,17 +198,18 @@ UP031_0.py:18:7: UP031 [*] Use format specifiers instead of percent format 20 20 | print("%.3f" % (15,)) 21 21 | -UP031_0.py:20:7: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 20:7: [*] Use format specifiers instead of percent format + + --> UP031_0.py:20:7 | 18 | print("%.f" % (15,)) 19 | 20 | print("%.3f" % (15,)) - | ^^^^^^^^^^^^^^ UP031 + | ^^^^^^^^^^^^^^ 21 | 22 | print("%3f" % (15,)) | = help: Replace with format specifiers - ℹ Unsafe fix 17 17 | 18 18 | print("%.f" % (15,)) @@ -210,17 +220,18 @@ UP031_0.py:20:7: UP031 [*] Use format specifiers instead of percent format 22 22 | print("%3f" % (15,)) 23 23 | -UP031_0.py:22:7: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 22:7: [*] Use format specifiers instead of percent format + + --> UP031_0.py:22:7 | 20 | print("%.3f" % (15,)) 21 | 22 | print("%3f" % (15,)) - | ^^^^^^^^^^^^^ UP031 + | ^^^^^^^^^^^^^ 23 | 24 | print("%-5f" % (5,)) | = help: Replace with format specifiers - ℹ Unsafe fix 19 19 | 20 20 | print("%.3f" % (15,)) @@ -231,17 +242,18 @@ UP031_0.py:22:7: UP031 [*] Use format specifiers instead of percent format 24 24 | print("%-5f" % (5,)) 25 25 | -UP031_0.py:24:7: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 24:7: [*] Use format specifiers instead of percent format + + --> UP031_0.py:24:7 | 22 | print("%3f" % (15,)) 23 | 24 | print("%-5f" % (5,)) - | ^^^^^^^^^^^^^ UP031 + | ^^^^^^^^^^^^^ 25 | 26 | print("%9f" % (5,)) | = help: Replace with format specifiers - ℹ Unsafe fix 21 21 | 22 22 | print("%3f" % (15,)) @@ -252,17 +264,18 @@ UP031_0.py:24:7: UP031 [*] Use format specifiers instead of percent format 26 26 | print("%9f" % (5,)) 27 27 | -UP031_0.py:26:7: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 26:7: [*] Use format specifiers instead of percent format + + --> UP031_0.py:26:7 | 24 | print("%-5f" % (5,)) 25 | 26 | print("%9f" % (5,)) - | ^^^^^^^^^^^^ UP031 + | ^^^^^^^^^^^^ 27 | 28 | print("%#o" % (123,)) | = help: Replace with format specifiers - ℹ Unsafe fix 23 23 | 24 24 | print("%-5f" % (5,)) @@ -273,17 +286,18 @@ UP031_0.py:26:7: UP031 [*] Use format specifiers instead of percent format 28 28 | print("%#o" % (123,)) 29 29 | -UP031_0.py:28:7: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 28:7: [*] Use format specifiers instead of percent format + + --> UP031_0.py:28:7 | 26 | print("%9f" % (5,)) 27 | 28 | print("%#o" % (123,)) - | ^^^^^^^^^^^^^^ UP031 + | ^^^^^^^^^^^^^^ 29 | 30 | print("brace {} %s" % (1,)) | = help: Replace with format specifiers - ℹ Unsafe fix 25 25 | 26 26 | print("%9f" % (5,)) @@ -294,17 +308,18 @@ UP031_0.py:28:7: UP031 [*] Use format specifiers instead of percent format 30 30 | print("brace {} %s" % (1,)) 31 31 | -UP031_0.py:30:7: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 30:7: [*] Use format specifiers instead of percent format + + --> UP031_0.py:30:7 | 28 | print("%#o" % (123,)) 29 | 30 | print("brace {} %s" % (1,)) - | ^^^^^^^^^^^^^^^^^^^^ UP031 + | ^^^^^^^^^^^^^^^^^^^^ 31 | 32 | print(( | = help: Replace with format specifiers - ℹ Unsafe fix 27 27 | 28 28 | print("%#o" % (123,)) @@ -315,17 +330,18 @@ UP031_0.py:30:7: UP031 [*] Use format specifiers instead of percent format 32 32 | print(( 33 33 | "foo %s " -UP031_0.py:33:5: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 33:5: [*] Use format specifiers instead of percent format + + --> UP031_0.py:33:5 | 32 | print(( 33 | "foo %s " | _____^ 34 | | "bar %s" % (x, y) - | |_____________________^ UP031 + | |_____________________^ 35 | )) | = help: Replace with format specifiers - ℹ Unsafe fix 30 30 | print("brace {} %s" % (1,)) 31 31 | @@ -338,18 +354,19 @@ UP031_0.py:33:5: UP031 [*] Use format specifiers instead of percent format 36 36 | 37 37 | print( -UP031_0.py:38:3: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 38:3: [*] Use format specifiers instead of percent format + + --> UP031_0.py:38:3 | 37 | print( 38 | "%s" % ( | ___^ 39 | | "trailing comma", 40 | | ) - | |_________^ UP031 + | |_________^ 41 | ) | = help: Replace with format specifiers - ℹ Unsafe fix 35 35 | )) 36 36 | @@ -360,17 +377,18 @@ UP031_0.py:38:3: UP031 [*] Use format specifiers instead of percent format 40 40 | ) 41 41 | ) -UP031_0.py:43:7: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 43:7: [*] Use format specifiers instead of percent format + + --> UP031_0.py:43:7 | 41 | ) 42 | 43 | print("foo %s " % (x,)) - | ^^^^^^^^^^^^^^^^ UP031 + | ^^^^^^^^^^^^^^^^ 44 | 45 | print("%(k)s" % {"k": "v"}) | = help: Replace with format specifiers - ℹ Unsafe fix 40 40 | ) 41 41 | ) @@ -381,17 +399,18 @@ UP031_0.py:43:7: UP031 [*] Use format specifiers instead of percent format 45 45 | print("%(k)s" % {"k": "v"}) 46 46 | -UP031_0.py:45:7: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 45:7: [*] Use format specifiers instead of percent format + + --> UP031_0.py:45:7 | 43 | print("foo %s " % (x,)) 44 | 45 | print("%(k)s" % {"k": "v"}) - | ^^^^^^^^^^^^^^^^^^^^ UP031 + | ^^^^^^^^^^^^^^^^^^^^ 46 | 47 | print("%(k)s" % { | = help: Replace with format specifiers - ℹ Unsafe fix 42 42 | 43 43 | print("foo %s " % (x,)) @@ -402,7 +421,9 @@ UP031_0.py:45:7: UP031 [*] Use format specifiers instead of percent format 47 47 | print("%(k)s" % { 48 48 | "k": "v", -UP031_0.py:47:7: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 47:7: [*] Use format specifiers instead of percent format + + --> UP031_0.py:47:7 | 45 | print("%(k)s" % {"k": "v"}) 46 | @@ -411,12 +432,11 @@ UP031_0.py:47:7: UP031 [*] Use format specifiers instead of percent format 48 | | "k": "v", 49 | | "i": "j" 50 | | }) - | |_^ UP031 + | |_^ 51 | 52 | print("%(to_list)s" % {"to_list": []}) | = help: Replace with format specifiers - ℹ Unsafe fix 44 44 | 45 45 | print("%(k)s" % {"k": "v"}) @@ -433,17 +453,18 @@ UP031_0.py:47:7: UP031 [*] Use format specifiers instead of percent format 52 52 | print("%(to_list)s" % {"to_list": []}) 53 53 | -UP031_0.py:52:7: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 52:7: [*] Use format specifiers instead of percent format + + --> UP031_0.py:52:7 | 50 | }) 51 | 52 | print("%(to_list)s" % {"to_list": []}) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP031 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 53 | 54 | print("%(k)s" % {"k": "v", "i": 1, "j": []}) | = help: Replace with format specifiers - ℹ Unsafe fix 49 49 | "i": "j" 50 50 | }) @@ -454,17 +475,18 @@ UP031_0.py:52:7: UP031 [*] Use format specifiers instead of percent format 54 54 | print("%(k)s" % {"k": "v", "i": 1, "j": []}) 55 55 | -UP031_0.py:54:7: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 54:7: [*] Use format specifiers instead of percent format + + --> UP031_0.py:54:7 | 52 | print("%(to_list)s" % {"to_list": []}) 53 | 54 | print("%(k)s" % {"k": "v", "i": 1, "j": []}) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP031 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 55 | 56 | print("%(ab)s" % {"a" "b": 1}) | = help: Replace with format specifiers - ℹ Unsafe fix 51 51 | 52 52 | print("%(to_list)s" % {"to_list": []}) @@ -475,17 +497,18 @@ UP031_0.py:54:7: UP031 [*] Use format specifiers instead of percent format 56 56 | print("%(ab)s" % {"a" "b": 1}) 57 57 | -UP031_0.py:56:7: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 56:7: [*] Use format specifiers instead of percent format + + --> UP031_0.py:56:7 | 54 | print("%(k)s" % {"k": "v", "i": 1, "j": []}) 55 | 56 | print("%(ab)s" % {"a" "b": 1}) - | ^^^^^^^^^^^^^^^^^^^^^^^ UP031 + | ^^^^^^^^^^^^^^^^^^^^^^^ 57 | 58 | print("%(a)s" % {"a" : 1}) | = help: Replace with format specifiers - ℹ Unsafe fix 53 53 | 54 54 | print("%(k)s" % {"k": "v", "i": 1, "j": []}) @@ -496,15 +519,16 @@ UP031_0.py:56:7: UP031 [*] Use format specifiers instead of percent format 58 58 | print("%(a)s" % {"a" : 1}) 59 59 | -UP031_0.py:58:7: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 58:7: [*] Use format specifiers instead of percent format + + --> UP031_0.py:58:7 | 56 | print("%(ab)s" % {"a" "b": 1}) 57 | 58 | print("%(a)s" % {"a" : 1}) - | ^^^^^^^^^^^^^^^^^^^^^ UP031 + | ^^^^^^^^^^^^^^^^^^^^^ | = help: Replace with format specifiers - ℹ Unsafe fix 55 55 | 56 56 | print("%(ab)s" % {"a" "b": 1}) @@ -515,17 +539,18 @@ UP031_0.py:58:7: UP031 [*] Use format specifiers instead of percent format 60 60 | 61 61 | print( -UP031_0.py:62:5: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 62:5: [*] Use format specifiers instead of percent format + + --> UP031_0.py:62:5 | 61 | print( 62 | "foo %(foo)s " | _____^ 63 | | "bar %(bar)s" % {"foo": x, "bar": y} - | |________________________________________^ UP031 + | |________________________________________^ 64 | ) | = help: Replace with format specifiers - ℹ Unsafe fix 59 59 | 60 60 | @@ -538,18 +563,19 @@ UP031_0.py:62:5: UP031 [*] Use format specifiers instead of percent format 65 65 | 66 66 | bar = {"bar": y} -UP031_0.py:68:5: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 68:5: [*] Use format specifiers instead of percent format + + --> UP031_0.py:68:5 | 66 | bar = {"bar": y} 67 | print( 68 | "foo %(foo)s " | _____^ 69 | | "bar %(bar)s" % {"foo": x, **bar} - | |_____________________________________^ UP031 + | |_____________________________________^ 70 | ) | = help: Replace with format specifiers - ℹ Unsafe fix 65 65 | 66 66 | bar = {"bar": y} @@ -562,17 +588,18 @@ UP031_0.py:68:5: UP031 [*] Use format specifiers instead of percent format 71 71 | 72 72 | print("%s \N{snowman}" % (a,)) -UP031_0.py:72:7: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 72:7: [*] Use format specifiers instead of percent format + + --> UP031_0.py:72:7 | 70 | ) 71 | 72 | print("%s \N{snowman}" % (a,)) - | ^^^^^^^^^^^^^^^^^^^^^^^ UP031 + | ^^^^^^^^^^^^^^^^^^^^^^^ 73 | 74 | print("%(foo)s \N{snowman}" % {"foo": 1}) | = help: Replace with format specifiers - ℹ Unsafe fix 69 69 | "bar %(bar)s" % {"foo": x, **bar} 70 70 | ) @@ -583,17 +610,18 @@ UP031_0.py:72:7: UP031 [*] Use format specifiers instead of percent format 74 74 | print("%(foo)s \N{snowman}" % {"foo": 1}) 75 75 | -UP031_0.py:74:7: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 74:7: [*] Use format specifiers instead of percent format + + --> UP031_0.py:74:7 | 72 | print("%s \N{snowman}" % (a,)) 73 | 74 | print("%(foo)s \N{snowman}" % {"foo": 1}) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP031 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 75 | 76 | print(("foo %s " "bar %s") % (x, y)) | = help: Replace with format specifiers - ℹ Unsafe fix 71 71 | 72 72 | print("%s \N{snowman}" % (a,)) @@ -604,17 +632,18 @@ UP031_0.py:74:7: UP031 [*] Use format specifiers instead of percent format 76 76 | print(("foo %s " "bar %s") % (x, y)) 77 77 | -UP031_0.py:76:7: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 76:7: [*] Use format specifiers instead of percent format + + --> UP031_0.py:76:7 | 74 | print("%(foo)s \N{snowman}" % {"foo": 1}) 75 | 76 | print(("foo %s " "bar %s") % (x, y)) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP031 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 77 | 78 | # Single-value expressions | = help: Replace with format specifiers - ℹ Unsafe fix 73 73 | 74 74 | print("%(foo)s \N{snowman}" % {"foo": 1}) @@ -625,16 +654,17 @@ UP031_0.py:76:7: UP031 [*] Use format specifiers instead of percent format 78 78 | # Single-value expressions 79 79 | print('Hello %s' % "World") -UP031_0.py:79:7: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 79:7: [*] Use format specifiers instead of percent format + + --> UP031_0.py:79:7 | 78 | # Single-value expressions 79 | print('Hello %s' % "World") - | ^^^^^^^^^^^^^^^^^^^^ UP031 + | ^^^^^^^^^^^^^^^^^^^^ 80 | print('Hello %s' % f"World") 81 | print('Hello %s (%s)' % bar) | = help: Replace with format specifiers - ℹ Unsafe fix 76 76 | print(("foo %s " "bar %s") % (x, y)) 77 77 | @@ -645,17 +675,18 @@ UP031_0.py:79:7: UP031 [*] Use format specifiers instead of percent format 81 81 | print('Hello %s (%s)' % bar) 82 82 | print('Hello %s (%s)' % bar.baz) -UP031_0.py:80:7: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 80:7: [*] Use format specifiers instead of percent format + + --> UP031_0.py:80:7 | 78 | # Single-value expressions 79 | print('Hello %s' % "World") 80 | print('Hello %s' % f"World") - | ^^^^^^^^^^^^^^^^^^^^^ UP031 + | ^^^^^^^^^^^^^^^^^^^^^ 81 | print('Hello %s (%s)' % bar) 82 | print('Hello %s (%s)' % bar.baz) | = help: Replace with format specifiers - ℹ Unsafe fix 77 77 | 78 78 | # Single-value expressions @@ -666,17 +697,18 @@ UP031_0.py:80:7: UP031 [*] Use format specifiers instead of percent format 82 82 | print('Hello %s (%s)' % bar.baz) 83 83 | print('Hello %s (%s)' % bar['bop']) -UP031_0.py:81:7: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 81:7: [*] Use format specifiers instead of percent format + + --> UP031_0.py:81:7 | 79 | print('Hello %s' % "World") 80 | print('Hello %s' % f"World") 81 | print('Hello %s (%s)' % bar) - | ^^^^^^^^^^^^^^^^^^^^^ UP031 + | ^^^^^^^^^^^^^^^^^^^^^ 82 | print('Hello %s (%s)' % bar.baz) 83 | print('Hello %s (%s)' % bar['bop']) | = help: Replace with format specifiers - ℹ Unsafe fix 78 78 | # Single-value expressions 79 79 | print('Hello %s' % "World") @@ -687,17 +719,18 @@ UP031_0.py:81:7: UP031 [*] Use format specifiers instead of percent format 83 83 | print('Hello %s (%s)' % bar['bop']) 84 84 | print('Hello %(arg)s' % bar) -UP031_0.py:82:7: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 82:7: [*] Use format specifiers instead of percent format + + --> UP031_0.py:82:7 | 80 | print('Hello %s' % f"World") 81 | print('Hello %s (%s)' % bar) 82 | print('Hello %s (%s)' % bar.baz) - | ^^^^^^^^^^^^^^^^^^^^^^^^^ UP031 + | ^^^^^^^^^^^^^^^^^^^^^^^^^ 83 | print('Hello %s (%s)' % bar['bop']) 84 | print('Hello %(arg)s' % bar) | = help: Replace with format specifiers - ℹ Unsafe fix 79 79 | print('Hello %s' % "World") 80 80 | print('Hello %s' % f"World") @@ -708,17 +741,18 @@ UP031_0.py:82:7: UP031 [*] Use format specifiers instead of percent format 84 84 | print('Hello %(arg)s' % bar) 85 85 | print('Hello %(arg)s' % bar.baz) -UP031_0.py:83:7: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 83:7: [*] Use format specifiers instead of percent format + + --> UP031_0.py:83:7 | 81 | print('Hello %s (%s)' % bar) 82 | print('Hello %s (%s)' % bar.baz) 83 | print('Hello %s (%s)' % bar['bop']) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP031 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 84 | print('Hello %(arg)s' % bar) 85 | print('Hello %(arg)s' % bar.baz) | = help: Replace with format specifiers - ℹ Unsafe fix 80 80 | print('Hello %s' % f"World") 81 81 | print('Hello %s (%s)' % bar) @@ -729,17 +763,18 @@ UP031_0.py:83:7: UP031 [*] Use format specifiers instead of percent format 85 85 | print('Hello %(arg)s' % bar.baz) 86 86 | print('Hello %(arg)s' % bar['bop']) -UP031_0.py:84:7: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 84:7: [*] Use format specifiers instead of percent format + + --> UP031_0.py:84:7 | 82 | print('Hello %s (%s)' % bar.baz) 83 | print('Hello %s (%s)' % bar['bop']) 84 | print('Hello %(arg)s' % bar) - | ^^^^^^^^^^^^^^^^^^^^^ UP031 + | ^^^^^^^^^^^^^^^^^^^^^ 85 | print('Hello %(arg)s' % bar.baz) 86 | print('Hello %(arg)s' % bar['bop']) | = help: Replace with format specifiers - ℹ Unsafe fix 81 81 | print('Hello %s (%s)' % bar) 82 82 | print('Hello %s (%s)' % bar.baz) @@ -750,16 +785,17 @@ UP031_0.py:84:7: UP031 [*] Use format specifiers instead of percent format 86 86 | print('Hello %(arg)s' % bar['bop']) 87 87 | -UP031_0.py:85:7: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 85:7: [*] Use format specifiers instead of percent format + + --> UP031_0.py:85:7 | 83 | print('Hello %s (%s)' % bar['bop']) 84 | print('Hello %(arg)s' % bar) 85 | print('Hello %(arg)s' % bar.baz) - | ^^^^^^^^^^^^^^^^^^^^^^^^^ UP031 + | ^^^^^^^^^^^^^^^^^^^^^^^^^ 86 | print('Hello %(arg)s' % bar['bop']) | = help: Replace with format specifiers - ℹ Unsafe fix 82 82 | print('Hello %s (%s)' % bar.baz) 83 83 | print('Hello %s (%s)' % bar['bop']) @@ -770,17 +806,18 @@ UP031_0.py:85:7: UP031 [*] Use format specifiers instead of percent format 87 87 | 88 88 | # Hanging modulos -UP031_0.py:86:7: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 86:7: [*] Use format specifiers instead of percent format + + --> UP031_0.py:86:7 | 84 | print('Hello %(arg)s' % bar) 85 | print('Hello %(arg)s' % bar.baz) 86 | print('Hello %(arg)s' % bar['bop']) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP031 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 87 | 88 | # Hanging modulos | = help: Replace with format specifiers - ℹ Unsafe fix 83 83 | print('Hello %s (%s)' % bar['bop']) 84 84 | print('Hello %(arg)s' % bar) @@ -791,19 +828,20 @@ UP031_0.py:86:7: UP031 [*] Use format specifiers instead of percent format 88 88 | # Hanging modulos 89 89 | ( -UP031_0.py:89:1: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 89:1: [*] Use format specifiers instead of percent format + + --> UP031_0.py:88:18 | 88 | # Hanging modulos 89 | / ( 90 | | "foo %s " 91 | | "bar %s" 92 | | ) % (x, y) - | |__________^ UP031 + | |__________^ 93 | 94 | ( | = help: Replace with format specifiers - ℹ Unsafe fix 87 87 | 88 88 | # Hanging modulos @@ -818,7 +856,9 @@ UP031_0.py:89:1: UP031 [*] Use format specifiers instead of percent format 94 94 | ( 95 95 | "foo %(foo)s " -UP031_0.py:94:1: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 94:1: [*] Use format specifiers instead of percent format + + --> UP031_0.py:93:1 | 92 | ) % (x, y) 93 | @@ -826,12 +866,11 @@ UP031_0.py:94:1: UP031 [*] Use format specifiers instead of percent format 95 | | "foo %(foo)s " 96 | | "bar %(bar)s" 97 | | ) % {"foo": x, "bar": y} - | |________________________^ UP031 + | |________________________^ 98 | 99 | ( | = help: Replace with format specifiers - ℹ Unsafe fix 92 92 | ) % (x, y) 93 93 | @@ -846,17 +885,18 @@ UP031_0.py:94:1: UP031 [*] Use format specifiers instead of percent format 99 99 | ( 100 100 | """foo %s""" -UP031_0.py:100:5: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 100:5: [*] Use format specifiers instead of percent format + + --> UP031_0.py:100:5 | 99 | ( 100 | """foo %s""" | _____^ 101 | | % (x,) - | |__________^ UP031 + | |__________^ 102 | ) | = help: Replace with format specifiers - ℹ Unsafe fix 97 97 | ) % {"foo": x, "bar": y} 98 98 | @@ -868,7 +908,9 @@ UP031_0.py:100:5: UP031 [*] Use format specifiers instead of percent format 103 102 | 104 103 | ( -UP031_0.py:105:5: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 105:5: [*] Use format specifiers instead of percent format + + --> UP031_0.py:105:5 | 104 | ( 105 | """ @@ -876,11 +918,10 @@ UP031_0.py:105:5: UP031 [*] Use format specifiers instead of percent format 106 | | foo %s 107 | | """ 108 | | % (x,) - | |__________^ UP031 + | |__________^ 109 | ) | = help: Replace with format specifiers - ℹ Unsafe fix 103 103 | 104 104 | ( @@ -894,17 +935,18 @@ UP031_0.py:105:5: UP031 [*] Use format specifiers instead of percent format 110 109 | 111 110 | "%s" % ( -UP031_0.py:111:1: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 111:1: [*] Use format specifiers instead of percent format + + --> UP031_0.py:110:1 | 109 | ) 110 | 111 | / "%s" % ( 112 | | x, # comment 113 | | ) - | |_^ UP031 + | |_^ | = help: Replace with format specifiers - ℹ Unsafe fix 108 108 | % (x,) 109 109 | ) @@ -915,20 +957,21 @@ UP031_0.py:111:1: UP031 [*] Use format specifiers instead of percent format 113 113 | ) 114 114 | -UP031_0.py:116:8: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 116:8: [*] Use format specifiers instead of percent format + + --> UP031_0.py:116:8 | 116 | path = "%s-%s-%s.pem" % ( | ________^ -117 | | safe_domain_name(cn), # common name, which should be filename safe because it is IDNA-encoded, but in case of a malformed cert make sure it's ok to use as a filename +117 | | safe_domain_name(cn), # common name, which should be filename safe because it is IDNA-encoded, but in case of a malformed cert ... 118 | | cert.not_valid_after.date().isoformat().replace("-", ""), # expiration date 119 | | hexlify(cert.fingerprint(hashes.SHA256())).decode("ascii")[0:8], # fingerprint prefix 120 | | ) - | |_^ UP031 + | |_^ 121 | 122 | # UP031 (no longer false negatives; now offer potentially unsafe fixes) | = help: Replace with format specifiers - ℹ Unsafe fix 113 113 | ) 114 114 | @@ -939,16 +982,17 @@ UP031_0.py:116:8: UP031 [*] Use format specifiers instead of percent format 118 118 | cert.not_valid_after.date().isoformat().replace("-", ""), # expiration date 119 119 | hexlify(cert.fingerprint(hashes.SHA256())).decode("ascii")[0:8], # fingerprint prefix -UP031_0.py:123:1: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 123:1: [*] Use format specifiers instead of percent format + + --> UP031_0.py:122:72 | 122 | # UP031 (no longer false negatives; now offer potentially unsafe fixes) 123 | 'Hello %s' % bar - | ^^^^^^^^^^^^^^^^ UP031 + | ^^^^^^^^^^^^^^^^ 124 | 125 | 'Hello %s' % bar.baz | = help: Replace with format specifiers - ℹ Unsafe fix 120 120 | ) 121 121 | @@ -959,17 +1003,18 @@ UP031_0.py:123:1: UP031 [*] Use format specifiers instead of percent format 125 125 | 'Hello %s' % bar.baz 126 126 | -UP031_0.py:125:1: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 125:1: [*] Use format specifiers instead of percent format + + --> UP031_0.py:124:1 | 123 | 'Hello %s' % bar 124 | 125 | 'Hello %s' % bar.baz - | ^^^^^^^^^^^^^^^^^^^^ UP031 + | ^^^^^^^^^^^^^^^^^^^^ 126 | 127 | 'Hello %s' % bar['bop'] | = help: Replace with format specifiers - ℹ Unsafe fix 122 122 | # UP031 (no longer false negatives; now offer potentially unsafe fixes) 123 123 | 'Hello %s' % bar @@ -980,17 +1025,18 @@ UP031_0.py:125:1: UP031 [*] Use format specifiers instead of percent format 127 127 | 'Hello %s' % bar['bop'] 128 128 | -UP031_0.py:127:1: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 127:1: [*] Use format specifiers instead of percent format + + --> UP031_0.py:126:1 | 125 | 'Hello %s' % bar.baz 126 | 127 | 'Hello %s' % bar['bop'] - | ^^^^^^^^^^^^^^^^^^^^^^^ UP031 + | ^^^^^^^^^^^^^^^^^^^^^^^ 128 | 129 | # Not a valid type annotation but this test shouldn't result in a panic. | = help: Replace with format specifiers - ℹ Unsafe fix 124 124 | 125 125 | 'Hello %s' % bar.baz @@ -1001,17 +1047,18 @@ UP031_0.py:127:1: UP031 [*] Use format specifiers instead of percent format 129 129 | # Not a valid type annotation but this test shouldn't result in a panic. 130 130 | # Refer: https://github.com/astral-sh/ruff/issues/11736 -UP031_0.py:131:5: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 131:5: [*] Use format specifiers instead of percent format + + --> UP031_0.py:131:5 | 129 | # Not a valid type annotation but this test shouldn't result in a panic. 130 | # Refer: https://github.com/astral-sh/ruff/issues/11736 131 | x: "'%s + %s' % (1, 2)" - | ^^^^^^^^^^^^^^^^^^ UP031 + | ^^^^^^^^^^^^^^^^^^ 132 | 133 | # See: https://github.com/astral-sh/ruff/issues/12421 | = help: Replace with format specifiers - ℹ Unsafe fix 128 128 | 129 129 | # Not a valid type annotation but this test shouldn't result in a panic. @@ -1022,16 +1069,17 @@ UP031_0.py:131:5: UP031 [*] Use format specifiers instead of percent format 133 133 | # See: https://github.com/astral-sh/ruff/issues/12421 134 134 | print("%.2X" % 1) -UP031_0.py:134:7: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 134:7: [*] Use format specifiers instead of percent format + + --> UP031_0.py:134:7 | 133 | # See: https://github.com/astral-sh/ruff/issues/12421 134 | print("%.2X" % 1) - | ^^^^^^^^^^ UP031 + | ^^^^^^^^^^ 135 | print("%.02X" % 1) 136 | print("%02X" % 1) | = help: Replace with format specifiers - ℹ Unsafe fix 131 131 | x: "'%s + %s' % (1, 2)" 132 132 | @@ -1042,17 +1090,18 @@ UP031_0.py:134:7: UP031 [*] Use format specifiers instead of percent format 136 136 | print("%02X" % 1) 137 137 | print("%.00002X" % 1) -UP031_0.py:135:7: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 135:7: [*] Use format specifiers instead of percent format + + --> UP031_0.py:135:7 | 133 | # See: https://github.com/astral-sh/ruff/issues/12421 134 | print("%.2X" % 1) 135 | print("%.02X" % 1) - | ^^^^^^^^^^^ UP031 + | ^^^^^^^^^^^ 136 | print("%02X" % 1) 137 | print("%.00002X" % 1) | = help: Replace with format specifiers - ℹ Unsafe fix 132 132 | 133 133 | # See: https://github.com/astral-sh/ruff/issues/12421 @@ -1063,17 +1112,18 @@ UP031_0.py:135:7: UP031 [*] Use format specifiers instead of percent format 137 137 | print("%.00002X" % 1) 138 138 | print("%.20X" % 1) -UP031_0.py:136:7: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 136:7: [*] Use format specifiers instead of percent format + + --> UP031_0.py:136:7 | 134 | print("%.2X" % 1) 135 | print("%.02X" % 1) 136 | print("%02X" % 1) - | ^^^^^^^^^^ UP031 + | ^^^^^^^^^^ 137 | print("%.00002X" % 1) 138 | print("%.20X" % 1) | = help: Replace with format specifiers - ℹ Unsafe fix 133 133 | # See: https://github.com/astral-sh/ruff/issues/12421 134 134 | print("%.2X" % 1) @@ -1084,16 +1134,17 @@ UP031_0.py:136:7: UP031 [*] Use format specifiers instead of percent format 138 138 | print("%.20X" % 1) 139 139 | -UP031_0.py:137:7: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 137:7: [*] Use format specifiers instead of percent format + + --> UP031_0.py:137:7 | 135 | print("%.02X" % 1) 136 | print("%02X" % 1) 137 | print("%.00002X" % 1) - | ^^^^^^^^^^^^^^ UP031 + | ^^^^^^^^^^^^^^ 138 | print("%.20X" % 1) | = help: Replace with format specifiers - ℹ Unsafe fix 134 134 | print("%.2X" % 1) 135 135 | print("%.02X" % 1) @@ -1104,17 +1155,18 @@ UP031_0.py:137:7: UP031 [*] Use format specifiers instead of percent format 139 139 | 140 140 | print("%2X" % 1) -UP031_0.py:138:7: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 138:7: [*] Use format specifiers instead of percent format + + --> UP031_0.py:138:7 | 136 | print("%02X" % 1) 137 | print("%.00002X" % 1) 138 | print("%.20X" % 1) - | ^^^^^^^^^^^ UP031 + | ^^^^^^^^^^^ 139 | 140 | print("%2X" % 1) | = help: Replace with format specifiers - ℹ Unsafe fix 135 135 | print("%.02X" % 1) 136 136 | print("%02X" % 1) @@ -1125,16 +1177,17 @@ UP031_0.py:138:7: UP031 [*] Use format specifiers instead of percent format 140 140 | print("%2X" % 1) 141 141 | print("%02X" % 1) -UP031_0.py:140:7: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 140:7: [*] Use format specifiers instead of percent format + + --> UP031_0.py:140:7 | 138 | print("%.20X" % 1) 139 | 140 | print("%2X" % 1) - | ^^^^^^^^^ UP031 + | ^^^^^^^^^ 141 | print("%02X" % 1) | = help: Replace with format specifiers - ℹ Unsafe fix 137 137 | print("%.00002X" % 1) 138 138 | print("%.20X" % 1) @@ -1145,16 +1198,17 @@ UP031_0.py:140:7: UP031 [*] Use format specifiers instead of percent format 142 142 | 143 143 | # UP031 (no longer false negatives, but offer no fix because of more complex syntax) -UP031_0.py:141:7: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 141:7: [*] Use format specifiers instead of percent format + + --> UP031_0.py:141:7 | 140 | print("%2X" % 1) 141 | print("%02X" % 1) - | ^^^^^^^^^^ UP031 + | ^^^^^^^^^^ 142 | 143 | # UP031 (no longer false negatives, but offer no fix because of more complex syntax) | = help: Replace with format specifiers - ℹ Unsafe fix 138 138 | print("%.20X" % 1) 139 139 | diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP032_0.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP032_0.py.snap index 487e053727..d536c2164f 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP032_0.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP032_0.py.snap @@ -1,17 +1,18 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -UP032_0.py:5:1: UP032 [*] Use f-string instead of `format` call +error[UP032]: 5:1: [*] Use f-string instead of `format` call + + --> UP032_0.py:4:1 | 3 | ### 4 | 5 | "{} {}".format(a, b) - | ^^^^^^^^^^^^^^^^^^^^ UP032 + | ^^^^^^^^^^^^^^^^^^^^ 6 | 7 | "{1} {0}".format(a, b) | = help: Convert to f-string - ℹ Safe fix 2 2 | # Errors 3 3 | ### @@ -22,17 +23,18 @@ UP032_0.py:5:1: UP032 [*] Use f-string instead of `format` call 7 7 | "{1} {0}".format(a, b) 8 8 | -UP032_0.py:7:1: UP032 [*] Use f-string instead of `format` call +error[UP032]: 7:1: [*] Use f-string instead of `format` call + + --> UP032_0.py:6:1 | 5 | "{} {}".format(a, b) 6 | 7 | "{1} {0}".format(a, b) - | ^^^^^^^^^^^^^^^^^^^^^^ UP032 + | ^^^^^^^^^^^^^^^^^^^^^^ 8 | 9 | "{0} {1} {0}".format(a, b) | = help: Convert to f-string - ℹ Safe fix 4 4 | 5 5 | "{} {}".format(a, b) @@ -43,17 +45,18 @@ UP032_0.py:7:1: UP032 [*] Use f-string instead of `format` call 9 9 | "{0} {1} {0}".format(a, b) 10 10 | -UP032_0.py:9:1: UP032 [*] Use f-string instead of `format` call +error[UP032]: 9:1: [*] Use f-string instead of `format` call + + --> UP032_0.py:8:1 | 7 | "{1} {0}".format(a, b) 8 | 9 | "{0} {1} {0}".format(a, b) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ UP032 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ 10 | 11 | "{x.y}".format(x=z) | = help: Convert to f-string - ℹ Safe fix 6 6 | 7 7 | "{1} {0}".format(a, b) @@ -64,17 +67,18 @@ UP032_0.py:9:1: UP032 [*] Use f-string instead of `format` call 11 11 | "{x.y}".format(x=z) 12 12 | -UP032_0.py:11:1: UP032 [*] Use f-string instead of `format` call +error[UP032]: 11:1: [*] Use f-string instead of `format` call + + --> UP032_0.py:10:1 | 9 | "{0} {1} {0}".format(a, b) 10 | 11 | "{x.y}".format(x=z) - | ^^^^^^^^^^^^^^^^^^^ UP032 + | ^^^^^^^^^^^^^^^^^^^ 12 | 13 | "{x} {y} {x}".format(x=a, y=b) | = help: Convert to f-string - ℹ Safe fix 8 8 | 9 9 | "{0} {1} {0}".format(a, b) @@ -85,17 +89,18 @@ UP032_0.py:11:1: UP032 [*] Use f-string instead of `format` call 13 13 | "{x} {y} {x}".format(x=a, y=b) 14 14 | -UP032_0.py:13:1: UP032 [*] Use f-string instead of `format` call +error[UP032]: 13:1: [*] Use f-string instead of `format` call + + --> UP032_0.py:12:1 | 11 | "{x.y}".format(x=z) 12 | 13 | "{x} {y} {x}".format(x=a, y=b) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP032 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 14 | 15 | "{.x} {.y}".format(a, b) | = help: Convert to f-string - ℹ Safe fix 10 10 | 11 11 | "{x.y}".format(x=z) @@ -106,17 +111,18 @@ UP032_0.py:13:1: UP032 [*] Use f-string instead of `format` call 15 15 | "{.x} {.y}".format(a, b) 16 16 | -UP032_0.py:15:1: UP032 [*] Use f-string instead of `format` call +error[UP032]: 15:1: [*] Use f-string instead of `format` call + + --> UP032_0.py:14:1 | 13 | "{x} {y} {x}".format(x=a, y=b) 14 | 15 | "{.x} {.y}".format(a, b) - | ^^^^^^^^^^^^^^^^^^^^^^^^ UP032 + | ^^^^^^^^^^^^^^^^^^^^^^^^ 16 | 17 | "{} {}".format(a.b, c.d) | = help: Convert to f-string - ℹ Safe fix 12 12 | 13 13 | "{x} {y} {x}".format(x=a, y=b) @@ -127,17 +133,18 @@ UP032_0.py:15:1: UP032 [*] Use f-string instead of `format` call 17 17 | "{} {}".format(a.b, c.d) 18 18 | -UP032_0.py:17:1: UP032 [*] Use f-string instead of `format` call +error[UP032]: 17:1: [*] Use f-string instead of `format` call + + --> UP032_0.py:16:1 | 15 | "{.x} {.y}".format(a, b) 16 | 17 | "{} {}".format(a.b, c.d) - | ^^^^^^^^^^^^^^^^^^^^^^^^ UP032 + | ^^^^^^^^^^^^^^^^^^^^^^^^ 18 | 19 | "{}".format(a()) | = help: Convert to f-string - ℹ Safe fix 14 14 | 15 15 | "{.x} {.y}".format(a, b) @@ -148,17 +155,18 @@ UP032_0.py:17:1: UP032 [*] Use f-string instead of `format` call 19 19 | "{}".format(a()) 20 20 | -UP032_0.py:19:1: UP032 [*] Use f-string instead of `format` call +error[UP032]: 19:1: [*] Use f-string instead of `format` call + + --> UP032_0.py:18:1 | 17 | "{} {}".format(a.b, c.d) 18 | 19 | "{}".format(a()) - | ^^^^^^^^^^^^^^^^ UP032 + | ^^^^^^^^^^^^^^^^ 20 | 21 | "{}".format(a.b()) | = help: Convert to f-string - ℹ Safe fix 16 16 | 17 17 | "{} {}".format(a.b, c.d) @@ -169,17 +177,18 @@ UP032_0.py:19:1: UP032 [*] Use f-string instead of `format` call 21 21 | "{}".format(a.b()) 22 22 | -UP032_0.py:21:1: UP032 [*] Use f-string instead of `format` call +error[UP032]: 21:1: [*] Use f-string instead of `format` call + + --> UP032_0.py:20:1 | 19 | "{}".format(a()) 20 | 21 | "{}".format(a.b()) - | ^^^^^^^^^^^^^^^^^^ UP032 + | ^^^^^^^^^^^^^^^^^^ 22 | 23 | "{}".format(a.b().c()) | = help: Convert to f-string - ℹ Safe fix 18 18 | 19 19 | "{}".format(a()) @@ -190,17 +199,18 @@ UP032_0.py:21:1: UP032 [*] Use f-string instead of `format` call 23 23 | "{}".format(a.b().c()) 24 24 | -UP032_0.py:23:1: UP032 [*] Use f-string instead of `format` call +error[UP032]: 23:1: [*] Use f-string instead of `format` call + + --> UP032_0.py:22:1 | 21 | "{}".format(a.b()) 22 | 23 | "{}".format(a.b().c()) - | ^^^^^^^^^^^^^^^^^^^^^^ UP032 + | ^^^^^^^^^^^^^^^^^^^^^^ 24 | 25 | "hello {}!".format(name) | = help: Convert to f-string - ℹ Safe fix 20 20 | 21 21 | "{}".format(a.b()) @@ -211,17 +221,18 @@ UP032_0.py:23:1: UP032 [*] Use f-string instead of `format` call 25 25 | "hello {}!".format(name) 26 26 | -UP032_0.py:25:1: UP032 [*] Use f-string instead of `format` call +error[UP032]: 25:1: [*] Use f-string instead of `format` call + + --> UP032_0.py:24:1 | 23 | "{}".format(a.b().c()) 24 | 25 | "hello {}!".format(name) - | ^^^^^^^^^^^^^^^^^^^^^^^^ UP032 + | ^^^^^^^^^^^^^^^^^^^^^^^^ 26 | 27 | "{}{b}{}".format(a, c, b=b) | = help: Convert to f-string - ℹ Safe fix 22 22 | 23 23 | "{}".format(a.b().c()) @@ -232,17 +243,18 @@ UP032_0.py:25:1: UP032 [*] Use f-string instead of `format` call 27 27 | "{}{b}{}".format(a, c, b=b) 28 28 | -UP032_0.py:27:1: UP032 [*] Use f-string instead of `format` call +error[UP032]: 27:1: [*] Use f-string instead of `format` call + + --> UP032_0.py:26:1 | 25 | "hello {}!".format(name) 26 | 27 | "{}{b}{}".format(a, c, b=b) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP032 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ 28 | 29 | "{}".format(0x0) | = help: Convert to f-string - ℹ Safe fix 24 24 | 25 25 | "hello {}!".format(name) @@ -253,17 +265,18 @@ UP032_0.py:27:1: UP032 [*] Use f-string instead of `format` call 29 29 | "{}".format(0x0) 30 30 | -UP032_0.py:29:1: UP032 [*] Use f-string instead of `format` call +error[UP032]: 29:1: [*] Use f-string instead of `format` call + + --> UP032_0.py:28:1 | 27 | "{}{b}{}".format(a, c, b=b) 28 | 29 | "{}".format(0x0) - | ^^^^^^^^^^^^^^^^ UP032 + | ^^^^^^^^^^^^^^^^ 30 | 31 | "{} {}".format(a, b) | = help: Convert to f-string - ℹ Safe fix 26 26 | 27 27 | "{}{b}{}".format(a, c, b=b) @@ -274,17 +287,18 @@ UP032_0.py:29:1: UP032 [*] Use f-string instead of `format` call 31 31 | "{} {}".format(a, b) 32 32 | -UP032_0.py:31:1: UP032 [*] Use f-string instead of `format` call +error[UP032]: 31:1: [*] Use f-string instead of `format` call + + --> UP032_0.py:30:1 | 29 | "{}".format(0x0) 30 | 31 | "{} {}".format(a, b) - | ^^^^^^^^^^^^^^^^^^^^ UP032 + | ^^^^^^^^^^^^^^^^^^^^ 32 | 33 | """{} {}""".format(a, b) | = help: Convert to f-string - ℹ Safe fix 28 28 | 29 29 | "{}".format(0x0) @@ -295,17 +309,18 @@ UP032_0.py:31:1: UP032 [*] Use f-string instead of `format` call 33 33 | """{} {}""".format(a, b) 34 34 | -UP032_0.py:33:1: UP032 [*] Use f-string instead of `format` call +error[UP032]: 33:1: [*] Use f-string instead of `format` call + + --> UP032_0.py:32:1 | 31 | "{} {}".format(a, b) 32 | 33 | """{} {}""".format(a, b) - | ^^^^^^^^^^^^^^^^^^^^^^^^ UP032 + | ^^^^^^^^^^^^^^^^^^^^^^^^ 34 | 35 | "foo{}".format(1) | = help: Convert to f-string - ℹ Safe fix 30 30 | 31 31 | "{} {}".format(a, b) @@ -316,17 +331,18 @@ UP032_0.py:33:1: UP032 [*] Use f-string instead of `format` call 35 35 | "foo{}".format(1) 36 36 | -UP032_0.py:35:1: UP032 [*] Use f-string instead of `format` call +error[UP032]: 35:1: [*] Use f-string instead of `format` call + + --> UP032_0.py:34:1 | 33 | """{} {}""".format(a, b) 34 | 35 | "foo{}".format(1) - | ^^^^^^^^^^^^^^^^^ UP032 + | ^^^^^^^^^^^^^^^^^ 36 | 37 | r"foo{}".format(1) | = help: Convert to f-string - ℹ Safe fix 32 32 | 33 33 | """{} {}""".format(a, b) @@ -337,17 +353,18 @@ UP032_0.py:35:1: UP032 [*] Use f-string instead of `format` call 37 37 | r"foo{}".format(1) 38 38 | -UP032_0.py:37:1: UP032 [*] Use f-string instead of `format` call +error[UP032]: 37:1: [*] Use f-string instead of `format` call + + --> UP032_0.py:36:1 | 35 | "foo{}".format(1) 36 | 37 | r"foo{}".format(1) - | ^^^^^^^^^^^^^^^^^^ UP032 + | ^^^^^^^^^^^^^^^^^^ 38 | 39 | x = "{a}".format(a=1) | = help: Convert to f-string - ℹ Safe fix 34 34 | 35 35 | "foo{}".format(1) @@ -358,17 +375,18 @@ UP032_0.py:37:1: UP032 [*] Use f-string instead of `format` call 39 39 | x = "{a}".format(a=1) 40 40 | -UP032_0.py:39:5: UP032 [*] Use f-string instead of `format` call +error[UP032]: 39:5: [*] Use f-string instead of `format` call + + --> UP032_0.py:39:5 | 37 | r"foo{}".format(1) 38 | 39 | x = "{a}".format(a=1) - | ^^^^^^^^^^^^^^^^^ UP032 + | ^^^^^^^^^^^^^^^^^ 40 | 41 | print("foo {} ".format(x)) | = help: Convert to f-string - ℹ Safe fix 36 36 | 37 37 | r"foo{}".format(1) @@ -379,17 +397,18 @@ UP032_0.py:39:5: UP032 [*] Use f-string instead of `format` call 41 41 | print("foo {} ".format(x)) 42 42 | -UP032_0.py:41:7: UP032 [*] Use f-string instead of `format` call +error[UP032]: 41:7: [*] Use f-string instead of `format` call + + --> UP032_0.py:41:7 | 39 | x = "{a}".format(a=1) 40 | 41 | print("foo {} ".format(x)) - | ^^^^^^^^^^^^^^^^^^^ UP032 + | ^^^^^^^^^^^^^^^^^^^ 42 | 43 | "{a[b]}".format(a=a) | = help: Convert to f-string - ℹ Safe fix 38 38 | 39 39 | x = "{a}".format(a=1) @@ -400,17 +419,18 @@ UP032_0.py:41:7: UP032 [*] Use f-string instead of `format` call 43 43 | "{a[b]}".format(a=a) 44 44 | -UP032_0.py:43:1: UP032 [*] Use f-string instead of `format` call +error[UP032]: 43:1: [*] Use f-string instead of `format` call + + --> UP032_0.py:42:1 | 41 | print("foo {} ".format(x)) 42 | 43 | "{a[b]}".format(a=a) - | ^^^^^^^^^^^^^^^^^^^^ UP032 + | ^^^^^^^^^^^^^^^^^^^^ 44 | 45 | "{a.a[b]}".format(a=a) | = help: Convert to f-string - ℹ Safe fix 40 40 | 41 41 | print("foo {} ".format(x)) @@ -421,17 +441,18 @@ UP032_0.py:43:1: UP032 [*] Use f-string instead of `format` call 45 45 | "{a.a[b]}".format(a=a) 46 46 | -UP032_0.py:45:1: UP032 [*] Use f-string instead of `format` call +error[UP032]: 45:1: [*] Use f-string instead of `format` call + + --> UP032_0.py:44:1 | 43 | "{a[b]}".format(a=a) 44 | 45 | "{a.a[b]}".format(a=a) - | ^^^^^^^^^^^^^^^^^^^^^^ UP032 + | ^^^^^^^^^^^^^^^^^^^^^^ 46 | 47 | "{}{{}}{}".format(escaped, y) | = help: Convert to f-string - ℹ Safe fix 42 42 | 43 43 | "{a[b]}".format(a=a) @@ -442,17 +463,18 @@ UP032_0.py:45:1: UP032 [*] Use f-string instead of `format` call 47 47 | "{}{{}}{}".format(escaped, y) 48 48 | -UP032_0.py:47:1: UP032 [*] Use f-string instead of `format` call +error[UP032]: 47:1: [*] Use f-string instead of `format` call + + --> UP032_0.py:46:1 | 45 | "{a.a[b]}".format(a=a) 46 | 47 | "{}{{}}{}".format(escaped, y) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP032 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 48 | 49 | "{}".format(a) | = help: Convert to f-string - ℹ Safe fix 44 44 | 45 45 | "{a.a[b]}".format(a=a) @@ -463,17 +485,18 @@ UP032_0.py:47:1: UP032 [*] Use f-string instead of `format` call 49 49 | "{}".format(a) 50 50 | -UP032_0.py:49:1: UP032 [*] Use f-string instead of `format` call +error[UP032]: 49:1: [*] Use f-string instead of `format` call + + --> UP032_0.py:48:1 | 47 | "{}{{}}{}".format(escaped, y) 48 | 49 | "{}".format(a) - | ^^^^^^^^^^^^^^ UP032 + | ^^^^^^^^^^^^^^ 50 | 51 | '({}={{0!e}})'.format(a) | = help: Convert to f-string - ℹ Safe fix 46 46 | 47 47 | "{}{{}}{}".format(escaped, y) @@ -484,17 +507,18 @@ UP032_0.py:49:1: UP032 [*] Use f-string instead of `format` call 51 51 | '({}={{0!e}})'.format(a) 52 52 | -UP032_0.py:51:1: UP032 [*] Use f-string instead of `format` call +error[UP032]: 51:1: [*] Use f-string instead of `format` call + + --> UP032_0.py:50:1 | 49 | "{}".format(a) 50 | 51 | '({}={{0!e}})'.format(a) - | ^^^^^^^^^^^^^^^^^^^^^^^^ UP032 + | ^^^^^^^^^^^^^^^^^^^^^^^^ 52 | 53 | "{[b]}".format(a) | = help: Convert to f-string - ℹ Safe fix 48 48 | 49 49 | "{}".format(a) @@ -505,17 +529,18 @@ UP032_0.py:51:1: UP032 [*] Use f-string instead of `format` call 53 53 | "{[b]}".format(a) 54 54 | -UP032_0.py:53:1: UP032 [*] Use f-string instead of `format` call +error[UP032]: 53:1: [*] Use f-string instead of `format` call + + --> UP032_0.py:52:1 | 51 | '({}={{0!e}})'.format(a) 52 | 53 | "{[b]}".format(a) - | ^^^^^^^^^^^^^^^^^ UP032 + | ^^^^^^^^^^^^^^^^^ 54 | 55 | '{[b]}'.format(a) | = help: Convert to f-string - ℹ Safe fix 50 50 | 51 51 | '({}={{0!e}})'.format(a) @@ -526,17 +551,18 @@ UP032_0.py:53:1: UP032 [*] Use f-string instead of `format` call 55 55 | '{[b]}'.format(a) 56 56 | -UP032_0.py:55:1: UP032 [*] Use f-string instead of `format` call +error[UP032]: 55:1: [*] Use f-string instead of `format` call + + --> UP032_0.py:54:1 | 53 | "{[b]}".format(a) 54 | 55 | '{[b]}'.format(a) - | ^^^^^^^^^^^^^^^^^ UP032 + | ^^^^^^^^^^^^^^^^^ 56 | 57 | """{[b]}""".format(a) | = help: Convert to f-string - ℹ Safe fix 52 52 | 53 53 | "{[b]}".format(a) @@ -547,17 +573,18 @@ UP032_0.py:55:1: UP032 [*] Use f-string instead of `format` call 57 57 | """{[b]}""".format(a) 58 58 | -UP032_0.py:57:1: UP032 [*] Use f-string instead of `format` call +error[UP032]: 57:1: [*] Use f-string instead of `format` call + + --> UP032_0.py:56:1 | 55 | '{[b]}'.format(a) 56 | 57 | """{[b]}""".format(a) - | ^^^^^^^^^^^^^^^^^^^^^ UP032 + | ^^^^^^^^^^^^^^^^^^^^^ 58 | 59 | '''{[b]}'''.format(a) | = help: Convert to f-string - ℹ Safe fix 54 54 | 55 55 | '{[b]}'.format(a) @@ -568,17 +595,18 @@ UP032_0.py:57:1: UP032 [*] Use f-string instead of `format` call 59 59 | '''{[b]}'''.format(a) 60 60 | -UP032_0.py:59:1: UP032 [*] Use f-string instead of `format` call +error[UP032]: 59:1: [*] Use f-string instead of `format` call + + --> UP032_0.py:58:1 | 57 | """{[b]}""".format(a) 58 | 59 | '''{[b]}'''.format(a) - | ^^^^^^^^^^^^^^^^^^^^^ UP032 + | ^^^^^^^^^^^^^^^^^^^^^ 60 | 61 | "{}".format( | = help: Convert to f-string - ℹ Safe fix 56 56 | 57 57 | """{[b]}""".format(a) @@ -589,19 +617,20 @@ UP032_0.py:59:1: UP032 [*] Use f-string instead of `format` call 61 61 | "{}".format( 62 62 | 1 -UP032_0.py:61:1: UP032 [*] Use f-string instead of `format` call +error[UP032]: 61:1: [*] Use f-string instead of `format` call + + --> UP032_0.py:60:1 | 59 | '''{[b]}'''.format(a) 60 | 61 | / "{}".format( 62 | | 1 63 | | ) - | |_^ UP032 + | |_^ 64 | 65 | "123456789 {}".format( | = help: Convert to f-string - ℹ Safe fix 58 58 | 59 59 | '''{[b]}'''.format(a) @@ -614,19 +643,20 @@ UP032_0.py:61:1: UP032 [*] Use f-string instead of `format` call 65 63 | "123456789 {}".format( 66 64 | 1111111111111111111111111111111111111111111111111111111111111111111111111, -UP032_0.py:65:1: UP032 [*] Use f-string instead of `format` call +error[UP032]: 65:1: [*] Use f-string instead of `format` call + + --> UP032_0.py:64:1 | 63 | ) 64 | 65 | / "123456789 {}".format( 66 | | 1111111111111111111111111111111111111111111111111111111111111111111111111, 67 | | ) - | |_^ UP032 + | |_^ 68 | 69 | """ | = help: Convert to f-string - ℹ Safe fix 62 62 | 1 63 63 | ) @@ -639,19 +669,20 @@ UP032_0.py:65:1: UP032 [*] Use f-string instead of `format` call 69 67 | """ 70 68 | {} -UP032_0.py:69:1: UP032 [*] Use f-string instead of `format` call +error[UP032]: 69:1: [*] Use f-string instead of `format` call + + --> UP032_0.py:68:1 | 67 | ) 68 | 69 | / """ 70 | | {} 71 | | """.format(1) - | |_____________^ UP032 + | |_____________^ 72 | 73 | aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = """ | = help: Convert to f-string - ℹ Safe fix 66 66 | 1111111111111111111111111111111111111111111111111111111111111111111111111, 67 67 | ) @@ -665,7 +696,9 @@ UP032_0.py:69:1: UP032 [*] Use f-string instead of `format` call 73 73 | aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = """ 74 74 | {} -UP032_0.py:73:85: UP032 [*] Use f-string instead of `format` call +error[UP032]: 73:85: [*] Use f-string instead of `format` call + + --> UP032_0.py:73:85 | 71 | """.format(1) 72 | @@ -675,12 +708,11 @@ UP032_0.py:73:85: UP032 [*] Use f-string instead of `format` call 75 | | """.format( 76 | | 111111 77 | | ) - | |_^ UP032 + | |_^ 78 | 79 | "{a}" "{b}".format(a=1, b=1) | = help: Convert to f-string - ℹ Safe fix 70 70 | {} 71 71 | """.format(1) @@ -697,17 +729,18 @@ UP032_0.py:73:85: UP032 [*] Use f-string instead of `format` call 79 77 | "{a}" "{b}".format(a=1, b=1) 80 78 | -UP032_0.py:79:1: UP032 [*] Use f-string instead of `format` call +error[UP032]: 79:1: [*] Use f-string instead of `format` call + + --> UP032_0.py:78:1 | 77 | ) 78 | 79 | "{a}" "{b}".format(a=1, b=1) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP032 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 80 | 81 | ( | = help: Convert to f-string - ℹ Safe fix 76 76 | 111111 77 77 | ) @@ -718,7 +751,9 @@ UP032_0.py:79:1: UP032 [*] Use f-string instead of `format` call 81 81 | ( 82 82 | "{a}" -UP032_0.py:81:1: UP032 [*] Use f-string instead of `format` call +error[UP032]: 81:1: [*] Use f-string instead of `format` call + + --> UP032_0.py:80:1 | 79 | "{a}" "{b}".format(a=1, b=1) 80 | @@ -726,12 +761,11 @@ UP032_0.py:81:1: UP032 [*] Use f-string instead of `format` call 82 | | "{a}" 83 | | "{b}" 84 | | ).format(a=1, b=1) - | |__________________^ UP032 + | |__________________^ 85 | 86 | ( | = help: Convert to f-string - ℹ Safe fix 79 79 | "{a}" "{b}".format(a=1, b=1) 80 80 | @@ -746,7 +780,9 @@ UP032_0.py:81:1: UP032 [*] Use f-string instead of `format` call 86 86 | ( 87 87 | "{a}" -UP032_0.py:86:1: UP032 [*] Use f-string instead of `format` call +error[UP032]: 86:1: [*] Use f-string instead of `format` call + + --> UP032_0.py:85:1 | 84 | ).format(a=1, b=1) 85 | @@ -756,12 +792,11 @@ UP032_0.py:86:1: UP032 [*] Use f-string instead of `format` call 89 | | "{b}" 90 | | "" 91 | | ).format(a=1, b=1) - | |__________________^ UP032 + | |__________________^ 92 | 93 | ( | = help: Convert to f-string - ℹ Safe fix 84 84 | ).format(a=1, b=1) 85 85 | @@ -778,7 +813,9 @@ UP032_0.py:86:1: UP032 [*] Use f-string instead of `format` call 93 91 | ( 94 92 | ( -UP032_0.py:94:5: UP032 [*] Use f-string instead of `format` call +error[UP032]: 94:5: [*] Use f-string instead of `format` call + + --> UP032_0.py:94:5 | 93 | ( 94 | ( @@ -790,11 +827,10 @@ UP032_0.py:94:5: UP032 [*] Use f-string instead of `format` call 99 | | ) 100 | | # comment 101 | | .format(a=1, b=1) - | |_____________________^ UP032 + | |_____________________^ 102 | ) | = help: Convert to f-string - ℹ Safe fix 93 93 | ( 94 94 | ( @@ -812,7 +848,9 @@ UP032_0.py:94:5: UP032 [*] Use f-string instead of `format` call 103 103 | 104 104 | ( -UP032_0.py:104:1: UP032 [*] Use f-string instead of `format` call +error[UP032]: 104:1: [*] Use f-string instead of `format` call + + --> UP032_0.py:103:1 | 102 | ) 103 | @@ -820,10 +858,9 @@ UP032_0.py:104:1: UP032 [*] Use f-string instead of `format` call 105 | | "{a}" 106 | | "b" 107 | | ).format(a=1) - | |_____________^ UP032 + | |_____________^ | = help: Convert to f-string - ℹ Safe fix 102 102 | ) 103 103 | @@ -837,14 +874,15 @@ UP032_0.py:104:1: UP032 [*] Use f-string instead of `format` call 109 109 | 110 110 | def d(osname, version, release): -UP032_0.py:111:11: UP032 [*] Use f-string instead of `format` call +error[UP032]: 111:11: [*] Use f-string instead of `format` call + + --> UP032_0.py:111:11 | 110 | def d(osname, version, release): 111 | return"{}-{}.{}".format(osname, version, release) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP032 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: Convert to f-string - ℹ Safe fix 108 108 | 109 109 | @@ -855,14 +893,15 @@ UP032_0.py:111:11: UP032 [*] Use f-string instead of `format` call 113 113 | 114 114 | def e(): -UP032_0.py:115:10: UP032 [*] Use f-string instead of `format` call +error[UP032]: 115:10: [*] Use f-string instead of `format` call + + --> UP032_0.py:115:10 | 114 | def e(): 115 | yield"{}".format(1) - | ^^^^^^^^^^^^^^ UP032 + | ^^^^^^^^^^^^^^ | = help: Convert to f-string - ℹ Safe fix 112 112 | 113 113 | @@ -873,13 +912,14 @@ UP032_0.py:115:10: UP032 [*] Use f-string instead of `format` call 117 117 | 118 118 | assert"{}".format(1) -UP032_0.py:118:7: UP032 [*] Use f-string instead of `format` call +error[UP032]: 118:7: [*] Use f-string instead of `format` call + + --> UP032_0.py:118:7 | 118 | assert"{}".format(1) - | ^^^^^^^^^^^^^^ UP032 + | ^^^^^^^^^^^^^^ | = help: Convert to f-string - ℹ Safe fix 115 115 | yield"{}".format(1) 116 116 | @@ -890,14 +930,15 @@ UP032_0.py:118:7: UP032 [*] Use f-string instead of `format` call 120 120 | 121 121 | async def c(): -UP032_0.py:122:12: UP032 [*] Use f-string instead of `format` call +error[UP032]: 122:12: [*] Use f-string instead of `format` call + + --> UP032_0.py:122:12 | 121 | async def c(): 122 | return "{}".format(await 3) - | ^^^^^^^^^^^^^^^^^^^^ UP032 + | ^^^^^^^^^^^^^^^^^^^^ | = help: Convert to f-string - ℹ Safe fix 119 119 | 120 120 | @@ -908,14 +949,15 @@ UP032_0.py:122:12: UP032 [*] Use f-string instead of `format` call 124 124 | 125 125 | async def c(): -UP032_0.py:126:12: UP032 [*] Use f-string instead of `format` call +error[UP032]: 126:12: [*] Use f-string instead of `format` call + + --> UP032_0.py:126:12 | 125 | async def c(): 126 | return "{}".format(1 + await 3) - | ^^^^^^^^^^^^^^^^^^^^^^^^ UP032 + | ^^^^^^^^^^^^^^^^^^^^^^^^ | = help: Convert to f-string - ℹ Safe fix 123 123 | 124 124 | @@ -926,15 +968,16 @@ UP032_0.py:126:12: UP032 [*] Use f-string instead of `format` call 128 128 | 129 129 | "{}".format(1 * 2) -UP032_0.py:129:1: UP032 [*] Use f-string instead of `format` call +error[UP032]: 129:1: [*] Use f-string instead of `format` call + + --> UP032_0.py:129:1 | 129 | "{}".format(1 * 2) - | ^^^^^^^^^^^^^^^^^^ UP032 + | ^^^^^^^^^^^^^^^^^^ 130 | 131 | ### | = help: Convert to f-string - ℹ Safe fix 126 126 | return "{}".format(1 + await 3) 127 127 | @@ -945,19 +988,20 @@ UP032_0.py:129:1: UP032 [*] Use f-string instead of `format` call 131 131 | ### 132 132 | # Non-errors -UP032_0.py:160:1: UP032 [*] Use f-string instead of `format` call +error[UP032]: 160:1: [*] Use f-string instead of `format` call + + --> UP032_0.py:159:1 | 158 | r'"\N{snowman} {}".format(a)' 159 | 160 | / "123456789 {}".format( 161 | | 11111111111111111111111111111111111111111111111111111111111111111111111111, 162 | | ) - | |_^ UP032 + | |_^ 163 | 164 | """ | = help: Convert to f-string - ℹ Safe fix 157 157 | 158 158 | r'"\N{snowman} {}".format(a)' @@ -970,7 +1014,9 @@ UP032_0.py:160:1: UP032 [*] Use f-string instead of `format` call 164 162 | """ 165 163 | {} -UP032_0.py:164:1: UP032 [*] Use f-string instead of `format` call +error[UP032]: 164:1: [*] Use f-string instead of `format` call + + --> UP032_0.py:163:1 | 162 | ) 163 | @@ -983,12 +1029,11 @@ UP032_0.py:164:1: UP032 [*] Use f-string instead of `format` call 170 | | 2, 171 | | 111111111111111111111111111111111111111111111111111111111111111111111111111111111111111, 172 | | ) - | |_^ UP032 + | |_^ 173 | 174 | aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = """{} | = help: Convert to f-string - ℹ Safe fix 161 161 | 11111111111111111111111111111111111111111111111111111111111111111111111111, 162 162 | ) @@ -1010,7 +1055,9 @@ UP032_0.py:164:1: UP032 [*] Use f-string instead of `format` call 174 170 | aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = """{} 175 171 | """.format( -UP032_0.py:174:84: UP032 [*] Use f-string instead of `format` call +error[UP032]: 174:84: [*] Use f-string instead of `format` call + + --> UP032_0.py:174:84 | 172 | ) 173 | @@ -1019,12 +1066,11 @@ UP032_0.py:174:84: UP032 [*] Use f-string instead of `format` call 175 | | """.format( 176 | | 111111 177 | | ) - | |_^ UP032 + | |_^ 178 | 179 | "{}".format( | = help: Convert to f-string - ℹ Safe fix 171 171 | 111111111111111111111111111111111111111111111111111111111111111111111111111111111111111, 172 172 | ) @@ -1039,28 +1085,30 @@ UP032_0.py:174:84: UP032 [*] Use f-string instead of `format` call 179 177 | "{}".format( 180 178 | [ -UP032_0.py:202:1: UP032 Use f-string instead of `format` call +error[UP032]: 202:1: Use f-string instead of `format` call + + --> UP032_0.py:201:1 | 200 | "{}".format(**c) 201 | 202 | / "{}".format( 203 | | 1 # comment 204 | | ) - | |_^ UP032 + | |_^ | = help: Convert to f-string +error[UP032]: 209:1: [*] Use f-string instead of `format` call -UP032_0.py:209:1: UP032 [*] Use f-string instead of `format` call + --> UP032_0.py:208:38 | 207 | # The fixed string will exceed the line length, but it's still smaller than the 208 | # existing line length, so it's fine. 209 | "".format(self.internal_ids, self.external_ids, self.properties, self.tags, self.others) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP032 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 210 | 211 | # When fixing, trim the trailing empty string. | = help: Convert to f-string - ℹ Safe fix 206 206 | 207 207 | # The fixed string will exceed the line length, but it's still smaller than the @@ -1071,18 +1119,19 @@ UP032_0.py:209:1: UP032 [*] Use f-string instead of `format` call 211 211 | # When fixing, trim the trailing empty string. 212 212 | raise ValueError("Conflicting configuration dicts: {!r} {!r}" -UP032_0.py:212:18: UP032 [*] Use f-string instead of `format` call +error[UP032]: 212:18: [*] Use f-string instead of `format` call + + --> UP032_0.py:212:18 | 211 | # When fixing, trim the trailing empty string. 212 | raise ValueError("Conflicting configuration dicts: {!r} {!r}" | __________________^ 213 | | "".format(new_dict, d)) - | |_______________________________________^ UP032 + | |_______________________________________^ 214 | 215 | # When fixing, trim the trailing empty string. | = help: Convert to f-string - ℹ Safe fix 209 209 | "".format(self.internal_ids, self.external_ids, self.properties, self.tags, self.others) 210 210 | @@ -1094,18 +1143,19 @@ UP032_0.py:212:18: UP032 [*] Use f-string instead of `format` call 215 214 | # When fixing, trim the trailing empty string. 216 215 | raise ValueError("Conflicting configuration dicts: {!r} {!r}" -UP032_0.py:216:18: UP032 [*] Use f-string instead of `format` call +error[UP032]: 216:18: [*] Use f-string instead of `format` call + + --> UP032_0.py:216:18 | 215 | # When fixing, trim the trailing empty string. 216 | raise ValueError("Conflicting configuration dicts: {!r} {!r}" | __________________^ 217 | | .format(new_dict, d)) - | |_____________________________________^ UP032 + | |_____________________________________^ 218 | 219 | raise ValueError( | = help: Convert to f-string - ℹ Safe fix 213 213 | "".format(new_dict, d)) 214 214 | @@ -1118,17 +1168,18 @@ UP032_0.py:216:18: UP032 [*] Use f-string instead of `format` call 219 219 | raise ValueError( 220 220 | "Conflicting configuration dicts: {!r} {!r}" -UP032_0.py:220:5: UP032 [*] Use f-string instead of `format` call +error[UP032]: 220:5: [*] Use f-string instead of `format` call + + --> UP032_0.py:220:5 | 219 | raise ValueError( 220 | "Conflicting configuration dicts: {!r} {!r}" | _____^ 221 | | "".format(new_dict, d) - | |__________________________^ UP032 + | |__________________________^ 222 | ) | = help: Convert to f-string - ℹ Safe fix 217 217 | .format(new_dict, d)) 218 218 | @@ -1140,18 +1191,19 @@ UP032_0.py:220:5: UP032 [*] Use f-string instead of `format` call 223 222 | 224 223 | raise ValueError( -UP032_0.py:225:5: UP032 [*] Use f-string instead of `format` call +error[UP032]: 225:5: [*] Use f-string instead of `format` call + + --> UP032_0.py:225:5 | 224 | raise ValueError( 225 | "Conflicting configuration dicts: {!r} {!r}" | _____^ 226 | | "".format(new_dict, d) - | |__________________________^ UP032 + | |__________________________^ 227 | 228 | ) | = help: Convert to f-string - ℹ Safe fix 222 222 | ) 223 223 | @@ -1163,19 +1215,20 @@ UP032_0.py:225:5: UP032 [*] Use f-string instead of `format` call 228 227 | ) 229 228 | -UP032_0.py:231:1: UP032 [*] Use f-string instead of `format` call +error[UP032]: 231:1: [*] Use f-string instead of `format` call + + --> UP032_0.py:230:123 | 230 | # The first string will be converted to an f-string and the curly braces in the second should be converted to be unescaped 231 | / ( 232 | | "{}" 233 | | "{{}}" 234 | | ).format(a) - | |___________^ UP032 + | |___________^ 235 | 236 | ("{}" "{{}}").format(a) | = help: Convert to f-string - ℹ Safe fix 229 229 | 230 230 | # The first string will be converted to an f-string and the curly braces in the second should be converted to be unescaped @@ -1189,15 +1242,16 @@ UP032_0.py:231:1: UP032 [*] Use f-string instead of `format` call 236 236 | ("{}" "{{}}").format(a) 237 237 | -UP032_0.py:236:1: UP032 [*] Use f-string instead of `format` call +error[UP032]: 236:1: [*] Use f-string instead of `format` call + + --> UP032_0.py:235:1 | 234 | ).format(a) 235 | 236 | ("{}" "{{}}").format(a) - | ^^^^^^^^^^^^^^^^^^^^^^^ UP032 + | ^^^^^^^^^^^^^^^^^^^^^^^ | = help: Convert to f-string - ℹ Safe fix 233 233 | "{{}}" 234 234 | ).format(a) @@ -1208,19 +1262,20 @@ UP032_0.py:236:1: UP032 [*] Use f-string instead of `format` call 238 238 | 239 239 | # Both strings will be converted to an f-string and the curly braces in the second should left escaped -UP032_0.py:240:1: UP032 [*] Use f-string instead of `format` call +error[UP032]: 240:1: [*] Use f-string instead of `format` call + + --> UP032_0.py:239:103 | 239 | # Both strings will be converted to an f-string and the curly braces in the second should left escaped 240 | / ( 241 | | "{}" 242 | | "{{{}}}" 243 | | ).format(a, b) - | |______________^ UP032 + | |______________^ 244 | 245 | ("{}" "{{{}}}").format(a, b) | = help: Convert to f-string - ℹ Safe fix 238 238 | 239 239 | # Both strings will be converted to an f-string and the curly braces in the second should left escaped @@ -1235,17 +1290,18 @@ UP032_0.py:240:1: UP032 [*] Use f-string instead of `format` call 245 245 | ("{}" "{{{}}}").format(a, b) 246 246 | -UP032_0.py:245:1: UP032 [*] Use f-string instead of `format` call +error[UP032]: 245:1: [*] Use f-string instead of `format` call + + --> UP032_0.py:244:1 | 243 | ).format(a, b) 244 | 245 | ("{}" "{{{}}}").format(a, b) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP032 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 246 | 247 | # The dictionary should be parenthesized. | = help: Convert to f-string - ℹ Safe fix 242 242 | "{{{}}}" 243 243 | ).format(a, b) @@ -1256,16 +1312,17 @@ UP032_0.py:245:1: UP032 [*] Use f-string instead of `format` call 247 247 | # The dictionary should be parenthesized. 248 248 | "{}".format({0: 1}[0]) -UP032_0.py:248:1: UP032 [*] Use f-string instead of `format` call +error[UP032]: 248:1: [*] Use f-string instead of `format` call + + --> UP032_0.py:247:42 | 247 | # The dictionary should be parenthesized. 248 | "{}".format({0: 1}[0]) - | ^^^^^^^^^^^^^^^^^^^^^^ UP032 + | ^^^^^^^^^^^^^^^^^^^^^^ 249 | 250 | # The dictionary should be parenthesized. | = help: Convert to f-string - ℹ Safe fix 245 245 | ("{}" "{{{}}}").format(a, b) 246 246 | @@ -1276,16 +1333,17 @@ UP032_0.py:248:1: UP032 [*] Use f-string instead of `format` call 250 250 | # The dictionary should be parenthesized. 251 251 | "{}".format({0: 1}.bar) -UP032_0.py:251:1: UP032 [*] Use f-string instead of `format` call +error[UP032]: 251:1: [*] Use f-string instead of `format` call + + --> UP032_0.py:250:42 | 250 | # The dictionary should be parenthesized. 251 | "{}".format({0: 1}.bar) - | ^^^^^^^^^^^^^^^^^^^^^^^ UP032 + | ^^^^^^^^^^^^^^^^^^^^^^^ 252 | 253 | # The dictionary should be parenthesized. | = help: Convert to f-string - ℹ Safe fix 248 248 | "{}".format({0: 1}[0]) 249 249 | @@ -1296,16 +1354,17 @@ UP032_0.py:251:1: UP032 [*] Use f-string instead of `format` call 253 253 | # The dictionary should be parenthesized. 254 254 | "{}".format({0: 1}()) -UP032_0.py:254:1: UP032 [*] Use f-string instead of `format` call +error[UP032]: 254:1: [*] Use f-string instead of `format` call + + --> UP032_0.py:253:42 | 253 | # The dictionary should be parenthesized. 254 | "{}".format({0: 1}()) - | ^^^^^^^^^^^^^^^^^^^^^ UP032 + | ^^^^^^^^^^^^^^^^^^^^^ 255 | 256 | # The string shouldn't be converted, since it would require repeating the function call. | = help: Convert to f-string - ℹ Safe fix 251 251 | "{}".format({0: 1}.bar) 252 252 | @@ -1316,16 +1375,17 @@ UP032_0.py:254:1: UP032 [*] Use f-string instead of `format` call 256 256 | # The string shouldn't be converted, since it would require repeating the function call. 257 257 | "{x} {x}".format(x=foo()) -UP032_0.py:261:1: UP032 [*] Use f-string instead of `format` call +error[UP032]: 261:1: [*] Use f-string instead of `format` call + + --> UP032_0.py:260:90 | 260 | # The string _should_ be converted, since the function call is repeated in the arguments. 261 | "{0} {1}".format(foo(), foo()) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP032 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 262 | 263 | # The call should be removed, but the string itself should remain. | = help: Convert to f-string - ℹ Safe fix 258 258 | "{0} {0}".format(foo()) 259 259 | @@ -1336,16 +1396,17 @@ UP032_0.py:261:1: UP032 [*] Use f-string instead of `format` call 263 263 | # The call should be removed, but the string itself should remain. 264 264 | ''.format(self.project) -UP032_0.py:264:1: UP032 [*] Use f-string instead of `format` call +error[UP032]: 264:1: [*] Use f-string instead of `format` call + + --> UP032_0.py:263:67 | 263 | # The call should be removed, but the string itself should remain. 264 | ''.format(self.project) - | ^^^^^^^^^^^^^^^^^^^^^^^ UP032 + | ^^^^^^^^^^^^^^^^^^^^^^^ 265 | 266 | # The call should be removed, but the string itself should remain. | = help: Convert to f-string - ℹ Safe fix 261 261 | "{0} {1}".format(foo(), foo()) 262 262 | @@ -1356,16 +1417,17 @@ UP032_0.py:264:1: UP032 [*] Use f-string instead of `format` call 266 266 | # The call should be removed, but the string itself should remain. 267 267 | "".format(self.project) -UP032_0.py:267:1: UP032 [*] Use f-string instead of `format` call +error[UP032]: 267:1: [*] Use f-string instead of `format` call + + --> UP032_0.py:266:67 | 266 | # The call should be removed, but the string itself should remain. 267 | "".format(self.project) - | ^^^^^^^^^^^^^^^^^^^^^^^ UP032 + | ^^^^^^^^^^^^^^^^^^^^^^^ 268 | 269 | # Not a valid type annotation but this test shouldn't result in a panic. | = help: Convert to f-string - ℹ Safe fix 264 264 | ''.format(self.project) 265 265 | @@ -1376,15 +1438,16 @@ UP032_0.py:267:1: UP032 [*] Use f-string instead of `format` call 269 269 | # Not a valid type annotation but this test shouldn't result in a panic. 270 270 | # Refer: https://github.com/astral-sh/ruff/issues/11736 -UP032_0.py:271:5: UP032 [*] Use f-string instead of `format` call +error[UP032]: 271:5: [*] Use f-string instead of `format` call + + --> UP032_0.py:271:5 | 269 | # Not a valid type annotation but this test shouldn't result in a panic. 270 | # Refer: https://github.com/astral-sh/ruff/issues/11736 271 | x: "'{} + {}'.format(x, y)" - | ^^^^^^^^^^^^^^^^^^^^^^ UP032 + | ^^^^^^^^^^^^^^^^^^^^^^ | = help: Convert to f-string - ℹ Safe fix 268 268 | 269 269 | # Not a valid type annotation but this test shouldn't result in a panic. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP032_1.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP032_1.py.snap index 95edd56b4e..6551a9ae77 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP032_1.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP032_1.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -error[UP032]: UP032_1.py:1:1: [*] Use f-string instead of `format` call +error[UP032]: 1:1: [*] Use f-string instead of `format` call + --> UP032_1.py:1:1 | 1 | "{} {}".format(a, b) # Intentionally at start-of-file, to ensure graceful handling. | ^^^^^^^^^^^^^^^^^^^^ diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP032_2.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP032_2.py.snap index d95c34ce35..9b5b0afd85 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP032_2.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP032_2.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -error[UP032]: UP032_2.py:2:1: [*] Use f-string instead of `format` call +error[UP032]: 2:1: [*] Use f-string instead of `format` call + --> UP032_2.py:1:9 | 1 | # Errors 2 | "{.real}".format(1) @@ -19,8 +20,9 @@ error[UP032]: UP032_2.py:2:1: [*] Use f-string instead of `format` call 4 4 | "{a.real}".format(a=1) 5 5 | -error[UP032]: UP032_2.py:3:1: [*] Use f-string instead of `format` call +error[UP032]: 3:1: [*] Use f-string instead of `format` call + --> UP032_2.py:2:20 | 1 | # Errors 2 | "{.real}".format(1) @@ -38,8 +40,9 @@ error[UP032]: UP032_2.py:3:1: [*] Use f-string instead of `format` call 5 5 | 6 6 | "{.real}".format(1.0) -error[UP032]: UP032_2.py:4:1: [*] Use f-string instead of `format` call +error[UP032]: 4:1: [*] Use f-string instead of `format` call + --> UP032_2.py:3:21 | 2 | "{.real}".format(1) 3 | "{0.real}".format(1) @@ -59,8 +62,9 @@ error[UP032]: UP032_2.py:4:1: [*] Use f-string instead of `format` call 6 6 | "{.real}".format(1.0) 7 7 | "{0.real}".format(1.0) -error[UP032]: UP032_2.py:6:1: [*] Use f-string instead of `format` call +error[UP032]: 6:1: [*] Use f-string instead of `format` call + --> UP032_2.py:5:1 | 4 | "{a.real}".format(a=1) 5 | @@ -80,8 +84,9 @@ error[UP032]: UP032_2.py:6:1: [*] Use f-string instead of `format` call 8 8 | "{a.real}".format(a=1.0) 9 9 | -error[UP032]: UP032_2.py:7:1: [*] Use f-string instead of `format` call +error[UP032]: 7:1: [*] Use f-string instead of `format` call + --> UP032_2.py:6:22 | 6 | "{.real}".format(1.0) 7 | "{0.real}".format(1.0) @@ -99,8 +104,9 @@ error[UP032]: UP032_2.py:7:1: [*] Use f-string instead of `format` call 9 9 | 10 10 | "{.real}".format(1j) -error[UP032]: UP032_2.py:8:1: [*] Use f-string instead of `format` call +error[UP032]: 8:1: [*] Use f-string instead of `format` call + --> UP032_2.py:7:23 | 6 | "{.real}".format(1.0) 7 | "{0.real}".format(1.0) @@ -120,8 +126,9 @@ error[UP032]: UP032_2.py:8:1: [*] Use f-string instead of `format` call 10 10 | "{.real}".format(1j) 11 11 | "{0.real}".format(1j) -error[UP032]: UP032_2.py:10:1: [*] Use f-string instead of `format` call +error[UP032]: 10:1: [*] Use f-string instead of `format` call + --> UP032_2.py:9:1 | 8 | "{a.real}".format(a=1.0) 9 | @@ -141,8 +148,9 @@ error[UP032]: UP032_2.py:10:1: [*] Use f-string instead of `format` call 12 12 | "{a.real}".format(a=1j) 13 13 | -error[UP032]: UP032_2.py:11:1: [*] Use f-string instead of `format` call +error[UP032]: 11:1: [*] Use f-string instead of `format` call + --> UP032_2.py:10:21 | 10 | "{.real}".format(1j) 11 | "{0.real}".format(1j) @@ -160,8 +168,9 @@ error[UP032]: UP032_2.py:11:1: [*] Use f-string instead of `format` call 13 13 | 14 14 | "{.real}".format(0b01) -error[UP032]: UP032_2.py:12:1: [*] Use f-string instead of `format` call +error[UP032]: 12:1: [*] Use f-string instead of `format` call + --> UP032_2.py:11:22 | 10 | "{.real}".format(1j) 11 | "{0.real}".format(1j) @@ -181,8 +190,9 @@ error[UP032]: UP032_2.py:12:1: [*] Use f-string instead of `format` call 14 14 | "{.real}".format(0b01) 15 15 | "{0.real}".format(0b01) -error[UP032]: UP032_2.py:14:1: [*] Use f-string instead of `format` call +error[UP032]: 14:1: [*] Use f-string instead of `format` call + --> UP032_2.py:13:1 | 12 | "{a.real}".format(a=1j) 13 | @@ -202,8 +212,9 @@ error[UP032]: UP032_2.py:14:1: [*] Use f-string instead of `format` call 16 16 | "{a.real}".format(a=0b01) 17 17 | -error[UP032]: UP032_2.py:15:1: [*] Use f-string instead of `format` call +error[UP032]: 15:1: [*] Use f-string instead of `format` call + --> UP032_2.py:14:23 | 14 | "{.real}".format(0b01) 15 | "{0.real}".format(0b01) @@ -221,8 +232,9 @@ error[UP032]: UP032_2.py:15:1: [*] Use f-string instead of `format` call 17 17 | 18 18 | "{}".format(1 + 2) -error[UP032]: UP032_2.py:16:1: [*] Use f-string instead of `format` call +error[UP032]: 16:1: [*] Use f-string instead of `format` call + --> UP032_2.py:15:24 | 14 | "{.real}".format(0b01) 15 | "{0.real}".format(0b01) @@ -242,8 +254,9 @@ error[UP032]: UP032_2.py:16:1: [*] Use f-string instead of `format` call 18 18 | "{}".format(1 + 2) 19 19 | "{}".format([1, 2]) -error[UP032]: UP032_2.py:18:1: [*] Use f-string instead of `format` call +error[UP032]: 18:1: [*] Use f-string instead of `format` call + --> UP032_2.py:17:1 | 16 | "{a.real}".format(a=0b01) 17 | @@ -263,8 +276,9 @@ error[UP032]: UP032_2.py:18:1: [*] Use f-string instead of `format` call 20 20 | "{}".format({1, 2}) 21 21 | "{}".format({1: 2, 3: 4}) -error[UP032]: UP032_2.py:19:1: [*] Use f-string instead of `format` call +error[UP032]: 19:1: [*] Use f-string instead of `format` call + --> UP032_2.py:18:19 | 18 | "{}".format(1 + 2) 19 | "{}".format([1, 2]) @@ -283,8 +297,9 @@ error[UP032]: UP032_2.py:19:1: [*] Use f-string instead of `format` call 21 21 | "{}".format({1: 2, 3: 4}) 22 22 | "{}".format((i for i in range(2))) -error[UP032]: UP032_2.py:20:1: [*] Use f-string instead of `format` call +error[UP032]: 20:1: [*] Use f-string instead of `format` call + --> UP032_2.py:19:20 | 18 | "{}".format(1 + 2) 19 | "{}".format([1, 2]) @@ -304,8 +319,9 @@ error[UP032]: UP032_2.py:20:1: [*] Use f-string instead of `format` call 22 22 | "{}".format((i for i in range(2))) 23 23 | -error[UP032]: UP032_2.py:21:1: [*] Use f-string instead of `format` call +error[UP032]: 21:1: [*] Use f-string instead of `format` call + --> UP032_2.py:20:20 | 19 | "{}".format([1, 2]) 20 | "{}".format({1, 2}) @@ -324,8 +340,9 @@ error[UP032]: UP032_2.py:21:1: [*] Use f-string instead of `format` call 23 23 | 24 24 | "{.real}".format(1 + 2) -error[UP032]: UP032_2.py:22:1: [*] Use f-string instead of `format` call +error[UP032]: 22:1: [*] Use f-string instead of `format` call + --> UP032_2.py:21:26 | 20 | "{}".format({1, 2}) 21 | "{}".format({1: 2, 3: 4}) @@ -345,8 +362,9 @@ error[UP032]: UP032_2.py:22:1: [*] Use f-string instead of `format` call 24 24 | "{.real}".format(1 + 2) 25 25 | "{.real}".format([1, 2]) -error[UP032]: UP032_2.py:24:1: [*] Use f-string instead of `format` call +error[UP032]: 24:1: [*] Use f-string instead of `format` call + --> UP032_2.py:23:1 | 22 | "{}".format((i for i in range(2))) 23 | @@ -366,8 +384,9 @@ error[UP032]: UP032_2.py:24:1: [*] Use f-string instead of `format` call 26 26 | "{.real}".format({1, 2}) 27 27 | "{.real}".format({1: 2, 3: 4}) -error[UP032]: UP032_2.py:25:1: [*] Use f-string instead of `format` call +error[UP032]: 25:1: [*] Use f-string instead of `format` call + --> UP032_2.py:24:24 | 24 | "{.real}".format(1 + 2) 25 | "{.real}".format([1, 2]) @@ -386,8 +405,9 @@ error[UP032]: UP032_2.py:25:1: [*] Use f-string instead of `format` call 27 27 | "{.real}".format({1: 2, 3: 4}) 28 28 | "{}".format((i for i in range(2))) -error[UP032]: UP032_2.py:26:1: [*] Use f-string instead of `format` call +error[UP032]: 26:1: [*] Use f-string instead of `format` call + --> UP032_2.py:25:25 | 24 | "{.real}".format(1 + 2) 25 | "{.real}".format([1, 2]) @@ -406,8 +426,9 @@ error[UP032]: UP032_2.py:26:1: [*] Use f-string instead of `format` call 27 27 | "{.real}".format({1: 2, 3: 4}) 28 28 | "{}".format((i for i in range(2))) -error[UP032]: UP032_2.py:27:1: [*] Use f-string instead of `format` call +error[UP032]: 27:1: [*] Use f-string instead of `format` call + --> UP032_2.py:26:25 | 25 | "{.real}".format([1, 2]) 26 | "{.real}".format({1, 2}) @@ -424,8 +445,9 @@ error[UP032]: UP032_2.py:27:1: [*] Use f-string instead of `format` call 27 |+f"{({1: 2, 3: 4}).real}" 28 28 | "{}".format((i for i in range(2))) -error[UP032]: UP032_2.py:28:1: [*] Use f-string instead of `format` call +error[UP032]: 28:1: [*] Use f-string instead of `format` call + --> UP032_2.py:27:31 | 26 | "{.real}".format({1, 2}) 27 | "{.real}".format({1: 2, 3: 4}) diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP033_0.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP033_0.py.snap index d99e499791..86a33a26ff 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP033_0.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP033_0.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -error[UP033]: UP033_0.py:4:21: [*] Use `@functools.cache` instead of `@functools.lru_cache(maxsize=None)` +error[UP033]: 4:21: [*] Use `@functools.cache` instead of `@functools.lru_cache(maxsize=None)` + --> UP033_0.py:4:21 | 4 | @functools.lru_cache(maxsize=None) | ^^^^^^^^^^^^^^ @@ -20,8 +21,9 @@ error[UP033]: UP033_0.py:4:21: [*] Use `@functools.cache` instead of `@functools 6 6 | pass 7 7 | -error[UP033]: UP033_0.py:10:21: [*] Use `@functools.cache` instead of `@functools.lru_cache(maxsize=None)` +error[UP033]: 10:21: [*] Use `@functools.cache` instead of `@functools.lru_cache(maxsize=None)` + --> UP033_0.py:10:21 | 9 | @other_decorator 10 | @functools.lru_cache(maxsize=None) @@ -40,8 +42,9 @@ error[UP033]: UP033_0.py:10:21: [*] Use `@functools.cache` instead of `@functool 12 12 | pass 13 13 | -error[UP033]: UP033_0.py:15:21: [*] Use `@functools.cache` instead of `@functools.lru_cache(maxsize=None)` +error[UP033]: 15:21: [*] Use `@functools.cache` instead of `@functools.lru_cache(maxsize=None)` + --> UP033_0.py:15:21 | 15 | @functools.lru_cache(maxsize=None) | ^^^^^^^^^^^^^^ diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP033_1.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP033_1.py.snap index cd924d1a7f..8094f064d1 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP033_1.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP033_1.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -error[UP033]: UP033_1.py:4:11: [*] Use `@functools.cache` instead of `@functools.lru_cache(maxsize=None)` +error[UP033]: 4:11: [*] Use `@functools.cache` instead of `@functools.lru_cache(maxsize=None)` + --> UP033_1.py:4:11 | 4 | @lru_cache(maxsize=None) | ^^^^^^^^^^^^^^ @@ -21,8 +22,9 @@ error[UP033]: UP033_1.py:4:11: [*] Use `@functools.cache` instead of `@functools 6 6 | pass 7 7 | -error[UP033]: UP033_1.py:10:11: [*] Use `@functools.cache` instead of `@functools.lru_cache(maxsize=None)` +error[UP033]: 10:11: [*] Use `@functools.cache` instead of `@functools.lru_cache(maxsize=None)` + --> UP033_1.py:10:11 | 9 | @other_decorator 10 | @lru_cache(maxsize=None) @@ -47,8 +49,9 @@ error[UP033]: UP033_1.py:10:11: [*] Use `@functools.cache` instead of `@functool 12 12 | pass 13 13 | -error[UP033]: UP033_1.py:15:11: [*] Use `@functools.cache` instead of `@functools.lru_cache(maxsize=None)` +error[UP033]: 15:11: [*] Use `@functools.cache` instead of `@functools.lru_cache(maxsize=None)` + --> UP033_1.py:15:11 | 15 | @lru_cache(maxsize=None) | ^^^^^^^^^^^^^^ diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP034.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP034.py.snap index 2e4b574ff7..35cabaf48e 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP034.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP034.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -error[UP034]: UP034.py:2:7: [*] Avoid extraneous parentheses +error[UP034]: 2:7: [*] Avoid extraneous parentheses + --> UP034.py:2:7 | 1 | # UP034 2 | print(("foo")) @@ -19,8 +20,9 @@ error[UP034]: UP034.py:2:7: [*] Avoid extraneous parentheses 4 4 | # UP034 5 5 | print(("hell((goodybe))o")) -error[UP034]: UP034.py:5:7: [*] Avoid extraneous parentheses +error[UP034]: 5:7: [*] Avoid extraneous parentheses + --> UP034.py:5:7 | 4 | # UP034 5 | print(("hell((goodybe))o")) @@ -39,8 +41,9 @@ error[UP034]: UP034.py:5:7: [*] Avoid extraneous parentheses 7 7 | # UP034 8 8 | print((("foo"))) -error[UP034]: UP034.py:8:7: [*] Avoid extraneous parentheses +error[UP034]: 8:7: [*] Avoid extraneous parentheses + --> UP034.py:8:7 | 7 | # UP034 8 | print((("foo"))) @@ -59,8 +62,9 @@ error[UP034]: UP034.py:8:7: [*] Avoid extraneous parentheses 10 10 | # UP034 11 11 | print((((1)))) -error[UP034]: UP034.py:11:7: [*] Avoid extraneous parentheses +error[UP034]: 11:7: [*] Avoid extraneous parentheses + --> UP034.py:11:7 | 10 | # UP034 11 | print((((1)))) @@ -79,8 +83,9 @@ error[UP034]: UP034.py:11:7: [*] Avoid extraneous parentheses 13 13 | # UP034 14 14 | print(("foo{}".format(1))) -error[UP034]: UP034.py:14:7: [*] Avoid extraneous parentheses +error[UP034]: 14:7: [*] Avoid extraneous parentheses + --> UP034.py:14:7 | 13 | # UP034 14 | print(("foo{}".format(1))) @@ -99,8 +104,9 @@ error[UP034]: UP034.py:14:7: [*] Avoid extraneous parentheses 16 16 | # UP034 17 17 | print( -error[UP034]: UP034.py:18:5: [*] Avoid extraneous parentheses +error[UP034]: 18:5: [*] Avoid extraneous parentheses + --> UP034.py:18:5 | 16 | # UP034 17 | print( @@ -119,8 +125,9 @@ error[UP034]: UP034.py:18:5: [*] Avoid extraneous parentheses 20 20 | 21 21 | # UP034 -error[UP034]: UP034.py:23:5: [*] Avoid extraneous parentheses +error[UP034]: 23:5: [*] Avoid extraneous parentheses + --> UP034.py:23:5 | 21 | # UP034 22 | print( @@ -145,8 +152,9 @@ error[UP034]: UP034.py:23:5: [*] Avoid extraneous parentheses 27 27 | 28 28 | # UP034 -error[UP034]: UP034.py:30:13: [*] Avoid extraneous parentheses +error[UP034]: 30:13: [*] Avoid extraneous parentheses + --> UP034.py:30:13 | 28 | # UP034 29 | def f(): @@ -166,8 +174,9 @@ error[UP034]: UP034.py:30:13: [*] Avoid extraneous parentheses 32 32 | # UP034 33 33 | if True: -error[UP034]: UP034.py:35:9: [*] Avoid extraneous parentheses +error[UP034]: 35:9: [*] Avoid extraneous parentheses + --> UP034.py:35:9 | 33 | if True: 34 | print( @@ -186,8 +195,9 @@ error[UP034]: UP034.py:35:9: [*] Avoid extraneous parentheses 37 37 | 38 38 | # UP034 -error[UP034]: UP034.py:39:7: [*] Avoid extraneous parentheses +error[UP034]: 39:7: [*] Avoid extraneous parentheses + --> UP034.py:39:7 | 38 | # UP034 39 | print((x for x in range(3))) diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP035.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP035.py.snap index e83b5d88e3..596d0390f2 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP035.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP035.py.snap @@ -1,16 +1,17 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -UP035.py:2:1: UP035 [*] Import from `collections.abc` instead: `Mapping` +error[UP035]: 2:1: [*] Import from `collections.abc` instead: `Mapping` + + --> UP035.py:1:8 | 1 | # UP035 2 | from collections import Mapping - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 3 | 4 | from collections import Mapping as MAP | = help: Import from `collections.abc` - ℹ Safe fix 1 1 | # UP035 2 |-from collections import Mapping @@ -19,17 +20,18 @@ UP035.py:2:1: UP035 [*] Import from `collections.abc` instead: `Mapping` 4 4 | from collections import Mapping as MAP 5 5 | -UP035.py:4:1: UP035 [*] Import from `collections.abc` instead: `Mapping` +error[UP035]: 4:1: [*] Import from `collections.abc` instead: `Mapping` + + --> UP035.py:3:1 | 2 | from collections import Mapping 3 | 4 | from collections import Mapping as MAP - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 5 | 6 | from collections import Mapping, Sequence | = help: Import from `collections.abc` - ℹ Safe fix 1 1 | # UP035 2 2 | from collections import Mapping @@ -40,17 +42,18 @@ UP035.py:4:1: UP035 [*] Import from `collections.abc` instead: `Mapping` 6 6 | from collections import Mapping, Sequence 7 7 | -UP035.py:6:1: UP035 [*] Import from `collections.abc` instead: `Mapping`, `Sequence` +error[UP035]: 6:1: [*] Import from `collections.abc` instead: `Mapping`, `Sequence` + + --> UP035.py:5:1 | 4 | from collections import Mapping as MAP 5 | 6 | from collections import Mapping, Sequence - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 7 | 8 | from collections import Counter, Mapping | = help: Import from `collections.abc` - ℹ Safe fix 3 3 | 4 4 | from collections import Mapping as MAP @@ -61,17 +64,18 @@ UP035.py:6:1: UP035 [*] Import from `collections.abc` instead: `Mapping`, `Seque 8 8 | from collections import Counter, Mapping 9 9 | -UP035.py:8:1: UP035 [*] Import from `collections.abc` instead: `Mapping` +error[UP035]: 8:1: [*] Import from `collections.abc` instead: `Mapping` + + --> UP035.py:7:1 | 6 | from collections import Mapping, Sequence 7 | 8 | from collections import Counter, Mapping - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 9 | 10 | from collections import (Counter, Mapping) | = help: Import from `collections.abc` - ℹ Safe fix 5 5 | 6 6 | from collections import Mapping, Sequence @@ -83,17 +87,18 @@ UP035.py:8:1: UP035 [*] Import from `collections.abc` instead: `Mapping` 10 11 | from collections import (Counter, Mapping) 11 12 | -UP035.py:10:1: UP035 [*] Import from `collections.abc` instead: `Mapping` +error[UP035]: 10:1: [*] Import from `collections.abc` instead: `Mapping` + + --> UP035.py:9:1 | 8 | from collections import Counter, Mapping 9 | 10 | from collections import (Counter, Mapping) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 11 | 12 | from collections import (Counter, | = help: Import from `collections.abc` - ℹ Safe fix 7 7 | 8 8 | from collections import Counter, Mapping @@ -105,18 +110,19 @@ UP035.py:10:1: UP035 [*] Import from `collections.abc` instead: `Mapping` 12 13 | from collections import (Counter, 13 14 | Mapping) -UP035.py:12:1: UP035 [*] Import from `collections.abc` instead: `Mapping` +error[UP035]: 12:1: [*] Import from `collections.abc` instead: `Mapping` + + --> UP035.py:11:1 | 10 | from collections import (Counter, Mapping) 11 | 12 | / from collections import (Counter, 13 | | Mapping) - | |_________________________________^ UP035 + | |_________________________________^ 14 | 15 | from collections import Counter, \ | = help: Import from `collections.abc` - ℹ Safe fix 9 9 | 10 10 | from collections import (Counter, Mapping) @@ -129,18 +135,19 @@ UP035.py:12:1: UP035 [*] Import from `collections.abc` instead: `Mapping` 15 15 | from collections import Counter, \ 16 16 | Mapping -UP035.py:15:1: UP035 [*] Import from `collections.abc` instead: `Mapping` +error[UP035]: 15:1: [*] Import from `collections.abc` instead: `Mapping` + + --> UP035.py:14:1 | 13 | Mapping) 14 | 15 | / from collections import Counter, \ 16 | | Mapping - | |________________________________^ UP035 + | |________________________________^ 17 | 18 | from collections import Counter, Mapping, Sequence | = help: Import from `collections.abc` - ℹ Safe fix 12 12 | from collections import (Counter, 13 13 | Mapping) @@ -153,17 +160,18 @@ UP035.py:15:1: UP035 [*] Import from `collections.abc` instead: `Mapping` 18 18 | from collections import Counter, Mapping, Sequence 19 19 | -UP035.py:18:1: UP035 [*] Import from `collections.abc` instead: `Mapping`, `Sequence` +error[UP035]: 18:1: [*] Import from `collections.abc` instead: `Mapping`, `Sequence` + + --> UP035.py:17:1 | 16 | Mapping 17 | 18 | from collections import Counter, Mapping, Sequence - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 19 | 20 | from collections import Mapping as mapping, Counter | = help: Import from `collections.abc` - ℹ Safe fix 15 15 | from collections import Counter, \ 16 16 | Mapping @@ -175,17 +183,18 @@ UP035.py:18:1: UP035 [*] Import from `collections.abc` instead: `Mapping`, `Sequ 20 21 | from collections import Mapping as mapping, Counter 21 22 | -UP035.py:20:1: UP035 [*] Import from `collections.abc` instead: `Mapping` +error[UP035]: 20:1: [*] Import from `collections.abc` instead: `Mapping` + + --> UP035.py:19:1 | 18 | from collections import Counter, Mapping, Sequence 19 | 20 | from collections import Mapping as mapping, Counter - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 21 | 22 | if True: | = help: Import from `collections.abc` - ℹ Safe fix 17 17 | 18 18 | from collections import Counter, Mapping, Sequence @@ -197,16 +206,17 @@ UP035.py:20:1: UP035 [*] Import from `collections.abc` instead: `Mapping` 22 23 | if True: 23 24 | from collections import Mapping, Counter -UP035.py:23:5: UP035 [*] Import from `collections.abc` instead: `Mapping` +error[UP035]: 23:5: [*] Import from `collections.abc` instead: `Mapping` + + --> UP035.py:23:5 | 22 | if True: 23 | from collections import Mapping, Counter - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 24 | 25 | if True: | = help: Import from `collections.abc` - ℹ Safe fix 20 20 | from collections import Mapping as mapping, Counter 21 21 | @@ -218,17 +228,18 @@ UP035.py:23:5: UP035 [*] Import from `collections.abc` instead: `Mapping` 25 26 | if True: 26 27 | if True: -UP035.py:28:5: UP035 [*] Import from `collections.abc` instead: `Mapping` +error[UP035]: 28:5: [*] Import from `collections.abc` instead: `Mapping` + + --> UP035.py:28:5 | 26 | if True: 27 | pass 28 | from collections import Mapping, Counter - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 29 | 30 | if True: from collections import Mapping | = help: Import from `collections.abc` - ℹ Safe fix 25 25 | if True: 26 26 | if True: @@ -240,17 +251,18 @@ UP035.py:28:5: UP035 [*] Import from `collections.abc` instead: `Mapping` 30 31 | if True: from collections import Mapping 31 32 | -UP035.py:30:10: UP035 [*] Import from `collections.abc` instead: `Mapping` +error[UP035]: 30:10: [*] Import from `collections.abc` instead: `Mapping` + + --> UP035.py:30:10 | 28 | from collections import Mapping, Counter 29 | 30 | if True: from collections import Mapping - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 31 | 32 | import os | = help: Import from `collections.abc` - ℹ Safe fix 27 27 | pass 28 28 | from collections import Mapping, Counter @@ -261,15 +273,16 @@ UP035.py:30:10: UP035 [*] Import from `collections.abc` instead: `Mapping` 32 32 | import os 33 33 | from collections import Counter, Mapping -UP035.py:33:1: UP035 [*] Import from `collections.abc` instead: `Mapping` +error[UP035]: 33:1: [*] Import from `collections.abc` instead: `Mapping` + + --> UP035.py:32:10 | 32 | import os 33 | from collections import Counter, Mapping - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 34 | import sys | = help: Import from `collections.abc` - ℹ Safe fix 30 30 | if True: from collections import Mapping 31 31 | @@ -281,7 +294,9 @@ UP035.py:33:1: UP035 [*] Import from `collections.abc` instead: `Mapping` 35 36 | 36 37 | if True: -UP035.py:37:5: UP035 [*] Import from `collections.abc` instead: `Mapping`, `Callable` +error[UP035]: 37:5: [*] Import from `collections.abc` instead: `Mapping`, `Callable` + + --> UP035.py:37:5 | 36 | if True: 37 | from collections import ( @@ -291,12 +306,11 @@ UP035.py:37:5: UP035 [*] Import from `collections.abc` instead: `Mapping`, `Call 40 | | Bad, 41 | | Good, 42 | | ) - | |_____^ UP035 + | |_____^ 43 | 44 | from typing import Callable, Match, Pattern, List, OrderedDict, AbstractSet, ContextManager | = help: Import from `collections.abc` - ℹ Safe fix 35 35 | 36 36 | if True: @@ -311,17 +325,18 @@ UP035.py:37:5: UP035 [*] Import from `collections.abc` instead: `Mapping`, `Call 44 43 | from typing import Callable, Match, Pattern, List, OrderedDict, AbstractSet, ContextManager 45 44 | -UP035.py:44:1: UP035 [*] Import from `collections.abc` instead: `Callable` +error[UP035]: 44:1: [*] Import from `collections.abc` instead: `Callable` + + --> UP035.py:43:1 | 42 | ) 43 | 44 | from typing import Callable, Match, Pattern, List, OrderedDict, AbstractSet, ContextManager - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 45 | 46 | if True: from collections import ( | = help: Import from `collections.abc` - ℹ Safe fix 41 41 | Good, 42 42 | ) @@ -333,17 +348,18 @@ UP035.py:44:1: UP035 [*] Import from `collections.abc` instead: `Callable` 46 47 | if True: from collections import ( 47 48 | Mapping, Counter) -UP035.py:44:1: UP035 [*] Import from `collections` instead: `OrderedDict` +error[UP035]: 44:1: [*] Import from `collections` instead: `OrderedDict` + + --> UP035.py:43:1 | 42 | ) 43 | 44 | from typing import Callable, Match, Pattern, List, OrderedDict, AbstractSet, ContextManager - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 45 | 46 | if True: from collections import ( | = help: Import from `collections` - ℹ Safe fix 41 41 | Good, 42 42 | ) @@ -355,17 +371,18 @@ UP035.py:44:1: UP035 [*] Import from `collections` instead: `OrderedDict` 46 47 | if True: from collections import ( 47 48 | Mapping, Counter) -UP035.py:44:1: UP035 [*] Import from `re` instead: `Match`, `Pattern` +error[UP035]: 44:1: [*] Import from `re` instead: `Match`, `Pattern` + + --> UP035.py:43:1 | 42 | ) 43 | 44 | from typing import Callable, Match, Pattern, List, OrderedDict, AbstractSet, ContextManager - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 45 | 46 | if True: from collections import ( | = help: Import from `re` - ℹ Safe fix 41 41 | Good, 42 42 | ) @@ -377,69 +394,75 @@ UP035.py:44:1: UP035 [*] Import from `re` instead: `Match`, `Pattern` 46 47 | if True: from collections import ( 47 48 | Mapping, Counter) -UP035.py:44:1: UP035 `typing.List` is deprecated, use `list` instead +error[UP035]: 44:1: `typing.List` is deprecated, use `list` instead + + --> UP035.py:43:1 | 42 | ) 43 | 44 | from typing import Callable, Match, Pattern, List, OrderedDict, AbstractSet, ContextManager - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 45 | 46 | if True: from collections import ( | +error[UP035]: 44:1: `typing.AbstractSet` is deprecated, use `collections.abc.Set` instead -UP035.py:44:1: UP035 `typing.AbstractSet` is deprecated, use `collections.abc.Set` instead + --> UP035.py:43:1 | 42 | ) 43 | 44 | from typing import Callable, Match, Pattern, List, OrderedDict, AbstractSet, ContextManager - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 45 | 46 | if True: from collections import ( | +error[UP035]: 44:1: `typing.ContextManager` is deprecated, use `contextlib.AbstractContextManager` instead -UP035.py:44:1: UP035 `typing.ContextManager` is deprecated, use `contextlib.AbstractContextManager` instead + --> UP035.py:43:1 | 42 | ) 43 | 44 | from typing import Callable, Match, Pattern, List, OrderedDict, AbstractSet, ContextManager - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 45 | 46 | if True: from collections import ( | +error[UP035]: 46:10: Import from `collections.abc` instead: `Mapping` -UP035.py:46:10: UP035 Import from `collections.abc` instead: `Mapping` + --> UP035.py:46:10 | 44 | from typing import Callable, Match, Pattern, List, OrderedDict, AbstractSet, ContextManager 45 | 46 | if True: from collections import ( | __________^ 47 | | Mapping, Counter) - | |_____________________^ UP035 + | |_____________________^ 48 | 49 | # Bad imports from PYI027 that are now handled by PYI022 (UP035) | = help: Import from `collections.abc` +error[UP035]: 50:1: `typing.ContextManager` is deprecated, use `contextlib.AbstractContextManager` instead -UP035.py:50:1: UP035 `typing.ContextManager` is deprecated, use `contextlib.AbstractContextManager` instead + --> UP035.py:49:65 | 49 | # Bad imports from PYI027 that are now handled by PYI022 (UP035) 50 | from typing import ContextManager - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 51 | from typing import OrderedDict 52 | from typing_extensions import OrderedDict | +error[UP035]: 51:1: [*] Import from `collections` instead: `OrderedDict` -UP035.py:51:1: UP035 [*] Import from `collections` instead: `OrderedDict` + --> UP035.py:50:34 | 49 | # Bad imports from PYI027 that are now handled by PYI022 (UP035) 50 | from typing import ContextManager 51 | from typing import OrderedDict - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 52 | from typing_extensions import OrderedDict 53 | from typing import Callable | = help: Import from `collections` - ℹ Safe fix 48 48 | 49 49 | # Bad imports from PYI027 that are now handled by PYI022 (UP035) @@ -450,17 +473,18 @@ UP035.py:51:1: UP035 [*] Import from `collections` instead: `OrderedDict` 53 53 | from typing import Callable 54 54 | from typing import ByteString -UP035.py:52:1: UP035 [*] Import from `typing` instead: `OrderedDict` +error[UP035]: 52:1: [*] Import from `typing` instead: `OrderedDict` + + --> UP035.py:51:31 | 50 | from typing import ContextManager 51 | from typing import OrderedDict 52 | from typing_extensions import OrderedDict - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 53 | from typing import Callable 54 | from typing import ByteString | = help: Import from `typing` - ℹ Safe fix 49 49 | # Bad imports from PYI027 that are now handled by PYI022 (UP035) 50 50 | from typing import ContextManager @@ -471,17 +495,18 @@ UP035.py:52:1: UP035 [*] Import from `typing` instead: `OrderedDict` 54 54 | from typing import ByteString 55 55 | from typing import Container -UP035.py:53:1: UP035 [*] Import from `collections.abc` instead: `Callable` +error[UP035]: 53:1: [*] Import from `collections.abc` instead: `Callable` + + --> UP035.py:52:42 | 51 | from typing import OrderedDict 52 | from typing_extensions import OrderedDict 53 | from typing import Callable - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ 54 | from typing import ByteString 55 | from typing import Container | = help: Import from `collections.abc` - ℹ Safe fix 50 50 | from typing import ContextManager 51 51 | from typing import OrderedDict @@ -492,17 +517,18 @@ UP035.py:53:1: UP035 [*] Import from `collections.abc` instead: `Callable` 55 55 | from typing import Container 56 56 | from typing import Hashable -UP035.py:54:1: UP035 [*] Import from `collections.abc` instead: `ByteString` +error[UP035]: 54:1: [*] Import from `collections.abc` instead: `ByteString` + + --> UP035.py:53:28 | 52 | from typing_extensions import OrderedDict 53 | from typing import Callable 54 | from typing import ByteString - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 55 | from typing import Container 56 | from typing import Hashable | = help: Import from `collections.abc` - ℹ Safe fix 51 51 | from typing import OrderedDict 52 52 | from typing_extensions import OrderedDict @@ -513,17 +539,18 @@ UP035.py:54:1: UP035 [*] Import from `collections.abc` instead: `ByteString` 56 56 | from typing import Hashable 57 57 | from typing import ItemsView -UP035.py:55:1: UP035 [*] Import from `collections.abc` instead: `Container` +error[UP035]: 55:1: [*] Import from `collections.abc` instead: `Container` + + --> UP035.py:54:30 | 53 | from typing import Callable 54 | from typing import ByteString 55 | from typing import Container - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 56 | from typing import Hashable 57 | from typing import ItemsView | = help: Import from `collections.abc` - ℹ Safe fix 52 52 | from typing_extensions import OrderedDict 53 53 | from typing import Callable @@ -534,17 +561,18 @@ UP035.py:55:1: UP035 [*] Import from `collections.abc` instead: `Container` 57 57 | from typing import ItemsView 58 58 | from typing import Iterable -UP035.py:56:1: UP035 [*] Import from `collections.abc` instead: `Hashable` +error[UP035]: 56:1: [*] Import from `collections.abc` instead: `Hashable` + + --> UP035.py:55:29 | 54 | from typing import ByteString 55 | from typing import Container 56 | from typing import Hashable - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ 57 | from typing import ItemsView 58 | from typing import Iterable | = help: Import from `collections.abc` - ℹ Safe fix 53 53 | from typing import Callable 54 54 | from typing import ByteString @@ -555,17 +583,18 @@ UP035.py:56:1: UP035 [*] Import from `collections.abc` instead: `Hashable` 58 58 | from typing import Iterable 59 59 | from typing import Iterator -UP035.py:57:1: UP035 [*] Import from `collections.abc` instead: `ItemsView` +error[UP035]: 57:1: [*] Import from `collections.abc` instead: `ItemsView` + + --> UP035.py:56:28 | 55 | from typing import Container 56 | from typing import Hashable 57 | from typing import ItemsView - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 58 | from typing import Iterable 59 | from typing import Iterator | = help: Import from `collections.abc` - ℹ Safe fix 54 54 | from typing import ByteString 55 55 | from typing import Container @@ -576,17 +605,18 @@ UP035.py:57:1: UP035 [*] Import from `collections.abc` instead: `ItemsView` 59 59 | from typing import Iterator 60 60 | from typing import KeysView -UP035.py:58:1: UP035 [*] Import from `collections.abc` instead: `Iterable` +error[UP035]: 58:1: [*] Import from `collections.abc` instead: `Iterable` + + --> UP035.py:57:29 | 56 | from typing import Hashable 57 | from typing import ItemsView 58 | from typing import Iterable - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ 59 | from typing import Iterator 60 | from typing import KeysView | = help: Import from `collections.abc` - ℹ Safe fix 55 55 | from typing import Container 56 56 | from typing import Hashable @@ -597,17 +627,18 @@ UP035.py:58:1: UP035 [*] Import from `collections.abc` instead: `Iterable` 60 60 | from typing import KeysView 61 61 | from typing import Mapping -UP035.py:59:1: UP035 [*] Import from `collections.abc` instead: `Iterator` +error[UP035]: 59:1: [*] Import from `collections.abc` instead: `Iterator` + + --> UP035.py:58:28 | 57 | from typing import ItemsView 58 | from typing import Iterable 59 | from typing import Iterator - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ 60 | from typing import KeysView 61 | from typing import Mapping | = help: Import from `collections.abc` - ℹ Safe fix 56 56 | from typing import Hashable 57 57 | from typing import ItemsView @@ -618,17 +649,18 @@ UP035.py:59:1: UP035 [*] Import from `collections.abc` instead: `Iterator` 61 61 | from typing import Mapping 62 62 | from typing import MappingView -UP035.py:60:1: UP035 [*] Import from `collections.abc` instead: `KeysView` +error[UP035]: 60:1: [*] Import from `collections.abc` instead: `KeysView` + + --> UP035.py:59:28 | 58 | from typing import Iterable 59 | from typing import Iterator 60 | from typing import KeysView - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ 61 | from typing import Mapping 62 | from typing import MappingView | = help: Import from `collections.abc` - ℹ Safe fix 57 57 | from typing import ItemsView 58 58 | from typing import Iterable @@ -639,17 +671,18 @@ UP035.py:60:1: UP035 [*] Import from `collections.abc` instead: `KeysView` 62 62 | from typing import MappingView 63 63 | from typing import MutableMapping -UP035.py:61:1: UP035 [*] Import from `collections.abc` instead: `Mapping` +error[UP035]: 61:1: [*] Import from `collections.abc` instead: `Mapping` + + --> UP035.py:60:28 | 59 | from typing import Iterator 60 | from typing import KeysView 61 | from typing import Mapping - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ 62 | from typing import MappingView 63 | from typing import MutableMapping | = help: Import from `collections.abc` - ℹ Safe fix 58 58 | from typing import Iterable 59 59 | from typing import Iterator @@ -660,17 +693,18 @@ UP035.py:61:1: UP035 [*] Import from `collections.abc` instead: `Mapping` 63 63 | from typing import MutableMapping 64 64 | from typing import MutableSequence -UP035.py:62:1: UP035 [*] Import from `collections.abc` instead: `MappingView` +error[UP035]: 62:1: [*] Import from `collections.abc` instead: `MappingView` + + --> UP035.py:61:27 | 60 | from typing import KeysView 61 | from typing import Mapping 62 | from typing import MappingView - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 63 | from typing import MutableMapping 64 | from typing import MutableSequence | = help: Import from `collections.abc` - ℹ Safe fix 59 59 | from typing import Iterator 60 60 | from typing import KeysView @@ -681,17 +715,18 @@ UP035.py:62:1: UP035 [*] Import from `collections.abc` instead: `MappingView` 64 64 | from typing import MutableSequence 65 65 | from typing import MutableSet -UP035.py:63:1: UP035 [*] Import from `collections.abc` instead: `MutableMapping` +error[UP035]: 63:1: [*] Import from `collections.abc` instead: `MutableMapping` + + --> UP035.py:62:31 | 61 | from typing import Mapping 62 | from typing import MappingView 63 | from typing import MutableMapping - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 64 | from typing import MutableSequence 65 | from typing import MutableSet | = help: Import from `collections.abc` - ℹ Safe fix 60 60 | from typing import KeysView 61 61 | from typing import Mapping @@ -702,17 +737,18 @@ UP035.py:63:1: UP035 [*] Import from `collections.abc` instead: `MutableMapping` 65 65 | from typing import MutableSet 66 66 | from typing import Sequence -UP035.py:64:1: UP035 [*] Import from `collections.abc` instead: `MutableSequence` +error[UP035]: 64:1: [*] Import from `collections.abc` instead: `MutableSequence` + + --> UP035.py:63:34 | 62 | from typing import MappingView 63 | from typing import MutableMapping 64 | from typing import MutableSequence - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 65 | from typing import MutableSet 66 | from typing import Sequence | = help: Import from `collections.abc` - ℹ Safe fix 61 61 | from typing import Mapping 62 62 | from typing import MappingView @@ -723,17 +759,18 @@ UP035.py:64:1: UP035 [*] Import from `collections.abc` instead: `MutableSequence 66 66 | from typing import Sequence 67 67 | from typing import Sized -UP035.py:65:1: UP035 [*] Import from `collections.abc` instead: `MutableSet` +error[UP035]: 65:1: [*] Import from `collections.abc` instead: `MutableSet` + + --> UP035.py:64:35 | 63 | from typing import MutableMapping 64 | from typing import MutableSequence 65 | from typing import MutableSet - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 66 | from typing import Sequence 67 | from typing import Sized | = help: Import from `collections.abc` - ℹ Safe fix 62 62 | from typing import MappingView 63 63 | from typing import MutableMapping @@ -744,17 +781,18 @@ UP035.py:65:1: UP035 [*] Import from `collections.abc` instead: `MutableSet` 67 67 | from typing import Sized 68 68 | from typing import ValuesView -UP035.py:66:1: UP035 [*] Import from `collections.abc` instead: `Sequence` +error[UP035]: 66:1: [*] Import from `collections.abc` instead: `Sequence` + + --> UP035.py:65:30 | 64 | from typing import MutableSequence 65 | from typing import MutableSet 66 | from typing import Sequence - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ 67 | from typing import Sized 68 | from typing import ValuesView | = help: Import from `collections.abc` - ℹ Safe fix 63 63 | from typing import MutableMapping 64 64 | from typing import MutableSequence @@ -765,17 +803,18 @@ UP035.py:66:1: UP035 [*] Import from `collections.abc` instead: `Sequence` 68 68 | from typing import ValuesView 69 69 | from typing import Awaitable -UP035.py:67:1: UP035 [*] Import from `collections.abc` instead: `Sized` +error[UP035]: 67:1: [*] Import from `collections.abc` instead: `Sized` + + --> UP035.py:66:28 | 65 | from typing import MutableSet 66 | from typing import Sequence 67 | from typing import Sized - | ^^^^^^^^^^^^^^^^^^^^^^^^ UP035 + | ^^^^^^^^^^^^^^^^^^^^^^^^ 68 | from typing import ValuesView 69 | from typing import Awaitable | = help: Import from `collections.abc` - ℹ Safe fix 64 64 | from typing import MutableSequence 65 65 | from typing import MutableSet @@ -786,17 +825,18 @@ UP035.py:67:1: UP035 [*] Import from `collections.abc` instead: `Sized` 69 69 | from typing import Awaitable 70 70 | from typing import AsyncIterator -UP035.py:68:1: UP035 [*] Import from `collections.abc` instead: `ValuesView` +error[UP035]: 68:1: [*] Import from `collections.abc` instead: `ValuesView` + + --> UP035.py:67:25 | 66 | from typing import Sequence 67 | from typing import Sized 68 | from typing import ValuesView - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 69 | from typing import Awaitable 70 | from typing import AsyncIterator | = help: Import from `collections.abc` - ℹ Safe fix 65 65 | from typing import MutableSet 66 66 | from typing import Sequence @@ -807,17 +847,18 @@ UP035.py:68:1: UP035 [*] Import from `collections.abc` instead: `ValuesView` 70 70 | from typing import AsyncIterator 71 71 | from typing import AsyncIterable -UP035.py:69:1: UP035 [*] Import from `collections.abc` instead: `Awaitable` +error[UP035]: 69:1: [*] Import from `collections.abc` instead: `Awaitable` + + --> UP035.py:68:30 | 67 | from typing import Sized 68 | from typing import ValuesView 69 | from typing import Awaitable - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 70 | from typing import AsyncIterator 71 | from typing import AsyncIterable | = help: Import from `collections.abc` - ℹ Safe fix 66 66 | from typing import Sequence 67 67 | from typing import Sized @@ -828,17 +869,18 @@ UP035.py:69:1: UP035 [*] Import from `collections.abc` instead: `Awaitable` 71 71 | from typing import AsyncIterable 72 72 | from typing import Coroutine -UP035.py:70:1: UP035 [*] Import from `collections.abc` instead: `AsyncIterator` +error[UP035]: 70:1: [*] Import from `collections.abc` instead: `AsyncIterator` + + --> UP035.py:69:29 | 68 | from typing import ValuesView 69 | from typing import Awaitable 70 | from typing import AsyncIterator - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 71 | from typing import AsyncIterable 72 | from typing import Coroutine | = help: Import from `collections.abc` - ℹ Safe fix 67 67 | from typing import Sized 68 68 | from typing import ValuesView @@ -849,17 +891,18 @@ UP035.py:70:1: UP035 [*] Import from `collections.abc` instead: `AsyncIterator` 72 72 | from typing import Coroutine 73 73 | from typing import Collection -UP035.py:71:1: UP035 [*] Import from `collections.abc` instead: `AsyncIterable` +error[UP035]: 71:1: [*] Import from `collections.abc` instead: `AsyncIterable` + + --> UP035.py:70:33 | 69 | from typing import Awaitable 70 | from typing import AsyncIterator 71 | from typing import AsyncIterable - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 72 | from typing import Coroutine 73 | from typing import Collection | = help: Import from `collections.abc` - ℹ Safe fix 68 68 | from typing import ValuesView 69 69 | from typing import Awaitable @@ -870,17 +913,18 @@ UP035.py:71:1: UP035 [*] Import from `collections.abc` instead: `AsyncIterable` 73 73 | from typing import Collection 74 74 | from typing import AsyncGenerator -UP035.py:72:1: UP035 [*] Import from `collections.abc` instead: `Coroutine` +error[UP035]: 72:1: [*] Import from `collections.abc` instead: `Coroutine` + + --> UP035.py:71:33 | 70 | from typing import AsyncIterator 71 | from typing import AsyncIterable 72 | from typing import Coroutine - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 73 | from typing import Collection 74 | from typing import AsyncGenerator | = help: Import from `collections.abc` - ℹ Safe fix 69 69 | from typing import Awaitable 70 70 | from typing import AsyncIterator @@ -891,17 +935,18 @@ UP035.py:72:1: UP035 [*] Import from `collections.abc` instead: `Coroutine` 74 74 | from typing import AsyncGenerator 75 75 | from typing import Reversible -UP035.py:73:1: UP035 [*] Import from `collections.abc` instead: `Collection` +error[UP035]: 73:1: [*] Import from `collections.abc` instead: `Collection` + + --> UP035.py:72:29 | 71 | from typing import AsyncIterable 72 | from typing import Coroutine 73 | from typing import Collection - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 74 | from typing import AsyncGenerator 75 | from typing import Reversible | = help: Import from `collections.abc` - ℹ Safe fix 70 70 | from typing import AsyncIterator 71 71 | from typing import AsyncIterable @@ -912,17 +957,18 @@ UP035.py:73:1: UP035 [*] Import from `collections.abc` instead: `Collection` 75 75 | from typing import Reversible 76 76 | from typing import Generator -UP035.py:74:1: UP035 [*] Import from `collections.abc` instead: `AsyncGenerator` +error[UP035]: 74:1: [*] Import from `collections.abc` instead: `AsyncGenerator` + + --> UP035.py:73:30 | 72 | from typing import Coroutine 73 | from typing import Collection 74 | from typing import AsyncGenerator - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 75 | from typing import Reversible 76 | from typing import Generator | = help: Import from `collections.abc` - ℹ Safe fix 71 71 | from typing import AsyncIterable 72 72 | from typing import Coroutine @@ -933,17 +979,18 @@ UP035.py:74:1: UP035 [*] Import from `collections.abc` instead: `AsyncGenerator` 76 76 | from typing import Generator 77 77 | from typing import Callable -UP035.py:75:1: UP035 [*] Import from `collections.abc` instead: `Reversible` +error[UP035]: 75:1: [*] Import from `collections.abc` instead: `Reversible` + + --> UP035.py:74:34 | 73 | from typing import Collection 74 | from typing import AsyncGenerator 75 | from typing import Reversible - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 76 | from typing import Generator 77 | from typing import Callable | = help: Import from `collections.abc` - ℹ Safe fix 72 72 | from typing import Coroutine 73 73 | from typing import Collection @@ -954,17 +1001,18 @@ UP035.py:75:1: UP035 [*] Import from `collections.abc` instead: `Reversible` 77 77 | from typing import Callable 78 78 | from typing import cast -UP035.py:76:1: UP035 [*] Import from `collections.abc` instead: `Generator` +error[UP035]: 76:1: [*] Import from `collections.abc` instead: `Generator` + + --> UP035.py:75:30 | 74 | from typing import AsyncGenerator 75 | from typing import Reversible 76 | from typing import Generator - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 77 | from typing import Callable 78 | from typing import cast | = help: Import from `collections.abc` - ℹ Safe fix 73 73 | from typing import Collection 74 74 | from typing import AsyncGenerator @@ -975,16 +1023,17 @@ UP035.py:76:1: UP035 [*] Import from `collections.abc` instead: `Generator` 78 78 | from typing import cast 79 79 | -UP035.py:77:1: UP035 [*] Import from `collections.abc` instead: `Callable` +error[UP035]: 77:1: [*] Import from `collections.abc` instead: `Callable` + + --> UP035.py:76:29 | 75 | from typing import Reversible 76 | from typing import Generator 77 | from typing import Callable - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ 78 | from typing import cast | = help: Import from `collections.abc` - ℹ Safe fix 74 74 | from typing import AsyncGenerator 75 75 | from typing import Reversible @@ -995,16 +1044,17 @@ UP035.py:77:1: UP035 [*] Import from `collections.abc` instead: `Callable` 79 79 | 80 80 | # OK -UP035.py:84:1: UP035 [*] Import from `typing` instead: `SupportsIndex` +error[UP035]: 84:1: [*] Import from `typing` instead: `SupportsIndex` + + --> UP035.py:83:23 | 83 | # UP035 on py312+ only 84 | from typing_extensions import SupportsIndex - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 85 | 86 | # UP035 on py312+ only | = help: Import from `typing` - ℹ Safe fix 81 81 | from a import b 82 82 | @@ -1015,16 +1065,17 @@ UP035.py:84:1: UP035 [*] Import from `typing` instead: `SupportsIndex` 86 86 | # UP035 on py312+ only 87 87 | from typing_extensions import NamedTuple -UP035.py:87:1: UP035 [*] Import from `typing` instead: `NamedTuple` +error[UP035]: 87:1: [*] Import from `typing` instead: `NamedTuple` + + --> UP035.py:86:23 | 86 | # UP035 on py312+ only 87 | from typing_extensions import NamedTuple - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 88 | 89 | # UP035 on py312+ only: `typing_extensions` supports `frozen_default` (backported from 3.12). | = help: Import from `typing` - ℹ Safe fix 84 84 | from typing_extensions import SupportsIndex 85 85 | @@ -1035,16 +1086,17 @@ UP035.py:87:1: UP035 [*] Import from `typing` instead: `NamedTuple` 89 89 | # UP035 on py312+ only: `typing_extensions` supports `frozen_default` (backported from 3.12). 90 90 | from typing_extensions import dataclass_transform -UP035.py:90:1: UP035 [*] Import from `typing` instead: `dataclass_transform` +error[UP035]: 90:1: [*] Import from `typing` instead: `dataclass_transform` + + --> UP035.py:89:94 | 89 | # UP035 on py312+ only: `typing_extensions` supports `frozen_default` (backported from 3.12). 90 | from typing_extensions import dataclass_transform - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 91 | 92 | # UP035 | = help: Import from `typing` - ℹ Safe fix 87 87 | from typing_extensions import NamedTuple 88 88 | @@ -1055,16 +1107,17 @@ UP035.py:90:1: UP035 [*] Import from `typing` instead: `dataclass_transform` 92 92 | # UP035 93 93 | from backports.strenum import StrEnum -UP035.py:93:1: UP035 [*] Import from `enum` instead: `StrEnum` +error[UP035]: 93:1: [*] Import from `enum` instead: `StrEnum` + + --> UP035.py:92:8 | 92 | # UP035 93 | from backports.strenum import StrEnum - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 94 | 95 | # UP035 | = help: Import from `enum` - ℹ Safe fix 90 90 | from typing_extensions import dataclass_transform 91 91 | @@ -1075,16 +1128,17 @@ UP035.py:93:1: UP035 [*] Import from `enum` instead: `StrEnum` 95 95 | # UP035 96 96 | from typing_extensions import override -UP035.py:96:1: UP035 [*] Import from `typing` instead: `override` +error[UP035]: 96:1: [*] Import from `typing` instead: `override` + + --> UP035.py:95:8 | 95 | # UP035 96 | from typing_extensions import override - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 97 | 98 | # UP035 | = help: Import from `typing` - ℹ Safe fix 93 93 | from backports.strenum import StrEnum 94 94 | @@ -1095,16 +1149,17 @@ UP035.py:96:1: UP035 [*] Import from `typing` instead: `override` 98 98 | # UP035 99 99 | from typing_extensions import Buffer -UP035.py:99:1: UP035 [*] Import from `collections.abc` instead: `Buffer` +error[UP035]: 99:1: [*] Import from `collections.abc` instead: `Buffer` + + --> UP035.py:98:8 | 98 | # UP035 99 | from typing_extensions import Buffer - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 100 | 101 | # UP035 | = help: Import from `collections.abc` - ℹ Safe fix 96 96 | from typing_extensions import override 97 97 | @@ -1115,16 +1170,17 @@ UP035.py:99:1: UP035 [*] Import from `collections.abc` instead: `Buffer` 101 101 | # UP035 102 102 | from typing_extensions import get_original_bases -UP035.py:102:1: UP035 [*] Import from `types` instead: `get_original_bases` +error[UP035]: 102:1: [*] Import from `types` instead: `get_original_bases` + + --> UP035.py:101:8 | 101 | # UP035 102 | from typing_extensions import get_original_bases - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 103 | 104 | # UP035 on py313+ only | = help: Import from `types` - ℹ Safe fix 99 99 | from typing_extensions import Buffer 100 100 | @@ -1135,16 +1191,17 @@ UP035.py:102:1: UP035 [*] Import from `types` instead: `get_original_bases` 104 104 | # UP035 on py313+ only 105 105 | from typing_extensions import TypeVar -UP035.py:105:1: UP035 [*] Import from `typing` instead: `TypeVar` +error[UP035]: 105:1: [*] Import from `typing` instead: `TypeVar` + + --> UP035.py:104:23 | 104 | # UP035 on py313+ only 105 | from typing_extensions import TypeVar - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 106 | 107 | # UP035 on py313+ only | = help: Import from `typing` - ℹ Safe fix 102 102 | from typing_extensions import get_original_bases 103 103 | @@ -1155,16 +1212,17 @@ UP035.py:105:1: UP035 [*] Import from `typing` instead: `TypeVar` 107 107 | # UP035 on py313+ only 108 108 | from typing_extensions import CapsuleType -UP035.py:108:1: UP035 [*] Import from `types` instead: `CapsuleType` +error[UP035]: 108:1: [*] Import from `types` instead: `CapsuleType` + + --> UP035.py:107:23 | 107 | # UP035 on py313+ only 108 | from typing_extensions import CapsuleType - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 109 | 110 | # UP035 on py313+ only | = help: Import from `types` - ℹ Safe fix 105 105 | from typing_extensions import TypeVar 106 106 | @@ -1175,14 +1233,15 @@ UP035.py:108:1: UP035 [*] Import from `types` instead: `CapsuleType` 110 110 | # UP035 on py313+ only 111 111 | from typing_extensions import deprecated -UP035.py:111:1: UP035 [*] Import from `warnings` instead: `deprecated` +error[UP035]: 111:1: [*] Import from `warnings` instead: `deprecated` + + --> UP035.py:110:23 | 110 | # UP035 on py313+ only 111 | from typing_extensions import deprecated - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: Import from `warnings` - ℹ Safe fix 108 108 | from typing_extensions import CapsuleType 109 109 | diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_0.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_0.py.snap index 329642fd56..ee5c9768ce 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_0.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_0.py.snap @@ -1,17 +1,18 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -UP036_0.py:3:4: UP036 [*] Version block is outdated for minimum Python version +error[UP036]: 3:4: [*] Version block is outdated for minimum Python version + + --> UP036_0.py:3:4 | 1 | import sys 2 | 3 | if sys.version_info < (3,0): - | ^^^^^^^^^^^^^^^^^^^^^^^^ UP036 + | ^^^^^^^^^^^^^^^^^^^^^^^^ 4 | print("py2") 5 | else: | = help: Remove outdated version block - ℹ Unsafe fix 1 1 | import sys 2 2 | @@ -24,17 +25,18 @@ UP036_0.py:3:4: UP036 [*] Version block is outdated for minimum Python version 8 5 | if sys.version_info < (3,0): 9 6 | if True: -UP036_0.py:8:4: UP036 [*] Version block is outdated for minimum Python version +error[UP036]: 8:4: [*] Version block is outdated for minimum Python version + + --> UP036_0.py:8:4 | 6 | print("py3") 7 | 8 | if sys.version_info < (3,0): - | ^^^^^^^^^^^^^^^^^^^^^^^^ UP036 + | ^^^^^^^^^^^^^^^^^^^^^^^^ 9 | if True: 10 | print("py2!") | = help: Remove outdated version block - ℹ Unsafe fix 5 5 | else: 6 6 | print("py3") @@ -51,16 +53,17 @@ UP036_0.py:8:4: UP036 [*] Version block is outdated for minimum Python version 16 10 | if sys.version_info < (3,0): print("PY2!") 17 11 | else: print("PY3!") -UP036_0.py:16:4: UP036 [*] Version block is outdated for minimum Python version +error[UP036]: 16:4: [*] Version block is outdated for minimum Python version + + --> UP036_0.py:16:4 | 14 | print("py3") 15 | 16 | if sys.version_info < (3,0): print("PY2!") - | ^^^^^^^^^^^^^^^^^^^^^^^^ UP036 + | ^^^^^^^^^^^^^^^^^^^^^^^^ 17 | else: print("PY3!") | = help: Remove outdated version block - ℹ Unsafe fix 13 13 | else: 14 14 | print("py3") @@ -72,16 +75,17 @@ UP036_0.py:16:4: UP036 [*] Version block is outdated for minimum Python version 19 18 | if True: 20 19 | if sys.version_info < (3,0): -UP036_0.py:20:8: UP036 [*] Version block is outdated for minimum Python version +error[UP036]: 20:8: [*] Version block is outdated for minimum Python version + + --> UP036_0.py:20:8 | 19 | if True: 20 | if sys.version_info < (3,0): - | ^^^^^^^^^^^^^^^^^^^^^^^^ UP036 + | ^^^^^^^^^^^^^^^^^^^^^^^^ 21 | print("PY2") 22 | else: | = help: Remove outdated version block - ℹ Unsafe fix 17 17 | else: print("PY3!") 18 18 | @@ -95,17 +99,18 @@ UP036_0.py:20:8: UP036 [*] Version block is outdated for minimum Python version 25 22 | if sys.version_info < (3,0): print(1 if True else 3) 26 23 | else: -UP036_0.py:25:4: UP036 [*] Version block is outdated for minimum Python version +error[UP036]: 25:4: [*] Version block is outdated for minimum Python version + + --> UP036_0.py:25:4 | 23 | print("PY3") 24 | 25 | if sys.version_info < (3,0): print(1 if True else 3) - | ^^^^^^^^^^^^^^^^^^^^^^^^ UP036 + | ^^^^^^^^^^^^^^^^^^^^^^^^ 26 | else: 27 | print("py3") | = help: Remove outdated version block - ℹ Unsafe fix 22 22 | else: 23 23 | print("PY3") @@ -118,17 +123,18 @@ UP036_0.py:25:4: UP036 [*] Version block is outdated for minimum Python version 29 27 | if sys.version_info < (3,0): 30 28 | def f(): -UP036_0.py:29:4: UP036 [*] Version block is outdated for minimum Python version +error[UP036]: 29:4: [*] Version block is outdated for minimum Python version + + --> UP036_0.py:29:4 | 27 | print("py3") 28 | 29 | if sys.version_info < (3,0): - | ^^^^^^^^^^^^^^^^^^^^^^^^ UP036 + | ^^^^^^^^^^^^^^^^^^^^^^^^ 30 | def f(): 31 | print("py2") | = help: Remove outdated version block - ℹ Unsafe fix 26 26 | else: 27 27 | print("py3") @@ -147,17 +153,18 @@ UP036_0.py:29:4: UP036 [*] Version block is outdated for minimum Python version 37 33 | if sys.version_info > (3,0): 38 34 | print("py3") -UP036_0.py:37:4: UP036 [*] Version block is outdated for minimum Python version +error[UP036]: 37:4: [*] Version block is outdated for minimum Python version + + --> UP036_0.py:37:4 | 35 | print("This the next") 36 | 37 | if sys.version_info > (3,0): - | ^^^^^^^^^^^^^^^^^^^^^^^^ UP036 + | ^^^^^^^^^^^^^^^^^^^^^^^^ 38 | print("py3") 39 | else: | = help: Remove outdated version block - ℹ Unsafe fix 34 34 | print("py3") 35 35 | print("This the next") @@ -171,17 +178,18 @@ UP036_0.py:37:4: UP036 [*] Version block is outdated for minimum Python version 42 39 | 43 40 | x = 1 -UP036_0.py:45:4: UP036 [*] Version block is outdated for minimum Python version +error[UP036]: 45:4: [*] Version block is outdated for minimum Python version + + --> UP036_0.py:45:4 | 43 | x = 1 44 | 45 | if sys.version_info > (3,0): - | ^^^^^^^^^^^^^^^^^^^^^^^^ UP036 + | ^^^^^^^^^^^^^^^^^^^^^^^^ 46 | print("py3") 47 | else: | = help: Remove outdated version block - ℹ Unsafe fix 42 42 | 43 43 | x = 1 @@ -195,16 +203,17 @@ UP036_0.py:45:4: UP036 [*] Version block is outdated for minimum Python version 50 47 | 51 48 | x = 1 -UP036_0.py:53:4: UP036 [*] Version block is outdated for minimum Python version +error[UP036]: 53:4: [*] Version block is outdated for minimum Python version + + --> UP036_0.py:53:4 | 51 | x = 1 52 | 53 | if sys.version_info > (3,0): print("py3") - | ^^^^^^^^^^^^^^^^^^^^^^^^ UP036 + | ^^^^^^^^^^^^^^^^^^^^^^^^ 54 | else: print("py2") | = help: Remove outdated version block - ℹ Unsafe fix 50 50 | 51 51 | x = 1 @@ -216,17 +225,18 @@ UP036_0.py:53:4: UP036 [*] Version block is outdated for minimum Python version 56 55 | if sys.version_info > (3,): 57 56 | print("py3") -UP036_0.py:56:4: UP036 [*] Version block is outdated for minimum Python version +error[UP036]: 56:4: [*] Version block is outdated for minimum Python version + + --> UP036_0.py:56:4 | 54 | else: print("py2") 55 | 56 | if sys.version_info > (3,): - | ^^^^^^^^^^^^^^^^^^^^^^^ UP036 + | ^^^^^^^^^^^^^^^^^^^^^^^ 57 | print("py3") 58 | else: | = help: Remove outdated version block - ℹ Unsafe fix 53 53 | if sys.version_info > (3,0): print("py3") 54 54 | else: print("py2") @@ -240,16 +250,17 @@ UP036_0.py:56:4: UP036 [*] Version block is outdated for minimum Python version 61 58 | if True: 62 59 | if sys.version_info > (3,): -UP036_0.py:62:8: UP036 [*] Version block is outdated for minimum Python version +error[UP036]: 62:8: [*] Version block is outdated for minimum Python version + + --> UP036_0.py:62:8 | 61 | if True: 62 | if sys.version_info > (3,): - | ^^^^^^^^^^^^^^^^^^^^^^^ UP036 + | ^^^^^^^^^^^^^^^^^^^^^^^ 63 | print("py3") 64 | else: | = help: Remove outdated version block - ℹ Unsafe fix 59 59 | print("py2") 60 60 | @@ -263,17 +274,18 @@ UP036_0.py:62:8: UP036 [*] Version block is outdated for minimum Python version 67 64 | if sys.version_info < (3,): 68 65 | print("py2") -UP036_0.py:67:4: UP036 [*] Version block is outdated for minimum Python version +error[UP036]: 67:4: [*] Version block is outdated for minimum Python version + + --> UP036_0.py:67:4 | 65 | print("py2") 66 | 67 | if sys.version_info < (3,): - | ^^^^^^^^^^^^^^^^^^^^^^^ UP036 + | ^^^^^^^^^^^^^^^^^^^^^^^ 68 | print("py2") 69 | else: | = help: Remove outdated version block - ℹ Unsafe fix 64 64 | else: 65 65 | print("py2") @@ -287,16 +299,17 @@ UP036_0.py:67:4: UP036 [*] Version block is outdated for minimum Python version 72 69 | def f(): 73 70 | if sys.version_info < (3,0): -UP036_0.py:73:8: UP036 [*] Version block is outdated for minimum Python version +error[UP036]: 73:8: [*] Version block is outdated for minimum Python version + + --> UP036_0.py:73:8 | 72 | def f(): 73 | if sys.version_info < (3,0): - | ^^^^^^^^^^^^^^^^^^^^^^^^ UP036 + | ^^^^^^^^^^^^^^^^^^^^^^^^ 74 | try: 75 | yield | = help: Remove outdated version block - ℹ Unsafe fix 70 70 | print("py3") 71 71 | @@ -313,17 +326,18 @@ UP036_0.py:73:8: UP036 [*] Version block is outdated for minimum Python version 81 75 | 82 76 | class C: -UP036_0.py:86:8: UP036 [*] Version block is outdated for minimum Python version +error[UP036]: 86:8: [*] Version block is outdated for minimum Python version + + --> UP036_0.py:86:8 | 84 | pass 85 | 86 | if sys.version_info < (3,0): - | ^^^^^^^^^^^^^^^^^^^^^^^^ UP036 + | ^^^^^^^^^^^^^^^^^^^^^^^^ 87 | def f(py2): 88 | pass | = help: Remove outdated version block - ℹ Unsafe fix 83 83 | def g(): 84 84 | pass @@ -340,16 +354,17 @@ UP036_0.py:86:8: UP036 [*] Version block is outdated for minimum Python version 93 89 | def h(): 94 90 | pass -UP036_0.py:97:8: UP036 [*] Version block is outdated for minimum Python version +error[UP036]: 97:8: [*] Version block is outdated for minimum Python version + + --> UP036_0.py:97:8 | 96 | if True: 97 | if sys.version_info < (3,0): - | ^^^^^^^^^^^^^^^^^^^^^^^^ UP036 + | ^^^^^^^^^^^^^^^^^^^^^^^^ 98 | 2 99 | else: | = help: Remove outdated version block - ℹ Unsafe fix 94 94 | pass 95 95 | @@ -363,17 +378,18 @@ UP036_0.py:97:8: UP036 [*] Version block is outdated for minimum Python version 102 99 | # comment 103 100 | -UP036_0.py:104:4: UP036 [*] Version block is outdated for minimum Python version +error[UP036]: 104:4: [*] Version block is outdated for minimum Python version + + --> UP036_0.py:104:4 | 102 | # comment 103 | 104 | if sys.version_info < (3,0): - | ^^^^^^^^^^^^^^^^^^^^^^^^ UP036 + | ^^^^^^^^^^^^^^^^^^^^^^^^ 105 | def f(): 106 | print("py2") | = help: Remove outdated version block - ℹ Unsafe fix 101 101 | 102 102 | # comment @@ -396,16 +412,17 @@ UP036_0.py:104:4: UP036 [*] Version block is outdated for minimum Python version 115 109 | if True: 116 110 | if sys.version_info > (3,): -UP036_0.py:116:8: UP036 [*] Version block is outdated for minimum Python version +error[UP036]: 116:8: [*] Version block is outdated for minimum Python version + + --> UP036_0.py:116:8 | 115 | if True: 116 | if sys.version_info > (3,): - | ^^^^^^^^^^^^^^^^^^^^^^^ UP036 + | ^^^^^^^^^^^^^^^^^^^^^^^ 117 | print(3) 118 | # comment | = help: Remove outdated version block - ℹ Unsafe fix 113 113 | print("py3") 114 114 | @@ -417,16 +434,17 @@ UP036_0.py:116:8: UP036 [*] Version block is outdated for minimum Python version 119 118 | print(2+3) 120 119 | -UP036_0.py:122:8: UP036 [*] Version block is outdated for minimum Python version +error[UP036]: 122:8: [*] Version block is outdated for minimum Python version + + --> UP036_0.py:122:8 | 121 | if True: 122 | if sys.version_info > (3,): print(3) - | ^^^^^^^^^^^^^^^^^^^^^^^ UP036 + | ^^^^^^^^^^^^^^^^^^^^^^^ 123 | 124 | if True: | = help: Remove outdated version block - ℹ Unsafe fix 119 119 | print(2+3) 120 120 | @@ -437,15 +455,16 @@ UP036_0.py:122:8: UP036 [*] Version block is outdated for minimum Python version 124 124 | if True: 125 125 | if sys.version_info > (3,): -UP036_0.py:125:8: UP036 [*] Version block is outdated for minimum Python version +error[UP036]: 125:8: [*] Version block is outdated for minimum Python version + + --> UP036_0.py:125:8 | 124 | if True: 125 | if sys.version_info > (3,): - | ^^^^^^^^^^^^^^^^^^^^^^^ UP036 + | ^^^^^^^^^^^^^^^^^^^^^^^ 126 | print(3) | = help: Remove outdated version block - ℹ Unsafe fix 122 122 | if sys.version_info > (3,): print(3) 123 123 | @@ -457,16 +476,17 @@ UP036_0.py:125:8: UP036 [*] Version block is outdated for minimum Python version 128 127 | 129 128 | if True: -UP036_0.py:130:8: UP036 [*] Version block is outdated for minimum Python version +error[UP036]: 130:8: [*] Version block is outdated for minimum Python version + + --> UP036_0.py:130:8 | 129 | if True: 130 | if sys.version_info <= (3, 0): - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ UP036 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ 131 | expected_error = [] 132 | else: | = help: Remove outdated version block - ℹ Unsafe fix 127 127 | 128 128 | @@ -485,15 +505,16 @@ UP036_0.py:130:8: UP036 [*] Version block is outdated for minimum Python version 139 136 | 140 137 | if sys.version_info <= (3, 0): -UP036_0.py:140:4: UP036 [*] Version block is outdated for minimum Python version +error[UP036]: 140:4: [*] Version block is outdated for minimum Python version + + --> UP036_0.py:140:4 | 140 | if sys.version_info <= (3, 0): - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ UP036 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ 141 | expected_error = [] 142 | else: | = help: Remove outdated version block - ℹ Unsafe fix 137 137 | ] 138 138 | @@ -512,15 +533,16 @@ UP036_0.py:140:4: UP036 [*] Version block is outdated for minimum Python version 149 146 | 150 147 | if sys.version_info > (3,0): -UP036_0.py:150:4: UP036 [*] Version block is outdated for minimum Python version +error[UP036]: 150:4: [*] Version block is outdated for minimum Python version + + --> UP036_0.py:150:4 | 150 | if sys.version_info > (3,0): - | ^^^^^^^^^^^^^^^^^^^^^^^^ UP036 + | ^^^^^^^^^^^^^^^^^^^^^^^^ 151 | """this 152 | is valid""" | = help: Remove outdated version block - ℹ Unsafe fix 147 147 | ] 148 148 | @@ -546,16 +568,17 @@ UP036_0.py:150:4: UP036 [*] Version block is outdated for minimum Python version 163 162 | if sys.version_info > (3, 0): expected_error = \ 164 163 | [] -UP036_0.py:163:4: UP036 [*] Version block is outdated for minimum Python version +error[UP036]: 163:4: [*] Version block is outdated for minimum Python version + + --> UP036_0.py:163:4 | 161 | "this for some reason") 162 | 163 | if sys.version_info > (3, 0): expected_error = \ - | ^^^^^^^^^^^^^^^^^^^^^^^^^ UP036 + | ^^^^^^^^^^^^^^^^^^^^^^^^^ 164 | [] | = help: Remove outdated version block - ℹ Unsafe fix 160 160 | ("so is" 161 161 | "this for some reason") @@ -566,17 +589,18 @@ UP036_0.py:163:4: UP036 [*] Version block is outdated for minimum Python version 165 165 | 166 166 | if sys.version_info > (3, 0): expected_error = [] -UP036_0.py:166:4: UP036 [*] Version block is outdated for minimum Python version +error[UP036]: 166:4: [*] Version block is outdated for minimum Python version + + --> UP036_0.py:166:4 | 164 | [] 165 | 166 | if sys.version_info > (3, 0): expected_error = [] - | ^^^^^^^^^^^^^^^^^^^^^^^^^ UP036 + | ^^^^^^^^^^^^^^^^^^^^^^^^^ 167 | 168 | if sys.version_info > (3, 0): \ | = help: Remove outdated version block - ℹ Unsafe fix 163 163 | if sys.version_info > (3, 0): expected_error = \ 164 164 | [] @@ -587,16 +611,17 @@ UP036_0.py:166:4: UP036 [*] Version block is outdated for minimum Python version 168 168 | if sys.version_info > (3, 0): \ 169 169 | expected_error = [] -UP036_0.py:168:4: UP036 [*] Version block is outdated for minimum Python version +error[UP036]: 168:4: [*] Version block is outdated for minimum Python version + + --> UP036_0.py:168:4 | 166 | if sys.version_info > (3, 0): expected_error = [] 167 | 168 | if sys.version_info > (3, 0): \ - | ^^^^^^^^^^^^^^^^^^^^^^^^^ UP036 + | ^^^^^^^^^^^^^^^^^^^^^^^^^ 169 | expected_error = [] | = help: Remove outdated version block - ℹ Unsafe fix 165 165 | 166 166 | if sys.version_info > (3, 0): expected_error = [] @@ -608,15 +633,16 @@ UP036_0.py:168:4: UP036 [*] Version block is outdated for minimum Python version 171 170 | if True: 172 171 | if sys.version_info > (3, 0): expected_error = \ -UP036_0.py:172:8: UP036 [*] Version block is outdated for minimum Python version +error[UP036]: 172:8: [*] Version block is outdated for minimum Python version + + --> UP036_0.py:172:8 | 171 | if True: 172 | if sys.version_info > (3, 0): expected_error = \ - | ^^^^^^^^^^^^^^^^^^^^^^^^^ UP036 + | ^^^^^^^^^^^^^^^^^^^^^^^^^ 173 | [] | = help: Remove outdated version block - ℹ Unsafe fix 169 169 | expected_error = [] 170 170 | @@ -627,16 +653,17 @@ UP036_0.py:172:8: UP036 [*] Version block is outdated for minimum Python version 174 174 | 175 175 | if True: -UP036_0.py:176:8: UP036 [*] Version block is outdated for minimum Python version +error[UP036]: 176:8: [*] Version block is outdated for minimum Python version + + --> UP036_0.py:176:8 | 175 | if True: 176 | if sys.version_info > (3, 0): expected_error = [] - | ^^^^^^^^^^^^^^^^^^^^^^^^^ UP036 + | ^^^^^^^^^^^^^^^^^^^^^^^^^ 177 | 178 | if True: | = help: Remove outdated version block - ℹ Unsafe fix 173 173 | [] 174 174 | @@ -647,15 +674,16 @@ UP036_0.py:176:8: UP036 [*] Version block is outdated for minimum Python version 178 178 | if True: 179 179 | if sys.version_info > (3, 0): \ -UP036_0.py:179:8: UP036 [*] Version block is outdated for minimum Python version +error[UP036]: 179:8: [*] Version block is outdated for minimum Python version + + --> UP036_0.py:179:8 | 178 | if True: 179 | if sys.version_info > (3, 0): \ - | ^^^^^^^^^^^^^^^^^^^^^^^^^ UP036 + | ^^^^^^^^^^^^^^^^^^^^^^^^^ 180 | expected_error = [] | = help: Remove outdated version block - ℹ Unsafe fix 176 176 | if sys.version_info > (3, 0): expected_error = [] 177 177 | @@ -665,16 +693,17 @@ UP036_0.py:179:8: UP036 [*] Version block is outdated for minimum Python version 181 180 | 182 181 | if sys.version_info < (3,13): -UP036_0.py:182:4: UP036 [*] Version block is outdated for minimum Python version +error[UP036]: 182:4: [*] Version block is outdated for minimum Python version + + --> UP036_0.py:182:4 | 180 | expected_error = [] 181 | 182 | if sys.version_info < (3,13): - | ^^^^^^^^^^^^^^^^^^^^^^^^^ UP036 + | ^^^^^^^^^^^^^^^^^^^^^^^^^ 183 | print("py3") | = help: Remove outdated version block - ℹ Unsafe fix 179 179 | if sys.version_info > (3, 0): \ 180 180 | expected_error = [] @@ -685,43 +714,47 @@ UP036_0.py:182:4: UP036 [*] Version block is outdated for minimum Python version 185 183 | if sys.version_info <= (3,13): 186 184 | print("py3") -UP036_0.py:191:24: UP036 Version specifier is invalid +error[UP036]: 191:24: Version specifier is invalid + + --> UP036_0.py:191:24 | 189 | print("py3") 190 | 191 | if sys.version_info == 10000000: - | ^^^^^^^^ UP036 + | ^^^^^^^^ 192 | print("py3") | +error[UP036]: 194:23: Version specifier is invalid -UP036_0.py:194:23: UP036 Version specifier is invalid + --> UP036_0.py:194:23 | 192 | print("py3") 193 | 194 | if sys.version_info < (3,10000000): - | ^^^^^^^^^^^^ UP036 + | ^^^^^^^^^^^^ 195 | print("py3") | +error[UP036]: 197:24: Version specifier is invalid -UP036_0.py:197:24: UP036 Version specifier is invalid + --> UP036_0.py:197:24 | 195 | print("py3") 196 | 197 | if sys.version_info <= (3,10000000): - | ^^^^^^^^^^^^ UP036 + | ^^^^^^^^^^^^ 198 | print("py3") | +error[UP036]: 203:4: [*] Version block is outdated for minimum Python version -UP036_0.py:203:4: UP036 [*] Version block is outdated for minimum Python version + --> UP036_0.py:203:4 | 201 | print("py3") 202 | 203 | if sys.version_info >= (3,13): - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ UP036 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ 204 | print("py3") | = help: Remove outdated version block - ℹ Unsafe fix 200 200 | if sys.version_info > (3,13): 201 201 | print("py3") @@ -733,15 +766,16 @@ UP036_0.py:203:4: UP036 [*] Version block is outdated for minimum Python version 206 205 | # Slices on `sys.version_info` should be treated equivalently. 207 206 | if sys.version_info[:2] >= (3,0): -UP036_0.py:207:4: UP036 [*] Version block is outdated for minimum Python version +error[UP036]: 207:4: [*] Version block is outdated for minimum Python version + + --> UP036_0.py:207:4 | 206 | # Slices on `sys.version_info` should be treated equivalently. 207 | if sys.version_info[:2] >= (3,0): - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP036 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 208 | print("py3") | = help: Remove outdated version block - ℹ Unsafe fix 204 204 | print("py3") 205 205 | @@ -753,16 +787,17 @@ UP036_0.py:207:4: UP036 [*] Version block is outdated for minimum Python version 210 209 | if sys.version_info[:3] >= (3,0): 211 210 | print("py3") -UP036_0.py:210:4: UP036 [*] Version block is outdated for minimum Python version +error[UP036]: 210:4: [*] Version block is outdated for minimum Python version + + --> UP036_0.py:210:4 | 208 | print("py3") 209 | 210 | if sys.version_info[:3] >= (3,0): - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP036 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 211 | print("py3") | = help: Remove outdated version block - ℹ Unsafe fix 207 207 | if sys.version_info[:2] >= (3,0): 208 208 | print("py3") @@ -774,17 +809,18 @@ UP036_0.py:210:4: UP036 [*] Version block is outdated for minimum Python version 213 212 | if sys.version_info[:2] > (3,14): 214 213 | print("py3") -UP036_0.py:219:4: UP036 [*] Version block is outdated for minimum Python version +error[UP036]: 219:4: [*] Version block is outdated for minimum Python version + + --> UP036_0.py:219:4 | 217 | print("py3") 218 | 219 | if sys.version_info > (3,0): - | ^^^^^^^^^^^^^^^^^^^^^^^^ UP036 + | ^^^^^^^^^^^^^^^^^^^^^^^^ 220 | f"this is\ 221 | allowed too" | = help: Remove outdated version block - ℹ Unsafe fix 216 216 | if sys.version_info[:3] > (3,14): 217 217 | print("py3") diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_1.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_1.py.snap index 7a8863e7cc..b8e5525d0d 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_1.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_1.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -error[UP036]: UP036_1.py:3:4: [*] Version block is outdated for minimum Python version +error[UP036]: 3:4: [*] Version block is outdated for minimum Python version + --> UP036_1.py:3:4 | 1 | import sys 2 | @@ -24,8 +25,9 @@ error[UP036]: UP036_1.py:3:4: [*] Version block is outdated for minimum Python v 8 5 | if sys.version_info < (3,): 9 6 | 2 -error[UP036]: UP036_1.py:8:4: [*] Version block is outdated for minimum Python version +error[UP036]: 8:4: [*] Version block is outdated for minimum Python version + --> UP036_1.py:8:4 | 6 | 3 7 | @@ -48,8 +50,9 @@ error[UP036]: UP036_1.py:8:4: [*] Version block is outdated for minimum Python v 13 10 | if sys.version_info < (3,0): 14 11 | 2 -error[UP036]: UP036_1.py:13:4: [*] Version block is outdated for minimum Python version +error[UP036]: 13:4: [*] Version block is outdated for minimum Python version + --> UP036_1.py:13:4 | 11 | 3 12 | @@ -72,8 +75,9 @@ error[UP036]: UP036_1.py:13:4: [*] Version block is outdated for minimum Python 18 15 | if sys.version_info == 3: 19 16 | 3 -error[UP036]: UP036_1.py:18:4: [*] Version block is outdated for minimum Python version +error[UP036]: 18:4: [*] Version block is outdated for minimum Python version + --> UP036_1.py:18:4 | 16 | 3 17 | @@ -96,8 +100,9 @@ error[UP036]: UP036_1.py:18:4: [*] Version block is outdated for minimum Python 23 20 | if sys.version_info > (3,): 24 21 | 3 -error[UP036]: UP036_1.py:23:4: [*] Version block is outdated for minimum Python version +error[UP036]: 23:4: [*] Version block is outdated for minimum Python version + --> UP036_1.py:23:4 | 21 | 2 22 | @@ -120,8 +125,9 @@ error[UP036]: UP036_1.py:23:4: [*] Version block is outdated for minimum Python 28 25 | if sys.version_info >= (3,): 29 26 | 3 -error[UP036]: UP036_1.py:28:4: [*] Version block is outdated for minimum Python version +error[UP036]: 28:4: [*] Version block is outdated for minimum Python version + --> UP036_1.py:28:4 | 26 | 2 27 | @@ -144,8 +150,9 @@ error[UP036]: UP036_1.py:28:4: [*] Version block is outdated for minimum Python 33 30 | from sys import version_info 34 31 | -error[UP036]: UP036_1.py:35:4: [*] Version block is outdated for minimum Python version +error[UP036]: 35:4: [*] Version block is outdated for minimum Python version + --> UP036_1.py:35:4 | 33 | from sys import version_info 34 | @@ -168,8 +175,9 @@ error[UP036]: UP036_1.py:35:4: [*] Version block is outdated for minimum Python 40 37 | if True: 41 38 | print(1) -error[UP036]: UP036_1.py:42:6: [*] Version block is outdated for minimum Python version +error[UP036]: 42:6: [*] Version block is outdated for minimum Python version + --> UP036_1.py:42:6 | 40 | if True: 41 | print(1) @@ -189,8 +197,9 @@ error[UP036]: UP036_1.py:42:6: [*] Version block is outdated for minimum Python 45 43 | print(3) 46 44 | -error[UP036]: UP036_1.py:49:6: [*] Version block is outdated for minimum Python version +error[UP036]: 49:6: [*] Version block is outdated for minimum Python version + --> UP036_1.py:49:6 | 47 | if True: 48 | print(1) @@ -213,8 +222,9 @@ error[UP036]: UP036_1.py:49:6: [*] Version block is outdated for minimum Python 54 52 | if True: 55 53 | print(1) -error[UP036]: UP036_1.py:56:6: [*] Version block is outdated for minimum Python version +error[UP036]: 56:6: [*] Version block is outdated for minimum Python version + --> UP036_1.py:56:6 | 54 | if True: 55 | print(1) @@ -233,8 +243,9 @@ error[UP036]: UP036_1.py:56:6: [*] Version block is outdated for minimum Python 58 58 | 59 59 | def f(): -error[UP036]: UP036_1.py:62:10: [*] Version block is outdated for minimum Python version +error[UP036]: 62:10: [*] Version block is outdated for minimum Python version + --> UP036_1.py:62:10 | 60 | if True: 61 | print(1) @@ -253,8 +264,9 @@ error[UP036]: UP036_1.py:62:10: [*] Version block is outdated for minimum Python 64 64 | 65 65 | if True: -error[UP036]: UP036_1.py:67:6: [*] Version block is outdated for minimum Python version +error[UP036]: 67:6: [*] Version block is outdated for minimum Python version + --> UP036_1.py:67:6 | 65 | if True: 66 | print(1) @@ -274,8 +286,9 @@ error[UP036]: UP036_1.py:67:6: [*] Version block is outdated for minimum Python 70 68 | print(3) 71 69 | -error[UP036]: UP036_1.py:75:10: [*] Version block is outdated for minimum Python version +error[UP036]: 75:10: [*] Version block is outdated for minimum Python version + --> UP036_1.py:75:10 | 73 | if True: 74 | print(1) diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_2.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_2.py.snap index 6d21337a2b..c77211106d 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_2.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_2.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -error[UP036]: UP036_2.py:4:4: [*] Version block is outdated for minimum Python version +error[UP036]: 4:4: [*] Version block is outdated for minimum Python version + --> UP036_2.py:4:4 | 2 | from sys import version_info 3 | @@ -25,8 +26,9 @@ error[UP036]: UP036_2.py:4:4: [*] Version block is outdated for minimum Python v 9 6 | if version_info > (3, 5): 10 7 | 3+6 -error[UP036]: UP036_2.py:9:4: [*] Version block is outdated for minimum Python version +error[UP036]: 9:4: [*] Version block is outdated for minimum Python version + --> UP036_2.py:9:4 | 7 | 3-5 8 | @@ -49,8 +51,9 @@ error[UP036]: UP036_2.py:9:4: [*] Version block is outdated for minimum Python v 14 11 | if sys.version_info >= (3,6): 15 12 | 3+6 -error[UP036]: UP036_2.py:14:4: [*] Version block is outdated for minimum Python version +error[UP036]: 14:4: [*] Version block is outdated for minimum Python version + --> UP036_2.py:14:4 | 12 | 3-5 13 | @@ -73,8 +76,9 @@ error[UP036]: UP036_2.py:14:4: [*] Version block is outdated for minimum Python 19 16 | if version_info >= (3,6): 20 17 | 3+6 -error[UP036]: UP036_2.py:19:4: [*] Version block is outdated for minimum Python version +error[UP036]: 19:4: [*] Version block is outdated for minimum Python version + --> UP036_2.py:19:4 | 17 | 3-5 18 | @@ -97,8 +101,9 @@ error[UP036]: UP036_2.py:19:4: [*] Version block is outdated for minimum Python 24 21 | if sys.version_info < (3,6): 25 22 | 3-5 -error[UP036]: UP036_2.py:24:4: [*] Version block is outdated for minimum Python version +error[UP036]: 24:4: [*] Version block is outdated for minimum Python version + --> UP036_2.py:24:4 | 22 | 3-5 23 | @@ -121,8 +126,9 @@ error[UP036]: UP036_2.py:24:4: [*] Version block is outdated for minimum Python 29 26 | if sys.version_info <= (3,5): 30 27 | 3-5 -error[UP036]: UP036_2.py:29:4: [*] Version block is outdated for minimum Python version +error[UP036]: 29:4: [*] Version block is outdated for minimum Python version + --> UP036_2.py:29:4 | 27 | 3+6 28 | @@ -145,8 +151,9 @@ error[UP036]: UP036_2.py:29:4: [*] Version block is outdated for minimum Python 34 31 | if sys.version_info <= (3, 5): 35 32 | 3-5 -error[UP036]: UP036_2.py:34:4: [*] Version block is outdated for minimum Python version +error[UP036]: 34:4: [*] Version block is outdated for minimum Python version + --> UP036_2.py:34:4 | 32 | 3+6 33 | @@ -169,8 +176,9 @@ error[UP036]: UP036_2.py:34:4: [*] Version block is outdated for minimum Python 39 36 | if sys.version_info >= (3, 5): 40 37 | pass -error[UP036]: UP036_2.py:39:4: [*] Version block is outdated for minimum Python version +error[UP036]: 39:4: [*] Version block is outdated for minimum Python version + --> UP036_2.py:39:4 | 37 | 3+6 38 | @@ -190,8 +198,9 @@ error[UP036]: UP036_2.py:39:4: [*] Version block is outdated for minimum Python 42 41 | if sys.version_info < (3,0): 43 42 | pass -error[UP036]: UP036_2.py:42:4: [*] Version block is outdated for minimum Python version +error[UP036]: 42:4: [*] Version block is outdated for minimum Python version + --> UP036_2.py:42:4 | 40 | pass 41 | @@ -210,8 +219,9 @@ error[UP036]: UP036_2.py:42:4: [*] Version block is outdated for minimum Python 45 43 | if True: 46 44 | if sys.version_info < (3,0): -error[UP036]: UP036_2.py:46:8: [*] Version block is outdated for minimum Python version +error[UP036]: 46:8: [*] Version block is outdated for minimum Python version + --> UP036_2.py:46:8 | 45 | if True: 46 | if sys.version_info < (3,0): @@ -230,8 +240,9 @@ error[UP036]: UP036_2.py:46:8: [*] Version block is outdated for minimum Python 49 48 | if sys.version_info < (3,0): 50 49 | pass -error[UP036]: UP036_2.py:49:4: [*] Version block is outdated for minimum Python version +error[UP036]: 49:4: [*] Version block is outdated for minimum Python version + --> UP036_2.py:49:4 | 47 | pass 48 | @@ -253,8 +264,9 @@ error[UP036]: UP036_2.py:49:4: [*] Version block is outdated for minimum Python 53 51 | 54 52 | if sys.version_info > (3,): -error[UP036]: UP036_2.py:54:4: [*] Version block is outdated for minimum Python version +error[UP036]: 54:4: [*] Version block is outdated for minimum Python version + --> UP036_2.py:54:4 | 52 | pass 53 | diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_3.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_3.py.snap index 594e0f1ee2..13316c1c65 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_3.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_3.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -error[UP036]: UP036_3.py:3:15: [*] Version block is outdated for minimum Python version +error[UP036]: 3:15: [*] Version block is outdated for minimum Python version + --> UP036_3.py:3:15 | 1 | import sys 2 | @@ -30,8 +31,9 @@ error[UP036]: UP036_3.py:3:15: [*] Version block is outdated for minimum Python 12 7 | if False: 13 8 | if sys.version_info < (3,0): -error[UP036]: UP036_3.py:13:19: [*] Version block is outdated for minimum Python version +error[UP036]: 13:19: [*] Version block is outdated for minimum Python version + --> UP036_3.py:13:19 | 12 | if False: 13 | if sys.version_info < (3,0): @@ -59,8 +61,9 @@ error[UP036]: UP036_3.py:13:19: [*] Version block is outdated for minimum Python 22 17 | 23 18 | if sys.version_info < (3,0): print("PY2!") -error[UP036]: UP036_3.py:23:15: [*] Version block is outdated for minimum Python version +error[UP036]: 23:15: [*] Version block is outdated for minimum Python version + --> UP036_3.py:23:15 | 23 | if sys.version_info < (3,0): print("PY2!") | ^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_4.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_4.py.snap index f247e274c2..467011d315 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_4.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_4.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -error[UP036]: UP036_4.py:4:8: [*] Version block is outdated for minimum Python version +error[UP036]: 4:8: [*] Version block is outdated for minimum Python version + --> UP036_4.py:4:8 | 3 | if True: 4 | if sys.version_info < (3, 3): @@ -21,8 +22,9 @@ error[UP036]: UP036_4.py:4:8: [*] Version block is outdated for minimum Python v 7 6 | 8 7 | if True: -error[UP036]: UP036_4.py:11:10: [*] Version block is outdated for minimum Python version +error[UP036]: 11:10: [*] Version block is outdated for minimum Python version + --> UP036_4.py:11:10 | 9 | if foo: 10 | print() @@ -42,8 +44,9 @@ error[UP036]: UP036_4.py:11:10: [*] Version block is outdated for minimum Python 14 13 | if True: 15 14 | if foo: -error[UP036]: UP036_4.py:17:10: [*] Version block is outdated for minimum Python version +error[UP036]: 17:10: [*] Version block is outdated for minimum Python version + --> UP036_4.py:17:10 | 15 | if foo: 16 | print() @@ -63,8 +66,9 @@ error[UP036]: UP036_4.py:17:10: [*] Version block is outdated for minimum Python 20 18 | cmd = [sys.executable, "-m", "test", "-j0"] 21 19 | -error[UP036]: UP036_4.py:24:10: [*] Version block is outdated for minimum Python version +error[UP036]: 24:10: [*] Version block is outdated for minimum Python version + --> UP036_4.py:24:10 | 22 | if foo: 23 | print() @@ -84,8 +88,9 @@ error[UP036]: UP036_4.py:24:10: [*] Version block is outdated for minimum Python 27 26 | if sys.version_info < (3, 3): 28 27 | cmd = [sys.executable, "-m", "test.regrtest"] -error[UP036]: UP036_4.py:27:8: [*] Version block is outdated for minimum Python version +error[UP036]: 27:8: [*] Version block is outdated for minimum Python version + --> UP036_4.py:27:8 | 25 | cmd = [sys.executable, "-m", "test.regrtest"] 26 | @@ -104,8 +109,9 @@ error[UP036]: UP036_4.py:27:8: [*] Version block is outdated for minimum Python 30 28 | if foo: 31 29 | print() -error[UP036]: UP036_4.py:32:10: [*] Version block is outdated for minimum Python version +error[UP036]: 32:10: [*] Version block is outdated for minimum Python version + --> UP036_4.py:32:10 | 30 | if foo: 31 | print() @@ -125,8 +131,9 @@ error[UP036]: UP036_4.py:32:10: [*] Version block is outdated for minimum Python 35 33 | cmd = [sys.executable, "-m", "test", "-j0"] 36 34 | -error[UP036]: UP036_4.py:37:8: [*] Version block is outdated for minimum Python version +error[UP036]: 37:8: [*] Version block is outdated for minimum Python version + --> UP036_4.py:37:8 | 35 | cmd = [sys.executable, "-m", "test", "-j0"] 36 | @@ -149,8 +156,9 @@ error[UP036]: UP036_4.py:37:8: [*] Version block is outdated for minimum Python 42 39 | if sys.version_info < (3, 3): 43 40 | cmd = [sys.executable, "-m", "test.regrtest"] -error[UP036]: UP036_4.py:42:8: [*] Version block is outdated for minimum Python version +error[UP036]: 42:8: [*] Version block is outdated for minimum Python version + --> UP036_4.py:42:8 | 40 | cmd = [sys.executable, "-m", "test", "-j0"] 41 | diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_5.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_5.py.snap index 27f040d18c..45f9edd31a 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_5.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_5.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -error[UP036]: UP036_5.py:3:4: [*] Version block is outdated for minimum Python version +error[UP036]: 3:4: [*] Version block is outdated for minimum Python version + --> UP036_5.py:3:4 | 1 | import sys 2 | @@ -31,8 +32,9 @@ error[UP036]: UP036_5.py:3:4: [*] Version block is outdated for minimum Python v 15 5 | 16 6 | import sys -error[UP036]: UP036_5.py:18:4: [*] Version block is outdated for minimum Python version +error[UP036]: 18:4: [*] Version block is outdated for minimum Python version + --> UP036_5.py:18:4 | 16 | import sys 17 | diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP037_0.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP037_0.py.snap index 7db4943a8f..3b98f40850 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP037_0.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP037_0.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -error[UP037]: UP037_0.py:18:14: [*] Remove quotes from type annotation +error[UP037]: 18:14: [*] Remove quotes from type annotation + --> UP037_0.py:18:14 | 18 | def foo(var: "MyClass") -> "MyClass": | ^^^^^^^^^ @@ -19,8 +20,9 @@ error[UP037]: UP037_0.py:18:14: [*] Remove quotes from type annotation 20 20 | 21 21 | -error[UP037]: UP037_0.py:18:28: [*] Remove quotes from type annotation +error[UP037]: 18:28: [*] Remove quotes from type annotation + --> UP037_0.py:18:28 | 18 | def foo(var: "MyClass") -> "MyClass": | ^^^^^^^^^ @@ -37,8 +39,9 @@ error[UP037]: UP037_0.py:18:28: [*] Remove quotes from type annotation 20 20 | 21 21 | -error[UP037]: UP037_0.py:19:8: [*] Remove quotes from type annotation +error[UP037]: 19:8: [*] Remove quotes from type annotation + --> UP037_0.py:19:8 | 18 | def foo(var: "MyClass") -> "MyClass": 19 | x: "MyClass" @@ -55,8 +58,9 @@ error[UP037]: UP037_0.py:19:8: [*] Remove quotes from type annotation 21 21 | 22 22 | def foo(*, inplace: "bool"): -error[UP037]: UP037_0.py:22:21: [*] Remove quotes from type annotation +error[UP037]: 22:21: [*] Remove quotes from type annotation + --> UP037_0.py:22:21 | 22 | def foo(*, inplace: "bool"): | ^^^^^^ @@ -73,8 +77,9 @@ error[UP037]: UP037_0.py:22:21: [*] Remove quotes from type annotation 24 24 | 25 25 | -error[UP037]: UP037_0.py:26:16: [*] Remove quotes from type annotation +error[UP037]: 26:16: [*] Remove quotes from type annotation + --> UP037_0.py:26:16 | 26 | def foo(*args: "str", **kwargs: "int"): | ^^^^^ @@ -91,8 +96,9 @@ error[UP037]: UP037_0.py:26:16: [*] Remove quotes from type annotation 28 28 | 29 29 | -error[UP037]: UP037_0.py:26:33: [*] Remove quotes from type annotation +error[UP037]: 26:33: [*] Remove quotes from type annotation + --> UP037_0.py:26:33 | 26 | def foo(*args: "str", **kwargs: "int"): | ^^^^^ @@ -109,8 +115,9 @@ error[UP037]: UP037_0.py:26:33: [*] Remove quotes from type annotation 28 28 | 29 29 | -error[UP037]: UP037_0.py:30:10: [*] Remove quotes from type annotation +error[UP037]: 30:10: [*] Remove quotes from type annotation + --> UP037_0.py:30:10 | 30 | x: Tuple["MyClass"] | ^^^^^^^^^ @@ -128,8 +135,9 @@ error[UP037]: UP037_0.py:30:10: [*] Remove quotes from type annotation 32 32 | x: Callable[["MyClass"], None] 33 33 | -error[UP037]: UP037_0.py:32:14: [*] Remove quotes from type annotation +error[UP037]: 32:14: [*] Remove quotes from type annotation + --> UP037_0.py:32:14 | 30 | x: Tuple["MyClass"] 31 | @@ -147,8 +155,9 @@ error[UP037]: UP037_0.py:32:14: [*] Remove quotes from type annotation 34 34 | 35 35 | class Foo(NamedTuple): -error[UP037]: UP037_0.py:36:8: [*] Remove quotes from type annotation +error[UP037]: 36:8: [*] Remove quotes from type annotation + --> UP037_0.py:36:8 | 35 | class Foo(NamedTuple): 36 | x: "MyClass" @@ -165,8 +174,9 @@ error[UP037]: UP037_0.py:36:8: [*] Remove quotes from type annotation 38 38 | 39 39 | class D(TypedDict): -error[UP037]: UP037_0.py:40:27: [*] Remove quotes from type annotation +error[UP037]: 40:27: [*] Remove quotes from type annotation + --> UP037_0.py:40:27 | 39 | class D(TypedDict): 40 | E: TypedDict("E", foo="int", total=False) @@ -183,8 +193,9 @@ error[UP037]: UP037_0.py:40:27: [*] Remove quotes from type annotation 42 42 | 43 43 | class D(TypedDict): -error[UP037]: UP037_0.py:44:31: [*] Remove quotes from type annotation +error[UP037]: 44:31: [*] Remove quotes from type annotation + --> UP037_0.py:44:31 | 43 | class D(TypedDict): 44 | E: TypedDict("E", {"foo": "int"}) @@ -201,8 +212,9 @@ error[UP037]: UP037_0.py:44:31: [*] Remove quotes from type annotation 46 46 | 47 47 | x: Annotated["str", "metadata"] -error[UP037]: UP037_0.py:47:14: [*] Remove quotes from type annotation +error[UP037]: 47:14: [*] Remove quotes from type annotation + --> UP037_0.py:47:14 | 47 | x: Annotated["str", "metadata"] | ^^^^^ @@ -220,8 +232,9 @@ error[UP037]: UP037_0.py:47:14: [*] Remove quotes from type annotation 49 49 | x: Arg("str", "name") 50 50 | -error[UP037]: UP037_0.py:49:8: [*] Remove quotes from type annotation +error[UP037]: 49:8: [*] Remove quotes from type annotation + --> UP037_0.py:49:8 | 47 | x: Annotated["str", "metadata"] 48 | @@ -241,8 +254,9 @@ error[UP037]: UP037_0.py:49:8: [*] Remove quotes from type annotation 51 51 | x: DefaultArg("str", "name") 52 52 | -error[UP037]: UP037_0.py:51:15: [*] Remove quotes from type annotation +error[UP037]: 51:15: [*] Remove quotes from type annotation + --> UP037_0.py:51:15 | 49 | x: Arg("str", "name") 50 | @@ -262,8 +276,9 @@ error[UP037]: UP037_0.py:51:15: [*] Remove quotes from type annotation 53 53 | x: NamedArg("str", "name") 54 54 | -error[UP037]: UP037_0.py:53:13: [*] Remove quotes from type annotation +error[UP037]: 53:13: [*] Remove quotes from type annotation + --> UP037_0.py:53:13 | 51 | x: DefaultArg("str", "name") 52 | @@ -283,8 +298,9 @@ error[UP037]: UP037_0.py:53:13: [*] Remove quotes from type annotation 55 55 | x: DefaultNamedArg("str", "name") 56 56 | -error[UP037]: UP037_0.py:55:20: [*] Remove quotes from type annotation +error[UP037]: 55:20: [*] Remove quotes from type annotation + --> UP037_0.py:55:20 | 53 | x: NamedArg("str", "name") 54 | @@ -304,8 +320,9 @@ error[UP037]: UP037_0.py:55:20: [*] Remove quotes from type annotation 57 57 | x: DefaultNamedArg("str", name="name") 58 58 | -error[UP037]: UP037_0.py:57:20: [*] Remove quotes from type annotation +error[UP037]: 57:20: [*] Remove quotes from type annotation + --> UP037_0.py:57:20 | 55 | x: DefaultNamedArg("str", "name") 56 | @@ -325,8 +342,9 @@ error[UP037]: UP037_0.py:57:20: [*] Remove quotes from type annotation 59 59 | x: VarArg("str") 60 60 | -error[UP037]: UP037_0.py:59:11: [*] Remove quotes from type annotation +error[UP037]: 59:11: [*] Remove quotes from type annotation + --> UP037_0.py:59:11 | 57 | x: DefaultNamedArg("str", name="name") 58 | @@ -346,8 +364,9 @@ error[UP037]: UP037_0.py:59:11: [*] Remove quotes from type annotation 61 61 | x: List[List[List["MyClass"]]] 62 62 | -error[UP037]: UP037_0.py:61:19: [*] Remove quotes from type annotation +error[UP037]: 61:19: [*] Remove quotes from type annotation + --> UP037_0.py:61:19 | 59 | x: VarArg("str") 60 | @@ -367,8 +386,9 @@ error[UP037]: UP037_0.py:61:19: [*] Remove quotes from type annotation 63 63 | x: NamedTuple("X", [("foo", "int"), ("bar", "str")]) 64 64 | -error[UP037]: UP037_0.py:63:29: [*] Remove quotes from type annotation +error[UP037]: 63:29: [*] Remove quotes from type annotation + --> UP037_0.py:63:29 | 61 | x: List[List[List["MyClass"]]] 62 | @@ -388,8 +408,9 @@ error[UP037]: UP037_0.py:63:29: [*] Remove quotes from type annotation 65 65 | x: NamedTuple("X", fields=[("foo", "int"), ("bar", "str")]) 66 66 | -error[UP037]: UP037_0.py:63:45: [*] Remove quotes from type annotation +error[UP037]: 63:45: [*] Remove quotes from type annotation + --> UP037_0.py:63:45 | 61 | x: List[List[List["MyClass"]]] 62 | @@ -409,8 +430,9 @@ error[UP037]: UP037_0.py:63:45: [*] Remove quotes from type annotation 65 65 | x: NamedTuple("X", fields=[("foo", "int"), ("bar", "str")]) 66 66 | -error[UP037]: UP037_0.py:65:29: [*] Remove quotes from type annotation +error[UP037]: 65:29: [*] Remove quotes from type annotation + --> UP037_0.py:65:29 | 63 | x: NamedTuple("X", [("foo", "int"), ("bar", "str")]) 64 | @@ -430,8 +452,9 @@ error[UP037]: UP037_0.py:65:29: [*] Remove quotes from type annotation 67 67 | x: NamedTuple(typename="X", fields=[("foo", "int")]) 68 68 | -error[UP037]: UP037_0.py:65:36: [*] Remove quotes from type annotation +error[UP037]: 65:36: [*] Remove quotes from type annotation + --> UP037_0.py:65:36 | 63 | x: NamedTuple("X", [("foo", "int"), ("bar", "str")]) 64 | @@ -451,8 +474,9 @@ error[UP037]: UP037_0.py:65:36: [*] Remove quotes from type annotation 67 67 | x: NamedTuple(typename="X", fields=[("foo", "int")]) 68 68 | -error[UP037]: UP037_0.py:65:45: [*] Remove quotes from type annotation +error[UP037]: 65:45: [*] Remove quotes from type annotation + --> UP037_0.py:65:45 | 63 | x: NamedTuple("X", [("foo", "int"), ("bar", "str")]) 64 | @@ -472,8 +496,9 @@ error[UP037]: UP037_0.py:65:45: [*] Remove quotes from type annotation 67 67 | x: NamedTuple(typename="X", fields=[("foo", "int")]) 68 68 | -error[UP037]: UP037_0.py:65:52: [*] Remove quotes from type annotation +error[UP037]: 65:52: [*] Remove quotes from type annotation + --> UP037_0.py:65:52 | 63 | x: NamedTuple("X", [("foo", "int"), ("bar", "str")]) 64 | @@ -493,8 +518,9 @@ error[UP037]: UP037_0.py:65:52: [*] Remove quotes from type annotation 67 67 | x: NamedTuple(typename="X", fields=[("foo", "int")]) 68 68 | -error[UP037]: UP037_0.py:67:24: [*] Remove quotes from type annotation +error[UP037]: 67:24: [*] Remove quotes from type annotation + --> UP037_0.py:67:24 | 65 | x: NamedTuple("X", fields=[("foo", "int"), ("bar", "str")]) 66 | @@ -514,8 +540,9 @@ error[UP037]: UP037_0.py:67:24: [*] Remove quotes from type annotation 69 69 | X: MyCallable("X") 70 70 | -error[UP037]: UP037_0.py:67:38: [*] Remove quotes from type annotation +error[UP037]: 67:38: [*] Remove quotes from type annotation + --> UP037_0.py:67:38 | 65 | x: NamedTuple("X", fields=[("foo", "int"), ("bar", "str")]) 66 | @@ -535,8 +562,9 @@ error[UP037]: UP037_0.py:67:38: [*] Remove quotes from type annotation 69 69 | X: MyCallable("X") 70 70 | -error[UP037]: UP037_0.py:67:45: [*] Remove quotes from type annotation +error[UP037]: 67:45: [*] Remove quotes from type annotation + --> UP037_0.py:67:45 | 65 | x: NamedTuple("X", fields=[("foo", "int"), ("bar", "str")]) 66 | diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP037_1.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP037_1.py.snap index 003b1471f4..7bbfea6d10 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP037_1.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP037_1.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -error[UP037]: UP037_1.py:9:8: [*] Remove quotes from type annotation +error[UP037]: 9:8: [*] Remove quotes from type annotation + --> UP037_1.py:9:8 | 7 | def foo(): 8 | # UP037 diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP038.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP038.py.snap index 1e75087d63..68f7861d3e 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP038.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP038.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -error[UP038]: UP038.py:1:1: [*] Use `X | Y` in `isinstance` call instead of `(X, Y)` +error[UP038]: 1:1: [*] Use `X | Y` in `isinstance` call instead of `(X, Y)` + --> UP038.py:1:1 | 1 | isinstance(1, (int, float)) # UP038 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -16,8 +17,9 @@ error[UP038]: UP038.py:1:1: [*] Use `X | Y` in `isinstance` call instead of `(X, 3 3 | 4 4 | isinstance(1, int) # OK -error[UP038]: UP038.py:2:1: [*] Use `X | Y` in `issubclass` call instead of `(X, Y)` +error[UP038]: 2:1: [*] Use `X | Y` in `issubclass` call instead of `(X, Y)` + --> UP038.py:1:37 | 1 | isinstance(1, (int, float)) # UP038 2 | issubclass("yes", (int, float, str)) # UP038 diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP039.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP039.py.snap index f663ac5be1..8975fe08e7 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP039.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP039.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -error[UP039]: UP039.py:2:8: [*] Unnecessary parentheses after class definition +error[UP039]: 2:8: [*] Unnecessary parentheses after class definition + --> UP039.py:2:8 | 1 | # Errors 2 | class A(): @@ -18,8 +19,9 @@ error[UP039]: UP039.py:2:8: [*] Unnecessary parentheses after class definition 4 4 | 5 5 | -error[UP039]: UP039.py:6:8: [*] Unnecessary parentheses after class definition +error[UP039]: 6:8: [*] Unnecessary parentheses after class definition + --> UP039.py:6:8 | 6 | class A() \ | ^^ @@ -37,8 +39,9 @@ error[UP039]: UP039.py:6:8: [*] Unnecessary parentheses after class definition 8 8 | pass 9 9 | -error[UP039]: UP039.py:12:9: [*] Unnecessary parentheses after class definition +error[UP039]: 12:9: [*] Unnecessary parentheses after class definition + --> UP039.py:12:9 | 11 | class A \ 12 | (): @@ -56,8 +59,9 @@ error[UP039]: UP039.py:12:9: [*] Unnecessary parentheses after class definition 14 14 | 15 15 | -error[UP039]: UP039.py:17:8: [*] Unnecessary parentheses after class definition +error[UP039]: 17:8: [*] Unnecessary parentheses after class definition + --> UP039.py:17:8 | 16 | @decorator() 17 | class A(): @@ -75,8 +79,9 @@ error[UP039]: UP039.py:17:8: [*] Unnecessary parentheses after class definition 19 19 | 20 20 | @decorator -error[UP039]: UP039.py:21:8: [*] Unnecessary parentheses after class definition +error[UP039]: 21:8: [*] Unnecessary parentheses after class definition + --> UP039.py:21:8 | 20 | @decorator 21 | class A(): diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP040.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP040.py.snap index aefb9beac4..8e38bcc1a4 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP040.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP040.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -error[UP040]: UP040.py:5:1: [*] Type alias `x` uses `TypeAlias` annotation instead of the `type` keyword +error[UP040]: 5:1: [*] Type alias `x` uses `TypeAlias` annotation instead of the `type` keyword + --> UP040.py:4:8 | 4 | # UP040 5 | x: typing.TypeAlias = int @@ -20,8 +21,9 @@ error[UP040]: UP040.py:5:1: [*] Type alias `x` uses `TypeAlias` annotation inste 7 7 | 8 8 | # UP040 simple generic -error[UP040]: UP040.py:6:1: [*] Type alias `x` uses `TypeAlias` annotation instead of the `type` keyword +error[UP040]: 6:1: [*] Type alias `x` uses `TypeAlias` annotation instead of the `type` keyword + --> UP040.py:5:26 | 4 | # UP040 5 | x: typing.TypeAlias = int @@ -41,8 +43,9 @@ error[UP040]: UP040.py:6:1: [*] Type alias `x` uses `TypeAlias` annotation inste 8 8 | # UP040 simple generic 9 9 | T = typing.TypeVar["T"] -error[UP040]: UP040.py:10:1: [*] Type alias `x` uses `TypeAlias` annotation instead of the `type` keyword +error[UP040]: 10:1: [*] Type alias `x` uses `TypeAlias` annotation instead of the `type` keyword + --> UP040.py:9:24 | 8 | # UP040 simple generic 9 | T = typing.TypeVar["T"] @@ -62,8 +65,9 @@ error[UP040]: UP040.py:10:1: [*] Type alias `x` uses `TypeAlias` annotation inst 12 12 | # UP040 call style generic 13 13 | T = typing.TypeVar("T") -error[UP040]: UP040.py:14:1: [*] Type alias `x` uses `TypeAlias` annotation instead of the `type` keyword +error[UP040]: 14:1: [*] Type alias `x` uses `TypeAlias` annotation instead of the `type` keyword + --> UP040.py:13:24 | 12 | # UP040 call style generic 13 | T = typing.TypeVar("T") @@ -83,8 +87,9 @@ error[UP040]: UP040.py:14:1: [*] Type alias `x` uses `TypeAlias` annotation inst 16 16 | # UP040 bounded generic 17 17 | T = typing.TypeVar("T", bound=int) -error[UP040]: UP040.py:18:1: [*] Type alias `x` uses `TypeAlias` annotation instead of the `type` keyword +error[UP040]: 18:1: [*] Type alias `x` uses `TypeAlias` annotation instead of the `type` keyword + --> UP040.py:17:35 | 16 | # UP040 bounded generic 17 | T = typing.TypeVar("T", bound=int) @@ -104,8 +109,9 @@ error[UP040]: UP040.py:18:1: [*] Type alias `x` uses `TypeAlias` annotation inst 20 20 | # UP040 constrained generic 21 21 | T = typing.TypeVar("T", int, str) -error[UP040]: UP040.py:22:1: [*] Type alias `x` uses `TypeAlias` annotation instead of the `type` keyword +error[UP040]: 22:1: [*] Type alias `x` uses `TypeAlias` annotation instead of the `type` keyword + --> UP040.py:21:34 | 20 | # UP040 constrained generic 21 | T = typing.TypeVar("T", int, str) @@ -125,8 +131,9 @@ error[UP040]: UP040.py:22:1: [*] Type alias `x` uses `TypeAlias` annotation inst 24 24 | # UP040 contravariant generic 25 25 | T = typing.TypeVar("T", contravariant=True) -error[UP040]: UP040.py:26:1: [*] Type alias `x` uses `TypeAlias` annotation instead of the `type` keyword +error[UP040]: 26:1: [*] Type alias `x` uses `TypeAlias` annotation instead of the `type` keyword + --> UP040.py:25:44 | 24 | # UP040 contravariant generic 25 | T = typing.TypeVar("T", contravariant=True) @@ -146,8 +153,9 @@ error[UP040]: UP040.py:26:1: [*] Type alias `x` uses `TypeAlias` annotation inst 28 28 | # UP040 covariant generic 29 29 | T = typing.TypeVar("T", covariant=True) -error[UP040]: UP040.py:30:1: [*] Type alias `x` uses `TypeAlias` annotation instead of the `type` keyword +error[UP040]: 30:1: [*] Type alias `x` uses `TypeAlias` annotation instead of the `type` keyword + --> UP040.py:29:40 | 28 | # UP040 covariant generic 29 | T = typing.TypeVar("T", covariant=True) @@ -167,8 +175,9 @@ error[UP040]: UP040.py:30:1: [*] Type alias `x` uses `TypeAlias` annotation inst 32 32 | # UP040 in class scope 33 33 | T = typing.TypeVar["T"] -error[UP040]: UP040.py:36:5: [*] Type alias `x` uses `TypeAlias` annotation instead of the `type` keyword +error[UP040]: 36:5: [*] Type alias `x` uses `TypeAlias` annotation instead of the `type` keyword + --> UP040.py:36:5 | 34 | class Foo: 35 | # reference to global variable @@ -188,8 +197,9 @@ error[UP040]: UP040.py:36:5: [*] Type alias `x` uses `TypeAlias` annotation inst 38 38 | # reference to class variable 39 39 | TCLS = typing.TypeVar["TCLS"] -error[UP040]: UP040.py:40:5: [*] Type alias `y` uses `TypeAlias` annotation instead of the `type` keyword +error[UP040]: 40:5: [*] Type alias `y` uses `TypeAlias` annotation instead of the `type` keyword + --> UP040.py:40:5 | 38 | # reference to class variable 39 | TCLS = typing.TypeVar["TCLS"] @@ -209,8 +219,9 @@ error[UP040]: UP040.py:40:5: [*] Type alias `y` uses `TypeAlias` annotation inst 42 42 | # UP040 won't add generics in fix 43 43 | T = typing.TypeVar(*args) -error[UP040]: UP040.py:44:1: [*] Type alias `x` uses `TypeAlias` annotation instead of the `type` keyword +error[UP040]: 44:1: [*] Type alias `x` uses `TypeAlias` annotation instead of the `type` keyword + --> UP040.py:43:26 | 42 | # UP040 won't add generics in fix 43 | T = typing.TypeVar(*args) @@ -230,8 +241,9 @@ error[UP040]: UP040.py:44:1: [*] Type alias `x` uses `TypeAlias` annotation inst 46 46 | # OK 47 47 | x: TypeAlias -error[UP040]: UP040.py:53:1: [*] Type alias `Decorator` uses `TypeAlias` annotation instead of the `type` keyword +error[UP040]: 53:1: [*] Type alias `Decorator` uses `TypeAlias` annotation instead of the `type` keyword + --> UP040.py:52:24 | 51 | # type alias. 52 | T = typing.TypeVar["T"] @@ -249,8 +261,9 @@ error[UP040]: UP040.py:53:1: [*] Type alias `Decorator` uses `TypeAlias` annotat 55 55 | 56 56 | from typing import TypeVar, Annotated, TypeAliasType -error[UP040]: UP040.py:63:1: [*] Type alias `PositiveList` uses `TypeAliasType` assignment instead of the `type` keyword +error[UP040]: 63:1: [*] Type alias `PositiveList` uses `TypeAliasType` assignment instead of the `type` keyword + --> UP040.py:62:17 | 61 | # https://github.com/astral-sh/ruff/issues/11422 62 | T = TypeVar("T") @@ -274,8 +287,9 @@ error[UP040]: UP040.py:63:1: [*] Type alias `PositiveList` uses `TypeAliasType` 67 65 | # Bound 68 66 | T = TypeVar("T", bound=SupportGt) -error[UP040]: UP040.py:69:1: [*] Type alias `PositiveList` uses `TypeAliasType` assignment instead of the `type` keyword +error[UP040]: 69:1: [*] Type alias `PositiveList` uses `TypeAliasType` assignment instead of the `type` keyword + --> UP040.py:68:34 | 67 | # Bound 68 | T = TypeVar("T", bound=SupportGt) @@ -299,8 +313,9 @@ error[UP040]: UP040.py:69:1: [*] Type alias `PositiveList` uses `TypeAliasType` 73 71 | # Multiple bounds 74 72 | T1 = TypeVar("T1", bound=SupportGt) -error[UP040]: UP040.py:77:1: [*] Type alias `Tuple3` uses `TypeAliasType` assignment instead of the `type` keyword +error[UP040]: 77:1: [*] Type alias `Tuple3` uses `TypeAliasType` assignment instead of the `type` keyword + --> UP040.py:76:19 | 75 | T2 = TypeVar("T2") 76 | T3 = TypeVar("T3") @@ -320,8 +335,9 @@ error[UP040]: UP040.py:77:1: [*] Type alias `Tuple3` uses `TypeAliasType` assign 79 79 | # No type_params 80 80 | PositiveInt = TypeAliasType("PositiveInt", Annotated[int, Gt(0)]) -error[UP040]: UP040.py:80:1: [*] Type alias `PositiveInt` uses `TypeAliasType` assignment instead of the `type` keyword +error[UP040]: 80:1: [*] Type alias `PositiveInt` uses `TypeAliasType` assignment instead of the `type` keyword + --> UP040.py:79:17 | 79 | # No type_params 80 | PositiveInt = TypeAliasType("PositiveInt", Annotated[int, Gt(0)]) @@ -339,8 +355,9 @@ error[UP040]: UP040.py:80:1: [*] Type alias `PositiveInt` uses `TypeAliasType` a 82 82 | 83 83 | # OK: Other name -error[UP040]: UP040.py:81:1: [*] Type alias `PositiveInt` uses `TypeAliasType` assignment instead of the `type` keyword +error[UP040]: 81:1: [*] Type alias `PositiveInt` uses `TypeAliasType` assignment instead of the `type` keyword + --> UP040.py:80:66 | 79 | # No type_params 80 | PositiveInt = TypeAliasType("PositiveInt", Annotated[int, Gt(0)]) diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP040.pyi.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP040.pyi.snap index 5f1c3849d4..6892b87679 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP040.pyi.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP040.pyi.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -error[UP040]: UP040.pyi:6:1: [*] Type alias `x` uses `TypeAlias` annotation instead of the `type` keyword +error[UP040]: 6:1: [*] Type alias `x` uses `TypeAlias` annotation instead of the `type` keyword + --> UP040.pyi:5:110 | 4 | # UP040 5 | # Fixes in type stub files should be safe to apply unlike in regular code where runtime behavior could change @@ -19,8 +20,9 @@ error[UP040]: UP040.pyi:6:1: [*] Type alias `x` uses `TypeAlias` annotation inst 6 |+type x = int 7 7 | x: TypeAlias = int -error[UP040]: UP040.pyi:7:1: [*] Type alias `x` uses `TypeAlias` annotation instead of the `type` keyword +error[UP040]: 7:1: [*] Type alias `x` uses `TypeAlias` annotation instead of the `type` keyword + --> UP040.pyi:6:26 | 5 | # Fixes in type stub files should be safe to apply unlike in regular code where runtime behavior could change 6 | x: typing.TypeAlias = int diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP041.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP041.py.snap index 27cd4cfc08..b2a7777817 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP041.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP041.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -error[UP041]: UP041.py:5:8: [*] Replace aliased errors with `TimeoutError` +error[UP041]: 5:8: [*] Replace aliased errors with `TimeoutError` + --> UP041.py:5:8 | 3 | try: 4 | pass @@ -21,8 +22,9 @@ error[UP041]: UP041.py:5:8: [*] Replace aliased errors with `TimeoutError` 7 7 | 8 8 | try: -error[UP041]: UP041.py:10:8: [*] Replace aliased errors with `TimeoutError` +error[UP041]: 10:8: [*] Replace aliased errors with `TimeoutError` + --> UP041.py:10:8 | 8 | try: 9 | pass @@ -41,8 +43,9 @@ error[UP041]: UP041.py:10:8: [*] Replace aliased errors with `TimeoutError` 12 12 | 13 13 | # Should NOT be in parentheses when replaced -error[UP041]: UP041.py:17:8: [*] Replace aliased errors with `TimeoutError` +error[UP041]: 17:8: [*] Replace aliased errors with `TimeoutError` + --> UP041.py:17:8 | 15 | try: 16 | pass @@ -61,8 +64,9 @@ error[UP041]: UP041.py:17:8: [*] Replace aliased errors with `TimeoutError` 19 19 | 20 20 | try: -error[UP041]: UP041.py:22:8: [*] Replace aliased errors with `TimeoutError` +error[UP041]: 22:8: [*] Replace aliased errors with `TimeoutError` + --> UP041.py:22:8 | 20 | try: 21 | pass @@ -81,8 +85,9 @@ error[UP041]: UP041.py:22:8: [*] Replace aliased errors with `TimeoutError` 24 24 | 25 25 | try: -error[UP041]: UP041.py:27:8: [*] Replace aliased errors with `TimeoutError` +error[UP041]: 27:8: [*] Replace aliased errors with `TimeoutError` + --> UP041.py:27:8 | 25 | try: 26 | pass @@ -101,8 +106,9 @@ error[UP041]: UP041.py:27:8: [*] Replace aliased errors with `TimeoutError` 29 29 | 30 30 | # Should be kept in parentheses (because multiple) -error[UP041]: UP041.py:34:8: [*] Replace aliased errors with `TimeoutError` +error[UP041]: 34:8: [*] Replace aliased errors with `TimeoutError` + --> UP041.py:34:8 | 32 | try: 33 | pass @@ -121,8 +127,9 @@ error[UP041]: UP041.py:34:8: [*] Replace aliased errors with `TimeoutError` 36 36 | 37 37 | # First should change, second should not -error[UP041]: UP041.py:42:8: [*] Replace aliased errors with `TimeoutError` +error[UP041]: 42:8: [*] Replace aliased errors with `TimeoutError` + --> UP041.py:42:8 | 40 | try: 41 | pass diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP042.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP042.py.snap index 87c0ddda04..0d54dce0d4 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP042.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP042.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -error[UP042]: UP042.py:4:7: [*] Class A inherits from both `str` and `enum.Enum` +error[UP042]: 4:7: [*] Class A inherits from both `str` and `enum.Enum` + --> UP042.py:4:7 | 4 | class A(str, Enum): ... | ^ @@ -19,8 +20,9 @@ error[UP042]: UP042.py:4:7: [*] Class A inherits from both `str` and `enum.Enum` 6 6 | 7 7 | class B(Enum, str): ... -error[UP042]: UP042.py:7:7: [*] Class B inherits from both `str` and `enum.Enum` +error[UP042]: 7:7: [*] Class B inherits from both `str` and `enum.Enum` + --> UP042.py:7:7 | 7 | class B(Enum, str): ... | ^ @@ -40,15 +42,17 @@ error[UP042]: UP042.py:7:7: [*] Class B inherits from both `str` and `enum.Enum` 9 9 | 10 10 | class D(int, str, Enum): ... -error[UP042]: UP042.py:10:7: Class D inherits from both `str` and `enum.Enum` +error[UP042]: 10:7: Class D inherits from both `str` and `enum.Enum` + --> UP042.py:10:7 | 10 | class D(int, str, Enum): ... | ^ | = help: Inherit from `enum.StrEnum` -error[UP042]: UP042.py:13:7: Class E inherits from both `str` and `enum.Enum` +error[UP042]: 13:7: Class E inherits from both `str` and `enum.Enum` + --> UP042.py:13:7 | 13 | class E(str, int, Enum): ... | ^ diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP043.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP043.py.snap index 4198822ad3..30756af2e5 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP043.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP043.py.snap @@ -1,14 +1,15 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -UP043.py:4:15: UP043 [*] Unnecessary default type arguments +error[UP043]: 4:15: [*] Unnecessary default type arguments + + --> UP043.py:4:15 | 4 | def func() -> Generator[int, None, None]: - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ UP043 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ 5 | yield 42 | = help: Remove default type arguments - ℹ Safe fix 1 1 | from typing import Generator, AsyncGenerator 2 2 | @@ -19,14 +20,15 @@ UP043.py:4:15: UP043 [*] Unnecessary default type arguments 6 6 | 7 7 | -UP043.py:8:15: UP043 [*] Unnecessary default type arguments +error[UP043]: 8:15: [*] Unnecessary default type arguments + + --> UP043.py:8:15 | 8 | def func() -> Generator[int, None]: - | ^^^^^^^^^^^^^^^^^^^^ UP043 + | ^^^^^^^^^^^^^^^^^^^^ 9 | yield 42 | = help: Remove default type arguments - ℹ Safe fix 5 5 | yield 42 6 6 | @@ -37,15 +39,16 @@ UP043.py:8:15: UP043 [*] Unnecessary default type arguments 10 10 | 11 11 | -UP043.py:21:15: UP043 [*] Unnecessary default type arguments +error[UP043]: 21:15: [*] Unnecessary default type arguments + + --> UP043.py:21:15 | 21 | def func() -> Generator[int, int, None]: - | ^^^^^^^^^^^^^^^^^^^^^^^^^ UP043 + | ^^^^^^^^^^^^^^^^^^^^^^^^^ 22 | _ = yield 42 23 | return None | = help: Remove default type arguments - ℹ Safe fix 18 18 | return foo 19 19 | @@ -56,14 +59,15 @@ UP043.py:21:15: UP043 [*] Unnecessary default type arguments 23 23 | return None 24 24 | -UP043.py:31:21: UP043 [*] Unnecessary default type arguments +error[UP043]: 31:21: [*] Unnecessary default type arguments + + --> UP043.py:31:21 | 31 | async def func() -> AsyncGenerator[int, None]: - | ^^^^^^^^^^^^^^^^^^^^^^^^^ UP043 + | ^^^^^^^^^^^^^^^^^^^^^^^^^ 32 | yield 42 | = help: Remove default type arguments - ℹ Safe fix 28 28 | return 42 29 29 | diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__async_timeout_error_alias_not_applied_py310.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__async_timeout_error_alias_not_applied_py310.snap index ababacb759..612f9ddff9 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__async_timeout_error_alias_not_applied_py310.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__async_timeout_error_alias_not_applied_py310.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -error[UP041]: UP041.py:10:8: [*] Replace aliased errors with `TimeoutError` +error[UP041]: 10:8: [*] Replace aliased errors with `TimeoutError` + --> UP041.py:10:8 | 8 | try: 9 | pass @@ -21,8 +22,9 @@ error[UP041]: UP041.py:10:8: [*] Replace aliased errors with `TimeoutError` 12 12 | 13 13 | # Should NOT be in parentheses when replaced -error[UP041]: UP041.py:22:8: [*] Replace aliased errors with `TimeoutError` +error[UP041]: 22:8: [*] Replace aliased errors with `TimeoutError` + --> UP041.py:22:8 | 20 | try: 21 | pass @@ -41,8 +43,9 @@ error[UP041]: UP041.py:22:8: [*] Replace aliased errors with `TimeoutError` 24 24 | 25 25 | try: -error[UP041]: UP041.py:27:8: [*] Replace aliased errors with `TimeoutError` +error[UP041]: 27:8: [*] Replace aliased errors with `TimeoutError` + --> UP041.py:27:8 | 25 | try: 26 | pass @@ -61,8 +64,9 @@ error[UP041]: UP041.py:27:8: [*] Replace aliased errors with `TimeoutError` 29 29 | 30 30 | # Should be kept in parentheses (because multiple) -error[UP041]: UP041.py:34:8: [*] Replace aliased errors with `TimeoutError` +error[UP041]: 34:8: [*] Replace aliased errors with `TimeoutError` + --> UP041.py:34:8 | 32 | try: 33 | pass diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__datetime_utc_alias_py311.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__datetime_utc_alias_py311.snap index 852fd21921..7b39d0db05 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__datetime_utc_alias_py311.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__datetime_utc_alias_py311.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -error[UP017]: UP017.py:10:11: [*] Use `datetime.UTC` alias +error[UP017]: 10:11: [*] Use `datetime.UTC` alias + --> UP017.py:10:11 | 8 | from datetime import timezone 9 | @@ -25,8 +26,9 @@ error[UP017]: UP017.py:10:11: [*] Use `datetime.UTC` alias 12 13 | 13 14 | def func(): -error[UP017]: UP017.py:16:11: [*] Use `datetime.UTC` alias +error[UP017]: 16:11: [*] Use `datetime.UTC` alias + --> UP017.py:16:11 | 14 | from datetime import timezone as tz 15 | @@ -49,8 +51,9 @@ error[UP017]: UP017.py:16:11: [*] Use `datetime.UTC` alias 18 19 | 19 20 | def func(): -error[UP017]: UP017.py:22:11: [*] Use `datetime.UTC` alias +error[UP017]: 22:11: [*] Use `datetime.UTC` alias + --> UP017.py:22:11 | 20 | import datetime 21 | @@ -68,8 +71,9 @@ error[UP017]: UP017.py:22:11: [*] Use `datetime.UTC` alias 24 24 | 25 25 | def func(): -error[UP017]: UP017.py:28:11: [*] Use `datetime.UTC` alias +error[UP017]: 28:11: [*] Use `datetime.UTC` alias + --> UP017.py:28:11 | 26 | import datetime as dt 27 | diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_keep_runtime_typing_p310.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_keep_runtime_typing_p310.snap index 7c6ce239eb..1b8e7452e3 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_keep_runtime_typing_p310.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_keep_runtime_typing_p310.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -error[UP006]: future_annotations.py:34:18: [*] Use `list` instead of `List` for type annotation +error[UP006]: 34:18: [*] Use `list` instead of `List` for type annotation + --> future_annotations.py:34:18 | 34 | def f(x: int) -> List[int]: | ^^^^ @@ -20,8 +21,9 @@ error[UP006]: future_annotations.py:34:18: [*] Use `list` instead of `List` for 36 36 | y.append(x) 37 37 | return y -error[UP006]: future_annotations.py:35:9: [*] Use `list` instead of `List` for type annotation +error[UP006]: 35:9: [*] Use `list` instead of `List` for type annotation + --> future_annotations.py:35:9 | 34 | def f(x: int) -> List[int]: 35 | y = List[int]() @@ -40,8 +42,9 @@ error[UP006]: future_annotations.py:35:9: [*] Use `list` instead of `List` for t 37 37 | return y 38 38 | -error[UP006]: future_annotations.py:42:27: [*] Use `list` instead of `List` for type annotation +error[UP006]: 42:27: [*] Use `list` instead of `List` for type annotation + --> future_annotations.py:42:27 | 40 | x: Optional[int] = None 41 | @@ -56,8 +59,9 @@ error[UP006]: future_annotations.py:42:27: [*] Use `list` instead of `List` for 42 |-MyList: TypeAlias = Union[List[int], List[str]] 42 |+MyList: TypeAlias = Union[list[int], List[str]] -error[UP006]: future_annotations.py:42:38: [*] Use `list` instead of `List` for type annotation +error[UP006]: 42:38: [*] Use `list` instead of `List` for type annotation + --> future_annotations.py:42:38 | 40 | x: Optional[int] = None 41 | diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_585_p37.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_585_p37.snap index bf41b0b99a..49af54c4a6 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_585_p37.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_585_p37.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -error[UP006]: future_annotations.py:34:18: [*] Use `list` instead of `List` for type annotation +error[UP006]: 34:18: [*] Use `list` instead of `List` for type annotation + --> future_annotations.py:34:18 | 34 | def f(x: int) -> List[int]: | ^^^^ diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_585_py310.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_585_py310.snap index 7c6ce239eb..1b8e7452e3 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_585_py310.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_585_py310.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -error[UP006]: future_annotations.py:34:18: [*] Use `list` instead of `List` for type annotation +error[UP006]: 34:18: [*] Use `list` instead of `List` for type annotation + --> future_annotations.py:34:18 | 34 | def f(x: int) -> List[int]: | ^^^^ @@ -20,8 +21,9 @@ error[UP006]: future_annotations.py:34:18: [*] Use `list` instead of `List` for 36 36 | y.append(x) 37 37 | return y -error[UP006]: future_annotations.py:35:9: [*] Use `list` instead of `List` for type annotation +error[UP006]: 35:9: [*] Use `list` instead of `List` for type annotation + --> future_annotations.py:35:9 | 34 | def f(x: int) -> List[int]: 35 | y = List[int]() @@ -40,8 +42,9 @@ error[UP006]: future_annotations.py:35:9: [*] Use `list` instead of `List` for t 37 37 | return y 38 38 | -error[UP006]: future_annotations.py:42:27: [*] Use `list` instead of `List` for type annotation +error[UP006]: 42:27: [*] Use `list` instead of `List` for type annotation + --> future_annotations.py:42:27 | 40 | x: Optional[int] = None 41 | @@ -56,8 +59,9 @@ error[UP006]: future_annotations.py:42:27: [*] Use `list` instead of `List` for 42 |-MyList: TypeAlias = Union[List[int], List[str]] 42 |+MyList: TypeAlias = Union[list[int], List[str]] -error[UP006]: future_annotations.py:42:38: [*] Use `list` instead of `List` for type annotation +error[UP006]: 42:38: [*] Use `list` instead of `List` for type annotation + --> future_annotations.py:42:38 | 40 | x: Optional[int] = None 41 | diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_604_p37.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_604_p37.snap index ebf3881fa9..c58cb192f4 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_604_p37.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_604_p37.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -error[UP007]: future_annotations.py:40:4: [*] Use `X | Y` for type annotations +error[UP007]: 40:4: [*] Use `X | Y` for type annotations + --> future_annotations.py:40:4 | 40 | x: Optional[int] = None | ^^^^^^^^^^^^^ diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_604_py310.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_604_py310.snap index 8a29410593..f037f1119e 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_604_py310.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_604_py310.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -error[UP007]: future_annotations.py:40:4: [*] Use `X | Y` for type annotations +error[UP007]: 40:4: [*] Use `X | Y` for type annotations + --> future_annotations.py:40:4 | 40 | x: Optional[int] = None | ^^^^^^^^^^^^^ @@ -19,8 +20,9 @@ error[UP007]: future_annotations.py:40:4: [*] Use `X | Y` for type annotations 41 41 | 42 42 | MyList: TypeAlias = Union[List[int], List[str]] -error[UP007]: future_annotations.py:42:21: [*] Use `X | Y` for type annotations +error[UP007]: 42:21: [*] Use `X | Y` for type annotations + --> future_annotations.py:42:21 | 40 | x: Optional[int] = None 41 | diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__preview.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__preview.snap index 79c32ccea2..5c4c50c01e 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__preview.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__preview.snap @@ -1,16 +1,17 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -UP031_0.py:4:7: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 4:7: [*] Use format specifiers instead of percent format + + --> UP031_0.py:4:7 | 3 | # UP031 4 | print('%s %s' % (a, b)) - | ^^^^^^^^^^^^^^^^ UP031 + | ^^^^^^^^^^^^^^^^ 5 | 6 | print('%s%s' % (a, b)) | = help: Replace with format specifiers - ℹ Unsafe fix 1 1 | a, b, x, y = 1, 2, 3, 4 2 2 | @@ -21,17 +22,18 @@ UP031_0.py:4:7: UP031 [*] Use format specifiers instead of percent format 6 6 | print('%s%s' % (a, b)) 7 7 | -UP031_0.py:6:7: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 6:7: [*] Use format specifiers instead of percent format + + --> UP031_0.py:6:7 | 4 | print('%s %s' % (a, b)) 5 | 6 | print('%s%s' % (a, b)) - | ^^^^^^^^^^^^^^^ UP031 + | ^^^^^^^^^^^^^^^ 7 | 8 | print("trivial" % ()) | = help: Replace with format specifiers - ℹ Unsafe fix 3 3 | # UP031 4 4 | print('%s %s' % (a, b)) @@ -42,17 +44,18 @@ UP031_0.py:6:7: UP031 [*] Use format specifiers instead of percent format 8 8 | print("trivial" % ()) 9 9 | -UP031_0.py:8:7: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 8:7: [*] Use format specifiers instead of percent format + + --> UP031_0.py:8:7 | 6 | print('%s%s' % (a, b)) 7 | 8 | print("trivial" % ()) - | ^^^^^^^^^^^^^^ UP031 + | ^^^^^^^^^^^^^^ 9 | 10 | print("%s" % ("simple",)) | = help: Replace with format specifiers - ℹ Unsafe fix 5 5 | 6 6 | print('%s%s' % (a, b)) @@ -63,17 +66,18 @@ UP031_0.py:8:7: UP031 [*] Use format specifiers instead of percent format 10 10 | print("%s" % ("simple",)) 11 11 | -UP031_0.py:10:7: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 10:7: [*] Use format specifiers instead of percent format + + --> UP031_0.py:10:7 | 8 | print("trivial" % ()) 9 | 10 | print("%s" % ("simple",)) - | ^^^^^^^^^^^^^^^^^^ UP031 + | ^^^^^^^^^^^^^^^^^^ 11 | 12 | print("%s" % ("%s" % ("nested",),)) | = help: Replace with format specifiers - ℹ Unsafe fix 7 7 | 8 8 | print("trivial" % ()) @@ -84,17 +88,18 @@ UP031_0.py:10:7: UP031 [*] Use format specifiers instead of percent format 12 12 | print("%s" % ("%s" % ("nested",),)) 13 13 | -UP031_0.py:12:7: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 12:7: [*] Use format specifiers instead of percent format + + --> UP031_0.py:12:7 | 10 | print("%s" % ("simple",)) 11 | 12 | print("%s" % ("%s" % ("nested",),)) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP031 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 13 | 14 | print("%s%% percent" % (15,)) | = help: Replace with format specifiers - ℹ Unsafe fix 9 9 | 10 10 | print("%s" % ("simple",)) @@ -105,17 +110,18 @@ UP031_0.py:12:7: UP031 [*] Use format specifiers instead of percent format 14 14 | print("%s%% percent" % (15,)) 15 15 | -UP031_0.py:12:15: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 12:15: [*] Use format specifiers instead of percent format + + --> UP031_0.py:12:15 | 10 | print("%s" % ("simple",)) 11 | 12 | print("%s" % ("%s" % ("nested",),)) - | ^^^^^^^^^^^^^^^^^^ UP031 + | ^^^^^^^^^^^^^^^^^^ 13 | 14 | print("%s%% percent" % (15,)) | = help: Replace with format specifiers - ℹ Unsafe fix 9 9 | 10 10 | print("%s" % ("simple",)) @@ -126,17 +132,18 @@ UP031_0.py:12:15: UP031 [*] Use format specifiers instead of percent format 14 14 | print("%s%% percent" % (15,)) 15 15 | -UP031_0.py:14:7: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 14:7: [*] Use format specifiers instead of percent format + + --> UP031_0.py:14:7 | 12 | print("%s" % ("%s" % ("nested",),)) 13 | 14 | print("%s%% percent" % (15,)) - | ^^^^^^^^^^^^^^^^^^^^^^ UP031 + | ^^^^^^^^^^^^^^^^^^^^^^ 15 | 16 | print("%f" % (15,)) | = help: Replace with format specifiers - ℹ Unsafe fix 11 11 | 12 12 | print("%s" % ("%s" % ("nested",),)) @@ -147,17 +154,18 @@ UP031_0.py:14:7: UP031 [*] Use format specifiers instead of percent format 16 16 | print("%f" % (15,)) 17 17 | -UP031_0.py:16:7: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 16:7: [*] Use format specifiers instead of percent format + + --> UP031_0.py:16:7 | 14 | print("%s%% percent" % (15,)) 15 | 16 | print("%f" % (15,)) - | ^^^^^^^^^^^^ UP031 + | ^^^^^^^^^^^^ 17 | 18 | print("%.f" % (15,)) | = help: Replace with format specifiers - ℹ Unsafe fix 13 13 | 14 14 | print("%s%% percent" % (15,)) @@ -168,17 +176,18 @@ UP031_0.py:16:7: UP031 [*] Use format specifiers instead of percent format 18 18 | print("%.f" % (15,)) 19 19 | -UP031_0.py:18:7: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 18:7: [*] Use format specifiers instead of percent format + + --> UP031_0.py:18:7 | 16 | print("%f" % (15,)) 17 | 18 | print("%.f" % (15,)) - | ^^^^^^^^^^^^^ UP031 + | ^^^^^^^^^^^^^ 19 | 20 | print("%.3f" % (15,)) | = help: Replace with format specifiers - ℹ Unsafe fix 15 15 | 16 16 | print("%f" % (15,)) @@ -189,17 +198,18 @@ UP031_0.py:18:7: UP031 [*] Use format specifiers instead of percent format 20 20 | print("%.3f" % (15,)) 21 21 | -UP031_0.py:20:7: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 20:7: [*] Use format specifiers instead of percent format + + --> UP031_0.py:20:7 | 18 | print("%.f" % (15,)) 19 | 20 | print("%.3f" % (15,)) - | ^^^^^^^^^^^^^^ UP031 + | ^^^^^^^^^^^^^^ 21 | 22 | print("%3f" % (15,)) | = help: Replace with format specifiers - ℹ Unsafe fix 17 17 | 18 18 | print("%.f" % (15,)) @@ -210,17 +220,18 @@ UP031_0.py:20:7: UP031 [*] Use format specifiers instead of percent format 22 22 | print("%3f" % (15,)) 23 23 | -UP031_0.py:22:7: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 22:7: [*] Use format specifiers instead of percent format + + --> UP031_0.py:22:7 | 20 | print("%.3f" % (15,)) 21 | 22 | print("%3f" % (15,)) - | ^^^^^^^^^^^^^ UP031 + | ^^^^^^^^^^^^^ 23 | 24 | print("%-5f" % (5,)) | = help: Replace with format specifiers - ℹ Unsafe fix 19 19 | 20 20 | print("%.3f" % (15,)) @@ -231,17 +242,18 @@ UP031_0.py:22:7: UP031 [*] Use format specifiers instead of percent format 24 24 | print("%-5f" % (5,)) 25 25 | -UP031_0.py:24:7: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 24:7: [*] Use format specifiers instead of percent format + + --> UP031_0.py:24:7 | 22 | print("%3f" % (15,)) 23 | 24 | print("%-5f" % (5,)) - | ^^^^^^^^^^^^^ UP031 + | ^^^^^^^^^^^^^ 25 | 26 | print("%9f" % (5,)) | = help: Replace with format specifiers - ℹ Unsafe fix 21 21 | 22 22 | print("%3f" % (15,)) @@ -252,17 +264,18 @@ UP031_0.py:24:7: UP031 [*] Use format specifiers instead of percent format 26 26 | print("%9f" % (5,)) 27 27 | -UP031_0.py:26:7: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 26:7: [*] Use format specifiers instead of percent format + + --> UP031_0.py:26:7 | 24 | print("%-5f" % (5,)) 25 | 26 | print("%9f" % (5,)) - | ^^^^^^^^^^^^ UP031 + | ^^^^^^^^^^^^ 27 | 28 | print("%#o" % (123,)) | = help: Replace with format specifiers - ℹ Unsafe fix 23 23 | 24 24 | print("%-5f" % (5,)) @@ -273,17 +286,18 @@ UP031_0.py:26:7: UP031 [*] Use format specifiers instead of percent format 28 28 | print("%#o" % (123,)) 29 29 | -UP031_0.py:28:7: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 28:7: [*] Use format specifiers instead of percent format + + --> UP031_0.py:28:7 | 26 | print("%9f" % (5,)) 27 | 28 | print("%#o" % (123,)) - | ^^^^^^^^^^^^^^ UP031 + | ^^^^^^^^^^^^^^ 29 | 30 | print("brace {} %s" % (1,)) | = help: Replace with format specifiers - ℹ Unsafe fix 25 25 | 26 26 | print("%9f" % (5,)) @@ -294,17 +308,18 @@ UP031_0.py:28:7: UP031 [*] Use format specifiers instead of percent format 30 30 | print("brace {} %s" % (1,)) 31 31 | -UP031_0.py:30:7: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 30:7: [*] Use format specifiers instead of percent format + + --> UP031_0.py:30:7 | 28 | print("%#o" % (123,)) 29 | 30 | print("brace {} %s" % (1,)) - | ^^^^^^^^^^^^^^^^^^^^ UP031 + | ^^^^^^^^^^^^^^^^^^^^ 31 | 32 | print(( | = help: Replace with format specifiers - ℹ Unsafe fix 27 27 | 28 28 | print("%#o" % (123,)) @@ -315,17 +330,18 @@ UP031_0.py:30:7: UP031 [*] Use format specifiers instead of percent format 32 32 | print(( 33 33 | "foo %s " -UP031_0.py:33:5: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 33:5: [*] Use format specifiers instead of percent format + + --> UP031_0.py:33:5 | 32 | print(( 33 | "foo %s " | _____^ 34 | | "bar %s" % (x, y) - | |_____________________^ UP031 + | |_____________________^ 35 | )) | = help: Replace with format specifiers - ℹ Unsafe fix 30 30 | print("brace {} %s" % (1,)) 31 31 | @@ -338,18 +354,19 @@ UP031_0.py:33:5: UP031 [*] Use format specifiers instead of percent format 36 36 | 37 37 | print( -UP031_0.py:38:3: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 38:3: [*] Use format specifiers instead of percent format + + --> UP031_0.py:38:3 | 37 | print( 38 | "%s" % ( | ___^ 39 | | "trailing comma", 40 | | ) - | |_________^ UP031 + | |_________^ 41 | ) | = help: Replace with format specifiers - ℹ Unsafe fix 35 35 | )) 36 36 | @@ -360,17 +377,18 @@ UP031_0.py:38:3: UP031 [*] Use format specifiers instead of percent format 40 40 | ) 41 41 | ) -UP031_0.py:43:7: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 43:7: [*] Use format specifiers instead of percent format + + --> UP031_0.py:43:7 | 41 | ) 42 | 43 | print("foo %s " % (x,)) - | ^^^^^^^^^^^^^^^^ UP031 + | ^^^^^^^^^^^^^^^^ 44 | 45 | print("%(k)s" % {"k": "v"}) | = help: Replace with format specifiers - ℹ Unsafe fix 40 40 | ) 41 41 | ) @@ -381,17 +399,18 @@ UP031_0.py:43:7: UP031 [*] Use format specifiers instead of percent format 45 45 | print("%(k)s" % {"k": "v"}) 46 46 | -UP031_0.py:45:7: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 45:7: [*] Use format specifiers instead of percent format + + --> UP031_0.py:45:7 | 43 | print("foo %s " % (x,)) 44 | 45 | print("%(k)s" % {"k": "v"}) - | ^^^^^^^^^^^^^^^^^^^^ UP031 + | ^^^^^^^^^^^^^^^^^^^^ 46 | 47 | print("%(k)s" % { | = help: Replace with format specifiers - ℹ Unsafe fix 42 42 | 43 43 | print("foo %s " % (x,)) @@ -402,7 +421,9 @@ UP031_0.py:45:7: UP031 [*] Use format specifiers instead of percent format 47 47 | print("%(k)s" % { 48 48 | "k": "v", -UP031_0.py:47:7: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 47:7: [*] Use format specifiers instead of percent format + + --> UP031_0.py:47:7 | 45 | print("%(k)s" % {"k": "v"}) 46 | @@ -411,12 +432,11 @@ UP031_0.py:47:7: UP031 [*] Use format specifiers instead of percent format 48 | | "k": "v", 49 | | "i": "j" 50 | | }) - | |_^ UP031 + | |_^ 51 | 52 | print("%(to_list)s" % {"to_list": []}) | = help: Replace with format specifiers - ℹ Unsafe fix 44 44 | 45 45 | print("%(k)s" % {"k": "v"}) @@ -433,17 +453,18 @@ UP031_0.py:47:7: UP031 [*] Use format specifiers instead of percent format 52 52 | print("%(to_list)s" % {"to_list": []}) 53 53 | -UP031_0.py:52:7: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 52:7: [*] Use format specifiers instead of percent format + + --> UP031_0.py:52:7 | 50 | }) 51 | 52 | print("%(to_list)s" % {"to_list": []}) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP031 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 53 | 54 | print("%(k)s" % {"k": "v", "i": 1, "j": []}) | = help: Replace with format specifiers - ℹ Unsafe fix 49 49 | "i": "j" 50 50 | }) @@ -454,17 +475,18 @@ UP031_0.py:52:7: UP031 [*] Use format specifiers instead of percent format 54 54 | print("%(k)s" % {"k": "v", "i": 1, "j": []}) 55 55 | -UP031_0.py:54:7: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 54:7: [*] Use format specifiers instead of percent format + + --> UP031_0.py:54:7 | 52 | print("%(to_list)s" % {"to_list": []}) 53 | 54 | print("%(k)s" % {"k": "v", "i": 1, "j": []}) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP031 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 55 | 56 | print("%(ab)s" % {"a" "b": 1}) | = help: Replace with format specifiers - ℹ Unsafe fix 51 51 | 52 52 | print("%(to_list)s" % {"to_list": []}) @@ -475,17 +497,18 @@ UP031_0.py:54:7: UP031 [*] Use format specifiers instead of percent format 56 56 | print("%(ab)s" % {"a" "b": 1}) 57 57 | -UP031_0.py:56:7: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 56:7: [*] Use format specifiers instead of percent format + + --> UP031_0.py:56:7 | 54 | print("%(k)s" % {"k": "v", "i": 1, "j": []}) 55 | 56 | print("%(ab)s" % {"a" "b": 1}) - | ^^^^^^^^^^^^^^^^^^^^^^^ UP031 + | ^^^^^^^^^^^^^^^^^^^^^^^ 57 | 58 | print("%(a)s" % {"a" : 1}) | = help: Replace with format specifiers - ℹ Unsafe fix 53 53 | 54 54 | print("%(k)s" % {"k": "v", "i": 1, "j": []}) @@ -496,15 +519,16 @@ UP031_0.py:56:7: UP031 [*] Use format specifiers instead of percent format 58 58 | print("%(a)s" % {"a" : 1}) 59 59 | -UP031_0.py:58:7: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 58:7: [*] Use format specifiers instead of percent format + + --> UP031_0.py:58:7 | 56 | print("%(ab)s" % {"a" "b": 1}) 57 | 58 | print("%(a)s" % {"a" : 1}) - | ^^^^^^^^^^^^^^^^^^^^^ UP031 + | ^^^^^^^^^^^^^^^^^^^^^ | = help: Replace with format specifiers - ℹ Unsafe fix 55 55 | 56 56 | print("%(ab)s" % {"a" "b": 1}) @@ -515,17 +539,18 @@ UP031_0.py:58:7: UP031 [*] Use format specifiers instead of percent format 60 60 | 61 61 | print( -UP031_0.py:62:5: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 62:5: [*] Use format specifiers instead of percent format + + --> UP031_0.py:62:5 | 61 | print( 62 | "foo %(foo)s " | _____^ 63 | | "bar %(bar)s" % {"foo": x, "bar": y} - | |________________________________________^ UP031 + | |________________________________________^ 64 | ) | = help: Replace with format specifiers - ℹ Unsafe fix 59 59 | 60 60 | @@ -538,18 +563,19 @@ UP031_0.py:62:5: UP031 [*] Use format specifiers instead of percent format 65 65 | 66 66 | bar = {"bar": y} -UP031_0.py:68:5: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 68:5: [*] Use format specifiers instead of percent format + + --> UP031_0.py:68:5 | 66 | bar = {"bar": y} 67 | print( 68 | "foo %(foo)s " | _____^ 69 | | "bar %(bar)s" % {"foo": x, **bar} - | |_____________________________________^ UP031 + | |_____________________________________^ 70 | ) | = help: Replace with format specifiers - ℹ Unsafe fix 65 65 | 66 66 | bar = {"bar": y} @@ -562,17 +588,18 @@ UP031_0.py:68:5: UP031 [*] Use format specifiers instead of percent format 71 71 | 72 72 | print("%s \N{snowman}" % (a,)) -UP031_0.py:72:7: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 72:7: [*] Use format specifiers instead of percent format + + --> UP031_0.py:72:7 | 70 | ) 71 | 72 | print("%s \N{snowman}" % (a,)) - | ^^^^^^^^^^^^^^^^^^^^^^^ UP031 + | ^^^^^^^^^^^^^^^^^^^^^^^ 73 | 74 | print("%(foo)s \N{snowman}" % {"foo": 1}) | = help: Replace with format specifiers - ℹ Unsafe fix 69 69 | "bar %(bar)s" % {"foo": x, **bar} 70 70 | ) @@ -583,17 +610,18 @@ UP031_0.py:72:7: UP031 [*] Use format specifiers instead of percent format 74 74 | print("%(foo)s \N{snowman}" % {"foo": 1}) 75 75 | -UP031_0.py:74:7: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 74:7: [*] Use format specifiers instead of percent format + + --> UP031_0.py:74:7 | 72 | print("%s \N{snowman}" % (a,)) 73 | 74 | print("%(foo)s \N{snowman}" % {"foo": 1}) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP031 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 75 | 76 | print(("foo %s " "bar %s") % (x, y)) | = help: Replace with format specifiers - ℹ Unsafe fix 71 71 | 72 72 | print("%s \N{snowman}" % (a,)) @@ -604,17 +632,18 @@ UP031_0.py:74:7: UP031 [*] Use format specifiers instead of percent format 76 76 | print(("foo %s " "bar %s") % (x, y)) 77 77 | -UP031_0.py:76:7: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 76:7: [*] Use format specifiers instead of percent format + + --> UP031_0.py:76:7 | 74 | print("%(foo)s \N{snowman}" % {"foo": 1}) 75 | 76 | print(("foo %s " "bar %s") % (x, y)) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP031 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 77 | 78 | # Single-value expressions | = help: Replace with format specifiers - ℹ Unsafe fix 73 73 | 74 74 | print("%(foo)s \N{snowman}" % {"foo": 1}) @@ -625,16 +654,17 @@ UP031_0.py:76:7: UP031 [*] Use format specifiers instead of percent format 78 78 | # Single-value expressions 79 79 | print('Hello %s' % "World") -UP031_0.py:79:7: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 79:7: [*] Use format specifiers instead of percent format + + --> UP031_0.py:79:7 | 78 | # Single-value expressions 79 | print('Hello %s' % "World") - | ^^^^^^^^^^^^^^^^^^^^ UP031 + | ^^^^^^^^^^^^^^^^^^^^ 80 | print('Hello %s' % f"World") 81 | print('Hello %s (%s)' % bar) | = help: Replace with format specifiers - ℹ Unsafe fix 76 76 | print(("foo %s " "bar %s") % (x, y)) 77 77 | @@ -645,17 +675,18 @@ UP031_0.py:79:7: UP031 [*] Use format specifiers instead of percent format 81 81 | print('Hello %s (%s)' % bar) 82 82 | print('Hello %s (%s)' % bar.baz) -UP031_0.py:80:7: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 80:7: [*] Use format specifiers instead of percent format + + --> UP031_0.py:80:7 | 78 | # Single-value expressions 79 | print('Hello %s' % "World") 80 | print('Hello %s' % f"World") - | ^^^^^^^^^^^^^^^^^^^^^ UP031 + | ^^^^^^^^^^^^^^^^^^^^^ 81 | print('Hello %s (%s)' % bar) 82 | print('Hello %s (%s)' % bar.baz) | = help: Replace with format specifiers - ℹ Unsafe fix 77 77 | 78 78 | # Single-value expressions @@ -666,17 +697,18 @@ UP031_0.py:80:7: UP031 [*] Use format specifiers instead of percent format 82 82 | print('Hello %s (%s)' % bar.baz) 83 83 | print('Hello %s (%s)' % bar['bop']) -UP031_0.py:81:7: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 81:7: [*] Use format specifiers instead of percent format + + --> UP031_0.py:81:7 | 79 | print('Hello %s' % "World") 80 | print('Hello %s' % f"World") 81 | print('Hello %s (%s)' % bar) - | ^^^^^^^^^^^^^^^^^^^^^ UP031 + | ^^^^^^^^^^^^^^^^^^^^^ 82 | print('Hello %s (%s)' % bar.baz) 83 | print('Hello %s (%s)' % bar['bop']) | = help: Replace with format specifiers - ℹ Unsafe fix 78 78 | # Single-value expressions 79 79 | print('Hello %s' % "World") @@ -687,17 +719,18 @@ UP031_0.py:81:7: UP031 [*] Use format specifiers instead of percent format 83 83 | print('Hello %s (%s)' % bar['bop']) 84 84 | print('Hello %(arg)s' % bar) -UP031_0.py:82:7: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 82:7: [*] Use format specifiers instead of percent format + + --> UP031_0.py:82:7 | 80 | print('Hello %s' % f"World") 81 | print('Hello %s (%s)' % bar) 82 | print('Hello %s (%s)' % bar.baz) - | ^^^^^^^^^^^^^^^^^^^^^^^^^ UP031 + | ^^^^^^^^^^^^^^^^^^^^^^^^^ 83 | print('Hello %s (%s)' % bar['bop']) 84 | print('Hello %(arg)s' % bar) | = help: Replace with format specifiers - ℹ Unsafe fix 79 79 | print('Hello %s' % "World") 80 80 | print('Hello %s' % f"World") @@ -708,17 +741,18 @@ UP031_0.py:82:7: UP031 [*] Use format specifiers instead of percent format 84 84 | print('Hello %(arg)s' % bar) 85 85 | print('Hello %(arg)s' % bar.baz) -UP031_0.py:83:7: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 83:7: [*] Use format specifiers instead of percent format + + --> UP031_0.py:83:7 | 81 | print('Hello %s (%s)' % bar) 82 | print('Hello %s (%s)' % bar.baz) 83 | print('Hello %s (%s)' % bar['bop']) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP031 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 84 | print('Hello %(arg)s' % bar) 85 | print('Hello %(arg)s' % bar.baz) | = help: Replace with format specifiers - ℹ Unsafe fix 80 80 | print('Hello %s' % f"World") 81 81 | print('Hello %s (%s)' % bar) @@ -729,17 +763,18 @@ UP031_0.py:83:7: UP031 [*] Use format specifiers instead of percent format 85 85 | print('Hello %(arg)s' % bar.baz) 86 86 | print('Hello %(arg)s' % bar['bop']) -UP031_0.py:84:7: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 84:7: [*] Use format specifiers instead of percent format + + --> UP031_0.py:84:7 | 82 | print('Hello %s (%s)' % bar.baz) 83 | print('Hello %s (%s)' % bar['bop']) 84 | print('Hello %(arg)s' % bar) - | ^^^^^^^^^^^^^^^^^^^^^ UP031 + | ^^^^^^^^^^^^^^^^^^^^^ 85 | print('Hello %(arg)s' % bar.baz) 86 | print('Hello %(arg)s' % bar['bop']) | = help: Replace with format specifiers - ℹ Unsafe fix 81 81 | print('Hello %s (%s)' % bar) 82 82 | print('Hello %s (%s)' % bar.baz) @@ -750,16 +785,17 @@ UP031_0.py:84:7: UP031 [*] Use format specifiers instead of percent format 86 86 | print('Hello %(arg)s' % bar['bop']) 87 87 | -UP031_0.py:85:7: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 85:7: [*] Use format specifiers instead of percent format + + --> UP031_0.py:85:7 | 83 | print('Hello %s (%s)' % bar['bop']) 84 | print('Hello %(arg)s' % bar) 85 | print('Hello %(arg)s' % bar.baz) - | ^^^^^^^^^^^^^^^^^^^^^^^^^ UP031 + | ^^^^^^^^^^^^^^^^^^^^^^^^^ 86 | print('Hello %(arg)s' % bar['bop']) | = help: Replace with format specifiers - ℹ Unsafe fix 82 82 | print('Hello %s (%s)' % bar.baz) 83 83 | print('Hello %s (%s)' % bar['bop']) @@ -770,17 +806,18 @@ UP031_0.py:85:7: UP031 [*] Use format specifiers instead of percent format 87 87 | 88 88 | # Hanging modulos -UP031_0.py:86:7: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 86:7: [*] Use format specifiers instead of percent format + + --> UP031_0.py:86:7 | 84 | print('Hello %(arg)s' % bar) 85 | print('Hello %(arg)s' % bar.baz) 86 | print('Hello %(arg)s' % bar['bop']) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP031 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 87 | 88 | # Hanging modulos | = help: Replace with format specifiers - ℹ Unsafe fix 83 83 | print('Hello %s (%s)' % bar['bop']) 84 84 | print('Hello %(arg)s' % bar) @@ -791,19 +828,20 @@ UP031_0.py:86:7: UP031 [*] Use format specifiers instead of percent format 88 88 | # Hanging modulos 89 89 | ( -UP031_0.py:89:1: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 89:1: [*] Use format specifiers instead of percent format + + --> UP031_0.py:88:18 | 88 | # Hanging modulos 89 | / ( 90 | | "foo %s " 91 | | "bar %s" 92 | | ) % (x, y) - | |__________^ UP031 + | |__________^ 93 | 94 | ( | = help: Replace with format specifiers - ℹ Unsafe fix 87 87 | 88 88 | # Hanging modulos @@ -818,7 +856,9 @@ UP031_0.py:89:1: UP031 [*] Use format specifiers instead of percent format 94 94 | ( 95 95 | "foo %(foo)s " -UP031_0.py:94:1: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 94:1: [*] Use format specifiers instead of percent format + + --> UP031_0.py:93:1 | 92 | ) % (x, y) 93 | @@ -826,12 +866,11 @@ UP031_0.py:94:1: UP031 [*] Use format specifiers instead of percent format 95 | | "foo %(foo)s " 96 | | "bar %(bar)s" 97 | | ) % {"foo": x, "bar": y} - | |________________________^ UP031 + | |________________________^ 98 | 99 | ( | = help: Replace with format specifiers - ℹ Unsafe fix 92 92 | ) % (x, y) 93 93 | @@ -846,17 +885,18 @@ UP031_0.py:94:1: UP031 [*] Use format specifiers instead of percent format 99 99 | ( 100 100 | """foo %s""" -UP031_0.py:100:5: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 100:5: [*] Use format specifiers instead of percent format + + --> UP031_0.py:100:5 | 99 | ( 100 | """foo %s""" | _____^ 101 | | % (x,) - | |__________^ UP031 + | |__________^ 102 | ) | = help: Replace with format specifiers - ℹ Unsafe fix 97 97 | ) % {"foo": x, "bar": y} 98 98 | @@ -868,7 +908,9 @@ UP031_0.py:100:5: UP031 [*] Use format specifiers instead of percent format 103 102 | 104 103 | ( -UP031_0.py:105:5: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 105:5: [*] Use format specifiers instead of percent format + + --> UP031_0.py:105:5 | 104 | ( 105 | """ @@ -876,11 +918,10 @@ UP031_0.py:105:5: UP031 [*] Use format specifiers instead of percent format 106 | | foo %s 107 | | """ 108 | | % (x,) - | |__________^ UP031 + | |__________^ 109 | ) | = help: Replace with format specifiers - ℹ Unsafe fix 103 103 | 104 104 | ( @@ -894,17 +935,18 @@ UP031_0.py:105:5: UP031 [*] Use format specifiers instead of percent format 110 109 | 111 110 | "%s" % ( -UP031_0.py:111:1: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 111:1: [*] Use format specifiers instead of percent format + + --> UP031_0.py:110:1 | 109 | ) 110 | 111 | / "%s" % ( 112 | | x, # comment 113 | | ) - | |_^ UP031 + | |_^ | = help: Replace with format specifiers - ℹ Unsafe fix 108 108 | % (x,) 109 109 | ) @@ -915,20 +957,21 @@ UP031_0.py:111:1: UP031 [*] Use format specifiers instead of percent format 113 113 | ) 114 114 | -UP031_0.py:116:8: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 116:8: [*] Use format specifiers instead of percent format + + --> UP031_0.py:116:8 | 116 | path = "%s-%s-%s.pem" % ( | ________^ -117 | | safe_domain_name(cn), # common name, which should be filename safe because it is IDNA-encoded, but in case of a malformed cert make sure it's ok to use as a filename +117 | | safe_domain_name(cn), # common name, which should be filename safe because it is IDNA-encoded, but in case of a malformed cert ... 118 | | cert.not_valid_after.date().isoformat().replace("-", ""), # expiration date 119 | | hexlify(cert.fingerprint(hashes.SHA256())).decode("ascii")[0:8], # fingerprint prefix 120 | | ) - | |_^ UP031 + | |_^ 121 | 122 | # UP031 (no longer false negatives; now offer potentially unsafe fixes) | = help: Replace with format specifiers - ℹ Unsafe fix 113 113 | ) 114 114 | @@ -939,16 +982,17 @@ UP031_0.py:116:8: UP031 [*] Use format specifiers instead of percent format 118 118 | cert.not_valid_after.date().isoformat().replace("-", ""), # expiration date 119 119 | hexlify(cert.fingerprint(hashes.SHA256())).decode("ascii")[0:8], # fingerprint prefix -UP031_0.py:123:1: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 123:1: [*] Use format specifiers instead of percent format + + --> UP031_0.py:122:72 | 122 | # UP031 (no longer false negatives; now offer potentially unsafe fixes) 123 | 'Hello %s' % bar - | ^^^^^^^^^^^^^^^^ UP031 + | ^^^^^^^^^^^^^^^^ 124 | 125 | 'Hello %s' % bar.baz | = help: Replace with format specifiers - ℹ Unsafe fix 120 120 | ) 121 121 | @@ -959,17 +1003,18 @@ UP031_0.py:123:1: UP031 [*] Use format specifiers instead of percent format 125 125 | 'Hello %s' % bar.baz 126 126 | -UP031_0.py:125:1: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 125:1: [*] Use format specifiers instead of percent format + + --> UP031_0.py:124:1 | 123 | 'Hello %s' % bar 124 | 125 | 'Hello %s' % bar.baz - | ^^^^^^^^^^^^^^^^^^^^ UP031 + | ^^^^^^^^^^^^^^^^^^^^ 126 | 127 | 'Hello %s' % bar['bop'] | = help: Replace with format specifiers - ℹ Unsafe fix 122 122 | # UP031 (no longer false negatives; now offer potentially unsafe fixes) 123 123 | 'Hello %s' % bar @@ -980,17 +1025,18 @@ UP031_0.py:125:1: UP031 [*] Use format specifiers instead of percent format 127 127 | 'Hello %s' % bar['bop'] 128 128 | -UP031_0.py:127:1: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 127:1: [*] Use format specifiers instead of percent format + + --> UP031_0.py:126:1 | 125 | 'Hello %s' % bar.baz 126 | 127 | 'Hello %s' % bar['bop'] - | ^^^^^^^^^^^^^^^^^^^^^^^ UP031 + | ^^^^^^^^^^^^^^^^^^^^^^^ 128 | 129 | # Not a valid type annotation but this test shouldn't result in a panic. | = help: Replace with format specifiers - ℹ Unsafe fix 124 124 | 125 125 | 'Hello %s' % bar.baz @@ -1001,17 +1047,18 @@ UP031_0.py:127:1: UP031 [*] Use format specifiers instead of percent format 129 129 | # Not a valid type annotation but this test shouldn't result in a panic. 130 130 | # Refer: https://github.com/astral-sh/ruff/issues/11736 -UP031_0.py:131:5: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 131:5: [*] Use format specifiers instead of percent format + + --> UP031_0.py:131:5 | 129 | # Not a valid type annotation but this test shouldn't result in a panic. 130 | # Refer: https://github.com/astral-sh/ruff/issues/11736 131 | x: "'%s + %s' % (1, 2)" - | ^^^^^^^^^^^^^^^^^^ UP031 + | ^^^^^^^^^^^^^^^^^^ 132 | 133 | # See: https://github.com/astral-sh/ruff/issues/12421 | = help: Replace with format specifiers - ℹ Unsafe fix 128 128 | 129 129 | # Not a valid type annotation but this test shouldn't result in a panic. @@ -1022,16 +1069,17 @@ UP031_0.py:131:5: UP031 [*] Use format specifiers instead of percent format 133 133 | # See: https://github.com/astral-sh/ruff/issues/12421 134 134 | print("%.2X" % 1) -UP031_0.py:134:7: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 134:7: [*] Use format specifiers instead of percent format + + --> UP031_0.py:134:7 | 133 | # See: https://github.com/astral-sh/ruff/issues/12421 134 | print("%.2X" % 1) - | ^^^^^^^^^^ UP031 + | ^^^^^^^^^^ 135 | print("%.02X" % 1) 136 | print("%02X" % 1) | = help: Replace with format specifiers - ℹ Unsafe fix 131 131 | x: "'%s + %s' % (1, 2)" 132 132 | @@ -1042,17 +1090,18 @@ UP031_0.py:134:7: UP031 [*] Use format specifiers instead of percent format 136 136 | print("%02X" % 1) 137 137 | print("%.00002X" % 1) -UP031_0.py:135:7: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 135:7: [*] Use format specifiers instead of percent format + + --> UP031_0.py:135:7 | 133 | # See: https://github.com/astral-sh/ruff/issues/12421 134 | print("%.2X" % 1) 135 | print("%.02X" % 1) - | ^^^^^^^^^^^ UP031 + | ^^^^^^^^^^^ 136 | print("%02X" % 1) 137 | print("%.00002X" % 1) | = help: Replace with format specifiers - ℹ Unsafe fix 132 132 | 133 133 | # See: https://github.com/astral-sh/ruff/issues/12421 @@ -1063,17 +1112,18 @@ UP031_0.py:135:7: UP031 [*] Use format specifiers instead of percent format 137 137 | print("%.00002X" % 1) 138 138 | print("%.20X" % 1) -UP031_0.py:136:7: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 136:7: [*] Use format specifiers instead of percent format + + --> UP031_0.py:136:7 | 134 | print("%.2X" % 1) 135 | print("%.02X" % 1) 136 | print("%02X" % 1) - | ^^^^^^^^^^ UP031 + | ^^^^^^^^^^ 137 | print("%.00002X" % 1) 138 | print("%.20X" % 1) | = help: Replace with format specifiers - ℹ Unsafe fix 133 133 | # See: https://github.com/astral-sh/ruff/issues/12421 134 134 | print("%.2X" % 1) @@ -1084,16 +1134,17 @@ UP031_0.py:136:7: UP031 [*] Use format specifiers instead of percent format 138 138 | print("%.20X" % 1) 139 139 | -UP031_0.py:137:7: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 137:7: [*] Use format specifiers instead of percent format + + --> UP031_0.py:137:7 | 135 | print("%.02X" % 1) 136 | print("%02X" % 1) 137 | print("%.00002X" % 1) - | ^^^^^^^^^^^^^^ UP031 + | ^^^^^^^^^^^^^^ 138 | print("%.20X" % 1) | = help: Replace with format specifiers - ℹ Unsafe fix 134 134 | print("%.2X" % 1) 135 135 | print("%.02X" % 1) @@ -1104,17 +1155,18 @@ UP031_0.py:137:7: UP031 [*] Use format specifiers instead of percent format 139 139 | 140 140 | print("%2X" % 1) -UP031_0.py:138:7: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 138:7: [*] Use format specifiers instead of percent format + + --> UP031_0.py:138:7 | 136 | print("%02X" % 1) 137 | print("%.00002X" % 1) 138 | print("%.20X" % 1) - | ^^^^^^^^^^^ UP031 + | ^^^^^^^^^^^ 139 | 140 | print("%2X" % 1) | = help: Replace with format specifiers - ℹ Unsafe fix 135 135 | print("%.02X" % 1) 136 136 | print("%02X" % 1) @@ -1125,16 +1177,17 @@ UP031_0.py:138:7: UP031 [*] Use format specifiers instead of percent format 140 140 | print("%2X" % 1) 141 141 | print("%02X" % 1) -UP031_0.py:140:7: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 140:7: [*] Use format specifiers instead of percent format + + --> UP031_0.py:140:7 | 138 | print("%.20X" % 1) 139 | 140 | print("%2X" % 1) - | ^^^^^^^^^ UP031 + | ^^^^^^^^^ 141 | print("%02X" % 1) | = help: Replace with format specifiers - ℹ Unsafe fix 137 137 | print("%.00002X" % 1) 138 138 | print("%.20X" % 1) @@ -1145,16 +1198,17 @@ UP031_0.py:140:7: UP031 [*] Use format specifiers instead of percent format 142 142 | 143 143 | # UP031 (no longer false negatives, but offer no fix because of more complex syntax) -UP031_0.py:141:7: UP031 [*] Use format specifiers instead of percent format +error[UP031]: 141:7: [*] Use format specifiers instead of percent format + + --> UP031_0.py:141:7 | 140 | print("%2X" % 1) 141 | print("%02X" % 1) - | ^^^^^^^^^^ UP031 + | ^^^^^^^^^^ 142 | 143 | # UP031 (no longer false negatives, but offer no fix because of more complex syntax) | = help: Replace with format specifiers - ℹ Unsafe fix 138 138 | print("%.20X" % 1) 139 139 | @@ -1165,154 +1219,169 @@ UP031_0.py:141:7: UP031 [*] Use format specifiers instead of percent format 143 143 | # UP031 (no longer false negatives, but offer no fix because of more complex syntax) 144 144 | -UP031_0.py:145:1: UP031 Use format specifiers instead of percent format +error[UP031]: 145:1: Use format specifiers instead of percent format + + --> UP031_0.py:144:1 | 143 | # UP031 (no longer false negatives, but offer no fix because of more complex syntax) 144 | 145 | "%d.%d" % (a, b) - | ^^^^^^^ UP031 + | ^^^^^^^ 146 | 147 | "%*s" % (5, "hi") | = help: Replace with format specifiers +error[UP031]: 147:1: Use format specifiers instead of percent format -UP031_0.py:147:1: UP031 Use format specifiers instead of percent format + --> UP031_0.py:146:1 | 145 | "%d.%d" % (a, b) 146 | 147 | "%*s" % (5, "hi") - | ^^^^^ UP031 + | ^^^^^ 148 | 149 | "%d" % (flt,) | = help: Replace with format specifiers +error[UP031]: 149:1: Use format specifiers instead of percent format -UP031_0.py:149:1: UP031 Use format specifiers instead of percent format + --> UP031_0.py:148:1 | 147 | "%*s" % (5, "hi") 148 | 149 | "%d" % (flt,) - | ^^^^ UP031 + | ^^^^ 150 | 151 | "%c" % (some_string,) | = help: Replace with format specifiers +error[UP031]: 151:1: Use format specifiers instead of percent format -UP031_0.py:151:1: UP031 Use format specifiers instead of percent format + --> UP031_0.py:150:1 | 149 | "%d" % (flt,) 150 | 151 | "%c" % (some_string,) - | ^^^^ UP031 + | ^^^^ 152 | 153 | "%.2r" % (1.25) | = help: Replace with format specifiers +error[UP031]: 153:1: Use format specifiers instead of percent format -UP031_0.py:153:1: UP031 Use format specifiers instead of percent format + --> UP031_0.py:152:1 | 151 | "%c" % (some_string,) 152 | 153 | "%.2r" % (1.25) - | ^^^^^^ UP031 + | ^^^^^^ 154 | 155 | "%.*s" % (5, "hi") | = help: Replace with format specifiers +error[UP031]: 155:1: Use format specifiers instead of percent format -UP031_0.py:155:1: UP031 Use format specifiers instead of percent format + --> UP031_0.py:154:1 | 153 | "%.2r" % (1.25) 154 | 155 | "%.*s" % (5, "hi") - | ^^^^^^ UP031 + | ^^^^^^ 156 | 157 | "%i" % (flt,) | = help: Replace with format specifiers +error[UP031]: 157:1: Use format specifiers instead of percent format -UP031_0.py:157:1: UP031 Use format specifiers instead of percent format + --> UP031_0.py:156:1 | 155 | "%.*s" % (5, "hi") 156 | 157 | "%i" % (flt,) - | ^^^^ UP031 + | ^^^^ 158 | 159 | "%()s" % {"": "empty"} | = help: Replace with format specifiers +error[UP031]: 159:1: Use format specifiers instead of percent format -UP031_0.py:159:1: UP031 Use format specifiers instead of percent format + --> UP031_0.py:158:1 | 157 | "%i" % (flt,) 158 | 159 | "%()s" % {"": "empty"} - | ^^^^^^ UP031 + | ^^^^^^ 160 | 161 | "%s" % {"k": "v"} | = help: Replace with format specifiers +error[UP031]: 161:1: Use format specifiers instead of percent format -UP031_0.py:161:1: UP031 Use format specifiers instead of percent format + --> UP031_0.py:160:1 | 159 | "%()s" % {"": "empty"} 160 | 161 | "%s" % {"k": "v"} - | ^^^^ UP031 + | ^^^^ 162 | 163 | "%()s" % {"": "bar"} | = help: Replace with format specifiers +error[UP031]: 163:1: Use format specifiers instead of percent format -UP031_0.py:163:1: UP031 Use format specifiers instead of percent format + --> UP031_0.py:162:1 | 161 | "%s" % {"k": "v"} 162 | 163 | "%()s" % {"": "bar"} - | ^^^^^^ UP031 + | ^^^^^^ 164 | 165 | "%(1)s" % {"1": "bar"} | = help: Replace with format specifiers +error[UP031]: 165:1: Use format specifiers instead of percent format -UP031_0.py:165:1: UP031 Use format specifiers instead of percent format + --> UP031_0.py:164:1 | 163 | "%()s" % {"": "bar"} 164 | 165 | "%(1)s" % {"1": "bar"} - | ^^^^^^^ UP031 + | ^^^^^^^ 166 | 167 | "%(a)s" % {"a": 1, "a": 2} | = help: Replace with format specifiers +error[UP031]: 167:1: Use format specifiers instead of percent format -UP031_0.py:167:1: UP031 Use format specifiers instead of percent format + --> UP031_0.py:166:1 | 165 | "%(1)s" % {"1": "bar"} 166 | 167 | "%(a)s" % {"a": 1, "a": 2} - | ^^^^^^^ UP031 + | ^^^^^^^ 168 | 169 | "%(1)s" % {1: 2, "1": 2} | = help: Replace with format specifiers +error[UP031]: 169:1: Use format specifiers instead of percent format -UP031_0.py:169:1: UP031 Use format specifiers instead of percent format + --> UP031_0.py:168:1 | 167 | "%(a)s" % {"a": 1, "a": 2} 168 | 169 | "%(1)s" % {1: 2, "1": 2} - | ^^^^^^^ UP031 + | ^^^^^^^ 170 | 171 | "%(and)s" % {"and": 2} | = help: Replace with format specifiers +error[UP031]: 171:1: Use format specifiers instead of percent format -UP031_0.py:171:1: UP031 Use format specifiers instead of percent format + --> UP031_0.py:170:1 | 169 | "%(1)s" % {1: 2, "1": 2} 170 | 171 | "%(and)s" % {"and": 2} - | ^^^^^^^^^ UP031 + | ^^^^^^^^^ | = help: Replace with format specifiers diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB101_FURB101.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB101_FURB101.py.snap index 4a5b1f9d12..a1497d9449 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB101_FURB101.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB101_FURB101.py.snap @@ -1,56 +1,63 @@ --- source: crates/ruff_linter/src/rules/refurb/mod.rs --- -error[FURB101]: FURB101.py:12:6: `open` and `read` should be replaced by `Path("file.txt").read_text()` +error[FURB101]: 12:6: `open` and `read` should be replaced by `Path("file.txt").read_text()` + --> FURB101.py:12:6 | 11 | # FURB101 12 | with open("file.txt") as f: | ^^^^^^^^^^^^^^^^^^^^^ 13 | x = f.read() | -error[FURB101]: FURB101.py:16:6: `open` and `read` should be replaced by `Path("file.txt").read_bytes()` +error[FURB101]: 16:6: `open` and `read` should be replaced by `Path("file.txt").read_bytes()` + --> FURB101.py:16:6 | 15 | # FURB101 16 | with open("file.txt", "rb") as f: | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ 17 | x = f.read() | -error[FURB101]: FURB101.py:20:6: `open` and `read` should be replaced by `Path("file.txt").read_bytes()` +error[FURB101]: 20:6: `open` and `read` should be replaced by `Path("file.txt").read_bytes()` + --> FURB101.py:20:6 | 19 | # FURB101 20 | with open("file.txt", mode="rb") as f: | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 21 | x = f.read() | -error[FURB101]: FURB101.py:24:6: `open` and `read` should be replaced by `Path("file.txt").read_text(encoding="utf8")` +error[FURB101]: 24:6: `open` and `read` should be replaced by `Path("file.txt").read_text(encoding="utf8")` + --> FURB101.py:24:6 | 23 | # FURB101 24 | with open("file.txt", encoding="utf8") as f: | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 25 | x = f.read() | -error[FURB101]: FURB101.py:28:6: `open` and `read` should be replaced by `Path("file.txt").read_text(errors="ignore")` +error[FURB101]: 28:6: `open` and `read` should be replaced by `Path("file.txt").read_text(errors="ignore")` + --> FURB101.py:28:6 | 27 | # FURB101 28 | with open("file.txt", errors="ignore") as f: | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 29 | x = f.read() | -error[FURB101]: FURB101.py:32:6: `open` and `read` should be replaced by `Path("file.txt").read_text()` +error[FURB101]: 32:6: `open` and `read` should be replaced by `Path("file.txt").read_text()` + --> FURB101.py:32:6 | 31 | # FURB101 32 | with open("file.txt", mode="r") as f: # noqa: FURB120 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 33 | x = f.read() | -error[FURB101]: FURB101.py:36:6: `open` and `read` should be replaced by `Path(foo()).read_bytes()` +error[FURB101]: 36:6: `open` and `read` should be replaced by `Path(foo()).read_bytes()` + --> FURB101.py:36:6 | 35 | # FURB101 36 | with open(foo(), "rb") as f: @@ -58,8 +65,9 @@ error[FURB101]: FURB101.py:36:6: `open` and `read` should be replaced by `Path(f 37 | # The body of `with` is non-trivial, but the recommendation holds. 38 | bar("pre") | -error[FURB101]: FURB101.py:44:6: `open` and `read` should be replaced by `Path("a.txt").read_text()` +error[FURB101]: 44:6: `open` and `read` should be replaced by `Path("a.txt").read_text()` + --> FURB101.py:44:6 | 43 | # FURB101 44 | with open("a.txt") as a, open("b.txt", "rb") as b: @@ -67,8 +75,9 @@ error[FURB101]: FURB101.py:44:6: `open` and `read` should be replaced by `Path(" 45 | x = a.read() 46 | y = b.read() | -error[FURB101]: FURB101.py:44:26: `open` and `read` should be replaced by `Path("b.txt").read_bytes()` +error[FURB101]: 44:26: `open` and `read` should be replaced by `Path("b.txt").read_bytes()` + --> FURB101.py:44:26 | 43 | # FURB101 44 | with open("a.txt") as a, open("b.txt", "rb") as b: @@ -76,8 +85,9 @@ error[FURB101]: FURB101.py:44:26: `open` and `read` should be replaced by `Path( 45 | x = a.read() 46 | y = b.read() | -error[FURB101]: FURB101.py:49:18: `open` and `read` should be replaced by `Path("file.txt").read_text()` +error[FURB101]: 49:18: `open` and `read` should be replaced by `Path("file.txt").read_text()` + --> FURB101.py:49:18 | 48 | # FURB101 49 | with foo() as a, open("file.txt") as b, foo() as c: diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB103_FURB103.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB103_FURB103.py.snap index ef00ba64bf..5a45817cd5 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB103_FURB103.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB103_FURB103.py.snap @@ -1,56 +1,63 @@ --- source: crates/ruff_linter/src/rules/refurb/mod.rs --- -error[FURB103]: FURB103.py:12:6: `open` and `write` should be replaced by `Path("file.txt").write_text("test")` +error[FURB103]: 12:6: `open` and `write` should be replaced by `Path("file.txt").write_text("test")` + --> FURB103.py:12:6 | 11 | # FURB103 12 | with open("file.txt", "w") as f: | ^^^^^^^^^^^^^^^^^^^^^^^^^^ 13 | f.write("test") | -error[FURB103]: FURB103.py:16:6: `open` and `write` should be replaced by `Path("file.txt").write_bytes(foobar)` +error[FURB103]: 16:6: `open` and `write` should be replaced by `Path("file.txt").write_bytes(foobar)` + --> FURB103.py:16:6 | 15 | # FURB103 16 | with open("file.txt", "wb") as f: | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ 17 | f.write(foobar) | -error[FURB103]: FURB103.py:20:6: `open` and `write` should be replaced by `Path("file.txt").write_bytes(b"abc")` +error[FURB103]: 20:6: `open` and `write` should be replaced by `Path("file.txt").write_bytes(b"abc")` + --> FURB103.py:20:6 | 19 | # FURB103 20 | with open("file.txt", mode="wb") as f: | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 21 | f.write(b"abc") | -error[FURB103]: FURB103.py:24:6: `open` and `write` should be replaced by `Path("file.txt").write_text(foobar, encoding="utf8")` +error[FURB103]: 24:6: `open` and `write` should be replaced by `Path("file.txt").write_text(foobar, encoding="utf8")` + --> FURB103.py:24:6 | 23 | # FURB103 24 | with open("file.txt", "w", encoding="utf8") as f: | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 25 | f.write(foobar) | -error[FURB103]: FURB103.py:28:6: `open` and `write` should be replaced by `Path("file.txt").write_text(foobar, errors="ignore")` +error[FURB103]: 28:6: `open` and `write` should be replaced by `Path("file.txt").write_text(foobar, errors="ignore")` + --> FURB103.py:28:6 | 27 | # FURB103 28 | with open("file.txt", "w", errors="ignore") as f: | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 29 | f.write(foobar) | -error[FURB103]: FURB103.py:32:6: `open` and `write` should be replaced by `Path("file.txt").write_text(foobar)` +error[FURB103]: 32:6: `open` and `write` should be replaced by `Path("file.txt").write_text(foobar)` + --> FURB103.py:32:6 | 31 | # FURB103 32 | with open("file.txt", mode="w") as f: | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 33 | f.write(foobar) | -error[FURB103]: FURB103.py:36:6: `open` and `write` should be replaced by `Path(foo()).write_bytes(bar())` +error[FURB103]: 36:6: `open` and `write` should be replaced by `Path(foo()).write_bytes(bar())` + --> FURB103.py:36:6 | 35 | # FURB103 36 | with open(foo(), "wb") as f: @@ -58,8 +65,9 @@ error[FURB103]: FURB103.py:36:6: `open` and `write` should be replaced by `Path( 37 | # The body of `with` is non-trivial, but the recommendation holds. 38 | bar("pre") | -error[FURB103]: FURB103.py:44:6: `open` and `write` should be replaced by `Path("a.txt").write_text(x)` +error[FURB103]: 44:6: `open` and `write` should be replaced by `Path("a.txt").write_text(x)` + --> FURB103.py:44:6 | 43 | # FURB103 44 | with open("a.txt", "w") as a, open("b.txt", "wb") as b: @@ -67,8 +75,9 @@ error[FURB103]: FURB103.py:44:6: `open` and `write` should be replaced by `Path( 45 | a.write(x) 46 | b.write(y) | -error[FURB103]: FURB103.py:44:31: `open` and `write` should be replaced by `Path("b.txt").write_bytes(y)` +error[FURB103]: 44:31: `open` and `write` should be replaced by `Path("b.txt").write_bytes(y)` + --> FURB103.py:44:31 | 43 | # FURB103 44 | with open("a.txt", "w") as a, open("b.txt", "wb") as b: @@ -76,8 +85,9 @@ error[FURB103]: FURB103.py:44:31: `open` and `write` should be replaced by `Path 45 | a.write(x) 46 | b.write(y) | -error[FURB103]: FURB103.py:49:18: `open` and `write` should be replaced by `Path("file.txt").write_text(bar(bar(a + x)))` +error[FURB103]: 49:18: `open` and `write` should be replaced by `Path("file.txt").write_text(bar(bar(a + x)))` + --> FURB103.py:49:18 | 48 | # FURB103 49 | with foo() as a, open("file.txt", "w") as b, foo() as c: @@ -85,24 +95,27 @@ error[FURB103]: FURB103.py:49:18: `open` and `write` should be replaced by `Path 50 | # We have other things in here, multiple with items, but the user 51 | # writes a single time to file and that bit they can replace. | -error[FURB103]: FURB103.py:58:6: `open` and `write` should be replaced by `Path("file.txt").write_text(foobar, newline="\r\n")` +error[FURB103]: 58:6: `open` and `write` should be replaced by `Path("file.txt").write_text(foobar, newline="\r\n")` + --> FURB103.py:58:6 | 57 | # FURB103 58 | with open("file.txt", "w", newline="\r\n") as f: | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 59 | f.write(foobar) | -error[FURB103]: FURB103.py:66:6: `open` and `write` should be replaced by `Path("file.txt").write_text(foobar, newline="\r\n")` +error[FURB103]: 66:6: `open` and `write` should be replaced by `Path("file.txt").write_text(foobar, newline="\r\n")` + --> FURB103.py:66:6 | 65 | # FURB103 66 | with builtins.open("file.txt", "w", newline="\r\n") as f: | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 67 | f.write(foobar) | -error[FURB103]: FURB103.py:74:6: `open` and `write` should be replaced by `Path("file.txt").write_text(foobar, newline="\r\n")` +error[FURB103]: 74:6: `open` and `write` should be replaced by `Path("file.txt").write_text(foobar, newline="\r\n")` + --> FURB103.py:74:6 | 73 | # FURB103 74 | with o("file.txt", "w", newline="\r\n") as f: diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB105_FURB105.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB105_FURB105.py.snap index 274567d4fc..418a32985a 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB105_FURB105.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB105_FURB105.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/refurb/mod.rs --- -error[FURB105]: FURB105.py:3:1: [*] Unnecessary empty string passed to `print` +error[FURB105]: 3:1: [*] Unnecessary empty string passed to `print` + --> FURB105.py:2:1 | 1 | # Errors. 2 | @@ -21,8 +22,9 @@ error[FURB105]: FURB105.py:3:1: [*] Unnecessary empty string passed to `print` 5 5 | print("", end="bar") 6 6 | print("", sep=",", end="bar") -error[FURB105]: FURB105.py:4:1: [*] Unnecessary empty string and separator passed to `print` +error[FURB105]: 4:1: [*] Unnecessary empty string and separator passed to `print` + --> FURB105.py:3:10 | 3 | print("") 4 | print("", sep=",") @@ -41,8 +43,9 @@ error[FURB105]: FURB105.py:4:1: [*] Unnecessary empty string and separator passe 6 6 | print("", sep=",", end="bar") 7 7 | print(sep="") -error[FURB105]: FURB105.py:5:1: [*] Unnecessary empty string passed to `print` +error[FURB105]: 5:1: [*] Unnecessary empty string passed to `print` + --> FURB105.py:4:19 | 3 | print("") 4 | print("", sep=",") @@ -62,8 +65,9 @@ error[FURB105]: FURB105.py:5:1: [*] Unnecessary empty string passed to `print` 7 7 | print(sep="") 8 8 | print("", sep="") -error[FURB105]: FURB105.py:6:1: [*] Unnecessary empty string and separator passed to `print` +error[FURB105]: 6:1: [*] Unnecessary empty string and separator passed to `print` + --> FURB105.py:5:21 | 4 | print("", sep=",") 5 | print("", end="bar") @@ -83,8 +87,9 @@ error[FURB105]: FURB105.py:6:1: [*] Unnecessary empty string and separator passe 8 8 | print("", sep="") 9 9 | print("", "", sep="") -error[FURB105]: FURB105.py:7:1: [*] Unnecessary separator passed to `print` +error[FURB105]: 7:1: [*] Unnecessary separator passed to `print` + --> FURB105.py:6:30 | 5 | print("", end="bar") 6 | print("", sep=",", end="bar") @@ -104,8 +109,9 @@ error[FURB105]: FURB105.py:7:1: [*] Unnecessary separator passed to `print` 9 9 | print("", "", sep="") 10 10 | print("", "", sep="", end="") -error[FURB105]: FURB105.py:8:1: [*] Unnecessary empty string and separator passed to `print` +error[FURB105]: 8:1: [*] Unnecessary empty string and separator passed to `print` + --> FURB105.py:7:14 | 6 | print("", sep=",", end="bar") 7 | print(sep="") @@ -125,8 +131,9 @@ error[FURB105]: FURB105.py:8:1: [*] Unnecessary empty string and separator passe 10 10 | print("", "", sep="", end="") 11 11 | print("", "", sep="", end="bar") -error[FURB105]: FURB105.py:9:1: [*] Unnecessary empty string and separator passed to `print` +error[FURB105]: 9:1: [*] Unnecessary empty string and separator passed to `print` + --> FURB105.py:8:18 | 7 | print(sep="") 8 | print("", sep="") @@ -146,8 +153,9 @@ error[FURB105]: FURB105.py:9:1: [*] Unnecessary empty string and separator passe 11 11 | print("", "", sep="", end="bar") 12 12 | print("", sep="", end="bar") -error[FURB105]: FURB105.py:10:1: [*] Unnecessary empty string and separator passed to `print` +error[FURB105]: 10:1: [*] Unnecessary empty string and separator passed to `print` + --> FURB105.py:9:22 | 8 | print("", sep="") 9 | print("", "", sep="") @@ -167,8 +175,9 @@ error[FURB105]: FURB105.py:10:1: [*] Unnecessary empty string and separator pass 12 12 | print("", sep="", end="bar") 13 13 | print(sep="", end="bar") -error[FURB105]: FURB105.py:11:1: [*] Unnecessary empty string and separator passed to `print` +error[FURB105]: 11:1: [*] Unnecessary empty string and separator passed to `print` + --> FURB105.py:10:30 | 9 | print("", "", sep="") 10 | print("", "", sep="", end="") @@ -188,8 +197,9 @@ error[FURB105]: FURB105.py:11:1: [*] Unnecessary empty string and separator pass 13 13 | print(sep="", end="bar") 14 14 | print("", "foo", sep="") -error[FURB105]: FURB105.py:12:1: [*] Unnecessary empty string and separator passed to `print` +error[FURB105]: 12:1: [*] Unnecessary empty string and separator passed to `print` + --> FURB105.py:11:33 | 10 | print("", "", sep="", end="") 11 | print("", "", sep="", end="bar") @@ -209,8 +219,9 @@ error[FURB105]: FURB105.py:12:1: [*] Unnecessary empty string and separator pass 14 14 | print("", "foo", sep="") 15 15 | print("foo", "", sep="") -error[FURB105]: FURB105.py:13:1: [*] Unnecessary separator passed to `print` +error[FURB105]: 13:1: [*] Unnecessary separator passed to `print` + --> FURB105.py:12:29 | 11 | print("", "", sep="", end="bar") 12 | print("", sep="", end="bar") @@ -230,8 +241,9 @@ error[FURB105]: FURB105.py:13:1: [*] Unnecessary separator passed to `print` 15 15 | print("foo", "", sep="") 16 16 | print("foo", "", "bar", sep="") -error[FURB105]: FURB105.py:14:1: [*] Unnecessary empty string and separator passed to `print` +error[FURB105]: 14:1: [*] Unnecessary empty string and separator passed to `print` + --> FURB105.py:13:25 | 12 | print("", sep="", end="bar") 13 | print(sep="", end="bar") @@ -251,8 +263,9 @@ error[FURB105]: FURB105.py:14:1: [*] Unnecessary empty string and separator pass 16 16 | print("foo", "", "bar", sep="") 17 17 | print("", *args) -error[FURB105]: FURB105.py:15:1: [*] Unnecessary empty string and separator passed to `print` +error[FURB105]: 15:1: [*] Unnecessary empty string and separator passed to `print` + --> FURB105.py:14:25 | 13 | print(sep="", end="bar") 14 | print("", "foo", sep="") @@ -272,8 +285,9 @@ error[FURB105]: FURB105.py:15:1: [*] Unnecessary empty string and separator pass 17 17 | print("", *args) 18 18 | print("", *args, sep="") -error[FURB105]: FURB105.py:16:1: [*] Unnecessary empty string passed to `print` +error[FURB105]: 16:1: [*] Unnecessary empty string passed to `print` + --> FURB105.py:15:25 | 14 | print("", "foo", sep="") 15 | print("foo", "", sep="") @@ -293,8 +307,9 @@ error[FURB105]: FURB105.py:16:1: [*] Unnecessary empty string passed to `print` 18 18 | print("", *args, sep="") 19 19 | print("", **kwargs) -error[FURB105]: FURB105.py:18:1: [*] Unnecessary empty string passed to `print` +error[FURB105]: 18:1: [*] Unnecessary empty string passed to `print` + --> FURB105.py:17:17 | 16 | print("foo", "", "bar", sep="") 17 | print("", *args) @@ -314,8 +329,9 @@ error[FURB105]: FURB105.py:18:1: [*] Unnecessary empty string passed to `print` 20 20 | print(sep="\t") 21 21 | -error[FURB105]: FURB105.py:19:1: [*] Unnecessary empty string passed to `print` +error[FURB105]: 19:1: [*] Unnecessary empty string passed to `print` + --> FURB105.py:18:25 | 17 | print("", *args) 18 | print("", *args, sep="") @@ -334,8 +350,9 @@ error[FURB105]: FURB105.py:19:1: [*] Unnecessary empty string passed to `print` 21 21 | 22 22 | # OK. -error[FURB105]: FURB105.py:20:1: [*] Unnecessary separator passed to `print` +error[FURB105]: 20:1: [*] Unnecessary separator passed to `print` + --> FURB105.py:19:20 | 18 | print("", *args, sep="") 19 | print("", **kwargs) diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB110_FURB110.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB110_FURB110.py.snap index a356434423..ef77b39f7f 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB110_FURB110.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB110_FURB110.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/refurb/mod.rs --- -error[FURB110]: FURB110.py:1:5: [*] Replace ternary `if` expression with `or` operator +error[FURB110]: 1:5: [*] Replace ternary `if` expression with `or` operator + --> FURB110.py:1:5 | 1 | z = x if x else y # FURB110 | ^^^^^^^^^^^^^ @@ -17,8 +18,9 @@ error[FURB110]: FURB110.py:1:5: [*] Replace ternary `if` expression with `or` op 3 3 | z = x \ 4 4 | if x else y # FURB110 -error[FURB110]: FURB110.py:3:5: [*] Replace ternary `if` expression with `or` operator +error[FURB110]: 3:5: [*] Replace ternary `if` expression with `or` operator + --> FURB110.py:3:5 | 1 | z = x if x else y # FURB110 2 | @@ -40,8 +42,9 @@ error[FURB110]: FURB110.py:3:5: [*] Replace ternary `if` expression with `or` op 6 5 | z = x if x \ 7 6 | else \ -error[FURB110]: FURB110.py:6:5: [*] Replace ternary `if` expression with `or` operator +error[FURB110]: 6:5: [*] Replace ternary `if` expression with `or` operator + --> FURB110.py:6:5 | 4 | if x else y # FURB110 5 | @@ -66,8 +69,9 @@ error[FURB110]: FURB110.py:6:5: [*] Replace ternary `if` expression with `or` op 10 8 | z = x() if x() else y() # FURB110 11 9 | -error[FURB110]: FURB110.py:10:5: [*] Replace ternary `if` expression with `or` operator +error[FURB110]: 10:5: [*] Replace ternary `if` expression with `or` operator + --> FURB110.py:10:5 | 8 | y # FURB110 9 | @@ -87,8 +91,9 @@ error[FURB110]: FURB110.py:10:5: [*] Replace ternary `if` expression with `or` o 12 12 | # FURB110 13 13 | z = x if ( -error[FURB110]: FURB110.py:13:5: [*] Replace ternary `if` expression with `or` operator +error[FURB110]: 13:5: [*] Replace ternary `if` expression with `or` operator + --> FURB110.py:13:5 | 12 | # FURB110 13 | z = x if ( @@ -118,8 +123,9 @@ error[FURB110]: FURB110.py:13:5: [*] Replace ternary `if` expression with `or` o 18 18 | y 19 19 | ) -error[FURB110]: FURB110.py:23:5: [*] Replace ternary `if` expression with `or` operator +error[FURB110]: 23:5: [*] Replace ternary `if` expression with `or` operator + --> FURB110.py:23:5 | 21 | # FURB110 22 | z = ( @@ -149,8 +155,9 @@ error[FURB110]: FURB110.py:23:5: [*] Replace ternary `if` expression with `or` o 28 28 | y 29 29 | ) -error[FURB110]: FURB110.py:34:5: [*] Replace ternary `if` expression with `or` operator +error[FURB110]: 34:5: [*] Replace ternary `if` expression with `or` operator + --> FURB110.py:34:5 | 32 | # FURB110 33 | z = ( @@ -180,8 +187,9 @@ error[FURB110]: FURB110.py:34:5: [*] Replace ternary `if` expression with `or` o 41 36 | 42 37 | # FURB110 -error[FURB110]: FURB110.py:44:5: [*] Replace ternary `if` expression with `or` operator +error[FURB110]: 44:5: [*] Replace ternary `if` expression with `or` operator + --> FURB110.py:44:5 | 42 | # FURB110 43 | z = ( diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB113_FURB113.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB113_FURB113.py.snap index 36223892a6..a3170eb25a 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB113_FURB113.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB113_FURB113.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/refurb/mod.rs --- -error[FURB113]: FURB113.py:23:1: [*] Use `nums.extend((1, 2))` instead of repeatedly calling `nums.append()` +error[FURB113]: 23:1: [*] Use `nums.extend((1, 2))` instead of repeatedly calling `nums.append()` + --> FURB113.py:22:10 | 22 | # FURB113 23 | / nums.append(1) @@ -22,8 +23,9 @@ error[FURB113]: FURB113.py:23:1: [*] Use `nums.extend((1, 2))` instead of repeat 26 25 | 27 26 | -error[FURB113]: FURB113.py:29:1: [*] Use `nums3.extend((1, 2))` instead of repeatedly calling `nums3.append()` +error[FURB113]: 29:1: [*] Use `nums3.extend((1, 2))` instead of repeatedly calling `nums3.append()` + --> FURB113.py:28:10 | 28 | # FURB113 29 | / nums3.append(1) @@ -43,8 +45,9 @@ error[FURB113]: FURB113.py:29:1: [*] Use `nums3.extend((1, 2))` instead of repea 32 31 | 33 32 | -error[FURB113]: FURB113.py:35:1: [*] Use `nums4.extend((1, 2))` instead of repeatedly calling `nums4.append()` +error[FURB113]: 35:1: [*] Use `nums4.extend((1, 2))` instead of repeatedly calling `nums4.append()` + --> FURB113.py:34:10 | 34 | # FURB113 35 | / nums4.append(1) @@ -64,8 +67,9 @@ error[FURB113]: FURB113.py:35:1: [*] Use `nums4.extend((1, 2))` instead of repea 38 37 | 39 38 | -error[FURB113]: FURB113.py:41:1: Use `nums.extend((1, 2, 3))` instead of repeatedly calling `nums.append()` +error[FURB113]: 41:1: Use `nums.extend((1, 2, 3))` instead of repeatedly calling `nums.append()` + --> FURB113.py:40:10 | 40 | # FURB113 41 | / nums.append(1) @@ -76,8 +80,9 @@ error[FURB113]: FURB113.py:41:1: Use `nums.extend((1, 2, 3))` instead of repeate 45 | pass | = help: Replace with `nums.extend((1, 2, 3))` -error[FURB113]: FURB113.py:49:1: Use `nums.extend((1, 2, 3))` instead of repeatedly calling `nums.append()` +error[FURB113]: 49:1: Use `nums.extend((1, 2, 3))` instead of repeatedly calling `nums.append()` + --> FURB113.py:48:10 | 48 | # FURB113 49 | / nums.append(1) @@ -91,8 +96,9 @@ error[FURB113]: FURB113.py:49:1: Use `nums.extend((1, 2, 3))` instead of repeate 56 | nums4.append(1) | = help: Replace with `nums.extend((1, 2, 3))` -error[FURB113]: FURB113.py:53:1: Use `nums3.extend((1, 2))` instead of repeatedly calling `nums3.append()` +error[FURB113]: 53:1: Use `nums3.extend((1, 2))` instead of repeatedly calling `nums3.append()` + --> FURB113.py:52:10 | 51 | nums.append(2) 52 | # FURB113 @@ -106,8 +112,9 @@ error[FURB113]: FURB113.py:53:1: Use `nums3.extend((1, 2))` instead of repeatedl 59 | pass | = help: Replace with `nums3.extend((1, 2))` -error[FURB113]: FURB113.py:56:1: [*] Use `nums4.extend((1, 2))` instead of repeatedly calling `nums4.append()` +error[FURB113]: 56:1: [*] Use `nums4.extend((1, 2))` instead of repeatedly calling `nums4.append()` + --> FURB113.py:55:10 | 54 | nums.append(3) 55 | # FURB113 @@ -129,8 +136,9 @@ error[FURB113]: FURB113.py:56:1: [*] Use `nums4.extend((1, 2))` instead of repea 59 58 | pass 60 59 | -error[FURB113]: FURB113.py:62:1: [*] Use `nums.extend((1, 2, 3))` instead of repeatedly calling `nums.append()` +error[FURB113]: 62:1: [*] Use `nums.extend((1, 2, 3))` instead of repeatedly calling `nums.append()` + --> FURB113.py:61:10 | 61 | # FURB113 62 | / nums.append(1) @@ -151,8 +159,9 @@ error[FURB113]: FURB113.py:62:1: [*] Use `nums.extend((1, 2, 3))` instead of rep 66 64 | 67 65 | if True: -error[FURB113]: FURB113.py:69:5: [*] Use `nums.extend((1, 2))` instead of repeatedly calling `nums.append()` +error[FURB113]: 69:5: [*] Use `nums.extend((1, 2))` instead of repeatedly calling `nums.append()` + --> FURB113.py:69:5 | 67 | if True: 68 | # FURB113 @@ -173,8 +182,9 @@ error[FURB113]: FURB113.py:69:5: [*] Use `nums.extend((1, 2))` instead of repeat 72 71 | 73 72 | if True: -error[FURB113]: FURB113.py:75:5: [*] Use `nums.extend((1, 2))` instead of repeatedly calling `nums.append()` +error[FURB113]: 75:5: [*] Use `nums.extend((1, 2))` instead of repeatedly calling `nums.append()` + --> FURB113.py:75:5 | 73 | if True: 74 | # FURB113 @@ -196,8 +206,9 @@ error[FURB113]: FURB113.py:75:5: [*] Use `nums.extend((1, 2))` instead of repeat 78 77 | 79 78 | -error[FURB113]: FURB113.py:82:5: Use `nums.extend((1, 2, 3))` instead of repeatedly calling `nums.append()` +error[FURB113]: 82:5: Use `nums.extend((1, 2, 3))` instead of repeatedly calling `nums.append()` + --> FURB113.py:82:5 | 80 | if True: 81 | # FURB113 @@ -209,8 +220,9 @@ error[FURB113]: FURB113.py:82:5: Use `nums.extend((1, 2, 3))` instead of repeate | |__________________^ | = help: Replace with `nums.extend((1, 2, 3))` -error[FURB113]: FURB113.py:90:5: [*] Use `x.extend((1, 2))` instead of repeatedly calling `x.append()` +error[FURB113]: 90:5: [*] Use `x.extend((1, 2))` instead of repeatedly calling `x.append()` + --> FURB113.py:90:5 | 88 | def yes_one(x: list[int]): 89 | # FURB113 @@ -231,8 +243,9 @@ error[FURB113]: FURB113.py:90:5: [*] Use `x.extend((1, 2))` instead of repeatedl 93 92 | 94 93 | def yes_two(x: List[int]): -error[FURB113]: FURB113.py:96:5: [*] Use `x.extend((1, 2))` instead of repeatedly calling `x.append()` +error[FURB113]: 96:5: [*] Use `x.extend((1, 2))` instead of repeatedly calling `x.append()` + --> FURB113.py:96:5 | 94 | def yes_two(x: List[int]): 95 | # FURB113 @@ -253,8 +266,9 @@ error[FURB113]: FURB113.py:96:5: [*] Use `x.extend((1, 2))` instead of repeatedl 99 98 | 100 99 | def yes_three(*, x: list[int]): -error[FURB113]: FURB113.py:102:5: [*] Use `x.extend((1, 2))` instead of repeatedly calling `x.append()` +error[FURB113]: 102:5: [*] Use `x.extend((1, 2))` instead of repeatedly calling `x.append()` + --> FURB113.py:102:5 | 100 | def yes_three(*, x: list[int]): 101 | # FURB113 @@ -275,8 +289,9 @@ error[FURB113]: FURB113.py:102:5: [*] Use `x.extend((1, 2))` instead of repeated 105 104 | 106 105 | def yes_four(x: list[int], /): -error[FURB113]: FURB113.py:108:5: [*] Use `x.extend((1, 2))` instead of repeatedly calling `x.append()` +error[FURB113]: 108:5: [*] Use `x.extend((1, 2))` instead of repeatedly calling `x.append()` + --> FURB113.py:108:5 | 106 | def yes_four(x: list[int], /): 107 | # FURB113 @@ -297,8 +312,9 @@ error[FURB113]: FURB113.py:108:5: [*] Use `x.extend((1, 2))` instead of repeated 111 110 | 112 111 | def yes_five(x: list[int], y: list[int]): -error[FURB113]: FURB113.py:114:5: Use `x.extend((1, 2, 3))` instead of repeatedly calling `x.append()` +error[FURB113]: 114:5: Use `x.extend((1, 2, 3))` instead of repeatedly calling `x.append()` + --> FURB113.py:114:5 | 112 | def yes_five(x: list[int], y: list[int]): 113 | # FURB113 @@ -310,8 +326,9 @@ error[FURB113]: FURB113.py:114:5: Use `x.extend((1, 2, 3))` instead of repeatedl | |_______________^ | = help: Replace with `x.extend((1, 2, 3))` -error[FURB113]: FURB113.py:122:5: [*] Use `x.extend((1, 2))` instead of repeatedly calling `x.append()` +error[FURB113]: 122:5: [*] Use `x.extend((1, 2))` instead of repeatedly calling `x.append()` + --> FURB113.py:122:5 | 120 | def yes_six(x: list): 121 | # FURB113 @@ -332,8 +349,9 @@ error[FURB113]: FURB113.py:122:5: [*] Use `x.extend((1, 2))` instead of repeated 125 124 | 126 125 | if True: -error[FURB113]: FURB113.py:128:5: Use `nums.extend((1, 2, 3))` instead of repeatedly calling `nums.append()` +error[FURB113]: 128:5: Use `nums.extend((1, 2, 3))` instead of repeatedly calling `nums.append()` + --> FURB113.py:128:5 | 126 | if True: 127 | # FURB113 diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB116_FURB116.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB116_FURB116.py.snap index a201b6419a..1ddcf9155a 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB116_FURB116.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB116_FURB116.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/refurb/mod.rs --- -error[FURB116]: FURB116.py:6:7: [*] Replace `oct` call with `f"{num:o}"` +error[FURB116]: 6:7: [*] Replace `oct` call with `f"{num:o}"` + --> FURB116.py:6:7 | 4 | return num 5 | @@ -22,8 +23,9 @@ error[FURB116]: FURB116.py:6:7: [*] Replace `oct` call with `f"{num:o}"` 8 8 | print(bin(num)[2:]) # FURB116 9 9 | -error[FURB116]: FURB116.py:7:7: [*] Replace `hex` call with `f"{num:x}"` +error[FURB116]: 7:7: [*] Replace `hex` call with `f"{num:x}"` + --> FURB116.py:7:7 | 6 | print(oct(num)[2:]) # FURB116 7 | print(hex(num)[2:]) # FURB116 @@ -41,8 +43,9 @@ error[FURB116]: FURB116.py:7:7: [*] Replace `hex` call with `f"{num:x}"` 9 9 | 10 10 | print(oct(1337)[2:]) # FURB116 -error[FURB116]: FURB116.py:8:7: [*] Replace `bin` call with `f"{num:b}"` +error[FURB116]: 8:7: [*] Replace `bin` call with `f"{num:b}"` + --> FURB116.py:8:7 | 6 | print(oct(num)[2:]) # FURB116 7 | print(hex(num)[2:]) # FURB116 @@ -62,8 +65,9 @@ error[FURB116]: FURB116.py:8:7: [*] Replace `bin` call with `f"{num:b}"` 10 10 | print(oct(1337)[2:]) # FURB116 11 11 | print(hex(1337)[2:]) # FURB116 -error[FURB116]: FURB116.py:10:7: [*] Replace `oct` call with `f"{1337:o}"` +error[FURB116]: 10:7: [*] Replace `oct` call with `f"{1337:o}"` + --> FURB116.py:10:7 | 8 | print(bin(num)[2:]) # FURB116 9 | @@ -83,8 +87,9 @@ error[FURB116]: FURB116.py:10:7: [*] Replace `oct` call with `f"{1337:o}"` 12 12 | print(bin(1337)[2:]) # FURB116 13 13 | -error[FURB116]: FURB116.py:11:7: [*] Replace `hex` call with `f"{1337:x}"` +error[FURB116]: 11:7: [*] Replace `hex` call with `f"{1337:x}"` + --> FURB116.py:11:7 | 10 | print(oct(1337)[2:]) # FURB116 11 | print(hex(1337)[2:]) # FURB116 @@ -102,8 +107,9 @@ error[FURB116]: FURB116.py:11:7: [*] Replace `hex` call with `f"{1337:x}"` 13 13 | 14 14 | print(bin(return_num())[2:]) # FURB116 (no autofix) -error[FURB116]: FURB116.py:12:7: [*] Replace `bin` call with `f"{1337:b}"` +error[FURB116]: 12:7: [*] Replace `bin` call with `f"{1337:b}"` + --> FURB116.py:12:7 | 10 | print(oct(1337)[2:]) # FURB116 11 | print(hex(1337)[2:]) # FURB116 @@ -123,8 +129,9 @@ error[FURB116]: FURB116.py:12:7: [*] Replace `bin` call with `f"{1337:b}"` 14 14 | print(bin(return_num())[2:]) # FURB116 (no autofix) 15 15 | print(bin(int(f"{num}"))[2:]) # FURB116 (no autofix) -error[FURB116]: FURB116.py:14:7: Replace `bin` call with f-string +error[FURB116]: 14:7: Replace `bin` call with f-string + --> FURB116.py:14:7 | 12 | print(bin(1337)[2:]) # FURB116 13 | @@ -133,8 +140,9 @@ error[FURB116]: FURB116.py:14:7: Replace `bin` call with f-string 15 | print(bin(int(f"{num}"))[2:]) # FURB116 (no autofix) | = help: Replace with f-string -error[FURB116]: FURB116.py:15:7: Replace `bin` call with f-string +error[FURB116]: 15:7: Replace `bin` call with f-string + --> FURB116.py:15:7 | 14 | print(bin(return_num())[2:]) # FURB116 (no autofix) 15 | print(bin(int(f"{num}"))[2:]) # FURB116 (no autofix) diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB118_FURB118.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB118_FURB118.py.snap index fdfe0dbfbe..03a5901d44 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB118_FURB118.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB118_FURB118.py.snap @@ -1,16 +1,17 @@ --- source: crates/ruff_linter/src/rules/refurb/mod.rs --- -FURB118.py:2:13: FURB118 [*] Use `operator.invert` instead of defining a lambda +error[FURB118]: 2:13: [*] Use `operator.invert` instead of defining a lambda + + --> FURB118.py:2:13 | 1 | # Errors. 2 | op_bitnot = lambda x: ~x - | ^^^^^^^^^^^^ FURB118 + | ^^^^^^^^^^^^ 3 | op_not = lambda x: not x 4 | op_pos = lambda x: +x | = help: Replace with `operator.invert` - ℹ Safe fix 1 1 | # Errors. 2 |-op_bitnot = lambda x: ~x @@ -20,17 +21,18 @@ FURB118.py:2:13: FURB118 [*] Use `operator.invert` instead of defining a lambda 4 5 | op_pos = lambda x: +x 5 6 | op_neg = lambda x: -x -FURB118.py:3:10: FURB118 [*] Use `operator.not_` instead of defining a lambda +error[FURB118]: 3:10: [*] Use `operator.not_` instead of defining a lambda + + --> FURB118.py:3:10 | 1 | # Errors. 2 | op_bitnot = lambda x: ~x 3 | op_not = lambda x: not x - | ^^^^^^^^^^^^^^^ FURB118 + | ^^^^^^^^^^^^^^^ 4 | op_pos = lambda x: +x 5 | op_neg = lambda x: -x | = help: Replace with `operator.not_` - ℹ Safe fix 1 1 | # Errors. 2 |+import operator @@ -41,16 +43,17 @@ FURB118.py:3:10: FURB118 [*] Use `operator.not_` instead of defining a lambda 5 6 | op_neg = lambda x: -x 6 7 | -FURB118.py:4:10: FURB118 [*] Use `operator.pos` instead of defining a lambda +error[FURB118]: 4:10: [*] Use `operator.pos` instead of defining a lambda + + --> FURB118.py:4:10 | 2 | op_bitnot = lambda x: ~x 3 | op_not = lambda x: not x 4 | op_pos = lambda x: +x - | ^^^^^^^^^^^^ FURB118 + | ^^^^^^^^^^^^ 5 | op_neg = lambda x: -x | = help: Replace with `operator.pos` - ℹ Safe fix 1 1 | # Errors. 2 |+import operator @@ -62,17 +65,18 @@ FURB118.py:4:10: FURB118 [*] Use `operator.pos` instead of defining a lambda 6 7 | 7 8 | op_add = lambda x, y: x + y -FURB118.py:5:10: FURB118 [*] Use `operator.neg` instead of defining a lambda +error[FURB118]: 5:10: [*] Use `operator.neg` instead of defining a lambda + + --> FURB118.py:5:10 | 3 | op_not = lambda x: not x 4 | op_pos = lambda x: +x 5 | op_neg = lambda x: -x - | ^^^^^^^^^^^^ FURB118 + | ^^^^^^^^^^^^ 6 | 7 | op_add = lambda x, y: x + y | = help: Replace with `operator.neg` - ℹ Safe fix 1 1 | # Errors. 2 |+import operator @@ -85,17 +89,18 @@ FURB118.py:5:10: FURB118 [*] Use `operator.neg` instead of defining a lambda 7 8 | op_add = lambda x, y: x + y 8 9 | op_sub = lambda x, y: x - y -FURB118.py:7:10: FURB118 [*] Use `operator.add` instead of defining a lambda +error[FURB118]: 7:10: [*] Use `operator.add` instead of defining a lambda + + --> FURB118.py:7:10 | 5 | op_neg = lambda x: -x 6 | 7 | op_add = lambda x, y: x + y - | ^^^^^^^^^^^^^^^^^^ FURB118 + | ^^^^^^^^^^^^^^^^^^ 8 | op_sub = lambda x, y: x - y 9 | op_mult = lambda x, y: x * y | = help: Replace with `operator.add` - ℹ Safe fix 1 1 | # Errors. 2 |+import operator @@ -110,16 +115,17 @@ FURB118.py:7:10: FURB118 [*] Use `operator.add` instead of defining a lambda 9 10 | op_mult = lambda x, y: x * y 10 11 | op_matmutl = lambda x, y: x @ y -FURB118.py:8:10: FURB118 [*] Use `operator.sub` instead of defining a lambda +error[FURB118]: 8:10: [*] Use `operator.sub` instead of defining a lambda + + --> FURB118.py:8:10 | 7 | op_add = lambda x, y: x + y 8 | op_sub = lambda x, y: x - y - | ^^^^^^^^^^^^^^^^^^ FURB118 + | ^^^^^^^^^^^^^^^^^^ 9 | op_mult = lambda x, y: x * y 10 | op_matmutl = lambda x, y: x @ y | = help: Replace with `operator.sub` - ℹ Safe fix 1 1 | # Errors. 2 |+import operator @@ -135,17 +141,18 @@ FURB118.py:8:10: FURB118 [*] Use `operator.sub` instead of defining a lambda 10 11 | op_matmutl = lambda x, y: x @ y 11 12 | op_truediv = lambda x, y: x / y -FURB118.py:9:11: FURB118 [*] Use `operator.mul` instead of defining a lambda +error[FURB118]: 9:11: [*] Use `operator.mul` instead of defining a lambda + + --> FURB118.py:9:11 | 7 | op_add = lambda x, y: x + y 8 | op_sub = lambda x, y: x - y 9 | op_mult = lambda x, y: x * y - | ^^^^^^^^^^^^^^^^^^ FURB118 + | ^^^^^^^^^^^^^^^^^^ 10 | op_matmutl = lambda x, y: x @ y 11 | op_truediv = lambda x, y: x / y | = help: Replace with `operator.mul` - ℹ Safe fix 1 1 | # Errors. 2 |+import operator @@ -162,17 +169,18 @@ FURB118.py:9:11: FURB118 [*] Use `operator.mul` instead of defining a lambda 11 12 | op_truediv = lambda x, y: x / y 12 13 | op_mod = lambda x, y: x % y -FURB118.py:10:14: FURB118 [*] Use `operator.matmul` instead of defining a lambda +error[FURB118]: 10:14: [*] Use `operator.matmul` instead of defining a lambda + + --> FURB118.py:10:14 | 8 | op_sub = lambda x, y: x - y 9 | op_mult = lambda x, y: x * y 10 | op_matmutl = lambda x, y: x @ y - | ^^^^^^^^^^^^^^^^^^ FURB118 + | ^^^^^^^^^^^^^^^^^^ 11 | op_truediv = lambda x, y: x / y 12 | op_mod = lambda x, y: x % y | = help: Replace with `operator.matmul` - ℹ Safe fix 1 1 | # Errors. 2 |+import operator @@ -189,17 +197,18 @@ FURB118.py:10:14: FURB118 [*] Use `operator.matmul` instead of defining a lambda 12 13 | op_mod = lambda x, y: x % y 13 14 | op_pow = lambda x, y: x ** y -FURB118.py:11:14: FURB118 [*] Use `operator.truediv` instead of defining a lambda +error[FURB118]: 11:14: [*] Use `operator.truediv` instead of defining a lambda + + --> FURB118.py:11:14 | 9 | op_mult = lambda x, y: x * y 10 | op_matmutl = lambda x, y: x @ y 11 | op_truediv = lambda x, y: x / y - | ^^^^^^^^^^^^^^^^^^ FURB118 + | ^^^^^^^^^^^^^^^^^^ 12 | op_mod = lambda x, y: x % y 13 | op_pow = lambda x, y: x ** y | = help: Replace with `operator.truediv` - ℹ Safe fix 1 1 | # Errors. 2 |+import operator @@ -216,17 +225,18 @@ FURB118.py:11:14: FURB118 [*] Use `operator.truediv` instead of defining a lambd 13 14 | op_pow = lambda x, y: x ** y 14 15 | op_lshift = lambda x, y: x << y -FURB118.py:12:10: FURB118 [*] Use `operator.mod` instead of defining a lambda +error[FURB118]: 12:10: [*] Use `operator.mod` instead of defining a lambda + + --> FURB118.py:12:10 | 10 | op_matmutl = lambda x, y: x @ y 11 | op_truediv = lambda x, y: x / y 12 | op_mod = lambda x, y: x % y - | ^^^^^^^^^^^^^^^^^^ FURB118 + | ^^^^^^^^^^^^^^^^^^ 13 | op_pow = lambda x, y: x ** y 14 | op_lshift = lambda x, y: x << y | = help: Replace with `operator.mod` - ℹ Safe fix 1 1 | # Errors. 2 |+import operator @@ -243,17 +253,18 @@ FURB118.py:12:10: FURB118 [*] Use `operator.mod` instead of defining a lambda 14 15 | op_lshift = lambda x, y: x << y 15 16 | op_rshift = lambda x, y: x >> y -FURB118.py:13:10: FURB118 [*] Use `operator.pow` instead of defining a lambda +error[FURB118]: 13:10: [*] Use `operator.pow` instead of defining a lambda + + --> FURB118.py:13:10 | 11 | op_truediv = lambda x, y: x / y 12 | op_mod = lambda x, y: x % y 13 | op_pow = lambda x, y: x ** y - | ^^^^^^^^^^^^^^^^^^^ FURB118 + | ^^^^^^^^^^^^^^^^^^^ 14 | op_lshift = lambda x, y: x << y 15 | op_rshift = lambda x, y: x >> y | = help: Replace with `operator.pow` - ℹ Safe fix 1 1 | # Errors. 2 |+import operator @@ -270,17 +281,18 @@ FURB118.py:13:10: FURB118 [*] Use `operator.pow` instead of defining a lambda 15 16 | op_rshift = lambda x, y: x >> y 16 17 | op_bitor = lambda x, y: x | y -FURB118.py:14:13: FURB118 [*] Use `operator.lshift` instead of defining a lambda +error[FURB118]: 14:13: [*] Use `operator.lshift` instead of defining a lambda + + --> FURB118.py:14:13 | 12 | op_mod = lambda x, y: x % y 13 | op_pow = lambda x, y: x ** y 14 | op_lshift = lambda x, y: x << y - | ^^^^^^^^^^^^^^^^^^^ FURB118 + | ^^^^^^^^^^^^^^^^^^^ 15 | op_rshift = lambda x, y: x >> y 16 | op_bitor = lambda x, y: x | y | = help: Replace with `operator.lshift` - ℹ Safe fix 1 1 | # Errors. 2 |+import operator @@ -297,17 +309,18 @@ FURB118.py:14:13: FURB118 [*] Use `operator.lshift` instead of defining a lambda 16 17 | op_bitor = lambda x, y: x | y 17 18 | op_xor = lambda x, y: x ^ y -FURB118.py:15:13: FURB118 [*] Use `operator.rshift` instead of defining a lambda +error[FURB118]: 15:13: [*] Use `operator.rshift` instead of defining a lambda + + --> FURB118.py:15:13 | 13 | op_pow = lambda x, y: x ** y 14 | op_lshift = lambda x, y: x << y 15 | op_rshift = lambda x, y: x >> y - | ^^^^^^^^^^^^^^^^^^^ FURB118 + | ^^^^^^^^^^^^^^^^^^^ 16 | op_bitor = lambda x, y: x | y 17 | op_xor = lambda x, y: x ^ y | = help: Replace with `operator.rshift` - ℹ Safe fix 1 1 | # Errors. 2 |+import operator @@ -324,17 +337,18 @@ FURB118.py:15:13: FURB118 [*] Use `operator.rshift` instead of defining a lambda 17 18 | op_xor = lambda x, y: x ^ y 18 19 | op_bitand = lambda x, y: x & y -FURB118.py:16:12: FURB118 [*] Use `operator.or_` instead of defining a lambda +error[FURB118]: 16:12: [*] Use `operator.or_` instead of defining a lambda + + --> FURB118.py:16:12 | 14 | op_lshift = lambda x, y: x << y 15 | op_rshift = lambda x, y: x >> y 16 | op_bitor = lambda x, y: x | y - | ^^^^^^^^^^^^^^^^^^ FURB118 + | ^^^^^^^^^^^^^^^^^^ 17 | op_xor = lambda x, y: x ^ y 18 | op_bitand = lambda x, y: x & y | = help: Replace with `operator.or_` - ℹ Safe fix 1 1 | # Errors. 2 |+import operator @@ -351,17 +365,18 @@ FURB118.py:16:12: FURB118 [*] Use `operator.or_` instead of defining a lambda 18 19 | op_bitand = lambda x, y: x & y 19 20 | op_floordiv = lambda x, y: x // y -FURB118.py:17:10: FURB118 [*] Use `operator.xor` instead of defining a lambda +error[FURB118]: 17:10: [*] Use `operator.xor` instead of defining a lambda + + --> FURB118.py:17:10 | 15 | op_rshift = lambda x, y: x >> y 16 | op_bitor = lambda x, y: x | y 17 | op_xor = lambda x, y: x ^ y - | ^^^^^^^^^^^^^^^^^^ FURB118 + | ^^^^^^^^^^^^^^^^^^ 18 | op_bitand = lambda x, y: x & y 19 | op_floordiv = lambda x, y: x // y | = help: Replace with `operator.xor` - ℹ Safe fix 1 1 | # Errors. 2 |+import operator @@ -378,16 +393,17 @@ FURB118.py:17:10: FURB118 [*] Use `operator.xor` instead of defining a lambda 19 20 | op_floordiv = lambda x, y: x // y 20 21 | -FURB118.py:18:13: FURB118 [*] Use `operator.and_` instead of defining a lambda +error[FURB118]: 18:13: [*] Use `operator.and_` instead of defining a lambda + + --> FURB118.py:18:13 | 16 | op_bitor = lambda x, y: x | y 17 | op_xor = lambda x, y: x ^ y 18 | op_bitand = lambda x, y: x & y - | ^^^^^^^^^^^^^^^^^^ FURB118 + | ^^^^^^^^^^^^^^^^^^ 19 | op_floordiv = lambda x, y: x // y | = help: Replace with `operator.and_` - ℹ Safe fix 1 1 | # Errors. 2 |+import operator @@ -404,17 +420,18 @@ FURB118.py:18:13: FURB118 [*] Use `operator.and_` instead of defining a lambda 20 21 | 21 22 | op_eq = lambda x, y: x == y -FURB118.py:19:15: FURB118 [*] Use `operator.floordiv` instead of defining a lambda +error[FURB118]: 19:15: [*] Use `operator.floordiv` instead of defining a lambda + + --> FURB118.py:19:15 | 17 | op_xor = lambda x, y: x ^ y 18 | op_bitand = lambda x, y: x & y 19 | op_floordiv = lambda x, y: x // y - | ^^^^^^^^^^^^^^^^^^^ FURB118 + | ^^^^^^^^^^^^^^^^^^^ 20 | 21 | op_eq = lambda x, y: x == y | = help: Replace with `operator.floordiv` - ℹ Safe fix 1 1 | # Errors. 2 |+import operator @@ -431,17 +448,18 @@ FURB118.py:19:15: FURB118 [*] Use `operator.floordiv` instead of defining a lamb 21 22 | op_eq = lambda x, y: x == y 22 23 | op_ne = lambda x, y: x != y -FURB118.py:21:9: FURB118 [*] Use `operator.eq` instead of defining a lambda +error[FURB118]: 21:9: [*] Use `operator.eq` instead of defining a lambda + + --> FURB118.py:21:9 | 19 | op_floordiv = lambda x, y: x // y 20 | 21 | op_eq = lambda x, y: x == y - | ^^^^^^^^^^^^^^^^^^^ FURB118 + | ^^^^^^^^^^^^^^^^^^^ 22 | op_ne = lambda x, y: x != y 23 | op_lt = lambda x, y: x < y | = help: Replace with `operator.eq` - ℹ Safe fix 1 1 | # Errors. 2 |+import operator @@ -458,16 +476,17 @@ FURB118.py:21:9: FURB118 [*] Use `operator.eq` instead of defining a lambda 23 24 | op_lt = lambda x, y: x < y 24 25 | op_lte = lambda x, y: x <= y -FURB118.py:22:9: FURB118 [*] Use `operator.ne` instead of defining a lambda +error[FURB118]: 22:9: [*] Use `operator.ne` instead of defining a lambda + + --> FURB118.py:22:9 | 21 | op_eq = lambda x, y: x == y 22 | op_ne = lambda x, y: x != y - | ^^^^^^^^^^^^^^^^^^^ FURB118 + | ^^^^^^^^^^^^^^^^^^^ 23 | op_lt = lambda x, y: x < y 24 | op_lte = lambda x, y: x <= y | = help: Replace with `operator.ne` - ℹ Safe fix 1 1 | # Errors. 2 |+import operator @@ -484,17 +503,18 @@ FURB118.py:22:9: FURB118 [*] Use `operator.ne` instead of defining a lambda 24 25 | op_lte = lambda x, y: x <= y 25 26 | op_gt = lambda x, y: x > y -FURB118.py:23:9: FURB118 [*] Use `operator.lt` instead of defining a lambda +error[FURB118]: 23:9: [*] Use `operator.lt` instead of defining a lambda + + --> FURB118.py:23:9 | 21 | op_eq = lambda x, y: x == y 22 | op_ne = lambda x, y: x != y 23 | op_lt = lambda x, y: x < y - | ^^^^^^^^^^^^^^^^^^ FURB118 + | ^^^^^^^^^^^^^^^^^^ 24 | op_lte = lambda x, y: x <= y 25 | op_gt = lambda x, y: x > y | = help: Replace with `operator.lt` - ℹ Safe fix 1 1 | # Errors. 2 |+import operator @@ -511,17 +531,18 @@ FURB118.py:23:9: FURB118 [*] Use `operator.lt` instead of defining a lambda 25 26 | op_gt = lambda x, y: x > y 26 27 | op_gte = lambda x, y: x >= y -FURB118.py:24:10: FURB118 [*] Use `operator.le` instead of defining a lambda +error[FURB118]: 24:10: [*] Use `operator.le` instead of defining a lambda + + --> FURB118.py:24:10 | 22 | op_ne = lambda x, y: x != y 23 | op_lt = lambda x, y: x < y 24 | op_lte = lambda x, y: x <= y - | ^^^^^^^^^^^^^^^^^^^ FURB118 + | ^^^^^^^^^^^^^^^^^^^ 25 | op_gt = lambda x, y: x > y 26 | op_gte = lambda x, y: x >= y | = help: Replace with `operator.le` - ℹ Safe fix 1 1 | # Errors. 2 |+import operator @@ -538,17 +559,18 @@ FURB118.py:24:10: FURB118 [*] Use `operator.le` instead of defining a lambda 26 27 | op_gte = lambda x, y: x >= y 27 28 | op_is = lambda x, y: x is y -FURB118.py:25:9: FURB118 [*] Use `operator.gt` instead of defining a lambda +error[FURB118]: 25:9: [*] Use `operator.gt` instead of defining a lambda + + --> FURB118.py:25:9 | 23 | op_lt = lambda x, y: x < y 24 | op_lte = lambda x, y: x <= y 25 | op_gt = lambda x, y: x > y - | ^^^^^^^^^^^^^^^^^^ FURB118 + | ^^^^^^^^^^^^^^^^^^ 26 | op_gte = lambda x, y: x >= y 27 | op_is = lambda x, y: x is y | = help: Replace with `operator.gt` - ℹ Safe fix 1 1 | # Errors. 2 |+import operator @@ -565,17 +587,18 @@ FURB118.py:25:9: FURB118 [*] Use `operator.gt` instead of defining a lambda 27 28 | op_is = lambda x, y: x is y 28 29 | op_isnot = lambda x, y: x is not y -FURB118.py:26:10: FURB118 [*] Use `operator.ge` instead of defining a lambda +error[FURB118]: 26:10: [*] Use `operator.ge` instead of defining a lambda + + --> FURB118.py:26:10 | 24 | op_lte = lambda x, y: x <= y 25 | op_gt = lambda x, y: x > y 26 | op_gte = lambda x, y: x >= y - | ^^^^^^^^^^^^^^^^^^^ FURB118 + | ^^^^^^^^^^^^^^^^^^^ 27 | op_is = lambda x, y: x is y 28 | op_isnot = lambda x, y: x is not y | = help: Replace with `operator.ge` - ℹ Safe fix 1 1 | # Errors. 2 |+import operator @@ -592,17 +615,18 @@ FURB118.py:26:10: FURB118 [*] Use `operator.ge` instead of defining a lambda 28 29 | op_isnot = lambda x, y: x is not y 29 30 | op_in = lambda x, y: y in x -FURB118.py:27:9: FURB118 [*] Use `operator.is_` instead of defining a lambda +error[FURB118]: 27:9: [*] Use `operator.is_` instead of defining a lambda + + --> FURB118.py:27:9 | 25 | op_gt = lambda x, y: x > y 26 | op_gte = lambda x, y: x >= y 27 | op_is = lambda x, y: x is y - | ^^^^^^^^^^^^^^^^^^^ FURB118 + | ^^^^^^^^^^^^^^^^^^^ 28 | op_isnot = lambda x, y: x is not y 29 | op_in = lambda x, y: y in x | = help: Replace with `operator.is_` - ℹ Safe fix 1 1 | # Errors. 2 |+import operator @@ -619,17 +643,18 @@ FURB118.py:27:9: FURB118 [*] Use `operator.is_` instead of defining a lambda 29 30 | op_in = lambda x, y: y in x 30 31 | op_itemgetter = lambda x: x[0] -FURB118.py:28:12: FURB118 [*] Use `operator.is_not` instead of defining a lambda +error[FURB118]: 28:12: [*] Use `operator.is_not` instead of defining a lambda + + --> FURB118.py:28:12 | 26 | op_gte = lambda x, y: x >= y 27 | op_is = lambda x, y: x is y 28 | op_isnot = lambda x, y: x is not y - | ^^^^^^^^^^^^^^^^^^^^^^^ FURB118 + | ^^^^^^^^^^^^^^^^^^^^^^^ 29 | op_in = lambda x, y: y in x 30 | op_itemgetter = lambda x: x[0] | = help: Replace with `operator.is_not` - ℹ Safe fix 1 1 | # Errors. 2 |+import operator @@ -646,17 +671,18 @@ FURB118.py:28:12: FURB118 [*] Use `operator.is_not` instead of defining a lambda 30 31 | op_itemgetter = lambda x: x[0] 31 32 | op_itemgetter = lambda x: (x[0], x[1], x[2]) -FURB118.py:29:9: FURB118 [*] Use `operator.contains` instead of defining a lambda +error[FURB118]: 29:9: [*] Use `operator.contains` instead of defining a lambda + + --> FURB118.py:29:9 | 27 | op_is = lambda x, y: x is y 28 | op_isnot = lambda x, y: x is not y 29 | op_in = lambda x, y: y in x - | ^^^^^^^^^^^^^^^^^^^ FURB118 + | ^^^^^^^^^^^^^^^^^^^ 30 | op_itemgetter = lambda x: x[0] 31 | op_itemgetter = lambda x: (x[0], x[1], x[2]) | = help: Replace with `operator.contains` - ℹ Safe fix 1 1 | # Errors. 2 |+import operator @@ -673,17 +699,18 @@ FURB118.py:29:9: FURB118 [*] Use `operator.contains` instead of defining a lambd 31 32 | op_itemgetter = lambda x: (x[0], x[1], x[2]) 32 33 | op_itemgetter = lambda x: (x[1:], x[2]) -FURB118.py:30:17: FURB118 [*] Use `operator.itemgetter(0)` instead of defining a lambda +error[FURB118]: 30:17: [*] Use `operator.itemgetter(0)` instead of defining a lambda + + --> FURB118.py:30:17 | 28 | op_isnot = lambda x, y: x is not y 29 | op_in = lambda x, y: y in x 30 | op_itemgetter = lambda x: x[0] - | ^^^^^^^^^^^^^^ FURB118 + | ^^^^^^^^^^^^^^ 31 | op_itemgetter = lambda x: (x[0], x[1], x[2]) 32 | op_itemgetter = lambda x: (x[1:], x[2]) | = help: Replace with `operator.itemgetter(0)` - ℹ Safe fix 1 1 | # Errors. 2 |+import operator @@ -700,17 +727,18 @@ FURB118.py:30:17: FURB118 [*] Use `operator.itemgetter(0)` instead of defining a 32 33 | op_itemgetter = lambda x: (x[1:], x[2]) 33 34 | op_itemgetter = lambda x: x[:] -FURB118.py:31:17: FURB118 [*] Use `operator.itemgetter(0, 1, 2)` instead of defining a lambda +error[FURB118]: 31:17: [*] Use `operator.itemgetter(0, 1, 2)` instead of defining a lambda + + --> FURB118.py:31:17 | 29 | op_in = lambda x, y: y in x 30 | op_itemgetter = lambda x: x[0] 31 | op_itemgetter = lambda x: (x[0], x[1], x[2]) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FURB118 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 32 | op_itemgetter = lambda x: (x[1:], x[2]) 33 | op_itemgetter = lambda x: x[:] | = help: Replace with `operator.itemgetter(0, 1, 2)` - ℹ Safe fix 1 1 | # Errors. 2 |+import operator @@ -727,17 +755,18 @@ FURB118.py:31:17: FURB118 [*] Use `operator.itemgetter(0, 1, 2)` instead of defi 33 34 | op_itemgetter = lambda x: x[:] 34 35 | op_itemgetter = lambda x: x[0, 1] -FURB118.py:32:17: FURB118 [*] Use `operator.itemgetter(slice(1, None), 2)` instead of defining a lambda +error[FURB118]: 32:17: [*] Use `operator.itemgetter(slice(1, None), 2)` instead of defining a lambda + + --> FURB118.py:32:17 | 30 | op_itemgetter = lambda x: x[0] 31 | op_itemgetter = lambda x: (x[0], x[1], x[2]) 32 | op_itemgetter = lambda x: (x[1:], x[2]) - | ^^^^^^^^^^^^^^^^^^^^^^^ FURB118 + | ^^^^^^^^^^^^^^^^^^^^^^^ 33 | op_itemgetter = lambda x: x[:] 34 | op_itemgetter = lambda x: x[0, 1] | = help: Replace with `operator.itemgetter(slice(1, None), 2)` - ℹ Safe fix 1 1 | # Errors. 2 |+import operator @@ -754,17 +783,18 @@ FURB118.py:32:17: FURB118 [*] Use `operator.itemgetter(slice(1, None), 2)` inste 34 35 | op_itemgetter = lambda x: x[0, 1] 35 36 | op_itemgetter = lambda x: x[(0, 1)] -FURB118.py:33:17: FURB118 [*] Use `operator.itemgetter(slice(None))` instead of defining a lambda +error[FURB118]: 33:17: [*] Use `operator.itemgetter(slice(None))` instead of defining a lambda + + --> FURB118.py:33:17 | 31 | op_itemgetter = lambda x: (x[0], x[1], x[2]) 32 | op_itemgetter = lambda x: (x[1:], x[2]) 33 | op_itemgetter = lambda x: x[:] - | ^^^^^^^^^^^^^^ FURB118 + | ^^^^^^^^^^^^^^ 34 | op_itemgetter = lambda x: x[0, 1] 35 | op_itemgetter = lambda x: x[(0, 1)] | = help: Replace with `operator.itemgetter(slice(None))` - ℹ Safe fix 1 1 | # Errors. 2 |+import operator @@ -781,16 +811,17 @@ FURB118.py:33:17: FURB118 [*] Use `operator.itemgetter(slice(None))` instead of 35 36 | op_itemgetter = lambda x: x[(0, 1)] 36 37 | -FURB118.py:34:17: FURB118 [*] Use `operator.itemgetter((0, 1))` instead of defining a lambda +error[FURB118]: 34:17: [*] Use `operator.itemgetter((0, 1))` instead of defining a lambda + + --> FURB118.py:34:17 | 32 | op_itemgetter = lambda x: (x[1:], x[2]) 33 | op_itemgetter = lambda x: x[:] 34 | op_itemgetter = lambda x: x[0, 1] - | ^^^^^^^^^^^^^^^^^ FURB118 + | ^^^^^^^^^^^^^^^^^ 35 | op_itemgetter = lambda x: x[(0, 1)] | = help: Replace with `operator.itemgetter((0, 1))` - ℹ Safe fix 1 1 | # Errors. 2 |+import operator @@ -807,15 +838,16 @@ FURB118.py:34:17: FURB118 [*] Use `operator.itemgetter((0, 1))` instead of defin 36 37 | 37 38 | -FURB118.py:35:17: FURB118 [*] Use `operator.itemgetter((0, 1))` instead of defining a lambda +error[FURB118]: 35:17: [*] Use `operator.itemgetter((0, 1))` instead of defining a lambda + + --> FURB118.py:35:17 | 33 | op_itemgetter = lambda x: x[:] 34 | op_itemgetter = lambda x: x[0, 1] 35 | op_itemgetter = lambda x: x[(0, 1)] - | ^^^^^^^^^^^^^^^^^^^ FURB118 + | ^^^^^^^^^^^^^^^^^^^ | = help: Replace with `operator.itemgetter((0, 1))` - ℹ Safe fix 1 1 | # Errors. 2 |+import operator @@ -832,18 +864,21 @@ FURB118.py:35:17: FURB118 [*] Use `operator.itemgetter((0, 1))` instead of defin 37 38 | 38 39 | def op_not2(x): -FURB118.py:38:5: FURB118 Use `operator.not_` instead of defining a function +error[FURB118]: 38:5: Use `operator.not_` instead of defining a function + + --> FURB118.py:38:5 | 38 | def op_not2(x): - | ^^^^^^^ FURB118 + | ^^^^^^^ 39 | return not x | = help: Replace with `operator.not_` +error[FURB118]: 42:5: Use `operator.add` instead of defining a function -FURB118.py:42:5: FURB118 Use `operator.add` instead of defining a function + --> FURB118.py:42:5 | 42 | def op_add2(x, y): - | ^^^^^^^ FURB118 + | ^^^^^^^ 43 | return x + y | = help: Replace with `operator.add` diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB129_FURB129.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB129_FURB129.py.snap index b51c13866a..959433c078 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB129_FURB129.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB129_FURB129.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/refurb/mod.rs --- -error[FURB129]: FURB129.py:7:18: [*] Instead of calling `readlines()`, iterate over file object directly +error[FURB129]: 7:18: [*] Instead of calling `readlines()`, iterate over file object directly + --> FURB129.py:7:18 | 5 | # Errors 6 | with open("FURB129.py") as f: @@ -22,8 +23,9 @@ error[FURB129]: FURB129.py:7:18: [*] Instead of calling `readlines()`, iterate o 9 9 | a = [line.lower() for line in f.readlines()] 10 10 | b = {line.upper() for line in f.readlines()} -error[FURB129]: FURB129.py:9:35: [*] Instead of calling `readlines()`, iterate over file object directly +error[FURB129]: 9:35: [*] Instead of calling `readlines()`, iterate over file object directly + --> FURB129.py:9:35 | 7 | for _line in f.readlines(): 8 | pass @@ -43,8 +45,9 @@ error[FURB129]: FURB129.py:9:35: [*] Instead of calling `readlines()`, iterate o 11 11 | c = {line.lower(): line.upper() for line in f.readlines()} 12 12 | -error[FURB129]: FURB129.py:10:35: [*] Instead of calling `readlines()`, iterate over file object directly +error[FURB129]: 10:35: [*] Instead of calling `readlines()`, iterate over file object directly + --> FURB129.py:10:35 | 8 | pass 9 | a = [line.lower() for line in f.readlines()] @@ -63,8 +66,9 @@ error[FURB129]: FURB129.py:10:35: [*] Instead of calling `readlines()`, iterate 12 12 | 13 13 | with Path("FURB129.py").open() as f: -error[FURB129]: FURB129.py:11:49: [*] Instead of calling `readlines()`, iterate over file object directly +error[FURB129]: 11:49: [*] Instead of calling `readlines()`, iterate over file object directly + --> FURB129.py:11:49 | 9 | a = [line.lower() for line in f.readlines()] 10 | b = {line.upper() for line in f.readlines()} @@ -84,8 +88,9 @@ error[FURB129]: FURB129.py:11:49: [*] Instead of calling `readlines()`, iterate 13 13 | with Path("FURB129.py").open() as f: 14 14 | for _line in f.readlines(): -error[FURB129]: FURB129.py:14:18: [*] Instead of calling `readlines()`, iterate over file object directly +error[FURB129]: 14:18: [*] Instead of calling `readlines()`, iterate over file object directly + --> FURB129.py:14:18 | 13 | with Path("FURB129.py").open() as f: 14 | for _line in f.readlines(): @@ -103,8 +108,9 @@ error[FURB129]: FURB129.py:14:18: [*] Instead of calling `readlines()`, iterate 16 16 | 17 17 | for _line in open("FURB129.py").readlines(): -error[FURB129]: FURB129.py:17:14: [*] Instead of calling `readlines()`, iterate over file object directly +error[FURB129]: 17:14: [*] Instead of calling `readlines()`, iterate over file object directly + --> FURB129.py:17:14 | 15 | pass 16 | @@ -123,8 +129,9 @@ error[FURB129]: FURB129.py:17:14: [*] Instead of calling `readlines()`, iterate 19 19 | 20 20 | for _line in Path("FURB129.py").open().readlines(): -error[FURB129]: FURB129.py:20:14: [*] Instead of calling `readlines()`, iterate over file object directly +error[FURB129]: 20:14: [*] Instead of calling `readlines()`, iterate over file object directly + --> FURB129.py:20:14 | 18 | pass 19 | @@ -143,8 +150,9 @@ error[FURB129]: FURB129.py:20:14: [*] Instead of calling `readlines()`, iterate 22 22 | 23 23 | -error[FURB129]: FURB129.py:26:18: [*] Instead of calling `readlines()`, iterate over file object directly +error[FURB129]: 26:18: [*] Instead of calling `readlines()`, iterate over file object directly + --> FURB129.py:26:18 | 24 | def func(): 25 | f = Path("FURB129.py").open() @@ -164,8 +172,9 @@ error[FURB129]: FURB129.py:26:18: [*] Instead of calling `readlines()`, iterate 28 28 | f.close() 29 29 | -error[FURB129]: FURB129.py:32:18: [*] Instead of calling `readlines()`, iterate over file object directly +error[FURB129]: 32:18: [*] Instead of calling `readlines()`, iterate over file object directly + --> FURB129.py:32:18 | 31 | def func(f: io.BytesIO): 32 | for _line in f.readlines(): @@ -183,8 +192,9 @@ error[FURB129]: FURB129.py:32:18: [*] Instead of calling `readlines()`, iterate 34 34 | 35 35 | -error[FURB129]: FURB129.py:38:22: [*] Instead of calling `readlines()`, iterate over file object directly +error[FURB129]: 38:22: [*] Instead of calling `readlines()`, iterate over file object directly + --> FURB129.py:38:22 | 36 | def func(): 37 | with (open("FURB129.py") as f, foo as bar): @@ -204,8 +214,9 @@ error[FURB129]: FURB129.py:38:22: [*] Instead of calling `readlines()`, iterate 40 40 | for _line in bar.readlines(): 41 41 | pass -error[FURB129]: FURB129.py:48:17: [*] Instead of calling `readlines()`, iterate over file object directly +error[FURB129]: 48:17: [*] Instead of calling `readlines()`, iterate over file object directly + --> FURB129.py:48:17 | 47 | with builtins.open("FURB129.py") as f: 48 | for line in f.readlines(): @@ -223,8 +234,9 @@ error[FURB129]: FURB129.py:48:17: [*] Instead of calling `readlines()`, iterate 50 50 | 51 51 | -error[FURB129]: FURB129.py:56:17: [*] Instead of calling `readlines()`, iterate over file object directly +error[FURB129]: 56:17: [*] Instead of calling `readlines()`, iterate over file object directly + --> FURB129.py:56:17 | 55 | with o("FURB129.py") as f: 56 | for line in f.readlines(): diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB131_FURB131.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB131_FURB131.py.snap index 2d1f17c5f5..c9d1b4b0b1 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB131_FURB131.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB131_FURB131.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/refurb/mod.rs --- -error[FURB131]: FURB131.py:11:1: [*] Prefer `clear` over deleting a full slice +error[FURB131]: 11:1: [*] Prefer `clear` over deleting a full slice + --> FURB131.py:10:10 | 10 | # FURB131 11 | del nums[:] @@ -19,8 +20,9 @@ error[FURB131]: FURB131.py:11:1: [*] Prefer `clear` over deleting a full slice 13 13 | 14 14 | # FURB131 -error[FURB131]: FURB131.py:15:1: [*] Prefer `clear` over deleting a full slice +error[FURB131]: 15:1: [*] Prefer `clear` over deleting a full slice + --> FURB131.py:14:10 | 14 | # FURB131 15 | del names[:] @@ -37,24 +39,27 @@ error[FURB131]: FURB131.py:15:1: [*] Prefer `clear` over deleting a full slice 17 17 | 18 18 | # FURB131 -error[FURB131]: FURB131.py:19:1: Prefer `clear` over deleting a full slice +error[FURB131]: 19:1: Prefer `clear` over deleting a full slice + --> FURB131.py:18:10 | 18 | # FURB131 19 | del x, nums[:] | ^^^^^^^^^^^^^^ | = help: Replace with `clear()` -error[FURB131]: FURB131.py:23:1: Prefer `clear` over deleting a full slice +error[FURB131]: 23:1: Prefer `clear` over deleting a full slice + --> FURB131.py:22:10 | 22 | # FURB131 23 | del y, names[:], x | ^^^^^^^^^^^^^^^^^^ | = help: Replace with `clear()` -error[FURB131]: FURB131.py:28:5: [*] Prefer `clear` over deleting a full slice +error[FURB131]: 28:5: [*] Prefer `clear` over deleting a full slice + --> FURB131.py:28:5 | 26 | def yes_one(x: list[int]): 27 | # FURB131 @@ -72,8 +77,9 @@ error[FURB131]: FURB131.py:28:5: [*] Prefer `clear` over deleting a full slice 30 30 | 31 31 | def yes_two(x: dict[int, str]): -error[FURB131]: FURB131.py:33:5: [*] Prefer `clear` over deleting a full slice +error[FURB131]: 33:5: [*] Prefer `clear` over deleting a full slice + --> FURB131.py:33:5 | 31 | def yes_two(x: dict[int, str]): 32 | # FURB131 @@ -91,8 +97,9 @@ error[FURB131]: FURB131.py:33:5: [*] Prefer `clear` over deleting a full slice 35 35 | 36 36 | def yes_three(x: List[int]): -error[FURB131]: FURB131.py:38:5: [*] Prefer `clear` over deleting a full slice +error[FURB131]: 38:5: [*] Prefer `clear` over deleting a full slice + --> FURB131.py:38:5 | 36 | def yes_three(x: List[int]): 37 | # FURB131 @@ -110,8 +117,9 @@ error[FURB131]: FURB131.py:38:5: [*] Prefer `clear` over deleting a full slice 40 40 | 41 41 | def yes_four(x: Dict[int, str]): -error[FURB131]: FURB131.py:43:5: [*] Prefer `clear` over deleting a full slice +error[FURB131]: 43:5: [*] Prefer `clear` over deleting a full slice + --> FURB131.py:43:5 | 41 | def yes_four(x: Dict[int, str]): 42 | # FURB131 @@ -129,8 +137,9 @@ error[FURB131]: FURB131.py:43:5: [*] Prefer `clear` over deleting a full slice 45 45 | 46 46 | def yes_five(x: Dict[int, str]): -error[FURB131]: FURB131.py:48:5: [*] Prefer `clear` over deleting a full slice +error[FURB131]: 48:5: [*] Prefer `clear` over deleting a full slice + --> FURB131.py:48:5 | 46 | def yes_five(x: Dict[int, str]): 47 | # FURB131 @@ -150,8 +159,9 @@ error[FURB131]: FURB131.py:48:5: [*] Prefer `clear` over deleting a full slice 50 50 | x = 1 51 51 | -error[FURB131]: FURB131.py:58:1: [*] Prefer `clear` over deleting a full slice +error[FURB131]: 58:1: [*] Prefer `clear` over deleting a full slice + --> FURB131.py:57:10 | 56 | sneaky = SneakyList() 57 | # FURB131 diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB132_FURB132.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB132_FURB132.py.snap index f676c0b8e2..da1446db93 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB132_FURB132.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB132_FURB132.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/refurb/mod.rs --- -error[FURB132]: FURB132.py:12:1: [*] Use `s.discard("x")` instead of check and `remove` +error[FURB132]: 12:1: [*] Use `s.discard("x")` instead of check and `remove` + --> FURB132.py:11:10 | 11 | # FURB132 12 | / if "x" in s: @@ -21,8 +22,9 @@ error[FURB132]: FURB132.py:12:1: [*] Use `s.discard("x")` instead of check and ` 15 14 | 16 15 | # FURB132 -error[FURB132]: FURB132.py:22:1: [*] Use `s3.discard("x")` instead of check and `remove` +error[FURB132]: 22:1: [*] Use `s3.discard("x")` instead of check and `remove` + --> FURB132.py:21:10 | 21 | # FURB132 22 | / if "x" in s3: @@ -41,8 +43,9 @@ error[FURB132]: FURB132.py:22:1: [*] Use `s3.discard("x")` instead of check and 25 24 | 26 25 | var = "y" -error[FURB132]: FURB132.py:28:1: [*] Use `s.discard(var)` instead of check and `remove` +error[FURB132]: 28:1: [*] Use `s.discard(var)` instead of check and `remove` + --> FURB132.py:27:10 | 26 | var = "y" 27 | # FURB132 @@ -62,8 +65,9 @@ error[FURB132]: FURB132.py:28:1: [*] Use `s.discard(var)` instead of check and ` 31 30 | 32 31 | if f"{var}:{var}" in s: -error[FURB132]: FURB132.py:32:1: [*] Use `s.discard(f"{var}:{var}")` instead of check and `remove` +error[FURB132]: 32:1: [*] Use `s.discard(f"{var}:{var}")` instead of check and `remove` + --> FURB132.py:32:1 | 32 | / if f"{var}:{var}" in s: 33 | | s.remove(f"{var}:{var}") diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB136_FURB136.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB136_FURB136.py.snap index 7ce49188aa..f5b340b50e 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB136_FURB136.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB136_FURB136.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/refurb/mod.rs --- -error[FURB136]: FURB136.py:4:1: [*] Replace `x if x > y else y` with `max(y, x)` +error[FURB136]: 4:1: [*] Replace `x if x > y else y` with `max(y, x)` + --> FURB136.py:3:1 | 2 | y = 2 3 | @@ -22,8 +23,9 @@ error[FURB136]: FURB136.py:4:1: [*] Replace `x if x > y else y` with `max(y, x)` 6 6 | x if x >= y else y # FURB136 7 7 | -error[FURB136]: FURB136.py:6:1: [*] Replace `x if x >= y else y` with `max(x, y)` +error[FURB136]: 6:1: [*] Replace `x if x >= y else y` with `max(x, y)` + --> FURB136.py:5:1 | 4 | x if x > y else y # FURB136 5 | @@ -43,8 +45,9 @@ error[FURB136]: FURB136.py:6:1: [*] Replace `x if x >= y else y` with `max(x, y) 8 8 | x if x < y else y # FURB136 9 9 | -error[FURB136]: FURB136.py:8:1: [*] Replace `x if x < y else y` with `min(y, x)` +error[FURB136]: 8:1: [*] Replace `x if x < y else y` with `min(y, x)` + --> FURB136.py:7:1 | 6 | x if x >= y else y # FURB136 7 | @@ -64,8 +67,9 @@ error[FURB136]: FURB136.py:8:1: [*] Replace `x if x < y else y` with `min(y, x)` 10 10 | x if x <= y else y # FURB136 11 11 | -error[FURB136]: FURB136.py:10:1: [*] Replace `x if x <= y else y` with `min(x, y)` +error[FURB136]: 10:1: [*] Replace `x if x <= y else y` with `min(x, y)` + --> FURB136.py:9:1 | 8 | x if x < y else y # FURB136 9 | @@ -85,8 +89,9 @@ error[FURB136]: FURB136.py:10:1: [*] Replace `x if x <= y else y` with `min(x, y 12 12 | y if x > y else x # FURB136 13 13 | -error[FURB136]: FURB136.py:12:1: [*] Replace `y if x > y else x` with `min(x, y)` +error[FURB136]: 12:1: [*] Replace `y if x > y else x` with `min(x, y)` + --> FURB136.py:11:1 | 10 | x if x <= y else y # FURB136 11 | @@ -106,8 +111,9 @@ error[FURB136]: FURB136.py:12:1: [*] Replace `y if x > y else x` with `min(x, y) 14 14 | y if x >= y else x # FURB136 15 15 | -error[FURB136]: FURB136.py:14:1: [*] Replace `y if x >= y else x` with `min(y, x)` +error[FURB136]: 14:1: [*] Replace `y if x >= y else x` with `min(y, x)` + --> FURB136.py:13:1 | 12 | y if x > y else x # FURB136 13 | @@ -127,8 +133,9 @@ error[FURB136]: FURB136.py:14:1: [*] Replace `y if x >= y else x` with `min(y, x 16 16 | y if x < y else x # FURB136 17 17 | -error[FURB136]: FURB136.py:16:1: [*] Replace `y if x < y else x` with `max(x, y)` +error[FURB136]: 16:1: [*] Replace `y if x < y else x` with `max(x, y)` + --> FURB136.py:15:1 | 14 | y if x >= y else x # FURB136 15 | @@ -148,8 +155,9 @@ error[FURB136]: FURB136.py:16:1: [*] Replace `y if x < y else x` with `max(x, y) 18 18 | y if x <= y else x # FURB136 19 19 | -error[FURB136]: FURB136.py:18:1: [*] Replace `y if x <= y else x` with `max(y, x)` +error[FURB136]: 18:1: [*] Replace `y if x <= y else x` with `max(y, x)` + --> FURB136.py:17:1 | 16 | y if x < y else x # FURB136 17 | @@ -169,8 +177,9 @@ error[FURB136]: FURB136.py:18:1: [*] Replace `y if x <= y else x` with `max(y, x 20 20 | x + y if x > y else y # OK 21 21 | -error[FURB136]: FURB136.py:22:1: [*] Replace `if` expression with `max(y, x)` +error[FURB136]: 22:1: [*] Replace `if` expression with `max(y, x)` + --> FURB136.py:21:1 | 20 | x + y if x > y else y # OK 21 | diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB140_FURB140.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB140_FURB140.py.snap index e5aef940bd..062975b505 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB140_FURB140.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB140_FURB140.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/refurb/mod.rs --- -error[FURB140]: FURB140.py:7:1: [*] Use `itertools.starmap` instead of the generator +error[FURB140]: 7:1: [*] Use `itertools.starmap` instead of the generator + --> FURB140.py:6:10 | 6 | # FURB140 7 | [print(x, y) for x, y in zipped()] @@ -25,8 +26,9 @@ error[FURB140]: FURB140.py:7:1: [*] Use `itertools.starmap` instead of the gener 9 10 | # FURB140 10 11 | (print(x, y) for x, y in zipped()) -error[FURB140]: FURB140.py:10:1: [*] Use `itertools.starmap` instead of the generator +error[FURB140]: 10:1: [*] Use `itertools.starmap` instead of the generator + --> FURB140.py:9:10 | 9 | # FURB140 10 | (print(x, y) for x, y in zipped()) @@ -50,8 +52,9 @@ error[FURB140]: FURB140.py:10:1: [*] Use `itertools.starmap` instead of the gene 12 13 | # FURB140 13 14 | {print(x, y) for x, y in zipped()} -error[FURB140]: FURB140.py:13:1: [*] Use `itertools.starmap` instead of the generator +error[FURB140]: 13:1: [*] Use `itertools.starmap` instead of the generator + --> FURB140.py:12:10 | 12 | # FURB140 13 | {print(x, y) for x, y in zipped()} @@ -73,8 +76,9 @@ error[FURB140]: FURB140.py:13:1: [*] Use `itertools.starmap` instead of the gene 15 16 | 16 17 | from itertools import starmap as sm -error[FURB140]: FURB140.py:19:1: [*] Use `itertools.starmap` instead of the generator +error[FURB140]: 19:1: [*] Use `itertools.starmap` instead of the generator + --> FURB140.py:18:10 | 18 | # FURB140 19 | [print(x, y) for x, y in zipped()] @@ -93,8 +97,9 @@ error[FURB140]: FURB140.py:19:1: [*] Use `itertools.starmap` instead of the gene 21 21 | # FURB140 22 22 | (print(x, y) for x, y in zipped()) -error[FURB140]: FURB140.py:22:1: [*] Use `itertools.starmap` instead of the generator +error[FURB140]: 22:1: [*] Use `itertools.starmap` instead of the generator + --> FURB140.py:21:10 | 21 | # FURB140 22 | (print(x, y) for x, y in zipped()) @@ -113,8 +118,9 @@ error[FURB140]: FURB140.py:22:1: [*] Use `itertools.starmap` instead of the gene 24 24 | # FURB140 25 25 | {print(x, y) for x, y in zipped()} -error[FURB140]: FURB140.py:25:1: [*] Use `itertools.starmap` instead of the generator +error[FURB140]: 25:1: [*] Use `itertools.starmap` instead of the generator + --> FURB140.py:24:10 | 24 | # FURB140 25 | {print(x, y) for x, y in zipped()} @@ -133,8 +139,9 @@ error[FURB140]: FURB140.py:25:1: [*] Use `itertools.starmap` instead of the gene 27 27 | # FURB140 (check it still flags starred arguments). 28 28 | # See https://github.com/astral-sh/ruff/issues/7636 -error[FURB140]: FURB140.py:29:1: [*] Use `itertools.starmap` instead of the generator +error[FURB140]: 29:1: [*] Use `itertools.starmap` instead of the generator + --> FURB140.py:28:52 | 27 | # FURB140 (check it still flags starred arguments). 28 | # See https://github.com/astral-sh/ruff/issues/7636 @@ -154,8 +161,9 @@ error[FURB140]: FURB140.py:29:1: [*] Use `itertools.starmap` instead of the gene 31 31 | {foo(*t) for t in [(85, 60), (100, 80)]} 32 32 | -error[FURB140]: FURB140.py:30:1: [*] Use `itertools.starmap` instead of the generator +error[FURB140]: 30:1: [*] Use `itertools.starmap` instead of the generator + --> FURB140.py:29:41 | 28 | # See https://github.com/astral-sh/ruff/issues/7636 29 | [foo(*t) for t in [(85, 60), (100, 80)]] @@ -174,8 +182,9 @@ error[FURB140]: FURB140.py:30:1: [*] Use `itertools.starmap` instead of the gene 32 32 | 33 33 | # Non-errors. -error[FURB140]: FURB140.py:31:1: [*] Use `itertools.starmap` instead of the generator +error[FURB140]: 31:1: [*] Use `itertools.starmap` instead of the generator + --> FURB140.py:30:41 | 29 | [foo(*t) for t in [(85, 60), (100, 80)]] 30 | (foo(*t) for t in [(85, 60), (100, 80)]) diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB142_FURB142.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB142_FURB142.py.snap index 33286f5934..b7b2b703e4 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB142_FURB142.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB142_FURB142.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/refurb/mod.rs --- -error[FURB142]: FURB142.py:5:1: [*] Use of `set.add()` in a for loop +error[FURB142]: 5:1: [*] Use of `set.add()` in a for loop + --> FURB142.py:4:1 | 3 | s = set() 4 | @@ -24,8 +25,9 @@ error[FURB142]: FURB142.py:5:1: [*] Use of `set.add()` in a for loop 8 7 | for x in {1, 2, 3}: 9 8 | s.add(x) -error[FURB142]: FURB142.py:8:1: [*] Use of `set.add()` in a for loop +error[FURB142]: 8:1: [*] Use of `set.add()` in a for loop + --> FURB142.py:7:1 | 6 | s.add(x) 7 | @@ -47,8 +49,9 @@ error[FURB142]: FURB142.py:8:1: [*] Use of `set.add()` in a for loop 11 10 | for x in (1, 2, 3): 12 11 | s.add(x) -error[FURB142]: FURB142.py:11:1: [*] Use of `set.add()` in a for loop +error[FURB142]: 11:1: [*] Use of `set.add()` in a for loop + --> FURB142.py:10:1 | 9 | s.add(x) 10 | @@ -70,8 +73,9 @@ error[FURB142]: FURB142.py:11:1: [*] Use of `set.add()` in a for loop 14 13 | for x in (1, 2, 3): 15 14 | s.discard(x) -error[FURB142]: FURB142.py:14:1: [*] Use of `set.discard()` in a for loop +error[FURB142]: 14:1: [*] Use of `set.discard()` in a for loop + --> FURB142.py:13:1 | 12 | s.add(x) 13 | @@ -93,8 +97,9 @@ error[FURB142]: FURB142.py:14:1: [*] Use of `set.discard()` in a for loop 17 16 | for x in (1, 2, 3): 18 17 | s.add(x + 1) -error[FURB142]: FURB142.py:17:1: [*] Use of `set.add()` in a for loop +error[FURB142]: 17:1: [*] Use of `set.add()` in a for loop + --> FURB142.py:16:1 | 15 | s.discard(x) 16 | @@ -116,8 +121,9 @@ error[FURB142]: FURB142.py:17:1: [*] Use of `set.add()` in a for loop 20 19 | for x, y in ((1, 2), (3, 4)): 21 20 | s.add((x, y)) -error[FURB142]: FURB142.py:20:1: [*] Use of `set.add()` in a for loop +error[FURB142]: 20:1: [*] Use of `set.add()` in a for loop + --> FURB142.py:19:1 | 18 | s.add(x + 1) 19 | @@ -139,8 +145,9 @@ error[FURB142]: FURB142.py:20:1: [*] Use of `set.add()` in a for loop 23 22 | num = 123 24 23 | -error[FURB142]: FURB142.py:25:1: [*] Use of `set.add()` in a for loop +error[FURB142]: 25:1: [*] Use of `set.add()` in a for loop + --> FURB142.py:24:1 | 23 | num = 123 24 | @@ -162,8 +169,9 @@ error[FURB142]: FURB142.py:25:1: [*] Use of `set.add()` in a for loop 28 27 | for x in (1, 2, 3): 29 28 | s.add((num, x)) -error[FURB142]: FURB142.py:28:1: [*] Use of `set.add()` in a for loop +error[FURB142]: 28:1: [*] Use of `set.add()` in a for loop + --> FURB142.py:27:1 | 26 | s.add(num) 27 | @@ -185,8 +193,9 @@ error[FURB142]: FURB142.py:28:1: [*] Use of `set.add()` in a for loop 31 30 | for x in (1, 2, 3): 32 31 | s.add(x + num) -error[FURB142]: FURB142.py:31:1: [*] Use of `set.add()` in a for loop +error[FURB142]: 31:1: [*] Use of `set.add()` in a for loop + --> FURB142.py:30:1 | 29 | s.add((num, x)) 30 | diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB145_FURB145.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB145_FURB145.py.snap index 4a0e3ad25a..3d2a97d916 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB145_FURB145.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB145_FURB145.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/refurb/mod.rs --- -error[FURB145]: FURB145.py:4:5: [*] Prefer `copy` method over slicing +error[FURB145]: 4:5: [*] Prefer `copy` method over slicing + --> FURB145.py:4:5 | 3 | # Errors. 4 | a = l[:] @@ -21,8 +22,9 @@ error[FURB145]: FURB145.py:4:5: [*] Prefer `copy` method over slicing 6 6 | d, e = l[:], 1 7 7 | m = l[::] -error[FURB145]: FURB145.py:5:11: [*] Prefer `copy` method over slicing +error[FURB145]: 5:11: [*] Prefer `copy` method over slicing + --> FURB145.py:5:11 | 3 | # Errors. 4 | a = l[:] @@ -42,8 +44,9 @@ error[FURB145]: FURB145.py:5:11: [*] Prefer `copy` method over slicing 7 7 | m = l[::] 8 8 | l[:] -error[FURB145]: FURB145.py:6:8: [*] Prefer `copy` method over slicing +error[FURB145]: 6:8: [*] Prefer `copy` method over slicing + --> FURB145.py:6:8 | 4 | a = l[:] 5 | b, c = 1, l[:] @@ -63,8 +66,9 @@ error[FURB145]: FURB145.py:6:8: [*] Prefer `copy` method over slicing 8 8 | l[:] 9 9 | print(l[:]) -error[FURB145]: FURB145.py:7:5: [*] Prefer `copy` method over slicing +error[FURB145]: 7:5: [*] Prefer `copy` method over slicing + --> FURB145.py:7:5 | 5 | b, c = 1, l[:] 6 | d, e = l[:], 1 @@ -84,8 +88,9 @@ error[FURB145]: FURB145.py:7:5: [*] Prefer `copy` method over slicing 9 9 | print(l[:]) 10 10 | -error[FURB145]: FURB145.py:8:1: [*] Prefer `copy` method over slicing +error[FURB145]: 8:1: [*] Prefer `copy` method over slicing + --> FURB145.py:7:10 | 6 | d, e = l[:], 1 7 | m = l[::] @@ -104,8 +109,9 @@ error[FURB145]: FURB145.py:8:1: [*] Prefer `copy` method over slicing 10 10 | 11 11 | # False negatives. -error[FURB145]: FURB145.py:9:7: [*] Prefer `copy` method over slicing +error[FURB145]: 9:7: [*] Prefer `copy` method over slicing + --> FURB145.py:9:7 | 7 | m = l[::] 8 | l[:] diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB148_FURB148.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB148_FURB148.py.snap index a0937681ad..0ba2669a4b 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB148_FURB148.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB148_FURB148.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/refurb/mod.rs --- -error[FURB148]: FURB148.py:14:17: [*] `enumerate` value is unused, use `for x in range(len(y))` instead +error[FURB148]: 14:17: [*] `enumerate` value is unused, use `for x in range(len(y))` instead + --> FURB148.py:14:17 | 13 | # Errors 14 | for index, _ in enumerate(books): @@ -20,8 +21,9 @@ error[FURB148]: FURB148.py:14:17: [*] `enumerate` value is unused, use `for x in 16 16 | 17 17 | for index, _ in enumerate(books, start=0): -error[FURB148]: FURB148.py:17:17: [*] `enumerate` value is unused, use `for x in range(len(y))` instead +error[FURB148]: 17:17: [*] `enumerate` value is unused, use `for x in range(len(y))` instead + --> FURB148.py:17:17 | 15 | print(index) 16 | @@ -40,8 +42,9 @@ error[FURB148]: FURB148.py:17:17: [*] `enumerate` value is unused, use `for x in 19 19 | 20 20 | for index, _ in enumerate(books, 0): -error[FURB148]: FURB148.py:20:17: [*] `enumerate` value is unused, use `for x in range(len(y))` instead +error[FURB148]: 20:17: [*] `enumerate` value is unused, use `for x in range(len(y))` instead + --> FURB148.py:20:17 | 18 | print(index) 19 | @@ -60,8 +63,9 @@ error[FURB148]: FURB148.py:20:17: [*] `enumerate` value is unused, use `for x in 22 22 | 23 23 | for index, _ in enumerate(books, start=1): -error[FURB148]: FURB148.py:23:17: `enumerate` value is unused, use `for x in range(len(y))` instead +error[FURB148]: 23:17: `enumerate` value is unused, use `for x in range(len(y))` instead + --> FURB148.py:23:17 | 21 | print(index) 22 | @@ -70,8 +74,9 @@ error[FURB148]: FURB148.py:23:17: `enumerate` value is unused, use `for x in ran 24 | print(index) | = help: Replace with `range(len(...))` -error[FURB148]: FURB148.py:26:17: `enumerate` value is unused, use `for x in range(len(y))` instead +error[FURB148]: 26:17: `enumerate` value is unused, use `for x in range(len(y))` instead + --> FURB148.py:26:17 | 24 | print(index) 25 | @@ -80,8 +85,9 @@ error[FURB148]: FURB148.py:26:17: `enumerate` value is unused, use `for x in ran 27 | print(index) | = help: Replace with `range(len(...))` -error[FURB148]: FURB148.py:29:17: `enumerate` value is unused, use `for x in range(len(y))` instead +error[FURB148]: 29:17: `enumerate` value is unused, use `for x in range(len(y))` instead + --> FURB148.py:29:17 | 27 | print(index) 28 | @@ -90,8 +96,9 @@ error[FURB148]: FURB148.py:29:17: `enumerate` value is unused, use `for x in ran 30 | print(book) | = help: Replace with `range(len(...))` -error[FURB148]: FURB148.py:32:17: `enumerate` value is unused, use `for x in range(len(y))` instead +error[FURB148]: 32:17: `enumerate` value is unused, use `for x in range(len(y))` instead + --> FURB148.py:32:17 | 30 | print(book) 31 | @@ -100,8 +107,9 @@ error[FURB148]: FURB148.py:32:17: `enumerate` value is unused, use `for x in ran 33 | print(book) | = help: Replace with `range(len(...))` -error[FURB148]: FURB148.py:35:16: [*] `enumerate` index is unused, use `for x in y` instead +error[FURB148]: 35:16: [*] `enumerate` index is unused, use `for x in y` instead + --> FURB148.py:35:16 | 33 | print(book) 34 | @@ -120,8 +128,9 @@ error[FURB148]: FURB148.py:35:16: [*] `enumerate` index is unused, use `for x in 37 37 | 38 38 | for _, book in enumerate(books, start=0): -error[FURB148]: FURB148.py:38:16: [*] `enumerate` index is unused, use `for x in y` instead +error[FURB148]: 38:16: [*] `enumerate` index is unused, use `for x in y` instead + --> FURB148.py:38:16 | 36 | print(book) 37 | @@ -140,8 +149,9 @@ error[FURB148]: FURB148.py:38:16: [*] `enumerate` index is unused, use `for x in 40 40 | 41 41 | for _, book in enumerate(books, 0): -error[FURB148]: FURB148.py:41:16: [*] `enumerate` index is unused, use `for x in y` instead +error[FURB148]: 41:16: [*] `enumerate` index is unused, use `for x in y` instead + --> FURB148.py:41:16 | 39 | print(book) 40 | @@ -160,8 +170,9 @@ error[FURB148]: FURB148.py:41:16: [*] `enumerate` index is unused, use `for x in 43 43 | 44 44 | for _, book in enumerate(books, start=1): -error[FURB148]: FURB148.py:44:16: [*] `enumerate` index is unused, use `for x in y` instead +error[FURB148]: 44:16: [*] `enumerate` index is unused, use `for x in y` instead + --> FURB148.py:44:16 | 42 | print(book) 43 | @@ -180,8 +191,9 @@ error[FURB148]: FURB148.py:44:16: [*] `enumerate` index is unused, use `for x in 46 46 | 47 47 | for _, book in enumerate(books, 1): -error[FURB148]: FURB148.py:47:16: [*] `enumerate` index is unused, use `for x in y` instead +error[FURB148]: 47:16: [*] `enumerate` index is unused, use `for x in y` instead + --> FURB148.py:47:16 | 45 | print(book) 46 | @@ -200,8 +212,9 @@ error[FURB148]: FURB148.py:47:16: [*] `enumerate` index is unused, use `for x in 49 49 | 50 50 | for _, book in enumerate(books, start=x): -error[FURB148]: FURB148.py:50:16: [*] `enumerate` index is unused, use `for x in y` instead +error[FURB148]: 50:16: [*] `enumerate` index is unused, use `for x in y` instead + --> FURB148.py:50:16 | 48 | print(book) 49 | @@ -220,8 +233,9 @@ error[FURB148]: FURB148.py:50:16: [*] `enumerate` index is unused, use `for x in 52 52 | 53 53 | for _, book in enumerate(books, x): -error[FURB148]: FURB148.py:53:16: [*] `enumerate` index is unused, use `for x in y` instead +error[FURB148]: 53:16: [*] `enumerate` index is unused, use `for x in y` instead + --> FURB148.py:53:16 | 51 | print(book) 52 | @@ -240,8 +254,9 @@ error[FURB148]: FURB148.py:53:16: [*] `enumerate` index is unused, use `for x in 55 55 | 56 56 | for index, (_, _) in enumerate(books): -error[FURB148]: FURB148.py:56:22: [*] `enumerate` value is unused, use `for x in range(len(y))` instead +error[FURB148]: 56:22: [*] `enumerate` value is unused, use `for x in range(len(y))` instead + --> FURB148.py:56:22 | 54 | print(book) 55 | @@ -260,8 +275,9 @@ error[FURB148]: FURB148.py:56:22: [*] `enumerate` value is unused, use `for x in 58 58 | 59 59 | for (_, _), book in enumerate(books): -error[FURB148]: FURB148.py:59:21: [*] `enumerate` index is unused, use `for x in y` instead +error[FURB148]: 59:21: [*] `enumerate` index is unused, use `for x in y` instead + --> FURB148.py:59:21 | 57 | print(index) 58 | @@ -280,8 +296,9 @@ error[FURB148]: FURB148.py:59:21: [*] `enumerate` index is unused, use `for x in 61 61 | 62 62 | for(index, _)in enumerate(books): -error[FURB148]: FURB148.py:62:17: [*] `enumerate` value is unused, use `for x in range(len(y))` instead +error[FURB148]: 62:17: [*] `enumerate` value is unused, use `for x in range(len(y))` instead + --> FURB148.py:62:17 | 60 | print(book) 61 | @@ -300,8 +317,9 @@ error[FURB148]: FURB148.py:62:17: [*] `enumerate` value is unused, use `for x in 64 64 | 65 65 | for(index), _ in enumerate(books): -error[FURB148]: FURB148.py:65:18: [*] `enumerate` value is unused, use `for x in range(len(y))` instead +error[FURB148]: 65:18: [*] `enumerate` value is unused, use `for x in range(len(y))` instead + --> FURB148.py:65:18 | 63 | print(index) 64 | @@ -320,8 +338,9 @@ error[FURB148]: FURB148.py:65:18: [*] `enumerate` value is unused, use `for x in 67 67 | 68 68 | for index, _ in enumerate(books_and_authors): -error[FURB148]: FURB148.py:68:17: [*] `enumerate` value is unused, use `for x in range(len(y))` instead +error[FURB148]: 68:17: [*] `enumerate` value is unused, use `for x in range(len(y))` instead + --> FURB148.py:68:17 | 66 | print(index) 67 | @@ -340,8 +359,9 @@ error[FURB148]: FURB148.py:68:17: [*] `enumerate` value is unused, use `for x in 70 70 | 71 71 | for _, book in enumerate(books_and_authors): -error[FURB148]: FURB148.py:71:16: [*] `enumerate` index is unused, use `for x in y` instead +error[FURB148]: 71:16: [*] `enumerate` index is unused, use `for x in y` instead + --> FURB148.py:71:16 | 69 | print(index) 70 | @@ -360,8 +380,9 @@ error[FURB148]: FURB148.py:71:16: [*] `enumerate` index is unused, use `for x in 73 73 | 74 74 | for index, _ in enumerate(books_set): -error[FURB148]: FURB148.py:74:17: [*] `enumerate` value is unused, use `for x in range(len(y))` instead +error[FURB148]: 74:17: [*] `enumerate` value is unused, use `for x in range(len(y))` instead + --> FURB148.py:74:17 | 72 | print(book) 73 | @@ -380,8 +401,9 @@ error[FURB148]: FURB148.py:74:17: [*] `enumerate` value is unused, use `for x in 76 76 | 77 77 | for _, book in enumerate(books_set): -error[FURB148]: FURB148.py:77:16: [*] `enumerate` index is unused, use `for x in y` instead +error[FURB148]: 77:16: [*] `enumerate` index is unused, use `for x in y` instead + --> FURB148.py:77:16 | 75 | print(index) 76 | @@ -400,8 +422,9 @@ error[FURB148]: FURB148.py:77:16: [*] `enumerate` index is unused, use `for x in 79 79 | 80 80 | for index, _ in enumerate(books_tuple): -error[FURB148]: FURB148.py:80:17: [*] `enumerate` value is unused, use `for x in range(len(y))` instead +error[FURB148]: 80:17: [*] `enumerate` value is unused, use `for x in range(len(y))` instead + --> FURB148.py:80:17 | 78 | print(book) 79 | @@ -420,8 +443,9 @@ error[FURB148]: FURB148.py:80:17: [*] `enumerate` value is unused, use `for x in 82 82 | 83 83 | for _, book in enumerate(books_tuple): -error[FURB148]: FURB148.py:83:16: [*] `enumerate` index is unused, use `for x in y` instead +error[FURB148]: 83:16: [*] `enumerate` index is unused, use `for x in y` instead + --> FURB148.py:83:16 | 81 | print(index) 82 | diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB152_FURB152.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB152_FURB152.py.snap index 8e8087583f..d8fd43e7a1 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB152_FURB152.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB152_FURB152.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/refurb/mod.rs --- -error[FURB152]: FURB152.py:3:5: [*] Replace `3.14` with `math.pi` +error[FURB152]: 3:5: [*] Replace `3.14` with `math.pi` + --> FURB152.py:3:5 | 1 | r = 3.1 # OK 2 | @@ -22,8 +23,9 @@ error[FURB152]: FURB152.py:3:5: [*] Replace `3.14` with `math.pi` 5 6 | C = 6.28 * r # FURB152 6 7 | -error[FURB152]: FURB152.py:5:5: [*] Replace `6.28` with `math.tau` +error[FURB152]: 5:5: [*] Replace `6.28` with `math.tau` + --> FURB152.py:5:5 | 3 | A = 3.14 * r ** 2 # FURB152 4 | @@ -45,8 +47,9 @@ error[FURB152]: FURB152.py:5:5: [*] Replace `6.28` with `math.tau` 7 8 | e = 2.71 # FURB152 8 9 | -error[FURB152]: FURB152.py:7:5: [*] Replace `2.71` with `math.e` +error[FURB152]: 7:5: [*] Replace `2.71` with `math.e` + --> FURB152.py:7:5 | 5 | C = 6.28 * r # FURB152 6 | @@ -70,8 +73,9 @@ error[FURB152]: FURB152.py:7:5: [*] Replace `2.71` with `math.e` 9 10 | r = 3.15 # OK 10 11 | -error[FURB152]: FURB152.py:11:5: [*] Replace `3.141` with `math.pi` +error[FURB152]: 11:5: [*] Replace `3.141` with `math.pi` + --> FURB152.py:11:5 | 9 | r = 3.15 # OK 10 | @@ -96,8 +100,9 @@ error[FURB152]: FURB152.py:11:5: [*] Replace `3.141` with `math.pi` 13 14 | r = 3.142 # FURB152 14 15 | -error[FURB152]: FURB152.py:13:5: [*] Replace `3.142` with `math.pi` +error[FURB152]: 13:5: [*] Replace `3.142` with `math.pi` + --> FURB152.py:13:5 | 11 | r = 3.141 # FURB152 12 | @@ -122,8 +127,9 @@ error[FURB152]: FURB152.py:13:5: [*] Replace `3.142` with `math.pi` 15 16 | r = 3.1415 # FURB152 16 17 | -error[FURB152]: FURB152.py:15:5: [*] Replace `3.1415` with `math.pi` +error[FURB152]: 15:5: [*] Replace `3.1415` with `math.pi` + --> FURB152.py:15:5 | 13 | r = 3.142 # FURB152 14 | @@ -148,8 +154,9 @@ error[FURB152]: FURB152.py:15:5: [*] Replace `3.1415` with `math.pi` 17 18 | r = 3.1416 # FURB152 18 19 | -error[FURB152]: FURB152.py:17:5: [*] Replace `3.1416` with `math.pi` +error[FURB152]: 17:5: [*] Replace `3.1416` with `math.pi` + --> FURB152.py:17:5 | 15 | r = 3.1415 # FURB152 16 | @@ -174,8 +181,9 @@ error[FURB152]: FURB152.py:17:5: [*] Replace `3.1416` with `math.pi` 19 20 | r = 3.141592 # FURB152 20 21 | -error[FURB152]: FURB152.py:19:5: [*] Replace `3.141592` with `math.pi` +error[FURB152]: 19:5: [*] Replace `3.141592` with `math.pi` + --> FURB152.py:19:5 | 17 | r = 3.1416 # FURB152 18 | @@ -200,8 +208,9 @@ error[FURB152]: FURB152.py:19:5: [*] Replace `3.141592` with `math.pi` 21 22 | r = 3.141593 # FURB152 22 23 | -error[FURB152]: FURB152.py:21:5: [*] Replace `3.141593` with `math.pi` +error[FURB152]: 21:5: [*] Replace `3.141593` with `math.pi` + --> FURB152.py:21:5 | 19 | r = 3.141592 # FURB152 20 | @@ -226,8 +235,9 @@ error[FURB152]: FURB152.py:21:5: [*] Replace `3.141593` with `math.pi` 23 24 | r = 3.14159265 # FURB152 24 25 | -error[FURB152]: FURB152.py:23:5: [*] Replace `3.14159265` with `math.pi` +error[FURB152]: 23:5: [*] Replace `3.14159265` with `math.pi` + --> FURB152.py:23:5 | 21 | r = 3.141593 # FURB152 22 | @@ -252,8 +262,9 @@ error[FURB152]: FURB152.py:23:5: [*] Replace `3.14159265` with `math.pi` 25 26 | r = 3.141592653589793238462643383279 # FURB152 26 27 | -error[FURB152]: FURB152.py:25:5: [*] Replace `3.141592653589793238462643383279` with `math.pi` +error[FURB152]: 25:5: [*] Replace `3.141592653589793238462643383279` with `math.pi` + --> FURB152.py:25:5 | 23 | r = 3.14159265 # FURB152 24 | @@ -278,8 +289,9 @@ error[FURB152]: FURB152.py:25:5: [*] Replace `3.141592653589793238462643383279` 27 28 | r = 3.14159266 # OK 28 29 | -error[FURB152]: FURB152.py:31:5: [*] Replace `2.718` with `math.e` +error[FURB152]: 31:5: [*] Replace `2.718` with `math.e` + --> FURB152.py:31:5 | 29 | e = 2.7 # OK 30 | @@ -304,8 +316,9 @@ error[FURB152]: FURB152.py:31:5: [*] Replace `2.718` with `math.e` 33 34 | e = 2.7182 # FURB152 34 35 | -error[FURB152]: FURB152.py:33:5: [*] Replace `2.7182` with `math.e` +error[FURB152]: 33:5: [*] Replace `2.7182` with `math.e` + --> FURB152.py:33:5 | 31 | e = 2.718 # FURB152 32 | @@ -330,8 +343,9 @@ error[FURB152]: FURB152.py:33:5: [*] Replace `2.7182` with `math.e` 35 36 | e = 2.7183 # FURB152 36 37 | -error[FURB152]: FURB152.py:35:5: [*] Replace `2.7183` with `math.e` +error[FURB152]: 35:5: [*] Replace `2.7183` with `math.e` + --> FURB152.py:35:5 | 33 | e = 2.7182 # FURB152 34 | @@ -356,8 +370,9 @@ error[FURB152]: FURB152.py:35:5: [*] Replace `2.7183` with `math.e` 37 38 | e = 2.719 # OK 38 39 | -error[FURB152]: FURB152.py:45:5: [*] Replace `2.7182000000000001` with `math.e` +error[FURB152]: 45:5: [*] Replace `2.7182000000000001` with `math.e` + --> FURB152.py:45:5 | 43 | e = 2.718200000000001 # OK 44 | diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB154_FURB154.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB154_FURB154.py.snap index a935e1ae3c..c8efe2b2a4 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB154_FURB154.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB154_FURB154.py.snap @@ -1,16 +1,17 @@ --- source: crates/ruff_linter/src/rules/refurb/mod.rs --- -FURB154.py:4:5: FURB154 [*] Use of repeated consecutive `global` +error[FURB154]: 4:5: [*] Use of repeated consecutive `global` + + --> FURB154.py:4:5 | 3 | def f1(): 4 | global x | _____^ 5 | | global y - | |____________^ FURB154 + | |____________^ | = help: Merge `global` statements - ℹ Safe fix 1 1 | # Errors 2 2 | @@ -22,17 +23,18 @@ FURB154.py:4:5: FURB154 [*] Use of repeated consecutive `global` 7 6 | 8 7 | def f3(): -FURB154.py:9:5: FURB154 [*] Use of repeated consecutive `global` +error[FURB154]: 9:5: [*] Use of repeated consecutive `global` + + --> FURB154.py:9:5 | 8 | def f3(): 9 | global x | _____^ 10 | | global y 11 | | global z - | |____________^ FURB154 + | |____________^ | = help: Merge `global` statements - ℹ Safe fix 6 6 | 7 7 | @@ -45,18 +47,19 @@ FURB154.py:9:5: FURB154 [*] Use of repeated consecutive `global` 13 11 | 14 12 | def f4(): -FURB154.py:15:5: FURB154 [*] Use of repeated consecutive `global` +error[FURB154]: 15:5: [*] Use of repeated consecutive `global` + + --> FURB154.py:15:5 | 14 | def f4(): 15 | global x | _____^ 16 | | global y - | |____________^ FURB154 + | |____________^ 17 | pass 18 | global x | = help: Merge `global` statements - ℹ Safe fix 12 12 | 13 13 | @@ -68,17 +71,18 @@ FURB154.py:15:5: FURB154 [*] Use of repeated consecutive `global` 18 17 | global x 19 18 | global y -FURB154.py:18:5: FURB154 [*] Use of repeated consecutive `global` +error[FURB154]: 18:5: [*] Use of repeated consecutive `global` + + --> FURB154.py:18:5 | 16 | global y 17 | pass 18 | global x | _____^ 19 | | global y - | |____________^ FURB154 + | |____________^ | = help: Merge `global` statements - ℹ Safe fix 15 15 | global x 16 16 | global y @@ -90,18 +94,19 @@ FURB154.py:18:5: FURB154 [*] Use of repeated consecutive `global` 21 20 | 22 21 | def f2(): -FURB154.py:26:9: FURB154 [*] Use of repeated consecutive `nonlocal` +error[FURB154]: 26:9: [*] Use of repeated consecutive `nonlocal` + + --> FURB154.py:26:9 | 25 | def inner(): 26 | nonlocal x | _________^ 27 | | nonlocal y - | |__________________^ FURB154 + | |__________________^ 28 | 29 | def inner2(): | = help: Merge `nonlocal` statements - ℹ Safe fix 23 23 | x = y = z = 1 24 24 | @@ -113,19 +118,20 @@ FURB154.py:26:9: FURB154 [*] Use of repeated consecutive `nonlocal` 29 28 | def inner2(): 30 29 | nonlocal x -FURB154.py:30:9: FURB154 [*] Use of repeated consecutive `nonlocal` +error[FURB154]: 30:9: [*] Use of repeated consecutive `nonlocal` + + --> FURB154.py:30:9 | 29 | def inner2(): 30 | nonlocal x | _________^ 31 | | nonlocal y 32 | | nonlocal z - | |__________________^ FURB154 + | |__________________^ 33 | 34 | def inner3(): | = help: Merge `nonlocal` statements - ℹ Safe fix 27 27 | nonlocal y 28 28 | @@ -138,18 +144,19 @@ FURB154.py:30:9: FURB154 [*] Use of repeated consecutive `nonlocal` 34 32 | def inner3(): 35 33 | nonlocal x -FURB154.py:35:9: FURB154 [*] Use of repeated consecutive `nonlocal` +error[FURB154]: 35:9: [*] Use of repeated consecutive `nonlocal` + + --> FURB154.py:35:9 | 34 | def inner3(): 35 | nonlocal x | _________^ 36 | | nonlocal y - | |__________________^ FURB154 + | |__________________^ 37 | pass 38 | nonlocal x | = help: Merge `nonlocal` statements - ℹ Safe fix 32 32 | nonlocal z 33 33 | @@ -161,17 +168,18 @@ FURB154.py:35:9: FURB154 [*] Use of repeated consecutive `nonlocal` 38 37 | nonlocal x 39 38 | nonlocal y -FURB154.py:38:9: FURB154 [*] Use of repeated consecutive `nonlocal` +error[FURB154]: 38:9: [*] Use of repeated consecutive `nonlocal` + + --> FURB154.py:38:9 | 36 | nonlocal y 37 | pass 38 | nonlocal x | _________^ 39 | | nonlocal y - | |__________________^ FURB154 + | |__________________^ | = help: Merge `nonlocal` statements - ℹ Safe fix 35 35 | nonlocal x 36 36 | nonlocal y @@ -183,18 +191,19 @@ FURB154.py:38:9: FURB154 [*] Use of repeated consecutive `nonlocal` 41 40 | 42 41 | def f5(): -FURB154.py:46:9: FURB154 [*] Use of repeated consecutive `global` +error[FURB154]: 46:9: [*] Use of repeated consecutive `global` + + --> FURB154.py:46:9 | 45 | def inner(): 46 | global w | _________^ 47 | | global x - | |________________^ FURB154 + | |________________^ 48 | nonlocal y 49 | nonlocal z | = help: Merge `global` statements - ℹ Safe fix 43 43 | w = x = y = z = 1 44 44 | @@ -206,19 +215,20 @@ FURB154.py:46:9: FURB154 [*] Use of repeated consecutive `global` 49 48 | nonlocal z 50 49 | -FURB154.py:48:9: FURB154 [*] Use of repeated consecutive `nonlocal` +error[FURB154]: 48:9: [*] Use of repeated consecutive `nonlocal` + + --> FURB154.py:48:9 | 46 | global w 47 | global x 48 | nonlocal y | _________^ 49 | | nonlocal z - | |__________________^ FURB154 + | |__________________^ 50 | 51 | def inner2(): | = help: Merge `nonlocal` statements - ℹ Safe fix 45 45 | def inner(): 46 46 | global w @@ -230,17 +240,18 @@ FURB154.py:48:9: FURB154 [*] Use of repeated consecutive `nonlocal` 51 50 | def inner2(): 52 51 | global x -FURB154.py:53:9: FURB154 [*] Use of repeated consecutive `nonlocal` +error[FURB154]: 53:9: [*] Use of repeated consecutive `nonlocal` + + --> FURB154.py:53:9 | 51 | def inner2(): 52 | global x 53 | nonlocal y | _________^ 54 | | nonlocal z - | |__________________^ FURB154 + | |__________________^ | = help: Merge `nonlocal` statements - ℹ Safe fix 50 50 | 51 51 | def inner2(): @@ -252,17 +263,18 @@ FURB154.py:53:9: FURB154 [*] Use of repeated consecutive `nonlocal` 56 55 | 57 56 | def f6(): -FURB154.py:58:5: FURB154 [*] Use of repeated consecutive `global` +error[FURB154]: 58:5: [*] Use of repeated consecutive `global` + + --> FURB154.py:58:5 | 57 | def f6(): 58 | global x, y, z | _____^ 59 | | global a, b, c 60 | | global d, e, f - | |__________________^ FURB154 + | |__________________^ | = help: Merge `global` statements - ℹ Safe fix 55 55 | 56 56 | diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB157_FURB157.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB157_FURB157.py.snap index aacd568726..89763a572f 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB157_FURB157.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB157_FURB157.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/refurb/mod.rs --- -error[FURB157]: FURB157.py:5:9: [*] Verbose expression in `Decimal` constructor +error[FURB157]: 5:9: [*] Verbose expression in `Decimal` constructor + --> FURB157.py:5:9 | 4 | # Errors 5 | Decimal("0") @@ -21,8 +22,9 @@ error[FURB157]: FURB157.py:5:9: [*] Verbose expression in `Decimal` constructor 7 7 | Decimal(float("Infinity")) 8 8 | Decimal(float("-Infinity")) -error[FURB157]: FURB157.py:6:9: [*] Verbose expression in `Decimal` constructor +error[FURB157]: 6:9: [*] Verbose expression in `Decimal` constructor + --> FURB157.py:6:9 | 4 | # Errors 5 | Decimal("0") @@ -42,8 +44,9 @@ error[FURB157]: FURB157.py:6:9: [*] Verbose expression in `Decimal` constructor 8 8 | Decimal(float("-Infinity")) 9 9 | Decimal(float("inf")) -error[FURB157]: FURB157.py:7:9: [*] Verbose expression in `Decimal` constructor +error[FURB157]: 7:9: [*] Verbose expression in `Decimal` constructor + --> FURB157.py:7:9 | 5 | Decimal("0") 6 | Decimal("-42") @@ -63,8 +66,9 @@ error[FURB157]: FURB157.py:7:9: [*] Verbose expression in `Decimal` constructor 9 9 | Decimal(float("inf")) 10 10 | Decimal(float("-inf")) -error[FURB157]: FURB157.py:8:9: [*] Verbose expression in `Decimal` constructor +error[FURB157]: 8:9: [*] Verbose expression in `Decimal` constructor + --> FURB157.py:8:9 | 6 | Decimal("-42") 7 | Decimal(float("Infinity")) @@ -84,8 +88,9 @@ error[FURB157]: FURB157.py:8:9: [*] Verbose expression in `Decimal` constructor 10 10 | Decimal(float("-inf")) 11 11 | Decimal(float("nan")) -error[FURB157]: FURB157.py:9:9: [*] Verbose expression in `Decimal` constructor +error[FURB157]: 9:9: [*] Verbose expression in `Decimal` constructor + --> FURB157.py:9:9 | 7 | Decimal(float("Infinity")) 8 | Decimal(float("-Infinity")) @@ -105,8 +110,9 @@ error[FURB157]: FURB157.py:9:9: [*] Verbose expression in `Decimal` constructor 11 11 | Decimal(float("nan")) 12 12 | decimal.Decimal("0") -error[FURB157]: FURB157.py:10:9: [*] Verbose expression in `Decimal` constructor +error[FURB157]: 10:9: [*] Verbose expression in `Decimal` constructor + --> FURB157.py:10:9 | 8 | Decimal(float("-Infinity")) 9 | Decimal(float("inf")) @@ -126,8 +132,9 @@ error[FURB157]: FURB157.py:10:9: [*] Verbose expression in `Decimal` constructor 12 12 | decimal.Decimal("0") 13 13 | -error[FURB157]: FURB157.py:11:9: [*] Verbose expression in `Decimal` constructor +error[FURB157]: 11:9: [*] Verbose expression in `Decimal` constructor + --> FURB157.py:11:9 | 9 | Decimal(float("inf")) 10 | Decimal(float("-inf")) @@ -146,8 +153,9 @@ error[FURB157]: FURB157.py:11:9: [*] Verbose expression in `Decimal` constructor 13 13 | 14 14 | # OK -error[FURB157]: FURB157.py:12:17: [*] Verbose expression in `Decimal` constructor +error[FURB157]: 12:17: [*] Verbose expression in `Decimal` constructor + --> FURB157.py:12:17 | 10 | Decimal(float("-inf")) 11 | Decimal(float("nan")) diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB161_FURB161.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB161_FURB161.py.snap index 7465e4b65b..25f7e72b5a 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB161_FURB161.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB161_FURB161.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/refurb/mod.rs --- -error[FURB161]: FURB161.py:6:9: [*] Use of `bin(x).count('1')` +error[FURB161]: 6:9: [*] Use of `bin(x).count('1')` + --> FURB161.py:6:9 | 4 | return 10 5 | @@ -22,8 +23,9 @@ error[FURB161]: FURB161.py:6:9: [*] Use of `bin(x).count('1')` 8 8 | count = bin(0b1010).count("1") # FURB161 9 9 | count = bin(0xA).count("1") # FURB161 -error[FURB161]: FURB161.py:7:9: [*] Use of `bin(10).count('1')` +error[FURB161]: 7:9: [*] Use of `bin(10).count('1')` + --> FURB161.py:7:9 | 6 | count = bin(x).count("1") # FURB161 7 | count = bin(10).count("1") # FURB161 @@ -42,8 +44,9 @@ error[FURB161]: FURB161.py:7:9: [*] Use of `bin(10).count('1')` 9 9 | count = bin(0xA).count("1") # FURB161 10 10 | count = bin(0o12).count("1") # FURB161 -error[FURB161]: FURB161.py:8:9: [*] Use of `bin(0b1010).count('1')` +error[FURB161]: 8:9: [*] Use of `bin(0b1010).count('1')` + --> FURB161.py:8:9 | 6 | count = bin(x).count("1") # FURB161 7 | count = bin(10).count("1") # FURB161 @@ -63,8 +66,9 @@ error[FURB161]: FURB161.py:8:9: [*] Use of `bin(0b1010).count('1')` 10 10 | count = bin(0o12).count("1") # FURB161 11 11 | count = bin(0x10 + 0x1000).count("1") # FURB161 -error[FURB161]: FURB161.py:9:9: [*] Use of `bin(0xA).count('1')` +error[FURB161]: 9:9: [*] Use of `bin(0xA).count('1')` + --> FURB161.py:9:9 | 7 | count = bin(10).count("1") # FURB161 8 | count = bin(0b1010).count("1") # FURB161 @@ -84,8 +88,9 @@ error[FURB161]: FURB161.py:9:9: [*] Use of `bin(0xA).count('1')` 11 11 | count = bin(0x10 + 0x1000).count("1") # FURB161 12 12 | count = bin(ten()).count("1") # FURB161 -error[FURB161]: FURB161.py:10:9: [*] Use of `bin(0o12).count('1')` +error[FURB161]: 10:9: [*] Use of `bin(0o12).count('1')` + --> FURB161.py:10:9 | 8 | count = bin(0b1010).count("1") # FURB161 9 | count = bin(0xA).count("1") # FURB161 @@ -105,8 +110,9 @@ error[FURB161]: FURB161.py:10:9: [*] Use of `bin(0o12).count('1')` 12 12 | count = bin(ten()).count("1") # FURB161 13 13 | count = bin((10)).count("1") # FURB161 -error[FURB161]: FURB161.py:11:9: [*] Use of `bin(0x10 + 0x1000).count('1')` +error[FURB161]: 11:9: [*] Use of `bin(0x10 + 0x1000).count('1')` + --> FURB161.py:11:9 | 9 | count = bin(0xA).count("1") # FURB161 10 | count = bin(0o12).count("1") # FURB161 @@ -126,8 +132,9 @@ error[FURB161]: FURB161.py:11:9: [*] Use of `bin(0x10 + 0x1000).count('1')` 13 13 | count = bin((10)).count("1") # FURB161 14 14 | count = bin("10" "15").count("1") # FURB161 -error[FURB161]: FURB161.py:12:9: [*] Use of `bin(ten()).count('1')` +error[FURB161]: 12:9: [*] Use of `bin(ten()).count('1')` + --> FURB161.py:12:9 | 10 | count = bin(0o12).count("1") # FURB161 11 | count = bin(0x10 + 0x1000).count("1") # FURB161 @@ -147,8 +154,9 @@ error[FURB161]: FURB161.py:12:9: [*] Use of `bin(ten()).count('1')` 14 14 | count = bin("10" "15").count("1") # FURB161 15 15 | -error[FURB161]: FURB161.py:13:9: [*] Use of `bin(10).count('1')` +error[FURB161]: 13:9: [*] Use of `bin(10).count('1')` + --> FURB161.py:13:9 | 11 | count = bin(0x10 + 0x1000).count("1") # FURB161 12 | count = bin(ten()).count("1") # FURB161 @@ -167,8 +175,9 @@ error[FURB161]: FURB161.py:13:9: [*] Use of `bin(10).count('1')` 15 15 | 16 16 | count = x.bit_count() # OK -error[FURB161]: FURB161.py:14:9: [*] Use of `bin("10" "15").count('1')` +error[FURB161]: 14:9: [*] Use of `bin("10" "15").count('1')` + --> FURB161.py:14:9 | 12 | count = bin(ten()).count("1") # FURB161 13 | count = bin((10)).count("1") # FURB161 diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB163_FURB163.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB163_FURB163.py.snap index a452b427ce..68bc655594 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB163_FURB163.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB163_FURB163.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/refurb/mod.rs --- -error[FURB163]: FURB163.py:4:1: [*] Prefer `math.log2(1)` over `math.log` with a redundant base +error[FURB163]: 4:1: [*] Prefer `math.log2(1)` over `math.log` with a redundant base + --> FURB163.py:3:9 | 3 | # Errors 4 | math.log(1, 2) @@ -21,8 +22,9 @@ error[FURB163]: FURB163.py:4:1: [*] Prefer `math.log2(1)` over `math.log` with a 6 6 | math.log(1, math.e) 7 7 | foo = ... -error[FURB163]: FURB163.py:5:1: [*] Prefer `math.log10(1)` over `math.log` with a redundant base +error[FURB163]: 5:1: [*] Prefer `math.log10(1)` over `math.log` with a redundant base + --> FURB163.py:4:15 | 3 | # Errors 4 | math.log(1, 2) @@ -42,8 +44,9 @@ error[FURB163]: FURB163.py:5:1: [*] Prefer `math.log10(1)` over `math.log` with 7 7 | foo = ... 8 8 | math.log(foo, 2) -error[FURB163]: FURB163.py:6:1: [*] Prefer `math.log(1)` over `math.log` with a redundant base +error[FURB163]: 6:1: [*] Prefer `math.log(1)` over `math.log` with a redundant base + --> FURB163.py:5:16 | 4 | math.log(1, 2) 5 | math.log(1, 10) @@ -63,8 +66,9 @@ error[FURB163]: FURB163.py:6:1: [*] Prefer `math.log(1)` over `math.log` with a 8 8 | math.log(foo, 2) 9 9 | math.log(foo, 10) -error[FURB163]: FURB163.py:8:1: [*] Prefer `math.log2(foo)` over `math.log` with a redundant base +error[FURB163]: 8:1: [*] Prefer `math.log2(foo)` over `math.log` with a redundant base + --> FURB163.py:7:10 | 6 | math.log(1, math.e) 7 | foo = ... @@ -84,8 +88,9 @@ error[FURB163]: FURB163.py:8:1: [*] Prefer `math.log2(foo)` over `math.log` with 10 10 | math.log(foo, math.e) 11 11 | math.log(1, 2.0) -error[FURB163]: FURB163.py:9:1: [*] Prefer `math.log10(foo)` over `math.log` with a redundant base +error[FURB163]: 9:1: [*] Prefer `math.log10(foo)` over `math.log` with a redundant base + --> FURB163.py:8:17 | 7 | foo = ... 8 | math.log(foo, 2) @@ -105,8 +110,9 @@ error[FURB163]: FURB163.py:9:1: [*] Prefer `math.log10(foo)` over `math.log` wit 11 11 | math.log(1, 2.0) 12 12 | math.log(1, 10.0) -error[FURB163]: FURB163.py:10:1: [*] Prefer `math.log(foo)` over `math.log` with a redundant base +error[FURB163]: 10:1: [*] Prefer `math.log(foo)` over `math.log` with a redundant base + --> FURB163.py:9:18 | 8 | math.log(foo, 2) 9 | math.log(foo, 10) @@ -126,8 +132,9 @@ error[FURB163]: FURB163.py:10:1: [*] Prefer `math.log(foo)` over `math.log` with 12 12 | math.log(1, 10.0) 13 13 | -error[FURB163]: FURB163.py:11:1: [*] Prefer `math.log2(1)` over `math.log` with a redundant base +error[FURB163]: 11:1: [*] Prefer `math.log2(1)` over `math.log` with a redundant base + --> FURB163.py:10:22 | 9 | math.log(foo, 10) 10 | math.log(foo, math.e) @@ -146,8 +153,9 @@ error[FURB163]: FURB163.py:11:1: [*] Prefer `math.log2(1)` over `math.log` with 13 13 | 14 14 | # OK -error[FURB163]: FURB163.py:12:1: [*] Prefer `math.log10(1)` over `math.log` with a redundant base +error[FURB163]: 12:1: [*] Prefer `math.log10(1)` over `math.log` with a redundant base + --> FURB163.py:11:17 | 10 | math.log(foo, math.e) 11 | math.log(1, 2.0) diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB164_FURB164.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB164_FURB164.py.snap index f2539e88ea..16e086a730 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB164_FURB164.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB164_FURB164.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/refurb/mod.rs --- -error[FURB164]: FURB164.py:7:5: [*] Verbose method `from_float` in `Fraction` construction +error[FURB164]: 7:5: [*] Verbose method `from_float` in `Fraction` construction + --> FURB164.py:7:5 | 6 | # Errors 7 | _ = Fraction.from_float(0.1) @@ -21,8 +22,9 @@ error[FURB164]: FURB164.py:7:5: [*] Verbose method `from_float` in `Fraction` co 9 9 | _ = Fraction.from_float(5.0) 10 10 | _ = fractions.Fraction.from_float(4.2) -error[FURB164]: FURB164.py:8:5: [*] Verbose method `from_float` in `Fraction` construction +error[FURB164]: 8:5: [*] Verbose method `from_float` in `Fraction` construction + --> FURB164.py:8:5 | 6 | # Errors 7 | _ = Fraction.from_float(0.1) @@ -42,8 +44,9 @@ error[FURB164]: FURB164.py:8:5: [*] Verbose method `from_float` in `Fraction` co 10 10 | _ = fractions.Fraction.from_float(4.2) 11 11 | _ = Fraction.from_decimal(Decimal("4.2")) -error[FURB164]: FURB164.py:9:5: [*] Verbose method `from_float` in `Fraction` construction +error[FURB164]: 9:5: [*] Verbose method `from_float` in `Fraction` construction + --> FURB164.py:9:5 | 7 | _ = Fraction.from_float(0.1) 8 | _ = Fraction.from_float(-0.5) @@ -63,8 +66,9 @@ error[FURB164]: FURB164.py:9:5: [*] Verbose method `from_float` in `Fraction` co 11 11 | _ = Fraction.from_decimal(Decimal("4.2")) 12 12 | _ = Fraction.from_decimal(Decimal("-4.2")) -error[FURB164]: FURB164.py:10:5: [*] Verbose method `from_float` in `Fraction` construction +error[FURB164]: 10:5: [*] Verbose method `from_float` in `Fraction` construction + --> FURB164.py:10:5 | 8 | _ = Fraction.from_float(-0.5) 9 | _ = Fraction.from_float(5.0) @@ -84,8 +88,9 @@ error[FURB164]: FURB164.py:10:5: [*] Verbose method `from_float` in `Fraction` c 12 12 | _ = Fraction.from_decimal(Decimal("-4.2")) 13 13 | _ = Fraction.from_decimal(Decimal.from_float(4.2)) -error[FURB164]: FURB164.py:11:5: [*] Verbose method `from_decimal` in `Fraction` construction +error[FURB164]: 11:5: [*] Verbose method `from_decimal` in `Fraction` construction + --> FURB164.py:11:5 | 9 | _ = Fraction.from_float(5.0) 10 | _ = fractions.Fraction.from_float(4.2) @@ -105,8 +110,9 @@ error[FURB164]: FURB164.py:11:5: [*] Verbose method `from_decimal` in `Fraction` 13 13 | _ = Fraction.from_decimal(Decimal.from_float(4.2)) 14 14 | _ = Decimal.from_float(0.1) -error[FURB164]: FURB164.py:12:5: [*] Verbose method `from_decimal` in `Fraction` construction +error[FURB164]: 12:5: [*] Verbose method `from_decimal` in `Fraction` construction + --> FURB164.py:12:5 | 10 | _ = fractions.Fraction.from_float(4.2) 11 | _ = Fraction.from_decimal(Decimal("4.2")) @@ -126,8 +132,9 @@ error[FURB164]: FURB164.py:12:5: [*] Verbose method `from_decimal` in `Fraction` 14 14 | _ = Decimal.from_float(0.1) 15 15 | _ = Decimal.from_float(-0.5) -error[FURB164]: FURB164.py:13:5: [*] Verbose method `from_decimal` in `Fraction` construction +error[FURB164]: 13:5: [*] Verbose method `from_decimal` in `Fraction` construction + --> FURB164.py:13:5 | 11 | _ = Fraction.from_decimal(Decimal("4.2")) 12 | _ = Fraction.from_decimal(Decimal("-4.2")) @@ -147,8 +154,9 @@ error[FURB164]: FURB164.py:13:5: [*] Verbose method `from_decimal` in `Fraction` 15 15 | _ = Decimal.from_float(-0.5) 16 16 | _ = Decimal.from_float(5.0) -error[FURB164]: FURB164.py:13:27: [*] Verbose method `from_float` in `Decimal` construction +error[FURB164]: 13:27: [*] Verbose method `from_float` in `Decimal` construction + --> FURB164.py:13:27 | 11 | _ = Fraction.from_decimal(Decimal("4.2")) 12 | _ = Fraction.from_decimal(Decimal("-4.2")) @@ -168,8 +176,9 @@ error[FURB164]: FURB164.py:13:27: [*] Verbose method `from_float` in `Decimal` c 15 15 | _ = Decimal.from_float(-0.5) 16 16 | _ = Decimal.from_float(5.0) -error[FURB164]: FURB164.py:14:5: [*] Verbose method `from_float` in `Decimal` construction +error[FURB164]: 14:5: [*] Verbose method `from_float` in `Decimal` construction + --> FURB164.py:14:5 | 12 | _ = Fraction.from_decimal(Decimal("-4.2")) 13 | _ = Fraction.from_decimal(Decimal.from_float(4.2)) @@ -189,8 +198,9 @@ error[FURB164]: FURB164.py:14:5: [*] Verbose method `from_float` in `Decimal` co 16 16 | _ = Decimal.from_float(5.0) 17 17 | _ = decimal.Decimal.from_float(4.2) -error[FURB164]: FURB164.py:15:5: [*] Verbose method `from_float` in `Decimal` construction +error[FURB164]: 15:5: [*] Verbose method `from_float` in `Decimal` construction + --> FURB164.py:15:5 | 13 | _ = Fraction.from_decimal(Decimal.from_float(4.2)) 14 | _ = Decimal.from_float(0.1) @@ -210,8 +220,9 @@ error[FURB164]: FURB164.py:15:5: [*] Verbose method `from_float` in `Decimal` co 17 17 | _ = decimal.Decimal.from_float(4.2) 18 18 | _ = Decimal.from_float(float("inf")) -error[FURB164]: FURB164.py:16:5: [*] Verbose method `from_float` in `Decimal` construction +error[FURB164]: 16:5: [*] Verbose method `from_float` in `Decimal` construction + --> FURB164.py:16:5 | 14 | _ = Decimal.from_float(0.1) 15 | _ = Decimal.from_float(-0.5) @@ -231,8 +242,9 @@ error[FURB164]: FURB164.py:16:5: [*] Verbose method `from_float` in `Decimal` co 18 18 | _ = Decimal.from_float(float("inf")) 19 19 | _ = Decimal.from_float(float("-inf")) -error[FURB164]: FURB164.py:17:5: [*] Verbose method `from_float` in `Decimal` construction +error[FURB164]: 17:5: [*] Verbose method `from_float` in `Decimal` construction + --> FURB164.py:17:5 | 15 | _ = Decimal.from_float(-0.5) 16 | _ = Decimal.from_float(5.0) @@ -252,8 +264,9 @@ error[FURB164]: FURB164.py:17:5: [*] Verbose method `from_float` in `Decimal` co 19 19 | _ = Decimal.from_float(float("-inf")) 20 20 | _ = Decimal.from_float(float("Infinity")) -error[FURB164]: FURB164.py:18:5: [*] Verbose method `from_float` in `Decimal` construction +error[FURB164]: 18:5: [*] Verbose method `from_float` in `Decimal` construction + --> FURB164.py:18:5 | 16 | _ = Decimal.from_float(5.0) 17 | _ = decimal.Decimal.from_float(4.2) @@ -273,8 +286,9 @@ error[FURB164]: FURB164.py:18:5: [*] Verbose method `from_float` in `Decimal` co 20 20 | _ = Decimal.from_float(float("Infinity")) 21 21 | _ = Decimal.from_float(float("-Infinity")) -error[FURB164]: FURB164.py:19:5: [*] Verbose method `from_float` in `Decimal` construction +error[FURB164]: 19:5: [*] Verbose method `from_float` in `Decimal` construction + --> FURB164.py:19:5 | 17 | _ = decimal.Decimal.from_float(4.2) 18 | _ = Decimal.from_float(float("inf")) @@ -294,8 +308,9 @@ error[FURB164]: FURB164.py:19:5: [*] Verbose method `from_float` in `Decimal` co 21 21 | _ = Decimal.from_float(float("-Infinity")) 22 22 | _ = Decimal.from_float(float("nan")) -error[FURB164]: FURB164.py:20:5: [*] Verbose method `from_float` in `Decimal` construction +error[FURB164]: 20:5: [*] Verbose method `from_float` in `Decimal` construction + --> FURB164.py:20:5 | 18 | _ = Decimal.from_float(float("inf")) 19 | _ = Decimal.from_float(float("-inf")) @@ -315,8 +330,9 @@ error[FURB164]: FURB164.py:20:5: [*] Verbose method `from_float` in `Decimal` co 22 22 | _ = Decimal.from_float(float("nan")) 23 23 | -error[FURB164]: FURB164.py:21:5: [*] Verbose method `from_float` in `Decimal` construction +error[FURB164]: 21:5: [*] Verbose method `from_float` in `Decimal` construction + --> FURB164.py:21:5 | 19 | _ = Decimal.from_float(float("-inf")) 20 | _ = Decimal.from_float(float("Infinity")) @@ -335,8 +351,9 @@ error[FURB164]: FURB164.py:21:5: [*] Verbose method `from_float` in `Decimal` co 23 23 | 24 24 | # OK -error[FURB164]: FURB164.py:22:5: [*] Verbose method `from_float` in `Decimal` construction +error[FURB164]: 22:5: [*] Verbose method `from_float` in `Decimal` construction + --> FURB164.py:22:5 | 20 | _ = Decimal.from_float(float("Infinity")) 21 | _ = Decimal.from_float(float("-Infinity")) diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB166_FURB166.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB166_FURB166.py.snap index d436506fdb..2eff5da5a6 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB166_FURB166.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB166_FURB166.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/refurb/mod.rs --- -error[FURB166]: FURB166.py:3:5: [*] Use of `int` with explicit `base=2` after removing prefix +error[FURB166]: 3:5: [*] Use of `int` with explicit `base=2` after removing prefix + --> FURB166.py:3:5 | 1 | # Errors 2 | @@ -21,8 +22,9 @@ error[FURB166]: FURB166.py:3:5: [*] Use of `int` with explicit `base=2` after re 5 5 | _ = int("0xFFFF"[2:], 16) 6 6 | -error[FURB166]: FURB166.py:4:5: [*] Use of `int` with explicit `base=8` after removing prefix +error[FURB166]: 4:5: [*] Use of `int` with explicit `base=8` after removing prefix + --> FURB166.py:4:5 | 3 | _ = int("0b1010"[2:], 2) 4 | _ = int("0o777"[2:], 8) @@ -40,8 +42,9 @@ error[FURB166]: FURB166.py:4:5: [*] Use of `int` with explicit `base=8` after re 6 6 | 7 7 | b = "0b11" -error[FURB166]: FURB166.py:5:5: [*] Use of `int` with explicit `base=16` after removing prefix +error[FURB166]: 5:5: [*] Use of `int` with explicit `base=16` after removing prefix + --> FURB166.py:5:5 | 3 | _ = int("0b1010"[2:], 2) 4 | _ = int("0o777"[2:], 8) @@ -61,8 +64,9 @@ error[FURB166]: FURB166.py:5:5: [*] Use of `int` with explicit `base=16` after r 7 7 | b = "0b11" 8 8 | _ = int(b[2:], 2) -error[FURB166]: FURB166.py:8:5: [*] Use of `int` with explicit `base=2` after removing prefix +error[FURB166]: 8:5: [*] Use of `int` with explicit `base=2` after removing prefix + --> FURB166.py:8:5 | 7 | b = "0b11" 8 | _ = int(b[2:], 2) @@ -81,8 +85,9 @@ error[FURB166]: FURB166.py:8:5: [*] Use of `int` with explicit `base=2` after re 10 10 | _ = int("0xFFFF"[2:], base=16) 11 11 | -error[FURB166]: FURB166.py:10:5: [*] Use of `int` with explicit `base=16` after removing prefix +error[FURB166]: 10:5: [*] Use of `int` with explicit `base=16` after removing prefix + --> FURB166.py:10:5 | 8 | _ = int(b[2:], 2) 9 | @@ -102,8 +107,9 @@ error[FURB166]: FURB166.py:10:5: [*] Use of `int` with explicit `base=16` after 12 12 | _ = int(b"0xFFFF"[2:], 16) 13 13 | -error[FURB166]: FURB166.py:12:5: [*] Use of `int` with explicit `base=16` after removing prefix +error[FURB166]: 12:5: [*] Use of `int` with explicit `base=16` after removing prefix + --> FURB166.py:12:5 | 10 | _ = int("0xFFFF"[2:], base=16) 11 | @@ -121,8 +127,9 @@ error[FURB166]: FURB166.py:12:5: [*] Use of `int` with explicit `base=16` after 14 14 | 15 15 | def get_str(): -error[FURB166]: FURB166.py:19:5: [*] Use of `int` with explicit `base=16` after removing prefix +error[FURB166]: 19:5: [*] Use of `int` with explicit `base=16` after removing prefix + --> FURB166.py:19:5 | 19 | _ = int(get_str()[2:], 16) | ^^^^^^^^^^^^^^^^^^^^^^ diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB167_FURB167.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB167_FURB167.py.snap index 9a3d20cd89..d96b1b8ee4 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB167_FURB167.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB167_FURB167.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/refurb/mod.rs --- -error[FURB167]: FURB167.py:13:42: [*] Use of regular expression alias `re.I` +error[FURB167]: 13:42: [*] Use of regular expression alias `re.I` + --> FURB167.py:13:42 | 12 | # FURB167 13 | if re.match("^hello", "hello world", re.I): @@ -20,8 +21,9 @@ error[FURB167]: FURB167.py:13:42: [*] Use of regular expression alias `re.I` 15 15 | 16 16 | -error[FURB167]: FURB167.py:21:39: [*] Use of regular expression alias `re.I` +error[FURB167]: 21:39: [*] Use of regular expression alias `re.I` + --> FURB167.py:21:39 | 20 | # FURB167 21 | if match("^hello", "hello world", I): diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB168_FURB168.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB168_FURB168.py.snap index 4c949c6060..00065123e2 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB168_FURB168.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB168_FURB168.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/refurb/mod.rs --- -error[FURB168]: FURB168.py:5:4: [*] Prefer `is` operator over `isinstance` to check if an object is `None` +error[FURB168]: 5:4: [*] Prefer `is` operator over `isinstance` to check if an object is `None` + --> FURB168.py:5:4 | 3 | # Errors. 4 | @@ -21,8 +22,9 @@ error[FURB168]: FURB168.py:5:4: [*] Prefer `is` operator over `isinstance` to ch 7 7 | 8 8 | if isinstance(foo, (type(None))): -error[FURB168]: FURB168.py:8:4: [*] Prefer `is` operator over `isinstance` to check if an object is `None` +error[FURB168]: 8:4: [*] Prefer `is` operator over `isinstance` to check if an object is `None` + --> FURB168.py:8:4 | 6 | pass 7 | @@ -41,8 +43,9 @@ error[FURB168]: FURB168.py:8:4: [*] Prefer `is` operator over `isinstance` to ch 10 10 | 11 11 | if isinstance(foo, (type(None), type(None), type(None))): -error[FURB168]: FURB168.py:11:4: [*] Prefer `is` operator over `isinstance` to check if an object is `None` +error[FURB168]: 11:4: [*] Prefer `is` operator over `isinstance` to check if an object is `None` + --> FURB168.py:11:4 | 9 | pass 10 | @@ -61,8 +64,9 @@ error[FURB168]: FURB168.py:11:4: [*] Prefer `is` operator over `isinstance` to c 13 13 | 14 14 | if isinstance(foo, None | None): -error[FURB168]: FURB168.py:14:4: [*] Prefer `is` operator over `isinstance` to check if an object is `None` +error[FURB168]: 14:4: [*] Prefer `is` operator over `isinstance` to check if an object is `None` + --> FURB168.py:14:4 | 12 | pass 13 | @@ -81,8 +85,9 @@ error[FURB168]: FURB168.py:14:4: [*] Prefer `is` operator over `isinstance` to c 16 16 | 17 17 | if isinstance(foo, (None | None)): -error[FURB168]: FURB168.py:17:4: [*] Prefer `is` operator over `isinstance` to check if an object is `None` +error[FURB168]: 17:4: [*] Prefer `is` operator over `isinstance` to check if an object is `None` + --> FURB168.py:17:4 | 15 | pass 16 | @@ -101,8 +106,9 @@ error[FURB168]: FURB168.py:17:4: [*] Prefer `is` operator over `isinstance` to c 19 19 | 20 20 | if isinstance(foo, None | type(None)): -error[FURB168]: FURB168.py:20:4: [*] Prefer `is` operator over `isinstance` to check if an object is `None` +error[FURB168]: 20:4: [*] Prefer `is` operator over `isinstance` to check if an object is `None` + --> FURB168.py:20:4 | 18 | pass 19 | @@ -121,8 +127,9 @@ error[FURB168]: FURB168.py:20:4: [*] Prefer `is` operator over `isinstance` to c 22 22 | 23 23 | if isinstance(foo, (None | type(None))): -error[FURB168]: FURB168.py:23:4: [*] Prefer `is` operator over `isinstance` to check if an object is `None` +error[FURB168]: 23:4: [*] Prefer `is` operator over `isinstance` to check if an object is `None` + --> FURB168.py:23:4 | 21 | pass 22 | @@ -141,8 +148,9 @@ error[FURB168]: FURB168.py:23:4: [*] Prefer `is` operator over `isinstance` to c 25 25 | 26 26 | # A bit contrived, but is both technically valid and equivalent to the above. -error[FURB168]: FURB168.py:27:4: [*] Prefer `is` operator over `isinstance` to check if an object is `None` +error[FURB168]: 27:4: [*] Prefer `is` operator over `isinstance` to check if an object is `None` + --> FURB168.py:27:4 | 26 | # A bit contrived, but is both technically valid and equivalent to the above. 27 | if isinstance(foo, (type(None) | ((((type(None))))) | ((None | type(None))))): diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB169_FURB169.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB169_FURB169.py.snap index 2b2774c601..a333e789f7 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB169_FURB169.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB169_FURB169.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/refurb/mod.rs --- -error[FURB169]: FURB169.py:5:1: [*] Compare the identities of `foo` and `None` instead of their respective types +error[FURB169]: 5:1: [*] Compare the identities of `foo` and `None` instead of their respective types + --> FURB169.py:4:1 | 3 | # Error. 4 | @@ -22,8 +23,9 @@ error[FURB169]: FURB169.py:5:1: [*] Compare the identities of `foo` and `None` i 7 7 | type(None) is type(foo) 8 8 | -error[FURB169]: FURB169.py:7:1: [*] Compare the identities of `foo` and `None` instead of their respective types +error[FURB169]: 7:1: [*] Compare the identities of `foo` and `None` instead of their respective types + --> FURB169.py:6:1 | 5 | type(foo) is type(None) 6 | @@ -43,8 +45,9 @@ error[FURB169]: FURB169.py:7:1: [*] Compare the identities of `foo` and `None` i 9 9 | type(None) is type(None) 10 10 | -error[FURB169]: FURB169.py:9:1: [*] Compare the identities of `None` and `None` instead of their respective types +error[FURB169]: 9:1: [*] Compare the identities of `None` and `None` instead of their respective types + --> FURB169.py:8:1 | 7 | type(None) is type(foo) 8 | @@ -64,8 +67,9 @@ error[FURB169]: FURB169.py:9:1: [*] Compare the identities of `None` and `None` 11 11 | type(foo) is not type(None) 12 12 | -error[FURB169]: FURB169.py:11:1: [*] Compare the identities of `foo` and `None` instead of their respective types +error[FURB169]: 11:1: [*] Compare the identities of `foo` and `None` instead of their respective types + --> FURB169.py:10:1 | 9 | type(None) is type(None) 10 | @@ -85,8 +89,9 @@ error[FURB169]: FURB169.py:11:1: [*] Compare the identities of `foo` and `None` 13 13 | type(None) is not type(foo) 14 14 | -error[FURB169]: FURB169.py:13:1: [*] Compare the identities of `foo` and `None` instead of their respective types +error[FURB169]: 13:1: [*] Compare the identities of `foo` and `None` instead of their respective types + --> FURB169.py:12:1 | 11 | type(foo) is not type(None) 12 | @@ -106,8 +111,9 @@ error[FURB169]: FURB169.py:13:1: [*] Compare the identities of `foo` and `None` 15 15 | type(None) is not type(None) 16 16 | -error[FURB169]: FURB169.py:15:1: [*] Compare the identities of `None` and `None` instead of their respective types +error[FURB169]: 15:1: [*] Compare the identities of `None` and `None` instead of their respective types + --> FURB169.py:14:1 | 13 | type(None) is not type(foo) 14 | @@ -127,8 +133,9 @@ error[FURB169]: FURB169.py:15:1: [*] Compare the identities of `None` and `None` 17 17 | type(foo) == type(None) 18 18 | -error[FURB169]: FURB169.py:17:1: [*] Compare the identities of `foo` and `None` instead of their respective types +error[FURB169]: 17:1: [*] Compare the identities of `foo` and `None` instead of their respective types + --> FURB169.py:16:1 | 15 | type(None) is not type(None) 16 | @@ -148,8 +155,9 @@ error[FURB169]: FURB169.py:17:1: [*] Compare the identities of `foo` and `None` 19 19 | type(None) == type(foo) 20 20 | -error[FURB169]: FURB169.py:19:1: [*] Compare the identities of `foo` and `None` instead of their respective types +error[FURB169]: 19:1: [*] Compare the identities of `foo` and `None` instead of their respective types + --> FURB169.py:18:1 | 17 | type(foo) == type(None) 18 | @@ -169,8 +177,9 @@ error[FURB169]: FURB169.py:19:1: [*] Compare the identities of `foo` and `None` 21 21 | type(None) == type(None) 22 22 | -error[FURB169]: FURB169.py:21:1: [*] Compare the identities of `None` and `None` instead of their respective types +error[FURB169]: 21:1: [*] Compare the identities of `None` and `None` instead of their respective types + --> FURB169.py:20:1 | 19 | type(None) == type(foo) 20 | @@ -190,8 +199,9 @@ error[FURB169]: FURB169.py:21:1: [*] Compare the identities of `None` and `None` 23 23 | type(foo) != type(None) 24 24 | -error[FURB169]: FURB169.py:23:1: [*] Compare the identities of `foo` and `None` instead of their respective types +error[FURB169]: 23:1: [*] Compare the identities of `foo` and `None` instead of their respective types + --> FURB169.py:22:1 | 21 | type(None) == type(None) 22 | @@ -211,8 +221,9 @@ error[FURB169]: FURB169.py:23:1: [*] Compare the identities of `foo` and `None` 25 25 | type(None) != type(foo) 26 26 | -error[FURB169]: FURB169.py:25:1: [*] Compare the identities of `foo` and `None` instead of their respective types +error[FURB169]: 25:1: [*] Compare the identities of `foo` and `None` instead of their respective types + --> FURB169.py:24:1 | 23 | type(foo) != type(None) 24 | @@ -232,8 +243,9 @@ error[FURB169]: FURB169.py:25:1: [*] Compare the identities of `foo` and `None` 27 27 | type(None) != type(None) 28 28 | -error[FURB169]: FURB169.py:27:1: [*] Compare the identities of `None` and `None` instead of their respective types +error[FURB169]: 27:1: [*] Compare the identities of `None` and `None` instead of their respective types + --> FURB169.py:26:1 | 25 | type(None) != type(foo) 26 | diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB171_FURB171.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB171_FURB171.py.snap index 1801354cae..850a9486ff 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB171_FURB171.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB171_FURB171.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/refurb/mod.rs --- -error[FURB171]: FURB171.py:3:4: [*] Membership test against single-item container +error[FURB171]: 3:4: [*] Membership test against single-item container + --> FURB171.py:3:4 | 1 | # Errors. 2 | @@ -20,8 +21,9 @@ error[FURB171]: FURB171.py:3:4: [*] Membership test against single-item containe 5 5 | 6 6 | if 1 in [1]: -error[FURB171]: FURB171.py:6:4: [*] Membership test against single-item container +error[FURB171]: 6:4: [*] Membership test against single-item container + --> FURB171.py:6:4 | 4 | print("Single-element tuple") 5 | @@ -40,8 +42,9 @@ error[FURB171]: FURB171.py:6:4: [*] Membership test against single-item containe 8 8 | 9 9 | if 1 in {1}: -error[FURB171]: FURB171.py:9:4: [*] Membership test against single-item container +error[FURB171]: 9:4: [*] Membership test against single-item container + --> FURB171.py:9:4 | 7 | print("Single-element list") 8 | @@ -60,8 +63,9 @@ error[FURB171]: FURB171.py:9:4: [*] Membership test against single-item containe 11 11 | 12 12 | if "a" in "a": -error[FURB171]: FURB171.py:12:4: [*] Membership test against single-item container +error[FURB171]: 12:4: [*] Membership test against single-item container + --> FURB171.py:12:4 | 10 | print("Single-element set") 11 | @@ -80,8 +84,9 @@ error[FURB171]: FURB171.py:12:4: [*] Membership test against single-item contain 14 14 | 15 15 | if 1 not in (1,): -error[FURB171]: FURB171.py:15:4: [*] Membership test against single-item container +error[FURB171]: 15:4: [*] Membership test against single-item container + --> FURB171.py:15:4 | 13 | print("Single-element string") 14 | @@ -100,8 +105,9 @@ error[FURB171]: FURB171.py:15:4: [*] Membership test against single-item contain 17 17 | 18 18 | if not 1 in (1,): -error[FURB171]: FURB171.py:18:8: [*] Membership test against single-item container +error[FURB171]: 18:8: [*] Membership test against single-item container + --> FURB171.py:18:8 | 16 | print("Check `not in` membership test") 17 | diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB177_FURB177.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB177_FURB177.py.snap index a7034cc35a..f708d21e3b 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB177_FURB177.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB177_FURB177.py.snap @@ -1,15 +1,16 @@ --- source: crates/ruff_linter/src/rules/refurb/mod.rs --- -FURB177.py:5:5: FURB177 [*] Prefer `Path.cwd()` over `Path().resolve()` for current-directory lookups +error[FURB177]: 5:5: [*] Prefer `Path.cwd()` over `Path().resolve()` for current-directory lookups + + --> FURB177.py:5:5 | 4 | # Errors 5 | _ = Path().resolve() - | ^^^^^^^^^^^^^^^^ FURB177 + | ^^^^^^^^^^^^^^^^ 6 | _ = pathlib.Path().resolve() | = help: Replace `Path().resolve()` with `Path.cwd()` - ℹ Unsafe fix 2 2 | from pathlib import Path 3 3 | @@ -20,17 +21,18 @@ FURB177.py:5:5: FURB177 [*] Prefer `Path.cwd()` over `Path().resolve()` for curr 7 7 | 8 8 | _ = Path("").resolve() -FURB177.py:6:5: FURB177 [*] Prefer `Path.cwd()` over `Path().resolve()` for current-directory lookups +error[FURB177]: 6:5: [*] Prefer `Path.cwd()` over `Path().resolve()` for current-directory lookups + + --> FURB177.py:6:5 | 4 | # Errors 5 | _ = Path().resolve() 6 | _ = pathlib.Path().resolve() - | ^^^^^^^^^^^^^^^^^^^^^^^^ FURB177 + | ^^^^^^^^^^^^^^^^^^^^^^^^ 7 | 8 | _ = Path("").resolve() | = help: Replace `Path().resolve()` with `Path.cwd()` - ℹ Unsafe fix 3 3 | 4 4 | # Errors @@ -41,16 +43,17 @@ FURB177.py:6:5: FURB177 [*] Prefer `Path.cwd()` over `Path().resolve()` for curr 8 8 | _ = Path("").resolve() 9 9 | _ = pathlib.Path("").resolve() -FURB177.py:8:5: FURB177 [*] Prefer `Path.cwd()` over `Path().resolve()` for current-directory lookups +error[FURB177]: 8:5: [*] Prefer `Path.cwd()` over `Path().resolve()` for current-directory lookups + + --> FURB177.py:8:5 | 6 | _ = pathlib.Path().resolve() 7 | 8 | _ = Path("").resolve() - | ^^^^^^^^^^^^^^^^^^ FURB177 + | ^^^^^^^^^^^^^^^^^^ 9 | _ = pathlib.Path("").resolve() | = help: Replace `Path().resolve()` with `Path.cwd()` - ℹ Unsafe fix 5 5 | _ = Path().resolve() 6 6 | _ = pathlib.Path().resolve() @@ -61,16 +64,17 @@ FURB177.py:8:5: FURB177 [*] Prefer `Path.cwd()` over `Path().resolve()` for curr 10 10 | 11 11 | _ = Path(".").resolve() -FURB177.py:9:5: FURB177 [*] Prefer `Path.cwd()` over `Path().resolve()` for current-directory lookups +error[FURB177]: 9:5: [*] Prefer `Path.cwd()` over `Path().resolve()` for current-directory lookups + + --> FURB177.py:9:5 | 8 | _ = Path("").resolve() 9 | _ = pathlib.Path("").resolve() - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ FURB177 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ 10 | 11 | _ = Path(".").resolve() | = help: Replace `Path().resolve()` with `Path.cwd()` - ℹ Unsafe fix 6 6 | _ = pathlib.Path().resolve() 7 7 | @@ -81,16 +85,17 @@ FURB177.py:9:5: FURB177 [*] Prefer `Path.cwd()` over `Path().resolve()` for curr 11 11 | _ = Path(".").resolve() 12 12 | _ = pathlib.Path(".").resolve() -FURB177.py:11:5: FURB177 [*] Prefer `Path.cwd()` over `Path().resolve()` for current-directory lookups +error[FURB177]: 11:5: [*] Prefer `Path.cwd()` over `Path().resolve()` for current-directory lookups + + --> FURB177.py:11:5 | 9 | _ = pathlib.Path("").resolve() 10 | 11 | _ = Path(".").resolve() - | ^^^^^^^^^^^^^^^^^^^ FURB177 + | ^^^^^^^^^^^^^^^^^^^ 12 | _ = pathlib.Path(".").resolve() | = help: Replace `Path().resolve()` with `Path.cwd()` - ℹ Unsafe fix 8 8 | _ = Path("").resolve() 9 9 | _ = pathlib.Path("").resolve() @@ -101,16 +106,17 @@ FURB177.py:11:5: FURB177 [*] Prefer `Path.cwd()` over `Path().resolve()` for cur 13 13 | 14 14 | _ = Path("", **kwargs).resolve() -FURB177.py:12:5: FURB177 [*] Prefer `Path.cwd()` over `Path().resolve()` for current-directory lookups +error[FURB177]: 12:5: [*] Prefer `Path.cwd()` over `Path().resolve()` for current-directory lookups + + --> FURB177.py:12:5 | 11 | _ = Path(".").resolve() 12 | _ = pathlib.Path(".").resolve() - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ FURB177 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ 13 | 14 | _ = Path("", **kwargs).resolve() | = help: Replace `Path().resolve()` with `Path.cwd()` - ℹ Unsafe fix 9 9 | _ = pathlib.Path("").resolve() 10 10 | @@ -121,16 +127,17 @@ FURB177.py:12:5: FURB177 [*] Prefer `Path.cwd()` over `Path().resolve()` for cur 14 14 | _ = Path("", **kwargs).resolve() 15 15 | _ = pathlib.Path("", **kwargs).resolve() -FURB177.py:14:5: FURB177 [*] Prefer `Path.cwd()` over `Path().resolve()` for current-directory lookups +error[FURB177]: 14:5: [*] Prefer `Path.cwd()` over `Path().resolve()` for current-directory lookups + + --> FURB177.py:14:5 | 12 | _ = pathlib.Path(".").resolve() 13 | 14 | _ = Path("", **kwargs).resolve() - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FURB177 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 15 | _ = pathlib.Path("", **kwargs).resolve() | = help: Replace `Path().resolve()` with `Path.cwd()` - ℹ Unsafe fix 11 11 | _ = Path(".").resolve() 12 12 | _ = pathlib.Path(".").resolve() @@ -141,16 +148,17 @@ FURB177.py:14:5: FURB177 [*] Prefer `Path.cwd()` over `Path().resolve()` for cur 16 16 | 17 17 | _ = Path(".", **kwargs).resolve() -FURB177.py:15:5: FURB177 [*] Prefer `Path.cwd()` over `Path().resolve()` for current-directory lookups +error[FURB177]: 15:5: [*] Prefer `Path.cwd()` over `Path().resolve()` for current-directory lookups + + --> FURB177.py:15:5 | 14 | _ = Path("", **kwargs).resolve() 15 | _ = pathlib.Path("", **kwargs).resolve() - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FURB177 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 16 | 17 | _ = Path(".", **kwargs).resolve() | = help: Replace `Path().resolve()` with `Path.cwd()` - ℹ Unsafe fix 12 12 | _ = pathlib.Path(".").resolve() 13 13 | @@ -161,16 +169,17 @@ FURB177.py:15:5: FURB177 [*] Prefer `Path.cwd()` over `Path().resolve()` for cur 17 17 | _ = Path(".", **kwargs).resolve() 18 18 | _ = pathlib.Path(".", **kwargs).resolve() -FURB177.py:17:5: FURB177 [*] Prefer `Path.cwd()` over `Path().resolve()` for current-directory lookups +error[FURB177]: 17:5: [*] Prefer `Path.cwd()` over `Path().resolve()` for current-directory lookups + + --> FURB177.py:17:5 | 15 | _ = pathlib.Path("", **kwargs).resolve() 16 | 17 | _ = Path(".", **kwargs).resolve() - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FURB177 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 18 | _ = pathlib.Path(".", **kwargs).resolve() | = help: Replace `Path().resolve()` with `Path.cwd()` - ℹ Unsafe fix 14 14 | _ = Path("", **kwargs).resolve() 15 15 | _ = pathlib.Path("", **kwargs).resolve() @@ -181,16 +190,17 @@ FURB177.py:17:5: FURB177 [*] Prefer `Path.cwd()` over `Path().resolve()` for cur 19 19 | 20 20 | # OK -FURB177.py:18:5: FURB177 [*] Prefer `Path.cwd()` over `Path().resolve()` for current-directory lookups +error[FURB177]: 18:5: [*] Prefer `Path.cwd()` over `Path().resolve()` for current-directory lookups + + --> FURB177.py:18:5 | 17 | _ = Path(".", **kwargs).resolve() 18 | _ = pathlib.Path(".", **kwargs).resolve() - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FURB177 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 19 | 20 | # OK | = help: Replace `Path().resolve()` with `Path.cwd()` - ℹ Unsafe fix 15 15 | _ = pathlib.Path("", **kwargs).resolve() 16 16 | diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB180_FURB180.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB180_FURB180.py.snap index c23b9b513c..eb8ca101aa 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB180_FURB180.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB180_FURB180.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/refurb/mod.rs --- -error[FURB180]: FURB180.py:7:10: [*] Use of `metaclass=abc.ABCMeta` to define abstract base class +error[FURB180]: 7:10: [*] Use of `metaclass=abc.ABCMeta` to define abstract base class + --> FURB180.py:7:10 | 5 | # Errors 6 | @@ -22,8 +23,9 @@ error[FURB180]: FURB180.py:7:10: [*] Use of `metaclass=abc.ABCMeta` to define ab 9 9 | def foo(self): pass 10 10 | -error[FURB180]: FURB180.py:12:10: [*] Use of `metaclass=abc.ABCMeta` to define abstract base class +error[FURB180]: 12:10: [*] Use of `metaclass=abc.ABCMeta` to define abstract base class + --> FURB180.py:12:10 | 12 | class A1(metaclass=ABCMeta): | ^^^^^^^^^^^^^^^^^ @@ -41,8 +43,9 @@ error[FURB180]: FURB180.py:12:10: [*] Use of `metaclass=abc.ABCMeta` to define a 14 14 | def foo(self): pass 15 15 | -error[FURB180]: FURB180.py:26:18: [*] Use of `metaclass=abc.ABCMeta` to define abstract base class +error[FURB180]: 26:18: [*] Use of `metaclass=abc.ABCMeta` to define abstract base class + --> FURB180.py:26:18 | 26 | class A2(B0, B1, metaclass=ABCMeta): | ^^^^^^^^^^^^^^^^^ @@ -60,8 +63,9 @@ error[FURB180]: FURB180.py:26:18: [*] Use of `metaclass=abc.ABCMeta` to define a 28 28 | def foo(self): pass 29 29 | -error[FURB180]: FURB180.py:31:34: [*] Use of `metaclass=abc.ABCMeta` to define abstract base class +error[FURB180]: 31:34: [*] Use of `metaclass=abc.ABCMeta` to define abstract base class + --> FURB180.py:31:34 | 31 | class A3(B0, before_metaclass=1, metaclass=abc.ABCMeta): | ^^^^^^^^^^^^^^^^^^^^^ diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB181_FURB181.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB181_FURB181.py.snap index ce6d56123f..9d817720e9 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB181_FURB181.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB181_FURB181.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/refurb/mod.rs --- -error[FURB181]: FURB181.py:19:1: [*] Use of hashlib's `.digest().hex()` +error[FURB181]: 19:1: [*] Use of hashlib's `.digest().hex()` + --> FURB181.py:18:1 | 17 | # these will match 18 | @@ -22,8 +23,9 @@ error[FURB181]: FURB181.py:19:1: [*] Use of hashlib's `.digest().hex()` 21 21 | md5().digest().hex() 22 22 | sha1().digest().hex() -error[FURB181]: FURB181.py:20:1: [*] Use of hashlib's `.digest().hex()` +error[FURB181]: 20:1: [*] Use of hashlib's `.digest().hex()` + --> FURB181.py:19:25 | 19 | blake2b().digest().hex() 20 | blake2s().digest().hex() @@ -42,8 +44,9 @@ error[FURB181]: FURB181.py:20:1: [*] Use of hashlib's `.digest().hex()` 22 22 | sha1().digest().hex() 23 23 | sha224().digest().hex() -error[FURB181]: FURB181.py:21:1: [*] Use of hashlib's `.digest().hex()` +error[FURB181]: 21:1: [*] Use of hashlib's `.digest().hex()` + --> FURB181.py:20:25 | 19 | blake2b().digest().hex() 20 | blake2s().digest().hex() @@ -63,8 +66,9 @@ error[FURB181]: FURB181.py:21:1: [*] Use of hashlib's `.digest().hex()` 23 23 | sha224().digest().hex() 24 24 | sha256().digest().hex() -error[FURB181]: FURB181.py:22:1: [*] Use of hashlib's `.digest().hex()` +error[FURB181]: 22:1: [*] Use of hashlib's `.digest().hex()` + --> FURB181.py:21:21 | 20 | blake2s().digest().hex() 21 | md5().digest().hex() @@ -84,8 +88,9 @@ error[FURB181]: FURB181.py:22:1: [*] Use of hashlib's `.digest().hex()` 24 24 | sha256().digest().hex() 25 25 | sha384().digest().hex() -error[FURB181]: FURB181.py:23:1: [*] Use of hashlib's `.digest().hex()` +error[FURB181]: 23:1: [*] Use of hashlib's `.digest().hex()` + --> FURB181.py:22:22 | 21 | md5().digest().hex() 22 | sha1().digest().hex() @@ -105,8 +110,9 @@ error[FURB181]: FURB181.py:23:1: [*] Use of hashlib's `.digest().hex()` 25 25 | sha384().digest().hex() 26 26 | sha3_224().digest().hex() -error[FURB181]: FURB181.py:24:1: [*] Use of hashlib's `.digest().hex()` +error[FURB181]: 24:1: [*] Use of hashlib's `.digest().hex()` + --> FURB181.py:23:24 | 22 | sha1().digest().hex() 23 | sha224().digest().hex() @@ -126,8 +132,9 @@ error[FURB181]: FURB181.py:24:1: [*] Use of hashlib's `.digest().hex()` 26 26 | sha3_224().digest().hex() 27 27 | sha3_256().digest().hex() -error[FURB181]: FURB181.py:25:1: [*] Use of hashlib's `.digest().hex()` +error[FURB181]: 25:1: [*] Use of hashlib's `.digest().hex()` + --> FURB181.py:24:24 | 23 | sha224().digest().hex() 24 | sha256().digest().hex() @@ -147,8 +154,9 @@ error[FURB181]: FURB181.py:25:1: [*] Use of hashlib's `.digest().hex()` 27 27 | sha3_256().digest().hex() 28 28 | sha3_384().digest().hex() -error[FURB181]: FURB181.py:26:1: [*] Use of hashlib's `.digest().hex()` +error[FURB181]: 26:1: [*] Use of hashlib's `.digest().hex()` + --> FURB181.py:25:24 | 24 | sha256().digest().hex() 25 | sha384().digest().hex() @@ -168,8 +176,9 @@ error[FURB181]: FURB181.py:26:1: [*] Use of hashlib's `.digest().hex()` 28 28 | sha3_384().digest().hex() 29 29 | sha3_512().digest().hex() -error[FURB181]: FURB181.py:27:1: [*] Use of hashlib's `.digest().hex()` +error[FURB181]: 27:1: [*] Use of hashlib's `.digest().hex()` + --> FURB181.py:26:26 | 25 | sha384().digest().hex() 26 | sha3_224().digest().hex() @@ -189,8 +198,9 @@ error[FURB181]: FURB181.py:27:1: [*] Use of hashlib's `.digest().hex()` 29 29 | sha3_512().digest().hex() 30 30 | sha512().digest().hex() -error[FURB181]: FURB181.py:28:1: [*] Use of hashlib's `.digest().hex()` +error[FURB181]: 28:1: [*] Use of hashlib's `.digest().hex()` + --> FURB181.py:27:26 | 26 | sha3_224().digest().hex() 27 | sha3_256().digest().hex() @@ -210,8 +220,9 @@ error[FURB181]: FURB181.py:28:1: [*] Use of hashlib's `.digest().hex()` 30 30 | sha512().digest().hex() 31 31 | shake_128().digest(10).hex() -error[FURB181]: FURB181.py:29:1: [*] Use of hashlib's `.digest().hex()` +error[FURB181]: 29:1: [*] Use of hashlib's `.digest().hex()` + --> FURB181.py:28:26 | 27 | sha3_256().digest().hex() 28 | sha3_384().digest().hex() @@ -231,8 +242,9 @@ error[FURB181]: FURB181.py:29:1: [*] Use of hashlib's `.digest().hex()` 31 31 | shake_128().digest(10).hex() 32 32 | shake_256().digest(10).hex() -error[FURB181]: FURB181.py:30:1: [*] Use of hashlib's `.digest().hex()` +error[FURB181]: 30:1: [*] Use of hashlib's `.digest().hex()` + --> FURB181.py:29:26 | 28 | sha3_384().digest().hex() 29 | sha3_512().digest().hex() @@ -252,8 +264,9 @@ error[FURB181]: FURB181.py:30:1: [*] Use of hashlib's `.digest().hex()` 32 32 | shake_256().digest(10).hex() 33 33 | -error[FURB181]: FURB181.py:31:1: Use of hashlib's `.digest().hex()` +error[FURB181]: 31:1: Use of hashlib's `.digest().hex()` + --> FURB181.py:30:24 | 29 | sha3_512().digest().hex() 30 | sha512().digest().hex() @@ -262,8 +275,9 @@ error[FURB181]: FURB181.py:31:1: Use of hashlib's `.digest().hex()` 32 | shake_256().digest(10).hex() | = help: Replace with `.hexdigest()` -error[FURB181]: FURB181.py:32:1: Use of hashlib's `.digest().hex()` +error[FURB181]: 32:1: Use of hashlib's `.digest().hex()` + --> FURB181.py:31:29 | 30 | sha512().digest().hex() 31 | shake_128().digest(10).hex() @@ -273,8 +287,9 @@ error[FURB181]: FURB181.py:32:1: Use of hashlib's `.digest().hex()` 34 | hashlib.sha256().digest().hex() | = help: Replace with `.hexdigest()` -error[FURB181]: FURB181.py:34:1: [*] Use of hashlib's `.digest().hex()` +error[FURB181]: 34:1: [*] Use of hashlib's `.digest().hex()` + --> FURB181.py:33:1 | 32 | shake_256().digest(10).hex() 33 | @@ -294,8 +309,9 @@ error[FURB181]: FURB181.py:34:1: [*] Use of hashlib's `.digest().hex()` 36 36 | sha256(b"text").digest().hex() 37 37 | -error[FURB181]: FURB181.py:36:1: [*] Use of hashlib's `.digest().hex()` +error[FURB181]: 36:1: [*] Use of hashlib's `.digest().hex()` + --> FURB181.py:35:1 | 34 | hashlib.sha256().digest().hex() 35 | @@ -315,8 +331,9 @@ error[FURB181]: FURB181.py:36:1: [*] Use of hashlib's `.digest().hex()` 38 38 | hash_algo().digest().hex() 39 39 | -error[FURB181]: FURB181.py:38:1: [*] Use of hashlib's `.digest().hex()` +error[FURB181]: 38:1: [*] Use of hashlib's `.digest().hex()` + --> FURB181.py:37:1 | 36 | sha256(b"text").digest().hex() 37 | diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB187_FURB187.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB187_FURB187.py.snap index e4d08fd9ee..252c725ced 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB187_FURB187.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB187_FURB187.py.snap @@ -1,15 +1,16 @@ --- source: crates/ruff_linter/src/rules/refurb/mod.rs --- -FURB187.py:6:5: FURB187 [*] Use of assignment of `reversed` on list `l` +error[FURB187]: 6:5: [*] Use of assignment of `reversed` on list `l` + + --> FURB187.py:6:5 | 4 | def a(): 5 | l = [] 6 | l = reversed(l) - | ^^^^^^^^^^^^^^^ FURB187 + | ^^^^^^^^^^^^^^^ | = help: Replace with `l.reverse()` - ℹ Unsafe fix 3 3 | 4 4 | def a(): @@ -20,15 +21,16 @@ FURB187.py:6:5: FURB187 [*] Use of assignment of `reversed` on list `l` 8 8 | 9 9 | def b(): -FURB187.py:11:5: FURB187 [*] Use of assignment of `reversed` on list `l` +error[FURB187]: 11:5: [*] Use of assignment of `reversed` on list `l` + + --> FURB187.py:11:5 | 9 | def b(): 10 | l = [] 11 | l = list(reversed(l)) - | ^^^^^^^^^^^^^^^^^^^^^ FURB187 + | ^^^^^^^^^^^^^^^^^^^^^ | = help: Replace with `l.reverse()` - ℹ Unsafe fix 8 8 | 9 9 | def b(): @@ -39,15 +41,16 @@ FURB187.py:11:5: FURB187 [*] Use of assignment of `reversed` on list `l` 13 13 | 14 14 | def c(): -FURB187.py:16:5: FURB187 [*] Use of assignment of `reversed` on list `l` +error[FURB187]: 16:5: [*] Use of assignment of `reversed` on list `l` + + --> FURB187.py:16:5 | 14 | def c(): 15 | l = [] 16 | l = l[::-1] - | ^^^^^^^^^^^ FURB187 + | ^^^^^^^^^^^ | = help: Replace with `l.reverse()` - ℹ Unsafe fix 13 13 | 14 14 | def c(): diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB192_FURB192.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB192_FURB192.py.snap index 58511a69ae..622214be98 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB192_FURB192.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB192_FURB192.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/refurb/mod.rs --- -error[FURB192]: FURB192.py:3:1: [*] Prefer `min` over `sorted()` to compute the minimum value in a sequence +error[FURB192]: 3:1: [*] Prefer `min` over `sorted()` to compute the minimum value in a sequence + --> FURB192.py:2:1 | 1 | # Errors 2 | @@ -21,8 +22,9 @@ error[FURB192]: FURB192.py:3:1: [*] Prefer `min` over `sorted()` to compute the 5 5 | sorted(l)[-1] 6 6 | -error[FURB192]: FURB192.py:5:1: [*] Prefer `max` over `sorted()` to compute the maximum value in a sequence +error[FURB192]: 5:1: [*] Prefer `max` over `sorted()` to compute the maximum value in a sequence + --> FURB192.py:4:1 | 3 | sorted(l)[0] 4 | @@ -42,8 +44,9 @@ error[FURB192]: FURB192.py:5:1: [*] Prefer `max` over `sorted()` to compute the 7 7 | sorted(l, reverse=False)[-1] 8 8 | -error[FURB192]: FURB192.py:7:1: [*] Prefer `max` over `sorted()` to compute the maximum value in a sequence +error[FURB192]: 7:1: [*] Prefer `max` over `sorted()` to compute the maximum value in a sequence + --> FURB192.py:6:1 | 5 | sorted(l)[-1] 6 | @@ -63,8 +66,9 @@ error[FURB192]: FURB192.py:7:1: [*] Prefer `max` over `sorted()` to compute the 9 9 | sorted(l, key=lambda x: x)[0] 10 10 | -error[FURB192]: FURB192.py:9:1: [*] Prefer `min` over `sorted()` to compute the minimum value in a sequence +error[FURB192]: 9:1: [*] Prefer `min` over `sorted()` to compute the minimum value in a sequence + --> FURB192.py:8:1 | 7 | sorted(l, reverse=False)[-1] 8 | @@ -84,8 +88,9 @@ error[FURB192]: FURB192.py:9:1: [*] Prefer `min` over `sorted()` to compute the 11 11 | sorted(l, key=key_fn)[0] 12 12 | -error[FURB192]: FURB192.py:11:1: [*] Prefer `min` over `sorted()` to compute the minimum value in a sequence +error[FURB192]: 11:1: [*] Prefer `min` over `sorted()` to compute the minimum value in a sequence + --> FURB192.py:10:1 | 9 | sorted(l, key=lambda x: x)[0] 10 | @@ -105,8 +110,9 @@ error[FURB192]: FURB192.py:11:1: [*] Prefer `min` over `sorted()` to compute the 13 13 | sorted([1, 2, 3])[0] 14 14 | -error[FURB192]: FURB192.py:13:1: [*] Prefer `min` over `sorted()` to compute the minimum value in a sequence +error[FURB192]: 13:1: [*] Prefer `min` over `sorted()` to compute the minimum value in a sequence + --> FURB192.py:12:1 | 11 | sorted(l, key=key_fn)[0] 12 | @@ -126,8 +132,9 @@ error[FURB192]: FURB192.py:13:1: [*] Prefer `min` over `sorted()` to compute the 15 15 | # Unsafe 16 16 | -error[FURB192]: FURB192.py:17:1: [*] Prefer `min` over `sorted()` to compute the minimum value in a sequence +error[FURB192]: 17:1: [*] Prefer `min` over `sorted()` to compute the minimum value in a sequence + --> FURB192.py:16:1 | 15 | # Unsafe 16 | @@ -147,8 +154,9 @@ error[FURB192]: FURB192.py:17:1: [*] Prefer `min` over `sorted()` to compute the 19 19 | sorted(l, reverse=True)[0] 20 20 | -error[FURB192]: FURB192.py:19:1: [*] Prefer `max` over `sorted()` to compute the maximum value in a sequence +error[FURB192]: 19:1: [*] Prefer `max` over `sorted()` to compute the maximum value in a sequence + --> FURB192.py:18:1 | 17 | sorted(l, key=key_fn, reverse=True)[-1] 18 | @@ -168,8 +176,9 @@ error[FURB192]: FURB192.py:19:1: [*] Prefer `max` over `sorted()` to compute the 21 21 | sorted(l, reverse=True)[-1] 22 22 | -error[FURB192]: FURB192.py:21:1: [*] Prefer `min` over `sorted()` to compute the minimum value in a sequence +error[FURB192]: 21:1: [*] Prefer `min` over `sorted()` to compute the minimum value in a sequence + --> FURB192.py:20:1 | 19 | sorted(l, reverse=True)[0] 20 | diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__write_whole_file_python_39.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__write_whole_file_python_39.snap index 445a83eda6..835e191628 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__write_whole_file_python_39.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__write_whole_file_python_39.snap @@ -1,86 +1,97 @@ --- source: crates/ruff_linter/src/rules/refurb/mod.rs --- -FURB103.py:12:6: FURB103 `open` and `write` should be replaced by `Path("file.txt").write_text("test")` +error[FURB103]: 12:6: `open` and `write` should be replaced by `Path("file.txt").write_text("test")` + + --> FURB103.py:12:6 | 11 | # FURB103 12 | with open("file.txt", "w") as f: - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ FURB103 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ 13 | f.write("test") | +error[FURB103]: 16:6: `open` and `write` should be replaced by `Path("file.txt").write_bytes(foobar)` -FURB103.py:16:6: FURB103 `open` and `write` should be replaced by `Path("file.txt").write_bytes(foobar)` + --> FURB103.py:16:6 | 15 | # FURB103 16 | with open("file.txt", "wb") as f: - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ FURB103 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ 17 | f.write(foobar) | +error[FURB103]: 20:6: `open` and `write` should be replaced by `Path("file.txt").write_bytes(b"abc")` -FURB103.py:20:6: FURB103 `open` and `write` should be replaced by `Path("file.txt").write_bytes(b"abc")` + --> FURB103.py:20:6 | 19 | # FURB103 20 | with open("file.txt", mode="wb") as f: - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FURB103 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 21 | f.write(b"abc") | +error[FURB103]: 24:6: `open` and `write` should be replaced by `Path("file.txt").write_text(foobar, encoding="utf8")` -FURB103.py:24:6: FURB103 `open` and `write` should be replaced by `Path("file.txt").write_text(foobar, encoding="utf8")` + --> FURB103.py:24:6 | 23 | # FURB103 24 | with open("file.txt", "w", encoding="utf8") as f: - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FURB103 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 25 | f.write(foobar) | +error[FURB103]: 28:6: `open` and `write` should be replaced by `Path("file.txt").write_text(foobar, errors="ignore")` -FURB103.py:28:6: FURB103 `open` and `write` should be replaced by `Path("file.txt").write_text(foobar, errors="ignore")` + --> FURB103.py:28:6 | 27 | # FURB103 28 | with open("file.txt", "w", errors="ignore") as f: - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FURB103 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 29 | f.write(foobar) | +error[FURB103]: 32:6: `open` and `write` should be replaced by `Path("file.txt").write_text(foobar)` -FURB103.py:32:6: FURB103 `open` and `write` should be replaced by `Path("file.txt").write_text(foobar)` + --> FURB103.py:32:6 | 31 | # FURB103 32 | with open("file.txt", mode="w") as f: - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FURB103 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 33 | f.write(foobar) | +error[FURB103]: 36:6: `open` and `write` should be replaced by `Path(foo()).write_bytes(bar())` -FURB103.py:36:6: FURB103 `open` and `write` should be replaced by `Path(foo()).write_bytes(bar())` + --> FURB103.py:36:6 | 35 | # FURB103 36 | with open(foo(), "wb") as f: - | ^^^^^^^^^^^^^^^^^^^^^^ FURB103 + | ^^^^^^^^^^^^^^^^^^^^^^ 37 | # The body of `with` is non-trivial, but the recommendation holds. 38 | bar("pre") | +error[FURB103]: 44:6: `open` and `write` should be replaced by `Path("a.txt").write_text(x)` -FURB103.py:44:6: FURB103 `open` and `write` should be replaced by `Path("a.txt").write_text(x)` + --> FURB103.py:44:6 | 43 | # FURB103 44 | with open("a.txt", "w") as a, open("b.txt", "wb") as b: - | ^^^^^^^^^^^^^^^^^^^^^^^ FURB103 + | ^^^^^^^^^^^^^^^^^^^^^^^ 45 | a.write(x) 46 | b.write(y) | +error[FURB103]: 44:31: `open` and `write` should be replaced by `Path("b.txt").write_bytes(y)` -FURB103.py:44:31: FURB103 `open` and `write` should be replaced by `Path("b.txt").write_bytes(y)` + --> FURB103.py:44:31 | 43 | # FURB103 44 | with open("a.txt", "w") as a, open("b.txt", "wb") as b: - | ^^^^^^^^^^^^^^^^^^^^^^^^ FURB103 + | ^^^^^^^^^^^^^^^^^^^^^^^^ 45 | a.write(x) 46 | b.write(y) | +error[FURB103]: 49:18: `open` and `write` should be replaced by `Path("file.txt").write_text(bar(bar(a + x)))` -FURB103.py:49:18: FURB103 `open` and `write` should be replaced by `Path("file.txt").write_text(bar(bar(a + x)))` + --> FURB103.py:49:18 | 48 | # FURB103 49 | with foo() as a, open("file.txt", "w") as b, foo() as c: - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ FURB103 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ 50 | # We have other things in here, multiple with items, but the user 51 | # writes a single time to file and that bit they can replace. | diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__PY39_RUF013_RUF013_0.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__PY39_RUF013_RUF013_0.py.snap index 562d78e313..fd885f232f 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__PY39_RUF013_RUF013_0.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__PY39_RUF013_RUF013_0.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs --- -error[RUF013]: RUF013_0.py:20:12: [*] PEP 484 prohibits implicit `Optional` +error[RUF013]: 20:12: [*] PEP 484 prohibits implicit `Optional` + --> RUF013_0.py:20:12 | 20 | def f(arg: int = None): # RUF013 | ^^^ @@ -19,8 +20,9 @@ error[RUF013]: RUF013_0.py:20:12: [*] PEP 484 prohibits implicit `Optional` 22 22 | 23 23 | -error[RUF013]: RUF013_0.py:24:12: [*] PEP 484 prohibits implicit `Optional` +error[RUF013]: 24:12: [*] PEP 484 prohibits implicit `Optional` + --> RUF013_0.py:24:12 | 24 | def f(arg: str = None): # RUF013 | ^^^ @@ -37,8 +39,9 @@ error[RUF013]: RUF013_0.py:24:12: [*] PEP 484 prohibits implicit `Optional` 26 26 | 27 27 | -error[RUF013]: RUF013_0.py:28:12: [*] PEP 484 prohibits implicit `Optional` +error[RUF013]: 28:12: [*] PEP 484 prohibits implicit `Optional` + --> RUF013_0.py:28:12 | 28 | def f(arg: Tuple[str] = None): # RUF013 | ^^^^^^^^^^ @@ -55,8 +58,9 @@ error[RUF013]: RUF013_0.py:28:12: [*] PEP 484 prohibits implicit `Optional` 30 30 | 31 31 | -error[RUF013]: RUF013_0.py:58:12: [*] PEP 484 prohibits implicit `Optional` +error[RUF013]: 58:12: [*] PEP 484 prohibits implicit `Optional` + --> RUF013_0.py:58:12 | 58 | def f(arg: Union = None): # RUF013 | ^^^^^ @@ -73,8 +77,9 @@ error[RUF013]: RUF013_0.py:58:12: [*] PEP 484 prohibits implicit `Optional` 60 60 | 61 61 | -error[RUF013]: RUF013_0.py:62:12: [*] PEP 484 prohibits implicit `Optional` +error[RUF013]: 62:12: [*] PEP 484 prohibits implicit `Optional` + --> RUF013_0.py:62:12 | 62 | def f(arg: Union[int] = None): # RUF013 | ^^^^^^^^^^ @@ -91,8 +96,9 @@ error[RUF013]: RUF013_0.py:62:12: [*] PEP 484 prohibits implicit `Optional` 64 64 | 65 65 | -error[RUF013]: RUF013_0.py:66:12: [*] PEP 484 prohibits implicit `Optional` +error[RUF013]: 66:12: [*] PEP 484 prohibits implicit `Optional` + --> RUF013_0.py:66:12 | 66 | def f(arg: Union[int, str] = None): # RUF013 | ^^^^^^^^^^^^^^^ @@ -109,8 +115,9 @@ error[RUF013]: RUF013_0.py:66:12: [*] PEP 484 prohibits implicit `Optional` 68 68 | 69 69 | -error[RUF013]: RUF013_0.py:85:12: [*] PEP 484 prohibits implicit `Optional` +error[RUF013]: 85:12: [*] PEP 484 prohibits implicit `Optional` + --> RUF013_0.py:85:12 | 85 | def f(arg: int | float = None): # RUF013 | ^^^^^^^^^^^ @@ -127,8 +134,9 @@ error[RUF013]: RUF013_0.py:85:12: [*] PEP 484 prohibits implicit `Optional` 87 87 | 88 88 | -error[RUF013]: RUF013_0.py:89:12: [*] PEP 484 prohibits implicit `Optional` +error[RUF013]: 89:12: [*] PEP 484 prohibits implicit `Optional` + --> RUF013_0.py:89:12 | 89 | def f(arg: int | float | str | bytes = None): # RUF013 | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -145,8 +153,9 @@ error[RUF013]: RUF013_0.py:89:12: [*] PEP 484 prohibits implicit `Optional` 91 91 | 92 92 | -error[RUF013]: RUF013_0.py:108:12: [*] PEP 484 prohibits implicit `Optional` +error[RUF013]: 108:12: [*] PEP 484 prohibits implicit `Optional` + --> RUF013_0.py:108:12 | 108 | def f(arg: Literal[1] = None): # RUF013 | ^^^^^^^^^^ @@ -163,8 +172,9 @@ error[RUF013]: RUF013_0.py:108:12: [*] PEP 484 prohibits implicit `Optional` 110 110 | 111 111 | -error[RUF013]: RUF013_0.py:112:12: [*] PEP 484 prohibits implicit `Optional` +error[RUF013]: 112:12: [*] PEP 484 prohibits implicit `Optional` + --> RUF013_0.py:112:12 | 112 | def f(arg: Literal[1, "foo"] = None): # RUF013 | ^^^^^^^^^^^^^^^^^ @@ -181,8 +191,9 @@ error[RUF013]: RUF013_0.py:112:12: [*] PEP 484 prohibits implicit `Optional` 114 114 | 115 115 | -error[RUF013]: RUF013_0.py:131:22: [*] PEP 484 prohibits implicit `Optional` +error[RUF013]: 131:22: [*] PEP 484 prohibits implicit `Optional` + --> RUF013_0.py:131:22 | 131 | def f(arg: Annotated[int, ...] = None): # RUF013 | ^^^ @@ -199,8 +210,9 @@ error[RUF013]: RUF013_0.py:131:22: [*] PEP 484 prohibits implicit `Optional` 133 133 | 134 134 | -error[RUF013]: RUF013_0.py:135:32: [*] PEP 484 prohibits implicit `Optional` +error[RUF013]: 135:32: [*] PEP 484 prohibits implicit `Optional` + --> RUF013_0.py:135:32 | 135 | def f(arg: Annotated[Annotated[int | str, ...], ...] = None): # RUF013 | ^^^^^^^^^ @@ -217,8 +229,9 @@ error[RUF013]: RUF013_0.py:135:32: [*] PEP 484 prohibits implicit `Optional` 137 137 | 138 138 | -error[RUF013]: RUF013_0.py:151:11: [*] PEP 484 prohibits implicit `Optional` +error[RUF013]: 151:11: [*] PEP 484 prohibits implicit `Optional` + --> RUF013_0.py:151:11 | 150 | def f( 151 | arg1: int = None, # RUF013 @@ -237,8 +250,9 @@ error[RUF013]: RUF013_0.py:151:11: [*] PEP 484 prohibits implicit `Optional` 153 153 | arg3: Literal[1, 2, 3] = None, # RUF013 154 154 | ): -error[RUF013]: RUF013_0.py:152:11: [*] PEP 484 prohibits implicit `Optional` +error[RUF013]: 152:11: [*] PEP 484 prohibits implicit `Optional` + --> RUF013_0.py:152:11 | 150 | def f( 151 | arg1: int = None, # RUF013 @@ -258,8 +272,9 @@ error[RUF013]: RUF013_0.py:152:11: [*] PEP 484 prohibits implicit `Optional` 154 154 | ): 155 155 | pass -error[RUF013]: RUF013_0.py:153:11: [*] PEP 484 prohibits implicit `Optional` +error[RUF013]: 153:11: [*] PEP 484 prohibits implicit `Optional` + --> RUF013_0.py:153:11 | 151 | arg1: int = None, # RUF013 152 | arg2: Union[int, float] = None, # RUF013 @@ -279,8 +294,9 @@ error[RUF013]: RUF013_0.py:153:11: [*] PEP 484 prohibits implicit `Optional` 155 155 | pass 156 156 | -error[RUF013]: RUF013_0.py:181:12: [*] PEP 484 prohibits implicit `Optional` +error[RUF013]: 181:12: [*] PEP 484 prohibits implicit `Optional` + --> RUF013_0.py:181:12 | 181 | def f(arg: Union[Annotated[int, ...], Union[str, bytes]] = None): # RUF013 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -297,8 +313,9 @@ error[RUF013]: RUF013_0.py:181:12: [*] PEP 484 prohibits implicit `Optional` 183 183 | 184 184 | -error[RUF013]: RUF013_0.py:188:13: [*] PEP 484 prohibits implicit `Optional` +error[RUF013]: 188:13: [*] PEP 484 prohibits implicit `Optional` + --> RUF013_0.py:188:13 | 188 | def f(arg: "int" = None): # RUF013 | ^^^ @@ -315,8 +332,9 @@ error[RUF013]: RUF013_0.py:188:13: [*] PEP 484 prohibits implicit `Optional` 190 190 | 191 191 | -error[RUF013]: RUF013_0.py:192:13: [*] PEP 484 prohibits implicit `Optional` +error[RUF013]: 192:13: [*] PEP 484 prohibits implicit `Optional` + --> RUF013_0.py:192:13 | 192 | def f(arg: "str" = None): # RUF013 | ^^^ @@ -333,16 +351,18 @@ error[RUF013]: RUF013_0.py:192:13: [*] PEP 484 prohibits implicit `Optional` 194 194 | 195 195 | -error[RUF013]: RUF013_0.py:196:12: PEP 484 prohibits implicit `Optional` +error[RUF013]: 196:12: PEP 484 prohibits implicit `Optional` + --> RUF013_0.py:196:12 | 196 | def f(arg: "st" "r" = None): # RUF013 | ^^^^^^^^ 197 | pass | = help: Convert to `Optional[T]` -error[RUF013]: RUF013_0.py:204:12: [*] PEP 484 prohibits implicit `Optional` +error[RUF013]: 204:12: [*] PEP 484 prohibits implicit `Optional` + --> RUF013_0.py:204:12 | 204 | def f(arg: Union["int", "str"] = None): # RUF013 | ^^^^^^^^^^^^^^^^^^^ diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__PY39_RUF013_RUF013_1.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__PY39_RUF013_RUF013_1.py.snap index e590bfb332..a78a41872a 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__PY39_RUF013_RUF013_1.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__PY39_RUF013_RUF013_1.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs --- -error[RUF013]: RUF013_1.py:4:12: [*] PEP 484 prohibits implicit `Optional` +error[RUF013]: 4:12: [*] PEP 484 prohibits implicit `Optional` + --> RUF013_1.py:4:12 | 4 | def f(arg: int = None): # RUF013 | ^^^ diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF005_RUF005.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF005_RUF005.py.snap index d23bc9c4f4..78829e8b09 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF005_RUF005.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF005_RUF005.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs --- -error[RUF005]: RUF005.py:4:1: Consider `[*foo]` instead of concatenation +error[RUF005]: 4:1: Consider `[*foo]` instead of concatenation + --> RUF005.py:3:4 | 2 | # Non-fixable Errors. 3 | ### @@ -13,8 +14,9 @@ error[RUF005]: RUF005.py:4:1: Consider `[*foo]` instead of concatenation 7 | ] | = help: Replace with `[*foo]` -error[RUF005]: RUF005.py:6:1: Consider `[*foo]` instead of concatenation +error[RUF005]: 6:1: Consider `[*foo]` instead of concatenation + --> RUF005.py:5:2 | 4 | foo + [ # This will be preserved. 5 | ] @@ -25,8 +27,9 @@ error[RUF005]: RUF005.py:6:1: Consider `[*foo]` instead of concatenation 9 | # The order | = help: Replace with `[*foo]` -error[RUF005]: RUF005.py:16:10: Consider `[*first, 4, 5, 6]` instead of concatenation +error[RUF005]: 16:10: Consider `[*first, 4, 5, 6]` instead of concatenation + --> RUF005.py:16:10 | 14 | # to preserve 15 | ] @@ -42,8 +45,9 @@ error[RUF005]: RUF005.py:16:10: Consider `[*first, 4, 5, 6]` instead of concaten | |_^ | = help: Replace with `[*first, 4, 5, 6]` -error[RUF005]: RUF005.py:39:7: [*] Consider `[1, 2, 3, *foo]` instead of concatenation +error[RUF005]: 39:7: [*] Consider `[1, 2, 3, *foo]` instead of concatenation + --> RUF005.py:39:7 | 38 | foo = [4, 5, 6] 39 | bar = [1, 2, 3] + foo @@ -62,8 +66,9 @@ error[RUF005]: RUF005.py:39:7: [*] Consider `[1, 2, 3, *foo]` instead of concate 41 41 | quux = (7, 8, 9) + zoob 42 42 | spam = quux + (10, 11, 12) -error[RUF005]: RUF005.py:41:8: [*] Consider `(7, 8, 9, *zoob)` instead of concatenation +error[RUF005]: 41:8: [*] Consider `(7, 8, 9, *zoob)` instead of concatenation + --> RUF005.py:41:8 | 39 | bar = [1, 2, 3] + foo 40 | zoob = tuple(bar) @@ -83,8 +88,9 @@ error[RUF005]: RUF005.py:41:8: [*] Consider `(7, 8, 9, *zoob)` instead of concat 43 43 | spom = list(spam) 44 44 | eggs = spom + [13, 14, 15] -error[RUF005]: RUF005.py:42:8: [*] Consider `(*quux, 10, 11, 12)` instead of concatenation +error[RUF005]: 42:8: [*] Consider `(*quux, 10, 11, 12)` instead of concatenation + --> RUF005.py:42:8 | 40 | zoob = tuple(bar) 41 | quux = (7, 8, 9) + zoob @@ -104,8 +110,9 @@ error[RUF005]: RUF005.py:42:8: [*] Consider `(*quux, 10, 11, 12)` instead of con 44 44 | eggs = spom + [13, 14, 15] 45 45 | elatement = ("we all say",) + yay() -error[RUF005]: RUF005.py:44:8: [*] Consider `[*spom, 13, 14, 15]` instead of concatenation +error[RUF005]: 44:8: [*] Consider `[*spom, 13, 14, 15]` instead of concatenation + --> RUF005.py:44:8 | 42 | spam = quux + (10, 11, 12) 43 | spom = list(spam) @@ -125,8 +132,9 @@ error[RUF005]: RUF005.py:44:8: [*] Consider `[*spom, 13, 14, 15]` instead of con 46 46 | excitement = ("we all think",) + Fun().yay() 47 47 | astonishment = ("we all feel",) + Fun.words -error[RUF005]: RUF005.py:45:13: [*] Consider `("we all say", *yay())` instead of concatenation +error[RUF005]: 45:13: [*] Consider `("we all say", *yay())` instead of concatenation + --> RUF005.py:45:13 | 43 | spom = list(spam) 44 | eggs = spom + [13, 14, 15] @@ -146,8 +154,9 @@ error[RUF005]: RUF005.py:45:13: [*] Consider `("we all say", *yay())` instead of 47 47 | astonishment = ("we all feel",) + Fun.words 48 48 | -error[RUF005]: RUF005.py:46:14: [*] Consider `("we all think", *Fun().yay())` instead of concatenation +error[RUF005]: 46:14: [*] Consider `("we all think", *Fun().yay())` instead of concatenation + --> RUF005.py:46:14 | 44 | eggs = spom + [13, 14, 15] 45 | elatement = ("we all say",) + yay() @@ -166,8 +175,9 @@ error[RUF005]: RUF005.py:46:14: [*] Consider `("we all think", *Fun().yay())` in 48 48 | 49 49 | chain = ["a", "b", "c"] + eggs + list(("yes", "no", "pants") + zoob) -error[RUF005]: RUF005.py:47:16: [*] Consider `("we all feel", *Fun.words)` instead of concatenation +error[RUF005]: 47:16: [*] Consider `("we all feel", *Fun.words)` instead of concatenation + --> RUF005.py:47:16 | 45 | elatement = ("we all say",) + yay() 46 | excitement = ("we all think",) + Fun().yay() @@ -187,8 +197,9 @@ error[RUF005]: RUF005.py:47:16: [*] Consider `("we all feel", *Fun.words)` inste 49 49 | chain = ["a", "b", "c"] + eggs + list(("yes", "no", "pants") + zoob) 50 50 | -error[RUF005]: RUF005.py:49:9: [*] Consider iterable unpacking instead of concatenation +error[RUF005]: 49:9: [*] Consider iterable unpacking instead of concatenation + --> RUF005.py:49:9 | 47 | astonishment = ("we all feel",) + Fun.words 48 | @@ -208,8 +219,9 @@ error[RUF005]: RUF005.py:49:9: [*] Consider iterable unpacking instead of concat 51 51 | baz = () + zoob 52 52 | -error[RUF005]: RUF005.py:49:39: [*] Consider `("yes", "no", "pants", *zoob)` instead of concatenation +error[RUF005]: 49:39: [*] Consider `("yes", "no", "pants", *zoob)` instead of concatenation + --> RUF005.py:49:39 | 47 | astonishment = ("we all feel",) + Fun.words 48 | @@ -229,8 +241,9 @@ error[RUF005]: RUF005.py:49:39: [*] Consider `("yes", "no", "pants", *zoob)` ins 51 51 | baz = () + zoob 52 52 | -error[RUF005]: RUF005.py:51:7: [*] Consider `(*zoob,)` instead of concatenation +error[RUF005]: 51:7: [*] Consider `(*zoob,)` instead of concatenation + --> RUF005.py:51:7 | 49 | chain = ["a", "b", "c"] + eggs + list(("yes", "no", "pants") + zoob) 50 | @@ -250,8 +263,9 @@ error[RUF005]: RUF005.py:51:7: [*] Consider `(*zoob,)` instead of concatenation 53 53 | [] + foo + [ 54 54 | ] -error[RUF005]: RUF005.py:53:1: [*] Consider `[*foo]` instead of concatenation +error[RUF005]: 53:1: [*] Consider `[*foo]` instead of concatenation + --> RUF005.py:52:1 | 51 | baz = () + zoob 52 | @@ -273,8 +287,9 @@ error[RUF005]: RUF005.py:53:1: [*] Consider `[*foo]` instead of concatenation 56 55 | pylint_call = [sys.executable, "-m", "pylint"] + args + [path] 57 56 | pylint_call_tuple = (sys.executable, "-m", "pylint") + args + (path, path2) -error[RUF005]: RUF005.py:56:15: [*] Consider `[sys.executable, "-m", "pylint", *args, path]` instead of concatenation +error[RUF005]: 56:15: [*] Consider `[sys.executable, "-m", "pylint", *args, path]` instead of concatenation + --> RUF005.py:56:15 | 54 | ] 55 | @@ -294,8 +309,9 @@ error[RUF005]: RUF005.py:56:15: [*] Consider `[sys.executable, "-m", "pylint", * 58 58 | b = a + [2, 3] + [4] 59 59 | -error[RUF005]: RUF005.py:57:21: [*] Consider iterable unpacking instead of concatenation +error[RUF005]: 57:21: [*] Consider iterable unpacking instead of concatenation + --> RUF005.py:57:21 | 56 | pylint_call = [sys.executable, "-m", "pylint"] + args + [path] 57 | pylint_call_tuple = (sys.executable, "-m", "pylint") + args + (path, path2) @@ -313,8 +329,9 @@ error[RUF005]: RUF005.py:57:21: [*] Consider iterable unpacking instead of conca 59 59 | 60 60 | # Uses the non-preferred quote style, which should be retained. -error[RUF005]: RUF005.py:58:5: [*] Consider `[*a, 2, 3, 4]` instead of concatenation +error[RUF005]: 58:5: [*] Consider `[*a, 2, 3, 4]` instead of concatenation + --> RUF005.py:58:5 | 56 | pylint_call = [sys.executable, "-m", "pylint"] + args + [path] 57 | pylint_call_tuple = (sys.executable, "-m", "pylint") + args + (path, path2) @@ -334,8 +351,9 @@ error[RUF005]: RUF005.py:58:5: [*] Consider `[*a, 2, 3, 4]` instead of concatena 60 60 | # Uses the non-preferred quote style, which should be retained. 61 61 | f"{a() + ['b']}" -error[RUF005]: RUF005.py:61:4: [*] Consider `[*a(), 'b']` instead of concatenation +error[RUF005]: 61:4: [*] Consider `[*a(), 'b']` instead of concatenation + --> RUF005.py:61:4 | 60 | # Uses the non-preferred quote style, which should be retained. 61 | f"{a() + ['b']}" diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF006_RUF006.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF006_RUF006.py.snap index dcc832329a..d5e8027821 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF006_RUF006.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF006_RUF006.py.snap @@ -1,48 +1,54 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs --- -error[RUF006]: RUF006.py:6:5: Store a reference to the return value of `asyncio.create_task` +error[RUF006]: 6:5: Store a reference to the return value of `asyncio.create_task` + --> RUF006.py:6:5 | 4 | # Error 5 | def f(): 6 | asyncio.create_task(coordinator.ws_connect()) # Error | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -error[RUF006]: RUF006.py:11:5: Store a reference to the return value of `asyncio.ensure_future` +error[RUF006]: 11:5: Store a reference to the return value of `asyncio.ensure_future` + --> RUF006.py:11:5 | 9 | # Error 10 | def f(): 11 | asyncio.ensure_future(coordinator.ws_connect()) # Error | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -error[RUF006]: RUF006.py:68:12: Store a reference to the return value of `asyncio.create_task` +error[RUF006]: 68:12: Store a reference to the return value of `asyncio.create_task` + --> RUF006.py:68:12 | 66 | # Error 67 | def f(): 68 | task = asyncio.create_task(coordinator.ws_connect()) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -error[RUF006]: RUF006.py:74:26: Store a reference to the return value of `loop.create_task` +error[RUF006]: 74:26: Store a reference to the return value of `loop.create_task` + --> RUF006.py:74:26 | 72 | def f(): 73 | loop = asyncio.get_running_loop() 74 | task: asyncio.Task = loop.create_task(coordinator.ws_connect()) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -error[RUF006]: RUF006.py:97:5: Store a reference to the return value of `loop.create_task` +error[RUF006]: 97:5: Store a reference to the return value of `loop.create_task` + --> RUF006.py:97:5 | 95 | def f(): 96 | loop = asyncio.get_running_loop() 97 | loop.create_task(coordinator.ws_connect()) # Error | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -error[RUF006]: RUF006.py:152:13: Store a reference to the return value of `asyncio.create_task` +error[RUF006]: 152:13: Store a reference to the return value of `asyncio.create_task` + --> RUF006.py:152:13 | 150 | async def f(x: bool): 151 | if x: @@ -51,8 +57,9 @@ error[RUF006]: RUF006.py:152:13: Store a reference to the return value of `async 153 | else: 154 | t = None | -error[RUF006]: RUF006.py:170:5: Store a reference to the return value of `loop.create_task` +error[RUF006]: 170:5: Store a reference to the return value of `loop.create_task` + --> RUF006.py:170:5 | 168 | def f(): 169 | loop = asyncio.new_event_loop() @@ -61,8 +68,9 @@ error[RUF006]: RUF006.py:170:5: Store a reference to the return value of `loop.c 171 | 172 | # Error | -error[RUF006]: RUF006.py:175:5: Store a reference to the return value of `loop.create_task` +error[RUF006]: 175:5: Store a reference to the return value of `loop.create_task` + --> RUF006.py:175:5 | 173 | def f(): 174 | loop = asyncio.get_event_loop() diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF007_RUF007.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF007_RUF007.py.snap index 653760b026..aa5eaf929b 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF007_RUF007.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF007_RUF007.py.snap @@ -1,108 +1,119 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs --- -RUF007.py:16:1: RUF007 Prefer `itertools.pairwise()` over `zip()` when iterating over successive pairs +error[RUF007]: 16:1: Prefer `itertools.pairwise()` over `zip()` when iterating over successive pairs + + --> RUF007.py:15:9 | 15 | # Errors 16 | zip(input, input[1:]) - | ^^^ RUF007 + | ^^^ 17 | zip(input, input[1::1]) 18 | zip(input[:-1], input[1:]) | = help: Replace `zip()` with `itertools.pairwise()` +error[RUF007]: 17:1: Prefer `itertools.pairwise()` over `zip()` when iterating over successive pairs -RUF007.py:17:1: RUF007 Prefer `itertools.pairwise()` over `zip()` when iterating over successive pairs + --> RUF007.py:16:22 | 15 | # Errors 16 | zip(input, input[1:]) 17 | zip(input, input[1::1]) - | ^^^ RUF007 + | ^^^ 18 | zip(input[:-1], input[1:]) 19 | zip(input[1:], input[2:]) | = help: Replace `zip()` with `itertools.pairwise()` +error[RUF007]: 18:1: Prefer `itertools.pairwise()` over `zip()` when iterating over successive pairs -RUF007.py:18:1: RUF007 Prefer `itertools.pairwise()` over `zip()` when iterating over successive pairs + --> RUF007.py:17:24 | 16 | zip(input, input[1:]) 17 | zip(input, input[1::1]) 18 | zip(input[:-1], input[1:]) - | ^^^ RUF007 + | ^^^ 19 | zip(input[1:], input[2:]) 20 | zip(input[1:-1], input[2:]) | = help: Replace `zip()` with `itertools.pairwise()` +error[RUF007]: 19:1: Prefer `itertools.pairwise()` over `zip()` when iterating over successive pairs -RUF007.py:19:1: RUF007 Prefer `itertools.pairwise()` over `zip()` when iterating over successive pairs + --> RUF007.py:18:27 | 17 | zip(input, input[1::1]) 18 | zip(input[:-1], input[1:]) 19 | zip(input[1:], input[2:]) - | ^^^ RUF007 + | ^^^ 20 | zip(input[1:-1], input[2:]) 21 | list(zip(input, input[1:])) | = help: Replace `zip()` with `itertools.pairwise()` +error[RUF007]: 20:1: Prefer `itertools.pairwise()` over `zip()` when iterating over successive pairs -RUF007.py:20:1: RUF007 Prefer `itertools.pairwise()` over `zip()` when iterating over successive pairs + --> RUF007.py:19:26 | 18 | zip(input[:-1], input[1:]) 19 | zip(input[1:], input[2:]) 20 | zip(input[1:-1], input[2:]) - | ^^^ RUF007 + | ^^^ 21 | list(zip(input, input[1:])) 22 | list(zip(input[:-1], input[1:])) | = help: Replace `zip()` with `itertools.pairwise()` +error[RUF007]: 21:6: Prefer `itertools.pairwise()` over `zip()` when iterating over successive pairs -RUF007.py:21:6: RUF007 Prefer `itertools.pairwise()` over `zip()` when iterating over successive pairs + --> RUF007.py:21:6 | 19 | zip(input[1:], input[2:]) 20 | zip(input[1:-1], input[2:]) 21 | list(zip(input, input[1:])) - | ^^^ RUF007 + | ^^^ 22 | list(zip(input[:-1], input[1:])) 23 | zip(foo[:-1], foo[1:], strict=True) | = help: Replace `zip()` with `itertools.pairwise()` +error[RUF007]: 22:6: Prefer `itertools.pairwise()` over `zip()` when iterating over successive pairs -RUF007.py:22:6: RUF007 Prefer `itertools.pairwise()` over `zip()` when iterating over successive pairs + --> RUF007.py:22:6 | 20 | zip(input[1:-1], input[2:]) 21 | list(zip(input, input[1:])) 22 | list(zip(input[:-1], input[1:])) - | ^^^ RUF007 + | ^^^ 23 | zip(foo[:-1], foo[1:], strict=True) 24 | zip(foo[:-1], foo[1:], strict=False) | = help: Replace `zip()` with `itertools.pairwise()` +error[RUF007]: 23:1: Prefer `itertools.pairwise()` over `zip()` when iterating over successive pairs -RUF007.py:23:1: RUF007 Prefer `itertools.pairwise()` over `zip()` when iterating over successive pairs + --> RUF007.py:22:33 | 21 | list(zip(input, input[1:])) 22 | list(zip(input[:-1], input[1:])) 23 | zip(foo[:-1], foo[1:], strict=True) - | ^^^ RUF007 + | ^^^ 24 | zip(foo[:-1], foo[1:], strict=False) 25 | zip(foo[:-1], foo[1:], strict=bool(foo)) | = help: Replace `zip()` with `itertools.pairwise()` +error[RUF007]: 24:1: Prefer `itertools.pairwise()` over `zip()` when iterating over successive pairs -RUF007.py:24:1: RUF007 Prefer `itertools.pairwise()` over `zip()` when iterating over successive pairs + --> RUF007.py:23:36 | 22 | list(zip(input[:-1], input[1:])) 23 | zip(foo[:-1], foo[1:], strict=True) 24 | zip(foo[:-1], foo[1:], strict=False) - | ^^^ RUF007 + | ^^^ 25 | zip(foo[:-1], foo[1:], strict=bool(foo)) | = help: Replace `zip()` with `itertools.pairwise()` +error[RUF007]: 25:1: Prefer `itertools.pairwise()` over `zip()` when iterating over successive pairs -RUF007.py:25:1: RUF007 Prefer `itertools.pairwise()` over `zip()` when iterating over successive pairs + --> RUF007.py:24:37 | 23 | zip(foo[:-1], foo[1:], strict=True) 24 | zip(foo[:-1], foo[1:], strict=False) 25 | zip(foo[:-1], foo[1:], strict=bool(foo)) - | ^^^ RUF007 + | ^^^ | = help: Replace `zip()` with `itertools.pairwise()` diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF008_RUF008.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF008_RUF008.py.snap index 6375abbad1..b33e882d44 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF008_RUF008.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF008_RUF008.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs --- -error[RUF008]: RUF008.py:10:34: Do not use mutable default values for dataclass attributes +error[RUF008]: 10:34: Do not use mutable default values for dataclass attributes + --> RUF008.py:10:34 | 8 | @dataclass 9 | class A: @@ -11,8 +12,9 @@ error[RUF008]: RUF008.py:10:34: Do not use mutable default values for dataclass 11 | immutable_annotation: typing.Sequence[int] = [] 12 | without_annotation = [] | -error[RUF008]: RUF008.py:20:34: Do not use mutable default values for dataclass attributes +error[RUF008]: 20:34: Do not use mutable default values for dataclass attributes + --> RUF008.py:20:34 | 18 | @dataclass 19 | class B: diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF009_RUF009.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF009_RUF009.py.snap index 72c80a2d1a..9671920be5 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF009_RUF009.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF009_RUF009.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs --- -error[RUF009]: RUF009.py:20:41: Do not perform function call `default_function` in dataclass defaults +error[RUF009]: 20:41: Do not perform function call `default_function` in dataclass defaults + --> RUF009.py:20:41 | 18 | @dataclass() 19 | class A: @@ -11,8 +12,9 @@ error[RUF009]: RUF009.py:20:41: Do not perform function call `default_function` 21 | class_variable: typing.ClassVar[list[int]] = default_function() 22 | another_class_var: ClassVar[list[int]] = default_function() | -error[RUF009]: RUF009.py:43:41: Do not perform function call `default_function` in dataclass defaults +error[RUF009]: 43:41: Do not perform function call `default_function` in dataclass defaults + --> RUF009.py:43:41 | 41 | @dataclass 42 | class B: @@ -21,8 +23,9 @@ error[RUF009]: RUF009.py:43:41: Do not perform function call `default_function` 44 | another_dataclass: A = A() 45 | not_optimal: ImmutableType = ImmutableType(20) | -error[RUF009]: RUF009.py:44:28: Do not perform function call `A` in dataclass defaults +error[RUF009]: 44:28: Do not perform function call `A` in dataclass defaults + --> RUF009.py:44:28 | 42 | class B: 43 | hidden_mutable_default: list[int] = default_function() @@ -31,8 +34,9 @@ error[RUF009]: RUF009.py:44:28: Do not perform function call `A` in dataclass de 45 | not_optimal: ImmutableType = ImmutableType(20) 46 | good_variant: ImmutableType = DEFAULT_IMMUTABLETYPE_FOR_ALL_DATACLASSES | -error[RUF009]: RUF009.py:45:34: Do not perform function call `ImmutableType` in dataclass defaults +error[RUF009]: 45:34: Do not perform function call `ImmutableType` in dataclass defaults + --> RUF009.py:45:34 | 43 | hidden_mutable_default: list[int] = default_function() 44 | another_dataclass: A = A() diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF010_RUF010.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF010_RUF010.py.snap index 5755c35f3a..1c6c2aa1ae 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF010_RUF010.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF010_RUF010.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs --- -error[RUF010]: RUF010.py:9:4: [*] Use explicit conversion flag +error[RUF010]: 9:4: [*] Use explicit conversion flag + --> RUF010.py:9:4 | 9 | f"{str(bla)}, {repr(bla)}, {ascii(bla)}" # RUF010 | ^^^^^^^^ @@ -20,8 +21,9 @@ error[RUF010]: RUF010.py:9:4: [*] Use explicit conversion flag 11 11 | f"{str(d['a'])}, {repr(d['b'])}, {ascii(d['c'])}" # RUF010 12 12 | -error[RUF010]: RUF010.py:9:16: [*] Use explicit conversion flag +error[RUF010]: 9:16: [*] Use explicit conversion flag + --> RUF010.py:9:16 | 9 | f"{str(bla)}, {repr(bla)}, {ascii(bla)}" # RUF010 | ^^^^^^^^^ @@ -39,8 +41,9 @@ error[RUF010]: RUF010.py:9:16: [*] Use explicit conversion flag 11 11 | f"{str(d['a'])}, {repr(d['b'])}, {ascii(d['c'])}" # RUF010 12 12 | -error[RUF010]: RUF010.py:9:29: [*] Use explicit conversion flag +error[RUF010]: 9:29: [*] Use explicit conversion flag + --> RUF010.py:9:29 | 9 | f"{str(bla)}, {repr(bla)}, {ascii(bla)}" # RUF010 | ^^^^^^^^^^ @@ -58,8 +61,9 @@ error[RUF010]: RUF010.py:9:29: [*] Use explicit conversion flag 11 11 | f"{str(d['a'])}, {repr(d['b'])}, {ascii(d['c'])}" # RUF010 12 12 | -error[RUF010]: RUF010.py:11:4: [*] Use explicit conversion flag +error[RUF010]: 11:4: [*] Use explicit conversion flag + --> RUF010.py:11:4 | 9 | f"{str(bla)}, {repr(bla)}, {ascii(bla)}" # RUF010 10 | @@ -79,8 +83,9 @@ error[RUF010]: RUF010.py:11:4: [*] Use explicit conversion flag 13 13 | f"{(str(bla))}, {(repr(bla))}, {(ascii(bla))}" # RUF010 14 14 | -error[RUF010]: RUF010.py:11:19: [*] Use explicit conversion flag +error[RUF010]: 11:19: [*] Use explicit conversion flag + --> RUF010.py:11:19 | 9 | f"{str(bla)}, {repr(bla)}, {ascii(bla)}" # RUF010 10 | @@ -100,8 +105,9 @@ error[RUF010]: RUF010.py:11:19: [*] Use explicit conversion flag 13 13 | f"{(str(bla))}, {(repr(bla))}, {(ascii(bla))}" # RUF010 14 14 | -error[RUF010]: RUF010.py:11:35: [*] Use explicit conversion flag +error[RUF010]: 11:35: [*] Use explicit conversion flag + --> RUF010.py:11:35 | 9 | f"{str(bla)}, {repr(bla)}, {ascii(bla)}" # RUF010 10 | @@ -121,8 +127,9 @@ error[RUF010]: RUF010.py:11:35: [*] Use explicit conversion flag 13 13 | f"{(str(bla))}, {(repr(bla))}, {(ascii(bla))}" # RUF010 14 14 | -error[RUF010]: RUF010.py:13:5: [*] Use explicit conversion flag +error[RUF010]: 13:5: [*] Use explicit conversion flag + --> RUF010.py:13:5 | 11 | f"{str(d['a'])}, {repr(d['b'])}, {ascii(d['c'])}" # RUF010 12 | @@ -142,8 +149,9 @@ error[RUF010]: RUF010.py:13:5: [*] Use explicit conversion flag 15 15 | f"{bla!s}, {(repr(bla))}, {(ascii(bla))}" # RUF010 16 16 | -error[RUF010]: RUF010.py:13:19: [*] Use explicit conversion flag +error[RUF010]: 13:19: [*] Use explicit conversion flag + --> RUF010.py:13:19 | 11 | f"{str(d['a'])}, {repr(d['b'])}, {ascii(d['c'])}" # RUF010 12 | @@ -163,8 +171,9 @@ error[RUF010]: RUF010.py:13:19: [*] Use explicit conversion flag 15 15 | f"{bla!s}, {(repr(bla))}, {(ascii(bla))}" # RUF010 16 16 | -error[RUF010]: RUF010.py:13:34: [*] Use explicit conversion flag +error[RUF010]: 13:34: [*] Use explicit conversion flag + --> RUF010.py:13:34 | 11 | f"{str(d['a'])}, {repr(d['b'])}, {ascii(d['c'])}" # RUF010 12 | @@ -184,8 +193,9 @@ error[RUF010]: RUF010.py:13:34: [*] Use explicit conversion flag 15 15 | f"{bla!s}, {(repr(bla))}, {(ascii(bla))}" # RUF010 16 16 | -error[RUF010]: RUF010.py:15:14: [*] Use explicit conversion flag +error[RUF010]: 15:14: [*] Use explicit conversion flag + --> RUF010.py:15:14 | 13 | f"{(str(bla))}, {(repr(bla))}, {(ascii(bla))}" # RUF010 14 | @@ -205,8 +215,9 @@ error[RUF010]: RUF010.py:15:14: [*] Use explicit conversion flag 17 17 | f"{foo(bla)}" # OK 18 18 | -error[RUF010]: RUF010.py:15:29: [*] Use explicit conversion flag +error[RUF010]: 15:29: [*] Use explicit conversion flag + --> RUF010.py:15:29 | 13 | f"{(str(bla))}, {(repr(bla))}, {(ascii(bla))}" # RUF010 14 | @@ -226,8 +237,9 @@ error[RUF010]: RUF010.py:15:29: [*] Use explicit conversion flag 17 17 | f"{foo(bla)}" # OK 18 18 | -error[RUF010]: RUF010.py:35:20: [*] Use explicit conversion flag +error[RUF010]: 35:20: [*] Use explicit conversion flag + --> RUF010.py:35:20 | 33 | f"Member of tuple mismatches type at index {i}. Expected {of_shape_i}. Got " 34 | " intermediary content " diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF012_RUF012.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF012_RUF012.py.snap index 863935644e..fbc1b34b31 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF012_RUF012.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF012_RUF012.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs --- -error[RUF012]: RUF012.py:9:34: Mutable class attributes should be annotated with `typing.ClassVar` +error[RUF012]: 9:34: Mutable class attributes should be annotated with `typing.ClassVar` + --> RUF012.py:9:34 | 7 | } 8 | @@ -11,8 +12,9 @@ error[RUF012]: RUF012.py:9:34: Mutable class attributes should be annotated with 10 | immutable_annotation: Sequence[int] = [] 11 | without_annotation = [] | -error[RUF012]: RUF012.py:11:26: Mutable class attributes should be annotated with `typing.ClassVar` +error[RUF012]: 11:26: Mutable class attributes should be annotated with `typing.ClassVar` + --> RUF012.py:11:26 | 9 | mutable_default: list[int] = [] 10 | immutable_annotation: Sequence[int] = [] @@ -21,8 +23,9 @@ error[RUF012]: RUF012.py:11:26: Mutable class attributes should be annotated wit 12 | class_variable: ClassVar[list[int]] = [] 13 | final_variable: Final[list[int]] = [] | -error[RUF012]: RUF012.py:25:26: Mutable class attributes should be annotated with `typing.ClassVar` +error[RUF012]: 25:26: Mutable class attributes should be annotated with `typing.ClassVar` + --> RUF012.py:25:26 | 23 | mutable_default: list[int] = [] 24 | immutable_annotation: Sequence[int] = [] diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF013_RUF013_0.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF013_RUF013_0.py.snap index eff5fe7418..bdd13345e3 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF013_RUF013_0.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF013_RUF013_0.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs --- -error[RUF013]: RUF013_0.py:20:12: [*] PEP 484 prohibits implicit `Optional` +error[RUF013]: 20:12: [*] PEP 484 prohibits implicit `Optional` + --> RUF013_0.py:20:12 | 20 | def f(arg: int = None): # RUF013 | ^^^ @@ -19,8 +20,9 @@ error[RUF013]: RUF013_0.py:20:12: [*] PEP 484 prohibits implicit `Optional` 22 22 | 23 23 | -error[RUF013]: RUF013_0.py:24:12: [*] PEP 484 prohibits implicit `Optional` +error[RUF013]: 24:12: [*] PEP 484 prohibits implicit `Optional` + --> RUF013_0.py:24:12 | 24 | def f(arg: str = None): # RUF013 | ^^^ @@ -37,8 +39,9 @@ error[RUF013]: RUF013_0.py:24:12: [*] PEP 484 prohibits implicit `Optional` 26 26 | 27 27 | -error[RUF013]: RUF013_0.py:28:12: [*] PEP 484 prohibits implicit `Optional` +error[RUF013]: 28:12: [*] PEP 484 prohibits implicit `Optional` + --> RUF013_0.py:28:12 | 28 | def f(arg: Tuple[str] = None): # RUF013 | ^^^^^^^^^^ @@ -55,8 +58,9 @@ error[RUF013]: RUF013_0.py:28:12: [*] PEP 484 prohibits implicit `Optional` 30 30 | 31 31 | -error[RUF013]: RUF013_0.py:58:12: [*] PEP 484 prohibits implicit `Optional` +error[RUF013]: 58:12: [*] PEP 484 prohibits implicit `Optional` + --> RUF013_0.py:58:12 | 58 | def f(arg: Union = None): # RUF013 | ^^^^^ @@ -73,8 +77,9 @@ error[RUF013]: RUF013_0.py:58:12: [*] PEP 484 prohibits implicit `Optional` 60 60 | 61 61 | -error[RUF013]: RUF013_0.py:62:12: [*] PEP 484 prohibits implicit `Optional` +error[RUF013]: 62:12: [*] PEP 484 prohibits implicit `Optional` + --> RUF013_0.py:62:12 | 62 | def f(arg: Union[int] = None): # RUF013 | ^^^^^^^^^^ @@ -91,8 +96,9 @@ error[RUF013]: RUF013_0.py:62:12: [*] PEP 484 prohibits implicit `Optional` 64 64 | 65 65 | -error[RUF013]: RUF013_0.py:66:12: [*] PEP 484 prohibits implicit `Optional` +error[RUF013]: 66:12: [*] PEP 484 prohibits implicit `Optional` + --> RUF013_0.py:66:12 | 66 | def f(arg: Union[int, str] = None): # RUF013 | ^^^^^^^^^^^^^^^ @@ -109,8 +115,9 @@ error[RUF013]: RUF013_0.py:66:12: [*] PEP 484 prohibits implicit `Optional` 68 68 | 69 69 | -error[RUF013]: RUF013_0.py:85:12: [*] PEP 484 prohibits implicit `Optional` +error[RUF013]: 85:12: [*] PEP 484 prohibits implicit `Optional` + --> RUF013_0.py:85:12 | 85 | def f(arg: int | float = None): # RUF013 | ^^^^^^^^^^^ @@ -127,8 +134,9 @@ error[RUF013]: RUF013_0.py:85:12: [*] PEP 484 prohibits implicit `Optional` 87 87 | 88 88 | -error[RUF013]: RUF013_0.py:89:12: [*] PEP 484 prohibits implicit `Optional` +error[RUF013]: 89:12: [*] PEP 484 prohibits implicit `Optional` + --> RUF013_0.py:89:12 | 89 | def f(arg: int | float | str | bytes = None): # RUF013 | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -145,8 +153,9 @@ error[RUF013]: RUF013_0.py:89:12: [*] PEP 484 prohibits implicit `Optional` 91 91 | 92 92 | -error[RUF013]: RUF013_0.py:108:12: [*] PEP 484 prohibits implicit `Optional` +error[RUF013]: 108:12: [*] PEP 484 prohibits implicit `Optional` + --> RUF013_0.py:108:12 | 108 | def f(arg: Literal[1] = None): # RUF013 | ^^^^^^^^^^ @@ -163,8 +172,9 @@ error[RUF013]: RUF013_0.py:108:12: [*] PEP 484 prohibits implicit `Optional` 110 110 | 111 111 | -error[RUF013]: RUF013_0.py:112:12: [*] PEP 484 prohibits implicit `Optional` +error[RUF013]: 112:12: [*] PEP 484 prohibits implicit `Optional` + --> RUF013_0.py:112:12 | 112 | def f(arg: Literal[1, "foo"] = None): # RUF013 | ^^^^^^^^^^^^^^^^^ @@ -181,8 +191,9 @@ error[RUF013]: RUF013_0.py:112:12: [*] PEP 484 prohibits implicit `Optional` 114 114 | 115 115 | -error[RUF013]: RUF013_0.py:131:22: [*] PEP 484 prohibits implicit `Optional` +error[RUF013]: 131:22: [*] PEP 484 prohibits implicit `Optional` + --> RUF013_0.py:131:22 | 131 | def f(arg: Annotated[int, ...] = None): # RUF013 | ^^^ @@ -199,8 +210,9 @@ error[RUF013]: RUF013_0.py:131:22: [*] PEP 484 prohibits implicit `Optional` 133 133 | 134 134 | -error[RUF013]: RUF013_0.py:135:32: [*] PEP 484 prohibits implicit `Optional` +error[RUF013]: 135:32: [*] PEP 484 prohibits implicit `Optional` + --> RUF013_0.py:135:32 | 135 | def f(arg: Annotated[Annotated[int | str, ...], ...] = None): # RUF013 | ^^^^^^^^^ @@ -217,8 +229,9 @@ error[RUF013]: RUF013_0.py:135:32: [*] PEP 484 prohibits implicit `Optional` 137 137 | 138 138 | -error[RUF013]: RUF013_0.py:151:11: [*] PEP 484 prohibits implicit `Optional` +error[RUF013]: 151:11: [*] PEP 484 prohibits implicit `Optional` + --> RUF013_0.py:151:11 | 150 | def f( 151 | arg1: int = None, # RUF013 @@ -237,8 +250,9 @@ error[RUF013]: RUF013_0.py:151:11: [*] PEP 484 prohibits implicit `Optional` 153 153 | arg3: Literal[1, 2, 3] = None, # RUF013 154 154 | ): -error[RUF013]: RUF013_0.py:152:11: [*] PEP 484 prohibits implicit `Optional` +error[RUF013]: 152:11: [*] PEP 484 prohibits implicit `Optional` + --> RUF013_0.py:152:11 | 150 | def f( 151 | arg1: int = None, # RUF013 @@ -258,8 +272,9 @@ error[RUF013]: RUF013_0.py:152:11: [*] PEP 484 prohibits implicit `Optional` 154 154 | ): 155 155 | pass -error[RUF013]: RUF013_0.py:153:11: [*] PEP 484 prohibits implicit `Optional` +error[RUF013]: 153:11: [*] PEP 484 prohibits implicit `Optional` + --> RUF013_0.py:153:11 | 151 | arg1: int = None, # RUF013 152 | arg2: Union[int, float] = None, # RUF013 @@ -279,8 +294,9 @@ error[RUF013]: RUF013_0.py:153:11: [*] PEP 484 prohibits implicit `Optional` 155 155 | pass 156 156 | -error[RUF013]: RUF013_0.py:181:12: [*] PEP 484 prohibits implicit `Optional` +error[RUF013]: 181:12: [*] PEP 484 prohibits implicit `Optional` + --> RUF013_0.py:181:12 | 181 | def f(arg: Union[Annotated[int, ...], Union[str, bytes]] = None): # RUF013 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -297,8 +313,9 @@ error[RUF013]: RUF013_0.py:181:12: [*] PEP 484 prohibits implicit `Optional` 183 183 | 184 184 | -error[RUF013]: RUF013_0.py:188:13: [*] PEP 484 prohibits implicit `Optional` +error[RUF013]: 188:13: [*] PEP 484 prohibits implicit `Optional` + --> RUF013_0.py:188:13 | 188 | def f(arg: "int" = None): # RUF013 | ^^^ @@ -315,8 +332,9 @@ error[RUF013]: RUF013_0.py:188:13: [*] PEP 484 prohibits implicit `Optional` 190 190 | 191 191 | -error[RUF013]: RUF013_0.py:192:13: [*] PEP 484 prohibits implicit `Optional` +error[RUF013]: 192:13: [*] PEP 484 prohibits implicit `Optional` + --> RUF013_0.py:192:13 | 192 | def f(arg: "str" = None): # RUF013 | ^^^ @@ -333,16 +351,18 @@ error[RUF013]: RUF013_0.py:192:13: [*] PEP 484 prohibits implicit `Optional` 194 194 | 195 195 | -error[RUF013]: RUF013_0.py:196:12: PEP 484 prohibits implicit `Optional` +error[RUF013]: 196:12: PEP 484 prohibits implicit `Optional` + --> RUF013_0.py:196:12 | 196 | def f(arg: "st" "r" = None): # RUF013 | ^^^^^^^^ 197 | pass | = help: Convert to `T | None` -error[RUF013]: RUF013_0.py:204:12: [*] PEP 484 prohibits implicit `Optional` +error[RUF013]: 204:12: [*] PEP 484 prohibits implicit `Optional` + --> RUF013_0.py:204:12 | 204 | def f(arg: Union["int", "str"] = None): # RUF013 | ^^^^^^^^^^^^^^^^^^^ diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF013_RUF013_1.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF013_RUF013_1.py.snap index 6e1b8b2b12..8049587675 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF013_RUF013_1.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF013_RUF013_1.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs --- -error[RUF013]: RUF013_1.py:4:12: [*] PEP 484 prohibits implicit `Optional` +error[RUF013]: 4:12: [*] PEP 484 prohibits implicit `Optional` + --> RUF013_1.py:4:12 | 4 | def f(arg: int = None): # RUF013 | ^^^ diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF013_RUF013_3.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF013_RUF013_3.py.snap index 2e5f1c5997..fa69d45de3 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF013_RUF013_3.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF013_RUF013_3.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs --- -error[RUF013]: RUF013_3.py:4:12: [*] PEP 484 prohibits implicit `Optional` +error[RUF013]: 4:12: [*] PEP 484 prohibits implicit `Optional` + --> RUF013_3.py:4:12 | 4 | def f(arg: typing.List[str] = None): # RUF013 | ^^^^^^^^^^^^^^^^ @@ -19,8 +20,9 @@ error[RUF013]: RUF013_3.py:4:12: [*] PEP 484 prohibits implicit `Optional` 6 6 | 7 7 | -error[RUF013]: RUF013_3.py:22:12: [*] PEP 484 prohibits implicit `Optional` +error[RUF013]: 22:12: [*] PEP 484 prohibits implicit `Optional` + --> RUF013_3.py:22:12 | 22 | def f(arg: typing.Union[int, str] = None): # RUF013 | ^^^^^^^^^^^^^^^^^^^^^^ @@ -37,8 +39,9 @@ error[RUF013]: RUF013_3.py:22:12: [*] PEP 484 prohibits implicit `Optional` 24 24 | 25 25 | -error[RUF013]: RUF013_3.py:29:12: [*] PEP 484 prohibits implicit `Optional` +error[RUF013]: 29:12: [*] PEP 484 prohibits implicit `Optional` + --> RUF013_3.py:29:12 | 29 | def f(arg: typing.Literal[1, "foo", True] = None): # RUF013 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF015_RUF015.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF015_RUF015.py.snap index cd7f8ac9a9..51c733e5a7 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF015_RUF015.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF015_RUF015.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs --- -error[RUF015]: RUF015.py:4:1: [*] Prefer `next(iter(x))` over single element slice +error[RUF015]: 4:1: [*] Prefer `next(iter(x))` over single element slice + --> RUF015.py:3:9 | 3 | # RUF015 4 | list(x)[0] @@ -21,8 +22,9 @@ error[RUF015]: RUF015.py:4:1: [*] Prefer `next(iter(x))` over single element sli 6 6 | list(i for i in x)[0] 7 7 | [i for i in x][0] -error[RUF015]: RUF015.py:5:1: [*] Prefer `next(iter(x))` over single element slice +error[RUF015]: 5:1: [*] Prefer `next(iter(x))` over single element slice + --> RUF015.py:4:11 | 3 | # RUF015 4 | list(x)[0] @@ -42,8 +44,9 @@ error[RUF015]: RUF015.py:5:1: [*] Prefer `next(iter(x))` over single element sli 7 7 | [i for i in x][0] 8 8 | -error[RUF015]: RUF015.py:6:1: [*] Prefer `next(iter(x))` over single element slice +error[RUF015]: 6:1: [*] Prefer `next(iter(x))` over single element slice + --> RUF015.py:5:12 | 4 | list(x)[0] 5 | tuple(x)[0] @@ -62,8 +65,9 @@ error[RUF015]: RUF015.py:6:1: [*] Prefer `next(iter(x))` over single element sli 8 8 | 9 9 | # OK (not indexing (solely) the first element) -error[RUF015]: RUF015.py:7:1: [*] Prefer `next(iter(x))` over single element slice +error[RUF015]: 7:1: [*] Prefer `next(iter(x))` over single element slice + --> RUF015.py:6:22 | 5 | tuple(x)[0] 6 | list(i for i in x)[0] @@ -83,8 +87,9 @@ error[RUF015]: RUF015.py:7:1: [*] Prefer `next(iter(x))` over single element sli 9 9 | # OK (not indexing (solely) the first element) 10 10 | list(x) -error[RUF015]: RUF015.py:29:1: [*] Prefer `next(i + 1 for i in x)` over single element slice +error[RUF015]: 29:1: [*] Prefer `next(i + 1 for i in x)` over single element slice + --> RUF015.py:28:46 | 28 | # RUF015 (doesn't mirror the underlying list) 29 | [i + 1 for i in x][0] @@ -103,8 +108,9 @@ error[RUF015]: RUF015.py:29:1: [*] Prefer `next(i + 1 for i in x)` over single e 31 31 | [(i, i + 1) for i in x][0] 32 32 | -error[RUF015]: RUF015.py:30:1: [*] Prefer `next(i for i in x if i > 5)` over single element slice +error[RUF015]: 30:1: [*] Prefer `next(i for i in x if i > 5)` over single element slice + --> RUF015.py:29:22 | 28 | # RUF015 (doesn't mirror the underlying list) 29 | [i + 1 for i in x][0] @@ -123,8 +129,9 @@ error[RUF015]: RUF015.py:30:1: [*] Prefer `next(i for i in x if i > 5)` over sin 32 32 | 33 33 | # RUF015 (multiple generators) -error[RUF015]: RUF015.py:31:1: [*] Prefer `next((i, i + 1) for i in x)` over single element slice +error[RUF015]: 31:1: [*] Prefer `next((i, i + 1) for i in x)` over single element slice + --> RUF015.py:30:27 | 29 | [i + 1 for i in x][0] 30 | [i for i in x if i > 5][0] @@ -144,8 +151,9 @@ error[RUF015]: RUF015.py:31:1: [*] Prefer `next((i, i + 1) for i in x)` over sin 33 33 | # RUF015 (multiple generators) 34 34 | y = range(10) -error[RUF015]: RUF015.py:35:1: [*] Prefer `next(i + j for i in x for j in y)` over single element slice +error[RUF015]: 35:1: [*] Prefer `next(i + j for i in x for j in y)` over single element slice + --> RUF015.py:34:14 | 33 | # RUF015 (multiple generators) 34 | y = range(10) @@ -165,8 +173,9 @@ error[RUF015]: RUF015.py:35:1: [*] Prefer `next(i + j for i in x for j in y)` ov 37 37 | # RUF015 38 38 | list(range(10))[0] -error[RUF015]: RUF015.py:38:1: [*] Prefer `next(iter(range(10)))` over single element slice +error[RUF015]: 38:1: [*] Prefer `next(iter(range(10)))` over single element slice + --> RUF015.py:37:9 | 37 | # RUF015 38 | list(range(10))[0] @@ -185,8 +194,9 @@ error[RUF015]: RUF015.py:38:1: [*] Prefer `next(iter(range(10)))` over single el 40 40 | list(x["y"])[0] 41 41 | [*range(10)][0] -error[RUF015]: RUF015.py:39:1: [*] Prefer `next(iter(x.y))` over single element slice +error[RUF015]: 39:1: [*] Prefer `next(iter(x.y))` over single element slice + --> RUF015.py:38:19 | 37 | # RUF015 38 | list(range(10))[0] @@ -206,8 +216,9 @@ error[RUF015]: RUF015.py:39:1: [*] Prefer `next(iter(x.y))` over single element 41 41 | [*range(10)][0] 42 42 | [*x["y"]][0] -error[RUF015]: RUF015.py:40:1: [*] Prefer `next(iter(x["y"]))` over single element slice +error[RUF015]: 40:1: [*] Prefer `next(iter(x["y"]))` over single element slice + --> RUF015.py:39:13 | 38 | list(range(10))[0] 39 | list(x.y)[0] @@ -227,8 +238,9 @@ error[RUF015]: RUF015.py:40:1: [*] Prefer `next(iter(x["y"]))` over single eleme 42 42 | [*x["y"]][0] 43 43 | [*x.y][0] -error[RUF015]: RUF015.py:41:1: [*] Prefer `next(iter(range(10)))` over single element slice +error[RUF015]: 41:1: [*] Prefer `next(iter(range(10)))` over single element slice + --> RUF015.py:40:16 | 39 | list(x.y)[0] 40 | list(x["y"])[0] @@ -248,8 +260,9 @@ error[RUF015]: RUF015.py:41:1: [*] Prefer `next(iter(range(10)))` over single el 43 43 | [*x.y][0] 44 44 | [* x.y][0] -error[RUF015]: RUF015.py:42:1: [*] Prefer `next(iter(x["y"]))` over single element slice +error[RUF015]: 42:1: [*] Prefer `next(iter(x["y"]))` over single element slice + --> RUF015.py:41:16 | 40 | list(x["y"])[0] 41 | [*range(10)][0] @@ -269,8 +282,9 @@ error[RUF015]: RUF015.py:42:1: [*] Prefer `next(iter(x["y"]))` over single eleme 44 44 | [* x.y][0] 45 45 | [ -error[RUF015]: RUF015.py:43:1: [*] Prefer `next(iter(x.y))` over single element slice +error[RUF015]: 43:1: [*] Prefer `next(iter(x.y))` over single element slice + --> RUF015.py:42:13 | 41 | [*range(10)][0] 42 | [*x["y"]][0] @@ -290,8 +304,9 @@ error[RUF015]: RUF015.py:43:1: [*] Prefer `next(iter(x.y))` over single element 45 45 | [ 46 46 | *x.y -error[RUF015]: RUF015.py:44:1: [*] Prefer `next(iter(x.y))` over single element slice +error[RUF015]: 44:1: [*] Prefer `next(iter(x.y))` over single element slice + --> RUF015.py:43:10 | 42 | [*x["y"]][0] 43 | [*x.y][0] @@ -311,8 +326,9 @@ error[RUF015]: RUF015.py:44:1: [*] Prefer `next(iter(x.y))` over single element 46 46 | *x.y 47 47 | ][0] -error[RUF015]: RUF015.py:45:1: [*] Prefer `next(iter(x.y))` over single element slice +error[RUF015]: 45:1: [*] Prefer `next(iter(x.y))` over single element slice + --> RUF015.py:44:11 | 43 | [*x.y][0] 44 | [* x.y][0] @@ -336,8 +352,9 @@ error[RUF015]: RUF015.py:45:1: [*] Prefer `next(iter(x.y))` over single element 49 47 | # RUF015 (multi-line) 50 48 | revision_heads_map_ast = [ -error[RUF015]: RUF015.py:50:26: [*] Prefer `next(...)` over single element slice +error[RUF015]: 50:26: [*] Prefer `next(...)` over single element slice + --> RUF015.py:50:26 | 49 | # RUF015 (multi-line) 50 | revision_heads_map_ast = [ @@ -366,8 +383,9 @@ error[RUF015]: RUF015.py:50:26: [*] Prefer `next(...)` over single element slice 56 56 | # RUF015 (zip) 57 57 | list(zip(x, y))[0] -error[RUF015]: RUF015.py:57:1: [*] Prefer `next(zip(x, y))` over single element slice +error[RUF015]: 57:1: [*] Prefer `next(zip(x, y))` over single element slice + --> RUF015.py:56:15 | 56 | # RUF015 (zip) 57 | list(zip(x, y))[0] @@ -385,8 +403,9 @@ error[RUF015]: RUF015.py:57:1: [*] Prefer `next(zip(x, y))` over single element 59 59 | 60 60 | # RUF015 (pop) -error[RUF015]: RUF015.py:58:1: [*] Prefer `next(zip(x, y))` over single element slice +error[RUF015]: 58:1: [*] Prefer `next(zip(x, y))` over single element slice + --> RUF015.py:57:19 | 56 | # RUF015 (zip) 57 | list(zip(x, y))[0] @@ -406,8 +425,9 @@ error[RUF015]: RUF015.py:58:1: [*] Prefer `next(zip(x, y))` over single element 60 60 | # RUF015 (pop) 61 61 | list(x).pop(0) -error[RUF015]: RUF015.py:61:1: [*] Prefer `next(iter(x))` over single element slice +error[RUF015]: 61:1: [*] Prefer `next(iter(x))` over single element slice + --> RUF015.py:60:15 | 60 | # RUF015 (pop) 61 | list(x).pop(0) @@ -426,8 +446,9 @@ error[RUF015]: RUF015.py:61:1: [*] Prefer `next(iter(x))` over single element sl 63 63 | list(i for i in x).pop(0) 64 64 | -error[RUF015]: RUF015.py:62:1: [*] Prefer `next(iter(x))` over single element slice +error[RUF015]: 62:1: [*] Prefer `next(iter(x))` over single element slice + --> RUF015.py:61:15 | 60 | # RUF015 (pop) 61 | list(x).pop(0) @@ -446,8 +467,9 @@ error[RUF015]: RUF015.py:62:1: [*] Prefer `next(iter(x))` over single element sl 64 64 | 65 65 | # OK -error[RUF015]: RUF015.py:63:1: [*] Prefer `next(iter(x))` over single element slice +error[RUF015]: 63:1: [*] Prefer `next(iter(x))` over single element slice + --> RUF015.py:62:22 | 61 | list(x).pop(0) 62 | [i for i in x].pop(0) @@ -467,8 +489,9 @@ error[RUF015]: RUF015.py:63:1: [*] Prefer `next(iter(x))` over single element sl 65 65 | # OK 66 66 | list(x).pop(1) -error[RUF015]: RUF015.py:73:5: [*] Prefer `next(iter(zip(x, y)))` over single element slice +error[RUF015]: 73:5: [*] Prefer `next(iter(zip(x, y)))` over single element slice + --> RUF015.py:73:5 | 71 | def test(): 72 | zip = list # Overwrite the builtin zip diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF016_RUF016.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF016_RUF016.py.snap index 7cd802dfb1..7b2b4243f0 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF016_RUF016.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF016_RUF016.py.snap @@ -1,16 +1,18 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs --- -error[RUF016]: RUF016.py:20:13: Indexed access to type `str` uses type `str` instead of an integer or slice +error[RUF016]: 20:13: Indexed access to type `str` uses type `str` instead of an integer or slice + --> RUF016.py:20:13 | 19 | # Should emit for invalid access on strings 20 | var = "abc"["x"] | ^^^ 21 | var = f"abc"["x"] | -error[RUF016]: RUF016.py:21:14: Indexed access to type `str` uses type `str` instead of an integer or slice +error[RUF016]: 21:14: Indexed access to type `str` uses type `str` instead of an integer or slice + --> RUF016.py:21:14 | 19 | # Should emit for invalid access on strings 20 | var = "abc"["x"] @@ -19,8 +21,9 @@ error[RUF016]: RUF016.py:21:14: Indexed access to type `str` uses type `str` ins 22 | 23 | # Should emit for invalid access on bytes | -error[RUF016]: RUF016.py:24:14: Indexed access to type `bytes` uses type `str` instead of an integer or slice +error[RUF016]: 24:14: Indexed access to type `bytes` uses type `str` instead of an integer or slice + --> RUF016.py:24:14 | 23 | # Should emit for invalid access on bytes 24 | var = b"abc"["x"] @@ -28,16 +31,18 @@ error[RUF016]: RUF016.py:24:14: Indexed access to type `bytes` uses type `str` i 25 | 26 | # Should emit for invalid access on lists and tuples | -error[RUF016]: RUF016.py:27:17: Indexed access to type `list` uses type `str` instead of an integer or slice +error[RUF016]: 27:17: Indexed access to type `list` uses type `str` instead of an integer or slice + --> RUF016.py:27:17 | 26 | # Should emit for invalid access on lists and tuples 27 | var = [1, 2, 3]["x"] | ^^^ 28 | var = (1, 2, 3)["x"] | -error[RUF016]: RUF016.py:28:17: Indexed access to type `tuple` uses type `str` instead of an integer or slice +error[RUF016]: 28:17: Indexed access to type `tuple` uses type `str` instead of an integer or slice + --> RUF016.py:28:17 | 26 | # Should emit for invalid access on lists and tuples 27 | var = [1, 2, 3]["x"] @@ -46,8 +51,9 @@ error[RUF016]: RUF016.py:28:17: Indexed access to type `tuple` uses type `str` i 29 | 30 | # Should emit for invalid access on list comprehensions | -error[RUF016]: RUF016.py:31:30: Indexed access to type `list comprehension` uses type `str` instead of an integer or slice +error[RUF016]: 31:30: Indexed access to type `list comprehension` uses type `str` instead of an integer or slice + --> RUF016.py:31:30 | 30 | # Should emit for invalid access on list comprehensions 31 | var = [x for x in range(10)]["x"] @@ -55,8 +61,9 @@ error[RUF016]: RUF016.py:31:30: Indexed access to type `list comprehension` uses 32 | 33 | # Should emit for invalid access using tuple | -error[RUF016]: RUF016.py:34:13: Indexed access to type `str` uses type `tuple` instead of an integer or slice +error[RUF016]: 34:13: Indexed access to type `str` uses type `tuple` instead of an integer or slice + --> RUF016.py:34:13 | 33 | # Should emit for invalid access using tuple 34 | var = "abc"[1, 2] @@ -64,8 +71,9 @@ error[RUF016]: RUF016.py:34:13: Indexed access to type `str` uses type `tuple` i 35 | 36 | # Should emit for invalid access using string | -error[RUF016]: RUF016.py:37:14: Indexed access to type `list` uses type `str` instead of an integer or slice +error[RUF016]: 37:14: Indexed access to type `list` uses type `str` instead of an integer or slice + --> RUF016.py:37:14 | 36 | # Should emit for invalid access using string 37 | var = [1, 2]["x"] @@ -73,8 +81,9 @@ error[RUF016]: RUF016.py:37:14: Indexed access to type `list` uses type `str` in 38 | 39 | # Should emit for invalid access using float | -error[RUF016]: RUF016.py:40:14: Indexed access to type `list` uses type `float` instead of an integer or slice +error[RUF016]: 40:14: Indexed access to type `list` uses type `float` instead of an integer or slice + --> RUF016.py:40:14 | 39 | # Should emit for invalid access using float 40 | var = [1, 2][0.25] @@ -82,8 +91,9 @@ error[RUF016]: RUF016.py:40:14: Indexed access to type `list` uses type `float` 41 | 42 | # Should emit for invalid access using dict | -error[RUF016]: RUF016.py:43:14: Indexed access to type `list` uses type `dict` instead of an integer or slice +error[RUF016]: 43:14: Indexed access to type `list` uses type `dict` instead of an integer or slice + --> RUF016.py:43:14 | 42 | # Should emit for invalid access using dict 43 | var = [1, 2][{"x": "y"}] @@ -91,8 +101,9 @@ error[RUF016]: RUF016.py:43:14: Indexed access to type `list` uses type `dict` i 44 | 45 | # Should emit for invalid access using dict comp | -error[RUF016]: RUF016.py:46:14: Indexed access to type `list` uses type `dict comprehension` instead of an integer or slice +error[RUF016]: 46:14: Indexed access to type `list` uses type `dict comprehension` instead of an integer or slice + --> RUF016.py:46:14 | 45 | # Should emit for invalid access using dict comp 46 | var = [1, 2][{x: "y" for x in range(2)}] @@ -100,8 +111,9 @@ error[RUF016]: RUF016.py:46:14: Indexed access to type `list` uses type `dict co 47 | 48 | # Should emit for invalid access using list | -error[RUF016]: RUF016.py:49:14: Indexed access to type `list` uses type `tuple` instead of an integer or slice +error[RUF016]: 49:14: Indexed access to type `list` uses type `tuple` instead of an integer or slice + --> RUF016.py:49:14 | 48 | # Should emit for invalid access using list 49 | var = [1, 2][2, 3] @@ -109,8 +121,9 @@ error[RUF016]: RUF016.py:49:14: Indexed access to type `list` uses type `tuple` 50 | 51 | # Should emit for invalid access using list comp | -error[RUF016]: RUF016.py:52:14: Indexed access to type `list` uses type `list comprehension` instead of an integer or slice +error[RUF016]: 52:14: Indexed access to type `list` uses type `list comprehension` instead of an integer or slice + --> RUF016.py:52:14 | 51 | # Should emit for invalid access using list comp 52 | var = [1, 2][[x for x in range(2)]] @@ -118,8 +131,9 @@ error[RUF016]: RUF016.py:52:14: Indexed access to type `list` uses type `list co 53 | 54 | # Should emit on invalid access using set | -error[RUF016]: RUF016.py:55:14: Indexed access to type `list` uses type `set` instead of an integer or slice +error[RUF016]: 55:14: Indexed access to type `list` uses type `set` instead of an integer or slice + --> RUF016.py:55:14 | 54 | # Should emit on invalid access using set 55 | var = [1, 2][{"x", "y"}] @@ -127,8 +141,9 @@ error[RUF016]: RUF016.py:55:14: Indexed access to type `list` uses type `set` in 56 | 57 | # Should emit on invalid access using set comp | -error[RUF016]: RUF016.py:58:14: Indexed access to type `list` uses type `set comprehension` instead of an integer or slice +error[RUF016]: 58:14: Indexed access to type `list` uses type `set comprehension` instead of an integer or slice + --> RUF016.py:58:14 | 57 | # Should emit on invalid access using set comp 58 | var = [1, 2][{x for x in range(2)}] @@ -136,8 +151,9 @@ error[RUF016]: RUF016.py:58:14: Indexed access to type `list` uses type `set com 59 | 60 | # Should emit on invalid access using bytes | -error[RUF016]: RUF016.py:61:14: Indexed access to type `list` uses type `bytes` instead of an integer or slice +error[RUF016]: 61:14: Indexed access to type `list` uses type `bytes` instead of an integer or slice + --> RUF016.py:61:14 | 60 | # Should emit on invalid access using bytes 61 | var = [1, 2][b"x"] @@ -145,8 +161,9 @@ error[RUF016]: RUF016.py:61:14: Indexed access to type `list` uses type `bytes` 62 | 63 | # Should emit for non-integer slice start | -error[RUF016]: RUF016.py:64:17: Slice in indexed access to type `list` uses type `str` instead of an integer +error[RUF016]: 64:17: Slice in indexed access to type `list` uses type `str` instead of an integer + --> RUF016.py:64:17 | 63 | # Should emit for non-integer slice start 64 | var = [1, 2, 3]["x":2] @@ -154,8 +171,9 @@ error[RUF016]: RUF016.py:64:17: Slice in indexed access to type `list` uses type 65 | var = [1, 2, 3][f"x":2] 66 | var = [1, 2, 3][1.2:2] | -error[RUF016]: RUF016.py:65:17: Slice in indexed access to type `list` uses type `str` instead of an integer +error[RUF016]: 65:17: Slice in indexed access to type `list` uses type `str` instead of an integer + --> RUF016.py:65:17 | 63 | # Should emit for non-integer slice start 64 | var = [1, 2, 3]["x":2] @@ -164,8 +182,9 @@ error[RUF016]: RUF016.py:65:17: Slice in indexed access to type `list` uses type 66 | var = [1, 2, 3][1.2:2] 67 | var = [1, 2, 3][{"x"}:2] | -error[RUF016]: RUF016.py:66:17: Slice in indexed access to type `list` uses type `float` instead of an integer +error[RUF016]: 66:17: Slice in indexed access to type `list` uses type `float` instead of an integer + --> RUF016.py:66:17 | 64 | var = [1, 2, 3]["x":2] 65 | var = [1, 2, 3][f"x":2] @@ -174,8 +193,9 @@ error[RUF016]: RUF016.py:66:17: Slice in indexed access to type `list` uses type 67 | var = [1, 2, 3][{"x"}:2] 68 | var = [1, 2, 3][{x for x in range(2)}:2] | -error[RUF016]: RUF016.py:67:17: Slice in indexed access to type `list` uses type `set` instead of an integer +error[RUF016]: 67:17: Slice in indexed access to type `list` uses type `set` instead of an integer + --> RUF016.py:67:17 | 65 | var = [1, 2, 3][f"x":2] 66 | var = [1, 2, 3][1.2:2] @@ -184,8 +204,9 @@ error[RUF016]: RUF016.py:67:17: Slice in indexed access to type `list` uses type 68 | var = [1, 2, 3][{x for x in range(2)}:2] 69 | var = [1, 2, 3][{"x": x for x in range(2)}:2] | -error[RUF016]: RUF016.py:68:17: Slice in indexed access to type `list` uses type `set comprehension` instead of an integer +error[RUF016]: 68:17: Slice in indexed access to type `list` uses type `set comprehension` instead of an integer + --> RUF016.py:68:17 | 66 | var = [1, 2, 3][1.2:2] 67 | var = [1, 2, 3][{"x"}:2] @@ -194,8 +215,9 @@ error[RUF016]: RUF016.py:68:17: Slice in indexed access to type `list` uses type 69 | var = [1, 2, 3][{"x": x for x in range(2)}:2] 70 | var = [1, 2, 3][[x for x in range(2)]:2] | -error[RUF016]: RUF016.py:69:17: Slice in indexed access to type `list` uses type `dict comprehension` instead of an integer +error[RUF016]: 69:17: Slice in indexed access to type `list` uses type `dict comprehension` instead of an integer + --> RUF016.py:69:17 | 67 | var = [1, 2, 3][{"x"}:2] 68 | var = [1, 2, 3][{x for x in range(2)}:2] @@ -203,8 +225,9 @@ error[RUF016]: RUF016.py:69:17: Slice in indexed access to type `list` uses type | ^^^^^^^^^^^^^^^^^^^^^^^^^^ 70 | var = [1, 2, 3][[x for x in range(2)]:2] | -error[RUF016]: RUF016.py:70:17: Slice in indexed access to type `list` uses type `list comprehension` instead of an integer +error[RUF016]: 70:17: Slice in indexed access to type `list` uses type `list comprehension` instead of an integer + --> RUF016.py:70:17 | 68 | var = [1, 2, 3][{x for x in range(2)}:2] 69 | var = [1, 2, 3][{"x": x for x in range(2)}:2] @@ -213,8 +236,9 @@ error[RUF016]: RUF016.py:70:17: Slice in indexed access to type `list` uses type 71 | 72 | # Should emit for non-integer slice end | -error[RUF016]: RUF016.py:73:19: Slice in indexed access to type `list` uses type `str` instead of an integer +error[RUF016]: 73:19: Slice in indexed access to type `list` uses type `str` instead of an integer + --> RUF016.py:73:19 | 72 | # Should emit for non-integer slice end 73 | var = [1, 2, 3][0:"x"] @@ -222,8 +246,9 @@ error[RUF016]: RUF016.py:73:19: Slice in indexed access to type `list` uses type 74 | var = [1, 2, 3][0:f"x"] 75 | var = [1, 2, 3][0:1.2] | -error[RUF016]: RUF016.py:74:19: Slice in indexed access to type `list` uses type `str` instead of an integer +error[RUF016]: 74:19: Slice in indexed access to type `list` uses type `str` instead of an integer + --> RUF016.py:74:19 | 72 | # Should emit for non-integer slice end 73 | var = [1, 2, 3][0:"x"] @@ -232,8 +257,9 @@ error[RUF016]: RUF016.py:74:19: Slice in indexed access to type `list` uses type 75 | var = [1, 2, 3][0:1.2] 76 | var = [1, 2, 3][0:{"x"}] | -error[RUF016]: RUF016.py:75:19: Slice in indexed access to type `list` uses type `float` instead of an integer +error[RUF016]: 75:19: Slice in indexed access to type `list` uses type `float` instead of an integer + --> RUF016.py:75:19 | 73 | var = [1, 2, 3][0:"x"] 74 | var = [1, 2, 3][0:f"x"] @@ -242,8 +268,9 @@ error[RUF016]: RUF016.py:75:19: Slice in indexed access to type `list` uses type 76 | var = [1, 2, 3][0:{"x"}] 77 | var = [1, 2, 3][0:{x for x in range(2)}] | -error[RUF016]: RUF016.py:76:19: Slice in indexed access to type `list` uses type `set` instead of an integer +error[RUF016]: 76:19: Slice in indexed access to type `list` uses type `set` instead of an integer + --> RUF016.py:76:19 | 74 | var = [1, 2, 3][0:f"x"] 75 | var = [1, 2, 3][0:1.2] @@ -252,8 +279,9 @@ error[RUF016]: RUF016.py:76:19: Slice in indexed access to type `list` uses type 77 | var = [1, 2, 3][0:{x for x in range(2)}] 78 | var = [1, 2, 3][0:{"x": x for x in range(2)}] | -error[RUF016]: RUF016.py:77:19: Slice in indexed access to type `list` uses type `set comprehension` instead of an integer +error[RUF016]: 77:19: Slice in indexed access to type `list` uses type `set comprehension` instead of an integer + --> RUF016.py:77:19 | 75 | var = [1, 2, 3][0:1.2] 76 | var = [1, 2, 3][0:{"x"}] @@ -262,8 +290,9 @@ error[RUF016]: RUF016.py:77:19: Slice in indexed access to type `list` uses type 78 | var = [1, 2, 3][0:{"x": x for x in range(2)}] 79 | var = [1, 2, 3][0:[x for x in range(2)]] | -error[RUF016]: RUF016.py:78:19: Slice in indexed access to type `list` uses type `dict comprehension` instead of an integer +error[RUF016]: 78:19: Slice in indexed access to type `list` uses type `dict comprehension` instead of an integer + --> RUF016.py:78:19 | 76 | var = [1, 2, 3][0:{"x"}] 77 | var = [1, 2, 3][0:{x for x in range(2)}] @@ -271,8 +300,9 @@ error[RUF016]: RUF016.py:78:19: Slice in indexed access to type `list` uses type | ^^^^^^^^^^^^^^^^^^^^^^^^^^ 79 | var = [1, 2, 3][0:[x for x in range(2)]] | -error[RUF016]: RUF016.py:79:19: Slice in indexed access to type `list` uses type `list comprehension` instead of an integer +error[RUF016]: 79:19: Slice in indexed access to type `list` uses type `list comprehension` instead of an integer + --> RUF016.py:79:19 | 77 | var = [1, 2, 3][0:{x for x in range(2)}] 78 | var = [1, 2, 3][0:{"x": x for x in range(2)}] @@ -281,8 +311,9 @@ error[RUF016]: RUF016.py:79:19: Slice in indexed access to type `list` uses type 80 | 81 | # Should emit for non-integer slice step | -error[RUF016]: RUF016.py:82:21: Slice in indexed access to type `list` uses type `str` instead of an integer +error[RUF016]: 82:21: Slice in indexed access to type `list` uses type `str` instead of an integer + --> RUF016.py:82:21 | 81 | # Should emit for non-integer slice step 82 | var = [1, 2, 3][0:1:"x"] @@ -290,8 +321,9 @@ error[RUF016]: RUF016.py:82:21: Slice in indexed access to type `list` uses type 83 | var = [1, 2, 3][0:1:f"x"] 84 | var = [1, 2, 3][0:1:1.2] | -error[RUF016]: RUF016.py:83:21: Slice in indexed access to type `list` uses type `str` instead of an integer +error[RUF016]: 83:21: Slice in indexed access to type `list` uses type `str` instead of an integer + --> RUF016.py:83:21 | 81 | # Should emit for non-integer slice step 82 | var = [1, 2, 3][0:1:"x"] @@ -300,8 +332,9 @@ error[RUF016]: RUF016.py:83:21: Slice in indexed access to type `list` uses type 84 | var = [1, 2, 3][0:1:1.2] 85 | var = [1, 2, 3][0:1:{"x"}] | -error[RUF016]: RUF016.py:84:21: Slice in indexed access to type `list` uses type `float` instead of an integer +error[RUF016]: 84:21: Slice in indexed access to type `list` uses type `float` instead of an integer + --> RUF016.py:84:21 | 82 | var = [1, 2, 3][0:1:"x"] 83 | var = [1, 2, 3][0:1:f"x"] @@ -310,8 +343,9 @@ error[RUF016]: RUF016.py:84:21: Slice in indexed access to type `list` uses type 85 | var = [1, 2, 3][0:1:{"x"}] 86 | var = [1, 2, 3][0:1:{x for x in range(2)}] | -error[RUF016]: RUF016.py:85:21: Slice in indexed access to type `list` uses type `set` instead of an integer +error[RUF016]: 85:21: Slice in indexed access to type `list` uses type `set` instead of an integer + --> RUF016.py:85:21 | 83 | var = [1, 2, 3][0:1:f"x"] 84 | var = [1, 2, 3][0:1:1.2] @@ -320,8 +354,9 @@ error[RUF016]: RUF016.py:85:21: Slice in indexed access to type `list` uses type 86 | var = [1, 2, 3][0:1:{x for x in range(2)}] 87 | var = [1, 2, 3][0:1:{"x": x for x in range(2)}] | -error[RUF016]: RUF016.py:86:21: Slice in indexed access to type `list` uses type `set comprehension` instead of an integer +error[RUF016]: 86:21: Slice in indexed access to type `list` uses type `set comprehension` instead of an integer + --> RUF016.py:86:21 | 84 | var = [1, 2, 3][0:1:1.2] 85 | var = [1, 2, 3][0:1:{"x"}] @@ -330,8 +365,9 @@ error[RUF016]: RUF016.py:86:21: Slice in indexed access to type `list` uses type 87 | var = [1, 2, 3][0:1:{"x": x for x in range(2)}] 88 | var = [1, 2, 3][0:1:[x for x in range(2)]] | -error[RUF016]: RUF016.py:87:21: Slice in indexed access to type `list` uses type `dict comprehension` instead of an integer +error[RUF016]: 87:21: Slice in indexed access to type `list` uses type `dict comprehension` instead of an integer + --> RUF016.py:87:21 | 85 | var = [1, 2, 3][0:1:{"x"}] 86 | var = [1, 2, 3][0:1:{x for x in range(2)}] @@ -339,8 +375,9 @@ error[RUF016]: RUF016.py:87:21: Slice in indexed access to type `list` uses type | ^^^^^^^^^^^^^^^^^^^^^^^^^^ 88 | var = [1, 2, 3][0:1:[x for x in range(2)]] | -error[RUF016]: RUF016.py:88:21: Slice in indexed access to type `list` uses type `list comprehension` instead of an integer +error[RUF016]: 88:21: Slice in indexed access to type `list` uses type `list comprehension` instead of an integer + --> RUF016.py:88:21 | 86 | var = [1, 2, 3][0:1:{x for x in range(2)}] 87 | var = [1, 2, 3][0:1:{"x": x for x in range(2)}] @@ -349,8 +386,9 @@ error[RUF016]: RUF016.py:88:21: Slice in indexed access to type `list` uses type 89 | 90 | # Should emit for non-integer slice start and end; should emit twice with specific ranges | -error[RUF016]: RUF016.py:91:17: Slice in indexed access to type `list` uses type `str` instead of an integer +error[RUF016]: 91:17: Slice in indexed access to type `list` uses type `str` instead of an integer + --> RUF016.py:91:17 | 90 | # Should emit for non-integer slice start and end; should emit twice with specific ranges 91 | var = [1, 2, 3]["x":"y"] @@ -358,8 +396,9 @@ error[RUF016]: RUF016.py:91:17: Slice in indexed access to type `list` uses type 92 | 93 | # Should emit once for repeated invalid access | -error[RUF016]: RUF016.py:91:21: Slice in indexed access to type `list` uses type `str` instead of an integer +error[RUF016]: 91:21: Slice in indexed access to type `list` uses type `str` instead of an integer + --> RUF016.py:91:21 | 90 | # Should emit for non-integer slice start and end; should emit twice with specific ranges 91 | var = [1, 2, 3]["x":"y"] @@ -367,8 +406,9 @@ error[RUF016]: RUF016.py:91:21: Slice in indexed access to type `list` uses type 92 | 93 | # Should emit once for repeated invalid access | -error[RUF016]: RUF016.py:94:17: Indexed access to type `list` uses type `str` instead of an integer or slice +error[RUF016]: 94:17: Indexed access to type `list` uses type `str` instead of an integer or slice + --> RUF016.py:94:17 | 93 | # Should emit once for repeated invalid access 94 | var = [1, 2, 3]["x"]["y"]["z"] diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF017_RUF017_0.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF017_RUF017_0.py.snap index eb2664cca0..b3dae02b62 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF017_RUF017_0.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF017_RUF017_0.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs --- -error[RUF017]: RUF017_0.py:5:1: [*] Avoid quadratic list summation +error[RUF017]: 5:1: [*] Avoid quadratic list summation + --> RUF017_0.py:4:9 | 4 | # RUF017 5 | sum([x, y], start=[]) @@ -24,8 +25,9 @@ error[RUF017]: RUF017_0.py:5:1: [*] Avoid quadratic list summation 7 9 | sum([[1, 2, 3], [4, 5, 6]], start=[]) 8 10 | sum([[1, 2, 3], [4, 5, 6]], []) -error[RUF017]: RUF017_0.py:6:1: [*] Avoid quadratic list summation +error[RUF017]: 6:1: [*] Avoid quadratic list summation + --> RUF017_0.py:5:22 | 4 | # RUF017 5 | sum([x, y], start=[]) @@ -49,8 +51,9 @@ error[RUF017]: RUF017_0.py:6:1: [*] Avoid quadratic list summation 8 10 | sum([[1, 2, 3], [4, 5, 6]], []) 9 11 | sum([[1, 2, 3], [4, 5, 6]], -error[RUF017]: RUF017_0.py:7:1: [*] Avoid quadratic list summation +error[RUF017]: 7:1: [*] Avoid quadratic list summation + --> RUF017_0.py:6:16 | 5 | sum([x, y], start=[]) 6 | sum([x, y], []) @@ -75,8 +78,9 @@ error[RUF017]: RUF017_0.py:7:1: [*] Avoid quadratic list summation 9 11 | sum([[1, 2, 3], [4, 5, 6]], 10 12 | []) -error[RUF017]: RUF017_0.py:8:1: [*] Avoid quadratic list summation +error[RUF017]: 8:1: [*] Avoid quadratic list summation + --> RUF017_0.py:7:38 | 6 | sum([x, y], []) 7 | sum([[1, 2, 3], [4, 5, 6]], start=[]) @@ -102,8 +106,9 @@ error[RUF017]: RUF017_0.py:8:1: [*] Avoid quadratic list summation 10 12 | []) 11 13 | -error[RUF017]: RUF017_0.py:9:1: [*] Avoid quadratic list summation +error[RUF017]: 9:1: [*] Avoid quadratic list summation + --> RUF017_0.py:8:32 | 7 | sum([[1, 2, 3], [4, 5, 6]], start=[]) 8 | sum([[1, 2, 3], [4, 5, 6]], []) @@ -131,8 +136,9 @@ error[RUF017]: RUF017_0.py:9:1: [*] Avoid quadratic list summation 12 13 | # OK 13 14 | sum([x, y]) -error[RUF017]: RUF017_0.py:21:5: [*] Avoid quadratic list summation +error[RUF017]: 21:5: [*] Avoid quadratic list summation + --> RUF017_0.py:21:5 | 19 | import functools, operator 20 | @@ -150,8 +156,9 @@ error[RUF017]: RUF017_0.py:21:5: [*] Avoid quadratic list summation 23 23 | 24 24 | # Regression test for: https://github.com/astral-sh/ruff/issues/7718 -error[RUF017]: RUF017_0.py:26:5: [*] Avoid quadratic list summation +error[RUF017]: 26:5: [*] Avoid quadratic list summation + --> RUF017_0.py:26:5 | 24 | # Regression test for: https://github.com/astral-sh/ruff/issues/7718 25 | def func(): diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF017_RUF017_1.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF017_RUF017_1.py.snap index cf0c79d3ea..4af0587d77 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF017_RUF017_1.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF017_RUF017_1.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs --- -error[RUF017]: RUF017_1.py:1:1: [*] Avoid quadratic list summation +error[RUF017]: 1:1: [*] Avoid quadratic list summation + --> RUF017_1.py:1:1 | 1 | sum((factor.dims for factor in bases), []) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF018_RUF018.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF018_RUF018.py.snap index 107089e1e0..3878a20641 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF018_RUF018.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF018_RUF018.py.snap @@ -1,16 +1,18 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs --- -error[RUF018]: RUF018.py:2:9: Avoid assignment expressions in `assert` statements +error[RUF018]: 2:9: Avoid assignment expressions in `assert` statements + --> RUF018.py:2:9 | 1 | # RUF018 2 | assert (x := 0) == 0 | ^^^^^^ 3 | assert x, (y := "error") | -error[RUF018]: RUF018.py:3:12: Avoid assignment expressions in `assert` statements +error[RUF018]: 3:12: Avoid assignment expressions in `assert` statements + --> RUF018.py:3:12 | 1 | # RUF018 2 | assert (x := 0) == 0 diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF019_RUF019.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF019_RUF019.py.snap index f536eb250a..d44918146f 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF019_RUF019.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF019_RUF019.py.snap @@ -1,16 +1,17 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs --- -RUF019.py:3:4: RUF019 [*] Unnecessary key check before dictionary access +error[RUF019]: 3:4: [*] Unnecessary key check before dictionary access + + --> RUF019.py:3:4 | 1 | d = {} 2 | # RUF019 3 | if "k" in d and d["k"]: - | ^^^^^^^^^^^^^^^^^^^ RUF019 + | ^^^^^^^^^^^^^^^^^^^ 4 | pass | = help: Replace with `dict.get` - ℹ Safe fix 1 1 | d = {} 2 2 | # RUF019 @@ -20,15 +21,16 @@ RUF019.py:3:4: RUF019 [*] Unnecessary key check before dictionary access 5 5 | 6 6 | k = "k" -RUF019.py:7:4: RUF019 [*] Unnecessary key check before dictionary access +error[RUF019]: 7:4: [*] Unnecessary key check before dictionary access + + --> RUF019.py:7:4 | 6 | k = "k" 7 | if k in d and d[k]: - | ^^^^^^^^^^^^^^^ RUF019 + | ^^^^^^^^^^^^^^^ 8 | pass | = help: Replace with `dict.get` - ℹ Safe fix 4 4 | pass 5 5 | @@ -39,16 +41,17 @@ RUF019.py:7:4: RUF019 [*] Unnecessary key check before dictionary access 9 9 | 10 10 | if (k) in d and d[k]: -RUF019.py:10:4: RUF019 [*] Unnecessary key check before dictionary access +error[RUF019]: 10:4: [*] Unnecessary key check before dictionary access + + --> RUF019.py:10:4 | 8 | pass 9 | 10 | if (k) in d and d[k]: - | ^^^^^^^^^^^^^^^^^ RUF019 + | ^^^^^^^^^^^^^^^^^ 11 | pass | = help: Replace with `dict.get` - ℹ Safe fix 7 7 | if k in d and d[k]: 8 8 | pass @@ -59,16 +62,17 @@ RUF019.py:10:4: RUF019 [*] Unnecessary key check before dictionary access 12 12 | 13 13 | if k in d and d[(k)]: -RUF019.py:13:4: RUF019 [*] Unnecessary key check before dictionary access +error[RUF019]: 13:4: [*] Unnecessary key check before dictionary access + + --> RUF019.py:13:4 | 11 | pass 12 | 13 | if k in d and d[(k)]: - | ^^^^^^^^^^^^^^^^^ RUF019 + | ^^^^^^^^^^^^^^^^^ 14 | pass | = help: Replace with `dict.get` - ℹ Safe fix 10 10 | if (k) in d and d[k]: 11 11 | pass @@ -79,17 +83,18 @@ RUF019.py:13:4: RUF019 [*] Unnecessary key check before dictionary access 15 15 | 16 16 | not ("key" in dct and dct["key"]) -RUF019.py:16:6: RUF019 [*] Unnecessary key check before dictionary access +error[RUF019]: 16:6: [*] Unnecessary key check before dictionary access + + --> RUF019.py:16:6 | 14 | pass 15 | 16 | not ("key" in dct and dct["key"]) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF019 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ 17 | 18 | bool("key" in dct and dct["key"]) | = help: Replace with `dict.get` - ℹ Safe fix 13 13 | if k in d and d[(k)]: 14 14 | pass @@ -100,17 +105,18 @@ RUF019.py:16:6: RUF019 [*] Unnecessary key check before dictionary access 18 18 | bool("key" in dct and dct["key"]) 19 19 | -RUF019.py:18:6: RUF019 [*] Unnecessary key check before dictionary access +error[RUF019]: 18:6: [*] Unnecessary key check before dictionary access + + --> RUF019.py:18:6 | 16 | not ("key" in dct and dct["key"]) 17 | 18 | bool("key" in dct and dct["key"]) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF019 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ 19 | 20 | # OK | = help: Replace with `dict.get` - ℹ Safe fix 15 15 | 16 16 | not ("key" in dct and dct["key"]) diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF020_RUF020.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF020_RUF020.py.snap index a5fc95913d..2e85f4bf57 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF020_RUF020.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF020_RUF020.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs --- -error[RUF020]: RUF020.py:3:7: [*] `Union[Never, T]` is equivalent to `T` +error[RUF020]: 3:7: [*] `Union[Never, T]` is equivalent to `T` + --> RUF020.py:3:7 | 1 | from typing import Never, NoReturn, Union 2 | @@ -21,8 +22,9 @@ error[RUF020]: RUF020.py:3:7: [*] `Union[Never, T]` is equivalent to `T` 5 5 | Never | int 6 6 | NoReturn | int -error[RUF020]: RUF020.py:4:7: [*] `Union[NoReturn, T]` is equivalent to `T` +error[RUF020]: 4:7: [*] `Union[NoReturn, T]` is equivalent to `T` + --> RUF020.py:4:7 | 3 | Union[Never, int] 4 | Union[NoReturn, int] @@ -41,8 +43,9 @@ error[RUF020]: RUF020.py:4:7: [*] `Union[NoReturn, T]` is equivalent to `T` 6 6 | NoReturn | int 7 7 | Union[Union[Never, int], Union[NoReturn, int]] -error[RUF020]: RUF020.py:5:1: [*] `Never | T` is equivalent to `T` +error[RUF020]: 5:1: [*] `Never | T` is equivalent to `T` + --> RUF020.py:4:21 | 3 | Union[Never, int] 4 | Union[NoReturn, int] @@ -62,8 +65,9 @@ error[RUF020]: RUF020.py:5:1: [*] `Never | T` is equivalent to `T` 7 7 | Union[Union[Never, int], Union[NoReturn, int]] 8 8 | Union[NoReturn, int, float] -error[RUF020]: RUF020.py:6:1: [*] `NoReturn | T` is equivalent to `T` +error[RUF020]: 6:1: [*] `NoReturn | T` is equivalent to `T` + --> RUF020.py:5:12 | 4 | Union[NoReturn, int] 5 | Never | int @@ -82,8 +86,9 @@ error[RUF020]: RUF020.py:6:1: [*] `NoReturn | T` is equivalent to `T` 7 7 | Union[Union[Never, int], Union[NoReturn, int]] 8 8 | Union[NoReturn, int, float] -error[RUF020]: RUF020.py:7:13: [*] `Union[Never, T]` is equivalent to `T` +error[RUF020]: 7:13: [*] `Union[Never, T]` is equivalent to `T` + --> RUF020.py:7:13 | 5 | Never | int 6 | NoReturn | int @@ -100,8 +105,9 @@ error[RUF020]: RUF020.py:7:13: [*] `Union[Never, T]` is equivalent to `T` 7 |+Union[int, Union[NoReturn, int]] 8 8 | Union[NoReturn, int, float] -error[RUF020]: RUF020.py:7:32: [*] `Union[NoReturn, T]` is equivalent to `T` +error[RUF020]: 7:32: [*] `Union[NoReturn, T]` is equivalent to `T` + --> RUF020.py:7:32 | 5 | Never | int 6 | NoReturn | int @@ -118,8 +124,9 @@ error[RUF020]: RUF020.py:7:32: [*] `Union[NoReturn, T]` is equivalent to `T` 7 |+Union[Union[Never, int], int] 8 8 | Union[NoReturn, int, float] -error[RUF020]: RUF020.py:8:7: [*] `Union[NoReturn, T]` is equivalent to `T` +error[RUF020]: 8:7: [*] `Union[NoReturn, T]` is equivalent to `T` + --> RUF020.py:8:7 | 6 | NoReturn | int 7 | Union[Union[Never, int], Union[NoReturn, int]] diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF021_RUF021.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF021_RUF021.py.snap index 7fd7c27171..dead3e0278 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF021_RUF021.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF021_RUF021.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs --- -error[RUF021]: RUF021.py:12:10: [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear +error[RUF021]: 12:10: [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear + --> RUF021.py:12:10 | 11 | a, b, c = 1, 0, 2 12 | x = a or b and c # RUF021: => `a or (b and c)` @@ -20,8 +21,9 @@ error[RUF021]: RUF021.py:12:10: [*] Parenthesize `a and b` expressions when chai 14 14 | 15 15 | a, b, c = 0, 1, 2 -error[RUF021]: RUF021.py:13:10: [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear +error[RUF021]: 13:10: [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear + --> RUF021.py:13:10 | 11 | a, b, c = 1, 0, 2 12 | x = a or b and c # RUF021: => `a or (b and c)` @@ -41,8 +43,9 @@ error[RUF021]: RUF021.py:13:10: [*] Parenthesize `a and b` expressions when chai 15 15 | a, b, c = 0, 1, 2 16 16 | y = a and b or c # RUF021: => `(a and b) or c` -error[RUF021]: RUF021.py:16:5: [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear +error[RUF021]: 16:5: [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear + --> RUF021.py:16:5 | 15 | a, b, c = 0, 1, 2 16 | y = a and b or c # RUF021: => `(a and b) or c` @@ -61,8 +64,9 @@ error[RUF021]: RUF021.py:16:5: [*] Parenthesize `a and b` expressions when chain 18 18 | a, b, c, d = 1, 2, 0, 3 19 19 | if a or b or c and d: # RUF021: => `a or b or (c and d)` -error[RUF021]: RUF021.py:19:14: [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear +error[RUF021]: 19:14: [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear + --> RUF021.py:19:14 | 18 | a, b, c, d = 1, 2, 0, 3 19 | if a or b or c and d: # RUF021: => `a or b or (c and d)` @@ -80,8 +84,9 @@ error[RUF021]: RUF021.py:19:14: [*] Parenthesize `a and b` expressions when chai 21 21 | 22 22 | a, b, c, d = 0, 0, 2, 3 -error[RUF021]: RUF021.py:26:11: [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear +error[RUF021]: 26:11: [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear + --> RUF021.py:26:11 | 24 | if bool(): 25 | pass @@ -100,8 +105,9 @@ error[RUF021]: RUF021.py:26:11: [*] Parenthesize `a and b` expressions when chai 28 28 | 29 29 | a, b, c, d = 0, 1, 0, 2 -error[RUF021]: RUF021.py:30:7: [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear +error[RUF021]: 30:7: [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear + --> RUF021.py:30:7 | 29 | a, b, c, d = 0, 1, 0, 2 30 | while a and b or c and d: # RUF021: => `(and b) or (c and d)` @@ -119,8 +125,9 @@ error[RUF021]: RUF021.py:30:7: [*] Parenthesize `a and b` expressions when chain 32 32 | 33 33 | b, c, d, e = 2, 3, 0, 4 -error[RUF021]: RUF021.py:30:18: [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear +error[RUF021]: 30:18: [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear + --> RUF021.py:30:18 | 29 | a, b, c, d = 0, 1, 0, 2 30 | while a and b or c and d: # RUF021: => `(and b) or (c and d)` @@ -138,8 +145,9 @@ error[RUF021]: RUF021.py:30:18: [*] Parenthesize `a and b` expressions when chai 32 32 | 33 33 | b, c, d, e = 2, 3, 0, 4 -error[RUF021]: RUF021.py:35:44: [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear +error[RUF021]: 35:44: [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear + --> RUF021.py:35:44 | 33 | b, c, d, e = 2, 3, 0, 4 34 | # RUF021: => `a or b or c or (d and e)`: @@ -159,8 +167,9 @@ error[RUF021]: RUF021.py:35:44: [*] Parenthesize `a and b` expressions when chai 37 37 | a, b, c, d = 0, 1, 3, 0 38 38 | assert not a and b or c or d # RUF021: => `(not a and b) or c or d` -error[RUF021]: RUF021.py:38:8: [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear +error[RUF021]: 38:8: [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear + --> RUF021.py:38:8 | 37 | a, b, c, d = 0, 1, 3, 0 38 | assert not a and b or c or d # RUF021: => `(not a and b) or c or d` @@ -179,8 +188,9 @@ error[RUF021]: RUF021.py:38:8: [*] Parenthesize `a and b` expressions when chain 40 40 | if (not a) and b or c or d: # RUF021: => `((not a) and b) or c or d` 41 41 | if (not a and b) or c or d: # OK -error[RUF021]: RUF021.py:40:4: [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear +error[RUF021]: 40:4: [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear + --> RUF021.py:40:4 | 38 | assert not a and b or c or d # RUF021: => `(not a and b) or c or d` 39 | @@ -200,8 +210,9 @@ error[RUF021]: RUF021.py:40:4: [*] Parenthesize `a and b` expressions when chain 42 42 | pass 43 43 | -error[RUF021]: RUF021.py:46:8: [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear +error[RUF021]: 46:8: [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear + --> RUF021.py:46:8 | 44 | if ( 45 | some_reasonably_long_condition @@ -225,8 +236,9 @@ error[RUF021]: RUF021.py:46:8: [*] Parenthesize `a and b` expressions when chain 49 49 | and some_fifth_reasonably_long_condition 50 50 | # a comment -error[RUF021]: RUF021.py:48:8: [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear +error[RUF021]: 48:8: [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear + --> RUF021.py:48:8 | 46 | or some_other_reasonably_long_condition 47 | and some_third_reasonably_long_condition diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF022_RUF022.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF022_RUF022.py.snap index 81936872ad..6fdd499254 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF022_RUF022.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF022_RUF022.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs --- -error[RUF022]: RUF022.py:5:11: [*] `__all__` is not sorted +error[RUF022]: 5:11: [*] `__all__` is not sorted + --> RUF022.py:5:11 | 3 | ################################################## 4 | @@ -22,8 +23,9 @@ error[RUF022]: RUF022.py:5:11: [*] `__all__` is not sorted 7 7 | __all__ = ("d", "c", "b", "a") 8 8 | -error[RUF022]: RUF022.py:6:12: [*] `__all__` is not sorted +error[RUF022]: 6:12: [*] `__all__` is not sorted + --> RUF022.py:6:12 | 5 | __all__ = ["d", "c", "b", "a"] # a comment that is untouched 6 | __all__ += ["foo", "bar", "antipasti"] @@ -41,8 +43,9 @@ error[RUF022]: RUF022.py:6:12: [*] `__all__` is not sorted 8 8 | 9 9 | # Quoting style is retained, -error[RUF022]: RUF022.py:7:11: [*] `__all__` is not sorted +error[RUF022]: 7:11: [*] `__all__` is not sorted + --> RUF022.py:7:11 | 5 | __all__ = ["d", "c", "b", "a"] # a comment that is untouched 6 | __all__ += ["foo", "bar", "antipasti"] @@ -62,8 +65,9 @@ error[RUF022]: RUF022.py:7:11: [*] `__all__` is not sorted 9 9 | # Quoting style is retained, 10 10 | # but unnecessary parens are not -error[RUF022]: RUF022.py:11:17: [*] `__all__` is not sorted +error[RUF022]: 11:17: [*] `__all__` is not sorted + --> RUF022.py:11:17 | 9 | # Quoting style is retained, 10 | # but unnecessary parens are not @@ -83,8 +87,9 @@ error[RUF022]: RUF022.py:11:17: [*] `__all__` is not sorted 13 13 | # (but they are in multiline `__all__` definitions) 14 14 | __all__: tuple = ("b", "c", "a",) -error[RUF022]: RUF022.py:14:18: [*] `__all__` is not sorted +error[RUF022]: 14:18: [*] `__all__` is not sorted + --> RUF022.py:14:18 | 12 | # Trailing commas are also not retained in single-line `__all__` definitions 13 | # (but they are in multiline `__all__` definitions) @@ -104,8 +109,9 @@ error[RUF022]: RUF022.py:14:18: [*] `__all__` is not sorted 16 16 | if bool(): 17 17 | __all__ += ("x", "m", "a", "s") -error[RUF022]: RUF022.py:17:16: [*] `__all__` is not sorted +error[RUF022]: 17:16: [*] `__all__` is not sorted + --> RUF022.py:17:16 | 16 | if bool(): 17 | __all__ += ("x", "m", "a", "s") @@ -124,8 +130,9 @@ error[RUF022]: RUF022.py:17:16: [*] `__all__` is not sorted 19 19 | __all__ += "foo3", "foo2", "foo1" # NB: an implicit tuple (without parens) 20 20 | -error[RUF022]: RUF022.py:19:16: [*] `__all__` is not sorted +error[RUF022]: 19:16: [*] `__all__` is not sorted + --> RUF022.py:19:16 | 17 | __all__ += ("x", "m", "a", "s") 18 | else: @@ -145,8 +152,9 @@ error[RUF022]: RUF022.py:19:16: [*] `__all__` is not sorted 21 21 | __all__: list[str] = ["the", "three", "little", "pigs"] 22 22 | -error[RUF022]: RUF022.py:21:22: [*] `__all__` is not sorted +error[RUF022]: 21:22: [*] `__all__` is not sorted + --> RUF022.py:21:22 | 19 | __all__ += "foo3", "foo2", "foo1" # NB: an implicit tuple (without parens) 20 | @@ -166,8 +174,9 @@ error[RUF022]: RUF022.py:21:22: [*] `__all__` is not sorted 23 23 | __all__ = ("parenthesized_item"), "in", ("an_unparenthesized_tuple") 24 24 | __all__.extend(["foo", "bar"]) -error[RUF022]: RUF022.py:23:11: [*] `__all__` is not sorted +error[RUF022]: 23:11: [*] `__all__` is not sorted + --> RUF022.py:23:11 | 21 | __all__: list[str] = ["the", "three", "little", "pigs"] 22 | @@ -187,8 +196,9 @@ error[RUF022]: RUF022.py:23:11: [*] `__all__` is not sorted 25 25 | __all__.extend(("foo", "bar")) 26 26 | __all__.extend((((["foo", "bar"])))) -error[RUF022]: RUF022.py:24:16: [*] `__all__` is not sorted +error[RUF022]: 24:16: [*] `__all__` is not sorted + --> RUF022.py:24:16 | 23 | __all__ = ("parenthesized_item"), "in", ("an_unparenthesized_tuple") 24 | __all__.extend(["foo", "bar"]) @@ -207,8 +217,9 @@ error[RUF022]: RUF022.py:24:16: [*] `__all__` is not sorted 26 26 | __all__.extend((((["foo", "bar"])))) 27 27 | -error[RUF022]: RUF022.py:25:16: [*] `__all__` is not sorted +error[RUF022]: 25:16: [*] `__all__` is not sorted + --> RUF022.py:25:16 | 23 | __all__ = ("parenthesized_item"), "in", ("an_unparenthesized_tuple") 24 | __all__.extend(["foo", "bar"]) @@ -227,8 +238,9 @@ error[RUF022]: RUF022.py:25:16: [*] `__all__` is not sorted 27 27 | 28 28 | #################################### -error[RUF022]: RUF022.py:26:19: [*] `__all__` is not sorted +error[RUF022]: 26:19: [*] `__all__` is not sorted + --> RUF022.py:26:19 | 24 | __all__.extend(["foo", "bar"]) 25 | __all__.extend(("foo", "bar")) @@ -248,8 +260,9 @@ error[RUF022]: RUF022.py:26:19: [*] `__all__` is not sorted 28 28 | #################################### 29 29 | # Neat multiline __all__ definitions -error[RUF022]: RUF022.py:32:11: [*] `__all__` is not sorted +error[RUF022]: 32:11: [*] `__all__` is not sorted + --> RUF022.py:32:11 | 30 | #################################### 31 | @@ -283,8 +296,9 @@ error[RUF022]: RUF022.py:32:11: [*] `__all__` is not sorted 39 39 | 40 40 | __all__ = [ -error[RUF022]: RUF022.py:40:11: [*] `__all__` is not sorted +error[RUF022]: 40:11: [*] `__all__` is not sorted + --> RUF022.py:40:11 | 38 | ) 39 | @@ -318,8 +332,9 @@ error[RUF022]: RUF022.py:40:11: [*] `__all__` is not sorted 47 47 | 48 48 | # we implement an "isort-style sort": -error[RUF022]: RUF022.py:54:11: [*] `__all__` is not sorted +error[RUF022]: 54:11: [*] `__all__` is not sorted + --> RUF022.py:54:11 | 52 | # This (which is currently alphabetically sorted) 53 | # should get reordered accordingly: @@ -405,8 +420,9 @@ error[RUF022]: RUF022.py:54:11: [*] `__all__` is not sorted 86 87 | ########################################## 87 88 | # Messier multiline __all__ definitions... -error[RUF022]: RUF022.py:91:11: [*] `__all__` is not sorted +error[RUF022]: 91:11: [*] `__all__` is not sorted + --> RUF022.py:91:11 | 90 | # comment0 91 | __all__ = ("d", "a", # comment1 @@ -444,8 +460,9 @@ error[RUF022]: RUF022.py:91:11: [*] `__all__` is not sorted 98 101 | ) # comment6 99 102 | # comment7 -error[RUF022]: RUF022.py:101:11: [*] `__all__` is not sorted +error[RUF022]: 101:11: [*] `__all__` is not sorted + --> RUF022.py:101:11 | 99 | # comment7 100 | @@ -478,8 +495,9 @@ error[RUF022]: RUF022.py:101:11: [*] `__all__` is not sorted 106 109 | # comment5 107 110 | # comment6 -error[RUF022]: RUF022.py:110:11: [*] `__all__` is not sorted +error[RUF022]: 110:11: [*] `__all__` is not sorted + --> RUF022.py:110:11 | 108 | ] # comment7 109 | @@ -571,8 +589,9 @@ error[RUF022]: RUF022.py:110:11: [*] `__all__` is not sorted 125 157 | __all__: tuple[str, ...] = ( # a comment about the opening paren 126 158 | # multiline comment about "bbb" part 1 -error[RUF022]: RUF022.py:125:28: [*] `__all__` is not sorted +error[RUF022]: 125:28: [*] `__all__` is not sorted + --> RUF022.py:125:28 | 123 | "register_error", "lookup_error"] 124 | @@ -607,8 +626,9 @@ error[RUF022]: RUF022.py:125:28: [*] `__all__` is not sorted 133 133 | 134 134 | # we use natural sort for `__all__`, -error[RUF022]: RUF022.py:138:11: [*] `__all__` is not sorted +error[RUF022]: 138:11: [*] `__all__` is not sorted + --> RUF022.py:138:11 | 136 | # Also, this doesn't end with a trailing comma, 137 | # so the autofix shouldn't introduce one: @@ -639,8 +659,9 @@ error[RUF022]: RUF022.py:138:11: [*] `__all__` is not sorted 144 144 | 145 145 | __all__.extend(( # comment0 -error[RUF022]: RUF022.py:145:16: [*] `__all__` is not sorted +error[RUF022]: 145:16: [*] `__all__` is not sorted + --> RUF022.py:145:16 | 143 | ) 144 | @@ -672,8 +693,9 @@ error[RUF022]: RUF022.py:145:16: [*] `__all__` is not sorted 151 151 | )) # comment2 152 152 | -error[RUF022]: RUF022.py:155:5: [*] `__all__` is not sorted +error[RUF022]: 155:5: [*] `__all__` is not sorted + --> RUF022.py:155:5 | 153 | __all__.extend( # comment0 154 | # comment1 @@ -704,8 +726,9 @@ error[RUF022]: RUF022.py:155:5: [*] `__all__` is not sorted 161 161 | ) # comment4 162 162 | ) # comment2 -error[RUF022]: RUF022.py:164:16: [*] `__all__` is not sorted +error[RUF022]: 164:16: [*] `__all__` is not sorted + --> RUF022.py:164:16 | 162 | ) # comment2 163 | @@ -737,8 +760,9 @@ error[RUF022]: RUF022.py:164:16: [*] `__all__` is not sorted 170 170 | ]) # comment2 171 171 | -error[RUF022]: RUF022.py:174:5: [*] `__all__` is not sorted +error[RUF022]: 174:5: [*] `__all__` is not sorted + --> RUF022.py:174:5 | 172 | __all__.extend( # comment0 173 | # comment1 @@ -769,8 +793,9 @@ error[RUF022]: RUF022.py:174:5: [*] `__all__` is not sorted 180 180 | ] # comment4 181 181 | ) # comment2 -error[RUF022]: RUF022.py:183:11: [*] `__all__` is not sorted +error[RUF022]: 183:11: [*] `__all__` is not sorted + --> RUF022.py:183:11 | 181 | ) # comment2 182 | @@ -801,8 +826,9 @@ error[RUF022]: RUF022.py:183:11: [*] `__all__` is not sorted 187 190 | 188 191 | __all__ = ["Awaitable", "Coroutine", -error[RUF022]: RUF022.py:188:11: [*] `__all__` is not sorted +error[RUF022]: 188:11: [*] `__all__` is not sorted + --> RUF022.py:188:11 | 186 | ] 187 | @@ -833,8 +859,9 @@ error[RUF022]: RUF022.py:188:11: [*] `__all__` is not sorted 192 196 | __all__ = [ 193 197 | "foo", -error[RUF022]: RUF022.py:192:11: [*] `__all__` is not sorted +error[RUF022]: 192:11: [*] `__all__` is not sorted + --> RUF022.py:192:11 | 190 | ] 191 | @@ -861,8 +888,9 @@ error[RUF022]: RUF022.py:192:11: [*] `__all__` is not sorted 197 197 | 198 198 | ######################################################################### -error[RUF022]: RUF022.py:204:11: `__all__` is not sorted +error[RUF022]: 204:11: `__all__` is not sorted + --> RUF022.py:204:11 | 202 | ######################################################################### 203 | @@ -878,8 +906,9 @@ error[RUF022]: RUF022.py:204:11: `__all__` is not sorted 211 | __all__ = ( | = help: Apply an isort-style sorting to `__all__` -error[RUF022]: RUF022.py:211:11: `__all__` is not sorted +error[RUF022]: 211:11: `__all__` is not sorted + --> RUF022.py:211:11 | 209 | ) 210 | @@ -896,8 +925,9 @@ error[RUF022]: RUF022.py:211:11: `__all__` is not sorted 219 | __all__ = ("don't" "care" "about", "__all__" "with", "concatenated" "strings") | = help: Apply an isort-style sorting to `__all__` -error[RUF022]: RUF022.py:219:11: `__all__` is not sorted +error[RUF022]: 219:11: `__all__` is not sorted + --> RUF022.py:219:11 | 217 | ) 218 | @@ -907,8 +937,9 @@ error[RUF022]: RUF022.py:219:11: `__all__` is not sorted 221 | ############################################################ | = help: Apply an isort-style sorting to `__all__` -error[RUF022]: RUF022.py:225:11: [*] `__all__` is not sorted +error[RUF022]: 225:11: [*] `__all__` is not sorted + --> RUF022.py:225:11 | 223 | ############################################################ 224 | @@ -933,8 +964,9 @@ error[RUF022]: RUF022.py:225:11: [*] `__all__` is not sorted 229 230 | __all__ = [ 230 231 | "loads", -error[RUF022]: RUF022.py:229:11: [*] `__all__` is not sorted +error[RUF022]: 229:11: [*] `__all__` is not sorted + --> RUF022.py:229:11 | 227 | "dumps",) 228 | @@ -959,8 +991,9 @@ error[RUF022]: RUF022.py:229:11: [*] `__all__` is not sorted 233 233 | __all__ = ['xp', 'yp', 234 234 | 'canvas' -error[RUF022]: RUF022.py:233:11: [*] `__all__` is not sorted +error[RUF022]: 233:11: [*] `__all__` is not sorted + --> RUF022.py:233:11 | 231 | "dumps" , ] 232 | @@ -993,8 +1026,9 @@ error[RUF022]: RUF022.py:233:11: [*] `__all__` is not sorted 236 238 | # very strangely placed comment 237 239 | -error[RUF022]: RUF022.py:243:11: [*] `__all__` is not sorted +error[RUF022]: 243:11: [*] `__all__` is not sorted + --> RUF022.py:243:11 | 241 | ] 242 | @@ -1028,8 +1062,9 @@ error[RUF022]: RUF022.py:243:11: [*] `__all__` is not sorted 250 249 | , 251 250 | ) -error[RUF022]: RUF022.py:253:11: [*] `__all__` is not sorted +error[RUF022]: 253:11: [*] `__all__` is not sorted + --> RUF022.py:253:11 | 251 | ) 252 | diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF023_RUF023.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF023_RUF023.py.snap index 7365bb1259..ea00dcc9c4 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF023_RUF023.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF023_RUF023.py.snap @@ -1,15 +1,16 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs --- -RUF023.py:6:17: RUF023 [*] `Klass.__slots__` is not sorted +error[RUF023]: 6:17: [*] `Klass.__slots__` is not sorted + + --> RUF023.py:6:17 | 5 | class Klass: 6 | __slots__ = ["d", "c", "b", "a"] # a comment that is untouched - | ^^^^^^^^^^^^^^^^^^^^ RUF023 + | ^^^^^^^^^^^^^^^^^^^^ 7 | __slots__ = ("d", "c", "b", "a") | = help: Apply a natural sort to `Klass.__slots__` - ℹ Safe fix 3 3 | ######################### 4 4 | @@ -20,17 +21,18 @@ RUF023.py:6:17: RUF023 [*] `Klass.__slots__` is not sorted 8 8 | 9 9 | # Quoting style is retained, -RUF023.py:7:17: RUF023 [*] `Klass.__slots__` is not sorted +error[RUF023]: 7:17: [*] `Klass.__slots__` is not sorted + + --> RUF023.py:7:17 | 5 | class Klass: 6 | __slots__ = ["d", "c", "b", "a"] # a comment that is untouched 7 | __slots__ = ("d", "c", "b", "a") - | ^^^^^^^^^^^^^^^^^^^^ RUF023 + | ^^^^^^^^^^^^^^^^^^^^ 8 | 9 | # Quoting style is retained, | = help: Apply a natural sort to `Klass.__slots__` - ℹ Safe fix 4 4 | 5 5 | class Klass: @@ -41,17 +43,18 @@ RUF023.py:7:17: RUF023 [*] `Klass.__slots__` is not sorted 9 9 | # Quoting style is retained, 10 10 | # but unnecessary parens are not -RUF023.py:11:22: RUF023 [*] `Klass.__slots__` is not sorted +error[RUF023]: 11:22: [*] `Klass.__slots__` is not sorted + + --> RUF023.py:11:22 | 9 | # Quoting style is retained, 10 | # but unnecessary parens are not 11 | __slots__: set = {'b', "c", ((('a')))} - | ^^^^^^^^^^^^^^^^^^^^^ RUF023 + | ^^^^^^^^^^^^^^^^^^^^^ 12 | # Trailing commas are also not retained for single-line definitions 13 | # (but they are in multiline definitions) | = help: Apply a natural sort to `Klass.__slots__` - ℹ Safe fix 8 8 | 9 9 | # Quoting style is retained, @@ -62,17 +65,18 @@ RUF023.py:11:22: RUF023 [*] `Klass.__slots__` is not sorted 13 13 | # (but they are in multiline definitions) 14 14 | __slots__: tuple = ("b", "c", "a",) -RUF023.py:14:24: RUF023 [*] `Klass.__slots__` is not sorted +error[RUF023]: 14:24: [*] `Klass.__slots__` is not sorted + + --> RUF023.py:14:24 | 12 | # Trailing commas are also not retained for single-line definitions 13 | # (but they are in multiline definitions) 14 | __slots__: tuple = ("b", "c", "a",) - | ^^^^^^^^^^^^^^^^ RUF023 + | ^^^^^^^^^^^^^^^^ 15 | 16 | class Klass2: | = help: Apply a natural sort to `Klass.__slots__` - ℹ Safe fix 11 11 | __slots__: set = {'b', "c", ((('a')))} 12 12 | # Trailing commas are also not retained for single-line definitions @@ -83,17 +87,18 @@ RUF023.py:14:24: RUF023 [*] `Klass.__slots__` is not sorted 16 16 | class Klass2: 17 17 | if bool(): -RUF023.py:18:21: RUF023 [*] `Klass2.__slots__` is not sorted +error[RUF023]: 18:21: [*] `Klass2.__slots__` is not sorted + + --> RUF023.py:18:21 | 16 | class Klass2: 17 | if bool(): 18 | __slots__ = {"x": "docs for x", "m": "docs for m", "a": "docs for a"} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF023 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 19 | else: 20 | __slots__ = "foo3", "foo2", "foo1" # NB: an implicit tuple (without parens) | = help: Apply a natural sort to `Klass2.__slots__` - ℹ Safe fix 15 15 | 16 16 | class Klass2: @@ -104,17 +109,18 @@ RUF023.py:18:21: RUF023 [*] `Klass2.__slots__` is not sorted 20 20 | __slots__ = "foo3", "foo2", "foo1" # NB: an implicit tuple (without parens) 21 21 | -RUF023.py:20:21: RUF023 [*] `Klass2.__slots__` is not sorted +error[RUF023]: 20:21: [*] `Klass2.__slots__` is not sorted + + --> RUF023.py:20:21 | 18 | __slots__ = {"x": "docs for x", "m": "docs for m", "a": "docs for a"} 19 | else: 20 | __slots__ = "foo3", "foo2", "foo1" # NB: an implicit tuple (without parens) - | ^^^^^^^^^^^^^^^^^^^^^^ RUF023 + | ^^^^^^^^^^^^^^^^^^^^^^ 21 | 22 | __slots__: list[str] = ["the", "three", "little", "pigs"] | = help: Apply a natural sort to `Klass2.__slots__` - ℹ Safe fix 17 17 | if bool(): 18 18 | __slots__ = {"x": "docs for x", "m": "docs for m", "a": "docs for a"} @@ -125,17 +131,18 @@ RUF023.py:20:21: RUF023 [*] `Klass2.__slots__` is not sorted 22 22 | __slots__: list[str] = ["the", "three", "little", "pigs"] 23 23 | __slots__ = ("parenthesized_item"), "in", ("an_unparenthesized_tuple") -RUF023.py:22:28: RUF023 [*] `Klass2.__slots__` is not sorted +error[RUF023]: 22:28: [*] `Klass2.__slots__` is not sorted + + --> RUF023.py:22:28 | 20 | __slots__ = "foo3", "foo2", "foo1" # NB: an implicit tuple (without parens) 21 | 22 | __slots__: list[str] = ["the", "three", "little", "pigs"] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF023 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 23 | __slots__ = ("parenthesized_item"), "in", ("an_unparenthesized_tuple") 24 | # we use natural sort, | = help: Apply a natural sort to `Klass2.__slots__` - ℹ Safe fix 19 19 | else: 20 20 | __slots__ = "foo3", "foo2", "foo1" # NB: an implicit tuple (without parens) @@ -146,16 +153,17 @@ RUF023.py:22:28: RUF023 [*] `Klass2.__slots__` is not sorted 24 24 | # we use natural sort, 25 25 | # not alphabetical sort or "isort-style" sort -RUF023.py:23:17: RUF023 [*] `Klass2.__slots__` is not sorted +error[RUF023]: 23:17: [*] `Klass2.__slots__` is not sorted + + --> RUF023.py:23:17 | 22 | __slots__: list[str] = ["the", "three", "little", "pigs"] 23 | __slots__ = ("parenthesized_item"), "in", ("an_unparenthesized_tuple") - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF023 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 24 | # we use natural sort, 25 | # not alphabetical sort or "isort-style" sort | = help: Apply a natural sort to `Klass2.__slots__` - ℹ Safe fix 20 20 | __slots__ = "foo3", "foo2", "foo1" # NB: an implicit tuple (without parens) 21 21 | @@ -166,17 +174,18 @@ RUF023.py:23:17: RUF023 [*] `Klass2.__slots__` is not sorted 25 25 | # not alphabetical sort or "isort-style" sort 26 26 | __slots__ = {"aadvark237", "aadvark10092", "aadvark174", "aadvark532"} -RUF023.py:26:17: RUF023 [*] `Klass2.__slots__` is not sorted +error[RUF023]: 26:17: [*] `Klass2.__slots__` is not sorted + + --> RUF023.py:26:17 | 24 | # we use natural sort, 25 | # not alphabetical sort or "isort-style" sort 26 | __slots__ = {"aadvark237", "aadvark10092", "aadvark174", "aadvark532"} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF023 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 27 | 28 | ############################ | = help: Apply a natural sort to `Klass2.__slots__` - ℹ Safe fix 23 23 | __slots__ = ("parenthesized_item"), "in", ("an_unparenthesized_tuple") 24 24 | # we use natural sort, @@ -187,7 +196,9 @@ RUF023.py:26:17: RUF023 [*] `Klass2.__slots__` is not sorted 28 28 | ############################ 29 29 | # Neat multiline definitions -RUF023.py:33:17: RUF023 [*] `Klass3.__slots__` is not sorted +error[RUF023]: 33:17: [*] `Klass3.__slots__` is not sorted + + --> RUF023.py:33:17 | 32 | class Klass3: 33 | __slots__ = ( @@ -198,12 +209,11 @@ RUF023.py:33:17: RUF023 [*] `Klass3.__slots__` is not sorted 37 | | # a comment regarding 'a0': 38 | | "a0" 39 | | ) - | |_____^ RUF023 + | |_____^ 40 | __slots__ = [ 41 | "d", | = help: Apply a natural sort to `Klass3.__slots__` - ℹ Safe fix 31 31 | 32 32 | class Klass3: @@ -221,7 +231,9 @@ RUF023.py:33:17: RUF023 [*] `Klass3.__slots__` is not sorted 40 40 | __slots__ = [ 41 41 | "d", -RUF023.py:40:17: RUF023 [*] `Klass3.__slots__` is not sorted +error[RUF023]: 40:17: [*] `Klass3.__slots__` is not sorted + + --> RUF023.py:40:17 | 38 | "a0" 39 | ) @@ -233,12 +245,11 @@ RUF023.py:40:17: RUF023 [*] `Klass3.__slots__` is not sorted 44 | | # a comment regarding 'a': 45 | | "a" 46 | | ] - | |_____^ RUF023 + | |_____^ 47 | 48 | ################################## | = help: Apply a natural sort to `Klass3.__slots__` - ℹ Safe fix 38 38 | "a0" 39 39 | ) @@ -256,7 +267,9 @@ RUF023.py:40:17: RUF023 [*] `Klass3.__slots__` is not sorted 47 47 | 48 48 | ################################## -RUF023.py:54:17: RUF023 [*] `Klass4.__slots__` is not sorted +error[RUF023]: 54:17: [*] `Klass4.__slots__` is not sorted + + --> RUF023.py:54:17 | 52 | class Klass4: 53 | # comment0 @@ -269,11 +282,10 @@ RUF023.py:54:17: RUF023 [*] `Klass4.__slots__` is not sorted 59 | | "formatted", 60 | | # comment5 61 | | ) # comment6 - | |_____^ RUF023 + | |_____^ 62 | # comment7 | = help: Apply a natural sort to `Klass4.__slots__` - ℹ Safe fix 51 51 | 52 52 | class Klass4: @@ -296,7 +308,9 @@ RUF023.py:54:17: RUF023 [*] `Klass4.__slots__` is not sorted 61 64 | ) # comment6 62 65 | # comment7 -RUF023.py:64:17: RUF023 [*] `Klass4.__slots__` is not sorted +error[RUF023]: 64:17: [*] `Klass4.__slots__` is not sorted + + --> RUF023.py:64:17 | 62 | # comment7 63 | @@ -309,12 +323,11 @@ RUF023.py:64:17: RUF023 [*] `Klass4.__slots__` is not sorted 69 | | # comment5 70 | | # comment6 71 | | ] # comment7 - | |_____^ RUF023 + | |_____^ 72 | 73 | # from cpython/Lib/pathlib/__init__.py | = help: Apply a natural sort to `Klass4.__slots__` - ℹ Safe fix 62 62 | # comment7 63 63 | @@ -330,7 +343,9 @@ RUF023.py:64:17: RUF023 [*] `Klass4.__slots__` is not sorted 69 72 | # comment5 70 73 | # comment6 -RUF023.py:75:17: RUF023 [*] `PurePath.__slots__` is not sorted +error[RUF023]: 75:17: [*] `PurePath.__slots__` is not sorted + + --> RUF023.py:75:17 | 73 | # from cpython/Lib/pathlib/__init__.py 74 | class PurePath: @@ -370,12 +385,11 @@ RUF023.py:75:17: RUF023 [*] `PurePath.__slots__` is not sorted 107 | | # path. It's set when `__hash__()` is called for the first time. 108 | | '_hash', 109 | | ) - | |_____^ RUF023 + | |_____^ 110 | 111 | # From cpython/Lib/pickletools.py | = help: Apply a natural sort to `PurePath.__slots__` - ℹ Safe fix 73 73 | # from cpython/Lib/pathlib/__init__.py 74 74 | class PurePath: @@ -431,7 +445,9 @@ RUF023.py:75:17: RUF023 [*] `PurePath.__slots__` is not sorted 110 107 | 111 108 | # From cpython/Lib/pickletools.py -RUF023.py:113:17: RUF023 [*] `ArgumentDescriptor.__slots__` is not sorted +error[RUF023]: 113:17: [*] `ArgumentDescriptor.__slots__` is not sorted + + --> RUF023.py:113:17 | 111 | # From cpython/Lib/pickletools.py 112 | class ArgumentDescriptor(object): @@ -453,12 +469,11 @@ RUF023.py:113:17: RUF023 [*] `ArgumentDescriptor.__slots__` is not sorted 127 | | # human-readable docs for this arg descriptor; a string 128 | | 'doc', 129 | | ) - | |_____^ RUF023 + | |_____^ 130 | 131 | #################################### | = help: Apply a natural sort to `ArgumentDescriptor.__slots__` - ℹ Safe fix 111 111 | # From cpython/Lib/pickletools.py 112 112 | class ArgumentDescriptor(object): @@ -486,20 +501,23 @@ RUF023.py:113:17: RUF023 [*] `ArgumentDescriptor.__slots__` is not sorted 130 127 | 131 128 | #################################### -RUF023.py:138:17: RUF023 `SlotUser.__slots__` is not sorted +error[RUF023]: 138:17: `SlotUser.__slots__` is not sorted + + --> RUF023.py:138:17 | 136 | # Multiline dicts are out of scope. 137 | class SlotUser: 138 | __slots__ = {'power': 'measured in kilowatts', | _________________^ 139 | | 'distance': 'measured in kilometers'} - | |______________________________________________________^ RUF023 + | |______________________________________________________^ 140 | 141 | class Klass5: | = help: Apply a natural sort to `SlotUser.__slots__` +error[RUF023]: 142:17: `Klass5.__slots__` is not sorted -RUF023.py:142:17: RUF023 `Klass5.__slots__` is not sorted + --> RUF023.py:142:17 | 141 | class Klass5: 142 | __slots__ = ( @@ -509,13 +527,14 @@ RUF023.py:142:17: RUF023 `Klass5.__slots__` is not sorted 145 | | "a_veeeeeeeeeeeeeeeeeeery_long_parenthesized_item" 146 | | ), 147 | | ) - | |_____^ RUF023 + | |_____^ 148 | __slots__ = ( 149 | "b", | = help: Apply a natural sort to `Klass5.__slots__` +error[RUF023]: 148:17: `Klass5.__slots__` is not sorted -RUF023.py:148:17: RUF023 `Klass5.__slots__` is not sorted + --> RUF023.py:148:17 | 146 | ), 147 | ) @@ -527,34 +546,35 @@ RUF023.py:148:17: RUF023 `Klass5.__slots__` is not sorted 152 | | )), 153 | | "a" 154 | | ) - | |_____^ RUF023 + | |_____^ 155 | __slots__ = ("don't" "care" "about", "__slots__" "with", "concatenated" "strings") | = help: Apply a natural sort to `Klass5.__slots__` +error[RUF023]: 155:17: `Klass5.__slots__` is not sorted -RUF023.py:155:17: RUF023 `Klass5.__slots__` is not sorted + --> RUF023.py:155:17 | 153 | "a" 154 | ) 155 | __slots__ = ("don't" "care" "about", "__slots__" "with", "concatenated" "strings") - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF023 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 156 | 157 | ############################################################ | = help: Apply a natural sort to `Klass5.__slots__` +error[RUF023]: 162:17: [*] `BezierBuilder.__slots__` is not sorted -RUF023.py:162:17: RUF023 [*] `BezierBuilder.__slots__` is not sorted + --> RUF023.py:162:17 | 161 | class BezierBuilder: 162 | __slots__ = ('xp', 'yp', | _________________^ 163 | | 'canvas',) - | |___________________________^ RUF023 + | |___________________________^ 164 | 165 | class BezierBuilder2: | = help: Apply a natural sort to `BezierBuilder.__slots__` - ℹ Safe fix 159 159 | ############################################################ 160 160 | @@ -570,18 +590,19 @@ RUF023.py:162:17: RUF023 [*] `BezierBuilder.__slots__` is not sorted 165 168 | class BezierBuilder2: 166 169 | __slots__ = {'xp', 'yp', -RUF023.py:166:17: RUF023 [*] `BezierBuilder2.__slots__` is not sorted +error[RUF023]: 166:17: [*] `BezierBuilder2.__slots__` is not sorted + + --> RUF023.py:166:17 | 165 | class BezierBuilder2: 166 | __slots__ = {'xp', 'yp', | _________________^ 167 | | 'canvas' , } - | |___________________________________________^ RUF023 + | |___________________________________________^ 168 | 169 | class BezierBuilder3: | = help: Apply a natural sort to `BezierBuilder2.__slots__` - ℹ Safe fix 163 163 | 'canvas',) 164 164 | @@ -596,7 +617,9 @@ RUF023.py:166:17: RUF023 [*] `BezierBuilder2.__slots__` is not sorted 169 171 | class BezierBuilder3: 170 172 | __slots__ = ['xp', 'yp', -RUF023.py:170:17: RUF023 [*] `BezierBuilder3.__slots__` is not sorted +error[RUF023]: 170:17: [*] `BezierBuilder3.__slots__` is not sorted + + --> RUF023.py:170:17 | 169 | class BezierBuilder3: 170 | __slots__ = ['xp', 'yp', @@ -609,12 +632,11 @@ RUF023.py:170:17: RUF023 [*] `BezierBuilder3.__slots__` is not sorted 176 | | 177 | | # another strangely placed comment 178 | | ] - | |__________________^ RUF023 + | |__________________^ 179 | 180 | class BezierBuilder4: | = help: Apply a natural sort to `BezierBuilder3.__slots__` - ℹ Safe fix 167 167 | 'canvas' , } 168 168 | @@ -629,7 +651,9 @@ RUF023.py:170:17: RUF023 [*] `BezierBuilder3.__slots__` is not sorted 173 175 | # very strangely placed comment 174 176 | -RUF023.py:181:17: RUF023 [*] `BezierBuilder4.__slots__` is not sorted +error[RUF023]: 181:17: [*] `BezierBuilder4.__slots__` is not sorted + + --> RUF023.py:181:17 | 180 | class BezierBuilder4: 181 | __slots__ = ( @@ -642,12 +666,11 @@ RUF023.py:181:17: RUF023 [*] `BezierBuilder4.__slots__` is not sorted 187 | | # strange comment 2 188 | | , 189 | | ) - | |_____^ RUF023 + | |_____^ 190 | 191 | __slots__ = {"foo", "bar", | = help: Apply a natural sort to `BezierBuilder4.__slots__` - ℹ Safe fix 179 179 | 180 180 | class BezierBuilder4: @@ -663,7 +686,9 @@ RUF023.py:181:17: RUF023 [*] `BezierBuilder4.__slots__` is not sorted 188 187 | , 189 188 | ) -RUF023.py:191:17: RUF023 [*] `BezierBuilder4.__slots__` is not sorted +error[RUF023]: 191:17: [*] `BezierBuilder4.__slots__` is not sorted + + --> RUF023.py:191:17 | 189 | ) 190 | @@ -671,10 +696,9 @@ RUF023.py:191:17: RUF023 [*] `BezierBuilder4.__slots__` is not sorted | _________________^ 192 | | "baz", "bingo" 193 | | } - | |__________________^ RUF023 + | |__________________^ | = help: Apply a natural sort to `BezierBuilder4.__slots__` - ℹ Safe fix 188 188 | , 189 189 | ) @@ -692,16 +716,17 @@ RUF023.py:191:17: RUF023 [*] `BezierBuilder4.__slots__` is not sorted 195 198 | 196 199 | class VeryDRY: -RUF023.py:199:17: RUF023 [*] `VeryDRY.__slots__` is not sorted +error[RUF023]: 199:17: [*] `VeryDRY.__slots__` is not sorted + + --> RUF023.py:199:17 | 197 | # This should get flagged, *but* the fix is unsafe, 198 | # since the `__slots__` binding is used by the `__match_args__` definition 199 | __slots__ = ("foo", "bar") - | ^^^^^^^^^^^^^^ RUF023 + | ^^^^^^^^^^^^^^ 200 | __match_args__ = __slots__ | = help: Apply a natural sort to `VeryDRY.__slots__` - ℹ Unsafe fix 196 196 | class VeryDRY: 197 197 | # This should get flagged, *but* the fix is unsafe, diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF024_RUF024.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF024_RUF024.py.snap index fce3bdd40a..375b8ee7b3 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF024_RUF024.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF024_RUF024.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs --- -error[RUF024]: RUF024.py:9:1: [*] Do not pass mutable objects as values to `dict.fromkeys` +error[RUF024]: 9:1: [*] Do not pass mutable objects as values to `dict.fromkeys` + --> RUF024.py:8:10 | 8 | # Errors. 9 | dict.fromkeys(pierogi_fillings, []) @@ -21,8 +22,9 @@ error[RUF024]: RUF024.py:9:1: [*] Do not pass mutable objects as values to `dict 11 11 | dict.fromkeys(pierogi_fillings, {}) 12 12 | dict.fromkeys(pierogi_fillings, set()) -error[RUF024]: RUF024.py:10:1: [*] Do not pass mutable objects as values to `dict.fromkeys` +error[RUF024]: 10:1: [*] Do not pass mutable objects as values to `dict.fromkeys` + --> RUF024.py:9:36 | 8 | # Errors. 9 | dict.fromkeys(pierogi_fillings, []) @@ -42,8 +44,9 @@ error[RUF024]: RUF024.py:10:1: [*] Do not pass mutable objects as values to `dic 12 12 | dict.fromkeys(pierogi_fillings, set()) 13 13 | dict.fromkeys(pierogi_fillings, {"pre": "populated!"}) -error[RUF024]: RUF024.py:11:1: [*] Do not pass mutable objects as values to `dict.fromkeys` +error[RUF024]: 11:1: [*] Do not pass mutable objects as values to `dict.fromkeys` + --> RUF024.py:10:40 | 9 | dict.fromkeys(pierogi_fillings, []) 10 | dict.fromkeys(pierogi_fillings, list()) @@ -63,8 +66,9 @@ error[RUF024]: RUF024.py:11:1: [*] Do not pass mutable objects as values to `dic 13 13 | dict.fromkeys(pierogi_fillings, {"pre": "populated!"}) 14 14 | dict.fromkeys(pierogi_fillings, dict()) -error[RUF024]: RUF024.py:12:1: [*] Do not pass mutable objects as values to `dict.fromkeys` +error[RUF024]: 12:1: [*] Do not pass mutable objects as values to `dict.fromkeys` + --> RUF024.py:11:36 | 10 | dict.fromkeys(pierogi_fillings, list()) 11 | dict.fromkeys(pierogi_fillings, {}) @@ -84,8 +88,9 @@ error[RUF024]: RUF024.py:12:1: [*] Do not pass mutable objects as values to `dic 14 14 | dict.fromkeys(pierogi_fillings, dict()) 15 15 | import builtins -error[RUF024]: RUF024.py:13:1: [*] Do not pass mutable objects as values to `dict.fromkeys` +error[RUF024]: 13:1: [*] Do not pass mutable objects as values to `dict.fromkeys` + --> RUF024.py:12:39 | 11 | dict.fromkeys(pierogi_fillings, {}) 12 | dict.fromkeys(pierogi_fillings, set()) @@ -105,8 +110,9 @@ error[RUF024]: RUF024.py:13:1: [*] Do not pass mutable objects as values to `dic 15 15 | import builtins 16 16 | builtins.dict.fromkeys(pierogi_fillings, dict()) -error[RUF024]: RUF024.py:14:1: [*] Do not pass mutable objects as values to `dict.fromkeys` +error[RUF024]: 14:1: [*] Do not pass mutable objects as values to `dict.fromkeys` + --> RUF024.py:13:55 | 12 | dict.fromkeys(pierogi_fillings, set()) 13 | dict.fromkeys(pierogi_fillings, {"pre": "populated!"}) @@ -126,8 +132,9 @@ error[RUF024]: RUF024.py:14:1: [*] Do not pass mutable objects as values to `dic 16 16 | builtins.dict.fromkeys(pierogi_fillings, dict()) 17 17 | -error[RUF024]: RUF024.py:16:1: [*] Do not pass mutable objects as values to `dict.fromkeys` +error[RUF024]: 16:1: [*] Do not pass mutable objects as values to `dict.fromkeys` + --> RUF024.py:15:16 | 14 | dict.fromkeys(pierogi_fillings, dict()) 15 | import builtins diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF026_RUF026.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF026_RUF026.py.snap index ef8de0ea1b..2cee937d45 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF026_RUF026.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF026_RUF026.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs --- -error[RUF026]: RUF026.py:11:5: [*] `default_factory` is a positional-only argument to `defaultdict` +error[RUF026]: 11:5: [*] `default_factory` is a positional-only argument to `defaultdict` + --> RUF026.py:11:5 | 10 | def func(): 11 | defaultdict(default_factory=int) # RUF026 @@ -19,8 +20,9 @@ error[RUF026]: RUF026.py:11:5: [*] `default_factory` is a positional-only argume 13 13 | 14 14 | def func(): -error[RUF026]: RUF026.py:15:5: [*] `default_factory` is a positional-only argument to `defaultdict` +error[RUF026]: 15:5: [*] `default_factory` is a positional-only argument to `defaultdict` + --> RUF026.py:15:5 | 14 | def func(): 15 | defaultdict(default_factory=float) # RUF026 @@ -37,8 +39,9 @@ error[RUF026]: RUF026.py:15:5: [*] `default_factory` is a positional-only argume 17 17 | 18 18 | def func(): -error[RUF026]: RUF026.py:19:5: [*] `default_factory` is a positional-only argument to `defaultdict` +error[RUF026]: 19:5: [*] `default_factory` is a positional-only argument to `defaultdict` + --> RUF026.py:19:5 | 18 | def func(): 19 | defaultdict(default_factory=dict) # RUF026 @@ -55,8 +58,9 @@ error[RUF026]: RUF026.py:19:5: [*] `default_factory` is a positional-only argume 21 21 | 22 22 | def func(): -error[RUF026]: RUF026.py:23:5: [*] `default_factory` is a positional-only argument to `defaultdict` +error[RUF026]: 23:5: [*] `default_factory` is a positional-only argument to `defaultdict` + --> RUF026.py:23:5 | 22 | def func(): 23 | defaultdict(default_factory=list) # RUF026 @@ -73,8 +77,9 @@ error[RUF026]: RUF026.py:23:5: [*] `default_factory` is a positional-only argume 25 25 | 26 26 | def func(): -error[RUF026]: RUF026.py:27:5: [*] `default_factory` is a positional-only argument to `defaultdict` +error[RUF026]: 27:5: [*] `default_factory` is a positional-only argument to `defaultdict` + --> RUF026.py:27:5 | 26 | def func(): 27 | defaultdict(default_factory=tuple) # RUF026 @@ -91,8 +96,9 @@ error[RUF026]: RUF026.py:27:5: [*] `default_factory` is a positional-only argume 29 29 | 30 30 | def func(): -error[RUF026]: RUF026.py:34:5: [*] `default_factory` is a positional-only argument to `defaultdict` +error[RUF026]: 34:5: [*] `default_factory` is a positional-only argument to `defaultdict` + --> RUF026.py:34:5 | 32 | pass 33 | @@ -110,8 +116,9 @@ error[RUF026]: RUF026.py:34:5: [*] `default_factory` is a positional-only argume 36 36 | 37 37 | def func(): -error[RUF026]: RUF026.py:38:5: [*] `default_factory` is a positional-only argument to `defaultdict` +error[RUF026]: 38:5: [*] `default_factory` is a positional-only argument to `defaultdict` + --> RUF026.py:38:5 | 37 | def func(): 38 | defaultdict(default_factory=lambda: 1) # RUF026 @@ -128,8 +135,9 @@ error[RUF026]: RUF026.py:38:5: [*] `default_factory` is a positional-only argume 40 40 | 41 41 | def func(): -error[RUF026]: RUF026.py:44:5: [*] `default_factory` is a positional-only argument to `defaultdict` +error[RUF026]: 44:5: [*] `default_factory` is a positional-only argument to `defaultdict` + --> RUF026.py:44:5 | 42 | from collections import deque 43 | @@ -147,8 +155,9 @@ error[RUF026]: RUF026.py:44:5: [*] `default_factory` is a positional-only argume 46 46 | 47 47 | def func(): -error[RUF026]: RUF026.py:52:5: [*] `default_factory` is a positional-only argument to `defaultdict` +error[RUF026]: 52:5: [*] `default_factory` is a positional-only argument to `defaultdict` + --> RUF026.py:52:5 | 50 | pass 51 | @@ -166,8 +175,9 @@ error[RUF026]: RUF026.py:52:5: [*] `default_factory` is a positional-only argume 54 54 | 55 55 | def func(): -error[RUF026]: RUF026.py:56:5: [*] `default_factory` is a positional-only argument to `defaultdict` +error[RUF026]: 56:5: [*] `default_factory` is a positional-only argument to `defaultdict` + --> RUF026.py:56:5 | 55 | def func(): 56 | defaultdict(default_factory=tuple, member=1) # RUF026 @@ -184,8 +194,9 @@ error[RUF026]: RUF026.py:56:5: [*] `default_factory` is a positional-only argume 58 58 | 59 59 | def func(): -error[RUF026]: RUF026.py:60:5: [*] `default_factory` is a positional-only argument to `defaultdict` +error[RUF026]: 60:5: [*] `default_factory` is a positional-only argument to `defaultdict` + --> RUF026.py:60:5 | 59 | def func(): 60 | defaultdict(member=1, default_factory=tuple) # RUF026 @@ -202,8 +213,9 @@ error[RUF026]: RUF026.py:60:5: [*] `default_factory` is a positional-only argume 62 62 | 63 63 | def func(): -error[RUF026]: RUF026.py:64:5: [*] `default_factory` is a positional-only argument to `defaultdict` +error[RUF026]: 64:5: [*] `default_factory` is a positional-only argument to `defaultdict` + --> RUF026.py:64:5 | 63 | def func(): 64 | defaultdict(member=1, default_factory=tuple,) # RUF026 @@ -220,8 +232,9 @@ error[RUF026]: RUF026.py:64:5: [*] `default_factory` is a positional-only argume 66 66 | 67 67 | def func(): -error[RUF026]: RUF026.py:68:5: [*] `default_factory` is a positional-only argument to `defaultdict` +error[RUF026]: 68:5: [*] `default_factory` is a positional-only argument to `defaultdict` + --> RUF026.py:68:5 | 67 | def func(): 68 | defaultdict( @@ -243,8 +256,9 @@ error[RUF026]: RUF026.py:68:5: [*] `default_factory` is a positional-only argume 72 71 | 73 72 | -error[RUF026]: RUF026.py:75:5: [*] `default_factory` is a positional-only argument to `defaultdict` +error[RUF026]: 75:5: [*] `default_factory` is a positional-only argument to `defaultdict` + --> RUF026.py:75:5 | 74 | def func(): 75 | defaultdict( diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF027_RUF027_0.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF027_RUF027_0.py.snap index aa801f00a5..39a5343b3d 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF027_RUF027_0.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF027_RUF027_0.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs --- -error[RUF027]: RUF027_0.py:5:7: [*] Possible f-string without an `f` prefix +error[RUF027]: 5:7: [*] Possible f-string without an `f` prefix + --> RUF027_0.py:5:7 | 3 | "always ignore this: {val}" 4 | @@ -20,8 +21,9 @@ error[RUF027]: RUF027_0.py:5:7: [*] Possible f-string without an `f` prefix 7 7 | 8 8 | def simple_cases(): -error[RUF027]: RUF027_0.py:10:9: [*] Possible f-string without an `f` prefix +error[RUF027]: 10:9: [*] Possible f-string without an `f` prefix + --> RUF027_0.py:10:9 | 8 | def simple_cases(): 9 | a = 4 @@ -40,8 +42,9 @@ error[RUF027]: RUF027_0.py:10:9: [*] Possible f-string without an `f` prefix 12 12 | 13 13 | -error[RUF027]: RUF027_0.py:11:9: [*] Possible f-string without an `f` prefix +error[RUF027]: 11:9: [*] Possible f-string without an `f` prefix + --> RUF027_0.py:11:9 | 9 | a = 4 10 | b = "{a}" # RUF027 @@ -59,8 +62,9 @@ error[RUF027]: RUF027_0.py:11:9: [*] Possible f-string without an `f` prefix 13 13 | 14 14 | def escaped_string(): -error[RUF027]: RUF027_0.py:21:9: [*] Possible f-string without an `f` prefix +error[RUF027]: 21:9: [*] Possible f-string without an `f` prefix + --> RUF027_0.py:21:9 | 19 | def raw_string(): 20 | a = 4 @@ -79,8 +83,9 @@ error[RUF027]: RUF027_0.py:21:9: [*] Possible f-string without an `f` prefix 23 23 | 24 24 | -error[RUF027]: RUF027_0.py:22:9: [*] Possible f-string without an `f` prefix +error[RUF027]: 22:9: [*] Possible f-string without an `f` prefix + --> RUF027_0.py:22:9 | 20 | a = 4 21 | b = r"raw string with formatting: {a}" # RUF027 @@ -98,8 +103,9 @@ error[RUF027]: RUF027_0.py:22:9: [*] Possible f-string without an `f` prefix 24 24 | 25 25 | def print_name(name: str): -error[RUF027]: RUF027_0.py:27:11: [*] Possible f-string without an `f` prefix +error[RUF027]: 27:11: [*] Possible f-string without an `f` prefix + --> RUF027_0.py:27:11 | 25 | def print_name(name: str): 26 | a = 4 @@ -118,8 +124,9 @@ error[RUF027]: RUF027_0.py:27:11: [*] Possible f-string without an `f` prefix 29 29 | 30 30 | -error[RUF027]: RUF027_0.py:28:11: [*] Possible f-string without an `f` prefix +error[RUF027]: 28:11: [*] Possible f-string without an `f` prefix + --> RUF027_0.py:28:11 | 26 | a = 4 27 | print("Hello, {name}!") # RUF027 @@ -137,8 +144,9 @@ error[RUF027]: RUF027_0.py:28:11: [*] Possible f-string without an `f` prefix 30 30 | 31 31 | def nested_funcs(): -error[RUF027]: RUF027_0.py:33:33: [*] Possible f-string without an `f` prefix +error[RUF027]: 33:33: [*] Possible f-string without an `f` prefix + --> RUF027_0.py:33:33 | 31 | def nested_funcs(): 32 | a = 4 @@ -156,8 +164,9 @@ error[RUF027]: RUF027_0.py:33:33: [*] Possible f-string without an `f` prefix 35 35 | 36 36 | def tripled_quoted(): -error[RUF027]: RUF027_0.py:39:19: [*] Possible f-string without an `f` prefix +error[RUF027]: 39:19: [*] Possible f-string without an `f` prefix + --> RUF027_0.py:39:19 | 37 | a = 4 38 | c = a @@ -177,8 +186,9 @@ error[RUF027]: RUF027_0.py:39:19: [*] Possible f-string without an `f` prefix 41 41 | multi_line = a = """b { # comment 42 42 | c} d -error[RUF027]: RUF027_0.py:41:22: [*] Possible f-string without an `f` prefix +error[RUF027]: 41:22: [*] Possible f-string without an `f` prefix + --> RUF027_0.py:41:22 | 39 | single_line = """ {a} """ # RUF027 40 | # RUF027 @@ -199,8 +209,9 @@ error[RUF027]: RUF027_0.py:41:22: [*] Possible f-string without an `f` prefix 43 43 | """ 44 44 | -error[RUF027]: RUF027_0.py:49:9: [*] Possible f-string without an `f` prefix +error[RUF027]: 49:9: [*] Possible f-string without an `f` prefix + --> RUF027_0.py:49:9 | 47 | a = 4 48 | # RUF027 @@ -221,8 +232,9 @@ error[RUF027]: RUF027_0.py:49:9: [*] Possible f-string without an `f` prefix 51 51 | " 52 52 | -error[RUF027]: RUF027_0.py:56:9: [*] Possible f-string without an `f` prefix +error[RUF027]: 56:9: [*] Possible f-string without an `f` prefix + --> RUF027_0.py:56:9 | 54 | def implicit_concat(): 55 | a = 4 @@ -241,8 +253,9 @@ error[RUF027]: RUF027_0.py:56:9: [*] Possible f-string without an `f` prefix 58 58 | 59 59 | -error[RUF027]: RUF027_0.py:57:18: [*] Possible f-string without an `f` prefix +error[RUF027]: 57:18: [*] Possible f-string without an `f` prefix + --> RUF027_0.py:57:18 | 55 | a = 4 56 | b = "{a}" "+" "{b}" r" \\ " # RUF027 for the first part only @@ -260,8 +273,9 @@ error[RUF027]: RUF027_0.py:57:18: [*] Possible f-string without an `f` prefix 59 59 | 60 60 | def escaped_chars(): -error[RUF027]: RUF027_0.py:62:9: [*] Possible f-string without an `f` prefix +error[RUF027]: 62:9: [*] Possible f-string without an `f` prefix + --> RUF027_0.py:62:9 | 60 | def escaped_chars(): 61 | a = 4 @@ -279,8 +293,9 @@ error[RUF027]: RUF027_0.py:62:9: [*] Possible f-string without an `f` prefix 64 64 | 65 65 | def method_calls(): -error[RUF027]: RUF027_0.py:70:18: [*] Possible f-string without an `f` prefix +error[RUF027]: 70:18: [*] Possible f-string without an `f` prefix + --> RUF027_0.py:70:18 | 68 | first = "Wendy" 69 | last = "Appleseed" @@ -300,8 +315,9 @@ error[RUF027]: RUF027_0.py:70:18: [*] Possible f-string without an `f` prefix 72 72 | def format_specifiers(): 73 73 | a = 4 -error[RUF027]: RUF027_0.py:74:9: [*] Possible f-string without an `f` prefix +error[RUF027]: 74:9: [*] Possible f-string without an `f` prefix + --> RUF027_0.py:74:9 | 72 | def format_specifiers(): 73 | a = 4 diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF028_RUF028.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF028_RUF028.py.snap index 35d5037a88..cfd680ec8c 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF028_RUF028.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF028_RUF028.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs --- -error[RUF028]: RUF028.py:3:9: [*] This suppression comment is invalid because it cannot be in an expression, pattern, argument list, or other non-statement +error[RUF028]: 3:9: [*] This suppression comment is invalid because it cannot be in an expression, pattern, argument list, or other non-statement + --> RUF028.py:3:9 | 1 | def fmt_off_between_lists(): 2 | test_list = [ @@ -20,8 +21,9 @@ error[RUF028]: RUF028.py:3:9: [*] This suppression comment is invalid because it 5 4 | 2, 6 5 | 3, -error[RUF028]: RUF028.py:12:5: [*] This suppression comment is invalid because it cannot be on its own line +error[RUF028]: 12:5: [*] This suppression comment is invalid because it cannot be on its own line + --> RUF028.py:12:5 | 10 | # note: the second `fmt: skip`` should be OK 11 | def fmt_skip_on_own_line(): @@ -39,8 +41,9 @@ error[RUF028]: RUF028.py:12:5: [*] This suppression comment is invalid because i 14 13 | 15 14 | -error[RUF028]: RUF028.py:17:1: [*] This suppression comment is invalid because it cannot be after a decorator +error[RUF028]: 17:1: [*] This suppression comment is invalid because it cannot be after a decorator + --> RUF028.py:16:22 | 16 | @fmt_skip_on_own_line 17 | # fmt: off @@ -58,8 +61,9 @@ error[RUF028]: RUF028.py:17:1: [*] This suppression comment is invalid because i 19 18 | def fmt_off_between_decorators(): 20 19 | pass -error[RUF028]: RUF028.py:24:1: [*] This suppression comment is invalid because it cannot be after a decorator +error[RUF028]: 24:1: [*] This suppression comment is invalid because it cannot be after a decorator + --> RUF028.py:23:28 | 23 | @fmt_off_between_decorators 24 | # fmt: off @@ -77,8 +81,9 @@ error[RUF028]: RUF028.py:24:1: [*] This suppression comment is invalid because i 26 25 | ... 27 26 | -error[RUF028]: RUF028.py:33:5: [*] This suppression comment is invalid because it cannot be directly above an alternate body +error[RUF028]: 33:5: [*] This suppression comment is invalid because it cannot be directly above an alternate body + --> RUF028.py:33:5 | 31 | for val in x: 32 | print(x) @@ -97,8 +102,9 @@ error[RUF028]: RUF028.py:33:5: [*] This suppression comment is invalid because i 35 34 | print("done") 36 35 | while False: -error[RUF028]: RUF028.py:39:5: [*] This suppression comment is invalid because it cannot be directly above an alternate body +error[RUF028]: 39:5: [*] This suppression comment is invalid because it cannot be directly above an alternate body + --> RUF028.py:39:5 | 37 | print("while") 38 | # fmt: off @@ -117,8 +123,9 @@ error[RUF028]: RUF028.py:39:5: [*] This suppression comment is invalid because i 41 40 | print("done") 42 41 | if len(x) > 3: -error[RUF028]: RUF028.py:45:5: [*] This suppression comment is invalid because it cannot be directly above an alternate body +error[RUF028]: 45:5: [*] This suppression comment is invalid because it cannot be directly above an alternate body + --> RUF028.py:45:5 | 43 | print("huh?") 44 | # fmt: on @@ -137,8 +144,9 @@ error[RUF028]: RUF028.py:45:5: [*] This suppression comment is invalid because i 47 46 | print("expected") 48 47 | -error[RUF028]: RUF028.py:52:5: [*] This suppression comment is invalid because it cannot be after a decorator +error[RUF028]: 52:5: [*] This suppression comment is invalid because it cannot be after a decorator + --> RUF028.py:52:5 | 50 | class Test: 51 | @classmethod @@ -157,8 +165,9 @@ error[RUF028]: RUF028.py:52:5: [*] This suppression comment is invalid because i 54 53 | # fmt: off 55 54 | cls, -error[RUF028]: RUF028.py:54:9: [*] This suppression comment is invalid because it cannot be in an expression, pattern, argument list, or other non-statement +error[RUF028]: 54:9: [*] This suppression comment is invalid because it cannot be in an expression, pattern, argument list, or other non-statement + --> RUF028.py:54:9 | 52 | # fmt: off 53 | def cls_method_a( @@ -177,8 +186,9 @@ error[RUF028]: RUF028.py:54:9: [*] This suppression comment is invalid because i 56 55 | ) -> None: # noqa: test # fmt: skip 57 56 | pass -error[RUF028]: RUF028.py:62:13: [*] This suppression comment is invalid because it cannot be at the end of a line +error[RUF028]: 62:13: [*] This suppression comment is invalid because it cannot be at the end of a line + --> RUF028.py:62:13 | 60 | def fmt_on_trailing(): 61 | # fmt: off @@ -197,8 +207,9 @@ error[RUF028]: RUF028.py:62:13: [*] This suppression comment is invalid because 64 64 | 65 65 | -error[RUF028]: RUF028.py:63:10: [*] This suppression comment is invalid because it cannot be at the end of a line +error[RUF028]: 63:10: [*] This suppression comment is invalid because it cannot be at the end of a line + --> RUF028.py:63:10 | 61 | # fmt: off 62 | val = 5 # fmt: on diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF029_RUF029.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF029_RUF029.py.snap index a38bb94829..797d49d42b 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF029_RUF029.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF029_RUF029.py.snap @@ -1,46 +1,52 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs --- -error[RUF029]: RUF029.py:38:11: Function `fail_1a` is declared `async`, but doesn't `await` or use `async` features. +error[RUF029]: 38:11: Function `fail_1a` is declared `async`, but doesn't `await` or use `async` features. + --> RUF029.py:38:11 | 38 | async def fail_1a(): # RUF029 | ^^^^^^^ 39 | time.sleep(1) | -error[RUF029]: RUF029.py:42:11: Function `fail_1b` is declared `async`, but doesn't `await` or use `async` features. +error[RUF029]: 42:11: Function `fail_1b` is declared `async`, but doesn't `await` or use `async` features. + --> RUF029.py:42:11 | 42 | async def fail_1b(): # RUF029: yield does not require async | ^^^^^^^ 43 | yield "hello" | -error[RUF029]: RUF029.py:46:11: Function `fail_2` is declared `async`, but doesn't `await` or use `async` features. +error[RUF029]: 46:11: Function `fail_2` is declared `async`, but doesn't `await` or use `async` features. + --> RUF029.py:46:11 | 46 | async def fail_2(): # RUF029 | ^^^^^^ 47 | with None as i: 48 | pass | -error[RUF029]: RUF029.py:51:11: Function `fail_3` is declared `async`, but doesn't `await` or use `async` features. +error[RUF029]: 51:11: Function `fail_3` is declared `async`, but doesn't `await` or use `async` features. + --> RUF029.py:51:11 | 51 | async def fail_3(): # RUF029 | ^^^^^^ 52 | for i in []: 53 | pass | -error[RUF029]: RUF029.py:58:11: Function `fail_4a` is declared `async`, but doesn't `await` or use `async` features. +error[RUF029]: 58:11: Function `fail_4a` is declared `async`, but doesn't `await` or use `async` features. + --> RUF029.py:58:11 | 58 | async def fail_4a(): # RUF029: the /outer/ function does not await | ^^^^^^^ 59 | async def foo(): 60 | await bla | -error[RUF029]: RUF029.py:63:11: Function `fail_4b` is declared `async`, but doesn't `await` or use `async` features. +error[RUF029]: 63:11: Function `fail_4b` is declared `async`, but doesn't `await` or use `async` features. + --> RUF029.py:63:11 | 63 | async def fail_4b(): # RUF029: the /outer/ function does not await | ^^^^^^^ diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF030_RUF030.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF030_RUF030.py.snap index aeea27858e..06794494bd 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF030_RUF030.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF030_RUF030.py.snap @@ -1,17 +1,18 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs --- -RUF030.py:6:14: RUF030 [*] `print()` expression in `assert` statement is likely unintentional +error[RUF030]: 6:14: [*] `print()` expression in `assert` statement is likely unintentional + + --> RUF030.py:6:14 | 4 | # Expects: 5 | # - single StringLiteral 6 | assert True, print("This print is not intentional.") - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF030 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 7 | 8 | # Concatenated string literals | = help: Remove `print` - ℹ Unsafe fix 3 3 | # Standard Case 4 4 | # Expects: @@ -22,17 +23,18 @@ RUF030.py:6:14: RUF030 [*] `print()` expression in `assert` statement is likely 8 8 | # Concatenated string literals 9 9 | # Expects: -RUF030.py:11:14: RUF030 [*] `print()` expression in `assert` statement is likely unintentional +error[RUF030]: 11:14: [*] `print()` expression in `assert` statement is likely unintentional + + --> RUF030.py:11:14 | 9 | # Expects: 10 | # - single StringLiteral 11 | assert True, print("This print" " is not intentional.") - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF030 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 12 | 13 | # Positional arguments, string literals | = help: Remove `print` - ℹ Unsafe fix 8 8 | # Concatenated string literals 9 9 | # Expects: @@ -43,17 +45,18 @@ RUF030.py:11:14: RUF030 [*] `print()` expression in `assert` statement is likely 13 13 | # Positional arguments, string literals 14 14 | # Expects: -RUF030.py:16:14: RUF030 [*] `print()` expression in `assert` statement is likely unintentional +error[RUF030]: 16:14: [*] `print()` expression in `assert` statement is likely unintentional + + --> RUF030.py:16:14 | 14 | # Expects: 15 | # - single StringLiteral concatenated with " " 16 | assert True, print("This print", "is not intentional") - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF030 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 17 | 18 | # Concatenated string literals combined with Positional arguments | = help: Remove `print` - ℹ Unsafe fix 13 13 | # Positional arguments, string literals 14 14 | # Expects: @@ -64,17 +67,18 @@ RUF030.py:16:14: RUF030 [*] `print()` expression in `assert` statement is likely 18 18 | # Concatenated string literals combined with Positional arguments 19 19 | # Expects: -RUF030.py:21:14: RUF030 [*] `print()` expression in `assert` statement is likely unintentional +error[RUF030]: 21:14: [*] `print()` expression in `assert` statement is likely unintentional + + --> RUF030.py:21:14 | 19 | # Expects: 20 | # - single stringliteral concatenated with " " only between `print` and `is` 21 | assert True, print("This " "print", "is not intentional.") - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF030 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 22 | 23 | # Positional arguments, string literals with a variable | = help: Remove `print` - ℹ Unsafe fix 18 18 | # Concatenated string literals combined with Positional arguments 19 19 | # Expects: @@ -85,17 +89,18 @@ RUF030.py:21:14: RUF030 [*] `print()` expression in `assert` statement is likely 23 23 | # Positional arguments, string literals with a variable 24 24 | # Expects: -RUF030.py:26:14: RUF030 [*] `print()` expression in `assert` statement is likely unintentional +error[RUF030]: 26:14: [*] `print()` expression in `assert` statement is likely unintentional + + --> RUF030.py:26:14 | 24 | # Expects: 25 | # - single FString concatenated with " " 26 | assert True, print("This", print.__name__, "is not intentional.") - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF030 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 27 | 28 | # Mixed brackets string literals | = help: Remove `print` - ℹ Unsafe fix 23 23 | # Positional arguments, string literals with a variable 24 24 | # Expects: @@ -106,17 +111,18 @@ RUF030.py:26:14: RUF030 [*] `print()` expression in `assert` statement is likely 28 28 | # Mixed brackets string literals 29 29 | # Expects: -RUF030.py:31:14: RUF030 [*] `print()` expression in `assert` statement is likely unintentional +error[RUF030]: 31:14: [*] `print()` expression in `assert` statement is likely unintentional + + --> RUF030.py:31:14 | 29 | # Expects: 30 | # - single StringLiteral concatenated with " " 31 | assert True, print("This print", 'is not intentional', """and should be removed""") - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF030 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 32 | 33 | # Mixed brackets with other brackets inside | = help: Remove `print` - ℹ Unsafe fix 28 28 | # Mixed brackets string literals 29 29 | # Expects: @@ -127,17 +133,18 @@ RUF030.py:31:14: RUF030 [*] `print()` expression in `assert` statement is likely 33 33 | # Mixed brackets with other brackets inside 34 34 | # Expects: -RUF030.py:36:14: RUF030 [*] `print()` expression in `assert` statement is likely unintentional +error[RUF030]: 36:14: [*] `print()` expression in `assert` statement is likely unintentional + + --> RUF030.py:36:14 | 34 | # Expects: 35 | # - single StringLiteral concatenated with " " and escaped brackets 36 | assert True, print("This print", 'is not "intentional"', """and "should" be 'removed'""") - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF030 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 37 | 38 | # Positional arguments, string literals with a separator | = help: Remove `print` - ℹ Unsafe fix 33 33 | # Mixed brackets with other brackets inside 34 34 | # Expects: @@ -148,17 +155,18 @@ RUF030.py:36:14: RUF030 [*] `print()` expression in `assert` statement is likely 38 38 | # Positional arguments, string literals with a separator 39 39 | # Expects: -RUF030.py:41:14: RUF030 [*] `print()` expression in `assert` statement is likely unintentional +error[RUF030]: 41:14: [*] `print()` expression in `assert` statement is likely unintentional + + --> RUF030.py:41:14 | 39 | # Expects: 40 | # - single StringLiteral concatenated with "|" 41 | assert True, print("This print", "is not intentional", sep="|") - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF030 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 42 | 43 | # Positional arguments, string literals with None as separator | = help: Remove `print` - ℹ Unsafe fix 38 38 | # Positional arguments, string literals with a separator 39 39 | # Expects: @@ -169,17 +177,18 @@ RUF030.py:41:14: RUF030 [*] `print()` expression in `assert` statement is likely 43 43 | # Positional arguments, string literals with None as separator 44 44 | # Expects: -RUF030.py:46:14: RUF030 [*] `print()` expression in `assert` statement is likely unintentional +error[RUF030]: 46:14: [*] `print()` expression in `assert` statement is likely unintentional + + --> RUF030.py:46:14 | 44 | # Expects: 45 | # - single StringLiteral concatenated with " " 46 | assert True, print("This print", "is not intentional", sep=None) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF030 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 47 | 48 | # Positional arguments, string literals with variable as separator, needs f-string | = help: Remove `print` - ℹ Unsafe fix 43 43 | # Positional arguments, string literals with None as separator 44 44 | # Expects: @@ -190,17 +199,18 @@ RUF030.py:46:14: RUF030 [*] `print()` expression in `assert` statement is likely 48 48 | # Positional arguments, string literals with variable as separator, needs f-string 49 49 | # Expects: -RUF030.py:51:14: RUF030 [*] `print()` expression in `assert` statement is likely unintentional +error[RUF030]: 51:14: [*] `print()` expression in `assert` statement is likely unintentional + + --> RUF030.py:51:14 | 49 | # Expects: 50 | # - single FString concatenated with "{U00A0}" 51 | assert True, print("This print", "is not intentional", sep=U00A0) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF030 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 52 | 53 | # Unnecessary f-string | = help: Remove `print` - ℹ Unsafe fix 48 48 | # Positional arguments, string literals with variable as separator, needs f-string 49 49 | # Expects: @@ -211,17 +221,18 @@ RUF030.py:51:14: RUF030 [*] `print()` expression in `assert` statement is likely 53 53 | # Unnecessary f-string 54 54 | # Expects: -RUF030.py:56:14: RUF030 [*] `print()` expression in `assert` statement is likely unintentional +error[RUF030]: 56:14: [*] `print()` expression in `assert` statement is likely unintentional + + --> RUF030.py:56:14 | 54 | # Expects: 55 | # - single StringLiteral 56 | assert True, print(f"This f-string is just a literal.") - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF030 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 57 | 58 | # Positional arguments, string literals and f-strings | = help: Remove `print` - ℹ Unsafe fix 53 53 | # Unnecessary f-string 54 54 | # Expects: @@ -232,17 +243,18 @@ RUF030.py:56:14: RUF030 [*] `print()` expression in `assert` statement is likely 58 58 | # Positional arguments, string literals and f-strings 59 59 | # Expects: -RUF030.py:61:14: RUF030 [*] `print()` expression in `assert` statement is likely unintentional +error[RUF030]: 61:14: [*] `print()` expression in `assert` statement is likely unintentional + + --> RUF030.py:61:14 | 59 | # Expects: 60 | # - single FString concatenated with " " 61 | assert True, print("This print", f"is not {'intentional':s}") - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF030 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 62 | 63 | # Positional arguments, string literals and f-strings with a separator | = help: Remove `print` - ℹ Unsafe fix 58 58 | # Positional arguments, string literals and f-strings 59 59 | # Expects: @@ -253,17 +265,18 @@ RUF030.py:61:14: RUF030 [*] `print()` expression in `assert` statement is likely 63 63 | # Positional arguments, string literals and f-strings with a separator 64 64 | # Expects: -RUF030.py:66:14: RUF030 [*] `print()` expression in `assert` statement is likely unintentional +error[RUF030]: 66:14: [*] `print()` expression in `assert` statement is likely unintentional + + --> RUF030.py:66:14 | 64 | # Expects: 65 | # - single FString concatenated with "|" 66 | assert True, print("This print", f"is not {'intentional':s}", sep="|") - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF030 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 67 | 68 | # A single f-string | = help: Remove `print` - ℹ Unsafe fix 63 63 | # Positional arguments, string literals and f-strings with a separator 64 64 | # Expects: @@ -274,17 +287,18 @@ RUF030.py:66:14: RUF030 [*] `print()` expression in `assert` statement is likely 68 68 | # A single f-string 69 69 | # Expects: -RUF030.py:71:14: RUF030 [*] `print()` expression in `assert` statement is likely unintentional +error[RUF030]: 71:14: [*] `print()` expression in `assert` statement is likely unintentional + + --> RUF030.py:71:14 | 69 | # Expects: 70 | # - single FString 71 | assert True, print(f"This print is not {'intentional':s}") - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF030 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 72 | 73 | # A single f-string with a redundant separator | = help: Remove `print` - ℹ Unsafe fix 68 68 | # A single f-string 69 69 | # Expects: @@ -295,17 +309,18 @@ RUF030.py:71:14: RUF030 [*] `print()` expression in `assert` statement is likely 73 73 | # A single f-string with a redundant separator 74 74 | # Expects: -RUF030.py:76:14: RUF030 [*] `print()` expression in `assert` statement is likely unintentional +error[RUF030]: 76:14: [*] `print()` expression in `assert` statement is likely unintentional + + --> RUF030.py:76:14 | 74 | # Expects: 75 | # - single FString 76 | assert True, print(f"This print is not {'intentional':s}", sep="|") - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF030 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 77 | 78 | # Complex f-string with variable as separator | = help: Remove `print` - ℹ Unsafe fix 73 73 | # A single f-string with a redundant separator 74 74 | # Expects: @@ -316,17 +331,18 @@ RUF030.py:76:14: RUF030 [*] `print()` expression in `assert` statement is likely 78 78 | # Complex f-string with variable as separator 79 79 | # Expects: -RUF030.py:83:14: RUF030 [*] `print()` expression in `assert` statement is likely unintentional +error[RUF030]: 83:14: [*] `print()` expression in `assert` statement is likely unintentional + + --> RUF030.py:83:14 | 81 | condition = "True is True" 82 | maintainer = "John Doe" 83 | assert True, print("Unreachable due to", condition, f", ask {maintainer} for advice", sep=U00A0) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF030 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 84 | 85 | # Empty print | = help: Remove `print` - ℹ Unsafe fix 80 80 | # - single FString concatenated with "{U00A0}", all placeholders preserved 81 81 | condition = "True is True" @@ -337,17 +353,18 @@ RUF030.py:83:14: RUF030 [*] `print()` expression in `assert` statement is likely 85 85 | # Empty print 86 86 | # Expects: -RUF030.py:88:14: RUF030 [*] `print()` expression in `assert` statement is likely unintentional +error[RUF030]: 88:14: [*] `print()` expression in `assert` statement is likely unintentional + + --> RUF030.py:88:14 | 86 | # Expects: 87 | # - `msg` entirely removed from assertion 88 | assert True, print() - | ^^^^^^^ RUF030 + | ^^^^^^^ 89 | 90 | # Empty print with separator | = help: Remove `print` - ℹ Unsafe fix 85 85 | # Empty print 86 86 | # Expects: @@ -358,17 +375,18 @@ RUF030.py:88:14: RUF030 [*] `print()` expression in `assert` statement is likely 90 90 | # Empty print with separator 91 91 | # Expects: -RUF030.py:93:14: RUF030 [*] `print()` expression in `assert` statement is likely unintentional +error[RUF030]: 93:14: [*] `print()` expression in `assert` statement is likely unintentional + + --> RUF030.py:93:14 | 91 | # Expects: 92 | # - `msg` entirely removed from assertion 93 | assert True, print(sep=" ") - | ^^^^^^^^^^^^^^ RUF030 + | ^^^^^^^^^^^^^^ 94 | 95 | # Custom print function that actually returns a string | = help: Remove `print` - ℹ Unsafe fix 90 90 | # Empty print with separator 91 91 | # Expects: @@ -379,15 +397,16 @@ RUF030.py:93:14: RUF030 [*] `print()` expression in `assert` statement is likely 95 95 | # Custom print function that actually returns a string 96 96 | # Expects: -RUF030.py:108:14: RUF030 [*] `print()` expression in `assert` statement is likely unintentional +error[RUF030]: 108:14: [*] `print()` expression in `assert` statement is likely unintentional + + --> RUF030.py:108:14 | 106 | # Expects: 107 | # - single StringLiteral 108 | assert True, builtins.print("This print should be removed.") - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF030 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: Remove `print` - ℹ Unsafe fix 105 105 | # Use of `builtins.print` 106 106 | # Expects: diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF031_RUF031.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF031_RUF031.py.snap index b3ca339ba1..2705310d38 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF031_RUF031.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF031_RUF031.py.snap @@ -1,16 +1,17 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs --- -RUF031.py:2:3: RUF031 [*] Avoid parentheses for tuples in subscripts. +error[RUF031]: 2:3: [*] Avoid parentheses for tuples in subscripts. + + --> RUF031.py:2:3 | 1 | d = {(1,2):"a",(3,4):"b",(5,6,7):"c",(8,):"d"} 2 | d[(1,2)] - | ^^^^^ RUF031 + | ^^^^^ 3 | d[( 4 | 1, | = help: Remove the parentheses. - ℹ Safe fix 1 1 | d = {(1,2):"a",(3,4):"b",(5,6,7):"c",(8,):"d"} 2 |-d[(1,2)] @@ -19,7 +20,9 @@ RUF031.py:2:3: RUF031 [*] Avoid parentheses for tuples in subscripts. 4 4 | 1, 5 5 | 2 -RUF031.py:3:3: RUF031 [*] Avoid parentheses for tuples in subscripts. +error[RUF031]: 3:3: [*] Avoid parentheses for tuples in subscripts. + + --> RUF031.py:3:3 | 1 | d = {(1,2):"a",(3,4):"b",(5,6,7):"c",(8,):"d"} 2 | d[(1,2)] @@ -28,12 +31,11 @@ RUF031.py:3:3: RUF031 [*] Avoid parentheses for tuples in subscripts. 4 | | 1, 5 | | 2 6 | | )] - | |_^ RUF031 + | |_^ 7 | d[ 8 | 1, | = help: Remove the parentheses. - ℹ Safe fix 1 1 | d = {(1,2):"a",(3,4):"b",(5,6,7):"c",(8,):"d"} 2 2 | d[(1,2)] @@ -47,17 +49,18 @@ RUF031.py:3:3: RUF031 [*] Avoid parentheses for tuples in subscripts. 8 8 | 1, 9 9 | 2 -RUF031.py:11:3: RUF031 [*] Avoid parentheses for tuples in subscripts. +error[RUF031]: 11:3: [*] Avoid parentheses for tuples in subscripts. + + --> RUF031.py:11:3 | 9 | 2 10 | ] 11 | d[(2,4)] - | ^^^^^ RUF031 + | ^^^^^ 12 | d[(5,6,7)] 13 | d[(8,)] | = help: Remove the parentheses. - ℹ Safe fix 8 8 | 1, 9 9 | 2 @@ -68,17 +71,18 @@ RUF031.py:11:3: RUF031 [*] Avoid parentheses for tuples in subscripts. 13 13 | d[(8,)] 14 14 | d[tuple(1,2)] -RUF031.py:12:3: RUF031 [*] Avoid parentheses for tuples in subscripts. +error[RUF031]: 12:3: [*] Avoid parentheses for tuples in subscripts. + + --> RUF031.py:12:3 | 10 | ] 11 | d[(2,4)] 12 | d[(5,6,7)] - | ^^^^^^^ RUF031 + | ^^^^^^^ 13 | d[(8,)] 14 | d[tuple(1,2)] | = help: Remove the parentheses. - ℹ Safe fix 9 9 | 2 10 10 | ] @@ -89,17 +93,18 @@ RUF031.py:12:3: RUF031 [*] Avoid parentheses for tuples in subscripts. 14 14 | d[tuple(1,2)] 15 15 | d[tuple(8)] -RUF031.py:13:3: RUF031 [*] Avoid parentheses for tuples in subscripts. +error[RUF031]: 13:3: [*] Avoid parentheses for tuples in subscripts. + + --> RUF031.py:13:3 | 11 | d[(2,4)] 12 | d[(5,6,7)] 13 | d[(8,)] - | ^^^^ RUF031 + | ^^^^ 14 | d[tuple(1,2)] 15 | d[tuple(8)] | = help: Remove the parentheses. - ℹ Safe fix 10 10 | ] 11 11 | d[(2,4)] @@ -110,16 +115,17 @@ RUF031.py:13:3: RUF031 [*] Avoid parentheses for tuples in subscripts. 15 15 | d[tuple(8)] 16 16 | d[1,2] -RUF031.py:20:3: RUF031 [*] Avoid parentheses for tuples in subscripts. +error[RUF031]: 20:3: [*] Avoid parentheses for tuples in subscripts. + + --> RUF031.py:20:3 | 18 | d[5,6,7] 19 | e = {((1,2),(3,4)):"a"} 20 | e[((1,2),(3,4))] - | ^^^^^^^^^^^^^ RUF031 + | ^^^^^^^^^^^^^ 21 | e[(1,2),(3,4)] | = help: Remove the parentheses. - ℹ Safe fix 17 17 | d[3,4] 18 18 | d[5,6,7] @@ -131,15 +137,16 @@ RUF031.py:20:3: RUF031 [*] Avoid parentheses for tuples in subscripts. 23 23 | token_features[ 24 24 | (window_position, feature_name) -RUF031.py:24:5: RUF031 [*] Avoid parentheses for tuples in subscripts. +error[RUF031]: 24:5: [*] Avoid parentheses for tuples in subscripts. + + --> RUF031.py:24:5 | 23 | token_features[ 24 | (window_position, feature_name) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF031 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 25 | ] = self._extract_raw_features_from_token | = help: Remove the parentheses. - ℹ Safe fix 21 21 | e[(1,2),(3,4)] 22 22 | @@ -150,16 +157,17 @@ RUF031.py:24:5: RUF031 [*] Avoid parentheses for tuples in subscripts. 26 26 | 27 27 | d[1,] -RUF031.py:28:3: RUF031 [*] Avoid parentheses for tuples in subscripts. +error[RUF031]: 28:3: [*] Avoid parentheses for tuples in subscripts. + + --> RUF031.py:28:3 | 27 | d[1,] 28 | d[(1,)] - | ^^^^ RUF031 + | ^^^^ 29 | d[()] # empty tuples should be ignored 30 | d[:,] # slices in the subscript lead to syntax error if parens are added | = help: Remove the parentheses. - ℹ Safe fix 25 25 | ] = self._extract_raw_features_from_token 26 26 | @@ -170,17 +178,18 @@ RUF031.py:28:3: RUF031 [*] Avoid parentheses for tuples in subscripts. 30 30 | d[:,] # slices in the subscript lead to syntax error if parens are added 31 31 | d[1,2,:] -RUF031.py:36:3: RUF031 [*] Avoid parentheses for tuples in subscripts. +error[RUF031]: 36:3: [*] Avoid parentheses for tuples in subscripts. + + --> RUF031.py:36:3 | 34 | # Python <=3.10 to avoid syntax error. 35 | # https://github.com/astral-sh/ruff/issues/12776 36 | d[(*foo,bar)] - | ^^^^^^^^^^ RUF031 + | ^^^^^^^^^^ 37 | 38 | x: dict[str, int] # tuples inside type annotations should never be altered | = help: Remove the parentheses. - ℹ Safe fix 33 33 | # Should keep these parentheses in 34 34 | # Python <=3.10 to avoid syntax error. diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF032_RUF032.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF032_RUF032.py.snap index c21499b3f4..ba4e356233 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF032_RUF032.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF032_RUF032.py.snap @@ -1,17 +1,18 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs --- -RUF032.py:6:17: RUF032 [*] `Decimal()` called with float literal argument +error[RUF032]: 6:17: [*] `Decimal()` called with float literal argument + + --> RUF032.py:6:17 | 4 | decimal.Decimal(0) 5 | 6 | decimal.Decimal(0.0) # Should error - | ^^^ RUF032 + | ^^^ 7 | 8 | decimal.Decimal("0.0") | = help: Use a string literal instead - ℹ Unsafe fix 3 3 | # Tests with fully qualified import 4 4 | decimal.Decimal(0) @@ -22,17 +23,18 @@ RUF032.py:6:17: RUF032 [*] `Decimal()` called with float literal argument 8 8 | decimal.Decimal("0.0") 9 9 | -RUF032.py:12:17: RUF032 [*] `Decimal()` called with float literal argument +error[RUF032]: 12:17: [*] `Decimal()` called with float literal argument + + --> RUF032.py:12:17 | 10 | decimal.Decimal(10) 11 | 12 | decimal.Decimal(10.0) # Should error - | ^^^^ RUF032 + | ^^^^ 13 | 14 | decimal.Decimal("10.0") | = help: Use a string literal instead - ℹ Unsafe fix 9 9 | 10 10 | decimal.Decimal(10) @@ -43,17 +45,18 @@ RUF032.py:12:17: RUF032 [*] `Decimal()` called with float literal argument 14 14 | decimal.Decimal("10.0") 15 15 | -RUF032.py:18:17: RUF032 [*] `Decimal()` called with float literal argument +error[RUF032]: 18:17: [*] `Decimal()` called with float literal argument + + --> RUF032.py:18:17 | 16 | decimal.Decimal(-10) 17 | 18 | decimal.Decimal(-10.0) # Should error - | ^^^^^ RUF032 + | ^^^^^ 19 | 20 | decimal.Decimal("-10.0") | = help: Use a string literal instead - ℹ Unsafe fix 15 15 | 16 16 | decimal.Decimal(-10) @@ -64,17 +67,18 @@ RUF032.py:18:17: RUF032 [*] `Decimal()` called with float literal argument 20 20 | decimal.Decimal("-10.0") 21 21 | -RUF032.py:33:15: RUF032 [*] `Decimal()` called with float literal argument +error[RUF032]: 33:15: [*] `Decimal()` called with float literal argument + + --> RUF032.py:33:15 | 31 | val = Decimal(0) 32 | 33 | val = Decimal(0.0) # Should error - | ^^^ RUF032 + | ^^^ 34 | 35 | val = Decimal("0.0") | = help: Use a string literal instead - ℹ Unsafe fix 30 30 | 31 31 | val = Decimal(0) @@ -85,17 +89,18 @@ RUF032.py:33:15: RUF032 [*] `Decimal()` called with float literal argument 35 35 | val = Decimal("0.0") 36 36 | -RUF032.py:39:15: RUF032 [*] `Decimal()` called with float literal argument +error[RUF032]: 39:15: [*] `Decimal()` called with float literal argument + + --> RUF032.py:39:15 | 37 | val = Decimal(10) 38 | 39 | val = Decimal(10.0) # Should error - | ^^^^ RUF032 + | ^^^^ 40 | 41 | val = Decimal("10.0") | = help: Use a string literal instead - ℹ Unsafe fix 36 36 | 37 37 | val = Decimal(10) @@ -106,17 +111,18 @@ RUF032.py:39:15: RUF032 [*] `Decimal()` called with float literal argument 41 41 | val = Decimal("10.0") 42 42 | -RUF032.py:45:15: RUF032 [*] `Decimal()` called with float literal argument +error[RUF032]: 45:15: [*] `Decimal()` called with float literal argument + + --> RUF032.py:45:15 | 43 | val = Decimal(-10) 44 | 45 | val = Decimal(-10.0) # Should error - | ^^^^^ RUF032 + | ^^^^^ 46 | 47 | val = Decimal("-10.0") | = help: Use a string literal instead - ℹ Unsafe fix 42 42 | 43 43 | val = Decimal(-10) @@ -127,17 +133,18 @@ RUF032.py:45:15: RUF032 [*] `Decimal()` called with float literal argument 47 47 | val = Decimal("-10.0") 48 48 | -RUF032.py:81:23: RUF032 [*] `Decimal()` called with float literal argument +error[RUF032]: 81:23: [*] `Decimal()` called with float literal argument + + --> RUF032.py:81:23 | 79 | # Retest with fully qualified import 80 | 81 | val = decimal.Decimal(0.0) # Should error - | ^^^ RUF032 + | ^^^ 82 | 83 | val = decimal.Decimal("0.0") | = help: Use a string literal instead - ℹ Unsafe fix 78 78 | 79 79 | # Retest with fully qualified import @@ -148,17 +155,18 @@ RUF032.py:81:23: RUF032 [*] `Decimal()` called with float literal argument 83 83 | val = decimal.Decimal("0.0") 84 84 | -RUF032.py:85:23: RUF032 [*] `Decimal()` called with float literal argument +error[RUF032]: 85:23: [*] `Decimal()` called with float literal argument + + --> RUF032.py:85:23 | 83 | val = decimal.Decimal("0.0") 84 | 85 | val = decimal.Decimal(10.0) # Should error - | ^^^^ RUF032 + | ^^^^ 86 | 87 | val = decimal.Decimal("10.0") | = help: Use a string literal instead - ℹ Unsafe fix 82 82 | 83 83 | val = decimal.Decimal("0.0") @@ -169,17 +177,18 @@ RUF032.py:85:23: RUF032 [*] `Decimal()` called with float literal argument 87 87 | val = decimal.Decimal("10.0") 88 88 | -RUF032.py:89:23: RUF032 [*] `Decimal()` called with float literal argument +error[RUF032]: 89:23: [*] `Decimal()` called with float literal argument + + --> RUF032.py:89:23 | 87 | val = decimal.Decimal("10.0") 88 | 89 | val = decimal.Decimal(-10.0) # Should error - | ^^^^^ RUF032 + | ^^^^^ 90 | 91 | val = decimal.Decimal("-10.0") | = help: Use a string literal instead - ℹ Unsafe fix 86 86 | 87 87 | val = decimal.Decimal("10.0") diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF101_RUF101.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF101_RUF101.py.snap index 9ea25fb9e9..68d112c258 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF101_RUF101.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF101_RUF101.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs --- -error[RUF101]: RUF101.py:1:15: [*] `RUF940` is a redirect to `RUF950` +error[RUF101]: 1:15: [*] `RUF940` is a redirect to `RUF950` + --> RUF101.py:1:15 | 1 | x = 2 # noqa: RUF940 | ^^^^^^ @@ -18,8 +19,9 @@ error[RUF101]: RUF101.py:1:15: [*] `RUF940` is a redirect to `RUF950` 4 4 | x = 2 # noqa: RUF950, RUF940, RUF950, RUF950, RUF950 5 5 | x = 2 # noqa: RUF940, RUF950, RUF940 -error[RUF101]: RUF101.py:3:15: [*] `RUF940` is a redirect to `RUF950` +error[RUF101]: 3:15: [*] `RUF940` is a redirect to `RUF950` + --> RUF101.py:3:15 | 1 | x = 2 # noqa: RUF940 2 | x = 2 # noqa: RUF950 @@ -38,8 +40,9 @@ error[RUF101]: RUF101.py:3:15: [*] `RUF940` is a redirect to `RUF950` 5 5 | x = 2 # noqa: RUF940, RUF950, RUF940 6 6 | x = 2 # noqa: RUF940, RUF950, RUF940, RUF950 -error[RUF101]: RUF101.py:4:23: [*] `RUF940` is a redirect to `RUF950` +error[RUF101]: 4:23: [*] `RUF940` is a redirect to `RUF950` + --> RUF101.py:4:23 | 2 | x = 2 # noqa: RUF950 3 | x = 2 # noqa: RUF940, RUF950 @@ -58,8 +61,9 @@ error[RUF101]: RUF101.py:4:23: [*] `RUF940` is a redirect to `RUF950` 5 5 | x = 2 # noqa: RUF940, RUF950, RUF940 6 6 | x = 2 # noqa: RUF940, RUF950, RUF940, RUF950 -error[RUF101]: RUF101.py:5:15: [*] `RUF940` is a redirect to `RUF950` +error[RUF101]: 5:15: [*] `RUF940` is a redirect to `RUF950` + --> RUF101.py:5:15 | 3 | x = 2 # noqa: RUF940, RUF950 4 | x = 2 # noqa: RUF950, RUF940, RUF950, RUF950, RUF950 @@ -76,8 +80,9 @@ error[RUF101]: RUF101.py:5:15: [*] `RUF940` is a redirect to `RUF950` 5 |+x = 2 # noqa: RUF950, RUF950, RUF940 6 6 | x = 2 # noqa: RUF940, RUF950, RUF940, RUF950 -error[RUF101]: RUF101.py:5:31: [*] `RUF940` is a redirect to `RUF950` +error[RUF101]: 5:31: [*] `RUF940` is a redirect to `RUF950` + --> RUF101.py:5:31 | 3 | x = 2 # noqa: RUF940, RUF950 4 | x = 2 # noqa: RUF950, RUF940, RUF950, RUF950, RUF950 @@ -94,8 +99,9 @@ error[RUF101]: RUF101.py:5:31: [*] `RUF940` is a redirect to `RUF950` 5 |+x = 2 # noqa: RUF940, RUF950, RUF950 6 6 | x = 2 # noqa: RUF940, RUF950, RUF940, RUF950 -error[RUF101]: RUF101.py:6:15: [*] `RUF940` is a redirect to `RUF950` +error[RUF101]: 6:15: [*] `RUF940` is a redirect to `RUF950` + --> RUF101.py:6:15 | 4 | x = 2 # noqa: RUF950, RUF940, RUF950, RUF950, RUF950 5 | x = 2 # noqa: RUF940, RUF950, RUF940 @@ -110,8 +116,9 @@ error[RUF101]: RUF101.py:6:15: [*] `RUF940` is a redirect to `RUF950` 6 |-x = 2 # noqa: RUF940, RUF950, RUF940, RUF950 6 |+x = 2 # noqa: RUF950, RUF950, RUF940, RUF950 -error[RUF101]: RUF101.py:6:31: [*] `RUF940` is a redirect to `RUF950` +error[RUF101]: 6:31: [*] `RUF940` is a redirect to `RUF950` + --> RUF101.py:6:31 | 4 | x = 2 # noqa: RUF950, RUF940, RUF950, RUF950, RUF950 5 | x = 2 # noqa: RUF940, RUF950, RUF940 diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF200_bleach.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF200_bleach.snap index 23f834e365..28b8615fbd 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF200_bleach.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF200_bleach.snap @@ -1,10 +1,11 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs --- -error[RUF200]: pyproject.toml:5:16: Failed to parse pyproject.toml: Version specifier `>=1.1.0<1.2` doesn't match PEP 440 rules +error[RUF200]: 5:16: Failed to parse pyproject.toml: Version specifier `>=1.1.0<1.2` doesn't match PEP 440 rules tinycss2>=1.1.0<1.2 ^^^^^^^^^^^ + --> pyproject.toml:5:16 | 3 | version = "0.1.0" 4 | # There's a comma missing here diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF200_maturin_gh_1615.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF200_maturin_gh_1615.snap index b9e78fdfbc..723fd3d17c 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF200_maturin_gh_1615.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF200_maturin_gh_1615.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs --- -error[RUF200]: pyproject.toml:9:17: Failed to parse pyproject.toml: wanted string or table +error[RUF200]: 9:17: Failed to parse pyproject.toml: wanted string or table + --> pyproject.toml:9:17 | 7 | [project] 8 | name = "..." diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__confusables.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__confusables.snap index d9f8ebc539..4f10a8e8ea 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__confusables.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__confusables.snap @@ -1,15 +1,17 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs --- -error[RUF001]: confusables.py:1:6: String contains ambiguous `𝐁` (MATHEMATICAL BOLD CAPITAL B). Did you mean `B` (LATIN CAPITAL LETTER B)? +error[RUF001]: 1:6: String contains ambiguous `𝐁` (MATHEMATICAL BOLD CAPITAL B). Did you mean `B` (LATIN CAPITAL LETTER B)? + --> confusables.py:1:6 | 1 | x = "𝐁ad string" | ^ 2 | y = "−" | -error[RUF002]: confusables.py:6:56: Docstring contains ambiguous `)` (FULLWIDTH RIGHT PARENTHESIS). Did you mean `)` (RIGHT PARENTHESIS)? +error[RUF002]: 6:56: Docstring contains ambiguous `)` (FULLWIDTH RIGHT PARENTHESIS). Did you mean `)` (RIGHT PARENTHESIS)? + --> confusables.py:6:56 | 5 | def f(): 6 | """Here's a docstring with an unusual parenthesis: )""" @@ -17,8 +19,9 @@ error[RUF002]: confusables.py:6:56: Docstring contains ambiguous `)` (FULLWIDT 7 | # And here's a comment with an unusual punctuation mark: ᜵ 8 | ... | -error[RUF003]: confusables.py:7:62: Comment contains ambiguous `᜵` (PHILIPPINE SINGLE PUNCTUATION). Did you mean `/` (SOLIDUS)? +error[RUF003]: 7:62: Comment contains ambiguous `᜵` (PHILIPPINE SINGLE PUNCTUATION). Did you mean `/` (SOLIDUS)? + --> confusables.py:7:62 | 5 | def f(): 6 | """Here's a docstring with an unusual parenthesis: )""" @@ -26,15 +29,17 @@ error[RUF003]: confusables.py:7:62: Comment contains ambiguous `᜵` (PHILIPPINE | ^ 8 | ... | -error[RUF001]: confusables.py:17:6: String contains ambiguous `𝐁` (MATHEMATICAL BOLD CAPITAL B). Did you mean `B` (LATIN CAPITAL LETTER B)? +error[RUF001]: 17:6: String contains ambiguous `𝐁` (MATHEMATICAL BOLD CAPITAL B). Did you mean `B` (LATIN CAPITAL LETTER B)? + --> confusables.py:17:6 | 17 | x = "𝐁ad string" | ^ 18 | x = "−" | -error[RUF001]: confusables.py:26:10: String contains ambiguous `α` (GREEK SMALL LETTER ALPHA). Did you mean `a` (LATIN SMALL LETTER A)? +error[RUF001]: 26:10: String contains ambiguous `α` (GREEK SMALL LETTER ALPHA). Did you mean `a` (LATIN SMALL LETTER A)? + --> confusables.py:26:10 | 24 | # The first word should be ignored, while the second should be included, since it 25 | # contains ASCII. @@ -43,8 +48,9 @@ error[RUF001]: confusables.py:26:10: String contains ambiguous `α` (GREEK SMALL 27 | 28 | # The two characters should be flagged here. The first character is a "word" | -error[RUF001]: confusables.py:31:6: String contains ambiguous `Р` (CYRILLIC CAPITAL LETTER ER). Did you mean `P` (LATIN CAPITAL LETTER P)? +error[RUF001]: 31:6: String contains ambiguous `Р` (CYRILLIC CAPITAL LETTER ER). Did you mean `P` (LATIN CAPITAL LETTER P)? + --> confusables.py:31:6 | 29 | # consisting of a single ambiguous character, while the second character is a "word 30 | # boundary" (whitespace) that it itself ambiguous. @@ -53,8 +59,9 @@ error[RUF001]: confusables.py:31:6: String contains ambiguous `Р` (CYRILLIC CAP 32 | 33 | # Same test cases as above but using f-strings instead: | -error[RUF001]: confusables.py:31:7: String contains ambiguous ` ` (EN QUAD). Did you mean ` ` (SPACE)? +error[RUF001]: 31:7: String contains ambiguous ` ` (EN QUAD). Did you mean ` ` (SPACE)? + --> confusables.py:31:7 | 29 | # consisting of a single ambiguous character, while the second character is a "word 30 | # boundary" (whitespace) that it itself ambiguous. @@ -63,8 +70,9 @@ error[RUF001]: confusables.py:31:7: String contains ambiguous ` ` (EN QUAD). D 32 | 33 | # Same test cases as above but using f-strings instead: | -error[RUF001]: confusables.py:34:7: String contains ambiguous `𝐁` (MATHEMATICAL BOLD CAPITAL B). Did you mean `B` (LATIN CAPITAL LETTER B)? +error[RUF001]: 34:7: String contains ambiguous `𝐁` (MATHEMATICAL BOLD CAPITAL B). Did you mean `B` (LATIN CAPITAL LETTER B)? + --> confusables.py:34:7 | 33 | # Same test cases as above but using f-strings instead: 34 | x = f"𝐁ad string" @@ -72,8 +80,9 @@ error[RUF001]: confusables.py:34:7: String contains ambiguous `𝐁` (MATHEMATIC 35 | x = f"−" 36 | x = f"Русский" | -error[RUF001]: confusables.py:37:11: String contains ambiguous `α` (GREEK SMALL LETTER ALPHA). Did you mean `a` (LATIN SMALL LETTER A)? +error[RUF001]: 37:11: String contains ambiguous `α` (GREEK SMALL LETTER ALPHA). Did you mean `a` (LATIN SMALL LETTER A)? + --> confusables.py:37:11 | 35 | x = f"−" 36 | x = f"Русский" @@ -81,8 +90,9 @@ error[RUF001]: confusables.py:37:11: String contains ambiguous `α` (GREEK SMALL | ^ 38 | x = f"Р усский" | -error[RUF001]: confusables.py:38:7: String contains ambiguous `Р` (CYRILLIC CAPITAL LETTER ER). Did you mean `P` (LATIN CAPITAL LETTER P)? +error[RUF001]: 38:7: String contains ambiguous `Р` (CYRILLIC CAPITAL LETTER ER). Did you mean `P` (LATIN CAPITAL LETTER P)? + --> confusables.py:38:7 | 36 | x = f"Русский" 37 | x = f"βα Bαd" @@ -91,8 +101,9 @@ error[RUF001]: confusables.py:38:7: String contains ambiguous `Р` (CYRILLIC CAP 39 | 40 | # Nested f-strings | -error[RUF001]: confusables.py:38:8: String contains ambiguous ` ` (EN QUAD). Did you mean ` ` (SPACE)? +error[RUF001]: 38:8: String contains ambiguous ` ` (EN QUAD). Did you mean ` ` (SPACE)? + --> confusables.py:38:8 | 36 | x = f"Русский" 37 | x = f"βα Bαd" @@ -101,8 +112,9 @@ error[RUF001]: confusables.py:38:8: String contains ambiguous ` ` (EN QUAD). D 39 | 40 | # Nested f-strings | -error[RUF001]: confusables.py:41:7: String contains ambiguous `𝐁` (MATHEMATICAL BOLD CAPITAL B). Did you mean `B` (LATIN CAPITAL LETTER B)? +error[RUF001]: 41:7: String contains ambiguous `𝐁` (MATHEMATICAL BOLD CAPITAL B). Did you mean `B` (LATIN CAPITAL LETTER B)? + --> confusables.py:41:7 | 40 | # Nested f-strings 41 | x = f"𝐁ad string {f" {f"Р усский"}"}" @@ -110,8 +122,9 @@ error[RUF001]: confusables.py:41:7: String contains ambiguous `𝐁` (MATHEMATIC 42 | 43 | # Comments inside f-strings | -error[RUF001]: confusables.py:41:21: String contains ambiguous ` ` (EN QUAD). Did you mean ` ` (SPACE)? +error[RUF001]: 41:21: String contains ambiguous ` ` (EN QUAD). Did you mean ` ` (SPACE)? + --> confusables.py:41:21 | 40 | # Nested f-strings 41 | x = f"𝐁ad string {f" {f"Р усский"}"}" @@ -119,8 +132,9 @@ error[RUF001]: confusables.py:41:21: String contains ambiguous ` ` (EN QUAD). 42 | 43 | # Comments inside f-strings | -error[RUF001]: confusables.py:41:25: String contains ambiguous `Р` (CYRILLIC CAPITAL LETTER ER). Did you mean `P` (LATIN CAPITAL LETTER P)? +error[RUF001]: 41:25: String contains ambiguous `Р` (CYRILLIC CAPITAL LETTER ER). Did you mean `P` (LATIN CAPITAL LETTER P)? + --> confusables.py:41:25 | 40 | # Nested f-strings 41 | x = f"𝐁ad string {f" {f"Р усский"}"}" @@ -128,8 +142,9 @@ error[RUF001]: confusables.py:41:25: String contains ambiguous `Р` (CYRILLIC CA 42 | 43 | # Comments inside f-strings | -error[RUF001]: confusables.py:41:26: String contains ambiguous ` ` (EN QUAD). Did you mean ` ` (SPACE)? +error[RUF001]: 41:26: String contains ambiguous ` ` (EN QUAD). Did you mean ` ` (SPACE)? + --> confusables.py:41:26 | 40 | # Nested f-strings 41 | x = f"𝐁ad string {f" {f"Р усский"}"}" @@ -137,8 +152,9 @@ error[RUF001]: confusables.py:41:26: String contains ambiguous ` ` (EN QUAD). 42 | 43 | # Comments inside f-strings | -error[RUF003]: confusables.py:44:68: Comment contains ambiguous `)` (FULLWIDTH RIGHT PARENTHESIS). Did you mean `)` (RIGHT PARENTHESIS)? +error[RUF003]: 44:68: Comment contains ambiguous `)` (FULLWIDTH RIGHT PARENTHESIS). Did you mean `)` (RIGHT PARENTHESIS)? + --> confusables.py:44:68 | 43 | # Comments inside f-strings 44 | x = f"string { # And here's a comment with an unusual parenthesis: ) @@ -146,8 +162,9 @@ error[RUF003]: confusables.py:44:68: Comment contains ambiguous `)` (FULLWIDTH 45 | # And here's a comment with a greek alpha: ∗ 46 | foo # And here's a comment with an unusual punctuation mark: ᜵ | -error[RUF003]: confusables.py:46:62: Comment contains ambiguous `᜵` (PHILIPPINE SINGLE PUNCTUATION). Did you mean `/` (SOLIDUS)? +error[RUF003]: 46:62: Comment contains ambiguous `᜵` (PHILIPPINE SINGLE PUNCTUATION). Did you mean `/` (SOLIDUS)? + --> confusables.py:46:62 | 44 | x = f"string { # And here's a comment with an unusual parenthesis: ) 45 | # And here's a comment with a greek alpha: ∗ @@ -155,15 +172,17 @@ error[RUF003]: confusables.py:46:62: Comment contains ambiguous `᜵` (PHILIPPIN | ^ 47 | }" | -error[RUF001]: confusables.py:58:6: String contains ambiguous `𝐁` (MATHEMATICAL BOLD CAPITAL B). Did you mean `B` (LATIN CAPITAL LETTER B)? +error[RUF001]: 58:6: String contains ambiguous `𝐁` (MATHEMATICAL BOLD CAPITAL B). Did you mean `B` (LATIN CAPITAL LETTER B)? + --> confusables.py:58:6 | 57 | # Implicit string concatenation 58 | x = "𝐁ad" f"𝐁ad string" | ^ | -error[RUF001]: confusables.py:58:13: String contains ambiguous `𝐁` (MATHEMATICAL BOLD CAPITAL B). Did you mean `B` (LATIN CAPITAL LETTER B)? +error[RUF001]: 58:13: String contains ambiguous `𝐁` (MATHEMATICAL BOLD CAPITAL B). Did you mean `B` (LATIN CAPITAL LETTER B)? + --> confusables.py:58:13 | 57 | # Implicit string concatenation 58 | x = "𝐁ad" f"𝐁ad string" diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__no_remove_parentheses_starred_expr_py310.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__no_remove_parentheses_starred_expr_py310.snap index 4dbad809a6..1b961e2c49 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__no_remove_parentheses_starred_expr_py310.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__no_remove_parentheses_starred_expr_py310.snap @@ -1,16 +1,17 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs --- -RUF031.py:2:3: RUF031 [*] Avoid parentheses for tuples in subscripts. +error[RUF031]: 2:3: [*] Avoid parentheses for tuples in subscripts. + + --> RUF031.py:2:3 | 1 | d = {(1,2):"a",(3,4):"b",(5,6,7):"c",(8,):"d"} 2 | d[(1,2)] - | ^^^^^ RUF031 + | ^^^^^ 3 | d[( 4 | 1, | = help: Remove the parentheses. - ℹ Safe fix 1 1 | d = {(1,2):"a",(3,4):"b",(5,6,7):"c",(8,):"d"} 2 |-d[(1,2)] @@ -19,7 +20,9 @@ RUF031.py:2:3: RUF031 [*] Avoid parentheses for tuples in subscripts. 4 4 | 1, 5 5 | 2 -RUF031.py:3:3: RUF031 [*] Avoid parentheses for tuples in subscripts. +error[RUF031]: 3:3: [*] Avoid parentheses for tuples in subscripts. + + --> RUF031.py:3:3 | 1 | d = {(1,2):"a",(3,4):"b",(5,6,7):"c",(8,):"d"} 2 | d[(1,2)] @@ -28,12 +31,11 @@ RUF031.py:3:3: RUF031 [*] Avoid parentheses for tuples in subscripts. 4 | | 1, 5 | | 2 6 | | )] - | |_^ RUF031 + | |_^ 7 | d[ 8 | 1, | = help: Remove the parentheses. - ℹ Safe fix 1 1 | d = {(1,2):"a",(3,4):"b",(5,6,7):"c",(8,):"d"} 2 2 | d[(1,2)] @@ -47,17 +49,18 @@ RUF031.py:3:3: RUF031 [*] Avoid parentheses for tuples in subscripts. 8 8 | 1, 9 9 | 2 -RUF031.py:11:3: RUF031 [*] Avoid parentheses for tuples in subscripts. +error[RUF031]: 11:3: [*] Avoid parentheses for tuples in subscripts. + + --> RUF031.py:11:3 | 9 | 2 10 | ] 11 | d[(2,4)] - | ^^^^^ RUF031 + | ^^^^^ 12 | d[(5,6,7)] 13 | d[(8,)] | = help: Remove the parentheses. - ℹ Safe fix 8 8 | 1, 9 9 | 2 @@ -68,17 +71,18 @@ RUF031.py:11:3: RUF031 [*] Avoid parentheses for tuples in subscripts. 13 13 | d[(8,)] 14 14 | d[tuple(1,2)] -RUF031.py:12:3: RUF031 [*] Avoid parentheses for tuples in subscripts. +error[RUF031]: 12:3: [*] Avoid parentheses for tuples in subscripts. + + --> RUF031.py:12:3 | 10 | ] 11 | d[(2,4)] 12 | d[(5,6,7)] - | ^^^^^^^ RUF031 + | ^^^^^^^ 13 | d[(8,)] 14 | d[tuple(1,2)] | = help: Remove the parentheses. - ℹ Safe fix 9 9 | 2 10 10 | ] @@ -89,17 +93,18 @@ RUF031.py:12:3: RUF031 [*] Avoid parentheses for tuples in subscripts. 14 14 | d[tuple(1,2)] 15 15 | d[tuple(8)] -RUF031.py:13:3: RUF031 [*] Avoid parentheses for tuples in subscripts. +error[RUF031]: 13:3: [*] Avoid parentheses for tuples in subscripts. + + --> RUF031.py:13:3 | 11 | d[(2,4)] 12 | d[(5,6,7)] 13 | d[(8,)] - | ^^^^ RUF031 + | ^^^^ 14 | d[tuple(1,2)] 15 | d[tuple(8)] | = help: Remove the parentheses. - ℹ Safe fix 10 10 | ] 11 11 | d[(2,4)] @@ -110,16 +115,17 @@ RUF031.py:13:3: RUF031 [*] Avoid parentheses for tuples in subscripts. 15 15 | d[tuple(8)] 16 16 | d[1,2] -RUF031.py:20:3: RUF031 [*] Avoid parentheses for tuples in subscripts. +error[RUF031]: 20:3: [*] Avoid parentheses for tuples in subscripts. + + --> RUF031.py:20:3 | 18 | d[5,6,7] 19 | e = {((1,2),(3,4)):"a"} 20 | e[((1,2),(3,4))] - | ^^^^^^^^^^^^^ RUF031 + | ^^^^^^^^^^^^^ 21 | e[(1,2),(3,4)] | = help: Remove the parentheses. - ℹ Safe fix 17 17 | d[3,4] 18 18 | d[5,6,7] @@ -131,15 +137,16 @@ RUF031.py:20:3: RUF031 [*] Avoid parentheses for tuples in subscripts. 23 23 | token_features[ 24 24 | (window_position, feature_name) -RUF031.py:24:5: RUF031 [*] Avoid parentheses for tuples in subscripts. +error[RUF031]: 24:5: [*] Avoid parentheses for tuples in subscripts. + + --> RUF031.py:24:5 | 23 | token_features[ 24 | (window_position, feature_name) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF031 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 25 | ] = self._extract_raw_features_from_token | = help: Remove the parentheses. - ℹ Safe fix 21 21 | e[(1,2),(3,4)] 22 22 | @@ -150,16 +157,17 @@ RUF031.py:24:5: RUF031 [*] Avoid parentheses for tuples in subscripts. 26 26 | 27 27 | d[1,] -RUF031.py:28:3: RUF031 [*] Avoid parentheses for tuples in subscripts. +error[RUF031]: 28:3: [*] Avoid parentheses for tuples in subscripts. + + --> RUF031.py:28:3 | 27 | d[1,] 28 | d[(1,)] - | ^^^^ RUF031 + | ^^^^ 29 | d[()] # empty tuples should be ignored 30 | d[:,] # slices in the subscript lead to syntax error if parens are added | = help: Remove the parentheses. - ℹ Safe fix 25 25 | ] = self._extract_raw_features_from_token 26 26 | diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__noqa.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__noqa.snap index c60869a240..b4598b4d2f 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__noqa.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__noqa.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs --- -error[F841]: noqa.py:23:5: [*] Local variable `I` is assigned to but never used +error[F841]: 23:5: [*] Local variable `I` is assigned to but never used + --> noqa.py:23:5 | 21 | def f(): 22 | # Only `E741` should be ignored by the `noqa`. diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__prefer_parentheses_getitem_tuple.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__prefer_parentheses_getitem_tuple.snap index 9af8d5e20b..da33c9e0f8 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__prefer_parentheses_getitem_tuple.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__prefer_parentheses_getitem_tuple.snap @@ -1,19 +1,20 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs --- -RUF031_prefer_parens.py:8:5: RUF031 [*] Use parentheses for tuples in subscripts. +error[RUF031]: 8:5: [*] Use parentheses for tuples in subscripts. + + --> RUF031_prefer_parens.py:8:5 | 6 | )] 7 | d[ 8 | 1, | _____^ 9 | | 2 - | |_____^ RUF031 + | |_____^ 10 | ] 11 | d[(2,4)] | = help: Parenthesize the tuple. - ℹ Safe fix 5 5 | 2 6 6 | )] @@ -26,17 +27,18 @@ RUF031_prefer_parens.py:8:5: RUF031 [*] Use parentheses for tuples in subscripts 11 11 | d[(2,4)] 12 12 | d[(5,6,7)] -RUF031_prefer_parens.py:16:3: RUF031 [*] Use parentheses for tuples in subscripts. +error[RUF031]: 16:3: [*] Use parentheses for tuples in subscripts. + + --> RUF031_prefer_parens.py:16:3 | 14 | d[tuple(1,2)] 15 | d[tuple(8)] 16 | d[1,2] - | ^^^ RUF031 + | ^^^ 17 | d[3,4] 18 | d[5,6,7] | = help: Parenthesize the tuple. - ℹ Safe fix 13 13 | d[(8,)] 14 14 | d[tuple(1,2)] @@ -47,17 +49,18 @@ RUF031_prefer_parens.py:16:3: RUF031 [*] Use parentheses for tuples in subscript 18 18 | d[5,6,7] 19 19 | e = {((1,2),(3,4)):"a"} -RUF031_prefer_parens.py:17:3: RUF031 [*] Use parentheses for tuples in subscripts. +error[RUF031]: 17:3: [*] Use parentheses for tuples in subscripts. + + --> RUF031_prefer_parens.py:17:3 | 15 | d[tuple(8)] 16 | d[1,2] 17 | d[3,4] - | ^^^ RUF031 + | ^^^ 18 | d[5,6,7] 19 | e = {((1,2),(3,4)):"a"} | = help: Parenthesize the tuple. - ℹ Safe fix 14 14 | d[tuple(1,2)] 15 15 | d[tuple(8)] @@ -68,17 +71,18 @@ RUF031_prefer_parens.py:17:3: RUF031 [*] Use parentheses for tuples in subscript 19 19 | e = {((1,2),(3,4)):"a"} 20 20 | e[((1,2),(3,4))] -RUF031_prefer_parens.py:18:3: RUF031 [*] Use parentheses for tuples in subscripts. +error[RUF031]: 18:3: [*] Use parentheses for tuples in subscripts. + + --> RUF031_prefer_parens.py:18:3 | 16 | d[1,2] 17 | d[3,4] 18 | d[5,6,7] - | ^^^^^ RUF031 + | ^^^^^ 19 | e = {((1,2),(3,4)):"a"} 20 | e[((1,2),(3,4))] | = help: Parenthesize the tuple. - ℹ Safe fix 15 15 | d[tuple(8)] 16 16 | d[1,2] @@ -89,17 +93,18 @@ RUF031_prefer_parens.py:18:3: RUF031 [*] Use parentheses for tuples in subscript 20 20 | e[((1,2),(3,4))] 21 21 | e[(1,2),(3,4)] -RUF031_prefer_parens.py:21:3: RUF031 [*] Use parentheses for tuples in subscripts. +error[RUF031]: 21:3: [*] Use parentheses for tuples in subscripts. + + --> RUF031_prefer_parens.py:21:3 | 19 | e = {((1,2),(3,4)):"a"} 20 | e[((1,2),(3,4))] 21 | e[(1,2),(3,4)] - | ^^^^^^^^^^^ RUF031 + | ^^^^^^^^^^^ 22 | 23 | token_features[ | = help: Parenthesize the tuple. - ℹ Safe fix 18 18 | d[5,6,7] 19 19 | e = {((1,2),(3,4)):"a"} @@ -110,17 +115,18 @@ RUF031_prefer_parens.py:21:3: RUF031 [*] Use parentheses for tuples in subscript 23 23 | token_features[ 24 24 | (window_position, feature_name) -RUF031_prefer_parens.py:26:3: RUF031 [*] Use parentheses for tuples in subscripts. +error[RUF031]: 26:3: [*] Use parentheses for tuples in subscripts. + + --> RUF031_prefer_parens.py:26:3 | 24 | (window_position, feature_name) 25 | ] = self._extract_raw_features_from_token 26 | d[1,] - | ^^ RUF031 + | ^^ 27 | d[(1,)] 28 | d[()] # empty tuples should be ignored | = help: Parenthesize the tuple. - ℹ Safe fix 23 23 | token_features[ 24 24 | (window_position, feature_name) diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__preview__RUF007_RUF007.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__preview__RUF007_RUF007.py.snap index b12828b3ac..654d271d2d 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__preview__RUF007_RUF007.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__preview__RUF007_RUF007.py.snap @@ -1,16 +1,17 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs --- -RUF007.py:16:1: RUF007 [*] Prefer `itertools.pairwise()` over `zip()` when iterating over successive pairs +error[RUF007]: 16:1: [*] Prefer `itertools.pairwise()` over `zip()` when iterating over successive pairs + + --> RUF007.py:15:9 | 15 | # Errors 16 | zip(input, input[1:]) - | ^^^ RUF007 + | ^^^ 17 | zip(input, input[1::1]) 18 | zip(input[:-1], input[1:]) | = help: Replace `zip()` with `itertools.pairwise()` - ℹ Unsafe fix 1 |+import itertools 1 2 | input = [1, 2, 3] @@ -26,17 +27,18 @@ RUF007.py:16:1: RUF007 [*] Prefer `itertools.pairwise()` over `zip()` when itera 18 19 | zip(input[:-1], input[1:]) 19 20 | zip(input[1:], input[2:]) -RUF007.py:17:1: RUF007 [*] Prefer `itertools.pairwise()` over `zip()` when iterating over successive pairs +error[RUF007]: 17:1: [*] Prefer `itertools.pairwise()` over `zip()` when iterating over successive pairs + + --> RUF007.py:16:22 | 15 | # Errors 16 | zip(input, input[1:]) 17 | zip(input, input[1::1]) - | ^^^ RUF007 + | ^^^ 18 | zip(input[:-1], input[1:]) 19 | zip(input[1:], input[2:]) | = help: Replace `zip()` with `itertools.pairwise()` - ℹ Unsafe fix 1 |+import itertools 1 2 | input = [1, 2, 3] @@ -52,17 +54,18 @@ RUF007.py:17:1: RUF007 [*] Prefer `itertools.pairwise()` over `zip()` when itera 19 20 | zip(input[1:], input[2:]) 20 21 | zip(input[1:-1], input[2:]) -RUF007.py:18:1: RUF007 [*] Prefer `itertools.pairwise()` over `zip()` when iterating over successive pairs +error[RUF007]: 18:1: [*] Prefer `itertools.pairwise()` over `zip()` when iterating over successive pairs + + --> RUF007.py:17:24 | 16 | zip(input, input[1:]) 17 | zip(input, input[1::1]) 18 | zip(input[:-1], input[1:]) - | ^^^ RUF007 + | ^^^ 19 | zip(input[1:], input[2:]) 20 | zip(input[1:-1], input[2:]) | = help: Replace `zip()` with `itertools.pairwise()` - ℹ Unsafe fix 1 |+import itertools 1 2 | input = [1, 2, 3] @@ -78,17 +81,18 @@ RUF007.py:18:1: RUF007 [*] Prefer `itertools.pairwise()` over `zip()` when itera 20 21 | zip(input[1:-1], input[2:]) 21 22 | list(zip(input, input[1:])) -RUF007.py:19:1: RUF007 [*] Prefer `itertools.pairwise()` over `zip()` when iterating over successive pairs +error[RUF007]: 19:1: [*] Prefer `itertools.pairwise()` over `zip()` when iterating over successive pairs + + --> RUF007.py:18:27 | 17 | zip(input, input[1::1]) 18 | zip(input[:-1], input[1:]) 19 | zip(input[1:], input[2:]) - | ^^^ RUF007 + | ^^^ 20 | zip(input[1:-1], input[2:]) 21 | list(zip(input, input[1:])) | = help: Replace `zip()` with `itertools.pairwise()` - ℹ Unsafe fix 1 |+import itertools 1 2 | input = [1, 2, 3] @@ -104,17 +108,18 @@ RUF007.py:19:1: RUF007 [*] Prefer `itertools.pairwise()` over `zip()` when itera 21 22 | list(zip(input, input[1:])) 22 23 | list(zip(input[:-1], input[1:])) -RUF007.py:20:1: RUF007 [*] Prefer `itertools.pairwise()` over `zip()` when iterating over successive pairs +error[RUF007]: 20:1: [*] Prefer `itertools.pairwise()` over `zip()` when iterating over successive pairs + + --> RUF007.py:19:26 | 18 | zip(input[:-1], input[1:]) 19 | zip(input[1:], input[2:]) 20 | zip(input[1:-1], input[2:]) - | ^^^ RUF007 + | ^^^ 21 | list(zip(input, input[1:])) 22 | list(zip(input[:-1], input[1:])) | = help: Replace `zip()` with `itertools.pairwise()` - ℹ Unsafe fix 1 |+import itertools 1 2 | input = [1, 2, 3] @@ -130,17 +135,18 @@ RUF007.py:20:1: RUF007 [*] Prefer `itertools.pairwise()` over `zip()` when itera 22 23 | list(zip(input[:-1], input[1:])) 23 24 | zip(foo[:-1], foo[1:], strict=True) -RUF007.py:21:6: RUF007 [*] Prefer `itertools.pairwise()` over `zip()` when iterating over successive pairs +error[RUF007]: 21:6: [*] Prefer `itertools.pairwise()` over `zip()` when iterating over successive pairs + + --> RUF007.py:21:6 | 19 | zip(input[1:], input[2:]) 20 | zip(input[1:-1], input[2:]) 21 | list(zip(input, input[1:])) - | ^^^ RUF007 + | ^^^ 22 | list(zip(input[:-1], input[1:])) 23 | zip(foo[:-1], foo[1:], strict=True) | = help: Replace `zip()` with `itertools.pairwise()` - ℹ Unsafe fix 1 |+import itertools 1 2 | input = [1, 2, 3] @@ -156,17 +162,18 @@ RUF007.py:21:6: RUF007 [*] Prefer `itertools.pairwise()` over `zip()` when itera 23 24 | zip(foo[:-1], foo[1:], strict=True) 24 25 | zip(foo[:-1], foo[1:], strict=False) -RUF007.py:22:6: RUF007 [*] Prefer `itertools.pairwise()` over `zip()` when iterating over successive pairs +error[RUF007]: 22:6: [*] Prefer `itertools.pairwise()` over `zip()` when iterating over successive pairs + + --> RUF007.py:22:6 | 20 | zip(input[1:-1], input[2:]) 21 | list(zip(input, input[1:])) 22 | list(zip(input[:-1], input[1:])) - | ^^^ RUF007 + | ^^^ 23 | zip(foo[:-1], foo[1:], strict=True) 24 | zip(foo[:-1], foo[1:], strict=False) | = help: Replace `zip()` with `itertools.pairwise()` - ℹ Unsafe fix 1 |+import itertools 1 2 | input = [1, 2, 3] @@ -182,17 +189,18 @@ RUF007.py:22:6: RUF007 [*] Prefer `itertools.pairwise()` over `zip()` when itera 24 25 | zip(foo[:-1], foo[1:], strict=False) 25 26 | zip(foo[:-1], foo[1:], strict=bool(foo)) -RUF007.py:23:1: RUF007 [*] Prefer `itertools.pairwise()` over `zip()` when iterating over successive pairs +error[RUF007]: 23:1: [*] Prefer `itertools.pairwise()` over `zip()` when iterating over successive pairs + + --> RUF007.py:22:33 | 21 | list(zip(input, input[1:])) 22 | list(zip(input[:-1], input[1:])) 23 | zip(foo[:-1], foo[1:], strict=True) - | ^^^ RUF007 + | ^^^ 24 | zip(foo[:-1], foo[1:], strict=False) 25 | zip(foo[:-1], foo[1:], strict=bool(foo)) | = help: Replace `zip()` with `itertools.pairwise()` - ℹ Unsafe fix 1 |+import itertools 1 2 | input = [1, 2, 3] @@ -207,16 +215,17 @@ RUF007.py:23:1: RUF007 [*] Prefer `itertools.pairwise()` over `zip()` when itera 24 25 | zip(foo[:-1], foo[1:], strict=False) 25 26 | zip(foo[:-1], foo[1:], strict=bool(foo)) -RUF007.py:24:1: RUF007 [*] Prefer `itertools.pairwise()` over `zip()` when iterating over successive pairs +error[RUF007]: 24:1: [*] Prefer `itertools.pairwise()` over `zip()` when iterating over successive pairs + + --> RUF007.py:23:36 | 22 | list(zip(input[:-1], input[1:])) 23 | zip(foo[:-1], foo[1:], strict=True) 24 | zip(foo[:-1], foo[1:], strict=False) - | ^^^ RUF007 + | ^^^ 25 | zip(foo[:-1], foo[1:], strict=bool(foo)) | = help: Replace `zip()` with `itertools.pairwise()` - ℹ Unsafe fix 1 |+import itertools 1 2 | input = [1, 2, 3] @@ -230,15 +239,16 @@ RUF007.py:24:1: RUF007 [*] Prefer `itertools.pairwise()` over `zip()` when itera 25 |+itertools.pairwise(foo) 25 26 | zip(foo[:-1], foo[1:], strict=bool(foo)) -RUF007.py:25:1: RUF007 [*] Prefer `itertools.pairwise()` over `zip()` when iterating over successive pairs +error[RUF007]: 25:1: [*] Prefer `itertools.pairwise()` over `zip()` when iterating over successive pairs + + --> RUF007.py:24:37 | 23 | zip(foo[:-1], foo[1:], strict=True) 24 | zip(foo[:-1], foo[1:], strict=False) 25 | zip(foo[:-1], foo[1:], strict=bool(foo)) - | ^^^ RUF007 + | ^^^ | = help: Replace `zip()` with `itertools.pairwise()` - ℹ Unsafe fix 1 |+import itertools 1 2 | input = [1, 2, 3] diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__preview_confusables.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__preview_confusables.snap index fb0244606a..1a1807fe13 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__preview_confusables.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__preview_confusables.snap @@ -1,15 +1,17 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs --- -error[RUF001]: confusables.py:1:6: String contains ambiguous `𝐁` (MATHEMATICAL BOLD CAPITAL B). Did you mean `B` (LATIN CAPITAL LETTER B)? +error[RUF001]: 1:6: String contains ambiguous `𝐁` (MATHEMATICAL BOLD CAPITAL B). Did you mean `B` (LATIN CAPITAL LETTER B)? + --> confusables.py:1:6 | 1 | x = "𝐁ad string" | ^ 2 | y = "−" | -error[RUF002]: confusables.py:6:56: Docstring contains ambiguous `)` (FULLWIDTH RIGHT PARENTHESIS). Did you mean `)` (RIGHT PARENTHESIS)? +error[RUF002]: 6:56: Docstring contains ambiguous `)` (FULLWIDTH RIGHT PARENTHESIS). Did you mean `)` (RIGHT PARENTHESIS)? + --> confusables.py:6:56 | 5 | def f(): 6 | """Here's a docstring with an unusual parenthesis: )""" @@ -17,8 +19,9 @@ error[RUF002]: confusables.py:6:56: Docstring contains ambiguous `)` (FULLWIDT 7 | # And here's a comment with an unusual punctuation mark: ᜵ 8 | ... | -error[RUF003]: confusables.py:7:62: Comment contains ambiguous `᜵` (PHILIPPINE SINGLE PUNCTUATION). Did you mean `/` (SOLIDUS)? +error[RUF003]: 7:62: Comment contains ambiguous `᜵` (PHILIPPINE SINGLE PUNCTUATION). Did you mean `/` (SOLIDUS)? + --> confusables.py:7:62 | 5 | def f(): 6 | """Here's a docstring with an unusual parenthesis: )""" @@ -26,15 +29,17 @@ error[RUF003]: confusables.py:7:62: Comment contains ambiguous `᜵` (PHILIPPINE | ^ 8 | ... | -error[RUF001]: confusables.py:17:6: String contains ambiguous `𝐁` (MATHEMATICAL BOLD CAPITAL B). Did you mean `B` (LATIN CAPITAL LETTER B)? +error[RUF001]: 17:6: String contains ambiguous `𝐁` (MATHEMATICAL BOLD CAPITAL B). Did you mean `B` (LATIN CAPITAL LETTER B)? + --> confusables.py:17:6 | 17 | x = "𝐁ad string" | ^ 18 | x = "−" | -error[RUF001]: confusables.py:26:10: String contains ambiguous `α` (GREEK SMALL LETTER ALPHA). Did you mean `a` (LATIN SMALL LETTER A)? +error[RUF001]: 26:10: String contains ambiguous `α` (GREEK SMALL LETTER ALPHA). Did you mean `a` (LATIN SMALL LETTER A)? + --> confusables.py:26:10 | 24 | # The first word should be ignored, while the second should be included, since it 25 | # contains ASCII. @@ -43,8 +48,9 @@ error[RUF001]: confusables.py:26:10: String contains ambiguous `α` (GREEK SMALL 27 | 28 | # The two characters should be flagged here. The first character is a "word" | -error[RUF001]: confusables.py:31:6: String contains ambiguous `Р` (CYRILLIC CAPITAL LETTER ER). Did you mean `P` (LATIN CAPITAL LETTER P)? +error[RUF001]: 31:6: String contains ambiguous `Р` (CYRILLIC CAPITAL LETTER ER). Did you mean `P` (LATIN CAPITAL LETTER P)? + --> confusables.py:31:6 | 29 | # consisting of a single ambiguous character, while the second character is a "word 30 | # boundary" (whitespace) that it itself ambiguous. @@ -53,8 +59,9 @@ error[RUF001]: confusables.py:31:6: String contains ambiguous `Р` (CYRILLIC CAP 32 | 33 | # Same test cases as above but using f-strings instead: | -error[RUF001]: confusables.py:31:7: String contains ambiguous ` ` (EN QUAD). Did you mean ` ` (SPACE)? +error[RUF001]: 31:7: String contains ambiguous ` ` (EN QUAD). Did you mean ` ` (SPACE)? + --> confusables.py:31:7 | 29 | # consisting of a single ambiguous character, while the second character is a "word 30 | # boundary" (whitespace) that it itself ambiguous. @@ -63,8 +70,9 @@ error[RUF001]: confusables.py:31:7: String contains ambiguous ` ` (EN QUAD). D 32 | 33 | # Same test cases as above but using f-strings instead: | -error[RUF001]: confusables.py:34:7: String contains ambiguous `𝐁` (MATHEMATICAL BOLD CAPITAL B). Did you mean `B` (LATIN CAPITAL LETTER B)? +error[RUF001]: 34:7: String contains ambiguous `𝐁` (MATHEMATICAL BOLD CAPITAL B). Did you mean `B` (LATIN CAPITAL LETTER B)? + --> confusables.py:34:7 | 33 | # Same test cases as above but using f-strings instead: 34 | x = f"𝐁ad string" @@ -72,8 +80,9 @@ error[RUF001]: confusables.py:34:7: String contains ambiguous `𝐁` (MATHEMATIC 35 | x = f"−" 36 | x = f"Русский" | -error[RUF001]: confusables.py:37:11: String contains ambiguous `α` (GREEK SMALL LETTER ALPHA). Did you mean `a` (LATIN SMALL LETTER A)? +error[RUF001]: 37:11: String contains ambiguous `α` (GREEK SMALL LETTER ALPHA). Did you mean `a` (LATIN SMALL LETTER A)? + --> confusables.py:37:11 | 35 | x = f"−" 36 | x = f"Русский" @@ -81,8 +90,9 @@ error[RUF001]: confusables.py:37:11: String contains ambiguous `α` (GREEK SMALL | ^ 38 | x = f"Р усский" | -error[RUF001]: confusables.py:38:7: String contains ambiguous `Р` (CYRILLIC CAPITAL LETTER ER). Did you mean `P` (LATIN CAPITAL LETTER P)? +error[RUF001]: 38:7: String contains ambiguous `Р` (CYRILLIC CAPITAL LETTER ER). Did you mean `P` (LATIN CAPITAL LETTER P)? + --> confusables.py:38:7 | 36 | x = f"Русский" 37 | x = f"βα Bαd" @@ -91,8 +101,9 @@ error[RUF001]: confusables.py:38:7: String contains ambiguous `Р` (CYRILLIC CAP 39 | 40 | # Nested f-strings | -error[RUF001]: confusables.py:38:8: String contains ambiguous ` ` (EN QUAD). Did you mean ` ` (SPACE)? +error[RUF001]: 38:8: String contains ambiguous ` ` (EN QUAD). Did you mean ` ` (SPACE)? + --> confusables.py:38:8 | 36 | x = f"Русский" 37 | x = f"βα Bαd" @@ -101,8 +112,9 @@ error[RUF001]: confusables.py:38:8: String contains ambiguous ` ` (EN QUAD). D 39 | 40 | # Nested f-strings | -error[RUF001]: confusables.py:41:7: String contains ambiguous `𝐁` (MATHEMATICAL BOLD CAPITAL B). Did you mean `B` (LATIN CAPITAL LETTER B)? +error[RUF001]: 41:7: String contains ambiguous `𝐁` (MATHEMATICAL BOLD CAPITAL B). Did you mean `B` (LATIN CAPITAL LETTER B)? + --> confusables.py:41:7 | 40 | # Nested f-strings 41 | x = f"𝐁ad string {f" {f"Р усский"}"}" @@ -110,8 +122,9 @@ error[RUF001]: confusables.py:41:7: String contains ambiguous `𝐁` (MATHEMATIC 42 | 43 | # Comments inside f-strings | -error[RUF001]: confusables.py:41:21: String contains ambiguous ` ` (EN QUAD). Did you mean ` ` (SPACE)? +error[RUF001]: 41:21: String contains ambiguous ` ` (EN QUAD). Did you mean ` ` (SPACE)? + --> confusables.py:41:21 | 40 | # Nested f-strings 41 | x = f"𝐁ad string {f" {f"Р усский"}"}" @@ -119,8 +132,9 @@ error[RUF001]: confusables.py:41:21: String contains ambiguous ` ` (EN QUAD). 42 | 43 | # Comments inside f-strings | -error[RUF001]: confusables.py:41:25: String contains ambiguous `Р` (CYRILLIC CAPITAL LETTER ER). Did you mean `P` (LATIN CAPITAL LETTER P)? +error[RUF001]: 41:25: String contains ambiguous `Р` (CYRILLIC CAPITAL LETTER ER). Did you mean `P` (LATIN CAPITAL LETTER P)? + --> confusables.py:41:25 | 40 | # Nested f-strings 41 | x = f"𝐁ad string {f" {f"Р усский"}"}" @@ -128,8 +142,9 @@ error[RUF001]: confusables.py:41:25: String contains ambiguous `Р` (CYRILLIC CA 42 | 43 | # Comments inside f-strings | -error[RUF001]: confusables.py:41:26: String contains ambiguous ` ` (EN QUAD). Did you mean ` ` (SPACE)? +error[RUF001]: 41:26: String contains ambiguous ` ` (EN QUAD). Did you mean ` ` (SPACE)? + --> confusables.py:41:26 | 40 | # Nested f-strings 41 | x = f"𝐁ad string {f" {f"Р усский"}"}" @@ -137,8 +152,9 @@ error[RUF001]: confusables.py:41:26: String contains ambiguous ` ` (EN QUAD). 42 | 43 | # Comments inside f-strings | -error[RUF003]: confusables.py:44:68: Comment contains ambiguous `)` (FULLWIDTH RIGHT PARENTHESIS). Did you mean `)` (RIGHT PARENTHESIS)? +error[RUF003]: 44:68: Comment contains ambiguous `)` (FULLWIDTH RIGHT PARENTHESIS). Did you mean `)` (RIGHT PARENTHESIS)? + --> confusables.py:44:68 | 43 | # Comments inside f-strings 44 | x = f"string { # And here's a comment with an unusual parenthesis: ) @@ -146,8 +162,9 @@ error[RUF003]: confusables.py:44:68: Comment contains ambiguous `)` (FULLWIDTH 45 | # And here's a comment with a greek alpha: ∗ 46 | foo # And here's a comment with an unusual punctuation mark: ᜵ | -error[RUF003]: confusables.py:46:62: Comment contains ambiguous `᜵` (PHILIPPINE SINGLE PUNCTUATION). Did you mean `/` (SOLIDUS)? +error[RUF003]: 46:62: Comment contains ambiguous `᜵` (PHILIPPINE SINGLE PUNCTUATION). Did you mean `/` (SOLIDUS)? + --> confusables.py:46:62 | 44 | x = f"string { # And here's a comment with an unusual parenthesis: ) 45 | # And here's a comment with a greek alpha: ∗ @@ -155,23 +172,26 @@ error[RUF003]: confusables.py:46:62: Comment contains ambiguous `᜵` (PHILIPPIN | ^ 47 | }" | -error[RUF001]: confusables.py:55:28: String contains ambiguous `µ` (MICRO SIGN). Did you mean `μ` (GREEK SMALL LETTER MU)? +error[RUF001]: 55:28: String contains ambiguous `µ` (MICRO SIGN). Did you mean `μ` (GREEK SMALL LETTER MU)? + --> confusables.py:55:28 | 55 | assert getattr(Labware(), "µL") == 1.5 | ^ 56 | 57 | # Implicit string concatenation | -error[RUF001]: confusables.py:58:6: String contains ambiguous `𝐁` (MATHEMATICAL BOLD CAPITAL B). Did you mean `B` (LATIN CAPITAL LETTER B)? +error[RUF001]: 58:6: String contains ambiguous `𝐁` (MATHEMATICAL BOLD CAPITAL B). Did you mean `B` (LATIN CAPITAL LETTER B)? + --> confusables.py:58:6 | 57 | # Implicit string concatenation 58 | x = "𝐁ad" f"𝐁ad string" | ^ | -error[RUF001]: confusables.py:58:13: String contains ambiguous `𝐁` (MATHEMATICAL BOLD CAPITAL B). Did you mean `B` (LATIN CAPITAL LETTER B)? +error[RUF001]: 58:13: String contains ambiguous `𝐁` (MATHEMATICAL BOLD CAPITAL B). Did you mean `B` (LATIN CAPITAL LETTER B)? + --> confusables.py:58:13 | 57 | # Implicit string concatenation 58 | x = "𝐁ad" f"𝐁ad string" diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_0.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_0.snap index 4eedb484ea..61396d8ab3 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_0.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_0.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs --- -error[RUF100]: RUF100_0.py:9:12: [*] Unused blanket `noqa` directive +error[RUF100]: 9:12: [*] Unused blanket `noqa` directive + --> RUF100_0.py:9:12 | 8 | # Invalid 9 | c = 1 # noqa @@ -20,8 +21,9 @@ error[RUF100]: RUF100_0.py:9:12: [*] Unused blanket `noqa` directive 11 11 | 12 12 | # Invalid -error[RUF100]: RUF100_0.py:13:12: [*] Unused `noqa` directive (unused: `E501`) +error[RUF100]: 13:12: [*] Unused `noqa` directive (unused: `E501`) + --> RUF100_0.py:13:12 | 12 | # Invalid 13 | d = 1 # noqa: E501 @@ -40,8 +42,9 @@ error[RUF100]: RUF100_0.py:13:12: [*] Unused `noqa` directive (unused: `E501`) 15 15 | # Invalid 16 16 | d = 1 # noqa: F841, E501 -error[RUF100]: RUF100_0.py:16:12: [*] Unused `noqa` directive (unused: `F841`, `E501`) +error[RUF100]: 16:12: [*] Unused `noqa` directive (unused: `F841`, `E501`) + --> RUF100_0.py:16:12 | 15 | # Invalid 16 | d = 1 # noqa: F841, E501 @@ -60,8 +63,9 @@ error[RUF100]: RUF100_0.py:16:12: [*] Unused `noqa` directive (unused: `F841`, ` 18 18 | # Invalid (and unimplemented or not enabled) 19 19 | d = 1 # noqa: F841, W191, F821 -error[RUF100]: RUF100_0.py:19:12: [*] Unused `noqa` directive (unused: `F841`, `W191`; non-enabled: `F821`) +error[RUF100]: 19:12: [*] Unused `noqa` directive (unused: `F841`, `W191`; non-enabled: `F821`) + --> RUF100_0.py:19:12 | 18 | # Invalid (and unimplemented or not enabled) 19 | d = 1 # noqa: F841, W191, F821 @@ -80,8 +84,9 @@ error[RUF100]: RUF100_0.py:19:12: [*] Unused `noqa` directive (unused: `F841`, ` 21 21 | # Invalid (but external) 22 22 | d = 1 # noqa: F841, V101 -error[RUF100]: RUF100_0.py:22:12: [*] Unused `noqa` directive (unused: `F841`) +error[RUF100]: 22:12: [*] Unused `noqa` directive (unused: `F841`) + --> RUF100_0.py:22:12 | 21 | # Invalid (but external) 22 | d = 1 # noqa: F841, V101 @@ -100,8 +105,9 @@ error[RUF100]: RUF100_0.py:22:12: [*] Unused `noqa` directive (unused: `F841`) 24 24 | # Invalid (but external) 25 25 | d = 1 # noqa: V500 -error[RUF100]: RUF100_0.py:25:12: [*] Unused `noqa` directive (unknown: `V500`) +error[RUF100]: 25:12: [*] Unused `noqa` directive (unknown: `V500`) + --> RUF100_0.py:25:12 | 24 | # Invalid (but external) 25 | d = 1 # noqa: V500 @@ -120,8 +126,9 @@ error[RUF100]: RUF100_0.py:25:12: [*] Unused `noqa` directive (unknown: `V500`) 27 27 | # fmt: off 28 28 | # Invalid - no space before # -error[RUF100]: RUF100_0.py:29:12: [*] Unused `noqa` directive (unused: `E501`) +error[RUF100]: 29:12: [*] Unused `noqa` directive (unused: `E501`) + --> RUF100_0.py:29:12 | 27 | # fmt: off 28 | # Invalid - no space before # @@ -141,8 +148,9 @@ error[RUF100]: RUF100_0.py:29:12: [*] Unused `noqa` directive (unused: `E501`) 31 31 | # Invalid - many spaces before # 32 32 | d = 1 # noqa: E501 -error[F841]: RUF100_0.py:32:5: [*] Local variable `d` is assigned to but never used +error[F841]: 32:5: [*] Local variable `d` is assigned to but never used + --> RUF100_0.py:32:5 | 31 | # Invalid - many spaces before # 32 | d = 1 # noqa: E501 @@ -159,8 +167,9 @@ error[F841]: RUF100_0.py:32:5: [*] Local variable `d` is assigned to but never u 34 33 | 35 34 | -error[RUF100]: RUF100_0.py:32:12: [*] Unused `noqa` directive (unused: `E501`) +error[RUF100]: 32:12: [*] Unused `noqa` directive (unused: `E501`) + --> RUF100_0.py:32:12 | 31 | # Invalid - many spaces before # 32 | d = 1 # noqa: E501 @@ -178,8 +187,9 @@ error[RUF100]: RUF100_0.py:32:12: [*] Unused `noqa` directive (unused: `E501`) 34 34 | 35 35 | -error[RUF100]: RUF100_0.py:58:6: [*] Unused `noqa` directive (unused: `F841`) +error[RUF100]: 58:6: [*] Unused `noqa` directive (unused: `F841`) + --> RUF100_0.py:58:6 | 57 | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. 58 | """ # noqa: E501, F841 @@ -198,8 +208,9 @@ error[RUF100]: RUF100_0.py:58:6: [*] Unused `noqa` directive (unused: `F841`) 60 60 | # Invalid 61 61 | _ = """Lorem ipsum dolor sit amet. -error[RUF100]: RUF100_0.py:66:6: [*] Unused `noqa` directive (unused: `E501`) +error[RUF100]: 66:6: [*] Unused `noqa` directive (unused: `E501`) + --> RUF100_0.py:66:6 | 65 | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor. 66 | """ # noqa: E501 @@ -218,8 +229,9 @@ error[RUF100]: RUF100_0.py:66:6: [*] Unused `noqa` directive (unused: `E501`) 68 68 | # Invalid 69 69 | _ = """Lorem ipsum dolor sit amet. -error[RUF100]: RUF100_0.py:74:6: [*] Unused blanket `noqa` directive +error[RUF100]: 74:6: [*] Unused blanket `noqa` directive + --> RUF100_0.py:74:6 | 73 | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor. 74 | """ # noqa @@ -238,8 +250,9 @@ error[RUF100]: RUF100_0.py:74:6: [*] Unused blanket `noqa` directive 76 76 | # Valid 77 77 | # this is a veryyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy long comment # noqa: E501 -error[F401]: RUF100_0.py:88:8: [*] `shelve` imported but unused +error[F401]: 88:8: [*] `shelve` imported but unused + --> RUF100_0.py:88:8 | 86 | import collections # noqa 87 | import os # noqa: F401, RUF100 @@ -257,16 +270,18 @@ error[F401]: RUF100_0.py:88:8: [*] `shelve` imported but unused 90 89 | 91 90 | print(sys.path) -error[E501]: RUF100_0.py:93:89: Line too long (89 > 88) +error[E501]: 93:89: Line too long (89 > 88) + --> RUF100_0.py:93:89 | 91 | print(sys.path) 92 | 93 | "shape: (6,)\nSeries: '' [duration[μs]]\n[\n\t0µs\n\t1µs\n\t2µs\n\t3µs\n\t4µs\n\t5µs\n]" # noqa: F401 | ^ | -error[RUF100]: RUF100_0.py:93:92: [*] Unused `noqa` directive (unused: `F401`) +error[RUF100]: 93:92: [*] Unused `noqa` directive (unused: `F401`) + --> RUF100_0.py:93:92 | 91 | print(sys.path) 92 | @@ -284,8 +299,9 @@ error[RUF100]: RUF100_0.py:93:92: [*] Unused `noqa` directive (unused: `F401`) 95 95 | 96 96 | def f(): -error[RUF100]: RUF100_0.py:107:12: [*] Unused `noqa` directive (unknown: `E50`) +error[RUF100]: 107:12: [*] Unused `noqa` directive (unknown: `E50`) + --> RUF100_0.py:107:12 | 105 | def f(): 106 | # Invalid - nonexistent error code with multibyte character @@ -304,8 +320,9 @@ error[RUF100]: RUF100_0.py:107:12: [*] Unused `noqa` directive (unknown: `E50`) 109 109 | 110 110 | -error[F841]: RUF100_0.py:108:5: [*] Local variable `e` is assigned to but never used +error[F841]: 108:5: [*] Local variable `e` is assigned to but never used + --> RUF100_0.py:108:5 | 106 | # Invalid - nonexistent error code with multibyte character 107 | d = 1 # …noqa: F841, E50 @@ -322,8 +339,9 @@ error[F841]: RUF100_0.py:108:5: [*] Local variable `e` is assigned to but never 110 109 | 111 110 | def f(): -error[RUF100]: RUF100_0.py:108:12: [*] Unused `noqa` directive (unknown: `E50`) +error[RUF100]: 108:12: [*] Unused `noqa` directive (unknown: `E50`) + --> RUF100_0.py:108:12 | 106 | # Invalid - nonexistent error code with multibyte character 107 | d = 1 # …noqa: F841, E50 @@ -341,8 +359,9 @@ error[RUF100]: RUF100_0.py:108:12: [*] Unused `noqa` directive (unknown: `E50`) 110 110 | 111 111 | def f(): -error[RUF100]: RUF100_0.py:118:12: [*] Unused `noqa` directive (duplicated: `F841`; unknown: `X200`) +error[RUF100]: 118:12: [*] Unused `noqa` directive (duplicated: `F841`; unknown: `X200`) + --> RUF100_0.py:118:12 | 116 | # Check duplicate code detection 117 | def f(): @@ -362,8 +381,9 @@ error[RUF100]: RUF100_0.py:118:12: [*] Unused `noqa` directive (duplicated: `F84 120 120 | y = 2 == bar # noqa: SIM300, F841, SIM300, SIM300 121 121 | -error[RUF100]: RUF100_0.py:120:19: [*] Unused `noqa` directive (duplicated: `SIM300`, `SIM300`) +error[RUF100]: 120:19: [*] Unused `noqa` directive (duplicated: `SIM300`, `SIM300`) + --> RUF100_0.py:120:19 | 118 | x = 2 # noqa: F841, F841, X200 119 | @@ -383,8 +403,9 @@ error[RUF100]: RUF100_0.py:120:19: [*] Unused `noqa` directive (duplicated: `SIM 122 122 | z = 2 # noqa: F841 F841 F841, F841, F841 123 123 | -error[RUF100]: RUF100_0.py:122:12: [*] Unused `noqa` directive (duplicated: `F841`, `F841`, `F841`, `F841`) +error[RUF100]: 122:12: [*] Unused `noqa` directive (duplicated: `F841`, `F841`, `F841`, `F841`) + --> RUF100_0.py:122:12 | 120 | y = 2 == bar # noqa: SIM300, F841, SIM300, SIM300 121 | @@ -404,8 +425,9 @@ error[RUF100]: RUF100_0.py:122:12: [*] Unused `noqa` directive (duplicated: `F84 124 124 | return 125 125 | -error[RUF100]: RUF100_0.py:129:20: [*] Unused `noqa` directive (duplicated: `S307`, `S307`, `S307`) +error[RUF100]: 129:20: [*] Unused `noqa` directive (duplicated: `S307`, `S307`, `S307`) + --> RUF100_0.py:129:20 | 127 | # Allow code redirects 128 | x = eval(command) # noqa: PGH001, S307 @@ -424,8 +446,9 @@ error[RUF100]: RUF100_0.py:129:20: [*] Unused `noqa` directive (duplicated: `S30 130 130 | x = eval(command) # noqa: PGH001, S307, PGH001 131 131 | x = eval(command) # noqa: PGH001, S307, PGH001, S307 -error[RUF100]: RUF100_0.py:130:20: [*] Unused `noqa` directive (duplicated: `PGH001`) +error[RUF100]: 130:20: [*] Unused `noqa` directive (duplicated: `PGH001`) + --> RUF100_0.py:130:20 | 128 | x = eval(command) # noqa: PGH001, S307 129 | x = eval(command) # noqa: S307, PGH001, S307, S307, S307 @@ -442,8 +465,9 @@ error[RUF100]: RUF100_0.py:130:20: [*] Unused `noqa` directive (duplicated: `PGH 130 |+x = eval(command) # noqa: PGH001, S307 131 131 | x = eval(command) # noqa: PGH001, S307, PGH001, S307 -error[RUF100]: RUF100_0.py:131:20: [*] Unused `noqa` directive (duplicated: `PGH001`, `S307`) +error[RUF100]: 131:20: [*] Unused `noqa` directive (duplicated: `PGH001`, `S307`) + --> RUF100_0.py:131:20 | 129 | x = eval(command) # noqa: S307, PGH001, S307, S307, S307 130 | x = eval(command) # noqa: PGH001, S307, PGH001 diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_0_prefix.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_0_prefix.snap index a6d8b2cc85..aeb19d42df 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_0_prefix.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_0_prefix.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs --- -error[RUF100]: RUF100_0.py:9:12: [*] Unused blanket `noqa` directive +error[RUF100]: 9:12: [*] Unused blanket `noqa` directive + --> RUF100_0.py:9:12 | 8 | # Invalid 9 | c = 1 # noqa @@ -20,8 +21,9 @@ error[RUF100]: RUF100_0.py:9:12: [*] Unused blanket `noqa` directive 11 11 | 12 12 | # Invalid -error[RUF100]: RUF100_0.py:13:12: [*] Unused `noqa` directive (unused: `E501`) +error[RUF100]: 13:12: [*] Unused `noqa` directive (unused: `E501`) + --> RUF100_0.py:13:12 | 12 | # Invalid 13 | d = 1 # noqa: E501 @@ -40,8 +42,9 @@ error[RUF100]: RUF100_0.py:13:12: [*] Unused `noqa` directive (unused: `E501`) 15 15 | # Invalid 16 16 | d = 1 # noqa: F841, E501 -error[RUF100]: RUF100_0.py:16:12: [*] Unused `noqa` directive (unused: `F841`, `E501`) +error[RUF100]: 16:12: [*] Unused `noqa` directive (unused: `F841`, `E501`) + --> RUF100_0.py:16:12 | 15 | # Invalid 16 | d = 1 # noqa: F841, E501 @@ -60,8 +63,9 @@ error[RUF100]: RUF100_0.py:16:12: [*] Unused `noqa` directive (unused: `F841`, ` 18 18 | # Invalid (and unimplemented or not enabled) 19 19 | d = 1 # noqa: F841, W191, F821 -error[RUF100]: RUF100_0.py:19:12: [*] Unused `noqa` directive (unused: `F841`, `W191`; non-enabled: `F821`) +error[RUF100]: 19:12: [*] Unused `noqa` directive (unused: `F841`, `W191`; non-enabled: `F821`) + --> RUF100_0.py:19:12 | 18 | # Invalid (and unimplemented or not enabled) 19 | d = 1 # noqa: F841, W191, F821 @@ -80,8 +84,9 @@ error[RUF100]: RUF100_0.py:19:12: [*] Unused `noqa` directive (unused: `F841`, ` 21 21 | # Invalid (but external) 22 22 | d = 1 # noqa: F841, V101 -error[RUF100]: RUF100_0.py:22:12: [*] Unused `noqa` directive (unused: `F841`) +error[RUF100]: 22:12: [*] Unused `noqa` directive (unused: `F841`) + --> RUF100_0.py:22:12 | 21 | # Invalid (but external) 22 | d = 1 # noqa: F841, V101 @@ -100,8 +105,9 @@ error[RUF100]: RUF100_0.py:22:12: [*] Unused `noqa` directive (unused: `F841`) 24 24 | # Invalid (but external) 25 25 | d = 1 # noqa: V500 -error[RUF100]: RUF100_0.py:29:12: [*] Unused `noqa` directive (unused: `E501`) +error[RUF100]: 29:12: [*] Unused `noqa` directive (unused: `E501`) + --> RUF100_0.py:29:12 | 27 | # fmt: off 28 | # Invalid - no space before # @@ -121,8 +127,9 @@ error[RUF100]: RUF100_0.py:29:12: [*] Unused `noqa` directive (unused: `E501`) 31 31 | # Invalid - many spaces before # 32 32 | d = 1 # noqa: E501 -error[F841]: RUF100_0.py:32:5: [*] Local variable `d` is assigned to but never used +error[F841]: 32:5: [*] Local variable `d` is assigned to but never used + --> RUF100_0.py:32:5 | 31 | # Invalid - many spaces before # 32 | d = 1 # noqa: E501 @@ -139,8 +146,9 @@ error[F841]: RUF100_0.py:32:5: [*] Local variable `d` is assigned to but never u 34 33 | 35 34 | -error[RUF100]: RUF100_0.py:32:12: [*] Unused `noqa` directive (unused: `E501`) +error[RUF100]: 32:12: [*] Unused `noqa` directive (unused: `E501`) + --> RUF100_0.py:32:12 | 31 | # Invalid - many spaces before # 32 | d = 1 # noqa: E501 @@ -158,8 +166,9 @@ error[RUF100]: RUF100_0.py:32:12: [*] Unused `noqa` directive (unused: `E501`) 34 34 | 35 35 | -error[RUF100]: RUF100_0.py:58:6: [*] Unused `noqa` directive (unused: `F841`) +error[RUF100]: 58:6: [*] Unused `noqa` directive (unused: `F841`) + --> RUF100_0.py:58:6 | 57 | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. 58 | """ # noqa: E501, F841 @@ -178,8 +187,9 @@ error[RUF100]: RUF100_0.py:58:6: [*] Unused `noqa` directive (unused: `F841`) 60 60 | # Invalid 61 61 | _ = """Lorem ipsum dolor sit amet. -error[RUF100]: RUF100_0.py:66:6: [*] Unused `noqa` directive (unused: `E501`) +error[RUF100]: 66:6: [*] Unused `noqa` directive (unused: `E501`) + --> RUF100_0.py:66:6 | 65 | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor. 66 | """ # noqa: E501 @@ -198,8 +208,9 @@ error[RUF100]: RUF100_0.py:66:6: [*] Unused `noqa` directive (unused: `E501`) 68 68 | # Invalid 69 69 | _ = """Lorem ipsum dolor sit amet. -error[RUF100]: RUF100_0.py:74:6: [*] Unused blanket `noqa` directive +error[RUF100]: 74:6: [*] Unused blanket `noqa` directive + --> RUF100_0.py:74:6 | 73 | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor. 74 | """ # noqa @@ -218,8 +229,9 @@ error[RUF100]: RUF100_0.py:74:6: [*] Unused blanket `noqa` directive 76 76 | # Valid 77 77 | # this is a veryyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy long comment # noqa: E501 -error[F401]: RUF100_0.py:88:8: [*] `shelve` imported but unused +error[F401]: 88:8: [*] `shelve` imported but unused + --> RUF100_0.py:88:8 | 86 | import collections # noqa 87 | import os # noqa: F401, RUF100 @@ -237,16 +249,18 @@ error[F401]: RUF100_0.py:88:8: [*] `shelve` imported but unused 90 89 | 91 90 | print(sys.path) -error[E501]: RUF100_0.py:93:89: Line too long (89 > 88) +error[E501]: 93:89: Line too long (89 > 88) + --> RUF100_0.py:93:89 | 91 | print(sys.path) 92 | 93 | "shape: (6,)\nSeries: '' [duration[μs]]\n[\n\t0µs\n\t1µs\n\t2µs\n\t3µs\n\t4µs\n\t5µs\n]" # noqa: F401 | ^ | -error[RUF100]: RUF100_0.py:93:92: [*] Unused `noqa` directive (unused: `F401`) +error[RUF100]: 93:92: [*] Unused `noqa` directive (unused: `F401`) + --> RUF100_0.py:93:92 | 91 | print(sys.path) 92 | @@ -264,8 +278,9 @@ error[RUF100]: RUF100_0.py:93:92: [*] Unused `noqa` directive (unused: `F401`) 95 95 | 96 96 | def f(): -error[RUF100]: RUF100_0.py:107:12: [*] Unused `noqa` directive (unknown: `E50`) +error[RUF100]: 107:12: [*] Unused `noqa` directive (unknown: `E50`) + --> RUF100_0.py:107:12 | 105 | def f(): 106 | # Invalid - nonexistent error code with multibyte character @@ -284,8 +299,9 @@ error[RUF100]: RUF100_0.py:107:12: [*] Unused `noqa` directive (unknown: `E50`) 109 109 | 110 110 | -error[F841]: RUF100_0.py:108:5: [*] Local variable `e` is assigned to but never used +error[F841]: 108:5: [*] Local variable `e` is assigned to but never used + --> RUF100_0.py:108:5 | 106 | # Invalid - nonexistent error code with multibyte character 107 | d = 1 # …noqa: F841, E50 @@ -302,8 +318,9 @@ error[F841]: RUF100_0.py:108:5: [*] Local variable `e` is assigned to but never 110 109 | 111 110 | def f(): -error[RUF100]: RUF100_0.py:108:12: [*] Unused `noqa` directive (unknown: `E50`) +error[RUF100]: 108:12: [*] Unused `noqa` directive (unknown: `E50`) + --> RUF100_0.py:108:12 | 106 | # Invalid - nonexistent error code with multibyte character 107 | d = 1 # …noqa: F841, E50 @@ -321,8 +338,9 @@ error[RUF100]: RUF100_0.py:108:12: [*] Unused `noqa` directive (unknown: `E50`) 110 110 | 111 111 | def f(): -error[RUF100]: RUF100_0.py:118:12: [*] Unused `noqa` directive (duplicated: `F841`; unknown: `X200`) +error[RUF100]: 118:12: [*] Unused `noqa` directive (duplicated: `F841`; unknown: `X200`) + --> RUF100_0.py:118:12 | 116 | # Check duplicate code detection 117 | def f(): @@ -342,8 +360,9 @@ error[RUF100]: RUF100_0.py:118:12: [*] Unused `noqa` directive (duplicated: `F84 120 120 | y = 2 == bar # noqa: SIM300, F841, SIM300, SIM300 121 121 | -error[RUF100]: RUF100_0.py:120:19: [*] Unused `noqa` directive (duplicated: `SIM300`, `SIM300`) +error[RUF100]: 120:19: [*] Unused `noqa` directive (duplicated: `SIM300`, `SIM300`) + --> RUF100_0.py:120:19 | 118 | x = 2 # noqa: F841, F841, X200 119 | @@ -363,8 +382,9 @@ error[RUF100]: RUF100_0.py:120:19: [*] Unused `noqa` directive (duplicated: `SIM 122 122 | z = 2 # noqa: F841 F841 F841, F841, F841 123 123 | -error[RUF100]: RUF100_0.py:122:12: [*] Unused `noqa` directive (duplicated: `F841`, `F841`, `F841`, `F841`) +error[RUF100]: 122:12: [*] Unused `noqa` directive (duplicated: `F841`, `F841`, `F841`, `F841`) + --> RUF100_0.py:122:12 | 120 | y = 2 == bar # noqa: SIM300, F841, SIM300, SIM300 121 | @@ -384,8 +404,9 @@ error[RUF100]: RUF100_0.py:122:12: [*] Unused `noqa` directive (duplicated: `F84 124 124 | return 125 125 | -error[RUF100]: RUF100_0.py:129:20: [*] Unused `noqa` directive (duplicated: `S307`, `S307`, `S307`) +error[RUF100]: 129:20: [*] Unused `noqa` directive (duplicated: `S307`, `S307`, `S307`) + --> RUF100_0.py:129:20 | 127 | # Allow code redirects 128 | x = eval(command) # noqa: PGH001, S307 @@ -404,8 +425,9 @@ error[RUF100]: RUF100_0.py:129:20: [*] Unused `noqa` directive (duplicated: `S30 130 130 | x = eval(command) # noqa: PGH001, S307, PGH001 131 131 | x = eval(command) # noqa: PGH001, S307, PGH001, S307 -error[RUF100]: RUF100_0.py:130:20: [*] Unused `noqa` directive (duplicated: `PGH001`) +error[RUF100]: 130:20: [*] Unused `noqa` directive (duplicated: `PGH001`) + --> RUF100_0.py:130:20 | 128 | x = eval(command) # noqa: PGH001, S307 129 | x = eval(command) # noqa: S307, PGH001, S307, S307, S307 @@ -422,8 +444,9 @@ error[RUF100]: RUF100_0.py:130:20: [*] Unused `noqa` directive (duplicated: `PGH 130 |+x = eval(command) # noqa: PGH001, S307 131 131 | x = eval(command) # noqa: PGH001, S307, PGH001, S307 -error[RUF100]: RUF100_0.py:131:20: [*] Unused `noqa` directive (duplicated: `PGH001`, `S307`) +error[RUF100]: 131:20: [*] Unused `noqa` directive (duplicated: `PGH001`, `S307`) + --> RUF100_0.py:131:20 | 129 | x = eval(command) # noqa: S307, PGH001, S307, S307, S307 130 | x = eval(command) # noqa: PGH001, S307, PGH001 diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_1.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_1.snap index 0c97ba7435..aece2f35e4 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_1.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_1.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs --- -error[F401]: RUF100_1.py:37:9: [*] `typing.Union` imported but unused +error[F401]: 37:9: [*] `typing.Union` imported but unused + --> RUF100_1.py:37:9 | 35 | from typing import ( 36 | Mapping, # noqa: F401 @@ -22,8 +23,9 @@ error[F401]: RUF100_1.py:37:9: [*] `typing.Union` imported but unused 40 39 | 41 40 | def f(): -error[RUF100]: RUF100_1.py:52:20: [*] Unused `noqa` directive (unused: `F401`) +error[RUF100]: 52:20: [*] Unused `noqa` directive (unused: `F401`) + --> RUF100_1.py:52:20 | 50 | # This should ignore the error, but the inner noqa should be marked as unused. 51 | from typing import ( # noqa: F401 @@ -42,8 +44,9 @@ error[RUF100]: RUF100_1.py:52:20: [*] Unused `noqa` directive (unused: `F401`) 54 54 | 55 55 | -error[RUF100]: RUF100_1.py:59:20: [*] Unused `noqa` directive (unused: `F401`) +error[RUF100]: 59:20: [*] Unused `noqa` directive (unused: `F401`) + --> RUF100_1.py:59:20 | 57 | # This should ignore the error, but the inner noqa should be marked as unused. 58 | from typing import ( # noqa @@ -62,8 +65,9 @@ error[RUF100]: RUF100_1.py:59:20: [*] Unused `noqa` directive (unused: `F401`) 61 61 | 62 62 | -error[RUF100]: RUF100_1.py:66:16: [*] Unused `noqa` directive (non-enabled: `F501`) +error[RUF100]: 66:16: [*] Unused `noqa` directive (non-enabled: `F501`) + --> RUF100_1.py:66:16 | 64 | # This should ignore the error, but mark F501 as unused. 65 | from typing import ( # noqa: F401 @@ -82,8 +86,9 @@ error[RUF100]: RUF100_1.py:66:16: [*] Unused `noqa` directive (non-enabled: `F50 68 68 | 69 69 | -error[RUF100]: RUF100_1.py:72:27: [*] Unused `noqa` directive (non-enabled: `F501`) +error[RUF100]: 72:27: [*] Unused `noqa` directive (non-enabled: `F501`) + --> RUF100_1.py:72:27 | 70 | def f(): 71 | # This should ignore the error, but mark F501 as unused. @@ -103,8 +108,9 @@ error[RUF100]: RUF100_1.py:72:27: [*] Unused `noqa` directive (non-enabled: `F50 74 74 | ) 75 75 | -error[F401]: RUF100_1.py:89:24: [*] `typing.Awaitable` imported but unused +error[F401]: 89:24: [*] `typing.Awaitable` imported but unused + --> RUF100_1.py:89:24 | 87 | def f(): 88 | # This should mark F501 as unused. @@ -119,8 +125,9 @@ error[F401]: RUF100_1.py:89:24: [*] `typing.Awaitable` imported but unused 89 |- from typing import Awaitable, AwaitableGenerator # noqa: F501 89 |+ pass # noqa: F501 -error[F401]: RUF100_1.py:89:35: [*] `typing.AwaitableGenerator` imported but unused +error[F401]: 89:35: [*] `typing.AwaitableGenerator` imported but unused + --> RUF100_1.py:89:35 | 87 | def f(): 88 | # This should mark F501 as unused. @@ -135,8 +142,9 @@ error[F401]: RUF100_1.py:89:35: [*] `typing.AwaitableGenerator` imported but unu 89 |- from typing import Awaitable, AwaitableGenerator # noqa: F501 89 |+ pass # noqa: F501 -error[RUF100]: RUF100_1.py:89:55: [*] Unused `noqa` directive (non-enabled: `F501`) +error[RUF100]: 89:55: [*] Unused `noqa` directive (non-enabled: `F501`) + --> RUF100_1.py:89:55 | 87 | def f(): 88 | # This should mark F501 as unused. diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_2.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_2.snap index 820df5a0a9..99805d5545 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_2.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_2.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs --- -error[RUF100]: RUF100_2.py:1:19: [*] Unused `noqa` directive (unused: `F401`) +error[RUF100]: 1:19: [*] Unused `noqa` directive (unused: `F401`) + --> RUF100_2.py:1:19 | 1 | import itertools # noqa: F401 | ^^^^^^^^^^^^ diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_3.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_3.snap index 12a1bfa1b3..2ca4b4eb74 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_3.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_3.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs --- -error[RUF100]: RUF100_3.py:1:1: [*] Unused blanket `noqa` directive +error[RUF100]: 1:1: [*] Unused blanket `noqa` directive + --> RUF100_3.py:1:1 | 1 | # noqa | ^^^^^^ @@ -16,8 +17,9 @@ error[RUF100]: RUF100_3.py:1:1: [*] Unused blanket `noqa` directive 3 2 | print() # noqa 4 3 | print() # noqa # comment -error[RUF100]: RUF100_3.py:2:1: [*] Unused blanket `noqa` directive +error[RUF100]: 2:1: [*] Unused blanket `noqa` directive + --> RUF100_3.py:1:7 | 1 | # noqa 2 | # noqa # comment @@ -34,8 +36,9 @@ error[RUF100]: RUF100_3.py:2:1: [*] Unused blanket `noqa` directive 4 4 | print() # noqa # comment 5 5 | print() # noqa # comment -error[RUF100]: RUF100_3.py:3:10: [*] Unused blanket `noqa` directive +error[RUF100]: 3:10: [*] Unused blanket `noqa` directive + --> RUF100_3.py:3:10 | 1 | # noqa 2 | # noqa # comment @@ -54,8 +57,9 @@ error[RUF100]: RUF100_3.py:3:10: [*] Unused blanket `noqa` directive 5 5 | print() # noqa # comment 6 6 | print() # noqa comment -error[RUF100]: RUF100_3.py:4:10: [*] Unused blanket `noqa` directive +error[RUF100]: 4:10: [*] Unused blanket `noqa` directive + --> RUF100_3.py:4:10 | 2 | # noqa # comment 3 | print() # noqa @@ -75,8 +79,9 @@ error[RUF100]: RUF100_3.py:4:10: [*] Unused blanket `noqa` directive 6 6 | print() # noqa comment 7 7 | print() # noqa comment -error[RUF100]: RUF100_3.py:5:10: [*] Unused blanket `noqa` directive +error[RUF100]: 5:10: [*] Unused blanket `noqa` directive + --> RUF100_3.py:5:10 | 3 | print() # noqa 4 | print() # noqa # comment @@ -96,8 +101,9 @@ error[RUF100]: RUF100_3.py:5:10: [*] Unused blanket `noqa` directive 7 7 | print() # noqa comment 8 8 | print(a) # noqa -error[RUF100]: RUF100_3.py:6:10: [*] Unused blanket `noqa` directive +error[RUF100]: 6:10: [*] Unused blanket `noqa` directive + --> RUF100_3.py:6:10 | 4 | print() # noqa # comment 5 | print() # noqa # comment @@ -117,8 +123,9 @@ error[RUF100]: RUF100_3.py:6:10: [*] Unused blanket `noqa` directive 8 8 | print(a) # noqa 9 9 | print(a) # noqa # comment -error[RUF100]: RUF100_3.py:7:10: [*] Unused blanket `noqa` directive +error[RUF100]: 7:10: [*] Unused blanket `noqa` directive + --> RUF100_3.py:7:10 | 5 | print() # noqa # comment 6 | print() # noqa comment @@ -138,8 +145,9 @@ error[RUF100]: RUF100_3.py:7:10: [*] Unused blanket `noqa` directive 9 9 | print(a) # noqa # comment 10 10 | print(a) # noqa # comment -error[RUF100]: RUF100_3.py:14:1: [*] Unused `noqa` directive (unused: `E501`, `F821`) +error[RUF100]: 14:1: [*] Unused `noqa` directive (unused: `E501`, `F821`) + --> RUF100_3.py:13:1 | 12 | print(a) # noqa comment 13 | @@ -158,8 +166,9 @@ error[RUF100]: RUF100_3.py:14:1: [*] Unused `noqa` directive (unused: `E501`, `F 16 15 | print() # noqa: E501, F821 17 16 | print() # noqa: E501, F821 # comment -error[RUF100]: RUF100_3.py:15:1: [*] Unused `noqa` directive (unused: `E501`, `F821`) +error[RUF100]: 15:1: [*] Unused `noqa` directive (unused: `E501`, `F821`) + --> RUF100_3.py:14:19 | 14 | # noqa: E501, F821 15 | # noqa: E501, F821 # comment @@ -178,8 +187,9 @@ error[RUF100]: RUF100_3.py:15:1: [*] Unused `noqa` directive (unused: `E501`, `F 17 17 | print() # noqa: E501, F821 # comment 18 18 | print() # noqa: E501, F821 # comment -error[RUF100]: RUF100_3.py:16:10: [*] Unused `noqa` directive (unused: `E501`, `F821`) +error[RUF100]: 16:10: [*] Unused `noqa` directive (unused: `E501`, `F821`) + --> RUF100_3.py:16:10 | 14 | # noqa: E501, F821 15 | # noqa: E501, F821 # comment @@ -199,8 +209,9 @@ error[RUF100]: RUF100_3.py:16:10: [*] Unused `noqa` directive (unused: `E501`, ` 18 18 | print() # noqa: E501, F821 # comment 19 19 | print() # noqa: E501, F821 comment -error[RUF100]: RUF100_3.py:17:10: [*] Unused `noqa` directive (unused: `E501`, `F821`) +error[RUF100]: 17:10: [*] Unused `noqa` directive (unused: `E501`, `F821`) + --> RUF100_3.py:17:10 | 15 | # noqa: E501, F821 # comment 16 | print() # noqa: E501, F821 @@ -220,8 +231,9 @@ error[RUF100]: RUF100_3.py:17:10: [*] Unused `noqa` directive (unused: `E501`, ` 19 19 | print() # noqa: E501, F821 comment 20 20 | print() # noqa: E501, F821 comment -error[RUF100]: RUF100_3.py:18:10: [*] Unused `noqa` directive (unused: `E501`, `F821`) +error[RUF100]: 18:10: [*] Unused `noqa` directive (unused: `E501`, `F821`) + --> RUF100_3.py:18:10 | 16 | print() # noqa: E501, F821 17 | print() # noqa: E501, F821 # comment @@ -241,8 +253,9 @@ error[RUF100]: RUF100_3.py:18:10: [*] Unused `noqa` directive (unused: `E501`, ` 20 20 | print() # noqa: E501, F821 comment 21 21 | print(a) # noqa: E501, F821 -error[RUF100]: RUF100_3.py:19:10: [*] Unused `noqa` directive (unused: `E501`, `F821`) +error[RUF100]: 19:10: [*] Unused `noqa` directive (unused: `E501`, `F821`) + --> RUF100_3.py:19:10 | 17 | print() # noqa: E501, F821 # comment 18 | print() # noqa: E501, F821 # comment @@ -262,8 +275,9 @@ error[RUF100]: RUF100_3.py:19:10: [*] Unused `noqa` directive (unused: `E501`, ` 21 21 | print(a) # noqa: E501, F821 22 22 | print(a) # noqa: E501, F821 # comment -error[RUF100]: RUF100_3.py:20:10: [*] Unused `noqa` directive (unused: `E501`, `F821`) +error[RUF100]: 20:10: [*] Unused `noqa` directive (unused: `E501`, `F821`) + --> RUF100_3.py:20:10 | 18 | print() # noqa: E501, F821 # comment 19 | print() # noqa: E501, F821 comment @@ -283,8 +297,9 @@ error[RUF100]: RUF100_3.py:20:10: [*] Unused `noqa` directive (unused: `E501`, ` 22 22 | print(a) # noqa: E501, F821 # comment 23 23 | print(a) # noqa: E501, F821 # comment -error[RUF100]: RUF100_3.py:21:11: [*] Unused `noqa` directive (unused: `E501`) +error[RUF100]: 21:11: [*] Unused `noqa` directive (unused: `E501`) + --> RUF100_3.py:21:11 | 19 | print() # noqa: E501, F821 comment 20 | print() # noqa: E501, F821 comment @@ -304,8 +319,9 @@ error[RUF100]: RUF100_3.py:21:11: [*] Unused `noqa` directive (unused: `E501`) 23 23 | print(a) # noqa: E501, F821 # comment 24 24 | print(a) # noqa: E501, F821 comment -error[RUF100]: RUF100_3.py:22:11: [*] Unused `noqa` directive (unused: `E501`) +error[RUF100]: 22:11: [*] Unused `noqa` directive (unused: `E501`) + --> RUF100_3.py:22:11 | 20 | print() # noqa: E501, F821 comment 21 | print(a) # noqa: E501, F821 @@ -325,8 +341,9 @@ error[RUF100]: RUF100_3.py:22:11: [*] Unused `noqa` directive (unused: `E501`) 24 24 | print(a) # noqa: E501, F821 comment 25 25 | print(a) # noqa: E501, F821 comment -error[RUF100]: RUF100_3.py:23:11: [*] Unused `noqa` directive (unused: `E501`) +error[RUF100]: 23:11: [*] Unused `noqa` directive (unused: `E501`) + --> RUF100_3.py:23:11 | 21 | print(a) # noqa: E501, F821 22 | print(a) # noqa: E501, F821 # comment @@ -346,8 +363,9 @@ error[RUF100]: RUF100_3.py:23:11: [*] Unused `noqa` directive (unused: `E501`) 25 25 | print(a) # noqa: E501, F821 comment 26 26 | -error[RUF100]: RUF100_3.py:24:11: [*] Unused `noqa` directive (unused: `E501`) +error[RUF100]: 24:11: [*] Unused `noqa` directive (unused: `E501`) + --> RUF100_3.py:24:11 | 22 | print(a) # noqa: E501, F821 # comment 23 | print(a) # noqa: E501, F821 # comment @@ -366,8 +384,9 @@ error[RUF100]: RUF100_3.py:24:11: [*] Unused `noqa` directive (unused: `E501`) 26 26 | 27 27 | print(a) # comment with unicode µ # noqa: E501 -error[RUF100]: RUF100_3.py:25:11: [*] Unused `noqa` directive (unused: `E501`) +error[RUF100]: 25:11: [*] Unused `noqa` directive (unused: `E501`) + --> RUF100_3.py:25:11 | 23 | print(a) # noqa: E501, F821 # comment 24 | print(a) # noqa: E501, F821 comment @@ -387,8 +406,9 @@ error[RUF100]: RUF100_3.py:25:11: [*] Unused `noqa` directive (unused: `E501`) 27 27 | print(a) # comment with unicode µ # noqa: E501 28 28 | print(a) # comment with unicode µ # noqa: E501, F821 -error[F821]: RUF100_3.py:27:7: Undefined name `a` +error[F821]: 27:7: Undefined name `a` + --> RUF100_3.py:27:7 | 25 | print(a) # noqa: E501, F821 comment 26 | @@ -396,8 +416,9 @@ error[F821]: RUF100_3.py:27:7: Undefined name `a` | ^ 28 | print(a) # comment with unicode µ # noqa: E501, F821 | -error[RUF100]: RUF100_3.py:27:39: [*] Unused `noqa` directive (unused: `E501`) +error[RUF100]: 27:39: [*] Unused `noqa` directive (unused: `E501`) + --> RUF100_3.py:27:39 | 25 | print(a) # noqa: E501, F821 comment 26 | @@ -414,8 +435,9 @@ error[RUF100]: RUF100_3.py:27:39: [*] Unused `noqa` directive (unused: `E501`) 27 |+print(a) # comment with unicode µ 28 28 | print(a) # comment with unicode µ # noqa: E501, F821 -error[RUF100]: RUF100_3.py:28:39: [*] Unused `noqa` directive (unused: `E501`) +error[RUF100]: 28:39: [*] Unused `noqa` directive (unused: `E501`) + --> RUF100_3.py:28:39 | 27 | print(a) # comment with unicode µ # noqa: E501 28 | print(a) # comment with unicode µ # noqa: E501, F821 diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_5.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_5.snap index fa68e38879..9a591379a7 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_5.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_5.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs --- -error[ERA001]: RUF100_5.py:7:5: Found commented-out code +error[ERA001]: 7:5: Found commented-out code + --> RUF100_5.py:7:5 | 5 | # "key1": 123, # noqa: ERA001 6 | # "key2": 456, # noqa @@ -20,8 +21,9 @@ error[ERA001]: RUF100_5.py:7:5: Found commented-out code 9 8 | 10 9 | -error[ERA001]: RUF100_5.py:11:1: Found commented-out code +error[ERA001]: 11:1: Found commented-out code + --> RUF100_5.py:11:1 | 11 | #import os # noqa: E501 | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -33,8 +35,9 @@ error[ERA001]: RUF100_5.py:11:1: Found commented-out code 10 10 | 11 |-#import os # noqa: E501 -error[RUF100]: RUF100_5.py:11:13: [*] Unused `noqa` directive (unused: `E501`) +error[RUF100]: 11:13: [*] Unused `noqa` directive (unused: `E501`) + --> RUF100_5.py:11:13 | 11 | #import os # noqa: E501 | ^^^^^^^^^^^^ diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruff_noqa_codes.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruff_noqa_codes.snap index f7155f266c..4aa9071e16 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruff_noqa_codes.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruff_noqa_codes.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs --- -error[F841]: ruff_noqa_codes.py:8:5: [*] Local variable `x` is assigned to but never used +error[F841]: 8:5: [*] Local variable `x` is assigned to but never used + --> ruff_noqa_codes.py:8:5 | 7 | def f(): 8 | x = 1 diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruff_noqa_invalid.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruff_noqa_invalid.snap index e37748d6c8..d5d6b9526f 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruff_noqa_invalid.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruff_noqa_invalid.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs --- -error[F401]: ruff_noqa_invalid.py:1:8: [*] `os` imported but unused +error[F401]: 1:8: [*] `os` imported but unused + --> ruff_noqa_invalid.py:1:8 | 1 | import os # ruff: noqa: F401 | ^^ @@ -14,8 +15,9 @@ error[F401]: ruff_noqa_invalid.py:1:8: [*] `os` imported but unused 3 2 | 4 3 | def f(): -error[F841]: ruff_noqa_invalid.py:5:5: [*] Local variable `x` is assigned to but never used +error[F841]: 5:5: [*] Local variable `x` is assigned to but never used + --> ruff_noqa_invalid.py:5:5 | 4 | def f(): 5 | x = 1 diff --git a/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__error-instead-of-exception_TRY400.py.snap b/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__error-instead-of-exception_TRY400.py.snap index 17acc43f67..14a4ce7825 100644 --- a/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__error-instead-of-exception_TRY400.py.snap +++ b/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__error-instead-of-exception_TRY400.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/tryceratops/mod.rs --- -error[TRY400]: TRY400.py:13:9: [*] Use `logging.exception` instead of `logging.error` +error[TRY400]: 13:9: [*] Use `logging.exception` instead of `logging.error` + --> TRY400.py:13:9 | 11 | a = 1 12 | except Exception: @@ -22,8 +23,9 @@ error[TRY400]: TRY400.py:13:9: [*] Use `logging.exception` instead of `logging.e 15 15 | if True: 16 16 | logging.error("Context message here") -error[TRY400]: TRY400.py:16:13: [*] Use `logging.exception` instead of `logging.error` +error[TRY400]: 16:13: [*] Use `logging.exception` instead of `logging.error` + --> TRY400.py:16:13 | 15 | if True: 16 | logging.error("Context message here") @@ -40,8 +42,9 @@ error[TRY400]: TRY400.py:16:13: [*] Use `logging.exception` instead of `logging. 18 18 | 19 19 | def bad(): -error[TRY400]: TRY400.py:27:9: [*] Use `logging.exception` instead of `logging.error` +error[TRY400]: 27:9: [*] Use `logging.exception` instead of `logging.error` + --> TRY400.py:27:9 | 25 | a = 1 26 | except Exception: @@ -61,8 +64,9 @@ error[TRY400]: TRY400.py:27:9: [*] Use `logging.exception` instead of `logging.e 29 29 | if True: 30 30 | logger.error("Context message here") -error[TRY400]: TRY400.py:30:13: [*] Use `logging.exception` instead of `logging.error` +error[TRY400]: 30:13: [*] Use `logging.exception` instead of `logging.error` + --> TRY400.py:30:13 | 29 | if True: 30 | logger.error("Context message here") @@ -79,8 +83,9 @@ error[TRY400]: TRY400.py:30:13: [*] Use `logging.exception` instead of `logging. 32 32 | 33 33 | def bad(): -error[TRY400]: TRY400.py:37:9: [*] Use `logging.exception` instead of `logging.error` +error[TRY400]: 37:9: [*] Use `logging.exception` instead of `logging.error` + --> TRY400.py:37:9 | 35 | a = 1 36 | except Exception: @@ -100,8 +105,9 @@ error[TRY400]: TRY400.py:37:9: [*] Use `logging.exception` instead of `logging.e 39 39 | if True: 40 40 | log.error("Context message here") -error[TRY400]: TRY400.py:40:13: [*] Use `logging.exception` instead of `logging.error` +error[TRY400]: 40:13: [*] Use `logging.exception` instead of `logging.error` + --> TRY400.py:40:13 | 39 | if True: 40 | log.error("Context message here") @@ -118,8 +124,9 @@ error[TRY400]: TRY400.py:40:13: [*] Use `logging.exception` instead of `logging. 42 42 | 43 43 | def bad(): -error[TRY400]: TRY400.py:47:9: [*] Use `logging.exception` instead of `logging.error` +error[TRY400]: 47:9: [*] Use `logging.exception` instead of `logging.error` + --> TRY400.py:47:9 | 45 | a = 1 46 | except Exception: @@ -139,8 +146,9 @@ error[TRY400]: TRY400.py:47:9: [*] Use `logging.exception` instead of `logging.e 49 49 | if True: 50 50 | self.logger.error("Context message here") -error[TRY400]: TRY400.py:50:13: [*] Use `logging.exception` instead of `logging.error` +error[TRY400]: 50:13: [*] Use `logging.exception` instead of `logging.error` + --> TRY400.py:50:13 | 49 | if True: 50 | self.logger.error("Context message here") @@ -157,8 +165,9 @@ error[TRY400]: TRY400.py:50:13: [*] Use `logging.exception` instead of `logging. 52 52 | 53 53 | def good(): -error[TRY400]: TRY400.py:100:9: [*] Use `logging.exception` instead of `logging.error` +error[TRY400]: 100:9: [*] Use `logging.exception` instead of `logging.error` + --> TRY400.py:100:9 | 98 | a = 1 99 | except Exception: @@ -178,8 +187,9 @@ error[TRY400]: TRY400.py:100:9: [*] Use `logging.exception` instead of `logging. 102 102 | if True: 103 103 | error("Context message here") -error[TRY400]: TRY400.py:103:13: [*] Use `logging.exception` instead of `logging.error` +error[TRY400]: 103:13: [*] Use `logging.exception` instead of `logging.error` + --> TRY400.py:103:13 | 102 | if True: 103 | error("Context message here") @@ -196,8 +206,9 @@ error[TRY400]: TRY400.py:103:13: [*] Use `logging.exception` instead of `logging 105 105 | 106 106 | def good(): -error[TRY400]: TRY400.py:143:13: [*] Use `logging.exception` instead of `logging.error` +error[TRY400]: 143:13: [*] Use `logging.exception` instead of `logging.error` + --> TRY400.py:143:13 | 141 | b = 2 142 | except Exception: diff --git a/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__raise-vanilla-args_TRY003.py.snap b/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__raise-vanilla-args_TRY003.py.snap index 3947d47e17..b4b4987518 100644 --- a/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__raise-vanilla-args_TRY003.py.snap +++ b/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__raise-vanilla-args_TRY003.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/tryceratops/mod.rs --- -error[TRY003]: TRY003.py:8:15: Avoid specifying long messages outside the exception class +error[TRY003]: 8:15: Avoid specifying long messages outside the exception class + --> TRY003.py:8:15 | 6 | a = 1 7 | if a == 1: @@ -11,24 +12,27 @@ error[TRY003]: TRY003.py:8:15: Avoid specifying long messages outside the except 9 | elif a == 2: 10 | raise CustomException("Short") # This is acceptable | -error[TRY003]: TRY003.py:34:15: Avoid specifying long messages outside the exception class +error[TRY003]: 34:15: Avoid specifying long messages outside the exception class + --> TRY003.py:34:15 | 32 | def bad(a): 33 | if a % 2 == 0: 34 | raise BadArgCantBeEven(f"The argument '{a}' should be even") | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -error[TRY003]: TRY003.py:39:15: Avoid specifying long messages outside the exception class +error[TRY003]: 39:15: Avoid specifying long messages outside the exception class + --> TRY003.py:39:15 | 37 | def another_bad(a): 38 | if a % 2 == 0: 39 | raise BadArgCantBeEven(f"The argument {a} should not be odd.") | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -error[TRY003]: TRY003.py:44:15: Avoid specifying long messages outside the exception class +error[TRY003]: 44:15: Avoid specifying long messages outside the exception class + --> TRY003.py:44:15 | 42 | def and_another_bad(a): 43 | if a % 2 == 0: diff --git a/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__raise-vanilla-class_TRY002.py.snap b/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__raise-vanilla-class_TRY002.py.snap index 4950b2e853..1900a9dead 100644 --- a/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__raise-vanilla-class_TRY002.py.snap +++ b/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__raise-vanilla-class_TRY002.py.snap @@ -1,40 +1,43 @@ --- source: crates/ruff_linter/src/rules/tryceratops/mod.rs --- -TRY002.py:13:15: TRY002 Create your own exception +error[TRY002]: 13:15: Create your own exception + + --> TRY002.py:13:15 | 11 | a = 1 12 | if a == 1: 13 | raise Exception("Custom message") - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ TRY002 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ 14 | 15 | b = 1 | +error[TRY002]: 17:15: Create your own exception -TRY002.py:17:15: TRY002 Create your own exception + --> TRY002.py:17:15 | 15 | b = 1 16 | if b == 1: 17 | raise Exception - | ^^^^^^^^^ TRY002 + | ^^^^^^^^^ | +error[TRY002]: 37:15: Create your own exception -TRY002.py:37:15: TRY002 Create your own exception + --> TRY002.py:37:15 | 35 | a = 1 36 | if a == 1: 37 | raise BaseException("Custom message") - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TRY002 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 38 | 39 | b = 1 | +error[TRY002]: 41:15: Create your own exception -TRY002.py:41:15: TRY002 Create your own exception + --> TRY002.py:41:15 | 39 | b = 1 40 | if b == 1: 41 | raise BaseException - | ^^^^^^^^^^^^^ TRY002 + | ^^^^^^^^^^^^^ | - - diff --git a/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__raise-within-try_TRY301.py.snap b/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__raise-within-try_TRY301.py.snap index 7417b41101..4534fe09a4 100644 --- a/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__raise-within-try_TRY301.py.snap +++ b/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__raise-within-try_TRY301.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/tryceratops/mod.rs --- -error[TRY301]: TRY301.py:14:13: Abstract `raise` to an inner function +error[TRY301]: 14:13: Abstract `raise` to an inner function + --> TRY301.py:14:13 | 12 | a = process() 13 | if not a: @@ -11,8 +12,9 @@ error[TRY301]: TRY301.py:14:13: Abstract `raise` to an inner function 15 | 16 | raise MyException(a) | -error[TRY301]: TRY301.py:16:9: Abstract `raise` to an inner function +error[TRY301]: 16:9: Abstract `raise` to an inner function + --> TRY301.py:16:9 | 14 | raise MyException(a) 15 | @@ -21,8 +23,9 @@ error[TRY301]: TRY301.py:16:9: Abstract `raise` to an inner function 17 | 18 | try: | -error[TRY301]: TRY301.py:21:17: Abstract `raise` to an inner function +error[TRY301]: 21:17: Abstract `raise` to an inner function + --> TRY301.py:21:17 | 19 | b = process() 20 | if not b: @@ -31,8 +34,9 @@ error[TRY301]: TRY301.py:21:17: Abstract `raise` to an inner function 22 | except Exception: 23 | logger.exception("something failed") | -error[TRY301]: TRY301.py:32:13: Abstract `raise` to an inner function +error[TRY301]: 32:13: Abstract `raise` to an inner function + --> TRY301.py:32:13 | 30 | a = process() 31 | if not a: @@ -41,8 +45,9 @@ error[TRY301]: TRY301.py:32:13: Abstract `raise` to an inner function 33 | 34 | raise MyException(a) | -error[TRY301]: TRY301.py:34:9: Abstract `raise` to an inner function +error[TRY301]: 34:9: Abstract `raise` to an inner function + --> TRY301.py:34:9 | 32 | raise MyException(a) 33 | @@ -51,8 +56,9 @@ error[TRY301]: TRY301.py:34:9: Abstract `raise` to an inner function 35 | 36 | try: | -error[TRY301]: TRY301.py:39:17: Abstract `raise` to an inner function +error[TRY301]: 39:17: Abstract `raise` to an inner function + --> TRY301.py:39:17 | 37 | b = process() 38 | if not b: diff --git a/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__try-consider-else_TRY300.py.snap b/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__try-consider-else_TRY300.py.snap index 0ce6a636dd..5af451c0c0 100644 --- a/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__try-consider-else_TRY300.py.snap +++ b/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__try-consider-else_TRY300.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/tryceratops/mod.rs --- -error[TRY300]: TRY300.py:20:9: Consider moving this statement to an `else` block +error[TRY300]: 20:9: Consider moving this statement to an `else` block + --> TRY300.py:20:9 | 18 | a = 1 19 | b = process() diff --git a/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__type-check-without-type-error_TRY004.py.snap b/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__type-check-without-type-error_TRY004.py.snap index 83e7fe0bf2..9d91a516a3 100644 --- a/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__type-check-without-type-error_TRY004.py.snap +++ b/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__type-check-without-type-error_TRY004.py.snap @@ -1,96 +1,108 @@ --- source: crates/ruff_linter/src/rules/tryceratops/mod.rs --- -error[TRY004]: TRY004.py:12:9: Prefer `TypeError` exception for invalid type +error[TRY004]: 12:9: Prefer `TypeError` exception for invalid type + --> TRY004.py:12:9 | 10 | pass 11 | else: 12 | raise Exception("...") # should be typeerror | ^^^^^^^^^^^^^^^^^^^^^^ | -error[TRY004]: TRY004.py:19:9: Prefer `TypeError` exception for invalid type +error[TRY004]: 19:9: Prefer `TypeError` exception for invalid type + --> TRY004.py:19:9 | 17 | pass 18 | else: 19 | raise Exception("...") # should be typeerror | ^^^^^^^^^^^^^^^^^^^^^^ | -error[TRY004]: TRY004.py:30:9: Prefer `TypeError` exception for invalid type +error[TRY004]: 30:9: Prefer `TypeError` exception for invalid type + --> TRY004.py:30:9 | 28 | pass 29 | else: 30 | raise Exception("...") # should be typeerror | ^^^^^^^^^^^^^^^^^^^^^^ | -error[TRY004]: TRY004.py:37:9: Prefer `TypeError` exception for invalid type +error[TRY004]: 37:9: Prefer `TypeError` exception for invalid type + --> TRY004.py:37:9 | 35 | pass 36 | else: 37 | raise Exception("...") # should be typeerror | ^^^^^^^^^^^^^^^^^^^^^^ | -error[TRY004]: TRY004.py:44:9: Prefer `TypeError` exception for invalid type +error[TRY004]: 44:9: Prefer `TypeError` exception for invalid type + --> TRY004.py:44:9 | 42 | pass 43 | else: 44 | raise ArithmeticError("...") # should be typeerror | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -error[TRY004]: TRY004.py:51:9: Prefer `TypeError` exception for invalid type +error[TRY004]: 51:9: Prefer `TypeError` exception for invalid type + --> TRY004.py:51:9 | 49 | pass 50 | else: 51 | raise AssertionError("...") # should be typeerror | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -error[TRY004]: TRY004.py:58:9: Prefer `TypeError` exception for invalid type +error[TRY004]: 58:9: Prefer `TypeError` exception for invalid type + --> TRY004.py:58:9 | 56 | pass 57 | else: 58 | raise AttributeError("...") # should be typeerror | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -error[TRY004]: TRY004.py:65:9: Prefer `TypeError` exception for invalid type +error[TRY004]: 65:9: Prefer `TypeError` exception for invalid type + --> TRY004.py:65:9 | 63 | pass 64 | else: 65 | raise BufferError # should be typeerror | ^^^^^^^^^^^^^^^^^ | -error[TRY004]: TRY004.py:72:9: Prefer `TypeError` exception for invalid type +error[TRY004]: 72:9: Prefer `TypeError` exception for invalid type + --> TRY004.py:72:9 | 70 | pass 71 | else: 72 | raise EOFError("...") # should be typeerror | ^^^^^^^^^^^^^^^^^^^^^ | -error[TRY004]: TRY004.py:79:9: Prefer `TypeError` exception for invalid type +error[TRY004]: 79:9: Prefer `TypeError` exception for invalid type + --> TRY004.py:79:9 | 77 | pass 78 | else: 79 | raise ImportError("...") # should be typeerror | ^^^^^^^^^^^^^^^^^^^^^^^^ | -error[TRY004]: TRY004.py:86:9: Prefer `TypeError` exception for invalid type +error[TRY004]: 86:9: Prefer `TypeError` exception for invalid type + --> TRY004.py:86:9 | 84 | pass 85 | else: 86 | raise LookupError("...") # should be typeerror | ^^^^^^^^^^^^^^^^^^^^^^^^ | -error[TRY004]: TRY004.py:95:9: Prefer `TypeError` exception for invalid type +error[TRY004]: 95:9: Prefer `TypeError` exception for invalid type + --> TRY004.py:95:9 | 93 | # should be typeerror 94 | # not multiline is on purpose for fix @@ -100,176 +112,198 @@ error[TRY004]: TRY004.py:95:9: Prefer `TypeError` exception for invalid type 97 | | ) | |_________^ | -error[TRY004]: TRY004.py:104:9: Prefer `TypeError` exception for invalid type +error[TRY004]: 104:9: Prefer `TypeError` exception for invalid type + --> TRY004.py:104:9 | 102 | pass 103 | else: 104 | raise NameError("...") # should be typeerror | ^^^^^^^^^^^^^^^^^^^^^^ | -error[TRY004]: TRY004.py:111:9: Prefer `TypeError` exception for invalid type +error[TRY004]: 111:9: Prefer `TypeError` exception for invalid type + --> TRY004.py:111:9 | 109 | pass 110 | else: 111 | raise ReferenceError("...") # should be typeerror | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -error[TRY004]: TRY004.py:118:9: Prefer `TypeError` exception for invalid type +error[TRY004]: 118:9: Prefer `TypeError` exception for invalid type + --> TRY004.py:118:9 | 116 | pass 117 | else: 118 | raise RuntimeError("...") # should be typeerror | ^^^^^^^^^^^^^^^^^^^^^^^^^ | -error[TRY004]: TRY004.py:125:9: Prefer `TypeError` exception for invalid type +error[TRY004]: 125:9: Prefer `TypeError` exception for invalid type + --> TRY004.py:125:9 | 123 | pass 124 | else: 125 | raise SyntaxError("...") # should be typeerror | ^^^^^^^^^^^^^^^^^^^^^^^^ | -error[TRY004]: TRY004.py:132:9: Prefer `TypeError` exception for invalid type +error[TRY004]: 132:9: Prefer `TypeError` exception for invalid type + --> TRY004.py:132:9 | 130 | pass 131 | else: 132 | raise SystemError("...") # should be typeerror | ^^^^^^^^^^^^^^^^^^^^^^^^ | -error[TRY004]: TRY004.py:139:9: Prefer `TypeError` exception for invalid type +error[TRY004]: 139:9: Prefer `TypeError` exception for invalid type + --> TRY004.py:139:9 | 137 | pass 138 | else: 139 | raise ValueError("...") # should be typeerror | ^^^^^^^^^^^^^^^^^^^^^^^ | -error[TRY004]: TRY004.py:146:9: Prefer `TypeError` exception for invalid type +error[TRY004]: 146:9: Prefer `TypeError` exception for invalid type + --> TRY004.py:146:9 | 144 | pass 145 | else: 146 | raise Exception("...") # should be typeerror | ^^^^^^^^^^^^^^^^^^^^^^ | -error[TRY004]: TRY004.py:153:9: Prefer `TypeError` exception for invalid type +error[TRY004]: 153:9: Prefer `TypeError` exception for invalid type + --> TRY004.py:153:9 | 151 | pass 152 | else: 153 | raise Exception("...") # should be typeerror | ^^^^^^^^^^^^^^^^^^^^^^ | -error[TRY004]: TRY004.py:160:9: Prefer `TypeError` exception for invalid type +error[TRY004]: 160:9: Prefer `TypeError` exception for invalid type + --> TRY004.py:160:9 | 158 | pass 159 | else: 160 | raise Exception("...") # should be typeerror | ^^^^^^^^^^^^^^^^^^^^^^ | -error[TRY004]: TRY004.py:167:9: Prefer `TypeError` exception for invalid type +error[TRY004]: 167:9: Prefer `TypeError` exception for invalid type + --> TRY004.py:167:9 | 165 | pass 166 | else: 167 | raise Exception("...") # should be typeerror | ^^^^^^^^^^^^^^^^^^^^^^ | -error[TRY004]: TRY004.py:174:9: Prefer `TypeError` exception for invalid type +error[TRY004]: 174:9: Prefer `TypeError` exception for invalid type + --> TRY004.py:174:9 | 172 | pass 173 | else: 174 | raise Exception("...") # should be typeerror | ^^^^^^^^^^^^^^^^^^^^^^ | -error[TRY004]: TRY004.py:181:9: Prefer `TypeError` exception for invalid type +error[TRY004]: 181:9: Prefer `TypeError` exception for invalid type + --> TRY004.py:181:9 | 179 | pass 180 | else: 181 | raise Exception("...") # should be typeerror | ^^^^^^^^^^^^^^^^^^^^^^ | -error[TRY004]: TRY004.py:188:9: Prefer `TypeError` exception for invalid type +error[TRY004]: 188:9: Prefer `TypeError` exception for invalid type + --> TRY004.py:188:9 | 186 | pass 187 | else: 188 | raise Exception("...") # should be typeerror | ^^^^^^^^^^^^^^^^^^^^^^ | -error[TRY004]: TRY004.py:195:9: Prefer `TypeError` exception for invalid type +error[TRY004]: 195:9: Prefer `TypeError` exception for invalid type + --> TRY004.py:195:9 | 193 | pass 194 | else: 195 | raise Exception("...") # should be typeerror | ^^^^^^^^^^^^^^^^^^^^^^ | -error[TRY004]: TRY004.py:202:9: Prefer `TypeError` exception for invalid type +error[TRY004]: 202:9: Prefer `TypeError` exception for invalid type + --> TRY004.py:202:9 | 200 | pass 201 | else: 202 | raise Exception("...") # should be typeerror | ^^^^^^^^^^^^^^^^^^^^^^ | -error[TRY004]: TRY004.py:209:9: Prefer `TypeError` exception for invalid type +error[TRY004]: 209:9: Prefer `TypeError` exception for invalid type + --> TRY004.py:209:9 | 207 | pass 208 | else: 209 | raise Exception("...") # should be typeerror | ^^^^^^^^^^^^^^^^^^^^^^ | -error[TRY004]: TRY004.py:216:9: Prefer `TypeError` exception for invalid type +error[TRY004]: 216:9: Prefer `TypeError` exception for invalid type + --> TRY004.py:216:9 | 214 | pass 215 | else: 216 | raise Exception("...") # should be typeerror | ^^^^^^^^^^^^^^^^^^^^^^ | -error[TRY004]: TRY004.py:223:9: Prefer `TypeError` exception for invalid type +error[TRY004]: 223:9: Prefer `TypeError` exception for invalid type + --> TRY004.py:223:9 | 221 | pass 222 | else: 223 | raise Exception("...") # should be typeerror | ^^^^^^^^^^^^^^^^^^^^^^ | -error[TRY004]: TRY004.py:230:9: Prefer `TypeError` exception for invalid type +error[TRY004]: 230:9: Prefer `TypeError` exception for invalid type + --> TRY004.py:230:9 | 228 | pass 229 | elif isinstance(arg2, int): 230 | raise Exception("...") # should be typeerror | ^^^^^^^^^^^^^^^^^^^^^^ | -error[TRY004]: TRY004.py:239:9: Prefer `TypeError` exception for invalid type +error[TRY004]: 239:9: Prefer `TypeError` exception for invalid type + --> TRY004.py:239:9 | 237 | pass 238 | else: 239 | raise Exception("...") # should be typeerror | ^^^^^^^^^^^^^^^^^^^^^^ | -error[TRY004]: TRY004.py:276:9: Prefer `TypeError` exception for invalid type +error[TRY004]: 276:9: Prefer `TypeError` exception for invalid type + --> TRY004.py:276:9 | 274 | def check_body(some_args): 275 | if isinstance(some_args, int): 276 | raise ValueError("...") # should be typeerror | ^^^^^^^^^^^^^^^^^^^^^^^ | -error[TRY004]: TRY004.py:286:9: Prefer `TypeError` exception for invalid type +error[TRY004]: 286:9: Prefer `TypeError` exception for invalid type + --> TRY004.py:286:9 | 284 | def multiple_elifs(some_args): 285 | if not isinstance(some_args, int): @@ -278,8 +312,9 @@ error[TRY004]: TRY004.py:286:9: Prefer `TypeError` exception for invalid type 287 | elif some_args < 3: 288 | raise ValueError("...") # this is ok | -error[TRY004]: TRY004.py:297:9: Prefer `TypeError` exception for invalid type +error[TRY004]: 297:9: Prefer `TypeError` exception for invalid type + --> TRY004.py:297:9 | 295 | def multiple_ifs(some_args): 296 | if not isinstance(some_args, int): @@ -288,8 +323,9 @@ error[TRY004]: TRY004.py:297:9: Prefer `TypeError` exception for invalid type 298 | else: 299 | if some_args < 3: | -error[TRY004]: TRY004.py:316:9: Prefer `TypeError` exception for invalid type +error[TRY004]: 316:9: Prefer `TypeError` exception for invalid type + --> TRY004.py:316:9 | 314 | return "CronExpression" 315 | else: diff --git a/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__useless-try-except_TRY302.py.snap b/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__useless-try-except_TRY302.py.snap index c7377047ef..38b587839e 100644 --- a/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__useless-try-except_TRY302.py.snap +++ b/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__useless-try-except_TRY302.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/tryceratops/mod.rs --- -error[TRY302]: TRY302.py:12:5: Remove exception handler; error is immediately re-raised +error[TRY302]: 12:5: Remove exception handler; error is immediately re-raised + --> TRY302.py:12:5 | 10 | try: 11 | process() @@ -13,8 +14,9 @@ error[TRY302]: TRY302.py:12:5: Remove exception handler; error is immediately re 14 | 15 | def bad(): | -error[TRY302]: TRY302.py:18:5: Remove exception handler; error is immediately re-raised +error[TRY302]: 18:5: Remove exception handler; error is immediately re-raised + --> TRY302.py:18:5 | 16 | try: 17 | process() @@ -26,8 +28,9 @@ error[TRY302]: TRY302.py:18:5: Remove exception handler; error is immediately re 21 | 22 | def bad(): | -error[TRY302]: TRY302.py:25:5: Remove exception handler; error is immediately re-raised +error[TRY302]: 25:5: Remove exception handler; error is immediately re-raised + --> TRY302.py:25:5 | 23 | try: 24 | process() @@ -39,8 +42,9 @@ error[TRY302]: TRY302.py:25:5: Remove exception handler; error is immediately re 28 | 29 | def bad(): | -error[TRY302]: TRY302.py:32:5: Remove exception handler; error is immediately re-raised +error[TRY302]: 32:5: Remove exception handler; error is immediately re-raised + --> TRY302.py:32:5 | 30 | try: 31 | process() @@ -51,8 +55,9 @@ error[TRY302]: TRY302.py:32:5: Remove exception handler; error is immediately re 34 | 35 | def bad(): | -error[TRY302]: TRY302.py:38:5: Remove exception handler; error is immediately re-raised +error[TRY302]: 38:5: Remove exception handler; error is immediately re-raised + --> TRY302.py:38:5 | 36 | try: 37 | process() @@ -63,8 +68,9 @@ error[TRY302]: TRY302.py:38:5: Remove exception handler; error is immediately re 40 | 41 | def bad(): | -error[TRY302]: TRY302.py:44:5: Remove exception handler; error is immediately re-raised +error[TRY302]: 44:5: Remove exception handler; error is immediately re-raised + --> TRY302.py:44:5 | 42 | try: 43 | process() @@ -75,8 +81,9 @@ error[TRY302]: TRY302.py:44:5: Remove exception handler; error is immediately re 46 | 47 | def bad(): | -error[TRY302]: TRY302.py:50:5: Remove exception handler; error is immediately re-raised +error[TRY302]: 50:5: Remove exception handler; error is immediately re-raised + --> TRY302.py:50:5 | 48 | try: 49 | process() @@ -87,8 +94,9 @@ error[TRY302]: TRY302.py:50:5: Remove exception handler; error is immediately re 52 | except Exception: 53 | raise | -error[TRY302]: TRY302.py:52:5: Remove exception handler; error is immediately re-raised +error[TRY302]: 52:5: Remove exception handler; error is immediately re-raised + --> TRY302.py:52:5 | 50 | except MyException: 51 | raise @@ -99,8 +107,9 @@ error[TRY302]: TRY302.py:52:5: Remove exception handler; error is immediately re 54 | 55 | def bad(): | -error[TRY302]: TRY302.py:58:5: Remove exception handler; error is immediately re-raised +error[TRY302]: 58:5: Remove exception handler; error is immediately re-raised + --> TRY302.py:58:5 | 56 | try: 57 | process() @@ -111,8 +120,9 @@ error[TRY302]: TRY302.py:58:5: Remove exception handler; error is immediately re 60 | except Exception as e: 61 | raise e | -error[TRY302]: TRY302.py:60:5: Remove exception handler; error is immediately re-raised +error[TRY302]: 60:5: Remove exception handler; error is immediately re-raised + --> TRY302.py:60:5 | 58 | except MyException as e: 59 | raise e @@ -123,8 +133,9 @@ error[TRY302]: TRY302.py:60:5: Remove exception handler; error is immediately re 62 | 63 | def bad(): | -error[TRY302]: TRY302.py:66:5: Remove exception handler; error is immediately re-raised +error[TRY302]: 66:5: Remove exception handler; error is immediately re-raised + --> TRY302.py:66:5 | 64 | try: 65 | process() @@ -135,8 +146,9 @@ error[TRY302]: TRY302.py:66:5: Remove exception handler; error is immediately re 68 | except Exception as e: 69 | raise e | -error[TRY302]: TRY302.py:68:5: Remove exception handler; error is immediately re-raised +error[TRY302]: 68:5: Remove exception handler; error is immediately re-raised + --> TRY302.py:68:5 | 66 | except MyException as ex: 67 | raise ex diff --git a/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__verbose-log-message_TRY401.py.snap b/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__verbose-log-message_TRY401.py.snap index fbdc335c81..ff5c3b970a 100644 --- a/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__verbose-log-message_TRY401.py.snap +++ b/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__verbose-log-message_TRY401.py.snap @@ -1,16 +1,18 @@ --- source: crates/ruff_linter/src/rules/tryceratops/mod.rs --- -error[TRY401]: TRY401.py:8:45: Redundant exception object included in `logging.exception` call +error[TRY401]: 8:45: Redundant exception object included in `logging.exception` call + --> TRY401.py:8:45 | 6 | finish() 7 | except Exception as ex: 8 | logger.exception(f"Found an error: {ex}") # TRY401 | ^^ | -error[TRY401]: TRY401.py:19:53: Redundant exception object included in `logging.exception` call +error[TRY401]: 19:53: Redundant exception object included in `logging.exception` call + --> TRY401.py:19:53 | 17 | if True is False: 18 | for i in range(10): @@ -19,8 +21,9 @@ error[TRY401]: TRY401.py:19:53: Redundant exception object included in `logging. 20 | except IndexError as bad: 21 | logger.exception(f"Found an error: {bad} {bad}") # TRY401 | -error[TRY401]: TRY401.py:21:45: Redundant exception object included in `logging.exception` call +error[TRY401]: 21:45: Redundant exception object included in `logging.exception` call + --> TRY401.py:21:45 | 19 | logger.exception(f"Found an error: {bad} {good}") # TRY401 20 | except IndexError as bad: @@ -29,8 +32,9 @@ error[TRY401]: TRY401.py:21:45: Redundant exception object included in `logging. 22 | except Exception as bad: 23 | logger.exception(f"Found an error: {bad}") # TRY401 | -error[TRY401]: TRY401.py:21:51: Redundant exception object included in `logging.exception` call +error[TRY401]: 21:51: Redundant exception object included in `logging.exception` call + --> TRY401.py:21:51 | 19 | logger.exception(f"Found an error: {bad} {good}") # TRY401 20 | except IndexError as bad: @@ -39,8 +43,9 @@ error[TRY401]: TRY401.py:21:51: Redundant exception object included in `logging. 22 | except Exception as bad: 23 | logger.exception(f"Found an error: {bad}") # TRY401 | -error[TRY401]: TRY401.py:23:45: Redundant exception object included in `logging.exception` call +error[TRY401]: 23:45: Redundant exception object included in `logging.exception` call + --> TRY401.py:23:45 | 21 | logger.exception(f"Found an error: {bad} {bad}") # TRY401 22 | except Exception as bad: @@ -48,8 +53,9 @@ error[TRY401]: TRY401.py:23:45: Redundant exception object included in `logging. | ^^^ 24 | logger.exception(f"Found an error: {bad}") # TRY401 | -error[TRY401]: TRY401.py:24:45: Redundant exception object included in `logging.exception` call +error[TRY401]: 24:45: Redundant exception object included in `logging.exception` call + --> TRY401.py:24:45 | 22 | except Exception as bad: 23 | logger.exception(f"Found an error: {bad}") # TRY401 @@ -58,47 +64,53 @@ error[TRY401]: TRY401.py:24:45: Redundant exception object included in `logging. 25 | 26 | if True: | -error[TRY401]: TRY401.py:27:49: Redundant exception object included in `logging.exception` call +error[TRY401]: 27:49: Redundant exception object included in `logging.exception` call + --> TRY401.py:27:49 | 26 | if True: 27 | logger.exception(f"Found an error: {bad}") # TRY401 | ^^^ | -error[TRY401]: TRY401.py:39:47: Redundant exception object included in `logging.exception` call +error[TRY401]: 39:47: Redundant exception object included in `logging.exception` call + --> TRY401.py:39:47 | 37 | ... 38 | except Exception as ex: 39 | logger.exception(f"Logging an error: {ex}") # TRY401 | ^^ | -error[TRY401]: TRY401.py:46:53: Redundant exception object included in `logging.exception` call +error[TRY401]: 46:53: Redundant exception object included in `logging.exception` call + --> TRY401.py:46:53 | 44 | ... 45 | except Exception as ex: 46 | logger.exception("Logging an error: " + str(ex)) # TRY401 | ^^ | -error[TRY401]: TRY401.py:53:47: Redundant exception object included in `logging.exception` call +error[TRY401]: 53:47: Redundant exception object included in `logging.exception` call + --> TRY401.py:53:47 | 51 | ... 52 | except Exception as ex: 53 | logger.exception("Logging an error:", ex) # TRY401 | ^^ | -error[TRY401]: TRY401.py:77:38: Redundant exception object included in `logging.exception` call +error[TRY401]: 77:38: Redundant exception object included in `logging.exception` call + --> TRY401.py:77:38 | 75 | finish() 76 | except Exception as ex: 77 | exception(f"Found an error: {ex}") # TRY401 | ^^ | -error[TRY401]: TRY401.py:88:46: Redundant exception object included in `logging.exception` call +error[TRY401]: 88:46: Redundant exception object included in `logging.exception` call + --> TRY401.py:88:46 | 86 | if True is False: 87 | for i in range(10): @@ -107,8 +119,9 @@ error[TRY401]: TRY401.py:88:46: Redundant exception object included in `logging. 89 | except IndexError as bad: 90 | exception(f"Found an error: {bad} {bad}") # TRY401 | -error[TRY401]: TRY401.py:90:38: Redundant exception object included in `logging.exception` call +error[TRY401]: 90:38: Redundant exception object included in `logging.exception` call + --> TRY401.py:90:38 | 88 | exception(f"Found an error: {bad} {good}") # TRY401 89 | except IndexError as bad: @@ -117,8 +130,9 @@ error[TRY401]: TRY401.py:90:38: Redundant exception object included in `logging. 91 | except Exception as bad: 92 | exception(f"Found an error: {bad}") # TRY401 | -error[TRY401]: TRY401.py:90:44: Redundant exception object included in `logging.exception` call +error[TRY401]: 90:44: Redundant exception object included in `logging.exception` call + --> TRY401.py:90:44 | 88 | exception(f"Found an error: {bad} {good}") # TRY401 89 | except IndexError as bad: @@ -127,8 +141,9 @@ error[TRY401]: TRY401.py:90:44: Redundant exception object included in `logging. 91 | except Exception as bad: 92 | exception(f"Found an error: {bad}") # TRY401 | -error[TRY401]: TRY401.py:92:38: Redundant exception object included in `logging.exception` call +error[TRY401]: 92:38: Redundant exception object included in `logging.exception` call + --> TRY401.py:92:38 | 90 | exception(f"Found an error: {bad} {bad}") # TRY401 91 | except Exception as bad: @@ -136,8 +151,9 @@ error[TRY401]: TRY401.py:92:38: Redundant exception object included in `logging. | ^^^ 93 | exception(f"Found an error: {bad}") # TRY401 | -error[TRY401]: TRY401.py:93:38: Redundant exception object included in `logging.exception` call +error[TRY401]: 93:38: Redundant exception object included in `logging.exception` call + --> TRY401.py:93:38 | 91 | except Exception as bad: 92 | exception(f"Found an error: {bad}") # TRY401 @@ -146,47 +162,53 @@ error[TRY401]: TRY401.py:93:38: Redundant exception object included in `logging. 94 | 95 | if True: | -error[TRY401]: TRY401.py:96:42: Redundant exception object included in `logging.exception` call +error[TRY401]: 96:42: Redundant exception object included in `logging.exception` call + --> TRY401.py:96:42 | 95 | if True: 96 | exception(f"Found an error: {bad}") # TRY401 | ^^^ | -error[TRY401]: TRY401.py:103:40: Redundant exception object included in `logging.exception` call +error[TRY401]: 103:40: Redundant exception object included in `logging.exception` call + --> TRY401.py:103:40 | 101 | ... 102 | except Exception as ex: 103 | exception(f"Logging an error: {ex}") # TRY401 | ^^ | -error[TRY401]: TRY401.py:110:46: Redundant exception object included in `logging.exception` call +error[TRY401]: 110:46: Redundant exception object included in `logging.exception` call + --> TRY401.py:110:46 | 108 | ... 109 | except Exception as ex: 110 | exception("Logging an error: " + str(ex)) # TRY401 | ^^ | -error[TRY401]: TRY401.py:117:40: Redundant exception object included in `logging.exception` call +error[TRY401]: 117:40: Redundant exception object included in `logging.exception` call + --> TRY401.py:117:40 | 115 | ... 116 | except Exception as ex: 117 | exception("Logging an error:", ex) # TRY401 | ^^ | -error[TRY401]: TRY401.py:139:49: Redundant exception object included in `logging.exception` call +error[TRY401]: 139:49: Redundant exception object included in `logging.exception` call + --> TRY401.py:139:49 | 137 | finish() 138 | except Exception as ex: 139 | logger.exception(f"Found an error: {ex}") # TRY401 | ^^ | -error[TRY401]: TRY401.py:150:49: Redundant exception object included in `logging.exception` call +error[TRY401]: 150:49: Redundant exception object included in `logging.exception` call + --> TRY401.py:150:49 | 148 | finish() 149 | except Exception: diff --git a/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__verbose-raise_TRY201.py.snap b/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__verbose-raise_TRY201.py.snap index 95d1fb15f8..0d0ce3c629 100644 --- a/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__verbose-raise_TRY201.py.snap +++ b/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__verbose-raise_TRY201.py.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/rules/tryceratops/mod.rs --- -error[TRY201]: TRY201.py:20:15: [*] Use `raise` without specifying exception name +error[TRY201]: 20:15: [*] Use `raise` without specifying exception name + --> TRY201.py:20:15 | 18 | except MyException as e: 19 | logger.exception("process failed") @@ -20,8 +21,9 @@ error[TRY201]: TRY201.py:20:15: [*] Use `raise` without specifying exception nam 22 22 | 23 23 | def good(): -error[TRY201]: TRY201.py:63:19: [*] Use `raise` without specifying exception name +error[TRY201]: 63:19: [*] Use `raise` without specifying exception name + --> TRY201.py:63:19 | 61 | logger.exception("process failed") 62 | if True: @@ -39,8 +41,9 @@ error[TRY201]: TRY201.py:63:19: [*] Use `raise` without specifying exception nam 65 65 | 66 66 | def bad_that_needs_recursion_2(): -error[TRY201]: TRY201.py:74:23: [*] Use `raise` without specifying exception name +error[TRY201]: 74:23: [*] Use `raise` without specifying exception name + --> TRY201.py:74:23 | 73 | def foo(): 74 | raise e diff --git a/crates/ruff_linter/src/snapshots/ruff_linter__linter__tests__import_sorting.snap b/crates/ruff_linter/src/snapshots/ruff_linter__linter__tests__import_sorting.snap index 77be3335d7..d4c4c6b120 100644 --- a/crates/ruff_linter/src/snapshots/ruff_linter__linter__tests__import_sorting.snap +++ b/crates/ruff_linter/src/snapshots/ruff_linter__linter__tests__import_sorting.snap @@ -1,14 +1,15 @@ --- source: crates/ruff_linter/src/linter.rs --- -error[I001]: isort.ipynb:cell 1:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: cell 1:1:1: [*] Import block is un-sorted or un-formatted + --> isort.ipynb:1:1 | 1 | / from pathlib import Path 2 | | import random 3 | | import math -4 | | from typing import Any - | |_^ + | |____________^ +4 | from typing import Any 5 | import collections 6 | # Newline should be added here | @@ -23,13 +24,14 @@ error[I001]: isort.ipynb:cell 1:1:1: [*] Import block is un-sorted or un-formatt 5 5 | import collections 6 6 | # Newline should be added here -error[I001]: isort.ipynb:cell 2:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: cell 2:1:1: [*] Import block is un-sorted or un-formatted + --> isort.ipynb:1:1 | 1 | / from typing import Any 2 | | import collections -3 | | # Newline should be added here - | |_^ + | |___________________^ +3 | # Newline should be added here 4 | def foo(): 5 | pass | @@ -47,14 +49,15 @@ error[I001]: isort.ipynb:cell 2:1:1: [*] Import block is un-sorted or un-formatt 7 9 | def foo(): 8 10 | pass -error[I001]: isort.ipynb:cell 3:1:1: [*] Import block is un-sorted or un-formatted +error[I001]: cell 3:1:1: [*] Import block is un-sorted or un-formatted + --> isort.ipynb:1:1 | 1 | / from pathlib import Path 2 | | import sys 3 | | -4 | | %matplotlib \ - | |_^ + | |__^ +4 | %matplotlib \ 5 | --inline | = help: Organize imports @@ -69,13 +72,15 @@ error[I001]: isort.ipynb:cell 3:1:1: [*] Import block is un-sorted or un-formatt 12 12 | %matplotlib \ 13 13 | --inline -error[I001]: isort.ipynb:cell 3:7:1: [*] Import block is un-sorted or un-formatted +error[I001]: cell 3:7:1: [*] Import block is un-sorted or un-formatted + --> isort.ipynb:6:1 | 5 | --inline 6 | 7 | / import math 8 | | import abc + | |___________^ | = help: Organize imports ℹ Safe fix diff --git a/crates/ruff_linter/src/snapshots/ruff_linter__linter__tests__ipy_escape_command.snap b/crates/ruff_linter/src/snapshots/ruff_linter__linter__tests__ipy_escape_command.snap index e09ebd7537..6c852e83b2 100644 --- a/crates/ruff_linter/src/snapshots/ruff_linter__linter__tests__ipy_escape_command.snap +++ b/crates/ruff_linter/src/snapshots/ruff_linter__linter__tests__ipy_escape_command.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/linter.rs --- -error[F401]: ipy_escape_command.ipynb:cell 1:5:8: [*] `os` imported but unused +error[F401]: cell 1:5:8: [*] `os` imported but unused + --> ipy_escape_command.ipynb:5:8 | 3 | %matplotlib inline 4 | @@ -21,8 +22,9 @@ error[F401]: ipy_escape_command.ipynb:cell 1:5:8: [*] `os` imported but unused 7 6 | _ = math.pi 8 7 | %%timeit -error[F401]: ipy_escape_command.ipynb:cell 2:2:8: [*] `sys` imported but unused +error[F401]: cell 2:2:8: [*] `sys` imported but unused + --> ipy_escape_command.ipynb:2:8 | 1 | %%timeit 2 | import sys diff --git a/crates/ruff_linter/src/snapshots/ruff_linter__linter__tests__undefined_name.snap b/crates/ruff_linter/src/snapshots/ruff_linter__linter__tests__undefined_name.snap index 583e71ef10..dbf846f86d 100644 --- a/crates/ruff_linter/src/snapshots/ruff_linter__linter__tests__undefined_name.snap +++ b/crates/ruff_linter/src/snapshots/ruff_linter__linter__tests__undefined_name.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/linter.rs --- -error[F821]: undefined_name.ipynb:cell 3:1:7: Undefined name `undefined` +error[F821]: cell 3:1:7: Undefined name `undefined` + --> undefined_name.ipynb:1:7 | 1 | print(undefined) | ^^^^^^^^^ diff --git a/crates/ruff_linter/src/snapshots/ruff_linter__linter__tests__unused_variable.snap b/crates/ruff_linter/src/snapshots/ruff_linter__linter__tests__unused_variable.snap index b5557c77ae..f94d4678fe 100644 --- a/crates/ruff_linter/src/snapshots/ruff_linter__linter__tests__unused_variable.snap +++ b/crates/ruff_linter/src/snapshots/ruff_linter__linter__tests__unused_variable.snap @@ -1,8 +1,9 @@ --- source: crates/ruff_linter/src/linter.rs --- -error[F841]: unused_variable.ipynb:cell 1:2:5: [*] Local variable `foo1` is assigned to but never used +error[F841]: cell 1:2:5: [*] Local variable `foo1` is assigned to but never used + --> unused_variable.ipynb:2:5 | 1 | def f(): 2 | foo1 = %matplotlib --list @@ -18,8 +19,9 @@ error[F841]: unused_variable.ipynb:cell 1:2:5: [*] Local variable `foo1` is assi 4 4 | def f(): 5 5 | bar1 = !pwd -error[F841]: unused_variable.ipynb:cell 1:3:5: [*] Local variable `foo2` is assigned to but never used +error[F841]: cell 1:3:5: [*] Local variable `foo2` is assigned to but never used + --> unused_variable.ipynb:3:5 | 1 | def f(): 2 | foo1 = %matplotlib --list @@ -36,8 +38,9 @@ error[F841]: unused_variable.ipynb:cell 1:3:5: [*] Local variable `foo2` is assi 5 5 | bar1 = !pwd 6 6 | bar2: str = !pwd -error[F841]: unused_variable.ipynb:cell 2:2:5: [*] Local variable `bar1` is assigned to but never used +error[F841]: cell 2:2:5: [*] Local variable `bar1` is assigned to but never used + --> unused_variable.ipynb:2:5 | 1 | def f(): 2 | bar1 = !pwd @@ -53,8 +56,9 @@ error[F841]: unused_variable.ipynb:cell 2:2:5: [*] Local variable `bar1` is assi 5 |+ !pwd 6 6 | bar2: str = !pwd -error[F841]: unused_variable.ipynb:cell 2:3:5: [*] Local variable `bar2` is assigned to but never used +error[F841]: cell 2:3:5: [*] Local variable `bar2` is assigned to but never used + --> unused_variable.ipynb:3:5 | 1 | def f(): 2 | bar1 = !pwd diff --git a/crates/ruff_linter/src/snapshots/ruff_linter__linter__tests__vscode_language_id.snap b/crates/ruff_linter/src/snapshots/ruff_linter__linter__tests__vscode_language_id.snap index d89e58dc78..ed00e9504e 100644 --- a/crates/ruff_linter/src/snapshots/ruff_linter__linter__tests__vscode_language_id.snap +++ b/crates/ruff_linter/src/snapshots/ruff_linter__linter__tests__vscode_language_id.snap @@ -1,15 +1,16 @@ --- source: crates/ruff_linter/src/linter.rs --- -vscode_language_id.ipynb:cell 3:1:8: F401 [*] `os` imported but unused +error[F401]: cell 3:1:8: [*] `os` imported but unused + + --> vscode_language_id.ipynb:1:8 | 1 | import os - | ^^ F401 + | ^^ 2 | 3 | print("hello world") | = help: Remove unused import: `os` - ℹ Safe fix 1 |-import os 2 1 |