def process(self, fp): try: root = etree.fromstring(fp.read()) except Exception: current_app.logger.exception('Failed to parse XML') return [] job = self.job # <file name="/var/lib/jenkins/workspace/Releases/ESLint Release/eslint/fullOfProblems.js"> # <error line="1" column="10" severity="error" message="'addOne' is defined but never used. (no-unused-vars)" source="eslint.rules.no-unused-vars" /> for f_node in root.iter('file'): # name filename = f_node.get('name') for e_node in f_node.iter('error'): # line, column, severity, message, source db.session.add(StyleViolation( job=job, repository_id=job.repository_id, filename=filename, severity=Severity[e_node.get('severity')], message=e_node.get('message'), source=e_node.get('source'), lineno=e_node.get('line'), colno=e_node.get('column'), )) db.session.flush()
def process(self, fp): job = self.job for line in fp: # optparse.py:69:11: E401 multiple imports on one line parsed = regexp.match(line.decode('utf-8')) if not parsed: continue severity = SEVERITY_MAP.get( parsed.group('source')[0], Severity.info) db.session.add( StyleViolation( job=job, repository_id=job.repository_id, filename=parsed.group('filename'), severity=severity, message=parsed.group('message'), source=parsed.group('source'), lineno=parsed.group('lineno'), colno=parsed.group('colno'), )) db.session.flush()
def process(self, fp): job = self.job for line in fp: # zeus/auth.py:20: [C0326(bad - whitespace), ] Exactly one space required around keyword argument assignment # def __init__(self, repository_ids: Optional[str]=None): parsed = regexp.match(line.decode('utf-8')) if not parsed: continue severity = SEVERITY_MAP.get( parsed.group('source')[0], Severity.info) db.session.add( StyleViolation( job=job, repository_id=job.repository_id, filename=parsed.group('filename'), severity=severity, message=parsed.group('message'), source=parsed.group('source'), lineno=parsed.group('lineno'), # colno=parsed.group('colno'), )) db.session.flush()