Skip to content
A static analysis tool to gather a few metrics, like what code should have priority in refactoring.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin
src
storage
tests
var
.gitattributes
.gitignore
.php_cs.dist
.scrutinizer.yml
LICENSE
Makefile
README.md
box.json
composer.json
composer.lock
humbug.json.dist
phpunit.xml

README.md

Hgraca\Phorensic

Author Software License Latest Version Total Downloads

Build Status Coverage Status Quality Score

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:

  1. Mine the project for data, which is put in a sqlite DB
    • phorensic:extract [<repositoryPath>] [<since>] [<dbPath>]
  2. 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)
You can’t perform that action at this time.