Package com.puppycrawl.tools.checkstyle
Class XpathFileGeneratorAuditListener
java.lang.Object
com.puppycrawl.tools.checkstyle.AbstractAutomaticBean
com.puppycrawl.tools.checkstyle.XpathFileGeneratorAuditListener
- All Implemented Interfaces:
AuditListener
,Configurable
,Contextualizable
,EventListener
Generates suppressions.xml file, based on violations occurred.
See issue #102
-
Nested Class Summary
Nested classes/interfaces inherited from class com.puppycrawl.tools.checkstyle.AbstractAutomaticBean
AbstractAutomaticBean.OutputStreamOptions
-
Field Summary
Modifier and TypeFieldDescriptionprivate final boolean
Close output stream in auditFinished.private boolean
Determines if xml header is printed.private static final String
The " quote character.private final PrintWriter
Helper writer that allows easy encoding and printing. -
Constructor Summary
ConstructorDescriptionXpathFileGeneratorAuditListener
(OutputStream out, AbstractAutomaticBean.OutputStreamOptions outputStreamOptions) Creates a newSuppressionFileGenerator
instance. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addError
(AuditEvent event) Notify that an audit error was discovered on a specific file.void
addException
(AuditEvent event, Throwable throwable) Notify that an exception happened while performing audit.void
auditFinished
(AuditEvent event) Notify that the audit is finished.void
auditStarted
(AuditEvent event) Notify that the audit is about to start.void
fileFinished
(AuditEvent event) Notify that audit is finished on a specific file.void
fileStarted
(AuditEvent event) Notify that audit is about to start on a specific file.protected void
Provides a hook to finish the part of this component's setup that was not handled by the bean introspection.private void
Prints XML header if only it was not printed before.Methods inherited from class com.puppycrawl.tools.checkstyle.AbstractAutomaticBean
configure, contextualize, getConfiguration, setupChild
-
Field Details
-
QUOTE_CHAR
The " quote character.- See Also:
-
writer
Helper writer that allows easy encoding and printing. -
closeStream
Close output stream in auditFinished. -
isXmlHeaderPrinted
Determines if xml header is printed.
-
-
Constructor Details
-
XpathFileGeneratorAuditListener
public XpathFileGeneratorAuditListener(OutputStream out, AbstractAutomaticBean.OutputStreamOptions outputStreamOptions) Creates a newSuppressionFileGenerator
instance. Sets the output to a defined stream.- Parameters:
out
- the output streamoutputStreamOptions
- ifCLOSE
stream should be closed in auditFinished()
-
-
Method Details
-
auditStarted
Description copied from interface:AuditListener
Notify that the audit is about to start.- Specified by:
auditStarted
in interfaceAuditListener
- Parameters:
event
- the event details
-
auditFinished
Description copied from interface:AuditListener
Notify that the audit is finished.- Specified by:
auditFinished
in interfaceAuditListener
- Parameters:
event
- the event details
-
fileStarted
Description copied from interface:AuditListener
Notify that audit is about to start on a specific file.- Specified by:
fileStarted
in interfaceAuditListener
- Parameters:
event
- the event details
-
fileFinished
Description copied from interface:AuditListener
Notify that audit is finished on a specific file.- Specified by:
fileFinished
in interfaceAuditListener
- Parameters:
event
- the event details
-
addError
Description copied from interface:AuditListener
Notify that an audit error was discovered on a specific file.- Specified by:
addError
in interfaceAuditListener
- Parameters:
event
- the event details
-
addException
Description copied from interface:AuditListener
Notify that an exception happened while performing audit.- Specified by:
addException
in interfaceAuditListener
- Parameters:
event
- the event detailsthrowable
- details of the exception
-
printXmlHeader
Prints XML header if only it was not printed before. -
finishLocalSetup
Description copied from class:AbstractAutomaticBean
Provides a hook to finish the part of this component's setup that was not handled by the bean introspection.The default implementation does nothing.
- Specified by:
finishLocalSetup
in classAbstractAutomaticBean
-