Showing 614 of 901 total issues

Function SetWerfFirstRunAt has 5 return statements (exceeds 4 allowed).
Open

func SetWerfFirstRunAt(ctx context.Context) error {
    path := getWerfFirstRunAtPath()
    if _, lock, err := AcquireHostLock(ctx, path, lockgate.AcquireOptions{OnWaitFunc: func(lockName string, doWait func() error) error { return doWait() }}); err != nil {
        return fmt.Errorf("error locking path %q: %w", path, err)
    } else {
Severity: Major
Found in pkg/werf/last_werf_run_at.go - About 35 mins to fix

    Method get_lang_field_or_raise_error has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_lang_field_or_raise_error(hash)
            if !(hash == nil or hash.instance_of? Hash)
                raise "get_lang_field_or_raise_error filter failed: unexpected argument '#{hash}'"
            end
    
    
    Severity: Minor
    Found in docs/_plugins/custom_filters.rb - About 35 mins 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 21 (exceeds 20 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: Minor
    Found in cmd/werf/managed_images/add/add.go - About 25 mins 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 getCustomTagFuncList has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
    Open

    func getCustomTagFuncList(tagOptionValues []string, commonCmdData *CmdData, imageNameList []string) ([]image.CustomTagFunc, error) {
        if len(tagOptionValues) == 0 {
            return nil, nil
        }
    
    
    Severity: Minor
    Found in cmd/werf/common/conveyor_options.go - About 25 mins 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.GetStagesIDs has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
    Open

    func (storage *RepoStagesStorage) GetStagesIDs(ctx context.Context, _ 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 25 mins 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.run has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
    Open

    func (m *cleanupManager) run(ctx context.Context) error {
        if err := logboek.Context(ctx).LogProcess("Fetching manifests and metadata").DoError(func() error {
            return m.init(ctx)
        }); err != nil {
            return err
    Severity: Minor
    Found in pkg/cleaning/cleanup.go - About 25 mins 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 GetExistingGitWorktrees has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
    Open

    func GetExistingGitWorktrees(cacheVersionRoot string) ([]*GitWorktreeDesc, error) {
        var res []*GitWorktreeDesc
    
        for _, dir := range []string{filepath.Join(cacheVersionRoot, "local"), filepath.Join(cacheVersionRoot, "remote")} {
            if _, err := os.Stat(dir); os.IsNotExist(err) {
    Severity: Minor
    Found in pkg/git_repo/gitdata/git_worktree.go - About 25 mins 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.skipFileFunc has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
    Open

    func (r FileReader) skipFileFunc(acceptedFilePathMatcher path_matcher.PathMatcher) func(ctx context.Context, r FileReader, existingRelPath string) (bool, error) {
        return func(ctx context.Context, r FileReader, existingRelPath string) (bool, error) {
            if filepath.Base(existingRelPath) == ".git" {
                return true, nil
            }
    Severity: Minor
    Found in pkg/giterminism_manager/file_reader/fs.go - About 25 mins 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 Dependency.validate has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
    Open

    func (d *Dependency) validate() error {
        if d.ImageName == "" {
            return newDetailedConfigError("image name is not specified for dependency", d.raw, d.raw.doc())
        }
    
    
    Severity: Minor
    Found in pkg/config/dependency.go - About 25 mins 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 mock_subprocess_Popen_in_low_level_execute has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    def mock_subprocess_Popen_in_low_level_execute():
        from ansible.plugins.action import ActionBase
        import subprocess
        original_low_exec = ActionBase._low_level_execute_command
        def new_low_exec(self, cmd, **kwargs):
    Severity: Minor
    Found in pkg/build/builder/ansible/sitecustomize.py - About 25 mins 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 Conveyor.doImagesInParallel has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
    Open

    func (c *Conveyor) doImagesInParallel(ctx context.Context, phases []Phase, logImages bool) error {
        if logImages {
            blockMsg := "Concurrent build plan"
            if c.ParallelTasksLimit > 0 {
                blockMsg = fmt.Sprintf("%s (no more than %d images at the same time)", blockMsg, c.ParallelTasksLimit)
    Severity: Minor
    Found in pkg/build/conveyor.go - About 25 mins 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 Conveyor.doImage has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
    Open

    func (c *Conveyor) doImage(ctx context.Context, img *image.Image, phases []Phase) error {
        return logboek.Context(ctx).LogProcess(img.LogDetailedName()).
            Options(func(options types.LogProcessOptionsInterface) {
                options.Style(img.LogProcessStyle())
            }).
    Severity: Minor
    Found in pkg/build/conveyor.go - About 25 mins 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 ExportBase.AutoExcludeExportAndCheck has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
    Open

    func (c *ExportBase) AutoExcludeExportAndCheck(exp autoExcludeExport) bool {
        if !isSubPath(c.To, exp.GetTo()) {
            return true
        }
    
    
    Severity: Minor
    Found in pkg/config/export_base.go - About 25 mins 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 _deprecated_msg has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def _deprecated_msg(self, msg, version=None, removed=False):
            ''' used to print out a deprecation message.'''
            if not removed and not C.DEPRECATION_WARNINGS:
                return
    
    
    Severity: Minor
    Found in pkg/build/builder/ansible/callback/live.py - About 25 mins 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