重复代码检查工具Simian

Simian是一款跨平台的重复代码检测工具,能检测代码片段中除空格、注释及换行外的内容是否一致,支持多种编程语言。通过特定命令行参数,用户可以定制检测过程,如忽略大小写、特定字符或代码块,结果将以指定格式输出。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

简介
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
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

cgm625637391

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

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

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

打赏作者

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

抵扣说明:

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

余额充值