department-of-veterans-affairs/vets-website

View on GitHub

Showing 12,811 of 12,811 total issues

Function RequiredLoginView has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

export const RequiredLoginView = props => {
  const { user, verify, useSiS, showProfileErrorMessage = false } = props;

  const shouldSignIn = useCallback(() => !user.login.currentlyLoggedIn, [
    user.login.currentlyLoggedIn,
Severity: Minor
Found in src/platform/user/authorization/components/RequiredLoginView.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 SearchBar has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

function SearchBar({ onInputChange, previousValue, setSearchData, userInput }) {
  const [isGlobalSearch, setGlobalSearch] = useState(false);
  const [expanded, setExpanded] = useState(false);
  const [inputError, setInputError] = useState(false);
  const GLOBAL = 'All VA.gov';
Severity: Minor
Found in src/applications/resources-and-support/components/SearchBar.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 ReportModal has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

const ReportModal = ({
  representativeName,
  representativeId,
  address,
  phone,

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

export default function transformForSubmit(formConfig, form) {
  const hasReceivedMedicalTreatment =
    form?.data?.['view:hasReceivedMedicalTreatment'];

  const transformedData = JSON.parse(
Severity: Minor
Found in src/applications/simple-forms/20-10207/config/submit-transformer.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 PrimaryAddressWithAutofill has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

const PrimaryAddressWithAutofill = props => {
  const {
    errorSchema,
    formContext,
    formData,

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 GET /vaos/v2/appointments has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

  'GET /vaos/v2/appointments': (req, res) => {
    // merge arrays together
    const appointments = confirmedV2.data.concat(requestsV2.data, mockAppts);
    const filteredAppointments = appointments.filter(appointment => {
      return req.query.statuses.some(status => {
Severity: Minor
Found in src/applications/vaos/services/mocks/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 EstimatedBenefits has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

export default function EstimatedBenefits({
  outputs,
  calculator,
  isOJT,
  dispatchShowModal,
Severity: Minor
Found in src/applications/gi/components/profile/EstimatedBenefits.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 ReviewPage has 77 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const ReviewPage = props => {
  const [privacyCheckbox, setPrivacyCheckbox] = useState(false);
  const [submitted, setSubmitted] = useState(false);

  const { chapterTitles, getChapterPagesFromChapterIndex } = setupPages();
Severity: Major
Found in src/applications/appeals/testing/nod-new/components/ReviewPage.jsx - About 3 hrs to fix

    Function FindVaForms has 77 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export const FindVaForms = () => {
      return (
        <>
          <SearchForm />
          <SearchResults />
    Severity: Major
    Found in src/applications/find-forms/components/FindVaForms.jsx - About 3 hrs to fix

      File form.js has 295 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import React from 'react';
      import footerContent from '@department-of-veterans-affairs/platform-forms/FormFooter';
      import environment from '@department-of-veterans-affairs/platform-utilities/environment';
      
      import {
      Severity: Minor
      Found in src/applications/simple-forms/21-0972/config/form.js - About 3 hrs to fix

        Function SignatureInput has 77 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const SignatureInput = props => {
          const {
            fullName,
            required,
            label,

          Function submitTransformer has 77 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const submitTransformer = (formConfig, form) => {
            const { data: formData } = form;
            const primaryKey = formData['view:hasPrimaryCaregiver'] ? 'primary' : null;
            const SecondaryOneKey = formData['view:hasSecondaryCaregiverOne']
              ? 'secondaryOne'
          Severity: Major
          Found in src/applications/caregivers/config/submit-transformer.js - About 3 hrs to fix

            Function CareSummariesAndNotes has 77 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const CareSummariesAndNotes = () => {
              const dispatch = useDispatch();
              const updatedRecordList = useSelector(
                state => state.mr.careSummariesAndNotes.updatedList,
              );

              Function FillRefillButton has 77 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const FillRefillButton = rx => {
                const dispatch = useDispatch();
              
                const { dispensedDate, error, prescriptionId, success, isRefillable } = rx;
              
              

                File AutosuggestField.jsx has 294 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import React from 'react';
                import PropTypes from 'prop-types';
                import Downshift from 'downshift';
                import classNames from 'classnames';
                import set from '../../../../utilities/data/set';
                Severity: Minor
                Found in src/platform/forms-system/src/js/fields/AutosuggestField.jsx - About 3 hrs to fix

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

                  ConfirmationPage.defaultProps = {
                    fullName: {
                      first: '',
                      last: '',
                    },
                  src/applications/disability-benefits/2346/containers/ConfirmationPage.jsx on lines 294..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 96.

                  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

                  ConfirmationPage.defaultProps = {
                    fullName: {
                      first: '',
                      last: '',
                    },
                  src/applications/health-care-supply-reordering/containers/ConfirmationPage.jsx on lines 294..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 96.

                  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 addToGuesses(name, offsets) {
                      var i, offset;
                      arrayToInt(offsets);
                      for (i = 0; i < offsets.length; i++) {
                        offset = offsets[i];
                  Severity: Major
                  Found in src/applications/personalization/dashboard/lib/moment-tz.js and 1 other location - About 3 hrs to fix
                  src/applications/vaos/lib/moment-tz.js on lines 300..308

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

                  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

                          docExplanation={
                            <>
                              <p>In the future, you might need:</p>
                              <ul>
                                <li>Your reserve kicker</li>
                  src/applications/edu-benefits/1990/containers/ConfirmationPage.jsx on lines 43..59

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

                  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

                    data: PropTypes.shape({
                      personalData: PropTypes.shape({
                        veteranContactInformation: PropTypes.shape({
                          mobilePhone: PropTypes.shape({
                            countryCode: PropTypes.string,
                  src/applications/financial-status-report/components/contactInfo/ContactInfo.jsx on lines 256..267

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

                  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

                  Severity
                  Category
                  Status
                  Source
                  Language