PHPackages                             andrewholgate/drupalstrict - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. andrewholgate/drupalstrict

ActiveLibrary[Testing &amp; Quality](/categories/testing)

andrewholgate/drupalstrict
==========================

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

v0.1.1(11y ago)112.1k1[1 PRs](https://github.com/andrewholgate/drupalstrict/pulls)GNU GPL v2.0PHP &gt;=5.2.0

Since Nov 16Pushed 11y ago1 watchersCompare

[ Source](https://github.com/andrewholgate/drupalstrict)[ Packagist](https://packagist.org/packages/andrewholgate/drupalstrict)[ Docs](https://github.com/andrewholgate/drupalstrict)[ RSS](/packages/andrewholgate-drupalstrict/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (4)Used By (0)

DrupalStrict code review
========================

[](#drupalstrict-code-review)

Drupal Strict code review sniffer is a series of [PHP CodeSniffer](http://www.squizlabs.com/php-codesniffer) rules which enforce coding standards beyond the Drupal 7 standards found in the [Coder Sniffer module](https://www.drupal.org/project/coder).

The majority of the rules are designed to enforce better coding legibility by flagging complex code.

Examples
--------

[](#examples)

- [Cyclomatic complexity](http://en.wikipedia.org/wiki/Cyclomatic_complexity) must not surpass 10.
- A maximum [nesting level](http://en.wikipedia.org/wiki/Nesting_(computing)) of 5.
- Detection of commented out code.
- Disallow multiple assignments, `eval` and inner functions.

Installation
------------

[](#installation)

Using [Composer](https://getcomposer.org/), add the following to your `composer.json`

```
{
    "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:

```
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
-----

[](#usage)

You can review your project code using the Drupal and Drupal Strict Standards by entering:

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

```

See the [PHP CodeSniffer commandline usage](http://pear.php.net/manual/en/package.php.php-codesniffer.usage.php) for more configurations.

Additional Code Review Rules
----------------------------

[](#additional-code-review-rules)

Other rules can also be installed for additional code reviews.

```
{
    "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:

```
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:

```
./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.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~76 days

Total

2

Last Release

4116d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e3d5beb787af496d19dd89f65034927158facae615a1c7cd5abe38e31f38f8ed?d=identicon)[andrewholgate](/maintainers/andrewholgate)

---

Top Contributors

[![andrewholgate](https://avatars.githubusercontent.com/u/3862180?v=4)](https://github.com/andrewholgate "andrewholgate (6 commits)")

---

Tags

standardsphpcscode reviewdrupal

### Embed Badge

![Health badge](/badges/andrewholgate-drupalstrict/health.svg)

```
[![Health](https://phpackages.com/badges/andrewholgate-drupalstrict/health.svg)](https://phpackages.com/packages/andrewholgate-drupalstrict)
```

###  Alternatives

[wp-coding-standards/wpcs

PHP\_CodeSniffer rules (sniffs) to enforce WordPress coding conventions

2.7k42.5M1.6k](/packages/wp-coding-standards-wpcs)[dealerdirect/phpcodesniffer-composer-installer

PHP\_CodeSniffer Standards Composer Installer Plugin

596161.9M1.9k](/packages/dealerdirect-phpcodesniffer-composer-installer)[phpcompatibility/phpcompatibility-wp

A ruleset for PHP\_CodeSniffer to check for PHP cross-version compatibility issues in projects, while accounting for polyfills provided by WordPress.

21830.6M587](/packages/phpcompatibility-phpcompatibility-wp)[acquia/coding-standards

PHP\_CodeSniffer rules (sniffs) for Acquia coding standards

214.8M28](/packages/acquia-coding-standards)[phpcsstandards/phpcsextra

A collection of sniffs and standards for use with PHP\_CodeSniffer.

10224.3M44](/packages/phpcsstandards-phpcsextra)[drupal/coder

Coder is a library to review Drupal code.

3043.6M460](/packages/drupal-coder)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
