hgraca / phorensic
A static analysis tool to gather a few metrics, like what code should have priority in refactoring.
dev-master / 1.0.x-dev
2017-01-03 20:34 UTC
Requires
- php: >=7.0
- cilex/cilex: ^2.0
- hgraca/file-system: ^1.2.1
- hgraca/helper: ^1.4.0
- hgraca/micro-dbal: ^0.2.0
- pdepend/pdepend: @stable
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.0
- humbug/humbug: ^1.0@alpha
- mockery/mockery: ^0.9
- phpunit/php-code-coverage: ~3
- phpunit/phpunit: ~5
- roave/security-advisories: dev-master
This package is auto-updated.
Last update: 2020-01-15 00:43:54 UTC
README
A static analysis tool to gather a few metrics, like what code should have priority in refactoring.
The metrics aimed for are:
- Hotspots detection (complexity * change_rate)
- Prioritize code for refactoring
- Code units temporal coupling
- If there is no reason for them to change together (unlike tests and the code they test), they should probably be refactored
- Code units ownership analysis
- To detect team knowledge deficiencies
Usage
This tool works in 2 steps:
- Mine the project for data, which is put in a sqlite DB
phorensic:extract [<repositoryPath>] [<since>] [<dbPath>]
- Query a sqlite DB for information
phorensic:analyse <dbPath> [<limit>]
So, for example:
bin/run phorensic:extract /opt/my_project "last month" "./analyse_2016-12-20_23:51:36.sqlite" bin/run phorensic:analyse "./analyse_2016-12-20_23:51:36.sqlite" 20
Installation
To install the library, run the command below and you will get the latest version:
composer require hgraca/phorensic
Tests
To run the tests run:
make test
Or just one of the following:
make test-acceptance make test-functional make test-integration make test-unit make test-humbug
To run the tests in debug mode run:
make test-debug
Coverage
To generate the test coverage run:
make coverage
Code standards
To fix the code standards run:
make cs-fix
Todo
- Create Builder class so that we can do dep inj with the commands and make them testable
- Test the commands
- Create command to find classes with temporal-coupling
- Create command to find specific class ownership
- Create command to find specific package ownership
- Create command to find ownership analysis (ownership fractals)