robotty/dank-twitch-irc

View on GitHub
lib/client/client.ts

Summary

Maintainability
D
1 day
Test Coverage
F
53%

ChatClient has 24 functions (exceeds 20 allowed). Consider refactoring.
Open

export class ChatClient extends BaseClient {
  public get wantedChannels(): Set<string> {
    return unionSets(this.connections.map((c) => c.wantedChannels));
  }

Severity: Minor
Found in lib/client/client.ts - About 2 hrs to fix

    File client.ts has 267 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import * as debugLogger from "debug-logger";
    import { getMods, getVips } from "../operations/get-mods-vips";
    import { ClientConfiguration } from "../config/config";
    import { Color } from "../message/color";
    import { ClientMixin, ConnectionMixin } from "../mixins/base-mixin";
    Severity: Minor
    Found in lib/client/client.ts - About 2 hrs to fix

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

        public newConnection(): SingleConnection {
          const conn = new SingleConnection(this.configuration);
      
          log.debug(`Creating new connection (ID ${conn.connectionID})`);
      
      
      Severity: Minor
      Found in lib/client/client.ts - About 1 hr to fix

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

          public async say(channelName: string, message: string): Promise<void> {
            channelName = correctChannelName(channelName);
            validateChannelName(channelName);
            await say(
              this.requireConnection(mustNotBeJoined(channelName)),
        Severity: Major
        Found in lib/client/client.ts and 1 other location - About 1 hr to fix
        lib/client/client.ts on lines 193..201

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

        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 async me(channelName: string, message: string): Promise<void> {
            channelName = correctChannelName(channelName);
            validateChannelName(channelName);
            await me(
              this.requireConnection(mustNotBeJoined(channelName)),
        Severity: Major
        Found in lib/client/client.ts and 1 other location - About 1 hr to fix
        lib/client/client.ts on lines 183..191

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

        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 async getVips(channelName: string): Promise<string[]> {
            channelName = correctChannelName(channelName);
            validateChannelName(channelName);
            return await getVips(this.requireConnection(), channelName);
          }
        Severity: Major
        Found in lib/client/client.ts and 1 other location - About 1 hr to fix
        lib/client/client.ts on lines 235..239

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

        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 async getMods(channelName: string): Promise<string[]> {
            channelName = correctChannelName(channelName);
            validateChannelName(channelName);
            return await getMods(this.requireConnection(), channelName);
          }
        Severity: Major
        Found in lib/client/client.ts and 1 other location - About 1 hr to fix
        lib/client/client.ts on lines 241..245

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

        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 get wantedChannels(): Set<string> {
            return unionSets(this.connections.map((c) => c.wantedChannels));
          }
        Severity: Minor
        Found in lib/client/client.ts and 1 other location - About 30 mins to fix
        lib/client/client.ts on lines 40..42

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

        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 get joinedChannels(): Set<string> {
            return unionSets(this.connections.map((c) => c.joinedChannels));
          }
        Severity: Minor
        Found in lib/client/client.ts and 1 other location - About 30 mins to fix
        lib/client/client.ts on lines 36..38

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

        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

        There are no issues that match your filters.

        Category
        Status