department-of-veterans-affairs/vets-website

View on GitHub

Showing 12,835 of 12,835 total issues

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

export const uiSchema = {
  'ui:title': titleWithSubtitle(gulfWar1990PageTitle, 'Summary'),
  'ui:description': ({ formData }) => (
    <ToxicExposureSummary
      formData={formData}
src/applications/disability-benefits/all-claims/pages/toxicExposure/gulfWar2001Summary.js on lines 9..20

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

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

  const getReliefOption = debt => {
    if (debt.resolutionOption === RESOLUTION_OPTION_TYPES.MONTHLY) {
      return 'Extended monthly payments';
    }
    if (debt.resolutionOption === RESOLUTION_OPTION_TYPES.COMPROMISE) {
src/applications/financial-status-report/components/shared/CustomResolutionOptionReview.jsx on lines 52..63

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

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

  Message: {
    GET: 'SM_MESSAGE_GET',
    GET_IN_THREAD: 'SM_MESSAGE_GET_IN_THREAD',
    CLEAR: 'SM_MESSAGE_CLEAR',
    GET_LIST: 'SM_MESSAGE_GET_LIST',
Severity: Major
Found in src/applications/mhv-secure-messaging/util/actionTypes.js and 1 other location - About 2 hrs to fix
src/platform/user/authentication/constants.js on lines 20..37

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

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

import mapValues from 'lodash/mapValues';
import { endOfDay, isAfter, isValid, isWithinInterval } from 'date-fns';
import vaMedicalFacilities from 'vets-json-schema/dist/vaMedicalFacilities.json';

import set from '~/platform/utilities/data/set';
Severity: Minor
Found in src/applications/hca/utils/helpers/index.js - About 2 hrs to fix

    File DocumentRequestPage.jsx has 264 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import React from 'react';
    import Scroll from 'react-scroll';
    import { merge } from 'lodash';
    import { connect } from 'react-redux';
    import PropTypes from 'prop-types';
    Severity: Minor
    Found in src/applications/claims-status/containers/DocumentRequestPage.jsx - About 2 hrs to fix

      Consider simplifying this complex logical expression.
      Open

          if (formContext.reviewMode) {
            const {
              address1,
              address2,
              address3,

        responses has 22 functions (exceeds 20 allowed). Consider refactoring.
        Open

        const responses = {
          'GET /v0/feature_toggles': (_req, res) => {
            const secondsOfDelay = 0;
            delaySingleResponse(
              () =>
        Severity: Minor
        Found in src/applications/personalization/profile/mocks/server.js - About 2 hrs to fix

          Function apiRequest has 58 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function apiRequest(resource, optionalSettings, success, error) {
            const apiVersion = (optionalSettings && optionalSettings.apiVersion) || 'v0';
            const baseUrl = `${environment.API_URL}/${apiVersion}`;
            const url = resource[0] === '/' ? [baseUrl, resource].join('') : resource;
            const csrfTokenStored = localStorage.getItem('csrfToken');
          Severity: Major
          Found in src/platform/utilities/api/index.js - About 2 hrs to fix

            Function findErrors has 58 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                const findErrors = (name, err) => {
                  if (err && typeof err === 'object') {
                    // process the last type of error message which provides an `__errors`
                    // message array. If there are multiple errors, we'll join them into
                    // one message.
            Severity: Major
            Found in src/platform/forms-system/src/js/utilities/data/reduceErrors.js - About 2 hrs to fix

              Function renderLetterHistory has 58 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export const renderLetterHistory = diaryCode => {
                switch (diaryCode) {
                  case '100':
                  case '101':
                  case '102':

                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 SaveResultsModal has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  const SaveResultsModal = () => {
                    const [isOpen, setIsOpen] = useState(false);
                    const [showAlert, setShowAlert] = useState(false);
                    const currentUrl = window.location.href;
                    const toggleModal = open => {

                    Function incomeLimits has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    const incomeLimits = (state = initialState, action) => {
                      switch (action.type) {
                        case IL_UPDATE_DEPENDENTS:
                          return {
                            ...state,
                    Severity: Major
                    Found in src/applications/income-limits/reducers/index.js - About 2 hrs to fix

                      Function HouseholdFinancialOnboarding has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      const HouseholdFinancialOnboarding = props => {
                        const {
                          goBack,
                          goForward,
                          contentBeforeButtons,
                      Severity: Major
                      Found in src/applications/hca/components/FormPages/FinancialOnboarding.jsx - About 2 hrs to fix

                        Function alertsBuildShow has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export default function alertsBuildShow() {
                          // This controls the text expanders.
                          function expanderFire() {
                            // Toggle aria-expanded for the button
                            const ariaExpanded =
                        Severity: Major
                        Found in src/applications/static-pages/widget-creators/alerts-dismiss-view.js - About 2 hrs to fix

                          Function VetCenterInfoSection has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          function VetCenterInfoSection(props) {
                            const attrs = {
                              opStatus: props.vetCenter.fieldOperatingStatusFacility,
                              opStatusExtra: props.vetCenter.fieldOperatingStatusMoreInfo,
                            };

                            Function onSubmitHandler has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              const onSubmitHandler = event => {
                                event.preventDefault();
                            
                                let filterList;
                            
                            
                            Severity: Major
                            Found in src/applications/static-pages/events/components/Search/index.js - About 2 hrs to fix

                              Function WizardContainer has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              const WizardContainer = () => {
                                useEffect(() => {
                                  focusElement('va-breadcrumbs');
                                  scrollToTop();
                                });

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

                                  render() {
                                    const { itf, title } = this.props;
                                
                                    if (this.shouldBlockITF(this.props.location.pathname)) {
                                      return this.props.children;

                                  Function renderLetterHistory has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  export const renderLetterHistory = diaryCode => {
                                    switch (diaryCode) {
                                      case '100':
                                      case '101':
                                      case '102':
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language