jover_be / drupal-code-check
A Git pre-commit hook to check Drupal Coding Standards and more.
Installs: 2 625
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 3
Forks: 4
Open Issues: 2
Requires
- php: >=5.4
- drupal/coder: ~8.2
- symfony/console: ~2.8|~3.0
- symfony/process: ~2.8|~3.0
README
A Git pre-commit hook to check Drupal Coding Standards and more.
Description
This Git pre-commit hook will be active on your Composer based Drupal project.
Things which will be checked in the pre-commit hook:
- Syntax checking using PHP Linter
- Automatically try to match code style via PHP Code Sniffer Beautifier and Fixer
- Coding standards checking using PHP Code Sniffer
- Blacklisted strings checking/validation
Note that files of the following origins are not checked:
- Drupal Core
- Contributed Modules
- Contributed Libraries
- Contributed Themes
- Contributed Profiles
Getting started
Prerequisites
- Composer
- Composer based Drupal project
- PHP 5.4 or higher
Installation
Add this project as a composer dependency on your Composer based Drupal project.
composer require jover_be/drupal-code-check
And don't forget to update...
composer update jover_be/drupal-code-check
In order to activate the Git Hooks, update your composer.json file like following:
{
"scripts": {
"post-install-cmd": [
"jover_be\\drupal_code_check\\GitHooks::create"
],
"post-update-cmd": [
"jover_be\\drupal_code_check\\GitHooks::create",
]
}
}
Development requirement
In case you want to install it as a development requirement (require-dev), make use of the project neronmoon/scriptsdev in order to execute the scripts only in case your project was installed in development mode.
composer require --dev neronmoon/scriptsdev composer require --dev jover_be/drupal-code-check
And instead, you should be using the scripts-dev part as described by
{
"extra": {
"scripts-dev": {
"post-install-cmd": [
"jover_be\\drupal_code_check\\GitHooks::create"
],
"post-update-cmd": [
"jover_be\\drupal_code_check\\GitHooks::create",
]
}
}
}
Author
License
This project is licensed under the MIT License - see the LICENSE file for details.