## 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

Constructor Summary
`StrictDuplicateCodeCheck()` Creates a new instance of this class.

Method Summary
`void` `process(File[] aFiles)` Processes a set of files and fires errors to the MessageDispatcher.
`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 com.puppycrawl.tools.checkstyle.api.AbstractFileSetCheck
`destroy, filter, fireErrors, getCharset, getMessageCollector, getMessageDispatcher, log, log, setCharset, setFileExtensions, setMessageDispatcher`

Methods inherited from class com.puppycrawl.tools.checkstyle.api.AbstractViolationReporter
`getId, getMessageBundle, getSeverity, getSeverityLevel, log, log, log, log, log, log, log, log, log, setId, setSeverity`

Methods inherited from class com.puppycrawl.tools.checkstyle.api.AutomaticBean
`configure, contextualize, finishLocalSetup, getConfiguration, setupChild`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface com.puppycrawl.tools.checkstyle.api.Configurable
`configure`

Methods inherited from interface com.puppycrawl.tools.checkstyle.api.Contextualizable
`contextualize`

Constructor Detail

### StrictDuplicateCodeCheck

    public StrictDuplicateCodeCheck()

  Creates a new instance of this class.

Method Detail

### 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

### process

    public void process(File[] aFiles)

  Processes a set of files and fires errors to the MessageDispatcher. The file set to process might contain files that are not interesting to the FileSetCheck. Such files should be ignored, no error message should be fired for them. For example a FileSetCheck that checks java files should ignore html or properties files. Once processiong is done, it is highly recommended to call for the destroy method to close and remove the listeners.

  Parameters:
    `aFiles` - the files to be audited.
  See Also:
    `FileSetCheck.destroy()`

Back to the Checkstyle Home Page