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

                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

                      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

                          Severity
                          Category
                          Status
                          Source
                          Language