Sha256: 522ac323e6dbbf34a003bbf7e812bf78ab3ea987217aa3ea7932101d5eb5cf91

Contents?: true

Size: 561 Bytes

Versions: 19

Compression:

Stored size: 561 Bytes

Contents

require 'roodi/checks/check'

module Roodi
  module Checks
    # Checks to make sure for loops are not being used..
    # 
    # Using a for loop is not idiomatic use of Ruby, and is usually a sign that someone with 
    # more experience in a different programming language is trying out Ruby.  Use 
    # Enumerable.each with a block instead.
    class ForLoopCheck < Check
      def interesting_nodes
        [:for]
      end

      def evaluate_start(node)
        add_error "Don't use 'for' loops. Use Enumerable.each instead."
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 3 rubygems

Version Path
roodi-5.0.0 lib/roodi/checks/for_loop_check.rb
roodi-4.1.1 lib/roodi/checks/for_loop_check.rb
roodi-4.1.0 lib/roodi/checks/for_loop_check.rb
roodi-4.0.0 lib/roodi/checks/for_loop_check.rb
roodi-3.3.1 lib/roodi/checks/for_loop_check.rb
roodi-3.3.0 lib/roodi/checks/for_loop_check.rb
roodi-3.2.0 lib/roodi/checks/for_loop_check.rb
roodi-3.1.1 lib/roodi/checks/for_loop_check.rb
roodi-3.1.0 lib/roodi/checks/for_loop_check.rb
roodi-3.0.1 lib/roodi/checks/for_loop_check.rb
roodi-3.0.0 lib/roodi/checks/for_loop_check.rb
metric_fu-roodi-2.2.2 lib/roodi/checks/for_loop_check.rb
metric_fu-roodi-2.2.1 lib/roodi/checks/for_loop_check.rb
roodi-2.2.0 lib/roodi/checks/for_loop_check.rb
metric_fu-roodi-2.2.0 lib/roodi/checks/for_loop_check.rb
roodi1.9-2.0.1 lib/roodi/checks/for_loop_check.rb
roodi-2.1.0 lib/roodi/checks/for_loop_check.rb
roodi-2.0.1 lib/roodi/checks/for_loop_check.rb
roodi-2.0.0 lib/roodi/checks/for_loop_check.rb