socketio/socket.io

View on GitHub

Showing 158 of 158 total issues

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

exports.config = {
  allScriptsTimeout: 11000,
  specs: [
    './src/**/*.e2e-spec.ts'
  ],
examples/angular-todomvc/e2e/protractor.conf.js on lines 10..37

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

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

File socket.ts has 407 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { Packet, PacketType } from "socket.io-parser";
import debugModule from "debug";
import type { Server } from "./index";
import {
  EventParams,
Severity: Minor
Found in lib/socket.ts - About 5 hrs to fix

    Socket has 40 functions (exceeds 20 allowed). Consider refactoring.
    Open

    export class Socket<
      ListenEvents extends EventsMap = DefaultEventsMap,
      EmitEvents extends EventsMap = ListenEvents,
      ServerSideEvents extends EventsMap = DefaultEventsMap,
      SocketData = any
    Severity: Minor
    Found in lib/socket.ts - About 5 hrs to fix

      Function Polling has 124 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        var Polling = /*#__PURE__*/function (_Transport) {
          _inherits(Polling, _Transport);
      
          var _super = _createSuper(Polling);
      
      
      Severity: Major
      Found in client-dist/socket.io.js - About 4 hrs to fix

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

          private run(
            socket: Socket<ListenEvents, EmitEvents, ServerSideEvents, SocketData>,
            fn: (err: ExtendedError | null) => void
          ) {
            const fns = this._fns.slice(0);
        Severity: Major
        Found in lib/namespace.ts and 1 other location - About 4 hrs to fix
        lib/socket.ts on lines 660..678

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

        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

        Function Request has 120 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          var Request = /*#__PURE__*/function (_Emitter) {
            _inherits(Request, _Emitter);
        
            var _super2 = _createSuper(Request);
        
        
        Severity: Major
        Found in client-dist/socket.io.js - About 4 hrs to fix

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

            private run(event: Event, fn: (err: Error | null) => void): void {
              const fns = this.fns.slice(0);
              if (!fns.length) return fn(null);
          
              function run(i: number) {
          Severity: Major
          Found in lib/socket.ts and 1 other location - About 4 hrs to fix
          lib/namespace.ts on lines 148..169

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

          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

          Function Decoder has 115 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            var Decoder = /*#__PURE__*/function (_Emitter) {
              _inherits(Decoder, _Emitter);
          
              var _super = _createSuper(Decoder);
          
          
          Severity: Major
          Found in client-dist/socket.io.js - About 4 hrs to fix

            Function WS has 113 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              var WS = /*#__PURE__*/function (_Transport) {
                _inherits(WS, _Transport);
            
                var _super = _createSuper(WS);
            
            
            Severity: Major
            Found in client-dist/socket.io.js - About 4 hrs to fix

              Function default has 109 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export default function (components: Components) {
                const { todoRepository } = components;
                return {
                  createTodo: async function (
                    payload: Omit<Todo, "id">,

                Server has 32 functions (exceeds 20 allowed). Consider refactoring.
                Open

                export class Server<
                  ListenEvents extends EventsMap = DefaultEventsMap,
                  EmitEvents extends EventsMap = ListenEvents,
                  ServerSideEvents extends EventsMap = DefaultEventsMap,
                  SocketData = any
                Severity: Minor
                Found in lib/index.ts - About 4 hrs to fix

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

                    socket.on('add user', username => {
                      if (addedUser) return;
                  
                      // we store the username in the socket session for this client
                      socket.username = username;
                  Severity: Major
                  Found in examples/cluster-nginx/server/index.js and 1 other location - About 3 hrs to fix
                  examples/chat/index.js on lines 33..48

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

                  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

                    socket.on('add user', (username) => {
                      if (addedUser) return;
                  
                      // we store the username in the socket session for this client
                      socket.username = username;
                  Severity: Major
                  Found in examples/chat/index.js and 1 other location - About 3 hrs to fix
                  examples/cluster-nginx/server/index.js on lines 42..57

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

                  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 3 locations. Consider refactoring.
                  Open

                      }, {
                        key: "reconnectionDelay",
                        value: function reconnectionDelay(v) {
                          var _a;
                  
                  
                  Severity: Major
                  Found in client-dist/socket.io.js and 2 other locations - About 3 hrs to fix
                  client-dist/socket.io.js on lines 3822..3832
                  client-dist/socket.io.js on lines 3832..3842

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

                  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 3 locations. Consider refactoring.
                  Open

                      }, {
                        key: "reconnectionDelayMax",
                        value: function reconnectionDelayMax(v) {
                          var _a;
                  
                  
                  Severity: Major
                  Found in client-dist/socket.io.js and 2 other locations - About 3 hrs to fix
                  client-dist/socket.io.js on lines 3812..3822
                  client-dist/socket.io.js on lines 3822..3832

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

                  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 3 locations. Consider refactoring.
                  Open

                      }, {
                        key: "randomizationFactor",
                        value: function randomizationFactor(v) {
                          var _a;
                  
                  
                  Severity: Major
                  Found in client-dist/socket.io.js and 2 other locations - About 3 hrs to fix
                  client-dist/socket.io.js on lines 3812..3822
                  client-dist/socket.io.js on lines 3832..3842

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

                  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

                  Function probe has 74 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                        value: function probe(name) {
                          var _this4 = this;
                  
                          var transport = this.createTransport(name);
                          var failed = false;
                  Severity: Major
                  Found in client-dist/socket.io.js - About 2 hrs to fix

                    Function Transport has 74 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      var Transport = /*#__PURE__*/function (_Emitter) {
                        _inherits(Transport, _Emitter);
                    
                        var _super = _createSuper(Transport);
                    
                    
                    Severity: Major
                    Found in client-dist/socket.io.js - About 2 hrs to fix

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

                          function Socket(uri) {
                            var _this;
                      
                            var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
                      
                      
                      Severity: Major
                      Found in client-dist/socket.io.js - About 2 hrs to fix

                        Function patchAdapter has 62 lines of code (exceeds 25 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: Major
                        Found in lib/uws.ts - About 2 hrs to fix
                          Severity
                          Category
                          Status
                          Source
                          Language