dotcloud/docker

View on GitHub

Showing 1,904 of 1,904 total issues

Function newRepository has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    ctx context.Context, repoInfo *registry.RepositoryInfo, endpoint registry.APIEndpoint,
    metaHeaders http.Header, authConfig *registrytypes.AuthConfig, actions ...string,
Severity: Minor
Found in distribution/registry.go - About 45 mins to fix

    Method manifestStore.getLocal has 7 return statements (exceeds 4 allowed).
    Open

    func (m *manifestStore) getLocal(ctx context.Context, desc ocispec.Descriptor, ref reference.Named) (distribution.Manifest, error) {
        ra, err := m.local.ReaderAt(ctx, desc)
        if err != nil {
            return nil, errors.Wrap(err, "error getting content store reader")
        }
    Severity: Major
    Found in distribution/manifest.go - About 45 mins to fix

      Function EnsureRemoveAll has 7 return statements (exceeds 4 allowed).
      Open

      func EnsureRemoveAll(dir string) error {
          notExistErr := make(map[string]bool)
      
          // track retries
          exitOnErr := make(map[string]int)
      Severity: Major
      Found in internal/containerfs/rm.go - About 45 mins to fix

        Method store.restore has a Cognitive Complexity of 23 (exceeds 20 allowed). Consider refactoring.
        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: Minor
        Found in image/store.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 Manager.Pull has 7 return statements (exceeds 4 allowed).
        Open

        func (pm *Manager) Pull(ctx context.Context, ref reference.Named, name string, metaHeader http.Header, authConfig *registry.AuthConfig, privileges types.PluginPrivileges, outStream io.Writer, opts ...CreateOpt) (err error) {
            pm.muGC.RLock()
            defer pm.muGC.RUnlock()
        
            // revalidate because Pull is public
        Severity: Major
        Found in plugin/backend_linux.go - About 45 mins to fix

          Method Store.resolvePluginID has 7 return statements (exceeds 4 allowed).
          Open

          func (ps *Store) resolvePluginID(idOrName string) (string, error) {
              if validFullID.MatchString(idOrName) {
                  return idOrName, nil
              }
          
          
          Severity: Major
          Found in plugin/store.go - About 45 mins to fix

            Function kubernetesSafeOpen has 7 return statements (exceeds 4 allowed).
            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: Major
            Found in internal/safepath/k8s_safeopen_linux.go - About 45 mins to fix

              Function evaluatePath has 7 return statements (exceeds 4 allowed).
              Open

              func evaluatePath(path, subpath string) (resolvedBasePath string, resolvedSubpath string, err error) {
                  baseResolved, err := filepath.EvalSymlinks(path)
                  if err != nil {
                      if errors.Is(err, os.ErrNotExist) {
                          return "", "", &ErrNotAccessible{Path: path, Cause: err}
              Severity: Major
              Found in internal/safepath/common.go - About 45 mins to fix

                Method KernelVersion.UnmarshalJSON has 7 return statements (exceeds 4 allowed).
                Open

                func (k *KernelVersion) UnmarshalJSON(version []byte) error {
                    var (
                        ver string
                        err error
                    )
                Severity: Major
                Found in profiles/seccomp/seccomp.go - About 45 mins to fix

                  Method pushDescriptor.layerAlreadyExists has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      ctx context.Context,
                      progressOutput progress.Output,
                      diffID layer.DiffID,
                      checkOtherRepositories bool,
                      maxExistenceCheckAttempts int,
                  Severity: Minor
                  Found in distribution/push_v2.go - About 45 mins to fix

                    Method Manager.fetch has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    func (pm *Manager) fetch(ctx context.Context, ref reference.Named, auth *registry.AuthConfig, out progress.Output, metaHeader http.Header, handlers ...images.Handler) (err error) {
                    Severity: Minor
                    Found in plugin/fetch_linux.go - About 45 mins to fix

                      Function splitConfigRootFSFromTar has 7 return statements (exceeds 4 allowed).
                      Open

                      func splitConfigRootFSFromTar(in io.ReadCloser, config *[]byte) io.ReadCloser {
                          pr, pw := io.Pipe()
                          go func() {
                              tarReader := tar.NewReader(in)
                              tarWriter := tar.NewWriter(pw)
                      Severity: Major
                      Found in plugin/backend_linux.go - About 45 mins to fix

                        Method tarexporter.loadLayer has 6 arguments (exceeds 4 allowed). Consider refactoring.
                        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) {
                        Severity: Minor
                        Found in image/tarexport/load.go - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                      } else if len(output) != 0 {
                                          return fmt.Errorf("could not delete linking rule from %s/%s: %s", c.Table, c.Name, output)
                                      }
                          Severity: Major
                          Found in libnetwork/iptables/iptables.go - About 45 mins to fix

                            Method Controller.deleteEndpointNameResolution has 6 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                            func (c *Controller) deleteEndpointNameResolution(svcName, svcID, nID, eID, containerName string, vip net.IP, serviceAliases, taskAliases []string, ip net.IP, rmService, multipleEntries bool, method string) error {
                            Severity: Minor
                            Found in libnetwork/service_common.go - About 45 mins to fix

                              Method Controller.addServiceBinding has 6 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                              func (c *Controller) addServiceBinding(svcName, svcID, nID, eID, containerName string, vip net.IP, ingressPorts []*PortConfig, serviceAliases, taskAliases []string, ip net.IP, method string) error {
                              Severity: Minor
                              Found in libnetwork/service_common.go - About 45 mins to fix

                                Method NetworkDB.handleNetworkEvent has 7 return statements (exceeds 4 allowed).
                                Open

                                func (nDB *NetworkDB) handleNetworkEvent(nEvent *NetworkEvent) bool {
                                    // Update our local clock if the received messages has newer
                                    // time.
                                    nDB.networkClock.Witness(nEvent.LTime)
                                
                                
                                Severity: Major
                                Found in libnetwork/networkdb/delegate.go - About 45 mins to fix

                                  Avoid deeply nested control flow statements.
                                  Open

                                              } else if len(output) != 0 {
                                                  return fmt.Errorf("could not delete establish rule from %s: %s", c.Table, output)
                                              }
                                  Severity: Major
                                  Found in libnetwork/iptables/iptables.go - About 45 mins to fix

                                    Function NewAllocator has 7 return statements (exceeds 4 allowed).
                                    Open

                                    func NewAllocator(lcAs, glAs []*ipamutils.NetworkToSplit) (*Allocator, error) {
                                        var (
                                            a                          Allocator
                                            err                        error
                                            lcAs4, lcAs6, glAs4, glAs6 []*ipamutils.NetworkToSplit
                                    Severity: Major
                                    Found in libnetwork/ipams/defaultipam/allocator.go - About 45 mins to fix

                                      Method Controller.handleEpTableEvent has 7 return statements (exceeds 4 allowed).
                                      Open

                                      func (c *Controller) handleEpTableEvent(ev events.Event) {
                                          var (
                                              nid   string
                                              eid   string
                                              value []byte
                                      Severity: Major
                                      Found in libnetwork/agent.go - About 45 mins to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language