ocadotechnology/rapid-router

View on GitHub
game/static/game/js/blocklyCompiler.js

Summary

Maintainability
F
1 wk
Test Coverage

File blocklyCompiler.js has 556 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"use strict";

var ocargo = ocargo || {};

ocargo.BlocklyCompiler = function () {};
Severity: Major
Found in game/static/game/js/blocklyCompiler.js - About 1 day to fix

    Function createSequence has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

    ocargo.BlocklyCompiler.prototype.createSequence = function (block) {
      var commands = [];
    
      while (block) {
        if (block.type === "move_forwards") {
    Severity: Minor
    Found in game/static/game/js/blocklyCompiler.js - 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 getValue has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    ocargo.BlocklyCompiler.prototype.getValue = function (block) {
      if (block.type === "variables_get") {
        var variableName = block.inputList[0].fieldRow[0].text_;
        return parseInt(this.program.variables[variableName]);
      } else if (block.type === "math_number") {
    Severity: Minor
    Found in game/static/game/js/blocklyCompiler.js - 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 createSequence has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    ocargo.BlocklyCompiler.prototype.createSequence = function (block) {
      var commands = [];
    
      while (block) {
        if (block.type === "move_forwards") {
    Severity: Minor
    Found in game/static/game/js/blocklyCompiler.js - About 1 hr to fix

      Function getValue has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      ocargo.BlocklyCompiler.prototype.getValue = function (block) {
        if (block.type === "variables_get") {
          var variableName = block.inputList[0].fieldRow[0].text_;
          return parseInt(this.program.variables[variableName]);
        } else if (block.type === "math_number") {
      Severity: Minor
      Found in game/static/game/js/blocklyCompiler.js - About 1 hr to fix

        Function mobileCreateIf has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        ocargo.BlocklyCompiler.prototype.mobileCreateIf = function (block) {
          var conditionalCommandSets = [];
        
          var elseCount = block.elseCount_ || 0;
          var i = 0;
        Severity: Minor
        Found in game/static/game/js/blocklyCompiler.js - About 1 hr to fix

          Function createIf has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          ocargo.BlocklyCompiler.prototype.createIf = function (block) {
            var conditionalCommandSets = [];
          
            var elseCount = block.elseCount_ || 0;
            var i = 0;
          Severity: Minor
          Found in game/static/game/js/blocklyCompiler.js - About 1 hr to fix

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

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

            ocargo.BlocklyCompiler.prototype.compileProcedures = function () {
              this.procedures = {};
              this.procedureBindings = [];
            
              var procBlocks = ocargo.blocklyControl.procedureBlocks();
            Severity: Minor
            Found in game/static/game/js/blocklyCompiler.js - 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 mobileCreateIf has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

            ocargo.BlocklyCompiler.prototype.mobileCreateIf = function (block) {
              var conditionalCommandSets = [];
            
              var elseCount = block.elseCount_ || 0;
              var i = 0;
            Severity: Minor
            Found in game/static/game/js/blocklyCompiler.js - 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 mobileCreateSequence has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

            ocargo.BlocklyCompiler.prototype.mobileCreateSequence = function (blocks) {
              var commands = [];
            
              var block = blocks.shift();
              while (block) {
            Severity: Minor
            Found in game/static/game/js/blocklyCompiler.js - 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 createIf has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

            ocargo.BlocklyCompiler.prototype.createIf = function (block) {
              var conditionalCommandSets = [];
            
              var elseCount = block.elseCount_ || 0;
              var i = 0;
            Severity: Minor
            Found in game/static/game/js/blocklyCompiler.js - 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 too many return statements within this function.
            Open

                return this.cowCrossingCondition(conditionBlock);
            Severity: Major
            Found in game/static/game/js/blocklyCompiler.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                    return leftValue ** rightValue;
              Severity: Major
              Found in game/static/game/js/blocklyCompiler.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                      return leftValue * rightValue;
                Severity: Major
                Found in game/static/game/js/blocklyCompiler.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                      return null;
                  Severity: Major
                  Found in game/static/game/js/blocklyCompiler.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                        return this.logicCompareCondition(conditionBlock);
                    Severity: Major
                    Found in game/static/game/js/blocklyCompiler.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                            return leftValue / rightValue;
                      Severity: Major
                      Found in game/static/game/js/blocklyCompiler.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                            return this.trafficLightCondition(conditionBlock);
                        Severity: Major
                        Found in game/static/game/js/blocklyCompiler.js - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                return leftValue > rightValue;
                          Severity: Major
                          Found in game/static/game/js/blocklyCompiler.js - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                  return leftValue >= rightValue;
                            Severity: Major
                            Found in game/static/game/js/blocklyCompiler.js - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                  return this.trafficLightCondition(conditionBlock);
                              Severity: Major
                              Found in game/static/game/js/blocklyCompiler.js - About 30 mins to fix

                                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

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

                                ocargo.BlocklyCompiler.prototype.createIf = function (block) {
                                  var conditionalCommandSets = [];
                                
                                  var elseCount = block.elseCount_ || 0;
                                  var i = 0;
                                Severity: Major
                                Found in game/static/game/js/blocklyCompiler.js and 1 other location - About 1 day to fix
                                game/static/game/js/blocklyCompiler.js on lines 597..631

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

                                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

                                ocargo.BlocklyCompiler.prototype.mobileCreateIf = function (block) {
                                  var conditionalCommandSets = [];
                                
                                  var elseCount = block.elseCount_ || 0;
                                  var i = 0;
                                Severity: Major
                                Found in game/static/game/js/blocklyCompiler.js and 1 other location - About 1 day to fix
                                game/static/game/js/blocklyCompiler.js on lines 284..318

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

                                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

                                ocargo.BlocklyCompiler.prototype.createWhileUntil = function (block) {
                                  var conditionBlock = block.inputList[0].connection.targetBlock();
                                  if (conditionBlock === null) {
                                    throw gettext_noop("Perhaps try looking at your 'repeat' blocks?");
                                  }
                                Severity: Major
                                Found in game/static/game/js/blocklyCompiler.js and 1 other location - About 7 hrs to fix
                                game/static/game/js/blocklyCompiler.js on lines 580..595

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

                                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

                                ocargo.BlocklyCompiler.prototype.mobileCreateWhileUntil = function (block) {
                                  var conditionBlock = block.inputList[0].connection.targetBlock();
                                  if (conditionBlock === null) {
                                    throw gettext_noop("Perhaps try looking at your 'repeat' blocks?");
                                  }
                                Severity: Major
                                Found in game/static/game/js/blocklyCompiler.js and 1 other location - About 7 hrs to fix
                                game/static/game/js/blocklyCompiler.js on lines 213..228

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

                                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

                                ocargo.BlocklyCompiler.prototype.createRepeatWhile = function (block) {
                                  var conditionBlock = block.inputList[0].connection.targetBlock();
                                  if (conditionBlock === null) {
                                    throw gettext_noop("Perhaps try looking at your 'repeat' blocks?");
                                  }
                                Severity: Major
                                Found in game/static/game/js/blocklyCompiler.js and 1 other location - About 5 hrs to fix
                                game/static/game/js/blocklyCompiler.js on lines 551..563

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

                                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

                                ocargo.BlocklyCompiler.prototype.mobileCreateRepeatWhile = function (block) {
                                  var conditionBlock = block.inputList[0].connection.targetBlock();
                                  if (conditionBlock === null) {
                                    throw gettext_noop("Perhaps try looking at your 'repeat' blocks?");
                                  }
                                Severity: Major
                                Found in game/static/game/js/blocklyCompiler.js and 1 other location - About 5 hrs to fix
                                game/static/game/js/blocklyCompiler.js on lines 118..130

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

                                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

                                ocargo.BlocklyCompiler.prototype.createRepeat = function (block) {
                                  var bodyBlock = block.inputList[1].connection.targetBlock();
                                  if (bodyBlock === null) {
                                    throw gettext_noop("Perhaps try looking at your 'repeat' blocks?");
                                  }
                                Severity: Major
                                Found in game/static/game/js/blocklyCompiler.js and 1 other location - About 4 hrs to fix
                                game/static/game/js/blocklyCompiler.js on lines 565..578

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

                                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

                                ocargo.BlocklyCompiler.prototype.mobileCreateRepeat = function (block) {
                                  var bodyBlock = block.inputList[1].connection.targetBlock();
                                  if (bodyBlock === null) {
                                    throw gettext_noop("Perhaps try looking at your 'repeat' blocks?");
                                  }
                                Severity: Major
                                Found in game/static/game/js/blocklyCompiler.js and 1 other location - About 4 hrs to fix
                                game/static/game/js/blocklyCompiler.js on lines 198..211

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

                                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

                                ocargo.BlocklyCompiler.prototype.mobileCreateProcedureCall = function (block) {
                                  var name = block.inputList[0].fieldRow[2].text_;
                                  if (name === "") {
                                    throw gettext_noop("Perhaps try checking the names in your 'call' blocks?");
                                  }
                                Severity: Major
                                Found in game/static/game/js/blocklyCompiler.js and 1 other location - About 3 hrs to fix
                                game/static/game/js/blocklyCompiler.js on lines 132..141

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

                                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

                                ocargo.BlocklyCompiler.prototype.createProcedureCall = function (block) {
                                  var name = block.inputList[0].fieldRow[2].text_;
                                  if (name === "") {
                                    throw gettext_noop("Perhaps try checking the names in your 'call' blocks?");
                                  }
                                Severity: Major
                                Found in game/static/game/js/blocklyCompiler.js and 1 other location - About 3 hrs to fix
                                game/static/game/js/blocklyCompiler.js on lines 633..642

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

                                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 (operator == "ADD") {
                                      return leftValue + rightValue;
                                    } else if (operator == "MINUS") {
                                      return leftValue - rightValue;
                                    } else if (operator == "MULTIPLY") {
                                Severity: Major
                                Found in game/static/game/js/blocklyCompiler.js and 1 other location - About 2 hrs to fix
                                game/static/game/js/blocklyCompiler.js on lines 456..466

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

                                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

                                    } else if (operator == "NEQ") {
                                      return leftValue !== rightValue;
                                    } else if (operator == "LT") {
                                      return leftValue < rightValue;
                                    } else if (operator == "LTE") {
                                Severity: Major
                                Found in game/static/game/js/blocklyCompiler.js and 1 other location - About 2 hrs to fix
                                game/static/game/js/blocklyCompiler.js on lines 270..280

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

                                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

                                ocargo.BlocklyCompiler.prototype.deadEndCondition = function (block) {
                                  return function (model) {
                                    queueHighlight(model, block);
                                    return model.isDeadEnd();
                                  };
                                Severity: Minor
                                Found in game/static/game/js/blocklyCompiler.js and 1 other location - About 50 mins to fix
                                game/static/game/js/blocklyCompiler.js on lines 415..420

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

                                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

                                ocargo.BlocklyCompiler.prototype.atDestinationCondition = function (block) {
                                  return function (model) {
                                    queueHighlight(model, block);
                                    return model.isAtADestination();
                                  };
                                Severity: Minor
                                Found in game/static/game/js/blocklyCompiler.js and 1 other location - About 50 mins to fix
                                game/static/game/js/blocklyCompiler.js on lines 395..400

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

                                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