Skip to content

Commit 3233fc4

Browse files
committed
Modernize build configuration
- Update Makefile with proper phpcs flags per spec - Configure PHPStan with contributte/phpstan at level 9 - Update ruleset.xml with element-based property syntax - Align .editorconfig, .gitattributes, .gitignore with spec
1 parent fcaf2b8 commit 3233fc4

File tree

6 files changed

+56
-41
lines changed

6 files changed

+56
-41
lines changed

.editorconfig

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# EditorConfig is awesome: http://EditorConfig.org
2-
31
root = true
42

53
[*]
@@ -8,9 +6,15 @@ end_of_line = lf
86
insert_final_newline = true
97
trim_trailing_whitespace = true
108
indent_style = tab
11-
indent_size = tab
12-
tab_width = 4
9+
indent_size = 4
1310

14-
[{*.json,*.yaml,*.yml,*.md}]
11+
[*.{yml,yaml}]
1512
indent_style = space
1613
indent_size = 2
14+
15+
[*.md]
16+
trim_trailing_whitespace = false
17+
18+
[*.neon]
19+
indent_style = tab
20+
indent_size = 4

.gitattributes

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# Not archived
22
.docs export-ignore
3-
tests export-ignore
43
.editorconfig export-ignore
54
.gitattributes export-ignore
5+
.github export-ignore
66
.gitignore export-ignore
7-
.travis.yml export-ignore
87
Makefile export-ignore
98
phpstan.neon export-ignore
109
README.md export-ignore
1110
ruleset.xml export-ignore
11+
tests export-ignore

.gitignore

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
1-
# IDE
2-
/.idea
3-
4-
# Composer
5-
/vendor
6-
/composer.lock
7-
8-
# Tests
9-
/temp
10-
/coverage.xml
1+
/vendor/
2+
/tests/tmp/
3+
composer.lock
4+
coverage.html
5+
coverage.xml

Makefile

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,34 @@
1-
.PHONY: install qa cs csf phpstan tests coverage-clover coverage-html
2-
1+
.PHONY: install
32
install:
43
composer update
54

5+
.PHONY: qa
66
qa: phpstan cs
77

8+
.PHONY: cs
89
cs:
910
ifdef GITHUB_ACTION
10-
vendor/bin/codesniffer -q --report=checkstyle src tests | cs2pr
11+
vendor/bin/phpcs --standard=ruleset.xml --encoding=utf-8 --extensions=php,phpt --colors -nsp -q --report=checkstyle src tests | cs2pr
1112
else
12-
vendor/bin/codesniffer src tests
13+
vendor/bin/phpcs --standard=ruleset.xml --encoding=utf-8 --extensions=php,phpt --colors -nsp src tests
1314
endif
1415

16+
.PHONY: csf
1517
csf:
16-
vendor/bin/codefixer src tests
18+
vendor/bin/phpcbf --standard=ruleset.xml --encoding=utf-8 --extensions=php,phpt --colors -nsp src tests
1719

20+
.PHONY: phpstan
1821
phpstan:
19-
vendor/bin/phpstan analyse -l max -c phpstan.neon src
22+
vendor/bin/phpstan analyse -c phpstan.neon
2023

24+
.PHONY: tests
2125
tests:
22-
vendor/bin/tester -s -p php --colors 1 -C tests/cases
23-
24-
coverage-clover:
25-
vendor/bin/tester -s -p phpdbg --colors 1 -C --coverage ./coverage.xml --coverage-src ./src tests/cases
26+
vendor/bin/tester -s -p php --colors 1 -C tests/Cases
2627

27-
coverage-html:
28-
vendor/bin/tester -s -p phpdbg --colors 1 -C --coverage ./coverage.html --coverage-src ./src tests/cases
28+
.PHONY: coverage
29+
coverage:
30+
ifdef GITHUB_ACTION
31+
vendor/bin/tester -s -p phpdbg --colors 1 -C --coverage coverage.xml --coverage-src src tests/Cases
32+
else
33+
vendor/bin/tester -s -p phpdbg --colors 1 -C --coverage coverage.html --coverage-src src tests/Cases
34+
endif

phpstan.neon

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
includes:
2-
- vendor/phpstan/phpstan-deprecation-rules/rules.neon
3-
- vendor/phpstan/phpstan-nette/extension.neon
4-
- vendor/phpstan/phpstan-nette/rules.neon
5-
- vendor/phpstan/phpstan-strict-rules/rules.neon
2+
- vendor/contributte/phpstan/phpstan.neon
3+
4+
parameters:
5+
level: 9
6+
phpVersion: 80200
7+
8+
scanDirectories:
9+
- src
10+
11+
fileExtensions:
12+
- php
13+
14+
paths:
15+
- src
16+
- .docs
17+
18+
ignoreErrors:

ruleset.xml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
11
<?xml version="1.0"?>
22
<ruleset>
3-
<!-- Contributte Coding Standard -->
4-
<rule ref="./vendor/ninjify/coding-standard/contributte.xml"/>
3+
<rule ref="./vendor/contributte/qa/ruleset-8.2.xml"/>
54

6-
<!-- Specific -->
75
<rule ref="SlevomatCodingStandard.Files.TypeNameMatchesFileName">
86
<properties>
9-
<property name="rootNamespaces" type="array" value="
10-
src => Nettrine\Extensions\Atlantic18,
11-
tests/cases => Tests\Cases,
12-
"/>
7+
<property name="rootNamespaces" type="array">
8+
<element key="src" value="Nettrine\Extensions\Atlantic18"/>
9+
<element key="tests" value="Tests"/>
10+
</property>
1311
</properties>
1412
</rule>
1513

16-
<!--Exclude folders -->
1714
<exclude-pattern>/tests/tmp</exclude-pattern>
1815
</ruleset>

0 commit comments

Comments
 (0)