CircuitVerse/CircuitVerse

View on GitHub

Showing 330 of 15,369 total issues

Function solve has a Cognitive Complexity of 148 (exceeds 5 allowed). Consider refactoring.
Open

BooleanMinimize.prototype.solve = function () {
    function dec_to_binary_string(n) {
        var str = n.toString(2);

        while (str.length != this.numVars) {
Severity: Minor
Found in simulator/src/quinMcCluskey.js - About 3 days 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 listeners.js has 1068 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* eslint-disable no-shadow */
/* eslint-disable no-negated-condition */
/* eslint-disable no-alert */
/* eslint-disable new-cap */
/* eslint-disable no-undef */
Severity: Major
Found in simulator/src/listeners.js - About 2 days to fix

    Function update has a Cognitive Complexity of 120 (exceeds 5 allowed). Consider refactoring.
    Open

        update() {
            if (embed) return;
    
            if (this == simulationArea.hover) simulationArea.hover = undefined;
            this.hover = this.isHover();
    Severity: Minor
    Found in simulator/src/node.js - About 2 days 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 VerilogClasses.js has 940 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import AndGate from './modules/AndGate';
    import NandGate from './modules/NandGate';
    import Multiplexer from './modules/Multiplexer';
    import XorGate from './modules/XorGate';
    import XnorGate from './modules/XnorGate';
    Severity: Major
    Found in simulator/src/VerilogClasses.js - About 2 days to fix

      File canvas2svg.js has 807 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /*!!
       *  Canvas 2 Svg v1.0.19
       *  A low level canvas to SVG converter. Uses a mock canvas context to build an SVG document.
       *
       *  Licensed under the MIT license:
      Severity: Major
      Found in simulator/vendor/canvas2svg.js - About 1 day to fix

        File canvas2svg.js has 800 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        /*!!
         *  Canvas 2 Svg v1.0.19
         *  A low level canvas to SVG converter. Uses a mock canvas context to build an SVG document.
         *
         *  Licensed under the MIT license:
        Severity: Major
        Found in simulator/src/canvas2svg.js - About 1 day to fix

          Function startListeners has 443 lines of code (exceeds 100 allowed). Consider refactoring.
          Open

          export default function startListeners() {
              $('#deleteSelected').on('click', () => {
                  deleteSelected();
              });
          
          
          Severity: Major
          Found in simulator/src/listeners.js - About 1 day to fix

            Function add has a Cognitive Complexity of 86 (exceeds 5 allowed). Consider refactoring.
            Open

              add: function (shortcut_combination, callback, opt) {
                //Provide a set of default options
                var default_options = {
                  type: "keydown",
                  propagate: false,
            Severity: Minor
            Found in simulator/src/hotkey_binder/model/shortcuts.plugin.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

            File data.js has 735 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            // Function to create new circuit
            // Function creates button in tab, creates scope and switches to this circuit
            function newCircuit(name, id) {
                name = name || prompt("Enter circuit name:");
                name = stripTags(name);
            Severity: Major
            Found in public/js/data.js - About 1 day to fix

              File testbench.js has 631 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              /**
               * This file contains all functions related the the testbench
               * Contains the the testbench engine and UI modules
               */
              
              
              Severity: Major
              Found in simulator/src/testbench.js - About 1 day to fix

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

                    render() {
                        var { width, height } = this;
                        this.canvas.height = height;
                        this.canvas.width = width;
                        var endTime = this.getCurrentTime();
                Severity: Minor
                Found in simulator/src/plotArea.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 resolve has a Cognitive Complexity of 66 (exceeds 5 allowed). Consider refactoring.
                Open

                    resolve() {
                        if (this.type == NODE_OUTPUT) {
                            // Since output node forces its value on its neighbours, remove its contentions.
                            // An existing contention will now trickle to the other output node that was causing
                            // the contention.
                Severity: Minor
                Found in simulator/src/node.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 customResolve has a Cognitive Complexity of 65 (exceeds 5 allowed). Consider refactoring.
                Open

                function customResolve(clockInp, dInp, qOutput, en, masterState, 
                    slaveState, prevClockState, clock_polarity, enable_polarity, numIterations) {
                        
                    for(var i = 0; i < numIterations; i++) {
                        if(clock_polarity[i] != undefined) {
                Severity: Minor
                Found in simulator/src/sequential/verilogRAM.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

                File subcircuit.js has 586 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                /* eslint-disable import/no-cycle */
                import Scope, { scopeList, switchCircuit } from "./circuit";
                import CircuitElement from "./circuitElement";
                import simulationArea from "./simulationArea";
                import { scheduleBackup, checkIfBackup } from "./data/backupCircuit";
                Severity: Major
                Found in simulator/src/subcircuit.js - About 1 day to fix

                  File circuitElement.js has 585 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  /* eslint-disable no-multi-assign */
                  /* eslint-disable no-bitwise */
                  /* eslint-disable */
                  import { scheduleUpdate } from './engine';
                  import simulationArea from './simulationArea';
                  Severity: Major
                  Found in simulator/src/circuitElement.js - About 1 day to fix

                    File node.js has 581 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    /* eslint-disable import/no-cycle */
                    import { drawCircle, drawLine, arc } from './canvasApi';
                    import simulationArea from './simulationArea';
                    import { distance, showError } from './utils';
                    import {
                    Severity: Major
                    Found in simulator/src/node.js - About 1 day to fix

                      Function showProperties has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring.
                      Open

                      export function showProperties(obj) {
                          if (obj === prevPropertyObjGet()) return;
                          hideProperties();
                          prevPropertyObjSet(obj);
                          if(layoutModeGet()){
                      Severity: Minor
                      Found in simulator/src/ux.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

                      File ux.js has 528 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      /* eslint-disable import/no-cycle */
                      /* eslint-disable guard-for-in */
                      /* eslint-disable no-restricted-syntax */
                      /* eslint-disable no-restricted-syntax */
                      /* eslint-disable guard-for-in */
                      Severity: Major
                      Found in simulator/src/ux.js - About 1 day to fix

                        Function findDimensions has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring.
                        Open

                        export function findDimensions(scope = globalScope) {
                            var totalObjects = 0;
                            simulationArea.minWidth = undefined;
                            simulationArea.maxWidth = undefined;
                            simulationArea.minHeight = undefined;
                        Severity: Minor
                        Found in simulator/src/canvasApi.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 drawCombinationalAnalysis has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
                        Open

                        function drawCombinationalAnalysis(combinationalData, inputList, outputListNames, scope = globalScope) {
                            findDimensions(scope);
                            var inputCount = inputList.length;
                            var maxTerms = 0;
                            for (var i = 0; i < combinationalData.length; i++) { maxTerms = Math.max(maxTerms, combinationalData[i].length); }
                        Severity: Minor
                        Found in simulator/src/combinationalAnalysis.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

                        Severity
                        Category
                        Status
                        Source
                        Language