vue代码查重(任意格式文件)

vue代码查重(任意格式文件)

1.代码查重能防止重复开发,提升开发效率,减少不必要的bug
   市面上针对web前端代码的查重软件并不多,大致有以下四种:
jsinspect**,jsinspect**, jscpd**,PMD-CPD,其中jsinspect**,jsinspect**,PMD-CPD多用于.js 文件代码查重(不支持.vue等文件),jscpd** 支持150多种格式的文档代码查重,以下重点介绍jscpd**查重工具
2.jscpd使用
  查重分类:
     基于代码行的
     基于标识符(token)的
     基于度量(metrics)的
     基于抽象语法树(Abstract Syntax Tree)的
     基于程序依赖图(Program Dependence Graph)的
   使用方法:
     1.安装jscpd依赖 npm install jscpd -g
     2.执行命令行查重(命令行参考)
       实例: jscpd ./src/* ./server/* -l 5 -o reporter.html 该命令行表示查询/src /server 目录下的文件,5行以上代码块MD5值相等算重复
      结果:
在这里插入图片描述

3.命令行参考

    所有配置参数也可以直接在终端命令行中以参数形式附加。

OptionTypeDefaultDescription
-l, –min-lines[NUMBER]5min size of duplication in code lines
-t, –min-tokens[NUMBER]70min size of duplication in code tokens
-f, –files[STRING]*glob pattern for find code
-r, –reporter[STRING]xmlreporter name or path
-x, –xsl-href[STRING]-path to xsl file for include to xml report
-e, –exclude[STRING]-directory to ignore
–languages-exts[STRING]-list of languages with file extensions (e.g. language:ext1,ext2;language:ext3)
-g, –languages[STRING]All supportedlist of languages which scan for duplicates, separated with coma
-o, –output[PATH]-path to report file
-c, –config[PATH]-path to config yml file (e.g. .cpd.yml)
–verbose-show full info about copies
–skip-commentsfalse-skip comments in code when duplications finding
-b, –blamefalse-blame authors of duplications (get information about authors from git)
-p, –path[PATH]Current dirpath to code
–limit[NUMBER]50limit of allowed duplications, if real duplications percent more then limit jscpd exit with error
-d, –debug-show debug information (options list and selected files)
-v, –version-Display the current version
-h, –help-Display help and usage details
  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 7
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值