How to disable a specific checkstyle rule for a specific line of code?

Yes, I saw this question:

How to disable a specific checkstyle rule for a specific line of code?

But I can’t comment, and I wanted to ask if it is possible to do what the OP asked:

How to disable one specific rule for a line of code

I also saw this: Is there a way to make Checkstyle ignore a specific warning in the source code?

I think the answer to my question is to use SuppressWithNearbyCommentFilter

I just don't understand how my comments look in java.

Let's say I have the following code:

public class MyDataContainer {
  /** the name */
  public String name;
}

and I want to get rid of the warning "Visibility modifier" and nothing more .

What do I need to enable (using the eclipse--cs.sf.net plugin)?

And what should my comments look like?

Suppresion

//CHECKSTYLE:OFF
//CHECKSTYLE:ON

.

+5
1

, :

SuppressWithNearbyCommentFilter :

<module name="SuppressWithNearbyCommentFilter">
   <property name="commentFormat" value="CHECKSTYLE DISABLE ([\w\|]+) FOR (-?\d+) LINES"/>
   <property name="checkFormat" value="$1"/>
   <property name="influenceFormat" value="$2"/>
</module>

, , :

// CHECKSTYLE DISABLE <WarningName> FOR <# of lines> LINES

// CHECKSTYLE DISABLE MagicNumber FOR 2 LINES

( , ).

+11

All Articles