robotty/dank-twitch-irc

View on GitHub

Showing 169 of 169 total issues

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

    it("should send NICK and PASS if password is specified", function () {
      sinon.useFakeTimers(); // prevent the promise timing out
      const { data, client } = fakeConnection();

      sendLogin(client, "justinfan12345", "SCHMOOPIE");
Severity: Major
Found in lib/operations/login.spec.ts and 1 other location - About 1 hr to fix
lib/operations/login.spec.ts on lines 25..31

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

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 4 locations. Consider refactoring.
Open

    it("sends the correct wire command", function () {
      sinon.useFakeTimers(); // prevent the promise timing out
      const { data, client } = fakeConnection();
      joinChannel(client, "pajlada");
      assert.deepEqual(data, ["JOIN #pajlada\r\n"]);
Severity: Major
Found in lib/operations/join.spec.ts and 3 other locations - About 1 hr to fix
lib/operations/get-mods-vips.spec.ts on lines 10..15
lib/operations/get-mods-vips.spec.ts on lines 87..92
lib/operations/ping.spec.ts on lines 10..17

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

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 4 locations. Consider refactoring.
Open

    it("sends the correct wire command", function () {
      sinon.useFakeTimers(); // prevent the promise timing out
      const { data, client } = fakeConnection();
      getMods(client, "pajlada");
      assert.deepEqual(data, ["PRIVMSG #pajlada :/mods\r\n"]);
Severity: Major
Found in lib/operations/get-mods-vips.spec.ts and 3 other locations - About 1 hr to fix
lib/operations/get-mods-vips.spec.ts on lines 87..92
lib/operations/join.spec.ts on lines 64..69
lib/operations/ping.spec.ts on lines 10..17

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

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 4 locations. Consider refactoring.
Open

    it("sends the correct wire command", function () {
      sinon.useFakeTimers(); // prevent the promise timing out
      const { data, client } = fakeConnection();
      getVips(client, "pajlada");
      assert.deepEqual(data, ["PRIVMSG #pajlada :/vips\r\n"]);
Severity: Major
Found in lib/operations/get-mods-vips.spec.ts and 3 other locations - About 1 hr to fix
lib/operations/get-mods-vips.spec.ts on lines 10..15
lib/operations/join.spec.ts on lines 64..69
lib/operations/ping.spec.ts on lines 10..17

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

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 4 locations. Consider refactoring.
Open

    it("should send the correct wire command if ping identifier is specified", function () {
      sinon.useFakeTimers(); // prevent the promise timing out
      const { data, client } = fakeConnection();

      sendPing(client, "some identifier");
Severity: Major
Found in lib/operations/ping.spec.ts and 3 other locations - About 1 hr to fix
lib/operations/get-mods-vips.spec.ts on lines 10..15
lib/operations/get-mods-vips.spec.ts on lines 87..92
lib/operations/join.spec.ts on lines 64..69

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

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

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

export function expandTransportConfig(
  config: TransportConfiguration | undefined
): ExpandedTransportConfiguration {
  if (config == null) {
    return expandTransportConfig({
Severity: Minor
Found in lib/config/expanded.ts - About 1 hr to fix

    Function acquire has 43 lines of code (exceeds 25 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 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 3 locations. Consider refactoring.
      Open

        describe("CapabilitiesError", function () {
          it("should be instanceof ConnectionError", function () {
            assert.instanceOf(new CapabilitiesError(), ConnectionError);
          });
          it("should not be instanceof ClientError", function () {
      Severity: Major
      Found in lib/operations/request-capabilities.spec.ts and 2 other locations - About 1 hr to fix
      lib/operations/login.spec.ts on lines 72..79
      lib/operations/ping.spec.ts on lines 68..75

      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 3 locations. Consider refactoring.
      Open

        describe("PingTimeoutError", function () {
          it("should be instanceof ConnectionError", function () {
            assert.instanceOf(new PingTimeoutError(), ConnectionError);
          });
          it("should not be instanceof ClientError", function () {
      Severity: Major
      Found in lib/operations/ping.spec.ts and 2 other locations - About 1 hr to fix
      lib/operations/login.spec.ts on lines 72..79
      lib/operations/request-capabilities.spec.ts on lines 132..139

      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 3 locations. Consider refactoring.
      Open

        describe("LoginError", function () {
          it("should be instanceof ConnectionError", function () {
            assert.instanceOf(new LoginError(), ConnectionError);
          });
          it("should not be instanceof ClientError", function () {
      Severity: Major
      Found in lib/operations/login.spec.ts and 2 other locations - About 1 hr to fix
      lib/operations/ping.spec.ts on lines 68..75
      lib/operations/request-capabilities.spec.ts on lines 132..139

      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

          it("should return 2-element array on 2 identical emotes", function () {
            const actual = tagParserFor({ key: "25:4-8,14-18" }).getEmotes(
              "key",
              "asd Kappa def Kappa def"
            );
      Severity: Major
      Found in lib/message/parser/tag-values.spec.ts and 1 other location - About 1 hr to fix
      lib/message/parser/tag-values.spec.ts on lines 247..256

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

      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

          it("should return 2-element array on 2 different emotes", function () {
            const actual = tagParserFor({ key: "25:4-8/1902:14-18" }).getEmotes(
              "key",
              "asd Kappa def Keepo def"
            );
      Severity: Major
      Found in lib/message/parser/tag-values.spec.ts and 1 other location - About 1 hr to fix
      lib/message/parser/tag-values.spec.ts on lines 236..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 68.

      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

      Function parseEmotes has a Cognitive Complexity of 13 (exceeds 5 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

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

            it("mutated correctly 2", () => {
              const inArr = [1, 2, 3];
              assert.strictEqual(
                findAndPushToEnd(inArr, (e) => e === 2),
                2
        Severity: Major
        Found in lib/utils/find-and-push-to-end.spec.ts and 1 other location - About 1 hr to fix
        lib/utils/find-and-push-to-end.spec.ts on lines 14..22

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

        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

            it("mutated correctly 1", () => {
              const inArr = [1, 2, 3];
              assert.strictEqual(
                findAndPushToEnd(inArr, (e) => e === 1),
                1
        Severity: Major
        Found in lib/utils/find-and-push-to-end.spec.ts and 1 other location - About 1 hr to fix
        lib/utils/find-and-push-to-end.spec.ts on lines 24..32

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

        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

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

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

                assert.deepStrictEqual(
                  actual,
                  new IRCMessage({
                    rawSource: ":leppunen PRIVMSG",
                    ircPrefixRaw: "leppunen",
          Severity: Major
          Found in lib/message/parser/irc-message.spec.ts and 1 other location - About 1 hr to fix
          lib/message/parser/irc-message.spec.ts on lines 142..156

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

          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

          Severity
          Category
          Status
          Source
          Language