From 632db8ce5b1ac147d672c2eb5fd47410f871ba15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Can=20Geli=C5=9F?= Date: Mon, 19 May 2014 20:00:31 +0300 Subject: [PATCH] Fix file ignore phpcpd phpcpd's --exclude parameter only accepts "folders". Files should be used with --names-exclude. --- PHPCI/Plugin/PhpCpd.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/PHPCI/Plugin/PhpCpd.php b/PHPCI/Plugin/PhpCpd.php index 9325efa6..0279b8f4 100644 --- a/PHPCI/Plugin/PhpCpd.php +++ b/PHPCI/Plugin/PhpCpd.php @@ -66,7 +66,15 @@ class PhpCpd implements \PHPCI\Plugin $ignore = ''; if (count($this->ignore)) { $map = function ($item) { - return ' --exclude ' . (substr($item, -1) == '/' ? substr($item, 0, -1) : $item); + // remove the trailing slash + $item = (substr($item, -1) == '/' ? substr($item, 0, -1) : $item); + + if (is_file($this->path . '/' . $item)) { + return ' --names-exclude ' . $item; + } else { + return ' --exclude ' . $item; + } + }; $ignore = array_map($map, $this->ignore);