Kev1CO/cocofest

View on GitHub

Showing 132 of 200 total issues

Function get_initial_guess has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

def get_initial_guess(biorbd_model_path: str, final_time: int, n_stim: int, n_shooting: int, objective: dict) -> dict:
Severity: Minor
Found in cocofest/dynamics/warm_start.py - About 35 mins to fix

    Function remove_duplicates has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def remove_duplicates(self, time):
            states = self.sol.decision_states(to_merge=[SolutionMerge.PHASES, SolutionMerge.NODES])
            vals, idx_start, count = np.unique(time, return_counts=True, return_index=True)
            time = time[idx_start]
            state_keys = states.keys()
    Severity: Minor
    Found in cocofest/result/pickle.py - About 35 mins 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 dynamics has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def dynamics(
            time: MX,
            states: MX,
            controls: MX,
            parameters: MX,
    Severity: Minor
    Found in cocofest/models/ding2007.py - About 35 mins 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 get_intensity_parameters has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_intensity_parameters(nlp, parameters: ParameterList, muscle_name: str = None) -> MX:
            """
            Get the nlp list of intensity parameters
    
            Parameters
    Severity: Minor
    Found in cocofest/models/hmed2018.py - About 35 mins 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 dynamics has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def dynamics(
            time: MX,
            states: MX,
            controls: MX,
            parameters: MX,
    Severity: Minor
    Found in cocofest/models/ding2007_with_fatigue.py - About 35 mins 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 get_pulse_duration_parameters has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_pulse_duration_parameters(nlp, parameters: ParameterList, muscle_name: str = None) -> MX:
            """
            Get the nlp list of pulse_duration parameters
    
            Parameters
    Severity: Minor
    Found in cocofest/models/ding2007.py - About 35 mins 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 cn_sum_fun has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def cn_sum_fun(self, r0: MX | float, t: MX, t_stim_prev: list[MX]) -> MX | float:
            """
            Parameters
            ----------
            r0: MX | float
    Severity: Minor
    Found in cocofest/models/ding2003.py - About 25 mins 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 cn_sum_fun has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def cn_sum_fun(
            self, r0: MX | float, t: MX, t_stim_prev: list[MX] = None, intensity_stim: list[MX] = None
        ) -> MX | float:
            """
            Parameters
    Severity: Minor
    Found in cocofest/models/hmed2018.py - About 25 mins 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 configure_all_muscle_states has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def configure_all_muscle_states(self, muscles_dynamics_model, ocp, nlp):
            state_name_list = []
            for muscle_dynamics_model in muscles_dynamics_model:
                for state_key in muscle_dynamics_model.name_dof:
                    if state_key in self.state_dictionary.keys():
    Severity: Minor
    Found in cocofest/models/state_configue.py - About 25 mins 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 node_shooting_list_creation has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    def node_shooting_list_creation(stim, stimulated_n_shooting):
        """
        Creates a list of node shooting points.
    
        Parameters
    Severity: Minor
    Found in cocofest/identification/identification_method.py - About 25 mins 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 build_initial_guess_from_ocp has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def build_initial_guess_from_ocp(self, ocp):
            """
            Build a state, control, parameters and stochastic initial guesses for each phases from a given ocp
            """
            x = InitialGuessList()
    Severity: Minor
    Found in cocofest/integration/ivp_fes.py - About 25 mins 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_frequency_and_final_time has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def from_frequency_and_final_time(
            cls,
            fes_parameters: dict = None,
            ivp_parameters: dict = None,
        ):
    Severity: Minor
    Found in cocofest/integration/ivp_fes.py - About 25 mins 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