Skip to content

Commit 8734366

Browse files
fix: move codespell config to toml (#602)
* fix: move codespell config to toml Signed-off-by: Henry Schreiner <[email protected]> * style: pre-commit fixes --------- Signed-off-by: Henry Schreiner <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 80442b4 commit 8734366

File tree

4 files changed

+19
-12
lines changed

4 files changed

+19
-12
lines changed

.pre-commit-config.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,9 @@ repos:
7070
hooks:
7171
- id: codespell
7272
exclude: ^Gemfile\.lock$
73-
args: ["-Lnd", "-w"]
73+
additional_dependencies:
74+
- tomli; python_version<'3.11'
75+
args: ["-w"]
7476

7577
- repo: local
7678
hooks:

docs/pages/guides/style.md

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -666,21 +666,23 @@ than a list of "valid" words. To use:
666666
rev: "v2.4.1"
667667
hooks:
668668
- id: codespell
669-
args: ["-L", "sur,nd"]
669+
additional_dependencies:
670+
- tomli; python_version<'3.11'
670671
```
671672

672673
You can list allowed spellings in a comma separated string passed to `-L` (or
673674
`--ignore-words-list` - usually it is better to use long options when you are
674-
not typing things live). The example above will allow "Big Sur" and "ND". You
675-
can instead use a comma separated list in `setup.cfg` or `.codespellrc`:
675+
not typing things live). The example below will allow "Big Sur" and "ND". Here's
676+
an example of `pyproject.toml` configuration:
676677

677678
```ini
678-
[codespell]
679-
ignore-words-list = sur,nd
679+
[tool.codespell]
680+
ignore-words-list = ["sur", "nd"]
680681
```
681682

682-
If you add the `toml` extra (or use Python 3.11+), you can instead put a
683-
`tool.codespell` section in your `pyproject.toml`.
683+
You can also add the `-w` flag to have it automatically correct errors - this is
684+
very helpful to quickly make corrections if you have a lot of them when first
685+
adding the check. `uvx codespell -w` will quickly correct all non-hidden files.
684686

685687
You can also use a local pygrep check to eliminate common capitalization errors,
686688
such as the one below:
@@ -695,10 +697,6 @@ such as the one below:
695697
exclude: .pre-commit-config.yaml
696698
```
697699

698-
You can also add the `-w` flag to have it automatically correct errors - this is
699-
very helpful to quickly make corrections if you have a lot of them when first
700-
adding the check.
701-
702700
## PyGrep hooks
703701

704702
{% rr PC170 %} This is a repository with a

pyproject.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,3 +188,8 @@ ignore = [
188188

189189
[tool.repo-review.ignore]
190190
RTD103 = "Using Ruby instead of Python for docs"
191+
192+
[tool.codespell]
193+
ignore-words-list = [
194+
"nd",
195+
]

{{cookiecutter.project_name}}/.pre-commit-config.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ repos:
7171
rev: "v2.4.1"
7272
hooks:
7373
- id: codespell
74+
additional_dependencies:
75+
- tomli; python_version<'3.11'
7476

7577
- repo: https://github.com/shellcheck-py/shellcheck-py
7678
rev: "v0.10.0.1"

0 commit comments

Comments
 (0)