Sha256: 25c25d6c03533fa92242a09a72bb1ee5291ce07a67f06f516d59d405e88ca6b5
Contents?: true
Size: 950 Bytes
Versions: 1
Compression:
Stored size: 950 Bytes
Contents
# encoding: utf-8 module Rubocop module Cop module Rails # This cop checks for the use of old-style attribute validation macros. class Validation < Cop MSG = 'Use the new "sexy" validations (validates ...).' BLACKLIST = [:validates_acceptance_of, :validates_confirmation_of, :validates_exclusion_of, :validates_format_of, :validates_inclusion_of, :validates_length_of, :validates_numericality_of, :validates_presence_of, :validates_size_of] def self.rails? true end def on_send(node) receiver, method_name, *_args = *node if receiver.nil? && BLACKLIST.include?(method_name) add_offence(:convention, node.loc.selector, MSG) end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rubocop-0.9.0 | lib/rubocop/cop/rails/validation.rb |