Skip to content

[JAVA] Rule Exclude is not working in PMD 6.17.0 and Gradle 5.6 #3028

Answered by jsotuyod
sudharmohan asked this question in Q&A
Discussion options

You must be logged in to vote

@sudharmohan firstly, your ruleset is incorrect. The root element of the XML should be <ruleset> and it must include the XML Schema.

For instance:

<?xml version="1.0"?>
<ruleset name="Custom Rules"
    xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 https://pmd.sourceforge.io/ruleset_2_0_0.xsd">

    <rule ref="category/java/errorprone.xml">
        <exclude name="DataflowAnomalyAnalysis"/>
    </rule>
</ruleset>

Please, refer to the documentation on writing your own ruleset:

https://pmd.github.io/pmd-6.17.0/pmd_userdocs_making_rulesets.html

Also of note, Gradle incl…

Replies: 2 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #1991 on January 15, 2021 09:20.