Skip to content
This repository has been archived by the owner on Oct 6, 2023. It is now read-only.

Commit

Permalink
Issue grantmcconnaughey#62 - Add mypy parser
Browse files Browse the repository at this point in the history
  • Loading branch information
bugale committed Jul 11, 2022
1 parent 809380e commit b21f892
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions lintly/parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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') or 1),
column=int(groups.get('column') or 1),
code=(groups.get('code') or '[empty]').strip(),
message=(groups.get('message') or '[empty]').strip()
)

violations[path].append(violation)
Expand Down Expand Up @@ -299,4 +300,7 @@ def parse_violations(self, output):

# cfn-nag JSON output
'cfn-nag': CfnNagParser(),

# Mypy formatter
'mypy': LineRegexParser(r'^(?P<path>.*\.py):(?:(?P<line>\d*):)?(?:(?P<column>\d*):)? [^:]*: (?P<message>.*?)(?:\[(?P<code>\S*)\])?$'),
}

0 comments on commit b21f892

Please sign in to comment.