Skip to content

Commit 2f1494d

Browse files
committed
GH Actions: always check that all sniffs are feature complete
The `phpcsstandards/phpcsdevtools` package includes a script which can check whether sniffs are feature complete, i.e. whether all sniffs have unit tests and documentation. By adding this check to the `basics` GH Actions workflow, we prevent untested and/or undocumented sniffs from entering the repo. For now, the documentation check is silenced. P.S.: the `PHPCSDevTools` package contains a few more goodies which having the package (dev-)required now make available to developers, like the `PHPCSDebug` standard to get detailed information about the tokens in a file. Have a look at the package [readme](https://github.com/PHPCSStandards/PHPCSDevTools) for more information.
1 parent 0ea8b1a commit 2f1494d

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

.github/workflows/basics.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,9 @@ jobs:
5757

5858
- name: Show PHPCS results in PR
5959
run: cs2pr ./phpcs-report.xml
60+
61+
# Check that the sniffs available are feature complete.
62+
# For now, just check that all sniffs have unit tests.
63+
# At a later stage the documentation check can be activated.
64+
- name: Check sniff feature completeness
65+
run: composer check-complete

composer.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"php-parallel-lint/php-parallel-lint": "^1.0",
2626
"php-parallel-lint/php-console-highlighter": "^0.5",
2727
"phpcompatibility/php-compatibility": "^9",
28+
"phpcsstandards/phpcsdevtools": "^1.0",
2829
"phpunit/phpunit": "^4 || ^5 || ^6 || ^7"
2930
},
3031
"scripts": {
@@ -37,11 +38,15 @@
3738
"phpcs": "bin/phpcs",
3839
"phpunit": "bin/unit-tests",
3940
"coverage": "bin/unit-tests-coverage",
41+
"check-complete": [
42+
"@php ./vendor/phpcsstandards/phpcsdevtools/bin/phpcs-check-feature-completeness -q ./WordPressVIPMinimum"
43+
],
4044
"test": [
4145
"@lint",
4246
"@ruleset",
4347
"@phpunit",
44-
"@phpcs"
48+
"@phpcs",
49+
"@check-complete"
4550
]
4651
},
4752
"support": {

0 commit comments

Comments
 (0)