asteris-llc/converge

View on GitHub
load/dependencyresolver.go

Summary

Maintainability
B
4 hrs
Test Coverage

Function alignEdgesInGroup has a Cognitive Complexity of 29 (exceeds 20 allowed). Consider refactoring.
Open

func alignEdgesInGroup(ctx context.Context, g *graph.Graph, id, group string) (*graph.Graph, error) {
    upEdges := withoutRoot(g.UpEdgesInGroup(id, group))
    for i, upEdge := range upEdges {
        if i > 0 {
            dest := highestGroupEdge(g, upEdges[i-1], group)
Severity: Minor
Found in load/dependencyresolver.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

Function ResolveDependencies has 7 return statements (exceeds 4 allowed).
Open

func ResolveDependencies(ctx context.Context, g *graph.Graph) (*graph.Graph, error) {
    logger := logging.GetLogger(ctx).WithField("function", "ResolveDependencies")
    logger.Debug("resolving dependencies")

    groupLock := new(sync.Mutex)
Severity: Major
Found in load/dependencyresolver.go - About 45 mins to fix

    Function getParams has 5 return statements (exceeds 4 allowed).
    Open

    func getParams(g *graph.Graph, id string, node *parse.Node) (out []string, err error) {
        var nodeStrings []string
        nodeStrings, err = node.GetStrings()
        if err != nil {
            return nil, err
    Severity: Major
    Found in load/dependencyresolver.go - About 35 mins to fix

      Function getXrefs has 5 return statements (exceeds 4 allowed).
      Open

      func getXrefs(g *graph.Graph, id string, node *parse.Node) (out []string, err error) {
          var nodeStrings []string
          var calls []string
          nodeRefs := make(map[string]struct{})
          nodeStrings, err = node.GetStrings()
      Severity: Major
      Found in load/dependencyresolver.go - About 35 mins to fix

        Function ResolveDependencies has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
        Open

        func ResolveDependencies(ctx context.Context, g *graph.Graph) (*graph.Graph, error) {
            logger := logging.GetLogger(ctx).WithField("function", "ResolveDependencies")
            logger.Debug("resolving dependencies")
        
            groupLock := new(sync.Mutex)
        Severity: Minor
        Found in load/dependencyresolver.go - About 25 mins 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

        There are no issues that match your filters.

        Category
        Status