luin/express-di

View on GitHub

Showing 7 of 11 total issues

Function _dispatch has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
Open

express.Router.prototype._dispatch = function(req, res, next){
  var params = this.params
    , self = this;


Severity: Minor
Found in lib/di.js - About 6 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 _dispatch has 122 lines of code (exceeds 25 allowed). Consider refactoring.
Open

express.Router.prototype._dispatch = function(req, res, next){
  var params = this.params
    , self = this;


Severity: Major
Found in lib/di.js - About 4 hrs to fix

    Function pass has 118 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      (function pass(i, err){
        var paramCallbacks
          , paramIndex = 0
          , paramVal
          , route
    Severity: Major
    Found in lib/di.js - About 4 hrs to fix

      Function paramCallback has 59 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function paramCallback(err) {
            var fn = paramCallbacks[paramIndex++];
            if (err || !fn) return param(err);
      
            var parameters = utils.getParameters(fn);
      Severity: Major
      Found in lib/di.js - About 2 hrs to fix

        Function route has 52 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        express.Router.prototype.route = function(method, path) {
          var callbacks = utils.flatten([].slice.call(arguments, 2));
        
          callbacks = callbacks
            .map(function(fn) {
        Severity: Major
        Found in lib/di.js - About 2 hrs to fix

          Function arraysEqual has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

          exports.arraysEqual = function(arr1, arr2) {
            if (arr1 === arr2) return true;
            if (arr1 === null || arr2 === null) return false;
            if (arr1.length != arr2.length) return false;
          
          
          Severity: Minor
          Found in lib/utils.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

          Avoid too many return statements within this function.
          Open

            return true;
          Severity: Major
          Found in lib/utils.js - About 30 mins to fix
            Severity
            Category
            Status
            Source
            Language