mirror of
https://github.com/astral-sh/ruff.git
synced 2025-07-24 05:26:23 +00:00
Spellcheck & grammar (#10375)
## Summary I used `codespell` and `gramma` to identify mispellings and grammar errors throughout the codebase and fixed them. I tried not to make any controversial changes, but feel free to revert as you see fit.
This commit is contained in:
parent
c56fb6e15a
commit
3ed707f245
67 changed files with 135 additions and 170 deletions
|
@ -6,7 +6,7 @@ def foo2(parameter_1, parameter_2, parameter_3, parameter_4, parameter_5, parame
|
|||
def foo3(parameter_1, parameter_2, parameter_3, parameter_4, parameter_5, parameter_6, parameter_7): pass
|
||||
def foo4(parameter_1, parameter_2, parameter_3, parameter_4, parameter_5, parameter_6, parameter_7): pass
|
||||
|
||||
# Adding some unformated code covering a wide range of syntaxes.
|
||||
# Adding some unformatted code covering a wide range of syntaxes.
|
||||
|
||||
if True:
|
||||
# Incorrectly indented prefix comments.
|
||||
|
|
|
@ -28,7 +28,7 @@ def foo3(
|
|||
|
||||
def foo4(parameter_1, parameter_2, parameter_3, parameter_4, parameter_5, parameter_6, parameter_7): pass
|
||||
|
||||
# Adding some unformated code covering a wide range of syntaxes.
|
||||
# Adding some unformatted code covering a wide range of syntaxes.
|
||||
|
||||
if True:
|
||||
# Incorrectly indented prefix comments.
|
||||
|
|
|
@ -19,7 +19,7 @@ z: (Short
|
|||
z: (int) = 2.3
|
||||
z: ((int)) = foo()
|
||||
|
||||
# In case I go for not enforcing parantheses, this might get improved at the same time
|
||||
# In case I go for not enforcing parentheses, this might get improved at the same time
|
||||
x = (
|
||||
z
|
||||
== 9999999999999999999999999999999999999999
|
||||
|
|
|
@ -28,7 +28,7 @@ z: Short | Short2 | Short3 | Short4 = 8
|
|||
z: int = 2.3
|
||||
z: int = foo()
|
||||
|
||||
# In case I go for not enforcing parantheses, this might get improved at the same time
|
||||
# In case I go for not enforcing parentheses, this might get improved at the same time
|
||||
x = (
|
||||
z
|
||||
== 9999999999999999999999999999999999999999
|
||||
|
|
|
@ -148,7 +148,7 @@ class TabbedIndent:
|
|||
"""check for correct tabbed formatting
|
||||
^^^^^^^^^^
|
||||
Normal indented line
|
||||
- autor
|
||||
- author
|
||||
"""
|
||||
|
||||
|
||||
|
|
|
@ -189,7 +189,7 @@ f"aaaaaa {[
|
|||
yyyyyyyyyyyy
|
||||
]} ccccccc"
|
||||
|
||||
# Remove the parenthese because they aren't required
|
||||
# Remove the parentheses because they aren't required
|
||||
xxxxxxxxxxxxxxx = (
|
||||
f"aaaaaaaaaaaaaaaa bbbbbbbbbbbbbbb {
|
||||
xxxxxxxxxxx # comment 14
|
||||
|
@ -214,7 +214,7 @@ f"{ # comment 15
|
|||
# removed once we have a strict parser.
|
||||
x = f"aaaaaaaaa { x ! r }"
|
||||
|
||||
# Even in the case of debug expresions, we only need to preserve the whitespace within
|
||||
# Even in the case of debug expressions, we only need to preserve the whitespace within
|
||||
# the expression part of the replacement field.
|
||||
x = f"aaaaaaaaa { x = ! r }"
|
||||
|
||||
|
|
|
@ -2,5 +2,5 @@
|
|||
# the target version is 3.12 or later. A user can have 3.12 syntax even if the target
|
||||
# version isn't set.
|
||||
|
||||
# Quotes re-use
|
||||
# Quotes reuse
|
||||
f"{'a'}"
|
||||
|
|
|
@ -5,5 +5,5 @@ def test():
|
|||
if unformatted + a:
|
||||
pass
|
||||
|
||||
# Get's formatted again
|
||||
# Gets formatted again
|
||||
a + b
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
# Get's formatted
|
||||
# Gets formatted
|
||||
a + b
|
||||
|
||||
# fmt: off
|
||||
a + [1, 2, 3, 4, 5 ]
|
||||
# fmt: on
|
||||
|
||||
# Get's formatted again
|
||||
# Gets formatted again
|
||||
a + b
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
# Get's formatted
|
||||
# Gets formatted
|
||||
a + b
|
||||
|
||||
# yapf: disable
|
||||
a + [1, 2, 3, 4, 5 ]
|
||||
# yapf: enable
|
||||
|
||||
# Get's formatted again
|
||||
# Gets formatted again
|
||||
a + b
|
||||
|
||||
|
||||
|
@ -13,5 +13,5 @@ a + b
|
|||
a + [1, 2, 3, 4, 5 ]
|
||||
# fmt: on
|
||||
|
||||
# Get's formatted again
|
||||
# Gets formatted again
|
||||
a + b
|
||||
|
|
|
@ -12,7 +12,7 @@ class <RANGE_START> Test(OtherClass<RANGE_END>)\
|
|||
def __init__( self):
|
||||
print("hello")
|
||||
|
||||
print( "dont' format this")
|
||||
print( "don't format this")
|
||||
|
||||
|
||||
def test2(<RANGE_START>a, b, c: str, d):<RANGE_END>
|
||||
|
|
|
@ -195,7 +195,7 @@ a[aaaaaaa, b] = (
|
|||
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc # comment
|
||||
)
|
||||
|
||||
# Format both as flat, but don't loos the comment.
|
||||
# Format both as flat, but don't lose the comment.
|
||||
a[aaaaaaa, b] = bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb # comment
|
||||
|
||||
#######################################################
|
||||
|
|
|
@ -66,20 +66,20 @@ raise ( # another comment
|
|||
raise (
|
||||
) # what now
|
||||
|
||||
raise ( # sould I stay here
|
||||
raise ( # should I stay here
|
||||
# just a comment here
|
||||
) # trailing comment
|
||||
|
||||
raise hello( # sould I stay here
|
||||
raise hello( # should I stay here
|
||||
# just a comment here
|
||||
) # trailing comment
|
||||
|
||||
raise ( # sould I stay here
|
||||
raise ( # should I stay here
|
||||
test,
|
||||
# just a comment here
|
||||
) # trailing comment
|
||||
|
||||
raise hello( # sould I stay here
|
||||
raise hello( # should I stay here
|
||||
# just a comment here
|
||||
"hey"
|
||||
) # trailing comment
|
||||
|
|
|
@ -16,7 +16,7 @@ use std::ops::Range;
|
|||
/// before inserting any parts for the key `b`.
|
||||
/// * The parts per key are inserted in the following order: *leading*, *dangling*, and then the *trailing* parts.
|
||||
///
|
||||
/// Parts inserted in the above mentioned order are stored in a `Vec` shared by all keys to reduce the number
|
||||
/// Parts inserted in the above-mentioned order are stored in a `Vec` shared by all keys to reduce the number
|
||||
/// of allocations and increased cache locality. The implementation falls back to storing the *leading*,
|
||||
/// *dangling*, and *trailing* parts of a key in dedicated `Vec`s if the parts aren't inserted in the before mentioned order.
|
||||
/// Out of order insertions come with a slight performance penalty due to:
|
||||
|
|
|
@ -26,7 +26,7 @@ z: (Short
|
|||
z: (int) = 2.3
|
||||
z: ((int)) = foo()
|
||||
|
||||
# In case I go for not enforcing parantheses, this might get improved at the same time
|
||||
# In case I go for not enforcing parentheses, this might get improved at the same time
|
||||
x = (
|
||||
z
|
||||
== 9999999999999999999999999999999999999999
|
||||
|
@ -165,7 +165,7 @@ z: Short | Short2 | Short3 | Short4 = 8
|
|||
z: int = 2.3
|
||||
z: int = foo()
|
||||
|
||||
# In case I go for not enforcing parantheses, this might get improved at the same time
|
||||
# In case I go for not enforcing parentheses, this might get improved at the same time
|
||||
x = (
|
||||
z
|
||||
== 9999999999999999999999999999999999999999
|
||||
|
@ -269,7 +269,7 @@ z: Short | Short2 | Short3 | Short4 = 8
|
|||
z: int = 2.3
|
||||
z: int = foo()
|
||||
|
||||
# In case I go for not enforcing parantheses, this might get improved at the same time
|
||||
# In case I go for not enforcing parentheses, this might get improved at the same time
|
||||
x = (
|
||||
z
|
||||
== 9999999999999999999999999999999999999999
|
||||
|
@ -341,5 +341,3 @@ def f(
|
|||
another_option: bool = False,
|
||||
): ...
|
||||
```
|
||||
|
||||
|
||||
|
|
|
@ -154,7 +154,7 @@ class TabbedIndent:
|
|||
"""check for correct tabbed formatting
|
||||
^^^^^^^^^^
|
||||
Normal indented line
|
||||
- autor
|
||||
- author
|
||||
"""
|
||||
|
||||
|
||||
|
@ -330,7 +330,7 @@ class TabbedIndent:
|
|||
"""check for correct tabbed formatting
|
||||
^^^^^^^^^^
|
||||
Normal indented line
|
||||
- autor
|
||||
- author
|
||||
"""
|
||||
|
||||
|
||||
|
@ -506,7 +506,7 @@ class TabbedIndent:
|
|||
"""check for correct tabbed formatting
|
||||
^^^^^^^^^^
|
||||
Normal indented line
|
||||
- autor
|
||||
- author
|
||||
"""
|
||||
|
||||
|
||||
|
@ -682,7 +682,7 @@ class TabbedIndent:
|
|||
"""check for correct tabbed formatting
|
||||
^^^^^^^^^^
|
||||
Normal indented line
|
||||
- autor
|
||||
- author
|
||||
"""
|
||||
|
||||
|
||||
|
@ -858,7 +858,7 @@ class TabbedIndent:
|
|||
"""check for correct tabbed formatting
|
||||
^^^^^^^^^^
|
||||
Normal indented line
|
||||
- autor
|
||||
- author
|
||||
"""
|
||||
|
||||
|
||||
|
@ -1034,7 +1034,7 @@ class TabbedIndent:
|
|||
"""check for correct tabbed formatting
|
||||
^^^^^^^^^^
|
||||
Normal indented line
|
||||
- autor
|
||||
- author
|
||||
"""
|
||||
|
||||
|
||||
|
@ -1042,6 +1042,3 @@ def single_quoted():
|
|||
"content\ "
|
||||
return
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -195,7 +195,7 @@ f"aaaaaa {[
|
|||
yyyyyyyyyyyy
|
||||
]} ccccccc"
|
||||
|
||||
# Remove the parenthese because they aren't required
|
||||
# Remove the parentheses because they aren't required
|
||||
xxxxxxxxxxxxxxx = (
|
||||
f"aaaaaaaaaaaaaaaa bbbbbbbbbbbbbbb {
|
||||
xxxxxxxxxxx # comment 14
|
||||
|
@ -220,7 +220,7 @@ f"{ # comment 15
|
|||
# removed once we have a strict parser.
|
||||
x = f"aaaaaaaaa { x ! r }"
|
||||
|
||||
# Even in the case of debug expresions, we only need to preserve the whitespace within
|
||||
# Even in the case of debug expressions, we only need to preserve the whitespace within
|
||||
# the expression part of the replacement field.
|
||||
x = f"aaaaaaaaa { x = ! r }"
|
||||
|
||||
|
@ -510,7 +510,7 @@ f"aaaaaa {
|
|||
]
|
||||
} ccccccc"
|
||||
|
||||
# Remove the parenthese because they aren't required
|
||||
# Remove the parentheses because they aren't required
|
||||
xxxxxxxxxxxxxxx = f"aaaaaaaaaaaaaaaa bbbbbbbbbbbbbbb {
|
||||
xxxxxxxxxxx # comment 14
|
||||
+ yyyyyyyyyy
|
||||
|
@ -533,7 +533,7 @@ f"{ # comment 15
|
|||
# removed once we have a strict parser.
|
||||
x = f"aaaaaaaaa {x!r}"
|
||||
|
||||
# Even in the case of debug expresions, we only need to preserve the whitespace within
|
||||
# Even in the case of debug expressions, we only need to preserve the whitespace within
|
||||
# the expression part of the replacement field.
|
||||
x = f"aaaaaaaaa { x = !r}"
|
||||
|
||||
|
@ -804,7 +804,7 @@ f"aaaaaa {[
|
|||
yyyyyyyyyyyy
|
||||
]} ccccccc"
|
||||
|
||||
# Remove the parenthese because they aren't required
|
||||
# Remove the parentheses because they aren't required
|
||||
xxxxxxxxxxxxxxx = f"aaaaaaaaaaaaaaaa bbbbbbbbbbbbbbb {
|
||||
xxxxxxxxxxx # comment 14
|
||||
+ yyyyyyyyyy
|
||||
|
@ -827,7 +827,7 @@ f"{ # comment 15
|
|||
# removed once we have a strict parser.
|
||||
x = f"aaaaaaaaa { x ! r }"
|
||||
|
||||
# Even in the case of debug expresions, we only need to preserve the whitespace within
|
||||
# Even in the case of debug expressions, we only need to preserve the whitespace within
|
||||
# the expression part of the replacement field.
|
||||
x = f"aaaaaaaaa { x = ! r }"
|
||||
|
||||
|
@ -1086,7 +1086,7 @@ hello {
|
|||
+ ]
|
||||
+} ccccccc"
|
||||
|
||||
# Remove the parenthese because they aren't required
|
||||
# Remove the parentheses because they aren't required
|
||||
xxxxxxxxxxxxxxx = f"aaaaaaaaaaaaaaaa bbbbbbbbbbbbbbb {
|
||||
- xxxxxxxxxxx # comment 14
|
||||
- + yyyyyyyyyy
|
||||
|
@ -1113,7 +1113,7 @@ hello {
|
|||
-x = f"aaaaaaaaa { x ! r }"
|
||||
+x = f"aaaaaaaaa {x!r}"
|
||||
|
||||
# Even in the case of debug expresions, we only need to preserve the whitespace within
|
||||
# Even in the case of debug expressions, we only need to preserve the whitespace within
|
||||
# the expression part of the replacement field.
|
||||
-x = f"aaaaaaaaa { x = ! r }"
|
||||
+x = f"aaaaaaaaa { x = !r}"
|
||||
|
@ -1202,6 +1202,3 @@ hello {
|
|||
+ } --------
|
||||
"""
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ input_file: crates/ruff_python_formatter/resources/test/fixtures/ruff/expression
|
|||
# the target version is 3.12 or later. A user can have 3.12 syntax even if the target
|
||||
# version isn't set.
|
||||
|
||||
# Quotes re-use
|
||||
# Quotes reuse
|
||||
f"{'a'}"
|
||||
```
|
||||
|
||||
|
@ -33,7 +33,7 @@ source_type = Python
|
|||
# the target version is 3.12 or later. A user can have 3.12 syntax even if the target
|
||||
# version isn't set.
|
||||
|
||||
# Quotes re-use
|
||||
# Quotes reuse
|
||||
f"{'a'}"
|
||||
```
|
||||
|
||||
|
@ -45,10 +45,7 @@ f"{'a'}"
|
|||
@@ -3,4 +3,4 @@
|
||||
# version isn't set.
|
||||
|
||||
# Quotes re-use
|
||||
# Quotes reuse
|
||||
-f"{'a'}"
|
||||
+f"{"a"}"
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ def test():
|
|||
if unformatted + a:
|
||||
pass
|
||||
|
||||
# Get's formatted again
|
||||
# Gets formatted again
|
||||
a + b
|
||||
```
|
||||
|
||||
|
@ -25,9 +25,6 @@ def test():
|
|||
pass
|
||||
|
||||
|
||||
# Get's formatted again
|
||||
# Gets formatted again
|
||||
a + b
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -4,29 +4,26 @@ input_file: crates/ruff_python_formatter/resources/test/fixtures/ruff/fmt_on_off
|
|||
---
|
||||
## Input
|
||||
```python
|
||||
# Get's formatted
|
||||
# Gets formatted
|
||||
a + b
|
||||
|
||||
# fmt: off
|
||||
a + [1, 2, 3, 4, 5 ]
|
||||
# fmt: on
|
||||
|
||||
# Get's formatted again
|
||||
# Gets formatted again
|
||||
a + b
|
||||
```
|
||||
|
||||
## Output
|
||||
```python
|
||||
# Get's formatted
|
||||
# Gets formatted
|
||||
a + b
|
||||
|
||||
# fmt: off
|
||||
a + [1, 2, 3, 4, 5 ]
|
||||
# fmt: on
|
||||
|
||||
# Get's formatted again
|
||||
# Gets formatted again
|
||||
a + b
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -4,14 +4,14 @@ input_file: crates/ruff_python_formatter/resources/test/fixtures/ruff/fmt_on_off
|
|||
---
|
||||
## Input
|
||||
```python
|
||||
# Get's formatted
|
||||
# Gets formatted
|
||||
a + b
|
||||
|
||||
# yapf: disable
|
||||
a + [1, 2, 3, 4, 5 ]
|
||||
# yapf: enable
|
||||
|
||||
# Get's formatted again
|
||||
# Gets formatted again
|
||||
a + b
|
||||
|
||||
|
||||
|
@ -19,20 +19,20 @@ a + b
|
|||
a + [1, 2, 3, 4, 5 ]
|
||||
# fmt: on
|
||||
|
||||
# Get's formatted again
|
||||
# Gets formatted again
|
||||
a + b
|
||||
```
|
||||
|
||||
## Output
|
||||
```python
|
||||
# Get's formatted
|
||||
# Gets formatted
|
||||
a + b
|
||||
|
||||
# yapf: disable
|
||||
a + [1, 2, 3, 4, 5 ]
|
||||
# yapf: enable
|
||||
|
||||
# Get's formatted again
|
||||
# Gets formatted again
|
||||
a + b
|
||||
|
||||
|
||||
|
@ -40,9 +40,6 @@ a + b
|
|||
a + [1, 2, 3, 4, 5 ]
|
||||
# fmt: on
|
||||
|
||||
# Get's formatted again
|
||||
# Gets formatted again
|
||||
a + b
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ class <RANGE_START> Test(OtherClass<RANGE_END>)\
|
|||
def __init__( self):
|
||||
print("hello")
|
||||
|
||||
print( "dont' format this")
|
||||
print( "don't format this")
|
||||
|
||||
|
||||
def test2(<RANGE_START>a, b, c: str, d):<RANGE_END>
|
||||
|
@ -65,7 +65,7 @@ class Test(OtherClass): # comment
|
|||
def __init__( self):
|
||||
print("hello")
|
||||
|
||||
print( "dont' format this")
|
||||
print( "don't format this")
|
||||
|
||||
|
||||
def test2(a, b, c: str, d):
|
||||
|
@ -96,6 +96,3 @@ if a + b: # trailing clause header comment
|
|||
if b + c: # trailing clause header comment
|
||||
print("Not formatted" )
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -201,7 +201,7 @@ a[aaaaaaa, b] = (
|
|||
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc # comment
|
||||
)
|
||||
|
||||
# Format both as flat, but don't loos the comment.
|
||||
# Format both as flat, but don't lose the comment.
|
||||
a[aaaaaaa, b] = bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb # comment
|
||||
|
||||
#######################################################
|
||||
|
@ -455,7 +455,7 @@ a[aaaaaaa, b] = (
|
|||
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc # comment
|
||||
)
|
||||
|
||||
# Format both as flat, but don't loos the comment.
|
||||
# Format both as flat, but don't lose the comment.
|
||||
a[aaaaaaa, b] = bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb # comment
|
||||
|
||||
#######################################################
|
||||
|
@ -488,6 +488,3 @@ type A[
|
|||
VeryLongTypeNameThatShouldBreakFirstToTheRightBeforeSplitngtinthatExceedsTheWidth
|
||||
] = str
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -72,20 +72,20 @@ raise ( # another comment
|
|||
raise (
|
||||
) # what now
|
||||
|
||||
raise ( # sould I stay here
|
||||
raise ( # should I stay here
|
||||
# just a comment here
|
||||
) # trailing comment
|
||||
|
||||
raise hello( # sould I stay here
|
||||
raise hello( # should I stay here
|
||||
# just a comment here
|
||||
) # trailing comment
|
||||
|
||||
raise ( # sould I stay here
|
||||
raise ( # should I stay here
|
||||
test,
|
||||
# just a comment here
|
||||
) # trailing comment
|
||||
|
||||
raise hello( # sould I stay here
|
||||
raise hello( # should I stay here
|
||||
# just a comment here
|
||||
"hey"
|
||||
) # trailing comment
|
||||
|
@ -195,24 +195,21 @@ raise ( # another comment
|
|||
|
||||
raise () # what now
|
||||
|
||||
raise ( # sould I stay here
|
||||
raise ( # should I stay here
|
||||
# just a comment here
|
||||
) # trailing comment
|
||||
|
||||
raise hello( # sould I stay here
|
||||
raise hello( # should I stay here
|
||||
# just a comment here
|
||||
) # trailing comment
|
||||
|
||||
raise ( # sould I stay here
|
||||
raise ( # should I stay here
|
||||
test,
|
||||
# just a comment here
|
||||
) # trailing comment
|
||||
|
||||
raise hello( # sould I stay here
|
||||
raise hello( # should I stay here
|
||||
# just a comment here
|
||||
"hey"
|
||||
) # trailing comment
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue