Checkstyle does not work with SuppressionCommentFilter

Below is my code around the validation style - but it doesn't seem to suppress audits between lines of suppression comments. I also tried with inline comment // instead of / * * /

Please, help. I tried many ways - permutations / combinations of those who fixed it. Thanks. Please let me know if you need more information.

/* CHECKSTYLE:OFF */ private abc createTimerChart(String title, String yAxisLabel, XYDataset dataset) { final abc chart = ChartFactory.createXYLineChart(title, // chart title "Time Elapsed (" + pollUnit.toString() + ")", // x axis label yAxisLabel, // y axis label dataset, // data PlotOrientation.VERTICAL, true, // include legend true, // tooltips false // urls ); /* CHECKSTYLE:ON */ 

CONFIG.XML reads:

  <module name="FileContentsHolder"> <module name="SuppressionCommentFilter"> <property name="checkFormat" value="IndentationCheck"/> </module> </module> 

AFTER MOVING SuppressionCommentFilter UNDER CHECKER:

 <module name="Checker"> <!-- setting the default severity to warning --> <property name="severity" value="warning" /> <module name="SuppressionCommentFilter"> <property name="checkFormat" value="Indentation"/> </module> <!-- No TAB characters in the source code --> <module name="FileTabCharacter" /> <!-- List of files to ignore . --> <!-- TODO Add all auto-generated files to this file --> <module name="SuppressionFilter"> <property name="file" value="checkstyle/kepler-checkstyle-suppressions.xml"/> </module> <module name="TreeWalker"> .. .. .. 
+4
source share
1 answer

The indentation check is called Indentation . It will work if you change the checkFormat property to Indentation :

 <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.3//EN" "http://www.puppycrawl.com/dtds/configuration_1_3.dtd"> <module name="Checker"> <property name="severity" value="warning" /> <module name="TreeWalker"> <module name="JavadocType" /> <module name="Indentation" /> <module name="FileContentsHolder"/> </module> <module name="SuppressionCommentFilter"> <property name="checkFormat" value="Indentation" /> </module> </module> 

Or, more generally, I would recommend not setting the checkFormat property at all, which makes a suppression comment suppresses all warnings for this block of code.

+2
source

Source: https://habr.com/ru/post/1445582/


All Articles