Skip to content

Commit d718e74

Browse files
author
Adegoke Obasa
committed
Ensure lint target fails on error, set correct options for phpcpd and phpunit targets
1 parent 5544b70 commit d718e74

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

build.xml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<project name="yii2-base-project" default="full-build">
2+
<project name="yii2-base-project" default="build">
33
<property name="pdepend" value="${basedir}/vendor/bin/pdepend"/>
44
<property name="phpcpd" value="${basedir}/vendor/bin/phpcpd"/>
55
<property name="phpcs" value="${basedir}/vendor/bin/phpcs"/>
@@ -8,6 +8,10 @@
88
<property name="phpmd" value="${basedir}/vendor/bin/phpmd"/>
99
<property name="phpunit" value="${basedir}/vendor/bin/phpunit"/>
1010

11+
<target name="build"
12+
depends="prepare,static-analysis"
13+
description="Performs static analysis and withouy running the tests"/>
14+
1115
<target name="full-build"
1216
depends="prepare,static-analysis,phpunit"
1317
description="Performs static analysis and runs the tests"/>
@@ -65,17 +69,15 @@
6569
<target name="lint"
6670
unless="lint.done"
6771
description="Perform syntax check of sourcecode files">
68-
<apply executable="php" taskname="lint">
72+
<apply executable="php" taskname="lint" failonerror="true">
6973
<arg value="-l"/>
7074

7175
<fileset dir="${basedir}/app">
7276
<include name="**/*.php"/>
73-
<modified/>
7477
</fileset>
7578

7679
<fileset dir="${basedir}/tests">
7780
<include name="**/*.php"/>
78-
<modified/>
7981
</fileset>
8082
</apply>
8183

@@ -187,6 +189,8 @@
187189
unless="phpcpd.done"
188190
description="Find duplicate code using PHPCPD and print human readable output. Intended for usage on the command line before committing.">
189191
<exec executable="${phpcpd}" taskname="phpcpd">
192+
<arg value="--min-lines=2"/>
193+
<arg value="--min-tokens=5"/>
190194
<arg path="${basedir}/app"/>
191195
</exec>
192196

@@ -200,6 +204,8 @@
200204
<exec executable="${phpcpd}" taskname="phpcpd">
201205
<arg value="--log-pmd"/>
202206
<arg path="${basedir}/build/logs/pmd-cpd.xml"/>
207+
<arg value="--min-lines=2"/>
208+
<arg value="--min-tokens=10"/>
203209
<arg path="${basedir}/app"/>
204210
</exec>
205211

@@ -213,6 +219,7 @@
213219
<exec executable="${phpunit}" resultproperty="result.phpunit" taskname="phpunit">
214220
<arg value="--configuration"/>
215221
<arg path="${basedir}/build/phpunit.xml"/>
222+
<arg path="${basedir}/tests"/>
216223
</exec>
217224

218225
<property name="phpunit.done" value="true"/>
@@ -226,6 +233,7 @@
226233
<arg value="--configuration"/>
227234
<arg path="${basedir}/build/phpunit.xml"/>
228235
<arg value="--no-coverage"/>
236+
<arg path="${basedir}/tests"/>
229237
</exec>
230238

231239
<property name="phpunit.done" value="true"/>

0 commit comments

Comments
 (0)