Sha256: da33489e07c19fd9d449625a6759e4860a0152551c881e06912d28b81facce92
Contents?: true
Size: 848 Bytes
Versions: 8
Compression:
Stored size: 848 Bytes
Contents
require 'simplabs/excellent/checks/base' module Simplabs module Excellent module Checks # This check reports code that uses +for+ loops as in: # # for user in @users # do_something(user) # end # # The use of for loops in Ruby is contrary to the language's basic concept of iterators. The above statement would better be written as: # # @users.each do |user| # do_something(user) # end # # ==== Applies to # # * +for+ loops class ForLoopCheck < Base def initialize #:nodoc: super @interesting_nodes = [:for] @interesting_files = [/\.rb$/, /\.erb$/] end def evaluate(context) #:nodoc: add_warning(context, 'For loop used.') end end end end end
Version data entries
8 entries across 8 versions & 2 rubygems