Showing 47 of 72 total issues
Function hydrateAfterEagerLoad
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports.afterLoad = function hydrateAfterEagerLoad(findOptions, model) {
if (model !== null && findOptions.include && findOptions.include.length && model.entity.options.include) {
var models = this.getDefinedModels();
Object.keys(model.entity.options.includeMap).forEach(function(modelName) {
Function findTargetModelsBeforeCreateSourceModel
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function findTargetModelsBeforeCreateSourceModel(as, association, targetModel, values, queryOptions, callback) {
var valuesAs = values[as] ? (values[as] instanceof Array ? underscore.clone(values[as]) : [underscore.clone(values[as])]) : false
, isSelfRef = this === targetModel
, sourcePk = this.primaryKey
, targetPK = targetModel.primaryKey
- 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 updateTargetModelBeforeSourceModel
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function updateTargetModelBeforeSourceModel(as, association, targetModel, values, queryOptions, callback) {
var valueAs = values[as]
, isSelfRef = this === targetModel
, entity = valueAs !== undefined && valueAs !== null ? valueAs.entity : undefined
, sourcePk = this.primaryKey
- 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 exports
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
module.exports = function createTargetModelBeforeSourceModel(as, association, targetModel, instance, values, queryOptions, callback) {
Function exports
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
module.exports = function aliasTargetModelAfterCreateSourceModel(as, association, targetModel, instance, values, queryOptions, callback) {
Function exports
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
module.exports = function createTargetModelsAfterSourceModel(as, association, targetModel, instance, values, queryOptions, callback) {
Function exports
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
module.exports = function aliasTargetModelAfterUpdateSourceModel(as, association, targetModel, instance, values, queryOptions, callback) {
Function exports
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
module.exports = function findTargetModelBeforeCreateSourceModel(as, association, targetModel, values, queryOptions, callback) {
Avoid deeply nested control flow statements. Open
if (!(model.entity[as][i] instanceof CsModel)) {
model.entity[as][i] = new CsModel(model.entity[as][i]);
hydrateAfterEagerLoad.apply(CsModel, [model.entity[as][i].entity.options, model.entity[as][i]]);
}
Function getFieldType
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
getFieldType: function(Static, options, name) {
var field;
switch(options.type.type || options.type) {
- 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 exports
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
module.exports = function findTargetModelsBeforeCreateSourceModel(as, association, targetModel, values, queryOptions, callback) {
Function defineField
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
defineField: function(Static, fields, name) {
var fieldDefinition = {}
, columnName = name
, options = Static.fields[name];
- 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 exports
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
module.exports = function findTargetModelsBeforeUpdateSourceModel(as, association, targetModel, values, queryOptions, callback) {
Function exports
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
module.exports = function findTargetModelBeforeUpdateSourceModel(as, association, targetModel, values, queryOptions, callback) {
Function findTargetModelBeforeUpdateSourceModel
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function findTargetModelBeforeUpdateSourceModel(as, association, targetModel, values, queryOptions, callback) {
var valueAs = values[as]
, entity = valueAs !== undefined && valueAs !== null ? valueAs.entity : undefined
, isTargetPk = valueAs ? !isNaN(valueAs) : false
, targetPK = targetModel.primaryKey
- 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 exports
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
module.exports = function updateTargetModelBeforeSourceModel(as, association, targetModel, values, queryOptions, callback) {
Function setupOptions
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
setupOptions: function(parseDebug, sequelizeConf, Static) {
parseDebug('Setup options...');
if (Static.dbName !== false ) {
parseDebug('Setting dbName=' + Static.dbName + ' (sequelize tableName option)...');
- 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
if (!isSelfRef && !!doubleLinked && !!valuesAs && valuesAs.length &&
(typeof valuesAs[0] !== 'object' || valuesAs[0][targetPK] === undefined)) {
targetModel
.findAll(nestedQuery, queryOptions)
Function exports
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
module.exports = function createRelationAccessor(accessor, alias, TargetModel, values, options) {
Function defineAssociationAccessors
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function defineAssociationAccessors(sourceModel, assocType, targetModel, alias, association) {