|
| 1 | +MODULE := modsecurity_parser |
| 2 | +BLUE='\033[0;34m' |
| 3 | +RED='\033[0;31m' |
| 4 | +GREEN='\033[0;32m' |
| 5 | +YELLOW='\033[0;33m' |
| 6 | +BYELLOW='\033[1;33m' |
| 7 | +UYELLOW='\033[4;33m' |
| 8 | +OYELLOW='\033[43m' |
| 9 | +NC='\033[0m' # No color |
| 10 | + |
| 11 | +run: |
| 12 | + @python -m $(MODULE) |
| 13 | + |
| 14 | +integration-v2: |
| 15 | + @python -m ${MODULE} -f sample_audit_log/modsec_audit_v2.log -j out-v2.json -x out-v2.xlsx -g out-v2.png |
| 16 | + |
| 17 | +integration-v3: |
| 18 | + @python -m ${MODULE} -f sample_audit_log/modsec_audit_v3.log -j out-v3.json -x out-v3.xlsx -g out-v3.png --version3 |
| 19 | + |
| 20 | +integration-v2-json: |
| 21 | + @python -m ${MODULE} -f sample_audit_log/modsec_audit_v2_json.log -j out-v2-json.json -x out-v2-json.xlsx -g out-v2-json.png --jsonaudit |
| 22 | + |
| 23 | +integration-v2-timems: |
| 24 | + @python -m ${MODULE} -f sample_audit_log/modsec_audit_v2_timems.log -j out-v2-timems.json -x out-v2-timems.xlsx -g out-v2-timems.png |
| 25 | + |
| 26 | +test-e2e: |
| 27 | + @echo "\n${BLUE}Running E2E tests on sample_audit_log folder ${NC}\n" |
| 28 | + @python -m ${MODULE} -f sample_audit_log/modsec_audit_v2.log -j out-v2.json -x out-v2.xlsx -g out-v2.png |
| 29 | + @python -m ${MODULE} -f sample_audit_log/modsec_audit_v3.log -j out-v3.json -x out-v3.xlsx -g out-v3.png --version3 |
| 30 | + @python -m ${MODULE} -f sample_audit_log/modsec_audit_v2_json.log -j out-v2-json.json -x out-v2-json.xlsx -g out-v2-json.png --jsonaudit |
| 31 | + @python -m ${MODULE} -f sample_audit_log/modsec_audit_v2_utc_minus.log -j out-v2-utc-minus -x out-v2-utc-minus.xlsx -g out-v2-utc-minus.png |
| 32 | + @python -m ${MODULE} -f sample_audit_log/modsec_audit_v2_timems.log -j out-v2-timems.json -x out-v2-timems.xlsx -g out-v2-timems.png |
| 33 | + |
| 34 | +test: |
| 35 | + @echo "\n${OYELLOW}Running Pylint against source and test files...${NC}\n" |
| 36 | + @pytest |
| 37 | + |
| 38 | +lint: |
| 39 | + # test comments |
| 40 | + @echo "\n${BLUE}Running Pylint against source and test files...${NC}\n" |
| 41 | + # @pylint --rcfile=setup.cfg **/*.py *.py |
| 42 | + @pylint --rcfile=setup.cfg *.py |
| 43 | + @echo "\n${BLUE}Running PyDocStyle against source files...${NC}\n" |
| 44 | + @pydocstyle --config=setup.cfg modsecurity_parser.py |
| 45 | + @echo "\n${BLUE}Running Flake8 against source and test files...${NC}\n" |
| 46 | + @flake8 |
| 47 | + @echo "\n${BLUE}Running Bandit against source files...${NC}\n" |
| 48 | + # @bandit -r --ini setup.cfg |
| 49 | + @bandit -r --ini setup.cfg |
| 50 | + @echo "\n${BLUE}Running pycodestyle against source files...${NC}\n" |
| 51 | + @pycodestyle modsecurity_parser.py |
| 52 | + @echo "\n${BLUE}Running Code Coverage against source files...${NC}\n" |
| 53 | + @pytest --cov=modsecurity_parser tests --cov-report=html |
| 54 | + |
| 55 | + |
| 56 | +clean: |
| 57 | + rm -rf .pytest_cache .coverage .pytest_cache coverage.xml sample_audit_log/modsec_output |
| 58 | + |
| 59 | +.PHONY: clean test |
0 commit comments