#472 filter annotation

Future
closed
nobody
5
2016-02-27
2007-11-29
domak
No

Is there a plan to create annotations for filtering checkstyle rules, something like java "@suppressWarning" ?

It would be a great improvment on filter in xml file.

Thanks

Discussion

  • Oliver Burn

    Oliver Burn - 2007-12-03

    Logged In: YES
    user_id=218824
    Originator: NO

    On one hand I can see the advantage to this. On the other, I question the wisdom of putting Checkstyle dependencies in the actual Source code base.

     
  • domak

    domak - 2007-12-03

    Logged In: YES
    user_id=1936515
    Originator: YES

    Maybe you can re-use @SuppressWarnings of java.lang with a checkstyle prefix something like @SuppressWarnings("checkstyle-ThrowsCount") or @SuppressWarnings("checkstyle.ThrowsCount") ?

     
  • Stephen Kestle

    Stephen Kestle - 2008-07-28

    Logged In: YES
    user_id=1319178
    Originator: NO

    I have just come across the following: comment in our code
    /
    * WARNING: This method is deliberately not final so that new digits can be easily added
    * by a subclass. Do not make this method final.

    /
    If we could ignore DesignForExtension with a reason at a method specific level, it would be possible to error if final was added to the method.

    This would be reverse-checkstyle in a way, but checkstyle is all about making sure the code does not have potential problems.

    The compiler would not pick this up early, as it is an API, and is not extended [very often].

    On another note, having it annotated per method avoids the
    //Checkstyle:OFF:DesignForExtension
    // **** All methods below this should be able to be extended

    problem, where someone accidentally adds a method to the end of the class...

    Please make checkstyle more robust with explicitly declared exceptions. Using SuppressWarnings seems reasonable and correct, and will not introduce any code dependencies.

     
  • Roman Ivanov

    Roman Ivanov - 2016-02-27
    • status: open --> closed
    • Group: --> Future
     

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

Sign up for the SourceForge newsletter:





No, thanks