Showing 900 of 900 total issues

Method Local.Unshallow has 5 return statements (exceeds 4 allowed).
Open

func (repo *Local) Unshallow(ctx context.Context) error {
    if lock, err := repo.acquireFetchLock(ctx); err != nil {
        return fmt.Errorf("unable to acquire fetch lock: %w", err)
    } else {
        defer werf.ReleaseHostLock(lock)
Severity: Major
Found in pkg/git_repo/local.go - About 35 mins to fix

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

    func DoTasks(ctx context.Context, numberOfTasks int, options DoTasksOptions, taskFunc func(ctx context.Context, taskId int) error) error {
        if numberOfTasks == 0 {
            return nil
        }
    
    
    Severity: Major
    Found in pkg/util/parallel/parallel.go - About 35 mins to fix

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

      func NewNativeStoreOptions(rootlessUID int, driver StorageDriver) (*thirdparty.StoreOptions, error) {
          var (
              runRoot string
              err     error
          )
      Severity: Major
      Found in pkg/buildah/native_linux.go - About 35 mins to fix

        Method NativeBuildah.Containers has 5 return statements (exceeds 4 allowed).
        Open

        func (b *NativeBuildah) Containers(ctx context.Context, opts ContainersOptions) (image.ContainerList, error) {
            builders, err := buildah.OpenAllBuilders(b.Store)
            if err != nil {
                return nil, err
            }
        Severity: Major
        Found in pkg/buildah/native_linux.go - About 35 mins to fix

          Method BuildContextArchive.Create has 5 return statements (exceeds 4 allowed).
          Open

          func (a *BuildContextArchive) Create(ctx context.Context, opts container_backend.BuildContextArchiveCreateOptions) error {
              contextPathRelativeToGitWorkTree := filepath.Join(a.giterminismMgr.RelativeToGitProjectDir(), opts.ContextGitSubDir)
          
              dockerIgnorePathMatcher, err := createDockerIgnorePathMatcher(ctx, a.giterminismMgr, opts.ContextGitSubDir, opts.DockerfileRelToContextPath)
              if err != nil {
          Severity: Major
          Found in pkg/build/image/build_context_archive.go - About 35 mins to fix

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

            func SetWerfFirstRunAt(ctx context.Context) error {
                path := getWerfFirstRunAtPath()
                if _, lock, err := AcquireHostLock(ctx, path, lockgate.AcquireOptions{OnWaitFunc: func(lockName string, doWait func() error) error { return doWait() }}); err != nil {
                    return fmt.Errorf("error locking path %q: %w", path, err)
                } else {
            Severity: Major
            Found in pkg/werf/last_werf_run_at.go - About 35 mins to fix

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

              func (c *container) RmIfExist(ctx context.Context) error {
                  exist, err := docker.ContainerExist(ctx, c.Name)
                  if err != nil {
                      return err
                  }
              Severity: Major
              Found in pkg/stapel/container.go - About 35 mins to fix

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

                func InterfaceToStringArray(stringOrStringArray, configSection interface{}, doc *doc) ([]string, error) {
                    if stringOrStringArray == nil {
                        return []string{}, nil
                    } else if val, ok := stringOrStringArray.(string); ok {
                        return []string{val}, nil
                Severity: Major
                Found in pkg/config/common.go - About 35 mins to fix

                  Method WerfConfig.validateImageFrom has 5 return statements (exceeds 4 allowed).
                  Open

                  func (c *WerfConfig) validateImageFrom(i *StapelImageBase) error {
                      if i.raw.FromImage != "" {
                          fromImageName := i.raw.FromImage
                  
                          if fromImageName == i.Name {
                  Severity: Major
                  Found in pkg/config/werf.go - About 35 mins to fix

                    Method GitCacheStage.gitMappingsPatchSize has 5 return statements (exceeds 4 allowed).
                    Open

                    func (s *GitCacheStage) gitMappingsPatchSize(ctx context.Context, c Conveyor, prevBuiltImage *StageImage) (int64, error) {
                        var size int64
                        for _, gitMapping := range s.gitMappings {
                            commit, err := gitMapping.GetBaseCommitForPrevBuiltImage(ctx, c, prevBuiltImage)
                            if err != nil {
                    Severity: Major
                    Found in pkg/build/stage/git_cache.go - About 35 mins to fix

                      Method Image.setupBaseImageRepoDigest has 5 return statements (exceeds 4 allowed).
                      Open

                      func (i *Image) setupBaseImageRepoDigest(ctx context.Context, reference string) error {
                          i.Conveyor.GetServiceRWMutex("baseImagesRepoIdsCache" + reference).Lock()
                          defer i.Conveyor.GetServiceRWMutex("baseImagesRepoIdsCache" + reference).Unlock()
                      
                          switch {
                      Severity: Major
                      Found in pkg/build/image/image.go - About 35 mins to fix

                        Method rawStapelImage.UnmarshalYAML has 5 return statements (exceeds 4 allowed).
                        Open

                        func (c *rawStapelImage) UnmarshalYAML(unmarshal func(interface{}) error) error {
                            parentStack.Push(c)
                            type plain rawStapelImage
                            err := unmarshal((*plain)(c))
                            parentStack.Pop()
                        Severity: Major
                        Found in pkg/config/raw_stapel_image.go - About 35 mins to fix

                          Method rawStageDependencies.toDirective has 5 return statements (exceeds 4 allowed).
                          Open

                          func (c *rawStageDependencies) toDirective() (stageDependencies *StageDependencies, err error) {
                              stageDependencies = &StageDependencies{}
                          
                              if install, err := InterfaceToStringArray(c.Install, c, c.rawGit.rawStapelImage.doc); err != nil {
                                  return nil, err
                          Severity: Major
                          Found in pkg/config/raw_stage_dependencies.go - About 35 mins to fix

                            Method WerfConfig.validateDependenciesImages has 5 return statements (exceeds 4 allowed).
                            Open

                            func (c *WerfConfig) validateDependenciesImages() error {
                                for _, dfImage := range c.ImagesFromDockerfile {
                                    for _, imgDep := range dfImage.Dependencies {
                                        if imgDep.ImageName == dfImage.Name {
                                            return newDetailedConfigError(fmt.Sprintf("image can't depend on itself: `%s`!", imgDep.ImageName), imgDep.raw, dfImage.raw.doc)
                            Severity: Major
                            Found in pkg/config/werf.go - About 35 mins to fix

                              Method _escStaticFS.prepare has 5 return statements (exceeds 4 allowed).
                              Open

                              func (_escStaticFS) prepare(name string) (*_escFile, error) {
                                  f, present := _escData[path.Clean(name)]
                                  if !present {
                                      return nil, os.ErrNotExist
                                  }
                              Severity: Major
                              Found in pkg/build/builder/ansible/static.go - About 35 mins to fix

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

                                func RunAutoHostCleanup(ctx context.Context, options AutoHostCleanupOptions) error {
                                    if !options.ForceShouldRun {
                                        shouldRun, err := ShouldRunAutoHostCleanup(ctx, options.HostCleanupOptions)
                                        if err != nil {
                                            logboek.Context(ctx).Warn().LogF("WARNING: unable to check if auto host cleanup should be run: %s\n", err)
                                Severity: Major
                                Found in pkg/host_cleaning/host_cleanup.go - About 35 mins to fix

                                  Method StapelImageBase.validate has 5 return statements (exceeds 4 allowed).
                                  Open

                                  func (c *StapelImageBase) validate(giterminismManager giterminism_manager.Interface) error {
                                      if c.FromLatest {
                                          if err := giterminismManager.Inspector().InspectConfigStapelFromLatest(); err != nil {
                                              return newDetailedConfigError(err.Error(), nil, c.raw.doc)
                                          }
                                  Severity: Major
                                  Found in pkg/config/stapel_image_base.go - About 35 mins to fix

                                    Similar blocks of code found in 5 locations. Consider refactoring.
                                    Open

                                            case *appsv1.DaemonSet:
                                                // TODO: multiplier equals 3 because typically there are only 3 nodes in the cluster.
                                                // TODO: It is better to fetch number of nodes dynamically, but in the most cases multiplier=3 will work ok.
                                                spec, err := makeMultitrackSpec(ctx, &value.ObjectMeta, allowedFailuresCountOptions{multiplier: 3, defaultPerReplica: 1}, "ds")
                                                if err != nil {
                                    Severity: Major
                                    Found in pkg/deploy/helm/resources_waiter.go and 4 other locations - About 35 mins to fix
                                    pkg/deploy/helm/resources_waiter.go on lines 427..436
                                    pkg/deploy/helm/resources_waiter.go on lines 447..456
                                    pkg/deploy/helm/resources_waiter.go on lines 481..488
                                    pkg/deploy/helm/resources_waiter.go on lines 489..496

                                    Duplicated Code

                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                    Tuning

                                    This issue has a mass of 105.

                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                    Refactorings

                                    Further Reading

                                    Similar blocks of code found in 5 locations. Consider refactoring.
                                    Open

                                            case *extensions.DaemonSet:
                                                // TODO: multiplier equals 3 because typically there are only 3 nodes in the cluster.
                                                // TODO: It is better to fetch number of nodes dynamically, but in the most cases multiplier=3 will work ok.
                                                spec, err := makeMultitrackSpec(ctx, &value.ObjectMeta, allowedFailuresCountOptions{multiplier: 3, defaultPerReplica: 1}, "ds")
                                                if err != nil {
                                    Severity: Major
                                    Found in pkg/deploy/helm/resources_waiter.go and 4 other locations - About 35 mins to fix
                                    pkg/deploy/helm/resources_waiter.go on lines 437..446
                                    pkg/deploy/helm/resources_waiter.go on lines 447..456
                                    pkg/deploy/helm/resources_waiter.go on lines 481..488
                                    pkg/deploy/helm/resources_waiter.go on lines 489..496

                                    Duplicated Code

                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                    Tuning

                                    This issue has a mass of 105.

                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                    Refactorings

                                    Further Reading

                                    Similar blocks of code found in 5 locations. Consider refactoring.
                                    Open

                                            case *batchv1.Job:
                                                spec, err := makeMultitrackSpec(ctx, &value.ObjectMeta, allowedFailuresCountOptions{multiplier: 1, defaultPerReplica: 0}, "job")
                                                if err != nil {
                                                    return nil, fmt.Errorf("cannot track %s %s: %w", value.Kind, value.Name, err)
                                                }
                                    Severity: Major
                                    Found in pkg/deploy/helm/resources_waiter.go and 4 other locations - About 35 mins to fix
                                    pkg/deploy/helm/resources_waiter.go on lines 427..436
                                    pkg/deploy/helm/resources_waiter.go on lines 437..446
                                    pkg/deploy/helm/resources_waiter.go on lines 447..456
                                    pkg/deploy/helm/resources_waiter.go on lines 489..496

                                    Duplicated Code

                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                    Tuning

                                    This issue has a mass of 105.

                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                    Refactorings

                                    Further Reading

                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language