socketio/socket.io

View on GitHub

Showing 158 of 158 total issues

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

function App() {
  const [isConnected, setIsConnected] = useState(socket.connected);
  const [lastMessage, setLastMessage] = useState(null);

  useEffect(() => {
Severity: Minor
Found in examples/create-react-app-example/src/App.js - About 1 hr to fix

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

      public except(
        room: Room | Room[]
      ): BroadcastOperator<EmitEvents, SocketData> {
        return this.newBroadcastOperator().except(room);
      }
    Severity: Major
    Found in lib/socket.ts and 2 other locations - About 1 hr to fix
    lib/socket.ts on lines 257..259
    lib/socket.ts on lines 268..270

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

    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 constructor has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      constructor() {
        this.socket = io(environment.serverUrl);
    
        this.socket.on("connect", () => {
          this.socket.emit("todo:list", (res) => {
    Severity: Minor
    Found in examples/basic-crud-application/angular-client/src/app/store.ts - About 1 hr to fix

      Function of has 28 lines of code (exceeds 25 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

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

              value: function emit(ev) {
                if (RESERVED_EVENTS.hasOwnProperty(ev)) {
                  throw new Error('"' + ev + '" is a reserved event name');
                }
        
        
        Severity: Minor
        Found in client-dist/socket.io.js - About 1 hr to fix

          Function sendFile has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            private static sendFile(
              filename: string,
              req: http.IncomingMessage,
              res: http.ServerResponse
            ): void {
          Severity: Minor
          Found in lib/index.ts - About 1 hr to fix

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

                      for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
                        args[_key4] = arguments[_key4];
                      }
            Severity: Major
            Found in client-dist/socket.io.js and 2 other locations - About 1 hr to fix
            client-dist/socket.io.js on lines 3115..3117
            client-dist/socket.io.js on lines 3204..3206

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

            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

              public to(room: Room | Room[]): BroadcastOperator<EmitEvents, SocketData> {
                return this.sockets.to(room);
              }
            Severity: Major
            Found in lib/index.ts and 2 other locations - About 1 hr to fix
            lib/index.ts on lines 678..680
            lib/index.ts on lines 689..693

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

            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

              public in(room: Room | Room[]): BroadcastOperator<EmitEvents, SocketData> {
                return this.sockets.in(room);
              }
            Severity: Major
            Found in lib/index.ts and 2 other locations - About 1 hr to fix
            lib/index.ts on lines 667..669
            lib/index.ts on lines 689..693

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

            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

                    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
                      args[_key] = arguments[_key];
                    }
            Severity: Major
            Found in client-dist/socket.io.js and 2 other locations - About 1 hr to fix
            client-dist/socket.io.js on lines 3204..3206
            client-dist/socket.io.js on lines 3393..3395

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

            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

              public except(
                name: Room | Room[]
              ): BroadcastOperator<EmitEvents, SocketData> {
                return this.sockets.except(name);
              }
            Severity: Major
            Found in lib/index.ts and 2 other locations - About 1 hr to fix
            lib/index.ts on lines 667..669
            lib/index.ts on lines 678..680

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

            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

                      for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
                        args[_key3] = arguments[_key3];
                      }
            Severity: Major
            Found in client-dist/socket.io.js and 2 other locations - About 1 hr to fix
            client-dist/socket.io.js on lines 3115..3117
            client-dist/socket.io.js on lines 3393..3395

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

            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 connect has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              private connect(name: string, auth: object = {}): void {
                if (this.server._nsps.has(name)) {
                  debug("connecting to namespace %s", name);
                  return this.doConnect(name, auth);
                }
            Severity: Minor
            Found in lib/client.ts - About 1 hr to fix

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

                var decode$1 = function decode(base64) {
                  var bufferLength = base64.length * 0.75,
                      len = base64.length,
                      i,
                      p = 0,
              Severity: Minor
              Found in client-dist/socket.io.js - About 1 hr to fix

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

                  _add(
                    client: Client<ListenEvents, EmitEvents, ServerSideEvents>,
                    query,
                    fn?: () => void
                  ): Socket<ListenEvents, EmitEvents, ServerSideEvents, SocketData> {
                Severity: Minor
                Found in lib/namespace.ts - About 1 hr to fix

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

                    socket.on('new message', data => {
                      // we tell the client to execute 'new message'
                      socket.broadcast.emit('new message', {
                        username: socket.username,
                        message: data
                  Severity: Major
                  Found in examples/cluster-nginx/server/index.js and 1 other location - About 1 hr to fix
                  examples/chat/index.js on lines 24..30

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

                  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

                    public send(...args: EventParams<EmitEvents, "message">): this {
                      this.sockets.emit("message", ...args);
                      return this;
                    }
                  Severity: Major
                  Found in lib/index.ts and 1 other location - About 1 hr to fix
                  lib/index.ts on lines 712..715

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

                  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('new message', (data) => {
                      // we tell the client to execute 'new message'
                      socket.broadcast.emit('new message', {
                        username: socket.username,
                        message: data
                  Severity: Major
                  Found in examples/chat/index.js and 1 other location - About 1 hr to fix
                  examples/cluster-nginx/server/index.js on lines 33..39

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

                  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

                    public write(...args: EventParams<EmitEvents, "message">): this {
                      this.sockets.emit("message", ...args);
                      return this;
                    }
                  Severity: Major
                  Found in lib/index.ts and 1 other location - About 1 hr to fix
                  lib/index.ts on lines 701..704

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

                  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

                          case 2:
                            decoded = numericSchema.decode(obj);
                            packet.data = [ 'numeric', decoded.data ];
                            packet.nsp = decoded.nsp;
                            break;
                  Severity: Minor
                  Found in examples/custom-parsers/src/custom-parser.js and 1 other location - About 55 mins to fix
                  examples/custom-parsers/src/custom-parser.js on lines 98..102

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

                  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

                  Severity
                  Category
                  Status
                  Source
                  Language