Created
December 22, 2024 22:37
-
-
Save rudiedirkx/e6a1addec077ac31f9b2fbd508fa6c2e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$output = trim(file_get_contents('php://stdin')); | |
$lines = explode("\n", $output); | |
$counts = []; | |
$lastFile = null; | |
foreach ($lines as $line) { | |
if (preg_match('#^ Line \s+ (.+)#', $line, $match)) { | |
$lastFile = trim($match[1]); | |
$counts[$lastFile] = 0; | |
} | |
elseif (preg_match('#^ \d+ #', $line, $match)) { | |
$counts[$lastFile]++; | |
} | |
} | |
// print_r($counts); | |
foreach ($counts as $file => $count) { | |
printf("% 4d %s\n", $count, $file); | |
} | |
printf("\nTotal errors: %d\n\n", array_sum($counts)); | |
exit($counts ? 1 : 0); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment