-
Notifications
You must be signed in to change notification settings - Fork 480
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
Allow for regex in dictionaries #3632
Comments
Codespell processes words. The regex that splits text into words is documented here: codespell/codespell_lib/_codespell.py Lines 479 to 489 in faf0c8d
|
@DimitriPapadopoulos I didn't get what |
The best way to use
I can also get all the words to
This works, but is not a clean solution. The initial request of this issue was the ability to add regular expressions to dictionaries. For example, to be able to add |
The answer is that it's currently not possible to add regexes to dictionaries. I can reopen this as an enhancement request, no problem. But then, given the requirement of matching |
I thought that it's possible in some way because you closed as completed. Having it open as enhancement request works for me. Will it be hard to implement? Do not want to use grep to have all the functionality around the check - to be able to provide dicts, set which files to test and to ignore, use inline comments to ignore a specific rule etc. |
I think it will be very hard to implement. Using |
I am considering using
codespell
to search for non-inclusive terms in our code.codespell
has a built-in dictionary in https://github.com/codespell-project/codespell/blob/main/codespell_lib/data/dictionary_usage.txt.However,
codespell
cannot search words from dictionary as a substring. For example, cosider this line:timemaster is a program that uses ptp4l and phc2sys in combination with chronyd or ntpd to synchronize the system clock to NTP and PTP time masters.
Codespell would report the use of
masters
but it ignorestimemaster
.I wonder if it is possible to allow passing regular expressions in the dictionary. So that I can add
.*master.*
to a dictionary and expect codespell to catch all strings that match that regex.The text was updated successfully, but these errors were encountered: