department-of-veterans-affairs/vets-website

View on GitHub

Showing 4,231 of 14,884 total issues

Function ShowAlertOrSip has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

const ShowAlertOrSip = ({ basename, sipOptions, bottom }) => {
  const loggedIn = useSelector(isLoggedIn);
  // Verified LOA3?
  const isVerified = useSelector(
    state => selectProfile(state)?.verified || false,

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 NearbyLocations has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

const NearbyLocations = props => {
  const [originalCoordinates, setOriginalCoordinates] = useState([]);
  const [nearbyVADistances, setNearbyVADistances] = useState(false);
  const dispatch = useDispatch();

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 submitTransformer has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

const submitTransformer = (formConfig, form) => {
  const { data: formData } = form;
  const primaryKey = hasPrimaryCaregiver(formData) ? 'primary' : null;
  const SecondaryOneKey = hasSecondaryCaregiverOne(formData)
    ? 'secondaryOne'
Severity: Minor
Found in src/applications/caregivers/config/submit-transformer.js - About 2 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 SpouseGrossMonthlyIncomeInput has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

const SpouseGrossMonthlyIncomeInput = props => {
  const { goToPath, goBack, setFormData } = props;

  const editIndex = getJobIndex();

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 GrossMonthlyIncomeInput has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

const GrossMonthlyIncomeInput = props => {
  const { goToPath, goBack, setFormData } = props;

  const editIndex = getJobIndex();

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 parseTestFile has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

function parseTestFile(features, code) {
  const stack = [];
  const ast = parser.parse(code, { sourceType: 'module', plugins: ['jsx'] });
  traverse.default(ast, {
    enter(path) {
Severity: Minor
Found in src/applications/vaos/scripts/gherkin.js - About 2 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 FilterYourResults has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

export function FilterYourResults({
  dispatchFilterChange,
  dispatchError,
  filters,
  modalClose,
Severity: Minor
Found in src/applications/gi/containers/FilterYourResults.jsx - About 2 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 ContactAccreditedRepresentative has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

const ContactAccreditedRepresentative = props => {
  const { formData, goBack, goForward, goToPath } = props;
  const rep = props?.formData?.['view:selectedRepresentative'];
  const repAttributes = rep?.attributes;
  const addressData = getEntityAddressAsObject(repAttributes);

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 annuityPages.js has 274 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import React from 'react';
import merge from 'lodash/merge';
import {
  arrayBuilderItemFirstPageTitleUI,
  arrayBuilderItemSubsequentPageTitleUI,

    File SchemaForm.jsx has 274 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import PropTypes from 'prop-types';
    import React from 'react';
    import { merge, once } from 'lodash';
    import classNames from 'classnames';
    import Form from '@department-of-veterans-affairs/react-jsonschema-form';

      File digitalFormPatterns.js has 274 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import * as webComponentPatterns from 'platform/forms-system/src/js/web-component-patterns';
      import { arrayBuilderPages } from 'platform/forms-system/src/js/patterns/array-builder';
      import { formatReviewDate } from 'platform/forms-system/exportsFile';
      
      /** @type {SchemaOptions} */

        Function getAllFormLinks has 64 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export const getAllFormLinks = getAppUrlImpl => {
          if (!getAppUrlImpl) {
            throw new Error(
              'getAppUrlImpl is required as an argument of getAllFormLinks()',
            );
        Severity: Major
        Found in src/platform/forms/constants.js - About 2 hrs to fix

          Function VaFileInputField has 64 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const VaFileInputField = props => {
            const mappedProps = vaFileInputFieldMapping(props);
            const dispatch = useDispatch();
            const { formNumber } = props?.uiOptions;
            const { fileUploadUrl } = mappedProps;

            Function createDirectDepositPage has 64 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export default function createDirectDepositPage() {
              const bankAccountProperties = {
                type: 'object',
                properties: {
                  accountType: {
            Severity: Major
            Found in src/applications/edu-benefits/10203/pages/DirectDeposit.jsx - About 2 hrs to fix

              Function IntroductionPage has 64 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export default function IntroductionPage(props) {
                const { route } = props;
                const { formConfig, pageList } = route;
                const { appType } = formConfig?.customText;
              
              
              Severity: Major
              Found in src/applications/ivc-champva/10-7959a/containers/IntroductionPage.jsx - About 2 hrs to fix

                Function libraryFilters has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export function libraryFilters(el) {
                  // Grab our current page from the active pager button.
                  if (el.srcElement.classList.contains('pager-numbers')) {
                    activePage = parseInt(el.srcElement.text, 10);
                    sessionStorage.setItem('pageNum', parseInt(el.srcElement.text, 10));

                  Function transformTOEForm has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export function transformTOEForm(_formConfig, form) {
                    const formFieldUserFullName = form?.data['view:userFullName']?.userFullName;
                    const viewComponentUserFullName =
                      form?.loadedData?.formData['view:userFullName']?.userFullName;
                    const formFieldDateOfBirth = form?.data?.dateOfBirth;
                  Severity: Major
                  Found in src/applications/toe/utils/form-submit-transform.js - About 2 hrs to fix

                    Function ArrivedAtFacility has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    const ArrivedAtFacility = props => {
                      const { router } = props;
                      const { t } = useTranslation();
                      const dispatch = useDispatch();
                      const { goToNextPage } = useFormRouting(router);
                    Severity: Major
                    Found in src/applications/check-in/day-of/pages/ArrivedAtFacility.jsx - About 2 hrs to fix

                      Function transform5490Form has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export function transform5490Form(_formConfig, form) {
                        const formFieldUserFullName = form?.data?.claimantFullName;
                        const viewComponentUserFullName =
                          form?.loadedData?.formData?.claimantFullName;
                      
                      

                        Function LandingPageUnauth has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        const LandingPageUnauth = () => {
                          const dispatch = useDispatch();
                          const handleSignIn = () => {
                            dispatch(toggleLoginModal(true, 'mhv-sm-landing-page'));
                          };
                          Severity
                          Category
                          Status
                          Source
                          Language