dotcloud/docker

View on GitHub

Showing 1,468 of 1,914 total issues

Method driver.CreateNetwork has 9 return statements (exceeds 4 allowed).
Open

func (d *driver) CreateNetwork(nid string, option map[string]interface{}, nInfo driverapi.NetworkInfo, ipV4Data, ipV6Data []driverapi.IPAMData) error {
    kv, err := kernel.GetKernelVersion()
    if err != nil {
        return fmt.Errorf("failed to check kernel version for ipvlan driver support: %v", err)
    }
Severity: Major
Found in libnetwork/drivers/ipvlan/ipvlan_network.go - About 55 mins to fix

    Method distributionRouter.fetchManifest has a Cognitive Complexity of 24 (exceeds 20 allowed). Consider refactoring.
    Open

    func (s *distributionRouter) fetchManifest(ctx context.Context, distrepo distribution.Repository, namedRef reference.Named) (registry.DistributionInspect, error) {
        var distributionInspect registry.DistributionInspect
        if canonicalRef, ok := namedRef.(reference.Canonical); !ok {
            namedRef = reference.TagNameOnly(namedRef)
    
    
    Severity: Minor
    Found in api/server/router/distribution/distribution_routes.go - About 55 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

    Method State.String has 9 return statements (exceeds 4 allowed).
    Open

    func (s *State) String() string {
        if s.Running {
            if s.Paused {
                return fmt.Sprintf("Up %s (Paused)", units.HumanDuration(time.Now().UTC().Sub(s.StartedAt)))
            }
    Severity: Major
    Found in container/state.go - About 55 mins to fix

      Method imageRouter.getImagesJSON has a Cognitive Complexity of 24 (exceeds 20 allowed). Consider refactoring.
      Open

      func (ir *imageRouter) getImagesJSON(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
          if err := httputils.ParseForm(r); err != nil {
              return err
          }
      
      
      Severity: Minor
      Found in api/server/router/image/image_routes.go - About 55 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

      Method ImageService.PrepareSnapshot has 9 return statements (exceeds 4 allowed).
      Open

      func (i *ImageService) PrepareSnapshot(ctx context.Context, id string, parentImage string, platform *ocispec.Platform, setupInit func(string) error) error {
          var parentSnapshot string
          if parentImage != "" {
              img, err := i.resolveImage(ctx, parentImage)
              if err != nil {
      Severity: Major
      Found in daemon/containerd/image_snapshot.go - About 55 mins to fix

        Method container.NewTask has 9 return statements (exceeds 4 allowed).
        Open

        func (c *container) NewTask(ctx context.Context, checkpointDir string, withStdin bool, attachStdio libcontainerdtypes.StdioCallback) (libcontainerdtypes.Task, error) {
            var (
                checkpoint     *types.Descriptor
                t              containerd.Task
                rio            cio.IO
        Severity: Major
        Found in libcontainerd/remote/client.go - About 55 mins to fix

          Method Daemon.cleanupMountsFromReaderByID has a Cognitive Complexity of 24 (exceeds 20 allowed). Consider refactoring.
          Open

          func (daemon *Daemon) cleanupMountsFromReaderByID(reader io.Reader, id string, unmount func(target string) error) error {
              if daemon.root == "" {
                  return nil
              }
              var errs []string
          Severity: Minor
          Found in daemon/daemon_linux.go - About 55 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

          Method Cluster.CreateService has 9 return statements (exceeds 4 allowed).
          Open

          func (c *Cluster) CreateService(s swarm.ServiceSpec, encodedAuth string, queryRegistry bool) (*swarm.ServiceCreateResponse, error) {
              var resp *swarm.ServiceCreateResponse
              err := c.lockedManagerAction(func(ctx context.Context, state nodeState) error {
                  err := c.populateNetworkID(ctx, state.controlClient, &s)
                  if err != nil {
          Severity: Major
          Found in daemon/cluster/services.go - About 55 mins to fix

            Method Cluster.imageWithDigestString has 9 return statements (exceeds 4 allowed).
            Open

            func (c *Cluster) imageWithDigestString(ctx context.Context, image string, authConfig *registry.AuthConfig) (string, error) {
                ref, err := reference.ParseAnyReference(image)
                if err != nil {
                    return "", err
                }
            Severity: Major
            Found in daemon/cluster/services.go - About 55 mins to fix

              Method ImageService.ImageHistory has 9 return statements (exceeds 4 allowed).
              Open

              func (i *ImageService) ImageHistory(ctx context.Context, name string, platform *ocispec.Platform) ([]*imagetype.HistoryResponseItem, error) {
                  start := time.Now()
                  img, err := i.resolveImage(ctx, name)
                  if err != nil {
                      return nil, err
              Severity: Major
              Found in daemon/containerd/image_history.go - About 55 mins to fix

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

                func (i *ImageService) pruneAll(ctx context.Context, imagesToPrune map[string]containerdimages.Image) (*image.PruneReport, error) {
                    report := image.PruneReport{}
                
                    ctx, span := tracing.StartSpan(ctx, "ImageService.pruneAll")
                    span.SetAttributes(tracing.Attribute("count", len(imagesToPrune)))
                Severity: Minor
                Found in daemon/containerd/image_prune.go - About 55 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

                Method Cluster.UpdateService has 9 return statements (exceeds 4 allowed).
                Open

                func (c *Cluster) UpdateService(serviceIDOrName string, version uint64, spec swarm.ServiceSpec, flags types.ServiceUpdateOptions, queryRegistry bool) (*swarm.ServiceUpdateResponse, error) {
                    var resp *swarm.ServiceUpdateResponse
                
                    err := c.lockedManagerAction(func(ctx context.Context, state nodeState) error {
                        err := c.populateNetworkID(ctx, state.controlClient, &spec)
                Severity: Major
                Found in daemon/cluster/services.go - About 55 mins to fix

                  Method controller.Logs has a Cognitive Complexity of 24 (exceeds 20 allowed). Consider refactoring.
                  Open

                  func (r *controller) Logs(ctx context.Context, publisher exec.LogPublisher, options api.LogSubscriptionOptions) error {
                      if err := r.checkClosed(); err != nil {
                          return err
                      }
                  
                  
                  Severity: Minor
                  Found in daemon/cluster/executor/container/controller.go - About 55 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

                  Method ImageService.verifyImagesProvidePlatform has 9 return statements (exceeds 4 allowed).
                  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: Major
                  Found in daemon/containerd/image_exporter.go - About 55 mins to fix

                    Function ValidateLogOpt has a Cognitive Complexity of 24 (exceeds 20 allowed). Consider refactoring.
                    Open

                    func ValidateLogOpt(cfg map[string]string) error {
                        address, err := parseAddress(cfg["gelf-address"])
                        if err != nil {
                            return err
                        }
                    Severity: Minor
                    Found in daemon/logger/gelf/gelf.go - About 55 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 getTailReader has 9 return statements (exceeds 4 allowed).
                    Open

                    func getTailReader(ctx context.Context, r loggerutils.SizeReaderAt, req int) (loggerutils.SizeReaderAt, int, error) {
                        size := r.Size()
                        if req < 0 {
                            return nil, 0, errdefs.InvalidParameter(errors.Errorf("invalid number of lines to tail: %d", req))
                        }
                    Severity: Major
                    Found in daemon/logger/local/read.go - About 55 mins to fix

                      Method Daemon.allocateNetwork has 9 return statements (exceeds 4 allowed).
                      Open

                      func (daemon *Daemon) allocateNetwork(ctx context.Context, cfg *config.Config, ctr *container.Container) (retErr error) {
                          if daemon.netController == nil {
                              return nil
                          }
                      
                      
                      Severity: Major
                      Found in daemon/container_operations.go - About 55 mins to fix

                        Method Daemon.update has 9 return statements (exceeds 4 allowed).
                        Open

                        func (daemon *Daemon) update(name string, hostConfig *container.HostConfig) error {
                            if hostConfig == nil {
                                return nil
                            }
                        
                        
                        Severity: Major
                        Found in daemon/update.go - About 55 mins to fix

                          Method Daemon.localNetworksPrune has 9 return statements (exceeds 4 allowed).
                          Open

                          func (daemon *Daemon) localNetworksPrune(ctx context.Context, pruneFilters filters.Args) *network.PruneReport {
                              rep := &network.PruneReport{}
                          
                              until, _ := getUntilFromPruneFilters(pruneFilters)
                          
                          
                          Severity: Major
                          Found in daemon/prune.go - About 55 mins to fix

                            Method Daemon.disconnectFromNetwork has 9 return statements (exceeds 4 allowed).
                            Open

                            func (daemon *Daemon) disconnectFromNetwork(ctx context.Context, ctr *container.Container, n *libnetwork.Network, force bool) error {
                                var (
                                    ep   *libnetwork.Endpoint
                                    sbox *libnetwork.Sandbox
                                )
                            Severity: Major
                            Found in daemon/container_operations.go - About 55 mins to fix
                              Severity
                              Category
                              Status
                              Source
                              Language