dotcloud/docker

View on GitHub

Showing 1,468 of 1,914 total issues

Function setupSeccomp has 78 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func setupSeccomp(config *Seccomp, rs *specs.Spec) (*specs.LinuxSeccomp, error) {
    if config == nil {
        return nil, nil
    }

Severity: Major
Found in profiles/seccomp/seccomp_linux.go - About 2 hrs to fix

    Method systemRouter.getEvents has 78 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func (s *systemRouter) getEvents(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
        if err := httputils.ParseForm(r); err != nil {
            return err
        }
    
    
    Severity: Major
    Found in api/server/router/system/system_routes.go - About 2 hrs to fix

      Function setupLabelFilter has 78 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func setupLabelFilter(ctx context.Context, store content.Store, fltrs filters.Args) (func(image images.Image) bool, error) {
          type labelCheck struct {
              key        string
              value      string
              onlyExists bool
      Severity: Major
      Found in daemon/containerd/image_list.go - About 2 hrs to fix

        Function New has 78 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func New(info logger.Info) (logger.Logger, error) {
            initGCP()
        
            var project string
            if projectID != "" {
        Severity: Major
        Found in daemon/logger/gcplogs/gcplogging.go - About 2 hrs to fix

          Method Resolver.setupIPTable has a Cognitive Complexity of 31 (exceeds 20 allowed). Consider refactoring.
          Open

          func (r *Resolver) setupIPTable() error {
              if r.err != nil {
                  return r.err
              }
              laddr := r.conn.LocalAddr().String()
          Severity: Minor
          Found in libnetwork/resolver_unix.go - About 2 hrs 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 Network.addLBBackend has a Cognitive Complexity of 31 (exceeds 20 allowed). Consider refactoring.
          Open

          func (n *Network) addLBBackend(ip net.IP, lb *loadBalancer) {
              if len(lb.vip) == 0 {
                  return
              }
          
          
          Severity: Minor
          Found in libnetwork/service_windows.go - About 2 hrs 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 setupIPChains has a Cognitive Complexity of 31 (exceeds 20 allowed). Consider refactoring.
          Open

          func setupIPChains(config configuration, version iptables.IPVersion) (natChain *iptables.ChainInfo, filterChain *iptables.ChainInfo, isolationChain1 *iptables.ChainInfo, isolationChain2 *iptables.ChainInfo, retErr error) {
              // Sanity check.
              if version == iptables.IPv4 && !config.EnableIPTables {
                  return nil, nil, nil, nil, errors.New("cannot create new chains, iptables is disabled")
              }
          Severity: Minor
          Found in libnetwork/drivers/bridge/setup_ip_tables_linux.go - About 2 hrs 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.setupFilters has 23 return statements (exceeds 4 allowed).
          Open

          func (i *ImageService) setupFilters(ctx context.Context, imageFilters filters.Args) (filterFunc imageFilterFunc, outErr error) {
              var fltrs []imageFilterFunc
              err := imageFilters.WalkValues("before", func(value string) error {
                  img, err := i.GetImage(ctx, value, backend.GetImageOpts{})
                  if err != nil {
          Severity: Major
          Found in daemon/containerd/image_list.go - About 2 hrs to fix

            Method Cluster.Leave has a Cognitive Complexity of 31 (exceeds 20 allowed). Consider refactoring.
            Open

            func (c *Cluster) Leave(ctx context.Context, force bool) error {
                c.controlMutex.Lock()
                defer c.controlMutex.Unlock()
            
                c.mu.Lock()
            Severity: Minor
            Found in daemon/cluster/swarm.go - About 2 hrs 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.deleteAll has a Cognitive Complexity of 31 (exceeds 20 allowed). Consider refactoring.
            Open

            func (i *ImageService) deleteAll(ctx context.Context, imgID image.ID, all []images.Image, c conflictType, prune bool) (records []imagetypes.DeleteResponse, err error) {
                // Workaround for: https://github.com/moby/buildkit/issues/3797
                possiblyDeletedConfigs := map[digest.Digest]struct{}{}
                if len(all) > 0 && i.content != nil {
                    handled := map[digest.Digest]struct{}{}
            Severity: Minor
            Found in daemon/containerd/image_delete.go - About 2 hrs 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 DirCopy has 23 return statements (exceeds 4 allowed).
            Open

            func DirCopy(srcDir, dstDir string, copyMode Mode, copyOpaqueXattrs bool) error {
                copyWithFileRange := true
                copyWithFileClone := true
            
                // This is a map of source file inodes to dst file paths
            Severity: Major
            Found in daemon/graphdriver/copy/copy.go - About 2 hrs to fix

              Function validateEndpointSettings has a Cognitive Complexity of 31 (exceeds 20 allowed). Consider refactoring.
              Open

              func validateEndpointSettings(nw *libnetwork.Network, nwName string, epConfig *networktypes.EndpointSettings) error {
                  if epConfig == nil {
                      return nil
                  }
              
              
              Severity: Minor
              Found in daemon/container_operations.go - About 2 hrs 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 Daemon.allocateNetwork has a Cognitive Complexity of 31 (exceeds 20 allowed). Consider refactoring.
              Open

              func (daemon *Daemon) allocateNetwork(ctx context.Context, cfg *config.Config, ctr *container.Container) (retErr error) {
                  if daemon.netController == nil {
                      return nil
                  }
              
              
              Severity: Minor
              Found in daemon/container_operations.go - About 2 hrs 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 Network.addLBBackend has 77 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func (n *Network) addLBBackend(ip net.IP, lb *loadBalancer) {
                  if len(lb.vip) == 0 {
                      return
                  }
              
              
              Severity: Major
              Found in libnetwork/service_windows.go - About 2 hrs to fix

                Method addrSpace.allocatePredefinedPool has 77 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func (aSpace *addrSpace) allocatePredefinedPool(reserved []netip.Prefix) (netip.Prefix, error) {
                    aSpace.mu.Lock()
                    defer aSpace.mu.Unlock()
                
                    var pdfID int
                Severity: Major
                Found in libnetwork/ipams/defaultipam/address_space.go - About 2 hrs to fix

                  Method driver.createNetwork has 77 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

                  func (d *driver) createNetwork(config *networkConfiguration) (err error) {
                      // Initialize handle when needed
                      d.Lock()
                      if d.nlh.Handle == nil {
                          d.nlh = ns.NlHandle()
                  Severity: Major
                  Found in libnetwork/drivers/bridge/bridge_linux.go - About 2 hrs to fix

                    Method distributionRouter.fetchManifest has 77 lines of code (exceeds 50 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: Major
                    Found in api/server/router/distribution/distribution_routes.go - About 2 hrs to fix

                      Method Daemon.setupMounts has 77 lines of code (exceeds 50 allowed). Consider refactoring.
                      Open

                      func (daemon *Daemon) setupMounts(ctx context.Context, c *container.Container) ([]container.Mount, func(context.Context) error, error) {
                          var mounts []container.Mount
                          // TODO: tmpfs mounts should be part of Mountpoints
                          tmpfsMounts := make(map[string]bool)
                          tmpfsMountInfo, err := c.TmpfsMounts()
                      Severity: Major
                      Found in daemon/volumes_unix.go - About 2 hrs to fix

                        Method container.NewTask has 77 lines of code (exceeds 50 allowed). Consider refactoring.
                        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 2 hrs to fix

                          File container.go has 503 lines of code (exceeds 500 allowed). Consider refactoring.
                          Open

                          package convert // import "github.com/docker/docker/daemon/cluster/convert"
                          
                          import (
                              "context"
                              "encoding/json"
                          Severity: Minor
                          Found in daemon/cluster/convert/container.go - About 2 hrs to fix
                            Severity
                            Category
                            Status
                            Source
                            Language