-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from petzich/develop
Improvements - Makefile and internalise pre-commit rules
- Loading branch information
Showing
3 changed files
with
55 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,22 @@ | ||
--- | ||
fail_fast: false | ||
repos: | ||
- repo: https://github.com/digitalpulp/pre-commit-php | ||
rev: 1.3.0 | ||
- repo: local | ||
hooks: | ||
- id: php-cbf | ||
name: Fix php code with php-cbf | ||
language: system | ||
entry: phpcbf | ||
verbose: true | ||
stages: [manual] | ||
types: [php] | ||
- repo: https://github.com/digitalpulp/pre-commit-php | ||
rev: 1.3.0 | ||
args: [-n] | ||
- repo: local | ||
hooks: | ||
- id: php-cs | ||
name: Check php code style with php-cs | ||
language: system | ||
entry: phpcs | ||
verbose: true | ||
types: [php] | ||
args: [-n] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Makefile for petzi/docker-pre-commit-php | ||
# Make targets to help in the development of this docker image | ||
|
||
.DEFAULT_GOAL := help | ||
|
||
# Docker configuration | ||
DOCKER=docker | ||
# Docker build configuration | ||
DOCKER_TAG=petzi/pre-commit-php | ||
|
||
# Docker run configuration for the main image | ||
DOCKER_VOL=-v "${PWD}:/src" | ||
DOCKER_WD=-w "/src" | ||
DOCKER_RUN_TEST=$(DOCKER) run --rm $(DOCKER_VOL) $(DOCKER_WD) | ||
|
||
# The help command is inspired by this post: | ||
# https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html | ||
.PHONY: help | ||
help: | ||
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' | ||
|
||
.PHONY: build | ||
build: ## Build the images on development | ||
$(DOCKER) build -t $(DOCKER_TAG) . | ||
|
||
.PHONY: test | ||
test: ## Run each image once to test the build result | ||
$(DOCKER_RUN_TEST) $(DOCKER_TAG) --all-files | ||
|
||
.PHONY: test-php-cbf | ||
test-php-cbf: ## Run php-cbf on all files | ||
$(DOCKER_RUN_TEST) $(DOCKER_TAG) --all-files --hook-stage=manual php-cbf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
/** | ||
* A (valid) test file for php-cs | ||
* | ||
* @category None | ||
* @package None | ||
* @author Test Author <[email protected]> | ||
* @license https://github.com/petzich/docker-pre-commit-php/blob/master/LICENSE MIT | ||
* @link None | ||
* */ | ||
echo "hello world"; | ||
|
||
?> |