From c6c355ad59743f0b93e6c564451c774c2271df97 Mon Sep 17 00:00:00 2001 From: SonataCI Date: Sun, 31 Dec 2017 02:07:32 +0100 Subject: [PATCH] DevKit updates --- .travis.yml | 1 - Makefile | 51 ++++++++++++++++++++++++++++++++++++++++++++------- 2 files changed, 44 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9e29b262..8b297c3b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -35,7 +35,6 @@ env: - SYMFONY_DEPRECATIONS_HELPER=weak - TARGET=test - UPSTREAM_URL=https://github.com/sonata-project/SonataNotificationBundle.git - - XMLLINT_INDENT=" " matrix: fast_finish: true diff --git a/Makefile b/Makefile index 6fb54c87..74403c5b 100644 --- a/Makefile +++ b/Makefile @@ -2,22 +2,59 @@ # # It's auto-generated by sonata-project/dev-kit package. -.PHONY: test docs - all: @echo "Please choose a task." +.PHONY: all + +lint: lint-composer lint-yaml lint-composer lint-xml lint-php +.PHONY: lint -lint: +lint-composer: composer validate - find . -name '*.yml' -not -path './vendor/*' -not -path './Resources/public/vendor/*' | xargs yaml-lint +.PHONY: lint-composer + +lint-yaml: + find . -name '*.yml' -not -path './vendor/*' -not -path './src/Resources/public/vendor/*' | xargs yaml-lint + +.PHONY: lint-yaml + +lint-xml: find . \( -name '*.xml' -or -name '*.xliff' \) \ - -not -path './vendor/*' -not -path './Resources/public/vendor/*' \ - | xargs -I'{}' xmllint --encode UTF-8 --output '{}' --format '{}' + -not -path './vendor/*' \ + -not -path './src/Resources/public/vendor/*' \ + | while read xmlFile; \ + do \ + XMLLINT_INDENT=' ' xmllint --encode UTF-8 --format "$$xmlFile"|diff - "$$xmlFile"; \ + if [ $$? -ne 0 ] ;then exit 1; fi; \ + done + +.PHONY: lint-xml + +lint-php: + php-cs-fixer fix --ansi --verbose --diff --dry-run +.PHONY: lint-php + +cs-fix: cs-fix-php cs-fix-xml +.PHONY: cs-fix + +cs-fix-php: php-cs-fixer fix --verbose - git diff --exit-code +.PHONY: cs-fix-php + +cs-fix-xml: + find . \( -name '*.xml' -or -name '*.xliff' \) \ + -not -path './vendor/*' \ + -not -path './src/Resources/public/vendor/*' \ + | while read xmlFile; \ + do \ + XMLLINT_INDENT=' ' xmllint --encode UTF-8 --format "$$xmlFile" --output "$$xmlFile"; \ + done +.PHONY: cs-fix-xml test: phpunit -c phpunit.xml.dist --coverage-clover build/logs/clover.xml +.PHONY: test docs: cd docs && sphinx-build -W -b html -d _build/doctrees . _build/html +.PHONY: docs