Function stackSubgroupsWithInnerStack
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
exports.stackSubgroupsWithInnerStack = function (subgroupItems, margin, subgroups) {
var doSubStack = false;
// Run subgroups in their order (if any)
var subgroupOrder = [];
- 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 substack
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
exports.substack = function (items, margin, subgroup) {
for (var i = 0; i < items.length; i++) {
items[i].top = null;
}
- 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 stack
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
exports.stack = function(items, margin, force) {
if (force) {
// reset top position of all items
for (var i = 0; i < items.length; i++) {
items[i].top = null;
- 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 stackSubgroups
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
exports.stackSubgroups = function(items, margin, subgroups) {
for (var subgroup in subgroups) {
if (subgroups.hasOwnProperty(subgroup)) {
- 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 nostack
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
exports.nostack = function(items, margin, subgroups, stackSubgroups) {
for (var i = 0; i < items.length; i++) {
if (items[i].data.subgroup == undefined) {
items[i].top = margin.item.vertical;
} else if (items[i].data.subgroup !== undefined && stackSubgroups) {
- 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 stackSubgroupsWithInnerStack
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.stackSubgroupsWithInnerStack = function (subgroupItems, margin, subgroups) {
var doSubStack = false;
// Run subgroups in their order (if any)
var subgroupOrder = [];
Function substack
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.substack = function (items, margin, subgroup) {
for (var i = 0; i < items.length; i++) {
items[i].top = null;
}
Consider simplifying this complex logical expression. Open
if (rtl) {
return ((a.right - margin.horizontal + EPSILON) < (b.right + b.width) &&
(a.right + a.width + margin.horizontal - EPSILON) > b.right &&
(a.top - margin.vertical + EPSILON) < (b.top + b.height) &&
(a.top + a.height + margin.vertical - EPSILON) > b.top);
Avoid deeply nested control flow statements. Open
if (other.top !== null && other !== item && other.stack && exports.collision(item, other, margin.item, other.options.rtl)) {
collidingItem = other;
break;
}
Avoid deeply nested control flow statements. Open
if (other.top !== null && other !== item /*&& other.stack*/ && exports.collision(item, other, margin.item, other.options.rtl)) {
collidingItem = other;
break;
}
Avoid deeply nested control flow statements. Open
if (subgroups[subgroup].visible == true && subgroups[subgroup].index < subgroups[items[i].data.subgroup].index) {
newTop += subgroups[subgroup].height;
subgroups[items[i].data.subgroup].top = newTop;
}
Avoid deeply nested control flow statements. Open
if (subgroups[subgroup].stack) {
items[i].baseTop = items[i].top;
}
Avoid deeply nested control flow statements. Open
if (subgroups[otherSubgroup].top !== null && otherSubgroup !== subgroup && subgroups[subgroup].index > subgroups[otherSubgroup].index && exports.collisionByTimes(subgroups[subgroup], subgroups[otherSubgroup])) {
collidingItem = subgroups[otherSubgroup];
break;
}
TODO found Open
// TODO: optimize checking for overlap. when there is a gap without items,
- Exclude checks
TODO found Open
// TODO: optimize checking for overlap. when there is a gap without items,
- Exclude checks
TODO found Open
// TODO: optimize checking for overlap. when there is a gap without items,
- Exclude checks