cloudsmith-io/cloudsmith-cli

View on GitHub
cloudsmith_cli/cli/commands/policy/vulnerability.py

Summary

Maintainability
F
6 days
Test Coverage
A
96%

Function ls has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

def ls(ctx, opts, owner, page, page_size):
Severity: Minor
Found in cloudsmith_cli/cli/commands/policy/vulnerability.py - About 35 mins to fix

    Function update has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def update(ctx, opts, owner, identifier, policy_config_file):
    Severity: Minor
    Found in cloudsmith_cli/cli/commands/policy/vulnerability.py - About 35 mins to fix

      Function delete has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def delete(ctx, opts, owner, identifier, yes):
      Severity: Minor
      Found in cloudsmith_cli/cli/commands/policy/vulnerability.py - About 35 mins to fix

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        @vulnerability.command()
        @decorators.common_cli_config_options
        @decorators.common_cli_output_options
        @decorators.common_api_auth_options
        @decorators.initialise_api
        Severity: Major
        Found in cloudsmith_cli/cli/commands/policy/vulnerability.py and 1 other location - About 2 days to fix
        cloudsmith_cli/cli/commands/policy/license.py on lines 201..267

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 232.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        @vulnerability.command(aliases=["rm"])
        @decorators.common_cli_config_options
        @decorators.common_cli_output_options
        @decorators.common_api_auth_options
        @decorators.initialise_api
        Severity: Major
        Found in cloudsmith_cli/cli/commands/policy/vulnerability.py and 1 other location - About 2 days to fix
        cloudsmith_cli/cli/commands/policy/license.py on lines 270..326

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 218.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        @vulnerability.command(name="list", aliases=["ls"])
        @decorators.common_cli_config_options
        @decorators.common_cli_list_options
        @decorators.common_cli_output_options
        @decorators.common_api_auth_options
        Severity: Major
        Found in cloudsmith_cli/cli/commands/policy/vulnerability.py and 1 other location - About 1 day to fix
        cloudsmith_cli/cli/commands/policy/license.py on lines 79..123

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 191.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

        @vulnerability.command(aliases=["new"])
        @decorators.common_cli_config_options
        @decorators.common_cli_output_options
        @decorators.common_api_auth_options
        @decorators.initialise_api
        Severity: Major
        Found in cloudsmith_cli/cli/commands/policy/vulnerability.py and 2 other locations - About 2 hrs to fix
        cloudsmith_cli/cli/commands/policy/license.py on lines 126..133
        cloudsmith_cli/cli/commands/repos.py on lines 135..142

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 61.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        @policy.group(cls=command.AliasGroup, name="vulnerability", aliases=[])
        @decorators.common_cli_config_options
        @decorators.common_cli_output_options
        @decorators.common_api_auth_options
        @decorators.initialise_api
        Severity: Major
        Found in cloudsmith_cli/cli/commands/policy/vulnerability.py and 1 other location - About 1 hr to fix
        cloudsmith_cli/cli/commands/policy/license.py on lines 65..76

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 40.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            with handle_api_exceptions(ctx, opts=opts, context_msg=context_msg):
                with maybe_spinner(opts):
                    policies = [api.create_vulnerability_policy(owner, policy_config)]
        Severity: Minor
        Found in cloudsmith_cli/cli/commands/policy/vulnerability.py and 1 other location - About 55 mins to fix
        cloudsmith_cli/cli/commands/policy/license.py on lines 189..191

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 37.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        There are no issues that match your filters.

        Category
        Status