Showing 241 of 478 total issues
Function AMPLITUDE_DRAWER_FROM_CUSTOM_STATS
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
const AMPLITUDE_DRAWER_FROM_CUSTOM_STATS = GatePainting.makeDisplayDrawer(args => {
let n = args.gate.height;
let {quality, ket, phaseLockIndex, incoherentKet} = args.customStats || {
ket: (n === 1 ? Matrix.zero(2, 1) : Matrix.zero(1 << Math.floor(n / 2), 1 << Math.ceil(n / 2))).times(NaN),
quality: 1,
Function paintMatrix
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
static paintMatrix(painter,
matrix,
drawArea,
amplitudeCircleFillColor,
amplitudeCircleStrokeColor,
- 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 redrawControlWires
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
function redrawControlWires(args) {
if (args.positionInCircuit === undefined || args.isHighlighted) {
return;
}
let painter = args.painter;
- 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
File Controls.js
has 258 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.
Painter
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
class Painter {
/**
* @param {!HTMLCanvasElement} canvas
* @param {!RestartableRng=} rng
*/
Function _drawWires
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
_drawWires(painter, showLabels, hand) {
let drawnWireCount = Math.min(this.circuitDefinition.numWires, (this._extraWireStartIndex || Infinity) + 1);
// Initial value labels
if (showLabels) {
Function paintGateSymbol
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
GatePainting.paintGateSymbol = (args, symbolOverride=undefined, allowExponent=true) => {
let painter = args.painter;
let rect = args.rect.paddedBy(-2);
if (symbolOverride === undefined) {
symbolOverride = args.gate.symbol;
Function initUrlCircuitSync
has 48 lines of code (exceeds 25 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();
Function paintBlochSphereRotation
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
static paintBlochSphereRotation(painter,
operation,
drawArea,
backgroundColor = Config.DISPLAY_GATE_BACK_COLOR,
fillColor = Config.DISPLAY_GATE_FORE_COLOR) {
Function getUnmetContextKeys
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
getUnmetContextKeys() {
let result = new Set();
for (let c = 0; c < this.columns.length; c++) {
let col = this.columns[c];
let ctx = this.colCustomContextFromGates(c, 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 _computeGateSlotCoverMap
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
_computeGateSlotCoverMap() {
let result = new Map();
for (let col = 0; col < this.columns.length; col++) {
for (let row = 0; row < this.numWires; row++) {
let gate = this.columns[col].gates[row];
- 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 _drawWires
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
_drawWires(painter, showLabels, hand) {
let drawnWireCount = Math.min(this.circuitDefinition.numWires, (this._extraWireStartIndex || Infinity) + 1);
// Initial value labels
if (showLabels) {
- 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 _drawHintLabels
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
_drawHintLabels(painter, stats) {
let gridRect = this._rectForSuperpositionDisplay();
// Amplitude hint.
painter.print(
Function constructor
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor(numWires,
columns,
outerRowOffset=0,
outerContext=new Map(),
customGateSet=new CustomGateSet(),
Function amplitudeDisplayStatTextures
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
function amplitudeDisplayStatTextures(stateKet, controls, controlsTexture, rangeOffset, rangeLength) {
let incoherentKet = probabilityStatTexture(stateKet, controlsTexture, rangeOffset, rangeLength);
let trader = new WglTextureTrader(stateKet);
trader.dontDeallocCurrentTexture();
Function _fromCircuitAtTime_noFallback
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
static _fromCircuitAtTime_noFallback(circuitDefinition, time) {
circuitDefinition = circuitDefinition.withMinimumWireCount();
const numWires = circuitDefinition.numWires;
// Advance state while collecting stats into textures.
Function _copy
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
_copy() {
let g = new Gate();
g.symbol = this.symbol;
g.name = this.name;
g.blurb = this.blurb;
Function processOutputs
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
function processOutputs(span, pixelGroups, circuitDefinition) {
let [ketPixels, qualityPixels, rawIncoherentKetPixels] = pixelGroups;
let denormalizedQuality = qualityPixels[0];
let n = 1 << span;
let w = n === 2 ? 2 : 1 << Math.floor(Math.round(Math.log2(n))/2);
Function colControls
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
colControls(col) {
if (col < 0 || col >= this.columns.length) {
return Controls.NONE;
}
let column = this.columns[col];
- 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 paintDensityMatrix
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
static paintDensityMatrix(painter,
matrix,
drawArea,
focusPoints = [],
backgroundColor = Config.DISPLAY_GATE_BACK_COLOR,
- 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"