dotcloud/docker

View on GitHub

Showing 1,468 of 1,914 total issues

Method Daemon.setWindowsCredentialSpec has 9 return statements (exceeds 4 allowed).
Open

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

Severity: Major
Found in daemon/oci_windows.go - About 55 mins to fix

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

    func (daemon *Daemon) ContainersPrune(ctx context.Context, pruneFilters filters.Args) (*container.PruneReport, error) {
        if !daemon.pruneRunning.CompareAndSwap(false, true) {
            return nil, errPruneRunning
        }
        defer daemon.pruneRunning.Store(false)
    Severity: Minor
    Found in daemon/prune.go - About 55 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 Daemon.logNodeEvent has a Cognitive Complexity of 24 (exceeds 20 allowed). Consider refactoring.
    Open

    func (daemon *Daemon) logNodeEvent(action swarmapi.WatchActionKind, node *swarmapi.Node, oldNode *swarmapi.Node) {
        name := node.Spec.Annotations.Name
        if name == "" && node.Description != nil {
            name = node.Description.Hostname
        }
    Severity: Minor
    Found in daemon/events.go - About 55 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 ImageService.CommitImage has 9 return statements (exceeds 4 allowed).
    Open

    func (i *ImageService) CommitImage(ctx context.Context, c backend.CommitConfig) (image.ID, error) {
        if err := ctx.Err(); err != nil {
            return "", err
        }
    
    
    Severity: Major
    Found in daemon/images/image_commit.go - About 55 mins to fix

      Function readFrozenImageList has a Cognitive Complexity of 24 (exceeds 20 allowed). Consider refactoring.
      Open

      func readFrozenImageList(ctx context.Context, dockerfilePath string, images []string) (map[string]string, error) {
          f, err := os.Open(dockerfilePath)
          if err != nil {
              return nil, errors.Wrap(err, "error reading dockerfile")
          }
      Severity: Minor
      Found in testutil/fixtures/load/frozen.go - About 55 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 Daemon.CreateImageFromContainer has 9 return statements (exceeds 4 allowed).
      Open

      func (daemon *Daemon) CreateImageFromContainer(ctx context.Context, name string, c *backend.CreateImageConfig) (string, error) {
          start := time.Now()
      
          container, err := daemon.GetContainer(name)
          if err != nil {
      Severity: Major
      Found in daemon/commit.go - About 55 mins to fix

        Method layerStore.registerWithDescriptor has a Cognitive Complexity of 24 (exceeds 20 allowed). Consider refactoring.
        Open

        func (ls *layerStore) registerWithDescriptor(ts io.Reader, parent ChainID, descriptor distribution.Descriptor) (Layer, error) {
            // cErr is used to hold the error which will always trigger
            // cleanup of creates sources but may not be an error returned
            // to the caller (already exists).
            var cErr error
        Severity: Minor
        Found in layer/layer_store.go - About 55 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 decodeContainerConfig has 9 return statements (exceeds 4 allowed).
        Open

        func decodeContainerConfig(src io.Reader, si *sysinfo.SysInfo) (*container.Config, *container.HostConfig, *network.NetworkingConfig, error) {
            var w container.CreateRequest
            if err := loadJSON(src, &w); err != nil {
                return nil, nil, nil, err
            }
        Severity: Major
        Found in runconfig/config.go - About 55 mins to fix

          Method walker.walk has 9 return statements (exceeds 4 allowed).
          Open

          func (w *walker) walk(path string, i1, i2 os.FileInfo) (err error) {
              // Register these nodes with the return trees, unless we're still at the
              // (already-created) roots:
              if path != "/" {
                  if err := walkchunk(path, i1, w.dir1, w.root1); err != nil {
          Severity: Major
          Found in pkg/archive/changes_linux.go - About 55 mins to fix

            Method layerStore.registerWithDescriptor has 9 return statements (exceeds 4 allowed).
            Open

            func (ls *layerStore) registerWithDescriptor(ts io.Reader, parent ChainID, descriptor distribution.Descriptor) (Layer, error) {
                // cErr is used to hold the error which will always trigger
                // cleanup of creates sources but may not be an error returned
                // to the caller (already exists).
                var cErr error
            Severity: Major
            Found in layer/layer_store.go - About 55 mins to fix

              Function validateNetContainerMode has 9 return statements (exceeds 4 allowed).
              Open

              func validateNetContainerMode(c *container.Config, hc *container.HostConfig) error {
                  // FIXME(thaJeztah): a network named "container" (without colon) is not seen as "container-mode" network.
                  if string(hc.NetworkMode) != "container" && !hc.NetworkMode.IsContainer() {
                      return nil
                  }
              Severity: Major
              Found in runconfig/hostconfig.go - About 55 mins to fix

                Method layerStore.RegisterByGraphID has 9 return statements (exceeds 4 allowed).
                Open

                func (ls *layerStore) RegisterByGraphID(graphID string, parent ChainID, diffID DiffID, tarDataFile string, size int64) (Layer, error) {
                    // err is used to hold the error which will always trigger
                    // cleanup of creates sources but may not be an error returned
                    // to the caller (already exists).
                    var err error
                Severity: Major
                Found in layer/migration.go - About 55 mins to fix

                  Method Manager.Upgrade has 7 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  func (pm *Manager) Upgrade(ctx context.Context, ref reference.Named, name string, metaHeader http.Header, authConfig *registry.AuthConfig, privileges types.PluginPrivileges, outStream io.Writer) error {
                  Severity: Major
                  Found in plugin/backend_unsupported.go - About 50 mins to fix

                    Method Manager.Upgrade has 7 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    func (pm *Manager) Upgrade(ctx context.Context, ref reference.Named, name string, metaHeader http.Header, authConfig *registry.AuthConfig, privileges types.PluginPrivileges, outStream io.Writer) (err error) {
                    Severity: Major
                    Found in plugin/backend_linux.go - About 50 mins to fix

                      Function New has 7 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                      func New(ctx context.Context, rootDir string, cli *containerd.Client, ns string, exitHandler ExitHandler, shim string, shimOpts interface{}) (*Executor, error) {
                      Severity: Major
                      Found in plugin/executor/containerd/containerd.go - About 50 mins to fix

                        Function ReplaceContainer has 7 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                        func ReplaceContainer(ctx context.Context, client types.Client, id string, spec *specs.Spec, shim string, runtimeOptions interface{}, opts ...containerd.NewContainerOpts) (types.Container, error) {
                        Severity: Major
                        Found in libcontainerd/replace.go - About 50 mins to fix

                          Method store.restore has 8 return statements (exceeds 4 allowed).
                          Open

                          func (is *store) restore() error {
                              // As the code below is run when restoring all images (which can be "many"),
                              // constructing the "log.G(ctx).WithFields" is deliberately not "DRY", as the
                              // logger is only used for error-cases, and we don't want to do allocations
                              // if we don't need it. The "f" type alias is here is just for convenience,
                          Severity: Major
                          Found in image/store.go - About 50 mins to fix

                            Method ImageCache.GetCache has 8 return statements (exceeds 4 allowed).
                            Open

                            func (ic *ImageCache) GetCache(parentID string, cfg *containertypes.Config, platform ocispec.Platform) (string, error) {
                                imgID, err := ic.localImageCache.GetCache(parentID, cfg, platform)
                                if err != nil {
                                    return "", err
                                }
                            Severity: Major
                            Found in image/cache/cache.go - About 50 mins to fix

                              Function setupSeccomp has 8 return statements (exceeds 4 allowed).
                              Open

                              func setupSeccomp(config *Seccomp, rs *specs.Spec) (*specs.LinuxSeccomp, error) {
                                  if config == nil {
                                      return nil, nil
                                  }
                              
                              
                              Severity: Major
                              Found in profiles/seccomp/seccomp_linux.go - About 50 mins to fix

                                Method Manager.Upgrade has 8 return statements (exceeds 4 allowed).
                                Open

                                func (pm *Manager) Upgrade(ctx context.Context, ref reference.Named, name string, metaHeader http.Header, authConfig *registry.AuthConfig, privileges types.PluginPrivileges, outStream io.Writer) (err error) {
                                    p, err := pm.config.Store.GetV2Plugin(name)
                                    if err != nil {
                                        return err
                                    }
                                Severity: Major
                                Found in plugin/backend_linux.go - About 50 mins to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language