coast-team/netflux

View on GitHub

Showing 73 of 75 total issues

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

  private rejoin() {
    this.setState(WebChannelState.JOINING)
    if (!isVisible() || !isOnline()) {
      this.internalLeave()
    } else {
Severity: Minor
Found in src/WebChannel.ts - About 1 hr to fix

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

      private handleMessage(bytes: ArrayBuffer) {
        try {
          const msg = proto.Message.decode(new Uint8Array(bytes))
          switch (msg.type) {
            case 'heartbeat':
    Severity: Minor
    Found in src/Signaling.ts - About 1 hr to fix

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

        private async proceedNegotiation(
          streamId: number,
          initiator: proto.Info,
          passive: proto.Info,
          amIInitiator: boolean
      Severity: Minor
      Found in src/service/channelBuilder/ChannelBuilder.ts - About 55 mins 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 connect has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

        connect(key: string): void {
          if (isWebSocketSupported()) {
            this.setState(SignalingState.CONNECTING)
            this.ws = new env.WebSocket(this.fullUrl(key))
            this.ws.binaryType = 'arraybuffer'
      Severity: Minor
      Found in src/Signaling.ts - About 55 mins 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 rejoin has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        private rejoin() {
          this.setState(WebChannelState.JOINING)
          if (!isVisible() || !isOnline()) {
            this.internalLeave()
          } else {
      Severity: Minor
      Found in src/WebChannel.ts - About 45 mins 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 onBrowserBack has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        private onBrowserBack() {
          if (isVisible() && isOnline()) {
            log.webgroup('onBrowserBack', { isVisible: isVisible(), isOnline: isOnline() })
            this.rejoinEnabled = this.autoRejoin
            if (this.rejoinEnabled) {
      Severity: Minor
      Found in src/WebChannel.ts - About 45 mins 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 decodeUserMessage has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        decodeUserMessage(bytes: Uint8Array, senderId: number): UserDataType | undefined {
          try {
            const { length, type, contentType, full, chunk } = super.decode(bytes) as {
              length: number
              type: proto.Message.Type
      Severity: Minor
      Found in src/service/UserMessage.ts - About 45 mins 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 readURLQuery has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        private readURLQuery(
          url: string
        ): {
          type: number
          wcId: number
      Severity: Minor
      Found in src/Bot.ts - About 35 mins 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 startHeartbeatInterval has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        private startHeartbeatInterval() {
          this.heartbeatInterval = setInterval(() => {
            this.adjacentMembers.forEach((ch) => ch.sendHeartbeat())
            this.distantMembers.forEach((peer, id) => {
              peer.missedHeartbeat++
      Severity: Minor
      Found in src/service/topology/FullMesh.ts - About 35 mins 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 handleMessage has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        handleMessage(msg: proto.Message) {
          if (msg.type) {
            switch (msg.type) {
              case 'offer':
                log.webrtc('REMOTE OFFER', { offer: msg.offer })
      Severity: Minor
      Found in src/service/dataChannelBuilder/Remote.ts - About 25 mins 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

      TODO found
      Open

      // TODO: add wrtc for WebRTC/RTCDataChannel support in NodeJS
      Severity: Minor
      Found in src/misc/polyfills.node.ts by fixme

      TODO found
      Open

                // TODO: implement when there are more than one topology implementation
      Severity: Minor
      Found in src/Channel.ts by fixme

      TODO found
      Open

                // TODO: this is a rare case, when the joining peer id equals to the
      Severity: Minor
      Found in src/Channel.ts by fixme
      Severity
      Category
      Status
      Source
      Language