docker/docker

View on GitHub

Showing 443 of 1,855 total issues

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

        case 1:
            if wireType != 2 {
                return fmt.Errorf("proto: wrong wireType = %d for field Source", wireType)
            }
            var stringLen uint64
Severity: Major
Found in api/types/plugins/logdriver/entry.pb.go and 25 other locations - About 2 hrs to fix
api/types/plugins/logdriver/entry.pb.go on lines 600..631
api/types/swarm/runtime/plugin.pb.go on lines 408..439
api/types/swarm/runtime/plugin.pb.go on lines 440..471
api/types/swarm/runtime/plugin.pb.go on lines 608..639
api/types/swarm/runtime/plugin.pb.go on lines 640..671
libnetwork/agent.pb.go on lines 647..678
libnetwork/agent.pb.go on lines 679..710
libnetwork/agent.pb.go on lines 711..742
libnetwork/agent.pb.go on lines 743..774
libnetwork/agent.pb.go on lines 775..806
libnetwork/agent.pb.go on lines 975..1006
libnetwork/drivers/overlay/overlay.pb.go on lines 272..303
libnetwork/drivers/overlay/overlay.pb.go on lines 304..335
libnetwork/drivers/overlay/overlay.pb.go on lines 336..367
libnetwork/networkdb/networkdb.pb.go on lines 1891..1922
libnetwork/networkdb/networkdb.pb.go on lines 2011..2042
libnetwork/networkdb/networkdb.pb.go on lines 2043..2074
libnetwork/networkdb/networkdb.pb.go on lines 2125..2156
libnetwork/networkdb/networkdb.pb.go on lines 2176..2207
libnetwork/networkdb/networkdb.pb.go on lines 2331..2362
libnetwork/networkdb/networkdb.pb.go on lines 2451..2482
libnetwork/networkdb/networkdb.pb.go on lines 2483..2514
libnetwork/networkdb/networkdb.pb.go on lines 2515..2546
libnetwork/networkdb/networkdb.pb.go on lines 2547..2578
libnetwork/networkdb/networkdb.pb.go on lines 2721..2752

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

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

        case 2:
            if wireType != 2 {
                return fmt.Errorf("proto: wrong wireType = %d for field ServiceName", wireType)
            }
            var stringLen uint64
Severity: Major
Found in libnetwork/agent.pb.go and 25 other locations - About 2 hrs to fix
api/types/plugins/logdriver/entry.pb.go on lines 389..420
api/types/plugins/logdriver/entry.pb.go on lines 600..631
api/types/swarm/runtime/plugin.pb.go on lines 408..439
api/types/swarm/runtime/plugin.pb.go on lines 440..471
api/types/swarm/runtime/plugin.pb.go on lines 608..639
api/types/swarm/runtime/plugin.pb.go on lines 640..671
libnetwork/agent.pb.go on lines 647..678
libnetwork/agent.pb.go on lines 711..742
libnetwork/agent.pb.go on lines 743..774
libnetwork/agent.pb.go on lines 775..806
libnetwork/agent.pb.go on lines 975..1006
libnetwork/drivers/overlay/overlay.pb.go on lines 272..303
libnetwork/drivers/overlay/overlay.pb.go on lines 304..335
libnetwork/drivers/overlay/overlay.pb.go on lines 336..367
libnetwork/networkdb/networkdb.pb.go on lines 1891..1922
libnetwork/networkdb/networkdb.pb.go on lines 2011..2042
libnetwork/networkdb/networkdb.pb.go on lines 2043..2074
libnetwork/networkdb/networkdb.pb.go on lines 2125..2156
libnetwork/networkdb/networkdb.pb.go on lines 2176..2207
libnetwork/networkdb/networkdb.pb.go on lines 2331..2362
libnetwork/networkdb/networkdb.pb.go on lines 2451..2482
libnetwork/networkdb/networkdb.pb.go on lines 2483..2514
libnetwork/networkdb/networkdb.pb.go on lines 2515..2546
libnetwork/networkdb/networkdb.pb.go on lines 2547..2578
libnetwork/networkdb/networkdb.pb.go on lines 2721..2752

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

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

        case 3:
            if wireType != 2 {
                return fmt.Errorf("proto: wrong wireType = %d for field NodeName", wireType)
            }
            var stringLen uint64
