aboutsummaryrefslogtreecommitdiffhomepage
path: root/Makefile
diff options
context:
space:
mode:
authornodiscc <nodiscc@gmail.com>2015-04-10 20:28:51 +0200
committernodiscc <nodiscc@gmail.com>2015-04-10 20:28:51 +0200
commitc5db827aee741315cf4789ed63074d6229fe7fba (patch)
tree55badac525ec709b688feabbf5c8fcb3cd1cf844 /Makefile
parent1caf20055175d47e0c88785e185e15a481509368 (diff)
parent6811469e75e35bbf488fe5f7fc5501f483c4a37f (diff)
downloadShaarli-c5db827aee741315cf4789ed63074d6229fe7fba.tar.gz
Shaarli-c5db827aee741315cf4789ed63074d6229fe7fba.tar.zst
Shaarli-c5db827aee741315cf4789ed63074d6229fe7fba.zip
Merge branch 'pandoc' into next
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile45
1 files changed, 24 insertions, 21 deletions
diff --git a/Makefile b/Makefile
index 8f9ab9e7..e6f42853 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,6 @@
1# Shaarli, the personal, minimalist, super-fast, no-database delicious clone. 1# Shaarli, the personal, minimalist, super-fast, no-database delicious clone.
2#
3# Makefile for PHP code analysis & testing 2# Makefile for PHP code analysis & testing
4# 3
5# Prerequisites: 4# Prerequisites:
6# - install Composer, either: 5# - install Composer, either:
7# - from your distro's package manager; 6# - from your distro's package manager;
@@ -9,6 +8,7 @@
9# - install/update test dependencies: 8# - install/update test dependencies:
10# $ composer install # 1st setup 9# $ composer install # 1st setup
11# $ composer update 10# $ composer update
11
12BIN = vendor/bin 12BIN = vendor/bin
13PHP_SOURCE = index.php 13PHP_SOURCE = index.php
14MESS_DETECTOR_RULES = cleancode,codesize,controversial,design,naming,unusedcode 14MESS_DETECTOR_RULES = cleancode,codesize,controversial,design,naming,unusedcode
@@ -17,41 +17,39 @@ all: static_analysis_summary
17 17
18## 18##
19# Concise status of the project 19# Concise status of the project
20#
21# These targets are non-blocking: || exit 0 20# These targets are non-blocking: || exit 0
22## 21##
22
23static_analysis_summary: code_sniffer_source copy_paste mess_detector_summary 23static_analysis_summary: code_sniffer_source copy_paste mess_detector_summary
24 24
25## 25##
26# PHP_CodeSniffer 26# PHP_CodeSniffer
27#
28# Detects PHP syntax errors 27# Detects PHP syntax errors
29#
30# Documentation (usage, output formatting): 28# Documentation (usage, output formatting):
31# - http://pear.php.net/manual/en/package.php.php-codesniffer.usage.php 29# - http://pear.php.net/manual/en/package.php.php-codesniffer.usage.php
32# - http://pear.php.net/manual/en/package.php.php-codesniffer.reporting.php 30# - http://pear.php.net/manual/en/package.php.php-codesniffer.reporting.php
33## 31##
32
34code_sniffer: code_sniffer_full 33code_sniffer: code_sniffer_full
35 34
36# - errors by Git author 35### - errors by Git author
37code_sniffer_blame: 36code_sniffer_blame:
38 @$(BIN)/phpcs $(PHP_SOURCE) --report-gitblame 37 @$(BIN)/phpcs $(PHP_SOURCE) --report-gitblame
39 38
40# - all errors/warnings 39### - all errors/warnings
41code_sniffer_full: 40code_sniffer_full:
42 @$(BIN)/phpcs $(PHP_SOURCE) --report-full --report-width=200 41 @$(BIN)/phpcs $(PHP_SOURCE) --report-full --report-width=200
43 42
44# - errors grouped by kind 43### - errors grouped by kind
45code_sniffer_source: 44code_sniffer_source:
46 @$(BIN)/phpcs $(PHP_SOURCE) --report-source || exit 0 45 @$(BIN)/phpcs $(PHP_SOURCE) --report-source || exit 0
47 46
48## 47##
49# PHP Copy/Paste Detector 48# PHP Copy/Paste Detector
50#
51# Detects code redundancy 49# Detects code redundancy
52#
53# Documentation: https://github.com/sebastianbergmann/phpcpd 50# Documentation: https://github.com/sebastianbergmann/phpcpd
54## 51##
52
55copy_paste: 53copy_paste:
56 @echo "-----------------------" 54 @echo "-----------------------"
57 @echo "PHP COPY/PASTE DETECTOR" 55 @echo "PHP COPY/PASTE DETECTOR"
@@ -61,32 +59,30 @@ copy_paste:
61 59
62## 60##
63# PHP Mess Detector 61# PHP Mess Detector
64#
65# Detects PHP syntax errors, sorted by category 62# Detects PHP syntax errors, sorted by category
66#
67# Rules documentation: http://phpmd.org/rules/index.html 63# Rules documentation: http://phpmd.org/rules/index.html
68# 64##
65
69mess_title: 66mess_title:
70 @echo "-----------------" 67 @echo "-----------------"
71 @echo "PHP MESS DETECTOR" 68 @echo "PHP MESS DETECTOR"
72 @echo "-----------------" 69 @echo "-----------------"
73 70
74# - all warnings 71### - all warnings
75mess_detector: mess_title 72mess_detector: mess_title
76 @$(BIN)/phpmd $(PHP_SOURCE) text $(MESS_DETECTOR_RULES) | sed 's_.*\/__' 73 @$(BIN)/phpmd $(PHP_SOURCE) text $(MESS_DETECTOR_RULES) | sed 's_.*\/__'
77 74
78# - all warnings 75### - all warnings + HTML output contains links to PHPMD's documentation
79# the generated HTML contains links to PHPMD's documentation
80mess_detector_html: 76mess_detector_html:
81 @$(BIN)/phpmd $(PHP_SOURCE) html $(MESS_DETECTOR_RULES) \ 77 @$(BIN)/phpmd $(PHP_SOURCE) html $(MESS_DETECTOR_RULES) \
82 --reportfile phpmd.html || exit 0 78 --reportfile phpmd.html || exit 0
83 79
84# - warnings grouped by message, sorted by descending frequency order 80### - warnings grouped by message, sorted by descending frequency order
85mess_detector_grouped: mess_title 81mess_detector_grouped: mess_title
86 @$(BIN)/phpmd $(PHP_SOURCE) text $(MESS_DETECTOR_RULES) \ 82 @$(BIN)/phpmd $(PHP_SOURCE) text $(MESS_DETECTOR_RULES) \
87 | cut -f 2 | sort | uniq -c | sort -nr 83 | cut -f 2 | sort | uniq -c | sort -nr
88 84
89# - summary: number of warnings by rule set 85### - summary: number of warnings by rule set
90mess_detector_summary: mess_title 86mess_detector_summary: mess_title
91 @for rule in $$(echo $(MESS_DETECTOR_RULES) | tr ',' ' '); do \ 87 @for rule in $$(echo $(MESS_DETECTOR_RULES) | tr ',' ' '); do \
92 warnings=$$($(BIN)/phpmd $(PHP_SOURCE) text $$rule | wc -l); \ 88 warnings=$$($(BIN)/phpmd $(PHP_SOURCE) text $$rule | wc -l); \
@@ -95,13 +91,20 @@ mess_detector_summary: mess_title
95 91
96## 92##
97# Targets for repository and documentation maintenance 93# Targets for repository and documentation maintenance
98# 94##
99# remove all unversioned files 95
96### remove all unversioned files
100clean: 97clean:
101 @git clean -df 98 @git clean -df
102 99
103# update the local copy of the documentation 100### update the local copy of the documentation
104doc: clean 101doc: clean
105 @rm -rf doc 102 @rm -rf doc
106 @git clone https://github.com/shaarli/Shaarli.wiki.git doc 103 @git clone https://github.com/shaarli/Shaarli.wiki.git doc
107 @rm -rf doc/.git 104 @rm -rf doc/.git
105
106### Convert local markdown documentation to HTML
107htmldoc:
108 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"; \
110 done; \ No newline at end of file