EscolaLMS/Front

View on GitHub

Showing 173 of 585 total issues

File index.tsx has 1897 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { SVGProps } from "react";

export const HamburguerIcon = () => {
  return (
    <svg
Severity: Major
Found in src/icons/index.tsx - About 5 days to fix

    File i18n.ts has 1464 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import i18n from "i18next";
    import { initReactI18next } from "react-i18next";
    import { resources as ComponentTranslations } from "@escolalms/components/lib/styleguide/i18n";
    
    // the translations
    Severity: Major
    Found in src/i18n.ts - About 3 days to fix

      Function Navbar has 474 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const Navbar = () => {
        const { t } = useTranslation();
        const {
          showModal,
          closeModal,
      Severity: Major
      Found in src/components/_App/Navbar/index.tsx - About 2 days to fix

        File index.tsx has 712 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import { useContext, useEffect, useMemo, useState } from "react";
        
        import { EscolaLMSContext } from "@escolalms/sdk/lib/react/context";
        import { Navigation } from "@escolalms/components/lib/components/molecules/Navigation/Navigation";
        import { Avatar } from "@escolalms/components/lib/components/atoms/Avatar/Avatar";
        Severity: Major
        Found in src/components/_App/Navbar/index.tsx - About 1 day to fix

          Function getNotificationTranslationObject has 270 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export const getNotificationTranslationObject = (
            notification: Notification
          ): {
            translation: string;
            object?: { name?: string; amount?: number; date?: string; user?: string };
          Severity: Major
          Found in src/utils/index.ts - About 1 day to fix

            Function Przelewy24Content has 181 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const Przelewy24Content = () => {
              const {
                user,
                processing,
                discountStatus,
            Severity: Major
            Found in src/components/Cart/CartContent/p24.tsx - About 7 hrs to fix

              Function CoursePage has 180 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const CoursePage = () => {
                const [questionnaires, setQuestionnaires] = useState<API.Questionnaire[]>([]);
                const [courseAccessModalVisible, setCourseAccessModalVisible] =
                  useState(false);
              
              
              Severity: Major
              Found in src/pages/courses/course/index.tsx - About 7 hrs to fix

                Function TutorPage has 169 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                const TutorPage = () => {
                  const { id } = useParams<{ id: string }>();
                  const { t } = useTranslation();
                  const { tutor, fetchTutor, courses, fetchCourses } =
                    useContext(EscolaLMSContext);
                Severity: Major
                Found in src/pages/tutors/tutor/index.tsx - About 6 hrs to fix

                  Function Onboarding has 151 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  const Onboarding = () => {
                    const { settings, fetchSettings, updateProfile, fetchProfile, user } =
                      useContext(EscolaLMSContext);
                    const { t, i18n } = useTranslation();
                    const history = useHistory();
                  Severity: Major
                  Found in src/components/Onboarding/index.tsx - About 6 hrs to fix

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

                    const ConsultationSidebar: React.FC<ConsultationSidebarProps> = (props) => {
                      const { consultation } = props;
                      const { cart, addToCart, user } = useContext(EscolaLMSContext);
                      const { t } = useTranslation();
                      const { push } = useHistory();
                    Severity: Major
                    Found in src/components/Consultations/Consultation/ConsultationSidebar.tsx - About 5 hrs to fix

                      Function RegisterPage has 141 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      const RegisterPage = () => {
                        const { search } = useLocation();
                        const { user, socialAuthorize } = useContext(EscolaLMSContext);
                        const [view, setView] = useState<"" | "success" | "register">("");
                        const [modalVisible, setModalVisible] = useState(false);
                      Severity: Major
                      Found in src/pages/register/index.tsx - About 5 hrs to fix

                        Function QuestionnairesModal has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
                        Open

                        export const QuestionnairesModal = ({
                          entityId,
                          entityModel,
                          onSuccesGetQuestionnaires,
                        }: Props) => {

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

                        const Footer = () => {
                          const { settings, fetchPages, pages, user } = useContext(EscolaLMSContext);
                          const { t, i18n } = useTranslation();
                          useEffect(() => {
                            fetchPages();
                        Severity: Major
                        Found in src/components/_App/Footer/index.tsx - About 5 hrs to fix

                          File index.ts has 364 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          import {
                            BulkNotificationSection,
                            EventTypes,
                            Notification,
                            Order,
                          Severity: Minor
                          Found in src/utils/index.ts - About 4 hrs to fix

                            Function WebinarSidebarButtons has 118 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            const WebinarSidebarButtons = () => {
                              const [buttonStatus, setButtonStatus] = useState<ButtonStatus>(
                                ButtonStatus.DEFAULT
                              );
                              const [showMeetModal, setShowMeetModal] = useState(false);
                            Severity: Major
                            Found in src/components/Webinars/Webinar/WebinarSidebar/Buttons/index.tsx - About 4 hrs to fix

                              Function usePayment has 117 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              const usePayment = () => {
                                const {
                                  user,
                                  cart,
                                  fetchCart,
                              Severity: Major
                              Found in src/hooks/usePayment.ts - About 4 hrs to fix

                                Function useFilter has 113 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                const useFilter = (entityType: EntityType = "courses") => {
                                  const coursesContext = useContext(CoursesContext);
                                  const consultationsContext = useContext(ConsultationsContext);
                                  const { fetchCategories, categoryTree } = useContext(EscolaLMSContext);
                                
                                
                                Severity: Major
                                Found in src/hooks/courses/useFilter.ts - About 4 hrs to fix

                                  Function Navbar has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                  const Navbar = () => {
                                    const { t } = useTranslation();
                                    const {
                                      showModal,
                                      closeModal,
                                  Severity: Minor
                                  Found in src/components/_App/Navbar/index.tsx - About 4 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 JitsyMeeting has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                  const JitsyMeeting: React.FC<Props> = ({
                                    jitsyData,
                                    term,
                                    consultationTermId,
                                    consultationId,
                                  Severity: Minor
                                  Found in src/components/Consultations/ConsultationCard/JitsyMeeting/index.tsx - About 4 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 useChatLogic has 110 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  const useChatLogic = (lessonID: number, token: string | null | undefined) => {
                                    if (!token) throw new Error("Token is required");
                                  
                                    const [chatState, setChatState] = useState<State>(INITIAL_STATE);
                                    const { t } = useTranslation();
                                  Severity: Major
                                  Found in src/hooks/chat/useChatLogic.ts - About 4 hrs to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language