bcgov/common-forms-toolkit

View on GitHub

Showing 559 of 559 total issues

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

    this._routes.delete('/submissions/:submissionId', middleware.hasRole(this._resourceAccess, ['editor']), async (req, res, next) => {
      await this._controller.deleteSubmission(req, res, next);
    });
Severity: Major
Found in docs/sample/forms/myform/router.js and 17 other locations - About 1 hr to fix
app/src/forms/attestations/router.js on lines 14..16
app/src/forms/attestations/router.js on lines 18..20
app/src/forms/attestations/router.js on lines 30..32
app/src/forms/attestations/router.js on lines 34..36
app/src/forms/common/router.js on lines 27..29
app/src/forms/common/router.js on lines 31..33
app/src/forms/common/router.js on lines 35..37
app/src/forms/common/router.js on lines 39..41
app/src/forms/common/router.js on lines 43..45
app/src/forms/common/router.js on lines 47..49
app/src/forms/common/router.js on lines 51..53
app/src/forms/common/router.js on lines 55..57
app/src/forms/common/router.js on lines 59..61
docs/sample/forms/myform/router.js on lines 14..16
docs/sample/forms/myform/router.js on lines 18..20
docs/sample/forms/myform/router.js on lines 22..24
docs/sample/forms/myform/router.js on lines 30..32

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 59.

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

exports.down = function (knex) {
  return Promise.resolve()
    .then(() => knex.schema.raw(`DROP VIEW IF EXISTS ${FARM_PREFIX}_submission_search_vw`));
};
app/src/db/migrations/20200519140119_005-settings-table.js on lines 15..18
docs/sample/db/migrations/20200626145736_myform-form.js on lines 18..21

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

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

    this._routes.post('/submissions/:submissionId/notes', middleware.hasRole(this._resourceAccess, ['reviewer']), async (req, res, next) => {
      await this._controller.createSubmissionNote(req, res, next);
    });
Severity: Major
Found in app/src/forms/common/router.js and 17 other locations - About 1 hr to fix
app/src/forms/attestations/router.js on lines 14..16
app/src/forms/attestations/router.js on lines 18..20
app/src/forms/attestations/router.js on lines 30..32
app/src/forms/attestations/router.js on lines 34..36
app/src/forms/common/router.js on lines 27..29
app/src/forms/common/router.js on lines 31..33
app/src/forms/common/router.js on lines 35..37
app/src/forms/common/router.js on lines 39..41
app/src/forms/common/router.js on lines 47..49
app/src/forms/common/router.js on lines 51..53
app/src/forms/common/router.js on lines 55..57
app/src/forms/common/router.js on lines 59..61
docs/sample/forms/myform/router.js on lines 14..16
docs/sample/forms/myform/router.js on lines 18..20
docs/sample/forms/myform/router.js on lines 22..24
docs/sample/forms/myform/router.js on lines 30..32
docs/sample/forms/myform/router.js on lines 34..36

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

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

    this._routes.get('/submissions/:submissionId/notes', middleware.hasRole(this._resourceAccess, ['viewer']), async (req, res, next) => {
      await this._controller.readSubmissionNotes(req, res, next);
    });
Severity: Major
Found in app/src/forms/common/router.js and 17 other locations - About 1 hr to fix
app/src/forms/attestations/router.js on lines 14..16
app/src/forms/attestations/router.js on lines 18..20
app/src/forms/attestations/router.js on lines 30..32
app/src/forms/attestations/router.js on lines 34..36
app/src/forms/common/router.js on lines 27..29
app/src/forms/common/router.js on lines 31..33
app/src/forms/common/router.js on lines 35..37
app/src/forms/common/router.js on lines 39..41
app/src/forms/common/router.js on lines 43..45
app/src/forms/common/router.js on lines 51..53
app/src/forms/common/router.js on lines 55..57
app/src/forms/common/router.js on lines 59..61
docs/sample/forms/myform/router.js on lines 14..16
docs/sample/forms/myform/router.js on lines 18..20
docs/sample/forms/myform/router.js on lines 22..24
docs/sample/forms/myform/router.js on lines 30..32
docs/sample/forms/myform/router.js on lines 34..36

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

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

    this._routes.post('/settings', middleware.hasRole(this._resourceAccess, ['admin']), async (req, res, next) => {
      await this._controller.createSettings(req, res, next);
    });
Severity: Major
Found in app/src/forms/common/router.js and 17 other locations - About 1 hr to fix
app/src/forms/attestations/router.js on lines 14..16
app/src/forms/attestations/router.js on lines 18..20
app/src/forms/attestations/router.js on lines 30..32
app/src/forms/attestations/router.js on lines 34..36
app/src/forms/common/router.js on lines 27..29
app/src/forms/common/router.js on lines 31..33
app/src/forms/common/router.js on lines 35..37
app/src/forms/common/router.js on lines 39..41
app/src/forms/common/router.js on lines 43..45
app/src/forms/common/router.js on lines 47..49
app/src/forms/common/router.js on lines 51..53
app/src/forms/common/router.js on lines 59..61
docs/sample/forms/myform/router.js on lines 14..16
docs/sample/forms/myform/router.js on lines 18..20
docs/sample/forms/myform/router.js on lines 22..24
docs/sample/forms/myform/router.js on lines 30..32
docs/sample/forms/myform/router.js on lines 34..36

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

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

