From ba53b03df3366a01498adccb71e9829cb55cca9a Mon Sep 17 00:00:00 2001 From: Gangler Fabrice Date: Thu, 27 Feb 2020 12:55:54 +0100 Subject: [PATCH] CHORE(QA): add PHP Mess Detector (PHPMD) dependency documentation: https://phpqa.io/projects/phpmd.html https://phpmd.org install: composer require --dev phpmd/phpmd Refs: #24 --- webapp/composer.json | 1 + webapp/composer.lock | 163 ++++++++++++++++++++++++++++++++++++++++++- webapp/grumphp.yml | 28 ++++---- webapp/symfony.lock | 9 +++ 4 files changed, 185 insertions(+), 16 deletions(-) diff --git a/webapp/composer.json b/webapp/composer.json index e0d8a2b..d1202b6 100644 --- a/webapp/composer.json +++ b/webapp/composer.json @@ -40,6 +40,7 @@ "doctrine/doctrine-fixtures-bundle": "^3.3", "fzaninotto/faker": "^1.9", "jakub-onderka/php-parallel-lint": "^1.0", + "phpmd/phpmd": "^2.8", "phpro/grumphp": "^0.18.0", "symfony/browser-kit": "5.0.*", "symfony/css-selector": "5.0.*", diff --git a/webapp/composer.lock b/webapp/composer.lock index f3dafb7..ddff459 100644 --- a/webapp/composer.lock +++ b/webapp/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "9afec40bca4e1d3d28072af3653c2eb1", + "content-hash": "dea16d94bd4214cba1790ddf47dd5874", "packages": [ { "name": "doctrine/annotations", @@ -6113,6 +6113,50 @@ } ], "packages-dev": [ + { + "name": "composer/xdebug-handler", + "version": "1.4.0", + "source": { + "type": "git", + "url": "https://github.com/composer/xdebug-handler.git", + "reference": "cbe23383749496fe0f373345208b79568e4bc248" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/cbe23383749496fe0f373345208b79568e4bc248", + "reference": "cbe23383749496fe0f373345208b79568e4bc248", + "shasum": "" + }, + "require": { + "php": "^5.3.2 || ^7.0 || ^8.0", + "psr/log": "^1.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.7 || 6.5 - 8" + }, + "type": "library", + "autoload": { + "psr-4": { + "Composer\\XdebugHandler\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "John Stevenson", + "email": "john-stevenson@blueyonder.co.uk" + } + ], + "description": "Restarts a process without Xdebug.", + "keywords": [ + "Xdebug", + "performance" + ], + "time": "2019-11-06T16:40:04+00:00" + }, { "name": "doctrine/data-fixtures", "version": "1.4.2", @@ -6506,6 +6550,53 @@ ], "time": "2019-11-08T13:50:10+00:00" }, + { + "name": "pdepend/pdepend", + "version": "2.7.1", + "source": { + "type": "git", + "url": "https://github.com/pdepend/pdepend.git", + "reference": "daba1cf0a6edaf172fa02a17807ae29f4c1c7471" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/pdepend/pdepend/zipball/daba1cf0a6edaf172fa02a17807ae29f4c1c7471", + "reference": "daba1cf0a6edaf172fa02a17807ae29f4c1c7471", + "shasum": "" + }, + "require": { + "php": ">=5.3.7", + "symfony/config": "^2.3.0|^3|^4|^5", + "symfony/dependency-injection": "^2.3.0|^3|^4|^5", + "symfony/filesystem": "^2.3.0|^3|^4|^5" + }, + "require-dev": { + "easy-doc/easy-doc": "0.0.0 || ^1.2.3", + "gregwar/rst": "^1.0", + "phpunit/phpunit": "^4.8.35|^5.7", + "squizlabs/php_codesniffer": "^2.0.0" + }, + "bin": [ + "src/bin/pdepend" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.x-dev" + } + }, + "autoload": { + "psr-4": { + "PDepend\\": "src/main/php/PDepend" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "Official version of pdepend to be handled with Composer", + "time": "2020-02-08T12:06:13+00:00" + }, { "name": "php-webdriver/webdriver", "version": "1.8.1", @@ -6571,6 +6662,76 @@ ], "time": "2020-02-17T08:14:38+00:00" }, + { + "name": "phpmd/phpmd", + "version": "2.8.2", + "source": { + "type": "git", + "url": "https://github.com/phpmd/phpmd.git", + "reference": "714629ed782537f638fe23c4346637659b779a77" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpmd/phpmd/zipball/714629ed782537f638fe23c4346637659b779a77", + "reference": "714629ed782537f638fe23c4346637659b779a77", + "shasum": "" + }, + "require": { + "composer/xdebug-handler": "^1.0", + "ext-xml": "*", + "pdepend/pdepend": "^2.7.1", + "php": ">=5.3.9" + }, + "require-dev": { + "easy-doc/easy-doc": "0.0.0 || ^1.3.2", + "gregwar/rst": "^1.0", + "mikey179/vfsstream": "^1.6.4", + "phpunit/phpunit": "^4.8.36 || ^5.7.27", + "squizlabs/php_codesniffer": "^2.0" + }, + "bin": [ + "src/bin/phpmd" + ], + "type": "library", + "autoload": { + "psr-0": { + "PHPMD\\": "src/main/php" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Manuel Pichler", + "email": "github@manuel-pichler.de", + "homepage": "https://github.com/manuelpichler", + "role": "Project Founder" + }, + { + "name": "Marc Würth", + "email": "ravage@bluewin.ch", + "homepage": "https://github.com/ravage84", + "role": "Project Maintainer" + }, + { + "name": "Other contributors", + "homepage": "https://github.com/phpmd/phpmd/graphs/contributors", + "role": "Contributors" + } + ], + "description": "PHPMD is a spin-off project of PHP Depend and aims to be a PHP equivalent of the well known Java tool PMD.", + "homepage": "https://phpmd.org/", + "keywords": [ + "mess detection", + "mess detector", + "pdepend", + "phpmd", + "pmd" + ], + "time": "2020-02-16T20:15:50+00:00" + }, { "name": "phpro/grumphp", "version": "v0.18.0", diff --git a/webapp/grumphp.yml b/webapp/grumphp.yml index e9c9804..cabd93a 100644 --- a/webapp/grumphp.yml +++ b/webapp/grumphp.yml @@ -17,6 +17,7 @@ parameters: tasks: - composer # - phpcs + - phpmd - phplint - jsonlint - xmllint @@ -40,15 +41,7 @@ parameters: - phplint # - phpcs # - phpcpd - ## - ## test-suite for the "vendor/bin/grumphp run --testsuite php_testSuite_full" command: - ## ---> run following tasks on the full codebase - php_testSuite_full: - tasks: - - phplint - # - phpcs - # - phpcpd - # - phpmd + - phpmd tasks: ## ######## git_commit_msg @@ -166,12 +159,17 @@ parameters: # triggered_by: ['php'] ## ## PHP Mess Detector: https://github.com/phpro/grumphp/blob/master/doc/tasks/phpmd.md - ## -----> detects too many errors for the current source code - # phpmd: - # whitelist_patterns: [] - # exclude: [] - # ruleset: ['cleancode', 'codesize', 'naming'] - # triggered_by: ['php'] + phpmd: + whitelist_patterns: [] + exclude: [] + ruleset: + - 'cleancode' + - 'codesize' + - 'controversial' + - 'design' + - 'naming' + - 'unusedcode' + triggered_by: ['php'] ## ## PhpMnd (detect magic numbers): https://github.com/phpro/grumphp/blob/master/doc/tasks/phpmnd.md ## -----> impossible to install at the moment because conflict between dependencies diff --git a/webapp/symfony.lock b/webapp/symfony.lock index 08d41f6..1290009 100644 --- a/webapp/symfony.lock +++ b/webapp/symfony.lock @@ -1,4 +1,7 @@ { + "composer/xdebug-handler": { + "version": "1.4.0" + }, "doctrine/annotations": { "version": "1.0", "recipe": { @@ -129,6 +132,9 @@ "ocramius/proxy-manager": { "version": "2.2.3" }, + "pdepend/pdepend": { + "version": "2.7.1" + }, "php": { "version": "7.2" }, @@ -144,6 +150,9 @@ "phpdocumentor/type-resolver": { "version": "1.0.1" }, + "phpmd/phpmd": { + "version": "2.8.2" + }, "phpro/grumphp": { "version": "v0.18.0" }, -- GitLab