dotcloud/docker

View on GitHub

Showing 1,904 of 1,904 total issues

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

func AddNamespaceRangesUser(name string) (int, int, error) {
    if err := addUser(name); err != nil {
        return -1, -1, fmt.Errorf("error adding user %q: %v", name, err)
    }

Severity: Major
Found in pkg/idtools/usergroupadd_linux.go - About 45 mins to fix

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

    func (m *PortConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
        if deterministic {
            return xxx_messageInfo_PortConfig.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 87..98
    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 *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

    Avoid deeply nested control flow statements.
    Open

                        if err := os.RemoveAll(path); err != nil {
                            return 0, err
                        }
    Severity: Major
    Found in pkg/archive/diff.go - About 45 mins to fix

      Function mkdirAs has a Cognitive Complexity of 23 (exceeds 20 allowed). Consider refactoring.
      Open

      func mkdirAs(path string, mode os.FileMode, owner Identity, mkAll, chownExisting bool) error {
          path, err := filepath.Abs(path)
          if err != nil {
              return err
          }
      Severity: Minor
      Found in pkg/idtools/idtools_unix.go - About 45 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

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

      func createSubordinateRanges(name string) error {
          // first, we should verify that ranges weren't automatically created
          // by the distro tooling
          ranges, err := parseSubuid(name)
          if err != nil {
      Severity: Major
      Found in pkg/idtools/usergroupadd_linux.go - About 45 mins to fix

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

        func (m *GossipMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
            if deterministic {
                return xxx_messageInfo_GossipMessage.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 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 *NetworkEvent) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
            if deterministic {
                return xxx_messageInfo_NetworkEvent.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 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

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

        func CompareKernelVersion(a, b VersionInfo) int {
            if a.Kernel < b.Kernel {
                return -1
            } else if a.Kernel > b.Kernel {
                return 1
        Severity: Major
        Found in pkg/parsers/kernel/kernel.go - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                          for key, val in task.items():
                              if isinstance(val, dict):
                                  for k, v in val.items():
                                      entries.append(v)
                              else:
          Severity: Major
          Found in libnetwork/cmd/ssd/ssd.py - About 45 mins to fix

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

            func (m *BulkSyncMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
                if deterministic {
                    return xxx_messageInfo_BulkSyncMessage.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 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 *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

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

            func mkdirall(path string, perm *windows.SecurityAttributes) error {
                if volumePath.MatchString(path) {
                    return nil
                }
            
            
            Severity: Major
            Found in pkg/system/filesys_windows.go - About 45 mins to fix

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

              func StdCopy(dstout, dsterr io.Writer, src io.Reader) (written int64, err error) {
                  var (
                      buf       = make([]byte, startingBufLen)
                      bufLen    = len(buf)
                      nr, nw    int
              Severity: Major
              Found in pkg/stdcopy/stdcopy.go - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

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

                  Avoid deeply nested control flow statements.
                  Open

                                      if aufsTempdir, err = os.MkdirTemp(dest, "dockerplnk"); err != nil {
                                          return 0, err
                                      }
                  Severity: Major
                  Found in pkg/archive/diff.go - About 45 mins to fix

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

                    func PrepareQuotaTestImage(t *testing.T) (string, error) {
                        // imageSize is the size of the test-image. The minimum size allowed
                        // is 300MB.
                        //
                        // See https://git.kernel.org/pub/scm/fs/xfs/xfsprogs-dev.git/commit/?id=6e0ed3d19c54603f0f7d628ea04b550151d8a262
                    Severity: Major
                    Found in quota/testhelpers.go - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                              if os.IsNotExist(err) {
                                                  err = nil // parent was deleted
                                              }
                      Severity: Major
                      Found in pkg/archive/diff.go - About 45 mins to fix
                        Severity
                        Category
                        Status
                        Source
                        Language