-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
70 lines (57 loc) · 1.79 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
# This file is part of aptscan
# https://github.com/scorphus/aptscan
# Licensed under the BSD-3-Clause license:
# https://opensource.org/licenses/BSD-3-Clause
# Copyright (c) 2024, Pablo S. Blum de Aguiar <scorphus@gmail.com>
# list all available targets
list:
@sh -c "$(MAKE) -p no_targets__ | awk -F':' '/^[a-zA-Z0-9][^\$$#\/\\t=]*:([^=]|$$)/ {split(\$$1,A,/ /);for(i in A)print A[i]}' | grep -v '__\$$' | grep -v 'make\[1\]' | grep -v 'Makefile' | sort"
.PHONY: list
# required for list
no_targets__:
# install dependencies and pre-commit hooks
setup:
@PIP_REQUIRE_VIRTUALENV=true pip install -U -e .\[tests\]
@pre-commit install -f --hook-type pre-commit
@pre-commit install -f --hook-type pre-push
.PHONY: setup
# install dependencies
setup-ci:
@pip install -U -e .\[tests\]
.PHONY: setup-ci
# run isort, black and flake8 for style guide enforcement
isort:
@isort .
.PHONY: isort
black:
@black .
.PHONY: black
pylint:
@pylint aptscan
@pylint --rc-file tests/pylintrc tests
.PHONY: pylint
mypy:
@mypy .
@echo Remember to run “make mypy-strict” for strict type checking
mypy-strict:
@mypy --strict .
lint: isort black pylint mypy
.PHONY: lint
# run tests with coverage
test:
@pytest --cov=aptscan tests
.PHONY: test
# report coverage in html format
coverage: test
@coverage html
.PHONY: coverage
# clean python object, test and coverage files
pyclean:
@find . -type d -iname '__pycache__' -exec rm -rf \{\} + -print
@find . -type d -iname '.benchmarks' -exec rm -rf \{\} + -print
@find . -type d -iname '.mypy_cache' -exec rm -rf \{\} + -print
@find . -type d -iname '.pytest_cache' -exec rm -rf \{\} + -print
@find . -type d -iname '*.egg-info' -exec rm -rf \{\} + -print
@find . -type f -iname '.coverage' -exec rm -rf \{\} + -print
@find . -type f -name "*.pyc" -delete -print
.PHONY: pyclean