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/RedundantException auto-correction does not keep original parenthesization of the raise method call, and that can cause unparsable ruby.
raise
Rubocop keeps presence or absence of parentheses in the raise method call when auto-correcting.
Rubocop removes parenthesis from the raise method call.
$ echo "system(*args) || raise(RuntimeError, 'hola')" | bundle exec rubocop --only Style/RedundantException --stdin file.rb --auto-correct Inspecting 1 file E Offenses: file.rb:1:18: C: [Corrected] Style/RedundantException: Redundant RuntimeError argument can be removed. system(*args) || raise(RuntimeError, 'hola') ^^^^^^^^^^^^^^^^^^^^^^^^^^^ file.rb:1:24: E: Lint/Syntax: unexpected token tSTRING (Using Ruby 2.1 parser; configure using TargetRubyVersion parameter, under AllCops) system(*args) || raise 'hola' ^^^^^^ 1 file inspected, 2 offenses detected, 1 offense corrected ==================== system(*args) || raise 'hola'
$ rubocop -V 0.52.1 (using Parser 2.4.0.2, running on ruby 2.5.0 x86_64-linux)
The text was updated successfully, but these errors were encountered:
[Fix rubocop#5520] Fix Style/RedundantException auto-correction doe…
Style/RedundantException
15b79cc
…s not keep parenthesization
[Fix #5520] Fix Style/RedundantException auto-correction does not k…
471e59e
…eep parenthesization
Successfully merging a pull request may close this issue.
Style/RedundantException auto-correction does not keep original parenthesization of the
raise
method call, and that can cause unparsable ruby.Expected behavior
Rubocop keeps presence or absence of parentheses in the
raise
method call when auto-correcting.Actual behavior
Rubocop removes parenthesis from the
raise
method call.Steps to reproduce the problem
RuboCop version
The text was updated successfully, but these errors were encountered: