Skip to content

Commit 66e303f

Browse files
committed
Run all linters even if one fails
Often it is useful to run mypy even if there are formatting errors.
1 parent 38e5013 commit 66e303f

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

tools/run_py_linters.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
from argparse import ArgumentParser
2323
from os import environ
2424
from pathlib import Path
25-
from subprocess import run
25+
from subprocess import SubprocessError, run
2626
from typing import List
2727

2828
source_root = Path(environ['MESON_SOURCE_ROOT'])
@@ -61,7 +61,7 @@ def run_mypy() -> None:
6161
)
6262

6363

64-
def linter_main() -> None:
64+
def run_flake8() -> None:
6565
run(
6666
args=(
6767
'flake8',
@@ -70,7 +70,22 @@ def linter_main() -> None:
7070
check=True,
7171
)
7272

73-
run_mypy()
73+
74+
def linter_main() -> None:
75+
is_success = True
76+
77+
try:
78+
run_flake8()
79+
except SubprocessError:
80+
is_success = False
81+
82+
try:
83+
run_mypy()
84+
except SubprocessError:
85+
is_success = False
86+
87+
if not is_success:
88+
raise SystemExit(1)
7489

7590

7691
def get_all_python_files() -> List[Path]:

0 commit comments

Comments
 (0)