dotcloud/docker

View on GitHub

Showing 1,904 of 1,904 total issues

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 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

      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 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 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 Worker.GetRemotes has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            func (w *Worker) GetRemotes(ctx context.Context, ref cache.ImmutableRef, createIfNeeded bool, _ cacheconfig.RefConfig, all bool, s session.Group) ([]*solver.Remote, error) {
            Severity: Minor
            Found in builder/builder-next/worker/worker.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 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 Service.Search has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  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) {
                  Severity: Minor
                  Found in registry/search.go - About 45 mins to fix

                    Method buildRouter.postBuild has 7 return statements (exceeds 4 allowed).
                    Open

                    func (br *buildRouter) postBuild(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
                        var (
                            notVerboseBuffer = bytes.NewBuffer(nil)
                            version          = httputils.VersionFromContext(ctx)
                        )
                    Severity: Major
                    Found in api/server/router/build/build_routes.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 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 patchImageConfig has 7 return statements (exceeds 4 allowed).
                        Open

                        func patchImageConfig(dt []byte, dps []digest.Digest, history []ocispec.History, cache *exptypes.InlineCacheEntry) ([]byte, error) {
                            m := map[string]json.RawMessage{}
                            if err := json.Unmarshal(dt, &m); err != nil {
                                return nil, errors.Wrap(err, "failed to parse image config for patch")
                            }
                        Severity: Major
                        Found in builder/builder-next/exporter/mobyexporter/writer.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 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

                              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

                                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

                                  Method Backend.Build has 7 return statements (exceeds 4 allowed).
                                  Open

                                  func (b *Backend) Build(ctx context.Context, config backend.BuildConfig) (string, error) {
                                      options := config.Options
                                      useBuildKit := options.Version == types.BuilderBuildKit
                                  
                                      tags, err := sanitizeRepoAndTags(options.Tags)
                                  Severity: Major
                                  Found in api/server/backend/build/backend.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 initializeStage has 7 return statements (exceeds 4 allowed).
                                      Open

                                      func initializeStage(ctx context.Context, d dispatchRequest, cmd *instructions.Stage) error {
                                          err := d.builder.imageProber.Reset(ctx)
                                          if err != nil {
                                              return err
                                          }
                                      Severity: Major
                                      Found in builder/dockerfile/dispatchers.go - About 45 mins to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language