Sha256: b944218403c86f7f08c0c1597048f3711106730c86e12240656b519f414b46a4

Contents?: true

Size: 863 Bytes

Versions: 65

Compression:

Stored size: 863 Bytes

Contents

# frozen_string_literal: true

module RuboCop
  module Cop
    module InternalAffairs
      # `RuboCop::Cop::Cop` is deprecated and will be removed in Rubocop 2.0.
      # Your custom cop class should inherit from `RuboCop::Cop::Base` instead of
      # `RuboCop::Cop::Cop`.
      #
      # See "v1 Upgrade Notes" for more details:
      # https://docs.rubocop.org/rubocop/v1_upgrade_notes.html
      #
      # @example
      #   # bad
      #   class Foo < Cop
      #   end
      #
      #   # good
      #   class Foo < Base
      #   end
      #
      class InheritDeprecatedCopClass < Base
        MSG = 'Use `Base` instead of `Cop`.'

        def on_class(node)
          return unless (parent_class = node.parent_class)
          return unless parent_class.children.last == :Cop

          add_offense(parent_class)
        end
      end
    end
  end
end

Version data entries

65 entries across 59 versions & 7 rubygems

Version Path
cm-admin-1.5.22 vendor/bundle/ruby/3.3.0/gems/rubocop-1.35.1/lib/rubocop/cop/internal_affairs/inherit_deprecated_cop_class.rb
cm-admin-1.5.21 vendor/bundle/ruby/3.3.0/gems/rubocop-1.35.1/lib/rubocop/cop/internal_affairs/inherit_deprecated_cop_class.rb
cm-admin-1.5.20 vendor/bundle/ruby/3.3.0/gems/rubocop-1.35.1/lib/rubocop/cop/internal_affairs/inherit_deprecated_cop_class.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/rubocop-1.31.2/lib/rubocop/cop/internal_affairs/inherit_deprecated_cop_class.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/rubocop-1.26.0/lib/rubocop/cop/internal_affairs/inherit_deprecated_cop_class.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/rubocop-1.35.1/lib/rubocop/cop/internal_affairs/inherit_deprecated_cop_class.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/rubocop-1.36.0/lib/rubocop/cop/internal_affairs/inherit_deprecated_cop_class.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/rubocop-1.35.1/lib/rubocop/cop/internal_affairs/inherit_deprecated_cop_class.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/rubocop-1.26.0/lib/rubocop/cop/internal_affairs/inherit_deprecated_cop_class.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/rubocop-1.36.0/lib/rubocop/cop/internal_affairs/inherit_deprecated_cop_class.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/rubocop-1.31.2/lib/rubocop/cop/internal_affairs/inherit_deprecated_cop_class.rb
call_your_name-0.1.0 vendor/bundle/ruby/3.1.0/gems/rubocop-1.48.1/lib/rubocop/cop/internal_affairs/inherit_deprecated_cop_class.rb
rubocop-1.48.1 lib/rubocop/cop/internal_affairs/inherit_deprecated_cop_class.rb
rubocop-1.48.0 lib/rubocop/cop/internal_affairs/inherit_deprecated_cop_class.rb
rubocop-1.47.0 lib/rubocop/cop/internal_affairs/inherit_deprecated_cop_class.rb
zilla-0.2.0 vendor/bundle/ruby/3.2.0/gems/rubocop-1.46.0/lib/rubocop/cop/internal_affairs/inherit_deprecated_cop_class.rb
rubocop-1.46.0 lib/rubocop/cop/internal_affairs/inherit_deprecated_cop_class.rb
rubocop-1.45.1 lib/rubocop/cop/internal_affairs/inherit_deprecated_cop_class.rb
rubocop-1.45.0 lib/rubocop/cop/internal_affairs/inherit_deprecated_cop_class.rb
rubocop-1.44.1 lib/rubocop/cop/internal_affairs/inherit_deprecated_cop_class.rb