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
Refactor comment access #8405
Refactor comment access #8405
Conversation
Apart from the failing build, the changes look good to me. |
Right, now that |
d723d10
to
f3b2848
Compare
Seems you'll also have to rebase. |
I wish there was a way to flag a PR as "auto merge"; if the CI is green merge instantly... I wait for the CI and then forget about it 😅 |
That PR affects only the internals, so I think we can merge it right away. |
Yeah, that'd be a cool feature indeed! |
Highlight for style/safe_navigation_spec isn't perfect though
Avoids incorrect use of `comments_before_line`. The autocorrection worked only for case statements that were root of the document and were not indented Also fix `Style/SafeNavigation`'s auto-correction, typical off-by-one error without a spec
Could we consider https://github.com/marketplace/mergify ? There are other bots available as well as github actions, but [some people] had good success with mergify. |
mergify looks nice. We can certainly try it. |
`RuboCop::Cop::Util#comment_line?` is flagged by rubocop/rubocop#8405 as a bad API. So I propose to fix not use this method.
This PR fixes all occurrences of
ProcessedSource#find_comment
,each_comment
,comments_before_line
,commented?
and improves processing in general.Fixes two cops with bad comment treatment:
Style/EmptyCaseCondition
,SaveNavigation
. I didn't check other cops, is just that the processing for these was clearly erroneous.util.rb
'scomment_line?
remains though, even though it is a bad API (it should probably be something likeProcessedSource#line_is_comment?(line_nb)
instead).This PR relies on an unreleased version of
rubocop-ast