ocadotechnology/rapid-router

View on GitHub
game/end_to_end_tests/base_game_test.py

Summary

Maintainability
D
3 days
Test Coverage

BaseGameTest has 30 functions (exceeds 20 allowed). Consider refactoring.
Open

class BaseGameTest(SeleniumTestCase):
    BLOCKLY_SOLUTIONS_DIR = os.path.join(
        os.path.dirname(__file__), "data/blockly_solutions"
    )

Severity: Minor
Found in game/end_to_end_tests/base_game_test.py - About 3 hrs to fix

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

        def complete_and_check_level(
            self,
            level_number,
            page,
            next_episode=None,
    Severity: Minor
    Found in game/end_to_end_tests/base_game_test.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 complete_and_check_level has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def complete_and_check_level(
    Severity: Minor
    Found in game/end_to_end_tests/base_game_test.py - About 45 mins to fix

      Function _go_to_path has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def _go_to_path(self, path):
              socket.setdefaulttimeout(20)
              attempts = 0
              while True:
                  try:
      Severity: Minor
      Found in game/end_to_end_tests/base_game_test.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

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

          def go_to_episode(self, episodeId):
              path = reverse("start_episode", kwargs={"episodeId": str(episodeId)})
              self._go_to_path(path)
              self.selenium.execute_script("ocargo.animation.FAST_ANIMATION_DURATION = 1;")
      
      
      Severity: Major
      Found in game/end_to_end_tests/base_game_test.py and 1 other location - About 2 hrs to fix
      game/end_to_end_tests/base_game_test.py on lines 87..92

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

      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

          def go_to_level(self, level_name):
              path = reverse("play_default_level", kwargs={"levelName": str(level_name)})
              self._go_to_path(path)
              self.selenium.execute_script("ocargo.animation.FAST_ANIMATION_DURATION = 1;")
      
      
      Severity: Major
      Found in game/end_to_end_tests/base_game_test.py and 1 other location - About 2 hrs to fix
      game/end_to_end_tests/base_game_test.py on lines 106..111

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

      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 7 locations. Consider refactoring.
      Open

          def run_crashing_test(self, level, workspace_file):
              user_profile = self.login_once()
      
              workspace_id = self.use_workspace(workspace_file, user_profile)
      
      
      Severity: Major
      Found in game/end_to_end_tests/base_game_test.py and 6 other locations - About 1 hr to fix
      game/end_to_end_tests/base_game_test.py on lines 118..123
      game/end_to_end_tests/base_game_test.py on lines 152..158
      game/end_to_end_tests/base_game_test.py on lines 163..169
      game/end_to_end_tests/base_game_test.py on lines 174..180
      game/end_to_end_tests/base_game_test.py on lines 185..191
      game/end_to_end_tests/base_game_test.py on lines 196..202

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

      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 7 locations. Consider refactoring.
      Open

          def undefined_procedure_test(self, level, workspace_file):
              user_profile = self.login_once()
      
              workspace_id = self.use_workspace(workspace_file, user_profile)
      
      
      Severity: Major
      Found in game/end_to_end_tests/base_game_test.py and 6 other locations - About 1 hr to fix
      game/end_to_end_tests/base_game_test.py on lines 118..123
      game/end_to_end_tests/base_game_test.py on lines 125..131
      game/end_to_end_tests/base_game_test.py on lines 152..158
      game/end_to_end_tests/base_game_test.py on lines 163..169
      game/end_to_end_tests/base_game_test.py on lines 174..180
      game/end_to_end_tests/base_game_test.py on lines 185..191

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

      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 7 locations. Consider refactoring.
      Open

          def running_a_red_light_test(self, level, workspace_file):
              user_profile = self.login_once()
      
              workspace_id = self.use_workspace(workspace_file, user_profile)
      
      
      Severity: Major
      Found in game/end_to_end_tests/base_game_test.py and 6 other locations - About 1 hr to fix
      game/end_to_end_tests/base_game_test.py on lines 118..123
      game/end_to_end_tests/base_game_test.py on lines 125..131
      game/end_to_end_tests/base_game_test.py on lines 152..158
      game/end_to_end_tests/base_game_test.py on lines 163..169
      game/end_to_end_tests/base_game_test.py on lines 185..191
      game/end_to_end_tests/base_game_test.py on lines 196..202

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

      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 7 locations. Consider refactoring.
      Open

          def running_out_of_instructions_test(self, level, workspace_file):
              user_profile = self.login_once()
      
              workspace_id = self.use_workspace(workspace_file, user_profile)
      
      
      Severity: Major
      Found in game/end_to_end_tests/base_game_test.py and 6 other locations - About 1 hr to fix
      game/end_to_end_tests/base_game_test.py on lines 118..123
      game/end_to_end_tests/base_game_test.py on lines 125..131
      game/end_to_end_tests/base_game_test.py on lines 163..169
      game/end_to_end_tests/base_game_test.py on lines 174..180
      game/end_to_end_tests/base_game_test.py on lines 185..191
      game/end_to_end_tests/base_game_test.py on lines 196..202

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

      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 7 locations. Consider refactoring.
      Open

          def try_again_if_not_full_score_test(self, level, workspace_file):
              user_profile = self.login_once()
      
              workspace_id = self.use_workspace(workspace_file, user_profile)
      
      
      Severity: Major
      Found in game/end_to_end_tests/base_game_test.py and 6 other locations - About 1 hr to fix
      game/end_to_end_tests/base_game_test.py on lines 125..131
      game/end_to_end_tests/base_game_test.py on lines 152..158
      game/end_to_end_tests/base_game_test.py on lines 163..169
      game/end_to_end_tests/base_game_test.py on lines 174..180
      game/end_to_end_tests/base_game_test.py on lines 185..191
      game/end_to_end_tests/base_game_test.py on lines 196..202

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

      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 7 locations. Consider refactoring.
      Open

          def running_out_of_fuel_test(self, level, workspace_file):
              user_profile = self.login_once()
      
              workspace_id = self.use_workspace(workspace_file, user_profile)
      
      
      Severity: Major
      Found in game/end_to_end_tests/base_game_test.py and 6 other locations - About 1 hr to fix
      game/end_to_end_tests/base_game_test.py on lines 118..123
      game/end_to_end_tests/base_game_test.py on lines 125..131
      game/end_to_end_tests/base_game_test.py on lines 152..158
      game/end_to_end_tests/base_game_test.py on lines 174..180
      game/end_to_end_tests/base_game_test.py on lines 185..191
      game/end_to_end_tests/base_game_test.py on lines 196..202

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

      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 7 locations. Consider refactoring.
      Open

          def not_delivered_everywhere_test(self, level, workspace_file):
              user_profile = self.login_once()
      
              workspace_id = self.use_workspace(workspace_file, user_profile)
      
      
      Severity: Major
      Found in game/end_to_end_tests/base_game_test.py and 6 other locations - About 1 hr to fix
      game/end_to_end_tests/base_game_test.py on lines 118..123
      game/end_to_end_tests/base_game_test.py on lines 125..131
      game/end_to_end_tests/base_game_test.py on lines 152..158
      game/end_to_end_tests/base_game_test.py on lines 163..169
      game/end_to_end_tests/base_game_test.py on lines 174..180
      game/end_to_end_tests/base_game_test.py on lines 196..202

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

      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

          def go_to_homepage(self):
              path = reverse("home")
              self._go_to_path(path)
              return HomePage(self.selenium)
      Severity: Minor
      Found in game/end_to_end_tests/base_game_test.py and 1 other location - About 35 mins to fix
      game/end_to_end_tests/base_game_test.py on lines 101..104

      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

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

          def go_to_level_editor(self):
              path = reverse("level_editor")
              self._go_to_path(path)
              return EditorPage(self.selenium)
      Severity: Minor
      Found in game/end_to_end_tests/base_game_test.py and 1 other location - About 35 mins to fix
      game/end_to_end_tests/base_game_test.py on lines 82..85

      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

      There are no issues that match your filters.

      Category
      Status