Showing 503 of 787 total issues
Avoid deeply nested control flow statements. Open
if (!item) {
item = previousModel.getAssociationForAlias(model, model.name);
}
Avoid deeply nested control flow statements. Open
if (newIdx === -1) {
continue;
}
Function selectFromTableFragment
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
selectFromTableFragment(options, model, attributes, tables, mainTableAs) {
this._throwOnEmptyAttributes(attributes, {
modelName: model && model.name,
as: mainTableAs
});
- 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
Avoid deeply nested control flow statements. Open
if (Array.isArray(options.order[i])) {
options.order[i][0] = alias;
} else {
options.order[i] = alias;
}
Avoid deeply nested control flow statements. Open
if (itemHash === topHash) {
if (!resultMap[itemHash]) {
resultMap[itemHash] = values;
} else {
topExists = true;
Avoid deeply nested control flow statements. Open
if (newIdx > rightestPosition) {
rightestPosition = newIdx;
}
Function _whereGroupBind
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
_whereGroupBind(key, value, options) {
const binding = key === Op.or ? this.OperatorMap[Op.or] : this.OperatorMap[Op.and];
const outerBinding = key === Op.not ? 'NOT ' : '';
if (Array.isArray(value)) {
- 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
Avoid deeply nested control flow statements. Open
if (dataType.includes(' REFERENCES')) {
dataTypeString += dataType.substr(dataType.indexOf(' REFERENCES'));
}
Avoid deeply nested control flow statements. Open
if (
include.association.through.model.rawAttributes[attr]._autoGenerated ||
attr === include.association.foreignKey ||
attr === include.association.otherKey ||
typeof instance[include.association.through.model.name][attr] === undefined
Avoid deeply nested control flow statements. Open
for (const foreignKeyReference of foreignKeyReferences) {
const constraintName = foreignKeyReference.constraintName;
if (
!!constraintName &&
foreignKeyReference.tableCatalog === database &&
Function _loadDialectModule
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
_loadDialectModule(moduleName) {
try {
if (this.sequelize.config.dialectModulePath) {
return require(this.sequelize.config.dialectModulePath);
}
- 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
Avoid deeply nested control flow statements. Open
if (!parentHash) {
parentHash = topHash;
}
Avoid deeply nested control flow statements. Open
if (!all.includes(types[j])) {
all.unshift(types[j]);
i++;
}
Avoid deeply nested control flow statements. Open
for (const attr of Object.keys(include.association.through.model.rawAttributes)) {
if (
include.association.through.model.rawAttributes[attr]._autoGenerated ||
attr === include.association.foreignKey ||
attr === include.association.otherKey ||
Function constructor
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
constructor(values = {}, options = {}) {
options = {
isNewRecord: true,
_schema: this.constructor._schema,
_schemaDelimiter: this.constructor._schemaDelimiter,
- 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
Avoid deeply nested control flow statements. Open
if (!(include.association instanceof BelongsToMany)) {
associationInstance.set(
include.association.foreignKey,
instance.get(include.association.sourceKey || instance.constructor.primaryKeyAttribute, {
raw: true
Avoid deeply nested control flow statements. Open
if (dataType.includes('NOT NULL')) {
dataTypeString = dataType.replace(' PRIMARY KEY', '');
} else {
dataTypeString = dataType.replace('PRIMARY KEY', 'NOT NULL');
}
Function _addDefaultAttributes
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
static _addDefaultAttributes() {
const tail = {};
let head = {};
// Add id if no primary key was manually added to definition
- 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
Avoid deeply nested control flow statements. Open
if (values[k] === undefined) {
continue;
}
Avoid deeply nested control flow statements. Open
if (!_.isEqual(previousNestedValue, value)) {
Dottie.set(this.dataValues, key, value);
this.changed(key.split('.')[0], true);
}