1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-22 22:01:48 +01:00

Added issue type and psalm.dev link to Emacs report

Fixes vimeo/psalm#8331
This commit is contained in:
Bruce Weirdan 2023-02-14 21:19:29 -04:00
parent 47eb024007
commit 1ab02125b0
No known key found for this signature in database
GPG Key ID: CFC3AAB181751B0D
2 changed files with 11 additions and 7 deletions

View File

@ -14,12 +14,14 @@ final class EmacsReport extends Report
$output = '';
foreach ($this->issues_data as $issue_data) {
$output .= sprintf(
'%s:%s:%s:%s - %s',
'%s:%s:%s:%s - %s: %s (see %s)',
$issue_data->file_path,
$issue_data->line_from,
$issue_data->column_from,
($issue_data->severity === Config::REPORT_ERROR ? 'error' : 'warning'),
$issue_data->type,
$issue_data->message,
$issue_data->link,
) . "\n";
}

View File

@ -963,12 +963,14 @@ echo $a;';
$emacs_report_options = ProjectAnalyzer::getFileReportOptions([__DIR__ . '/test-report.emacs'])[0];
$this->assertSame(
'somefile.php:3:10:error - Cannot find referenced variable $as_you_____type
somefile.php:3:10:error - Could not infer a return type
somefile.php:2:42:error - Could not verify return type \'null|string\' for psalmCanVerify
somefile.php:8:6:error - Const CHANGE_ME is not defined
somefile.php:17:6:warning - Possibly undefined global variable $a, first seen on line 11
',
<<<'EOF'
somefile.php:3:10:error - UndefinedVariable: Cannot find referenced variable $as_you_____type (see https://psalm.dev/024)
somefile.php:3:10:error - MixedReturnStatement: Could not infer a return type (see https://psalm.dev/138)
somefile.php:2:42:error - MixedInferredReturnType: Could not verify return type 'null|string' for psalmCanVerify (see https://psalm.dev/047)
somefile.php:8:6:error - UndefinedConstant: Const CHANGE_ME is not defined (see https://psalm.dev/020)
somefile.php:17:6:warning - PossiblyUndefinedGlobalVariable: Possibly undefined global variable $a, first seen on line 11 (see https://psalm.dev/126)
EOF,
IssueBuffer::getOutput(IssueBuffer::getIssuesData(), $emacs_report_options),
);
}