Skip to content

Conversation

@GauthamGoli
Copy link
Contributor

@GauthamGoli GauthamGoli commented Aug 6, 2017

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully run brew tests with your changes locally?

#569 and #2662
RuboCop has pattern searching macros which simplify searching/matching nodes in AST.
Found documentation for same in the source of node_pattern.rb

This PR updates depends_on audits to use such pattern matching methods, so code becomes more readable and also fixes bug in previous code which wasn't detecting dependencies.

(there is however one edge case where the value of a depends_on hash is an array, I know how exactly to implement that and will deal with that later)

Edit: How did I derive those patterns? By running the below commands and looking at the AST.
$ ruby-parse -e 'depends_on :x11 => optional'
$ ruby-parse -e 'depends_on "readline" => :recommended'

cc @ilovezfs

Copy link
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One question but otherwise: great work here 👍

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worth using EOS or EOS.undent here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah.

@MikeMcQuaid MikeMcQuaid merged commit fabcad3 into Homebrew:master Aug 8, 2017
@MikeMcQuaid
Copy link
Member

Thanks again @GauthamGoli!

@Homebrew Homebrew locked and limited conversation to collaborators May 4, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants