12rambau/sepal_ui

View on GitHub

Showing 45 of 52 total issues

Function zoom_ee_object has a Cognitive Complexity of 131 (exceeds 5 allowed). Consider refactoring.
Open

    def zoom_ee_object(self, item: ee.ComputedObject, zoom_out: int = 1) -> Self:
        """Get the proper zoom to the given ee geometry.

        Args:
            item: the geometry to zoom on
Severity: Minor
Found in sepal_ui/mapping/sepal_map.py - About 2 days 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 switch has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
Open

def switch(
    *params, debug: bool = True, on_widgets: List[str] = [], targets: List[bool] = []
) -> Any:
    r"""Decorator to switch the state of input boolean parameters on class widgets or the class itself.

Severity: Minor
Found in sepal_ui/scripts/decorator.py - About 6 hrs 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 main has 49 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def main() -> None:
    """Launch the process."""
    # parse arguments
    parser.parse_args()

Severity: Minor
Found in sepal_ui/bin/module_factory.py - About 1 hr to fix

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

    def __init__(
        self,
        methods: Union[str, List[str]] = "ALL",
        gee: bool = True,
        map_: Optional[sm.SepalMap] = None,
Severity: Minor
Found in sepal_ui/aoi/aoi_view.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_items has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def _get_items(self) -> List[v.ListItem]:
        """Create the list of items inside the folder.

        Returns:
            list of items inside the selected folder
Severity: Minor
Found in sepal_ui/sepalwidgets/inputs.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_children has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def get_children(
        self,
        widget: Optional[v.VuetifyWidget] = None,
        klass: Optional[Type[v.VuetifyWidget]] = None,
        attr: str = "",
Severity: Minor
Found in sepal_ui/sepalwidgets/sepalwidget.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 __init__ has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def __init__(
        self,
        basemaps: List[str] = [],
        dc: bool = False,
        vinspector: bool = False,
Severity: Minor
Found in sepal_ui/mapping/sepal_map.py - About 1 hr to fix

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

def get_xyz_dict(
    free_only: bool = True,
    _collection: Optional[dict] = None,
    _output: Optional[dict] = None,
) -> dict:
Severity: Minor
Found in sepal_ui/mapping/basemaps.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 catch_errors has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

def catch_errors(alert: Optional[v.Alert] = None, debug: Optional[bool] = None) -> Any:
    """Decorator to execute try/except sentence and catch errors in the alert message.

    If debug is True then the error is raised anyway.

Severity: Minor
Found in sepal_ui/scripts/decorator.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 delete_assets has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

def delete_assets(asset_id: str, dry_run: bool = True) -> None:
    """Delete the selected asset and all its content.

    This method will delete all the files and folders existing in an asset folder. By default a dry run will be launched and if you are satisfyed with the displayed names, change the ``dry_run`` variable to ``False``. No other warnng will be displayed.

Severity: Minor
Found in sepal_ui/scripts/gee.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 geojson_to_ee has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

def geojson_to_ee(
    geo_json: dict, geodesic: bool = False, encoding: str = "utf-8"
) -> ee.FeatureCollection:
    """Transform a geojson object into a featureCollection or a Geometry.

Severity: Minor
Found in sepal_ui/scripts/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 main has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def main() -> None:
    """Launch the venv creation process."""
    # read arguments (there should be none)
    parser.parse_args()

Severity: Minor
Found in sepal_ui/bin/module_venv.py - About 1 hr to fix

Function read_data has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def read_data(self, **kwargs) -> None:
        """Read the data when the map is clicked with the vinspector activated.

        Args:
            kwargs: any arguments from the map interaction
Severity: Minor
Found in sepal_ui/mapping/inspector_control.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 sanitize has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def sanitize(cls, d: Union[dict, list]) -> dict:
        """Identify numbered dictionaries embedded in the dict and transform them into lists.

        This function is an helper to prevent deprecation after the introduction of pontoon for translation.
        The user is now force to use keys even for numbered lists. SimpleNamespace doesn't support integer indexing
Severity: Minor
Found in sepal_ui/translator/translator.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 loading_button has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def loading_button(
    alert: Optional[v.Alert] = None,
    button: Optional[v.Btn] = None,
    debug: Optional[bool] = None,
) -> Any:
Severity: Minor
Found in sepal_ui/scripts/decorator.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 key_use has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def key_use(self, folder: Path, name: str) -> List[str]:
        """Parse all the files in the folder and check if keys are all used at least once.

        Return the unused key names.

Severity: Minor
Found in sepal_ui/translator/translator.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 search_status has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def search_status(d: dict) -> List[Dict[str, bool]]:
        """Get the status of a specific subscription.

        Args:
            d: dictionary of subscription object
Severity: Minor
Found in sepal_ui/planetapi/planet_model.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 _toggle_btns has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def _toggle_btns(self, change: dict) -> None:
        """Toggle the status of the btns."""
        if not change["new"]:
            self.v_model = 1
            [self._turn_btn(btn_id, False) for btn_id in BTNS.keys()]
Severity: Minor
Found in sepal_ui/planetapi/planet_widgets.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 read_data has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def read_data(self, **kwargs) -> None:
        """Read the data when the map is clicked with the vinspector activated.

        Args:
            kwargs: any arguments from the map interaction
Severity: Minor
Found in sepal_ui/mapping/inspector_control.py - About 1 hr to fix

Function __init__ has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def __init__(
        self,
        extensions: List[str] = [],
        folder: Union[str, Path] = Path.home(),
        label: str = ms.widgets.fileinput.label,
Severity: Minor
Found in sepal_ui/sepalwidgets/inputs.py - About 1 hr to fix
Severity
Category
Status
Source
Language