dotcloud/docker

View on GitHub

Showing 1,468 of 1,914 total issues

Method Copier.copySrc has a Cognitive Complexity of 75 (exceeds 20 allowed). Consider refactoring.
Open

func (c *Copier) copySrc(name string, src io.Reader) {
    defer c.copyJobs.Done()

    bufSize := defaultBufSize
    if sizedLogger, ok := c.dst.(SizedLogger); ok {
Severity: Minor
Found in daemon/logger/copier.go - About 1 day 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 a Cognitive Complexity of 75 (exceeds 20 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: Minor
Found in daemon/graphdriver/copy/copy.go - About 1 day 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 bridgeNetwork.addPortMappings has a Cognitive Complexity of 73 (exceeds 20 allowed). Consider refactoring.
Open

func (n *bridgeNetwork) addPortMappings(
    ctx context.Context,
    epAddrV4, epAddrV6 *net.IPNet,
    cfg []types.PortBinding,
    defHostIP net.IP,
Severity: Minor
Found in libnetwork/drivers/bridge/port_mapping_linux.go - About 1 day 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.resolveAllReferences has a Cognitive Complexity of 73 (exceeds 20 allowed). Consider refactoring.
Open

func (i *ImageService) resolveAllReferences(ctx context.Context, refOrID string) (*containerdimages.Image, []containerdimages.Image, error) {
    parsed, err := reference.ParseAnyReference(refOrID)
    if err != nil {
        return nil, nil, errdefs.InvalidParameter(err)
    }
Severity: Minor
Found in daemon/containerd/image.go - About 1 day 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_routes.go has 783 lines of code (exceeds 500 allowed). Consider refactoring.
Open

package container // import "github.com/docker/docker/api/server/router/container"

import (
    "context"
    "encoding/json"
Severity: Major
Found in api/server/router/container/container_routes.go - About 1 day to fix

    File agent.go has 782 lines of code (exceeds 500 allowed). Consider refactoring.
    Open

    package libnetwork
    
    //go:generate protoc -I=. -I=../vendor/ --gogofaster_out=import_path=github.com/docker/docker/libnetwork:. agent.proto
    
    import (
    Severity: Major
    Found in libnetwork/agent.go - About 1 day to fix

      Method driver.Join has a Cognitive Complexity of 71 (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.ipvlan.Join", trace.WithAttributes(
              attribute.String("nid", nid),
              attribute.String("eid", eid),
              attribute.String("sboxKey", sboxKey)))
      Severity: Minor
      Found in libnetwork/drivers/ipvlan/ipvlan_joinleave.go - About 1 day 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 check_network has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring.
      Open

      def check_network(nw_name, ingress=False):
      
          print "Verifying LB programming for containers on network %s" % nw_name
      
          data = cli.inspect_network(nw_name, verbose=True)
      Severity: Minor
      Found in libnetwork/cmd/ssd/ssd.py - About 1 day 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

      Consider simplifying this complex logical expression.
      Open

          if resources.CPUShares != 0 ||
              resources.Memory != 0 ||
              resources.NanoCPUs != 0 ||
              resources.CgroupParent != "" ||
              resources.BlkioWeight != 0 ||
      Severity: Critical
      Found in container/container_windows.go - About 1 day to fix

        Function compare has a Cognitive Complexity of 70 (exceeds 20 allowed). Consider refactoring.
        Open

        func compare(a, b *container.Config) bool {
            if a == nil || b == nil {
                return false
            }
        
        
        Severity: Minor
        Found in image/cache/compare.go - About 1 day 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.pullTag has a Cognitive Complexity of 70 (exceeds 20 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: Minor
        Found in daemon/containerd/image_pull.go - About 1 day 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 plugin.pb.go has 763 lines of code (exceeds 500 allowed). Consider refactoring.
        Open

        // Code generated by protoc-gen-gogo. DO NOT EDIT.
        // source: plugin.proto
        
        package runtime
        
        
        Severity: Major
        Found in api/types/swarm/runtime/plugin.pb.go - About 1 day to fix

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

          func (daemon *Daemon) openContainerFS(ctr *container.Container) (_ *containerFSView, retErr error) {
              ctx := context.TODO()
          
              if err := daemon.Mount(ctr); err != nil {
                  return nil, err
          Severity: Minor
          Found in daemon/containerfs_linux.go - About 1 day 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 Builder.Build has a Cognitive Complexity of 67 (exceeds 20 allowed). Consider refactoring.
          Open

          func (b *Builder) Build(ctx context.Context, opt backend.BuildConfig) (*builder.Result, error) {
              if len(opt.Options.Outputs) > 1 {
                  return nil, errors.Errorf("multiple outputs not supported")
              }
          
          
          Severity: Minor
          Found in builder/builder-next/builder.go - About 1 day 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.ImageDelete has a Cognitive Complexity of 66 (exceeds 20 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: Minor
          Found in daemon/containerd/image_delete.go - About 7 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.createWindows has a Cognitive Complexity of 65 (exceeds 20 allowed). Consider refactoring.
          Open

          func (c *client) createWindows(id string, spec *specs.Spec, runtimeOptions interface{}) (*container, error) {
              logger := c.logger.WithField("container", id)
              configuration := &hcsshim.ContainerConfig{
                  SystemType:              "Container",
                  Name:                    id,
          Severity: Minor
          Found in libcontainerd/local/local_windows.go - About 7 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 merge has a Cognitive Complexity of 64 (exceeds 20 allowed). Consider refactoring.
          Open

          func merge(userConf, imageConf *containertypes.Config) error {
              if userConf.User == "" {
                  userConf.User = imageConf.User
              }
              if len(userConf.ExposedPorts) == 0 {
          Severity: Minor
          Found in daemon/commit.go - About 7 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 Endpoint.sbJoin has a Cognitive Complexity of 63 (exceeds 20 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: Minor
          Found in libnetwork/endpoint.go - About 7 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.ImagesPrune has a Cognitive Complexity of 63 (exceeds 20 allowed). Consider refactoring.
          Open

          func (i *ImageService) ImagesPrune(ctx context.Context, pruneFilters filters.Args) (*imagetypes.PruneReport, error) {
              if !i.pruneRunning.CompareAndSwap(false, true) {
                  return nil, errPruneRunning
              }
              defer i.pruneRunning.Store(false)
          Severity: Minor
          Found in daemon/images/image_prune.go - About 7 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.fillPlatformInfo has a Cognitive Complexity of 63 (exceeds 20 allowed). Consider refactoring.
          Open

          func (daemon *Daemon) fillPlatformInfo(ctx context.Context, v *system.Info, sysInfo *sysinfo.SysInfo, cfg *configStore) error {
              v.CgroupDriver = cgroupDriver(&cfg.Config)
              v.CgroupVersion = "1"
              if sysInfo.CgroupUnified {
                  v.CgroupVersion = "2"
          Severity: Minor
          Found in daemon/info_unix.go - About 7 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

          Severity
          Category
          Status
          Source
          Language