-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
auto-correct changes logic #2859
Comments
@xithan, the first issue that you mention, pertaining to The second one sounds like a bug to me. I assume that the second issue is coming from |
latest rubocop version 0.37.2 with default style rules. I double-checked with
|
Running RuboCop on the code produces this output: test.rb:4:1: C: [Corrected] Style/NegatedIf: Favor unless over if for negative conditions.
return if !a.include? b && c
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
test.rb:4:11: C: [Corrected] Style/RedundantParentheses: Don't use parentheses around an unary operation.
return if (!a.include? b) && c
^^^^^^^^^^^^^^^
test.rb:4:15: W: Lint/RequireParentheses: Use parentheses in the method call to avoid confusion about precedence.
return unless a.include? b && c Breaking it down, the first run will cause an offense in I think this is an issue with |
Not so. The transformation which
|
Just pushing a fix to my open PR. |
Thanks for the fix @alexdowad |
a == a.downcase
is changed toa.casecmp(a).zero?
(the former condition is supposed to check if uppercase letters are present; the auto-corrected condition is always true)
return if (!a.include? b) && c
is changed toreturn unless a.include? b && c
(auto-correct converts
if !
tounless
although there is a second expression involved)The text was updated successfully, but these errors were encountered: