diff options
author | VirtualTam <virtualtam@flibidi.net> | 2019-02-23 16:27:33 +0100 |
---|---|---|
committer | VirtualTam <virtualtam@flibidi.net> | 2019-02-23 16:27:33 +0100 |
commit | 43c77f658a905e2def6aeca4c092683977cd0c55 (patch) | |
tree | cb0dc273a315a777847d251f856625b2fc779c04 /Makefile | |
parent | 630ebca2b6359e942e5b6c057cca2b6069c1093a (diff) | |
parent | 1826e383ecf501302974132fd443cf1ca06e10f6 (diff) | |
download | Shaarli-43c77f658a905e2def6aeca4c092683977cd0c55.tar.gz Shaarli-43c77f658a905e2def6aeca4c092683977cd0c55.tar.zst Shaarli-43c77f658a905e2def6aeca4c092683977cd0c55.zip |
Merge commit '1826e383ecf501302974132fd443cf1ca06e10f6' into v0.10
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 68 |
1 files changed, 7 insertions, 61 deletions
@@ -2,8 +2,6 @@ | |||
2 | # Makefile for PHP code analysis & testing, documentation and release generation | 2 | # Makefile for PHP code analysis & testing, documentation and release generation |
3 | 3 | ||
4 | BIN = vendor/bin | 4 | BIN = vendor/bin |
5 | PHP_SOURCE = index.php application tests plugins | ||
6 | PHP_COMMA_SOURCE = index.php,application,tests,plugins | ||
7 | 5 | ||
8 | all: static_analysis_summary check_permissions test | 6 | all: static_analysis_summary check_permissions test |
9 | 7 | ||
@@ -18,84 +16,32 @@ docker_%: | |||
18 | cd ~/shaarli && make $* | 16 | cd ~/shaarli && make $* |
19 | 17 | ||
20 | ## | 18 | ## |
21 | # Concise status of the project | ||
22 | # These targets are non-blocking: || exit 0 | ||
23 | ## | ||
24 | |||
25 | static_analysis_summary: code_sniffer_source copy_paste mess_detector_summary | ||
26 | @echo | ||
27 | |||
28 | ## | ||
29 | # PHP_CodeSniffer | 19 | # PHP_CodeSniffer |
30 | # Detects PHP syntax errors | 20 | # Detects PHP syntax errors |
31 | # Documentation (usage, output formatting): | 21 | # Documentation (usage, output formatting): |
32 | # - http://pear.php.net/manual/en/package.php.php-codesniffer.usage.php | 22 | # - http://pear.php.net/manual/en/package.php.php-codesniffer.usage.php |
33 | # - http://pear.php.net/manual/en/package.php.php-codesniffer.reporting.php | 23 | # - http://pear.php.net/manual/en/package.php.php-codesniffer.reporting.php |
34 | ## | 24 | ## |
25 | PHPCS := $(BIN)/phpcs | ||
35 | 26 | ||
36 | code_sniffer: code_sniffer_full | 27 | code_sniffer: |
28 | @$(PHPCS) | ||
37 | 29 | ||
38 | ### - errors filtered by coding standard: PEAR, PSR1, PSR2, Zend... | 30 | ### - errors filtered by coding standard: PEAR, PSR1, PSR2, Zend... |
39 | PHPCS_%: | 31 | PHPCS_%: |
40 | @$(BIN)/phpcs $(PHP_SOURCE) --report-full --report-width=200 --standard=$* | 32 | @$(PHPCS) --report-full --report-width=200 --standard=$* |
41 | 33 | ||
42 | ### - errors by Git author | 34 | ### - errors by Git author |
43 | code_sniffer_blame: | 35 | code_sniffer_blame: |
44 | @$(BIN)/phpcs $(PHP_SOURCE) --report-gitblame | 36 | @$(PHPCS) --report-gitblame |
45 | 37 | ||
46 | ### - all errors/warnings | 38 | ### - all errors/warnings |
47 | code_sniffer_full: | 39 | code_sniffer_full: |
48 | @$(BIN)/phpcs $(PHP_SOURCE) --report-full --report-width=200 | 40 | @$(PHPCS) --report-full --report-width=200 |
49 | 41 | ||
50 | ### - errors grouped by kind | 42 | ### - errors grouped by kind |
51 | code_sniffer_source: | 43 | code_sniffer_source: |
52 | @$(BIN)/phpcs $(PHP_SOURCE) --report-source || exit 0 | 44 | @$(PHPCS) --report-source || exit 0 |
53 | |||
54 | ## | ||
55 | # PHP Copy/Paste Detector | ||
56 | # Detects code redundancy | ||
57 | # Documentation: https://github.com/sebastianbergmann/phpcpd | ||
58 | ## | ||
59 | |||
60 | copy_paste: | ||
61 | @echo "-----------------------" | ||
62 | @echo "PHP COPY/PASTE DETECTOR" | ||
63 | @echo "-----------------------" | ||
64 | @$(BIN)/phpcpd $(PHP_SOURCE) || exit 0 | ||
65 | @echo | ||
66 | |||
67 | ## | ||
68 | # PHP Mess Detector | ||
69 | # Detects PHP syntax errors, sorted by category | ||
70 | # Rules documentation: http://phpmd.org/rules/index.html | ||
71 | ## | ||
72 | MESS_DETECTOR_RULES = cleancode,codesize,controversial,design,naming,unusedcode | ||
73 | |||
74 | mess_title: | ||
75 | @echo "-----------------" | ||
76 | @echo "PHP MESS DETECTOR" | ||
77 | @echo "-----------------" | ||
78 | |||
79 | ### - all warnings | ||
80 | mess_detector: mess_title | ||
81 | @$(BIN)/phpmd $(PHP_COMMA_SOURCE) text $(MESS_DETECTOR_RULES) | sed 's_.*\/__' | ||
82 | |||
83 | ### - all warnings + HTML output contains links to PHPMD's documentation | ||
84 | mess_detector_html: | ||
85 | @$(BIN)/phpmd $(PHP_COMMA_SOURCE) html $(MESS_DETECTOR_RULES) \ | ||
86 | --reportfile phpmd.html || exit 0 | ||
87 | |||
88 | ### - warnings grouped by message, sorted by descending frequency order | ||
89 | mess_detector_grouped: mess_title | ||
90 | @$(BIN)/phpmd $(PHP_SOURCE) text $(MESS_DETECTOR_RULES) \ | ||
91 | | cut -f 2 | sort | uniq -c | sort -nr | ||
92 | |||
93 | ### - summary: number of warnings by rule set | ||
94 | mess_detector_summary: mess_title | ||
95 | @for rule in $$(echo $(MESS_DETECTOR_RULES) | tr ',' ' '); do \ | ||
96 | warnings=$$($(BIN)/phpmd $(PHP_COMMA_SOURCE) text $$rule | wc -l); \ | ||
97 | printf "$$warnings\t$$rule\n"; \ | ||
98 | done; | ||
99 | 45 | ||
100 | ## | 46 | ## |
101 | # Checks source file & script permissions | 47 | # Checks source file & script permissions |