Strilanc/Quirk

View on GitHub

Showing 241 of 478 total issues

Function timesQubitOperation has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    timesQubitOperation(operation2x2, qubitIndex, controlMask, desiredValueMask) {
        Util.need((controlMask & (1 << qubitIndex)) === 0, "Matrix.timesQubitOperation: self-controlled");
        Util.need(operation2x2._width === 2 && operation2x2._height === 2, "Matrix.timesQubitOperation: not 2x2");

        let {_width: w, _height: h, _buffer: old} = this;
Severity: Minor
Found in src/math/Matrix.js - About 35 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 interleavePainter has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

let interleavePainter = reverse => args => {
    if (args.positionInCircuit !== undefined) {
        GatePainting.PERMUTATION_DRAWER(args);
        return;
    }
Severity: Minor
Found in src/gates/InterleaveBitsGates.js - About 35 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 too many return statements within this function.
Open

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

    Avoid too many return statements within this function.
    Open

            return equate_Indexables(subject, other);
    Severity: Major
    Found in src/base/Equate.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

              return equate_Sets(subject, other);
      Severity: Major
      Found in src/base/Equate.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

            return equate_Objects(subject, other);
        Severity: Major
        Found in src/base/Equate.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

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

            Avoid too many return statements within this function.
            Open

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

              Avoid too many return statements within this function.
              Open

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

                Avoid too many return statements within this function.
                Open

                    return value.toString();
                Severity: Major
                Found in src/base/Format.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                          return this._toString_bothValues(format);
                  Severity: Major
                  Found in src/math/Complex.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

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

                      Avoid too many return statements within this function.
                      Open

                              return value.toFixed(digits);
                      Severity: Major
                      Found in src/base/Format.js - About 30 mins to fix

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

                            static _paintGateTooltip_matrix(painter, gate, matrix, pad, dispSize, w, pushRect, nextY) {
                                if (matrix === undefined) {
                                    return;
                                }
                        
                        
                        Severity: Minor
                        Found in src/draw/WidgetPainter.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

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

                            _shiftAndSpliceColumn(rowShift, gatesOfCol, insertCol, isInsert) {
                                // Move gates upward.
                                while (rowShift < 0 && gatesOfCol[0] === undefined) {
                                    gatesOfCol.shift();
                                    gatesOfCol.push(undefined);
                        Severity: Minor
                        Found in src/ui/DisplayedCircuit.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

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

                            _updateMeasureMask_gateStep(state, row, disabledReasons) {
                                if (disabledReasons[row] !== undefined) {
                                    return;
                                }
                        
                        
                        Severity: Minor
                        Found in src/circuit/GateColumn.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

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

                            previewDrop(hand) {
                                return hand.heldRow !== undefined ? this._previewDropMovedRow(hand) :
                                    hand.heldColumn !== undefined ? this._previewDropMovedGateColumn(hand) :
                                    hand.heldGate !== undefined ? this._previewDropMovedGate(hand) :
                                    this._previewResizedGate(hand);
                        Severity: Minor
                        Found in src/ui/DisplayedCircuit.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

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

                        let GATE_CIRCUIT_DRAWER = args => {
                            let circuit = args.gate.knownCircuit;
                            if (circuit === undefined || args.gate.symbol !== '') {
                                if (args.gate.stableDuration() === Infinity) {
                                    GatePainting.DEFAULT_DRAWER(args);
                        Severity: Minor
                        Found in src/ui/DisplayedCircuit.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

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

                        function describe_Object(value, limit) {
                            let entries = [];
                            for (let k in value) {
                                if (!value.hasOwnProperty(k)) {
                                    continue;
                        Severity: Minor
                        Found in src/base/Describe.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

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

                            _findHeightWiseOverlapsInCol(col) {
                                let pushedGates = new Set();
                                let h = 0;
                                for (let row = 0; row < this.numWires; row++) {
                                    h -= 1;
                        Severity: Minor
                        Found in src/circuit/CircuitDefinition.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