department-of-veterans-affairs/vets-website

View on GitHub
src/applications/burials-ez/components/NoFormPage.jsx

Summary

Maintainability
F
4 days
Test Coverage

Function generateData has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
Open

const generateData = (type, formData) => {
  switch (type) {
    case 'claimant-information':
      return {
        'Claimant’s first name': formData?.claimantFullName?.first
Severity: Minor
Found in src/applications/burials-ez/components/NoFormPage.jsx - About 1 day 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

File NoFormPage.jsx has 437 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import React, { useEffect, useState } from 'react';
import { useSelector } from 'react-redux';
import { apiRequest } from 'platform/utilities/api';
import { formatSSN } from 'platform/utilities/ui';
import { isLoggedIn } from '@department-of-veterans-affairs/platform-user/selectors';
Severity: Minor
Found in src/applications/burials-ez/components/NoFormPage.jsx - About 6 hrs to fix

    Function NoFormPage has 160 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export const NoFormPage = () => {
      const [data, setData] = useState({});
      const [loading, setLoading] = useState(true);
      const loggedIn = useSelector(isLoggedIn);
    
    
    Severity: Major
    Found in src/applications/burials-ez/components/NoFormPage.jsx - About 6 hrs to fix

      Function generateData has 124 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const generateData = (type, formData) => {
        switch (type) {
          case 'claimant-information':
            return {
              'Claimant’s first name': formData?.claimantFullName?.first
      Severity: Major
      Found in src/applications/burials-ez/components/NoFormPage.jsx - About 4 hrs to fix

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

                  <va-alert
                    close-btn-aria-label="Close notification"
                    status="info"
                    visible
                  >
        Severity: Major
        Found in src/applications/burials-ez/components/NoFormPage.jsx and 1 other location - About 3 hrs to fix
        src/applications/burials-ez/components/NoFormPage.jsx on lines 429..445

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

        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

              <va-alert close-btn-aria-label="Close notification" status="info" visible>
                <h2 id="track-your-status-on-mobile" slot="headline">
                  You don’t have any saved online burial forms.
                </h2>
                <div>
        Severity: Major
        Found in src/applications/burials-ez/components/NoFormPage.jsx and 1 other location - About 3 hrs to fix
        src/applications/burials-ez/components/NoFormPage.jsx on lines 393..413

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

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

        const renderFields = [
          {
            title: 'Claimant information',
            id: 'claimant-information',
          },
        Severity: Major
        Found in src/applications/burials-ez/components/NoFormPage.jsx and 4 other locations - About 1 hr to fix
        src/applications/discharge-wizard/components/questions/BranchOfService.jsx on lines 27..33
        src/applications/financial-status-report/wizard/pages/Recipients.jsx on lines 11..32
        src/applications/gi/containers/search/LocationSearchForm.jsx on lines 61..67
        src/applications/vaos/utils/constants.js on lines 388..409

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

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

            apiRequest(resource)
              .then(responseData => {
                setData(responseData);
                setLoading(false);
              })
        Severity: Major
        Found in src/applications/burials-ez/components/NoFormPage.jsx and 1 other location - About 1 hr to fix
        src/applications/pensions/components/NoFormPage.jsx on lines 23..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 55.

        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

                    <p className="vads-u-margin-top--0 vads-u-margin-bottom--1">
                      <strong>Suffix: </strong>
                      {name.suffix ? name.suffix : 'None'}
                    </p>
        Severity: Minor
        Found in src/applications/burials-ez/components/NoFormPage.jsx and 1 other location - About 40 mins to fix
        src/applications/burials-ez/components/NoFormPage.jsx on lines 210..213

        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

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

                    <p className="vads-u-margin-top--0 vads-u-margin-bottom--1">
                      <strong>Middle: </strong>
                      {name.middle ? name.middle : 'None'}
                    </p>
        Severity: Minor
        Found in src/applications/burials-ez/components/NoFormPage.jsx and 1 other location - About 40 mins to fix
        src/applications/burials-ez/components/NoFormPage.jsx on lines 218..221

        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

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

              <p>
                Call us at <va-telephone contact="8008271000" />. We’re here Monday
                through Friday, 8:00 a.m to 9:00 p.m ET. If you have hearing loss, call{' '}
                <va-telephone contact="711" tty />.
              </p>
        Severity: Minor
        Found in src/applications/burials-ez/components/NoFormPage.jsx and 2 other locations - About 30 mins to fix
        src/applications/my-education-benefits/components/confirmation/ConfirmationPending.jsx on lines 66..72
        src/applications/pensions/components/NoFormPage.jsx on lines 210..214

        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