File size: 1,154 Bytes
3f61e65
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
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()