| 
1 | 1 | @ECHO OFF  | 
2 | 2 | REM Makefile for project needs  | 
3 | 3 | REM Author: Ben Trachtenberg  | 
4 |  | -REM Version: 1.0.6  | 
 | 4 | +REM Version: 1.0.7  | 
5 | 5 | REM  | 
6 | 6 | 
 
  | 
7 |  | -IF "%1" == "all" (  | 
8 |  | -    pytest --cov --cov-report=html -vvv  | 
 | 7 | +SET option=%1  | 
 | 8 | + | 
 | 9 | +IF "%option%" == "" (  | 
 | 10 | +    GOTO BAD_OPTIONS  | 
 | 11 | +)  | 
 | 12 | + | 
 | 13 | +IF "%option%" == "all" (  | 
9 | 14 |     black {{cookiecutter.__app_name}}/  | 
10 | 15 |     black tests/  | 
11 | 16 |     pylint {{cookiecutter.__app_name}}\  | 
 | 17 | +    pytest --cov --cov-report=html -vvv  | 
 | 18 | +    bandit -c pyproject.toml -r .  | 
12 | 19 |     pip-audit -r requirements.txt  | 
13 | 20 |     GOTO END  | 
14 | 21 | )  | 
15 | 22 | 
 
  | 
16 |  | -IF "%1" == "build" (  | 
 | 23 | +IF "%option%" == "build" (  | 
17 | 24 |     python -m build  | 
18 | 25 |     GOTO END  | 
19 | 26 | )  | 
20 | 27 | 
 
  | 
21 |  | -IF "%1" == "coverage" (  | 
 | 28 | +IF "%option%" == "coverage" (  | 
22 | 29 |     pytest --cov --cov-report=html -vvv  | 
23 | 30 |     GOTO END  | 
24 | 31 | )  | 
25 | 32 | 
 
  | 
26 |  | -IF "%1" == "pylint" (  | 
 | 33 | +IF "%option%" == "pylint" (  | 
27 | 34 |     pylint {{cookiecutter.__app_name}}\  | 
28 | 35 |     GOTO END  | 
29 | 36 | )  | 
30 | 37 | 
 
  | 
31 |  | -IF "%1" == "pytest" (  | 
 | 38 | +IF "%option%" == "pytest" (  | 
32 | 39 |     pytest --cov -vvv  | 
33 | 40 |     GOTO END  | 
34 | 41 | )  | 
35 | 42 | 
 
  | 
36 |  | -IF "%1" == "dev-run" (  | 
 | 43 | +IF "%option%" == "dev-run" (  | 
37 | 44 |     python -c "from {{cookiecutter.__app_name}} import cli;cli()" start -p 8080 -r  | 
38 | 45 |     GOTO END  | 
39 | 46 | )  | 
40 | 47 | 
 
  | 
41 |  | -IF "%1" == "format" (  | 
 | 48 | +IF "%option%" == "format" (  | 
42 | 49 |     black {{cookiecutter.__app_name}}/  | 
43 | 50 |     black tests/  | 
44 | 51 |     GOTO END  | 
45 | 52 | )  | 
46 | 53 | 
 
  | 
47 |  | -IF "%1" == "check-vuln" (  | 
 | 54 | +IF "%option%" == "check-vuln" (  | 
48 | 55 |     pip-audit -r requirements.txt  | 
49 | 56 |     GOTO END  | 
50 | 57 | )  | 
51 | 58 | 
 
  | 
 | 59 | +IF "%option%" == "check-security" (  | 
 | 60 | +    bandit -c pyproject.toml -r .  | 
 | 61 | +    GOTO END  | 
 | 62 | +)  | 
 | 63 | + | 
52 | 64 | {% if cookiecutter.app_documents_location == 'github-pages' %}  | 
53 |  | -IF "%1" == "gh-pages" (  | 
 | 65 | +IF "%option%" == "gh-pages" (  | 
54 | 66 |     rmdir /s /q docs\source\code  | 
55 | 67 |     sphinx-apidoc -o ./docs/source/code ./{{cookiecutter.__app_name}}  | 
56 | 68 |     sphinx-build ./docs ./docs/gh-pages  | 
57 | 69 |     GOTO END  | 
58 | 70 | )  | 
59 | 71 | {% endif %}  | 
60 | 72 | 
 
  | 
 | 73 | +:OPTIONS  | 
61 | 74 | @ECHO make options  | 
62 |  | -@ECHO     all                 To run coverage, format, pylint, and check-vuln  | 
63 |  | -@ECHO     build               To build a distribution  | 
64 |  | -@ECHO     check-vuln          To check for vulnerabilities  | 
65 |  | -@ECHO     coverage            To run coverage and display ASCII and output to htmlcov  | 
66 |  | -@ECHO     dev-run             To run the app  | 
67 |  | -@ECHO     format              To format the code with black  | 
68 |  | -@ECHO     pylint              To run pylint  | 
69 |  | -@ECHO     pytest              To run pytest with verbose option  | 
 | 75 | +@ECHO     all             To run coverage, format, pylint, and check-vuln  | 
 | 76 | +@ECHO     build           To build a distribution  | 
 | 77 | +@ECHO     coverage        To run coverage and display ASCII and output to htmlcov  | 
 | 78 | +@ECHO     dev-run         To run the app  | 
 | 79 | +@ECHO     check-vuln      To check for vulnerabilities in the dependencies  | 
 | 80 | +@ECHO     check-security  To check for vulnerabilities in the code  | 
 | 81 | +@ECHO     format          To format the code with black  | 
 | 82 | +@ECHO     pylint          To run pylint  | 
 | 83 | +@ECHO     pytest          To run pytest with verbose option  | 
70 | 84 | {% if cookiecutter.app_documents_location == 'github-pages' %}@ECHO     gh-pages  To create the GitHub pages{% endif %}  | 
 | 85 | +GOTO END  | 
 | 86 | + | 
 | 87 | +:BAD_OPTIONS  | 
 | 88 | +@ECHO Argument is missing  | 
 | 89 | +@ECHO Usage: make.bat option  | 
 | 90 | +@ECHO.  | 
 | 91 | +GOTO OPTIONS  | 
71 | 92 | 
 
  | 
72 | 93 | :END  | 
0 commit comments