#406 Which check produced what message?

Check (274)

It would be the most important feature for me figuring
out easily (with one look!) which message in the
Checkstyle report was produced by which check. It this
currently possible? In my HTML- as well as in the XML-
report these information are missing.

Motivation: nearly anyone out there using Checkstyle
will need to configure the rules file (e.g.
sun_checkx.xml) according to the "feedback" given in
the results report (i.e. switching of unwanted checks,
fine tuning others).


  • Oliver Burn

    Oliver Burn - 2006-01-13

    Logged In: YES

    Sounds reasonable to put the classname of the check.

  • Matthias Herp

    Matthias Herp - 2006-06-30

    Logged In: YES


    This feature is very important for me. Is this contained in
    the next release of Checkstyle? Will there be a new release
    in the next time?

    best regards,

  • Oliver Burn

    Oliver Burn - 2006-06-30

    Logged In: YES

    The XML file that is used to generate the report contains the class that generated the error. It is a matter of changing the XSL stylesheet to include the information in the report.

    Matthias, I suggest that you submit a patch with the suggested change you want, if you want it included in the next release.

  • Sebastian Dietrich

    Logged In: YES
    Originator: NO

    Here is the patch (on HEAD):
    -------- START-PATCH ---------

    Eclipse Workspace Patch 1.0

    P checkstyle

    Index: src/checkstyle/com/puppycrawl/tools/checkstyle/DefaultLogger.java

    RCS file: /cvsroot/checkstyle/checkstyle/src/checkstyle/com/puppycrawl/tools/checkstyle/DefaultLogger.java,v
    retrieving revision 1.22
    diff -u -r1.22 DefaultLogger.java
    --- src/checkstyle/com/puppycrawl/tools/checkstyle/DefaultLogger.java 31 Oct 2005 19:23:47 -0000 1.22
    +++ src/checkstyle/com/puppycrawl/tools/checkstyle/DefaultLogger.java 27 Jan 2007 13:27:39 -0000
    @@ -41,7 +41,7 @@
    implements AuditListener
    /* cushion for avoiding StringBuffer.expandCapacity /
    - private static final int BUFFER_CUSHION = 12;
    + private static final int BUFFER_CUSHION = 15;

     /** where to write info messages **/
     private final PrintWriter mInfoWriter;

    @@ -100,7 +100,7 @@
    final String message = aEvt.getMessage();

             // avoid StringBuffer.expandCapacity
    • final int bufLen = fileName.length() + message.length()
    • final int bufLen = fileName.length() + message.length() + aEvt.getSourceName().length()
      final StringBuffer sb = new StringBuffer(bufLen);

    @@ -112,7 +112,7 @@
    if (SeverityLevel.WARNING.equals(severityLevel)) {
    sb.append(": warning");
    - sb.append(": ").append(message);
    + sb.append(":[").append(aEvt.getSourceName()).append("] ").append(message);
    -------- END-PATCH ---------

  • Alexandre NOUVEL

    Logged In: YES
    Originator: NO

    Hi, this seems to be very close to the feature request # 1656024 (Custom messages for modules in configuration file), where some sort of patch was proposed.

  • Roman Ivanov

    Roman Ivanov - 2016-02-28
    • status: open --> closed
  • Roman Ivanov

    Roman Ivanov - 2016-02-28

    already implemented in latest releases.

    output is like:

    Starting audit...
    [ERROR] /var/tmp/TestClass.java:3:33: Parameter bar should be final. [FinalParameters]
    Audit done.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks