blob: ae2d84ed8df9afeef00e9f2c513bfc388914b671 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
<?php
declare(strict_types=1);
namespace Shirabe\Lint;
final class Runner
{
/** @param list<array{0: Linter, 1: list<string>}> $linters */
public function __construct(
private readonly string $rootDir,
private readonly array $linters,
) {
}
public function run(): bool
{
$allPassed = true;
foreach ($this->linters as [$linter, $excludes]) {
echo "===== {$linter->name()} =====\n";
$errors = $linter->check($this->rootDir, $excludes);
if ($errors === []) {
echo "Passed.\n";
} else {
echo $linter->failureIntro(), "\n";
foreach ($errors as $error) {
echo " {$error}\n";
}
$allPassed = false;
}
echo "\n";
}
return $allPassed;
}
}
|