https://github.com/chi-teck/drupal-coder-extension
A highly opinionated extension for Drupal coding standards.
https://github.com/chi-teck/drupal-coder-extension
Last synced: 8 months ago
JSON representation
A highly opinionated extension for Drupal coding standards.
- Host: GitHub
- URL: https://github.com/chi-teck/drupal-coder-extension
- Owner: Chi-teck
- License: gpl-2.0
- Created: 2020-05-02T15:02:11.000Z (over 5 years ago)
- Default Branch: 2.x
- Last Pushed: 2024-04-03T14:17:58.000Z (over 1 year ago)
- Last Synced: 2024-12-29T13:26:55.473Z (10 months ago)
- Homepage:
- Size: 34.2 KB
- Stars: 5
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Extended Drupal Coding Standard
This project offers a set of preconfigured rules for PHP Code Sniffer mainly related to new PHP features that are not
covered by Drupal coding standards yet.
## System RequirementsPHP 8.1+
## Installation
Install the standard locally through Composer.
```shell
composer require --dev chi-teck/drupal-coder-extension
```Add `DrupalExtended` standard to your project's `phpcs.xml`.
```xml
./src/Exception
```
A complete example of `phpcs.xml`:
```xml
PHP Code Sniffer configuration for My Project.
./web/modules/custom
./web/themes/custom
./tests
./docroot/themes/custom/example/node_modules
```
## Usage
Run the `phpcs` script to check custom code.
```
./vendor/bin/phpcs -ps --standard=phpcs.xml
```Run the `phpcbf` script to automatically correct coding standard violations.
```
./vendor/bin/phpcbf
```You also can put this command into projects `composer.json`:
```json
{
…
"scripts": {
"phpcs": "vendor/bin/phpcs -ps"
}
}
```Then you can use it like
```shell
composer phpcs
```## Links
* [PHP Code Sniffer](https://github.com/squizlabs/PHP_CodeSniffer)
* [Drupal Coding Standards](https://www.drupal.org/node/2802991)
* [Drupal Coder](https://www.drupal.org/project/coder)
* [Slevomat Coding Standard](https://github.com/slevomat/coding-standard)## License
GNU General Public License, version 2 or later.