Function _redraw
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
_redraw(hidden = false) {
if (this.allowRedraw === true) {
this.body.emitter.emit("initRedraw");
this.redrawRequested = false;
- 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 _redraw
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
_redraw(hidden = false) {
if (this.allowRedraw === true) {
this.body.emitter.emit("initRedraw");
this.redrawRequested = false;
Function bindEventListeners
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
bindEventListeners() {
this.body.emitter.on("dragStart", () => { this.dragging = true; });
this.body.emitter.on("dragEnd", () => { this.dragging = false; });
this.body.emitter.on("_resizeNodes", () => { this._resizeNodes(); });
this.body.emitter.on("_redraw", () => {
Function _drawNodes
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
_drawNodes(ctx, alwaysShow = false) {
let nodes = this.body.nodes;
let nodeIndices = this.body.nodeIndices;
let node;
let selected = [];
Function _drawNodes
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
_drawNodes(ctx, alwaysShow = false) {
let nodes = this.body.nodes;
let nodeIndices = this.body.nodeIndices;
let node;
let selected = [];
- 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 _determineBrowserMethod
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
_determineBrowserMethod() {
if (typeof window !== 'undefined') {
let browserType = navigator.userAgent.toLowerCase();
this.requiresTimeout = false;
if (browserType.indexOf('msie 9.0') != -1) { // IE 9
- 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"