Skip to content

maintidx measures the maintainability index of each function.

License

Notifications You must be signed in to change notification settings

yagipy/maintidx

Repository files navigation

maintidx

maintidx measures the maintainability index of each function.
Here for more information about this package.(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/maintidx@v1.0.0

Go version 1.16+

go install github.com/yagipy/maintidx/cmd/maintidx@v1.0.0

Usage

standalone

maintidx ./...
  1. Install golangci-lint
  2. Execute the following
golangci-lint run --disable-all -E maintidx

It's also available to use .golangci.yml

# Add maintidx to enable linters.
linters:
  enable:
    - maintidx

linters-settings:
  maintidx:
    # Show functions with maintainability index lower than N.
    # A high index indicates better maintainability (it's kind of the opposite of complexity).
    # Default: 20
    under: 100

Execute using .golangci.yml

golangci-lint run

with go run

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)

About

maintidx measures the maintainability index of each function.

Resources

License

Stars

Watchers

Forks

Packages

No packages published