acutesoftware/virtual-AI-simulator

View on GitHub

Showing 91 of 91 total issues

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

            x_len = 1 * (math.floor(self.grd.get_grid_width() / 200) + 1)
Severity: Major
Found in vais/worlds.py and 3 other locations - About 45 mins to fix
vais/worlds.py on lines 234..234
vais/worlds.py on lines 237..237
vais/worlds.py on lines 238..238

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

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

            print (self.c1.name + ' ' + result + ' for ' + str(dmg))
Severity: Minor
Found in vais/z_prototypes/game_rpg_simulation1.py and 1 other location - About 45 mins to fix
vais/z_prototypes/game_rpg_simulation1.py on lines 86..86

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

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

            y_len = 1 * (math.floor(self.grd.get_grid_height() / 200) + 1)
Severity: Major
Found in vais/worlds.py and 3 other locations - About 45 mins to fix
vais/worlds.py on lines 234..234
vais/worlds.py on lines 235..235
vais/worlds.py on lines 238..238

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 method2 has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

def method2():
    for start_seed in range(1, 9999999):
        random.seed(start_seed)
        if start_seed % 1000 == 0:
            logger.debug('seed = ' + str(start_seed))
Severity: Minor
Found in vais/z_prototypes/random_string_finder.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 build_world has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

def build_world(height, width, num_seeds, perc_land, perc_sea, perc_blocked):    
Severity: Minor
Found in vais/world_generator.py - About 45 mins to fix

    Function method1 has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    def method1():
        for start_seed in range(1, 9999):
            random.seed(start_seed)
            if start_seed % 100 == 0:
                logger.debug('seed = ' + str(start_seed))
    Severity: Minor
    Found in vais/z_prototypes/random_string_finder.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

    Avoid deeply nested control flow statements.
    Open

                            if self.grd.get_tile(y,x) != val:
                                self.grd.set_tile(y, x, TERRAIN_LAND)
                                num_iterations -= 1
                new_x = cur_pos[0] + randint(0,3)-2
    Severity: Major
    Found in vais/worlds.py - About 45 mins to fix

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

                  y_len = 10 * (math.floor(self.grd.get_grid_height() / 120) + 1)
      Severity: Major
      Found in vais/worlds.py and 3 other locations - About 45 mins to fix
      vais/worlds.py on lines 235..235
      vais/worlds.py on lines 237..237
      vais/worlds.py on lines 238..238

      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

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

                  x_len = 10 * (math.floor(self.grd.get_grid_width() / 120) + 1)
      Severity: Major
      Found in vais/worlds.py and 3 other locations - About 45 mins to fix
      vais/worlds.py on lines 234..234
      vais/worlds.py on lines 235..235
      vais/worlds.py on lines 237..237

      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

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

                  print (self.c2.name + ' ' + result + ' for ' + str(dmg))
      Severity: Minor
      Found in vais/z_prototypes/game_rpg_simulation1.py and 1 other location - About 45 mins to fix
      vais/z_prototypes/game_rpg_simulation1.py on lines 79..79

      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 refresh_stats has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def refresh_stats(self):
              """
              only need this when generating terrain (sea = 100 - perc_land at start).
              This function forces a recount, otherwise just call the variables
              """
      Severity: Minor
      Found in vais/worlds.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

      Avoid deeply nested control flow statements.
      Open

                              for x in range(-expand, expand):
                                  new_x = col+x
                                  new_y = row+y
                                  if new_x < 0: new_x = 0
                                  if new_y < 0: new_y = 0
      Severity: Major
      Found in vais/worlds.py - About 45 mins to fix

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

                garbage = ''.join([chr(random.randint(32,122)) for x in range(100000)])
        Severity: Minor
        Found in vais/z_prototypes/random_string_finder.py and 1 other location - About 40 mins to fix
        vais/z_prototypes/random_string_finder.py on lines 44..44

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

        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

                garbage = ''.join([chr(random.randint(32,122)) for x in range(10)])
        Severity: Minor
        Found in vais/z_prototypes/random_string_finder.py and 1 other location - About 40 mins to fix
        vais/z_prototypes/random_string_finder.py on lines 30..30

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

        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 show_message has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def show_message(self, c_attack, c_defend, result, dmg, print_console='Yes'):
        Severity: Minor
        Found in vais/battle.py - About 35 mins to fix

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

              def __init__(self, name, src, dest, val, condition = None):
          Severity: Minor
          Found in vais/envirosim.py - About 35 mins to fix

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

                def __init__(self, char1, char2, traits, rules, print_console='Yes'):
            Severity: Minor
            Found in vais/battle.py - About 35 mins to fix

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

                  def add_affect(self, name, src, dest, val, condition = None ):
              Severity: Minor
              Found in vais/envirosim.py - About 35 mins to fix

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

                    def __init__(self, c1, c2, traits, rules, num_fights = 1000):
                Severity: Minor
                Found in vais/battle.py - About 35 mins to fix

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

                          p = planet.Planet('vais_test_planet', num_seeds=5, width=20, height=15, wind=0.2, rain=0.20, sun=0.2, lava=0.5)
                  Severity: Minor
                  Found in vais/z_prototypes/test_vais.py and 2 other locations - About 35 mins to fix
                  scripts/quick_start.py on lines 18..18
                  vais/z_prototypes/test_vais.py on lines 37..37

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

                  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

                  Severity
                  Category
                  Status
                  Source
                  Language