0

How to run pmd analysis for multiple files? here if for suppose there are multiple .cls files , then how can I run analysis on multiple files in single time?

pmd.bat -d "$(Build.SourcesDirectory)\code\src\apexcode.cls" -f xml -R "$(Build.SourcesDirectory)\code\build\MyApexRule.xml" -reportfile pmd.xml

priya
  • 391
  • 1
  • 5
  • 24
  • I have tried giving -d "$(Build.SourcesDirectory)\code\src\apexcode.cls", "$(Build.SourcesDirectory)\code\src\apexcode1.cls"....but this is not feasible as there are more than 20 files and I want all the files to be analyzed..can someone tell me feasible solution? – priya Aug 18 '20 at 11:56
  • For instance, using a PowerShell task and `Get-ChildItem` (https://stackoverflow.com/questions/18847145/loop-through-files-in-a-directory-using-powershell) – Alexander Volok Aug 18 '20 at 14:05

1 Answers1

1

You can also specify complete directories and PMD will search for any files with "*.cls" extension:

pmd.bat -d "$(Build.SourcesDirectory)\code\src" -f xml ^
    -R "$(Build.SourcesDirectory)\code\build\MyApexRule.xml" ^
    -reportfile pmd.xml

See also https://pmd.github.io/latest/pmd_userdocs_cli_reference.html for the complete documentation of the CLI flags.

adangel
  • 1,816
  • 14
  • 17