docker/swarmkit

View on GitHub

Showing 1,008 of 1,820 total issues

Method Updater.Run has 7 return statements (exceeds 4 allowed).
Open

func (u *Updater) Run(ctx context.Context, slots []orchestrator.Slot) {
    defer close(u.doneChan)

    service := u.newService

Severity: Major
Found in manager/orchestrator/update/updater.go - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                        if integer < 128 {
                            count++
                        }
    Severity: Major
    Found in api/raft.pb.go - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                      if postIndex < 0 {
                          return ErrInvalidLengthRaft
                      }
      Severity: Major
      Found in api/raft.pb.go - About 45 mins to fix

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

        func DecryptPEMBlock(block *pem.Block, password []byte) ([]byte, error) {
            der := block.Bytes
        
            var privKey encryptedPrivateKeyInfo
            if _, err := asn1.Unmarshal(der, &privKey); err != nil {
        Severity: Major
        Found in ca/pkcs8/pkcs8.go - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                              if shift >= 64 {
                                  return ErrIntOverflowRaft
                              }
          Severity: Major
          Found in api/raft.pb.go - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                if b < 0x80 {
                                    break
                                }
            Severity: Major
            Found in api/raft.pb.go - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                              if packedLen < 0 {
                                  return ErrInvalidLengthRaft
                              }
              Severity: Major
              Found in api/raft.pb.go - About 45 mins to fix

                Method Supervisor.Restart has 7 return statements (exceeds 4 allowed).
                Open

                func (r *Supervisor) Restart(ctx context.Context, tx store.Tx, cluster *api.Cluster, service *api.Service, t api.Task) error {
                    // TODO(aluzzardi): This function should not depend on `service`.
                
                    // Is the old task still in the process of restarting? If so, wait for
                    // its restart delay to elapse, to avoid tight restart loops (for
                Severity: Major
                Found in manager/orchestrator/restart/restart.go - About 45 mins to fix

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

                  func AuthorizeForwardedRoleAndOrg(ctx context.Context, authorizedRoles, forwarderRoles []string, org string, blacklistedCerts map[string]*api.BlacklistedCertificate) (string, error) {
                      if isForwardedRequest(ctx) {
                          _, err := AuthorizeOrgAndRole(ctx, org, blacklistedCerts, forwarderRoles...)
                          if err != nil {
                              return "", status.Errorf(codes.PermissionDenied, "Permission denied: unauthorized forwarder role: %v", err)
                  Severity: Major
                  Found in ca/auth.go - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                            if assignments.addOrUpdateTask(readTx, v.Task) {
                                                oneModification()
                                            }
                    Severity: Major
                    Found in manager/dispatcher/dispatcher.go - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                              if assignments.removeTask(readTx, v.Task) {
                                                  oneModification()
                                              }
                      Severity: Major
                      Found in manager/dispatcher/dispatcher.go - About 45 mins to fix

                        Method Scheduler.scheduleNTasksOnSubtree has 6 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                        func (s *Scheduler) scheduleNTasksOnSubtree(ctx context.Context, n int, taskGroup map[string]*api.Task, tree *decisionTree, schedulingDecisions map[string]schedulingDecision, nodeLess func(a *NodeInfo, b *NodeInfo) bool) int {
                        Severity: Minor
                        Found in manager/scheduler/scheduler.go - About 45 mins to fix

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

                          func newRootRotationObject(ctx context.Context, securityConfig *ca.SecurityConfig, apiRootCA *api.RootCA, newCARootCA ca.RootCA, extCAs []*api.ExternalCA, version uint64) (*api.RootCA, error) {
                          Severity: Minor
                          Found in manager/controlapi/ca_rotation.go - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                            if !request.IncludeOldObject {
                                                eventMessage.OldObject = nil
                                            }
                            Severity: Major
                            Found in manager/watchapi/watch.go - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                                  if oldTask, exists := tasksMap[v.Task.ID]; exists {
                                                      // States ASSIGNED and below are set by the orchestrator/scheduler,
                                                      // not the agent, so tasks in these states need to be sent to the
                                                      // agent even if nothing else has changed.
                                                      if equality.TasksEqualStable(oldTask, v.Task) && v.Task.Status.State > api.TaskStateAssigned {
                              Severity: Major
                              Found in manager/dispatcher/dispatcher.go - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                                    if time.Since(debouncingStarted) > maxLatency {
                                                        commitDebounceTimer.Stop()
                                                        commitDebounceTimer = nil
                                                        commitDebounceTimeout = nil
                                                        schedule()
                                Severity: Major
                                Found in manager/scheduler/scheduler.go - About 45 mins to fix

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

                                  func validateConfigRefsSpec(spec api.TaskSpec) error {
                                      container := spec.GetContainer()
                                      if container == nil {
                                          return nil
                                      }
                                  Severity: Major
                                  Found in manager/controlapi/service.go - About 45 mins to fix

                                    Method Scheduler.scheduleNTasksOnNodes has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                    Open

                                    func (s *Scheduler) scheduleNTasksOnNodes(ctx context.Context, n int, taskGroup map[string]*api.Task, nodes []NodeInfo, schedulingDecisions map[string]schedulingDecision, nodeLess func(a *NodeInfo, b *NodeInfo) bool) int {
                                    Severity: Minor
                                    Found in manager/scheduler/scheduler.go - About 45 mins to fix

                                      Method Server.CreateService has 7 return statements (exceeds 4 allowed).
                                      Open

                                      func (s *Server) CreateService(ctx context.Context, request *api.CreateServiceRequest) (*api.CreateServiceResponse, error) {
                                          if err := validateServiceSpec(request.Spec); err != nil {
                                              return nil, err
                                          }
                                      
                                      
                                      Severity: Major
                                      Found in manager/controlapi/service.go - About 45 mins to fix

                                        Method Server.Watch has 7 return statements (exceeds 4 allowed).
                                        Open

                                        func (s *Server) Watch(request *api.WatchRequest, stream api.Watch_WatchServer) error {
                                            ctx := stream.Context()
                                        
                                            s.mu.Lock()
                                            pctx := s.pctx
                                        Severity: Major
                                        Found in manager/watchapi/watch.go - About 45 mins to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language