Class: Sharekit::Cli::Finding
- Inherits:
-
Data
- Object
- Data
- Sharekit::Cli::Finding
- Includes:
- Comparable
- Defined in:
- lib/sharekit/cli/finding.rb
Overview
Immutable value object for one scan hit. Data.define gives us structural
equality and Hash-pattern deconstruction (in {severity:, rule:}) for free —
a plain TS interface has neither.
The triage fields default to nil, so a scan-only run builds a Finding the
same way it always did, and Triage layers verdicts on with #with rather
than mutating anything.
Instance Attribute Summary collapse
-
#confidence ⇒ Object
readonly
Returns the value of attribute confidence.
-
#file ⇒ Object
readonly
Returns the value of attribute file.
-
#line ⇒ Object
readonly
Returns the value of attribute line.
-
#preview ⇒ Object
readonly
Returns the value of attribute preview.
-
#rationale ⇒ Object
readonly
Returns the value of attribute rationale.
-
#rule ⇒ Object
readonly
Returns the value of attribute rule.
-
#severity ⇒ Object
readonly
Returns the value of attribute severity.
-
#verdict ⇒ Object
readonly
Returns the value of attribute verdict.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #high? ⇒ Boolean
-
#initialize(verdict: nil, confidence: nil, rationale: nil) ⇒ Finding
constructor
A new instance of Finding.
- #triaged? ⇒ Boolean
Constructor Details
#initialize(verdict: nil, confidence: nil, rationale: nil) ⇒ Finding
Returns a new instance of Finding.
18 |
# File 'lib/sharekit/cli/finding.rb', line 18 def initialize(verdict: nil, confidence: nil, rationale: nil, **) = super |
Instance Attribute Details
#confidence ⇒ Object (readonly)
Returns the value of attribute confidence
14 15 16 |
# File 'lib/sharekit/cli/finding.rb', line 14 def confidence @confidence end |
#file ⇒ Object (readonly)
Returns the value of attribute file
14 15 16 |
# File 'lib/sharekit/cli/finding.rb', line 14 def file @file end |
#line ⇒ Object (readonly)
Returns the value of attribute line
14 15 16 |
# File 'lib/sharekit/cli/finding.rb', line 14 def line @line end |
#preview ⇒ Object (readonly)
Returns the value of attribute preview
14 15 16 |
# File 'lib/sharekit/cli/finding.rb', line 14 def preview @preview end |
#rationale ⇒ Object (readonly)
Returns the value of attribute rationale
14 15 16 |
# File 'lib/sharekit/cli/finding.rb', line 14 def rationale @rationale end |
#rule ⇒ Object (readonly)
Returns the value of attribute rule
14 15 16 |
# File 'lib/sharekit/cli/finding.rb', line 14 def rule @rule end |
#severity ⇒ Object (readonly)
Returns the value of attribute severity
14 15 16 |
# File 'lib/sharekit/cli/finding.rb', line 14 def severity @severity end |
#verdict ⇒ Object (readonly)
Returns the value of attribute verdict
14 15 16 |
# File 'lib/sharekit/cli/finding.rb', line 14 def verdict @verdict end |
Instance Method Details
#<=>(other) ⇒ Object
20 21 22 |
# File 'lib/sharekit/cli/finding.rb', line 20 def <=>(other) SEVERITY_RANK.fetch(severity) <=> SEVERITY_RANK.fetch(other.severity) end |
#high? ⇒ Boolean
24 |
# File 'lib/sharekit/cli/finding.rb', line 24 def high? = severity == :high |
#triaged? ⇒ Boolean
25 |
# File 'lib/sharekit/cli/finding.rb', line 25 def triaged? = !verdict.nil? |