My GIT hooks for WordPress plugins and themes development.
pre-commit
- Lint and check coding standards using WPCS.
composer require --dev claudiosanches/wp-git-hooks
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.
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>
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
- 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.
Inspired by: