cityssm/lottery-licence-manager

View on GitHub

Showing 390 of 460 total issues

Identical blocks of code found in 3 locations. Consider refactoring.
Open

    const licences = getLicences({ organizationID }, request.session, {
        includeOrganization: false,
        limit: -1
    }).licences || [];
Severity: Minor
Found in handlers/organizations-get/edit.js and 2 other locations - About 30 mins to fix
handlers/organizations-get/print.js on lines 15..18
handlers/organizations-get/view.js on lines 17..20

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 45.

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 7 locations. Consider refactoring.
Open

    if (requestBody.isEligibleForLicences && requestBody.isEligibleForLicences !== "") {
        sql += " and o.isEligibleForLicences = ?";
        sqlParameters.push(requestBody.isEligibleForLicences);
    }
Severity: Major
Found in helpers/licencesDB/getOrganizations.js and 6 other locations - About 30 mins to fix
helpers/licencesDB.js on lines 124..127
helpers/licencesDB/getEvents.js on lines 17..20
helpers/licencesDB/getEvents.js on lines 21..24
helpers/licencesDB/getLicences.js on lines 21..24
helpers/licencesDB/getLicences.js on lines 32..35
helpers/licencesDB/getOutstandingEvents.js on lines 27..30

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 45.

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 7 locations. Consider refactoring.
Open

    if (requestBody.licenceTypeKey && requestBody.licenceTypeKey !== "") {
        sql += " and l.licenceTypeKey = ?";
        sqlParameters.push(requestBody.licenceTypeKey);
    }
Severity: Major
Found in helpers/licencesDB/getOutstandingEvents.js and 6 other locations - About 30 mins to fix
helpers/licencesDB.js on lines 124..127
helpers/licencesDB/getEvents.js on lines 17..20
helpers/licencesDB/getEvents.js on lines 21..24
helpers/licencesDB/getLicences.js on lines 21..24
helpers/licencesDB/getLicences.js on lines 32..35
helpers/licencesDB/getOrganizations.js on lines 35..38

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 45.

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 7 locations. Consider refactoring.
Open

    if (requestBody.externalLicenceNumber && requestBody.externalLicenceNumber !== "") {
        sqlWhereClause += " and instr(lower(l.externalLicenceNumber), ?) > 0";
        sqlParameters.push(requestBody.externalLicenceNumber);
    }
Severity: Major
Found in helpers/licencesDB/getEvents.js and 6 other locations - About 30 mins to fix
helpers/licencesDB.js on lines 124..127
helpers/licencesDB/getEvents.js on lines 21..24
helpers/licencesDB/getLicences.js on lines 21..24
helpers/licencesDB/getLicences.js on lines 32..35
helpers/licencesDB/getOrganizations.js on lines 35..38
helpers/licencesDB/getOutstandingEvents.js on lines 27..30

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 45.

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 7 locations. Consider refactoring.
Open

    if (requestBodyOrParametersObject.licenceTypeKey && requestBodyOrParametersObject.licenceTypeKey !== "") {
        sqlWhereClause += " and l.licenceTypeKey = ?";
        sqlParameters.push(requestBodyOrParametersObject.licenceTypeKey);
    }
Severity: Major
Found in helpers/licencesDB/getLicences.js and 6 other locations - About 30 mins to fix
helpers/licencesDB.js on lines 124..127
helpers/licencesDB/getEvents.js on lines 17..20
helpers/licencesDB/getEvents.js on lines 21..24
helpers/licencesDB/getLicences.js on lines 21..24
helpers/licencesDB/getOrganizations.js on lines 35..38
helpers/licencesDB/getOutstandingEvents.js on lines 27..30

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 45.

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

Identical blocks of code found in 3 locations. Consider refactoring.
Open

    const licences = getLicences({ organizationID }, request.session, {
        includeOrganization: false,
        limit: -1
    }).licences || [];
Severity: Minor
Found in handlers/organizations-get/view.js and 2 other locations - About 30 mins to fix
handlers/organizations-get/edit.js on lines 20..23
handlers/organizations-get/print.js on lines 15..18

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 45.

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

