mirror of
https://github.com/crate-ci/typos.git
synced 2024-12-22 15:42:23 -05:00
docs(ref): Add dotall specifier to block ignore
Needed a `(?s)` to match multiple enclosed newlines. And added a non-greedy modifier and matching test to prevent double blocks from causing intermediate lines to be ignored: ```shell # spellchecker:off should be ignored # spellchecker:on should not be ignored # without non-greedy, this is also ignored # spellchecker:off should be ignored # spellchecker:on ```
This commit is contained in:
parent
d9da472373
commit
c7a34fcbe2
4 changed files with 10 additions and 6 deletions
|
@ -1,5 +1,5 @@
|
|||
[default]
|
||||
extend-ignore-re = ["#\\s*spellchecker:off\\s*\\n.*\\n\\s*#\\s*spellchecker:on"]
|
||||
extend-ignore-re = ["(?s)(#|//)\\s*spellchecker:off.*?\\n\\s*(#|//)\\s*spellchecker:on"]
|
||||
|
||||
[default.extend-identifiers]
|
||||
hello = "goodbye"
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
hello
|
||||
# spellchecker:off
|
||||
hello
|
||||
# spellchecker:on
|
||||
henlo
|
||||
// spellchecker:on
|
||||
hello
|
||||
// ensure greedy doesn't exclude everything across blocks
|
||||
# spellchecker:off
|
||||
# spellchecker:on
|
||||
|
|
|
@ -8,9 +8,9 @@ error: `hello` should be `goodbye`
|
|||
| ^^^^^
|
||||
|
|
||||
error: `hello` should be `goodbye`
|
||||
--> ./file.ignore:5:1
|
||||
--> ./file.ignore:6:1
|
||||
|
|
||||
5 | hello
|
||||
6 | hello
|
||||
| ^^^^^
|
||||
|
|
||||
"""
|
||||
|
|
|
@ -39,8 +39,8 @@ Configuration is read from the following (in precedence order)
|
|||
| type.\<name>.extend-glob | \- | list of strings | File globs for matching `<name>` |
|
||||
|
||||
Common `extend-ignore-re`:
|
||||
- Line ignore with trailing `# spellchecker:disable-line`: `"(?Rm)^.*#\\s*spellchecker:disable-line$"`
|
||||
- Line block with `# spellchecker:<on|off>`: `"#\\s*spellchecker:off\\s*\\n.*\\n\\s*#\\s*spellchecker:on"`
|
||||
- Line ignore with trailing `# spellchecker:disable-line`: `"(?Rm)^.*(#|//)\\s*spellchecker:disable-line$"`
|
||||
- Line block with `# spellchecker:<on|off>`: `"(?s)(#|//)\\s*spellchecker:off.*?\\n\\s*(#|//)\\s*spellchecker:on"`
|
||||
|
||||
Common `extend-ignore-identifiers-re`:
|
||||
- SSL Cipher suites: `"\\bTLS_[A-Z0-9_]+(_anon_[A-Z0-9_]+)?\\b"`
|
||||
|
|
Loading…
Reference in a new issue