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

      {userLoggedIn &&
      !userIdVerified /* If User's signed-in but not identity-verified [not LOA3] */ && (
          <div className="id-not-verified-content vads-u-margin-top--4">
            <va-alert status="continue" uswds>
              <h3 slot="headline">
src/applications/simple-forms/21-0845/containers/IntroductionPage.jsx on lines 83..120

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

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 renderScholarships = () => {
    if (!displayedInputs.scholarships) return null;
    const scholarshipsId = 'scholarships';
    const scholarshipsFieldId = `${scholarshipsId}-field`;
    return (
src/applications/gi/components/profile/CalculateYourBenefitsForm.jsx on lines 585..612

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

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

        {userLoggedIn &&
        !userIdVerified /* If User's signed-in but not identity-verified [not LOA3] */ && (
            <div className="id-not-verified-content vads-u-margin-top--4">
              <va-alert status="continue" uswds>
                <h3 slot="headline">
src/applications/simple-forms/21-4142/containers/IntroductionPage.jsx on lines 63..99

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

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

                {!reviewMode && (
                  <div className="vads-u-margin-top--1p5">
                    <Link
                      key={`edit-va-${index}`}
                      id={`edit-va-${index}`}
src/applications/appeals/testing/sc/components/EvidenceSummaryLists.jsx on lines 140..163

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

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

const CreditCardBill = props => {
  const { data, goToPath, setFormData } = props;

  const { expenses } = data;
  const { creditCardBills = [] } = expenses;

    Function MoveMessageToFolderBtn has 213 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const MoveMessageToFolderBtn = props => {
      const {
        threadId,
        allFolders,
        isVisible,

      File inboxThreads.js has 521 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      const { sub, formatISO } = require('date-fns');
      
      const inboxThreads = {
        data: [
          {
      Severity: Major
      Found in src/platform/mhv/api/mocks/secure-messaging/threads/inboxThreads.js - About 1 day to fix

        File constants.js has 520 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import React from 'react';
        
        export const TITLE = 'Request priority processing for an existing claim';
        export const SUBTITLE = 'Priority processing request (VA form 20-10207)';
        
        
        Severity: Major
        Found in src/applications/simple-forms/20-10207/config/constants.js - About 1 day to fix

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

          export function validateGulfWarDates(
            errors,
            { gulfWarStartDate, gulfWarEndDate },
          ) {
            const fromDate = convertToDateField(gulfWarStartDate);
          Severity: Major
          Found in src/applications/hca/utils/validation.js and 1 other location - About 1 day to fix
          src/applications/hca/utils/validation.js on lines 63..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 204.

          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 function validateExposureDates(
            errors,
            { toxicExposureStartDate, toxicExposureEndDate },
          ) {
            const fromDate = convertToDateField(toxicExposureStartDate);
          Severity: Major
          Found in src/applications/hca/utils/validation.js and 1 other location - About 1 day to fix
          src/applications/hca/utils/validation.js on lines 39..61

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

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

          const PreSubmitCheckboxGroup = props => {
            const {
              onSectionComplete,
              formData,
              showError,
          Severity: Major
          Found in src/applications/caregivers/components/PreSubmitInfo/index.jsx - About 1 day to fix

            Function ReplyDraftItem has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
            Open

            const ReplyDraftItem = props => {
              const {
                draft,
                drafts,
                cannotReply,

            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 FilterBeforeResults has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
            Open

            export function FilterBeforeResults({
              dispatchFilterChange,
              dispatchError,
              filters,
              modalClose,
            Severity: Minor
            Found in src/applications/gi/containers/search/FilterBeforeResults.jsx - 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 form-submit-transform.js has 517 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            // this constant maps the values on address.js in vets.json schema from VA.gov values to LTS values
            
            import { formFields } from '../constants';
            
            // the lts values were found on the LTS database and LTS validates them, so we need to send correct value from here
            Severity: Major
            Found in src/applications/my-education-benefits/utils/form-submit-transform.js - About 1 day to fix

              Function ContestableIssuesWidget has 210 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const ContestableIssuesWidget = props => {
                const {
                  value = [],
                  id,
                  options,

                Function useNotificationSettingsUtils has 210 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export const useNotificationSettingsUtils = () => {
                  const communicationPreferences = useSelector(
                    state => state?.communicationPreferences,
                  );
                
                

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

                  OtherIncomeSummary.propTypes = {
                    contentAfterButtons: PropTypes.object,
                    contentBeforeButtons: PropTypes.object,
                    data: PropTypes.shape({
                      additionalIncome: PropTypes.shape({
                  src/applications/financial-status-report/components/householdIncome/AdditionalIncomeCheckList.jsx on lines 100..124

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

                  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

                  AdditionalIncomeCheckList.propTypes = {
                    contentAfterButtons: PropTypes.object,
                    contentBeforeButtons: PropTypes.object,
                    data: PropTypes.shape({
                      additionalIncome: PropTypes.shape({
                  src/applications/financial-status-report/components/householdIncome/OtherIncomeSummary.jsx on lines 166..190

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

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

                  export function NewAppointment() {
                    const isCernerOnlyPatient = useSelector(selectIsCernerOnlyPatient);
                    const isNewAppointmentStarted = useSelector(selectIsNewAppointmentStarted);
                    const featureBreadcrumbUrlUpdate = useSelector(state =>
                      selectFeatureBreadcrumbUrlUpdate(state),
                  Severity: Major
                  Found in src/applications/vaos/new-appointment/index.jsx - About 1 day to fix

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

                    Batteries.propTypes = {
                      eligibility: PropTypes.object,
                      formData: PropTypes.object,
                      order: PropTypes.arrayOf(
                        PropTypes.shape({
                    src/applications/health-care-supply-reordering/components/Batteries.jsx on lines 219..242

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

                    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

                    Severity
                    Category
                    Status
                    Source
                    Language