Skip to content

Commit 29ade8c

Browse files
authored
Merge pull request #91 from lmc-eu/feature/internal-ecs-config
Style: Add internal rules configuration for the project itself
2 parents 2a54925 + 48837fb commit 29ade8c

File tree

4 files changed

+29
-3
lines changed

4 files changed

+29
-3
lines changed

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ecs-internal.php export-ignore

composer.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,12 @@
5555
"@test"
5656
],
5757
"analyze": [
58-
"vendor/bin/ecs check src/ tests/ ecs.php ecs-8.1.php ecs-8.2.php ecs-8.3.php --ansi",
58+
"vendor/bin/ecs check --config=ecs-internal.php --ansi",
5959
"vendor/bin/phpstan analyze -c phpstan.neon --ansi"
6060
],
6161
"fix": [
6262
"@composer normalize",
63-
"vendor/bin/ecs check ./src/ ./tests/ ecs.php ecs-8.1.php ecs-8.2.php ecs-8.3.php --ansi --fix"
63+
"vendor/bin/ecs check --config=ecs-internal.php --ansi --fix"
6464
],
6565
"lint": [
6666
"vendor/bin/parallel-lint -j 10 -e php ./src ./tests ecs.php ecs-8.1.php ecs-8.2.php ecs-8.3.php",

ecs-internal.php

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php declare(strict_types=1);
2+
3+
use PhpCsFixer\Fixer\PhpUnit\PhpUnitTestAnnotationFixer;
4+
use Symplify\CodingStandard\Fixer\LineLength\LineLengthFixer;
5+
use Symplify\EasyCodingStandard\Config\ECSConfig;
6+
7+
/**
8+
* Internal rules configuration for the lmc/coding-standard project itself
9+
*/
10+
return ECSConfig::configure()
11+
->withPaths([__DIR__ . '/src', __DIR__ . '/tests'])
12+
->withRootFiles()
13+
->withSets(
14+
[
15+
__DIR__ . '/ecs.php',
16+
],
17+
)
18+
->withConfiguredRule(PhpUnitTestAnnotationFixer::class, ['style' => 'annotation'])
19+
->withConfiguredRule(
20+
LineLengthFixer::class,
21+
['line_length' => 120, 'break_long_lines' => true, 'inline_short_lines' => false],
22+
);

ecs.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,10 @@
461461
->withConfiguredRule(ArraySyntaxFixer::class, ['syntax' => 'short'])
462462
// The body of each structure MUST be enclosed by braces. Braces should be properly placed
463463
// @TODO move configuration to BracesPositionFixer after BracesFixer is not included in PSR-12 check anymore
464-
->withConfiguredRule(BracesFixer::class, ['allow_single_line_closure' => true, 'allow_single_line_anonymous_class_with_empty_body' => true])
464+
->withConfiguredRule(
465+
BracesFixer::class,
466+
['allow_single_line_closure' => true, 'allow_single_line_anonymous_class_with_empty_body' => true],
467+
)
465468
// Class, trait and interface elements must be separated with one or none blank line
466469
->withConfiguredRule(ClassAttributesSeparationFixer::class, ['elements' => ['method' => 'one']])
467470
// Visibility MUST be declared on all properties, methods and class constants

0 commit comments

Comments
 (0)