cityssm/lottery-licence-manager

View on GitHub

Showing 28 of 460 total issues

Function updateLicence has a Cognitive Complexity of 56 (exceeds 15 allowed). Consider refactoring.
Open

export const updateLicence = (requestBody, requestSession) => {
    const database = sqlite(databasePath);
    const pastLicenceObject = getLicenceWithDB(database, requestBody.licenceID, requestSession, {
        includeTicketTypes: true,
        includeFields: true,
Severity: Minor
Found in helpers/licencesDB/updateLicence.js - About 7 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

Function updateLicence has a Cognitive Complexity of 56 (exceeds 15 allowed). Consider refactoring.
Open

export const updateLicence = (requestBody: LotteryLicenceForm, requestSession: expressSession.Session): boolean => {

  // Check if can update

  const database = sqlite(databasePath);
Severity: Minor
Found in helpers/licencesDB/updateLicence.ts - About 7 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

Function organizationReminders has a Cognitive Complexity of 43 (exceeds 15 allowed). Consider refactoring.
Open

llm.organizationReminders = (() => {

  const urlPrefix = document.querySelector("main").dataset.urlPrefix;

  let reminderCategories: configTypes.ConfigReminderCategory[];
Severity: Minor
Found in public-typescript/main-organizationReminders.ts - About 4 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

Function organizationReminders has a Cognitive Complexity of 43 (exceeds 15 allowed). Consider refactoring.
Open

llm.organizationReminders = (() => {
    const urlPrefix = document.querySelector("main").dataset.urlPrefix;
    let reminderCategories;
    const reminderTypeCache = new Map();
    let dismissingStatuses = [];
Severity: Minor
Found in public-typescript/main-organizationReminders.js - About 4 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

Function addTicketType_openModal has a Cognitive Complexity of 42 (exceeds 15 allowed). Consider refactoring.
Open

    const addTicketType_openModal = (clickEvent) => {
        const ticketTypeFieldPresets = {
            manufacturerLocationId: lastUsedManufacturerID,
            distributorLocationId: lastUsedDistributorID,
            ticketType: "",
Severity: Minor
Found in public-typescript/licence-edit/ticketTypes.js - About 4 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

Function addTicketType_openModal has a Cognitive Complexity of 42 (exceeds 15 allowed). Consider refactoring.
Open

  const addTicketType_openModal = (clickEvent: Event) => {

    const ticketTypeFieldPresets = {
      manufacturerLocationId: lastUsedManufacturerID,
      distributorLocationId: lastUsedDistributorID,
Severity: Minor
Found in public-typescript/licence-edit/ticketTypes.ts - About 4 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

Function organizationReminders has 336 lines of code (exceeds 300 allowed). Consider refactoring.
Open

llm.organizationReminders = (() => {

  const urlPrefix = document.querySelector("main").dataset.urlPrefix;

  let reminderCategories: configTypes.ConfigReminderCategory[];
Severity: Major
Found in public-typescript/main-organizationReminders.ts - About 2 hrs to fix

    Function handler has a Cognitive Complexity of 26 (exceeds 15 allowed). Consider refactoring.
    Open

    export const handler = (request, response) => {
        const organizationID = Number.parseInt(request.body.organizationID, 10);
        const accountNumber = request.body.accountNumber;
        const bankingYear = Number.parseInt(request.body.bankingYear, 10);
        const bankingMonth = Number.parseInt(request.body.bankingMonth, 10);
    Severity: Minor
    Found in handlers/organizations-post/doUpdateBankRecordsByMonth.js - About 2 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

    Function getLicences has a Cognitive Complexity of 26 (exceeds 15 allowed). Consider refactoring.
    Open

    export const getLicences = (requestBodyOrParametersObject: {
      externalLicenceNumber?: string;
      licenceTypeKey?: string;
      organizationID?: string | number;
      organizationName?: string;
    Severity: Minor
    Found in helpers/licencesDB/getLicences.ts - About 2 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

    Function handler has a Cognitive Complexity of 26 (exceeds 15 allowed). Consider refactoring.
    Open

    export const handler: RequestHandler = (request, response) => {
    
      const organizationID = Number.parseInt(request.body.organizationID, 10);
      const accountNumber = request.body.accountNumber;
      const bankingYear = Number.parseInt(request.body.bankingYear, 10);
    Severity: Minor
    Found in handlers/organizations-post/doUpdateBankRecordsByMonth.ts - About 2 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

    Function getLicences has a Cognitive Complexity of 26 (exceeds 15 allowed). Consider refactoring.
    Open

    export const getLicences = (requestBodyOrParametersObject, requestSession, includeOptions) => {
        if (requestBodyOrParametersObject.organizationName && requestBodyOrParametersObject.organizationName !== "") {
            includeOptions.includeOrganization = true;
        }
        const database = sqlite(databasePath, {
    Severity: Minor
    Found in helpers/licencesDB/getLicences.js - About 2 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

    Function rollForwardOrganization has a Cognitive Complexity of 23 (exceeds 15 allowed). Consider refactoring.
    Open

    export const rollForwardOrganization = (organizationID: number,
      updateFiscalYear: boolean,
      updateReminders: boolean,
      requestSession: expressSession.Session): RollForwardOrganizationReturn => {
    
    
    Severity: Minor
    Found in helpers/licencesDB/rollForwardOrganization.ts - 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 rollForwardOrganization has a Cognitive Complexity of 23 (exceeds 15 allowed). Consider refactoring.
    Open

    export const rollForwardOrganization = (organizationID, updateFiscalYear, updateReminders, requestSession) => {
        const rightNowMillis = Date.now();
        const database = sqlite(databasePath);
        const organizationRow = database.prepare("select fiscalStartDate, fiscalEndDate" +
            " from Organizations" +
    Severity: Minor
    Found in helpers/licencesDB/rollForwardOrganization.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 getLicenceWithDB has a Cognitive Complexity of 22 (exceeds 15 allowed). Consider refactoring.
    Open

    export const getLicenceWithDB = (database, licenceID, requestSession, queryOptions) => {
        const licenceObject = database.prepare("select l.*," +
            " lo.locationName, lo.locationAddress1" +
            " from LotteryLicences l" +
            " left join Locations lo on l.locationID = lo.locationID" +
    Severity: Minor
    Found in helpers/licencesDB/getLicence.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 getLicenceWithDB has a Cognitive Complexity of 22 (exceeds 15 allowed). Consider refactoring.
    Open

    export const getLicenceWithDB = (database: sqlite.Database, licenceID: number | string,
      requestSession: expressSession.Session,
      queryOptions: {
        includeTicketTypes: boolean;
        includeFields: boolean;
    Severity: Minor
    Found in helpers/licencesDB/getLicence.ts - 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 initializeTabs has a Cognitive Complexity of 19 (exceeds 15 allowed). Consider refactoring.
    Open

    llm.initializeTabs = (tabsListElement, callbackFunctions) => {
        if (!tabsListElement) {
            return;
        }
        const isPanelOrMenuListTabs = tabsListElement.classList.contains("panel-tabs") || tabsListElement.classList.contains("menu-list");
    Severity: Minor
    Found in public-typescript/main.js - About 55 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

    Function canUpdateObject has a Cognitive Complexity of 18 (exceeds 15 allowed). Consider refactoring.
    Open

    export const canUpdateObject = (object, requestSession) => {
        const userProperties = requestSession.user.userProperties;
        let canUpdate = false;
        if (!requestSession) {
            canUpdate = false;
    Severity: Minor
    Found in helpers/licencesDB.js - About 45 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

    Function canUpdateObject has a Cognitive Complexity of 18 (exceeds 15 allowed). Consider refactoring.
    Open

    export const canUpdateObject = (object: llm.Record, requestSession: expressSession.Session): boolean => {
    
      const userProperties = requestSession.user.userProperties;
    
      // Check user permissions
    Severity: Minor
    Found in helpers/licencesDB.ts - About 45 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

    Avoid deeply nested control flow statements.
    Open

                        if (activeReminder) {
                          continue;
                        }
    Severity: Major
    Found in public-typescript/main-organizationReminders.ts - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                                              if (activeReminder) {
                                                  continue;
                                              }
      Severity: Major
      Found in public-typescript/main-organizationReminders.js - About 45 mins to fix
        Severity
        Category
        Status
        Source
        Language