Class: Hashira::Smells::ParamCheck

Inherits:
Object
  • Object
show all
Defined in:
lib/hashira/smells/param_check.rb

Constant Summary collapse

COMPARISONS =
%i[== != =~].freeze

Instance Method Summary collapse

Constructor Details

#initialize(node, name) ⇒ ParamCheck

Returns a new instance of ParamCheck.



8
9
10
11
# File 'lib/hashira/smells/param_check.rb', line 8

def initialize(node, name)
  @node = node
  @name = name
end

Instance Method Details

#legitimate?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/hashira/smells/param_check.rb', line 18

def legitimate?
  absolved? || working? || nested.any?(&:legitimate?)
end

#matchesObject



13
14
15
16
# File 'lib/hashira/smells/param_check.rb', line 13

def matches
  return [] if legitimate?
  nested.flat_map(&:matches) + tested
end