Developer Guide
Last updated on
22 January 2020
This page is dedicated to assisting anyone who may contribute to the module.
Code Sniffing
To keep up with Drupal's best practices and coding standards, it is helpful during development to use code sniffing. Coder is the module being used, specifically the Code Sniffer.
You'll first need to follow the steps in the documentation for Installing Code Sniffer.
Once you have that installed and ready to go, you may refer to the Command Line Usage documentation for how to use this.
As an example, the following commands were used during initial development to ensure the code was adhering to both best practices and coding standards:
Check Drupal Best Practices
phpcs --standard=DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml /path/to/drupal/example_module
Check Drupal Coding Standards
phpcs --standard=Drupal --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml /path/to/drupal/example_module
Automatically Fix Coding Standards
phpcbf --standard=Drupal --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml /path/to/drupal/example_module
Help improve this page
Page status: No known problems
You can:
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion