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 negative in Style/RedundantParentheses with ranges #13811

Closed
vlad-pisanov opened this issue Feb 9, 2025 · 0 comments · Fixed by #13812
Closed

False negative in Style/RedundantParentheses with ranges #13811

vlad-pisanov opened this issue Feb 9, 2025 · 0 comments · Fixed by #13812
Labels

Comments

@vlad-pisanov
Copy link
Contributor

Consider

((1..5))
((1...5))
((((1..5)))).first
(((1..))).first
foo(((1..5)))

Style/RedundantParentheses doesn't flag any of these as offenses. erange / irange nodes already wrapped in parentheses don't need additional parentheses around them.

1.71.0 (using Parser 3.3.7.0, rubocop-ast 1.38.0, analyzing as Ruby 3.3, running on ruby 3.3.2) [x86_64-darwin21]
  - rubocop-factory_bot 2.26.1
  - rubocop-minitest 0.36.0
  - rubocop-performance 1.23.1
  - rubocop-rails 2.29.1
@koic koic added the bug label Feb 9, 2025
koic added a commit to koic/rubocop that referenced this issue Feb 9, 2025

Verified

This commit was signed with the committer’s verified signature.
Honny1 Jan Rodák
This PR fixes false negatives for `Style/RedundantParentheses`
when handling range literals with redundant parentheses.

Fixes rubocop#13811
bbatsov pushed a commit that referenced this issue Feb 9, 2025
This PR fixes false negatives for `Style/RedundantParentheses`
when handling range literals with redundant parentheses.

Fixes #13811
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants