coronasafe/care_fe

View on GitHub

Showing 1,568 of 1,569 total issues

File QuestionnaireEditor.tsx has 1652 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { zodResolver } from "@hookform/resolvers/zod";
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
import { t } from "i18next";
import {
ChevronDown,
Severity: Major
Found in src/components/Questionnaire/QuestionnaireEditor.tsx - About 4 days to fix

Function PatientRegistration has 753 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function PatientRegistration(
props: PatientRegistrationPageProps,
) {
const [{ phone_number }] = useQueryParams();
const { patientId, facilityId } = props;
Severity: Major
Found in src/components/Patient/PatientRegistration.tsx - About 3 days to fix

Function FilesTab has 633 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const FilesTab = (props: FilesTabProps) => {
const { patient, type, encounter } = props;
const { qParams, updateQuery, Pagination, resultsPerPage } = useFilters({
limit: 14,
});
Severity: Major
Found in src/components/Files/FilesTab.tsx - About 3 days to fix

File DiagnosisQuestion.tsx has 1044 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import {
DotsVerticalIcon,
MinusCircledIcon,
Pencil2Icon,
} from "@radix-ui/react-icons";
Severity: Major
Found in src/components/Questionnaire/QuestionTypes/DiagnosisQuestion.tsx - About 2 days to fix

Function Login has 523 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const Login = (props: LoginProps) => {
const { signIn, patientLogin, isAuthenticating } = useAuthContext();
const {
reCaptchaSiteKey,
urls,
Severity: Major
Found in src/components/Auth/Login.tsx - About 2 days to fix

File MedicationRequestQuestion.tsx has 1032 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { MinusCircledIcon, Pencil2Icon } from "@radix-ui/react-icons";
import { useQuery } from "@tanstack/react-query";
import { t } from "i18next";
import React, { useEffect, useState } from "react";
 
 

File AppointmentsPage.tsx has 1015 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import careConfig from "@careConfig";
import { CaretDownIcon, CheckIcon } from "@radix-ui/react-icons";
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
import {
addDays,
Severity: Major
Found in src/pages/Appointments/AppointmentsPage.tsx - About 2 days to fix

Function useFileManager has 457 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function useFileManager(
options: FileManagerOptions,
): FileManagerResult {
const { type: fileType, onArchive, onEdit, uploadedFiles } = options;
 
 
Severity: Major
Found in src/hooks/useFileManager.tsx - About 2 days to fix

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

{isMobile && showCategorySelection ? (
<>
<ValueSetSelect
system="system-condition-code"
placeholder={t("add_another_diagnosis")}
src/components/Questionnaire/QuestionTypes/SymptomQuestion.tsx on lines 720..789

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

{isMobile && showSymptomSelection ? (
<>
<ValueSetSelect
system="system-condition-code"
placeholder={t("add_another_symptom")}
Severity: Major
Found in src/components/Questionnaire/QuestionTypes/SymptomQuestion.tsx and 1 other location - About 2 days to fix
src/components/Questionnaire/QuestionTypes/DiagnosisQuestion.tsx on lines 566..637

Function PatientInfoCard has 437 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function PatientInfoCard(props: PatientInfoCardProps) {
const { patient, encounter, canWrite, disableButtons = false } = props;
const { t } = useTranslation();
 
return (
Severity: Major
Found in src/components/Patient/PatientInfoCard.tsx - About 2 days to fix

File EditScheduleTemplateSheet.tsx has 887 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { zodResolver } from "@hookform/resolvers/zod";
import { useMutation, useQueryClient } from "@tanstack/react-query";
import { isBefore, parse } from "date-fns";
import { Loader2, SaveIcon, Trash2Icon } from "lucide-react";
import { useState } from "react";
Severity: Major
Found in src/pages/Scheduling/components/EditScheduleTemplateSheet.tsx - About 2 days to fix

Function FilePreviewDialog has 426 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const FilePreviewDialog = (props: FilePreviewProps) => {
const {
show,
onClose,
file_state,
Severity: Major
Found in src/components/Common/FilePreviewDialog.tsx - About 2 days to fix

File QuestionnaireForm.tsx has 827 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { useMutation, useQuery } from "@tanstack/react-query";
import { t } from "i18next";
import { useNavigationPrompt } from "raviger";
import { useEffect, useState } from "react";
import { toast } from "sonner";
Severity: Major
Found in src/components/Questionnaire/QuestionnaireForm.tsx - About 1 day to fix

File PatientRegistration.tsx has 817 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { zodResolver } from "@hookform/resolvers/zod";
import { useMutation, useQuery } from "@tanstack/react-query";
import { InfoIcon } from "lucide-react";
import { navigate, useNavigationPrompt, useQueryParams } from "raviger";
import { useEffect, useMemo, useState } from "react";
Severity: Major
Found in src/components/Patient/PatientRegistration.tsx - About 1 day to fix

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

function QuestionResponseValue({ question, response }: QuestionResponseProps) {
if (!response) return null;
return (
<div>
<div className="text-xs text-gray-500">{question.text}</div>
src/components/Facility/ConsultationDetails/PrintQuestionnaireQuestionnaireResponses.tsx on lines 229..268

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

function QuestionResponseValue({ question, response }: QuestionResponseProps) {
if (!response) return null;
 
return (
<div>
src/components/Facility/ConsultationDetails/QuestionnaireResponsesList.tsx on lines 80..122

File AdministrationTab.tsx has 808 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"use client";
 
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
import { format, formatDistanceToNow } from "date-fns";
import { t } from "i18next";

Function PatientRegistration has 383 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function PatientRegistration(props: PatientRegistrationProps) {
const { staffId } = props;
const selectedSlot = JSON.parse(
localStorage.getItem("selectedSlot") ?? "",
) as TokenSlot;
Severity: Major
Found in src/pages/PublicAppointments/PatientRegistration.tsx - About 1 day to fix

Function LocationSheet has a Cognitive Complexity of 95 (exceeds 5 allowed). Consider refactoring.
Open

export function LocationSheet({
trigger,
history,
facilityId,
encounter,
Severity: Minor
Found in src/components/Location/LocationSheet.tsx - About 1 day to fix
Severity
Category
Status
Source
Language