Module: Ucode::Audit::Registry

Defined in:
lib/ucode/audit/registry.rb

Overview

Ordered list of extractor classes run for every audit face.

Order matters only for human-readable output (text formatter). All extractors are independent; their outputs are merged into one big hash before constructing the AuditReport.

MECE / OCP: a new concern = one file under ‘Ucode::Audit::Extractors::*` + one line in the appropriate list below. AuditCommand never enumerates extractors directly.

Constant Summary collapse

ORDERED_EXTRACTORS =

Full audit: every concern. The five cheap extractors come from TODO 08; the five expensive extractors come from TODO 09. The Aggregations extractor (TODO 10) sits last because it depends on UCD baseline resolution.

[
  Extractors::Provenance,
  Extractors::Identity,
  Extractors::Style,
  Extractors::Licensing,
  Extractors::Coverage,
  Extractors::Metrics,
  Extractors::Hinting,
  Extractors::ColorCapabilities,
  Extractors::VariationDetail,
  Extractors::OpenTypeLayout,
  Extractors::Aggregations,
].freeze
BRIEF_EXTRACTORS =

Brief audit: cheap, name-table-only extractors. Used by ‘ucode audit –brief` for a fast inventory pass. Stable list —the expensive extractors are never part of brief mode.

[
  Extractors::Provenance,
  Extractors::Identity,
  Extractors::Style,
  Extractors::Licensing,
  Extractors::Coverage,
].freeze

Class Method Summary collapse

Class Method Details

.each(mode: :full) {|extractor_class| ... } ⇒ void

This method returns an undefined value.

Iterate the extractors appropriate for the given mode.

Parameters:

  • mode (Symbol) (defaults to: :full)

    :full (default) or :brief

Yield Parameters:

  • extractor_class (Class)


49
50
51
# File 'lib/ucode/audit/registry.rb', line 49

def self.each(mode: :full, &)
  extractors_for(mode).each(&)
end

.extractors_for(mode) ⇒ Array<Class>

Returns the extractor list for the given mode.

Parameters:

  • mode (Symbol)

    :full or :brief

Returns:

  • (Array<Class>)

    the extractor list for the given mode



55
56
57
58
59
60
# File 'lib/ucode/audit/registry.rb', line 55

def self.extractors_for(mode)
  case mode
  when :brief then BRIEF_EXTRACTORS
  else ORDERED_EXTRACTORS
  end
end