hypatia-software-organization/hypatia-engine

View on GitHub

Showing 25 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

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

          class TMXVersionUnsupported(TMXException):
              """Attempted to create a TileMap from a TMX map, but
              the TMX map version is unsupported.
          
              Attribs:
          Severity: Major
          Found in hypatia/game.py and 1 other location - About 1 hr to fix
          hypatia/game.py on lines 116..135

          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 49.

          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 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

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

          class TMXLayersNotCSV(TMXException):
              """The data encoding used for layers during Tilemap.from_tmx()
              is not supported. Only CSV is supported.
          
              Attribs:
          Severity: Major
          Found in hypatia/game.py and 1 other location - About 1 hr to fix
          hypatia/game.py on lines 92..113

          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 49.

          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

                      try:
                          self.animations[action][direction] = animation
                      except KeyError:
                          self.animations[action] = {direction: animation}
          Severity: Major
          Found in hypatia/sprites.py and 1 other location - About 1 hr to fix
          hypatia/sprites.py on lines 194..201

          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 43.

          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 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

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

                          for direction in constants.Direction.cardinals_and_ordinals():
          
                              # We set everything to the Stand South animation since
                              # it was set first.
                              try:
          Severity: Major
          Found in hypatia/sprites.py and 1 other location - About 1 hr to fix
          hypatia/sprites.py on lines 175..178

          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 43.

          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 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

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

                  elif type(coordinates[0]) == int and type(coordinates[1]) == int:
          Severity: Major
          Found in hypatia/animatedsprite.py and 1 other location - About 1 hr to fix
          hypatia/animatedsprite.py on lines 103..103

          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 38.

          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

                  elif type(coordinates[0]) == int and type(coordinates[1]) == int:
          Severity: Major
          Found in hypatia/animatedsprite.py and 1 other location - About 1 hr to fix
          hypatia/animatedsprite.py on lines 165..165

          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 38.

          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

                  if potential_rect.bottom > master_rect.bottom:
                      difference_y = (difference_y -
                                      (potential_rect.bottom - master_rect.bottom))
          Severity: Minor
          Found in hypatia/render.py and 1 other location - About 45 mins to fix
          hypatia/render.py on lines 134..136

          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 35.

          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 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

          Severity
          Category
          Status
          Source
          Language