-
-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy path.php-cs-fixer-custom.php
More file actions
129 lines (120 loc) · 5.41 KB
/
.php-cs-fixer-custom.php
File metadata and controls
129 lines (120 loc) · 5.41 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<?php
/** @noinspection PhpPossiblePolymorphicInvocationInspection */
/** @noinspection PhpUnusedAliasInspection */
declare(strict_types=1);
/**
* Copyright (c) 2020-2026 guanguans<ityaozm@gmail.com>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*
* @see https://github.com/guanguans/laravel-soar
*/
use Guanguans\PhpCsFixerCustomFixers\Fixer\CommandLineTool\AbstractCommandLineToolFixer;
use Guanguans\PhpCsFixerCustomFixers\Fixer\CommandLineTool\AutocorrectFixer;
use Guanguans\PhpCsFixerCustomFixers\Fixer\CommandLineTool\BladeFormatterFixer;
use Guanguans\PhpCsFixerCustomFixers\Fixer\CommandLineTool\DockerfmtFixer;
use Guanguans\PhpCsFixerCustomFixers\Fixer\CommandLineTool\DotenvLinterFixer;
use Guanguans\PhpCsFixerCustomFixers\Fixer\CommandLineTool\LintMdFixer;
use Guanguans\PhpCsFixerCustomFixers\Fixer\CommandLineTool\MarkdownlintCli2Fixer;
use Guanguans\PhpCsFixerCustomFixers\Fixer\CommandLineTool\MarkdownlintFixer;
use Guanguans\PhpCsFixerCustomFixers\Fixer\CommandLineTool\PintFixer;
use Guanguans\PhpCsFixerCustomFixers\Fixer\CommandLineTool\ShfmtFixer;
use Guanguans\PhpCsFixerCustomFixers\Fixer\CommandLineTool\SqlfluffFixer;
use Guanguans\PhpCsFixerCustomFixers\Fixer\CommandLineTool\SqruffFixer;
use Guanguans\PhpCsFixerCustomFixers\Fixer\CommandLineTool\TextlintFixer;
use Guanguans\PhpCsFixerCustomFixers\Fixer\CommandLineTool\TombiFixer;
use Guanguans\PhpCsFixerCustomFixers\Fixer\CommandLineTool\TyposFixer;
use Guanguans\PhpCsFixerCustomFixers\Fixer\CommandLineTool\XmllintFixer;
use Guanguans\PhpCsFixerCustomFixers\Fixer\CommandLineTool\YamlfmtFixer;
use Guanguans\PhpCsFixerCustomFixers\Fixer\CommandLineTool\ZhlintFixer;
use Guanguans\PhpCsFixerCustomFixers\Fixer\InlineHtml\JsonFixer;
use Guanguans\PhpCsFixerCustomFixers\Fixer\InlineHtml\SqlOfDoctrineSqlFormatterFixer;
use Guanguans\PhpCsFixerCustomFixers\Fixer\InlineHtml\SqlOfPhpmyadminSqlParserFixer;
use Guanguans\PhpCsFixerCustomFixers\Fixers;
use PhpCsFixer\Config;
use PhpCsFixer\Finder;
use PhpCsFixer\Runner\Parallel\ParallelConfigFactory;
return (new Config)
->registerCustomFixers($fixers = Fixers::make())
->setRules([
'encoding' => true,
'no_trailing_whitespace' => true,
'no_whitespace_in_blank_line' => true,
'non_printable_character' => true,
'single_blank_line_at_eof' => true,
AutocorrectFixer::name() => true,
LintMdFixer::name() => true,
// MarkdownlintCli2Fixer::name() => true,
MarkdownlintFixer::name() => true,
// TextlintFixer::name() => true,
ZhlintFixer::name() => true,
// PintFixer::name() => true,
// BladeFormatterFixer::name() => [ // Custom BladeFormatterFixer configuration
// AbstractCommandLineToolFixer::COMMAND => ['path/to/node', 'path/to/blade-formatter'],
// AbstractCommandLineToolFixer::OPTIONS => [
// '--config' => 'path/to/.bladeformatterrc',
// '--extra-liners' => true,
// '--indent-size' => 2,
// // ...
// ],
// ],
BladeFormatterFixer::name() => true, // Default BladeFormatterFixer configuration
SqlOfDoctrineSqlFormatterFixer::name() => true,
// SqlOfPhpmyadminSqlParserFixer::name() => true,
// SqruffFixer::name() => true,
// SqlfluffFixer::name() => true,
// SqlfluffFixer::name() => [
// AbstractCommandLineToolFixer::OPTIONS => [
// '--dialect' => 'mysql',
// ],
// AbstractCommandLineToolFixer::EXTENSIONS => ['sql'],
// ],
DockerfmtFixer::name() => true,
DotenvLinterFixer::name() => true,
JsonFixer::name() => true,
ShfmtFixer::name() => true,
TombiFixer::name() => true,
TyposFixer::name() => true,
XmllintFixer::name() => true,
YamlfmtFixer::name() => true,
])
->setFinder(
Finder::create()
->in(__DIR__)
->exclude([
'__snapshots__/',
'Fixtures/',
'vendor-bin/',
])
->notPath([
'.chglog/CHANGELOG.tpl.md',
'CHANGELOG.md',
// 'composer.json',
'README-zh_CN.md',
'README.md',
])
->name($fixers->extensionPatterns())
->notName([
'/\-overview\.md$/',
'/\.lock$/',
'/\-lock\.json$/',
// '/\.php$/',
'/(?<!\.blade)\.php$/',
// Exclude temporary files created by `zhlint` in the current working directory.
'/zhlint\-.*\..*$/',
])
->ignoreDotFiles(false)
->ignoreUnreadableDirs(false)
->ignoreVCS(true)
->ignoreVCSIgnored(true)
/** @see \Symfony\Component\Finder\Iterator\SortableIterator::__construct() */
// ->sortByExtension()
->sort(static fn (SplFileInfo $a, SplFileInfo $b): int => strnatcmp($a->getExtension(), $b->getExtension()))
)
->setCacheFile(\sprintf('%s/.build/php-cs-fixer/%s.cache', __DIR__, pathinfo(__FILE__, \PATHINFO_FILENAME)))
// ->setParallelConfig(ParallelConfigFactory::sequential())
->setParallelConfig(ParallelConfigFactory::detect())
->setRiskyAllowed(true)
->setUnsupportedPhpVersionAllowed(true)
->setUsingCache(true);