Severity: Major
Found in libnetwork/networkdb/networkdb.pb.go and 25 other locations - About 2 hrs to fix
api/types/plugins/logdriver/entry.pb.go on lines 389..420
api/types/plugins/logdriver/entry.pb.go on lines 600..631
api/types/swarm/runtime/plugin.pb.go on lines 408..439
api/types/swarm/runtime/plugin.pb.go on lines 440..471
api/types/swarm/runtime/plugin.pb.go on lines 608..639
api/types/swarm/runtime/plugin.pb.go on lines 640..671
libnetwork/agent.pb.go on lines 647..678
libnetwork/agent.pb.go on lines 679..710
libnetwork/agent.pb.go on lines 711..742
libnetwork/agent.pb.go on lines 743..774
libnetwork/agent.pb.go on lines 775..806
libnetwork/agent.pb.go on lines 975..1006
libnetwork/drivers/overlay/overlay.pb.go on lines 272..303
libnetwork/drivers/overlay/overlay.pb.go on lines 304..335
libnetwork/drivers/overlay/overlay.pb.go on lines 336..367
libnetwork/networkdb/networkdb.pb.go on lines 1891..1922
libnetwork/networkdb/networkdb.pb.go on lines 2011..2042
libnetwork/networkdb/networkdb.pb.go on lines 2043..2074
libnetwork/networkdb/networkdb.pb.go on lines 2125..2156
libnetwork/networkdb/networkdb.pb.go on lines 2331..2362
libnetwork/networkdb/networkdb.pb.go on lines 2451..2482
libnetwork/networkdb/networkdb.pb.go on lines 2483..2514
libnetwork/networkdb/networkdb.pb.go on lines 2515..2546
libnetwork/networkdb/networkdb.pb.go on lines 2547..2578
libnetwork/networkdb/networkdb.pb.go on lines 2721..2752

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

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

        case 3:
            if wireType != 2 {
                return fmt.Errorf("proto: wrong wireType = %d for field NodeName", wireType)
            }
            var stringLen uint64
Severity: Major
Found in libnetwork/networkdb/networkdb.pb.go and 25 other locations - About 2 hrs to fix
api/types/plugins/logdriver/entry.pb.go on lines 389..420
api/types/plugins/logdriver/entry.pb.go on lines 600..631
api/types/swarm/runtime/plugin.pb.go on lines 408..439
api/types/swarm/runtime/plugin.pb.go on lines 440..471
api/types/swarm/runtime/plugin.pb.go on lines 608..639
api/types/swarm/runtime/plugin.pb.go on lines 640..671
libnetwork/agent.pb.go on lines 647..678
libnetwork/agent.pb.go on lines 679..710
libnetwork/agent.pb.go on lines 711..742
libnetwork/agent.pb.go on lines 743..774
libnetwork/agent.pb.go on lines 775..806
libnetwork/agent.pb.go on lines 975..1006
libnetwork/drivers/overlay/overlay.pb.go on lines 272..303
libnetwork/drivers/overlay/overlay.pb.go on lines 304..335
libnetwork/drivers/overlay/overlay.pb.go on lines 336..367
libnetwork/networkdb/networkdb.pb.go on lines 1891..1922
libnetwork/networkdb/networkdb.pb.go on lines 2011..2042
libnetwork/networkdb/networkdb.pb.go on lines 2043..2074
libnetwork/networkdb/networkdb.pb.go on lines 2125..2156
libnetwork/networkdb/networkdb.pb.go on lines 2176..2207
libnetwork/networkdb/networkdb.pb.go on lines 2331..2362
libnetwork/networkdb/networkdb.pb.go on lines 2483..2514
libnetwork/networkdb/networkdb.pb.go on lines 2515..2546
libnetwork/networkdb/networkdb.pb.go on lines 2547..2578
libnetwork/networkdb/networkdb.pb.go on lines 2721..2752

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

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

        case 4:
            if wireType != 2 {
                return fmt.Errorf("proto: wrong wireType = %d for field VirtualIP", wireType)
            }
            var stringLen uint64
