Skip to content

SuppressionCommentFilter ignores messageFormat #76

romani opened this Issue Dec 8, 2013 · 2 comments

2 participants

Checkstyle member
romani commented Dec 8, 2013

SF issue: 520
Created: 2008-07-16
Creator: Chris Brigham

SuppressionCommentFilters ignore their messageFormats if their checkFormat regex patterns match the check that triggered the event.

Expected: messageFormats should apply as "AND" after match for checkFormat.
This bug also breaks the example present on so it have to resolved., without changing config, change in file "2" to "3". in case of "3" violation have to be present.

import java.util.concurrent.ExecutionException;

public class SyncError {

    // ThrowsCount OFF: 2
    protected void beginTransaction1() throws ExecutionException, DataFormatException {
        // ...
    // ThrowsCount OFF: 2



<?xml version="1.0"?>
          "-//Puppy Crawl//DTD Check Configuration 1.3//EN"

<module name="Checker">
    <module name="TreeWalker">
        <module name="FileContentsHolder"/>
        <module name="ThrowsCount"/>
        <module name="SuppressionCommentFilter">
            <property name="offCommentFormat" value="ThrowsCount OFF\: (\w+)"/>
            <property name="onCommentFormat" value="ThrowsCount ON\: (\w+)"/>
            <property name="checkFormat" value="ThrowsCount"/>
            <property name="messageFormat" value="^Throws count \w+ $1 .*$"/>


java -cp file:///home/rivanov/java/git-others/checkstyle/target/checkstyle-5.7-SNAPSHOT-all.jar -c my_checks.xml 
@romani romani closed this Dec 9, 2013
Splaktar commented Jun 7, 2014

Is this fix in 5.7?

Checkstyle member
romani commented Jun 8, 2014

Yes, it should work in 5.7.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.