forked from tomasnorre/crawler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ecs.php
95 lines (75 loc) · 3.91 KB
/
ecs.php
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
<?php
declare(strict_types=1);
use PHP_CodeSniffer\Standards\Generic\Sniffs\Metrics\CyclomaticComplexitySniff;
use PhpCsFixer\Fixer\ArrayNotation\ArraySyntaxFixer;
use PhpCsFixer\Fixer\Import\NoLeadingImportSlashFixer;
use PhpCsFixer\Fixer\Import\NoUnusedImportsFixer;
use PhpCsFixer\Fixer\Import\OrderedImportsFixer;
use PhpCsFixer\Fixer\Operator\BinaryOperatorSpacesFixer;
use PhpCsFixer\Fixer\Operator\ConcatSpaceFixer;
use PhpCsFixer\Fixer\Operator\TernaryOperatorSpacesFixer;
use PhpCsFixer\Fixer\Operator\UnaryOperatorSpacesFixer;
use PhpCsFixer\Fixer\PhpUnit\PhpUnitStrictFixer;
use PhpCsFixer\Fixer\PhpUnit\PhpUnitTestAnnotationFixer;
use PhpCsFixer\Fixer\Phpdoc\AlignMultilineCommentFixer;
use PhpCsFixer\Fixer\Phpdoc\GeneralPhpdocAnnotationRemoveFixer;
use PhpCsFixer\Fixer\Phpdoc\NoBlankLinesAfterPhpdocFixer;
use PhpCsFixer\Fixer\Whitespace\NoExtraBlankLinesFixer;
use Symplify\CodingStandard\Fixer\ArrayNotation\StandaloneLineInMultilineArrayFixer;
use Symplify\EasyCodingStandard\Config\ECSConfig;
use Symplify\EasyCodingStandard\ValueObject\Option;
use Symplify\EasyCodingStandard\ValueObject\Set\SetList;
return static function (ECSConfig $ecsConfig): void {
$parameters = $ecsConfig->parameters();
$ecsConfig->import(SetList::PSR_12);
$ecsConfig->import(SetList::COMMON);
$parameters->set(Option::SKIP,
[
__DIR__ . '/Tests/Acceptance/Support/_generated',
'PhpCsFixer\Fixer\ClassNotation\ClassAttributesSeparationFixer' => null,
'PhpCsFixer\Fixer\Whitespace\ArrayIndentationFixer' => null,
'PhpCsFixer\Fixer\FunctionNotation\MethodArgumentSpaceFixer' => null,
'PhpCsFixer\Fixer\Strict\StrictParamFixer' => null,
'PHP_CodeSniffer\Standards\Generic\Sniffs\CodeAnalysis\AssignmentInConditionSniff.FoundInWhileCondition' => null,
PhpUnitStrictFixer::class => null,
PhpUnitTestAnnotationFixer::class => null,
'SlevomatCodingStandard\Sniffs\Classes\TraitUseSpacingSniff.IncorrectLinesCountAfterLastUse' => null,
'Symplify\CodingStandard\Fixer\ArrayNotation\ArrayOpenerAndCloserNewlineFixer' => null,
'Symplify\CodingStandard\Fixer\ArrayNotation\ArrayListItemNewlineFixer' => null,
UnaryOperatorSpacesFixer::class => null,
StandaloneLineInMultilineArrayFixer::class => null,
PhpCsFixer\Fixer\Operator\NotOperatorWithSuccessorSpaceFixer::class => null,
'PHP_CodeSniffer\Standards\Generic\Sniffs\CodeAnalysis\AssignmentInConditionSniff.Found' => null,
]
);
$parameters->set(
Option::PATHS,
[
__DIR__ . '/Classes',
__DIR__ . '/Configuration',
__DIR__ . '/Tests',
]
);
$services = $ecsConfig->services();
$services->set(ArraySyntaxFixer::class)
->call('configure', [['syntax' => 'short']]);
$services->set(ConcatSpaceFixer::class)
->call('configure', [['spacing' => 'one']]);
$services->set(BinaryOperatorSpacesFixer::class)
->call('configure', [['default' => 'single_space']]);
$services->set(NoExtraBlankLinesFixer::class);
$services->set(TernaryOperatorSpacesFixer::class);
$services->set(NoBlankLinesAfterPhpdocFixer::class);
$services->set(AlignMultilineCommentFixer::class)
->call('configure', [['comment_type' => 'phpdocs_only']]);
$services->set(GeneralPhpdocAnnotationRemoveFixer::class)
->call('configure', [['annotations' => ['author', 'since']]]);
$services->set(NoLeadingImportSlashFixer::class);
$services->set(NoUnusedImportsFixer::class);
$services->set(OrderedImportsFixer::class)
->call('configure', [['imports_order' => ['class', 'const', 'function']]]);
$services->set(CyclomaticComplexitySniff::class)
->property('complexity', 22)
->property('absoluteComplexity', 22);
$services->set(\Symplify\CodingStandard\Fixer\LineLength\LineLengthFixer::class);
};