docker/swarmkit

View on GitHub

Showing 1,820 of 1,820 total issues

Method AssignmentsRequest.Unmarshal has 15 return statements (exceeds 4 allowed).
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 1 hr to fix

    Method NetworkAttachmentSpec.Unmarshal has 15 return statements (exceeds 4 allowed).
    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 1 hr to fix

      Method ReplicatedJob.Unmarshal has 15 return statements (exceeds 4 allowed).
      Open

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

        Method ContainerSpec_PullOptions.Unmarshal has 15 return statements (exceeds 4 allowed).
        Open

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

          Method Reconciler.ReconcileService has 15 return statements (exceeds 4 allowed).
          Open

          func (r *Reconciler) ReconcileService(id string) error {
              var (
                  service *api.Service
                  tasks   []*api.Task
                  cluster *api.Cluster
          Severity: Major
          Found in manager/orchestrator/jobs/replicated/reconciler.go - About 1 hr to fix

            Method JoinRequest.Unmarshal has 15 return statements (exceeds 4 allowed).
            Open

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

              Method ResolveAddressResponse.Unmarshal has 15 return statements (exceeds 4 allowed).
              Open

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

                Method Dispatcher.Assignments has 15 return statements (exceeds 4 allowed).
                Open

                func (d *Dispatcher) Assignments(r *api.AssignmentsRequest, stream api.Dispatcher_AssignmentsServer) error {
                    d.rpcRW.RLock()
                    defer d.rpcRW.RUnlock()
                
                    dctx, err := d.isRunningLocked()
                Severity: Major
                Found in manager/dispatcher/dispatcher.go - About 1 hr to fix

                  Method Server.UpdateVolume has 15 return statements (exceeds 4 allowed).
                  Open

                  func (s *Server) UpdateVolume(ctx context.Context, request *api.UpdateVolumeRequest) (*api.UpdateVolumeResponse, error) {
                      if request.VolumeID == "" {
                          return nil, status.Errorf(codes.InvalidArgument, "VolumeID must not be empty")
                      }
                      if request.Spec == nil {
                  Severity: Major
                  Found in manager/controlapi/volume.go - About 1 hr to fix

                    Method Node.Join has a Cognitive Complexity of 27 (exceeds 20 allowed). Consider refactoring.
                    Open

                    func (n *Node) Join(ctx context.Context, req *api.JoinRequest) (*api.JoinResponse, error) {
                        nodeInfo, err := ca.RemoteNode(ctx)
                        if err != nil {
                            return nil, err
                        }
                    Severity: Minor
                    Found in manager/state/raft/raft.go - About 1 hr 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

                    Function dumpWAL has 60 lines of code (exceeds 50 allowed). Consider refactoring.
                    Open

                    func dumpWAL(swarmdir, unlockKey string, start, end uint64, redact bool) error {
                        walData, _, err := loadData(swarmdir, unlockKey)
                        if err != nil {
                            return err
                        }
                    Severity: Minor
                    Found in swarmd/cmd/swarm-rafttool/dump.go - About 1 hr to fix

                      Function ConvertResourceWatch has 60 lines of code (exceeds 50 allowed). Consider refactoring.
                      Open

                      func ConvertResourceWatch(action WatchActionKind, filters []*SelectBy, kind string) ([]Event, error) {
                          var (
                              m          Resource
                              checkFuncs []ResourceCheckFunc
                          )
                      Severity: Minor
                      Found in api/objects.pb.go - About 1 hr to fix

                        Method raftProxyGen.genClientServerStreamingMethod has 60 lines of code (exceeds 50 allowed). Consider refactoring.
                        Open

                        func (g *raftProxyGen) genClientServerStreamingMethod(s *descriptor.ServiceDescriptorProto, m *descriptor.MethodDescriptorProto) {
                            streamType := s.GetName() + "_" + m.GetName() + "Server"
                        
                            g.genStreamWrapper(streamType)
                        
                        
                        Severity: Minor
                        Found in protobuf/plugin/raftproxy/raftproxy.go - About 1 hr to fix

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

                          func (m *GenericRuntimeSpec) Size() (n int) {
                              if m == nil {
                                  return 0
                              }
                              var l int
                          Severity: Major
                          Found in api/specs.pb.go and 1 other location - About 1 hr to fix
                          api/dispatcher.pb.go on lines 2866..2881

                          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 152.

                          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 2 locations. Consider refactoring.
                          Open

                          func (m *AttachNetworkRequest) Size() (n int) {
                              if m == nil {
                                  return 0
                              }
                              var l int
                          Severity: Major
                          Found in api/resource.pb.go and 1 other location - About 1 hr to fix
                          api/dispatcher.pb.go on lines 2773..2788

                          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 152.

                          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 2 locations. Consider refactoring.
                          Open

                          func (m *UpdateTaskStatusRequest_TaskStatusUpdate) Size() (n int) {
                              if m == nil {
                                  return 0
                              }
                              var l int
                          Severity: Major
                          Found in api/dispatcher.pb.go and 1 other location - About 1 hr to fix
                          api/specs.pb.go on lines 4049..4064

                          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 152.

                          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 2 locations. Consider refactoring.
                          Open

                          func (m *SessionRequest) Size() (n int) {
                              if m == nil {
                                  return 0
                              }
                              var l int
                          Severity: Major
                          Found in api/dispatcher.pb.go and 1 other location - About 1 hr to fix
                          api/resource.pb.go on lines 706..721

                          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 152.

                          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

                          Method Cluster.Size has 59 lines of code (exceeds 50 allowed). Consider refactoring.
                          Open

                          func (m *Cluster) Size() (n int) {
                              if m == nil {
                                  return 0
                              }
                              var l int
                          Severity: Minor
                          Found in api/objects.pb.go - About 1 hr to fix

                            Method SessionMessage.MarshalToSizedBuffer has 59 lines of code (exceeds 50 allowed). Consider refactoring.
                            Open

                            func (m *SessionMessage) MarshalToSizedBuffer(dAtA []byte) (int, error) {
                                i := len(dAtA)
                                _ = i
                                var l int
                                _ = l
                            Severity: Minor
                            Found in api/dispatcher.pb.go - About 1 hr to fix

                              Method Node.processInternalRaftRequest has 59 lines of code (exceeds 50 allowed). Consider refactoring.
                              Open

                              func (n *Node) processInternalRaftRequest(ctx context.Context, r *api.InternalRaftRequest, cb func()) (proto.Message, error) {
                                  n.stopMu.RLock()
                                  if !n.IsMember() {
                                      n.stopMu.RUnlock()
                                      return nil, ErrStopped
                              Severity: Minor
                              Found in manager/state/raft/raft.go - About 1 hr to fix
                                Severity
                                Category
                                Status
                                Source
                                Language