docker/docker

View on GitHub

Showing 1,408 of 1,853 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 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 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

    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

      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 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(sb *Sandbox, options ...EndpointOption) (err error) {
            n, err := ep.getNetworkFromStore()
            if err != nil {
                return fmt.Errorf("failed to get network from store during join: %v", err)
            }
        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 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

        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) (*types.ImagesPruneReport, error) {
            if !atomic.CompareAndSwapInt32(&i.pruneRunning, 0, 1) {
                return nil, errPruneRunning
            }
            defer atomic.StoreInt32(&i.pruneRunning, 0)
        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 driver.Join has a Cognitive Complexity of 62 (exceeds 20 allowed). Consider refactoring.
        Open

        func (d *driver) Join(nid, eid string, sboxKey string, jinfo driverapi.JoinInfo, options map[string]interface{}) error {
            n, err := d.getNetwork(nid)
            if err != nil {
                return err
            }
        Severity: Minor
        Found in libnetwork/drivers/ipvlan/ipvlan_joinleave.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

        File entry.pb.go has 714 lines of code (exceeds 500 allowed). Consider refactoring.
        Open

        // Code generated by protoc-gen-gogo. DO NOT EDIT.
        // source: entry.proto
        
        package logdriver
        
        
        Severity: Minor
        Found in api/types/plugins/logdriver/entry.pb.go - About 7 hrs to fix

          Method IPTable.ProgramChain has a Cognitive Complexity of 61 (exceeds 20 allowed). Consider refactoring.
          Open

          func (iptable IPTable) ProgramChain(c *ChainInfo, bridgeName string, hairpinMode, enable bool) error {
              if c.Name == "" {
                  return errors.New("could not program chain, missing chain name")
              }
          
          
          Severity: Minor
          Found in libnetwork/iptables/iptables.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.ImageDelete has a Cognitive Complexity of 61 (exceeds 20 allowed). Consider refactoring.
          Open

          func (i *ImageService) ImageDelete(ctx context.Context, imageRef string, force, prune bool) ([]imagetypes.DeleteResponse, error) {
              start := time.Now()
              records := []imagetypes.DeleteResponse{}
          
              img, err := i.GetImage(ctx, imageRef, backend.GetImageOpts{})
          Severity: Minor
          Found in daemon/images/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

          File windows.go has 708 lines of code (exceeds 500 allowed). Consider refactoring.
          Open

          //go:build windows
          
          // Shim for the Host Network Service (HNS) to manage networking for
          // Windows Server containers and Hyper-V containers. This module
          // is a basic libnetwork driver that passes all the calls to HNS
          Severity: Minor
          Found in libnetwork/drivers/windows/windows.go - About 7 hrs to fix
            Severity
            Category
            Status
            Source
            Language