Asymmetrik/node-rest-starter

View on GitHub

Showing 301 of 301 total issues

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

        it('read finds team', async () => {
            const t = await userService.read(user.admin._id);
            should.exist(t);
            t.name.should.equal('admin Name');
        });
Severity: Major
Found in src/app/core/teams/teams.service.spec.ts and 1 other location - About 1 hr to fix
src/app/core/teams/teams.service.spec.ts on lines 309..313

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

        [
            {
                inputQueryParams: null,
                expected: defaultLimit,
                name: 'should handle null values with default'
Severity: Major
Found in src/app/common/util.service.spec.ts and 1 other location - About 1 hr to fix
src/app/common/util.service.spec.ts on lines 369..423

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

        it('return existing explicit team role for user (plain object)', () => {
            const role = teamsService.getActiveTeamRole(
                user.explicit,
                team.teamWithNoExternalTeam
            );
Severity: Major
Found in src/app/core/teams/teams.service.spec.ts and 4 other locations - About 1 hr to fix
src/app/core/teams/teams.service.spec.ts on lines 191..199
src/app/core/teams/teams.service.spec.ts on lines 230..238
src/app/core/teams/teams.service.spec.ts on lines 260..268
src/app/core/teams/teams.service.spec.ts on lines 1318..1325

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

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 requesterCount = await User.countDocuments({
                teams: {
                    $elemMatch: {
                        _id: new mongoose.Types.ObjectId(team.teamWithNoExternalTeam._id),
                        role: 'requester'
Severity: Major
Found in src/app/core/teams/teams.service.spec.ts and 1 other location - About 1 hr to fix
src/app/core/teams/teams.service.spec.ts on lines 1021..1028

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

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 requesterCount = await User.countDocuments({
                teams: {
                    $elemMatch: {
                        _id: new mongoose.Types.ObjectId(team.teamWithNoExternalTeam2._id),
                        role: 'requester'
Severity: Major
Found in src/app/core/teams/teams.service.spec.ts and 1 other location - About 1 hr to fix
src/app/core/teams/teams.service.spec.ts on lines 1037..1044

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

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

        it('return existing explicit team role for user (model object)', () => {
            const role = teamsService.getActiveTeamRole(
                user.explicit,
                team.teamWithNoExternalTeam
            );
Severity: Major
Found in src/app/core/teams/teams.service.spec.ts and 4 other locations - About 1 hr to fix
src/app/core/teams/teams.service.spec.ts on lines 201..209
src/app/core/teams/teams.service.spec.ts on lines 230..238
src/app/core/teams/teams.service.spec.ts on lines 260..268
src/app/core/teams/teams.service.spec.ts on lines 1318..1325

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

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

            it('return implicit team role for user', () => {
                const role = teamsService.getActiveTeamRole(
                    user.implicit2,
                    team.teamWithExternalRoles
                );
Severity: Major
Found in src/app/core/teams/teams.service.spec.ts and 4 other locations - About 1 hr to fix
src/app/core/teams/teams.service.spec.ts on lines 191..199
src/app/core/teams/teams.service.spec.ts on lines 201..209
src/app/core/teams/teams.service.spec.ts on lines 230..238
src/app/core/teams/teams.service.spec.ts on lines 1318..1325

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

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

            it('Should get team role for root team', () => {
                const role = teamsService.getActiveTeamRole(
                    user.user1,
                    team.teamWithNoExternalTeam
                );
Severity: Major
Found in src/app/core/teams/teams.service.spec.ts and 4 other locations - About 1 hr to fix
src/app/core/teams/teams.service.spec.ts on lines 191..199
src/app/core/teams/teams.service.spec.ts on lines 201..209
src/app/core/teams/teams.service.spec.ts on lines 230..238
src/app/core/teams/teams.service.spec.ts on lines 260..268

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

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('error sending email', async () => {
            sandbox.stub(emailService, 'sendMail').rejects(new Error('error'));

            await userEmailService.emailApprovedUser(user, {});

Severity: Major
Found in src/app/core/user/user-email.service.spec.ts and 3 other locations - About 1 hr to fix
src/app/core/user/auth/user-password.service.spec.ts on lines 161..167
src/app/core/user/user-email.service.spec.ts on lines 79..85
src/app/core/user/user-email.service.spec.ts on lines 126..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 67.

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('error sending email', async () => {
            sandbox.stub(emailService, 'sendMail').rejects(new Error('error'));

            await userEmailService.welcomeWithAccessEmail(user, {});

Severity: Major
Found in src/app/core/user/user-email.service.spec.ts and 3 other locations - About 1 hr to fix
src/app/core/user/auth/user-password.service.spec.ts on lines 161..167
src/app/core/user/user-email.service.spec.ts on lines 35..41
src/app/core/user/user-email.service.spec.ts on lines 79..85

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

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('error sending email', async () => {
            sandbox.stub(emailService, 'sendMail').rejects(new Error('error'));

            await userPasswordService.sendPasswordResetConfirmEmail(testUser, {});

Severity: Major
Found in src/app/core/user/auth/user-password.service.spec.ts and 3 other locations - About 1 hr to fix
src/app/core/user/user-email.service.spec.ts on lines 35..41
src/app/core/user/user-email.service.spec.ts on lines 79..85
src/app/core/user/user-email.service.spec.ts on lines 126..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 67.

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('error sending email', async () => {
            sandbox.stub(emailService, 'sendMail').rejects(new Error('error'));

            await userEmailService.signupEmail(user, {});

Severity: Major
Found in src/app/core/user/user-email.service.spec.ts and 3 other locations - About 1 hr to fix
src/app/core/user/auth/user-password.service.spec.ts on lines 161..167
src/app/core/user/user-email.service.spec.ts on lines 35..41
src/app/core/user/user-email.service.spec.ts on lines 126..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 67.

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

            it('return implicit team role for user', () => {
                const role = teamsService.getActiveTeamRole(
                    user.implicit1,
                    team.teamWithExternalTeam
                );
Severity: Major
Found in src/app/core/teams/teams.service.spec.ts and 4 other locations - About 1 hr to fix
src/app/core/teams/teams.service.spec.ts on lines 191..199
src/app/core/teams/teams.service.spec.ts on lines 201..209
src/app/core/teams/teams.service.spec.ts on lines 260..268
src/app/core/teams/teams.service.spec.ts on lines 1318..1325

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

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 paginatePlugin has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function paginatePlugin<EnforcedDocType, TModelType, TInstanceMethods>(
    schema: Schema<EnforcedDocType, TModelType, TInstanceMethods>
) {
    schema.query['paginate'] = async function <DocType>(
        this: Query<HydratedDocument<DocType>[], DocType>,
Severity: Minor
Found in src/app/common/mongoose/paginate.plugin.ts - About 1 hr to fix

    Function updateCurrentUser has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export const updateCurrentUser = async (req, res) => {
        // Make sure the user is logged in
        if (null == req.user) {
            throw new BadRequestError('User is not logged in');
        }
    Severity: Minor
    Found in src/app/core/user/user.controller.ts - About 1 hr to fix

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

              it('test user with no roles access own resource', () => {
                  const user = { _id: id1 };
                  const resource = { creator: id1 };
      
                  return userAuthorizationService
      Severity: Major
      Found in src/app/core/user/auth/user-authorization.service.spec.ts and 1 other location - About 1 hr to fix
      src/app/core/user/auth/user-authorization.service.spec.ts on lines 309..316

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

      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('test user with no roles access another user resource', () => {
                  const user = { _id: id1 };
                  const resource = { creator: id2 };
      
                  return userAuthorizationService
      Severity: Major
      Found in src/app/core/user/auth/user-authorization.service.spec.ts and 1 other location - About 1 hr to fix
      src/app/core/user/auth/user-authorization.service.spec.ts on lines 300..307

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

      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

              if (!this.provider && config.has('mailer.provider')) {
                  const { default: Provider } = await import(
                      path.posix.resolve(config.get('mailer.provider'))
                  );
                  this.provider = new Provider(config.get('mailer.options'));
      Severity: Major
      Found in src/app/core/email/email.service.ts and 1 other location - About 1 hr to fix
      src/app/core/user/auth/user-authorization.service.ts on lines 131..138

      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

                  try {
                      const { default: Provider } = await import(
                          path.posix.resolve(config.get('auth.externalRoles.provider.file'))
                      );
                      this.provider = new Provider(
      Severity: Major
      Found in src/app/core/user/auth/user-authorization.service.ts and 1 other location - About 1 hr to fix
      src/app/core/email/email.service.ts on lines 140..145

      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

          it('should add paginate function to query', () => {
              const query = PaginateExample.find();
              should.exist(query.paginate);
      
              query.paginate.should.be.Function();
      Severity: Major
      Found in src/app/common/mongoose/paginate.plugin.spec.ts and 2 other locations - About 1 hr to fix
      src/app/common/mongoose/contains-search.plugin.spec.ts on lines 41..46
      src/app/common/mongoose/text-search.plugin.spec.ts on lines 25..30

      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