asteris-llc/converge

View on GitHub
apply/pipeline.go

Summary

Maintainability
D
1 day
Test Coverage

Method pipelineGen.pipelineGen.pipelineGen.pipelineGen.applyNode has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

func (g *pipelineGen) applyNode(ctx context.Context, val interface{}) (interface{}, error) {
    if asResult, ok := val.(*Result); ok {
        return asResult, nil
    }
    twrapper, ok := val.(resultWrapper)
Severity: Minor
Found in apply/pipeline.go - About 1 hr to fix

    Method pipelineGen.pipelineGen.pipelineGen.pipelineGen.maybeRunFinalCheck has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    func (g *pipelineGen) maybeRunFinalCheck(ctx context.Context, resultI interface{}) (interface{}, error) {
        result, ok := resultI.(*Result)
        if !ok {
            return nil, fmt.Errorf("expected *Result but got %T", resultI)
        }
    Severity: Minor
    Found in apply/pipeline.go - About 1 hr to fix

      Method pipelineGen.pipelineGen.pipelineGen.DependencyCheck has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      func (g *pipelineGen) DependencyCheck(ctx context.Context, taskI interface{}) (interface{}, error) {
          result, ok := taskI.(resultWrapper)
          if !ok {
              return nil, errors.New("input node is not a task wrapper")
          }
      Severity: Minor
      Found in apply/pipeline.go - About 45 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

      Method pipelineGen.pipelineGen.pipelineGen.maybeRunFinalCheck has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      func (g *pipelineGen) maybeRunFinalCheck(ctx context.Context, resultI interface{}) (interface{}, error) {
          result, ok := resultI.(*Result)
          if !ok {
              return nil, fmt.Errorf("expected *Result but got %T", resultI)
          }
      Severity: Minor
      Found in apply/pipeline.go - About 45 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

      Method pipelineGen.pipelineGen.pipelineGen.pipelineGen.pipelineGen.maybeRunFinalCheck has 5 return statements (exceeds 4 allowed).
      Open

      func (g *pipelineGen) maybeRunFinalCheck(ctx context.Context, resultI interface{}) (interface{}, error) {
          result, ok := resultI.(*Result)
          if !ok {
              return nil, fmt.Errorf("expected *Result but got %T", resultI)
          }
      Severity: Major
      Found in apply/pipeline.go - About 35 mins to fix

        Method pipelineGen.pipelineGen.pipelineGen.pipelineGen.DependencyCheck has 5 return statements (exceeds 4 allowed).
        Open

        func (g *pipelineGen) DependencyCheck(ctx context.Context, taskI interface{}) (interface{}, error) {
            result, ok := taskI.(resultWrapper)
            if !ok {
                return nil, errors.New("input node is not a task wrapper")
            }
        Severity: Major
        Found in apply/pipeline.go - About 35 mins to fix

          Method pipelineGen.pipelineGen.pipelineGen.applyNode has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          func (g *pipelineGen) applyNode(ctx context.Context, val interface{}) (interface{}, error) {
              if asResult, ok := val.(*Result); ok {
                  return asResult, nil
              }
              twrapper, ok := val.(resultWrapper)
          Severity: Minor
          Found in apply/pipeline.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

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

          func (g *pipelineGen) Renderer(id string) (*render.Renderer, error) {
              return g.RenderingPlant.GetRenderer(id)
          }
          Severity: Major
          Found in apply/pipeline.go and 1 other location - About 2 hrs to fix
          plan/pipeline.go on lines 192..194

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 56.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

              return executor.NewPipeline().
                  AndThen(gen.GetTask).
                  AndThen(gen.DependencyCheck).
                  AndThen(gen.maybeSkipApplication).
                  AndThen(gen.applyNode).
          Severity: Major
          Found in apply/pipeline.go and 1 other location - About 2 hrs to fix
          plan/pipeline.go on lines 45..49

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 55.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

          // Copyright © 2016 Asteris, LLC
          //
          // Licensed under the Apache License, Version 2.0 (the "License");
          // you may not use this file except in compliance with the License.
          // You may obtain a copy of the License at
          Severity: Major
          Found in apply/pipeline.go and 1 other location - About 1 hr to fix
          resource/file/owner/utils.go on lines 1..74

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 47.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

              if inner, ok := status.(settable); ok && err != nil {
                  inner.SetError(err)
              }
          Severity: Minor
          Found in apply/pipeline.go and 1 other location - About 55 mins to fix
          plan/pipeline.go on lines 181..183

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 36.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 13 locations. Consider refactoring.
          Open

          func (g *pipelineGen) DependencyCheck(ctx context.Context, taskI interface{}) (interface{}, error) {
              result, ok := taskI.(resultWrapper)
              if !ok {
                  return nil, errors.New("input node is not a task wrapper")
              }
          Severity: Major
          Found in apply/pipeline.go and 12 other locations - About 40 mins to fix
          apply/pipeline.go on lines 52..57
          apply/pipeline.go on lines 95..113
          apply/pipeline.go on lines 119..152
          apply/pipeline.go on lines 157..184
          executor/pipeline.go on lines 49..59
          plan/pipeline.go on lines 53..71
          plan/pipeline.go on lines 76..102
          plan/pipeline.go on lines 117..142
          plan/pipeline.go on lines 148..190
          render/render.go on lines 73..81
          render/render.go on lines 84..124
          render/render.go on lines 175..183

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 32.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 13 locations. Consider refactoring.
          Open

          func (g *pipelineGen) applyNode(ctx context.Context, val interface{}) (interface{}, error) {
              if asResult, ok := val.(*Result); ok {
                  return asResult, nil
              }
              twrapper, ok := val.(resultWrapper)
          Severity: Major
          Found in apply/pipeline.go and 12 other locations - About 40 mins to fix
          apply/pipeline.go on lines 52..57
          apply/pipeline.go on lines 64..90
          apply/pipeline.go on lines 95..113
          apply/pipeline.go on lines 157..184
          executor/pipeline.go on lines 49..59
          plan/pipeline.go on lines 53..71
          plan/pipeline.go on lines 76..102
          plan/pipeline.go on lines 117..142
          plan/pipeline.go on lines 148..190
          render/render.go on lines 73..81
          render/render.go on lines 84..124
          render/render.go on lines 175..183

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 32.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 13 locations. Consider refactoring.
          Open

          func (g *pipelineGen) GetTask(ctx context.Context, idi interface{}) (interface{}, error) {
              if plan, ok := idi.(*plan.Result); ok {
                  return resultWrapper{Plan: plan}, nil
              }
              return nil, fmt.Errorf("expected plan.Result but got %T", idi)
          Severity: Major
          Found in apply/pipeline.go and 12 other locations - About 40 mins to fix
          apply/pipeline.go on lines 64..90
          apply/pipeline.go on lines 95..113
          apply/pipeline.go on lines 119..152
          apply/pipeline.go on lines 157..184
          executor/pipeline.go on lines 49..59
          plan/pipeline.go on lines 53..71
          plan/pipeline.go on lines 76..102
          plan/pipeline.go on lines 117..142
          plan/pipeline.go on lines 148..190
          render/render.go on lines 73..81
          render/render.go on lines 84..124
          render/render.go on lines 175..183

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 32.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 13 locations. Consider refactoring.
          Open

          func (g *pipelineGen) maybeRunFinalCheck(ctx context.Context, resultI interface{}) (interface{}, error) {
              result, ok := resultI.(*Result)
              if !ok {
                  return nil, fmt.Errorf("expected *Result but got %T", resultI)
              }
          Severity: Major
          Found in apply/pipeline.go and 12 other locations - About 40 mins to fix
          apply/pipeline.go on lines 52..57
          apply/pipeline.go on lines 64..90
          apply/pipeline.go on lines 95..113
          apply/pipeline.go on lines 119..152
          executor/pipeline.go on lines 49..59
          plan/pipeline.go on lines 53..71
          plan/pipeline.go on lines 76..102
          plan/pipeline.go on lines 117..142
          plan/pipeline.go on lines 148..190
          render/render.go on lines 73..81
          render/render.go on lines 84..124
          render/render.go on lines 175..183

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 32.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 13 locations. Consider refactoring.
          Open

          func (g *pipelineGen) maybeSkipApplication(ctx context.Context, resultI interface{}) (interface{}, error) {
              if asResult, ok := resultI.(*Result); ok {
                  return asResult, nil
              }
              asPlan, ok := resultI.(resultWrapper)
          Severity: Major
          Found in apply/pipeline.go and 12 other locations - About 40 mins to fix
          apply/pipeline.go on lines 52..57
          apply/pipeline.go on lines 64..90
          apply/pipeline.go on lines 119..152
          apply/pipeline.go on lines 157..184
          executor/pipeline.go on lines 49..59
          plan/pipeline.go on lines 53..71
          plan/pipeline.go on lines 76..102
          plan/pipeline.go on lines 117..142
          plan/pipeline.go on lines 148..190
          render/render.go on lines 73..81
          render/render.go on lines 84..124
          render/render.go on lines 175..183

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 32.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          There are no issues that match your filters.

          Category
          Status