Skip to content

Commit 6825aa3

Browse files
committed
Maintenance: git, codesniffer, phpstan, makefile
1 parent 817b05b commit 6825aa3

7 files changed

Lines changed: 52 additions & 55 deletions

File tree

.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-
[{*.json, *.yaml, *.yml, *.md}]
14+
[*.{json,yaml,yml,md}]
1515
indent_style = space
1616
indent_size = 2

.gitattributes

Lines changed: 3 additions & 4 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
86
Makefile export-ignore
9-
phpstan.neon export-ignore
107
README.md export-ignore
8+
phpstan.neon export-ignore
119
ruleset.xml export-ignore
10+
tests export-ignore

.gitignore

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
/composer.lock
77

88
# Tests
9-
/temp
10-
/coverage.html
11-
/coverage.xml
9+
/tests/tmp
10+
/coverage.*
11+
/tests/**/*.log
12+
/tests/**/*.html
13+
/tests/**/*.expected
14+
/tests/**/*.actual

Makefile

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,31 @@
1-
.PHONY: install qa cs csf phpstan tests coverage
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:
1922
vendor/bin/phpstan analyse -c phpstan.neon
2023

24+
.PHONY: tests
2125
tests:
2226
vendor/bin/tester -s -p php --colors 1 -C tests/Cases
2327

28+
.PHONY: coverage
2429
coverage:
2530
ifdef GITHUB_ACTION
2631
vendor/bin/tester -s -p phpdbg --colors 1 -C --coverage coverage.xml --coverage-src src tests/Cases

composer.json

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,12 @@
2424
"nette/utils": "^v4.0.2"
2525
},
2626
"require-dev": {
27-
"contributte/dev": "^v0.4",
28-
"contributte/qa": "^v0.3.1",
29-
"contributte/tester": "^v0.2.0",
27+
"contributte/qa": "^0.3.1",
28+
"contributte/tester": "^0.2.0",
29+
"contributte/phpstan": "^0.1",
3030
"nette/application": "^v3.1.14",
31-
"nette/di": "^v3.1.7",
32-
"nette/http": "^v3.2.2",
33-
"phpstan/phpstan": "^1.10.39",
34-
"phpstan/phpstan-deprecation-rules": "^1.1.4",
35-
"phpstan/phpstan-nette": "^1.2.9",
36-
"phpstan/phpstan-strict-rules": "^1.5.1"
31+
"nette/di": "^3.1.8",
32+
"nette/http": "^3.2.3"
3733
},
3834
"conflict": {
3935
"nette/di": "<3.0.7",

phpstan.neon

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +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:
85
level: 9
6+
phpVersion: 80100
7+
8+
scanDirectories:
9+
- src
10+
11+
fileExtensions:
12+
- php
13+
914
paths:
1015
- src
16+
- .docs
17+
18+
ignoreErrors:

ruleset.xml

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

5-
<!-- Extending rulesets -->
6-
<rule ref="./vendor/contributte/qa/ruleset-8.1.xml"/>
7-
8-
<!-- Specific rules -->
6+
<!-- Rules -->
97
<rule ref="SlevomatCodingStandard.Files.TypeNameMatchesFileName">
108
<properties>
119
<property name="rootNamespaces" type="array">
1210
<element key="src" value="Contributte\Psr7"/>
1311
<element key="tests" value="Tests"/>
1412
</property>
13+
<property name="extensions" type="array">
14+
<element key="php" value="php"/>
15+
<element key="phpt" value="phpt"/>
16+
</property>
1517
</properties>
1618
</rule>
1719

18-
<rule ref="SlevomatCodingStandard.Classes.SuperfluousTraitNaming.SuperfluousSuffix">
19-
<exclude name="SlevomatCodingStandard.Classes.SuperfluousTraitNaming.SuperfluousSuffix"/>
20+
<rule ref="SlevomatCodingStandard.Variables.DisallowSuperGlobalVariable.DisallowedSuperGlobalVariable">
21+
<exclude-pattern>src/**</exclude-pattern>
22+
<exclude-pattern>tests/**</exclude-pattern>
2023
</rule>
2124

22-
<rule ref="SlevomatCodingStandard.Functions.DisallowEmptyFunction.EmptyFunction">
23-
<exclude-pattern>src/NullStream.php</exclude-pattern>
25+
<rule ref="SlevomatCodingStandard.Classes.SuperfluousTraitNaming.SuperfluousSuffix">
26+
<exclude-pattern>src/**/*Trait.php</exclude-pattern>
2427
</rule>
2528

2629
<rule ref="SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint">
27-
<exclude-pattern>src/Psr7RequestWrapper.php</exclude-pattern>
28-
<exclude-pattern>src/Psr7ResponseWrapper.php</exclude-pattern>
29-
<exclude-pattern>src/ProxyRequest.php</exclude-pattern>
30-
<exclude-pattern>src/ProxyResponse.php</exclude-pattern>
30+
<exclude-pattern>src</exclude-pattern>
3131
</rule>
3232

33-
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingNativeTypeHint">
34-
<exclude-pattern>src/Psr7RequestWrapper.php</exclude-pattern>
35-
<exclude-pattern>src/ProxyRequest.php</exclude-pattern>
36-
<exclude-pattern>src/ProxyResponse.php</exclude-pattern>
37-
</rule>
38-
39-
<rule ref="SlevomatCodingStandard.Variables.DisallowSuperGlobalVariable.DisallowedSuperGlobalVariable">
40-
<exclude-pattern>src/Psr7ServerRequest.php</exclude-pattern>
41-
<exclude-pattern>src/Psr7ServerRequestFactory.php</exclude-pattern>
42-
<exclude-pattern>tests/Cases/Psr7ServerRequestFactoryTest.php</exclude-pattern>
43-
<exclude-pattern>tests/Cases/Psr7ServerRequestTest.php</exclude-pattern>
44-
</rule>
45-
46-
<!-- Exclude folders -->
33+
<!-- Excludes -->
4734
<exclude-pattern>/tests/tmp</exclude-pattern>
4835
</ruleset>
49-

0 commit comments

Comments
 (0)