Skip to content

NickDickinsonWilde/php-composter-phpcs-drupal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHP Composter PHPCS Drupal

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.

About

Provides a Drupal Standards PHPCS precommit hook

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages