pyomeca/bioptim

View on GitHub

Showing 631 of 631 total issues

Function mx has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def mx(self):
        """
        Returns
        -------
        The MX of all variable concatenated together
Severity: Minor
Found in bioptim/optimization/parameters.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 muscle_driven has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def muscle_driven(
        ocp,
        nlp,
        with_excitations: bool = False,
        fatigue: FatigueList = None,
Severity: Minor
Found in bioptim/dynamics/configure_problem.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 _check_has_no_phase_dynamics_shared_during_the_phase has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def _check_has_no_phase_dynamics_shared_during_the_phase(problem_type, **kwargs):
    if not isinstance(problem_type, SocpType.COLLOCATION):
        if "phase_dynamics" in kwargs:
            if kwargs["phase_dynamics"] == PhaseDynamics.SHARED_DURING_THE_PHASE:
                raise ValueError(
Severity: Minor
Found in bioptim/optimization/stochastic_optimal_control_program.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 export_data has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def export_data(self, sol) -> tuple:
        states, controls, parameters = super(CyclicRecedingHorizonOptimization, self).export_data(sol)

        frames = self.frame_to_export
        if frames.stop is not None and frames.stop != self.nlp[0].n_controls_nodes:
Severity: Minor
Found in bioptim/optimization/receding_horizon_optimization.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_cyclic_bound has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def _set_cyclic_bound(self, sol: Solution = None):
        if self.nlp[0].x_bounds.type != InterpolationType.CONSTANT_WITH_FIRST_AND_LAST_DIFFERENT:
            raise ValueError(
                "Cyclic bounds for x_bounds should be of "
                "type InterpolationType.CONSTANT_WITH_FIRST_AND_LAST_DIFFERENT"
Severity: Minor
Found in bioptim/optimization/receding_horizon_optimization.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 _check_multi_threading_and_problem_type has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def _check_multi_threading_and_problem_type(problem_type, **kwargs):
    if not isinstance(problem_type, SocpType.COLLOCATION):
        if "n_thread" in kwargs:
            if kwargs["n_thread"] != 1:
                raise ValueError(
Severity: Minor
Found in bioptim/optimization/stochastic_optimal_control_program.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 graphs has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def graphs(
        self,
        automatically_organize: bool = True,
        show_bounds: bool = False,
        show_now: bool = True,
Severity: Minor
Found in bioptim/optimization/solution/solution.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 append has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def append(self, name: str, cx: list, bimapping: BiMapping):
        """
        Add a new variable to the list

        Parameters
Severity: Minor
Found in bioptim/optimization/optimization_variable.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, key: str, scaling: np.ndarray | list = None, **kwargs):
        """
        Parameters
        ----------
        scaling: np.ndarray | list
Severity: Minor
Found in bioptim/optimization/variable_scaling.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 append_from_scaled has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def append_from_scaled(
        self,
        name: str,
        cx: list,
        scaled_optimization_variable: "OptimizationVariableList",
Severity: Minor
Found in bioptim/optimization/optimization_variable.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 decision_parameters has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def decision_parameters(self, scaled: bool = False, to_merge: SolutionMerge | list[SolutionMerge] = None):
        """
        Returns the decision parameters

        Parameters
Severity: Minor
Found in bioptim/optimization/solution/solution.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