From dd4202e14bbc973195fefc00d9aa5c500b53516c Mon Sep 17 00:00:00 2001 From: Mathieu Ducrot Date: Wed, 23 Jun 2021 08:42:33 +0200 Subject: [PATCH] #1 Init QA bundles --- .gitignore | 5 +++++ Makefile | 38 ++++++++++++++++++++++++++++++++++++++ composer.json | 8 ++++---- src/.gitkeep | 0 tests/.gitkeep | 0 5 files changed, 47 insertions(+), 4 deletions(-) create mode 100644 .gitignore create mode 100644 src/.gitkeep create mode 100644 tests/.gitkeep diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7c43e86 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +/vendor/ +composer.lock +/phpmetrics/ +coverage.* +.php_cs.cache diff --git a/Makefile b/Makefile index 2ee0cb1..85d53c5 100644 --- a/Makefile +++ b/Makefile @@ -21,3 +21,41 @@ ps: ## List containers from project .PHONY: ssh ssh: ## Access to the php container in interactive mode docker exec -it --user=dev smartbooster-parameterbundle-php bash + +## +## Qualimetry +## ------- + +.PHONY: cs checkstyle +cs: checkstyle +checkstyle: ## PHP Checkstyle + vendor/bin/phpcs --extensions=php -n --standard=PSR12 --report=full src tests + +.PHONY: cb code-beautifier +cb: code-beautifier +code-beautifier: ## Code beautifier (Checkstyle fixer) + vendor/bin/phpcbf --extensions=php --standard=PSR12 src tests + +.PHONY: lint-php +lint-php: ## Linter PHP + find src -type f -name "*.php" -exec php -l {} \; + +.PHONY: composer-validate +composer-validate: ## Validate composer.json and composer.lock + composer validate composer.json + +.PHONY: cpd +cpd: ## Copy paste detector + vendor/bin/phpcpd --fuzzy src + +.PHONY: metrics +metrics: ## Build static analysis from the php in src. Repports available in ./phpmetrics/index.html + vendor/bin/phpmetrics --report-html=phpmetrics src + +.PHONY: phpstan +phpstan: ## Launch PHP Static Analysis + vendor/bin/phpstan analyse src --level=6 + +.PHONY: qa qualimetry +qa: qualimetry ## Launch all qualimetry rules +qualimetry: checkstyle lint-php composer-validate metrics phpstan diff --git a/composer.json b/composer.json index d62f21b..ca5bada 100644 --- a/composer.json +++ b/composer.json @@ -12,11 +12,11 @@ "homepage": "https://www.smartbooster.io" } ], - "require": { - - }, "require-dev": { - + "squizlabs/php_codesniffer": "^3.6", + "sebastian/phpcpd": "^6.0", + "phpmetrics/phpmetrics": "^2.7", + "phpstan/phpstan": "^0.12.90" }, "autoload": { "psr-4": { diff --git a/src/.gitkeep b/src/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/tests/.gitkeep b/tests/.gitkeep new file mode 100644 index 0000000..e69de29