pierre-manchon/INPMT

View on GitHub

Showing 5 of 7 total issues

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

def format_dataset_output(
    dataset: AnyStr = "", name: AnyStr = "", ext: AnyStr = "", prevent_duplicate=True
) -> tuple[str, AnyStr | str, str]:
    """
    :param dataset: Path to a file
Severity: Minor
Found in INPMT/utils/utils.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 get_urban_profile has 9 arguments (exceeds 4 allowed). Consider refactoring.
Open

def get_urban_profile(
Severity: Major
Found in INPMT/processing.py - About 1 hr to fix

    Function get_nearest_park has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    def get_nearest_park(
            parks: GeoDataFrame,
            geom_villages: GeoDataFrame
    ) -> tuple[Any | None, str | None, str]:
        """
    Severity: Minor
    Found in INPMT/processing.py - 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 get_urban_profile has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    def get_urban_profile(
        datasets: str,
        villages: AnyStr,
        parks: AnyStr,
        population: xr.Dataset,
    Severity: Minor
    Found in INPMT/processing.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 get_landuse has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    def get_landuse(
        dataset: xr.Dataset,
        qml: list
    ) -> tuple[DataFrame, int]:
        """
    Severity: Minor
    Found in INPMT/processing.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