Sha256: 0d15b4c1200dd5aed83fd20803585947958f9894de38589f7e8addeccdc385a1

Contents?: true

Size: 512 Bytes

Versions: 6

Compression:

Stored size: 512 Bytes

Contents

require 'roodi/checks/check'

module Roodi
  module Checks
    class ControlCouplingCheck < Check
      def interesting_nodes
        [:defn, :lvar]
      end

      def evaluate_defn(node)
        @method_name = node[1]
        @arguments = node[2][1][1]
        @arguments.delete_at 0
      end
        
      def evaluate_lvar(node)
        add_error "Method \"#{@method_name}\" uses the argument \"#{node[1]}\" for internal control." if @arguments.detect {|each| each == node[1]}
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
roodi-1.3.4 lib/roodi/checks/control_coupling_check.rb
roodi-1.3.5 lib/roodi/checks/control_coupling_check.rb
roodi-1.3.3 lib/roodi/checks/control_coupling_check.rb
roodi-1.3.6 lib/roodi/checks/control_coupling_check.rb
roodi-1.3.7 lib/roodi/checks/control_coupling_check.rb
roodi-1.3.2 lib/roodi/checks/control_coupling_check.rb