Skip to content

bug: With ignore-multiline-regex set, --write doesn't work properly #3642

@spetrosi

Description

@spetrosi

When ignore-multiline-regex is set in config, and I run codespell -w, it removes newlines in edited files, which results in files being reformatted to a single line.

$ echo -e "Thsi line contains a typo\nWhile this line is correct" > test.txt
$ cat test.txt 
Thsi line contains a typo
While this line is correct
$ codespell test.txt 
> Thsi line contains a typo
test.txt:1: Thsi ==> This
$ codespell test.txt -w --ignore-multiline-regex="codespell:ignore-begin.*codespell:ignore-end"
FIXED: test.txt
$ cat test.txt 
$ cat test.txt 
This line contains a typoWhile this line is correct

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions