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.
Files changed (51) hide show
  1. codespell-2.4.0/.devcontainer/devcontainer.json +14 -0
  2. {codespell-2.2.6 → codespell-2.4.0}/.devcontainer/post_create.sh +2 -0
  3. codespell-2.4.0/.github/release.yml +5 -0
  4. {codespell-2.2.6 → codespell-2.4.0}/.github/workflows/codespell-private.yml +20 -14
  5. {codespell-2.2.6 → codespell-2.4.0}/.github/workflows/codespell-windows.yml +6 -3
  6. {codespell-2.2.6 → codespell-2.4.0}/.github/workflows/codespell.yml +1 -1
  7. codespell-2.4.0/.github/workflows/release.yml +58 -0
  8. {codespell-2.2.6 → codespell-2.4.0}/.gitignore +3 -0
  9. codespell-2.4.0/.mailmap +2 -0
  10. {codespell-2.2.6 → codespell-2.4.0}/PKG-INFO +69 -24
  11. {codespell-2.2.6 → codespell-2.4.0}/README.rst +63 -20
  12. {codespell-2.2.6 → codespell-2.4.0}/codespell.egg-info/PKG-INFO +69 -24
  13. {codespell-2.2.6 → codespell-2.4.0}/codespell.egg-info/SOURCES.txt +5 -0
  14. codespell-2.4.0/codespell_lib/__init__.py +4 -0
  15. {codespell-2.2.6 → codespell-2.4.0}/codespell_lib/__main__.py +3 -1
  16. {codespell-2.2.6 → codespell-2.4.0}/codespell_lib/_codespell.py +310 -190
  17. codespell-2.4.0/codespell_lib/_spellchecker.py +75 -0
  18. codespell-2.4.0/codespell_lib/_text_util.py +27 -0
  19. {codespell-2.2.6 → codespell-2.4.0}/codespell_lib/_version.py +2 -2
  20. {codespell-2.2.6 → codespell-2.4.0}/codespell_lib/data/dictionary.txt +7281 -135
  21. {codespell-2.2.6 → codespell-2.4.0}/codespell_lib/data/dictionary_code.txt +13 -6
  22. {codespell-2.2.6 → codespell-2.4.0}/codespell_lib/data/dictionary_en-GB_to_en-US.txt +73 -5
  23. codespell-2.4.0/codespell_lib/data/dictionary_informal.txt +19 -0
  24. {codespell-2.2.6 → codespell-2.4.0}/codespell_lib/data/dictionary_names.txt +2 -0
  25. {codespell-2.2.6 → codespell-2.4.0}/codespell_lib/data/dictionary_rare.txt +37 -3
  26. {codespell-2.2.6 → codespell-2.4.0}/codespell_lib/data/dictionary_usage.txt +2 -0
  27. codespell-2.4.0/codespell_lib/tests/data/en_GB-additional.wordlist +77 -0
  28. codespell-2.4.0/codespell_lib/tests/data/en_US-additional.wordlist +65 -0
  29. {codespell-2.2.6 → codespell-2.4.0}/codespell_lib/tests/test_basic.py +319 -49
  30. {codespell-2.2.6 → codespell-2.4.0}/codespell_lib/tests/test_dictionary.py +32 -36
  31. {codespell-2.2.6 → codespell-2.4.0}/pyproject.toml +50 -21
  32. codespell-2.4.0/tox.ini +19 -0
  33. codespell-2.2.6/.devcontainer/devcontainer.json +0 -14
  34. codespell-2.2.6/.github/workflows/release.yml +0 -58
  35. codespell-2.2.6/codespell_lib/__init__.py +0 -4
  36. codespell-2.2.6/codespell_lib/data/dictionary_informal.txt +0 -8
  37. codespell-2.2.6/codespell_lib/tests/data/en_GB-additional.wordlist +0 -36
  38. codespell-2.2.6/codespell_lib/tests/data/en_US-additional.wordlist +0 -27
  39. {codespell-2.2.6 → codespell-2.4.0}/.github/CODEOWNERS +0 -0
  40. {codespell-2.2.6 → codespell-2.4.0}/.github/dependabot.yml +0 -0
  41. {codespell-2.2.6 → codespell-2.4.0}/COPYING +0 -0
  42. {codespell-2.2.6 → codespell-2.4.0}/MANIFEST.in +0 -0
  43. {codespell-2.2.6 → codespell-2.4.0}/codespell.egg-info/dependency_links.txt +0 -0
  44. {codespell-2.2.6 → codespell-2.4.0}/codespell.egg-info/entry_points.txt +0 -0
  45. {codespell-2.2.6 → codespell-2.4.0}/codespell.egg-info/requires.txt +0 -0
  46. {codespell-2.2.6 → codespell-2.4.0}/codespell.egg-info/top_level.txt +0 -0
  47. {codespell-2.2.6 → codespell-2.4.0}/codespell_lib/data/__init__.py +0 -0
  48. {codespell-2.2.6 → codespell-2.4.0}/codespell_lib/data/linux-kernel.exclude +0 -0
  49. {codespell-2.2.6 → codespell-2.4.0}/codespell_lib/py.typed +0 -0
  50. {codespell-2.2.6 → codespell-2.4.0}/codespell_lib/tests/__init__.py +0 -0
  51. {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
+ }
@@ -1,3 +1,5 @@
1
+ git config --global --add safe.directory /workspaces/codespell
2
+
1
3
  sudo apt-get update
