Kev1CO/cocofest

View on GitHub

Showing 200 of 200 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

ocp = OcpFesMsk.prepare_ocp(
    biorbd_model_path="../msk_models/arm26.bioMod",
    bound_type="start_end",
    bound_data=[[65, 38], [65, 38]],
    fes_muscle_models=[
cocofest/examples/dynamics/intensity_optimization_hold_position_multi_muscle.py on lines 49..59

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 46.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

    def _sanity_check_fes_models_inputs(
Severity: Major
Found in cocofest/optimization/fes_ocp_dynamics.py - About 1 hr to fix

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

        def prepare_ocp(
    Severity: Major
    Found in cocofest/optimization/fes_identification_ocp.py - About 1 hr to fix

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      im1 = axs.scatter(
          np.array(parameter_list[0])[:, 0],
          np.array(parameter_list[0])[:, 1],
      cocofest/examples/sensitivity/truncation/summation_truncation_graph.py on lines 145..147

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 45.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      im2 = axs.scatter(
          np.array(all_model_list_ground_truth_parameter[0])[:, 0],
          np.array(all_model_list_ground_truth_parameter[0])[:, 1],
      cocofest/examples/sensitivity/truncation/summation_truncation_graph.py on lines 135..137

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 45.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

                          result += a[n] * cos(2.0 * np.pi * n * x / self.p) + b[n] * sin(2.0 * np.pi * n * x / self.p)
      Severity: Major
      Found in cocofest/fourier_approx.py and 1 other location - About 1 hr to fix
      cocofest/fourier_approx.py on lines 35..35

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 45.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

          def __init__(
      Severity: Major
      Found in cocofest/identification/hmed2018_force_parameter_identification.py - About 1 hr to fix

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

            def __init__(
        Severity: Major
        Found in cocofest/identification/ding2003_force_parameter_identification.py - About 1 hr to fix

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

              def __init__(
          Severity: Major
          Found in cocofest/identification/ding2007_force_parameter_identification.py - About 1 hr to fix

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

                def plot(self, starting_location: str = None, show_rehastim=False):
                    """
                    Plot the muscle stimulation angle of a cycling motion
                    Parameters
                    ----------
            Severity: Minor
            Found in cocofest/result/plot.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 __init__ has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def __init__(
                    self,
                    fes_parameters: dict = None,
                    ivp_parameters: dict = None,
                ):
            Severity: Minor
            Found in cocofest/integration/ivp_fes.py - About 1 hr to fix

              Function muscles_joint_torque has 11 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def muscles_joint_torque(
              Severity: Major
              Found in cocofest/models/dynamical_model.py - About 1 hr to fix

                Function _set_objective has 11 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def _set_objective(
                Severity: Major
                Found in cocofest/optimization/fes_ocp_dynamics.py - About 1 hr to fix

                  Identical blocks of code found in 2 locations. Consider refactoring.
                  Open

                  constraint.add(
                      ConstraintFcn.SUPERIMPOSE_MARKERS,
                      first_marker="COM_hand",
                      second_marker="reaching_target",
                      phase=n_stim - 1,
                  cocofest/examples/dynamics/reaching_task/reaching_task_frequency_optimization.py on lines 69..75

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 42.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Identical blocks of code found in 2 locations. Consider refactoring.
                  Open

                  constraint.add(
                      ConstraintFcn.SUPERIMPOSE_MARKERS,
                      first_marker="COM_hand",
                      second_marker="reaching_target",
                      phase=n_stim - 1,
                  cocofest/examples/dynamics/reaching_task/reaching_task_intensity_optimization.py on lines 72..78

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 42.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Function prepare_nmpc has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def prepare_nmpc(self):
                          (pulse_event, pulse_duration, pulse_intensity, objective) = OcpFes._fill_dict(
                              self.pulse_event, self.pulse_duration, self.pulse_intensity, self.objective
                          )
                  
                  
                  Severity: Minor
                  Found in cocofest/optimization/fes_ocp_nmpc_cyclic.py - About 1 hr to fix

                    Function prepare_ocp has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        def prepare_ocp(
                            model: FesModel = None,
                            n_stim: int = None,
                            n_shooting: int = None,
                            final_time: int | float = None,
                    Severity: Minor
                    Found in cocofest/optimization/fes_ocp.py - About 1 hr to fix

                      Function dynamics has 10 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          def dynamics(
                      Severity: Major
                      Found in cocofest/models/ding2007_with_fatigue.py - About 1 hr to fix

                        Function system_dynamics has 10 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            def system_dynamics(
                        Severity: Major
                        Found in cocofest/models/hmed2018_with_fatigue.py - About 1 hr to fix

                          Function dynamics has 10 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                              def dynamics(
                          Severity: Major
                          Found in cocofest/models/ding2003.py - About 1 hr to fix
                            Severity
                            Category
                            Status
                            Source
                            Language