lint: Check *.pyi stubs.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2021-07-09 17:20:40 -07:00
committed by Tim Abbott
parent a3603a865e
commit 9fec1fb16d

View File

@@ -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: