hypatia-software-organization/hypatia-engine

View on GitHub

Showing 17 of 25 total issues

File animatedsprite.py has 536 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""Quite specifically my pyganim replacement.

More advanced animation/sprite abstractions are in
the animations module.

Severity: Major
Found in hypatia/animatedsprite.py - About 1 day to fix

    File game.py has 374 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # This module is part of Hypatia and is released under the
    # MIT License: http://opensource.org/licenses/MIT
    
    """Why stuff is drawn; logic flow for the game.
    
    Severity: Minor
    Found in hypatia/game.py - About 5 hrs to fix

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

      # This module is part of Hypatia and is released under the
      # MIT License: http://opensource.org/licenses/MIT
      
      """Where stuff is being drawn; tile engine for maps.
      
      Severity: Minor
      Found in hypatia/tiles.py - About 4 hrs to fix

        Function __init__ has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
        Open

            def __init__(self, tilesheet_name, tile_ids):
                """Stitch tiles from swatch to layer surfaces.
        
                Piece together layers/surfaces from corresponding tile graphic
                names, using the specified tile swatch. Keep track of
        Severity: Minor
        Found in hypatia/tiles.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

        File sprites.py has 279 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        # This module is part of Hypatia and is released under the
        # MIT license: http://opensource.org/licenses/MIT
        
        """Sprites!
        
        Severity: Minor
        Found in hypatia/sprites.py - About 2 hrs to fix

          Function __init__ has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
          Open

              def __init__(self, directory, position=None, children=None):
                  """
          
                  Args:
                      directory (str): directory containing (animated)
          Severity: Minor
          Found in hypatia/sprites.py - About 2 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 handle_input has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

              def handle_input(self):
                  """For the "overworld," a generic scene where
                  the player moves about the scene.
          
                  This is in its infancy.
          Severity: Minor
          Found in hypatia/controllers.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 a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

              def __init__(self, resource_category, resource_name):
                  """Load a resource ZIP using a category and zip name.
          
                  Args:
                      resource_category (str): E.g., tilesheets, walkabouts.
          Severity: Minor
          Found in hypatia/resources.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 move has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

              def move(self, game, direction):
                  """Modify human player's positional data legally (check
                  for collisions).
                  Note:
                    Will round down to nearest probable step
          Severity: Minor
          Found in hypatia/player.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 a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

              def __init__(self, path_or_readable):
                  """Read XML from path_or_readable, validate the TMX as being
                  supported by Hypatia, and set all supported information as
                  attributes.
          
          Severity: Minor
          Found in hypatia/game.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 talk has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              def talk(self, npcs, dialogbox):
                  """Trigger another actor's :meth:`actor.Actor.say()` if
                  they are immediately *in front* of this actor.
          
                  See Also:
          Severity: Minor
          Found in hypatia/actor.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 from_resources has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              def from_resources(cls, tilesheet_name):
                  """Create a Tilesheet from a name, corresponding to a path
                  pointing to a tilesheet zip archive.
          
                  Args:
          Severity: Minor
          Found in hypatia/tiles.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 from_velocity has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def from_velocity(cls, velocity):
                  """Return a direction which corresponds
                  to the current 2D velocity.
          
                  See Also:
          Severity: Minor
          Found in hypatia/constants.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 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def __init__(self, name, surface, tiles, tile_size, animated_tiles=None):
          Severity: Minor
          Found in hypatia/tiles.py - About 35 mins to fix

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

                def from_resource(self, scene_name):
                    """The native format, and hopefully most reliable,
                    stable, and generally best way of saving, loading,
                    or creating Hypatia scenes.
            
            Severity: Minor
            Found in hypatia/game.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 palette_cycle has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            def palette_cycle(surface):
                """get_palette is not sufficient; it generates superflous colors.
            
                Note:
                  Need to see if I can convert 32bit alpha to 8 bit temporarily,
            Severity: Minor
            Found in hypatia/sprites.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 runtime_setup has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def runtime_setup(self):
                    """Perform actions to setup the walkabout. Actions performed
                    once pygame is running and walkabout has been initialized.
            
                    Convert and play all the animations, run init for children.
            Severity: Minor
            Found in hypatia/sprites.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