asteris-llc/converge

View on GitHub

Showing 247 of 615 total issues

Function execPipeline has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

func execPipeline(ctx context.Context, in *graph.Graph, pipelineF MkPipelineF, renderingPlant *render.Factory, notify *graph.Notifier) (*graph.Graph, error) {
Severity: Minor
Found in apply/apply.go - About 35 mins to fix

    Function simpleCheckSuccess has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    func simpleCheckSuccess(t *testing.T, lvm lowlevel.LVM, group string, name string, size *lowlevel.LvmSize) (resource.TaskStatus, resource.Task) {
    Severity: Minor
    Found in resource/lvm/lv/lv_test.go - About 35 mins to fix

      Function simpleApplyFailure has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      func simpleApplyFailure(t *testing.T, lvm lowlevel.LVM, group string, name string, size *lowlevel.LvmSize) resource.TaskStatus {
      Severity: Minor
      Found in resource/lvm/lv/lv_test.go - About 35 mins to fix

        Function testDrawNodesCustomPrinter has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        func testDrawNodesCustomPrinter(t *testing.T, h *human.Printer, id string, in Printable, out string) {
        Severity: Minor
        Found in prettyprinters/human/human_test.go - About 35 mins to fix

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

          func (p pipelineGen) prepareNode(ctx context.Context, idi interface{}) (interface{}, error) {
              var metadataErr error
          
              res, ok := idi.(resource.Resource)
              if !ok {
          Severity: Major
          Found in render/render.go - About 35 mins to fix

            Method Formatter.init has 5 return statements (exceeds 4 allowed).
            Open

            func (f *Formatter) init() {
                isColorTerminal := logrus.IsTerminal(os.Stderr) && (runtime.GOOS != "windows")
                f.fancy = (!f.DisableColors && isColorTerminal)
            
                f.replacer = strings.NewReplacer(
            Severity: Major
            Found in helpers/logging/formatter.go - About 35 mins to fix

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

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

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

                func newExportedField(input interface{}, index int) (*ExportedField, bool) {
                    if nil == input {
                        return nil, false
                    }
                
                
                Severity: Major
                Found in resource/field_extractor.go - About 35 mins to fix

                  Method Preparer.convertTime has 5 return statements (exceeds 4 allowed).
                  Open

                  func (p *Preparer) convertTime(typ reflect.Type, r Renderer, name string, val interface{}, base int) (reflect.Value, error) {
                      if val == nil {
                          return reflect.Zero(typ), nil
                      }
                  
                  
                  Severity: Major
                  Found in resource/preparer.go - About 35 mins to fix

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

                    func AssertDiff(t *testing.T, diffs map[string]resource.Diff, name, original, current string) bool {
                        var ok bool
                    
                        if ok = assert.NotEmpty(t, diffs); !ok {
                            return false
                    Severity: Major
                    Found in helpers/comparison/diff.go - About 35 mins to fix

                      Method Unarchive.readWrite has 5 return statements (exceeds 4 allowed).
                      Open

                      func (u *Unarchive) readWrite(file string) error {
                          fileName := strings.TrimPrefix(file, u.fetchDir.Name())
                      
                          fStat, err := os.Stat(file)
                          if err != nil {
                      Severity: Major
                      Found in resource/unarchive/unarchive.go - About 35 mins to fix

                        Method Container.compareLinks has 5 return statements (exceeds 4 allowed).
                        Open

                        func (c *Container) compareLinks(container *dc.Container) (actual, expected string) {
                            normalizeLink := func(link string) string {
                                // internally links are stored as "/linkedcontainername:/containername/alias"
                                parts := strings.Split(link, ":")
                                if len(parts) == 1 {
                        Severity: Major
                        Found in resource/docker/container/container.go - About 35 mins to fix

                          Method executor.HealthCheck has 5 return statements (exceeds 4 allowed).
                          Open

                          func (e *executor) HealthCheck(in *pb.LoadRequest, stream pb.Executor_HealthCheckServer) error {
                              logger, ctx := setIDLogger(stream.Context())
                              logger = logger.WithField("function", "executor.Plan")
                          
                              loaded, err := in.Load(ctx)
                          Severity: Major
                          Found in rpc/executor.go - About 35 mins to fix

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

                            func (g *pipelineGen) GetTask(ctx context.Context, idi interface{}) (interface{}, error) {
                                if thunk, ok := idi.(*render.PrepareThunk); ok {
                                    thunked, err := thunk.Thunk(g.RenderingPlant)
                                    if err != nil {
                                        return nil, err
                            Severity: Major
                            Found in plan/pipeline.go - About 35 mins to fix

                              Method Preparer.Prepare has 5 return statements (exceeds 4 allowed).
                              Open

                              func (p *Preparer) Prepare(ctx context.Context, r Renderer) (Task, error) {
                                  value := reflect.ValueOf(p.Destination)
                                  typ := value.Type()
                                  wasPtr := false // so we can re-wrap later if we need to
                              
                              
                              Severity: Major
                              Found in resource/preparer.go - About 35 mins to fix

                                Method Preparer.convertDuration has 5 return statements (exceeds 4 allowed).
                                Open

                                func (p *Preparer) convertDuration(typ reflect.Type, r Renderer, name string, val interface{}, base int) (reflect.Value, error) {
                                    if val == nil {
                                        return reflect.Zero(typ), nil
                                    }
                                
                                
                                Severity: Major
                                Found in resource/preparer.go - About 35 mins to fix

                                  Method Preparer.convertMap has 5 return statements (exceeds 4 allowed).
                                  Open

                                  func (p *Preparer) convertMap(typ reflect.Type, r Renderer, name string, val interface{}, base int) (reflect.Value, error) {
                                      if val == nil {
                                          return reflect.Zero(typ), nil
                                      }
                                  
                                  
                                  Severity: Major
                                  Found in resource/preparer.go - About 35 mins to fix

                                    Method Client.CreateContainer has 5 return statements (exceeds 4 allowed).
                                    Open

                                    func (c *Client) CreateContainer(opts dc.CreateContainerOptions) (*dc.Container, error) {
                                        name := opts.Name
                                    
                                        container, err := c.FindContainer(name)
                                        if err != nil {
                                    Severity: Major
                                    Found in resource/docker/docker.go - About 35 mins to fix

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

                                      func ResolveTask(w interface{}) (Task, bool) {
                                          if w == nil {
                                              return nil, false
                                          }
                                          if tasker, ok := w.(Tasker); ok {
                                      Severity: Major
                                      Found in resource/resource.go - About 35 mins to fix

                                        Method GrapherClient.Graph has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring.
                                        Open

                                        func (gc *GrapherClient) Graph(ctx context.Context, loc *pb.LoadRequest, opts ...grpc.CallOption) (*graph.Graph, error) {
                                            stream, err := gc.client.Graph(ctx, loc, opts...)
                                            if err != nil {
                                                return nil, errors.Wrap(err, "could not open stream")
                                            }
                                        Severity: Minor
                                        Found in rpc/grapherclient.go - About 35 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

                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language