Sha256: 4841b9d52264b9d2ec66b1e75875a9eb6dcf961a69ba71f79006741e583d955b
Contents?: true
Size: 921 Bytes
Versions: 7
Compression:
Stored size: 921 Bytes
Contents
# frozen_string_literal: true module RuboCop module Cop module Salsify # Check that serializers subclass ApplicationSerializer with Rails 5.0. # # @example # # # good # class Tesla < ApplicationSerializer # ... # end # # # bad # class Yugo < ActiveModel::Serializer # ... # end class RailsApplicationSerializer < Cop extend TargetRailsVersion minimum_target_rails_version 5.0 MSG = 'Serializers should subclass `ApplicationSerializer`.' SUPERCLASS = 'ApplicationSerializer' BASE_PATTERN = '(const (const nil? :ActiveModel) :Serializer)' include RuboCop::Cop::EnforceSuperclass def autocorrect(node) lambda do |corrector| corrector.replace(node.source_range, self.class::SUPERCLASS) end end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems