socketio/socket.io

View on GitHub

Showing 58 of 158 total issues

Function create has 51 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      value: function create() {
        var _this5 = this;

        var opts = pick(this.opts, "agent", "pfx", "key", "passphrase", "cert", "ca", "ciphers", "rejectUnauthorized", "autoUnref");
        opts.xdomain = !!this.opts.xd;
Severity: Major
Found in client-dist/socket.io.js - About 2 hrs to fix

    Function _createForOfIteratorHelper has 49 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      function _createForOfIteratorHelper(o, allowArrayLike) {
        var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
    
        if (!it) {
          if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
    Severity: Minor
    Found in client-dist/socket.io.js - About 1 hr to fix

      Function decodeString has 49 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            value: function decodeString(str) {
              var i = 0; // look up type
      
              var p = {
                type: Number(str.charAt(0))
      Severity: Minor
      Found in client-dist/socket.io.js - About 1 hr to fix

        Function patchAdapter has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

        export function patchAdapter(app /* : TemplatedApp */) {
          Adapter.prototype.addAll = function (id, rooms) {
            const isNew = !this.sids.has(id);
            addAll.call(this, id, rooms);
            const socket: Socket = this.nsp.sockets.get(id);
        Severity: Minor
        Found in lib/uws.ts - 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 Encoder has 44 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          var Encoder = /*#__PURE__*/function () {
            function Encoder() {
              _classCallCheck(this, Encoder);
            }
        
        
        Severity: Minor
        Found in client-dist/socket.io.js - About 1 hr to fix

          Function attachApp has 42 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            public attachApp(app /*: TemplatedApp */, opts: Partial<ServerOptions> = {}) {
              // merge the options passed to the Socket.IO server
              Object.assign(opts, this.opts);
              // set engine.io path to `/socket.io`
              opts.path = opts.path || this._path;
          Severity: Minor
          Found in lib/index.ts - About 1 hr to fix

            Function open has 41 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  value: function open(fn) {
                    var _this2 = this;
            
                    if (~this._readyState.indexOf("open")) return this;
                    this.engine = new Socket$1(this.uri, this.opts);
            Severity: Minor
            Found in client-dist/socket.io.js - About 1 hr to fix

              Function exports has 35 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              module.exports = function (config) {
                config.set({
                  basePath: '',
                  frameworks: ['jasmine', '@angular-devkit/build-angular'],
                  plugins: [
              Severity: Minor
              Found in examples/basic-crud-application/angular-client/karma.conf.js - About 1 hr to fix

                Function exports has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                module.exports = function (config) {
                  config.set({
                    basePath: '',
                    frameworks: ['jasmine', '@angular-devkit/build-angular'],
                    plugins: [
                Severity: Minor
                Found in examples/angular-todomvc/karma.conf.js - About 1 hr to fix

                  Function url has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    function url(uri) {
                      var path = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
                      var loc = arguments.length > 2 ? arguments[2] : undefined;
                      var obj = uri; // default to window.location
                  
                  
                  Severity: Minor
                  Found in client-dist/socket.io.js - About 1 hr to fix

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

                          value: function onpacket(packet) {
                            var sameNamespace = packet.nsp === this.nsp;
                            if (!sameNamespace) return;
                    
                            switch (packet.type) {
                    Severity: Minor
                    Found in client-dist/socket.io.js - About 1 hr to fix

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

                          function Manager(uri, opts) {
                            var _this;
                      
                            _classCallCheck(this, Manager);
                      
                      
                      Severity: Minor
                      Found in client-dist/socket.io.js - About 1 hr to fix

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

                          public of(
                            name: string | RegExp | ParentNspNameMatchFn,
                            fn?: (
                              socket: Socket<ListenEvents, EmitEvents, ServerSideEvents, SocketData>
                            ) => void
                        Severity: Minor
                        Found in lib/index.ts - 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 registerValidSW has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function registerValidSW(swUrl, config) {
                          navigator.serviceWorker
                            .register(swUrl)
                            .then(registration => {
                              registration.onupdatefound = () => {
                        Severity: Minor
                        Found in examples/create-react-app-example/src/serviceWorker.js - About 1 hr to fix

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

                            Adapter.prototype.broadcast = function (packet, opts) {
                              const useFastPublish = opts.rooms.size <= 1 && opts.except!.size === 0;
                              if (!useFastPublish) {
                                broadcast.call(this, packet, opts);
                                return;
                          Severity: Minor
                          Found in lib/uws.ts - About 1 hr to fix

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

                                  value: function close() {
                                    var _this6 = this;
                            
                                    var close = function close() {
                                      _this6.onClose("forced close");
                            Severity: Minor
                            Found in client-dist/socket.io.js - About 1 hr to fix

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

                                      var onTransportOpen = function onTransportOpen() {
                                        if (failed) return;
                                        transport.send([{
                                          type: "ping",
                                          data: "probe"
                              Severity: Minor
                              Found in client-dist/socket.io.js - About 1 hr to fix

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

                                      value: function reconnect() {
                                        var _this3 = this;
                                
                                        if (this._reconnecting || this.skipReconnect) return this;
                                        var self = this;
                                Severity: Minor
                                Found in client-dist/socket.io.js - About 1 hr to fix

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

                                    parseBinary (obj) {
                                      let view = new Uint8Array(obj);
                                      let packetId = view[0];
                                      try {
                                        let packet = {
                                  Severity: Minor
                                  Found in examples/custom-parsers/src/custom-parser.js - About 1 hr to fix

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

                                    export function serveFile(res /* : HttpResponse */, filepath: string) {
                                      const { size } = statSync(filepath);
                                      const readStream = createReadStream(filepath);
                                      const destroyReadStream = () => !readStream.destroyed && readStream.destroy();
                                    
                                    
                                    Severity: Minor
                                    Found in lib/uws.ts - About 1 hr to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language