html去除重复代码,simian 查找项目中的重复代码

article/2025/11/9 10:08:52

866996a353ee495bc007b84ff31e2fc2.png

证明文件是完整的,可忽略

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

使用bin目录下的jar

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

java -jar D:Program_Filessimian-2.5.10insimian-2.5.10.jar -threshold=3 "D:workspaceideafathersrc***.java" >> D:esult.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=FNAME

Reads the configuration from the specifiedfile

-defaultLanguage=LANG

Assumes files are in the specified language if none can be inferred

-excludes=SPEC

Excludes 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:END

Ignores 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=SPEC

Including files matching the specified pattern

-language=LANG

Assumes ALL files are in the specified language

-reportDuplicateText[+/-]

Prints the duplicate text in reports

-threshold=COUNT

Matches will contain at least the specified number of lines

示例说明:

一些参数:

检查包括子目录下的所有的c#文件:

"-recurse=*.cs"

检查当前目录下的所有c#文件 ,并且只检查代码3行以上重复的代码

-threshold=3 "*.cs"

在当前目录的所有子文件夹下检测所有c和h后缀的文件:

**/*.c **/*.h

检测两个不同目录下的所有java文件:

"/csharp-source/*.cs" "/java-source/*.java"

检测所有子目录下的所有java文件,包括test类:

-includes=**/*.java -excludes=**/*Test.java

检测当前目录下的所有java文件,且忽略其中的数字的不同:

-ignoreNumbers "*.java"

检测所有java文件,并以xml格式显示结果:

-formatter=xml "*.rb"

从文件中读取配置参数(文件中一行只能包括一个simian有效的参数):

-config=simian.config


http://chatgpt.dhexx.cn/article/Ko0b5ZHp.shtml

相关文章

如何产出规范、安全、高质量的代码?

对于一个软件开发团队,可以通过哪些代码质量指标和扫描方法让团队产出规范、安全、高质量的代码?让开发团队运行的安全、透明、可靠?本文总结了其中一些实践和工具,包含常见代码质量扫描工具、代码质量指标、第三方依赖管理、安全…

重复代码检查工具simian的基本用法

