docker/docker

View on GitHub

Showing 1,412 of 1,855 total issues

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

func (daemon *Daemon) openContainerFS(container *container.Container) (_ *containerFSView, err error) {
    ctx := context.TODO()

    if err := daemon.Mount(container); err != nil {
        return nil, err
Severity: Minor
Found in daemon/containerfs_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 PluginSpec.Unmarshal has 197 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func (m *PluginSpec) Unmarshal(dAtA []byte) error {
    l := len(dAtA)
    iNdEx := 0
    for iNdEx < l {
        preIndex := iNdEx
Severity: Major
Found in api/types/swarm/runtime/plugin.pb.go - About 6 hrs to fix

    File container_routes.go has 698 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: Minor
    Found in api/server/router/container/container_routes.go - About 6 hrs to fix

      Method CompoundMessage.Unmarshal has a Cognitive Complexity of 59 (exceeds 20 allowed). Consider refactoring.
      Open

      func (m *CompoundMessage) Unmarshal(dAtA []byte) error {
          l := len(dAtA)
          iNdEx := 0
          for iNdEx < l {
              preIndex := iNdEx
      Severity: Minor
      Found in libnetwork/networkdb/networkdb.pb.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 CompoundMessage_SimpleMessage.Unmarshal has a Cognitive Complexity of 59 (exceeds 20 allowed). Consider refactoring.
      Open

      func (m *CompoundMessage_SimpleMessage) Unmarshal(dAtA []byte) error {
          l := len(dAtA)
          iNdEx := 0
          for iNdEx < l {
              preIndex := iNdEx
      Severity: Minor
      Found in libnetwork/networkdb/networkdb.pb.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 ImageService.Images has 190 lines of code (exceeds 50 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: Major
      Found in daemon/images/image_list.go - About 6 hrs to fix

        Function ServiceSpecToGRPC has a Cognitive Complexity of 58 (exceeds 20 allowed). Consider refactoring.
        Open

        func ServiceSpecToGRPC(s types.ServiceSpec) (swarmapi.ServiceSpec, error) {
            name := s.Name
            if name == "" {
                name = namesgenerator.GetRandomName(0)
            }
        Severity: Minor
        Found in daemon/cluster/convert/service.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.UpdateService has a Cognitive Complexity of 58 (exceeds 20 allowed). Consider refactoring.
        Open

        func (c *Cluster) UpdateService(serviceIDOrName string, version uint64, spec swarm.ServiceSpec, flags types.ServiceUpdateOptions, queryRegistry bool) (*swarm.ServiceUpdateResponse, error) {
            var resp *swarm.ServiceUpdateResponse
        
            err := c.lockedManagerAction(func(ctx context.Context, state nodeState) error {
                err := c.populateNetworkID(ctx, state.controlClient, &spec)
        Severity: Minor
        Found in daemon/cluster/services.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 LogEntry.Unmarshal has 188 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func (m *LogEntry) Unmarshal(dAtA []byte) error {
            l := len(dAtA)
            iNdEx := 0
            for iNdEx < l {
                preIndex := iNdEx
        Severity: Major
        Found in api/types/plugins/logdriver/entry.pb.go - About 6 hrs to fix

          Method Builder.Build has 186 lines of code (exceeds 50 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: Major
          Found in builder/builder-next/builder.go - About 6 hrs to fix

            Method pushDescriptor.Upload has a Cognitive Complexity of 57 (exceeds 20 allowed). Consider refactoring.
            Open

            func (pd *pushDescriptor) Upload(ctx context.Context, progressOutput progress.Output) (distribution.Descriptor, error) {
                // Skip foreign layers unless this registry allows nondistributable artifacts.
                if !pd.endpoint.AllowNondistributableArtifacts {
                    if fs, ok := pd.layer.(distribution.Describable); ok {
                        if d := fs.Descriptor(); len(d.URLs) > 0 {
            Severity: Minor
            Found in distribution/push_v2.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 tarexporter.Load has a Cognitive Complexity of 57 (exceeds 20 allowed). Consider refactoring.
            Open

            func (l *tarexporter) Load(ctx context.Context, inTar io.ReadCloser, outStream io.Writer, quiet bool) (outErr error) {
                ctx, span := tracing.StartSpan(ctx, "tarexport.Load")
                defer span.End()
                defer func() {
                    span.SetStatus(outErr)
            Severity: Minor
            Found in image/tarexport/load.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 networkallocator.go has 684 lines of code (exceeds 500 allowed). Consider refactoring.
            Open

            package cnmallocator
            
            import (
                "context"
                "fmt"
            Severity: Minor
            Found in libnetwork/cnmallocator/networkallocator.go - About 6 hrs to fix

              Method BulkSyncMessage.Unmarshal has 184 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

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

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

                func (c *Cluster) ServiceLogs(ctx context.Context, selector *backend.LogSelector, config *container.LogsOptions) (<-chan *backend.LogMessage, error) {
                    c.mu.RLock()
                    defer c.mu.RUnlock()
                
                    state := c.currentNodeState()
                Severity: Minor
                Found in daemon/cluster/services.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.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

                  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, container *container.Container) ([]libnetwork.SandboxOption, error) {
                      var sboxOptions []libnetwork.SandboxOption
                      sboxOptions = append(sboxOptions, libnetwork.OptionHostname(container.Config.Hostname), libnetwork.OptionDomainname(container.Config.Domainname))
                  
                      if container.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
                    Severity
                    Category
                    Status
                    Source
                    Language