-
Notifications
You must be signed in to change notification settings - Fork 174
/
Makefile
78 lines (57 loc) · 2.12 KB
/
Makefile
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
dirs := $(shell ls | egrep 'policies|rules|global_helpers|models|templates|queries' | xargs)
UNAME := $(shell uname)
TEST_ARGS :=
ifeq ($(UNAME), Darwin)
install_pipenv_cmd = brew install pipenv
endif
install-pipenv:
which pipenv || $(install_pipenv_cmd)
vscode-config: install-pipenv install
@echo "backing up existing vscode configs"
test -f .vscode/settings.json && cp .vscode/settings.json .vscode/settings_bak.json \
|| echo "no existing vscode settings.json file found. continuing"
test -f .vscode/launch.json && cp .vscode/launch.json .vscode/launch_bak.json \
|| echo "no existing vscode launch.json file found. continuing"
@echo "Creating new vscode config files"
cp .vscode/example_launch.json .vscode/launch.json
sed -e 's#XXX_pipenv_py_output_XXX#$(shell pipenv --py)#' .vscode/example_settings.json > .vscode/settings.json
which code && code .
ci:
pipenv run $(MAKE) lint test
deps:
pipenv sync --dev
deps-update:
pipenv update
global-helpers-unit-test:
pipenv run python -m unittest global_helpers/*_test.py
lint: lint-pylint lint-fmt
lint-pylint:
pipenv run bandit -r $(dirs)
pipenv run pylint $(dirs)
pipenv run isort --profile=black --check-only $(dirs)
lint-fmt:
@echo Checking python file formatting with the black code style checker
pipenv run black --line-length=100 --check $(dirs)
lint-mitre:
pipenv run python3 ./.scripts/mitre_mapping_check.py
venv:
pipenv sync --dev
pat-update:
pipenv update panther-analysis-tool
fmt:
pipenv run isort --profile=black $(dirs)
pipenv run black --line-length=100 $(dirs)
install:
pipenv sync --dev
test: global-helpers-unit-test
pipenv run panther_analysis_tool test $(TEST_ARGS)
check-deprecated:
pipenv run python3 ./.scripts/deleted_rules.py check
remove-deprecated:
pipenv run python3 ./.scripts/deleted_rules.py remove
docker-build:
docker build -t panther-analysis:latest .
docker-test:
docker run --mount "type=bind,source=${CURDIR},target=/home/panther-analysis" panther-analysis:latest make test TEST_ARGS="$(TEST_ARGS)"
docker-lint:
docker run --mount "type=bind,source=${CURDIR},target=/home/panther-analysis" panther-analysis:latest make lint