CleverStack/node-seed

View on GitHub

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};
    }
Severity: Minor
Found in lib/classes/Service.js - About 1 hr to fix

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();
Severity: Minor
Found in lib/classes/Service.js - About 1 hr to fix

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) {
Severity: Minor
Found in lib/classes/Service.js - About 1 hr to fix

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  = {};

Severity: Minor
Found in lib/classes/Validator.js - About 1 hr to fix

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) {
Severity: Minor
Found in lib/classes/Service.js - About 1 hr to fix

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};
    }
Severity: Minor
Found in lib/classes/Service.js - About 1 hr to fix

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};
Severity: Minor
Found in lib/classes/Service.js - About 1 hr to fix

Function toJSON has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function toJSON() {
  var json    = {}
    , helpers = utils.model.helpers;

  try {
Severity: Minor
Found in lib/utils/model/instance/toJSON.js - About 1 hr to fix

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
Severity: Minor
Found in lib/classes/Module.js - About 1 hr to fix

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;
Severity: Minor
Found in lib/utils/model/find.js - About 1 hr to fix

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))));
  }

Severity: Minor
Found in lib/utils/model/helpers/alias/fields/forOutput.js - About 55 mins to fix

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;
    }
    
Severity: Minor
Found in lib/classes/Controller.js - About 55 mins to fix

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;

Severity: Minor
Found in lib/classes/Controller.js - About 55 mins to fix

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) {
Severity: Minor
Found in lib/utils/model/behaviours/softDeleteable.js - About 55 mins to fix

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;
Severity: Minor
Found in lib/classes/ModuleLoader.js - About 55 mins to fix

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;

Severity: Minor
Found in lib/classes/Controller.js - About 55 mins to fix

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 ) {
Severity: Minor
Found in lib/utils/model/helpers/nestedOperations.js - About 45 mins to fix

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);
                  }

Severity: Major
Found in lib/utils/magicModule.js - About 45 mins to fix

Function exports has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

module.exports = function linkDriver(moduleLdr, Klass, modelType, moduleName, modelName, debuggr) {
Severity: Minor
Found in lib/utils/model/helpers/driver.js - About 45 mins to fix

Function exports has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

module.exports = function afterExtendModel(utils, defineProp, model, Klass, modelName, debug) {
Severity: Minor
Found in lib/utils/model/helpers/afterExtend.js - About 45 mins to fix
Severity
Category
Status
Source
Language