coast-team/netflux

View on GitHub

Showing 48 of 75 total issues

Function constructor has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  constructor(
    wc: WebChannel,
    wsOrDc: WebSocket | RTCDataChannel,
    type: number,
    id: number,
Severity: Minor
Found in src/Channel.ts - About 1 hr to fix

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

      constructor(
        id: number,
        pc: RTCPeerConnection,
        send: (msg: proto.IMessage) => void,
        remotes: Map<number, Remote>,
    Severity: Minor
    Found in src/service/dataChannelBuilder/Remote.ts - About 1 hr to fix

      Function initHandlers has 38 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        private initHandlers() {
          // Configure handlers
          this.wsOrDc.onmessage = ({ data }: { data: ArrayBuffer }) => {
            try {
              const msg = Message.decode(new Uint8Array(data))
      Severity: Minor
      Found in src/Channel.ts - About 1 hr to fix

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

          create(
            id: number,
            connectionTimeout: number,
            responseTimeout: number,
            onConnectionTimeoutCallback: () => void
        Severity: Minor
        Found in src/service/channelBuilder/ConnectionsInProgress.ts - About 1 hr to fix

          Function init has 37 lines of code (exceeds 25 allowed). Consider refactoring.
          Confirmed

            private init(): void {
              this.webSocketServer = new Server({
                perMessageDeflate: this.perMessageDeflate,
                verifyClient: (info: any) => this.validateURLQuery(info),
                server: this.server,
          Severity: Minor
          Found in src/Bot.ts - About 1 hr to fix

            Function subscribeToSignalingState has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Confirmed

              private subscribeToSignalingState() {
                this.signaling.onState.subscribe((state: SignalingState) => {
                  log.signalingState(SignalingState[state], this.myId)
                  this.onSignalingStateChange(state)
                  switch (state) {
            Severity: Minor
            Found in src/WebChannel.ts - About 1 hr to fix

              Function useAllStreams has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                protected useAllStreams(
                  wc: IStream<OutWcMessage, InWcMsg> & WebChannel,
                  sig: IStream<OutSigMsg, InSigMsg>
                ): IAllStreams<OutMsg, InMsg> {
                  const wcStream = this.useWebChannelStream(wc)
              Severity: Minor
              Found in src/service/Service.ts - About 1 hr to fix

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

                  constructor(options: IWebChannelOptions) {
                    const { topology, autoRejoin, rtcConfiguration, signalingServer } = {
                      ...webChannelDefaultOptions,
                      ...options,
                    }
                Severity: Minor
                Found in src/WebChannel.ts - About 1 hr to fix

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

                      connection.promise = new Promise((resolveResponse, rejectResponse) => {
                        const responseTimer = setTimeout(
                          () => connection.reject(new Error(ConnectionError.RESPONSE_TIMEOUT)),
                          responseTimeout
                        )
                  Severity: Minor
                  Found in src/service/channelBuilder/ConnectionsInProgress.ts - About 1 hr to fix

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

                      constructor(
                        id: number,
                        pc: RTCPeerConnection,
                        send: (msg: proto.IMessage) => void,
                        remotes: Map<number, Remote>,
                    Severity: Minor
                    Found in src/service/dataChannelBuilder/Remote.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 handleInitMessage has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      private handleInitMessage(msg: proto.Message) {
                        switch (msg.type) {
                          case 'initPing': {
                            log.channel(`${this.wc.myId} received InitPing`)
                            const { topology, wcId, senderId, members, key } = msg.initPing as proto.Data
                    Severity: Minor
                    Found in src/Channel.ts - About 1 hr to fix

                      Function proceedNegotiation has 30 lines of code (exceeds 25 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 1 hr to fix

                        Function readURLQuery has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          private readURLQuery(
                            url: string
                          ): {
                            type: number
                            wcId: number
                        Severity: Minor
                        Found in src/Bot.ts - About 1 hr to fix

                          Function connect has 28 lines of code (exceeds 25 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 1 hr to fix

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

                              constructor(wc: WebChannel) {
                                super(wc, FullMesh.SERVICE_ID, proto.Message)
                                this.adjacentMembers = new Map()
                                this.distantMembers = new Map()
                                this.antecedentId = 0
                            Severity: Minor
                            Found in src/service/topology/FullMesh.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 constructor has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                            Open

                              constructor(
                                wc: WebChannel,
                                wsOrDc: WebSocket | RTCDataChannel,
                                type: number,
                                id: number,
                            Severity: Minor
                            Found in src/Channel.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 constructor has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                            Open

                              constructor(options: BotOptions) {
                                botServer = new BotServer(options)
                            
                                /**
                                 * Read-only NodeJS http server instance.
                            Severity: Minor
                            Found in src/BotFacade.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 connectToMembers has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                            Open

                              private connectToMembers(ids: number[], adjacentId: number): Promise<void | void[]> {
                                const missingIds = ids.filter((id) => !this.adjacentMembers.has(id) && id !== this.wc.myId)
                                if (missingIds.length !== 0) {
                                  log.topology(`TRY TO CONNECT to members`, missingIds)
                                  const attempts: Array<Promise<void>> = []
                            Severity: Minor
                            Found in src/service/topology/FullMesh.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 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
                                Severity
                                Category
                                Status
                                Source
                                Language