title: Exclude certain directories and files in pdepend, phpmd, phpcpd, phpcs, phpdoc, phploc
body: <p>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 <code>build.xml</code></p>
  
  <p><strong>Ques1-</strong> Do I have to write the <code>--ignore="path/filename"</code> for every php file in the project?</p>
  
  <p><strong>Ques2-</strong> There are certain files which are not php but <code>.dat</code> so should I mention these files in the <code>--ignore</code> too?</p>
  
  <p><strong>Ques3-</strong> Can I specify to exclude files based on their size such that I exclude all the files larger than 500kb? </p>
  
  <p>My current xml file looks like this:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  
  &lt;project name="name-of-project" default="build" basedir="."&gt;
    &lt;property name="root.dir" value="${basedir}/.."/&gt;
    &lt;property name="source" value="${root.dir}"/&gt;
  
   &lt;target name="clean"
           description="Clean up and create artifact directories"&gt;
    &lt;delete dir="${basedir}/build/api"/&gt;
    &lt;delete dir="${basedir}/build/code-browser"/&gt;
    &lt;delete dir="${basedir}/build/coverage"/&gt;
    &lt;delete dir="${basedir}/build/logs"/&gt;
    &lt;delete dir="${basedir}/build/pdepend"/&gt;
  
    &lt;mkdir dir="${basedir}/build/api"/&gt;
    &lt;mkdir dir="${basedir}/build/code-browser"/&gt;
    &lt;mkdir dir="${basedir}/build/coverage"/&gt;
    &lt;mkdir dir="${basedir}/build/logs"/&gt;
    &lt;mkdir dir="${basedir}/build/pdepend"/&gt;
   &lt;/target&gt;
  
   &lt;target name="phpunit"
           description="Run unit tests using PHPUnit and generates junit.xml and clover.xml"&gt;
    &lt;exec executable="phpunit" failonerror="true"&gt;
      &lt;env key="DOCUMENT_ROOT" value="${source}/api"/&gt;
      &lt;env key="MODEL_ROOT" value="${source}/model"/&gt;
    &lt;/exec&gt;
   &lt;/target&gt;
  
   &lt;target name="parallelTasks"
           description="Run the pdepend, phpmd, phpcpd, phpcs, phpdoc and phploc tasks in parallel using a maximum of 2 threads."&gt;
    &lt;parallel threadCount="2"&gt;
     &lt;sequential&gt;
      &lt;antcall target="pdepend"/&gt;
      &lt;antcall target="phpmd"/&gt;
     &lt;/sequential&gt;
     &lt;antcall target="phpcpd"/&gt;
     &lt;antcall target="phpcs"/&gt;
     &lt;antcall target="phpdoc"/&gt;
     &lt;antcall target="phploc"/&gt;
    &lt;/parallel&gt;
   &lt;/target&gt;
  
   &lt;target name="pdepend"
           description="Generate jdepend.xml and software metrics charts using PHP_Depend"&gt;
    &lt;exec executable="pdepend"&gt;
     &lt;arg value="--jdepend-xml=${basedir}/build/logs/jdepend.xml" /&gt;
     &lt;arg value="--jdepend-chart=${basedir}/build/pdepend/dependencies.svg" /&gt;
     &lt;arg value="--overview-pyramid=${basedir}/build/pdepend/overview-pyramid.svg" /&gt;
     &lt;arg value="--ignore=${source}/web" /&gt;
     &lt;arg path="${source}" /&gt;
    &lt;/exec&gt;
   &lt;/target&gt;
  
   &lt;target name="phpmd"
           description="Generate pmd.xml using PHPMD"&gt;
    &lt;exec executable="phpmd"&gt;
     &lt;arg path="${source}" /&gt;
     &lt;arg value="xml" /&gt;
     &lt;arg value="${basedir}/build/phpmd.xml" /&gt;
     &lt;arg value="--reportfile" /&gt;
     &lt;arg value="${basedir}/build/logs/pmd.xml" /&gt;
     &lt;arg value="--exclude" /&gt;
     &lt;arg value="${basedir}/web" /&gt;
    &lt;/exec&gt;
   &lt;/target&gt;
  
   &lt;target name="phpcpd"
           description="Generate pmd-cpd.xml using PHPCPD"&gt;
    &lt;exec executable="phpcpd"&gt;
     &lt;arg value="--log-pmd" /&gt;
     &lt;arg value="${basedir}/build/logs/pmd-cpd.xml" /&gt;
     &lt;arg value="--exclude" /&gt;
     &lt;arg value="${basedir}/web" /&gt;
     &lt;arg path="${source}" /&gt;
    &lt;/exec&gt;
   &lt;/target&gt;
  
   &lt;target name="phploc"
           description="Generate phploc.csv"&gt;
    &lt;exec executable="phploc"&gt;
     &lt;arg value="--log-csv" /&gt;
     &lt;arg value="${basedir}/build/logs/phploc.csv" /&gt;
     &lt;arg value="--exclude" /&gt;
     &lt;arg value="${basedir}/web" /&gt;
     &lt;arg path="${source}" /&gt;
    &lt;/exec&gt;
   &lt;/target&gt;
  
   &lt;target name="phpcs"
           description="Generate checkstyle.xml using PHP_CodeSniffer"&gt;
    &lt;exec executable="phpcs" output="/dev/null"&gt;
     &lt;arg value="--report=checkstyle" /&gt;
     &lt;arg value="--report-file=${basedir}/build/logs/checkstyle.xml" /&gt;
     &lt;arg value="--standard=${basedir}/build/phpcs.xml" /&gt;
     &lt;arg value="--ignore=${source}/web" /&gt; 
     &lt;arg path="${source}" /&gt;
    &lt;/exec&gt;
   &lt;/target&gt;
  
   &lt;target name="phpdoc"
           description="Generate API documentation using PHPDocumentor"&gt;
    &lt;exec executable="phpdoc"&gt;
     &lt;arg value="--directory" /&gt;
     &lt;arg path="${source}" /&gt;
     &lt;arg value="--target" /&gt;
     &lt;arg path="${basedir}/build/api" /&gt;
     &lt;arg value="--ignore" /&gt;
     &lt;arg path="${basedir}/web" /&gt;
    &lt;/exec&gt;
   &lt;/target&gt;
  
   &lt;target name="phpcb"
           description="Aggregate tool output with PHP_CodeBrowser"&gt;
    &lt;exec executable="phpcb"&gt;
     &lt;arg value="--log" /&gt;
     &lt;arg path="${basedir}/build/logs" /&gt;
     &lt;arg value="--source" /&gt;
     &lt;arg path="${source}" /&gt;
     &lt;arg value="--ignore" /&gt;
     &lt;arg path="${basedir}/web" /&gt;
     &lt;arg value="--output" /&gt;
     &lt;arg path="${basedir}/build/code-browser" /&gt; 
    &lt;/exec&gt;
   &lt;/target&gt;
  
   &lt;target name="build" depends="clean,parallelTasks,phpunit,phpcb"/&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>And I am getting errors like these</p>
  
  <pre><code>pdepend:
       [exec] PHP_Depend 0.10.5 by Manuel Pichler
  
       [exec] Parsing source files:
       [exec] phpcpd 1.3.2 by Sebastian Bergmann.
  
       [exec] PHP Fatal error:  Allowed memory size of 262144000 bytes exhausted (tried to allocate 71 bytes) in /usr/share/pear/PHPCPD/Detector.php on line 115
       [exec] PHP Stack trace:
       [exec] PHP   1. {main}() /usr/bin/phpcpd:0
       [exec] PHP   2. PHPCPD_TextUI_Command::main() /usr/bin/phpcpd:51
       [exec] PHP   3. PHPCPD_Detector-&gt;copyPasteDetection() /usr/share/pear/PHPCPD/TextUI/Command.php:216
       [exec] PHP   4. token_get_all() /usr/share/pear/PHPCPD/Detector.php:115
       [exec] Result: 255
  
  phploc:
       [exec] phploc 1.6.1 by Sebastian Bergmann.
  
       [exec] PHP Fatal error:  Allowed memory size of 262144000 bytes exhausted (tried to allocate 71 bytes) in /usr/share/pear/PHPLOC/Analyser.php on line 279
       [exec] PHP Stack trace:
       [exec] PHP   1. {main}() /usr/bin/phploc:0
       [exec] PHP   2. PHPLOC_TextUI_Command::main() /usr/bin/phploc:51
       [exec] PHP   3. PHPLOC_Analyser-&gt;countFiles() /usr/share/pear/PHPLOC/TextUI/Command.php:215
       [exec] PHP   4. PHPLOC_Analyser-&gt;countFile() /usr/share/pear/PHPLOC/Analyser.php:170
       [exec] PHP   5. token_get_all() /usr/share/pear/PHPLOC/Analyser.php:279
       [exec] Result: 255
  </code></pre>
  
  <p>What should I do to solve it? If I manually remove the large files from the directory then the build just passes but I want the build to run automatically checking out the code base from svn which will have these large files.</p>
  
  <p><strong>Ques4-</strong> Can I configure my checkout in such a way that these files dont get checked out?</p>