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

codespell ignores C/C++ tabs ('\t') in strings #17

Closed
orbitcowboy opened this issue Jul 26, 2013 · 3 comments · Fixed by #2875
Closed

codespell ignores C/C++ tabs ('\t') in strings #17

orbitcowboy opened this issue Jul 26, 2013 · 3 comments · Fixed by #2875

Comments

@orbitcowboy
Copy link

I found out, that codespell gives wrong answers in case of a tab is used within a C/C++ string. For example:
test.c:

int main()
{
    std::cout<< "\tTest\n";
}

dict.txt:

ttest->test

Scanning with test.c with codespell gives a wrong result:

$ ../codespell.py dict.txt test.c 
test.c:3: tTest  ==> test
@vinc17fr
Copy link
Contributor

vinc17fr commented Jun 4, 2018

\n should also be ignored.

@yarikoptic
Copy link
Contributor

\t issue might have been resolved but I keep hitting this eldest ever issue with \n once in a while, e.g. on /tmp/1.c:

int main()
{
    std::cout<< "\tTest\nin here";
}
❯ codespell --version
2.2.2
❯ codespell /tmp/1.c
/tmp/1.c:3: nin ==> inn, min, bin, nine

@DimitriPapadopoulos
Copy link
Collaborator

DimitriPapadopoulos commented Feb 27, 2023

codespell is language-agnostic. Handling escape characters would require to identify the type of each file and adapt --regex or --ignore-regex. A proof of concept could be a shell script identifying the type of each file and calling codespell with the proper --regex and --ignore-regex.

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

Successfully merging a pull request may close this issue.

4 participants