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
audit: Port audit_conflicts method to rubocop and add tests #2843
audit: Port audit_conflicts method to rubocop and add tests #2843
Conversation
f0f645d
to
4f30de4
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.
Two tiny nits but otherwise looking good 👍
# This cop audits versioned Formulae for `conflicts_with` | ||
class Conflicts < FormulaCop | ||
MSG = <<-EOS.undent | ||
Versioned formulae should not use `conflicts_with`. |
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.
Only indent by two characters here.
|
||
def audit_formula(_node, _class_node, _parent_class_node, body) | ||
return unless versioned_formula? | ||
whitelist = %w[node@ bash-completion@].freeze |
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.
Let's make this a constant earlier in the class and have one formula per line so they stand out a bit more
8a9f570
to
0db695e
Compare
EOS | ||
|
||
WHITELIST = %w[node@ | ||
bash-completion@].freeze |
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.
Let's go for:
WHITELIST = %w[
node@
bash-completion@
].freeze
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.
that will reduce the diff on future additions here.
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.
Waoh. Never thought of that!
@MikeMcQuaid I'm moving the two private methods defined in |
0db695e
to
4ed34f9
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.
Looks good to me. 👍
brew tests
with your changes locally?#569
This PR partially ports
audit_conflicts
method to a custom cop. Remaining code inaudit_conflicts
uses Homebrew internals methods and I could not figure out their exact functionality to port them. Please let me know if this approach is not good.