You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fixesrubocop#10622.
This PR fixes a false positive for `Style/RaiseArgs` when
error type class constructor with keyword arguments and message argument.
The signature of `raise` is below.
```ruby
raise
raise(string, cause: $!)
raise(exception [, string [, array]], cause: $!)
```
https://ruby-doc.org/core-3.1.0/Kernel.html#method-i-raise
So rubocop#10622 would be a false positive because `raise MyError.new(data: 'mydata'), 'message'` and
`raise MyError.new('message', data: 'mydata')` are incompatible.
Fixes#10622.
This PR fixes a false positive for `Style/RaiseArgs` when
error type class constructor with keyword arguments and message argument.
The signature of `raise` is below.
```ruby
raise
raise(string, cause: $!)
raise(exception [, string [, array]], cause: $!)
```
https://ruby-doc.org/core-3.1.0/Kernel.html#method-i-raise
So #10622 would be a false positive because `raise MyError.new(data: 'mydata'), 'message'` and
`raise MyError.new('message', data: 'mydata')` are incompatible.
When running
rubocop -a
with autocorrect enabled with following configurationon this code:
Expected behavior
Should autocorrect to
or error as not-auto correctable but violating the
cmopact
styleActual behavior
replaces the code with:
removing the
data: "mydata"
parameter silentlySteps to reproduce the problem
Run
rubocop -a
with the configuration and code aboveRuboCop version
The text was updated successfully, but these errors were encountered: