docker/swarmkit

View on GitHub

Showing 1,820 of 1,820 total issues

Method Node.LeaderConn has 6 return statements (exceeds 4 allowed).
Open

func (n *Node) LeaderConn(ctx context.Context) (*grpc.ClientConn, error) {
    cc, err := n.getLeaderConn()
    if err == nil {
        return cc, nil
    }
Severity: Major
Found in manager/state/raft/raft.go - About 40 mins to fix

    Method LogBroker.SubscribeLogs has 6 return statements (exceeds 4 allowed).
    Open

    func (lb *LogBroker) SubscribeLogs(request *api.SubscribeLogsRequest, stream api.Logs_SubscribeLogsServer) error {
        ctx := stream.Context()
    
        if err := validateSelector(request.Selector); err != nil {
            return err
    Severity: Major
    Found in manager/logbroker/broker.go - About 40 mins to fix

      Function RestoreTable has 6 return statements (exceeds 4 allowed).
      Open

      func RestoreTable(tx Tx, table string, newObjects []api.StoreObject) error {
          checkType := func(by By) error {
              return nil
          }
          var oldObjects []api.StoreObject
      Severity: Major
      Found in manager/state/store/object.go - About 40 mins to fix

        Method ResourceAllocator.AttachNetwork has 6 return statements (exceeds 4 allowed).
        Open

        func (ra *ResourceAllocator) AttachNetwork(ctx context.Context, request *api.AttachNetworkRequest) (*api.AttachNetworkResponse, error) {
            nodeInfo, err := ca.RemoteNode(ctx)
            if err != nil {
                return nil, err
            }
        Severity: Major
        Found in manager/resourceapi/allocator.go - About 40 mins to fix

          Method Node.ChangesBetween has 6 return statements (exceeds 4 allowed).
          Open

          func (n *Node) ChangesBetween(from, to api.Version) ([]state.Change, error) {
              n.stopMu.RLock()
              defer n.stopMu.RUnlock()
          
              if from.Index > to.Index {
          Severity: Major
          Found in manager/state/raft/raft.go - About 40 mins to fix

            Method Cluster.ValidateConfigurationChange has 6 return statements (exceeds 4 allowed).
            Open

            func (c *Cluster) ValidateConfigurationChange(cc raftpb.ConfChange) error {
                c.mu.Lock()
                defer c.mu.Unlock()
            
                if c.removed[cc.NodeID] {
            Severity: Major
            Found in manager/state/raft/membership/cluster.go - About 40 mins to fix

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

                      sp2 := &api.Service{
                          ID: "predServiceID2",
                          Spec: api.ServiceSpec{
                              Annotations: api.Annotations{
                                  Name: "predService2",
              Severity: Minor
              Found in manager/allocator/allocator_test_suite.go and 1 other location - About 40 mins to fix
              manager/allocator/allocator_test_suite.go on lines 180..195

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

              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 (c *raftClient) StreamRaftMessage(ctx context.Context, opts ...grpc.CallOption) (Raft_StreamRaftMessageClient, error) {
                  stream, err := c.cc.NewStream(ctx, &_Raft_serviceDesc.Streams[0], "/docker.swarmkit.v1.Raft/StreamRaftMessage", opts...)
                  if err != nil {
                      return nil, err
                  }
              Severity: Minor
              Found in api/raft.pb.go and 1 other location - About 40 mins to fix
              api/logbroker.pb.go on lines 1069..1076

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

              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

                      sp1 := &api.Service{
                          ID: "predServiceID1",
                          Spec: api.ServiceSpec{
                              Annotations: api.Annotations{
                                  Name: "predService1",
              Severity: Minor
              Found in manager/allocator/allocator_test_suite.go and 1 other location - About 40 mins to fix
              manager/allocator/allocator_test_suite.go on lines 214..229

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

              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

                      if configRef.GetFile() != nil {
                          fileName := configRef.GetFile().Name
                          // Validate the file name
                          if fileName == "" {
                              return status.Errorf(codes.InvalidArgument, "malformed file config reference, invalid target file name provided")
              Severity: Minor
              Found in manager/controlapi/service.go and 1 other location - About 40 mins to fix
              manager/controlapi/service.go on lines 380..391

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

              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 (c *logBrokerClient) PublishLogs(ctx context.Context, opts ...grpc.CallOption) (LogBroker_PublishLogsClient, error) {
                  stream, err := c.cc.NewStream(ctx, &_LogBroker_serviceDesc.Streams[1], "/docker.swarmkit.v1.LogBroker/PublishLogs", opts...)
                  if err != nil {
                      return nil, err
                  }
              Severity: Minor
              Found in api/logbroker.pb.go and 1 other location - About 40 mins to fix
              api/raft.pb.go on lines 1149..1156

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

              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

                      if secretRef.GetFile() != nil {
                          fileName := secretRef.GetFile().Name
                          if fileName == "" {
                              return status.Errorf(codes.InvalidArgument, "malformed file secret reference, invalid target file name provided")
                          }
              Severity: Minor
              Found in manager/controlapi/service.go and 1 other location - About 40 mins to fix
              manager/controlapi/service.go on lines 435..448

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

              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 *secrets) Get(secretID string) (*api.Secret, error) {
                  s.mu.RLock()
                  defer s.mu.RUnlock()
                  if s, ok := s.m[secretID]; ok {
                      return s, nil
              Severity: Minor
              Found in agent/secrets/secrets.go and 1 other location - About 40 mins to fix
              agent/configs/configs.go on lines 26..33

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

              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

                  if len(ctr.Secrets) > 0 {
                      fmt.Fprintln(w, "  Secrets:")
                      for _, sr := range ctr.Secrets {
                          var targetName, mode string
                          if sr.GetFile() != nil {
              Severity: Minor
              Found in swarmd/cmd/swarmctl/task/inspect.go and 1 other location - About 40 mins to fix
              swarmd/cmd/swarmctl/task/inspect.go on lines 82..92

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

              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 (r *configs) Get(configID string) (*api.Config, error) {
                  r.mu.RLock()
                  defer r.mu.RUnlock()
                  if r, ok := r.m[configID]; ok {
                      return r, nil
              Severity: Minor
              Found in agent/configs/configs.go and 1 other location - About 40 mins to fix
              agent/secrets/secrets.go on lines 27..34

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

              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

                  if len(ctr.Configs) > 0 {
                      fmt.Fprintln(w, "  Configs:")
                      for _, cr := range ctr.Configs {
                          var targetName, mode string
                          if cr.GetFile() != nil {
              Severity: Minor
              Found in swarmd/cmd/swarmctl/task/inspect.go and 1 other location - About 40 mins to fix
              swarmd/cmd/swarmctl/task/inspect.go on lines 71..81

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

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

              func (m *ServiceSpec_GlobalJob) Size() (n int) {
                  if m == nil {
                      return 0
                  }
                  var l int
              Severity: Major
              Found in api/specs.pb.go and 37 other locations - About 40 mins to fix
              api/dispatcher.pb.go on lines 2989..3000
              api/dispatcher.pb.go on lines 3001..3012
              api/dispatcher.pb.go on lines 3013..3024
              api/dispatcher.pb.go on lines 3025..3036
              api/raft.pb.go on lines 2485..2496
              api/raft.pb.go on lines 2507..2518
              api/raft.pb.go on lines 2529..2540
              api/raft.pb.go on lines 2609..2620
              api/raft.pb.go on lines 2621..2632
              api/raft.pb.go on lines 2633..2644
              api/raft.pb.go on lines 2645..2656
              api/raft.pb.go on lines 2657..2668
              api/raft.pb.go on lines 2669..2680
              api/raft.pb.go on lines 2681..2692
              api/raft.pb.go on lines 2693..2704
              api/raft.pb.go on lines 2705..2716
              api/raft.pb.go on lines 2717..2728
              api/specs.pb.go on lines 3861..3872
              api/specs.pb.go on lines 3873..3884
              api/specs.pb.go on lines 3885..3896
              api/specs.pb.go on lines 3997..4008
              api/specs.pb.go on lines 4009..4020
              api/specs.pb.go on lines 4021..4032
              api/watch.pb.go on lines 2284..2295
              api/watch.pb.go on lines 2296..2307
              api/watch.pb.go on lines 2308..2319
              api/watch.pb.go on lines 2320..2331
              api/watch.pb.go on lines 2332..2343
              api/watch.pb.go on lines 2344..2355
              api/watch.pb.go on lines 2356..2367
              api/watch.pb.go on lines 2368..2379
              api/watch.pb.go on lines 2380..2391
              api/watch.pb.go on lines 2392..2403
              api/watch.pb.go on lines 2493..2504
              api/watch.pb.go on lines 2505..2516
              api/watch.pb.go on lines 2537..2548
              protobuf/plugin/plugin.pb.go on lines 585..596

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

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

              func (m *StoreAction_Volume) Size() (n int) {
                  if m == nil {
                      return 0
                  }
                  var l int
              Severity: Major
              Found in api/raft.pb.go and 37 other locations - About 40 mins to fix
              api/dispatcher.pb.go on lines 2989..3000
              api/dispatcher.pb.go on lines 3001..3012
              api/dispatcher.pb.go on lines 3013..3024
              api/dispatcher.pb.go on lines 3025..3036
              api/raft.pb.go on lines 2485..2496
              api/raft.pb.go on lines 2507..2518
              api/raft.pb.go on lines 2529..2540
              api/raft.pb.go on lines 2609..2620
              api/raft.pb.go on lines 2621..2632
              api/raft.pb.go on lines 2633..2644
              api/raft.pb.go on lines 2645..2656
              api/raft.pb.go on lines 2657..2668
              api/raft.pb.go on lines 2669..2680
              api/raft.pb.go on lines 2681..2692
              api/raft.pb.go on lines 2693..2704
              api/raft.pb.go on lines 2705..2716
              api/specs.pb.go on lines 3861..3872
              api/specs.pb.go on lines 3873..3884
              api/specs.pb.go on lines 3885..3896
              api/specs.pb.go on lines 3897..3908
              api/specs.pb.go on lines 3997..4008
              api/specs.pb.go on lines 4009..4020
              api/specs.pb.go on lines 4021..4032
              api/watch.pb.go on lines 2284..2295
              api/watch.pb.go on lines 2296..2307
              api/watch.pb.go on lines 2308..2319
              api/watch.pb.go on lines 2320..2331
              api/watch.pb.go on lines 2332..2343
              api/watch.pb.go on lines 2344..2355
              api/watch.pb.go on lines 2356..2367
              api/watch.pb.go on lines 2368..2379
              api/watch.pb.go on lines 2380..2391
              api/watch.pb.go on lines 2392..2403
              api/watch.pb.go on lines 2493..2504
              api/watch.pb.go on lines 2505..2516
              api/watch.pb.go on lines 2537..2548
              protobuf/plugin/plugin.pb.go on lines 585..596

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

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

              func (m *Object_Network) Size() (n int) {
                  if m == nil {
                      return 0
                  }
                  var l int
              Severity: Major
              Found in api/watch.pb.go and 37 other locations - About 40 mins to fix
              api/dispatcher.pb.go on lines 2989..3000
              api/dispatcher.pb.go on lines 3001..3012
              api/dispatcher.pb.go on lines 3013..3024
              api/dispatcher.pb.go on lines 3025..3036
              api/raft.pb.go on lines 2485..2496
              api/raft.pb.go on lines 2507..2518
              api/raft.pb.go on lines 2529..2540
              api/raft.pb.go on lines 2609..2620
              api/raft.pb.go on lines 2621..2632
              api/raft.pb.go on lines 2633..2644
              api/raft.pb.go on lines 2645..2656
              api/raft.pb.go on lines 2657..2668
              api/raft.pb.go on lines 2669..2680
              api/raft.pb.go on lines 2681..2692
              api/raft.pb.go on lines 2693..2704
              api/raft.pb.go on lines 2705..2716
              api/raft.pb.go on lines 2717..2728
              api/specs.pb.go on lines 3861..3872
              api/specs.pb.go on lines 3873..3884
              api/specs.pb.go on lines 3885..3896
              api/specs.pb.go on lines 3897..3908
              api/specs.pb.go on lines 3997..4008
              api/specs.pb.go on lines 4009..4020
              api/specs.pb.go on lines 4021..4032
              api/watch.pb.go on lines 2284..2295
              api/watch.pb.go on lines 2296..2307
              api/watch.pb.go on lines 2320..2331
              api/watch.pb.go on lines 2332..2343
              api/watch.pb.go on lines 2344..2355
              api/watch.pb.go on lines 2356..2367
              api/watch.pb.go on lines 2368..2379
              api/watch.pb.go on lines 2380..2391
              api/watch.pb.go on lines 2392..2403
              api/watch.pb.go on lines 2493..2504
              api/watch.pb.go on lines 2505..2516
              api/watch.pb.go on lines 2537..2548
              protobuf/plugin/plugin.pb.go on lines 585..596

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

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

              func (m *Object_Task) Size() (n int) {
                  if m == nil {
                      return 0
                  }
                  var l int
              Severity: Major
              Found in api/watch.pb.go and 37 other locations - About 40 mins to fix
              api/dispatcher.pb.go on lines 2989..3000
              api/dispatcher.pb.go on lines 3001..3012
              api/dispatcher.pb.go on lines 3013..3024
              api/dispatcher.pb.go on lines 3025..3036
              api/raft.pb.go on lines 2485..2496
              api/raft.pb.go on lines 2507..2518
              api/raft.pb.go on lines 2529..2540
              api/raft.pb.go on lines 2609..2620
              api/raft.pb.go on lines 2621..2632
              api/raft.pb.go on lines 2633..2644
              api/raft.pb.go on lines 2645..2656
              api/raft.pb.go on lines 2657..2668
              api/raft.pb.go on lines 2669..2680
              api/raft.pb.go on lines 2681..2692
              api/raft.pb.go on lines 2693..2704
              api/raft.pb.go on lines 2705..2716
              api/raft.pb.go on lines 2717..2728
              api/specs.pb.go on lines 3861..3872
              api/specs.pb.go on lines 3873..3884
              api/specs.pb.go on lines 3885..3896
              api/specs.pb.go on lines 3897..3908
              api/specs.pb.go on lines 3997..4008
              api/specs.pb.go on lines 4009..4020
              api/specs.pb.go on lines 4021..4032
              api/watch.pb.go on lines 2284..2295
              api/watch.pb.go on lines 2296..2307
              api/watch.pb.go on lines 2308..2319
              api/watch.pb.go on lines 2332..2343
              api/watch.pb.go on lines 2344..2355
              api/watch.pb.go on lines 2356..2367
              api/watch.pb.go on lines 2368..2379
              api/watch.pb.go on lines 2380..2391
              api/watch.pb.go on lines 2392..2403
              api/watch.pb.go on lines 2493..2504
              api/watch.pb.go on lines 2505..2516
              api/watch.pb.go on lines 2537..2548
              protobuf/plugin/plugin.pb.go on lines 585..596

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

              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