ocadotechnology/rapid-router

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

Summary

Maintainability
F
1 mo
Test Coverage

Function LevelEditor has a Cognitive Complexity of 667 (exceeds 5 allowed). Consider refactoring.
Open

ocargo.LevelEditor = function(levelId) {

    /*************/
    /* Constants */
    /*************/
Severity: Minor
Found in game/static/game/js/level_editor.js - About 1 wk 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 LevelEditor has 2147 lines of code (exceeds 25 allowed). Consider refactoring.
Open

ocargo.LevelEditor = function(levelId) {

    /*************/
    /* Constants */
    /*************/
Severity: Major
Found in game/static/game/js/level_editor.js - About 1 wk to fix

    File level_editor.js has 2175 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    'use strict';
    
    var ocargo = ocargo || {};
    
    ocargo.LevelEditor = function(levelId) {
    Severity: Major
    Found in game/static/game/js/level_editor.js - About 6 days to fix

      Function setupToolbox has 557 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function setupToolbox() {
              var tabs = [];
              var currentTabSelected = null;
      
              tabs.play = new ocargo.Tab($('#play_radio'), $("#run-code-button"), $('#play_radio + label'));
      Severity: Major
      Found in game/static/game/js/level_editor.js - About 2 days to fix

        Function setupTrafficLightListeners has 213 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function setupTrafficLightListeners(trafficLight) {
                var image = trafficLight.image;
        
                // Position in map coordinates.
                var sourceCoord;
        Severity: Major
        Found in game/static/game/js/level_editor.js - About 1 day to fix

          Function setupCowListeners has 140 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function setupCowListeners(cow) {
                  var image = cow.image;
          
                  // Position in map coordinates.
                  var controlledCoord;
          Severity: Major
          Found in game/static/game/js/level_editor.js - About 5 hrs to fix

            Function onDragMove has 97 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    function onDragMove(dx, dy) {
                        trafficLight.valid = false;
                        image.attr({'cursor':'default'});
                        moved = dx !== 0 || dy !== 0;
            
            
            Severity: Major
            Found in game/static/game/js/level_editor.js - About 3 hrs to fix

              Function restoreState has 96 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  function restoreState(state) {
                      console.log("restoring state");
              
                      clear();
              
              
              Severity: Major
              Found in game/static/game/js/level_editor.js - About 3 hrs to fix

                Function setupHelpTab has 93 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        function setupHelpTab() {
                            var helpMessages = [
                                gettext('To get started, draw a road.'),
                                gettext('Click on the square you want the road to start from. Then, without letting go of the mouse button, ' +
                                    'drag to the square you’d like the road to end on. Do this as many times as you like to add new sections ' +
                Severity: Major
                Found in game/static/game/js/level_editor.js - About 3 hrs to fix

                  Function setupSaveTab has 79 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          function setupSaveTab() {
                              var selectedLevel = null;
                  
                              ownedLevels.addListener(processListOfLevels);
                  
                  
                  Severity: Major
                  Found in game/static/game/js/level_editor.js - About 3 hrs to fix

                    Function setupLoadTab has 78 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            function setupLoadTab() {
                                var selectedLevel = null;
                                var listOfOwnedLevels = null;
                                var sharedLevels = [];
                    
                    
                    Severity: Major
                    Found in game/static/game/js/level_editor.js - About 3 hrs to fix

                      Function extractState has 68 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          function extractState() {
                      
                              var state = {};
                      
                              // Create node data
                      Severity: Major
                      Found in game/static/game/js/level_editor.js - About 2 hrs to fix

                        Function isLevelValid has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            function isLevelValid() {
                                // Check to see if a road has been created
                            if (nodes === undefined || nodes.length == 0) {
                                var noRoad = interpolate(
                                    gettext('In %(map_icon)s%(map_label)s menu, click on %(add_road_icon)s%(add_road_label)s. Draw a road by clicking ' +
                        Severity: Major
                        Found in game/static/game/js/level_editor.js - About 2 hrs to fix

                          Function onDragMove has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                  function onDragMove(dx, dy) {
                                      cow.valid = false;
                                      image.attr({'cursor':'default'});
                                      moved = dx !== 0 || dy !== 0;
                          
                          
                          Severity: Major
                          Found in game/static/game/js/level_editor.js - About 2 hrs to fix

                            Function setupBlocksTab has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                    function setupBlocksTab() {
                                        tabs.blocks.setOnChange(function() {
                                            transitionTab(tabs.blocks);
                                        });
                            
                            
                            Severity: Major
                            Found in game/static/game/js/level_editor.js - About 2 hrs to fix

                              Function setupDecorListeners has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  function setupDecorListeners(decor) {
                                      var image = decor.image;
                              
                                      var originX;
                                      var originY;
                              Severity: Major
                              Found in game/static/game/js/level_editor.js - About 2 hrs to fix

                                Function save has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                            function save() {
                                                if(!isLevelValid()) {
                                                    return;
                                                }
                                
                                
                                Severity: Minor
                                Found in game/static/game/js/level_editor.js - About 1 hr to fix

                                  Function InternalTrafficLight has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      function InternalTrafficLight(data) {
                                  
                                          // public methods
                                          this.getData = function() {
                                              if (!this.valid) {
                                  Severity: Minor
                                  Found in game/static/game/js/level_editor.js - About 1 hr to fix

                                    Function finaliseDelete has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        function finaliseDelete(strikeEnd) {
                                    
                                            function deleteNode(x, y) {
                                                var coord = new ocargo.Coordinate(x, y);
                                                var node = ocargo.Node.findNodeByCoordinate(coord, nodes);
                                    Severity: Minor
                                    Found in game/static/game/js/level_editor.js - About 1 hr to fix

                                      Function handleMouseDown has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                          function handleMouseDown(this_rect) {
                                              return function (ev) {
                                                  ev.preventDefault();
                                      
                                                  var getBBox = this_rect.getBBox();
                                      Severity: Minor
                                      Found in game/static/game/js/level_editor.js - About 1 hr to fix

                                        Function InternalDecor has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                            function InternalDecor(decorName) {
                                        
                                                // public methods
                                                this.getData = function() {
                                                    var bBox = this.image.getBBox();
                                        Severity: Minor
                                        Found in game/static/game/js/level_editor.js - About 1 hr to fix

                                          Function onDragEnd has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                                          Open

                                                  function onDragEnd() {
                                                      //Unmark previously occupied square
                                                      if(cow.controlledNode) {
                                                          markAsBackground(cow.controlledNode.coordinate);
                                                      }
                                          Severity: Minor
                                          Found in game/static/game/js/level_editor.js - About 1 hr to fix

                                            Function onDragEnd has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                                            Open

                                                    function onDragEnd() {
                                                        // Unmark squares currently occupied
                                                        if (sourceCoord) {
                                                            markAsBackground(sourceCoord);
                                                        }
                                            Severity: Minor
                                            Found in game/static/game/js/level_editor.js - About 1 hr to fix

                                              Function setupMapTab has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                                              Open

                                                      function setupMapTab() {
                                                          tabs.map.setOnChange(function() {
                                                              transitionTab(tabs.map);
                                                              mode = modes.ADD_ROAD_MODE;
                                                              changeCurrentToolDisplay(modes.ADD_ROAD_MODE);
                                              Severity: Minor
                                              Found in game/static/game/js/level_editor.js - About 1 hr to fix

                                                Function InternalCow has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                                                Open

                                                    function InternalCow(data) {
                                                        this.data = data;
                                                
                                                        this.getData = function() {
                                                            if (!this.valid) {
                                                Severity: Minor
                                                Found in game/static/game/js/level_editor.js - About 1 hr to fix

                                                  Function getLevelTextForDjangoMigration has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                                                  Open

                                                      function getLevelTextForDjangoMigration() {
                                                          // Put a call to this function in restoreState and you should get a string
                                                          // you can copy and paste into a Django migration file
                                                          var state = extractState();
                                                  
                                                  
                                                  Severity: Minor
                                                  Found in game/static/game/js/level_editor.js - About 1 hr to fix

                                                    Function setupBlocks has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                                    Open

                                                                function setupBlocks() {
                                                                    function addListenerToImage(type) {
                                                                        $('#' + type + '_image').click(function() {
                                                                            $('#' + type + '_checkbox').click();
                                                                        });
                                                    Severity: Minor
                                                    Found in game/static/game/js/level_editor.js - About 1 hr to fix

                                                      Function setupSceneryTab has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                                      Open

                                                              function setupSceneryTab() {
                                                                  tabs.scenery.popup = true;
                                                      
                                                                  tabs.scenery.setOnChange(function() {
                                                                      transitionTab(tabs.scenery);
                                                      Severity: Minor
                                                      Found in game/static/game/js/level_editor.js - About 1 hr to fix

                                                        Function setupMaxFuel has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                                                        Open

                                                            function setupMaxFuel(){
                                                                var MAX_FUEL = 99;
                                                                var DEFAULT_FUEL = 50;
                                                                var lastCorrectFuel = $('#max_fuel').val();
                                                                if (!onlyContainsDigits(lastCorrectFuel)) {
                                                        Severity: Minor
                                                        Found in game/static/game/js/level_editor.js - About 1 hr to fix

                                                          Function deleteNode has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                                                          Open

                                                                  function deleteNode(x, y) {
                                                                      var coord = new ocargo.Coordinate(x, y);
                                                                      var node = ocargo.Node.findNodeByCoordinate(coord, nodes);
                                                                      if (node) {
                                                                          // Remove all the references to the node we're removing.
                                                          Severity: Minor
                                                          Found in game/static/game/js/level_editor.js - About 1 hr to fix

                                                            Function setupRandomTab has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                                            Open

                                                                    function setupRandomTab() {
                                                                        tabs.random.setOnChange(function() {
                                                                            transitionTab(tabs.random);
                                                                        });
                                                            
                                                            
                                                            Severity: Minor
                                                            Found in game/static/game/js/level_editor.js - About 1 hr to fix

                                                              Function addReleaseListeners has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                                              Open

                                                                  function addReleaseListeners(element) {
                                                                      var lastGridItem;
                                                              
                                                                      element.onmouseover =
                                                                          function(e) {
                                                              Severity: Minor
                                                              Found in game/static/game/js/level_editor.js - About 1 hr to fix

                                                                Function isLoggedIn has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                Open

                                                                    function isLoggedIn(activity) {
                                                                        if (USER_STATUS !== "SCHOOL_STUDENT" && USER_STATUS !== "TEACHER" && USER_STATUS !== "INDEPENDENT_STUDENT") {
                                                                            var getNotLoggedInMessage = function() {
                                                                                var notLoggedInMessages = [];
                                                                                switch (activity) {
                                                                Severity: Minor
                                                                Found in game/static/game/js/level_editor.js - About 1 hr to fix

                                                                  Avoid too many return statements within this function.
                                                                  Open

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

                                                                    Avoid too many return statements within this function.
                                                                    Open

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

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

                                                                              if (houseNodes.length === 0) {
                                                                                  var noHouses = interpolate(
                                                                                      gettext('In %(map_icon)s%(map_label)s menu, click on %(add_house_icon)s%(add_house_label)s ' +
                                                                                          'and then select the square(s) where you want to add houses for delivery.'
                                                                                      ), {
                                                                      Severity: Major
                                                                      Found in game/static/game/js/level_editor.js and 2 other locations - About 5 hrs to fix
                                                                      game/static/game/js/level_editor.js on lines 2439..2453
                                                                      game/static/game/js/level_editor.js on lines 2455..2469

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

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

                                                                              if (!originNode) {
                                                                                  var noStart = interpolate(
                                                                                      gettext('In %(map_icon)s%(map_label)s menu, click on %(mark_start_icon)s%(mark_start_label)s ' +
                                                                                          'and then select the square where you want the road to start.'
                                                                                      ), {
                                                                      Severity: Major
                                                                      Found in game/static/game/js/level_editor.js and 2 other locations - About 5 hrs to fix
                                                                      game/static/game/js/level_editor.js on lines 2439..2453
                                                                      game/static/game/js/level_editor.js on lines 2471..2485

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

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

                                                                          if (nodes === undefined || nodes.length == 0) {
                                                                              var noRoad = interpolate(
                                                                                  gettext('In %(map_icon)s%(map_label)s menu, click on %(add_road_icon)s%(add_road_label)s. Draw a road by clicking ' +
                                                                                      'on a square then dragging to another square.'
                                                                                  ), {
                                                                      Severity: Major
                                                                      Found in game/static/game/js/level_editor.js and 2 other locations - About 5 hrs to fix
                                                                      game/static/game/js/level_editor.js on lines 2455..2469
                                                                      game/static/game/js/level_editor.js on lines 2471..2485

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

                                                                      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

                                                                                          ), {
                                                                                              map_icon: ocargo.jsElements.image(ocargo.Drawing.imageDir + 'icons/map.svg', 'popupIcon'),
                                                                                              map_label: '<b>' + gettext('Map') + '</b>',
                                                                                              mark_start_icon: ocargo.jsElements.image(ocargo.Drawing.imageDir + 'icons/origin.svg', 'popupIcon'),
                                                                                              mark_start_label: '<b>' + gettext('Mark start') + '</b>',
                                                                      Severity: Major
                                                                      Found in game/static/game/js/level_editor.js and 1 other location - About 5 hrs to fix
                                                                      game/static/game/js/level_editor.js on lines 797..804

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

                                                                      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

                                                                                          ), {
                                                                                              play_icon: ocargo.jsElements.image(ocargo.Drawing.imageDir + 'icons/play.svg', 'popupIcon'),
                                                                                              play_label: '<b>' + gettext('Play') + '</b>',
                                                                                              save_icon: ocargo.jsElements.image(ocargo.Drawing.imageDir + 'icons/save.svg', 'popupIcon'),
                                                                                              save_label: '<b>' + gettext('Save') + '</b>',
                                                                      Severity: Major
                                                                      Found in game/static/game/js/level_editor.js and 1 other location - About 5 hrs to fix
                                                                      game/static/game/js/level_editor.js on lines 738..745

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

                                                                      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

                                                                                      for (var i = 0; i < table[0].rows.length; i++) {
                                                                                           var row = table[0].rows[i];
                                                                                           var existingName = row.cells[0].innerHTML;
                                                                                           if (existingName === newName) {
                                                                                              existingId = row.getAttribute('value');
                                                                      Severity: Major
                                                                      Found in game/static/game/js/level_editor.js and 1 other location - About 3 hrs to fix
                                                                      game/static/game/js/game.js on lines 1212..1219

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

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

                                                                          function handleTouchEnd() {
                                                                              return function(ev) {
                                                                                  if (ev.changedTouches.length === 1 && !isScrolling) {
                                                                                      var gridItem = getGridItem(ev.changedTouches[0].pageX, ev.changedTouches[0].pageY);
                                                                                      handleMouseUp(gridItem)(ev);
                                                                      Severity: Major
                                                                      Found in game/static/game/js/level_editor.js and 2 other locations - About 2 hrs to fix
                                                                      game/static/game/js/level_editor.js on lines 1416..1423
                                                                      game/static/game/js/level_editor.js on lines 1425..1432

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

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

                                                                          function handleTouchStart() {
                                                                              return function (ev) {
                                                                                  if (ev.touches.length === 1 && !isScrolling) {
                                                                                      var gridItem = getGridItem(ev.touches[0].pageX, ev.touches[0].pageY);
                                                                                      handleMouseDown(gridItem)(ev);
                                                                      Severity: Major
                                                                      Found in game/static/game/js/level_editor.js and 2 other locations - About 2 hrs to fix
                                                                      game/static/game/js/level_editor.js on lines 1425..1432
                                                                      game/static/game/js/level_editor.js on lines 1434..1441

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

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

                                                                          function handleTouchMove() {
                                                                              return function(ev) {
                                                                                  if (ev.touches.length === 1 && !isScrolling) {
                                                                                      var gridItem = getGridItem(ev.touches[0].pageX, ev.touches[0].pageY);
                                                                                      handleMouseOver(gridItem)(ev);
                                                                      Severity: Major
                                                                      Found in game/static/game/js/level_editor.js and 2 other locations - About 2 hrs to fix
                                                                      game/static/game/js/level_editor.js on lines 1416..1423
                                                                      game/static/game/js/level_editor.js on lines 1434..1441

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

                                                                      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

                                                                              this.destroy = function() {
                                                                                  this.image.remove();
                                                                                  var index = trafficLights.indexOf(this);
                                                                                  if (index !== -1) {
                                                                                      trafficLights.splice(index, 1);
                                                                      Severity: Major
                                                                      Found in game/static/game/js/level_editor.js and 1 other location - About 1 hr to fix
                                                                      game/static/game/js/level_editor.js on lines 2785..2791

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

                                                                      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

                                                                              this.destroy = function() {
                                                                                  this.image.remove();
                                                                                  var index = decor.indexOf(this);
                                                                                  if (index !== -1) {
                                                                                      decor.splice(index, 1);
                                                                      Severity: Major
                                                                      Found in game/static/game/js/level_editor.js and 1 other location - About 1 hr to fix
                                                                      game/static/game/js/level_editor.js on lines 2707..2713

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

                                                                      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

                                                                                  $('#trafficLightRed').click(function() {
                                                                                      new InternalTrafficLight({"redDuration": 3, "greenDuration": 3, "startTime": 0,
                                                                                                                "startingState": ocargo.TrafficLight.RED,
                                                                                                                "sourceCoordinate": null,  "direction": null});
                                                                                  });
                                                                      Severity: Major
                                                                      Found in game/static/game/js/level_editor.js and 1 other location - About 1 hr to fix
                                                                      game/static/game/js/level_editor.js on lines 331..335

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

                                                                      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

                                                                                  $('#trafficLightGreen').click(function() {
                                                                                      new InternalTrafficLight({"redDuration": 3, "greenDuration": 3, "startTime": 0,
                                                                                                                "startingState": ocargo.TrafficLight.GREEN,
                                                                                                                "sourceCoordinate": null,  "direction": null});
                                                                                  });
                                                                      Severity: Major
                                                                      Found in game/static/game/js/level_editor.js and 1 other location - About 1 hr to fix
                                                                      game/static/game/js/level_editor.js on lines 325..329

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

                                                                      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 (paperHeight < paperY + imageHeight) {
                                                                                          trafficLightY = paperHeight - imageHeight
                                                                                          image.transform('t' + trafficLightX + ',' + trafficLightY + 'r' + rotation + 's' + scaling);
                                                                                      }
                                                                      Severity: Major
                                                                      Found in game/static/game/js/level_editor.js and 1 other location - About 1 hr to fix
                                                                      game/static/game/js/level_editor.js on lines 1941..1944

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

                                                                      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 (paperWidth < paperX + imageWidth) {
                                                                                          trafficLightX = paperWidth - imageWidth
                                                                                          image.transform('t' + trafficLightX + ',' + trafficLightY + 'r' + rotation + 's' + scaling);
                                                                                      }
                                                                      Severity: Major
                                                                      Found in game/static/game/js/level_editor.js and 1 other location - About 1 hr to fix
                                                                      game/static/game/js/level_editor.js on lines 1945..1948

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

                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                      Refactorings

                                                                      Further Reading

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

                                                                              if(paperAbsX > trashcanAbsolutePaperX && paperAbsX <= trashcanAbsolutePaperX + trashcanWidth  &&
                                                                                  paperAbsY > trashcanAbsolutePaperY - 20 && paperAbsY <= trashcanAbsolutePaperY + trashcanHeight) {
                                                                                  openTrashcan();
                                                                              } else {
                                                                                  closeTrashcan();
                                                                      Severity: Major
                                                                      Found in game/static/game/js/level_editor.js and 2 other locations - About 1 hr to fix
                                                                      game/static/game/js/level_editor.js on lines 1622..1627
                                                                      game/static/game/js/level_editor.js on lines 1878..1883

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

                                                                      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

                                                                                  var noBlocks = interpolate(
                                                                                      gettext('Go to %(code_icon)s%(code_label)s and select some to use. Remember to include the move and turn ' +
                                                                                          'commands!'
                                                                                      ), {
                                                                                          code_icon: ocargo.jsElements.image(ocargo.Drawing.imageDir + 'icons/blockly.svg', 'popupIcon'),
                                                                      Severity: Major
                                                                      Found in game/static/game/js/level_editor.js and 1 other location - About 1 hr to fix
                                                                      game/static/game/js/level_editor.js on lines 785..793

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

                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                      Refactorings

                                                                      Further Reading

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

                                                                                  if(paperAbsX > trashcanAbsolutePaperX && paperAbsX <= trashcanAbsolutePaperX + trashcanWidth  &&
                                                                                      paperAbsY > trashcanAbsolutePaperY - 20 && paperAbsY <= trashcanAbsolutePaperY + trashcanHeight) {
                                                                                      openTrashcan();
                                                                                  } else {
                                                                                      closeTrashcan();
                                                                      Severity: Major
                                                                      Found in game/static/game/js/level_editor.js and 2 other locations - About 1 hr to fix
                                                                      game/static/game/js/level_editor.js on lines 1028..1033
                                                                      game/static/game/js/level_editor.js on lines 1622..1627

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

                                                                      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

                                                                                      interpolate(
                                                                                          gettext('Select which blocks of code you want to be used to create a route for your character from the ' +
                                                                                              '%(blocks_icon)s%(blocks_label)s menu.'
                                                                                          ), {
                                                                                              blocks_icon: ocargo.jsElements.image(ocargo.Drawing.imageDir + 'icons/blockly.svg', 'popupIcon'),
                                                                      Severity: Major
                                                                      Found in game/static/game/js/level_editor.js and 1 other location - About 1 hr to fix
                                                                      game/static/game/js/level_editor.js on lines 2498..2506

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

                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                      Refactorings

                                                                      Further Reading

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

                                                                                  if(paperAbsX > trashcanAbsolutePaperX && paperAbsX <= trashcanAbsolutePaperX + trashcanWidth  &&
                                                                                      paperAbsY > trashcanAbsolutePaperY - 20 && paperAbsY <= trashcanAbsolutePaperY + trashcanHeight) {
                                                                                      openTrashcan();
                                                                                  } else {
                                                                                      closeTrashcan();
                                                                      Severity: Major
                                                                      Found in game/static/game/js/level_editor.js and 2 other locations - About 1 hr to fix
                                                                      game/static/game/js/level_editor.js on lines 1028..1033
                                                                      game/static/game/js/level_editor.js on lines 1878..1883

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

                                                                      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

                                                                                      interpolate(
                                                                                          gettext('%(quit_icon)s%(quit_label)s will take you back to the Rapid Router homepage.'
                                                                                          ), {
                                                                                              quit_icon: ocargo.jsElements.image(ocargo.Drawing.imageDir + 'icons/quit.svg', 'popupIcon'),
                                                                                              quit_label: '<b>' + gettext('Quit') + '</b>'
                                                                      Severity: Major
                                                                      Found in game/static/game/js/level_editor.js and 3 other locations - About 1 hr to fix
                                                                      game/static/game/js/level_editor.js on lines 760..766
                                                                      game/static/game/js/level_editor.js on lines 778..784
                                                                      game/static/game/js/level_editor.js on lines 2812..2818

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

                                                                      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

                                                                                      interpolate(
                                                                                          gettext('Choose a character to play with from the %(character_icon)s%(character_label)s menu.'), {
                                                                                              character_icon: ocargo.jsElements.image(ocargo.Drawing.imageDir + 'icons/character.svg', 'popupIcon'),
                                                                                              character_label: '<b>' + gettext('Character') + '</b>'
                                                                                          },
                                                                      Severity: Major
                                                                      Found in game/static/game/js/level_editor.js and 3 other locations - About 1 hr to fix
                                                                      game/static/game/js/level_editor.js on lines 760..766
                                                                      game/static/game/js/level_editor.js on lines 807..814
                                                                      game/static/game/js/level_editor.js on lines 2812..2818

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

                                                                      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

                                                                          var subtitle = interpolate(
                                                                              gettext('Click %(help_icon)s%(help_label)s for clues on getting started.'), {
                                                                                  help_icon: ocargo.jsElements.image(ocargo.Drawing.imageDir + 'icons/help.svg', 'popupHelp'),
                                                                                  help_label: '<b>' + gettext('Help') + '</b>'
                                                                              },
                                                                      Severity: Major
                                                                      Found in game/static/game/js/level_editor.js and 3 other locations - About 1 hr to fix
                                                                      game/static/game/js/level_editor.js on lines 760..766
                                                                      game/static/game/js/level_editor.js on lines 778..784
                                                                      game/static/game/js/level_editor.js on lines 807..814

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

                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                      Refactorings

                                                                      Further Reading

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

                                                                                  if (houseNodes.length > 0) {
                                                                                      for (let i = 0; i < houseNodes.length; i++){
                                                                                          markAsHouse(houseNodes[i].coordinate);
                                                                                      }
                                                                                  }
                                                                      Severity: Major
                                                                      Found in game/static/game/js/level_editor.js and 1 other location - About 1 hr to fix
                                                                      game/static/game/js/level_editor.js on lines 1803..1807

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

                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                      Refactorings

                                                                      Further Reading

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

                                                                                  if (houseNodes.length > 0) {
                                                                                      for (let i = 0; i < houseNodes.length; i++) {
                                                                                          markAsHouse(houseNodes[i].coordinate);
                                                                                      }
                                                                                  }
                                                                      Severity: Major
                                                                      Found in game/static/game/js/level_editor.js and 1 other location - About 1 hr to fix
                                                                      game/static/game/js/level_editor.js on lines 1585..1589

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

                                                                      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

                                                                                      interpolate(
                                                                                          gettext('Click %(random_icon)s%(random_label)s if you want the computer to create a random route for you.'), {
                                                                                              random_icon: ocargo.jsElements.image(ocargo.Drawing.imageDir + 'icons/random.svg', 'popupIcon'),
                                                                                              random_label: '<b>' + gettext('Random') + '</b>'
                                                                                          },
                                                                      Severity: Major
                                                                      Found in game/static/game/js/level_editor.js and 3 other locations - About 1 hr to fix
                                                                      game/static/game/js/level_editor.js on lines 778..784
                                                                      game/static/game/js/level_editor.js on lines 807..814
                                                                      game/static/game/js/level_editor.js on lines 2812..2818

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

                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                      Refactorings

                                                                      Further Reading

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

                                                                              if (houseNodes.length > 0) {
                                                                                  for (let i = 0; i < houseNodes.length; i++) {
                                                                                      markAsHouse(houseNodes[i].coordinate);
                                                                                  }
                                                                              }
                                                                      Severity: Major
                                                                      Found in game/static/game/js/level_editor.js and 2 other locations - About 1 hr to fix
                                                                      game/static/game/js/level_editor.js on lines 1658..1662
                                                                      game/static/game/js/level_editor.js on lines 1922..1926

                                                                      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

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

                                                                                  if (houseNodes.length > 0) {
                                                                                      for (let i = 0; i < houseNodes.length; i++) {
                                                                                          markAsHouse(houseNodes[i].coordinate);
                                                                                      }
                                                                                  }
                                                                      Severity: Major
                                                                      Found in game/static/game/js/level_editor.js and 2 other locations - About 1 hr to fix
                                                                      game/static/game/js/level_editor.js on lines 1219..1223
                                                                      game/static/game/js/level_editor.js on lines 1922..1926

                                                                      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

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

                                                                                  if (houseNodes.length > 0) {
                                                                                      for (let i = 0; i < houseNodes.length; i++) {
                                                                                          markAsHouse(houseNodes[i].coordinate);
                                                                                      }
                                                                                  }
                                                                      Severity: Major
                                                                      Found in game/static/game/js/level_editor.js and 2 other locations - About 1 hr to fix
                                                                      game/static/game/js/level_editor.js on lines 1219..1223
                                                                      game/static/game/js/level_editor.js on lines 1658..1662

                                                                      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

                                                                          function bringTrafficLightsToFront() {
                                                                              for (var i = 0; i < trafficLights.length; i++) {
                                                                                  trafficLights[i].image.toFront();
                                                                              }
                                                                          }
                                                                      Severity: Minor
                                                                      Found in game/static/game/js/level_editor.js and 1 other location - About 55 mins to fix
                                                                      game/static/game/js/level_editor.js on lines 1146..1150

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

                                                                      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

                                                                          function bringDecorToFront() {
                                                                              for (var i = 0; i < decor.length; i++) {
                                                                                  decor[i].image.toFront();
                                                                              }
                                                                          }
                                                                      Severity: Minor
                                                                      Found in game/static/game/js/level_editor.js and 1 other location - About 55 mins to fix
                                                                      game/static/game/js/level_editor.js on lines 1152..1156

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

                                                                      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 (strikeStart.y <= strikeEnd.y) {
                                                                                  for (y = strikeStart.y + 1; y <= strikeEnd.y; y++) {
                                                                                      func(strikeEnd.x, y);
                                                                                  }
                                                                              } else {
                                                                      Severity: Minor
                                                                      Found in game/static/game/js/level_editor.js and 1 other location - About 40 mins to fix
                                                                      game/static/game/js/level_editor.js on lines 2126..2130

                                                                      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

                                                                              } else {
                                                                                  for (y = strikeStart.y - 1; y >= strikeEnd.y; y--) {
                                                                                      func(strikeEnd.x, y);
                                                                                  }
                                                                              }
                                                                      Severity: Minor
                                                                      Found in game/static/game/js/level_editor.js and 1 other location - About 40 mins to fix
                                                                      game/static/game/js/level_editor.js on lines 2122..2126

                                                                      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

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

                                                                                  if (paperX < 0) {
                                                                                      paperX = 0;
                                                                                  } else if (paperX + imageWidth > EXTENDED_PAPER_WIDTH) {
                                                                                      paperX = EXTENDED_PAPER_WIDTH - imageWidth;
                                                                                  }
                                                                      Severity: Minor
                                                                      Found in game/static/game/js/level_editor.js and 2 other locations - About 35 mins to fix
                                                                      game/static/game/js/level_editor.js on lines 1466..1470
                                                                      game/static/game/js/level_editor.js on lines 1776..1780

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

                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                      Refactorings

                                                                      Further Reading

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

                                                                                  if (paperX < 0) {
                                                                                      paperX = 0;
                                                                                  } else if (paperX + imageWidth > EXTENDED_PAPER_WIDTH) {
                                                                                      paperX = EXTENDED_PAPER_WIDTH - imageWidth;
                                                                                  }
                                                                      Severity: Minor
                                                                      Found in game/static/game/js/level_editor.js and 2 other locations - About 35 mins to fix
                                                                      game/static/game/js/level_editor.js on lines 1556..1560
                                                                      game/static/game/js/level_editor.js on lines 1776..1780

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

                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                      Refactorings

                                                                      Further Reading

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

                                                                                  if (paperX < 0) {
                                                                                      paperX = 0;
                                                                                  } else if (paperX + imageWidth > EXTENDED_PAPER_WIDTH) {
                                                                                      paperX = EXTENDED_PAPER_WIDTH - imageWidth;
                                                                                  }
                                                                      Severity: Minor
                                                                      Found in game/static/game/js/level_editor.js and 2 other locations - About 35 mins to fix
                                                                      game/static/game/js/level_editor.js on lines 1466..1470
                                                                      game/static/game/js/level_editor.js on lines 1556..1560

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

                                                                      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 (data.sourceCoordinate && data.direction) {
                                                                                  var sourceCoordinate = new ocargo.Coordinate(data.sourceCoordinate.x, data.sourceCoordinate.y);
                                                                                  var controlledCoordinate = sourceCoordinate.getNextInDirection(data.direction);
                                                                      
                                                                                  this.sourceNode = ocargo.Node.findNodeByCoordinate(sourceCoordinate, nodes);
                                                                      Severity: Minor
                                                                      Found in game/static/game/js/level_editor.js and 1 other location - About 35 mins to fix
                                                                      game/static/game/js/level_editor.js on lines 2668..2678

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

                                                                      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 (paperY < 0) {
                                                                                      paperY =  0;
                                                                                  } else if (paperY + imageHeight >  EXTENDED_PAPER_HEIGHT) {
                                                                                      paperY = EXTENDED_PAPER_HEIGHT - imageHeight;
                                                                                  }
                                                                      Severity: Minor
                                                                      Found in game/static/game/js/level_editor.js and 1 other location - About 35 mins to fix
                                                                      game/static/game/js/level_editor.js on lines 1561..1565

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

                                                                      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 (paperY < 0) {
                                                                                      paperY =  0;
                                                                                  } else if (paperY + imageHeight >  EXTENDED_PAPER_HEIGHT) {
                                                                                      paperY = EXTENDED_PAPER_HEIGHT - imageHeight;
                                                                                  }
                                                                      Severity: Minor
                                                                      Found in game/static/game/js/level_editor.js and 1 other location - About 35 mins to fix
                                                                      game/static/game/js/level_editor.js on lines 1781..1785

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

                                                                      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 ( data.coordinates && data.coordinates.length > 0 ) {
                                                                                  var coordinates = new ocargo.Coordinate(data.coordinates[0].x, data.coordinates[0].y);
                                                                                  this.controlledNode = ocargo.Node.findNodeByCoordinate(coordinates, nodes);
                                                                      
                                                                                  if (this.controlledNode) {
                                                                      Severity: Minor
                                                                      Found in game/static/game/js/level_editor.js and 1 other location - About 35 mins to fix
                                                                      game/static/game/js/level_editor.js on lines 2727..2740

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

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

                                                                              for (var i = trafficLights.length-1; i >= 0; i--) {
                                                                                  trafficLights[i].destroy();
                                                                              }
                                                                      Severity: Minor
                                                                      Found in game/static/game/js/level_editor.js and 2 other locations - About 30 mins to fix
                                                                      game/static/game/js/level_editor.js on lines 1112..1114
                                                                      game/static/game/js/level_editor.js on lines 1116..1118

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

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

                                                                              for (var i = cows.length-1; i >= 0; i--) {
                                                                                  cows[i].destroy();
                                                                              }
                                                                      Severity: Minor
                                                                      Found in game/static/game/js/level_editor.js and 2 other locations - About 30 mins to fix
                                                                      game/static/game/js/level_editor.js on lines 1109..1111
                                                                      game/static/game/js/level_editor.js on lines 1112..1114

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

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

                                                                              for (var i = decor.length-1; i >= 0; i--) {
                                                                                  decor[i].destroy();
                                                                              }
                                                                      Severity: Minor
                                                                      Found in game/static/game/js/level_editor.js and 2 other locations - About 30 mins to fix
                                                                      game/static/game/js/level_editor.js on lines 1109..1111
                                                                      game/static/game/js/level_editor.js on lines 1116..1118

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

                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                      Refactorings

                                                                      Further Reading

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

                                                                                  var y = GRID_HEIGHT - Math.min(Math.max(0, Math.floor(absY)), GRID_HEIGHT - 1) - 1;
                                                                      Severity: Minor
                                                                      Found in game/static/game/js/level_editor.js and 1 other location - About 30 mins to fix
                                                                      game/static/game/js/level_editor.js on lines 1830..1830

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

                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                      Refactorings

                                                                      Further Reading

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

                                                                                  var y = GRID_HEIGHT - Math.min(Math.max(0, Math.floor(absY)), GRID_HEIGHT - 1) - 1;
                                                                      Severity: Minor
                                                                      Found in game/static/game/js/level_editor.js and 1 other location - About 30 mins to fix
                                                                      game/static/game/js/level_editor.js on lines 1597..1597

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

                                                                      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