[英]How can I exclude blocks in XML files using CPD?
In a large project multiple android resources are used. 在大型项目中,会使用多个android资源。 It now happens that there are resources copied.
现在发生了复制了资源的情况。 I want to detect these copies using CPD .
我想使用CPD检测这些副本。 Currently I'm using the following command:
目前,我正在使用以下命令:
./run.sh cpd --language xml --minimum-tokens 20 --files $RES_FOLDER
Unfortunately most XML files contains at least a declaration line: 不幸的是,大多数XML文件至少包含一个声明行:
<?xml version="1.0" encoding="UTF-8" ?>
followed by some header: 随后是一些标题:
<!--
-- Copyright 2017, all rights reserved.
-->
There is an option --skip-blocks-pattern
but it seems to be ignored. 有一个
--skip-blocks-pattern
选项,但它似乎被忽略了。
Anybody any hints? 有人提示吗?
I fear this can't be done at the moment. 我担心目前无法做到这一点。
The --skip-blocks-pattern
is a cpp only flag, used to ignore #if 0 ... #endif
blocks. --skip-blocks-pattern
是仅cpp的标志,用于忽略#if 0 ... #endif
块。
There are plans to provide the ignore support through comments on all / most supported languages in the near future. 计划在不久的将来通过对所有/最受支持的语言的注释提供忽略支持。 We recently added such support experimentally on Java and so far had good results, so we may soon promote it across the board.
我们最近通过实验在Java上添加了这种支持,到目前为止效果很好,因此我们可能很快全面推广。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.