Showing 8 of 35 total issues
Function TestFromStringLiterals
has 157 lines of code (exceeds 25 allowed). Consider refactoring. Open
func TestFromStringLiterals(t *testing.T) {
for _, test := range [...]struct {
name string
pkgpath string
files map[string]string
Function TestAddNode
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
func TestAddNode(t *testing.T) {
tests := []struct {
name string
graph Graph
node *Node
Function TestAddEdge
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
func TestAddEdge(t *testing.T) {
tests := []struct {
name string
node *Node
dest *Node
Function TestContainsNode
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
func TestContainsNode(t *testing.T) {
tests := []struct {
name string
graph Graph
id string
Function TestId
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
func TestId(t *testing.T) {
var tests = []struct {
name string
want string
pkgFn func() *types.Package
Function TestAddNode
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
func TestAddNode(t *testing.T) {
tests := []struct {
name string
graph Graph
node *Node
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function traverse
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
func traverse(defs map[*ast.Ident]types.Object) graph.Graph {
g := graph.New()
for _, def := range defs {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function addRelated
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
func addRelated(g graph.Graph, node *graph.Node) error {
t, ok := node.Object.(Typer)
if !ok {
return errors.New("node does not have a Type() method")
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"