Sha256: e0137d0ce127fa3f347dab91222bf34f0ee6eb2cf8ebc7b5c6e239316eb80bd8
Contents?: true
Size: 1.15 KB
Versions: 3
Compression:
Stored size: 1.15 KB
Contents
module Pronto module Credo class OutputParser attr_reader :output, :file TYPE_WARNINGS = { 'R' => :info, 'W' => :warning, 'C' => :info, 'D' => :info, 'F' => :info, } def initialize(file, output) @file = file @output = output end def parse output.lines.map do |line| next unless line.start_with?(file) line_parts = line.split(':') offence_in_line = line_parts[1] column_line = nil if line_parts[2].to_i == 0 offence_level = TYPE_WARNINGS[line_parts[2].strip] offence_message = line_parts[3..-1].join(':').strip else offence_level = TYPE_WARNINGS[line_parts[3].strip] column_line = line_parts[2].to_i offence_message = line_parts[4..-1].join(':').strip end { line: offence_in_line.to_i, column: column_line, level: offence_level, message: offence_message } end.compact end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
pronto-credo-0.0.3 | lib/pronto/credo/output_parser.rb |
pronto-credo-0.0.2 | lib/pronto/credo/output_parser.rb |
pronto-credo-0.0.1 | lib/pronto/credo/output_parser.rb |