department-of-veterans-affairs/vets-website

View on GitHub
src/platform/user/profile/vap-svc/actions/transactions.js

Summary

Maintainability
D
2 days
Test Coverage

File transactions.js has 401 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import * as Sentry from '@sentry/browser';

import {
  ADDRESS_POU,
  FIELD_NAMES,
Severity: Minor
Found in src/platform/user/profile/vap-svc/actions/transactions.js - About 5 hrs to fix

    Function validateAddress has 116 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    ) => async dispatch => {
      const userEnteredAddress = { ...inputAddress };
      dispatch({
        type: ADDRESS_VALIDATION_INITIALIZE,
        fieldName,
    Severity: Major
    Found in src/platform/user/profile/vap-svc/actions/transactions.js - About 4 hrs to fix

      Function validateAddress has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
      Open

      export const validateAddress = (
        route,
        method,
        fieldName,
        inputAddress,
      Severity: Minor
      Found in src/platform/user/profile/vap-svc/actions/transactions.js - About 4 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 createTransaction has 58 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function createTransaction(
        route,
        method,
        fieldName,
        payload,
      Severity: Major
      Found in src/platform/user/profile/vap-svc/actions/transactions.js - About 2 hrs to fix

        Function refreshTransaction has 54 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function refreshTransaction(
          transaction,
          analyticsSectionName,
          _route = null,
        ) {
        Severity: Major
        Found in src/platform/user/profile/vap-svc/actions/transactions.js - About 2 hrs to fix

          Function updateValidationKeyAndSave has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          ) => async dispatch => {
            dispatch({
              type: ADDRESS_VALIDATION_UPDATE,
              fieldName,
            });
          Severity: Minor
          Found in src/platform/user/profile/vap-svc/actions/transactions.js - About 1 hr to fix

            Function createTransaction has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

              route,
              method,
              fieldName,
              payload,
              analyticsSectionName,
            Severity: Minor
            Found in src/platform/user/profile/vap-svc/actions/transactions.js - About 35 mins to fix

              There are no issues that match your filters.

              Category
              Status