ocadotechnology/rapid-router

View on GitHub

Showing 697 of 1,371 total issues

Avoid too many return statements within this function.
Open

            return recipient_profile.student.class_field.teacher.school == sharer_profile.teacher.school
Severity: Major
Found in game/permissions.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

                return recipient_profile.teacher.school == sharer_profile.teacher.school
    Severity: Major
    Found in game/permissions.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                  return False
      Severity: Major
      Found in game/permissions.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                return scoreboard_view(
        Severity: Major
        Found in game/views/scoreboard.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                  return level.default and not level.episode.in_development
          Severity: Major
          Found in game/permissions.py - About 30 mins to fix

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

            ocargo.Saving.prototype.deleteWorkspace = function (id, callback) {
                csrftoken = Cookies.get('csrftoken');
                if (USER_STATUS === 'TEACHER' || USER_STATUS === 'SCHOOL_STUDENT' || USER_STATUS === 'INDEPENDENT_STUDENT') {
                    $.ajax({
                        url: Urls.delete_workspace(id),
            Severity: Minor
            Found in game/static/game/js/saving.js - 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 PathFinder has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            ocargo.PathFinder = function(model) {
                this.van = model.van;
                this.nodes = model.map.nodes;
                this.destinations = model.map.destinations;
            
            
            Severity: Minor
            Found in game/static/game/js/pathFinder.js - 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 initCustomBlocksDescription has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            function initCustomBlocksDescription() {
              Blockly.Blocks["start"] = {
                // Beginning block - identifies the start of the program
                init: function () {
                  ocargo.blocklyControl.numStartBlocks++;
            Severity: Minor
            Found in game/static/game/js/blocklyCustomBlocks.js - 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 moveVan has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            ocargo.Model.prototype.moveVan = function(nextNode, action) {
                // Crash?
                let currentNodeHasCow = this.getCowForNode(this.van.getPosition().currentNode, [ocargo.Cow.ACTIVE, ocargo.Cow.READY]);
            
                if (currentNodeHasCow) {
            Severity: Minor
            Found in game/static/game/js/model.js - 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 mobileGetCondition has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            ocargo.BlocklyCompiler.prototype.mobileGetCondition = function (
              conditionBlock
            ) {
              if (conditionBlock.type === "road_exists") {
                var selection = conditionBlock.inputList[0].fieldRow[1].value_;
            Severity: Minor
            Found in game/static/game/js/blocklyCompiler.js - 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 _setupStepTab has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            ocargo.Game.prototype._setupStepTab = function () {
              this.tabs.step.setOnChange(
                function () {
                  if (this.tabs.play.isInState('readyToPlay')) {
                    this._resetAndPrepareAnimation()
            Severity: Minor
            Found in game/static/game/js/game.js - 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 get_decor_element has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            def get_decor_element(name, theme):
                """Helper method to get a decor element corresponding to the theme or a default one."""
                try:
                    return DECOR_DATA[(name, theme.name)]
                except KeyError:
            Severity: Minor
            Found in game/decor.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 play_anonymous_level has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            def play_anonymous_level(request, levelId, from_level_editor=True, random_level=False):
                night_mode = (
                    False if not app_settings.NIGHT_MODE_FEATURE_ENABLED else "night" in request.GET
                )
                level = Level.objects.filter(id=levelId)
            Severity: Minor
            Found in game/views/level_editor.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 _setupConsoleLogViewSliderListeners has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            ocargo.Game.prototype._setupConsoleLogViewSliderListeners = function () {
              let startEvents = ['mousedown', 'touchstart']
              let moveEvents = ['mousemove', 'touchmove']
              let endEvents = ['mouseup', 'touchend', 'touchcancel']
            
            
            Severity: Minor
            Found in game/static/game/js/game.js - 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 add_levels_80_to_107 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            def add_levels_80_to_107(apps, schema_editor):
            
                Level = apps.get_model("game", "Level")
                Episode = apps.get_model("game", "Episode")
                Theme = apps.get_model("game", "Theme")
            Severity: Minor
            Found in game/migrations/0001_squashed_0025_levels_ordering_pt1.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 _setupPythonViewSliderListeners has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            ocargo.Game.prototype._setupPythonViewSliderListeners = function () {
              let startEvents = ['mousedown', 'touchstart']
              let moveEvents = ['mousemove', 'touchmove']
              let endEvents = ['mouseup', 'touchend', 'touchcancel']
            
            
            Severity: Minor
            Found in game/static/game/js/game.js - 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 _setupLoadTab has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            ocargo.Game.prototype._setupLoadTab = function () {
              var selectedWorkspace = null
              this.tabs.load.setOnChange(
                function () {
                  this.changeTabSelectionTo(this.tabs.load)
            Severity: Minor
            Found in game/static/game/js/game.js - 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