diff --git a/.travis.yml b/.travis.yml index 637081ad..e6b3b5d7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,6 +7,5 @@ php: - '7.1' install: - composer update -script: ./vendor/bin/phpunit ./tests +script: composer test sudo: false - diff --git a/Makefile b/Makefile index 7604f66c..eb9d48f0 100644 --- a/Makefile +++ b/Makefile @@ -1,57 +1,21 @@ -COMPOSER_BIN = ./vendor/bin - -.PHONY: default test doc phpcs phpmd check install-devtool copyright release +.PHONY: default test doc phpcs phpmd check install-devtool copyright release clean install reinstall default: check test: - $(COMPOSER_BIN)/phpunit ./tests + composer test doc: - yes yes | $(COMPOSER_BIN)/apigen generate --source=./src --destination=./docs --title line-bot-sdk-php + composer doc phpcs: - $(COMPOSER_BIN)/phpcs --standard=PSR2 src/ tests/ examples/EchoBot/src examples/EchoBot/public examples/KitchenSink/src examples/KitchenSink/public + composer cs phpmd: - $(COMPOSER_BIN)/phpmd ./src text cleancode,codesize,controversial,design,unusedcode,naming | \ - grep -v 'Avoid using static access to class' | \ - grep -v 'Avoid variables with short names like' | \ - grep -v 'Avoid excessively long variable names like' | \ - grep -v 'The method register uses an else expression' | \ - grep -v 'The method sendRequest uses an else expression' | \ - cat - $(COMPOSER_BIN)/phpmd ./examples/EchoBot/src text cleancode,codesize,controversial,design,unusedcode,naming | \ - grep -v 'Avoid using static access to class' | \ - grep -v 'Avoid variables with short names like' | \ - grep -v 'Avoid excessively long variable names like' | \ - grep -v 'The method register uses an else expression' | \ - grep -v 'The method sendRequest uses an else expression' | \ - cat - $(COMPOSER_BIN)/phpmd ./examples/EchoBot/public text cleancode,codesize,controversial,design,unusedcode,naming | \ - grep -v 'Avoid using static access to class' | \ - grep -v 'Avoid variables with short names like' | \ - grep -v 'Avoid excessively long variable names like' | \ - grep -v 'The method register uses an else expression' | \ - grep -v 'The method sendRequest uses an else expression' | \ - cat - $(COMPOSER_BIN)/phpmd ./examples/KitchenSink/src text cleancode,codesize,controversial,design,unusedcode,naming | \ - grep -v 'Avoid using static access to class' | \ - grep -v 'Avoid variables with short names like' | \ - grep -v 'Avoid excessively long variable names like' | \ - grep -v 'The method register uses an else expression' | \ - grep -v 'The method sendRequest uses an else expression' | \ - cat - $(COMPOSER_BIN)/phpmd ./examples/KitchenSink/public text cleancode,codesize,controversial,design,unusedcode,naming | \ - grep -v 'Avoid using static access to class' | \ - grep -v 'Avoid variables with short names like' | \ - grep -v 'Avoid excessively long variable names like' | \ - grep -v 'The method register uses an else expression' | \ - grep -v 'The method sendRequest uses an else expression' | \ - cat + composer md copyright: - bash ./devtool/check_copyright.sh + devtool/check_copyright.sh check: test copyright phpcs phpmd @@ -68,3 +32,10 @@ endif git tag $(VERSION) git push origin $(VERSION) +clean: + rm -rf vendor composer.lock + +install: + composer install + +reinstall: clean install diff --git a/composer.json b/composer.json index 12cb23fd..cfb13c37 100644 --- a/composer.json +++ b/composer.json @@ -38,5 +38,11 @@ "psr-4": { "LINE\\Tests\\": "tests/" } + }, + "scripts": { + "test": "phpunit tests", + "doc": "apigen generate --source=src --destination=docs --title line-bot-sdk-php", + "cs": "phpcs --standard=PSR2 src tests examples/EchoBot/src examples/EchoBot/public examples/KitchenSink/src examples/KitchenSink/public", + "md": "phpmd --ignore-violations-on-exit src,examples/EchoBot/src,examples/EchoBot/public,examples/KitchenSink/src,examples/KitchenSink/public text phpmd.xml" } } diff --git a/devtool/check_copyright.sh b/devtool/check_copyright.sh old mode 100644 new mode 100755 diff --git a/phpmd.xml b/phpmd.xml new file mode 100644 index 00000000..4f56ca49 --- /dev/null +++ b/phpmd.xml @@ -0,0 +1,29 @@ + + + + line-bot-sdk-php phpmd custom rules + + KitchenSink/Route.php + + + + + + + + + + + + + + + + + + + +