Skip to content

Commit a8f6a6b

Browse files
authored
Added spellcheck tools (#3625)
1 parent d8aa58d commit a8f6a6b

18 files changed

Lines changed: 78 additions & 41 deletions

File tree

.pre-commit-config.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,18 @@ repos:
3838
args: ["--config=.github/bake.toml"]
3939
- id: mbake-validate
4040

41+
- repo: https://github.com/crate-ci/typos
42+
rev: v1.45.0
43+
hooks:
44+
- id: typos
45+
46+
- repo: https://github.com/codespell-project/codespell
47+
rev: v2.4.1
48+
hooks:
49+
- id: codespell
50+
additional_dependencies:
51+
- tomli
52+
4153
- repo: https://github.com/pre-commit/pre-commit-hooks
4254
rev: v6.0.0
4355
hooks:

CHANGELOG.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ Our [GitHub Action](https://github.com/marketplace/actions/wemake-python-stylegu
316316
- Adds a new rule to forbid `lambda` assigns to special attributes, #1733
317317
- Adds a new rule to check problematic function params, #1343
318318
- Adds a new rule to detect duplicate conditions in `if`s and `elif`s, #2241
319-
- Adds a new rule to detect duplicate `case` pattens in `match`, #3206
319+
- Adds a new rule to detect duplicate `case` patterns in `match`, #3206
320320
- Adds a new rule to find too many `match` subjects, #3201
321321
- Adds a new rule to detect too many `case` statements, #3202
322322
- Adds a new rule to find too complex `except` with too many exceptions
@@ -1051,7 +1051,7 @@ In this release we had a little focus on:
10511051

10521052
- Bumps `flake8-eradicate` version
10531053
and solves `attrs` incompatible versions issue
1054-
- Bumps `flake8-dosctrings` version
1054+
- Bumps `flake8-docstrings` version
10551055
and solved `pydocstyle` issue
10561056
- Fixes `TryExceptMultipleReturnPathViolation` not tracking `else` and `finally`
10571057
returns at the same time
@@ -1101,7 +1101,7 @@ In this release we had a little focus on:
11011101
- Adds `bellybutton` to the list of other linters
11021102
- Documents how to use `nitpick` to sync the configuration
11031103
- Documents how to use `flakehell` to create `baseline`s for legacy integrations
1104-
- Improves tests for binary, octal, hex, and exponentional numbers
1104+
- Improves tests for binary, octal, hex, and exponential numbers
11051105
- Adds new `xenon` CI check
11061106
- Now handles exceptions in our own code, hope to never see them!
11071107
- Now uses `coverage` checks in deepsource
@@ -1161,7 +1161,7 @@ for you to rename your violations with a script.
11611161
- Ensures that `--diff` mode works for `flake8`
11621162
- Renames `Incorrect` to `Wrong` where possible
11631163
- Renames `IncorrectlyNestedTernaryViolation` to `NestedTernaryViolation`
1164-
- Renames `IncorectLoopIterTypeViolation` to `WrongLoopIterTypeViolation`
1164+
- Renames `IncorrectLoopIterTypeViolation` to `WrongLoopIterTypeViolation`
11651165

11661166

11671167
## 0.10.0 aka The Great Compare

pyproject.toml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,5 +274,30 @@ module = "wemake_python_styleguide.compat.packaging"
274274
# We allow unused `ignore` comments, because we cannot sync it between versions:
275275
warn_unused_ignores = false
276276

277+
[tool.codespell]
278+
# codespell configuration: https://github.com/codespell-project/codespell
279+
skip = [
280+
"__pycache__",
281+
"_build",
282+
".mypy_cache",
283+
"*.lock",
284+
"tests/whitelist.txt",
285+
]
286+
ignore-words-list = [
287+
"NotIn",
288+
]
289+
290+
291+
[tool.typos.files]
292+
# typos configuration: https://github.com/crate-ci/typos/
293+
extend-exclude = [
294+
"__pycache__",
295+
"_build",
296+
".mypy_cache",
297+
"*.lock",
298+
"tests/whitelist.txt",
299+
]
300+
301+
277302
[tool.poetry.scripts]
278303
wps = "wemake_python_styleguide.cli.cli_app:main"

tests/test_visitors/test_ast/test_builtins/test_numbers/test_magic_numbers.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,9 @@ def test_magic_number(
144144
parse_tokens,
145145
):
146146
"""Testing that there are no magic numbers in this code."""
147-
formated_code = mode(code.format(number))
148-
tree = parse_ast_tree(formated_code)
149-
file_tokens = parse_tokens(formated_code)
147+
formatted_code = mode(code.format(number))
148+
tree = parse_ast_tree(formatted_code)
149+
file_tokens = parse_tokens(formatted_code)
150150

151151
visitor = WrongNumberVisitor(
152152
default_options,
@@ -197,9 +197,9 @@ def test_magic_number_whitelist(
197197
parse_tokens,
198198
):
199199
"""Testing that magic numbers in this code are whitelisted."""
200-
formated_code = mode(code.format(number))
201-
tree = parse_ast_tree(formated_code)
202-
file_tokens = parse_tokens(formated_code)
200+
formatted_code = mode(code.format(number))
201+
tree = parse_ast_tree(formatted_code)
202+
file_tokens = parse_tokens(formatted_code)
203203

204204
visitor = WrongNumberVisitor(
205205
default_options,
@@ -251,9 +251,9 @@ def test_magic_number_warning(
251251
parse_tokens,
252252
):
253253
"""Testing that magic numbers in this code are warnings."""
254-
formated_code = mode(code.format(number))
255-
tree = parse_ast_tree(formated_code)
256-
file_tokens = parse_tokens(formated_code)
254+
formatted_code = mode(code.format(number))
255+
tree = parse_ast_tree(formatted_code)
256+
file_tokens = parse_tokens(formatted_code)
257257

258258
visitor = WrongNumberVisitor(
259259
default_options,
@@ -303,9 +303,9 @@ def test_magic_number_octal_warning(
303303
parse_tokens,
304304
):
305305
"""Testing that magic numbers in this code are warnings."""
306-
formated_code = mode(code.format(number))
307-
tree = parse_ast_tree(formated_code)
308-
file_tokens = parse_tokens(formated_code)
306+
formatted_code = mode(code.format(number))
307+
tree = parse_ast_tree(formatted_code)
308+
file_tokens = parse_tokens(formatted_code)
309309

310310
visitor = WrongNumberVisitor(
311311
default_options,

tests/test_visitors/test_ast/test_builtins/test_strings/test_formatted_string.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
f_format_var_single2 = "f'{value1:{fmt1}} {value2:{fmt2}}'"
5555
f_format_var_single_index = "f'{value:{fmt[0]}}'"
5656
f_format_var_single_call = "f'{value:{fmt()}}'"
57-
f_format_convertions = "f'{value1!r} {value2!s} {value3!a}'"
57+
f_format_conversions = "f'{value1!r} {value2!s} {value3!a}'"
5858
f_format_assign = "f'{value=:<8}'"
5959
f_format_assign_conversion = "f'{value=!r}'"
6060
f_format_assign_attr = "f'{value.attr=:.456e}'"
@@ -243,7 +243,7 @@ def test_complex_f_string(assert_errors, parse_ast_tree, code, default_options):
243243
f_format_var_single2,
244244
f_format_var_single_index,
245245
f_format_var_single_call,
246-
f_format_convertions,
246+
f_format_conversions,
247247
f_format_assign,
248248
f_format_assign_conversion,
249249
f_format_assign_attr,

tests/test_visitors/test_ast/test_classes/test_wrong_empty_lines_count.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ def test_ellipsis_into_body(
384384
assert_errors(visitor, [WrongEmptyLinesCountViolation])
385385

386386

387-
def test_string_concatination(
387+
def test_string_concatenation(
388388
parse_tokens,
389389
default_options,
390390
assert_errors,

tests/test_visitors/test_ast/test_compares/test_multiple_in.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def test_compare_with_in(
6161
@pytest.mark.parametrize(
6262
'comparators',
6363
[
64-
('line', 'sqaure', 'shape'),
64+
('line', 'square', 'shape'),
6565
('output', 'status', {True}),
6666
('letter', 'line', 'book'),
6767
],

tests/test_visitors/test_ast/test_complexity/test_annotation_complexity/test_annotation_complexity_nesting.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class Test:
6969
'Dict[int, str]',
7070
'Callable[[str, int], int]',
7171
'List[List[int]]',
72-
'"String Annontation"',
72+
'"String Annotation"',
7373
'typing.int',
7474
'typing.List[int]',
7575
'typing.List["typing.Tuple[int]"]',

tests/test_visitors/test_ast/test_complexity/test_classes/test_method_counts.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ async def method2(cls): ...
9191

9292
# regression1779
9393

94-
class_with_overloades = """
94+
class_with_overloads = """
9595
class First:
9696
@overload
9797
def my_method(self): ...
@@ -115,7 +115,7 @@ def my_method(self): ...
115115
class_with_async_and_usual_class_methods,
116116
class_with_staticmethods,
117117
class_with_async_staticmethods,
118-
class_with_overloades,
118+
class_with_overloads,
119119
],
120120
)
121121
def test_method_counts_normal(
@@ -167,7 +167,7 @@ def test_method_counts_violation(
167167
@pytest.mark.parametrize(
168168
'code',
169169
[
170-
class_with_overloades,
170+
class_with_overloads,
171171
],
172172
)
173173
def test_method_counts_exceptions(

tests/test_visitors/test_ast/test_conditions/test_negated_conditions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ def test_correctly_negated_complex_conditions(
188188
('x != 1', 'y == 2', [NegatedConditionsViolation]),
189189
],
190190
)
191-
def test_correctly_double_negated_condtions(
191+
def test_correctly_double_negated_conditions(
192192
first,
193193
second,
194194
violations,

0 commit comments

Comments
 (0)