Strilanc/Quirk

View on GitHub

Showing 241 of 478 total issues

File Painter.js has 317 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * Copyright 2017 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
Severity: Minor
Found in src/draw/Painter.js - About 3 hrs to fix

    File Detector.js has 316 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /**
     * Copyright 2017 Google Inc.
     *
     * Licensed under the Apache License, Version 2.0 (the "License");
     * you may not use this file except in compliance with the License.
    Severity: Minor
    Found in src/gates/Detector.js - About 3 hrs to fix

      File GateColumn.js has 315 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /**
       * Copyright 2017 Google Inc.
       *
       * Licensed under the Apache License, Version 2.0 (the "License");
       * you may not use this file except in compliance with the License.
      Severity: Minor
      Found in src/circuit/GateColumn.js - About 3 hrs to fix

        Complex has 29 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class Complex {
            /**
             * @param {!number} real The real part of the Complex number. The 'a' in a + bi.
             * @param {!number} imag The imaginary part of the Complex number. The 'b' in a + bi.
             */
        Severity: Minor
        Found in src/math/Complex.js - About 3 hrs to fix

          File DisplayedInspector.js has 305 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          /**
           * Copyright 2017 Google Inc.
           *
           * Licensed under the Apache License, Version 2.0 (the "License");
           * you may not use this file except in compliance with the License.
          Severity: Minor
          Found in src/ui/DisplayedInspector.js - About 3 hrs to fix

            File Serializer.js has 300 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            /**
             * Copyright 2017 Google Inc.
             *
             * Licensed under the Apache License, Version 2.0 (the "License");
             * you may not use this file except in compliance with the License.
            Severity: Minor
            Found in src/circuit/Serializer.js - About 3 hrs to fix

              File Complex.js has 299 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              /**
               * Copyright 2017 Google Inc.
               *
               * Licensed under the Apache License, Version 2.0 (the "License");
               * you may not use this file except in compliance with the License.
              Severity: Minor
              Found in src/math/Complex.js - About 3 hrs to fix

                GateColumn has 27 functions (exceeds 20 allowed). Consider refactoring.
                Open

                class GateColumn {
                    /**
                     * A column of gates in a circuit with many qubits.
                     *
                     * @param {!Array.<undefined|!Gate>} gates The list of gates to apply to each wire, with the i'th gate applying to
                Severity: Minor
                Found in src/circuit/GateColumn.js - About 3 hrs to fix

                  File menu.js has 296 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  /**
                   * Copyright 2017 Google Inc.
                   *
                   * Licensed under the Apache License, Version 2.0 (the "License");
                   * you may not use this file except in compliance with the License.
                  Severity: Minor
                  Found in src/ui/menu.js - About 3 hrs to fix

                    Function paintDensityMatrix has 76 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        static paintDensityMatrix(painter,
                                                  matrix,
                                                  drawArea,
                                                  focusPoints = [],
                                                  backgroundColor = Config.DISPLAY_GATE_BACK_COLOR,
                    Severity: Major
                    Found in src/draw/MathPainter.js - About 3 hrs to fix

                      Function parseFormula has 74 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function parseFormula(text, tokenMap) {
                          let tokens = _tokenize(text).map(e => _translate_token(e, tokenMap));
                      
                          // Cut off trailing operation, so parse fails less often as users are typing.
                          if (tokens.length > 0 && tokens[tokens.length - 1].priority !== undefined) {
                      Severity: Major
                      Found in src/math/FormulaParser.js - About 2 hrs to fix

                        File AmplitudeDisplay.js has 289 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        /**
                         * Copyright 2017 Google Inc.
                         *
                         * Licensed under the Apache License, Version 2.0 (the "License");
                         * you may not use this file except in compliance with the License.
                        Severity: Minor
                        Found in src/gates/AmplitudeDisplay.js - About 2 hrs to fix

                          Function _disabledReason_remixing has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                          Open

                              _disabledReason_remixing(row, inputMeasureMask) {
                                  // Measured qubits can't be re-superposed for implementation simplicity reasons.
                                  let g = this.gates[row];
                                  let mask = ((1 << g.height) - 1) << row;
                                  let maskMeasured = mask & inputMeasureMask;
                          Severity: Minor
                          Found in src/circuit/GateColumn.js - About 2 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

                          DisplayedInspector has 25 functions (exceeds 20 allowed). Consider refactoring.
                          Open

                          class DisplayedInspector {
                              /**
                               * @param {!Rect} drawArea
                               * @param {!DisplayedCircuit} circuitWidget
                               * @param {!DisplayedToolbox} displayedToolboxTop
                          Severity: Minor
                          Found in src/ui/DisplayedInspector.js - About 2 hrs to fix

                            Function paintDeferredValueTooltip has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                static paintDeferredValueTooltip(
                                        painter,
                                        x,
                                        y,
                                        labelText,
                            Severity: Major
                            Found in src/draw/MathPainter.js - About 2 hrs to fix

                              Util has 23 functions (exceeds 20 allowed). Consider refactoring.
                              Open

                              class Util {
                                  /**
                                   * Checks a precondition, throwing an exception containing the given message in the case of failure.
                                   * @param {!boolean|*} expression
                                   * @param {=string} message
                              Severity: Minor
                              Found in src/base/Util.js - About 2 hrs to fix

                                File Util.js has 269 lines of code (exceeds 250 allowed). Consider refactoring.
                                Open

                                /**
                                 * Copyright 2017 Google Inc.
                                 *
                                 * Licensed under the Apache License, Version 2.0 (the "License");
                                 * you may not use this file except in compliance with the License.
                                Severity: Minor
                                Found in src/base/Util.js - About 2 hrs to fix

                                  Function initUrlCircuitSync has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                  function initUrlCircuitSync(revision) {
                                      // Pull initial circuit out of URL '#x=y' arguments.
                                      const getHashParameters = () => {
                                          let hashText = document.location.hash.substr(1);
                                          let paramsMap = new Map();
                                  Severity: Minor
                                  Found in src/ui/url.js - About 2 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

                                  Function describeKet has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      static describeKet(bitCount, bitMask, factor, format) {
                                          factor = Complex.from(factor);
                                          if (factor.isEqualTo(0)) {
                                              return "";
                                          }
                                  Severity: Minor
                                  Found in src/draw/WidgetPainter.js - About 2 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

                                  Function paintMatrix has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      static paintMatrix(painter,
                                                         matrix,
                                                         drawArea,
                                                         amplitudeCircleFillColor,
                                                         amplitudeCircleStrokeColor,
                                  Severity: Major
                                  Found in src/draw/MathPainter.js - About 2 hrs to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language