dotcloud/docker

View on GitHub

Showing 1,468 of 1,914 total issues

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

func (daemon *Daemon) ContainerRename(oldName, newName string) (retErr error) {
    if oldName == "" || newName == "" {
        return errdefs.InvalidParameter(errors.New("Neither old nor new names may be empty"))
    }

Severity: Minor
Found in daemon/rename.go - About 6 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 backend_linux.go has 676 lines of code (exceeds 500 allowed). Consider refactoring.
Open

package plugin // import "github.com/docker/docker/plugin"

import (
    "archive/tar"
    "bytes"
Severity: Minor
Found in plugin/backend_linux.go - About 6 hrs to fix

    Function attemptBindHostPorts has a Cognitive Complexity of 55 (exceeds 20 allowed). Consider refactoring.
    Open

    func attemptBindHostPorts(
        ctx context.Context,
        cfg []portBindingReq,
        proto string,
        hostPortStart, hostPortEnd uint16,
    Severity: Minor
    Found in libnetwork/drivers/bridge/port_mapping_linux.go - About 6 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 Cluster.resolveSystemAddrViaSubnetCheck has a Cognitive Complexity of 55 (exceeds 20 allowed). Consider refactoring.
    Open

    func (c *Cluster) resolveSystemAddrViaSubnetCheck() (net.IP, error) {
        // Use the system's only IP address, or fail if there are
        // multiple addresses to choose from. Skip interfaces which
        // are managed by docker via subnet check.
        interfaces, err := net.Interfaces()
    Severity: Minor
    Found in daemon/cluster/listen_addr.go - About 6 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.buildSandboxOptions has a Cognitive Complexity of 55 (exceeds 20 allowed). Consider refactoring.
    Open

    func (daemon *Daemon) buildSandboxOptions(cfg *config.Config, ctr *container.Container) ([]libnetwork.SandboxOption, error) {
        var sboxOptions []libnetwork.SandboxOption
        sboxOptions = append(sboxOptions, libnetwork.OptionHostname(ctr.Config.Hostname), libnetwork.OptionDomainname(ctr.Config.Domainname))
    
        if ctr.HostConfig.NetworkMode.IsHost() {
    Severity: Minor
    Found in daemon/container_operations.go - About 6 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 ServiceSpecToGRPC has 175 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func ServiceSpecToGRPC(s types.ServiceSpec) (swarmapi.ServiceSpec, error) {
        name := s.Name
        if name == "" {
            name = namesgenerator.GetRandomName(0)
        }
    Severity: Major
    Found in daemon/cluster/convert/service.go - About 6 hrs to fix

      File port_mapping_linux.go has 664 lines of code (exceeds 500 allowed). Consider refactoring.
      Open

      // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16:
      //go:build go1.21
      
      package bridge
      
      
      Severity: Minor
      Found in libnetwork/drivers/bridge/port_mapping_linux.go - About 5 hrs to fix

        Method Reader.TestFollow has 173 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func (tr Reader) TestFollow(t *testing.T) {
            // Reader sends all logs and closes after logger is closed
            // - Starting from empty log (like run)
            for i, tail := range []int{-1, 0, 1, 42} {
                i, tail := i, tail
        Severity: Major
        Found in daemon/logger/loggertest/logreader.go - About 5 hrs to fix

          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 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 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 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 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 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

          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 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 167 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
                Severity
                Category
                Status
                Source
                Language