-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
105 lines (83 loc) · 3.23 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
# /!\ /!\ /!\ /!\ /!\ /!\ /!\ DISCLAIMER /!\ /!\ /!\ /!\ /!\ /!\ /!\ /!\
#
# This Makefile is only meant to be used for DEVELOPMENT purpose.
#
# PLEASE DO NOT USE IT FOR YOUR CI/PRODUCTION/WHATEVER...
#
# /!\ /!\ /!\ /!\ /!\ /!\ /!\ /!\ /!\ /!\ /!\ /!\ /!\ /!\ /!\ /!\ /!\ /!\
#
# Note to developpers:
#
# While editing this file, please respect the following statements:
#
# 1. Every variable should be defined in the ad hoc VARIABLES section with a
# relevant subsection
# 2. Every new rule should be defined in the ad hoc RULES section with a
# relevant subsection depending on the targeted service
# 3. Rules should be sorted alphabetically within their section
# 4. When a rule has multiple dependencies, you should:
# - duplicate the rule name to add the help string (if required)
# - write one dependency per line to increase readability and diffs
# 5. .PHONY rule statement should be written after the corresponding rule
# ==============================================================================
# VARIABLES
BOLD := \033[1m
RESET := \033[0m
GREEN := \033[1;32m
# ==============================================================================
# RULES
default: h
# -- quality
lint: ## Run all linters (isort, black, flake8, pylint)
lint: \
lint-isort \
lint-black \
lint-flake8 \
lint-pylint \
lint-bandit
.PHONY: lint
lint-black: ## Run the black tool and update files that need to
@echo "$(BOLD)Running black$(RESET)"
black src tests
.PHONY: lint-black
lint-flake8: ## Run the flake8 tool
@echo "$(BOLD)Running flake8$(RESET)"
flake8 src tests
.PHONY: lint-flake8
lint-isort: ## automatically re-arrange python imports in code base
@echo "$(BOLD)Running isort$(RESET)"
isort src tests --atomic
.PHONY: lint-isort
lint-pylint: ## Run the pylint tool
@echo "$(BOLD)Running pylint$(RESET)"
DJANGO_SETTINGS_MODULE=app.settings DJANGO_CONFIGURATION=Test pylint --rcfile=pylintrc src tests/tests_django_peertube_runner_connector tests/app
.PHONY: lint-pylint
lint-bandit: ## lint back-end python sources with bandit
@echo "$(BOLD)Running bandit$(RESET)"
bandit -c .bandit -qr src
.PHONY: lint-bandit
check-manifest: ## check the MANIFEST.in is correct
@echo "$(BOLD)Running check-manifest$(RESET)"
check-manifest
.PHONY: check-manifest
# -- tests
test: ## run the test suite (tox)
@echo "$(BOLD)Running tests$(RESET)"
tox
.PHONY: test
# -- local django server
run_django: ## run the Django test server
@echo "$(BOLD)Running Django test server$(RESET)"
DJANGO_ENVIRONMENT=development python tests/manage.py runserver 127.0.0.1:8000
.PHONY: run_django
# -- Misc
h: # short default help task
@echo "$(BOLD)Project Makefile$(RESET)"
@echo "Please use 'make $(BOLD)target$(RESET)' where $(BOLD)target$(RESET) is one of:"
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(firstword $(MAKEFILE_LIST)) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "$(GREEN)%-50s$(RESET) %s\n", $$1, $$2}'
.PHONY: h
help: ## Show a more readable help on multiple lines
@echo "$(BOLD)Project Makefile$(RESET)"
@echo "Please use 'make $(BOLD)target$(RESET)' where $(BOLD)target$(RESET) is one of:"
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(firstword $(MAKEFILE_LIST)) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "$(GREEN)%s$(RESET)\n %s\n\n", $$1, $$2}'
.PHONY: help