Skip to content

Commit 09b870b

Browse files
committed
Add severity to output
1 parent becc472 commit 09b870b

File tree

4 files changed

+5
-2
lines changed

4 files changed

+5
-2
lines changed

psalm.xml.dist

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
55
autoloader="vendor/squizlabs/php_codesniffer/autoload.php"
66
errorLevel="2"
7+
findUnusedPsalmSuppress="true"
8+
findUnusedVariablesAndParams="true"
79
resolveFromConfigFile="true"
810
>
911
<projectFiles>

src/Report/Gitlab.php

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public function generateFileReport($report, File $phpcsFile, $showSources = fals
3535
'categories' => ['Style'],
3636
'check_name' => $error['source'],
3737
'fingerprint' => md5($report['filename'] . $error['message'] . $line . $column),
38+
'severity' => $error['type'] === 'ERROR' ? 'major' : 'minor',
3839
'description' => str_replace(["\n", "\r", "\t"], ['\n', '\r', '\t'], $error['message']),
3940
'location' => [
4041
'path' => $report['filename'],

tests/Fixtures/MixedViolations.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,6 @@ public function getReportData(): array
4747

4848
public function getExpectedOutput(): string
4949
{
50-
return '{"type":"issue","categories":["Style"],"check_name":"PSR12.Functions.ReturnTypeDeclaration.SpaceBeforeReturnType","fingerprint":"766bf1f7eff186fd667447bfb0291078","description":"There must be a single space between the colon and type in a return type declaration","location":{"path":"tests/Report/GitlabTest.php","lines":{"begin":23,"end":23}}},{"type":"issue","categories":["Style"],"check_name":"Generic.Files.LineLength.TooLong","fingerprint":"517eda4b85a33cd09fc933259f873191","description":"Line exceeds 120 characters; contains 124 characters","location":{"path":"tests/Report/GitlabTest.php","lines":{"begin":34,"end":34}}},';
50+
return '{"type":"issue","categories":["Style"],"check_name":"PSR12.Functions.ReturnTypeDeclaration.SpaceBeforeReturnType","fingerprint":"766bf1f7eff186fd667447bfb0291078","severity":"major","description":"There must be a single space between the colon and type in a return type declaration","location":{"path":"tests/Report/GitlabTest.php","lines":{"begin":23,"end":23}}},{"type":"issue","categories":["Style"],"check_name":"Generic.Files.LineLength.TooLong","fingerprint":"517eda4b85a33cd09fc933259f873191","severity":"minor","description":"Line exceeds 120 characters; contains 124 characters","location":{"path":"tests/Report/GitlabTest.php","lines":{"begin":34,"end":34}}},';
5151
}
5252
}

tests/Fixtures/SingleViolation.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,6 @@ public function getReportData(): array
3636

3737
public function getExpectedOutput(): string
3838
{
39-
return '{"type":"issue","categories":["Style"],"check_name":"PSR12.Files.FileHeader.SpacingInsideBlock","fingerprint":"21f4cd5b7d88d9eb67402be5d56caa8b","description":"Header blocks must not contain blank lines","location":{"path":"src/Report/Gitlab.php","lines":{"begin":18,"end":18}}},';
39+
return '{"type":"issue","categories":["Style"],"check_name":"PSR12.Files.FileHeader.SpacingInsideBlock","fingerprint":"21f4cd5b7d88d9eb67402be5d56caa8b","severity":"major","description":"Header blocks must not contain blank lines","location":{"path":"src/Report/Gitlab.php","lines":{"begin":18,"end":18}}},';
4040
}
4141
}

0 commit comments

Comments
 (0)