Sha256: 0a373ad649f96abe7745850c15ced1f265de59ff4f18ff749e684ab1cafcd244

Contents?: true

Size: 963 Bytes

Versions: 15

Compression:

Stored size: 963 Bytes

Contents

# encoding: utf-8
require 'rails_best_practices/reviews/review'

module RailsBestPractices
  module Reviews
    # Review a helper file to make sure it is not an empty moduel.
    #
    # See the best practice details here http://rails-bestpractices.com/posts/72-remove-empty-helpers.
    #
    # Implementation:
    #
    # Review process:
    #   check all helper files, if the body of module is nil, then the helper file should be removed.
    class RemoveEmptyHelpersReview < Review
      interesting_nodes :module
      interesting_files HELPER_FILES

      def url
        "http://rails-bestpractices.com/posts/72-remove-empty-helpers"
      end

      # check the body of module node, if it is nil, then it should be removed.
      def start_module(node)
        if s(:bodystmt, s(:stmts_add, s(:stmts_new), s(:void_stmt)), nil, nil, nil) == node.body
          add_error "remove empty helpers", node.file, node.line
        end
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 2 rubygems

Version Path
rails_best_practices-1.10.1 lib/rails_best_practices/reviews/remove_empty_helpers_review.rb
rails_best_practices-gorgeouscode-1.0.0 lib/rails_best_practices/reviews/remove_empty_helpers_review.rb
rails_best_practices-1.10.0 lib/rails_best_practices/reviews/remove_empty_helpers_review.rb
rails_best_practices-1.9.1 lib/rails_best_practices/reviews/remove_empty_helpers_review.rb
rails_best_practices-1.9.0 lib/rails_best_practices/reviews/remove_empty_helpers_review.rb
rails_best_practices-1.8.0 lib/rails_best_practices/reviews/remove_empty_helpers_review.rb
rails_best_practices-1.7.2 lib/rails_best_practices/reviews/remove_empty_helpers_review.rb
rails_best_practices-1.7.1 lib/rails_best_practices/reviews/remove_empty_helpers_review.rb
rails_best_practices-1.7.0 lib/rails_best_practices/reviews/remove_empty_helpers_review.rb
rails_best_practices-1.6.0 lib/rails_best_practices/reviews/remove_empty_helpers_review.rb
rails_best_practices-1.5.3 lib/rails_best_practices/reviews/remove_empty_helpers_review.rb
rails_best_practices-1.5.2 lib/rails_best_practices/reviews/remove_empty_helpers_review.rb
rails_best_practices-1.5.1 lib/rails_best_practices/reviews/remove_empty_helpers_review.rb
rails_best_practices-1.5.0 lib/rails_best_practices/reviews/remove_empty_helpers_review.rb
rails_best_practices-1.4.0 lib/rails_best_practices/reviews/remove_empty_helpers_review.rb