jaredhanson/electrolyte

View on GitHub

Showing 26 of 26 total issues

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

exports = module.exports = function(settings, db, logger) {

  function logRequest(req, res, next) {
    logger.info(req.ip + ' ' + req.headers['user-agent']);
    next();
Severity: Major
Found in examples/async-express/app/handlers/list.js and 1 other location - About 1 day to fix
examples/express/app/handlers/list.js on lines 14..40

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

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

exports = module.exports = function(settings, db, logger) {
  
  function logRequest(req, res, next) {
    logger.info(req.ip + ' ' + req.headers['user-agent']);
    next();
Severity: Major
Found in examples/express/app/handlers/list.js and 1 other location - About 1 day to fix
examples/async-express/app/handlers/list.js on lines 14..40

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

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

exports = module.exports = function() {
  var settings = new Settings();
  
  settings.set('env', process.env.NODE_ENV || 'development');
  settings.set('title', 'To Do List')
Severity: Major
Found in examples/express/app/components/settings.js and 1 other location - About 7 hrs to fix
examples/async-express/app/components/settings.js on lines 15..34

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

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

exports = module.exports = function() {
  var settings = new Settings();

  settings.set('env', process.env.NODE_ENV || 'development');
  settings.set('title', 'To Do List')
Severity: Major
Found in examples/async-express/app/components/settings.js and 1 other location - About 7 hrs to fix
examples/express/app/components/settings.js on lines 15..34

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

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

exports = module.exports = function(db, logger) {
  
  function validateItem(req, res, next) {
    if (!req.body.description) {
      return res.send('Tasks must have a description');
Severity: Major
Found in examples/express/app/handlers/create.js and 1 other location - About 7 hrs to fix
examples/async-express/app/handlers/create.js on lines 12..45

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

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

exports = module.exports = function(db, logger) {

  function validateItem(req, res, next) {
    if (!req.body.description) {
      return res.send('Tasks must have a description');
Severity: Major
Found in examples/async-express/app/handlers/create.js and 1 other location - About 7 hrs to fix
examples/express/app/handlers/create.js on lines 12..45

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

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

Database.prototype.add = function(item, cb) {
  var self = this;
  process.nextTick(function() {
    var id = records.length + 1;
    item.id = id;
Severity: Major
Found in examples/async-express/app/components/db/todos.js and 1 other location - About 3 hrs to fix
examples/express/app/components/db/todos.js on lines 47..56

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

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

Database.prototype.add = function(item, cb) {
  var self = this;
  process.nextTick(function() {
    var id = records.length + 1;
    item.id = id;
Severity: Major
Found in examples/express/app/components/db/todos.js and 1 other location - About 3 hrs to fix
examples/async-express/app/components/db/todos.js on lines 50..59

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

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

Container.prototype.create = function(id, parent, ecomp, options) {
  //if (id == 'http://i.bixbyjs.org/http/middleware/session') {
  if (id == 'http://i.bixbyjs.org/http/middleware/authenticate') {
    console.log('!!! ATTEMPTED TO CREATE AUTH MIDDLEWARE: ' + parent.id);
  }
Severity: Major
Found in lib/container.js - About 3 hrs to fix

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

    function ImplementationNotFoundError(message, iface) {
      Error.call(this);
      Error.captureStackTrace(this, arguments.callee);
      this.message = message;
      this.code = 'IMPLEMENTATION_NOT_FOUND';
    Severity: Major
    Found in lib/errors/implnotfound.js and 1 other location - About 1 hr to fix
    lib/errors/componentnotfound.js on lines 6..12

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

    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 ComponentNotFoundError(message, iface) {
      Error.call(this);
      Error.captureStackTrace(this, arguments.callee);
      this.message = message;
      this.code = 'IMPLEMENTATION_NOT_FOUND';
    Severity: Major
    Found in lib/errors/componentnotfound.js and 1 other location - About 1 hr to fix
    lib/errors/implnotfound.js on lines 6..12

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

    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 components has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    InjectedContainer.prototype.components = function(q, filt) {
      if (typeof q == 'string' && !Array.isArray(q)) {
        q = [ q ];
      } else if (typeof q == 'boolean') {
        filt = q;
    Severity: Minor
    Found in lib/injectedcontainer.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 create has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    Component.prototype.create = function(container, options) {
      options = options || {};
      
      debug('create %s', this.id);
      
    Severity: Minor
    Found in lib/component.js - About 1 hr to fix

      Function components has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      InjectedContainer.prototype.components = function(q, filt) {
        if (typeof q == 'string' && !Array.isArray(q)) {
          q = [ q ];
        } else if (typeof q == 'boolean') {
          filt = q;
      Severity: Minor
      Found in lib/injectedcontainer.js - About 1 hr to fix

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

        Container.prototype.use = function(ns, asm) {
          if (typeof ns !== 'string') {
            // force ns to be an empty string if not specified
            asm = ns;
            ns = '';
        Severity: Minor
        Found in lib/container.js - About 1 hr to fix

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

          Container.prototype._registerComponent = function(id, mod, source) {
            var spec, pattern;
            
            if (mod['@literal']) {
              pattern = 'literal';
          Severity: Minor
          Found in lib/container.js - About 1 hr to fix

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

            function Component(id, mod, asm) {
              var keys, i, len;
              
              this.id = id;
              this.dependencies = mod['@require'] || [];
            Severity: Minor
            Found in lib/component.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 use has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

            Container.prototype.use = function(ns, asm) {
              if (typeof ns !== 'string') {
                // force ns to be an empty string if not specified
                asm = ns;
                ns = '';
            Severity: Minor
            Found in lib/container.js - About 45 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 create has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            Component.prototype.create = function(container, options) {
              options = options || {};
              
              debug('create %s', this.id);
              
            Severity: Minor
            Found in lib/component.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

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

            Database.prototype.findAll = function(cb) {
              process.nextTick(function() {
                return cb(null, records);
              });
            }
            Severity: Minor
            Found in examples/async-express/app/components/db/todos.js and 1 other location - About 30 mins to fix
            examples/express/app/components/db/todos.js on lines 41..45

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

            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

            Severity
            Category
            Status
            Source
            Language