Sha256: c5b7362ec56b510e8cc2c824f8262d6b2c25048ee54a636f00c936d61da1e1a7

Contents?: true

Size: 467 Bytes

Versions: 3

Compression:

Stored size: 467 Bytes

Contents

require "rubocop"

module RuboCop
  module Cop
    module GitHub
      class RailsApplicationRecord < Cop
        MSG = "Models should subclass from ApplicationRecord"

        ACTIVE_RECORD_BASE = s(:const, s(:const, nil, :ActiveRecord), :Base)

        def on_class(node)
          _name, superclass, _body = *node

          if superclass == ACTIVE_RECORD_BASE
            add_offense(superclass, :expression)
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rubocop-github-0.2.2 lib/rubocop/cop/github/rails_application_record.rb
rubocop-github-0.2.1 lib/rubocop/cop/github/rails_application_record.rb
rubocop-github-0.2.0 lib/rubocop/cop/github/rails_application_record.rb