dotcloud/docker

View on GitHub

Showing 1,468 of 1,914 total issues

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

func initializeStage(ctx context.Context, d dispatchRequest, cmd *instructions.Stage) error {
    err := d.builder.imageProber.Reset(ctx)
    if err != nil {
        return err
    }
Severity: Major
Found in builder/dockerfile/dispatchers.go - About 45 mins to fix

    Method Worker.GetRemotes has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    func (w *Worker) GetRemotes(ctx context.Context, ref cache.ImmutableRef, createIfNeeded bool, _ cacheconfig.RefConfig, all bool, s session.Group) ([]*solver.Remote, error) {
    Severity: Minor
    Found in builder/builder-next/worker/worker.go - About 45 mins to fix

      Method Backend.Build has 7 return statements (exceeds 4 allowed).
      Open

      func (b *Backend) Build(ctx context.Context, config backend.BuildConfig) (string, error) {
          options := config.Options
          useBuildKit := options.Version == types.BuilderBuildKit
      
          tags, err := sanitizeRepoAndTags(options.Tags)
      Severity: Major
      Found in api/server/backend/build/backend.go - About 45 mins to fix

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

        func saveArchive(ctx context.Context, cs content.Store, layerReader io.Reader) (digest.Digest, digest.Digest, string, error) {
            // Wrap the reader in buffered reader to allow peeks.
            p := pools.BufioReader32KPool
            bufRd := p.Get(layerReader)
            defer p.Put(bufRd)
        Severity: Major
        Found in daemon/containerd/image_import.go - About 45 mins to fix

          Method client.newStdioPipes has 7 return statements (exceeds 4 allowed).
          Open

          func (c *client) newStdioPipes(fifos *cio.FIFOSet) (_ *stdioPipes, err error) {
              p := &stdioPipes{}
              if fifos.Stdin != "" {
                  c.logger.WithField("stdin", fifos.Stdin).Debug("listen")
                  l, err := winio.ListenPipe(fifos.Stdin, nil)
          Severity: Major
          Found in libcontainerd/remote/client_io_windows.go - About 45 mins to fix

            Function findMissingMountable has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            func findMissingMountable(ctx context.Context, store content.Store, queue *jobs,
                target ocispec.Descriptor, targetRef reference.Named, limiter *semaphore.Weighted,
            Severity: Minor
            Found in daemon/containerd/image_push.go - About 45 mins to fix

              Method client.NewContainer has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              func (c *client) NewContainer(ctx context.Context, id string, ociSpec *specs.Spec, shim string, runtimeOptions interface{}, opts ...containerd.NewContainerOpts) (libcontainerdtypes.Container, error) {
              Severity: Minor
              Found in libcontainerd/remote/client.go - About 45 mins to fix

                Method ImageService.ImportImage has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                func (i *ImageService) ImportImage(ctx context.Context, ref reference.Named, platform *ocispec.Platform, msg string, layerReader io.Reader, changes []string) (image.ID, error) {
                Severity: Minor
                Found in daemon/containerd/image_import.go - About 45 mins to fix

                  Method Daemon.createContainerOSSpecificSettings has 7 return statements (exceeds 4 allowed).
                  Open

                  func (daemon *Daemon) createContainerOSSpecificSettings(ctx context.Context, container *container.Container, config *containertypes.Config, hostConfig *containertypes.HostConfig) error {
                      if err := daemon.Mount(container); err != nil {
                          return err
                      }
                      defer daemon.Unmount(container)
                  Severity: Major
                  Found in daemon/create_unix.go - About 45 mins to fix

                    Method cacheAdaptor.Get has a Cognitive Complexity of 23 (exceeds 20 allowed). Consider refactoring.
                    Open

                    func (c cacheAdaptor) Get(id image.ID) (*image.Image, error) {
                        ctx := context.TODO()
                        ref := id.String()
                    
                        outImg, err := c.is.GetImage(ctx, id.String(), backend.GetImageOpts{})
                    Severity: Minor
                    Found in daemon/containerd/cache.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 setExitCodeFromError has 7 return statements (exceeds 4 allowed).
                    Open

                    func setExitCodeFromError(setExitCode func(exitStatus), err error) error {
                        if err == nil {
                            return nil
                        }
                        errDesc := status.Convert(err).Message()
                    Severity: Major
                    Found in daemon/errors.go - About 45 mins to fix

                      Method client.NewContainer has 6 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                      func (c *client) NewContainer(_ context.Context, id string, spec *specs.Spec, shim string, runtimeOptions interface{}, opts ...containerd.NewContainerOpts) (libcontainerdtypes.Container, error) {
                      Severity: Minor
                      Found in libcontainerd/local/local_windows.go - About 45 mins to fix

                        Method Daemon.cleanupMounts has 7 return statements (exceeds 4 allowed).
                        Open

                        func (daemon *Daemon) cleanupMounts(cfg *config.Config) error {
                            if err := daemon.cleanupMountsByID(""); err != nil {
                                return err
                            }
                        
                        
                        Severity: Major
                        Found in daemon/daemon_linux.go - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                              if c.waitServe(ctx) {
                                                  go c.processEventStream(ctx, ns)
                                                  return
                                              }
                          Severity: Major
                          Found in libcontainerd/remote/client.go - About 45 mins to fix

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

                            func ifaceAddrs(linkName string) (v4, v6 []*net.IPNet, err error) {
                                nl := ns.NlHandle()
                                link, err := nl.LinkByName(linkName)
                                if err != nil {
                                    if !errors.As(err, new(netlink.LinkNotFoundError)) {
                            Severity: Major
                            Found in daemon/daemon_linux.go - About 45 mins to fix

                              Method task.CreateCheckpoint has 7 return statements (exceeds 4 allowed).
                              Open

                              func (t *task) CreateCheckpoint(ctx context.Context, checkpointDir string, exit bool) error {
                                  img, err := t.Task.Checkpoint(ctx, t.ctr.getCheckpointOptions(exit))
                                  if err != nil {
                                      return wrapError(err)
                                  }
                              Severity: Major
                              Found in libcontainerd/remote/client.go - About 45 mins to fix

                                Method ImageService.PushImage has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                func (i *ImageService) PushImage(ctx context.Context, sourceRef reference.Named, platform *ocispec.Platform, metaHeaders map[string][]string, authConfig *registry.AuthConfig, outStream io.Writer) (retErr error) {
                                Severity: Minor
                                Found in daemon/containerd/image_push.go - About 45 mins to fix

                                  Avoid deeply nested control flow statements.
                                  Open

                                                          if err := unmount(mnt); err != nil {
                                                              log.G(context.TODO()).Error(err)
                                                              errs = append(errs, err.Error())
                                                          }
                                  Severity: Major
                                  Found in daemon/daemon_linux.go - About 45 mins to fix

                                    Method Daemon.populateVolume has 7 return statements (exceeds 4 allowed).
                                    Open

                                    func (daemon *Daemon) populateVolume(ctx context.Context, c *container.Container, mnt *volumemounts.MountPoint) error {
                                        ctrDestPath, err := c.GetResourcePath(mnt.Destination)
                                        if err != nil {
                                            return err
                                        }
                                    Severity: Major
                                    Found in daemon/create_unix.go - About 45 mins to fix

                                      Method ImageService.pushRef has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                      Open

                                      func (i *ImageService) pushRef(ctx context.Context, targetRef reference.Named, platform *ocispec.Platform, metaHeaders map[string][]string, authConfig *registry.AuthConfig, out progress.Output) (retErr error) {
                                      Severity: Minor
                                      Found in daemon/containerd/image_push.go - About 45 mins to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language