CleverStack/node-seed

View on GitHub

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 ];
            }
Severity: Major
Found in lib/classes/Module.js - About 45 mins to fix

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

module.exports = function defineModelFields(Klass, Proto, modelName, modelType, debug) {
Severity: Minor
Found in lib/utils/model/helpers/defineFields.js - About 35 mins to fix

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

module.exports  = function emitAfterEvent(eventName, modelDataOrFindOptions, queryOptions, model, callback) {
Severity: Minor
Found in lib/utils/model/helpers/events/afterEvent.js - About 35 mins to fix

Function runValidatorForField has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

  runValidatorForField: function(fieldName, value, validators, validatorName, callback) {
Severity: Minor
Found in lib/classes/Validator.js - About 35 mins to fix

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() : {}
Severity: Minor
Found in lib/classes/Module.js - About 35 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 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;

Severity: Minor
Found in lib/classes/Controller.js - About 35 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 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;

Severity: Minor
Found in lib/classes/Controller.js - About 35 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 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;
Severity: Minor
Found in lib/utils/model/helpers/criteria/requirePrimaryKeys.js - About 25 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 toJSON has a Cognitive Complexity of 6 (exceeds 5 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 25 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 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 = [];
Severity: Minor
Found in lib/utils/helpers.js - About 25 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 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;

Severity: Minor
Found in lib/classes/Validator.js - About 25 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 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};
    }
Severity: Minor
Found in lib/classes/Service.js - About 25 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

Severity
Category
Status
Source
Language