-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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 find_end_line
for block nodes.
#11858
Conversation
find_end_line
when parent does not have an end.find_end_line
for block nodes.
Can you add a test case and a changelog entry? |
Are there any existing tests for |
It would be better to add a reproducible test case in any cop that mixin $ git grep 'include CommentsHelp'
lib/rubocop/cop/layout/class_structure.rb:137: include CommentsHelp
lib/rubocop/cop/lint/empty_conditional_body.rb:65: include CommentsHelp
lib/rubocop/cop/lint/empty_in_pattern.rb:47: include CommentsHelp
lib/rubocop/cop/lint/empty_when.rb:48: include CommentsHelp
lib/rubocop/cop/style/class_methods_definitions.rb:63: include CommentsHelp
lib/rubocop/cop/style/if_unless_modifier.rb:68: include CommentsHelp
lib/rubocop/cop/style/multiline_ternary_operator.rb:37: include CommentsHelp
lib/rubocop/cop/style/redundant_initialize.rb:98: include CommentsHelp
lib/rubocop/cop/style/symbol_proc.rb:88: include CommentsHelp It may not be the best, but having regression tests is essential. |
b6fdef6
to
5668fb1
Compare
Thanks, I found a cop that runs on blocks which actually has this problem. |
I left two comments. Finally, please squash the commits into one. |
e6d273f
to
40b3a31
Compare
Thanks! |
When two block nodes are in the root, e.g.
calling
find_end_line
on the second will return1
instead of7
.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 runs RuboCop on its own code.{change_type}_{change_description}.md
if the new code introduces user-observable changes. See changelog entry format for details.