department-of-veterans-affairs/vets-website

View on GitHub
src/platform/forms-system/src/js/components/ReviewCardField.jsx

Summary

Maintainability
D
2 days
Test Coverage

File ReviewCardField.jsx has 403 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import React from 'react';
import PropTypes from 'prop-types';
import * as Sentry from '@sentry/browser';

import {
Severity: Minor
Found in src/platform/forms-system/src/js/components/ReviewCardField.jsx - About 5 hrs to fix

    Function constructor has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      constructor(props) {
        super(props);
    
        // Throw an error if there’s no viewComponent (should be React component)
        if (
    Severity: Minor
    Found in src/platform/forms-system/src/js/components/ReviewCardField.jsx - About 1 hr to fix

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

        onPropertyChange(name) {
          return value => {
            const formData = Object.keys(this.props.formData || {}).length
              ? this.props.formData
              : getDefaultFormState(
      src/applications/disability-benefits/2346/components/ReviewCardField.jsx on lines 131..142
      src/applications/health-care-supply-reordering/components/ReviewCardField.jsx on lines 131..142
      src/platform/forms-system/src/js/fields/ObjectField.jsx on lines 100..111
      src/platform/forms-system/src/js/review/ObjectField.jsx on lines 56..67

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

      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

        getDescription = () => {
          const {
            uiSchema: { 'ui:description': description },
            formData,
          } = this.props;
      src/applications/disability-benefits/2346/components/ReviewCardField.jsx on lines 158..172
      src/applications/health-care-supply-reordering/components/ReviewCardField.jsx on lines 158..172

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

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

        isRequired = name => {
          const { schema } = this.props;
          const schemaRequired =
            Array.isArray(schema.required) && schema.required.indexOf(name) !== -1;
      
      
      src/applications/disability-benefits/2346/components/ReviewCardField.jsx on lines 517..527
      src/applications/health-care-supply-reordering/components/ReviewCardField.jsx on lines 509..519
      src/applications/my-education-benefits/components/AccordionField.jsx on lines 147..157

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

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

        resetFormData = oldData => {
          const formData =
            oldData !== undefined
              ? oldData
              : getDefaultFormState(
      src/applications/disability-benefits/2346/components/ReviewCardField.jsx on lines 505..515
      src/applications/health-care-supply-reordering/components/ReviewCardField.jsx on lines 497..507

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

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

        getTitle = () => {
          const { uiSchema, formData } = this.props;
          return typeof uiSchema['ui:title'] === 'function'
            ? uiSchema['ui:title'](formData)
            : uiSchema['ui:title'];
      src/applications/disability-benefits/2346/components/ReviewCardField.jsx on lines 144..149
      src/applications/disability-benefits/2346/components/ReviewCardField.jsx on lines 151..156
      src/applications/health-care-supply-reordering/components/ReviewCardField.jsx on lines 144..149
      src/applications/health-care-supply-reordering/components/ReviewCardField.jsx on lines 151..156
      src/platform/forms-system/src/js/components/ReviewCardField.jsx on lines 100..105

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

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

        getSubtitle = () => {
          const { uiSchema, formData } = this.props;
          return typeof uiSchema['ui:subtitle'] === 'function'
            ? uiSchema['ui:subtitle'](formData)
            : uiSchema['ui:subtitle'];
      src/applications/disability-benefits/2346/components/ReviewCardField.jsx on lines 144..149
      src/applications/disability-benefits/2346/components/ReviewCardField.jsx on lines 151..156
      src/applications/health-care-supply-reordering/components/ReviewCardField.jsx on lines 144..149
      src/applications/health-care-supply-reordering/components/ReviewCardField.jsx on lines 151..156
      src/platform/forms-system/src/js/components/ReviewCardField.jsx on lines 93..98

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

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

        static defaultProps = {
          uiSchema: {},
          errorSchema: {},
          idSchema: {},
          registry: getDefaultRegistry(),
      src/applications/disability-benefits/2346/components/ReviewCardField.jsx on lines 38..46
      src/applications/health-care-supply-reordering/components/ReviewCardField.jsx on lines 38..46
      src/applications/my-education-benefits/components/AccordionField.jsx on lines 17..25
      src/platform/forms-system/src/js/fields/ObjectField.jsx on lines 44..52

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

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

          const {
            viewComponent: ViewComponent,
            volatileData,
            reviewTitle,
            itemName,
      src/applications/disability-benefits/2346/components/ReviewCardField.jsx on lines 307..313
      src/applications/health-care-supply-reordering/components/ReviewCardField.jsx on lines 307..313

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

      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

      There are no issues that match your filters.

      Category
      Status