department-of-veterans-affairs/vets-website

View on GitHub

Showing 12,811 of 12,811 total issues

File topic.js has 388 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { flatten, orderBy } from 'lodash';
import clone from 'platform/utilities/data/clone';
import get from 'platform/utilities/data/get';
import set from 'platform/utilities/data/set';
import { createSelector } from 'reselect';
Severity: Minor
Found in src/applications/ask-a-question/form/inquiry/topic/topic.js - About 5 hrs to fix

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

    const Eligible = ({ referenceNumber }) => (
      <>
        <StatusAlert.Eligible referenceNumber={referenceNumber} />
        <ReviewAndDownload />
        <div>
    src/applications/_mock-form-ae-design-patterns/patterns/pattern2/TaskRed/form/components/statuses/Eligible.jsx on lines 7..26

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

    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 default {
      uiSchema: {
        [EVIDENCE_OTHER]: yesNoUI({
          title: evidenceWillUploadTitle,
          enableAnalytics: true,
    Severity: Major
    Found in src/applications/appeals/995/pages/evidenceWillUpload.js and 1 other location - About 5 hrs to fix
    src/applications/appeals/testing/sc/pages/evidenceWillUpload.js on lines 14..47

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

    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

          this.setState(newState, () => {
            const newFormData = this.props.formData.concat(
              getDefaultFormState(
                this.props.schema.additionalItems,
                undefined,
    src/platform/forms-system/src/js/fields/ArrayField.jsx on lines 145..156

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

    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 default {
      uiSchema: {
        [EVIDENCE_OTHER]: yesNoUI({
          title: evidenceWillUploadTitle,
          enableAnalytics: true,
    src/applications/appeals/995/pages/evidenceWillUpload.js on lines 14..47

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

    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

          this.setState(newState, () => {
            const newFormData = this.props.formData.concat(
              getDefaultFormState(
                this.props.schema.additionalItems,
                undefined,
    Severity: Major
    Found in src/platform/forms-system/src/js/fields/ArrayField.jsx and 1 other location - About 5 hrs to fix
    src/applications/pre-need-integration/components/DeceasedPersons.jsx on lines 154..165

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

    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

    const Eligible = ({ referenceNumber }) => (
      <>
        <StatusAlert.Eligible referenceNumber={referenceNumber} />
        <ReviewAndDownload />
        <div>
    src/applications/lgy/coe/form/components/statuses/Eligible.jsx on lines 7..26

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

    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 3 locations. Consider refactoring.
    Open

                    mailingAddress: {
                      addressLine1: '8210 Doby Ln',
                      addressLine2: null,
                      addressLine3: null,
                      addressPou: 'CORRESPONDENCE',
    Severity: Major
    Found in src/applications/personalization/profile/msw-mocks.js and 2 other locations - About 5 hrs to fix
    src/applications/personalization/profile/msw-mocks.js on lines 637..665
    src/applications/personalization/profile/msw-mocks.js on lines 666..694

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

    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 3 locations. Consider refactoring.
    Open

                  mailingAddress: {
                    addressLine1: '123 Main St',
                    addressLine2: null,
                    addressLine3: null,
                    addressPou: 'CORRESPONDENCE',
    Severity: Major
    Found in src/applications/personalization/profile/msw-mocks.js and 2 other locations - About 5 hrs to fix
    src/applications/personalization/profile/msw-mocks.js on lines 277..305
    src/applications/personalization/profile/msw-mocks.js on lines 637..665

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

    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 3 locations. Consider refactoring.
    Open

                  residentialAddress: {
                    addressLine1: '123 Main St',
                    addressLine2: null,
                    addressLine3: null,
                    addressPou: 'RESIDENCE/CHOICE',
    Severity: Major
    Found in src/applications/personalization/profile/msw-mocks.js and 2 other locations - About 5 hrs to fix
    src/applications/personalization/profile/msw-mocks.js on lines 277..305
    src/applications/personalization/profile/msw-mocks.js on lines 666..694

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

    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 editControls =
        showCheckbox && isEditable ? (
          <div>
            <Link
              to={{
    Severity: Major
    Found in src/applications/appeals/shared/components/IssueCard.jsx and 1 other location - About 5 hrs to fix
    src/applications/appeals/testing/nod-new/components/IssueCard.jsx on lines 149..171

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

    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

          en: (
            <div>
              Have you had any of these symptoms in the past 48 hours?
              <ul>
                <li>New loss of taste or smell</li>
    Severity: Major
    Found in src/applications/coronavirus-screener/config/questions.jsx and 1 other location - About 5 hrs to fix
    src/applications/coronavirus-screener/config/questions.jsx on lines 156..174

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

    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 editControls =
        showCheckbox && isEditable ? (
          <div>
            <Link
              to={{
    src/applications/appeals/shared/components/IssueCard.jsx on lines 161..183

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

    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

          es: (
            <div>
              ¿Ha tenido alguno de estos síntomas en las últimas 48 horas?
              <ul>
                <li>Pérdida nueva del gusto o del olfato</li>
    Severity: Major
    Found in src/applications/coronavirus-screener/config/questions.jsx and 1 other location - About 5 hrs to fix
    src/applications/coronavirus-screener/config/questions.jsx on lines 137..155

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

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

    const SipsDevModal = props => {
      const { pageList, form, locationPathname } = props || {};
      const { formId, version, data, submission } = form || {};
    
      const [isModalVisible, toggleModal] = useState(false);
    Severity: Major
    Found in src/platform/forms/save-in-progress/SaveInProgressDevModal.jsx - About 5 hrs to fix

      Function Description has 132 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function Description(props) {
        const isClaimingBurialAllowance =
          props.formData['view:claimedBenefits'].burialAllowance;
        const serviceRequested =
          props.formData?.burialAllowanceRequested?.service === true;

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

        import moment from 'moment-timezone';
        import cheerio from 'cheerio';
        import { generatePdf } from '@department-of-veterans-affairs/platform-pdf/exports';
        import * as Sentry from '@sentry/browser';
        import {
        Severity: Minor
        Found in src/applications/mhv-medications/util/helpers.js - About 5 hrs to fix

          Function ChangeOfAddressWrapper has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
          Open

          const ChangeOfAddressWrapper = ({ mailingAddress, loading, applicantName }) => {
            const { loading: isLoading, error, data: response } = useSelector(
              state => state.updateAddress,
            );
            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 App has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
          Open

          export default function App({ children }) {
            const dispatch = useDispatch();
            const profileLoading = useSelector(state => isProfileLoading(state));
            const userLoggedIn = useSelector(state => isLoggedIn(state));
          
          
          Severity: Minor
          Found in src/applications/travel-pay/containers/TravelPayStatusApp.jsx - About 5 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 transform has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
          Open

          export function transform(formConfig, form) {
            // Grab isBDD before things are changed/deleted
            const isBDDForm = isBDD(form.data);
            // Grab ratedDisabilities before they're deleted in case the page is inactive
            // We need to send all of these to vets-api even if the veteran doesn't apply
          Severity: Minor
          Found in src/applications/disability-benefits/all-claims/submit-transformer.js - About 5 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

          Severity
          Category
          Status
          Source
          Language