appsflare/ludicrum-api

View on GitHub
assets/js/socket.io.js

Summary

Maintainability
F
1 wk
Test Coverage

File socket.io.js has 1660 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*! Socket.IO.js build:0.9.16, development. Copyright(c) 2011 LearnBoost <dev@learnboost.com> MIT Licensed */

var io = ('undefined' === typeof module ? {} : module.exports);
(function () {

Severity: Major
Found in assets/js/socket.io.js - About 4 days to fix

    Function str has 65 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 assets/js/socket.io.js - About 2 hrs to fix

      Function reconnect has 61 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          Socket.prototype.reconnect = function () {
            this.reconnecting = true;
            this.reconnectionAttempts = 0;
            this.reconnectionDelay = this.options['reconnection delay'];
      
      
      Severity: Major
      Found in assets/js/socket.io.js - About 2 hrs to fix

        Function decodePacket has 61 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            parser.decodePacket = function (data) {
              var pieces = data.match(regexp);
        
              if (!pieces) return {};
        
        
        Severity: Major
        Found in assets/js/socket.io.js - About 2 hrs to fix

          Function post has 59 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              JSONPPolling.prototype.post = function (data) {
                var self = this
                  , query = io.util.query(
                    this.socket.options.query
                    , 't=' + (+new Date) + '&i=' + this.index
          Severity: Major
          Found in assets/js/socket.io.js - About 2 hrs to fix

            Function onPacket has 53 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                SocketNamespace.prototype.onPacket = function (packet) {
                  var self = this;
            
                  function ack() {
                    self.packet({
            Severity: Major
            Found in assets/js/socket.io.js - About 2 hrs to fix

              Function connect has 50 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  Socket.prototype.connect = function (fn) {
                    if (this.connecting) {
                      return this;
                    }
              
              
              Severity: Minor
              Found in assets/js/socket.io.js - About 2 hrs to fix

                Function handshake has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    Socket.prototype.handshake = function (fn) {
                      var self = this
                        , options = this.options;
                
                      function complete(data) {
                Severity: Minor
                Found in assets/js/socket.io.js - About 1 hr to fix

                  Function encodePacket has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      parser.encodePacket = function (packet) {
                        var type = indexOf(packets, packet.type)
                          , id = packet.id || ''
                          , endpoint = packet.endpoint || ''
                          , ack = packet.ack
                  Severity: Minor
                  Found in assets/js/socket.io.js - About 1 hr to fix

                    Function get has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        XHRPolling.prototype.get = function () {
                          if (!this.isOpen) return;
                    
                          var self = this;
                    
                    
                    Severity: Minor
                    Found in assets/js/socket.io.js - About 1 hr to fix

                      Function Socket has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          function Socket(options) {
                            this.options = {
                              port: 80
                              , secure: false
                              , document: 'document' in global ? document : false
                      Severity: Minor
                      Found in assets/js/socket.io.js - About 1 hr to fix

                        Function parse has 34 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.
                        
                              var j;
                        Severity: Minor
                        Found in assets/js/socket.io.js - About 1 hr to fix

                          Function maybeReconnect has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                function maybeReconnect() {
                                  if (!self.reconnecting) {
                                    return;
                                  }
                          
                          
                          Severity: Minor
                          Found in assets/js/socket.io.js - About 1 hr to fix

                            Function connect has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                    function connect(transports) {
                                      if (self.transport) self.transport.clearTimeouts();
                            
                                      self.transport = self.getTransport(transports);
                                      if (!self.transport) return self.publish('connect_failed');
                            Severity: Minor
                            Found in assets/js/socket.io.js - About 1 hr to fix

                              Avoid deeply nested control flow statements.
                              Open

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

                                Avoid deeply nested control flow statements.
                                Open

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

                                  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 assets/js/socket.io.js and 1 other location - About 2 hrs to fix
                                  assets/js/socket.io.js on lines 804..806

                                  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 assets/js/socket.io.js and 1 other location - About 2 hrs to fix
                                  assets/js/socket.io.js on lines 841..843

                                  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

                                      Flag.prototype.emit = function () {
                                        this.namespace.flags[this.name] = true;
                                        this.namespace.emit.apply(this.namespace, arguments);
                                      };
                                  Severity: Major
                                  Found in assets/js/socket.io.js and 1 other location - About 1 hr to fix
                                  assets/js/socket.io.js on lines 2300..2303

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

                                  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

                                      Flag.prototype.send = function () {
                                        this.namespace.flags[this.name] = true;
                                        this.namespace.send.apply(this.namespace, arguments);
                                      };
                                  Severity: Major
                                  Found in assets/js/socket.io.js and 1 other location - About 1 hr to fix
                                  assets/js/socket.io.js on lines 2311..2314

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

                                  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

                                          , query = io.util.query(
                                            this.socket.options.query
                                            , 't=' + (+new Date) + '&i=' + this.index
                                          );
                                  Severity: Minor
                                  Found in assets/js/socket.io.js and 1 other location - About 50 mins to fix
                                  assets/js/socket.io.js on lines 3160..3163

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

                                  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

                                          , query = io.util.query(
                                            this.socket.options.query
                                            , 't=' + (+new Date) + '&i=' + this.index
                                          );
                                  Severity: Minor
                                  Found in assets/js/socket.io.js and 1 other location - About 50 mins to fix
                                  assets/js/socket.io.js on lines 3247..3250

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

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

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

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

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

                                  Refactorings

                                  Further Reading

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

                                        for (var i = 0, l = arr.length; i < l; i++) {
                                          this.packet(arr[i]);
                                        }
                                  Severity: Minor
                                  Found in assets/js/socket.io.js and 1 other location - About 35 mins to fix
                                  assets/js/socket.io.js on lines 1310..1312

                                  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

                                            for (var i = 0, l = msgs.length; i < l; i++) {
                                              this.onPacket(msgs[i]);
                                            }
                                  Severity: Minor
                                  Found in assets/js/socket.io.js and 1 other location - About 35 mins to fix
                                  assets/js/socket.io.js on lines 2435..2437

                                  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

                                        this.websocket.onclose = function () {
                                          self.onClose();
                                          self.socket.setBuffer(true);
                                        };
                                  Severity: Minor
                                  Found in assets/js/socket.io.js and 1 other location - About 30 mins to fix
                                  assets/js/socket.io.js on lines 2384..2387

                                  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

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

                                        this.websocket.onopen = function () {
                                          self.onOpen();
                                          self.socket.setBuffer(false);
                                        };
                                  Severity: Minor
                                  Found in assets/js/socket.io.js and 1 other location - About 30 mins to fix
                                  assets/js/socket.io.js on lines 2391..2394

                                  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

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

                                      WS.prototype.scheme = function () {
                                        return this.socket.options.secure ? 'wss' : 'ws';
                                      };
                                  Severity: Minor
                                  Found in assets/js/socket.io.js and 1 other location - About 30 mins to fix
                                  assets/js/socket.io.js on lines 2688..2690

                                  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

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

                                      XHR.prototype.scheme = function () {
                                        return this.socket.options.secure ? 'https' : 'http';
                                      };
                                  Severity: Minor
                                  Found in assets/js/socket.io.js and 1 other location - About 30 mins to fix
                                  assets/js/socket.io.js on lines 2470..2472

                                  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

                                  There are no issues that match your filters.

                                  Category
                                  Status