Showing 11 of 47 total issues
Tree
has 44 methods (exceeds 20 allowed). Consider refactoring. Open
type Tree struct {
Root *Node // Root node
Comparator utils.Comparator // Key comparator
size int // Total number of keys in the tree
m int // order (maximum number of children)
Tree
has 29 methods (exceeds 20 allowed). Consider refactoring. Open
type Tree struct {
Root *Node
size int
Comparator utils.Comparator
}
File btree.go
has 502 lines of code (exceeds 500 allowed). Consider refactoring. Open
// Package btree implements a B tree.
//
// According to Knuth's definition, a B-tree of order m is a tree which satisfies the following properties:
// - Every node has at most m children.
// - Every non-leaf node (except root) has at least ⌈m/2⌉ children.
Method Tree.Visualizer
has 61 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (tree *Tree) Visualizer(fileName string) bool {
it := tree.Iterator()
dotString := "digraph G{bgcolor=azure;"
nodeIndexCount := 0
subGraphNumber := 0
Method Tree.Visualizer
has a Cognitive Complexity of 27 (exceeds 20 allowed). Consider refactoring. Open
func (tree *Tree) Visualizer(fileName string) bool {
it := tree.Iterator()
dotString := "digraph G{bgcolor=azure;"
nodeIndexCount := 0
subGraphNumber := 0
- 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
Method Iterator.Next
has a Cognitive Complexity of 26 (exceeds 20 allowed). Consider refactoring. Open
func (iterator *Iterator) Next() bool {
if iterator.position == end {
goto end
}
if iterator.position == begin {
- 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
Method Iterator.Prev
has a Cognitive Complexity of 26 (exceeds 20 allowed). Consider refactoring. Open
func (iterator *Iterator) Prev() bool {
if iterator.position == begin {
goto begin
}
if iterator.position == end {
- 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
Method Iterator.Next
has a Cognitive Complexity of 25 (exceeds 20 allowed). Consider refactoring. Open
func (iterator *Iterator) Next() bool {
// If already at end, go to end
if iterator.position == end {
goto end
}
- 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
Method Iterator.Prev
has a Cognitive Complexity of 25 (exceeds 20 allowed). Consider refactoring. Open
func (iterator *Iterator) Prev() bool {
// If already at beginning, go to begin
if iterator.position == begin {
goto begin
}
- 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
Method Tree.rebalance
has 51 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (tree *Tree) rebalance(node *Node, deletedKey interface{}) {
// check if rebalancing is needed
if node == nil || len(node.Entries) >= tree.minEntries() {
return
}
Method Tree.remove
has 6 return statements (exceeds 4 allowed). Open
func (t *Tree) remove(key interface{}, qp **Node) bool {
q := *qp
if q == nil {
return false
}