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
# No offence
a,
b = [1, 2].map {|i| i - 5}
# No offence either
c,
d = [3, 4].map do |i|
i - 5
end
# Gets an end alignment offence
e,
f = [5, 6].map do |i|
i - 5
end
end_alignment_bug.rb:13:1: W: end at 13, 0 is not aligned with [5, 6].map do |i| at 11, 4
end
^^^
In the third snippet, I think it's ok for end to align with the e variable.
However, having e and f on different lines is pretty dodgy, so it's not so much a false positive, as not highlighting the correct problem.
The text was updated successfully, but these errors were encountered:
The code that raise the offence is related to checks for code like:
variable=testdo |i|
end
This assumes that if you split the line, then the last line should contain only the block statement, but we don't handle your case :/. This is another case where the block's end needs to be aligned with the start of the line where the block is defined.
Whether e and f should be on the same line or not has to be handled in entirely different Cop, which I think we don't have at the moment.
Anyway, I'll work on fixing cases like the 3rd one.
In the third snippet, I think it's ok for
end
to align with thee
variable.However, having
e
andf
on different lines is pretty dodgy, so it's not so much a false positive, as not highlighting the correct problem.The text was updated successfully, but these errors were encountered: