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

  constructor(props) {
    super(props);
    const { uiSchema, schema, formData } = props;
    const input = getInput(formData, uiSchema, schema);
    const uiOptions = uiSchema['ui:options'];
Severity: Major
Found in src/platform/forms-system/src/js/fields/AutosuggestField.jsx and 1 other location - About 1 day to fix
src/applications/pre-need-integration/components/AutosugggestField.jsx on lines 42..69

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

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

import { useEffect, useRef } from 'react';
import moment from 'moment';
import { intersection, matches, merge, uniq } from 'lodash';
import shouldUpdate from 'recompose/shouldUpdate';
import { deepEquals } from '@department-of-veterans-affairs/react-jsonschema-form/lib/utils';
Severity: Major
Found in src/platform/forms-system/src/js/helpers.js - About 1 day to fix

    File form.jsx has 604 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import React from 'react';
    
    import fullSchemaPreNeed from 'vets-json-schema/dist/40-10007-INTEGRATION-schema.json';
    
    import environment from 'platform/utilities/environment';
    Severity: Major
    Found in src/applications/pre-need-integration/config/form.jsx - About 1 day to fix

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

      import React from 'react';
      import { useSelector } from 'react-redux';
      import { VA_FORM_IDS } from 'platform/forms/constants';
      
      export const PrimaryActionLink = ({ href = '/', children, onClick = null }) => (
      Severity: Major
      Found in src/applications/simple-forms/21-4138/config/constants.js - About 1 day to fix

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

            function unpackBase60(string) {
                var i = 0,
                    parts = string.split('.'),
                    whole = parts[0],
                    fractional = parts[1] || '',
        Severity: Major
        Found in src/applications/vaos/lib/moment-tz.js and 1 other location - About 1 day to fix
        src/applications/personalization/dashboard/lib/moment-tz.js on lines 68..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 244.

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

        export function getDependentPageList(pages, formData = {}) {
          return pages.reduce((acc, page) => {
            if ('depends' in page) {
              /*
              Some pages can depend on more than one key/value pair, so we'll compare the amount of
        Severity: Major
        Found in src/applications/ezr/utils/helpers/household.js and 1 other location - About 1 day to fix
        src/applications/_mock-form-ae-design-patterns/utils/helpers/household.js on lines 28..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 244.

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

        export function getDependentPageList(pages, formData = {}) {
          return pages.reduce((acc, page) => {
            if ('depends' in page) {
              /*
              Some pages can depend on more than one key/value pair, so we'll compare the amount of
        src/applications/ezr/utils/helpers/household.js on lines 28..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 244.

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

          function unpackBase60(string) {
            var i = 0,
              parts = string.split('.'),
              whole = parts[0],
              fractional = parts[1] || '',
        Severity: Major
        Found in src/applications/personalization/dashboard/lib/moment-tz.js and 1 other location - About 1 day to fix
        src/applications/vaos/lib/moment-tz.js on lines 62..92

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

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

          constructor(props) {
            super(props);
            this.validate = this.validate.bind(this);
            this.onError = this.onError.bind(this);
            this.getEmptyState = this.getEmptyState.bind(this);
        Severity: Major
        Found in src/platform/forms-system/src/js/components/SchemaForm.jsx and 1 other location - About 1 day to fix
        src/applications/_mock-form-ae-design-patterns/patterns/pattern1/TaskPurple/SchemaForm.jsx on lines 31..54

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

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

          constructor(props) {
            super(props);
            this.validate = this.validate.bind(this);
            this.onError = this.onError.bind(this);
            this.getEmptyState = this.getEmptyState.bind(this);
        src/platform/forms-system/src/js/components/SchemaForm.jsx on lines 28..51

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

        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 itfError = (
          <div>
            <div className="vads-u-margin-bottom--2">
              <p>You can continue to file your claim or call us to confirm.</p>
              <strong>What an intent to file means: </strong>
        Severity: Major
        Found in src/applications/appeals/testing/sc/content/itfWrapper.jsx and 1 other location - About 1 day to fix
        src/applications/appeals/995/content/itfWrapper.jsx on lines 46..96

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

        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 itfError = (
          <div>
            <div className="vads-u-margin-bottom--2">
              <p>You can continue to file your claim or call us to confirm.</p>
              <strong>What an intent to file means: </strong>
        Severity: Major
        Found in src/applications/appeals/995/content/itfWrapper.jsx and 1 other location - About 1 day to fix
        src/applications/appeals/testing/sc/content/itfWrapper.jsx on lines 46..96

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

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

        export function prefillTransformer(pages, formData, metadata) {
          const prefillPersonalInformation = data => {
            const newData = _.omit(['personalInformation'], data);
            const { personalInformation } = data;
        
        
        Severity: Minor
        Found in src/applications/representative-appoint/prefill-transformer.js - 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 local-vapsvc.js has 600 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import { uniqueId } from 'lodash';
        import * as VAP_SERVICE from '../constants';
        
        export function isVAProfileServiceConfigured() {
          return (
        Severity: Major
        Found in src/platform/user/profile/vap-svc/util/local-vapsvc.js - About 1 day to fix

          Function SettingsPage has 260 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const SettingsPage = () => {
            const dispatch = useDispatch();
          
            const fullState = useSelector(state => state);
            const isSharing = useSelector(state => state.mr.sharing.isSharing);
          Severity: Major
          Found in src/applications/mhv-medical-records/containers/SettingsPage.jsx - About 1 day to fix

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

            export function scrollToFirstError() {
              // [error] will focus any web-components with an error message
              const errorEl = document.querySelector(ERROR_ELEMENTS.join(','));
              if (errorEl) {
                // document.body.scrollTop doesn’t work with all browsers, so we’ll cover them all like so:
            Severity: Major
            Found in src/platform/utilities/ui/scroll.js and 1 other location - About 1 day to fix
            src/platform/forms-system/src/js/utilities/ui/index.js on lines 126..160

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

            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 Radiation23B = ({
              formResponses,
              router,
              setRadiation23B,
              viewedIntroPage,
            src/applications/pact-act/containers/questions/agent-orange/AgentOrange-2-2-B.jsx on lines 14..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 243.

            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 scrollToFirstError() {
              // [error] will focus any web-components with an error message
              const errorEl = document.querySelector(ERROR_ELEMENTS.join(','));
              if (errorEl) {
                // document.body.scrollTop doesn’t work with all browsers, so we’ll cover them all like so:
            Severity: Major
            Found in src/platform/forms-system/src/js/utilities/ui/index.js and 1 other location - About 1 day to fix
            src/platform/utilities/ui/scroll.js on lines 30..64

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

            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 Orange22B = ({
              formResponses,
              router,
              setOrange22B,
              viewedIntroPage,
            src/applications/pact-act/containers/questions/radiation/Radiation-2-3-B.jsx on lines 14..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 243.

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

              render() {
                const { route, loggedIn, formId, isBDDForm, showWizard } = this.props;
                const { formConfig, pageList } = route;
                const pageTitle = `${getPageTitle(isBDDForm)} ${PAGE_TITLE_SUFFIX}`;
                const startText = getStartText(isBDDForm);
              Severity
              Category
              Status
              Source
              Language