https://github.com/jover/drupal-code-check
A Git pre-commit hook to check Drupal Coding Standards and more.
https://github.com/jover/drupal-code-check
Last synced: 9 months ago
JSON representation
A Git pre-commit hook to check Drupal Coding Standards and more.
- Host: GitHub
- URL: https://github.com/jover/drupal-code-check
- Owner: jover
- License: mit
- Created: 2016-11-12T17:54:31.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-05-05T14:09:35.000Z (over 8 years ago)
- Last Synced: 2025-03-25T18:41:11.781Z (10 months ago)
- Language: PHP
- Homepage:
- Size: 30.3 KB
- Stars: 4
- Watchers: 2
- Forks: 5
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-drupal - jover/drupal-code-check: A Git pre-commit hook to check Drupal Coding Standards and more.
README
# Drupal Code Check
A Git pre-commit hook to check Drupal Coding Standards and more.
[](https://packagist.org/packages/jover_be/drupal-code-check) [](https://packagist.org/packages/jover_be/drupal-code-check) [](https://packagist.org/packages/jover_be/drupal-code-check) [](https://packagist.org/packages/jover_be/drupal-code-check) [](https://packagist.org/packages/jover_be/drupal-code-check)
## 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.
```bash
composer require jover_be/drupal-code-check
```
And don't forget to update...
```bash
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.
```bash
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
[jover.be](http://www.jover.be)
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.