docker/swarmkit

View on GitHub

Showing 1,820 of 1,820 total issues

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

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

              func (m *SelectBySlot) MarshalToSizedBuffer(dAtA []byte) (int, error) {
                  i := len(dAtA)
                  _ = i
                  var l int
                  _ = l
              Severity: Major
              Found in api/watch.pb.go and 2 other locations - About 2 hrs to fix
              api/ca.pb.go on lines 940..958
              api/specs.pb.go on lines 2732..2750

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

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

              func (m *IssueNodeCertificateResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
                  i := len(dAtA)
                  _ = i
                  var l int
                  _ = l
              Severity: Major
              Found in api/ca.pb.go and 2 other locations - About 2 hrs to fix
              api/specs.pb.go on lines 2732..2750
              api/watch.pb.go on lines 1591..1609

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

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

              func (m *ResourceReference) MarshalToSizedBuffer(dAtA []byte) (int, error) {
                  i := len(dAtA)
                  _ = i
                  var l int
                  _ = l
              Severity: Major
              Found in api/specs.pb.go and 2 other locations - About 2 hrs to fix
              api/ca.pb.go on lines 940..958
              api/watch.pb.go on lines 1591..1609

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

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

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

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

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

                  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 *TasksMessage) 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 2 hrs to fix
                  api/logbroker.pb.go on lines 1518..1538

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

                  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

                  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
                            Severity
                            Category
                            Status
                            Source
                            Language