Skip to content

Dockerfile for linting PHP, including with the Drupal coding standard

Notifications You must be signed in to change notification settings

dcycle/docker-php-lint

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CircleCI

Lint PHP projects using PHP Code Sniffer, including with the Drupal coding standard defined in the coder module.

This image was first created on December 2nd, 2016 and was not updated before Dec. 12, 2019. If you have a project which uses the image from before Dec. 12, 2019, use tag 1. After Dec. 12, 2019, this project will be rebuilt every week using the latest version of the software, and use

  • tag 2 for php 7
  • tag 3 for php 8

For example:

docker run --rm -v "$(pwd)":/code dcycle/php-lint:3 --standard=Drupal /code
docker run --rm -v "$(pwd)":/code dcycle/php-lint:3 /code

You will need to explicitly ignore js files or the Drupal and PHPCS linters will give conflicting information:

docker run --rm -v "$(pwd)":/code \
  dcycle/php-lint:3 \
  --ignore=data/*,*.js \
  --standard=Drupal \
  --report=full \
  /code

Get help like this:

docker run --rm -v $(pwd):/code dcycle/php-lint:3 --help

To ignore certain lines in your PHP files:

// @codingStandardsIgnoreStart
...
// @codingStandardsIgnoreEnd

To automatically fix errors you can add --entrypoint=/vendor/bin/phpcbf before dcycle/php-lint:3 in your command, like this:

docker run --rm -v "$(pwd)":/code --entrypoint=/vendor/bin/phpcbf dcycle/php-lint:3 /code

Resources

About

Dockerfile for linting PHP, including with the Drupal coding standard

Resources

Stars

Watchers

Forks

Packages

No packages published