Skip to content
Andrii Havryliuk edited this page Oct 23, 2024 · 2 revisions

Description

This is a fork of https://github.com/phpmetrics/PhpMetrics with some adjustments to make package dependencies for Shopware more understandable.

What changed

  • Added configuration option package-depth to make package dependencies report more coarse-grained (0 will switch to default behavior)
  • Added configuration option package-exclude to exclude from report namespaces starting with one of provided prefixes. For more details see PackageSieve and it's usages.

Usage

  1. Clone repository
  2. Checkout 3.x-custom-package-resolution branch
  3. Run composer install
  4. Create configuration file phpmetrics.json:
{
  "composer": true,
  "includes": [
    "src",
    "custom/plugins/SwagCommercial/src",
    "custom/plugins/SaasRufus/src"
  ],
  "excludes": [
    "Test.php",
    "_fixture",
    "vendor"
  ],
  "extensions": [
    "php"
  ],
  "groups": [
    {
      "name": "Core",
      "match": "!^Shopware\\\\Core\\\\!"
    },
    {
      "name": "Administration",
      "match": "!^Shopware\\\\Administration\\\\!"
    },
    {
      "name": "Elasticsearch",
      "match": "!^Shopware\\\\Elasticsearch\\\\!"
    },
    {
      "name": "Storefront",
      "match": "!^Shopware\\\\Storefront\\\\!"
    },
    {
      "name": "WebInstaller",
      "match": "!^Shopware\\\\WebInstaller\\\\!"
    },
    {
      "name": "Migration",
      "match": "!migration!i"
    },
    {
      "name": "Commercial",
      "match": "!^Shopware\\\\Commercial\\\\!"
    },
    {
      "name": "Rufus",
      "match": "!^Swag\\\\SaasRufus\\\\!"
    }
  ],
  "package-depth": 4,
  "package-exclude": [
    "Shopware\\Core\\Migration\\V6_3\\",
    "Shopware\\Core\\Migration\\V6_4\\",
    "Shopware\\Core\\Migration\\V6_5\\",
    "Shopware\\Core\\Migration\\V6_6\\",
    "Shopware\\Core\\Migration\\V6_7\\",
    "Shopware\\Core\\Framework\\DataAbstractionLayer\\",
    "Symfony\\",
    "Doctrine\\"
  ],
  "plugins": {
  }
}
  1. Run analysis php ./path_to_the_code/bin/phpmetrics --config=phpmetrics.json --report-html=phpmetrics_report --report-json=phpmetrics_report.json
Clone this wiki locally