Skip to content

Commit 0950916

Browse files
[pre-commit] Add codespell, and fix some existing typos (#9912)
* Add the spellchecker codespell to the pre-commit configuration * Make the dict name generic now that it's used by multiple tools * Fix existing typos * Sort the custom dict
1 parent 3b4a7f9 commit 0950916

39 files changed

+105
-63
lines changed

.pre-commit-config.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ repos:
77
hooks:
88
- id: trailing-whitespace
99
exclude: tests(/\w*)*/functional/t/trailing_whitespaces.py|tests/pyreverse/data/.*.html|doc/data/messages/t/trailing-whitespace/bad.py
10+
# - id: file-contents-sorter # commented out because it does not preserve comments order
11+
# args: ["--ignore-case", "--unique"]
12+
# files: "custom_dict.txt"
1013
- id: end-of-file-fixer
1114
exclude: |
1215
(?x)^(
@@ -173,3 +176,10 @@ repos:
173176
- id: bandit
174177
args: ["-r", "-lll"]
175178
exclude: *fixtures
179+
- repo: https://github.com/codespell-project/codespell
180+
rev: v2.3.0
181+
hooks:
182+
- id: codespell
183+
args: ["--toml=pyproject.toml"]
184+
additional_dependencies:
185+
- tomli

.pyenchant_pylint_custom_dict.txt renamed to custom_dict.txt

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@ argumentparser
1313
argumentsparser
1414
argv
1515
ascii
16+
asend
1617
assignattr
1718
assignname
18-
ast
1919
AST
20+
ast
2021
astroid
2122
async
2223
asynccontextmanager
@@ -67,8 +68,8 @@ contextlib
6768
contextmanager
6869
contravariance
6970
contravariant
70-
cpython
7171
CPython
72+
cpython
7273
csv
7374
CVE
7475
cwd
@@ -126,8 +127,8 @@ formfeed
126127
fromlineno
127128
fullname
128129
func
129-
functiøn
130130
functiondef
131+
functiøn
131132
functools
132133
genexpr
133134
getattr
@@ -160,10 +161,11 @@ isfile
160161
isinstance
161162
isort
162163
iter
163-
itered
164164
iterable
165165
iterables
166+
itered
166167
iteritems
168+
iTerm
167169
jn
168170
jpg
169171
json
@@ -206,10 +208,10 @@ monkeypatch
206208
mro
207209
# Used so much that we need the abbreviation
208210
msg
211+
msg-template
209212
msgid
210213
msgids
211214
msgs
212-
msg-template
213215
mult
214216
multiline
215217
multiset
@@ -250,8 +252,8 @@ parens
250252
passthru
251253
pathlib
252254
patternerror
253-
positionals
254255
png
256+
positionals
255257
pragma
256258
pragma's
257259
pragmas
@@ -264,9 +266,9 @@ pyenchant
264266
pyfile
265267
pyi
266268
pylint
269+
pylint's
267270
pylintdict
268271
pylintrc
269-
pylint's
270272
pyproject
271273
pypy
272274
pyreverse
@@ -275,6 +277,7 @@ qname
275277
rawcheckers
276278
rc
277279
rcfile
280+
re-usable
278281
readlines
279282
recognise
280283
recurse
@@ -345,9 +348,9 @@ tomlkit
345348
toplevel
346349
towncrier
347350
tp
351+
truthey
348352
truthness
349353
truthy
350-
truthey
351354
tryexcept
352355
txt
353356
typecheck
@@ -362,8 +365,8 @@ unary
362365
unflattens
363366
unhandled
364367
unicode
365-
Uninferable
366368
uninferable
369+
Uninferable
367370
unittest
368371
unraisablehook
369372
untriggered

doc/development_guide/contributor_guide/profiling.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ and thus is displayed as being 0.
9090

9191
Often you are more interested in the cumulative time (per call). This refers to the time spent within the function
9292
and any of the functions it called or the functions they called (etc.). In our example, the ``visit_importfrom``
93-
method and all of its child-functions took a little over 8 seconds to exectute, with an execution time of
93+
method and all of its child-functions took a little over 8 seconds to execute, with an execution time of
9494
0.013 ms per call.
9595

9696
You can also search the ``profiler_stats`` for an individual function you want to check. For example

doc/development_guide/contributor_guide/tests/writing_test.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Unittest tests
2121

2222
Most other tests reside in the '/pylint/test' directory. These unittests can be used to test
2323
almost all functionality within Pylint. A good step before writing any new unittests is to look
24-
at some tests that test a similar funcitionality. This can often help write new tests.
24+
at some tests that test a similar functionality. This can often help write new tests.
2525

2626
If your new test requires any additional files you can put those in the
2727
``/pylint/test/regrtest_data`` directory. This is the directory we use to store any data needed for

doc/user_guide/checkers/features.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -918,16 +918,16 @@ Refactoring checker Messages
918918
Emitted when a single "return" or "return None" statement is found at the end
919919
of function or method definition. This statement can safely be removed
920920
because Python will implicitly return None
921-
:use-implicit-booleaness-not-comparison-to-string (C1804): *"%s" can be simplified to "%s", if it is striclty a string, as an empty string is falsey*
922-
Empty string are considered false in a boolean context. Following this check
923-
blindly in weakly typed code base can create hard to debug issues. If the
924-
value can be something else that is falsey but not a string (for example
925-
``None``, an empty sequence, or ``0``) the code will not be equivalent.
926921
:use-implicit-booleaness-not-comparison (C1803): *"%s" can be simplified to "%s", if it is strictly a sequence, as an empty %s is falsey*
927922
Empty sequences are considered false in a boolean context. Following this
928923
check blindly in weakly typed code base can create hard to debug issues. If
929924
the value can be something else that is falsey but not a sequence (for
930925
example ``None``, an empty string, or ``0``) the code will not be equivalent.
926+
:use-implicit-booleaness-not-comparison-to-string (C1804): *"%s" can be simplified to "%s", if it is strictly a string, as an empty string is falsey*
927+
Empty string are considered false in a boolean context. Following this check
928+
blindly in weakly typed code base can create hard to debug issues. If the
929+
value can be something else that is falsey but not a string (for example
930+
``None``, an empty sequence, or ``0``) the code will not be equivalent.
931931
:use-implicit-booleaness-not-comparison-to-zero (C1805): *"%s" can be simplified to "%s", if it is strictly an int, as 0 is falsey*
932932
0 is considered false in a boolean context. Following this check blindly in
933933
weakly typed code base can create hard to debug issues. If the value can be

doc/whatsnew/0/0.x.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1001,7 +1001,7 @@ Release date: 2004-10-19
10011001
* avoid importing analyzed modules !
10021002

10031003
* new Refactor and Convention message categories. Some Warnings have been
1004-
remaped into those new categories
1004+
remapped into those new categories
10051005

10061006
* added "similar", a tool to find copied and pasted lines of code,
10071007
both using a specific command line tool and integrated as a

doc/whatsnew/1/1.5.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ Release date: 2015-11-29
435435
* astroid.utils.LocalsVisitor was moved to pylint.pyreverse.LocalsVisitor.
436436

437437
* pylint.checkers.utils.excepts_import_error was removed.
438-
Use pylint.chekcers.utils.error_of_type instead.
438+
Use pylint.checkers.utils.error_of_type instead.
439439

440440
* Don't emit undefined-all-variables for nodes which can't be
441441
inferred (YES nodes).

doc/whatsnew/2/2.0/summary.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ Other Changes
221221
``pylint`` should be a bit faster as well.
222222

223223
We added a new flag, ``max_inferable_values`` on ``astroid.MANAGER`` for
224-
limitting the maximum amount of values that ``astroid`` can infer when inferring
224+
limiting the maximum amount of values that ``astroid`` can infer when inferring
225225
values. This change should improve the performance when dealing with large frameworks
226226
such as ``django``.
227227
You can also control this behaviour with ``pylint --limit-inference-results``

doc/whatsnew/2/2.13/summary.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ New checkers
8181
creates memory leaks by never letting the instance get garbage collected.
8282

8383
Closes #5670
84-
Clsoes #6180
84+
Closes #6180
8585

8686
Removed checkers
8787
================

doc/whatsnew/2/2.4/full.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ Release date: 2019-09-24
137137
Closes #2925
138138

139139
* ``useless-suppression`` check now ignores ``cyclic-import`` suppressions,
140-
which could lead to false postiives due to incomplete context at the time
140+
which could lead to false positives due to incomplete context at the time
141141
of the check.
142142

143143
Closes #3064

0 commit comments

Comments
 (0)