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
The Style/UnneededCondition auto-correct can yield syntax errors when a single statement in an else branch spans more than one line without parenthesis.
Example:
def foo(bar = false)
if bar
bar
else
OpenStruct.new one: 1,
two: 2
end
end
Expected behavior
This should auto-correct to
def foo(bar = false)
bar || OpenStruct.new(one: 1,
two: 2)
end
or
def foo(bar = false)
bar || OpenStruct.new one: 1, two: 2
end
Actual behavior
Rubocop auto-corrected to (invalid syntax):
def foo(bar = false)
bar || OpenStruct.new one: 1,
two: 2
end
Steps to reproduce the problem
# test.rb
def foo(bar = false)
bar || OpenStruct.new one: 1,
two: 2
end
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contribution and understanding!
The Style/UnneededCondition auto-correct can yield syntax errors when a single statement in an else branch spans more than one line without parenthesis.
Example:
Expected behavior
This should auto-correct to
or
Actual behavior
Rubocop auto-corrected to (invalid syntax):
Steps to reproduce the problem
RuboCop version
The text was updated successfully, but these errors were encountered: