Method: Goodcheck::Reporters::JSON#analysis

Defined in:
lib/goodcheck/reporters/json.rb

#analysisObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/goodcheck/reporters/json.rb', line 14

def analysis
  yield

  json = issues.map do |issue|
    location = issue.location
    {
      rule_id: issue.rule.id,
      path: issue.path,
      location: location && {
        start_line: location.start_line,
        start_column: location.start_column,
        end_line: location.end_line,
        end_column: location.end_column
      },
      message: issue.rule.message,
      justifications: issue.rule.justifications,
      severity: issue.rule.severity
    }
  end
  stdout.puts ::JSON.dump(json)
  json
end