Showing 503 of 787 total issues
Avoid deeply nested control flow statements. Open
if (i < length - 1) {
parentHash = itemHash;
}
Avoid deeply nested control flow statements. Open
if (includeMap[prevKey].association.isSingleAssociation) {
if ($parent) {
$parent[$lastKeyPrefix] = resultMap[itemHash] = values;
}
} else {
Function _createForeignAndOtherKeys
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
_createForeignAndOtherKeys() {
/*
* Default/generated foreign/other keys
*/
if (_.isObject(this.options.foreignKey)) {
- 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 (_.isObject(dep)) {
deps.push(`${dep.schema}.${dep.tableName}`);
} else {
deps.push(dep);
}
Function create
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
async create(sourceInstance, values, options) {
values = values || {};
options = options || {};
if (this.scope) {
- 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 getValidatorKey
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
getValidatorKey(useTypeAsNS: boolean, NSSeparator: string): string {
const useTANS = useTypeAsNS === undefined || !!useTypeAsNS;
const NSSep = NSSeparator === undefined ? '.' : NSSeparator;
const type = this.origin;
- 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
Consider simplifying this complex logical expression. Open
} else if (
(arguments.length === 1 && typeof database === 'string') ||
(arguments.length === 2 && typeof username === 'object')
) {
// new Sequelize(URI, { ... options })
Consider simplifying this complex logical expression. Open
if (value instanceof Utils.SequelizeMethod || options.bindParam === false) {
values.push(
`${this.quoteIdentifier(key)}=${this.escape(
value,
(modelAttributeMap && modelAttributeMap[key]) || undefined,
Consider simplifying this complex logical expression. Open
if (topLevelInfo.subQuery && !include.subQuery && include.parent.subQuery && !parentIsTop) {
// If we are minifying aliases and our JOIN target has been minified, we need to use the alias instead of the original column name
const joinSource =
this._getAliasForField(tableSource, `${tableSource}.${attrSource}`, topLevelInfo.options) ||
`${tableSource}.${attrSource}`;
Consider simplifying this complex logical expression. Open
if (value instanceof Utils.SequelizeMethod || options.bindParam === false) {
values.push(
this.escape(value, (modelAttributeMap && modelAttributeMap[key]) || undefined, { context: 'INSERT' })
);
} else {
Consider simplifying this complex logical expression. Open
if (Object.prototype.hasOwnProperty.call(definition, 'unique') && definition.unique) {
let idxName;
if (typeof definition.unique === 'object' && Object.prototype.hasOwnProperty.call(definition.unique, 'name')) {
idxName = definition.unique.name;
} else if (typeof definition.unique === 'string') {
Consider simplifying this complex logical expression. Open
if (!tableName.schema && (options.schema || (!!model && model._schema))) {
tableName = this.queryGenerator.addSchema({
tableName,
_schema: (!!model && model._schema) || options.schema
});
Consider simplifying this complex logical expression. Open
if (value instanceof Utils.SequelizeMethod || options.bindParam === false) {
values.push(
`${this.quoteIdentifier(key)}=${this.escape(
value,
(modelAttributeMap && modelAttributeMap[key]) || undefined,
Consider simplifying this complex logical expression. Open
if (
originalValue &&
!!value &&
(value === originalValue ||
(value instanceof Date && originalValue instanceof Date && value.getTime() === originalValue.getTime()))
Function addForeignKeyConstraints
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function addForeignKeyConstraints(newAttribute, source, target, options, key) {
Function changeColumnQuery
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
changeColumnQuery(tableName, attributes) {
const attrString = [],
constraintString = [];
let commentString = '';
- 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 dataTypeMapping
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
dataTypeMapping(tableName, attr, dataType) {
if (dataType.includes('PRIMARY KEY')) {
dataType = dataType.replace('PRIMARY KEY', '');
}
- 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 mapValueFieldNames
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function mapValueFieldNames(dataValues, fields, Model) {
const values = {};
for (const attr of fields) {
if (dataValues[attr] !== undefined && !Model._virtualAttributes.has(attr)) {
- 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 upsert
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
async upsert(tableName, insertValues, updateValues, where, options) {
const model = options.model;
const wheres = [];
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
Function deleteQuery
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
deleteQuery(tableName, where, options = {}, model) {
const table = this.quoteTable(tableName);
let whereClause = this.getWhereConditions(where, null, model, options);
const limit = options.limit ? ` LIMIT ${this.escape(options.limit)}` : '';
let primaryKeys = '';
- 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"