Class: Pedant::CheckContainsIpAddressLiterals
- Inherits:
-
Check
- Object
- Check
- Pedant::CheckContainsIpAddressLiterals
show all
- Defined in:
- lib/pedant/checks/contains_ip_address_literals.rb
Instance Attribute Summary
Attributes inherited from Check
#result
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Check
all, depends, #fail, #fatal, friendly_name, inherited, #initialize, initialize!, list, #pass, provides, ready?, #report, run_checks_in_dependency_order, #skip, #warn
Constructor Details
This class inherits a constructor from Pedant::Check
Class Method Details
.requires ⇒ Object
29
30
31
|
# File 'lib/pedant/checks/contains_ip_address_literals.rb', line 29
def self.requires
super + [:trees]
end
|
Instance Method Details
#check(file, tree) ⇒ Object
33
34
35
36
37
38
39
|
# File 'lib/pedant/checks/contains_ip_address_literals.rb', line 33
def check(file, tree)
return if tree.all(:Ip).empty?
warn
report(:warn, "IP address literals were found in #{file}.")
tree.all(:Ip).each { |ip| report(:warn, ip.context) }
end
|
#run ⇒ Object
41
42
43
44
45
46
47
|
# File 'lib/pedant/checks/contains_ip_address_literals.rb', line 41
def run
pass
@kb[:trees].each { |file, tree| check(file, tree) }
end
|