Skip to content

Use a non-greedy example for --ignore-multiline-regex - #4029

Open
ekanshul wants to merge 1 commit into
codespell-project:mainfrom
ekanshul:fix-3892-nongreedy-ignore-multiline-example
Open

ekanshul wants to merge 1 commit into
codespell-project:mainfrom
ekanshul:fix-3892-nongreedy-ignore-multiline-example

Conversation

@ekanshul

Copy link
Copy Markdown

Fixes #3892

The --ignore-multiline-regex help example used a greedy .* match. With re.DOTALL, that stretches from the first codespell:ignore-begin to the last codespell:ignore-end, so text between two ignored regions is skipped.

The documented example now uses .*?. A test with two ignore blocks and a typo between them checks that the documented pattern still reports that typo.

The help text used a greedy .* which matches from the first
codespell:ignore-begin through the last ignore-end, so typos
between two ignored regions are silently skipped. Use .*? in
the documented example and cover that case in tests.
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 this pull request may close these issues.

Make --ignore-multiline-regex example non-greedy

1 participant