class Pronto::AndroidLint::Parsing
Constants
- TYPE_WARNINGS
Attributes
path[R]
Public Class Methods
new(path)
click to toggle source
# File lib/pronto/ProntoAndroidLint/Parsing.rb, line 15 def initialize(path) @path = path end
Public Instance Methods
parse()
click to toggle source
# File lib/pronto/ProntoAndroidLint/Parsing.rb, line 19 def parse lint_result = File.open(@path) { |f| Nokogiri::XML(f) } lint_result.xpath("//issue").flat_map do |issue| issue.xpath(".//location").map do |location| { path: location.attribute("file").try(:value), line: location.attribute("line").try(:value).to_i, level: TYPE_WARNINGS[issue.attribute("severity").value], message: create_message(issue) } end end rescue => e raise "Error while parsing file: #{@path}\n#{e.message}" end
Private Instance Methods
create_message(issue)
click to toggle source
# File lib/pronto/ProntoAndroidLint/Parsing.rb, line 36 def create_message(issue) "#{issue.attribute("summary").try(:value)}\n\n#{issue.attribute("message").try(:value)} #{issue.attribute("explanation").try(:value)}" end