Showing 132 of 200 total issues
Function extract_data_from_pickle
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def extract_data_from_pickle(self, solution: str):
with open(solution, "rb") as f:
pickle_data = pickle.load(f)
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 _sanity_check
has 22 arguments (exceeds 4 allowed). Consider refactoring. Open
def _sanity_check(
File hmed2018_with_fatigue.py
has 281 lines of code (exceeds 250 allowed). Consider refactoring. Open
from typing import Callable
from casadi import MX, vertcat
import numpy as np
DingModelFrequency
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
class DingModelFrequency(FesModel):
"""
This is a custom model of the Bioptim package. As CustomModel, some methods are mandatory and must be implemented.
to make it work with bioptim.
File ding2007_with_fatigue.py
has 277 lines of code (exceeds 250 allowed). Consider refactoring. Open
from typing import Callable
from casadi import MX, vertcat
import numpy as np
Function prepare_ocp
has 21 arguments (exceeds 4 allowed). Consider refactoring. Open
def prepare_ocp(
File ding2003_with_fatigue.py
has 270 lines of code (exceeds 250 allowed). Consider refactoring. Open
from typing import Callable
from casadi import MX, vertcat
import numpy as np
Function extract_data_from_sol
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def extract_data_from_sol(self, solution: Solution):
data = {}
n_phase = solution.ocp.n_phases
width = 2 * np.pi / n_phase
radii = 1 / (solution.ocp.nlp[0].model.nb_muscles + 1)
- 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 stimulation_detection
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def stimulation_detection(
self,
time,
stimulation_signal,
average_time_difference: float = 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
FesModel
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
class FesModel(ABC):
@abstractmethod
def set_a_rest(self, model, a_rest: MX | float):
"""
Function _pulse_mode_settings
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def _pulse_mode_settings(self):
if self.pulse_mode == "single":
step = self.final_time / self.n_stim
self.final_time_phase = (step,)
for i in range(self.n_stim):
- 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
File ding2007.py
has 258 lines of code (exceeds 250 allowed). Consider refactoring. Open
from typing import Callable
import numpy as np
from casadi import MX, vertcat, exp
Function prepare_ocp
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
def prepare_ocp(
biorbd_model_path: str,
bound_type: str = None,
bound_data: list = None,
fes_muscle_models: list[FesModel] = None,
Function _build_parameters
has 15 arguments (exceeds 4 allowed). Consider refactoring. Open
def _build_parameters(
Function __init__
has 15 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function fit_func_by_fourier_series_with_real_coeffs
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def fit_func_by_fourier_series_with_real_coeffs(self, x, ab, mode="numpy"):
result = 0.0
a = ab[:, 0]
b = ab[:, 1]
if mode == "numpy":
- 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 prepare_ocp
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def prepare_ocp(
biorbd_model_path: str,
bound_type: str = None,
bound_data: list = None,
fes_muscle_models: list[FesModel] = 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 _build_parameters
has 14 arguments (exceeds 4 allowed). Consider refactoring. Open
def _build_parameters(
Function __init__
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def __init__(
self,
fes_parameters: dict = None,
ivp_parameters: dict = 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 _sanity_check_fes_models_inputs
has 13 arguments (exceeds 4 allowed). Consider refactoring. Open
def _sanity_check_fes_models_inputs(