Menu

#394 Checkstyle Plugin does not recognize suppressions properly

6.9.0
closed
nobody
None
1
2015-10-03
2015-09-27
hkais
No

I have am using eclipse-cs for a long time already, and I really love your great piece of work.
So many thanks for such a great tool.

Right now I am facing the issue, that checkstyle is not working anymore as soon as I integrate a suppression.

<module>
    <module>
      ...
    </module>
    <module name="SuppressionFilter">
        <property name="file" value="${config_loc}/suppressions.xml" />
    </module>
</module>

Now if I clear all checkstyle markings, and redo a "check code with checkstyle" on the whole project, eclipse takes some time but it does not do anything. Nor do I get a error on eclipse .log file.
If I remove the SuppressionFilter everything works great, except my suppressions are missing.

This is really odd, especially sometime we get checkstyle working by just removing all lines from suppressions.xml and readding them.

Is there a way to get more tracing from eclipse-cs?

Maybe it is related to #344 https://sourceforge.net/p/eclipse-cs/bugs/344/ ?

Discussion

  • Lars Koedderitzsch

    Hi and thanks!
    Is it possible for you to attach your checkstyle config + suppression file?

     
  • hkais

    hkais - 2015-09-27

    Hello Lars,
    big thanks for your prompt reply.
    I have sent you a private message with the files
    best wishes

     
  • hkais

    hkais - 2015-09-29

    Hello Lars,
    did you had a chance to review the xmls?
    I can provide you more debugging info, but can you point me how to increase the debug level for the plugin in eclipse?
    best wishes

     
  • Lars Koedderitzsch

    Ok, I had a look and tracked your problems down to those suppression rules:

    <suppress checks="[a-zA-Z0-9]*" files=".*\.[uUcClLsS]" />
    <suppress checks="[a-zA-Z0-9]*" files=".*\.[pPdDfF]" />
    

    It appears that by coincidence (e.g. a certain package path) they match all relevant file, hence suppressing everything.

    On top they don't even do what you intented, they should probably be something like:

    .*\.(ucls|UCLS)$
    .*\.(pdf|PDF)$
    

    Hope this helps,
    Lars

     

    Last edit: Lars Koedderitzsch 2015-09-29
  • hkais

    hkais - 2015-09-29

    big thanks!
    It was working for about 2 years till the update?!?

    Maybe a stupid question, but how have you found the issues?

     
  • Lars Koedderitzsch

    The suppression filter is part of the Checkstyle core library (http://checkstyle.sf.net), it is possible that some change in recent Checkstyle versions triggered a change in behaviour.

    I found the issue by trying the config on different projects - some would reproduce the behaviour, some not.
    On a project having the issue I methodically commented all the suspicious suppression rules (the regex ones) until the culprit was found.

    The regular expression ".*.[uUcClLsS]" matches any occurrence of ".u" or "".c" etc. in the file path - for instance a project named "whatever.core" would trigger the issue.

    Btw. there is no debug logging in the eclipse-cs plugin or Checkstyle core...

     
  • Lars Koedderitzsch

    • status: open --> closed
     

Log in to post a comment.