crate-ci / typos

Source code spell checker
Apache License 2.0
2.47k stars 94 forks source link

Allow default.extend-words to work across punctuation #400

Open aaronraimist opened 2 years ago

aaronraimist commented 2 years ago

Fuj'ehr, json-clos, add-ons and raim.ist are marked as misspelled by typos which is generally fine, other than add-ons which probably shouldn't be corrected. However the only way to mark them as false positives is to write partial words in the config file like:

[default.extend-words]
ehr = "ehr"
clos = "clos"
ons = "ons"
ist = "ist"

It would be nice to be able to write out the entire word like:

[default.extend-words]
"Fuj'ehr" = "Fuj'ehr"
"json-clos" = "json-clos"
"add-ons" = "add-ons"
"raim.ist = "raim.ist"

This would give more context to what the false positive is and to reduce likelihood of not catching a real misspelling in the future.

Possibly related to https://github.com/crate-ci/typos/issues/399

epage commented 2 years ago

The challenge is deciding what punctuation makes up a word or what doesn't. add-ons could just as well be subtracting one variable from the other. Ideally we'd catch that when the variables are declared and so wouldn't worry about it when just referencing them but it illustrates the idea.

halkeye commented 2 years ago

Claus => Clause ✅ Santa Claus => Santa Clause ❌

Same with proper names "Alan O'Leary" shouldn't be updated to "Alan O'Leery"

lots of workarounds, but just adding more data to be consistered.

tinmarino commented 1 year ago

To silence this, I added:

default.extend-ignore-re = [
  "--hel", "add-ons"
]

PS: Thanks you @epage for this awesome program: I do not know how it works but it works and amazingly fast.