department-of-veterans-affairs/vets-website

View on GitHub

Showing 3,724 of 12,675 total issues

Function NoRegistrationMessage has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function NoRegistrationMessage() {
  return (
    <FullWidthLayout>
      <InfoAlert
        status="error"
Severity: Minor
Found in src/applications/vaos/components/NoRegistrationMessage.jsx - About 1 hr to fix

    Function filteredAppointments has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        const filteredAppointments = appointments.filter(appointment => {
          return req.query.statuses.some(status => {
            if (appointment.attributes.status === status) {
              // Automatically add appointments with these statuses to the collection
              if (
    Severity: Minor
    Found in src/applications/vaos/services/mocks/index.js - About 1 hr to fix

      Function generateClaimTitle has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const generateClaimTitle = (claim, placement, tab) => {
        // This will default to 'disability compensation'
        const claimType = getClaimType(claim).toLowerCase();
        const isRequestToAddOrRemoveDependent = addOrRemoveDependentClaimTypeCodes.includes(
          claim?.attributes?.claimTypeCode,
      Severity: Minor
      Found in src/applications/claims-status/utils/helpers.js - About 1 hr to fix

        Function preEligibilityChange has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          const preEligibilityChange = e => {
            const { value } = e.target;
        
            recordEvent({
              event: 'gibct-form-change',
        Severity: Minor
        Found in src/applications/gi/components/SearchBenefits.jsx - About 1 hr to fix

          Function getTab has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            const getTab = tabName => {
              const activeTab = tabName === mobileTab;
              const tabClasses = classNames(
                {
                  'active-results-tab': activeTab,
          Severity: Minor
          Found in src/applications/gi/containers/search/LocationSearchResults.jsx - About 1 hr to fix

            Function eligibilityAndFilters has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              const eligibilityAndFilters = cnt => {
                const showTuitionAndFilters = cnt > 0 || usedFilters;
            
                if (showTuitionAndFilters) {
                  return (
            Severity: Minor
            Found in src/applications/gi/containers/search/LocationSearchResults.jsx - About 1 hr to fix

              Function preEligibilityChange has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                const preEligibilityChange = (e, name, number) => {
                  const field = e.target.name;
                  const { value } = e.target;
              
                  if (field === 'giBillChapter' && value === '33a') {
              Severity: Minor
              Found in src/applications/gi/components/profile/BenefitsForm.jsx - About 1 hr to fix

                Function renderOptions has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  const renderOptions = () => {
                    const displayOptions = Array.isArray(options) ? options : [];
                    return displayOptions.map((option, index) => {
                      const { checked, optionLabel, name, learnMore, dataTestId } = option;
                
                
                Severity: Minor
                Found in src/applications/gi/components/VaCheckboxGroupGi.jsx - About 1 hr to fix

                  Function handleInputFocusWithPotentialOverLap has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export const handleInputFocusWithPotentialOverLap = (
                    fieldId1,
                    fieldId2,
                    scrollableFieldId,
                  ) => {
                  Severity: Minor
                  Found in src/applications/gi/utils/helpers.js - About 1 hr to fix

                    Function addressLabel has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export const addressLabel = address => {
                      // Destructure address object for easier access
                      const {
                        addressLine1,
                        addressLine2,

                      Function transformServiceHistoryEntryIntoTableRow has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export const transformServiceHistoryEntryIntoTableRow = entry => {
                        const formattedBeginDate = entry.beginDate
                          ? moment(entry.beginDate).format('LL')
                          : '';
                        const formattedEndDate = entry.endDate
                      Severity: Minor
                      Found in src/applications/personalization/profile/helpers.js - About 1 hr to fix

                        Function mockGetRefreshStatus has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export const mockGetRefreshStatus = () => {
                          switch (scenario) {
                            case 1: {
                              return mockStatusResponse(0, 80, 70, 70); // STALE
                            }
                        Severity: Minor
                        Found in src/applications/mhv-medical-records/util/testHelper.js - About 1 hr to fix

                          Function createBasicInitialState has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          function createBasicInitialState(serviceHistory) {
                            return {
                              user: {
                                profile: {
                                  veteranStatus: {

                            Function getLabsAndTestsList has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            export const getLabsAndTestsList = (isCurrent = false) => async dispatch => {
                              dispatch({
                                type: Actions.LabsAndTests.UPDATE_LIST_STATE,
                                payload: Constants.loadStates.FETCHING,
                              });
                            Severity: Minor
                            Found in src/applications/mhv-medical-records/actions/labsAndTests.js - About 1 hr to fix

                              Function dropdownContent has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                      const dropdownContent = () => {
                                        return (
                                          <>
                                            <p
                                              className="vads-u-padding-bottom--1"

                                Function prefillPersonalInformation has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  const prefillPersonalInformation = data => {
                                    const newData = _.omit(['personalInformation'], data);
                                    const { personalInformation } = data;
                                
                                    if (personalInformation) {
                                Severity: Minor
                                Found in src/applications/representative-appoint/prefill-transformer.js - About 1 hr to fix

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

                                    const content = () => {
                                      return (
                                        <>
                                          {page ? (
                                            <PrintOnlyPage

                                    Function getServiceAvailability has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    export function getServiceAvailability() {
                                      return dispatch => {
                                        dispatch({
                                          type: SET_SERVICE_AVAILABILITY,
                                          serviceAvailability: SERVICE_AVAILABILITY_STATES.pending,
                                    Severity: Minor
                                    Found in src/applications/post-911-gib-status/actions/post-911-gib-status.js - About 1 hr to fix

                                      Function NavItemRow has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                      const NavItemRow = ({ depth, item, trackEvents }) => {
                                        // Derive item properties.
                                        const { expanded, hasChildren, href, id, isSelected, label } = item;
                                      
                                        // Derive depth booleans.
                                      Severity: Minor
                                      Found in src/platform/site-wide/side-nav/components/NavItemRow.js - About 1 hr 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 getFormDOM has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                      export function getFormDOM(form) {
                                        const formDOM = form?.container || findDOMNode(form);
                                      
                                        if (!formDOM) {
                                          throw new Error(
                                      Severity: Minor
                                      Found in src/platform/testing/unit/schemaform-utils.jsx - About 1 hr 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