simian是一个检查重复代码的工具,支持通过命令行和UI方式来检查代码,可以检查多种语言(比如C\C, java, c#等)的代码,常见的编程语言都支持,下面先来看看如何使用命令行来检查c重复代码的。 E:\temp\simian-…

CC simian

看它还好.所以就收藏起来. 让开发自动化: 除掉构建脚本中的气味创建一致、可重复、可维护的构建 文档选项 打印本页将此页作为电子邮件发送级别: 初级Paul Duvall (paul.duvallstelligent.com), CTO, Stelligent Incorporated2006 年 11 月 1…

使用Simian检查Java项目中冗余代码

Simian UI 是一个用来发现重复代码的eclipse插件,对于改善设计,消除冗余代码很有帮助。 使用eclipse的Help->Software Update进行安装。站点地址为:http://www.integility.com/eclipse/ 安装后,按照提示重新启动eclipse. 1 在希望进行分析…

使用Simian工具扫描重复代码

工具下载地址:http://www.harukizaemon.com/simian/get_it_now.html 1. simian命令行的格式: java -jar simian.jar [options] [files] simian.exe [options] [files] 2. Usage: [options] [files] 命令描述-balanceCurlyBraces[/-]Accounts for curl…

异常解决java.lang.ClassNotFoundException: org.springframework.boot.actuate.endpoint.PublicMetrics

异常java.lang.ClassNotFoundException: org.springframework.boot.actuate.endpoint.PublicMetrics 原因:springboot-web 版本冲突 修改版本为1.5.9

关闭springboot健康检查 org.springframework.boot.actuate.health.AbstractHealthIndicator 89 health - Elastic

错误日志:org.springframework.boot.actuate.health.AbstractHealthIndicator 89 health - Elasticsearch health check failed java.net.ConnectException: Connection refused: no further information 出现这个错误是spring对Elasticsearch监测失败,解…

解决 Spring Cloud 整合 zipkin 报错:org.springframework.boot.actuate.health.CompositeHealthIndicator......

文章目录 一、问题描述二、解决方法 一、问题描述 我的 Spring Boot 版本是 2.3.4&#xff0c;Spring Cloud 版本是 Hoxton.SR1。 要整合 zipkin&#xff0c;先在服务端导入了以下依赖&#xff1a; <dependencies><dependency><groupId>io.zipkin.java</g…

NoClassDefFoundError: org/springframework/boot/actuate/web/trace/servlet/HttpTraceFilter

线上项目运行期间报错&#xff1a;java.lang.NoClassDefFoundError: org/springframework/boot/actuate/web/trace/servlet/HttpTraceFilter$CustomStatusResponseWrapper 提示class找不到&#xff0c;百思不得其解&#xff0c;sping的jar咋会找不到&#xff0c;最后怀疑是打包…

org/springframework/boot/actuate/metrics/cache/CacheMeterBinderProvider not found. Make sure your ow

报错信息如下 java.lang.IllegalStateException: Could not evaluate condition on org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfiguration$EndpointWebMvcConfiguration due to org/springframework/boot/actuate/metrics/cache/CacheMeterBinder…

spring boot 源码解析52-actuate中MVCEndPoint解析

前言 之前的几篇文章分析了spring boot 中有关endpoint的实现,细心的朋友可以发现,在org.springframework.boot.actuate.endpoint.mvc 包下也有一系列的xxxEndpoint,这又是为什么呢? 原因是: 我们很多情况下,都是访问接口的方式获取应用的监控,之前的分析是其实现的底层,要想…

Unable to identify any set of controllers that can actuate the specified joints:

提示&#xff1a;文章写完后&#xff0c;目录可以自动生成&#xff0c;如何生成可参考右边的帮助文档 文章目录 背景一、解决办法二、总结 背景 具体的报错如下&#xff1a; [ERROR] [1649324583.023988413]: Unable to identify any set of controllers that can actuate the…

springboot整合Actuator监控

springboot整合Actuator监控。 1.简要说明&#xff1a; Actuator提供了对springboot应用程序监视和管理的能力&#xff0c;可以选择通过使用HTTP Endpoint或者使用JMX来管理和监控springboot应用程序。 Actuator 允许通过Endpoints对springboot进行监控和交互。springboot内…

项目监控之Spring Boot 监控端点 Actuator 入门

1. 概述 应用在部署在生产环境下&#xff0c;我们还需要考虑应用的管理与监控。例如说&#xff0c;应用是否健康存活、应用的 JVM 监控信息、服务器的监控信息&#xff08;CPU、内存、磁盘等等&#xff09;。 如果我们为应用的管理与监控做相应的开发&#xff0c;是需要一定的…

spring boot 源码解析23-actuate使用及EndPoint解析

前言 spring boot 中有个很诱人的组件–actuator,可以对spring boot应用做监控,只需在pom文件中加入如下配置即可: <dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-actuator</artifactId></depen…

ESXi挂载NFS共享存储

通常VMware的整体架构由三个部分组成&#xff0c;虚拟化环境&#xff08;包括ESXi与vCenter以及VM&#xff09;&#xff0c;交换机&#xff08;通常为万兆交换机或光纤交换机&#xff09;&#xff0c;存储&#xff08;netap、EMC等&#xff09;。使用光纤交换机&#xff0c;ESX…

Docker容器中挂载NFS共享目录

之前在https://blog.csdn.net/fengbingchun/article/details/110561129 介绍过使用Dockerfile构建ubuntu 16.04镜像,并在容器中编译执行Messy_Test项目.这里介绍下如何在容器中挂载NFS服务器上的共享目录. Dockerfile内容如下&#xff1a; FROM ubuntu:16.04 LABEL maintaine…

LINUX 下创建NFS共享目录

Linux下创建NFS共享目录的步骤如下 实验中服务器端IP为10.201.86.204&#xff0c;客户端IP为10.201.86.2051.在服务器端格式化需要共享的磁盘 fdisk /dev/sdb mkfs.xfs -f /dev/sdb12.安装NFS软件包 Server端和客户端都要安装 rpm -qa |grep nfs-utils rpm -qa |grep rpcb…

NFS共享存储服务介绍与案例详细配置过程

目录 1&#xff0c;什么是NFS?2&#xff0c;NFS工作原理3&#xff0c;使用NFS发布共享资源4&#xff0c;NFS 挂载原理5&#xff0c;NFS服务所需软件及主要配置文件安装NFS服务&#xff0c;需要安装两个软件&#xff0c;分别是&#xff1a; 6&#xff0c; NFS的相关文件&#x…

NFS 共享目录

今天用迅为的itop-4412的开发板 挂载nfs 把流程写一下&#xff0c;和遇到的问题。图片用的开发手册的图片 我有的没截图 1、搭建 NFS 服务器 实现 NFS&#xff0c;需要一个主机作为 NFS 服务器&#xff0c;选择虚拟机 Ubuntu 作为主机。首先需要在 在虚拟机 Ubuntu 上安装 Ub…