Class: Henitai::Reporter::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/henitai/reporter.rb,
sig/henitai.rbs

Overview

Base class for all reporters.

Direct Known Subclasses

Dashboard, DryRun, Github, Html, Json, Terminal

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config:, history_store: nil) ⇒ Base

Returns a new instance of Base.

Parameters:

  • history_store (MutantHistoryStore, nil) (defaults to: nil)

    accepted by every reporter for a uniform factory signature; only the JSON reporter uses it. Ignored elsewhere.

  • config: (Configuration)
  • history_store: (MutantHistoryStore, nil) (defaults to: nil)


46
47
48
49
# File 'lib/henitai/reporter.rb', line 46

def initialize(config:, history_store: nil)
  @config = config
  @history_store = history_store
end

Instance Attribute Details

#configConfiguration (readonly)

Returns the value of attribute config.

Returns:



58
59
60
# File 'lib/henitai/reporter.rb', line 58

def config
  @config
end

#history_storeMutantHistoryStore? (readonly)

Returns the value of attribute history_store.

Returns:



58
59
60
# File 'lib/henitai/reporter.rb', line 58

def history_store
  @history_store
end

Instance Method Details

#authoritative?(result) ⇒ Boolean

Authoritative (full) runs fully replace the canonical report; scoped/partial runs merge into it (CanonicalReportMerger) so findings for files outside this run's scope aren't lost.

Parameters:

  • (Object)

Returns:

  • (Boolean)


63
64
65
66
67
# File 'lib/henitai/reporter.rb', line 63

def authoritative?(result)
  return true unless result.respond_to?(:authoritative?)

  result.authoritative?
end

#canonical_pathString

The merge source of truth is always the JSON canonical report, even for the HTML reporter, which embeds the same merged schema.

Returns:

  • (String)


71
72
73
# File 'lib/henitai/reporter.rb', line 71

def canonical_path
  File.join(config.reports_dir, "mutation-report.json")
end

#report(result) ⇒ void

This method returns an undefined value.

Parameters:

Raises:

  • (NotImplementedError)


52
53
54
# File 'lib/henitai/reporter.rb', line 52

def report(result)
  raise NotImplementedError, "#{self.class}#report must be implemented"
end