Showing 52 of 88 total issues
Function find
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
find: function(idOrFindOptions, queryOptions) {
idOrFindOptions = (typeof idOrFindOptions !== 'object') ? {where:{id: idOrFindOptions}} : idOrFindOptions;
if (!idOrFindOptions.where) {
idOrFindOptions = {where: idOrFindOptions};
}
- Read upRead up
- Create a ticketCreate a ticket
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 extend
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
module.exports.extend = function() {
var extendingArgs = [].slice.call(arguments)
, serviceName = (typeof extendingArgs[ 0 ] === 'string') ? extendingArgs.shift() : false
, Klass = (extendingArgs.length === 2) ? extendingArgs.shift() : {}
, Proto = extendingArgs.shift();
- Read upRead up
- Create a ticketCreate a ticket
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 findAndUpdate
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
findAndUpdate: function(values, queryOptions) {
var service = this;
queryOptions = queryOptions || {};
if (!queryOptions.where) {
- Read upRead up
- Create a ticketCreate a ticket
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 validateEachField
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
validateEachField: function(Class, model, fieldName, callback) {
var attributes = Class.fields[ fieldName ]
, value = model[ fieldName ]
, validators = {};
- Read upRead up
- Create a ticketCreate a ticket
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 findAndUpdate
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
findAndUpdate: function(values, queryOptions) {
var service = this;
queryOptions = queryOptions || {};
if (!queryOptions.where) {
- Create a ticketCreate a ticket
Function find
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
find: function(idOrFindOptions, queryOptions) {
idOrFindOptions = (typeof idOrFindOptions !== 'object') ? {where:{id: idOrFindOptions}} : idOrFindOptions;
if (!idOrFindOptions.where) {
idOrFindOptions = {where: idOrFindOptions};
}
- Create a ticketCreate a ticket
Function update
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
update: function(values, queryOptions) {
values = (typeof values === 'object') ? values : {};
queryOptions = (typeof queryOptions !== 'object') ? {where:{id: queryOptions}} : queryOptions;
if (!queryOptions.where) {
queryOptions = {where: queryOptions};
- Create a ticketCreate a ticket
Function toJSON
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function toJSON() {
var json = {}
, helpers = utils.model.helpers;
try {
- Create a ticketCreate a ticket
Function addFolderToPath
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
addFolderToPath: function(injector, folder) {
var folderPath = path.join(this.path, folder)
, folders = folder.split('/')
, currentFolder = null
, rootFolder = null
- Read upRead up
- Create a ticketCreate a ticket
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 findModel
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function findModel(findOptions, queryOptions) {
var utilName = this.type.toLowerCase() + 'Utils'
, helpers = utils.model.helpers
, driverUtil = utils[utilName]
, softDeleteable = utils.model.behaviours.softDeleteable.criteria;
- Create a ticketCreate a ticket
Function aliasFieldsForOutput
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function aliasFieldsForOutput(fields, callback) {
if (debug.enabled && !fields.where) {
debug(util.format('aliasFieldsForOutput(%s)', utils.model.helpers.debugInspect(Object.keys(fields))));
}
- Read upRead up
- Create a ticketCreate a ticket
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 handleServiceMessage
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
handleServiceMessage: function(response) {
if (!!this.responseSent) {
return;
}
- Read upRead up
- Create a ticketCreate a ticket
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 putAction
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
putAction: function() {
var service = this.Class.service !== null ? this.Class.service : false
, model = service && service.model !== undefined ? service.model : false
, findOptions;
- Read upRead up
- Create a ticketCreate a ticket
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 softDeleteableCriteria
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
module.exports.criteria = function softDeleteableCriteria(findOptions, queryOptions, callback) {
var columnName = this.deletedAt
, where = findOptions.where;
if (!where) {
- Read upRead up
- Create a ticketCreate a ticket
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 loadModules
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
loadModules: function(env, modules) {
var deps = this.getEnabledModuleNames()
, loader = this;
modules = modules || this.modules;
- Read upRead up
- Create a ticketCreate a ticket
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 postAction
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
postAction: function() {
var service = this.Class.service !== null ? this.Class.service : false
, model = service && service.model !== undefined ? service.model : false
, findOptions;
- Read upRead up
- Create a ticketCreate a ticket
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 setupNestedOperations
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function setupNestedOperations(Klass, modelName, model, debug) {
injector.getInstance('moduleLoader').on('routesInitialized', function() {
debug( 'Parsing templated event handlers...' );
Object.keys( Klass ).forEach( function( propName ) {
if ( propName.indexOf( ' ' ) !== -1 || utils.model.helpers.eventNames.indexOf( propName ) !== -1 ) {
- Read upRead up
- Create a ticketCreate a ticket
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 (dottie.get(loaded, fullPath) === undefined) {
if (debug.enabled) {
debug('Loading %s into magic module from %s...', fullPath, actualPath);
}
- Create a ticketCreate a ticket
Function exports
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
module.exports = function linkDriver(moduleLdr, Klass, modelType, moduleName, modelName, debuggr) {
- Create a ticketCreate a ticket
Function exports
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
module.exports = function afterExtendModel(utils, defineProp, model, Klass, modelName, debug) {
- Create a ticketCreate a ticket