I really like the new built in feature of VS11 to find 'Code Clones' but there does not seem to be any way to configure it.
An example would be only show me exact clones of 5 lines or more.
Right now it gives Exact, Strong, Medium and Weak matches and it seems like they are for 10 lines or more. If I could configure this it would help work through the clones and it would find me those small methods that I am sure have been cut and pasted over the years.
UPDATE Here is the notes from the documentation for the Release Preview version about how to configure the ability to exclude generated files
To exclude files generated by T4 templates from code clone analysis
Place the templates in a sub directory of the Visual Studio project. Name it, for example, GeneratedFiles.
Add a new text file to the project, and change its name and extension to t4Exclusions.codeclonesettings
Change the content of the file as follows:
<CodeCloneSettings>
<Exclusions>
<File>
GeneratedFiles*.cs</File>
</Exclusions>
</CodeCloneSettings>
UPDATE - 08/27/2012 I found this in the Code Clone documentation, it was not there in the earlier versions. It is one way to find clones of less than 10 lines long.
To find clones of a particular code fragment
1. Highlight a fragment of code within a method or a get/set definition.
Note - You can find clones of statements, but not declarations such as field, method, or property signatures.
2. On the shortcut menu for the fragment, choose Find matching clones in solution.
Use this method when you want to know if there is a similar method or fragment already in existence in your solution.
From the documentation:
Clones that are less than 10 statements long are not discovered by this command.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With