Showing 614 of 901 total issues

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

    Function runGetServiceValues has a Cognitive Complexity of 42 (exceeds 20 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: Minor
    Found in cmd/werf/helm/get_autogenerated_values.go - About 3 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 a Cognitive Complexity of 42 (exceeds 20 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: Minor
    Found in cmd/werf/cleanup/cleanup.go - About 3 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 RepoStagesStorage.GetStagesIDsByDigest has a Cognitive Complexity of 42 (exceeds 20 allowed). Consider refactoring.
    Open

    func (storage *RepoStagesStorage) GetStagesIDsByDigest(ctx context.Context, _, digest string, opts ...Option) ([]image.StageID, error) {
        var res []image.StageID
    
        o := makeOptions(opts...)
        if tags, err := storage.DockerRegistry.Tags(ctx, storage.RepoAddress, o.dockerRegistryOptions...); err != nil {
    Severity: Minor
    Found in pkg/storage/repo_stages_storage.go - About 3 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 runPublish has 44 return statements (exceeds 4 allowed).
    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 3 hrs to fix

      Local has 31 methods (exceeds 20 allowed). Consider refactoring.
      Open

      type Local struct {
          *Base
      
          WorkTreeDir string
          GitDir      string
      Severity: Minor
      Found in pkg/git_repo/local.go - About 3 hrs to fix

        Function makeMultitrackSpecsFromResList has 119 lines of code (exceeds 50 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: Major
        Found in pkg/deploy/helm/resources_waiter.go - About 3 hrs to fix

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

          func (api *api) getRepoImageByDesc(ctx context.Context, originalTag string, desc *remote.Descriptor, ref name.Reference) (*image.Info, error) {
              referenceParts, err := api.parseReferenceParts(ref.Name())
              if err != nil {
                  return nil, fmt.Errorf("unable to parse reference %q: %w", ref.Name(), err)
              }
          Severity: Minor
          Found in pkg/docker_registry/api.go - About 3 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 generateGitMappings has a Cognitive Complexity of 41 (exceeds 20 allowed). Consider refactoring.
          Open

          func generateGitMappings(ctx context.Context, metaConfig *config.Meta, imageBaseConfig *config.StapelImageBase, opts CommonImageOptions) ([]*stage.GitMapping, error) {
              var gitMappings []*stage.GitMapping
          
              if len(imageBaseConfig.Git.Local) != 0 {
                  localGitRepo := opts.GiterminismManager.LocalGitRepo()
          Severity: Minor
          Found in pkg/build/image/stapel.go - About 3 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 570 lines of code (exceeds 500 allowed). Consider refactoring.
          Open

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

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

            func run(ctx context.Context, imagesToProcess build.ImagesToProcess, tagTemplateList []string, extraLabels map[string]string) error {
                if imagesToProcess.WithoutImages {
                    return nil
                }
            
            
            Severity: Major
            Found in cmd/werf/export/export.go - About 3 hrs to fix

              Method diffParser.handleDiffLine has 115 lines of code (exceeds 50 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: Major
              Found in pkg/true_git/diff_parser.go - About 3 hrs to fix

                Function runMain has a Cognitive Complexity of 40 (exceeds 20 allowed). Consider refactoring.
                Open

                func runMain(ctx context.Context) error {
                    global_warnings.PostponeMultiwerfNotUpToDateWarning()
                
                    if err := werf.Init(*commonCmdData.TmpDir, *commonCmdData.HomeDir); err != nil {
                        return fmt.Errorf("initialization error: %w", err)
                Severity: Minor
                Found in cmd/werf/run/run.go - About 3 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 a Cognitive Complexity of 40 (exceeds 20 allowed). Consider refactoring.
                Open

                func run(ctx context.Context, containerBackend container_backend.ContainerBackend, giterminismManager giterminism_manager.Interface, commonCmdData common.CmdData, cmdData composeCmdData, dockerComposeCmdName string) error {
                    var envArray []string
                    if dockerComposeCmdName != "down" {
                        imagesToProcess := common.GetImagesToProcess(cmdData.WerfImagesToProcess, *commonCmdData.WithoutImages)
                
                
                Severity: Minor
                Found in cmd/werf/compose/main.go - About 3 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 cleanupManager.cleanupUnusedStages has a Cognitive Complexity of 40 (exceeds 20 allowed). Consider refactoring.
                Open

                func (m *cleanupManager) cleanupUnusedStages(ctx context.Context) error {
                    stageDescriptionList := m.stageManager.GetStageDescriptionList(stage_manager.StageDescriptionListOptions{})
                    stageDescriptionListCount := len(stageDescriptionList)
                
                    if err := logboek.Context(ctx).Info().LogProcess("Fetching imports metadata").DoError(func() error {
                Severity: Minor
                Found in pkg/cleaning/cleanup.go - About 3 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 writePatch has a Cognitive Complexity of 40 (exceeds 20 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: Minor
                Found in pkg/true_git/patch.go - About 3 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 GetLocalDockerServerStorageCheck has a Cognitive Complexity of 40 (exceeds 20 allowed). Consider refactoring.
                Open

                func GetLocalDockerServerStorageCheck(ctx context.Context, dockerServerStoragePath string) (*LocalDockerServerStorageCheckResult, error) {
                    res := &LocalDockerServerStorageCheckResult{}
                
                    vu, err := volumeutils.GetVolumeUsageByPath(ctx, dockerServerStoragePath)
                    if err != nil {
                Severity: Minor
                Found in pkg/host_cleaning/local_docker_server.go - About 3 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

                WerfConfig has 29 methods (exceeds 20 allowed). Consider refactoring.
                Open

                type WerfConfig struct {
                    Meta                 *Meta
                    StapelImages         []*StapelImage
                    ImagesFromDockerfile []*ImageFromDockerfile
                    Artifacts            []*StapelImageArtifact
                Severity: Minor
                Found in pkg/config/werf.go - About 3 hrs to fix

                  Function generateRunMounts has 111 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

                  func generateRunMounts(mounts []*instructions.Mount) []string {
                      var runMounts []string
                  
                      for _, mount := range mounts {
                          var options []string
                  Severity: Major
                  Found in pkg/buildah/native_linux.go - About 3 hrs to fix

                    Method diffParser.handleDiffLine has 38 return statements (exceeds 4 allowed).
                    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: Major
                    Found in pkg/true_git/diff_parser.go - About 3 hrs to fix
                      Severity
                      Category
                      Status
                      Source
                      Language