Severity: Major
Found in libnetwork/agent.pb.go and 25 other locations - About 2 hrs to fix
api/types/plugins/logdriver/entry.pb.go on lines 389..420
api/types/plugins/logdriver/entry.pb.go on lines 600..631
api/types/swarm/runtime/plugin.pb.go on lines 408..439
api/types/swarm/runtime/plugin.pb.go on lines 440..471
api/types/swarm/runtime/plugin.pb.go on lines 608..639
api/types/swarm/runtime/plugin.pb.go on lines 640..671
libnetwork/agent.pb.go on lines 647..678
libnetwork/agent.pb.go on lines 679..710
libnetwork/agent.pb.go on lines 711..742
libnetwork/agent.pb.go on lines 775..806
libnetwork/agent.pb.go on lines 975..1006
libnetwork/drivers/overlay/overlay.pb.go on lines 272..303
libnetwork/drivers/overlay/overlay.pb.go on lines 304..335
libnetwork/drivers/overlay/overlay.pb.go on lines 336..367
libnetwork/networkdb/networkdb.pb.go on lines 1891..1922
libnetwork/networkdb/networkdb.pb.go on lines 2011..2042
libnetwork/networkdb/networkdb.pb.go on lines 2043..2074
libnetwork/networkdb/networkdb.pb.go on lines 2125..2156
libnetwork/networkdb/networkdb.pb.go on lines 2176..2207
libnetwork/networkdb/networkdb.pb.go on lines 2331..2362
libnetwork/networkdb/networkdb.pb.go on lines 2451..2482
libnetwork/networkdb/networkdb.pb.go on lines 2483..2514
libnetwork/networkdb/networkdb.pb.go on lines 2515..2546
libnetwork/networkdb/networkdb.pb.go on lines 2547..2578
libnetwork/networkdb/networkdb.pb.go on lines 2721..2752

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

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

        case 2:
            if wireType != 2 {
                return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType)
            }
            var stringLen uint64
