1 /*xml 2 <module name="Checker"> 3 <module name="TreeWalker"> 4 <module name="TrailingComment"/> 5 <module name="SuppressionXpathSingleFilter"> 6 <property name="checks" value="TrailingCommentCheck"/> 7 <property name="query" value="//SINGLE_LINE_COMMENT 8 [./COMMENT_CONTENT[starts-with(@text, ' NOPMD')]]"/> 9 <property name="query" value="//SINGLE_LINE_COMMENT 10 [./COMMENT_CONTENT[starts-with(@text, ' SUPPRESS CHECKSTYLE')]]"/> 11 <property name="query" value="//SINGLE_LINE_COMMENT 12 [./COMMENT_CONTENT[starts-with(@text, ' NOSONAR')]]"/> 13 </module> 14 </module> 15 </module> 16 */ 17 18 package com.puppycrawl.tools.checkstyle.checks.trailingcomment; 19 20 // xdoc section -- start 21 public class Example4 { 22 int a; // SUPPRESS CHECKSTYLE - OK, comment starts with " SUPPRESS CHECKSTYLE" 23 int b; // NOPMD - OK, comment starts with " NOPMD" 24 int c; // NOSONAR - OK, comment starts with " NOSONAR" 25 int d; // violation, not suppressed 26 } 27 // xdoc section -- end