com.puppycrawl.tools.checkstyle.checks.duplicates
Class StrictDuplicateCodeCheck
java.lang.Object
com.puppycrawl.tools.checkstyle.api.AutomaticBean
com.puppycrawl.tools.checkstyle.api.AbstractViolationReporter
com.puppycrawl.tools.checkstyle.api.AbstractFileSetCheck
com.puppycrawl.tools.checkstyle.checks.duplicates.StrictDuplicateCodeCheck
- All Implemented Interfaces:
- Configurable, Contextualizable, FileSetCheck
public final class StrictDuplicateCodeCheck
- extends AbstractFileSetCheck
Performs a line-by-line comparison of all code lines and reports
duplicate code if a sequence of lines differs only in
indentation. All import statements in Java code are ignored, any
other line - including javadoc, whitespace lines between methods,
etc. - is considered (which is why the check is called
strict).
- Author:
- Lars Kühne
Method Summary |
void |
beginProcessing(String aCharset)
Called when about to be called to process a set of files. |
void |
finishProcessing()
Called when all the files have been processed. |
protected void |
processFiltered(File aFile,
List<String> aLines)
Called to process a file that matches the specified file extensions. |
void |
setBasedir(String aBasedir)
|
void |
setMin(int aMin)
Sets the minimum number of lines that must be equivalent
before the check complains. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
StrictDuplicateCodeCheck
public StrictDuplicateCodeCheck()
- Creates a new instance of this class.
setMin
public void setMin(int aMin)
- Sets the minimum number of lines that must be equivalent
before the check complains.
- Parameters:
aMin
- the number of lines that must be equal before
triggering a 'duplicate code' message.
setBasedir
public void setBasedir(String aBasedir)
- Parameters:
aBasedir
- the base directory to strip off in filenames
beginProcessing
public void beginProcessing(String aCharset)
- Description copied from class:
AbstractFileSetCheck
- Called when about to be called to process a set of files.
- Specified by:
beginProcessing
in interface FileSetCheck
- Overrides:
beginProcessing
in class AbstractFileSetCheck
- Parameters:
aCharset
- the character set used to read the files.
processFiltered
protected void processFiltered(File aFile,
List<String> aLines)
- Description copied from class:
AbstractFileSetCheck
- Called to process a file that matches the specified file extensions.
- Specified by:
processFiltered
in class AbstractFileSetCheck
- Parameters:
aFile
- the file to be processedaLines
- an immutable list of the contents of the file.
finishProcessing
public void finishProcessing()
- Description copied from class:
AbstractFileSetCheck
- Called when all the files have been processed. This is the time to
perform any checks that need to be done across a set of files. In this
method, the implementation is responsible for the logging of messages.
- Specified by:
finishProcessing
in interface FileSetCheck
- Overrides:
finishProcessing
in class AbstractFileSetCheck