Skip to content

[Java] Execute PMD Custom RuleSet using PMD command line #3053

Answered by adangel
Neha-Dhonde asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @Neha-Dhonde ,
this should work with the following command line, given that your ruleset file is called "custom-rules.xml":

./bin/run.sh pmd -R custom-rules.xml -d src-folder/ -f text

On the pmd documation page you can see a more exhaustive documentation about the various flags and possible output formats.

But maybe you need help in putting your xpath expression developed with the Designer into a ruleset file? This part is indeed missing in the XPath Rule documentatio.
Your ruleset "custom-rules.xml" could look like this:

<?xml version="1.0"?>

<ruleset name="Custom Rules"
    xmlns="http://pmd.sourceforge.net/ruleset/3.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by adangel
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #589 on January 15, 2021 09:44.