Identical blocks of code found in 3 locations. Consider refactoring.
Open

    const licences = getLicences({ organizationID }, request.session, {
        includeOrganization: false,
        limit: -1
    }).licences || [];
Severity: Minor
Found in handlers/organizations-get/print.js and 2 other locations - About 30 mins to fix
handlers/organizations-get/edit.js on lines 20..23
handlers/organizations-get/view.js on lines 17..20

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 45.

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 7 locations. Consider refactoring.
Open

    if (requestBodyOrParametersObject.organizationID && requestBodyOrParametersObject.organizationID !== "") {
        sqlWhereClause += " and l.organizationID = ?";
        sqlParameters.push(requestBodyOrParametersObject.organizationID);
    }
Severity: Major
Found in helpers/licencesDB/getLicences.js and 6 other locations - About 30 mins to fix
helpers/licencesDB.js on lines 124..127
helpers/licencesDB/getEvents.js on lines 17..20
helpers/licencesDB/getEvents.js on lines 21..24
helpers/licencesDB/getLicences.js on lines 32..35
helpers/licencesDB/getOrganizations.js on lines 35..38
helpers/licencesDB/getOutstandingEvents.js on lines 27..30

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 45.

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

Identical blocks of code found in 3 locations. Consider refactoring.
Open

  const licences = getLicences({ organizationID },
    request.session, {
      includeOrganization: false,
      limit: -1
    }).licences || [];
