Sha256: 593828f19a69d880433c6b27f3dfb942fd88a447444bb4e463f97d75406f1da2
Contents?: true
Size: 944 Bytes
Versions: 11
Compression:
Stored size: 944 Bytes
Contents
# frozen_string_literal: true module RuboCop module Cop module Rails # This cop checks that controllers subclass ApplicationController. # # @example # # # good # class MyController < ApplicationController # # ... # end # # # bad # class MyController < ActionController::Base # # ... # end class ApplicationController < Cop MSG = 'Controllers should subclass `ApplicationController`.' SUPERCLASS = 'ApplicationController' BASE_PATTERN = '(const (const nil? :ActionController) :Base)' # rubocop:disable Layout/ClassStructure include RuboCop::Cop::EnforceSuperclass # rubocop:enable Layout/ClassStructure def autocorrect(node) lambda do |corrector| corrector.replace(node.source_range, self.class::SUPERCLASS) end end end end end end
Version data entries
11 entries across 11 versions & 1 rubygems