Showing 631 of 915 total issues

LocalStagesStorage has 39 methods (exceeds 20 allowed). Consider refactoring.
Open

type LocalStagesStorage struct {
    ContainerBackend container_backend.ContainerBackend
}
Severity: Minor
Found in pkg/storage/local_stages_storage.go - About 5 hrs to fix

    Function runExport has a Cognitive Complexity of 49 (exceeds 20 allowed). Consider refactoring.
    Open

    func runExport(ctx context.Context, imagesToProcess build.ImagesToProcess) error {
        if err := werf.Init(*commonCmdData.TmpDir, *commonCmdData.HomeDir); err != nil {
            return fmt.Errorf("initialization error: %w", err)
        }
    
    
    Severity: Minor
    Found in cmd/werf/bundle/export/export.go - About 5 hrs 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 FullDockerfileStage.FetchDependencies has a Cognitive Complexity of 49 (exceeds 20 allowed). Consider refactoring.
    Open

    func (s *FullDockerfileStage) FetchDependencies(ctx context.Context, c Conveyor, containerBackend container_backend.ContainerBackend, dockerRegistry docker_registry.GenericApiInterface) error {
        resolvedDependenciesArgsHash := ResolveDependenciesArgs(s.targetPlatform, s.dependencies, c)
    
        resolvedDockerMetaArgsHash, err := s.resolveDockerMetaArgs(resolvedDependenciesArgsHash)
        if err != nil {
    Severity: Minor
    Found in pkg/build/stage/full_dockerfile.go - About 5 hrs 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 FullDockerfileStage.GetDependencies has a Cognitive Complexity of 48 (exceeds 20 allowed). Consider refactoring.
    Open

    func (s *FullDockerfileStage) GetDependencies(ctx context.Context, c Conveyor, cb container_backend.ContainerBackend, prevImage, prevBuiltImage *StageImage, buildContextArchive container_backend.BuildContextArchiver) (string, error) {
        resolvedDependenciesArgsHash := ResolveDependenciesArgs(s.targetPlatform, s.dependencies, c)
    
        resolvedDockerMetaArgsHash, err := s.resolveDockerMetaArgs(resolvedDependenciesArgsHash)
        if err != nil {
    Severity: Minor
    Found in pkg/build/stage/full_dockerfile.go - About 4 hrs 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

    BaseStage has 37 methods (exceeds 20 allowed). Consider refactoring.
    Open

    type BaseStage struct {
        name             StageName
        logName          string
        targetPlatform   string
        imageName        string
    Severity: Minor
    Found in pkg/build/stage/base.go - About 4 hrs to fix

      Function RunGC has 145 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func RunGC(ctx context.Context, allowedVolumeUsagePercentage, allowedVolumeUsageMarginPercentage float64) error {
          if lock, err := lockGC(ctx, false); err != nil {
              return err
          } else {
              defer werf.ReleaseHostLock(lock)
      Severity: Major
      Found in pkg/git_repo/gitdata/gc.go - About 4 hrs to fix

        Method Image.SetupBaseImage has a Cognitive Complexity of 47 (exceeds 20 allowed). Consider refactoring.
        Open

        func (i *Image) SetupBaseImage(ctx context.Context, storageManager manager.StorageManagerInterface, storageOpts manager.StorageOptions) error {
            logboek.Context(ctx).Debug().LogF(" -- SetupBaseImage for %q\n", i.Name)
        
            switch i.baseImageType {
            case StageAsBaseImage:
        Severity: Minor
        Found in pkg/build/image/image.go - About 4 hrs 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 runGetServiceValues has 142 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func runGetServiceValues(ctx context.Context, imagesToProcess build.ImagesToProcess) error {
            logboek.SetAcceptedLevel(level.Error)
        
            if err := werf.Init(*getAutogeneratedValuedCmdData.TmpDir, *getAutogeneratedValuedCmdData.HomeDir); err != nil {
                return fmt.Errorf("initialization error: %w", err)
        Severity: Major
        Found in cmd/werf/helm/get_autogenerated_values.go - About 4 hrs to fix

          Method WerfChart.CreateNewBundle has 142 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func (wc *WerfChart) CreateNewBundle(ctx context.Context, destDir, chartVersion string, vals *values.Options) (*Bundle, error) {
              chartPath := filepath.Join(wc.GiterminismManager.ProjectDir(), wc.ChartDir)
              chrt, err := loader.LoadDir(chartPath)
              if err != nil {
                  return nil, fmt.Errorf("error loading chart %q: %w", chartPath, err)
          Severity: Major
          Found in pkg/deploy/helm/chart_extender/werf_chart.go - About 4 hrs to fix

            Function writePatch has 140 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            func writePatch(ctx context.Context, out io.Writer, gitDir, workTreeCacheDir string, withSubmodules bool, opts PatchOptions) (*PatchDescriptor, error) {
                var err error
            
                gitDir, err = filepath.Abs(gitDir)
                if err != nil {
            Severity: Major
            Found in pkg/true_git/patch.go - About 4 hrs to fix

              Function ReferencesToScan has 137 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func ReferencesToScan(ctx context.Context, gitRepository *git.Repository, keepPolicies []*config.MetaCleanupKeepPolicy) ([]*ReferenceToScan, error) {
                  rs, err := gitRepository.References()
                  if err != nil {
                      return nil, fmt.Errorf("get repository references failed: %w", err)
                  }
              Severity: Major
              Found in pkg/cleaning/git_history_based_cleanup/reference_to_scan.go - About 4 hrs to fix

                Method FullDockerfileStage.dockerfileInstructionDependencies has 136 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func (s *FullDockerfileStage) dockerfileInstructionDependencies(ctx context.Context, giterminismManager giterminism_manager.Interface, resolvedDockerMetaArgsHash, resolvedDependenciesArgsHash map[string]string, dockerStageID int, cmd interface{}, isOnbuildInstruction, isBaseImageOnbuildInstruction bool) ([]string, []string, error) {
                    var dependencies []string
                    var onBuildDependencies []string
                
                    resolveValueFunc := func(value string) (string, error) {
                Severity: Major
                Found in pkg/build/stage/full_dockerfile.go - About 4 hrs to fix

                  Function SecretEdit has a Cognitive Complexity of 44 (exceeds 20 allowed). Consider refactoring.
                  Open

                  func SecretEdit(ctx context.Context, m *secrets_manager.SecretsManager, workingDir, filePath string, values bool) error {
                      var encoder *secret.YamlEncoder
                      if enc, err := m.GetYamlEncoder(ctx, workingDir); err != nil {
                          return err
                      } else {
                  Severity: Minor
                  Found in cmd/werf/helm/secret/common/edit.go - About 4 hrs 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 NewCmd has a Cognitive Complexity of 44 (exceeds 20 allowed). Consider refactoring.
                  Open

                  func NewCmd(ctx context.Context) (*cobra.Command, error) {
                      var namespace string
                      ctx = common.NewContextWithCmdData(ctx, &_commonCmdData)
                      cmd := common.SetCommandContext(ctx, &cobra.Command{
                          Use:          "helm",
                  Severity: Minor
                  Found in cmd/werf/helm/helm.go - About 4 hrs 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 FileReader.walkFilesWithPathMatcher has a Cognitive Complexity of 44 (exceeds 20 allowed). Consider refactoring.
                  Open

                  func (r FileReader) walkFilesWithPathMatcher(ctx context.Context, relDir string, pathMatcher path_matcher.PathMatcher, skipFileFunc func(ctx context.Context, r FileReader, existingRelPath string) (bool, error), fileFunc func(notResolvedPath string) error) error {
                      if !pathMatcher.IsDirOrSubmodulePathMatched(relDir) {
                          return nil
                      }
                  
                  
                  Severity: Minor
                  Found in pkg/giterminism_manager/file_reader/fs.go - About 4 hrs 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 RunGC has a Cognitive Complexity of 44 (exceeds 20 allowed). Consider refactoring.
                  Open

                  func RunGC(ctx context.Context, allowedVolumeUsagePercentage, allowedVolumeUsageMarginPercentage float64) error {
                      if lock, err := lockGC(ctx, false); err != nil {
                          return err
                      } else {
                          defer werf.ReleaseHostLock(lock)
                  Severity: Minor
                  Found in pkg/git_repo/gitdata/gc.go - About 4 hrs 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 runCleanup has 130 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

                  func runCleanup(ctx context.Context) error {
                      if err := werf.Init(*commonCmdData.TmpDir, *commonCmdData.HomeDir); err != nil {
                          return fmt.Errorf("initialization error: %w", err)
                      }
                  
                  
                  Severity: Major
                  Found in cmd/werf/cleanup/cleanup.go - About 4 hrs to fix

                    Method StorageManager.FetchStage has 129 lines of code (exceeds 50 allowed). Consider refactoring.
                    Open

                    func (m *StorageManager) FetchStage(ctx context.Context, containerBackend container_backend.ContainerBackend, stg stage.Interface) error {
                        logboek.Context(ctx).Debug().LogF("-- StagesManager.FetchStage %s\n", stg.LogDetailedName())
                    
                        if err := m.LockStageImage(ctx, stg.GetStageImage().Image.Name()); err != nil {
                            return fmt.Errorf("error locking stage image %q: %w", stg.GetStageImage().Image.Name(), err)
                    Severity: Major
                    Found in pkg/storage/manager/storage_manager.go - About 4 hrs to fix

                      Function run has a Cognitive Complexity of 43 (exceeds 20 allowed). Consider refactoring.
                      Open

                      func run(ctx context.Context, pod, secret, namespace string, werfConfig *config.WerfConfig, containerBackend container_backend.ContainerBackend, giterminismManager giterminism_manager.Interface) error {
                          projectName := werfConfig.Meta.Project
                      
                          userExtraAnnotations, err := common.GetUserExtraAnnotations(&commonCmdData)
                          if err != nil {
                      Severity: Minor
                      Found in cmd/werf/kube_run/kube_run.go - About 4 hrs 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 run has 124 lines of code (exceeds 50 allowed). Consider refactoring.
                      Open

                      func run(ctx context.Context, pod, secret, namespace string, werfConfig *config.WerfConfig, containerBackend container_backend.ContainerBackend, giterminismManager giterminism_manager.Interface) error {
                          projectName := werfConfig.Meta.Project
                      
                          userExtraAnnotations, err := common.GetUserExtraAnnotations(&commonCmdData)
                          if err != nil {
                      Severity: Major
                      Found in cmd/werf/kube_run/kube_run.go - About 3 hrs to fix
                        Severity
                        Category
                        Status
                        Source
                        Language