lib/spoom/deadcode.rb in spoom-1.2.2 vs lib/spoom/deadcode.rb in spoom-1.2.3
- old
+ new
@@ -10,10 +10,11 @@
require_relative "deadcode/location"
require_relative "deadcode/definition"
require_relative "deadcode/reference"
require_relative "deadcode/send"
+require_relative "deadcode/plugins"
module Spoom
module Deadcode
class Error < Spoom::Error
extend T::Sig
@@ -32,24 +33,24 @@
class IndexerError < Error; end
class << self
extend T::Sig
- sig { params(index: Index, ruby: String, file: String).void }
- def index_ruby(index, ruby, file:)
+ sig { params(index: Index, ruby: String, file: String, plugins: T::Array[Deadcode::Plugins::Base]).void }
+ def index_ruby(index, ruby, file:, plugins: [])
node = SyntaxTree.parse(ruby)
- visitor = Spoom::Deadcode::Indexer.new(file, ruby, index)
+ visitor = Spoom::Deadcode::Indexer.new(file, ruby, index, plugins: plugins)
visitor.visit(node)
rescue SyntaxTree::Parser::ParseError => e
raise ParserError.new("Error while parsing #{file} (#{e.message} at #{e.lineno}:#{e.column})", parent: e)
rescue => e
raise IndexerError.new("Error while indexing #{file} (#{e.message})", parent: e)
end
- sig { params(index: Index, erb: String, file: String).void }
- def index_erb(index, erb, file:)
+ sig { params(index: Index, erb: String, file: String, plugins: T::Array[Deadcode::Plugins::Base]).void }
+ def index_erb(index, erb, file:, plugins: [])
ruby = ERB.new(erb).src
- index_ruby(index, ruby, file: file)
+ index_ruby(index, ruby, file: file, plugins: plugins)
end
end
end
end