Class: Rigor::CLI::TypeScanCommand

Inherits:
Object
  • Object
show all
Defined in:
lib/rigor/cli/type_scan_command.rb

Overview

Executes the ‘rigor type-scan` command.

The command walks every Prism node in one or more files, runs ‘Rigor::Scope#type_of` on each, and reports per-node-class coverage of the inference engine’s directly recognized classes. It is the project’s primary CI gate for tracking how much of an input source the engine can name without falling back to ‘Dynamic`.

Defined Under Namespace

Classes: LocatedEvent, ScanAccumulator

Constant Summary collapse

USAGE =
"Usage: rigor type-scan [options] PATH..."

Instance Method Summary collapse

Constructor Details

#initialize(argv:, out:, err:) ⇒ TypeScanCommand

Returns a new instance of TypeScanCommand.



26
27
28
29
30
# File 'lib/rigor/cli/type_scan_command.rb', line 26

def initialize(argv:, out:, err:)
  @argv = argv
  @out = out
  @err = err
end

Instance Method Details

#runInteger

Returns CLI exit status.

Returns:

  • (Integer)

    CLI exit status.



33
34
35
36
37
38
39
40
41
42
# File 'lib/rigor/cli/type_scan_command.rb', line 33

def run
  options = parse_options
  paths = collect_paths(@argv)
  return CLI::EXIT_USAGE if paths.nil?
  return usage_error if paths.empty?

  report = scan_paths(paths, options)
  TypeScanRenderer.new(out: @out).render(report, format: options.fetch(:format))
  determine_exit(report, options)
end