Showing 835 of 1,558 total issues
Function DOTToGraph
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
function DOTToGraph (data) {
// parse the DOT file
var dotData = parseDOT(data);
var graphData = {
nodes: [],
Function selectiveNotDeepExtend
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
exports.selectiveNotDeepExtend = function (propsToExclude, a, b, allowDeletion = false) {
// TODO: add support for Arrays to deepExtend
// NOTE: array properties have an else-below; apparently, there is a problem here.
if (Array.isArray(b)) {
throw new TypeError('Arrays are not supported by deepExtend');
- 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 _updateValueRange
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
Network.prototype._updateValueRange = function (obj) {
var id;
// determine the range of the objects
var valueMin = 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 _formBarnesHutTree
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
_formBarnesHutTree(nodes, nodeIndices) {
let node;
let nodeCount = nodeIndices.length;
let minX = nodes[nodeIndices[0]].x;
- 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 fit
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
fit(options = {nodes:[]}, initialZoom = false) {
let range;
let zoomLevel;
if (options.nodes === undefined || options.nodes.length === 0) {
options.nodes = this.body.nodeIndices;
- 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 setColor
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
setColor(color, setInitial = true) {
if (color === 'none') {
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 getItemRange
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
Timeline.prototype.getItemRange = function () {
// get a rough approximation for the range based on the items start and end dates
var range = this.getDataRange();
var min = range.min !== null ? range.min.valueOf() : null;
var max = range.max !== null ? range.max.valueOf() : null;
Function _onEvent
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
DataView.prototype._onEvent = function (event, params, senderId) {
var i, len, id, item;
var ids = params && params.items;
var addedIds = [],
updatedIds = [],
Function parseColor
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.parseColor = function (color) {
var c;
if (exports.isString(color) === true) {
if (exports.isValidRGB(color) === true) {
var rgb = color.substr(4).substr(0, color.length - 5).split(',').map(function (value) { return parseInt(value) });
Function mergeOptions
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.mergeOptions = function (mergeTarget, options, option, globalOptions = {}) {
// Local helpers
var isPresent = function(obj) {
return obj !== null && obj !== undefined;
}
Function layoutNetwork
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
layoutNetwork() {
if (this.options.hierarchical.enabled !== true && this.options.improvedLayout === true) {
let indices = this.body.nodeIndices;
// first check if we should Kamada Kawai to layout. The threshold is if less than half of the visible
Function solve
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
solve() {
var edgeLength, edge;
var dx, dy, fx, fy, springForce, distance;
var edges = this.body.edges;
var factor = 0.5;
Consider simplifying this complex logical expression. Open
if (this.touchParams.itemProps) {
event.stopPropagation();
var me = this;
var snap = this.options.snap || null;
Consider simplifying this complex logical expression. Open
if ((((this.edgeType instanceof BezierEdgeDynamic) &&
(smooth.enabled === true) &&
(smooth.type === 'dynamic'))) ||
(((this.edgeType instanceof CubicBezierEdge) &&
(smooth.enabled === true) &&
Function _checkShowPopup
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
_checkShowPopup(pointer) {
let x = this.canvas._XconvertDOMtoCanvas(pointer.x);
let y = this.canvas._YconvertDOMtoCanvas(pointer.y);
let pointerObj = {
left: x,
Function initializeData
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
DataGroup.prototype.initializeData = function(graph3d, rawData, style) {
if (rawData === undefined) return;
if (Array.isArray(rawData)) {
rawData = new DataSet(rawData);
Function setOptions
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
GraphGroup.prototype.setOptions = function (options) {
if (options !== undefined) {
var fields = ['sampling', 'style', 'sort', 'yAxisOrientation', 'barChart', 'zIndex','excludeFromStacking', 'excludeFromLegend'];
util.selectiveDeepExtend(fields, this.options, options);
- 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 Canvas.js
has 274 lines of code (exceeds 250 allowed). Consider refactoring. Open
let Hammer = require('../../module/hammer');
let hammerUtil = require('../../hammerUtil');
let util = require('../../util');
Function focus
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
Timeline.prototype.focus = function(id, options) {
if (!this.itemsData || id == undefined) return;
var ids = Array.isArray(id) ? id : [id];
Function DataAxis
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
function DataAxis(body, options, svg, linegraphOptions) {
this.id = util.randomUUID();
this.body = body;
this.defaultOptions = {