dotcloud/docker

View on GitHub

Showing 1,468 of 1,914 total issues

Method State.StateString has 7 return statements (exceeds 4 allowed).
Open

func (s *State) StateString() string {
    if s.Running {
        if s.Paused {
            return "paused"
        }
Severity: Major
Found in container/state.go - About 45 mins to fix

    Method stubExecutor.Run has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    func (w *stubExecutor) Run(ctx context.Context, id string, root executor.Mount, mounts []executor.Mount, process executor.ProcessInfo, started chan<- struct{}) (resourcetypes.Recorder, error) {
    Severity: Minor
    Found in builder/builder-next/executor_nolinux.go - About 45 mins to fix

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

      func (ir *imageRouter) postImagesPush(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
          metaHeaders := map[string][]string{}
          for k, v := range r.Header {
              if strings.HasPrefix(k, "X-Meta-") {
                  metaHeaders[k] = v
      Severity: Minor
      Found in api/server/router/image/image_routes.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 containerRouter.postContainerExecStart has 7 return statements (exceeds 4 allowed).
      Open

      func (c *containerRouter) postContainerExecStart(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/container/exec.go - About 45 mins to fix

        Method imageRouter.postImagesPush has 7 return statements (exceeds 4 allowed).
        Open

        func (ir *imageRouter) postImagesPush(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
            metaHeaders := map[string][]string{}
            for k, v := range r.Header {
                if strings.HasPrefix(k, "X-Meta-") {
                    metaHeaders[k] = v
        Severity: Major
        Found in api/server/router/image/image_routes.go - About 45 mins to fix

          Method Worker.FromRemote has 7 return statements (exceeds 4 allowed).
          Open

          func (w *Worker) FromRemote(ctx context.Context, remote *solver.Remote) (cache.ImmutableRef, error) {
              rootfs, err := getLayers(ctx, remote.Descriptors)
              if err != nil {
                  return nil, err
              }
          Severity: Major
          Found in builder/builder-next/worker/worker.go - About 45 mins to fix

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

            func ReadCertsDirectory(tlsConfig *tls.Config, directory string) error {
                fs, err := os.ReadDir(directory)
                if err != nil && !os.IsNotExist(err) {
                    return invalidParam(err)
                }
            Severity: Major
            Found in registry/registry.go - About 45 mins to fix

              Method distributionRouter.getDistributionInfo has 7 return statements (exceeds 4 allowed).
              Open

              func (s *distributionRouter) getDistributionInfo(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/distribution/distribution_routes.go - About 45 mins to fix

                Function handleSysctlBC has a Cognitive Complexity of 23 (exceeds 20 allowed). Consider refactoring.
                Open

                func handleSysctlBC(
                    hostConfig *container.HostConfig,
                    netConfig *network.NetworkingConfig,
                    version string,
                ) (string, error) {
                Severity: Minor
                Found in api/server/router/container/container_routes.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 dispatchRun has 7 return statements (exceeds 4 allowed).
                Open

                func dispatchRun(ctx context.Context, d dispatchRequest, c *instructions.RunCommand) error {
                    if err := image.CheckOS(d.state.operatingSystem); err != nil {
                        return err
                    }
                
                
                Severity: Major
                Found in builder/dockerfile/dispatchers.go - About 45 mins to fix

                  Method gitRepo.clone has 7 return statements (exceeds 4 allowed).
                  Open

                  func (repo gitRepo) clone() (checkoutDir string, err error) {
                      fetch := fetchArgs(repo.remote, repo.ref)
                  
                      root, err := os.MkdirTemp("", "docker-build-git")
                      if err != nil {
                  Severity: Major
                  Found in builder/remotecontext/git/gitutils.go - About 45 mins to fix

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

                    func (s *snapshotter) EnsureLayer(ctx context.Context, key string) ([]layer.DiffID, error) {
                        s.layerCreateLocker.Lock(key)
                        defer s.layerCreateLocker.Unlock(key)
                    
                        diffIDs, err := s.GetDiffIDs(ctx, key)
                    Severity: Minor
                    Found in builder/builder-next/adapters/snapshot/layer.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 newExecutor has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    func newExecutor(_, _ string, _ *libnetwork.Controller, _ *oci.DNSConfig, _ bool, _ idtools.IdentityMapping, _ string) (executor.Executor, error) {
                    Severity: Minor
                    Found in builder/builder-next/executor_nolinux.go - About 45 mins to fix

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

                      func BuildFromConfig(ctx context.Context, config *container.Config, changes []string, os string) (*container.Config, error) {
                          if len(changes) == 0 {
                              return config, nil
                          }
                      
                      
                      Severity: Major
                      Found in builder/dockerfile/builder.go - About 45 mins to fix

                        Method networkRouter.findUniqueNetwork has 7 return statements (exceeds 4 allowed).
                        Open

                        func (n *networkRouter) findUniqueNetwork(term string) (network.Inspect, error) {
                            listByFullName := map[string]network.Inspect{}
                            listByPartialID := map[string]network.Inspect{}
                        
                            filter := filters.NewArgs(filters.Arg("idOrName", term))
                        Severity: Major
                        Found in api/server/router/network/network_routes.go - About 45 mins to fix

                          Method Service.Search has 7 return statements (exceeds 4 allowed).
                          Open

                          func (s *Service) Search(ctx context.Context, searchFilters filters.Args, term string, limit int, authConfig *registry.AuthConfig, headers map[string][]string) ([]registry.SearchResult, error) {
                              if err := searchFilters.Validate(acceptedSearchFilterTags); err != nil {
                                  return nil, err
                              }
                          
                          
                          Severity: Major
                          Found in registry/search.go - About 45 mins to fix

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

                            func newExecutor(root, cgroupParent string, net *libnetwork.Controller, dnsConfig *oci.DNSConfig, rootless bool, idmap idtools.IdentityMapping, apparmorProfile string) (executor.Executor, error) {
                            Severity: Minor
                            Found in builder/builder-next/executor_linux.go - About 45 mins to fix

                              Method distributionRouter.fetchManifest has 7 return statements (exceeds 4 allowed).
                              Open

                              func (s *distributionRouter) fetchManifest(ctx context.Context, distrepo distribution.Repository, namedRef reference.Named) (registry.DistributionInspect, error) {
                                  var distributionInspect registry.DistributionInspect
                                  if canonicalRef, ok := namedRef.(reference.Canonical); !ok {
                                      namedRef = reference.TagNameOnly(namedRef)
                              
                              
                              Severity: Major
                              Found in api/server/router/distribution/distribution_routes.go - About 45 mins to fix

                                Method requestReader.Read has 7 return statements (exceeds 4 allowed).
                                Open

                                func (r *requestReader) Read(p []byte) (n int, err error) {
                                    if r.client == nil || r.request == nil {
                                        return 0, fmt.Errorf("client and request can't be nil")
                                    }
                                    isFreshRequest := false
                                Severity: Major
                                Found in registry/resumable/resumablerequestreader.go - About 45 mins to fix

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

                                  func parseChownFlag(ctx context.Context, builder *Builder, state *dispatchState, chown, ctrRootPath string, identityMapping idtools.IdentityMapping) (idtools.Identity, error) {
                                      var userStr, grpStr string
                                      parts := strings.Split(chown, ":")
                                      if len(parts) > 2 {
                                          return idtools.Identity{}, errors.New("invalid chown string format: " + chown)
                                  Severity: Major
                                  Found in builder/dockerfile/internals_linux.go - About 45 mins to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language