Skip to content

fix: move codespell config to toml #602

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ repos:
hooks:
- id: codespell
exclude: ^Gemfile\.lock$
args: ["-Lnd", "-w"]
additional_dependencies:
- tomli; python_version<'3.11'
args: ["-w"]

- repo: local
hooks:
Expand Down
20 changes: 9 additions & 11 deletions docs/pages/guides/style.md
Original file line number Diff line number Diff line change
Expand Up @@ -666,21 +666,23 @@ than a list of "valid" words. To use:
rev: "v2.4.1"
hooks:
- id: codespell
args: ["-L", "sur,nd"]
additional_dependencies:
- tomli; python_version<'3.11'
```

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

```ini
[codespell]
ignore-words-list = sur,nd
[tool.codespell]
ignore-words-list = ["sur", "nd"]
```

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

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

You can also add the `-w` flag to have it automatically correct errors - this is
very helpful to quickly make corrections if you have a lot of them when first
adding the check.

## PyGrep hooks

{% rr PC170 %} This is a repository with a
Expand Down
5 changes: 5 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -188,3 +188,8 @@ ignore = [

[tool.repo-review.ignore]
RTD103 = "Using Ruby instead of Python for docs"

[tool.codespell]
ignore-words-list = [
"nd",
]
2 changes: 2 additions & 0 deletions {{cookiecutter.project_name}}/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ repos:
rev: "v2.4.1"
hooks:
- id: codespell
additional_dependencies:
- tomli; python_version<'3.11'

- repo: https://github.com/shellcheck-py/shellcheck-py
rev: "v0.10.0.1"
Expand Down
Loading