Sha256: e5eee3c4b704e0280ea3e9feab6a08a2c6d93564f206c06ec525304b31a4a455

Contents?: true

Size: 1 KB

Versions: 5

Compression:

Stored size: 1 KB

Contents

# typed: strict
# frozen_string_literal: true

module Spoom
  module Deadcode
    module Plugins
      class Rubocop < Base
        extend T::Sig

        RUBOCOP_CONSTANTS = T.let(["MSG", "RESTRICT_ON_SEND"].to_set.freeze, T::Set[String])

        ignore_classes_inheriting_from(
          "RuboCop::Cop::Cop",
          "RuboCop::Cop::Base",
        )

        sig { override.params(definition: Model::Constant).void }
        def on_define_constant(definition)
          owner = definition.owner
          return false unless owner.is_a?(Model::Class)

          @index.ignore(definition) if ignored_subclass?(owner) && RUBOCOP_CONSTANTS.include?(definition.name)
        end

        sig { override.params(definition: Model::Method).void }
        def on_define_method(definition)
          return unless definition.name == "on_send"

          owner = definition.owner
          return unless owner.is_a?(Model::Class)

          @index.ignore(definition) if ignored_subclass?(owner)
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
spoom-1.5.0 lib/spoom/deadcode/plugins/rubocop.rb
spoom-1.4.2 lib/spoom/deadcode/plugins/rubocop.rb
spoom-1.4.1 lib/spoom/deadcode/plugins/rubocop.rb
spoom-1.4.0 lib/spoom/deadcode/plugins/rubocop.rb
spoom-1.3.3 lib/spoom/deadcode/plugins/rubocop.rb