Sha256: d31912dca1e5d0f50b9ad1c03be244ff1259bdbba18f973b57c454fb6f1fe18a
Contents?: true
Size: 982 Bytes
Versions: 1
Compression:
Stored size: 982 Bytes
Contents
require 'json' module Pronto module Swiftlint class OutputParser def parse(output) begin violations = JSON.parse(output) rescue => e puts "pronto-swiftlint ERROR: failed to parse output. Is formatter set to json? #{e}" return [] end result = {} violations.each do |violation| file = violation['file'] result[file] ||= [] result[file] << { file: violation['file'], line: violation['line'], column: violation['character'], level: parse_severity(violation['severity']), message: violation['reason'], rule: violation['rule_id'] } end result end private def parse_severity(severity) if severity == 'Warning' :warning elsif severity == 'Error' :error else :info end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pronto-swiftlint-0.1.0 | lib/pronto/swiftlint/output_parser.rb |