-
-
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
Fix Layout/SpaceAroundBlockParameters bug related to trailing commas #8084
Fix Layout/SpaceAroundBlockParameters bug related to trailing commas #8084
Conversation
e3150d2
to
8100dec
Compare
processed_source.buffer.source[pos] == ',' ? pos + 1 : pos | ||
def last_end_pos_inside_pipes(arguments, pos) | ||
num = pos - arguments.source_range.to_a.first | ||
trailing_comma_index = arguments.source[num..-1].index(',') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There must be a smarter way to do this :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so; parser
doesn't give out any info about the commas
processed_source.buffer.source[pos] == ',' ? pos + 1 : pos | ||
def last_end_pos_inside_pipes(arguments, pos) | ||
num = pos - arguments.source_range.to_a.first | ||
trailing_comma_index = arguments.source[num..-1].index(',') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so; parser
doesn't give out any info about the commas
c3de612
to
83e5cfd
Compare
2efef3b
to
7d26ac8
Compare
@bquorning Can you rebase this PR? |
There was a bug in how Layout/SpaceAroundBlockParameters autocorrected block parameters with a trailing comma with both leading and trailing whitespace.
7d26ac8
to
0f34b08
Compare
I had completely forgotten about this PR :-) It’s rebased now. |
Thanks!
I forget about most PRs, especially if they are not on the first scree. That's why I did a lot of PR pruning today. It's great when you have no more than 25 of them. :-) |
There was a bug in how Layout/SpaceAroundBlockParameters autocorrected block parameters with a trailing comma with both leading and trailing whitespace.
Before submitting the PR make sure the following are checked:
[Fix #issue-number]
(if the related issue exists).master
(if not - rebase it).bundle exec rake default
. It executes all tests and RuboCop for itself, and generates the documentation.