1#!/usr/bin/env python2
 2
 3import re
 4import sys
 5
 6from lxml import etree
 7
 8matcher = re.compile(r'^(.+):(\d+): (.*)$')
 9
10last_filename = None
11
12root_elem = etree.Element('lint')
13filename_elem = None
14
15for line in sys.stdin:
16    if len(line.strip()) == 0:
17        continue
18
19    match = matcher.match(line)
20
21    filename, line, message = match.groups()
22
23    if filename != last_filename:
24        filename_elem = etree.SubElement(root_elem, 'file', name=filename)
25
26    etree.SubElement(filename_elem, 'issue', line=line, char='1', severity='warning', reason=message, evidence='xxx')
27
28print(etree.tostring(root_elem))