department-of-veterans-affairs/vets-website

View on GitHub

Showing 3,724 of 12,675 total issues

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 validation.js has 494 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: Minor
      Found in src/platform/forms-system/src/js/validation.js - 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 EmploymentRecord has 195 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const EmploymentRecord = props => {
            const { data, goToPath, setFormData } = props;
          
            const editIndex = getJobIndex();
          
          

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

            const PrescriptionDetailsDocumentation = () => {
              const { prescriptionId } = useParams();
              const { search } = useLocation();
              const queryParams = new URLSearchParams(search);
              const ndcNumber = queryParams.get('ndc');

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

              const EmploymentRecord = props => {
                const { data, goToPath, setFormData } = props;
              
                const editIndex = getJobIndex();
              
              

                Function navigateForward has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
                Open

                export const navigateForward = (
                  SHORT_NAME,
                  formResponses,
                  router,
                  editMode,
                Severity: Minor
                Found in src/applications/discharge-wizard/utilities/page-navigation.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 MessageList has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
                Open

                const MessageList = props => {
                  const dispatch = useDispatch();
                  const { folder, messages, keyword, isSearch, sortOrder, page } = props;
                  const perPage = 10;
                  const totalEntries = messages?.length;

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

                import appendQuery from 'append-query';
                
                import { fetchAndUpdateSessionExpiration as fetch } from 'platform/utilities/api';
                import mbxGeo from '@mapbox/mapbox-sdk/services/geocoding';
                import { api } from '../config';
                Severity: Minor
                Found in src/applications/gi/actions/index.js - About 7 hrs to fix

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

                    render() {
                      const {
                        formIds,
                        profile,
                        login,
                  Severity: Major
                  Found in src/platform/forms/save-in-progress/ApplicationStatus.jsx - About 7 hrs to fix

                    Function schoolSearch has 192 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export default function schoolSearch(state = initialState, action) {
                      switch (action.type) {
                        case INSTITUTION_SELECTED: {
                          const {
                            address1,
                    Severity: Major
                    Found in src/applications/edu-benefits/feedback-tool/reducers/schoolSelect.js - About 7 hrs to fix

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

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

                        File constants.js has 485 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        import { getAppUrl } from '../utilities/registry-helpers';
                        
                        export const VA_FORM_IDS = Object.freeze({
                          FEEDBACK_TOOL: 'FEEDBACK-TOOL',
                          FORM_0873: '0873',
                        Severity: Minor
                        Found in src/platform/forms/constants.js - About 7 hrs to fix

                          File SchoolSelectField.jsx has 485 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          import React from 'react';
                          import PropTypes from 'prop-types';
                          import _ from 'lodash';
                          import classNames from 'classnames';
                          import {

                            Function Error has 190 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            const Error = () => {
                              const { t } = useTranslation();
                              const selectError = useMemo(makeSelectError, []);
                              const { error } = useSelector(selectError);
                            
                            
                            Severity: Major
                            Found in src/applications/check-in/day-of/pages/Error.jsx - About 7 hrs to fix

                              Function SpousePayrollDeductionInputList has 190 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              const SpousePayrollDeductionInputList = props => {
                                const { goToPath, goBack, setFormData } = props;
                              
                                const editIndex = getJobIndex();
                              
                              

                                Function PrescriptionDetails has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
                                Open

                                const PrescriptionDetails = () => {
                                  const prescription = useSelector(
                                    state => state.rx.prescriptions?.prescriptionDetails,
                                  );
                                  const prescriptionsApiError = useSelector(
                                Severity: Minor
                                Found in src/applications/mhv-medications/containers/PrescriptionDetails.jsx - 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 render has 189 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  render() {
                                    const { onCTALinkClick } = this;
                                    const {
                                      ehrDataByVhaId,
                                      cernerFacilities,
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language