From c7c4fdc32fd15447207fe824f28112da2db9061b Mon Sep 17 00:00:00 2001 From: Ivan Smolin Date: Wed, 3 May 2017 11:04:50 +0300 Subject: [PATCH] add copy-paste detection warnings generator script --- cpd_script.php | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 cpd_script.php diff --git a/cpd_script.php b/cpd_script.php new file mode 100644 index 0000000..4516660 --- /dev/null +++ b/cpd_script.php @@ -0,0 +1,10 @@ +duplication as $duplication) { + $files = $duplication->xpath('file'); + foreach ($files as $file) { + echo $file['path'].':'.$file['line'].':1: warning: '.$duplication['lines'].' copy-pasted lines from: ' + .implode(', ', array_map(function ($otherFile) { return $otherFile['path'].':'.$otherFile['line']; }, + array_filter($files, function ($f) use (&$file) { return $f != $file; }))).PHP_EOL; + } +} +?>