Showing 59 of 59 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    if (cluster.isMaster) {
      console.info('Creating HTTP server cluster with %d workers', size);

      for (var i = 0; i < size; ++i) {
        debug('spawning worker process %d', (i + 1));
Severity: Major
Found in lib/boot/httpservercluster.js and 1 other location - About 1 day to fix
lib/boot/httpsservercluster.js on lines 49..78

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 259.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    if (cluster.isMaster) {
      console.info('Creating HTTPS server cluster with %d workers', size);

      for (var i = 0; i < size; ++i) {
        debug('spawning worker process %d', (i + 1));
Severity: Major
Found in lib/boot/httpsservercluster.js and 1 other location - About 1 day to fix
lib/boot/httpservercluster.js on lines 48..81

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 259.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

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

    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 _invoke has a Cognitive Complexity of 22 (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

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        for (var i = 0, len = arguments.length; i < len; i++) {
          var arg = arguments[i];
          var placeholder = placeholders[i];
    
          if (arg && (arg.id || arg.id === 0)) {
    Severity: Major
    Found in lib/helpers/route/pattern.js and 1 other location - About 3 hrs to fix
    lib/helpers/route/entry.js on lines 18..27

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 95.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        for (var i = 0, len = arguments.length; i < len; i++) {
          var arg = arguments[i];
          var placeholder = placeholders[i];
    
          if (arg && (arg.id || arg.id === 0)) {
    Severity: Major
    Found in lib/helpers/route/entry.js and 1 other location - About 3 hrs to fix
    lib/helpers/route/pattern.js on lines 30..39

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 95.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Function _devoke has a Cognitive Complexity of 20 (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 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 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 56 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

        Identical blocks of code found in 3 locations. Consider refactoring.
        Open

            for (var i = 0, len = deps.length; i < len; ++i) {
              debug('create %s', deps[i]);
              var inst = container.create(deps[i], this);
              args.push(inst);
            }
        Severity: Major
        Found in lib/boot/di/routes.js and 2 other locations - About 2 hrs to fix
        lib/instantiators/di/constructor.js on lines 26..30
        lib/instantiators/di/factory.js on lines 26..30

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 75.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 3 locations. Consider refactoring.
        Open

            for (var i = 0, len = deps.length; i < len; ++i) {
              debug('create %s', deps[i]);
              var inst = container.create(deps[i], this);
              args.push(inst);
            }
        Severity: Major
        Found in lib/instantiators/di/factory.js and 2 other locations - About 2 hrs to fix
        lib/boot/di/routes.js on lines 37..41
        lib/instantiators/di/constructor.js on lines 26..30

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 75.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 3 locations. Consider refactoring.
        Open

            for (var i = 0, len = deps.length; i < len; ++i) {
              debug('create %s', deps[i]);
              var inst = container.create(deps[i], this);
              args.push(inst);
            }
        Severity: Major
        Found in lib/instantiators/di/constructor.js and 2 other locations - About 2 hrs to fix
        lib/boot/di/routes.js on lines 37..41
        lib/instantiators/di/factory.js on lines 26..30

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 75.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        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')('emvc');
        Severity: Minor
        Found in lib/boot/httpservercluster.js - About 2 hrs to fix

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

          module.exports = function(port, address, options) {
            var os = require('os')
              , http = require('https')
              , cluster = require('cluster')
              , debug = require('debug')('emvc');
          Severity: Minor
          Found in lib/boot/httpsservercluster.js - About 1 hr to fix

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                  http.createServer(this.express).listen(port, address, function() {
                    var addr = this.address();
                    console.info('HTTP server listening on %s:%d', addr.address, addr.port);
                    return done();
                  });
            Severity: Major
            Found in lib/boot/httpservercluster.js and 1 other location - About 1 hr to fix
            lib/boot/httpserver.js on lines 42..46

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 71.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                http.createServer(this.express).listen(port, address, function() {
                  var addr = this.address();
                  console.info('HTTP server listening on http://%s:%d', addr.address, addr.port);
                  return done();
                });
            Severity: Major
            Found in lib/boot/httpserver.js and 1 other location - About 1 hr to fix
            lib/boot/httpservercluster.js on lines 76..80

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 71.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            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 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
                Severity
                Category
                Status
                Source
                Language