docker/swarmkit

View on GitHub

Showing 1,820 of 1,820 total issues

Method Resource.Unmarshal has 42 return statements (exceeds 4 allowed).
Open

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

    Method testSuite.TestAllocatorRestoreForDuplicateIPs has 116 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func (suite *testSuite) TestAllocatorRestoreForDuplicateIPs() {
        s := store.NewMemoryStore(nil)
        suite.NotNil(s)
        defer s.Close()
        // Create 3 services with 1 task each
    Severity: Major
    Found in manager/allocator/allocator_test_suite.go - About 3 hrs to fix

      Method AttachNetworkRequest.Unmarshal has 115 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

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

        Method UpdateTaskStatusRequest_TaskStatusUpdate.Unmarshal has 115 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

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

          Method SessionRequest.Unmarshal has 115 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

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

            Method GenericRuntimeSpec.Unmarshal has 115 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

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

              Method Task.MarshalToSizedBuffer has a Cognitive Complexity of 40 (exceeds 20 allowed). Consider refactoring.
              Open

              func (m *Task) MarshalToSizedBuffer(dAtA []byte) (int, error) {
                  i := len(dAtA)
                  _ = i
                  var l int
                  _ = l
              Severity: Minor
              Found in api/objects.pb.go - About 3 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 Server.RemoveNode has a Cognitive Complexity of 40 (exceeds 20 allowed). Consider refactoring.
              Open

              func (s *Server) RemoveNode(ctx context.Context, request *api.RemoveNodeRequest) (*api.RemoveNodeResponse, error) {
                  if request.NodeID == "" {
                      return nil, status.Errorf(codes.InvalidArgument, errInvalidArgument.Error())
                  }
              
              
              Severity: Minor
              Found in manager/controlapi/node.go - About 3 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.allocateTask has a Cognitive Complexity of 40 (exceeds 20 allowed). Consider refactoring.
              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: Minor
              Found in manager/allocator/network.go - About 3 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 GetUnlockKeyResponse.Unmarshal has 114 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

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

                Method Service.MarshalToSizedBuffer has 114 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

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

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

                  func (m *UpdateTaskStatusRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
                      i := len(dAtA)
                      _ = i
                      var l int
                      _ = l
                  Severity: Major
                  Found in api/dispatcher.pb.go and 1 other location - About 3 hrs to fix
                  api/dispatcher.pb.go on lines 2030..2057

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

                  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 *UpdateVolumeStatusRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
                      i := len(dAtA)
                      _ = i
                      var l int
                      _ = l
                  Severity: Major
                  Found in api/dispatcher.pb.go and 1 other location - About 3 hrs to fix
                  api/dispatcher.pb.go on lines 1921..1948

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

                  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 UpdateTaskStatusRequest.Unmarshal has 113 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

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

                    Method UpdateVolumeStatusRequest.Unmarshal has 113 lines of code (exceeds 50 allowed). Consider refactoring.
                    Open

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

                      Method Node.MarshalToSizedBuffer has 112 lines of code (exceeds 50 allowed). Consider refactoring.
                      Open

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

                        Method Server.ListNodes has 112 lines of code (exceeds 50 allowed). Consider refactoring.
                        Open

                        func (s *Server) ListNodes(ctx context.Context, request *api.ListNodesRequest) (*api.ListNodesResponse, error) {
                            var (
                                nodes []*api.Node
                                err   error
                            )
                        Severity: Major
                        Found in manager/controlapi/node.go - About 3 hrs to fix

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

                          package config
                          
                          import (
                              "context"
                              "fmt"
                          Severity: Major
                          Found in swarmd/cmd/swarmctl/config/common.go and 1 other location - About 3 hrs to fix
                          swarmd/cmd/swarmctl/secret/common.go on lines 1..43

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

                          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

                          package secret
                          
                          import (
                              "context"
                              "fmt"
                          Severity: Major
                          Found in swarmd/cmd/swarmctl/secret/common.go and 1 other location - About 3 hrs to fix
                          swarmd/cmd/swarmctl/config/common.go on lines 1..43

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

                          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 Endpoint_VirtualIP.Unmarshal has 111 lines of code (exceeds 50 allowed). Consider refactoring.
                          Open

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