File EdgesHandler.js
has 331 lines of code (exceeds 250 allowed). Consider refactoring. Open
var util = require("../../util");
var DataSet = require('../../DataSet');
var DataView = require('../../DataView');
var Edge = require("./components/Edge").default;
Function constructor
has 98 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor(body, images, groups) {
this.body = body;
this.images = images;
this.groups = groups;
Function setOptions
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
setOptions(options) {
if (options !== undefined) {
// use the parser from the Edge class to fill in all shorthand notations
Edge.parseOptions(this.options, options, true, this.defaultOptions, true);
- 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 bindEventListeners
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
bindEventListeners() {
// this allows external modules to force all dynamic curves to turn static.
this.body.emitter.on("_forceDisableDynamicCurves", (type, emit = true) => {
if (type === 'dynamic') {
type = 'continuous';
Function setData
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
setData(edges, doNotEmit = false) {
var oldEdgesData = this.body.data.edges;
if (edges instanceof DataSet || edges instanceof DataView) {
this.body.data.edges = edges;
Avoid deeply nested control flow statements. Open
if (smoothOptions.enabled === true && smoothOptions.type === 'dynamic') {
if (type === undefined) {
edge.setOptions({smooth: false});
}
else {
Function setData
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
setData(edges, doNotEmit = false) {
var oldEdgesData = this.body.data.edges;
if (edges instanceof DataSet || edges instanceof DataView) {
this.body.data.edges = edges;
- 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 reconnectEdges
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
reconnectEdges() {
var id;
var nodes = this.body.nodes;
var edges = this.body.edges;
- 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 update
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
update(ids) {
var edges = this.body.edges;
var edgesData = this.body.data.edges;
var dataChanged = false;
for (var i = 0; i < ids.length; i++) {
- 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
TODO found Open
// TODO: Verify and examine the consequences of this. It might still trigger when
- Exclude checks
TODO found Open
// TODO: is this null or undefined or false?
- Exclude checks
TODO found Open
// TODO: is this null or undefined or false?
- Exclude checks