dotcloud/docker

View on GitHub

Showing 1,904 of 1,904 total issues

Method Daemon.buildSandboxOptions has 7 return statements (exceeds 4 allowed).
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: Major
Found in daemon/container_operations.go - About 45 mins to fix

    Method Daemon.findAndAttachNetwork has 7 return statements (exceeds 4 allowed).
    Open

    func (daemon *Daemon) findAndAttachNetwork(ctr *container.Container, idOrName string, epConfig *networktypes.EndpointSettings) (*libnetwork.Network, *networktypes.NetworkingConfig, error) {
        id := getNetworkID(idOrName, epConfig)
    
        n, err := daemon.FindNetwork(id)
        if err != nil {
    Severity: Major
    Found in daemon/container_operations.go - About 45 mins to fix

      Method ImageService.PullImage has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      func (i *ImageService) PullImage(ctx context.Context, ref reference.Named, platform *ocispec.Platform, metaHeaders map[string][]string, authConfig *registry.AuthConfig, outStream io.Writer) error {
      Severity: Minor
      Found in daemon/images/image_pull.go - About 45 mins to fix

        Method ImageService.PushImage has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        func (i *ImageService) PushImage(ctx context.Context, ref reference.Named, platform *ocispec.Platform, metaHeaders map[string][]string, authConfig *registry.AuthConfig, outStream io.Writer) error {
        Severity: Minor
        Found in daemon/images/image_push.go - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                              if retryCount >= 5 {
                                  return nil, nil, fmt.Errorf("could not find network %s after successful attachment", idOrName)
                              }
          Severity: Major
          Found in daemon/container_operations.go - About 45 mins to fix

            Method Daemon.DisconnectFromNetwork has 7 return statements (exceeds 4 allowed).
            Open

            func (daemon *Daemon) DisconnectFromNetwork(ctx context.Context, ctr *container.Container, networkName string, force bool) error {
                n, err := daemon.FindNetwork(networkName)
                ctr.Lock()
                defer ctr.Unlock()
            
            
            Severity: Major
            Found in daemon/container_operations.go - About 45 mins to fix

              Method Daemon.createSpec has 7 return statements (exceeds 4 allowed).
              Open

              func (daemon *Daemon) createSpec(ctx context.Context, daemonCfg *configStore, c *container.Container, mounts []container.Mount) (*specs.Spec, error) {
                  img, err := daemon.imageService.GetImage(ctx, string(c.ImageID), backend.GetImageOpts{})
                  if err != nil {
                      return nil, err
                  }
              Severity: Major
              Found in daemon/oci_windows.go - About 45 mins to fix

                Method ImageService.checkImageDeleteConflict has 7 return statements (exceeds 4 allowed).
                Open

                func (i *ImageService) checkImageDeleteConflict(imgID image.ID, mask conflictType) *imageDeleteConflict {
                    // Check if the image has any descendant images.
                    if mask&conflictDependentChild != 0 && len(i.imageStore.Children(imgID)) > 0 {
                        return &imageDeleteConflict{
                            hard:    true,
                Severity: Major
                Found in daemon/images/image_delete.go - About 45 mins to fix

                  Method Daemon.connectToNetwork has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  func (daemon *Daemon) connectToNetwork(ctx context.Context, cfg *config.Config, ctr *container.Container, idOrName string, endpointConfig *network.EndpointSettings, updateSettings bool) (retErr error) {
                  Severity: Minor
                  Found in daemon/container_operations.go - About 45 mins to fix

                    Method Daemon.ContainerTop has 7 return statements (exceeds 4 allowed).
                    Open

                    func (daemon *Daemon) ContainerTop(name string, psArgs string) (*containertypes.ContainerTopOKBody, error) {
                        // It's not at all an equivalent to linux 'ps' on Windows
                        if psArgs != "" {
                            return nil, errors.New("Windows does not support arguments to top")
                        }
                    Severity: Major
                    Found in daemon/top_windows.go - About 45 mins to fix

                      Method ImageService.ImportImage has 6 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                      func (i *ImageService) ImportImage(ctx context.Context, newRef reference.Named, platform *ocispec.Platform, msg string, layerReader io.Reader, changes []string) (image.ID, error) {
                      Severity: Minor
                      Found in daemon/images/image_import.go - About 45 mins to fix

                        Method ImageService.pullImageWithReference has 6 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                        func (i *ImageService) pullImageWithReference(ctx context.Context, ref reference.Named, platform *ocispec.Platform, metaHeaders map[string][]string, authConfig *registry.AuthConfig, outStream io.Writer) error {
                        Severity: Minor
                        Found in daemon/images/image_pull.go - About 45 mins to fix

                          Method Config.ValidatePlatformConfig has 7 return statements (exceeds 4 allowed).
                          Open

                          func (conf *Config) ValidatePlatformConfig() error {
                              if conf.EnableUserlandProxy {
                                  if conf.UserlandProxyPath == "" {
                                      return errors.New("invalid userland-proxy-path: userland-proxy is enabled, but userland-proxy-path is not set")
                                  }
                          Severity: Major
                          Found in daemon/config/config_linux.go - About 45 mins to fix

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

                            func (daemon *Daemon) foldFilter(ctx context.Context, view *container.View, config *containertypes.ListOptions) (*listContext, error) {
                                psFilters := config.Filters
                            
                                var filtExited []int
                            
                            
                            Severity: Minor
                            Found in daemon/list.go - About 45 mins 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 getConflictFreeConfiguration has 7 return statements (exceeds 4 allowed).
                            Open

                            func getConflictFreeConfiguration(configFile string, flags *pflag.FlagSet) (*Config, error) {
                                b, err := os.ReadFile(configFile)
                                if err != nil {
                                    return nil, err
                                }
                            Severity: Major
                            Found in daemon/config/config.go - About 45 mins to fix

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

                              func (daemon *Daemon) clusterNetworksPrune(ctx context.Context, pruneFilters filters.Args) (*network.PruneReport, error) {
                                  rep := &network.PruneReport{}
                              
                                  until, _ := getUntilFromPruneFilters(pruneFilters)
                              
                              
                              Severity: Minor
                              Found in daemon/prune.go - About 45 mins 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 NaiveDiffDriver.Diff has 7 return statements (exceeds 4 allowed).
                              Open

                              func (gdw *NaiveDiffDriver) Diff(id, parent string) (arch io.ReadCloser, err error) {
                                  startTime := time.Now()
                                  driver := gdw.ProtoDriver
                              
                                  layerRootFs, err := driver.Get(id, "")
                              Severity: Major
                              Found in daemon/graphdriver/fsdiff.go - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                                        if _, err := i.removeImageRef(repoRef); err != nil {
                                                            return records, err
                                                        }
                                Severity: Major
                                Found in daemon/images/image_delete.go - About 45 mins to fix

                                  Method Daemon.setupContainerDirs has 7 return statements (exceeds 4 allowed).
                                  Open

                                  func (daemon *Daemon) setupContainerDirs(c *container.Container) ([]container.Mount, error) {
                                      // Note, unlike Unix, we do NOT call into SetupWorkingDirectory as
                                      // this is done in VMCompute. Further, we couldn't do it for Hyper-V
                                      // containers anyway.
                                      if err := daemon.setupSecretDir(c); err != nil {
                                  Severity: Major
                                  Found in daemon/oci_windows.go - About 45 mins to fix

                                    Method Client.callWithRetry has 7 return statements (exceeds 4 allowed).
                                    Open

                                    func (c *Client) callWithRetry(serviceMethod string, data io.Reader, retry bool, reqOpts ...func(*RequestOpts)) (io.ReadCloser, error) {
                                        var retries int
                                        start := time.Now()
                                    
                                        var opts RequestOpts
                                    Severity: Major
                                    Found in pkg/plugins/client.go - About 45 mins to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language