Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#406 Which check produced what message?

release_4.2
open
nobody
Check (274)
3
2012-10-10
2006-01-11
Klaus
No

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).

Discussion

  • Oliver Burn
    Oliver Burn
    2006-01-13

    Logged In: YES
    user_id=218824

    Sounds reasonable to put the classname of the check.

     
  • Matthias Herp
    Matthias Herp
    2006-06-30

    Logged In: YES
    user_id=1211860

    Hello!

    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,
    Matthias

     
  • Oliver Burn
    Oliver Burn
    2006-06-30

    Logged In: YES
    user_id=218824

    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.

     
  • Logged In: YES
    user_id=457169
    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()
      + BUFFER_CUSHION;
      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);
    mErrorWriter.println(sb.toString());
    }
    }
    -------- END-PATCH ---------

     
  • Logged In: YES
    user_id=420021
    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.