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
# an example filedeffunc# foofoo# hogeiffooifbarbuzendendend
Run:
$ rubocop -a --debug --only Style/SoleNestedConditional test.rb
Expected behavior
# an example filedeffunc# foofoo# hogeiffoo && barbuzendend
Actual behavior
Output:
For /Users/thinca/tmp/rubocop-test: configuration from /Users/thinca/tmp/rubocop-test/.rubocop.yml
Default configuration from /Users/thinca/tmp/rubocop-test/vendor/bundle/ruby/2.7.0/gems/rubocop-1.6.1/config/default.yml
Inspecting 1 file
Scanning /Users/thinca/tmp/rubocop-test/test.rb
Loading cache from /Users/thinca/.cache/rubocop_cache/fd9e92937dd32541de61425da45d7dfa0c54bb9e/5c3a0012aae88f33b221aa9bbc6dcfba8f2100c7/9f77710eeb664a239190bf981ba7f5ff6c702a02
C
Offenses:
test.rb:9:5: C: [Corrected] Style/SoleNestedConditional: Consider merging nested conditions into outer if conditions.
if bar
^^
1 file inspected, 1 offense detected, 1 offense corrected
Finished in 0.12683500000275671 seconds
test.rb
# an example filedeffunc# foofoo# hoge# an example file# foo# hogeiffoo && barbuzendend
Extra comments are appears
Strange indentation
Steps to reproduce the problem
$ mkdir -p ~/tmp/rubocop-test
$ cd ~/tmp/rubocop-test
$ (put .rubocop.yml and test.rb. rubocop is already installed.)
$ rubocop -a --debug --only Style/SoleNestedConditional test.rb
Thank you for the feedback. Part of auto-correction of indentation will be left to other Layout cop yet (Layout/IndentationWidth cop), but the auto-corrected comment is clearly incorrect.
I got a wrong auto-correction with
Style/SoleNestedConditional
cop and withoutStyle/IfUnlessModifier
cop..rubocop.yml
test.rb
Run:
Expected behavior
Actual behavior
Output:
test.rb
Steps to reproduce the problem
RuboCop version
The text was updated successfully, but these errors were encountered: