dotcloud/docker

View on GitHub

Showing 1,468 of 1,914 total issues

Method driver.CreateEndpoint has 138 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func (d *driver) CreateEndpoint(ctx context.Context, nid, eid string, ifInfo driverapi.InterfaceInfo, _ map[string]interface{}) error {
    if ifInfo == nil {
        return errors.New("invalid interface info passed")
    }

Severity: Major
Found in libnetwork/drivers/bridge/bridge_linux.go - About 4 hrs to fix

    Function compare has 137 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func compare(a, b *container.Config) bool {
        if a == nil || b == nil {
            return false
        }
    
    
    Severity: Major
    Found in image/cache/compare.go - About 4 hrs to fix

      Function includeContainerInList has 137 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func includeContainerInList(container *container.Snapshot, filter *listContext) iterationAction {
          // Do not include container if it's in the list before the filter container.
          // Set the filter container to nil to include the rest of containers after this one.
          if filter.beforeFilter != nil {
              if container.ID == filter.beforeFilter.ID {
      Severity: Major
      Found in daemon/list.go - About 4 hrs to fix

        File image_list.go has 602 lines of code (exceeds 500 allowed). Consider refactoring.
        Open

        package containerd
        
        import (
            "context"
            "encoding/json"
        Severity: Minor
        Found in daemon/containerd/image_list.go - About 4 hrs to fix

          Method PortConfig.Unmarshal has 136 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func (m *PortConfig) Unmarshal(dAtA []byte) error {
              l := len(dAtA)
              iNdEx := 0
              for iNdEx < l {
                  preIndex := iNdEx
          Severity: Major
          Found in libnetwork/agent.pb.go - About 4 hrs to fix

            Function withFetchProgress has a Cognitive Complexity of 45 (exceeds 20 allowed). Consider refactoring.
            Open

            func withFetchProgress(cs content.Store, out progress.Output, ref reference.Named) images.HandlerFunc {
                return func(ctx context.Context, desc ocispec.Descriptor) ([]ocispec.Descriptor, error) {
                    switch desc.MediaType {
                    case ocispec.MediaTypeImageManifest, images.MediaTypeDockerSchema2Manifest:
                        tn := reference.TagNameOnly(ref)
            Severity: Minor
            Found in plugin/fetch_linux.go - About 4 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.setupMounts has a Cognitive Complexity of 45 (exceeds 20 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: Minor
            Found in daemon/volumes_unix.go - About 4 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.createSpec has a Cognitive Complexity of 45 (exceeds 20 allowed). Consider refactoring.
            Open

            func (daemon *Daemon) createSpec(ctx context.Context, daemonCfg *configStore, c *container.Container, mounts []container.Mount) (*specs.Spec, error) {
                img, err := daemon.imageService.GetImage(ctx, string(c.ImageID), backend.GetImageOpts{})
                if err != nil {
                    return nil, err
                }
            Severity: Minor
            Found in daemon/oci_windows.go - About 4 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 UnpackLayer has 135 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            func UnpackLayer(dest string, layer io.Reader, options *TarOptions) (size int64, err error) {
                tr := tar.NewReader(layer)
                trBuf := pools.BufioReader32KPool.Get(tr)
                defer pools.BufioReader32KPool.Put(trBuf)
            
            
            Severity: Major
            Found in pkg/archive/diff.go - About 4 hrs to fix

              File service.go has 599 lines of code (exceeds 500 allowed). Consider refactoring.
              Open

              package convert // import "github.com/docker/docker/daemon/cluster/convert"
              
              import (
                  "fmt"
                  "strings"
              Severity: Minor
              Found in daemon/cluster/convert/service.go - About 4 hrs to fix

                Method puller.pullSchema2Layers has 134 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func (p *puller) pullSchema2Layers(ctx context.Context, target distribution.Descriptor, layers []distribution.Descriptor, platform *ocispec.Platform) (id digest.Digest, err error) {
                    if _, err := p.config.ImageStore.Get(ctx, target.Digest); err == nil {
                        // If the image already exists locally, no need to pull
                        // anything.
                        return target.Digest, nil
                Severity: Major
                Found in distribution/pull_v2.go - About 4 hrs to fix

                  Method PeerRecord.Unmarshal has 134 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

                  func (m *PeerRecord) Unmarshal(dAtA []byte) error {
                      l := len(dAtA)
                      iNdEx := 0
                      for iNdEx < l {
                          preIndex := iNdEx
                  Severity: Major
                  Found in libnetwork/drivers/windows/overlay/overlay.pb.go - About 4 hrs to fix

                    Method Daemon.initNetworkController has 134 lines of code (exceeds 50 allowed). Consider refactoring.
                    Open

                    func (daemon *Daemon) initNetworkController(daemonCfg *config.Config, activeSandboxes map[string]interface{}) error {
                        netOptions, err := daemon.networkOptions(daemonCfg, nil, daemon.id, nil)
                        if err != nil {
                            return err
                        }
                    Severity: Major
                    Found in daemon/daemon_windows.go - About 4 hrs to fix

                      Function containerToGRPC has 133 lines of code (exceeds 50 allowed). Consider refactoring.
                      Open

                      func containerToGRPC(c *types.ContainerSpec) (*swarmapi.ContainerSpec, error) {
                          containerSpec := &swarmapi.ContainerSpec{
                              Image:          c.Image,
                              Labels:         c.Labels,
                              Command:        c.Command,
                      Severity: Major
                      Found in daemon/cluster/convert/container.go - About 4 hrs to fix

                        Method Endpoint.sbJoin has 132 lines of code (exceeds 50 allowed). Consider refactoring.
                        Open

                        func (ep *Endpoint) sbJoin(ctx context.Context, sb *Sandbox, options ...EndpointOption) (retErr error) {
                            ctx, span := otel.Tracer("").Start(ctx, "libnetwork.sbJoin")
                            defer span.End()
                        
                            n, err := ep.getNetworkFromStore()
                        Severity: Major
                        Found in libnetwork/endpoint.go - About 4 hrs to fix

                          Method NetworkPushPull.Unmarshal has 132 lines of code (exceeds 50 allowed). Consider refactoring.
                          Open

                          func (m *NetworkPushPull) Unmarshal(dAtA []byte) error {
                              l := len(dAtA)
                              iNdEx := 0
                              for iNdEx < l {
                                  preIndex := iNdEx
                          Severity: Major
                          Found in libnetwork/networkdb/networkdb.pb.go - About 4 hrs to fix

                            Function FilterNetworks has a Cognitive Complexity of 44 (exceeds 20 allowed). Consider refactoring.
                            Open

                            func FilterNetworks(nws []network.Inspect, filter filters.Args) ([]network.Inspect, error) {
                                // if filter is empty, return original network list
                                if filter.Len() == 0 {
                                    return nws, nil
                                }
                            Severity: Minor
                            Found in daemon/network/filter.go - About 4 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

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

                            package container // import "github.com/docker/docker/daemon/cluster/executor/container"
                            
                            import (
                                "context"
                                "encoding/json"
                            Severity: Minor
                            Found in daemon/cluster/executor/container/container.go - About 4 hrs to fix

                              Method ImageService.pullTag has 130 lines of code (exceeds 50 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 {
                                  var opts []containerd.RemoteOpt
                                  if platform != nil {
                                      opts = append(opts, containerd.WithPlatform(platforms.Format(*platform)))
                                  }
                              Severity: Major
                              Found in daemon/containerd/image_pull.go - About 4 hrs to fix

                                Method Daemon.containerStart has 130 lines of code (exceeds 50 allowed). Consider refactoring.
                                Open

                                func (daemon *Daemon) containerStart(ctx context.Context, daemonCfg *configStore, container *container.Container, checkpoint string, checkpointDir string, resetRestartManager bool) (retErr error) {
                                    ctx, span := otel.Tracer("").Start(ctx, "daemon.containerStart", trace.WithAttributes(
                                        attribute.String("container.ID", container.ID),
                                        attribute.String("container.Name", container.Name)))
                                    defer span.End()
                                Severity: Major
                                Found in daemon/start.go - About 4 hrs to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language