[SalesForce] PMD Apex static code analyser on Mac

I have used PMD before on Windows. I found this video very helpful for advising me of the correct PMD command to input for Windows.

I want to use PMD on Mac. I have installed PMD (I know it's installed because by inputting 'pmd pmd -help', I get info) but I am not able to give the correct PMD terminal command.

I used the format below on Windows and it worked correctly:

pmd –d “[Your path to the folder, for example pmdCodeAnalysis]” – f html –R “[Your path to pmdCodeAnalysis\Rules\ApexRules.xml” –reportfile “..\PMDOutput.html”

but inputting what I perceive to be the Mac equivalent doesn't work.

pmd pmd -ls /Users/andyhitchings/Desktop/pmd/Code -f html -R /Users/andyhitchings/Desktop/pmd/Rules/ApexRules.xml -reportfile “../pmdOutput.html”

Can anyone advise what the correct command should be to get PMD to work on Mac?

Thank you,

Best Answer

Many fragments of you command look wrong when I compare to what I normally use and what is described here in the docs:https://pmd.github.io/pmd-6.3.0/pmd_userdocs_getting_started.html

E.g. there is no -ls parameter. You have to use -d as in Windows. I highly recommend to start with a simple command where no reports are written to boil down the problem to a specific fragment.

$ ./bin/run.sh pmd -d ../../../src/classes/ -f html -R rulesets/apex/basic.xml -language apex
Related Topic