Showing 241 of 478 total issues
Function makeInputGate
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
let makeInputGate = (key, reverse) => Gate.buildFamily(1, 16, (span, builder) => builder.
setSerializedId((reverse ? 'rev' : '') + `input${key}${span}`).
setSymbol((reverse ? 'rev ' : '') + `input ${key}`).
setTitle(`Input Gate [${key}]` + (reverse ? ' [reversed]' : '')).
setBlurb(`Temporarily uses some qubits as input ${key}${reverse ? ', in big-endian order' : ''}.`).
- 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 computeAndPaintOp
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
function computeAndPaintOp(canvas, opGetter, button) {
button.disabled = true;
let painter = new Painter(canvas);
painter.clear();
let d = Math.min((canvas.width - 5)/2, canvas.height);
Function constructor
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor() {
/** @type {!string} The text shown when drawing the gate. */
this.symbol = '';
/** @type {!string} The identifier text used for the gate when serializing/parsing JSON. */
this.serializedId = '';
Function _drawColumnSurvivalRate
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
_drawColumnSurvivalRate(painter, gateColumn, col, stats) {
if (gateColumn.indexOfNonUnitaryGate() === undefined) {
return;
}
Function constructor
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor(fragmentShaderSource, uniformParameterNames) {
let ctx = initializedWglContext();
let precision = ctx.maximumShaderFloatPrecision;
let vertexShader = `
precision ${precision} float;
Function PERMUTATION_DRAWER
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
GatePainting.PERMUTATION_DRAWER = args => {
if (args.positionInCircuit === undefined) {
GatePainting.DEFAULT_DRAWER(args);
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 _uncached_customContextFromGates
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
_uncached_customContextFromGates(outerRowOffset) {
let results = [];
let stickyCtx = new Map();
for (let col = 0; col < this.columns.length; col++) {
let ctx = new Map(stickyCtx);
- 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 withHeightOverlapsFixed
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
withHeightOverlapsFixed(recurseLimit=5) {
let newCols = [];
for (let col = 0; col < this.columns.length; col++) {
let pushedGateIndexes = this._findHeightWiseOverlapsInCol(col);
if (pushedGateIndexes.size === 0) {
- 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 isScaler
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
isScaler(epsilon=0) {
if (this._width !== this._height) {
return false;
}
let sr = this._buffer[0];
- 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 printParagraph
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
printParagraph(text,
area,
proportionalCenterOfAlignment = new Point(0, 0),
fontColor = Config.DEFAULT_TEXT_COLOR,
maxFontSize = Config.DEFAULT_FONT_SIZE,
Function initMenu
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
function initMenu(revision, obsIsAnyOverlayShowing) {
// Show/hide menu overlay.
(() => {
const menuButton = /** @type {!HTMLButtonElement} */ document.getElementById('menu-button');
const closeMenuButton = /** @type {!HTMLButtonElement} */ document.getElementById('close-menu-button');
Function advanceStateWithCircuit
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
function advanceStateWithCircuit(ctx, circuitDefinition, collectStats) {
// Prep stats collection.
let colQubitDensities = [];
let customStats = [];
let colNorms = [];
Function _drawHint_useControls
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
_drawHint_useControls(painter) {
let visibilityFactor = this._hintVisibility();
if (visibilityFactor <= 0) {
return;
}
Function drawClick
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
function drawClick(args, axis) {
// Draw tilted "*click*" text.
let clicked = args.customStats;
if (!clicked) {
return;
Function constructor
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor(canvas=undefined, context=undefined) {
if (canvas === undefined) {
canvas = /** @type {!HTMLCanvasElement} */ document.createElement('canvas');
context = undefined;
}
Function _drawHintLabels
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
_drawHintLabels(painter, stats) {
let gridRect = this._rectForSuperpositionDisplay();
// Amplitude hint.
painter.print(
- 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 toJson_Gate
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
let toJson_Gate = (gate, context=new CustomGateSet()) => {
let found = Gates.findKnownGateById(gate.serializedId, context);
if (found === gate) {
return gate.serializedId;
}
- 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 toJson_CircuitDefinition
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
let toJson_CircuitDefinition = (v, context) => {
let result = {
cols: v.trimEmptyColumnsAtEndIgnoringGateWidths().columns.
map(e => toJson_GateColumn(e, context || v.customGateSet)).
map(c => seq(c).skipTailWhile(e => e === 1).toArray())
- 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 applyToStateVectorAtQubitWithControls
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
applyToStateVectorAtQubitWithControls(stateVector, qubitIndex, controls) {
let chunkSize = this._width*2;
let chunkBuf = stateVector._buffer.slice(0, chunkSize);
let strideLength = 2 << qubitIndex;
let strideChunkSize = strideLength*chunkSize >> 1;
- 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 onErrorHandler
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
function onErrorHandler(errorMsg, url, lineNumber, columnNumber, errorObj) {
try {
let location = simplifySrcUrls(
((errorObj instanceof Object)? errorObj.stack : undefined) ||
(url + ":" + lineNumber + ":" + columnNumber));