docker/docker

View on GitHub

Showing 443 of 1,855 total issues

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

func (pr *pluginRouter) inspectPlugin(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
    result, err := pr.backend.Inspect(vars["name"])
    if err != nil {
        return err
    }
Severity: Major
Found in api/server/router/plugin/plugin_routes.go and 3 other locations - About 45 mins to fix
api/server/router/container/exec.go on lines 19..26
api/server/router/swarm/cluster_routes.go on lines 472..479
api/server/router/swarm/cluster_routes.go on lines 544..551

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

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 (proxy *TCPProxy) Run() {
    quit := make(chan bool)
    defer close(quit)
    for {
        client, err := proxy.listener.Accept()
Severity: Minor
Found in cmd/docker-proxy/tcp_proxy.go and 1 other location - About 45 mins to fix
cmd/docker-proxy/sctp_proxy.go on lines 78..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 117.

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 (daemon *Daemon) reloadDebug(txn *reloadTxn, newCfg *configStore, conf *config.Config, attributes map[string]string) error {
    // update corresponding configuration
    if conf.IsValueSet("debug") {
        newCfg.Debug = conf.Debug
    }
Severity: Minor
Found in daemon/reload.go and 1 other location - About 45 mins to fix
daemon/reload.go on lines 260..269

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

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 (s *containerRouter) getExecByID(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
    eConfig, err := s.backend.ContainerExecInspect(vars["id"])
    if err != nil {
        return err
    }
Severity: Major
Found in api/server/router/container/exec.go and 3 other locations - About 45 mins to fix
api/server/router/plugin/plugin_routes.go on lines 288..294
api/server/router/swarm/cluster_routes.go on lines 472..479
api/server/router/swarm/cluster_routes.go on lines 544..551

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

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 (proxy *SCTPProxy) Run() {
    quit := make(chan bool)
    defer close(quit)
    for {
        client, err := proxy.listener.Accept()
Severity: Minor
Found in cmd/docker-proxy/sctp_proxy.go and 1 other location - About 45 mins to fix
cmd/docker-proxy/tcp_proxy.go on lines 74..85

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

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 (sr *swarmRouter) getSecret(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
    secret, err := sr.backend.GetSecret(vars["id"])
    if err != nil {
        return err
    }
Severity: Major
Found in api/server/router/swarm/cluster_routes.go and 3 other locations - About 45 mins to fix
api/server/router/plugin/plugin_routes.go on lines 288..294
api/server/router/container/exec.go on lines 19..26
api/server/router/swarm/cluster_routes.go on lines 544..551

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

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 (daemon *Daemon) reloadLiveRestore(txn *reloadTxn, newCfg *configStore, conf *config.Config, attributes map[string]string) error {
    // update corresponding configuration
    if conf.IsValueSet("live-restore") {
        newCfg.LiveRestoreEnabled = conf.LiveRestoreEnabled
    }
Severity: Minor
Found in daemon/reload.go and 1 other location - About 45 mins to fix
daemon/reload.go on lines 148..156

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

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 (sr *swarmRouter) getConfig(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
    config, err := sr.backend.GetConfig(vars["id"])
    if err != nil {
        return err
    }
Severity: Major
Found in api/server/router/swarm/cluster_routes.go and 3 other locations - About 45 mins to fix
api/server/router/plugin/plugin_routes.go on lines 288..294
api/server/router/container/exec.go on lines 19..26
api/server/router/swarm/cluster_routes.go on lines 472..479

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

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 (d *driver) Leave(nid, eid string) error {
    network, err := d.getNetwork(nid)
    if err != nil {
        return err
    }
Severity: Minor
Found in libnetwork/drivers/macvlan/macvlan_joinleave.go and 1 other location - About 45 mins to fix
libnetwork/drivers/ipvlan/ipvlan_joinleave.go on lines 143..157

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

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 ok := n.validatePortBindingIPv6(&bIPv6, containerIP, defHostIP); ok {
            if err := n.allocatePort(&bIPv6, ulPxyEnabled); err != nil {
                // On allocation failure, release previously allocated ports. On cleanup error, just log a warning message
                if cuErr := n.releasePortsInternal(bs); cuErr != nil {
                    log.G(context.TODO()).Warnf("allocation failure for %v, failed to clear previously allocated ipv6 port bindings: %v", bIPv6, cuErr)
Severity: Minor
Found in libnetwork/drivers/bridge/port_mapping_linux.go and 1 other location - About 45 mins to fix
libnetwork/drivers/bridge/port_mapping_linux.go on lines 44..53

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

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 ep.iface.addr != nil {
        if err := ipam.ReleaseAddress(ep.iface.v4PoolID, ep.iface.addr.IP); err != nil {
            log.G(context.TODO()).Warnf("Failed to release ip address %s on delete of endpoint %s (%s): %v", ep.iface.addr.IP, ep.Name(), ep.ID(), err)
        }
    }
Severity: Minor
Found in libnetwork/endpoint.go and 1 other location - About 45 mins to fix
libnetwork/endpoint.go on lines 1162..1166

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

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 (d *driver) Leave(nid, eid string) error {
    network, err := d.getNetwork(nid)
    if err != nil {
        return err
    }
Severity: Minor
Found in libnetwork/drivers/ipvlan/ipvlan_joinleave.go and 1 other location - About 45 mins to fix
libnetwork/drivers/macvlan/macvlan_joinleave.go on lines 104..118

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

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 ok := n.validatePortBindingIPv4(&bIPv4, containerIPv4, defHostIP); ok {
            if err := n.allocatePort(&bIPv4, ulPxyEnabled); err != nil {
                // On allocation failure, release previously allocated ports. On cleanup error, just log a warning message
                if cuErr := n.releasePortsInternal(bs); cuErr != nil {
                    log.G(context.TODO()).Warnf("allocation failure for %v, failed to clear previously allocated ipv4 port bindings: %v", bIPv4, cuErr)
Severity: Minor
Found in libnetwork/drivers/bridge/port_mapping_linux.go and 1 other location - About 45 mins to fix
libnetwork/drivers/bridge/port_mapping_linux.go on lines 70..79

Duplicated Code

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

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

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

Tuning

This issue has a mass of 116.

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 ep.iface.addrv6 != nil {
        if err := ipam.ReleaseAddress(ep.iface.v6PoolID, ep.iface.addrv6.IP); err != nil {
            log.G(context.TODO()).Warnf("Failed to release ip address %s on delete of endpoint %s (%s): %v", ep.iface.addrv6.IP, ep.Name(), ep.ID(), err)
        }
    }
Severity: Minor
Found in libnetwork/endpoint.go and 1 other location - About 45 mins to fix
libnetwork/endpoint.go on lines 1156..1160

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

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

func (m *NetworkEntry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
    if deterministic {
        return xxx_messageInfo_NetworkEntry.Marshal(b, m, deterministic)
    } else {
        b = b[:cap(b)]
Severity: Major
Found in libnetwork/networkdb/networkdb.pb.go and 15 other locations - About 45 mins to fix
api/types/plugins/logdriver/entry.pb.go on lines 42..53
api/types/plugins/logdriver/entry.pb.go on lines 116..127
api/types/swarm/runtime/plugin.pb.go on lines 44..55
api/types/swarm/runtime/plugin.pb.go on lines 120..131
libnetwork/agent.pb.go on lines 87..98
libnetwork/agent.pb.go on lines 204..215
libnetwork/drivers/overlay/overlay.pb.go on lines 51..62
libnetwork/networkdb/networkdb.pb.go on lines 197..208
libnetwork/networkdb/networkdb.pb.go on lines 254..265
libnetwork/networkdb/networkdb.pb.go on lines 313..324
libnetwork/networkdb/networkdb.pb.go on lines 441..452
libnetwork/networkdb/networkdb.pb.go on lines 506..517
libnetwork/networkdb/networkdb.pb.go on lines 603..614
libnetwork/networkdb/networkdb.pb.go on lines 669..680
libnetwork/networkdb/networkdb.pb.go on lines 714..725

Duplicated Code

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

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

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

Tuning

This issue has a mass of 115.

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

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

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

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

Refactorings

Further Reading

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

        if c.Privileges.AppArmor != nil {
            containerSpec.Privileges.Apparmor = &swarmapi.Privileges_AppArmorOpts{}

            switch c.Privileges.AppArmor.Mode {
            case types.AppArmorModeDefault:
Severity: Minor
Found in daemon/cluster/convert/container.go and 1 other location - About 45 mins to fix
daemon/cluster/convert/container.go on lines 88..97

Duplicated Code

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

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

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

Tuning

This issue has a mass of 115.

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

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

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

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

Refactorings

Further Reading

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

func (m *NodeEvent) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
    if deterministic {
        return xxx_messageInfo_NodeEvent.Marshal(b, m, deterministic)
    } else {
        b = b[:cap(b)]
Severity: Major
Found in libnetwork/networkdb/networkdb.pb.go and 15 other locations - About 45 mins to fix
api/types/plugins/logdriver/entry.pb.go on lines 42..53
api/types/plugins/logdriver/entry.pb.go on lines 116..127
api/types/swarm/runtime/plugin.pb.go on lines 44..55
api/types/swarm/runtime/plugin.pb.go on lines 120..131
libnetwork/agent.pb.go on lines 87..98
libnetwork/agent.pb.go on lines 204..215
libnetwork/drivers/overlay/overlay.pb.go on lines 51..62
libnetwork/networkdb/networkdb.pb.go on lines 197..208
libnetwork/networkdb/networkdb.pb.go on lines 313..324
libnetwork/networkdb/networkdb.pb.go on lines 379..390
libnetwork/networkdb/networkdb.pb.go on lines 441..452
libnetwork/networkdb/networkdb.pb.go on lines 506..517
libnetwork/networkdb/networkdb.pb.go on lines 603..614
libnetwork/networkdb/networkdb.pb.go on lines 669..680
libnetwork/networkdb/networkdb.pb.go on lines 714..725

Duplicated Code

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

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

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

Tuning

This issue has a mass of 115.

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

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

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

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

Refactorings

Further Reading

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

func (m *PeerRecord) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
    if deterministic {
        return xxx_messageInfo_PeerRecord.Marshal(b, m, deterministic)
    } else {
        b = b[:cap(b)]
Severity: Major
Found in libnetwork/drivers/overlay/overlay.pb.go and 15 other locations - About 45 mins to fix
api/types/plugins/logdriver/entry.pb.go on lines 42..53
api/types/plugins/logdriver/entry.pb.go on lines 116..127
api/types/swarm/runtime/plugin.pb.go on lines 44..55
api/types/swarm/runtime/plugin.pb.go on lines 120..131
libnetwork/agent.pb.go on lines 87..98
libnetwork/agent.pb.go on lines 204..215
libnetwork/networkdb/networkdb.pb.go on lines 197..208
libnetwork/networkdb/networkdb.pb.go on lines 254..265
libnetwork/networkdb/networkdb.pb.go on lines 313..324
libnetwork/networkdb/networkdb.pb.go on lines 379..390
libnetwork/networkdb/networkdb.pb.go on lines 441..452
libnetwork/networkdb/networkdb.pb.go on lines 506..517
libnetwork/networkdb/networkdb.pb.go on lines 603..614
libnetwork/networkdb/networkdb.pb.go on lines 669..680
libnetwork/networkdb/networkdb.pb.go on lines 714..725

Duplicated Code

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

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

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

Tuning

This issue has a mass of 115.

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

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

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

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

Refactorings

Further Reading

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

        if c.Privileges.Apparmor != nil {
            containerSpec.Privileges.AppArmor = &types.AppArmorOpts{}

            switch c.Privileges.Apparmor.Mode {
            case swarmapi.Privileges_AppArmorOpts_DEFAULT:
Severity: Minor
Found in daemon/cluster/convert/container.go and 1 other location - About 45 mins to fix
daemon/cluster/convert/container.go on lines 356..365

Duplicated Code

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

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

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

Tuning

This issue has a mass of 115.

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

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

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

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

Refactorings

Further Reading

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

func (m *NetworkPushPull) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
    if deterministic {
        return xxx_messageInfo_NetworkPushPull.Marshal(b, m, deterministic)
    } else {
        b = b[:cap(b)]
Severity: Major
Found in libnetwork/networkdb/networkdb.pb.go and 15 other locations - About 45 mins to fix
api/types/plugins/logdriver/entry.pb.go on lines 42..53
api/types/plugins/logdriver/entry.pb.go on lines 116..127
api/types/swarm/runtime/plugin.pb.go on lines 44..55
api/types/swarm/runtime/plugin.pb.go on lines 120..131
libnetwork/agent.pb.go on lines 87..98
libnetwork/agent.pb.go on lines 204..215
libnetwork/drivers/overlay/overlay.pb.go on lines 51..62
libnetwork/networkdb/networkdb.pb.go on lines 197..208
libnetwork/networkdb/networkdb.pb.go on lines 254..265
libnetwork/networkdb/networkdb.pb.go on lines 313..324
libnetwork/networkdb/networkdb.pb.go on lines 379..390
libnetwork/networkdb/networkdb.pb.go on lines 506..517
libnetwork/networkdb/networkdb.pb.go on lines 603..614
libnetwork/networkdb/networkdb.pb.go on lines 669..680
libnetwork/networkdb/networkdb.pb.go on lines 714..725

Duplicated Code

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

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

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

Tuning

This issue has a mass of 115.

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

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

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

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

Refactorings

Further Reading

Severity
Category
Status
Source
Language