department-of-veterans-affairs/vets-website

View on GitHub

Showing 4,231 of 14,884 total issues

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

  render() {
    const {
      addressValidationType,
      suggestedAddresses,
      addressFromUser,

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

      render() {
        // loading state for terms content is handled by parent component
        const { terms } = this.props;
    
        if (!terms.termsContent) {
    Severity: Major
    Found in src/platform/user/authorization/components/AcceptTermsPrompt.jsx - About 2 hrs to fix

      Function submit has 73 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const submit = form => {
        const currentAddress = form.data['view:currentAddress'];
        const itemQuantities = form.data?.order?.length;
        const { order, permanentAddress, temporaryAddress, vetEmail } = form.data;
        for (const address of [permanentAddress, temporaryAddress]) {
      Severity: Major
      Found in src/applications/health-care-supply-reordering/config/form.js - About 2 hrs to fix

        Function WiderThanMobileOfficialGovtWebsite has 73 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const WiderThanMobileOfficialGovtWebsite = () => {
          const [isExpanded, setIsExpanded] = useState(false);
        
          const toggleExpansion = () => {
            setIsExpanded(!isExpanded);

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

            render() {
              return (
                <div className="schemaform-intro">
                  <FormTitle title="Apply for a Specially Adapted Housing Grant or Special Home Adaptation Grant" />
                  <p>
          Severity: Major
          Found in src/applications/sah/sahg/containers/IntroductionPage.jsx - About 2 hrs to fix

            Function activeDutyNote has 73 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              const activeDutyNote = () => {
                if (
                  eighteenOrOver(formData.relativeDateOfBirth) &&
                  (!hasServed || (hasServed && allServicePeriodsHaveEndDate))
                ) {
            Severity: Major
            Found in src/applications/edu-benefits/5490/containers/PreSubmitInfo.jsx - About 2 hrs to fix

              Function createDirectDepositPage has 73 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export default function createDirectDepositPage(schema) {
                const { bankAccountChangeUpdate, bankAccount } = schema.definitions;
              
                return {
                  title: 'Direct deposit',
              Severity: Major
              Found in src/applications/edu-benefits/pages/directDepositChangeUpdate.js - About 2 hrs to fix

                Function facilityReducer has 73 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export function facilityReducer(state = initialState, action) {
                  switch (action.type) {
                    case FETCH_FACILITY_STARTED:
                      return { ...state, data: {}, loading: true, error: false };
                    case FETCH_FACILITY_SUCCESS:
                Severity: Major
                Found in src/applications/static-pages/facilities/reducers/index.js - About 2 hrs to fix

                  Function WiderThanMobileOfficialGovtWebsite has 73 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  const WiderThanMobileOfficialGovtWebsite = () => {
                    const [isExpanded, setIsExpanded] = useState(false);
                  
                    const toggleExpansion = () => {
                      setIsExpanded(!isExpanded);

                    Function isLocationOfResidenceRequired has 73 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export const isLocationOfResidenceRequired = data => {
                      const {
                        contactPreference,
                        relationshipToVeteran,
                        selectCategory,
                    Severity: Major
                    Found in src/applications/ask-va/config/helpers.jsx - About 2 hrs to fix

                      Function CustomResolutionOptionReview has 73 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

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

                        Function fetchConfirmedAppointmentDetails has 73 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export function fetchConfirmedAppointmentDetails(id, type) {
                          return async (dispatch, getState) => {
                            try {
                              const state = getState();
                              const featureVAOSServiceVAAppointments = selectFeatureVAOSServiceVAAppointments(
                        Severity: Major
                        Found in src/applications/vaos/appointment-list/redux/actions.js - About 2 hrs to fix

                          Function GiBillBreadcrumbs has 73 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          const GiBillBreadcrumbs = () => {
                            const ProgramsTypeMatch = useRouteMatch(
                              '/institution/:facilityCode/:programType',
                            );
                            const profileMatch = useRouteMatch('/institution/:facilityCode');
                          Severity: Major
                          Found in src/applications/gi/components/GiBillBreadcrumbs.jsx - About 2 hrs to fix

                            Function onChangeEvent has 73 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              const onChangeEvent = option => {
                                // title may be a React component
                                const title = options.title?.props?.children || options.title || '';
                                // this check isn't ideal since the message may exist and the question
                                // may be dynamically toggled between being required or not

                              Function getCompareCalculatorState has 73 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              export const getCompareCalculatorState = (
                                calculator,
                                institution,
                                constants,
                              ) => {
                              Severity: Major
                              Found in src/applications/gi/selectors/compare.js - About 2 hrs to fix

                                Function ConnectedDevicesContainer has 73 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                export const ConnectedDevicesContainer = () => {
                                  const [hasLoaded, setHasLoaded] = useState(false);
                                  const [connectionAvailable, setConnectionAvailable] = useState(false);
                                  const [connectedDevices, setConnectedDevices] = useState([]);
                                  const [successAlert, setSuccessAlert] = useState(false);

                                  Function removeDependents has 73 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  export function removeDependents(state = initialState, action) {
                                    // schema, uiSchema, and formData are already extracted based on index (stateKey) here.
                                    if (action.type === FORM_DATA_UPDATED) {
                                      const {
                                        data: newFormData,

                                    Function makeUserObject has 73 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    export function makeUserObject(options = {}) {
                                      const services = options.services || ['vet360'];
                                      let claims = {
                                        ch33_bank_accounts: true,
                                        communication_preferences: true,
                                    Severity: Major
                                    Found in src/applications/personalization/common/helpers.js - About 2 hrs to fix

                                      Function LabsAndTests has 73 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                      const LabsAndTests = () => {
                                        const dispatch = useDispatch();
                                        const updatedRecordList = useSelector(
                                          state => state.mr.labsAndTests.updatedList,
                                        );
                                      Severity: Major
                                      Found in src/applications/mhv-medical-records/containers/LabsAndTests.jsx - About 2 hrs to fix

                                        Function ReviewFieldTemplate has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                                        Open

                                        export default function ReviewFieldTemplate(props) {
                                          const { children, uiSchema, schema, formContext } = props;
                                          const label = uiSchema['ui:title'] || props.label;
                                          const description = uiSchema['ui:description'];
                                          const textDescription = typeof description === 'string' ? description : null;
                                        Severity: Minor
                                        Found in src/platform/forms-system/src/js/review/ReviewFieldTemplate.jsx - About 2 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

                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language