robotty/dank-twitch-irc

View on GitHub

Showing 35 of 169 total issues

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

export function splitIntoChunks(
  bits: string[],
  separator = " ",
  limit: number
): string[][] {
Severity: Minor
Found in lib/utils/split-into-chunks.ts - About 1 hr to fix

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

    export function splitIntoChunks(
      bits: string[],
      separator = " ",
      limit: number
    ): string[][] {
    Severity: Minor
    Found in lib/utils/split-into-chunks.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 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      public constructor(message: IRCMessageData) {
        super(message);
    
        this.messageText = getParameter(this, 1);
    
    
    Severity: Minor
    Found in lib/message/twitch-types/usernotice.ts - About 1 hr to fix

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

      async function getModsOrVips(
        conn: SingleConnection,
        channelName: string,
        config: GetUsersConfig
      ): Promise<string[]> {
      Severity: Minor
      Found in lib/operations/get-mods-vips.ts - About 1 hr to fix

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

          public constructor(ircMessage: IRCMessage) {
            super(ircMessage);
        
            const { isAction, message } = parseActionAndMessage(
              requireParameter(this, 1)
        Severity: Minor
        Found in lib/message/twitch-types/privmsg.ts - About 1 hr to fix

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

          export function parseEmotes(
            messageText: string,
            emotesSrc: string
          ): TwitchEmoteList {
            const emotes: TwitchEmoteList = [];
          Severity: Minor
          Found in lib/message/parser/emotes.ts - About 1 hr to fix

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

            function assertLink(e: Error, chain: any[], depth = 0): void {
              const [errorType, message, ...newChain] = chain;
            
              const actualPrototype = Object.getPrototypeOf(e);
              const expectedPrototype = errorType.prototype;
            Severity: Minor
            Found in lib/helpers.spec.ts - About 1 hr to fix

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

              export async function joinAll(
                conn: SingleConnection,
                channelNames: string[]
              ): Promise<Record<string, Error | undefined>> {
                // e.g. "JOIN #firstchannel,#secondchannel,#thirdchannel"
              Severity: Minor
              Found in lib/operations/join-all.ts - About 1 hr to fix

                Function timeout has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                  conn: SingleConnection,
                  channelName: string,
                  username: string,
                  length: number,
                  reason?: string
                Severity: Minor
                Found in lib/operations/timeout.ts - About 35 mins to fix

                  Avoid too many return statements within this function.
                  Open

                      return releaseFn;
                  Severity: Major
                  Found in lib/mixins/ratelimiters/slow-mode.ts - About 30 mins to fix

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

                      public constructor(message?: string, cause?: Error | undefined) {
                        let newMessage;
                        if (
                          message != null &&
                          cause != null &&
                    Severity: Minor
                    Found in lib/utils/base-error.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

                    Function onUserStateChange has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                      private onUserStateChange(channelName: string, newState: UserState): void {
                        const { fastSpam, certain } = canSpamFast(
                          channelName,
                          this.client.configuration.username,
                          newState
                    Severity: Minor
                    Found in lib/mixins/ratelimiters/slow-mode.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

                    Function applyToClient has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                      public applyToClient(client: ChatClient): void {
                        type GenericReplacementFn = (
                          oldFn: (channelName: string, message: string) => Promise<void>,
                          channelName: string,
                          message: string
                    Severity: Minor
                    Found in lib/mixins/alternate-message-modifier.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

                    Function extractEventParams has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                    export function extractEventParams(tags: IRCMessageTags): EventParams {
                      const params: EventParams = {};
                    
                      // converts all msg-param-* tags into a new "params" object where keys are camelCased
                      // and boolean/integer tags are parsed (including a identically named "Raw" property).
                    Severity: Minor
                    Found in lib/message/twitch-types/usernotice.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

                    Function acquire has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                      private async acquire(
                        channelName: string
                      ): Promise<(() => void) | undefined> {
                        const { fastSpam, certain } = canSpamFast(
                          channelName,
                    Severity: Minor
                    Found in lib/mixins/ratelimiters/slow-mode.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

                    Severity
                    Category
                    Status
                    Source
                    Language