-
Hello, I have read the documentation from: https://checkstyle.sourceforge.io/config_filters.html#SuppressionFilter and https://checkstyle.sourceforge.io/cmdline.html and https://www.w3schools.com/xml/xpath_axes.asp. I am using Java 17 and Checkstyle 10.9.3 (downloaded from https://github.com/checkstyle/checkstyle/releases/tag/checkstyle-10.9.3). docs/mvToFpa% javac PlantView.java docs/mvToFpa% cat PlantView.java
docs/mvToFpa% cat xpath-suppressions.xml
docs/mvToFpa% cat sun_checks10.xml
docs/mvToFpa% /opt/java/jdk-17.0.6/bin/java -jar /opt/checkstyle-10.9.3/checkstyle-10.9.3-all.jar -c sun_checks10.xml -o PlantViewChecks.txt PlantView.java docs/mvToFpa% cat PlantViewChecks.txt
Expected: |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
if you need to suppress all violations in code block that is generated it might be easiler to use this filter: hmm your xpath looks like matching:
problem is that LineLength is not child of Treewalker so filters of tree walker are not applicable. Use https://checkstyle.org/config_filters.html#SuppressionCommentFilter and make |
Beta Was this translation helpful? Give feedback.
It is good. We have bunch of way to do suppression, choose what you like most or suites you.
Instead of "all" you can specify name of Check to be explicit.
You can try to use this Check https://github.com/sevntu-checkstyle/sevntu.checkstyle/blob/master/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/sizes/LineLengthExtendedCheck.java it is AST based.