Module: Henitai::CanonicalReportWriter

Defined in:
lib/henitai/canonical_report_writer.rb,
sig/henitai.rbs

Overview

Writes a Stryker schema to the canonical report path.

Authoritative (full-run) writes replace the file wholesale; non-authoritative writes (scoped/partial runs, and every incremental checkpoint after the first) merge into the existing report via CanonicalReportMerger, pruning entries whose source file no longer exists. Shared by the JSON reporter and the CheckpointReporter so both persist the report identically.

Class Method Summary collapse

Class Method Details

.write(schema, path:, authoritative:) ⇒ Hash[untyped, untyped]

Parameters:

  • (Hash[Symbol, untyped])
  • path: (String)
  • authoritative: (Boolean)

Returns:

  • (Hash[untyped, untyped])


15
16
17
18
19
20
# File 'lib/henitai/canonical_report_writer.rb', line 15

def self.write(schema, path:, authoritative:)
  output = authoritative ? schema : CanonicalReportMerger.merge(schema, path, prune_missing: true)
  FileUtils.mkdir_p(File.dirname(path))
  File.write(path, JSON.pretty_generate(output))
  output
end