docker/swarmkit

View on GitHub

Showing 812 of 1,820 total issues

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

func (m *Object_Network) MarshalToSizedBuffer(dAtA []byte) (int, error) {
    i := len(dAtA)
    if m.Network != nil {
        {
            size, err := m.Network.MarshalToSizedBuffer(dAtA[:i])
Severity: Major
Found in api/watch.pb.go and 33 other locations - About 1 hr to fix
api/dispatcher.pb.go on lines 2256..2271
api/dispatcher.pb.go on lines 2277..2292
api/dispatcher.pb.go on lines 2298..2313
api/dispatcher.pb.go on lines 2319..2334
api/raft.pb.go on lines 1869..1884
api/raft.pb.go on lines 1890..1905
api/raft.pb.go on lines 1911..1926
api/raft.pb.go on lines 1932..1947
api/raft.pb.go on lines 1953..1968
api/raft.pb.go on lines 1974..1989
api/raft.pb.go on lines 1995..2010
api/raft.pb.go on lines 2016..2031
api/raft.pb.go on lines 2037..2052
api/raft.pb.go on lines 2058..2073
api/specs.pb.go on lines 2355..2370
api/specs.pb.go on lines 2376..2391
api/specs.pb.go on lines 2397..2412
api/specs.pb.go on lines 2418..2433
api/specs.pb.go on lines 2659..2674
api/specs.pb.go on lines 2680..2695
api/specs.pb.go on lines 2701..2716
api/watch.pb.go on lines 1371..1386
api/watch.pb.go on lines 1392..1407
api/watch.pb.go on lines 1434..1449
api/watch.pb.go on lines 1455..1470
api/watch.pb.go on lines 1476..1491
api/watch.pb.go on lines 1497..1512
api/watch.pb.go on lines 1518..1533
api/watch.pb.go on lines 1539..1554
api/watch.pb.go on lines 1560..1575
api/watch.pb.go on lines 1748..1763
api/watch.pb.go on lines 1769..1784
api/watch.pb.go on lines 1818..1833

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

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

func (m *Object_Extension) MarshalToSizedBuffer(dAtA []byte) (int, error) {
    i := len(dAtA)
    if m.Extension != nil {
        {
            size, err := m.Extension.MarshalToSizedBuffer(dAtA[:i])
Severity: Major
Found in api/watch.pb.go and 33 other locations - About 1 hr to fix
api/dispatcher.pb.go on lines 2256..2271
api/dispatcher.pb.go on lines 2277..2292
api/dispatcher.pb.go on lines 2298..2313
api/dispatcher.pb.go on lines 2319..2334
api/raft.pb.go on lines 1869..1884
api/raft.pb.go on lines 1890..1905
api/raft.pb.go on lines 1911..1926
api/raft.pb.go on lines 1932..1947
api/raft.pb.go on lines 1953..1968
api/raft.pb.go on lines 1974..1989
api/raft.pb.go on lines 1995..2010
api/raft.pb.go on lines 2016..2031
api/raft.pb.go on lines 2037..2052
api/raft.pb.go on lines 2058..2073
api/specs.pb.go on lines 2355..2370
api/specs.pb.go on lines 2376..2391
api/specs.pb.go on lines 2397..2412
api/specs.pb.go on lines 2418..2433
api/specs.pb.go on lines 2659..2674
api/specs.pb.go on lines 2680..2695
api/specs.pb.go on lines 2701..2716
api/watch.pb.go on lines 1371..1386
api/watch.pb.go on lines 1392..1407
api/watch.pb.go on lines 1413..1428
api/watch.pb.go on lines 1434..1449
api/watch.pb.go on lines 1455..1470
api/watch.pb.go on lines 1476..1491
api/watch.pb.go on lines 1497..1512
api/watch.pb.go on lines 1539..1554
api/watch.pb.go on lines 1560..1575
api/watch.pb.go on lines 1748..1763
api/watch.pb.go on lines 1769..1784
api/watch.pb.go on lines 1818..1833

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

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

        case 10:
            if wireType != 0 {
                return fmt.Errorf("proto: wrong wireType = %d for field FIPS", wireType)
            }
            var v int
Severity: Major
Found in api/objects.pb.go and 16 other locations - About 1 hr to fix
api/dispatcher.pb.go on lines 4298..4317
api/logbroker.pb.go on lines 2485..2504
api/logbroker.pb.go on lines 3582..3601
api/logbroker.pb.go on lines 3718..3737
api/objects.pb.go on lines 7083..7102
api/objects.pb.go on lines 8571..8590
api/objects.pb.go on lines 9226..9245
api/objects.pb.go on lines 10008..10027
api/specs.pb.go on lines 6898..6917
api/specs.pb.go on lines 7054..7073
api/specs.pb.go on lines 7074..7093
api/specs.pb.go on lines 8084..8103
api/specs.pb.go on lines 8104..8123
api/specs.pb.go on lines 8160..8179
api/specs.pb.go on lines 8180..8199
api/watch.pb.go on lines 4359..4378

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

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

        case 13:
            if wireType != 0 {
                return fmt.Errorf("proto: wrong wireType = %d for field TTY", wireType)
            }
            var v int
Severity: Major
Found in api/specs.pb.go and 16 other locations - About 1 hr to fix
api/dispatcher.pb.go on lines 4298..4317
api/logbroker.pb.go on lines 2485..2504
api/logbroker.pb.go on lines 3582..3601
api/logbroker.pb.go on lines 3718..3737
api/objects.pb.go on lines 7083..7102
api/objects.pb.go on lines 8571..8590
api/objects.pb.go on lines 8988..9007
api/objects.pb.go on lines 9226..9245
api/objects.pb.go on lines 10008..10027
api/specs.pb.go on lines 7054..7073
api/specs.pb.go on lines 7074..7093
api/specs.pb.go on lines 8084..8103
api/specs.pb.go on lines 8104..8123
api/specs.pb.go on lines 8160..8179
api/specs.pb.go on lines 8180..8199
api/watch.pb.go on lines 4359..4378

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

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

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

    o := src.(*NodeCertificateStatusResponse)
    *m = *o
    if o.Status != nil {
Severity: Major
Found in api/ca.pb.go and 3 other locations - About 1 hr to fix
api/logbroker.pb.go on lines 793..805
api/logbroker.pb.go on lines 848..860
api/watch.pb.go on lines 1203..1215

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

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

func filterClusters(candidates []*api.Cluster, filters ...func(*api.Cluster) bool) []*api.Cluster {
    result := []*api.Cluster{}

    for _, c := range candidates {
        match := true
Severity: Major
Found in manager/controlapi/cluster.go and 5 other locations - About 1 hr to fix
manager/controlapi/network.go on lines 236..253
manager/controlapi/node.go on lines 59..76
manager/controlapi/service.go on lines 960..977
manager/controlapi/task.go on lines 55..72
manager/controlapi/volume.go on lines 204..220

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

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

func filterServices(candidates []*api.Service, filters ...func(*api.Service) bool) []*api.Service {
    result := []*api.Service{}

    for _, c := range candidates {
        match := true
Severity: Major
Found in manager/controlapi/service.go and 5 other locations - About 1 hr to fix
manager/controlapi/cluster.go on lines 186..203
manager/controlapi/network.go on lines 236..253
manager/controlapi/node.go on lines 59..76
manager/controlapi/task.go on lines 55..72
manager/controlapi/volume.go on lines 204..220

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

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

func filterNodes(candidates []*api.Node, filters ...func(*api.Node) bool) []*api.Node {
    result := []*api.Node{}

    for _, c := range candidates {
        match := true
Severity: Major
Found in manager/controlapi/node.go and 5 other locations - About 1 hr to fix
manager/controlapi/cluster.go on lines 186..203
manager/controlapi/network.go on lines 236..253
manager/controlapi/service.go on lines 960..977
manager/controlapi/task.go on lines 55..72
manager/controlapi/volume.go on lines 204..220

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

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

        case 10:
            if wireType != 0 {
                return fmt.Errorf("proto: wrong wireType = %d for field DesiredState", wireType)
            }
            var v TaskState
Severity: Major
Found in api/watch.pb.go and 2 other locations - About 1 hr to fix
api/watch.pb.go on lines 4071..4090
api/watch.pb.go on lines 4091..4110

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

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

        case 12:
            if wireType != 0 {
                return fmt.Errorf("proto: wrong wireType = %d for field Membership", wireType)
            }
            var v NodeSpec_Membership
Severity: Major
Found in api/watch.pb.go and 2 other locations - About 1 hr to fix
api/watch.pb.go on lines 4051..4070
api/watch.pb.go on lines 4071..4090

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

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

func filterTasks(candidates []*api.Task, filters ...func(*api.Task) bool) []*api.Task {
    result := []*api.Task{}

    for _, c := range candidates {
        match := true
Severity: Major
Found in manager/controlapi/task.go and 5 other locations - About 1 hr to fix
manager/controlapi/cluster.go on lines 186..203
manager/controlapi/network.go on lines 236..253
manager/controlapi/node.go on lines 59..76
manager/controlapi/service.go on lines 960..977
manager/controlapi/volume.go on lines 204..220

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

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

func filterNetworks(candidates []*api.Network, filters ...func(*api.Network) bool) []*api.Network {
    result := []*api.Network{}

    for _, c := range candidates {
        match := true
Severity: Major
Found in manager/controlapi/network.go and 5 other locations - About 1 hr to fix
manager/controlapi/cluster.go on lines 186..203
manager/controlapi/node.go on lines 59..76
manager/controlapi/service.go on lines 960..977
manager/controlapi/task.go on lines 55..72
manager/controlapi/volume.go on lines 204..220

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

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

        case 11:
            if wireType != 0 {
                return fmt.Errorf("proto: wrong wireType = %d for field Role", wireType)
            }
            var v NodeRole
Severity: Major
Found in api/watch.pb.go and 2 other locations - About 1 hr to fix
api/watch.pb.go on lines 4051..4070
api/watch.pb.go on lines 4091..4110

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

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

func filterVolumes(candidates []*api.Volume, filters ...func(*api.Volume) bool) []*api.Volume {
    result := []*api.Volume{}
    for _, c := range candidates {
        match := true
        for _, f := range filters {
Severity: Major
Found in manager/controlapi/volume.go and 5 other locations - About 1 hr to fix
manager/controlapi/cluster.go on lines 186..203
manager/controlapi/network.go on lines 236..253
manager/controlapi/node.go on lines 59..76
manager/controlapi/service.go on lines 960..977
manager/controlapi/task.go on lines 55..72

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

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

    if len(m.Hosts) > 0 {
        for iNdEx := len(m.Hosts) - 1; iNdEx >= 0; iNdEx-- {
            i -= len(m.Hosts[iNdEx])
            copy(dAtA[i:], m.Hosts[iNdEx])
            i = encodeVarintSpecs(dAtA, i, uint64(len(m.Hosts[iNdEx])))
Severity: Major
Found in api/specs.pb.go and 2 other locations - About 1 hr to fix
api/specs.pb.go on lines 2867..2877
api/specs.pb.go on lines 2878..2888

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

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

    if len(m.CapabilityAdd) > 0 {
        for iNdEx := len(m.CapabilityAdd) - 1; iNdEx >= 0; iNdEx-- {
            i -= len(m.CapabilityAdd[iNdEx])
            copy(dAtA[i:], m.CapabilityAdd[iNdEx])
            i = encodeVarintSpecs(dAtA, i, uint64(len(m.CapabilityAdd[iNdEx])))
Severity: Major
Found in api/specs.pb.go and 2 other locations - About 1 hr to fix
api/specs.pb.go on lines 2867..2877
api/specs.pb.go on lines 3001..3011

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

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

    if len(m.CapabilityDrop) > 0 {
        for iNdEx := len(m.CapabilityDrop) - 1; iNdEx >= 0; iNdEx-- {
            i -= len(m.CapabilityDrop[iNdEx])
            copy(dAtA[i:], m.CapabilityDrop[iNdEx])
            i = encodeVarintSpecs(dAtA, i, uint64(len(m.CapabilityDrop[iNdEx])))
Severity: Major
Found in api/specs.pb.go and 2 other locations - About 1 hr to fix
api/specs.pb.go on lines 2878..2888
api/specs.pb.go on lines 3001..3011

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

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

    if flags.Changed("cpu-reservation") {
        if spec.Task.Resources == nil {
            spec.Task.Resources = &api.ResourceRequirements{}
        }
        if spec.Task.Resources.Reservations == nil {
Severity: Major
Found in swarmd/cmd/swarmctl/service/flagparser/resource.go and 3 other locations - About 1 hr to fix
swarmd/cmd/swarmctl/service/flagparser/resource.go on lines 47..57
swarmd/cmd/swarmctl/service/flagparser/resource.go on lines 59..69
swarmd/cmd/swarmctl/service/flagparser/resource.go on lines 83..93

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

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

func (m *ResourceReference) Size() (n int) {
    if m == nil {
        return 0
    }
    var l int
Severity: Major
Found in api/specs.pb.go and 2 other locations - About 1 hr to fix
api/ca.pb.go on lines 1425..1439
api/watch.pb.go on lines 2404..2418

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

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

    suite.NoError(s.Update(func(tx store.Tx) error {
        t6 := &api.Task{
            ID: "testTaskID6",
            Status: api.TaskStatus{
                State: api.TaskStateNew,
Severity: Major
Found in manager/allocator/allocator_test_suite.go and 1 other location - About 1 hr to fix
manager/allocator/allocator_test_suite.go on lines 369..384

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

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