dotcloud/docker

View on GitHub

Showing 445 of 1,885 total issues

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

func (m *LogEntry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
    if deterministic {
        return xxx_messageInfo_LogEntry.Marshal(b, m, deterministic)
    } else {
        b = b[:cap(b)]
Severity: Major
Found in api/types/plugins/logdriver/entry.pb.go and 15 other locations - About 45 mins to fix
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 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 *EndpointRecord) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
    if deterministic {
        return xxx_messageInfo_EndpointRecord.Marshal(b, m, deterministic)
    } else {
        b = b[:cap(b)]
Severity: Major
Found in libnetwork/agent.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 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 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 *TableEvent) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
    if deterministic {
        return xxx_messageInfo_TableEvent.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 441..452
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 *PluginSpec) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
    if deterministic {
        return xxx_messageInfo_PluginSpec.Marshal(b, m, deterministic)
    } else {
        b = b[:cap(b)]
Severity: Major
Found in api/types/swarm/runtime/plugin.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 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 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 89..98

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 359..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 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 len(ranges) == 0 {
        // no UID ranges; let's create one
        startID, err := findNextUIDRange()
        if err != nil {
            return fmt.Errorf("can't find available subuid range: %v", err)
Severity: Minor
Found in pkg/idtools/usergroupadd_linux.go and 1 other location - About 45 mins to fix
pkg/idtools/usergroupadd_linux.go on lines 115..126

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

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 len(ranges) == 0 {
        // no GID ranges; let's create one
        startID, err := findNextGIDRange()
        if err != nil {
            return fmt.Errorf("can't find available subgid range: %v", err)
Severity: Minor
Found in pkg/idtools/usergroupadd_linux.go and 1 other location - About 45 mins to fix
pkg/idtools/usergroupadd_linux.go on lines 98..109

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

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 (a *authorizationPlugin) AuthZResponse(authReq *Request) (*Response, error) {
    if err := a.initPlugin(); err != nil {
        return nil, err
    }

Severity: Minor
Found in pkg/authorization/plugin.go and 1 other location - About 40 mins to fix
pkg/authorization/plugin.go on lines 70..81

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

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 (a *authorizationPlugin) AuthZRequest(authReq *Request) (*Response, error) {
    if err := a.initPlugin(); err != nil {
        return nil, err
    }

Severity: Minor
Found in pkg/authorization/plugin.go and 1 other location - About 40 mins to fix
pkg/authorization/plugin.go on lines 83..94

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

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 *driver) storeDelete(kvObject datastore.KVObject) error {
    if d.store == nil {
        log.G(context.TODO()).Debugf("ipvlan store not initialized. kv object %s is not deleted from store", datastore.Key(kvObject.Key()...))
        return nil
    }
Severity: Minor
Found in libnetwork/drivers/ipvlan/ipvlan_store.go and 1 other location - About 40 mins to fix
libnetwork/drivers/macvlan/macvlan_store.go on lines 126..133

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

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

        NetworkSettingsBase: types.NetworkSettingsBase{
            Bridge:                 ctr.NetworkSettings.Bridge,
            SandboxID:              ctr.NetworkSettings.SandboxID,
            SandboxKey:             ctr.NetworkSettings.SandboxKey,
            HairpinMode:            ctr.NetworkSettings.HairpinMode,
Severity: Minor
Found in daemon/inspect.go and 1 other location - About 40 mins to fix
daemon/inspect.go on lines 256..265

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

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

    return types.DefaultNetworkSettings{
        EndpointID:          nw.EndpointSettings.EndpointID,
        Gateway:             nw.EndpointSettings.Gateway,
        GlobalIPv6Address:   nw.EndpointSettings.GlobalIPv6Address,
        GlobalIPv6PrefixLen: nw.EndpointSettings.GlobalIPv6PrefixLen,
Severity: Minor
Found in daemon/inspect.go and 1 other location - About 40 mins to fix
daemon/inspect.go on lines 76..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 112.

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 *driver) storeDelete(kvObject datastore.KVObject) error {
    if d.store == nil {
        log.G(context.TODO()).Debugf("macvlan store not initialized. kv object %s is not deleted from store", datastore.Key(kvObject.Key()...))
        return nil
    }
Severity: Minor
Found in libnetwork/drivers/macvlan/macvlan_store.go and 1 other location - About 40 mins to fix
libnetwork/drivers/ipvlan/ipvlan_store.go on lines 127..134

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

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

func (e ExperimentalMiddleware) WrapHandler(handler func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error) func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
    return func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
        w.Header().Set("Docker-Experimental", e.experimental)
        return handler(ctx, w, r, vars)
    }
Severity: Major
Found in api/server/middleware/experimental.go and 4 other locations - About 40 mins to fix
api/server/middleware/cors.go on lines 27..42
api/server/middleware/debug.go on lines 17..55
api/server/middleware/version.go on lines 67..86
pkg/authorization/middleware.go on lines 55..110

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

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

    for i := 0; i < b.N; i++ {
        arch, err := driver.Diff(upper, "")
        if err != nil {
            b.Fatal(err)
        }
Severity: Major
Found in daemon/graphdriver/graphtest/graphbench_unix.go and 2 other locations - About 40 mins to fix
daemon/graphdriver/graphtest/graphbench_unix.go on lines 74..84
daemon/graphdriver/graphtest/graphbench_unix.go on lines 209..219

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

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

func (m *Middleware) WrapHandler(handler func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error) func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
    return func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
        plugins := m.getAuthzPlugins()
        if len(plugins) == 0 {
            return handler(ctx, w, r, vars)
Severity: Major
Found in pkg/authorization/middleware.go and 4 other locations - About 40 mins to fix
api/server/middleware/cors.go on lines 27..42
api/server/middleware/debug.go on lines 17..55
api/server/middleware/experimental.go on lines 23..28
api/server/middleware/version.go on lines 67..86

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

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

    for i := 0; i < b.N; i++ {
        arch, err := driver.Diff(base, "")
        if err != nil {
            b.Fatal(err)
        }
Severity: Major
Found in daemon/graphdriver/graphtest/graphbench_unix.go and 2 other locations - About 40 mins to fix
daemon/graphdriver/graphtest/graphbench_unix.go on lines 110..120
daemon/graphdriver/graphtest/graphbench_unix.go on lines 209..219

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

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

    for i := 0; i < b.N; i++ {
        arch, err := driver.Diff(topLayer, "")
        if err != nil {
            b.Fatal(err)
        }
Severity: Major
Found in daemon/graphdriver/graphtest/graphbench_unix.go and 2 other locations - About 40 mins to fix
daemon/graphdriver/graphtest/graphbench_unix.go on lines 74..84
daemon/graphdriver/graphtest/graphbench_unix.go on lines 110..120

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

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

func DebugRequestMiddleware(handler func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error) func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
    return func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
        log.G(ctx).Debugf("Calling %s %s", r.Method, r.RequestURI)

        if r.Method != http.MethodPost {
Severity: Major
Found in api/server/middleware/debug.go and 4 other locations - About 40 mins to fix
api/server/middleware/cors.go on lines 27..42
api/server/middleware/experimental.go on lines 23..28
api/server/middleware/version.go on lines 67..86
pkg/authorization/middleware.go on lines 55..110

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

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