Sha256: 245f6ab715d40c9ead3318b9d5d03c504dc7524919ac8494ea0616c22c136df3
Contents?: true
Size: 961 Bytes
Versions: 5
Compression:
Stored size: 961 Bytes
Contents
require 'simplabs/excellent/checks/base' module Simplabs module Excellent module Checks module Rails # This check reports +ActiveRecord+ models that do not validate anything. Not validating anything in the model is usually not intended and has # most likely just been forgotten. For more information on validations and why to use them, see http://guides.rubyonrails.org/activerecord_validations_callbacks.html#why-use-validations. # # ==== Applies to # # * +ActiveRecord+ models class ValidationsCheck < Base def initialize #:nodoc: super @interesting_nodes = [:class] end def evaluate(context) #:nodoc: add_warning(context, '{{class}} does not validate any attributes.', { :class => context.full_name }) if context.active_record_model? && !context.validating? end end end end end end
Version data entries
5 entries across 5 versions & 2 rubygems