代码复制检测 - Delphi

时间:2011-02-07 18:35:47

标签: delphi refactoring

有没有人知道在SolidSDD等delphi程序中找到重复代码的好工具?

5 个答案:

答案 0 :(得分:5)

Delphi 2010& XE有它built in。有一个名为Audits&的新工具。指标。

他们针对您的代码执行多项测试,以发现可以通过静态分析检测到的各种问题或难闻的气味。

在XE菜单中,您可以选择Project | QA审核以访问重复的代码检查功能。您可以运行3种不同的重复代码检查。

QA Audits

虽然它没有进行重复代码检测,但还有Peganza Pascal Analyzer使用静态分析进行不同的审核。

答案 1 :(得分:4)

我们通过Torry的Delphi网站找到了DupeCheck。它是一个独立的.exe,它扫描目录列表,并通过.pas文件,试图查找重复的代码行 - 忽略注释,空格和区分大小写。

答案 2 :(得分:3)

试试这个:

Delphi Audit

答案 3 :(得分:2)

您可以尝试使用Smartbear软件中的AQTime,它是一个很好的分析和分析工具,可以让您检测duplicated code,更像是:

Codecoverage,性能问题,内存分配,异常和功能跟踪等。

这个工具不是免费的,但它非常强大并且支持Delphi应用程序,你甚至可以选择将它集成到你的IDE中。

了解更多信息c AQ-Profilers

答案 4 :(得分:0)

我使用过Simian。 http://www.harukizaemon.com/simian/

您可以轻松运行它以查找重复的代码。 例如:

  simian-2.3.33 -ignoreCharacterCase+ -ignoreCurlyBraces+ %1

它不是专门用于Delphi,但它有效。

以下是输出示例:

Simian is not free unless used solely for non-commercial or evaluation purposes.
{failOnDuplication=true, ignoreCharacterCase=true, ignoreCurlyBraces=true, ignoreIdentifierCase=true, ignoreModifiers=true, ignoreStringCase=true, threshold=6}
Found 6 duplicate lines in the following files:
 Between lines 6386 and 6391 in c:\develop\Schedule.pas
 Between lines 6370 and 6375 in c:\develop\Schedule.pas
Found 6 duplicate lines in the following files:
 Between lines 5229 and 5235 in c:\develop\Schedule.pas
 Between lines 5189 and 5195 in c:\develop\Schedule.pas
Found 6 duplicate lines in the following files:
 Between lines 6892 and 6898 in c:\develop\Schedule.pas
 Between lines 6418 and 6423 in c:\develop\Schedule.pas
 Between lines 6402 and 6407 in c:\develop\Schedule.pas
 Between lines 6354 and 6359 in c:\develop\Schedule.pas
 Between lines 6338 and 6343 in c:\develop\Schedule.pas
Found 27 duplicate lines in the following files:
 Between lines 2995 and 3022 in c:\develop\Schedule.pas
 Between lines 3035 and 3062 in c:\develop\Schedule.pas