dotcloud/docker

View on GitHub

Showing 1,885 of 1,885 total issues

Method containerRouter.getContainersJSON has 5 return statements (exceeds 4 allowed).
Open

func (s *containerRouter) getContainersJSON(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
    if err := httputils.ParseForm(r); err != nil {
        return err
    }
    filter, err := filters.FromJSON(r.Form.Get("filters"))
Severity: Major
Found in api/server/router/container/container_routes.go - About 35 mins to fix

    Method Args.MatchKVList has 5 return statements (exceeds 4 allowed).
    Open

    func (args Args) MatchKVList(key string, sources map[string]string) bool {
        fieldValues := args.fields[key]
    
        // do not filter if there is no filter set or cannot determine filter
        if len(fieldValues) == 0 {
    Severity: Major
    Found in api/types/filters/parse.go - About 35 mins to fix

      Method gitRepo.checkout has 5 return statements (exceeds 4 allowed).
      Open

      func (repo gitRepo) checkout(root string) (string, error) {
          // Try checking out by ref name first. This will work on branches and sets
          // .git/HEAD to the current branch name
          if output, err := repo.gitWithinDir(root, "checkout", repo.ref); err != nil {
              // If checking out by branch name fails check out the last fetched ref
      Severity: Major
      Found in builder/remotecontext/git/gitutils.go - About 35 mins to fix

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

        func FromArchive(tarStream io.Reader) (builder.Source, error) {
            root, err := longpath.MkdirTemp("", "docker-builder")
            if err != nil {
                return nil, err
            }
        Severity: Major
        Found in builder/remotecontext/archive.go - About 35 mins to fix

          Method Worker.ResolveSourceMetadata has 5 return statements (exceeds 4 allowed).
          Open

          func (w *Worker) ResolveSourceMetadata(ctx context.Context, op *pb.SourceOp, opt sourceresolver.Opt, sm *session.Manager, g session.Group) (*sourceresolver.MetaResponse, error) {
              if opt.SourcePolicies != nil {
                  return nil, errors.New("source policies can not be set for worker")
              }
          
          
          Severity: Major
          Found in builder/builder-next/worker/worker.go - About 35 mins to fix

            Method volumeRouter.putVolumesUpdate has 5 return statements (exceeds 4 allowed).
            Open

            func (v *volumeRouter) putVolumesUpdate(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
                if !v.cluster.IsManager() {
                    return errdefs.Unavailable(errors.New("volume update only valid for cluster volumes, but swarm is unavailable"))
                }
            
            
            Severity: Major
            Found in api/server/router/volume/volume_routes.go - About 35 mins to fix

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

              func getAccountIdentity(ctx context.Context, builder *Builder, accountName string, ctrRootPath string, state *dispatchState) (idtools.Identity, error) {
                  // If this is potentially a string SID then attempt to convert it to verify
                  // this, otherwise continue looking for the account.
                  if strings.HasPrefix(accountName, "S-") || strings.HasPrefix(accountName, "s-") {
                      sid, err := windows.StringToSid(accountName)
              Severity: Major
              Found in builder/dockerfile/internals_windows.go - About 35 mins to fix

                Method swarmRouter.updateService has 5 return statements (exceeds 4 allowed).
                Open

                func (sr *swarmRouter) updateService(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
                    var service types.ServiceSpec
                    if err := httputils.ReadJSON(r, &service); err != nil {
                        return err
                    }
                Severity: Major
                Found in api/server/router/swarm/cluster_routes.go - About 35 mins to fix

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

                  func fixPermissionsWindows(source, destination, SID string) error {
                      privileges := []string{winio.SeRestorePrivilege, idtools.SeTakeOwnershipPrivilege}
                  
                      err := winio.EnableProcessPrivileges(privileges)
                      if err != nil {
                  Severity: Major
                  Found in builder/dockerfile/copy_windows.go - About 35 mins to fix

                    Method swarmRouter.getServices has 5 return statements (exceeds 4 allowed).
                    Open

                    func (sr *swarmRouter) getServices(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
                        if err := httputils.ParseForm(r); err != nil {
                            return err
                        }
                        filter, err := filters.FromJSON(r.Form.Get("filters"))
                    Severity: Major
                    Found in api/server/router/swarm/cluster_routes.go - About 35 mins to fix

                      Method networkRouter.deleteNetwork has 5 return statements (exceeds 4 allowed).
                      Open

                      func (n *networkRouter) deleteNetwork(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
                          if err := httputils.ParseForm(r); err != nil {
                              return err
                          }
                      
                      
                      Severity: Major
                      Found in api/server/router/network/network_routes.go - About 35 mins to fix

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

                        func toBuildkitExtraHosts(inp []string, hostGatewayIP net.IP) (string, error) {
                            if len(inp) == 0 {
                                return "", nil
                            }
                            hosts := make([]string, 0, len(inp))
                        Severity: Major
                        Found in builder/builder-next/builder.go - About 35 mins to fix

                          Method imageRouter.getImagesSearch has 5 return statements (exceeds 4 allowed).
                          Open

                          func (ir *imageRouter) getImagesSearch(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
                              if err := httputils.ParseForm(r); err != nil {
                                  return err
                              }
                          
                          
                          Severity: Major
                          Found in api/server/router/image/image_routes.go - About 35 mins to fix

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

                            func dispatchTriggeredOnBuild(ctx context.Context, d dispatchRequest, triggers []string) error {
                                fmt.Fprintf(d.builder.Stdout, "# Executing %d build trigger", len(triggers))
                                if len(triggers) > 1 {
                                    fmt.Fprint(d.builder.Stdout, "s")
                                }
                            Severity: Major
                            Found in builder/dockerfile/dispatchers.go - About 35 mins to fix

                              Method task.Pause has 5 return statements (exceeds 4 allowed).
                              Open

                              func (t *task) Pause(_ context.Context) error {
                                  if t.ctr.ociSpec.Windows.HyperV == nil {
                                      return cerrdefs.ErrNotImplemented
                                  }
                              
                              
                              Severity: Major
                              Found in libcontainerd/local/local_windows.go - About 35 mins to fix

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

                                func validateAddress(address string, subnet netip.Prefix, subnetFamily ipFamily) error {
                                    if address == "" {
                                        return nil
                                    }
                                    addr, err := netip.ParseAddr(address)
                                Severity: Major
                                Found in api/types/network/ipam.go - About 35 mins to fix

                                  Method container.createIO has 5 return statements (exceeds 4 allowed).
                                  Open

                                  func (c *container) createIO(fifos *cio.FIFOSet, stdinCloseSync chan containerd.Process, attachStdio libcontainerdtypes.StdioCallback) (cio.IO, error) {
                                      var (
                                          io  *cio.DirectIO
                                          err error
                                      )
                                  Severity: Major
                                  Found in libcontainerd/remote/client.go - About 35 mins to fix

                                    Method task.Exec has 5 return statements (exceeds 4 allowed).
                                    Open

                                    func (t *task) Exec(ctx context.Context, processID string, spec *specs.Process, withStdin bool, attachStdio libcontainerdtypes.StdioCallback) (_ libcontainerdtypes.Process, retErr error) {
                                        hcsContainer, err := t.getHCSContainer()
                                        if err != nil {
                                            return nil, err
                                        }
                                    Severity: Major
                                    Found in libcontainerd/local/local_windows.go - About 35 mins to fix

                                      Method task.Resume has 5 return statements (exceeds 4 allowed).
                                      Open

                                      func (t *task) Resume(ctx context.Context) error {
                                          if t.ctr.ociSpec.Windows.HyperV == nil {
                                              return errors.New("cannot resume Windows Server Containers")
                                          }
                                      
                                      
                                      Severity: Major
                                      Found in libcontainerd/local/local_windows.go - About 35 mins to fix

                                        Method container.NewTask has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring.
                                        Open

                                        func (c *container) NewTask(ctx context.Context, checkpointDir string, withStdin bool, attachStdio libcontainerdtypes.StdioCallback) (libcontainerdtypes.Task, error) {
                                            var (
                                                checkpoint     *types.Descriptor
                                                t              containerd.Task
                                                rio            cio.IO
                                        Severity: Minor
                                        Found in libcontainerd/remote/client.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

                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language