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
$ rubocop -A --only Style/GuardClause --debug ./rubocopbug.rb
For /www/Simplero: configuration from /www/Simplero/.rubocop.yml
configuration from /home/jason/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/rubocop-minitest-0.23.2/config/default.yml
configuration from /home/jason/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/rubocop-minitest-0.23.2/config/default.yml
Default configuration from /home/jason/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/rubocop-1.39.0/config/default.yml
configuration from /home/jason/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/rubocop-performance-1.15.1/config/default.yml
configuration from /home/jason/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/rubocop-performance-1.15.1/config/default.yml
configuration from /home/jason/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/rubocop-rails-2.17.3/config/default.yml
configuration from /home/jason/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/rubocop-rails-2.17.3/config/default.yml
Use parallel by default.
Skipping parallel inspection: only a single file needs inspection
Inspecting 1 file
Scanning /www/Simplero/rubocopbug.rb
Loading cache from /home/jason/.cache/rubocop_cache/4c1cd43e90e17aa86a0cd840b2f8c640d820033f/4e5ae3791c1d8e384badf81b88153dccf260d162/7a1361acb3ce8e58b0745c992ceaa05f89355179
C
Offenses:
rubocopbug.rb:4:3: C: [Corrected] Style/GuardClause: Use a guard clause (raise AuthorizationFailure if response.code == 401) instead of wrapping the code inside a conditional expression.
if response.code == 401
^^
1 file inspected, 1 offense detected, 1 offense corrected
Finished in 0.4634500271640718 seconds
Fixesrubocop#11196.
This PR fix a false positive for `Style/GuardClause`
when using `raise` in `then` body of `if..elsif..end` form.
It would be unexpected to replace complex conditional forms
using `elsif` with modifier form.
Fixes#11196.
This PR fix a false positive for `Style/GuardClause`
when using `raise` in `then` body of `if..elsif..end` form.
It would be unexpected to replace complex conditional forms
using `elsif` with modifier form.
Style/GuardClause auto-correction results in syntax errors with the following code:
Expected behavior
Correction to:
Actual behavior
RuboCop version
The text was updated successfully, but these errors were encountered: