lcom4

package module
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 2, 2022 License: MIT Imports: 6 Imported by: 0

README

LCOM4go

LCOM4go is a tool to compute LCOM4, Lack of Cohesion of Methods metrics ver.4, for golang projects.

Usage

$ ./lcom4go ./...
...

$ ./lcom4go net/http
...

LCOM4 definition

https://objectscriptquality.com/docs/metrics/lack-cohesion-methods-lcom4

Examples

The lcom4 of s0 is 1 because both method1 and method2 use s0.m.

type s0 struct {
	m int
}

func (a s0) method1() int {
	return a.m
}
func (a s0) method2() int {
	return -a.m
}

The lcom4 of s1 is 2 because method3 uses a.n which is not used by method1 and method2.

type s1 struct {
	m int
	n int
}

func (a s1) method1() int {
	return a.m
}
func (a s1) method2() int {
	return -a.m
}
func (a s1) method3() int {
	return -a.n
}

Running the tests

go test ./...

License

This software is released under the MIT License, see the license file.

References

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Analyzer = &analysis.Analyzer{
	Name:     "lcom4",
	Doc:      doc,
	Run:      run,
	Requires: []*analysis.Analyzer{},
}

Analyzer is the lcom4 analyzer.

Functions

This section is empty.

Types

This section is empty.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL