custom messages

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

custom messages

burton
Hi, I'm trying to create a custom message for a check. The docs give an
example:

http://checkstyle.sourceforge.net/config.html#Custom%20messages

<module name="MemberName">
     <property name="format" value="^m[a-zA-Z0-9]*$"/>
     <message key="name.invalidPattern"
              value="Member ''{0}'' must start with a lowercase ''m''
(checked pattern ''{1}'')."
              />
</module>

       

When I incorporate this example verbatim into a configuration file,
Checkstyle claims that there is an error in the configuration file:

java -jar checkstyle-all-5.1.jar -c ./test_checks.xml Test.java
Error loading configuration file
com.puppycrawl.tools.checkstyle.api.CheckstyleException: unable to read
./test_checks.xml - unable to parse configuration stream - Element type
"message" must be declared.:12:15

... followed by more error output.

Anyone know what (if anything) is wrong with the example?

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Checkstyle-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/checkstyle-user
Reply | Threaded
Open this post in threaded view
|

Re: custom messages

Oliver Burn
I best you have not updated the DTD reference in your configuration file. It should reference version 1.3 of the configuration DTD.

The start of the file should look something like:

<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
          "-//Puppy Crawl//DTD Check Configuration 1.3//EN"
          "http://www.puppycrawl.com/dtds/configuration_1_3.dtd">

Regards,
Oliver

On Sat, Sep 11, 2010 at 06:31, burton <[hidden email]> wrote:
Hi, I'm trying to create a custom message for a check. The docs give an
example:

http://checkstyle.sourceforge.net/config.html#Custom%20messages

<module name="MemberName">
    <property name="format" value="^m[a-zA-Z0-9]*$"/>
    <message key="name.invalidPattern"
             value="Member ''{0}'' must start with a lowercase ''m''
(checked pattern ''{1}'')."
             />
</module>



When I incorporate this example verbatim into a configuration file,
Checkstyle claims that there is an error in the configuration file:

java -jar checkstyle-all-5.1.jar -c ./test_checks.xml Test.java
Error loading configuration file
com.puppycrawl.tools.checkstyle.api.CheckstyleException: unable to read
./test_checks.xml - unable to parse configuration stream - Element type
"message" must be declared.:12:15

... followed by more error output.

Anyone know what (if anything) is wrong with the example?

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Checkstyle-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/checkstyle-user


------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Checkstyle-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/checkstyle-user