Showing 47 of 72 total issues
Function exports
has 165 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function(grunt) {
var defaultConfig = require(path.join(__dirname, 'config', 'default.json'))
, configFile = null
, config = {}
, dbTarget = grunt.option('module') || null
Function defineAssociations
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
function defineAssociations(models) {
/*jshint validthis: true */
var cleverOrm = this
, modelNames = Object.keys(models);
- 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 associateModels
has 86 lines of code (exceeds 25 allowed). Consider refactoring. Open
function associateModels(callback) {
async.forEachSeries(
Object.keys(seedData),
function forEachSeedDataModel(modelName, cb) {
var ModelType = models[modelName.replace('Model', '')]
Function createTargetModelsAfterSourceModel
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function createTargetModelsAfterSourceModel(as, association, targetModel, instance, values, queryOptions, callback) {
var valuesAs = values[as]
, isSelfRef = this === targetModel
, entity = valuesAs !== undefined && valuesAs !== null ? valuesAs.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 forEachSeedDataModel
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
function forEachSeedDataModel(modelName, cb) {
var ModelType = models[modelName.replace('Model', '')]
, Models = seedData[modelName];
if (!ModelType || !Models || ModelType.type !== 'ORM') {
Function associateModel
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
function associateModel(data, modelCb) {
if (data.associations !== undefined) {
var assocLength = Object.keys(data.associations).length
, called = 0
, model = _.findWhere(assocMap[modelName], { id: data.id });
Function eagerLoad
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
module.exports.load = function eagerLoad(findOptions) {
if (!!findOptions.include && findOptions.include instanceof Array) {
for(var i = 0; i < findOptions.include.length; i++) {
if (this.debug.enabled) {
this.debug('eagerLoad(' + inspect(underscore.omit(findOptions.include[i], 'model', 'include')) + ', ' + inspect(findOptions.include[i].model.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
File module.js
has 262 lines of code (exceeds 250 allowed). Consider refactoring. Open
var injector = require('injector')
, Sequelize = require('sequelize')
, debug = require('debug')
, utils = require('utils')
, Module = injector.getInstance('Module')
Function getFieldType
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
getFieldType: function(Static, options, name) {
var field;
switch(options.type.type || options.type) {
Function exports
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function(grunt) {
var defaultConfig = require(path.join(__dirname, 'config', 'default.json'))
, configFile = null
, config = {}
, dbTarget = grunt.option('module') || 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 createTargetModelsAfterSourceModel
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function createTargetModelsAfterSourceModel(as, association, targetModel, instance, values, queryOptions, callback) {
var valuesAs = values[as]
, isSelfRef = this === targetModel
, entity = valuesAs !== undefined && valuesAs !== null ? valuesAs.entity : undefined
, sourcePk = this.primaryKey
Function createModels
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
function createModels(callback) {
async.forEachSeries(
Object.keys(seedData),
function forEachSeedDataModel(modelName, cb) {
var ModelType = models[modelName.replace('Model', '')]
Function defineAssociationAccessors
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
function defineAssociationAccessors(sourceModel, assocType, targetModel, alias, association) {
var accessors = accessorTypes[assocType]
, singular = inflect.singularize(alias)
, plural = inflect.pluralize(alias);
Function defineNestedOperations
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
function defineNestedOperations(sourceModel, assocType, targetModel, alias, association) {
/*jshint validthis: true */
var events = this[assocType]
, eventNames;
- 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 defineField
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
defineField: function(Static, fields, name) {
var fieldDefinition = {}
, columnName = name
, options = Static.fields[name];
Function defineAssociations
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
function defineAssociations(models) {
/*jshint validthis: true */
var cleverOrm = this
, modelNames = Object.keys(models);
Function setupOptions
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
setupOptions: function(parseDebug, sequelizeConf, Static) {
parseDebug('Setup options...');
if (Static.dbName !== false ) {
parseDebug('Setting dbName=' + Static.dbName + ' (sequelize tableName option)...');
Function forEachSeedDataModel
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
function forEachSeedDataModel(modelName, cb) {
var ModelType = models[modelName.replace('Model', '')]
, Models = seedData[modelName];
if (!ModelType || !Models || ModelType.type !== 'ORM') {
Function eachSourceModel
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
modelNames.forEach(function eachSourceModel(sourceModelName) {
var associationTypes = Object.keys(models[sourceModelName]);
associationTypes.forEach(function eachAssociationType(assocType) {
var targets = models[sourceModelName][assocType];
Function findTargetModelsBeforeUpdateSourceModel
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function findTargetModelsBeforeUpdateSourceModel(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"