class Pedant::CheckLocalVariableUnused

Public Class Methods

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

Public Instance Methods

check(file, tree) click to toggle source
# File lib/pedant/checks/local_variable_unused.rb, line 33
def check(file, tree)
  def check_function(id, blk)
    report(:warn, "Function #{id.name} was not analyzed since this check is unfinished.")
  end

  # Local variable statements can technically occur anywhere, they only
  # create new variables when found in functions.
  tree.all(:Function).each { |fn| check_function(fn.name, fn.body) }
end
check_function(id, blk) click to toggle source
# File lib/pedant/checks/local_variable_unused.rb, line 34
def check_function(id, blk)
  report(:warn, "Function #{id.name} was not analyzed since this check is unfinished.")
end
run() click to toggle source
# File lib/pedant/checks/local_variable_unused.rb, line 43
def run
  # This check will pass by default.
  pass

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