Showing 5 of 5 total issues

Method Container.fill has a Cognitive Complexity of 51 (exceeds 20 allowed). Consider refactoring.
Open

func (container Container) fill(c component) {
    if len(c.dependencies) == 0 {
        return
    }

Severity: Minor
Found in container.go - About 5 hrs to fix

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 Container.Connect has a Cognitive Complexity of 30 (exceeds 20 allowed). Consider refactoring.
Open

func (container Container) Connect(val interface{}, id ...string) {
    ptr := false
    rv := reflect.ValueOf(val)
    rt := rv.Type()
    nam := ""
Severity: Minor
Found in container.go - About 1 hr to fix

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 Container.Connect has 66 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func (container Container) Connect(val interface{}, id ...string) {
    ptr := false
    rv := reflect.ValueOf(val)
    rt := rv.Type()
    nam := ""
Severity: Minor
Found in container.go - About 1 hr to fix

    Method Container.fill has 51 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func (container Container) fill(c component) {
        if len(c.dependencies) == 0 {
            return
        }
    
    
    Severity: Minor
    Found in container.go - About 1 hr to fix

      Avoid deeply nested control flow statements.
      Open

                  if _, exist := container.components[sf.Type]; exist {
                      panic(tagForgottenError{field: sf})
                  }
      Severity: Major
      Found in container.go - About 45 mins to fix
        Severity
        Category
        Status
        Source
        Language