Severity: Minor
Found in handlers/organizations-get/print.ts and 2 other locations - About 30 mins to fix
handlers/organizations-get/edit.ts on lines 35..40
handlers/organizations-get/view.ts on lines 31..35

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 45.

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 2 locations. Consider refactoring.
Open

    licencesDB.prepare("create table if not exists OrganizationBankRecords (" +

      "organizationID integer not null," +
      " recordIndex integer not null," +

Severity: Minor
Found in helpers/databaseInitializer.ts and 1 other location - About 30 mins to fix
helpers/databaseInitializer.ts on lines 33..47

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 45.

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 7 locations. Consider refactoring.
Open

  if (requestBody.licenceTypeKey && requestBody.licenceTypeKey !== "") {
    sqlWhereClause += " and l.licenceTypeKey = ?";
    sqlParameters.push(requestBody.licenceTypeKey);
  }
Severity: Major
Found in helpers/licencesDB/getEvents.ts and 6 other locations - About 30 mins to fix
helpers/licencesDB.ts on lines 234..238
helpers/licencesDB/getEvents.ts on lines 48..51
helpers/licencesDB/getLicences.ts on lines 58..63
helpers/licencesDB/getLicences.ts on lines 75..79
helpers/licencesDB/getOrganizations.ts on lines 62..67
helpers/licencesDB/getOutstandingEvents.ts on lines 44..48

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 45.

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 7 locations. Consider refactoring.
Open

  if (requestBody.externalLicenceNumber && requestBody.externalLicenceNumber !== "") {
    sqlWhereClause += " and instr(lower(l.externalLicenceNumber), ?) > 0";
    sqlParameters.push(requestBody.externalLicenceNumber);
  }
Severity: Major
Found in helpers/licencesDB/getEvents.ts and 6 other locations - About 30 mins to fix
helpers/licencesDB.ts on lines 234..238
helpers/licencesDB/getEvents.ts on lines 53..56
helpers/licencesDB/getLicences.ts on lines 58..63
helpers/licencesDB/getLicences.ts on lines 75..79
helpers/licencesDB/getOrganizations.ts on lines 62..67
helpers/licencesDB/getOutstandingEvents.ts on lines 44..48

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 45.

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 2 locations. Consider refactoring.
Open

    licencesDB.prepare("create table if not exists Locations (" +

      "locationID integer primary key autoincrement," +
      " locationName varchar(100)," +
      " locationAddress1 varchar(50)," +
Severity: Minor
Found in helpers/databaseInitializer.ts and 1 other location - About 30 mins to fix
helpers/databaseInitializer.ts on lines 131..145

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 45.

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

Identical blocks of code found in 3 locations. Consider refactoring.
Open

  const licences = getLicences({ organizationID },
    request.session, {
      includeOrganization: false,
      limit: -1
    }).licences || [];
Severity: Minor
Found in handlers/organizations-get/view.ts and 2 other locations - About 30 mins to fix
handlers/organizations-get/edit.ts on lines 35..40
handlers/organizations-get/print.ts on lines 28..32

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 45.

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 7 locations. Consider refactoring.
Open

  if (requestBody.licenceTypeKey && requestBody.licenceTypeKey !== "") {

    sql += " and l.licenceTypeKey = ?";
    sqlParameters.push(requestBody.licenceTypeKey);
  }
Severity: Major
Found in helpers/licencesDB/getOutstandingEvents.ts and 6 other locations - About 30 mins to fix
helpers/licencesDB.ts on lines 234..238
helpers/licencesDB/getEvents.ts on lines 48..51
helpers/licencesDB/getEvents.ts on lines 53..56
helpers/licencesDB/getLicences.ts on lines 58..63
helpers/licencesDB/getLicences.ts on lines 75..79
helpers/licencesDB/getOrganizations.ts on lines 62..67

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 45.

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 7 locations. Consider refactoring.
Open

  if (requestBody.isEligibleForLicences && requestBody.isEligibleForLicences !== "") {

    sql += " and o.isEligibleForLicences = ?";
    sqlParameters.push(requestBody.isEligibleForLicences);

Severity: Major
Found in helpers/licencesDB/getOrganizations.ts and 6 other locations - About 30 mins to fix
helpers/licencesDB.ts on lines 234..238
helpers/licencesDB/getEvents.ts on lines 48..51
helpers/licencesDB/getEvents.ts on lines 53..56
helpers/licencesDB/getLicences.ts on lines 58..63
helpers/licencesDB/getLicences.ts on lines 75..79
helpers/licencesDB/getOutstandingEvents.ts on lines 44..48

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 45.

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 2 locations. Consider refactoring.
Open

        licencesDB.prepare("create table if not exists Locations (" +
            "locationID integer primary key autoincrement," +
            " locationName varchar(100)," +
            " locationAddress1 varchar(50)," +
            " locationAddress2 varchar(50)," +
Severity: Minor
Found in helpers/databaseInitializer.js and 1 other location - About 30 mins to fix
helpers/databaseInitializer.js on lines 88..98

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 45.

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

Identical blocks of code found in 3 locations. Consider refactoring.
Open

  const licences = getLicences({ organizationID },
    request.session, {
      includeOrganization: false,
      limit: -1
    }
Severity: Minor
Found in handlers/organizations-get/edit.ts and 2 other locations - About 30 mins to fix
handlers/organizations-get/print.ts on lines 28..32
handlers/organizations-get/view.ts on lines 31..35

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 45.

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 2 locations. Consider refactoring.
Open

                        ("<td>" +
                            "<a data-tooltip=\"View Organization\"" +
                            " href=\"" + cityssm.escapeHTML(urlPrefix) + "/organizations/" + licenceObject.organizationID.toString() + "\">" +
                            cityssm.escapeHTML(licenceObject.organizationName) +
Severity: Minor
Found in public-typescript/licence-search.js and 1 other location - About 30 mins to fix
public-typescript/location-cleanup.js on lines 56..59

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 45.

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 7 locations. Consider refactoring.
Open

  if (requestBodyOrParametersObject.organizationID && requestBodyOrParametersObject.organizationID !== "") {

    sqlWhereClause += " and l.organizationID = ?";
    sqlParameters.push(requestBodyOrParametersObject.organizationID);

Severity: Major
Found in helpers/licencesDB/getLicences.ts and 6 other locations - About 30 mins to fix
helpers/licencesDB.ts on lines 234..238
helpers/licencesDB/getEvents.ts on lines 48..51
helpers/licencesDB/getEvents.ts on lines 53..56
helpers/licencesDB/getLicences.ts on lines 75..79
helpers/licencesDB/getOrganizations.ts on lines 62..67
helpers/licencesDB/getOutstandingEvents.ts on lines 44..48

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 45.

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