docker/swarmkit

View on GitHub

Showing 1,008 of 1,820 total issues

Function CheckTasks has a Cognitive Complexity of 81 (exceeds 20 allowed). Consider refactoring.
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: Minor
Found in manager/orchestrator/taskinit/init.go - About 1 day 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

File service.go has 847 lines of code (exceeds 500 allowed). Consider refactoring.
Open

package controlapi

import (
    "context"
    "errors"
Severity: Major
Found in manager/controlapi/service.go - About 1 day to fix

    Method AssignmentChange.Unmarshal has a Cognitive Complexity of 80 (exceeds 20 allowed). Consider refactoring.
    Open

    func (m *AssignmentChange) Unmarshal(dAtA []byte) error {
        l := len(dAtA)
        iNdEx := 0
        for iNdEx < l {
            preIndex := iNdEx
    Severity: Minor
    Found in api/dispatcher.pb.go - About 1 day 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 NetworkAttachment.Unmarshal has 274 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

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

      Method Task.Unmarshal has 117 return statements (exceeds 4 allowed).
      Open

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

        Method EndpointSpec.Unmarshal has a Cognitive Complexity of 77 (exceeds 20 allowed). Consider refactoring.
        Open

        func (m *EndpointSpec) Unmarshal(dAtA []byte) error {
            l := len(dAtA)
            iNdEx := 0
            for iNdEx < l {
                preIndex := iNdEx
        Severity: Minor
        Found in api/specs.pb.go - About 1 day 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 InternalRaftRequest.Unmarshal has a Cognitive Complexity of 77 (exceeds 20 allowed). Consider refactoring.
        Open

        func (m *InternalRaftRequest) Unmarshal(dAtA []byte) error {
            l := len(dAtA)
            iNdEx := 0
            for iNdEx < l {
                preIndex := iNdEx
        Severity: Minor
        Found in api/raft.pb.go - About 1 day 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 NetworkSpec.Unmarshal has 264 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

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

          Node has 65 methods (exceeds 20 allowed). Consider refactoring.
          Open

          type Node struct {
              raftNode  raft.Node
              cluster   *membership.Cluster
              transport *transport.Transport
          
          
          Severity: Major
          Found in manager/state/raft/raft.go - About 1 day to fix

            Method IssueNodeCertificateResponse.Unmarshal has a Cognitive Complexity of 74 (exceeds 20 allowed). Consider refactoring.
            Open

            func (m *IssueNodeCertificateResponse) Unmarshal(dAtA []byte) error {
                l := len(dAtA)
                iNdEx := 0
                for iNdEx < l {
                    preIndex := iNdEx
            Severity: Minor
            Found in api/ca.pb.go - About 1 day 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 UpdateVolumeStatusRequest_VolumeStatusUpdate.Unmarshal has a Cognitive Complexity of 74 (exceeds 20 allowed). Consider refactoring.
            Open

            func (m *UpdateVolumeStatusRequest_VolumeStatusUpdate) Unmarshal(dAtA []byte) error {
                l := len(dAtA)
                iNdEx := 0
                for iNdEx < l {
                    preIndex := iNdEx
            Severity: Minor
            Found in api/dispatcher.pb.go - About 1 day 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 ResourceReference.Unmarshal has a Cognitive Complexity of 74 (exceeds 20 allowed). Consider refactoring.
            Open

            func (m *ResourceReference) Unmarshal(dAtA []byte) error {
                l := len(dAtA)
                iNdEx := 0
                for iNdEx < l {
                    preIndex := iNdEx
            Severity: Minor
            Found in api/specs.pb.go - About 1 day 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 SelectBySlot.Unmarshal has a Cognitive Complexity of 74 (exceeds 20 allowed). Consider refactoring.
            Open

            func (m *SelectBySlot) Unmarshal(dAtA []byte) error {
                l := len(dAtA)
                iNdEx := 0
                for iNdEx < l {
                    preIndex := iNdEx
            Severity: Minor
            Found in api/watch.pb.go - About 1 day 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 TLSAuthorization.Unmarshal has a Cognitive Complexity of 74 (exceeds 20 allowed). Consider refactoring.
            Open

            func (m *TLSAuthorization) Unmarshal(dAtA []byte) error {
                l := len(dAtA)
                iNdEx := 0
                for iNdEx < l {
                    preIndex := iNdEx
            Severity: Minor
            Found in protobuf/plugin/plugin.pb.go - About 1 day 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 Updater.Run has a Cognitive Complexity of 73 (exceeds 20 allowed). Consider refactoring.
            Open

            func (u *Updater) Run(ctx context.Context, slots []orchestrator.Slot) {
                defer close(u.doneChan)
            
                service := u.newService
            
            
            Severity: Minor
            Found in manager/orchestrator/update/updater.go - About 1 day 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

            File memory.go has 772 lines of code (exceeds 500 allowed). Consider refactoring.
            Open

            package store
            
            import (
                "context"
                "errors"
            Severity: Major
            Found in manager/state/store/memory.go - About 1 day to fix

              Method Network.Unmarshal has 237 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

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

                Method SelectBy.Unmarshal has 99 return statements (exceeds 4 allowed).
                Open

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

                  Method Reconciler.ReconcileService has a Cognitive Complexity of 69 (exceeds 20 allowed). Consider refactoring.
                  Open

                  func (r *Reconciler) ReconcileService(id string) error {
                      var (
                          service *api.Service
                          cluster *api.Cluster
                          tasks   []*api.Task
                  Severity: Minor
                  Found in manager/orchestrator/jobs/global/reconciler.go - About 1 day 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 Volume.Unmarshal has 235 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

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