department-of-veterans-affairs/vets-website

View on GitHub

Showing 3,724 of 12,675 total issues

File migrations.js has 311 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import get from 'platform/utilities/data/get';
import set from 'platform/utilities/data/set';
import { isValidDateRange } from 'platform/forms/validations';
import { convertToDateField } from 'platform/forms-system/src/js/validation';
import { isValidCentralMailPostalCode } from 'platform/forms/address/validations';
Severity: Minor
Found in src/applications/pensions/migrations.js - About 3 hrs to fix

    Function DebtLettersDownload has 86 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const DebtLettersDownload = () => {
      const { debtLinks, isError, isVBMSError, hasDependentDebts } = useSelector(
        ({ combinedPortal }) => combinedPortal.debtLetters,
      );
    
    

      Function ConfirmationPage has 86 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-10D/containers/ConfirmationPage.jsx - About 3 hrs to fix

        Function SubTopicSelectPage has 86 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const SubTopicSelectPage = props => {
          const { onChange, loggedIn, goBack, goToPath, formData, topicID } = props;
        
          const [apiData, setApiData] = useState([]);
          const [loading, isLoading] = useState(false);
        Severity: Major
        Found in src/applications/ask-va/containers/SubTopicSelectPage.jsx - About 3 hrs to fix

          File helpers.js has 310 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import moment from 'moment-timezone';
          import {
            DefaultFolders as Folders,
            Paths,
            RecipientStatus,
          Severity: Minor
          Found in src/applications/mhv-secure-messaging/util/helpers.js - About 3 hrs to fix

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

            const allFolders = {
              data: [
                {
                  attributes: {
                    count: 3,
            Severity: Minor
            Found in src/applications/personalization/dashboard/mocks/messaging/index.js - About 3 hrs to fix

              File RefillPrescriptions.jsx has 310 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import React, { useState, useEffect, useMemo } from 'react';
              import PropTypes from 'prop-types';
              import { useLocation } from 'react-router-dom';
              import { useSelector, useDispatch } from 'react-redux';
              import {
              Severity: Minor
              Found in src/applications/mhv-medications/containers/RefillPrescriptions.jsx - About 3 hrs to fix

                Function subscribeComponentAnalyticsEvents has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                Open

                export function subscribeComponentAnalyticsEvents(
                  e,
                  recordEvent = _recordEvent,
                ) {
                  // Is it a component we are tracking?
                Severity: Minor
                Found in src/platform/site-wide/component-library-analytics-setup.js - About 3 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 checkValidSchema has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                Open

                export function checkValidSchema(schema, errors = [], path = ['root']) {
                  if (typeof schema.type !== 'string') {
                    errors.push(`Missing type in ${path.join('.')} schema.`);
                  }
                
                
                Severity: Minor
                Found in src/platform/forms-system/src/js/helpers.js - About 3 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 ContestableIssuesWidget has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                Open

                const ContestableIssuesWidget = props => {
                  const {
                    value = [],
                    id,
                    options,

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

                export const App = ({ loggedIn, toggleLoginModal, displayToggle }) => {
                  const [lastUpdated, updateLastUpdated] = useState('');
                  const [year, updateYear] = useState(0);
                  const [formError, updateFormError] = useState({ error: false, type: '' }); // types: "not found", "download error"
                  const [formType, updateFormType] = useState('pdf');
                Severity: Minor
                Found in src/applications/static-pages/download-1095b/components/App/index.js - About 3 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 EmploymentRecord has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                Open

                const EmploymentRecord = ({
                  idSchema,
                  uiSchema,
                  formData,
                  setFormData,

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

                export function KeywordSearch({
                  className,
                  inputValue,
                  label,
                  labelAdditional,
                Severity: Minor
                Found in src/applications/gi/components/search/KeywordSearch.jsx - About 3 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

                File SearchResult.jsx has 309 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                /* eslint-disable @department-of-veterans-affairs/prefer-button-component */
                
                import React, { useState, useEffect } from 'react';
                import PropTypes from 'prop-types';
                import {

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

                  import React from 'react';
                  import PropTypes from 'prop-types';
                  import { connect } from 'react-redux';
                  import { toggleLoginModal as toggleLoginModalAction } from '@department-of-veterans-affairs/platform-site-wide/actions';
                  import { useFeatureToggle } from 'platform/utilities/feature-toggles';

                    File CompareDrawer.jsx has 309 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import React, { useEffect, useState, useRef } from 'react';
                    import { connect } from 'react-redux';
                    import { useHistory } from 'react-router-dom';
                    import classNames from 'classnames';
                    import { removeCompareInstitution, compareDrawerOpened } from '../actions';
                    Severity: Minor
                    Found in src/applications/gi/containers/CompareDrawer.jsx - About 3 hrs to fix

                      File Profile.jsx has 309 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import React, { Component } from 'react';
                      import PropTypes from 'prop-types';
                      import { connect } from 'react-redux';
                      import { BrowserRouter, Route, Switch, Redirect } from 'react-router-dom';
                      import { LastLocationProvider } from 'react-router-last-location';
                      Severity: Minor
                      Found in src/applications/personalization/profile/components/Profile.jsx - About 3 hrs to fix

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

                          render() {
                            const {
                              uiSchema,
                              errorSchema,
                              idSchema,
                        Severity: Major
                        Found in src/platform/forms-system/src/js/fields/BasicArrayField.jsx - About 3 hrs to fix

                          Function DynamicRadioWidget has 85 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          export function DynamicRadioWidget(props) {
                            const { onChange } = props;
                            let locationsList = null;
                            let upperContent = null;
                            const [locations, setLocations] = useState([]);

                            Function CancelPageLayout has 85 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            export default function CancelPageLayout() {
                              const { id } = useParams();
                              const {
                                appointment,
                                bookingNotes,
                              Severity
                              Category
                              Status
                              Source
                              Language