coronasafe/care_fe

View on GitHub

Showing 1,644 of 1,645 total issues

Function Sidebar has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

function Sidebar({
side = "left",
variant = "sidebar",
collapsible = "offcanvas",
className,
Severity: Minor
Found in src/components/ui/sidebar.tsx - About 35 mins to fix

Function PatientNavUser has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export function PatientNavUser() {
const { t } = useTranslation();
const { isMobile, open } = useSidebar();
const signOut = usePatientSignOut();
const patientUserContext = usePatientContext();
Severity: Minor
Found in src/components/ui/sidebar/nav-user.tsx - About 35 mins to fix

Function getMutationParams has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

function getMutationParams(
entityType: "encounter" | "location" | "device",
entityId: string,
facilityId: string,
isAdd: boolean,
Severity: Minor
Found in src/components/Patient/LinkDepartmentsSheet.tsx - About 35 mins to fix

Function EncounterQuestionnaire has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export default function EncounterQuestionnaire({
facilityId,
patientId,
encounterId,
questionnaireSlug,
Severity: Minor
Found in src/components/Patient/EncounterQuestionnaire.tsx - About 35 mins to fix

Function Appointments has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export const Appointments = (props: PatientProps) => {
const { patientData, facilityId } = props;
const patientId = patientData.id;
const { t } = useTranslation();
const { hasPermission } = usePermissions();
Severity: Minor
Found in src/components/Patient/PatientDetailsTab/Appointments.tsx - About 35 mins to fix

Function ConsentCard has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

function ConsentCard({ consent }: ConsentCardProps) {
const { t } = useTranslation();
 
const [loadPreview, setLoadPreview] = useState(false);
 
 
Severity: Minor
Found in src/components/Consent/ConsentSheet.tsx - About 35 mins to fix

Function QuestionnaireSearch has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export function QuestionnaireSearch({
placeholder,
onSelect,
subjectType,
disabled,
Severity: Minor
Found in src/components/Questionnaire/QuestionnaireSearch.tsx - About 35 mins to fix

Function useMediaDevicePermission has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export const useMediaDevicePermission = () => {
const toastShownRef = useRef(false);
const { t } = useTranslation();
 
const requestPermission = useCallback(
Severity: Minor
Found in src/Utils/useMediaDevicePermission.ts - About 35 mins to fix

Function callApi has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export async function callApi<Route extends ApiRoute<unknown, unknown>>(
{ baseUrl, path, method, noAuth }: Route,
options?: ApiCallOptions<Route>,
): Promise<Route["TRes"]> {
const url = `${baseUrl ?? careConfig.apiUrl}${makeUrl(path, options?.queryParams, options?.pathParams)}`;
Severity: Minor
Found in src/Utils/request/query.ts - About 35 mins to fix

Function formatPatientAge has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export const formatPatientAge = (
obj: PatientModel | Patient,
abbreviated = false,
) => {
const suffixes = getRelativeDateSuffix(abbreviated);
Severity: Minor
Found in src/Utils/utils.ts - About 35 mins to fix

Function EncounterCard has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export const EncounterCard = (props: EncounterCardProps) => {
const { t } = useTranslation();
 
const { encounter, permissions, facilityId } = props;
const { hasPermission } = usePermissions();
Severity: Minor
Found in src/components/Facility/EncounterCard.tsx - About 35 mins to fix

Function ObservationsList has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export default function ObservationsList(props: Props) {
const { t } = useTranslation();
const patientId = props.encounter.patient.id;
const encounterId = props.encounter.id;
const { ref, inView } = useInView();
Severity: Minor
Found in src/components/Facility/ConsultationDetails/ObservationsList.tsx - About 35 mins to fix

Function MessageItem has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

function MessageItem({
message,
...props
}: React.ComponentProps<"div"> & { message: Message }) {
const authUser = useAuthUser();
Severity: Minor
Found in src/pages/Encounters/tabs/EncounterNotesTab.tsx - About 35 mins to fix

Function DeviceEncounterHistory has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const DeviceEncounterHistory = ({ facilityId, deviceId, trigger }: Props) => {
const { t } = useTranslation();
 
const { data: encountersData, isLoading } = useQuery({
queryKey: ["deviceEncounterHistory", facilityId, deviceId],
Severity: Minor
Found in src/pages/Facility/settings/devices/DeviceEncounterHistory.tsx - About 35 mins to fix

Function DeviceServiceHistory has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export default function DeviceServiceHistory({
facilityId,
deviceId,
}: DeviceServiceHistoryProps) {
const { t } = useTranslation();
Severity: Minor
Found in src/pages/Facility/settings/devices/components/DeviceServiceHistory.tsx - About 35 mins to fix

Function DeviceCard has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export default function DeviceCard({ device, encounter }: Props) {
const { t } = useTranslation();
 
const getStatusColor = (status: string) => {
switch (status) {
Severity: Minor
Found in src/pages/Facility/settings/devices/components/DeviceCard.tsx - About 35 mins to fix

Function useLocationState has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

function useLocationState(
initialLocationId?: string,
facilityId?: string,
): LocationState & {
handleLocationSelect: (location: LocationListType) => void;
Severity: Minor
Found in src/pages/Facility/locations/LocationList.tsx - About 35 mins to fix

Function fillPatientDetails has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

fillPatientDetails(data: PatientFormData) {
this.enterName(data.name)
.enterPhoneNumber(data.phoneNumber)
.selectGender(data.gender)
.selectBloodGroup(data.bloodGroup);
Severity: Minor
Found in cypress/pageObject/Patients/PatientCreation.ts - About 35 mins to fix

Function PrintPrescription has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export const PrintPrescription = (props: {
facilityId: string;
encounterId: string;
patientId: string;
}) => {
Severity: Minor
Found in src/pages/Encounters/PrintPrescription.tsx - About 35 mins to fix

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

queryFn: query.paginated(medicationRequestApi.list, {
pathParams: { patientId },
queryParams: { encounter: encounterId },
pageSize: 100,
}),
Severity: Minor
Found in src/components/Patient/TreatmentSummary.tsx and 2 other locations - About 35 mins to fix
src/components/Medicine/MedicationAdministration/PrintMedicationAdministration.tsx on lines 52..58
src/components/Patient/TreatmentSummary.tsx on lines 110..114
Severity
Category
Status
Source
Language