aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts/linters/lint
blob: 5f59945d6254130318e0aef500015d5f46c5f81a (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
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/env php
<?php

declare(strict_types=1);

require __DIR__ . '/vendor/autoload.php';

use Shirabe\Lint\Linters\CargoWorkspaceDependencies;
use Shirabe\Lint\Linters\ContiguousUseBlock;
use Shirabe\Lint\Linters\NoBannedUse;
use Shirabe\Lint\Linters\NoDecorativeSectionComment;
use Shirabe\Lint\Linters\NoExceptionDowncast;
use Shirabe\Lint\Linters\NoFormatTrailingComma;
use Shirabe\Lint\Linters\NoModRs;
use Shirabe\Lint\Linters\NoStdCollectionsMaps;
use Shirabe\Lint\Linters\NoUseAsAlias;
use Shirabe\Lint\Linters\PhpSrcDerivationBoundary;
use Shirabe\Lint\Linters\SortedDependencies;
use Shirabe\Lint\Runner;

$rootDir = dirname(__DIR__, 2);

$runner = new Runner($rootDir, [
    [new CargoWorkspaceDependencies(), []],
    [new ContiguousUseBlock(), []],
    [new NoBannedUse(), []],
    [new NoDecorativeSectionComment(), [
        'crates/shirabe-semver/src/version_parser.rs',
    ]],
    [new NoExceptionDowncast(), [
        // Defines the box and the walk the rule points at.
        'crates/shirabe-php-shim/src/exception.rs',
        // Downcast a panic payload, not an error: PHP's error handler throws an \ErrorException
        // where these call sites `catch` it.
        'crates/shirabe/src/cache.rs',
        'crates/shirabe/src/util/filesystem.rs',
    ]],
    [new NoFormatTrailingComma(), [
        'crates/shirabe/src/package/loader/root_package_loader.rs',
        'crates/shirabe-spdx-licenses/src/spdx_licenses.rs',
    ]],
    [new NoModRs(), []],
    [new NoStdCollectionsMaps(), []],
    [new NoUseAsAlias(), []],
    [new PhpSrcDerivationBoundary(), []],
    [new SortedDependencies(), []],
]);

exit($runner->run() ? 0 : 1);