-
Notifications
You must be signed in to change notification settings - Fork 26
/
Makefile
80 lines (65 loc) · 2.53 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
79
80
packages = panther_analysis_tool
default: help
# via https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
.PHONY: help
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
.PHONY: ci
ci: lint integration
.PHONY: install-pipenv
install-pipenv:
pip install pipenv
.PHONY: deps
deps: ## Install dependencies (including dev dependencies) using pipenv
pipenv install --dev
.PHONY: deps-update
deps-update: ## Update dependencies using pipenv
pipenv update
pipenv lock
pipenv requirements > requirements.txt
.PHONY: reqs
reqs:
pipenv requirements > requirements.txt
.PHONY: lint
lint: ## Lint panther_analysis_tool (mypy, bandit, pylint)
pipenv run mypy $(packages) --disallow-untyped-defs --ignore-missing-imports --warn-unused-ignores
pipenv run bandit -r $(packages)
pipenv run pylint $(packages) --disable=missing-docstring,duplicate-code,W0511,R0912,W4901,too-many-lines,too-few-public-methods --max-line-length=140
.PHONY: venv
venv: ## Install dependencies (including dev dependencies) using pipenv
pipenv install --dev
.PHONY: fmt
fmt: ## Format panther_analysis_tool (black)
pipenv run isort --profile=black .
pipenv run black --line-length=100 .
.PHONY: install
install: ## Install dependencies (including dev dependencies) using pipenv
pipenv install --dev
pipenv requirements > requirements.txt
.PHONY: test
test: ## Run panther_analysis_tool tests
pipenv run nose2 -v --with-coverage --coverage=panther_analysis_tool --coverage-report=html
.PHONY: test-fail-fast
test-fail-fast: ## Run panther_analysis_tool tests, stopping as soon as a test fails
pipenv run nose2 -v --stop
.PHONY: coverage
coverage: ## Open the coverage report generated by the test target
open ./htmlcov/index.html
.PHONY: integration
integration: ## Run panther_analysis_tool integration tests (from included fixtures and panther-analysis repo)
pipenv run panther_analysis_tool test --path tests/fixtures/detections/valid_analysis
rm -rf panther-analysis
git clone https://github.com/panther-labs/panther-analysis.git
cd panther-analysis;\
pipenv lock; \
pipenv requirements | grep -v 'panther-analysis-tool==' > requirements.ci.txt; \
pipenv install -r requirements.ci.txt; \
pipenv install -e ..; \
pip install schema==0.7.5; \
pipenv run panther_analysis_tool --version; \
pipenv run panther_analysis_tool test --path .
rm -rf panther-analysis
.PHONY: pypi
pypi: reqs ## Publish to PyPi
pipenv run python3 setup.py sdist
pipenv run twine upload dist/*