diff --git a/crates/ruff_linter/resources/test/fixtures/flake8_commas/COM81.py b/crates/ruff_linter/resources/test/fixtures/flake8_commas/COM81.py index 5d926c0b5880f..833c74ab0d999 100644 --- a/crates/ruff_linter/resources/test/fixtures/flake8_commas/COM81.py +++ b/crates/ruff_linter/resources/test/fixtures/flake8_commas/COM81.py @@ -510,7 +510,7 @@ def bah(ham, spam, ): image[:,:,] -lambda x, : +lambda x, : x # ==> unpack.py <== def function( 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 3a23eb602a2d6..33a9285a05509 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 @@ -601,7 +601,7 @@ COM81.py:511:10: COM819 [*] Trailing comma prohibited 511 | image[:,:,] | ^ COM819 512 | -513 | lambda x, : +513 | lambda x, : x | = help: Remove trailing comma @@ -612,14 +612,14 @@ COM81.py:511:10: COM819 [*] Trailing comma prohibited 511 |-image[:,:,] 511 |+image[:,:] 512 512 | -513 513 | lambda x, : +513 513 | lambda x, : x 514 514 | COM81.py:513:9: COM819 [*] Trailing comma prohibited | 511 | image[:,:,] 512 | -513 | lambda x, : +513 | lambda x, : x | ^ COM819 514 | 515 | # ==> unpack.py <== @@ -630,8 +630,8 @@ COM81.py:513:9: COM819 [*] Trailing comma prohibited 510 510 | 511 511 | image[:,:,] 512 512 | -513 |-lambda x, : - 513 |+lambda x : +513 |-lambda x, : x + 513 |+lambda x : x 514 514 | 515 515 | # ==> unpack.py <== 516 516 | def function( @@ -798,6 +798,14 @@ COM81.py:565:13: COM812 [*] Trailing comma missing 567 567 | 568 568 | ( +COM81.py:569:5: E999 SyntaxError: Starred expression cannot be used here + | +568 | ( +569 | *args + | ^ E999 +570 | ) + | + COM81.py:573:10: COM812 [*] Trailing comma missing | 572 | { 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 5ff96325eeb6b..dbeb2a68a9682 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 @@ -21,4 +21,42 @@ E11.py:6:1: E111 Indentation is not a multiple of 4 8 | if False: | +E11.py:9:1: E999 SyntaxError: Expected an indented block after `if` statement + | + 7 | #: E112 + 8 | if False: + 9 | print() + | ^ E999 +10 | #: E113 +11 | print() + | +E11.py:12:1: E999 SyntaxError: Unexpected indentation + | +10 | #: E113 +11 | print() +12 | print() + | ^ E999 +13 | #: E114 E116 +14 | mimetype = 'application/x-directory' + | + +E11.py:14:1: E999 SyntaxError: Expected a statement + | +12 | print() +13 | #: E114 E116 +14 | mimetype = 'application/x-directory' + | ^ E999 +15 | # 'httpd/unix-directory' +16 | create_date = False + | + +E11.py:45:1: E999 SyntaxError: Expected an indented block after `if` statement + | +43 | #: E112 +44 | if False: # +45 | print() + | ^ E999 +46 | #: +47 | 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 ea4f5346a8c89..0c573ea76e4a3 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 @@ -11,6 +11,36 @@ E11.py:9:1: E112 Expected an indented block 11 | print() | +E11.py:9:1: E999 SyntaxError: Expected an indented block after `if` statement + | + 7 | #: E112 + 8 | if False: + 9 | print() + | ^ E999 +10 | #: E113 +11 | print() + | + +E11.py:12:1: E999 SyntaxError: Unexpected indentation + | +10 | #: E113 +11 | print() +12 | print() + | ^ E999 +13 | #: E114 E116 +14 | mimetype = 'application/x-directory' + | + +E11.py:14:1: E999 SyntaxError: Expected a statement + | +12 | print() +13 | #: E114 E116 +14 | mimetype = 'application/x-directory' + | ^ E999 +15 | # 'httpd/unix-directory' +16 | create_date = False + | + E11.py:45:1: E112 Expected an indented block | 43 | #: E112 @@ -21,4 +51,12 @@ E11.py:45:1: E112 Expected an indented block 47 | if False: | - +E11.py:45:1: E999 SyntaxError: Expected an indented block after `if` statement + | +43 | #: E112 +44 | if False: # +45 | print() + | ^ E999 +46 | #: +47 | 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 fe41aac33f533..633940a73c1b5 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,6 +1,16 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- +E11.py:9:1: E999 SyntaxError: Expected an indented block after `if` statement + | + 7 | #: E112 + 8 | if False: + 9 | print() + | ^ E999 +10 | #: E113 +11 | print() + | + E11.py:12:1: E113 Unexpected indentation | 10 | #: E113 @@ -11,4 +21,32 @@ E11.py:12:1: E113 Unexpected indentation 14 | mimetype = 'application/x-directory' | +E11.py:12:1: E999 SyntaxError: Unexpected indentation + | +10 | #: E113 +11 | print() +12 | print() + | ^ E999 +13 | #: E114 E116 +14 | mimetype = 'application/x-directory' + | + +E11.py:14:1: E999 SyntaxError: Expected a statement + | +12 | print() +13 | #: E114 E116 +14 | mimetype = 'application/x-directory' + | ^ E999 +15 | # 'httpd/unix-directory' +16 | create_date = False + | +E11.py:45:1: E999 SyntaxError: Expected an indented block after `if` statement + | +43 | #: E112 +44 | if False: # +45 | print() + | ^ E999 +46 | #: +47 | 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 3fcbbc03f884b..77d2f8c795cff 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,6 +1,36 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- +E11.py:9:1: E999 SyntaxError: Expected an indented block after `if` statement + | + 7 | #: E112 + 8 | if False: + 9 | print() + | ^ E999 +10 | #: E113 +11 | print() + | + +E11.py:12:1: E999 SyntaxError: Unexpected indentation + | +10 | #: E113 +11 | print() +12 | print() + | ^ E999 +13 | #: E114 E116 +14 | mimetype = 'application/x-directory' + | + +E11.py:14:1: E999 SyntaxError: Expected a statement + | +12 | print() +13 | #: E114 E116 +14 | mimetype = 'application/x-directory' + | ^ E999 +15 | # 'httpd/unix-directory' +16 | create_date = False + | + E11.py:15:1: E114 Indentation is not a multiple of 4 (comment) | 13 | #: E114 E116 @@ -11,4 +41,12 @@ E11.py:15:1: E114 Indentation is not a multiple of 4 (comment) 17 | #: E116 E116 E116 | - +E11.py:45:1: E999 SyntaxError: Expected an indented block after `if` statement + | +43 | #: E112 +44 | if False: # +45 | print() + | ^ E999 +46 | #: +47 | 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 34e21b201ed0c..781412b9b00da 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,6 +1,36 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- +E11.py:9:1: E999 SyntaxError: Expected an indented block after `if` statement + | + 7 | #: E112 + 8 | if False: + 9 | print() + | ^ E999 +10 | #: E113 +11 | print() + | + +E11.py:12:1: E999 SyntaxError: Unexpected indentation + | +10 | #: E113 +11 | print() +12 | print() + | ^ E999 +13 | #: E114 E116 +14 | mimetype = 'application/x-directory' + | + +E11.py:14:1: E999 SyntaxError: Expected a statement + | +12 | print() +13 | #: E114 E116 +14 | mimetype = 'application/x-directory' + | ^ E999 +15 | # 'httpd/unix-directory' +16 | create_date = False + | + E11.py:30:1: E115 Expected an indented block (comment) | 28 | def start(self): @@ -61,4 +91,12 @@ E11.py:35:1: E115 Expected an indented block (comment) 37 | #: E117 | - +E11.py:45:1: E999 SyntaxError: Expected an indented block after `if` statement + | +43 | #: E112 +44 | if False: # +45 | print() + | ^ E999 +46 | #: +47 | 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 8f1a719473b12..1ddd5e9f741fb 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,6 +1,36 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- +E11.py:9:1: E999 SyntaxError: Expected an indented block after `if` statement + | + 7 | #: E112 + 8 | if False: + 9 | print() + | ^ E999 +10 | #: E113 +11 | print() + | + +E11.py:12:1: E999 SyntaxError: Unexpected indentation + | +10 | #: E113 +11 | print() +12 | print() + | ^ E999 +13 | #: E114 E116 +14 | mimetype = 'application/x-directory' + | + +E11.py:14:1: E999 SyntaxError: Expected a statement + | +12 | print() +13 | #: E114 E116 +14 | mimetype = 'application/x-directory' + | ^ E999 +15 | # 'httpd/unix-directory' +16 | create_date = False + | + E11.py:15:1: E116 Unexpected indentation (comment) | 13 | #: E114 E116 @@ -41,4 +71,12 @@ E11.py:26:1: E116 Unexpected indentation (comment) 28 | def start(self): | - +E11.py:45:1: E999 SyntaxError: Expected an indented block after `if` statement + | +43 | #: E112 +44 | if False: # +45 | print() + | ^ E999 +46 | #: +47 | 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 fc9e939039071..2d9cda2c03635 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 @@ -11,6 +11,36 @@ E11.py:6:1: E117 Over-indented 8 | if False: | +E11.py:9:1: E999 SyntaxError: Expected an indented block after `if` statement + | + 7 | #: E112 + 8 | if False: + 9 | print() + | ^ E999 +10 | #: E113 +11 | print() + | + +E11.py:12:1: E999 SyntaxError: Unexpected indentation + | +10 | #: E113 +11 | print() +12 | print() + | ^ E999 +13 | #: E114 E116 +14 | mimetype = 'application/x-directory' + | + +E11.py:14:1: E999 SyntaxError: Expected a statement + | +12 | print() +13 | #: E114 E116 +14 | mimetype = 'application/x-directory' + | ^ E999 +15 | # 'httpd/unix-directory' +16 | create_date = False + | + E11.py:39:1: E117 Over-indented | 37 | #: E117 @@ -31,4 +61,12 @@ E11.py:42:1: E117 Over-indented 44 | if False: # | - +E11.py:45:1: E999 SyntaxError: Expected an indented block after `if` statement + | +43 | #: E112 +44 | if False: # +45 | print() + | ^ E999 +46 | #: +47 | if False: + | 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 5e8fe375665fb..e2071c9282435 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 @@ -8,6 +8,22 @@ W19.py:1:1: W191 Indentation contains tabs 2 | multiline string with tab in it''' | +W19.py:1:1: E999 SyntaxError: Unexpected indentation + | +1 | '''File starts with a tab + | ^^^^ E999 +2 | multiline string with tab in it''' + | + +W19.py:5:1: E999 SyntaxError: Expected a statement + | +4 | #: W191 +5 | if False: + | ^ E999 +6 | print # indented with 1 tab +7 | #: + | + W19.py:6:1: W191 Indentation contains tabs | 4 | #: W191 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 6dcc4546f11f9..324d1e72c2cbd 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,4 +1,8 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- - +E2_syntax_error.py:1:10: E999 SyntaxError: Expected an expression + | +1 | a = (1 or) + | ^ E999 + | diff --git a/crates/ruff_linter/src/rules/pyflakes/mod.rs b/crates/ruff_linter/src/rules/pyflakes/mod.rs index a700b7ed6c498..f9c2d331f60f5 100644 --- a/crates/ruff_linter/src/rules/pyflakes/mod.rs +++ b/crates/ruff_linter/src/rules/pyflakes/mod.rs @@ -2413,7 +2413,7 @@ mod tests { fn used_in_lambda() { flakes( r"import fu; - lambda: fu +lambda: fu ", &[], ); @@ -2432,7 +2432,7 @@ mod tests { fn used_in_slice_obj() { flakes( r#"import fu; - "meow"[::fu] +"meow"[::fu] "#, &[], ); @@ -3039,16 +3039,6 @@ mod tests { &[], ); - flakes( - r#" - from interior import decorate - @decorate('value", &[]); - def f(): - return "hello" - "#, - &[], - ); - flakes( r#" @decorate