department-of-veterans-affairs/vets-website

View on GitHub

Showing 12,675 of 12,675 total issues

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

  render() {
    const pageDescription = (
      <>
        <h3 className="vads-u-font-size--h4">Shipping address</h3>
        <div className="vads-u-margin-top--2">
src/applications/disability-benefits/2346/components/ReviewCardField.jsx on lines 578..608

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 216.

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

  if (yellowRibbonPrograms.length > 0) {
    yellowRibbonPrograms = yellowRibbonPrograms.map((program, index) => ({
      ...program,
      index,
    }));
Severity: Major
Found in src/applications/gi/selectors/compare.js and 1 other location - About 1 day to fix
src/applications/gi/reducers/calculator.js on lines 324..352

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 216.

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

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

  render() {
    const {
      currentPageNumber,
      errorMessages,
      facilityCodeSelected,

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

      handleInputValueChange = inputValue => {
        if (inputValue !== this.state.input) {
          const uiOptions = this.props.uiSchema['ui:options'];
          if (uiOptions.queryForResults) {
            this.debouncedGetOptions(inputValue);
    src/platform/forms-system/src/js/fields/AutosuggestField.jsx on lines 161..186

    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 215.

    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

    export const months = [
      { label: 'Jan', value: 1, text: 'January' },
      { label: 'Feb', value: 2, text: 'February' },
      { label: 'Mar', value: 3, text: 'March' },
      { label: 'Apr', value: 4, text: 'April' },
    Severity: Major
    Found in src/applications/travel-pay/util/dates.js and 1 other location - About 1 day to fix
    src/platform/forms-system/src/js/utilities/date/index.js on lines 3..16

    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 215.

    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

      handleInputValueChange = inputValue => {
        if (inputValue !== this.state.input) {
          const uiOptions = this.props.uiSchema['ui:options'];
          if (uiOptions.queryForResults) {
            this.debouncedGetOptions(inputValue);
    Severity: Major
    Found in src/platform/forms-system/src/js/fields/AutosuggestField.jsx and 1 other location - About 1 day to fix
    src/applications/pre-need-integration/components/AutosugggestField.jsx on lines 162..187

    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 215.

    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

    export const months = [
      { label: 'Jan', value: 1, text: 'January' },
      { label: 'Feb', value: 2, text: 'February' },
      { label: 'Mar', value: 3, text: 'March' },
      { label: 'Apr', value: 4, text: 'April' },
    Severity: Major
    Found in src/platform/forms-system/src/js/utilities/date/index.js and 1 other location - About 1 day to fix
    src/applications/travel-pay/util/dates.js on lines 16..29

    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 215.

    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

    export default {
      uiSchema: {
        claimantPhone: {
          'ui:title': 'Phone number',
          'ui:autocomplete': 'tel',
    src/applications/simple-forms/21-10210/pages/vetContInfo.js on lines 13..68

    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 215.

    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

    export default {
      uiSchema: {
        veteranPhone: {
          'ui:title': 'Phone number',
          'ui:autocomplete': 'tel',
    Severity: Major
    Found in src/applications/simple-forms/21-10210/pages/vetContInfo.js and 1 other location - About 1 day to fix
    src/applications/simple-forms/21-10210/pages/claimantContInfo.js on lines 13..68

    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 215.

    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

    export const notSelfSufficientDescription = (
      <div>
        <va-additional-info trigger="What does &quot;unable to support themself&quot; mean?">
          <p className="vads-u-margin-bottom--4">
            We consider a child to be <strong>unable to support themself</strong> if
    src/applications/disability-benefits/686c-674/config/chapters/add-a-child/child-place-of-birth/notSelfSufficientDescription.jsx on lines 3..33

    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 214.

    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

    export const notSelfSufficientDescription = (
      <div>
        <va-additional-info trigger="What does &quot;unable to support themself&quot; mean?">
          <p className="vads-u-margin-bottom--4">
            We consider a child to be <strong>unable to support themself</strong> if
    src/applications/disability-benefits/686c-674-v2/config/chapters/add-a-child/child-place-of-birth/notSelfSufficientDescription.jsx on lines 3..33

    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 214.

    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

    Function formReducer has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
    Open

    export default function formReducer(state = initialState, action) {
      switch (action.type) {
        case FORM_PAGE_OPENED: {
          const { data, schema } = setupFormData(
            state.data,
    Severity: Minor
    Found in src/applications/vaos/new-appointment/redux/reducer.js - About 1 day 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

    File helpers.js has 538 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import { dropRight, merge } from 'lodash';
    import { getDefaultFormState } from '@department-of-veterans-affairs/react-jsonschema-form/lib/utils';
    import dataGet from '../../../../utilities/data/get';
    import set from '../../../../utilities/data/set';
    import unset from '../../../../utilities/data/unset';
    Severity: Major
    Found in src/platform/forms-system/src/js/state/helpers.js - About 1 day to fix

      File SearchPage.jsx has 538 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /* eslint-disable react-hooks/exhaustive-deps */
      
      import React, { useEffect, useRef, useState } from 'react';
      import PropTypes from 'prop-types';
      import { connect, useStore } from 'react-redux';
      Severity: Major
      Found in src/applications/representative-search/containers/SearchPage.jsx - About 1 day to fix

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

        /* eslint-disable camelcase */
        /**
         * Functions related to fetching Apppointment data and pulling information from that data
         * @module services/Appointment
         */
        Severity: Major
        Found in src/applications/vaos/services/appointment/index.js - About 1 day to fix

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

          App.propTypes = {
            getContestableIssues: PropTypes.func.isRequired,
            setFormData: PropTypes.func.isRequired,
            accountUuid: PropTypes.string,
            children: PropTypes.any,
          Severity: Major
          Found in src/applications/appeals/995/containers/App.jsx and 1 other location - About 1 day to fix
          src/applications/appeals/testing/sc/containers/App.jsx on lines 185..209

          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 212.

          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

          App.propTypes = {
            getContestableIssues: PropTypes.func.isRequired,
            setFormData: PropTypes.func.isRequired,
            accountUuid: PropTypes.string,
            children: PropTypes.any,
          Severity: Major
          Found in src/applications/appeals/testing/sc/containers/App.jsx and 1 other location - About 1 day to fix
          src/applications/appeals/995/containers/App.jsx on lines 185..209

          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 212.

          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 createSaveInProgressUpdateTaskPurple = () => {
            const now = new Date().toISOString();
          
            return {
              data: {
          src/applications/_mock-form-ae-design-patterns/mocks/endpoints/in-progress-forms/mock-form-ae-design-patterns.js on lines 80..110

          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 212.

          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 createSaveInProgressUpdate = () => {
            const now = new Date().toISOString();
          
            return {
              data: {
          src/applications/_mock-form-ae-design-patterns/mocks/endpoints/in-progress-forms/mock-form-ae-design-patterns.js on lines 112..142

          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 212.

          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

          Function debtSummaryText has 221 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export const debtSummaryText = (diaryCode, dateOfLetter, balance) => {
            const endDateText = endDate(dateOfLetter, diaryCode);
          
            switch (diaryCode) {
              case '71':
            Severity
            Category
            Status
            Source
            Language