mirror of
https://github.com/crate-ci/typos.git
synced 2024-11-25 10:31:02 -05:00
ac46a6ba54
Typos primarily works off of identifiers and words. We have built-in support to detect constructs that span identifiers that should not be spell checked, like UUIDs, emails, domains, etc. This opens it up for for user-defined identifier-spanning constructs using regexes via `extend-ignore-re`. This works differently than any of the previous ways of ignoring thing because the regexes require extra parse passes. Under the assumption that (1) actual typos are rare and (2) number of files relying on `extend-ignore-re` are rare, we only do these extra parse passes when a typo is found, causing almost no performance hit in the expected case. While this could be used for more generic types of ignores, it isn't the most maintainable because it is separate from the source files in question. Ideally, we'd implement document settings / directives for these cases (#316).
35 lines
2.7 KiB
Markdown
35 lines
2.7 KiB
Markdown
# `typos` Reference
|
|
|
|
## Configuration
|
|
|
|
### Sources
|
|
|
|
Configuration is read from the following (in precedence order)
|
|
|
|
- Command line arguments
|
|
- File specified via `--config PATH`
|
|
- Search parents of specified file / directory for one of `typos.toml`, `_typos.toml`, or `.typos.toml`
|
|
|
|
### Config Fields
|
|
|
|
| Field | Argument | Format | Description |
|
|
|------------------------|-------------------|--------|-------------|
|
|
| files.binary | --binary | bool | Check binary files as text |
|
|
| files.extend-exclude | --exclude | list of strings | Typos-specific ignore globs (gitignore syntax) |
|
|
| files.ignore-hidden | --hidden | bool | Skip hidden files and directories. |
|
|
| files.ignore-files | --ignore | bool | Respect ignore files. |
|
|
| files.ignore-dot | --ignore-dot | bool | Respect .ignore files. |
|
|
| files.ignore-vcs | --ignore-vcs | bool | Respect ignore files in vcs directories. |
|
|
| files.ignore-global | --ignore-global | bool | Respect global ignore files. |
|
|
| files.ignore-parent | --ignore-parent | bool | Respect ignore files in parent directories. |
|
|
| default.binary | --binary | bool | Check binary files as text |
|
|
| default.check-filename | \- | bool | Verifying spelling in file names. |
|
|
| default.check-file | \- | bool | Verifying spelling in files. |
|
|
| default.unicode | --unicode | bool | Allow unicode characters in identifiers (and not just ASCII) |
|
|
| default.locale | --locale | en, en-us, en-gb, en-ca, en-au | English dialect to correct to. |
|
|
| default.extend-ignore-re | \- | list of [regexes](https://docs.rs/regex/latest/regex/index.html#syntax) | Custom uncorrectable sections (e.g. markdown code fences, PGP signatures, etc) |
|
|
| default.extend-identifiers | \- | table of strings | Corrections for [identifiers](./design.md#identifiers-and-words). When the correction is blank, the identifier is never valid. When the correction is the key, the identifier is always valid. |
|
|
| default.extend-ignore-identifiers-re | \- | list of [regexes](https://docs.rs/regex/latest/regex/index.html#syntax) | Pattern-match always-valid identifiers |
|
|
| default.extend-words | \- | table of strings | Corrections for [words](./design.md#identifiers-and-words). When the correction is blank, the word is never valid. When the correction is the key, the word is always valid. |
|
|
| type.\<name>.\<field> | \<varied> | \<varied> | See `default.` for child keys. Run with `--type-list` to see available `<name>`s |
|
|
| type.\<name>.extend-glob | \- | list of strings | File globs for matching `<name>` |
|