Skip to content
New issue

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

Merging if expression with unless modifier might change original logic. Should be safe fix #9370

Closed
jlahtinen opened this issue Jan 13, 2021 · 0 comments · Fixed by #9371
Closed
Labels

Comments

@jlahtinen
Copy link

Tested with current master 3dc4e62 and 1.6.1
no .rubocop.yml file

Testfile

class Bar
  def bar
    if @a
      raise Foo unless @b && @c
    end
  end
end

after rubocop -a

class Bar
  def bar
    raise Foo if @a && !@b && @c
  end
end

expected

raise line should be e.g. raise Foo if @a && !(@b && @c)

@koic koic added the bug label Jan 13, 2021
koic added a commit to koic/rubocop that referenced this issue Jan 14, 2021
…dConditional`

Fixes rubocop#9370.

This PR fixes an incorrect auto-correct for `Style/SoleNestedConditional`
when using nested `unless` modifier multiple conditional.
koic added a commit that referenced this issue Jan 14, 2021
…tyle_sole_nested_conditional

[Fix #9370] Fix an incorrect auto-correct for `Style/SoleNestedCondtional`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants