A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/rubocop/rubocop/issues/14386 below:

Style/RedundantParentheses false positive on one-line rescue within array · Issue #14386 · rubocop/rubocop · GitHub

When a one-line rescue is used as an array element, v1.79 suggests removing the parentheses, but doing so is a syntax error. Likely as a result of #14355?

Expected behavior

No Style/RedundantParentheses offenses.

Actual behavior
test.rb:2:3: C: [Correctable] Style/RedundantParentheses: Don't use parentheses around a one-line rescue.
  (foo rescue nil),
  ^^^^^^^^^^^^^^^^
Steps to reproduce the problem
# test.rb
[
  (foo rescue nil),
]
$ rubocop --cache=false --only Style/RedundantParentheses test.rb
RuboCop version
1.79.0 (using Parser 3.3.9.0, Prism 1.4.0, default, rubocop-ast 1.46.0, analyzing as Ruby 3.4, running on ruby 3.4.1) [arm64-darwin23]

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4