class Pedant::CheckContainsIpAddressLiterals

Public Class Methods

requires() click to toggle source
Calls superclass method Pedant::Check::requires
# File lib/pedant/checks/contains_ip_address_literals.rb, line 29
def self.requires
  super + [:trees]
end

Public Instance Methods

check(file, tree) click to toggle source
# 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() click to toggle source
# File lib/pedant/checks/contains_ip_address_literals.rb, line 41
def run
  # This check will pass by default.
  pass

  # Run this check on the tree of every file.
  @kb[:trees].each { |file, tree| check(file, tree) }
end