forked from jolly-good-toolbelt/jiratools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
self_check.py
executable file
·57 lines (42 loc) · 1.58 KB
/
self_check.py
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
#!/usr/bin/env python
"""
Script to make sure the repo is good enough for running tests, meets SDLC, etc.
Basically, antyhing you want to put here that will be part of your automated
PR checking and whatever santiy checking you want for the CICD server to be confident
that it can start a test run without any missing packages, syntax errors, etc.
We're leaning in to using 'pre-commit' but this script can still be used
to run or check things that aren't a good fit for 'pre-commit'.
Runs the following commands:
{}
"""
import argparse
from show_env import execute_command_list
SETUP_COMMAND = ["python", "./env_setup.py"]
# Fill in with your own project details!!!
commands_to_run = [["poetry", "run", "pre-commit", "run", "-a"]]
__doc__ = __doc__.format("\n".join(map(" ".join, commands_to_run)))
def self_check(do_setup=False, verbose=True):
"""Run code checks."""
if do_setup:
commands_to_run.insert(0, SETUP_COMMAND)
execute_command_list(commands_to_run, verbose=verbose)
def main():
"""Self check with cli args."""
parser = argparse.ArgumentParser(
formatter_class=argparse.RawDescriptionHelpFormatter, description=__doc__
)
parser.add_argument(
"--setup",
action="store_true",
help='run "./env_setup.py" before running self checks',
)
parser.add_argument(
"-q",
"--quiet",
action="store_true",
help="do not show each command before it is executed",
)
args = parser.parse_args()
self_check(do_setup=args.setup, verbose=not args.quiet)
if __name__ == "__main__":
main()