Showing 6 of 31 total issues
Function findUnbalancedNodes
has a Cognitive Complexity of 25 (exceeds 20 allowed). Consider refactoring. Open
func findUnbalancedNodes(n Node, diff int) {
if len(n.children) > 2 {
childWeights := make(map[int]int)
for i := range n.children {
- 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 solve
has a Cognitive Complexity of 24 (exceeds 20 allowed). Consider refactoring. Open
func solve(filename string, iterations int) (ones int) {
grid := [][]int{
[]int{0, 1, 0},
[]int{0, 0, 1},
[]int{1, 1, 1},
- 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 evalRule
has 7 return statements (exceeds 4 allowed). Open
func evalRule(s []string) bool {
regVal := register[s[0]]
val, _ := strconv.Atoi(s[2])
switch s[1] {
Avoid deeply nested control flow statements. Open
if reflect.DeepEqual(ruleToPattern(k), pattern) || reflect.DeepEqual(ruleToPattern(k), flip(pattern)) {
matchedRule = true
newGrid = append(newGrid, ruleToPattern(ruleSet[k]))
break
}
Function traverse
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
func traverse(grid map[Point]string, p Point, dir string, t string, steps int) (string, int) {
Function findSumGroups
has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring. Open
func findSumGroups(s string) (int, garbageCounter int) {
st := make(stack, 0)
sumGroups := 0
garbage := false
- 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"