Class Roodi::Checks::NpathComplexityMethodCheck
In: lib/roodi/checks/npath_complexity_method_check.rb
Parent: Roodi::Checks::NpathComplexityCheck

Checks Npath complexity of a method against a specified limit.

Methods

Constants

DEFAULT_COMPLEXITY = 8

Public Class methods

[Source]

# File lib/roodi/checks/npath_complexity_method_check.rb, line 9
      def initialize(options = {})
        complexity = options['complexity'] || DEFAULT_COMPLEXITY
        super(complexity)
      end

Public Instance methods

[Source]

# File lib/roodi/checks/npath_complexity_method_check.rb, line 23
      def evaluate_end_defn(node)
        add_error "Method name \"#{@method_name}\" n-path complexity is #{@current_value}.  It should be #{@complexity} or less." unless @current_value <= @complexity
      end

[Source]

# File lib/roodi/checks/npath_complexity_method_check.rb, line 18
      def evaluate_start_defn(node)
        @method_name = @node[1]
        push_value
      end

[Source]

# File lib/roodi/checks/npath_complexity_method_check.rb, line 14
      def interesting_nodes
        [:defn] + COMPLEXITY_NODE_TYPES
      end

[Validate]