mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-12 07:44:16 +00:00
Merge pull request #1410 from PyCQA/parallel-syntax-error
fix parallel execution collecting a SyntaxError
This commit is contained in:
commit
0fac346d84
1 changed files with 5 additions and 3 deletions
|
|
@ -20,6 +20,8 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
multiprocessing = None # type: ignore
|
multiprocessing = None # type: ignore
|
||||||
|
|
||||||
|
Results = List[Tuple[str, int, int, str, Optional[str]]]
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
SERIAL_RETRY_ERRNOS = {
|
SERIAL_RETRY_ERRNOS = {
|
||||||
|
|
@ -346,7 +348,7 @@ class FileChecker:
|
||||||
self.options = options
|
self.options = options
|
||||||
self.filename = filename
|
self.filename = filename
|
||||||
self.checks = checks
|
self.checks = checks
|
||||||
self.results: List[Tuple[str, int, int, str, Optional[str]]] = []
|
self.results: Results = []
|
||||||
self.statistics = {
|
self.statistics = {
|
||||||
"tokens": 0,
|
"tokens": 0,
|
||||||
"logical lines": 0,
|
"logical lines": 0,
|
||||||
|
|
@ -588,7 +590,7 @@ class FileChecker:
|
||||||
self.run_physical_checks(file_processor.lines[-1])
|
self.run_physical_checks(file_processor.lines[-1])
|
||||||
self.run_logical_checks()
|
self.run_logical_checks()
|
||||||
|
|
||||||
def run_checks(self):
|
def run_checks(self) -> Tuple[str, Results, Dict[str, int]]:
|
||||||
"""Run checks against the file."""
|
"""Run checks against the file."""
|
||||||
assert self.processor is not None
|
assert self.processor is not None
|
||||||
try:
|
try:
|
||||||
|
|
@ -598,7 +600,7 @@ class FileChecker:
|
||||||
code = "E902" if isinstance(e, tokenize.TokenError) else "E999"
|
code = "E902" if isinstance(e, tokenize.TokenError) else "E999"
|
||||||
row, column = self._extract_syntax_information(e)
|
row, column = self._extract_syntax_information(e)
|
||||||
self.report(code, row, column, f"{type(e).__name__}: {e.args[0]}")
|
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"]
|
logical_lines = self.processor.statistics["logical lines"]
|
||||||
self.statistics["logical lines"] = logical_lines
|
self.statistics["logical lines"] = logical_lines
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue