Giter VIP home page Giter VIP logo

docker-php-cs-fixer's Introduction

Docker image for php-cs-fixer

Tag License

lint build nightly

All #awesome-ci Docker images

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

View Dockerfiles on GitHub.

Available Architectures: amd64, i386, arm64, arm/v7, arm/v6, ppc64le, s390x

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

🐳 Available Docker image versions

Docker

Rolling releaess

The following Docker image tags are rolling releases and are built and updated every night.

nightly

Docker Tag Git Ref PHPCF PHP Available Architectures
latest master latest latest amd64, i386, arm64, arm/v7, arm/v6, ppc64le, s390x
latest-php8.1 master latest 8.1 amd64, i386, arm64, arm/v7, arm/v6, ppc64le, s390x
latest-php8.0 master latest 8.0 amd64, i386, arm64, arm/v7, arm/v6, ppc64le, s390x
latest-php7.4 master latest 7.4 amd64, i386, arm64, arm/v7, arm/v6, ppc64le, s390x
3 master 3.x.x latest amd64, i386, arm64, arm/v7, arm/v6, ppc64le, s390x
3-php8.1 master 3.x.x 8.1 amd64, i386, arm64, arm/v7, arm/v6, ppc64le, s390x
3-php8.0 master 3.x.x 8.0 amd64, i386, arm64, arm/v7, arm/v6, ppc64le, s390x
3-php7.4 master 3.x.x 7.4 amd64, i386, arm64, arm/v7, arm/v6, ppc64le, s390x
2 master 2.x.x latest amd64, i386, arm64, arm/v7, arm/v6, ppc64le, s390x
2-php8.1 master 2.x.x 8.1 amd64, i386, arm64, arm/v7, arm/v6, ppc64le, s390x
2-php8.0 master 2.x.x 8.0 amd64, i386, arm64, arm/v7, arm/v6, ppc64le, s390x
2-php7.4 master 2.x.x 7.4 amd64, i386, arm64, arm/v7, arm/v6, ppc64le, s390x
2-php7.3 master 2.x.x 7.3 amd64, i386, arm64, arm/v7, arm/v6, ppc64le, s390x
2-php7.2 master 2.x.x 7.2 amd64, i386, arm64, arm/v7, arm/v6, ppc64le, s390x
2-php7.1 master 2.x.x 7.1 amd64, i386, arm64, arm/v7, arm/v6, ppc64le, s390x
2-php7.0 master 2.x.x 7.0 amd64, i386, arm64, arm/v7, arm/v6, ppc64le
2-php5.6 master 2.x.x 5.6 amd64, i386, arm64, arm/v7, arm/v6, ppc64le

Point in time releases

The following Docker image tags are built once and can be used for reproducible builds. Its version never changes so you will have to update tags in your pipelines from time to time in order to stay up-to-date.

build

