Module: SimpleCov::CLI::Ratchet::Output
Constant Summary
CommandHelpers::STATS_ROW_FORMAT
Instance Method Summary
collapse
build_parser, command_name, common_options, error, error_nil, on_help, one?, parse_common, quiet_option, recorded_contexts, stats_row
Instance Method Details
#change_summary(outcome, generated) ⇒ Object
19
20
21
22
23
24
|
# File 'lib/simplecov/cli/ratchet/output.rb', line 19
def change_summary(outcome, generated)
files = outcome.baseline.entries.size
return "#{files} #{one?(files) ? "file" : "files"}" if generated
"#{outcome.tightened.size} tightened, #{outcome.pruned.size} pruned, #{outcome.unchanged.size} unchanged"
end
|
#emit(stdout, opts, outcome, generated) ⇒ Object
11
12
13
14
15
16
17
|
# File 'lib/simplecov/cli/ratchet/output.rb', line 11
def emit(stdout, opts, outcome, generated)
return stdout.puts(JSON.generate(json_summary(opts, outcome, generated))) if opts.fetch(:json)
verb = opts.fetch(:dry_run) ? "would write" : "wrote"
stdout.puts("simplecov ratchet: #{verb} #{opts.fetch(:baseline)} (#{change_summary(outcome, generated)})")
report_regressed(stdout, outcome.regressed)
end
|
#json_summary(opts, outcome, generated) ⇒ Object
33
34
35
36
37
38
39
40
|
# File 'lib/simplecov/cli/ratchet/output.rb', line 33
def json_summary(opts, outcome, generated)
{
written: !opts.fetch(:dry_run), path: opts.fetch(:baseline), generated: generated,
files: outcome.baseline.entries.size,
tightened: outcome.tightened, pruned: outcome.pruned,
regressed: outcome.regressed, unchanged: outcome.unchanged
}
end
|
#report_regressed(stdout, regressed) ⇒ Object
26
27
28
29
30
31
|
# File 'lib/simplecov/cli/ratchet/output.rb', line 26
def report_regressed(stdout, regressed)
return if regressed.empty?
noun = one?(regressed.size) ? "1 file below its floor" : "#{regressed.size} files below their floors"
stdout.puts("simplecov ratchet: #{noun}, entries kept unchanged")
end
|