asteris-llc/converge

View on GitHub

Showing 247 of 615 total issues

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

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

    func newMockOS(ownedFiles []ownershipRecord,
        users []*user.User,
        groups []*user.Group,
        defaultUser *user.User,
        defaultGroup *user.Group,
    Severity: Minor
    Found in resource/file/owner/helper_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 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

          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 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 User.DiffAdd has 5 return statements (exceeds 4 allowed).
              Open

              func (u *User) DiffAdd(status *resource.Status) (*AddUserOptions, error) {
                  options := new(AddUserOptions)
              
                  // if a group exists with the same name as the user being added, a groupname
                  // must also be indicated so the user may be added to that group
              Severity: Major
              Found in resource/user/user.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 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

                    Function newSliceTypePropertiesFromMap has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring.
                    Open

                    func newSliceTypePropertiesFromMap(m map[string]interface{}) *SliceTypeProperties {
                        s := &SliceTypeProperties{}
                    
                        if val, ok := m["BlockIOAccounting"]; ok {
                            s.BlockIOAccounting = val.(bool)
                    Severity: Minor
                    Found in resource/systemd/unit/systemd_properties.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

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

                    func (p *Preparer) Prepare(ctx context.Context, render resource.Renderer) (resource.Task, error) {
                        if p.UID != nil && *p.UID == math.MaxUint32 {
                            // the maximum uid on linux is MaxUint32 - 1
                            return nil, fmt.Errorf("user \"uid\" parameter out of range")
                        }
                    Severity: Major
                    Found in resource/user/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

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

                        func (u *Unarchive) copyFile(from, to string) error {
                            src, err := os.Open(from)
                            if err != nil {
                                return err
                            }
                        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 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

                              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 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 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 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 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
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language