coffee-with-milk
coffee-with-milk

Reputation: 3

How can I exclude blocks in XML files using CPD?

In a large project multiple android resources are used. It now happens that there are resources copied. I want to detect these copies using 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 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.

Anybody any hints?

Upvotes: 0

Views: 215

Answers (1)

Johnco
Johnco

Reputation: 4160

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.

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.

Upvotes: 0

Related Questions