bcgov/common-forms-toolkit

View on GitHub

Showing 559 of 559 total issues

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

      if (!this._equalTo(currentSubmission.contacts.find(x => x.contactType === this._constants.CONTACT_TYPE_COVID), covid)) {
        covid.updatedBy = user.username;
        await this._models.Contact.query(trx).patchAndFetchById(covid.contactId, covid);
        doTheUpdate = true;
      }
Severity: Major
Found in app/src/forms/attestations/dataService.js and 1 other location - About 1 hr to fix
app/src/forms/attestations/dataService.js on lines 303..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 60.

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

      data() {
        return {
          ready: false,
          authenticated: false,
          userName: null,
Severity: Minor
Found in app/frontend/src/plugins/keycloak.js - About 1 hr to fix

    Function down has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    exports.down = function(knex) {
      return Promise.resolve()
        .then(() => {
          return knex(`${PREFIX}_settings`).del();
        })
    Severity: Minor
    Found in docs/sample/db/migrations/20200626145742_myform-data.js - About 1 hr to fix

      Function updateSubmission has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        async updateSubmission(submissionId, obj, user) {
          // update: location, contacts, business
          if (!obj) {
            throw Error(`${this._constants.TITLE} Submission cannot be updated without data`);
          }
      Severity: Minor
      Found in docs/sample/forms/myform/dataService.js - About 1 hr to fix

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

            this._routes.post('/submissions/:submissionId/statuses', middleware.hasRole(this._resourceAccess, ['reviewer']), async (req, res, next) => {
              await this._controller.createSubmissionStatus(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 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
        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 modifiers has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          static get modifiers() {
            return {
              orderDescending(builder) {
                builder.orderBy('createdAt', 'desc');
              },
        Severity: Minor
        Found in app/src/forms/attestations/models/submission.js - About 1 hr to fix

          Function modifiers has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            static get modifiers() {
              return {
                orderDescending(builder) {
                  builder.orderBy('createdAt', 'desc');
                },
          Severity: Minor
          Found in app/src/forms/attestations/models/submission.js - About 1 hr to fix

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

                this._routes.put('/submissions/:submissionId', middleware.hasRole(this._resourceAccess, ['editor']), async (req, res, next) => {
                  await this._controller.updateSubmission(req, res, next);
                });
            Severity: Major
            Found in app/src/forms/attestations/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 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
            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/statuses', middleware.hasRole(this._resourceAccess, ['viewer']), async (req, res, next) => {
                  await this._controller.readSubmissionStatuses(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 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
            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.put('/current', middleware.hasRole(this._resourceAccess, ['admin']), async (req, res, next) => {
                  await this._controller.update(req, res, next);
                });
            Severity: Major
            Found in app/src/forms/attestations/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 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
            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('/', middleware.hasRole(this._resourceAccess, ['admin']), async (req, res, next) => {
                  await this._controller.create(req, res, next);
                });
            Severity: Major
            Found in app/src/forms/attestations/router.js and 17 other locations - About 1 hr to fix
            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
            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.delete('/submissions/:submissionId', middleware.hasRole(this._resourceAccess, ['editor']), async (req, res, next) => {
                  await this._controller.deleteSubmission(req, res, next);
                });
            Severity: Major
            Found in app/src/forms/attestations/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/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
            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('/settings/:name', middleware.hasRole(this._resourceAccess, ['viewer']), async (req, res, next) => {
                  await this._controller.readSettings(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 55..57
            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', middleware.hasRole(this._resourceAccess, ['viewer']), async (req, res, next) => {
                  await this._controller.searchSubmissions(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 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('/settings', middleware.hasRole(this._resourceAccess, ['viewer']), async (req, res, next) => {
                  await this._controller.allSettings(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 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 3 locations. Consider refactoring.
            Open

            exports.down = function(knex) {
              return Promise.resolve()
                .then(() => knex.schema.dropTableIfExists(`${PREFIX}_submission_survey`));
            };
            Severity: Major
            Found in docs/sample/db/migrations/20200626145736_myform-form.js and 2 other locations - About 1 hr to fix
            app/src/db/migrations/20200519140119_005-settings-table.js on lines 15..18
            app/src/db/migrations/20210506111304-021-farmopscreening_submission_search_vw.js on lines 50..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 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('/', middleware.hasRole(this._resourceAccess, ['admin']), async (req, res, next) => {
                  await this._controller.create(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 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('/submissions/:submissionId/statuses/:statusId/notes', middleware.hasRole(this._resourceAccess, ['reviewer']), async (req, res, next) => {
                  await this._controller.createSubmissionStatusNote(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 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
            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/statuses/:statusId/notes', middleware.hasRole(this._resourceAccess, ['viewer']), async (req, res, next) => {
                  await this._controller.readSubmissionStatusNotes(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 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
            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.put('/submissions/:submissionId', middleware.hasRole(this._resourceAccess, ['editor']), async (req, res, next) => {
                  await this._controller.updateSubmission(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 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

            Severity
            Category
            Status
            Source
            Language