Skip to content


The missing checkstyle for twig!

Twigcs aims to be what phpcs is to php. It checks your codebase for violations on coding standards.

DrevOps comes with pre-configured Twigcs ruleset for Drupal projects.


ahoy lint-be


See configuration reference.

All global configuration takes place in the .twig_cs.php file.

Targets include custom modules and themes.

Adding or removing targets:

return Twigcs\Config\Config::create()
  ->addFinder(Twigcs\Finder\TemplateFinder::create()->in(__DIR__ . '/web/themes/custom/mytheme'));


Twigcs does not support ignoring a file inline.

Twigcs does not support ignoring of the code blocks.

Twigcs does not support ignoring the current and the next line.

Twigcs supports ignoring violations for unused variables:

{# twigcs use-var bar #}
{% set bar = 1 %}

Ignoring fail in CI

This tool runs in CI by default and fails the build if there are any violations.

Set DREVOPS_CI_TWIGCS_IGNORE_FAILURE environment variable to 1 to ignore failures. The tool will still run and report violations, if any.