Pdepend Analyze is a command line tool that analyzes the summary xml file generated by Pdepend. For now it shows the methods that have the highest Cylcomatic Complexity and N-Path Complexity in the Pdepend summary XML file generated for any given code base. There is a pdepend process command line tool that formats the Pdepend summary xml as HTML, its very useful. This command line tool can be used as part of the tests or even as a pre-commit hook to lower down the software complexity.
This library needs PHP 5.4+.
It has been tested using PHP 5.4 to PHP 5.6.
You can install the library directly with composer:
"geshan/pdepend-analyzer": "0.1.0"
To you this command line tool, you will need to generate your code metrics using PDepend with command like below:
ᐅ phpdepend --summary-xml=/tmp/summary.xml /path/to/your/src
For more information about Pdepend refer to its docs.
After you have your summary.xml
file with the software metrics of your code base you can run the pdepend-analyzer in
in the following ways:
ᐅ ./pdepend-analyze --file=tests/Pdepend/Fixtures/summary.xml
ᐅ ./pdepend-analyze --file=tests/Pdepend/Fixtures/summary.xml --cyclomatic-complexity-limit=2 --npath-complexity-limit=5
PHPUnit is used to test the command line tool. You will need composer to get the dependencies. To run tests locally, execute the following commands in project root:
ᐅ composer install --prefer-source
ᐅ ./vendor/bin/phpunit --configuration phpunit.xml --bootstrap vendor/autoload.php
Add an issue, open a PR, drop us an email! We would love to hear from you!