We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Style/RedundantRegexpCharacterClass is problematic under in specific case:
Style/RedundantRegexpCharacterClass
def escape(text) text.gsub(/.[\b]/, '') end
# Style/RedundantRegexpCharacterClass: Redundant single-element character class, [\b] can be replaced with \b..
# Style/RedundantRegexpCharacterClass: Redundant single-element character class, [\b] can be replaced with \b.
but, \b [\b] behave differently.
\b
[\b]
https://docs.ruby-lang.org/en/2.7.0/Regexp.html#class-Regexp-label-Anchors
\b - Matches word boundaries when outside brackets; backspace (0x08) when inside brackets
Ignore [\b] case.
Change [\b] to \b.
$ [bundle exec] rubocop -V 0.86.0 (using Parser 2.7.1.4, rubocop-ast 0.0.3, running on ruby 2.7.1 x86_64-darwin18)
The text was updated successfully, but these errors were encountered:
@owst Can you take a look?
Sorry, something went wrong.
Aha, I missed this difference in behaviour, apologies - I'll have a look this evening UK time 👍
b417653
Merge pull request #8202 from owst/allow_character_class_containing_b…
4cb9e49
…ackslash_b [Fix #8193] Avoid false positive in Style/RedundantRegexpCharacterClass
thx!
No branches or pull requests
Style/RedundantRegexpCharacterClass
is problematic under in specific case:# Style/RedundantRegexpCharacterClass: Redundant single-element character class, [\b] can be replaced with \b.
.but,
\b
[\b]
behave differently.https://docs.ruby-lang.org/en/2.7.0/Regexp.html#class-Regexp-label-Anchors
Expected behavior
Ignore
[\b]
case.Actual behavior
Change
[\b]
to\b
.RuboCop version
The text was updated successfully, but these errors were encountered: