Skip to content

Instantly share code, notes, and snippets.

@Halleck45
Created September 27, 2012 14:34
Show Gist options
  • Save Halleck45/3794330 to your computer and use it in GitHub Desktop.
Save Halleck45/3794330 to your computer and use it in GitHub Desktop.
Mini audit de code avec phing
<?xml version="1.0" ?>
<project name="audit" basedir="." default="audit">
<property name="style" value="ZEND" />
<property name="test" value="${source}/../test" />
<property name="test-bootstrap" value="" />
<target name="prepare">
<mkdir dir="${out}" />
</target>
<!-- PHP Depend -->
<target name="pdepend" depends="prepare">
<phpdepend file="${source}">
<logger type="overview-pyramid" outfile="${out}/pyramid.svg"/>
</phpdepend>
</target>
<!-- Checkstyle -->
<target name="phpcs" depends="prepare">
<exec command="phpcs --standard=${style} --report=full ${source} > ${out}/checkstyle.txt" escape="false" />
<exec command="phpcs --standard=${style} --report=checkstyle ${source} > ${out}/checkstyle.xml" escape="false" />
</target>
<!-- Copy Paste Detector -->
<target name="phpcpd" depends="prepare">
<phpcpd file="${source}">
<formatter type="pmd" outfile="${out}/pmd-cpd.xml"/>
</phpcpd>
<exec command="phpcpd ${source} > ${out}/pmd-cpd.txt" escape="false" />
</target>
<!-- Mess Detector -->
<target name="phpmd" depends="prepare">
<phpmd file="${source}">
<formatter type="html" outfile="${out}/pmd.html"/>
<formatter type="xml" outfile="${out}/pmd.xml"/>
</phpmd>
</target>
<!-- PHPDoc -->
<target name="phpdoc" depends="prepare">
<exec command="apigen --source ${source} --destination ${out}/doc" />
</target>
<!-- Rats -->
<target name="rats">
<exec command="rats --html ${source} > ${out}/rats.html" />
</target>
<!-- Code Browser -->
<target name="phpcb">
<exec command="phpcb --log=${out} --output=${out}/browser --source=${source}" />
</target>
<!-- PHP Unit -->
<target name="phpunit">
<if>
<equals arg1="${test-bootstrap}" arg2="" />
<then>
<!-- Without bootstrap -->
<phpunit>
<formatter todir="${out}" type="xml" outfile="testsuite.xml"/>
<formatter todir="${out}" type="clover"/>
<batchtest>
<fileset dir="${test}">
<include name="**/*Test*.php"/>
</fileset>
</batchtest>
</phpunit>
</then>
<else>
<!-- With bootstrap -->
<phpunit bootstrap="${test-bootstrap}">
<formatter todir="${out}" type="xml" outfile="testsuite.xml"/>
<formatter todir="${out}" type="clover"/>
<batchtest>
<fileset dir="${test}">
<include name="**/*Test*.php"/>
</fileset>
</batchtest>
</phpunit>
</else>
</if>
</target>
<!-- ALL -->
<target name="audit" depends="pdepend,phpcpd,phpmd,phpdoc,rats,phpcb,phpunit" />
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment