Hgraca\Phorensic
, (*1)
, (*2)
A static analysis tool to gather a few metrics, like what code should have priority in refactoring., (*3)
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, (*4)
Usage
This tool works in 2 steps:, (*5)
- 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:, (*6)
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:, (*7)
composer require hgraca/phorensic
Tests
To run the tests run:, (*8)
make test
Or just one of the following:, (*9)
make test-acceptance
make test-functional
make test-integration
make test-unit
make test-humbug
To run the tests in debug mode run:, (*10)
make test-debug
Coverage
To generate the test coverage run:, (*11)
make coverage
Code standards
To fix the code standards run:, (*12)
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)