truongld/yodajs

View on GitHub

Showing 38 of 64 total issues

File create.js has 616 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*jshint -W003 */

/**
 * Module dependencies.
 */
Severity: Major
Found in lib/cli/create.js - About 1 day to fix

    Function _invoke has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
    Open

    Controller.prototype._invoke = function(action) {
      if (typeof this[action] !== 'function') {
        return this.__next(new ControllerError(this.__id + '#' + action + ' is not a function'));
      }
      
    Severity: Minor
    Found in lib/controller.js - About 3 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 render has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
    Open

    Controller.prototype.render = function(template, options, fn) {
      if (typeof options === 'function') {
        fn = options;
        options = undefined;
      } else if (typeof template === 'function') {
    Severity: Minor
    Found in lib/controller.js - About 3 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 respondWith has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

    Controller.prototype.respondWith = function(obj) {
      var req = this.__req
        , res = this.__res
        , format = this.__req.params.format;
      format = format ? mime.lookup(format) : undefined;
    Severity: Minor
    Found in lib/controller.js - About 3 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 _devoke has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

    Controller.prototype._devoke = function(err, cb) {
      if (this.__devoked) { return; }
      this.__devoked = true;
    
      var self = this
    Severity: Minor
    Found in lib/controller.js - About 3 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

    File controller.js has 301 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /**
     * Module dependencies.
     */
    var router = require('actionrouter')
      , mime = require('express').static.mime
    Severity: Minor
    Found in lib/controller.js - About 3 hrs to fix

      Function server has 74 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      exports = module.exports = function server(dir, address, port, env, options) {
        console.log('CLI ENV: ' + env);
        options = options || {};
        
        var command, args, proc;
      Severity: Major
      Found in lib/cli/server.js - About 2 hrs to fix

        Function render has 63 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        Controller.prototype.render = function(template, options, fn) {
          if (typeof options === 'function') {
            fn = options;
            options = undefined;
          } else if (typeof template === 'function') {
        Severity: Major
        Found in lib/controller.js - About 2 hrs to fix

          Function _invoke has 60 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          Controller.prototype._invoke = function(action) {
            if (typeof this[action] !== 'function') {
              return this.__next(new ControllerError(this.__id + '#' + action + ' is not a function'));
            }
            
          Severity: Major
          Found in lib/controller.js - About 2 hrs to fix

            Function exports has 50 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            module.exports = function(port, address, options) {
              var os = require('os')
                , http = require('http')
                , cluster = require('cluster')
                , debug = require('debug')('maglev');
            Severity: Minor
            Found in lib/boot/httpservercluster.js - About 2 hrs to fix

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

              exports = module.exports = function create(path) {
                console.log('creating Yodajs application at : ' + path);
                
                (function createApplication(path) {
                  emptyDirectory(path, function(empty) {
              Severity: Minor
              Found in lib/cli/create.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 createApplicationAt has 46 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function createApplicationAt(path) {
                console.log();
                process.on('exit', function(){
                  console.log();
                  console.log('   install dependencies:');
              Severity: Minor
              Found in lib/cli/create.js - About 1 hr to fix

                Function respondWith has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                Controller.prototype.respondWith = function(obj) {
                  var req = this.__req
                    , res = this.__res
                    , format = this.__req.params.format;
                  format = format ? mime.lookup(format) : undefined;
                Severity: Minor
                Found in lib/controller.js - About 1 hr to fix

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

                  Controller.prototype._devoke = function(err, cb) {
                    if (this.__devoked) { return; }
                    this.__devoked = true;
                  
                    var self = this
                  Severity: Minor
                  Found in lib/controller.js - About 1 hr to fix

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

                    module.exports = function(container) {
                      if (!container) {
                        try {
                          container = require('electrolyte');
                        } catch (_) {
                    Severity: Minor
                    Found in lib/instantiators/di/constructor.js - About 1 hr to fix

                      Function tag has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function tag(name, options, close, cb) {
                        if (typeof close === 'function') {
                          cb = close;
                          close = true;
                        }
                      Severity: Minor
                      Found in lib/helpers/tag.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 _controller has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                      Open

                      Application.prototype._controller = function(id, cb) {
                        var mod = this.__controllers[id]
                          , mpath;
                        
                        if (!mod) {
                      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 exports has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                      Open

                      module.exports = function(app, options) {
                        options = options || {};
                        var name = options.name || 'invoke';
                        
                        return function invokable(req, res, next) {
                      Severity: Minor
                      Found in lib/middleware/invokable.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 server has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                      Open

                      exports = module.exports = function server(dir, address, port, env, options) {
                        console.log('CLI ENV: ' + env);
                        options = options || {};
                        
                        var command, args, proc;
                      Severity: Minor
                      Found in lib/cli/server.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 httpServerCluster has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        return function httpServerCluster(done) {
                          port = port || options.port || this.get('port') || 3000;
                          address = address || options.address || this.get('address') || '0.0.0.0';
                          
                          if (cluster.isMaster) {
                      Severity: Minor
                      Found in lib/boot/httpservercluster.js - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language