Docker Tag Git Ref PHPCF PHP Available Architectures
latest-<tag> git: <tag> latest latest amd64, i386, arm64, arm/v7, arm/v6, ppc64le, s390x
latest-php8.1-<tag> git: <tag> latest 8.1 amd64, i386, arm64, arm/v7, arm/v6, ppc64le, s390x
latest-php8.0-<tag> git: <tag> latest 8.0 amd64, i386, arm64, arm/v7, arm/v6, ppc64le, s390x
latest-php7.4-<tag> git: <tag> latest 7.4 amd64, i386, arm64, arm/v7, arm/v6, ppc64le, s390x
3-<tag> git: <tag> 3.x.x latest amd64, i386, arm64, arm/v7, arm/v6, ppc64le, s390x
3-php8.1-<tag> git: <tag> 3.x.x 8.1 amd64, i386, arm64, arm/v7, arm/v6, ppc64le, s390x
3-php8.0-<tag> git: <tag> 3.x.x 8.0 amd64, i386, arm64, arm/v7, arm/v6, ppc64le, s390x
3-php7.4-<tag> git: <tag> 3.x.x 7.4 amd64, i386, arm64, arm/v7, arm/v6, ppc64le, s390x
2-<tag> git: <tag> 2.x.x latest amd64, i386, arm64, arm/v7, arm/v6, ppc64le, s390x
2-php8.1-<tag> git: <tag> 2.x.x 8.1 amd64, i386, arm64, arm/v7, arm/v6, ppc64le, s390x
2-php8.0-<tag> git: <tag> 2.x.x 8.0 amd64, i386, arm64, arm/v7, arm/v6, ppc64le, s390x
2-php7.4-<tag> git: <tag> 2.x.x 7.4 amd64, i386, arm64, arm/v7, arm/v6, ppc64le, s390x
2-php7.3-<tag> git: <tag> 2.x.x 7.3 amd64, i386, arm64, arm/v7, arm/v6, ppc64le, s390x
2-php7.2-<tag> git: <tag> 2.x.x 7.2 amd64, i386, arm64, arm/v7, arm/v6, ppc64le, s390x
2-php7.1-<tag> git: <tag> 2.x.x 7.1 amd64, i386, arm64, arm/v7, arm/v6, ppc64le, s390x
2-php7.0-<tag> git: <tag> 2.x.x 7.0 amd64, i386, arm64, arm/v7, arm/v6, ppc64le
2-php5.6-<tag> git: <tag> 2.x.x 5.6 amd64, i386, arm64, arm/v7, arm/v6, ppc64le

Where <tag> refers to the chosen git tag from this repository.

📂 Docker mounts

The working directory inside the Docker container is /data/ and should be mounted locally.

💻 Usage

Generic

$ 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

Dry-run

$ 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

Example Makefile

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)

Travis CI integration

---
sudo: required
language: minimal
services:
  - docker
script:
  - make lint

🔄 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
linkcheck linkcheck-hub-img Basic Search for URLs in files and validate their HTTP status code
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]
kubeval kubeval-hub-img K8s Lint Kubernetes files
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
bandit bandit-hub-img Python A security linter from PyCQA
black black-hub-img Python The uncompromising Python code formatter
mypy mypy-hub-img Python Static source code analysis
pycodestyle pycs-hub-img Python Python style guide checker
pydocstyle pyds-hub-img Python Python docstyle 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

docker-php-cs-fixer's People

Contributors

cytopia avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

docker-php-cs-fixer's Issues

Project abandoned?

Hi folks!
First of all: Thanks for the effort you've put into this Image. We use this image in production ci/cd pipelines in multiple projects and I'm happy someone build this since the original project is not maintaining docker images.

I really don't want to be the douche asking about project abandonment, but we really depend on this image and the development looks very stale. Since there have already been people opening up pull requests for updating language support (thanks btw Orkin!), I'm seriously considering forking this project to keep development running - but I want to make sure the original project maintainer has the opportunity to speak out first.

Please don't take this the wrong way, I'm really thankful for your push on this - but we really need a reliable image here.

Thanks in advance for your understanding!

Support of php 8.2

Hi, their is a plan to support php 8.2 ?

I made a PR (don't know if it's really needed) : #19

Not operational for 4 months - any plans to revive it

Hi! Looking for a docker image to create docker-based pre-commit hook,

In one of the latest version, the PSR12 ruleset was introduced which I want to use
Unfortunately, this repo docker image is not built for a couple of months.
Are there any plans to restart it or should I look for an alternative?

Thanks, and appreciate your effort to make other's lives easier.

Image is not updating since 3 months

Hello, I've tried to understand why the latest tag was behind the actual latest version of php-cs-fixer and found out that nightly build has been disabled because of inactivity in the repo.

image

It might be interesting to auto-update the repo with CI to avoid this pitfall.

Cheers.

Nightly builds failed because of v2.16.6 and v2.16.7

The building of the docker images has failed because v2.16.6 and v2.16.7 required PHP7.0 and PHP7.1. This requirement was unique to those version. Building the latest PCF (2.17.3) with PHP5.6, PHP7.0 and PHP7.1 works as expected.

Can you restart the nightly building?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.