Showing 52 of 88 total issues
Function addResource
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
addResource: function(pathToInspect, file, callback) {
if ((file.match(/.+\.js$/g) !== null || file.match(/.+\.es6$/g) !== null) && this.Class.excludedFiles.indexOf(file) === -1) {
var folders = pathToInspect.split(path.sep)
, name = file.replace('.js', '').replace('.es6', '')
, currentFolder = 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 aliasAssociationForQuery
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
function aliasAssociationForQuery(data, remove, fieldName, callback) {
var associations = this.Class ? this.Class.entity.associations : this.entity.associations
, hasAssociation = associations ? associations[fieldName] : false
, isArray = data[fieldName] instanceof Array;
- 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 defineField
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function defineField(Proto, Klass, fieldName) {
var prop = Proto[fieldName]
, columnName = !!Klass.underscored ? inflect.underscore(fieldName) : fieldName;
if (!!prop.columnName && fieldName !== prop.columnName) {
- 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
File Service.js
has 285 lines of code (exceeds 250 allowed). Consider refactoring. Open
var injector = require('injector')
, exceptions = require('exceptions')
, Classes = require('classes')
, underscore = require('underscore')
, Class = Classes.Class
- Create a ticketCreate a ticket
Function aliasFieldsForQuery
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function aliasFieldsForQuery(fields, callback) {
if (Object.keys(fields).length > 0) {
if (debug.enabled) {
debug(util.format('aliasFieldsForQuery(%s)', utils.model.helpers.debugInspect(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 addResource
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
addResource: function(pathToInspect, file, callback) {
if ((file.match(/.+\.js$/g) !== null || file.match(/.+\.es6$/g) !== null) && this.Class.excludedFiles.indexOf(file) === -1) {
var folders = pathToInspect.split(path.sep)
, name = file.replace('.js', '').replace('.es6', '')
, currentFolder = null
- Create a ticketCreate a ticket
Function extend
has 49 lines of code (exceeds 25 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();
- Create a ticketCreate a ticket
Function aliasAssociationsForOutput
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function aliasAssociationsForOutput(fields, callback) {
if (this.associations || this.Class.associations) {
if (debug.enabled) {
debug(util.format('aliasAssociationsForOutput(%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 update
has a Cognitive Complexity of 14 (exceeds 5 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};
- 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 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
loadModules: function(env, modules) {
var deps = this.getEnabledModuleNames()
, loader = this;
modules = modules || this.modules;
- Create a ticketCreate a ticket
Function defineField
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function defineField(Proto, Klass, fieldName) {
var prop = Proto[fieldName]
, columnName = !!Klass.underscored ? inflect.underscore(fieldName) : fieldName;
if (!!prop.columnName && fieldName !== prop.columnName) {
- Create a ticketCreate a ticket
Function extend
has 40 lines of code (exceeds 25 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() : {}
- Create a ticketCreate a ticket
Function loadResourcesForPath
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
function loadResourcesForPath(folderPath) {
var exists = fs.existsSync(folderPath)
, listing = !!exists ? fs.readdirSync(folderPath) : [];
if (!!exists && listing.length) {
- Create a ticketCreate a ticket
Function saveModelInstance
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function saveModelInstance(values, queryOptions) {
var utilName = this.Class.type.toLowerCase() + 'Utils'
, helpers = utils.model.helpers
, driverUtil = utils[utilName]
, omitFields;
- Create a ticketCreate a ticket
Function findOrCreateModel
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function findOrCreateModel(findOptions, queryOptions) {
var helpers = utils.model.helpers
, cxtTransaction = false;
findOptions = helpers.findOptions.normalize(findOptions);
- Create a ticketCreate a ticket
Function isNewModel
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function isNewModel(data, callback) {
if (this.debug.enabled) {
this.debug(util.format('isNewModel(%s)', utils.model.helpers.debugInspect(data)));
}
- 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 findOrCreateModel
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function findOrCreateModel(findOptions, queryOptions) {
var helpers = utils.model.helpers
, cxtTransaction = false;
findOptions = helpers.findOptions.normalize(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 findAll
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
findAll: 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 findOrCreate
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
findOrCreate: function(idOrFindOptions, queryOptions) {
idOrFindOptions = (typeof idOrFindOptions !== 'object') ? {where:{id: idOrFindOptions}} : idOrFindOptions;
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 modelDynamicFindersGenerator
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function modelDynamicFindersGenerator(model) {
var finders = ['findBy', 'findAllBy', 'countBy']
, criteria = [
'is', 'in', 'like', 'notLike', 'iLike', 'notILike', 'startsWith', 'endsWith',
'not', 'notEqual', 'between', 'notBetween', 'greaterThan', 'lessThan', 'greaterThanOrEqualTo', 'lessThanOrEqualTo',
- Create a ticketCreate a ticket