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.
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 fromJson_Gate
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
let fromJson_Gate = (json, context=new CustomGateSet()) => {
let props = fromJson_Gate_props(json);
try {
if (props.matrix !== undefined) {
Function fromJson_Gate_Matrix
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
let fromJson_Gate_Matrix = props => {
let mat = _parseGateMatrix(props.matrix);
// Special case the mystery gate.
if (props.id === MysteryGateSymbol) {
- 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 _fromJson_InitialState
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function _fromJson_InitialState(json) {
let {init} = json;
if (init === undefined) {
return 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 fromJson_Gate
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
let fromJson_Gate = (json, context=new CustomGateSet()) => {
let props = fromJson_Gate_props(json);
try {
if (props.matrix !== undefined) {
- 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 fromJson_Gate_props
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
let fromJson_Gate_props = json => {
let id = _getGateId(json);
let matrix = json["matrix"];
let circuit = json["circuit"];
let param = json["arg"];
- 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"