aboutsummaryrefslogtreecommitdiffhomepage
path: root/Makefile
diff options
context:
space:
mode:
authorVirtualTam <virtualtam@flibidi.org>2015-03-12 00:43:02 +0100
committerVirtualTam <virtualtam@flibidi.net>2015-06-11 00:45:45 +0200
commitca74886f30da323f42aa4bd70461003f46ef299b (patch)
tree3714895c25d80bdb472211a564f83d3744d90f34 /Makefile
parentcbecab773526b0c39f3cffa1d4595b5caa781bda (diff)
downloadShaarli-ca74886f30da323f42aa4bd70461003f46ef299b.tar.gz
Shaarli-ca74886f30da323f42aa4bd70461003f46ef299b.tar.zst
Shaarli-ca74886f30da323f42aa4bd70461003f46ef299b.zip
LinkDB: move to a proper file, add test coverage
Relates to #71 LinkDB - move to application/LinkDB.php - code cleanup - indentation - whitespaces - formatting - comment cleanup - add missing documentation - unify formatting Test coverage for LinkDB - constructor - public / private access - link-related methods Shaarli utilities (LinkDB dependencies) - move startsWith() and endsWith() functions to application/Utils.php - add test coverage Dev utilities - Composer: add PHPUnit to dev dependencies - Makefile: - update lint targets - add test targets - generate coverage reports Signed-off-by: VirtualTam <virtualtam@flibidi.net>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile33
1 files changed, 26 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index e6f42853..80efcfaa 100644
--- a/Makefile
+++ b/Makefile
@@ -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
12BIN = vendor/bin 15BIN = vendor/bin
13PHP_SOURCE = index.php 16PHP_SOURCE = index.php application tests
14MESS_DETECTOR_RULES = cleancode,codesize,controversial,design,naming,unusedcode 17PHP_COMMA_SOURCE = index.php,application,tests
15 18
16all: static_analysis_summary 19all: 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
23static_analysis_summary: code_sniffer_source copy_paste mess_detector_summary 26static_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##
69MESS_DETECTOR_RULES = cleancode,codesize,controversial,design,naming,unusedcode
65 70
66mess_title: 71mess_title:
67 @echo "-----------------" 72 @echo "-----------------"
@@ -70,11 +75,11 @@ mess_title:
70 75
71### - all warnings 76### - all warnings
72mess_detector: mess_title 77mess_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
76mess_detector_html: 81mess_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
86mess_detector_summary: mess_title 91mess_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##
105test: 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
107htmldoc: 126htmldoc:
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;