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

Escaped characters in strings not ignored in 2.0 version #1774

Closed
diafour opened this issue Nov 24, 2020 · 4 comments · Fixed by #2875
Closed

Escaped characters in strings not ignored in 2.0 version #1774

diafour opened this issue Nov 24, 2020 · 4 comments · Fixed by #2875

Comments

@diafour
Copy link

diafour commented Nov 24, 2020

Hello! I use the latest version of codespell in CI. Yesterday everything was ok, but the new release gives errors about escaped characters.

A minimal reproducible example is simple:

cat hello.c
#include <stdio.h>

int main() {
  printf("CodeSpell do not ignore escaped chars\nin strings.");
  return 0;
}

codespell==1.17.1 sees no problem in that file.

codespell==2.0.0 gives this message:

hello.c:4: nin ==> inn, min, bin, nine
@bl-ue
Copy link
Contributor

bl-ue commented Dec 11, 2020

I think it would even better if codespell intelligently detected a \ or \n at the beginning of a typo and skipped it. Because it's common to make typos in strings. Of course it should respect your configuration, and there shouldn't be a regression. Just a thought.

@jschwartzentruber
Copy link

jschwartzentruber commented Jul 5, 2021

An easy solution to this is something like:

[codespell]
ignore-regex = \\[fnrstv]

@juju4
Copy link

juju4 commented Jan 8, 2023

I also see this when working on ARM template (Azure; json files).

Above workaround seems to work well.

multiple related entries
#151
#174
#233
#1422

@DimitriPapadopoulos
Copy link
Collaborator

DimitriPapadopoulos commented Jan 9, 2023

This might be widely useful enough to add it to the README.rst page, or to a new "recipes" page.

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

Successfully merging a pull request may close this issue.

6 participants