Skip to content

Commit aa54693

Browse files
committedOct 11, 2021
fix parallel execution collecting a SyntaxError
1 parent d31c535 commit aa54693

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed
 

‎src/flake8/checker.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
except ImportError:
2121
multiprocessing = None # type: ignore
2222

23+
Results = List[Tuple[str, int, int, str, Optional[str]]]
24+
2325
LOG = logging.getLogger(__name__)
2426

2527
SERIAL_RETRY_ERRNOS = {
@@ -346,7 +348,7 @@ def __init__(self, filename, checks, options):
346348
self.options = options
347349
self.filename = filename
348350
self.checks = checks
349-
self.results: List[Tuple[str, int, int, str, Optional[str]]] = []
351+
self.results: Results = []
350352
self.statistics = {
351353
"tokens": 0,
352354
"logical lines": 0,
@@ -588,7 +590,7 @@ def process_tokens(self):
588590
self.run_physical_checks(file_processor.lines[-1])
589591
self.run_logical_checks()
590592

591-
def run_checks(self):
593+
def run_checks(self) -> Tuple[str, Results, Dict[str, int]]:
592594
"""Run checks against the file."""
593595
assert self.processor is not None
594596
try:
@@ -598,7 +600,7 @@ def run_checks(self):
598600
code = "E902" if isinstance(e, tokenize.TokenError) else "E999"
599601
row, column = self._extract_syntax_information(e)
600602
self.report(code, row, column, f"{type(e).__name__}: {e.args[0]}")
601-
return
603+
return self.filename, self.results, self.statistics
602604

603605
logical_lines = self.processor.statistics["logical lines"]
604606
self.statistics["logical lines"] = logical_lines

0 commit comments

Comments
 (0)
Please sign in to comment.