docker/swarmkit

View on GitHub

Showing 1,008 of 1,820 total issues

Method PublishLogsMessage.Unmarshal has 25 return statements (exceeds 4 allowed).
Open

func (m *PublishLogsMessage) Unmarshal(dAtA []byte) error {
    l := len(dAtA)
    iNdEx := 0
    for iNdEx < l {
        preIndex := iNdEx
Severity: Major
Found in api/logbroker.pb.go - About 2 hrs to fix

    Method NodeSpec.Unmarshal has 25 return statements (exceeds 4 allowed).
    Open

    func (m *NodeSpec) Unmarshal(dAtA []byte) error {
        l := len(dAtA)
        iNdEx := 0
        for iNdEx < l {
            preIndex := iNdEx
    Severity: Major
    Found in api/specs.pb.go - About 2 hrs to fix

      Method WatchRequest_WatchEntry.Unmarshal has 25 return statements (exceeds 4 allowed).
      Open

      func (m *WatchRequest_WatchEntry) Unmarshal(dAtA []byte) error {
          l := len(dAtA)
          iNdEx := 0
          for iNdEx < l {
              preIndex := iNdEx
      Severity: Major
      Found in api/watch.pb.go - About 2 hrs to fix

        Method Updater.updateTask has a Cognitive Complexity of 32 (exceeds 20 allowed). Consider refactoring.
        Open

        func (u *Updater) updateTask(ctx context.Context, slot orchestrator.Slot, updated *api.Task, order api.UpdateConfig_UpdateOrder) error {
            // Kick off the watch before even creating the updated task. This is in order to avoid missing any event.
            taskUpdates, cancel := state.Watch(u.watchQueue, api.EventUpdateTask{
                Task:   &api.Task{ID: updated.ID},
                Checks: []api.TaskCheckFunc{api.TaskCheckID},
        Severity: Minor
        Found in manager/orchestrator/update/updater.go - About 2 hrs to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Method Allocator.allocateTasks has a Cognitive Complexity of 32 (exceeds 20 allowed). Consider refactoring.
        Open

        func (a *Allocator) allocateTasks(ctx context.Context, existingAddressesOnly bool) error {
            var (
                nc             = a.netCtx
                tasks          []*api.Task
                allocatedTasks []*api.Task
        Severity: Minor
        Found in manager/allocator/network.go - About 2 hrs to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Method GetRootCACertificateResponse.Unmarshal has 81 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func (m *GetRootCACertificateResponse) Unmarshal(dAtA []byte) error {
            l := len(dAtA)
            iNdEx := 0
            for iNdEx < l {
                preIndex := iNdEx
        Severity: Major
        Found in api/ca.pb.go - About 2 hrs to fix

          Method SubscribeLogsMessage.Unmarshal has 81 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func (m *SubscribeLogsMessage) Unmarshal(dAtA []byte) error {
              l := len(dAtA)
              iNdEx := 0
              for iNdEx < l {
                  preIndex := iNdEx
          Severity: Major
          Found in api/logbroker.pb.go - About 2 hrs to fix

            Method TasksMessage.Unmarshal has 81 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            func (m *TasksMessage) Unmarshal(dAtA []byte) error {
                l := len(dAtA)
                iNdEx := 0
                for iNdEx < l {
                    preIndex := iNdEx
            Severity: Major
            Found in api/dispatcher.pb.go - About 2 hrs to fix

              Method Node.loadAndStart has 81 lines of code (exceeds 50 allowed). Consider refactoring.
              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 2 hrs to fix

                Method HeartbeatResponse.Unmarshal has 80 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func (m *HeartbeatResponse) Unmarshal(dAtA []byte) error {
                    l := len(dAtA)
                    iNdEx := 0
                    for iNdEx < l {
                        preIndex := iNdEx
                Severity: Major
                Found in api/dispatcher.pb.go - About 2 hrs to fix

                  Function validateCAConfig has 80 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

                  func validateCAConfig(ctx context.Context, securityConfig *ca.SecurityConfig, cluster *api.Cluster) (*api.RootCA, error) {
                      newConfig := cluster.Spec.CAConfig.Copy()
                      newConfig.SigningCACert = ca.NormalizePEMs(newConfig.SigningCACert) // ensure this is normalized before we use it
                  
                      if len(newConfig.SigningCAKey) > 0 && len(newConfig.SigningCACert) == 0 {
                  Severity: Major
                  Found in manager/controlapi/ca_rotation.go - About 2 hrs to fix

                    TaskSpec has 21 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                    type TaskSpec struct {
                        // Types that are valid to be assigned to Runtime:
                        //    *TaskSpec_Attachment
                        //    *TaskSpec_Container
                        //    *TaskSpec_Generic
                    Severity: Minor
                    Found in api/specs.pb.go - About 2 hrs to fix

                      Method NodeCertificateStatusRequest.Unmarshal has 79 lines of code (exceeds 50 allowed). Consider refactoring.
                      Open

                      func (m *NodeCertificateStatusRequest) Unmarshal(dAtA []byte) error {
                          l := len(dAtA)
                          iNdEx := 0
                          for iNdEx < l {
                              preIndex := iNdEx
                      Severity: Major
                      Found in api/ca.pb.go - About 2 hrs to fix

                        Method HealthCheckRequest.Unmarshal has 79 lines of code (exceeds 50 allowed). Consider refactoring.
                        Open

                        func (m *HealthCheckRequest) Unmarshal(dAtA []byte) error {
                            l := len(dAtA)
                            iNdEx := 0
                            for iNdEx < l {
                                preIndex := iNdEx
                        Severity: Major
                        Found in api/health.pb.go - About 2 hrs to fix

                          Method AttachNetworkResponse.Unmarshal has 79 lines of code (exceeds 50 allowed). Consider refactoring.
                          Open

                          func (m *AttachNetworkResponse) Unmarshal(dAtA []byte) error {
                              l := len(dAtA)
                              iNdEx := 0
                              for iNdEx < l {
                                  preIndex := iNdEx
                          Severity: Major
                          Found in api/resource.pb.go - About 2 hrs to fix

                            Method DetachNetworkRequest.Unmarshal has 79 lines of code (exceeds 50 allowed). Consider refactoring.
                            Open

                            func (m *DetachNetworkRequest) Unmarshal(dAtA []byte) error {
                                l := len(dAtA)
                                iNdEx := 0
                                for iNdEx < l {
                                    preIndex := iNdEx
                            Severity: Major
                            Found in api/resource.pb.go - About 2 hrs to fix

                              Method HeartbeatRequest.Unmarshal has 79 lines of code (exceeds 50 allowed). Consider refactoring.
                              Open

                              func (m *HeartbeatRequest) Unmarshal(dAtA []byte) error {
                                  l := len(dAtA)
                                  iNdEx := 0
                                  for iNdEx < l {
                                      preIndex := iNdEx
                              Severity: Major
                              Found in api/dispatcher.pb.go - About 2 hrs to fix

                                Method AssignmentsRequest.Unmarshal has 79 lines of code (exceeds 50 allowed). Consider refactoring.
                                Open

                                func (m *AssignmentsRequest) Unmarshal(dAtA []byte) error {
                                    l := len(dAtA)
                                    iNdEx := 0
                                    for iNdEx < l {
                                        preIndex := iNdEx
                                Severity: Major
                                Found in api/dispatcher.pb.go - About 2 hrs to fix

                                  Method TasksRequest.Unmarshal has 79 lines of code (exceeds 50 allowed). Consider refactoring.
                                  Open

                                  func (m *TasksRequest) Unmarshal(dAtA []byte) error {
                                      l := len(dAtA)
                                      iNdEx := 0
                                      for iNdEx < l {
                                          preIndex := iNdEx
                                  Severity: Major
                                  Found in api/dispatcher.pb.go - About 2 hrs to fix

                                    Method NetworkAttachmentSpec.Unmarshal has 79 lines of code (exceeds 50 allowed). Consider refactoring.
                                    Open

                                    func (m *NetworkAttachmentSpec) Unmarshal(dAtA []byte) error {
                                        l := len(dAtA)
                                        iNdEx := 0
                                        for iNdEx < l {
                                            preIndex := iNdEx
                                    Severity: Major
                                    Found in api/specs.pb.go - About 2 hrs to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language