dotcloud/docker

View on GitHub

Showing 1,885 of 1,885 total issues

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

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

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 Config.CopyStreams has a Cognitive Complexity of 53 (exceeds 20 allowed). Consider refactoring.
      Open

      func (c *Config) CopyStreams(ctx context.Context, cfg *AttachConfig) <-chan error {
          var group errgroup.Group
      
          // Connect stdin of container to the attach stdin stream.
          if cfg.Stdin != nil {
      Severity: Minor
      Found in container/stream/attach.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 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 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

            Method Daemon.containerStart has a Cognitive Complexity of 51 (exceeds 20 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: Minor
            Found in daemon/start.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 Info.ExtraAttributes has a Cognitive Complexity of 51 (exceeds 20 allowed). Consider refactoring.
            Open

            func (info *Info) ExtraAttributes(keyMod func(string) string) (map[string]string, error) {
                extra := make(map[string]string)
                labels, ok := info.Config["labels"]
                if ok && len(labels) > 0 {
                    for _, l := range strings.Split(labels, ",") {
            Severity: Minor
            Found in daemon/logger/loginfo.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 tarSum.Read has a Cognitive Complexity of 51 (exceeds 20 allowed). Consider refactoring.
            Open

            func (ts *tarSum) Read(buf []byte) (int, error) {
                if ts.finished {
                    return ts.bufWriter.Read(buf)
                }
                if len(ts.bufData) < len(buf) {
            Severity: Minor
            Found in pkg/tarsum/tarsum.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 EndpointRecord.Unmarshal has 61 return statements (exceeds 4 allowed).
            Open

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

              Method linuxParser.validateMountConfigImpl has a Cognitive Complexity of 50 (exceeds 20 allowed). Consider refactoring.
              Open

              func (p *linuxParser) validateMountConfigImpl(mnt *mount.Mount, validateBindSourceExists bool) error {
                  if len(mnt.Target) == 0 {
                      return &errMountConfig{mnt, errMissingField("Target")}
                  }
              
              
              Severity: Minor
              Found in volume/mounts/linux_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