LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

typos

Low false-positive source code spell checker

TLDR

Check the current directory for misspellings
$ typos
copy
Check a specific file or directory
$ typos [path/to/file_or_dir]
copy
Automatically fix detected typos in place
$ typos --write-changes
copy
Preview suggested fixes as a unified diff
$ typos --diff
copy
Output results as JSON for tooling integration
$ typos --format json
copy
Include hidden files and ignored paths
$ typos --hidden --no-ignore
copy
Use a specific English locale
$ typos --locale en-gb
copy
Check using a custom configuration file
$ typos --config [path/to/_typos.toml]
copy

SYNOPSIS

typos [OPTIONS] [PATH...]

DESCRIPTION

typos is a fast spell checker tailored for source code. It walks the file tree, respects .gitignore rules by default, and flags misspelled words inside identifiers, comments, and strings while keeping false positives low enough to run in pull-request gates.Detection is driven by a curated dictionary of common code typos rather than a full natural-language dictionary, so it tolerates camelCase, snake_case, abbreviations, and domain-specific jargon. Findings can be printed, written back to disk with --write-changes, or emitted as JSON for editors and CI tooling.The checker also understands per-language conventions through a file-type map, can be tuned for British or American English with --locale, and respects per-project overrides defined in \_typos.toml, typos.toml, Cargo.toml, or pyproject.toml.

PARAMETERS

-w, --write-changes

Apply the suggested corrections to files instead of only reporting them.
--diff
Print proposed changes as a unified diff without modifying files.
--format FORMAT
Output format: silent, brief, long (default), json.
--config FILE
Path to a configuration file (typically \typos.toml_).
--locale LOCALE
Set the English dialect: en, en-us, en-gb, en-ca, en-au.
--exclude GLOB
Skip paths matching the given gitignore-style pattern.
--force-exclude
Force excluded paths to be skipped even when given explicitly on the command line.
--hidden
Include hidden files and directories.
--no-ignore
Do not respect any ignore files.
--no-ignore-vcs
Do not respect ignore files inside version-control directories.
--no-ignore-dot
Do not respect .ignore files.
--no-ignore-global
Do not respect global ignore files.
--no-ignore-parent
Do not respect ignore files from parent directories.
--binary
Also check binary files as if they were text.
--no-unicode
Restrict identifiers to ASCII.
--type-list
Print all known file types and their globs.
--type TYPE
Only check files of the given type (e.g. rust, py).
--type-not TYPE
Exclude files of the given type.
-V, --version
Print the version and exit.
-h, --help
Print help.

CONFIGURATION

Project configuration lives in \_typos.toml (or a [tool.typos] table inside pyproject.toml / Cargo.toml). Common sections:

$ [default]
locale = "en-us"
extend-ignore-re = ["(?Rm)^.*#\\s*spellchecker:disable-line$"]

[default.extend-words]
mater = "mater"

[default.extend-identifiers]
HashMa = "HashMap"

[type.rust]
extend-glob = ["*.rs"]
check-file = true
copy
The [default.extend-words] and [default.extend-identifiers] tables either remap typos to their correct spelling or mark a word/identifier as valid by mapping it to itself.

CAVEATS

typos is not a general English spell checker: it only flags words from its built-in typo dictionary, so it will miss many real misspellings outside that list. Conversely, project-specific names, acronyms, and non-English words may still trip it up and require entries in \_typos.toml. Writing changes with --write-changes modifies files in place: review with --diff first, especially when the dictionary is unfamiliar.

HISTORY

typos was created by Ed Page (crate-ci) and released as an open-source project in 2019, written in Rust. It was designed to be fast and accurate enough to run on every commit in large monorepos, drawing inspiration from earlier code-oriented spell checkers like misspell and scspell while focusing on a curated, low false-positive corpus.

SEE ALSO

Copied to clipboard
Kai