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"

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


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?


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"/>


A scope package

means " package

or more public".



All Articles