Module: Spoom

Extended by:
T::Sig
Defined in:
lib/spoom/poset.rb,
lib/spoom.rb,
lib/spoom/cli.rb,
lib/spoom/parse.rb,
lib/spoom/colors.rb,
lib/spoom/sorbet.rb,
lib/spoom/cli/srb.rb,
lib/spoom/context.rb,
lib/spoom/printer.rb,
lib/spoom/version.rb,
lib/spoom/visitor.rb,
lib/spoom/coverage.rb,
lib/spoom/location.rb,
lib/spoom/timeline.rb,
lib/spoom/file_tree.rb,
lib/spoom/cli/config.rb,
lib/spoom/cli/helper.rb,
lib/spoom/cli/srb/tc.rb,
lib/spoom/sorbet/lsp.rb,
lib/spoom/cli/srb/lsp.rb,
lib/spoom/context/git.rb,
lib/spoom/coverage/d3.rb,
lib/spoom/model/model.rb,
lib/spoom/sorbet/sigs.rb,
lib/spoom/cli/deadcode.rb,
lib/spoom/cli/srb/bump.rb,
lib/spoom/cli/srb/sigs.rb,
lib/spoom/context/exec.rb,
lib/spoom/deadcode/erb.rb,
lib/spoom/deadcode/send.rb,
lib/spoom/model/builder.rb,
lib/spoom/sorbet/config.rb,
lib/spoom/sorbet/errors.rb,
lib/spoom/sorbet/sigils.rb,
lib/spoom/context/bundle.rb,
lib/spoom/context/sorbet.rb,
lib/spoom/deadcode/index.rb,
lib/spoom/file_collector.rb,
lib/spoom/sorbet/metrics.rb,
lib/spoom/coverage/d3/pie.rb,
lib/spoom/coverage/report.rb,
lib/spoom/model/reference.rb,
lib/spoom/sorbet/lsp/base.rb,
lib/spoom/cli/srb/coverage.rb,
lib/spoom/coverage/d3/base.rb,
lib/spoom/deadcode/indexer.rb,
lib/spoom/deadcode/plugins.rb,
lib/spoom/deadcode/remover.rb,
lib/spoom/coverage/snapshot.rb,
lib/spoom/sorbet/lsp/errors.rb,
lib/spoom/context/file_system.rb,
lib/spoom/deadcode/definition.rb,
lib/spoom/coverage/d3/timeline.rb,
lib/spoom/deadcode/plugins/base.rb,
lib/spoom/deadcode/plugins/rake.rb,
lib/spoom/deadcode/plugins/ruby.rb,
lib/spoom/deadcode/plugins/thor.rb,
lib/spoom/sorbet/lsp/structures.rb,
lib/spoom/coverage/d3/circle_map.rb,
lib/spoom/deadcode/plugins/rails.rb,
lib/spoom/deadcode/plugins/rspec.rb,
lib/spoom/deadcode/plugins/sorbet.rb,
lib/spoom/model/namespace_visitor.rb,
lib/spoom/deadcode/plugins/graphql.rb,
lib/spoom/deadcode/plugins/rubocop.rb,
lib/spoom/model/references_visitor.rb,
lib/spoom/backtrace_filter/minitest.rb,
lib/spoom/deadcode/plugins/minitest.rb,
lib/spoom/deadcode/plugins/actionpack.rb,
lib/spoom/deadcode/plugins/active_job.rb,
lib/spoom/deadcode/plugins/namespaces.rb,
lib/spoom/deadcode/plugins/active_model.rb,
lib/spoom/deadcode/plugins/action_mailer.rb,
lib/spoom/deadcode/plugins/active_record.rb,
lib/spoom/deadcode/plugins/active_support.rb,
lib/spoom/deadcode/plugins/action_mailer_preview.rb

Overview

typed: strict frozen_string_literal: true

Defined Under Namespace

Modules: BacktraceFilter, Cli, Colorize, Coverage, Deadcode, Git, LSP, Sorbet Classes: Color, Context, Error, ExecResult, FileCollector, FileTree, Location, Model, ParseError, Poset, Printer, Timeline, Visitor

Constant Summary collapse

SPOOM_PATH =
T.let((Pathname.new(__FILE__) / ".." / "..").to_s, String)
VERSION =
"1.5.2"

Class Method Summary collapse

Class Method Details

.parse_ruby(ruby, file:) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/spoom/parse.rb', line 13

def parse_ruby(ruby, file:)
  result = Prism.parse(ruby)
  unless result.success?
    message = +"Error while parsing #{file}:\n"

    result.errors.each do |e|
      message << "- #{e.message} (at #{e.location.start_line}:#{e.location.start_column})\n"
    end

    raise ParseError, message
  end

  result.value
end