strongloop/express

View on GitHub

Showing 46 of 74 total issues

Function handle has a Cognitive Complexity of 61 (exceeds 5 allowed). Consider refactoring.
Open

proto.handle = function handle(req, res, out) {
  var self = this;

  debug('dispatching %s %s', req.method, req.url);

Severity: Minor
Found in lib/router/index.js - About 1 day 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

File response.js has 542 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*!
 * express
 * Copyright(c) 2009-2013 TJ Holowaychuk
 * Copyright(c) 2014-2015 Douglas Christopher Wilson
 * MIT Licensed
Severity: Major
Found in lib/response.js - About 1 day to fix

    File index.js has 389 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /*!
     * express
     * Copyright(c) 2009-2013 TJ Holowaychuk
     * Copyright(c) 2013 Roman Shtylman
     * Copyright(c) 2014-2015 Douglas Christopher Wilson
    Severity: Minor
    Found in lib/router/index.js - About 5 hrs to fix

      Function send has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
      Open

      res.send = function send(body) {
        var chunk = body;
        var encoding;
        var req = this.req;
        var type;
      Severity: Minor
      Found in lib/response.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 handle has 127 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      proto.handle = function handle(req, res, out) {
        var self = this;
      
        debug('dispatching %s %s', req.method, req.url);
      
      
      Severity: Major
      Found in lib/router/index.js - About 5 hrs to fix

        Function send has 89 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        res.send = function send(body) {
          var chunk = body;
          var encoding;
          var req = this.req;
          var type;
        Severity: Major
        Found in lib/response.js - About 3 hrs to fix

          Function next has 76 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            function next(err) {
              var layerError = err === 'route'
                ? null
                : err;
          
          
          Severity: Major
          Found in lib/router/index.js - About 3 hrs to fix

            File application.js has 277 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            /*!
             * express
             * Copyright(c) 2009-2013 TJ Holowaychuk
             * Copyright(c) 2013 Roman Shtylman
             * Copyright(c) 2014-2015 Douglas Christopher Wilson
            Severity: Minor
            Found in lib/application.js - About 2 hrs to fix

              Function sendfile has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
              Open

              function sendfile(res, file, options, callback) {
                var done = false;
                var streaming;
              
                // request aborted
              Severity: Minor
              Found in lib/response.js - About 2 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 process_params has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
              Open

              proto.process_params = function process_params(layer, called, req, res, done) {
                var params = this.params;
              
                // captured parameters from the layer, keys and values
                var keys = layer.keys;
              Severity: Minor
              Found in lib/router/index.js - About 2 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 sendfile has 63 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function sendfile(res, file, options, callback) {
                var done = false;
                var streaming;
              
                // request aborted
              Severity: Major
              Found in lib/response.js - About 2 hrs to fix

                Function header has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                Open

                res.header = function header(field, val) {
                  if (arguments.length === 2) {
                    var value = Array.isArray(val)
                      ? val.map(String)
                      : String(val);
                Severity: Minor
                Found in lib/response.js - About 2 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 exports has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                module.exports = function(parent, options){
                  var dir = path.join(__dirname, '..', 'controllers');
                  var verbose = options.verbose;
                  fs.readdirSync(dir).forEach(function(name){
                    var file = path.join(dir, name)
                Severity: Major
                Found in examples/mvc/lib/boot.js - About 2 hrs to fix

                  Function process_params has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  proto.process_params = function process_params(layer, called, req, res, done) {
                    var params = this.params;
                  
                    // captured parameters from the layer, keys and values
                    var keys = layer.keys;
                  Severity: Major
                  Found in lib/router/index.js - About 2 hrs to fix

                    Function dispatch has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                    Open

                    Route.prototype.dispatch = function dispatch(req, res, done) {
                      var idx = 0;
                      var stack = this.stack;
                      var sync = 0
                    
                    
                    Severity: Minor
                    Found in lib/router/route.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 render has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    app.render = function render(name, options, callback) {
                      var cache = this.cache;
                      var done = callback;
                      var engines = this.engines;
                      var opts = options;
                    Severity: Minor
                    Found in lib/application.js - About 1 hr to fix

                      Function download has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                      Open

                      res.download = function download (path, filename, options, callback) {
                        var done = callback;
                        var name = filename;
                        var opts = options || null
                      
                      
                      Severity: Minor
                      Found in lib/response.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 dispatch has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      Route.prototype.dispatch = function dispatch(req, res, done) {
                        var idx = 0;
                        var stack = this.stack;
                        var sync = 0
                      
                      
                      Severity: Minor
                      Found in lib/router/route.js - About 1 hr to fix

                        Function defaultConfiguration has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        app.defaultConfiguration = function defaultConfiguration() {
                          var env = process.env.NODE_ENV || 'development';
                        
                          // default settings
                          this.enable('x-powered-by');
                        Severity: Minor
                        Found in lib/application.js - About 1 hr to fix

                          Function jsonp has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          res.jsonp = function jsonp(obj) {
                            var val = obj;
                          
                            // allow status / body
                            if (arguments.length === 2) {
                          Severity: Minor
                          Found in lib/response.js - About 1 hr to fix
                            Severity
                            Category
                            Status
                            Source
                            Language