Prevent checkstyle errors for PRIVATE member variables in suppressions.xml?

In a project I am working on, checkstyle fails with "Missing Javadoc comment" due to missing Javadoc comment on private variable . This seems like overkill behavior to me, and I would like to suppress the error for private members using a suppression XML file.

The following file succeeds in suppressing all Javadoc validation errors for variables:

<?xml version="1.0"?>
<!DOCTYPE suppressions PUBLIC
    "-//Puppy Crawl//DTD Suppressions 1.1//EN"
    "http://www.puppycrawl.com/dtds/suppressions_1_1.dtd">

<suppressions>
    <suppress files=".*" checks="JavadocVariable"/>
</suppressions>

      

However, this is not very useful behavior, because I still believe that the mistake in protecting protected and public members was a mistake.

How do I change the attribute checks

to give me the limited suppression I need?

+3


source to share


1 answer


Afaik, this cannot be achieved with suppression unless you want to comment out all private fields. Instead, tweak the JavadocVariable validation so that it doesn't cover the personal scope:

<module name="JavadocVariable">
   <property name="scope" value="package"/>
</module>

      



A scope package

means " package

or more public".

+1


source







All Articles