From c4c674b9143847eafc6c3347aa6ff58651348517 Mon Sep 17 00:00:00 2001 From: Laurent Laville Date: Sun, 2 Jun 2024 13:04:18 +0000 Subject: [PATCH] up-to-date report list --- .../Internal/Analyzer/ProjectAnalyzer.php | 16 +-------------- src/Psalm/Internal/Cli/Psalm.php | 8 ++++++-- src/Psalm/Report.php | 20 +++++++++++++++++++ 3 files changed, 27 insertions(+), 17 deletions(-) diff --git a/src/Psalm/Internal/Analyzer/ProjectAnalyzer.php b/src/Psalm/Internal/Analyzer/ProjectAnalyzer.php index ed22c279d97..d5e9d090dc4 100644 --- a/src/Psalm/Internal/Analyzer/ProjectAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/ProjectAnalyzer.php @@ -329,21 +329,7 @@ public static function getFileReportOptions(array $report_file_paths, bool $show { $report_options = []; - $mapping = [ - 'checkstyle.xml' => Report::TYPE_CHECKSTYLE, - 'sonarqube.json' => Report::TYPE_SONARQUBE, - 'codeclimate.json' => Report::TYPE_CODECLIMATE, - 'summary.json' => Report::TYPE_JSON_SUMMARY, - 'junit.xml' => Report::TYPE_JUNIT, - '.xml' => Report::TYPE_XML, - '.json' => Report::TYPE_JSON, - '.txt' => Report::TYPE_TEXT, - '.emacs' => Report::TYPE_EMACS, - '.pylint' => Report::TYPE_PYLINT, - '.console' => Report::TYPE_CONSOLE, - '.sarif' => Report::TYPE_SARIF, - 'count.txt' => Report::TYPE_COUNT, - ]; + $mapping = Report::getMapping(); foreach ($report_file_paths as $report_file_path) { foreach ($mapping as $extension => $type) { diff --git a/src/Psalm/Internal/Cli/Psalm.php b/src/Psalm/Internal/Cli/Psalm.php index e9156795953..dcfb903787e 100644 --- a/src/Psalm/Internal/Cli/Psalm.php +++ b/src/Psalm/Internal/Cli/Psalm.php @@ -37,6 +37,7 @@ use function array_filter; use function array_key_exists; +use function array_keys; use function array_map; use function array_merge; use function array_slice; @@ -1264,6 +1265,10 @@ private static function getHelpText(): string sort($formats); $outputFormats = wordwrap(implode(', ', $formats), 75, "\n "); + $reports = array_keys(Report::getMapping()); + sort($reports); + $reportFormats = wordwrap('"' . implode('", "', $reports) . '"', 75, "\n "); + return << self::TYPE_CHECKSTYLE, + 'sonarqube.json' => self::TYPE_SONARQUBE, + 'codeclimate.json' => self::TYPE_CODECLIMATE, + 'summary.json' => self::TYPE_JSON_SUMMARY, + 'junit.xml' => self::TYPE_JUNIT, + '.xml' => self::TYPE_XML, + '.sarif.json' => self::TYPE_SARIF, + '.json' => self::TYPE_JSON, + '.txt' => self::TYPE_TEXT, + '.emacs' => self::TYPE_EMACS, + '.pylint' => self::TYPE_PYLINT, + '.console' => self::TYPE_CONSOLE, + '.sarif' => self::TYPE_SARIF, + 'count.txt' => self::TYPE_COUNT, + ]; + } }