department-of-veterans-affairs/vets-website

View on GitHub

Showing 4,177 of 14,709 total issues

Function AvailableDebtsAndCopays has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

const AvailableDebtsAndCopays = ({ formContext }) => {
  const {
    debts,
    statements,
    pending,

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

function HighestRankAutoSuggest({ formData, formContext, idSchema, uiSchema }) {
  const dispatch = useDispatch();
  const [branchOfService, setBranchOfService] = useState('');
  const [rankOptions, setRankOptions] = useState([]);
  const [rank, setRank] = useState('');

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

const SelectAccreditedRepresentative = props => {
  const {
    loggedIn,
    setFormData,
    formData,

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 ConfirmationPage has 106 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function ConfirmationPage(props) {
  const { form } = props;
  const { submission, data } = form;
  const submitDate = new Date(submission?.timestamp);

Severity: Major
Found in src/applications/ivc-champva/10-7959C/containers/ConfirmationPage.jsx - About 4 hrs to fix

    Function InsurancePolicyInformation has 106 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const InsurancePolicyInformation = props => {
      const { data, goToPath, setFormData } = props;
    
      const { providers = [] } = data;
      const search = new URLSearchParams(window.location.search);

      Function InsurancePolicyInformation has 106 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const InsurancePolicyInformation = props => {
        const { data, goToPath, setFormData } = props;
      
        const { providers = [] } = data;
        const search = new URLSearchParams(window.location.search);

        Function ReloadWrapper has 106 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const ReloadWrapper = props => {
          const { children, router, app, reloadUpcoming = false } = props;
          const location = window.location.pathname;
          const { t } = useTranslation();
          const dispatch = useDispatch();
        Severity: Major
        Found in src/applications/check-in/components/layout/ReloadWrapper.jsx - About 4 hrs to fix

          Function createFormConfig781 has 106 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function createFormConfig781(iterations) {
            let configObj = {};
            const formType = '781';
            for (let index = 0; index < iterations; index++) {
              configObj = {
          Severity: Major
          Found in src/applications/disability-benefits/all-claims/config/781/index.js - About 4 hrs to fix

            File component-library-analytics-setup.js has 343 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            /* eslint-disable camelcase */
            /**
             * Attaches CustomEvent 'component-library-analytics' listener to document.body
             * to translate component library actions into analytics dataLayer events.
             */
            Severity: Minor
            Found in src/platform/site-wide/component-library-analytics-setup.js - About 4 hrs to fix

              File schemas.js has 343 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import constants from 'vets-json-schema/dist/constants.json';
              import currentOrPastDateUI from 'platform/forms-system/src/js/definitions/currentOrPastDate';
              import addressUiSchema from 'platform/forms-system/src/js/definitions/profileAddress';
              
              const validateAtLeastOneSelected = (errors, fieldData, formData) => {

                File seiConstants.js has 342 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                /** from BloodSugarTestingMethodEnumeration.java */
                export const VITALS_BLOOD_SUGAR_METHOD = {
                  CLT: 'Clinical Lab Test',
                  SL: 'Sterile Lancet',
                  T: 'Transcutaneous',
                Severity: Minor
                Found in src/applications/mhv-medical-records/util/seiConstants.js - About 4 hrs to fix

                  Function Approved has 105 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export function Approved(name) {
                    return (
                      <>
                        <div>
                          <va-alert
                  Severity: Major
                  Found in src/applications/fry-dea/components/ConfirmationResponses.jsx - About 4 hrs to fix

                    Function MessageListItem has 105 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    const MessageListItem = props => {
                      const location = useLocation();
                      const {
                        senderName,
                        sentDate,

                      File ArrayField.jsx has 341 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import PropTypes from 'prop-types';
                      import React from 'react';
                      import Scroll from 'react-scroll';
                      import {
                        getDefaultFormState,
                      Severity: Minor
                      Found in src/platform/forms-system/src/js/review/ArrayField.jsx - About 4 hrs to fix

                        File EvidenceSummaryLists.jsx has 341 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        import React from 'react';
                        import { Link } from 'react-router';
                        import PropTypes from 'prop-types';
                        
                        import readableList from 'platform/forms-system/src/js/utilities/data/readableList';

                          File submit.js has 341 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          import _ from 'platform/utilities/data';
                          import {
                            PTSD_INCIDENT_ITERATION,
                            PTSD_CHANGE_LABELS,
                            ATTACHMENT_KEYS,
                          Severity: Minor
                          Found in src/applications/disability-benefits/all-claims/utils/submit.js - About 4 hrs to fix

                            File ArrayField.jsx has 341 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            import get from '@department-of-veterans-affairs/platform-forms-system/get';
                            import set from '@department-of-veterans-affairs/platform-forms-system/set';
                            import {
                              getDefaultFormState,
                              toIdSchema,
                            Severity: Minor
                            Found in src/applications/ask-va/components/ArrayField.jsx - About 4 hrs to fix

                              Function render has 104 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                render() {
                                  const {
                                    currentDropdown,
                                    currentSection,
                                    data,
                              Severity: Major
                              Found in src/platform/site-wide/mega-menu/components/MegaMenu.jsx - About 4 hrs to fix

                                Function FormNav has 104 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                export default function FormNav(props) {
                                  const {
                                    formConfig = {},
                                    currentPath,
                                    formData,
                                Severity: Major
                                Found in src/platform/forms-system/src/js/components/FormNav.jsx - About 4 hrs to fix

                                  Function fieldEntries has 104 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  const fieldEntries = (key, uiSchema, data, schema, schemaFromState, index) => {
                                    if (data === undefined || data === null) return null;
                                    if (key.startsWith('view:') || key.startsWith('ui:')) return null;
                                  
                                    let schemaPropertiesKey = schema.properties?.[key];
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language