Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to ignore a word in a context #1056

Closed
ccoVeille opened this issue Jul 9, 2024 · 2 comments
Closed

how to ignore a word in a context #1056

ccoVeille opened this issue Jul 9, 2024 · 2 comments

Comments

@ccoVeille
Copy link

ccoVeille commented Jul 9, 2024

I have code with the following words: CC-BY-ND, or ND-JSON

Typos detects the ND as invalid because it expects AND, and it would be a normal typo if I was writing:

My favorite ice cream flavors are chocolate ND strawberry

but here CC-BY-ND, or ND-JSON are valid usage of ND

I had to exclude "ND", but it means I can no longer detect "chocolate ND strawberry"

I tried this

[default.extend-words]
CC-BY-ND = "CC-BY-ND"
ND-JSON = "ND-JSON"

and later a regexp

[default]
extend-ignore-identifiers-re = [
    "ND.JSON",
    "CC.BY.ND"
]

the ignore rules seems to catch only the word, not the context surrounding the word

I'm lucky because it's case-sensitive. I'm not likely to face ND in a text, and this would be detected

My favorite ice cream flavors are chocolate nd strawberry

But I would like to know there is something I could do about this

@epage
Copy link
Collaborator

epage commented Jul 9, 2024

the ignore rules seems to catch only the word, not the context surrounding the word

This is a variant of #743 and #745. We consider "words" to be elements of an identifier. We only recognize identifiers with _ and not -

What can work for your is default.extend-ignore-re which accepts arbitrary regexes. Anything appearing within those regexes will be ignored.

@ccoVeille
Copy link
Author

Thanks. I was indeed using extend-ignore-identifiers-re not extend-ignore-re

Problem solved, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants