From f1cad86dfdc60463bdbbf0d59a6f9dad51a72890 Mon Sep 17 00:00:00 2001 From: Peter Wilson Date: Fri, 7 Feb 2025 15:55:42 +1100 Subject: [PATCH 1/2] PHPBCF: Show `no errors were found` when there are no errors to fix. Modifies the output of PHPCBF when the exiting without fixing any errors to show a message indicating that the reasons was due to no coding standards violations in the code base. --- src/Reports/Cbf.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Reports/Cbf.php b/src/Reports/Cbf.php index d3b70fab62..acb664f29d 100644 --- a/src/Reports/Cbf.php +++ b/src/Reports/Cbf.php @@ -149,7 +149,12 @@ public function generate( array_pop($lines); if (empty($lines) === true) { - echo PHP_EOL.'No fixable errors were found'.PHP_EOL; + if (($totalErrors + $totalWarnings) === 0) { + echo PHP_EOL.'No errors were found'.PHP_EOL; + } else { + echo PHP_EOL.'No fixable errors were found'.PHP_EOL; + } + return; } From ff976e83279d45267fbc624333d13174f15a54f2 Mon Sep 17 00:00:00 2001 From: Peter Wilson Date: Sat, 8 Feb 2025 09:30:16 +1100 Subject: [PATCH 2/2] Modify no error output for clarity when scanning. --- src/Reports/Cbf.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Reports/Cbf.php b/src/Reports/Cbf.php index acb664f29d..9f2ba84061 100644 --- a/src/Reports/Cbf.php +++ b/src/Reports/Cbf.php @@ -150,7 +150,7 @@ public function generate( if (empty($lines) === true) { if (($totalErrors + $totalWarnings) === 0) { - echo PHP_EOL.'No errors were found'.PHP_EOL; + echo PHP_EOL.'No violations were found'.PHP_EOL; } else { echo PHP_EOL.'No fixable errors were found'.PHP_EOL; }