Source code spell checker
open sourceMIT OR Apache-2.0self-hostablefree
typos finds and corrects spelling mistakes in source code, fast enough to run on monorepos and with few enough false positives to run unattended on pull requests. Instead of flagging every word missing from a dictionary, it keeps a list of known misspellings and their corrections, splits identifiers into words, and skips things like hashes. typos reports mistakes and typos --write-changes fixes them; ambiguous corrections are only reported. A _typos.toml file marks names and identifiers as valid or excludes files, and it can emit diffs or JSON lines for custom integrations. It ships as a single Rust binary (cargo, Homebrew, Conda, pacman or prebuilt downloads), a GitHub Action and a pre-commit hook, and is dual-licensed MIT or Apache-2.0.
Problems it solves
- catch spelling mistakes in variable names, comments and docs before they get merged
- a spell checker for code that doesn't drown me in false positives on identifiers
- fail the CI build when a pull request introduces a typo
- automatically fix common misspellings across a whole monorepo
- spell check camelCase and snake_case identifiers by splitting them into words
- run a fast spell checker as a pre-commit hook
- codespell is too slow on our large repository
- ignore people's names and acronyms that look like typos with a config file
- get typo findings as JSON so I can feed them into my own tooling
Features
- finds and corrects misspellings in source code, file names and identifiers
- low false positives: corrects known misspellings instead of flagging unknown words
- --write-changes fixes typos in place; ambiguous ones are only reported
- _typos.toml config to accept words and identifiers, regex ignores and file excludes
- per-file-type settings, including checking file names only
- stdin and stdout mode, --diff output and --format json
- debugging commands to list files, identifiers and words it sees
- GitHub Action and pre-commit hook
- installs via cargo, Homebrew, Conda, pacman or prebuilt binaries
Capabilities
| Has a command line tool | plan not known |
|---|
Alternatives
The same job
These do what typos does.
- CSpell A Spell Checker for Code!