jaredhanson/locomotive

View on GitHub

Showing 62 of 62 total issues

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

    proc.on('exit', function(code, signal) {
      if (code == 127) {
        console.log();
        console.log('supervisor is not currently installed on this system.  To install, execute:');
        console.log('    $ npm install supervisor -g');
Severity: Major
Found in lib/cli/server.js and 1 other location - About 1 hr to fix
lib/cli/server.js on lines 63..70

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 72.

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

      proc.on('exit', function(code, signal) {
        if (code == 127) {
          console.log();
          console.log('nodemon is not currently installed on this system.  To install, execute:');
          console.log('    $ npm install nodemon -g');
Severity: Major
Found in lib/cli/server.js and 1 other location - About 1 hr to fix
lib/cli/server.js on lines 85..92

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 72.

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 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/httpserver.js and 1 other location - About 1 hr to fix
lib/boot/httpservercluster.js on lines 75..79

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

    Identical 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

    Function createApplicationAt has 40 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 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 _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 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 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

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

          if (!container) {
            try {
              container = require('electrolyte');
            } catch (_) {
              try {
        Severity: Major
        Found in lib/instantiators/di/factory.js and 1 other location - About 1 hr to fix
        lib/instantiators/di/constructor.js on lines 5..15

        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 63.

        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 35 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

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

            if (!container) {
              try {
                container = require('electrolyte');
              } catch (_) {
                try {
          Severity: Major
          Found in lib/instantiators/di/constructor.js and 1 other location - About 1 hr to fix
          lib/instantiators/di/factory.js on lines 5..15

          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 63.

          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 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

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

              if (typeof address == 'object') {
                options = address;
                address = undefined;
              } else if (typeof port == 'object') {
                options = port;
            Severity: Major
            Found in lib/boot/httpservercluster.js and 2 other locations - About 1 hr to fix
            lib/boot/httpserver.js on lines 28..35
            lib/controller.js on lines 82..89

            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 62.

            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 3 locations. Consider refactoring.
            Open

              if (typeof options === 'function') {
                fn = options;
                options = undefined;
              } else if (typeof template === 'function') {
                fn = template;
            Severity: Major
            Found in lib/controller.js and 2 other locations - About 1 hr to fix
            lib/boot/httpserver.js on lines 28..35
            lib/boot/httpservercluster.js on lines 31..38

            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 62.

            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

            function DispatchError(message) {
              Error.call(this);
              Error.captureStackTrace(this, arguments.callee);
              this.name = 'DispatchError';
              this.message = message;
            Severity: Major
            Found in lib/errors/dispatcherror.js and 1 other location - About 1 hr to fix
            lib/errors/controllererror.js on lines 6..11

            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 62.

            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

            function ControllerError(message) {
              Error.call(this);
              Error.captureStackTrace(this, arguments.callee);
              this.name = 'ControllerError';
              this.message = message;
            Severity: Major
            Found in lib/errors/controllererror.js and 1 other location - About 1 hr to fix
            lib/errors/dispatcherror.js on lines 6..11

            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 62.

            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 3 locations. Consider refactoring.
            Open

              if (typeof address == 'object') {
                options = address;
                address = undefined;
              } else if (typeof port == 'object') {
                options = port;
            Severity: Major
            Found in lib/boot/httpserver.js and 2 other locations - About 1 hr to fix
            lib/boot/httpservercluster.js on lines 31..38
            lib/controller.js on lines 82..89

            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 62.

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

            module.exports = function(env) {
              env = env || process.env.NODE_ENV || 'development';
              var self = this
                , app = express();
              
            Severity: Minor
            Found in lib/underlay/express.js - About 1 hr to fix
              Severity
              Category
              Status
              Source
              Language