amiorin/reloadlive

View on GitHub
lib/reloadlive/static/client.js

Summary

Maintainability
F
1 wk
Test Coverage

File client.js has 1458 lines of code (exceeds 250 allowed). Consider refactoring.
Open

'use strict';

var Faye = {
  VERSION:          '0.8.9',

Severity: Major
Found in lib/reloadlive/static/client.js - About 3 days to fix

    Function str has 68 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function str(key, holder) {
    
    // Produce a string from holder[key].
    
            var i,          // The loop counter.
    Severity: Major
    Found in lib/reloadlive/static/client.js - About 2 hrs to fix

      Function parse has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

        parse: function(url, params) {
          if (typeof url !== 'string') return url;
          var uri = new this(), parts;
      
          var consume = function(name, pattern, infer) {
      Severity: Minor
      Found in lib/reloadlive/static/client.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 request has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

        request: function(message, timeout) {
          var retry = this.retry(message, timeout),
              path  = Faye.URI.parse(this.endpoint).pathname,
              self  = this,
              xhr   = Faye.ENV.ActiveXObject
      Severity: Minor
      Found in lib/reloadlive/static/client.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 request has 47 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        request: function(message, timeout) {
          var retry = this.retry(message, timeout),
              path  = Faye.URI.parse(this.endpoint).pathname,
              self  = this,
              xhr   = Faye.ENV.ActiveXObject
      Severity: Minor
      Found in lib/reloadlive/static/client.js - About 1 hr to fix

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

          parse: function(url, params) {
            if (typeof url !== 'string') return url;
            var uri = new this(), parts;
        
            var consume = function(name, pattern, infer) {
        Severity: Minor
        Found in lib/reloadlive/static/client.js - About 1 hr to fix

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

            request: function(message, timeout) {
              var xhrClass = Faye.ENV.XDomainRequest ? XDomainRequest : XMLHttpRequest,
                  xhr      = new xhrClass(),
                  retry    = this.retry(message, timeout),
                  self     = this;
          Severity: Minor
          Found in lib/reloadlive/static/client.js - About 1 hr to fix

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

              log: function(messageArgs, level) {
                if (!Faye.logger) return;
            
                var levels = Faye.Logging.LOG_LEVELS;
                if (levels[Faye.Logging.logLevel] > levels[level]) return;
            Severity: Minor
            Found in lib/reloadlive/static/client.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 connect has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              connect: function() {
                if (Faye.Transport.WebSocket._unloaded) return;
            
                this._state = this._state || this.UNCONNECTED;
                if (this._state !== this.UNCONNECTED) return;
            Severity: Minor
            Found in lib/reloadlive/static/client.js - About 1 hr to fix

              Consider simplifying this complex logical expression.
              Open

                    if ((element    && element    !== register._element)   ||
                        (eventName  && eventName  !== register._type)      ||
                        (callback   && callback   !== register._callback)  ||
                        (context      && context      !== register._context))
                      continue;
              Severity: Critical
              Found in lib/reloadlive/static/client.js - About 1 hr to fix

                Function parse has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        JSON.parse = function (text, reviver) {
                
                // The parse method takes a text and an optional reviver function, and returns
                // a JavaScript value if the text is a valid JSON text.
                
                
                Severity: Minor
                Found in lib/reloadlive/static/client.js - About 1 hr to fix

                  Function detach has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                    detach: function(element, eventName, callback, context) {
                      var i = this._registry.length, register;
                      while (i--) {
                        register = this._registry[i];
                  
                  
                  Severity: Minor
                  Found in lib/reloadlive/static/client.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 map has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                    map: function(object, callback, context) {
                      if (object.map) return object.map(callback, context);
                      var result = [];
                  
                      if (object instanceof Array) {
                  Severity: Minor
                  Found in lib/reloadlive/static/client.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 connect has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                    connect: function() {
                      if (Faye.Transport.WebSocket._unloaded) return;
                  
                      this._state = this._state || this.UNCONNECTED;
                      if (this._state !== this.UNCONNECTED) return;
                  Severity: Minor
                  Found in lib/reloadlive/static/client.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 subscribe has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    subscribe: function(channel, callback, context) {
                      if (channel instanceof Array)
                        return Faye.map(channel, function(c) {
                          return this.subscribe(c, callback, context);
                        }, this);
                  Severity: Minor
                  Found in lib/reloadlive/static/client.js - About 1 hr to fix

                    Function request has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      request: function(messages, timeout) {
                        var params       = {message: Faye.toJSON(messages)},
                            head         = document.getElementsByTagName('head')[0],
                            script       = document.createElement('script'),
                            callbackName = Faye.Transport.JSONP.getCallbackName(),
                    Severity: Minor
                    Found in lib/reloadlive/static/client.js - About 1 hr to fix

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

                        extend: function(dest, source, overwrite) {
                          if (!source) return dest;
                          for (var key in source) {
                            if (!source.hasOwnProperty(key)) continue;
                            if (dest.hasOwnProperty(key) && overwrite === false) continue;
                      Severity: Minor
                      Found in lib/reloadlive/static/client.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 request has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                        request: function(message, timeout) {
                          var xhrClass = Faye.ENV.XDomainRequest ? XDomainRequest : XMLHttpRequest,
                              xhr      = new xhrClass(),
                              retry    = this.retry(message, timeout),
                              self     = this;
                      Severity: Minor
                      Found in lib/reloadlive/static/client.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 copyObject has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                        copyObject: function(object) {
                          var clone, i, key;
                          if (object instanceof Array) {
                            clone = [];
                            i = object.length;
                      Severity: Minor
                      Found in lib/reloadlive/static/client.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

                      Avoid deeply nested control flow statements.
                      Open

                                              if (v) {
                                                  partial.push(quote(k) + (gap ? ': ' : ':') + v);
                                              }
                      Severity: Major
                      Found in lib/reloadlive/static/client.js - About 45 mins to fix

                        Function receiveMessage has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                          receiveMessage: function(message) {
                            this.pipeThroughExtensions('incoming', message, function(message) {
                              if (!message) return;
                        
                              if (message.advice) this._handleAdvice(message.advice);
                        Severity: Minor
                        Found in lib/reloadlive/static/client.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 unbind has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                          unbind: function(eventType, listener, context) {
                            if (!this._subscribers || !this._subscribers[eventType]) return;
                        
                            if (!listener) {
                              delete this._subscribers[eventType];
                        Severity: Minor
                        Found in lib/reloadlive/static/client.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 random has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                          random: function(bitlength) {
                            bitlength = bitlength || this.ID_LENGTH;
                            if (bitlength > 32) {
                              var parts  = Math.ceil(bitlength / 32),
                                  string = '';
                        Severity: Minor
                        Found in lib/reloadlive/static/client.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

                        Avoid deeply nested control flow statements.
                        Open

                                                if (v) {
                                                    partial.push(quote(k) + (gap ? ': ' : ':') + v);
                                                }
                        Severity: Major
                        Found in lib/reloadlive/static/client.js - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                                      if (v !== undefined) {
                                                          value[k] = v;
                                                      } else {
                                                          delete value[k];
                                                      }
                          Severity: Major
                          Found in lib/reloadlive/static/client.js - About 45 mins to fix

                            Function get has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                              get: function(client, allowed, disabled, callback, context) {
                            Severity: Minor
                            Found in lib/reloadlive/static/client.js - About 35 mins to fix

                              Function asyncEach has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                              Open

                                asyncEach: function(list, iterator, callback, context) {
                                  var n       = list.length,
                                      i       = -1,
                                      calls   = 0,
                                      looping = false;
                              Severity: Minor
                              Found in lib/reloadlive/static/client.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

                              Function pipeThroughExtensions has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                              Open

                                pipeThroughExtensions: function(stage, message, callback, context) {
                                  this.debug('Passing through ? extensions: ?', stage, message);
                              
                                  if (!this._extensions) return callback.call(context, message);
                                  var extensions = this._extensions.slice();
                              Severity: Minor
                              Found in lib/reloadlive/static/client.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

                                  if (this._connectRequest) return;
                              Severity: Major
                              Found in lib/reloadlive/static/client.js - About 30 mins to fix

                                Function connect has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                Open

                                  connect: function(callback, context) {
                                    if (this._advice.reconnect === this.NONE) return;
                                    if (this._state === this.DISCONNECTED) return;
                                
                                    if (this._state === this.UNCONNECTED)
                                Severity: Minor
                                Found in lib/reloadlive/static/client.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 removeExtension has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                Open

                                  removeExtension: function(extension) {
                                    if (!this._extensions) return;
                                    var i = this._extensions.length;
                                    while (i--) {
                                      if (this._extensions[i] !== extension) continue;
                                Severity: Minor
                                Found in lib/reloadlive/static/client.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

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

                                  errback: function(callback, context) {
                                    if (!callback) return;
                                
                                    if (this._deferredStatus === 'failed')
                                      return callback.apply(context, this._deferredArgs);
                                Severity: Major
                                Found in lib/reloadlive/static/client.js and 1 other location - About 2 hrs to fix
                                lib/reloadlive/static/client.js on lines 294..302

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

                                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

                                  callback: function(callback, context) {
                                    if (!callback) return;
                                
                                    if (this._deferredStatus === 'succeeded')
                                      return callback.apply(context, this._deferredArgs);
                                Severity: Major
                                Found in lib/reloadlive/static/client.js and 1 other location - About 2 hrs to fix
                                lib/reloadlive/static/client.js on lines 312..320

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

                                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

                                                v = partial.length === 0 ? '[]' :
                                                    gap ? '[\n' + gap +
                                                            partial.join(',\n' + gap) + '\n' +
                                                                mind + ']' :
                                                          '[' + partial.join(',') + ']';
                                Severity: Major
                                Found in lib/reloadlive/static/client.js and 1 other location - About 2 hrs to fix
                                lib/reloadlive/static/client.js on lines 1665..1667

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

                                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

                                            v = partial.length === 0 ? '{}' :
                                                gap ? '{\n' + gap + partial.join(',\n' + gap) + '\n' +
                                                        mind + '}' : '{' + partial.join(',') + '}';
                                Severity: Major
                                Found in lib/reloadlive/static/client.js and 1 other location - About 2 hrs to fix
                                lib/reloadlive/static/client.js on lines 1626..1630

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

                                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 (Object.hasOwnProperty.call(value, k)) {
                                                        v = str(k, value);
                                                        if (v) {
                                                            partial.push(quote(k) + (gap ? ': ' : ':') + v);
                                                        }
                                Severity: Minor
                                Found in lib/reloadlive/static/client.js and 1 other location - About 50 mins to fix
                                lib/reloadlive/static/client.js on lines 1641..1646

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

                                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 (typeof k === 'string') {
                                                        v = str(k, value);
                                                        if (v) {
                                                            partial.push(quote(k) + (gap ? ': ' : ':') + v);
                                                        }
                                Severity: Minor
                                Found in lib/reloadlive/static/client.js and 1 other location - About 50 mins to fix
                                lib/reloadlive/static/client.js on lines 1653..1658

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

                                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

                                      if (parsedMessage) {
                                        self.receive(parsedMessage);
                                        self.trigger('up');
                                      } else {
                                        retry();
                                Severity: Minor
                                Found in lib/reloadlive/static/client.js and 1 other location - About 45 mins to fix
                                lib/reloadlive/static/client.js on lines 2095..2101

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

                                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

                                      if (parsedMessage) {
                                        self.receive(parsedMessage);
                                        self.trigger('up');
                                      } else {
                                        retry();
                                Severity: Minor
                                Found in lib/reloadlive/static/client.js and 1 other location - About 45 mins to fix
                                lib/reloadlive/static/client.js on lines 2050..2056

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

                                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

                                  isMeta: function(name) {
                                    var segments = this.parse(name);
                                    return segments ? (segments[0] === this.META) : null;
                                  },
                                Severity: Minor
                                Found in lib/reloadlive/static/client.js and 1 other location - About 35 mins to fix
                                lib/reloadlive/static/client.js on lines 613..616

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

                                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

                                  isService: function(name) {
                                    var segments = this.parse(name);
                                    return segments ? (segments[0] === this.SERVICE) : null;
                                  },
                                Severity: Minor
                                Found in lib/reloadlive/static/client.js and 1 other location - About 35 mins to fix
                                lib/reloadlive/static/client.js on lines 608..611

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

                                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

                                There are no issues that match your filters.

                                Category
                                Status