重复代码检查工具Simian

简介
Simian是一个可跨平台使用的重复代码检测工具,能够检测代码片段中除了空格、注释及换行外的内容是否完全一致,且支持的语言十分广泛

官网

Simian官网:http://www.harukizaemon.com/simian/index.html

下载

http://www.harukizaemon.com/simian/get_it_now.html地址下载

将这2个文件都下载下来,使用MD5文件校验上面的文件是否下载完毕了。

证明文件下载的文件是完整的。

然后解压simian-2.5.10.tar.gz,并把解压后的文件放到D:\Program_Files\simian-2.5.10目录下

使用

使用bin目录下的jar

执行命令,从src目录下找到重复3行的重复代码,并将找到的结果放入D:\result.txt中

java -jar D:\Program_Files\simian-2.5.10\bin\simian-2.5.10.jar -threshold=3 "D:\workspace\idea\father\src\**\*.java" >> D:\result.txt

Simian命令行的格式

java -jar simian.jar [options] [files]

Usage: [options] [files]

命令描述
-balanceCurlyBraces[+/-]Accounts for curly braces when breaking lines
-balanceParentheses[+/-]Accounts for parentheses when breaking lines
-balanceSquareBrackets[+/-]Accounts for square brackets when breaking lines
-config=FNAMEReads the configuration from the specifiedfile
-defaultLanguage=LANGAssumes files are in the specified language if none can be inferred
-excludes=SPECExcludes files matching the specified pattern
-failOnDuplication[+/-/%]Exits with a failure return code if duplication detected
-formatter=TYPE[:FNAME]Uses the specified output format when reporting
-ignoreBlocks=START:ENDIgnores all lines between START/END
-ignoreCharacterCase[+/-]Matches character literals irrespective of case
-ignoreCharacters[+/-]Completely ignores character literals
-ignoreCurlyBraces[+/-]Completely ignores curly braces
-ignoreIdentifierCase[+/-]Matches identifiers irresepctive of case
-ignoreIdentifiers[+/-]Completely ignores identifiers
-ignoreLiterals[+/-]Completely ignores all literals (strings, numbers and characters)
-ignoreModifiers[+/-]Ignores modifiers (public, private, static, etc.)
-ignoreNumbers[+/-]Completely ignores numbers
-ignoreOverlappingBlocks[+/-]Ignores blocks that wholly or partially overlap
-ignoreRegions[+/-]Ignores all lines between #region/#endregion
-ignoreStringCase[+/-]Matches string literals irrespective of case
-ignoreStrings[+/-]Completely ignores the contents of strings
-ignoreSubtypeNames[+/-]Matches on similar type names (eg. Reader and FilterReader)
-ignoreVariableNames[+/-]Completely ignores variable names (fields, parameters and locals)
-includes=SPECIncluding files matching the specified pattern
-language=LANGAssumes ALL files are in the specified language
-reportDuplicateText[+/-]Prints the duplicate text in reports
-threshold=COUNTMatches will contain at least the specified number of lines
  • 4
    点赞
  • 21
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
Simian是一种用于检测代码重复内容的工具。它可以扫描源代码文件,查找相似或完全相同的代码段,并将它们报告为重复项。这有助于开发人员识别可能存在的冗余代码,从而改善代码质量和可维护性。 Simian可以用于支持各种编程语言,包括Java、C++、C#、Python等。它可以扫描整个项目或特定的代码文件,并可根据用户设定的规则进行处理。 使用Simian工具的好处有很多。首先,它可以帮助开发团队识别并消除代码中的重复部分,从而减少代码库的大小和复杂性。这可以提高代码的可读性和可维护性,节省时间和精力。 其次,Simian可以发现隐藏的问题,如复制黏贴错误。有时开发人员可能会复制一段代码,稍作修改并粘贴到另一个位置,但忘记了修改部分代码Simian可以帮助开发者找出这些隐藏的错误,并及时进行修复,避免潜在的bug。 此外,Simian还提供了比较功能,可以比较两个代码库中的重复项。这对于开发人员来说非常有用,因为他们可以比较自己的代码与其他团队成员或外部代码库中的代码,以避免冲突或重复工作。 总之,Simian是一款非常实用的工具,可以帮助开发人员发现和解决代码中的重复问题,提高代码的质量和可维护性。它的使用简单灵活,适用于多种编程语言,是开发团队提高效率和减少错误的有力工具之一。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

cgm625637391

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值