docker/docker

View on GitHub

Showing 1,853 of 1,853 total issues

Method Daemon.containerStatPath has 5 return statements (exceeds 4 allowed).
Open

func (daemon *Daemon) containerStatPath(container *container.Container, path string) (stat *types.ContainerPathStat, err error) {
    container.Lock()
    defer container.Unlock()

    // Make sure an online file-system operation is permitted.
Severity: Major
Found in daemon/archive_windows.go - About 35 mins to fix

    Method ImageService.manifestMatchesPlatform has 5 return statements (exceeds 4 allowed).
    Open

    func (i *ImageService) manifestMatchesPlatform(ctx context.Context, img *image.Image, platform ocispec.Platform) (bool, error) {
        ls, err := i.leases.ListResources(ctx, leases.Lease{ID: imageKey(img.ID().String())})
        if err != nil {
            if cerrdefs.IsNotFound(err) {
                return false, nil
    Severity: Major
    Found in daemon/images/image.go - About 35 mins to fix

      Method atomicFileWriter.Close has 5 return statements (exceeds 4 allowed).
      Open

      func (w *atomicFileWriter) Close() (retErr error) {
          defer func() {
              if retErr != nil || w.writeErr != nil {
                  os.Remove(w.f.Name())
              }
      Severity: Major
      Found in pkg/ioutils/fswriters.go - About 35 mins to fix

        Method layerStore.ChecksumForGraphID has 5 return statements (exceeds 4 allowed).
        Open

        func (ls *layerStore) ChecksumForGraphID(id, parent, newTarDataPath string) (diffID DiffID, size int64, err error) {
            rawarchive, err := ls.driver.Diff(id, parent)
            if err != nil {
                return
            }
        Severity: Major
        Found in layer/migration.go - About 35 mins to fix

          Function doUnpack has 5 return statements (exceeds 4 allowed).
          Open

          func doUnpack(decompressedArchive io.Reader, relDest, root string, options *archive.TarOptions) error {
              optionsR, optionsW, err := os.Pipe()
              if err != nil {
                  return err
              }
          Severity: Major
          Found in pkg/chrootarchive/archive_unix_nolinux.go - About 35 mins to fix

            Method layerStore.initMount has 5 return statements (exceeds 4 allowed).
            Open

            func (ls *layerStore) initMount(graphID, parent, mountLabel string, initFunc MountInit, storageOpt map[string]string) (string, error) {
                // Use "<graph-id>-init" to maintain compatibility with graph drivers
                // which are expecting this layer with this special name. If all
                // graph drivers can be updated to not rely on knowing about this layer
                // then the initID should be randomly generated.
            Severity: Major
            Found in layer/layer_store.go - About 35 mins to fix

              Function parseSubidFile has 5 return statements (exceeds 4 allowed).
              Open

              func parseSubidFile(path, username string) (ranges, error) {
                  var rangeList ranges
              
                  subidFile, err := os.Open(path)
                  if err != nil {
              Severity: Major
              Found in pkg/idtools/idtools.go - About 35 mins to fix

                Function doPack has 5 return statements (exceeds 4 allowed).
                Open

                func doPack(relSrc, root string, options *archive.TarOptions) (io.ReadCloser, error) {
                    optionsR, optionsW, err := os.Pipe()
                    if err != nil {
                        return nil, err
                    }
                Severity: Major
                Found in pkg/chrootarchive/archive_unix_nolinux.go - About 35 mins to fix

                  Method scanner.Scan has 5 return statements (exceeds 4 allowed).
                  Open

                  func (s *scanner) Scan(ctx context.Context) bool {
                      if s.err != nil {
                          return false
                      }
                  
                  
                  Severity: Major
                  Found in pkg/tailfile/tailfile.go - About 35 mins to fix

                    Function toRootless has 5 return statements (exceeds 4 allowed).
                    Open

                    func toRootless(spec *specs.Spec, v2Controllers []string, currentOOMScoreAdj int) error {
                        if len(v2Controllers) == 0 {
                            if spec.Linux != nil {
                                // Remove cgroup settings.
                                spec.Linux.Resources = nil
                    Severity: Major
                    Found in pkg/rootless/specconv/specconv_linux.go - About 35 mins to fix

                      Function StickRuntimeDirContents has 5 return statements (exceeds 4 allowed).
                      Open

                      func StickRuntimeDirContents(files []string) ([]string, error) {
                          runtimeDir, err := GetRuntimeDir()
                          if err != nil {
                              // ignore error if runtimeDir is empty
                              return nil, nil
                      Severity: Major
                      Found in pkg/homedir/homedir_linux.go - About 35 mins to fix

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

                        func (pp *volumeDriverProxy) Create(name string, opts map[string]string) (err error) {
                            var (
                                req volumeDriverProxyCreateRequest
                                ret volumeDriverProxyCreateResponse
                            )
                        Severity: Minor
                        Found in volume/drivers/proxy.go and 1 other location - About 35 mins to fix
                        volume/drivers/proxy.go on lines 153..171

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

                        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 (pp *volumeDriverProxy) Get(name string) (volume *proxyVolume, err error) {
                            var (
                                req volumeDriverProxyGetRequest
                                ret volumeDriverProxyGetResponse
                            )
                        Severity: Minor
                        Found in volume/drivers/proxy.go and 1 other location - About 35 mins to fix
                        volume/drivers/proxy.go on lines 91..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 105.

                        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 (pp *volumeDriverProxy) Path(name string) (mountpoint string, err error) {
                            var (
                                req volumeDriverProxyPathRequest
                                ret volumeDriverProxyPathResponse
                            )
                        Severity: Minor
                        Found in volume/drivers/proxy.go and 1 other location - About 35 mins to fix
                        volume/drivers/proxy.go on lines 208..227

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

                        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 doLeaveNetwork(ips []string, args []string) {
                            doneCh := make(chan resultTuple, len(ips))
                            // check all the nodes
                            for _, ip := range ips {
                                go leaveNetwork(ip, servicePort, args[0], doneCh)
                        Severity: Minor
                        Found in libnetwork/cmd/networkdb-test/dbclient/ndbClient.go and 1 other location - About 35 mins to fix
                        libnetwork/cmd/networkdb-test/dbclient/ndbClient.go on lines 368..379

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

                        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 doJoinNetwork(ips []string, args []string) {
                            doneCh := make(chan resultTuple, len(ips))
                            // check all the nodes
                            for _, ip := range ips {
                                go joinNetwork(ip, servicePort, args[0], doneCh)
                        Severity: Minor
                        Found in libnetwork/cmd/networkdb-test/dbclient/ndbClient.go and 1 other location - About 35 mins to fix
                        libnetwork/cmd/networkdb-test/dbclient/ndbClient.go on lines 382..393

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

                        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 (pp *volumeDriverProxy) Unmount(name string, id string) (err error) {
                            var (
                                req volumeDriverProxyUnmountRequest
                                ret volumeDriverProxyUnmountResponse
                            )
                        Severity: Minor
                        Found in volume/drivers/proxy.go and 1 other location - About 35 mins to fix
                        volume/drivers/proxy.go on lines 35..53

                        Duplicated Code

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

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

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

                        Tuning

                        This issue has a mass of 105.

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

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

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

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

                        Refactorings

                        Further Reading

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

                            if link, err := d.nlh.LinkByName(ep.srcName); err == nil {
                                if err := d.nlh.LinkDel(link); err != nil {
                                    log.G(context.TODO()).WithError(err).Errorf("Failed to delete interface (%s)'s link on endpoint (%s) delete", ep.srcName, ep.id)
                                }
                            }
                        Severity: Minor
                        Found in libnetwork/drivers/bridge/bridge_linux.go and 1 other location - About 35 mins to fix
                        libnetwork/drivers/bridge/bridge_linux.go on lines 859..863

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

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

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

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

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

                        Refactorings

                        Further Reading

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

                                if link, err := d.nlh.LinkByName(ep.srcName); err == nil {
                                    if err := d.nlh.LinkDel(link); err != nil {
                                        log.G(context.TODO()).WithError(err).Errorf("Failed to delete interface (%s)'s link on endpoint (%s) delete", ep.srcName, ep.id)
                                    }
                                }
                        Severity: Minor
                        Found in libnetwork/drivers/bridge/bridge_linux.go and 1 other location - About 35 mins to fix
                        libnetwork/drivers/bridge/bridge_linux.go on lines 1163..1167

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

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

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

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

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

                        Refactorings

                        Further Reading

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

                                nat.Sort(l.Ports, func(ip, jp nat.Port) bool {
                                    // If the two ports have the same number, tcp takes priority
                                    // Sort in desc order
                                    return ip.Int() < jp.Int() || (ip.Int() == jp.Int() && strings.ToLower(ip.Proto()) == "tcp")
                                })
                        Severity: Minor
                        Found in daemon/links/links.go and 1 other location - About 35 mins to fix
                        daemon/links/links.go on lines 60..64

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

                        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