department-of-veterans-affairs/vets-website

View on GitHub

Showing 4,177 of 14,709 total issues

Function ReplyDraftItem has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring.
Open

const ReplyDraftItem = props => {
  const {
    draft,
    drafts,
    cannotReply,

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

export function uiSchema(
  label = 'Address',
  useStreet2 = true,
  useStreet3 = false,
  isRequired = null,

    Function transform has 202 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function transform(formConfig, form) {
      // Grab isBDD before things are changed/deleted
      const isBDDForm = isBDD(form.data);
      // Grab ratedDisabilities before they're deleted in case the page is inactive
      // We need to send all of these to vets-api even if the veteran doesn't apply
    Severity: Major
    Found in src/applications/disability-benefits/all-claims/submit-transformer.js - About 1 day to fix

      File validation.js has 503 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import find from 'lodash/find';
      import { Validator } from 'jsonschema';
      import get from '../../../utilities/data/get';
      import omit from '../../../utilities/data/omit';
      import set from '../../../utilities/data/set';
      Severity: Major
      Found in src/platform/forms-system/src/js/validation.js - About 1 day to fix

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

        const all = [
          {
            id: 5621490,
            reasonForStudy: null,
            radiologist: 'DOE,JOHN',
        Severity: Minor
        Found in src/platform/mhv/api/mocks/medical-records/mhv-radiology/index.js - About 1 day to fix

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

          import PropTypes from 'prop-types';
          import React from 'react';
          import classNames from 'classnames';
          
          import {
          Severity: Minor
          Found in src/platform/forms-system/src/js/fields/ArrayField.jsx - About 1 day to fix

            Function uiSchema has 199 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export function uiSchema(
              label = 'Address',
              useStreet3 = false,
              isRequired = null,
              ignoreRequired = false,
            Severity: Major
            Found in src/applications/pre-need/definitions/address.js - About 7 hrs to fix

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

                render() {
                  const {
                    uiSchema,
                    errorSchema,
                    idSchema,

                File arrayBuilder.jsx has 498 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                /* eslint-disable no-unused-vars */
                import { getNextPagePath } from 'platform/forms-system/src/js/routing';
                import {
                  createArrayBuilderItemAddPath,
                  onNavForwardKeepUrlParams,

                  File seiActivityJournal.js has 497 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  const activityJournal = [
                    {
                      activityJournalId: 17698747,
                      oplock: null,
                      createdDate: null,

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

                      render() {
                        return (
                          <div>
                            <article>
                              <div role="heading" aria-level="2">

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

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

                        Function SpouseEmploymentWorkDates has 198 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        const SpouseEmploymentWorkDates = props => {
                          const { goToPath, setFormData, data } = props;
                        
                          const RETURN_PATH = '/enhanced-spouse-employment-records';
                        
                        

                          Function default has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
                          Open

                          export default function(state = INITIAL_STATE, action) {
                            switch (action.type) {
                              case CALCULATOR_INPUTS_CHANGED: {
                                const { field, value } = action;
                                let convertedValue = value;
                          Severity: Minor
                          Found in src/applications/gi/reducers/calculator.js - About 7 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 NearByVetCenters has 197 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          const NearByVetCenters = props => {
                            const [originalCoordinates, setOriginalCoordinates] = useState([]);
                            const [fetchedVetCenters, setFetchedVetCenters] = useState([]);
                            const [nearbyVetCenterDistances, setNearbyVetCenterDistances] = useState(
                              false,

                            File reducer.js has 495 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            import { getDefaultFormState } from '@department-of-veterans-affairs/react-jsonschema-form/lib/utils';
                            import {
                              updateSchemasAndData,
                              updateItemsSchema,
                            } from 'platform/forms-system/src/js/state/helpers';
                            Severity: Minor
                            Found in src/applications/vaos/covid-19-vaccine/redux/reducer.js - About 7 hrs to fix

                              File App.jsx has 493 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              import React, { useEffect, useState, useRef } from 'react';
                              import { connect } from 'react-redux';
                              import moment from 'moment';
                              import PropTypes from 'prop-types';
                              import { VaBreadcrumbs } from '@department-of-veterans-affairs/web-components/react-bindings';
                              Severity: Minor
                              Found in src/applications/my-education-benefits/containers/App.jsx - About 7 hrs to fix

                                Function ContestableIssues has 195 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                const ContestableIssues = props => {
                                  const {
                                    id,
                                    options,
                                    formContext = {},
                                Severity: Major
                                Found in src/applications/appeals/shared/components/ContestableIssues.jsx - About 7 hrs to fix

                                  Function EmploymentWorkDates has 195 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  const EmploymentWorkDates = props => {
                                    const { goToPath, setFormData, data } = props;
                                  
                                    const RETURN_PATH = '/enhanced-employment-records';
                                  
                                  

                                    Function PrimaryAddressWithAutofill has 194 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    const PrimaryAddressWithAutofill = props => {
                                      const { formContext, formData, idSchema, onChange, schema } = props;
                                      const { reviewMode, submitted } = formContext;
                                      const { properties: schemaProps } = schema;
                                      const { veteranAddress } = useSelector(state => state.form.data);
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language