department-of-veterans-affairs/vets-website

View on GitHub
src/applications/vaos/services/mocks/index.js

Summary

Maintainability
F
6 days
Test Coverage

File index.js has 803 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* istanbul ignore file */
/* eslint-disable camelcase */
const delay = require('mocker-api/lib/delay');
const moment = require('moment');

Severity: Major
Found in src/applications/vaos/services/mocks/index.js - About 1 day to fix

    responses has 48 functions (exceeds 20 allowed). Consider refactoring.
    Open

    const responses = {
      'GET /vaos/v0/appointments': (req, res) => {
        if (req.query.type === 'cc') {
          return res.json(confirmedCC);
        }
    Severity: Minor
    Found in src/applications/vaos/services/mocks/index.js - About 6 hrs to fix

      Function GET /vaos/v2/appointments has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
      Open

        'GET /vaos/v2/appointments': (req, res) => {
          // merge arrays together
          const appointments = confirmedV2.data.concat(requestsV2.data, mockAppts);
          const filteredAppointments = appointments.filter(appointment => {
            return req.query.statuses.some(status => {
      Severity: Minor
      Found in src/applications/vaos/services/mocks/index.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

      Function POST /vaos/v2/appointments has 45 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        'POST /vaos/v2/appointments': (req, res) => {
          const {
            practitioners = [{ identifier: [{ system: null, value: null }] }],
          } = req.body;
          const selectedClinic = clinicsV2.data.filter(
      Severity: Minor
      Found in src/applications/vaos/services/mocks/index.js - About 1 hr to fix

        Function GET /vaos/v2/eligibility has 37 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          'GET /vaos/v2/eligibility': (req, res) => {
            const isDirect = req.query.type === 'direct';
            const ineligibilityReasons = [];
        
            if (
        Severity: Minor
        Found in src/applications/vaos/services/mocks/index.js - About 1 hr to fix

          Function GET /vaos/v2/appointments has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            'GET /vaos/v2/appointments': (req, res) => {
              // merge arrays together
              const appointments = confirmedV2.data.concat(requestsV2.data, mockAppts);
              const filteredAppointments = appointments.filter(appointment => {
                return req.query.statuses.some(status => {
          Severity: Minor
          Found in src/applications/vaos/services/mocks/index.js - About 1 hr to fix

            Function filteredAppointments has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                const filteredAppointments = appointments.filter(appointment => {
                  return req.query.statuses.some(status => {
                    if (appointment.attributes.status === status) {
                      // Automatically add appointments with these statuses to the collection
                      if (
            Severity: Minor
            Found in src/applications/vaos/services/mocks/index.js - About 1 hr to fix

              Function POST /vaos/v2/appointments has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                'POST /vaos/v2/appointments': (req, res) => {
                  const {
                    practitioners = [{ identifier: [{ system: null, value: null }] }],
                  } = req.body;
                  const selectedClinic = clinicsV2.data.filter(
              Severity: Minor
              Found in src/applications/vaos/services/mocks/index.js - 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

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

                      va_profile: {
                        status: 'OK',
                        birth_date: '19511118',
                        family_name: 'Hunter',
                        gender: 'M',
              Severity: Major
              Found in src/applications/vaos/services/mocks/index.js and 2 other locations - About 2 hrs to fix
              src/applications/mhv-medications/mocks/api/user/index.js on lines 100..121
              src/platform/mhv/api/mocks/user/index.js on lines 103..124

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

              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

                    return res.json({
                      data: {
                        id: '05084676-77a1-4754-b4e7-3638cb3124e5',
                        type: 'facility_visit',
                        attributes: {
              Severity: Major
              Found in src/applications/vaos/services/mocks/index.js and 1 other location - About 1 hr to fix
              src/applications/vaos/services/mocks/index.js on lines 159..168

              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

                  return res.json({
                    data: {
                      id: '05084676-77a1-4754-b4e7-3638cb3124e5',
                      type: 'facility_visit',
                      attributes: {
              Severity: Major
              Found in src/applications/vaos/services/mocks/index.js and 1 other location - About 1 hr to fix
              src/applications/vaos/services/mocks/index.js on lines 147..156

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

                'GET /vaos/v2/epsApi/networks/:networkId': (req, res) => {
                  return res.json({
                    data: epsNetworks.networks.find(
                      network => network?.id === req.params.networkId,
                    ),
              Severity: Major
              Found in src/applications/vaos/services/mocks/index.js and 5 other locations - About 1 hr to fix
              src/applications/vaos/services/mocks/index.js on lines 599..605
              src/applications/vaos/services/mocks/index.js on lines 609..615
              src/applications/vaos/services/mocks/index.js on lines 622..628
              src/applications/vaos/services/mocks/index.js on lines 629..638
              src/applications/vaos/services/mocks/index.js on lines 655..661

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

                'GET /vaos/v2/epsApi/specialty-groups/:specialtyGroupId': (req, res) => {
                  return res.json({
                    data: specialtyGroups.specialtyGroups.find(
                      specialtyGroup => specialtyGroup?.id === req.params.specialtyGroupId,
                    ),
              Severity: Major
              Found in src/applications/vaos/services/mocks/index.js and 5 other locations - About 1 hr to fix
              src/applications/vaos/services/mocks/index.js on lines 589..595
              src/applications/vaos/services/mocks/index.js on lines 599..605
              src/applications/vaos/services/mocks/index.js on lines 622..628
              src/applications/vaos/services/mocks/index.js on lines 629..638
              src/applications/vaos/services/mocks/index.js on lines 655..661

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

                'GET /vaos/v2/epsApi/referrals/:referralId': (req, res) => {
                  return res.json({
                    data: referrals.referrals.find(
                      referral => referral?.id === req.params.referralId,
                    ),
              Severity: Major
              Found in src/applications/vaos/services/mocks/index.js and 5 other locations - About 1 hr to fix
              src/applications/vaos/services/mocks/index.js on lines 589..595
              src/applications/vaos/services/mocks/index.js on lines 599..605
              src/applications/vaos/services/mocks/index.js on lines 609..615
              src/applications/vaos/services/mocks/index.js on lines 622..628
              src/applications/vaos/services/mocks/index.js on lines 629..638

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

                'GET /vaos/v2/epsApi/provider-services/:providerServiceId': (req, res) => {
                  return res.json({
                    data: providerServices.providerServices.find(
                      providerService => providerService?.id === req.params.providerServiceId,
                    ),
              Severity: Major
              Found in src/applications/vaos/services/mocks/index.js and 5 other locations - About 1 hr to fix
              src/applications/vaos/services/mocks/index.js on lines 589..595
              src/applications/vaos/services/mocks/index.js on lines 599..605
              src/applications/vaos/services/mocks/index.js on lines 609..615
              src/applications/vaos/services/mocks/index.js on lines 629..638
              src/applications/vaos/services/mocks/index.js on lines 655..661

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

                'GET /vaos/v2/epsApi/provider-services/:providerServiceId/slots': (
                  req,
                  res,
                ) => {
                  return res.json({
              Severity: Major
              Found in src/applications/vaos/services/mocks/index.js and 5 other locations - About 1 hr to fix
              src/applications/vaos/services/mocks/index.js on lines 589..595
              src/applications/vaos/services/mocks/index.js on lines 599..605
              src/applications/vaos/services/mocks/index.js on lines 609..615
              src/applications/vaos/services/mocks/index.js on lines 622..628
              src/applications/vaos/services/mocks/index.js on lines 655..661

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

                'GET /vaos/v2/epsApi/specialties/:specialtyId': (req, res) => {
                  return res.json({
                    data: specialties.specialties.find(
                      specialty => specialty?.id === req.params.specialtyId,
                    ),
              Severity: Major
              Found in src/applications/vaos/services/mocks/index.js and 5 other locations - About 1 hr to fix
              src/applications/vaos/services/mocks/index.js on lines 589..595
              src/applications/vaos/services/mocks/index.js on lines 609..615
              src/applications/vaos/services/mocks/index.js on lines 622..628
              src/applications/vaos/services/mocks/index.js on lines 629..638
              src/applications/vaos/services/mocks/index.js on lines 655..661

              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

                'GET /vaos/v0/appointment_requests/:id': (req, res) => {
                  return res.json({
                    data: requests.data.find(appt => appt.id === req.params.id),
                  });
                },
              Severity: Major
              Found in src/applications/vaos/services/mocks/index.js and 2 other locations - About 1 hr to fix
              src/applications/vaos/services/mocks/index.js on lines 102..106
              src/applications/vaos/services/mocks/index.js on lines 381..385

              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

                'GET /vaos/v0/appointments/va/:id': (req, res) => {
                  return res.json({
                    data: confirmedVA.data.find(appt => appt.id === req.params.id),
                  });
                },
              Severity: Major
              Found in src/applications/vaos/services/mocks/index.js and 2 other locations - About 1 hr to fix
              src/applications/vaos/services/mocks/index.js on lines 108..112
              src/applications/vaos/services/mocks/index.js on lines 381..385

              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

                'GET /vaos/v2/facilities/:id': (req, res) => {
                  return res.json({
                    data: facilitiesV2.data.find(facility => facility.id === req.params.id),
                  });
                },
              Severity: Major
              Found in src/applications/vaos/services/mocks/index.js and 2 other locations - About 1 hr to fix
              src/applications/vaos/services/mocks/index.js on lines 102..106
              src/applications/vaos/services/mocks/index.js on lines 108..112

              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

                'GET /vaos/v2/community_care/eligibility/:id': (req, res) => {
                  return res.json({
                    data: {
                      id: req.param.id,
                      type: 'cc_eligibility',
              Severity: Major
              Found in src/applications/vaos/services/mocks/index.js and 1 other location - About 1 hr to fix
              src/applications/vaos/services/mocks/index.js on lines 135..143

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

              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

                'GET /vaos/v0/community_care/eligibility/:id': (req, res) => {
                  return res.json({
                    data: {
                      id: req.param.id,
                      type: 'cc_eligibility',
              Severity: Major
              Found in src/applications/vaos/services/mocks/index.js and 1 other location - About 1 hr to fix
              src/applications/vaos/services/mocks/index.js on lines 372..380

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

              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

                'GET /vaos/v2/scheduling/configurations': (req, res) => {
                  if (req.query.cc_enabled === 'true') {
                    return res.json(schedulingConfigurationsCC);
                  }
              
              
              Severity: Minor
              Found in src/applications/vaos/services/mocks/index.js and 1 other location - About 55 mins to fix
              src/applications/vaos/services/mocks/index.js on lines 96..101

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

              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

                'GET /vaos/v0/appointments': (req, res) => {
                  if (req.query.type === 'cc') {
                    return res.json(confirmedCC);
                  }
                  return res.json(confirmedVA);
              Severity: Minor
              Found in src/applications/vaos/services/mocks/index.js and 1 other location - About 55 mins to fix
              src/applications/vaos/services/mocks/index.js on lines 365..371

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

              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

                  return res.json({
                    data: getSlot.find(slot => slot?.id === req.params.slotId),
                  });
              Severity: Minor
              Found in src/applications/vaos/services/mocks/index.js and 2 other locations - About 30 mins to fix
              src/applications/vaos/services/mocks/index.js on lines 520..524
              src/applications/vaos/services/mocks/index.js on lines 573..575

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

                  return res.json({
                    data: epsAppts.find(
                      appointment => appointment?.id === req.params.appointmentId,
                    ),
                  });
              Severity: Minor
              Found in src/applications/vaos/services/mocks/index.js and 2 other locations - About 30 mins to fix
              src/applications/vaos/services/mocks/index.js on lines 573..575
              src/applications/vaos/services/mocks/index.js on lines 648..650

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

                  return res.json({
                    data: epsPatients.find(patient => patient?.id === req.params.patientId),
                  });
              Severity: Minor
              Found in src/applications/vaos/services/mocks/index.js and 2 other locations - About 30 mins to fix
              src/applications/vaos/services/mocks/index.js on lines 520..524
              src/applications/vaos/services/mocks/index.js on lines 648..650

              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

              There are no issues that match your filters.

              Category
              Status