Skip to content

Commit 1409790

Browse files
authored
refactor: reduce class complexity, improve code quality (#233)
* build: require phpcs/phpmd * maintenance: refactor to reduce complexity of main class closes #16 * build: php8.1 compatability * ci: phpcs and phpmd * ci: codacy * ci: codacy ignore girhub
1 parent 24e3ea7 commit 1409790

15 files changed

+2057
-694
lines changed

.codacy.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
analysis:
2+
exclude_paths:
3+
- ".github/**"
4+
- "example/**"
5+
- "test/**"
6+

.github/workflows/ci.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,53 @@ jobs:
117117
level: 6
118118
memory_limit: 256M
119119

120+
phpmd:
121+
runs-on: ubuntu-latest
122+
needs: [ composer ]
123+
strategy:
124+
matrix:
125+
php: [ 8.2, 8.3, 8.4, 8.5 ]
126+
127+
steps:
128+
- uses: actions/download-artifact@v4
129+
with:
130+
name: build-artifact-${{ matrix.php }}
131+
path: /tmp/github-actions
132+
133+
- name: Extract build archive
134+
run: tar -xvf /tmp/github-actions/build.tar ./
135+
136+
- name: PHP Mess Detector
137+
uses: php-actions/phpmd@v1
138+
with:
139+
php_version: ${{ matrix.php }}
140+
path: src/
141+
output: text
142+
ruleset: phpmd.xml
143+
144+
phpcs:
145+
runs-on: ubuntu-latest
146+
needs: [ composer ]
147+
strategy:
148+
matrix:
149+
php: [ 8.2, 8.3, 8.4, 8.5 ]
150+
151+
steps:
152+
- uses: actions/download-artifact@v4
153+
with:
154+
name: build-artifact-${{ matrix.php }}
155+
path: /tmp/github-actions
156+
157+
- name: Extract build archive
158+
run: tar -xvf /tmp/github-actions/build.tar ./
159+
160+
- name: PHP Code Sniffer
161+
uses: php-actions/phpcs@v1
162+
with:
163+
php_version: ${{ matrix.php }}
164+
path: src/
165+
standard: phpcs.xml
166+
120167
remove_old_artifacts:
121168
runs-on: ubuntu-latest
122169

composer.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
"ext-dom": "*",
1212
"ext-libxml": "*",
1313
"phpstan/phpstan": "^2.1",
14-
"phpunit/phpunit": "^9.6"
14+
"phpunit/phpunit": "^10.5",
15+
"squizlabs/php_codesniffer": "^4.0",
16+
"phpmd/phpmd": "^2.15"
1517
},
1618

1719
"license": "MIT",
@@ -28,7 +30,8 @@
2830
},
2931

3032
"scripts": {
31-
"phpunit": "vendor/bin/phpunit --configuration test/phpunit/phpunit.xml",
33+
"phpunit": "XDEBUG_MODE=coverage vendor/bin/phpunit --configuration phpunit.xml",
34+
"phpunit:coverage": "XDEBUG_MODE=coverage vendor/bin/phpunit --configuration phpunit.xml --coverage-text",
3235
"phpstan": "vendor/bin/phpstan analyse --level 6 src",
3336
"test": [
3437
"@phpunit",

0 commit comments

Comments
 (0)