Wednesday, October 10, 2012

PHP Copy and Paste detection tool installation

In order to install it you will need to:

1. Upgrade to latest PHPUnit 3.7
2. Install (see instructions inside)
3. Install (see instructions inside)

Then you can run it like:

$ phpcpd /path/to/project/directory

You will see the copy&paste report:

Found 3 exact clones with 53 duplicated lines in 5 files:

  - /usr/local/src/phpunit/PHPUnit/Framework/Constraint/Or.php:136-157

  - /usr/local/src/phpunit/PHPUnit/Framework/Constraint/Or.php:136-157

  - /usr/local/src/phpunit/PHPUnit/Framework/Comparator/Scalar.php:121-132

0.19% duplicated lines out of 27640 total lines of code.