Class: Nitpick::ArgumentNitpicker

Inherits:
LocalVariableCounter show all
Defined in:
lib/nitpick/argument_nitpicker.rb

Instance Attribute Summary

Attributes inherited from Nitpicker

#warnings

Instance Method Summary collapse

Methods inherited from LocalVariableCounter

#call, #initialize, #process_args, #process_block_arg, #process_call, #process_iasgn, #process_lasgn, #process_lvar, #use, #uses

Methods inherited from Nitpicker

#initialize, #process_cfunc, #process_defn, #scan_for, #warn

Constructor Details

This class inherits a constructor from Nitpick::LocalVariableCounter

Instance Method Details

#nitpick!Object



3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/nitpick/argument_nitpicker.rb', line 3

def nitpick!
  @silence_warnings = false
  super
  return if @silence_warnings
  
  @lvars.each do |name, details|
    next if details[:calls] > 0
    next if details[:uses] >= 2
    next if !@args.include?(name)
    warn Warnings::UnusedArgument.new(name)
  end
end

#process_zsuper(exp) ⇒ Object



16
17
18
19
# File 'lib/nitpick/argument_nitpicker.rb', line 16

def process_zsuper(exp)
  @silence_warnings = true
  s(:zsuper)
end