EscolaLMS/Front

View on GitHub

Showing 162 of 559 total issues

Function useSubscriptions has 71 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const useSubscriptions = () => {
  const {
    fetchProducts,
    fetchMyProducts,
    products,
Severity: Major
Found in src/hooks/useSubscriptions.ts - About 2 hrs to fix

    Function StaticPage has 71 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const StaticPage = () => {
      const { slug } = useParams<{ slug: string }>();
      const { fetchPage, page, fetchPages, pages } = useContext(EscolaLMSContext);
    
      const prevSlug = usePrevious(slug);
    Severity: Major
    Found in src/pages/static-page/index.tsx - About 2 hrs to fix

      Function ConsultationsSlider has 70 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const ConsultationsSlider: React.FC<ConsultationsSliderProps> = (props) => {
        const {
          category,
          title = category,
          consultations,
      Severity: Major
      Found in src/components/Consultations/ConsultationsSlider/index.tsx - About 2 hrs to fix

        Function EventRelatedEvents has 69 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const EventRelatedEvents = () => {
          const { stationaryEvents } = useContext(EscolaLMSContext);
          const { t } = useTranslation();
          const data = stationaryEvents.list?.data;
        
        
        Severity: Major
        Found in src/components/Events/Event/EventRelatedEvents/index.tsx - About 2 hrs to fix

          Function Tags has 68 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const Tags = (props: TagsProps) => {
            const { tags, onTagClick } = props;
            const theme = useTheme();
            const [open, setOpen] = useState(false);
            const firstTags = tags ? [...tags].splice(0, 2) : [];
          Severity: Major
          Found in src/components/Tags/index.tsx - About 2 hrs to fix

            Function CategoriesBreadCrumbs has 66 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const CategoriesBreadCrumbs = (props: CategoriesProps) => {
              const { categories, onCategoryClick } = props;
              // const [open, setOpen] = useState(false);
              const parentRef = useRef<HTMLDivElement | null>(null);
              const firstCategories = categories || [];
            Severity: Major
            Found in src/components/Categories/CategoriesBreadCrumbs/index.tsx - About 2 hrs to fix

              Function ProfileCertificates has 65 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const ProfileCertificates: React.FC = () => {
                const { certificates, fetchCertificates } = useContext(EscolaLMSContext);
                const { t } = useTranslation();
              
                const { downloadCertificate, loadingId } = useCertificateDownload();
              Severity: Major
              Found in src/components/Profile/ProfileCertificates/index.tsx - About 2 hrs to fix

                Function CourseMainInfo has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                Open

                export const CourseMainInfo: FC<CourseMainInfoProps> = ({ courseData }) => {
                  const { fetchQuestionnaireStarsByModel } = useContext(EscolaLMSContext);
                  const [state, setState] = useState<State>({ type: StateTypes.INIT });
                  const history = useHistory();
                
                
                Severity: Minor
                Found in src/pages/courses/course/Components/CourseMainInfo/index.tsx - About 2 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 usePayment has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                Open

                const usePayment = () => {
                  const {
                    user,
                    cart,
                    fetchCart,
                Severity: Minor
                Found in src/hooks/usePayment.ts - About 2 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 MyConsultationsPage has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                const MyConsultationsPage = () => {
                  const { t } = useTranslation();
                  const { isTutor } = useRoles();
                
                  const myConsultationsTabs = useMemo(
                Severity: Major
                Found in src/pages/user/my-consultations.tsx - About 2 hrs to fix

                  Function VerifyEmail has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  const VerifyEmail: React.FC = () => {
                    const { push } = useHistory();
                    const { search } = useLocation();
                    const id = search && search?.split("&")[0]?.split("=")[1];
                    const hash = search && search?.split("&")[1]?.split("=")[1];
                  Severity: Major
                  Found in src/pages/verify-email/index.tsx - About 2 hrs to fix

                    Function EventsHeaderFilters has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    const EventsHeaderFilters = () => {
                      const { params, setParams } = useContext(EventsContext);
                      const location = useLocation();
                      const parsedParams = qs.parse(location.search, {
                        arrayFormat: "bracket",
                    Severity: Major
                    Found in src/components/Events/List/EventsHeader/Filters/index.tsx - About 2 hrs to fix

                      Function PackagesHeaderFilters has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      const PackagesHeaderFilters = () => {
                        const { params, setParams } = useContext(PackagesContext);
                        const location = useLocation();
                        const parsedParams = qs.parse(location.search, {
                          arrayFormat: "bracket",
                      Severity: Major
                      Found in src/components/Packages/List/PackagesHeader/Filters/index.tsx - About 2 hrs to fix

                        File index.tsx has 269 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 2 hrs to fix

                          Function WebinarsHeaderFilters has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          const WebinarsHeaderFilters = () => {
                            const { params, setParams } = useContext(WebinarsContext);
                            const location = useLocation();
                            const parsedParams = qs.parse(location.search, {
                              arrayFormat: "bracket",
                          Severity: Major
                          Found in src/components/Webinars/List/WebinarsHeader/Filters/index.tsx - About 2 hrs to fix

                            Function CoursesDetailsSidebar has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                            Open

                            const CoursesDetailsSidebar: React.FC<Props> = ({
                              course,
                              onRequestAccess,
                            }) => {
                              const { user, courseAccess } = useContext(EscolaLMSContext);

                            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 Przelewy24Content has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                            Open

                            const Przelewy24Content = () => {
                              const {
                                user,
                                processing,
                                discountStatus,
                            Severity: Minor
                            Found in src/components/Cart/CartContent/p24.tsx - About 2 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

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

                            import { EscolaLMSContext } from "@escolalms/sdk/lib/react";
                            import {
                              useCallback,
                              useContext,
                              useEffect,
                            Severity: Minor
                            Found in src/components/Onboarding/index.tsx - About 2 hrs to fix

                              Function CourseSidebar has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                              Open

                              }> = ({ course, topicId, onCompleteTopic, onCourseFinish }) => {
                                const { progress } = useLessonProgram(course);
                                const {
                                  courseProgressDetails,
                                  user,
                              Severity: Minor
                              Found in src/components/Courses/Course/CourseSidebar/index.tsx - About 2 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 StripeContent has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                              Open

                              const StripeContent = ({ stripeKey }: { stripeKey: string }) => {
                                const {
                                  processing,
                                  setProcessing,
                                  discountStatus,
                              Severity: Minor
                              Found in src/components/Cart/CartContent/stripe.tsx - About 2 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

                              Severity
                              Category
                              Status
                              Source
                              Language