Class: PreCommit::Message::Extractor

Inherits:
Object
  • Object
show all
Defined in:
lib/plugins/pre-commit/message/extractor.rb

Overview

Responsible for extract error messages from terminal output

Instance Method Summary collapse

Instance Method Details

#extract(output) ⇒ Hash

Extract data from a XML formatted output

Parameters:

  • output (String)

    Xml formatted ouput

Returns:

  • (Hash)


15
16
17
18
19
20
21
22
# File 'lib/plugins/pre-commit/message/extractor.rb', line 15

def extract(output)
  return Domain::Checkstyle.good if output.nil? || output.empty?
  xml_data = Crack::XML.parse(xml_content(output))

  files = xml_data['checkstyle']['file']

  Domain::Checkstyle.new(extract_bad_file(files))
end