Skip to content

Commit 87f4485

Browse files
committed
Maintenance: editorconfig, makefile, git, phpstan, codesniffer
1 parent 56cb46a commit 87f4485

File tree

6 files changed

+67
-63
lines changed

6 files changed

+67
-63
lines changed

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ indent_style = tab
1111
indent_size = tab
1212
tab_width = 4
1313

14-
[{*.yaml, *.yml, *.md}]
14+
[*.{json,yaml,yml,md}]
1515
indent_style = space
1616
indent_size = 2

.gitattributes

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
# Not archived
21
.docs export-ignore
3-
tests export-ignore
2+
.github export-ignore
43
.editorconfig export-ignore
54
.gitattributes export-ignore
65
.gitignore export-ignore
7-
.travis.yml export-ignore
8-
LICENSE export-ignore
6+
Makefile export-ignore
97
README.md export-ignore
108
phpstan.neon export-ignore
11-
ruleset.xml
9+
ruleset.xml export-ignore
10+
tests export-ignore

.gitignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
# IDE
22
/.idea
33

4-
# PHP
4+
# Composer
55
/vendor
66
/composer.lock
77

88
# Tests
99
/tests/tmp
10+
/coverage.*
11+
/tests/**/*.log
12+
/tests/**/*.html
13+
/tests/**/*.expected
14+
/tests/**/*.actual

Makefile

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

6-
qa: lint phpstan cs
7-
8-
lint:
9-
vendor/bin/linter src tests
5+
.PHONY: qa
6+
qa: phpstan cs
107

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

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

20+
.PHONY: phpstan
1721
phpstan:
18-
vendor/bin/phpstan analyse -l 8 -c phpstan.neon src
22+
vendor/bin/phpstan analyse -c phpstan.neon
1923

24+
.PHONY: tests
2025
tests:
21-
vendor/bin/tester -s -p php --colors 1 -C tests/cases
22-
23-
coverage-clover:
24-
vendor/bin/tester -s -p phpdbg --colors 1 -C --coverage ./coverage.xml --coverage-src ./src tests/cases
25-
26-
coverage-html:
27-
vendor/bin/tester -s -p phpdbg --colors 1 -C --coverage ./coverage.html --coverage-src ./src tests/cases
26+
vendor/bin/tester -s -p php --colors 1 -C tests/Cases
27+
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: 14 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +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
63

74
parameters:
8-
ignoreErrors:
9-
-
10-
message: '~^Parameter #1 \$pattern of function preg_match expects string, string\|null given\.$~'
11-
path: '*/src/ImageNameScript.php'
12-
count: 1
13-
-
14-
message: '~^Parameter #1 \$pattern of function preg_match expects string, string\|null given\.$~'
15-
path: '*/src/ImageStorage.php'
16-
count: 1
17-
-
18-
message: '~^Right side of && is always true\.$~'
19-
path: '*/src/ImageStorage.php'
20-
count: 1
21-
-
22-
message: '~^Method Contributte\\ImageStorage\\ImageStorage::fromIdentifier\(\) should return Contributte\\ImageStorage\\Image but returns array<int, Contributte\\ImageStorage\\ImageNameScript\|string>\|Contributte\\ImageStorage\\Image\.$~'
23-
path: '*/src/ImageStorage.php'
24-
count: 1
5+
level: 9
6+
phpVersion: 80100
7+
8+
scanDirectories:
9+
- src
10+
11+
fileExtensions:
12+
- php
2513

26-
-
27-
message: '#Cannot use array destructuring on array<int, Contributte\\ImageStorage\\ImageNameScript|string>|Contributte\\ImageStorage\\Image.#'
28-
path: '*/src/ImageStorage.php'
29-
count: 2
14+
paths:
15+
- src
16+
- .docs
17+
18+
ignoreErrors:

ruleset.xml

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,22 @@
1-
<?xml version="1.0"?>
2-
<ruleset name="Contributte">
3-
<!-- Extending rulesets -->
4-
<rule ref="vendor/ninjify/coding-standard/contributte.xml"/>
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<ruleset name="Contributte" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="vendor/squizlabs/php_codesniffer/phpcs.xsd">
3+
<!-- Rulesets -->
4+
<rule ref="./vendor/contributte/qa/ruleset-8.0.xml"/>
55

6-
<!-- My rules -->
7-
<rule ref="SlevomatCodingStandard.Files.TypeNameMatchesFileName">
8-
<properties>
9-
<property name="rootNamespaces" type="array" value="
10-
src=>Contributte\ImageStorage,
11-
tests/cases=>Tests\Cases
12-
"/>
13-
</properties>
14-
</rule>
6+
<!-- Rules -->
7+
<rule ref="SlevomatCodingStandard.Files.TypeNameMatchesFileName">
8+
<properties>
9+
<property name="rootNamespaces" type="array">
10+
<element key="src" value="Contributte\ImageStorage"/>
11+
<element key="tests" value="Tests"/>
12+
</property>
13+
<property name="extensions" type="array">
14+
<element key="php" value="php"/>
15+
<element key="phpt" value="phpt"/>
16+
</property>
17+
</properties>
18+
</rule>
1519

16-
<!-- Exclude folders -->
17-
<exclude-pattern>/tests/tmp</exclude-pattern>
20+
<!-- Excludes -->
21+
<exclude-pattern>/tests/tmp</exclude-pattern>
1822
</ruleset>

0 commit comments

Comments
 (0)