From 34ea46e1395ccfa73e273aa971440594adcf7a36 Mon Sep 17 00:00:00 2001 From: Claus Due Date: Sat, 12 Apr 2014 17:28:52 +0200 Subject: [PATCH] Preserve absolute paths in Plugin.PhpMessDetector Before: all paths, including absolute paths, were treated relative to build directory. After: any absolute path is not prefixed with the build directory path; it gets used as-is. --- PHPCI/Plugin/PhpMessDetector.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/PHPCI/Plugin/PhpMessDetector.php b/PHPCI/Plugin/PhpMessDetector.php index 89c22f66..c634c238 100755 --- a/PHPCI/Plugin/PhpMessDetector.php +++ b/PHPCI/Plugin/PhpMessDetector.php @@ -32,7 +32,8 @@ class PhpMessDetector implements \PHPCI\Plugin /** * @var string, based on the assumption the root may not hold the code to be - * tested, exteds the base path + * tested, exteds the base path only if the provided path is relative. Absolute + * paths are used verbatim */ protected $path; @@ -97,11 +98,16 @@ class PhpMessDetector implements \PHPCI\Plugin $this->phpci->logFailure('Could not find phpmd.'); return false; } + + $path = $this->phpci->buildPath . $this->path; + if ($this->path{0} == '/') { + $path = $this->path; + } $cmd = $phpmd . ' "%s" text %s %s %s'; $success = $this->phpci->executeCommand( $cmd, - $this->phpci->buildPath . $this->path, + $path, implode(',', $this->rules), $ignore, $suffixes