strongloop/express

View on GitHub

Showing 46 of 74 total issues

Function use has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

app.use = function use(fn) {
  var offset = 0;
  var path = '/';

  // default path to '/'
Severity: Minor
Found in lib/application.js - About 1 hr to fix

    Function render has a Cognitive Complexity of 12 (exceeds 5 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

    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 download has 34 lines of code (exceeds 25 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

      Function redirect has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      res.redirect = function redirect(url) {
        var address = url;
        var body;
        var status = 302;
      
      
      Severity: Minor
      Found in lib/response.js - About 1 hr to fix

        Function match has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        Layer.prototype.match = function match(path) {
          var match
        
          if (path != null) {
            // fast path non-ending match for / (any path matches)
        Severity: Minor
        Found in lib/router/layer.js - About 1 hr to fix

          Function jsonp has a Cognitive Complexity of 11 (exceeds 5 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

          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 use has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          proto.use = function use(fn) {
            var offset = 0;
            var path = '/';
          
            // default path to '/'
          Severity: Minor
          Found in lib/router/index.js - About 1 hr to fix

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

            app.set = function set(setting, val) {
              if (arguments.length === 1) {
                // app.get(setting)
                var settings = this.settings
            
            
            Severity: Minor
            Found in lib/application.js - About 1 hr to fix

              Function match has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

              Layer.prototype.match = function match(path) {
                var match
              
                if (path != null) {
                  // fast path non-ending match for / (any path matches)
              Severity: Minor
              Found in lib/router/layer.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 set has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

              app.set = function set(setting, val) {
                if (arguments.length === 1) {
                  // app.get(setting)
                  var settings = this.settings
              
              
              Severity: Minor
              Found in lib/application.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 use has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

              proto.use = function use(fn) {
                var offset = 0;
                var path = '/';
              
                // default path to '/'
              Severity: Minor
              Found in lib/router/index.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 sendFile has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              res.sendFile = function sendFile(path, options, callback) {
                var done = callback;
                var req = this.req;
                var res = this;
                var next = req.next;
              Severity: Minor
              Found in lib/response.js - About 1 hr to fix

                Function param has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  function param(err) {
                    if (err) {
                      return done(err);
                    }
                
                
                Severity: Minor
                Found in lib/router/index.js - About 1 hr to fix

                  Function View has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function View(name, options) {
                    var opts = options || {};
                  
                    this.defaultEngine = opts.defaultEngine;
                    this.ext = extname(name);
                  Severity: Minor
                  Found in lib/view.js - About 1 hr to fix

                    Function View has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function View(name, options) {
                      var opts = options || {};
                    
                      this.defaultEngine = opts.defaultEngine;
                      this.ext = extname(name);
                    Severity: Minor
                    Found in lib/view.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 process_params has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    proto.process_params = function process_params(layer, called, req, res, done) {
                    Severity: Minor
                    Found in lib/router/index.js - About 35 mins to fix

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

                        range: function(req, res, a, b, format){
                      Severity: Minor
                      Found in examples/resource/index.js - About 35 mins to fix

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

                        app.map = function(a, route){
                          route = route || '';
                          for (var key in a) {
                            switch (typeof a[key]) {
                              // { '/path': { ... }}
                        Severity: Minor
                        Found in examples/route-map/index.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 cookie has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                        res.cookie = function (name, value, options) {
                          var opts = merge({}, options);
                          var secret = this.req.secret;
                          var signed = opts.signed;
                        
                        
                        Severity: Minor
                        Found in lib/response.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 use has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                        app.use = function use(fn) {
                          var offset = 0;
                          var path = '/';
                        
                          // default path to '/'
                        Severity: Minor
                        Found in lib/application.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

                        Severity
                        Category
                        Status
                        Source
                        Language