Sha256: 2b2a0adf167e54e54030c71e1907e81d210ce9fd6b807346f5a22c2db5f86323
Contents?: true
Size: 1.25 KB
Versions: 1
Compression:
Stored size: 1.25 KB
Contents
# encoding: utf-8 require 'rails_best_practices/reviews/review' module RailsBestPractices module Reviews # Find out unused methods in models. # # Implemenation: # # Review process: # remember all method calls, # at end, check if all defined methods are called, # if not, non called methods are unused. class RemoveUnusedMethodsInModelsReview < Review include Klassable include Completeable include Callable include Exceptable interesting_files ALL_FILES def initialize(options={}) super @model_methods = Prepares.model_methods end # get all unused methods at the end of review process. def on_complete @model_methods.get_all_unused_methods.each do |method| if !excepted?(method) && method.method_name !~ /=$/ add_error "remove unused methods (#{method.class_name}##{method.method_name})", method.file, method.line end end end protected def methods @model_methods end def internal_except_methods %w(initialize validate to_xml to_json assign_attributes after_find after_initialize).map { |method_name| "*\##{method_name}" } end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rails_best_practices-1.5.0 | lib/rails_best_practices/reviews/remove_unused_methods_in_models_review.rb |