Showing 151 of 153 total issues

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

import numpy as np

from .external_force import ExternalForce
from .natural_coordinates import SegmentNaturalCoordinates, NaturalCoordinates
from .rotations import euler_axes_from_rotation_matrices
Severity: Minor
Found in bionc/bionc_numpy/generalized_force.py - About 3 hrs to fix

File natural_inertial_parameters.py has 287 lines of code (exceeds 250 allowed). Consider refactoring.
Open

from typing import Union

import numpy as np
from casadi import MX
from casadi import transpose, dot, inv
Severity: Minor
Found in bionc/bionc_casadi/natural_inertial_parameters.py - About 2 hrs to fix

Function __init__ has 20 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def __init__(
Severity: Major
Found in bionc/vizualization/animations.py - About 2 hrs to fix

Function holonomic_constraints_jacobian_derivative has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    def holonomic_constraints_jacobian_derivative(self, Qdot: NaturalVelocities) -> MX:
        """
        This function returns the Jacobian matrix the holonomic constraints, denoted Kdot.
        They are organized as follow, for each segment, the rows of the matrix are:
        [Phi_k_0, Phi_r_0, Phi_k_1, Phi_r_1, ..., Phi_k_n, Phi_r_n]
Severity: Minor
Found in bionc/bionc_casadi/biomechanical_model.py - About 2 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 holonomic_constraints_jacobian has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    def holonomic_constraints_jacobian(self, Q: NaturalCoordinates) -> MX:
        """
        This function returns the Jacobian matrix the holonomic constraints, denoted K.
        They are organized as follow, for each segmen, the rows of the matrix are:
        [Phi_k_0, Phi_r_0, Phi_k_1, Phi_r_1, ..., Phi_k_n, Phi_r_n]
Severity: Minor
Found in bionc/bionc_casadi/biomechanical_model.py - About 2 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 holonomic_constraints_jacobian has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    def holonomic_constraints_jacobian(self, Q: NaturalCoordinates) -> np.ndarray:
        """
        This function returns the Jacobian matrix the holonomic constraints, denoted K.
        They are organized as follow, for each segmen, the rows of the matrix are:
        [Phi_k_0, Phi_r_0, Phi_k_1, Phi_r_1, ..., Phi_k_n, Phi_r_n]
Severity: Minor
Found in bionc/bionc_numpy/biomechanical_model.py - About 2 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 holonomic_constraints_jacobian_derivative has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    def holonomic_constraints_jacobian_derivative(self, Qdot: NaturalVelocities) -> np.ndarray:
        """
        This function returns the Jacobian matrix the holonomic constraints, denoted Kdot.
        They are organized as follow, for each segment, the rows of the matrix are:
        [Phi_k_0, Phi_r_0, Phi_k_1, Phi_r_1, ..., Phi_k_n, Phi_r_n]
Severity: Minor
Found in bionc/bionc_numpy/biomechanical_model.py - About 2 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

GenericBiomechanicalModelSegments has 22 functions (exceeds 20 allowed). Consider refactoring.
Open

class GenericBiomechanicalModelSegments(ABC):
    """
    This is an abstract base class that provides the basic structure and methods for all biomechanical models.
    It contains the segments and the joints of the model. The implemented methods are not specific to numpy or casadi.

Severity: Minor
Found in bionc/protocols/biomechanical_model_segments.py - About 2 hrs to fix

File biomechanical_model_segments.py has 256 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import numpy as np
from abc import ABC, abstractmethod
from casadi import MX
from typing import Any

Severity: Minor
Found in bionc/protocols/biomechanical_model_segments.py - About 2 hrs to fix

Function get_Q_init_from_initial_guess_mode has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    def get_Q_init_from_initial_guess_mode(
        self,
        initial_guess_mode: InitialGuessModeType,
        Q_init: np.ndarray | NaturalCoordinates,
        experimental_markers: np.ndarray,
Severity: Minor
Found in bionc/bionc_numpy/inverse_kinematics.py - About 2 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 16 (exceeds 5 allowed). Consider refactoring.
Open

    def __init__(
        self,
        model: BiomechanicalModel,
        show_ground_frame: bool = True,
        show_frames: bool = True,
Severity: Minor
Found in bionc/vizualization/animations.py - About 2 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 model_creation_from_measured_data has 49 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def model_creation_from_measured_data(c3d_filename: str = "statref.c3d") -> BiomechanicalModel:
    """
    Create a model from a data file and we build the biomechanical model as a template using the marker names
    """

Severity: Minor
Found in examples/model_creation/two_side_lower_limbs.py - About 1 hr to fix

Function add_joint has 13 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def add_joint(
Severity: Major
Found in bionc/model_creation/biomechanical_model_template.py - About 1 hr to fix

Function __init__ has 12 arguments (exceeds 4 allowed). Consider refactoring.
Open

        def __init__(
Severity: Major
Found in bionc/bionc_casadi/joints.py - About 1 hr to fix

Function generate_c3d_file has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def generate_c3d_file():
    """
    This function generates a c3d file with full body open pose markerset
    This is made to not  overload the repository with a c3d file

Severity: Minor
Found in examples/model_creation/markerless_model.py - About 1 hr to fix

Function from_components has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def from_components(
        cls,
        udot: Union[np.ndarray, MX, list] = None,
        rpdot: Union[np.ndarray, MX, list] = None,
        rddot: Union[np.ndarray, MX, list] = None,
Severity: Minor
Found in bionc/bionc_casadi/natural_velocities.py - About 1 hr 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 from_components has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def from_components(
        cls,
        udot: Union[np.ndarray, list] = None,
        rpdot: Union[np.ndarray, list] = None,
        rddot: Union[np.ndarray, list] = None,
Severity: Minor
Found in bionc/bionc_numpy/natural_velocities.py - About 1 hr 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 from_components has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def from_components(cls, x: MX, y: MX, z: MX, t: MX):
        """
        Constructor of the class from the components of the homogenous transform

        Parameters
Severity: Minor
Found in bionc/bionc_casadi/homogenous_transform.py - About 1 hr 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 from_components has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def from_components(
        cls,
        uddot: Union[np.ndarray, MX, list] = None,
        rpddot: Union[np.ndarray, MX, list] = None,
        rdddot: Union[np.ndarray, MX, list] = None,
Severity: Minor
Found in bionc/bionc_casadi/natural_accelerations.py - About 1 hr 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 from_components has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def from_components(
        cls,
        uddot: Union[np.ndarray, list] = None,
        rpddot: Union[np.ndarray, list] = None,
        rdddot: Union[np.ndarray, list] = None,
Severity: Minor
Found in bionc/bionc_numpy/natural_accelerations.py - About 1 hr 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