Re: id attribute of suppress element not working

"Oliver Burn" <[email protected]>
Newsgroups gmane.comp.java.audit.checkstyle.user
Message-ID <[email protected]>
I am using the "id" attribute successfully with Checkstyle 4.4.

How are you launching Checkstyle?

>From your error message it implies you are using an old version of
Checkstyle. This is a common problem for people using ANT who have put an
old version of Checkstyle in ${ANT_HOME}/lib.

On Feb 6, 2008 2:09 AM, Armstrong, Conrad <[email protected]> wrote:

> It seems like the "id" attribute of the "suppress" element in a
> SuppressionFilter file does not work in Checkstyle 4.4.
>
> I have a few GenericIllegalRegexp modules to check for certain method
> calls (printStackTrace(), System.exit(), etc.). Using a
> SuppressionFilter file, I want to suppress only certain ones for certain
> files, so I can't just say:
>    <suppress checks="GenericIllegalRegexp"
> files=".*\\batchprograms\\.*"/>
> because that will suppress all my GenericIllegalRegexp modules for those
> classes, which I don't want. The documentation says I can use an "id"
> attribute instead of "checks". So, I do this in my confiuguration:
>        <module name="GenericIllegalRegexp">
>            <property name="id" value="systemexit"/>
>            <property name="format" value="System\.exit"/>
>            <property name="message" value="Don''t use System.exit()
> unless in a batch program."/>
>        </module>
> and then use this in my SuppressionFilter file:
>    <suppress id="systemexit" files=".*\\batchprograms\\.*"/>
>
> But Checkstyle fails to parse the SupporessionFilter file, giving this
> message:
>
> Unable to create a Checker: cannot initialize module SuppressionFilter -
> Cannot set property 'file' in module SuppressionFilter to
> '/path_to_my_SuppressionsFilter.xml': unable to parse /
> path_to_my_SuppressionsFilter.xml - Attribute "checks" is required and
> must be specified for element type "suppress".
>
> I then noticed that the example SuppressionFilter file in the
> documentation  (http://checkstyle.sourceforge.net/config.html#filters)
> references http://www.puppycrawl.com/dtds/suppressions_1_0.dtd, which
> indeed says that "checks" attribute is required and doesn't mention an
> "id" attribute. So I guessed and found
> http://www.puppycrawl.com/dtds/suppressions_1_1.dtd, which does exist
> and declares "id" and "checks" to be optional. But if I specify the 1_1
> dtd in my SuppressionFilter xml file, the exact same error occurs.
>
> Is this because the knowledge of the 1.0 dtd is built into the
> checkstyle jar? Is there something I can do to get around this, or
> should I file a bug?
>
> Thanks,
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Checkstyle-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/checkstyle-user
>

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

_______________________________________________
Checkstyle-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/checkstyle-user
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.