Skip to content

Commit

Permalink
rubocops/uses_from_macos: audit when depends_on :linux
Browse files Browse the repository at this point in the history
  • Loading branch information
cho-m committed Dec 30, 2023
1 parent 04d8ae2 commit d53ef47
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Library/Homebrew/rubocops/uses_from_macos.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,12 @@ class UsesFromMacos < FormulaCop
def audit_formula(_node, _class_node, _parent_class_node, body_node)
return if body_node.nil?

depends_on_linux = depends_on?(:linux)

find_method_with_args(body_node, :uses_from_macos, /^"(.+)"/).each do |method|
@offensive_node = method
problem "`uses_from_macos` should not be used when Linux is required." if depends_on_linux

dep = if parameters(method).first.instance_of?(RuboCop::AST::StrNode)
parameters(method).first
elsif parameters(method).first.instance_of?(RuboCop::AST::HashNode)
Expand Down

0 comments on commit d53ef47

Please sign in to comment.