Class: CC::Analyzer::Issue

Inherits:
Object
  • Object
show all
Defined in:
lib/cc/analyzer/issue.rb

Constant Summary collapse

DEFAULT_SEVERITY =
IssueValidations::SeverityValidation::MINOR
DEPRECATED_SEVERITY =
IssueValidations::SeverityValidation::NORMAL
SPEC_ISSUE_ATTRIBUTES =
%w[
  categories
  check_name
  content
  description
  location
  other_locations
  remediation_points
  severity
  type
]

Instance Method Summary collapse

Constructor Details

#initialize(engine_name, output) ⇒ Issue

Returns a new instance of Issue.



19
20
21
22
# File 'lib/cc/analyzer/issue.rb', line 19

def initialize(engine_name, output)
  @engine_name = engine_name
  @output = output
end

Instance Method Details

#as_jsonObject



24
25
26
27
28
29
# File 'lib/cc/analyzer/issue.rb', line 24

def as_json(*)
  parsed_output.reverse_merge!(
    "engine_name" => engine_name,
    "fingerprint" => fingerprint,
  ).merge!("severity" => severity)
end

#fingerprintObject



31
32
33
# File 'lib/cc/analyzer/issue.rb', line 31

def fingerprint
  parsed_output.fetch("fingerprint") { default_fingerprint }
end

#pathObject



42
43
44
# File 'lib/cc/analyzer/issue.rb', line 42

def path
  parsed_output.fetch("location", {}).fetch("path", "")
end