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

Fix matching note tags with a non-word char last #5859

Merged

Conversation

dbrookman
Copy link
Contributor

Type of Changes

Type
βœ“ πŸ› Bug fix
✨ New feature
πŸ”¨ Refactoring
πŸ“œ Docs

Description

Using \b at the end of the patterns for note tags will only match ones that end in an alphanumeric character, immediately followed by a non-alphanumeric character, or the end of the string. This is due to \b being defined as a boundary between a word character (\w) and a non-word character (\W), or the end of the string. This leads to deviations like ??? being ignored when specified.

Swapping \b for a positive lookahead that targets a whitespace, a colon, or the end of a string accounts for this.

Closes #5840.

Using "\b" at the end of these patterns will only match note tags that
end in an alphanumeric character, immediately followed by a
non-alphanumeric character, or the end of the string. This is due to
"\b" being defined as a boundary between a word character ("\w") and a
non-word character ("\W"), or the end of the string. This leads to
deviations like "???" being ignored when specified.

Swapping "\b" for a positive lookahead that targets a whitespace, a
colon, or the end of a string accounts for this.

Closes pylint-dev#5840.
Copy link
Member

@Pierre-Sassoulas Pierre-Sassoulas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks very good. Thank you for the analysis and for the fix !

@Pierre-Sassoulas Pierre-Sassoulas added Bug πŸͺ² False Negative πŸ¦‹ No message is emitted but something is wrong with the code labels Mar 4, 2022
@Pierre-Sassoulas Pierre-Sassoulas added this to the 2.13.0 milestone Mar 4, 2022
Copy link
Collaborator

@DanielNoord DanielNoord left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this and the investigation @dbrookman πŸ‘

@Pierre-Sassoulas Pierre-Sassoulas merged commit a1df768 into pylint-dev:main Mar 4, 2022
@Pierre-Sassoulas
Copy link
Member

Congratulation on becoming a pylint contributor πŸŽ‰

@dbrookman dbrookman deleted the fix-notes-non-word-char-last branch March 4, 2022 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug πŸͺ² False Negative πŸ¦‹ No message is emitted but something is wrong with the code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"--notes" option ignores note tags that are entirely punctuation
3 participants