-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
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
rubocops/lines: require a comment for skip_clean
#18002
Conversation
Library/Homebrew/test/rubocops/text/skip_clean_commented_spec.rb
Outdated
Show resolved
Hide resolved
916235d
to
b771b05
Compare
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.
💪🏻 Thanks!
method_comment = processed_source.comments.find do |comment| | ||
(method.loc.line - comment.loc.line).abs <= 1 | ||
end | ||
return unless method_comment.nil? |
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.
nit, unless nil
confuses me :-)
return unless method_comment.nil? | |
return if method_comment.present? |
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.
Or
return unless method_comment.nil? | |
return if !method_comment.nil? |
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 prefer the prior or the existing version to the second.
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.
One optional style nit from @issyl0 and should be good to go, thanks @branchvincent!
@Homebrew/core @Homebrew/maintainers any thoughts on other DSL elements that should always have a comment above them?
Off the top of my head: patches should have an explanation of what they fix and when they can be removed. |
Yeah patches is something I campaigned on every PR while back to have comments to the point it seems to be common maintainer knowledge now. Other cases are largely situational. E.g. if someone added a compiler flag workaround I'd also ask to add a comment (though can't really RuboCop check that).
In all cases, be aware to check for and skip through parent # comment explaining horrible hack
on_macos do
on_intel do
pour_bottle? ...
end
end which is an acceptable form of documenting. |
+1 for compiler flags as well. |
Thanks folks! @branchvincent would you be interested in adding patches/ |
Another thought is e.g. |
I'm interested if @branchvincent isn't. :-) |
Yea I'll add them here! @issyl0 I can take an initial stab at covering these other DSLs but maybe you could help fill in any gaps I might miss? Like the Also, I think I'll make this a strict audit to give us time to address all the existing offenses |
Thanks!
Good idea! |
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
brew style
with your changes locally?brew typecheck
with your changes locally?brew tests
with your changes locally?Related to the discussion in Homebrew/homebrew-core#176257, I didn't realize we expected
skip_clean
to be documented with a comment. This formalizes that requirement into an audit, scoped only tohomebrew/core
.