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.
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.
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.
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.
*/
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.
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.
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.
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
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.
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,
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) {
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.
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;
- Read upRead up
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
Function paintDeferredValueTooltip
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
static paintDeferredValueTooltip(
painter,
x,
y,
labelText,
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
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.
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();
- Read upRead up
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 "";
}
- Read upRead up
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,