Class: Guideline::LongMethodChecker

Inherits:
Checker
  • Object
show all
Defined in:
lib/guideline/checkers/long_method_checker.rb

Defined Under Namespace

Classes: Method, MethodParser

Constant Summary collapse

DEFAULT_MAX =
10

Instance Method Summary collapse

Methods inherited from Checker

#errors, #has_error?, #initialize, #report

Constructor Details

This class inherits a constructor from Guideline::Checker

Instance Method Details

#check(path) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/guideline/checkers/long_method_checker.rb', line 8

def check(path)
  MethodParser.parse(path.read) do |method|
    if method.height > max
      report(
        :message => method.message,
        :line    => method.line,
        :path    => path
      )
    end
  end
end