HabitRPG/habitrpg

View on GitHub
test/api/v3/integration/groups/POST-groups_invite.test.js

Summary

Maintainability
F
1 wk
Test Coverage

File POST-groups_invite.test.js has 489 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { v4 as generateUUID } from 'uuid';
import nconf from 'nconf';
import {
  createAndPopulateGroup,
  generateUser,
Severity: Minor
Found in test/api/v3/integration/groups/POST-groups_invite.test.js - About 7 hrs to fix

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

        it('returns an error when inviter has no chat privileges', async () => {
          const inviterMuted = await inviter.updateOne({ 'flags.chatRevoked': true });
          const userToInvite = await generateUser();
          await expect(inviterMuted.post(`/groups/${group._id}/invite`, {
            uuids: [userToInvite._id],
    Severity: Major
    Found in test/api/v3/integration/groups/POST-groups_invite.test.js and 1 other location - About 5 hrs to fix
    test/api/v3/integration/groups/POST-groups_invite.test.js on lines 109..120

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

    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

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

        it('returns an error when inviter has no chat privileges', async () => {
          const inviterMuted = await inviter.updateOne({ 'flags.chatRevoked': true });
          const userToInvite = await generateUser();
          await expect(inviterMuted.post(`/groups/${group._id}/invite`, {
            uuids: [userToInvite._id],
    Severity: Major
    Found in test/api/v3/integration/groups/POST-groups_invite.test.js and 1 other location - About 5 hrs to fix
    test/api/v3/integration/groups/POST-groups_invite.test.js on lines 441..452

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

    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

          await expect(inviter.post(`/groups/${group._id}/invite`, {
            uuids: [userToInvite._id],
          }))
            .to.eventually.be.rejected.and.eql({
              code: 401,
    Severity: Major
    Found in test/api/v3/integration/groups/POST-groups_invite.test.js and 1 other location - About 4 hrs to fix
    test/api/v3/integration/groups/POST-groups_invite.test.js on lines 460..467

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

    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

          await expect(inviter.post(`/groups/${group._id}/invite`, {
            uuids: [userToInvite._id],
          }))
            .to.eventually.be.rejected.and.eql({
              code: 401,
    Severity: Major
    Found in test/api/v3/integration/groups/POST-groups_invite.test.js and 1 other location - About 4 hrs to fix
    test/api/v3/integration/groups/POST-groups_invite.test.js on lines 479..486

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

    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

          await expect(inviter.post(`/groups/${group._id}/invite`, {
            usernames: [inviter.auth.local.lowerCaseUsername],
          }))
            .to.eventually.be.rejected.and.eql({
              code: 400,
    Severity: Major
    Found in test/api/v3/integration/groups/POST-groups_invite.test.js and 1 other location - About 3 hrs to fix
    test/api/v3/integration/groups/POST-groups_invite.test.js on lines 54..61

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

    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('returns an error when emails is empty and uuids is not passed', async () => {
          await expect(inviter.post(`/groups/${group._id}/invite`, {
            emails: [],
          }))
            .to.eventually.be.rejected.and.eql({
    Severity: Major
    Found in test/api/v3/integration/groups/POST-groups_invite.test.js and 1 other location - About 3 hrs to fix
    test/api/v3/integration/groups/POST-groups_invite.test.js on lines 171..180

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

    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

          await expect(inviterNoBlocks.post(`/groups/${group._id}/invite`, {
            usernames: [userWithBlockedInviter.auth.local.lowerCaseUsername],
          }))
            .to.eventually.be.rejected.and.eql({
              code: 401,
    Severity: Major
    Found in test/api/v3/integration/groups/POST-groups_invite.test.js and 1 other location - About 3 hrs to fix
    test/api/v3/integration/groups/POST-groups_invite.test.js on lines 41..48

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

    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('returns an error when uuids is empty and emails is not passed', async () => {
          await expect(inviter.post(`/groups/${group._id}/invite`, {
            uuids: [],
          }))
            .to.eventually.be.rejected.and.eql({
    Severity: Major
    Found in test/api/v3/integration/groups/POST-groups_invite.test.js and 1 other location - About 3 hrs to fix
    test/api/v3/integration/groups/POST-groups_invite.test.js on lines 306..315

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

    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

          await expect(inviter.post(`/groups/${group._id}/invite`, {
            usernames: [fakeID],
          }))
            .to.eventually.be.rejected.and.eql({
              code: 404,
    Severity: Major
    Found in test/api/v3/integration/groups/POST-groups_invite.test.js and 1 other location - About 2 hrs to fix
    test/api/v3/integration/groups/POST-groups_invite.test.js on lines 125..132

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

    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

          await expect(inviter.post(`/groups/${group._id}/invite`, {
            uuids: [fakeID],
          }))
            .to.eventually.be.rejected.and.eql({
              code: 404,
    Severity: Major
    Found in test/api/v3/integration/groups/POST-groups_invite.test.js and 1 other location - About 2 hrs to fix
    test/api/v3/integration/groups/POST-groups_invite.test.js on lines 30..37

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

    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

          await expect(inviter.post(`/groups/${group._id}/invite`, {
            uuids,
          }))
            .to.eventually.be.rejected.and.eql({
              code: 400,
    Severity: Major
    Found in test/api/v3/integration/groups/POST-groups_invite.test.js and 1 other location - About 2 hrs to fix
    test/api/v3/integration/groups/POST-groups_invite.test.js on lines 324..331

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

    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

          await expect(inviter.post(`/groups/${group._id}/invite`, {
            emails,
          }))
            .to.eventually.be.rejected.and.eql({
              code: 400,
    Severity: Major
    Found in test/api/v3/integration/groups/POST-groups_invite.test.js and 1 other location - About 2 hrs to fix
    test/api/v3/integration/groups/POST-groups_invite.test.js on lines 189..196

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

    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

          await expect(inviter.post(`/groups/${group._id}/invite`, {
            emails: { testInvite },
          }))
            .to.eventually.be.rejected.and.eql({
              code: 400,
    Severity: Major
    Found in test/api/v3/integration/groups/POST-groups_invite.test.js and 1 other location - About 2 hrs to fix
    test/api/v3/integration/groups/POST-groups_invite.test.js on lines 149..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 91.

    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

          await expect(inviter.post(`/groups/${group._id}/invite`, {
            uuids: { fakeID },
          }))
            .to.eventually.be.rejected.and.eql({
              code: 400,
    Severity: Major
    Found in test/api/v3/integration/groups/POST-groups_invite.test.js and 1 other location - About 2 hrs to fix
    test/api/v3/integration/groups/POST-groups_invite.test.js on lines 296..303

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

    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

          await expect(inviterMuted.post(`/groups/${group._id}/invite`, {
            emails: [testInvite],
            inviter: 'inviter name',
          }))
            .to.eventually.be.rejected.and.eql({
    Severity: Major
    Found in test/api/v3/integration/groups/POST-groups_invite.test.js and 1 other location - About 1 hr to fix
    test/api/v3/integration/groups/POST-groups_invite.test.js on lines 340..348

    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

          await expect(inviterWithMax.post(`/groups/${group._id}/invite`, {
            emails: [testInvite],
            inviter: 'inviter name',
          }))
            .to.eventually.be.rejected.and.eql({
    Severity: Major
    Found in test/api/v3/integration/groups/POST-groups_invite.test.js and 1 other location - About 1 hr to fix
    test/api/v3/integration/groups/POST-groups_invite.test.js on lines 273..281

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

          await expect(inviter.post(`/groups/${group._id}/invite`, {
            emails,
            uuids,
          }))
            .to.eventually.be.rejected.and.eql({
    Severity: Major
    Found in test/api/v3/integration/groups/POST-groups_invite.test.js and 2 other locations - About 1 hr to fix
    test/api/v3/integration/webhook/PUT-user_update_webhook.test.js on lines 160..164
    test/api/v3/integration/webhook/PUT-user_update_webhook.test.js on lines 173..177

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

    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

          const invite = await inviter.post(`/groups/${group._id}/invite`, {
            uuids: [newUser._id],
            emails: [{ name: 'test', email: 'test@habitica.com' }],
          });
    Severity: Major
    Found in test/api/v3/integration/groups/POST-groups_invite.test.js and 1 other location - About 1 hr to fix
    test/api/v3/integration/groups/POST-groups_invite.test.js on lines 428..431

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

    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

          const invite = await inviter.post(`/groups/${cancelledPlanGroup._id}/invite`, {
            uuids: [newUser._id],
            emails: [{ name: 'test', email: 'test@habitica.com' }],
          });
    Severity: Major
    Found in test/api/v3/integration/groups/POST-groups_invite.test.js and 1 other location - About 1 hr to fix
    test/api/v3/integration/groups/POST-groups_invite.test.js on lines 410..413

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

    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

          for (let i = 0; i < 50; i += 1) {
            emails.push(`${generateUUID()}@habitica.com`);
          }
    Severity: Minor
    Found in test/api/v3/integration/groups/POST-groups_invite.test.js and 1 other location - About 40 mins to fix
    test/api/v3/integration/groups/POST-groups_invite.test.js on lines 320..322

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

    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

          for (let i = 0; i < 101; i += 1) {
            emails.push(`${generateUUID()}@habitica.com`);
          }
    Severity: Minor
    Found in test/api/v3/integration/groups/POST-groups_invite.test.js and 1 other location - About 40 mins to fix
    test/api/v3/integration/groups/POST-groups_invite.test.js on lines 389..391

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

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

          await expect(userToInvite2.get('/user')).to.eventually.have.nested.property('invitations.parties[0].id', group._id);
    Severity: Major
    Found in test/api/v3/integration/groups/POST-groups_invite.test.js and 8 other locations - About 35 mins to fix
    test/api/v3/integration/groups/POST-groups_groupId_join.test.js on lines 145..145
    test/api/v3/integration/groups/POST-groups_groupId_join.test.js on lines 152..152
    test/api/v3/integration/groups/POST-groups_groupId_join.test.js on lines 155..155
    test/api/v3/integration/groups/POST-groups_invite.test.js on lines 77..78
    test/api/v3/integration/groups/POST-groups_invite.test.js on lines 103..103
    test/api/v3/integration/groups/POST-groups_invite.test.js on lines 104..104
    test/api/v3/integration/groups/POST-groups_invite.test.js on lines 225..226
    test/api/v3/integration/groups/POST-groups_invite.test.js on lines 249..249

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

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

          await expect(userToInvite.get('/user'))
            .to.eventually.have.nested.property('invitations.parties[0].id', group._id);
    Severity: Major
    Found in test/api/v3/integration/groups/POST-groups_invite.test.js and 8 other locations - About 35 mins to fix
    test/api/v3/integration/groups/POST-groups_groupId_join.test.js on lines 145..145
    test/api/v3/integration/groups/POST-groups_groupId_join.test.js on lines 152..152
    test/api/v3/integration/groups/POST-groups_groupId_join.test.js on lines 155..155
    test/api/v3/integration/groups/POST-groups_invite.test.js on lines 103..103
    test/api/v3/integration/groups/POST-groups_invite.test.js on lines 104..104
    test/api/v3/integration/groups/POST-groups_invite.test.js on lines 225..226
    test/api/v3/integration/groups/POST-groups_invite.test.js on lines 249..249
    test/api/v3/integration/groups/POST-groups_invite.test.js on lines 250..250

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

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

          await expect(userToInvite.get('/user'))
            .to.eventually.have.nested.property('invitations.parties[0].id', group._id);
    Severity: Major
    Found in test/api/v3/integration/groups/POST-groups_invite.test.js and 8 other locations - About 35 mins to fix
    test/api/v3/integration/groups/POST-groups_groupId_join.test.js on lines 145..145
    test/api/v3/integration/groups/POST-groups_groupId_join.test.js on lines 152..152
    test/api/v3/integration/groups/POST-groups_groupId_join.test.js on lines 155..155
    test/api/v3/integration/groups/POST-groups_invite.test.js on lines 77..78
    test/api/v3/integration/groups/POST-groups_invite.test.js on lines 103..103
    test/api/v3/integration/groups/POST-groups_invite.test.js on lines 104..104
    test/api/v3/integration/groups/POST-groups_invite.test.js on lines 249..249
    test/api/v3/integration/groups/POST-groups_invite.test.js on lines 250..250

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

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

          await expect(userToInvite.get('/user')).to.eventually.have.nested.property('invitations.parties[0].id', group._id);
    Severity: Major
    Found in test/api/v3/integration/groups/POST-groups_invite.test.js and 8 other locations - About 35 mins to fix
    test/api/v3/integration/groups/POST-groups_groupId_join.test.js on lines 145..145
    test/api/v3/integration/groups/POST-groups_groupId_join.test.js on lines 152..152
    test/api/v3/integration/groups/POST-groups_groupId_join.test.js on lines 155..155
    test/api/v3/integration/groups/POST-groups_invite.test.js on lines 77..78
    test/api/v3/integration/groups/POST-groups_invite.test.js on lines 103..103
    test/api/v3/integration/groups/POST-groups_invite.test.js on lines 104..104
    test/api/v3/integration/groups/POST-groups_invite.test.js on lines 225..226
    test/api/v3/integration/groups/POST-groups_invite.test.js on lines 250..250

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

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

          await expect(userToInvite2.get('/user')).to.eventually.have.nested.property('invitations.parties[0].id', group._id);
    Severity: Major
    Found in test/api/v3/integration/groups/POST-groups_invite.test.js and 8 other locations - About 35 mins to fix
    test/api/v3/integration/groups/POST-groups_groupId_join.test.js on lines 145..145
    test/api/v3/integration/groups/POST-groups_groupId_join.test.js on lines 152..152
    test/api/v3/integration/groups/POST-groups_groupId_join.test.js on lines 155..155
    test/api/v3/integration/groups/POST-groups_invite.test.js on lines 77..78
    test/api/v3/integration/groups/POST-groups_invite.test.js on lines 103..103
    test/api/v3/integration/groups/POST-groups_invite.test.js on lines 225..226
    test/api/v3/integration/groups/POST-groups_invite.test.js on lines 249..249
    test/api/v3/integration/groups/POST-groups_invite.test.js on lines 250..250

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

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

          await expect(userToInvite.get('/user')).to.eventually.have.nested.property('invitations.parties[0].id', group._id);
    Severity: Major
    Found in test/api/v3/integration/groups/POST-groups_invite.test.js and 8 other locations - About 35 mins to fix
    test/api/v3/integration/groups/POST-groups_groupId_join.test.js on lines 145..145
    test/api/v3/integration/groups/POST-groups_groupId_join.test.js on lines 152..152
    test/api/v3/integration/groups/POST-groups_groupId_join.test.js on lines 155..155
    test/api/v3/integration/groups/POST-groups_invite.test.js on lines 77..78
    test/api/v3/integration/groups/POST-groups_invite.test.js on lines 104..104
    test/api/v3/integration/groups/POST-groups_invite.test.js on lines 225..226
    test/api/v3/integration/groups/POST-groups_invite.test.js on lines 249..249
    test/api/v3/integration/groups/POST-groups_invite.test.js on lines 250..250

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

    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

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

          await expect(partyLeader.post(`/groups/${group._id}/invite`, {
            uuids: generatedInvites.map(invite => invite._id),
          }))
    Severity: Minor
    Found in test/api/v3/integration/groups/POST-groups_invite.test.js and 1 other location - About 30 mins to fix
    test/api/v3/integration/groups/POST-groups_invite.test.js on lines 555..557

    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

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

          expect(await partyLeader.post(`/groups/${group._id}/invite`, {
            uuids: generatedInvites.map(invite => invite._id),
          })).to.be.an('array');
    Severity: Minor
    Found in test/api/v3/integration/groups/POST-groups_invite.test.js and 1 other location - About 30 mins to fix
    test/api/v3/integration/groups/POST-groups_invite.test.js on lines 568..570

    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