codespell
Find and fix spelling errors in code
TLDR
Check for typos in all text files in the current directory, recursively
Correct all typos found in-place
Skip files with names that match the specified pattern (accepts a comma-separated list of patterns using wildcards)
Use a custom dictionary file when checking (--dictionary can be used multiple times)
Do not check words that are listed in the specified file
Do not check the specified words
Print 3 lines of [C]ontext around, [B]efore, or [A]fter each match
Check file names for typos, in addition to file contents
SYNOPSIS
codespell [OPTION]... [FILE]...
PARAMETERS
-h, --help
show help message and exit
-v, --version
show version and exit
-q INT, --quiet=INT
quietness level (0=verbose, 1=normal, 2=errors only)
-s STR, --skip=STR
comma-separated files/paths to skip
--skip-list=STR
comma-separated words to skip entirely
-d STR, --disable=STR
comma-separated checks to disable
-e STR, --enable=STR
comma-separated checks to enable
-c FILE, --config=FILE
path to config file
-f FILE, --file-list=FILE
file listing paths to check
-S DIR, --skip-dir=DIR
comma-separated directories to skip
-i INT, --ignore-lines=INT
ignore INT lines of context around errors
-w, --write-changes
write fixes directly to files
-x STR, --exclude=STR
comma-separated files/paths to exclude
-C DIR, --check-dir=DIR
recursively check directory
-L STR, --local-dict=STR
path to custom dictionary file
--hardcase
case-sensitive checking
--ignore-words=STR
comma-separated words to ignore
-D DIR, --dictionary=DIR
directory with dictionary files
-I FILE, --ignore-file=FILE
file of words to ignore
-A, --stop-at-first-error
stop after first error
--check-filenames
check filenames for misspellings
--check-hidden
include hidden directories
-j INT, --jobs=INT
number of parallel jobs
DESCRIPTION
Codespell is a fast, lightweight spell-checking tool optimized for source code, documentation, and commit messages.
Unlike general spell checkers, it handles programming idioms like camelCase identifiers, common typos in strings/comments, and technical terms from large codebases (e.g., Linux kernel, Mozilla).
Key features include: built-in dictionaries for code-specific words; recursive directory scanning; parallel processing with -j; interactive corrections; direct file writes with -w; configurable ignores/excludes; and CI/CD integration.
It reports misspellings with line numbers, suggested fixes, and context, ignoring case by default and filenames unless specified. Widely used in open-source projects for quality gates, reducing embarrassing typos in production code.
(~150 words)
CAVEATS
Python-based (requires Python 3); may false-positive rare technical terms; update dictionaries regularly for accuracy; not a full linter.
INSTALLATION
Via pip: pip install codespell
Debian/Ubuntu: apt install codespell
CONFIG FILE
INI-style ~/.codespellrc or --config; sections for ignores, dictionaries.
DICTIONARIES
Built-in: en, code-us, linux, etc. List via codespell -l; customize with --local-dict.
HISTORY
Created by Lucas De Marchi in 2012 as a Python script. Gained traction in 2016 with Linux kernel adoption for spell-checking patches. Now maintained by community, used in GNOME, Rust, Python projects; version 2.x added parallelization and better configs.


