dotcloud/docker

View on GitHub

Showing 1,468 of 1,914 total issues

Method RestartManager.ShouldRestart has 5 return statements (exceeds 4 allowed).
Open

func (rm *RestartManager) ShouldRestart(exitCode uint32, hasBeenManuallyStopped bool, executionDuration time.Duration) (bool, chan error, error) {
    if rm.policy.IsNone() {
        return false, nil, nil
    }
    rm.Lock()
Severity: Major
Found in restartmanager/restartmanager.go - About 35 mins to fix

    Function retryOnError has 5 return statements (exceeds 4 allowed).
    Open

    func retryOnError(err error) error {
        switch v := err.(type) {
        case errcode.Errors:
            if len(v) != 0 {
                return retryOnError(v[0])
    Severity: Major
    Found in distribution/errors.go - About 35 mins to fix

      Method v2MetadataService.Remove has 5 return statements (exceeds 4 allowed).
      Open

      func (serv *v2MetadataService) Remove(metadata V2Metadata) error {
          if serv.store == nil {
              // Support a service which has no backend storage, in this case
              // an remove becomes a no-op.
              // TODO: implement in memory storage
      Severity: Major
      Found in distribution/metadata/v2_metadata_service.go - About 35 mins to fix

        Function Join has 5 return statements (exceeds 4 allowed).
        Open

        func Join(_ context.Context, path, subpath string) (*SafePath, error) {
            base, subpart, err := evaluatePath(path, subpath)
            if err != nil {
                return nil, err
            }
        Severity: Major
        Found in internal/safepath/join_linux.go - About 35 mins to fix

          Method tarexporter.loadLayer has 5 return statements (exceeds 4 allowed).
          Open

          func (l *tarexporter) loadLayer(ctx context.Context, filename string, rootFS image.RootFS, id string, foreignSrc distribution.Descriptor, progressOutput progress.Output) (_ layer.Layer, outErr error) {
              ctx, span := tracing.StartSpan(ctx, "loadLayer")
              span.SetAttributes(tracing.Attribute("image.id", id))
              defer span.End()
              defer func() {
          Severity: Major
          Found in image/tarexport/load.go - About 35 mins to fix

            Function schema2ManifestDigest has 5 return statements (exceeds 4 allowed).
            Open

            func schema2ManifestDigest(ref reference.Named, mfst distribution.Manifest) (digest.Digest, error) {
                _, canonical, err := mfst.Payload()
                if err != nil {
                    return "", err
                }
            Severity: Major
            Found in distribution/pull_v2.go - About 35 mins to fix

              Function tempMountPoint has 5 return statements (exceeds 4 allowed).
              Open

              func tempMountPoint(sourceFd int) (string, error) {
                  var stat unix.Stat_t
                  err := unix_noeintr.Fstat(sourceFd, &stat)
                  if err != nil {
                      return "", errors.Wrap(err, "failed to Fstat mount source fd")
              Severity: Major
              Found in internal/safepath/join_linux.go - About 35 mins to fix

                Method LayerDownloadManager.Download has 5 return statements (exceeds 4 allowed).
                Open

                func (ldm *LayerDownloadManager) Download(ctx context.Context, initialRootFS image.RootFS, layers []DownloadDescriptor, progressOutput progress.Output) (image.RootFS, func(), error) {
                    var (
                        topLayer       layer.Layer
                        topDownload    *downloadTransfer
                        watcher        *watcher
                Severity: Major
                Found in distribution/xfer/download.go - About 35 mins to fix

                  Function kubernetesSafeOpen has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring.
                  Open

                  func kubernetesSafeOpen(base, subpath string) (int, error) {
                      // syscall.Openat flags used to traverse directories not following symlinks
                      const nofollowFlags = unix.O_RDONLY | unix.O_NOFOLLOW
                      // flags for getting file descriptor without following the symlink
                      const openFDFlags = unix.O_NOFOLLOW | unix.O_PATH
                  Severity: Minor
                  Found in internal/safepath/k8s_safeopen_linux.go - About 35 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 detectManifestBlobMediaType has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring.
                  Open

                  func detectManifestBlobMediaType(dt []byte) (string, error) {
                      var mfst struct {
                          MediaType string          `json:"mediaType"`
                          Manifests json.RawMessage `json:"manifests"` // oci index, manifest list
                          Config    json.RawMessage `json:"config"`    // schema2 Manifest
                  Severity: Minor
                  Found in distribution/manifest.go - About 35 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 GetRepositories has 5 return statements (exceeds 4 allowed).
                  Open

                  func GetRepositories(ctx context.Context, ref reference.Named, config *ImagePullConfig) ([]distribution.Repository, error) {
                      repoInfo, err := config.RegistryService.ResolveRepository(ref)
                      if err != nil {
                          return nil, errdefs.InvalidParameter(err)
                      }
                  Severity: Major
                  Found in distribution/repository.go - About 35 mins to fix

                    Method puller.pullSchema2Config has 5 return statements (exceeds 4 allowed).
                    Open

                    func (p *puller) pullSchema2Config(ctx context.Context, dgst digest.Digest) (configJSON []byte, err error) {
                        blobs := p.repo.Blobs(ctx)
                        err = retry(ctx, defaultMaxSchemaPullAttempts, defaultSchemaPullBackoff, func(ctx context.Context) (err error) {
                            configJSON, err = blobs.Get(ctx, dgst)
                            return err
                    Severity: Major
                    Found in distribution/pull_v2.go - About 35 mins to fix

                      Method PoolsOpt.Set has 5 return statements (exceeds 4 allowed).
                      Open

                      func (p *PoolsOpt) Set(value string) error {
                          csvReader := csv.NewReader(strings.NewReader(value))
                          fields, err := csvReader.Read()
                          if err != nil {
                              return err
                      Severity: Major
                      Found in opts/address_pools.go - About 35 mins to fix

                        Method Sandbox.updateGateway has 5 return statements (exceeds 4 allowed).
                        Open

                        func (sb *Sandbox) updateGateway(ep *Endpoint) error {
                            sb.mu.Lock()
                            osSbox := sb.osSbox
                            sb.mu.Unlock()
                            if osSbox == nil {
                        Severity: Major
                        Found in libnetwork/sandbox_linux.go - About 35 mins to fix

                          Function AddInterfaceFirewalld has 5 return statements (exceeds 4 allowed).
                          Open

                          func AddInterfaceFirewalld(intf string) error {
                              if !firewalldRunning {
                                  return nil
                              }
                          
                          
                          Severity: Major
                          Found in libnetwork/iptables/firewalld.go - About 35 mins to fix

                            Function getPluginClient has 5 return statements (exceeds 4 allowed).
                            Open

                            func getPluginClient(p plugingetter.CompatPlugin) (*plugins.Client, error) {
                                if v1, ok := p.(plugingetter.PluginWithV1Client); ok {
                                    return v1.Client(), nil
                                }
                            
                            
                            Severity: Major
                            Found in libnetwork/ipams/remote/remote.go - About 35 mins to fix

                              Function Register has 5 return statements (exceeds 4 allowed).
                              Open

                              func Register(r ipamapi.Registerer, pg plugingetter.PluginGetter, lAddrPools, gAddrPools []*ipamutils.NetworkToSplit) error {
                                  if err := defaultipam.Register(r, lAddrPools, gAddrPools); err != nil {
                                      return err
                                  }
                                  if err := windowsipam.Register(r); err != nil {
                              Severity: Major
                              Found in libnetwork/ipams/drivers.go - About 35 mins to fix

                                Method Allocator.getAddrSpace has 5 return statements (exceeds 4 allowed).
                                Open

                                func (a *Allocator) getAddrSpace(as string, v6 bool) (*addrSpace, error) {
                                    switch as {
                                    case localAddressSpace:
                                        if v6 {
                                            return a.local6, nil
                                Severity: Major
                                Found in libnetwork/ipams/defaultipam/allocator.go - About 35 mins to fix

                                  Method Endpoint.UpdateDNSNames has 5 return statements (exceeds 4 allowed).
                                  Open

                                  func (ep *Endpoint) UpdateDNSNames(dnsNames []string) error {
                                      nw := ep.getNetwork()
                                      c := nw.getController()
                                      sb, ok := ep.getSandbox()
                                      if !ok {
                                  Severity: Major
                                  Found in libnetwork/endpoint.go - About 35 mins to fix

                                    Method Allocator.RequestAddress has 5 return statements (exceeds 4 allowed).
                                    Open

                                    func (a *Allocator) RequestAddress(poolID string, prefAddress net.IP, opts map[string]string) (*net.IPNet, map[string]string, error) {
                                        log.G(context.TODO()).Debugf("RequestAddress(%s, %v, %v)", poolID, prefAddress, opts)
                                        k, err := PoolIDFromString(poolID)
                                        if err != nil {
                                            return nil, nil, types.InvalidParameterErrorf("invalid pool id: %s", poolID)
                                    Severity: Major
                                    Found in libnetwork/ipams/defaultipam/allocator.go - About 35 mins to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language