2
4
  sudo apt-get install -y libaspell-dev
3
5
 
@@ -0,0 +1,5 @@
1
+ changelog:
2
+ exclude:
3
+ authors:
4
+ - dependabot
5
+ - pre-commit-ci
@@ -12,31 +12,35 @@ jobs:
12
12
  test:
13
13
  env:
14
14
  REQUIRE_ASPELL: true
15
- RUFF_FORMAT: github
15
+ RUFF_OUTPUT_FORMAT: github
16
16
  # Make sure we're using the latest aspell dictionary
17
- runs-on: ubuntu-22.04
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
- - '3.8'
23
- - '3.9'
24
- - '3.10'
25
- - '3.11'
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: '3.10'
30
- no-toml: '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@v4
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@v3
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/*,*.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"
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@v4
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@v4
16
+ uses: actions/setup-python@v5
16
17
  with:
17
- python-version: '3.8'
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@v3
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 }}
@@ -1,4 +1,5 @@
1
1
  .coverage
2
+ .venv
2
3
  build
3
4
  dist
4
5
  ld
@@ -6,8 +7,10 @@ codespell.egg-info
6
7
  *.pyc
7
8
  *.orig
8
9
  .cache/
10
+ .coverage.*
9
11
  .mypy_cache/
10
12
  .pytest_cache/
13
+ .ruff_cache/
11
14
  codespell_lib/_version.py
12
15
  junit-results.xml
13
16
  *.egg-info/
@@ -0,0 +1,2 @@
1
+ Dimitri Papadopoulos Orfanos <3234522+DimitriPapadopoulos@users.noreply.github.com>
2
+ luzpaz <luzpaz@@users.noreply.github.com> <luzpaz@users.noreply.github.com>
@@ -1,9 +1,9 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: codespell
3
- Version: 2.2.6
4
- Summary: Codespell
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 v2
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 Words
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 ``wrod``.
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 a file
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 path can be specified via ``--toml <filename>``) file, and the
205
- ``[tool.codespell]`` entry will be used, but only if the tomli_ package
206
- is installed for versions of Python prior to 3.11. For example:
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
- These are both equivalent to running:
245
+ The above INI and TOML files are equivalent to running:
216
246
 
217
247
  .. code-block:: sh
218
248
 
219
- codespell --quiet-level 3 --count --skip "*.po,*.ts,./src/3rdParty,./src/Test"
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
- Any options specified in the command line will *override* options from the
233
- config files.
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
- `pre-commit <https://pre-commit.com/>`_ hook
238
- --------------------------------------------
282
+ pre-commit hook
283
+ ---------------
239
284
 
240
- codespell also works with `pre-commit`, using
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 Setup
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 Pull Requests
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/master/codespell_lib/data/dictionary.txt
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/master/codespell_lib/data
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 Words
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 ``wrod``.
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 a file
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 path can be specified via ``--toml <filename>``) file, and the
157
- ``[tool.codespell]`` entry will be used, but only if the tomli_ package
158
- is installed for versions of Python prior to 3.11. For example:
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
- These are both equivalent to running:
195
+ The above INI and TOML files are equivalent to running:
168
196
 
169
197
  .. code-block:: sh
170
198
 
171
- codespell --quiet-level 3 --count --skip "*.po,*.ts,./src/3rdParty,./src/Test"
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
- Any options specified in the command line will *override* options from the
185
- config files.
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
- `pre-commit <https://pre-commit.com/>`_ hook
190
- --------------------------------------------
232
+ pre-commit hook
233
+ ---------------
191
234
 
192
- codespell also works with `pre-commit`, using
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 Setup
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 Pull Requests
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/master/codespell_lib/data/dictionary.txt
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/master/codespell_lib/data
373
+ https://github.com/codespell-project/codespell/tree/main/codespell_lib/data
331
374
 
332
375
  License
333
376
  -------