coronasafe/care_fe

View on GitHub
src/pages/Patients/VerifyPatient.tsx

Summary

Maintainability
F
3 days
Test Coverage

Showing 7 of 7 total issues

Function VerifyPatient has 247 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function VerifyPatient(props: { facilityId: string }) {
const { t } = useTranslation();
const [qParams] = useQueryParams();
const { phone_number, year_of_birth, partial_id } = qParams;
const { goBack } = useAppHistory();
Severity: Major
Found in src/pages/Patients/VerifyPatient.tsx - About 1 day to fix

Function VerifyPatient has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

export default function VerifyPatient(props: { facilityId: string }) {
const { t } = useTranslation();
const [qParams] = useQueryParams();
const { phone_number, year_of_birth, partial_id } = qParams;
const { goBack } = useAppHistory();
Severity: Minor
Found in src/pages/Patients/VerifyPatient.tsx - About 3 hrs to fix

File VerifyPatient.tsx has 280 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { useMutation, useQuery } from "@tanstack/react-query";
import { AlertCircle, CalendarIcon } from "lucide-react";
import { Link, useQueryParams } from "raviger";
import { useEffect } from "react";
import { useTranslation } from "react-i18next";
Severity: Minor
Found in src/pages/Patients/VerifyPatient.tsx - About 2 hrs to fix

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

<div className="relative flex w-full items-center gap-3 md:gap-4">
<div className="flex size-10 md:size-12 items-center justify-center rounded-xl bg-primary/10 group-hover:bg-primary/20 transition-colors">
<CareIcon
icon="l-stethoscope"
className="size-5 md:size-6 text-primary"
Severity: Major
Found in src/pages/Patients/VerifyPatient.tsx and 1 other location - About 5 hrs to fix
src/components/Patient/PatientDetailsTab/EncounterHistory.tsx on lines 87..106

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

<div className="flex flex-col items-center justify-center p-6 md:p-8 text-center border rounded-lg border-dashed">
<div className="rounded-full bg-primary/10 p-2 md:p-3 mb-3 md:mb-4">
<CareIcon
icon="l-folder-open"
className="size-5 md:size-6 text-primary"
Severity: Major
Found in src/pages/Patients/VerifyPatient.tsx and 1 other location - About 3 hrs to fix
src/components/Questionnaire/QuestionnaireList.tsx on lines 50..60

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

onError: (error) => {
const errorData = error.cause as { errors: { msg: string[] } };
errorData.errors.msg.forEach((er) => {
toast.error(er);
});
Severity: Major
Found in src/pages/Patients/VerifyPatient.tsx and 4 other locations - About 2 hrs to fix
src/pages/Facility/settings/organizations/components/EditFacilityUserRoleSheet.tsx on lines 88..93
src/pages/Facility/settings/organizations/components/EditFacilityUserRoleSheet.tsx on lines 112..117
src/pages/Organization/components/EditUserRoleSheet.tsx on lines 88..93
src/pages/Organization/components/EditUserRoleSheet.tsx on lines 108..113

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

const { data: facilityData, isLoading: facilityLoading } = useQuery({
queryKey: ["facility", props.facilityId],
queryFn: query(routes.getPermittedFacility, {
pathParams: { id: props.facilityId },
}),
Severity: Major
Found in src/pages/Patients/VerifyPatient.tsx and 1 other location - About 1 hr to fix
src/pages/Appointments/AppointmentDetail.tsx on lines 87..94
Category
Status