jaredhanson/electrolyte

View on GitHub

Showing 14 of 26 total issues

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

    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

            Avoid too many return statements within this function.
            Open

                  return create(comp);
            Severity: Major
            Found in lib/container.js - About 30 mins to fix

              Function exports has a Cognitive Complexity of 6 (exceeds 5 allowed). 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: Minor
              Found in examples/express/app/components/settings.js - About 25 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 _registerComponent has a Cognitive Complexity of 6 (exceeds 5 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 25 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 resolve has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              Container.prototype.resolve = function(id, parent, optional) {
                var resolvers = this._resolvers
                  , fn, rid, i, len;
                for (i = 0, len = resolvers.length; i < len; ++i) {
                  fn = resolvers[i];
              Severity: Minor
              Found in lib/container.js - About 25 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 exports has a Cognitive Complexity of 6 (exceeds 5 allowed). 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: Minor
              Found in examples/async-express/app/components/settings.js - About 25 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