docker/docker

View on GitHub

Showing 1,408 of 1,853 total issues

Method puller.pullSchema2Layers has a Cognitive Complexity of 54 (exceeds 20 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: Minor
Found in distribution/pull_v2.go - About 5 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 skipAgent has a Cognitive Complexity of 54 (exceeds 20 allowed). Consider refactoring.
Open

func skipAgent(dAtA []byte) (n int, err error) {
    l := len(dAtA)
    iNdEx := 0
    depth := 0
    for iNdEx < l {
Severity: Minor
Found in libnetwork/agent.pb.go - About 5 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 skipNetworkdb has a Cognitive Complexity of 54 (exceeds 20 allowed). Consider refactoring.
Open

func skipNetworkdb(dAtA []byte) (n int, err error) {
    l := len(dAtA)
    iNdEx := 0
    depth := 0
    for iNdEx < l {
Severity: Minor
Found in libnetwork/networkdb/networkdb.pb.go - About 5 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 skipOverlay has a Cognitive Complexity of 54 (exceeds 20 allowed). Consider refactoring.
Open

func skipOverlay(dAtA []byte) (n int, err error) {
    l := len(dAtA)
    iNdEx := 0
    depth := 0
    for iNdEx < l {
Severity: Minor
Found in libnetwork/drivers/overlay/overlay.pb.go - About 5 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 skipPlugin has a Cognitive Complexity of 54 (exceeds 20 allowed). Consider refactoring.
Open

func skipPlugin(dAtA []byte) (n int, err error) {
    l := len(dAtA)
    iNdEx := 0
    depth := 0
    for iNdEx < l {
Severity: Minor
Found in api/types/swarm/runtime/plugin.pb.go - About 5 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 skipEntry has a Cognitive Complexity of 54 (exceeds 20 allowed). Consider refactoring.
Open

func skipEntry(dAtA []byte) (n int, err error) {
    l := len(dAtA)
    iNdEx := 0
    depth := 0
    for iNdEx < l {
Severity: Minor
Found in api/types/plugins/logdriver/entry.pb.go - About 5 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 setupLabelFilter has a Cognitive Complexity of 54 (exceeds 20 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: Minor
Found in daemon/containerd/image_list.go - About 5 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.ExportImage has a Cognitive Complexity of 54 (exceeds 20 allowed). Consider refactoring.
Open

func (i *ImageService) ExportImage(ctx context.Context, names []string, outStream io.Writer) error {
    platform := matchAllWithPreference(platforms.Default())
    opts := []archive.ExportOpt{
        archive.WithSkipNonDistributableBlobs(),

Severity: Minor
Found in daemon/containerd/image_exporter.go - About 5 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 cloudwatchlogs.go has 663 lines of code (exceeds 500 allowed). Consider refactoring.
Open

// Package awslogs provides the logdriver for forwarding container logs to Amazon CloudWatch Logs
package awslogs // import "github.com/docker/docker/daemon/logger/awslogs"

import (
    "context"
Severity: Minor
Found in daemon/logger/awslogs/cloudwatchlogs.go - About 5 hrs to fix

    File ndbClient.go has 662 lines of code (exceeds 500 allowed). Consider refactoring.
    Open

    package dbclient
    
    import (
        "context"
        "fmt"
    Severity: Minor
    Found in libnetwork/cmd/networkdb-test/dbclient/ndbClient.go - About 5 hrs to fix

      Method driver.CreateNetwork has a Cognitive Complexity of 53 (exceeds 20 allowed). Consider refactoring.
      Open

      func (d *driver) CreateNetwork(id string, option map[string]interface{}, nInfo driverapi.NetworkInfo, ipV4Data, ipV6Data []driverapi.IPAMData) error {
          if _, err := d.getNetwork(id); err == nil {
              return types.ForbiddenErrorf("network %s exists", id)
          }
      
      
      Severity: Minor
      Found in libnetwork/drivers/windows/windows.go - About 5 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.Images has a Cognitive Complexity of 53 (exceeds 20 allowed). Consider refactoring.
      Open

      func (i *ImageService) Images(ctx context.Context, opts imagetypes.ListOptions) ([]*imagetypes.Summary, error) {
          if err := opts.Filters.Validate(acceptedImageFilterTags); err != nil {
              return nil, err
          }
      
      
      Severity: Minor
      Found in daemon/containerd/image_list.go - About 5 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.NewNetwork has 166 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func (c *Controller) NewNetwork(networkType, name string, id string, options ...NetworkOption) (_ *Network, retErr error) {
          if id != "" {
              c.networkLocker.Lock(id)
              defer c.networkLocker.Unlock(id) //nolint:errcheck
      
      
      Severity: Major
      Found in libnetwork/controller.go - About 5 hrs to fix

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

        func New(info logger.Info) (logger.Logger, error) {
            hostname, err := info.Hostname()
            if err != nil {
                return nil, fmt.Errorf("%s: cannot access hostname to set source field", driverName)
            }
        Severity: Major
        Found in daemon/logger/splunk/splunk.go - About 5 hrs to fix

          Method Daemon.registerMountPoints has 166 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func (daemon *Daemon) registerMountPoints(container *container.Container, hostConfig *containertypes.HostConfig, defaultReadOnlyNonRecursive bool) (retErr error) {
              binds := map[string]bool{}
              mountPoints := map[string]*volumemounts.MountPoint{}
              parser := volumemounts.NewParser()
          
          
          Severity: Major
          Found in daemon/volumes.go - About 5 hrs to fix

            Method tarexporter.Load has a Cognitive Complexity of 52 (exceeds 20 allowed). Consider refactoring.
            Open

            func (l *tarexporter) Load(inTar io.ReadCloser, outStream io.Writer, quiet bool) error {
                var progressOutput progress.Output
                if !quiet {
                    progressOutput = streamformatter.NewJSONProgressOutput(outStream, false)
                }
            Severity: Minor
            Found in image/tarexport/load.go - About 5 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 a Cognitive Complexity of 52 (exceeds 20 allowed). Consider refactoring.
            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: Minor
            Found in daemon/containerd/image_list.go - About 5 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 changes has a Cognitive Complexity of 52 (exceeds 20 allowed). Consider refactoring.
            Open

            func changes(layers []string, rw string, dc deleteChange, sc skipChange) ([]Change, error) {
                var (
                    changes     []Change
                    changedDirs = make(map[string]struct{})
                )
            Severity: Minor
            Found in pkg/archive/changes.go - About 5 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 Plugin.Set has a Cognitive Complexity of 51 (exceeds 20 allowed). Consider refactoring.
            Open

            func (p *Plugin) Set(args []string) error {
                p.mu.Lock()
                defer p.mu.Unlock()
            
                if p.PluginObj.Enabled {
            Severity: Minor
            Found in plugin/v2/plugin.go - About 5 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 windowsParser.validateMountConfigReg has a Cognitive Complexity of 51 (exceeds 20 allowed). Consider refactoring.
            Open

            func (p *windowsParser) validateMountConfigReg(mnt *mount.Mount, additionalValidators ...mountValidator) error {
                if len(mnt.Target) == 0 {
                    return &errMountConfig{mnt, errMissingField("Target")}
                }
                for _, v := range additionalValidators {
            Severity: Minor
            Found in volume/mounts/windows_parser.go - About 5 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