Sha256: f39ecc1b994c55b58aa61227feaeec343d0c09e6405020c8ce2642d5e61bbc8e

Contents?: true

Size: 611 Bytes

Versions: 2

Compression:

Stored size: 611 Bytes

Contents

require 'simplabs/excellent/checks/base'

module Simplabs

  module Excellent

    module Checks

      class ControlCouplingCheck < Base

        def interesting_nodes
          [:defn, :lvar]
        end

        def evaluate_defn(node)
          @method_name = node[1]
          @arguments   = node[2][1..-1]
        end

        def evaluate_lvar(node)
          if @arguments.detect { |argument| argument == node[1] }
            add_error('Control of {{method}} is coupled to {{argument}}.', { :method => @method_name, :argument => node[1] }, -1)
          end
        end

      end

    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
simplabs-excellent-1.0.0 lib/simplabs/excellent/checks/control_coupling_check.rb
simplabs-excellent-1.0.1 lib/simplabs/excellent/checks/control_coupling_check.rb