Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,13 @@ This package contains Composer scripts to quickly run the developer checks which

After `composer install`, you can do:

- `composer test`: **Run all checks and tests** - this should pass cleanly before you submit a pull request.
- `composer lint`: Just run PHP and XML linters.
- `composer phpcs`: Just run PHPCS against this package.
- `composer phpunit`: Just run the unit tests.
- `composer ruleset`: Just run the ruleset tests.
- `composer lint`: Lint PHP and XML files in against parse errors.
- `composer cs`: Check the code style and code quality of the codebase via PHPCS.
- `composer test`: Run the unit tests for the VIPCS sniffs.
- `composer test-coverage`: Run the unit tests for the VIPCS sniffs with coverage enabled.
- `composer test-ruleset`: Run the ruleset tests for the VIPCS sniffs.
- `composer feature-completeness`: Check if all the VIPCS sniffs have tests.
- `composer check`: Run all checks (lint, CS, feature completeness) and tests - this should pass cleanly before you submit a pull request.

## Branches

Expand Down Expand Up @@ -190,7 +192,7 @@ The ruleset tests, previously named here as _integration tests_, are our way of

An example where it might not would be when a ruleset references a local sniff or a sniff from upstream (WPCS or PHPCS), but that the violation code, sniff name or category name has changed. Without a ruleset test, this would go unnoticed.

The `composer test` or `composer ruleset` commands run the `ruleset-test.php` files (one for each standard), which internally run `phpcs` against the "dirty" test files (`ruleset-test.inc`), and looks out for a known number of errors, warnings, and messages on each line. This is then compared against the expected errors, warnings and messages to see if there are any missing or unexpected violations or difference in messages.
The `composer check` or `composer test-ruleset` commands run the `ruleset-test.php` files (one for each standard), which internally run `phpcs` against the "dirty" test files (`ruleset-test.inc`), and looks out for a known number of errors, warnings, and messages on each line. This is then compared against the expected errors, warnings and messages to see if there are any missing or unexpected violations or difference in messages.

When adding or changing a sniff, the ruleset test files should be updated to match.

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/basics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,4 @@ jobs:
# For now, just check that all sniffs have unit tests.
# At a later stage the documentation check can be activated.
- name: Check sniff feature completeness
run: composer check-complete
run: composer feature-completeness
12 changes: 0 additions & 12 deletions bin/phpcs

This file was deleted.

30 changes: 19 additions & 11 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,26 +35,34 @@
}
},
"scripts": {
"install-codestandards": "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin::run",
"ruleset": "bin/ruleset-tests",
"test-ruleset": "bin/ruleset-tests",
"lint": [
"bin/php-lint",
"bin/xml-lint"
],
"phpcs": "bin/phpcs",
"phpunit": "bin/unit-tests",
"coverage": "bin/unit-tests-coverage",
"check-complete": [
"cs": "@php ./vendor/squizlabs/php_codesniffer/bin/phpcs",
"test": "bin/unit-tests",
"test-coverage": "bin/unit-tests-coverage",
"feature-completeness": [
"@php ./vendor/phpcsstandards/phpcsdevtools/bin/phpcs-check-feature-completeness -q ./WordPressVIPMinimum"
],
"test": [
"check": [
"@lint",
"@ruleset",
"@phpunit",
"@phpcs",
"@check-complete"
"@tests-ruleset",
"@tests",
"@cs",
"@feature-completeness"
]
},
"scripts-descriptions": {
"lint": "VIPCS: Lint PHP and XML files in against parse errors.",
"cs": "VIPCS: Check the code style and code quality of the codebase via PHPCS.",
"test": "VIPCS: Run the unit tests for the VIPCS sniffs.",
"test-coverage": "VIPCS: Run the unit tests for the VIPCS sniffs with coverage enabled.",
"test-ruleset": "VIPCS: Run the ruleset tests for the VIPCS sniffs.",
"feature-completeness": "VIPCS: Check if all the VIPCS sniffs have tests.",
"check": "VIPCS: Run all checks (lint, CS, feature completeness) and tests."
},
"support": {
"issues": "https://github.com/Automattic/VIP-Coding-Standards/issues",
"wiki": "https://github.com/Automattic/VIP-Coding-Standards/wiki",
Expand Down