department-of-veterans-affairs/vets-website

View on GitHub

Showing 3,724 of 12,675 total issues

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

export function transform(formConfig, form) {
  const expandedPages = expandArrayPages(
    createFormPageList(formConfig),
    form.data,
  );
Severity: Major
Found in src/applications/hca/utils/helpers/index.js - About 3 hrs to fix

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

      render() {
        const { disabilities } = this.state;
        const { calculatedRating } = this.state;
        const ratings = getRatings(disabilities);
    
    

      Function ContactInformation has 90 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const ContactInformation = () => {
        const lastLocation = useLastLocation();
      
        const hasUnsavedEdits = useSelector(
          state => state.vapService.hasUnsavedEdits,

        Function EkgDetails has 90 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const EkgDetails = props => {
          const { record, runningUnitTest } = props;
          const allowTxtDownloads = useSelector(
            state =>
              state.featureToggles[

          Function content has 90 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            const content = () => {
              if (
                (pdfTxtGenerateStatus.status !== PDF_TXT_GENERATE_STATUS.InProgress ||
                  allergiesError) &&
                (prescription || prescriptionsApiError)
          Severity: Major
          Found in src/applications/mhv-medications/containers/PrescriptionDetails.jsx - About 3 hrs to fix

            File ConfirmationPage.jsx has 316 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import React from 'react';
            import { connect } from 'react-redux';
            
            import scrollToTop from 'platform/utilities/ui/scrollToTop';
            import PropTypes from 'prop-types';

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

              // Node modules.
              import React from 'react';
              import PropTypes from 'prop-types';
              import { CONTACTS } from '@department-of-veterans-affairs/component-library/contacts';
              // Relative imports.

                Function Search has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                Open

                export const Search = ({ onSearch }) => {
                  const queryParams = new URLSearchParams(window.location.search);
                
                  const defaultSelectedOption = deriveDefaultSelectedOption();
                
                
                Severity: Minor
                Found in src/applications/static-pages/events/components/Search/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 AppointmentDetails has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                Open

                const AppointmentDetails = props => {
                  const { router } = props;
                  const { t } = useTranslation();
                  const dispatch = useDispatch();
                  const {

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

                const CustomResolutionOptionReview = props => {
                  const formData = useSelector(state => state.form.data);
                  const { selectedDebtsAndCopays = [] } = formData;
                
                  const currentDebt = selectedDebtsAndCopays[props.pagePerItemIndex];

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

                const EnhancedVehicleRecord = ({ data, goToPath, setFormData }) => {
                  const { assets } = data;
                  const { automobiles = [] } = assets;
                
                  const searchIndex = new URLSearchParams(window.location.search);

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

                  (eligibility, institution, form, derived) => {
                    const calculatedBenefits = {};
                
                    if ([eligibility, institution, form, derived].some(e => !e || isEmpty(e))) {
                      return calculatedBenefits;
                Severity: Minor
                Found in src/applications/gi/selectors/calculator.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 CautionaryInformation has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                Open

                export function CautionaryInformation({ institution, showModal }) {
                  const {
                    complaints,
                    schoolClosing,
                    schoolClosingOn,
                Severity: Minor
                Found in src/applications/gi/components/profile/CautionaryInformation.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

                Function useNotificationSettingsUtils has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                Open

                export const useNotificationSettingsUtils = () => {
                  const communicationPreferences = useSelector(
                    state => state?.communicationPreferences,
                  );
                
                

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

                const NewRecordsIndicator = ({
                  refreshState,
                  extractType,
                  newRecordsFound,
                  reloadFunction,

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

                  render() {
                    const { route } = this.props;
                    const { formConfig, pageList } = route;
                    return (
                      <article className="schemaform-intro">
                Severity: Major
                Found in src/applications/_mock-form/containers/IntroductionPage.jsx - About 3 hrs to fix

                  Function Landing has 89 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  const Landing = props => {
                    const { router } = props;
                    const { t } = useTranslation();
                  
                    const { jumpToPage } = useFormRouting(router);
                  Severity: Major
                  Found in src/applications/check-in/travel-claim/pages/landing/index.jsx - About 3 hrs to fix

                    Function VaMedicalCenter has 89 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    const VaMedicalCenter = props => {
                      const { formContext, id, onChange, value, veteranFacilityState } = props;
                      const { reviewMode, submitted } = formContext;
                    
                      const [facilities, setFacilities] = useState([]);
                    Severity: Major
                    Found in src/applications/caregivers/components/FormFields/VaMedicalCenter.jsx - About 3 hrs to fix

                      Function TopicSelect has 89 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      const TopicSelect = props => {
                        const { id, onChange, value, loggedIn, categoryID } = props;
                        const dispatch = useDispatch();
                      
                        const [apiData, setApiData] = useState([]);
                      Severity: Major
                      Found in src/applications/ask-va/components/FormFields/TopicSelect.jsx - About 3 hrs to fix

                        Function ConfirmApprovedPage has 89 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export default function ConfirmApprovedPage() {
                          const [confirmedData, setConfirmedData] = useState(0);
                        
                          // on react component mount, fetch data
                          useEffect(() => {
                        Severity: Major
                        Found in src/applications/vaos/referral-appointments/ConfirmApprovedPage.jsx - About 3 hrs to fix
                          Severity
                          Category
                          Status
                          Source
                          Language