codespell 2.2.6__tar.gz → 2.4.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- codespell-2.4.0/.devcontainer/devcontainer.json +14 -0
- {codespell-2.2.6 → codespell-2.4.0}/.devcontainer/post_create.sh +2 -0
- codespell-2.4.0/.github/release.yml +5 -0
- {codespell-2.2.6 → codespell-2.4.0}/.github/workflows/codespell-private.yml +20 -14
- {codespell-2.2.6 → codespell-2.4.0}/.github/workflows/codespell-windows.yml +6 -3
- {codespell-2.2.6 → codespell-2.4.0}/.github/workflows/codespell.yml +1 -1
- codespell-2.4.0/.github/workflows/release.yml +58 -0
- {codespell-2.2.6 → codespell-2.4.0}/.gitignore +3 -0
- codespell-2.4.0/.mailmap +2 -0
- {codespell-2.2.6 → codespell-2.4.0}/PKG-INFO +69 -24
- {codespell-2.2.6 → codespell-2.4.0}/README.rst +63 -20
- {codespell-2.2.6 → codespell-2.4.0}/codespell.egg-info/PKG-INFO +69 -24
- {codespell-2.2.6 → codespell-2.4.0}/codespell.egg-info/SOURCES.txt +5 -0
- codespell-2.4.0/codespell_lib/__init__.py +4 -0
- {codespell-2.2.6 → codespell-2.4.0}/codespell_lib/__main__.py +3 -1
- {codespell-2.2.6 → codespell-2.4.0}/codespell_lib/_codespell.py +310 -190
- codespell-2.4.0/codespell_lib/_spellchecker.py +75 -0
- codespell-2.4.0/codespell_lib/_text_util.py +27 -0
- {codespell-2.2.6 → codespell-2.4.0}/codespell_lib/_version.py +2 -2
- {codespell-2.2.6 → codespell-2.4.0}/codespell_lib/data/dictionary.txt +7281 -135
- {codespell-2.2.6 → codespell-2.4.0}/codespell_lib/data/dictionary_code.txt +13 -6
- {codespell-2.2.6 → codespell-2.4.0}/codespell_lib/data/dictionary_en-GB_to_en-US.txt +73 -5
- codespell-2.4.0/codespell_lib/data/dictionary_informal.txt +19 -0
- {codespell-2.2.6 → codespell-2.4.0}/codespell_lib/data/dictionary_names.txt +2 -0
- {codespell-2.2.6 → codespell-2.4.0}/codespell_lib/data/dictionary_rare.txt +37 -3
- {codespell-2.2.6 → codespell-2.4.0}/codespell_lib/data/dictionary_usage.txt +2 -0
- codespell-2.4.0/codespell_lib/tests/data/en_GB-additional.wordlist +77 -0
- codespell-2.4.0/codespell_lib/tests/data/en_US-additional.wordlist +65 -0
- {codespell-2.2.6 → codespell-2.4.0}/codespell_lib/tests/test_basic.py +319 -49
- {codespell-2.2.6 → codespell-2.4.0}/codespell_lib/tests/test_dictionary.py +32 -36
- {codespell-2.2.6 → codespell-2.4.0}/pyproject.toml +50 -21
- codespell-2.4.0/tox.ini +19 -0
- codespell-2.2.6/.devcontainer/devcontainer.json +0 -14
- codespell-2.2.6/.github/workflows/release.yml +0 -58
- codespell-2.2.6/codespell_lib/__init__.py +0 -4
- codespell-2.2.6/codespell_lib/data/dictionary_informal.txt +0 -8
- codespell-2.2.6/codespell_lib/tests/data/en_GB-additional.wordlist +0 -36
- codespell-2.2.6/codespell_lib/tests/data/en_US-additional.wordlist +0 -27
- {codespell-2.2.6 → codespell-2.4.0}/.github/CODEOWNERS +0 -0
- {codespell-2.2.6 → codespell-2.4.0}/.github/dependabot.yml +0 -0
- {codespell-2.2.6 → codespell-2.4.0}/COPYING +0 -0
- {codespell-2.2.6 → codespell-2.4.0}/MANIFEST.in +0 -0
- {codespell-2.2.6 → codespell-2.4.0}/codespell.egg-info/dependency_links.txt +0 -0
- {codespell-2.2.6 → codespell-2.4.0}/codespell.egg-info/entry_points.txt +0 -0
- {codespell-2.2.6 → codespell-2.4.0}/codespell.egg-info/requires.txt +0 -0
- {codespell-2.2.6 → codespell-2.4.0}/codespell.egg-info/top_level.txt +0 -0
- {codespell-2.2.6 → codespell-2.4.0}/codespell_lib/data/__init__.py +0 -0
- {codespell-2.2.6 → codespell-2.4.0}/codespell_lib/data/linux-kernel.exclude +0 -0
- {codespell-2.2.6 → codespell-2.4.0}/codespell_lib/py.typed +0 -0
- {codespell-2.2.6 → codespell-2.4.0}/codespell_lib/tests/__init__.py +0 -0
- {codespell-2.2.6 → codespell-2.4.0}/setup.cfg +0 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "Codespell Development Environment",
|
|
3
|
+
"image": "mcr.microsoft.com/devcontainers/python:1-3",
|
|
4
|
+
"customizations": {
|
|
5
|
+
"vscode": {
|
|
6
|
+
"extensions": [
|
|
7
|
+
"github.vscode-github-actions",
|
|
8
|
+
"ms-python.python",
|
|
9
|
+
"ms-python.vscode-pylance"
|
|
10
|
+
]
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"postCreateCommand": "bash .devcontainer/post_create.sh"
|
|
14
|
+
}
|
|
@@ -12,31 +12,35 @@ jobs:
|
|
|
12
12
|
test:
|
|
13
13
|
env:
|
|
14
14
|
REQUIRE_ASPELL: true
|
|
15
|
-
|
|
15
|
+
RUFF_OUTPUT_FORMAT: github
|
|
16
16
|
# Make sure we're using the latest aspell dictionary
|
|
17
|
-
runs-on: ubuntu-
|
|
17
|
+
runs-on: ubuntu-24.04-arm
|
|
18
|
+
timeout-minutes: 10
|
|
18
19
|
strategy:
|
|
19
20
|
fail-fast: false
|
|
20
21
|
matrix:
|
|
21
22
|
python-version:
|
|
22
|
-
-
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
-
-
|
|
23
|
+
- "3.8"
|
|
24
|
+
- "3.9"
|
|
25
|
+
- "3.10"
|
|
26
|
+
- "3.11"
|
|
27
|
+
- "3.12"
|
|
28
|
+
- "3.13"
|
|
26
29
|
no-toml:
|
|
27
|
-
-
|
|
30
|
+
- ""
|
|
28
31
|
include:
|
|
29
|
-
- python-version:
|
|
30
|
-
no-toml:
|
|
32
|
+
- python-version: "3.10"
|
|
33
|
+
no-toml: "no-toml"
|
|
31
34
|
name: ${{ matrix.python-version }} ${{ matrix.no-toml }}
|
|
32
35
|
steps:
|
|
33
36
|
- uses: actions/checkout@v4
|
|
34
37
|
with:
|
|
35
38
|
persist-credentials: false
|
|
36
39
|
- name: Setup python
|
|
37
|
-
uses: actions/setup-python@
|
|
40
|
+
uses: actions/setup-python@v5
|
|
38
41
|
with:
|
|
39
42
|
python-version: ${{ matrix.python-version }}
|
|
43
|
+
allow-prereleases: true
|
|
40
44
|
- run: sudo apt-get install libaspell-dev aspell-en
|
|
41
45
|
- name: Install dependencies
|
|
42
46
|
run: |
|
|
@@ -48,20 +52,22 @@ jobs:
|
|
|
48
52
|
- run: codespell --help
|
|
49
53
|
- run: codespell --version
|
|
50
54
|
- run: make check
|
|
51
|
-
- uses: codecov/codecov-action@
|
|
55
|
+
- uses: codecov/codecov-action@v5
|
|
56
|
+
with:
|
|
57
|
+
token: ${{ secrets.CODECOV_TOKEN }}
|
|
52
58
|
# tomli should not be required for the next two steps (and make sure it's not)
|
|
53
59
|
- run: pip uninstall -yq tomli
|
|
54
60
|
if: ${{ matrix.no-toml == 'no-toml' }}
|
|
55
|
-
- run: codespell --check-filenames --skip="./.git
|
|
61
|
+
- run: codespell --check-filenames --skip="./.git/*,./.pytest_cache/*,./junit-results.xml,*.pyc,./codespell_lib/tests/test_basic.py,./codespell_lib/data/*,./example/code.c,./build/lib/codespell_lib/tests/test_basic.py,./build/lib/codespell_lib/data/*,README.rst,*.egg-info/*,pyproject-codespell.precommit-toml,./.mypy_cache"
|
|
56
62
|
# this file has an error
|
|
57
63
|
- run: "! codespell codespell_lib/tests/test_basic.py"
|
|
58
64
|
|
|
59
|
-
|
|
60
65
|
make-check-dictionaries:
|
|
61
66
|
runs-on: ubuntu-latest
|
|
67
|
+
timeout-minutes: 10
|
|
62
68
|
steps:
|
|
63
69
|
- name: Setup Python
|
|
64
|
-
uses: actions/setup-python@
|
|
70
|
+
uses: actions/setup-python@v5
|
|
65
71
|
with:
|
|
66
72
|
python-version: 3.x
|
|
67
73
|
- uses: actions/checkout@v4
|
|
@@ -7,14 +7,15 @@ jobs:
|
|
|
7
7
|
test-windows:
|
|
8
8
|
name: Test Windows
|
|
9
9
|
runs-on: windows-latest
|
|
10
|
+
timeout-minutes: 10
|
|
10
11
|
steps:
|
|
11
12
|
- uses: actions/checkout@v4
|
|
12
13
|
with:
|
|
13
14
|
persist-credentials: false
|
|
14
15
|
- name: Setup python
|
|
15
|
-
uses: actions/setup-python@
|
|
16
|
+
uses: actions/setup-python@v5
|
|
16
17
|
with:
|
|
17
|
-
python-version:
|
|
18
|
+
python-version: "3.8"
|
|
18
19
|
- name: Install dependencies
|
|
19
20
|
run: |
|
|
20
21
|
python --version
|
|
@@ -24,4 +25,6 @@ jobs:
|
|
|
24
25
|
- run: codespell --help
|
|
25
26
|
- run: codespell --version
|
|
26
27
|
- run: pytest codespell_lib
|
|
27
|
-
- uses: codecov/codecov-action@
|
|
28
|
+
- uses: codecov/codecov-action@v5
|
|
29
|
+
with:
|
|
30
|
+
token: ${{ secrets.CODECOV_TOKEN }}
|
|
@@ -16,4 +16,4 @@ jobs:
|
|
|
16
16
|
with:
|
|
17
17
|
check_filenames: true
|
|
18
18
|
# When using this Action in other repos, the --skip option below can be removed
|
|
19
|
-
skip: "./.git,./codespell_lib/data,./example/code.c,test_basic.py,*.pyc,README.rst,pyproject-codespell.precommit-toml"
|
|
19
|
+
skip: "./.git,./codespell_lib/data,./example/code.c,test_basic.py,./codespell_lib/tests/data,*.pyc,README.rst,pyproject-codespell.precommit-toml"
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Upload a Python Package using Twine when a release is created
|
|
2
|
+
|
|
3
|
+
name: Build
|
|
4
|
+
on:
|
|
5
|
+
release:
|
|
6
|
+
types: [published]
|
|
7
|
+
push:
|
|
8
|
+
branches:
|
|
9
|
+
- main
|
|
10
|
+
pull_request:
|
|
11
|
+
branches:
|
|
12
|
+
- main
|
|
13
|
+
|
|
14
|
+
permissions:
|
|
15
|
+
contents: read
|
|
16
|
+
|
|
17
|
+
jobs:
|
|
18
|
+
package:
|
|
19
|
+
runs-on: ubuntu-latest
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/checkout@v4
|
|
22
|
+
with:
|
|
23
|
+
persist-credentials: false
|
|
24
|
+
- name: Set up Python
|
|
25
|
+
uses: actions/setup-python@v5
|
|
26
|
+
with:
|
|
27
|
+
python-version: "3.10"
|
|
28
|
+
- name: Install dependencies
|
|
29
|
+
run: |
|
|
30
|
+
python -m pip install --upgrade pip
|
|
31
|
+
pip install build twine
|
|
32
|
+
- name: Build package
|
|
33
|
+
run: python -m build
|
|
34
|
+
- name: Check package
|
|
35
|
+
run: twine check --strict dist/*
|
|
36
|
+
- name: Check env vars
|
|
37
|
+
run: |
|
|
38
|
+
echo "Triggered by: ${{ github.event_name }}"
|
|
39
|
+
- uses: actions/upload-artifact@v4
|
|
40
|
+
with:
|
|
41
|
+
name: dist
|
|
42
|
+
path: dist
|
|
43
|
+
|
|
44
|
+
# PyPI on release
|
|
45
|
+
pypi:
|
|
46
|
+
needs: package
|
|
47
|
+
runs-on: ubuntu-latest
|
|
48
|
+
if: github.event_name == 'release'
|
|
49
|
+
steps:
|
|
50
|
+
- uses: actions/download-artifact@v4
|
|
51
|
+
with:
|
|
52
|
+
name: dist
|
|
53
|
+
path: dist
|
|
54
|
+
- name: Publish to PyPI
|
|
55
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
56
|
+
with:
|
|
57
|
+
user: __token__
|
|
58
|
+
password: ${{ secrets.PYPI_API_TOKEN }}
|
codespell-2.4.0/.mailmap
ADDED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
2
|
Name: codespell
|
|
3
|
-
Version: 2.
|
|
4
|
-
Summary:
|
|
3
|
+
Version: 2.4.0
|
|
4
|
+
Summary: Fix common misspellings in text files
|
|
5
5
|
Author-email: Lucas De Marchi <lucas.de.marchi@gmail.com>
|
|
6
|
-
License: GPL
|
|
6
|
+
License: GPL-2.0-only
|
|
7
7
|
Project-URL: homepage, https://github.com/codespell-project/codespell
|
|
8
8
|
Project-URL: repository, https://github.com/codespell-project/codespell
|
|
9
9
|
Classifier: Intended Audience :: Developers
|
|
@@ -21,6 +21,8 @@ Classifier: Programming Language :: Python :: 3.8
|
|
|
21
21
|
Classifier: Programming Language :: Python :: 3.9
|
|
22
22
|
Classifier: Programming Language :: Python :: 3.10
|
|
23
23
|
Classifier: Programming Language :: Python :: 3.11
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
24
26
|
Requires-Python: >=3.8
|
|
25
27
|
Description-Content-Type: text/x-rst
|
|
26
28
|
License-File: COPYING
|
|
@@ -164,10 +166,10 @@ Want to know if a word you're proposing exists in codespell already? It is possi
|
|
|
164
166
|
|
|
165
167
|
You can select the optional dictionaries with the ``--builtin`` option.
|
|
166
168
|
|
|
167
|
-
Ignoring
|
|
169
|
+
Ignoring words
|
|
168
170
|
--------------
|
|
169
171
|
|
|
170
|
-
When ignoring false positives, note that spelling errors are *case-insensitive* but words to ignore are *case-sensitive*. For example, the dictionary entry ``wrod`` will also match the typo ``Wrod``, but to ignore it you must pass ``
|
|
172
|
+
When ignoring false positives, note that spelling errors are *case-insensitive* but words to ignore are *case-sensitive*. For example, the dictionary entry ``wrod`` will also match the typo ``Wrod``, but to ignore it you must pass ``Wrod``.
|
|
171
173
|
|
|
172
174
|
The words to ignore can be passed in two ways:
|
|
173
175
|
|
|
@@ -183,12 +185,34 @@ The words to ignore can be passed in two ways:
|
|
|
183
185
|
|
|
184
186
|
codespell -L word1,word2,word3,word4
|
|
185
187
|
|
|
188
|
+
Inline ignore
|
|
189
|
+
-------------
|
|
190
|
+
|
|
191
|
+
Some situation might require ignoring a specific word in a specific location. This can be achieved by adding a comment in the source code.
|
|
192
|
+
You can either ignore a single word or a list of words. The comment should be in the format of ``codespell:ignore <words>``.
|
|
193
|
+
Words should be separated by a comma.
|
|
194
|
+
|
|
195
|
+
1. ignore specific word:
|
|
196
|
+
|
|
197
|
+
.. code-block:: python
|
|
198
|
+
|
|
199
|
+
def wrod() # codespell:ignore wrod
|
|
200
|
+
pass
|
|
201
|
+
|
|
202
|
+
2. ignore multiple words:
|
|
203
|
+
|
|
204
|
+
.. code-block:: python
|
|
205
|
+
|
|
206
|
+
def wrod(wrods) # codespell:ignore
|
|
207
|
+
pass
|
|
208
|
+
|
|
186
209
|
Using a config file
|
|
187
210
|
-------------------
|
|
188
211
|
|
|
189
212
|
Command line options can also be specified in a config file.
|
|
190
213
|
|
|
191
|
-
When running ``codespell``, it will check in the current directory for
|
|
214
|
+
When running ``codespell``, it will check in the current directory for an
|
|
215
|
+
`INI file <https://en.wikipedia.org/wiki/INI_file>`_
|
|
192
216
|
named ``setup.cfg`` or ``.codespellrc`` (or a file specified via ``--config``),
|
|
193
217
|
containing an entry named ``[codespell]``. Each command line argument can
|
|
194
218
|
be specified in this file (without the preceding dashes), for example:
|
|
@@ -200,44 +224,65 @@ be specified in this file (without the preceding dashes), for example:
|
|
|
200
224
|
count =
|
|
201
225
|
quiet-level = 3
|
|
202
226
|
|
|
227
|
+
Python's
|
|
228
|
+
`configparser <https://docs.python.org/3/library/configparser.html#supported-ini-file-structure>`_
|
|
229
|
+
module defines the exact format of INI config files. For example,
|
|
230
|
+
comments are possible using ``;`` or ``#`` as the first character.
|
|
231
|
+
|
|
203
232
|
Codespell will also check in the current directory for a ``pyproject.toml``
|
|
204
|
-
(or a
|
|
205
|
-
|
|
206
|
-
|
|
233
|
+
file (or a file specified via ``--toml``), and the ``[tool.codespell]``
|
|
234
|
+
entry will be used. For versions of Python prior to 3.11, this requires
|
|
235
|
+
the tomli_ package. For example, here is the TOML equivalent of the
|
|
236
|
+
previous config file:
|
|
207
237
|
|
|
208
238
|
.. code-block:: toml
|
|
209
239
|
|
|
210
240
|
[tool.codespell]
|
|
211
241
|
skip = '*.po,*.ts,./src/3rdParty,./src/Test'
|
|
212
|
-
count =
|
|
242
|
+
count = true
|
|
213
243
|
quiet-level = 3
|
|
214
244
|
|
|
215
|
-
|
|
245
|
+
The above INI and TOML files are equivalent to running:
|
|
216
246
|
|
|
217
247
|
.. code-block:: sh
|
|
218
248
|
|
|
219
|
-
codespell --
|
|
249
|
+
codespell --skip "*.po,*.ts,./src/3rdParty,./src/Test" --count --quiet-level 3
|
|
220
250
|
|
|
221
251
|
If several config files are present, they are read in the following order:
|
|
222
252
|
|
|
223
|
-
#. ``pyproject.toml`` (only if the ``tomli`` library is available)
|
|
253
|
+
#. ``pyproject.toml`` (only if the ``tomli`` library is available for Python < 3.11)
|
|
224
254
|
#. ``setup.cfg``
|
|
225
255
|
#. ``.codespellrc``
|
|
226
256
|
#. any additional file supplied via ``--config``
|
|
227
257
|
|
|
228
258
|
If a codespell configuration is supplied in several of these files,
|
|
229
259
|
the configuration from the most recently read file overwrites previously
|
|
230
|
-
specified configurations.
|
|
260
|
+
specified configurations. Any options specified in the command line will
|
|
261
|
+
*override* options from the config files.
|
|
231
262
|
|
|
232
|
-
|
|
233
|
-
|
|
263
|
+
Values in a config file entry cannot start with a ``-`` character, so if
|
|
264
|
+
you need to do this, structure your entries like this:
|
|
265
|
+
|
|
266
|
+
.. code-block:: ini
|
|
267
|
+
|
|
268
|
+
[codespell]
|
|
269
|
+
dictionary = mydict,-
|
|
270
|
+
ignore-words-list = bar,-foo
|
|
271
|
+
|
|
272
|
+
instead of these invalid entries:
|
|
273
|
+
|
|
274
|
+
.. code-block:: ini
|
|
275
|
+
|
|
276
|
+
[codespell]
|
|
277
|
+
dictionary = -,mydict
|
|
278
|
+
ignore-words-list = -foo,bar
|
|
234
279
|
|
|
235
280
|
.. _tomli: https://pypi.org/project/tomli/
|
|
236
281
|
|
|
237
|
-
|
|
238
|
-
|
|
282
|
+
pre-commit hook
|
|
283
|
+
---------------
|
|
239
284
|
|
|
240
|
-
codespell also works with `pre-commit
|
|
285
|
+
codespell also works with `pre-commit <https://pre-commit.com/>`_, using
|
|
241
286
|
|
|
242
287
|
.. code-block:: yaml
|
|
243
288
|
|
|
@@ -291,7 +336,7 @@ applied directly, but should instead be manually inspected. E.g.:
|
|
|
291
336
|
|
|
292
337
|
clas->class, clash, disabled because of name clash in c++
|
|
293
338
|
|
|
294
|
-
Development
|
|
339
|
+
Development setup
|
|
295
340
|
-----------------
|
|
296
341
|
|
|
297
342
|
As suggested in the `Python Packaging User Guide`_, ensure ``pip``, ``setuptools``, and ``wheel`` are up to date before installing from source. Specifically you will need recent versions of ``setuptools`` and ``setuptools_scm``:
|
|
@@ -314,7 +359,7 @@ To run tests against the codebase run:
|
|
|
314
359
|
|
|
315
360
|
.. _Python Packaging User Guide: https://packaging.python.org/en/latest/tutorials/installing-packages/#requirements-for-installing-packages
|
|
316
361
|
|
|
317
|
-
Sending
|
|
362
|
+
Sending pull requests
|
|
318
363
|
---------------------
|
|
319
364
|
|
|
320
365
|
If you have a suggested typo that you'd like to see merged please follow these steps:
|
|
@@ -369,13 +414,13 @@ In the scenario where the user prefers not to follow the development version of
|
|
|
369
414
|
|
|
370
415
|
.. code-block:: sh
|
|
371
416
|
|
|
372
|
-
wget https://raw.githubusercontent.com/codespell-project/codespell/
|
|
417
|
+
wget https://raw.githubusercontent.com/codespell-project/codespell/main/codespell_lib/data/dictionary.txt
|
|
373
418
|
codespell -D dictionary.txt
|
|
374
419
|
|
|
375
420
|
The above simply downloads the latest ``dictionary.txt`` file and then by utilizing the ``-D`` flag allows the user to specify the freshly downloaded ``dictionary.txt`` as the custom dictionary instead of the default one.
|
|
376
421
|
|
|
377
422
|
You can also do the same thing for the other dictionaries listed here:
|
|
378
|
-
https://github.com/codespell-project/codespell/tree/
|
|
423
|
+
https://github.com/codespell-project/codespell/tree/main/codespell_lib/data
|
|
379
424
|
|
|
380
425
|
License
|
|
381
426
|
-------
|
|
@@ -116,10 +116,10 @@ Want to know if a word you're proposing exists in codespell already? It is possi
|
|
|
116
116
|
|
|
117
117
|
You can select the optional dictionaries with the ``--builtin`` option.
|
|
118
118
|
|
|
119
|
-
Ignoring
|
|
119
|
+
Ignoring words
|
|
120
120
|
--------------
|
|
121
121
|
|
|
122
|
-
When ignoring false positives, note that spelling errors are *case-insensitive* but words to ignore are *case-sensitive*. For example, the dictionary entry ``wrod`` will also match the typo ``Wrod``, but to ignore it you must pass ``
|
|
122
|
+
When ignoring false positives, note that spelling errors are *case-insensitive* but words to ignore are *case-sensitive*. For example, the dictionary entry ``wrod`` will also match the typo ``Wrod``, but to ignore it you must pass ``Wrod``.
|
|
123
123
|
|
|
124
124
|
The words to ignore can be passed in two ways:
|
|
125
125
|
|
|
@@ -135,12 +135,34 @@ The words to ignore can be passed in two ways:
|
|
|
135
135
|
|
|
136
136
|
codespell -L word1,word2,word3,word4
|
|
137
137
|
|
|
138
|
+
Inline ignore
|
|
139
|
+
-------------
|
|
140
|
+
|
|
141
|
+
Some situation might require ignoring a specific word in a specific location. This can be achieved by adding a comment in the source code.
|
|
142
|
+
You can either ignore a single word or a list of words. The comment should be in the format of ``codespell:ignore <words>``.
|
|
143
|
+
Words should be separated by a comma.
|
|
144
|
+
|
|
145
|
+
1. ignore specific word:
|
|
146
|
+
|
|
147
|
+
.. code-block:: python
|
|
148
|
+
|
|
149
|
+
def wrod() # codespell:ignore wrod
|
|
150
|
+
pass
|
|
151
|
+
|
|
152
|
+
2. ignore multiple words:
|
|
153
|
+
|
|
154
|
+
.. code-block:: python
|
|
155
|
+
|
|
156
|
+
def wrod(wrods) # codespell:ignore
|
|
157
|
+
pass
|
|
158
|
+
|
|
138
159
|
Using a config file
|
|
139
160
|
-------------------
|
|
140
161
|
|
|
141
162
|
Command line options can also be specified in a config file.
|
|
142
163
|
|
|
143
|
-
When running ``codespell``, it will check in the current directory for
|
|
164
|
+
When running ``codespell``, it will check in the current directory for an
|
|
165
|
+
`INI file <https://en.wikipedia.org/wiki/INI_file>`_
|
|
144
166
|
named ``setup.cfg`` or ``.codespellrc`` (or a file specified via ``--config``),
|
|
145
167
|
containing an entry named ``[codespell]``. Each command line argument can
|
|
146
168
|
be specified in this file (without the preceding dashes), for example:
|
|
@@ -152,44 +174,65 @@ be specified in this file (without the preceding dashes), for example:
|
|
|
152
174
|
count =
|
|
153
175
|
quiet-level = 3
|
|
154
176
|
|
|
177
|
+
Python's
|
|
178
|
+
`configparser <https://docs.python.org/3/library/configparser.html#supported-ini-file-structure>`_
|
|
179
|
+
module defines the exact format of INI config files. For example,
|
|
180
|
+
comments are possible using ``;`` or ``#`` as the first character.
|
|
181
|
+
|
|
155
182
|
Codespell will also check in the current directory for a ``pyproject.toml``
|
|
156
|
-
(or a
|
|
157
|
-
|
|
158
|
-
|
|
183
|
+
file (or a file specified via ``--toml``), and the ``[tool.codespell]``
|
|
184
|
+
entry will be used. For versions of Python prior to 3.11, this requires
|
|
185
|
+
the tomli_ package. For example, here is the TOML equivalent of the
|
|
186
|
+
previous config file:
|
|
159
187
|
|
|
160
188
|
.. code-block:: toml
|
|
161
189
|
|
|
162
190
|
[tool.codespell]
|
|
163
191
|
skip = '*.po,*.ts,./src/3rdParty,./src/Test'
|
|
164
|
-
count =
|
|
192
|
+
count = true
|
|
165
193
|
quiet-level = 3
|
|
166
194
|
|
|
167
|
-
|
|
195
|
+
The above INI and TOML files are equivalent to running:
|
|
168
196
|
|
|
169
197
|
.. code-block:: sh
|
|
170
198
|
|
|
171
|
-
codespell --
|
|
199
|
+
codespell --skip "*.po,*.ts,./src/3rdParty,./src/Test" --count --quiet-level 3
|
|
172
200
|
|
|
173
201
|
If several config files are present, they are read in the following order:
|
|
174
202
|
|
|
175
|
-
#. ``pyproject.toml`` (only if the ``tomli`` library is available)
|
|
203
|
+
#. ``pyproject.toml`` (only if the ``tomli`` library is available for Python < 3.11)
|
|
176
204
|
#. ``setup.cfg``
|
|
177
205
|
#. ``.codespellrc``
|
|
178
206
|
#. any additional file supplied via ``--config``
|
|
179
207
|
|
|
180
208
|
If a codespell configuration is supplied in several of these files,
|
|
181
209
|
the configuration from the most recently read file overwrites previously
|
|
182
|
-
specified configurations.
|
|
210
|
+
specified configurations. Any options specified in the command line will
|
|
211
|
+
*override* options from the config files.
|
|
183
212
|
|
|
184
|
-
|
|
185
|
-
|
|
213
|
+
Values in a config file entry cannot start with a ``-`` character, so if
|
|
214
|
+
you need to do this, structure your entries like this:
|
|
215
|
+
|
|
216
|
+
.. code-block:: ini
|
|
217
|
+
|
|
218
|
+
[codespell]
|
|
219
|
+
dictionary = mydict,-
|
|
220
|
+
ignore-words-list = bar,-foo
|
|
221
|
+
|
|
222
|
+
instead of these invalid entries:
|
|
223
|
+
|
|
224
|
+
.. code-block:: ini
|
|
225
|
+
|
|
226
|
+
[codespell]
|
|
227
|
+
dictionary = -,mydict
|
|
228
|
+
ignore-words-list = -foo,bar
|
|
186
229
|
|
|
187
230
|
.. _tomli: https://pypi.org/project/tomli/
|
|
188
231
|
|
|
189
|
-
|
|
190
|
-
|
|
232
|
+
pre-commit hook
|
|
233
|
+
---------------
|
|
191
234
|
|
|
192
|
-
codespell also works with `pre-commit
|
|
235
|
+
codespell also works with `pre-commit <https://pre-commit.com/>`_, using
|
|
193
236
|
|
|
194
237
|
.. code-block:: yaml
|
|
195
238
|
|
|
@@ -243,7 +286,7 @@ applied directly, but should instead be manually inspected. E.g.:
|
|
|
243
286
|
|
|
244
287
|
clas->class, clash, disabled because of name clash in c++
|
|
245
288
|
|
|
246
|
-
Development
|
|
289
|
+
Development setup
|
|
247
290
|
-----------------
|
|
248
291
|
|
|
249
292
|
As suggested in the `Python Packaging User Guide`_, ensure ``pip``, ``setuptools``, and ``wheel`` are up to date before installing from source. Specifically you will need recent versions of ``setuptools`` and ``setuptools_scm``:
|
|
@@ -266,7 +309,7 @@ To run tests against the codebase run:
|
|
|
266
309
|
|
|
267
310
|
.. _Python Packaging User Guide: https://packaging.python.org/en/latest/tutorials/installing-packages/#requirements-for-installing-packages
|
|
268
311
|
|
|
269
|
-
Sending
|
|
312
|
+
Sending pull requests
|
|
270
313
|
---------------------
|
|
271
314
|
|
|
272
315
|
If you have a suggested typo that you'd like to see merged please follow these steps:
|
|
@@ -321,13 +364,13 @@ In the scenario where the user prefers not to follow the development version of
|
|
|
321
364
|
|
|
322
365
|
.. code-block:: sh
|
|
323
366
|
|
|
324
|
-
wget https://raw.githubusercontent.com/codespell-project/codespell/
|
|
367
|
+
wget https://raw.githubusercontent.com/codespell-project/codespell/main/codespell_lib/data/dictionary.txt
|
|
325
368
|
codespell -D dictionary.txt
|
|
326
369
|
|
|
327
370
|
The above simply downloads the latest ``dictionary.txt`` file and then by utilizing the ``-D`` flag allows the user to specify the freshly downloaded ``dictionary.txt`` as the custom dictionary instead of the default one.
|
|
328
371
|
|
|
329
372
|
You can also do the same thing for the other dictionaries listed here:
|
|
330
|
-
https://github.com/codespell-project/codespell/tree/
|
|
373
|
+
https://github.com/codespell-project/codespell/tree/main/codespell_lib/data
|
|
331
374
|
|
|
332
375
|
License
|
|
333
376
|
-------
|