exports.down = function(knex) {
  return Promise.resolve()
    .then(() => knex.schema.dropTableIfExists(`${PREFIX}_settings`));
};
Severity: Major
Found in app/src/db/migrations/20200519140119_005-settings-table.js and 2 other locations - About 1 hr to fix
app/src/db/migrations/20210506111304-021-farmopscreening_submission_search_vw.js on lines 50..53
docs/sample/db/migrations/20200626145736_myform-form.js on lines 18..21

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

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

    this._routes.put('/current', middleware.hasRole(this._resourceAccess, ['admin']), async (req, res, next) => {
      await this._controller.update(req, res, next);
    });
Severity: Major
Found in docs/sample/forms/myform/router.js and 17 other locations - About 1 hr to fix
app/src/forms/attestations/router.js on lines 14..16
app/src/forms/attestations/router.js on lines 18..20
app/src/forms/attestations/router.js on lines 30..32
app/src/forms/attestations/router.js on lines 34..36
app/src/forms/common/router.js on lines 27..29
app/src/forms/common/router.js on lines 31..33
app/src/forms/common/router.js on lines 35..37
app/src/forms/common/router.js on lines 39..41
app/src/forms/common/router.js on lines 43..45
app/src/forms/common/router.js on lines 47..49
app/src/forms/common/router.js on lines 51..53
app/src/forms/common/router.js on lines 55..57
app/src/forms/common/router.js on lines 59..61
docs/sample/forms/myform/router.js on lines 14..16
docs/sample/forms/myform/router.js on lines 22..24
docs/sample/forms/myform/router.js on lines 30..32
docs/sample/forms/myform/router.js on lines 34..36

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

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

  async createSubmission(obj, user) {
    if (!obj) {
      throw Error(`${this._constants.TITLE} Submission cannot be created without data`);
    }

Severity: Minor
Found in app/src/forms/attestations/dataService.js - About 1 hr to fix

    Function updateWatchVariables has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      function updateWatchVariables(isAuthenticated = false) {
        watch.authenticated = isAuthenticated;
        watch.loginFn = keycloak.login;
        watch.login = keycloak.login;
        watch.createLoginUrl = keycloak.createLoginUrl;
    Severity: Minor
    Found in app/frontend/src/plugins/keycloak.js - About 1 hr to fix

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

        getTeamRoles(form, users = false) {
          const params = {};
          if (users) params.users = true;
      
          return formAxios(form).get(`${form}/team/roles`, { params });
      Severity: Major
      Found in app/frontend/src/services/commonFormService.js and 1 other location - About 1 hr to fix
      app/frontend/src/services/commonFormService.js on lines 248..253

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

      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

        getTeamUsers(form, roles = false) {
          const params = {};
          if (roles) params.roles = true;
      
          return formAxios(form).get(`${form}/team/users`, { params });
      Severity: Major
      Found in app/frontend/src/services/commonFormService.js and 1 other location - About 1 hr to fix
      app/frontend/src/services/commonFormService.js on lines 234..239

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 58.

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

        constructor(slug, controller, models) {
          this._resourceAccess = `comfort-${slug}`;
          this._controller = controller;
          this._models = models;
          this._routes = require('express').Router();
      Severity: Minor
      Found in docs/sample/forms/myform/router.js - About 1 hr to fix

        Function searchSubmissions has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          async searchSubmissions(params) {
            if (params && params.tiny) {
              const submissions = await this._models.SubmissionSearchView.query()
                .modify('filterVersion', params.version)
                .modify('filterConfirmationId', params.confirmationId)
        Severity: Minor
        Found in app/src/forms/attestations/dataService.js - About 1 hr to fix

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

              this._routes.get('/roles', middleware.hasRole(this._clientName, 'admin'), async (req, res, next) => {
                await this._controller.readRoles(req, res, next);
              });
          Severity: Major
          Found in app/src/forms/teammanagement/router.js and 8 other locations - About 1 hr to fix
          app/src/forms/common/router.js on lines 23..25
          app/src/forms/teammanagement/router.js on lines 23..25
          app/src/forms/teammanagement/router.js on lines 27..29
          app/src/forms/teammanagement/router.js on lines 31..33
          app/src/forms/teammanagement/router.js on lines 35..37
          app/src/forms/teammanagement/router.js on lines 43..45
          app/src/forms/teammanagement/router.js on lines 47..49
          app/src/forms/teammanagement/router.js on lines 51..53

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

          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

              this._routes.get('/users/:userId/roles', middleware.hasRole(this._clientName, 'admin'), async (req, res, next) => {
                await this._controller.readUserRoles(req, res, next);
              });
          Severity: Major
          Found in app/src/forms/teammanagement/router.js and 8 other locations - About 1 hr to fix
          app/src/forms/common/router.js on lines 23..25
          app/src/forms/teammanagement/router.js on lines 23..25
          app/src/forms/teammanagement/router.js on lines 27..29
          app/src/forms/teammanagement/router.js on lines 35..37
          app/src/forms/teammanagement/router.js on lines 39..41
          app/src/forms/teammanagement/router.js on lines 43..45
          app/src/forms/teammanagement/router.js on lines 47..49
          app/src/forms/teammanagement/router.js on lines 51..53

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

          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

              this._routes.put('/users/:userId/roles', middleware.hasRole(this._clientName, 'admin'), async (req, res, next) => {
                await this._controller.updateUserRoles(req, res, next);
              });
          Severity: Major
          Found in app/src/forms/teammanagement/router.js and 8 other locations - About 1 hr to fix
          app/src/forms/common/router.js on lines 23..25
          app/src/forms/teammanagement/router.js on lines 23..25
          app/src/forms/teammanagement/router.js on lines 27..29
          app/src/forms/teammanagement/router.js on lines 31..33
          app/src/forms/teammanagement/router.js on lines 39..41
          app/src/forms/teammanagement/router.js on lines 43..45
          app/src/forms/teammanagement/router.js on lines 47..49
          app/src/forms/teammanagement/router.js on lines 51..53

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

          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

              this._routes.get('/users', middleware.hasRole(this._clientName, 'admin'), async (req, res, next) => {
                await this._controller.readUsers(req, res, next);
              });
          Severity: Major
          Found in app/src/forms/teammanagement/router.js and 8 other locations - About 1 hr to fix
          app/src/forms/common/router.js on lines 23..25
          app/src/forms/teammanagement/router.js on lines 27..29
          app/src/forms/teammanagement/router.js on lines 31..33
          app/src/forms/teammanagement/router.js on lines 35..37
          app/src/forms/teammanagement/router.js on lines 39..41
          app/src/forms/teammanagement/router.js on lines 43..45
          app/src/forms/teammanagement/router.js on lines 47..49
          app/src/forms/teammanagement/router.js on lines 51..53

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

          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

              this._routes.get('/roles/:roleId', middleware.hasRole(this._clientName, 'admin'), async (req, res, next) => {
                await this._controller.readRole(req, res, next);
              });
          Severity: Major
          Found in app/src/forms/teammanagement/router.js and 8 other locations - About 1 hr to fix
          app/src/forms/common/router.js on lines 23..25
          app/src/forms/teammanagement/router.js on lines 23..25
          app/src/forms/teammanagement/router.js on lines 27..29
          app/src/forms/teammanagement/router.js on lines 31..33
          app/src/forms/teammanagement/router.js on lines 35..37
          app/src/forms/teammanagement/router.js on lines 39..41
          app/src/forms/teammanagement/router.js on lines 47..49
          app/src/forms/teammanagement/router.js on lines 51..53

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

          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

              this._routes.get('/roles/:roleId/users', middleware.hasRole(this._clientName, 'admin'), async (req, res, next) => {
                await this._controller.readRoleUsers(req, res, next);
              });
          Severity: Major
          Found in app/src/forms/teammanagement/router.js and 8 other locations - About 1 hr to fix
          app/src/forms/common/router.js on lines 23..25
          app/src/forms/teammanagement/router.js on lines 23..25
          app/src/forms/teammanagement/router.js on lines 27..29
          app/src/forms/teammanagement/router.js on lines 31..33
          app/src/forms/teammanagement/router.js on lines 35..37
          app/src/forms/teammanagement/router.js on lines 39..41
          app/src/forms/teammanagement/router.js on lines 43..45
          app/src/forms/teammanagement/router.js on lines 51..53

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

          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

              this._routes.get('/users/:userId', middleware.hasRole(this._clientName, 'admin'), async (req, res, next) => {
                await this._controller.readUser(req, res, next);
              });
          Severity: Major
          Found in app/src/forms/teammanagement/router.js and 8 other locations - About 1 hr to fix
          app/src/forms/common/router.js on lines 23..25
          app/src/forms/teammanagement/router.js on lines 23..25
          app/src/forms/teammanagement/router.js on lines 31..33
          app/src/forms/teammanagement/router.js on lines 35..37
          app/src/forms/teammanagement/router.js on lines 39..41
          app/src/forms/teammanagement/router.js on lines 43..45
          app/src/forms/teammanagement/router.js on lines 47..49
          app/src/forms/teammanagement/router.js on lines 51..53

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

          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