bcgov/common-forms-toolkit

View on GitHub

Showing 88 of 559 total issues

File submission.js has 556 lines of code (exceeds 250 allowed). Consider refactoring.
Open

const {Model} = require('objection');
const CommonModels = require('../../common/models');
const constants = require('../constants');

const SubmissionSchema = {
Severity: Major
Found in app/src/forms/attestations/models/submission.js - About 1 day to fix

    File base.js has 433 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    const { Model } = require('objection');
    const constants = require('../constants');
    const stamps = require('./jsonSchema').stamps;
    const Timestamps = require('./mixins').Timestamps;
    
    
    Severity: Minor
    Found in app/src/forms/common/models/base.js - About 6 hrs to fix

      Function up has 139 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      exports.up = function(knex) {
        return Promise.resolve()
          .then(() => knex.schema.alterTable(`${AGRI_PREFIX}_submission_location`, table => {
            table.dropColumn('mineNumber');
            table.dropColumn('permitNumber');
      Severity: Major
      Found in app/src/db/migrations/20200604071226_012-cleanup-data-and-model.js - About 5 hrs to fix

        Function up has 138 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        exports.up = function(knex) {
          return Promise.resolve()
            .then(() => {
              return knex(`${PREFIX}_version_status_code`).del();
            })
        Severity: Major
        Found in app/src/db/migrations/20210506111303_020-farmopscreening-data.js - About 5 hrs to fix

          Function up has 138 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          exports.up = function(knex) {
            return Promise.resolve()
              .then(() => {
                return knex(`${PREFIX}_version_status_code`).del();
              })

            Function up has 138 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            exports.up = function(knex) {
              return Promise.resolve()
                .then(() => {
                  return knex(`${PREFIX}_version_status_code`).del();
                })

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

              exports.down = function(knex) {
                return Promise.resolve()
                  .then(() => knex.schema.alterTable(`${AGRI_PREFIX}_submission_location`, table => {
                    table.string('mineNumber').nullable();
                    table.string('permitNumber').nullable();
              Severity: Major
              Found in app/src/db/migrations/20200604071226_012-cleanup-data-and-model.js - About 5 hrs to fix

                File dataService.js has 382 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                const equal = require('fast-deep-equal');
                const log = require('npmlog');
                const Problem = require('api-problem');
                const {transaction} = require('objection');
                const {v4: uuidv4} = require('uuid');
                Severity: Minor
                Found in app/src/forms/attestations/dataService.js - About 5 hrs to fix

                  Function up has 125 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  exports.up = function (knex) {
                    return Promise.resolve()
                      .then(() => knex.schema.raw(`create view ${AGRI_PREFIX}_submission_search_vw
                              ("submissionId", "createdAt", deleted, "formVersionId", "confirmationId", "operationType", "assignedTo",
                               "statusCode", "statusDate", name, city, "operationTypeDisplay", "statusDisplay")

                    Function up has 102 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    exports.up = function(knex) {
                      return Promise.resolve()
                        .then(() => knex.schema.createTable(`${PREFIX}_submission_location`, table => {
                          table.increments('locationId').primary();
                          table.uuid('submissionId').references('submissionId').inTable(`${PREFIX}_submission`).notNullable().index();

                      Function up has 101 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      exports.up = function(knex) {
                        return Promise.resolve()
                          .then(() => knex.schema.createTable(`${PREFIX}_submission_location`, table => {
                            table.increments('locationId').primary();
                            table.uuid('submissionId').references('submissionId').inTable(`${PREFIX}_submission`).notNullable().index();

                        Function up has 98 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        exports.up = function(knex) {
                          return Promise.resolve()
                            .then(() => knex.schema.createTable(`${PREFIX}_submission_location`, table => {
                              table.increments('locationId').primary();
                              table.uuid('submissionId').references('submissionId').inTable(`${PREFIX}_submission`).notNullable().index();
                        Severity: Major
                        Found in app/src/db/migrations/20210506111302_019-farmopscreening-form.js - About 3 hrs to fix

                          Function up has 96 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          exports.up = function(knex) {
                            return Promise.resolve()
                              .then(() => knex.schema.createTable(`${PREFIX}_submission_location`, table => {
                                table.increments('locationId').primary();
                                table.uuid('submissionId').references('submissionId').inTable(`${PREFIX}_submission`).notNullable().index();

                            File dataService.js has 294 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            const equal = require('fast-deep-equal');
                            const log = require('npmlog');
                            const Problem = require('api-problem');
                            const {transaction} = require('objection');
                            const {v4: uuidv4} = require('uuid');
                            Severity: Minor
                            Found in docs/sample/forms/myform/dataService.js - About 3 hrs to fix

                              File 20200604071226_012-cleanup-data-and-model.js has 288 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              
                              const AGRI_PREFIX = require('../../forms/attestations/agriseafoodopscreening/constants').PREFIX;
                              const AGRI_TITLE = require('../../forms/attestations/agriseafoodopscreening/constants').TITLE;
                              const AGRI_TITLE_ORIG = 'Agriculture/Seafood Operator Screening';
                              
                              
                              Severity: Minor
                              Found in app/src/db/migrations/20200604071226_012-cleanup-data-and-model.js - About 2 hrs to fix

                                Function up has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                exports.up = function(knex) {
                                  return knex(`${PREFIX}_settings`).del()
                                    .then(() => {
                                      const data = {
                                        name: 'submissionEmail',
                                Severity: Major
                                Found in app/src/db/migrations/20200519164226_006-settings-table-data.js - About 2 hrs to fix

                                  Function up has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  exports.up = function(knex) {
                                    return Promise.resolve()
                                      .then(() => knex.schema.createTable(`${PREFIX}_form`, table => {
                                        table.uuid('formId').references('formId').inTable('form').notNullable().primary();
                                        table.string('description');
                                  Severity: Major
                                  Found in app/src/db/migrations/20210506111301_018-farmopscreening-common.js - About 2 hrs to fix

                                    Function up has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    exports.up = function(knex) {
                                      return Promise.resolve()
                                        .then(() => knex.schema.createTable(`${PREFIX}_form`, table => {
                                          table.uuid('formId').references('formId').inTable('form').notNullable().primary();
                                          table.string('description');

                                      Function up has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                      exports.up = function(knex) {
                                        return Promise.resolve()
                                          .then(() => knex.schema.createTable(`${PREFIX}_form`, table => {
                                            table.uuid('formId').references('formId').inTable('form').notNullable().primary();
                                            table.string('description');

                                        Function up has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                        exports.up = function(knex) {
                                          return Promise.resolve()
                                            .then(() => {
                                              return knex(`${PREFIX}_version_status_code`).del();
                                            })
                                        Severity: Major
                                        Found in docs/sample/db/migrations/20200626145742_myform-data.js - About 2 hrs to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language