Last updated 16 May 2016. Created on 28 January 2012.
Edited by volkswagenchick, klausi, kporras07, siliconmeadow. Log in to edit this page.

Coder Sniffer is a tool to help write code for Drupal or its modules. It can detect and automatically fix coding standard errors.
The project provides a coding standard for PHP_CodeSniffer based on the Drupal Coding Standard.

Those checks apply to all versions of Drupal, so you can use Coder 8.x-2.x to check Drupal 7 code.


This sniffer has been created because of the need to run coding standards checks without requiring a full drupal installation. This is great for checking code validation on a standalone server without a drupal site, checking a single file from a code editor (Eclipse, Textmate, etc.), or setting up pre-commit hooks on all files being committed.

Looking for support? Visit the forums, or join #drupal-support in IRC.


alex.designworks’s picture

DCR (Drupal Code Review) is a command-line utility to check that produced code follows Drupal coding standards and best practices.

It is a shell script wrapper around PHP_CodeSniffer and JSCS with Drupal-related code sniffs. It uses native and custom 3rd party phpcs sniffs.
It fully relies on Coder module, but also allows per-project sniffs configuration.

And also it scans JS files, so there is no need to set up jslint separately.

Finally, it can be used for automated builds and plays nice with false positives.

Director /Software Engineer | Integrated Experts |