dotcloud/docker

View on GitHub

Showing 445 of 1,885 total issues

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

package client // import "github.com/docker/docker/client"

import (
    "context"
    "encoding/json"
Severity: Major
Found in client/volume_prune.go and 3 other locations - About 2 hrs to fix
client/container_prune.go on lines 1..36
client/image_prune.go on lines 1..36
client/network_prune.go on lines 1..36

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

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 (sr *swarmRouter) createConfig(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
    var config types.ConfigSpec
    if err := httputils.ReadJSON(r, &config); err != nil {
        return err
    }
Severity: Major
Found in api/server/router/swarm/cluster_routes.go and 1 other location - About 2 hrs to fix
api/server/router/swarm/cluster_routes.go on lines 435..453

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

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 (sr *swarmRouter) createSecret(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
    var secret types.SecretSpec
    if err := httputils.ReadJSON(r, &secret); err != nil {
        return err
    }
Severity: Major
Found in api/server/router/swarm/cluster_routes.go and 1 other location - About 2 hrs to fix
api/server/router/swarm/cluster_routes.go on lines 506..525

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

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 (sr *swarmRouter) getTasks(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
    if err := httputils.ParseForm(r); err != nil {
        return err
    }
    filter, err := filters.FromJSON(r.Form.Get("filters"))
Severity: Major
Found in api/server/router/swarm/cluster_routes.go and 1 other location - About 2 hrs to fix
api/server/router/swarm/cluster_routes.go on lines 316..332

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

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 (sr *swarmRouter) getNodes(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
    if err := httputils.ParseForm(r); err != nil {
        return err
    }
    filter, err := filters.FromJSON(r.Form.Get("filters"))
Severity: Major
Found in api/server/router/swarm/cluster_routes.go and 1 other location - About 2 hrs to fix
api/server/router/swarm/cluster_routes.go on lines 387..403

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

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

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

func getPluginClient(p plugingetter.CompatPlugin) (*plugins.Client, error) {
    if v1, ok := p.(plugingetter.PluginWithV1Client); ok {
        return v1.Client(), nil
    }

Severity: Major
Found in libnetwork/ipams/remote/remote.go and 1 other location - About 2 hrs to fix
libnetwork/drivers/remote/driver.go on lines 69..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 220.

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

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

func getPluginClient(p plugingetter.CompatPlugin) (*plugins.Client, error) {
    if v1, ok := p.(plugingetter.PluginWithV1Client); ok {
        return v1.Client(), nil
    }

Severity: Major
Found in libnetwork/drivers/remote/driver.go and 1 other location - About 2 hrs to fix
libnetwork/ipams/remote/remote.go on lines 68..88

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

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

        case 5:
            if wireType != 2 {
                return fmt.Errorf("proto: wrong wireType = %d for field Env", wireType)
            }
            var stringLen uint64
Severity: Major
Found in api/types/swarm/runtime/plugin.pb.go and 4 other locations - About 2 hrs to fix
api/types/swarm/runtime/plugin.pb.go on lines 672..703
libnetwork/agent.pb.go on lines 841..872
libnetwork/agent.pb.go on lines 873..904
libnetwork/networkdb/networkdb.pb.go on lines 2753..2784

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

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

        case 3:
            if wireType != 2 {
                return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType)
            }
            var stringLen uint64
Severity: Major
Found in api/types/swarm/runtime/plugin.pb.go and 4 other locations - About 2 hrs to fix
api/types/swarm/runtime/plugin.pb.go on lines 526..557
libnetwork/agent.pb.go on lines 841..872
libnetwork/agent.pb.go on lines 873..904
libnetwork/networkdb/networkdb.pb.go on lines 2753..2784

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

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

        case 7:
            if wireType != 2 {
                return fmt.Errorf("proto: wrong wireType = %d for field Aliases", wireType)
            }
            var stringLen uint64
Severity: Major
Found in libnetwork/agent.pb.go and 4 other locations - About 2 hrs to fix
api/types/swarm/runtime/plugin.pb.go on lines 526..557
api/types/swarm/runtime/plugin.pb.go on lines 672..703
libnetwork/agent.pb.go on lines 873..904
libnetwork/networkdb/networkdb.pb.go on lines 2753..2784

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

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

        case 4:
            if wireType != 2 {
                return fmt.Errorf("proto: wrong wireType = %d for field Networks", wireType)
            }
            var stringLen uint64
Severity: Major
Found in libnetwork/networkdb/networkdb.pb.go and 4 other locations - About 2 hrs to fix
api/types/swarm/runtime/plugin.pb.go on lines 526..557
api/types/swarm/runtime/plugin.pb.go on lines 672..703
libnetwork/agent.pb.go on lines 841..872
libnetwork/agent.pb.go on lines 873..904

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

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

        case 8:
            if wireType != 2 {
                return fmt.Errorf("proto: wrong wireType = %d for field TaskAliases", wireType)
            }
            var stringLen uint64
Severity: Major
Found in libnetwork/agent.pb.go and 4 other locations - About 2 hrs to fix
api/types/swarm/runtime/plugin.pb.go on lines 526..557
api/types/swarm/runtime/plugin.pb.go on lines 672..703
libnetwork/agent.pb.go on lines 841..872
libnetwork/networkdb/networkdb.pb.go on lines 2753..2784

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

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

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

func delVlanLink(linkName string) error {
    if strings.Contains(linkName, ".") {
        _, _, err := parseVlan(linkName)
        if err != nil {
            return err
Severity: Major
Found in libnetwork/drivers/macvlan/macvlan_setup.go and 1 other location - About 2 hrs to fix
libnetwork/drivers/ipvlan/ipvlan_setup.go on lines 134..158

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

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

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

func delVlanLink(linkName string) error {
    if strings.Contains(linkName, ".") {
        _, _, err := parseVlan(linkName)
        if err != nil {
            return err
Severity: Major
Found in libnetwork/drivers/ipvlan/ipvlan_setup.go and 1 other location - About 2 hrs to fix
libnetwork/drivers/macvlan/macvlan_setup.go on lines 114..138

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

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

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 ServiceID", 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 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 5:
            if wireType != 2 {
                return fmt.Errorf("proto: wrong wireType = %d for field EndpointIP", 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 743..774
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 2176..2207
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

Severity
Category
Status
Source
Language