asteris-llc/converge

View on GitHub

Showing 247 of 615 total issues

Method Preparer.getValueForField has 8 return statements (exceeds 4 allowed).
Open

func (p *Preparer) getValueForField(r Renderer, field reflect.StructField) (reflect.Value, error) {
    // get the field name for use in future lookups
    name := p.getFieldName(field)
    raw, isSet := p.Source[name]

Severity: Major
Found in resource/preparer.go - About 50 mins to fix

    Method Unarchive.setDirsAndContents has 8 return statements (exceeds 4 allowed).
    Open

    func (u *Unarchive) setDirsAndContents() (bool, error) {
        var err error
    
        // set the unarchive destination directory
        u.destDir, err = os.Open(u.Destination)
    Severity: Major
    Found in resource/unarchive/unarchive.go - About 50 mins to fix

      Function checkSyntax has 8 return statements (exceeds 4 allowed).
      Open

      func checkSyntax(interpreter string, flags []string, script string) error {
          if interpreter == "" {
              interpreter = defaultInterpreter
              if len(flags) > 0 {
                  return errors.New("custom syntax check_flags given without an interpreter")
      Severity: Major
      Found in resource/shell/preparer.go - About 50 mins to fix

        Method Resource.shouldStop has 8 return statements (exceeds 4 allowed).
        Open

        func (r *Resource) shouldStop(u *Unit, st *resource.Status) bool {
            switch u.ActiveState {
            case "active":
                st.AddDifference("state", "active", "inactive", "")
                st.RaiseLevel(resource.StatusWillChange)
        Severity: Major
        Found in resource/systemd/unit/resource.go - About 50 mins to fix

          Function PeerBranches has 8 return statements (exceeds 4 allowed).
          Open

          func PeerBranches(g *graph.Graph, meta *node.Node) (out []*node.Node) {
              if !IsConditional(meta) {
                  return
              }
              kind, ok := meta.LookupMetadata(MetaType)
          Severity: Major
          Found in graph/node/conditional/conditional.go - About 50 mins to fix

            Method TypeExtractor.Visit has 8 return statements (exceeds 4 allowed).
            Open

            func (te *TypeExtractor) Visit(node ast.Node) (w ast.Visitor) {
                if node == nil {
                    return nil
                }
            
            
            Severity: Major
            Found in docs/extract.go - About 50 mins to fix

              Method Resource.shouldStart has 8 return statements (exceeds 4 allowed).
              Open

              func (r *Resource) shouldStart(u *Unit, st *resource.Status) bool {
                  switch u.ActiveState {
                  case "active":
                      st.AddMessage("already running")
                      return false
              Severity: Major
              Found in resource/systemd/unit/resource.go - About 50 mins to fix

                Function Nodes has 8 return statements (exceeds 4 allowed).
                Open

                func Nodes(ctx context.Context, root string, verify bool) (*graph.Graph, error) {
                    logger := logging.GetLogger(ctx).WithField("function", "Nodes")
                
                    toLoad := []*source{{"root", root, root}}
                
                
                Severity: Major
                Found in load/nodes.go - About 50 mins to fix

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

                  func getParamOverrides(gFunc func() *graph.Graph, id string) (ValueThunk, bool) {
                      name := graph.BaseID(id)
                      f := func() (resource.Value, bool, error) { return resource.Value(""), false, nil }
                      if strings.HasPrefix(name, "param") {
                          f = func() (resource.Value, bool, error) {
                  Severity: Major
                  Found in render/factory.go - About 45 mins to fix

                    Method pipelineGen.MaybeResolveConditional has 7 return statements (exceeds 4 allowed).
                    Open

                    func (g *pipelineGen) MaybeResolveConditional(_ context.Context, idi interface{}) (interface{}, error) {
                        meta, ok := g.Graph.Get(g.ID)
                        if !ok {
                            return nil, errors.New("unexpectedly unable to find " + g.ID + " in graph")
                        }
                    Severity: Major
                    Found in plan/pipeline.go - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                          if err != nil {
                                              status.RaiseLevel(resource.StatusFatal)
                                              status.Output = append(status.Output, fmt.Sprintf("error adding group %s", g.Name))
                                              return status, errors.Wrap(err, "group add")
                                          }
                      Severity: Major
                      Found in resource/group/group.go - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                            if err != nil {
                                                status.RaiseLevel(resource.StatusFatal)
                                                status.Output = append(status.Output, fmt.Sprintf("error modifying group %s with new name %s and new gid %s", g.Name, g.NewName, g.GID))
                                                return status, errors.Wrap(err, "group modify")
                                            }
                        Severity: Major
                        Found in resource/group/group.go - About 45 mins to fix

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

                          func TestRetryUntil(t *testing.T) {
                              t.Parallel()
                              defer logging.HideLogs(t)()
                          
                              t.Run("sets retry count", func(t *testing.T) {
                          Severity: Major
                          Found in resource/wait/retrier_test.go - About 45 mins to fix

                            Method Unarchive.evaluateDuplicates has 7 return statements (exceeds 4 allowed).
                            Open

                            func (u *Unarchive) evaluateDuplicates() error {
                                // determine which directory has fewer items in order to minimize operations
                                dirA := u.destDir.Name()
                                dirB := u.fetchDir.Name()
                                filesA := u.destContents
                            Severity: Major
                            Found in resource/unarchive/unarchive.go - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                                  if err != nil {
                                                      status.RaiseLevel(resource.StatusFatal)
                                                      status.Output = append(status.Output, fmt.Sprintf("error modifying group %s", g.Name))
                                                      return status, errors.Wrap(err, "group modify")
                                                  }
                              Severity: Major
                              Found in resource/group/group.go - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                                    if err != nil {
                                                        status.RaiseLevel(resource.StatusFatal)
                                                        status.Output = append(status.Output, fmt.Sprintf("error adding group %s with gid %s", g.Name, g.GID))
                                                        return status, errors.Wrap(err, "group add")
                                                    }
                                Severity: Major
                                Found in resource/group/group.go - About 45 mins to fix

                                  Method User.DiffMod has 7 return statements (exceeds 4 allowed).
                                  Open

                                  func (u *User) DiffMod(status *resource.Status, currUser *user.User) (*ModUserOptions, error) {
                                      options := new(ModUserOptions)
                                  
                                      // Check for differences between currUser and the desired modifications
                                      if u.NewUsername != "" {
                                  Severity: Major
                                  Found in resource/user/user.go - About 45 mins to fix

                                    Avoid deeply nested control flow statements.
                                    Open

                                                        if err != nil {
                                                            status.RaiseLevel(resource.StatusFatal)
                                                            status.Output = append(status.Output, fmt.Sprintf("error modifying group %s with new gid %s", g.Name, g.GID))
                                                            return status, errors.Wrap(err, "group modify")
                                                        }
                                    Severity: Major
                                    Found in resource/group/group.go - About 45 mins to fix

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

                                      func simpleCheckSuccess(t *testing.T, lvm lowlevel.LVM, group string, devs []string, remove bool, forceRemove bool) (resource.TaskStatus, resource.Task) {
                                      Severity: Minor
                                      Found in resource/lvm/vg/vg_test.go - About 45 mins to fix

                                        Function simpleCheckFailure has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                        Open

                                        func simpleCheckFailure(t *testing.T, lvm lowlevel.LVM, group string, devs []string, remove bool, forceRemove bool) resource.TaskStatus {
                                        Severity: Minor
                                        Found in resource/lvm/vg/vg_test.go - About 45 mins to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language