department-of-veterans-affairs/vets-website

View on GitHub

Showing 3,724 of 12,675 total issues

Function MessageThreadMeta has 61 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const MessageThreadMeta = props => {
  const {
    message,
    fromMe,
    replyMessage,

    Function fetchPastAppointments has 61 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

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

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

        const content = () => {
          if (refreshedOnThisPage) {
            if (refreshPhase === refreshPhases.FAILED) {
              return failedMsg();
            }

        File MOCK_VA_APPOINTMENTS_OVER_30_DAYS.js has 268 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import { addDays, formatISO } from 'date-fns';
        
        export default {
          data: [
            {

          Function getProfileInfoFieldAttributes has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

          export const getProfileInfoFieldAttributes = fieldName => {
            let apiRoute;
            let convertCleanDataToPayload;
            let title;
            let uiSchema;

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

          export default function vapService(state = initialState, action) {
            switch (action.type) {
              case VAP_SERVICE_TRANSACTIONS_FETCH_SUCCESS: {
                const transactions = action.data.map(transactionData =>
                  // Wrap in a "data" property to imitate the API response for a single transaction
          Severity: Minor
          Found in src/platform/user/profile/vap-svc/reducers/index.js - 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

          Function getInitialFormValues has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

          export const getInitialFormValues = options => {
            const { fieldName, data, modalData } = options;
          
            if (fieldName === FIELD_NAMES.EMAIL) {
              return data ? { ...data } : { emailAddress: '' };

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

          export function prefillTransformerV3(pages, formData, metadata, state) {
            const bankInformation = state.data?.bankInformation || {};
            const claimant = state.data?.formData?.data?.attributes?.claimant || {};
            const exclusionPeriods = Array.isArray(state.data?.exclusionPeriods)
              ? state.data?.exclusionPeriods
          Severity: Minor
          Found in src/applications/my-education-benefits/helpers.js - 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

          Function formatOperatingHours has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

          export const formatOperatingHours = operatingHours => {
            if (!operatingHours) return operatingHours;
            // Remove all whitespace and sanitize dashes.
            const sanitizedOperatingHours = operatingHours
              .replace(/ /g, '')
          Severity: Minor
          Found in src/applications/facility-locator/utils/helpers.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

          Function displayConditionsMet has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

          export const displayConditionsMet = (SHORT_NAME, formResponses) => {
            const displayConditionsForShortName = DISPLAY_CONDITIONS[SHORT_NAME];
            const questionRequirements = Object.keys(displayConditionsForShortName);
          
            if (questionRequirements.includes('FORK')) {

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

          export const getInitialFormValues = options => {
            const { fieldName, data, modalData } = options;
          
            if (fieldName === FIELD_NAMES.EMAIL) {
              return data ? { ...data } : { emailAddress: '' };

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

          const fieldEntries = (key, uiSchema, data, schema, schemaFromState) => {
            if (key.startsWith('view:') || key.startsWith('ui:')) return null;
            if (schema.properties[key] === undefined || !uiSchema) return null;
          
            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 PayrollDeductionChecklist has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

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

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

          const EmploymentQuestion = props => {
            const {
              data,
              goBack,
              goToPath,

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

          const AddOtherExpense = ({ data, goToPath, setFormData }) => {
            const { otherExpenses = [] } = data;
          
            // Borrowed from 995 AddIssue
            // get index from url '/add-issue?index={index}'

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

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

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

          const EditContactList = () => {
            const dispatch = useDispatch();
            const location = useLocation();
            const history = useHistory();
            const [allTriageTeams, setAllTriageTeams] = useState(null);
          Severity: Minor
          Found in src/applications/mhv-secure-messaging/containers/EditContactList.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

          Function PrescriptionPrintOnly has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

          const PrescriptionPrintOnly = props => {
            const { rx, hideLineBreak, refillHistory, isDetailsRx } = props;
            const pharmacyPhone = pharmacyPhoneNumber(rx);
          
            const activeNonVaContent = pres => (

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

          import { createSelector } from 'reselect';
          import {
            countries,
            states,
            isValidUSZipCode,
          Severity: Minor
          Found in src/platform/forms-system/src/js/definitions/address.js - About 2 hrs to fix

            File v2.js has 267 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            /* istanbul ignore file */
            import appendQuery from 'append-query';
            // eslint-disable-next-line import/no-unresolved
            import { apiRequest } from '@department-of-veterans-affairs/platform-utilities/exports';
            import environment from '@department-of-veterans-affairs/platform-utilities/environment';
            Severity: Minor
            Found in src/applications/check-in/api/versions/v2.js - About 2 hrs to fix
              Severity
              Category
              Status
              Source
              Language