These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /** |
||
3 | * This file is part of PHP Mess Detector. |
||
4 | * |
||
5 | * Copyright (c) Manuel Pichler <[email protected]>. |
||
6 | * All rights reserved. |
||
7 | * |
||
8 | * Licensed under BSD License |
||
9 | * For full copyright and license information, please see the LICENSE file. |
||
10 | * Redistributions of files must retain the above copyright notice. |
||
11 | * |
||
12 | * @author Lukas Bestle <[email protected]> |
||
13 | * @copyright Manuel Pichler. All rights reserved. |
||
14 | * @license https://opensource.org/licenses/bsd-license.php BSD License |
||
15 | * @link http://phpmd.org/ |
||
16 | */ |
||
17 | |||
18 | namespace PHPMD\Renderer; |
||
19 | |||
20 | use PHPMD\AbstractRenderer; |
||
21 | use PHPMD\Report; |
||
22 | |||
23 | /** |
||
24 | * This renderer outputs all violations in a format that GitHub Actions |
||
25 | * understands to display and highlight as problems. |
||
26 | */ |
||
27 | class GitHubRenderer extends AbstractRenderer |
||
28 | { |
||
29 | /** |
||
30 | * This method will be called when the engine has finished the source analysis |
||
31 | * phase. |
||
32 | * |
||
33 | * @param \PHPMD\Report $report |
||
34 | * @return void |
||
35 | */ |
||
36 | public function renderReport(Report $report) |
||
37 | { |
||
38 | $writer = $this->getWriter(); |
||
39 | |||
40 | View Code Duplication | foreach ($report->getRuleViolations() as $violation) { |
|
0 ignored issues
–
show
|
|||
41 | $writer->write('::warning file='); |
||
42 | $writer->write($violation->getFileName()); |
||
43 | $writer->write(',line='); |
||
44 | $writer->write($violation->getBeginLine()); |
||
45 | $writer->write('::'); |
||
46 | $writer->write($violation->getDescription()); |
||
47 | $writer->write(PHP_EOL); |
||
48 | } |
||
49 | |||
50 | View Code Duplication | foreach ($report->getErrors() as $error) { |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository.
Loading history...
|
|||
51 | $writer->write('::error file='); |
||
52 | $writer->write($error->getFile()); |
||
53 | $writer->write('::'); |
||
54 | $writer->write($error->getMessage()); |
||
55 | $writer->write(PHP_EOL); |
||
56 | } |
||
57 | } |
||
58 | } |
||
59 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.