@@ -21,7 +21,7 @@ PYTHON = python3
2121
2222# .PHONY defines parts of the makefile that are not dependant on any specific file
2323# This is most often used to store functions
24- .PHONY = help setup format lint test debug clean
24+ .PHONY = all help setup format lint format-n-lint test-n-cover pre-commit
2525
2626# Defining an array variable
2727FILES = input output
3737 @echo " $( BOLD_CYAN) make setup$( RESET_STYLES) : Setup pyflask-service"
3838 @echo " $( BOLD_CYAN) make format$( RESET_STYLES) : Format and fix python code in pyflask-service"
3939 @echo " $( BOLD_CYAN) make lint$( RESET_STYLES) : Lint pyflask-service"
40- @echo " $( BOLD_CYAN) make test$( RESET_STYLES) : Test pyflask-service"
40+ @echo " $( BOLD_CYAN) make format-n-lint$( RESET_STYLES) : Format and lint python code in pyflask-service"
41+ @echo " $( BOLD_CYAN) make test-n-cover$( RESET_STYLES) : Test and code coverage pyflask-service"
42+ @echo " $( BOLD_CYAN) make pre-commit$( RESET_STYLES) : Run pre-commit checks for pyflask-service"
4143 @echo " $( BOLD_CYAN) make debug$( RESET_STYLES) : Debug pyflask-service"
4244 @echo " $( BOLD_CYAN) make clean$( RESET_STYLES) : Clean pyflask-service"
4345 @echo " $( BOLD_CYAN) make dev-run$( RESET_STYLES) : Run pyflask-service in environment=development"
@@ -73,6 +75,9 @@ format: #: Format and fix python code with black, isort, autoflake
7375 @echo " \n$( BOLD_CYAN) Flaking$( RESET_STYLES) ❄️"
7476 flake8 --version
7577 autoflake --remove-all-unused-imports --remove-unused-variables --remove-duplicate-keys --ignore-init-module-imports -i -r $(APP_DIR ) $(TEST_DIR ) $(HOME_DIR_PY_FILES )
78+ @echo " \n$( BOLD_CYAN) Running pre-commit hooks$( RESET_STYLES) 🏁️️️"
79+ pre-commit run --all-files
80+ @echo " \n$( BOLD_CYAN) All checks passed$( RESET_STYLES) 🏳️️️️"
7681 @echo " \n"
7782
7883
@@ -88,9 +93,25 @@ lint: #: Run static analysis with flake8, radon, mypy and bandit
8893 mypy $(APP_DIR ) $(HOME_DIR_PY_FILES )
8994 @echo " \n$( BOLD_CYAN) Securing with bandit$( RESET_STYLES) 🕵️️"
9095 bandit --version
91- bandit -l -i -r . --format=custom
92- @echo " \n$( BOLD_CYAN) Running pre-commit hooks$( RESET_STYLES) 🏁️️️"
93- pre-commit run --all-files
94- @echo " \n$( BOLD_CYAN) All checks passed$( RESET_STYLES) 🏳️️️️"
96+ bandit -l -i -r . --format=custom -c .bandit.yml -x ./$(TEST_DIR )
97+ @echo " \n"
98+
99+
100+ format-n-lint : # : Format and lint
101+ make format
102+ make lint
95103 @echo " \n"
96104
105+
106+ test-n-cover : # : Test with pytest, Code coverage with pytest-cov plugin
107+ @echo " \n$( BOLD_CYAN) Testing with pytest$( RESET_STYLES) 📊️"
108+ pytest --version
109+ pytest
110+ @echo " \n"
111+
112+
113+ pre-commit : # : Run pre-commit checks : format, lint, test, cover
114+ make format-n-lint
115+ make test-n-cover
116+ @echo " \n$( BOLD_CYAN) Pre commit jobs completed$( RESET_STYLES) 👍"
117+ @echo " \n"
0 commit comments