有什么工具可以检查重复的 VB.NET 代码吗?
我希望快速了解一下我们有多少“复制粘贴”编码,有很多 C# / Java 工具可以检查此类事情。有没有与 VB.NET 配合良好的此类工具?
(我已经看到看起来有很多重复的代码,但希望获得一些数字来帮助我提出解决方案)
更新进度。
我刚刚尝试过猿猴。
- 它似乎无法生成格式良好的报告,我可以通过电子邮件发送
- 当局部变量的名称或参数等可能已更改时,它无法处理,例如它仅匹配文本行相同。
Clone Doctor 不支持 VB.NET(仅 C# 和 VB 6 以及许多其他版本)
2010 年 10 月:VB.net 添加到 CloneDR 支持的语言
Clone Detective for Visual Studio a> 仅支持 C#
SolidSDD - 源代码重复检测器 仅支持 C、C++、C# 和 Java
DuplicateFinder 是开源的,但其他方面看起来很像 Simian,例如,它仅适用于文本行
ConQAT - 持续质量评估工具包 似乎有一个适用于 VB.NET 的克隆检测器 (还没有尝试过)
Gendarme 有点像 FXCop 并且有一个 AvoidCodeDuplicatedInSameClassRule 规则,这看起来非常有前途,因为它避免了在文本级别工作的问题。 刚刚尝试过,这是迄今为止最好的解决方案,遗憾的是它没有以更大的范围进行搜索。
在声称这个问题重复之前,请检查其他问题是否涉及VB。 NET,因为许多适用于 C# 的工具不适用于 VB.NET。 (但是,如果这个问题是真正的重复问题,我不会感到惊讶)
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.
- It does not seem to be able to produce a nicely formatted report I can sent by email
- It does not cope when the names of local variables, or parameters etc may have been changed, e.g it just matches on lines of text being the same.
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)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(9)
CodeRush 11.2 引入了一项名为重复检测和合并 (DDC) 的新功能
http://community.devexpress.com/blogs/markmiller/archive/2011/11/29/duplicate-detection-and-consolidation-in-coderush -for-visual-studio.aspx
确保也检查它的选项,因为当更改了如此多的行,当然时间已经过去等等时,您可以让它运行。
他们已经发布了一些不错的内容DevExpress 网站上也有视频。
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.
[我是 CloneDR(“Clone Doctor”) 的作者。]
CloneDR 的参数化为相关编程语言的完整语法。所以它不仅仅是匹配线条。相反,它可以找到语法良好的克隆,其变体不仅仅是标识符更改,无论它们在一行中的何处停止或开始。
CloneDR 所依赖的引擎,DMS 软件重新工程工具包" 是一个工具用于分析任何编程语言的大型系统,并使用语言描述来驱动分析,
目前它有 VBScript 和 VB6(作为“Visual Basic”的方言)。没有 VB.net,但是考虑到 DMS 基础设施和我们在许多其他语言方面的经验,这将是非常简单的,
因此,CloneDR 可以很好地做到这一点,只需我们在
2010 年 10 月进行一点编辑:添加 VB.net 作为 CloneDR 可以处理的语言。
[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.
Atomiq 支持 vb.net 以及其他语言,并且结果呈现得很好。
Atomiq supports vb.net amongst other languages, and the results are nicely presented.
JetBrains 发布的控制台工具集 Resharper 控制台工具 用于运行复制分析。安装后,它允许您进行与 TeamCity 相同的分析,并在本地生成重复报告,甚至使用 MSBuild 将重复搜索包含到自定义构建过程中。这个工具完全可以满足您的需要。您可以在 JetBrains 博客文章
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
Simian 相似度分析器:
Simian Similarity Analyzer:
我曾经看过一个令人印象深刻的 Pattern Insight 演示;它的 CP Miner 可能就是您正在寻找的:http://patterninsight.com/products/cp -miner.php。它似乎与语言无关,尽管我找不到任何关于 C/C++ 以外的语言的明确信息。
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++.
尝试 Simian 相似度分析器:
Try Simian Similarity Analyzer:
卷起袖子,编写你自己的解析器以将其与CPD?
Roll up your sleeves and write your own parser to use it with CPD?
请参阅我找到的工具的问题。
See the question for the tools I found.