diff --git a/README.md b/README.md index dad459903..a6e923ae9 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ Dual-licensed under [MIT](LICENSE-MIT) or [Apache 2.0](LICENSE-APACHE) - [pre-commit](docs/pre-commit.md) - [Custom](#custom) - [Debugging](#debugging) -- [Reference](docs/reference.md) +- [Configuration](docs/reference.md) - [FAQ](#faq) - [Comparison with other spell checkers](docs/comparison.md) - [Projects using typos](https://github.com/crate-ci/typos/wiki) @@ -103,6 +103,22 @@ If you need some more flexibility, you can completely exclude some files from co extend-exclude = ["localized/*.po"] ``` +### Supported config files + +The default option is setting the configuration in `typos.toml`, `_typos.toml` or `.typos.toml`. + +In addition, you can set the same configuration with standard python's config file `pyproject.toml` by adding `[tool.typos.xyz]` where the `xyz` is the same as in default `_typos.toml` so the sample configuration above will be: +```toml +[tool.typos.default] +extend-ignore-identifiers-re = ["AttributeID.*Supress.*"] + +[tool.typos.default.extend-identifiers] +AttributeIDSupressMenu = "AttributeIDSupressMenu" + +[tool.typos.default.extend-words] +teh = "teh" +``` + ### Integrations - [GitHub Actions](docs/github-action.md) diff --git a/docs/reference.md b/docs/reference.md index 4b7e79285..d9572914e 100644 --- a/docs/reference.md +++ b/docs/reference.md @@ -14,27 +14,27 @@ Configuration is read from the following (in precedence order) ### 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.\.\ | \ | \ | See `default.` for child keys. Run with `--type-list` to see available ``s | -| type.\.extend-glob | \- | list of strings | File globs for matching `` | +| 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.\.\]` | \ | \ | See `default.` for child keys. Run with `--type-list` to see available ``s | +| `[type.\.extend-glob]` | \- | `list` of strings | File globs for matching `` | Common `extend-ignore-identifiers-re`: - SSL Cipher suites: `"\\bTLS_[A-Z0-9_]+(_anon_[A-Z0-9_]+)?\\b"`