cloudsmith-io/cloudsmith-cli

View on GitHub
cloudsmith_cli/cli/validators.py

Summary

Maintainability
A
3 hrs
Test Coverage
F
46%

Function validate_api_headers has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

def validate_api_headers(param, value):
    """Validate that API headers is a CSV of k=v pairs."""
    # pylint: disable=unused-argument
    if not value:
        return None
Severity: Minor
Found in cloudsmith_cli/cli/validators.py - About 1 hr 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 validate_slashes has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def validate_slashes(
    param, value, minimum=2, maximum=None, form=None, allow_blank=False
):
    """Ensure that parameter has slashes and minimum parts."""
    try:
Severity: Minor
Found in cloudsmith_cli/cli/validators.py - About 1 hr 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 validate_slashes has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

def validate_slashes(
Severity: Minor
Found in cloudsmith_cli/cli/validators.py - About 45 mins to fix

    Function validate_scheduled_reset_period has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    def validate_scheduled_reset_period(ctx, param, value):
        """Ensure that a valid value for scheduled reset period is used."""
    
        periods = [
            "Never Reset",
    Severity: Minor
    Found in cloudsmith_cli/cli/validators.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

    Function validate_bandwidth_unit has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    def validate_bandwidth_unit(ctx, param, value):
        """Ensure that a valid value for bandwidth unit is used."""
    
        units = [
            "Byte",
    Severity: Minor
    Found in cloudsmith_cli/cli/validators.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

    There are no issues that match your filters.

    Category
    Status