claudiosanches / wp-git-hooks
WP GIT Hooks
Installs: 238
Dependents: 1
Suggesters: 0
Security: 0
Stars: 5
Watchers: 2
Forks: 1
Open Issues: 1
Type:scripts
Requires
- php: >=7.0
- dealerdirect/phpcodesniffer-composer-installer: ^0.4.3
- wimg/php-compatibility: ^8.0
- wp-coding-standards/wpcs: ^1.0
README
My GIT hooks for WordPress plugins and themes development.
Hooks
pre-commit
- Lint and check coding standards using WPCS.
Installation
composer require --dev claudiosanches/wp-git-hooks
Setup
Include the follow lines into the project's composer.json
:
"scripts": {
"pre-update-cmd": [
"ClaudioSanches\\WpGitHooks\\Hooks::preHooks"
],
"pre-install-cmd": [
"ClaudioSanches\\WpGitHooks\\Hooks::preHooks"
],
"post-install-cmd": [
"ClaudioSanches\\WpGitHooks\\Hooks::postHooks"
],
"post-update-cmd": [
"ClaudioSanches\\WpGitHooks\\Hooks::postHooks"
]
}
This will install all hooks and setup WPCS.
Sample phpcs.xml for PHPCS/WPCS
A phpcs.xml
file is required in order to correct run your project's coding standards.
<?xml version="1.0"?> <ruleset name="WordPress Coding Standards"> <description>PHP_CodeSniffer ruleset for WordPress plugins and themes development.</description> <rule ref="PHPCompatibility"></rule> <rule ref="WordPress"></rule> </ruleset>
Manual setup (optional)
By default should already run all commands from composer scripts
when installed, but if necessary run it manually is possible with the follow commands:
composer run-script pre-update-cmd composer run-script post-update-cmd
Release history
- 2018-08-01 - 1.3.3
- Fixed Packagist.org builds.
- 2018-07-31 - 1.3.2
- Full support for
phpcs.xml.dist
.
- Full support for
- 2017-12-18 - 1.3.1
- Fixed support for
phpcs.xml.dist
.
- Fixed support for
- 2017-12-18 - 1.3.0
- Requires
phpcs.xml
orphpcs.xml.dist
by default. - No longer accepts
phpcs.xml
.
- Requires
- 2017-11-19 - 1.2.0
- Included support for
PHPCompatibility
. - Automatically load all PHP_CodeSniffer plugins.
- Included support for
- 2017-11-09 - 1.1.0
- Removed unnecessary configuration file.
- 2017-10-30 - 1.0.1
- Fixed vendor path for
hooks/pre-commit
andbin/read-wp-git-hooks-config
.
- Fixed vendor path for
- 2017-10-27 - 1.0.0
- Initial release.
Sources
Inspired by: