Showing 915 of 915 total issues

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

package secret

import (
    "context"
    "fmt"
Severity: Major
Found in cmd/werf/helm/secret/values/edit/edit.go and 1 other location - About 1 day to fix
cmd/werf/helm/secret/file/edit/edit.go on lines 1..77

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

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

Conveyor has 59 methods (exceeds 20 allowed). Consider refactoring.
Open

type Conveyor struct {
    werfConfig *config.WerfConfig

    projectDir       string
    containerWerfDir string
Severity: Major
Found in pkg/build/conveyor.go - About 1 day to fix

    Function runPublish has 226 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func runPublish(ctx context.Context, imagesToProcess build.ImagesToProcess) error {
        global_warnings.PostponeMultiwerfNotUpToDateWarning()
    
        if err := werf.Init(*commonCmdData.TmpDir, *commonCmdData.HomeDir); err != nil {
            return fmt.Errorf("initialization error: %w", err)
    Severity: Major
    Found in cmd/werf/bundle/publish/publish.go - About 1 day to fix

      Method FullDockerfileStage.dockerfileInstructionDependencies has a Cognitive Complexity of 64 (exceeds 20 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: Minor
      Found in pkg/build/stage/full_dockerfile.go - About 7 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 WerfChart.CreateNewBundle has a Cognitive Complexity of 63 (exceeds 20 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: Minor
      Found in pkg/deploy/helm/chart_extender/werf_chart.go - About 7 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 getCommitMessages has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
      Open

      async function getCommitMessages() {
        const { context } = github;
      
        const ignoreTitle = core.getInput('ignoreTitle').trim();
        const ignoreDescription = core.getInput('ignoreDescription').trim();
      Severity: Minor
      Found in .github/actions/get-commit-message/index.js - About 7 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 diffParser.handleDiffLine has a Cognitive Complexity of 62 (exceeds 20 allowed). Consider refactoring.
      Open

      func (p *diffParser) handleDiffLine(line string) error {
          if debugPatchParser() {
              oldState := p.state
              fmt.Printf("TRUE_GIT parse diff line: state=%#v line=%#v\n", oldState, line)
              defer func() {
      Severity: Minor
      Found in pkg/true_git/diff_parser.go - About 7 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

      File conveyor.go has 707 lines of code (exceeds 500 allowed). Consider refactoring.
      Open

      package build
      
      import (
          "bytes"
          "context"
      Severity: Minor
      Found in pkg/build/conveyor.go - About 7 hrs to fix

        File repo_stages_storage.go has 706 lines of code (exceeds 500 allowed). Consider refactoring.
        Open

        package storage
        
        import (
            "context"
            "fmt"
        Severity: Minor
        Found in pkg/storage/repo_stages_storage.go - About 6 hrs to fix

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

          package stage
          
          import (
              "context"
          
          
          Severity: Major
          Found in pkg/build/stage/setup.go and 2 other locations - About 6 hrs to fix
          pkg/build/stage/before_setup.go on lines 1..50
          pkg/build/stage/install.go on lines 1..50

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

          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 3 locations. Consider refactoring.
          Open

          package stage
          
          import (
              "context"
          
          
          Severity: Major
          Found in pkg/build/stage/before_setup.go and 2 other locations - About 6 hrs to fix
          pkg/build/stage/install.go on lines 1..50
          pkg/build/stage/setup.go on lines 1..50

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

          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 3 locations. Consider refactoring.
          Open

          package stage
          
          import (
              "context"
          
          
          Severity: Major
          Found in pkg/build/stage/install.go and 2 other locations - About 6 hrs to fix
          pkg/build/stage/before_setup.go on lines 1..50
          pkg/build/stage/setup.go on lines 1..50

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

          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

          Function runExport has 195 lines of code (exceeds 50 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: Major
          Found in cmd/werf/bundle/export/export.go - About 6 hrs to fix

            Method api.mutateImageOrIndex has a Cognitive Complexity of 58 (exceeds 20 allowed). Consider refactoring.
            Open

            func (api *api) mutateImageOrIndex(ctx context.Context, imageOrIndex interface{}, mutateManifestConfigFunc func(cfg v1.Config) (v1.Config, error), ref name.Reference, isRefByDigest bool) (interface{}, error) {
                switch i := imageOrIndex.(type) {
                case v1.Image:
                    cf, err := i.ConfigFile()
                    if err != nil {
            Severity: Minor
            Found in pkg/docker_registry/api.go - About 6 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 GetExistingGitPatches has a Cognitive Complexity of 58 (exceeds 20 allowed). Consider refactoring.
            Open

            func GetExistingGitPatches(cacheVersionRoot string) ([]*GitPatchDesc, error) {
                var res []*GitPatchDesc
            
                if _, err := os.Stat(cacheVersionRoot); os.IsNotExist(err) {
                    return nil, nil
            Severity: Minor
            Found in pkg/git_repo/gitdata/git_patch.go - About 6 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 GetExistingGitArchives has a Cognitive Complexity of 58 (exceeds 20 allowed). Consider refactoring.
            Open

            func GetExistingGitArchives(cacheVersionRoot string) ([]*GitArchiveDesc, error) {
                var res []*GitArchiveDesc
            
                if _, err := os.Stat(cacheVersionRoot); os.IsNotExist(err) {
                    return nil, nil
            Severity: Minor
            Found in pkg/git_repo/gitdata/git_archive.go - About 6 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

            File plan.go has 677 lines of code (exceeds 500 allowed). Consider refactoring.
            Open

            package plan
            
            import (
                "context"
                "fmt"
            Severity: Minor
            Found in cmd/werf/plan/plan.go - About 6 hrs to fix

              Method StorageManager.FetchStage has a Cognitive Complexity of 55 (exceeds 20 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: Minor
              Found in pkg/storage/manager/storage_manager.go - About 6 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

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

              //go:build linux && s390x
              // +build linux,s390x
              
              // Copyright (c) 2015-2021 MinIO, Inc.
              //
              Severity: Major
              Found in pkg/third_party/minio/disk/stat_linux_s390x.go and 1 other location - About 6 hrs to fix
              pkg/third_party/minio/disk/stat_linux_32bit.go on lines 1..83

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

              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 2 locations. Consider refactoring.
              Open

              //go:build (linux && arm) || (linux && 386)
              // +build linux,arm linux,386
              
              // Copyright (c) 2015-2021 MinIO, Inc.
              //
              Severity: Major
              Found in pkg/third_party/minio/disk/stat_linux_32bit.go and 1 other location - About 6 hrs to fix
              pkg/third_party/minio/disk/stat_linux_s390x.go on lines 1..83

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

              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