Sha256: 05dbc666e02a10aacb9d656828b5424a109393a88a56bbba2bade5df618a3c7f
Contents?: true
Size: 873 Bytes
Versions: 4
Compression:
Stored size: 873 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_contexts = [Parsing::ForLoopContext] @interesting_files = [/\.rb$/, /\.erb$/] end def evaluate(context) #:nodoc: add_warning(context, 'For loop used.') end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems