12rambau/sepal_ui

View on GitHub
sepal_ui/sepalwidgets/inputs.py

Summary

Maintainability
A
3 hrs
Test Coverage

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 _on_file_input_change has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def _on_file_input_change(self, change: dict) -> Self:
        """Update the select content when the fileinput v_model is changing."""
        # clear the selects
        self._clear_select()

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

    def _validate(self, change: dict) -> None:
        """Validate the selected asset. Throw an error message if is not accessible or not in the type list."""
        self.error_messages = None

        # trim the current value
Severity: Minor
Found in sepal_ui/sepalwidgets/inputs.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_items has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def _get_items(self, *args) -> Self:
        # init the item list
        items = []

        # add the default values if needed
Severity: Minor
Found in sepal_ui/sepalwidgets/inputs.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