Package com.puppycrawl.tools.checkstyle
Class SuppressionsStringPrinter
- java.lang.Object
-
- com.puppycrawl.tools.checkstyle.SuppressionsStringPrinter
-
public final class SuppressionsStringPrinter extends Object
Class for constructing xpath queries to suppress nodes with specified line and column number.
-
-
Field Summary
Fields Modifier and Type Field Description private static String
LINE_SEPARATOR
OS specific line separator.private static Pattern
VALID_SUPPRESSION_LINE_COLUMN_NUMBER_REGEX
Line and column number config value pattern.
-
Constructor Summary
Constructors Modifier Constructor Description private
SuppressionsStringPrinter()
Prevent instances.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static String
generate(FileText fileText, DetailAST detailAST, int lineNumber, int columnNumber, int tabWidth)
CreatesXpathQueryGenerator
instance and generates suppressions.static String
printSuppressions(File file, String suppressionLineColumnNumber, int tabWidth)
Prints generated suppressions.
-
-
-
Field Detail
-
VALID_SUPPRESSION_LINE_COLUMN_NUMBER_REGEX
private static final Pattern VALID_SUPPRESSION_LINE_COLUMN_NUMBER_REGEX
Line and column number config value pattern.
-
LINE_SEPARATOR
private static final String LINE_SEPARATOR
OS specific line separator.
-
-
Constructor Detail
-
SuppressionsStringPrinter
private SuppressionsStringPrinter()
Prevent instances.
-
-
Method Detail
-
printSuppressions
public static String printSuppressions(File file, String suppressionLineColumnNumber, int tabWidth) throws IOException, CheckstyleException
Prints generated suppressions.- Parameters:
file
- the file to process.suppressionLineColumnNumber
- line and column number of the suppressiontabWidth
- length of the tab character- Returns:
- generated suppressions.
- Throws:
IOException
- if the file could not be read.IllegalStateException
- if suppressionLineColumnNumber is not of a valid format.CheckstyleException
- if the file is not a Java source.
-
generate
private static String generate(FileText fileText, DetailAST detailAST, int lineNumber, int columnNumber, int tabWidth)
CreatesXpathQueryGenerator
instance and generates suppressions.- Parameters:
fileText
-FileText
object.detailAST
-DetailAST
object.lineNumber
- line number.columnNumber
- column number.tabWidth
- length of the tab character.- Returns:
- generated suppressions.
-
-