Skip to content

Commit f7a523f

Browse files
authored
Fix an issue when re.match returns None (#814)
1 parent 6a7eae7 commit f7a523f

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

pyls/plugins/flake8_lint.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,16 @@ def parse_stdout(document, stdout):
118118
diagnostics = []
119119
lines = stdout.splitlines()
120120
for raw_line in lines:
121-
parsed_line = re.match(r'(.*):(\d*):(\d*): (\w*) (.*)', raw_line).groups()
122-
if not parsed_line or len(parsed_line) != 5:
121+
parsed_line = re.match(r'(.*):(\d*):(\d*): (\w*) (.*)', raw_line)
122+
if not parsed_line:
123123
log.debug("Flake8 output parser can't parse line '%s'", raw_line)
124124
continue
125+
126+
parsed_line = parsed_line.groups()
127+
if len(parsed_line) != 5:
128+
log.debug("Flake8 output parser can't parse line '%s'", raw_line)
129+
continue
130+
125131
_, line, character, code, msg = parsed_line
126132
line = int(line) - 1
127133
character = int(character) - 1

0 commit comments

Comments
 (0)