Library/Homebrew/rubocops/extend/formula_cop.rb
# Returns true if given dependency name and dependency type exist in given dependency method call node.
# TODO: Add case where key of hash is an array
Returns true if given dependency name and dependency type exist in given dependency method call node.
TODO: Add case where key of hash is an array
Returns true if given dependency name and dependency type exist in given dependency method call node . TODO : Add case where key of hash is an array
def depends_on_name_type?(node, name = nil, type = :required)
        if name
          name_match = false
        else
          name_match = true 
        end
        case type
        when :required
          type_match = required_dependency?(node)
          name_match ||= required_dependency_name?(node, name) if type_match
        when :build, :test, :optional, :recommended
          type_match = dependency_type_hash_match?(node, type)
          name_match ||= dependency_name_hash_match?(node, name) if type_match
        when :any
          type_match = true
          name_match ||= required_dependency_name?(node, name)
          name_match ||= dependency_name_hash_match?(node, name)
        else
          type_match = false
        end
        if type_match || name_match
          @offensive_node = node
          @offense_source_range = node.source_range
        end
        type_match && name_match
      end
def depends_on_name_type? ( node , name = nil , type = :required ) if name name_match = false else name_match = true end case type when :required type_match = required_dependency? ( node ) name_match ||= required_dependency_name? ( node , name ) if type_match when :build , :test , :optional , :recommended type_match = dependency_type_hash_match? ( node , type ) name_match ||= dependency_name_hash_match? ( node , name ) if type_match when :any type_match = true name_match ||= required_dependency_name? ( node , name ) name_match ||= dependency_name_hash_match? ( node , name ) else type_match = false end if type_match || name_match @offensive_node = node @offense_source_range = node . source_range end type_match && name_match end
Returns true if given dependency name and dependency type exist in given dependency method call node.
Returns true if given dependency name and dependency type exist in given dependency method call node .
# Match only by type when name is nil
node
name
type