[apex] Apex code analysis #3029
-
Hi, Currently I am running PMD analysis though command line. Is there a way to segregate issues like Critical, Bug, Warning and Bloker? I am exporting the analysis on a html file. pmd.bat -d "path" -f html -R "path\Apex Rules.xml" -reportfile "path\result.html". Can we integrate PMD with any other tool like Sonar or codeacy to get the details on the UI? Thanks, |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
It's just my guessing but I think there isn't. There's always an option to write a script to read the output and do what you want, though.
You can check for tools that support the outputs that PMD produces. I don't know other tools, but I'm pretty sure you can integrate it with GitLab. GitLab can parse the JUnit result format. |
Beta Was this translation helpful? Give feedback.
-
Please watch my free Pluralsight course on how to integrate using Codacy: https://www.pluralsight.com/courses/play-by-play-automated-code-analysis-in-salesforce. Sonar currently doesn’t support apex to the full extend. I cannot recommend it. |
Beta Was this translation helpful? Give feedback.
-
You can use the priority of the rules. You of course need to decide on your own, which rule you consider yourself as Blocker, Critical, Warning, Bug. Follow the documentation here: https://pmd.github.io/latest/pmd_userdocs_configuring_rules.html#message-and-priority-overriding in order to configure the priority for your rules. Then you might want to try out different report formats: https://pmd.github.io/latest/pmd_userdocs_cli_reference.html#available-report-formats You could also just use xml + xslt to render a report. There are many integrations of PMD into various tools, see https://pmd.github.io/latest/pmd_userdocs_tools_ci.html and https://pmd.github.io/latest/pmd_userdocs_tools.html |
Beta Was this translation helpful? Give feedback.
-
Thanks @adangel . One final question, can we add priority details in html report? | File | Line | Problem-- | -- | -- | -- Thanks, |
Beta Was this translation helpful? Give feedback.
Please watch my free Pluralsight course on how to integrate using Codacy: https://www.pluralsight.com/courses/play-by-play-automated-code-analysis-in-salesforce. Sonar currently doesn’t support apex to the full extend. I cannot recommend it.