Severity: Major
Found in api/types/swarm/runtime/plugin.pb.go and 25 other locations - About 2 hrs to fix
api/types/plugins/logdriver/entry.pb.go on lines 389..420
api/types/plugins/logdriver/entry.pb.go on lines 600..631
api/types/swarm/runtime/plugin.pb.go on lines 408..439
api/types/swarm/runtime/plugin.pb.go on lines 440..471
api/types/swarm/runtime/plugin.pb.go on lines 608..639
libnetwork/agent.pb.go on lines 647..678
libnetwork/agent.pb.go on lines 679..710
libnetwork/agent.pb.go on lines 711..742
libnetwork/agent.pb.go on lines 743..774
libnetwork/agent.pb.go on lines 775..806
libnetwork/agent.pb.go on lines 975..1006
libnetwork/drivers/overlay/overlay.pb.go on lines 272..303
libnetwork/drivers/overlay/overlay.pb.go on lines 304..335
libnetwork/drivers/overlay/overlay.pb.go on lines 336..367
libnetwork/networkdb/networkdb.pb.go on lines 1891..1922
libnetwork/networkdb/networkdb.pb.go on lines 2011..2042
libnetwork/networkdb/networkdb.pb.go on lines 2043..2074
libnetwork/networkdb/networkdb.pb.go on lines 2125..2156
libnetwork/networkdb/networkdb.pb.go on lines 2176..2207
libnetwork/networkdb/networkdb.pb.go on lines 2331..2362
libnetwork/networkdb/networkdb.pb.go on lines 2451..2482
libnetwork/networkdb/networkdb.pb.go on lines 2483..2514
libnetwork/networkdb/networkdb.pb.go on lines 2515..2546
libnetwork/networkdb/networkdb.pb.go on lines 2547..2578
libnetwork/networkdb/networkdb.pb.go on lines 2721..2752

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

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 SecretReferencesFromGRPC(s []*swarmapi.SecretReference) []*swarmtypes.SecretReference {
    refs := []*swarmtypes.SecretReference{}

    for _, r := range s {
        ref := &swarmtypes.SecretReference{
Severity: Major
Found in daemon/cluster/convert/secret.go and 1 other location - About 2 hrs to fix
daemon/cluster/convert/config.go on lines 56..78

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

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 ConfigReferencesFromGRPC(s []*swarmapi.ConfigReference) []*swarmtypes.ConfigReference {
    refs := []*swarmtypes.ConfigReference{}

    for _, r := range s {
        ref := &swarmtypes.ConfigReference{
Severity: Major
Found in daemon/cluster/convert/config.go and 1 other location - About 2 hrs to fix
daemon/cluster/convert/secret.go on lines 58..80

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

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 (this *PortConfig) GoString() string {
    if this == nil {
        return "nil"
    }
    s := make([]string, 0, 8)
Severity: Major
Found in libnetwork/agent.pb.go and 2 other locations - About 2 hrs to fix
libnetwork/networkdb/networkdb.pb.go on lines 851..863
libnetwork/networkdb/networkdb.pb.go on lines 864..876

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

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 (this *NetworkEvent) GoString() string {
    if this == nil {
        return "nil"
    }
    s := make([]string, 0, 8)
Severity: Major
Found in libnetwork/networkdb/networkdb.pb.go and 2 other locations - About 2 hrs to fix
libnetwork/agent.pb.go on lines 319..331
libnetwork/networkdb/networkdb.pb.go on lines 864..876

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

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

type SecretAPIClient interface {
    SecretList(ctx context.Context, options types.SecretListOptions) ([]swarm.Secret, error)
    SecretCreate(ctx context.Context, secret swarm.SecretSpec) (types.SecretCreateResponse, error)
    SecretRemove(ctx context.Context, id string) error
    SecretInspectWithRaw(ctx context.Context, name string) (swarm.Secret, []byte, error)
Severity: Major
Found in client/interface.go and 1 other location - About 2 hrs to fix
client/interface.go on lines 196..202

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

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

type ConfigAPIClient interface {
    ConfigList(ctx context.Context, options types.ConfigListOptions) ([]swarm.Config, error)
    ConfigCreate(ctx context.Context, config swarm.ConfigSpec) (types.ConfigCreateResponse, error)
    ConfigRemove(ctx context.Context, id string) error
    ConfigInspectWithRaw(ctx context.Context, name string) (swarm.Config, []byte, error)
Severity: Major
Found in client/interface.go and 1 other location - About 2 hrs to fix
client/interface.go on lines 187..193

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

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 (this *NetworkEntry) GoString() string {
    if this == nil {
        return "nil"
    }
    s := make([]string, 0, 8)
Severity: Major
Found in libnetwork/networkdb/networkdb.pb.go and 2 other locations - About 2 hrs to fix
libnetwork/agent.pb.go on lines 319..331
libnetwork/networkdb/networkdb.pb.go on lines 851..863

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

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

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

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

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

Refactorings

Further Reading

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

func (s *containerRouter) postContainerExecResize(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
    if err := httputils.ParseForm(r); err != nil {
        return err
    }
    height, err := strconv.Atoi(r.Form.Get("h"))
Severity: Major
Found in api/server/router/container/exec.go and 1 other location - About 2 hrs to fix
api/server/router/container/container_routes.go on lines 754..769

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

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

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

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

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

Refactorings

Further Reading

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

func (s *containerRouter) postContainersResize(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
    if err := httputils.ParseForm(r); err != nil {
        return err
    }

Severity: Major
Found in api/server/router/container/container_routes.go and 1 other location - About 2 hrs to fix
api/server/router/container/exec.go on lines 155..169

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

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 (d *Daemon) CheckServiceTasksInState(ctx context.Context, service string, state swarm.TaskState, message string) func(*testing.T) (interface{}, string) {
    return func(c *testing.T) (interface{}, string) {
        tasks := d.GetServiceTasks(ctx, c, service)
        var count int
        for _, task := range tasks {
Severity: Major
Found in integration-cli/daemon/daemon_swarm.go and 1 other location - About 2 hrs to fix
integration-cli/daemon/daemon_swarm.go on lines 35..48

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

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 dir&reverse > 0 {
        rSA = &netlink.XfrmState{
            Src:   remoteIP,
            Dst:   localIP,
            Proto: netlink.XFRM_PROTO_ESP,
Severity: Major
Found in libnetwork/drivers/overlay/encryption.go and 1 other location - About 2 hrs to fix
libnetwork/drivers/overlay/encryption.go on lines 344..368

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

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 dir&forward > 0 {
        fSA = &netlink.XfrmState{
            Src:   localIP,
            Dst:   remoteIP,
            Proto: netlink.XFRM_PROTO_ESP,
Severity: Major
Found in libnetwork/drivers/overlay/encryption.go and 1 other location - About 2 hrs to fix
libnetwork/drivers/overlay/encryption.go on lines 318..342

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

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 (d *Daemon) CheckServiceTasksInStateWithError(ctx context.Context, service string, state swarm.TaskState, errorMessage string) func(*testing.T) (interface{}, string) {
    return func(c *testing.T) (interface{}, string) {
        tasks := d.GetServiceTasks(ctx, c, service)
        var count int
        for _, task := range tasks {
Severity: Major
Found in integration-cli/daemon/daemon_swarm.go and 1 other location - About 2 hrs to fix
integration-cli/daemon/daemon_swarm.go on lines 18..31

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

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 (p PortBinding) ContainerAddr() (net.Addr, error) {
    switch p.Proto {
    case UDP:
        return &net.UDPAddr{IP: p.IP, Port: int(p.Port)}, nil
    case TCP:
Severity: Major
Found in libnetwork/types/types.go and 1 other location - About 2 hrs to fix
libnetwork/types/types.go on lines 81..92

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 203.

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