lily-seabreeze/sappho

View on GitHub
sappho/particle.py

Summary

Maintainability
D
1 day
Test Coverage

File particle.py has 544 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""Particle system definitions.

There's a few basic concepts here.  Note that all functions affecting physics,
emission, launch, and display are implemented as classes with a `__call__`
magic method, but could just as easily be pure functions since no extra info
Severity: Major
Found in sappho/particle.py - About 1 day to fix

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

        def __call__(self, dt):
            """How many particles to emit in `dt` seconds.
    
            Arguments:
                dt: Elapsed time in seconds.
    Severity: Minor
    Found in sappho/particle.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 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def __init__(
    Severity: Major
    Found in sappho/particle.py - About 50 mins to fix

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

          def __init__(self, x, y, dx=0, dy=0, life=0, species=None):
      Severity: Minor
      Found in sappho/particle.py - About 45 mins to fix

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

            def __init__(self, x=0, y=0, dx=0, dy=0, life=0, jitter=None):
        Severity: Minor
        Found in sappho/particle.py - About 45 mins to fix

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

              def __init__(self, x=0, y=0, dx=0, dy=0, life=0):
          Severity: Minor
          Found in sappho/particle.py - About 35 mins to fix

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

                def __init__(self, image, origin, tints,
            Severity: Minor
            Found in sappho/particle.py - About 35 mins to fix

              Function _discard_dead_particles has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def _discard_dead_particles(self):
                      """Get rid of all no longer active particles (life <= 0)."""
                      write_index = 0
                      for read_index, particle in enumerate(self.particles):
                          if particle.life > 0:
              Severity: Minor
              Found in sappho/particle.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

              There are no issues that match your filters.

              Category
              Status