cityssm/parking-ticket-system

View on GitHub

Showing 19 of 360 total issues

File offence-maint.ts has 684 lines of code (exceeds 500 allowed). Consider refactoring.
Open

/* eslint-disable unicorn/filename-case, unicorn/prefer-module, eslint-comments/disable-enable-pair */
/* eslint-disable @typescript-eslint/indent */

import type { BulmaJS } from '@cityssm/bulma-js/types.js'
import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types.js'
Severity: Major
Found in public/javascripts/offence-maint.ts - About 6 hrs to fix

    File mto-ticketConvict.ts has 626 lines of code (exceeds 500 allowed). Consider refactoring.
    Open

    /* eslint-disable unicorn/filename-case, unicorn/prefer-module, eslint-comments/disable-enable-pair */
    /* eslint-disable @typescript-eslint/indent */
    /* eslint-disable no-extra-semi */
    
    // eslint-disable-next-line n/no-missing-import
    Severity: Major
    Found in public/javascripts/mto-ticketConvict.ts - About 5 hrs to fix

      File mto-plateExport.ts has 590 lines of code (exceeds 500 allowed). Consider refactoring.
      Open

      /* eslint-disable unicorn/filename-case, unicorn/prefer-module, eslint-comments/disable-enable-pair */
      /* eslint-disable @typescript-eslint/indent */
      /* eslint-disable no-extra-semi */
      
      import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types.js'
      Severity: Major
      Found in public/javascripts/mto-plateExport.ts - About 4 hrs to fix

        File ticket-statuses-edit.ts has 578 lines of code (exceeds 500 allowed). Consider refactoring.
        Open

        /* eslint-disable unicorn/filename-case, unicorn/prefer-module, eslint-comments/disable-enable-pair */
        /* eslint-disable no-extra-semi */
        
        // eslint-disable-next-line n/no-missing-import
        import type { BulmaJS } from '@cityssm/bulma-js/types.js'
        Severity: Major
        Found in public/javascripts/ticket-statuses-edit.ts - About 3 hrs to fix

          Function initializeTabs has a Cognitive Complexity of 35 (exceeds 15 allowed). Consider refactoring.
          Open

          pts.initializeTabs = (tabsListElement, callbackFunctions) => {
              var _a;
              if (!tabsListElement) {
                  return;
              }
          Severity: Minor
          Found in public/javascripts/main.js - About 3 hrs 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

          File offence-maint.js has 520 lines of code (exceeds 500 allowed). Consider refactoring.
          Open

          "use strict";
          Object.defineProperty(exports, "__esModule", { value: true });
          (() => {
              var _a, _b, _c;
              const offenceMap = new Map();
          Severity: Major
          Found in public/javascripts/offence-maint.js - About 2 hrs to fix

            File ticket-edit.ts has 512 lines of code (exceeds 500 allowed). Consider refactoring.
            Open

            /* eslint-disable unicorn/filename-case, eslint-comments/disable-enable-pair */
            /* eslint-disable @typescript-eslint/indent */
            /* eslint-disable no-labels */
            
            // eslint-disable-next-line n/no-missing-import
            Severity: Major
            Found in public/javascripts/ticket-edit.ts - About 2 hrs to fix

              File mto-ticketConvict.js has 505 lines of code (exceeds 500 allowed). Consider refactoring.
              Open

              "use strict";
              Object.defineProperty(exports, "__esModule", { value: true });
              (() => {
                  var _a, _b;
                  const canUpdate = ((_a = document.querySelector('main')) === null || _a === void 0 ? void 0 : _a.dataset.canUpdate) === 'true';
              Severity: Major
              Found in public/javascripts/mto-ticketConvict.js - About 2 hrs to fix

                Consider simplifying this complex logical expression.
                Open

                    if (
                      (trElement.dataset.isVehicleMakeMatch ?? '') !== '' &&
                      (trElement.dataset.isLicencePlateExpiryDateMatch ?? '') !== ''
                    ) {
                      doMatch()
                Severity: Critical
                Found in public/javascripts/ticket-reconcile.ts - About 1 hr to fix

                  Consider simplifying this complex logical expression.
                  Open

                      if (
                        (trElement.dataset.isVehicleMakeMatch ?? '') !== '' ||
                        (trElement.dataset.isLicencePlateExpiryDateMatch ?? '') !== ''
                      ) {
                        const ticketVehicle = trElement.dataset.ticketVehicle ?? ''
                  Severity: Critical
                  Found in public/javascripts/ticket-reconcile.ts - About 1 hr to fix

                    Consider simplifying this complex logical expression.
                    Open

                            if (((_a = trElement.dataset.isVehicleMakeMatch) !== null && _a !== void 0 ? _a : '') !== '' ||
                                ((_b = trElement.dataset.isLicencePlateExpiryDateMatch) !== null && _b !== void 0 ? _b : '') !== '') {
                                const ticketVehicle = (_c = trElement.dataset.ticketVehicle) !== null && _c !== void 0 ? _c : '';
                                const ticketExpiryDate = (_d = trElement.dataset.ticketExpiryDate) !== null && _d !== void 0 ? _d : '';
                                const ownerVehicle = (_e = trElement.dataset.ownerVehicle) !== null && _e !== void 0 ? _e : '';
                    Severity: Critical
                    Found in public/javascripts/ticket-reconcile.js - About 1 hr to fix

                      Consider simplifying this complex logical expression.
                      Open

                              if (((_a = trElement.dataset.isVehicleMakeMatch) !== null && _a !== void 0 ? _a : '') !== '' &&
                                  ((_b = trElement.dataset.isLicencePlateExpiryDateMatch) !== null && _b !== void 0 ? _b : '') !== '') {
                                  doMatch();
                              }
                              else {
                      Severity: Critical
                      Found in public/javascripts/ticket-reconcile.js - About 1 hr to fix

                        Function createStatus has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                        function createStatus(batchId, ticketId, statusKey, sessionUser, connectedDatabase) {
                        Severity: Minor
                        Found in database/parkingDB/addParkingTicketToConvictionBatch.js - About 35 mins to fix

                          Function getLicencePlateOwner has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                            licencePlateCountry: string,
                            licencePlateProvince: string,
                            licencePlateNumber: string,
                            recordDateOrBefore: number,
                            connectedDatabase?: sqlite.Database
                          Severity: Minor
                          Found in database/parkingDB/getLicencePlateOwner.ts - About 35 mins to fix

                            Function getLicencePlateOwner has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                            export default async function getLicencePlateOwner(licencePlateCountry, licencePlateProvince, licencePlateNumber, recordDateOrBefore, connectedDatabase) {
                            Severity: Minor
                            Found in database/parkingDB/getLicencePlateOwner.js - About 35 mins to fix

                              Function createStatus has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                batchId: number,
                                ticketId: number,
                                statusKey: 'convicted' | 'convictionBatch',
                                sessionUser: PTSUser,
                                connectedDatabase?: sqlite.Database
                              Severity: Minor
                              Found in database/parkingDB/addParkingTicketToConvictionBatch.ts - About 35 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                      return
                                Severity: Major
                                Found in public/javascripts/mto-ticketConvict.ts - About 30 mins to fix

                                  Avoid too many return statements within this function.
                                  Open

                                              return;
                                  Severity: Major
                                  Found in public/javascripts/mto-ticketConvict.js - About 30 mins to fix

                                    Function initializeTabs has a Cognitive Complexity of 16 (exceeds 15 allowed). Consider refactoring.
                                    Open

                                    pts.initializeTabs = (tabsListElement, callbackFunctions) => {
                                      if (!tabsListElement) {
                                        return
                                      }
                                    
                                    
                                    Severity: Minor
                                    Found in public/javascripts/main.ts - About 25 mins 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

                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language