From 3a22e1b3984fd39a39c9a96f7280a1f191f14427 Mon Sep 17 00:00:00 2001 From: Daniel Speicher <daniel.speicher@lakedrops.com> Date: Thu, 30 May 2024 16:10:04 +0200 Subject: [PATCH] Document Drupal Development Env: composer/plugin/drupal-development-environment#1 --- .../plugin/drupal-dev-environment/index.md | 7 ++- docs/dev_tools/test.md | 47 +++++++++++++++++-- 2 files changed, 47 insertions(+), 7 deletions(-) diff --git a/docs/composer/plugin/drupal-dev-environment/index.md b/docs/composer/plugin/drupal-dev-environment/index.md index ad1ff7f..5fea776 100644 --- a/docs/composer/plugin/drupal-dev-environment/index.md +++ b/docs/composer/plugin/drupal-dev-environment/index.md @@ -15,11 +15,10 @@ It provides a massive amount of testing tools, which can be executed out of the - [Dependency Analysis](../../../dev_tools/test.md#drupal-dependency-analysis) - [PHP Unit](../../../dev_tools/test.md#unitkernelfunctional-testing) - [PHP Code Sniffer](../../../dev_tools/test.md#php-code-sniffer) -- [PHP PHPStan](../../../dev_tools/test.md#php-stan) -- [PHP Lint](../../../dev_tools/test.md#php-code-sniffer) +- [PHP Stan](../../../dev_tools/test.md#php-stan) +- [PHP Lint](../../../dev_tools/test.md#php-lint) - [PHP LOC](../../../dev_tools/test.md#php-loc) - [PHP Mess Detection](../../../dev_tools/test.md#php-mess-detection) -- [PHP Copy and Paste Detector](../../../dev_tools/test.md#php-code-sniffer) -- [PHP Metrics](../../../dev_tools/test.md#php-code-sniffer) +- [PHP Metrics](../../../dev_tools/test.md#php-metrics) - [PHP Stylelint](../../../dev_tools/test.md#php-code-sniffer) - [Eslint](../../../dev_tools/test.md#php-code-sniffer) diff --git a/docs/dev_tools/test.md b/docs/dev_tools/test.md index 6f521c1..2e387e3 100644 --- a/docs/dev_tools/test.md +++ b/docs/dev_tools/test.md @@ -44,11 +44,10 @@ We have several tools to perform static code analysis. - [PHP Code Sniffer](#php-code-sniffer) - [PHP PHPStan](#php-stan) -- [PHP Lint](#php-code-sniffer) +- [PHP Lint](#php-lint) - [PHP LOC](#php-loc) - [PHP Mess Detection](../../../dev_tools/test.md#php-mess-detection) -- [PHP Copy and Paste Detector](../../../dev_tools/test.md#php-code-sniffer) -- [PHP Metrics](../../../dev_tools/test.md#php-code-sniffer) +- [PHP Metrics](#php-metrics) - [PHP Stylelint](../../../dev_tools/test.md#php-code-sniffer) - [Eslint](../../../dev_tools/test.md#php-code-sniffer) @@ -134,6 +133,22 @@ a test phpstan <file_ordirectory> Whether it is a directory, it runs the analysis for everything under this directory recursively. +### PHP Lint + +You can execute PHP Lint for a specific Drupal contrib module: + +```phplint +a test phplintmodule <contrib_module> +``` + +Now the entire code in that module will be analysed. + +If you want to analyse a custom module, just do the following: + +```phplint +a test phplintmodule ../custom/<custom_module> +``` + ### PHP LOC PHP LOC prints several metrics about your code, like the average size of a class. @@ -164,6 +179,32 @@ a test phpmd <file_ordirectory> json <profile> Whether it is a directory, it runs the analysis for everything under this directory recursively. +### PHP Metrics + +This useful tool provides more information as [PHP LOC](#php-loc). It adds for example: + +- complexity +- bugs +- object-oriented programming stats +- coupling +- etc. + +Note: **This can take a while depending on your module.** + +You can execute PHP Metrics for a specific Drupal contrib module: + +```phpmet +a test phpmetricsmodule <contrib_module> +``` + +Now the entire code in that module will be analysed. + +If you want to analyse a custom module, just do the following: + +```phpmet +a test phpmetricsmodule ../custom/<custom_module> +``` + ## Unit/Kernel/Functional Testing To execute the tests, you can use a single command: -- GitLab