12rambau/sepal_ui

View on GitHub

Showing 47 of 54 total issues

Function update_nb_layer has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def update_nb_layer(self, change: dict) -> None:
        """Update the number of layer monitored by the statebar."""
        # exit if nothing changed
        # for example we change a layer parameters and it trigger this one
        if len(change["new"]) == len(change["old"]):
Severity: Minor
Found in sepal_ui/mapping/layer_state_control.py - About 55 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 init_ee has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

def init_ee() -> None:
    r"""Initialize earth engine according using a token.

    THe environment used to run the tests need to have a EARTHENGINE_TOKEN variable.
    The content of this variable must be the copy of a personal credential file that you can find on your local computer if you already run the earth engine command line tool. See the usage question for a github action example.
Severity: Minor
Found in sepal_ui/scripts/decorator.py - About 45 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 init_ee has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

def init_ee() -> None:
    r"""Initialize earth engine according using a token.

    THe environment used to run the tests need to have a EARTHENGINE_TOKEN variable.
    The content of this variable must be the copy of a personal credential file that you can find on your local computer if you already run the earth engine command line tool. See the usage question for a github action example.
Severity: Minor
Found in sepal_ui/scripts/utils.py - About 45 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 _is_active has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def _is_active(self) -> None:
        """Check if the key has an associated active subscription and change the state button accordingly."""
        # As there is not any key that identify the nicfi contract,
        # let's find though all the subscriptions a representative name
        wildcards = ["Level_0", "Level_1", "Level2"]
Severity: Minor
Found in sepal_ui/planetapi/planet_model.py - About 45 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 to_colors has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

def to_colors(in_color: Union[str, Sequence], out_type: str = "hex") -> Union[str, tuple]:
    """Transform any color type into a color in the specified output format.

    Available format: [hex]

Severity: Minor
Found in sepal_ui/scripts/utils.py - About 45 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 add_colorbar has 11 arguments (exceeds 10 allowed). Consider refactoring.
Open

    def add_colorbar(
Severity: Major
Found in sepal_ui/mapping/sepal_map.py - About 35 mins to fix

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

    def _on_theme_change(self, _) -> None:
        """Change the url of the basemaps."""
        light = "https://a.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png"
        dark = "https://a.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}.png"

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

    def _activate(self, change: dict) -> None:
        """Activate the adapted widgets."""
        # clear and hide the alert
        self.alert.reset()

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

    def init_session(self, credentials: Union[str, List[str]], write_secrets: bool = False) -> None:
        """Initialize planet client with api key or credentials. It will handle errors.

        Args:
            credentials: planet API key, username and password pair or a secrets planet.json file.
Severity: Minor
Found in sepal_ui/planetapi/planet_model.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 _remove_banner has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def _remove_banner(self, change: dict) -> None:
        """Remove banner and adapt display of the others.

        Adapt the banner display so that the first one is the only one shown displaying the number of other banner in the queue
        """
Severity: Minor
Found in sepal_ui/sepalwidgets/app.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 __init__ has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def __init__(
        self,
        tiles: List[v.Card] = [],
        appBar: Optional[AppBar] = None,
        footer: Optional[Footer] = None,
Severity: Minor
Found in sepal_ui/sepalwidgets/app.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 set_object has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def set_object(self, method: str = "") -> Self:
        """Set the object (gdf/featurecollection) based on the model inputs.

        The method can be manually overwritten by setting the ``method`` parameter.

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

    def set_default(
        self,
        vector: Optional[Union[str, Path]] = None,
        admin: Optional[str] = None,
        asset: Optional[Union[str, Path]] = None,
Severity: Minor
Found in sepal_ui/aoi/aoi_model.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 _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 show_tile has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def show_tile(self, name: str) -> Self:
        """Select the tile to display when the app is launched.

        Args:
            name: the mount-id of the tile(s) to display
Severity: Minor
Found in sepal_ui/sepalwidgets/app.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 main has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def main() -> None:
    """Activate the selected venv."""
    # parse arguments
    parser.parse_args()

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

    def _from_eelayer(self, ee_obj: ee.ComputedObject, coords: Sequence[float]) -> dict:
        """Extract the values of the ee_object for the considered point.

        Args:
            ee_obj: the ee object to reduce to a single point
Severity: Minor
Found in sepal_ui/mapping/inspector_control.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 _from_geo_json has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def _from_geo_json(self, geo_json: dict) -> Self:
        """Set the gdf output from a geo_json.

        Args:
            geo_json: the __geo_interface__ dict of a geometry drawn on the map
Severity: Minor
Found in sepal_ui/aoi/aoi_model.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 __init__ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def __init__(self, msg: str = "", gliph: str = "", **kwargs) -> None:
        """Custom process Btn filled with the provided text.

        The color will be defaulted to 'primary' and can be changed afterward according to your need.

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

    def _set_legend(self, *args) -> None:
        """Creates/update a legend based on the class legend_dict member."""
        # Do this to avoid crash when called by trait for the first time
        if self._html_table is None:
            return
Severity: Minor
Found in sepal_ui/mapping/legend_control.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