EscolaLMS/Front

View on GitHub

Showing 173 of 585 total issues

Function Tasks has 108 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const Tasks = () => {
  const { t } = useTranslation();
  const [currentPage, setCurrentPage] = useState(1);
  const [lastPage, setLastPage] = useState(2);
  const previousDisabled = currentPage <= 1;
Severity: Major
Found in src/pages/user/MyTasks/index.tsx - About 4 hrs to fix

    Function useProfileCourses has 107 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const useProfileCourses = (filter = CourseStatus.ALL) => {
      const {
        fetchMyAuthoredCourses,
        myAuthoredCourses,
        fetchPaginatedProgress,
    Severity: Major
    Found in src/hooks/courses/useProfileCourses.ts - About 4 hrs to fix

      Function Orders has 107 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const Orders = () => {
        const { orders, fetchOrders, fetchOrderInvoice } =
          useContext(EscolaLMSContext);
      
        const { t } = useTranslation();
      Severity: Major
      Found in src/pages/user/my-orders.tsx - About 4 hrs to fix

        Function useLessonProgram has 104 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function useLessonProgram(
          program: API.CourseProgram,
          courseRouteName: string = "/course/"
        ) {
          const {
        Severity: Major
        Found in src/hooks/useLessonProgram.ts - About 4 hrs to fix

          Function CoursePanelProvider has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
          Open

          const CoursePanelProvider: React.FC<React.PropsWithChildren> = ({
            children,
          }) => {
            const {
              sendProgress,
          Severity: Minor
          Found in src/components/Courses/Course/Context/index.tsx - About 3 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 Routes has 93 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const Routes: React.FC = (): ReactElement => {
            const {
              home,
              // authentication,
              page,
          Severity: Major
          Found in src/components/Routes/index.tsx - About 3 hrs to fix

            Function Index has 92 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const Index = () => {
              const { categoryTree, settings, fetchCategories, user } =
                useContext(EscolaLMSContext);
            
              const history = useHistory();
            Severity: Major
            Found in src/pages/index.tsx - About 3 hrs to fix

              Function Consultation has 92 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const Consultation = () => {
                const { t } = useTranslation();
                const { id } = useParams<{ id: string }>();
                const { consultation, fetchConsultation, consultations } =
                  useContext(EscolaLMSContext);
              Severity: Major
              Found in src/components/Consultations/Consultation/index.tsx - About 3 hrs to fix

                Function PromotedCoursesSection has 89 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                const PromotedCoursesSection: React.FC = () => {
                  const { courses, loading } = useFetchCourses({
                    per_page: 8,
                  });
                
                
                Severity: Major
                Found in src/components/Courses/PromotedCoursesSection/index.tsx - About 3 hrs to fix

                  Function WebinarInfo has 86 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  const WebinarInfo = () => {
                    const { webinar } = useContext(EscolaLMSContext);
                    const { t } = useTranslation();
                  
                    if (!webinar.value) {
                  Severity: Major
                  Found in src/components/Webinars/Webinar/WebinarInfo/index.tsx - About 3 hrs to fix

                    Function ProfileCourses has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                    Open

                    const ProfileCourses = ({
                      filter = CourseStatus.ALL,
                    }: {
                      filter: CourseStatus;
                    }) => {
                    Severity: Minor
                    Found in src/components/Profile/ProfileCourses/index.tsx - About 3 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 ConsultationSidebar has a Cognitive Complexity of 24 (exceeds 5 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: Minor
                    Found in src/components/Consultations/Consultation/ConsultationSidebar.tsx - About 3 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 Onboarding has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                    Open

                    const Onboarding = () => {
                      const { settings, fetchSettings, updateProfile, fetchProfile, user } =
                        useContext(EscolaLMSContext);
                      const { t, i18n } = useTranslation();
                      const history = useHistory();
                    Severity: Minor
                    Found in src/components/Onboarding/index.tsx - About 3 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 ConsultationsContainer has 81 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    const ConsultationsContainer = () => {
                      const [mobileDrawerState, setMobileDrawerState] = React.useState<{
                        showDrawer: boolean;
                        type: keyof typeof MobileDrawerTypes;
                      }>({
                    Severity: Major
                    Found in src/components/Consultations/List/ConsultationsContainer/index.tsx - About 3 hrs to fix

                      Function EventInfo has 78 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      const EventInfo = () => {
                        const { stationaryEvent } = useContext(EscolaLMSContext);
                        const { t } = useTranslation();
                      
                        if (!stationaryEvent.value) {
                      Severity: Major
                      Found in src/components/Events/Event/EventInfo/index.tsx - About 3 hrs to fix

                        Function Footer has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                        Open

                        const Footer = () => {
                          const { settings, fetchPages, pages, user } = useContext(EscolaLMSContext);
                          const { t, i18n } = useTranslation();
                          useEffect(() => {
                            fetchPages();
                        Severity: Minor
                        Found in src/components/_App/Footer/index.tsx - About 3 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 CoursesCollection has 77 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        const CoursesCollection: React.FC = () => {
                          const [mobileDrawerState, setMobileDrawerState] = React.useState<{
                            showDrawer: boolean;
                            type: keyof typeof MobileDrawerTypes;
                          }>({
                        Severity: Major
                        Found in src/components/Courses/CoursesCollection/index.tsx - About 3 hrs to fix

                          Function useSearchParams has 77 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          export const useSearchParams = () => {
                            const { search, pathname } = useLocation();
                            const history = useHistory();
                          
                            const query = useMemo(() => new URLSearchParams(search), [search]);
                          Severity: Major
                          Found in src/hooks/useSearchParams.ts - About 3 hrs to fix

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

                            import React, {
                              useCallback,
                              useContext,
                              useEffect,
                              useMemo,
                            Severity: Minor
                            Found in src/components/Courses/Course/Context/index.tsx - About 3 hrs to fix

                              Function PackageInfo has 76 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              export const PackageInfo = () => {
                                const { product } = useContext(EscolaLMSContext);
                                const { t } = useTranslation();
                              
                                if (!product.value) {
                              Severity: Major
                              Found in src/components/Packages/Package/PackageInfo/index.tsx - About 3 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language