department-of-veterans-affairs/vets-website

View on GitHub
src/applications/claims-status/actions/index.js

Summary

Maintainability
F
1 wk
Test Coverage

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

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

import { recordEvent } from '@department-of-veterans-affairs/platform-monitoring/exports';
import { apiRequest } from '@department-of-veterans-affairs/platform-utilities/exports';
Severity: Major
Found in src/applications/claims-status/actions/index.js - About 1 day to fix

    Function submitFiles has 171 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function submitFiles(claimId, trackedItem, files) {
      let filesComplete = 0;
      let bytesComplete = 0;
      let hasError = false;
      const totalSize = files.reduce((sum, file) => sum + file.file.size, 0);
    Severity: Major
    Found in src/applications/claims-status/actions/index.js - About 6 hrs to fix

      Function submitFilesLighthouse has 139 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function submitFilesLighthouse(claimId, trackedItem, files) {
        let filesComplete = 0;
        let bytesComplete = 0;
        let hasError = false;
        const totalSize = files.reduce((sum, file) => sum + file.file.size, 0);
      Severity: Major
      Found in src/applications/claims-status/actions/index.js - About 5 hrs to fix

        Function onAllComplete has 70 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                    onAllComplete: () => {
                      if (canUseMocks()) {
                        dispatch({ type: DONE_UPLOADING });
                        dispatch(
                          setNotification({
        Severity: Major
        Found in src/applications/claims-status/actions/index.js - About 2 hrs to fix

          Function submitRequest has 44 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function submitRequest(id, cstClaimPhasesEnabled = false) {
            return dispatch => {
              dispatch({
                type: SUBMIT_DECISION_REQUEST,
              });
          Severity: Minor
          Found in src/applications/claims-status/actions/index.js - About 1 hr to fix

            Function onAllComplete has 38 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                        onAllComplete: () => {
                          const now = new Date(Date.now());
                          const uploadDate = buildDateFormatter()(now.toISOString());
                          if (!hasError) {
                            recordEvent({
            Severity: Minor
            Found in src/applications/claims-status/actions/index.js - About 1 hr to fix

              Function submit5103 has 36 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export function submit5103(id, trackedItemId, cstClaimPhasesEnabled = false) {
                return dispatch => {
                  dispatch({
                    type: SUBMIT_DECISION_REQUEST,
                  });
              Severity: Minor
              Found in src/applications/claims-status/actions/index.js - About 1 hr to fix

                Function getAppealsV2 has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export function getAppealsV2() {
                  return dispatch => {
                    dispatch({ type: FETCH_APPEALS_PENDING });
                    return apiRequest('/appeals')
                      .then(appeals => dispatch(fetchAppealsSuccess(appeals)))
                Severity: Minor
                Found in src/applications/claims-status/actions/index.js - About 1 hr to fix

                  Function getClaims has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export const getClaims = () => {
                    return dispatch => {
                      const startTimeMillis = Date.now();
                      dispatch({ type: FETCH_CLAIMS_PENDING });
                  
                  
                  Severity: Minor
                  Found in src/applications/claims-status/actions/index.js - About 1 hr to fix

                    Identical blocks of code found in 2 locations. Consider refactoring.
                    Open

                                onError: (_id, fileName, _reason, { response, status }) => {
                                  if (status === 401) {
                                    dispatch({
                                      type: SET_UNAUTHORIZED,
                                    });
                    Severity: Major
                    Found in src/applications/claims-status/actions/index.js and 1 other location - About 3 hrs to fix
                    src/applications/claims-status/actions/index.js on lines 653..663

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 98.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Identical blocks of code found in 2 locations. Consider refactoring.
                    Open

                                onError: (_id, fileName, _reason, { response, status }) => {
                                  if (status === 401) {
                                    dispatch({
                                      type: SET_UNAUTHORIZED,
                                    });
                    Severity: Major
                    Found in src/applications/claims-status/actions/index.js and 1 other location - About 3 hrs to fix
                    src/applications/claims-status/actions/index.js on lines 505..515

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 98.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Identical blocks of code found in 2 locations. Consider refactoring.
                    Open

                                  if (!hasError) {
                                    recordEvent({
                                      event: 'claims-upload-success',
                                    });
                                    dispatch({
                    Severity: Major
                    Found in src/applications/claims-status/actions/index.js and 1 other location - About 2 hrs to fix
                    src/applications/claims-status/actions/index.js on lines 435..479

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 90.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Identical blocks of code found in 2 locations. Consider refactoring.
                    Open

                                  if (!hasError) {
                                    recordEvent({
                                      event: 'claims-upload-success',
                                    });
                                    dispatch({
                    Severity: Major
                    Found in src/applications/claims-status/actions/index.js and 1 other location - About 2 hrs to fix
                    src/applications/claims-status/actions/index.js on lines 592..627

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 90.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Identical blocks of code found in 2 locations. Consider refactoring.
                    Open

                            switch (status) {
                              case '403':
                                action.type = USER_FORBIDDEN_ERROR;
                                break;
                              case '404':
                    Severity: Major
                    Found in src/applications/claims-status/actions/index.js and 1 other location - About 2 hrs to fix
                    src/applications/personalization/dashboard/actions/appeals.js on lines 69..85

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 82.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Identical blocks of code found in 2 locations. Consider refactoring.
                    Open

                          () => {
                            dispatch({ type: SET_DECISION_REQUESTED });
                            if (cstClaimPhasesEnabled) {
                              dispatch(
                                setNotification({
                    Severity: Major
                    Found in src/applications/claims-status/actions/index.js and 1 other location - About 1 hr to fix
                    src/applications/claims-status/actions/index.js on lines 291..310

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 74.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Identical blocks of code found in 2 locations. Consider refactoring.
                    Open

                          () => {
                            dispatch({ type: SET_DECISION_REQUESTED });
                            if (cstClaimPhasesEnabled) {
                              dispatch(
                                setNotification({
                    Severity: Major
                    Found in src/applications/claims-status/actions/index.js and 1 other location - About 1 hr to fix
                    src/applications/claims-status/actions/index.js on lines 250..269

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 74.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                                    dispatch(
                                      setNotification({
                                        title: 'We have your evidence',
                                        body: (
                                          <span>
                    Severity: Major
                    Found in src/applications/claims-status/actions/index.js and 1 other location - About 1 hr to fix
                    src/applications/claims-status/actions/index.js on lines 411..431

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 59.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                                    dispatch(
                                      setNotification({
                                        title: 'We have your evidence',
                                        body: (
                                          <span>
                    Severity: Major
                    Found in src/applications/claims-status/actions/index.js and 1 other location - About 1 hr to fix
                    src/applications/claims-status/actions/index.js on lines 442..462

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 59.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                              request: {
                                endpoint: `${
                                  environment.API_URL
                                }/v0/evss_claims/${claimId}/documents`,
                                inputName: 'file',
                    Severity: Major
                    Found in src/applications/claims-status/actions/index.js and 1 other location - About 1 hr to fix
                    src/applications/claims-status/actions/index.js on lines 572..582

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 58.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                              request: {
                                endpoint: `${
                                  environment.API_URL
                                }/v0/benefits_claims/${claimId}/benefits_documents`,
                                inputName: 'file',
                    Severity: Major
                    Found in src/applications/claims-status/actions/index.js and 1 other location - About 1 hr to fix
                    src/applications/claims-status/actions/index.js on lines 391..401

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 58.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Similar blocks of code found in 4 locations. Consider refactoring.
                    Open

                              Sentry.withScope(scope => {
                                scope.setFingerprint(['{{default}}', errorCode]);
                                Sentry.captureException(
                                  `lighthouse_claims_err_get_claims ${errorCode}`,
                                );
                    Severity: Major
                    Found in src/applications/claims-status/actions/index.js and 3 other locations - About 50 mins to fix
                    src/applications/claims-status/actions/index.js on lines 109..112
                    src/applications/personalization/dashboard/actions/appeals.js on lines 86..89
                    src/applications/personalization/dashboard/actions/claims.js on lines 65..70

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 51.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Similar blocks of code found in 4 locations. Consider refactoring.
                    Open

                            Sentry.withScope(scope => {
                              scope.setFingerprint(['{{default}}', status]);
                              Sentry.captureException(`vets_appeals_v2_err_get_appeals ${status}`);
                            });
                    Severity: Major
                    Found in src/applications/claims-status/actions/index.js and 3 other locations - About 50 mins to fix
                    src/applications/claims-status/actions/index.js on lines 179..184
                    src/applications/personalization/dashboard/actions/appeals.js on lines 86..89
                    src/applications/personalization/dashboard/actions/claims.js on lines 65..70

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 51.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    There are no issues that match your filters.

                    Category
                    Status