Showing 614 of 901 total issues

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

type PerfCheckContainerBackend struct {
    ContainerBackend ContainerBackend
}
Severity: Minor
Found in pkg/container_backend/perf_check_container_backend.go - About 2 hrs to fix

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

    func NewCmd(ctx context.Context) *cobra.Command {
        ctx = common.NewContextWithCmdData(ctx, &commonCmdData)
        cmd := common.SetCommandContext(ctx, &cobra.Command{
            Use:                   "kube-run [options] [IMAGE_NAME] [-- COMMAND ARG...]",
            Short:                 "Run container for project image in Kubernetes",
    Severity: Major
    Found in cmd/werf/kube_run/kube_run.go - About 2 hrs to fix

      Function run has 94 lines of code (exceeds 50 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: Major
      Found in cmd/werf/compose/main.go - About 2 hrs to fix

        Function _get_task_info_from_args has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
        Open

            def _get_task_info_from_args(self, task, start=False):
                info = ''
                if task.action in self.FREE_FORM_MODULES:
                    info = task.args.get('_raw_params', '')
                if task.action == 'file':
        Severity: Minor
        Found in pkg/build/builder/ansible/callback/live.py - 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 NewCmd has 93 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func NewCmd(ctx context.Context) *cobra.Command {
            ctx = common.NewContextWithCmdData(ctx, &commonCmdData)
            cmd := common.SetCommandContext(ctx, &cobra.Command{
                Use:                   "run [options] [IMAGE_NAME] [-- COMMAND ARG...]",
                Short:                 "Run container for project image",
        Severity: Major
        Found in cmd/werf/run/run.go - About 2 hrs to fix

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

          func run(ctx context.Context, imageNames []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/managed_images/rm/rm.go - About 2 hrs to fix

            Function runDismiss has 91 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

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

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

              func NewCmd(ctx context.Context) *cobra.Command {
                  ctx = common.NewContextWithCmdData(ctx, &commonCmdData)
                  cmd := common.SetCommandContext(ctx, &cobra.Command{
                      Use:                   "graph [IMAGE_NAME...]",
                      DisableFlagsInUseLine: true,
              Severity: Major
              Found in cmd/werf/config/graph/graph.go - About 2 hrs to fix

                Function GetInfo has a Cognitive Complexity of 34 (exceeds 20 allowed). Consider refactoring.
                Open

                func GetInfo(path string, firstTime bool) (info Info, err error) {
                    s := syscall.Statfs_t{}
                    err = syscall.Statfs(path, &s)
                    if err != nil {
                        return Info{}, err
                Severity: Minor
                Found in pkg/third_party/minio/disk/stat_linux.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

                Method FileReader.resolveFilePath has a Cognitive Complexity of 34 (exceeds 20 allowed). Consider refactoring.
                Open

                func (r FileReader) resolveFilePath(ctx context.Context, relPath string, depth int, checkSymlinkTargetFunc func(resolvedPath string) error) (string, error) {
                    if depth > 1000 {
                        return "", fmt.Errorf("too many levels of symbolic links")
                    }
                    depth++
                Severity: Minor
                Found in pkg/giterminism_manager/file_reader/fs.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 run has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                Open

                    def run(self):
                        self.stdout_sock.listen(1)
                
                        rsockets = [self.stdout_sock]
                        while True:
                Severity: Minor
                Found in pkg/build/builder/ansible/werf/live_stdout.py - 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 run has 89 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

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

                  Function runRender has 28 return statements (exceeds 4 allowed).
                  Open

                  func runRender(ctx context.Context) 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/render/render.go - About 2 hrs to fix

                    Manager has 23 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                    type Manager struct {
                        stages               map[string]*stage
                        stageIDCustomTagList map[string][]string
                        finalStages          map[string]*stage
                        imageMetadataList    []*imageMetadata
                    Severity: Minor
                    Found in pkg/cleaning/stage_manager/manager.go - About 2 hrs to fix

                      FileReader has 23 methods (exceeds 20 allowed). Consider refactoring.
                      Open

                      func (r FileReader) projectDirRelativePathToWorkTreeRelativePath(relPath string) string {
                          return filepath.Join(r.sharedOptions.RelativeToGitProjectDir(), relPath)
                      }
                      Severity: Minor
                      Found in pkg/giterminism_manager/file_reader/git.go - About 2 hrs to fix

                        Function runMain has 87 lines of code (exceeds 50 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: Major
                        Found in cmd/werf/run/run.go - About 2 hrs to fix

                          Method cleanupManager.cleanupImageMetadata has a Cognitive Complexity of 33 (exceeds 20 allowed). Consider refactoring.
                          Open

                          func (m *cleanupManager) cleanupImageMetadata(ctx context.Context, imageName string, hitStageIDCommitList map[string][]string, stageIDsToUnlink []string) error {
                              if countStageIDCommitList(hitStageIDCommitList) != 0 || len(stageIDsToUnlink) != 0 {
                                  stageIDCommitListToDelete := map[string][]string{}
                                  stageIDCommitListToCleanup := m.stageManager.GetStageIDCommitListToCleanup(imageName)
                              stageIDCommitListLoop:
                          Severity: Minor
                          Found in pkg/cleaning/cleanup.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 newCmd has 84 lines of code (exceeds 50 allowed). Consider refactoring.
                          Open

                          func newCmd(ctx context.Context, composeCmdName string, options *newCmdOptions) *cobra.Command {
                              var cmdData composeCmdData
                              var commonCmdData common.CmdData
                          
                              short := GetComposeShort(composeCmdName).Short
                          Severity: Major
                          Found in cmd/werf/compose/main.go - About 2 hrs to fix

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

                            func NewCmd(ctx context.Context) *cobra.Command {
                                ctx = common.NewContextWithCmdData(ctx, &commonCmdData)
                                cmd := common.SetCommandContext(ctx, &cobra.Command{
                                    Use:                   "render [IMAGE_NAME...]",
                                    Short:                 "Render Kubernetes templates",
                            Severity: Major
                            Found in cmd/werf/render/render.go - About 2 hrs to fix

                              Function NewNativeBuildah has 84 lines of code (exceeds 50 allowed). Consider refactoring.
                              Open

                              func NewNativeBuildah(commonOpts CommonBuildahOpts, opts NativeModeOpts) (*NativeBuildah, error) {
                                  b := &NativeBuildah{
                                      Isolation: *commonOpts.Isolation,
                                      TmpDir:    commonOpts.TmpDir,
                                      Insecure:  commonOpts.Insecure,
                              Severity: Major
                              Found in pkg/buildah/native_linux.go - About 2 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language