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
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
To install the library, run the command below and you will get the latest version:
composer require hgraca/phorensic
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
To generate the test coverage run:
make coverage
To fix the code standards run:
make cs-fix
- 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)