department-of-veterans-affairs/vets-website

View on GitHub

Showing 12,811 of 12,811 total issues

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

export function fetchDirectDeposit() {
  return async dispatch => {
    dispatch({ type: FETCH_DIRECT_DEPOSIT });
    return apiRequest(DIRECT_DEPOSIT_ENDPOINT)
      .then(response => {
Severity: Major
Found in src/applications/my-education-benefits/actions/index.js and 1 other location - About 3 hrs to fix
src/applications/toe/actions.js on lines 70..87

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

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

  let content = (
    <RoutedSavableApp formConfig={formConfig} currentLocation={location}>
      <ITFWrapper
        loggedIn={loggedIn}
        pathname={pathname}
Severity: Major
Found in src/applications/appeals/995/containers/App.jsx and 1 other location - About 3 hrs to fix
src/applications/appeals/testing/sc/containers/App.jsx on lines 137..151

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

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 yourRolePage = {
  uiSchema: {
    'ui:objectViewField': PageFieldSummary,
    yourRole: radioUI({
      title: CHAPTER_3.YOUR_ROLE.TITLE,
src/applications/ask-va/config/chapters/personalInformation/yourRoleEducation.js on lines 8..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 104.

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 fetchPersonalInformation() {
  return async dispatch => {
    dispatch({ type: FETCH_PERSONAL_INFORMATION });
    return apiRequest(CLAIMANT_INFO_ENDPOINT)
      .then(response => {
Severity: Major
Found in src/applications/toe/actions.js and 1 other location - About 3 hrs to fix
src/applications/my-education-benefits/actions/index.js on lines 206..223

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

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:authorizationPolicy': {
    'ui:description': () => {
      return (
        <div className="vads-u-margin-y--3">
          <va-accordion uswds bordered open-single>
src/applications/representative-appoint/pages/authorizations/authorizeAddress.js on lines 24..50

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

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

const DebtLettersDownload = () => {
  const { debtLinks, isError, isVBMSError, hasDependentDebts } = useSelector(
    ({ combinedPortal }) => combinedPortal.debtLetters,
  );

    Function ConfirmationPage has 86 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function ConfirmationPage(props) {
      const { form } = props;
      const { submission, data } = form;
      const submitDate = new Date(submission?.timestamp);
    
    
    Severity: Major
    Found in src/applications/ivc-champva/10-10D/containers/ConfirmationPage.jsx - About 3 hrs to fix

      Function SubTopicSelectPage has 86 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const SubTopicSelectPage = props => {
        const { onChange, loggedIn, goBack, goToPath, formData, topicID } = props;
      
        const [apiData, setApiData] = useState([]);
        const [loading, isLoading] = useState(false);
      Severity: Major
      Found in src/applications/ask-va/containers/SubTopicSelectPage.jsx - About 3 hrs to fix

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

        import moment from 'moment-timezone';
        import {
          DefaultFolders as Folders,
          Paths,
          RecipientStatus,
        Severity: Minor
        Found in src/applications/mhv-secure-messaging/util/helpers.js - About 3 hrs to fix

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

          const allFolders = {
            data: [
              {
                attributes: {
                  count: 3,
          Severity: Minor
          Found in src/applications/personalization/dashboard/mocks/messaging/index.js - About 3 hrs to fix

            File RefillPrescriptions.jsx has 310 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import React, { useState, useEffect, useMemo } from 'react';
            import PropTypes from 'prop-types';
            import { useLocation } from 'react-router-dom';
            import { useSelector, useDispatch } from 'react-redux';
            import {
            Severity: Minor
            Found in src/applications/mhv-medications/containers/RefillPrescriptions.jsx - About 3 hrs to fix

              Function subscribeComponentAnalyticsEvents has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
              Open

              export function subscribeComponentAnalyticsEvents(
                e,
                recordEvent = _recordEvent,
              ) {
                // Is it a component we are tracking?
              Severity: Minor
              Found in src/platform/site-wide/component-library-analytics-setup.js - About 3 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 checkValidSchema has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
              Open

              export function checkValidSchema(schema, errors = [], path = ['root']) {
                if (typeof schema.type !== 'string') {
                  errors.push(`Missing type in ${path.join('.')} schema.`);
                }
              
              
              Severity: Minor
              Found in src/platform/forms-system/src/js/helpers.js - About 3 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 ContestableIssuesWidget has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
              Open

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

              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 24 (exceeds 5 allowed). Consider refactoring.
              Open

              export const App = ({ loggedIn, toggleLoginModal, displayToggle }) => {
                const [lastUpdated, updateLastUpdated] = useState('');
                const [year, updateYear] = useState(0);
                const [formError, updateFormError] = useState({ error: false, type: '' }); // types: "not found", "download error"
                const [formType, updateFormType] = useState('pdf');
              Severity: Minor
              Found in src/applications/static-pages/download-1095b/components/App/index.js - About 3 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 EmploymentRecord has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
              Open

              const EmploymentRecord = ({
                idSchema,
                uiSchema,
                formData,
                setFormData,

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

              const AttachmentsList = props => {
                const {
                  attachments,
                  compose,
                  draftSequence,
              Severity: Minor
              Found in src/applications/mhv-secure-messaging/components/AttachmentsList.jsx - About 3 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 KeywordSearch has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
              Open

              export function KeywordSearch({
                className,
                inputValue,
                label,
                labelAdditional,
              Severity: Minor
              Found in src/applications/gi/components/search/KeywordSearch.jsx - About 3 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

              File SearchResult.jsx has 309 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              /* eslint-disable @department-of-veterans-affairs/prefer-button-component */
              
              import React, { useState, useEffect } from 'react';
              import PropTypes from 'prop-types';
              import {

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

                import React from 'react';
                import PropTypes from 'prop-types';
                import { connect } from 'react-redux';
                import { toggleLoginModal as toggleLoginModalAction } from '@department-of-veterans-affairs/platform-site-wide/actions';
                import { useFeatureToggle } from 'platform/utilities/feature-toggles';
                  Severity
                  Category
                  Status
                  Source
                  Language