Showing 136 of 282 total issues

Function setActive has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    setActive(which: string): void {
        const $current = $('.game-items').find('li.active').length ? $('.game-items li.active') : $('.game-items li:first');
        let $el;
        this.templateHelper.removeClass('active', $current);
        if (which === 'next') {
Severity: Minor
Found in src/modules/games/games.module.ts - About 55 mins to fix

Cognitive Complexity

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

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

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

Further reading

Function scoreBlocks has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

      function scoreBlocks(possibles, blocks, x, y, filled, width, height) {
Severity: Major
Found in src/assets/js/games/blockrain/blockrain.jquery.js - About 50 mins to fix

    Function drawBlock has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

            drawBlock: function(x, y, blockType, blockVariation, blockIndex, blockRotation, falling) {
    Severity: Major
    Found in src/assets/js/games/blockrain/blockrain.jquery.js - About 50 mins to fix

      Function v has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

                      function v(t, n, i, r, a, s, u) {
      Severity: Major
      Found in src/assets/js/games/tower/main.js - About 50 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                                    if (n.dataFilter == v) return t;
        Severity: Major
        Found in src/assets/js/games/tower/main.js - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                        if (shiftIndex) { i = shiftIndex; }
          Severity: Major
          Found in src/_helpers/template7.js - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                        for (j = i + 1; j < helperParts.length; j += 1) {
                          hashContent += " " + (helperParts[j]);
                          if (helperParts[j].indexOf(openingQuote) >= 0) {
                            shiftIndex = j;
                            break;
            Severity: Major
            Found in src/_helpers/template7.js - About 45 mins to fix

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

              export function computeLineStartsMap(text: string): number[] {
                  const result: number[] = [0];
                  let pos = 0;
                  while (pos < text.length) {
                      const char = text.charCodeAt(pos++);
              Severity: Minor
              Found in src/utils/line-mappings.ts - About 45 mins to fix

              Cognitive Complexity

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

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

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

              Further reading

              Avoid deeply nested control flow statements.
              Open

                                if (y + blocks[i] < 0) {
                                  gameOver = true;
                                }
              Severity: Major
              Found in src/assets/js/games/blockrain/blockrain.jquery.js - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                              if (stringBlocks[j].indexOf(("{{#" + helperName)) >= 0) {
                                helperContent += stringBlocks[j];
                                if (foundElse) { elseContent += stringBlocks[j]; }
                                toSkip += 1;
                              } else if (stringBlocks[j].indexOf(("{{/" + helperName)) >= 0) {
                Severity: Major
                Found in src/_helpers/template7.js - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                if (stringBlocks[j].indexOf('{{/') >= 0) {
                                  depth -= 1;
                                }
                  Severity: Major
                  Found in src/_helpers/template7.js - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                                        if (n) return p(n, "parsererror", k, y, b)
                    Severity: Major
                    Found in src/assets/js/games/tower/main.js - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                    if (helperParts[j].indexOf(openingQuote) >= 0) {
                                      shiftIndex = j;
                                      slices.push(part);
                                      break;
                                    }
                      Severity: Major
                      Found in src/_helpers/template7.js - About 45 mins to fix

                        Function add has 6 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                                add: function(x, y, blockType, blockVariation, blockIndex, blockOrientation) {
                        Severity: Minor
                        Found in src/assets/js/games/blockrain/blockrain.jquery.js - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                        if (stringBlocks[j].indexOf('{{#') >= 0) {
                                          depth += 1;
                                        }
                          Severity: Major
                          Found in src/_helpers/template7.js - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                            if( game._checkCollisions(x, y + 1, blocks, true) ) {
                                              // collision
                                              score = scoreBlocks(possibles, blocks, x, y, filled, width, height);
                                              if (score > best_score_for_shape) {
                                                best_score_for_shape = score;
                            Severity: Major
                            Found in src/assets/js/games/blockrain/blockrain.jquery.js - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                          if (shiftIndex) { i = shiftIndex; }
                              Severity: Major
                              Found in src/_helpers/template7.js - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                            if (isPartial) {
                                              helperName = '_partial';
                                              if (helperContext[0]) {
                                                if (helperContext[0].indexOf('[') === 0) { helperContext[0] = helperContext[0].replace(/[[\]]/g, ''); }
                                                else { helperContext[0] = "\"" + (helperContext[0].replace(/"|'/g, '')) + "\""; }
                                Severity: Major
                                Found in src/_helpers/template7.js - About 45 mins to fix

                                  Function func has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                  Open

                                        var func = function(filled, checkCollisions, width, height, mode, _one_shape) {
                                  Severity: Minor
                                  Found in src/assets/js/games/blockrain/blockrain.jquery.js - About 45 mins to fix

                                    Avoid deeply nested control flow statements.
                                    Open

                                                  if (helperName === 'raw') {
                                                    blocks.push({
                                                      type: 'plain',
                                                      content: helperContent,
                                                    });
                                    Severity: Major
                                    Found in src/_helpers/template7.js - About 45 mins to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language