Sha256: 09f7f497e7f8a78d03529d123e0229dfd6a45006f14ed97f4723a7a2b8682854

Contents?: true

Size: 709 Bytes

Versions: 10

Compression:

Stored size: 709 Bytes

Contents

require 'roodi/checks/npath_complexity_check'

module Roodi
  module Checks
    # Checks NPATH complexity of a method against a specified limit.
    class NpathComplexityMethodCheck < NpathComplexityCheck

      DEFAULT_COMPLEXITY = 8

      def initialize
        super(DEFAULT_COMPLEXITY)
      end

      def interesting_nodes
        [:defn] + COMPLEXITY_NODE_TYPES
      end

      def evaluate_start_defn(node)
        @method_name = @node[1]
        push_value
      end

      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

    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
roodi-5.0.0 lib/roodi/checks/npath_complexity_method_check.rb
roodi-4.1.1 lib/roodi/checks/npath_complexity_method_check.rb
roodi-4.1.0 lib/roodi/checks/npath_complexity_method_check.rb
roodi-4.0.0 lib/roodi/checks/npath_complexity_method_check.rb
roodi-3.3.1 lib/roodi/checks/npath_complexity_method_check.rb
roodi-3.3.0 lib/roodi/checks/npath_complexity_method_check.rb
roodi-3.2.0 lib/roodi/checks/npath_complexity_method_check.rb
roodi-3.1.1 lib/roodi/checks/npath_complexity_method_check.rb
roodi-3.1.0 lib/roodi/checks/npath_complexity_method_check.rb
roodi-3.0.1 lib/roodi/checks/npath_complexity_method_check.rb