mirror of https://github.com/zulip/zulip.git
lint: Check *.pyi stubs.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
a3603a865e
commit
9fec1fb16d
11
tools/lint
11
tools/lint
|
@ -51,6 +51,7 @@ def run() -> None:
|
||||||
"md",
|
"md",
|
||||||
"pp",
|
"pp",
|
||||||
"py",
|
"py",
|
||||||
|
"pyi",
|
||||||
"rst",
|
"rst",
|
||||||
"sh",
|
"sh",
|
||||||
"text",
|
"text",
|
||||||
|
@ -132,7 +133,7 @@ def run() -> None:
|
||||||
linter_config.external_linter(
|
linter_config.external_linter(
|
||||||
"mypy",
|
"mypy",
|
||||||
command,
|
command,
|
||||||
["py"],
|
["py", "pyi"],
|
||||||
pass_targets=False,
|
pass_targets=False,
|
||||||
description="Static type checker for Python (config: pyproject.toml)",
|
description="Static type checker for Python (config: pyproject.toml)",
|
||||||
)
|
)
|
||||||
|
@ -158,7 +159,7 @@ def run() -> None:
|
||||||
linter_config.external_linter(
|
linter_config.external_linter(
|
||||||
"isort",
|
"isort",
|
||||||
["isort"],
|
["isort"],
|
||||||
["py"],
|
["py", "pyi"],
|
||||||
description="Sorts Python import statements",
|
description="Sorts Python import statements",
|
||||||
check_arg=["--check-only", "--diff"],
|
check_arg=["--check-only", "--diff"],
|
||||||
)
|
)
|
||||||
|
@ -172,7 +173,7 @@ def run() -> None:
|
||||||
linter_config.external_linter(
|
linter_config.external_linter(
|
||||||
"black",
|
"black",
|
||||||
["black"],
|
["black"],
|
||||||
["py"],
|
["py", "pyi"],
|
||||||
description="Reformats Python code",
|
description="Reformats Python code",
|
||||||
check_arg=["--check"],
|
check_arg=["--check"],
|
||||||
suppress_line=lambda line: line == "All done! ✨ 🍰 ✨\n"
|
suppress_line=lambda line: line == "All done! ✨ 🍰 ✨\n"
|
||||||
|
@ -229,8 +230,8 @@ def run() -> None:
|
||||||
failed = check_pyflakes(by_lang["py"], args)
|
failed = check_pyflakes(by_lang["py"], args)
|
||||||
return 1 if failed else 0
|
return 1 if failed else 0
|
||||||
|
|
||||||
python_part1 = {x for x in by_lang["py"] if random.randint(0, 1) == 0}
|
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"] if y not in python_part1}
|
python_part2 = {y for y in by_lang["py"] + by_lang["pyi"] if y not in python_part1}
|
||||||
|
|
||||||
@linter_config.lint
|
@linter_config.lint
|
||||||
def pep8_1of2() -> int:
|
def pep8_1of2() -> int:
|
||||||
|
|
Loading…
Reference in New Issue