class CC::Analyzer::Issue
Constants
- DEFAULT_SEVERITY
- DEPRECATED_SEVERITY
- SPEC_ISSUE_ATTRIBUTES
Attributes
engine_name[R]
output[R]
Public Class Methods
new(engine_name, output)
click to toggle source
# File lib/cc/analyzer/issue.rb, line 19 def initialize(engine_name, output) @engine_name = engine_name @output = output end
Public Instance Methods
as_json(*)
click to toggle source
# 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
fingerprint()
click to toggle source
# File lib/cc/analyzer/issue.rb, line 31 def fingerprint parsed_output.fetch("fingerprint") { default_fingerprint } end
path()
click to toggle source
# File lib/cc/analyzer/issue.rb, line 42 def path parsed_output.fetch("location", {}).fetch("path", "") end
Private Instance Methods
default_fingerprint()
click to toggle source
# File lib/cc/analyzer/issue.rb, line 50 def default_fingerprint SourceFingerprint.new(self).compute end
parsed_output()
click to toggle source
# File lib/cc/analyzer/issue.rb, line 64 def parsed_output @parsed_output ||= JSON.parse(output) end
severity()
click to toggle source
# File lib/cc/analyzer/issue.rb, line 54 def severity severity = parsed_output.fetch("severity", DEFAULT_SEVERITY) if severity == DEPRECATED_SEVERITY DEFAULT_SEVERITY else severity end end