forked from vectorleap-pulse/grammar-ai
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlint.py
More file actions
33 lines (26 loc) · 1.02 KB
/
Copy pathlint.py
File metadata and controls
33 lines (26 loc) · 1.02 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
#!/usr/bin/env python3
"""Linter script that runs ruff and mypy checks."""
import subprocess
import sys
def run_linter():
"""Run ruff check and mypy on the project."""
try:
print("Running ruff format...")
subprocess.run([sys.executable, "-m", "ruff", "format", "."], check=True)
print("Ruff format passed.")
print("Running ruff check...")
subprocess.run([sys.executable, "-m", "ruff", "check", "--fix", "."], check=True)
print("Ruff check passed.")
except subprocess.CalledProcessError as e:
print(f"Ruff check failed with exit code {e.returncode}")
sys.exit(1)
try:
print("Running mypy...")
subprocess.run([sys.executable, "-m", "mypy", "."], check=True)
print("Mypy check passed.")
except subprocess.CalledProcessError as e:
print(f"Mypy check failed with exit code {e.returncode}")
sys.exit(1)
print("All linter checks passed!")
if __name__ == "__main__":
run_linter()