From 9fec1fb16d98da9e9dbb44a19ea87b562bc82935 Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Fri, 9 Jul 2021 17:20:40 -0700 Subject: [PATCH] lint: Check *.pyi stubs. Signed-off-by: Anders Kaseorg --- tools/lint | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tools/lint b/tools/lint index bc33f568bf..7fc70c83eb 100755 --- a/tools/lint +++ b/tools/lint @@ -51,6 +51,7 @@ def run() -> None: "md", "pp", "py", + "pyi", "rst", "sh", "text", @@ -132,7 +133,7 @@ def run() -> None: linter_config.external_linter( "mypy", command, - ["py"], + ["py", "pyi"], pass_targets=False, description="Static type checker for Python (config: pyproject.toml)", ) @@ -158,7 +159,7 @@ def run() -> None: linter_config.external_linter( "isort", ["isort"], - ["py"], + ["py", "pyi"], description="Sorts Python import statements", check_arg=["--check-only", "--diff"], ) @@ -172,7 +173,7 @@ def run() -> None: linter_config.external_linter( "black", ["black"], - ["py"], + ["py", "pyi"], description="Reformats Python code", check_arg=["--check"], suppress_line=lambda line: line == "All done! ✨ 🍰 ✨\n" @@ -229,8 +230,8 @@ def run() -> None: failed = check_pyflakes(by_lang["py"], args) return 1 if failed else 0 - python_part1 = {x for x in by_lang["py"] if random.randint(0, 1) == 0} - python_part2 = {y for y in by_lang["py"] if y not in python_part1} + python_part1 = {x for x in by_lang["py"] + by_lang["pyi"] if random.randint(0, 1) == 0} + python_part2 = {y for y in by_lang["py"] + by_lang["pyi"] if y not in python_part1} @linter_config.lint def pep8_1of2() -> int: