Class Nitpick::Nitpicker
In: lib/nitpick/nitpicker.rb
Parent: SexpProcessor

Methods

Attributes

warnings  [RW] 

Public Class methods

[Source]

# File lib/nitpick/nitpicker.rb, line 5
    def initialize(klass, meth)
      super()
      self.auto_shift_type = true
      self.strict = false
      self.expected = Sexp
      
      @unsupported.delete(:cfunc)
      @class = klass
      @method = meth
      @warnings = []
    end

Public Instance methods

[Source]

# File lib/nitpick/nitpicker.rb, line 17
    def nitpick!
      process(ParseTree.translate(@class, @method))
    end

[Source]

# File lib/nitpick/nitpicker.rb, line 44
    def process_cfunc(exp); exp.clear; s(); end

[Source]

# File lib/nitpick/nitpicker.rb, line 33
    def process_defn(exp)
      method = exp.shift
      result = s(:defn, method)
      
      until exp.empty?
        result << process(exp.shift)
      end

      result
    end

[Source]

# File lib/nitpick/nitpicker.rb, line 21
    def scan_for(warning_classes, options = {})
      matched_warnings = warning_classes.map do |warning_class|
        warning_class.discover(options[:with])
      end
      
      warn(*matched_warnings)
    end

[Source]

# File lib/nitpick/nitpicker.rb, line 29
    def warn(*warnings)
      @warnings += warnings.compact
    end

[Validate]