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

    function addZone (packed) {
        var i, name, split, normalized;

        if (typeof packed === "string") {
            packed = [packed];
Severity: Major
Found in src/applications/vaos/lib/moment-tz.js and 1 other location - About 6 hrs to fix
src/applications/personalization/dashboard/lib/moment-tz.js on lines 405..420

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

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-l-col--12 small-screen:vads-l-col--6 vads-u-margin--1">
              <VaRadio
                uswds
                label="V3 Radio"
                onVaValueChange={e => updateRadioValue(e.detail, 'v3')}
Severity: Major
Found in src/applications/ds-playground/pages/V1V3Page.jsx and 1 other location - About 6 hrs to fix
src/applications/ds-v3-playground/pages/V3BasePage.jsx on lines 174..201

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

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 uiSchema = {
  childStoppedAttendingSchool: {
    'ui:options': {
      itemName: 'Child who left school',
      viewField: ChildViewField,
src/applications/disability-benefits/686c-674-v2/config/chapters/report-marriage-of-child/child-information/childInformation.js on lines 34..63

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

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

        <va-additional-info
          trigger="How to calculate your monthly deductions"
          class="vads-u-margin-top--2"
        >
          <p>
src/applications/financial-status-report/components/householdIncome/SpousePayrollDeductionInputList.jsx on lines 199..225

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

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 uiSchema = {
  childMarriage: {
    'ui:options': {
      itemName: 'Child who got married',
      viewField: ChildViewField,
src/applications/disability-benefits/686c-674-v2/config/chapters/report-child-stopped-attending-school/child-information/childInformation.js on lines 34..63

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

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:internationalTextMessageAlert': {
              'ui:description': (
                <va-alert status="warning">
                  <>
                    You can’t choose to get text notifications because you have
Severity: Major
Found in src/applications/fry-dea/config/form.js and 1 other location - About 6 hrs to fix
src/applications/toe/config/form.js on lines 968..998

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

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

  function addZone(packed) {
    var i, name, split, normalized;

    if (typeof packed === 'string') {
      packed = [packed];
Severity: Major
Found in src/applications/personalization/dashboard/lib/moment-tz.js and 1 other location - About 6 hrs to fix
src/applications/vaos/lib/moment-tz.js on lines 384..399

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

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

    {
      id: '3004370',
      type: 'message_details',
      attributes: {
        messageId: 3004370,
src/platform/mhv/api/mocks/secure-messaging/messages/messageDetails.js on lines 391..430

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

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

        <va-additional-info
          trigger="How to calculate your spouse's monthly deductions"
          class="vads-u-margin-top--2"
        >
          <p>
src/applications/financial-status-report/components/householdIncome/PayrollDeductionInputList.jsx on lines 195..222

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

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

export const SearchResultsHeader = ({
  results,
  facilityType,
  serviceType,
  context,
Severity: Minor
Found in src/applications/facility-locator/components/SearchResultsHeader.jsx - About 6 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 InstallmentContract has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
Open

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

  const { installmentContracts = [] } = data;

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

const SearchForm = props => {
  const { folder, keyword, resultsCount, query, threadCount } = props;
  const mhvSecureMessagingFilterAccordion = useSelector(
    state =>
      state.featureToggles[

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 blue_button_report.js has 420 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * Blue Button PDF template.
 *
 * NB: The order in which items are added to the document is important,
 * and thus PDFKit requires performing operations synchronously.
Severity: Minor
Found in src/platform/pdf/templates/blue_button_report.js - About 6 hrs to fix

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

      render() {
        const { supplies, order, eligibility } = this.props;
        const currentDate = moment();
        const batterySupplies = supplies.filter(
          batterySupply => batterySupply.productGroup === BATTERY,

      File validations.js has 420 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import _ from 'platform/utilities/data';
      import some from 'lodash/some';
      import moment from 'moment';
      
      import {
      Severity: Minor
      Found in src/applications/disability-benefits/all-claims/validations.js - About 6 hrs to fix

        Function FileInput has 152 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const FileInput = props => {
          const {
            attachments,
            setAttachments,
            setAttachFileSuccess,

          Function AllergyDetails has 152 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const AllergyDetails = props => {
            const { runningUnitTest } = props;
            const allergy = useSelector(state => state.mr.allergies.allergyDetails);
            const allergyList = useSelector(state => state.mr.allergies.allergiesList);
            const user = useSelector(state => state.user.profile);
          Severity: Major
          Found in src/applications/mhv-medical-records/containers/AllergyDetails.jsx - About 6 hrs to fix

            Function ExtraDetails has 152 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const ExtraDetails = rx => {
              const { dispStatus, refillRemaining } = rx;
              const pharmacyPhone = pharmacyPhoneNumber(rx);
              let noRefillRemaining = false;
              if (refillRemaining === 0 && dispStatus === 'Active') {
            Severity: Major
            Found in src/applications/mhv-medications/components/shared/ExtraDetails.jsx - About 6 hrs to fix

              File ReviewPage.jsx has 419 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import {
                VaAccordion,
                VaAccordionItem,
                VaAlert,
              } from '@department-of-veterans-affairs/component-library/dist/react-bindings';
              Severity: Minor
              Found in src/applications/ask-va/containers/ReviewPage.jsx - About 6 hrs to fix

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

                /* eslint-disable camelcase */
                const simpleUser = {
                  data: {
                    id: '',
                    type: 'users_scaffolds',
                Severity: Minor
                Found in src/applications/personalization/common/mocks/users/index.js - About 6 hrs to fix
                  Severity
                  Category
                  Status
                  Source
                  Language