synthex / run_linters.py
theaniketgiri's picture
backend
3f61e65
import subprocess
import sys
import os
import platform
def run_black():
print("\nRunning Black...")
try:
subprocess.run(
["black", "app/", "tests/"],
check=True
)
print("Black completed successfully!")
except subprocess.CalledProcessError:
print("Black found issues!")
sys.exit(1)
def run_flake8():
print("\nRunning Flake8...")
try:
subprocess.run(
["flake8", "app/", "tests/"],
check=True
)
print("Flake8 completed successfully!")
except subprocess.CalledProcessError:
print("Flake8 found issues!")
sys.exit(1)
def run_mypy():
print("\nRunning MyPy...")
try:
subprocess.run(
["mypy", "app/", "tests/"],
check=True
)
print("MyPy completed successfully!")
except subprocess.CalledProcessError:
print("MyPy found issues!")
sys.exit(1)
def main():
print("Running linters...")
run_black()
run_flake8()
run_mypy()
print("\nAll linters passed successfully!")
if __name__ == "__main__":
main()