Skip to content

Commit

Permalink
Fix an issue when re.match returns None (#814)
Browse files Browse the repository at this point in the history
  • Loading branch information
mpanarin authored May 25, 2020
1 parent 6a7eae7 commit f7a523f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions pyls/plugins/flake8_lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,16 @@ def parse_stdout(document, stdout):
diagnostics = []
lines = stdout.splitlines()
for raw_line in lines:
parsed_line = re.match(r'(.*):(\d*):(\d*): (\w*) (.*)', raw_line).groups()
if not parsed_line or len(parsed_line) != 5:
parsed_line = re.match(r'(.*):(\d*):(\d*): (\w*) (.*)', raw_line)
if not parsed_line:
log.debug("Flake8 output parser can't parse line '%s'", raw_line)
continue

parsed_line = parsed_line.groups()
if len(parsed_line) != 5:
log.debug("Flake8 output parser can't parse line '%s'", raw_line)
continue

_, line, character, code, msg = parsed_line
line = int(line) - 1
character = int(character) - 1
Expand Down

0 comments on commit f7a523f

Please sign in to comment.