docker/swarmkit

View on GitHub

Showing 1,820 of 1,820 total issues

Method raftProxyDispatcherServer.Assignments has 8 return statements (exceeds 4 allowed).
Open

func (p *raftProxyDispatcherServer) Assignments(r *AssignmentsRequest, stream Dispatcher_AssignmentsServer) error {
    ctx := stream.Context()
    conn, err := p.connSelector.LeaderConn(ctx)
    if err != nil {
        if err == raftselector.ErrIsLeader {
Severity: Major
Found in api/dispatcher.pb.go - About 50 mins to fix

    Method raftProxyLogsServer.SubscribeLogs has 8 return statements (exceeds 4 allowed).
    Open

    func (p *raftProxyLogsServer) SubscribeLogs(r *SubscribeLogsRequest, stream Logs_SubscribeLogsServer) error {
        ctx := stream.Context()
        conn, err := p.connSelector.LeaderConn(ctx)
        if err != nil {
            if err == raftselector.ErrIsLeader {
    Severity: Major
    Found in api/logbroker.pb.go - About 50 mins to fix

      Method ServiceSpec.MarshalToSizedBuffer has 8 return statements (exceeds 4 allowed).
      Open

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

        Method raftProxyWatchServer.Watch has 8 return statements (exceeds 4 allowed).
        Open

        func (p *raftProxyWatchServer) Watch(r *WatchRequest, stream Watch_WatchServer) error {
            ctx := stream.Context()
            conn, err := p.connSelector.LeaderConn(ctx)
            if err != nil {
                if err == raftselector.ErrIsLeader {
        Severity: Major
        Found in api/watch.pb.go - About 50 mins to fix

          Method TaskSpec.MarshalToSizedBuffer has 8 return statements (exceeds 4 allowed).
          Open

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

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

            func CheckTasks(ctx context.Context, s *store.MemoryStore, readTx store.ReadTx, initHandler InitHandler, startSupervisor restart.SupervisorInterface) error {
                instances := make(map[orchestrator.SlotTuple][]*api.Task)
                err := s.Batch(func(batch *store.Batch) error {
                    tasks, err := store.FindTasks(readTx, store.All)
                    if err != nil {
            Severity: Major
            Found in manager/orchestrator/taskinit/init.go - About 50 mins to fix

              Method Server.UpdateCluster has 8 return statements (exceeds 4 allowed).
              Open

              func (s *Server) UpdateCluster(ctx context.Context, request *api.UpdateClusterRequest) (*api.UpdateClusterResponse, error) {
                  if request.ClusterID == "" || request.ClusterVersion == nil {
                      return nil, status.Errorf(codes.InvalidArgument, errInvalidArgument.Error())
                  }
                  if err := validateClusterSpec(request.Spec); err != nil {
              Severity: Major
              Found in manager/controlapi/cluster.go - About 50 mins to fix

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

                func validateClusterSpec(spec *api.ClusterSpec) error {
                    if spec == nil {
                        return status.Errorf(codes.InvalidArgument, errInvalidArgument.Error())
                    }
                
                
                Severity: Major
                Found in manager/controlapi/cluster.go - About 50 mins to fix

                  Method Manager.handleVolume has 8 return statements (exceeds 4 allowed).
                  Open

                  func (vm *Manager) handleVolume(ctx context.Context, id string) error {
                      var volume *api.Volume
                      vm.store.View(func(tx store.ReadTx) {
                          volume = store.GetVolume(tx, id)
                      })
                  Severity: Major
                  Found in manager/csi/manager.go - About 50 mins to fix

                    Method Server.ListServices has 8 return statements (exceeds 4 allowed).
                    Open

                    func (s *Server) ListServices(ctx context.Context, request *api.ListServicesRequest) (*api.ListServicesResponse, error) {
                        var (
                            services []*api.Service
                            err      error
                        )
                    Severity: Major
                    Found in manager/controlapi/service.go - About 50 mins to fix

                      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

                                    Similar blocks of code found in 10 locations. Consider refactoring.
                                    Open

                                    func (p *raftProxyHealthServer) runCtxMods(ctx context.Context, ctxMods []func(context.Context) (context.Context, error)) (context.Context, error) {
                                        var err error
                                        for _, mod := range ctxMods {
                                            ctx, err = mod(ctx)
                                            if err != nil {
                                    Severity: Major
                                    Found in api/health.pb.go and 9 other locations - About 50 mins to fix
                                    api/ca.pb.go on lines 1126..1135
                                    api/ca.pb.go on lines 1268..1277
                                    api/dispatcher.pb.go on lines 2481..2490
                                    api/logbroker.pb.go on lines 1754..1763
                                    api/logbroker.pb.go on lines 1877..1886
                                    api/raft.pb.go on lines 2124..2133
                                    api/raft.pb.go on lines 2323..2332
                                    api/resource.pb.go on lines 602..611
                                    api/watch.pb.go on lines 2187..2196

                                    Duplicated Code

                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                    Tuning

                                    This issue has a mass of 120.

                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                    Refactorings

                                    Further Reading

                                    Similar blocks of code found in 10 locations. Consider refactoring.
                                    Open

                                    func (p *raftProxyCAServer) runCtxMods(ctx context.Context, ctxMods []func(context.Context) (context.Context, error)) (context.Context, error) {
                                        var err error
                                        for _, mod := range ctxMods {
                                            ctx, err = mod(ctx)
                                            if err != nil {
                                    Severity: Major
                                    Found in api/ca.pb.go and 9 other locations - About 50 mins to fix
                                    api/ca.pb.go on lines 1268..1277
                                    api/dispatcher.pb.go on lines 2481..2490
                                    api/health.pb.go on lines 410..419
                                    api/logbroker.pb.go on lines 1754..1763
                                    api/logbroker.pb.go on lines 1877..1886
                                    api/raft.pb.go on lines 2124..2133
                                    api/raft.pb.go on lines 2323..2332
                                    api/resource.pb.go on lines 602..611
                                    api/watch.pb.go on lines 2187..2196

                                    Duplicated Code

                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                    Tuning

                                    This issue has a mass of 120.

                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                    Refactorings

                                    Further Reading

                                    Similar blocks of code found in 10 locations. Consider refactoring.
                                    Open

                                    func (p *raftProxyNodeCAServer) runCtxMods(ctx context.Context, ctxMods []func(context.Context) (context.Context, error)) (context.Context, error) {
                                        var err error
                                        for _, mod := range ctxMods {
                                            ctx, err = mod(ctx)
                                            if err != nil {
                                    Severity: Major
                                    Found in api/ca.pb.go and 9 other locations - About 50 mins to fix
                                    api/ca.pb.go on lines 1126..1135
                                    api/dispatcher.pb.go on lines 2481..2490
                                    api/health.pb.go on lines 410..419
                                    api/logbroker.pb.go on lines 1754..1763
                                    api/logbroker.pb.go on lines 1877..1886
                                    api/raft.pb.go on lines 2124..2133
                                    api/raft.pb.go on lines 2323..2332
                                    api/resource.pb.go on lines 602..611
                                    api/watch.pb.go on lines 2187..2196

                                    Duplicated Code

                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                    Tuning

                                    This issue has a mass of 120.

                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                    Refactorings

                                    Further Reading

                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language