bionc/bionc_numpy/biomechanical_model.py

Summary

Maintainability
D
2 days
Test Coverage

File biomechanical_model.py has 551 lines of code (exceeds 250 allowed). Consider refactoring.
Open

from typing import Any

import numpy as np
from numpy import transpose

Severity: Major
Found in bionc/bionc_numpy/biomechanical_model.py - About 1 day to fix

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

Function _inverse_dynamics_recursive_step has 9 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def _inverse_dynamics_recursive_step(
Severity: Major
Found in bionc/bionc_numpy/biomechanical_model.py - About 1 hr to fix

Function holonomic_constraints has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def holonomic_constraints(self, Q: NaturalCoordinates) -> np.ndarray:
        """
        This function returns the holonomic constraints of the system, denoted Phi_h
        as a function of the natural coordinates Q. They are organized as follow, for each segment:
            [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 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 forward_dynamics has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def forward_dynamics(
Severity: Minor
Found in bionc/bionc_numpy/biomechanical_model.py - About 35 mins to fix

There are no issues that match your filters.

Category
Status