Skip to content

Remove warning about unused groups #56763

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

Closed
wants to merge 1 commit into from

Conversation

bionicles
Copy link

@bionicles bionicles commented Jan 7, 2024

This warning is annoying and serves to discourage use of named capturing groups (which are more maintainable) because users must either switch to extracting the groups (not always necessary) or replace their named groups with "(?:" (unnamed groups are harder to maintain because it's less clear what is their objective within a greater regex pattern).

If users need to specialize their regex patterns to each command, then they need to maintain multiple copies, some with unnamed groups, some without, just to silence some warning, also, if they remove the groups, then later on when they want to use them, they might have to figure out how to replace groups they removed just to silence a warning, and be frustrated.

If we remove this unnecessary warning, then we no longer discourage users who use named capturing groups, thus facilitating readability of the patterns, and portability to other contexts, such as debuggers or the "extract" method mentioned in the removed warning.

TL;DR: This warning doesn't need to exist, so I'm removing it. If there are tests which expect it, then they could also be removed. Code to silence the warning should still work, but could also be removed.

This warning is annoying and serves to discourage use of named capturing groups (which are more maintainable) because users must either switch to extracting the groups (not always necessary) or replace their named groups with "(?:" (unnamed groups are harder to maintain because it's less clear what is their objective within a greater regex pattern). 

If users need to specialize their regex patterns to each command, then they need to maintain multiple copies, some with unnamed groups, some without, just to silence some warning, also, if they remove the groups, then later on when they want to use them, they might have to figure out how to replace groups they removed just to silence a warning, and be frustrated.

If we remove this unnecessary warning, then we no longer discourage users who use named capturing groups, thus facilitating readability of the patterns, and portability to other contexts, such as debuggers or the "extract" method mentioned in the removed warning.

TL;DR: This warning doesn't need to exist, so I'm removing it. If there are tests which expect it, then they could also be removed. Code to silence the warning should still work, but could also be removed.
@phofl
Copy link
Member

phofl commented Jan 7, 2024

Please open issues to facilitate a discussion before you open a PR

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.

2 participants