bcgov/common-forms-toolkit

View on GitHub

Showing 88 of 559 total issues

Function update has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

Severity: Minor
Found in docs/sample/forms/myform/dataService.js - About 1 hr to fix

    Function create has 37 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      async create(obj, user) {
        if (!obj) {
          throw Error(`${this._constants.TITLE} cannot be created without data`);
        }
    
    
    Severity: Minor
    Found in app/src/forms/attestations/dataService.js - About 1 hr to fix

      Function create has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

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

        Function getRouter has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export default function getRouter(basePath = '/') {
          const router = new VueRouter({
            base: basePath,
            mode: 'history',
            routes: [
        Severity: Minor
        Found in app/frontend/src/router/index.js - About 1 hr to fix

          Function modifiers has a Cognitive Complexity of 12 (exceeds 5 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

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function modifiers has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

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

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function modifiers has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

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

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function modifiers has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

            static get modifiers() {
              return {
                orderDescending(builder) {
                  builder.orderBy('createdAt', 'desc');
                },

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function modifiers has 35 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/farmopscreening/models/form.js - About 1 hr to fix

            Function modifiers has 35 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/agriseafoodopscreening/models/form.js - About 1 hr to fix

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

                  static get modifiers() {
                    return {
                      orderDescending(builder) {
                        builder.orderBy('createdAt', 'desc');
                      },

                  Function constructor has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    constructor(resourceAccess) {
                      super();
                      this._controller = new Controller(resourceAccess);
                      this._clientName = `comfort-${resourceAccess}`;
                      this._routes = require('express').Router();
                  Severity: Minor
                  Found in app/src/forms/teammanagement/router.js - About 1 hr to fix

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

                    exports.down = function(knex) {
                      return knex(`${PREFIX}_note`).del()
                        .then(() => {
                          return knex(`${PREFIX}_submission_status`).del();
                        })

                      Function constructor has 34 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 app/src/forms/attestations/router.js - About 1 hr to fix

                        Function updateCurrentStatusCodes has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          async updateCurrentStatusCodes (obj, user){
                            if (!obj || !Array.isArray(obj)) {
                              throw Error('Status Codes cannot be updated without data');
                            }
                            let trx;
                        Severity: Minor
                        Found in app/src/forms/common/dataService.js - About 1 hr to fix

                          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

                                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
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language