department-of-veterans-affairs/vets-website

View on GitHub
src/applications/dhp-connected-devices/components/DevicesToConnectSection.jsx

Summary

Maintainability
B
4 hrs
Test Coverage

Function disclaimerText has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  const disclaimerText = () => {
    return (
      <>
        <div>
          <p>

    Function DevicesToConnectSection has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    export const DevicesToConnectSection = ({
      connectedDevices,
      connectionAvailable,
      hasLoaded,
    }) => {

    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

              <p>
                <strong>
                  Data that you share with VA may not be actively monitored by your
                  VA care team.
                </strong>{' '}
    src/applications/dhp-connected-devices/containers/App.jsx on lines 20..35
    src/platform/static-data/error-messages.jsx on lines 47..60

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

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

    DevicesToConnectSection.propTypes = {
      connectedDevices: PropTypes.array.isRequired,
      connectionAvailable: PropTypes.bool.isRequired,
      hasLoaded: PropTypes.bool.isRequired,
    };
    src/applications/claims-status/components/appeals-v2/NextEvent.jsx on lines 12..16
    src/applications/combined-debt-portal/medical-copays/components/DownloadStatement.jsx on lines 63..67
    src/applications/dhp-connected-devices/components/DisconnectModal.jsx on lines 31..35
    src/applications/discharge-wizard/containers/FormPage.jsx on lines 32..36
    src/applications/financial-status-report/components/householdIncome/SpousePayrollDeductionInputList.jsx on lines 248..252
    src/applications/lgy/coe/form/components/statuses/Pending.jsx on lines 33..37
    src/applications/personalization/profile/components/connected-apps/AppDeletedAlert.jsx on lines 32..36
    src/applications/representative-search/components/results/PaginationWrapper.jsx on lines 29..33
    src/applications/sco/components/HubRail/shared/liSpanAndVaLinkAndPTag.jsx on lines 11..15
    src/applications/sco/components/HubRail/shared/liVaIconAndVaLink.jsx on lines 10..14
    src/applications/static-pages/events/components/Search/FilterBy.jsx on lines 31..35
    src/applications/vaos/new-appointment/components/CommunityCareProviderSelectionPage/ProviderSelectionField.jsx on lines 71..75
    src/applications/vaos/appointment-list/components/PastAppointmentsList/PastAppointmentsDateDropdown.jsx on lines 43..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 51.

    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

      const areAllDevicesConnected = () => {
        try {
          return connectedDevices.every(device => device.connected);
        } catch (err) {
          return false;
    src/applications/dhp-connected-devices/components/ConnectedDevicesSection.jsx on lines 13..19

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

    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