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 4f49ee1 commit 192a716
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 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,8 @@ 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*):)? [^:]*: '
r'(?P<message>.*?)(?:\[(?P<code>\S*)\])?$'),
}

0 comments on commit 192a716

Please sign in to comment.