lily-seabreeze/sappho

View on GitHub

Showing 19 of 27 total issues

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

    File tiles.py has 260 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # TODO: module level docstring
    """Tile engine; tile map, tilesheet system.
    
    Has impassability support.
    
    
    Severity: Minor
    Found in sappho/tiles.py - About 2 hrs to fix

      File animate.py has 253 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      """Painless animated sprites which are pygame.sprite.Sprite objects.
      
      Animated sprites from GIF, and all YOU have to know is to `update_state`!
      You just have to call `update_state` once per loop with the timedelta:
      
      
      Severity: Minor
      Found in sappho/animate.py - About 2 hrs to fix

        Function move_as_close_as_possible has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

        def move_as_close_as_possible(sprite, destination, sprite_group):
            """Return how close sprite can go to destination without collision,
            along with the first sprite blocking its progress (if any).
        
            "Position" herein will always refer to a position
        Severity: Minor
        Found in sappho/collide.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 __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 update has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def update(self, camera, wall_collision_group, layer_size, timedelta):
                  self.sprite.update(timedelta)
          
                  if self.x_speed == 0 and self.y_speed == 0:
                      return None
          Severity: Minor
          Found in demo/demo.py - About 45 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 __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, duration, color, center, x_speed, y_speed, size):
            Severity: Minor
            Found in demo/demo.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 update has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def update(self, wall_list, layer_size, asteroid_list, player_bullet_list, timedelta):
                Severity: Minor
                Found in demo/demo.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 __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 add_if_below_threshold has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def add_if_below_threshold(cls, player, asteroid_list, at_least_x_existing):
                      
                              if len(asteroid_list) < at_least_x_existing:
                                  plus_or_minus_x = random.choice([1, -1])
                                  new_asteroid_x = player.sprite.rect.top - (cls.SPAWN_DISTANCE_FROM_PLAYER * plus_or_minus_x)
                      Severity: Minor
                      Found in demo/demo.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 parse_rules has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def parse_rules(path_to_rules_file):
                              """Get properties for tile IDs from the
                              path_to_rules_file.
                      
                              A rule file looks something like this:
                      Severity: Minor
                      Found in sappho/tiles.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 update has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def update(self, wall_list, asteroid_list, player_bullet_list, timedelta):
                              self.current_duration += timedelta
                      
                              if self.current_duration >= self.total_duration:
                                  player_bullet_list.remove(self)
                      Severity: Minor
                      Found in demo/demo.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 _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

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

                          def set_solid_tiles_topleft(self, tiles):
                              """The rectangles from tiles do not contain positional
                              data (all of their toplefts are [0, 0]). This method
                              sets the appropriate topleft per rectangle, considering
                              the position of the tile in the tilemap.
                      Severity: Minor
                      Found in sappho/tiles.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_csv_string_and_tilesheet has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def from_csv_string_and_tilesheet(cls, csv_string, tilesheet, firstgid=0):
                              """Create a tilemap using a CSV of tile IDs and
                              a tilesheet.
                      
                              Arguments:
                      Severity: Minor
                      Found in sappho/tiles.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