Sha256: 1fefb9735e0b51938758123f0bc8966d60ded2a5e5d48c33ca7f1bab4bc57002
Contents?: true
Size: 725 Bytes
Versions: 32
Compression:
Stored size: 725 Bytes
Contents
# frozen_string_literal: true require "rubocop" module RuboCop module Cop module GitHub class RailsApplicationRecord < Cop MSG = "Models should subclass from ApplicationRecord" def_node_matcher :active_record_base_const?, <<-PATTERN (const (const nil? :ActiveRecord) :Base) PATTERN def_node_matcher :application_record_const?, <<-PATTERN (const nil? :ApplicationRecord) PATTERN def on_class(node) klass, superclass, _ = *node if active_record_base_const?(superclass) && !(application_record_const?(klass)) add_offense(superclass, location: :expression) end end end end end end
Version data entries
32 entries across 32 versions & 2 rubygems