-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlint.py
More file actions
57 lines (45 loc) · 1.01 KB
/
lint.py
File metadata and controls
57 lines (45 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import subprocess
import sys
def run(cmd: list[str], message: str) -> None:
print(f"\n{message}...")
subprocess.run(cmd, check=True)
def run_lint() -> None:
run(
["ruff", "format", "python/", "tests/", "examples/"],
"Running ruff format",
)
run(
["ruff", "check", "--fix", "python/", "tests/", "examples/"],
"Running ruff check",
)
run(
["mypy", "python/ordr"],
"Running mypy",
)
run(
["cargo", "fmt", "--all"],
"Running cargo fmt",
)
run(
[
"cargo",
"clippy",
"--all-targets",
"--all-features",
"--",
"-D",
"warnings",
],
"Running cargo clippy",
)
run(
["pytest", "tests/"],
"Running pytest",
)
print("\nAll checks passed.")
if __name__ == "__main__":
try:
run_lint()
except subprocess.CalledProcessError:
print("\nChecks failed.")
sys.exit(1)