diff --git a/crates/ruff_linter/resources/test/fixtures/ruff/RUF100_0.py b/crates/ruff_linter/resources/test/fixtures/ruff/RUF100_0.py index 27af127f78..95c25c7f55 100644 --- a/crates/ruff_linter/resources/test/fixtures/ruff/RUF100_0.py +++ b/crates/ruff_linter/resources/test/fixtures/ruff/RUF100_0.py @@ -103,7 +103,7 @@ def f(): def f(): - # Invalid - nonexistant error code with multibyte character + # Invalid - nonexistent error code with multibyte character d = 1 # …noqa: F841, E50 e = 1 # …noqa: E50 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 b97e377ec4..4832895a70 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 @@ -287,7 +287,7 @@ RUF100_0.py:93:92: RUF100 [*] Unused `noqa` directive (unused: `F401`) RUF100_0.py:107:12: RUF100 [*] Unused `noqa` directive (unknown: `E50`) | 105 | def f(): -106 | # Invalid - nonexistant error code with multibyte character +106 | # Invalid - nonexistent error code with multibyte character 107 | d = 1 # …noqa: F841, E50 | ^^^^^^^^^^^^^^^^^ RUF100 108 | e = 1 # …noqa: E50 @@ -297,7 +297,7 @@ RUF100_0.py:107:12: RUF100 [*] Unused `noqa` directive (unknown: `E50`) ℹ Safe fix 104 104 | 105 105 | def f(): -106 106 | # Invalid - nonexistant error code with multibyte character +106 106 | # Invalid - nonexistent error code with multibyte character 107 |- d = 1 # …noqa: F841, E50 107 |+ d = 1 # noqa: F841 108 108 | e = 1 # …noqa: E50 @@ -306,7 +306,7 @@ RUF100_0.py:107:12: RUF100 [*] Unused `noqa` directive (unknown: `E50`) RUF100_0.py:108:5: F841 [*] Local variable `e` is assigned to but never used | -106 | # Invalid - nonexistant error code with multibyte character +106 | # Invalid - nonexistent error code with multibyte character 107 | d = 1 # …noqa: F841, E50 108 | e = 1 # …noqa: E50 | ^ F841 @@ -315,7 +315,7 @@ RUF100_0.py:108:5: F841 [*] Local variable `e` is assigned to but never used ℹ Unsafe fix 105 105 | def f(): -106 106 | # Invalid - nonexistant error code with multibyte character +106 106 | # Invalid - nonexistent error code with multibyte character 107 107 | d = 1 # …noqa: F841, E50 108 |- e = 1 # …noqa: E50 109 108 | @@ -324,7 +324,7 @@ RUF100_0.py:108:5: F841 [*] Local variable `e` is assigned to but never used RUF100_0.py:108:12: RUF100 [*] Unused `noqa` directive (unknown: `E50`) | -106 | # Invalid - nonexistant error code with multibyte character +106 | # Invalid - nonexistent error code with multibyte character 107 | d = 1 # …noqa: F841, E50 108 | e = 1 # …noqa: E50 | ^^^^^^^^^^^ RUF100 @@ -333,7 +333,7 @@ RUF100_0.py:108:12: RUF100 [*] Unused `noqa` directive (unknown: `E50`) ℹ Safe fix 105 105 | def f(): -106 106 | # Invalid - nonexistant error code with multibyte character +106 106 | # Invalid - nonexistent error code with multibyte character 107 107 | d = 1 # …noqa: F841, E50 108 |- e = 1 # …noqa: E50 108 |+ e = 1 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 679f06f196..10d49089c3 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 @@ -267,7 +267,7 @@ RUF100_0.py:93:92: RUF100 [*] Unused `noqa` directive (unused: `F401`) RUF100_0.py:107:12: RUF100 [*] Unused `noqa` directive (unknown: `E50`) | 105 | def f(): -106 | # Invalid - nonexistant error code with multibyte character +106 | # Invalid - nonexistent error code with multibyte character 107 | d = 1 # …noqa: F841, E50 | ^^^^^^^^^^^^^^^^^ RUF100 108 | e = 1 # …noqa: E50 @@ -277,7 +277,7 @@ RUF100_0.py:107:12: RUF100 [*] Unused `noqa` directive (unknown: `E50`) ℹ Safe fix 104 104 | 105 105 | def f(): -106 106 | # Invalid - nonexistant error code with multibyte character +106 106 | # Invalid - nonexistent error code with multibyte character 107 |- d = 1 # …noqa: F841, E50 107 |+ d = 1 # noqa: F841 108 108 | e = 1 # …noqa: E50 @@ -286,7 +286,7 @@ RUF100_0.py:107:12: RUF100 [*] Unused `noqa` directive (unknown: `E50`) RUF100_0.py:108:5: F841 [*] Local variable `e` is assigned to but never used | -106 | # Invalid - nonexistant error code with multibyte character +106 | # Invalid - nonexistent error code with multibyte character 107 | d = 1 # …noqa: F841, E50 108 | e = 1 # …noqa: E50 | ^ F841 @@ -295,7 +295,7 @@ RUF100_0.py:108:5: F841 [*] Local variable `e` is assigned to but never used ℹ Unsafe fix 105 105 | def f(): -106 106 | # Invalid - nonexistant error code with multibyte character +106 106 | # Invalid - nonexistent error code with multibyte character 107 107 | d = 1 # …noqa: F841, E50 108 |- e = 1 # …noqa: E50 109 108 | @@ -304,7 +304,7 @@ RUF100_0.py:108:5: F841 [*] Local variable `e` is assigned to but never used RUF100_0.py:108:12: RUF100 [*] Unused `noqa` directive (unknown: `E50`) | -106 | # Invalid - nonexistant error code with multibyte character +106 | # Invalid - nonexistent error code with multibyte character 107 | d = 1 # …noqa: F841, E50 108 | e = 1 # …noqa: E50 | ^^^^^^^^^^^ RUF100 @@ -313,7 +313,7 @@ RUF100_0.py:108:12: RUF100 [*] Unused `noqa` directive (unknown: `E50`) ℹ Safe fix 105 105 | def f(): -106 106 | # Invalid - nonexistant error code with multibyte character +106 106 | # Invalid - nonexistent error code with multibyte character 107 107 | d = 1 # …noqa: F841, E50 108 |- e = 1 # …noqa: E50 108 |+ e = 1 diff --git a/crates/ruff_python_formatter/resources/test/fixtures/ruff/expression/fstring.py b/crates/ruff_python_formatter/resources/test/fixtures/ruff/expression/fstring.py index 52854c062a..001a554163 100644 --- a/crates/ruff_python_formatter/resources/test/fixtures/ruff/expression/fstring.py +++ b/crates/ruff_python_formatter/resources/test/fixtures/ruff/expression/fstring.py @@ -224,7 +224,7 @@ f"""aaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbb ccccccccccc { f"""fooooooooooooooooooo barrrrrrrrrrrrrrrrrrr { xxxxxxxxxxxxxxx:.3f} aaaaaaaaaaaaaaaaa { xxxxxxxxxxxxxxxxxxxx } bbbbbbbbbbbb""" -# Throw in a random comment in it but surpise, this is not a comment but just a text +# Throw in a random comment in it but surprise, this is not a comment but just a text # which is part of the format specifier aaaaaaaaaaa = f"""asaaaaaaaaaaaaaaaa { aaaaaaaaaaaa + bbbbbbbbbbbb + ccccccccccccccc + dddddddd:.3f diff --git a/crates/ruff_python_formatter/tests/snapshots/format@expression__fstring.py.snap b/crates/ruff_python_formatter/tests/snapshots/format@expression__fstring.py.snap index a0e72a27fb..189d25ce3f 100644 --- a/crates/ruff_python_formatter/tests/snapshots/format@expression__fstring.py.snap +++ b/crates/ruff_python_formatter/tests/snapshots/format@expression__fstring.py.snap @@ -230,7 +230,7 @@ f"""aaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbb ccccccccccc { f"""fooooooooooooooooooo barrrrrrrrrrrrrrrrrrr { xxxxxxxxxxxxxxx:.3f} aaaaaaaaaaaaaaaaa { xxxxxxxxxxxxxxxxxxxx } bbbbbbbbbbbb""" -# Throw in a random comment in it but surpise, this is not a comment but just a text +# Throw in a random comment in it but surprise, this is not a comment but just a text # which is part of the format specifier aaaaaaaaaaa = f"""asaaaaaaaaaaaaaaaa { aaaaaaaaaaaa + bbbbbbbbbbbb + ccccccccccccccc + dddddddd:.3f @@ -571,7 +571,7 @@ f"""fooooooooooooooooooo barrrrrrrrrrrrrrrrrrr {xxxxxxxxxxxxxxx:.3f} aaaaaaaaaaa xxxxxxxxxxxxxxxxxxxx } bbbbbbbbbbbb""" -# Throw in a random comment in it but surpise, this is not a comment but just a text +# Throw in a random comment in it but surprise, this is not a comment but just a text # which is part of the format specifier aaaaaaaaaaa = f"""asaaaaaaaaaaaaaaaa {aaaaaaaaaaaa + bbbbbbbbbbbb + ccccccccccccccc + dddddddd:.3f # comment @@ -890,7 +890,7 @@ f"""aaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbb ccccccccccc { f"""fooooooooooooooooooo barrrrrrrrrrrrrrrrrrr { xxxxxxxxxxxxxxx:.3f} aaaaaaaaaaaaaaaaa { xxxxxxxxxxxxxxxxxxxx } bbbbbbbbbbbb""" -# Throw in a random comment in it but surpise, this is not a comment but just a text +# Throw in a random comment in it but surprise, this is not a comment but just a text # which is part of the format specifier aaaaaaaaaaa = f"""asaaaaaaaaaaaaaaaa { aaaaaaaaaaaa + bbbbbbbbbbbb + ccccccccccccccc + dddddddd:.3f @@ -1206,7 +1206,7 @@ hello { + xxxxxxxxxxxxxxxxxxxx +} bbbbbbbbbbbb""" - # Throw in a random comment in it but surpise, this is not a comment but just a text + # Throw in a random comment in it but surprise, this is not a comment but just a text # which is part of the format specifier -aaaaaaaaaaa = f"""asaaaaaaaaaaaaaaaa { - aaaaaaaaaaaa + bbbbbbbbbbbb + ccccccccccccccc + dddddddd:.3f diff --git a/crates/ruff_python_parser/resources/invalid/statements/function_type_parameters.py b/crates/ruff_python_parser/resources/invalid/statements/function_type_parameters.py index d2ed2f5dae..33ea00f4ec 100644 --- a/crates/ruff_python_parser/resources/invalid/statements/function_type_parameters.py +++ b/crates/ruff_python_parser/resources/invalid/statements/function_type_parameters.py @@ -3,7 +3,7 @@ # That's because the parser has no way of feeding the error recovery back to the lexer, # so they don't agree on the state of the world which can lead to all kind of errors further down in the file. # This is not just a problem with parentheses but also with the transformation made by the -# `SoftKeywordTransformer` because the `Parser` and `Transfomer` may not agree if they're +# `SoftKeywordTransformer` because the `Parser` and `Transformer` may not agree if they're # currently in a position where the `type` keyword is allowed or not. # That roughly means that any kind of recovery can lead to unrelated syntax errors # on following lines. @@ -16,4 +16,4 @@ def multiple_commas[A,,B](): ... def multiple_trailing_commas[A,,](): ... -def multiple_commas_and_recovery[A,,100](): ... \ No newline at end of file +def multiple_commas_and_recovery[A,,100](): ... diff --git a/crates/ruff_python_parser/src/parser/expression.rs b/crates/ruff_python_parser/src/parser/expression.rs index 47b74be32f..711fa5c52e 100644 --- a/crates/ruff_python_parser/src/parser/expression.rs +++ b/crates/ruff_python_parser/src/parser/expression.rs @@ -2326,7 +2326,7 @@ impl Ranged for ParsedExpr { /// See: #[derive(Debug, Ord, Eq, PartialEq, PartialOrd, Copy, Clone)] pub(super) enum OperatorPrecedence { - /// The initital precedence when parsing an expression. + /// The initial precedence when parsing an expression. Initial, /// Precedence of boolean `or` operator. Or, diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__function_type_parameters.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__function_type_parameters.py.snap index c2f674bcf3..58aa04440c 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__function_type_parameters.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__function_type_parameters.py.snap @@ -7,27 +7,27 @@ input_file: crates/ruff_python_parser/resources/invalid/statements/function_type ``` Module( ModModule { - range: 0..986, + range: 0..988, body: [ FunctionDef( StmtFunctionDef { - range: 795..823, + range: 796..824, is_async: false, decorator_list: [], name: Identifier { id: "keyword", - range: 799..806, + range: 800..807, }, type_params: Some( TypeParams { - range: 806..816, + range: 807..817, type_params: [ TypeVar( TypeParamTypeVar { - range: 807..808, + range: 808..809, name: Identifier { id: "A", - range: 807..808, + range: 808..809, }, bound: None, default: None, @@ -35,10 +35,10 @@ Module( ), TypeVar( TypeParamTypeVar { - range: 810..815, + range: 811..816, name: Identifier { id: "await", - range: 810..815, + range: 811..816, }, bound: None, default: None, @@ -48,7 +48,7 @@ Module( }, ), parameters: Parameters { - range: 816..818, + range: 817..819, posonlyargs: [], args: [], vararg: None, @@ -59,10 +59,10 @@ Module( body: [ Expr( StmtExpr { - range: 820..823, + range: 821..824, value: EllipsisLiteral( ExprEllipsisLiteral { - range: 820..823, + range: 821..824, }, ), }, @@ -72,23 +72,23 @@ Module( ), FunctionDef( StmtFunctionDef { - range: 825..861, + range: 826..862, is_async: false, decorator_list: [], name: Identifier { id: "not_a_type_param", - range: 829..845, + range: 830..846, }, type_params: Some( TypeParams { - range: 845..854, + range: 846..855, type_params: [ TypeVar( TypeParamTypeVar { - range: 846..847, + range: 847..848, name: Identifier { id: "A", - range: 846..847, + range: 847..848, }, bound: None, default: None, @@ -96,10 +96,10 @@ Module( ), TypeVar( TypeParamTypeVar { - range: 852..853, + range: 853..854, name: Identifier { id: "B", - range: 852..853, + range: 853..854, }, bound: None, default: None, @@ -109,7 +109,7 @@ Module( }, ), parameters: Parameters { - range: 854..856, + range: 855..857, posonlyargs: [], args: [], vararg: None, @@ -120,10 +120,10 @@ Module( body: [ Expr( StmtExpr { - range: 858..861, + range: 859..862, value: EllipsisLiteral( ExprEllipsisLiteral { - range: 858..861, + range: 859..862, }, ), }, @@ -133,23 +133,23 @@ Module( ), FunctionDef( StmtFunctionDef { - range: 863..895, + range: 864..896, is_async: false, decorator_list: [], name: Identifier { id: "multiple_commas", - range: 867..882, + range: 868..883, }, type_params: Some( TypeParams { - range: 882..888, + range: 883..889, type_params: [ TypeVar( TypeParamTypeVar { - range: 883..884, + range: 884..885, name: Identifier { id: "A", - range: 883..884, + range: 884..885, }, bound: None, default: None, @@ -157,10 +157,10 @@ Module( ), TypeVar( TypeParamTypeVar { - range: 886..887, + range: 887..888, name: Identifier { id: "B", - range: 886..887, + range: 887..888, }, bound: None, default: None, @@ -170,7 +170,7 @@ Module( }, ), parameters: Parameters { - range: 888..890, + range: 889..891, posonlyargs: [], args: [], vararg: None, @@ -181,10 +181,10 @@ Module( body: [ Expr( StmtExpr { - range: 892..895, + range: 893..896, value: EllipsisLiteral( ExprEllipsisLiteral { - range: 892..895, + range: 893..896, }, ), }, @@ -194,23 +194,23 @@ Module( ), FunctionDef( StmtFunctionDef { - range: 897..937, + range: 898..938, is_async: false, decorator_list: [], name: Identifier { id: "multiple_trailing_commas", - range: 901..925, + range: 902..926, }, type_params: Some( TypeParams { - range: 925..930, + range: 926..931, type_params: [ TypeVar( TypeParamTypeVar { - range: 926..927, + range: 927..928, name: Identifier { id: "A", - range: 926..927, + range: 927..928, }, bound: None, default: None, @@ -220,7 +220,7 @@ Module( }, ), parameters: Parameters { - range: 930..932, + range: 931..933, posonlyargs: [], args: [], vararg: None, @@ -231,10 +231,10 @@ Module( body: [ Expr( StmtExpr { - range: 934..937, + range: 935..938, value: EllipsisLiteral( ExprEllipsisLiteral { - range: 934..937, + range: 935..938, }, ), }, @@ -244,23 +244,23 @@ Module( ), FunctionDef( StmtFunctionDef { - range: 939..978, + range: 940..979, is_async: false, decorator_list: [], name: Identifier { id: "multiple_commas_and_recovery", - range: 943..971, + range: 944..972, }, type_params: Some( TypeParams { - range: 971..975, + range: 972..976, type_params: [ TypeVar( TypeParamTypeVar { - range: 972..973, + range: 973..974, name: Identifier { id: "A", - range: 972..973, + range: 973..974, }, bound: None, default: None, @@ -270,7 +270,7 @@ Module( }, ), parameters: Parameters { - range: 975..975, + range: 976..976, posonlyargs: [], args: [], vararg: None, @@ -281,10 +281,10 @@ Module( body: [ Expr( StmtExpr { - range: 975..978, + range: 976..979, value: NumberLiteral( ExprNumberLiteral { - range: 975..978, + range: 976..979, value: Int( 100, ), @@ -297,10 +297,10 @@ Module( ), AnnAssign( StmtAnnAssign { - range: 979..986, + range: 980..987, target: Tuple( ExprTuple { - range: 979..981, + range: 980..982, elts: [], ctx: Store, parenthesized: true, @@ -308,7 +308,7 @@ Module( ), annotation: EllipsisLiteral( ExprEllipsisLiteral { - range: 983..986, + range: 984..987, }, ), value: None,