1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
4
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
5
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
6
|
|
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
7
|
|
|
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
8
|
|
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
9
|
|
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
10
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
11
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
12
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
13
|
|
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
14
|
|
|
* |
15
|
|
|
* This software consists of voluntary contributions made by many individuals |
16
|
|
|
* and is licensed under the LGPL. For more information please see |
17
|
|
|
* <http://phing.info>. |
18
|
|
|
*/ |
19
|
|
|
|
20
|
|
|
use Phing\Exception\BuildException; |
21
|
|
|
use Phing\Io\File; |
22
|
|
|
use Phing\Project; |
23
|
|
|
use SebastianBergmann\PHPCPD\CodeCloneMap; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* Prints PMD-XML output of phpcpd run |
27
|
|
|
* |
28
|
|
|
* @author Benjamin Schultz <[email protected]> |
29
|
|
|
* |
30
|
|
|
* @package phing.tasks.ext.phpcpd.formatter |
31
|
|
|
*/ |
32
|
|
|
class PMDPHPCPDResultFormatter extends PHPCPDResultFormatter |
33
|
|
|
{ |
34
|
|
|
/** |
35
|
|
|
* Processes a list of clones. |
36
|
|
|
* |
37
|
|
|
* @param PHPCPD_CloneMap|CodeCloneMap $clones |
|
|
|
|
38
|
|
|
* @param Project $project |
39
|
|
|
* @param boolean $useFile |
40
|
|
|
* @param File|null $outFile |
41
|
|
|
* |
42
|
|
|
* @throws BuildException |
43
|
|
|
*/ |
44
|
1 |
|
public function processClones($clones, Project $project, $useFile = false, $outFile = null) |
45
|
|
|
{ |
46
|
1 |
|
if (!$useFile || empty($outFile)) { |
47
|
|
|
throw new BuildException('Output filename required for this formatter'); |
48
|
|
|
} |
49
|
|
|
|
50
|
1 |
|
if (get_class($clones) == 'PHPCPD_CloneMap') { |
51
|
|
|
$logger = new PHPCPD_Log_XML_PMD($outFile); |
|
|
|
|
52
|
|
|
} else { |
53
|
1 |
|
$logger = new \SebastianBergmann\PHPCPD\Log\PMD($outFile); |
54
|
|
|
} |
55
|
|
|
|
56
|
1 |
|
$logger->processClones($clones); |
57
|
1 |
|
} |
58
|
|
|
} |
59
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths