docker/swarmkit

View on GitHub

Showing 1,008 of 1,820 total issues

Function changeNodeAvailability has 6 return statements (exceeds 4 allowed).
Open

func changeNodeAvailability(cmd *cobra.Command, args []string, availability api.NodeSpec_Availability) error {
    if len(args) == 0 {
        return errors.New("missing node ID")
    }

Severity: Major
Found in swarmd/cmd/swarmctl/node/common.go - About 40 mins to fix

    Function dumpSnapshot has 6 return statements (exceeds 4 allowed).
    Open

    func dumpSnapshot(swarmdir, unlockKey string, redact bool) error {
        _, snapshot, err := loadData(swarmdir, unlockKey)
        if err != nil {
            return err
        }
    Severity: Major
    Found in swarmd/cmd/swarm-rafttool/dump.go - About 40 mins to fix

      Function ParseAddSecret has 6 return statements (exceeds 4 allowed).
      Open

      func ParseAddSecret(cmd *cobra.Command, spec *api.ServiceSpec, flagName string) error {
          flags := cmd.Flags()
      
          if flags.Changed(flagName) {
              secrets, err := flags.GetStringSlice(flagName)
      Severity: Major
      Found in swarmd/cmd/swarmctl/service/flagparser/secret.go - About 40 mins to fix

        Method Agent.run has 6 return statements (exceeds 4 allowed).
        Open

        func (a *Agent) run(ctx context.Context) {
            ctx, cancel := context.WithCancel(ctx)
            defer cancel()
            defer close(a.closed) // full shutdown.
        
        
        Severity: Major
        Found in agent/agent.go - About 40 mins to fix

          Method controller.waitReady has 6 return statements (exceeds 4 allowed).
          Open

          func (r *controller) waitReady(pctx context.Context) error {
              if err := r.checkClosed(); err != nil {
                  return err
              }
          
          
          Severity: Major
          Found in swarmd/dockerexec/controller.go - About 40 mins to fix

            Function expandMounts has 6 return statements (exceeds 4 allowed).
            Open

            func expandMounts(ctx Context, mounts []api.Mount) ([]api.Mount, error) {
                if len(mounts) == 0 {
                    return mounts, nil
                }
            
            
            Severity: Major
            Found in template/expand.go - About 40 mins to fix

              Function changeNodeRole has 6 return statements (exceeds 4 allowed).
              Open

              func changeNodeRole(cmd *cobra.Command, args []string, role api.NodeRole) error {
                  if len(args) == 0 {
                      return errors.New("missing node ID")
                  }
              
              
              Severity: Major
              Found in swarmd/cmd/swarmctl/node/common.go - About 40 mins to fix

                Function ParseAddConfig has 6 return statements (exceeds 4 allowed).
                Open

                func ParseAddConfig(cmd *cobra.Command, spec *api.ServiceSpec, flagName string) error {
                    flags := cmd.Flags()
                
                    if flags.Changed(flagName) {
                        configs, err := flags.GetStringSlice(flagName)
                Severity: Major
                Found in swarmd/cmd/swarmctl/service/flagparser/config.go - About 40 mins to fix

                  Method nodePlugin.init has 6 return statements (exceeds 4 allowed).
                  Open

                  func (np *nodePlugin) init(ctx context.Context) error {
                      probe, err := np.idClient.Probe(ctx, &csi.ProbeRequest{})
                      if err != nil {
                          return err
                      }
                  Severity: Major
                  Found in agent/csi/plugin/plugin.go - About 40 mins to fix

                    Function parsePortConfig has 6 return statements (exceeds 4 allowed).
                    Open

                    func parsePortConfig(portConfig string) (string, api.PortConfig_Protocol, uint32, uint32, error) {
                        protocol := api.ProtocolTCP
                        parts := strings.Split(portConfig, ":")
                        if len(parts) < 2 {
                            return "", protocol, 0, 0, errors.New("insufficient parameters in port configuration")
                    Severity: Major
                    Found in swarmd/cmd/swarmctl/service/flagparser/port.go - About 40 mins to fix

                      Function remove has 6 return statements (exceeds 4 allowed).
                      Open

                      func remove(na, r *api.GenericResource) bool {
                          switch tr := r.Resource.(type) {
                          case *api.GenericResource_DiscreteResourceSpec:
                              if na.GetDiscreteResourceSpec() == nil {
                                  return false // Type change, ignore
                      Severity: Major
                      Found in api/genericresource/helpers.go - About 40 mins to fix

                        Function HasEnough has 6 return statements (exceeds 4 allowed).
                        Open

                        func HasEnough(nodeRes []*api.GenericResource, taskRes *api.GenericResource) (bool, error) {
                            t := taskRes.GetDiscreteResourceSpec()
                            if t == nil {
                                return false, fmt.Errorf("task should only hold Discrete type")
                            }
                        Severity: Major
                        Found in api/genericresource/validate.go - About 40 mins to fix

                          Function HasResource has 6 return statements (exceeds 4 allowed).
                          Open

                          func HasResource(res *api.GenericResource, resources []*api.GenericResource) bool {
                              for _, r := range resources {
                                  if Kind(res) != Kind(r) {
                                      continue
                                  }
                          Severity: Major
                          Found in api/genericresource/validate.go - About 40 mins to fix

                            Function RemoteNode has 6 return statements (exceeds 4 allowed).
                            Open

                            func RemoteNode(ctx context.Context) (RemoteNodeInfo, error) {
                                // If we have a value on the context that marks this as a local
                                // request, we return the node info from the context.
                                localNodeInfo := ctx.Value(LocalRequestKey)
                            
                            
                            Severity: Major
                            Found in ca/auth.go - About 40 mins to fix

                              Method Reconciler.ReconcileService has 6 return statements (exceeds 4 allowed).
                              Open

                              func (r *Reconciler) ReconcileService(id string) error {
                                  var (
                                      service *api.Service
                                      cluster *api.Cluster
                                      tasks   []*api.Task
                              Severity: Major
                              Found in manager/orchestrator/jobs/global/reconciler.go - About 40 mins to fix

                                Method Orchestrator.Run has 6 return statements (exceeds 4 allowed).
                                Open

                                func (g *Orchestrator) Run(ctx context.Context) error {
                                    defer close(g.doneChan)
                                
                                    // Watch changes to services and tasks
                                    queue := g.store.WatchQueue()
                                Severity: Major
                                Found in manager/orchestrator/global/global.go - About 40 mins to fix

                                  Method Server.Run has 6 return statements (exceeds 4 allowed).
                                  Open

                                  func (s *Server) Run(ctx context.Context) error {
                                      s.mu.Lock()
                                      if s.isRunning() {
                                          s.mu.Unlock()
                                          return errors.New("CA signer is already running")
                                  Severity: Major
                                  Found in ca/server.go - About 40 mins to fix

                                    Function parseExternalCA has 6 return statements (exceeds 4 allowed).
                                    Open

                                    func parseExternalCA(caSpec string) (*api.ExternalCA, error) {
                                        csvReader := csv.NewReader(strings.NewReader(caSpec))
                                        fields, err := csvReader.Read()
                                        if err != nil {
                                            return nil, err
                                    Severity: Major
                                    Found in cli/external_ca.go - About 40 mins to fix

                                      Method Orchestrator.reconcileOneNode has 6 return statements (exceeds 4 allowed).
                                      Open

                                      func (g *Orchestrator) reconcileOneNode(ctx context.Context, node *api.Node) {
                                          if node.Spec.Availability == api.NodeAvailabilityDrain {
                                              log.G(ctx).Debugf("global orchestrator: node %s in drain state, shutting down its tasks", node.ID)
                                              g.foreachTaskFromNode(ctx, node, g.shutdownTask)
                                              return
                                      Severity: Major
                                      Found in manager/orchestrator/global/global.go - About 40 mins to fix

                                        Function ParseJoinToken has 6 return statements (exceeds 4 allowed).
                                        Open

                                        func ParseJoinToken(token string) (*ParsedJoinToken, error) {
                                            split := strings.Split(token, "-")
                                            numParts := len(split)
                                        
                                            // v1 has 4, v2 has 5
                                        Severity: Major
                                        Found in ca/config.go - About 40 mins to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language