dotcloud/docker

View on GitHub

Showing 1,468 of 1,914 total issues

Function pullEndpoints has a Cognitive Complexity of 32 (exceeds 20 allowed). Consider refactoring.
Open

func pullEndpoints(ctx context.Context, registryService RegistryResolver, ref reference.Named,
    f func(context.Context, registry.RepositoryInfo, registry.APIEndpoint) error,
) (*registry.RepositoryInfo, error) {
    // Resolve the Repository name from fqn to RepositoryInfo
    repoInfo, err := registryService.ResolveRepository(ref)
Severity: Minor
Found in distribution/pull.go - About 2 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 LayerDownloadManager.makeDownloadFuncFromDownload has a Cognitive Complexity of 32 (exceeds 20 allowed). Consider refactoring.
Open

func (ldm *LayerDownloadManager) makeDownloadFuncFromDownload(descriptor DownloadDescriptor, sourceDownload *downloadTransfer, parentDownload *downloadTransfer) doFunc {
    return func(progressChan chan<- progress.Progress, start <-chan struct{}, inactive chan<- struct{}) transfer {
        d := &downloadTransfer{
            transfer:   newTransfer(),
            layerStore: ldm.layerStore,
Severity: Minor
Found in distribution/xfer/download.go - About 2 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 NetworkPushPull.Unmarshal has 25 return statements (exceeds 4 allowed).
Open

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

    Method VolumeStore.restore has a Cognitive Complexity of 32 (exceeds 20 allowed). Consider refactoring.
    Open

    func (s *VolumeStore) restore() {
        var ls []volumeMetadata
        s.db.View(func(tx *bolt.Tx) error {
            ls = listMeta(tx)
            return nil
    Severity: Minor
    Found in volume/service/restore.go - About 2 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.CreateEndpoint has a Cognitive Complexity of 32 (exceeds 20 allowed). Consider refactoring.
    Open

    func (d *driver) CreateEndpoint(ctx context.Context, nid, eid string, ifInfo driverapi.InterfaceInfo, epOptions map[string]interface{}) error {
        ctx, span := otel.Tracer("").Start(ctx, fmt.Sprintf("libnetwork.drivers.windows_%s.CreateEndpoint", d.name), trace.WithAttributes(
            attribute.String("nid", nid),
            attribute.String("eid", eid)))
        defer span.End()
    Severity: Minor
    Found in libnetwork/drivers/windows/windows.go - About 2 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 withCommonOptions has a Cognitive Complexity of 32 (exceeds 20 allowed). Consider refactoring.
    Open

    func withCommonOptions(daemon *Daemon, daemonCfg *dconfig.Config, c *container.Container) coci.SpecOpts {
        return func(ctx context.Context, _ coci.Client, _ *containers.Container, s *coci.Spec) error {
            if c.BaseFS == "" {
                return errors.New("populateCommonSpec: BaseFS of container " + c.ID + " is unexpectedly empty")
            }
    Severity: Minor
    Found in daemon/oci_linux.go - About 2 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 parseConfig has a Cognitive Complexity of 32 (exceeds 20 allowed). Consider refactoring.
    Open

    func parseConfig(cfg map[string]string) (fluent.Config, error) {
        var config fluent.Config
    
        loc, err := parseAddress(cfg[addressKey])
        if err != nil {
    Severity: Minor
    Found in daemon/logger/fluentd/fluentd.go - About 2 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 logStream.collectBatch has a Cognitive Complexity of 32 (exceeds 20 allowed). Consider refactoring.
    Open

    func (l *logStream) collectBatch(created chan bool) {
        // Wait for the logstream/group to be created
        <-created
        flushInterval := l.forceFlushInterval
        if flushInterval <= 0 {
    Severity: Minor
    Found in daemon/logger/awslogs/cloudwatchlogs.go - About 2 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 includeContainerInList has 25 return statements (exceeds 4 allowed).
    Open

    func includeContainerInList(container *container.Snapshot, filter *listContext) iterationAction {
        // Do not include container if it's in the list before the filter container.
        // Set the filter container to nil to include the rest of containers after this one.
        if filter.beforeFilter != nil {
            if container.ID == filter.beforeFilter.ID {
    Severity: Major
    Found in daemon/list.go - About 2 hrs to fix

      Method Manager.Push has 81 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func (pm *Manager) Push(ctx context.Context, name string, metaHeader http.Header, authConfig *registry.AuthConfig, outStream io.Writer) error {
          p, err := pm.config.Store.GetV2Plugin(name)
          if err != nil {
              return err
          }
      Severity: Major
      Found in plugin/backend_linux.go - About 2 hrs to fix

        Method CompoundMessage_SimpleMessage.Unmarshal has 81 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

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

          Method CompoundMessage.Unmarshal has 81 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

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

            File image_builder.go has 510 lines of code (exceeds 500 allowed). Consider refactoring.
            Open

            package containerd
            
            import (
                "bytes"
                "context"
            Severity: Minor
            Found in daemon/containerd/image_builder.go - About 2 hrs to fix

              Method Controller.NewSandbox has 80 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func (c *Controller) NewSandbox(ctx context.Context, containerID string, options ...SandboxOption) (_ *Sandbox, retErr error) {
                  if containerID == "" {
                      return nil, types.InvalidParameterErrorf("invalid container ID")
                  }
              
              
              Severity: Major
              Found in libnetwork/controller.go - About 2 hrs to fix

                Method driver.configure has 80 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func (d *driver) configure(option map[string]interface{}) error {
                    var (
                        config            configuration
                        err               error
                        natChain          *iptables.ChainInfo
                Severity: Major
                Found in libnetwork/drivers/bridge/bridge_linux.go - About 2 hrs to fix

                  Method PortConfig.Unmarshal has 24 return statements (exceeds 4 allowed).
                  Open

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

                    Method PeerRecord.Unmarshal has 24 return statements (exceeds 4 allowed).
                    Open

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

                      Worker has 21 methods (exceeds 20 allowed). Consider refactoring.
                      Open

                      type Worker struct {
                          Opt
                          SourceManager *source.Manager
                      }
                      Severity: Minor
                      Found in builder/builder-next/worker/worker.go - About 2 hrs to fix

                        Function verifyPlatformContainerResources has 24 return statements (exceeds 4 allowed).
                        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: Major
                        Found in daemon/daemon_windows.go - About 2 hrs to fix

                          Method PortMapper.MapRange has 79 lines of code (exceeds 50 allowed). Consider refactoring.
                          Open

                          func (pm *PortMapper) MapRange(container net.Addr, hostIP net.IP, hostPortStart, hostPortEnd int) (host net.Addr, retErr error) {
                              pm.lock.Lock()
                              defer pm.lock.Unlock()
                          
                              var (
                          Severity: Major
                          Found in libnetwork/portmapper/mapper.go - About 2 hrs to fix
                            Severity
                            Category
                            Status
                            Source
                            Language