Skip to content

Commit 7b7f256

Browse files
authored
Add sniff and md (#1)
* Add sniff and md * Update * fix lock
1 parent 69cd5b0 commit 7b7f256

11 files changed

+845
-158
lines changed

.github/workflows/php.yml

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: PHP Composer Tests
22

3-
on: [push]
3+
on: [push, pull_request]
44

55
jobs:
66
build:
@@ -16,17 +16,19 @@ jobs:
1616
- name: Install dependencies
1717
run: composer install --prefer-dist --no-progress --no-suggest
1818

19-
# - name: Run Code Sniffer
20-
# run: composer run-script sniff
19+
- name: Run Code Sniffer
20+
run: composer run-script sniff
2121

2222
# - name: Run Linter
2323
# run: composer run-script lint
2424

2525
- name: Run Static Analysis
2626
run: composer run-script stan
2727

28-
# - name: Run Mess Detection
29-
# run: composer run-script md
28+
- name: Run Mess Detection
29+
run: composer run-script md
3030

3131
- name: Run Unit Tests
32+
env:
33+
XDEBUG_MODE: coverage
3234
run: composer run-script test

.phpcs.xml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0"?>
2+
<ruleset name="Yocto Framework Coding Standard">
3+
<description>Yocto Framework Coding Standard</description>
4+
<arg value="p" />
5+
6+
<rule ref="PSR12"/>
7+
<rule ref="PSR1"/>
8+
<rule ref="PSR2">
9+
<exclude name="Generic.Files.LineEndings.InvalidEOLChar" />
10+
<exclude name="PSR2.ControlStructures.ControlStructureSpacing.SpacingAfterOpenBrace" />
11+
<exclude name="PSR2.Files.EndFileNewline.NoneFound" />
12+
</rule>
13+
<rule ref="Generic.Arrays.DisallowLongArraySyntax" />
14+
</ruleset>

composer.json

+15-3
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,18 @@
99
}
1010
],
1111
"scripts": {
12+
"check": [
13+
"@sniff",
14+
"@stan",
15+
"@md",
16+
"@test"
17+
],
1218
"test": "pest --coverage",
13-
"test-github": "pest --no-coverage",
14-
"stan": "phpstan analyse src --memory-limit=-1"
19+
"test-github": "pest --coverage --coverage-clover=coverage.xml",
20+
"stan": "phpstan analyse src --memory-limit=-1",
21+
"sniff": "php vendor/squizlabs/php_codesniffer/bin/phpcs -s --colors src/",
22+
"fix": "php vendor/squizlabs/php_codesniffer/bin/phpcbf src/",
23+
"md": "php vendor/bin/phpmd src/ text rulesets.xml"
1524
},
1625
"autoload": {
1726
"psr-4": {
@@ -25,14 +34,17 @@
2534
"require-dev": {
2635
"pestphp/pest": "^1.21",
2736
"phpstan/phpstan": "^1.2",
28-
"guzzlehttp/psr7": "^2.4"
37+
"guzzlehttp/psr7": "^2.4",
38+
"squizlabs/php_codesniffer": "^3.7",
39+
"phpmd/phpmd": "^2.13"
2940
},
3041
"config": {
3142
"allow-plugins": {
3243
"pestphp/pest-plugin": true
3344
}
3445
},
3546
"require": {
47+
"php": "^8.1",
3648
"psr/http-message": "^1.0",
3749
"psr/http-server-middleware": "^1.0",
3850
"psr/http-factory": "^1.0"

0 commit comments

Comments
 (0)