Looking for some help, trying to find a way to make Maven antrun plugin interate over ALL files in my php module, executing php -l (lint check) on them all.
If I use failonerror property set to true, it will fail as soon as it hits one bad file. If I use the resultproperty with a fileset (current implementation) then it parses all files, but the return code is from the first execution of php lint, so it only fails if the first file is bad.
<apply executable="php" failonerror="false" resultproperty="myresult">
<arg value="-l" />
<fileset dir="${basedir}">
<include name="**/*.php" />
</fileset>
</apply>
I've tried to use a different method of calling php -l, using find (from http://kamisama.me/2012/07/02/faster-php-lint/ ), but it still seems to quit on the first broken file.
<target name="lint" description="Perform syntax check of sourcecode files">
<exec executable="bash" failonerror="true">
<arg value="-c" />
<arg value="find -L ${basedir}/src -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l" />
</exec>
</target>
Could use some help with antrun syntax or a method which will check all files, but exit at the end IF one or more files fail the lint check.
I've also considered githooks, but am not in charge of that system.
Any tips appreciated!