dotcloud/docker

View on GitHub

Showing 1,468 of 1,914 total issues

Method ImageManifest.IsPseudoImage has 7 return statements (exceeds 4 allowed).
Open

func (im *ImageManifest) IsPseudoImage(ctx context.Context) (bool, error) {
    if im.IsAttestation() {
        return true, nil
    }

Severity: Major
Found in daemon/containerd/image_manifest.go - About 45 mins to fix

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

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

      Method ImageService.pullForBuilder has 7 return statements (exceeds 4 allowed).
      Open

      func (i *ImageService) pullForBuilder(ctx context.Context, name string, authConfigs map[string]registry.AuthConfig, output io.Writer, platform *ocispec.Platform) (*ocispec.Descriptor, error) {
          ref, err := reference.ParseNormalizedNamed(name)
          if err != nil {
              return nil, err
          }
      Severity: Major
      Found in daemon/containerd/image_builder.go - About 45 mins to fix

        Method Cluster.resolveSystemAddrViaSubnetCheck has 7 return statements (exceeds 4 allowed).
        Open

        func (c *Cluster) resolveSystemAddrViaSubnetCheck() (net.IP, error) {
            // Use the system's only IP address, or fail if there are
            // multiple addresses to choose from. Skip interfaces which
            // are managed by docker via subnet check.
            interfaces, err := net.Interfaces()
        Severity: Major
        Found in daemon/cluster/listen_addr.go - About 45 mins to fix

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

          func newContainerAdapter(b executorpkg.Backend, i executorpkg.ImageBackend, v executorpkg.VolumeBackend, task *api.Task, node *api.NodeDescription, dependencies exec.DependencyGetter) (*containerAdapter, error) {
          Severity: Minor
          Found in daemon/cluster/executor/container/adapter.go - About 45 mins to fix

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

            func resolveInterfaceAddr(specifiedInterface string) (net.IP, error) {
                // Use a specific interface's IP address.
                intf, err := net.InterfaceByName(specifiedInterface)
                if err != nil {
                    return nil, errNoSuchInterface
            Severity: Major
            Found in daemon/cluster/listen_addr.go - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                              } else if ctnr.State.ExitCode != 0 {
                                  return &exitError{code: ctnr.State.ExitCode, cause: healthErr}
                              }
              Severity: Major
              Found in daemon/cluster/executor/container/controller.go - About 45 mins to fix

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

                func writeContentsForImage(ctx context.Context, snName string, cs content.Store,
                    newConfig imagespec.DockerOCIImage, layers []ocispec.Descriptor,
                    containerConfig container.Config,
                Severity: Minor
                Found in daemon/containerd/image_builder.go - About 45 mins to fix

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

                  func (i *ImageService) verifyImagesProvidePlatform(ctx context.Context, imgs []containerdimages.Image, platform ocispec.Platform, pm platforms.Matcher) error {
                      if len(imgs) == 0 {
                          return errdefs.NotFound(fmt.Errorf("no images providing the requested platform %s found", platforms.FormatAll(platform)))
                      }
                      var incompleteImgs []string
                  Severity: Minor
                  Found in daemon/containerd/image_exporter.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 newController has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  func newController(b executorpkg.Backend, i executorpkg.ImageBackend, v executorpkg.VolumeBackend, task *api.Task, node *api.NodeDescription, dependencies exec.DependencyGetter) (*controller, error) {
                  Severity: Minor
                  Found in daemon/cluster/executor/container/controller.go - About 45 mins to fix

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

                    func newNetworkAttacherController(b executorpkg.Backend, i executorpkg.ImageBackend, v executorpkg.VolumeBackend, task *api.Task, node *api.NodeDescription, dependencies exec.DependencyGetter) (*networkAttacherController, error) {
                    Severity: Minor
                    Found in daemon/cluster/executor/container/attachment.go - About 45 mins to fix

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

                      func findMissingMountable(ctx context.Context, store content.Store, queue *jobs,
                          target ocispec.Descriptor, targetRef reference.Named, limiter *semaphore.Weighted,
                      ) (map[digest.Digest]distributionSource, error) {
                          mountableBlobs := map[digest.Digest]distributionSource{}
                          var mutex sync.Mutex
                      Severity: Major
                      Found in daemon/containerd/image_push.go - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                        } else if !allTags {
                                            if tagged, ok := repoRef.(reference.Tagged); ok {
                                                if tag == "" {
                                                    tag = tagged.Tag()
                                                } else if tag != tagged.Tag() {
                        Severity: Major
                        Found in daemon/containerd/image_delete.go - About 45 mins to fix

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

                          func (i *ImageService) applyDiffLayer(ctx context.Context, name string, containerID string, sn snapshots.Snapshotter, differ diff.Applier, diffDesc ocispec.Descriptor) (retErr error) {
                          Severity: Minor
                          Found in daemon/containerd/image_commit.go - About 45 mins to fix

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

                            func (i *ImageService) pullTag(ctx context.Context, ref reference.Named, platform *ocispec.Platform, metaHeaders map[string][]string, authConfig *registrytypes.AuthConfig, out progress.Output) error {
                            Severity: Minor
                            Found in daemon/containerd/image_pull.go - About 45 mins to fix

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

                              func initClusterSpec(node *swarmnode.Node, spec types.Spec) error {
                                  ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
                                  defer cancel()
                                  for conn := range node.ListenControlSocket(ctx) {
                                      if ctx.Err() != nil {
                              Severity: Major
                              Found in daemon/cluster/swarm.go - About 45 mins to fix

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

                                func ValidateLogOpt(cfg map[string]string) error {
                                    address, err := parseAddress(cfg["gelf-address"])
                                    if err != nil {
                                        return err
                                    }
                                Severity: Major
                                Found in daemon/logger/gelf/gelf.go - About 45 mins to fix

                                  Avoid deeply nested control flow statements.
                                  Open

                                                      if logErr := c.dst.Log(msg); logErr != nil {
                                                          logDriverError(c.dst.Name(), string(msg.Line), logErr)
                                                      }
                                  Severity: Major
                                  Found in daemon/logger/copier.go - About 45 mins to fix

                                    Method Daemon.newContainer has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                    Open

                                    func (daemon *Daemon) newContainer(name string, operatingSystem string, config *containertypes.Config, hostConfig *containertypes.HostConfig, imgID image.ID, managed bool) (*container.Container, error) {
                                    Severity: Minor
                                    Found in daemon/container.go - About 45 mins to fix

                                      Avoid deeply nested control flow statements.
                                      Open

                                                          if jsonEvent, err := json.Marshal(messages[j]); err != nil {
                                                              log.G(ctx).Error(err)
                                                          } else {
                                                              log.G(ctx).Error(fmt.Errorf("Failed to send a message '%s'", string(jsonEvent)))
                                                          }
                                      Severity: Major
                                      Found in daemon/logger/splunk/splunk.go - About 45 mins to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language