Kev1CO/cocofest

View on GitHub

Showing 132 of 200 total issues

Function __init__ has a Cognitive Complexity of 189 (exceeds 5 allowed). Consider refactoring.
Open

    def __init__(
        self,
        c3d_path: str | list[str] = None,
        calibration_matrix_path: str = None,
        for_identification: bool = False,
Severity: Minor
Found in data_process/force_from_c3d.py - About 3 days 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 _sanity_check_fes_models_inputs has a Cognitive Complexity of 104 (exceeds 5 allowed). Consider refactoring.
Open

    def _sanity_check_fes_models_inputs(
        biorbd_model_path,
        bound_type,
        bound_data,
        fes_muscle_models,
Severity: Minor
Found in cocofest/optimization/fes_ocp_dynamics.py - About 2 days 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 fes_ocp_dynamics.py has 830 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import numpy as np

from bioptim import (
    Axis,
    BoundsList,
Severity: Major
Found in cocofest/optimization/fes_ocp_dynamics.py - About 1 day to fix

    Function _set_bounds has a Cognitive Complexity of 84 (exceeds 5 allowed). Consider refactoring.
    Open

        def _set_bounds(bio_models, fes_muscle_models, bound_type, bound_data, n_stim, initial_state):
            # ---- STATE BOUNDS REPRESENTATION ---- #
            #
            #                    |‾‾‾‾‾‾‾‾‾‾x_max_middle‾‾‾‾‾‾‾‾‾‾‾‾x_max_end‾
            #                    |          max_bounds              max_bounds
    Severity: Minor
    Found in cocofest/optimization/fes_ocp_dynamics.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 fes_ocp.py has 702 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import numpy as np
    
    from bioptim import (
        BoundsList,
        ConstraintList,
    Severity: Major
    Found in cocofest/optimization/fes_ocp.py - About 1 day to fix

      Function _build_parameters has a Cognitive Complexity of 73 (exceeds 5 allowed). Consider refactoring.
      Open

          def _build_parameters(
              model,
              n_stim,
              time_min,
              time_max,
      Severity: Minor
      Found in cocofest/optimization/fes_ocp_dynamics.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

      Function _set_objective has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
      Open

          def _set_objective(
              n_stim,
              n_shooting,
              force_fourier_coef,
              end_node_tracking,
      Severity: Minor
      Found in cocofest/optimization/fes_ocp_dynamics.py - About 6 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

      File ivp_fes.py has 401 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import numpy as np
      from bioptim import (
          ControlType,
          DynamicsList,
          InitialGuessList,
      Severity: Minor
      Found in cocofest/integration/ivp_fes.py - About 5 hrs to fix

        File ding2003_force_parameter_identification.py has 372 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import time as time_package
        
        from bioptim import Solver, Objective, OdeSolver
        
        from ..models.fes_model import FesModel
        Severity: Minor
        Found in cocofest/identification/ding2003_force_parameter_identification.py - About 4 hrs to fix

          File ding2003.py has 372 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          from typing import Callable
          
          import numpy as np
          from casadi import MX, exp, vertcat
          
          
          Severity: Minor
          Found in cocofest/models/ding2003.py - About 4 hrs to fix

            Function dictionaries_check has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
            Open

                def dictionaries_check(self):
                    if not isinstance(self.fes_parameters, dict):
                        raise ValueError("fes_parameters must be a dictionary")
            
                    if not isinstance(self.ivp_parameters, dict):
            Severity: Minor
            Found in cocofest/integration/ivp_fes.py - About 4 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 __init__ has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
            Open

                def __init__(
                    self,
                    pickle_path: str | list[str] = None,
                    muscle_name: str | list[str] = None,
                    forearm_angle: int | float | list[int] | list[float] = None,
            Severity: Minor
            Found in data_process/force_from_sensor.py - About 4 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 _set_objective has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
            Open

                def _set_objective(
                    n_stim,
                    n_shooting,
                    force_fourier_coefficient,
                    end_node_tracking,
            Severity: Minor
            Found in cocofest/optimization/fes_ocp_nmpc_cyclic.py - About 4 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

            File fes_identification_ocp.py has 344 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import numpy as np
            
            from bioptim import (
                BoundsList,
                ConstraintList,
            Severity: Minor
            Found in cocofest/optimization/fes_identification_ocp.py - About 4 hrs to fix

              File force_from_c3d.py has 326 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import numpy as np
              import matplotlib.pyplot as plt
              from scipy.signal import find_peaks
              from copy import deepcopy
              import heapq
              Severity: Minor
              Found in data_process/force_from_c3d.py - About 3 hrs to fix

                File hmed2018.py has 322 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                from typing import Callable
                
                from casadi import MX, vertcat, tanh
                import numpy as np
                
                
                Severity: Minor
                Found in cocofest/models/hmed2018.py - About 3 hrs to fix

                  File fes_ocp_nmpc_cyclic.py has 318 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import math
                  
                  import numpy as np
                  from bioptim import (
                      SolutionMerge,
                  Severity: Minor
                  Found in cocofest/optimization/fes_ocp_nmpc_cyclic.py - About 3 hrs to fix

                    File hmed2018_force_parameter_identification.py has 310 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import time as time_package
                    import numpy as np
                    
                    from bioptim import Solver, Objective, OdeSolver
                    from ..models.hmed2018 import DingModelIntensityFrequency
                    Severity: Minor
                    Found in cocofest/identification/hmed2018_force_parameter_identification.py - About 3 hrs to fix

                      Function average_data_extraction has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                      Open

                      def average_data_extraction(model_data_path):
                          """
                          Extracts average data from the provided path.
                      
                          Parameters
                      Severity: Minor
                      Found in cocofest/identification/identification_method.py - About 3 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

                      File ding2007_force_parameter_identification.py has 297 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import time as time_package
                      import numpy as np
                      
                      from bioptim import Solver, Objective, OdeSolver
                      from ..models.ding2007 import DingModelPulseDurationFrequency
                      Severity: Minor
                      Found in cocofest/identification/ding2007_force_parameter_identification.py - About 3 hrs to fix
                        Severity
                        Category
                        Status
                        Source
                        Language