diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 33 |
1 files changed, 26 insertions, 7 deletions
@@ -8,12 +8,15 @@ | |||
8 | # - install/update test dependencies: | 8 | # - install/update test dependencies: |
9 | # $ composer install # 1st setup | 9 | # $ composer install # 1st setup |
10 | # $ composer update | 10 | # $ composer update |
11 | # - install Xdebug for PHPUnit code coverage reports: | ||
12 | # - see http://xdebug.org/docs/install | ||
13 | # - enable in php.ini | ||
11 | 14 | ||
12 | BIN = vendor/bin | 15 | BIN = vendor/bin |
13 | PHP_SOURCE = index.php | 16 | PHP_SOURCE = index.php application tests |
14 | MESS_DETECTOR_RULES = cleancode,codesize,controversial,design,naming,unusedcode | 17 | PHP_COMMA_SOURCE = index.php,application,tests |
15 | 18 | ||
16 | all: static_analysis_summary | 19 | all: static_analysis_summary test |
17 | 20 | ||
18 | ## | 21 | ## |
19 | # Concise status of the project | 22 | # Concise status of the project |
@@ -21,6 +24,7 @@ all: static_analysis_summary | |||
21 | ## | 24 | ## |
22 | 25 | ||
23 | static_analysis_summary: code_sniffer_source copy_paste mess_detector_summary | 26 | static_analysis_summary: code_sniffer_source copy_paste mess_detector_summary |
27 | @echo | ||
24 | 28 | ||
25 | ## | 29 | ## |
26 | # PHP_CodeSniffer | 30 | # PHP_CodeSniffer |
@@ -62,6 +66,7 @@ copy_paste: | |||
62 | # Detects PHP syntax errors, sorted by category | 66 | # Detects PHP syntax errors, sorted by category |
63 | # Rules documentation: http://phpmd.org/rules/index.html | 67 | # Rules documentation: http://phpmd.org/rules/index.html |
64 | ## | 68 | ## |
69 | MESS_DETECTOR_RULES = cleancode,codesize,controversial,design,naming,unusedcode | ||
65 | 70 | ||
66 | mess_title: | 71 | mess_title: |
67 | @echo "-----------------" | 72 | @echo "-----------------" |
@@ -70,11 +75,11 @@ mess_title: | |||
70 | 75 | ||
71 | ### - all warnings | 76 | ### - all warnings |
72 | mess_detector: mess_title | 77 | mess_detector: mess_title |
73 | @$(BIN)/phpmd $(PHP_SOURCE) text $(MESS_DETECTOR_RULES) | sed 's_.*\/__' | 78 | @$(BIN)/phpmd $(PHP_COMMA_SOURCE) text $(MESS_DETECTOR_RULES) | sed 's_.*\/__' |
74 | 79 | ||
75 | ### - all warnings + HTML output contains links to PHPMD's documentation | 80 | ### - all warnings + HTML output contains links to PHPMD's documentation |
76 | mess_detector_html: | 81 | mess_detector_html: |
77 | @$(BIN)/phpmd $(PHP_SOURCE) html $(MESS_DETECTOR_RULES) \ | 82 | @$(BIN)/phpmd $(PHP_COMMA_SOURCE) html $(MESS_DETECTOR_RULES) \ |
78 | --reportfile phpmd.html || exit 0 | 83 | --reportfile phpmd.html || exit 0 |
79 | 84 | ||
80 | ### - warnings grouped by message, sorted by descending frequency order | 85 | ### - warnings grouped by message, sorted by descending frequency order |
@@ -85,11 +90,25 @@ mess_detector_grouped: mess_title | |||
85 | ### - summary: number of warnings by rule set | 90 | ### - summary: number of warnings by rule set |
86 | mess_detector_summary: mess_title | 91 | mess_detector_summary: mess_title |
87 | @for rule in $$(echo $(MESS_DETECTOR_RULES) | tr ',' ' '); do \ | 92 | @for rule in $$(echo $(MESS_DETECTOR_RULES) | tr ',' ' '); do \ |
88 | warnings=$$($(BIN)/phpmd $(PHP_SOURCE) text $$rule | wc -l); \ | 93 | warnings=$$($(BIN)/phpmd $(PHP_COMMA_SOURCE) text $$rule | wc -l); \ |
89 | printf "$$warnings\t$$rule\n"; \ | 94 | printf "$$warnings\t$$rule\n"; \ |
90 | done; | 95 | done; |
91 | 96 | ||
92 | ## | 97 | ## |
98 | # PHPUnit | ||
99 | # Runs unitary and functional tests | ||
100 | # Generates an HTML coverage report if Xdebug is enabled | ||
101 | # | ||
102 | # See phpunit.xml for configuration | ||
103 | # https://phpunit.de/manual/current/en/appendixes.configuration.html | ||
104 | ## | ||
105 | test: clean | ||
106 | @echo "-------" | ||
107 | @echo "PHPUNIT" | ||
108 | @echo "-------" | ||
109 | @$(BIN)/phpunit tests | ||
110 | |||
111 | ## | ||
93 | # Targets for repository and documentation maintenance | 112 | # Targets for repository and documentation maintenance |
94 | ## | 113 | ## |
95 | 114 | ||
@@ -107,4 +126,4 @@ doc: clean | |||
107 | htmldoc: | 126 | htmldoc: |
108 | for file in `find doc/ -maxdepth 1 -name "*.md"`; do \ | 127 | for file in `find doc/ -maxdepth 1 -name "*.md"`; do \ |
109 | pandoc -f markdown_github -t html5 -s -c "github-markdown.css" -o doc/`basename $$file .md`.html "$$file"; \ | 128 | pandoc -f markdown_github -t html5 -s -c "github-markdown.css" -o doc/`basename $$file .md`.html "$$file"; \ |
110 | done; \ No newline at end of file | 129 | done; |