Showing 915 of 915 total issues

Function setNewDocs has 476 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func setNewDocs(cmd *cobra.Command) {
    switch cmd.Use {
    case "events [--for TYPE/NAME] [--watch]":
        cmd.Annotations = map[string]string{
            common.DocsLongMD: GetAlphaEventsDocs().LongMD,
Severity: Major
Found in cmd/werf/docs/replacers/kubectl/kubectl.go - About 2 days to fix

    File native_linux.go has 1006 lines of code (exceeds 500 allowed). Consider refactoring.
    Open

    //go:build linux
    // +build linux
    
    package buildah
    
    
    Severity: Major
    Found in pkg/buildah/native_linux.go - About 1 day to fix

      File map.go has 974 lines of code (exceeds 500 allowed). Consider refactoring.
      Open

      package slug
      
      var mapping = map[string]string{
          "0": "0",
          "1": "1",
      Severity: Major
      Found in pkg/slug/map.go - About 1 day to fix

        Function run has 343 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func run(ctx context.Context, containerBackend container_backend.ContainerBackend, giterminismManager giterminism_manager.Interface, imagesToProcess build.ImagesToProcess) error {
            werfConfigPath, werfConfig, err := common.GetRequiredWerfConfig(ctx, &commonCmdData, giterminismManager, common.GetWerfConfigOptions(&commonCmdData, true))
            if err != nil {
                return fmt.Errorf("unable to load werf config: %w", err)
            }
        Severity: Major
        Found in cmd/werf/plan/plan.go - About 1 day to fix

          File kubectl_docs.go has 930 lines of code (exceeds 500 allowed). Consider refactoring.
          Open

          package kubectl
          
          import (
              "fmt"
              "path"
          Severity: Major
          Found in cmd/werf/docs/replacers/kubectl/kubectl_docs.go - About 1 day to fix

            File kube_run.go has 915 lines of code (exceeds 500 allowed). Consider refactoring.
            Open

            package kube_run
            
            import (
                "bytes"
                "context"
            Severity: Major
            Found in cmd/werf/kube_run/kube_run.go - About 1 day to fix

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

              func run(ctx context.Context, containerBackend container_backend.ContainerBackend, giterminismManager giterminism_manager.Interface, imagesToProcess build.ImagesToProcess) error {
                  werfConfigPath, werfConfig, err := common.GetRequiredWerfConfig(ctx, &commonCmdData, giterminismManager, common.GetWerfConfigOptions(&commonCmdData, true))
                  if err != nil {
                      return fmt.Errorf("unable to load werf config: %w", err)
                  }
              Severity: Minor
              Found in cmd/werf/plan/plan.go - About 1 day 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 cleanup.go has 886 lines of code (exceeds 500 allowed). Consider refactoring.
              Open

              package cleaning
              
              import (
                  "context"
                  "fmt"
              Severity: Major
              Found in pkg/cleaning/cleanup.go - About 1 day to fix

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

                package secret
                
                import (
                    "context"
                    "fmt"
                Severity: Major
                Found in cmd/werf/helm/secret/file/decrypt/decrypt.go and 2 other locations - About 1 day to fix
                cmd/werf/helm/secret/file/encrypt/encrypt.go on lines 1..94
                cmd/werf/helm/secret/values/decrypt/decrypt.go on lines 1..103

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

                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 secret
                
                import (
                    "context"
                    "fmt"
                Severity: Major
                Found in cmd/werf/helm/secret/values/decrypt/decrypt.go and 2 other locations - About 1 day to fix
                cmd/werf/helm/secret/file/decrypt/decrypt.go on lines 1..98
                cmd/werf/helm/secret/file/encrypt/encrypt.go on lines 1..94

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

                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 secret
                
                import (
                    "context"
                    "fmt"
                Severity: Major
                Found in cmd/werf/helm/secret/file/encrypt/encrypt.go and 2 other locations - About 1 day to fix
                cmd/werf/helm/secret/file/decrypt/decrypt.go on lines 1..98
                cmd/werf/helm/secret/values/decrypt/decrypt.go on lines 1..103

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

                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 runRender has a Cognitive Complexity of 84 (exceeds 20 allowed). Consider refactoring.
                Open

                func runRender(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/render/render.go - About 1 day 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 makeMultitrackSpecsFromResList has a Cognitive Complexity of 82 (exceeds 20 allowed). Consider refactoring.
                Open

                func makeMultitrackSpecsFromResList(ctx context.Context, resources helm_kube.ResourceList, timeout, statusProgressPeriod time.Duration) (*multitrack.MultitrackSpecs, error) {
                    specs := &multitrack.MultitrackSpecs{}
                
                    for _, v := range resources {
                        switch value := asVersioned(v).(type) {
                Severity: Minor
                Found in pkg/deploy/helm/resources_waiter.go - About 1 day 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 storage_manager.go has 851 lines of code (exceeds 500 allowed). Consider refactoring.
                Open

                package manager
                
                import (
                    "context"
                    "errors"
                Severity: Major
                Found in pkg/storage/manager/storage_manager.go - About 1 day to fix

                  File static.go has 841 lines of code (exceeds 500 allowed). Consider refactoring.
                  Open

                  // Code generated by "esc -no-compress -ignore static.go -o ansible/static.go -pkg ansible ansible"; DO NOT EDIT.
                  
                  package ansible
                  
                  import (
                  Severity: Major
                  Found in pkg/build/builder/ansible/static.go - About 1 day to fix

                    Method ExtraAnnotationsAndLabelsPostRenderer.Run has a Cognitive Complexity of 78 (exceeds 20 allowed). Consider refactoring.
                    Open

                    func (pr *ExtraAnnotationsAndLabelsPostRenderer) Run(renderedManifests *bytes.Buffer) (*bytes.Buffer, error) {
                        extraAnnotations := map[string]string{}
                        for k, v := range WerfRuntimeAnnotations {
                            extraAnnotations[k] = v
                        }
                    Severity: Minor
                    Found in pkg/deploy/helm/extra_annotations_and_labels_post_renderer.go - About 1 day 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 runRender has 264 lines of code (exceeds 50 allowed). Consider refactoring.
                    Open

                    func runRender(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/render/render.go - About 1 day to fix

                      Function prepareMultitrackSpec has a Cognitive Complexity of 75 (exceeds 20 allowed). Consider refactoring.
                      Open

                      func prepareMultitrackSpec(metadataName, resourceNameOrKind, namespace string, annotations map[string]string, failuresCountOptions allowedFailuresCountOptions) (*multitrack.MultitrackSpec, error) {
                          defaultAllowFailuresCount := new(int)
                          // Allow 1 fail per replica by default
                          *defaultAllowFailuresCount = applyAllowedFailuresCountMultiplier(failuresCountOptions.defaultPerReplica, failuresCountOptions.multiplier)
                      
                      
                      Severity: Minor
                      Found in pkg/deploy/helm/resources_waiter.go - About 1 day 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 generateRunMounts has a Cognitive Complexity of 74 (exceeds 20 allowed). Consider refactoring.
                      Open

                      func generateRunMounts(mounts []*instructions.Mount) []string {
                          var runMounts []string
                      
                          for _, mount := range mounts {
                              var options []string
                      Severity: Minor
                      Found in pkg/buildah/native_linux.go - About 1 day 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

                      package secret
                      
                      import (
                          "context"
                          "fmt"
                      Severity: Major
                      Found in cmd/werf/helm/secret/file/edit/edit.go and 1 other location - About 1 day to fix
                      cmd/werf/helm/secret/values/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

                      Severity
                      Category
                      Status
                      Source
                      Language