2017 © Pedro Peláez
 

library drupalstrict

Drupal Strict: Strictly enforces additional coding standards for Drupal development using PHP CodeSniffer.

image

andrewholgate/drupalstrict

Drupal Strict: Strictly enforces additional coding standards for Drupal development using PHP CodeSniffer.

  • Sunday, February 1, 2015
  • by andrewholgate
  • Repository
  • 1 Watchers
  • 1 Stars
  • 7,791 Installations
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

DrupalStrict code review

Drupal Strict code review sniffer is a series of PHP CodeSniffer rules which enforce coding standards beyond the Drupal 7 standards found in the Coder Sniffer module., (*1)

The majority of the rules are designed to enforce better coding legibility by flagging complex code., (*2)

Examples

Installation

Using Composer, add the following to your composer.json, (*3)

{
    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/andrewholgate/drupalstrict"
        }
    ],
    "require": {
        "andrewholgate/drupalstrict": "~0.1"
    }
}

You will then need to symlink DrupalStrict and the Drupal standards to the PHP CodeSniffer path using:, (*4)

ln -s $(pwd)/vendor/andrewholgate/drupalstrict/DrupalStrict $(pwd)/vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/
ln -s $(pwd)/vendor/drupal/coder/coder_sniffer/Drupal $(pwd)/vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/

Usage

You can review your project code using the Drupal and Drupal Strict Standards by entering:, (*5)

./vendor/bin/phpcs --standard=Drupal,DrupalStrict  -- /path/to/code/

See the PHP CodeSniffer commandline usage for more configurations., (*6)

Additional Code Review Rules

Other rules can also be installed for additional code reviews., (*7)

{
    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/andrewholgate/drupalstrict"
        },
        {
            "type": "vcs",
            "url": "https://github.com/Pheromone/phpcs-security-audit"
        },
        {
            "type": "package",
            "package": {
                "name": "drupal/drupalpractice",
                "version": "8.1.0-beta1",
                "type": "library",
                "dist": {
                    "url": "http://ftp.drupal.org/files/projects/drupalpractice-8.x-1.0-beta1.tar.gz",
                    "type": "tar"
               }
           }
      },
    ],
    "require": {
        "andrewholgate/drupalstrict": "~0.1",
        "drupal/drupalpractice": "8.1.0-beta1",
        "pheromone/phpcs-security-audit": "dev-master"
    }
}

The rules can then be symlinked using:, (*8)

ln -s $(pwd)/vendor/andrewholgate/drupalstrict/DrupalStrict $(pwd)/vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/
ln -s $(pwd)/vendor/drupal/coder/coder_sniffer/Drupal $(pwd)/vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/
ln -s $(pwd)/vendor/drupal/drupalpractice/DrupalPractice $(pwd)/vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/

And run using the following command:, (*9)

./vendor/bin/phpcs --standard=Drupal,DrupalPractice,DrupalStrict,vendor/andrewholgate/drupalstrict/security_ruleset.xml  -- /path/to/code/

Note that DrupalStrict also contains a ruleset.xml file for the phpcs-security-audit tool., (*10)

The Versions

01/02 2015

dev-master

9999999-dev https://github.com/andrewholgate/drupalstrict

Drupal Strict: Strictly enforces additional coding standards for Drupal development using PHP CodeSniffer.

  Sources   Download

GNU GPL v2.0

The Requires

 

by Andrew Holgate

phpcs drupal standards code review

01/02 2015

v0.1.1

0.1.1.0 https://github.com/andrewholgate/drupalstrict

Drupal Strict: Strictly enforces additional coding standards for Drupal development using PHP CodeSniffer.

  Sources   Download

GNU GPL v2.0

The Requires

 

by Andrew Holgate

phpcs drupal standards code review

01/02 2015

dev-develop

dev-develop https://github.com/andrewholgate/drupalstrict

Drupal Strict: Strictly enforces additional coding standards for Drupal development using PHP CodeSniffer.

  Sources   Download

GNU GPL v2.0

The Requires

 

by Andrew Holgate

phpcs drupal standards code review

16/11 2014

v0.1.0

0.1.0.0 https://github.com/andrewholgate/drupalstrict

Drupal Strict: Strictly enforces additional coding standards for Drupal development using PHP CodeSniffer.

  Sources   Download

GNU GPL v2.0

The Requires

 

by Andrew Holgate

phpcs drupal standards code review