diff --git a/lintly/parsers.py b/lintly/parsers.py index d0277d1..791829b 100644 --- a/lintly/parsers.py +++ b/lintly/parsers.py @@ -61,11 +61,12 @@ def parse_violations(self, output): path = self._normalize_path(match.group('path')) + groups = match.groupdict() violation = Violation( - line=int(match.group('line')), - column=int(match.group('column')), - code=match.group('code'), - message=match.group('message') + line=int(groups.get('line', 1)), + column=int(groups.get('column', 1)), + code=groups.get('code', 'warning').strip(), + message=groups.get('message', '').strip() ) violations[path].append(violation) @@ -299,4 +300,7 @@ def parse_violations(self, output): # cfn-nag JSON output 'cfn-nag': CfnNagParser(), + + # Mypy formatter + 'mypy': LineRegexParser(r'^(?P.*\.py):(?:(?P\d*):)?(?:(?P\d*):)? [^:]*: (?P.*)(?:\[(?P\S*)\])?$'), }