Skip to content

Escaped characters in strings not ignored in 2.0 version #1774

Closed

Description

@diafour

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

Activity

  1. bl-ue commented on Dec 11, 2020

    @bl-ue
    Contributor

    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.

  2. jschwartzentruber commented on Jul 5, 2021

    @jschwartzentruber

    An easy solution to this is something like:

    [codespell]
    ignore-regex = \\[fnrstv]
    
  3. juju4 commented on Jan 8, 2023

    @juju4

    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

  4. DimitriPapadopoulos commented on Jan 9, 2023

    @DimitriPapadopoulos
    Collaborator

    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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions