docker/swarmkit

View on GitHub

Showing 1,820 of 1,820 total issues

Method Scheduler.scheduleNTasksOnSubtree has a Cognitive Complexity of 33 (exceeds 20 allowed). Consider refactoring.
Open

func (s *Scheduler) scheduleNTasksOnSubtree(ctx context.Context, n int, taskGroup map[string]*api.Task, tree *decisionTree, schedulingDecisions map[string]schedulingDecision, nodeLess func(a *NodeInfo, b *NodeInfo) bool) int {
    if tree.next == nil {
        nodes := tree.orderedNodes(s.pipeline.Process, nodeLess)
        if len(nodes) == 0 {
            return 0
Severity: Minor
Found in manager/scheduler/scheduler.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

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

    hasNoIPOverlapTasks := func(fakeT assert.TestingT, s *store.MemoryStore, task *api.Task) bool {
        assert.NotEqual(fakeT, len(task.Networks), 0)
        assert.NotEqual(fakeT, len(task.Networks[0].Addresses), 0)
        assignedIP := task.Networks[1].Addresses[0]
        if assignedIPs[assignedIP] {
Severity: Major
Found in manager/allocator/allocator_test_suite.go and 1 other location - About 2 hrs to fix
manager/allocator/allocator_test_suite.go on lines 981..994

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

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

    hasNoIPOverlapTasks := func(fakeT assert.TestingT, s *store.MemoryStore, task *api.Task) bool {
        assert.NotEqual(fakeT, len(task.Networks), 0)
        assert.NotEqual(fakeT, len(task.Networks[0].Addresses), 0)
        assignedIP := task.Networks[0].Addresses[0]
        if assignedIPs[assignedIP] {
Severity: Major
Found in manager/allocator/allocator_test_suite.go and 1 other location - About 2 hrs to fix
manager/allocator/allocator_test_suite.go on lines 1179..1192

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

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

Function ConvertTaskWatch has 85 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func ConvertTaskWatch(action WatchActionKind, filters []*SelectBy) ([]Event, error) {
    var (
        m               Task
        checkFuncs      []TaskCheckFunc
        hasDesiredState bool
Severity: Major
Found in api/objects.pb.go - About 2 hrs to fix

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

      Method ClusterSpec.MarshalToSizedBuffer has 85 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

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

        Method Server.UpdateService has 85 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func (s *Server) UpdateService(ctx context.Context, request *api.UpdateServiceRequest) (*api.UpdateServiceResponse, error) {
            if request.ServiceID == "" || request.ServiceVersion == nil {
                return nil, status.Errorf(codes.InvalidArgument, errInvalidArgument.Error())
            }
            if err := validateServiceSpec(request.Spec); err != nil {
        Severity: Major
        Found in manager/controlapi/service.go - About 2 hrs to fix

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

          func (s *Server) GetTask(ctx context.Context, request *api.GetTaskRequest) (*api.GetTaskResponse, error) {
              if request.TaskID == "" {
                  return nil, status.Errorf(codes.InvalidArgument, errInvalidArgument.Error())
              }
          
          
          Severity: Major
          Found in manager/controlapi/task.go and 1 other location - About 2 hrs to fix
          manager/controlapi/network.go on lines 139..154

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

          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 (s *Server) GetNetwork(ctx context.Context, request *api.GetNetworkRequest) (*api.GetNetworkResponse, error) {
              if request.NetworkID == "" {
                  return nil, status.Errorf(codes.InvalidArgument, errInvalidArgument.Error())
              }
          
          
          Severity: Major
          Found in manager/controlapi/network.go and 1 other location - About 2 hrs to fix
          manager/controlapi/task.go on lines 17..32

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

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

          func (p *raftProxyNodeCAServer) pollNewLeaderConn(ctx context.Context) (*grpc.ClientConn, error) {
              ticker := rafttime.NewTicker(500 * rafttime.Millisecond)
              defer ticker.Stop()
              for {
                  select {
          Severity: Major
          Found in api/ca.pb.go and 9 other locations - About 2 hrs to fix
          api/ca.pb.go on lines 1136..1158
          api/dispatcher.pb.go on lines 2491..2513
          api/health.pb.go on lines 420..442
          api/logbroker.pb.go on lines 1764..1786
          api/logbroker.pb.go on lines 1887..1909
          api/raft.pb.go on lines 2134..2156
          api/raft.pb.go on lines 2333..2355
          api/resource.pb.go on lines 612..634
          api/watch.pb.go on lines 2197..2219

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

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

          func (p *raftProxyRaftMembershipServer) pollNewLeaderConn(ctx context.Context) (*grpc.ClientConn, error) {
              ticker := rafttime.NewTicker(500 * rafttime.Millisecond)
              defer ticker.Stop()
              for {
                  select {
          Severity: Major
          Found in api/raft.pb.go and 9 other locations - About 2 hrs to fix
          api/ca.pb.go on lines 1136..1158
          api/ca.pb.go on lines 1278..1300
          api/dispatcher.pb.go on lines 2491..2513
          api/health.pb.go on lines 420..442
          api/logbroker.pb.go on lines 1764..1786
          api/logbroker.pb.go on lines 1887..1909
          api/raft.pb.go on lines 2134..2156
          api/resource.pb.go on lines 612..634
          api/watch.pb.go on lines 2197..2219

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

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

          func (p *raftProxyCAServer) pollNewLeaderConn(ctx context.Context) (*grpc.ClientConn, error) {
              ticker := rafttime.NewTicker(500 * rafttime.Millisecond)
              defer ticker.Stop()
              for {
                  select {
          Severity: Major
          Found in api/ca.pb.go and 9 other locations - About 2 hrs to fix
          api/ca.pb.go on lines 1278..1300
          api/dispatcher.pb.go on lines 2491..2513
          api/health.pb.go on lines 420..442
          api/logbroker.pb.go on lines 1764..1786
          api/logbroker.pb.go on lines 1887..1909
          api/raft.pb.go on lines 2134..2156
          api/raft.pb.go on lines 2333..2355
          api/resource.pb.go on lines 612..634
          api/watch.pb.go on lines 2197..2219

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

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

          func (p *raftProxyWatchServer) pollNewLeaderConn(ctx context.Context) (*grpc.ClientConn, error) {
              ticker := rafttime.NewTicker(500 * rafttime.Millisecond)
              defer ticker.Stop()
              for {
                  select {
          Severity: Major
          Found in api/watch.pb.go and 9 other locations - About 2 hrs to fix
          api/ca.pb.go on lines 1136..1158
          api/ca.pb.go on lines 1278..1300
          api/dispatcher.pb.go on lines 2491..2513
          api/health.pb.go on lines 420..442
          api/logbroker.pb.go on lines 1764..1786
          api/logbroker.pb.go on lines 1887..1909
          api/raft.pb.go on lines 2134..2156
          api/raft.pb.go on lines 2333..2355
          api/resource.pb.go on lines 612..634

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

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

          func (p *raftProxyResourceAllocatorServer) pollNewLeaderConn(ctx context.Context) (*grpc.ClientConn, error) {
              ticker := rafttime.NewTicker(500 * rafttime.Millisecond)
              defer ticker.Stop()
              for {
                  select {
          Severity: Major
          Found in api/resource.pb.go and 9 other locations - About 2 hrs to fix
          api/ca.pb.go on lines 1136..1158
          api/ca.pb.go on lines 1278..1300
          api/dispatcher.pb.go on lines 2491..2513
          api/health.pb.go on lines 420..442
          api/logbroker.pb.go on lines 1764..1786
          api/logbroker.pb.go on lines 1887..1909
          api/raft.pb.go on lines 2134..2156
          api/raft.pb.go on lines 2333..2355
          api/watch.pb.go on lines 2197..2219

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

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

          func (p *raftProxyLogsServer) pollNewLeaderConn(ctx context.Context) (*grpc.ClientConn, error) {
              ticker := rafttime.NewTicker(500 * rafttime.Millisecond)
              defer ticker.Stop()
              for {
                  select {
          Severity: Major
          Found in api/logbroker.pb.go and 9 other locations - About 2 hrs to fix
          api/ca.pb.go on lines 1136..1158
          api/ca.pb.go on lines 1278..1300
          api/dispatcher.pb.go on lines 2491..2513
          api/health.pb.go on lines 420..442
          api/logbroker.pb.go on lines 1887..1909
          api/raft.pb.go on lines 2134..2156
          api/raft.pb.go on lines 2333..2355
          api/resource.pb.go on lines 612..634
          api/watch.pb.go on lines 2197..2219

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

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

          func (p *raftProxyHealthServer) pollNewLeaderConn(ctx context.Context) (*grpc.ClientConn, error) {
              ticker := rafttime.NewTicker(500 * rafttime.Millisecond)
              defer ticker.Stop()
              for {
                  select {
          Severity: Major
          Found in api/health.pb.go and 9 other locations - About 2 hrs to fix
          api/ca.pb.go on lines 1136..1158
          api/ca.pb.go on lines 1278..1300
          api/dispatcher.pb.go on lines 2491..2513
          api/logbroker.pb.go on lines 1764..1786
          api/logbroker.pb.go on lines 1887..1909
          api/raft.pb.go on lines 2134..2156
          api/raft.pb.go on lines 2333..2355
          api/resource.pb.go on lines 612..634
          api/watch.pb.go on lines 2197..2219

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

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

          func (p *raftProxyRaftServer) pollNewLeaderConn(ctx context.Context) (*grpc.ClientConn, error) {
              ticker := rafttime.NewTicker(500 * rafttime.Millisecond)
              defer ticker.Stop()
              for {
                  select {
          Severity: Major
          Found in api/raft.pb.go and 9 other locations - About 2 hrs to fix
          api/ca.pb.go on lines 1136..1158
          api/ca.pb.go on lines 1278..1300
          api/dispatcher.pb.go on lines 2491..2513
          api/health.pb.go on lines 420..442
          api/logbroker.pb.go on lines 1764..1786
          api/logbroker.pb.go on lines 1887..1909
          api/raft.pb.go on lines 2333..2355
          api/resource.pb.go on lines 612..634
          api/watch.pb.go on lines 2197..2219

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

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

          func (p *raftProxyLogBrokerServer) pollNewLeaderConn(ctx context.Context) (*grpc.ClientConn, error) {
              ticker := rafttime.NewTicker(500 * rafttime.Millisecond)
              defer ticker.Stop()
              for {
                  select {
          Severity: Major
          Found in api/logbroker.pb.go and 9 other locations - About 2 hrs to fix
          api/ca.pb.go on lines 1136..1158
          api/ca.pb.go on lines 1278..1300
          api/dispatcher.pb.go on lines 2491..2513
          api/health.pb.go on lines 420..442
          api/logbroker.pb.go on lines 1764..1786
          api/raft.pb.go on lines 2134..2156
          api/raft.pb.go on lines 2333..2355
          api/resource.pb.go on lines 612..634
          api/watch.pb.go on lines 2197..2219

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

          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

              hasNoIPOverlapServices := func(fakeT assert.TestingT, service *api.Service) bool {
                  assert.NotEqual(fakeT, len(service.Endpoint.VirtualIPs), 0)
                  assert.NotEqual(fakeT, len(service.Endpoint.VirtualIPs[0].Addr), 0)
                  assignedVIP := service.Endpoint.VirtualIPs[1].Addr
                  if assignedIPs[assignedVIP] {
          Severity: Major
          Found in manager/allocator/allocator_test_suite.go and 1 other location - About 2 hrs to fix
          manager/allocator/allocator_test_suite.go on lines 966..979

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

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

          func (p *raftProxyDispatcherServer) pollNewLeaderConn(ctx context.Context) (*grpc.ClientConn, error) {
              ticker := rafttime.NewTicker(500 * rafttime.Millisecond)
              defer ticker.Stop()
              for {
                  select {
          Severity: Major
          Found in api/dispatcher.pb.go and 9 other locations - About 2 hrs to fix
          api/ca.pb.go on lines 1136..1158
          api/ca.pb.go on lines 1278..1300
          api/health.pb.go on lines 420..442
          api/logbroker.pb.go on lines 1764..1786
          api/logbroker.pb.go on lines 1887..1909
          api/raft.pb.go on lines 2134..2156
          api/raft.pb.go on lines 2333..2355
          api/resource.pb.go on lines 612..634
          api/watch.pb.go on lines 2197..2219

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

          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

          Severity
          Category
          Status
          Source
          Language