Showing 28 of 53 total issues
Function exports
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function( grunt ) {
var dbTarget = grunt.option( 'module' ) || null
, defaultConfig = require( path.join( __dirname, 'config', 'default.json' ) )
, configFile = null
, config = {};
- 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 (!(model.entity[as][i] instanceof CsModel)) {
model.entity[as][i] = new CsModel(model.entity[as][i]);
}
Function defineAssociationAccessors
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function defineAssociationAccessors(sourceModel, assocType, targetModel, alias, association) {
Function associateModels
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
associateModels: function(Klass, Proto, assocType, assocTo) {
var modelName = Klass.modelName
, models = require('models');
if (Klass.type.toLowerCase() === 'odm') {
- 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 hasOne
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function hasOne(mongoose, model, proto, assocTo) {
assocTo = assocTo instanceof Array ? underscore.clone(assocTo) : [assocTo, {}];
var targetModelName = assocTo.shift()
, associationOptions = assocTo.shift()
- 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 eagerLoad
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
module.exports.load = function eagerLoad(findOptions) {
var populate = []
, addToPopulate = function(modelInclude, index, array, parentInclude) {
var include = modelInclude.model.modelName || modelInclude.modelName;
- 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 preSetup
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
preSetup: function() {
var dbConfig = this.config.mongoose
, queryLogger = debug('cleverstack:queryLog');
if (!!dbConfig.debug || queryLogger.enabled) {
- 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 hydrateModel
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function hydrateModel(findOptions, model, callback) {
var ModelClass = this;
if (model !== null) {
model = new ModelClass(model);
- 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"