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

False positive for Style/RedundantRegexpCharacterClass #8205

Closed
viraptor opened this issue Jun 24, 2020 · 0 comments
Closed

False positive for Style/RedundantRegexpCharacterClass #8205

viraptor opened this issue Jun 24, 2020 · 0 comments
Labels

Comments

@viraptor
Copy link

When using an escaped square bracket in a character class, rubocop suggests incorrect fix.


Expected behavior

[(\[]TM[\])] passes the RedundantRegexpCharacterClass check.

Actual behavior

C: Style/RedundantRegexpCharacterClass: Redundant single-element character class, [\] can be replaced with \.

Steps to reproduce the problem

Run the check on a line with:

/\b ?[(\[]TM[\])]/i

RuboCop version

0.86.0 (using Parser 2.7.1.4, rubocop-ast 0.0.3, running on ruby 2.6.6 x86_64-darwin18)
@marcandre marcandre added the bug label Jun 24, 2020
@koic koic closed this as completed in 8caec83 Jun 25, 2020
koic added a commit that referenced this issue Jun 25, 2020
…ntregexpcharacterclass

[Fix #8205] Avoid false positive in Style/RedundantRegexpCharacterClass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants