docker/swarmkit

View on GitHub

Showing 1,008 of 1,820 total issues

Method Dispatcher.markNodesUnknown has 8 return statements (exceeds 4 allowed).
Open

func (d *Dispatcher) markNodesUnknown(ctx context.Context) error {
    log := log.G(ctx).WithField("method", "(*Dispatcher).markNodesUnknown")
    var nodes []*api.Node
    var err error
    d.store.View(func(tx store.ReadTx) {
Severity: Major
Found in manager/dispatcher/dispatcher.go - About 50 mins to fix

    Method LogBroker.ListenSubscriptions has 8 return statements (exceeds 4 allowed).
    Open

    func (lb *LogBroker) ListenSubscriptions(request *api.ListenSubscriptionsRequest, stream api.LogBroker_ListenSubscriptionsServer) error {
        remote, err := ca.RemoteNode(stream.Context())
        if err != nil {
            return err
        }
    Severity: Major
    Found in manager/logbroker/broker.go - About 50 mins to fix

      Method Node.loadAndStart has 8 return statements (exceeds 4 allowed).
      Open

      func (n *Node) loadAndStart(ctx context.Context, forceNewCluster bool) error {
          snapshot, waldata, err := n.readFromDisk(ctx)
          if err != nil {
              return err
          }
      Severity: Major
      Found in manager/state/raft/storage.go - About 50 mins to fix

        Method LogBroker.PublishLogs has 8 return statements (exceeds 4 allowed).
        Open

        func (lb *LogBroker) PublishLogs(stream api.LogBroker_PublishLogsServer) (err error) {
            remote, err := ca.RemoteNode(stream.Context())
            if err != nil {
                return err
            }
        Severity: Major
        Found in manager/logbroker/broker.go - About 50 mins to fix

          Method portAllocator.isPortsAllocatedOnInit has 8 return statements (exceeds 4 allowed).
          Open

          func (pa *portAllocator) isPortsAllocatedOnInit(s *api.Service, onInit bool) bool {
              // If service has no user-defined endpoint and allocated endpoint,
              // we assume it is allocated and return true.
              if s.Endpoint == nil && s.Spec.Endpoint == nil {
                  return true
          Severity: Major
          Found in manager/allocator/portallocator.go - About 50 mins to fix

            Method Allocator.allocateTask has 8 return statements (exceeds 4 allowed).
            Open

            func (a *Allocator) allocateTask(ctx context.Context, t *api.Task) (err error) {
                taskUpdated := false
                nc := a.netCtx
            
                logger := log.G(ctx).WithField("method", "(*Allocator).allocateTask")
            Severity: Major
            Found in manager/allocator/network.go - About 50 mins to fix

              Method Node.JoinAndStart has 8 return statements (exceeds 4 allowed).
              Open

              func (n *Node) JoinAndStart(ctx context.Context) (err error) {
                  ctx, cancel := n.WithContext(ctx)
                  defer func() {
                      cancel()
                      if err != nil {
              Severity: Major
              Found in manager/state/raft/raft.go - About 50 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                            if err != nil {
                                                return err
                                            }
                Severity: Major
                Found in swarmd/cmd/swarmctl/service/flagparser/tmpfs.go - About 45 mins to fix

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

                  func decryptRaftData(swarmdir, outdir, unlockKey string) error {
                      krw, err := getKRW(swarmdir, unlockKey)
                      if err != nil {
                          return err
                      }
                  Severity: Major
                  Found in swarmd/cmd/swarm-rafttool/common.go - About 45 mins to fix

                    Method StubAPIClient.ContainerCreate has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    func (sa *StubAPIClient) ContainerCreate(ctx context.Context, config *container.Config, hostConfig *container.HostConfig, networking *network.NetworkingConfig, platform *v1.Platform, containerName string) (container.CreateResponse, error) {
                    Severity: Minor
                    Found in swarmd/dockerexec/docker_client_stub.go - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                                  switch suffix {
                                                  case 'g':
                                                      multiplier = 1 << 30
                                                  case 'm':
                                                      multiplier = 1 << 20
                      Severity: Major
                      Found in swarmd/cmd/swarmctl/service/flagparser/tmpfs.go - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                                    if container := actype.Task.Spec.GetContainer(); container != nil {
                                                        container.Env = []string{"ENVVARS REDACTED"}
                                                        if container.PullOptions != nil {
                                                            container.PullOptions.RegistryAuth = "REDACTED"
                                                        }
                        Severity: Major
                        Found in swarmd/cmd/swarm-rafttool/dump.go - About 45 mins to fix

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

                          func parseTmpfs(flags *pflag.FlagSet, spec *api.ServiceSpec) error {
                              if flags.Changed("tmpfs") {
                                  tmpfss, err := flags.GetStringSlice("tmpfs")
                                  if err != nil {
                                      return err
                          Severity: Major
                          Found in swarmd/cmd/swarmctl/service/flagparser/tmpfs.go - About 45 mins to fix

                            Method nodePlugin.NodeUnstageVolume has 7 return statements (exceeds 4 allowed).
                            Open

                            func (np *nodePlugin) NodeUnstageVolume(ctx context.Context, req *api.VolumeAssignment) error {
                                np.mu.Lock()
                                defer np.mu.Unlock()
                                if !np.staging {
                                    return nil
                            Severity: Major
                            Found in agent/csi/plugin/plugin.go - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                                          if container := actype.Service.Spec.Task.GetContainer(); container != nil {
                                                              container.Env = []string{"ENVVARS REDACTED"}
                                                              if container.PullOptions != nil {
                                                                  container.PullOptions.RegistryAuth = "REDACTED"
                                                              }
                              Severity: Major
                              Found in swarmd/cmd/swarm-rafttool/dump.go - About 45 mins to fix

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

                                func parseRestart(flags *pflag.FlagSet, spec *api.ServiceSpec) error {
                                    if spec.Task.Restart == nil {
                                        // set new service's restart policy as RestartOnAny
                                        spec.Task.Restart = &api.RestartPolicy{
                                            Condition: api.RestartOnAny,
                                Severity: Major
                                Found in swarmd/cmd/swarmctl/service/flagparser/restart.go - About 45 mins to fix

                                  Method controller.Remove has 7 return statements (exceeds 4 allowed).
                                  Open

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

                                    Method Cluster.MarshalToSizedBuffer has 7 return statements (exceeds 4 allowed).
                                    Open

                                    func (m *Cluster) MarshalToSizedBuffer(dAtA []byte) (int, error) {
                                        i := len(dAtA)
                                        _ = i
                                        var l int
                                        _ = l
                                    Severity: Major
                                    Found in api/objects.pb.go - About 45 mins to fix

                                      Avoid deeply nested control flow statements.
                                      Open

                                                          if intStringLenmapkey < 0 {
                                                              return ErrInvalidLengthObjects
                                                          }
                                      Severity: Major
                                      Found in api/objects.pb.go - About 45 mins to fix

                                        Avoid deeply nested control flow statements.
                                        Open

                                                            if shift >= 64 {
                                                                return ErrIntOverflowObjects
                                                            }
                                        Severity: Major
                                        Found in api/objects.pb.go - About 45 mins to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language