mauriciosoares/core.js

View on GitHub

Showing 18 of 32 total issues

Function createCore has 265 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const createCore = function () {
    const core = {};

    core.paused = false;
    core.moduleInstances = new Map();
Severity: Major
Found in src/core.js - About 1 day to fix

    File saved_drawings.js has 515 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    export {
        abstractLines,
        snowMan,
        flower,
    };
    Severity: Major
    Found in examples/draw/settings/saved_drawings.js - About 1 day to fix

      File prebuilts.js has 511 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      export {blinker, glider, leightWeightSpaceShip};
      const leightWeightSpaceShip = [
          [
            0,
            1,
      Severity: Major
      Found in examples/gameOfLife/settings/prebuilts.js - About 1 day to fix

        Function createCore has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
        Open

        const createCore = function () {
            const core = {};
        
            core.paused = false;
            core.moduleInstances = new Map();
        Severity: Minor
        Found in src/core.js - About 3 hrs to fix

        Cognitive Complexity

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

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

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

        Further reading

        File core.js has 291 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        // @ts-check
        export { createCore, ALL, ERROR, prepareWorkerCode };
        export { startEventRecorder, stopEventRecorder } from "./eventRecorder.js";
        export { replayEvents } from "./eventPlayer.js";
        export { useDefaultLogging } from "./logging.js";
        Severity: Minor
        Found in src/core.js - About 3 hrs to fix

          Function startUiInput has 54 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const startUiInput = function (emitter, instance) {
              let paused = false;
              const pauseButton = document.getElementById(`pause`);
              const pauseAction = function () {
                  if (paused) {
          Severity: Major
          Found in examples/gameOfLife/input.js - About 2 hrs to fix

            Function listenForWorkerMessage has 47 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    listenForWorkerMessage(name, worker, resolve, earlyWrapper) {
                        worker.addEventListener(`message`, function (messageEvent)  {
                            const message = messageEvent.data;
                            if (!Object.prototype.hasOwnProperty.call(message, CORE_ACTION_KEY)) {
                                return;
            Severity: Minor
            Found in src/core.js - About 1 hr to fix

              Function startWorker has 38 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      startWorker(moduleUrl, name, data, workerReady) {
                          
                          const earlyWrapper = {
                              module: moduleUrl,
                              name,
              Severity: Minor
              Found in src/core.js - About 1 hr to fix

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

                        start(module, { 
                            name = Symbol(),
                            data = undefined,
                            worker = false,
                            workerReady = false,
                Severity: Minor
                Found in src/core.js - About 1 hr to fix

                  Function sumNeighbors has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  const sumNeighbors = function (cells, w, h, x, y) {
                  Severity: Minor
                  Found in examples/gameOfLife/gameOfLife.js - About 35 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                        return;
                    Severity: Major
                    Found in src/core.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                              return;
                      Severity: Major
                      Found in src/workerGlue.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                    return;
                        Severity: Major
                        Found in src/workerGlue.js - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                  return;
                          Severity: Major
                          Found in src/workerGlue.js - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                                return;
                            Severity: Major
                            Found in src/core.js - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                      return;
                              Severity: Major
                              Found in src/workerGlue.js - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                                    return;
                                Severity: Major
                                Found in src/core.js - About 30 mins to fix

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

                                  const nextGeneration = function (grid, neighborCounts) {
                                    grid.forEach(function(rowArray, yIndex) {
                                      rowArray.forEach(function(cellState, xIndex) {
                                        // const cellState = grid[yIndex][xIndex];
                                        const count = neighborCounts[yIndex][xIndex];
                                  Severity: Minor
                                  Found in examples/gameOfLife/gameOfLife.js - About 25 mins to fix

                                  Cognitive Complexity

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

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

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

                                  Further reading

                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language