Asymmetrik/node-rest-starter

View on GitHub

Showing 301 of 301 total issues

File teams.service.spec.ts has 1442 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import _ from 'lodash';
import mongoose from 'mongoose';
import should from 'should';
import { assert, createSandbox } from 'sinon';

Severity: Major
Found in src/app/core/teams/teams.service.spec.ts - About 3 days to fix

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

                it('should have external roles and groups removed on login when cache expired', async () => {
                    req.headers = {
                        [config.get<string>('proxyPkiPrimaryUserHeader')]:
                            spec.user.expiredUser.providerData.dn
                    };
    Severity: Major
    Found in src/app/core/user/auth/user-authentication.controller.spec.ts and 1 other location - About 2 days to fix
    src/app/core/user/auth/user-authentication.controller.spec.ts on lines 470..493

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

    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 have external roles and groups removed on login when missing from cache', async () => {
                    req.headers = {
                        [config.get<string>('proxyPkiPrimaryUserHeader')]:
                            spec.user.missingUser.providerData.dn
                    };
    Severity: Major
    Found in src/app/core/user/auth/user-authentication.controller.spec.ts and 1 other location - About 2 days to fix
    src/app/core/user/auth/user-authentication.controller.spec.ts on lines 495..518

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

    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

        describe('teamMemberById', () => {
            it('team found', async () => {
                sandbox.stub(userService, 'read').resolves({
                    toObject: () => {
                        return {
    Severity: Major
    Found in src/app/core/teams/teams.controller.spec.ts and 1 other location - About 1 day to fix
    src/app/core/teams/teams.controller.spec.ts on lines 286..320

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

    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

        describe('teamById', () => {
            it('team found', async () => {
                sandbox.stub(teamsService, 'read').resolves({
                    toObject: () => {
                        return {
    Severity: Major
    Found in src/app/core/teams/teams.controller.spec.ts and 1 other location - About 1 day to fix
    src/app/core/teams/teams.controller.spec.ts on lines 322..360

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

    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

    File teams.service.ts has 648 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import _ from 'lodash';
    import mongoose, { FilterQuery, PopulateOptions, Types } from 'mongoose';
    
    import {
        TeamRoleImplicit,
    Severity: Major
    Found in src/app/core/teams/teams.service.ts - About 1 day to fix

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

                  it('implicit members enabled; nested teams enabled', async () => {
                      const configGetStub = sandbox.stub(config, 'get');
                      configGetStub.withArgs('teams.implicitMembers.enabled').returns(true);
                      configGetStub
                          .withArgs('teams.implicitMembers.strategy')
      Severity: Major
      Found in src/app/core/teams/teams.service.spec.ts and 1 other location - About 1 day to fix
      src/app/core/teams/teams.service.spec.ts on lines 1473..1493

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

      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('implicit members enabled; nested teams disabled', async () => {
                      const configGetStub = sandbox.stub(config, 'get');
                      configGetStub.withArgs('teams.implicitMembers.enabled').returns(true);
                      configGetStub
                          .withArgs('teams.implicitMembers.strategy')
      Severity: Major
      Found in src/app/core/teams/teams.service.spec.ts and 1 other location - About 1 day to fix
      src/app/core/teams/teams.service.spec.ts on lines 1514..1534

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

      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

      File user-authentication.controller.spec.ts has 554 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import _ from 'lodash';
      import { DateTime } from 'luxon';
      import passport from 'passport';
      import should from 'should';
      import { assert, createSandbox } from 'sinon';
      Severity: Major
      Found in src/app/core/user/auth/user-authentication.controller.spec.ts - About 1 day to fix

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

                it('search results page returned', async () => {
                    const queryParams = { size: 10 };
                    const query = null;
                    const search = '';
                    const result = await euaService.search(queryParams, search, query);
        Severity: Major
        Found in src/app/core/user/eua/eua.service.spec.ts and 2 other locations - About 1 day to fix
        src/app/core/access-checker/cache/cache-entry.service.spec.ts on lines 71..84
        src/app/core/user/user.service.spec.ts on lines 99..113

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

        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('search results page returned', async () => {
                    const queryParams = { size: 10 };
                    const query = null;
                    const search = '';
                    const result = await cacheEntryService.search(queryParams, search, query);
        src/app/core/user/eua/eua.service.spec.ts on lines 137..150
        src/app/core/user/user.service.spec.ts on lines 99..113

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

        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('search results page returned', async () => {
                    const queryParams = { size: 10 };
                    const query = null;
                    const search = '';
        
        
        Severity: Major
        Found in src/app/core/user/user.service.spec.ts and 2 other locations - About 1 day to fix
        src/app/core/access-checker/cache/cache-entry.service.spec.ts on lines 71..84
        src/app/core/user/eua/eua.service.spec.ts on lines 137..150

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

        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

        File util.service.spec.ts has 534 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import should from 'should';
        
        import { utilService } from '../../dependencies';
        
        /**
        Severity: Major
        Found in src/app/common/util.service.spec.ts - About 1 day to fix

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

                  it('should create mailOptions properly for inactivity template', async () => {
                      const expectedEmailContent = `HEADER
          <p>Hello ${user.name},</p>
          <br>
          <p>It seems you haven't logged into your ${config.get(
          Severity: Major
          Found in src/app/core/user/inactive/inactive-user.job.spec.ts and 1 other location - About 1 day to fix
          src/app/core/user/inactive/inactive-user.job.spec.ts on lines 34..67

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

          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 create mailOptions properly for deactivate template', async () => {
                      const expectedEmailContent = `HEADER
          <p>Hello ${user.name},</p>
          <br>
          <p>It seems you haven't logged into your ${config.get(
          Severity: Major
          Found in src/app/core/user/inactive/inactive-user.job.spec.ts and 1 other location - About 1 day to fix
          src/app/core/user/inactive/inactive-user.job.spec.ts on lines 69..102

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

          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('implicit members disabled; nested teams enabled', async () => {
                          const configGetStub = sandbox.stub(config, 'get');
                          configGetStub.withArgs('teams.implicitMembers.enabled').returns(false);
                          configGetStub.withArgs('teams.nestedTeams').returns(true);
                          configGetStub.callThrough();
          Severity: Major
          Found in src/app/core/teams/teams.service.spec.ts and 1 other location - About 1 day to fix
          src/app/core/teams/teams.service.spec.ts on lines 1454..1471

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

          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('implicit members disabled; nested teams disabled', async () => {
                          const configGetStub = sandbox.stub(config, 'get');
                          configGetStub.withArgs('teams.implicitMembers.enabled').returns(false);
                          configGetStub.withArgs('teams.nestedTeams').returns(false);
                          configGetStub.callThrough();
          Severity: Major
          Found in src/app/core/teams/teams.service.spec.ts and 1 other location - About 1 day to fix
          src/app/core/teams/teams.service.spec.ts on lines 1495..1512

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

          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('updateMemberRole', () => {
                  it('request handled', async () => {
                      const req = {
                          team: new Team(),
                          user: new User(),
          Severity: Major
          Found in src/app/core/teams/teams.controller.spec.ts and 2 other locations - About 7 hrs to fix
          src/app/core/teams/teams.controller.spec.ts on lines 179..200
          src/app/core/teams/teams.controller.spec.ts on lines 240..261

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

          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('removeMember', () => {
                  it('request handled', async () => {
                      const req = {
                          team: new Team(),
                          user: new User(),
          Severity: Major
          Found in src/app/core/teams/teams.controller.spec.ts and 2 other locations - About 7 hrs to fix
          src/app/core/teams/teams.controller.spec.ts on lines 179..200
          src/app/core/teams/teams.controller.spec.ts on lines 263..284

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

          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('addMember', () => {
                  it('request handled', async () => {
                      const req = {
                          team: new Team(),
                          user: new User(),
          Severity: Major
          Found in src/app/core/teams/teams.controller.spec.ts and 2 other locations - About 7 hrs to fix
          src/app/core/teams/teams.controller.spec.ts on lines 240..261
          src/app/core/teams/teams.controller.spec.ts on lines 263..284

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

          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