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

Is it possible to detect wrong spelled words like this: #6

Closed
orbitcowboy opened this issue May 8, 2012 · 4 comments
Closed

Is it possible to detect wrong spelled words like this: #6

orbitcowboy opened this issue May 8, 2012 · 4 comments

Comments

@orbitcowboy
Copy link

$ more test.cpp
enum
{
ID_ESTABLISED = 0;
};

$ more dictionary.txt

establised->established

$ codespell.py dictionary.txt
$

In this case codespell does not detect the error. But if i remove the preceeding ID_ from the enum definition, codespell is able
to detect the error. Is it possible to detect the errror without modification of the code?
Many thanks in advance

Martin Ettl

@lucasdemarchi
Copy link
Collaborator

Right now it's not possible. With the following patch it would detect misspellings, but it fixing the word doesn't work. If you find the right regex, I could apply this patch

diff --git a/codespell.py b/codespell.py
index daec448..1fd014f 100755
--- a/codespell.py
+++ b/codespell.py
@@ -390,6 +390,7 @@ def parse_file(filename, colors, summary):
fixed_words = set()
asked_for = set()

  •    line = line.replace('_', ' ')
     for word in rx.findall(line):
         lword = word.lower()
         if lword in misspellings:
    

@orbitcowboy
Copy link
Author

Thank you. This patch works perfectly for my needs. Is it possible you apply this patch to mainline, because there is no reason against to always replace all '_' with ' ' before checking.

@lucasdemarchi
Copy link
Collaborator

Sorry, I can't... not until we find a proper solution to have "-w" argument working with that.

@orbitcowboy
Copy link
Author

Ok, i understand. Thank you for your help!

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