-
Notifications
You must be signed in to change notification settings - Fork 34
/
Makefile
107 lines (93 loc) · 4.03 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
.PHONY: clean
clean: clean-build clean-pyc clean-test clean-docs
.PHONY: clean-build
clean-build:
rm -fr build/
rm -fr dist/
rm -fr .eggs/
rm -fr pip-wheel-metadata
find . -name '*.egg-info' -exec rm -fr {} +
find . -name '*.egg' -exec rm -fr {} +
find . -name '*.svn' -exec rm -fr {} +
find . -type d -name __pycache__ -exec rm -rv {} +
rm -fr .idea .history
rm -fr venv
.PHONY: clean-docs
clean-docs:
rm -fr site/
.PHONY: clean-pyc
clean-pyc:
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +
find . -name '__pycache__' -exec rm -fr {} +
find . -name '.DS_Store' -exec rm -fr {} +
.PHONY: clean-test
clean-test: clean-cache
rm -fr .tox/
rm -f .coverage
find . -name ".coverage*" -not -name ".coveragerc" -exec rm -fr "{}" \;
rm -fr coverage.xml
rm -fr htmlcov/
find . -name 'log.txt' -exec rm -fr {} +
find . -name 'log.*.txt' -exec rm -fr {} +
rm -rf leak_report
# removes various cache files
.PHONY: clean-cache
clean-cache:
find . -type d -name .hypothesis -prune -exec rm -rf {} \;
rm -fr .pytest_cache
rm -fr .mypy_cache/
# isort: fix import orders
# black: format files according to the pep standards
.PHONY: format
format:
tomte format-code
# black-check: check code style
# isort-check: check for import order
# flake8: wrapper around various code checks, https://flake8.pycqa.org/en/latest/user/error-codes.html
# mypy: static type checker
# pylint: code analysis for code smells and refactoring suggestions
# darglint: docstring linter
.PHONY: code-checks
code-checks:
tomte check-code
# safety: checks dependencies for known security vulnerabilities
# bandit: security linter
# gitleaks: checks for sensitive information
.PHONY: security
security:
tomte check-security
gitleaks detect --report-format json --report-path leak_report
# generate abci docstrings
# update copyright headers
# generate latest hashes for updated packages
.PHONY: generators
generators: clean-cache fix-abci-app-specs
tox -e abci-docstrings
tomte format-copyright --author valory --exclude-part abci --exclude-part http_client --exclude-part ipfs --exclude-part ledger --exclude-part p2p_libp2p_client --exclude-part gnosis_safe --exclude-part gnosis_safe_proxy_factory --exclude-part multisend --exclude-part service_registry --exclude-part protocols --exclude-part abstract_abci --exclude-part abstract_round_abci --exclude-part registration_abci --exclude-part reset_pause_abci --exclude-part termination_abci --exclude-part transaction_settlement_abci --exclude-part websocket_client --exclude-part contract_subscription
autonomy packages lock
tox -e fix-doc-hashes
.PHONY: common-checks-1
common-checks-1:
tomte check-copyright --author valory --exclude-part abci --exclude-part http_client --exclude-part ipfs --exclude-part ledger --exclude-part p2p_libp2p_client --exclude-part gnosis_safe --exclude-part gnosis_safe_proxy_factory --exclude-part multisend --exclude-part service_registry --exclude-part protocols --exclude-part abstract_abci --exclude-part abstract_round_abci --exclude-part registration_abci --exclude-part reset_pause_abci --exclude-part termination_abci --exclude-part transaction_settlement_abci --exclude-part websocket_client --exclude-part contract_subscription
tomte check-doc-links
tox -p -e check-hash -e check-packages -e check-doc-hashes -e analyse-service
.PHONY: common-checks-2
common-checks-2:
tox -e check-abci-docstrings
tox -e check-abciapp-specs
tox -e check-handlers
.PHONY: all-checks
all-checks: clean format code-checks security generators common-checks-1 common-checks-2
.PHONY: fix-abci-app-specs
fix-abci-app-specs:
autonomy analyse fsm-specs --update --app-class MechAbciApp --package packages/valory/skills/mech_abci
echo "Successfully validated abcis!"
protolint_install:
mkdir protolint_install
cd protolint_install && \
wget https://github.com/yoheimuta/protolint/releases/download/v0.27.0/protolint_0.27.0_Linux_x86_64.tar.gz && \
tar -xvf protolint_0.27.0_Linux_x86_64.tar.gz && \
sudo mv protolint /usr/local/bin/protolint
sudo rm -rf protolint_install