Class: Fontisan::Audit::Check
- Inherits:
-
Object
- Object
- Fontisan::Audit::Check
- Defined in:
- lib/fontisan/audit/check.rb
Overview
Abstract base for all audit checks. A check is a stateless function that examines a loaded font and returns an Array of Models::ValidationReport::Issue records. An empty array means the font passed the check.
Subclasses MUST override Check.call and Check.code.
Checks are intentionally stateless + side-effect free so they can be composed, run in parallel, and tested in isolation.
Direct Known Subclasses
Fontisan::Audit::Checks::CffTableCheck, Fontisan::Audit::Checks::CmapCheck, Fontisan::Audit::Checks::CollectionIntegrityCheck, Fontisan::Audit::Checks::FormatRoundTripCheck, Fontisan::Audit::Checks::GlyfTableCheck, Fontisan::Audit::Checks::GlyphNameCheck, Fontisan::Audit::Checks::HeadCheck, Fontisan::Audit::Checks::HheaCheck, Fontisan::Audit::Checks::HintingCheck, Fontisan::Audit::Checks::KernCheck, Fontisan::Audit::Checks::LayoutTableCheck, Fontisan::Audit::Checks::MaxpCheck, Fontisan::Audit::Checks::NameTableCheck, Fontisan::Audit::Checks::NamingConsistencyCheck, Fontisan::Audit::Checks::OpenTypeConformanceCheck, Fontisan::Audit::Checks::Os2Check, Fontisan::Audit::Checks::OtsCompatibilityCheck, Fontisan::Audit::Checks::PostCheck, Fontisan::Audit::Checks::TableDirectoryCheck, Fontisan::Audit::Checks::VariableFontCheck, Fontisan::Audit::Checks::Woff2ValidationCheck
Class Method Summary collapse
-
.call(font) ⇒ Array<Models::ValidationReport::Issue>
Run the check against
font. -
.code ⇒ Symbol
Unique short identifier for this check (e.g. :table_checksum).
-
.issue(severity:, message:, location: nil) ⇒ Models::ValidationReport::Issue
Build an issue.
Class Method Details
.call(font) ⇒ Array<Models::ValidationReport::Issue>
Run the check against font.
21 22 23 24 |
# File 'lib/fontisan/audit/check.rb', line 21 def self.call(font) raise NotImplementedError, "#{name} must override .call(font) -> Array<Issue>" end |
.code ⇒ Symbol
Unique short identifier for this check (e.g. :table_checksum).
Used as the issue category for programmatic filtering.
30 31 32 33 |
# File 'lib/fontisan/audit/check.rb', line 30 def self.code raise NotImplementedError, "#{name} must override .code -> Symbol" end |
.issue(severity:, message:, location: nil) ⇒ Models::ValidationReport::Issue
Build an issue. Centralizes the category so callers don't repeat it.
37 38 39 40 41 42 43 44 |
# File 'lib/fontisan/audit/check.rb', line 37 def self.issue(severity:, message:, location: nil) Models::ValidationReport::Issue.new( severity: severity.to_s, category: code.to_s, message: , location: location, ) end |