public abstract class AbstractParser extends IssueParser
RegexpLineParser or RegexpDocumentParser. Each parser accepts a pre-preprocessor of the input lines. Here you can remove all debugging
lines that might be printed by the used build tool.RegexpLineParser,
RegexpDocumentParser,
CppLintParser,
EclipseParser,
StyleCopParser,
Serialized Form| Modifier and Type | Field and Description |
|---|---|
static String |
DEPRECATION
Category for warnings due to usage of deprecate API.
|
static String |
PROPRIETARY_API
Category for warnings due to the usage of proprietary API.
|
| Constructor and Description |
|---|
AbstractParser() |
| Modifier and Type | Method and Description |
|---|---|
String |
getFileName()
Returns the absolute path of the file that is parsed.
|
protected String |
guessCategory(String message)
Classifies the warning message: tries to guess a category from the warning message.
|
protected String |
guessCategoryIfEmpty(String category,
String message)
Returns a category for the current warning.
|
Report |
parse(Path file,
Charset charset,
Function<String,String> preProcessor)
Parses the specified file for issues.
|
Report |
parse(Reader reader)
Parses the specified input stream for issues.
|
abstract Report |
parse(Reader reader,
Function<String,String> preProcessor)
Parses the specified input stream for issues.
|
protected int |
parseInt(String lineNumber)
Converts a string line number to an integer value.
|
accepts, isXmlFile, parsepublic static final String DEPRECATION
public static final String PROPRIETARY_API
public String getFileName()
public Report parse(Path file, Charset charset, Function<String,String> preProcessor) throws ParsingException, ParsingCanceledException
IssueParserparse in class IssueParserfile - the file to parsecharset - the encoding to use when reading filespreProcessor - pre processes each input line before handing it to the actual parserParsingException - Signals that during parsing a non recoverable error has been occurredParsingCanceledException - Signals that the parsing has been aborted by the userpublic abstract Report parse(Reader reader, Function<String,String> preProcessor) throws ParsingCanceledException, ParsingException
reader - the reader to get the text frompreProcessor - pre processes each input line before handing it to the actual parserParsingException - Signals that during parsing a non recoverable error has been occurredParsingCanceledException - Signals that the parsing has been aborted by the userpublic Report parse(Reader reader) throws ParsingCanceledException, ParsingException
reader - the reader to get the text fromParsingException - Signals that during parsing a non recoverable error has been occurredParsingCanceledException - Signals that the parsing has been aborted by the userprotected int parseInt(@CheckForNull
String lineNumber)
lineNumber - the line number (as a string)protected String guessCategory(@CheckForNull String message)
message - the message to checkprotected String guessCategoryIfEmpty(@CheckForNull String category, @CheckForNull String message)
category - the warning category (might be empty)message - the warning messageCopyright © 2018. All rights reserved.