CleverStack/node-seed

View on GitHub
lib/classes/Module.js

Summary

Maintainability
C
1 day
Test Coverage

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
Severity: Minor
Found in lib/classes/Module.js - About 5 hrs 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 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
Severity: Major
Found in lib/classes/Module.js - About 2 hrs to fix

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

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 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

There are no issues that match your filters.

Category
Status