phydev/trajpy

View on GitHub

Showing 5 of 369 total issues

File trajpy.py has 414 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import numpy as np
from scipy.stats import linregress
import trajpy.auxiliar_functions as aux
from typing import Union, List, Dict, Tuple
import warnings
Severity: Minor
Found in trajpy/trajpy.py - About 5 hrs to fix

    Function compute_selected has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
    Open

        def compute_selected(self) -> None:
            '''
                compute the selected features
            '''
            
    Severity: Minor
    Found in trajpy/gui.py - About 3 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 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def __init__(self, trajectory: np.ndarray=np.zeros((1, 2)), box_length: int = None, **params) -> None:
            """
            Initialization function that can be left blank for using staticmethods.
            It can be initialized with an array with shape (N, dim)
            where dim is the number of spatial dimensions plus the time component.
    Severity: Minor
    Found in trajpy/trajpy.py - About 1 hr to fix

      Function normal_diffusion has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      def normal_diffusion(n_steps: int, n_samples: int, dx: float, y0: float, D: float, dt: float) -> Tuple[np.ndarray, np.ndarray]:
          """
          Generates an ensemble of normal diffusion trajectories.
      
          :param n_steps: total steps
      Severity: Minor
      Found in trajpy/traj_generator.py - About 55 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 confined_diffusion has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      def confined_diffusion(radius: float, n_steps: int, n_samples: int, dx: float, y0: float, D: float, dt: float) -> Tuple[np.ndarray, np.ndarray]:
          """
          Generates trajectories under confinement.
      
          :param radius: confinement radius
      Severity: Minor
      Found in trajpy/traj_generator.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