Class: Moult::CLI::CoverageCommand

Inherits:
Object
  • Object
show all
Defined in:
lib/moult/cli/coverage_command.rb

Overview

moult coverage [PATH] --coverage FILE — a per-symbol hot/cold/untracked map resolved from a local coverage file. Thin layer: parse options, build the index, load the dataset, drive Moult::CoverageReport.build, format. The map is diagnostic; it makes no dead-code claim (see moult deadcode --coverage for the confidence merge).

Constant Summary collapse

VALID_FORMATS =
%i[auto simplecov coverage].freeze

Instance Method Summary collapse

Instance Method Details

#run(argv) ⇒ Integer

Returns process exit status.

Returns:

  • (Integer)

    process exit status



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/moult/cli/coverage_command.rb', line 17

def run(argv)
  options = parse(argv)
  return puts_help(options) if options[:help]

  unless options[:coverage]
    warn "moult: coverage requires --coverage PATH"
    warn @parser
    return 1
  end

  root = File.expand_path(options[:path])
  unless File.exist?(root)
    warn "moult: no such file or directory: #{options[:path]}"
    return 1
  end

  puts render(analyze(root, options), options)
  0
rescue OptionParser::ParseError => e
  warn "moult: #{e.message}"
  1
rescue => e
  warn "moult: #{e.message}"
  1
end