maintidx

maintidx measures the maintainability index of each function.
Here for more information about this library.(Sorry, Japanese only)

What is maintainability index

The maintainability index is an index that measures the maintainability of source code.
The coefficients include cyclomatic complexity, halstead volume, and line of code.
This library used the rebased value provided by Microsoft.
The maintainability index is an experimental value, so don’t expect too much from it, but the cyclomatic complexity used as a coefficient was found to be closely related to the number of times the code was edited.

Installation

Go version < 1.16

go get -u github.com/yagipy/maintidx/cmd/[email protected]

Go version 1.16+

go install github.com/yagipy/maintidx/cmd/[email protected]

Usage

standalone

maintidx ./...

with go run

No installation required

go run github.com/yagipy/maintidx/cmd/maintidx ./...

with go vet

go vet -vettool=`which maintidx` ./...

Flag

Flags:
  -under int
    	show functions with maintainability index < N only. (default 20)

TODO

  • Setup execute env on container
  • Impl cyc.Cyc.Calc()
  • Move maintidx.Visitor.PrintHalstVol to halstval package
  • Consider the necessity of halstvol.incrIfAllTrue
  • Test under pkg file

GitHub

View Github