ocadotechnology/rapid-router

View on GitHub

Showing 1,359 of 1,362 total issues

Function BlocklyCustomisations has a Cognitive Complexity of 99 (exceeds 5 allowed). Consider refactoring.
Open

ocargo.BlocklyCustomisations = function () {

    const TOOLBOX_REMAINING_CAPACITY_TEXT_COLUMN_WIDTH = 50;

    var limitedBlocks = false;
Severity: Minor
Found in game/static/game/js/blocklyCustomisations.js - About 1 day 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 generate_random_path has a Cognitive Complexity of 92 (exceeds 5 allowed). Consider refactoring.
Open

def generate_random_path(num_road_tiles, branchiness_factor, loopiness_factor, curviness_factor):
    def pick_adjacent_node(nodes, connections, branchiness_factor, curviness_factor):
        for attempts in range(5):
            origin = pick_origin_node(nodes, connections, branchiness_factor)
            possibles = []
Severity: Minor
Found in game/random_road.py - About 1 day to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

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

ocargo.BlocklyCompiler.prototype.createIf = function (block) {
  var conditionalCommandSets = [];

  var elseCount = block.elseCount_ || 0;
  var i = 0;
Severity: Major
Found in game/static/game/js/blocklyCompiler.js and 1 other location - About 1 day to fix
game/static/game/js/blocklyCompiler.js on lines 597..631

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 327.

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

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

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

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

Refactorings

Further Reading

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

ocargo.BlocklyCompiler.prototype.mobileCreateIf = function (block) {
  var conditionalCommandSets = [];

  var elseCount = block.elseCount_ || 0;
  var i = 0;
Severity: Major
Found in game/static/game/js/blocklyCompiler.js and 1 other location - About 1 day to fix
game/static/game/js/blocklyCompiler.js on lines 284..318

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 327.

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

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

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

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

Refactorings

Further Reading

File dataTables.fixedColumns.js has 739 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*! FixedColumns 3.0.4
 * ©2010-2014 SpryMedia Ltd - datatables.net/license
 */

/**
Severity: Major
Found in game/static/game/js/dataTables.fixedColumns.js - About 1 day to fix

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

                if (rgb[5]) {
                    values = rgb[5][split](commaSpaces);
                    red = toFloat(values[0]);
                    values[0].slice(-1) == "%" && (red *= 2.55);
                    green = toFloat(values[1]);
    Severity: Major
    Found in game/static/game/js/raphael.js and 1 other location - About 1 day to fix
    game/static/game/js/raphael.js on lines 1324..1336

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

    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 (rgb[6]) {
                    values = rgb[6][split](commaSpaces);
                    red = toFloat(values[0]);
                    values[0].slice(-1) == "%" && (red *= 2.55);
                    green = toFloat(values[1]);
    Severity: Major
    Found in game/static/game/js/raphael.js and 1 other location - About 1 day to fix
    game/static/game/js/raphael.js on lines 1311..1323

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

    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

    File foundation.joyride.js has 732 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    ;(function ($, window, document, undefined) {
      'use strict';
    
      var Modernizr = Modernizr || false;
    
    
    Severity: Major
    Found in game/static/game/js/foundation/foundation/foundation.joyride.js - About 1 day to fix

      File widget-scroller.js has 701 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /*! Widget: scroller - updated 5/17/2015 (v2.22.0) *//*
       Copyright (C) 2011 T. Connell & Associates, Inc.
      
       Dual-licensed under the MIT and GPL licenses
      
      
      Severity: Major
      Found in game/static/game/js/widget-scroller.js - About 1 day to fix

        Consider simplifying this complex logical expression.
        Open

                if (params.opacity != null || 
                    params["stroke-width"] != null ||
                    params.fill != null ||
                    params.src != null ||
                    params.stroke != null ||
        Severity: Critical
        Found in game/static/game/js/raphael.js - About 1 day to fix

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

                S(this.scope).off('.offcanvas')
                  .on('click.fndtn.offcanvas', '.left-off-canvas-toggle', function (e) {
                    self.click_toggle_class(e, move_class + right_postfix);
                    if (self.settings.open_method !== 'overlap') {
                      S('.left-submenu').removeClass(move_class + right_postfix);
          game/static/game/js/foundation/foundation/foundation.offcanvas.js on lines 37..83

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

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

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

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

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

          Refactorings

          Further Reading

          Function generate_decor has a Cognitive Complexity of 68 (exceeds 5 allowed). Consider refactoring.
          Open

          def generate_decor(path, num_tiles):
              DECOR_DATA = decor_data()
              DECOR_SUM = decor_sum()
          
              def find_node_by_coordinate(x, y, dec, nodes):
          Severity: Minor
          Found in game/random_road.py - About 1 day 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 Orbit has 257 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            var Orbit = function (el, settings) {
              // Don't reinitialize plugin
              if (el.hasClass(settings.slides_container_class)) {
                return this;
              }
          Severity: Major
          Found in game/static/game/js/foundation/foundation/foundation.orbit.js - About 1 day to fix

            Function setFillAndStroke has 253 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                setFillAndStroke = function (o, params) {
                    var node = o.node,
                        attrs = o.attrs,
                        vis = node.style.visibility;
                    node.style.visibility = "hidden";
            Severity: Major
            Found in game/static/game/js/raphael.js - About 1 day to fix

              Function add_and_reorder_levels has 252 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              def add_and_reorder_levels(apps, schema_editor):
              
                  Level = apps.get_model("game", "Level")
                  Character = apps.get_model("game", "Character")
                  Theme = apps.get_model("game", "Theme")
              Severity: Major
              Found in game/migrations/0001_squashed_0025_levels_ordering_pt1.py - About 1 day to fix

                File blocklyCustomBlocks.js has 560 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                "use strict";
                
                var ocargo = ocargo || {};
                var Blockly = Blockly || {};
                
                
                Severity: Major
                Found in game/static/game/js/blocklyCustomBlocks.js - About 1 day to fix

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

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

                    Function setFillAndStroke has 212 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        setFillAndStroke = function (o, params) {
                            // o.paper.canvas.style.display = "none";
                            o.attrs = o.attrs || {};
                            var node = o.node,
                                a = o.attrs,
                    Severity: Major
                    Found in game/static/game/js/raphael.js - About 1 day to fix

                      Function student_row has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
                      Open

                      def student_row(levels_sorted, student, best_attempts):
                          threshold = 0.5
                      
                          num_all = num_finished = num_attempted = num_started = 0
                          total_score = 0
                      Severity: Minor
                      Found in game/views/scoreboard.py - About 1 day to fix

                      Cognitive Complexity

                      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                      A method's cognitive complexity is based on a few simple rules:

                      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                      • Code is considered more complex for each "break in the linear flow of the code"
                      • Code is considered more complex when "flow breaking structures are nested"

                      Further reading

                      Function add_levels has 203 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      def add_levels(apps, schema_editor):
                      
                          Level = apps.get_model("game", "Level")
                          Theme = apps.get_model("game", "Theme")
                          Character = apps.get_model("game", "Character")
                      Severity: Major
                      Found in game/migrations/0001_squashed_0025_levels_ordering_pt1.py - About 1 day to fix
                        Severity
                        Category
                        Status
                        Source
                        Language