Showing 16 of 16 total issues
Function update_object_options
has a Cognitive Complexity of 27 (exceeds 6 allowed). Consider refactoring. Open
def update_object_options(
self,
ui_json_data: dict,
filename: str,
contents: str,
- Read upRead up
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_component
has a Cognitive Complexity of 26 (exceeds 6 allowed). Consider refactoring. Open
def _init_component(
comp: Component, ui_json_data: dict, kwargs: dict | None = None
):
"""
Initialize dash component from ui_json_data.
- Read upRead up
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_params_dict
has a Cognitive Complexity of 21 (exceeds 6 allowed). Consider refactoring. Open
def get_params_dict(self, update_dict: dict) -> dict:
"""
Get dict of current params.
:param update_dict: Dict of parameters with new values to convert to a params dict.
- Read upRead up
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_data_options
has a Cognitive Complexity of 20 (exceeds 6 allowed). Consider refactoring. Open
def get_data_options(
self,
ui_json_data: dict,
object_uid: str | None,
object_name: str = "objects",
- Read upRead up
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 find_value
has a Cognitive Complexity of 18 (exceeds 6 allowed). Consider refactoring. Open
def find_value(labels: list, keywords: list, default=None) -> list:
"""
Find matching keywords within a list of labels.
:param labels: List of labels or list of [key, value] that may contain the keywords.
- Read upRead up
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 update
has a Cognitive Complexity of 18 (exceeds 6 allowed). Consider refactoring. Open
def update(self, params_dict: dict[str, Any]):
"""
Update parameters with dictionary contents.
:param params_dict: Dictionary of parameters.
- Read upRead up
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 free_parameter_dict
has a Cognitive Complexity of 17 (exceeds 6 allowed). Consider refactoring. Open
def free_parameter_dict(self) -> dict:
"""
Extract groups of free parameters from the ui_json dictionary that match
the 'free_parameter_identifier' and 'free_parameter_keys'.
- Read upRead up
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 _copy_property_groups
has a Cognitive Complexity of 15 (exceeds 6 allowed). Consider refactoring. Open
def _copy_property_groups(source_groups: list[ObjectBase], param_dict: dict):
"""Copy any property groups over to param_dict of temporary workspace"""
temp_prop_groups = param_dict["objects"].property_groups
for group in source_groups:
if not isinstance(group, PropertyGroup):
- Read upRead up
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 sorted_children_dict
has a Cognitive Complexity of 10 (exceeds 6 allowed). Consider refactoring. Open
def sorted_children_dict(
entity: UUID | Entity, workspace: Workspace | None = None
) -> dict[str, UUID] | None:
"""
Uses natural sorting algorithm to order the keys of a dictionary containing
- Read upRead up
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
Avoid deeply nested control flow statements. Open
if key not in label.lower():
raise ValueError(
f"Malformed input refinement group {group}. "
f"Must contain forms for all "
f"of {self._free_parameter_keys} in this order."
Function weighted_average
has 8 arguments (exceeds 6 allowed). Consider refactoring. Open
def weighted_average( # pylint: disable=too-many-arguments, too-many-locals
Avoid deeply nested control flow statements. Open
for elem in utils.collect(
self.ui_json, "group", self.ui_json[key]["group"]
):
setattr(self, elem, None)
Function __init__
has a Cognitive Complexity of 8 (exceeds 6 allowed). Consider refactoring. Open
def __init__(
self,
ui_json: InputFile | None = None,
ui_json_data: dict | None = None,
params: BaseParams | None = None,
- Read upRead up
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 collect_input_from_dict
has a Cognitive Complexity of 8 (exceeds 6 allowed). Consider refactoring. Open
def collect_input_from_dict(
base_model: BaseModel, data: dict[str, Any]
) -> dict[str, dict | Any]:
"""
Recursively replace BaseModel objects with dictionary of 'data' values.
- Read upRead up
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
Avoid too many return
statements within this function. Open
return
Function get_locations
has a Cognitive Complexity of 7 (exceeds 6 allowed). Consider refactoring. Open
def get_locations(workspace: Workspace, entity: UUID | Points | GridObject | Data):
"""
Returns entity's centroids or vertices.
If no location data is found on the provided entity, the method will
- Read upRead up
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"