Class: Moult::DeadCodeReport
- Inherits:
-
Object
- Object
- Moult::DeadCodeReport
- Defined in:
- lib/moult/dead_code_report.rb
Overview
The serialized result model for moult deadcode, sibling to Report. It
owns the JSON envelope (schema/deadcode.schema.json) and leaves the protected
hotspots Report untouched. The findings it carries are
Confidence::Finding objects — the per-finding confidence model is the
protected API, so this class only adds the report-level envelope around it.
Constant Summary collapse
- SCHEMA_VERSION =
Bump only on a breaking change to the serialized shape. v2 adds the Phase 3 runtime block: analysis.coverage provenance and a per-finding runtime classification (both null when no coverage was merged).
2
Instance Attribute Summary collapse
-
#backend ⇒ Object
readonly
Returns the value of attribute backend.
-
#backend_version ⇒ Object
readonly
Returns the value of attribute backend_version.
-
#coverage_source ⇒ Object
readonly
Returns the value of attribute coverage_source.
-
#diagnostics ⇒ Object
readonly
Returns the value of attribute diagnostics.
-
#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.
-
#rails ⇒ Object
readonly
Returns the value of attribute rails.
-
#resolved ⇒ Object
readonly
Returns the value of attribute resolved.
-
#root ⇒ Object
readonly
Returns the value of attribute root.
Instance Method Summary collapse
-
#initialize(root:, findings:, git_ref: nil, generated_at: nil, backend: "rubydex", backend_version: nil, resolved: true, rails: false, diagnostics: [], coverage_source: nil) ⇒ DeadCodeReport
constructor
A new instance of DeadCodeReport.
- #to_h ⇒ Object
Constructor Details
#initialize(root:, findings:, git_ref: nil, generated_at: nil, backend: "rubydex", backend_version: nil, resolved: true, rails: false, diagnostics: [], coverage_source: nil) ⇒ DeadCodeReport
Returns a new instance of DeadCodeReport.
29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/moult/dead_code_report.rb', line 29 def initialize(root:, findings:, git_ref: nil, generated_at: nil, backend: "rubydex", backend_version: nil, resolved: true, rails: false, diagnostics: [], coverage_source: nil) @root = root @findings = findings @git_ref = git_ref @generated_at = generated_at @backend = backend @backend_version = backend_version @resolved = resolved @rails = rails @diagnostics = diagnostics @coverage_source = coverage_source end |
Instance Attribute Details
#backend ⇒ Object (readonly)
Returns the value of attribute backend.
15 16 17 |
# File 'lib/moult/dead_code_report.rb', line 15 def backend @backend end |
#backend_version ⇒ Object (readonly)
Returns the value of attribute backend_version.
15 16 17 |
# File 'lib/moult/dead_code_report.rb', line 15 def backend_version @backend_version end |
#coverage_source ⇒ Object (readonly)
Returns the value of attribute coverage_source.
15 16 17 |
# File 'lib/moult/dead_code_report.rb', line 15 def coverage_source @coverage_source end |
#diagnostics ⇒ Object (readonly)
Returns the value of attribute diagnostics.
15 16 17 |
# File 'lib/moult/dead_code_report.rb', line 15 def diagnostics @diagnostics end |
#findings ⇒ Object (readonly)
Returns the value of attribute findings.
15 16 17 |
# File 'lib/moult/dead_code_report.rb', line 15 def findings @findings end |
#generated_at ⇒ Object (readonly)
Returns the value of attribute generated_at.
15 16 17 |
# File 'lib/moult/dead_code_report.rb', line 15 def generated_at @generated_at end |
#git_ref ⇒ Object (readonly)
Returns the value of attribute git_ref.
15 16 17 |
# File 'lib/moult/dead_code_report.rb', line 15 def git_ref @git_ref end |
#rails ⇒ Object (readonly)
Returns the value of attribute rails.
15 16 17 |
# File 'lib/moult/dead_code_report.rb', line 15 def rails @rails end |
#resolved ⇒ Object (readonly)
Returns the value of attribute resolved.
15 16 17 |
# File 'lib/moult/dead_code_report.rb', line 15 def resolved @resolved end |
#root ⇒ Object (readonly)
Returns the value of attribute root.
15 16 17 |
# File 'lib/moult/dead_code_report.rb', line 15 def root @root end |
Instance Method Details
#to_h ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/moult/dead_code_report.rb', line 44 def to_h { schema_version: SCHEMA_VERSION, tool: {name: "moult", version: Moult::VERSION}, analysis: { root: root, git_ref: git_ref, generated_at: generated_at, coverage: coverage_source&.to_h, index: { backend: backend, backend_version: backend_version, resolved: resolved, rails: rails, diagnostics: diagnostics } }, findings: findings.map(&:to_h) } end |