dotcloud/docker

View on GitHub

Showing 1,468 of 1,914 total issues

Method pushDescriptor.Upload has 112 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func (pd *pushDescriptor) Upload(ctx context.Context, progressOutput progress.Output) (distribution.Descriptor, error) {
    // Skip foreign layers unless this registry allows nondistributable artifacts.
    if !pd.endpoint.AllowNondistributableArtifacts {
        if fs, ok := pd.layer.(distribution.Describable); ok {
            if d := fs.Descriptor(); len(d.URLs) > 0 {
Severity: Major
Found in distribution/push_v2.go - About 3 hrs to fix

    Method Cluster.ServiceLogs has 112 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func (c *Cluster) ServiceLogs(ctx context.Context, selector *backend.LogSelector, config *container.LogsOptions) (<-chan *backend.LogMessage, error) {
        c.mu.RLock()
        defer c.mu.RUnlock()
    
        state := c.currentNodeState()
    Severity: Major
    Found in daemon/cluster/services.go - About 3 hrs to fix

      Function DirCopy has 112 lines of code (exceeds 50 allowed). Consider refactoring.
      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 3 hrs to fix

        Function WithNamespaces has 111 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func WithNamespaces(daemon *Daemon, c *container.Container) coci.SpecOpts {
            return func(ctx context.Context, _ coci.Client, _ *containers.Container, s *coci.Spec) error {
                userNS := false
                // user
                if c.HostConfig.UsernsMode.IsPrivate() {
        Severity: Major
        Found in daemon/oci_linux.go - About 3 hrs to fix

          Function compare has 39 return statements (exceeds 4 allowed).
          Open

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

            Method cnmNetworkAllocator.AllocateService has a Cognitive Complexity of 39 (exceeds 20 allowed). Consider refactoring.
            Open

            func (na *cnmNetworkAllocator) AllocateService(s *api.Service) (err error) {
                defer func() {
                    if err != nil {
                        na.DeallocateService(s)
                    }
            Severity: Minor
            Found in libnetwork/cnmallocator/networkallocator.go - About 3 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 client.newStdioPipes has a Cognitive Complexity of 39 (exceeds 20 allowed). Consider refactoring.
            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: Minor
            Found in libcontainerd/remote/client_io_windows.go - About 3 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 controller.Start has a Cognitive Complexity of 39 (exceeds 20 allowed). Consider refactoring.
            Open

            func (r *controller) Start(ctx context.Context) error {
                if err := r.checkClosed(); err != nil {
                    return err
                }
            
            
            Severity: Minor
            Found in daemon/cluster/executor/container/controller.go - About 3 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.ContainerExecStart has a Cognitive Complexity of 39 (exceeds 20 allowed). Consider refactoring.
            Open

            func (daemon *Daemon) ContainerExecStart(ctx context.Context, name string, options backend.ExecStartConfig) (err error) {
                var (
                    cStdin           io.ReadCloser
                    cStdout, cStderr io.Writer
                )
            Severity: Minor
            Found in daemon/exec.go - About 3 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.createNetwork has a Cognitive Complexity of 39 (exceeds 20 allowed). Consider refactoring.
            Open

            func (daemon *Daemon) createNetwork(cfg *config.Config, create networktypes.CreateRequest, id string, agent bool) (*networktypes.CreateResponse, error) {
                if network.IsPredefined(create.Name) {
                    return nil, PredefinedNetworkError(create.Name)
                }
            
            
            Severity: Minor
            Found in daemon/network.go - About 3 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 splunk.go has 558 lines of code (exceeds 500 allowed). Consider refactoring.
            Open

            // Package splunk provides the log driver for forwarding server logs to
            // Splunk HTTP Event Collector endpoint.
            package splunk // import "github.com/docker/docker/daemon/logger/splunk"
            
            import (
            Severity: Minor
            Found in daemon/logger/splunk/splunk.go - About 3 hrs to fix

              Method driver.Join has 109 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func (d *driver) Join(ctx context.Context, nid, eid string, sboxKey string, jinfo driverapi.JoinInfo, options map[string]interface{}) error {
                  ctx, span := otel.Tracer("").Start(ctx, "libnetwork.drivers.ipvlan.Join", trace.WithAttributes(
                      attribute.String("nid", nid),
                      attribute.String("eid", eid),
                      attribute.String("sboxKey", sboxKey)))
              Severity: Major
              Found in libnetwork/drivers/ipvlan/ipvlan_joinleave.go - About 3 hrs to fix

                Method ImageService.ImageDelete has 109 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func (i *ImageService) ImageDelete(ctx context.Context, imageRef string, force, prune bool) (response []imagetypes.DeleteResponse, retErr error) {
                    start := time.Now()
                    defer func() {
                        if retErr == nil {
                            dimages.ImageActions.WithValues("delete").UpdateSince(start)
                Severity: Major
                Found in daemon/containerd/image_delete.go - About 3 hrs to fix

                  Sandbox has 28 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                  func (sb *Sandbox) processOptions(options ...SandboxOption) {
                      for _, opt := range options {
                          if opt != nil {
                              opt(sb)
                          }
                  Severity: Minor
                  Found in libnetwork/sandbox.go - About 3 hrs to fix

                    File push_v2.go has 555 lines of code (exceeds 500 allowed). Consider refactoring.
                    Open

                    package distribution // import "github.com/docker/docker/distribution"
                    
                    import (
                        "context"
                        "fmt"
                    Severity: Minor
                    Found in distribution/push_v2.go - About 3 hrs to fix

                      Method ImageService.ImportImage has 108 lines of code (exceeds 50 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) {
                          refString := ""
                          if ref != nil {
                              refString = ref.String()
                          }
                      Severity: Major
                      Found in daemon/containerd/image_import.go - About 3 hrs to fix

                        Method Sandbox.populateNetworkResources has a Cognitive Complexity of 38 (exceeds 20 allowed). Consider refactoring.
                        Open

                        func (sb *Sandbox) populateNetworkResources(ctx context.Context, ep *Endpoint) error {
                            ctx, span := otel.Tracer("").Start(ctx, "libnetwork.Sandbox.populateNetworkResources", trace.WithAttributes(
                                attribute.String("endpoint.Name", ep.Name())))
                            defer span.End()
                        
                        
                        Severity: Minor
                        Found in libnetwork/sandbox_linux.go - About 3 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 Go has a Cognitive Complexity of 38 (exceeds 20 allowed). Consider refactoring.
                        Open

                        func Go(flags int, setupfn func() error, fn func()) error {
                            started := make(chan error)
                        
                            maskedFlags := flags
                            for f := range reversibleSetnsFlags {
                        Severity: Minor
                        Found in internal/unshare/unshare_linux.go - About 3 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 driver.Join has a Cognitive Complexity of 38 (exceeds 20 allowed). Consider refactoring.
                        Open

                        func (d *driver) Join(ctx context.Context, nid, eid string, sboxKey string, jinfo driverapi.JoinInfo, options map[string]interface{}) error {
                            ctx, span := otel.Tracer("").Start(ctx, "libnetwork.drivers.macvlan.Join", trace.WithAttributes(
                                attribute.String("nid", nid),
                                attribute.String("eid", eid),
                                attribute.String("sboxKey", sboxKey)))
                        Severity: Minor
                        Found in libnetwork/drivers/macvlan/macvlan_joinleave.go - About 3 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 PluginSpec.Unmarshal has 37 return statements (exceeds 4 allowed).
                        Open

                        func (m *PluginSpec) Unmarshal(dAtA []byte) error {
                            l := len(dAtA)
                            iNdEx := 0
                            for iNdEx < l {
                                preIndex := iNdEx
                        Severity: Major
                        Found in api/types/swarm/runtime/plugin.pb.go - About 3 hrs to fix
                          Severity
                          Category
                          Status
                          Source
                          Language