Sha256: e5b1d50608812a97475ad73b74c868706a59f2fae6759a41c6d027507dacfc3d

Contents?: true

Size: 850 Bytes

Versions: 3

Compression:

Stored size: 850 Bytes

Contents

# typed: strict
# frozen_string_literal: true

module Spoom
  module Deadcode
    module Plugins
      class ActiveSupport < Base
        ignore_classes_inheriting_from(/^(::)?ActiveSupport::TestCase$/)

        ignore_methods_named(
          "after_all",
          "after_setup",
          "after_teardown",
          "before_all",
          "before_setup",
          "before_teardown",
        )

        SETUP_AND_TEARDOWN_METHODS = T.let(["setup", "teardown"], T::Array[String])

        sig { override.params(indexer: Indexer, send: Send).void }
        def on_send(indexer, send)
          return unless send.recv.nil? && SETUP_AND_TEARDOWN_METHODS.include?(send.name)

          send.each_arg(Prism::SymbolNode) do |arg|
            indexer.reference_method(T.must(arg.value), send.node)
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
spoom-1.3.2 lib/spoom/deadcode/plugins/active_support.rb
spoom-1.3.1 lib/spoom/deadcode/plugins/active_support.rb
spoom-1.3.0 lib/spoom/deadcode/plugins/active_support.rb