-
Notifications
You must be signed in to change notification settings - Fork 24
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
"end" is marked as similar #155
Comments
@reedstonefood Hi, thanks for opening this issue. It's really helpful to have a reproduction case when coming across bugs like this. I can tell you that the engine is mis-reporting the line numbers, and is actually trying to tell you that lines 95 and 96 are similar. This file reproduces the bug: # foo.rb
def console_output
w = 36 # width of "card"
str = '*' * (w+2) + "\n"
str << '*' << self.roll_range.center(w) << "* #{je[0]}\n"
str << '*' << @attribute["name"].capitalize.center(w) << "* #{je[1]}\n"
str << '*' << " Symbol : #{@attribute["symbol"]} ".center(w) << "* #{je[2]}\n"
str << '*' << " Cost : #{@attribute["cost"]} ".center(w) << "* #{je[3]}\n"
str << '*' * (w+2) << " #{je[4]}"
puts str.colour(ansi_colour)
end But this one doesn't: # foo.rb
def console_output
w = 36 # width of "card"
str = '*' * (w+2) + ""
str << '*' << self.roll_range.center(w) << "* #{je[0]}"
str << '*' << @attribute["name"].capitalize.center(w) << "* #{je[1]}"
str << '*' << " Symbol : #{@attribute["symbol"]} ".center(w) << "* #{je[2]}"
str << '*' << " Cost : #{@attribute["cost"]} ".center(w) << "* #{je[3]}"
str << '*' * (w+2) << " #{je[4]}"
puts str.colour(ansi_colour)
end It seems to be thrown off by the newline characters in the string literals when coming up with the line numbers. We'll look into where that's happening and try to have a fix out as soon as we can. |
Happy to help! The explanation makes perfect sense. |
Yes, line numbers and strings (esp w/ heredocs or interpolation) are a mess. |
This should be fixed with a newer version of ruby_parser: 3.8.3 / 2016-10-09
|
@zenspider @maxjacobson Awesome work! @reedstonefood I'm going to go ahead and close this issue. Feel free to reopen if you're still getting the same similar to Thanks! |
This line
str << '*' * (w+2) << " #{je[4]}"
is showing as being similar to
end
Source
Am I missing something here?
The text was updated successfully, but these errors were encountered: