Package and Class Name in the error/warning/info message

Help
2013-11-27
2014-03-25
  • Maymone Dahan
    Maymone Dahan
    2013-11-27

    I am using the log function of the com.puppycrawl.tools.checkstyle.api.AbstractFileSetCheck class.
    As a result, in the Problems tab folder of the Eclipse, I see the required message but it is preceeded by the full name of my package and the check class.
    Example:
    I wrote this code : log("Do not write too complex expressions")
    But in the Problems tab folder this line is displayed.
    cs.md.java.checks.ComplexExpression Do not write too complex expressions.
    I would like to suppress the package/class name in the message (appears in bold).
    How can I do it?
    Thanks

     
  • Un-ticking Window->Preferences->Checkstyle->Include rule name in violation message should do the trick.

    Sorry for the late reply...

    HTH, Lars

     
  • WOGNIN
    WOGNIN
    2014-03-21

    Thanks for the answer.
    I have the same problem but I don't want to remove also the module name.

    I only want to remove the full package prefix and use only module name as prefix of the log message.

    I've put my checkstyle-metadata.xml and "checkstyle-metadata.properties" files in the my checks packages following the custom tutorial

    but It can't solve the problem.

    Have I forget something ?
    Thanks a lot.
    WOGNIN

     
  • Please check out our sample project containing a customer check:
    https://sourceforge.net/p/eclipse-cs/git/ci/master/tree/net.sf.eclipsecs.sample/

    My first guess would be that you're missing the package.xml or something in the metadata.xml - or you're using the fully qualified check name in your checkstyle configuration file, instead of the shortened check name (which proper configuration of packages.xml would allow you to)...

    HTH,
    Lars

     
    Last edit: Lars Koedderitzsch 2014-03-24
  • WOGNIN
    WOGNIN
    2014-03-25

    Thanks Lars,

    Effectively, I hade a non closed tag in my checkstyle-metadata.xml file.
    As I started Eclipse with -console option, I got the OSGI concole but the error was not logged there, rather in the workspace log file that I didn't check.

    I correct it and everything works fine as expected.
    Thanks again for your response

    WOGNIN