Showing 52 of 88 total issues
Avoid deeply nested control flow statements. Open
if (rootFolder === null) {
rootFolder = currentFolder;
if (this[ rootFolder ] !== undefined ) {
lastFolder = this[ rootFolder ];
}
- Create a ticketCreate a ticket
Function exports
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
module.exports = function defineModelFields(Klass, Proto, modelName, modelType, debug) {
- Create a ticketCreate a ticket
Function exports
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
module.exports = function emitAfterEvent(eventName, modelDataOrFindOptions, queryOptions, model, callback) {
- Create a ticketCreate a ticket
Function runValidatorForField
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
runValidatorForField: function(fieldName, value, validators, validatorName, callback) {
- Create a ticketCreate a ticket
Function extend
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
extend: function() {
var Reg = new RegExp('.*\\(([^\\)]+)\\:.*\\:.*\\)', 'ig')
, stack = new Error().stack.split('\n')
, extendingArgs = [].slice.call(arguments)
, Static = (extendingArgs.length === 2) ? 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 getAction
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
getAction: 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 deleteAction
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
deleteAction: 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 requirePrimaryKeys
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function requirePrimaryKeys(findOptions, callback) {
if (/^[0-9a-fA-F]{24}$/.test(findOptions) || !isNaN(findOptions)) {
if (this.primaryKeys.length === 1) {
var findOptionsOverride = { where: {} };
findOptionsOverride.where[this.primaryKey] = 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 toJSON
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function toJSON() {
var json = {}
, helpers = utils.model.helpers;
try {
- 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 includeModel
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
includeModel: function(findOptions, model, as, includes) {
var include;
if (!findOptions.include) {
findOptions.include = [];
- 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 runValidatorForField
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
runValidatorForField: function(fieldName, value, validators, validatorName, callback) {
var args = [value]
, isFunc = typeof validators[validatorName] === 'function'
, isValid;
- 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 destroy
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
destroy: function(queryOptions) {
queryOptions = (typeof queryOptions !== 'object') ? {where:{id: queryOptions}} : queryOptions;
if (!queryOptions.where) {
queryOptions = {where: queryOptions};
}
- 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"