Class: Moult::BoundariesReport
- Inherits:
-
Object
- Object
- Moult::BoundariesReport
- Defined in:
- lib/moult/boundaries_report.rb
Overview
The serialized result model for moult boundaries (schema/boundaries.schema.json),
sibling to DuplicationReport, DeadCodeReport, CoverageReport and HealthReport.
It owns its own JSON envelope and leaves the other protected contracts untouched.
Each Finding is one recorded architecture-boundary violation group. Unlike the
dead-code/duplication contracts it carries confidence: null (a packwerk violation
is a recorded fact, not a probabilistic candidate) and a Moult::Boundaries::Severity
classification instead — the honest per-finding grade for this slice. Nothing here
asserts the code is wrong, only that packwerk recorded a declared-boundary crossing.
Defined Under Namespace
Classes: Finding, Occurrence
Constant Summary collapse
- SCHEMA_VERSION =
Bump only on a breaking change to the serialized shape.
1
Instance Attribute Summary collapse
-
#backend ⇒ Object
readonly
Returns the value of attribute backend.
-
#backend_version ⇒ Object
readonly
Returns the value of attribute backend_version.
-
#configured ⇒ Object
readonly
Returns the value of attribute configured.
-
#findings ⇒ Object
readonly
Returns the value of attribute findings.
-
#generated_at ⇒ Object
readonly
Returns the value of attribute generated_at.
-
#git_ref ⇒ Object
readonly
Returns the value of attribute git_ref.
-
#root ⇒ Object
readonly
Returns the value of attribute root.
Instance Method Summary collapse
-
#initialize(root:, findings:, git_ref: nil, generated_at: nil, backend: "packwerk", backend_version: nil, configured: false) ⇒ BoundariesReport
constructor
A new instance of BoundariesReport.
-
#summary ⇒ Hash
Aggregate counts across all violation groups.
- #to_h ⇒ Object
Constructor Details
#initialize(root:, findings:, git_ref: nil, generated_at: nil, backend: "packwerk", backend_version: nil, configured: false) ⇒ BoundariesReport
Returns a new instance of BoundariesReport.
56 57 58 59 60 61 62 63 64 65 |
# File 'lib/moult/boundaries_report.rb', line 56 def initialize(root:, findings:, git_ref: nil, generated_at: nil, backend: "packwerk", backend_version: nil, configured: false) @root = root @findings = findings @git_ref = git_ref @generated_at = generated_at @backend = backend @backend_version = backend_version @configured = configured end |
Instance Attribute Details
#backend ⇒ Object (readonly)
Returns the value of attribute backend.
49 50 51 |
# File 'lib/moult/boundaries_report.rb', line 49 def backend @backend end |
#backend_version ⇒ Object (readonly)
Returns the value of attribute backend_version.
49 50 51 |
# File 'lib/moult/boundaries_report.rb', line 49 def backend_version @backend_version end |
#configured ⇒ Object (readonly)
Returns the value of attribute configured.
49 50 51 |
# File 'lib/moult/boundaries_report.rb', line 49 def configured @configured end |
#findings ⇒ Object (readonly)
Returns the value of attribute findings.
49 50 51 |
# File 'lib/moult/boundaries_report.rb', line 49 def findings @findings end |
#generated_at ⇒ Object (readonly)
Returns the value of attribute generated_at.
49 50 51 |
# File 'lib/moult/boundaries_report.rb', line 49 def generated_at @generated_at end |
#git_ref ⇒ Object (readonly)
Returns the value of attribute git_ref.
49 50 51 |
# File 'lib/moult/boundaries_report.rb', line 49 def git_ref @git_ref end |
#root ⇒ Object (readonly)
Returns the value of attribute root.
49 50 51 |
# File 'lib/moult/boundaries_report.rb', line 49 def root @root end |
Instance Method Details
#summary ⇒ Hash
Returns aggregate counts across all violation groups.
68 69 70 71 72 73 74 75 |
# File 'lib/moult/boundaries_report.rb', line 68 def summary { findings: findings.size, violations: findings.sum { |f| f.occurrences.size }, by_type: tally { |f| f.violation_type }, by_severity: tally { |f| f.severity } } end |
#to_h ⇒ Object
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/moult/boundaries_report.rb', line 77 def to_h { schema_version: SCHEMA_VERSION, tool: {name: "moult", version: Moult::VERSION}, analysis: { root: root, git_ref: git_ref, generated_at: generated_at, detector: { backend: backend, backend_version: backend_version, configured: configured } }, summary: summary, findings: findings.map(&:to_h) } end |