Sign inSign up

joinville/phpcs-wordpress

By joinville

•Updated almost 10 years ago

Docker image for PHP_CodeSniffer already configured for WordPress Coding Standards.

Artifact
0

2.8K

joinville/phpcs-wordpress repository overview

Docker image for PHP_CodeSniffer⁠ already configured for WordPress Coding Standards⁠.

⁠Build

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

# Under proxy
docker build --no-cache -t joinville/phpcs-wordpress --build-arg "http_proxy=$http_proxy" .

⁠Test

Show the available standards:

$ docker run joinville/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/ joinville/phpcs-wordpress phpcs  --standard=WordPress-Core /scripts/

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

⁠GitLab CI example

# Run PHP_CodeSniffer in our custom WordPress plugin and theme
code_lint:
  stage: test
  image: joinville/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

Tag summary

Content type

Unrecognized

Digest

Size

27 MB

Last updated

almost 10 years ago

docker pull joinville/phpcs-wordpress