From aa54693c9ec03368c6e592efff4dd4757dd72a47 Mon Sep 17 00:00:00 2001 From: Anthony Sottile Date: Mon, 11 Oct 2021 05:28:05 -0700 Subject: [PATCH] fix parallel execution collecting a SyntaxError --- src/flake8/checker.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/flake8/checker.py b/src/flake8/checker.py index 85074954..14c122b4 100644 --- a/src/flake8/checker.py +++ b/src/flake8/checker.py @@ -20,6 +20,8 @@ except ImportError: multiprocessing = None # type: ignore +Results = List[Tuple[str, int, int, str, Optional[str]]] + LOG = logging.getLogger(__name__) SERIAL_RETRY_ERRNOS = { @@ -346,7 +348,7 @@ def __init__(self, filename, checks, options): self.options = options self.filename = filename self.checks = checks - self.results: List[Tuple[str, int, int, str, Optional[str]]] = [] + self.results: Results = [] self.statistics = { "tokens": 0, "logical lines": 0, @@ -588,7 +590,7 @@ def process_tokens(self): self.run_physical_checks(file_processor.lines[-1]) self.run_logical_checks() - def run_checks(self): + def run_checks(self) -> Tuple[str, Results, Dict[str, int]]: """Run checks against the file.""" assert self.processor is not None try: @@ -598,7 +600,7 @@ def run_checks(self): code = "E902" if isinstance(e, tokenize.TokenError) else "E999" row, column = self._extract_syntax_information(e) self.report(code, row, column, f"{type(e).__name__}: {e.args[0]}") - return + return self.filename, self.results, self.statistics logical_lines = self.processor.statistics["logical lines"] self.statistics["logical lines"] = logical_lines