department-of-veterans-affairs/vets-website

View on GitHub

Showing 3,724 of 12,675 total issues

Function reduceErrors has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

export const reduceErrors = (errors, pageList, reviewErrors = {}) =>
  errors.reduce((processedErrors, error) => {
    let errorIndex = null; // save key (index) of array items with __error
    const findErrors = (name, err) => {
      if (err && typeof err === 'object') {
Severity: Minor
Found in src/platform/forms-system/src/js/utilities/data/reduceErrors.js - About 4 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 updateRequiredFields has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

export function updateRequiredFields(schema, uiSchema, formData, index = null) {
  if (!uiSchema) {
    return schema;
  }

Severity: Minor
Found in src/platform/forms-system/src/js/state/helpers.js - About 4 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 render has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

  render() {
    const { location } = this.props;

    if (!location) {
      return null;
Severity: Minor
Found in src/applications/facility-locator/components/AppointmentInfo.jsx - About 4 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 Dropdown has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

const Dropdown = ({
  shortName,
  router,
  formResponses,
  formValue,

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

const RadioGroup = ({
  formError,
  formResponses,
  formValue,
  hint,

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

function nextQuestion(currentQuestion, answer, state) {
  let next;
  const noGeneralCourtMartial = ['2', '3'].includes(state['7_courtMartial']);
  const dischargeYear = state['2_dischargeYear'];
  const dischargeMonth = state['3_dischargeMonth'] || 1;
Severity: Minor
Found in src/applications/discharge-wizard/reducers/discharge-wizard.js - About 4 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 getDerivedAttributes has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

export function getDerivedAttributes(constant, eligibility, institution) {
  const your = eligibility;
  const its = institution;
  const chapter = Number(your.giBillChapter);
  let monthlyRate;
Severity: Minor
Found in src/applications/gi/selectors/estimator.js - About 4 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 SearchQueryReducer has 114 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const SearchQueryReducer = (state = INITIAL_STATE, action) => {
  switch (action.type) {
    case SEARCH_STARTED:
      return {
        ...state,
Severity: Major
Found in src/applications/facility-locator/reducers/searchQuery.js - About 4 hrs to fix

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

      render() {
        const { showWizard } = this.props;
    
        if (showWizard === undefined) return null;
        return (
    Severity: Major
    Found in src/applications/edu-benefits/5495/containers/IntroductionPage.jsx - About 4 hrs to fix

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

        render() {
          const { showWizard } = this.props;
      
          if (showWizard === undefined) return null;
          return (
      Severity: Major
      Found in src/applications/edu-benefits/5490/containers/IntroductionPage.jsx - About 4 hrs to fix

        Function UpcomingAppointmentsList has 114 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export default function UpcomingAppointmentsList() {
          const history = useHistory();
          const dispatch = useDispatch();
          const {
            showScheduleButton,

          File MissingFileOverview.jsx has 356 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          /*
          OVERVIEW:
          The MissingFileOverview component is responsible for tracking file uploads
          within the form and displaying a message to the user indicating which files
          they have yet to upload before the application is considered complete. 

            File AddressValidationView.jsx has 355 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import React from 'react';
            import PropTypes from 'prop-types';
            import { connect } from 'react-redux';
            import { VaAlert } from '@department-of-veterans-affairs/component-library/dist/react-bindings';
            import {

              File medicareInformation.js has 355 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import React from 'react';
              import {
                titleUI,
                titleSchema,
                textUI,
              Severity: Minor
              Found in src/applications/ivc-champva/10-7959C/chapters/medicareInformation.js - About 4 hrs to fix

                File form-submit-transform.js has 355 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                // this constant maps the values on address.js in vets.json schema from VA.gov values to LTS values
                // the lts values were found on the LTS database and LTS validates them, so we need to send correct value from here
                const countries = [
                  { schemaValue: 'USA', ltsValue: 'US', label: 'United States' },
                  { schemaValue: 'AFG', ltsValue: 'AF', label: 'Afghanistan' },

                  Function MessageThreadHeader has 113 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  const MessageThreadHeader = props => {
                    const {
                      message,
                      cannotReply,
                      isCreateNewModalVisible,

                    Function RadiologyImagesList has 113 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    const RadiologyImagesList = () => {
                      const dispatch = useDispatch();
                      const allowTxtDownloads = useSelector(
                        state =>
                          state.featureToggles[

                      Function Hub has 113 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export const Hub = () => {
                        const { label, link } = useSignInServiceProvider();
                        const hasBadAddress = useSelector(hasBadAddressSelector);
                      
                        useEffect(() => {
                      Severity: Major
                      Found in src/applications/personalization/profile/components/hub/Hub.jsx - About 4 hrs to fix

                        Function renderResultItems has 112 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          const renderResultItems = (searchQuery, apiResults) => {
                            return apiResults?.map((result, index) => {
                              let item;
                              const showHealthConnectNumber = isHealthAndHealthConnect(result, query);
                        
                        
                        Severity: Major
                        Found in src/applications/facility-locator/components/ResultsList.jsx - About 4 hrs to fix

                          Function guardianInformation has 112 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          export default function guardianInformation(schema, options) {
                            // Use the defaults as necessary, but override with the options given
                            const { fields, required } = {
                              ...defaults(),
                              ...options,
                          Severity: Major
                          Found in src/applications/edu-benefits/1995/pages/guardianInformation.jsx - About 4 hrs to fix
                            Severity
                            Category
                            Status
                            Source
                            Language