13

I wish to get a quick feeling for how much “copy and paste” coding we have, there are many tools for C# / Java to check for this type of thing. Are there any such tools that work well with VB.NET?

(I have seen what looks like lots of repeated code, but wish to get some number to help me make a case for sorting it out)


Update on progress.

I have just tried Simian.

Clone Doctor does not support VB.NET (only C# and VB 6 and lot of other)
October 2010: VB.net added to langauges supported by CloneDR

Clone Detective for Visual Studio only supports C#

SolidSDD - Source Code Duplication Detector only supports C, C++, C# and Java

DuplicateFinder is open source, but otherwise looks very match like Simian, e.g it just works on lines of text

ConQAT - Continuous Quality Assessment Toolkit seems to have a clone detector that works for VB.NET (not tried it yet)

Gendarme is a bit like FXCop and has a AvoidCodeDuplicatedInSameClassRule rule, this looks very promising, as it avoids the problem of working at the text level. Just tried it, it is the best solution so far, pity it does not search with a greater scope.


Before claiming that this question is a duplicate, please check that the other question addresses VB.NET, as a lot of tools that work well for C# don't work so well for VB.NET. (However it would not surprise me if this question is a real duplicate)

Community
  • 1
  • 1
Ian Ringrose
  • 51,220
  • 55
  • 213
  • 317
  • Does this question help? http://stackoverflow.com/questions/758126/what-are-good-tools-for-identifying-potentially-duplicated-code-for-c-express-us – Shoban Feb 15 '10 at 15:37
  • 2
    @Shoban the problem is that most tools that work for C# don't surport VB.NET well. – Ian Ringrose Feb 15 '10 at 15:57

9 Answers9

3

CodeRush 11.2 introduced a new feature called Duplicate Detection and Consolidation (DDC)

http://community.devexpress.com/blogs/markmiller/archive/2011/11/29/duplicate-detection-and-consolidation-in-coderush-for-visual-studio.aspx

Make sure to check out the options for it as well, as you can have it run when so many lines are changed, certainly time has passed, etc.

They've posted some decent videos on the DevExpress site too.

2GDave
  • 996
  • 8
  • 18
1

Simian: http://www.redhillconsulting.com.au/products/simian/

Marek
  • 10,307
  • 8
  • 70
  • 106
1

[I'm the author of CloneDR ("Clone Doctor").]

CloneDR is parameterized by a full grammar for the programming language in question. So it doesn't just match lines. Rather, it can find clones which are syntactically well-formed, with variations that are more than just identifier changes, regardless of where they stop or start in a line.

The engine on which CloneDR rests, The DMS Software Reengineering Toolkit" is a tool for analyzing large scale systems in any programming language, and uses language descriptions to drive the analysis. DMS has a wide variety of language front ends already available.

Presently it has VBScript and VB6 (as dialects of "Visual Basic"). It doesn't have VB.net, but that would be pretty straightforward to do given the DMS infrastructure and our experience with lots of other languages.

So, CloneDR could do this just fine, with a small bit of effort on our part.

EDIT October 2010: VB.net added as a language CloneDR can process.

Ira Baxter
  • 93,541
  • 22
  • 172
  • 341
1

JetBrains published console tool set Resharper Console Tools to run duplication analysis. Once installed it allows you to do the same analysis as TeamCity does and generate duplicates report locally and even include duplicates search into custom build process with MSBuild. This tool does exactly what you need. More details you can find here at JetBrains blog post

Valentine
  • 506
  • 6
  • 23
  • Welcome to Stack Overflow! While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. See [How do I write a good answer](http://stackoverflow.com/help/how-to-answer). – ByteHamster May 06 '15 at 14:43
1

Atomiq supports vb.net amongst other languages, and the results are nicely presented.

Matthieu
  • 4,605
  • 4
  • 40
  • 60
0

Try Simian:

Simian (Similarity Analyser) identifies duplication in Java, C#, C, C++, COBOL, Ruby, JSP, ASP, HTML, XML, Visual Basic, Groovy source code and even plain text files.

Anton Gogolev
  • 113,561
  • 39
  • 200
  • 288
0

I once saw an impressive demo of Pattern Insight; its CP Miner may be what you’re looking for: http://patterninsight.com/products/cp-miner.php. It seems to be language-independent, though I couldn’t find anything explicit about languages other than C/C++.

Flash Sheridan
  • 1,671
  • 1
  • 14
  • 14
-1

Roll up your sleeves and write your own parser to use it with CPD?

Anders Lindahl
  • 41,582
  • 9
  • 89
  • 93
  • Your link doesn't work. Here's one on Wayback ... [working link](https://web.archive.org/web/20121019132921/http://pmd.sourceforge.net/cpd.html) – MicroservicesOnDDD Feb 10 '20 at 20:52
-1

See the question for the tools I found.

Ian Ringrose
  • 51,220
  • 55
  • 213
  • 317
  • 5
    Instead of pointing to your question, you should write your results in this answer. It would be less confusing considering the way this website is usually used. – Matthieu Nov 23 '11 at 15:41
  • I totally agree with @Matthieu ... this is a QUESTION and then ANSWER site. – alcor Feb 28 '17 at 16:10