Docker image providing static analysis tools for Drupal and PHP. This is based on the comprehensive PHPQA image and adds Drupal specific sniffs and PAReview.
DockerHub repository: https://hub.docker.com/r/hussainweb/drupalqa
This image currently only supports Debian along with 8.0, 8.1, and 8.2. PHP 7.x images are available but no longer supported by the upstream image.
php7.3
(end of support)php7.4
(end of support)php8.0
(8.x/debian/Dockerfile)php8.1
(8.x/debian/Dockerfile)php8.2
(8.x/debian/Dockerfile)php8.3
(8.x/debian/Dockerfile)
See PHPQA's available tools for a complete list of tools provided by that image. DrupalQA adds these tools:
- Drupal coder sniffs by the Drupal Coder module - Checks for Drupal coding standards
- DrupalPractice coder sniffs by the Drupal Coder module - Checks for best practices for Drupal
- DrupalSecure coder sniffs (outdated and will be removed)
- PHPCompatibility coder sniffs
- PAReview.sh - Runs various Drupal sniffs in sequence
- Drupal Check - check for correctness, deprecation errors specifically for Drupal modules, and more
NOTE: Drupal coder sniffs requires additional dependencies which aren't loaded when PHPCS is run via PHAR module (as is the case with phpcs provided by the phpqa image). For this reason, we remove the phpcs PHAR file and install it using composer.
Pull the image:
docker pull hussainweb/drupalqa:latest
Read additional documentation in phpqa's README.
To run the selected tool inside the container, you'll need to mount the project directory on the container with -v $(pwd):/project
. Some tools like to write to the /tmp
directory (like PHPStan, or Behat in some cases), therefore it's often useful to share it between docker runs, i.e. with -v $(pwd)/tmp-phpqa:/tmp
. If you want to be able to interrupt the selected tool if it takes too much time to complete, you can use the --init
option. Please refer to the docker run documentation for more information.
docker run --init -it --rm -v $(pwd):/project -v $(pwd)/tmp-phpqa:/tmp -w /project hussainweb/drupalqa phpstan analyse web/modules/custom
You can run DrupalQA as part of your GitHub Actions workflow directly using the associate action. Visit the action page readme or the marketplace page to learn more.