Sha256: 4681d2a383c219533da6cb0c33609d81fb4085ac4a4c37fab9c1ef5bfeaddcd6
Contents?: true
Size: 1.09 KB
Versions: 5
Compression:
Stored size: 1.09 KB
Contents
module Goodcheck module Reporters class JSON attr_reader :stdout attr_reader :stderr attr_reader :issues def initialize(stdout:, stderr:) @stdout = stdout @stderr = stderr @issues = [] end def analysis stderr.puts "Starting analysis..." yield json = issues.map do |issue| { rule_id: issue.rule.id, path: issue.path, location: { start_line: issue.location.start_line, start_column: issue.location.start_column, end_line: issue.location.end_line, end_column: issue.location.end_column }, message: issue.rule.message, justifications: issue.rule.justifications } end stdout.puts ::JSON.dump(json) end def file(path) stderr.puts "Checking #{path}..." yield end def rule(rule) stderr.puts " Checking #{rule.id}..." yield end def issue(issue) issues << issue end end end end
Version data entries
5 entries across 5 versions & 1 rubygems