/docker-phpcs

Alpine-based multistage-build version of phpcs for reproducible usage in CI

Primary LanguageMakefileMIT LicenseMIT

Docker image for phpcs

Build Status Tag License

All #awesome-ci Docker images

ansible ansible-lint awesome-ci black checkmake eslint file-lint gofmt goimports golint jsonlint phpcbf phpcs phplint php-cs-fixer pycodestyle pylint terraform-docs terragrunt terragrunt-fmt yamlfmt yamllint

All #awesome-ci Makefiles

Visit cytopia/makefiles for seamless project integration, minimum required best-practice code linting and CI.

View Dockerfile on GitHub.

Docker hub

Tiny Alpine-based multistage-builld dockerized version of phpcs[1]. The image is built nightly against multiple stable versions and pushed to Dockerhub.

[1] Official project: https://github.com/squizlabs/PHP_CodeSniffer

Available Docker image versions

Docker images for PHP CodeSniffer come with all available PHP versions. In doubt use latest tag.

Latest stable phpcs version

Docker tag phpcs version PHP version
latest latest stable latest stable
latest-php7.3 latest stable latest stable 7.3.x
latest-php7.2 latest stable latest stable 7.2.x
latest-php7.1 latest stable latest stable 7.1.x
latest-php7.0 latest stable latest stable 7.0.x
latest-php5.6 latest stable latest stable 5.6.x

Latest stable phpcs 3.x.x version

Docker tag phpcs version PHP version
3 latest stable 3.x.x latest stable
3-php7.3 latest stable 3.x.x latest stable 7.3.x
3-php7.2 latest stable 3.x.x latest stable 7.2.x
3-php7.1 latest stable 3.x.x latest stable 7.1.x
3-php7.0 latest stable 3.x.x latest stable 7.0.x
3-php5.6 latest stable 3.x.x latest stable 5.6.x

Latest stable phpcs 2.x.x version

Docker tag phpcs version PHP version
2 latest stable 2.x.x latest stable
2-php7.3 latest stable 2.x.x latest stable 7.3.x
2-php7.2 latest stable 2.x.x latest stable 7.2.x
2-php7.1 latest stable 2.x.x latest stable 7.1.x
2-php7.0 latest stable 2.x.x latest stable 7.0.x
2-php5.6 latest stable 2.x.x latest stable 5.6.x

Docker mounts

The working directory inside the Docker container is /data/ and should be mounted locally to the root of your project.

Usage

$ docker run --rm -v $(pwd):/data cytopia/phpcs .

----------------------------------------------------------------------
FOUND 4 ERRORS AFFECTING 3 LINES
----------------------------------------------------------------------
 2 | ERROR | [ ] Missing file doc comment
 5 | ERROR | [x] First condition of a multi-line IF statement must
   |       |     directly follow the opening parenthesis
 6 | ERROR | [x] Line indented incorrectly; expected at least 4
   |       |     spaces, found 1
 6 | ERROR | [x] Closing brace must be on a line by itself
----------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

Related #awesome-ci projects

Docker images

Save yourself from installing lot's of dependencies and pick a dockerized version of your favourite linter below for reproducible local or remote CI tests:

GitHub DockerHub Type Description
awesome-ci aci-hub-img Basic Tools for git, file and static source code analysis
file-lint flint-hub-img Basic Baisc source code analysis
ansible ansible-hub-img Ansible Multiple versions and flavours of Ansible
ansible-lint alint-hub-img Ansible Lint Ansible
gofmt gfmt-hub-img Go Format Go source code [1]
goimports gimp-hub-img Go Format Go source code [1]
golint glint-hub-img Go Lint Go code
eslint elint-hub-img Javascript Lint Javascript code
jsonlint jlint-hub-img JSON Lint JSON files [1]
checkmake cm-hub-img Make Lint Makefiles
phpcbf pcbf-hub-img PHP PHP Code Beautifier and Fixer
phpcs pcs-hub-img PHP PHP Code Sniffer
phplint plint-hub-img PHP PHP Code Linter [1]
php-cs-fixer pcsf-hub-img PHP PHP Coding Standards Fixer
black black-hub-img Python The uncompromising Python code formatter
pycodestyle pycs-hub-img Python Python style guide checker
pylint pylint-hub-img Python Python source code, bug and quality checker
terraform-docs tfdocs-hub-img Terraform Terraform doc generator (TF 0.12 ready) [1]
terragrunt tg-hub-img Terraform Terragrunt and Terraform
terragrunt-fmt tgfmt-hub-img Terraform terraform fmt for Terragrunt files [1]
yamlfmt yfmt-hub-img Yaml Format Yaml files [1]
yamllint ylint-hub-img Yaml Lint Yaml files

[1] Uses a shell wrapper to add enhanced functionality not available by original project.

Makefiles

Visit cytopia/makefiles for dependency-less, seamless project integration and minimum required best-practice code linting for CI. The provided Makefiles will only require GNU Make and Docker itself removing the need to install anything else.

License

MIT License

Copyright (c) 2019 cytopia