pyomeca/bioptim

View on GitHub

Showing 631 of 631 total issues

File integrator.py has 664 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import numpy as np
from casadi import Function, vertcat, horzcat, collocation_points, tangent, rootfinder, DM, MX, SX, linspace

from ..misc.enums import ControlType, DefectType
from ..models.protocols.biomodel import BioModel
Severity: Major
Found in bioptim/dynamics/integrator.py - About 1 day to fix

    File multinode_penalty.py has 659 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    from typing import Callable, Any
    
    from casadi import MX_eye, SX_eye, jacobian, Function, MX, SX, vertcat
    
    from .constraints import PenaltyOption
    Severity: Major
    Found in bioptim/limits/multinode_penalty.py - About 1 day to fix

      MultiBiorbdModel has 74 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class MultiBiorbdModel:
          """
          This class allows to define multiple biorbd models for the same phase.
      
      
      
      Severity: Major
      Found in bioptim/models/biorbd/multi_biorbd_model.py - About 1 day to fix

        File __main__.py has 618 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        # based on https://github.com/pyqtgraph/pyqtgraph/tree/master/pyqtgraph/examples
        
        import keyword
        import os
        import re
        Severity: Major
        Found in bioptim/examples/__main__.py - About 1 day to fix

          Function generic_dispatch_bounds has a Cognitive Complexity of 63 (exceeds 5 allowed). Consider refactoring.
          Open

          def generic_dispatch_bounds(interface, include_g: bool, include_g_internal: bool, include_g_implicit: bool):
              """
              Parse the bounds of the full ocp to a SQP-friendly one
          
              Parameters
          Severity: Minor
          Found in bioptim/interfaces/interface_utils.py - About 1 day 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

          File arm_reaching_torque_driven_explicit.py has 568 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          """
          This example is adapted from arm_reaching_muscle_driven.py to make it torque driven.
          The states dynamics is implicit. which allows to minimize the uncertainty on the acceleration of joints.
          The algebraic states dynamics is explicit.
          """

            File online_callback_server.py has 566 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            from enum import IntEnum, StrEnum, auto
            import json
            import logging
            import platform
            import socket
            Severity: Major
            Found in bioptim/gui/online_callback_server.py - About 1 day to fix

              File stochastic_optimal_control_program.py has 564 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              from typing import Callable
              
              import numpy as np
              from casadi import DM_eye, vertcat, Function
              
              
              Severity: Major
              Found in bioptim/optimization/stochastic_optimal_control_program.py - About 1 day to fix

                File obstacle_avoidance_direct_collocation.py has 558 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                """
                This example aims to replicate the example provided in Gillis 2013: https://doi.org/10.1109/CDC.2013.6761121.
                It consists in a mass-point trying to find a time optimal periodic trajectory around super-ellipse obstacles.
                The controls are coordinates of a quide-point (the mass is attached to this guide point with a sping).
                """

                  File configure_new_variable.py has 557 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  from casadi import MX, SX, vertcat
                  import numpy as np
                  
                  from .fatigue.fatigue_dynamics import FatigueList, MultiFatigueInterface
                  from ..gui.plot import CustomPlot
                  Severity: Major
                  Found in bioptim/dynamics/configure_new_variable.py - About 1 day to fix

                    BioModel has 61 functions (exceeds 20 allowed). Consider refactoring.
                    Open

                    class BioModel(Protocol):
                        """
                        This protocol defines the minimal set of attributes and methods a model should possess to access every feature of
                        bioptim.
                        As a reminder for developers: only necessary attributes and methods should appear here.
                    Severity: Major
                    Found in bioptim/models/protocols/biomodel.py - About 1 day to fix

                      File ode_solver.py has 529 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      from typing import Callable
                      
                      from casadi import MX, SX, integrator as casadi_integrator, horzcat, Function, vertcat
                      
                      from . import integrator
                      Severity: Major
                      Found in bioptim/dynamics/ode_solver.py - About 1 day to fix

                        Function from_initial_guess has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def from_initial_guess(cls, ocp, sol: list):
                                """
                                Initialize all the attributes from a list of initial guesses (states, controls)
                        
                                Parameters
                        Severity: Minor
                        Found in bioptim/optimization/solution/solution.py - About 1 day 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

                        File optimization_variable.py has 512 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        from typing import Callable
                        
                        import numpy as np
                        from casadi import MX, SX, vertcat
                        
                        
                        Severity: Major
                        Found in bioptim/optimization/optimization_variable.py - About 1 day to fix

                          File serializable_class.py has 507 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          from typing import Any
                          
                          from casadi import Function
                          import numpy as np
                          
                          
                          Severity: Major
                          Found in bioptim/gui/serializable_class.py - About 1 day to fix

                            File objective_functions.py has 504 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            from typing import Callable, Any
                            
                            from .penalty import PenaltyFunctionAbstract, PenaltyOption
                            from .penalty_controller import PenaltyController
                            from ..misc.enums import Node, QuadratureRule, PenaltyType
                            Severity: Major
                            Found in bioptim/limits/objective_functions.py - About 1 day to fix

                              Function noisy_integrate has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  def noisy_integrate(
                                      self,
                                      integrator: SolutionIntegrator = SolutionIntegrator.OCP,
                                      to_merge: SolutionMerge | list[SolutionMerge] = None,
                                      size: int = 100,
                              Severity: Minor
                              Found in bioptim/optimization/solution/solution.py - About 1 day 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

                              IPOPT has 56 functions (exceeds 20 allowed). Consider refactoring.
                              Open

                              class IPOPT(GenericSolver):
                                  """
                                  Class for Solver Options of IPOPT
                              
                                  Attributes
                              Severity: Major
                              Found in bioptim/interfaces/ipopt_options.py - About 1 day to fix

                                Function __set_constraints has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    def __set_constraints(self, ocp):
                                        """
                                        Set the constraints from the ocp
                                
                                        Parameters
                                Severity: Minor
                                Found in bioptim/interfaces/acados_interface.py - About 7 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 _manage_fatigue_to_new_variable has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
                                Open

                                def _manage_fatigue_to_new_variable(
                                    name: str,
                                    name_elements: list,
                                    ocp,
                                    nlp,
                                Severity: Minor
                                Found in bioptim/dynamics/configure_new_variable.py - About 7 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

                                Severity
                                Category
                                Status
                                Source
                                Language