gfw-api/gfw-analysis-gee

View on GitHub
gfwanalysis/services/analysis/recent_tiles.py

Summary

Maintainability
C
1 day
Test Coverage
F
50%

File recent_tiles.py has 300 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""EE SENTINEL TILE URL SERVICE"""

import asyncio
import collections
import functools as funct
Severity: Minor
Found in gfwanalysis/services/analysis/recent_tiles.py - About 3 hrs to fix

    Function recent_data has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        def recent_data(lat, lon, start, end, sort_by):
            logging.info("[RECENT>DATA] function initiated")
            try:
                point = ee.Geometry.Point(float(lon), float(lat))
                S2 = (
    Severity: Minor
    Found in gfwanalysis/services/analysis/recent_tiles.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 recent_thumbs has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        def recent_thumbs(col_data, bands, bmin, bmax, opacity):
            """Takes collection data array and fetches thumbs"""
            source = col_data["source"]
            logging.info(f"[RECENT>THUMB] {source}")
    
    
    Severity: Minor
    Found in gfwanalysis/services/analysis/recent_tiles.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 recent_tiles has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        def recent_tiles(col_data, bands, bmin, bmax, opacity):
            """Takes collection data array and fetches tiles"""
            logging.info(f"[RECENT>TILE] {col_data.get('source')}")
    
            source = col_data["source"]
    Severity: Minor
    Found in gfwanalysis/services/analysis/recent_tiles.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_bands has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def validate_bands(bands, instrument):
            """Validate and serialide bands"""
            # Format
            if type(bands) == str:
                bands = bands[1:-1].split(",")
    Severity: Minor
    Found in gfwanalysis/services/analysis/recent_tiles.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

    There are no issues that match your filters.

    Category
    Status