All #awesome-ci Docker images
ansible-lint • ansible • awesome-ci • bandit • black • checkmake • eslint • file-lint • gofmt • goimports • golint • jsonlint • linkcheck • mypy • php-cs-fixer • phpcbf • phpcs • phplint • pycodestyle • pydocstyle • pylint • terraform-docs • terragrunt-fmt • terragrunt • 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.
Tiny Alpine-based multistage-build dockerized version of php-cs-fixer[1]. The image is built nightly against multiple stable versions and pushed to Dockerhub.
[1] Official project: https://github.com/FriendsOfPHP/PHP-CS-Fixer
Docker images for PHP Coding Standards Fixer come with all available PHP versions. In doubt use latest
tag.
Docker tag | php-cs-fixer version | PHP version |
---|---|---|
latest |
latest stable | latest stable |
latest-php8.0 |
latest stable | latest stable 8.0.x |
latest-php7.4 |
latest stable | latest stable 7.4.x |
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 |
Docker tag | php-cs-fixer version | PHP version |
---|---|---|
3 |
latest stable 3.x.x |
latest stable |
3-php8.0 |
latest stable 3.x.x |
latest stable 8.0.x |
3-php7.4 |
latest stable 3.x.x |
latest stable 7.4.x |
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 |
Docker tag | php-cs-fixer version | PHP version |
---|---|---|
2 |
latest stable 2.x.x |
latest stable |
2-php8.0 |
latest stable 2.x.x |
latest stable 8.0.x |
2-php7.4 |
latest stable 2.x.x |
latest stable 7.4.x |
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 tag | php-cs-fixer version | PHP version |
---|---|---|
1 |
latest stable 1.x.x |
latest stable supported version |
1-php7.1 |
latest stable 1.x.x |
latest stable 7.1.x |
1-php7.0 |
latest stable 1.x.x |
latest stable 7.0.x |
1-php5.6 |
latest stable 1.x.x |
latest stable 5.6.x |
The working directory inside the Docker container is /data/
and should be mounted locally to
the root of your project.
$ docker run --rm cytopia/php-cs-fixer --help
Usage:
list [options] [--] [<namespace>]
Arguments:
namespace The namespace name
Options:
--raw To output raw command list
--format=FORMAT The output format (txt, xml, json, or md) [default: "txt"]
Help:
The list command lists all commands:
php /usr/bin/php-cs-fixer list
You can also display the commands for a specific namespace:
php /usr/bin/php-cs-fixer list test
You can also output the information in other formats by using the --format option:
php /usr/bin/php-cs-fixer list --format=xml
It's also possible to get raw list of commands (useful for embedding command runner):
php /usr/bin/php-cs-fixer list --raw
$ docker run --rm -v $(pwd):/data cytopia/php-cs-fixer fix --dry-run --diff .
Loaded config default.
Using cache file ".php_cs.cache".
1) fail.php
---------- begin diff ----------
--- Original
+++ New
@@ @@
<?php
echo "test";
-if ( 1 ==2) {
- echo "asd"; }
+if (1 ==2) {
+ echo "asd";
+}
----------- end diff -----------
Checked all files in 0.004 seconds, 10.000 MB memory used
You can add the following Makefile to your project for easy generation of php-cs-fixer.
ifneq (,)
.error This Makefile requires GNU Make.
endif
.PHONY: lint _lint-pcf _update-pcf
CURRENT_DIR = $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
PCF_VERSION = 2
lint:
@echo "################################################################################"
@echo "# Linting Stage"
@echo "################################################################################"
@$(MAKE) --no-print-directory _lint-pcf
_lint-pcf: _update-pcf
@echo "------------------------------------------------------------"
@echo " PHP Code Style Fixer"
@echo "------------------------------------------------------------"
@if docker run --rm \
-v $(CURRENT_DIR):/data \
cytopia/php-cs-fixer:$(PCF_VERSION) \
fix --dry-run --diff .; then \
echo "OK"; \
else \
echo "Failed"; \
exit 1; \
fi
_update-pcf:
docker pull cytopia/php-cs-fixer:$(PCF_VERSION)
---
sudo: required
language: minimal
services:
- docker
script:
- make lint
Related #awesome-ci projects
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 | Basic | Tools for git, file and static source code analysis | |
file-lint | Basic | Baisc source code analysis | |
linkcheck | Basic | Search for URLs in files and validate their HTTP status code | |
ansible | Ansible | Multiple versions and flavours of Ansible | |
ansible-lint | Ansible | Lint Ansible | |
gofmt | Go | Format Go source code [1] | |
goimports | Go | Format Go source code [1] | |
golint | Go | Lint Go code | |
eslint | Javascript | Lint Javascript code | |
jsonlint | JSON | Lint JSON files [1] | |
checkmake | Make | Lint Makefiles | |
phpcbf | PHP | PHP Code Beautifier and Fixer | |
phpcs | PHP | PHP Code Sniffer | |
phplint | PHP | PHP Code Linter [1] | |
php-cs-fixer | PHP | PHP Coding Standards Fixer | |
bandit | Python | A security linter from PyCQA | |
black | Python | The uncompromising Python code formatter | |
mypy | Python | Static source code analysis | |
pycodestyle | Python | Python style guide checker | |
pydocstyle | Python | Python docstyle checker | |
pylint | Python | Python source code, bug and quality checker | |
terraform-docs | Terraform | Terraform doc generator (TF 0.12 ready) [1] | |
terragrunt | Terraform | Terragrunt and Terraform | |
terragrunt-fmt | Terraform | terraform fmt for Terragrunt files [1] |
|
yamlfmt | Yaml | Format Yaml files [1] | |
yamllint | Yaml | Lint Yaml files |
[1] Uses a shell wrapper to add enhanced functionality not available by original project.
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.
Copyright (c) 2019 cytopia