-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
44 lines (37 loc) · 1.29 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
.SILENT:
.PHONY: help lint test mess-detector code-duplication
## Colors
COLOR_RESET = \033[0m
COLOR_INFO = \033[32m
COLOR_COMMENT = \033[33m
## Help
help:
printf "${COLOR_COMMENT}Usage:${COLOR_RESET}\n"
printf " make [target]\n\n"
printf "${COLOR_COMMENT}Available targets:${COLOR_RESET}\n"
awk '/^[a-zA-Z\-\_0-9\.@]+:/ { \
helpMessage = match(lastLine, /^## (.*)/); \
if (helpMessage) { \
helpCommand = substr($$1, 0, index($$1, ":")); \
helpMessage = substr(lastLine, RSTART + 3, RLENGTH); \
printf " ${COLOR_INFO}%-17s${COLOR_RESET} %s\n", helpCommand, helpMessage; \
} \
} \
{ lastLine = $$0 }' $(MAKEFILE_LIST)
## Run lint tools (php-cs-fixer)
lint:
php-cs-fixer fix src --using-cache=false
## Run tests with system phpunit
test:
phpunit --coverage-html doc/coverage
find doc/ -type f -path '*.html' -exec sed -r 's/<small>(Generated by [^\n]*) at [^\n]*<\/small>/<small>\1<\/small>/' -i {} \;
## Run tests with internal phpunit
test@vendor:
vendor/bin/phpunit --coverage-html doc/coverage
find doc/ -type f -path '*.html' -exec sed -r 's/<small>(Generated by [^\n]*) at [^\n]*<\/small>/<small>\1<\/small>/' -i {} \;
## PHP Mess detector
mess-detector:
phpmd src/ text phpmd.xml --ignore-violations-on-exit
## Code duplication tester
code-duplication:
phpcpd --progress src