department-of-veterans-affairs/vets-website

View on GitHub

Showing 12,811 of 12,811 total issues

Function ClaimDetailLayout has 98 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function ClaimDetailLayout(props) {
  const { claim, clearNotification, currentTab, loading, message } = props;

  const tabs = ['Status', 'Files', 'Details', 'Overview'];

Severity: Major
Found in src/applications/claims-status/components/ClaimDetailLayout.jsx - About 3 hrs to fix

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

      render() {
        const { claim, lastPage } = this.props;
        const { claimPhaseDates, evidenceWaiverSubmitted5103 } = claim.attributes;
    
        let content;

      Function reducer has 98 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export default function reducer(state = initialState, action = {}) {
        switch (action.type) {
          case FETCH_STARTED: {
            return { ...state, loadingStatus: LOADING_STATES.pending };
          }

        Function StepThree has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
        Open

        const StepThree = ({ formValues }) => {
          const reasonCode = formValues['4_reason'];
          const noPrevApp = formValues['8_prevApplication'] === '2';
          const prevAppType = formValues['10_prevApplicationType'];
          const prevAppYear = formValues['9_prevApplicationYear'];
        Severity: Minor
        Found in src/applications/discharge-wizard/components/gpSteps/StepThree.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 AppointmentListItem has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
        Open

        const AppointmentListItem = props => {
          const { appointment, goToDetails, router, app, page, count } = props;
          const { t } = useTranslation();
          const selectFeatureToggles = useMemo(makeSelectFeatureToggles, []);
          const { isMedicationReviewContentEnabled } = useSelector(

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

        export default function getNewAppointmentFlow(state) {
          const featureBreadcrumbUrlUpdate = selectFeatureBreadcrumbUrlUpdate(state);
          const flowType = getFlowType(state);
          const isSingleVaFacility = selectSingleSupportedVALocation(state);
        
        
        Severity: Minor
        Found in src/applications/vaos/new-appointment/newAppointmentFlow.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 ComparePage has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
        Open

        export function ComparePage({
          allLoaded,
          compare,
          dispatchFetchCompareDetails,
          dispatchRemoveCompareInstitution,
        Severity: Minor
        Found in src/applications/gi/containers/ComparePage.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 generateBlueButtonData has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
        Open

        export const generateBlueButtonData = ({
          labsAndTests,
          notes,
          vaccines,
          allergies,
        Severity: Minor
        Found in src/applications/mhv-medical-records/util/pdfHelpers/blueButton.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

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

        IntroductionPage.propTypes = {
          route: PropTypes.shape({
            formConfig: PropTypes.shape({
              prefillEnabled: PropTypes.bool.isRequired,
              savedFormMessages: PropTypes.object.isRequired,
        src/applications/simple-forms/20-10206/containers/IntroductionPage.jsx on lines 165..175
        src/applications/simple-forms/21-0966/containers/IntroductionPage.jsx on lines 207..217

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

        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

        IntroductionPage.propTypes = {
          route: PropTypes.shape({
            formConfig: PropTypes.shape({
              prefillEnabled: PropTypes.bool.isRequired,
              savedFormMessages: PropTypes.object.isRequired,
        src/applications/simple-forms/21-0845/containers/IntroductionPage.jsx on lines 160..170
        src/applications/simple-forms/21-0966/containers/IntroductionPage.jsx on lines 207..217

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

        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

        IntroductionPage.propTypes = {
          route: PropTypes.shape({
            formConfig: PropTypes.shape({
              prefillEnabled: PropTypes.bool.isRequired,
              savedFormMessages: PropTypes.object.isRequired,
        src/applications/simple-forms/20-10206/containers/IntroductionPage.jsx on lines 165..175
        src/applications/simple-forms/21-0845/containers/IntroductionPage.jsx on lines 160..170

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

        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

                  <ul>
                    <li>
                      You made a change in course enrollment, <strong>or</strong>
                    </li>
                    <li>
        src/applications/financial-status-report/constants/deduction-codes/index.js on lines 71..84

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

        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

          ZoneScore.prototype.scoreOffsetAt = function(offsetAt) {
            this.offsetScore += Math.abs(
              this.zone.utcOffset(offsetAt.at) - offsetAt.offset,
            );
            if (this.zone.abbr(offsetAt.at).replace(/[^A-Z]/g, '') !== offsetAt.abbr) {
        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 244..249

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

        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

                  <ul>
                    <li>
                      You made a change in course enrollment, <strong>or</strong>
                    </li>
                    <li>
        src/applications/combined-debt-portal/debt-letters/const/deduction-codes/index.js on lines 80..93

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

        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

          const addObjectKeys = (
            originalObject,
            keysToAdd,
            valuesToAdd,
            schemaType,
        src/applications/verify-your-enrollment/components/ChangeOfAddressForm.jsx on lines 125..145

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

        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

          const addObjectKeys = (
            originalObject,
            keysToAdd,
            valuesToAdd,
            schemaType,
        src/applications/personalization/profile/components/direct-deposit/vye/components/ChangeOfAddressForm.jsx on lines 140..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 113.

        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

            ZoneScore.prototype.scoreOffsetAt = function (offsetAt) {
                this.offsetScore += Math.abs(this.zone.utcOffset(offsetAt.at) - offsetAt.offset);
                if (this.zone.abbr(offsetAt.at).replace(/[^A-Z]/g, '') !== offsetAt.abbr) {
                    this.abbrScore++;
                }
        Severity: Major
        Found in src/applications/vaos/lib/moment-tz.js and 1 other location - About 3 hrs to fix
        src/applications/personalization/dashboard/lib/moment-tz.js on lines 254..261

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

        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="row form-progress-buttons schemaform-buttons">
                <div className="small-5 medium-4 columns">
                  <ProgressButton
                    buttonClass="hca-button-progress usa-button-secondary"
                    onButtonClick={goBack}
        src/applications/hca/components/FormPages/DisabilityConfirmation.jsx on lines 30..47

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

        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

                veteranBenefitSelectionCompensation: {
                  path: 'veteran-benefit-selection-compensation',
                  depends: formData =>
                    shouldSeeVeteranBenefitSelectionCompensation({ formData }),
                  title: formData => benefitSelectionChapterTitle({ formData }),
        Severity: Major
        Found in src/applications/simple-forms/21-0966/config/form.js and 1 other location - About 3 hrs to fix
        src/applications/simple-forms/21-0966/config/form.js on lines 177..190

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

        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

                veteranBenefitSelectionPension: {
                  path: 'veteran-benefit-selection-pension',
                  depends: formData =>
                    shouldSeeVeteranBenefitSelectionPension({ formData }),
                  title: formData => benefitSelectionChapterTitle({ formData }),
        Severity: Major
        Found in src/applications/simple-forms/21-0966/config/form.js and 1 other location - About 3 hrs to fix
        src/applications/simple-forms/21-0966/config/form.js on lines 163..176

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

        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