dotcloud/docker

View on GitHub

Showing 1,904 of 1,904 total issues

Avoid deeply nested control flow statements.
Open

                    if err := ts.writer.Close(); err != nil {
                        return 0, err
                    }
Severity: Major
Found in pkg/tarsum/tarsum.go - About 45 mins to fix

    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

    Avoid deeply nested control flow statements.
    Open

                        if err := ts.tarW.Close(); err != nil {
                            return 0, err
                        }
    Severity: Major
    Found in pkg/tarsum/tarsum.go - About 45 mins to fix

      Function Parse has 7 return statements (exceeds 4 allowed).
      Open

      func Parse(filePath string, objName string) (*ParsedPkg, error) {
          fs := token.NewFileSet()
          pkg, err := parser.ParseFile(fs, filePath, nil, parser.AllErrors)
          if err != nil {
              return nil, err
      Severity: Major
      Found in pkg/plugins/pluginrpc-gen/parser.go - About 45 mins to fix

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

        func (m *CompoundMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
            if deterministic {
                return xxx_messageInfo_CompoundMessage.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 506..517
        libnetwork/networkdb/networkdb.pb.go on lines 603..614
        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 *CompoundMessage_SimpleMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
            if deterministic {
                return xxx_messageInfo_CompoundMessage_SimpleMessage.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 506..517
        libnetwork/networkdb/networkdb.pb.go on lines 603..614
        libnetwork/networkdb/networkdb.pb.go on lines 669..680

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

        func (m *PartialLogEntryMetadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
            if deterministic {
                return xxx_messageInfo_PartialLogEntryMetadata.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 42..53
        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 *PluginPrivilege) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
            if deterministic {
                return xxx_messageInfo_PluginPrivilege.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 44..55
        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 *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 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 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 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

            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

        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

        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

            return containertypes.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 75..84

        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

        Severity
        Category
        Status
        Source
        Language