diff --git a/docs/config.html b/docs/config.html index 32328e842..f49882970 100644 --- a/docs/config.html +++ b/docs/config.html @@ -431,6 +431,9 @@
  • Checks For Design Problems
  • +
  • + Checks For Finding Duplicate Code +
  • Miscellaneous Checks
  • diff --git a/docs/config_duplicates.html b/docs/config_duplicates.html new file mode 100644 index 000000000..94db6509d --- /dev/null +++ b/docs/config_duplicates.html @@ -0,0 +1,152 @@ + + + + + Duplicate Code Checks + + + + + + + + + + +

    Class Design Checks

    Checkstyle Logo
    + + + + + + + + +
    + +There are many trade-offs when writing a duplicate code detection tool. +Some of the conflicting goals are: +
      +
    • Fast
    • +
    • Low memory usage
    • +
    • Avoid false alarms
    • +
    • Support multiple/arbitrary languages
    • +
    • Support Fuzzy matches (comments, whitespace, linebreaks, variable renaming, etc.)
    • +
    +

    + +

    +Note that there are brilliant commercial implementations of duplicate code +detection tools. One that is particularly noteworthy is +Simian +from RedHill Consulting, Inc. +

    +

    +Simian is reasonably priced (free for noncommercial projects) +and includes a Checkstyle plugin. +We encourage all users of Checkstyle to evaluate Simian as an +alternative to the Checks we offer in our distribution. +

    + +

    +The following table summarizes the characteristics of the available +Checkstyle plugins for duplicate code detection: + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameSpeedMemory UsageFalse AlarmsSupported languagesFuzzy matches
    StrictDuplicateCodeMediumVery LowPossible but very unlikelyany languageNo
    SimianVery highLowunknownmany languages, including Java and C/C++/C#Limited support
    + +

    + + +

    StrictDuplicateCode

    +

    +

    + + +

    Properties

    + + + + + + + + + + + + + +
    namedescriptiontypedefault value
    minhow many lines must be equal to be considered a duplicateint12
    +

    Examples

    +

    + To configure the check: +

    +
    +<module name="StrictDuplicateCode"/>
    +      
    +

    + To configure the check so that it allows larger equivalent blocks: +

    +
    +<module name="VisibilityModifier">
    +    <property name="min" value="15"/>
    +</module>
    +      
    +

    + To configure the check so that it allows no public members: +

    +
    +<module name="VisibilityModifier">
    +    <property name="publicMemberPattern" value="^$"/>
    +</module>
    +      
    +

    Package

    +

    + com.puppycrawl.tools.checkstyle.checks.duplicates +

    +

    Parent Module

    +

    + Checker +

    + +
    +
    +
    Back to the Checkstyle Home Page
    + + + + diff --git a/docs/index.html b/docs/index.html index 428611a2c..241363a9a 100644 --- a/docs/index.html +++ b/docs/index.html @@ -132,6 +132,7 @@
  • Class Design
  • Usage
  • J2EE Requirements
  • +
  • Duplicate Code
  • Miscellaneous Checks