Skip to content

Commit f403c4f

Browse files
committed
Add phpmd checks and add bz2 PHP extension for it
1 parent cc6796d commit f403c4f

File tree

6 files changed

+73
-21
lines changed

6 files changed

+73
-21
lines changed

.docker/php-5.6/Dockerfile

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
FROM php:5.6-alpine
2-
3-
# Uncomment the furhter line to add needed extension(s)
4-
# RUN docker-php-ext-install iconv
5-
6-
# Uncomment the furhter line to add and enable a needed pecl extension(s)
7-
# RUN pecl install memcached && docker-php-ext-enable memcached
8-
2+
RUN apk --update add libbz2 bzip2-dev && \
3+
apk del build-base && \
4+
rm -rf /var/cache/apk/*
5+
RUN docker-php-ext-install bz2
96
VOLUME ["/app"]
107
WORKDIR /app

.docker/php-7.0/Dockerfile

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
FROM php:7.0-alpine
2-
3-
# Uncomment the furhter line to add needed extension(s)
4-
# RUN docker-php-ext-install iconv
5-
6-
# Uncomment the furhter line to add and enable a needed pecl extension(s)
7-
# RUN pecl install memcached && docker-php-ext-enable memcached
8-
2+
RUN apk --update add libbz2 bzip2-dev && \
3+
apk del build-base && \
4+
rm -rf /var/cache/apk/*
5+
RUN docker-php-ext-install bz2
96
VOLUME ["/app"]
107
WORKDIR /app

.docker/php-7.1/Dockerfile

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
FROM php:7.1-alpine
2-
3-
# Uncomment the furhter line to add needed extension(s)
4-
# RUN docker-php-ext-install iconv
5-
6-
# Uncomment the furhter line to add and enable a needed pecl extension(s)
7-
# RUN pecl install memcached && docker-php-ext-enable memcached
8-
2+
RUN apk --update add libbz2 bzip2-dev && \
3+
apk del build-base && \
4+
rm -rf /var/cache/apk/*
5+
RUN docker-php-ext-install bz2
96
VOLUME ["/app"]
107
WORKDIR /app

.docker/run.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ do
6060
print_task "Check PSR2 codestyle"
6161
execute "docker-compose run $VERSION php bin/phpcs.phar --standard=PSR2 ./src -v"
6262

63+
print_task "Check phpmd rules"
64+
execute "docker-compose run $VERSION php bin/phpmd.phar ./src text ./phpmd.xml "
65+
6366
print_task "Run copy paste detection"
6467
execute "docker-compose run $VERSION php bin/phpcpd.phar ./src"
6568
fi

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ script:
2525
- ./bin/phpcs.phar --standard=PSR2 ./src -v
2626
- ./bin/phpcpd.phar ./src
2727
- ./bin/security-checker.phar security:check ./composer.lock
28+
- ./bin/phpmd.phar ./src text ./phpmd.xml
2829
- ./bin/phpunit.phar --coverage-clover build/logs/clover.xml
2930
after_success:
3031
- ./bin/test-reporter

phpmd.xml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<ruleset name="basic-rules"
2+
xmlns="http://pmd.sf.net/ruleset/1.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0
5+
http://pmd.sf.net/ruleset_xml_schema.xsd"
6+
xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">
7+
<description>mess detection</description>
8+
9+
<rule ref="rulesets/cleancode.xml" />
10+
<rule ref="rulesets/codesize.xml">
11+
<exclude name="ExcessiveParameterList" />
12+
<exclude name="ExcessiveMethodLength" />
13+
<exclude name="ExcessiveClassLength" />
14+
<exclude name="CyclomaticComplexity" />
15+
</rule>
16+
<rule ref="rulesets/codesize.xml/ExcessiveParameterList">
17+
<properties>
18+
<property name="minimum" value="4" />
19+
</properties>
20+
</rule>
21+
<rule ref="rulesets/codesize.xml/ExcessiveMethodLength">
22+
<properties>
23+
<property name="minimum" value="31" />
24+
<property name="ignore-whitespace" value="true" />
25+
</properties>
26+
</rule>
27+
<rule ref="rulesets/codesize.xml/ExcessiveClassLength">
28+
<properties>
29+
<property name="minimum" value="301" />
30+
<property name="ignore-whitespace" value="true" />
31+
</properties>
32+
</rule>
33+
<rule ref="rulesets/codesize.xml/CyclomaticComplexity">
34+
<properties>
35+
<property name="reportLevel" value="6" />
36+
<property name="showClassesComplexity" value="true" />
37+
<property name="showMethodsComplexity" value="true" />
38+
</properties>
39+
</rule>
40+
<rule ref="rulesets/controversial.xml" />
41+
<rule ref="rulesets/design.xml" />
42+
<rule ref="rulesets/naming.xml">
43+
<exclude name="ShortVariable" />
44+
<exclude name="LongVariable" />
45+
</rule>
46+
<rule ref="rulesets/naming.xml/ShortVariable">
47+
<properties>
48+
<property name="minimum" value="2" />
49+
</properties>
50+
</rule>
51+
<rule ref="rulesets/naming.xml/LongVariable">
52+
<properties>
53+
<property name="maximum" value="30" />
54+
</properties>
55+
</rule>
56+
<rule ref="rulesets/unusedcode.xml" />
57+
</ruleset>

0 commit comments

Comments
 (0)