socketstream/socketstream

View on GitHub
lib/client/system/modules/eventemitter2.js

Summary

Maintainability
D
1 day
Test Coverage

File eventemitter2.js has 339 lines of code (exceeds 250 allowed). Consider refactoring.
Open

;!function(exports, undefined) {

  var isArray = Array.isArray ? Array.isArray : function _isArray(obj) {
    return Object.prototype.toString.call(obj) === "[object Array]";
  };
Severity: Minor
Found in lib/client/system/modules/eventemitter2.js - About 4 hrs to fix

    Function emit has 67 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      EventEmitter.prototype.emit = function() {
        this._events || init.call(this);
    
        var type = arguments[0];
    
    
    Severity: Major
    Found in lib/client/system/modules/eventemitter2.js - About 2 hrs to fix

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

        EventEmitter.prototype.off = function(type, listener) {
          if (typeof listener !== 'function') {
            throw new Error('removeListener only takes instances of Function');
          }
      
      
      Severity: Major
      Found in lib/client/system/modules/eventemitter2.js - About 2 hrs to fix

        Function growListenerTree has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          function growListenerTree(type, listener) {
        
            type = typeof type === 'string' ? type.split(this.delimiter) : type.slice();
        
            var tree = this.listenerTree;
        Severity: Minor
        Found in lib/client/system/modules/eventemitter2.js - About 1 hr to fix

          Function on has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            EventEmitter.prototype.on = function(type, listener) {
              this._events || init.call(this);
          
              // To avoid recursion in the case that type == "newListeners"! Before
              // adding it to the listeners, first emit "newListeners".
          Severity: Minor
          Found in lib/client/system/modules/eventemitter2.js - About 1 hr to fix

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

              function searchListenerTree(handlers, type, tree, i) {
                if (!tree) {
                  return;
                }
            
            
            Severity: Minor
            Found in lib/client/system/modules/eventemitter2.js - About 1 hr to fix

              Avoid deeply nested control flow statements.
              Open

                          if (m > 0 && tree._listeners.length > m) {
              
                            tree._listeners.warned = true;
                            console.error('(node) warning: possible EventEmitter memory ' +
                                          'leak detected. %d listeners added. ' +
              Severity: Major
              Found in lib/client/system/modules/eventemitter2.js - About 45 mins to fix

                Avoid too many return statements within this function.
                Open

                    return listeners;
                Severity: Major
                Found in lib/client/system/modules/eventemitter2.js - About 30 mins to fix

                  There are no issues that match your filters.

                  Category
                  Status