nickwilde1990/php-composter-phpcs-drupal

PHP Composter PHP Code Sniffer for Drupal (pre-commit).

Installs: 1 616

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 2

Forks: 0

Type:php-composter-action

2.0.0 2018-09-27 03:58 UTC

This package is auto-updated.

Last update: 2024-11-27 17:31:04 UTC


README

Check your Drupal code for standards compliance before committing.

Latest Stable Version Total Downloads Latest Unstable Version License

This Composer package will enforce a check of your PHP files upon each commit to make sure they comply with the Drupal code standards as defined by Drupal Coder.

This is a PHP Composter Action.

Uses the wonderful PHP CodeSniffer Project.

Table Of Contents

Installation

Just add as a development requirement to your composer.json, and it should work automagically:

composer require --dev nickwilde1990/php-composter-phpcs-drupal

Note: If you are using this with a Drupal module which is being run through the DrupalCI test bot, due to how that works/adds test dependencies, you will likely need to also run

composer require --dev "squizlabs/php_codesniffer:^3.3"

to force the required version of PHPCS since otherwise, the test bot is locked to the 2.8 branch.

Basic Usage

It should just work when you git commit.

Configuration

The Drupal Coder module provides two sets of sniffs. By default this uses the Drupal sniff rather than DrupalPractice. If you want to use DrupalPractice (or any other sniff set), you can specify that standard to use in your composer.json's extra key:

 "extra": {
   "php-composter-phpcs-drupal": {
     "standard": "DrupalPractice"
   }
 }

Contributing

All feedback / bug reports / pull requests are welcome.