Exclude certain directories and files in pdepend, phpmd, phpcpd, phpcs, phpdoc, phploc Exclude certain directories and files in pdepend, phpmd, phpcpd, phpcs, phpdoc, phploc jenkins jenkins

Exclude certain directories and files in pdepend, phpmd, phpcpd, phpcs, phpdoc, phploc


For every target you can use fileset property or add exclude directories manually

<target name="phploc" description="Measure project size using PHPLOC">    <exec executable="phploc">        <arg value="--log-csv"/>        <arg value="${basedir}/build/logs/phploc.csv"/>        <arg value="--exclude"/>        <arg value="${src}/api/"/>        <arg value="--exclude"/>        <arg value="${src}/external/"/>        <arg path="${src}"/>    </exec></target><target name="pdepend"        description="Calculate software metrics using PHP_Depend">    <exec executable="pdepend">        <arg value="--jdepend-xml=${basedir}/build/logs/jdepend.xml"/>        <arg value="--jdepend-chart=${basedir}/build/pdepend/dependencies.svg"/>        <arg value="--overview-pyramid=${basedir}/build/pdepend/overview-pyramid.svg"/>        <arg value="--ignore=/dir/one/,/dir/two/"/>        <arg path="${src}"/>    </exec></target><target name="phpcpd" description="Find duplicate code using PHPCPD">    <exec executable="phpcpd">        <arg value="--log-pmd"/>        <arg value="${basedir}/build/logs/pmd-cpd.xml"/>        <arg value="--exclude"/>        <arg value="${src}/api/"/>        <arg value="--exclude"/>        <arg value="${src}/exclude/"/><arg path="${src}"/>    </exec></target>

Hope my answer will be helpful for someone.


In my project there are certain directories and certain php files which are very large in size due to which my build is failing and I want to exclude them in my build.xml

There are certain files which are not php but .dat so should I mention these files in the --ignore too?

What I'm doing in this case is to make a copy of the needed files, and work from there. Either copy the whole directory and delete certain files, or copy over just the needed files. In the former case, the find program would do:

cp /my/large/project /tmp/workfind /tmp/work -name "*.dat" -deletefind /tmp/work -size 500k -delete

In the latter, I'm using ant's <copy> task:

<copy todir="${dir.source.our}" includeEmptyDirs="true">   <fileset dir="${dir.source}/ext" includes="${glob.source.our}"/></copy>

PHP Fatal error: Allowed memory size of 262144000 bytes exhausted

You'll have to increase PHP memory size in php.ini.Search for memory_limit and set the value to something like 512 MB, e.g.

memory_limit = 512M