Showing 614 of 901 total issues

Function getCommitMessages has 83 lines of code (exceeds 25 allowed). Consider refactoring.
Open

async function getCommitMessages() {
  const { context } = github;

  const ignoreTitle = core.getInput('ignoreTitle').trim() === 'true';
  const ignoreDescription = core.getInput('ignoreDescription').trim() === 'true';
Severity: Major
Found in .github/actions/get-commit-message/index.js - About 3 hrs to fix

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

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

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

        Function NewCmd has 105 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func NewCmd(ctx context.Context) *cobra.Command {
            ctx = common.NewContextWithCmdData(ctx, &commonCmdData)
        
            var useMsg string
            if isSpecificImagesEnabled() {
        Severity: Major
        Found in cmd/werf/plan/plan.go - About 3 hrs to fix

          Method api.mutateImageOrIndex has 105 lines of code (exceeds 50 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: Major
          Found in pkg/docker_registry/api.go - About 3 hrs to fix

            DockerServerBackend has 27 methods (exceeds 20 allowed). Consider refactoring.
            Open

            type DockerServerBackend struct{}
            Severity: Minor
            Found in pkg/container_backend/docker_server_backend.go - About 3 hrs to fix

              Method ExtraAnnotationsAndLabelsPostRenderer.Run has 104 lines of code (exceeds 50 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: Major
              Found in pkg/deploy/helm/extra_annotations_and_labels_post_renderer.go - About 3 hrs to fix

                Function run has a Cognitive Complexity of 37 (exceeds 20 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: Minor
                Found in cmd/werf/export/export.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 35 return statements (exceeds 4 allowed).
                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 3 hrs to fix

                  Method LegacyStageImage.Build has a Cognitive Complexity of 37 (exceeds 20 allowed). Consider refactoring.
                  Open

                  func (i *LegacyStageImage) Build(ctx context.Context, options BuildOptions) error {
                      if i.GetTargetPlatform() == i.ContainerBackend.GetDefaultPlatform() && i.ContainerBackend.GetDefaultPlatform() != "linux/amd64" {
                          logboek.Context(ctx).Error().LogF("Detected your default build platform as %s.\n", i.ContainerBackend.GetDefaultPlatform())
                          logboek.Context(ctx).Error().LogF("Building of stapel-type images using Docker-Server backend for platforms other than linux/amd64 is not supported.\n")
                          logboek.Context(ctx).Error().LogF("Please either:\n * confirm emulation of linux/amd64 by exlicitly setting --platform=linux/amd64 param;\n * or use Dockerfile-type image instead.\n")
                  Severity: Minor
                  Found in pkg/container_backend/legacy_stage_image.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 purge has a Cognitive Complexity of 37 (exceeds 20 allowed). Consider refactoring.
                  Open

                  func purge(ctx context.Context, dryRun bool, containerBackend container_backend.ContainerBackend) error {
                      tmpFiles, err := ioutil.ReadDir(werf.GetTmpDir())
                      if err != nil {
                          return fmt.Errorf("unable to list tmp files in %s: %w", werf.GetTmpDir(), err)
                      }
                  Severity: Minor
                  Found in pkg/tmp_manager/purge.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 SetupDockerfileStagesDependencies has a Cognitive Complexity of 37 (exceeds 20 allowed). Consider refactoring.
                  Open

                  func SetupDockerfileStagesDependencies(stages []*DockerfileStage) error {
                      stageByName := make(map[string]*DockerfileStage)
                      for _, stage := range stages {
                          if stage.HasStageName() {
                              stageByName[strings.ToLower(stage.StageName)] = stage
                  Severity: Minor
                  Found in pkg/dockerfile/dockerfile_stage.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 101 lines of code (exceeds 50 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: Major
                  Found in pkg/host_cleaning/local_docker_server.go - About 3 hrs to fix

                    LegacyStageImageContainer has 26 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                    type LegacyStageImageContainer struct {
                        image                      *LegacyStageImage
                        name                       string
                        runCommands                []string
                        serviceRunCommands         []string
                    Severity: Minor
                    Found in pkg/container_backend/legacy_stage_image_container.go - About 3 hrs to fix

                      NativeBuildah has 26 methods (exceeds 20 allowed). Consider refactoring.
                      Open

                      type NativeBuildah struct {
                          Isolation               thirdparty.Isolation
                          TmpDir                  string
                          InstanceTmpDir          string
                          ConfigTmpDir            string
                      Severity: Minor
                      Found in pkg/buildah/native_linux.go - About 3 hrs to fix

                        Image has 26 methods (exceeds 20 allowed). Consider refactoring.
                        Open

                        type Image struct {
                            CommonImageOptions
                        
                            IsArtifact              bool
                            IsDockerfileImage       bool
                        Severity: Minor
                        Found in pkg/build/image/image.go - About 3 hrs to fix

                          Function RunGC has a Cognitive Complexity of 36 (exceeds 20 allowed). Consider refactoring.
                          Open

                          func RunGC(ctx context.Context, dryRun bool, containerBackend container_backend.ContainerBackend) error {
                              projectDirsToRemove := []string{}
                              pathsToRemove := []string{}
                          
                              if err := gcReleasedProjectDirs(&projectDirsToRemove, &pathsToRemove); err != nil {
                          Severity: Minor
                          Found in pkg/tmp_manager/gc.go - About 2 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 DoTasks has a Cognitive Complexity of 36 (exceeds 20 allowed). Consider refactoring.
                          Open

                          func DoTasks(ctx context.Context, numberOfTasks int, options DoTasksOptions, taskFunc func(ctx context.Context, taskId int) error) error {
                              if numberOfTasks == 0 {
                                  return nil
                              }
                          
                          
                          Severity: Minor
                          Found in pkg/util/parallel/parallel.go - About 2 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 32 return statements (exceeds 4 allowed).
                          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 2 hrs to fix

                            api has 25 methods (exceeds 20 allowed). Consider refactoring.
                            Open

                            type api struct {
                                InsecureRegistry      bool
                                SkipTlsVerifyRegistry bool
                            }
                            Severity: Minor
                            Found in pkg/docker_registry/api.go - About 2 hrs to fix
                              Severity
                              Category
                              Status
                              Source
                              Language