joeyblake / docker-phpcs-wordpress

Docker container for PHP_CodeSniffer with WordPress rules

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Docker image for PHP_CodeSniffer already configured for WordPress Coding Standards.

Build

# No proxy
docker build --no-cache -t joeyblake/phpcs-wordpress .

Test

Show the available standards:

$ docker run joeyblake/phpcs-wordpress phpcs -i
The installed coding standards are MySource, PEAR, PHPCS, Squiz, Zend, PSR2, PSR1, WordPress, WordPress-Extra, WordPress-Docs, WordPress-Core and WordPress-VIP
$

Run

# Check for code standards issues
docker run -v /path/to/php/files/:/scripts/ joeyblake/phpcs-wordpress phpcs  --standard=WordPress-Core .

# Fix code standards issues
docker run -v /path/to/php/files/:/scripts/ joeyblake/phpcs-wordpress phpcbf --standard=WordPress-Core .

GitLab CI example

# Run PHP_CodeSniffer in our custom WordPress plugin and theme
code_lint:
  stage: test
  image: joeyblake/phpcs-wordpress
  script:
    - phpcs --standard=WordPress-Core wp-content/plugins/my-awesome-plugin
    - phpcs --standard=WordPress-Core --ignore=/bootstrap/,/inc/ wp-content/themes/my-awesome-theme

About

Docker container for PHP_CodeSniffer with WordPress rules


Languages

Language:Dockerfile 100.0%