-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
54 lines (40 loc) · 1.13 KB
/
Makefile
File metadata and controls
54 lines (40 loc) · 1.13 KB
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
NAME=cyberscore_be
IMAGE_NAME=cyberscore_be
ifndef VERSION
VERSION := $(shell python3 -c "import cyberscore_be;print(cyberscore_be.__version__)" || echo 0.0.0)
endif
ifndef BRANCH
BRANCH := $(shell git branch --show-current)
endif
ifndef COMMIT
COMMIT := $(shell git log -n1 --format="%h")
endif
ifndef SRC
SRC := src/cyberscore_be/*.py
endif
ifndef TESTS
TESTS := src/tests
endif
BUILD_RUN=docker run --rm "$(IMAGE_NAME):$(COMMIT)"
# .PHONY: git black lint build test coverage security
.PHONY: black lint build test coverage security
# git:
# @echo "branch: $(BRANCH) commit: $(COMMIT)"
black:
isort $(SRC)
black $(SRC)
autoflake --remove-all-unused-imports --remove-duplicate-keys --expand-star-imports --recursive --in-place $(SRC)
lint:
flake8 --max-line-length=120 --max-complexity 8 $(SRC)
# interrogate $(SRC)
mypy $(SRC)
pylint -d C0301 -d R0902 $(SRC)
build:
docker build -t $(IMAGE_NAME):$(COMMIT) . -f docker/build.Dockerfile
test:
pytest $(TESTS)
coverage:
pytest --cov-report term-missing --cov=cyberscore-be $(TESTS)
security:
safety check
bandit -r $(SRC)