dotcloud/docker

View on GitHub

Showing 1,468 of 1,914 total issues

Method ImageService.GetImageAndReleasableLayer has a Cognitive Complexity of 27 (exceeds 20 allowed). Consider refactoring.
Open

func (i *ImageService) GetImageAndReleasableLayer(ctx context.Context, refOrID string, opts backend.GetImageAndLayerOptions) (builder.Image, builder.ROLayer, error) {
    if refOrID == "" { // FROM scratch
        if runtime.GOOS == "windows" {
            return nil, nil, fmt.Errorf(`"FROM scratch" is not supported on Windows`)
        }
Severity: Minor
Found in daemon/containerd/image_builder.go - About 1 hr 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.setWindowsCredentialSpec has a Cognitive Complexity of 27 (exceeds 20 allowed). Consider refactoring.
Open

func (daemon *Daemon) setWindowsCredentialSpec(c *container.Container, s *specs.Spec) error {
    if c.HostConfig == nil || c.HostConfig.SecurityOpt == nil {
        return nil
    }

Severity: Minor
Found in daemon/oci_windows.go - About 1 hr 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.fillRootlessVersion has a Cognitive Complexity of 27 (exceeds 20 allowed). Consider refactoring.
Open

func (daemon *Daemon) fillRootlessVersion(ctx context.Context, v *types.Version) error {
    if !rootless.RunningWithRootlessKit() {
        return nil
    }
    rlc, err := getRootlessKitClient()
Severity: Minor
Found in daemon/info_unix.go - About 1 hr 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.NetworkAllocate has 60 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func (d *driver) NetworkAllocate(id string, option map[string]string, ipV4Data, ipV6Data []driverapi.IPAMData) (map[string]string, error) {
    if id == "" {
        return nil, fmt.Errorf("invalid network id for overlay network")
    }

Severity: Minor
Found in libnetwork/drivers/overlay/ovmanager/ovmanager.go - About 1 hr to fix

    Method driver.createNetwork has 60 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func (d *driver) createNetwork(config *configuration) (bool, error) {
        foundExisting := false
        networkList := d.getNetworks()
        for _, nw := range networkList {
            if config.Parent == nw.config.Parent {
    Severity: Minor
    Found in libnetwork/drivers/macvlan/macvlan_network.go - About 1 hr to fix

      Method driver.Join has 60 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func (d *driver) Join(_ context.Context, nid, eid string, sboxKey string, jinfo driverapi.JoinInfo, options map[string]interface{}) (retErr error) {
          join := &api.JoinRequest{
              NetworkID:  nid,
              EndpointID: eid,
              SandboxKey: sboxKey,
      Severity: Minor
      Found in libnetwork/drivers/remote/driver.go - About 1 hr to fix

        Method Resolver.forwardExtDNS has 60 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func (r *Resolver) forwardExtDNS(ctx context.Context, proto string, remoteAddr net.Addr, query *dns.Msg) *dns.Msg {
            ctx, span := otel.Tracer("").Start(ctx, "resolver.forwardExtDNS")
            defer span.End()
        
            proxyDNS := r.proxyDNS.Load()
        Severity: Minor
        Found in libnetwork/resolver.go - About 1 hr to fix

          Method controller.Logs has 60 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func (r *controller) Logs(ctx context.Context, publisher exec.LogPublisher, options api.LogSubscriptionOptions) error {
              if err := r.checkClosed(); err != nil {
                  return err
              }
          
          
          Severity: Minor
          Found in daemon/cluster/executor/container/controller.go - About 1 hr to fix

            Method Info.ExtraAttributes has 60 lines of code (exceeds 50 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 1 hr to fix

              Method layerStore.CreateRWLayer has 60 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func (ls *layerStore) CreateRWLayer(name string, parent ChainID, opts *CreateRWLayerOpts) (_ RWLayer, err error) {
                  var (
                      storageOpt map[string]string
                      initFunc   MountInit
                      mountLabel string
              Severity: Minor
              Found in layer/layer_store.go - About 1 hr to fix

                Function ensureHTTPServerImage has 60 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func ensureHTTPServerImage(t testing.TB) {
                    t.Helper()
                    var doIt bool
                    ensureHTTPServerOnce.Do(func() {
                        doIt = true
                Severity: Minor
                Found in testutil/fakestorage/fixtures.go - About 1 hr to fix

                  Method puller.pullSchema1 has 59 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

                  func (p *puller) pullSchema1(ctx context.Context, ref reference.Reference, unverifiedManifest *schema1.SignedManifest, platform *ocispec.Platform) (id digest.Digest, manifestDigest digest.Digest, err error) {
                      if platform != nil {
                          // Early bath if the requested OS doesn't match that of the configuration.
                          // This avoids doing the download, only to potentially fail later.
                          if err := image.CheckOS(platform.OS); err != nil {
                  Severity: Minor
                  Found in distribution/pull_v2.go - About 1 hr to fix

                    Function toRootless has 59 lines of code (exceeds 50 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 1 hr to fix

                      Function fetchTable has 59 lines of code (exceeds 50 allowed). Consider refactoring.
                      Open

                      func fetchTable(ip string, port int, network, tableName string, clusterPeers, networkPeers map[string]string, remediate bool) {
                          log.G(context.TODO()).Infof("Fetch %s table and check owners", tableName)
                          resp, err := http.Get(fmt.Sprintf(dumpTable, ip, port, network, tableName))
                          if err != nil {
                              log.G(context.TODO()).WithError(err).Fatalf("Failed fetching endpoint table")
                      Severity: Minor
                      Found in libnetwork/cmd/diagnostic/main.go - About 1 hr to fix

                        Method driver.parseNetworkOptions has 59 lines of code (exceeds 50 allowed). Consider refactoring.
                        Open

                        func (d *driver) parseNetworkOptions(id string, genericOptions map[string]string) (*networkConfiguration, error) {
                            config := &networkConfiguration{Type: d.name}
                        
                            for label, value := range genericOptions {
                                switch label {
                        Severity: Minor
                        Found in libnetwork/drivers/windows/windows.go - About 1 hr to fix

                          Function JobComplete has 59 lines of code (exceeds 50 allowed). Consider refactoring.
                          Open

                          func JobComplete(ctx context.Context, client client.CommonAPIClient, service swarmtypes.Service) func(log poll.LogT) poll.Result {
                              filter := filters.NewArgs(filters.Arg("service", service.ID))
                          
                              var jobIteration swarmtypes.Version
                              if service.JobStatus != nil {
                          Severity: Minor
                          Found in integration/internal/swarm/states.go - About 1 hr to fix

                            Function WithDevices has 59 lines of code (exceeds 50 allowed). Consider refactoring.
                            Open

                            func WithDevices(daemon *Daemon, c *container.Container) coci.SpecOpts {
                                return func(ctx context.Context, _ coci.Client, _ *containers.Container, s *coci.Spec) error {
                                    // Build lists of devices allowed and created within the container.
                                    var devs []specs.LinuxDevice
                                    devPermissions := s.Linux.Resources.Devices
                            Severity: Minor
                            Found in daemon/oci_linux.go - About 1 hr to fix

                              Function TaskFromGRPC has 59 lines of code (exceeds 50 allowed). Consider refactoring.
                              Open

                              func TaskFromGRPC(t swarmapi.Task) (types.Task, error) {
                                  containerStatus := t.Status.GetContainer()
                                  taskSpec, err := taskSpecFromGRPC(t.Spec)
                                  if err != nil {
                                      return types.Task{}, err
                              Severity: Minor
                              Found in daemon/cluster/convert/task.go - About 1 hr to fix

                                Function buildIPAMResources has 59 lines of code (exceeds 50 allowed). Consider refactoring.
                                Open

                                func buildIPAMResources(nw *libnetwork.Network) networktypes.IPAM {
                                    var ipamConfig []networktypes.IPAMConfig
                                
                                    ipamDriver, ipamOptions, ipv4Conf, ipv6Conf := nw.IpamConfig()
                                
                                
                                Severity: Minor
                                Found in daemon/network.go - About 1 hr to fix

                                  Function buildPortsRelatedCreateEndpointOptions has 59 lines of code (exceeds 50 allowed). Consider refactoring.
                                  Open

                                  func buildPortsRelatedCreateEndpointOptions(c *container.Container, n *libnetwork.Network, sb *libnetwork.Sandbox) ([]libnetwork.EndpointOption, error) {
                                      // Port-mapping rules belong to the container & applicable only to non-internal networks.
                                      //
                                      // TODO(thaJeztah): Look if we can provide a more minimal function for getPortMapInfo, as it does a lot, and we only need the "length".
                                      if n.Internal() || len(getPortMapInfo(sb)) > 0 {
                                  Severity: Minor
                                  Found in daemon/network.go - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language