department-of-veterans-affairs/vets-website

View on GitHub

Showing 12,805 of 12,805 total issues

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

const App = ({ formEnabled }) => {
  if (formEnabled === undefined) {
    return <va-loading-indicator message="Loading..." />;
  }

Severity: Major
Found in src/applications/static-pages/ivc-champva/10-7959c/App.js and 1 other location - About 4 hrs to fix
src/applications/static-pages/ivc-champva/10-7959a/App.js on lines 10..31

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

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

                'view:applicantInfo': {
                  mailingAddress: merge(
                    {},
                    address.uiSchema("Preparer's mailing address"),
                    {
Severity: Major
Found in src/applications/pre-need/config/form.jsx and 1 other location - About 4 hrs to fix
src/applications/pre-need-integration/config/pages/preparerContactDetails.jsx on lines 28..48

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

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 const ConfirmationPage = () => {
  const form = useSelector(state => state.form || {});
  const { submission, data } = form;
  const submitDate = submission.timestamp;
  const confirmationNumber = submission.response?.confirmationNumber;
src/applications/simple-forms/mock-form-minimal-header/containers/ConfirmationPage.jsx on lines 13..27

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

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 (
            modifiedData.application.claimant &&
            modifiedData.application.claimant.address &&
            (modifiedData.application.claimant.address.country !== 'USA' ||
              modifiedData.application.claimant.address.country !== 'CAN') &&
Severity: Major
Found in src/applications/pre-need-integration/definitions/address.js and 1 other location - About 4 hrs to fix
src/applications/pre-need/definitions/address.js on lines 279..287

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

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

        <div className="vads-u-display--flex">
          <span className="vads-u-margin-right--1 vads-u-margin-top--0p5">
            <va-icon icon="error" size={3} />
          </span>

src/applications/personalization/dashboard/components/benefit-application-drafts/DraftCard.jsx on lines 35..46

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

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 (
            modifiedData.application.claimant &&
            modifiedData.application.claimant.address &&
            (modifiedData.application.claimant.address.country !== 'USA' ||
              modifiedData.application.claimant.address.country !== 'CAN') &&
Severity: Major
Found in src/applications/pre-need/definitions/address.js and 1 other location - About 4 hrs to fix
src/applications/pre-need-integration/definitions/address.js on lines 291..299

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

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 App = ({ formEnabled }) => {
  if (formEnabled === undefined) {
    return <va-loading-indicator message="Loading..." />;
  }

Severity: Major
Found in src/applications/static-pages/ivc-champva/10-7959a/App.js and 1 other location - About 4 hrs to fix
src/applications/static-pages/ivc-champva/10-7959c/App.js on lines 10..31

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

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 AddressValidationModal.jsx has 352 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import {

    Function generateFeatureToggles has 111 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const generateFeatureToggles = (toggles = {}) => {
      const {
        mhvLandingPagePersonalization = true,
        mhvMedicationsToVaGovRelease = true,
        mhvMedicationsDisplayRefillContent = true,
    Severity: Major
    Found in src/platform/mhv/api/mocks/feature-toggles/index.js - About 4 hrs to fix

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

        render() {
          const { showWizard } = this.props;
      
          if (showWizard === undefined) return null;
          return (
      Severity: Major
      Found in src/applications/edu-benefits/1990/containers/IntroductionPage.jsx - About 4 hrs to fix

        Function ReviewPage has 111 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export default function ReviewPage() {
          const pageTitle = useSelector(state => getPageTitle(state, pageKey));
        
          const dispatch = useDispatch();
          const {
        Severity: Major
        Found in src/applications/vaos/new-appointment/components/ReviewPage/index.jsx - About 4 hrs to fix

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

          import sinon from 'sinon';
          import { expect } from 'chai';
          import { rest } from 'msw';
          import { setupServer } from 'msw/node';
          
          

            Function paginatedThreads has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
            Open

            const paginatedThreads = (req, res) => {
              const { index } = req.params;
              const { pageSize, pageNumber, sortField, sortOrder } = req.query;
            
              const sortFunc = (a, b) => {
            Severity: Minor
            Found in src/platform/mhv/api/mocks/secure-messaging/threads/index.js - About 4 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 validateAddress has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
            Open

            export const validateAddress = (
              route,
              method,
              fieldName,
              inputAddress,
            Severity: Minor
            Found in src/platform/user/profile/vap-svc/actions/transactions.js - About 4 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 MissingFileOverview has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
            Open

            export default function MissingFileOverview({
              contentAfterButtons,
              data,
              goBack,
              goForward,

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

            export default function prefillTransformer(pages, formData, metadata) {
              const prefillRatedDisabilities = data => {
                const { disabilities } = data;
            
                if (!disabilities) {

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

              render() {
                const { uiSchema, errorSchema, idSchema, schema, formContext } = this.props;
                const { SchemaField } = this.props.registry.fields || {};
            
                const properties = Object.keys(schema.properties);
            Severity: Major
            Found in src/platform/forms-system/src/js/review/ObjectField.jsx - About 4 hrs to fix

              File utilities.js has 350 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import appendQuery from 'append-query';
              import * as Sentry from '@sentry/browser';
              import 'url-search-params-polyfill';
              import environment from 'platform/utilities/environment';
              import { createOAuthRequest } from 'platform/utilities/oauth/utilities';
              Severity: Minor
              Found in src/platform/user/authentication/utilities.js - About 4 hrs to fix

                Function TravelPayAlert has 110 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                const TravelPayAlert = props => {
                  const {
                    travelPayEligible,
                    travelPayClaimRequested,
                    travelPayClaimError,

                  Function TypeOfCarePage has 110 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export default function TypeOfCarePage() {
                    const pageTitle = useSelector(state => getPageTitle(state, pageKey));
                  
                    const dispatch = useDispatch();
                    const {
                    Severity
                    Category
                    Status
                    Source
                    Language