https://github.com/drupol/drupal-conventions
Check (and fix) your code against Drupal's code conventions and coding standard.
https://github.com/drupol/drupal-conventions
Last synced: 10 months ago
JSON representation
Check (and fix) your code against Drupal's code conventions and coding standard.
- Host: GitHub
- URL: https://github.com/drupol/drupal-conventions
- Owner: drupol
- License: mit
- Created: 2019-01-22T11:24:30.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2022-03-29T11:16:52.000Z (almost 4 years ago)
- Last Synced: 2024-10-11T21:11:46.772Z (over 1 year ago)
- Language: PHP
- Homepage:
- Size: 99.6 KB
- Stars: 24
- Watchers: 4
- Forks: 1
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Contributing: .github/CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
- awesome-drupal - drupol/drupal-conventions: Check (and fix) your code against Drupal's code conventions and coding standard.
README
[](https://packagist.org/packages/drupol/drupal-conventions)
[](https://github.com/drupol/drupal-conventions)
[](https://packagist.org/packages/drupol/drupal-conventions)
[](https://travis-ci.org/drupol/drupal-conventions)
[](https://packagist.org/packages/drupol/drupal-conventions)
[](https://saythanks.io/to/drupol)
[](https://paypal.me/drupol)
# Drupal conventions
This tool will check your code against Drupal's coding standard.
It's based on [GrumPHP](https://github.com/phpro/grumphp) and comes with a default configuration tailored for Drupal development.
The following checks are triggered:
* [Drupal coder](https://www.drupal.org/project/coder) code sniffer's checks
* Custom [PHP CS Fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer) configuration
* PHPLint
* YAMLlint
* JSONlint
Drupal 7 and 8 are supported.
## Installation
```shell
composer require --dev drupol/drupal-conventions
```
### If you're not using GrumPHP
Manually add to your `composer.json` file:
#### Drupal 8
```yaml
"extra": {
"grumphp": {
"config-default-path": "vendor/drupol/drupal-conventions/config/drupal8/grumphp.yml"
}
}
```
#### Drupal 7
```yaml
"extra": {
"grumphp": {
"config-default-path": "vendor/drupol/drupal-conventions/config/drupal7/grumphp.yml"
}
}
```
### If you're using GrumPHP already
Edit the file `grumphp.yml.dist` or `grumphp.yml` and add on the top it:
#### Drupal 8
```yaml
imports:
- { resource: vendor/drupol/drupal-conventions/config/drupal8/grumphp.yml }
```
#### Drupal 7
```yaml
imports:
- { resource: vendor/drupol/drupal-conventions/config/drupal7/grumphp.yml }
```
To add an extra Grumphp task:
```yaml
imports:
- { resource: vendor/drupol/drupal-conventions/config/drupal7/grumphp.yml }
parameters:
extra_tasks:
phpunit:
always_execute: false
```
In conjunction with `extra_tasks`, use `skip_tasks` to skip tasks if needed.
## Contributing
Feel free to contribute to this library by sending Github pull requests. I'm quite reactive :-)