Chio (chan) exports metrics of a specific module for checking it's stability and flexibility.
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
cmd clean unused block Feb 1, 2019
pkg dir module 1-depth level finish Feb 1, 2019
sample
.gitignore add bin Oct 26, 2018
.travis.yml add travis config Oct 18, 2018
Gopkg.lock colorful Jan 24, 2019
Gopkg.toml colorful Jan 24, 2019
LICENSE
Makefile
README.md clean unused block Feb 1, 2019

README.md

Chio

Chio (chan) exports metrics of a specific module for checking it's stability and flexibility.

What can it does

Main idea from Clean Architecture book Chapter 14.

Summarization go here.

Three metrics we care about:

  1. Abstractness (A): This metric has the range [0, 1]. A value of 0 implies that the module has no abstract classes at all. A value of 1 implies that the module contains nothing but abstract classes.
  2. Instability (I): This metric has the range [0, 1]. I = 0 indicates a maximally stable module. I = 1 indicates a maximally unstable module.
  3. Distance (D): There is a place, where A and I have a balance, it's called The Main Sequence. This metric has the range [0, 1]. D = 0 implies that the module lies in that place, and on the other side (D = 1) means far from balance line, locates in Zone of Pain or Zone of Uselessness.

Example output metrics extracted from boogeyman repo

+------------------+-------+----------+----------+-------+--------+--------------+-------------+----------+
|   MODULE PATH    | FILES | CONCRETE | ABSTRACT | FANIN | FANOUT | ABSTRACTNESS | INSTABILITY | DISTANCE |
+------------------+-------+----------+----------+-------+--------+--------------+-------------+----------+
| /adapter/        |     5 |        3 |        1 |     0 |     13 | 0.250        | 1.000       | 0.250    |
| /config/         |     5 |        5 |        0 |     1 |     13 | 0.000        | 0.929       | 0.071    |
| /cross_cutting/  |     2 |        0 |        1 |     5 |      2 | 1.000        | 0.286       | 0.286    |
| /domain/         |    13 |        3 |        1 |    11 |     12 | 0.250        | 0.522       | 0.228    |
| /infrastructure/ |    12 |        8 |        0 |     0 |     32 | 0.000        | 1.000       | 0.000    |
| /usecase/        |     4 |        1 |        2 |     0 |      7 | 0.667        | 1.000       | 0.667    |
+------------------+-------+----------+----------+-------+--------+--------------+-------------+----------+

Usage

In case exec file you downloaded's name is chio.

Sample full params command

$ ./chio -l go -p ./ -d 1

Type -h to get help. Return value be like

Usage of ./bin/chio-darwin-64:
  -d string
        dir as module, default n-depth (n) (default "n")
  -l string
        language(s): go (default "go")
  -p string
        path to module (default ".")

TODO list

Support language(s)

  • Golang
  • Java
  • NodeJs

Load module strategies

  • n-depth Directory level (group files in same dir as a module)
  • 1-depth Directory level

Run on local

Chio development environment requires:

  1. Golang (1.9.2 or higher). Install go here.
  2. dep (Go dependency management tool). Install go here.

Run by go

$ go run main.go

or check Makefile for building bin on your local.

Contribution

All contributions will be welcome in this project.

License

The MIT License (MIT). Please see LICENSE for more information.