-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Add new Lint/DuplicateRegexpCharacterClassElement
cop
#8896
Add new Lint/DuplicateRegexpCharacterClassElement
cop
#8896
Conversation
c38a45b
to
52d3d2b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Only thing I can see is I think this would trigger a false positive on repeated space:
hex = /[
a-f # lowercase letter
0-9 # digit
]+/x
config/default.yml
Outdated
Style/DuplicateRegexpCharacterClassElement: | ||
Description: 'Checks for duplicate elements in Regexp character classes.' | ||
Enabled: pending | ||
VersionAdded: '0.94' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After rebasing update this to 1.1
. :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉 amazing - 1.0! Great news @bbatsov - thank you for all of your and the core team's hard work!
…char_class_elements
@marcandre regarding your comment:
Indeed, I thought the same would happen, but actually, it appears that Ruby's free-space mode doesn't support comments inside characters classes (at least on 2.6.6):
We shouldn't be able to match |
Awesome, thanks! |
Cop documentation:
Before submitting the PR make sure the following are checked:
[Fix #issue-number]
(if the related issue exists).master
(if not - rebase it).bundle exec rake default
. It executes all tests and RuboCop for itself, and generates the documentation.