docker/swarmkit

View on GitHub

Showing 812 of 1,820 total issues

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

func encodeVarintCa(dAtA []byte, offset int, v uint64) int {
    offset -= sovCa(v)
    base := offset
    for v >= 1<<7 {
        dAtA[offset] = uint8(v&0x7f | 0x80)
Severity: Major
Found in api/ca.pb.go and 10 other locations - About 35 mins to fix
api/dispatcher.pb.go on lines 2431..2441
api/health.pb.go on lines 360..370
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 11 locations. Consider refactoring.
Open

func encodeVarintSnapshot(dAtA []byte, offset int, v uint64) int {
    offset -= sovSnapshot(v)
    base := offset
    for v >= 1<<7 {
        dAtA[offset] = uint8(v&0x7f | 0x80)
Severity: Major
Found in api/snapshot.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/health.pb.go on lines 360..370
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/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 2 locations. Consider refactoring.
Open

func (x *raftStreamRaftMessageClient) CloseAndRecv() (*StreamRaftMessageResponse, error) {
    if err := x.ClientStream.CloseSend(); err != nil {
        return nil, err
    }
    m := new(StreamRaftMessageResponse)
Severity: Minor
Found in api/raft.pb.go and 1 other location - About 35 mins to fix
api/logbroker.pb.go on lines 1092..1101

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

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 (x *logBrokerPublishLogsClient) CloseAndRecv() (*PublishLogsResponse, error) {
    if err := x.ClientStream.CloseSend(); err != nil {
        return nil, err
    }
    m := new(PublishLogsResponse)
Severity: Minor
Found in api/logbroker.pb.go and 1 other location - About 35 mins to fix
api/raft.pb.go on lines 1172..1181

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

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 t.Spec.Restart != nil && t.Spec.Restart.Delay != nil {
                var err error
                restartDelay, err = gogotypes.DurationFromProto(t.Spec.Restart.Delay)
                if err != nil {
                    log.G(ctx).WithError(err).Error("invalid restart delay")
Severity: Minor
Found in manager/orchestrator/taskinit/init.go and 1 other location - About 35 mins to fix
manager/orchestrator/restart/restart.go on lines 177..186

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

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 t.Spec.Restart != nil && t.Spec.Restart.Delay != nil {
            var err error
            restartDelay, err = gogotypes.DurationFromProto(t.Spec.Restart.Delay)
            if err != nil {
                log.G(ctx).WithError(err).Error("invalid restart delay; using default")
Severity: Minor
Found in manager/orchestrator/restart/restart.go and 1 other location - About 35 mins to fix
manager/orchestrator/taskinit/init.go on lines 66..73

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

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 resourceEntry) EventUpdate(oldObject api.StoreObject) api.Event {
    if oldObject != nil {
        return api.EventUpdateResource{Resource: r.Resource, OldResource: oldObject.(resourceEntry).Resource}
    }
    return api.EventUpdateResource{Resource: r.Resource}
Severity: Minor
Found in manager/state/store/resources.go and 1 other location - About 35 mins to fix
manager/state/store/extensions.go on lines 74..79

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

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 (e extensionEntry) EventUpdate(oldObject api.StoreObject) api.Event {
    if oldObject != nil {
        return api.EventUpdateExtension{Extension: e.Extension, OldExtension: oldObject.(extensionEntry).Extension}
    }
    return api.EventUpdateExtension{Extension: e.Extension}
Severity: Minor
Found in manager/state/store/extensions.go and 1 other location - About 35 mins to fix
manager/state/store/resources.go on lines 84..89

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

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 spec.Rollback == nil {
        spec.Rollback = Service.Rollback.Copy()
    } else {
        if spec.Rollback.Monitor == nil {
            spec.Rollback.Monitor = &gogotypes.Duration{}
Severity: Minor
Found in api/defaults/service.go and 1 other location - About 35 mins to fix
api/defaults/service.go on lines 80..87

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

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 spec.Update == nil {
        spec.Update = Service.Update.Copy()
    } else {
        if spec.Update.Monitor == nil {
            spec.Update.Monitor = &gogotypes.Duration{}
Severity: Minor
Found in api/defaults/service.go and 1 other location - About 35 mins to fix
api/defaults/service.go on lines 89..96

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

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 *AttachNetworkResponse) Size() (n int) {
    if m == nil {
        return 0
    }
    var l int
Severity: Major
Found in api/resource.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/health.pb.go on lines 479..490
api/raft.pb.go on lines 2449..2460
api/raft.pb.go on lines 2563..2574
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

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

func (m *TLSAuthorization) CopyFrom(src interface{}) {

    o := src.(*TLSAuthorization)
    *m = *o
    if o.Roles != nil {
Severity: Minor
Found in protobuf/plugin/plugin.pb.go and 2 other locations - About 30 mins to fix
api/ca.pb.go on lines 489..497
api/ca.pb.go on lines 533..541

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

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

func (m *ResolveAddressResponse) Size() (n int) {
    if m == nil {
        return 0
    }
    var l int
Severity: Major
Found in api/raft.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/health.pb.go on lines 479..490
api/raft.pb.go on lines 2449..2460
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

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

func (m *GetRootCACertificateResponse) CopyFrom(src interface{}) {

    o := src.(*GetRootCACertificateResponse)
    *m = *o
    if o.Certificate != nil {
Severity: Minor
Found in api/ca.pb.go and 2 other locations - About 30 mins to fix
api/ca.pb.go on lines 489..497
protobuf/plugin/plugin.pb.go on lines 283..292

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

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

func (m *TasksRequest) Size() (n int) {
    if m == nil {
        return 0
    }
    var l int
Severity: Major
Found in api/dispatcher.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 2964..2975
api/health.pb.go on lines 479..490
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

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

func (m *AssignmentsRequest) Size() (n int) {
    if m == nil {
        return 0
    }
    var l int
Severity: Major
Found in api/dispatcher.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/health.pb.go on lines 479..490
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

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

func (m *DetachNetworkRequest) Size() (n int) {
    if m == nil {
        return 0
    }
    var l int
Severity: Major
Found in api/resource.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/health.pb.go on lines 479..490
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/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

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

func (m *JoinRequest) Size() (n int) {
    if m == nil {
        return 0
    }
    var l int
Severity: Major
Found in api/raft.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/health.pb.go on lines 479..490
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

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

func (m *NodeCertificateStatusRequest) Size() (n int) {
    if m == nil {
        return 0
    }
    var l int
Severity: Major
Found in api/ca.pb.go and 11 other locations - About 30 mins to fix
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/health.pb.go on lines 479..490
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

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

Severity
Category
Status
Source
Language