department-of-veterans-affairs/vets-website

View on GitHub

Showing 12,672 of 12,672 total issues

Function data has 146 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  data: (state = initialState, action) => {
    switch (action.type) {
      case FETCH_EXCLUSION_PERIODS:
        return {
          ...state,
Severity: Major
Found in src/applications/my-education-benefits/reducers/index.js - About 5 hrs to fix

    Function createMockSuccessResponse has 146 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const createMockSuccessResponse = (
      token,
      demographicsNeedsUpdate = false,
      demographicsConfirmedAt = null,
      nextOfKinNeedsUpdate = false,

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

        render() {
          const { submission, data } = this.props.form;
          const { response } = submission;
          const veteranFirstName = data?.veteranInformation?.fullName?.first || '';
          const veteranLastName = data?.veteranInformation?.fullName?.last || '';

        Function GrossMonthlyIncomeInput has 146 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const GrossMonthlyIncomeInput = props => {
          const { goToPath, goBack, setFormData } = props;
        
          const editIndex = getJobIndex();
        
        

          Function VaccineDetails has 146 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const VaccineDetails = props => {
            const { runningUnitTest } = props;
            const record = useSelector(state => state.mr.vaccines.vaccineDetails);
            const vaccines = useSelector(state => state.mr.vaccines.vaccinesList);
            const user = useSelector(state => state.user.profile);
          Severity: Major
          Found in src/applications/mhv-medical-records/containers/VaccineDetails.jsx - About 5 hrs to fix

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

              render() {
                const {
                  uiSchema,
                  errorSchema,
                  idSchema,

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

                onBlur(id) {
                  if (!this.state.formContext.touched[id]) {
                    const data = getFormDataFromSchemaId(id, this.props.data);
                    const isEmpty = data === undefined || data === null || data === '';
                    // - Prefer to only set as touched if the field is NOT empty,
              Severity: Major
              Found in src/platform/forms-system/src/js/components/SchemaForm.jsx and 1 other location - About 5 hrs to fix
              src/applications/_mock-form-ae-design-patterns/patterns/pattern1/TaskPurple/SchemaForm.jsx on lines 107..121

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

              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

                onBlur(id) {
                  if (!this.state.formContext.touched[id]) {
                    const data = getFormDataFromSchemaId(id, this.props.data);
                    const isEmpty = data === undefined || data === null || data === '';
                    // - Prefer to only set as touched if the field is NOT empty,
              src/platform/forms-system/src/js/components/SchemaForm.jsx on lines 104..118

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

              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 evidenceUploadUI = {
                ...fileUiSchema(EvidenceUploadLabel, {
                  fileUploadUrl: `${environment.API_URL}/v1/decision_review_evidence`,
                  addAnotherLabel: 'Add another document',
                  buttonText: 'Upload document',
              src/applications/appeals/testing/nod-new/utils/additionalInfoUpload.js on lines 27..50

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

              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 additionalInfoUploadUI = {
                ...fileUiSchema(AdditionalInfoUploadLabel, {
                  fileUploadUrl: `${environment.API_URL}/v1/decision_review_evidence`,
                  addAnotherLabel: 'Add another document',
                  buttonText: 'Upload document',
              src/applications/appeals/testing/nod-new/utils/evidenceUpload.js on lines 27..50

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

              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 ANALYTICS_EVENTS = {
                openedPrivateRecordsAcknowledgment: {
                  event: 'disability-526EZ-form-help-text-clicked',
                  [HELP_TEXT_CLICKED_EVENT]:
                    'Disability - Form 4142 - Private Medical Records: Read the full text',
              Severity: Major
              Found in src/applications/disability-benefits/all-claims/constants.js and 1 other location - About 5 hrs to fix
              src/applications/financial-status-report/constants/reviewErrors.js on lines 42..79

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

              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 VRECounselorNotification = () => {
                useEffect(() => {
                  recordEvent({
                    event: `howToWizard-alert-displayed`,
                    'reason-for-alert': 'ineligibility - eligible for chapter 31',
              src/applications/vre/25-8832/wizard/pages/IneligibleNotice.jsx on lines 5..33

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

              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 errorMapping = {
                    questions: {
                      chapterKey: 'bankruptcyAttestationChapter',
                      pageKey: 'bankruptcyHistory',
                    },
              src/applications/disability-benefits/all-claims/constants.js on lines 238..284

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

              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 IneligibleNotice = () => {
                useEffect(() => {
                  recordEvent({
                    event: `howToWizard-notice-displayed`,
                    'reason-for-alert': 'ineligibility - not a service member or veteran',
              src/applications/vre/25-8832/wizard/pages/VRECounselorNotification.jsx on lines 5..34

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

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

                render() {
                  const { supplies, order, eligibility } = this.props;
                  const currentDate = moment();
                  const apneaSupplies = supplies.filter(
                    supply => supply.productGroup === APNEA,

                Function IntroductionPage has 144 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                const IntroductionPage = props => {
                  useEffect(() => {
                    focusElement('.schemaform-title > h1');
                    scrollToTop();
                    document.title =
                Severity: Major
                Found in src/applications/vre/28-1900/containers/IntroductionPage.jsx - About 5 hrs to fix

                  Function FacilitySearch has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
                  Open

                  const FacilitySearch = props => {
                    const { data: formData, goBack, goForward, goToPath } = props;
                    const [query, setQuery] = useState('');
                    const [submittedQuery, setSubmittedQuery] = useState('');
                    const [loading, setLoading] = useState(false);
                  Severity: Minor
                  Found in src/applications/caregivers/components/FormFields/FacilitySearch.jsx - About 5 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 SpouseEmploymentWorkDates has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
                  Open

                  const SpouseEmploymentWorkDates = props => {
                    const { goToPath, setFormData, data } = props;
                  
                    const RETURN_PATH = '/enhanced-spouse-employment-records';
                  
                  

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

                  const EmploymentWorkDates = props => {
                    const { goToPath, setFormData, data } = props;
                  
                    const RETURN_PATH = '/enhanced-employment-records';
                  
                  

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

                  export function transformVAOSAppointment(appt) {
                    const appointmentType = getAppointmentType(appt);
                    const isCC = appt.kind === 'cc';
                    const isVideo = appt.kind === 'telehealth';
                    const isAtlas = !!appt.telehealth?.atlas;
                  Severity: Minor
                  Found in src/applications/vaos/services/appointment/transformers.js - About 5 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

                  Severity
                  Category
                  Status
                  Source
                  Language