Skip to content

PHP code sniffer plugin for Drupal code security audit.

Notifications You must be signed in to change notification settings

drupal-spider/DrupalSecurity

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 

Repository files navigation

DrupalSecurity

DrupalSecurity is a library for automated Drupal code security reviews. It defines rules for PHP_CodeSniffer

Note that Javascript has not been supported yet. To check and fix Javascript files please use ESLint and see the Drupal ESLint documentation.

Global installation

First, install phpcs:

PHP_CodeSniffe install

To make the phpcs command available globally, add the Composer bin path to your $PATH variable in ~/.profile, ~/.bashrc or ~/.zshrc:

export PATH="$PATH:$HOME/.composer/vendor/bin"

Second, install PHPCS plugins: Drupal coder PHPCSUtils

Last, download the DrupalSecurity folder to your local

Usage

Check Drupal Security standards

phpcs --standard=/path/to/DrupalSecurity --extensions=php,module,inc,install,theme,yml,twig /file/to/drupal/module