From 5cddaf75d06f03c1c43d8dc6fbedacbc902561fc Mon Sep 17 00:00:00 2001 From: Vincent Letourneau Date: Sun, 30 Jul 2017 11:49:03 +0200 Subject: [PATCH] Add make PHP Code Sniffer --- Makefile | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 663d45c..e2288b7 100644 --- a/Makefile +++ b/Makefile @@ -11,6 +11,7 @@ help: @echo "" @echo "Commands:" @echo " apidoc Generate documentation of API" + @echo " code-sniff Check the API with PHP Code Sniffer (PSR2)" @echo " clean Clean directories for reset" @echo " composer-up Update php composer" @echo " docker-start Create and start containers" @@ -37,6 +38,10 @@ clean: @rm -Rf web/app/report @rm -Rf etc/ssl/* +code-sniff: + @echo "Checking the standard code..." + @docker exec $(shell docker-compose ps -q php) app/vendor/bin/phpcs --standard=PSR2 app/src + composer-up: @docker run --rm -v $(shell pwd)/web/app:/app composer/composer update @@ -64,11 +69,11 @@ mysql-dump: mysql-restore: @docker exec -i $(shell docker-compose ps -q mysqldb) mysql -u"$(MYSQL_ROOT_USER)" -p"$(MYSQL_ROOT_PASSWORD)" < $(MYSQL_DUMPS_DIR)/db.sql -test: - @docker exec -i $(shell docker-compose ps -q php) app/vendor/bin/phpunit --colors=always --configuration app/ +test: code-sniff + @docker exec $(shell docker-compose ps -q php) app/vendor/bin/phpunit --colors=always --configuration app/ @make resetOwner resetOwner: @$(shell chown -Rf $(SUDO_USER):$(shell id -g -n $(SUDO_USER)) $(MYSQL_DUMPS_DIR) "$(shell pwd)/etc/ssl" "$(shell pwd)/web/app" 2> /dev/null) -.PHONY: clean \ No newline at end of file +.PHONY: clean test code-sniff init \ No newline at end of file