cityssm/parking-ticket-system

View on GitHub

Showing 360 of 360 total issues

Similar blocks of code found in 6 locations. Consider refactoring.
Open

export default function handler(request, response) {
    const results = updateParkingOffencesByBylawNumber(request.body);
    if (results.success) {
        results.bylaws = getParkingBylawsWithOffenceStats();
    }
Severity: Major
Found in handlers/admin-post/doUpdateOffencesByBylaw.js and 5 other locations - About 1 hr to fix
handlers/admin-post/doAddBylaw.js on lines 3..9
handlers/admin-post/doAddLocation.js on lines 3..9
handlers/admin-post/doUpdateBylaw.js on lines 3..9
handlers/admin-post/doUpdateLocation.js on lines 3..9
handlers/admin-post/doUpdateOffence.js on lines 3..9

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

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

export default function handler(request, response) {
    const results = updateParkingOffence(request.body);
    if (results.success) {
        results.offences = getParkingOffences();
    }
Severity: Major
Found in handlers/admin-post/doUpdateOffence.js and 5 other locations - About 1 hr to fix
handlers/admin-post/doAddBylaw.js on lines 3..9
handlers/admin-post/doAddLocation.js on lines 3..9
handlers/admin-post/doUpdateBylaw.js on lines 3..9
handlers/admin-post/doUpdateLocation.js on lines 3..9
handlers/admin-post/doUpdateOffencesByBylaw.js on lines 3..9

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

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

export default function handler(request, response) {
    const results = updateParkingBylaw(request.body);
    if (results.success) {
        results.bylaws = getParkingBylawsWithOffenceStats();
    }
Severity: Major
Found in handlers/admin-post/doUpdateBylaw.js and 5 other locations - About 1 hr to fix
handlers/admin-post/doAddBylaw.js on lines 3..9
handlers/admin-post/doAddLocation.js on lines 3..9
handlers/admin-post/doUpdateLocation.js on lines 3..9
handlers/admin-post/doUpdateOffence.js on lines 3..9
handlers/admin-post/doUpdateOffencesByBylaw.js on lines 3..9

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

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

        ;(
          document.querySelector('#is-loading-modal-message') as HTMLElement
        ).textContent = `Adding ${displayedTicketIds.length.toString()}
          ticket${displayedTicketIds.length === 1 ? '' : 's'}...`
Severity: Major
Found in public/javascripts/mto-ticketConvict.ts and 1 other location - About 1 hr to fix
public/javascripts/mto-plateExport.ts on lines 276..280

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

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

    (_b = document
        .querySelector('#is-clear-location-filter-button')) === null || _b === void 0 ? void 0 : _b.addEventListener('click', () => {
        clearLocationFilter();
        renderOffences();
    });
Severity: Major
Found in public/javascripts/offence-maint.js and 1 other location - About 1 hr to fix
public/javascripts/offence-maint.js on lines 500..504

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

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

            ;(
              document.querySelector('#is-loading-modal-message') as HTMLElement
            ).textContent = `Adding
              ${includedTicketIds.length.toString()}
              Parking Ticket${includedTicketIds.length === 1 ? '' : 's'}...`
Severity: Major
Found in public/javascripts/mto-plateExport.ts and 1 other location - About 1 hr to fix
public/javascripts/mto-ticketConvict.ts on lines 136..139

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

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

    (_c = document
        .querySelector('#is-clear-bylaw-filter-button')) === null || _c === void 0 ? void 0 : _c.addEventListener('click', () => {
        clearBylawFilter();
        renderOffences();
    });
Severity: Major
Found in public/javascripts/offence-maint.js and 1 other location - About 1 hr to fix
public/javascripts/offence-maint.js on lines 438..442

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

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

    function confirmResolveTicketFunction(clickEvent) {
        clickEvent.preventDefault();
        bulmaJS.confirm({
            title: 'Mark Ticket as Resolved',
            message: 'Once resolved, you will no longer be able to make changes to the ticket.',
Severity: Major
Found in public/javascripts/ticket-statuses-edit.js and 1 other location - About 1 hr to fix
public/javascripts/offence-maint.js on lines 52..63

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

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

        function confirmDelete(deleteClickEvent) {
            deleteClickEvent.preventDefault();
            bulmaJS.confirm({
                title: 'Remove Offence',
                message: 'Are you sure you want to remove this offence?',
Severity: Major
Found in public/javascripts/offence-maint.js and 1 other location - About 1 hr to fix
public/javascripts/ticket-statuses-edit.js on lines 25..36

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

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

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

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

          router
              .post('/doGetRecentConvictionBatches', updateOrOperatorPostHandler, handler_doGetRecentConvictionBatches)
              .post('/doGetConvictionBatch', updateOrOperatorPostHandler, handler_doGetConvictionBatch)
              .post('/doCreateConvictionBatch', updatePostHandler, handler_doCreateConvictionBatch)
              .post('/doAddTicketToConvictionBatch', updatePostHandler, handler_doAddTicketToConvictionBatch)
          Severity: Major
          Found in routes/tickets.js and 1 other location - About 1 hr to fix
          routes/plates.js on lines 22..28

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

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

          export default function handler(_request: Request, response: Response): void {
            const counts = getDatabaseCleanupCounts()
          
            response.render('admin-cleanup', {
              headTitle: 'Database Cleanup',
          Severity: Major
          Found in handlers/admin-get/cleanup.ts and 2 other locations - About 1 hr to fix
          handlers/admin-get/bylaws.ts on lines 5..12
          handlers/admin-get/locations.ts on lines 5..12

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

          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

          router
              .post('/doGetUnreceivedLicencePlateLookupBatches', updateOrOperatorPostHandler, handler_doGetUnreceivedLicencePlateLookupBatches)
              .post('/doCreateLookupBatch', updatePostHandler, handler_doCreateLookupBatch)
              .post('/doGetLookupBatch', updateOrOperatorPostHandler, handler_doGetLookupBatch)
              .post('/doAddLicencePlateToLookupBatch', updatePostHandler, handler_doAddLicencePlateToLookupBatch)
          Severity: Major
          Found in routes/plates.js and 1 other location - About 1 hr to fix
          routes/tickets.js on lines 50..56

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

          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

              for (const batchEntry of batch.batchEntries) {
                  batchEntry.statusDateString = dateIntegerToString(batchEntry.statusDate);
                  batchEntry.statusTimeString = timeIntegerToString(batchEntry.statusTime);
                  batchEntry.issueDateString = dateIntegerToString(batchEntry.issueDate);
              }
          Severity: Major
          Found in database/parkingDB/getConvictionBatch.js and 1 other location - About 1 hr to fix
          database/parkingDB/getUnreceivedLookupBatches.js on lines 20..24

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

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

          export default function handler(_request: Request, response: Response): void {
            const bylaws = getParkingBylawsWithOffenceStats()
          
            response.render('bylaw-maint', {
              headTitle: 'By-Law Maintenance',
          Severity: Major
          Found in handlers/admin-get/bylaws.ts and 2 other locations - About 1 hr to fix
          handlers/admin-get/cleanup.ts on lines 5..12
          handlers/admin-get/locations.ts on lines 5..12

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

          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

              for (const batch of batches) {
                  batch.batchDateString = dateIntegerToString(batch.batchDate);
                  batch.lockDateString = dateIntegerToString(batch.lockDate);
                  batch.sentDateString = dateIntegerToString(batch.sentDate);
              }
          Severity: Major
          Found in database/parkingDB/getUnreceivedLookupBatches.js and 1 other location - About 1 hr to fix
          database/parkingDB/getConvictionBatch.js on lines 46..50

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

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

          export default function handler(_request: Request, response: Response): void {
            const locations = getParkingLocations()
          
            response.render('location-maint', {
              headTitle: 'Parking Location Maintenance',
          Severity: Major
          Found in handlers/admin-get/locations.ts and 2 other locations - About 1 hr to fix
          handlers/admin-get/bylaws.ts on lines 5..12
          handlers/admin-get/cleanup.ts on lines 5..12

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

          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