-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Description
originally was reports as #102
Link to patch: https://sourceforge.net/p/checkstyle/patches/_discuss/thread/1d416f58/b6be/attachment/mychanges.patch
Explanation from patch author:
http://juliangamble.com/blog/2012/03/10/running-checkstyle-at-full-throttle-on-a-legacy-codebase/
Few thoughts about reasons and usage of this patch:
http://roman-ivanov.blogspot.com/2014/01/checkstyle-suppress-file-generator.html
We do not need suppression base on line and column, as it very problematic in maintenance, as any changes in code result in bunch of violations and it hard to keep in mind that it is only due to fact that existing suppressions does not work.
We already have suppression generation based on xpath - https://checkstyle.sourceforge.io/cmdline.html#Generating_Suppressions_XML so we need different model of suppression.
https://checkstyle.sourceforge.io/filters/suppressionfilter.html#SuppressionFilter will be target filter.
All we need to do is to suppress certain Check (id or name) on whole file (not xpath). It will be simple model of suppression, just on whole file. It is not ideal but better than nothing.
Example of generated result:
<?xml version="1.0"?>
<!DOCTYPE suppressions PUBLIC
"-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN"
"https://checkstyle.org/dtds/suppressions_1_2.dtd">
<suppressions>
<suppress checks="JavadocStyleCheck" files="AbstractComplexityCheck.java" />
<suppress checks="MagicNumberCheck" files="JavadocStyleCheck.java" />
</suppressions>