Skip to content

Commit 1197974

Browse files
Add severity key in Phan converter
Reported errors by Phan are not recognized by Gitlab Code Quality due to missing severity key in the generated Code Climate nodes. See https://docs.gitlab.com/ee/user/project/merge_requests/code_quality.html#implementing-a-custom-tool for a description of the required elements
1 parent 831ac87 commit 1197974

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/Phan/PhanConvertToSubset.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@
99

1010
final class PhanConvertToSubset extends AbstractConverter
1111
{
12+
private const SEVERITY_LEVELS = [
13+
0 => 'info',
14+
5 => 'minor',
15+
10 => 'critical'
16+
];
17+
1218
public function convertToSubset(): void
1319
{
1420
try {
@@ -22,6 +28,7 @@ public function convertToSubset(): void
2228
$node->location->path,
2329
$node->location->lines->begin
2430
),
31+
'severity' => self::SEVERITY_LEVELS[$node->severity] ?? null,
2532
'location' => [
2633
'path' => $node->location->path,
2734
'lines' => [

0 commit comments

Comments
 (0)