docker/swarmkit

View on GitHub
api/health.pb.go

Summary

Maintainability
F
1 wk
Test Coverage

File health.pb.go has 693 lines of code (exceeds 500 allowed). Consider refactoring.
Open

// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: github.com/docker/swarmkit/api/health.proto

package api

Severity: Minor
Found in api/health.pb.go - About 6 hrs to fix

    Method HealthCheckRequest.Unmarshal has a Cognitive Complexity of 56 (exceeds 20 allowed). Consider refactoring.
    Open

    func (m *HealthCheckRequest) Unmarshal(dAtA []byte) error {
        l := len(dAtA)
        iNdEx := 0
        for iNdEx < l {
            preIndex := iNdEx
    Severity: Minor
    Found in api/health.pb.go - About 6 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

    Function skipHealth has a Cognitive Complexity of 54 (exceeds 20 allowed). Consider refactoring.
    Open

    func skipHealth(dAtA []byte) (n int, err error) {
        l := len(dAtA)
        iNdEx := 0
        depth := 0
        for iNdEx < l {
    Severity: Minor
    Found in api/health.pb.go - About 5 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 HealthCheckResponse.Unmarshal has a Cognitive Complexity of 47 (exceeds 20 allowed). Consider refactoring.
    Open

    func (m *HealthCheckResponse) Unmarshal(dAtA []byte) error {
        l := len(dAtA)
        iNdEx := 0
        for iNdEx < l {
            preIndex := iNdEx
    Severity: Minor
    Found in api/health.pb.go - About 4 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 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

      Function skipHealth has 76 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func skipHealth(dAtA []byte) (n int, err error) {
          l := len(dAtA)
          iNdEx := 0
          depth := 0
          for iNdEx < l {
      Severity: Major
      Found in api/health.pb.go - About 2 hrs to fix

        Method HealthCheckResponse.Unmarshal has 66 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

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

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

            Method HealthCheckResponse.Unmarshal has 12 return statements (exceeds 4 allowed).
            Open

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

              Function skipHealth has 11 return statements (exceeds 4 allowed).
              Open

              func skipHealth(dAtA []byte) (n int, err error) {
                  l := len(dAtA)
                  iNdEx := 0
                  depth := 0
                  for iNdEx < l {
              Severity: Major
              Found in api/health.pb.go - About 1 hr to fix

                Method raftProxyHealthServer.Check has 9 return statements (exceeds 4 allowed).
                Open

                func (p *raftProxyHealthServer) Check(ctx context.Context, r *HealthCheckRequest) (*HealthCheckResponse, error) {
                
                    conn, err := p.connSelector.LeaderConn(ctx)
                    if err != nil {
                        if err == raftselector.ErrIsLeader {
                Severity: Major
                Found in api/health.pb.go - About 55 mins to fix

                  Similar blocks of code found in 11 locations. 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 and 10 other locations - About 1 day to fix
                  api/ca.pb.go on lines 1585..1666
                  api/dispatcher.pb.go on lines 3672..3753
                  api/dispatcher.pb.go on lines 4389..4470
                  api/dispatcher.pb.go on lines 4555..4636
                  api/raft.pb.go on lines 3154..3235
                  api/raft.pb.go on lines 3892..3973
                  api/resource.pb.go on lines 930..1011
                  api/resource.pb.go on lines 1012..1093
                  api/specs.pb.go on lines 6280..6361
                  api/specs.pb.go on lines 7500..7581

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

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

                  func skipHealth(dAtA []byte) (n int, err error) {
                      l := len(dAtA)
                      iNdEx := 0
                      depth := 0
                      for iNdEx < l {
                  Severity: Major
                  Found in api/health.pb.go and 10 other locations - About 6 hrs to fix
                  api/ca.pb.go on lines 2345..2422
                  api/dispatcher.pb.go on lines 5099..5176
                  api/logbroker.pb.go on lines 3809..3886
                  api/objects.pb.go on lines 10049..10126
                  api/raft.pb.go on lines 4496..4573
                  api/resource.pb.go on lines 1144..1221
                  api/snapshot.pb.go on lines 1528..1605
                  api/specs.pb.go on lines 9186..9263
                  api/watch.pb.go on lines 4796..4873
                  protobuf/plugin/plugin.pb.go on lines 1190..1267

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

                  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 *HealthCheckResponse) Unmarshal(dAtA []byte) error {
                      l := len(dAtA)
                      iNdEx := 0
                      for iNdEx < l {
                          preIndex := iNdEx
                  Severity: Major
                  Found in api/health.pb.go and 2 other locations - About 6 hrs to fix
                  api/raft.pb.go on lines 3823..3891
                  api/specs.pb.go on lines 5418..5486

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

                  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 NewRaftProxyHealthServer(local HealthServer, connSelector raftselector.ConnProvider, localCtxMod, remoteCtxMod func(context.Context) (context.Context, error)) HealthServer {
                      redirectChecker := func(ctx context.Context) (context.Context, error) {
                          p, ok := peer.FromContext(ctx)
                          if !ok {
                              return ctx, status.Errorf(codes.InvalidArgument, "remote addr is not found in context")
                  Severity: Major
                  Found in api/health.pb.go and 9 other locations - About 5 hrs to fix
                  api/ca.pb.go on lines 1094..1125
                  api/ca.pb.go on lines 1236..1267
                  api/dispatcher.pb.go on lines 2449..2480
                  api/logbroker.pb.go on lines 1722..1753
                  api/logbroker.pb.go on lines 1845..1876
                  api/raft.pb.go on lines 2092..2123
                  api/raft.pb.go on lines 2291..2322
                  api/resource.pb.go on lines 570..601
                  api/watch.pb.go on lines 2155..2186

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

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

                  func (p *raftProxyHealthServer) Check(ctx context.Context, r *HealthCheckRequest) (*HealthCheckResponse, error) {
                  
                      conn, err := p.connSelector.LeaderConn(ctx)
                      if err != nil {
                          if err == raftselector.ErrIsLeader {
                  Severity: Major
                  Found in api/health.pb.go and 13 other locations - About 4 hrs to fix
                  api/ca.pb.go on lines 1160..1193
                  api/ca.pb.go on lines 1195..1228
                  api/ca.pb.go on lines 1302..1335
                  api/ca.pb.go on lines 1337..1370
                  api/dispatcher.pb.go on lines 2566..2599
                  api/dispatcher.pb.go on lines 2601..2634
                  api/dispatcher.pb.go on lines 2636..2669
                  api/raft.pb.go on lines 2158..2191
                  api/raft.pb.go on lines 2250..2283
                  api/raft.pb.go on lines 2357..2390
                  api/raft.pb.go on lines 2392..2425
                  api/resource.pb.go on lines 636..669
                  api/resource.pb.go on lines 671..704

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

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

                  func _Health_Check_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
                      in := new(HealthCheckRequest)
                      if err := dec(in); err != nil {
                          return nil, err
                      }
                  Severity: Major
                  Found in api/health.pb.go and 13 other locations - About 2 hrs to fix
                  api/ca.pb.go on lines 640..656
                  api/ca.pb.go on lines 658..674
                  api/ca.pb.go on lines 748..764
                  api/ca.pb.go on lines 766..782
                  api/dispatcher.pb.go on lines 1593..1609
                  api/dispatcher.pb.go on lines 1611..1627
                  api/dispatcher.pb.go on lines 1629..1645
                  api/raft.pb.go on lines 1225..1241
                  api/raft.pb.go on lines 1269..1285
                  api/raft.pb.go on lines 1369..1385
                  api/raft.pb.go on lines 1387..1403
                  api/resource.pb.go on lines 374..390
                  api/resource.pb.go on lines 392..408

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

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

                  func (m *HealthCheckRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
                      i := len(dAtA)
                      _ = i
                      var l int
                      _ = l
                  Severity: Major
                  Found in api/health.pb.go and 10 other locations - About 1 hr to fix
                  api/ca.pb.go on lines 816..829
                  api/ca.pb.go on lines 998..1011
                  api/dispatcher.pb.go on lines 1860..1873
                  api/dispatcher.pb.go on lines 2137..2150
                  api/dispatcher.pb.go on lines 2204..2217
                  api/raft.pb.go on lines 1489..1502
                  api/raft.pb.go on lines 1770..1783
                  api/resource.pb.go on lines 484..497
                  api/resource.pb.go on lines 514..527
                  api/specs.pb.go on lines 2804..2817

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

                  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 *HealthCheckResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
                      i := len(dAtA)
                      _ = i
                      var l int
                      _ = l
                  Severity: Major
                  Found in api/health.pb.go and 2 other locations - About 50 mins to fix
                  api/raft.pb.go on lines 1742..1753
                  api/specs.pb.go on lines 2444..2455

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

                  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) runCtxMods(ctx context.Context, ctxMods []func(context.Context) (context.Context, error)) (context.Context, error) {
                      var err error
                      for _, mod := range ctxMods {
                          ctx, err = mod(ctx)
                          if err != nil {
                  Severity: Major
                  Found in api/health.pb.go and 9 other locations - About 50 mins to fix
                  api/ca.pb.go on lines 1126..1135
                  api/ca.pb.go on lines 1268..1277
                  api/dispatcher.pb.go on lines 2481..2490
                  api/logbroker.pb.go on lines 1754..1763
                  api/logbroker.pb.go on lines 1877..1886
                  api/raft.pb.go on lines 2124..2133
                  api/raft.pb.go on lines 2323..2332
                  api/resource.pb.go on lines 602..611
                  api/watch.pb.go on lines 2187..2196

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

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

                  func (m *HealthCheckRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
                      if deterministic {
                          return xxx_messageInfo_HealthCheckRequest.Marshal(b, m, deterministic)
                      } else {
                          b = b[:cap(b)]
                  Severity: Major
                  Found in api/health.pb.go and 101 other locations - About 45 mins to fix
                  api/ca.pb.go on lines 50..61
                  api/ca.pb.go on lines 87..98
                  api/ca.pb.go on lines 131..142
                  api/ca.pb.go on lines 168..179
                  api/ca.pb.go on lines 203..214
                  api/ca.pb.go on lines 239..250
                  api/ca.pb.go on lines 274..285
                  api/ca.pb.go on lines 311..322
                  api/dispatcher.pb.go on lines 112..123
                  api/dispatcher.pb.go on lines 202..213
                  api/dispatcher.pb.go on lines 239..250
                  api/dispatcher.pb.go on lines 277..288
                  api/dispatcher.pb.go on lines 316..327
                  api/dispatcher.pb.go on lines 355..366
                  api/dispatcher.pb.go on lines 390..401
                  api/dispatcher.pb.go on lines 427..438
                  api/dispatcher.pb.go on lines 476..487
                  api/dispatcher.pb.go on lines 511..522
                  api/dispatcher.pb.go on lines 547..558
                  api/dispatcher.pb.go on lines 585..596
                  api/dispatcher.pb.go on lines 621..632
                  api/dispatcher.pb.go on lines 662..673
                  api/dispatcher.pb.go on lines 768..779
                  api/dispatcher.pb.go on lines 816..827
                  api/health.pb.go on lines 113..124
                  api/logbroker.pb.go on lines 105..116
                  api/logbroker.pb.go on lines 148..159
                  api/logbroker.pb.go on lines 187..198
                  api/logbroker.pb.go on lines 225..236
                  api/logbroker.pb.go on lines 273..284
                  api/logbroker.pb.go on lines 311..322
                  api/logbroker.pb.go on lines 347..358
                  api/logbroker.pb.go on lines 384..395
                  api/logbroker.pb.go on lines 432..443
                  api/logbroker.pb.go on lines 477..488
                  api/logbroker.pb.go on lines 512..523
                  api/objects.pb.go on lines 51..62
                  api/objects.pb.go on lines 123..134
                  api/objects.pb.go on lines 190..201
                  api/objects.pb.go on lines 235..246
                  api/objects.pb.go on lines 283..294
                  api/objects.pb.go on lines 382..393
                  api/objects.pb.go on lines 430..441
                  api/objects.pb.go on lines 486..497
                  api/objects.pb.go on lines 558..569
                  api/objects.pb.go on lines 602..613
                  api/objects.pb.go on lines 644..655
                  api/objects.pb.go on lines 692..703
                  api/objects.pb.go on lines 733..744
                  api/objects.pb.go on lines 790..801
                  api/raft.pb.go on lines 90..101
                  api/raft.pb.go on lines 127..138
                  api/raft.pb.go on lines 169..180
                  api/raft.pb.go on lines 205..216
                  api/raft.pb.go on lines 240..251
                  api/raft.pb.go on lines 276..287
                  api/raft.pb.go on lines 311..322
                  api/raft.pb.go on lines 348..359
                  api/raft.pb.go on lines 384..395
                  api/raft.pb.go on lines 421..432
                  api/raft.pb.go on lines 458..469
                  api/raft.pb.go on lines 498..509
                  api/raft.pb.go on lines 547..558
                  api/resource.pb.go on lines 51..62
                  api/resource.pb.go on lines 87..98
                  api/resource.pb.go on lines 123..134
                  api/resource.pb.go on lines 158..169
                  api/snapshot.pb.go on lines 73..84
                  api/snapshot.pb.go on lines 111..122
                  api/snapshot.pb.go on lines 149..160
                  api/specs.pb.go on lines 211..222
                  api/specs.pb.go on lines 274..285
                  api/specs.pb.go on lines 380..391
                  api/specs.pb.go on lines 416..427
                  api/specs.pb.go on lines 461..472
                  api/specs.pb.go on lines 498..509
                  api/specs.pb.go on lines 565..576
                  api/specs.pb.go on lines 659..670
                  api/specs.pb.go on lines 696..707
                  api/specs.pb.go on lines 736..747
                  api/specs.pb.go on lines 888..899
                  api/specs.pb.go on lines 929..940
                  api/specs.pb.go on lines 974..985
                  api/specs.pb.go on lines 1012..1023
                  api/specs.pb.go on lines 1053..1064
                  api/specs.pb.go on lines 1116..1127
                  api/specs.pb.go on lines 1202..1213
                  api/specs.pb.go on lines 1249..1260
                  api/specs.pb.go on lines 1296..1307
                  api/specs.pb.go on lines 1373..1384
                  api/watch.pb.go on lines 95..106
                  api/watch.pb.go on lines 275..286
                  api/watch.pb.go on lines 313..324
                  api/watch.pb.go on lines 370..381
                  api/watch.pb.go on lines 633..644
                  api/watch.pb.go on lines 677..688
                  api/watch.pb.go on lines 719..730
                  api/watch.pb.go on lines 764..775
                  protobuf/plugin/plugin.pb.go on lines 58..69
                  protobuf/plugin/plugin.pb.go on lines 94..105
                  protobuf/plugin/plugin.pb.go on lines 135..146

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

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

                  func (m *HealthCheckResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
                      if deterministic {
                          return xxx_messageInfo_HealthCheckResponse.Marshal(b, m, deterministic)
                      } else {
                          b = b[:cap(b)]
                  Severity: Major
                  Found in api/health.pb.go and 101 other locations - About 45 mins to fix
                  api/ca.pb.go on lines 50..61
                  api/ca.pb.go on lines 87..98
                  api/ca.pb.go on lines 131..142
                  api/ca.pb.go on lines 168..179
                  api/ca.pb.go on lines 203..214
                  api/ca.pb.go on lines 239..250
                  api/ca.pb.go on lines 274..285
                  api/ca.pb.go on lines 311..322
                  api/dispatcher.pb.go on lines 112..123
                  api/dispatcher.pb.go on lines 202..213
                  api/dispatcher.pb.go on lines 239..250
                  api/dispatcher.pb.go on lines 277..288
                  api/dispatcher.pb.go on lines 316..327
                  api/dispatcher.pb.go on lines 355..366
                  api/dispatcher.pb.go on lines 390..401
                  api/dispatcher.pb.go on lines 427..438
                  api/dispatcher.pb.go on lines 476..487
                  api/dispatcher.pb.go on lines 511..522
                  api/dispatcher.pb.go on lines 547..558
                  api/dispatcher.pb.go on lines 585..596
                  api/dispatcher.pb.go on lines 621..632
                  api/dispatcher.pb.go on lines 662..673
                  api/dispatcher.pb.go on lines 768..779
                  api/dispatcher.pb.go on lines 816..827
                  api/health.pb.go on lines 77..88
                  api/logbroker.pb.go on lines 105..116
                  api/logbroker.pb.go on lines 148..159
                  api/logbroker.pb.go on lines 187..198
                  api/logbroker.pb.go on lines 225..236
                  api/logbroker.pb.go on lines 273..284
                  api/logbroker.pb.go on lines 311..322
                  api/logbroker.pb.go on lines 347..358
                  api/logbroker.pb.go on lines 384..395
                  api/logbroker.pb.go on lines 432..443
                  api/logbroker.pb.go on lines 477..488
                  api/logbroker.pb.go on lines 512..523
                  api/objects.pb.go on lines 51..62
                  api/objects.pb.go on lines 123..134
                  api/objects.pb.go on lines 190..201
                  api/objects.pb.go on lines 235..246
                  api/objects.pb.go on lines 283..294
                  api/objects.pb.go on lines 382..393
                  api/objects.pb.go on lines 430..441
                  api/objects.pb.go on lines 486..497
                  api/objects.pb.go on lines 558..569
                  api/objects.pb.go on lines 602..613
                  api/objects.pb.go on lines 644..655
                  api/objects.pb.go on lines 692..703
                  api/objects.pb.go on lines 733..744
                  api/objects.pb.go on lines 790..801
                  api/raft.pb.go on lines 90..101
                  api/raft.pb.go on lines 127..138
                  api/raft.pb.go on lines 169..180
                  api/raft.pb.go on lines 205..216
                  api/raft.pb.go on lines 240..251
                  api/raft.pb.go on lines 276..287
                  api/raft.pb.go on lines 311..322
                  api/raft.pb.go on lines 348..359
                  api/raft.pb.go on lines 384..395
                  api/raft.pb.go on lines 421..432
                  api/raft.pb.go on lines 458..469
                  api/raft.pb.go on lines 498..509
                  api/raft.pb.go on lines 547..558
                  api/resource.pb.go on lines 51..62
                  api/resource.pb.go on lines 87..98
                  api/resource.pb.go on lines 123..134
                  api/resource.pb.go on lines 158..169
                  api/snapshot.pb.go on lines 73..84
                  api/snapshot.pb.go on lines 111..122
                  api/snapshot.pb.go on lines 149..160
                  api/specs.pb.go on lines 211..222
                  api/specs.pb.go on lines 274..285
                  api/specs.pb.go on lines 380..391
                  api/specs.pb.go on lines 416..427
                  api/specs.pb.go on lines 461..472
                  api/specs.pb.go on lines 498..509
                  api/specs.pb.go on lines 565..576
                  api/specs.pb.go on lines 659..670
                  api/specs.pb.go on lines 696..707
                  api/specs.pb.go on lines 736..747
                  api/specs.pb.go on lines 888..899
                  api/specs.pb.go on lines 929..940
                  api/specs.pb.go on lines 974..985
                  api/specs.pb.go on lines 1012..1023
                  api/specs.pb.go on lines 1053..1064
                  api/specs.pb.go on lines 1116..1127
                  api/specs.pb.go on lines 1202..1213
                  api/specs.pb.go on lines 1249..1260
                  api/specs.pb.go on lines 1296..1307
                  api/specs.pb.go on lines 1373..1384
                  api/watch.pb.go on lines 95..106
                  api/watch.pb.go on lines 275..286
                  api/watch.pb.go on lines 313..324
                  api/watch.pb.go on lines 370..381
                  api/watch.pb.go on lines 633..644
                  api/watch.pb.go on lines 677..688
                  api/watch.pb.go on lines 719..730
                  api/watch.pb.go on lines 764..775
                  protobuf/plugin/plugin.pb.go on lines 58..69
                  protobuf/plugin/plugin.pb.go on lines 94..105
                  protobuf/plugin/plugin.pb.go on lines 135..146

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

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

                  func (c *healthClient) Check(ctx context.Context, in *HealthCheckRequest, opts ...grpc.CallOption) (*HealthCheckResponse, error) {
                      out := new(HealthCheckResponse)
                      err := c.cc.Invoke(ctx, "/docker.swarmkit.v1.Health/Check", in, out, opts...)
                      if err != nil {
                          return nil, err
                  Severity: Major
                  Found in api/health.pb.go and 13 other locations - About 35 mins to fix
                  api/ca.pb.go on lines 599..606
                  api/ca.pb.go on lines 608..615
                  api/ca.pb.go on lines 709..716
                  api/ca.pb.go on lines 718..725
                  api/dispatcher.pb.go on lines 1416..1423
                  api/dispatcher.pb.go on lines 1425..1432
                  api/dispatcher.pb.go on lines 1434..1441
                  api/raft.pb.go on lines 1140..1147
                  api/raft.pb.go on lines 1183..1190
                  api/raft.pb.go on lines 1328..1335
                  api/raft.pb.go on lines 1337..1344
                  api/resource.pb.go on lines 335..342
                  api/resource.pb.go on lines 344..351

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

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

                  func encodeVarintHealth(dAtA []byte, offset int, v uint64) int {
                      offset -= sovHealth(v)
                      base := offset
                      for v >= 1<<7 {
                          dAtA[offset] = uint8(v&0x7f | 0x80)
                  Severity: Major
                  Found in api/health.pb.go and 10 other locations - About 35 mins to fix
                  api/ca.pb.go on lines 1076..1086
                  api/dispatcher.pb.go on lines 2431..2441
                  api/logbroker.pb.go on lines 1704..1714
                  api/objects.pb.go on lines 2619..2629
                  api/raft.pb.go on lines 2074..2084
                  api/resource.pb.go on lines 552..562
                  api/snapshot.pb.go on lines 616..626
                  api/specs.pb.go on lines 3784..3794
                  api/watch.pb.go on lines 2137..2147
                  protobuf/plugin/plugin.pb.go on lines 526..536

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

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

                  func (m *HealthCheckRequest) Size() (n int) {
                      if m == nil {
                          return 0
                      }
                      var l int
                  Severity: Major
                  Found in api/health.pb.go and 11 other locations - About 30 mins to fix
                  api/ca.pb.go on lines 1372..1383
                  api/ca.pb.go on lines 1450..1461
                  api/dispatcher.pb.go on lines 2823..2834
                  api/dispatcher.pb.go on lines 2936..2947
                  api/dispatcher.pb.go on lines 2964..2975
                  api/raft.pb.go on lines 2449..2460
                  api/raft.pb.go on lines 2563..2574
                  api/resource.pb.go on lines 723..734
                  api/resource.pb.go on lines 736..747
                  api/specs.pb.go on lines 4054..4065
                  api/specs.pb.go on lines 4217..4228

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

                  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

                  There are no issues that match your filters.

                  Category
                  Status