From d4d2b130d24eca30c3eec0ad3b14eb2df0953c5c Mon Sep 17 00:00:00 2001 From: alexkravin Date: Fri, 13 Feb 2015 22:18:57 +0400 Subject: [PATCH] Suppression Comment Filter, extended docs for messageFormat option, issue #123 --- src/xdocs/config.xml | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/src/xdocs/config.xml b/src/xdocs/config.xml index 474e58371..422e38a12 100644 --- a/src/xdocs/config.xml +++ b/src/xdocs/config.xml @@ -1127,6 +1127,47 @@ private String [] strArray; private int array1 []; // CHECKSTYLE_ON: ALMOST_ALL +

+ To configure a filter to suppress Check's violation message which matches + specified message in messageFormat (so suppression will be not only by + Check's name, but by message text additionally, as the same Check could report + different by message format violations) between a comment + containing stop and comment containing resume: +

+ + +<module name="SuppressionCommentFilter"> + <property name="offCommentFormat" value="stop"/> + <property name="onCommentFormat" value="resume"/> + <property name="checkFormat" value="IllegalTypeCheck"/> + <property name="messageFormat" value="^Declaring variables, return values or parameters of type 'GregorianCalendar' is not allowed.$"/> +</module> + + +

+ Code before filter above is applied with Check's audit events: +

+ + +... +GregorianCalendar calendar; // Warning here: Declaring variables, return values or parameters of type 'GregorianCalendar' is not allowed. +HashSet hashSet; // Warning here: Declaring variables, return values or parameters of type 'HashSet' is not allowed. +... + + +

+ Code after filter is applied: +

+ + +... +//stop +GregorianCalendar calendar; // No warning here as it is suppressed by filter. +HashSet hashSet; // Warning here: Declaring variables, return values or parameters of type 'HashSet' is not allowed. +//resume +... + +