dotcloud/docker

View on GitHub

Showing 1,468 of 1,914 total issues

Method TableEvent.Unmarshal has 48 return statements (exceeds 4 allowed).
Open

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

    Method Controller.sandboxCleanup has a Cognitive Complexity of 43 (exceeds 20 allowed). Consider refactoring.
    Open

    func (c *Controller) sandboxCleanup(activeSandboxes map[string]interface{}) error {
        sandboxStates, err := c.store.List(&sbState{c: c})
        if err != nil {
            if err == datastore.ErrKeyNotFound {
                // It's normal for no sandboxes to be found. Just bail out.
    Severity: Minor
    Found in libnetwork/sandbox_store.go - About 4 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.link has a Cognitive Complexity of 43 (exceeds 20 allowed). Consider refactoring.
    Open

    func (d *driver) link(network *bridgeNetwork, endpoint *bridgeEndpoint, enable bool) (retErr error) {
        cc := endpoint.containerConfig
        ec := endpoint.extConnConfig
        if cc == nil || ec == nil || (len(cc.ParentEndpoints) == 0 && len(cc.ChildEndpoints) == 0) {
            // nothing to do
    Severity: Minor
    Found in libnetwork/drivers/bridge/bridge_linux.go - About 4 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 verifyPlatformContainerResources has a Cognitive Complexity of 43 (exceeds 20 allowed). Consider refactoring.
    Open

    func verifyPlatformContainerResources(resources *containertypes.Resources, isHyperv bool) (warnings []string, err error) {
        fixMemorySwappiness(resources)
        if !isHyperv {
            // The processor resource controls are mutually exclusive on
            // Windows Server Containers, the order of precedence is
    Severity: Minor
    Found in daemon/daemon_windows.go - About 4 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 127 lines of code (exceeds 50 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: Major
    Found in image/tarexport/load.go - About 4 hrs to fix

      Method LayerDownloadManager.makeDownloadFunc has 127 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func (ldm *LayerDownloadManager) makeDownloadFunc(descriptor DownloadDescriptor, parentLayer layer.ChainID, parentDownload *downloadTransfer) doFunc {
          return func(progressChan chan<- progress.Progress, start <-chan struct{}, inactive chan<- struct{}) transfer {
              d := &downloadTransfer{
                  transfer:   newTransfer(),
                  layerStore: ldm.layerStore,
      Severity: Major
      Found in distribution/xfer/download.go - About 4 hrs to fix

        File cluster.go has 586 lines of code (exceeds 500 allowed). Consider refactoring.
        Open

        package networkdb
        
        import (
            "bytes"
            "context"
        Severity: Minor
        Found in libnetwork/networkdb/cluster.go - About 4 hrs to fix

          File builder.go has 585 lines of code (exceeds 500 allowed). Consider refactoring.
          Open

          package buildkit
          
          import (
              "context"
              "fmt"
          Severity: Minor
          Found in builder/builder-next/builder.go - About 4 hrs to fix

            Method Daemon.ContainerRename has 126 lines of code (exceeds 50 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: Major
            Found in daemon/rename.go - About 4 hrs to fix

              Method puller.pullTag has 124 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func (p *puller) pullTag(ctx context.Context, ref reference.Named, platform *ocispec.Platform) (tagUpdated bool, err error) {
                  var (
                      tagOrDigest string // Used for logging/progress only
                      dgst        digest.Digest
                      mt          string
              Severity: Major
              Found in distribution/pull_v2.go - About 3 hrs to fix

                Method Client.imageBuildOptionsToQuery has 124 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func (cli *Client) imageBuildOptionsToQuery(ctx context.Context, options types.ImageBuildOptions) (url.Values, error) {
                    query := url.Values{}
                    if len(options.Tags) > 0 {
                        query["t"] = options.Tags
                    }
                Severity: Major
                Found in client/image_build.go - About 3 hrs to fix

                  Method Daemon.fillPlatformInfo has 124 lines of code (exceeds 50 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: Major
                  Found in daemon/info_unix.go - About 3 hrs to fix

                    Function toRootless has a Cognitive Complexity of 42 (exceeds 20 allowed). Consider refactoring.
                    Open

                    func toRootless(spec *specs.Spec, v2Controllers []string, currentOOMScoreAdj int) error {
                        if len(v2Controllers) == 0 {
                            if spec.Linux != nil {
                                // Remove cgroup settings.
                                spec.Linux.Resources = nil
                    Severity: Minor
                    Found in internal/rootless/specconv/specconv_linux.go - About 3 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 newProxy has a Cognitive Complexity of 42 (exceeds 20 allowed). Consider refactoring.
                    Open

                    func newProxy(config ProxyConfig) (p Proxy, err error) {
                        ipv := ip4
                        if config.HostIP.To4() == nil {
                            ipv = ip6
                        }
                    Severity: Minor
                    Found in cmd/docker-proxy/main_linux.go - About 3 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 cnmNetworkAllocator.IsServiceAllocated has a Cognitive Complexity of 42 (exceeds 20 allowed). Consider refactoring.
                    Open

                    func (na *cnmNetworkAllocator) IsServiceAllocated(s *api.Service, flags ...func(*networkallocator.ServiceAllocationOpts)) bool {
                        specNetworks := serviceNetworks(s)
                    
                        // If endpoint mode is VIP and allocator does not have the
                        // service in VIP allocated set then it needs to be allocated.
                    Severity: Minor
                    Found in libnetwork/cnmallocator/networkallocator.go - About 3 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 imageExporterInstance.Export has a Cognitive Complexity of 42 (exceeds 20 allowed). Consider refactoring.
                    Open

                    func (e *imageExporterInstance) Export(ctx context.Context, inp *exporter.Source, inlineCache exptypes.InlineCache, sessionID string) (map[string]string, exporter.DescriptorReference, error) {
                        if len(inp.Refs) > 1 {
                            return nil, nil, fmt.Errorf("exporting multiple references to image store is currently unsupported")
                        }
                    
                    
                    Severity: Minor
                    Found in builder/builder-next/exporter/mobyexporter/export.go - About 3 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 adjustForAPIVersion has a Cognitive Complexity of 42 (exceeds 20 allowed). Consider refactoring.
                    Open

                    func adjustForAPIVersion(cliVersion string, service *swarm.ServiceSpec) {
                        if cliVersion == "" {
                            return
                        }
                        if versions.LessThan(cliVersion, "1.46") {
                    Severity: Minor
                    Found in api/server/router/swarm/helpers.go - About 3 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.getSameReferences has a Cognitive Complexity of 42 (exceeds 20 allowed). Consider refactoring.
                    Open

                    func (i *ImageService) getSameReferences(ctx context.Context, named reference.Named, imgs []images.Image) ([]images.Image, error) {
                        var (
                            tag        string
                            sameRef    []images.Image
                            digestRefs = []images.Image{}
                    Severity: Minor
                    Found in daemon/containerd/image_delete.go - About 3 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 New has a Cognitive Complexity of 42 (exceeds 20 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: Minor
                    Found in daemon/logger/splunk/splunk.go - About 3 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.containerAttach has a Cognitive Complexity of 42 (exceeds 20 allowed). Consider refactoring.
                    Open

                    func (daemon *Daemon) containerAttach(c *container.Container, cfg *stream.AttachConfig, logs, doStream bool) error {
                        if logs {
                            logDriver, logCreated, err := daemon.getLogger(c)
                            if err != nil {
                                return err
                    Severity: Minor
                    Found in daemon/attach.go - About 3 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