Skip to content

Coding Standards

We use Drupal Coding Standards for all our contributed and custom modules.

PHPCodeSniffer runs our code linting using rules from Drupal Coder module and additional customizations. See our the PHPCodeSniffer configuration file.

Run all coding standards checks:

ahoy lint

Note that these checks run during automated builds.


  • Alphabetise package order where possible
    This helps developers to visually scan code faster.
  • Include information to make reviews easier
    Each patch attribute name should contain the title of the (d.o) issue, the link to the issue comment that contains the patch and the patch attribute value should be the patch file on
    "drupal/project": {
            "Issue title -": ""
    Following this approach makes it simpler to follow up the status of patches during updates.
    Example of a properly formatted patches attribute:
    "patches": {
          "drupal/better_exposed_filters": {
            "Add core/drupal as dependency to better_exposed_filters asset libraries -": ""
          "drupal/core": {
            "No validation on text length for menu description when editing node -": ""

Setting project coding standards inspections in PHPStorm

  1. PHPStorm > Preferences > Code Style
  2. Select the appropriate language (in the example image below it is PHP)
  3. Select the Set from... link
  4. Select Predefined Style > Drupal

It is then possible to use the keyboard shortcut Alt + command + l to format a file or selection.

Screenshot of PHPStorm settings