Scroll to navigation

CODESPELL(1) User Commands CODESPELL(1)

NAME

codespell - detect spelling mistakes in source code

SYNOPSIS

codespell [OPTIONS] [file1 file2 ... fileN]

DESCRIPTION

codespell is designed to find and fix common misspellings in text files. It is designed primarily for checking misspelled words in source code, but it can be used with other files as well.

usage: codespell [-h] [--version] [-d] [-c] [-w] [-D DICTIONARY]

[--builtin BUILTIN-LIST] [--ignore-regex IGNORE_REGEX] [-I FILES] [-L WORDS] [--uri-ignore-words-list WORDS] [-r REGEX] [--uri-regex URI_REGEX] [-s] [--count] [-S SKIP] [-x FILES] [-i INTERACTIVE] [-q QUIET_LEVEL] [-e] [-f] [-H] [-A LINES] [-B LINES] [-C LINES] [--stdin-single-line] [--config CONFIG] [--toml TOML] [files ...]

positional arguments:

files or directories to check

options:

show this help message and exit
show program's version number and exit
disable colors, even when printing to terminal
enable colors, even when not printing to terminal
write changes in place if possible
comma-separated list of custom dictionary files that contain spelling corrections. If this flag is not specified or equals "-" then the default dictionary is used.
comma-separated list of builtin dictionaries to include (when "-D -" or no "-D" is passed). Current options are: - 'clear' for unambiguous errors - 'rare' for rare (but valid) words that are likely to
- 'informal' for making informal words more formal - 'usage' for replacing phrasing with recommended
- 'code' for words from code and/or mathematics that
uint)
- 'names' for valid proper names that might be typos
- 'en-GB_to_en-US' for corrections from en-GB to en-US The default is 'clear,rare'.
regular expression that is used to find patterns to ignore by treating as whitespace. When writing regular expressions, consider ensuring there are boundary nonword chars, e.g., "\bmatch\b". Defaults to empty/disabled.
comma-separated list of files that contain words to be ignored by codespell. Files must contain 1 word per line. Words are case sensitive based on how they are written in the dictionary file.
comma-separated list of words to be ignored by codespell. Words are case sensitive based on how they are written in the dictionary file.
comma-separated list of words to be ignored by codespell in URIs and emails only. Words are case sensitive based on how they are written in the dictionary file. If set to "*", all misspelling in URIs and emails will be ignored.
regular expression that is used to find words. By default any alphanumeric character, the underscore, the hyphen, and the apostrophe are used to build words. This option cannot be specified together with --write-changes.
regular expression that is used to find URIs and emails. A default expression is provided.
print summary of fixes
print the number of errors as the last line of stderr
comma-separated list of files to skip. It accepts globs as well. E.g.: if you want codespell to skip .eps and .txt files, you'd give "*.eps,*.txt" to this option.
ignore whole lines that match those in the commaseparated list of files EXCLUDE. The lines in these files should match the to-be-excluded lines exactly
set interactive mode when writing changes: - 0: no interactivity. - 1: ask for confirmation. - 2: ask user to choose one fix when more than one is
- 3: both 1 and 2
bitmask that allows suppressing messages: - 0: print all messages. - 1: disable warnings about wrong encoding. - 2: disable warnings about binary files. - 4: omit warnings about automatic fixes that were
- 8: don't print anything for non-automatic fixes. - 16: don't print the list of fixed files. - 32: don't print configuration files. As usual with bitmasks, these levels can be combined; e.g. use 3 for levels 1+2, 7 for 1+2+4, 23 for 1+2+4+16, etc. The default mask is 34.
use chardet to detect the encoding of each file. This can slow down codespell, but is more reliable in detecting encodings other than utf-8, iso8859-1, and ascii.
check file names as well
check hidden files and directories (those starting with ".") as well.
print LINES of trailing context
print LINES of leading context
print LINES of surrounding context
output just a single line for each misspelling in stdin mode
path to config file.
path to a pyproject.toml file.

AUTHOR

Lucas De Marchi <lucas.de.marchi@gmail.com>

SEE ALSO

https://github.com/codespell-project/codespell

September 2024 codespell 2.3.0