File Node.js
has 366 lines of code (exceeds 250 allowed). Consider refactoring. Open
var util = require('../../../util');
var Label = require('./shared/Label').default;
var ComponentUtil = require('./shared/ComponentUtil').default;
var Box = require('./nodes/shapes/Box').default;
Node
has 27 functions (exceeds 20 allowed). Consider refactoring. Open
class Node {
/**
*
* @param {object} options An object containing options for the node. All
* options are optional, except for the id.
Function getFormattingValues
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
getFormattingValues() {
let values = {
color: this.options.color.background,
borderWidth: this.options.borderWidth,
borderColor: this.options.color.border,
- 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 updateShape
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
updateShape(currentShape) {
if (currentShape === this.options.shape && this.shape) {
this.shape.setOptions(this.options, this.imageObj, this.imageObjAlt);
}
else {
Function parseOptions
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
static parseOptions(parentOptions, newOptions, allowDeletion = false, globalOptions = {}, groupList) {
var fields = [
'color',
'fixed',
- 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 setOptions
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
setOptions(options) {
let currentShape = this.options.shape;
if (!options) {
return; // Note that the return value will be 'undefined'! This is OK.
}
- 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 getFormattingValues
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
getFormattingValues() {
let values = {
color: this.options.color.background,
borderWidth: this.options.borderWidth,
borderColor: this.options.color.border,
Function parseOptions
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
static parseOptions(parentOptions, newOptions, allowDeletion = false, globalOptions = {}, groupList) {
var fields = [
'color',
'fixed',
Function _load_images
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
_load_images() {
// Don't bother loading for nodes without images
if (this.options.shape !== 'circularImage' && this.options.shape !== 'image') {
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 setOptions
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
setOptions(options) {
let currentShape = this.options.shape;
if (!options) {
return; // Note that the return value will be 'undefined'! This is OK.
}
Avoid deeply nested control flow statements. Open
if ((values.shadowColor !== this.options.shadow.color) ||
(values.shadowSize !== this.options.shadow.size) ||
(values.shadowX !== this.options.shadow.x) ||
(values.shadowY !== this.options.shadow.y)) {
values.shadow = true;
TODO found Open
// TODO: It might not be a good idea either to merge the rest of the options, investigate this.
- Exclude checks
TODO found Open
* TODO: The imageObj members should be moved to CircularImageBase.
- Exclude checks