OpenHPS/openhps-socket

View on GitHub

Showing 4 of 15 total issues

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

    public connect(options: ClientOptions): Promise<void> {
        return new Promise<void>((resolve, reject) => {
            if (this._client && this._client.connected) {
                // Disconnect
                this._client.disconnect();
Severity: Major
Found in src/client/service/SocketClient.ts - About 3 hrs to fix

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

        private _onConnect(socket: io.Socket): void {
            this._clients.push(socket);
            this.logger('debug', {
                message: 'New client socket connection opened!',
            });
    Severity: Minor
    Found in src/server/service/SocketServer.ts - About 1 hr to fix

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

      const bundle = (env, module, prefix = "", name = PROJECT_NAME) => ({
        name,
        entry: `./dist/${module ? "esm" : "cjs"}/${prefix}index.js`,
        output: {
          path: path.resolve(__dirname, 'dist'),
      Severity: Minor
      Found in webpack.config.js - 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 _onInit has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private _onInit(): Promise<void> {
              return new Promise<void>((resolve) => {
                  switch (this._options.srv.constructor) {
                      case http.Server:
                      case https.Server:
      Severity: Minor
      Found in src/server/service/SocketServer.ts - About 1 hr to fix
        Severity
        Category
        Status
        Source
        Language