Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

lint: Check *.pyi stubs.

Anders Kaseorg9fec1fb16d98
diff --git a/tools/lint b/tools/lint
index bc33f568bf2..7fc70c83eba 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: