DC008: SpellingCheck

Overview

Property Value
ID DC008
Name SpellingCheck
Group documentation
Severity NOTE

Description

Checks for spelling errors in documentation using codespell.

Typos in documentation reduce professionalism and can confuse users. This check scans README.md and files in the docs/ directory for common spelling mistakes.

What it checks

The check runs codespell on:

  • README.md in the package root
  • All markdown files in docs/ directory

Results

  • PASSED: No spelling errors found
  • FAILED: One or more spelling errors detected
  • NOT_APPLICABLE: codespell is not installed, or no documentation files found

How to fix

Automatic fix

Run codespell with the --write-changes flag to automatically fix typos:

codespell --write-changes README.md docs/

Review the changes before committing:

git diff

Manual fix

Run codespell to see the errors:

codespell README.md docs/

Output format:

README.md:42: teh ==> the
docs/api.md:15: paramter ==> parameter
docs/guide.md:8: recieve ==> receive

Edit each file and fix the typos.

Ignore false positives

Some technical terms may be flagged incorrectly. Add them to an ignore list:

# Ignore specific words
codespell --ignore-words-list "aNd,anotherWord" README.md docs/

Or create an ignore file:

# .codespellignore
aNd
anotherWord

Then run:

codespell --ignore-words=.codespellignore README.md docs/

Configure in pyproject.toml

[tool.codespell]
skip = "*.lock,./build"
ignore-words-list = "aNd,anotherWord"

Installing codespell

pip

pip install codespell

uv

uv tool install codespell

As dev dependency

[project.optional-dependencies]
dev = [
    "codespell>=2.0.0",
]

Common typos codespell catches

Typo Correction
teh the
recieve receive
paramter parameter
occured occurred
seperate separate
enviroment environment
dependancy dependency
funciton function
arguement argument
retreive retrieve

Integration with CI

Add codespell to your CI pipeline:

GitHub Actions

- name: Check spelling
  run: |
    pip install codespell
    codespell README.md docs/

pre-commit

repos:
  - repo: https://github.com/codespell-project/codespell
    rev: v2.2.6
    hooks:
      - id: codespell
        args: [--ignore-words-list, "aNd"]

Configuration

Skip this check

[tool.pycmdcheck]
skip = ["DC008"]

CLI

pycmdcheck --skip DC008

Configure ignored words

[tool.pycmdcheck.checks.DC008]
ignore_words = ["aNd", "customWord"]

References