mirror of
https://github.com/danog/psalm.git
synced 2024-11-26 20:34:47 +01:00
parent
dc80880a80
commit
fa65ab8168
2
.github/workflows/shepherd.yml
vendored
2
.github/workflows/shepherd.yml
vendored
@ -15,4 +15,4 @@ jobs:
|
||||
COMPOSER_ROOT_VERSION: dev-master
|
||||
|
||||
- name: Run Psalm
|
||||
run: ./psalm --threads=2 --shepherd
|
||||
run: ./psalm --threads=2 --output-format=github --shepherd
|
||||
|
@ -18,6 +18,7 @@ use Psalm\Report\CheckstyleReport;
|
||||
use Psalm\Report\CompactReport;
|
||||
use Psalm\Report\ConsoleReport;
|
||||
use Psalm\Report\EmacsReport;
|
||||
use Psalm\Report\GithubActionsReport;
|
||||
use Psalm\Report\JsonReport;
|
||||
use Psalm\Report\JsonSummaryReport;
|
||||
use Psalm\Report\JunitReport;
|
||||
@ -673,6 +674,10 @@ class IssueBuffer
|
||||
case Report::TYPE_CONSOLE:
|
||||
$output = new ConsoleReport($normalized_data, self::$fixable_issue_counts, $report_options);
|
||||
break;
|
||||
|
||||
case Report::TYPE_GITHUB_ACTIONS:
|
||||
$output = new GithubActionsReport($normalized_data, self::$fixable_issue_counts, $report_options);
|
||||
break;
|
||||
}
|
||||
|
||||
return $output->create();
|
||||
|
@ -16,6 +16,7 @@ abstract class Report
|
||||
const TYPE_JUNIT = 'junit';
|
||||
const TYPE_CHECKSTYLE = 'checkstyle';
|
||||
const TYPE_TEXT = 'text';
|
||||
const TYPE_GITHUB_ACTIONS = 'github';
|
||||
|
||||
const SUPPORTED_OUTPUT_TYPES = [
|
||||
self::TYPE_COMPACT,
|
||||
@ -29,6 +30,7 @@ abstract class Report
|
||||
self::TYPE_JUNIT,
|
||||
self::TYPE_CHECKSTYLE,
|
||||
self::TYPE_TEXT,
|
||||
self::TYPE_GITHUB_ACTIONS,
|
||||
];
|
||||
|
||||
/**
|
||||
|
29
src/Psalm/Report/GithubActionsReport.php
Normal file
29
src/Psalm/Report/GithubActionsReport.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
namespace Psalm\Report;
|
||||
|
||||
use Psalm\Config;
|
||||
use Psalm\Report;
|
||||
use function sprintf;
|
||||
|
||||
class GithubActionsReport extends Report
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function create(): string
|
||||
{
|
||||
$output = '';
|
||||
foreach ($this->issues_data as $issue_data) {
|
||||
$output .= sprintf(
|
||||
'::%s file=%s,line=%s,col=%s::%s',
|
||||
($issue_data['severity'] === Config::REPORT_ERROR ? 'error' : 'warning'),
|
||||
$issue_data['file_name'],
|
||||
$issue_data['line_from'],
|
||||
$issue_data['column_from'],
|
||||
$issue_data['message']
|
||||
) . "\n";
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
}
|
@ -334,7 +334,7 @@ Output:
|
||||
|
||||
--output-format=console
|
||||
Changes the output format.
|
||||
Available formats: compact, console, emacs, json, pylint, xml, checkstyle, junit, sonarqube
|
||||
Available formats: compact, console, emacs, json, pylint, xml, checkstyle, junit, sonarqube, github
|
||||
|
||||
--no-progress
|
||||
Disable the progress indicator
|
||||
|
Loading…
Reference in New Issue
Block a user